blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
201
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 7
100
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 260
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 11.4k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 80
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 8
9.86M
| extension
stringclasses 52
values | content
stringlengths 8
9.86M
| authors
sequencelengths 1
1
| author
stringlengths 0
119
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
344192cf2d35fe4a5b47e9c8c5d6cd4c80354b78 | 4bb83687710716d91b5da55054c04f430474ee52 | /src/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.h | 972985665fa4c671a7a6ba0afc2993f54ce439f1 | [] | no_license | geralex/SWG-NGE | 0846566a44f4460c32d38078e0a1eb115a9b08b0 | fa8ae0017f996e400fccc5ba3763e5bb1c8cdd1c | refs/heads/master | 2020-04-06T11:18:36.110302 | 2018-03-19T15:42:32 | 2018-03-19T15:42:32 | 157,411,938 | 1 | 0 | null | 2018-11-13T16:35:01 | 2018-11-13T16:35:01 | null | UTF-8 | C++ | false | false | 2,103 | h | //========================================================================
//
// SharedGroupObjectTemplate.h
//
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
//overwritten the next time the template definition is compiled. Do not
//make changes to code inside these blocks.
//
// copyright 2001 Sony Online Entertainment
//
//========================================================================
#ifndef _INCLUDED_SharedGroupObjectTemplate_H
#define _INCLUDED_SharedGroupObjectTemplate_H
#include "SharedUniverseObjectTemplate.h"
#include "sharedFoundation/DynamicVariable.h"
#include "sharedUtility/TemplateParameter.h"
class Vector;
typedef StructParam<ObjectTemplate> StructParamOT;
//@BEGIN TFD TEMPLATE REFS
//@END TFD TEMPLATE REFS
class SharedGroupObjectTemplate : public SharedUniverseObjectTemplate
{
public:
//@BEGIN TFD ID
enum
{
SharedGroupObjectTemplate_tag = TAG(S,G,R,P)
};
//@END TFD ID
public:
SharedGroupObjectTemplate(const std::string & filename);
virtual ~SharedGroupObjectTemplate();
virtual Tag getId(void) const;
virtual Tag getTemplateVersion(void) const;
virtual Tag getHighestTemplateVersion(void) const;
static void install(bool allowDefaultTemplateParams = true);
//@BEGIN TFD
public:
protected:
virtual void load(Iff &file);
private:
//@END TFD
private:
Tag m_templateVersion; // the template version
bool m_versionOk; // flag that the template version loaded is the one we expect
static bool ms_allowDefaultTemplateParams; // flag to allow defaut params instead of fataling
static void registerMe(void);
static ObjectTemplate * create(const std::string & filename);
// no copying
SharedGroupObjectTemplate(const SharedGroupObjectTemplate &);
SharedGroupObjectTemplate & operator =(const SharedGroupObjectTemplate &);
};
inline void SharedGroupObjectTemplate::install(bool allowDefaultTemplateParams)
{
ms_allowDefaultTemplateParams = allowDefaultTemplateParams;
//@BEGIN TFD INSTALL
SharedGroupObjectTemplate::registerMe();
//@END TFD INSTALL
}
#endif // _INCLUDED_SharedGroupObjectTemplate_H
| [
"[email protected]"
] | |
789a2829cfc6bcdb6f4dca510bc0928f6b0d64ba | e11fec2011295290742a9b305fcd4387a5d2426c | /teste_dois_botoes_MOTORES_3_E_4_INTERRUP_AO_3/teste_dois_botoes_MOTORES_3_E_4_INTERRUP_AO_3.ino | 7769522d796b7266b94c590ab249b31e499fa0d4 | [] | no_license | leohfigueiredo/Arduino | 5fbda0fc7efd25cd3b839ec65219f8ccfc1cf39d | f71dc86e07a9716e67634dceba7e2863c0020aab | refs/heads/master | 2021-04-27T19:06:07.146467 | 2020-09-07T22:00:00 | 2020-09-07T22:00:00 | 122,350,755 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,262 | ino | #include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Inicializa o display no endereco 0x3F
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
boolean start = true;
volatile boolean e_stop = false;
volatile boolean e_stop3 = false;
int botaoinicio = 3; // define pino 9 como entrada botao liga
int chaveSW2 = 4; // define botao 8 como botao desliga
int chaveSW3 = 5;
#define rele00 8 // rele motor 3
#define rele02 9 // rele motor 4
#define pin12 12
#define pin13 13
int estadorele00 = 1;
int estadorele02 = 1;
int estadorele08 = 1;
int i;
void setup() {
Serial.begin(9600);
delay(100);
lcd.begin (20,4);
pinMode (pin12,OUTPUT);
pinMode (pin13,OUTPUT);
pinMode (botaoinicio, INPUT); // define como entrada
pinMode (chaveSW2, INPUT); // define como entrada
pinMode (chaveSW3, INPUT_PULLUP); // define como entrada
pinMode (rele00, OUTPUT); // define como saida
pinMode (rele02, OUTPUT); // define como saida
attachInterrupt(0,e_stop_ISR, RISING);
digitalWrite(rele00, estadorele00);
digitalWrite(rele02, estadorele02);
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("ETO ESTERILIZACIONES");
delay(1000);
lcd.setCursor(0,1);
lcd.print("PROCESSO ETO");
delay(1000);
lcd.setCursor(0,2);
lcd.print(" INICIALIZADO ");
lcd.setCursor(0,3);
lcd.print("--****************--");
delay(5000);
delay(100);
//Faz o efeito de deslocamento para esquerda
for (i =0; i <20; i++){
lcd.scrollDisplayLeft();
delay(20); }
delay(1000);
//Faz o efeito de deslocamento para esquerda
for (i =0; i <20; i++){
lcd.scrollDisplayLeft();
delay(20); }
delay(3000);
tone(12,262,200); //DO
delay(1000);
tone(12,262,200); //DO
delay(1000);
tone(12,262,200); //DO
delay(1000);
tone(12,349,300); //FA
delay(1000);
}
void loop() {
if(start == true){
if(e_stop == false){
Serial.println("tudo ok");
delay(300);
}
else{
Serial.println("EMERGENCIA!!!! RESETAR ARDUINO");
digitalWrite (rele02, HIGH); // envia saida para nivel alto
digitalWrite (rele00,HIGH); // envia a saida para nivel baixo
delay (100);
lcd.clear();
lcd.setBacklight(HIGH);
lcd.setCursor(3,0);
lcd.print("EMERGENCIA!!!");
delay(100);
lcd.setCursor(3,1);
lcd.print("RESETAR ARDUINO");
lcd.setCursor(5,2);
lcd.print("!!!!!!!!!!!!!!!");
delay(100);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
tone(12,349,300); //FA RUÍDO ALARME
delay(1000);
}
}
int valorInicio = digitalRead (botaoinicio);// le o valor de botao
int valorSW2 = digitalRead (chaveSW2); // le o valor de botao1
int valorSW3 = digitalRead (chaveSW3); // le o valor de botao2
if (valorInicio == HIGH && valorSW2 == LOW && valorSW2 == LOW) {// Testa o estado dos botoes
digitalWrite (rele02, HIGH); // envia saida para nivel alto
digitalWrite (rele00,LOW); // envia a saida para nivel baixo
lcd.clear();
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("ETO ESTERILIZACIONES");
delay(1000);
lcd.setCursor(6,1);
lcd.print("MOTOR 3");
lcd.setCursor(6,2);
lcd.print("EN MARCHA");
delay(1000);
}
else
if (valorInicio == LOW){
digitalWrite (rele00,HIGH); // envia a saida para nivel baixo
digitalWrite (rele02,HIGH); // envia a saida para nivel baixo
}
if (valorInicio == LOW && valorSW2 == HIGH && valorSW2 == LOW) { // Testa saida dos botoes
digitalWrite (rele00,HIGH); // envia a saida para nivel alto
digitalWrite (rele02,LOW); // envia a saida para nivel baixo
lcd.clear();
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("ETO ESTERILIZACIONES");
delay(1000);
lcd.setCursor(6,1);
lcd.print("MOTOR 4");
lcd.setCursor(6,2);
lcd.print("EN MARCHA");
}
else
if (valorSW2 == LOW){
digitalWrite (rele00,HIGH); // envia a saida para nivel baixo
digitalWrite (rele02,HIGH); // envia a saida para nivel baixo
}
if (valorSW3 == HIGH && valorInicio == LOW && valorSW2 == LOW) { // Testa saida dos botoes
digitalWrite (rele00,LOW); // envia a saida para nivel baixo
digitalWrite (rele02,LOW); // envia a saida para nivel baixo
lcd.clear();
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("ETO ESTERILIZACIONES");
delay(1000);
lcd.setCursor(3,1);
lcd.print("MOTORES 3 E 4");
lcd.setCursor(6,2);
lcd.print("EN MARCHA");
}
else{
if (valorSW3 == LOW){
digitalWrite (rele00,HIGH); // envia a saida para nivel baixo
digitalWrite (rele02,HIGH); // envia a saida para nivel baixo
lcd.clear();
lcd.setBacklight(HIGH);
lcd.setCursor(6,0);
lcd.print("MOTORES");
lcd.setCursor(6,1);
lcd.print("APAGADOS");
delay(6000);
lcd.clear();
tone(12,349,300); //FA
delay(500);
tone(12,349,300); //FA
delay(500);
tone(12,349,300); //FA
delay(500);
tone(12,262,200); //DO
delay(500);
tone(12,262,200); //DO
delay(500);
tone(12,262,200); //DO
delay(500);
}
while(1);
}
}
void e_stop_ISR(void){
detachInterrupt(0);
e_stop = !e_stop;
}
| [
"[email protected]"
] | |
4df4b72b14509c6b9839bf1988682230ba66523d | 927b1ceac19262d5dfb71fdfe03dc2eb0471126a | /src/qt/signverifymessagedialog.cpp | 2ee132f776e9e952b65ae5ab7efc758fa10c187b | [
"MIT"
] | permissive | cryptovein/ZedCoin | 7f3c16a4d640eeb5f1767e1fdef0e49b4dda889b | b9a72b685e0b3be069b8e477fae9aec8ab619da8 | refs/heads/master | 2020-04-04T02:01:57.575672 | 2014-03-07T02:17:09 | 2014-03-07T02:17:09 | 17,498,769 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,694 | cpp | #include "signverifymessagedialog.h"
#include "ui_signverifymessagedialog.h"
#include "addressbookpage.h"
#include "base58.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include "wallet.h"
#include <string>
#include <vector>
#include <QClipboard>
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SignVerifyMessageDialog),
model(0)
{
ui->setupUi(this);
#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->addressIn_SM->setPlaceholderText(tr("Enter a ZedCoin address"));
ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));
ui->addressIn_VM->setPlaceholderText(tr("Enter a ZedCoin address"));
ui->signatureIn_VM->setPlaceholderText(tr("Enter ZedCoin signature"));
#endif
GUIUtil::setupAddressWidget(ui->addressIn_SM, this);
GUIUtil::setupAddressWidget(ui->addressIn_VM, this);
ui->addressIn_SM->installEventFilter(this);
ui->messageIn_SM->installEventFilter(this);
ui->signatureOut_SM->installEventFilter(this);
ui->addressIn_VM->installEventFilter(this);
ui->messageIn_VM->installEventFilter(this);
ui->signatureIn_VM->installEventFilter(this);
ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
}
SignVerifyMessageDialog::~SignVerifyMessageDialog()
{
delete ui;
}
void SignVerifyMessageDialog::setModel(WalletModel *model)
{
this->model = model;
}
void SignVerifyMessageDialog::setAddress_SM(QString address)
{
ui->addressIn_SM->setText(address);
ui->messageIn_SM->setFocus();
}
void SignVerifyMessageDialog::setAddress_VM(QString address)
{
ui->addressIn_VM->setText(address);
ui->messageIn_VM->setFocus();
}
void SignVerifyMessageDialog::showTab_SM(bool fShow)
{
ui->tabWidget->setCurrentIndex(0);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::showTab_VM(bool fShow)
{
ui->tabWidget->setCurrentIndex(1);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::on_addressBookButton_SM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_SM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_pasteButton_SM_clicked()
{
setAddress_SM(QApplication::clipboard()->text());
}
void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
{
/* Clear old signature to ensure users don't get confused on error with an old signature displayed */
ui->signatureOut_SM->clear();
CBitcoinAddress addr(ui->addressIn_SM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock());
if (!ctx.isValid())
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Wallet unlock was canceled."));
return;
}
CKey key;
if (!pwalletMain->GetKey(keyID, key))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_SM->document()->toPlainText().toStdString();
std::vector<unsigned char> vchSig;
if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signing failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_SM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signed.") + QString("</nobr>"));
ui->signatureOut_SM->setText(QString::fromStdString(EncodeBase64(&vchSig[0], vchSig.size())));
}
void SignVerifyMessageDialog::on_copySignatureButton_SM_clicked()
{
QApplication::clipboard()->setText(ui->signatureOut_SM->text());
}
void SignVerifyMessageDialog::on_clearButton_SM_clicked()
{
ui->addressIn_SM->clear();
ui->messageIn_SM->clear();
ui->signatureOut_SM->clear();
ui->statusLabel_SM->clear();
ui->addressIn_SM->setFocus();
}
void SignVerifyMessageDialog::on_addressBookButton_VM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_VM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
{
CBitcoinAddress addr(ui->addressIn_VM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
bool fInvalid = false;
std::vector<unsigned char> vchSig = DecodeBase64(ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid);
if (fInvalid)
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_VM->document()->toPlainText().toStdString();
CKey key;
if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig))
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature did not match the message digest.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
if (!(CBitcoinAddress(key.GetPubKey().GetID()) == addr))
{
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_VM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>"));
}
void SignVerifyMessageDialog::on_clearButton_VM_clicked()
{
ui->addressIn_VM->clear();
ui->signatureIn_VM->clear();
ui->messageIn_VM->clear();
ui->statusLabel_VM->clear();
ui->addressIn_VM->setFocus();
}
bool SignVerifyMessageDialog::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)
{
if (ui->tabWidget->currentIndex() == 0)
{
/* Clear status message on focus change */
ui->statusLabel_SM->clear();
/* Select generated signature */
if (object == ui->signatureOut_SM)
{
ui->signatureOut_SM->selectAll();
return true;
}
}
else if (ui->tabWidget->currentIndex() == 1)
{
/* Clear status message on focus change */
ui->statusLabel_VM->clear();
}
}
return QDialog::eventFilter(object, event);
}
| [
"[email protected]"
] | |
9ffac9f1d826ab1bbf92bf58abe9d1b9d78165c6 | 6bee9b8fd4a49715e33c76eb255d0fd4529c5d24 | /src/MPC.cpp | d766f88f72df41ecc8794bde9e4c6a4182fa994f | [
"MIT"
] | permissive | SebastianDrynda/CarND-MPC-Project-P10 | a727c210f53061fc13acde0feb599030e9f7f822 | 12373572d24ee0941bb23c03d342b1675db3b6bd | refs/heads/master | 2020-03-26T07:58:47.738002 | 2018-08-15T13:31:37 | 2018-08-15T13:31:37 | 144,680,433 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,051 | cpp | #include "MPC.h"
#include <cppad/cppad.hpp>
#include <cppad/ipopt/solve.hpp>
#include "Eigen-3.3/Eigen/Core"
using CppAD::AD;
// TODO: Set the timestep length and duration
size_t N = 10;
double dt = 0.1;
// This value assumes the model presented in the classroom is used.
//
// It was obtained by measuring the radius formed by running the vehicle in the
// simulator around in a circle with a constant steering angle and velocity on a
// flat terrain.
//
// Lf was tuned until the the radius formed by the simulating the model
// presented in the classroom matched the previous radius.
//
// This is the length from front to CoG that has a similar radius.
const double Lf = 2.67;
const double ref_cte = 0;
const double ref_epsi = 0;
const double ref_v = 70;
const size_t x_start = 0;
const size_t y_start = x_start + N;
const size_t psi_start = y_start + N;
const size_t v_start = psi_start + N;
const size_t cte_start = v_start + N;
const size_t epsi_start = cte_start + N;
const size_t delta_start = epsi_start + N;
const size_t a_start = delta_start + N - 1;
class FG_eval {
public:
// Fitted polynomial coefficients
Eigen::VectorXd coeffs;
FG_eval(Eigen::VectorXd coeffs) {
this->coeffs = coeffs;
}
typedef CPPAD_TESTVECTOR(AD<double>)ADvector;
void operator()(ADvector& fg, const ADvector& vars) {
// TODO: implement MPC
// `fg` a vector of the cost constraints, `vars` is a vector of variable values (state & actuators)
// NOTE: You'll probably go back and forth between this function and
// the Solver function below.
// The cost is stored is the first element of `fg`.
// Any additions to the cost should be added to `fg[0]`.
fg[0] = 0;
// The part of the cost based on the reference state.
for( int i = 0; i < N; i++ ) {
fg[0] += 3000*CppAD::pow(vars[cte_start + i] - ref_cte, 2);
fg[0] += 3000*CppAD::pow(vars[epsi_start + i] - ref_epsi, 2);
fg[0] += CppAD::pow(vars[v_start + i] - ref_v, 2);
}
// Minimize the use of actuators.
for (int i = 0; i< N - 1; i++) {
fg[0] += 5*CppAD::pow(vars[delta_start + i], 2);
fg[0] += 5*CppAD::pow(vars[a_start + i], 2);
// penalty for speed + steer
fg[0] += 700*CppAD::pow(vars[delta_start + i] * vars[v_start+i], 2);
}
// Minimize the value gap between sequential actuations.
// (how smooth the actuations are)
for (int i = 0; i < N - 2; i++) {
fg[0] += 200*CppAD::pow(vars[delta_start + i + 1] - vars[delta_start + i], 2);
fg[0] += 10*CppAD::pow(vars[a_start + i + 1] - vars[a_start + i], 2);
}
// Setup constraints
fg[1 + x_start] = vars[x_start];
fg[1 + y_start] = vars[y_start];
fg[1 + psi_start] = vars[psi_start];
fg[1 + v_start] = vars[v_start];
fg[1 + cte_start] = vars[cte_start];
fg[1 + epsi_start] = vars[epsi_start];
for (int t = 1; t < N; t++) {
// The state at time t+1 .
AD<double> x1 = vars[x_start + t];
AD<double> y1 = vars[y_start + t];
AD<double> psi1 = vars[psi_start + t];
AD<double> v1 = vars[v_start + t];
AD<double> cte1 = vars[cte_start + t];
AD<double> epsi1 = vars[epsi_start + t];
// The state at time t.
AD<double> x0 = vars[x_start + t - 1];
AD<double> y0 = vars[y_start + t - 1];
AD<double> psi0 = vars[psi_start + t - 1];
AD<double> v0 = vars[v_start + t - 1];
AD<double> cte0 = vars[cte_start + t - 1];
AD<double> epsi0 = vars[epsi_start + t - 1];
// Only consider the actuation at time t.
AD<double> delta0 = vars[delta_start + t - 1];
AD<double> a0 = vars[a_start + t - 1];
AD<double> f0 = coeffs[0] + coeffs[1] * x0 + coeffs[2] * CppAD::pow(x0, 2) + coeffs[3] * CppAD::pow(x0, 3);
AD<double> psides0 = CppAD::atan(coeffs[1] + 2 * coeffs[2] * x0 + 3 * coeffs[3] * CppAD::pow(x0, 2));
// Here's `x` to get you started.
// The idea here is to constraint this value to be 0.
//
// NOTE: The use of `AD<double>` and use of `CppAD`!
// This is also CppAD can compute derivatives and pass
// these to the solver.
// TODO: Setup the rest of the model constraints
fg[1 + x_start + t] = x1 - (x0 + v0 * CppAD::cos(psi0) * dt);
fg[1 + y_start + t] = y1 - (y0 + v0 * CppAD::sin(psi0) * dt);
fg[1 + psi_start + t] = psi1 - (psi0 - v0 / Lf * delta0 * dt);
fg[1 + v_start + t] = v1 - (v0 + a0 * dt);
fg[1 + cte_start + t] = cte1 - ((f0 - y0) + (v0 * CppAD::sin(epsi0) * dt));
fg[1 + epsi_start + t] = epsi1 - ((psi0 - psides0) - v0 / Lf * delta0 * dt);
}
}
};
//
// MPC class definition implementation.
//
MPC::MPC() {
}
MPC::~MPC() {
}
vector<double> MPC::Solve(Eigen::VectorXd state, Eigen::VectorXd coeffs) {
bool ok = true;
// size_t i;
typedef CPPAD_TESTVECTOR(double)Dvector;
const double x = state[0];
const double y = state[1];
const double psi = state[2];
const double v = state[3];
const double cte = state[4];
const double epsi = state[5];
// TODO: Set the number of model variables (includes both states and inputs).
// For example: If the state is a 4 element vector, the actuators is a 2
// element vector and there are 10 timesteps. The number of variables is:
//
// 4 * 10 + 2 * 9
const size_t n_vars = N * 6 + (N - 1) * 2;
// TODO: Set the number of constraints
const size_t n_constraints = N * 6;
// Initial value of the independent variables.
// SHOULD BE 0 besides initial state.
Dvector vars(n_vars);
for (int i = 0; i < n_vars; i++) {
vars[i] = 0;
}
Dvector vars_lowerbound(n_vars);
Dvector vars_upperbound(n_vars);
// TODO: Set lower and upper limits for variables.
// Set the initial variable values
// Set all non-actuators upper and lower limits
// to the max negative and positive values.
for (int i = 0; i < delta_start; i++) {
vars_lowerbound[i] = -1.0e19;
vars_upperbound[i] = 1.0e19;
}
// The upper and lower limits of delta are set to -25 to 25
// degrees (values in radians).
for (int i = delta_start; i < a_start; i++) {
vars_lowerbound[i] = -0.436332 * Lf;
vars_upperbound[i] = 0.43632 * Lf;
}
// Actuator limits.
for (int i = a_start; i < n_vars; i++) {
vars_lowerbound[i] = -1.0;
vars_upperbound[i] = 1.0;
}
// Lower and upper limits for the constraints
// Should be 0 besides initial state.
Dvector constraints_lowerbound(n_constraints);
Dvector constraints_upperbound(n_constraints);
for (int i = 0; i < n_constraints; i++) {
constraints_lowerbound[i] = 0;
constraints_upperbound[i] = 0;
}
constraints_lowerbound[x_start] = x;
constraints_lowerbound[y_start] = y;
constraints_lowerbound[psi_start] = psi;
constraints_lowerbound[v_start] = v;
constraints_lowerbound[cte_start] = cte;
constraints_lowerbound[epsi_start] = epsi;
constraints_upperbound[x_start] = x;
constraints_upperbound[y_start] = y;
constraints_upperbound[psi_start] = psi;
constraints_upperbound[v_start] = v;
constraints_upperbound[cte_start] = cte;
constraints_upperbound[epsi_start] = epsi;
// object that computes objective and constraints
FG_eval fg_eval(coeffs);
//
// NOTE: You don't have to worry about these options
//
// options for IPOPT solver
std::string options;
// Uncomment this if you'd like more print information
options += "Integer print_level 0\n";
// NOTE: Setting sparse to true allows the solver to take advantage
// of sparse routines, this makes the computation MUCH FASTER. If you
// can uncomment 1 of these and see if it makes a difference or not but
// if you uncomment both the computation time should go up in orders of
// magnitude.
options += "Sparse true forward\n";
options += "Sparse true reverse\n";
// NOTE: Currently the solver has a maximum time limit of 0.5 seconds.
// Change this as you see fit.
options += "Numeric max_cpu_time 0.5\n";
// place to return solution
CppAD::ipopt::solve_result<Dvector> solution;
// solve the problem
CppAD::ipopt::solve<Dvector, FG_eval>(options, vars, vars_lowerbound,
vars_upperbound, constraints_lowerbound,
constraints_upperbound, fg_eval,
solution);
// Check some of the solution values
ok &= solution.status == CppAD::ipopt::solve_result<Dvector>::success;
// Cost
// auto cost = solution.obj_value;
// std::cout << "Cost " << cost << std::endl;
// TODO: Return the first actuator values. The variables can be accessed with
// `solution.x[i]`.
//
// {...} is shorthand for creating a vector, so auto x1 = {1.0,2.0}
// creates a 2 element double vector.
vector<double> result;
result.push_back(solution.x[delta_start]);
result.push_back(solution.x[a_start]);
for (int i = 0; i < N - 2; i++) {
result.push_back(solution.x[x_start + i + 1]);
result.push_back(solution.x[y_start + i + 1]);
}
return result;
}
| [
"[email protected]"
] | |
05c62a294527454eff25e74da825ed5031d4a23f | 1897e0530fbee7fe72d85b5fb15089174ea36de0 | /ImageSDL2/ImageSDL2/main.cpp | a2c115a1fbe7831820ba4af81d258e09ae7fe76b | [] | no_license | kafkaphoenix/sdl2bitmap | 8944545dfcbb1739949b8143a5e3494cf787c03f | 867fc2b55b9cb6761bfc1a28fe3478022952e29d | refs/heads/master | 2021-06-18T09:06:30.196098 | 2017-06-13T17:22:38 | 2017-06-13T17:22:38 | 93,310,957 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | cpp | #include <SDL.h>
int main(int argc, char ** argv)
{
bool quit = false;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
SDL_Window * window = SDL_CreateWindow("SDL Displaying Image", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
SDL_Surface *image = SDL_LoadBMP("image.bmp");
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, image);
while (!quit)
{
SDL_WaitEvent(&event);
switch (event.type)
{
case SDL_QUIT:
quit = true;
break;
}
SDL_Rect dstrect = { 50, 50, 320 ,240 };
SDL_RenderCopy(renderer, texture, NULL, &dstrect);
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(texture);
SDL_FreeSurface(image);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
} | [
"[email protected]"
] | |
b2c81f40c7b698f7e9626b27e70a4fdb87ed994a | a202b62726204f62141ea0de4cdd29edf94281da | /demo/ios/Pods/hippy/ios/sdk/layout/MTTLayoutCache.h | 68402f67395bcc1c16c246d921e7925148adde08 | [
"MIT",
"Apache-2.0"
] | permissive | hippy-contrib/hippy-react-ui | 8145dd7d5fbdc9352e479f3ea1efbcc48cc90415 | e3446b75a098b6f200a2c56f32078ab3b83e0e28 | refs/heads/master | 2023-03-23T20:16:41.113313 | 2020-04-23T13:59:05 | 2020-04-23T13:59:05 | 258,219,692 | 8 | 0 | MIT | 2021-03-12T12:31:10 | 2020-04-23T13:46:26 | JavaScript | UTF-8 | C++ | false | false | 1,307 | h | /**
* Copyright (c) 2017-present, Tencent, Inc.
* All rights reserved.
* Author: ianwang <[email protected]>
* Created on: 2018-01-08
*/
#ifndef MTTLAYOUTCACHE_H_
#define MTTLAYOUTCACHE_H_
#include "MTTFlex.h"
#include <stdint.h>
typedef struct {
MTTSize availableSize;
MTTSize resultSize;
MeasureMode widthMeasureMode;
MeasureMode heightMeasureMode;
FlexLayoutAction layoutAction;
} MeasureResult;
#define MAX_MEASURES_COUNT 6
class MTTLayoutCache {
public:
MTTLayoutCache();
virtual ~MTTLayoutCache();
void cacheResult(MTTSize availableSize, MTTSize resultSize,
MTTSizeMode measureMode, FlexLayoutAction layoutAction);
MeasureResult* getCachedMeasureResult(MTTSize availableSize,MTTSizeMode measureMode,
FlexLayoutAction layoutAction,
bool isMeasureNode);
MeasureResult* getCachedLayout();
void clearCache();
protected:
void initCache();
MeasureResult* useLayoutCacheIfPossible(MTTSize availableSize, MTTSizeMode measureMode);
MeasureResult* useMeasureCacheIfPossible(MTTSize availableSize, MTTSizeMode measureMode,
FlexLayoutAction layoutAction,
bool isMeasureNode);
private:
MeasureResult cachedLayout;
MeasureResult cachedMeasures[MAX_MEASURES_COUNT];
uint32_t nextMeasureIndex;
};
#endif /* MTTLAYOUTCACHE_H_ */
| [
"[email protected]"
] | |
96313719299a7b445f286865c1d6d76848a692a8 | 8b4119aaf6bb9af99c2480493ffc44a29e23d8d5 | /Battleship/boat.h | 2ab7302a4b255989b741d9b0acd054214f78f22f | [] | no_license | ahhTyler/Battleship | 35031c592ac7396b9f1cd1109be1d9c53c5b61e4 | 2df4aed8882cb8004ce95a1f73874223e8163634 | refs/heads/master | 2016-09-06T18:24:52.903652 | 2015-05-26T16:03:31 | 2015-05-26T16:03:31 | 35,825,848 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 182 | h | #include "stdafx.h"
#include "board.h"
using namespace std;
class ship : public Board
{
public:
int length;
int width;
void createBoat(int _boat, int x, int y, int direction);
}; | [
"[email protected]"
] | |
742c2c624c60b403dbee7243cb6ce0ee5135442e | d2fb019e63eb66f9ddcbdf39d07f7670f8cf79de | /groups/bsl/bslscm/bslscm_versiontag.t.cpp | fcdc88f471b98cb4463c449665ccff9ae75739eb | [
"MIT"
] | permissive | gosuwachu/bsl | 4fa8163a7e4b39e4253ad285b97f8a4d58020494 | 88cc2b2c480bcfca19e0f72753b4ec0359aba718 | refs/heads/master | 2021-01-17T05:36:55.605787 | 2013-01-15T19:48:00 | 2013-01-15T19:48:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,181 | cpp | // bslscm_versiontag.t.cpp -*-C++-*-
#include <bslscm_versiontag.h>
#include <cstdlib> // atoi()
#include <cstring>
#include <cstdio>
using namespace BloombergLP;
//==========================================================================
// STANDARD BDE ASSERT TEST MACRO
//--------------------------------------------------------------------------
// NOTE: THIS IS A LOW-LEVEL COMPONENT AND MAY NOT USE ANY C++ LIBRARY
// FUNCTIONS, INCLUDING IOSTREAMS.
static int testStatus = 0;
static bool verbose = false;
static bool veryVerbose = false;
static void aSsErT(int c, const char *s, int i) {
if (c) {
std::fprintf(stderr, "Error " __FILE__ "(%d): %s (failed)\n", i, s);
if (testStatus >= 0 && testStatus <= 100) ++testStatus;
}
}
#define ASSERT(X) { aSsErT(!(X), #X, __LINE__); }
#define LOOP_ASSERT(I,X) { \
if (!(X)) { std::printf("%s: %d\n", #I, I); \
aSsErT(1, #X, __LINE__); } }
//--------------------------------------------------------------------------
//=============================================================================
// SEMI-STANDARD TEST OUTPUT MACROS
//-----------------------------------------------------------------------------
// #define P(X) cout << #X " = " << (X) << endl; // Print identifier and value.
#define Q(X) std::printf("<| " #X " |>\n"); // Quote identifier literally.
//#define P_(X) cout << #X " = " << (X) << ", " << flush; // P(X) without '\n'
#define L_ __LINE__ // current Line number
#define T_ std::printf("\t"); // Print a tab (w/o newline)
//=============================================================================
// USAGE EXAMPLE HELPER FUNCTIONS
//-----------------------------------------------------------------------------
int newFunction()
// Return 1
{
return 1;
}
// int OldFunction()
// Not defined and never called due to conditional compilation
//=============================================================================
// MAIN PROGRAM
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
int test = argc > 1 ? std::atoi(argv[1]) : 0;
verbose = (argc > 2);
veryVerbose = (argc > 3);
std::printf("TEST %s CASE %d\n", __FILE__, test);
switch (test) { case 0:
case 3: {
//--------------------------------------------------------------------
// TEST USAGE EXAMPLE
//
// Concern:
// That the usage example in the user documentation compiles and
// runs as expected.
//
// Plan:
// Use the exact text of the usage example from the user
// documentation, but change uses of 'assert' to 'ASSERT'.
//
// Testing:
// USAGE EXAMPLE
//--------------------------------------------------------------------
if (verbose) std::printf("\nTEST USAGE EXAMPLE"
"\n==================\n");
// At compile time, the version of BSL can be used to select an older or newer
// way to accomplish a task, to enable new functionality, or to accommodate an
// interface change. For example, if a function changed names (a rare
// occurrence, but disruptive when it does happen), disruption can be minimized
// by conditionally calling the old or new function name using conditional
// compilation. The '#if' directive compares 'BSL_VERSION' to a specified
// major, minor, and patch version 4 composed using 'BSL_MAKE_VERSION':
//..
#if BSL_VERSION > BSL_MAKE_VERSION(1, 2)
// Call 'newFunction' for BSL version 1.2 and later:
int result = newFunction();
#else
// Call 'oldFunction' for BSL older than version 1.2:
int result = oldFunction();
#endif
ASSERT(result);
//..
} break;
case 2: {
//--------------------------------------------------------------------
// TEST BSL_MAKE_VERSION MACRO
//
// Concerns:
// That BSL_MAKE_VERSION create a compile-time constant if its
// arguments are all compile-time constants.
// That BSL_MAKE_VERSION correctly composes a major, minor, and
// patch version number into a single integer. Each component can
// be in the range 0-99.
//
// Plan:
// Use the result of BSL_MAKE_VERSION as an array dimension to
// prove that it is a compile-time constant.
// Using ad-hoc data selection, create a number of version values
// using the 'BSL_MAKE_VERSION' macro and verify that the expected
// value matches the actual value.
//
// Testing:
// BSL_MAKE_VERSION(major, minor)
//--------------------------------------------------------------------
if (verbose) std::printf("\nTEST BSL_MAKE_VERSION MACRO"
"\n===========================\n");
#if 0
// Test that 'BSL_MAKE_VERSION(0,1,2)' is a compile-time constant.
static const char COMPILE_ASSERT[BSL_MAKE_VERSION(0,1,2)] = { 0 };
ASSERT(sizeof(COMPILE_ASSERT) == 102);
static struct {
int d_line;
int d_major;
int d_minor;
int d_patch;
int d_version;
} const DATA[] = {
//line major minor patch version
//---- ----- ----- ----- -------
{ L_, 0, 0, 0, 0 },
{ L_, 0, 0, 1, 1 },
{ L_, 0, 1, 0, 100 },
{ L_, 0, 1, 1, 101 },
{ L_, 1, 0, 0, 10000 },
{ L_, 1, 0, 1, 10001 },
{ L_, 1, 1, 0, 10100 },
{ L_, 12, 34, 56, 123456 },
{ L_, 99, 99, 99, 999999 },
{ L_, 9, 9, 9, 90909 },
{ L_, 10, 20, 30, 102030 }
};
static const int NUM_DATA = sizeof(DATA) / sizeof(*DATA);
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_line;
const int MAJOR = DATA[i].d_major;
const int MINOR = DATA[i].d_minor;
const int PATCH = DATA[i].d_patch;
const int EXP = DATA[i].d_version;
LOOP_ASSERT(LINE, EXP == BSL_MAKE_VERSION(MAJOR, MINOR, PATCH));
}
#endif
static const char COMPILE_ASSERT[BSL_MAKE_VERSION(0,1)] = { 0 };
ASSERT(sizeof(COMPILE_ASSERT) == 100);
static struct {
int d_line;
int d_major;
int d_minor;
int d_version;
} const DATA[] = {
//line major minor version
//---- ----- ----- -------
{ L_, 0, 0, 0 },
{ L_, 0, 1, 100 },
{ L_, 1, 0, 10000 },
{ L_, 1, 1, 10100 },
{ L_, 12, 34, 123400 },
{ L_, 99, 99, 999900 },
{ L_, 9, 9, 90900 },
{ L_, 10, 20, 102000 }
};
static const int NUM_DATA = sizeof(DATA) / sizeof(*DATA);
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_line;
const int MAJOR = DATA[i].d_major;
const int MINOR = DATA[i].d_minor;
const int EXP = DATA[i].d_version;
LOOP_ASSERT(LINE, EXP == BSL_MAKE_VERSION(MAJOR, MINOR));
}
} break;
case 1: {
//--------------------------------------------------------------------
// TEST VERSION CONSISTENCY
//
// Concerns:
// That BSL_VERSION corresponds to the two components
// BSL_VERSION_MAJOR and BSL_VERSION_MINOR
//
// Plan:
// Decompose BSL_VERSION into its three components and verify
// that they correspond to the defined macros.
//
// Testing:
// BSL_VERSION
// BSL_VERSION_MAJOR
// BSL_VERSION_MINOR
//--------------------------------------------------------------------
if (verbose) std::printf("\nTEST VERSION CONSISTENCY"
"\n========================\n");
int major = (BSL_VERSION / 10000) % 100;
int minor = (BSL_VERSION / 100) % 100;
ASSERT(BSL_VERSION_MAJOR == major);
ASSERT(BSL_VERSION_MINOR == minor);
} break;
default: {
std::fprintf(stderr, "WARNING: CASE `%d' NOT FOUND.\n", test);
testStatus = -1;
}
}
if (testStatus > 0) {
std::fprintf(stderr, "Error, non-zero test status = %d.\n",
testStatus);
}
return testStatus;
}
// ----------------------------------------------------------------------------
// Copyright (C) 2012 Bloomberg L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
| [
"[email protected]"
] | |
d816b188a26fbde223b7c8515374dec05c723951 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-codeguruprofiler/include/aws/codeguruprofiler/model/GetNotificationConfigurationResult.h | 57c4b202033db90252f0f76f2c4302a76d351045 | [
"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 | 2,487 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/codeguruprofiler/CodeGuruProfiler_EXPORTS.h>
#include <aws/codeguruprofiler/model/NotificationConfiguration.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace CodeGuruProfiler
{
namespace Model
{
/**
* <p>The structure representing the
* GetNotificationConfigurationResponse.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/codeguruprofiler-2019-07-18/GetNotificationConfigurationResponse">AWS
* API Reference</a></p>
*/
class AWS_CODEGURUPROFILER_API GetNotificationConfigurationResult
{
public:
GetNotificationConfigurationResult();
GetNotificationConfigurationResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
GetNotificationConfigurationResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The current notification configuration for this profiling group.</p>
*/
inline const NotificationConfiguration& GetNotificationConfiguration() const{ return m_notificationConfiguration; }
/**
* <p>The current notification configuration for this profiling group.</p>
*/
inline void SetNotificationConfiguration(const NotificationConfiguration& value) { m_notificationConfiguration = value; }
/**
* <p>The current notification configuration for this profiling group.</p>
*/
inline void SetNotificationConfiguration(NotificationConfiguration&& value) { m_notificationConfiguration = std::move(value); }
/**
* <p>The current notification configuration for this profiling group.</p>
*/
inline GetNotificationConfigurationResult& WithNotificationConfiguration(const NotificationConfiguration& value) { SetNotificationConfiguration(value); return *this;}
/**
* <p>The current notification configuration for this profiling group.</p>
*/
inline GetNotificationConfigurationResult& WithNotificationConfiguration(NotificationConfiguration&& value) { SetNotificationConfiguration(std::move(value)); return *this;}
private:
NotificationConfiguration m_notificationConfiguration;
};
} // namespace Model
} // namespace CodeGuruProfiler
} // namespace Aws
| [
"[email protected]"
] | |
c61f710b32716d8cd6a4029b7ac1bcec4490cf64 | 63ef2786b4ae49aa77ec0279065226a8ceea27e1 | /Steering Behaviors for Autonomous characters/src/my_viewer.h | 394c13a565cd8b19f27b54c529be084fcf5830c3 | [] | no_license | arjunprakash05/Computer_Animation_and_Simulation | fc3a8080326f001b1975b7ded6547a02bc51e787 | 657216fc4512d48fe44443cf04c57145b52761de | refs/heads/master | 2020-04-21T19:46:28.757142 | 2019-06-11T05:47:57 | 2019-06-11T05:47:57 | 169,819,185 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,518 | h | # pragma once
# include <sig/sn_group.h>
# include <sig/sn_points.h>
# include <sig/sn_lines.h>
# include <sigogl/ui_radio_button.h>
# include <sigogl/ui_slider.h>
# include <sigogl/ui_button.h>
# include <sigogl/ui_check_button.h>
# include <sigogl/ws_viewer.h>
# include "particle_system.h"
class MyViewer : public WsViewer
{ public: // scene and other data:
SnGroup* _root;
SnGroup* _spheres;
SnPoints* _points;
SnLines* _lines;
SnLines* _world;
GsArray<GsMat*> _positions;
float _sphereradius;
ParticleSystem* _psys;
int _nfaces;
SnGroup* _targets;
public: // ui:
UiButton* _init;
UiCheckButton* _run;
UiCheckButton* _seek;
UiCheckButton* _seek1;
UiCheckButton* _flee;
UiCheckButton* _persue;
UiCheckButton* _persue2;
UiCheckButton* _attack;
UiCheckButton* _gather;
UiCheckButton* _scenario1;
UiCheckButton* _scenario2;
UiCheckButton* _scenario3;
UiCheckButton* _scol;
UiCheckButton* _vcol;
UiCheckButton* _bounce;
UiSlider* _windslider;
UiSlider* _tscaleslider;
UiSlider* _crestslider;
UiCheckButton* _vvel;
UiCheckButton* _vworld;
UiCheckButton* _vsphere;
public:
MyViewer ( int x, int y, int w, int h, const char *l=0 );
~MyViewer ();
void build_ui ();
void sphere_radius ( float r ) { _sphereradius=r; }
void view ( bool vel, bool world, bool spheres );
void build_scene ( ParticleSystem& psys, int nfaces );
void update_scene ();
void run ();
public :
virtual int handle_scene_event ( const GsEvent &e );
virtual int uievent ( int e );
};
| [
"[email protected]"
] | |
64ce5431eae0aa9863b3ed5d77d21895aefc952c | ccab578b41a5a563344355164c2814fe47b86642 | /algorithm/jps.cpp | 2e1b47037db99029d4b0e815a84be3e9c770fa8b | [] | no_license | gavr97/path-search | 7e0c140591b2581b8c259812a8f4a16e7cb6e61c | 777ca510ee2564438b8566547a6c1c511592ad31 | refs/heads/master | 2021-09-24T22:05:08.959401 | 2018-10-15T14:00:54 | 2018-10-15T14:00:54 | 74,914,971 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,572 | cpp | #include "heuristics.h"
#include <ctime>
#include "../algorithm/jps.h"
void Jps::setLevelPath(Output &output)
{
output.isLowLevel = false;
}
std::vector<Node> Jps::getSuccessors(const Node &node, const Map &map) const
{
// p -> u -> v
std::vector<Node> successors;
unsigned ux = node.getX();
unsigned uy = node.getY();
unsigned px, py;
if (node != nodeStart) {
px = node.getParent()->getX();
py = node.getParent()->getY();
}
for (unsigned indDirection = 0; indDirection != dyVec.size(); ++indDirection) {
unsigned vx = ux + dxVec[indDirection];
unsigned vy = uy + dyVec[indDirection];
if (!map.isObstacle(vx, vy) && map.isAllowedFromTo(ux, uy, vx, vy))
{
if (node != nodeStart && !isNatural(px, py, ux, uy, vx, vy, map) &&
!isForced(px, py, ux, uy, vx, vy, map))
{
// prune;
continue;
}
std::pair<bool, Node> jumpRes = jump(ux, uy, dxVec[indDirection], dyVec[indDirection], map);
if (jumpRes.first && close.find(jumpRes.second) == close.end())
successors.push_back(jumpRes.second);
}
}
return successors;
}
bool Jps::isNatural(unsigned px, unsigned py, unsigned ux, unsigned uy, unsigned vx, unsigned vy, const Map &map) const
{
// p ->(dx1, dy1)-> u ->(dx2, dy2)-> v
if (map.isObstacle(vx, vy)) {
return false;
}
int dx1, dx2, dy1, dy2;
getCoordinats(px, py, ux, uy, vx, vy, dx1, dy1, dx2, dy2);
if (dx1 * dy1 != 0) { // from p to u diagonal move
return (px != vx && py != vy);
} else { // from p to u straight
return (dx1 == dx2 && dy1 == dy2);
}
}
bool Jps::isForced(unsigned px, unsigned py, unsigned ux, unsigned uy, unsigned vx, unsigned vy, const Map &map) const
{
// p ->(dx1, dy1)-> u ->(dx2, dy2)-> v
if (map.isObstacle(vx, vy)) {
return false;
}
int dx1, dx2, dy1, dy2;
getCoordinats(px, py, ux, uy, vx, vy, dx1, dy1, dx2, dy2);
if (dx1 * dy1 != 0) { // from p to u diagonal move
if ((px + 2 * dx1 == vx) && (py == vy) && map.isObstacle(px + dx1, py)) {
return true;
} else if ((py + 2 * dy1 == vy) && (px == vx) && map.isObstacle(px, py + dy1)) {
return true;
} else {
return false;
}
} else { // from p to u straight
if ((px + 2 * dx2 == vx) && (py + dy2 == vy) && map.isObstacle(px + dx2, py + dy2)) {
return true;
} else if ((py + 2 * dy2 == vy) && (px + dx2 == vx) && map.isObstacle(px + dx2, py + dy2)) {
return true;
} else {
return false;
}
}
}
std::pair<bool, Node> Jps::jump(unsigned ux, unsigned uy, int dx, int dy, const Map &map) const
{
unsigned vx = ux + dx;
unsigned vy = uy + dy;
if (map.isObstacle(vx, vy)) {
return {false, Node{0, 0}};
}
if (nodeFinish == Node{vx, vy}) {
return {true, Node{vx, vy}};
}
bool isThereForcedNeig = false;
for (unsigned indDirection = 0; indDirection != dyVec.size(); ++indDirection) {
unsigned zx = vx + dxVec[indDirection];
unsigned zy = vy + dyVec[indDirection];
if (isForced(ux, uy, vx, vy, zx, zy, map)) {
isThereForcedNeig = true;
break;
}
}
if (isThereForcedNeig) {
return {true, Node{vx, vy}};
}
if (dx * dy != 0) { // diagonal move from u to v
std::pair<bool, Node> jumpRes = jump(vx, vy, dx, 0, map);
if (jumpRes.first) {
return {true, Node{vx, vy}};
}
jumpRes = jump(vx, vy, 0, dy, map);
if (jumpRes.first) {
return {true, Node{vx, vy}};
}
}
return jump(vx, vy, dx, dy, map);
}
void Jps::getCoordinats(unsigned &px, unsigned &py, unsigned &ux, unsigned &uy, unsigned &vx, unsigned &vy,
int &dx1, int &dy1, int &dx2, int &dy2) const
{
// p ->(dx1, dy1)-> u ->(dx2, dy2)-> v
dx1 = ux - px;
dy1 = uy - py;
// now normalize towards 1
if (dx1 > 0)
dx1 = 1;
else if (dx1 < 0)
dx1 = -1;
if (dy1 > 0)
dy1 = 1;
else if (dy1 < 0)
dy1 = -1;
// respevtively
dx2 = vx - ux;
dy2 = vy - uy;
if (dx2 > 0)
dx2 = 1;
else if (dx2 < 0)
dx2 = -1;
if (dy2 > 0)
dy2 = 1;
else if (dy2 < 0)
dy2 = -1;
// consider parent to just near in right direction
px = ux - dx1;
py = uy - dy1;
} | [
"[email protected]"
] | |
5f7b00dbedb6a79658a15699b2948338b5ddb0a1 | 6ca2f2333123ed9dd96001b38c23833214bb066f | /sketch_sep06c/sketch_sep06c.ino | 711f93f5d3ead8d155425ca7efd65e2df430673d | [
"MIT"
] | permissive | nityanandaz/BotController | a29ef0e2e657c653316acc9e0ebf77cb41c1f78e | 034e00135d42c640666f70cbfe5b0b2726a6d89c | refs/heads/master | 2020-07-21T18:53:22.454451 | 2020-07-10T18:27:17 | 2020-07-10T18:27:17 | 206,948,909 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,205 | ino | #include <Adafruit_NeoPixel.h>
#include <EasyNeoPixels.h>
#include <Servo.h>
#include <IFX9201_XMC1300_StepperMotor.h>
/*
Alpha Wheel
*/
#define DIR_PIN 4 // Pin 9 is standard DIR Pin
#define STP_PIN 3 // Pin 10 is standard STP Pin
#define DIS_PIN 2 // Pin 11 is standard DIS Pin
const int StepsPerRevolution = 200 * 8; // change this to fit the total number of steps per revolution for your motor
Stepper_motor AlphaWheelStepper = Stepper_motor(StepsPerRevolution, DIR_PIN, STP_PIN, DIS_PIN);
/*
Spray Servo
*/
Servo SprayCanServo;
/*
Commands
*/
#define DONOTHING 0
#define SPRAY 1
#define ROTATECLOCKWISE 2
#define ROTATEANTICLOCKWISE 3
/*
Input
*/
String inputString = "";
int InputCommand = 0;
/*
Framework
*/
void setup()
{
// Spray Can
SprayCanServo.attach(6);
SprayCanServo.write(0);
// USB
Serial.begin(9600);
// Alpha Wheel
AlphaWheelStepper.begin(); // set pins' mode as OUTPUT, set default speed and enable the stepper motor
AlphaWheelStepper.setSpeed(10); //changed from 40
// LEDs
pinMode(10, OUTPUT);
setupEasyNeoPixels(11, 14);
}
void loop()
{
readInput();
executeCommand();
}
/*
Commands
*/
void spray()
{
// Actual
int pos = 0;
for (pos = 0; pos <= 60; pos += 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
SprayCanServo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
// delay(5000);
for (pos = 60; pos >= 0; pos -= 2) { // goes from 180 degrees to 0 degrees
SprayCanServo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
}
void lightOn()
{
digitalWrite(10, HIGH);
}
void lightOff()
{
digitalWrite(10, LOW);
}
void rotateClockwise()
{
AlphaWheelStepper.move_degree(14.4);
delay(1000);
}
void rotateAnticlockwise()
{
AlphaWheelStepper.move_degree(-14.4);
delay(1000);
}
/*
Input
*/
void readInput()
{
while (Serial.available() > 0)
{
int inChar = Serial.read();
if (isDigit(inChar))
{
// convert the incoming byte to a char and add it to the string:
inputString += (char)inChar;
}
// if you get a newline, print the string, then the string's value:
if (inChar == '\n')
{
InputCommand = (inputString.toInt());
Serial.print("Value: ");
Serial.println(InputCommand);
// clear the string for new input:
inputString = "";
}
}
}
void executeCommand()
{
switch (InputCommand)
{
case DONOTHING: break;
case SPRAY: spray(); break;
case ROTATECLOCKWISE: rotateClockwise(); break;
case ROTATEANTICLOCKWISE: rotateAnticlockwise(); break; // prefer
case 4: lightOn(); delay(5000); lightOff(); break;
default:
if (InputCommand < 200 && InputCommand > 100)
{
int steps = InputCommand % 100;
AlphaWheelStepper.move_degree(-14.4 * steps);
delay(1000);
}
break;
}
InputCommand = DONOTHING;
}
| [
"[email protected]"
] | |
4029ad1e24bf1564010fbc4030363ee10e2a2c3b | 30b2a6f387e889ef7bc323921a1a6c521fbc47d1 | /MetropolHotel/LogPassword.cpp | ade6162d169aae343ab00134c5d8e2b5ef477a5d | [] | no_license | aKovalchuk1999/HotelService | 1228745756f6db27f8141dbbf9cbfcfd99f7e87e | a44301a84dd2107ad305bd7885e3b150f43ad002 | refs/heads/master | 2020-03-26T08:07:30.505596 | 2018-08-14T07:51:35 | 2018-08-14T07:51:35 | 144,686,763 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 46 | cpp | #include "StdAfx.h"
#include "LogPassword.h"
| [
"[email protected]"
] | |
78f703c537e3fb5e250de0a7bb78d3420bae65d9 | 71907ad3b0c3790f8599b14e72df495ce94d1da6 | /IndependentEntrypoint.cpp | c5c4f06ecc22851c39ebfa4549c20dcb7b738c9d | [] | no_license | ohm314/cl_forward | 751b30a653a333ce25f68dd9dc3992de834752f4 | 2dd635fe3b069e10afd8d1a41cb0fb49db72525f | refs/heads/master | 2021-01-18T09:14:21.608168 | 2015-09-16T10:39:45 | 2015-09-16T10:39:45 | 42,575,834 | 0 | 1 | null | 2015-09-16T08:50:10 | 2015-09-16T08:50:09 | null | UTF-8 | C++ | false | false | 4,796 | cpp |
/**
* Autocontained cross-platform independent entrypoint
* for Gaudi offloaded algorithms.
*
* Intended for testing and debugging, completely decoupled
* from the Gaudi framework.
*
* author - Daniel Campora
* email - [email protected]
*
* June, 2014
* CERN
*/
#include <iostream>
#include <string>
#include <cstring>
#include <exception>
#include <fstream>
#include <cstdlib>
#include <vector>
#include <algorithm>
/**
* execute entrypoint of algorithm
* Same signature as offloaded gaudi-algorithm
*
* @param output
* @param input
*/
extern int independent_execute(
const std::vector<std::vector<unsigned char> >& input,
std::vector<std::vector<unsigned char> >& output);
/**
* Post execution entrypoint
* @param output
*/
extern void independent_post_execute(
const std::vector<std::vector<unsigned char> >& output);
void printUsage(char* argv[]){
std::cerr << "Usage: "
<< argv[0] << " <comma separated input filenames>"
<< std::endl;
}
/**
* Generic StrException launcher
*/
class StrException : public std::exception
{
public:
std::string s;
StrException(std::string ss) : s(ss) {}
~StrException() throw () {} // Updated
const char* what() const throw() { return s.c_str(); }
};
/**
* Checks file existence
* @param name
* @return
*/
bool fileExists (const std::string& name) {
if (FILE *file = fopen(name.c_str(), "r")) {
fclose(file);
return true;
} else {
return false;
}
}
/**
* Reads some data from an input file, following the
* specified format of choice
*
* Format expected in file:
*
* int funcNameLen
* char* funcName
* int dataSize
* char* data
*/
void readFileIntoVector(std::string filename, std::vector<unsigned char> & output){
// Check if file exists
if (!fileExists(filename)){
throw StrException("Error: File " + filename + " does not exist.");
}
std::ifstream infile (filename.c_str(), std::ifstream::binary);
// get size of file
infile.seekg(0, std::ifstream::end);
int size = infile.tellg();
infile.seekg(0);
// Read format expected:
// int funcNameLen
// char* funcName
// int dataSize
// char* data
int funcNameLen;
int dataSize;
std::vector<char> funcName;
char* pFuncNameLen = (char*) &funcNameLen;
char* pDataSize = (char*) &dataSize;
infile.read(pFuncNameLen, sizeof(int));
funcName.resize(funcNameLen);
infile.read(&(funcName[0]), funcNameLen);
infile.read(pDataSize, sizeof(int));
// read content of infile with a vector
output.resize(dataSize);
infile.read ((char*) &(output[0]), dataSize);
infile.close();
}
/**
* This is if the function is called on its own
* (ie. non-gaudi execution)
*
* In that case, the file input is expected.
* As a convention, multiple files would be specified
* with comma-separated values
*
* @param argc
* @param argv
* @return
*/
int main(int argc, char *argv[])
{
std::string filename;
int fileNumber = 1;
std::string delimiter = ",";
std::vector<std::vector<unsigned char> > input;
// Get params (getopt independent)
if (argc != 2){
printUsage(argv);
return 0;
}
filename = std::string(argv[1]);
// Check how many files were specified and
// call the entrypoint with the suggested format
if(filename.empty()){
std::cerr << "No filename specified" << std::endl;
printUsage(argv);
return -1;
}
size_t numberOfOcurrences = std::count(filename.begin(), filename.end(), ',') + 1;
input.resize(numberOfOcurrences);
int input_index = 0;
size_t posFound = filename.find(delimiter);
if (posFound != std::string::npos){
size_t prevFound = 0;
while(prevFound != std::string::npos){
if (posFound == std::string::npos){
readFileIntoVector(filename.substr(prevFound, posFound-prevFound), input[input_index]);
prevFound = posFound;
}
else {
readFileIntoVector(filename.substr(prevFound, posFound-prevFound), input[input_index]);
prevFound = posFound + 1;
posFound = filename.find(delimiter, posFound + 1);
}
input_index++;
}
}
else {
readFileIntoVector(filename, input[0]);
}
// Print out first byte from formatter->inputPointer
std::cout << input.size() << " files read" << std::endl;
// Call offloaded algo
std::vector<std::vector<unsigned char> > output;
independent_execute(input, output);
// Post execution entrypoint
independent_post_execute(output);
return 0;
}
| [
"[email protected]"
] | |
b3fe332665380d6d7aac889a1512266915d37926 | 8f02939917edda1e714ffc26f305ac6778986e2d | /BOJ/11066/main.cc | d90c597b2fa4b30c0d0c261b46aff4f87df0893f | [] | no_license | queuedq/ps | fd6ee880d67484d666970e7ef85459683fa5b106 | d45bd3037a389495d9937afa47cf0f74cd3f09cf | refs/heads/master | 2023-08-18T16:45:18.970261 | 2023-08-17T17:04:19 | 2023-08-17T17:04:19 | 134,966,734 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,070 | cc | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
////////////////////////////////////////////////////////////////
const int MAX_K = 505;
int K, A[MAX_K], S[MAX_K];
lld score[MAX_K][MAX_K];
void reset() {
for (int i = 0; i < MAX_K; i++) {
for (int j = 0; j < MAX_K; j++) {
score[i][j] = 0;
}
}
}
void input() {
cin >> K;
for (int i = 0; i < K; i++) {
cin >> A[i];
S[i + 1] = S[i] + A[i];
}
}
lld dp(int l, int r) {
if (l + 1 == r) { return 0; }
if (score[l][r] > 0) { return score[l][r]; }
lld minScore = LLONG_MAX;
for (int i = l + 1; i < r; i++) {
minScore = min(minScore, dp(l, i) + dp(i, r) + S[r] - S[l]);
}
score[l][r] = minScore;
return minScore;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
////////////////////////////////
int T; cin >> T;
for (int i = 0; i < T; i++) {
reset();
input();
cout << dp(0, K) << endl;
}
////////////////////////////////
return 0;
}
| [
"[email protected]"
] | |
0f01647c14d016815b368f43af09cbc0c5300e1d | b012b15ec5edf8a52ecf3d2f390adc99633dfb82 | /releases/moos-ivp-13.5/ivp/src/lib_geometry/XYConvexGrid.cpp | d83d11212623fef840182e583797100b846eaac9 | [] | no_license | crosslore/moos-ivp-aro | cbe697ba3a842961d08b0664f39511720102342b | cf2f1abe0e27ccedd0bbc66e718be950add71d9b | refs/heads/master | 2022-12-06T08:14:18.641803 | 2020-08-18T06:39:14 | 2020-08-18T06:39:14 | 263,586,714 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,707 | cpp | /*****************************************************************/
/* NAME: Michael Benjamin, Henrik Schmidt, and John Leonard */
/* ORGN: Dept of Mechanical Eng / CSAIL, MIT Cambridge MA */
/* FILE: XYConvexGrid.cpp */
/* DATE: Aug 27th 2005 */
/* */
/* 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, write to the Free */
/* Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/*****************************************************************/
#include <iostream>
#include <cmath>
#include <cstdlib>
#include "XYConvexGrid.h"
#include "MBUtils.h"
#include "XYFormatUtilsPoly.h"
using namespace std;
//-------------------------------------------------------------
// Procedure: initialize
// Note: A convenience function. Only one cell variable is
// implied with an initial value as given. Calles the
// more generaly initialize function.
bool XYConvexGrid::initialize(const XYPolygon& poly,
double cell_size,
double init_value)
{
vector<string> cell_vars;
cell_vars.push_back("v");
vector<double> cell_init_vals;
cell_init_vals.push_back(init_value);
return(initialize(poly, cell_size, cell_vars, cell_init_vals));
}
//-------------------------------------------------------------
// Procedure: initialize
// Purpose: The general initialize function.
bool XYConvexGrid::initialize(const XYPolygon& poly,
double cell_size,
vector<string> cell_vars,
vector<double> cell_init_vals)
{
unsigned int i, psize = poly.size();
if(psize == 0)
return(false);
if(cell_vars.size() != cell_init_vals.size())
return(false);
// If for some reason there is no cell_vars info, use simple default
if(cell_vars.size() == 0) {
m_cell_vars.push_back("v");
m_cell_init_vals.push_back(0);
}
XYSquare unit_square(cell_size);
// Part One: get bounding box for the polygon and create
// elements based on that square
double xlow = poly.get_vx(0);
double xhigh = poly.get_vx(0);
double ylow = poly.get_vy(0);
double yhigh = poly.get_vy(0);
for(i=1; i<psize; i++) {
double x = poly.get_vx(i);
double y = poly.get_vy(i);
if(x < xlow) xlow = x;
if(x > xhigh) xhigh = x;
if(y < ylow) ylow = y;
if(y > yhigh) yhigh = y;
}
XYSquare outer_square(xlow, xhigh, ylow, yhigh);
vector<XYSquare> int_elements;
bool ok = initialize(outer_square, unit_square);
if(!ok)
return(false);
unsigned int esize = m_elements.size();
for(i=0; i<esize; i++) {
xlow = m_elements[i].getVal(0,0);
xhigh = m_elements[i].getVal(0,1);
ylow = m_elements[i].getVal(1,0);
yhigh = m_elements[i].getVal(1,1);
XYPolygon spoly;
spoly.add_vertex(xlow, ylow);
spoly.add_vertex(xhigh, ylow);
spoly.add_vertex(xhigh, yhigh);
spoly.add_vertex(xlow, yhigh);
if(spoly.intersects(poly))
int_elements.push_back(m_elements[i]);
}
m_elements = int_elements;
// Store some config information for serializing the grid (get_spec)
m_config_poly = poly;
m_config_cell_size = cell_size;
for(i=0; i<esize; i++)
m_cell_vals.push_back(cell_init_vals);
m_cell_vars = cell_vars;
m_cell_init_vals = cell_init_vals;
// Now that we know how many cell_vars, initialize the vectors
// containing one entry per cell_var.
unsigned int cix, csize = m_cell_vars.size();
for(cix=0; cix<csize; cix++) {
m_cell_max_limit.push_back(0);
m_cell_min_limit.push_back(0);
m_cell_max_limited.push_back(false);
m_cell_min_limited.push_back(false);
m_cell_max_sofar.push_back(0);
m_cell_min_sofar.push_back(0);
m_cell_minmax_noted.push_back(false);
}
return(true);
}
//-------------------------------------------------------------
// Procedure: ptIntersect
// Purpose: Determine is a given point is contained within the
// the given grid cell index.
bool XYConvexGrid::ptIntersect(unsigned int ix, double x, double y) const
{
if(ix >= m_elements.size())
return(false);
return(m_elements[ix].containsPoint(x, y));
}
//-------------------------------------------------------------
// Procedure: setIntersect
// Purpose: Determine the length of the given line segment that
// intersects with the given grid cell.
double XYConvexGrid::segIntersect(unsigned int ix,
double x1, double y1,
double x2, double y2)
{
if(ix >= m_elements.size())
return(0);
return(m_elements[ix].segIntersectLength(x1,y1,x2,y2));
}
//-------------------------------------------------------------
// Procedure: getElement
XYSquare XYConvexGrid::getElement(unsigned int ix) const
{
XYSquare retElement;
if(ix < m_elements.size())
return(m_elements[ix]);
else
return(retElement);
}
//-------------------------------------------------------------
// Procedure: hasCellVar()
bool XYConvexGrid::hasCellVar(const string& cell_var) const
{
unsigned int i, vsize = m_cell_vars.size();
for(i=0; i<vsize; i++) {
if(m_cell_vars[i] == cell_var)
return(true);
}
return(false);
}
//-------------------------------------------------------------
// Procedure: getCellVarIX()
unsigned int XYConvexGrid::getCellVarIX(const string& cell_var) const
{
unsigned int i, vsize = m_cell_vars.size();
for(i=0; i<vsize; i++) {
if(m_cell_vars[i] == cell_var)
return(i);
}
return(0);
}
//-------------------------------------------------------------
// Procedure: setVal
void XYConvexGrid::setVal(unsigned int ix, double val,
unsigned int cix)
{
if((ix >= m_elements.size()) || (cix >= m_cell_vars.size()))
return;
// Make sure new value is within bounds, if limited
if(m_cell_max_limited[cix] && (val > m_cell_max_limit[cix]))
val = m_cell_max_limit[cix];
if(m_cell_min_limited[cix] && (val < m_cell_min_limit[cix]))
val = m_cell_min_limit[cix];
// Set the value of the cell IX for cell var CIX
m_cell_vals[ix][cix] = val;
// Update the minimum value so far noted for cell_var CIX
if(!m_cell_minmax_noted[cix] || (val < m_cell_min_sofar[cix]))
m_cell_min_sofar[cix] = val;
// Update the maximum value so far noted for cell_var CIX
if(!m_cell_minmax_noted[cix] || (val > m_cell_max_sofar[cix]))
m_cell_max_sofar[cix] = val;
// Now that an update has been made for cell_var CIX, note it.
m_cell_minmax_noted[cix] = true;
}
//-------------------------------------------------------------
// Procedure: incVal
void XYConvexGrid::incVal(unsigned int ix, double val,
unsigned int cix)
{
if((ix >= m_elements.size()) || (cix >= m_cell_vars.size()))
return;
double curr_val = m_cell_vals[ix][cix];
setVal(ix, curr_val+val, cix);
}
//-------------------------------------------------------------
// Procedure: getVal
double XYConvexGrid::getVal(unsigned int ix, unsigned int cix) const
{
if((ix >= m_elements.size()) || (cix >= m_cell_vars.size()))
return(0);
return(m_cell_vals[ix][cix]);
}
//-------------------------------------------------------------
// Procedure: getVar
string XYConvexGrid::getVar(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return("");
return(m_cell_vars[cix]);
}
//-------------------------------------------------------------
// Procedure: getMin
double XYConvexGrid::getMin(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(0);
return(m_cell_min_sofar[cix]);
}
//-------------------------------------------------------------
// Procedure: getMax
double XYConvexGrid::getMax(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(0);
return(m_cell_max_sofar[cix]);
}
//-------------------------------------------------------------
// Procedure: getInitVal
double XYConvexGrid::getInitVal(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(0);
return(m_cell_init_vals[cix]);
}
//-------------------------------------------------------------
// Procedure: getMinLimit
double XYConvexGrid::getMinLimit(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(0);
return(m_cell_min_limit[cix]);
}
//-------------------------------------------------------------
// Procedure: cellVarMinLimited()
bool XYConvexGrid::cellVarMinLimited(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(false);
return(m_cell_min_limited[cix]);
}
//-------------------------------------------------------------
// Procedure: cellVarMaxLimited()
bool XYConvexGrid::cellVarMaxLimited(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(false);
return(m_cell_max_limited[cix]);
}
//-------------------------------------------------------------
// Procedure: getMaxLimit
double XYConvexGrid::getMaxLimit(unsigned int cix) const
{
if(cix >= m_cell_vars.size())
return(0);
return(m_cell_max_limit[cix]);
}
//-------------------------------------------------------------
// Procedure: setMinLimit
void XYConvexGrid::setMinLimit(double min_limit, unsigned int cix)
{
if(cix >= m_cell_vars.size())
return;
m_cell_min_limit[cix] = min_limit;
m_cell_min_limited[cix] = true;
// If there is a cell_max_limit in force
if(m_cell_max_limited[cix])
// And the new min_limit is actually greater(!) than max_limit
if(min_limit > m_cell_max_limit[cix])
// Then clip the min_limit to be no more than the max_limit
m_cell_min_limit[cix] = m_cell_max_limit[cix];
}
//-------------------------------------------------------------
// Procedure: setMaxLimit
void XYConvexGrid::setMaxLimit(double max_limit, unsigned int cix)
{
if(cix >= m_cell_vars.size())
return;
m_cell_max_limit[cix] = max_limit;
m_cell_max_limited[cix] = true;
// If there is a cell min_limit in force
if(m_cell_min_limited[cix])
// And the new max_limit is actually greater(!) than min_limit
if(max_limit < m_cell_min_limit[cix])
// Then clip the max_limit to be no more than the min_limit
m_cell_max_limit[cix] = m_cell_min_limit[cix];
}
//-------------------------------------------------------------
// Procedure: ptIntersect
// Purpose: Determine is a given point is contained within the
// the grid, i.e., within any one element
bool XYConvexGrid::ptIntersect(double x, double y) const
{
unsigned int i, vsize = m_elements.size();
for(i=0; i<vsize; i++)
if(m_elements[i].containsPoint(x, y))
return(true);
return(false);
}
//-------------------------------------------------------------
// Procedure: ptIntersectBound
// Purpose: Determine is a given point is contained within the
// bounding box of all grid squares.
bool XYConvexGrid::ptIntersectBound(double x, double y) const
{
return(m_bounding_square.containsPoint(x, y));
}
//-------------------------------------------------------------
// Procedure: segIntersectBound
// Purpose: Determine is a given line segment intersects the
// bounding box of all grid squares.
bool XYConvexGrid::segIntersectBound(double x1, double y1,
double x2, double y2) const
{
return(m_bounding_square.segIntersectLength(x1,y1,x2,y2) > 0);
}
//-------------------------------------------------------------
// Procedure: initialize
bool XYConvexGrid::initialize(const XYSquare& outer_square,
const XYSquare& unit_square)
{
double outer_x_len = outer_square.getLengthX();
double outer_y_len = outer_square.getLengthY();
double unit_x_len = unit_square.getLengthX();
double unit_y_len = unit_square.getLengthY();
if(outer_y_len < unit_y_len)
return(false);
if(outer_x_len < unit_x_len)
return(false);
double x_whole = floor(outer_x_len / unit_x_len);
double x_extra = (outer_x_len - (x_whole * unit_x_len));
int x_count = (int)(x_whole);
if(x_extra > 0)
x_count++;
double y_whole = floor(outer_y_len / unit_y_len);
double y_extra = (outer_y_len - (y_whole * unit_y_len));
int y_count = (int)(y_whole);
if(y_extra > 0)
y_count++;
XYSquare new_square;
for(int i=0; i<x_count; i++) {
for(int j=0; j<y_count; j++) {
double x_low = (i * unit_x_len) + outer_square.getVal(0,0);
double x_high = x_low + unit_x_len;
double y_low = (j * unit_y_len) + outer_square.getVal(1,0);
double y_high = y_low + unit_y_len;
new_square.set(x_low, x_high, y_low, y_high);
m_elements.push_back(new_square);
}
}
m_bounding_square = outer_square;
return(true);
}
//-------------------------------------------------------------
// Procedure: reset
// Purpose: Reset the grid (without changing the grid structure).
// Reset all the initial values back, and reset the
// min_sofar and max_sofar values for each cellvar.
void XYConvexGrid::reset()
{
// For each element (grid cell) and each cell_var, reset to the
// cell_var's initial value.
unsigned int ix, esize = m_elements.size();
unsigned int cix, csize = m_cell_vars.size();
for(ix=0; ix<esize; ix++) {
for(cix=0; cix<csize; cix++) {
double init_val = m_cell_init_vals[cix];
m_cell_vals[ix][cix] = init_val;
}
}
// For each cell_var indicate no values yet noted.
for(cix=0; ix<csize; ix++)
m_cell_minmax_noted[cix] = false;
}
//-------------------------------------------------------------
// Procedure: reset (for a given cell_var)
// Purpose: Reset the grid (without changing the grid structure).
// Reset all the initial values back, and reset the
// min_sofar and max_sofar values for each cellvar.
void XYConvexGrid::reset(const string& cell_var)
{
if(!hasCellVar(cell_var))
return;
unsigned int cix = getCellVarIX(cell_var);
// For each element (grid cell), for the given cell_var, reset
// to the cell_var's initial value.
unsigned int ix, esize = m_elements.size();
for(ix=0; ix<esize; ix++) {
double init_val = m_cell_init_vals[cix];
m_cell_vals[ix][cix] = init_val;
}
// For given cell_var indicate that no values yet noted
m_cell_minmax_noted[cix] = false;
}
//-------------------------------------------------------------
// Procedure: get_spec
string XYConvexGrid::get_spec() const
{
string spec = getConfigStr();
// Now build all the cell information. If a cell has no changes
// from the defaults, for any of its cell vars, there will be no
// info for that cell included. Format is generally like:
// cell=ix:var:val:var:val:var:val, or
// cell=23:force_angle:180:magnitude:2.3
unsigned int ix, esize = m_elements.size();
for(ix=0; ix<esize; ix++) {
string cell_spec;
unsigned int cix, csize = m_cell_vars.size();
for(cix=0; cix<csize; cix++) {
if(m_cell_vals[ix][cix] != m_cell_init_vals[cix]) {
double dval = m_cell_vals[ix][cix];
cell_spec += m_cell_vars[cix] + ":" + doubleToStringX(dval);
}
}
if(cell_spec != "") {
cell_spec = ",cell=" + uintToString(ix) + ":" + cell_spec;
spec += cell_spec;
}
}
string obj_spec = XYObject::get_spec();
if(obj_spec != "")
spec += ("," + obj_spec);
return(spec);
}
//-------------------------------------------------------------
// Procedure: getConfigStr
// Purpose: Return a serialized version of just the grid config
// components; likely its original configuration string.
// "pts={0,0:100,0:100,100:0,100},cell_size=10,
// cell_vars=x:0:y:0:z:0,cell_min=x:0,cell_max=x:100"
string XYConvexGrid::getConfigStr() const
{
string spec = m_config_poly.get_spec();
spec += ",cell_size=" + doubleToStringX(m_config_cell_size);
string cell_vars_spec;
unsigned int j, jsize = m_cell_vars.size();
for(j=0; j<jsize; j++) {
if(j != 0)
cell_vars_spec += ":";
cell_vars_spec += m_cell_vars[j] + ":";
cell_vars_spec += doubleToStringX(m_cell_init_vals[j]);
}
if(cell_vars_spec != "")
spec += ",cell_vars=" + cell_vars_spec;
unsigned int cix, cvsize = m_cell_vars.size();
for(cix=0; cix<cvsize; cix++) {
if(cellVarMinLimited(cix)) {
spec += ",cell_min=";
spec += m_cell_vars[cix] + ":";
double min_limit = getMinLimit(cix);
spec += doubleToStringX(min_limit);
}
if(cellVarMaxLimited(cix)) {
spec += ",cell_max=";
spec += m_cell_vars[cix] + ":";
double max_limit = getMaxLimit(cix);
spec += doubleToStringX(max_limit);
}
}
return(spec);
}
//-------------------------------------------------------------
// Procedure: print
// Purpose: For debugging.
void XYConvexGrid::print() const
{
unsigned int i, vsize = m_elements.size();
for(i=0; i<vsize; i++)
cout << "[" << i << "]: " << m_elements[i].get_spec() << endl;
}
| [
"[email protected]"
] | |
ba79dc6fc05c09a8231f0eec2c475e2c0d081d39 | a250908fe2c6b3b38c6834ae04b065f650109d52 | /lecture12/List.h | ec9d4ba151250a53c33d37eb137da21e64ec32bf | [
"MIT"
] | permissive | msareebhakak/ncstate-ece309-examples | 395e05385208f15ccfe0b1fc0b835e02ee46c5be | 4f36ac249af8a7910c146994abd541b03d7fdbd9 | refs/heads/master | 2020-12-06T07:54:55.005212 | 2019-12-02T20:17:07 | 2019-12-02T20:17:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 939 | h | #ifndef LIST_H
#define LIST_H
#include <string>
using Item = int;
class List {
private:
class ListNode {
public:
Item item;
ListNode * next;
ListNode(Item i, ListNode *n=nullptr) {
item = i;
next = n;
}
};
ListNode * head;
ListNode * tail;
public:
class iterator {
ListNode *node;
public:
iterator(ListNode *n = nullptr) {
node = n;
}
Item& getItem() { return node->item; }
void next() { node = node->next; }
bool end() { return node==nullptr; }
friend class List;
};
public:
List() {
// list is empty
head = nullptr;
tail = nullptr;
}
bool empty() {
return head==nullptr;
}
// Only declared, here, implemented
// in List.cpp
void append(Item a);
bool remove (Item ©);
void insertAfter(iterator, Item);
void removeAfter(iterator, Item&);
iterator begin() {
return iterator(head);
}
};
#endif
| [
"[email protected]"
] | |
4ded28aff8b76776996cf682c8701d1f2cb2fbfc | 908a6574871ece7d736724f8a0e07cd7e0147493 | /Stochastic/UCP-Stochastique/src/eoUCPMutation5.h~ | cd0a2ec73249e0150359314df0728246b689e4a2 | [] | no_license | sophiejacquin/UCP | fef5894a5b1a5fbb4faa0344ad332bd4f3c3871f | 9e770e1beb69c953efbae423cf553d1f6f702ad2 | refs/heads/master | 2021-01-17T20:50:48.278512 | 2016-07-27T15:11:42 | 2016-07-27T15:11:42 | 64,318,354 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,451 | /** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
The above line is useful in Emacs-like editors
*/
/*
Template for simple mutation operators
======================================
*/
#ifndef eoUCPMutation5_H
#define eoUCPMutation5_H
#include <eoOp.h>
#include <iostream>
using namespace std;
/**
* Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen
*
* THere is NO ASSUMPTION on the class GenoypeT.
* In particular, it does not need to derive from EO
*/
template<class GenotypeT>
class eoUCPMutation5: public eoMonOp<GenotypeT>
{
private:
// START Private data of an eoUCPMutation object
// varType anyVariable;
vector<eoUCPData> scenarios;
vector<int> tUp;
vector<int > tDown;
vector<int> tColdStart;
int longueur;
int nbUnitsS;
int nbEtats;
// END Private data of an eoUCPMutation object
public:
/**
* Ctor - no requirement
*/
// START eventually add or modify the anyVariable argument
eoUCPMutation5 (vector<int> & _tUp, vector<int> & _tDown, vector<int> & _tCS,vector<eoUCPData> _scenarios,int _longueur,int _nb)
{
tUp= _tUp;
tDown= _tDown;
tColdStart=_tCS;
scenarios=_scenarios;
longueur=_longueur;
nbUnitsS= _nb;
nbEtats=pow(2,nbUnitsS)+1;
}
// END Code of Ctor of an eoUCPEvalFunc object
/// The class name. Used to display statistics
string className() const { return "eoUCPMutation"; }
/**
* modifies the parent
* @param _genotype The parent genotype (will be modified)
*/
bool operator()(GenotypeT & _genotype)
{
////////cout<<"deb mut2"<<endl;
bool isModified(true);
vector<int> unitsS;
int nbUnits =_genotype.getNbUnits();
int h,i,j,k;
//choix heure début :
int nbHeures =_genotype.getNbHeures();
eoUniformGenerator<int> choixHDeb(1,nbHeures-longueur-1);
int hDeb=choixHDeb();
int hFin=hDeb+longueur;
// cout<<"hDeb : "<<hDeb<<" hFin : "<<hFin<<endl;
//choix unités :
int der=0;
for(j=0;j<nbUnitsS;j++)
{
eoUniformGenerator<int> choixUnit(0,nbUnits );
der= choixUnit();
bool deja=false;
for(k=0;k<j;k++)
if(unitsS[k]==der)deja=true;
if (deja) j--;
else {
unitsS.push_back(der);
//cout<<der<<" ";
}
}
//cout<<endl;
// tableaux du graphe :
//cout<<"av declaration"<<endl;
double graphEval[longueur+1][nbEtats];
int** graphPred = new int*[longueur+1];
for (j=0;j<longueur+1;j++) graphPred[j]=new int[nbEtats];
//////cout<<"debut remplissage"<<endl;
//verification à priori :
for(j=hDeb;j<hFin+1;j++)
{
for(k=0;k<nbUnitsS;k++)
{
if(_genotype.getTemps(j,unitsS[k])<0 && _genotype.getTemps(j-1,unitsS[k])>0 )
{
if( _genotype.getTemps(j-1,unitsS[k])<tUp[unitsS[k]]) cout<<"attention pb 1ap :"<<j<<" "<<k<<" tUp "<<tUp[unitsS[k]]<<" hDeb "<<hDeb<<"val pred "<<_genotype.getTemps(j-1,unitsS[k])<<endl;
}
else if(_genotype.getTemps(j,unitsS[k])>0 && _genotype.getTemps(j-1,unitsS[k])<0)
{
if( _genotype.getTemps(j-1,unitsS[k])>tDown[unitsS[k]]) cout<<"attention pb 2ap "<<j<<endl;
}
}
}
//Remplissage du graphe :
for(h=0;h<longueur+1;h++)
{
//////cout<<h<<endl;
vector<int> description=_genotype.getTemps()[hDeb+h];
for(i=0;i<nbEtats-1;i++)
{
//////cout<<i<<endl;
//vérifier réalisabilité de l'état:
bool realisable=true;
double CS=0;
//vérifier si non interdit par condition initiale ou finale et construction vecteur descriptif de l'état:
int puis=1;
int puisSup=2;
for(j=0;j<nbUnitsS;j++)
{
int unite=unitsS[j];
int tpsIni=_genotype.getTemps(hDeb-1,unite);
int tpsFin;
if(hFin+1<nbHeures)tpsFin=_genotype.getTemps(hFin+1,unite);
int etat;
if(i%puisSup>=puis)etat=1;
else etat=-1;
puisSup*=2;
puis*=2;
if((tpsIni>0&&tpsIni+h<tUp[unite] &&etat==-1)||(tpsIni<0 && tpsIni-h >tDown[unite] && etat==1))
{realisable=false; //cout <<"realisable faux 1: heure "<< h << " "<<j<<" "<<etat<<endl;
}
else if((hFin+1<nbHeures)&&((tpsFin>0 && tpsFin-(longueur -h +1)>0 && etat<0)||(tpsFin<0 && -tpsFin-(longueur -h +1)>0)&&etat==1))
{realisable=false;// cout <<"realisable faux2 : heure "<< h << " "<<j<<" "<<etat<<endl;
}
else if((hFin+1<nbHeures)&& tpsFin>0 && tpsFin<tUp[unite] && h>longueur+1-tpsFin && etat==-1)
{realisable=false;// cout <<"realisable faux 3 : heure "<< h << " "<<j<<" "<<etat<<endl;
}
else if((hFin+1<nbHeures)&& tpsFin>0 && tpsFin<tUp[unite] && longueur+1-tpsFin-tDown[unite]<h<=longueur+1-tpsFin && etat==1)
{realisable=false; //cout <<"realisable faux 3 : heure "<< h << " "<<j<<" "<<etat<<endl;
}
else if((hFin+1<nbHeures)&& tpsFin<0 && tpsFin>tColdStart[unite] && h<=longueur+1+tpsFin&& h>longueur+1+tpsFin-tUp[unite] &&etat==-1)
{realisable=false; cout <<"realisable faux 4 "<< h << " "<<j<<" "<<etat<<endl;}
description[unite]=etat;
}
//////cout<<"verif accessibilité finie "<<realisable<<endl;
if(realisable==true)
{
//cout<<realisable<<endl;
double penalite=0;
////cout<<"réalisable"<<endl;
// vérifier si réalisable au sens des demandes et réserves :
//recherche meilleur pred:
if(h==0)
{
graphPred[0][i]=0;
penalite=penalityHour(description,hDeb);
//eval avec CS + evalPred :
graphEval[0][i]=penalite;
//if(graphPred[0][i]==0){
int puissance=1;
int puisSup=2;
for(j=0;j<nbUnitsS;j++)
{
int tempsIni=_genotype.getTemps(hDeb-1,unitsS[j]);
int etat=description[unitsS[j]];
if(i%puisSup>=puissance)etat=1;
else etat=-1;
puissance*=2;
puisSup*=2;
if(etat<0 && tempsIni>0 && tempsIni< tUp[unitsS[j]])
graphPred[0][i]=-1;
else if(etat>0 && tempsIni<0 &&tempsIni>tDown[unitsS[j]])
graphPred[0][i]=-1;
else if(etat>0 && tempsIni<0 &&tempsIni>tColdStart[unitsS[j]])
graphEval[h][i]+=(*units)[unitsS[j]].get_sHot();
else if(etat>0 && tempsIni==tColdStart[unitsS[j]]) graphEval[h][i]=(*units)[unitsS[j]].get_sCold();
}
//}
//////cout<<"recherche meilleur pred h=0 finie"<<endl;
}
else //si h>0
{
graphPred[h][i]=-1;
penalite=penalityHour(description,h+hDeb);
for(j=0;j<nbEtats;j++)
{
bool possible=true;
if(graphPred[h-1][j]<0)possible=false;
k=0;
int CS=0;
//>0){ possible=false;}
//else ////cout<<"là c'est bon"<<endl;
int puissance=1;
int puisSup=2;
while(possible&& k<nbUnitsS)
{
int etat;
if(j<nbEtats-1 && j%puisSup>=puissance)etat=1;
else if(j<nbEtats-1)etat=-1;
else etat=_genotype.getTemps(hDeb+h,unitsS[k]);
puissance*=2;
puisSup*=2;
//if(h==13&& k==2)cout<<"etat "<<etat<<" description "<<description[unitsS[k]]<<endl;
if((etat<0 && description[unitsS[k]]>0)||(etat>0 && description[unitsS[k]]<0))
{
//calcul temps mm état :
//cout<<"changement d'etat"<<endl;
int tps=tempsMemeEtat(_genotype,graphPred,h-1,j,k,hDeb,unitsS[k]);
if(etat>0 && tps<tUp[unitsS[k]])
{
possible=false;
}
else if(etat<0)
{
if(tps< -tDown[unitsS[k]])
{
possible=false;
}
else if(tps< -tColdStart[unitsS[k]])
CS+=(*units)[unitsS[k]].get_sHot();
else CS+=(*units)[unitsS[k]].get_sCold();
}
//if(h==4 &&k==0 &&tps==3)cout<<tps<<" "<<possible<<"etat "<<etat<<" description "<<description[unitsS[k]]<<" "<<tUp[unitsS[k]]<<endl;
}
k++;
}//fin tq
if(possible)
{
//cout<<possible<<" "<<j<<" "<<graphPred[h][i]<<" "<<graphEval[h][i]<<" "<<graphEval[h-1][j]<<" CS "<<CS<<" penalite "<<penalite<<endl;
//regarde si meilleur predesseur :
if(graphPred[h][i]==-1|| graphEval[h][i]>graphEval[h-1][j]+CS+penalite)
{
//cout<<"là "<<h<<endl;
graphPred[h][i]=j;
graphEval[h][i]=graphEval[h-1][j]+CS+penalite;
}
}
}//fin pour
}
//////cout<<"autre cas fini"<<endl;
//calcul de FC:
if(graphPred[h][i]>-1&&penalite==0)
{
graphEval[h][i]+=fuelCost(_genotype,h+hDeb,description);
}
//////cout<<"calcul Fuel Cost effectué"<<endl;
}
else graphPred[h][i]=-1;
//////cout<<"fin iteration grde boucle états"<<endl;
}
//////cout<<"graphe rempli sauf dernier état"<<endl;
//dernier état: ajout possibilité de ratacher à d'autres sommets
graphPred[h][nbEtats-1]=nbEtats-1;
description=_genotype.getTemps()[hDeb+h];
double penalite=penalityHour(description,h+hDeb);
//Calcul de CS et numero autre sommet pred possible :
int puis=1;
int num=0;
double CS=0;
for(k=0;k<nbUnitsS;k++)
{
if(_genotype.getTemps(hDeb+h-1,unitsS[k])>0)num=num+puis;
puis*2;
if(description[unitsS[k]]==1)
{
if(_genotype.getTemps(hDeb+h-1,unitsS[k])<0 && _genotype.getTemps(hDeb+h-1,unitsS[k])>tColdStart[unitsS[k]])
CS+=(*units)[unitsS[k]].get_sHot();
else CS+=(*units)[unitsS[k]].get_sCold();
}
}
//Calcul de FC:
graphEval[h][nbEtats-1]+=CS;
if(h>0)graphEval[h][nbEtats-1]+=graphEval[h-1][nbEtats-1];
graphEval[h][nbEtats-1]+=penalite;
//regarder si autre pred est un pred possible :
/*if(h>0)
{
bool acceptable = true;
int k=0;
while(k<nbUnitsS && acceptable)
{
int tps=tempsMemeEtat(_genotype,graphPred,h-1,num,k,hDeb,unitsS[k]);
bool pos=false;
if(description[unitsS[k]]==tUp[unitsS[k]] && tps>=tUp[unitsS[k]]-1)
{
pos=true;
}
else if(description[unitsS[k]]==1 && tps>=-tDown[unitsS[k]])
{
pos=true;
}
else if(description[unitsS[k]]==-1 && tps>=tUp[unitsS[k]])
{
pos=true;
}
else if(description[unitsS[k]]==tColdStart[unitsS[k]] && tps>= -tColdStart[unitsS[k]]-1)
{
pos=true;
}
else if(description[unitsS[k]]>0 && tps== description[unitsS[k]]-1)
{
pos=true;
}
else if(description[unitsS[k]]<0 && tps== -description[unitsS[k]]-1)
{
pos=true;
}
acceptable= acceptable&& pos;
k++;
}
if(acceptable && graphEval[h-1][num]+CS+penalite<graphEval[h][nbEtats-1])
{
graphPred[h][nbEtats-1]=num;
graphEval[h][nbEtats-1]=graphEval[h-1][num]+CS+penalite;
}
}*/
//////cout<<"pred de base mis"<<endl;
//chercher si il existe un autre pred meilleur :
/*int nbPred=0;
for(j=0;j<nbEtats-1;j++)
{
bool possible=true;
if(h==0||graphPred[h-1][j]<0)possible=false;
else nbPred++;
k=0;
int CS=0;
int puissance=1;
int puisSup=2;
while(possible&& k<nbUnitsS)
{
int etat;
if( j%puisSup>=puissance)etat=1;
else etat=-1;
puisSup*=2;puissance*=2;
if(etat* description[unitsS[k]]<0)
{
//calcul temps mm état :
int tps=tempsMemeEtat(_genotype,graphPred,h-1,j,k,hDeb,unitsS[k]);
if(etat<0 && tps<tUp[unitsS[k]])
{
possible=false;
}
else if(etat>0)
{
if(tps< -tDown[unitsS[k]])
{
possible=false;
}
else if(tps< tColdStart[unitsS[k]])
CS+=(*units)[unitsS[k]].get_sHot();
else CS+=(*units)[unitsS[k]].get_sCold();
}
}
k++;
}//fin tq
//////cout<<"fin tq"<<endl;
if(possible)
{
//////cout<<possible<<endl;
//regarde si meilleur predesseur :
if(graphPred[h][nbEtats-1]==-1|| graphEval[h][nbEtats-1]>graphEval[h-1][j]+CS+penalite)
{
graphPred[h][nbEtats-1]=j;
graphEval[h][nbEtats-1]=graphEval[h-1][j]+CS+penalite;
}
}
}//fin pour*/
//cout<<" h "<<h<<" nbPred "<<nbPred<<endl;
//////cout<<"fin pour"<<endl;
//Calcul penalites :
if(penalite==0) graphEval[h][nbEtats-1]+=fuelCost(_genotype,h+hDeb,description);
//////cout<<"derbier etat"<<endl;
}
//////cout<<"fin remplisage graph"<<endl;
//fin remplissage graphes
//retour solution:
//recherche meilleur dernier etat valide:
int actu=nbEtats-1;
for(j=0;j<nbEtats-1;j++)
{
if(graphPred[longueur-1][j]>-1)
{
//cout<<graphEval[longueur-1][j]<<endl;
if(graphEval[longueur-1][j]<graphEval[longueur-1][actu]) actu=j;
}
}
//cout <<"actu def "<<actu<<endl;
//restitution des solutions sous forme binaire:
for(j=longueur;j>=0;j--)
{
int puissance=1;int puisSup=2;
for(k=0;k<nbUnitsS;k++)
{
if(actu<nbEtats-1)
{
int etat;
if(actu%puisSup>=puissance)etat=1;
else etat=-1;
_genotype.setTemps(hDeb+j,unitsS[k],etat);
puisSup*=2;puissance*=2;
// cout<<j<<": "<<actu<<" "<<tempsMemeEtat(_genotype,graphPred,j,actu,k,hDeb,unitsS[k])<<etat<<endl;
}
//else cout<< j<<": "<<actu<<" "<<_genotype
}
//cout<<j<<": "<<actu<<endl;
actu=graphPred[j][actu];
_genotype.setModif(hDeb+j,true);
}
//cout<<endl;
//////cout<<"rest binaire"<<endl;
//remise des temps comme il faut :
for(j=hDeb;j<hFin+1;j++)
{
for(k=0;k<nbUnitsS;k++)
{
if(_genotype.getTemps(j,unitsS[k])<0 && _genotype.getTemps(j-1,unitsS[k])<0 )
{
if(_genotype.getTemps(j-1,unitsS[k])>tColdStart[unitsS[k]])_genotype.setTemps(j,unitsS[k],_genotype.getTemps(j-1,unitsS[k])-1);
else _genotype.setTemps(j,unitsS[k],tColdStart[unitsS[k]]);
}
else if(_genotype.getTemps(j,unitsS[k])<0 && _genotype.getTemps(j-1,unitsS[k])>0 )
{
_genotype.setTemps(j,unitsS[k],-1);
if( _genotype.getTemps(j-1,unitsS[k])<tUp[unitsS[k]]) cout<<"attention pb 1 :"<<j<<" "<<k<<": "<<unitsS[k]<<" tUp "<<tUp[unitsS[k]]<<" hDeb "<<hDeb<<"val pred "<<_genotype.getTemps(j-1,unitsS[k])<<endl;
}
else if(_genotype.getTemps(j,unitsS[k])>0 && _genotype.getTemps(j-1,unitsS[k])>0)
{
if(_genotype.getTemps(j-1,unitsS[k])<tUp[unitsS[k]])_genotype.setTemps(j,unitsS[k],_genotype.getTemps(j-1,unitsS[k])+1);
else _genotype.setTemps(j,unitsS[k],tUp[unitsS[k]]);
}
else if(_genotype.getTemps(j,unitsS[k])>0 && _genotype.getTemps(j-1,unitsS[k])<0)
{
_genotype.setTemps(j,unitsS[k],1);
if( _genotype.getTemps(j-1,unitsS[k])>tDown[unitsS[k]]) cout<<"attention pb 2 "<<j<<" "<<unitsS[k]<<" tDown "<<tDown[unitsS[k]]<<" hDeb "<<hDeb<<"val pred "<<_genotype.getTemps(j-1,unitsS[k])<<endl;
}
}
}
//////cout<<"rest"<<endl;
//désalouage :
//////cout<<"deb desalouage"<<endl;
for (j=0;j<longueur+1;j++)
delete[] graphPred[j];
//////cout<<"ici"<<endl;
delete[] graphPred;
//////cout<<"desaloué"<<endl;
return isModified;
// END code for mutation of the _genotype object
}
int tempsMemeEtat(GenotypeT & _eo,int** graphPred,int h,int i,int u,int hDeb,int unit)
{
int tps=1;
int etat;
if(i<nbEtats-1)
{
if(i%( static_cast<int>(pow(2,u+1)))>=static_cast<int>(pow(2,u)))etat=1;
else etat=-1;
}
else
{
if(_eo.getTemps(h+hDeb,unit)>0)etat=1;
else etat=-1;
}
int pred= graphPred[h][i];
int etatPred;
if(pred<nbEtats-1)
{
if(pred%(static_cast<int>(pow(2,u+1)))>=static_cast<int>(pow(2,u)))etatPred=1;
else etatPred=-1;
}
else{
if(_eo.getTemps(h-1+hDeb,unit)>0)etatPred=1;
else etatPred=-1;
}
while(etat==etatPred && h>0)
{
tps++;
i=pred;
etat=etatPred;
h--;
pred=graphPred[h][i];
if(pred<nbEtats-1){
if(pred%(static_cast<int>(pow(2,u+1)))>=static_cast<int>(pow(2,u)))etatPred=1;
else etatPred=-1;}
else
{
if(_eo.getTemps(h-1+hDeb,unit)>0)etatPred=1;
else etatPred=-1;
}
}
if(h==0 && etat>0 &&_eo.getTemps(hDeb-1,unit)>0) tps+=_eo.getTemps(hDeb-1,unit);
else if(h==0 && etat<0 &&_eo.getTemps(hDeb-1,unit)<0) tps-=_eo.getTemps(hDeb-1,unit);
// else tps++;
return tps;
}
double fuelCost(GenotypeT & _eo,int h,vector<int> description)
{
double lamb,delt;
////////cout<<"deblambda"<<endl;
lambda_delta(lamb,delt,h,_eo,description);
//////cout<<"la"<<endl;
int nbUnits=(*units).size();
double prod[nbUnits];
double a1,a2,a0,pi,diff,sum=0;
//int indice;
do
{
sum=0;
for(unsigned int i=0;i<nbUnits;i++)
{
//indice = _eo.indiceUnitAtTime(i,h);
if(description[i]>0)
{
eoUCPUnit & unite =(*units)[i];
a1=unite.get_a1();
a2=unite.get_a2();
pi=0.5*(lamb-a1)/(a2);
if(pi<unite.get_Pmin())
pi=unite.get_Pmin();
else if(pi>unite.get_Pmax())
pi=unite.get_Pmax();
prod[i]=pi;
sum += pi;
}
}
diff=(*load)[h-1]-sum;
if(diff<0)
lamb=lamb-delt;
else
lamb=lamb+delt;
delt=delt*0.5;
}
while(fabs(diff)>0.00001);
////////cout<<"fin while"<<endl;
double res=0;
for(unsigned int i=0;i<nbUnits;i++)
{
if(description[i]>0)
{
eoUCPUnit & unite =(*units)[i];
a1=unite.get_a1();
a2=unite.get_a2();
a0=unite.get_a0();
double p=prod[i];
double fc=a0+(a2*p+a1)*p;
res += fc;
}
}
return res;
}
double StartUpCostHour(GenotypeT & _eo, int h,int usine,int tps, int tpsPred)
{
int nbUnits=(*units).size();
unsigned i;
double cost=0;
for(i=0;i<nbUnits;i++)
{
if((i!=usine && _eo.getTemps(h,i)==1)||(i==usine &&tps==1))
{
if((i!=usine &&_eo.getTemps(h-1,i)>-(*units)[i].get_tColdStart())||(i==usine && tpsPred>-(*units)[i].get_tColdStart()))
{
cost=cost+(*units)[i].get_sHot();
}
else cost=cost+(*units)[i].get_sCold();
}
}
return cost;
}
double penalityHour(vector<int> description, int h)
{
//Test existence :
//retour :
double Pmax,Pmin,sumPmin=0, sumPmax=0,demandReserve=0;
int nbUnits=(*units).size();
for(unsigned i=0;i<nbUnits;i++)
{
eoUCPUnit & unite = (*units)[i];
Pmax = unite.get_Pmax();
Pmin = unite.get_Pmin();
if(description[i]>0)
{
sumPmax+=Pmax;
sumPmin+=Pmin;
}
}
demandReserve= (*load)[h-1]+(*reserve)[h-1];
//////cout<<sumPmax <<" "<<sumPmin<<endl;
if (sumPmax >=demandReserve && sumPmin<=(*load)[h-1])
{
return 0;
}
else return 1000000;
}
void lambda_delta(double & lambda,double & delta,unsigned int h,GenotypeT & _eo,vector<int> description)
{
double res=0.0;
int Pmax=0;
int Pmin=0;
int nbUnitsS;
int nbUnits=(*units).size();
// std::vector<bool> * mbits = _eo.get_p_mbits();
double a1=0;
double a2=0;
double lmin=numeric_limits<double>::max();
double lmax=0;
double lminTmp=0;
double lmaxTmp=0;
for(unsigned i=0;i<nbUnits;i++)
{
eoUCPUnit & unite = (*units)[i];
if(description[i]>0)
{
Pmax = unite.get_Pmax();
Pmin = unite.get_Pmin();
a1 = unite.get_a1();
a2 = unite.get_a2();
lminTmp = a1+(2*a2*Pmin);
lmaxTmp = a1+(2*a2*Pmax);
if(lminTmp<lmin)
lmin=lminTmp;
if(lmaxTmp>lmax)
lmax=lmaxTmp;
}
}
lambda=(lmax+lmin)/2;
delta= (lmax-lmin)/2;
}
};
#endif
| [
"[email protected]"
] | ||
b46883309d3403394815915fedb1262cec4aba8c | 59b2d9114592a1151713996a8888456a7fbfe56c | /hdu/1867.cpp | a59daf1a9c461a67b12ba99c52070e3c11d93084 | [] | no_license | 111qqz/ACM-ICPC | 8a8e8f5653d8b6dc43524ef96b2cf473135e28bf | 0a1022bf13ddf1c1e3a705efcc4a12df506f5ed2 | refs/heads/master | 2022-04-02T21:43:33.759517 | 2020-01-18T14:14:07 | 2020-01-18T14:14:07 | 98,531,401 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,869 | cpp | /* ***********************************************
Author :111qqz
Created Time :2016年08月11日 星期四 05时08分32秒
File Name :code/hdu/1867.cpp
************************************************ */
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <ctime>
#define fst first
#define sec second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ms(a,x) memset(a,x,sizeof(a))
typedef long long LL;
#define pi pair < int ,int >
#define MP make_pair
using namespace std;
const double eps = 1E-8;
const int dx4[4]={1,0,0,-1};
const int dy4[4]={0,-1,1,0};
const int inf = 0x3f3f3f3f;
const int N=1E5+7;
char a[N],b[N];
int nxt[N];
void getnxt( char *s)
{
int n = strlen(s);
int i = 0 ;
int j = -1;
nxt[0] = -1;
while (i<n)
if (j==-1||s[i]==s[j]) nxt[++i] = ++j;
else j = nxt[j];
}
int kmp(char *a,char *b)
{
int n = strlen(a);
int m = strlen(b);
int i = 0;
int j = 0;
getnxt(b);
while (i<n&&j<m)
{
if (j==-1||a[i]==b[j]) i++,j++;
else j = nxt[j];
}
if (i==n)
return j; //为什么要判断i==n...?
return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("code/in.txt","r",stdin);
#endif
while (scanf("%s\n%s",a,b)!=EOF)
{
int k1 = kmp(a,b);
int k2 = kmp(b,a);
cout<<"k1:"<<k1<<" k2:"<<k2<<endl;
if (k1==k2)
{
if (strcmp(a,b)>0)
{
printf("%s",b);
printf("%s\n",a+k1);
}else
{
printf("%s",a);
printf("%s\n",b+k1);
}
}
else if (k1>k2)
{
printf("%s",a);
printf("%s\n",b+k1);
}
else
{
printf("%s",b);
printf("%s\n",a+k2);
}
}
#ifndef ONLINE_JUDGE
fclose(stdin);
#endif
return 0;
}
| [
"111qqz"
] | 111qqz |
c456473a096653e9ed73a8ce359a95f2bc65e761 | 3e1ac5a6f5473c93fb9d4174ced2e721a7c1ff4c | /build/iOS/Preview/include/Fuse.IActualPlacement.h | 2cab6093bba0cdeb198a5ba66ccc4b7fb3ca350f | [] | no_license | dream-plus/DreamPlus_popup | 49d42d313e9cf1c9bd5ffa01a42d4b7c2cf0c929 | 76bb86b1f2e36a513effbc4bc055efae78331746 | refs/heads/master | 2020-04-28T20:47:24.361319 | 2019-05-13T12:04:14 | 2019-05-13T12:04:14 | 175,556,703 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,552 | h | // This file was generated based on /usr/local/share/uno/Packages/Fuse.Nodes/1.9.0/Translation.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Object.h>
namespace g{namespace Uno{struct Float3;}}
namespace g{
namespace Fuse{
// public abstract interface IActualPlacement :54
// {
uInterfaceType* IActualPlacement_typeof();
struct IActualPlacement
{
void(*fp_get_ActualPosition)(uObject*, ::g::Uno::Float3*);
void(*fp_get_ActualSize)(uObject*, ::g::Uno::Float3*);
void(*fp_add_Placed)(uObject*, uDelegate*);
void(*fp_remove_Placed)(uObject*, uDelegate*);
static ::g::Uno::Float3 ActualPosition(const uInterface& __this);
static ::g::Uno::Float3 ActualSize(const uInterface& __this);
static void add_Placed(const uInterface& __this, uDelegate* value) { __this.VTable<IActualPlacement>()->fp_add_Placed(__this, value); }
static void remove_Placed(const uInterface& __this, uDelegate* value) { __this.VTable<IActualPlacement>()->fp_remove_Placed(__this, value); }
};
}} // ::g::Fuse
#include <Uno.Float3.h>
namespace g{
namespace Fuse{
inline ::g::Uno::Float3 IActualPlacement::ActualPosition(const uInterface& __this) { ::g::Uno::Float3 __retval; return __this.VTable<IActualPlacement>()->fp_get_ActualPosition(__this, &__retval), __retval; }
inline ::g::Uno::Float3 IActualPlacement::ActualSize(const uInterface& __this) { ::g::Uno::Float3 __retval; return __this.VTable<IActualPlacement>()->fp_get_ActualSize(__this, &__retval), __retval; }
// }
}} // ::g::Fuse
| [
"[email protected]"
] | |
6bf6403172292abc94d7be19692b7d18f0f400dd | cc11c53a1cd78783591f8863c0d9bd1057ceab21 | /source/uwp/Renderer/lib/AdaptiveSubmitAction.h | d330394957a5b62c90dc3b2fdef1ef3ab527e741 | [
"MIT"
] | permissive | Clancey/AdaptiveCards | 15578a4ae2c2bf016e0ba0db534eb246a22e3d6a | b0cdf05d2ce93c9244443b1d546d4332555fddd3 | refs/heads/master | 2021-04-26T23:28:09.765131 | 2018-03-16T18:47:28 | 2018-03-16T18:47:28 | 124,000,055 | 0 | 0 | MIT | 2018-03-06T01:08:44 | 2018-03-06T01:08:44 | null | UTF-8 | C++ | false | false | 2,793 | h | #pragma once
#include "AdaptiveCards.Rendering.Uwp.h"
#include "Enums.h"
#include "SubmitAction.h"
#include "AdaptiveActionElement.h"
namespace AdaptiveCards { namespace Rendering { namespace Uwp
{
class DECLSPEC_UUID("32114ce2-7e10-4f7f-8225-bfd661c6794c") AdaptiveSubmitAction :
public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
ABI::AdaptiveCards::Rendering::Uwp::IAdaptiveSubmitAction,
ABI::AdaptiveCards::Rendering::Uwp::IAdaptiveActionElement,
Microsoft::WRL::CloakedIid<ITypePeek>,
Microsoft::WRL::CloakedIid<AdaptiveCards::Rendering::Uwp::AdaptiveActionElementBase>>
{
InspectableClass(RuntimeClass_AdaptiveCards_Rendering_Uwp_AdaptiveSubmitAction, BaseTrust)
public:
HRESULT RuntimeClassInitialize() noexcept;
HRESULT RuntimeClassInitialize(_In_ const std::shared_ptr<AdaptiveCards::SubmitAction>& sharedSubmitAction);
// IAdaptiveSubmitAction
IFACEMETHODIMP get_DataJson(_Out_ ABI::Windows::Data::Json::IJsonValue** data);
IFACEMETHODIMP put_DataJson(_In_ ABI::Windows::Data::Json::IJsonValue* data);
// IAdaptiveActionElement
IFACEMETHODIMP get_ActionType(_Out_ ABI::AdaptiveCards::Rendering::Uwp::ActionType* actionType);
IFACEMETHODIMP get_ActionTypeString(_Out_ HSTRING* value) { return AdaptiveActionElementBase::get_ActionTypeString(value); }
IFACEMETHODIMP get_Title(_Out_ HSTRING* title) { return AdaptiveActionElementBase::get_Title(title); }
IFACEMETHODIMP put_Title(_In_ HSTRING title) { return AdaptiveActionElementBase::put_Title(title); }
IFACEMETHODIMP get_Id(_Out_ HSTRING* id) { return AdaptiveActionElementBase::get_Id(id); }
IFACEMETHODIMP put_Id(_In_ HSTRING id) { return AdaptiveActionElementBase::put_Id(id); }
IFACEMETHODIMP get_AdditionalProperties(_Out_ ABI::Windows::Data::Json::IJsonObject** result) { return AdaptiveActionElementBase::get_AdditionalProperties(result); }
IFACEMETHODIMP put_AdditionalProperties(_In_ ABI::Windows::Data::Json::IJsonObject* value) { return AdaptiveActionElementBase::put_AdditionalProperties(value); }
IFACEMETHODIMP ToJson(_Out_ ABI::Windows::Data::Json::IJsonObject** result) { return AdaptiveActionElementBase::ToJson(result); }
virtual HRESULT GetSharedModel(std::shared_ptr<AdaptiveCards::BaseActionElement>& sharedModel) override;
// ITypePeek method
void *PeekAt(REFIID riid) override
{
return PeekHelper(riid, this);
}
private:
Microsoft::WRL::ComPtr<ABI::Windows::Data::Json::IJsonValue> m_dataJson;
};
ActivatableClass(AdaptiveSubmitAction);
}}} | [
"[email protected]"
] | |
83eaa84a0a7a3e4d4a486e04a5a000aca871fcc2 | 325a3a48500a2cf9246453d611c628f10742953e | /MMOCoreORB/src/templates/tangible/FamiliarPetDeedTemplate.h | 428a4b4c1b00207bfc81b347897747559c8cb97f | [] | no_license | SWGEmu-Private-Servers/SWG-Sentinels-Republic | 39be3fb5655d57bfd8f44a75b234129dc85714be | cd96f476a51296370ffa7b19531a6db05a06d20a | refs/heads/master | 2022-12-17T08:31:57.793579 | 2020-09-22T07:28:57 | 2020-09-22T07:28:57 | 297,396,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 855 | h | /*
* FamiliarPetDeedTemplate.h
*
* Created on: August 17, 2013
* Author: washu
*/
#ifndef FamiliarPetDeedTemplate_H_
#define FamiliarPetDeedTemplate_H_
#include "templates/tangible/DeedTemplate.h"
class FamiliarPetDeedTemplate : public DeedTemplate {
private:
String controlDeviceObjectTemplate;
String mobileTemplate;
public:
FamiliarPetDeedTemplate() {
}
~FamiliarPetDeedTemplate() {
}
void readObject(LuaObject* templateData) {
DeedTemplate::readObject(templateData);
controlDeviceObjectTemplate = templateData->getStringField("controlDeviceObjectTemplate");
mobileTemplate = templateData->getStringField("mobileTemplate");
}
String getControlDeviceObjectTemplate() {
return controlDeviceObjectTemplate;
}
String getMobileTemplate() {
return mobileTemplate;
}
};
#endif /* FamiliarPetDeedTemplate_H_ */
| [
"[email protected]"
] | |
7f4e917e5f72c0bb3746cf2e795b949bdec536d2 | a6f1e7410e0aec1ac94fef71aabf1854b90c3620 | /Hunter104.cpp | 28fac9b239c6a326b1ba2036f0305484035eabb0 | [] | no_license | Kalaiarasan469/Hunter | 876c3ce6f4d50128825981d654d7cecacd2e1ef2 | b2e63ae6611157470af7a4710f3b5267c6c2e3a9 | refs/heads/master | 2021-04-28T05:55:11.852310 | 2018-06-18T16:41:43 | 2018-06-18T16:41:43 | 122,189,750 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | cpp | #include <iostream>
using namespace std;
class Hunter104
{
private:
int i,n=5,j,s=0,c=0,ar[1000];
public:
void get()
{
cin>>n;
}
void sum()
{
while(n!=0)
{
ar[c]=n%10;
n=n/10;
c++;
}
for(i=0;i<c/2;i++)
{
int t=ar[i];
ar[i]=ar[c-i-1];
ar[c-i-1]=t;
}
for(i=0;i<c;i++)
{
for(j=0;j<=i;j++)
{
s+=ar[j];
}
}
cout<<s;
}
Hunter104()
{
get();
sum();
}
};
int main()
{
Hunter104 h;
return 0;
}
| [
"[email protected]"
] | |
1f0129cbf42826edc5a43bfaf6f852af00588bd4 | 1aaeaeaf042529cb0e5b551cde992c91e501e46c | /lab1/src/treewidget.h | ee5b15b3a3e38a62180f8a1566361c19758a0e04 | [] | no_license | Kazeshirou/ppo | 17c3371de5a2f9d06a1a6cedd738b98fa52d0576 | b857fb8ba6b6cf712e4b365911ace4d7f814a1dc | refs/heads/master | 2020-03-09T06:03:02.540815 | 2018-05-31T13:51:57 | 2018-05-31T13:51:57 | 128,628,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | h | #ifndef TREEWIDGET_H
#define TREEWIDGET_H
#include <QTreeWidget>
class GeoRoute;
class QGeoCoordinate;
class TreeWidget: public QTreeWidget
{
Q_OBJECT
public:
explicit TreeWidget(QWidget *parent = nullptr);
~TreeWidget() = default;
void insertRoute(const GeoRoute &route, const int index = -1);
void removeRoute(const int index = -1);
void insertCoordinate(const QGeoCoordinate &coordinate, const int route, const int index = -1);
void removeCoordinate(const int route, const int index = -1);
int currentRoute();
int currentCoordinate();
bool currentIsRoute();
void changeRoute(int index, QString newname);
void changeRouteLength(int index, double newlength);
void changeCoordinate(int route, int index, int column, double newvalue);
signals:
void s_changeRoute(int index, QString newname);
void s_changeCoordinate(int route, int index, int column, double newvalue);
protected:
bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event);
protected slots:
void commitData(QWidget *editor);
};
#endif // TREEWIDGET_H
| [
"[email protected]"
] | |
7d289c99f191ea82c24dc5ae299c24ed35941a35 | a702fd5e803eca1fc66a4bb435ed68837db4a47b | /core/modules/replica/WorkerProcessorThread.h | 2508f51216d8ca5039859c7a70cb85829edf949d | [] | no_license | fjammes/qserv | f65c5775ca7f5a286b0bef2fd215a71ca47bc249 | 00595c8e6a3ec538c191976045c3c06fc0a15626 | refs/heads/master | 2020-04-27T18:02:32.130713 | 2019-03-18T08:42:36 | 2019-03-18T08:42:36 | 25,034,564 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,066 | h | // -*- LSST-C++ -*-
/*
* LSST Data Management System
* Copyright 2017 LSST Corporation.
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the LSST License Statement and
* the GNU General Public License along with this program. If not,
* see <http://www.lsstcorp.org/LegalNotices/>.
*/
#ifndef LSST_QSERV_REPLICA_WORKERPROCESSORTHREAD_H
#define LSST_QSERV_REPLICA_WORKERPROCESSORTHREAD_H
// System headers
#include <atomic>
#include <memory>
#include <thread>
// This header declarations
namespace lsst {
namespace qserv {
namespace replica {
/// Forward declaration for the class
class WorkerProcessor;
/**
* Class WorkerProcessorThread is a thread-based request processing engine
* for replication requests within worker-side services.
*/
class WorkerProcessorThread
: public std::enable_shared_from_this<WorkerProcessorThread> {
public:
/// Smart reference to objects of the class
typedef std::shared_ptr<WorkerProcessorThread> Ptr;
/// Smart reference for the WorkerProcessor's objects
typedef std::shared_ptr<WorkerProcessor> WorkerProcessorPtr;
/**
* Static factory method is needed to prevent issue with the lifespan
* and memory management of instances created otherwise (as values or via
* low-level pointers).
*
* @param processor
* pointer to the processor
*
* @return
* pointer to the created object
*/
static Ptr create(WorkerProcessorPtr const& processor);
// Default construction and copy semantics are prohibited
WorkerProcessorThread() = delete;
WorkerProcessorThread(WorkerProcessorThread const&) = delete;
WorkerProcessorThread& operator=(WorkerProcessorThread const&) = delete;
~WorkerProcessorThread() = default;
/// @return identifier of this thread object
unsigned int id() const { return _id; }
/// @return 'true' if the processing thread is still running
bool isRunning() const;
/**
* Create and run the thread (if none is still running) fetching
* and processing requests until method stop() is called.
*/
void run();
/**
* Tell the running thread to abort processing the current
* request (if any), put that request back into the input queue,
* stop fetching new requests and finish. The thread can be resumed
* later by calling method run().
*
* NOTE: This is an asynchronous operation.
*/
void stop();
/// @return context string
std::string context() const { return "THREAD: " + std::to_string(_id) + " "; }
private:
/**
* The constructor of the class.
*
* @param processor pointer to the processor
* @param id a unique identifier of this object
*/
WorkerProcessorThread(WorkerProcessorPtr const& processor,
unsigned int id);
/**
* Event handler called by the thread when it's about to stop
*/
void stopped();
private:
/// The processor
WorkerProcessorPtr const _processor;
/// The identifier of this thread object
unsigned int const _id;
/// The processing thread is created on demand when calling method run()
std::unique_ptr<std::thread> _thread;
/// The flag to be raised to tell the running thread to stop.
/// The thread will reset this flag when it finishes.
std::atomic<bool> _stop;
};
}}} // namespace lsst::qserv::replica
#endif // LSST_QSERV_REPLICA_WORKERPROCESSORTHREAD_H
| [
"[email protected]"
] | |
0b00a742ba7cdd73598cf1f08f5adbcc538101c1 | e8adbd28cc05fbcead7a8c6f5d0f6b1ce60ca18b | /include/dali/core/mm/malloc_resource.h | 441ad7f0fd15f44763cf984a18b0453f83b6969b | [
"Apache-2.0"
] | permissive | hoangtnm/DALI | 45cfd38690519f7ab43001d9f978261740e36d18 | a49640db9bda176b99523fa4a509bfbd75b3e4e4 | refs/heads/main | 2023-07-24T00:10:46.553798 | 2021-09-06T21:50:51 | 2021-09-06T21:50:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,498 | h | // Copyright (c) 2020-2021, NVIDIA CORPORATION & 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.
// 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 DALI_CORE_MM_MALLOC_RESOURCE_H_
#define DALI_CORE_MM_MALLOC_RESOURCE_H_
#include <stdlib.h>
#include <malloc.h>
#include "dali/core/mm/memory_resource.h"
#include "dali/core/cuda_error.h"
#include "dali/core/mm/detail/align.h"
namespace dali {
namespace mm {
/**
* @brief A memory resource that manages host memory with std::aligned_alloc and std::free
*/
class malloc_memory_resource : public host_memory_resource {
void *do_allocate(size_t bytes, size_t alignment) override {
if (bytes == 0)
return nullptr;
void *ptr = memalign(alignment, bytes + sizeof(int));
if (!ptr)
throw std::bad_alloc();
return ptr;
}
void do_deallocate(void *ptr, size_t bytes, size_t alignment) override {
return free(ptr);
}
bool do_is_equal(const memory_resource &other) const noexcept override {
return dynamic_cast<const malloc_memory_resource*>(&other) != nullptr;
}
public:
static malloc_memory_resource &instance() {
static malloc_memory_resource inst;
return inst;
}
};
/**
* @brief A memory resource that directly calls cudaMalloc and cudaFree.
*/
class cuda_malloc_memory_resource : public device_async_resource {
void *do_allocate(size_t bytes, size_t alignment) override {
if (bytes == 0)
return nullptr;
void *mem = nullptr;
if (alignment > 256)
throw dali::CUDABadAlloc();
CUDA_CALL(cudaMalloc(&mem, bytes | 1)); // |1 to prevent accidental coalescing
return mem;
}
void do_deallocate(void *ptr, size_t bytes, size_t alignment) override {
if (ptr) {
CUDA_DTOR_CALL(cudaFree(ptr));
}
}
void *do_allocate_async(size_t bytes, size_t alignment, stream_view) override {
return allocate(bytes, alignment);
}
void do_deallocate_async(void *mem, size_t bytes, size_t alignment, stream_view) override {
return deallocate(mem, bytes, alignment);
}
bool do_is_equal(const memory_resource<memory_kind> &other) const noexcept override {
return dynamic_cast<const cuda_malloc_memory_resource*>(&other) != nullptr;
}
public:
static cuda_malloc_memory_resource &instance() {
static cuda_malloc_memory_resource inst;
return inst;
}
};
/**
* @brief A memory resource that directly calls cudaMallocHost and cudaFreeHost.
*/
class pinned_malloc_memory_resource : public pinned_async_resource {
const size_t kGuaranteedAlignment = 256;
void *do_allocate(size_t bytes, size_t alignment) override {
if (bytes == 0)
return nullptr;
if (kGuaranteedAlignment < 256)
alignment = 1; // cudaMallocHost guarantees suffcient alignment - avoid overhead
return detail::aligned_alloc([](size_t size) {
void *mem = nullptr;
CUDA_CALL(cudaMallocHost(&mem, size | 1)); // |1 to prevent accidental coalescing
return mem;
}, bytes, alignment);
}
void do_deallocate(void *ptr, size_t bytes, size_t alignment) override {
if (ptr) {
if (kGuaranteedAlignment < 256)
alignment = 1; // cudaMallocHost guarantees suffcient alignment - avoid overhead
detail::aligned_dealloc([](void *ptr, size_t) {
CUDA_DTOR_CALL(cudaFreeHost(ptr));
}, ptr, bytes, alignment);
}
}
void *do_allocate_async(size_t bytes, size_t alignment, stream_view) override {
return allocate(bytes, alignment);
}
void do_deallocate_async(void *mem, size_t bytes, size_t alignment, stream_view) override {
return deallocate(mem, bytes, alignment);
}
bool do_is_equal(const memory_resource<memory_kind> &other) const noexcept override {
return dynamic_cast<const cuda_malloc_memory_resource*>(&other) != nullptr;
}
public:
static cuda_malloc_memory_resource &instance() {
static cuda_malloc_memory_resource inst;
return inst;
}
};
} // namespace mm
} // namespace dali
#endif // DALI_CORE_MM_MALLOC_RESOURCE_H_
| [
"[email protected]"
] | |
9fa337c89f6762362f18c5adc3a434ebf68a35ea | d2190cbb5ea5463410eb84ec8b4c6a660e4b3d0e | /old_hydra/hydra/branches/v3_04stable/shower/hshowergeanthit.cc | cda112ac640b4de9a2fc0a83e6fbcebc3cddd17a | [] | no_license | wesmail/hydra | 6c681572ff6db2c60c9e36ec864a3c0e83e6aa6a | ab934d4c7eff335cc2d25f212034121f050aadf1 | refs/heads/master | 2021-07-05T17:04:53.402387 | 2020-08-12T08:54:11 | 2020-08-12T08:54:11 | 149,625,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,892 | cc | #include "TObject.h"
#include "hshowergeanthit.h"
#include <iostream.h>
//////////////////////////////////////////////////////
// HShowerGeantHit
//
// This class contains one hit in one cell of the rich.
//
//////////////////////////////////////////////////////
ClassImp(HShowerGeantHit)
HShowerGeantHit::HShowerGeantHit() {
}
HShowerGeantHit::~HShowerGeantHit() {
}
void HShowerGeantHit::Clear() {
fBetaHit = 0.0;
fMomHit = 0.0;
fELosHit = 0.0;
nDetHit = 0;
fPhiHit = 0.0;
fThetaHit = 0.0;
fXHit = 0.0;
fYHit = 0.0;
nTrack = -1;
}
void HShowerGeantHit::getXY(Float_t* pfX, Float_t* pfY) {
*pfX = fXHit;
*pfY = fYHit;
}
void HShowerGeantHit::getAngles(Float_t* pfTheta, Float_t* pfPhi) {
*pfTheta = fThetaHit;
*pfPhi = fPhiHit;
}
Float_t HShowerGeantHit::getEnerLos() {
return fELosHit;
}
Float_t HShowerGeantHit::getBeta() {
return fBetaHit;
}
Float_t HShowerGeantHit::getMom() {
return fMomHit;
}
Int_t HShowerGeantHit::getDetector() {
return nDetHit;
}
Int_t HShowerGeantHit::getSector() {
return nSectHit;
}
Int_t HShowerGeantHit::getTrack() {
return nTrack;
}
void HShowerGeantHit::setXY(Float_t fX, Float_t fY) {
fXHit = fX;
fYHit= fY;
}
void HShowerGeantHit::setAngles(Float_t fTheta, Float_t fPhi) {
fThetaHit= fTheta;
fPhiHit = fPhi;
}
void HShowerGeantHit::setEnerLos(Float_t fEner) {
fELosHit = fEner;
}
void HShowerGeantHit::setBeta(Float_t fBeta) {
fBetaHit = fBeta;
}
void HShowerGeantHit::setMom(Float_t fMom) {
fMomHit = fMom;
}
void HShowerGeantHit::setDetector(Int_t nDet) {
nDetHit = nDet;
}
void HShowerGeantHit::setSector(Int_t nSect) {
nSectHit = nSect;
}
void HShowerGeantHit::setTrack(Int_t nTrk) {
nTrack = nTrk;
}
ostream& operator<< (ostream& output, HShowerGeantHit& raw) {
// output<<"pad charge:"<<raw.charge;
return output;
}
| [
"[email protected]"
] | |
c9b782acecce2c28e76949dbf014a51c4434705a | 585957053b8dbf7e8a2febef4f828e654cf53dc5 | /src/net/Misc.h | 1c63342f502fe7ba8c0bbfda0e656bc341639217 | [] | no_license | elefant/libmintress | a8e34dc907399028fc27f9244c9482fcee2d80d4 | 7f5ecc1cc95ad42f045faf73c0a943cfcb0553d4 | refs/heads/master | 2021-01-17T08:25:58.776477 | 2016-08-12T02:46:14 | 2016-08-12T02:46:14 | 65,517,734 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 529 | h | #ifndef NET_MISC_H
#define NET_MISC_H
#include <string>
namespace net
{
enum Protocol
{
PROTOCOL_TCP,
PROTOCOL_UDP,
PROTOCOL_HTTP,
PROTOCOL_RTP,
PROTOCOL_RTSP,
PROTOCOL_UNKNOWN,
};
std::string getLocalIp();
std::string encodeUrl
(
const std::string& aUrl
);
std::string decodeUrl
(
const std::string& aUrl
);
Protocol getProtocol
(
const std::string& aUrl
);
}
#endif
| [
"[email protected]"
] | |
a66b00cee1a07d0db53791255a2c1590ebcb3a01 | f20dc74769927484eab9f84bc152c92ea7ce0766 | /src/Main.cpp | 2928eb9577990c84ed12644bc11f8f34f3d0abb4 | [] | no_license | AndreiRafael/HyperFire3000 | db67b4c76851767e2508346a21952f7a9ce5f482 | 3f49c01002929ad464d698ef7eb7bd009a4a2a01 | refs/heads/master | 2020-08-06T03:29:04.413720 | 2019-11-27T16:27:34 | 2019-11-27T16:27:34 | 212,817,149 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 681 | cpp | #include <iostream>
#include <string>
#include <time.h>
#include "core/GameManager.h"
#include "core/InputManager.h"
#include "core/AudioManager.h"
#include <ExampleScene.h>
int main(int argc, char* argv[]) {
srand(time(NULL));
SDL_Init(SDL_INIT_EVERYTHING);
auto manager = hf::GameManager::get_instance();
auto audio_manager = hf::AudioManager::get_instance();
audio_manager->init(32);
int width;
int height;
manager->get_display_size(&width, &height);
manager->init("Window", width, height);
manager->set_clear_color(255, 0, 255, 255);
manager->set_next_scene<ExampleScene>();
manager->begin_loop();
manager->clear_instance();
SDL_Quit();
return 0;
} | [
"[email protected]"
] | |
9f195a25b7211cd51d1c56baed8fff6393bdba48 | b4f42eed62aa7ef0e28f04c1f455f030115ec58e | /messagingfw/senduiservices/launcher/src/senduilauncher.cpp | e2251487f4c9c92697f28e5b58eaaf3c7094becc | [] | no_license | SymbianSource/oss.FCL.sf.mw.messagingmw | 6addffd79d854f7a670cbb5d89341b0aa6e8c849 | 7af85768c2d2bc370cbb3b95e01103f7b7577455 | refs/heads/master | 2021-01-17T16:45:41.697969 | 2010-11-03T17:11:46 | 2010-11-03T17:11:46 | 71,851,820 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,227 | cpp | /*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Server application for launching SendUI services with
* low capabilites.
*
*/
#include <eikstart.h>
#include "senduilauncherapp.h"
// ======== GLOBAL FUNCTIONS ========
// ---------------------------------------------------------------------------
// Constructs and returns an application object.
// ---------------------------------------------------------------------------
//
LOCAL_C CApaApplication* NewApplication()
{
return new CSendUiLauncherApplication;
}
// ---------------------------------------------------------------------------
// Main function of the application executable.
// ---------------------------------------------------------------------------
//
TInt E32Main()
{
return EikStart::RunApplication(NewApplication);
}
| [
"[email protected]"
] | |
cafde7ffe1ac6a6510fbe7edb04d7436980a4b58 | 04b021cb3fd6274a80ed322775fd4bc14cf161ea | /datastructures/Dynamic Programming/edit distance/main.cpp | 027191886e7e69d5eb0a819647ea12b9f6758087 | [] | no_license | ashishcas/programs | f402c82fdac1aefca2db123db2391c441acf333d | fbfd90fa06b36346033b63e33619af34b9e9caf1 | refs/heads/master | 2020-03-17T13:53:40.676577 | 2019-08-20T15:54:04 | 2019-08-20T15:54:04 | 133,649,020 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 805 | cpp | #include <bits/stdc++.h>
using namespace std;
int mini(int a,int b,int c)
{
return min(min(a,b),c);
}
int edit(string s,string t)
{
int m = s.length();
int n = t.length();
int dp[m+1][n+1];
for(int i =0;i<=m;i++)
{
for(int j=0;j<=n;j++)
{
if(i == 0)
{
dp[i][j] = j;
}
else if( j == 0)
{
dp[i][j] = i;
}
else if (s[i-1] == t[j-1] )
{
dp[i][j] = dp[i-1][j-1];
}
else
{
dp[i][j] = 1+mini(dp[i][j-1],dp[i-1][j-1],dp[i][j-1]);
}
}
}
return dp[m][n];
}
int main()
{
string s,t;
cin>>s>>t;
cout<<edit(s,t)<<endl;
return 0;
}
| [
"[email protected]"
] | |
3339c57d2bbcd03d8b707f0e38bcfda084d97a4e | 320b6334f470f05e0b6eaba1064a3d6cd339bfd5 | /MFCApplication2/situation.h | c163278cc7bf068543e20accece6502eb6be7c21 | [
"MIT"
] | permissive | kzbnb/Alan-s-Gobang | 135306e288706c1b5a192e6df8cbbd50e9ae8abf | 7bd00da07629dee9a75d1b9981cc1e39ae12e516 | refs/heads/master | 2020-07-13T16:52:17.876637 | 2019-08-29T13:32:09 | 2019-08-29T13:32:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 262 | h | #pragma once
#ifndef SITUATION
#define SITUATION
class situation
{
public:
int five_win = 0, four_live = 0, four_chong = 0, four_die = 0, three_live = 0,
three_sleep = 0, two_live = 0, two_sleep = 0;
int score(int ,int );
};
#endif // !POINT
| [
"[email protected]"
] | |
adef425781dc018852870710b54633f604b326fd | 8a31c32e471630c2a490aa2a90f3a317fdbb37ba | /SymbolTable/hashtable.h | 9d36894215708817392174f7f8e6b681bf80e0a9 | [] | no_license | irstavr/wizAlgorithms | 8c2fa13b3c53067d6c74ab5ae039460f9474806b | 06e00a4dfbeda013ba8421dd20695c23ab9e0e1b | refs/heads/master | 2021-01-10T10:21:26.928253 | 2015-10-28T19:44:30 | 2015-10-28T19:44:30 | 45,123,937 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,685 | h | /* File: hashtable.h
* -----------------
* This is a simple table for storing values associated with a string
* key, supporting simple operations for enter and lookup.
*
* keys: strings
* values: any type
*/
#ifndef _H_hashtable
#define _H_hashtable
#include <map>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string.h> // strdup
#include <utility> // std::pair
template <class Value>
class Iterator;
template<class Value>
class Hashtable {
private:
std::multimap<std::string, Value> mmap;
public:
// ctor creates a new empty hashtable
Hashtable() {}
// Returns number of entries currently in table
int getNumEntries() const;
// Associates value with key. If a previous entry for
// key exists, the bool parameter controls whether
// new value overwrites the previous (removing it from
// from the table entirely) or just shadows it (keeps previous
// and adds additional entry). The lastmost entered one for an
// key will be the one returned by Lookup.
void enter(std::string key, Value value, bool overwriteInsteadOfShadow = true);
// Removes a given key->value pair. Any other values
// for that key are not affected. If this is the last
// remaining value for that key, the key is removed
// entirely.
void remove(std::string key, Value value);
// Returns value stored under key or NULL if no match.
// If more than one value for key (ie shadow feature was
// used during Enter), returns the lastmost entered one.
Value lookup(std::string key);
void printall(void);
// Returns an Iterator object (see below) that can be used to
// visit each value in the table in alphabetical order.
Iterator<Value> getIterator();
};
/*
* Iteration implementation.
*/
template <class Value>
class Iterator {
friend class Hashtable<Value>;
private:
typename std::multimap<std::string, Value>::iterator cur, end;
Iterator(std::multimap<std::string, Value>& t)
: cur(t.begin()), end(t.end()) {
}
public:
// Returns current value and advances iterator to next.
// Returns NULL when there are no more values in table
// Visits every value, even those that are shadowed.
Value getNextValue();
};
/* Hashtable::enter
* ----------------
* Stores new value for given identifier. If the key already
* has an entry and flag is to overwrite, will remove previous entry first,
* otherwise it just adds another entry under same key. Copies the
* key, so you don't have to worry about its allocation.
*/
template <class Value>
void
Hashtable<Value>::enter(std::string key, Value val, bool overwrite)
{
assert(val);
Value prev;
if (overwrite && (prev = lookup(key)))
{
remove(key, prev);
}
mmap.insert(std::make_pair(key, val));
}
/* Hashtable::Remove
* -----------------
* Removes a given key-value pair from table. If no such pair, no
* changes are made. Does not affect any other entries under that key.
*/
template <class Value>
void
Hashtable<Value>::remove(std::string key, Value val)
{
if (mmap.count(key) == 0)
{ // no matches at all
return;
}
typename std::multimap<std::string, Value>::iterator itr;
itr = mmap.find(key); // start at first occurrence
while (itr != mmap.upper_bound(key))
{
if (itr->second == val)
{ // iterate to find matching pair
mmap.erase(itr);
break;
}
++itr;
}
}
/* Hashtable::Lookup
* -----------------
* Returns the value earlier stored under key or NULL
* if there is no matching entry
*/
template <class Value>
Value
Hashtable<Value>::lookup(std::string key)
{
Value found = NULL;
if (mmap.count(key) > 0)
{
typename std::multimap<std::string, Value>::iterator cur, last, prev;
cur = mmap.find(key); // start at first occurrence
last = mmap.upper_bound(key);
while (cur != last)
{ // iterate to find last entered
prev = cur;
if (++cur == mmap.upper_bound(key))
{ // have to go one too far
found = prev->second; // one before last was it
break;
}
}
}
return found;
}
/* Hashtable::NumEntries
* ---------------------
*/
template <class Value>
int
Hashtable<Value>::getNumEntries() const
{
return mmap.size();
}
/* Hashtable:GetIterator
* ---------------------
* Returns iterator which can be used to walk through all values in table.
*/
template <class Value>
Iterator<Value>
Hashtable<Value>::getIterator()
{
return Iterator<Value>(mmap);
}
/* Iterator::GetNextValue
* ----------------------
* Iterator method used to return current value and advance iterator
* to next entry. Returns null if no more values exist.
*/
template <class Value>
Value
Iterator<Value>::getNextValue()
{
if (cur != end)
{
return (*cur++).second;
}
return NULL;
}
template <class Value>
void
Hashtable<Value>::printall(void)
{
typename std::multimap<std::string, Value>::const_iterator cur;
for (cur = mmap.begin(); cur != mmap.end(); ++cur)
{
char *cstr = new char[(cur->first).length() + 1];
strcpy(cstr, (cur->first).c_str());
printf("%*s[%s] [%s: %d] [scope: %d] [addr: %p] [table addr: %p]\n",
3 * 0, "",
cstr,
"TType", cur->second->getTType()->getTTypeID(),
cur->second->getScope(),
cur->second,
cur->second->getGamma());
delete [] cstr;
}
}
#endif
| [
"[email protected]"
] | |
3e9e283b586c3e91c8c7895f801ffe725dfe2840 | 7d19bd1b18359573bd2d5e39a730738df821a4d1 | /libs/concurrency/include_compatibility/hpx/util/spinlock.hpp | 0023efd5cd8ba57f071e814532e092701703f973 | [
"BSL-1.0",
"LicenseRef-scancode-free-unknown"
] | permissive | sarthakag/hpx | 4f45d3b8e2fc88d7d2f0bf0abb7d231cd18360e6 | a895dda5272634c5a8c9e35a45405699075a119e | refs/heads/master | 2022-04-11T23:38:21.432194 | 2020-03-25T19:11:37 | 2020-03-25T19:11:37 | 250,194,241 | 1 | 0 | BSL-1.0 | 2020-03-26T07:52:49 | 2020-03-26T07:52:48 | null | UTF-8 | C++ | false | false | 686 | hpp | // Copyright (c) 2019 Mikael Simberg
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <hpx/config.hpp>
#include <hpx/concurrency/config/defines.hpp>
#include <hpx/concurrency/spinlock.hpp>
#if defined(HPX_CONCURRENCY_HAVE_DEPRECATION_WARNINGS)
#if defined(HPX_MSVC)
#pragma message("The header hpx/util/spinlock.hpp is deprecated, \
please include hpx/concurrency/spinlock.hpp instead")
#else
#warning "The header hpx/util/spinlock.hpp is deprecated, \
please include hpx/concurrency/spinlock.hpp instead"
#endif
#endif
| [
"[email protected]"
] | |
577da0f627632aa20995b67900c8178a613263fc | 9109cbb93e6a2981199425c809f09ba8e9d774d2 | /topcoder/some-easy-problem/srm475.cpp | e011fd5a2cb45a4f1cc85106cff5dcd865f2e40f | [] | no_license | chffy/ACM-ICPC | e8ea50337931d997685c0fac1f0b424f33ab4e37 | 59f071b014634e923338571aaa2272c490a8a0ae | refs/heads/master | 2020-05-30T05:00:10.775875 | 2016-03-28T14:37:08 | 2016-03-28T14:37:08 | 23,791,162 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,269 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
int num[20], cnt[20];
int sum[20], pre[20], prd[20];
class RabbitStepping {
public:
double getExpected(string field, int r) {
int n = field.size();
int tot = 0;
for (int i = 0; i < 1 << n; ++i) {
if (__builtin_popcount(i) != r) continue;
++tot;
for (int j = 0; j < n; ++j)
if (i >> j & 1) ++sum[j];
}
double ans = 0;
for (int pos = 0; pos < n; ++pos) {
for (int mask = 0; mask < 1 << n; ++mask) {
if (__builtin_popcount(mask) != r) continue;
if (!(mask >> pos & 1)) continue;
for (int i = 0; i < n; ++i)
if (mask >> i & 1) num[i] = 1;
else num[i] = 0;
memset(pre, -1, sizeof(pre));
int m = n, x = pos;
while (m > 2) {
int flag = 0;
memset(cnt, 0, sizeof(cnt));
memset(prd, 0, sizeof(prd));
for (int i = 0; i < m; ++i) {
int y;
if (i == 0) y = 1;
else if (i >= m - 2) y = i - 1;
else if (field[i] == 'W') y = i - 1;
else if (field[i] == 'B') y = i + 1;
else if (field[i] == 'R') {
if (pre[i] == -1) y = i - 1;
else y = pre[i];
}
cnt[y] += num[i];
prd[y] = i;
if (i == x && !flag) {
x = y;
flag = 1;
}
}
memcpy(pre, prd, sizeof(pre));
memcpy(num, cnt, sizeof(num));
for (int i = 0; i < m; ++i)
if (num[i] > 1) num[i] = 0;
if (num[x] == 0) break;
--m;
}
if (num[x]) ans += 1.0 / tot;
}
}
return ans;
}
};
| [
"[email protected]"
] | |
b1b15d427580d595262d5c0ebb49fbb9610e4c60 | 444060f6c7b9d18143207f8052fadb5d0835d2f8 | /callback_remove/callback_remove_kernel/main.cpp | 4699c092160404143545ab41227cf06655ad4024 | [
"Apache-2.0"
] | permissive | yougar0/driver_callback_bypass_1909 | e19f43d8450879a3a77f77024d55ebfa0dcada5b | e8cd15e16b3e8f976c422344c9db9eaec6a0ba61 | refs/heads/main | 2023-07-04T07:44:14.666166 | 2021-08-05T09:46:23 | 2021-08-05T09:46:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,242 | cpp | #include <ntddk.h>
#include "struct.hpp"
#include "ob.hpp"
NTSTATUS defalut_irp(
PDEVICE_OBJECT device,
PIRP irp)
{
UNREFERENCED_PARAMETER(device);
irp->IoStatus.Status = STATUS_SUCCESS;
irp->IoStatus.Information = 0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
NTSTATUS communication_irp(
PDEVICE_OBJECT device,
PIRP irp)
{
UNREFERENCED_PARAMETER(device);
PIO_STACK_LOCATION io = IoGetCurrentIrpStackLocation(irp);
ULONG control = io->Parameters.DeviceIoControl.IoControlCode;
// pcommon_info info = (pcommon_info)irp->AssociatedIrp.SystemBuffer;
pcommon_info info = (pcommon_info)MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority);
switch (control)
{
case IoGetObCallback:
_ob::get_ob_callback(info);
break;
case IoRemoveObCallback:
break;
case IoDisableObCallback:
break;
}
KeFlushIoBuffers(irp->MdlAddress, TRUE, FALSE);
irp->IoStatus.Status = STATUS_SUCCESS;
irp->IoStatus.Information = 0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
VOID DriverUnload(PDRIVER_OBJECT driver)
{
UNREFERENCED_PARAMETER(driver);
if (g_device_object != nullptr)
{
IoDeleteSymbolicLink(&g_symbolic_link);
IoDeleteDevice(g_device_object);
}
g_device_object = nullptr;
DbgPrintEx(0, 0, "[%s] release \n", __FUNCTION__);
}
EXTERN_C
NTSTATUS
DriverEntry(
PDRIVER_OBJECT driver,
PUNICODE_STRING reg)
{
UNREFERENCED_PARAMETER(driver);
UNREFERENCED_PARAMETER(reg);
NTSTATUS status = IoCreateDevice(driver, 0, &g_device_name, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &g_device_object);
if (!NT_SUCCESS(status))
return status;
status = IoCreateSymbolicLink(&g_symbolic_link, &g_device_name);
if (!NT_SUCCESS(status))
{
IoDeleteDevice(g_device_object);
return status;
}
for (int i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) driver->MajorFunction[i] = defalut_irp;
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = communication_irp;
driver->DriverUnload = DriverUnload;
g_device_object->Flags |= DO_DIRECT_IO;
g_device_object->Flags &= ~DO_DEVICE_INITIALIZING;
DbgPrintEx(0, 0, "[%s] finish \n", __FUNCTION__);
return status;
} | [
"[email protected]"
] | |
d0511db5d3937d4bc6c3c2118c379b44b6dba01b | e018d8a71360d3a05cba3742b0f21ada405de898 | /Client/DebugKit.cpp | eef4d56f1c0dba02e779eb7adabc742a4a77aebf | [] | no_license | opendarkeden/client | 33f2c7e74628a793087a08307e50161ade6f4a51 | 321b680fad81d52baf65ea7eb3beeb91176c15f4 | refs/heads/master | 2022-11-28T08:41:15.782324 | 2022-11-26T13:21:22 | 2022-11-26T13:21:22 | 42,562,963 | 24 | 18 | null | 2022-11-26T13:21:23 | 2015-09-16T03:43:01 | C++ | UTF-8 | C++ | false | false | 4,019 | cpp | // DebugKit.cpp: implementation of the CDebugKit class.
//
//////////////////////////////////////////////////////////////////////
#include "Client_PCH.h"
#include "stdafx.h"
#include "DebugKit.h"
#include <wtypes.h>
#include "fstream"
extern BOOL g_bMsgOutPutFlag;
extern BOOL g_bMsgDetailFlag;
extern BOOL g_bMsgContentFlag;
extern CMessageStringTable g_MessageStringTable;
extern BYTE g_nKeyMapSelect;
extern int g_nGameVersion;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDebugKit::CDebugKit()
{
m_DebugInfo = new Properties;
}
CDebugKit::~CDebugKit()
{
if(m_DebugInfo!=NULL)
delete m_DebugInfo;
}
BOOL CDebugKit::load()
{
try{
m_DebugInfo->load("DebugInfo.ini");
}
catch (Error) {
return FALSE;
}
catch (IOException) {
return FALSE;
}
return TRUE;
}
std::string CDebugKit::GetMsgFileName()
{
try{
return m_DebugInfo->getProperty("MsgFileName");
}
catch (NoSuchElementException) {
return NULL;
}
}
BOOL CDebugKit::GetMsgOutPutFlag()
{
try{
return ((m_DebugInfo->getPropertyInt("MsgOutPutFlag")>0)?TRUE:FALSE);
}
catch (NoSuchElementException) {
return FALSE;
}
}
BOOL CDebugKit::GetMsgDetailFlag()
{
try{
return ((m_DebugInfo->getPropertyInt("MsgDetailFlag")>0)?TRUE:FALSE);
}
catch (NoSuchElementException) {
return FALSE;
}
}
BOOL CDebugKit::GetMsgContentFlag()
{
try{
return ((m_DebugInfo->getPropertyInt("MsgContentFlag")>0)?TRUE:FALSE);
}
catch (NoSuchElementException) {
return FALSE;
}
}
BYTE CDebugKit::GetAuthKeyMap()
{
try{
return m_DebugInfo->getPropertyInt("AuthKeyMap");
}
catch (NoSuchElementException) {
return FALSE;
}
}
int CDebugKit::GetGameVersion()
{
try{
return m_DebugInfo->getPropertyInt("GameVersion");
}
catch (NoSuchElementException) {
return 0;
}
}
const char *CMessageStringTable::GetMessageName(WORD MessageID)
{
if(IsExistMessageName(MessageID))
return m_MessageName[MessageID].c_str();
else
return "UNKNOWN_MESSAGE";
}
CMessageStringTable::CMessageStringTable()
{
}
CMessageStringTable::~CMessageStringTable()
{
}
void CMessageStringTable::LoadFromFile(std::string strFileName)
{
int i=0;
std::ifstream ifile( strFileName.c_str() , ios::in );
// std::ifstream ifile( "MessageDefine.ini" , ios::in );
if ( ! ifile )
return;
while ( true ) {
std::string line;
std::getline( ifile , line );
if ( ifile.eof() )
break;
uint key_begin = line.find_first_not_of( " \t" );
if ( key_begin == std::string::npos )
continue;
uint key_end = line.find( "," , key_begin );
std::string key = line.substr( key_begin , key_end - key_begin );
SetMessageName(i++,key);
}
ifile.close();
}
void CMessageStringTable::SaveToFile(std::string strFileName)
{
}
#ifdef DEBUG_INFO
BOOL InitDebugInfo()
{
CDebugKit *p_dKit = new CDebugKit();
if(p_dKit->load() == FALSE)
return FALSE;
g_bMsgOutPutFlag = p_dKit->GetMsgOutPutFlag();
g_bMsgContentFlag = p_dKit->GetMsgContentFlag();
g_bMsgDetailFlag = p_dKit->GetMsgDetailFlag();
g_nKeyMapSelect = p_dKit->GetAuthKeyMap();
g_nGameVersion = p_dKit->GetGameVersion();
std::string strFileName;
strFileName = p_dKit->GetMsgFileName();
g_MessageStringTable.LoadFromFile(strFileName);
const char *p_cName = g_MessageStringTable.GetMessageName(100);
delete p_dKit;
return TRUE;
}
void ClearDebugInfo()
{
g_MessageStringTable.ClearMessageName();
}
void PrintMessageDetail(ofstream file, char *strMsg, int length)
{
char temp[1024];
int i,j=0;
memset(temp,0,sizeof(temp));
j += sprintf(temp+j,"\t");
for(i=0; i<length; i++)
{
j += sprintf(temp+j,"%02x ",(BYTE)strMsg[i]);
if((i+1)%16 == 0 && i+1 != length)
j += sprintf(temp+j,"\n\t");
}
j += sprintf(temp+j,"\0");
file << temp << endl;
}
#endif | [
"[email protected]"
] | |
9cbda9f56ba305260f859818004a10098d03d57d | cfcfbd5eaafe91facecfd343c4a8a79fdbfdce5a | /ProjectUI/sisaankirjaus.h | 2796843eb139eed5c9b0311a8013d8c6e334ef72 | [] | no_license | Larry-666/ProjectUI | c19f2ff543943e9af1a794e77ac294f64ad2ad41 | 5a9b600bacdc8d540b3a999c9fe8129e8fce5766 | refs/heads/main | 2023-04-16T13:05:06.007167 | 2021-04-15T09:06:38 | 2021-04-15T09:06:38 | 357,852,272 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 388 | h | #ifndef SISAANKIRJAUS_H
#define SISAANKIRJAUS_H
#include <QDialog>
namespace Ui {
class Sisaankirjaus;
}
class Sisaankirjaus : public QDialog
{
Q_OBJECT
public:
explicit Sisaankirjaus(QWidget *parent = nullptr);
~Sisaankirjaus();
private slots:
void on_pushButton_clicked();
private:
Ui::Sisaankirjaus *ui;
};
#endif // SISAANKIRJAUS_H
| [
"[email protected]"
] | |
16bb523502f6c0e0acc84de717fb1b66e8c8b32f | b26a8e14cfaa1bc2e8086b99ad03ddd686ace72d | /1216 跳马问题.cpp | 78eb23bf7ff572928fc05ea372f7afec67aa2281 | [] | no_license | makixi/codevs | ed2013ed5a9699c3db14f8b4ad62222b139083d0 | cf5893d57ea1bf19ef9e552b9091fc052e8ba214 | refs/heads/master | 2021-04-06T20:51:46.667991 | 2018-04-12T14:39:50 | 2018-04-12T14:39:50 | 125,339,266 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 342 | cpp | #include <cstdio>
int f[301][301],n,m,sx,sy,tx,ty;
int dfs(int x,int y) {
if(x<1||y<1||x>n||y>m)return 0;
if(f[x][y])return f[x][y];
return f[x][y]=(dfs(x-2,y-1)+dfs(x-1,y+2)+
dfs(x-1,y-2)+dfs(x-2,y+1))%123456;
}
int main(){
scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&tx,&ty),f[sx][sy]=1;
printf("%d\n",dfs(tx,ty));
return 0;
}
| [
"[email protected]"
] | |
52869f18a3b327d8c6bcccdb6ec7cd504292e500 | 315450354c6ddeda9269ffa4c96750783963d629 | /CMSSW_7_0_4/tmp/slc6_amd64_gcc481/src/TotemDQMLite/GUI/src/TotemDQMLiteGUI/moc/QRootCanvas_h_moc.cc | 6e2f2b72aaaf3458a6afd9ec9024851263d95872 | [] | no_license | elizamelo/CMSTOTEMSim | e5928d49edb32cbfeae0aedfcf7bd3131211627e | b415e0ff0dad101be5e5de1def59c5894d7ca3e8 | refs/heads/master | 2021-05-01T01:31:38.139992 | 2017-09-12T17:07:12 | 2017-09-12T17:07:12 | 76,041,270 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,420 | cc | /****************************************************************************
** Meta object code from reading C++ file 'QRootCanvas.h'
**
** Created: Mon Jul 11 23:33:08 2016
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../../../../../../../src/TotemDQMLite/GUI/interface/QRootCanvas.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'QRootCanvas.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_QRootCanvas[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_QRootCanvas[] = {
"QRootCanvas\0"
};
void QRootCanvas::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
const QMetaObjectExtraData QRootCanvas::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject QRootCanvas::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_QRootCanvas,
qt_meta_data_QRootCanvas, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &QRootCanvas::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *QRootCanvas::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *QRootCanvas::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_QRootCanvas))
return static_cast<void*>(const_cast< QRootCanvas*>(this));
return QWidget::qt_metacast(_clname);
}
int QRootCanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
QT_END_MOC_NAMESPACE
| [
"[email protected]"
] | |
b36b02820cee28976577749c012fb6367f65762d | 1cfd0b154f05498c3bae47247e77acb598fb8cfb | /Misc/SubarraySumsII.cpp | 9a4910f29df3dfc36cb4897e2a8ddf2af14e95dc | [
"MIT"
] | permissive | 0xWOLAND/CompetitiveProgramming | 291e9e628788a0e14fd6638f6010e589b670d136 | 6dd47e56693e4fb0600a30a16453978fd52d584e | refs/heads/main | 2023-08-21T23:51:29.758793 | 2021-10-13T04:06:43 | 2021-10-13T04:06:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 484 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int n, x;
cin >> n >> x;
std::map<int, int> map;
map[0] = 1;
int u;
int sum = 0, ans = 0;
for(int i = 0; i < n; i++) {
cin >> u;
sum += u;
if(map[sum - x]){
ans += map[sum - x];
}
map[sum] += 1;
}
cout << ans << "\n";
return 0;
}
| [
"[email protected]"
] | |
c2039040fc1d3db9801abb3b8fa2bc12e93dc30f | 4023789d76ee33d3bc4cce94553d94aac79c8dfb | /src/channel.cpp | 4682b5e3ac8b9b97f8998d865e4e57153113c703 | [] | no_license | mwidya/Mutation | d80f5d700c259495c40aa5f04a03f32e4c713101 | 3949412d139f6f743beb3462a1777b1a27f6e944 | refs/heads/master | 2021-01-20T06:22:51.922215 | 2014-08-27T20:53:05 | 2014-08-27T20:53:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 738 | cpp | //
// channel.cpp
// Mutation
//
// Created by Martin Widyanata on 01.08.14.
//
//
#include "channel.h"
channel::channel(int width, int height, int glFormat, string syphonServerName){
mWidth = width;
mHeight = height;
mGlFormat = glFormat;
mSyphonServerName = syphonServerName;
// TODO Test if new instance is created when setName is called
mSyphonServer.setName(mSyphonServerName);
mTexture.allocate(mWidth, mHeight, mGlFormat);
mFbo.allocate(mWidth, mHeight, mGlFormat);
mFbo.begin();
ofClear(255, 255, 255);
mFbo.end();
}
channel::~channel(){
ofLog(OF_LOG_NOTICE, "Desructor ~channel was called");
}
void channel::draw(float x, float y){
mFbo.draw(x, y);
} | [
"[email protected]"
] | |
1ddfe897fd42581c9e61b8b286865de1689aec84 | 019873f0c364b45d560d0008f9719d6ec62bf23d | /help.cpp | 1feaf1d4da06853894ecd1fd2409552d4980e8b2 | [] | no_license | asdredmitry/JordThreads | d31809db0afa735b4e04be96db0806ac2f8bc631 | 5f0b84180815572303dc68d08f1b2cbd57206149 | refs/heads/master | 2021-07-24T14:22:40.693565 | 2017-11-06T23:49:41 | 2017-11-06T23:49:41 | 108,880,389 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,531 | cpp | #include <sys/resource.h>
#include <sys/time.h>
#include <stdio.h>
#include <math.h>
#include "help.h"
#define MAX_OUTPUT_SIZE 10
double f(int i, int j)
{
return fabs(i - j);
}
void readMatrix(int n, double *a, double *b, int mode, FILE *input)
{
int i, j;
double tmp;
if (mode == 1)
{
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
fscanf(input, "%lf", &a[i * n + j]);
fscanf(input, "%lf", &b[i]);
}
fclose(input);
}
else
{
for (i = 0; i < n; i++)
{
tmp = 0.0;
for (j = 0; j < n; j++)
{
a[i * n + j] = f(i, j);
if (!(j % 2)) tmp += a[i * n + j];
}
b[i] = tmp;
}
}
}
void printMatrix(int n, double *a, double *b)
{
int i, j;
int m = (n > MAX_OUTPUT_SIZE) ? MAX_OUTPUT_SIZE : n;
for (i = 0; i < m; i++)
{
printf("| ");
for (j = 0; j < m; j++)
printf("%10.3g ", a[i * n +j]);
printf(" | %10.3g\n", b[i]);
}
}
void printVector(int n, double *x)
{
int i;
int m = (n > MAX_OUTPUT_SIZE) ? MAX_OUTPUT_SIZE : n;
for (i = 0; i < m; i++)
printf("%10.3g ", x[i]);
}
double normNev(int n, double *a, double *b, double *x)
{
int i, j;
double tmp;
double rezult;
rezult = 0.0;
for (i = 0; i < n; i++)
{
tmp = 0.0;
for (j = 0; j < n; j++)
tmp += a[i * n + j] * x[j];
tmp -= b[i];
rezult += tmp * tmp;
}
return sqrt(rezult);
}
double accuracy(int n, double *x)
{
int i;
double tmp;
double rezult;
rezult = 0.0;
for (i = 0; i < n; i++)
{
tmp = x[i];
if (!(i%2)) tmp -= 1.0;
rezult += tmp * tmp;
}
return sqrt(rezult);
}
| [
"[email protected]"
] | |
e8f6eb51060fc776fdf38eb26babfe7e0fb5c63d | 762f52d0e4b51509187e91e90b67b22b9a3fd1b4 | /21. Dynamic Programming/19_elephantInMazeMinCost.cpp | 10dc9fbbd6f134a8f8f7e2065ff3183833c85895 | [] | no_license | apoorvKautilya21/Data-Structures-And-Algorithm-in-C- | f77319e5d56897586f89c377a53f5369a588f85d | c90a8953fc21f0d7a67cb28ec53a8ccf0157c58f | refs/heads/main | 2023-03-03T14:20:37.141531 | 2021-02-06T05:08:54 | 2021-02-06T05:08:54 | 336,460,031 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 592 | cpp | #include<iostream>
using namespace std;
#define R 4
#define C 4
int countPaths() {
int dp[100][100] = {0};
dp[0][0] = 1;
for(int i = 0; i < R; i++) {
for(int j = 0; j < i; j++) {
dp[i][0] += dp[j][0];
}
}
for(int i = 0; i < C; i++) {
for(int j = 0; j < i; j++) {
dp[0][i] += dp[0][i];
}
}
for(int i = 1; i < R; i++) {
for(int j = 1; j < C; j++) {
for(int k = 0; k < i; k++) {
dp[i][j] += dp[k][j];
}
for(int k = 0; k < j; k++) {
dp[i][j] += dp[i][k];
}
}
}
return dp[R - 1][C - 1];
}
int main() {
cout << countPaths();
return 0;
} | [
"[email protected]"
] | |
33b2b1211c66058002fa36240675fb1142204aa2 | ce05aaa05dad66310e159245b2ce4baa9f6ac25b | /viewtestdlg.cpp | cafb8450d601c9ce4334d8f07c75faa70f281473 | [] | no_license | acraig5075/kbutwa-utils | 617c25e6b10e17834e053283f0abbc430343a67f | 3515dc1f069653dd81e3734123b53512418b87fa | refs/heads/master | 2021-10-20T12:38:28.921982 | 2021-10-13T18:47:41 | 2021-10-13T18:47:41 | 47,452,185 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,253 | cpp | #include "viewtestdlg.h"
#include "ui_viewtestdlg.h"
ViewTestDlg::ViewTestDlg(QWidget *parent, const QString &number, const QString &vault, const QVector<QPair<QString, QString>> &labels, const QString &procedure) :
QDialog(parent),
ui(new Ui::ViewTestDlg)
{
ui->setupUi(this);
ui->numberEdit->setReadOnly(true);
ui->vaultEdit->setReadOnly(true);
ui->label1Edit->setReadOnly(true);
ui->label2Edit->setReadOnly(true);
ui->label3Edit->setReadOnly(true);
ui->procedureText->setReadOnly(true);
QLabel *labelNames[] = { ui->label1Name, ui->label2Name, ui->label3Name };
QLineEdit *labelEdits[] = { ui->label1Edit, ui->label2Edit, ui->label3Edit };
std::for_each(std::begin(labelNames), std::end(labelNames), [](QLabel *label){ label->setVisible(false); });
std::for_each(std::begin(labelEdits), std::end(labelEdits), [](QLineEdit *edit){ edit->setVisible(false); });
for (int i = 0; i < qMin(labels.size(), 3); ++i)
{
labelNames[i]->setVisible(true);
labelEdits[i]->setVisible(true);
labelNames[i]->setText(labels.at(i).first);
labelEdits[i]->setText(labels.at(i).second);
}
ui->numberEdit->setText(number);
ui->vaultEdit->setText(vault);
ui->procedureText->setText(procedure);
}
ViewTestDlg::~ViewTestDlg()
{
delete ui;
}
| [
"[email protected]"
] | |
136f02afb1925e38390ed7d069daef83b410d950 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/com/ole32/stg/h/dfdeb.hxx | d624896fdbd21378bd83340f4aed62962e7a8179 | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C++ | false | false | 1,955 | hxx | //+--------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1992.
//
// File: dfdeb.hxx
//
// Contents: Docfile debug header
//
// Functions: DfDebug
// DfSetResLimit
// DfGetResLimit
// DfPrintAllocs
// HaveResource
// ModifyResLimit
//
// History: 13-May-92 DrewB Created
//
//---------------------------------------------------------------
#ifndef __DFDEB_HXX__
#define __DFDEB_HXX__
#if DBG == 1
// Resources that can be controlled
#define DBR_MEMORY 0
#define DBR_XSCOMMITS 1
#define DBR_FAILCOUNT 2
#define DBR_FAILLIMIT 3
#define DBR_FAILTYPES 4
// Resources that can be queried
#define DBRQ_MEMORY_ALLOCATED 5
// Internal resources
#define DBRI_ALLOC_LIST 6
#define DBRI_LOGFILE_LIST 7
// Control flags
#define DBRF_LOGGING 8
//Number of shared heaps allocated
#define DBRQ_HEAPS 9
// Control whether sifting is enabled
#define DBRF_SIFTENABLE 10
#define CDBRESOURCES 11
// Simulated failure types
typedef enum {
DBF_MEMORY = 1,
DBF_DISKFULL = 2,
DBF_DISKREAD = 4,
DBF_DISKWRITE = 8
} DBFAILURE;
// Logging control flags (e.g. DfSetResLimit(DBRF_LOGGING, DFLOG_MIN);)
#define DFLOG_OFF 0x00000000
#define DFLOG_ON 0x02000000
#define DFLOG_PIDTID 0x04000000
STDAPI_(void) DfDebug(ULONG ulLevel, ULONG ulMSFLevel);
STDAPI_(void) DfSetResLimit(UINT iRes, LONG lLimit);
STDAPI_(LONG) DfGetResLimit(UINT iRes);
STDAPI_(void) DfSetFailureType(LONG lTypes);
BOOL SimulateFailure(DBFAILURE failure);
STDAPI_(LONG) DfGetMemAlloced(void);
STDAPI_(void) DfPrintAllocs(void);
// Internal APIs
BOOL HaveResource(UINT iRes, LONG lRequest);
LONG ModifyResLimit(UINT iRes, LONG lChange);
#endif // DBG == 1
#endif // #ifndef __DFDEB_HXX__
| [
"[email protected]"
] | |
97a153e98d58cdffcae462d48f626d813c25c1db | 3562757dd437244240ba9eada1a8e3d65e701fc3 | /IterativePostorder.cpp | 5c114ede2026332da0771fbe204ca6676edca1e3 | [] | no_license | Upasana-12/Trees | ccfa93c3e78b1aab3dafe0a3439374348a7db012 | eef493812d231eb7bd3cbbf0ba95b29d598a7603 | refs/heads/master | 2020-08-07T11:30:35.940599 | 2019-10-07T16:47:33 | 2019-10-07T16:47:33 | 213,432,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 612 | cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
vector<int> Solution::postorderTraversal(TreeNode* A)
{
vector<int> v;
stack<TreeNode*> s1,s2;
while(!s1.empty())
{
TreeNode* temp=s1.top();
s1.pop();
s2.push(temp);
if(temp->left)
s1.push(temp->left);
if(temp->right)
s1.push(temp->right);
}
while(!s2.empty())
{
v.push_back(s2.top()->val);
s2.pop();
}
return v;
}
| [
"[email protected]"
] | |
c6775e133f63b5f4de6e69a1d2a70acc440b80b4 | 165961905f419dbf7844ce25a4f125993252cf2f | /SoftLoader/04.code/SoftLoader/ANCToolPlugin/Config.cpp | 049a15a40a23f12b5cfe17e71f7436871e5732f5 | [] | no_license | Tairycy/Local_git_resp | caf67aa6a5b0807b23dfb9e2c80fbe7ed3247bab | 44b8cbd319327b37a2a5c2dae5b6c8fab8250549 | refs/heads/master | 2023-07-16T03:13:40.200394 | 2021-09-03T08:45:10 | 2021-09-03T08:45:10 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 12,016 | cpp | #include "Config.h"
#include <QFile>
#include <QApplication>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QDebug>
#include <QMessageBox>
#include "../common/customplot/Utility.h"
Config* Config::m_pIns = nullptr;
Config::Config()
: m_wave_format_modified_flag(false)
, m_wave_filter_modified_flag(false)
, m_axis_modified_flag(false)
, m_vec_fr_lines(ConfWaveLinesMaxValue)
, m_vec_phase_lines(ConfWaveLinesMaxValue)
, m_vec_fb(ConfFilesMaxValue)
, m_vec_ff(ConfFilesMaxValue)
, m_vec_music(ConfFilesMaxValue)
, m_fr_chart_data(ConfWaveLinesMaxValue)
, m_phase_chart_data(ConfFilesMaxValue)
, m_sys_dB(0)
, m_nPowerOfTwo(27)
{
for (int i = 0; i < ConfWaveLinesMaxValue; ++i)
{
m_vec_fr_lines[i].name = QString("Line_%1").arg(i + 1);
m_vec_fr_lines[i].clr = LineColors[i];
m_vec_phase_lines[i].name = QString("Line_%1").arg(i + 1);
m_vec_phase_lines[i].clr = LineColors[i];
}
for (int i=0; i<ConfFilesMaxValue; ++i)
{
m_vec_fb[i].nSerial = i + 1;
m_vec_ff[i].nSerial = i + 1;
}
}
Config::~Config()
{
}
Config * Config::getIns()
{
if (m_pIns == nullptr)
{
m_pIns = new Config;
}
return m_pIns;
}
int Config::initConf()
{
int nRet = 0;
readCommonJson();
int nRetAxis = 0;
bool bReadJson = readJson_axis();
if (!bReadJson)
{
nRetAxis = 10;
}
return nRet+nRetAxis;
}
void Config::saveOut()
{
writeJson_axis();
}
bool Config::readCommonJson()
{
QString strPathFile = QApplication::applicationDirPath();
strPathFile = strPathFile + QString("/config/ANCTool/common.json");
QFile file(strPathFile);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "打开文件失败,错误信息为:" << file.errorString();
return false;
}
QByteArray allData = file.readAll();
file.close();
QJsonParseError jsonError;
QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError));
if (jsonError.error != QJsonParseError::NoError)
{
qDebug() << "json error!" << jsonError.errorString();
return false;
}
QJsonObject root = jsonDoc.object();
m_nPowerOfTwo = root["powerOfTwo"].toInt();
m_sys_dB = root["sys_db"].toInt();
m_sys_freqRate = root["freqrate"].toInt();
m_sys_channel = root["channel"].toInt();
return true;
}
bool Config::writeCommonJson()
{
QString strPathFile = QApplication::applicationDirPath();
strPathFile = strPathFile + QString("/config/ANCTool/common.json");
QFile file(strPathFile);
if (!file.open(QIODevice::ReadWrite |QIODevice::Text))
{
qDebug() << QStringLiteral("打开文件失败,错误信息为:" )<< file.errorString();
return false;
}
file.resize(0); //清空文件中的原有内容
QJsonDocument jsonDoc;
QJsonObject jsonRoot;
jsonRoot["powerOfTwo"] = m_nPowerOfTwo;
jsonRoot["sys_db"] = m_sys_dB;
jsonRoot["freqrate"] = m_sys_freqRate;
jsonRoot["channel"] = m_sys_channel;
jsonDoc.setObject(jsonRoot);
file.write(jsonDoc.toJson());
file.close();
return true;
}
bool Config::readJson(QString strFile)
{
//QString strPathFile = QApplication::applicationDirPath();
//strPathFile = strPathFile + QString("/config/ANCTool/wave_filter_conf.json");
QFile file(strFile);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "打开文件失败,错误信息为:"<<file.errorString();
return false;
}
QByteArray allData = file.readAll();
file.close();
QJsonParseError jsonError;
QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError));
if (jsonError.error != QJsonParseError::NoError)
{
qDebug() << "json error!" << jsonError.errorString();
return false;
}
QJsonObject root = jsonDoc.object();
int nSysFreqRate = root["freqrate"].toInt();
if (m_sys_freqRate != nSysFreqRate)
{
QMessageBox::StandardButton button = QMessageBox::information(nullptr, QStringLiteral("提示"), QStringLiteral("当前系统设置的采样率与加载的配置不符,是否继续加载配置文件?"), QMessageBox::Yes, QMessageBox::No);
if (button == QMessageBox::No)
{
return false;
}
}
QJsonObject obj_wave_filter_ff = root["wave_filter_ff"].toObject();
QJsonObject obj_wave_filter_fb = root["wave_filter_fb"].toObject();
//QJsonObject obj_wave_filter_music = root["wave_filter_music"].toObject();
//FF配置读取
QJsonArray objArray_wave_filter_ff = obj_wave_filter_ff["data"].toArray();
for (int i = 0; i < objArray_wave_filter_ff.size(); i++)
{
QJsonObject tempObj = objArray_wave_filter_ff.at(i).toObject();
CONF_WAVE_FILTER_PARAM tempStu;
tempStu.nType = tempObj["type"].toInt();
tempStu.nSerial = tempObj["serial"].toInt();
tempStu.freq = tempObj["freq"].toInt();
tempStu.boost = tempObj["boost"].toDouble();
tempStu.nQ = tempObj["bandWidth"].toDouble();
tempStu.gain = tempObj["gain"].toInt();
tempStu.slope = tempObj["slope"].toDouble();
m_vec_ff[i] =tempStu;
}
//FB配置读取
QJsonArray objArray_wave_filter_fb = obj_wave_filter_fb["data"].toArray();
for (int i = 0; i < objArray_wave_filter_fb.size(); i++)
{
QJsonObject tempObj = objArray_wave_filter_fb.at(i).toObject();
CONF_WAVE_FILTER_PARAM tempStu;
tempStu.nType = tempObj["type"].toInt();
tempStu.nSerial = tempObj["serial"].toInt();
tempStu.freq = tempObj["freq"].toInt();
tempStu.boost = tempObj["boost"].toDouble();
tempStu.nQ = tempObj["bandWidth"].toDouble();
tempStu.gain = tempObj["gain"].toInt();
m_vec_fb[i] = tempStu;
}
/*
//MUSIC配置读取
QJsonArray objArray_wave_filter_music = obj_wave_filter_music["data"].toArray();
for (int i = 0; i < objArray_wave_filter_music.size(); i++)
{
QJsonObject tempObj = objArray_wave_filter_music.at(i).toObject();
CONF_WAVE_FILTER_PARAM tempStu;
tempStu.nType = WAVE_MUSIC;
tempStu.nSerial = tempObj["serial"].toInt();
tempStu.freq = tempObj["freq"].toInt();
tempStu.boost = tempObj["boost"].toInt();
tempStu.nQ = tempObj["bandWidth"].toInt();
tempStu.gain = tempObj["gain"].toInt();
m_vec_music[i] = tempStu;
}
*/
return true;
}
bool Config::writeJson(QString strFile)
{
//QString strPathFile = QApplication::applicationDirPath();
//strPathFile = strPathFile + QString("/config/ANCTool/wave_filter_conf.json");
QFile file(strFile);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
qDebug() << "打开文件失败,错误信息为:" << file.errorString();
return false;
}
file.resize(0); //清空文件中的原有内容
//
QJsonDocument jsonDoc;
QJsonObject jsonConf;
QJsonObject jsonWaveFF;
QJsonObject jsonWaveFB;
QJsonArray jsonArrayWaveFF;
QJsonArray jsonArrayWaveFB;
for (int i = 0; i < ConfFilesMaxValue; i++)
{
QJsonObject jsonObj;
CONF_WAVE_FILTER_PARAM tempParam = m_vec_ff[i];
jsonObj["serial"] = tempParam.nSerial;
jsonObj["type"] = tempParam.nType;
jsonObj["freq"] = tempParam.freq;
jsonObj["boost"] = tempParam.boost;
jsonObj["bandWidth"] = tempParam.nQ;
jsonObj["gain"] = tempParam.gain;
jsonObj["slope"] = tempParam.slope;
jsonArrayWaveFF.append(jsonObj);
}
jsonWaveFF["data"] = jsonArrayWaveFF;
for (int i = 0; i < ConfFilesMaxValue; i++)
{
QJsonObject jsonObj;
CONF_WAVE_FILTER_PARAM tempParam = m_vec_fb[i];
jsonObj["serial"] = tempParam.nSerial;
jsonObj["type"] = tempParam.nType;
jsonObj["freq"] = tempParam.freq;
jsonObj["boost"] = tempParam.boost;
jsonObj["bandWidth"] = tempParam.nQ;
jsonObj["gain"] = tempParam.gain;
jsonObj["slope"] = tempParam.slope;
jsonArrayWaveFB.append(jsonObj);
}
jsonWaveFB["data"] = jsonArrayWaveFB;
/*
for(int i = 0; i < ConfFilesMaxValue; i++)
{
QJsonObject jsonObj;
CONF_WAVE_FILTER_PARAM tempParam = m_vec_music[i];
jsonObj["serial"] = tempParam.nSerial;
jsonObj["freq"] = tempParam.freq;
jsonObj["boost"] = tempParam.boost;
jsonObj["bandWidth"] = tempParam.nQ;
jsonObj["gain"] = tempParam.gain;
jsonArrayWaveMUSIC.append(jsonObj);
}
jsonWaveMUSIC["data"] = jsonArrayWaveMUSIC;
*/
jsonConf["wave_filter_ff"] = jsonWaveFF;
jsonConf["wave_filter_fb"] = jsonWaveFB;
jsonConf["freqrate"] = m_sys_freqRate;
//jsonConf["wave_filter_music"] = jsonWaveMUSIC;
jsonDoc.setObject(jsonConf);
file.write(jsonDoc.toJson());
file.close();
return true;
}
bool Config::readJson_axis()
{
QString strPathFile = QApplication::applicationDirPath();
strPathFile = strPathFile + QString("/config/ANCTool/axis_conf.json");
QFile file(strPathFile);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "打开文件失败,错误信息为:" << file.errorString();
return false;
}
QByteArray allData = file.readAll();
file.close();
QJsonParseError jsonError;
QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError));
if (jsonError.error != QJsonParseError::NoError)
{
qDebug() << "json error!" << jsonError.errorString();
return false;
}
QJsonObject root = jsonDoc.object();
QJsonObject obj_axis = root["axis"].toObject();
QJsonObject obj_fr = obj_axis["fr"].toObject();
m_sys_dB = obj_axis["sysdb"].toInt();
QJsonObject obj_phase = obj_axis["phase"].toObject();
//配置读取FR
m_fr_chart_axis.nMin_x = obj_fr["min_x"].toInt();
m_fr_chart_axis.nMax_x = obj_fr["max_x"].toInt();
m_fr_chart_axis.nMin_y = obj_fr["min_y"].toInt();
m_fr_chart_axis.nMax_y = obj_fr["max_y"].toInt();
//配置读取FR
m_phase_chart_axis.nMin_x = obj_phase["min_x"].toInt();
m_phase_chart_axis.nMax_x = obj_phase["max_x"].toInt();
m_phase_chart_axis.nMin_y = obj_phase["min_y"].toInt();
m_phase_chart_axis.nMax_y = obj_phase["max_y"].toInt();
return true;
}
bool Config::writeJson_axis()
{
QString strPathFile = QApplication::applicationDirPath();
strPathFile = strPathFile + QString("/config/ANCTool/axis_conf.json");
QFile file(strPathFile);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
qDebug() << "打开文件失败,错误信息为:" << file.errorString();
return false;
}
file.resize(0); //清空文件中的原有内容
//
QJsonDocument jsonDoc;
QJsonObject root;
QJsonObject obj_axis;
QJsonObject obj_fr;
QJsonObject obj_phase;
//获取配置数据fr
obj_fr["min_x"] = m_fr_chart_axis.nMin_x;
obj_fr["max_x"] = m_fr_chart_axis.nMax_x;
obj_fr["min_y"] = m_fr_chart_axis.nMin_y;
obj_fr["max_y"] = m_fr_chart_axis.nMax_y;
//获取配置数据fr
obj_phase["min_x"] = m_phase_chart_axis.nMin_x;
obj_phase["max_x"] = m_phase_chart_axis.nMax_x;
obj_phase["min_y"] = m_phase_chart_axis.nMin_y;
obj_phase["max_y"] = m_phase_chart_axis.nMax_y;
obj_axis["fr"] = obj_fr;
obj_axis["phase"] = obj_phase;
obj_axis["sysdb"] = m_sys_dB;
root["axis"] = obj_axis;
jsonDoc.setObject(root);
file.write(jsonDoc.toJson());
file.close();
return true;
}
void Config::set_wave_filter_conf(WAVE_FILTER_TYPE nType, const CONF_WAVE_FILTER_PARAM & stuVal)
{
m_wave_filter_modified_flag = true;
switch (nType)
{
case WAVE_FF:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_ff[i].nSerial == stuVal.nSerial)
{
m_vec_ff[i] = stuVal;
break;
}
}
break;
case WAVE_FB:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_fb[i].nSerial == stuVal.nSerial)
{
m_vec_fb[i] = stuVal;
break;
}
}
break;
case WAVE_MUSIC:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_music[i].nSerial == stuVal.nSerial)
{
m_vec_music[i] = stuVal;
break;
}
}
break;
default:
break;
}
}
CONF_WAVE_FILTER_PARAM Config::get_wave_filter_conf(WAVE_FILTER_TYPE nType, int nSerial)
{
CONF_WAVE_FILTER_PARAM tempStu;
switch (nType)
{
case WAVE_FF:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_ff[i].nSerial == nSerial)
{
tempStu = m_vec_ff[i];
break;
}
}
break;
case WAVE_FB:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_fb[i].nSerial == nSerial)
{
tempStu = m_vec_fb[i];
break;
}
}
break;
case WAVE_MUSIC:
for (int i = 0; i < ConfFilesMaxValue; ++i)
{
if (m_vec_music[i].nSerial == nSerial)
{
tempStu = m_vec_music[i];
break;
}
}
break;
default:
break;
}
return tempStu;
}
| [
"[email protected]"
] | |
d37a6d284a436a28b74d3535e26ca49c9866e003 | 9cca17134874c14f3d6924a9d1831ed21ba9de1b | /Pendulum.hpp | fbd5a206643226142f79f3daa5085adc1a02d750 | [
"MIT"
] | permissive | clockworkengineer/Pendulum | 0cb1c04012c1a0500b48e2da441239695bd361ba | 2f54102012b664b299c36a46917e030a536be7ea | refs/heads/master | 2021-01-19T19:12:16.950946 | 2020-08-15T16:42:33 | 2020-08-15T16:42:33 | 88,406,099 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 373 | hpp | #ifndef PENDULUM_HPP
#define PENDULUM_HPP
// =========
// NAMESPACE
// =========
namespace Pendulum {
//
// .eml file extention
//
constexpr char const *kEMLFileExt{".eml"};
//
// Main processing functionality (archive e-mail).
//
void archiveEmail(int argc, char** argv);
}
#endif /* PENDULUM_HPP */
| [
"[email protected]"
] | |
357b7568ee72669f4c0e4cebedbbaf495f73dbb0 | 0310c7b65492405afea20c57a7787fb1854289ad | /PictureCreater/PictureCreater/BMPPic.h | bce702e753312c7c092094af09ab868151065acb | [] | no_license | nie11kun/c-plus-plus-test | d1f099a98d497b54049f436e092e9ac461df6d49 | a6056de82dea0274b0f82731fb1f403dea6c3dd4 | refs/heads/master | 2021-06-17T22:08:28.368538 | 2021-01-06T03:20:45 | 2021-01-06T03:20:45 | 132,863,604 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 258 | h | #pragma once
#include<stdio.h>
class BMPPic
{
public:
BMPPic();
~BMPPic();
bool generateBmp(char* pData, int width, int height, char * filename);
void readBmp(FILE* filename);
void bmpWidthHeight(FILE* fpbmp, int &width, int &height);
};
| [
"[email protected]"
] | |
78558a9f8f78fb026df91819083b2fb53ac7519b | b2b9e4d616a6d1909f845e15b6eaa878faa9605a | /Genemardon/20150920北京网络赛/1007.cpp | 2d864c52d403ca98595e8d058d3ee548783e3cca | [] | no_license | JinbaoWeb/ACM | db2a852816d2f4e395086b2b7f2fdebbb4b56837 | 021b0c8d9c96c1bc6e10374ea98d0706d7b509e1 | refs/heads/master | 2021-01-18T22:32:50.894840 | 2016-06-14T07:07:51 | 2016-06-14T07:07:51 | 55,882,694 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,850 | cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
using namespace std;
struct node
{
stack<int>box[8];
int qid;
long long nid;
node () {}
node (int qid, long long nid) : qid(qid), nid(nid) {}
};
int ans[8][2000000];
long long base[100];
void init()
{
base[0] = 1;
base[1] = 1;
for (int i = 2; i <= 50; i++) base[i] = base[i - 1] * 2;
}
int fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
int cantor(int s[], int x)
{
int i, j, temp, num;
num = 0;
for (i = 1; i < x; i++)
{
temp = 0;
for (int j = i + 1; j <= x; j++)
{
if (s[j] < s[i]) temp++;
}
num += fac[x - i] * temp;
}
return (num + 1);
}
void bfs(int x)
{
queue<node>q;
map<long long, int>M;
M.clear();
printf("%d\n", M[10] );
int cnt = 0;
int head = 0;
for (int i = 1; i <= x; i++)
head = head + base[(i - 1) * x + i];
node nn = node(cnt, head);
for (int i = 1; i <= x; i++) nn.box[i].push(i);
q.push(nn);
M[head] = 1;
while (!q.empty())
{
node tmp = q.front();
//printf("%d %lld\n",tmp.qid,tmp.nid );
int flag = 1;
int list[10];
for (int i = 1; i <= x; i++)
{
if (!tmp.box[i].empty()) list[i] = tmp.box[i].top();
if (tmp.box[i].size() != 1)
{
flag = 0;
break;
}
}
if (flag) ans[x][cantor(list, x)] = tmp.qid;
q.pop();
//printf("111\n");
for (int i = 1; i <= x; i++)
if (!(tmp.box[i].empty()))
{
//printf("222\n");
if (i > 1)
{
//printf("333\n");
if (tmp.box[i - 1].empty() || tmp.box[i - 1].top() > tmp.box[i].top())
{
long long id = tmp.nid - base[(i - 1) * x + tmp.box[i].top()] + base[(i - 2) * x + tmp.box[i].top()];
if (M[id] == 0)
{
stack<int>save[8];
M[id] = tmp.qid + 1;
node nnn = node(tmp.qid + 1, id);
for (int j = 1; j <= x; j++)
{
while (!tmp.box[j].empty())
{
save[j].push(tmp.box[j].top());
tmp.box[j].pop();
}
while (!save[j].empty())
{
tmp.box[j].push(save[j].top());
nnn.box[j].push(save[j].top());
save[j].pop();
}
}
nnn.box[i - 1].push(nnn.box[i].top());
nnn.box[i].pop();
q.push(nnn);
}
}
}
if (i < x)
{
//printf("444\n");
if (tmp.box[i + 1].empty() || tmp.box[i + 1].top() > tmp.box[i].top())
{
long long id = tmp.nid - base[(i - 1) * x + tmp.box[i].top()] + base[(i) * x + tmp.box[i].top()];
if (M[id] == 0)
{
stack<int>save[8];
M[id] = tmp.qid + 1;
node nnn = node(tmp.qid + 1, id);
for (int j = 1; j <= x; j++)
{
while (!tmp.box[j].empty())
{
save[j].push(tmp.box[j].top());
tmp.box[j].pop();
}
while (!save[j].empty())
{
tmp.box[j].push(save[j].top());
nnn.box[j].push(save[j].top());
save[j].pop();
}
}
nnn.box[i + 1].push(nnn.box[i].top());
nnn.box[i].pop();
q.push(nnn);
}
}
}
}
}
}
int main(int argc, char const *argv[])
{
init();
memset(ans,-1,sizeof(ans));
for (int i=1;i<=7;i++) bfs(i);
printf("1111\n");
int list[10]={0,3,2,1};
printf("%d\n",ans[3][cantor(list,3)] );
return 0;
} | [
"[email protected]"
] | |
842024825ac8044e6b813f934b81c43a8a5891d2 | 40c884145f53abed8e845766a2ad1e2e232c2e4c | /ExRootAnalysis/tmp/modules/ModulesDict.cc | 9bd295c924fd9b92efd8a56a1648f1b1a12ae045 | [] | no_license | BradSchoenrock/MadGraph | ac3b0f461cbbb8ae41bb276fe4edb713a7ad2ab4 | 59b40c977dbab60ec7d21ef42d28955434d808a9 | refs/heads/master | 2020-03-23T11:42:34.982767 | 2018-07-19T04:29:27 | 2018-07-19T04:29:27 | 141,517,331 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 103,651 | cc | #define private public
#define protected public
#include "modules/MadGraphClassFilter.h"
#include "modules/MadGraphAnalysis.h"
#include "modules/MadGraphKtJetFinder.h"
#include "modules/MadGraphConeJetFinder.h"
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class MadGraphClassFilter+;
#pragma link C++ class MadGraphAnalysis+;
#pragma link C++ class MadGraphKtJetFinder+;
#pragma link C++ class MadGraphConeJetFinder+;
#endif
//
// File generated by rootcint at Tue Apr 2 11:04:25 2013
// Do NOT change. Changes will be lost next time file is generated
//
#define R__DICTIONARY_FILENAME tmpdImodulesdIModulesDict
#include "RConfig.h" //rootcint 4834
#if !defined(R__ACCESS_IN_SYMBOL)
//Break the privacy of classes -- Disabled for the moment
#define private public
#define protected public
#endif
// Since CINT ignores the std namespace, we need to do so in this file.
namespace std {} using namespace std;
#include "ModulesDict.h"
#include "TCollectionProxyInfo.h"
#include "TClass.h"
#include "TBuffer.h"
#include "TMemberInspector.h"
#include "TError.h"
#ifndef G__ROOT
#define G__ROOT
#endif
#include "RtypesImp.h"
#include "TIsAProxy.h"
#include "TFileMergeInfo.h"
// START OF SHADOWS
namespace ROOT {
namespace Shadow {
} // of namespace Shadow
} // of namespace ROOT
// END OF SHADOWS
namespace ROOT {
void MadGraphClassFilter_ShowMembers(void *obj, TMemberInspector &R__insp);
static void *new_MadGraphClassFilter(void *p = 0);
static void *newArray_MadGraphClassFilter(Long_t size, void *p);
static void delete_MadGraphClassFilter(void *p);
static void deleteArray_MadGraphClassFilter(void *p);
static void destruct_MadGraphClassFilter(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphClassFilter*)
{
::MadGraphClassFilter *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphClassFilter >(0);
static ::ROOT::TGenericClassInfo
instance("MadGraphClassFilter", ::MadGraphClassFilter::Class_Version(), "./modules/MadGraphClassFilter.h", 14,
typeid(::MadGraphClassFilter), DefineBehavior(ptr, ptr),
&::MadGraphClassFilter::Dictionary, isa_proxy, 4,
sizeof(::MadGraphClassFilter) );
instance.SetNew(&new_MadGraphClassFilter);
instance.SetNewArray(&newArray_MadGraphClassFilter);
instance.SetDelete(&delete_MadGraphClassFilter);
instance.SetDeleteArray(&deleteArray_MadGraphClassFilter);
instance.SetDestructor(&destruct_MadGraphClassFilter);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MadGraphClassFilter*)
{
return GenerateInitInstanceLocal((::MadGraphClassFilter*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0); R__UseDummy(_R__UNIQUE_(Init));
} // end of namespace ROOT
namespace ROOT {
void MadGraphAnalysis_ShowMembers(void *obj, TMemberInspector &R__insp);
static void *new_MadGraphAnalysis(void *p = 0);
static void *newArray_MadGraphAnalysis(Long_t size, void *p);
static void delete_MadGraphAnalysis(void *p);
static void deleteArray_MadGraphAnalysis(void *p);
static void destruct_MadGraphAnalysis(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphAnalysis*)
{
::MadGraphAnalysis *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphAnalysis >(0);
static ::ROOT::TGenericClassInfo
instance("MadGraphAnalysis", ::MadGraphAnalysis::Class_Version(), "./modules/MadGraphAnalysis.h", 15,
typeid(::MadGraphAnalysis), DefineBehavior(ptr, ptr),
&::MadGraphAnalysis::Dictionary, isa_proxy, 4,
sizeof(::MadGraphAnalysis) );
instance.SetNew(&new_MadGraphAnalysis);
instance.SetNewArray(&newArray_MadGraphAnalysis);
instance.SetDelete(&delete_MadGraphAnalysis);
instance.SetDeleteArray(&deleteArray_MadGraphAnalysis);
instance.SetDestructor(&destruct_MadGraphAnalysis);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MadGraphAnalysis*)
{
return GenerateInitInstanceLocal((::MadGraphAnalysis*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0); R__UseDummy(_R__UNIQUE_(Init));
} // end of namespace ROOT
namespace ROOT {
void MadGraphKtJetFinder_ShowMembers(void *obj, TMemberInspector &R__insp);
static void *new_MadGraphKtJetFinder(void *p = 0);
static void *newArray_MadGraphKtJetFinder(Long_t size, void *p);
static void delete_MadGraphKtJetFinder(void *p);
static void deleteArray_MadGraphKtJetFinder(void *p);
static void destruct_MadGraphKtJetFinder(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphKtJetFinder*)
{
::MadGraphKtJetFinder *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphKtJetFinder >(0);
static ::ROOT::TGenericClassInfo
instance("MadGraphKtJetFinder", ::MadGraphKtJetFinder::Class_Version(), "./modules/MadGraphKtJetFinder.h", 15,
typeid(::MadGraphKtJetFinder), DefineBehavior(ptr, ptr),
&::MadGraphKtJetFinder::Dictionary, isa_proxy, 4,
sizeof(::MadGraphKtJetFinder) );
instance.SetNew(&new_MadGraphKtJetFinder);
instance.SetNewArray(&newArray_MadGraphKtJetFinder);
instance.SetDelete(&delete_MadGraphKtJetFinder);
instance.SetDeleteArray(&deleteArray_MadGraphKtJetFinder);
instance.SetDestructor(&destruct_MadGraphKtJetFinder);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MadGraphKtJetFinder*)
{
return GenerateInitInstanceLocal((::MadGraphKtJetFinder*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0); R__UseDummy(_R__UNIQUE_(Init));
} // end of namespace ROOT
namespace ROOT {
void MadGraphConeJetFinder_ShowMembers(void *obj, TMemberInspector &R__insp);
static void *new_MadGraphConeJetFinder(void *p = 0);
static void *newArray_MadGraphConeJetFinder(Long_t size, void *p);
static void delete_MadGraphConeJetFinder(void *p);
static void deleteArray_MadGraphConeJetFinder(void *p);
static void destruct_MadGraphConeJetFinder(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphConeJetFinder*)
{
::MadGraphConeJetFinder *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphConeJetFinder >(0);
static ::ROOT::TGenericClassInfo
instance("MadGraphConeJetFinder", ::MadGraphConeJetFinder::Class_Version(), "./modules/MadGraphConeJetFinder.h", 18,
typeid(::MadGraphConeJetFinder), DefineBehavior(ptr, ptr),
&::MadGraphConeJetFinder::Dictionary, isa_proxy, 4,
sizeof(::MadGraphConeJetFinder) );
instance.SetNew(&new_MadGraphConeJetFinder);
instance.SetNewArray(&newArray_MadGraphConeJetFinder);
instance.SetDelete(&delete_MadGraphConeJetFinder);
instance.SetDeleteArray(&deleteArray_MadGraphConeJetFinder);
instance.SetDestructor(&destruct_MadGraphConeJetFinder);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MadGraphConeJetFinder*)
{
return GenerateInitInstanceLocal((::MadGraphConeJetFinder*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0); R__UseDummy(_R__UNIQUE_(Init));
} // end of namespace ROOT
//______________________________________________________________________________
TClass *MadGraphClassFilter::fgIsA = 0; // static to hold class pointer
//______________________________________________________________________________
const char *MadGraphClassFilter::Class_Name()
{
return "MadGraphClassFilter";
}
//______________________________________________________________________________
const char *MadGraphClassFilter::ImplFileName()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetImplFileName();
}
//______________________________________________________________________________
int MadGraphClassFilter::ImplFileLine()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetImplFileLine();
}
//______________________________________________________________________________
void MadGraphClassFilter::Dictionary()
{
fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetClass();
}
//______________________________________________________________________________
TClass *MadGraphClassFilter::Class()
{
if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetClass();
return fgIsA;
}
//______________________________________________________________________________
TClass *MadGraphAnalysis::fgIsA = 0; // static to hold class pointer
//______________________________________________________________________________
const char *MadGraphAnalysis::Class_Name()
{
return "MadGraphAnalysis";
}
//______________________________________________________________________________
const char *MadGraphAnalysis::ImplFileName()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetImplFileName();
}
//______________________________________________________________________________
int MadGraphAnalysis::ImplFileLine()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetImplFileLine();
}
//______________________________________________________________________________
void MadGraphAnalysis::Dictionary()
{
fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetClass();
}
//______________________________________________________________________________
TClass *MadGraphAnalysis::Class()
{
if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetClass();
return fgIsA;
}
//______________________________________________________________________________
TClass *MadGraphKtJetFinder::fgIsA = 0; // static to hold class pointer
//______________________________________________________________________________
const char *MadGraphKtJetFinder::Class_Name()
{
return "MadGraphKtJetFinder";
}
//______________________________________________________________________________
const char *MadGraphKtJetFinder::ImplFileName()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetImplFileName();
}
//______________________________________________________________________________
int MadGraphKtJetFinder::ImplFileLine()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetImplFileLine();
}
//______________________________________________________________________________
void MadGraphKtJetFinder::Dictionary()
{
fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetClass();
}
//______________________________________________________________________________
TClass *MadGraphKtJetFinder::Class()
{
if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetClass();
return fgIsA;
}
//______________________________________________________________________________
TClass *MadGraphConeJetFinder::fgIsA = 0; // static to hold class pointer
//______________________________________________________________________________
const char *MadGraphConeJetFinder::Class_Name()
{
return "MadGraphConeJetFinder";
}
//______________________________________________________________________________
const char *MadGraphConeJetFinder::ImplFileName()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetImplFileName();
}
//______________________________________________________________________________
int MadGraphConeJetFinder::ImplFileLine()
{
return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetImplFileLine();
}
//______________________________________________________________________________
void MadGraphConeJetFinder::Dictionary()
{
fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetClass();
}
//______________________________________________________________________________
TClass *MadGraphConeJetFinder::Class()
{
if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetClass();
return fgIsA;
}
//______________________________________________________________________________
void MadGraphClassFilter::Streamer(TBuffer &R__b)
{
// Stream an object of class MadGraphClassFilter.
if (R__b.IsReading()) {
R__b.ReadClassBuffer(MadGraphClassFilter::Class(),this);
} else {
R__b.WriteClassBuffer(MadGraphClassFilter::Class(),this);
}
}
//______________________________________________________________________________
void MadGraphClassFilter::ShowMembers(TMemberInspector &R__insp)
{
// Inspect the data members of an object of class MadGraphClassFilter.
TClass *R__cl = ::MadGraphClassFilter::IsA();
if (R__cl || R__insp.IsA()) { }
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fFilter", &fFilter);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fClassifier", &fClassifier);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray);
ExRootModule::ShowMembers(R__insp);
}
namespace ROOT {
// Wrappers around operator new
static void *new_MadGraphClassFilter(void *p) {
return p ? new(p) ::MadGraphClassFilter : new ::MadGraphClassFilter;
}
static void *newArray_MadGraphClassFilter(Long_t nElements, void *p) {
return p ? new(p) ::MadGraphClassFilter[nElements] : new ::MadGraphClassFilter[nElements];
}
// Wrapper around operator delete
static void delete_MadGraphClassFilter(void *p) {
delete ((::MadGraphClassFilter*)p);
}
static void deleteArray_MadGraphClassFilter(void *p) {
delete [] ((::MadGraphClassFilter*)p);
}
static void destruct_MadGraphClassFilter(void *p) {
typedef ::MadGraphClassFilter current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class ::MadGraphClassFilter
//______________________________________________________________________________
void MadGraphAnalysis::Streamer(TBuffer &R__b)
{
// Stream an object of class MadGraphAnalysis.
if (R__b.IsReading()) {
R__b.ReadClassBuffer(MadGraphAnalysis::Class(),this);
} else {
R__b.WriteClassBuffer(MadGraphAnalysis::Class(),this);
}
}
//______________________________________________________________________________
void MadGraphAnalysis::ShowMembers(TMemberInspector &R__insp)
{
// Inspect the data members of an object of class MadGraphAnalysis.
TClass *R__cl = ::MadGraphAnalysis::IsA();
if (R__cl || R__insp.IsA()) { }
R__insp.Inspect(R__cl, R__insp.GetParent(), "fOutputFileName", &fOutputFileName);
R__insp.InspectMember(fOutputFileName, "fOutputFileName.");
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fInputArray", &fInputArray);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchEvent", &fBranchEvent);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fParticleHistogramsMap", (void*)&fParticleHistogramsMap);
R__insp.InspectMember("map<TString,ParticleHistograms*>", (void*)&fParticleHistogramsMap, "fParticleHistogramsMap.", true);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fPairHistogramsMap", (void*)&fPairHistogramsMap);
R__insp.InspectMember("map<TString,PairHistograms*>", (void*)&fPairHistogramsMap, "fPairHistogramsMap.", true);
ExRootModule::ShowMembers(R__insp);
}
namespace ROOT {
// Wrappers around operator new
static void *new_MadGraphAnalysis(void *p) {
return p ? new(p) ::MadGraphAnalysis : new ::MadGraphAnalysis;
}
static void *newArray_MadGraphAnalysis(Long_t nElements, void *p) {
return p ? new(p) ::MadGraphAnalysis[nElements] : new ::MadGraphAnalysis[nElements];
}
// Wrapper around operator delete
static void delete_MadGraphAnalysis(void *p) {
delete ((::MadGraphAnalysis*)p);
}
static void deleteArray_MadGraphAnalysis(void *p) {
delete [] ((::MadGraphAnalysis*)p);
}
static void destruct_MadGraphAnalysis(void *p) {
typedef ::MadGraphAnalysis current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class ::MadGraphAnalysis
//______________________________________________________________________________
void MadGraphKtJetFinder::Streamer(TBuffer &R__b)
{
// Stream an object of class MadGraphKtJetFinder.
if (R__b.IsReading()) {
R__b.ReadClassBuffer(MadGraphKtJetFinder::Class(),this);
} else {
R__b.WriteClassBuffer(MadGraphKtJetFinder::Class(),this);
}
}
//______________________________________________________________________________
void MadGraphKtJetFinder::ShowMembers(TMemberInspector &R__insp)
{
// Inspect the data members of an object of class MadGraphKtJetFinder.
TClass *R__cl = ::MadGraphKtJetFinder::IsA();
if (R__cl || R__insp.IsA()) { }
R__insp.Inspect(R__cl, R__insp.GetParent(), "fMaxParticleEta", &fMaxParticleEta);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinParticlePT", &fMinParticlePT);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinJetPT", &fMinJetPT);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fParameterR", &fParameterR);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fCollisionType", &fCollisionType);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fDistanceScheme", &fDistanceScheme);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fRecombinationScheme", &fRecombinationScheme);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fTowersList", (void*)&fTowersList);
R__insp.InspectMember("vector<KtJet::KtLorentzVector>", (void*)&fTowersList, "fTowersList.", true);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fJetsList", (void*)&fJetsList);
R__insp.InspectMember("vector<KtJet::KtLorentzVector>", (void*)&fJetsList, "fJetsList.", true);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray);
ExRootModule::ShowMembers(R__insp);
}
namespace ROOT {
// Wrappers around operator new
static void *new_MadGraphKtJetFinder(void *p) {
return p ? new(p) ::MadGraphKtJetFinder : new ::MadGraphKtJetFinder;
}
static void *newArray_MadGraphKtJetFinder(Long_t nElements, void *p) {
return p ? new(p) ::MadGraphKtJetFinder[nElements] : new ::MadGraphKtJetFinder[nElements];
}
// Wrapper around operator delete
static void delete_MadGraphKtJetFinder(void *p) {
delete ((::MadGraphKtJetFinder*)p);
}
static void deleteArray_MadGraphKtJetFinder(void *p) {
delete [] ((::MadGraphKtJetFinder*)p);
}
static void destruct_MadGraphKtJetFinder(void *p) {
typedef ::MadGraphKtJetFinder current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class ::MadGraphKtJetFinder
//______________________________________________________________________________
void MadGraphConeJetFinder::Streamer(TBuffer &R__b)
{
// Stream an object of class MadGraphConeJetFinder.
if (R__b.IsReading()) {
R__b.ReadClassBuffer(MadGraphConeJetFinder::Class(),this);
} else {
R__b.WriteClassBuffer(MadGraphConeJetFinder::Class(),this);
}
}
//______________________________________________________________________________
void MadGraphConeJetFinder::ShowMembers(TMemberInspector &R__insp)
{
// Inspect the data members of an object of class MadGraphConeJetFinder.
TClass *R__cl = ::MadGraphConeJetFinder::IsA();
if (R__cl || R__insp.IsA()) { }
R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinParticlePT", &fMinParticlePT);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinJetPT", &fMinJetPT);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fTowersList", (void*)&fTowersList);
R__insp.InspectMember("vector<PhysicsTower>", (void*)&fTowersList, "fTowersList.", false);
R__insp.Inspect(R__cl, R__insp.GetParent(), "fJetsList", (void*)&fJetsList);
R__insp.InspectMember("vector<Cluster>", (void*)&fJetsList, "fJetsList.", false);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fJetAlgo", &fJetAlgo);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle);
R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray);
ExRootModule::ShowMembers(R__insp);
}
namespace ROOT {
// Wrappers around operator new
static void *new_MadGraphConeJetFinder(void *p) {
return p ? new(p) ::MadGraphConeJetFinder : new ::MadGraphConeJetFinder;
}
static void *newArray_MadGraphConeJetFinder(Long_t nElements, void *p) {
return p ? new(p) ::MadGraphConeJetFinder[nElements] : new ::MadGraphConeJetFinder[nElements];
}
// Wrapper around operator delete
static void delete_MadGraphConeJetFinder(void *p) {
delete ((::MadGraphConeJetFinder*)p);
}
static void deleteArray_MadGraphConeJetFinder(void *p) {
delete [] ((::MadGraphConeJetFinder*)p);
}
static void destruct_MadGraphConeJetFinder(void *p) {
typedef ::MadGraphConeJetFinder current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class ::MadGraphConeJetFinder
namespace ROOT {
void vectorlEClustergR_ShowMembers(void *obj, TMemberInspector &R__insp);
static void vectorlEClustergR_Dictionary();
static void *new_vectorlEClustergR(void *p = 0);
static void *newArray_vectorlEClustergR(Long_t size, void *p);
static void delete_vectorlEClustergR(void *p);
static void deleteArray_vectorlEClustergR(void *p);
static void destruct_vectorlEClustergR(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const vector<Cluster>*)
{
vector<Cluster> *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<Cluster>),0);
static ::ROOT::TGenericClassInfo
instance("vector<Cluster>", -2, "prec_stl/vector", 49,
typeid(vector<Cluster>), DefineBehavior(ptr, ptr),
0, &vectorlEClustergR_Dictionary, isa_proxy, 0,
sizeof(vector<Cluster>) );
instance.SetNew(&new_vectorlEClustergR);
instance.SetNewArray(&newArray_vectorlEClustergR);
instance.SetDelete(&delete_vectorlEClustergR);
instance.SetDeleteArray(&deleteArray_vectorlEClustergR);
instance.SetDestructor(&destruct_vectorlEClustergR);
instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<Cluster> >()));
return &instance;
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const vector<Cluster>*)0x0); R__UseDummy(_R__UNIQUE_(Init));
// Dictionary for non-ClassDef classes
static void vectorlEClustergR_Dictionary() {
::ROOT::GenerateInitInstanceLocal((const vector<Cluster>*)0x0)->GetClass();
}
} // end of namespace ROOT
namespace ROOT {
// Wrappers around operator new
static void *new_vectorlEClustergR(void *p) {
return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<Cluster> : new vector<Cluster>;
}
static void *newArray_vectorlEClustergR(Long_t nElements, void *p) {
return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<Cluster>[nElements] : new vector<Cluster>[nElements];
}
// Wrapper around operator delete
static void delete_vectorlEClustergR(void *p) {
delete ((vector<Cluster>*)p);
}
static void deleteArray_vectorlEClustergR(void *p) {
delete [] ((vector<Cluster>*)p);
}
static void destruct_vectorlEClustergR(void *p) {
typedef vector<Cluster> current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class vector<Cluster>
namespace ROOT {
void vectorlEPhysicsTowergR_ShowMembers(void *obj, TMemberInspector &R__insp);
static void vectorlEPhysicsTowergR_Dictionary();
static void *new_vectorlEPhysicsTowergR(void *p = 0);
static void *newArray_vectorlEPhysicsTowergR(Long_t size, void *p);
static void delete_vectorlEPhysicsTowergR(void *p);
static void deleteArray_vectorlEPhysicsTowergR(void *p);
static void destruct_vectorlEPhysicsTowergR(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const vector<PhysicsTower>*)
{
vector<PhysicsTower> *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<PhysicsTower>),0);
static ::ROOT::TGenericClassInfo
instance("vector<PhysicsTower>", -2, "prec_stl/vector", 49,
typeid(vector<PhysicsTower>), DefineBehavior(ptr, ptr),
0, &vectorlEPhysicsTowergR_Dictionary, isa_proxy, 0,
sizeof(vector<PhysicsTower>) );
instance.SetNew(&new_vectorlEPhysicsTowergR);
instance.SetNewArray(&newArray_vectorlEPhysicsTowergR);
instance.SetDelete(&delete_vectorlEPhysicsTowergR);
instance.SetDeleteArray(&deleteArray_vectorlEPhysicsTowergR);
instance.SetDestructor(&destruct_vectorlEPhysicsTowergR);
instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<PhysicsTower> >()));
return &instance;
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const vector<PhysicsTower>*)0x0); R__UseDummy(_R__UNIQUE_(Init));
// Dictionary for non-ClassDef classes
static void vectorlEPhysicsTowergR_Dictionary() {
::ROOT::GenerateInitInstanceLocal((const vector<PhysicsTower>*)0x0)->GetClass();
}
} // end of namespace ROOT
namespace ROOT {
// Wrappers around operator new
static void *new_vectorlEPhysicsTowergR(void *p) {
return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<PhysicsTower> : new vector<PhysicsTower>;
}
static void *newArray_vectorlEPhysicsTowergR(Long_t nElements, void *p) {
return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<PhysicsTower>[nElements] : new vector<PhysicsTower>[nElements];
}
// Wrapper around operator delete
static void delete_vectorlEPhysicsTowergR(void *p) {
delete ((vector<PhysicsTower>*)p);
}
static void deleteArray_vectorlEPhysicsTowergR(void *p) {
delete [] ((vector<PhysicsTower>*)p);
}
static void destruct_vectorlEPhysicsTowergR(void *p) {
typedef vector<PhysicsTower> current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class vector<PhysicsTower>
/********************************************************
* tmp/modules/ModulesDict.cc
* CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED
* FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX().
* CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE.
********************************************************/
#ifdef G__MEMTEST
#undef malloc
#undef free
#endif
#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3))
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
extern "C" void G__cpp_reset_tagtableModulesDict();
extern "C" void G__set_cpp_environmentModulesDict() {
G__add_compiledheader("TObject.h");
G__add_compiledheader("TMemberInspector.h");
G__cpp_reset_tagtableModulesDict();
}
#include <new>
extern "C" int G__cpp_dllrevModulesDict() { return(30051515); }
/*********************************************************
* Member function Interface Method
*********************************************************/
/* MadGraphClassFilter */
static int G__ModulesDict_451_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphClassFilter* p = NULL;
char* gvp = (char*) G__getgvp();
int n = G__getaryconstruct();
if (n) {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphClassFilter[n];
} else {
p = new((void*) gvp) MadGraphClassFilter[n];
}
} else {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphClassFilter;
} else {
p = new((void*) gvp) MadGraphClassFilter;
}
}
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter));
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 85, (long) MadGraphClassFilter::Class());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphClassFilter::Class_Name());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 115, (long) MadGraphClassFilter::Class_Version());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphClassFilter::Dictionary();
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
((MadGraphClassFilter*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref);
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphClassFilter::DeclFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphClassFilter::ImplFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphClassFilter::ImplFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_451_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphClassFilter::DeclFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
// automatic copy constructor
static int G__ModulesDict_451_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphClassFilter* p;
void* tmp = (void*) G__int(libp->para[0]);
p = new MadGraphClassFilter(*(MadGraphClassFilter*) tmp);
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter));
return(1 || funcname || hash || result7 || libp) ;
}
// automatic destructor
typedef MadGraphClassFilter G__TMadGraphClassFilter;
static int G__ModulesDict_451_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
char* gvp = (char*) G__getgvp();
long soff = G__getstructoffset();
int n = G__getaryconstruct();
//
//has_a_delete: 1
//has_own_delete1arg: 0
//has_own_delete2arg: 0
//
if (!soff) {
return(1);
}
if (n) {
if (gvp == (char*)G__PVOID) {
delete[] (MadGraphClassFilter*) soff;
} else {
G__setgvp((long) G__PVOID);
for (int i = n - 1; i >= 0; --i) {
((MadGraphClassFilter*) (soff+(sizeof(MadGraphClassFilter)*i)))->~G__TMadGraphClassFilter();
}
G__setgvp((long)gvp);
}
} else {
if (gvp == (char*)G__PVOID) {
delete (MadGraphClassFilter*) soff;
} else {
G__setgvp((long) G__PVOID);
((MadGraphClassFilter*) (soff))->~G__TMadGraphClassFilter();
G__setgvp((long)gvp);
}
}
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
// automatic assignment operator
static int G__ModulesDict_451_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphClassFilter* dest = (MadGraphClassFilter*) G__getstructoffset();
*dest = *(MadGraphClassFilter*) libp->para[0].ref;
const MadGraphClassFilter& obj = *dest;
result7->ref = (long) (&obj);
result7->obj.i = (long) (&obj);
return(1 || funcname || hash || result7 || libp) ;
}
/* MadGraphAnalysis */
static int G__ModulesDict_453_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphAnalysis* p = NULL;
char* gvp = (char*) G__getgvp();
int n = G__getaryconstruct();
if (n) {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphAnalysis[n];
} else {
p = new((void*) gvp) MadGraphAnalysis[n];
}
} else {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphAnalysis;
} else {
p = new((void*) gvp) MadGraphAnalysis;
}
}
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis));
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_9(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 85, (long) MadGraphAnalysis::Class());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_10(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphAnalysis::Class_Name());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_11(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 115, (long) MadGraphAnalysis::Class_Version());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphAnalysis::Dictionary();
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
((MadGraphAnalysis*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref);
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphAnalysis::DeclFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphAnalysis::ImplFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphAnalysis::ImplFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_453_0_20(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphAnalysis::DeclFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
// automatic copy constructor
static int G__ModulesDict_453_0_21(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphAnalysis* p;
void* tmp = (void*) G__int(libp->para[0]);
p = new MadGraphAnalysis(*(MadGraphAnalysis*) tmp);
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis));
return(1 || funcname || hash || result7 || libp) ;
}
// automatic destructor
typedef MadGraphAnalysis G__TMadGraphAnalysis;
static int G__ModulesDict_453_0_22(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
char* gvp = (char*) G__getgvp();
long soff = G__getstructoffset();
int n = G__getaryconstruct();
//
//has_a_delete: 1
//has_own_delete1arg: 0
//has_own_delete2arg: 0
//
if (!soff) {
return(1);
}
if (n) {
if (gvp == (char*)G__PVOID) {
delete[] (MadGraphAnalysis*) soff;
} else {
G__setgvp((long) G__PVOID);
for (int i = n - 1; i >= 0; --i) {
((MadGraphAnalysis*) (soff+(sizeof(MadGraphAnalysis)*i)))->~G__TMadGraphAnalysis();
}
G__setgvp((long)gvp);
}
} else {
if (gvp == (char*)G__PVOID) {
delete (MadGraphAnalysis*) soff;
} else {
G__setgvp((long) G__PVOID);
((MadGraphAnalysis*) (soff))->~G__TMadGraphAnalysis();
G__setgvp((long)gvp);
}
}
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
/* MadGraphKtJetFinder */
static int G__ModulesDict_517_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphKtJetFinder* p = NULL;
char* gvp = (char*) G__getgvp();
int n = G__getaryconstruct();
if (n) {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphKtJetFinder[n];
} else {
p = new((void*) gvp) MadGraphKtJetFinder[n];
}
} else {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphKtJetFinder;
} else {
p = new((void*) gvp) MadGraphKtJetFinder;
}
}
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder));
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 85, (long) MadGraphKtJetFinder::Class());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphKtJetFinder::Class_Name());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 115, (long) MadGraphKtJetFinder::Class_Version());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphKtJetFinder::Dictionary();
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
((MadGraphKtJetFinder*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref);
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphKtJetFinder::DeclFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphKtJetFinder::ImplFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphKtJetFinder::ImplFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_517_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphKtJetFinder::DeclFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
// automatic copy constructor
static int G__ModulesDict_517_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphKtJetFinder* p;
void* tmp = (void*) G__int(libp->para[0]);
p = new MadGraphKtJetFinder(*(MadGraphKtJetFinder*) tmp);
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder));
return(1 || funcname || hash || result7 || libp) ;
}
// automatic destructor
typedef MadGraphKtJetFinder G__TMadGraphKtJetFinder;
static int G__ModulesDict_517_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
char* gvp = (char*) G__getgvp();
long soff = G__getstructoffset();
int n = G__getaryconstruct();
//
//has_a_delete: 1
//has_own_delete1arg: 0
//has_own_delete2arg: 0
//
if (!soff) {
return(1);
}
if (n) {
if (gvp == (char*)G__PVOID) {
delete[] (MadGraphKtJetFinder*) soff;
} else {
G__setgvp((long) G__PVOID);
for (int i = n - 1; i >= 0; --i) {
((MadGraphKtJetFinder*) (soff+(sizeof(MadGraphKtJetFinder)*i)))->~G__TMadGraphKtJetFinder();
}
G__setgvp((long)gvp);
}
} else {
if (gvp == (char*)G__PVOID) {
delete (MadGraphKtJetFinder*) soff;
} else {
G__setgvp((long) G__PVOID);
((MadGraphKtJetFinder*) (soff))->~G__TMadGraphKtJetFinder();
G__setgvp((long)gvp);
}
}
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
// automatic assignment operator
static int G__ModulesDict_517_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphKtJetFinder* dest = (MadGraphKtJetFinder*) G__getstructoffset();
*dest = *(MadGraphKtJetFinder*) libp->para[0].ref;
const MadGraphKtJetFinder& obj = *dest;
result7->ref = (long) (&obj);
result7->obj.i = (long) (&obj);
return(1 || funcname || hash || result7 || libp) ;
}
/* MadGraphConeJetFinder */
static int G__ModulesDict_528_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphConeJetFinder* p = NULL;
char* gvp = (char*) G__getgvp();
int n = G__getaryconstruct();
if (n) {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphConeJetFinder[n];
} else {
p = new((void*) gvp) MadGraphConeJetFinder[n];
}
} else {
if ((gvp == (char*)G__PVOID) || (gvp == 0)) {
p = new MadGraphConeJetFinder;
} else {
p = new((void*) gvp) MadGraphConeJetFinder;
}
}
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder));
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 85, (long) MadGraphConeJetFinder::Class());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphConeJetFinder::Class_Name());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 115, (long) MadGraphConeJetFinder::Class_Version());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphConeJetFinder::Dictionary();
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
((MadGraphConeJetFinder*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref);
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphConeJetFinder::DeclFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphConeJetFinder::ImplFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 67, (long) MadGraphConeJetFinder::ImplFileName());
return(1 || funcname || hash || result7 || libp) ;
}
static int G__ModulesDict_528_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
G__letint(result7, 105, (long) MadGraphConeJetFinder::DeclFileLine());
return(1 || funcname || hash || result7 || libp) ;
}
// automatic copy constructor
static int G__ModulesDict_528_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphConeJetFinder* p;
void* tmp = (void*) G__int(libp->para[0]);
p = new MadGraphConeJetFinder(*(MadGraphConeJetFinder*) tmp);
result7->obj.i = (long) p;
result7->ref = (long) p;
G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder));
return(1 || funcname || hash || result7 || libp) ;
}
// automatic destructor
typedef MadGraphConeJetFinder G__TMadGraphConeJetFinder;
static int G__ModulesDict_528_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
char* gvp = (char*) G__getgvp();
long soff = G__getstructoffset();
int n = G__getaryconstruct();
//
//has_a_delete: 1
//has_own_delete1arg: 0
//has_own_delete2arg: 0
//
if (!soff) {
return(1);
}
if (n) {
if (gvp == (char*)G__PVOID) {
delete[] (MadGraphConeJetFinder*) soff;
} else {
G__setgvp((long) G__PVOID);
for (int i = n - 1; i >= 0; --i) {
((MadGraphConeJetFinder*) (soff+(sizeof(MadGraphConeJetFinder)*i)))->~G__TMadGraphConeJetFinder();
}
G__setgvp((long)gvp);
}
} else {
if (gvp == (char*)G__PVOID) {
delete (MadGraphConeJetFinder*) soff;
} else {
G__setgvp((long) G__PVOID);
((MadGraphConeJetFinder*) (soff))->~G__TMadGraphConeJetFinder();
G__setgvp((long)gvp);
}
}
G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ;
}
// automatic assignment operator
static int G__ModulesDict_528_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
MadGraphConeJetFinder* dest = (MadGraphConeJetFinder*) G__getstructoffset();
*dest = *(MadGraphConeJetFinder*) libp->para[0].ref;
const MadGraphConeJetFinder& obj = *dest;
result7->ref = (long) (&obj);
result7->obj.i = (long) (&obj);
return(1 || funcname || hash || result7 || libp) ;
}
/* Setting up global function */
/*********************************************************
* Member function Stub
*********************************************************/
/* MadGraphClassFilter */
/* MadGraphAnalysis */
/* MadGraphKtJetFinder */
/* MadGraphConeJetFinder */
/*********************************************************
* Global function Stub
*********************************************************/
/*********************************************************
* Get size of pointer to member function
*********************************************************/
class G__Sizep2memfuncModulesDict {
public:
G__Sizep2memfuncModulesDict(): p(&G__Sizep2memfuncModulesDict::sizep2memfunc) {}
size_t sizep2memfunc() { return(sizeof(p)); }
private:
size_t (G__Sizep2memfuncModulesDict::*p)();
};
size_t G__get_sizep2memfuncModulesDict()
{
G__Sizep2memfuncModulesDict a;
G__setsizep2memfunc((int)a.sizep2memfunc());
return((size_t)a.sizep2memfunc());
}
/*********************************************************
* virtual base class offset calculation interface
*********************************************************/
/* Setting up class inheritance */
/*********************************************************
* Inheritance information setup/
*********************************************************/
extern "C" void G__cpp_setup_inheritanceModulesDict() {
/* Setting up class inheritance */
if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter))) {
MadGraphClassFilter *G__Lderived;
G__Lderived=(MadGraphClassFilter*)0x1000;
{
ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1);
}
{
ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TTask *G__Lpbase=(TTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TNamed *G__Lpbase=(TNamed*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TObject *G__Lpbase=(TObject*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0);
}
}
if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis))) {
MadGraphAnalysis *G__Lderived;
G__Lderived=(MadGraphAnalysis*)0x1000;
{
ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1);
}
{
ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TTask *G__Lpbase=(TTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TNamed *G__Lpbase=(TNamed*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TObject *G__Lpbase=(TObject*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0);
}
}
if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder))) {
MadGraphKtJetFinder *G__Lderived;
G__Lderived=(MadGraphKtJetFinder*)0x1000;
{
ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1);
}
{
ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TTask *G__Lpbase=(TTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TNamed *G__Lpbase=(TNamed*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TObject *G__Lpbase=(TObject*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0);
}
}
if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder))) {
MadGraphConeJetFinder *G__Lderived;
G__Lderived=(MadGraphConeJetFinder*)0x1000;
{
ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1);
}
{
ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TTask *G__Lpbase=(TTask*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TNamed *G__Lpbase=(TNamed*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0);
}
{
TObject *G__Lpbase=(TObject*)G__Lderived;
G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0);
}
}
}
/*********************************************************
* typedef information setup/
*********************************************************/
extern "C" void G__cpp_setup_typetableModulesDict() {
/* Setting up typedef entry */
G__search_typename2("Version_t",115,-1,0,-1);
G__setnewtype(-1,"Class version identifier (short)",0);
G__search_typename2("vector<ROOT::TSchemaHelper>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<TVirtualArray*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("iterator<std::bidirectional_iterator_tag,TObject*,std::ptrdiff_t,const TObject**,const TObject*&>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,std::ptrdiff_t,const TObject**,const TObject*&>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("iterator<bidirectional_iterator_tag,TObject*>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,long>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,long,const TObject**>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,TString>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,TString,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,ParticleHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,MadGraphAnalysis::ParticleHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,MadGraphAnalysis::ParticleHistograms*,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,PairHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,MadGraphAnalysis::PairHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("map<TString,MadGraphAnalysis::PairHistograms*,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<const KtLorentzVector*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<const KtJet::KtLorentzVector*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<KtLorentzVector>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<KtJet::KtLorentzVector>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<PhysicsTower>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("vector<Cluster>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR),0,-1);
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR));
G__setnewtype(-1,NULL,0);
G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR));
G__setnewtype(-1,NULL,0);
}
/*********************************************************
* Data Member information setup/
*********************************************************/
/* Setting up class,struct,union tag member variable */
/* MadGraphClassFilter */
static void G__setup_memvarMadGraphClassFilter(void) {
G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter));
{ MadGraphClassFilter *p; p=(MadGraphClassFilter*)0x1000; if (p) { }
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_ExRootFilter),-1,-1,4,"fFilter=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphParticleClassifier),-1,-1,4,"fClassifier=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL);
}
G__tag_memvar_reset();
}
/* MadGraphAnalysis */
static void G__setup_memvarMadGraphAnalysis(void) {
G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis));
{ MadGraphAnalysis *p; p=(MadGraphAnalysis*)0x1000; if (p) { }
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TString),-1,-1,4,"fOutputFileName=",0,"!");
G__memvar_setup((void*)0,85,0,1,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fInputArray=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchEvent=",0,"!");
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),G__defined_typename("map<TString,ParticleHistograms*>"),-1,4,"fParticleHistogramsMap=",0,"!");
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),G__defined_typename("map<TString,PairHistograms*>"),-1,4,"fPairHistogramsMap=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL);
}
G__tag_memvar_reset();
}
/* MadGraphKtJetFinder */
static void G__setup_memvarMadGraphKtJetFinder(void) {
G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder));
{ MadGraphKtJetFinder *p; p=(MadGraphKtJetFinder*)0x1000; if (p) { }
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMaxParticleEta=",0,(char*)NULL);
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinParticlePT=",0,(char*)NULL);
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinJetPT=",0,(char*)NULL);
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fParameterR=",0,(char*)NULL);
G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fCollisionType=",0,(char*)NULL);
G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fDistanceScheme=",0,(char*)NULL);
G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fRecombinationScheme=",0,(char*)NULL);
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),G__defined_typename("vector<KtJet::KtLorentzVector>"),-1,4,"fTowersList=",0,"!");
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),G__defined_typename("vector<KtJet::KtLorentzVector>"),-1,4,"fJetsList=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL);
}
G__tag_memvar_reset();
}
/* MadGraphConeJetFinder */
static void G__setup_memvarMadGraphConeJetFinder(void) {
G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder));
{ MadGraphConeJetFinder *p; p=(MadGraphConeJetFinder*)0x1000; if (p) { }
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinParticlePT=",0,(char*)NULL);
G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinJetPT=",0,(char*)NULL);
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR),G__defined_typename("vector<PhysicsTower>"),-1,4,"fTowersList=",0,(char*)NULL);
G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR),G__defined_typename("vector<Cluster>"),-1,4,"fJetsList=",0,(char*)NULL);
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_MidPointAlgorithm),-1,-1,4,"fJetAlgo=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!");
G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL);
}
G__tag_memvar_reset();
}
extern "C" void G__cpp_setup_memvarModulesDict() {
}
/***********************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
***********************************************************/
/*********************************************************
* Member function information setup for each class
*********************************************************/
static void G__setup_memfuncMadGraphClassFilter(void) {
/* MadGraphClassFilter */
G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter));
G__memfunc_setup("MadGraphClassFilter",1888,G__ModulesDict_451_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Class",502,G__ModulesDict_451_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphClassFilter::Class) ), 0);
G__memfunc_setup("Class_Name",982,G__ModulesDict_451_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::Class_Name) ), 0);
G__memfunc_setup("Class_Version",1339,G__ModulesDict_451_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphClassFilter::Class_Version) ), 0);
G__memfunc_setup("Dictionary",1046,G__ModulesDict_451_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphClassFilter::Dictionary) ), 0);
G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_451_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("DeclFileName",1145,G__ModulesDict_451_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::DeclFileName) ), 0);
G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_451_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphClassFilter::ImplFileLine) ), 0);
G__memfunc_setup("ImplFileName",1171,G__ModulesDict_451_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::ImplFileName) ), 0);
G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_451_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphClassFilter::DeclFileLine) ), 0);
// automatic copy constructor
G__memfunc_setup("MadGraphClassFilter", 1888, G__ModulesDict_451_0_17, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 0, 1, 1, 1, 0, "u 'MadGraphClassFilter' - 11 - -", (char*) NULL, (void*) NULL, 0);
// automatic destructor
G__memfunc_setup("~MadGraphClassFilter", 2014, G__ModulesDict_451_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1);
// automatic assignment operator
G__memfunc_setup("operator=", 937, G__ModulesDict_451_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 1, 1, 1, 1, 0, "u 'MadGraphClassFilter' - 11 - -", (char*) NULL, (void*) NULL, 0);
G__tag_memfunc_reset();
}
static void G__setup_memfuncMadGraphAnalysis(void) {
/* MadGraphAnalysis */
G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis));
G__memfunc_setup("MadGraphAnalysis",1608,G__ModulesDict_453_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("BookParticleHistograms",2272,(G__InterfaceMethod) NULL, 121, -1, -1, 0, 3, 1, 4, 0,
"U 'MadGraphAnalysis::ParticleHistograms' - 0 - histograms C - - 10 - name "
"C - - 10 - title", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("BookPairHistograms",1848,(G__InterfaceMethod) NULL, 121, -1, -1, 0, 3, 1, 4, 0,
"U 'MadGraphAnalysis::PairHistograms' - 0 - histograms C - - 10 - name "
"C - - 10 - title", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("GetParticleHistograms",2165,(G__InterfaceMethod) NULL, 85, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms), -1, 0, 2, 1, 4, 0,
"C - - 10 - module i - 'Int_t' 0 - number", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("GetPairHistograms",1741,(G__InterfaceMethod) NULL, 85, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms), -1, 0, 4, 1, 4, 0,
"C - - 10 - module1 i - 'Int_t' 0 - number1 "
"C - - 10 - module2 i - 'Int_t' 0 - number2", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("Class",502,G__ModulesDict_453_0_9, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphAnalysis::Class) ), 0);
G__memfunc_setup("Class_Name",982,G__ModulesDict_453_0_10, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::Class_Name) ), 0);
G__memfunc_setup("Class_Version",1339,G__ModulesDict_453_0_11, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphAnalysis::Class_Version) ), 0);
G__memfunc_setup("Dictionary",1046,G__ModulesDict_453_0_12, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphAnalysis::Dictionary) ), 0);
G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_453_0_16, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("DeclFileName",1145,G__ModulesDict_453_0_17, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::DeclFileName) ), 0);
G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_453_0_18, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphAnalysis::ImplFileLine) ), 0);
G__memfunc_setup("ImplFileName",1171,G__ModulesDict_453_0_19, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::ImplFileName) ), 0);
G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_453_0_20, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphAnalysis::DeclFileLine) ), 0);
// automatic copy constructor
G__memfunc_setup("MadGraphAnalysis", 1608, G__ModulesDict_453_0_21, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis), -1, 0, 1, 1, 1, 0, "u 'MadGraphAnalysis' - 11 - -", (char*) NULL, (void*) NULL, 0);
// automatic destructor
G__memfunc_setup("~MadGraphAnalysis", 1734, G__ModulesDict_453_0_22, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1);
G__tag_memfunc_reset();
}
static void G__setup_memfuncMadGraphKtJetFinder(void) {
/* MadGraphKtJetFinder */
G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder));
G__memfunc_setup("MadGraphKtJetFinder",1854,G__ModulesDict_517_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Class",502,G__ModulesDict_517_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphKtJetFinder::Class) ), 0);
G__memfunc_setup("Class_Name",982,G__ModulesDict_517_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::Class_Name) ), 0);
G__memfunc_setup("Class_Version",1339,G__ModulesDict_517_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphKtJetFinder::Class_Version) ), 0);
G__memfunc_setup("Dictionary",1046,G__ModulesDict_517_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphKtJetFinder::Dictionary) ), 0);
G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_517_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("DeclFileName",1145,G__ModulesDict_517_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::DeclFileName) ), 0);
G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_517_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphKtJetFinder::ImplFileLine) ), 0);
G__memfunc_setup("ImplFileName",1171,G__ModulesDict_517_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::ImplFileName) ), 0);
G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_517_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphKtJetFinder::DeclFileLine) ), 0);
// automatic copy constructor
G__memfunc_setup("MadGraphKtJetFinder", 1854, G__ModulesDict_517_0_17, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 0, 1, 1, 1, 0, "u 'MadGraphKtJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0);
// automatic destructor
G__memfunc_setup("~MadGraphKtJetFinder", 1980, G__ModulesDict_517_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1);
// automatic assignment operator
G__memfunc_setup("operator=", 937, G__ModulesDict_517_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 1, 1, 1, 1, 0, "u 'MadGraphKtJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0);
G__tag_memfunc_reset();
}
static void G__setup_memfuncMadGraphConeJetFinder(void) {
/* MadGraphConeJetFinder */
G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder));
G__memfunc_setup("MadGraphConeJetFinder",2052,G__ModulesDict_528_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Class",502,G__ModulesDict_528_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphConeJetFinder::Class) ), 0);
G__memfunc_setup("Class_Name",982,G__ModulesDict_528_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::Class_Name) ), 0);
G__memfunc_setup("Class_Version",1339,G__ModulesDict_528_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphConeJetFinder::Class_Version) ), 0);
G__memfunc_setup("Dictionary",1046,G__ModulesDict_528_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphConeJetFinder::Dictionary) ), 0);
G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1);
G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_528_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0);
G__memfunc_setup("DeclFileName",1145,G__ModulesDict_528_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::DeclFileName) ), 0);
G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_528_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphConeJetFinder::ImplFileLine) ), 0);
G__memfunc_setup("ImplFileName",1171,G__ModulesDict_528_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::ImplFileName) ), 0);
G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_528_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphConeJetFinder::DeclFileLine) ), 0);
// automatic copy constructor
G__memfunc_setup("MadGraphConeJetFinder", 2052, G__ModulesDict_528_0_17, (int) ('i'),
G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 0, 1, 1, 1, 0, "u 'MadGraphConeJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0);
// automatic destructor
G__memfunc_setup("~MadGraphConeJetFinder", 2178, G__ModulesDict_528_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1);
// automatic assignment operator
G__memfunc_setup("operator=", 937, G__ModulesDict_528_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 1, 1, 1, 1, 0, "u 'MadGraphConeJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0);
G__tag_memfunc_reset();
}
/*********************************************************
* Member function information setup
*********************************************************/
extern "C" void G__cpp_setup_memfuncModulesDict() {
}
/*********************************************************
* Global variable information setup for each class
*********************************************************/
static void G__cpp_setup_global0() {
/* Setting up global variables */
G__resetplocal();
}
static void G__cpp_setup_global1() {
}
static void G__cpp_setup_global2() {
G__resetglobalenv();
}
extern "C" void G__cpp_setup_globalModulesDict() {
G__cpp_setup_global0();
G__cpp_setup_global1();
G__cpp_setup_global2();
}
/*********************************************************
* Global function information setup for each class
*********************************************************/
static void G__cpp_setup_func0() {
G__lastifuncposition();
}
static void G__cpp_setup_func1() {
}
static void G__cpp_setup_func2() {
}
static void G__cpp_setup_func3() {
}
static void G__cpp_setup_func4() {
}
static void G__cpp_setup_func5() {
}
static void G__cpp_setup_func6() {
}
static void G__cpp_setup_func7() {
}
static void G__cpp_setup_func8() {
}
static void G__cpp_setup_func9() {
}
static void G__cpp_setup_func10() {
}
static void G__cpp_setup_func11() {
}
static void G__cpp_setup_func12() {
}
static void G__cpp_setup_func13() {
}
static void G__cpp_setup_func14() {
}
static void G__cpp_setup_func15() {
}
static void G__cpp_setup_func16() {
}
static void G__cpp_setup_func17() {
}
static void G__cpp_setup_func18() {
}
static void G__cpp_setup_func19() {
}
static void G__cpp_setup_func20() {
G__resetifuncposition();
}
extern "C" void G__cpp_setup_funcModulesDict() {
G__cpp_setup_func0();
G__cpp_setup_func1();
G__cpp_setup_func2();
G__cpp_setup_func3();
G__cpp_setup_func4();
G__cpp_setup_func5();
G__cpp_setup_func6();
G__cpp_setup_func7();
G__cpp_setup_func8();
G__cpp_setup_func9();
G__cpp_setup_func10();
G__cpp_setup_func11();
G__cpp_setup_func12();
G__cpp_setup_func13();
G__cpp_setup_func14();
G__cpp_setup_func15();
G__cpp_setup_func16();
G__cpp_setup_func17();
G__cpp_setup_func18();
G__cpp_setup_func19();
G__cpp_setup_func20();
}
/*********************************************************
* Class,struct,union,enum tag information setup
*********************************************************/
/* Setup class/struct taginfo */
G__linked_taginfo G__ModulesDictLN_TClass = { "TClass" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TBuffer = { "TBuffer" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TMemberInspector = { "TMemberInspector" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TObject = { "TObject" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TNamed = { "TNamed" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TString = { "TString" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR = { "vector<ROOT::TSchemaHelper,allocator<ROOT::TSchemaHelper> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<ROOT::TSchemaHelper,allocator<ROOT::TSchemaHelper> >::iterator>" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TObjArray = { "TObjArray" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TClonesArray = { "TClonesArray" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR = { "vector<TVirtualArray*,allocator<TVirtualArray*> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<TVirtualArray*,allocator<TVirtualArray*> >::iterator>" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_TIterator = { "TIterator" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR = { "iterator<bidirectional_iterator_tag,TObject*,long,const TObject**,const TObject*&>" , 115 , -1 };
G__linked_taginfo G__ModulesDictLN_TTask = { "TTask" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR = { "map<TString,TString,less<TString>,allocator<pair<const TString,TString> > >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_ExRootTask = { "ExRootTask" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_ExRootModule = { "ExRootModule" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_ExRootFilter = { "ExRootFilter" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphParticleClassifier = { "MadGraphParticleClassifier" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphClassFilter = { "MadGraphClassFilter" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphAnalysis = { "MadGraphAnalysis" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms = { "MadGraphAnalysis::ParticleHistograms" , 115 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms = { "MadGraphAnalysis::PairHistograms" , 115 , -1 };
G__linked_taginfo G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR = { "map<TString,MadGraphAnalysis::ParticleHistograms*,less<TString>,allocator<pair<const TString,MadGraphAnalysis::ParticleHistograms*> > >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR = { "map<TString,MadGraphAnalysis::PairHistograms*,less<TString>,allocator<pair<const TString,MadGraphAnalysis::PairHistograms*> > >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR = { "vector<const KtJet::KtLorentzVector*,allocator<const KtJet::KtLorentzVector*> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<const KtJet::KtLorentzVector*,allocator<const KtJet::KtLorentzVector*> >::iterator>" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR = { "vector<KtJet::KtLorentzVector,allocator<KtJet::KtLorentzVector> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<KtJet::KtLorentzVector,allocator<KtJet::KtLorentzVector> >::iterator>" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphKtJetFinder = { "MadGraphKtJetFinder" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR = { "vector<PhysicsTower,allocator<PhysicsTower> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<PhysicsTower,allocator<PhysicsTower> >::iterator>" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MidPointAlgorithm = { "MidPointAlgorithm" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_MadGraphConeJetFinder = { "MadGraphConeJetFinder" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR = { "vector<Cluster,allocator<Cluster> >" , 99 , -1 };
G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<Cluster,allocator<Cluster> >::iterator>" , 99 , -1 };
/* Reset class/struct taginfo */
extern "C" void G__cpp_reset_tagtableModulesDict() {
G__ModulesDictLN_TClass.tagnum = -1 ;
G__ModulesDictLN_TBuffer.tagnum = -1 ;
G__ModulesDictLN_TMemberInspector.tagnum = -1 ;
G__ModulesDictLN_TObject.tagnum = -1 ;
G__ModulesDictLN_TNamed.tagnum = -1 ;
G__ModulesDictLN_TString.tagnum = -1 ;
G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR.tagnum = -1 ;
G__ModulesDictLN_TObjArray.tagnum = -1 ;
G__ModulesDictLN_TClonesArray.tagnum = -1 ;
G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR.tagnum = -1 ;
G__ModulesDictLN_TIterator.tagnum = -1 ;
G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR.tagnum = -1 ;
G__ModulesDictLN_TTask.tagnum = -1 ;
G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR.tagnum = -1 ;
G__ModulesDictLN_ExRootTask.tagnum = -1 ;
G__ModulesDictLN_ExRootModule.tagnum = -1 ;
G__ModulesDictLN_ExRootFilter.tagnum = -1 ;
G__ModulesDictLN_MadGraphParticleClassifier.tagnum = -1 ;
G__ModulesDictLN_MadGraphClassFilter.tagnum = -1 ;
G__ModulesDictLN_MadGraphAnalysis.tagnum = -1 ;
G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms.tagnum = -1 ;
G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms.tagnum = -1 ;
G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR.tagnum = -1 ;
G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR.tagnum = -1 ;
G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR.tagnum = -1 ;
G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR.tagnum = -1 ;
G__ModulesDictLN_MadGraphKtJetFinder.tagnum = -1 ;
G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR.tagnum = -1 ;
G__ModulesDictLN_MidPointAlgorithm.tagnum = -1 ;
G__ModulesDictLN_MadGraphConeJetFinder.tagnum = -1 ;
G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR.tagnum = -1 ;
G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR.tagnum = -1 ;
}
extern "C" void G__cpp_setup_tagtableModulesDict() {
/* Setting up class,struct,union tag entry */
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TClass);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TBuffer);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TMemberInspector);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TObject);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TNamed);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TString);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TObjArray);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TClonesArray);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TIterator);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_TTask);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootTask);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootModule);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootFilter);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphParticleClassifier);
G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphClassFilter),sizeof(MadGraphClassFilter),-1,324864,(char*)NULL,G__setup_memvarMadGraphClassFilter,G__setup_memfuncMadGraphClassFilter);
G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysis),sizeof(MadGraphAnalysis),-1,324864,(char*)NULL,G__setup_memvarMadGraphAnalysis,G__setup_memfuncMadGraphAnalysis);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR);
G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphKtJetFinder),sizeof(MadGraphKtJetFinder),-1,324864,(char*)NULL,G__setup_memvarMadGraphKtJetFinder,G__setup_memfuncMadGraphKtJetFinder);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_MidPointAlgorithm);
G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphConeJetFinder),sizeof(MadGraphConeJetFinder),-1,324864,(char*)NULL,G__setup_memvarMadGraphConeJetFinder,G__setup_memfuncMadGraphConeJetFinder);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR);
G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR);
}
extern "C" void G__cpp_setupModulesDict(void) {
G__check_setup_version(30051515,"G__cpp_setupModulesDict()");
G__set_cpp_environmentModulesDict();
G__cpp_setup_tagtableModulesDict();
G__cpp_setup_inheritanceModulesDict();
G__cpp_setup_typetableModulesDict();
G__cpp_setup_memvarModulesDict();
G__cpp_setup_memfuncModulesDict();
G__cpp_setup_globalModulesDict();
G__cpp_setup_funcModulesDict();
if(0==G__getsizep2memfunc()) G__get_sizep2memfuncModulesDict();
return;
}
class G__cpp_setup_initModulesDict {
public:
G__cpp_setup_initModulesDict() { G__add_setup_func("ModulesDict",(G__incsetup)(&G__cpp_setupModulesDict)); G__call_setup_funcs(); }
~G__cpp_setup_initModulesDict() { G__remove_setup_func("ModulesDict"); }
};
G__cpp_setup_initModulesDict G__cpp_setup_initializerModulesDict;
| [
"[email protected]"
] | |
28e143bbb70b47096a6827d25f27b95d48ad2d8a | 9f9dce45e477007505617aa428945e35e8db4e6e | /modules/task_1/novozhilova_e_labeling/main.cpp | abb839c11a23963560784d0e46cc73d4695ec7a4 | [
"BSD-3-Clause"
] | permissive | Sergey01923/pp_2021_spring_informatics | bbce7351e391463868e8cb5bc848d6d2d46fbd47 | 1499ac172be6b57ba9fde633873360b51a54644f | refs/heads/master | 2023-05-11T10:02:26.907924 | 2021-06-04T10:54:25 | 2021-06-04T10:54:25 | 352,624,861 | 0 | 0 | BSD-3-Clause | 2021-04-18T19:17:46 | 2021-03-29T11:51:20 | null | UTF-8 | C++ | false | false | 6,708 | cpp | // Copyright 2021 Novozhilova Ekaterina
#include <gtest/gtest.h>
#include "./labeling.h"
TEST(Sequential, Test_10x10) {
std::vector<std::vector<int>> arr = {{1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 1, 1, 0, 0, 0, 0, 1, 0},
{1, 0, 0, 1, 0, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 1, 1},
{1, 0, 0, 0, 1, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 1, 1}};
std::vector<std::vector<int>> expected = {{1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 2, 2, 0, 0, 0, 0, 3, 0},
{1, 0, 0, 2, 0, 4, 4, 0, 0, 0},
{0, 0, 0, 0, 0, 4, 4, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 4, 0, 0, 0},
{0, 0, 0, 5, 0, 5, 0, 0, 0, 0},
{0, 0, 5, 5, 5, 5, 5, 0, 0, 0},
{0, 0, 0, 5, 5, 5, 0, 0, 6, 6},
{7, 0, 0, 0, 5, 0, 0, 0, 6, 6},
{0, 0, 0, 0, 0, 0, 0, 0, 6, 6}};
std::vector<std::vector<int>> res;
res = Labeling(arr, 10, 10);
ASSERT_EQ(expected, res);
}
TEST(Sequential, Test_15x15) {
std::vector<std::vector<int>> arr = {{1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
{1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
std::vector<std::vector<int>> expected = {{1, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3},
{0, 0, 2, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 3},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0},
{0, 0, 5, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0},
{0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 5, 0, 5, 0, 6, 6, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 5, 5, 5, 0, 6, 6, 0, 0, 0, 0, 0, 0},
{7, 0, 5, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{7, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{7, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0},
{7, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0},
{7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
std::vector<std::vector<int>> res;
res = Labeling(arr, 15, 15);
ASSERT_EQ(expected, res);
}
TEST(Sequential, Test_5x5) {
std::vector<std::vector<int>> arr = {{0, 0, 1, 1, 1},
{0, 0, 0, 0, 1},
{1, 1, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0}};
std::vector<std::vector<int>> expected = {{0, 0, 1, 1, 1},
{0, 0, 0, 0, 1},
{2, 2, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 3, 0, 0}};
std::vector<std::vector<int>> res;
res = Labeling(arr, 5, 5);
ASSERT_EQ(expected, res);
}
TEST(Sequential, Test_Empty) {
std::vector<std::vector<int>> arr = {{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}};
std::vector<std::vector<int>> expected = {{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}};
std::vector<std::vector<int>> res;
res = Labeling(arr, 5, 5);
ASSERT_EQ(expected, res);
}
TEST(Sequential, Test_Full) {
std::vector<std::vector<int>> arr = {{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}};
std::vector<std::vector<int>> expected = {{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}};
std::vector<std::vector<int>> res;
res = Labeling(arr, 5, 5);
ASSERT_EQ(expected, res);
}
| [
"[email protected]"
] | |
e2595fe39afb3384e2b67a8d31166cb1664b387e | ee41758c348e4e2e7eb45983ca7c647fdcbe754d | /ProiectSDA/src/util/vector.h | 687386fa3aba4f0018db9b8ec316a3da97a5379a | [] | no_license | mariusadam/dictionary-mvc-cpp | 9a180ca1dbed4871f634531ddd422325f3e2ee7d | e4bd6f73fa8a9c91a6c11999e7073c0548c6fbb6 | refs/heads/master | 2021-01-19T03:48:44.782482 | 2016-06-03T02:24:41 | 2016-06-03T02:24:41 | 60,148,579 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,197 | h | #ifndef VECTOR_H
#define VECTOR_H
#include <exception>
#include <cmath>
class VectorException : public std::exception
{
public:
VectorException() : std::exception() {}
VectorException(const char* msg) : std::exception{ msg } {}
};
template<typename Type> class IteratorVector;
/* Vector declaration */
template<typename Type> class Vector
{
private:
int __size;
int __capacity;
Type* __elements;
void __resize();
void __ensureCapacity();
public:
static const int DEFAULT_CAPACITY;
static const double RESIZE_FACTOR;
Vector();
Vector(const int& dim);
Vector(const Vector& other);
~Vector();
const int size() const;
void push_back(const Type& element);
bool has(const Type& element);
Type& at(const int& offset) const;
Type& pop(const int& offset);
Type& pop();
Type& remove(const Type& element);
Type& operator[](const int& offset) const;
Vector<Type> operator=(const Vector<Type> &other);
IteratorVector<Type> begin() const;
IteratorVector<Type> end() const;
};
/* IteratorVector declaration */
template<typename Type> class IteratorVector
{
private:
const Vector<Type>& __vec;
int __current;
public:
IteratorVector(const Vector<Type>& vec) : __vec{ vec }, __current{ 0 } {}
IteratorVector(const Vector<Type>& vec, const int& poz) : __vec{ vec }, __current{ poz } {}
~IteratorVector() {}
Type& element() const;
void next();
bool valid() const;
IteratorVector& operator++();
Type& operator*() const;
bool operator==(const IteratorVector<Type>& other) const;
bool operator!=(const IteratorVector<Type>& other) const;
};
/* Vector implementation */
template<typename Type>const int Vector<Type>::DEFAULT_CAPACITY = 1;
template<typename Type>const double Vector<Type>::RESIZE_FACTOR = 1.5;
template<typename Type>inline Vector<Type>::Vector() {
this->__size = 0;
this->__capacity = DEFAULT_CAPACITY;
this->__elements = new Type[DEFAULT_CAPACITY];
}
template<typename Type>inline Vector<Type>::Vector(const int& dim) {
if (dim < 0) {
throw VectorException("Invalid capacity!");
}
this->__size = 0;
this->__capacity = dim;
this->__elements = new Type[dim];
}
template<typename Type>inline Vector<Type>::Vector(const Vector& other) {
this->__elements = new Type[other.__size];
for (int i = 0; i < other.__size; i++) {
this->__elements[i] = other.__elements[i];
}
this->__size = other.__size;
this->__capacity = other.__capacity;
}
template<typename Type>inline Vector<Type>::~Vector() {
this->__size = 0;
this->__capacity = 0;
delete[] this->__elements;
}
template<typename Type>inline const int Vector<Type>::size() const {
return this->__size;
}
template<typename Type>inline void Vector<Type>::push_back(const Type& elem) {
this->__ensureCapacity();
this->__elements[this->__size++] = elem;
}
template<typename Type>inline bool Vector<Type>::has(const Type & element)
{
for (int i = 0; i < this->__size; i++) {
if (this->__elements[i] == element) {
return true;
}
}
return false;
}
template<typename Type>inline Type& Vector<Type>::at(const int& offset) const {
if (offset < 0 || offset >= this->__size) {
throw VectorException("Index out of range!");
}
return this->__elements[offset];
}
template<typename Type>inline Type& Vector<Type>::pop(const int& offset) {
if (offset < 0 || offset >= this->__size) {
throw VectorException("Index out of range!");
}
Type elem = this->__elements[offset];
for (int i = offset; i < this->__size - 1; i++) {
this->__elements[i] = this->__elements[i + 1];
}
this->__size--;
return elem;
}
template<typename Type>inline Type& Vector<Type>::pop() {
if (this->__size == 0) {
throw VectorException("The vector is empty!");
}
return this->pop(this->__size - 1)
}
template<typename Type>inline Type& Vector<Type>::remove(const Type& elem) {
for (int i = 0; i < this->__size; i++) {
if (this->__elements[i] == elem) {
return this->pop(i);
}
}
throw VectorException("Element not found!");
}
template<typename Type>inline Type& Vector<Type>::operator[](const int& offset) const {
return this->at(offset);
}
template<typename Type>
inline Vector<Type> Vector<Type>::operator=(const Vector<Type>& other) {
delete[] this->__elements;
this->__elements = new Type[other.__capacity];
for (int i = 0; i < other.__size; i++) {
this->__elements[i] = other.__elements[i];
}
this->__size = other.__size;
this->__capacity = other.__capacity;
return *this;
}
template<typename Type>inline IteratorVector<Type> Vector<Type>::begin() const {
return IteratorVector<Type> {*this};
}
template<typename Type>inline IteratorVector<Type> Vector<Type>::end() const {
return IteratorVector<Type> {*this, this->__size};
}
template<typename Type>inline void Vector<Type>::__ensureCapacity() {
if (this->__size == this->__capacity) {
this->__resize();
}
}
template<typename Type>inline void Vector<Type>::__resize() {
int newCapacity = this->__capacity + (int)std::round(this->__capacity * this->RESIZE_FACTOR) + 1;
Type* newElements = new Type[newCapacity];
if (newElements == NULL) {
throw VectorException("Could not resize, you ran out of memory!");
}
for (int i = 0; i < this->__size; i++) {
newElements[i] = this->__elements[i];
}
delete[] this->__elements;
this->__elements = newElements;
this->__capacity = newCapacity;
}
/* IteratorVector implementation */
template<typename Type>inline Type& IteratorVector<Type>::element() const {
return this->__vec[this->__current];
}
template<typename Type>inline void IteratorVector<Type>::next() {
this->__current++;
}
template<typename Type>inline bool IteratorVector<Type>::valid() const {
return this->__current != this->__vec.size();
}
template<typename Type>inline IteratorVector<Type>& IteratorVector<Type>::operator++() {
this->next();
return *this;
}
template<typename Type>inline bool IteratorVector<Type>::operator==(const IteratorVector<Type>& other) const {
return this->__current == other.__current;
}
template<typename Type>inline bool IteratorVector<Type>::operator!=(const IteratorVector<Type>& other) const {
return !(*this == other);
}
template<typename Type>inline Type& IteratorVector<Type>::operator*() const {
return this->element();
}
#endif // !VECTOR_H
| [
"[email protected]"
] | |
ee9e7f30a7ff01ad2c4150a2d50ffe44865f4f5e | 91b19ebb15c3f07785929b7f7a4972ca8f89c847 | /Classes/Jack.cpp | dc3265eea93b68a404ff3e00f17485c21d6a14a0 | [] | no_license | droidsde/DrawGirlsDiary | 85519ac806bca033c09d8b60fd36624f14d93c2e | 738e3cee24698937c8b21bd85517c9e10989141e | refs/heads/master | 2020-04-08T18:55:14.160915 | 2015-01-07T05:33:16 | 2015-01-07T05:33:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 103,675 | cpp | //
// Jack.cpp
// DrawingJack
//
// Created by 사원3 on 12. 11. 29..
//
//
#include "Jack.h"
#include "ASPopupView.h"
#include "StarGoldData.h"
#include "CCMenuLambda.h"
#include "MaingameScene.h"
#include "TutorialFlowStep.h"
#include "MyLocalization.h"
#include "AchieveNoti.h"
#include "CommonAnimation.h"
void Jack::searchAndMoveOldline(IntMoveState searchFirstMoveState)
{
queue<IntMoveState> bfsArray;
bfsArray.push(searchFirstMoveState);
bool isFinded = false;
IntPoint findedPoint;
bool is_not_outline_found = false;
IntPoint not_outline_found_point;
while(!bfsArray.empty() && !is_not_outline_found)//!isFinded)
{
IntMoveState t_ms = bfsArray.front();
bfsArray.pop();
if(myGD->mapState[t_ms.origin.x][t_ms.origin.y] == mapOldline)
{
if(!isFinded)
{
isFinded = true;
findedPoint = t_ms.origin;
}
if((t_ms.origin.x != mapWidthInnerBegin && t_ms.origin.x != mapWidthInnerEnd-1) && (t_ms.origin.y != mapHeightInnerBegin || t_ms.origin.y != mapHeightInnerEnd-1))
{
is_not_outline_found = true;
not_outline_found_point = t_ms.origin;
}
else
{
if(t_ms.direction == directionStop)
{
for(int i = directionLeftUp;i <= directionUp; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionLeftUp)
{
for(int i = directionLeftUp;i <= directionLeft; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionLeft)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x-1, t_ms.origin.y, directionLeft);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionLeftDown)
{
for(int i = directionLeft;i <= directionDown; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionDown)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y-1, directionDown);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionRightDown)
{
for(int i = directionDown;i <= directionRight; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionRight)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x+1, t_ms.origin.y, directionRight);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionRightUp)
{
for(int i = directionRight;i <= directionUp; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionUp)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
}
}
else
{
if(t_ms.direction == directionStop)
{
for(int i = directionLeftUp;i <= directionUp; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionLeftUp)
{
for(int i = directionLeftUp;i <= directionLeft; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionLeft)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x-1, t_ms.origin.y, directionLeft);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionLeftDown)
{
for(int i = directionLeft;i <= directionDown; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionDown)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y-1, directionDown);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionRightDown)
{
for(int i = directionDown;i <= directionRight; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionRight)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x+1, t_ms.origin.y, directionRight);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
else if(t_ms.direction == directionRightUp)
{
for(int i = directionRight;i <= directionUp; i++)
{
IntVector t_v = IntVector::directionVector((IntDirection)i);
IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);
}
}
else if(t_ms.direction == directionUp)
{
{ IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp);
if(n_ms.origin.isInnerMap())
bfsArray.push(n_ms);}
}
}
}
if(is_not_outline_found && !not_outline_found_point.isNull())
{
myGD->setJackPoint(not_outline_found_point);
setPosition(not_outline_found_point.convertToCCP());
}
else if(isFinded && !findedPoint.isNull())
{
myGD->setJackPoint(findedPoint);
setPosition(findedPoint.convertToCCP());
}
else // escape point not found
{
CCLOG("escape point not found!");
int i = kAchievementCode_hidden_dieEasy;
if(!myAchieve->isCompleted(AchievementCode(i)) && !myAchieve->isAchieve(AchievementCode(i)))
{
if(!myAchieve->isNoti(AchievementCode(i)) && !myAchieve->isCompleted(AchievementCode(i)) &&
myGD->getCommunication("UI_getUseTime") <= myAchieve->getCondition(AchievementCode(i)))
{
myAchieve->changeIngCount(AchievementCode(i), myAchieve->getCondition(AchievementCode(i)));
AchieveNoti* t_noti = AchieveNoti::create(AchievementCode(i));
CCDirector::sharedDirector()->getRunningScene()->addChild(t_noti);
}
}
mySGD->fail_code = kFC_gameover;
myGD->setIsGameover(true);
myGD->communication("Main_gameover");
}
}
//////////////////////////////////////////////////////////////////////////////// move test /////////////////////////////////////////////////////////
void Jack::moveTest()
{
IntPoint jp = myGD->getJackPoint();
CCPoint beforePosition = ccp((jp.x-1)*pixelSize+1, (jp.y-1)*pixelSize+1);
IntVector dv = IntVector::directionVector(direction);
IntVector s_dv = IntVector::directionVector(secondDirection);
IntVector c_dv = IntVector::directionVector(no_draw_direction);
IntVector c_s_dv = IntVector::directionVector(no_draw_secondDirection);
if(jp.isNull()) return;
if(test_speed >= 4.f)
{
if(is_double_moving == false)
is_double_moving = true;
else
is_double_moving = false;
}
else
is_double_moving = false;
IntPoint checkPoint;
IntPoint s_checkPoint;
IntVector s_dv_reverse;
IntPoint s_checkPoint_reverse;
if(direction == directionLeftDown)
{
if(before_x_direction != directionLeft && before_x_direction != directionDown)
{
dv = IntVector::directionVector(secondDirection);
before_x_direction = secondDirection;
}
else dv = IntVector::directionVector(before_x_direction);
if(before_x_direction == secondDirection)
{
if(before_x_direction == directionLeft)
{
s_dv = IntVector::directionVector(directionDown);
s_dv_reverse = IntVector::directionVector(directionUp);
}
else
{
s_dv = IntVector::directionVector(directionLeft);
s_dv_reverse = IntVector::directionVector(directionRight);
}
}
else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection);
}
else if(direction == directionRightDown)
{
if(before_x_direction != directionRight && before_x_direction != directionDown)
{
dv = IntVector::directionVector(secondDirection);
before_x_direction = secondDirection;
}
else dv = IntVector::directionVector(before_x_direction);
if(before_x_direction == secondDirection)
{
if(before_x_direction == directionRight)
{
s_dv = IntVector::directionVector(directionDown);
s_dv_reverse = IntVector::directionVector(directionUp);
}
else
{
s_dv = IntVector::directionVector(directionRight);
s_dv_reverse = IntVector::directionVector(directionLeft);
}
}
else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection);
}
else if(direction == directionRightUp)
{
if(before_x_direction != directionRight && before_x_direction != directionUp)
{
dv = IntVector::directionVector(secondDirection);
before_x_direction = secondDirection;
}
else dv = IntVector::directionVector(before_x_direction);
if(before_x_direction == secondDirection)
{
if(before_x_direction == directionRight)
{
s_dv = IntVector::directionVector(directionUp);
s_dv_reverse = IntVector::directionVector(directionDown);
}
else
{
s_dv = IntVector::directionVector(directionRight);
s_dv_reverse = IntVector::directionVector(directionLeft);
}
}
else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection);
}
else if(direction == directionLeftUp)
{
if(before_x_direction != directionLeft && before_x_direction != directionUp)
{
dv = IntVector::directionVector(secondDirection);
before_x_direction = secondDirection;
}
else dv = IntVector::directionVector(before_x_direction);
if(before_x_direction == secondDirection)
{
if(before_x_direction == directionLeft)
{
s_dv = IntVector::directionVector(directionUp);
s_dv_reverse = IntVector::directionVector(directionDown);
}
else
{
s_dv = IntVector::directionVector(directionLeft);
s_dv_reverse = IntVector::directionVector(directionRight);
}
}
else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection);
}
else
s_dv_reverse = IntVector::reverseDirectionVector(secondDirection);
checkPoint = IntPoint(jp.x+dv.dx, jp.y+dv.dy);
s_checkPoint = IntPoint(jp.x+s_dv.dx, jp.y+s_dv.dy);
s_checkPoint_reverse = IntPoint(jp.x+s_dv_reverse.dx, jp.y+s_dv_reverse.dy);
IntPoint c_checkPoint = IntPoint(jp.x+c_dv.dx, jp.y+c_dv.dy);
IntPoint c_s_checkPoint = IntPoint(jp.x+c_s_dv.dx, jp.y+c_s_dv.dy);
float t_speed = test_speed > 2.f ? 2.f : test_speed;
if(myState == jackStateNormal)
{
// main direction moving
if(c_dv.dx == 0 && c_dv.dy == 0)
stopMove();
else if(c_checkPoint.isInnerMap() && myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapOldline) // moving
{
afterPoint = IntPoint(c_checkPoint.x, c_checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_dv.dx,t_speed*c_dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = c_dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move"))
// jack_ccb_manager->runAnimationsForSequenceNamed("move");
//
// if(c_dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(c_dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
// main direction drawing
else if(c_checkPoint.isInnerMap() && myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapEmpty && isDrawingOn) // main drawing start
{
myGD->communication("CP_onJackDrawLine");
// path add
if(is_end_turn)
{
is_end_turn = false;
IntPointVector t_pv = IntPointVector(jp.x, jp.y, c_dv.dx, c_dv.dy);
myGD->communication("PM_addPath", t_pv);
}
// jack drawing
setJackState(jackStateDrawing);
afterPoint = IntPoint(c_checkPoint.x, c_checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_dv.dx,t_speed*c_dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = c_dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
//
// if(c_dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(c_dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else if(c_s_dv.dx == 0 && c_s_dv.dy == 0)
stopMove();
else if(c_checkPoint.isInnerMap() && (myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapEmpty || myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapOldget) &&
c_s_checkPoint.isInnerMap() && myGD->mapState[c_s_checkPoint.x][c_s_checkPoint.y] == mapOldline)
{
afterPoint = IntPoint(c_s_checkPoint.x, c_s_checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_s_dv.dx,t_speed*c_s_dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = c_s_dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move"))
// jack_ccb_manager->runAnimationsForSequenceNamed("move");
//
// if(c_s_dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(c_s_dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else // don't move
{
stopMove();
}
}
else // myState == jackStateDrawing
{
// main direction drawing
if(dv.dx == 0 && dv.dy == 0)
stopMove();
else if(checkPoint.isInnerMap() && (myGD->mapState[checkPoint.x][checkPoint.y] == mapOldline ||
myGD->mapState[checkPoint.x][checkPoint.y] == mapEmpty) && isDrawingOn) //
{
// path add
if(is_end_turn)
{
is_end_turn = false;
IntPointVector t_pv = IntPointVector(jp.x, jp.y, dv.dx, dv.dy);
myGD->communication("PM_addPath", t_pv);
}
// jack drawing
afterPoint = IntPoint(checkPoint.x, checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*dv.dx,t_speed*dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
//
// if(dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver))
{
if(s_dv.dx == 0 && s_dv.dy == 0)
stopMove();
else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn)
{
// path add
if(is_end_turn)
{
is_end_turn = false;
IntPointVector t_pv = IntPointVector(jp.x, jp.y, dv.dx, dv.dy);
myGD->communication("PM_addPath", t_pv);
}
// jack drawing
afterPoint = IntPoint(checkPoint.x, checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*dv.dx,t_speed*dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
//
// if(dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else
stopMove();
}
else
{
if(s_dv.dx == 0 && s_dv.dy == 0)
stopMove();
else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn &&
s_checkPoint.isInnerMap() && (myGD->mapState[s_checkPoint.x][s_checkPoint.y] == mapEmpty || myGD->mapState[s_checkPoint.x][s_checkPoint.y] == mapOldline))
{
if(is_end_turn)
{
is_end_turn = false;
IntPointVector t_pv = IntPointVector(jp.x, jp.y, s_dv.dx, s_dv.dy);
myGD->communication("PM_addPath", t_pv);
}
// jack drawing
afterPoint = IntPoint(s_checkPoint.x, s_checkPoint.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*s_dv.dx,t_speed*s_dv.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = s_dv.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
//
// if(s_dv.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(s_dv.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else if(s_dv_reverse.dx == 0 && s_dv_reverse.dy == 0)
stopMove();
else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn &&
s_checkPoint_reverse.isInnerMap() && (myGD->mapState[s_checkPoint_reverse.x][s_checkPoint_reverse.y] == mapEmpty || myGD->mapState[s_checkPoint_reverse.x][s_checkPoint_reverse.y] == mapOldline))
{
if(is_end_turn)
{
is_end_turn = false;
IntPointVector t_pv = IntPointVector(jp.x, jp.y, s_dv_reverse.dx, s_dv_reverse.dy);
myGD->communication("PM_addPath", t_pv);
}
// jack drawing
afterPoint = IntPoint(s_checkPoint_reverse.x, s_checkPoint_reverse.y);
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
}
CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*s_dv_reverse.dx,t_speed*s_dv_reverse.dy));
turnPosition = checkOutlineTurnPosition(turnPosition);
setPosition(turnPosition);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
// {
IntDirection t_direction = s_dv_reverse.getDirection();
if(t_direction == directionLeft)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_left");
}
else if(t_direction == directionRight)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_right");
}
else if(t_direction == directionUp)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_up");
}
else if(t_direction == directionDown)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
}
jack_img_direction = t_direction;
// }
// else
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
//
// if(s_dv_reverse.dx == -1 && jack_img_direction == directionRight)
// {
// jackImg->setScaleX(-1.f);
// jack_img_direction = directionLeft;
// }
// else if(s_dv_reverse.dx == 1 && jack_img_direction == directionLeft)
// {
// jackImg->setScaleX(1.f);
// jack_img_direction = directionRight;
// }
// }
}
else // don't move
{
stopMove();
}
}
}
float t_distance = sqrtf(powf(beforePosition.x-getPositionX(), 2.f) + powf(beforePosition.y-getPositionY(), 2.f));
if(t_distance >= 2.f)
{
is_end_turn = true;
check_turn_cnt++;
IntPoint beforePoint = myGD->getJackPoint();
CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
{
CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
afterPoint = IntPoint::convertToIntPoint(getPosition());
}
myGD->setJackPoint(afterPoint);
if(myGD->mapState[afterPoint.x][afterPoint.y] == mapOldline && myGD->mapState[beforePoint.x][beforePoint.y] == mapNewline) // != mapOldline
{
if(myState == jackStateDrawing)
{
setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1));
// isDrawingOn = false;
afterDirection = directionStop;
setJackState(jackStateNormal);
// new rect get !!!
myGD->communication("SW_stopAllSW");
myGD->communication("MS_ingNewlineToRealNewline");
myGD->communication("MS_scanMap");
myGD->communication("PM_cleanPath");
escapeJack();
}
}
else if(myGD->mapState[afterPoint.x][afterPoint.y] == mapEmpty)
{
if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver))
myGD->communication("PM_checkBeforeNewline", afterPoint);
myGD->mapState[afterPoint.x][afterPoint.y] = mapNewline;
// CCLOG("draw after point x : %d, y : %d", afterPoint.x, afterPoint.y);
}
else if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver) && myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline)
{
if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver))
myGD->communication("PM_checkBeforeNewline", afterPoint);
}
if(afterDirection == directionStop)
{
// CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1);
// if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f)
// {
// CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y);
// afterPoint = IntPoint::convertToIntPoint(getPosition());
// }
setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1));
// direction = afterDirection;
stopMove();
}
else
{
int check_top_line, check_bottom_line;
if(myGD->game_step == kGS_limited)
{
check_top_line = myGD->limited_step_top;
check_bottom_line = myGD->limited_step_bottom;
}
else
{
check_top_line = mapHeightInnerEnd-1;
check_bottom_line = mapHeightInnerBegin;
}
if(direction == directionLeftDown)
{
if(before_x_cnt > 0)
{
if(before_x_direction == directionLeft && afterPoint.y > check_bottom_line) before_x_direction = directionDown;
else if(before_x_direction == directionDown && afterPoint.x > mapWidthInnerBegin) before_x_direction = directionLeft;
before_x_cnt = 0;
}
else
{
if(before_x_direction != directionLeft && before_x_direction != directionDown)
{
before_x_direction = secondDirection;
before_x_cnt = 0;
}
else
before_x_cnt++;
}
}
else if(direction == directionRightDown)
{
if(before_x_cnt > 0)
{
if(before_x_direction == directionRight && afterPoint.y > check_bottom_line) before_x_direction = directionDown;
else if(before_x_direction == directionDown && afterPoint.x < mapWidthInnerEnd-1) before_x_direction = directionRight;
before_x_cnt = 0;
}
else
{
if(before_x_direction != directionRight && before_x_direction != directionDown)
{
before_x_direction = secondDirection;
before_x_cnt = 0;
}
else
before_x_cnt++;
}
}
else if(direction == directionRightUp)
{
if(before_x_cnt > 0)
{
if(before_x_direction == directionRight && afterPoint.y < check_top_line) before_x_direction = directionUp;
else if(before_x_direction == directionUp && afterPoint.x < mapWidthInnerEnd-1) before_x_direction = directionRight;
before_x_cnt = 0;
}
else
{
if(before_x_direction != directionRight && before_x_direction != directionUp)
{
before_x_direction = secondDirection;
before_x_cnt = 0;
}
else
before_x_cnt++;
}
}
else if(direction == directionLeftUp)
{
if(before_x_cnt > 0)
{
if(before_x_direction == directionLeft && afterPoint.y < check_top_line) before_x_direction = directionUp;
else if(before_x_direction == directionUp && afterPoint.x > mapWidthInnerBegin) before_x_direction = directionLeft;
before_x_cnt = 0;
}
else
{
if(before_x_direction != directionLeft && before_x_direction != directionUp)
{
before_x_direction = secondDirection;
before_x_cnt = 0;
}
else
before_x_cnt++;
}
}
if(direction != afterDirection)
{
check_turn_cnt = 0;
IntPoint a_jp = afterPoint;
setPosition(ccp((a_jp.x-1)*pixelSize+1, (a_jp.y-1)*pixelSize+1));
// CCLOG("change direction x : %d , y : %d , before : %d , after : %d", a_jp.x, a_jp.y, direction, afterDirection);
// myGD->communication("PM_lastPathRemove");
IntVector t_vector = IntVector::directionVector(afterDirection);
IntPointVector t_pv = IntPointVector(afterPoint.x, afterPoint.y, t_vector.dx, t_vector.dy);
myGD->communication("PM_checkLastAddPath", t_pv);
before_x_direction = directionStop;
before_x_cnt = 0;
direction = afterDirection;
}
}
test_speed = after_speed;
}
if(willBackTracking)
{
// direction = afterDirection = directionStop;
stopMove();
setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1));
if(myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline)
{
if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver))
{
if(myGD->getCommunicationBool("PM_checkRemoveNewline", afterPoint))
myGD->mapState[afterPoint.x][afterPoint.y] = mapEmpty;
}
else
myGD->mapState[afterPoint.x][afterPoint.y] = mapEmpty;
}
setJackState(jackStateBackTracking);
if(!btPoint.isNull())
{
myGD->setJackPoint(btPoint);
setPosition(ccp((btPoint.x-1)*pixelSize+1, (btPoint.y-1)*pixelSize+1));
}
isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton);
if(!isStun)
myGD->communication("Main_startBackTracking");
else
myGD->communication("Main_stunBackTracking");
}
if(is_double_moving)
{
moveTest();
}
}
Jack* Jack::create()
{
Jack* myJack = new Jack();
myJack->myInit();
myJack->autorelease();
return myJack;
}
void Jack::setPosition( CCPoint t_sp )
{
// float t_distance = sqrtf(powf(t_sp.x-getPositionX(), 2.f) + powf(t_sp.y-getPositionY(), 2.f));
// if(t_distance > 5.f)
// {
// CCLOG("what?!");
// }
CCNode::setPosition(t_sp);
myGD->communication("Main_moveGamePosition", t_sp);
myGD->communication("VS_setMoveGamePosition", t_sp);
}
void Jack::changeDirection( IntDirection t_d, IntDirection t_sd )
{
if(isReverse)
{
t_d = reverseDirection(t_d);
t_sd = reverseDirection(t_sd);
}
IntPoint jp = myGD->getJackPoint();
if(jp.isNull())
return;
if(myGD->mapState[jp.x-1][jp.y] != mapOldline && myGD->mapState[jp.x-1][jp.y] != mapNewline &&
myGD->mapState[jp.x+1][jp.y] != mapOldline && myGD->mapState[jp.x+1][jp.y] != mapNewline &&
myGD->mapState[jp.x][jp.y-1] != mapOldline && myGD->mapState[jp.x][jp.y-1] != mapNewline &&
myGD->mapState[jp.x][jp.y+1] != mapOldline && myGD->mapState[jp.x][jp.y+1] != mapNewline)
{
escapeJack();
}
IntDirection c_d = directionStop;
IntDirection c_sd = directionStop;
if(t_d == directionLeftDown)
{
c_d = t_sd;
if(t_sd == directionLeft) c_sd = directionDown;
else if(t_sd == directionDown) c_sd = directionLeft;
}
else if(t_d == directionRightDown)
{
c_d = t_sd;
if(t_sd == directionDown) c_sd = directionRight;
else if(t_sd == directionRight) c_sd = directionDown;
}
else if(t_d == directionRightUp)
{
c_d = t_sd;
if(t_sd == directionRight) c_sd = directionUp;
else if(t_sd == directionUp) c_sd = directionRight;
}
else if(t_d == directionLeftUp)
{
c_d = t_sd;
if(t_sd == directionLeft) c_sd = directionUp;
else if(t_sd == directionUp) c_sd = directionLeft;
}
else
{
c_d = t_d;
c_sd = t_sd;
}
if(direction == directionStop && t_d != directionStop) // move start
{
IntVector dv = IntVector::directionVector(t_d);
IntVector cv = IntVector::directionVector(c_d);
if(!isDrawingOn && myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapEmpty)
{
IntVector sdv = IntVector::directionVector(c_sd);
if(!myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline)
{
return;
}
else
{
check_turn_cnt = 0;
direction = t_d;
no_draw_direction = c_d;
afterDirection = direction;
secondDirection = t_sd;
no_draw_secondDirection = c_sd;
startMove();
return;
}
// isDrawingOn = true;
}
// else if(!isDrawingOn && myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapOldget) // if gesture
// {
// IntVector sdv = IntVector::directionVector(t_sd);
// int loop_cnt = 0;
// while(myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline && loop_cnt < 3)
// {
// loop_cnt++;
// if(myGD->mapState[jp.x+sdv.dx+dv.dx][jp.y+sdv.dy+dv.dy] == mapOldline)
// {
// check_turn_cnt = 4;
// direction = t_sd;
// afterDirection = direction;
// secondDirection = t_d;
// loop_cnt = 5;
// startMove();
// break;
// }
// else
// {
// IntVector t_sdv = IntVector::directionVector(t_sd);
// sdv.dx += t_sdv.dx;
// sdv.dy += t_sdv.dy;
// }
// }
// if(loop_cnt < 5)
// {
// sdv = IntVector::reverseDirectionVector(t_sd);
// loop_cnt = 0;
// while(myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline && loop_cnt < 3)
// {
// loop_cnt++;
// if(myGD->mapState[jp.x+sdv.dx+dv.dx][jp.y+sdv.dy+dv.dy] == mapOldline)
// {
// check_turn_cnt = 4;
// direction = IntVector::getReverseDirection(t_sd);
// afterDirection = direction;
// secondDirection = t_d;
// loop_cnt = 5;
// startMove();
// break;
// }
// else
// {
// IntVector t_sdv = IntVector::reverseDirectionVector(t_sd);
// sdv.dx += t_sdv.dx;
// sdv.dy += t_sdv.dy;
// }
// }
// }
//
// return;
// }
// else if(myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapNewline)
// {
// check_turn_cnt = 4;
// isReverseGesture = true;
// direction = t_sd;
// afterDirection = t_d;
// secondDirection = t_d;
// keep_direction = kKeepDirection_empty;
// startMove();
// return;
// }
check_turn_cnt = 0;
direction = t_d;
no_draw_direction = c_d;
afterDirection = direction;
secondDirection = t_sd;
no_draw_secondDirection = c_sd;
startMove();
}
// else if(t_d == directionStop) // move stop
// {
// afterDirection = t_d;
// secondDirection = t_sd;
// }
else // real change direction
{
IntVector dv = IntVector::directionVector(t_d);
IntVector cv = IntVector::directionVector(c_d);
if(!isDrawingOn && (myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapEmpty || myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapOldget))
{
IntVector sdv = IntVector::directionVector(c_sd);
if(!myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline)
{
if(isMoving)
stopMove();
}
else
{
check_turn_cnt = 0;
direction = t_d;
no_draw_direction = c_d;
afterDirection = direction;
secondDirection = t_sd;
no_draw_secondDirection = c_sd;
// startMove();
}
return;
}
if(t_d == direction)
{
check_turn_cnt = 0;
}
// if((t_d != directionStop && t_sd != directionStop) && myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapNewline)
// {
// isReverseGesture = true;
// reverseTurnCnt = 0;
// afterDirection = t_sd;
// secondDirection = t_d;
// }
// else
// {
// if(isReverseGesture) isReverseGesture = false;
afterDirection = t_d;
secondDirection = t_sd;
no_draw_direction = c_d;
no_draw_secondDirection = c_sd;
keep_direction = kKeepDirection_empty;
// }
}
// if()
// {
// direction = directionStop;
// afterDirection = directionStop;
// secondDirection = directionStop;
// }
}
void Jack::backTrackingAtAfterMoving( IntPoint t_p )
{
if(t_p.isNull())
return;
if(isMoving)
{
btPoint = t_p;
}
else
{
myGD->setJackPoint(t_p);
setPosition(ccp((t_p.x-1)*pixelSize+1, (t_p.y-1)*pixelSize+1));
if(myState != jackStateBackTracking)
myGD->communication("Main_startBackTracking");
setJackState(jackStateBackTracking);
}
}
void Jack::endBackTracking()
{
setJackState(jackStateNormal);
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("stop");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
afterDirection = directionStop;
secondDirection = directionStop;
keep_direction = kKeepDirection_empty;
// isReverseGesture = false;
for(int i=mapWidthInnerBegin;i<mapWidthInnerEnd;i++)
{
for(int j=mapHeightInnerBegin;j<mapHeightInnerEnd;j++)
{
if(myGD->mapState[i][j] == mapNewline)
{
if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver))
{
if(myGD->getCommunicationBool("PM_checkRemoveNewline", IntPoint(i,j)))
myGD->mapState[i][j] = mapEmpty;
}
else
myGD->mapState[i][j] = mapEmpty;
}
}
}
afterPoint = IntPoint::convertToIntPoint(getPosition());
if(myGD->mapState[afterPoint.x][afterPoint.y] != mapOldline)
{
IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
}
void Jack::changeSpeed( float t_s )
{
if(t_s > 4.f) t_s = 4.f;
else if(t_s > 2.f) t_s = 2.f;
else if(t_s < 0.8f) t_s = 0.8f;
after_speed = t_s;
if(test_speed < after_speed)
{
speed_change_img = SpeedChangeEffect::create(true);
addChild(speed_change_img, kJackZ_stunEffect);
speed_change_img->startAction();
}
else if(test_speed > after_speed)
{
speed_change_img = SpeedChangeEffect::create(false);
addChild(speed_change_img, kJackZ_stunEffect);
speed_change_img->startAction();
}
}
void Jack::createHammer()
{
if(!t_se)
{
t_se = StunHammer::create(this, callfunc_selector(Jack::stunJack));
addChild(t_se, kJackZ_stunEffect);
((StunHammer*)t_se)->startAction();
}
else
{
((StunHammer*)t_se)->showHammer();
}
}
void Jack::createFog()
{
if(!t_se)
{
t_se = IceFog::create(this, callfunc_selector(Jack::stunJack));
addChild(t_se, kJackZ_stunEffect);
((IceFog*)t_se)->startAction();
}
else
{
((IceFog*)t_se)->showFog();
}
}
void Jack::createSleep()
{
if(!t_se)
{
t_se = Sleep::create(this, callfunc_selector(Jack::stunJack));
addChild(t_se, kJackZ_stunEffect);
((Sleep*)t_se)->startAction();
}
else
{
((Sleep*)t_se)->showCircle();
}
}
void Jack::createChaos()
{
if(!t_chaos)
{
t_chaos = Chaos::create(this, callfunc_selector(Jack::reverseOn));
addChild(t_chaos, kJackZ_stunEffect);
t_chaos->startAction();
}
else
{
t_chaos->showCircle();
}
}
void Jack::reverseOn()
{
isReverse = true;
}
void Jack::reverseOff()
{
isReverse = false;
if(t_chaos)
{
t_chaos->removeFromParentAndCleanup(true);
t_chaos = NULL;
}
}
void Jack::stunJack()
{
myGD->communication("Main_touchEnd");
if(isDrawingOn)
isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton);
}
IntDirection Jack::getDirection()
{
return direction;
}
IntDirection Jack::getSecondDirection()
{
return secondDirection;
}
jackState Jack::getJackState()
{
return myState;
}
void Jack::stopMove()
{
if(getJackState() == jackStateNormal)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("stop");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
}
else if(getJackState() == jackStateDrawing)
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_stop"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("draw_stop");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
}
direction = directionStop;
afterDirection = directionStop;
secondDirection = directionStop;
before_x_direction = directionStop;
before_x_cnt = 0;
isMoving = false;
unschedule(schedule_selector(Jack::moveTest));
escapeJack();
}
void Jack::stopJack()
{
unschedule(schedule_selector(Jack::moveTest));
}
void Jack::startDieEffect( int die_type ) /* after coding */
{
// return;
if(!isDie && !myGD->getJackIsUnbeatable() && !myGD->getIsGameover())
{
myGD->communication("Main_checkHideStartMapGacha");
AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_die%d.mp3", rand()%3+1)->getCString(), false, true);
myGD->toFun();
myGD->communication("UI_writeDie");
myGD->communication("CP_onJackDie");
if(die_type == DieType::kDieType_other)
{
myLog->addLog(kLOG_die_other, myGD->getCommunication("UI_getUseTime"));
// if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupCrashArea))
// {
// myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupCrashArea, true);
// CCNode* exit_target = getParent()->getParent();
// exit_target->onExit();
//
// ASPopupView* t_popup = ASPopupView::create(-200);
//
// CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize();
// float screen_scale_x = screen_size.width/screen_size.height/1.5f;
// if(screen_scale_x < 1.f)
// screen_scale_x = 1.f;
//
// t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate));
// t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y));
// t_popup->setBasePosition(ccp(240, myDSH->ui_center_y));
//
// CCNode* t_container = CCNode::create();
// t_popup->setContainerNode(t_container);
// exit_target->getParent()->addChild(t_popup);
//
//// CCScale9Sprite* case_back = CCScale9Sprite::create("popup3_case_back.png", CCRectMake(0, 0, 150, 150), CCRectMake(13, 45, 135-13, 105-13));
//// case_back->setPosition(CCPointZero);
//// t_container->addChild(case_back);
////
//// case_back->setContentSize(CCSizeMake(348, 245));
//
// CCSprite* content_back = CCSprite::create("tutorial_popup3.png");
// content_back->setPosition(ccp(0,0));
// t_container->addChild(content_back);
//
// KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial3), mySGD->getFont().c_str(), 12.5f);
// content_label->setHorizontalAlignment(kCCTextAlignmentLeft);
// content_label->setAnchorPoint(ccp(0,0.5));
// content_label->setPosition(ccp(60,35));
// content_back->addChild(content_label);
//
//// CCSprite* title_img = CCSprite::create("tutorial_popup_title.png");
//// title_img->setPosition(ccp(0, 102));
//// t_container->addChild(title_img);
//
//// CCLabelTTF* content_label = CCLabelTTF::create("몬스터가 쏘는 미사일중에는\n획득영역을 지우는 것도 있어요.", mySGD->getFont().c_str(), 11);
//// content_label->setPosition(ccp(12,-65));
//// t_container->addChild(content_label);
//
// CCSprite* n_close = CCSprite::create("whitePaper.png");
// n_close->setOpacity(0);
// CCSprite* s_close = CCSprite::create("whitePaper.png");
// s_close->setOpacity(0);
//
// CCMenuLambda* close_menu = CCMenuLambda::create();
//
// close_menu->setTouchPriority(t_popup->getTouchPriority()-1);
// close_menu->setPosition(ccp(240, myDSH->ui_center_y));
// close_menu->setVisible(false);
// t_popup->addChild(close_menu);
//
// CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender)
// {
// close_menu->setVisible(false);
//
// t_container->addChild(KSTimer::create(0.2f, [=](){
// exit_target->onEnter();
// ((Maingame*)exit_target)->controlStunOff();
// t_popup->removeFromParent();
// }));
//
// t_container->addChild(KSGradualValue<float>::create(1.f, 1.2f, 0.05f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.2f);
// t_container->addChild(KSGradualValue<float>::create(1.2f, 0.f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(0.f);}));}));
//
// t_container->addChild(KSGradualValue<int>::create(255, 0, 0.15f, [=](int t){KS::setOpacity(t_container, t);}, [=](int t){KS::setOpacity(t_container, 0);}));
//
//
// });
//
// close_menu->addChild(close_item);
//
//
//
// t_container->setScaleY(0.f);
//
// t_container->addChild(KSGradualValue<float>::create(0.f, 1.2f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.2f);
// t_container->addChild(KSGradualValue<float>::create(1.2f, 0.8f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(0.8f);
// t_container->addChild(KSGradualValue<float>::create(0.8f, 1.f, 0.05f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.f);
// close_menu->setVisible(true);}));}));}));
//
// t_container->addChild(KSGradualValue<int>::create(0, 255, 0.25f, [=](int t){KS::setOpacity(t_container, t);}, [=](int t){KS::setOpacity(t_container, 255);}));
// }
}
else if(die_type == DieType::kDieType_missileToLine)
{
myLog->addLog(kLOG_die_missileToLine, myGD->getCommunication("UI_getUseTime"));
if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupMissileTrace))
{
myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupMissileTrace, true);
CCNode* exit_target = getParent()->getParent();
exit_target->onExit();
ASPopupView* t_popup = ASPopupView::create(-200);
CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize();
float screen_scale_x = screen_size.width/screen_size.height/1.5f;
if(screen_scale_x < 1.f)
screen_scale_x = 1.f;
t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate));
t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y));
t_popup->setBasePosition(ccp(240, myDSH->ui_center_y));
CCNode* t_container = CCNode::create();
t_popup->setContainerNode(t_container);
exit_target->getParent()->addChild(t_popup);
CCSprite* content_back = CCSprite::create("tutorial_popup1.png");
content_back->setPosition(ccp(0,0));
t_container->addChild(content_back);
KSLabelTTF* warning_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_warningDie), mySGD->getFont().c_str(), 15.f);
warning_label->disableOuterStroke();
warning_label->setPosition(ccp(52,66));
content_back->addChild(warning_label);
KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial1), mySGD->getFont().c_str(), 12.5f);
content_label->setColor(ccc3(20, 50, 70));
content_label->disableOuterStroke();
content_label->setAnchorPoint(ccp(0.5f,0.5f));
content_label->setPosition(ccp(content_back->getContentSize().width/2.f,50));
content_back->addChild(content_label);
CCSprite* n_close = CCSprite::create("whitePaper.png");
n_close->setOpacity(0);
CCSprite* s_close = CCSprite::create("whitePaper.png");
s_close->setOpacity(0);
CCMenuLambda* close_menu = CCMenuLambda::create();
close_menu->setTouchPriority(t_popup->getTouchPriority()-1);
close_menu->setPosition(ccp(240, myDSH->ui_center_y));
close_menu->setVisible(false);
t_popup->addChild(close_menu);
CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender)
{
close_menu->setVisible(false);
t_container->addChild(KSTimer::create(0.2f, [=](){
exit_target->onEnter();
((Maingame*)exit_target)->controlStunOff();
t_popup->removeFromParent();
}));
CommonAnimation::closePopup(t_popup, t_container, nullptr, [=](){
}, [=](){
// end_func(); removeFromParent();
});
});
close_menu->addChild(close_item);
CommonAnimation::openPopup(t_popup, t_container, nullptr, [=](){
}, [=](){
close_menu->setVisible(true);
});
}
}
else if(die_type == DieType::kDieType_shockwave)
{
myLog->addLog(kLOG_die_shockwave, myGD->getCommunication("UI_getUseTime"));
if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupShockWave))
{
myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupShockWave, true);
CCNode* exit_target = getParent()->getParent();
exit_target->onExit();
ASPopupView* t_popup = ASPopupView::create(-200);
CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize();
float screen_scale_x = screen_size.width/screen_size.height/1.5f;
if(screen_scale_x < 1.f)
screen_scale_x = 1.f;
t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate));
t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y));
t_popup->setBasePosition(ccp(240, myDSH->ui_center_y));
CCNode* t_container = CCNode::create();
t_popup->setContainerNode(t_container);
exit_target->getParent()->addChild(t_popup);
CCSprite* content_back = CCSprite::create("tutorial_popup2.png");
content_back->setPosition(ccp(0,0));
t_container->addChild(content_back);
KSLabelTTF* warning_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_warningDie), mySGD->getFont().c_str(), 15.f);
warning_label->disableOuterStroke();
warning_label->setPosition(ccp(52,66));
content_back->addChild(warning_label);
KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial2), mySGD->getFont().c_str(), 12.5f);
content_label->setColor(ccc3(20, 50, 70));
content_label->disableOuterStroke();
content_label->setAnchorPoint(ccp(0.5f,0.5f));
content_label->setPosition(ccp(content_back->getContentSize().width/2.f,50));
content_back->addChild(content_label);
CCSprite* n_close = CCSprite::create("whitePaper.png");
n_close->setOpacity(0);
CCSprite* s_close = CCSprite::create("whitePaper.png");
s_close->setOpacity(0);
CCMenuLambda* close_menu = CCMenuLambda::create();
close_menu->setTouchPriority(t_popup->getTouchPriority()-1);
close_menu->setPosition(ccp(240, myDSH->ui_center_y));
close_menu->setVisible(false);
t_popup->addChild(close_menu);
CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender)
{
close_menu->setVisible(false);
t_container->addChild(KSTimer::create(0.2f, [=](){
exit_target->onEnter();
((Maingame*)exit_target)->controlStunOff();
t_popup->removeFromParent();
}));
CommonAnimation::closePopup(t_container, t_container, nullptr, [=](){
}, [=](){
// end_func(); removeFromParent();
});
});
close_menu->addChild(close_item);
CommonAnimation::openPopup(t_popup, t_container, nullptr, [=](){
}, [=](){
close_menu->setVisible(true);
});
}
}
else if(die_type == DieType::kDieType_timeover)
{
}
myGD->communication("UI_endFever");
myGD->communication("UI_stopCombo");
// Well512 t_well512;
// myGD->setJackPoint(IntPoint(t_well512.GetValue(mapWidthInnerBegin, mapWidthInnerEnd),t_well512.GetValue(mapHeightInnerBegin, mapHeightInnerEnd)));
// if(getJackState() == jackStateDrawing)
// {
// jack_drawing->setVisible(false);
// }
setJackState(jackStateNormal);
// jack_barrier->setVisible(false);
isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton);
myGD->removeMapNewline();
myGD->communication("PM_cleanPath");
isStun = true;
myGD->communication("Main_startSpecialAttack");
// AudioEngine::sharedInstance()->playEffect("sound_jack_die.mp3", false);
// AudioEngine::sharedInstance()->playEffect("sound_die_jack.mp3", false);
isDie = true;
dieEffectCnt = 0;
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("die"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("die");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
// jackImg->removeFromParentAndCleanup(true);
CCNodeLoaderLibrary* nodeLoader = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
CCBReader* reader = new CCBReader(nodeLoader);
die_particle = dynamic_cast<CCSprite*>(reader->readNodeGraphFromFile("fx_cha_die1.ccbi",this));
reader->getAnimationManager()->setDelegate(this);
// jackImg = CCSprite::create("jack_die.png");
// jackImg->setScale(0.2f);
addChild(die_particle, kJackZ_main);
reader->release();
KS::setBlendFunc(die_particle, ccBlendFunc{GL_SRC_ALPHA, GL_ONE});
schedule(schedule_selector(Jack::dieEffect));
}
}
void Jack::completedAnimationSequenceNamed (char const * name)
{
string t_name = name;
if(t_name == "end_die_animation")
{
die_particle->removeFromParent();
}
}
void Jack::showMB()
{
if(!isDie)
{
MissileBarrier* t_mb = MissileBarrier::create();
// t_mb->setScale(0.8f);
addChild(t_mb, kJackZ_ActiveBarrier);
}
}
IntDirection Jack::getRecentDirection()
{
return direction;
}
void Jack::setTouchPointByJoystick( CCPoint t_p, IntDirection t_direction, bool is_touchEnd )
{
if(!joystickSpr_byJoystick)
{
joystickSpr_byJoystick = CCSprite::create("control_joystick_small_circle.png");
addChild(joystickSpr_byJoystick, kJackZ_defaultBarrier);
}
if(!touchPointSpr_byJoystick)
{
touchPointSpr_byJoystick = CCSprite::create("control_joystick_small_ball.png");
addChild(touchPointSpr_byJoystick, kJackZ_defaultBarrier);
}
if(!directionSpr_byJoystick)
{
directionSpr_byJoystick = CCSprite::create("control_joystick_arrow.png");
addChild(directionSpr_byJoystick, kJackZ_defaultBarrier);
}
if(is_touchEnd || t_direction == directionStop)
{
touchPointSpr_byJoystick->setVisible(false);
directionSpr_byJoystick->setVisible(false);
joystickSpr_byJoystick->setVisible(false);
return;
}
else
{
touchPointSpr_byJoystick->setVisible(false); // true
directionSpr_byJoystick->setVisible(false); // true
joystickSpr_byJoystick->setVisible(false); // true
}
touchPointSpr_byJoystick->setPosition(ccpMult(t_p, 0.385f));
if(t_direction == directionLeft)
{
directionSpr_byJoystick->setRotation(-90);
directionSpr_byJoystick->setPosition(ccp(-30,0));
}
else if(t_direction == directionDown)
{
directionSpr_byJoystick->setRotation(-180);
directionSpr_byJoystick->setPosition(ccp(0,-30));
}
else if(t_direction == directionRight)
{
directionSpr_byJoystick->setRotation(90);
directionSpr_byJoystick->setPosition(ccp(30,0));
}
else if(t_direction == directionUp)
{
directionSpr_byJoystick->setRotation(0);
directionSpr_byJoystick->setPosition(ccp(0,30));
}
else if(t_direction == directionStop)
{
directionSpr_byJoystick->setVisible(false);
}
}
void Jack::takeSpeedUpItem()
{
if(myGD->jack_base_speed + speed_up_value >= 2.f)
{
myGD->communication("Main_takeSpeedUpEffect", int(((2.f-1.1f) - (2.f-(myGD->jack_base_speed + speed_up_value)))/0.1f));
AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_attack%d.mp3", rand()%4+1)->getCString(), false, true);
int weapon_type = mySGD->getSelectedCharacterHistory().characterNo.getV()-1;
int weapon_level = mySGD->getSelectedCharacterHistory().level.getV();
int weapon_rank = (weapon_level-1)/5 + 1;
weapon_level = (weapon_level-1)%5 + 1;
myGD->createJackMissileWithStoneFunctor((StoneType)weapon_type, weapon_rank, weapon_level, 1, getPosition(), mySGD->getSelectedCharacterHistory().power.getV());
// string missile_code;
// missile_code = NSDS_GS(kSDS_CI_int1_missile_type_s, myDSH->getIntegerForKey(kDSH_Key_selectedCard));
// int missile_type = MissileDamageData::getMissileType(missile_code.c_str());
//
// // myGD->communication("Main_goldGettingEffect", jackPosition, int((t_p - t_beforePercentage)/JM_CONDITION*myDSH->getGoldGetRate()));
// float missile_speed = NSDS_GD(kSDS_CI_int1_missile_speed_d, myDSH->getIntegerForKey(kDSH_Key_selectedCard));
//
// myGD->communication("MP_createJackMissile", missile_type, 1, missile_speed, getPosition());
}
else
{
speed_up_value += 0.1f;
changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
myGD->communication("Main_takeSpeedUpEffect", int(((2.f-1.1f) - (2.f-(myGD->jack_base_speed + speed_up_value)))/0.1f));
}
}
float Jack::getSpeedUpValue()
{
return speed_up_value;
}
float Jack::getAlphaSpeed()
{
return alpha_speed_value;
}
void Jack::setAlphaSpeed( float t_s )
{
alpha_speed_value = t_s;
changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
}
void Jack::initStartPosition( CCPoint t_p )
{
int base_value = roundf(-t_p.y/((480.f-myGD->boarder_value*2)/(320.f))/2.f); // 중간 괄호 : myGD->game_scale
CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize();
float screen_height = roundf(480*screen_size.height/screen_size.width/2.f);
IntPoint checking_point = IntPoint(80,base_value+roundf(screen_height/((480.f-myGD->boarder_value*2)/(320.f))/2.f)); // 중간 괄호 : myGD->game_scale
int map_end_check_cnt = 0;
bool is_found = false;
for(int i=0;!is_found && map_end_check_cnt < 2;i++)
{
if(i%2 == 0)
checking_point.x -= i;
else
checking_point.x += i;
if(!checking_point.isInnerMap())
{
map_end_check_cnt++;
continue;
}
if(myGD->mapState[checking_point.x][checking_point.y] == mapOldline)
{
is_found = true;
myGD->setJackPoint(checking_point);
afterPoint = checking_point;
CCNode::setPosition(checking_point.convertToCCP());
break;
}
}
if(!is_found)
{
CCLOG("faskdhfn;asjbfv;kjqdhbf;kvuhqasdk;cn");
}
}
void Jack::setJackState( jackState t_s )
{
bool is_changed = t_s != myState;
myState = t_s;
myGD->setJackState(myState);
if(myState == jackStateNormal)
{
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2)
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move"))
// jack_ccb_manager->runAnimationsForSequenceNamed("move");
// }
// else
// {
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("move_down");
// }
// jackImg->setColor(ccWHITE);
// jackImg->setVisible(true);
// line_edge->setVisible(false);
myGD->communication("Main_setLineParticle", false);
// if(!is_hard && !jack_barrier->isVisible())
// jack_barrier->setVisible(true);
if(is_changed)
myGD->communication("GIM_removeBeautyStone");
}
else if(myState == jackStateDrawing)
{
// line_edge->setVisible(true);
myGD->communication("Main_setLineParticle", true);
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2)
// {
// if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw"))
// jack_ccb_manager->runAnimationsForSequenceNamed("draw");
// }
// else
// {
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down"))
jack_ccb_manager->runAnimationsForSequenceNamed("draw_down");
// }
// jackImg->setVisible(false);
// if(!is_hard && jack_barrier->isVisible())
// jack_barrier->setVisible(false);
if(is_changed)
myGD->communication("GIM_showBeautyStone");
}
else if(myState == jackStateBackTracking)
{
// line_edge->setVisible(false);
myGD->communication("Main_setLineParticle", false);
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("rewind"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("rewind");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
// jackImg->setColor(ccGRAY);
// if(!is_hard && jack_barrier->isVisible())
// jack_barrier->setVisible(false);
if(is_changed)
myGD->communication("GIM_removeBeautyStone");
}
}
IntDirection Jack::reverseDirection( IntDirection t_d )
{
IntDirection returnDirection;
if(t_d == directionLeftUp) returnDirection = directionRightDown;
else if(t_d == directionLeft) returnDirection = directionRight;
else if(t_d == directionLeftDown) returnDirection = directionRightUp;
else if(t_d == directionDown) returnDirection = directionUp;
else if(t_d == directionRightDown) returnDirection = directionLeftUp;
else if(t_d == directionRight) returnDirection = directionLeft;
else if(t_d == directionRightUp) returnDirection = directionLeftDown;
else if(t_d == directionUp) returnDirection = directionDown;
else returnDirection = directionStop;
return returnDirection;
}
void Jack::dieEffect()
{
dieEffectCnt++;
if(dieEffectCnt < 30)
{
// jackImg->setScale(0.2f + dieEffectCnt*0.02f);
// jackImg->setOpacity(255-dieEffectCnt*5);
}
else if(dieEffectCnt == 30)
{
unschedule(schedule_selector(Jack::dieEffect));
dieEscapeJack();
if(myGD->getIsGameover())
{
jackImg->setVisible(false);
endGame();
}
else
{
if(myDSH->getIntegerForKey(kDSH_Key_tutorial_flowStep) == kTutorialFlowStep_ingame)
{
myGD->communication("UI_addGameTime30Sec");
speed_up_value = 0.f;
changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
startReviveAnimation(jackImg);
}
else if(myGD->getCommunicationBool("UI_beRevivedJack"))
{
speed_up_value = 0.f;
changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
// jackImg->removeFromParentAndCleanup(true);
//
// CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png");
//
// jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jackImg->setScale(0.8f);
// addChild(jackImg, kJackZ_main);
startReviveAnimation(jackImg);
}
else
{
if(mySGD->is_endless_mode || continue_on_count < 2)
{
continue_on_count++;
myGD->communication("UI_showContinuePopup", this, callfunc_selector(Jack::endGame), this, callfunc_selector(Jack::continueGame));
}
else
{
jackImg->setVisible(false);
endGame();
}
}
}
}
// else if(dieEffectCnt > 80)
// {
// unschedule(schedule_selector(Jack::dieEffect));
//
// if(myGD->getCommunicationBool("UI_beRevivedJack"))
// {
// speed_up_value = 0.f;
// changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
//
// isDie = false;
// isStun = false;
//
// dieEscapeJack();
//
// if(myGD->getIsGameover())
// endGame();
// else
// {
// jackImg->removeFromParentAndCleanup(true);
//
// CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png");
//
// jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jackImg->setScale(0.8f);
// addChild(jackImg, kJackZ_main);
//
// CCAnimation* jack_animation = CCAnimation::create();
// jack_animation->setDelayPerUnit(0.1f);
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23));
//
// CCAnimate* jack_animate = CCAnimate::create(jack_animation);
// CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate);
// jackImg->runAction(jack_repeat);
//
// setTouchPointByJoystick(CCPointZero, directionStop, true);
// setJackState(jackStateNormal);
//
// myGD->communication("GIM_dieCreateItem");
// myGD->communication("Main_resetIsLineDie");
// myGD->communication("Main_stopSpecialAttack");
// }
// }
// else
// {
// myGD->communication("UI_showContinuePopup", this, callfunc_selector(Jack::endGame), this, callfunc_selector(Jack::continueGame));
// }
// }
}
void Jack::endReviveJack()
{
isDie = false;
isStun = false;
myGD->communication("Main_stopBackingCheck");
// CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png");
//
// CCAnimation* jack_animation = CCAnimation::create();
// jack_animation->setDelayPerUnit(0.1f);
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23));
//
// CCAnimate* jack_animate = CCAnimate::create(jack_animation);
// CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate);
// jackImg->runAction(jack_repeat);
if(myGD->mapState[afterPoint.x][afterPoint.y] != mapOldline)
{
IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
setTouchPointByJoystick(CCPointZero, directionStop, true);
setJackState(jackStateNormal);
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("stop");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
// jack_barrier->setVisible(true);
myGD->communication("UI_resumeCounting");
myGD->communication("GIM_dieCreateItem");
myGD->communication("Main_resetIsLineDie");
myGD->communication("Main_stopSpecialAttack");
myGD->communication("CP_onJackRevived");
}
void Jack::continueGame()
{
speed_up_value = 0.f;
changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value);
// jackImg->removeFromParentAndCleanup(true);
//
// CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png");
//
// jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jackImg->setScale(0.8f);
// addChild(jackImg, kJackZ_main);
startReviveAnimation(jackImg);
}
void Jack::endGame()
{
int i = kAchievementCode_hidden_dieEasy;
if(!myAchieve->isCompleted(AchievementCode(i)) && !myAchieve->isAchieve(AchievementCode(i)))
{
if(!myAchieve->isNoti(AchievementCode(i)) && !myAchieve->isCompleted(AchievementCode(i)) &&
myGD->getCommunication("UI_getUseTime") <= myAchieve->getCondition(AchievementCode(i)))
{
myAchieve->changeIngCount(AchievementCode(i), myAchieve->getCondition(AchievementCode(i)));
AchieveNoti* t_noti = AchieveNoti::create(AchievementCode(i));
CCDirector::sharedDirector()->getRunningScene()->addChild(t_noti);
}
}
mySGD->fail_code = kFC_gameover;
myGD->setIsGameover(true);
myGD->communication("Main_allStopSchedule");
myGD->communication("Main_gameover");
}
void Jack::escapeJack()
{
if(afterPoint.isInnerMap())
{
if(myGD->mapState[afterPoint.x-1][afterPoint.y] == mapOldget &&
myGD->mapState[afterPoint.x+1][afterPoint.y] == mapOldget &&
myGD->mapState[afterPoint.x][afterPoint.y-1] == mapOldget &&
myGD->mapState[afterPoint.x][afterPoint.y+1] == mapOldget)
{
IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
bool is_go_inner = (myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline ||
myGD->mapState[afterPoint.x-1][afterPoint.y] == mapNewline ||
myGD->mapState[afterPoint.x+1][afterPoint.y] == mapNewline ||
myGD->mapState[afterPoint.x][afterPoint.y-1] == mapNewline ||
myGD->mapState[afterPoint.x][afterPoint.y+1] == mapNewline);
for(int x = mapWidthInnerBegin+1;x < mapWidthInnerEnd-1 && !is_go_inner;x++)
{
if(!(myGD->mapState[x][mapHeightInnerBegin] == mapOldline && myGD->mapState[x][mapHeightInnerBegin+1] == mapOldget))
is_go_inner = true;
if(!(myGD->mapState[x][mapHeightInnerEnd-1] == mapOldline && myGD->mapState[x][mapHeightInnerEnd-1-1] == mapOldget))
is_go_inner = true;
}
for(int y = mapHeightInnerBegin+1;y < mapHeightInnerEnd-1 && !is_go_inner;y++)
{
if(!(myGD->mapState[mapWidthInnerBegin][y] == mapOldline && myGD->mapState[mapWidthInnerBegin+1][y] == mapOldget))
is_go_inner = true;
if(!(myGD->mapState[mapWidthInnerEnd-1][y] == mapOldline && myGD->mapState[mapWidthInnerEnd-1-1][y] == mapOldget))
is_go_inner = true;
}
if(!is_go_inner)
{
IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
}
}
void Jack::dieEscapeJack()
{
IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
void Jack::startMove()
{
is_end_turn = true;
isMoving = true;
moveValue = 0;
move_loop_cnt = 0;
moveTest();
schedule(schedule_selector(Jack::moveTest));
}
void Jack::resetStopEffects()
{
t_se = NULL;
// t_chaos = NULL;
}
void Jack::positionRefresh()
{
setPosition(getPosition());
}
bool Jack::isDieJack()
{
return isDie;
}
CCNode* Jack::getJack()
{
return this;
}
void Jack::myInit()
{
continue_on_count = 0;
before_x_direction = directionStop;
before_x_cnt = 0;
keep_direction = kKeepDirection_empty;
isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton);
// isReverseGesture = false;
isReverse = false;
t_se = NULL;
t_chaos = NULL;
isStun = false;
isDie = false;
is_double_moving = false;
myGD->V_F["Jack_changeSpeed"] = std::bind(&Jack::changeSpeed, this, _1);
myGD->V_I["Jack_startDieEffect"] = std::bind(&Jack::startDieEffect, this, _1);
myGD->V_V["Jack_createHammer"] = std::bind(&Jack::createHammer, this);
myGD->V_V["Jack_createFog"] = std::bind(&Jack::createFog, this);
myGD->V_V["Jack_createSleep"] = std::bind(&Jack::createSleep, this);
myGD->V_V["Jack_createChaos"] = std::bind(&Jack::createChaos, this);
myGD->V_V["Jack_reverseOff"] = std::bind(&Jack::reverseOff, this);
myGD->V_V["Jack_resetStopEffects"] = std::bind(&Jack::resetStopEffects, this);
myGD->V_V["Jack_showMB"] = std::bind(&Jack::showMB, this);
myGD->V_V["Jack_takeSpeedUpItem"] = std::bind(&Jack::takeSpeedUpItem, this);
myGD->F_V["Jack_getAlphaSpeed"] = std::bind(&Jack::getAlphaSpeed, this);
myGD->V_F["Jack_setAlphaSpeed"] = std::bind(&Jack::setAlphaSpeed, this, _1);
myGD->F_V["Jack_getSpeedUpValue"] = std::bind(&Jack::getSpeedUpValue, this);
myGD->V_V["Jack_positionRefresh"] = std::bind(&Jack::positionRefresh, this);
myGD->B_V["Jack_isDie"] = std::bind(&Jack::isDieJack, this);
myGD->CCN_V["Jack_getJack"] = std::bind(&Jack::getJack, this);
isMoving = false;
willBackTracking = false;
btPoint = IntPoint();
direction = directionStop;
afterDirection = directionStop;
//////////////////////////////////////////////////////////// move test ////////////////////////////////
speed_up_value = 0.f;
alpha_speed_value = 0.f;
test_speed = myGD->jack_base_speed + speed_up_value + alpha_speed_value;
after_speed = test_speed;
//////////////////////////////////////////////////////////// move test ////////////////////////////////
myState = jackStateNormal;
afterState = jackStateNormal;
string path_color;
int path_color_code = NSDS_GI(kSDS_GI_characterInfo_int1_statInfo_lineColor_i, mySGD->getSelectedCharacterHistory().characterNo.getV());
if(path_color_code == 1)
path_color = "life";
else if(path_color_code == 2)
path_color = "fire";
else if(path_color_code == 3)
path_color = "water";
else if(path_color_code == 4)
path_color = "wind";
else if(path_color_code == 5)
path_color = "lightning";
else if(path_color_code == 6)
path_color = "plasma";
else
path_color = "empty";
// line_edge = CCSprite::create("jack_drawing_point.png");//("path_edge_" + path_color + ".png").c_str());
// line_edge->setVisible(false);
// line_edge->setScale(0.5f);
// addChild(line_edge, kJackZ_line);
auto t_pair = KS::loadCCBIForFullPath<CCSprite*>(this, StageImgLoader::sharedInstance()->getDocumentPath() + NSDS_GS(kSDS_GI_characterInfo_int1_resourceInfo_ccbiID_s, mySGD->getSelectedCharacterHistory().characterNo.getV()) + ".ccbi");
jackImg = t_pair.first;
jack_ccb_manager = t_pair.second;
// CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png");
//
// jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jackImg->setScale(0.8f);
addChild(jackImg, kJackZ_main);
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("stop");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
}
jack_img_direction = directionStop;
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2)
// jack_img_direction = directionRight;
startShowJackAnimation(jackImg);
// CCAnimation* jack_animation = CCAnimation::create();
// jack_animation->setDelayPerUnit(0.1f);
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23));
// jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23));
//
// CCAnimate* jack_animate = CCAnimate::create(jack_animation);
// CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate);
// jackImg->runAction(jack_repeat);
is_hard = false;
// CCSprite* t_texture = CCSprite::create("jack_barrier.png");
//
// jack_barrier = CCSprite::createWithTexture(t_texture->getTexture(), CCRectMake(100, 0, 25, 25));
// jack_barrier->setScale(0.8f);
// addChild(jack_barrier, kJackZ_defaultBarrier);
// jack_barrier->setOpacity(0);
//
// CCAnimation* t_animation = CCAnimation::create();
// t_animation->setDelayPerUnit(0.1);
// for(int i=0;i<5;i++)
// t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(i*25, 0, 25, 25));
// CCAnimate* t_animate = CCAnimate::create(t_animation);
// CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate);
//
// jack_barrier->runAction(t_repeat);
setScale(1/myGD->game_scale);//NSDS_GD(mySD->getSilType(), kSDS_SI_scale_d)
}
void Jack::setStartPosition()
{
IntMoveState searchFirstMoveState = IntMoveState(160/2, 215/2, directionStop);
searchAndMoveOldline(searchFirstMoveState);
}
void Jack::keepDirectionAction( IntPoint jp, IntDirection t_d )
{
IntVector left_vector = IntVector::directionVector(IntVector::getLeftDirection(t_d));
IntVector right_vector = IntVector::directionVector(IntVector::getRightDirection(t_d));
IntPoint left_point = IntPoint(jp.x+left_vector.dx, jp.y+left_vector.dy);
IntPoint right_point = IntPoint(jp.x+right_vector.dx, jp.y+right_vector.dy);
if(left_point.isInnerMap() && right_point.isInnerMap() &&
(((myGD->mapState[left_point.x][left_point.y] == mapOldget || myGD->mapState[left_point.x][left_point.y] == mapOldline) &&
(myGD->mapState[right_point.x][right_point.y] == mapOldget || myGD->mapState[right_point.x][right_point.y] == mapOldline)) ||
(myGD->mapState[left_point.x][left_point.y] == mapEmpty && myGD->mapState[right_point.x][right_point.y] == mapEmpty)))
{
}
else
{
if(left_point.isInnerMap() && (myGD->mapState[left_point.x][left_point.y] == mapOldget || myGD->mapState[left_point.x][left_point.y] == mapOldline))
keep_direction = kKeepDirection_left;
else if(right_point.isInnerMap() && (myGD->mapState[right_point.x][right_point.y] == mapOldget || myGD->mapState[right_point.x][right_point.y] == mapOldline))
keep_direction = kKeepDirection_right;
}
}
bool Jack::rotarySelection( IntPoint jp, IntDirection t_d )
{
// if(myGD->mapState[jp.x][jp.y] != mapOldline)
// return false;
IntVector left_vector = IntVector::directionVector(IntVector::getLeftDirection(t_d));
IntVector right_vector = IntVector::directionVector(IntVector::getRightDirection(t_d));
IntVector direct_vector = IntVector::directionVector(t_d);
IntPoint left_point = IntPoint(jp.x+left_vector.dx, jp.y+left_vector.dy);
IntPoint right_point = IntPoint(jp.x+right_vector.dx, jp.y+right_vector.dy);
IntPoint direct_point = IntPoint(jp.x+direct_vector.dx, jp.y+direct_vector.dy);
IntPoint return_point = IntPoint(jp.x-direct_vector.dx, jp.y-direct_vector.dy);
int rotary_cnt = 0;
bool is_left = false;
bool is_right = false;
bool is_direct = false;
int oldget_cnt = 0;
if(left_point.isInnerMap() && myGD->mapState[left_point.x][left_point.y] == mapOldline)
{
is_left = true;
rotary_cnt++;
}
else if(left_point.isInnerMap() && myGD->mapState[left_point.x][left_point.y] == mapOldget)
{
oldget_cnt++;
}
if(right_point.isInnerMap() && myGD->mapState[right_point.x][right_point.y] == mapOldline)
{
is_right = true;
rotary_cnt++;
}
else if(right_point.isInnerMap() && myGD->mapState[right_point.x][right_point.y] == mapOldget)
{
oldget_cnt++;
}
if(direct_point.isInnerMap() && myGD->mapState[direct_point.x][direct_point.y] == mapOldline)
{
is_direct = true;
rotary_cnt++;
}
else if(direct_point.isInnerMap() && myGD->mapState[direct_point.x][direct_point.y] == mapOldget)
{
oldget_cnt++;
}
if(return_point.isInnerMap() && myGD->mapState[return_point.x][return_point.y] == mapOldget)
{
oldget_cnt++;
}
if(rotary_cnt >= 2 && oldget_cnt >= 2)
{
return false;
}
if(rotary_cnt >= 2 && keep_direction != kKeepDirection_empty)
{
if(keep_direction == kKeepDirection_left && is_right)
{
check_turn_cnt = 4;
direction = IntVector::getRightDirection(t_d);
afterDirection = direction;
}
else if(keep_direction == kKeepDirection_right && is_left)
{
check_turn_cnt = 4;
direction = IntVector::getLeftDirection(t_d);
afterDirection = direction;
}
else return false;
return true;
}
else
return false;
}
CCPoint Jack::checkOutlineTurnPosition( CCPoint turnPosition )
{
if(turnPosition.x < (mapWidthInnerBegin-1)*pixelSize+1) turnPosition.x = (mapWidthInnerBegin-1)*pixelSize+1;
if(turnPosition.x > (mapWidthInnerEnd-1-1)*pixelSize+1) turnPosition.x = (mapWidthInnerEnd-1-1)*pixelSize+1;
if(myGD->game_step == kGS_limited)
{
if(turnPosition.y < (myGD->limited_step_bottom-1)*pixelSize+1) turnPosition.y = (myGD->limited_step_bottom-1)*pixelSize+1;
if(turnPosition.y > (myGD->limited_step_top-1)*pixelSize+1) turnPosition.y = (myGD->limited_step_top-1)*pixelSize+1;
}
else
{
if(turnPosition.y < (mapHeightInnerBegin-1)*pixelSize+1) turnPosition.y = (mapHeightInnerBegin-1)*pixelSize+1;
if(turnPosition.y > (mapHeightInnerEnd-1-1)*pixelSize+1) turnPosition.y = (mapHeightInnerEnd-1-1)*pixelSize+1;
}
return turnPosition;
}
void Jack::startReviveAnimation( CCSprite* t_jack_img )
{
AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_resurrection%d.mp3", rand()%2+1)->getCString(), false, true);
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("born"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("born");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
// t_jack_img->setOpacity(0);
// t_jack_img->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.8f), CCFadeTo::create(0.5f, 255)));
CCNode* animation_node = CCNode::create();
animation_node->setPosition(ccp(t_jack_img->getContentSize().width/2.f, t_jack_img->getContentSize().height/2.f));
t_jack_img->addChild(animation_node);
startInnerParticle(animation_node);
CCDelayTime* delay1 = CCDelayTime::create(0.1f);
CCCallFuncO* call1 = CCCallFuncO::create(this, callfuncO_selector(Jack::startLightSprite), animation_node);
CCDelayTime* delay2 = CCDelayTime::create(0.2f);
CCCallFuncO* call2 = CCCallFuncO::create(this, callfuncO_selector(Jack::startOutterParticle), animation_node);
CCDelayTime* delay3 = CCDelayTime::create(0.5f);
CCCallFunc* call3 = CCCallFunc::create(this, callfunc_selector(Jack::endReviveJack));
CCCallFunc* call4 = CCCallFunc::create(animation_node, callfunc_selector(CCNode::removeFromParent));
CCSequence* t_seq = CCSequence::create(delay1, call1, delay2, call2, delay3, call3, call4, NULL);
animation_node->runAction(t_seq);
}
void Jack::startShowJackAnimation( CCSprite* t_jack_img )
{
if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("born"))
{
jack_ccb_manager->runAnimationsForSequenceNamed("born");
// if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2)
jack_img_direction = directionStop;
}
// t_jack_img->setOpacity(0);
// t_jack_img->runAction(CCFadeTo::create(1.3f, 255));
CCNode* animation_node = CCNode::create();
animation_node->setPosition(ccp(t_jack_img->getContentSize().width/2.f, t_jack_img->getContentSize().height/2.f));
t_jack_img->addChild(animation_node);
startInnerParticle(animation_node);
CCDelayTime* delay1 = CCDelayTime::create(0.2f);
CCCallFuncO* call1 = CCCallFuncO::create(this, callfuncO_selector(Jack::startLightSprite), animation_node);
CCDelayTime* delay2 = CCDelayTime::create(0.4f);
CCCallFuncO* call2 = CCCallFuncO::create(this, callfuncO_selector(Jack::startOutterParticle), animation_node);
CCDelayTime* delay3 = CCDelayTime::create(1.f);
CCCallFunc* call4 = CCCallFunc::create(animation_node, callfunc_selector(CCNode::removeFromParent));
CCSequence* t_seq = CCSequence::create(delay1, call1, delay2, call2, delay3, call4, NULL);
animation_node->runAction(t_seq);
}
void Jack::startInnerParticle( CCNode* target_node )
{
CCParticleSystemQuad* inner_particle = CCParticleSystemQuad::createWithTotalParticles(100);
inner_particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("particle2.png"));
inner_particle->setEmissionRate(166.67f);
inner_particle->setAngle(90.f);
inner_particle->setAngleVar(360.f);
ccBlendFunc inner_blend_func = {GL_SRC_ALPHA, GL_ONE};
inner_particle->setBlendFunc(inner_blend_func);
inner_particle->setDuration(0.5f);
inner_particle->setEmitterMode(kCCParticleModeRadius);
inner_particle->setStartColor(ccc4f(1.f, 1.f, 0.55f, 1.f));
inner_particle->setStartColorVar(ccc4f(0.f, 0.28f, 0.57f, 1.f));
inner_particle->setEndColor(ccc4f(0.f, 0.f, 0.f, 1.f));
inner_particle->setEndColorVar(ccc4f(0.f, 0.f, 0.f, 0.f));
inner_particle->setStartSize(15.f);
inner_particle->setStartSizeVar(7.f);
inner_particle->setEndSize(10.f);
inner_particle->setEndSizeVar(5.f);
inner_particle->setRotatePerSecond(0.f);
inner_particle->setRotatePerSecondVar(0.f);
inner_particle->setStartRadius(80.f);
inner_particle->setStartRadiusVar(40.f);
inner_particle->setEndRadius(15.f);
inner_particle->setTotalParticles(100);
inner_particle->setLife(0.6f);
inner_particle->setLifeVar(0.3f);
inner_particle->setStartSpin(0.f);
inner_particle->setStartSpinVar(0.f);
inner_particle->setEndSpin(0.f);
inner_particle->setEndSpinVar(0.f);
inner_particle->setPosition(ccp(0,0));
inner_particle->setPosVar(CCPointZero);
inner_particle->setAutoRemoveOnFinish(true);
target_node->addChild(inner_particle);
}
void Jack::startLightSprite( CCNode* target_node )
{
CCNodeLoaderLibrary* nodeLoader = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
CCBReader* reader = new CCBReader(nodeLoader);
CCSprite* lighter = dynamic_cast<CCSprite*>(reader->readNodeGraphFromFile("fx_cha_new.ccbi",this));
lighter->setPosition(ccp(0,0));
target_node->addChild(lighter);
reader->release();
KS::setBlendFunc(lighter, ccBlendFunc{GL_SRC_ALPHA, GL_ONE});
}
void Jack::startOutterParticle( CCNode* target_node )
{
CCParticleSystemQuad* outter_particle = CCParticleSystemQuad::createWithTotalParticles(100);
outter_particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("particle2.png"));
outter_particle->setEmissionRate(166.67f);
outter_particle->setAngle(90.f);
outter_particle->setAngleVar(90.f);
ccBlendFunc outter_blend_func = {GL_SRC_ALPHA, GL_ONE};
outter_particle->setBlendFunc(outter_blend_func);
outter_particle->setDuration(0.4f);
outter_particle->setEmitterMode(kCCParticleModeGravity);
outter_particle->setStartColor(ccc4f(1.f, 1.f, 0.55f, 1.f));
outter_particle->setStartColorVar(ccc4f(0.f, 0.28f, 0.57f, 1.f));
outter_particle->setEndColor(ccc4f(0.f, 0.f, 0.f, 1.f));
outter_particle->setEndColorVar(ccc4f(0.f, 0.f, 0.f, 0.f));
outter_particle->setStartSize(10.f);
outter_particle->setStartSizeVar(5.f);
outter_particle->setEndSize(10.f);
outter_particle->setEndSizeVar(5.f);
outter_particle->setGravity(ccp(0.f,300.f));
outter_particle->setRadialAccel(0.f);
outter_particle->setRadialAccelVar(0.f);
outter_particle->setSpeed(100.f);
outter_particle->setSpeedVar(40.f);
outter_particle->setTangentialAccel(0.f);
outter_particle->setTangentialAccelVar(0.f);
outter_particle->setTotalParticles(100);
outter_particle->setLife(0.4f);
outter_particle->setLifeVar(0.5f);
outter_particle->setStartSpin(0.f);
outter_particle->setStartSpinVar(0.f);
outter_particle->setEndSpin(0.f);
outter_particle->setEndSpinVar(0.f);
outter_particle->setPosition(ccp(0,0));
outter_particle->setPosVar(ccp(40.f,40.f));
outter_particle->setAutoRemoveOnFinish(true);
target_node->addChild(outter_particle);
}
StunHammer* StunHammer::create( CCObject* t_jack, SEL_CallFunc d_stun )
{
StunHammer* t_sh = new StunHammer();
t_sh->myInit(t_jack, d_stun);
t_sh->autorelease();
return t_sh;
}
void StunHammer::startAction()
{
CCAnimation* t_animation = CCAnimation::create();
t_animation->setDelayPerUnit(0.1);
t_animation->addSpriteFrameWithFileName("stun_hammer1.png");
t_animation->addSpriteFrameWithFileName("stun_hammer1.png");
t_animation->addSpriteFrameWithFileName("stun_hammer2.png");
CCAnimate* t_animate = CCAnimate::create(t_animation);
CCRotateBy* t_rotate = CCRotateBy::create(0.3, -90);
CCSpawn* t_spawn = CCSpawn::createWithTwoActions(t_animate, t_rotate);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(StunHammer::afterAction));
CCSequence* t_seq = CCSequence::createWithTwoActions(t_spawn, t_call);
hammerImg->runAction(t_seq);
}
void StunHammer::showHammer()
{
CCSprite* t_hammer = CCSprite::create("stun_hammer1.png");
t_hammer->setAnchorPoint(ccp(1.0,0.5));
t_hammer->setRotation(90);
t_hammer->setPosition(ccp(34,20));
addChild(t_hammer);
CCAnimation* t_animation = CCAnimation::create();
t_animation->setDelayPerUnit(0.1);
t_animation->addSpriteFrameWithFileName("stun_hammer1.png");
t_animation->addSpriteFrameWithFileName("stun_hammer1.png");
t_animation->addSpriteFrameWithFileName("stun_hammer2.png");
CCAnimate* t_animate = CCAnimate::create(t_animation);
CCRotateBy* t_rotate = CCRotateBy::create(0.3, -90);
CCSpawn* t_spawn = CCSpawn::createWithTwoActions(t_animate, t_rotate);
CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(StunHammer::deleteTempHammer), t_hammer);
CCSequence* t_seq = CCSequence::createWithTwoActions(t_spawn, t_call);
t_hammer->runAction(t_seq);
}
void StunHammer::selfRemove()
{
myGD->communication("Jack_resetStopEffects");
myGD->communication("Main_touchOn");
removeFromParentAndCleanup(true);
}
void StunHammer::deleteTempHammer( CCObject* t_hammer )
{
((CCNode*)t_hammer)->removeFromParentAndCleanup(true);
}
void StunHammer::afterAction()
{
hammerImg->removeFromParentAndCleanup(true);
AudioEngine::sharedInstance()->playEffect("sound_stun_hit.mp3",false);
(target_jack->*delegate_stun)();
starImg = CCSprite::create("stun_star.png", CCRectMake(0, 0, 20, 13));
starImg->setPosition(ccp(0,12));
CCSprite* t_texture = CCSprite::create("stun_star.png");
CCAnimation* t_animation = CCAnimation::create();
t_animation->setDelayPerUnit(0.1);
for(int i=0;i<3;i++)
{
t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(0, i*13, 20, 13));
}
CCAnimate* t_animate = CCAnimate::create(t_animation);
CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate);
addChild(starImg);
starImg->runAction(t_repeat);
}
void StunHammer::myInit( CCObject* t_jack, SEL_CallFunc d_stun )
{
target_jack = t_jack;
delegate_stun = d_stun;
hammerImg = CCSprite::create("stun_hammer1.png");
hammerImg->setAnchorPoint(ccp(1.0,0.5));
hammerImg->setRotation(90);
hammerImg->setPosition(ccp(34,20));
addChild(hammerImg);
}
IceFog* IceFog::create( CCObject* t_jack, SEL_CallFunc d_freeze )
{
IceFog* t_if = new IceFog();
t_if->myInit(t_jack, d_freeze);
t_if->autorelease();
return t_if;
}
void IceFog::startAction()
{
CCDelayTime* t_delay = CCDelayTime::create(0.2f);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(IceFog::afterAction));
CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call);
runAction(t_seq);
}
void IceFog::showFog()
{
fogImg->removeFromParent();
stopAllActions();
fogImg = KS::loadCCBI<CCSprite*>(this, "fx_freezing_1.ccbi").first;
KS::setBlendFunc(fogImg, ccBlendFunc{GL_SRC_ALPHA, GL_ONE});
addChild(fogImg);
}
void IceFog::selfRemove()
{
myGD->communication("Jack_resetStopEffects");
myGD->communication("Main_touchOn");
fog_manager->runAnimationsForSequenceNamed("stop");
CCDelayTime* t_delay = CCDelayTime::create(0.3f);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(CCNode::removeFromParent));
CCSequence* t_seq = CCSequence::create(t_delay, t_call, NULL);
runAction(t_seq);
// removeFromParentAndCleanup(true);
}
void IceFog::deleteFog()
{
// fogImg->removeFromParentAndCleanup(true);
}
void IceFog::afterAction()
{
AudioEngine::sharedInstance()->playEffect("sound_ice_hold.mp3", false);
(target_jack->*delegate_freeze)();
// fogImg->removeFromParentAndCleanup(true);
// iceImg = CCSprite::create("ice.png");
// addChild(iceImg);
}
void IceFog::myInit( CCObject* t_jack, SEL_CallFunc d_freeze )
{
target_jack = t_jack;
delegate_freeze = d_freeze;
auto t_ccb = KS::loadCCBI<CCSprite*>(this, "fx_freezing_1.ccbi");
fogImg = t_ccb.first;
KS::setBlendFunc(fogImg, ccBlendFunc{GL_SRC_ALPHA, GL_ONE});
addChild(fogImg);
fog_manager = t_ccb.second;
}
Sleep* Sleep::create( CCObject* t_jack, SEL_CallFunc d_sleep )
{
Sleep* t_s = new Sleep();
t_s->myInit(t_jack, d_sleep);
t_s->autorelease();
return t_s;
}
void Sleep::startAction()
{
CCDelayTime* t_delay = CCDelayTime::create(1.0);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(Sleep::afterAction));
CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call);
runAction(t_seq);
}
void Sleep::showCircle()
{
CircleCreater* t_cc = CircleCreater::create(ccYELLOW, 12);
addChild(t_cc);
CCDelayTime* t_delay = CCDelayTime::create(1.0);
CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(Sleep::deleteCircle), t_cc);
CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call);
runAction(t_seq);
}
void Sleep::selfRemove()
{
myGD->communication("Jack_resetStopEffects");
myGD->communication("Main_touchOn");
removeFromParentAndCleanup(true);
}
void Sleep::deleteCircle( CCObject* t_remove )
{
((CircleCreater*)t_remove)->stopCreate();
}
void Sleep::afterAction()
{
AudioEngine::sharedInstance()->playEffect("sound_sleep.mp3", false);
(target_jack->*delegate_sleep)();
my_cc->stopCreate();
// real sleep add
sleepImg = CCSprite::create("sleep_zzz.png", CCRectMake(0, 0, 30, 25));
sleepImg->setPosition(ccp(10,18));
addChild(sleepImg);
CCSprite* t_texture = CCSprite::create("sleep_zzz.png");
CCAnimation* t_animation = CCAnimation::create();
t_animation->setDelayPerUnit(0.1);
for(int i=0;i<5;i++)
{
t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(i*30, 0, 30, 25));
}
CCAnimate* t_animate = CCAnimate::create(t_animation);
CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate);
sleepImg->runAction(t_repeat);
}
void Sleep::myInit( CCObject* t_jack, SEL_CallFunc d_sleep )
{
target_jack = t_jack;
delegate_sleep = d_sleep;
my_cc = CircleCreater::create(ccYELLOW, 12);
addChild(my_cc);
}
Chaos* Chaos::create( CCObject* t_jack, SEL_CallFunc d_chaos )
{
Chaos* t_c = new Chaos();
t_c->myInit(t_jack, d_chaos);
t_c->autorelease();
return t_c;
}
void Chaos::startAction()
{
CCDelayTime* t_delay = CCDelayTime::create(1.0);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(Chaos::afterAction));
CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call);
runAction(t_seq);
}
void Chaos::showCircle()
{
CircleCreater* t_cc = CircleCreater::create(ccBLUE, 12);
addChild(t_cc);
CCDelayTime* t_delay = CCDelayTime::create(1.0);
CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(Chaos::deleteCircle), t_cc);
CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call);
runAction(t_seq);
}
void Chaos::selfRemove()
{
myGD->communication("Jack_resetStopEffects");
removeFromParentAndCleanup(true);
}
void Chaos::deleteCircle( CCObject* t_remove )
{
((CircleCreater*)t_remove)->stopCreate();
}
void Chaos::afterAction()
{
(target_jack->*delegate_chaos)();
my_cc->stopCreate();
chaosImg = CCSprite::create("chaos.png");
chaosImg->setAnchorPoint(ccp(0.5,0));
chaosImg->setRotation(-45);
addChild(chaosImg);
CCRotateTo* t_rotate_left = CCRotateTo::create(0.5, 45);
CCRotateTo* t_rotate_right = CCRotateTo::create(0.5, -45);
CCSequence* t_seq = CCSequence::createWithTwoActions(t_rotate_left, t_rotate_right);
CCRepeatForever* t_repeat = CCRepeatForever::create(t_seq);
chaosImg->runAction(t_repeat);
}
void Chaos::myInit( CCObject* t_jack, SEL_CallFunc d_chaos )
{
target_jack = t_jack;
delegate_chaos = d_chaos;
my_cc = CircleCreater::create(ccBLUE, 12);
addChild(my_cc);
}
MissileBarrier* MissileBarrier::create()
{
MissileBarrier* t_mb = new MissileBarrier();
t_mb->myInit();
t_mb->autorelease();
return t_mb;
}
void MissileBarrier::selfRemove()
{
removeFromParentAndCleanup(true);
}
void MissileBarrier::myInit()
{
AudioEngine::sharedInstance()->playEffect("sound_barrier_pass.mp3",false);
CCTexture2D* t_texture = CCTextureCache::sharedTextureCache()->addImage("jack_missile_barrier.png");
initWithTexture(t_texture, CCRectMake(0, 0, 38, 38));
CCAnimation* t_animation = CCAnimation::create();
t_animation->setDelayPerUnit(0.1);
for(int i=0;i<3;i++)
t_animation->addSpriteFrameWithTexture(t_texture, CCRectMake(38*i, 0, 38, 38));
CCAnimate* t_animate = CCAnimate::create(t_animation);
CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(MissileBarrier::selfRemove));
CCSequence* t_seq = CCSequence::createWithTwoActions(t_animate, t_call);
runAction(t_seq);
}
| [
"[email protected]"
] | |
b8e51524ca4872944d2d317871c3788574c59f5c | 7bb34b9837b6304ceac6ab45ce482b570526ed3c | /external/webkit/Tools/MiniBrowser/qt/BrowserView.cpp | 7d6426eb8621e63613aba2131e1cd78708f25232 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.1-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft"
] | permissive | ghsecuritylab/android_platform_sony_nicki | 7533bca5c13d32a8d2a42696344cc10249bd2fd8 | 526381be7808e5202d7865aa10303cb5d249388a | refs/heads/master | 2021-02-28T20:27:31.390188 | 2013-10-15T07:57:51 | 2013-10-15T07:57:51 | 245,730,217 | 0 | 0 | Apache-2.0 | 2020-03-08T00:59:27 | 2020-03-08T00:59:26 | null | UTF-8 | C++ | false | false | 2,308 | cpp | /*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2010 University of Szeged
*
* 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "BrowserView.h"
#include <QGraphicsScene>
BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWKContext* context, QWidget* parent)
: QGraphicsView(parent)
, m_item(0)
{
m_item = new QGraphicsWKView(context, backingStoreType, 0);
setScene(new QGraphicsScene(this));
scene()->addItem(m_item);
setFrameShape(QFrame::NoFrame);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
void BrowserView::resizeEvent(QResizeEvent* event)
{
QGraphicsView::resizeEvent(event);
QRectF rect(QPoint(0, 0), event->size());
m_item->setGeometry(rect);
scene()->setSceneRect(rect);
}
void BrowserView::load(const QString& url)
{
return m_item->load(QUrl::fromUserInput(url));
}
QGraphicsWKView* BrowserView::view() const
{
return m_item;
}
| [
"[email protected]"
] | |
7daf032ba044b0c4c2a53237a4a7f15f5ee4d6e4 | 7419c3edc2d0f8ecc82be918f1321d985b781a39 | /sources/mesh_layout.hpp | 07c65398fe6210c8858a80779adb779dd45d04eb | [] | no_license | Nojan/particle | 07b1685f127610b35d222aa305a9114577e6a855 | d3e700a114479c69dfcced52f828c1b253d4fde7 | refs/heads/master | 2021-07-30T00:03:37.947192 | 2018-09-16T15:27:45 | 2018-09-16T15:33:35 | 21,325,548 | 1 | 1 | null | 2021-07-28T09:49:41 | 2014-06-29T15:03:19 | C++ | UTF-8 | C++ | false | false | 1,740 | hpp | #pragma once
#include "types.hpp"
#include <array>
namespace VertexSemantic {
enum value {
Position,
Normal,
TexCoord0,
Color0,
Weigth,
Index,
Count,
};
static const char* str[] = {
"Position",
"Normal",
"TexCoord0",
"Color0",
"Weigth",
"Index",
"Count",
};
}
namespace VertexType {
enum value {
Float,
Float2,
Float3,
Float4,
FloatNormalize,
Float2Normalize,
Float3Normalize,
Float4Normalize,
Count,
};
static const char* str[] = {
"Float",
"Float2",
"Float3",
"Float4",
"FloatNormalize",
"Float2Normalize",
"Float3Normalize",
"Float4Normalize",
"Count",
};
static uint8_t ComponentCount[] = {
1,
2,
3,
4,
1,
2,
3,
4,
0,
};
}
size_t VertexTypeSize(VertexType::value type);
class VertexBufferLayout {
public:
struct Component {
VertexSemantic::value mSemantic;
VertexType::value mType;
};
VertexBufferLayout();
VertexBufferLayout(const VertexBufferLayout& ref);
void Add(const Component& component);
VertexBufferLayout& Add(VertexSemantic::value semantic, VertexType::value type);
size_t GetComponentCount() const;
const Component& GetComponent(size_t idx) const;
Component& GetComponent(size_t idx);
size_t GetIndex(VertexSemantic::value semantic) const;
size_t GetVertexSize() const;
size_t Offset(VertexSemantic::value semantic) const;
private:
std::array<Component, VertexSemantic::Count> mComponents;
};
| [
"[email protected]"
] | |
2c38f8a315020e5f8efe4ff1815ab52e4c783912 | ed6cc29968179d13bb30c73dbf2be2fb6469d495 | /P86/BASE/Pizza.h | 3a7f7f6eb7cdde3c6f6823617ac1a075b73ea2bc | [] | no_license | sindri69/pizza420 | e0880eea7eb0dbdeabae3dc675dba732a1778d90 | a0f78b59b5830ff67e9b5456a6e6d229869628f5 | refs/heads/master | 2021-08-28T14:59:32.423484 | 2017-12-12T14:19:05 | 2017-12-12T14:19:05 | 112,332,570 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 679 | h | #ifndef PIZZA_H
#define PIZZA_H
#include <string>
#include <iostream>
using namespace std;
class Pizza
{
public:
Pizza(string psize, string ptype, string ptopping, double pprice, bool ppayedfor, int pstatus);
string get_psize() const;
string get_ptype() const;
string get_ptopping() const;
double get_pprice() const;
bool get_ppayedfor() const;
int get_pstatus() const;
friend ostream& operator << (ostream& out, const Pizza& pizza);
private:
string psize;
string ptype;
string ptopping;
double pprice;
bool ppayedfor;
int pstatus;
};
#endif // PIZZA_H
| [
"[email protected]"
] | |
d426f57c064d12613d890eb0e1cd7e1578d1b838 | 32644d7e482ad227a51757ff0d07dd9cc5e1897e | /old/src_old/pig.h | 5969e0f14e9625c9f1917fefdb1fefc32dbd6ef5 | [] | no_license | pigApp/pig | 521b2f06f3020362d5e7ad3283faabc207f41f06 | 2593b7ca0203644a074d15b038ba4b5b2d421b7d | refs/heads/master | 2016-09-06T06:51:13.186777 | 2016-01-31T15:47:59 | 2016-01-31T15:47:59 | 20,078,750 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,530 | h | #ifndef PIG_H
#define PIG_H
#include "update.h"
#include "tcpSocket.h"
#include "torrent.h"
#include <QObject>
#include <QtSql>
class PIG : public QObject
{
Q_OBJECT
public:
PIG(QObject *parent = 0);
~PIG();
public slots:
void quit();
void set_root_object(QObject *root);
void password_handler(const bool require, const QString plain
, const bool check, const bool write);
void preview_handler(const int id, const QString host, const QString url
, const QString target
, const bool ready, const bool success, const bool error, const bool abort);
void torrent_handler(const QString host, const QString url, const QString target
, const int scene, const bool abort);
void find(const QString userInput, const QString category
, const QString pornstar, const QString quality, const QString full);
signals:
void sig_ret_password(const bool require = false, const bool success = false);
void sig_show_update();
void sig_show_news(const QString binaryNews, const QString databaseNews);
void sig_show_finder();
void sig_ret_db(int nMovies, QStringList dataMovies);
void sig_ret_stream(const int id, const bool ready, const bool success
, const bool error);
void sig_show_db_err();
private:
QObject *mRoot;
Update *mUpdate;
TcpSocket *mSocket[5];
Torrent *mTorrent;
QSqlDatabase db;
private slots:
void update_handler();
void start();
void cleanup();
void db_error();
};
#endif
| [
"[email protected]"
] | |
9688c31303ddfba6c187db6d3fb72ea775e29468 | 285c86812338bc61a0bdbe0f470981ac6c26a317 | /SEASON_1/K번째 수(백준)/JY_K번째 수.cpp | f37f47f620062e91d5568d30881c631a4789121a | [] | no_license | Dinoryong/algo-dinner | 7d296c84423586d25f5aecbf840139e397d8fb2d | ed49b0ef896e9d21d9e5893ba0d93555626cbaeb | refs/heads/main | 2023-06-24T14:18:12.495121 | 2021-07-20T14:08:49 | 2021-07-20T14:08:49 | 350,269,755 | 5 | 4 | null | 2021-07-01T14:19:28 | 2021-03-22T08:46:40 | Swift | UTF-8 | C++ | false | false | 488 | cpp | #include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
long long N, K;
long long answer = 0;
int main() {
cin >> N >> K;
long long left = 1, right = K;
while (left <= right) {
long long mid = (left + right) >> 1;
long long cnt = 0;
for (int i = 1; i <= N; i++) {
cnt += min(N, mid / i);
}
if (cnt >= K) {
right = mid - 1;
answer = mid;
}
else
left = mid + 1;
}
cout << answer;
system("pause");
return 0;
} | [
"[email protected]"
] | |
d60217c5b8e78d19c106974afc509f5cec2fcf29 | 2e1f21a5e1280158b46116f9156dac5ee091b290 | /queue/queue.cpp | 72d4fee18832036e11135670cf3caf05d6f3ba9c | [] | no_license | shenhangke/DataStructAndOS | 55b3dea1e5e07fb494fd5c9b9ef17a94ed3d95bb | cc62e9ad8e9e3330b92cc9d8022c5eb3ae8ecc7d | refs/heads/master | 2020-07-10T10:20:16.631121 | 2019-09-30T04:44:54 | 2019-09-30T04:44:54 | 204,239,923 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,461 | cpp | //
// Created by 沈航可 on 2019-08-23.
//
/*
* 队列满的条件是
* (rear+1)%queueSize==?front
* 计算队列长度的公式:
* (rear-front+queueSize)%queueSize
* */
/*
* 栈的结构,是只能在线性表的一头进行插入和删除操作
* 相对应的操作就是pop,和push
*
*
* 队列的本质,也是线性表,我们对这个表进行操作的时候,只能在这个表的一头进行插入操作,另外一头,进行删除操作
* 0 1 2 3 4
* ------------------------
* 1 | 2| 3| 4|5|
* ------------------------
* 我们暂时使用顺序结构来进行说明
*
*
* 1 2 3 4 5
*
* 如果我们现在要删除一个数据,只能够删除5,因为5这个元素,是在这个线性表的最尾端
* 如果我们要插入一个元素,我们只能把这个元素插入到线性表的开头,也就是1的前面
*
* 8这个元素插入到这个队列中
* 8 1 2 3 4 5
*
* 如果我要删除一个元素从线性表中删除一个元素,我只能删除5
*
*
* 对应对栈的pop和push操作,队列中也有相应的操作
* 分别叫做,出队,和入队
*
*
**/
int arr[10]; //令这个数组就是一个队列
//所以我需要定义两个指针,一个指向队头,一个指向队尾
int front,rear;
void initQueue(){
front=0;
rear=0;
}
/*
front
|
-------------
5|2 | 1 | 8| 5|2|1|8
-------------
|
rear
如果我们要插入一个元素,我们就保持头指针不变,在尾指针指向的地址处,填入元素,然后让尾指针加1
如果我要进行删除操作,那么我们就保持尾指针不变,让头指针+1
那么在这种情况下,队列的长度,就是rear-front
在一般队列中,队列长度的计算方法是
rear-front
判断一个队列是不是为空,只需要判断
front?=rear
还有一种队列,叫做循环队列
跟一般的队列结构不同的地方在于,如果我添加元素到了数组的末尾,想要再添加元素(在队列还可以添加元素的时候,就是说我申请的这个数组只中前面
部分还有空余)的时候,我可以将尾指针,指向这个数据的开头元素,从数据开头的元素开始重新使用
在这种操作情况下,
队列为空的时候,头尾指针是相等的,但是当队列满了的时候,头尾指针也是相等的
那么,我们就需要解决,怎么判断这个队列是空的还是满的
4/3=1。。。1
5%4=1
在循环队列中,rear这个指针,有可能在front指针的前面,也有可能在他的后面
循环d队列满的条件是
(rear+1)%queueSize==?front
计算队列的长度
* (rear-front+queueSize)%queueSize
*
* 队列的链结构
*
* front
* |
node_2->node_3->new_node
* |
* rear
*
* 我要在这个队列中,插入元素
* 1。把rear指向的这个节点的后继指针指向我要创建的新节点
* 2.把尾指针,指向新节点
*
* 我要在这个队列中删除元素
* 1。首先,用一个临时指针,记录下当前front指针指向的节点地址
* 2.我把front指针指向当前指向的这个节点的后继节点
* 3。把tmp指向的那个节点,删除
*
* 如果我们要判断这个链式结构的长度是不是为空
* 仅仅只需要判断头尾节点的只是不是一致,就可以了
*/
| [
"[email protected]"
] | |
61e2569dd94656d13a293b1a1ce8e6af692bb3b7 | 0dd4731848ce00ece780adaaccf3a6083afeca79 | /music_player_core/albummodel.h | 5fb51b4b93a98cfb7638fa07ffb04e31c57eb3b3 | [] | no_license | merq312/qt_music_player | 1894944d98418d69e9ba70c63f5c1f44508f1898 | 191f3504366a9d2dca9ad5cca129f54cabc24454 | refs/heads/master | 2023-08-24T19:34:26.296373 | 2021-10-04T04:47:41 | 2021-10-04T04:47:41 | 413,277,261 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 886 | h | #ifndef ALBUMMODEL_H
#define ALBUMMODEL_H
#include "music_player_core_global.h"
#include <QAbstractListModel>
#include <QPair>
#include <QString>
#include "databasemanager.h"
class QPixmap;
class MUSIC_PLAYER_CORE_EXPORT AlbumModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles {
ArtistNameRole = Qt::UserRole + 1,
};
AlbumModel(QObject *parent = 0);
void refreshAlbumList();
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
bool removeRows(int row, int count, const QModelIndex& parent) override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
private:
bool isIndexValid(const QModelIndex& index) const;
private:
DatabaseManager &_db;
QList<QPair<QString, QString>> _albumList;
QList<QPixmap *> _coverArtList;
};
#endif // ALBUMMODEL_H
| [
"[email protected]"
] | |
0d5b02ccc8d0cfc4f663ce0e7998da18e2fe71d2 | 78b28019e10962bb62a09fa1305264bbc9a113e3 | /common/geometry/kdtree/info/update_node_to_root.h | 6eb1b7b02f555717a5dd6f21e9ad81e3761369e2 | [
"MIT"
] | permissive | Loks-/competitions | 49d253c398bc926bfecc78f7d468410702f984a0 | 26a1b15f30bb664a308edc4868dfd315eeca0e0b | refs/heads/master | 2023-06-08T06:26:36.756563 | 2023-05-31T03:16:41 | 2023-05-31T03:16:41 | 135,969,969 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 311 | h | #pragma once
#include "common/binary_search_tree/info/update_node_to_root.h"
namespace geometry {
namespace kdtree {
namespace info {
template <class TNode>
inline void UpdateNodeToRoot(TNode* node) {
bst::info::UpdateNodeToRoot(node);
}
} // namespace info
} // namespace kdtree
} // namespace geometry
| [
"[email protected]"
] | |
431456dcf94122ccec10eec65c3b9a5d2e3647e7 | f1a2325795dcd90f940e45a3535ac3a0cb765616 | /development/TL1Services/TL1Core/TL1_DaDomain.h | afa5af47727d9207d5056febbc08de6aa33948ba | [] | no_license | MoonStart/Frame | 45c15d1e6febd7eb390b74b891bc5c40646db5de | e3a3574e5c243d9282778382509858514585ae03 | refs/heads/master | 2021-01-01T19:09:58.670794 | 2015-12-02T07:52:55 | 2015-12-02T07:52:55 | 31,520,344 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,117 | h | #ifndef __TL1_DADOMAIN_H__
#define __TL1_DADOMAIN_H__
/*-----------------------------------------------------------------------------
Copyright(c) Tellabs Transport Group Inc. All rights reserved.
SUBSYSTEM: Software Services
TARGET:
AUTHOR: Keith Halsall - August 7, 2012
DESCRIPTION: Header file for TL1 DA Domain declaration
-----------------------------------------------------------------------------*/
#ifdef WIN32 // Microsoft bug, identifier that exceeds 255 chars gets truncated
#pragma warning(disable:4786)
#endif
#ifndef __TL1_RESPONSE_H__
#include <Response/TL1_Response.h>
#endif
#ifndef __CT_TL1_CONTROLPLANEADDR_H__
#include <CommonTypes/CT_TL1_ControlPlaneAddr.h>
#endif
#ifndef __CT_CONTROLPLANE_DEFINITIONS_H__
#include <CommonTypes/CT_ControlPlane_Definitions.h>
#endif
#ifndef __CT_SM_TYPES_H__
#include <CommonTypes/CT_SM_Types.h>
#endif
/**
CLASS TL1_DaDomain
This is a protocol (pure abstract base class defining an interface)
that describes the set of system related TL1 commands, that a TL1 Entities
for a system is expected to implement. This class contains no
data member nor any default implementation.
*/
class TL1_DaDomain
{
public:
virtual void EntDa( const CT_TL1_DiscoveryAgentAddr& theAddr,
CT_TL1_LinkAddr* theDcnAddr,
string* theMgtDomain,
CT_SM_PST* thePst,
TL1_Response& theResponse ) = 0;
virtual void EdDa( const CT_TL1_DiscoveryAgentAddr& theAddr,
CT_SM_PST* thePst,
TL1_Response& theResponse ) = 0;
virtual void DltDa( const CT_TL1_DiscoveryAgentAddr& theAddr,
TL1_Response& theResponse ) = 0;
virtual void RtrvDa(const CT_TL1_DiscoveryAgentAddr& theAddr,
TL1_Response& theResponse )const = 0;
};
#endif
| [
"[email protected]"
] | |
7152c48ecb2d41dba203b6bad803803d57c7731e | 28a13ff79c03db639545ff914b0109d971651de8 | /Framework/Externals/slang/source/slang/compiler.cpp | 81f107bd80dc4cb503876d330a8392d47c4ea50c | [
"MIT"
] | permissive | tangent-vector-personal/Falcor | 828882a4180393f6fb5f76f7059d80b691df56ef | 04571cfa4f39c27f8931dd6b2d929f995f20bc83 | refs/heads/master | 2022-02-14T02:50:07.983450 | 2017-07-24T03:50:46 | 2017-07-24T03:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,318 | cpp | // Compiler.cpp : Defines the entry point for the console application.
//
#include "../core/basic.h"
#include "../core/slang-io.h"
#include "compiler.h"
#include "lexer.h"
#include "parameter-binding.h"
#include "parser.h"
#include "preprocessor.h"
#include "syntax-visitors.h"
#include "slang-stdlib.h"
#include "reflection.h"
#include "emit.h"
// Utilities for pass-through modes
#include "../slang-glslang/slang-glslang.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#undef WIN32_LEAN_AND_MEAN
#undef NOMINMAX
#include <d3dcompiler.h>
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#ifdef CreateDirectory
#undef CreateDirectory
#endif
namespace Slang
{
// CompileResult
void CompileResult::append(CompileResult const& result)
{
// Find which to append to
ResultFormat appendTo = ResultFormat::None;
if (format == ResultFormat::None)
{
format = result.format;
appendTo = result.format;
}
else if (format == result.format)
{
appendTo = format;
}
if (appendTo == ResultFormat::Text)
{
outputString.append(result.outputString.Buffer());
}
else if (appendTo == ResultFormat::Binary)
{
outputBinary.AddRange(result.outputBinary.Buffer(), result.outputBinary.Count());
}
}
// EntryPointRequest
TranslationUnitRequest* EntryPointRequest::getTranslationUnit()
{
return compileRequest->translationUnits[translationUnitIndex].Ptr();
}
//
Profile Profile::LookUp(char const* name)
{
#define PROFILE(TAG, NAME, STAGE, VERSION) if(strcmp(name, #NAME) == 0) return Profile::TAG;
#define PROFILE_ALIAS(TAG, DEF, NAME) if(strcmp(name, #NAME) == 0) return Profile::TAG;
#include "profile-defs.h"
return Profile::Unknown;
}
//
String emitHLSLForEntryPoint(
EntryPointRequest* entryPoint)
{
auto compileRequest = entryPoint->compileRequest;
auto translationUnit = entryPoint->getTranslationUnit();
if (compileRequest->passThrough != PassThroughMode::None)
{
// Generate a string that includes the content of
// the source file(s), along with a line directive
// to ensure that we get reasonable messages
// from the downstream compiler when in pass-through
// mode.
StringBuilder codeBuilder;
for(auto sourceFile : translationUnit->sourceFiles)
{
codeBuilder << "#line 1 \"";
for(auto c : sourceFile->path)
{
char buffer[] = { c, 0 };
switch(c)
{
default:
codeBuilder << buffer;
break;
case '\\':
codeBuilder << "\\\\";
}
}
codeBuilder << "\"\n";
codeBuilder << sourceFile->content << "\n";
}
return codeBuilder.ProduceString();
}
else
{
return emitEntryPoint(
entryPoint,
compileRequest->layout.Ptr(),
CodeGenTarget::HLSL);
}
}
String emitGLSLForEntryPoint(
EntryPointRequest* entryPoint)
{
auto compileRequest = entryPoint->compileRequest;
auto translationUnit = entryPoint->getTranslationUnit();
if (compileRequest->passThrough != PassThroughMode::None)
{
// Generate a string that includes the content of
// the source file(s), along with a line directive
// to ensure that we get reasonable messages
// from the downstream compiler when in pass-through
// mode.
StringBuilder codeBuilder;
int translationUnitCounter = 0;
for(auto sourceFile : translationUnit->sourceFiles)
{
int translationUnitIndex = translationUnitCounter++;
// We want to output `#line` directives, but we need
// to skip this for the first file, since otherwise
// some GLSL implementations will get tripped up by
// not having the `#version` directive be the first
// thing in the file.
if(translationUnitIndex != 0)
{
codeBuilder << "#line 1 " << translationUnitIndex << "\n";
}
codeBuilder << sourceFile->content << "\n";
}
return codeBuilder.ProduceString();
}
else
{
// TODO(tfoley): need to pass along the entry point
// so that we properly emit it as the `main` function.
return emitEntryPoint(
entryPoint,
compileRequest->layout.Ptr(),
CodeGenTarget::GLSL);
}
}
char const* GetHLSLProfileName(Profile profile)
{
switch(profile.raw)
{
#define PROFILE(TAG, NAME, STAGE, VERSION) case Profile::TAG: return #NAME;
#include "profile-defs.h"
default:
// TODO: emit an error here!
return "unknown";
}
}
#ifdef _WIN32
HMODULE loadD3DCompilerDLL(CompileRequest* request)
{
char const* libraryName = "d3dcompiler_47";
HMODULE d3dCompiler = LoadLibraryA(libraryName);
if (!d3dCompiler)
{
request->mSink.diagnose(CodePosition(), Diagnostics::failedToLoadDynamicLibrary, libraryName);
}
return d3dCompiler;
}
HMODULE getD3DCompilerDLL(CompileRequest* request)
{
// TODO(tfoley): let user specify version of d3dcompiler DLL to use.
static HMODULE d3dCompiler = loadD3DCompilerDLL(request);
return d3dCompiler;
}
List<uint8_t> EmitDXBytecodeForEntryPoint(
EntryPointRequest* entryPoint)
{
static pD3DCompile D3DCompile_ = nullptr;
if (!D3DCompile_)
{
HMODULE d3dCompiler = getD3DCompilerDLL(entryPoint->compileRequest);
if (!d3dCompiler)
return List<uint8_t>();
D3DCompile_ = (pD3DCompile)GetProcAddress(d3dCompiler, "D3DCompile");
if (!D3DCompile_)
return List<uint8_t>();
}
auto hlslCode = emitHLSLForEntryPoint(entryPoint);
maybeDumpIntermediate(entryPoint->compileRequest, hlslCode.Buffer(), CodeGenTarget::HLSL);
ID3DBlob* codeBlob;
ID3DBlob* diagnosticsBlob;
HRESULT hr = D3DCompile_(
hlslCode.begin(),
hlslCode.Length(),
"slang",
nullptr,
nullptr,
entryPoint->name.begin(),
GetHLSLProfileName(entryPoint->profile),
0,
0,
&codeBlob,
&diagnosticsBlob);
List<uint8_t> data;
if (codeBlob)
{
data.AddRange((uint8_t const*)codeBlob->GetBufferPointer(), (int)codeBlob->GetBufferSize());
codeBlob->Release();
}
if (diagnosticsBlob)
{
// TODO(tfoley): need a better policy for how we translate diagnostics
// back into the Slang world (although we should always try to generate
// HLSL that doesn't produce any diagnostics...)
entryPoint->compileRequest->mSink.diagnoseRaw(
FAILED(hr) ? Severity::Error : Severity::Warning,
(char const*) diagnosticsBlob->GetBufferPointer());
diagnosticsBlob->Release();
}
if (FAILED(hr))
{
return List<uint8_t>();
}
return data;
}
#if 0
List<uint8_t> EmitDXBytecode(
ExtraContext& context)
{
if(context.getTranslationUnitOptions().entryPoints.Count() != 1)
{
if(context.getTranslationUnitOptions().entryPoints.Count() == 0)
{
// TODO(tfoley): need to write diagnostics into this whole thing...
fprintf(stderr, "no entry point specified\n");
}
else
{
fprintf(stderr, "multiple entry points specified\n");
}
return List<uint8_t>();
}
return EmitDXBytecodeForEntryPoint(context, context.getTranslationUnitOptions().entryPoints[0]);
}
#endif
String dissassembleDXBC(
CompileRequest* compileRequest,
void const* data,
size_t size)
{
static pD3DDisassemble D3DDisassemble_ = nullptr;
if (!D3DDisassemble_)
{
HMODULE d3dCompiler = getD3DCompilerDLL(compileRequest);
if (!d3dCompiler)
return String();
D3DDisassemble_ = (pD3DDisassemble)GetProcAddress(d3dCompiler, "D3DDisassemble");
if (!D3DDisassemble_)
return String();
}
if (!data || !size)
{
return String();
}
ID3DBlob* codeBlob;
HRESULT hr = D3DDisassemble_(
data,
size,
0,
nullptr,
&codeBlob);
String result;
if (codeBlob)
{
char const* codeBegin = (char const*)codeBlob->GetBufferPointer();
char const* codeEnd = codeBegin + codeBlob->GetBufferSize();
result.append(codeBegin, codeEnd);
codeBlob->Release();
}
if (FAILED(hr))
{
// TODO(tfoley): need to figure out what to diagnose here...
}
return result;
}
String EmitDXBytecodeAssemblyForEntryPoint(
EntryPointRequest* entryPoint)
{
List<uint8_t> dxbc = EmitDXBytecodeForEntryPoint(entryPoint);
if (!dxbc.Count())
{
return String();
}
String result = dissassembleDXBC(entryPoint->compileRequest, dxbc.Buffer(), dxbc.Count());
return result;
}
#if 0
String EmitDXBytecodeAssembly(
ExtraContext& context)
{
if(context.getTranslationUnitOptions().entryPoints.Count() == 0)
{
// TODO(tfoley): need to write diagnostics into this whole thing...
fprintf(stderr, "no entry point specified\n");
return "";
}
StringBuilder sb;
for (auto entryPoint : context.getTranslationUnitOptions().entryPoints)
{
sb << EmitDXBytecodeAssemblyForEntryPoint(context, entryPoint);
}
return sb.ProduceString();
}
#endif
HMODULE loadGLSLCompilerDLL(CompileRequest* request)
{
char const* libraryName = "slang-glslang";
// TODO(tfoley): let user specify version of glslang DLL to use.
HMODULE glslCompiler = LoadLibraryA(libraryName);
if (!glslCompiler)
{
request->mSink.diagnose(CodePosition(), Diagnostics::failedToLoadDynamicLibrary, libraryName);
}
return glslCompiler;
}
HMODULE getGLSLCompilerDLL(CompileRequest* request)
{
static HMODULE glslCompiler = loadGLSLCompilerDLL(request);
return glslCompiler;
}
int invokeGLSLCompiler(
CompileRequest* slangCompileRequest,
glslang_CompileRequest& request)
{
static glslang_CompileFunc glslang_compile = nullptr;
if (!glslang_compile)
{
HMODULE glslCompiler = getGLSLCompilerDLL(slangCompileRequest);
if (!glslCompiler)
return 1;
glslang_compile = (glslang_CompileFunc)GetProcAddress(glslCompiler, "glslang_compile");
if (!glslang_compile)
return 1;
}
String diagnosticOutput;
auto diagnosticOutputFunc = [](void const* data, size_t size, void* userData)
{
(*(String*)userData).append((char const*)data, (char const*)data + size);
};
request.diagnosticFunc = diagnosticOutputFunc;
request.diagnosticUserData = &diagnosticOutput;
int err = glslang_compile(&request);
if (err)
{
slangCompileRequest->mSink.diagnoseRaw(
Severity::Error,
diagnosticOutput.begin());
return err;
}
return 0;
}
String dissassembleSPIRV(
CompileRequest* slangRequest,
void const* data,
size_t size)
{
String output;
auto outputFunc = [](void const* data, size_t size, void* userData)
{
(*(String*)userData).append((char const*)data, (char const*)data + size);
};
glslang_CompileRequest request;
request.action = GLSLANG_ACTION_DISSASSEMBLE_SPIRV;
request.inputBegin = data;
request.inputEnd = (char*)data + size;
request.outputFunc = outputFunc;
request.outputUserData = &output;
int err = invokeGLSLCompiler(slangRequest, request);
if (err)
{
String();
}
return output;
}
List<uint8_t> emitSPIRVForEntryPoint(
EntryPointRequest* entryPoint)
{
String rawGLSL = emitGLSLForEntryPoint(entryPoint);
maybeDumpIntermediate(entryPoint->compileRequest, rawGLSL.Buffer(), CodeGenTarget::GLSL);
List<uint8_t> output;
auto outputFunc = [](void const* data, size_t size, void* userData)
{
((List<uint8_t>*)userData)->AddRange((uint8_t*)data, size);
};
glslang_CompileRequest request;
request.action = GLSLANG_ACTION_COMPILE_GLSL_TO_SPIRV;
request.sourcePath = "slang";
request.slangStage = (SlangStage)entryPoint->profile.GetStage();
request.inputBegin = rawGLSL.begin();
request.inputEnd = rawGLSL.end();
request.outputFunc = outputFunc;
request.outputUserData = &output;
int err = invokeGLSLCompiler(entryPoint->compileRequest, request);
if (err)
{
return List<uint8_t>();
}
return output;
}
String emitSPIRVAssemblyForEntryPoint(
EntryPointRequest* entryPoint)
{
List<uint8_t> spirv = emitSPIRVForEntryPoint(entryPoint);
if (spirv.Count() == 0)
return String();
String result = dissassembleSPIRV(entryPoint->compileRequest, spirv.begin(), spirv.Count());
return result;
}
#endif
#if 0
String emitSPIRVAssembly(
ExtraContext& context)
{
if(context.getTranslationUnitOptions().entryPoints.Count() == 0)
{
// TODO(tfoley): need to write diagnostics into this whole thing...
fprintf(stderr, "no entry point specified\n");
return "";
}
StringBuilder sb;
for (auto entryPoint : context.getTranslationUnitOptions().entryPoints)
{
sb << emitSPIRVAssemblyForEntryPoint(context, entryPoint);
}
return sb.ProduceString();
}
#endif
// Do emit logic for a single entry point
CompileResult emitEntryPoint(
EntryPointRequest* entryPoint)
{
CompileResult result;
auto compileRequest = entryPoint->compileRequest;
auto target = compileRequest->Target;
switch (target)
{
case CodeGenTarget::HLSL:
{
String code = emitHLSLForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::GLSL:
{
String code = emitGLSLForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::DXBytecode:
{
List<uint8_t> code = EmitDXBytecodeForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::DXBytecodeAssembly:
{
String code = EmitDXBytecodeAssemblyForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::SPIRV:
{
List<uint8_t> code = emitSPIRVForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::SPIRVAssembly:
{
String code = emitSPIRVAssemblyForEntryPoint(entryPoint);
maybeDumpIntermediate(compileRequest, code.Buffer(), target);
result = CompileResult(code);
}
break;
case CodeGenTarget::None:
// The user requested no output
break;
// Note(tfoley): We currently hit this case when compiling the stdlib
case CodeGenTarget::Unknown:
break;
default:
SLANG_UNEXPECTED("unhandled code generation target");
break;
}
return result;
}
CompileResult emitTranslationUnitEntryPoints(
TranslationUnitRequest* translationUnit)
{
CompileResult result;
for (auto& entryPoint : translationUnit->entryPoints)
{
CompileResult entryPointResult = emitEntryPoint(entryPoint.Ptr());
entryPoint->result = entryPointResult;
}
// The result for the translation unit will just be the concatenation
// of the results for each entry point. This doesn't actually make
// much sense, but it is good enough for now.
//
// TODO: Replace this with a packaged JSON and/or binary format.
for (auto& entryPoint : translationUnit->entryPoints)
{
result.append(entryPoint->result);
}
return result;
}
// Do emit logic for an entire translation unit, which might
// have zero or more entry points
CompileResult emitTranslationUnit(
TranslationUnitRequest* translationUnit)
{
return emitTranslationUnitEntryPoints(translationUnit);
}
#if 0
TranslationUnitResult generateOutput(ExtraContext& context)
{
TranslationUnitResult result = emitTranslationUnit(context);
return result;
}
#endif
void generateOutput(
CompileRequest* compileRequest)
{
// Start of with per-translation-unit and per-entry-point lowering
for( auto translationUnit : compileRequest->translationUnits )
{
CompileResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr());
translationUnit->result = translationUnitResult;
}
// Allow for an "extra" target to verride things before we finish.
switch (compileRequest->extraTarget)
{
case CodeGenTarget::ReflectionJSON:
{
String reflectionJSON = emitReflectionJSON(compileRequest->layout.Ptr());
// Clobber existing output so we don't have to deal with it
for( auto translationUnit : compileRequest->translationUnits )
{
translationUnit->result = CompileResult();
}
for( auto entryPoint : compileRequest->entryPoints )
{
entryPoint->result = CompileResult();
}
// HACK(tfoley): just print it out since that is what people probably expect.
// TODO: need a way to control where output gets routed across all possible targets.
fprintf(stdout, "%s", reflectionJSON.begin());
return;
}
break;
default:
break;
}
}
// Debug logic for dumping intermediate outputs
//
void dumpIntermediate(
CompileRequest*,
void const* data,
size_t size,
char const* ext,
bool isBinary)
{
static int counter = 0;
int id = counter++;
String path;
path.append("slang-dump-");
path.append(id);
path.append(ext);
FILE* file = fopen(path.Buffer(), isBinary ? "wb" : "w");
if (!file) return;
fwrite(data, size, 1, file);
fclose(file);
}
void dumpIntermediateText(
CompileRequest* compileRequest,
void const* data,
size_t size,
char const* ext)
{
dumpIntermediate(compileRequest, data, size, ext, false);
}
void dumpIntermediateBinary(
CompileRequest* compileRequest,
void const* data,
size_t size,
char const* ext)
{
dumpIntermediate(compileRequest, data, size, ext, true);
}
void maybeDumpIntermediate(
CompileRequest* compileRequest,
void const* data,
size_t size,
CodeGenTarget target)
{
if (!compileRequest->shouldDumpIntermediates)
return;
switch (target)
{
default:
break;
case CodeGenTarget::HLSL:
dumpIntermediateText(compileRequest, data, size, ".hlsl");
break;
case CodeGenTarget::GLSL:
dumpIntermediateText(compileRequest, data, size, ".glsl");
break;
case CodeGenTarget::SPIRVAssembly:
dumpIntermediateText(compileRequest, data, size, ".spv.asm");
break;
case CodeGenTarget::DXBytecodeAssembly:
dumpIntermediateText(compileRequest, data, size, ".dxbc.asm");
break;
case CodeGenTarget::SPIRV:
dumpIntermediateBinary(compileRequest, data, size, ".spv");
{
String spirvAssembly = dissassembleSPIRV(compileRequest, data, size);
dumpIntermediateText(compileRequest, spirvAssembly.begin(), spirvAssembly.Length(), ".spv.asm");
}
break;
case CodeGenTarget::DXBytecode:
dumpIntermediateBinary(compileRequest, data, size, ".dxbc");
{
String dxbcAssembly = dissassembleDXBC(compileRequest, data, size);
dumpIntermediateText(compileRequest, dxbcAssembly.begin(), dxbcAssembly.Length(), ".dxbc.asm");
}
break;
}
}
void maybeDumpIntermediate(
CompileRequest* compileRequest,
char const* text,
CodeGenTarget target)
{
if (!compileRequest->shouldDumpIntermediates)
return;
maybeDumpIntermediate(compileRequest, text, strlen(text), target);
}
}
| [
"[email protected]"
] | |
0bac0aa362a380d6a5de79b79a3b51417496434d | 1d3e07aa050fd2fd0c8cc0a9a83b74b28826c8a8 | /lib/src/simple_geometry.cpp | 6543ef3fa10be65f1eba69f658a44a64a4b6aac7 | [] | no_license | climoge/moteur_physique | bdc066b4058c2e816841246d44a6d48cb52e5b7d | 5d52d3250c1142bc2c432ad6e6c1763f58425d6b | refs/heads/master | 2020-05-26T01:01:43.064415 | 2017-03-15T22:46:55 | 2017-03-15T22:46:55 | 84,959,128 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,401 | cpp | #include <glmlv/simple_geometry.hpp>
#include <glm/gtc/constants.hpp>
#include <iostream>
namespace glmlv
{
SimpleGeometry makeTriangle()
{
std::vector<Vertex3f3f2f> vertexBuffer =
{
{ glm::vec3(-0.5, -0.5, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0) },
{ glm::vec3(0.5, -0.5, 0), glm::vec3(0, 0, 1), glm::vec2(1, 0) },
{ glm::vec3(0., 0.5, 0), glm::vec3(0, 0, 1), glm::vec2(0.5, 1) }
};
std::vector<uint32_t> indexBuffer =
{
0, 1, 2
};
return{ vertexBuffer, indexBuffer };
}
SimpleGeometry makeCube()
{
std::vector<Vertex3f3f2f> vertexBuffer =
{
// Bottom side
{ glm::vec3(-0.5, -0.5, -0.5), glm::vec3(0, -1, 0), glm::vec2(0, 0) },
{ glm::vec3(0.5, -0.5, -0.5), glm::vec3(0, -1, 0), glm::vec2(0, 1) },
{ glm::vec3(0.5, -0.5, 0.5), glm::vec3(0, -1, 0), glm::vec2(1, 1) },
{ glm::vec3(-0.5, -0.5, 0.5), glm::vec3(0, -1, 0), glm::vec2(1, 0) },
// Right side
{ glm::vec3(0.5, -0.5, 0.5), glm::vec3(1, 0, 0), glm::vec2(0, 0) },
{ glm::vec3(0.5, -0.5, -0.5), glm::vec3(1, 0, 0), glm::vec2(0, 1) },
{ glm::vec3(0.5, 0.5, -0.5), glm::vec3(1, 0, 0), glm::vec2(1, 1) },
{ glm::vec3(0.5, 0.5, 0.5), glm::vec3(1, 0, 0), glm::vec2(1, 0) },
// Back side
{ glm::vec3(0.5, -0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(0, 0) },
{ glm::vec3(-0.5, -0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(0, 1) },
{ glm::vec3(-0.5, 0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(1, 1) },
{ glm::vec3(0.5, 0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(1, 0) },
// Left side
{ glm::vec3(-0.5, -0.5, -0.5), glm::vec3(-1, 0, 0), glm::vec2(0, 0) },
{ glm::vec3(-0.5, -0.5, 0.5), glm::vec3(-1, 0, 0), glm::vec2(0, 1) },
{ glm::vec3(-0.5, 0.5, 0.5), glm::vec3(-1, 0, 0), glm::vec2(1, 1) },
{ glm::vec3(-0.5, 0.5, -0.5), glm::vec3(-1, 0, 0), glm::vec2(1, 0) },
// Front side
{ glm::vec3(-0.5, -0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(0, 0) },
{ glm::vec3(0.5, -0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(0, 1) },
{ glm::vec3(0.5, 0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(1, 1) },
{ glm::vec3(-0.5, 0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(1, 0) },
// Top side
{ glm::vec3(-0.5, 0.5, 0.5), glm::vec3(0, 1, 0), glm::vec2(0, 0) },
{ glm::vec3(0.5, 0.5, 0.5), glm::vec3(0, 1, 0), glm::vec2(0, 1) },
{ glm::vec3(0.5, 0.5, -0.5), glm::vec3(0, 1, 0), glm::vec2(1, 1) },
{ glm::vec3(-0.5, 0.5, -0.5), glm::vec3(0, 1, 0), glm::vec2(1, 0) }
};
std::vector<uint32_t> indexBuffer =
{
0, 1, 2,
0, 2, 3,
4, 5, 6,
4, 6, 7,
8, 9, 10,
8, 10, 11,
12, 13, 14,
12, 14, 15,
16, 17, 18,
16, 18, 19,
20, 21, 22,
20, 22, 23
};
return{ vertexBuffer, indexBuffer };
}
/*SimpleGeometry makeFlag(std::Vector<PMat>& pMats)
{
std::vector<Vertex3f3f2f> vertexBuffer;
std::vector<uint32_t> indexBuffer;
uint32_t index = 0;
for(float j = 0; j <= 1; j += 0.1){
for(float i = 0; i <= 1; i += 0.1){
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + 0.1, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + 0.1, j + 0.1, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j + 0.1, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
indexBuffer.push_back(index);
indexBuffer.push_back(index+1);
indexBuffer.push_back(index+2);
indexBuffer.push_back(index);
indexBuffer.push_back(index+2);
indexBuffer.push_back(index+3);
index += 4;
}
}
for(auto const& pMat: pMats) {
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(pMat[i].getPos().x, pMat[i].getPos().y, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
indexBuffer.push_back(index);
index++;
}
return{ vertexBuffer, indexBuffer };
}*/
SimpleGeometry makeFlag()
{
std::vector<Vertex3f3f2f> vertexBuffer;
std::vector<uint32_t> indexBuffer;
uint32_t index = 0;
unsigned int width = 50;
unsigned int height = 50;
float jOffset = 1/(float) height;
float iOffset = 1/(float) width;
assert(width%2 == 0 && height%2 == 0);
for(float j = 0; j < 1; j += jOffset*2){
for(float i = 0; i < 1; i += iOffset*2){
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j + jOffset, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + iOffset, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + iOffset, j + jOffset, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0)));
if(index >= (2*width)){
std::cout << "index " << index << std::endl;
int offset = index - (width*2-1);
std::cout << "offset " << offset << std::endl;
indexBuffer.push_back(offset);
indexBuffer.push_back(index);
indexBuffer.push_back(offset + 2);
std::cout << "Vertex 1 : " << offset << " " << index << " " << offset+2 << std::endl;
indexBuffer.push_back(index);
indexBuffer.push_back(index+2);
indexBuffer.push_back(offset + 2);
std::cout << "Vertex 1 : " << index << " " << index+2 << " " << offset+2 << std::endl;
if(index % (2*width) < (width*2-4)){
std::cout << "index " << index << std::endl;
int offset = index - (width*2-1) + 2;
std::cout << "offset " << offset << std::endl;
indexBuffer.push_back(offset);
indexBuffer.push_back(index+2);
indexBuffer.push_back(offset + 2);
std::cout << "Vertex 1 : " << offset << " " << index+2 << " " << offset+2 << std::endl;
indexBuffer.push_back(index+2);
indexBuffer.push_back(index+4);
indexBuffer.push_back(offset + 2);
std::cout << "Vertex 1 : " << index+2 << " " << index+4 << " " << offset+2 << std::endl << std::endl;
}
}
if(index > 0 && index % (2*width)){
std::cout << "index : " << index << " modulo : " << index % (4*width) << std::endl;
std::cout << "Vertex 1 : " << index-2 << " " << index-1 << " " << index << std::endl;
std::cout << "Vertex 2 : " << index-1 << " " << index+1 << " " << index << std::endl << std::endl;
indexBuffer.push_back(index-2);
indexBuffer.push_back(index-1);
indexBuffer.push_back(index);
indexBuffer.push_back(index-1);
indexBuffer.push_back(index+1);
indexBuffer.push_back(index);
}
indexBuffer.push_back(index);
indexBuffer.push_back(index+1);
indexBuffer.push_back(index+2);
indexBuffer.push_back(index+1);
indexBuffer.push_back(index+3);
indexBuffer.push_back(index+2);
index += 4;
}
}
return{ vertexBuffer, indexBuffer };
}
SimpleGeometry makeSphere(uint32_t subdivLongitude)
{
const auto discLong = subdivLongitude;
const auto discLat = 2 * discLong;
float rcpLat = 1.f / discLat, rcpLong = 1.f / discLong;
float dPhi = glm::pi<float>() * 2.f * rcpLat, dTheta = glm::pi<float>() * rcpLong;
std::vector<Vertex3f3f2f> vertexBuffer;
for (uint32_t j = 0; j <= discLong; ++j)
{
float cosTheta = cos(-glm::half_pi<float>() + j * dTheta);
float sinTheta = sin(-glm::half_pi<float>() + j * dTheta);
for (uint32_t i = 0; i <= discLat; ++i) {
glm::vec3 coords;
coords.x = sin(i * dPhi) * cosTheta;
coords.y = sinTheta;
coords.z = cos(i * dPhi) * cosTheta;
vertexBuffer.emplace_back(coords, coords, glm::vec2(i * rcpLat, j * rcpLong));
}
}
std::vector<uint32_t> indexBuffer;
for (uint32_t j = 0; j < discLong; ++j)
{
uint32_t offset = j * (discLat + 1);
for (uint32_t i = 0; i < discLat; ++i)
{
indexBuffer.push_back(offset + i);
indexBuffer.push_back(offset + (i + 1));
indexBuffer.push_back(offset + discLat + 1 + (i + 1));
indexBuffer.push_back(offset + i);
indexBuffer.push_back(offset + discLat + 1 + (i + 1));
indexBuffer.push_back(offset + i + discLat + 1);
}
}
return{ vertexBuffer, indexBuffer };
}
}
| [
"[email protected]"
] | |
b2ba43b4608d26d188f0be138de8d2b0a587a0b3 | c81561d479c823a61be71c62f3c20ea166811b88 | /solution/Priprema3_dodatak/Zabava.h | 8c8b044e820b210ed8066a103e6c45aaa5b6d102 | [] | no_license | Metlina/oop | f864d89bb18d041358842f6f6977393b94f2d755 | a2dd1714876871e62fe2241e0b68b3de6e26906d | refs/heads/master | 2021-01-19T04:52:25.901947 | 2015-01-30T23:21:50 | 2015-01-30T23:21:50 | 30,095,027 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 418 | h | #include <vector>
#include <string>
#include "Prijatelj.h"
using namespace std;
class Zabava
{
private:
vector<Prijatelj*> uzvanici;
vector<Pice*> popisPica;
double budzet;
public:
Zabava(double budzet);
~Zabava(void);
void dodajPrijatelja(Prijatelj* prijatelj);
void dodajPice(Pice* pice);
double getBudzet();
Prijatelj* getPrijatelj(int id);
Pice* nadjiPice(int PiceId);
void ispisiPopisZaKupnju();
}; | [
"[email protected]"
] | |
26bc53606bba0d00b874807edbfa27bfb091dc43 | 995f187dc18e6848bf37900a1904bc3479bf8055 | /ConsoleApplication27/ConsoleApplication27.cpp | f13e54cacbae498f2a49b578549852336903a779 | [] | no_license | gordushha/ConsoleApplication27 | d6514dc39206e8a6f2f5b5ae4cdf87c6ca189710 | db5740cbfc11a8a560452529ae36704305ca926e | refs/heads/master | 2022-07-17T02:36:53.035215 | 2020-05-13T16:30:01 | 2020-05-13T16:30:01 | 263,681,279 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,025 | cpp | #include <iostream>
#pragma warning(disable:4996)
size_t my_strlen(const char* str)
{
size_t size = 0;
while (*str != '\0')
{
++str;
++size;
}
return size;
}
class TString
{
public:
TString():m_data (0) , m_size(0){}
TString(const char* str)
{
m_size = my_strlen(str);
m_data = new char[m_size + 1];
for (size_t i = 0; i < m_size + 1; ++i)
{
m_data[i] = str[i];
}
}
TString(const TString& other)
: TString(other.m_data)
{
m_data = other.m_data;
}
~TString()
{
delete[] m_data;
}
size_t size() const
{
return m_size;
}
char* data() const
{
return m_data;
}
TString operator+(const TString& other)
{
TString newStr;
int thisLength = strlen(this->m_data);
int otherLength = strlen(other.m_data);
newStr.m_size = thisLength + otherLength;
newStr.m_data = new char[thisLength + otherLength + 1];
int i = 0;
for (; i < thisLength; i++)
{
newStr.m_data[i] = this->m_data[i];
}
for (int j = 0; j < otherLength; j++, i++)
{
newStr.m_data[i] = other.m_data[j];
}
newStr.m_data[thisLength + otherLength] = '\0';
return newStr;
}
char& operator[](size_t i) const
{
if (i < 0 || i >= m_size)
throw "nil'zya(";
else
return m_data[i];
}
bool operator==(const TString& other)
{
if (m_size != other.m_size)
return false;
for (size_t i = 0; i < m_size; ++i)
{
if (m_data[i] != other.m_data[i])
return false;
}
return true;
}
bool operator!=(const TString& other)
{
return !(*this == other);
}
size_t my_min(size_t a, size_t b)
{
if (a < b)
return a;
return b;
}
bool operator<(const TString& other)
{
for (size_t i = 0; i < my_min(m_size, other.m_size); ++i)
{
if (m_data[i] != other.m_data[i])
return m_data[i] < other.m_data[i];
}
return m_size < other.m_size;
}
bool operator>(const TString& other)
{
if (*this < other)
return false;
return *this != other;
}
TString& operator=(const TString& other)
{
if (this == &other) //проверка на самокопирование
return *this;
m_size = other.m_size;
if (m_data)
delete[] m_data;
m_data = new char[m_size + 1]{};
for (size_t i = 0; i < m_size + 1; ++i)
{
m_data[i] = other.m_data[i];
}
return *this;
}
//Возвращает позицию
int find(const char* e) {
char* t = strstr(m_data, e);
if (t != NULL)
return t - m_data + 1;
else
return NULL;
}
TString* Tstrtok(const char* c) {
int count = 0;
TString tmp = m_data;
char* istr = strtok(tmp.m_data, c);
while (istr != NULL)
{
count += 1;
istr = strtok(NULL, c);
}
tmp = m_data;
TString* result = new TString[count];
count = 0;
istr = strtok(tmp.m_data, c);
while (istr != NULL)
{
result[count] = istr;
count += 1;
istr = strtok(NULL, c);
}
return result;
}
friend std::ostream& operator<<(std::ostream& stream, const TString& self);
friend std::istream& operator>>(std::istream& stream, TString& self);
private:
size_t m_size;
char* m_data;
};
std::ostream& operator<<(std::ostream& stream, const TString& self)
{
stream << self.data();
return stream;
}
std::istream& operator>>(std::istream& stream, TString& self)
{
char buf[1024] = {};
stream >> buf;
self = buf;
return stream;
}
int main()
{
TString empty_str;
std::cin >> empty_str;
empty_str = empty_str;
const char* str = "Hello";
char arr[6] = { 'H', 'e', 'l', 'l', 'o', '\0' };
const char* ptr = str + 4;
char ch = *ptr; // ???
size_t s = my_strlen(str); // = 5
TString my_str("Hello");
TString my_copy(my_str);
std::cout << my_copy << std::endl;
bool is_equal = my_str == my_copy;
bool is_not_equal = my_str != my_copy;
return 0;
} | [
"[email protected]"
] | |
9537ac8fe5fdc71c829f639a11083a69464a9b24 | 06bfbd7d0336a0e054bed3787363a702baa423ac | /Library/Network/BitTorrent/DHT/NodeId.cpp | e6e93a5a20335147274baef01f9d08aa3a4846e6 | [] | no_license | Y2JB/Bittorrent | 50a07ee3b851684e892bf2999ba9ff381625f759 | 825d0282ad3da577953b908fd8e13d063bb20389 | refs/heads/master | 2023-01-14T14:32:15.957897 | 2020-11-27T10:35:19 | 2020-11-27T10:35:19 | 240,065,485 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,077 | cpp | // Jon Bellamy 18/11/2009
#include "NodeId.h"
#include <assert.h>
#include <memory.h>
#include "General/Rand.h"
cDhtNodeId::cDhtNodeId()
{
Randomize();
}// END cDhtNodeId
cDhtNodeId::cDhtNodeId(const std::string& data)
{
assert(data.size() == NODE_ID_SIZE);
if(data.size() == NODE_ID_SIZE)
{
FromData(reinterpret_cast<const u8*>(data.c_str()));
}
}// END cDhtNodeId
cDhtNodeId::cDhtNodeId(const cDhtNodeId& rhs)
{
*this = rhs;
}// END cDhtNodeId
void cDhtNodeId::Randomize()
{
for(u32 i=0; i < NODE_ID_SIZE; i++)
{
mNodeId[i] = (u8)Rand16(0xFF);
}
}// END Randomize
void cDhtNodeId::FromData(const u8* data)
{
memcpy(mNodeId, data, NODE_ID_SIZE);
}// END FromData
const cDhtNodeId& cDhtNodeId::operator= (const cDhtNodeId& rhs)
{
memcpy(mNodeId, rhs.mNodeId, NODE_ID_SIZE);
return *this;
}// END operator=
bool cDhtNodeId::operator== (const cDhtNodeId& rhs) const
{
return memcmp(mNodeId, rhs.mNodeId, NODE_ID_SIZE) == 0;
}// END operator==
bool cDhtNodeId::operator< (const cDhtNodeId& rhs) const
{
if (*this == rhs)
{
return false;
}
else
{
for(u32 i=0; i < NODE_ID_SIZE; i++)
{
if(mNodeId[i] != rhs.mNodeId[i])
{
if(mNodeId[i] < rhs.mNodeId[i])
{
return true;
}
else
{
return false;
}
}
}
}
assert(0);
return true;
}// END operator<
bool cDhtNodeId::IsValid() const
{
return (memcmp(mNodeId, INVALID_NODE_ID, sizeof(mNodeId)) != 0);
}// END IsValid
std::string cDhtNodeId::AsString() const
{
return std::string(reinterpret_cast<const char*>(&mNodeId[0]), NODE_ID_SIZE);
}// END AsString
void cDhtNodeId::DebugPrint() const
{
for(u32 i=0; i < NODE_ID_SIZE; i++)
{
Printf("%.2X ", mNodeId[i]);
}
}// END DebugPrint
u32 DistanceBetweenDhtNodes(const cDhtNodeId& lhs, const cDhtNodeId& rhs)
{
u32 ret=0;
for(u32 i=0; i < cDhtNodeId::NODE_ID_SIZE; i++)
{
ret += (lhs[i] ^ rhs[i]);
}
return ret;
}// END DistanceBetweenDhtNodes | [
"[email protected]"
] | |
dcf92a2fad301bfaece8d5276c1dd7d3515af95c | 0aea33bf1e2768895bf37a3048008489e8f7aa27 | /export/windows/cpp/obj/include/flixel/FlxG.h | 840f934b54c70c53c7f0a5fe2592903fc62a7c4e | [] | no_license | ninjamuffin99/ProjectMountain | 5f96e3713fe77ee97e081dfd2f46bba32e526cb7 | 63f41b0345b789b1bd2bf05cb904e66ff9d35631 | refs/heads/master | 2021-01-01T16:22:44.354766 | 2017-07-25T21:06:40 | 2017-07-25T21:06:40 | 97,814,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 8,295 | h | // Generated by Haxe 3.4.0
#ifndef INCLUDED_flixel_FlxG
#define INCLUDED_flixel_FlxG
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
HX_DECLARE_CLASS1(flixel,FlxBasic)
HX_DECLARE_CLASS1(flixel,FlxCamera)
HX_DECLARE_CLASS1(flixel,FlxG)
HX_DECLARE_CLASS1(flixel,FlxGame)
HX_DECLARE_CLASS1(flixel,FlxObject)
HX_DECLARE_CLASS1(flixel,FlxRenderMethod)
HX_DECLARE_CLASS1(flixel,FlxSprite)
HX_DECLARE_CLASS1(flixel,FlxState)
HX_DECLARE_CLASS3(flixel,effects,postprocess,PostProcess)
HX_DECLARE_CLASS2(flixel,group,FlxTypedGroup)
HX_DECLARE_CLASS2(flixel,input,FlxKeyManager)
HX_DECLARE_CLASS2(flixel,input,FlxPointer)
HX_DECLARE_CLASS2(flixel,input,FlxSwipe)
HX_DECLARE_CLASS2(flixel,input,IFlxInputManager)
HX_DECLARE_CLASS3(flixel,input,gamepad,FlxGamepadManager)
HX_DECLARE_CLASS3(flixel,input,keyboard,FlxKeyboard)
HX_DECLARE_CLASS3(flixel,input,mouse,FlxMouse)
HX_DECLARE_CLASS2(flixel,math,FlxRandom)
HX_DECLARE_CLASS2(flixel,math,FlxRect)
HX_DECLARE_CLASS2(flixel,_hx_system,FlxVersion)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,BitmapFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,BitmapLogFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,CameraFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,ConsoleFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,DebuggerFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,InputFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,LogFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,PluginFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,SignalFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,SoundFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,VCRFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,WatchFrontEnd)
HX_DECLARE_CLASS3(flixel,_hx_system,scaleModes,BaseScaleMode)
HX_DECLARE_CLASS2(flixel,util,FlxSave)
HX_DECLARE_CLASS2(flixel,util,IFlxDestroyable)
HX_DECLARE_CLASS2(flixel,util,IFlxPooled)
HX_DECLARE_CLASS3(openfl,_legacy,display,DirectRenderer)
HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObject)
HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObjectContainer)
HX_DECLARE_CLASS3(openfl,_legacy,display,IBitmapDrawable)
HX_DECLARE_CLASS3(openfl,_legacy,display,InteractiveObject)
HX_DECLARE_CLASS3(openfl,_legacy,display,OpenGLView)
HX_DECLARE_CLASS3(openfl,_legacy,display,Sprite)
HX_DECLARE_CLASS3(openfl,_legacy,display,Stage)
HX_DECLARE_CLASS3(openfl,_legacy,events,EventDispatcher)
HX_DECLARE_CLASS3(openfl,_legacy,events,IEventDispatcher)
namespace flixel{
class HXCPP_CLASS_ATTRIBUTES FlxG_obj : public hx::Object
{
public:
typedef hx::Object super;
typedef FlxG_obj OBJ_;
FlxG_obj();
public:
enum { _hx_ClassId = 0x304c4dd1 };
void __construct();
inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="flixel.FlxG")
{ return hx::Object::operator new(inSize,inContainer,inName); }
inline void *operator new(size_t inSize, int extra)
{ return hx::Object::operator new(inSize+extra,false,"flixel.FlxG"); }
hx::ObjectPtr< FlxG_obj > __new() {
hx::ObjectPtr< FlxG_obj > __this = new FlxG_obj();
__this->__construct();
return __this;
}
static hx::ObjectPtr< FlxG_obj > __alloc(hx::Ctx *_hx_ctx) {
FlxG_obj *__this = (FlxG_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(FlxG_obj), false, "flixel.FlxG"));
*(void **)__this = FlxG_obj::_hx_vtable;
return __this;
}
static void * _hx_vtable;
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~FlxG_obj();
HX_DO_RTTI_ALL;
static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);
static bool __SetStatic(const ::String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp);
static void __register();
bool _hx_isInstanceOf(int inClassId);
::String __ToString() const { return HX_HCSTRING("FlxG","\xb5","\x4b","\x97","\x2e"); }
static void __boot();
static bool autoPause;
static bool fixedTimestep;
static Float timeScale;
static int worldDivisions;
static ::flixel::FlxCamera camera;
static ::flixel::_hx_system::FlxVersion VERSION;
static ::flixel::FlxGame game;
static int updateFramerate;
static int drawFramerate;
static ::flixel::FlxRenderMethod renderMethod;
static bool renderBlit;
static bool renderTile;
static Float elapsed;
static Float maxElapsed;
static int width;
static int height;
static ::flixel::_hx_system::scaleModes::BaseScaleMode scaleMode;
static ::flixel::math::FlxRect worldBounds;
static ::flixel::util::FlxSave save;
static ::flixel::math::FlxRandom random;
static ::flixel::input::mouse::FlxMouse mouse;
static ::Array< ::Dynamic> swipes;
static ::flixel::input::keyboard::FlxKeyboard keys;
static ::flixel::input::gamepad::FlxGamepadManager gamepads;
static ::flixel::_hx_system::frontEnds::InputFrontEnd inputs;
static ::flixel::_hx_system::frontEnds::ConsoleFrontEnd console;
static ::flixel::_hx_system::frontEnds::LogFrontEnd log;
static ::flixel::_hx_system::frontEnds::BitmapLogFrontEnd bitmapLog;
static ::flixel::_hx_system::frontEnds::WatchFrontEnd watch;
static ::flixel::_hx_system::frontEnds::DebuggerFrontEnd debugger;
static ::flixel::_hx_system::frontEnds::VCRFrontEnd vcr;
static ::flixel::_hx_system::frontEnds::BitmapFrontEnd bitmap;
static ::flixel::_hx_system::frontEnds::CameraFrontEnd cameras;
static ::flixel::_hx_system::frontEnds::PluginFrontEnd plugins;
static int initialWidth;
static int initialHeight;
static Float initialZoom;
static ::flixel::_hx_system::frontEnds::SoundFrontEnd sound;
static ::flixel::_hx_system::frontEnds::SignalFrontEnd signals;
static void resizeGame(int Width,int Height);
static ::Dynamic resizeGame_dyn();
static void resizeWindow(int Width,int Height);
static ::Dynamic resizeWindow_dyn();
static void resetGame();
static ::Dynamic resetGame_dyn();
static void switchState( ::flixel::FlxState nextState);
static ::Dynamic switchState_dyn();
static void resetState();
static ::Dynamic resetState_dyn();
static bool overlap( ::flixel::FlxBasic ObjectOrGroup1, ::flixel::FlxBasic ObjectOrGroup2, ::Dynamic NotifyCallback, ::Dynamic ProcessCallback);
static ::Dynamic overlap_dyn();
static bool pixelPerfectOverlap( ::flixel::FlxSprite Sprite1, ::flixel::FlxSprite Sprite2,hx::Null< int > AlphaTolerance, ::flixel::FlxCamera Camera);
static ::Dynamic pixelPerfectOverlap_dyn();
static bool collide( ::flixel::FlxBasic ObjectOrGroup1, ::flixel::FlxBasic ObjectOrGroup2, ::Dynamic NotifyCallback);
static ::Dynamic collide_dyn();
static ::flixel::effects::postprocess::PostProcess addPostProcess( ::flixel::effects::postprocess::PostProcess postProcess);
static ::Dynamic addPostProcess_dyn();
static void removePostProcess( ::flixel::effects::postprocess::PostProcess postProcess);
static ::Dynamic removePostProcess_dyn();
static void chainPostProcesses();
static ::Dynamic chainPostProcesses_dyn();
static void openURL(::String URL,::String Target);
static ::Dynamic openURL_dyn();
static void init( ::flixel::FlxGame Game,int Width,int Height,Float Zoom);
static ::Dynamic init_dyn();
static void initRenderMethod();
static ::Dynamic initRenderMethod_dyn();
static void reset();
static ::Dynamic reset_dyn();
static ::flixel::_hx_system::scaleModes::BaseScaleMode set_scaleMode( ::flixel::_hx_system::scaleModes::BaseScaleMode ScaleMode);
static ::Dynamic set_scaleMode_dyn();
static ::flixel::input::mouse::FlxMouse set_mouse( ::flixel::input::mouse::FlxMouse NewMouse);
static ::Dynamic set_mouse_dyn();
static int set_updateFramerate(int Framerate);
static ::Dynamic set_updateFramerate_dyn();
static int set_drawFramerate(int Framerate);
static ::Dynamic set_drawFramerate_dyn();
static bool get_fullscreen();
static ::Dynamic get_fullscreen_dyn();
static bool set_fullscreen(bool Value);
static ::Dynamic set_fullscreen_dyn();
static ::openfl::_legacy::display::Stage get_stage();
static ::Dynamic get_stage_dyn();
static ::flixel::FlxState get_state();
static ::Dynamic get_state_dyn();
static bool get_onMobile();
static ::Dynamic get_onMobile_dyn();
};
} // end namespace flixel
#endif /* INCLUDED_flixel_FlxG */
| [
"[email protected]"
] | |
f8a7605d6536df6676bbd0f6943837a5efa52025 | 2c3d28eb24ab8fb8f2e9c1931356c799f697ac2d | /Stack_and_Queue/nearest_smaller_element.cpp | b8b98f54a60626f861aa7d2d740017c872c1387a | [] | no_license | germal/Coding-InterviewBit | b4e83e26e7c3b895d85120ac248da0b0881b4bb0 | aee990075d0f28f6d8155effd607348e223f5434 | refs/heads/master | 2023-01-13T05:44:36.188426 | 2020-11-21T05:34:29 | 2020-11-21T05:34:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 814 | cpp | vector<int> Solution::prevSmaller(vector<int> &A) {
stack<int> B;
vector<int> ans;
ans.push_back(-1);
for(int i = 0;i < A.size();i++){
if(B.empty()) B.push(A[i]);
else if(A[i] <= B.top()){
while(B.empty() == 0){
if(A[i] <= B.top())
B.pop();
else
break;
}
if(B.empty()){
ans.push_back(-1);
B.push(A[i]);
}
else
{
ans.push_back(B.top());
B.push(A[i]);
}
}
else if(i != 0){
ans.push_back(B.top());
B.push(A[i]);
}
}
return ans;
}
| [
"[email protected]"
] | |
bfcde6c6e7d23717e5ff46e2a04a0d1a9725e9f3 | c843d52872906ef3744b8b944076c9e66da6f8fe | /1016A.cpp | 107cf08b0423d154e62d29a3b38cbdebaf287798 | [] | no_license | ismail-ru-cse-39/hello-world | 991d559db1d383df56948cc34138f2cf2c7e6a7d | 149c3d81880567cf0fdddabf3d39694817824ad4 | refs/heads/master | 2021-01-18T17:24:16.114381 | 2018-10-13T10:36:44 | 2018-10-13T10:36:44 | 86,794,540 | 0 | 0 | null | 2017-03-31T08:34:39 | 2017-03-31T08:09:01 | null | UTF-8 | C++ | false | false | 771 | cpp |
//http://codeforces.com/contest/1016/problem/A
#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d",&a)
int main()
{
int n,m;
int i;
vector<int>vi;
cin>>n>>m;
for(i = 0 ; i < n ; i++){
int tmp;
sc(tmp);
vi.push_back(tmp);
}
//cout<<"HI"<<endl;
//vector<int>vi_cnt;
int vi_cnt[n+1];
int rest = 0;
for(i = 0; i < n ; i++){
if(rest > 0){
vi_cnt[i] = ((vi[i]+rest)/m);
}
else{
vi_cnt[i] = ((vi[i])/m);
}
int tmp = rest;
rest = ((vi[i]+rest)%m);
}
for(i = 0 ; i < n ; i++){
printf("%d ",vi_cnt[i]);
}
cout<<endl;
return 0;
}
| [
"[email protected]"
] | |
c8340a4c8282dc29de3560a359bb5a0d16aac555 | f6439b5ed1614fd8db05fa963b47765eae225eb5 | /chrome/browser/content_settings/content_settings_utils.h | 97ee89a1617524d5a58f6f45a6aeb2063bd6c5db | [
"BSD-3-Clause"
] | permissive | aranajhonny/chromium | b8a3c975211e1ea2f15b83647b4d8eb45252f1be | caf5bcb822f79b8997720e589334266551a50a13 | refs/heads/master | 2021-05-11T00:20:34.020261 | 2018-01-21T03:31:45 | 2018-01-21T03:31:45 | 118,301,142 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,027 | h | // Copyright (c) 2012 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_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_
#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_
#include <string>
#include <utility>
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_pattern.h"
#include "chrome/common/content_settings_types.h"
namespace base {
class Value;
}
class GURL;
class HostContentSettingsMap;
namespace content_settings {
class ProviderInterface;
class RuleIterator;
typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair;
std::string GetTypeName(ContentSettingsType type);
bool GetTypeFromName(const std::string& name,
ContentSettingsType* return_setting);
// Converts |Value| to |ContentSetting|.
ContentSetting ValueToContentSetting(const base::Value* value);
// Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes
// a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT|
// is encoded as a NULL value, so it is not allowed as an integer value.
bool ParseContentSettingValue(const base::Value* value,
ContentSetting* setting);
PatternPair ParsePatternString(const std::string& pattern_str);
std::string CreatePatternString(
const ContentSettingsPattern& item_pattern,
const ContentSettingsPattern& top_level_frame_pattern);
// Caller takes the ownership of the returned |base::Value*|.
base::Value* GetContentSettingValueAndPatterns(
RuleIterator* rule_iterator,
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsPattern* primary_pattern,
ContentSettingsPattern* secondary_pattern);
base::Value* GetContentSettingValueAndPatterns(
const ProviderInterface* provider,
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
const std::string& resource_identifier,
bool include_incognito,
ContentSettingsPattern* primary_pattern,
ContentSettingsPattern* secondary_pattern);
base::Value* GetContentSettingValue(
const ProviderInterface* provider,
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
const std::string& resource_identifier,
bool include_incognito);
ContentSetting GetContentSetting(
const ProviderInterface* provider,
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
const std::string& resource_identifier,
bool include_incognito);
// Populates |rules| with content setting rules for content types that are
// handled by the renderer.
void GetRendererContentSettingRules(const HostContentSettingsMap* map,
RendererContentSettingRules* rules);
} // namespace content_settings
#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_
| [
"[email protected]"
] | |
53d43b9b91b24ebc48fe66734569602998501f04 | d8460da4691cf71f1121565bf6a4bc8cde1bf411 | /ZEngine-Core/Scripting/Script.cpp | f5386f2dc18ac3ef85a298738d9f988151105221 | [] | no_license | blizmax/zengine | 99cae2e35ed5c999cf903e6baa11ecbff1273844 | 907e5029831b0b2c79bea148de971523c1045015 | refs/heads/master | 2022-01-05T05:35:53.380759 | 2019-01-03T01:50:46 | 2019-01-03T01:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,610 | cpp | #include "Script.h"
#include "ScriptSystem.h"
#include <iostream>
#include <fstream>
Script::Script(std::string name) : ZObject(name, ObjectType::SCRIPT)
{
}
bool Script::CompileFromFile(std::string path)
{
std::ifstream in(path, std::ios::in);
if (in.is_open())
{
std::string code((std::istreambuf_iterator<char>(in)), (std::istreambuf_iterator<char>()));
return Compile(code);
}
else
std::cout << "SCRIPT: Failed to open file for compilation for script: " << GetName() << std::endl;
return false;
}
bool Script::Compile(std::string& code)
{
auto scriptSys = ScriptSystem::GetInstance();
auto isolate = scriptSys->GetIsolate();
auto context = scriptSys->GetContext()->GetLocal();
v8::Context::Scope scope(context);
auto source = v8::String::NewFromUtf8(isolate, code.c_str());
auto script = v8::Script::Compile(context, source).ToLocalChecked();
if (script.IsEmpty())
{
std::cout << "SCRIPT: Failed to compile script '" << GetName() << "'" << std::endl;
return false;
}
_scriptObj.Reset(isolate, script->GetUnboundScript());
return true;
}
void Script::Execute()
{
auto scriptSys = ScriptSystem::GetInstance();
auto context = scriptSys->GetContext()->GetLocal();
// Create an execution scope for the script
v8::Context::Scope scope(context);
// Bind the script to the current context
auto localScript = _scriptObj.Get(scriptSys->GetIsolate())->BindToCurrentContext();
// Execute the script
localScript->Run(context);
}
ZObject* Script::CreateInstance(std::string name, ObjectType type)
{
return new Script(name);
}
Script::~Script()
{
_scriptObj.Reset();
}
| [
"[email protected]"
] | |
dbc3942fc147d0547396a0b97cda05956468aead | 5a8bf8d140fa5aa3acc6a8e335f4f2f0974931fc | /uva/543 - Goldbach's Conjecture.cpp | e75d5ea0e24cc52cbc5ee8cf2acd56ee278e24a3 | [
"MIT"
] | permissive | taufique71/sports-programming | 72dbec005f790d8f6b55d1fb030cc3d50ffe7df2 | c29a92b5e5424c7de6f94e302fc6783561de9b3d | refs/heads/master | 2020-03-25T04:43:54.418420 | 2019-10-10T19:51:40 | 2019-10-10T19:51:40 | 134,890,558 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 677 | cpp | #include <iostream>
#define MAX 1000000
using namespace std;
int prime[MAX+10]={1};
void seive()
{
long int i,j;
for(i=0;i<=MAX;i++) prime[i]=1;
prime[0]=0;
prime[1]=0;
for(i=2;i<=MAX;)
{
if((i*i)>MAX) break;
for(j=i+i;j<=MAX;j=j+i) prime[j]=0;
for (i++; !prime[i]; i++);
}
}
void print(long int n)
{
long int i,j;
for(i=3,j=n-i;i<=j;i++,j--)
{
if(prime[i]&&prime[j]) break;
}
cout<<n<<" = "<<i<<" + "<<j<<endl;
}
int main(void)
{
long int n;
seive();
while(cin>>n)
{
if(n==0) break;
print(n);
}
return 0;
}
| [
"[email protected]"
] | |
650480ff89f17f80793ca5e9479566a2fa7dd7e5 | 12210a918a469378443453efbd4e3d9b9801babb | /cpp_basic_examples/hello_area_description/src/main/jni/hello_area_description/mini_timer.h | b58e34ee71cbb6774a1a3713d485a81e17c472e5 | [
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-google-cla",
"LicenseRef-scancode-warranty-disclaimer",
"Libpng",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | JzHuai0108/tango-examples-c | 4f0f04e23a0cd5a4686a04c9382b111aeffcfab0 | 51113f2d88d61749ea396b3f5a4bebbf7912327b | refs/heads/master | 2021-07-01T22:32:28.297409 | 2020-08-11T14:19:22 | 2020-08-11T14:19:22 | 123,386,592 | 4 | 0 | null | 2018-03-01T05:28:21 | 2018-03-01T05:28:21 | null | UTF-8 | C++ | false | false | 399 | h | //
// Created by jhuai on 19-8-11.
//
#ifndef CPP_BASIC_EXAMPLES_MINITIMER_H
#define CPP_BASIC_EXAMPLES_MINITIMER_H
#include <sys/time.h>
namespace timing {
class Timer {
struct timeval start_, end_;
public:
// start timer
Timer();
// reset timer.
void tic();
// stop timer
// return elapsed time
double toc();
};
} // namespace timing
#endif //CPP_BASIC_EXAMPLES_MINITIMER_H
| [
"[email protected]"
] | |
4114658b23abae253e5886e56121ecbe5493bf55 | 69ab565e491c73d55aaaa55b5d802dbbb04e8e3d | /QRD/src/QRD/DBObjects/Record.cpp | edb0ef4525a31722b9997d6c5cc6cbde6fa32360 | [] | no_license | CAt0mIcS/DatabaseManagementSystem | 8cfa82f0f1af77a10f6a3cc9d05549d036c7ac4b | f7dfc950b0ecc914099fac5a4b787fab37ee9a41 | refs/heads/master | 2022-12-25T07:38:10.594944 | 2020-10-09T13:40:54 | 2020-10-09T13:40:54 | 281,762,655 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 835 | cpp | #include <sstream>
#include "Record.h"
namespace QRD
{
bool Record::operator==(const Record& other) const
{
return m_RecordData == other.GetRecordData() && m_RecordId == other.GetRecordId();
}
void Record::DeleteData(unsigned short fieldId)
{
m_RecordData.erase(m_RecordData.begin() + fieldId);
}
std::string Record::ToString() const
{
std::ostringstream ss2;
for (unsigned int i = 0; i < m_RecordData.size(); ++i)
{
ss2 << "\n\t [" << i << "]: " << m_RecordData[i];
}
std::ostringstream ss;
ss << "Record object: "
<< "\n\t[Record::Location]: " << this
<< "\n\t[Record::m_Data]: " << ss2.str()
<< "\n\t[Record::m_RecordId]: " << m_RecordId << '\n';
return ss.str();
}
}
| [
"[email protected]"
] | |
3a199cb6e15715514f287c454528b91f2a207e50 | e2ab2b9def0176a9092c2aeb9c916164cf2e4445 | /AI.cpp | 8b8e89f797fb457cfc8b9f088eb1bda8620e7561 | [] | no_license | Elthron/Perudo | 75829cfd2247f1fd0afcfe2138814d1ccd4fcbe9 | 1cf96a2f353b318fc188956dcb829a1672430b93 | refs/heads/master | 2020-09-16T12:41:16.982823 | 2016-10-14T19:44:04 | 2016-10-14T19:44:04 | 66,290,233 | 0 | 0 | null | 2016-09-02T18:05:04 | 2016-08-22T16:42:58 | C++ | UTF-8 | C++ | false | false | 632 | cpp | #include "AI.h"
AI::AI(unsigned int die_size, std::string _name):
Player(die_size, name)
{}
void AI:notify(Message& message)
{
//call the appropriate function corresponding to the message id
switch(message.id)
{
case 1:
recievePlayerList(message.players_vec);
break;
case 2:
recieveNewBid(message.dice_number_,message.number_of_dice_, message.relevant_player);
break;
case 3:
recieveDiceRoll(message.roll_values);
break;
case 4:
recieveDiceLoss(message.relevant_player);
break;
default:
//bid instruction messages do not need to be handled by AIs
return;
}
} | [
"[email protected]"
] | |
d55a68d0d296fdddb0c0906a7040e63bd0098c4e | 96efae6f60910a17deb08346b33903c0b1fe2403 | /MFC Windows应用程序设计(第3版)/31273MFC Windows应用程序设计(第3版)/教材例题代码/04章例题代码/MyPrj/MyPrj.h | d0aa640a576f913836b1f970910f210acfaf43c9 | [] | no_license | truehaolix/DissectingMFC_SourceCode | bfa38219cc342eed4ddb8e34e1c4ee23bc4d4098 | c9ea97c50af7c2535b04eabf0fc6ec1a46591316 | refs/heads/master | 2021-12-14T21:34:11.132192 | 2017-06-03T05:43:50 | 2017-06-03T05:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,345 | h | // MyPrj.h : main header file for the MYPRJ application
//
#if !defined(AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_)
#define AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CMyPrjApp:
// See MyPrj.cpp for the implementation of this class
//
class CMyPrjApp : public CWinApp
{
public:
CMyPrjApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyPrjApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CMyPrjApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_)
| [
"[email protected]"
] | |
0b704fc268fb225fdb3ac9e1eeff19c20a8662ba | a0e65f99c7928552d16b46966046ea63f48810b3 | /hw3/tool/print_mat.cpp | f7fc4c5df7a0fed6685c970e48142350ffaee379 | [] | no_license | SuXY-O-O/ParallerComputing | 72758f293ce30f77db72ad9f5425a3a480e8eb7d | b2f44aed3162cd400c6f09c1278e3bd567ba3b73 | refs/heads/master | 2023-05-09T05:43:15.145529 | 2021-06-06T07:29:30 | 2021-06-06T07:29:30 | 374,295,507 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,335 | cpp | // print.cxx
// print the double precision matrix from the input file
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
int main(int argc, char **argv)
{
FILE *fh;
if (argc < 2)
{
printf("Invalid arguments!\n");
printf("Run the program as ./print filename\n");
exit(-1);
}
if (!(fh = fopen(argv[1], "r")))
{
printf("Can't open file %s\n", argv[1]);
exit(-1);
}
struct stat fstat;
int n1, n2, fsize;
char *fstream;
stat(argv[1], &fstat);
fsize = fstat.st_size;
fstream = (char *)malloc(fsize);
fread(fstream, sizeof(char), fsize, fh);
n1 = ((int *)fstream)[0];
n2 = ((int *)fstream)[1];
if (n1 <= 0 || n2 <= 0)
{
printf("Matrix size error, %dx%d\n", n1, n2);
exit(-1);
}
if (fsize < (sizeof(int) * 2 + sizeof(double) * n1 * n2))
{
printf("Actual size mismatches with stated size\n");
exit(-1);
}
double *A = (double *)(fstream + sizeof(int) * 2);
printf(" ---- %s: %d*%d Matrix -----\n", argv[1], n1, n2);
for (int i = 0; i < n1; i++)
{
for (int j = 0; j < n2; j++)
{
printf("%.4f ", *(A + i * n2 + j)); // A[i,j]
}
printf("\n");
}
free(fstream);
fclose(fh);
return 0;
} | [
"[email protected]"
] | |
259fc0019e45f0ffca6627bc7503950ba6e6f866 | eb2ff965bb3a2deec83a99d28a79bfd68e57f072 | /mainwidget.h | 20a3c0fd959bcc34fa76907df79a3432ef75d246 | [] | no_license | hermixy/PM-Qt | c2f31c9ad90c5005dcb8740b2c576a1f22f45f77 | e98c6f35057c854b2e703f67feefe12ebc700d72 | refs/heads/master | 2021-01-15T11:02:56.841382 | 2014-11-27T22:32:23 | 2014-11-27T22:32:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,009 | h | // Author: Dmitry Kukovinets ([email protected])
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QtWidgets>
#include "passwordlistwidget.h"
#include "passwordcontentwidget.h"
#include "settingssaver.h"
class MainWidget: public QSplitter
{
Q_OBJECT
// Properties
Q_PROPERTY(PasswordListWidget *passwordListWidget
READ passwordListWidget
DESIGNABLE false
SCRIPTABLE false
USER false);
Q_PROPERTY(PasswordContentWidget *passwordContentWidget
READ passwordContentWidget
DESIGNABLE false
SCRIPTABLE false
USER false);
public:
MainWidget(QWidget *parent = nullptr);
void readSettings(QSettings &settings, const QString &prefix = "");
void writeSettings(QSettings &settings, const QString &prefix = "") const;
virtual PasswordListWidget * passwordListWidget();
virtual PasswordContentWidget * passwordContentWidget();
private:
PasswordListWidget *passwordListWidget_;
PasswordContentWidget *passwordContentWidget_;
};
#endif // MAINWIDGET_H
| [
"[email protected]"
] | |
d580940c7056640554342e4afdbe83d597f64844 | 5deaaee37871d0268328f889a74ffe4cee5c6170 | /ArrayOfStructure.cpp | 2b3c82d9ef53910d7a223cd272f4e3c96fbe20bc | [] | no_license | harshitbansal373/c-plus-plus | 096fe8cf2069fb5c3fa2b7ccf1732a5edcede00e | 43c2b851e748142d5a18498d743d746a7ed63a61 | refs/heads/master | 2023-01-05T14:31:42.397967 | 2020-10-28T11:12:51 | 2020-10-28T11:12:51 | 158,512,426 | 5 | 32 | null | 2020-12-09T06:00:48 | 2018-11-21T08:05:06 | C++ | UTF-8 | C++ | false | false | 430 | cpp | //array of structure
#include<conio.h>
#include<iostream>
using namespace std;
struct record{
char name[100];
int roll_no;
char branch[10];
};
int main(){
int i;
struct record r[5];
cout<<"enter the name, roll no. and branch";
for(i=0;i<5;i++){
cin>>r[i].name>>r[i].roll_no>>r[i].branch;
}
cout<<"details of students are under";
for(i=0;i<5;i++){
cout<<"\n"<<r[i].name<<r[i].roll_no<<r[i].branch;
}
return 0;
}
| [
"[email protected]"
] | |
34384a730e41f86283f53b9785247f9d585c04ab | d65c5cfaee4abf3a8403fe338d0338e068b24885 | /Source/ParicialICC/MainPlayer.h | c28eb26000afd192d8e6c93906c7db63fa38f699 | [] | no_license | LordWake/Unreal-2017-FPS_First_Game | 7be471bbb904d267d21b289273ce70ed9509f0c4 | da58dcdbc221f06b26de2da2aaee97283d360dc2 | refs/heads/main | 2023-05-17T14:24:45.665172 | 2020-12-28T02:36:01 | 2020-12-28T02:36:01 | 302,237,697 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,299 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Engine.h"
#include "Engine/World.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
#include "PlayerBullet.h"
#include "MyUI.h"
#include "GameFramework/Character.h"
#include "MainPlayer.generated.h"
UCLASS()
class PARICIALICC_API AMainPlayer : public ACharacter
{
GENERATED_BODY()
public:
AMainPlayer();
float shotTimer;
float rifleShotTimer;
float shieldTimer;
float rifleAvailableTimer;
float waitForGuns;
float waitForMove;
FVector gunSocketLocation;
FVector rifleSocketLocation;
FRotator gunSocketRotation;
FRotator rifleSocketRotation;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float playerLife;
UPROPERTY(EditAnywhere)
float playerMaxLife;
UPROPERTY(EditAnywhere)
float myGunCoolDown;
UPROPERTY(EditAnywhere)
float myRifleCoolDown;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UParticleSystemComponent * gunMuzzle;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UParticleSystemComponent * rifleMuzzle;
UPROPERTY(EditAnywhere)
TSubclassOf<class APlayerBullet> prefabBullet;
UPROPERTY(EditAnywhere)
TSubclassOf<class APlayerBullet> prefabRifleBullet;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* myGun;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* myRifle;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* myShield;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* freezeShield;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* rifleLaser;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* gunLaser;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UAudioComponent* damageAudio;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UAudioComponent* gunAudio;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UAudioComponent* rifleAudio;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UAudioComponent* powerUpAudio;
protected:
virtual void BeginPlay() override;
bool canShot;
bool canShotRifle;
bool playerIsDead;
bool shieldActivated;
bool rifleIsAvailable;
bool gunLessActivated;
bool freezePlayerActivated;
UCameraComponent* myCamera;
FVector position;
FRotator viewRotation;
public:
virtual void Tick(float DeltaTime) override;
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
void ResetLevelOne();
void ResetLevelTwo();
void ResetLevelThree();
void MoveFront(float vertical);
void MoveRight(float horizontal);
void RotatePlayer(float rotation);
void RotateCameraPlayer(float rotation);
void Shoot();
void RifleShoot();
void StopRifleShoot();
void StopShoot();
void ShootCoolDown(float deltaTimer);
void RifleCoolDown(float deltaTimer);
void StartJump();
void EndJump();
void UpdatePlayerHUDLife();
void CheckPlayerLife();
void HealMyPlayer(float lifeToHeal);
void EnableShield();
void DisableShield(float timer);
void EnableRifle();
void DisableRifle(float timer);
void EnableMyWeapons(float timer);
void EnableMyMovement(float timer);
UFUNCTION(BlueprintCallable)
void TakePlayerDamage(float damage);
UFUNCTION(BlueprintCallable)
void GunLess();
UFUNCTION(BlueprintCallable)
void FreezeMyPlayer();
};
| [
"[email protected]"
] | |
35d8b8d365c7ef0228ac37710372faefba8707ad | 04e5b6df2ee3bcfb7005d8ec91aab8e380333ac4 | /clang_codecompletion/llvm/Object/IRObjectFile.h | db47960237a0159a43c47afe60bf941a6ae72bbd | [
"MIT"
] | permissive | ColdGrub1384/Pyto | 64e2a593957fd640907f0e4698d430ea7754a73e | 7557485a733dd7e17ba0366b92794931bdb39975 | refs/heads/main | 2023-08-01T03:48:35.694832 | 2022-07-20T14:38:45 | 2022-07-20T14:38:45 | 148,944,721 | 884 | 157 | MIT | 2023-02-26T21:34:04 | 2018-09-15T22:29:07 | C | UTF-8 | C++ | false | false | 2,915 | h | //===- IRObjectFile.h - LLVM IR object file implementation ------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares the IRObjectFile template class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_OBJECT_IROBJECTFILE_H
#define LLVM_OBJECT_IROBJECTFILE_H
#include "llvm/ADT/PointerUnion.h"
#include "llvm/Object/IRSymtab.h"
#include "llvm/Object/ModuleSymbolTable.h"
#include "llvm/Object/SymbolicFile.h"
namespace llvm {
class BitcodeModule;
class Module;
namespace object {
class ObjectFile;
class IRObjectFile : public SymbolicFile {
std::vector<std::unique_ptr<Module>> Mods;
ModuleSymbolTable SymTab;
IRObjectFile(MemoryBufferRef Object,
std::vector<std::unique_ptr<Module>> Mods);
public:
~IRObjectFile() override;
void moveSymbolNext(DataRefImpl &Symb) const override;
Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override;
Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
basic_symbol_iterator symbol_begin() const override;
basic_symbol_iterator symbol_end() const override;
StringRef getTargetTriple() const;
static bool classof(const Binary *v) {
return v->isIR();
}
using module_iterator =
pointee_iterator<std::vector<std::unique_ptr<Module>>::const_iterator,
const Module>;
module_iterator module_begin() const { return module_iterator(Mods.begin()); }
module_iterator module_end() const { return module_iterator(Mods.end()); }
iterator_range<module_iterator> modules() const {
return make_range(module_begin(), module_end());
}
/// Finds and returns bitcode embedded in the given object file, or an
/// error code if not found.
static Expected<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj);
/// Finds and returns bitcode in the given memory buffer (which may
/// be either a bitcode file or a native object file with embedded bitcode),
/// or an error code if not found.
static Expected<MemoryBufferRef>
findBitcodeInMemBuffer(MemoryBufferRef Object);
static Expected<std::unique_ptr<IRObjectFile>> create(MemoryBufferRef Object,
LLVMContext &Context);
};
/// The contents of a bitcode file and its irsymtab. Any underlying data
/// for the irsymtab are owned by Symtab and Strtab.
struct IRSymtabFile {
std::vector<BitcodeModule> Mods;
SmallVector<char, 0> Symtab, Strtab;
irsymtab::Reader TheReader;
};
/// Reads a bitcode file, creating its irsymtab if necessary.
Expected<IRSymtabFile> readIRSymtab(MemoryBufferRef MBRef);
}
}
#endif
| [
"[email protected]"
] | |
1ccecc19ba0ee47d600671ebfdf0fd493d6d268e | ec3ef9226427cdb361b8dd98a4d3b39fea6653d6 | /src/qt/bitcoinamountfield.cpp | 866b364e714ee3936d380a77ab50c2b876b7cbee | [
"MIT"
] | permissive | investhubcoin/Invest-Hub-Coin | 96e4fe9f839d107c5f4f990932c965abce419f38 | 7845dd9798302ca2631a723cb8434c0a71c03de7 | refs/heads/master | 2020-05-29T21:41:29.128492 | 2019-05-30T09:50:48 | 2019-05-30T09:50:48 | 187,916,304 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,182 | cpp | // Copyright (c) 2011-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bitcoinamountfield.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "qvaluecombobox.h"
#include <QAbstractSpinBox>
#include <QApplication>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLineEdit>
/** QSpinBox that uses fixed-point numbers internally and uses our own
* formatting/parsing functions.
*/
class AmountSpinBox : public QAbstractSpinBox
{
Q_OBJECT
public:
explicit AmountSpinBox(QWidget* parent) : QAbstractSpinBox(parent),
currentUnit(BitcoinUnits::IHC),
singleStep(100000) // satoshis
{
setAlignment(Qt::AlignRight);
connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged()));
}
QValidator::State validate(QString& text, int& pos) const
{
if (text.isEmpty())
return QValidator::Intermediate;
bool valid = false;
parse(text, &valid);
/* Make sure we return Intermediate so that fixup() is called on defocus */
return valid ? QValidator::Intermediate : QValidator::Invalid;
}
void fixup(QString& input) const
{
bool valid = false;
CAmount val = parse(input, &valid);
if (valid) {
input = BitcoinUnits::format(currentUnit, val, false, BitcoinUnits::separatorAlways);
lineEdit()->setText(input);
}
}
CAmount value(bool* valid_out = 0) const
{
return parse(text(), valid_out);
}
void setValue(const CAmount& value)
{
lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways));
emit valueChanged();
}
void stepBy(int steps)
{
bool valid = false;
CAmount val = value(&valid);
val = val + steps * singleStep;
val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney());
setValue(val);
}
void setDisplayUnit(int unit)
{
bool valid = false;
CAmount val = value(&valid);
currentUnit = unit;
if (valid)
setValue(val);
else
clear();
}
void setSingleStep(const CAmount& step)
{
singleStep = step;
}
QSize minimumSizeHint() const
{
if (cachedMinimumSizeHint.isEmpty()) {
ensurePolished();
const QFontMetrics fm(fontMetrics());
int h = lineEdit()->minimumSizeHint().height();
int w = fm.width(BitcoinUnits::format(BitcoinUnits::IHC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
w += 2; // cursor blinking space
QStyleOptionSpinBox opt;
initStyleOption(&opt);
QSize hint(w, h);
QSize extra(35, 6);
opt.rect.setSize(hint + extra);
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size();
// get closer to final result by repeating the calculation
opt.rect.setSize(hint + extra);
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size();
hint += extra;
hint.setHeight(h);
opt.rect = rect();
cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this).expandedTo(QApplication::globalStrut());
}
return cachedMinimumSizeHint;
}
private:
int currentUnit;
CAmount singleStep;
mutable QSize cachedMinimumSizeHint;
/**
* Parse a string into a number of base monetary units and
* return validity.
* @note Must return 0 if !valid.
*/
CAmount parse(const QString& text, bool* valid_out = 0) const
{
CAmount val = 0;
bool valid = BitcoinUnits::parse(currentUnit, text, &val);
if (valid) {
if (val < 0 || val > BitcoinUnits::maxMoney())
valid = false;
}
if (valid_out)
*valid_out = valid;
return valid ? val : 0;
}
protected:
bool event(QEvent* event)
{
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Comma) {
// Translate a comma into a period
QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count());
return QAbstractSpinBox::event(&periodKeyEvent);
}
}
return QAbstractSpinBox::event(event);
}
StepEnabled stepEnabled() const
{
StepEnabled rv = 0;
if (isReadOnly()) // Disable steps when AmountSpinBox is read-only
return StepNone;
if (text().isEmpty()) // Allow step-up with empty field
return StepUpEnabled;
bool valid = false;
CAmount val = value(&valid);
if (valid) {
if (val > 0)
rv |= StepDownEnabled;
if (val < BitcoinUnits::maxMoney())
rv |= StepUpEnabled;
}
return rv;
}
signals:
void valueChanged();
};
#include "bitcoinamountfield.moc"
BitcoinAmountField::BitcoinAmountField(QWidget* parent) : QWidget(parent),
amount(0)
{
amount = new AmountSpinBox(this);
amount->setLocale(QLocale::c());
amount->installEventFilter(this);
amount->setMaximumWidth(170);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(amount);
unit = new QValueComboBox(this);
unit->setModel(new BitcoinUnits(this));
layout->addWidget(unit);
layout->addStretch(1);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
setFocusPolicy(Qt::TabFocus);
setFocusProxy(amount);
// If one if the widgets changes, the combined content changes as well
connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int)));
// Set default based on configuration
unitChanged(unit->currentIndex());
}
void BitcoinAmountField::clear()
{
amount->clear();
unit->setCurrentIndex(0);
}
void BitcoinAmountField::setEnabled(bool fEnabled)
{
amount->setEnabled(fEnabled);
unit->setEnabled(fEnabled);
}
bool BitcoinAmountField::validate()
{
bool valid = false;
value(&valid);
setValid(valid);
return valid;
}
void BitcoinAmountField::setValid(bool valid)
{
if (valid)
amount->setStyleSheet("");
else
amount->setStyleSheet(STYLE_INVALID);
}
bool BitcoinAmountField::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::FocusIn) {
// Clear invalid flag on focus
setValid(true);
}
return QWidget::eventFilter(object, event);
}
QWidget* BitcoinAmountField::setupTabChain(QWidget* prev)
{
QWidget::setTabOrder(prev, amount);
QWidget::setTabOrder(amount, unit);
return unit;
}
CAmount BitcoinAmountField::value(bool* valid_out) const
{
return amount->value(valid_out);
}
void BitcoinAmountField::setValue(const CAmount& value)
{
amount->setValue(value);
}
void BitcoinAmountField::setReadOnly(bool fReadOnly)
{
amount->setReadOnly(fReadOnly);
unit->setEnabled(!fReadOnly);
}
void BitcoinAmountField::unitChanged(int idx)
{
// Use description tooltip for current unit for the combobox
unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());
// Determine new unit ID
int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt();
amount->setDisplayUnit(newUnit);
}
void BitcoinAmountField::setDisplayUnit(int newUnit)
{
unit->setValue(newUnit);
}
void BitcoinAmountField::setSingleStep(const CAmount& step)
{
amount->setSingleStep(step);
}
| [
"[email protected]"
] | |
cb500b328d62ec582adca0a694e582a83b3c0459 | e372d895d7a55b9031403ce04822ae1c36ab055f | /d05/ex02/Bureaucrat.hpp | 25b4cc79a0fdfd191c2cae2584abf1f9b4006480 | [] | no_license | maryna-kryshchuk/CPP-Piscine | 9b74766a5aa31dbf0ff7026a86b5bdb9a9e9f09f | 1bd945498f5d7ec2809b43ee77eea520ede4cee6 | refs/heads/master | 2021-09-17T14:00:19.635452 | 2018-07-02T11:31:03 | 2018-07-02T11:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,055 | hpp | // ************************************************************************** //
// //
// ::: :::::::: //
// Bureaucrat.hpp :+: :+: :+: //
// +:+ +:+ +:+ //
// By: avolgin <[email protected]> +#+ +:+ +#+ //
// +#+#+#+#+#+ +#+ //
// Created: 2018/06/25 14:51:04 by avolgin #+# #+# //
// Updated: 2018/06/26 16:27:45 by avolgin ### ########.fr //
// //
// ************************************************************************** //
#ifndef BUREAUCRAT_HPP
# define BUREAUCRAT_HPP
#include <iostream>
#include "Form.hpp"
class Form;
class Bureaucrat {
public:
class GradeTooHighException : public std::exception{
public:
GradeTooHighException(void)throw();
~GradeTooHighException(void)throw();
GradeTooHighException(const GradeTooHighException & obj)throw();
virtual const char * what() const throw();
};
class GradeTooLowException : public std::exception{
public:
virtual const char * what() const throw();
GradeTooLowException(void)throw();
~GradeTooLowException(void)throw();
GradeTooLowException(const GradeTooLowException & obj)throw();
};
Bureaucrat(std::string const & name, int grade);
Bureaucrat(const Bureaucrat & obj);
virtual void executeForm(Form const & form)const;
virtual ~Bureaucrat(void);
virtual std::string getName(void) const;
virtual void addGrade(int);
virtual void subGrade(int);
virtual int getGrade(void) const;
Bureaucrat & operator=(Bureaucrat const &);
void signForm(Form &)throw();
private:
Bureaucrat(void);
std::string _name;
int _grade;
};
std::ostream & operator<<(std::ostream & o, Bureaucrat const & rhs);
#endif
| [
"[email protected]"
] | |
00ed78ec3e9a90601449ccfc56a5a7e8069a366d | 3fa1397b95e38fb04dac5e009d70c292deff09a9 | /BaiTap_KTLT_0081_48/BaiTap_KTLT_0081_48.h | cf885e43e2b5eb0a25df8f396fb24b30bd08c38b | [] | no_license | nguyennhattruong96/BiboTraining_BaiTap_KTLT_Thay_NTTMKhang | 61b396de5dc88cdad0021036c7db332eec26b5f3 | 1cac487672de9d3c881a8afdc410434a5042c128 | refs/heads/master | 2021-01-16T18:47:05.754323 | 2017-10-13T11:15:01 | 2017-10-13T11:15:01 | 100,113,344 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | h | #ifndef __BaiTap_KTLT_0081_48_H__
#define __BaiTap_KTLT_0081_48_H__
#include <iostream>
#include <string>
using namespace std;
#pragma once
int Input(string sMessage);
void Tich(int n);
#endif // !__BaiTap_KTLT_0081_48_H__
| [
"[email protected]"
] | |
0b2e8029550d11608e1afc71fde7ab3582883768 | ad822f849322c5dcad78d609f28259031a96c98e | /SDK/OrganicPOI_Radiated_Crust_functions.cpp | 167d17f63c8f7839f0b738eee37ac8ebe18ac382 | [] | no_license | zH4x-SDK/zAstroneer-SDK | 1cdc9c51b60be619202c0258a0dd66bf96898ac4 | 35047f506eaef251a161792fcd2ddd24fe446050 | refs/heads/main | 2023-07-24T08:20:55.346698 | 2021-08-27T13:33:33 | 2021-08-27T13:33:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 861 | cpp |
#include "../SDK.h"
// Name: Astroneer-SDK, Version: 1.0.0
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------
// Function OrganicPOI_Radiated_Crust.OrganicPOI_Radiated_Crust_C.UserConstructionScript
// (Event, Public, BlueprintCallable, BlueprintEvent)
void AOrganicPOI_Radiated_Crust_C::UserConstructionScript()
{
static auto fn = UObject::FindObject<UFunction>("Function OrganicPOI_Radiated_Crust.OrganicPOI_Radiated_Crust_C.UserConstructionScript");
AOrganicPOI_Radiated_Crust_C_UserConstructionScript_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"[email protected]"
] | |
31197b839eaa9e1e45222dc71259fc793ca049a0 | 3cea356ef76eb8ff75e65afa4bd6368b7c94b064 | /Projects/VideoGameProject/Obstacle.h | ab6f654b806ae18db9a0868ab3d025a893331759 | [] | no_license | Jacophobia/OpenGL | e6961be528d9191c2d43b6ec449e221d408ad601 | 26b906115d2e918b07001f8fd9cb9f3d326fd2c1 | refs/heads/main | 2023-08-28T22:29:50.591405 | 2021-11-02T05:18:57 | 2021-11-02T05:18:57 | 423,021,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 141 | h | #ifndef OBSTACLE_H
#define OBSTACLE_H
#include "CollidableDynamicObject.h"
class Obstacle :
public CollidableDynamicObject
{
};
#endif | [
"[email protected]"
] | |
6cff4452ac19bae4813bc72b8d585a7c49543f3e | d4881694449a8c8c7925bdc5c45ed9909d36edba | /Project1/Project1/brizaaaa.cpp | 5f3bd47444a791d3957e9326d505abde64cfe89d | [] | no_license | Silentbroo/Projects.quiz | 46d7b17b7c576425ba05b4c2ab6e4a99a96c265a | d66532f05f5faa3c7d16cb4c6875d344cf9eb27d | refs/heads/master | 2021-01-18T13:12:56.060225 | 2017-05-19T14:45:29 | 2017-05-19T14:45:29 | 80,738,757 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,762 | cpp | #include <stdio.h>
#include <allegro5/allegro.h>
#include <cmath>
const float FPS = 100;
const int SCREEN_W = 640;
const int SCREEN_H = 480;
//change this number to change the size of the "marker tip" that draws the shape!
const int BOUNCER_SIZE = 15;
int main(int argc, char **argv) {
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_BITMAP *bouncer = NULL;
float bouncer_x = SCREEN_W / 2.0 - BOUNCER_SIZE / 2.0;
float bouncer_y = SCREEN_H / 2.0 - BOUNCER_SIZE / 2.0;
float bouncer_dx = -4.0, bouncer_dy = 4.0;
bool redraw = true;
double t = 1;
al_init();
timer = al_create_timer(1.0 / FPS);
display = al_create_display(SCREEN_W, SCREEN_H);
bouncer = al_create_bitmap(BOUNCER_SIZE, BOUNCER_SIZE);
al_set_target_bitmap(bouncer);
al_clear_to_color(al_map_rgb(255, 0, 255));
al_set_target_bitmap(al_get_backbuffer(display));
event_queue = al_create_event_queue();
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_timer_event_source(timer));
//change the numbers to change the background color, 000 is black
al_clear_to_color(al_map_rgb(67, 5, 9));
al_flip_display();
al_start_timer(timer);
while (1)
{
t++;
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if (ev.type == ALLEGRO_EVENT_TIMER) {
if (bouncer_x < 0 || bouncer_x > SCREEN_W - BOUNCER_SIZE) {
bouncer_dx = -bouncer_dx;
}
if (bouncer_y < 0 || bouncer_y > SCREEN_H - BOUNCER_SIZE) {
bouncer_dy = -bouncer_dy;
}
//////////////////////////////////////////////////////////////////////////////////////////////
//here's the parametric equations that determine the shape!!
bouncer_x = 250 + .25*(cos(t) + t*sin(t));
bouncer_y = 250 + (.25*(sin(t) - t*cos(t)))*-1;
/////////////////////////////////////////////////////////////////////////////////////////////////////
redraw = true;
}
else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
}
if (redraw && al_is_event_queue_empty(event_queue)) {
redraw = false;
//a well-placed if statement here might make it blink
//uncommenting this line makes it moving dots instead of picture
//also, change the number values to change the background color
// al_clear_to_color(al_map_rgb(0,0,0));
al_set_target_bitmap(bouncer);
//mess with this last line here to change colors
al_clear_to_color(al_map_rgb(90, t, 110));
al_set_target_bitmap(al_get_backbuffer(display));
al_draw_bitmap(bouncer, bouncer_x, bouncer_y, 1);
al_flip_display();
}
}
al_destroy_bitmap(bouncer);
al_destroy_timer(timer);
al_destroy_display(display);
al_destroy_event_queue(event_queue);
return 0;
}
| [
"Game110AM@605-110-STU21"
] | Game110AM@605-110-STU21 |
81ddf4409a30e3ac5f282b5c91a25453e02e2e8e | 553839a117f0ffc74615ee43ba98e028c85f83c9 | /Chess/Knight.cpp | a1363bebabab3b576e796ba23fd8cc353168f5be | [] | no_license | AleksandarK837/Chess-App | 3ad570bdcddcd074280ab04a85a680c478ab9335 | ab1c6a02a23a32984b5f3d43cb0a765b581123ec | refs/heads/master | 2021-05-22T13:26:54.472054 | 2020-07-15T18:01:43 | 2020-07-15T18:01:43 | 252,939,670 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 748 | cpp | #include "Knight.h"
Knight::Knight(int row, int column, Color color) : Figure(row, column, color)
{
}
void Knight::moveTo(int row, int column)
{
if (!isValidPosition(row, column))
{
throw std::logic_error("Position is not valid!\n");
}
// we move horse (2 steps up/down and 1 aside) or (1 step up/down and 2 aside)
int absRow = abs(this->row - row);
int absCol = abs(this->column - column);
if ((absRow == 2 && absCol == 1) || (absRow == 1 && absCol == 2))
{
setRow(row);
setColumn(column);
}
else
{
throw std::logic_error("Invalid Knight Position!\n");
}
}
Figure * Knight::clone() const
{
return new Knight(*this);
}
std::string Knight::getFigureType() const
{
return "Knight";
}
| [
"[email protected]"
] | |
8c82ed972acc620b86f663b9b5003a476934b108 | 4145500714b175cd40f6ecbd215635b5b859241f | /engine/XEffeEngine/XControl/XControlBasic.cpp | 7f979612b64f0c9e03760bf6fb3753c605240779 | [] | no_license | QiangJi/XEffect2D | 3fbb1e5f1a3a7c94f9d1ab3abb57943fa9da7b62 | bf7224542d8bb48de19b15a0b06a094bc78bd9f5 | refs/heads/master | 2020-12-13T12:52:53.945387 | 2014-04-22T08:45:37 | 2014-04-22T08:45:37 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,380 | cpp | //++++++++++++++++++++++++++++++++
//Author: 贾胜华(JiaShengHua)
//Version: 1.0.0
//Date: See the header file.
//--------------------------------
#include "XControlBasic.h"
_XControlBasic::_XControlBasic()
:m_mouseRect(0.0f,0.0f,1.0f,1.0f) //控件的鼠标响应范围
,m_size(1.0f,1.0f) //控件的大小
,m_position(0.0f,0.0f) //控件的位置
,m_color(1.0f,1.0f,1.0f,1.0f) //控件的颜色
,m_isEnable(0) //控件是否有效,有效的物件才能设置下面的属性
,m_isVisiable(0) //控件是否可见,可见的物件才能设置下面的属性
,m_isActive(0) //控件是否处于激活状态,激活的物件才能接收控制信号
,m_isBeChoose(0)
{
static int controlOrder = 0;
controlOrder ++;
m_objectID = controlOrder;
}
_XBool _XControlBasic::setACopy(const _XControlBasic & temp)
{
m_mouseRect = temp.m_mouseRect; //控件的鼠标响应范围
m_size = temp.m_size; //控件的大小
m_position = temp.m_position; //控件的位置
m_color = temp.m_color; //控件的颜色
m_isEnable = temp.m_isEnable; //控件是否有效,有效的物件才能设置下面的属性
m_isVisiable = temp.m_isVisiable; //控件是否可见,可见的物件才能设置下面的属性
m_isActive = temp.m_isActive; //控件是否处于激活状态,激活的物件才能接收控制信号
m_isBeChoose = temp.m_isBeChoose;
return XTrue;
} | [
"[email protected]"
] | |
368d2ad75a8c3796852c1e978c948d023ada570a | 68e794d0ef476f13c77b2ad912c08f9a2bf4205e | /tests/tests/cookie_encoding.cpp | 10d5b64704600032edb3634c188399b45fdd7c89 | [] | no_license | omerhorev/cryptopals | 8fbd829eacd038b6fe0f2c4e2fff63df4d274c02 | 3ab6ec686d8f2f319f7a0e3b7014a9156742e8ca | refs/heads/master | 2020-06-19T11:23:13.414944 | 2019-12-28T12:20:13 | 2019-12-28T12:20:13 | 196,691,133 | 2 | 0 | null | 2019-11-17T10:16:21 | 2019-07-13T07:16:33 | C++ | UTF-8 | C++ | false | false | 1,181 | cpp | //
// Created by omerh on 24/08/2019.
//
#include <gtest/gtest.h>
#include "utils/cookie_encoding.h"
struct example_object
{
int foo;
char baz[4];
float zap;
};
namespace utils
{
template<>
class cookie_encoder<example_object> : internal::encode_cookie_base
{
public:
std::string encode(const example_object &val)
{
std::string s;
s += encode_field("baz", val.baz);
s += encode_field("foo", val.foo);
s += encode_field("zap", val.zap);
return s;
}
void decode(const std::string &string, example_object &obj)
{
decode_field(string, "baz", obj.baz);
decode_field(string, "foo", obj.foo);
decode_field(string, "zap", obj.zap);
}
};
}
TEST(cookie, encode)
{
example_object obj1 = {};
obj1.zap = 0.5;
obj1.baz[0] = 'a';
obj1.baz[1] = 'b';
obj1.baz[2] = 0;
obj1.foo = 3;
example_object obj2 = {};
utils::decode_as_cookie(utils::encode_as_cookie(obj1), obj2);
ASSERT_EQ(obj1.zap, obj2.zap);
ASSERT_EQ(obj1.foo, obj2.foo);
ASSERT_STREQ(obj1.baz, obj2.baz);
} | [
"[email protected]"
] | |
2f6ae0c8eaea4f957e4707ed6562bf5ce93aa0fb | ab08c44b635f24ab08aee1de18b9caac07a230f0 | /EscapeBuilding 4.17/Source/EscapeBuilding/OpenDoor.cpp | 2143e0471ddbc39c56571185abea35b6b8072b09 | [] | no_license | Mkaral/repos | 50ea4d103ed72612209e95fc816e93d73048ae90 | fa4103621737dcb86759451c284d364895fb1ad5 | refs/heads/master | 2021-01-16T18:22:12.519942 | 2017-08-16T08:23:42 | 2017-08-16T08:23:42 | 100,064,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,199 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "OpenDoor.h"
// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
Owner = GetOwner();
ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
}
void UOpenDoor::OpenDoor()
{
Owner->SetActorRotation(FRotator(0.0f, openAngle, 0.0f));
}
// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
LastDoorOpenTime = GetWorld()->GetTimeSeconds();
}
if (GetWorld()->GetTimeSeconds() - LastDoorOpenTime > DoorCloseDelay)
{
CloseDoor();
}
}
void UOpenDoor::CloseDoor()
{
Owner->SetActorRotation(FRotator(0.0f, 0.0f, 0.0f));
}
| [
"[email protected]"
] | |
5f1769a8775251f1993c0fcc09995d0ca5247406 | a80db26373b943e5adf764453a534925592b613d | /src/remote_control_server/main.cc | 2a50056743eeacb144da331cf07397f3e99392dc | [] | no_license | 20496e76696e6369626c65/qt_simple_teamviewer | 34b3c808f3730adc83d48efa7521742ccdb217c8 | ac21c87aa7920e8408b333bb6792cdd2de5bd4ed | refs/heads/master | 2020-04-30T18:21:06.496477 | 2019-03-21T19:02:24 | 2019-03-21T19:02:24 | 177,007,149 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 333 | cc | #include <QApplication>
#include "../include/remote_control_server.h"
int main( int argc, char* argv[] ) {
QApplication a( argc, argv );
RemoteControlServer server;
if( !server.Start() ) {
qDebug() << "Server failed to start";
return 1;
}
qDebug() << "Server started";
return a.exec();
}
| [
"[email protected]"
] | |
a9b40f884b0523d8615290e1c0b8616a5a203c3e | fe7466fdc3f8251aa049268638e9b81d59161fe5 | /Linux C++/Parameter_BinningHV2/Grab_BinningHV2.cpp | cce14c6c8efda7b2fbcdb2e031b41bdbf3ddb7ac | [] | no_license | Setsu00/SentechSDK_FunctionSample | a4eb5664caf6a66813cf6e8e92d435cb800d1bad | 75fc81af00f0c6a400a25449fa5a351895676302 | refs/heads/master | 2023-03-11T08:40:14.215138 | 2023-02-02T03:06:03 | 2023-02-02T03:06:03 | 187,120,246 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,530 | cpp | /*
BinningHV2: Set Camera Binning Horizontal / Binning Vertical to 2
*/
#define ENABLED_ST_GUI
#include <StApi_TL.h>
#ifdef ENABLED_ST_GUI
#include <StApi_GUI.h>
#include <iomanip> //std::setprecision
#endif
using namespace StApi;
using namespace std;
const uint64_t nCountOfImagesToGrab = 100;
int main(int /* argc */, char ** /* argv */)
{
try
{
CStApiAutoInit objStApiAutoInit;
CIStSystemPtr pIStSystem(CreateIStSystem(StSystemVendor_Sentech));
CIStDevicePtr pIStDevice(pIStSystem->CreateFirstIStDevice());
cout << "Device=" << pIStDevice->GetIStDeviceInfo()->GetDisplayName() << endl;
#ifdef ENABLED_ST_GUI
CIStImageDisplayWndPtr pIStImageDisplayWnd(CreateIStWnd(StWindowType_ImageDisplay));
#endif
CIStDataStreamPtr pIStDataStream(pIStDevice->CreateIStDataStream(0));
// ==============================================================================================================
// Demostration of setting Binning Horizontal / Binning Veritcal to 2
// Create NodeMap pointer for accessing parameters
GenApi::CNodeMapPtr pNodeMapCameraParam(pIStDevice->GetRemoteIStPort()->GetINodeMap());
// Get Node for Binning Horizontal
GenApi::CNodePtr pNodeBinningH = pNodeMapCameraParam->GetNode("BinningHorizontal");
// Convert Node to CIntegerPtr for setting value
GenApi::CIntegerPtr pIntBinningH(pNodeBinningH);
// Set BinningHorizontal to 2
pIntBinningH->SetValue(2);
// Get Node for WiBinning Vertical
GenApi::CNodePtr pNodeBinningV = pNodeMapCameraParam->GetNode("BinningVertical");
// Convert Node to CIntegerPtr for setting value
GenApi::CIntegerPtr pIntBinningV(pNodeBinningV);
// Set BinningVertical to 2
pIntBinningV->SetValue(2);
// ==============================================================================================================
pIStDataStream->StartAcquisition(nCountOfImagesToGrab);
pIStDevice->AcquisitionStart();
while (pIStDataStream->IsGrabbing())
{
CIStStreamBufferPtr pIStStreamBuffer(pIStDataStream->RetrieveBuffer(5000));
if (pIStStreamBuffer->GetIStStreamBufferInfo()->IsImagePresent())
{
IStImage *pIStImage = pIStStreamBuffer->GetIStImage();
#ifdef ENABLED_ST_GUI
stringstream ss;
ss << pIStDevice->GetIStDeviceInfo()->GetDisplayName();
ss << " ";
ss << pIStImage->GetImageWidth() << " x " << pIStImage->GetImageHeight();
ss << " ";
ss << fixed << std::setprecision(2) << pIStDataStream->GetCurrentFPS();
ss << "[fps]";
GenICam::gcstring strText(ss.str().c_str());
pIStImageDisplayWnd->SetUserStatusBarText(strText);
if (!pIStImageDisplayWnd->IsVisible())
{
pIStImageDisplayWnd->Show(NULL, StWindowMode_Modaless);
pIStImageDisplayWnd->SetPosition(0, 0, pIStImage->GetImageWidth(), pIStImage->GetImageHeight());
}
pIStImageDisplayWnd->RegisterIStImage(pIStImage);
processEventGUI();
#else
cout << "BlockId=" << pIStStreamBuffer->GetIStStreamBufferInfo()->GetFrameID()
<< " Size:" << pIStImage->GetImageWidth() << " x " << pIStImage->GetImageHeight()
<< " First byte =" << (uint32_t)*(uint8_t*)pIStImage->GetImageBuffer() << endl;
#endif
}
else
{
cout << "Image data does not exist" << endl;
}
}
pIStDevice->AcquisitionStop();
pIStDataStream->StopAcquisition();
}
catch (const GenICam::GenericException &e)
{
cerr << endl << "An exception occurred." << endl << e.GetDescription() << endl;
}
cout << endl << "Press Enter to exit." << endl;
while (cin.get() != '\n');
return(0);
}
| [
"[email protected]"
] | |
fbf4bbf24ade965c8beb34736487f85201390ff0 | 97903b44eef6a0b080d0b4169a1c3487e75569b5 | /src/engine/src/vertex.cpp | 6ed103abaf992fa884c1bed0212ec67638636920 | [] | no_license | 1whatleytay/ivory | 74dd5aa791b225d0b03c03b67e0c262410f4e66a | 2bc153fa9dc56c4a135170b21551de8993215de1 | refs/heads/master | 2023-05-10T03:20:38.748844 | 2021-05-29T03:04:54 | 2021-05-29T03:11:02 | 347,225,561 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 760 | cpp | #include <engine/vertex.h>
Vec2::Vec2(float x, float y) : x(x), y(y) { }
std::array<uint8_t, 4> Color::data() const {
return {
static_cast<uint8_t>(red * 255.0f),
static_cast<uint8_t>(green * 255.0f),
static_cast<uint8_t>(blue * 255.0f),
255
};
}
Color::Color(uint32_t color) {
red = (float)(color >> 16u) / 255.0f;
green = (float)((color >> 8u) & 0xFFu) / 255.0f;
blue = (float)(color & 0xFFu) / 255.0f;
}
void Vertex::mark() {
glVertexAttribPointer(0, 3, GL_FLOAT, false, sizeof(Vertex), (void *)offsetof(Vertex, position));
glVertexAttribPointer(1, 2, GL_FLOAT, false, sizeof(Vertex), (void *)offsetof(Vertex, texCoord));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
}
| [
"[email protected]"
] | |
ae2df820f517b94260ebc071ea1b804c463a3d03 | dee038fd8d612fb25333286e5cbaa7ed4da5bc61 | /src/util/mm_io/readGraph.tcc | 3056ed86b7b7876913a224118b73a0a6edb7940c | [
"MIT"
] | permissive | IronySuzumiya/G-Sim | 9506ea5780848e4331ecf4075788059a6b89a54a | b6bf4d22da0b0fde190490a2cbb600b21a4ee395 | refs/heads/master | 2022-12-16T18:37:29.132826 | 2019-11-04T04:30:01 | 2019-11-04T04:30:01 | 292,493,679 | 0 | 0 | MIT | 2020-09-03T07:06:57 | 2020-09-03T07:06:56 | null | UTF-8 | C++ | false | false | 10,736 | tcc | #include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <fstream>
#include <string>
#include <unistd.h>
#include <map>
#include <set>
#include <filesystem>
extern "C" {
#include "mm_io.h"
}
template<class v_t>
void Utility::readGraph<v_t>::allocateGraph() {
// Initialize node pointers
nodePtrs = (unsigned int *)malloc((*numNodes + 2) * sizeof(unsigned int)); // Dummy for zero, plus extra at the end for M+1 bounds
vertex_property = (v_t *)malloc((*numNodes + 1) * sizeof(v_t));
for(int i = 0 ; i < *numNodes + 1; i ++) {
vertex_property[i] = initialVertexValue;
}
nodeNeighbors = (unsigned int *)malloc(*numNeighbors * sizeof(unsigned int));
edgeWeights = (double *)malloc(*numNeighbors * sizeof(double));
nodeIncomingPtrs = (unsigned int *)malloc((*numNodes + 1) * sizeof(unsigned int));
nodeIncomingNeighbors = (unsigned int *)malloc(*numNeighbors * sizeof(unsigned int));
}
template<class v_t>
void Utility::readGraph<v_t>::readMatrixMarket(const char *mmInputFile) {
fprintf(stderr, "[readMatrixMarket] allocating space for shared integers \n");
numNodes = (int*) malloc(sizeof(int));
numNeighbors = (int*) malloc(sizeof(int));
std::string binFname = std::string(mmInputFile)+".bin";
bool success = readBin(binFname);
if(!success) {
int M, N, nz, *I, *J;
double *val;
MM_typecode matcode;
fprintf(stderr, "[readMatrixMarket] Reading matrix market file \n");
int retval = mm_read_mtx_crd(mmInputFile, &M, &N, &nz, &I, &J, &val, &matcode);
if(retval < 0) {
fprintf(stderr, "matrix read failed!\n");
exit(-1);
}
// Check values: no vertices should be zero or > M
for(int j=0; j<nz; j++){
if((I[j] <= 0) || (J[j] <= 0)) {
fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an unsupported 0 vertex at %i\n", j);
assert(false);
}
if(I[j] > nz) {
fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an out-of-bounds vertex (%i > (nz=%i)) at position %i\n", I[j], nz, j);
assert(false);
}
if(J[j] > nz) {
fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an out-of-bounds vertex (%i > (nz=%i)) at position %i\n", I[j], nz, j);
assert(false);
}
}
*numNodes = M;
*numNeighbors = nz;
allocateGraph();
bool jIsInorder = true;
for(int j=0; j<nz-1; j++) {
if(j%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] preprocessing %i/%i\n", j, nz);
if(J[j] > J[j+1]) jIsInorder = false;
}
fprintf(stderr, "[readMatrixMarket] Converting matrix market to expected input \n");
unsigned int *nodePtr = nodePtrs;
unsigned int *nodeNeighbor = nodeNeighbors;
double *edgeWeight = edgeWeights;
int n = 0;
*nodePtr = n;
nodePtr[0] = 0; // initialize the first pointer to the start of the edge list
if(jIsInorder) {
//fprintf(stderr, "Test If\n");
int curJ = 0;
for(n = 0; n < nz; n++) {
if(n%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postprocessing %i/%i\n", n, nz);
//printf ("Test If 1 %d\n", n);
nodeNeighbor[n] = I[n];
//printf ("Test If 2\n");
if(mm_is_real(matcode))
*(edgeWeight++) = val[n]; //Giving error
else
*(edgeWeight++) = 1.;
while(curJ != J[n])
nodePtr[++curJ] = n;
}
// Update the very last node ptr
nodePtr[++curJ] = *numNeighbors;
} else {
//fprintf(stderr, " Test Else \n");
for(int i=0; i<=M; i++) {
for(int ind=0; ind < nz; ind++) {
if(n%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postprocessing %i, %i/%i\n", i, ind, nz);
if(I[ind] == i) {
*(nodeNeighbor++) = J[ind];
if(mm_is_real(matcode))
*(edgeWeight++) = val[ind];
else
*(edgeWeight++) = 1.;
n++;
}
}
*(++nodePtr) = n;
}
// Update the very last node pointer
*(++nodePtr) = *numNeighbors;
}
//fprintf(stderr, "Test \n");
//assert((nodeNeighbors)[0] == (nodeNeighbors)[1] == 0);
unsigned int p = 0;
unsigned int idx_cnt = 0;
memset(nodeIncomingNeighbors, 0, (*numNeighbors)*sizeof(unsigned int));
memset(nodeIncomingPtrs, 0, (*numNodes + 1)*sizeof(unsigned int));
std::map<int, std::set<int> > incomingNodes;
for(int nodeInd = 0; nodeInd <= M; nodeInd++) {
if(nodeInd%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postpostprocessing %i/%i\n", nodeInd, M);
for(unsigned int neighborInd = nodePtrs[nodeInd]; neighborInd < nodePtrs[nodeInd+1]; neighborInd++) {
int neighbor = nodeNeighbors[neighborInd];
incomingNodes[neighbor].insert(nodeInd);
}
}
for(int nodeInd = 0; nodeInd <= M; nodeInd++) {
if(nodeInd%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postpostpostprocessing %i/%i\n", nodeInd, M);
nodeIncomingPtrs[nodeInd] = p;
p += incomingNodes[nodeInd].size();
for(int neighborInd : incomingNodes[nodeInd]) {
nodeIncomingNeighbors[idx_cnt++] = neighborInd;
}
}
assert(nodeIncomingPtrs[0] == 0);
nodeIncomingPtrs[M+1] = p;
// check some stuff
for(int j = 0; j < M+2; j++) {
assert((nodePtrs[j] >=0) && (nodePtrs[j] <= ((unsigned int)nz)));
assert((nodeIncomingPtrs[j] >=0) && (nodeIncomingPtrs[j] <= ((unsigned int)nz)));
}
for(int j = 0; j < nz; j++) {
assert((nodeNeighbors[j] >=1) && (nodeNeighbors[j] <= ((unsigned int)M)));
assert((nodeIncomingNeighbors[j] >=1) && (nodeIncomingNeighbors[j] <= ((unsigned int)M)));
}
free(val);
free(J);
free(I);
writeBin(binFname);
}
}
template<class v_t>
void Utility::readGraph<v_t>::printEdgeWeights(void) {
for(int i = 0; i < *numNeighbors; i++) {
fprintf(stderr, "[readGraph DEBUG] edge %u: %lf\n", i, edgeWeights[i]);
}
}
template<class v_t>
void Utility::readGraph<v_t>::printNodePtrs(void) {
fprintf(stderr, "[readGraph DEBUG] nodePtrs:\n");
for(int i = 1; i < *numNodes; i++) {
fprintf(stderr, " node %u: %u\n", i, nodePtrs[i]);
}
}
template<class v_t>
void Utility::readGraph<v_t>::printGraph(void) {
for(int i = 1 ; i <= *numNodes; i++) {
std::cerr << "Node: " << i << "\n";
std::cerr << " Property: " << getVertexProperty(i) << "\n";
for(int j = getNodePtr(i); j < getNodePtr(i+1); j++) {
std::cerr << " Edge " << j << " weight " << getEdgeWeight(j) << "\n";
std::cerr << " Neighbor: " << getNodeNeighbor(j) << "\n";
}
}
}
template<class v_t>
void Utility::readGraph<v_t>::printVertexProperties(int num) {
std::cerr << "[ ";
for(int i = 1; i <= *numNodes && i < num; i++) {
std::cerr << getVertexProperty(i) << ", ";
}
std::cerr << "]\n";
}
template<class v_t>
void Utility::readGraph<v_t>::writeBin(std::string binFname) {
fprintf(stderr, "[writeBin] writing binary\n");
std::ofstream binFile;
binFile.open(binFname.c_str(), std::ios::out | std::ios::binary);
assert(binFile.is_open());
binFile.write((char*)numNodes, sizeof(int));
binFile.write((char*)numNeighbors, sizeof(int));
binFile.write((char*)nodePtrs, sizeof(unsigned int)*((*numNodes)+1));
binFile.write((char*)nodeNeighbors, sizeof(unsigned int)*(*numNeighbors));
binFile.write((char*)edgeWeights, sizeof(double)*(*numNeighbors));
binFile.write((char*)nodeIncomingPtrs, sizeof(unsigned int)*((*numNodes)+1));
binFile.write((char*)nodeIncomingNeighbors, sizeof(unsigned int)*(*numNeighbors));
binFile.close();
}
template<class v_t>
bool Utility::readGraph<v_t>::readBin(std::string binFname) {
std::ifstream binFile;
binFile.open(binFname.c_str(), std::ios::in | std::ios::binary);
if(!binFile.good()) return false;
uint64_t fileSize = std::filesystem::file_size(binFname.c_str());
const size_t startIdx = binFname.find_last_of("/");
binFname.erase(0, startIdx+1);
boost::interprocess::permissions perm;
perm.set_unrestricted();
if(shouldInit == 1) boost::interprocess::shared_memory_object::remove(binFname.c_str());
graphData = boost::interprocess::shared_memory_object(boost::interprocess::open_or_create,
binFname.c_str(),
boost::interprocess::read_write,
perm);
graphData.truncate(fileSize);
region = boost::interprocess::mapped_region(graphData, boost::interprocess::read_write, 0, fileSize);
uint8_t *dataPtr = (uint8_t*)region.get_address();
numNodes = (int*)dataPtr;
dataPtr += sizeof(int);
numNeighbors = (int*)dataPtr;
dataPtr += sizeof(int);
nodePtrs = (unsigned int*)dataPtr;
dataPtr += sizeof(unsigned int)*((*numNodes)+1);
nodeNeighbors = (unsigned int*)dataPtr;
dataPtr += sizeof(unsigned int)*(*numNeighbors);
edgeWeights = (double*)dataPtr;
dataPtr += sizeof(double)*(*numNeighbors);
nodeIncomingPtrs = (unsigned int*)dataPtr;
dataPtr += sizeof(unsigned int)*((*numNodes)+1);
nodeIncomingNeighbors = (unsigned int*)dataPtr;
dataPtr += sizeof(unsigned int)*(*numNeighbors);
assert(dataPtr <= (uint8_t*)region.get_address() + region.get_size());
if(shouldInit != 0) {
fprintf(stderr, "[writeBin] reading binary\n");
binFile.read((char*)numNodes, sizeof(int));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
binFile.read((char*)numNeighbors, sizeof(int));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
fprintf(stderr, "[writeBin] read numNodes(%p): %i and numNeighbors(%p): %i\n", numNodes, *numNodes, numNeighbors, *numNeighbors);
binFile.read((char*)nodePtrs, sizeof(unsigned int)*((*numNodes)+1));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
binFile.read((char*)nodeNeighbors, sizeof(unsigned int)*(*numNeighbors));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
binFile.read((char*)edgeWeights, sizeof(double)*(*numNeighbors));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
binFile.read((char*)nodeIncomingPtrs, sizeof(unsigned int)*((*numNodes)+1));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
binFile.read((char*)nodeIncomingNeighbors, sizeof(unsigned int)*(*numNeighbors));
assert(!binFile.fail());
fprintf(stderr, "%li bytes read\n", binFile.gcount());
} else fprintf(stderr, "skipping graph initialization\n");
binFile.close();
return true;
}
| [
"[email protected]"
] | |
74920e16229d800abb4dd62a8c49e91d4143e39f | 838e7a6c843119327e867a1927fc625ff0594ed7 | /apps/t3player/src/Interface.h | 7bd80dab1bc755b1506beba9bcc603ea3227cba2 | [] | no_license | albarral/sam | 4723c9651047f575e01ef2435302e4a5113a70c7 | 6a2fba2ba4ed98a1ef7da26b56ac6d12efcfa0ce | refs/heads/master | 2020-05-18T07:32:11.981113 | 2016-01-15T21:52:09 | 2016-01-15T21:52:09 | 32,345,569 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,138 | h | /***************************************************************************
* Copyright (C) 2015 by Migtron Robotics *
* [email protected] *
***************************************************************************/
#ifndef _INTERFACE_H
#define _INTERFACE_H
#include "ui_Interface.h"
#include <QPushButton>
#include <iostream>
#include <vector>
#include <QMouseEvent>
#include <QMessageBox>
#include<QGraphicsView>
#include<QGraphicsScene>
#include<QGraphicsRectItem>
#include<QVector>
#include<QGraphicsPolygonItem>
#include<QGraphicsSceneMouseEvent>
class Interface : public QMainWindow {
Q_OBJECT
public:
Interface(QMainWindow *parent = 0);
private:
Ui::Interface widget;
QGraphicsScene *scene;
QGraphicsView *view;
QGraphicsPolygonItem *polygon;
QGraphicsRectItem *rectangle;
private slots:
void start();
void userWins();
void agentWins();
void draw();
void play();
void setScene();
//std::vector<int> randomMove(std::vector<int> positions);
};
#endif /* _INTERFACE_H */
| [
"[email protected]"
] | |
1f01f099d47b6848f81203c5d1393ba5cdef5cff | be379c5decf2b8a8a7aac102e489563ae0da8593 | /extern/irrogles/source/Irrlicht/CGUISpriteBank.h | e57c62c503a4ce84516f786312aa6f14516fda57 | [] | no_license | codeman001/gsleveleditor | 6050daf26d623af4f6ab9fa97f032d958fb4c5ae | d30e54874a4c7ae4fd0a364aa92a2082f73a5d7c | refs/heads/master | 2021-01-10T13:09:01.347502 | 2013-05-12T09:14:47 | 2013-05-12T09:14:47 | 44,381,635 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,309 | h | // Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_SPRITE_BANK_H_INCLUDED__
#define __C_GUI_SPRITE_BANK_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUISpriteBank.h"
namespace irr
{
namespace video
{
class IVideoDriver;
class ITexture;
}
namespace gui
{
class IGUIEnvironment;
//! Sprite bank interface.
class CGUISpriteBank : public IGUISpriteBank
{
public:
CGUISpriteBank(IGUIEnvironment* env);
virtual ~CGUISpriteBank();
virtual core::array< core::rect<s32> >& getPositions();
virtual core::array< SGUISprite >& getSprites();
virtual u32 getTextureCount() const;
virtual video::ITexture* getTexture(u32 index) const;
virtual void addTexture(video::ITexture* texture);
virtual void setTexture(u32 index, video::ITexture* texture);
//! Add the texture and use it for a single non-animated sprite.
virtual s32 addTextureAsSprite(video::ITexture* texture);
//! clears sprites, rectangles and textures
virtual void clear();
//! Draws a sprite in 2d with position and color
virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false);
//! Draws a sprite batch in 2d using an array of positions and a color
virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos,
const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0,
bool loop=true, bool center=false);
protected:
struct SDrawBatch
{
core::array<core::position2di> positions;
core::array<core::recti> sourceRects;
u32 textureNumber;
};
core::array<SGUISprite> Sprites;
core::array< core::rect<s32> > Rectangles;
core::array<video::ITexture*> Textures;
IGUIEnvironment* Environment;
video::IVideoDriver* Driver;
};
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_SPRITE_BANK_H_INCLUDED__
| [
"[email protected]"
] |
Subsets and Splits