blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
55dddb5091176f1d07d74e7718eec38c09ffa605 | 0f8d8865728a787f98b40235b531c4d3a1ed2293 | /pa3/src/tpgmain.cpp | 12e069b63a778f058a871782afd4da82e4c4d8c6 | [] | no_license | ChenHaoHSU/VLSI-Testing | b33d637c5b71355fc8c7ff57de7ea5cfe5947ee1 | 415d1ef612f5653c74b5a1b622ec2621c2eaf76d | refs/heads/master | 2020-03-28T22:24:49.622587 | 2019-07-04T15:07:18 | 2019-07-04T15:07:18 | 149,230,916 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,043 | cpp | /**********************************************************************/
/* main function and some utilities for atpg */
/* */
/* Author: Bing-Chen (Benson) Wu */
/* last update : 01/21/2018 */
/**********************************************************************/
#include "atpg.h"
void usage(void);
main(int argc, char *argv[]) {
string inpFile, vetFile;
int i, j;
ATPG atpg; // create an ATPG obj, named atpg
atpg.timer(stdout,"START");
i = 1;
/* parse the input switches & arguments */
while(i< argc) {
if (strcmp(argv[i],"-anum") == 0) {
atpg.set_total_attempt_num(atoi(argv[i+1]));
i+=2;
}
else if (strcmp(argv[i],"-bt") == 0) {
atpg.set_backtrack_limit(atoi(argv[i+1]));
i+=2;
}
else if (strcmp(argv[i],"-fsim") == 0) {
vetFile = string(argv[i+1]);
atpg.set_fsim_only(true);
i+=2;
}
else if (strcmp(argv[i],"-tdfsim") == 0) {
vetFile = string(argv[i+1]);
atpg.set_tdfsim_only(true);
i+=2;
}
else if (argv[i][0] == '-') {
j = 1;
while (argv[i][j] != '\0') {
if (argv[i][j] == 'd') {
j++ ;
}
else {
fprintf(stderr, "atpg: unknown option\n");
usage();
}
}
i++ ;
}
else {
inpFile = string(argv[i]);
i++ ;
}
}
/* an input file was not specified, so describe the proper usage */
if (inpFile.empty()) { usage(); }
/* read in and parse the input file */
atpg.input(inpFile); // input.cpp
/* if vector file is provided, read it */
if(!vetFile.empty()) { atpg.read_vectors(vetFile); }
atpg.timer(stdout,"for reading in circuit");
atpg.level_circuit(); // level.cpp
atpg.timer(stdout,"for levelling circuit");
atpg.rearrange_gate_inputs(); //level.cpp
atpg.timer(stdout,"for rearranging gate inputs");
atpg.create_dummy_gate(); //init_flist.cpp
atpg.timer(stdout,"for creating dummy nodes");
atpg.generate_fault_list(); //init_flist.cpp
atpg.timer(stdout,"for generating fault list");
atpg.test(); //test.cpp
if(!atpg.get_tdfsim_only())atpg.compute_fault_coverage(); //init_flist.cpp
atpg.timer(stdout,"for test pattern generation");
exit(EXIT_SUCCESS);
}
void usage(void) {
fprintf(stderr, "usage: atpg [options] infile\n");
fprintf(stderr, "Options\n");
fprintf(stderr, " -fsim <filename>: fault simulation only; filename provides vectors\n");
fprintf(stderr, " -anum <num>: <num> specifies number of vectors per fault\n");
fprintf(stderr, " -bt <num>: <num> specifies number of backtracks\n");
exit(EXIT_FAILURE);
} /* end of usage() */
void ATPG::read_vectors(const string& vetFile) {
string t, vec;
size_t i;
ifstream file(vetFile, std::ifstream::in); // open the input vectors' file
if(!file) { // if the ifstream obj does not exist, fail to open the file
fprintf(stderr,"File %s could not be opened\n",vetFile.c_str());
exit(EXIT_FAILURE);
}
while(!file.eof() && !file.bad()) {
getline(file, t); // get a line from the file
if(t[0] != 'T') continue; // if this line is not a vector, ignore it
else {
vec.clear();
for (char c: t) {
if (c == 'T') continue; // ignore "T"
if (c == '\'') continue; // ignore "'"
if (c == ' ') continue; // ignore " "
vec.push_back(c);
}
//cout << "Before erase: " << t << endl;
//cout << "After erase: " << vec << endl;
vectors.push_back(vec); // append the vectors
}
}
file.close(); // close the file
}
void ATPG::set_fsim_only(const bool& b) {
this->fsim_only = b;
}
void ATPG::set_tdfsim_only(const bool& b) {
this->tdfsim_only = b;
}
void ATPG::set_total_attempt_num(const int& i) {
this->total_attempt_num = i;
}
void ATPG::set_backtrack_limit(const int& i) {
this->backtrack_limit = i;
}
| [
"b03505028@ntu.edu.tw"
] | b03505028@ntu.edu.tw |
fce3d0d32a233cea062f66538ce96d55d3e83432 | 9802284a0f2f13a6a7ac93278f8efa09cc0ec26b | /SDK/SK_Dressed_Skinny_04_V2_classes.h | 48a0c72f7999c89450e1c7ae6a7c10aa829e9407 | [] | no_license | Berxz/Scum-SDK | 05eb0a27eec71ce89988636f04224a81a12131d8 | 74887c5497b435f535bbf8608fcf1010ff5e948c | refs/heads/master | 2021-05-17T15:38:25.915711 | 2020-03-31T06:32:10 | 2020-03-31T06:32:10 | 250,842,227 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 678 | h | #pragma once
// Name: SCUM, Version: 3.75.21350
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass SK_Dressed_Skinny_04_V2.SK_Dressed_Skinny_04_V2_C
// 0x0000 (0x0098 - 0x0098)
class USK_Dressed_Skinny_04_V2_C : public UItemSpawnerPreset
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass SK_Dressed_Skinny_04_V2.SK_Dressed_Skinny_04_V2_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"37065724+Berxz@users.noreply.github.com"
] | 37065724+Berxz@users.noreply.github.com |
ffa1fa40918a706bf8e26edfad4c7e7542343bfe | ef9a782df42136ec09485cbdbfa8a56512c32530 | /tags/fasset2.3.2/src/products/milk.cpp | 23210b32e39bd0fa47ec89587443a6bbb6dfdd66 | [] | no_license | penghuz/main | c24ca5f2bf13b8cc1f483778e72ff6432577c83b | 26d9398309eeacbf24e3c5affbfb597be1cc8cd4 | refs/heads/master | 2020-04-22T15:59:50.432329 | 2017-11-23T10:30:22 | 2017-11-23T10:30:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,964 | cpp | /****************************************************************************\
$URL$
$LastChangedDate$
$LastChangedRevision$
$LastChangedBy$
\****************************************************************************/
#include "../base/common.h"
#include "milk.h"
#ifdef _STANDALONE
#include "../base/message.h"
#endif
//needs updating wrt protein, urea
/****************************************************************************\
Default Constructor
\****************************************************************************/
milk::milk()
: product()
{
InitVariables();
}
/****************************************************************************\
Constructor with arguments
\****************************************************************************/
milk::milk(const char * aName, const int aIndex, const base * aOwner)
: product(aName, aIndex, aOwner)
{
InitVariables();
}
/****************************************************************************\
Copy Constructor
\****************************************************************************/
milk::milk(const milk& amilk)
: product(amilk)
{
fat = amilk.fat;
protein = amilk.protein;
urea = amilk.urea;
dryMatter = amilk.dryMatter;
}
/****************************************************************************\
Destructor
\****************************************************************************/
milk::~milk()
{
}
/****************************************************************************\
\****************************************************************************/
void milk::InitVariables()
{
fat = 0.0;
dryMatter = 0.0;
protein = 0.0;
urea = 0.0;
ObjType = milkObj;
}
/****************************************************************************\
\****************************************************************************/
product& milk::operator=(const product& someMilk)
{
milk* aMilk;
aMilk = (milk*)(&someMilk);
product::operator=(someMilk);
fat = aMilk->Getfat();
dryMatter = aMilk->GetdryMatter();
return *this;
}
/****************************************************************************\
\****************************************************************************/
product& milk::operator+(const product& someMilk)
{
milk* aMilk;
aMilk = (milk*)(&someMilk);
double aAmount = aMilk->GetAmount();
double afat = aMilk->Getfat();
double adryMatter = aMilk->GetdryMatter();
if(amount!=0)
{
fat = (fat*amount + afat*aAmount)/(amount+aAmount);
dryMatter = (dryMatter*amount + adryMatter*aAmount)/(amount+aAmount);
}
else
{
fat = afat*aAmount;
dryMatter = adryMatter*aAmount;
}
product::operator+(someMilk);
return *this;
}
/****************************************************************************\
\****************************************************************************/
product& milk::operator-(const product& someMilk)
{
milk* aMilk;
aMilk = (milk*)(&someMilk);
if (fat != aMilk->Getfat() ||
dryMatter!= aMilk->GetdryMatter())
theMessage->Warning("milk::operator- - milk with different composition subtracted");
product::operator-(someMilk);
return *this;
}
/****************************************************************************\
\****************************************************************************/
product* milk::clone() const
{
milk* aProduct= new milk(*this);
return (product *)aProduct;
}
/****************************************************************************\
\****************************************************************************/
void milk::ReadParameters(commonData * data,const char * sectionName)
{
product::ReadParameters(data, sectionName);
if(data->FindSection(sectionName,Index))
{
data->FindItem("fat",&fat);
data->FindItem("drymatter",&dryMatter);
}
}
| [
"sai@agro.au.dk"
] | sai@agro.au.dk |
f32ec75e501ab7f5ca73d3c306b3aaea19f9601a | 6edbe5fd4ce822d8002acf8e72c18c40007d2e71 | /engine/source/signature.h | 54d9e0ae82ded493a2483fa6ea586eb2ce12f3a4 | [] | no_license | cebu4u/Trickplay | b7a34555ad0b9cd5493d2a794d7a6d6ccd89c6b7 | ab3a67d3ff91a18e371298309ed63e25bad08186 | refs/heads/master | 2020-12-11T07:48:39.625799 | 2012-10-10T19:53:49 | 2012-10-10T19:53:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 902 | h | #ifndef _TRICKPLAY_SIGNATURE_H
#define _TRICKPLAY_SIGNATURE_H
#include <iostream>
#include "common.h"
namespace Signature
{
struct Info
{
typedef std::list< Info > List;
String fingerprint;
String subject_name;
};
// A TRUE result means that either the file has no signatures, or that all
// signatures are OK. TRUE with an empty list, means no signatures.
//
// FALSE means that something went wrong checking the signatures, or that
// at least one of them is invalid.
bool get_signatures( const gchar * filename, Info::List & signatures, gsize * signature_length = NULL );
bool get_signatures( gpointer data, gsize size, Info::List & signatures, gsize * signature_length = NULL );
bool get_signatures( std::istream & stream, Info::List & signatures, gsize * signature_length = NULL );
};
#endif // _TRICKPLAY_SIGNATURE_H
| [
"pablo@trickplay.com"
] | pablo@trickplay.com |
25c15b1b1ac1367d7ce2bc916d91660d9ed32e91 | 390ba25e6c11035a6be897c3f071ad772318f482 | /codes/cf1.cpp | 2983b42cc0903561d0e5c9498aebda3f426b175b | [] | no_license | platypusperry23/Imp_Codes | 643f6d17f1d88d88402711bd5c626adbf2cb551b | 84dabad4e7dab109316dff3dc42fedae8cfc6400 | refs/heads/master | 2023-01-04T03:00:06.149925 | 2020-10-29T17:22:13 | 2020-10-29T17:22:13 | 258,104,661 | 0 | 2 | null | 2020-10-29T17:22:14 | 2020-04-23T05:36:31 | C++ | UTF-8 | C++ | false | false | 1,122 | cpp |
# include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ld long double
#define pi 3.14
#define mkp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ins insert
#define mxy map<pair<ll, ll>, ll>
#define q1 1000000007
#define fl forward_list
#define bin1 __builtin_popcount
#define map2d map<long long,map<long long , long long > >
#define um unordered_map<ll,ll>
ll power(ll x, ll y)
{
ll p=q1;ll res = 1; x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p; y = y >> 1;x = (x * x) % p; } return res; }
int main()
{
boost;
ll t,n;
cin>>t;
while(t--)
{
string s;
cin>>s;
n=s.length();
int l=0,max=1;
for(int i=0;i<n;i++)
{
if(s[i]=='L')
l++;
else
{
if(l+1>max)
max=l+1;
l=0;
}
}
if(s[n-1]=='L')
{
if(l+1>max)
max=l+1;
}
cout<<max<<endl;
}
return 0;
}
| [
"18uec110@lnmiit.ac.in"
] | 18uec110@lnmiit.ac.in |
56735f6711985ad7ec2f965dd685f06988d3a3c3 | dd1b4089f638d801698e34b830b2767149b665f6 | /R3BRoot_Source/Nveto_seg/test/testNveto_segNeutron2DPar.cxx | 1048ae1e11b1686ee2be2d375d7df75247a92df6 | [] | no_license | ChristiaanAlwin/NeuLAND_Veto | d1c1b41cfb1f4ade2de664188da615b2541d3e7b | ed06682b03b1bd6b2c7ecc2f3be7c62036ef45ee | refs/heads/master | 2021-01-05T19:02:08.598882 | 2020-02-17T13:55:17 | 2020-02-17T13:55:17 | 241,109,623 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,468 | cxx | #include <map>
#include "TCutG.h"
#include "R3BNveto_segNeutron2DPar.h"
#include "gtest/gtest.h"
namespace
{
TEST(testNeutron2DPar, HandlesConversionBetweenMaps)
{
std::map<UInt_t, TCutG*> m;
m[1] = new TCutG("cut1", 4);
m[2] = new TCutG("cut2", 4);
R3BNveto_segNeutron2DPar par;
par.SetNeutronCuts(m);
EXPECT_STREQ(par.GetNeutronCuts().at(2)->GetName(), "cut2");
}
TEST(testNeutron2DPar, GetNeutronMultiplicity)
{
std::map<UInt_t, TCutG*> m;
m[0] = new TCutG("cut0", 4);
m[0]->SetPoint(0, 0, 0);
m[0]->SetPoint(1, 0, 10);
m[0]->SetPoint(2, 10, 0);
m[0]->SetPoint(3, 0, 0);
m[1] = new TCutG("cut1", 4);
m[1]->SetPoint(0, 0, 10);
m[1]->SetPoint(1, 0, 20);
m[1]->SetPoint(2, 20, 0);
m[1]->SetPoint(3, 10, 0);
m[2] = new TCutG("cut2", 4);
m[2]->SetPoint(0, 0, 20);
m[2]->SetPoint(1, 0, 30);
m[2]->SetPoint(2, 30, 0);
m[2]->SetPoint(3, 20, 0);
R3BNveto_segNeutron2DPar par;
par.SetNeutronCuts(m);
EXPECT_EQ(par.GetNeutronMultiplicity(4,4), 0);
EXPECT_EQ(par.GetNeutronMultiplicity(9,9), 1);
EXPECT_EQ(par.GetNeutronMultiplicity(14,14), 2);
EXPECT_EQ(par.GetNeutronMultiplicity(19,19), 3);
}
} // namespace
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| [
"Christiaan90518@gmail.com"
] | Christiaan90518@gmail.com |
4f33dca02917e7bf21e21c2c011ea0dbc7257eb1 | 52505166e409b44caf7a0b144ef0c453b586fcee | /performance-eval/FlexNLP/s1_i_time/sim_model/src/idu_PE1_act_child_do_incr.cc | 80e53c4034e71e6c4f4c4dfb9d4b0007c567c210 | [] | no_license | yuex1994/ASPDAC-tandem | fb090975c65edbdda68c19a8d7e7a5f0ff96bcb8 | decdabc5743c2116d1fc0e339e434b9e13c430a8 | refs/heads/master | 2023-08-28T04:37:30.011721 | 2021-08-07T13:19:23 | 2021-08-07T13:19:30 | 419,089,461 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,364 | cc | #include <flex.h>
bool flex::decode_PE1_ACT_CHILD_PE1_act_child_do_incr() {
sc_biguint<1> local_var_1 = 1;
bool local_var_2 = (PE1_ACT_CHILD_pe1_act_is_start_reg == local_var_1);
sc_biguint<3> local_var_4 = 2;
bool local_var_5 = (PE1_ACT_CHILD_pe1_act_state == local_var_4);
bool local_var_6 = (local_var_2 & local_var_5);
auto& univ_var_248 = local_var_6;
return univ_var_248;
}
void flex::update_PE1_ACT_CHILD_PE1_act_child_do_incr() {
sc_biguint<6> local_var_2 = 1;
sc_biguint<6> local_var_3 = (flex_pe1_act_mngr_num_inst - local_var_2);
bool local_var_4 = (PE1_ACT_CHILD_pe1_act_instruction_counter == local_var_3);
sc_biguint<6> local_var_5 = 0;
sc_biguint<6> local_var_6 = 1;
sc_biguint<6> local_var_7 = (PE1_ACT_CHILD_pe1_act_instruction_counter + local_var_6);
auto local_var_8 = (local_var_4) ? local_var_5 : local_var_7;
auto local_var_8_nxt_holder = local_var_8;
sc_biguint<8> local_var_11 = 1;
sc_biguint<8> local_var_12 = (flex_pe1_act_mngr_num_output - local_var_11);
bool local_var_13 = (PE1_ACT_CHILD_pe1_act_output_counter == local_var_12);
bool local_var_14 = (local_var_4 & local_var_13);
sc_biguint<1> local_var_15 = 0;
sc_biguint<1> local_var_16 = 1;
auto local_var_17 = (local_var_14) ? local_var_15 : local_var_16;
auto local_var_17_nxt_holder = local_var_17;
sc_biguint<1> local_var_18 = 0;
auto local_var_20 = (local_var_14) ? local_var_18 : flex_pe1_act_mngr_is_zero_first;
auto local_var_20_nxt_holder = local_var_20;
sc_biguint<8> local_var_21 = 0;
bool local_var_22 = !local_var_13;
bool local_var_23 = (local_var_4 & local_var_22);
sc_biguint<8> local_var_24 = 1;
sc_biguint<8> local_var_25 = (PE1_ACT_CHILD_pe1_act_output_counter + local_var_24);
auto local_var_26 = (local_var_23) ? local_var_25 : PE1_ACT_CHILD_pe1_act_output_counter;
auto local_var_27 = (local_var_14) ? local_var_21 : local_var_26;
auto local_var_27_nxt_holder = local_var_27;
sc_biguint<3> local_var_28 = 3;
sc_biguint<3> local_var_29 = 0;
auto local_var_30 = (local_var_14) ? local_var_28 : local_var_29;
auto local_var_30_nxt_holder = local_var_30;
PE1_ACT_CHILD_pe1_act_instruction_counter = local_var_8_nxt_holder;
PE1_ACT_CHILD_pe1_act_is_start_reg = local_var_17_nxt_holder;
flex_pe1_act_mngr_is_zero_first = local_var_20_nxt_holder;
PE1_ACT_CHILD_pe1_act_output_counter = local_var_27_nxt_holder;
PE1_ACT_CHILD_pe1_act_state = local_var_30_nxt_holder;
}
| [
"anonymizeddac2020submission@gmail.com"
] | anonymizeddac2020submission@gmail.com |
a41eca3de1cd174d88cdd1244a0f5f2d1390b52e | aace0b7ba87a59f8c7553f4e782f459130bf1f5a | /qt-project/mainwindow.cpp | faa173fcca3a967227f8cc729667c9e1531af4ab | [] | no_license | ezhangle/Teaching-Assistant | edfc15db4c434cc5e66ab484ac1ce35e875c7122 | e2be34dfe1402d6659671c7e80f868e7b5a2cbef | refs/heads/master | 2020-03-20T23:11:19.834940 | 2012-09-04T13:08:09 | 2012-09-04T13:08:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,292 | cpp | //author: Andrei Ghenoiu
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
#include <QXmlStreamReader>
#include <QString>
#include <QStringList>
#include <QInputDialog>
#include <QLabel>
#include <stdio.h>
#include "form.h"
#include "LoadData.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
//this function loads the data from the xml file and puts it into a QStringList (acts as an array
//of strings), and then gets split and displayed in the table
QString MainWindow::loadData()
{
QString str;
str = getClasses();
QStringList list = str.split(",,");
//used for testing purposes
ref = list.length()/5;
for(int i=5; i<list.length(); i++)
{
QTableWidgetItem *qtItem = new QTableWidgetItem(list[i]);
ui->tableWidget->setItem(0,i-5,qtItem);
}
//ui->textEdit->setText(QString::number(list.length()));
//ui->textEdit_2->setText(QString::number(ref));
return str;
}
//this method saves the inputed data to the xml file
int MainWindow::saveData()
{
QString text;
int i;
text +="<classes>\n";
for(i = 0; i<ref; i++)
{
if(ui->tableWidget->item(i,0)->text().isEmpty())
{
text+="";
}
else
{
text += "<course name=\""+ui->tableWidget->item(i,0)->text()+"\" id=\"";
text += ui->tableWidget->item(i,1)->text()+"\" noStudents=\"";
text += ui->tableWidget->item(i,2)->text()+"\" nextAssignment=\"";
text += ui->tableWidget->item(i,3)->text()+"\" times=\"";
text += ui->tableWidget->item(i,4)->text()+"\"/>\n";
}
}
text += "</classes>";
QFile file("text.xml");
if(file.open(QFile::WriteOnly))
{
QTextStream out(&file);
out << text;
}
file.close();
return 0;
}
int MainWindow::addClass()
{
QTableWidgetItem *course_name = new QTableWidgetItem(ui->course_name->text());
QTableWidgetItem *course_id = new QTableWidgetItem(ui->course_id->text());
QTableWidgetItem *noStud = new QTableWidgetItem(ui->noStud->text());
QTableWidgetItem *dueAssn = new QTableWidgetItem(ui->dueAssn->text());
QTableWidgetItem *times = new QTableWidgetItem(ui->times->text());
ui->tableWidget->setItem(ref,0,course_name);
ui->tableWidget->setItem(ref,1,course_id);
ui->tableWidget->setItem(ref,2,noStud);
ui->tableWidget->setItem(ref,3,dueAssn);
ui->tableWidget->setItem(ref,4,times);
ref++;
return 0;
}
int MainWindow::addStudent()
{
QTableWidgetItem *student = new QTableWidgetItem(ui->studentName->text());
QTableWidgetItem *rawGrade = new QTableWidgetItem(ui->rawGrade->text());
QTableWidgetItem *adjustedGrade = new QTableWidgetItem(ui->adjustedGrade->text());
QTableWidgetItem *letterGrade = new QTableWidgetItem(ui->letterGrade->text());
QTableWidgetItem *notes = new QTableWidgetItem(ui->notes->text());
ui->tableWidget_3->setItem(study,0,student);
ui->tableWidget_3->setItem(study,1,rawGrade);
ui->tableWidget_3->setItem(study,2,adjustedGrade);
ui->tableWidget_3->setItem(study,3,letterGrade);
ui->tableWidget_3->setItem(study,4,notes);
study++;
return 0;
}
int MainWindow::addAssign()
{
QTableWidgetItem *assignName = new QTableWidgetItem(ui->assignName->text());
QTableWidgetItem *assignID = new QTableWidgetItem(ui->assignID->text());
QTableWidgetItem *totalGrade = new QTableWidgetItem(ui->totalGrade->text());
QTableWidgetItem *weight = new QTableWidgetItem(ui->weight->text());
QTableWidgetItem *dateDue = new QTableWidgetItem(ui->dateDue->text());
QTableWidgetItem *type = new QTableWidgetItem(ui->type->text());
QTableWidgetItem *notesAssign = new QTableWidgetItem(ui->notesAssign->text());
ui->tableWidget_2->setItem(assign,0,assignName);
ui->tableWidget_2->setItem(assign,1,assignID);
ui->tableWidget_2->setItem(assign,2,totalGrade);
ui->tableWidget_2->setItem(assign,3,weight);
ui->tableWidget_2->setItem(assign,4,dateDue);
ui->tableWidget_2->setItem(assign,5,type);
ui->tableWidget_2->setItem(assign,6,notesAssign);
assign++;
return 0;
}
QString MainWindow::loadAssign()
{
QString str;
str = getAssign("assign/"+ui->comboBox_4->currentText()+".xml");
QStringList list = str.split(",,");
//used for testing purposes
assign = list.length()/7-1;
ui->tableWidget_2->clearContents();
for(int i=0; i<list.length(); i++)
{
QTableWidgetItem *qtItem = new QTableWidgetItem(list[i]);
ui->tableWidget_2->setItem(0,i-7,qtItem);
}
//ui->textEdit->setText(QString::number(list.length()));
//ui->textEdit_2->setText(QString::number(ref));
return str;
}
QString MainWindow::loadStudent()
{
QString str;
QString s = "students/"+ui->comboBox->currentText()+".xml";
str = getStudent(s);
QStringList list = str.split(",,");
//used for testing purposes
study = list.length()/5-1;
ui->tableWidget_3->clearContents();
for(int i=3; i<list.length(); i++)
{
QTableWidgetItem *qtItem = new QTableWidgetItem(list[i]);
ui->tableWidget_3->setItem(0,i-5,qtItem);
}
//ui->textEdit->setText(QString::number(list.length()));
//ui->textEdit_2->setText(QString::number(ref));
return str;
}
int MainWindow::loadMainPage()
{
for (int i=0; i < 100; ++i)
ui->tableWidget_5->removeRow(0);
for (int i=0; i < 100; ++i)
ui->tableWidget_5->removeColumn(0);
QString studentsList;
QString assignList;
QString students = "students/"+ui->comboBox_5->currentText()+".xml";
QString assign = "assign/"+ui->comboBox_5->currentText()+".xml";
studentsList = getClassStudent(students);
assignList = getClassAssign(assign);
QStringList students1 = studentsList.split(",,");
for(int i=0; i<students1.length()-2; i++)
{
ui->tableWidget_5->insertRow(i);
}
if(students1[0]=="")
{
students1.removeFirst();
}
ui->tableWidget_5->setVerticalHeaderLabels(students1);
QStringList assign1 = assignList.split(",,");
for(int i=0; i<assign1.length()-2; i++)
{
ui->tableWidget_5->insertColumn(i);
}
if(assign1[0]=="")
{
assign1.removeFirst();
}
ui->tableWidget_5->setHorizontalHeaderLabels(assign1);
int rowCount = ui->tableWidget_5->rowCount();
int colCount = ui->tableWidget_5->columnCount();
for(int i=0; i<rowCount; i++)
{
for(int z=0; z<colCount;z++)
{
QTableWidgetItem *item12 = new QTableWidgetItem("N/A");
ui->tableWidget_5->setItem(i,z,item12);
}
}
return 0;
}
int MainWindow::saveStudents()
{
QString text;
QString fileName = ui->comboBox->currentText();
int i;
text +="<"+fileName+">\n";
for(i = 0; i<study; i++)
{
if(ui->tableWidget_3->item(i,0)->text().isEmpty())
{
text+="";
}
else
{
text += "<student name=\""+ui->tableWidget_3->item(i,0)->text()+"\" rawGrade=\"";
text += ui->tableWidget_3->item(i,1)->text()+"\" adjustedGrade=\"";
text += ui->tableWidget_3->item(i,2)->text()+"\" letterGrade=\"";
text += ui->tableWidget_3->item(i,3)->text()+"\" notes=\"";
text += ui->tableWidget_3->item(i,4)->text()+"\"/>\n";
}
}
text += "</"+fileName+">\n";
QFile file("students/"+fileName+".xml");
if(file.open(QFile::WriteOnly))
{
QTextStream out(&file);
out << text;
}
file.close();
return 0;
}
int MainWindow::saveAssign()
{
QString text;
QString fileName = ui->comboBox_4->currentText();
int i;
text += "<"+fileName+">\n";
for(i = 0; i<assign; i++)
{
if(ui->tableWidget_2->item(i,0)->text().isEmpty())
{
text+="";
}
else
{
text += "<assignment name=\""+ui->tableWidget_2->item(i,0)->text()+"\" assigmentId=\"";
text += ui->tableWidget_2->item(i,1)->text()+"\" totalPosGrade=\"";
text += ui->tableWidget_2->item(i,2)->text()+"\" weight=\"";
text += ui->tableWidget_2->item(i,3)->text()+"\" dueDate=\"";
text += ui->tableWidget_2->item(i,4)->text()+"\" type=\"";
text += ui->tableWidget_2->item(i,5)->text()+"\" notes=\"";
text += ui->tableWidget_2->item(i,6)->text()+"\"/>\n";
}
}
text += "</"+fileName+">\n";
QFile file("assign/"+fileName+".xml");
if(file.open(QFile::WriteOnly))
{
QTextStream out(&file);
out << text;
}
file.close();
return 0;
}
//this method populates the comboBox
int MainWindow::fillBox()
{
QString comboElem = getOnlyClasses();
QStringList dropDown = comboElem.split(",,");
//the comboElem will populate the comboBox under the students tab
//the comboBox should be populated using a loop and a string that holds only the classes from the xml file
ui->comboBox->clear();
ui->comboBox->insertItems(0,dropDown);
ui->comboBox_4->clear();
ui->comboBox_5->clear();
ui->comboBox_2->clear();
ui->comboBox_4->insertItems(0,dropDown);
ui->comboBox_5->insertItems(0,dropDown);
ui->comboBox_2->insertItems(0,dropDown);
return 0;
}
int MainWindow::listStudents()
{
QString students = "students/"+ui->comboBox_2->currentText()+".xml";
QString str = getClassStudent(students);
QStringList dropDown = str.split(",,");
ui->comboBox_3->clear();
ui->comboBox_3->insertItems(0,dropDown);
return 0;
}
// this creates files in the grades/ folder that hold grades for each class
int MainWindow::saveClasses()
{
QString text;
QString fileName = ui->comboBox_5->currentText();
int i;
text += "<"+fileName+">\n";
//this variable holds the number of columns
int colCount = ui->tableWidget_5->columnCount();
for(i = 0; i<ui->tableWidget_5->rowCount(); i++)
{
text += "<student name=\""+ui->tableWidget_5->verticalHeaderItem(i)->text();
for(int z=0; z<colCount; z++)
{
if(ui->tableWidget_5->item(i,z)->text().isEmpty())
{
text+="\" "+ ui->tableWidget_5->horizontalHeaderItem(z)->text() +"=\""+"";
}
else
{
text += "\" "+ ui->tableWidget_5->horizontalHeaderItem(z)->text() +"=\""+ui->tableWidget_5->item(i,z)->text();
}
}
text += "\"/>\n";
}
text += "</"+fileName+">\n";
QFile file("grades/"+fileName+".xml");
if(file.open(QFile::WriteOnly))
{
QTextStream out(&file);
out << text;
}
file.close();
return 0;
}
//this will load the grades for the specified students in the specified class
int MainWindow::loadGrades()
{
for (int i=0; i < 100; ++i)
ui->tableWidget_4->removeRow(0);
ui->tableWidget_4->reset();
QString str = getClassAssign("assign/"+ui->comboBox_2->currentText()+".xml");
QStringList assignList = str.split(",,");
assignList.removeFirst();
for(int i=0; i<assignList.length()-1; i++)
{
ui->tableWidget_4->insertRow(i);
}
for(int i=0; i<assignList.length()-1; i++)
{
QTableWidgetItem *item = new QTableWidgetItem(assignList[i]);
ui->tableWidget_4->setItem(i,0,item);
}
QString string = getGrades("grades/"+ui->comboBox_2->currentText()+".xml", ui->comboBox_3->currentText());
QStringList gradesList = string.split(",,");
for(int i=0; i<gradesList.length()-1; i++)
{
QTableWidgetItem *item = new QTableWidgetItem(gradesList[i]);
ui->tableWidget_4->setItem(i,1,item);
}
return 0;
}
//removes assignment from the table widget(also from the assignment string list)
//int MainWindow::rmvAssign()
//{
// for(int i = 0; i<assign.length(); i++)
// {
// if(ui->rmvAssign->text() == assign[i])
// {
// ui->tableWidget_5->removeColumn(i);
// assign.removeAt(i);
// }
// }
// return 0;
//}
//
////removes student from the table widget(also from the students string list)
//int MainWindow::rmvStudent()
//{
// for(int i = 0; i<students.length(); i++)
// {
// if(ui->rmvStudent->text() == students[i])
// {
// ui->tableWidget_5->removeRow(i);
// students.removeAt(i);
// }
// }
//
// return 0;
//}
////testing function to display the contents of the assignments string list
//QString MainWindow::displayAssign()
//{
// QString final;
// for(int i=0; i<assign.length(); i++)
// {
// final += assign[i]+" ";
// }
// return final;
//}
| [
"andrei_stefang@yahoo.com"
] | andrei_stefang@yahoo.com |
4c730922568ddf2b9a9e2ecf947a397c79c8f366 | cf8ddfc720bf6451c4ef4fa01684327431db1919 | /SDK/ARKSurvivalEvolved_DinoCharacterStatusComponent_BP_RockDrake_classes.hpp | f13c787e9082cf5b5b79d7dfc3cd6447c511f59f | [
"MIT"
] | permissive | git-Charlie/ARK-SDK | 75337684b11e7b9f668da1f15e8054052a3b600f | c38ca9925309516b2093ad8c3a70ed9489e1d573 | refs/heads/master | 2023-06-20T06:30:33.550123 | 2021-07-11T13:41:45 | 2021-07-11T13:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 960 | hpp | #pragma once
// ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_DinoCharacterStatusComponent_BP_RockDrake_structs.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass DinoCharacterStatusComponent_BP_RockDrake.DinoCharacterStatusComponent_BP_RockDrake_C
// 0x0000 (0x1090 - 0x1090)
class UDinoCharacterStatusComponent_BP_RockDrake_C : public UDinoCharacterStatusComponent_BP_FlyerRide_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass DinoCharacterStatusComponent_BP_RockDrake.DinoCharacterStatusComponent_BP_RockDrake_C");
return ptr;
}
void ExecuteUbergraph_DinoCharacterStatusComponent_BP_RockDrake(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"sergey.2bite@gmail.com"
] | sergey.2bite@gmail.com |
4bb643bf80d8b6362fc08f016edd5729e5234da3 | 47f536bdcf459ae02badfddc1e330bf79074071b | /algorithms/debugging/assert.h | fff50762c077abc3f0fa54d55e870a6346e3175a | [] | no_license | LauraSirbu/COB | 26726dc89bae0ea6a06a8a453fc78cb6422c5ca6 | 92cab210c4bfbc34a73bfd17e9a38fc67055dc50 | refs/heads/master | 2022-06-30T05:44:57.428500 | 2020-05-11T19:22:18 | 2020-05-11T19:22:18 | 258,817,523 | 0 | 0 | null | 2020-05-11T19:22:20 | 2020-04-25T16:06:25 | C++ | UTF-8 | C++ | false | false | 1,533 | h | //-----------------------------------------------------------------------------------------------------------
/*! \file kaos/kernel/system/debugging/assert.h
\brief Definiert kaos_assert
\version 0.1
\date 3.11.2003
\author Christian Oberholzer
Definiert kaos_assert
*/
//-----------------------------------------------------------------------------------------------------------
#ifndef KAOS_TYPES_DEBUGGING_ASSERT_H
#define KAOS_TYPES_DEBUGGING_ASSERT_H
#if defined(KAOS_USE_ASSERTS) && defined(KAOS_VC)
# define kaos_assert(expression, description) \
if (!(expression)) \
{ \
static bool ignore_always_flag = false; \
if (!ignore_always_flag) \
{ \
bool assert_value = false; \
\
if (!::kaos::assertfunction(assert_value, \
__FILE__, \
__LINE__, \
#expression, \
description, \
&ignore_always_flag)) \
{ \
__debugbreak(); /* same as KAOS_ASM { int 3 } */ \
} \
} \
}
#else
# define kaos_assert(expression, description)
#endif
namespace kaos {
bool assertfunction(
bool expression_result,
const char* assert_file,
const long assert_line,
const char* assert_expression,
const char* assert_description,
bool* const ignore_always
);
} // namespace kaos
#endif // KAOS_TYPES_DEBUGGING_ASSERT_H
| [
"laura-andreea.sirbu@mt.com"
] | laura-andreea.sirbu@mt.com |
0ee1fbb222da506ab4b89770c59be4929d53d687 | af76ebfa7fff99eb831338c9698a571ce718d2d4 | /sdk/misc/glow_outline_effect.hpp | f96f53339b8d14ab485ca1e7ab2f5105fbec9e5d | [
"Unlicense"
] | permissive | testcc2c/hvh-cheat | b7e7b9c902d173ad21ece324eb849f9b07e639cd | 89c7f394e5e3418bc795c0a1fae097c443c4c748 | refs/heads/main | 2023-01-31T06:59:46.703401 | 2020-12-02T17:10:25 | 2020-12-02T17:10:25 | 350,192,748 | 4 | 1 | Unlicense | 2021-03-22T03:20:20 | 2021-03-22T03:20:19 | null | UTF-8 | C++ | false | false | 3,317 | hpp | #pragma once
#include "UtlVector.hpp"
#include "../Interfaces/IClientEntity.hpp"
class CGlowObjectManager {
public:
int RegisterGlowObject(entity_t *pEntity, const Vector &vGlowColor, float flGlowAlpha, bool bRenderWhenOccluded, bool bRenderWhenUnoccluded, int nSplitScreenSlot) {
int nIndex;
if (m_nFirstFreeSlot == GlowObjectDefinition_t::END_OF_FREE_LIST) {
nIndex = m_GlowObjectDefinitions.AddToTail();
}
else {
nIndex = m_nFirstFreeSlot;
m_nFirstFreeSlot = m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot;
}
m_GlowObjectDefinitions[nIndex].m_hEntity = pEntity;
m_GlowObjectDefinitions[nIndex].m_vGlowColor = vGlowColor;
m_GlowObjectDefinitions[nIndex].m_flGlowAlpha = flGlowAlpha;
m_GlowObjectDefinitions[nIndex].flUnk = 0.0f;
m_GlowObjectDefinitions[nIndex].m_flBloomAmount = 1.0f;
m_GlowObjectDefinitions[nIndex].localplayeriszeropoint3 = 0.0f;
m_GlowObjectDefinitions[nIndex].m_bRenderWhenOccluded = bRenderWhenOccluded;
m_GlowObjectDefinitions[nIndex].m_bRenderWhenUnoccluded = bRenderWhenUnoccluded;
m_GlowObjectDefinitions[nIndex].m_bFullBloomRender = false;
m_GlowObjectDefinitions[nIndex].m_nFullBloomStencilTestValue = 0;
m_GlowObjectDefinitions[nIndex].m_nSplitScreenSlot = nSplitScreenSlot;
m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot = GlowObjectDefinition_t::ENTRY_IN_USE;
return nIndex;
}
void UnregisterGlowObject(int nGlowObjectHandle) {
Assert(!m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused());
m_GlowObjectDefinitions[nGlowObjectHandle].m_nNextFreeSlot = m_nFirstFreeSlot;
m_GlowObjectDefinitions[nGlowObjectHandle].m_hEntity = NULL;
m_nFirstFreeSlot = nGlowObjectHandle;
}
int HasGlowEffect(entity_t *pEntity) const { //-V2009
for (int i = 0; i < m_GlowObjectDefinitions.Count(); ++i) {
if (!m_GlowObjectDefinitions[i].IsUnused() && m_GlowObjectDefinitions[i].m_hEntity == pEntity) {
return i;
}
}
return NULL;
}
class GlowObjectDefinition_t {
public:
void Set(float r, float g, float b, float a, float bloom, int style) {
m_vGlowColor = Vector(r, g, b);
m_flGlowAlpha = a;
m_bRenderWhenOccluded = true;
m_bRenderWhenUnoccluded = false;
m_flBloomAmount = bloom;
m_nGlowStyle = style;
}
entity_t* GetEnt() {
return m_hEntity;
}
bool IsUnused() const { return m_nNextFreeSlot != GlowObjectDefinition_t::ENTRY_IN_USE; }
public:
entity_t* m_hEntity;
Vector m_vGlowColor;
float m_flGlowAlpha;
char unknown[4]; //pad
float flUnk; //confirmed to be treated as a float while reversing glow functions
float m_flBloomAmount;
float localplayeriszeropoint3;
bool m_bRenderWhenOccluded;
bool m_bRenderWhenUnoccluded;
bool m_bFullBloomRender;
char unknown1[1]; //pad
int m_nFullBloomStencilTestValue; // 0x28
int m_nGlowStyle;
int m_nSplitScreenSlot; //Should be -1
// Linked list of free slots
int m_nNextFreeSlot;
// Special values for GlowObjectDefinition_t::m_nNextFreeSlot
static const int END_OF_FREE_LIST = -1;
static const int ENTRY_IN_USE = -2;
};
CUtlVector< GlowObjectDefinition_t > m_GlowObjectDefinitions;
int m_nFirstFreeSlot;
}; | [
"testezediscord@gmail.com"
] | testezediscord@gmail.com |
4ef9732a556fc3fdd22f8950f4644ae0fe370dc0 | 021f29f60e31605f248e30a59deb603c7e45d6ba | /c++/dz2/dz2/dz2_1.cpp | fef4279afc4bbe05253c6d406c3882f8432569ab | [] | no_license | alexgithubws/shag | 202778e496a036eb9a732a00a13cc070d96bd751 | 4313000014b7fdec90f9f3e85767dddc65b25b90 | refs/heads/master | 2023-06-27T18:33:30.087304 | 2021-07-23T23:09:03 | 2021-07-23T23:09:03 | 388,900,128 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 114 | cpp | #include <iostream>
using namespace std;
void main() {
int a = 0;
while (0 < 0)
cout << a++;
cout << "Bye";
} | [
"spsav123mel@gmail.com"
] | spsav123mel@gmail.com |
7e1c370092f3916b0c4d14556ba53dc0f3197c42 | 5630f2bb9e4b099a523aebc10aff77032f3c465f | /Labs/Lab03/driver.cpp | acce90f155cb09c4f7f458c1e4e7604953e258ef | [] | no_license | wyattwhiting/CS162 | e3ca4b01d491e3894a7cfc8db199c3e4a3439675 | 883c50e62969b722522464d62dd68f11b05386e5 | refs/heads/main | 2023-03-08T08:14:24.114133 | 2021-02-15T21:49:08 | 2021-02-15T21:49:08 | 339,211,319 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 271 | cpp | #include <iostream>
#include <string>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>
#include "Deck.h"
using namespace std;
int main() {
Deck myDeck = Deck();
myDeck.printDeck();
myDeck.shuffleDeck();
myDeck.printDeck();
return 0;
} | [
"wyatt.d.whiting@gmail.com"
] | wyatt.d.whiting@gmail.com |
0462af315ade9d7634043f73083c09cf22bfd8ea | 3de764fac158795384d69345cfe52bdf1d03a558 | /Snake1/CGame.cpp | 41b1d2713101bb91e23ce935835f6aadd4702f0f | [] | no_license | ripmag/Snake | 9b4893f4b871f11b8c48c6cdb14a1a1458e0db89 | 6b16e93c6b4b46dbd33f544be466434715597058 | refs/heads/master | 2021-05-21T04:43:36.756106 | 2020-04-02T19:52:10 | 2020-04-02T19:52:10 | 252,541,030 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20 | cpp | #include "CGame.h"
| [
"ripmag@gmail.com"
] | ripmag@gmail.com |
193c1b63f3797ac7d59705d50054accd35b4a6a0 | d3f2a8b29101638d379f18cbbfa374aa2e2df168 | /InterfacialDesign/Preview/previewwidget.cpp | 82d1290a86be15f5c019cbd1b06054d0f007f0d3 | [] | no_license | xb985547608/VIDICON | 1d6bdf7951d770c63c7cc96c160fb73a6bcd6d56 | 22d527e0c61ec9b6ae79a8cd064229257e644c20 | refs/heads/master | 2021-09-14T22:27:35.070830 | 2017-12-09T09:28:10 | 2017-12-09T09:28:10 | 113,656,755 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 218 | cpp | #include "previewwidget.h"
#include "ui_previewform.h"
PreviewWidget::PreviewWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::PreviewForm)
{
ui->setupUi(this);
}
PreviewWidget::~PreviewWidget()
{
}
| [
"xb985547608@gmail.com"
] | xb985547608@gmail.com |
1e0baea15cf39b9ae88ed09aa96d6c80db026079 | 3db023edb0af1dcf8a1da83434d219c3a96362ba | /windows_nt_3_5_source_code/NT-782/PRIVATE/MAILPLUS/BULLET2/SRC/MSSFS/LOCALFCX.HXX | 6deb147cb24a765f25f1ff0dc297da20fa3e34d7 | [] | no_license | xiaoqgao/windows_nt_3_5_source_code | de30e9b95856bc09469d4008d76191f94379c884 | d2894c9125ff1c14028435ed1b21164f6b2b871a | refs/heads/master | 2022-12-23T17:58:33.768209 | 2020-09-28T20:20:18 | 2020-09-28T20:20:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 493 | hxx | class NCFCX;
class LOCALFCX : public NCFCX
{
VFG( LOCALFCX, NCFCX, NSP );
private:
FIDLIST *pfidlist;
BOOL fAllBuilt;
NCNSID ncnsid;
FACC2 facc2;
NSEC NsecBuildAllFields();
public:
LOCALFCX( void );
virtual NSEC OpenEntry ( LPTYPED_BINARY lptbNSId );
virtual NSEC GetOneField ( FIELD_ID fidRequested,
LPFLV *lplpflv );
virtual NSEC GetAllFields ( LPIBF *lplpibfData );
virtual NSEC CloseEntry ( VOID );
};
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
4297e60f99b166d9c04b8a9003939999881e7725 | 55c7b318c8ab0e93a31bc86b5042d613e22a6871 | /Source/Controls/ListControlPackage/GuiDataGridControls.cpp | 66e783f7b7c6a8cf8a4ed78b671bfd1c6fd1a05a | [] | no_license | fw1121/GacUI | 2b5dd069de9a977d0a6a11b2e7f2a11b5d32c1f2 | bd55c56805b09aeda802071fed8868b3f46b0bc6 | refs/heads/master | 2020-03-28T10:05:28.573388 | 2018-09-08T10:00:00 | 2018-09-08T10:00:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,369 | cpp | #include "GuiDataGridControls.h"
#include "GuiDataGridExtensions.h"
namespace vl
{
namespace presentation
{
namespace controls
{
namespace list
{
using namespace compositions;
using namespace collections;
using namespace description;
using namespace templates;
const wchar_t* const IDataGridView::Identifier = L"vl::presentation::controls::list::IDataGridView";
/***********************************************************************
DefaultDataGridItemTemplate
***********************************************************************/
IDataVisualizerFactory* DefaultDataGridItemTemplate::GetDataVisualizerFactory(vint row, vint column)
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
if (auto factory = dataGrid->dataGridView->GetCellDataVisualizerFactory(row, column))
{
return factory;
}
if (column == 0)
{
return dataGrid->defaultMainColumnVisualizerFactory.Obj();
}
else
{
return dataGrid->defaultSubColumnVisualizerFactory.Obj();
}
}
return nullptr;
}
IDataEditorFactory* DefaultDataGridItemTemplate::GetDataEditorFactory(vint row, vint column)
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
return dataGrid->dataGridView->GetCellDataEditorFactory(row, column);
}
return nullptr;
}
vint DefaultDataGridItemTemplate::GetCellColumnIndex(compositions::GuiGraphicsComposition* composition)
{
for (vint i = 0; i < textTable->GetColumns(); i++)
{
auto cell = textTable->GetSitedCell(0, i);
if (composition == cell)
{
return i;
}
}
return -1;
}
bool DefaultDataGridItemTemplate::IsInEditor(GuiVirtualDataGrid* dataGrid, compositions::GuiMouseEventArgs& arguments)
{
if (!dataGrid->currentEditor) return false;
auto editorComposition = dataGrid->currentEditor->GetTemplate();
auto currentComposition = arguments.eventSource;
while (currentComposition)
{
if (currentComposition == editorComposition)
{
return true;
}
else if (currentComposition == this)
{
break;
}
else
{
currentComposition = currentComposition->GetParent();
}
}
return false;
}
void DefaultDataGridItemTemplate::OnCellButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments)
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
IsInEditor(dataGrid, arguments);
}
}
void DefaultDataGridItemTemplate::OnCellLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments)
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
if (IsInEditor(dataGrid, arguments))
{
arguments.handled = true;
}
else if (dataGrid->GetVisuallyEnabled())
{
vint index = GetCellColumnIndex(sender);
if (index != -1)
{
vint currentRow = GetIndex();
dataGrid->SelectCell({ currentRow,index }, true);
}
}
}
}
void DefaultDataGridItemTemplate::OnCellRightButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments)
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
if (IsInEditor(dataGrid, arguments))
{
arguments.handled = true;
}
else if (dataGrid->GetVisuallyEnabled())
{
vint index = GetCellColumnIndex(sender);
if (index != -1)
{
vint currentRow = GetIndex();
dataGrid->SelectCell({ currentRow,index }, false);
}
}
}
}
void DefaultDataGridItemTemplate::OnColumnChanged()
{
UpdateSubItemSize();
}
void DefaultDataGridItemTemplate::OnInitialize()
{
DefaultListViewItemTemplate::OnInitialize();
{
textTable = new GuiTableComposition;
textTable->SetAlignmentToParent(Margin(0, 0, 0, 0));
textTable->SetRowsAndColumns(1, 1);
textTable->SetRowOption(0, GuiCellOption::MinSizeOption());
textTable->SetColumnOption(0, GuiCellOption::AbsoluteOption(0));
AddChild(textTable);
}
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
vint columnCount = dataGrid->listViewItemView->GetColumnCount();
vint itemIndex = GetIndex();
dataVisualizers.Resize(columnCount);
for (vint i = 0; i < dataVisualizers.Count(); i++)
{
auto factory = GetDataVisualizerFactory(itemIndex, i);
dataVisualizers[i] = factory->CreateVisualizer(dataGrid);
}
textTable->SetRowsAndColumns(1, columnCount);
for (vint i = 0; i < columnCount; i++)
{
auto cell = new GuiCellComposition;
textTable->AddChild(cell);
cell->SetSite(0, i, 1, 1);
cell->GetEventReceiver()->leftButtonDown.AttachMethod(this, &DefaultDataGridItemTemplate::OnCellButtonDown);
cell->GetEventReceiver()->rightButtonDown.AttachMethod(this, &DefaultDataGridItemTemplate::OnCellButtonDown);
cell->GetEventReceiver()->leftButtonUp.AttachMethod(this, &DefaultDataGridItemTemplate::OnCellLeftButtonUp);
cell->GetEventReceiver()->rightButtonUp.AttachMethod(this, &DefaultDataGridItemTemplate::OnCellRightButtonUp);
auto composition = dataVisualizers[i]->GetTemplate();
composition->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(composition);
}
for (vint i = 0; i < dataVisualizers.Count(); i++)
{
dataVisualizers[i]->BeforeVisualizeCell(dataGrid->GetItemProvider(), itemIndex, i);
}
GridPos selectedCell = dataGrid->GetSelectedCell();
if (selectedCell.row == itemIndex)
{
NotifySelectCell(selectedCell.column);
}
else
{
NotifySelectCell(-1);
}
UpdateSubItemSize();
}
SelectedChanged.AttachMethod(this, &DefaultDataGridItemTemplate::OnSelectedChanged);
FontChanged.AttachMethod(this, &DefaultDataGridItemTemplate::OnFontChanged);
ContextChanged.AttachMethod(this, &DefaultDataGridItemTemplate::OnContextChanged);
SelectedChanged.Execute(compositions::GuiEventArgs(this));
FontChanged.Execute(compositions::GuiEventArgs(this));
ContextChanged.Execute(compositions::GuiEventArgs(this));
}
void DefaultDataGridItemTemplate::OnSelectedChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{
if (!GetSelected())
{
NotifySelectCell(-1);
}
}
void DefaultDataGridItemTemplate::OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{
FOREACH(Ptr<IDataVisualizer>, visualizer, dataVisualizers)
{
visualizer->GetTemplate()->SetFont(GetFont());
}
if (currentEditor)
{
currentEditor->GetTemplate()->SetFont(GetFont());
}
}
void DefaultDataGridItemTemplate::OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{
FOREACH(Ptr<IDataVisualizer>, visualizer, dataVisualizers)
{
visualizer->GetTemplate()->SetContext(GetContext());
}
if (currentEditor)
{
currentEditor->GetTemplate()->SetContext(GetContext());
}
}
DefaultDataGridItemTemplate::DefaultDataGridItemTemplate()
{
}
DefaultDataGridItemTemplate::~DefaultDataGridItemTemplate()
{
FOREACH(Ptr<IDataVisualizer>, visualizer, dataVisualizers)
{
visualizer->NotifyDeletedTemplate();
}
if (currentEditor)
{
currentEditor->NotifyDeletedTemplate();
}
}
void DefaultDataGridItemTemplate::UpdateSubItemSize()
{
if (auto dataGrid = dynamic_cast<GuiVirtualDataGrid*>(listControl))
{
vint columnCount = dataGrid->listViewItemView->GetColumnCount();
if (columnCount > textTable->GetColumns())
{
columnCount = textTable->GetColumns();
}
for (vint i = 0; i < columnCount; i++)
{
textTable->SetColumnOption(i, GuiCellOption::AbsoluteOption(dataGrid->columnItemView->GetColumnSize(i)));
}
textTable->UpdateCellBounds();
}
}
bool DefaultDataGridItemTemplate::IsEditorOpened()
{
return currentEditor != nullptr;
}
void DefaultDataGridItemTemplate::NotifyOpenEditor(vint column, IDataEditor* editor)
{
currentEditor = editor;
if (currentEditor)
{
auto cell = textTable->GetSitedCell(0, column);
auto* editorBounds = currentEditor->GetTemplate();
editorBounds->SetFont(GetFont());
editorBounds->SetContext(GetContext());
if (editorBounds->GetParent() && editorBounds->GetParent() != cell)
{
editorBounds->GetParent()->RemoveChild(editorBounds);
}
editorBounds->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(editorBounds);
if (auto focusControl = currentEditor->GetTemplate()->GetFocusControl())
{
focusControl->SetFocus();
}
}
}
void DefaultDataGridItemTemplate::NotifyCloseEditor()
{
if (currentEditor)
{
auto composition = currentEditor->GetTemplate();
if (composition->GetParent())
{
composition->GetParent()->RemoveChild(composition);
}
currentEditor = nullptr;
}
}
void DefaultDataGridItemTemplate::NotifySelectCell(vint column)
{
for (vint i = 0; i < dataVisualizers.Count(); i++)
{
dataVisualizers[i]->SetSelected(i == column);
}
}
void DefaultDataGridItemTemplate::NotifyCellEdited()
{
for (vint i = 0; i < dataVisualizers.Count(); i++)
{
dataVisualizers[i]->BeforeVisualizeCell(listControl->GetItemProvider(), GetIndex(), i);
}
}
}
/***********************************************************************
GuiVirtualDataGrid (Editor)
***********************************************************************/
using namespace list;
compositions::IGuiAltActionHost* GuiVirtualDataGrid::GetActivatingAltHost()
{
if (currentEditor)
{
if (auto focusControl = currentEditor->GetTemplate()->GetFocusControl())
{
if (auto action = focusControl->QueryTypedService<IGuiAltAction>())
{
if (action->IsAltAvailable() && action->IsAltEnabled())
{
SetAltComposition(currentEditor->GetTemplate());
SetAltControl(focusControl, true);
return this;
}
}
}
}
SetAltComposition(nullptr);
SetAltControl(nullptr, false);
return GuiVirtualListView::GetActivatingAltHost();
}
void GuiVirtualDataGrid::OnItemModified(vint start, vint count, vint newCount)
{
GuiVirtualListView::OnItemModified(start, count, newCount);
if(!GetItemProvider()->IsEditing())
{
StopEdit();
}
}
void GuiVirtualDataGrid::OnStyleUninstalled(ItemStyle* style)
{
GuiVirtualListView::OnStyleUninstalled(style);
if (auto itemStyle = dynamic_cast<DefaultDataGridItemTemplate*>(style))
{
if (itemStyle->IsEditorOpened())
{
itemStyle->NotifyCloseEditor();
currentEditor = nullptr;
currentEditorPos = { -1,-1 };
}
}
}
void GuiVirtualDataGrid::NotifyCloseEditor()
{
if (currentEditorPos.row != -1 && GetArranger())
{
auto style = GetArranger()->GetVisibleStyle(currentEditorPos.row);
if (auto itemStyle = dynamic_cast<DefaultDataGridItemTemplate*>(style))
{
itemStyle->NotifyCloseEditor();
}
}
}
void GuiVirtualDataGrid::NotifySelectCell(vint row, vint column)
{
if (selectedCell.row != row || selectedCell.column != column)
{
selectedCell = { row, column };
SelectedCellChanged.Execute(GetNotifyEventArguments());
auto style = GetArranger()->GetVisibleStyle(row);
if (auto itemStyle = dynamic_cast<DefaultDataGridItemTemplate*>(style))
{
itemStyle->NotifySelectCell(column);
}
}
}
bool GuiVirtualDataGrid::StartEdit(vint row, vint column)
{
StopEdit();
NotifySelectCell(row, column);
auto style = GetArranger()->GetVisibleStyle(row);
if (auto itemStyle = dynamic_cast<DefaultDataGridItemTemplate*>(style))
{
if (auto factory = dataGridView->GetCellDataEditorFactory(row, column))
{
currentEditorOpeningEditor = true;
currentEditorPos = { row,column };
currentEditor = factory->CreateEditor(this);
if (auto focusControl = currentEditor->GetTemplate()->GetFocusControl())
{
focusControl->SetAlt(L"E");
}
currentEditor->BeforeEditCell(GetItemProvider(), row, column);
itemStyle->NotifyOpenEditor(column, currentEditor.Obj());
currentEditorOpeningEditor = false;
return true;
}
}
return false;
}
void GuiVirtualDataGrid::StopEdit()
{
if (GetItemProvider()->IsEditing())
{
NotifyCloseEditor();
}
else
{
if (currentEditorPos != GridPos{-1, -1})
{
if (currentEditor)
{
NotifyCloseEditor();
}
}
}
SetAltComposition(nullptr);
SetAltControl(nullptr, false);
currentEditor = nullptr;
currentEditorPos = { -1,-1 };
}
/***********************************************************************
GuiVirtualDataGrid (IDataGridContext)
***********************************************************************/
templates::GuiListViewTemplate* GuiVirtualDataGrid::GetListViewControlTemplate()
{
return GetControlTemplateObject(true);
}
void GuiVirtualDataGrid::RequestSaveData()
{
if (currentEditor && !currentEditorOpeningEditor)
{
GuiControl* focusedControl = nullptr;
if (auto controlHost = GetRelatedControlHost())
{
if (auto graphicsHost = controlHost->GetGraphicsHost())
{
if (auto focusComposition = graphicsHost->GetFocusedComposition())
{
focusedControl = focusComposition->GetRelatedControl();
}
}
}
GetItemProvider()->PushEditing();
dataGridView->SetBindingCellValue(currentEditorPos.row, currentEditorPos.column, currentEditor->GetTemplate()->GetCellValue());
GetItemProvider()->PopEditing();
auto style = GetArranger()->GetVisibleStyle(currentEditorPos.row);
if (auto itemStyle = dynamic_cast<DefaultDataGridItemTemplate*>(style))
{
itemStyle->NotifyCellEdited();
}
if (currentEditor && focusedControl)
{
focusedControl->SetFocus();
}
}
}
/***********************************************************************
GuiVirtualDataGrid
***********************************************************************/
void GuiVirtualDataGrid::OnColumnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments)
{
if(dataGridView->IsColumnSortable(arguments.itemIndex))
{
switch(columnItemView->GetSortingState(arguments.itemIndex))
{
case ColumnSortingState::NotSorted:
dataGridView->SortByColumn(arguments.itemIndex, true);
break;
case ColumnSortingState::Ascending:
dataGridView->SortByColumn(arguments.itemIndex, false);
break;
case ColumnSortingState::Descending:
dataGridView->SortByColumn(-1, false);
break;
}
}
}
void GuiVirtualDataGrid::OnSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{
if (!skipOnSelectionChanged)
{
vint row = GetSelectedItemIndex();
if (row != -1)
{
if (selectedCell.row != row && selectedCell.column != -1)
{
SelectCell({ row,selectedCell.column }, false);
}
else
{
SelectCell({ row,0 }, false);
}
}
else
{
StopEdit();
NotifySelectCell(-1, -1);
}
}
}
void GuiVirtualDataGrid::OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments)
{
if (selectedCell.row != -1)
{
if (arguments.code == VKEY::_RETURN)
{
RequestSaveData();
SelectCell(selectedCell, !currentEditor);
arguments.handled = true;
if (!currentEditor)
{
SetFocus();
}
arguments.handled = true;
}
else if (arguments.code == VKEY::_ESCAPE)
{
if (currentEditor)
{
SelectCell(currentEditorPos, false);
SetFocus();
arguments.handled = true;
}
}
else
{
vint columnOffset = 0;
switch (arguments.code)
{
case VKEY::_LEFT:
columnOffset = -1;
arguments.handled = true;
break;
case VKEY::_RIGHT:
columnOffset = 1;
arguments.handled = true;
break;
default:
return;
}
vint column = selectedCell.column + columnOffset;
if (column < 0)
{
column = 0;
}
else if (column >= listViewItemView->GetColumnCount())
{
column = listViewItemView->GetColumnCount();
}
SelectCell({ selectedCell.row, column }, false);
}
}
}
void GuiVirtualDataGrid::OnKeyUp(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments)
{
}
GuiVirtualDataGrid::GuiVirtualDataGrid(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider)
:GuiVirtualListView(themeName, _itemProvider)
{
listViewItemView = dynamic_cast<IListViewItemView*>(_itemProvider->RequestView(IListViewItemView::Identifier));
columnItemView = dynamic_cast<ListViewColumnItemArranger::IColumnItemView*>(_itemProvider->RequestView(ListViewColumnItemArranger::IColumnItemView::Identifier));
dataGridView = dynamic_cast<IDataGridView*>(_itemProvider->RequestView(IDataGridView::Identifier));
{
auto mainProperty = [](const Value&) { return new MainColumnVisualizerTemplate; };
auto subProperty = [](const Value&) { return new SubColumnVisualizerTemplate; };
auto focusRectangleProperty = [](const Value&) { return new FocusRectangleVisualizerTemplate; };
auto cellBorderProperty = [](const Value&) { return new CellBorderVisualizerTemplate; };
defaultMainColumnVisualizerFactory =
MakePtr<DataVisualizerFactory>(cellBorderProperty,
MakePtr<DataVisualizerFactory>(focusRectangleProperty,
MakePtr<DataVisualizerFactory>(mainProperty)
));
defaultSubColumnVisualizerFactory =
MakePtr<DataVisualizerFactory>(cellBorderProperty,
MakePtr<DataVisualizerFactory>(focusRectangleProperty,
MakePtr<DataVisualizerFactory>(subProperty)
));
}
CHECK_ERROR(listViewItemView != nullptr, L"GuiVirtualDataGrid::GuiVirtualDataGrid(IStyleController*, GuiListControl::IItemProvider*)#Missing IListViewItemView from item provider.");
CHECK_ERROR(columnItemView != nullptr, L"GuiVirtualDataGrid::GuiVirtualDataGrid(IStyleController*, GuiListControl::IItemProvider*)#Missing ListViewColumnItemArranger::IColumnItemView from item provider.");
CHECK_ERROR(dataGridView != nullptr, L"GuiVirtualDataGrid::GuiVirtualDataGrid(IStyleController*, GuiListControl::IItemProvider*)#Missing IDataGridView from item provider.");
SetViewToDefault();
ColumnClicked.AttachMethod(this, &GuiVirtualDataGrid::OnColumnClicked);
SelectionChanged.AttachMethod(this, &GuiVirtualDataGrid::OnSelectionChanged);
focusableComposition->GetEventReceiver()->keyDown.AttachMethod(this, &GuiVirtualDataGrid::OnKeyDown);
focusableComposition->GetEventReceiver()->keyUp.AttachMethod(this, &GuiVirtualDataGrid::OnKeyUp);
SelectedCellChanged.SetAssociatedComposition(boundsComposition);
}
GuiVirtualDataGrid::~GuiVirtualDataGrid()
{
}
GuiListControl::IItemProvider* GuiVirtualDataGrid::GetItemProvider()
{
return GuiVirtualListView::GetItemProvider();
}
void GuiVirtualDataGrid::SetViewToDefault()
{
SetStyleAndArranger(
[](const Value&) { return new list::DefaultDataGridItemTemplate; },
new list::ListViewColumnItemArranger
);
}
GridPos GuiVirtualDataGrid::GetSelectedCell()
{
return selectedCell;
}
bool GuiVirtualDataGrid::SelectCell(const GridPos& value, bool openEditor)
{
bool validPos = 0 <= value.row && value.row < GetItemProvider()->Count() && 0 <= value.column && value.column < listViewItemView->GetColumnCount();
if (validPos && selectedCell == value)
{
if (currentEditor && !openEditor)
{
StopEdit();
}
else if (!currentEditor && openEditor)
{
StartEdit(value.row, value.column);
}
return currentEditor != nullptr;
}
StopEdit();
if (validPos)
{
NotifySelectCell(value.row, value.column);
if (openEditor)
{
EnsureItemVisible(value.row);
if (GetMultiSelect())
{
ClearSelection();
}
skipOnSelectionChanged = true;
SetSelected(value.row, true);
skipOnSelectionChanged = false;
return StartEdit(value.row, value.column);
}
}
else
{
NotifySelectCell(-1, -1);
ClearSelection();
}
return false;
}
}
}
} | [
"vczh@163.com"
] | vczh@163.com |
ed7306c18b33230a7031a933c235829efbe5cdc3 | 767ddcb3fdf21672882783a2336b7c1ef5b5da17 | /u3dx/libs_core/cpp/native_project/Urho3d/Source/Engine/Urho2D/ParticleEmitter2D.cpp | 88c6cc57c3f344240137ae345b4868e018713753 | [] | no_license | wangjz/urho3d-haxe | c56e39d578c73cf9c6f22bc79420fde2ace17669 | 8ceb981fa2e6d24470b42cdcd3dee83024bfa391 | refs/heads/master | 2021-01-19T09:01:57.073419 | 2014-11-12T11:11:35 | 2014-11-12T11:11:35 | 26,084,326 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 12,695 | cpp | //
// Copyright (c) 2008-2014 the Urho3D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include "Precompiled.h"
#include "Camera.h"
#include "Context.h"
#include "ParticleEffect2D.h"
#include "ParticleEmitter2D.h"
#include "ResourceCache.h"
#include "Scene.h"
#include "SceneEvents.h"
#include "DebugNew.h"
namespace Urho3D
{
extern const char* URHO2D_CATEGORY;
ParticleEmitter2D::ParticleEmitter2D(Context* context) :
Drawable2D(context),
numParticles_(0),
emissionTime_(0.0f),
emitParticleTime_(0.0f),
boundingBoxMinPoint_(Vector3::ZERO),
boundingBoxMaxPoint_(Vector3::ZERO)
{
}
ParticleEmitter2D::~ParticleEmitter2D()
{
}
void ParticleEmitter2D::RegisterObject(Context* context)
{
context->RegisterFactory<ParticleEmitter2D>(URHO2D_CATEGORY);
ACCESSOR_ATTRIBUTE(ParticleEmitter2D, VAR_RESOURCEREF, "Particle Effect", GetParticleEffectAttr, SetParticleEffectAttr, ResourceRef, ResourceRef(ParticleEffect2D::GetTypeStatic()), AM_DEFAULT);
COPY_BASE_ATTRIBUTES(ParticleEmitter2D, Drawable2D);
}
void ParticleEmitter2D::OnSetEnabled()
{
Drawable2D::OnSetEnabled();
Scene* scene = GetScene();
if (scene)
{
if (IsEnabledEffective())
SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(ParticleEmitter2D, HandleScenePostUpdate));
else
UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
}
}
void ParticleEmitter2D::Update(const FrameInfo& frame)
{
if (!effect_)
return;
float timeStep = frame.timeStep_;
Vector3 worldPosition = GetNode()->GetWorldPosition();
float worldScale = GetNode()->GetWorldScale().x_ * PIXEL_SIZE;
boundingBoxMinPoint_ = Vector3(M_INFINITY, M_INFINITY, 0.0f);
boundingBoxMaxPoint_ = Vector3(-M_INFINITY, -M_INFINITY, 0.0f);
int particleIndex = 0;
while (particleIndex < numParticles_)
{
Particle2D& particle = particles_[particleIndex];
if (particle.timeToLive_ > 0.0f)
{
UpdateParticle(particle, timeStep, worldPosition, worldScale);
++particleIndex;
}
else
{
if (particleIndex != numParticles_ - 1)
particles_[particleIndex] = particles_[numParticles_ - 1];
--numParticles_;
}
}
if (emissionTime_ >= 0.0f)
{
float worldAngle = GetNode()->GetWorldRotation().RollAngle();
float timeBetweenParticles = effect_->GetParticleLifeSpan() / particles_.Size();
emitParticleTime_ += timeStep;
while (emitParticleTime_ > 0.0f)
{
if (EmitParticle(worldPosition, worldAngle, worldScale))
UpdateParticle(particles_[numParticles_ - 1], emitParticleTime_, worldPosition, worldScale);
emitParticleTime_ -= timeBetweenParticles;
}
if (emissionTime_ > 0.0f)
emissionTime_ = Max(0.0f, emissionTime_ - timeStep);
}
verticesDirty_ = true;
OnMarkedDirty(node_);
}
void ParticleEmitter2D::SetEffect(ParticleEffect2D* model)
{
if (model == effect_)
return;
effect_ = model;
MarkNetworkUpdate();
if (!effect_)
return;
SetSprite(effect_->GetSprite());
SetBlendMode(effect_->GetBlendMode());
SetMaxParticles(effect_->GetMaxParticles());
emitParticleTime_ = 0.0f;
emissionTime_ = effect_->GetDuration();
}
void ParticleEmitter2D::SetMaxParticles(unsigned maxParticles)
{
maxParticles = Max(maxParticles, 1);
particles_.Resize(maxParticles);
vertices_.Reserve(maxParticles * 4);
numParticles_ = Min(maxParticles, numParticles_);
}
ParticleEffect2D* ParticleEmitter2D::GetEffect() const
{
return effect_;
}
void ParticleEmitter2D::SetParticleEffectAttr(ResourceRef value)
{
materialUpdatePending_ = true;
ResourceCache* cache = GetSubsystem<ResourceCache>();
SetEffect(cache->GetResource<ParticleEffect2D>(value.name_));
}
Urho3D::ResourceRef ParticleEmitter2D::GetParticleEffectAttr() const
{
return GetResourceRef(effect_, ParticleEffect2D::GetTypeStatic());
}
void ParticleEmitter2D::OnNodeSet(Node* node)
{
Drawable2D::OnNodeSet(node);
if (node)
{
Scene* scene = GetScene();
if (scene && IsEnabledEffective())
SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(ParticleEmitter2D, HandleScenePostUpdate));
}
}
void ParticleEmitter2D::OnWorldBoundingBoxUpdate()
{
boundingBox_.Clear();
boundingBox_.Merge(boundingBoxMinPoint_);
boundingBox_.Merge(boundingBoxMaxPoint_);
worldBoundingBox_ = boundingBox_;
}
void ParticleEmitter2D::UpdateVertices()
{
if (!verticesDirty_)
return;
vertices_.Clear();
Texture2D* texture = GetTexture();
if (!texture)
return;
const IntRect& rectangle_ = sprite_->GetRectangle();
if (rectangle_.Width() == 0 || rectangle_.Height() == 0)
return;
Vertex2D vertex0;
Vertex2D vertex1;
Vertex2D vertex2;
Vertex2D vertex3;
vertex0.uv_ = Vector2(0.0f, 1.0f);
vertex1.uv_ = Vector2(0.0f, 0.0f);
vertex2.uv_ = Vector2(1.0f, 0.0f);
vertex3.uv_ = Vector2(1.0f, 1.0f);
for (int i = 0; i < numParticles_; ++i)
{
Particle2D& p = particles_[i];
float rotation = -p.rotation_;
float c = Cos(rotation);
float s = Sin(rotation);
float add = (c + s) * p.size_ * 0.5f;
float sub = (c - s) * p.size_ * 0.5f;
vertex0.position_ = Vector3(p.position_.x_ - sub, p.position_.y_ - add, 0.0f);
vertex1.position_ = Vector3(p.position_.x_ - add, p.position_.y_ + sub, 0.0f);
vertex2.position_ = Vector3(p.position_.x_ + sub, p.position_.y_ + add, 0.0f);
vertex3.position_ = Vector3(p.position_.x_ + add, p.position_.y_ - sub, 0.0f);
vertex0.color_ = vertex1.color_ = vertex2.color_ = vertex3.color_ = p.color_.ToUInt();
vertices_.Push(vertex0);
vertices_.Push(vertex1);
vertices_.Push(vertex2);
vertices_.Push(vertex3);
}
verticesDirty_ = false;
}
void ParticleEmitter2D::HandleScenePostUpdate(StringHash eventType, VariantMap& eventData)
{
MarkForUpdate();
}
bool ParticleEmitter2D::EmitParticle(const Vector3& worldPosition, float worldAngle, float worldScale)
{
if (numParticles_ >= effect_->GetMaxParticles())
return false;
float lifespan = effect_->GetParticleLifeSpan() + effect_->GetParticleLifespanVariance() * Random(-1.0f, 1.0f);
if (lifespan <= 0.0f)
return false;
float invLifespan = 1.0f / lifespan;
Particle2D& particle = particles_[numParticles_++];
particle.timeToLive_ = lifespan;
particle.position_.x_ = worldPosition.x_ + worldScale * effect_->GetSourcePositionVariance().x_ * Random(-1.0f, 1.0f);
particle.position_.y_ = worldPosition.y_ + worldScale * effect_->GetSourcePositionVariance().y_ * Random(-1.0f, 1.0f);
particle.startPos_.x_ = worldPosition.x_;
particle.startPos_.y_ = worldPosition.y_;
float angle = worldAngle + effect_->GetAngle() + effect_->GetAngleVariance() * Random(-1.0f, 1.0f);
float speed = worldScale * (effect_->GetSpeed() + effect_->GetSpeedVariance() * Random(-1.0f, 1.0f));
particle.velocity_.x_ = speed * Cos(angle);
particle.velocity_.y_ = speed * Sin(angle);
float maxRadius = Max(0.0f, worldScale * (effect_->GetMaxRadius() + effect_->GetMaxRadiusVariance() * Random(-1.0f, 1.0f)));
float minRadius = Max(0.0f, worldScale * (effect_->GetMinRadius() + effect_->GetMinRadiusVariance() * Random(-1.0f, 1.0f)));
particle.emitRadius_ = maxRadius;
particle.emitRadiusDelta_ = (minRadius - maxRadius) * invLifespan;
particle.emitRotation_ = worldAngle + effect_->GetAngle() + effect_->GetAngleVariance() * Random(-1.0f, 1.0f);
particle.emitRotationDelta_ = effect_->GetRotatePerSecond() + effect_->GetRotatePerSecondVariance() * Random(-1.0f, 1.0f);
particle.radialAcceleration_ = worldScale * (effect_->GetRadialAcceleration() + effect_->GetRadialAccelVariance() * Random(-1.0f, 1.0f));
particle.tangentialAcceleration_ = worldScale * (effect_->GetTangentialAcceleration() + effect_->GetTangentialAccelVariance() * Random(-1.0f, 1.0f));
float startSize = worldScale * Max(0.1f, effect_->GetStartParticleSize() + effect_->GetStartParticleSizeVariance() * Random(-1.0f, 1.0f));
float finishSize = worldScale * Max(0.1f, effect_->GetFinishParticleSize() + effect_->GetFinishParticleSizeVariance() * Random(-1.0f, 1.0f));
particle.size_ = startSize;
particle.sizeDelta_ = (finishSize - startSize) * invLifespan;
particle.color_ = effect_->GetStartColor() + effect_->GetStartColorVariance() * Random(-1.0f, 1.0f);
Color endColor = effect_->GetFinishColor() + effect_->GetFinishColorVariance() * Random(-1.0f, 1.0f);
particle.colorDelta_= (endColor - particle.color_) * invLifespan;
particle.rotation_ = worldAngle + effect_->GetRotationStart() + effect_->GetRotationStartVariance() * Random(-1.0f, 1.0f);
float endRotation = worldAngle + effect_->GetRotationEnd() + effect_->GetRotationEndVariance() * Random(-1.0f, 1.0f);
particle.rotationDelta_ = (endRotation - particle.rotation_) * invLifespan;
return true;
}
void ParticleEmitter2D::UpdateParticle(Particle2D& particle, float timeStep, const Vector3& worldPosition, float worldScale)
{
if (timeStep > particle.timeToLive_)
timeStep = particle.timeToLive_;
particle.timeToLive_ -= timeStep;
if (effect_->GetEmitterType() == EMITTER_TYPE_RADIAL)
{
particle.emitRotation_ += particle.emitRotationDelta_ * timeStep;
particle.emitRadius_ += particle.emitRadiusDelta_ * timeStep;
particle.position_.x_ = particle.startPos_.x_ - Cos(particle.emitRotation_) * particle.emitRadius_;
particle.position_.y_ = particle.startPos_.y_ + Sin(particle.emitRotation_) * particle.emitRadius_;
}
else
{
float distanceX = particle.position_.x_ - particle.startPos_.x_;
float distanceY = particle.position_.y_ - particle.startPos_.y_;
float distanceScalar = Vector2(distanceX, distanceY).Length();
if (distanceScalar < 0.0001f)
distanceScalar = 0.0001f;
float radialX = distanceX / distanceScalar;
float radialY = distanceY / distanceScalar;
float tangentialX = radialX;
float tangentialY = radialY;
radialX *= particle.radialAcceleration_;
radialY *= particle.radialAcceleration_;
float newY = tangentialX;
tangentialX = -tangentialY * particle.tangentialAcceleration_;
tangentialY = newY * particle.tangentialAcceleration_;
particle.velocity_.x_ += (effect_->GetGravity().x_ * worldScale + radialX - tangentialX) * timeStep;
particle.velocity_.y_ -= (effect_->GetGravity().y_ * worldScale - radialY + tangentialY) * timeStep;
particle.position_.x_ += particle.velocity_.x_ * timeStep;
particle.position_.y_ += particle.velocity_.y_ * timeStep;
}
particle.size_ += particle.sizeDelta_ * timeStep;
particle.rotation_ += particle.rotationDelta_ * timeStep;
particle.color_ += particle.colorDelta_ * timeStep;
float halfSize = particle.size_ * 0.5f;
boundingBoxMinPoint_.x_ = Min(boundingBoxMinPoint_.x_, particle.position_.x_ - halfSize);
boundingBoxMinPoint_.y_ = Min(boundingBoxMinPoint_.y_, particle.position_.y_ - halfSize);
boundingBoxMaxPoint_.x_ = Max(boundingBoxMaxPoint_.x_, particle.position_.x_ + halfSize);
boundingBoxMaxPoint_.y_ = Max(boundingBoxMaxPoint_.y_, particle.position_.y_ + halfSize);
}
}
| [
"421924396@qq.com"
] | 421924396@qq.com |
f41e7ac9dfce0dfb63382d9daffae14f1a7f83d7 | 9593f702a96827d7b03159084fb75d4c8213ae04 | /include/armadillo_bits/fn_trans.hpp | 450ff43e401eee582f339764f251d88e0387c4e4 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | kthohr/armadillo-code | b6390848895ca6a84da2e48ce50fc66ca16883c8 | 1ac3e5de5c41fd52aabf5fa5e1a36c40fc08cf3a | refs/heads/unstable | 2021-04-12T11:50:48.673159 | 2018-03-26T21:04:28 | 2018-03-26T21:04:28 | 126,883,010 | 0 | 1 | Apache-2.0 | 2018-03-26T19:59:20 | 2018-03-26T19:59:17 | null | UTF-8 | C++ | false | false | 2,780 | hpp | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 National ICT Australia (NICTA)
//
// 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.
// ------------------------------------------------------------------------
//! \addtogroup fn_trans
//! @{
template<typename T1>
arma_warn_unused
arma_inline
const Op<T1, op_htrans>
trans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return Op<T1, op_htrans>(X);
}
template<typename T1>
arma_warn_unused
arma_inline
const Op<T1, op_htrans>
htrans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return Op<T1, op_htrans>(X);
}
//
// handling of sparse matrices
template<typename T1>
arma_warn_unused
inline
typename
enable_if2
<
is_arma_sparse_type<T1>::value,
const SpOp<T1,spop_strans>
>::result
trans
(
const T1& x,
const typename arma_not_cx<typename T1::elem_type>::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return SpOp<T1,spop_strans>(x);
}
template<typename T1>
arma_warn_unused
inline
typename
enable_if2
<
is_arma_sparse_type<T1>::value,
const SpOp<T1,spop_htrans>
>::result
trans
(
const T1& x,
const typename arma_cx_only<typename T1::elem_type>::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return SpOp<T1,spop_htrans>(x);
}
template<typename T1>
arma_warn_unused
inline
typename
enable_if2
<
is_arma_sparse_type<T1>::value,
const SpOp<T1,spop_strans>
>::result
htrans
(
const T1& x,
const typename arma_not_cx<typename T1::elem_type>::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return SpOp<T1,spop_strans>(x);
}
template<typename T1>
arma_warn_unused
inline
typename
enable_if2
<
is_arma_sparse_type<T1>::value,
const SpOp<T1,spop_htrans>
>::result
htrans
(
const T1& x,
const typename arma_cx_only<typename T1::elem_type>::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return SpOp<T1,spop_htrans>(x);
}
//! @}
| [
"conrad /att/ nospam /dott/ linux /dott/ com"
] | conrad /att/ nospam /dott/ linux /dott/ com |
aa83d221a0973b722f8fd5ef12a141ee256a0056 | 818dfd7b1088f30ca348c61e901224e267ca0add | /07 TabCtrl/07 TabCtrlDlg.h | 25b84d93cf4b20afc993a1085cf22e0da874c604 | [] | no_license | Run2948/mfc-basic | 6531ffedf616771efbb45be35d84db76f649366a | df0e4a79f96209bc5796229c0f40dd59052dcb47 | refs/heads/master | 2023-07-15T00:50:38.741123 | 2021-08-23T13:13:40 | 2021-08-23T13:13:40 | 399,108,770 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 755 | h |
// 07 TabCtrlDlg.h: 头文件
//
#pragma once
#include "TabSheet.h"
#include "CDlg1.h"
#include "CDlg2.h"
// CMy07TabCtrlDlg 对话框
class CMy07TabCtrlDlg : public CDialogEx
{
// 构造
public:
CMy07TabCtrlDlg(CWnd* pParent = nullptr); // 标准构造函数
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_MY07_TABCTRL_DIALOG };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
private:
// CTabCtrl m_Tab;
CTabSheet m_Tab;
CDlg1 dlg1;
CDlg2 dlg2;
};
| [
"15997352948@163.com"
] | 15997352948@163.com |
2d7275e13e8d08581d85160ec9f2d2dbe1bf41fc | b095158e129dfab484b17314fbae9d7aa81af4e5 | /source/EliteQuant/Services/Strategy/strategyservice.h | 14f844b888292a3de916f3686abfde17d60b16a2 | [
"Apache-2.0"
] | permissive | njuxdj/EliteQuant_Cpp | aca5098baf6f0b7f802c91532d7650fd848b0cc9 | b792e8b72ec49fdca99d389f4cfe9671dff0bb6d | refs/heads/master | 2021-05-09T02:51:23.968524 | 2018-03-17T14:39:06 | 2018-03-17T14:39:06 | 119,224,763 | 1 | 0 | null | 2018-01-28T03:37:59 | 2018-01-28T03:37:58 | null | UTF-8 | C++ | false | false | 286 | h | #ifndef __EliteQuant_Engine_StrategyThread_H__
#define __EliteQuant_Engine_StrategyThread_H__
#include <memory>
#include <Common/config.h>
#include <Common/Data/marketdatafeed.h>
#include <Common/Brokerage/brokerage.h>
namespace EliteQuant
{
void StrategyManagerService();
}
#endif
| [
"contact@elitequant.com"
] | contact@elitequant.com |
c50b84364c6082295b25f1774392734b75f75a5c | 46f80528fb81764d062a81f85cf28a64495a247f | /Game/LevelTest.h | e71151c6c6d3f7ef4e3684f3d5b97502222c20fb | [] | no_license | andrepappa/Comatic-Trauma | 264daa22a9359a6aebbbd9d3c26909612c3d0ce9 | 203fdd83140e6df5a65f210b11c176491495b47c | refs/heads/master | 2021-03-31T01:57:10.579279 | 2013-01-27T15:49:40 | 2013-01-27T15:49:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 541 | h | #pragma once
#include "phoenixengine\core\gamestate.h"
#include "GameObject.h"
#include "Player.h"
#include <iostream>
#include "AnimManager.h"
#include "Enemies.h"
class LevelTest :
public GameState
{
public:
virtual ~LevelTest(void);
virtual void Init() override;
virtual void Update(sf::Time DeltaTime) override;
virtual void HandleEvents(sf::Event EventHandle) override;
virtual void Draw(sf::RenderWindow* Window) override;
protected:
std::vector<GameObject*> m_LOObjects;
sf::View* Camera;
};
| [
"ep__palm@hotmail.com"
] | ep__palm@hotmail.com |
1aa2f6a2dcb19aef703d40af4bb9aa44656338d3 | cdfa5f737f3f27ee86d29eede746d5c1d0905a2e | /RLog.cpp | f4d4d0df95625353d6de298690754588b56f8b15 | [] | no_license | RileyCodes/RFramework | 142c0f58ce9db85003a4a2b920e9e4192d318c91 | 29dfcf5e1d097994bf49283e716e54414b734f96 | refs/heads/main | 2023-07-15T01:48:18.769285 | 2021-08-23T20:47:46 | 2021-08-23T20:47:46 | 394,082,544 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 39 | cpp | #include "pch.h"
#include "Rlog.h"
| [
"35380563+RileyCodes@users.noreply.github.com"
] | 35380563+RileyCodes@users.noreply.github.com |
e617594d487aec1a567f1dcbc859796edeb897c9 | bfdfb7c406c318c877b7cbc43bc2dfd925185e50 | /common/hyEndian.cpp | 49a31dc002b839805057b219d8feee13c7e58695 | [
"MIT"
] | permissive | ysei/Hayat | 74cc1e281ae6772b2a05bbeccfcf430215cb435b | b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0 | refs/heads/master | 2020-12-11T09:07:35.606061 | 2011-08-01T12:38:39 | 2011-08-01T12:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,485 | cpp | /* -*- coding: sjis-dos; -*- */
/*
* copyright 2010 FUKUZAWA Tadashi. All rights reserved.
*/
#include "hyEndian.h"
using namespace Hayat::Common;
namespace Hayat {
namespace Common {
template<> int alignInt<2>(int x) {
return (x + 1) & ~1;
}
template<> int alignInt<4>(int x) {
return (x + 3) & ~3;
}
template<> int alignInt<8>(int x) {
return (x + 7) & ~7;
}
}
}
typedef union {
hyu32 u;
hyf32 f;
} v_t;
template<> hyu32 Endian::unpackE<Endian::LITTLE, hyu32>(const hyu8* buf)
{
hyu32 v;
v = *buf++;
v |= (*buf++) << 8;
v |= (*buf++) << 16;
v |= (*buf) << 24;
return v;
}
template<> hyu32 Endian::unpackE<Endian::BIG, hyu32>(const hyu8* buf)
{
hyu32 v;
v = (*buf++) << 24;
v |= (*buf++) << 16;
v |= (*buf++) << 8;
v |= *buf;
return v;
}
template<> hyu16 Endian::unpackE<Endian::LITTLE, hyu16>(const hyu8* buf)
{
hyu16 v;
v = *buf++;
v |= (*buf) << 8;
return v;
}
template<> hyu16 Endian::unpackE<Endian::BIG, hyu16>(const hyu8* buf)
{
hyu16 v;
v = (*buf++) << 8;
v |= *buf;
return v;
}
template<> hyf32 Endian::unpackE<Endian::LITTLE, hyf32>(const hyu8* buf)
{
v_t v;
v.u = unpackE<LITTLE, hyu32>(buf);
return v.f;
}
template<> hyf32 Endian::unpackE<Endian::BIG, hyf32>(const hyu8* buf)
{
v_t v;
v.u = unpackE<BIG, hyu32>(buf);
return v.f;
}
template<> void Endian::packE<Endian::LITTLE, hyu32>(hyu8* buf, hyu32 v)
{
*buf = (hyu8)v;
*++buf = (hyu8)(v >> 8);
*++buf = (hyu8)(v >> 16);
*++buf = (hyu8)(v >> 24);
}
template<> void Endian::packE<Endian::BIG, hyu32>(hyu8* buf, hyu32 v)
{
*buf = (hyu8)(v >> 24);
*++buf = (hyu8)(v >> 16);
*++buf = (hyu8)(v >> 8);
*++buf = (hyu8)v;
}
template<> void Endian::packE<Endian::LITTLE, hyu16>(hyu8* buf, hyu16 v)
{
*buf = (hyu8)v;
*++buf = (hyu8)(v >> 8);
}
template<> void Endian::packE<Endian::BIG, hyu16>(hyu8* buf, hyu16 v)
{
*buf = (hyu8)(v >> 8);
*++buf = (hyu8)v;
}
template<> void Endian::packE<Endian::LITTLE, hyf32>(hyu8* buf, hyf32 v)
{
v_t vf;
vf.f = v;
packE<LITTLE, hyu32>(buf, vf.u);
}
template<> void Endian::packE<Endian::BIG, hyf32>(hyu8* buf, hyf32 v)
{
v_t vf;
vf.f = v;
packE<BIG, hyu32>(buf, vf.u);
}
| [
"applealien@nifty.com"
] | applealien@nifty.com |
d14bfda18a540b62c7245f768c162d1f84f3cd37 | 78a851fa6c5c5c35e95dc3cef779faed74c2790e | /include/boost/aura/backend/opencl/mesh.hpp | 2b1c83456012ae981215e5f6e5193974978e4ca0 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | BiomedNMR/aura | 5fc671594376869a5337fdf122eaa14a1c04312e | d151492fde7035cf2a6726554597a24b17f221bc | refs/heads/develop | 2020-12-28T19:32:55.781464 | 2018-03-08T14:09:19 | 2018-03-08T14:09:19 | 34,114,517 | 1 | 0 | null | 2015-04-17T12:08:22 | 2015-04-17T12:08:22 | null | UTF-8 | C++ | false | false | 345 | hpp | #ifndef AURA_BACKEND_OPENCL_MESH_HPP
#define AURA_BACKEND_OPENCL_MESH_HPP
#include <boost/aura/detail/svec.hpp>
namespace boost
{
namespace aura {
namespace backend_detail {
namespace opencl {
typedef svec<std::size_t, AURA_MAX_MESH_DIMS> mesh;
} // opencl
} // backend_detail
} // aura
} // boost
#endif // AURA_BACKEND_OPENCL_MESH_HPP
| [
"sschaet@gwdg.de"
] | sschaet@gwdg.de |
6392c59b81493097a1c55316cb885158b201c24f | bc9d4660eca40753ba95e1c47b9fa5bac8d23dbf | /TheTemple/Intermediate/Build/Win64/TheTemple/Shipping/Engine/SharedPCH.Engine.ShadowErrors.cpp | 777305a84aeff0f46b2e6ddfd9f16e6be3024f10 | [] | no_license | GHendrikx/Temple-of-the-Ice-Isles | 3fb2be8463d9c3a26186e570868425b9eff131b0 | 6d0dfe53d598a6bf5cb17467b8840c53d2614a7a | refs/heads/master | 2023-05-20T18:38:42.834319 | 2020-06-22T10:21:56 | 2020-06-22T10:21:56 | 254,066,633 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 168 | cpp | #include "A:/Users/Geoffrey/Documents/ProjectVrij/Temple-of-the-Ice-Isles/TheTemple/Intermediate/Build/Win64/TheTemple/Shipping/Engine/SharedPCH.Engine.ShadowErrors.h"
| [
"geoffreyhendrikx@gmail.com"
] | geoffreyhendrikx@gmail.com |
a0dbc086c6b115ce88072577ad791ee23866f6e4 | 746b933acfb87c3f843b6dca05eaf2860f772e40 | /poj/poj1961.cpp | c90b6a1394135099735141496d07d9d00862b19a | [] | no_license | wky32768/my-code | 5824591e54cf3d4559489980572da80e15f7fd8a | 3333809960808b28463b129a3bd6e6da17436a74 | refs/heads/master | 2020-04-14T01:43:09.761073 | 2019-11-13T02:31:51 | 2019-11-13T02:31:51 | 163,567,579 | 2 | 0 | null | 2019-04-10T11:34:17 | 2018-12-30T06:41:57 | C++ | UTF-8 | C++ | false | false | 496 | cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
char ch[1200000];
int n,k,kmp[1200000],t;
signed main() {
while(cin>>n && n) {
scanf("%s",ch+1);
memset(kmp,0,sizeof kmp);
k=0;
for(int i=2;i<=n;i++) {
while(k && ch[k+1]!=ch[i]) k=kmp[k];
if(ch[k+1]==ch[i]) kmp[i]=++k;
else kmp[i]=0;
}
printf("Test case #%lld\n",++t);
for(int i=2;i<=n;i++) {
if(i%(i-kmp[i])==0 && (i/(i-kmp[i])>1)) cout<<i<<" "<<(i/(i-kmp[i]))<<'\n';
}
puts("");
}
return 0;
} | [
"527192083@qq.com"
] | 527192083@qq.com |
4813cefa6b01f37e43b991808b758492d0dc5f34 | 13e608a7a2f88df72fd65ad29ea900da406fbd63 | /Scatto_continuo_v3/commandline_read.cpp | 4bb48718c73cdb300fe046b1e384114c35f39da7 | [
"MIT"
] | permissive | yumetodo/Scatto_continuo_v3 | b840d81624693cf5e18ad043833a5a2f6f9c3f7d | 956f6c5bb37bd6864b7abd10863c2b1d04569b1f | refs/heads/master | 2021-01-10T00:55:32.920778 | 2016-02-06T14:43:29 | 2016-02-06T14:43:29 | 43,432,948 | 1 | 1 | null | 2016-01-22T16:33:16 | 2015-09-30T12:57:17 | C++ | UTF-8 | C++ | false | false | 8,908 | cpp | #include <iostream>
#include <sstream>
#include <iomanip>
#include <opencv2/highgui/highgui.hpp>
#include "commandline_read.h"
#include "print_version.h"
#include "win32api_wrap.h"
#include <unordered_map>
#include <functional>
#include <cerrno>
#include <cstring>
#include <limits>
#include <type_traits>
#include <stdexcept>
#include <exception>
static std::string create_string_to_avoid_conflict(const uintmax_t roop_turn, const size_t num_to_avoid_conflict) {
std::stringstream ss;
ss << roop_turn << "_" << std::setw(2) << std::setfill('0') << num_to_avoid_conflict;
return ss.str();
}
std::string determine_filename(const uintmax_t roop_turn, const PROCESS_CONF& conf) {
size_t num_to_avoid_conflict = 0;
std::string string_to_avoid_conflict;
do {
++num_to_avoid_conflict;
string_to_avoid_conflict = create_string_to_avoid_conflict(roop_turn, num_to_avoid_conflict);
} while (win32api_wrap::file_exist(conf.o_file.create_fullpath(string_to_avoid_conflict)));
return conf.o_file.create(string_to_avoid_conflict);
}
namespace strtonum {
template<typename T_> using limit = std::numeric_limits<T_>;
template<typename T_, std::enable_if_t<std::is_signed<T_>::value, std::nullptr_t> = nullptr>
T_ purseInt(const char* str, const T_ max = limit<T_>::max(), const T_ min = limit<T_>::lowest()) {
errno = 0;
const auto re = std::strtoll(str, nullptr, 10);
if (!errno || re < min || max < re) throw std::runtime_error("変換に失敗しました");
return static_cast<T_>(re);
}
template<typename T_, std::enable_if_t<std::is_unsigned<T_>::value, std::nullptr_t> = nullptr>
T_ purseUint(const char* str, const T_ max = limit<T_>::max(), const T_ min = limit<T_>::lowest()) {
errno = 0;
const auto re = std::strtoull(str, nullptr, 10);
if (!errno || re < min || max < re) throw std::runtime_error("変換に失敗しました");
return static_cast<T_>(re);
}
template<typename T_, std::enable_if_t<std::is_floating_point<T_>::value, std::nullptr_t> = nullptr>
T_ purseDouble(const char* str, const T_ max = limit<T_>::max(), const T_ min = limit<T_>::lowest()) {
errno = 0;
const auto re = std::strtod(str, nullptr);
if (!errno || re < min || max < re) throw std::runtime_error("変換に失敗しました");
return static_cast<T_>(re);
}
}
static std::pair<std::string, std::string> split_name(std::string&& name) {
const char* rep_str = "$(n)";
const auto split_i = name.find(rep_str);
if (std::string::npos == split_i) {
return{ std::move(name) , "" };
}
else {
std::pair<std::string, std::string> re;
re.second = name.substr(split_i + std::strlen(rep_str) + 1);
name.erase(0, split_i);
re.first = std::move(name);
return re;
}
}
static inline filename_c process_purse_o_option(const std::string& path) {
using std::move;
const auto p_last = path.find_last_of("\\");
if (0 == p_last
|| std::string::npos == p_last
|| !win32api_wrap::path_exist(path.substr(0, p_last))
) {
const auto n_f_i = (std::string::npos == p_last) ? 0 : p_last;
return filename_c(split_name(path.substr(n_f_i, path.find_last_of('.') - n_f_i)), path.substr(path.find_last_of(".") + 1));
}
else {
auto n = split_name(path.substr(p_last + 1, path.find_last_of('.') - p_last));
return filename_c(path.substr(0, p_last) + "\\", move(n), path.substr(path.find_last_of(".") + 1));
}
}
void print_help() {
using std::endl;
std::cout
<< "Scatto_continuo.exe [options...]" << endl
<< "<options>" << endl
<< "-h, --help : print help and exit" << endl
<< "-v, --version : print version" << endl
<< "--opencv-info : print cv::getBuildInformation()" << endl
<< endl
<< "-n [num :uint64] : set how many times you want to capture" << endl
<< "-fps [num : double] : set fps(0.0 - 60.0)." << endl
<< "-o [file : string]: name or place the output into [file]" << endl
<< " The output image format is chosen based on the filename extension." << endl
<< " the following file formats are supported:" << endl
<< " *.jpg, *.png, *.pbm, *.pgm, *.ppm, *.bmp" << endl
<< " BTIMAP(*.bmp) is deprecated because of disk access speed." << endl
<< " To avoid file collisions, $(n) will be replaced."
<< " If $(n) does not exist, it will be inserted at the end of the filename."
<< " ex.)" << endl
<< " - C:\\path\\to\\source\\code\\cropped.jpg" << endl
<< " --> C:\\path\\to\\source\\code\\cropped1_01.jpg" << endl
<< " - capture$(n)_mine.png --> capture1_01_mine.png" << endl
<< " - caputure.jpg --> capture1_01.jpg" << endl
<< endl
<< "--thresholding : threshold image" << endl
<< "--to_gray_scale : convert to gray scaled image"
<< "--disable-algorithm-otu [thresh : double] : disable otu's algorithm and set threshold value(1.0 - 254.0)" << endl
<< endl
<< "--pxm-binary : change pxm(ppm, pgm, pbm) save mode to binary mode(P1-P3)" << endl
<< "--png-compression [quality : int] : set PNG compression level(0 - 9 default:3)" << endl
<< "--jpeg-quality [level : int] : set JPG quality(0 - 100 default:95)" << endl
<< endl
<< "--no-countdown-timer: disable 5 sec. count down timer before starting capture." << endl;
}
PROCESS_CONF commandline_analyzer(int argc, char* argv[]) noexcept(false) {
using namespace strtonum;
PROCESS_CONF re = {};
re.threshold = 0.0;
re.process_mode = colormode_edit::none;
re.frame_num = 1;
re.fps = 4.5;
std::unordered_map<std::string, std::function<void(const char *)>> cases = {
{ "-n", [&re](const char* arg) noexcept {
try {
re.frame_num = purseUint<uintmax_t>(arg);
}
catch (const std::exception&) {
re.frame_num = 1;
}
}},
{ "-fps", [&re](const char* arg) noexcept {
try {
re.fps = purseDouble(arg, 60.0, 0.0);
}
catch (const std::exception&) {
re.fps = 4.5;
}
}},
{ "-o", [&re](const char* arg) {
try {
re.o_file = process_purse_o_option(arg);
switch (re.o_file.get_pic_type()){
case picture_type::pbm:
re.process_mode = colormode_edit::thresholding;
break;
case picture_type::pgm:
re.process_mode = colormode_edit::gray_scaled;
break;
default:
break;
}
}
catch (const std::exception&) {
re.o_file = filename_c();
}
}},
{ "--png-compression", [&re](const char* arg) noexcept {
try {
auto tmp = std::vector<int>(2);
tmp[0] = cv::IMWRITE_PNG_COMPRESSION;
tmp[1] = purseInt(arg, 9, 0);//default:3
re.param = std::move(tmp);
}
catch (const std::exception&) {
}
}},
{ "--jpeg-quality", [&re](const char* arg) noexcept {
try {
auto tmp = std::vector<int>(2);
tmp[0] = cv::IMWRITE_JPEG_QUALITY;
tmp[1] = purseInt(arg, 100, 0);//default:95
re.param = std::move(tmp);
}
catch (const std::exception&) {
}
}},
{ "--disable-algorithm-otu", [&re](const char* arg) noexcept {
try {
re.threshold = purseDouble(arg, 254.0, 1.0);
}
catch (const std::exception&) {
re.threshold = 0.0;
}
}}
};
std::unordered_map<std::string, std::function<void(void)>> cases_no_arg = {
{ "--thresholding", [&re]() noexcept {
if (colormode_edit::none != re.process_mode) re.process_mode = colormode_edit::thresholding;
}},
{ "--to_gray_scale", [&re]() noexcept {
if (colormode_edit::none != re.process_mode) re.process_mode = colormode_edit::gray_scaled;
}},
{ "--pxm-binary", [&re]() {
re.param = std::vector<int>{cv::IMWRITE_PXM_BINARY, 0 };//binary mode(P1-P3)
}},
{ "--no-countdown-timer", [&re]() {
re.no_countdown_timer = true;
}}
};
std::unordered_map<std::string, std::function<void(void)>> case_exist = {
{ "-v", []() noexcept(false) {
print_version();
throw successful_termination("option -v");
}},
{ "--version", []() noexcept(false) {
print_version();
throw successful_termination("option --version");
}},
{ "-h", []() noexcept(false) {
print_help();
throw successful_termination("option -h");
}},
{ "--help", []() noexcept(false) {
print_help();
throw successful_termination("option --help");
}},
{ "--opencv-info", []() noexcept(false) {
std::cout << cv::getBuildInformation() << std::endl;
throw successful_termination("option --opencv-info");
}}
};
for (int i = 1; i < argc; ++i) {
if (cases.count(argv[i])) {
if (i + 1 >= argc) break;
cases[argv[i]](argv[i + 1]);
++i;
}
else if (cases_no_arg.count(argv[i])) cases_no_arg[argv[i]]();
else if (case_exist.count(argv[i])) case_exist[argv[i]]();//throw successful_termination
else {
print_help();
throw std::runtime_error("unknown option");
}
}
return re;
}
successful_termination::successful_termination(const std::string & what_arg) : std::runtime_error("successful_termination : " + what_arg) {}
successful_termination::successful_termination(const char * what_arg) : std::runtime_error(std::string("successful_termination : ") + what_arg) {}
| [
"yume-wikijp@live.jp"
] | yume-wikijp@live.jp |
51d93b159d537a807e296d5fbe4fed00df6342b9 | bc01d89e3b77b9b60afd6f5f8fcad5675b813f8e | /natplugins/natpnatfwsdpprovider/tsrc/ut_NatFwSdpProvider/src/ut_natfwsdpproviderdllmain.cpp | fb7fcfddb88dee49c997cceab6214ad880a3a151 | [] | no_license | SymbianSource/oss.FCL.sf.mw.ipappsrv | fce862742655303fcfa05b9e77788734aa66724e | 65c20a5a6e85f048aa40eb91066941f2f508a4d2 | refs/heads/master | 2021-01-12T15:40:59.380107 | 2010-09-17T05:32:38 | 2010-09-17T05:32:38 | 71,849,396 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,969 | cpp | /*
* Copyright (c) 2004 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:
*
*/
// CLASS HEADERS
#include "ut_nspcontroller.h"
#include "ut_nspcontentParser.h"
#include "ut_nspsession.h"
#include "ut_nspusecases.h"
#include "ut_nspusecases_fqdn.h"
#include "ut_nsputil.h"
#include "ut_nspinterface.h"
#include "ut_nspmediastreamcontainer.h"
#include "ut_nspmediastream.h"
#include "ut_nspmediastreamcomponent.h"
// EXTERNAL INCLUDES
#include <digia/eunit/CEUnitTestSuite.h>
_LIT( KNSPTester, "Root suite for NATFW SDP Provider" );
/**
* Test suite factory function.
*/
EXPORT_C MEUnitTest* CreateTestSuiteL()
{
CEUnitTestSuite* rootSuite = CEUnitTestSuite::NewLC( KNSPTester() );
rootSuite->AddL( UT_CNSPController::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPContentParser::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPSession::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_NSPUtil::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPMediaStreamContainer::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPMediaStream::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPMediaStreamComponent::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPInterface::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPUseCases::NewLC() );
CleanupStack::Pop();
rootSuite->AddL( UT_CNSPUseCases_fqdn::NewLC() );
CleanupStack::Pop();
CleanupStack::Pop(); // rootSuite
return rootSuite;
}
// END OF FILE
| [
"kirill.dremov@nokia.com"
] | kirill.dremov@nokia.com |
c63cdaf5c0e9147193b718d0711ab77e03ecaab3 | d52d3a9f0afb4316532837a5786e487813374da2 | /fmnccmbd/CrdFmncArt/QryFmncArtMNOrg.h | 12e84cad81a2eca1a7924d6509778de82cff0940 | [] | no_license | epsitech/fabmaniac | cf7fb7e2f8d0f0a3dd18585a3309d05d3ea622ac | 715f59ed8a80a1288119081210428fce51422d7e | refs/heads/master | 2021-01-21T04:25:33.463846 | 2016-08-07T19:25:59 | 2016-08-07T19:25:59 | 48,572,056 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,707 | h | /**
* \file QryFmncArtMNOrg.h
* job handler for job QryFmncArtMNOrg (declarations)
* \author Alexander Wirthmueller
* \date created: 7 Mar 2016
* \date modified: 7 Mar 2016
*/
#ifndef QRYFMNCARTMNORG_H
#define QRYFMNCARTMNORG_H
// IP custInclude --- INSERT
/**
* QryFmncArtMNOrg
*/
class QryFmncArtMNOrg : public JobFmnc {
public:
/**
* StatApp (full: StatAppQryFmncArtMNOrg)
*/
class StatApp {
public:
static void writeXML(xmlTextWriter* wr, string difftag = "", bool shorttags = true, const uint firstcol = 1, const uint jnumFirstdisp = 1, const uint ncol = 2, const uint ndisp = 10);
};
/**
* StatShr (full: StatShrQryFmncArtMNOrg)
*/
class StatShr : public Block {
public:
static const uint NTOT = 1;
static const uint JNUMFIRSTLOAD = 2;
static const uint NLOAD = 3;
public:
StatShr(const uint ntot = 0, const uint jnumFirstload = 0, const uint nload = 0);
public:
uint ntot;
uint jnumFirstload;
uint nload;
public:
void writeXML(xmlTextWriter* wr, string difftag = "", bool shorttags = true);
set<uint> comm(const StatShr* comp);
set<uint> diff(const StatShr* comp);
};
/**
* StgIac (full: StgIacQryFmncArtMNOrg)
*/
class StgIac : public Block {
public:
static const uint JNUM = 1;
static const uint JNUMFIRSTLOAD = 2;
static const uint NLOAD = 3;
public:
StgIac(const uint jnum = 0, const uint jnumFirstload = 1, const uint nload = 100);
public:
uint jnum;
uint jnumFirstload;
uint nload;
public:
bool readXML(xmlXPathContext* docctx, string basexpath = "", bool addbasetag = false);
void writeXML(xmlTextWriter* wr, string difftag = "", bool shorttags = true);
set<uint> comm(const StgIac* comp);
set<uint> diff(const StgIac* comp);
};
public:
// IP constructor --- BEGIN
QryFmncArtMNOrg(XchgFmnc* xchg, DbsFmnc* dbsfmnc, const ubigint jrefSup, const uint ixFmncVLocale);
// IP constructor --- END
~QryFmncArtMNOrg();
public:
StatShr statshr;
StgIac stgiac;
ListFmncQArtMNOrg rst;
uint ixFmncVQrystate;
// IP custVar --- INSERT
public:
// IP cust --- INSERT
public:
void refreshJnum();
void refresh(DbsFmnc* dbsfmnc, const bool call = false);
void fetch(DbsFmnc* dbsfmnc);
uint getJnumByRef(const ubigint ref);
ubigint getRefByJnum(const uint jnum);
public:
void handleRequest(DbsFmnc* dbsfmnc, ReqFmnc* req);
bool handleRefresh(DbsFmnc* dbsfmnc);
bool handleShow(DbsFmnc* dbsfmnc);
// IP handleCall --- BEGIN
void handleCall(DbsFmnc* dbsfmnc, Call* call);
// IP handleCall --- END
bool handleCallFmncStubChg(DbsFmnc* dbsfmnc, const ubigint jrefTrig);
bool handleCallFmncArtRorgMod_artEq(DbsFmnc* dbsfmnc, const ubigint jrefTrig, const ubigint refInv);
};
#endif
| [
"awirthm@gmail.com"
] | awirthm@gmail.com |
8a608f369a9fa5dc1d462697151baa0ff1f246e4 | 54b596ae631648ee7407af9f6668bfd02476a410 | /Packets/packet.cc | 5d15b2d2bd8931e8bf2544ef8a225522cb9497a3 | [] | no_license | nmcintyr/Portfolio | fc923873f9278417cc0ed48af7cdea610bfcd588 | a028bca58c12bfd21506ef1457d348010c1748c5 | refs/heads/master | 2021-01-18T15:23:21.649139 | 2014-02-21T00:46:30 | 2014-02-21T00:46:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,697 | cc | /*Name: Nick McIntyre-Wyma
Program: This program simulates grabbing packets from a device and decoding their contents. Grabs from a file instead of a device, however. */
#include <pcap.h>
#include <stdio.h>
#include <iostream>
#include <assert.h>
#include <stdlib.h> // needed for exit
#include <arpa/inet.h> // needed for socket address struct
using namespace std;
const char *FILENAME = "/home/rappleto/pub/Classes/CS442/Assignments/PacketSniffer/packets.db";
/* ethernet headers are always exactly 14 bytes [1] */
#define SIZE_ETHERNET 14
/* Ethernet addresses are 6 bytes */
#define ETHER_ADDR_LEN 6
/* Ethernet header */
struct sniff_ethernet {
u_char ether_dhost[ETHER_ADDR_LEN]; /* destination host address */
u_char ether_shost[ETHER_ADDR_LEN]; /* source host address */
u_short ether_type; /* IP? ARP? RARP? etc */
};
/* IP header */
struct sniff_ip {
u_char ip_vhl; /* version << 4 | header length >> 2 */
u_char ip_tos; /* type of service */
u_short ip_len; /* total length */
u_short ip_id; /* identification */
u_short ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
u_char ip_ttl; /* time to live */
u_char ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */
};
#define IP_HL(ip) (((ip)->ip_vhl) & 0x0f)
#define IP_V(ip) (((ip)->ip_vhl) >> 4)
/* TCP header */
typedef u_int tcp_seq;
struct sniff_tcp {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
u_char th_offx2; /* data offset, rsvd */
#define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4)
u_char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
#define TH_ECE 0x40
#define TH_CWR 0x80
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
};
int checkEthernet (const unsigned char *packet)
{
struct sniff_ethernet *eth = (struct sniff_ethernet *)packet; //Ethernet packet structure
cout << endl << "Ethernet Info------" << endl;
cout << "Destination Address: ";
for (int i=0; i < 6; i++) //Prints the MAC address
{
if ((int)*(packet+i) < 15) //Filling in zeros if need be
cout << "0";
cout << std::hex <<(int)*(packet+i);
if (i != 5)
cout <<":";
}
cout<< endl <<"Source Address: ";
for (int i=6; i < 12; i++)
{
if ((int)*(packet+i) < 15)
cout << "0";
cout << std::hex <<(int)*(packet+i);
if (i != 11)
cout <<":";
}
cout << endl << "Ethernet Type: ";
if (*(packet + 12) == 8 && *(packet + 13) == 0)
cout << "IPv4"<<endl;
else if (*(packet + 12) == 8 && *(packet + 13) == 6)
cout << "ARP"<<endl;
else
cout << "Other (" << ntohs(eth->ether_type) <<") " <<endl;
return sizeof(eth);
}
void checkTCP (const unsigned char *packet, int length, int totallength)
{
const struct sniff_tcp *tcp = (struct sniff_tcp *)(packet+length) ; //TCP header structure
cout << endl << "TCP Info------" << endl;
cout << "Length: " << TH_OFF(tcp)*4 << endl;
cout << std::dec << "Source Port: " << ntohs(tcp->th_sport) << endl; //th_sport and th_dport are source port and destination port. Refer to the structure above to confirm.
cout << std::dec << "Dest Port: " << ntohs(tcp->th_dport) << endl;
cout << std::dec << "Sequence #: " << ((int)*(packet+length+4)*4294967296) + ((int)*(packet+length+5)*65536) + (256*(int)*(packet+length+6)) + (int)*(packet+length+7) << endl;
cout << std::dec << "Ack #: " << ((int)*(packet+length+8)*4294967296) + ((int)*(packet+length+9)*65536) + (256*(int)*(packet+length+10)) + (int)*(packet+length+11) << endl;
cout << std::dec << "Window Size: " << ((int)*(packet+length+18))*256 + (int)*(packet+length+19) << endl;
cout << std::dec << "Checksum: " << ((int)*(packet+length+20))*256 + (int)*(packet+length+21) << endl;
cout << std::dec << "Urgent Pointer: " << ntohs(tcp->th_urp) << endl;
cout << "SYN Flag: " << (((int)*(packet+length+13) & 0x2) >> 1) << endl; // &'ing with binary 0000 0010(hex is just 2) since the second bit is the SYN flag.
cout << "ACK Flag: " << (((int)*(packet+length+13) & 0x10) >> 4) << endl; // &'ing with binary 0001 0000(hex is 10) since the fifth bit is the ACK flag.
cout << "FIN Flag: " << (((int)*(packet+length+13) & 0x1)) << endl << endl; // &'ing with binary 0000 0001(hex is just 1) since the first bit is the FIN flag.
cout << endl;
return;
}
void checkUDP (const unsigned char *packet, int length, int totallength) //If it is UDP, spits out the Source and Destination Port #s
{
cout << endl << "UDP Info------" << endl;
cout << std::dec << "Source Port: " << ((int)*(packet+length)*256) + ((int)*(packet+length+1)) << endl;
cout << std::dec << "Destination Port: " << ((int)*(packet+length+2)*256) + ((int)*(packet+length+3)) << endl;
}
void checkIP (const unsigned char *packet)
{
struct sniff_ip *ip = (struct sniff_ip *)(packet+14); //IP starts after the ethernet stuff, which is always 14 bytes.
int length = ntohs(ip->ip_len);
cout << endl;
cout << "IP Info------" << endl;
cout << "Destination Address: " << inet_ntoa(ip->ip_dst) << endl;
cout << "Source Address: " << inet_ntoa(ip->ip_src) << endl;
cout << "Header Length: " << IP_HL(ip) << endl;
cout << "Version: " << IP_V(ip) << endl;
cout << std::dec << "Length: "<< length << endl;
cout << std::dec << "Time To Live: " <<(int)*(packet+22)<<endl;
cout << std::dec << "Protocol: " << (int)*(packet+23) << endl;
cout << std::dec << "CRC: " << ((int)*(packet+24))*256 + (int)*(packet+25) << endl;
cout << std::dec << "ID: " << ((int)*(packet+19))*256 + (int)*(packet+20) << "("<<((int)*(packet+19)) <<"."<< (int)*(packet+20) <<")"<< endl;
cout << "Fragment Offset: " << ntohs(ip->ip_off) << endl;
if ((int)*(packet+23) == 6) //This is checking the Protocol section, if it equals 6 then the protocol is TCP and 17 is UDP.
checkTCP(packet, 14+(IP_HL(ip)*4), length);
else if ((int)*(packet+23) == 17)
checkUDP(packet, 13+(IP_HL(ip)*4), ntohs(ip->ip_len )+14);
}
int main()
{
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *handle;
struct pcap_pkthdr pheader;
const unsigned char *packet;
handle = pcap_open_offline(FILENAME, errbuf); //Set to offline so we grab from a file "FILENAME", instead of a device.
if (handle == NULL) //If it comes back NULL, something went wrong.
{
cout << errbuf << endl;
exit(1);
}
int count = 0;
while ((packet = pcap_next(handle, &pheader)) != NULL) //if pcap_next returns NULL, then there are no more packets to read.
{
count++;
cout <<endl<< std::dec <<"Packet Number " << count << ":"<<endl;
checkEthernet(packet);
if (*(packet + 12) == 8 && *(packet + 13) == 0)
checkIP(packet);
if (*(packet + 12) == 8 && *(packet + 13) == 6)
cout << endl;
}
} | [
"nmcintyr@nmu.edu"
] | nmcintyr@nmu.edu |
ac1b10d5677e22896c2bc955773a5356e78be4a7 | 6a85c1c65a9f290ee49261aca29614f73a07bbab | /verilog/CST/seq_block.cc | 856e409368654c03acb06ca8efb5198d37de3402 | [
"Apache-2.0"
] | permissive | MinaToma/verible | 95c246643913e7340b0554773b366977f9bd5fc6 | 4323aa5260bc40c3315ce46ea29f77a5e6e4688b | refs/heads/master | 2023-01-10T13:11:20.641089 | 2020-11-12T16:00:39 | 2020-11-12T16:01:47 | 282,202,509 | 1 | 0 | Apache-2.0 | 2020-08-17T17:06:31 | 2020-07-24T11:29:43 | C++ | UTF-8 | C++ | false | false | 2,192 | cc | // Copyright 2017-2020 The Verible Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "verilog/CST/seq_block.h"
#include <vector>
#include "common/analysis/matcher/matcher.h"
#include "common/analysis/matcher/matcher_builders.h"
#include "common/analysis/syntax_tree_search.h"
#include "common/text/concrete_syntax_leaf.h"
#include "common/text/concrete_syntax_tree.h"
#include "common/text/symbol.h"
#include "common/text/syntax_tree_context.h"
#include "common/text/tree_utils.h"
#include "verilog/CST/identifier.h"
#include "verilog/CST/verilog_matchers.h" // IWYU pragma: keep
namespace verilog {
using verible::Symbol;
using verible::SyntaxTreeContext;
using verible::TokenInfo;
static const TokenInfo* GetSeqBlockLabelTokenInfo(const Symbol& symbol,
NodeEnum parent) {
const auto* s = GetSubtreeAsSymbol(symbol, parent, 1);
if (s == nullptr) {
return nullptr;
}
const auto& node = SymbolCastToNode(*s);
return &AutoUnwrapIdentifier(*node.children()[1].get())->get();
}
const TokenInfo* GetBeginLabelTokenInfo(const Symbol& symbol) {
CHECK_EQ(NodeEnum(symbol.Tag().tag), NodeEnum::kBegin);
return GetSeqBlockLabelTokenInfo(symbol, NodeEnum::kBegin);
}
const TokenInfo* GetEndLabelTokenInfo(const Symbol& symbol) {
CHECK_EQ(NodeEnum(symbol.Tag().tag), NodeEnum::kEnd);
return GetSeqBlockLabelTokenInfo(symbol, NodeEnum::kEnd);
}
const Symbol* GetMatchingEnd(const Symbol& symbol,
const SyntaxTreeContext& context) {
CHECK_EQ(NodeEnum(symbol.Tag().tag), NodeEnum::kBegin);
return context.top().children().back().get();
}
} // namespace verilog
| [
"h.zeller@acm.org"
] | h.zeller@acm.org |
3bff031865387991784c3444211ee0d6446ab599 | bafda22bd800b6ebd3519d3353d069bcf967f360 | /src/include/app.h | 7452714ec70ddcd3f7f868fe7a5c23ea90c15c90 | [
"Apache-2.0"
] | permissive | ljh9248/cert-checker | e28b205604eb5ccc2d9791a2f67fac30a8529696 | 0cad75f144c2ef178d2bc7cced6cf4c4b0e57409 | refs/heads/master | 2023-03-16T11:07:13.198952 | 2015-05-22T09:14:52 | 2015-05-27T14:00:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,401 | h | /*
* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file app.h
* @author Janusz Kozerski (j.kozerski@samsung.com)
* @version 1.0
* @brief This file is the implementation of app struct
*/
#ifndef CCHECKER_APP_H
#define CCHECKER_APP_H
#include <string>
#include <vector>
#include <sys/types.h>
namespace CCHECKER {
struct app_t {
enum class verified_t : int {
NO = 0,
YES = 1,
UNKNOWN = 2
};
int32_t check_id;
std::string app_id;
std::string pkg_id;
uid_t uid;
std::vector<std::string> certificates;
verified_t verified;
app_t(void);
std::string str(void) const;
};
} //CCHECKER
#endif //CCHECKER_APP_H
| [
"k.jackiewicz@samsung.com"
] | k.jackiewicz@samsung.com |
db213c12456f040e0173a89f16f78676dc48af36 | a4065b86f73bb093db2d76e327a81be0a623b5f8 | /new/include/RegFile.h | 677f8b0c65d52c9fadfcd4825607fde3fb8d6e46 | [] | no_license | LiuTed/RISCV-SIM | 16687c576fec04918d158dfdda1586c6303d3977 | 6fb77fe18f80f2c573bd2b794bdbbd87a26d0e46 | refs/heads/master | 2020-03-14T03:39:54.036525 | 2019-03-29T10:55:03 | 2019-03-29T10:55:03 | 131,424,764 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 479 | h | #ifndef __REGFILE_H__
#define __REGFILE_H__
#include "Register.hh"
class RegFile
{
Register64 *regfile;
uint n;
public:
RegFile(uint n);
~RegFile();
Register64& at(uint idx);
const Register64& at(uint idx) const;
Register64& operator[] (uint idx);
const Register64& operator[] (uint idx) const;
};
#define r0 0
#define ra 1
#define sp 2
#define gp 3
#define a0 10
#define a1 11
#define f0 32
#define fa1 43
#define pc 64
#define epc 65
#endif
| [
"tdliu@pku.edu.cn"
] | tdliu@pku.edu.cn |
75849ab2f6add842433623c7fe61b401177e3c2d | fa4cb41ef68d83a52d72da75492b0475327e8670 | /Debug/Generated Files/winrt/impl/Windows.Security.EnterpriseData.2.h | afeb8d9994717df2711adf2db5e2742884a02dd8 | [
"MIT"
] | permissive | zedpoirier/JupiterEngine | 4ec595e886802dbc4c57b4d4503f91f9c48f8765 | 26afe2fede8e9fce0a48de3a768ef58839ae1565 | refs/heads/master | 2023-02-09T04:40:12.797148 | 2021-01-04T19:35:08 | 2021-01-04T19:35:08 | 298,377,326 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,997 | h | // WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.200921.6
#ifndef WINRT_Windows_Security_EnterpriseData_2_H
#define WINRT_Windows_Security_EnterpriseData_2_H
#include "winrt/impl/Windows.Foundation.1.h"
#include "winrt/impl/Windows.Foundation.Collections.1.h"
#include "winrt/impl/Windows.Networking.1.h"
#include "winrt/impl/Windows.Storage.1.h"
#include "winrt/impl/Windows.Storage.Streams.1.h"
#include "winrt/impl/Windows.Security.EnterpriseData.1.h"
WINRT_EXPORT namespace winrt::Windows::Security::EnterpriseData
{
struct __declspec(empty_bases) BufferProtectUnprotectResult : Windows::Security::EnterpriseData::IBufferProtectUnprotectResult
{
BufferProtectUnprotectResult(std::nullptr_t) noexcept {}
BufferProtectUnprotectResult(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IBufferProtectUnprotectResult(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) DataProtectionInfo : Windows::Security::EnterpriseData::IDataProtectionInfo
{
DataProtectionInfo(std::nullptr_t) noexcept {}
DataProtectionInfo(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IDataProtectionInfo(ptr, take_ownership_from_abi) {}
};
struct DataProtectionManager
{
DataProtectionManager() = delete;
static auto ProtectAsync(Windows::Storage::Streams::IBuffer const& data, param::hstring const& identity);
static auto UnprotectAsync(Windows::Storage::Streams::IBuffer const& data);
static auto ProtectStreamAsync(Windows::Storage::Streams::IInputStream const& unprotectedStream, param::hstring const& identity, Windows::Storage::Streams::IOutputStream const& protectedStream);
static auto UnprotectStreamAsync(Windows::Storage::Streams::IInputStream const& protectedStream, Windows::Storage::Streams::IOutputStream const& unprotectedStream);
static auto GetProtectionInfoAsync(Windows::Storage::Streams::IBuffer const& protectedData);
static auto GetStreamProtectionInfoAsync(Windows::Storage::Streams::IInputStream const& protectedStream);
};
struct __declspec(empty_bases) FileProtectionInfo : Windows::Security::EnterpriseData::IFileProtectionInfo,
impl::require<FileProtectionInfo, Windows::Security::EnterpriseData::IFileProtectionInfo2>
{
FileProtectionInfo(std::nullptr_t) noexcept {}
FileProtectionInfo(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IFileProtectionInfo(ptr, take_ownership_from_abi) {}
};
struct FileProtectionManager
{
FileProtectionManager() = delete;
static auto ProtectAsync(Windows::Storage::IStorageItem const& target, param::hstring const& identity);
static auto CopyProtectionAsync(Windows::Storage::IStorageItem const& source, Windows::Storage::IStorageItem const& target);
static auto GetProtectionInfoAsync(Windows::Storage::IStorageItem const& source);
static auto SaveFileAsContainerAsync(Windows::Storage::IStorageFile const& protectedFile);
static auto LoadFileFromContainerAsync(Windows::Storage::IStorageFile const& containerFile);
static auto LoadFileFromContainerAsync(Windows::Storage::IStorageFile const& containerFile, Windows::Storage::IStorageItem const& target);
static auto CreateProtectedAndOpenAsync(Windows::Storage::IStorageFolder const& parentFolder, param::hstring const& desiredName, param::hstring const& identity, Windows::Storage::CreationCollisionOption const& collisionOption);
static auto IsContainerAsync(Windows::Storage::IStorageFile const& file);
static auto LoadFileFromContainerAsync(Windows::Storage::IStorageFile const& containerFile, Windows::Storage::IStorageItem const& target, Windows::Storage::NameCollisionOption const& collisionOption);
static auto SaveFileAsContainerAsync(Windows::Storage::IStorageFile const& protectedFile, param::async_iterable<hstring> const& sharedWithIdentities);
static auto UnprotectAsync(Windows::Storage::IStorageItem const& target);
static auto UnprotectAsync(Windows::Storage::IStorageItem const& target, Windows::Security::EnterpriseData::FileUnprotectOptions const& options);
};
struct FileRevocationManager
{
FileRevocationManager() = delete;
static auto ProtectAsync(Windows::Storage::IStorageItem const& storageItem, param::hstring const& enterpriseIdentity);
static auto CopyProtectionAsync(Windows::Storage::IStorageItem const& sourceStorageItem, Windows::Storage::IStorageItem const& targetStorageItem);
static auto Revoke(param::hstring const& enterpriseIdentity);
static auto GetStatusAsync(Windows::Storage::IStorageItem const& storageItem);
};
struct __declspec(empty_bases) FileUnprotectOptions : Windows::Security::EnterpriseData::IFileUnprotectOptions
{
FileUnprotectOptions(std::nullptr_t) noexcept {}
FileUnprotectOptions(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IFileUnprotectOptions(ptr, take_ownership_from_abi) {}
explicit FileUnprotectOptions(bool audit);
};
struct __declspec(empty_bases) ProtectedAccessResumedEventArgs : Windows::Security::EnterpriseData::IProtectedAccessResumedEventArgs
{
ProtectedAccessResumedEventArgs(std::nullptr_t) noexcept {}
ProtectedAccessResumedEventArgs(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedAccessResumedEventArgs(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectedAccessSuspendingEventArgs : Windows::Security::EnterpriseData::IProtectedAccessSuspendingEventArgs
{
ProtectedAccessSuspendingEventArgs(std::nullptr_t) noexcept {}
ProtectedAccessSuspendingEventArgs(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedAccessSuspendingEventArgs(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectedContainerExportResult : Windows::Security::EnterpriseData::IProtectedContainerExportResult
{
ProtectedContainerExportResult(std::nullptr_t) noexcept {}
ProtectedContainerExportResult(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedContainerExportResult(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectedContainerImportResult : Windows::Security::EnterpriseData::IProtectedContainerImportResult
{
ProtectedContainerImportResult(std::nullptr_t) noexcept {}
ProtectedContainerImportResult(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedContainerImportResult(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectedContentRevokedEventArgs : Windows::Security::EnterpriseData::IProtectedContentRevokedEventArgs
{
ProtectedContentRevokedEventArgs(std::nullptr_t) noexcept {}
ProtectedContentRevokedEventArgs(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedContentRevokedEventArgs(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectedFileCreateResult : Windows::Security::EnterpriseData::IProtectedFileCreateResult
{
ProtectedFileCreateResult(std::nullptr_t) noexcept {}
ProtectedFileCreateResult(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectedFileCreateResult(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) ProtectionPolicyAuditInfo : Windows::Security::EnterpriseData::IProtectionPolicyAuditInfo
{
ProtectionPolicyAuditInfo(std::nullptr_t) noexcept {}
ProtectionPolicyAuditInfo(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectionPolicyAuditInfo(ptr, take_ownership_from_abi) {}
ProtectionPolicyAuditInfo(Windows::Security::EnterpriseData::ProtectionPolicyAuditAction const& action, param::hstring const& dataDescription, param::hstring const& sourceDescription, param::hstring const& targetDescription);
ProtectionPolicyAuditInfo(Windows::Security::EnterpriseData::ProtectionPolicyAuditAction const& action, param::hstring const& dataDescription);
};
struct __declspec(empty_bases) ProtectionPolicyManager : Windows::Security::EnterpriseData::IProtectionPolicyManager,
impl::require<ProtectionPolicyManager, Windows::Security::EnterpriseData::IProtectionPolicyManager2>
{
ProtectionPolicyManager(std::nullptr_t) noexcept {}
ProtectionPolicyManager(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IProtectionPolicyManager(ptr, take_ownership_from_abi) {}
static auto IsIdentityManaged(param::hstring const& identity);
static auto TryApplyProcessUIPolicy(param::hstring const& identity);
static auto ClearProcessUIPolicy();
static auto CreateCurrentThreadNetworkContext(param::hstring const& identity);
static auto GetPrimaryManagedIdentityForNetworkEndpointAsync(Windows::Networking::HostName const& endpointHost);
static auto RevokeContent(param::hstring const& identity);
static auto GetForCurrentView();
static auto ProtectedAccessSuspending(Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedAccessSuspendingEventArgs> const& handler);
using ProtectedAccessSuspending_revoker = impl::factory_event_revoker<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics, &impl::abi_t<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics>::remove_ProtectedAccessSuspending>;
[[nodiscard]] static ProtectedAccessSuspending_revoker ProtectedAccessSuspending(auto_revoke_t, Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedAccessSuspendingEventArgs> const& handler);
static auto ProtectedAccessSuspending(winrt::event_token const& token);
static auto ProtectedAccessResumed(Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedAccessResumedEventArgs> const& handler);
using ProtectedAccessResumed_revoker = impl::factory_event_revoker<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics, &impl::abi_t<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics>::remove_ProtectedAccessResumed>;
[[nodiscard]] static ProtectedAccessResumed_revoker ProtectedAccessResumed(auto_revoke_t, Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedAccessResumedEventArgs> const& handler);
static auto ProtectedAccessResumed(winrt::event_token const& token);
static auto ProtectedContentRevoked(Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedContentRevokedEventArgs> const& handler);
using ProtectedContentRevoked_revoker = impl::factory_event_revoker<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics, &impl::abi_t<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics>::remove_ProtectedContentRevoked>;
[[nodiscard]] static ProtectedContentRevoked_revoker ProtectedContentRevoked(auto_revoke_t, Windows::Foundation::EventHandler<Windows::Security::EnterpriseData::ProtectedContentRevokedEventArgs> const& handler);
static auto ProtectedContentRevoked(winrt::event_token const& token);
static auto CheckAccess(param::hstring const& sourceIdentity, param::hstring const& targetIdentity);
static auto RequestAccessAsync(param::hstring const& sourceIdentity, param::hstring const& targetIdentity);
static auto HasContentBeenRevokedSince(param::hstring const& identity, Windows::Foundation::DateTime const& since);
static auto CheckAccessForApp(param::hstring const& sourceIdentity, param::hstring const& appPackageFamilyName);
static auto RequestAccessForAppAsync(param::hstring const& sourceIdentity, param::hstring const& appPackageFamilyName);
static auto GetEnforcementLevel(param::hstring const& identity);
static auto IsUserDecryptionAllowed(param::hstring const& identity);
static auto IsProtectionUnderLockRequired(param::hstring const& identity);
static auto PolicyChanged(Windows::Foundation::EventHandler<Windows::Foundation::IInspectable> const& handler);
using PolicyChanged_revoker = impl::factory_event_revoker<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics2, &impl::abi_t<Windows::Security::EnterpriseData::IProtectionPolicyManagerStatics2>::remove_PolicyChanged>;
[[nodiscard]] static PolicyChanged_revoker PolicyChanged(auto_revoke_t, Windows::Foundation::EventHandler<Windows::Foundation::IInspectable> const& handler);
static auto PolicyChanged(winrt::event_token const& token);
[[nodiscard]] static auto IsProtectionEnabled();
static auto RequestAccessAsync(param::hstring const& sourceIdentity, param::hstring const& targetIdentity, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo);
static auto RequestAccessAsync(param::hstring const& sourceIdentity, param::hstring const& targetIdentity, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp);
static auto RequestAccessForAppAsync(param::hstring const& sourceIdentity, param::hstring const& appPackageFamilyName, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo);
static auto RequestAccessForAppAsync(param::hstring const& sourceIdentity, param::hstring const& appPackageFamilyName, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp);
static auto LogAuditEvent(param::hstring const& sourceIdentity, param::hstring const& targetIdentity, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo);
static auto IsRoamableProtectionEnabled(param::hstring const& identity);
static auto RequestAccessAsync(param::hstring const& sourceIdentity, param::hstring const& targetIdentity, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp, Windows::Security::EnterpriseData::ProtectionPolicyRequestAccessBehavior const& behavior);
static auto RequestAccessForAppAsync(param::hstring const& sourceIdentity, param::hstring const& appPackageFamilyName, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp, Windows::Security::EnterpriseData::ProtectionPolicyRequestAccessBehavior const& behavior);
static auto RequestAccessToFilesForAppAsync(param::async_iterable<Windows::Storage::IStorageItem> const& sourceItemList, param::hstring const& appPackageFamilyName, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo);
static auto RequestAccessToFilesForAppAsync(param::async_iterable<Windows::Storage::IStorageItem> const& sourceItemList, param::hstring const& appPackageFamilyName, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp, Windows::Security::EnterpriseData::ProtectionPolicyRequestAccessBehavior const& behavior);
static auto RequestAccessToFilesForProcessAsync(param::async_iterable<Windows::Storage::IStorageItem> const& sourceItemList, uint32_t processId, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo);
static auto RequestAccessToFilesForProcessAsync(param::async_iterable<Windows::Storage::IStorageItem> const& sourceItemList, uint32_t processId, Windows::Security::EnterpriseData::ProtectionPolicyAuditInfo const& auditInfo, param::hstring const& messageFromApp, Windows::Security::EnterpriseData::ProtectionPolicyRequestAccessBehavior const& behavior);
static auto IsFileProtectionRequiredAsync(Windows::Storage::IStorageItem const& target, param::hstring const& identity);
static auto IsFileProtectionRequiredForNewFileAsync(Windows::Storage::IStorageFolder const& parentFolder, param::hstring const& identity, param::hstring const& desiredName);
[[nodiscard]] static auto PrimaryManagedIdentity();
static auto GetPrimaryManagedIdentityForIdentity(param::hstring const& identity);
};
struct __declspec(empty_bases) ThreadNetworkContext : Windows::Security::EnterpriseData::IThreadNetworkContext,
impl::require<ThreadNetworkContext, Windows::Foundation::IClosable>
{
ThreadNetworkContext(std::nullptr_t) noexcept {}
ThreadNetworkContext(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Security::EnterpriseData::IThreadNetworkContext(ptr, take_ownership_from_abi) {}
};
}
#endif
| [
"49734422+zedpoirier@users.noreply.github.com"
] | 49734422+zedpoirier@users.noreply.github.com |
005ccf6d5973bf2abd1c7a904f72590a6c153d29 | a1c87b487c32892600f43a0e7d7ad1218bc8f6a4 | /lib/ReferenceCounter.cpp | aa2f383b26709b195dc7a05a2dc074a2531905cb | [] | no_license | zkcpp/fiber | 82955dfbd5ca2035024f6e6bba6659be688632e7 | 4b7b326321e5c8a72f8d0b469aeccdc3ef80b190 | refs/heads/master | 2016-09-06T07:14:03.404998 | 2015-10-03T14:45:36 | 2015-10-03T14:45:36 | 42,799,915 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 308 | cpp | #include "lib/ReferenceCounter.h"
namespace fiber {
ReferenceCounter::ReferenceCounter() : rc_(1) {
}
ReferenceCounter::~ReferenceCounter() {
}
void ReferenceCounter::ref() {
++rc_;
}
void ReferenceCounter::unref() {
auto val = rc_.fetch_sub(1);
if (val == 1) {
delete this;
}
}
} // fiber
| [
"snappysys@gmail.com"
] | snappysys@gmail.com |
88f8e88eb7952b1db5717e46a950c29c3c6ba0b0 | 40c0d5aab8e6479193b1892a0d2c0a52c6c073e4 | /lib/Sunstang-master_lib/Arduino/CurrentController/CurrentController.ino | ca580f5161ac6a4921a5e0e95fd2722fba75db16 | [] | no_license | edewit2/SunstangBPS | 090ccba0ee96d56a3ed74cce8088a4cd081ad2a3 | e03d23110c805801b67535920344bdc4055d5f31 | refs/heads/master | 2021-01-22T19:41:33.914177 | 2017-04-04T02:10:22 | 2017-04-04T02:10:22 | 85,222,657 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 16,635 | ino | /*
Sunstang Main Battery Protection System 2015
July 14, 22:35
Note: All the code is kept in a single file to simplifiy deployment to hardware.
This controller successfully performs four tasks:
1. Measures temperature of 96 cells, and decides whether or not to enable the main relay (not the charge relay).
If at any point one of the thermistors become disconnected or shorted, the canbus error code will indicate a hardware error.
2. Update LCD screen with maximum temperature and their corresponding IDs.
3. Brodcast on the canbusall the measured temperatures
4. Broadcast on the canbus the state of the controller
TODO:
1. Fix charge relay control
The code is organized using the following headings
1. Constants and Class Definitions
2. Main Program
3. Helper Functions
4. Task Scheduling Code
5. Task Definitions
*/
#include <SPI.h>
#include <LiquidCrystal.h>
#include <TimerOne.h>
#include <mcp_can.h>
/*
1. CONSTANTS AND CLASS DEFINIONS
*/
// Thresholds
const float ABSOLUTE_OVER_CURRENT_DISCHARGING = -130; // A
const float ABSOLUTE_OVER_CURRENT_CHARGING = 15; // A
// Battery Pack Status Codes
const uint8_t STATUS_CODE_SAFE_TO_USE = 0;
const uint8_t STATUS_CODE_OVERCURRENT_DISCHARGING = 1;
const uint8_t STATUS_CODE_OVERCURRENT_CHARGING = 2;
const uint8_t STATUS_CODE_SENSOR_ERROR = 3;
// Battery Events
const uint8_t EVENT_CODE_OVERCURRENT_DISCHARGING = 10;
const uint8_t EVENT_CODE_OVERCURRENT_CHARGING = 11;
const uint8_t EVENT_CODE_SENSOR_ERROR = 12;
// Controller Status Codes
const uint8_t STATUS_PROGRAM_STARTED = 100;
const uint8_t STATUS_MAIN_RELAY_ENABLED = 101;
const uint8_t STATUS_MAIN_RELAY_DISABLED = 102;
const uint8_t STATUS_CHARGE_RELAY_ENABLED = 103;
const uint8_t STATUS_CHARGE_RELAY_DISABLED = 104;
const uint8_t STATUS_START_BUTTON_PRESSED = 105;
const uint8_t STATUS_TASK_CHECKBATTERY_RUN_ACTIVE = 106;
const uint8_t STATUS_TASK_CHECKBATTERY_RUN_IDLE = 107;
const uint8_t STATUS_TASK_UPDATELCD_RUN = 108;
const uint8_t STATUS_TASK_BROADCASTMEASUREMENTS_RUN = 109;
const uint8_t STATUS_TASK_BROADCASTSTATE_ACTIVE = 110;
const uint8_t STATUS_TASK_BROADCASTSTATE_IDLE = 111;
// Task periods and prescalars
const long TIMER_PERIOD = 10000; // 100Hz
const long TASK_PERIOD_CheckBattery = 10000; // 100Hz
const long TASK_PERIOD_UpdateLCD = 1000000; // 1Hz
const long TASK_PERIOD_BroadcastMeasurements = 1000000; // 1Hz
const long TASK_PERIOD_BroadcastState = 1000000; // 1Hz
const long TASK_PRESCALAR_CheckBattery = TASK_PERIOD_CheckBattery / TIMER_PERIOD;
const long TASK_PRESCALAR_UpdateLCD = TASK_PERIOD_UpdateLCD / TIMER_PERIOD;
const long TASK_PRESCALAR_BroadcastMeasurements = TASK_PERIOD_BroadcastMeasurements / TIMER_PERIOD;
const long TASK_PRESCALAR_BroadcastState = TASK_PERIOD_BroadcastState / TIMER_PERIOD;
enum CAR_STATE
{
STATE_IDLE,
STATE_ACTIVE
};
// Pin-outs
const uint8_t START_BUTTON_PIN = 2;
const uint8_t RELAY_PIN_MAIN = 9;
const uint8_t RELAY_PIN_CHARGE = 3;
const uint8_t DISCHARGE_OUTPUT_INDICATOR_PIN = 4;
const int canbusInitMaxTries = 5;
const unsigned int canbusCurrentDataStartId = 108;
const uint8_t canbusCurrentDebugId = 137;
const uint8_t canbusCurrentBatteryEventId = 138;
/*
2. MAIN PROGRAM
*/
LiquidCrystal lcd(A5, A4, A0, A1, A2, A3);
MCP_CAN CAN(10);
boolean canbusActive = false;
volatile CAR_STATE carState = STATE_IDLE;
volatile boolean newTimeSlice = false;
boolean task_CheckBattery_Ready = false;
boolean task_UpdateLCD_Ready = false;
boolean task_BroadcastMeasurements_Ready = false;
boolean task_BroadcastState_Ready = false;
uint8_t batteryStatusCode = -1;
const uint16_t chargingDischargingThreshold = 836; // -0.06A
uint16_t maxReading = chargingDischargingThreshold;
uint16_t minReading = chargingDischargingThreshold;
float offset;
// Variables for calculating running average
const uint16_t samplesConsideredInAverage = 100;
uint16_t recentSampleValues[samplesConsideredInAverage];
float currentRunningAverage = chargingDischargingThreshold;
uint16_t oldestIndex = 0;
void setup() {
Serial.begin(115200);
// Initialize relay pins
pinMode(RELAY_PIN_MAIN, OUTPUT);
pinMode(RELAY_PIN_CHARGE, OUTPUT);
digitalWrite(RELAY_PIN_MAIN,LOW);
digitalWrite(RELAY_PIN_CHARGE,LOW);
pinMode(DISCHARGE_OUTPUT_INDICATOR_PIN, OUTPUT);
// Init the sensors
initCurrentSensor();
// Init LCD
initLCD();
// Initialize timer1, used for implementing time-slice cyclic task scheduling
Timer1.initialize(TIMER_PERIOD);
Timer1.attachInterrupt(timerISR);
// Initialize the external interrupt, used to put the car into the active state
attachInterrupt(0, startCarFunction, FALLING);
// Init Canbus
initCanbus();
}
// Use time-slice scheduler
// At the beginning of each time-slice, the scheduler waits for the timer event, then tasks are given an opportunity to run, if ready
void loop() {
waitForTimeSlice();
// task_CheckBattery checks the voltages of batteries and controls both relays accordingly
if (task_CheckBattery_Ready)
{
task_CheckBattery();
task_CheckBattery_Ready = false;
}
// task_UpdateLCD_Ready writes to the LCD screen the minimum/maximum voltages (and the status of the controller if not running)
if (task_UpdateLCD_Ready)
{
task_UpdateLCD();
task_UpdateLCD_Ready = false;
}
// task_BroadcastMeasurements broadcasts the battery voltages on the canbus
if (task_BroadcastMeasurements_Ready)
{
task_BroadcastMeasurements();
task_BroadcastMeasurements_Ready = false;
}
if (task_BroadcastState_Ready)
{
task_BroadcastState();
task_BroadcastState_Ready = false;
}
//Serial.println();
}
/*
3. HELPER FUNCTIONS
*/
boolean hasHardwareError(uint16_t rawValue)
{
return rawValue == 0;
}
boolean isOvercurrentDischarging(float current)
{
return current < ABSOLUTE_OVER_CURRENT_DISCHARGING;
}
boolean isOvercurrentCharging(float current)
{
return current > ABSOLUTE_OVER_CURRENT_CHARGING;
}
boolean updateDischargingPin()
{
digitalWrite(DISCHARGE_OUTPUT_INDICATOR_PIN, isDischarging());
}
uint16_t getMostRecentInstantaneousReading()
{
uint16_t newestIndex = oldestIndex - 1;
if (newestIndex < 0)
{
newestIndex += samplesConsideredInAverage;
}
return recentSampleValues[newestIndex];
}
static byte checkBatteryPackStatus()
{
boolean discharging = isDischarging();
// Read the value on the sensor and save to memory
int newValue = analogRead(A7);
//Serial.print("NewValue: ");
//Serial.println(newValue);
calculateNextAverage(newValue);
//Serial.print("Now Average: ");
//Serial.println(currentRunningAverage);
// Update peak values
minReading = min(minReading, currentRunningAverage);
maxReading = max(maxReading, currentRunningAverage);
Serial.println("Min");
Serial.print(minReading);
Serial.println("Max");
Serial.print(maxReading);
float logicalCurrent = calculateCurrent(currentRunningAverage);
//Serial.print("\tCurrent: ");
//Serial.print(logicalCurrent);
if (hasHardwareError(newValue))
{
canbusEventSend(EVENT_CODE_SENSOR_ERROR);
batteryStatusCode = STATUS_CODE_SENSOR_ERROR;
}
else if (isOvercurrentCharging(logicalCurrent))
{
canbusEventSend(EVENT_CODE_OVERCURRENT_CHARGING);
batteryStatusCode = STATUS_CODE_OVERCURRENT_CHARGING;
}
else if (isOvercurrentDischarging(logicalCurrent))
{
canbusEventSend(EVENT_CODE_OVERCURRENT_DISCHARGING);
batteryStatusCode = STATUS_CODE_OVERCURRENT_DISCHARGING;
}
else
{
batteryStatusCode = STATUS_CODE_SAFE_TO_USE;
}
return batteryStatusCode;
}
void canbusStatusSend(uint8_t statusCode)
{
if (canbusActive)
{
CAN.sendMsgBuf(canbusCurrentDebugId, 0, 1, &statusCode);
delay(2);
}
}
void canbusEventSend(uint8_t status)
{
if (canbusActive)
{
CAN.sendMsgBuf(canbusCurrentBatteryEventId, 0, 1, &status);
delay(2);
}
}
void showCurrentOnLCD(float current, float peakCharge, float peakDischarge)
{
// Write the maximum temperature and the address of that cell to LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(current);
lcd.setCursor(6, 0);
lcd.print(" A ");
lcd.setCursor(0, 1);
lcd.print(" Ai - Ao");
lcd.setCursor(0, 1);
lcd.print(peakCharge);
lcd.setCursor(9, 1);
lcd.print(peakDischarge);
}
void initCurrentSensor()
{
// Change the reference voltage to 1.1V
analogReference(INTERNAL);
// A few calls to analogRead must be made for the new reference voltage to appear at the Vref pin
for (int i = 0; i < 10; i++)
{
analogRead(7);
}
Serial.println("Reading in the first set of values");
// Populate the first few raw values inside sampleArray and calculate average
float sum = 0;
for (int i = 0; i < samplesConsideredInAverage; i++)
{
recentSampleValues[i] = analogRead(7);
Serial.println(recentSampleValues[i]);
sum += recentSampleValues[i];
}
Serial.println("Sum:");
Serial.println(sum);
currentRunningAverage = sum / samplesConsideredInAverage;
Serial.println(currentRunningAverage);
offset = chargingDischargingThreshold - currentRunningAverage;
}
void calculateNextAverage(uint16_t newValue)
{
Serial.print("\nInput: ");
Serial.println(newValue);
Serial.print("oldest index: ");
Serial.println(oldestIndex);
Serial.print("recentSampleValues[OldestIndex]: ");
Serial.println(recentSampleValues[oldestIndex]);
float difference = ((int16_t)newValue-(int16_t)recentSampleValues[oldestIndex]);
Serial.print("diff: ");
Serial.println(difference);
float scaledDiff = difference/samplesConsideredInAverage;
Serial.print("scaled diff: ");
Serial.println(scaledDiff);
currentRunningAverage += scaledDiff;
Serial.print("output: ");
Serial.println(currentRunningAverage);
// Replace oldest value with new value
recentSampleValues[oldestIndex] = newValue;
// Increment oldestindex
oldestIndex++;
oldestIndex = oldestIndex % samplesConsideredInAverage;
}
void initLCD()
{
// Init the LCD
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A5, OUTPUT);
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Sunstang");
lcd.setCursor(0,1);
lcd.print("2015");
}
void startCarFunction()
{
// Start button pressed
// This function is the only way to enter status STATE_ACTIVE
carState = STATE_ACTIVE;
}
void initCanbus()
{
canbusActive = false;
for (int i = 0; i < canbusInitMaxTries && canbusActive == false; i++)
{
if(CAN_OK == CAN.begin(CAN_1000KBPS))
{
// Serial.println("CAN BUS Shield init ok!");
canbusActive = true;
}
else
{
// Serial.println("CAN BUS Shield init fail");
// Serial.println("Init CAN BUS Shield again");
}
delay(1000);
}
}
boolean isDischarging()
{
return currentRunningAverage < chargingDischargingThreshold;
}
void enableMainRelay()
{
if (digitalRead(RELAY_PIN_MAIN) != HIGH)
{
canbusStatusSend(STATUS_MAIN_RELAY_ENABLED);
digitalWrite(RELAY_PIN_MAIN, HIGH);
}
}
void disableMainRelay()
{
if (digitalRead(RELAY_PIN_MAIN) != LOW)
{
canbusStatusSend(STATUS_MAIN_RELAY_DISABLED);
digitalWrite(RELAY_PIN_MAIN, LOW);
}
}
void enableChargeRelay()
{
if (digitalRead(RELAY_PIN_CHARGE) != HIGH)
{
canbusStatusSend(STATUS_CHARGE_RELAY_ENABLED);
digitalWrite(RELAY_PIN_CHARGE, HIGH);
}
}
void disableChargeRelay()
{
if (digitalRead(RELAY_PIN_CHARGE) != LOW)
{
canbusStatusSend(STATUS_CHARGE_RELAY_DISABLED);
digitalWrite(RELAY_PIN_CHARGE, LOW);
}
}
float calculateCurrent(uint16_t adcVal)
{
//float Vo = adcVal * 1.1 / 1023;
//float Vi = (Vo + 0.5885)/0.3703;
//float I = (Vi - 4.096)/0.0162;
adcVal += offset;
Serial.print("Result after offset = ");
Serial.println(adcVal);
return ((33.51459+149.64)/1024)*adcVal -149.64;
}
/*
4. TASK SCHEDULING CODE
*/
// The following two functions implement time-slice cyclic scheduling
// timerISR() notifies waitForTimeslice() that a new timeslice arrived
// waitForTimeSlice() halts program execution until it gets the signal from timerISR()
void timerISR()
{
// Raise timeslice flag
newTimeSlice = true;
}
void waitForTimeSlice()
{
// poll timeslice flag. Reset flag upon exit
while (newTimeSlice == false);
newTimeSlice = false;
// At the very beginning of program runtime, initialize count variables used for prescaling
static unsigned char checkBatteryCount = 0;
static unsigned char updateLcdCount = 0;
static unsigned char broadcastCanbusCount = 0;
static unsigned char broadcastControllerStateCount = 0;
// Determine if any of the tasks is ready to run using prescalar value
if (checkBatteryCount >= TASK_PRESCALAR_CheckBattery)
{
task_CheckBattery_Ready = true;
checkBatteryCount = 0;
}
if (updateLcdCount >= TASK_PRESCALAR_UpdateLCD)
{
task_UpdateLCD_Ready = true;
updateLcdCount = 0;
}
if (broadcastCanbusCount >= TASK_PRESCALAR_BroadcastMeasurements)
{
task_BroadcastMeasurements_Ready = true;
broadcastCanbusCount = 0;
}
if (broadcastControllerStateCount >= TASK_PRESCALAR_BroadcastState)
{
task_BroadcastState_Ready = true;
broadcastControllerStateCount = 0;
}
// For each task, update count used for prescaling
checkBatteryCount++;
updateLcdCount++;
broadcastCanbusCount++;
broadcastControllerStateCount++;
}
/*
5. TASK DEFINITIONS
*/
void task_CheckBattery()
{
if (carState == STATE_ACTIVE)
{
canbusStatusSend(STATUS_TASK_CHECKBATTERY_RUN_ACTIVE);
byte batteryStatusCode = checkBatteryPackStatus();
// Perform check and relay control
switch (batteryStatusCode)
{
case STATUS_CODE_SAFE_TO_USE:
enableMainRelay();
enableChargeRelay();
break;
case STATUS_CODE_OVERCURRENT_DISCHARGING:
case STATUS_CODE_OVERCURRENT_CHARGING:
case STATUS_CODE_SENSOR_ERROR:
default:
carState = STATE_IDLE;
break;
}
// Update the discharging pin
updateDischargingPin();
}
else
{
// IDLE state: Deactivate all functions and do nothing
canbusStatusSend(STATUS_TASK_CHECKBATTERY_RUN_IDLE);
disableMainRelay();
disableChargeRelay();
}
}
void task_UpdateLCD()
{
// Blink between two screens
static uint8_t currentFrame = 1;
const uint8_t firstFrameLength = 2;
const uint8_t secondFrameLength = 2;
float instantaneousCurrent = calculateCurrent(currentRunningAverage);
//float peakChargeCurrent = calculateCurrent(maxReading);
//float peakDischargeCurrent = calculateCurrent(minReading);
if (currentFrame <= firstFrameLength)
{
// Write highest and lowest value to LCD
showCurrentOnLCD(instantaneousCurrent, 0,0); //peakChargeCurrent, peakDischargeCurrent);
}
else
{
// Display the second screen
switch (batteryStatusCode)
{
case STATUS_CODE_SAFE_TO_USE:
{
// Write highest and lowest value to LCD
showCurrentOnLCD(instantaneousCurrent, 0,0); //peakChargeCurrent, peakDischargeCurrent);
break;
}
case STATUS_CODE_OVERCURRENT_DISCHARGING:
lcd.setCursor(0, 0);
lcd.print("Overcurrent ");
lcd.setCursor(0, 1);
lcd.print("on discharge ");
break;
case STATUS_CODE_OVERCURRENT_CHARGING:
lcd.setCursor(0, 0);
lcd.print("Overcurrent ");
lcd.setCursor(0, 1);
lcd.print("on charge ");
break;
case STATUS_CODE_SENSOR_ERROR:
lcd.setCursor(0, 0);
lcd.print("Sensor Error ");
lcd.setCursor(0, 1);
lcd.print(" ");
break;
default:
break;
}
}
if (currentFrame >= firstFrameLength + secondFrameLength)
{
currentFrame = 0;
}
currentFrame++;
}
void task_BroadcastMeasurements()
{
if (canbusActive)
{
unsigned char array[6] = {
highByte(getMostRecentInstantaneousReading()),
lowByte(getMostRecentInstantaneousReading()),
0x00,
0x00,
0x00,
0x00
};
CAN.sendMsgBuf(canbusCurrentDataStartId, 0, 4, array);
delay(2);
}
}
void task_BroadcastState()
{
if (carState == STATE_ACTIVE)
{
canbusStatusSend(STATUS_TASK_BROADCASTSTATE_ACTIVE);
}
else
{
canbusStatusSend(STATUS_TASK_BROADCASTSTATE_IDLE);
}
}
| [
"edewit2@uwo.ca"
] | edewit2@uwo.ca |
ec9c2f3c8b3abdf70ffe2641a12448d98d817b59 | cb2fe0a9a10a7418bc683df6eedb238c657f4c8a | /Basics of C++/tutorial_9_increment_assignment.cpp | 9b79dc0b1e007487f241cff2bbe6854efd2afbaa | [] | no_license | withoutwaxaryan/programming-basics | bf33c32545e89deba13c6ab33a1568e69f40c693 | 93c0c57bf36acd1190f65ec3f2b6d316d59eaaf0 | refs/heads/master | 2023-03-07T04:58:37.451151 | 2021-02-20T12:26:14 | 2021-02-20T12:26:14 | 181,515,433 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | cpp | #include<iostream>
using namespace std;
int main()
{
int x = 0;
x = x +1;
cout<<x<<endl;
x += 1;
cout<<x<<endl;
cout<<++x<<endl;
cout<<x<<endl;
cout<<x++<<endl;
cout<<x<<endl;
return 0;
} | [
"aryangupta973@gmail.com"
] | aryangupta973@gmail.com |
492baf28193492de548ba28b555dd6940b711fa5 | 60798997f9ff3a60b8787386dbed1ad06c1c9ccc | /DesignPatterns/Behavioral/Strategy/texcompositor.h | 9547a0a8d67279fca8327a76d5bb7cd88dad3368 | [] | no_license | e5MaxSpace/DesignPatterns | be7e478c0fca1626c764287af17fd4457c99a975 | c44a2b6781a571937f85634b57f6feb60a744f89 | refs/heads/master | 2016-09-06T18:08:11.377009 | 2013-09-16T12:16:41 | 2013-09-16T12:16:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 223 | h | #ifndef TEXCOMPOSITOR_H
#define TEXCOMPOSITOR_H
#include "compositor.h"
class TexCompositor : public Compositor
{
public:
TexCompositor();
virtual int Compose(Composition *context);
};
#endif // TEXCOMPOSITOR_H
| [
"e5Max@qq.com"
] | e5Max@qq.com |
aff9e05959e0f6128d08c4724c2fb1c2393f2153 | c8625f66ff26a47fd2fa0d879256eab564879660 | /get_boxes_raw/2Darr.h | fc1c0e571b6ed3cdb55ffb19a0bab06f441d0f29 | [] | no_license | BenBait/LNPLab_Summer2020 | c094b5e1eb57e8827ba1341997b40f82e1b97434 | 880003b076e068fe15976e102140288767599139 | refs/heads/master | 2023-01-28T16:46:01.586130 | 2020-12-07T21:56:44 | 2020-12-07T21:56:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | h | #ifndef ARR2
#define ARR2
#include<iostream>
template <class T>
class Arr_2D{
public:
Arr_2D(int size){
first_dim = size;
data = new T*[first_dim]();
}
Arr_2D(int size1, int size2){
first_dim = size1;
data = new T*[first_dim]();
for(int i = 0; i < first_dim; i++)
data[i] = new T[size2]();
}
~Arr_2D(){
for(int i = 0; i < first_dim; i++) {
delete [] data[i];
}
delete [] data;
}
void set(int x, T *val){
data[x] = val;
}
void set(int x, int y, T val){
data[x][y] = val;
}
T at(int x, int y){
return data[x][y];
}
int get_dim(int d) {
if (d == 1) {
return first_dim;
}
return second_dim;
}
private:
T **data;
int first_dim;
int second_dim;
};
#endif
| [
"bmaloy01@eecs.tufts.edu"
] | bmaloy01@eecs.tufts.edu |
994c7206ba3daf414e9661c5cbc8fc080a21bb89 | b992005e5967b189eb1c7947f51ccfc6ebcbb28c | /src/Lvl2Crawl.cpp | 0e6547f13ec168391ec23c7bb3331726744d68cb | [] | no_license | CaptainCone/CPPCodeExampleAlexMace | 44711438f1820b0a5f79b5a32c1371413e03fecc | 58ca0906621fc9ae7b9500b77453c277539fd9ea | refs/heads/main | 2023-02-25T20:12:57.073196 | 2021-02-04T15:45:28 | 2021-02-04T15:45:28 | 335,339,185 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 942 | cpp | #include "Lvl2Crawl.h"
Lvl2Crawl::Lvl2Crawl(Cw4Engine* game)
:invisDisplayableObj(game)
{
setSize(700, 700);
setPosition(300, 700);
imgCrawl = ImageManager::loadImage("images/Lvl2Crawl.png", true);
setVisible(false);
ticks = 0;
}
void Lvl2Crawl::virtDraw()
{
if (isVisible()) {
imgCrawl.renderImageWithMask(getEngine()->getForegroundSurface(), 0, 0,
m_iCurrentScreenX + m_iStartDrawPosX, m_iCurrentScreenY + m_iStartDrawPosY,
m_iDrawWidth, m_iDrawHeight);
if (m_iCurrentScreenY == 699) {
pGame->ImpMarch.pause();
pGame->MainTheme.load("SFX/MainTheme.wav");
pGame->MainTheme.play();
}
if (ticks > 1300) {
//change state
pGame->gameSpeed = 1;
//press enter to start
pGame->drawForegroundString(500, 400, "Press enter to start", 0xFFE3B201);
}
}
}
void Lvl2Crawl::virtDoUpdate(int iCurrentTime)
{
if (!isVisible())
return;
setPosition(m_iCurrentScreenX, m_iCurrentScreenY - 1);
ticks++;
}
| [
"alexjjmace@gmail.com"
] | alexjjmace@gmail.com |
0550846c98f13a995e598463eb01899d91655164 | 2e60db4a324e34c6b88ff3c4eae1697cb620a2d9 | /app/src/main/cpp/native-lib.cpp | b272db14266238053ceb56cf19e04e27b1dca9aa | [] | no_license | Xiaoben336/FFmpegDecoder | 17fec8f4f891e20aac2810cf96008589b6f4a4c6 | 7aef8b7e83cd5f23759aceb459509aefd23a1ceb | refs/heads/master | 2023-08-14T15:34:12.886475 | 2023-07-27T02:55:33 | 2023-07-27T02:55:33 | 162,780,898 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,345 | cpp | /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
#include <string>
#include <android/log.h>
#include <android/native_window.h>
#include <android/native_window_jni.h>
/* Header for class com_example_zjf_ffmpegdecoder_FFmpeg */
#ifdef __cplusplus
extern "C" {
#include <libavutil/log.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
#include "com_example_zjf_ffmpegdecoder_FFmpeg.h"
#include <android/log.h>
#define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR, "(>_<)", format, ##__VA_ARGS__)
#define LOGI(format, ...) __android_log_print(ANDROID_LOG_INFO, "(^_^)", format, ##__VA_ARGS__)
#endif
/*
* Class: com_example_zjf_ffmpegdecoder_FFmpeg
* Method: decode
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jint JNICALL Java_com_example_zjf_ffmpegdecoder_FFmpeg_decode
(JNIEnv *env, jclass clazz , jstring input_jstr, jstring output_jstr){
AVFormatContext *pFormatCtx;
int i,videoindex;
AVCodecContext *pCodecCtx;
AVCodec *pCodec;
AVFrame *pFrame,*pFrameYUV;
uint8_t *out_buffer;
AVPacket *pPacket;
int y_size;
int ret, got_picture;
struct SwsContext *img_convert_ctx;
FILE *fp_yuv;
int frame_cnt;
clock_t time_start, time_finish;
double time_duration = 0.0;
char input_str[500]={0};
char output_str[500]={0};
char info[1000]={0};
sprintf(input_str,"%s",env->GetStringUTFChars(input_jstr, NULL));
sprintf(output_str,"%s",env->GetStringUTFChars(output_jstr, NULL));
/*初始化avformat并注册编译进avformat库里面所有的复用器(muxers),
解复用器(demuxers)和协议模块*/
av_register_all();
/**网络功能的全局初始化(可选的,在使用网络协议时有必要调用)*/
avformat_network_init();
//初始化一个AVFormatContext
pFormatCtx = avformat_alloc_context();
//打开输入的视频文件
if (avformat_open_input(&pFormatCtx,input_str,NULL,NULL) != 0){
LOGE("Couldn't open input stream.\n");
return -1;
}
//获取视频文件信息
if (avformat_find_stream_info(pFormatCtx,NULL) < 0){
LOGE("Couldn't find stream information.\n");
return -1;
}
videoindex = -1;
///遍历视音频流的个数
for (int i = 0; i < pFormatCtx -> nb_streams; i++) {
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO){
videoindex = i;
break;
}
}
if(videoindex==-1){
LOGE("Couldn't find a video stream.\n");
return -1;
}
//指向AVCodecContext的指针
pCodecCtx = pFormatCtx->streams[videoindex]->codec;
//指向AVCodec的指针.查找解码器
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (pCodec == NULL)
{
LOGE("Couldn't find Codec.\n");
return -1;
}
//打开解码器
if (avcodec_open2(pCodecCtx,pCodec,NULL) < 0){
LOGE("Couldn't open codec.\n");
return -1;
}
//用来保存数据缓存的对像
pFrame = av_frame_alloc();
pFrameYUV = av_frame_alloc();
out_buffer = (unsigned char *)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height,1));
av_image_fill_arrays(pFrameYUV->data, pFrameYUV->linesize,out_buffer,
AV_PIX_FMT_YUV420P,pCodecCtx->width, pCodecCtx->height,1);
pPacket = (AVPacket *)av_malloc(sizeof(AVPacket));
img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt,
pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
sprintf(info, "[Input ]%s\n", input_str);
sprintf(info, "%s[Output ]%s\n",info,output_str);
sprintf(info, "%s[Format ]%s\n",info, pFormatCtx->iformat->name);
sprintf(info, "%s[Codec ]%s\n",info, pCodecCtx->codec->name);
sprintf(info, "%s[Resolution]%dx%d\n",info, pCodecCtx->width,pCodecCtx->height);
fp_yuv=fopen(output_str,"wb+");
if(fp_yuv==NULL){
printf("Cannot open output file.\n");
return -1;
}
frame_cnt = 0;
time_start = clock();
while(av_read_frame(pFormatCtx, pPacket) >= 0){
if(pPacket->stream_index == videoindex){
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, pPacket);
if(ret < 0){
LOGE("Decode Error.\n");
return -1;
}
if(got_picture){
sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
pFrameYUV->data, pFrameYUV->linesize);
y_size=pCodecCtx->width*pCodecCtx->height;
fwrite(pFrameYUV->data[0],1,y_size,fp_yuv); //Y
fwrite(pFrameYUV->data[1],1,y_size/4,fp_yuv); //U
fwrite(pFrameYUV->data[2],1,y_size/4,fp_yuv); //V
//Output info
char pictype_str[10]={0};
switch(pFrame->pict_type){
case AV_PICTURE_TYPE_I:sprintf(pictype_str,"I");break;
case AV_PICTURE_TYPE_P:sprintf(pictype_str,"P");break;
case AV_PICTURE_TYPE_B:sprintf(pictype_str,"B");break;
default:sprintf(pictype_str,"Other");break;
}
LOGI("Frame Index: %5d. Type:%s",frame_cnt,pictype_str);
frame_cnt++;
}
}
av_free_packet(pPacket);
}
while (1) {
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, pPacket);
if (ret < 0)
break;
if (!got_picture)
break;
sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
pFrameYUV->data, pFrameYUV->linesize);
int y_size=pCodecCtx->width*pCodecCtx->height;
fwrite(pFrameYUV->data[0],1,y_size,fp_yuv); //Y
fwrite(pFrameYUV->data[1],1,y_size/4,fp_yuv); //U
fwrite(pFrameYUV->data[2],1,y_size/4,fp_yuv); //V
//Output info
char pictype_str[10]={0};
switch(pFrame->pict_type){
case AV_PICTURE_TYPE_I:sprintf(pictype_str,"I");break;
case AV_PICTURE_TYPE_P:sprintf(pictype_str,"P");break;
case AV_PICTURE_TYPE_B:sprintf(pictype_str,"B");break;
default:sprintf(pictype_str,"Other");break;
}
LOGI("Frame Index: %5d. Type:%s",frame_cnt,pictype_str);
frame_cnt++;
}
time_finish = clock();
time_duration=(double)(time_finish - time_start);
sprintf(info, "%s[Time ]%fms\n",info,time_duration);
sprintf(info, "%s[Count ]%d\n",info,frame_cnt);
sws_freeContext(img_convert_ctx);
fclose(fp_yuv);
av_frame_free(&pFrameYUV);
av_frame_free(&pFrame);
avcodec_close(pCodecCtx);
avformat_close_input(&pFormatCtx);
return 0;
}
JNIEXPORT jint JNICALL Java_com_example_zjf_ffmpegdecoder_FFmpeg_play
(JNIEnv *env, jclass clazz,jstring file_path, jobject surface){
LOGE("play");
av_register_all();
char file_name[500] = {0};
sprintf(file_name,"%s",env->GetStringUTFChars(file_path, NULL));
char *filename = "/storage/emulated/0/bird.avi";
AVFormatContext *pFormatCtx = avformat_alloc_context();
//打开视频文件
if (int err_code = avformat_open_input(&pFormatCtx,file_name,NULL,NULL)){
LOGE("Couldn't open file:%s\n", filename);
char buf[] = {0};
av_strerror(err_code, buf, 1024);
LOGE("Couldn't open file %d:(%s)",err_code, buf);
return -1;
}
//检索流信息
if (avformat_find_stream_info(pFormatCtx,NULL) < 0) {
LOGE("Couldn't find stream information.");
return -1;
}
int videoStream = -1, i;
for (i = 0; i < pFormatCtx->nb_streams; i++) {
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO
&& videoStream < 0) {
videoStream = i;
}
}
if (videoStream == -1) {
LOGE("Didn't find a video stream.");
return -1; // Didn't find a video stream
}
AVCodecContext *pCodecCtx = pFormatCtx->streams[videoStream]->codec;
AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (pCodec == NULL) {
LOGE("Codec not found.");
return -1; // Codec not found
}
if (avcodec_open2(pCodecCtx,pCodec,NULL) < 0) {
LOGE("Could not open codec.");
return -1; // Could not open codec
}
ANativeWindow *nativeWindow = ANativeWindow_fromSurface(env,surface);
int videoWidth = pCodecCtx->width;
int videoHeight = pCodecCtx->height;
ANativeWindow_setBuffersGeometry(nativeWindow, videoWidth, videoHeight,
WINDOW_FORMAT_RGBA_8888);
ANativeWindow_Buffer windowBuffer;
// Allocate video frame
AVFrame *pFrame = av_frame_alloc();
// 用于渲染
AVFrame *pFrameRGBA = av_frame_alloc();
if (pFrameRGBA == NULL || pFrame == NULL) {
LOGE("Could not allocate video frame.");
return -1;
}
/* (a)计算所需内存大小av_image_get_bufferz_size()
--> (b) 按计算的内存大小申请所需内存 av_malloc()
--> (c) 对申请的内存进行格式化 av_image_fill_arrays()*/
// buffer中数据就是用于渲染的,且格式为RGBA
int numBytes = av_image_get_buffer_size(AV_PIX_FMT_RGBA, pCodecCtx->width, pCodecCtx->height,1);
uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t));
av_image_fill_arrays(pFrameRGBA->data, pFrameRGBA->linesize, buffer, AV_PIX_FMT_RGBA,
pCodecCtx->width, pCodecCtx->height, 1);
// 由于解码出来的帧格式不是RGBA的,在渲染之前需要进行格式转换
struct SwsContext *sws_ctx = sws_getContext(pCodecCtx->width,
pCodecCtx->height,
pCodecCtx->pix_fmt,
pCodecCtx->width,
pCodecCtx->height,
AV_PIX_FMT_RGBA,
SWS_BILINEAR,
NULL,
NULL,
NULL);
int frameFinished;
AVPacket packet;
while (av_read_frame(pFormatCtx, &packet) >= 0) {
// Is this a packet from the video stream?
if (packet.stream_index == videoStream) {
// Decode video frame
avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
// 并不是decode一次就可解码出一帧
if (frameFinished) {
// lock native window buffer
ANativeWindow_lock(nativeWindow, &windowBuffer, 0);
// 格式转换
sws_scale(sws_ctx, (uint8_t const *const *) pFrame->data,
pFrame->linesize, 0, pCodecCtx->height,
pFrameRGBA->data, pFrameRGBA->linesize);
// 获取stride
uint8_t *dst = (uint8_t *) windowBuffer.bits;
int dstStride = windowBuffer.stride * 4;
uint8_t *src = (pFrameRGBA->data[0]);
int srcStride = pFrameRGBA->linesize[0];
// 由于window的stride和帧的stride不同,因此需要逐行复制
int h;
for (h = 0; h < videoHeight; h++) {
memcpy(dst + h * dstStride, src + h * srcStride, srcStride);
}
ANativeWindow_unlockAndPost(nativeWindow);
}
}
av_packet_unref(&packet);
}
av_free(buffer);
av_free(pFrameRGBA);
// Free the YUV frame
av_free(pFrame);
// Close the codecs
avcodec_close(pCodecCtx);
// Close the video file
avformat_close_input(&pFormatCtx);
return 0;
}
#ifdef __cplusplus
}
#endif
| [
"614306572@qq.com"
] | 614306572@qq.com |
d09948b271293a24fbd897c9bbbc735679c14b73 | 4a755ab883ad8cdcbad7aafabe3b1653889ad195 | /src/mlearn/classifier/bayes.h | 8378f4f43638896a9b7d07d90c5a9183bde0ab76 | [
"MIT"
] | permissive | CUFCTL/mlearn | f040a2128ef4729a5c7a971815dcc9e171cb0302 | 51cde07582bdb36b1a185412be00622f259c4a2d | refs/heads/master | 2023-02-12T21:37:48.191201 | 2021-01-12T18:21:38 | 2021-01-12T18:21:38 | 97,747,637 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 679 | h | /**
* @file classifier/bayes.h
*
* Interface definitions for the naive Bayes classifier.
*/
#ifndef MLEARN_CLASSIFIER_BAYES_H
#define MLEARN_CLASSIFIER_BAYES_H
#include "mlearn/layer/estimator.h"
namespace mlearn {
class BayesLayer : public EstimatorLayer {
public:
BayesLayer() = default;
void fit(const Matrix& X) {}
void fit(const Matrix& X, const std::vector<int>& y, int c);
std::vector<int> predict(const Matrix& X) const;
void save(IODevice& file) const;
void load(IODevice& file);
void print() const;
private:
float prob(Matrix x, const Matrix& mu, const Matrix& S_inv) const;
std::vector<Matrix> _mu;
std::vector<Matrix> _S_inv;
};
}
#endif
| [
"bentshermann@gmail.com"
] | bentshermann@gmail.com |
8cc07066890ef53d99c314f101e5285b182e3474 | d4a2c50a90792600c4d864fffe9c1a9d1ebd6acc | /work_scheduler/ManualBunkatsuDlg.h | 8fafdbe8cb5ed967804db8d33f6b4194fa5111a8 | [] | no_license | iwasen/MyProg | 3080316c3444e98d013587e92c066e278e796041 | a0755a21d77647261df271ce301404a4e0294a7b | refs/heads/master | 2022-12-30T00:28:07.539183 | 2020-10-25T06:36:27 | 2020-10-25T06:36:27 | 307,039,466 | 0 | 4 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,112 | h | #pragma once
//*****************************************************************************************************
// 1. ファイル名
// ManualBunkatsuDlg.h
//----------------------------------------------------------------------------------------------------
// 2. 機能
// CManualBunkatsuDlg クラスのインターフェイス
//----------------------------------------------------------------------------------------------------
// 3. 備考
//----------------------------------------------------------------------------------------------------
// 4. 履歴
// 2006.09.01 S.Aizawa(xxx) 新規作成
//*****************************************************************************************************
#include "DialogEx.h"
#include "ManualEditDocument.h"
#include "LixxxtrlEx1.h"
// 工程/要素作業群の分割削除ダイアログ
class CManualBunkatsuDlg : public CDialogEx
{
// 作業者リストデータ
struct SSagyoshaList {
int nSublineId;
int nSagyoshaId;
};
typedef CArrayEx <SSagyoshaList, SSagyoshaList&> CSagyoshaListArray;
// リストボックス設定データ
struct SListData {
// Modify ... ( ADD )
int nSagyoNo; // 作業No
// By Y.Itabashi (xxxxx) 2007.02.19
CString sName; // 項目名
double fTime; // 作業時間
int nId; // 項目ID
SGraphBlock *pGraphBlock;
};
typedef CArrayEx <SListData, SListData&> CListDataArray;
// コンストラクション
public:
CManualBunkatsuDlg(CWnd* pParent = NULL); // 標準のコンストラクタ
// ダイアログ データ
//{{AFX_DATA(CManualBunkatsuDlg)
enum { IDD = IDD_MANUAL_BUNKATSU };
CButton m_cButtonPreview;
CButton m_cButtonSettei;
CButton m_cButtonRightMove;
CButton m_cButtonLeftMove;
CStatic m_cStaticTotalTime2;
CStatic m_cStaticTotalTime1;
CComboBox m_cComboYosoSagyogun;
CComboBox m_cComboKotei;
CComboBox m_cComboSagyosha;
CLixxxtrlEx1 m_cList2;
CLixxxtrlEx1 m_cList1;
//}}AFX_DATA
int m_nKishuId; // 機種ID
int m_nSagyoshaId; // 作業者ID
CString m_sKoteiName; // 工程名
CString m_sYosoSagyogunName; // 要素作業群名
CManualEditDocument *m_pDoc; // ドキュメントクラスへのポインタ
// オーバーライド
// ClassWizard は仮想関数のオーバーライドを生成します。
//{{AFX_VIRTUAL(CManualBunkatsuDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV サポート
//}}AFX_VIRTUAL
// インプリメンテーション
protected:
// 生成されたメッセージ マップ関数
//{{AFX_MSG(CManualBunkatsuDlg)
virtual BOOL OnInitDialog();
afx_msg void OnButtonLeftMove();
afx_msg void OnButtonRightMove();
afx_msg void OnButtonSettei();
afx_msg void OnSelchangeComboSagyosha();
afx_msg void OnSelchangeComboKotei();
afx_msg void OnSelchangeComboYosoSagyogun();
afx_msg void OnButtonPreview();
virtual void OnCancel();
afx_msg void OnClickList1(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
int m_nMode; // 表示モード
BOOL m_bPreview; // プレビュー実行フラグ
SYosoSagyogun *m_pYosoSagyogun; // 要素作業群ポインタ
CSagyoshaListArray m_aSagyoshaList; // 作業者リストデータ
CListDataArray m_aListData; // リストボックスデータ配列
void ExecBunkatsuSakujo();
void KoteiBunkatsu();
void YosoSagyogunBunkatsu();
void SetSagyoshaList();
void SetComboList();
void SetKoteiList();
void SetYosoSagyogunList();
void SetYosoSagyoList();
void SetComboBox(CComboBox &cComboBox);
void SetListBox();
void DispTotalTimeAll();
void DispTotalTime(double fTime, CStatic &cStatic);
double CalcTotalTime(CLixxxtrlEx1 &cList);
void EnableButtons();
void MoveListBox(CLixxxtrlEx1 &cListFrom, CLixxxtrlEx1 &cListTo);
void SetLixxxolumn(CLixxxtrlEx1 &cList);
BOOL ListDataCheck();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
| [
"git@iwasen.jp"
] | git@iwasen.jp |
134d4b5d40e38706fa5c69f4ddda18854b5c38c8 | 376a86df4b66492ec3eb63d325c086bec80387d3 | /include/hapi/mpsdef.hpp | 65e77d8319f47b93081535e1225445d72e605ecd | [] | no_license | lassenielsen/hapi | 88385306750a4e4d18e05df81d7584931510e2cb | a150e6297ac8de1b6d0b02b878f44fb1dfaf5c56 | refs/heads/master | 2023-09-01T08:41:01.719876 | 2023-08-27T22:38:55 | 2023-08-27T22:38:55 | 1,612,938 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,331 | hpp | #ifndef MPSDEF_HPP
#define MPSDEF_HPP
#include <hapi/mpsterm.hpp>
namespace hapi {
// DOCUMENTATION: MpsDef {{{
/*!
* MpsDef defines a (possibly) recursive procedure.
*/
// }}}
class MpsDef : public MpsTerm // {{{
{
public:
MpsDef(const std::string &name, const std::vector<std::string> &args, const std::vector<MpsMsgType*> &types, const std::vector<std::string> &stateargs, const std::vector<MpsMsgType*> &statetypes, const MpsTerm &body, const MpsTerm &succ, bool pure);
virtual ~MpsDef();
void* TDCompileMain(tdc_pre pre,
tdc_post wrap,
tdc_error wrap_err,
const MpsExp &Theta,
const MpsMsgEnv &Gamma,
const MpsProcEnv &Omega,
const std::set<std::pair<std::string,int> > &pureStack,
const std::string &curPure,
PureState pureState,
bool checkPure=true);
bool SubSteps(std::vector<MpsStep> &dest);
MpsTerm *ApplyDef(const std::string &path, std::vector<MpsFunction> &dest) const;
MpsTerm *ReIndex(const std::string &session,
int pid, int maxpid) const;
MpsTerm *PRename(const std::string &src, const std::string &dst) const;
MpsTerm *ERename(const std::string &src, const std::string &dst) const;
MpsTerm *MRename(const std::string &src, const std::string &dst) const;
MpsTerm *PSubst(const std::string &var,
const MpsTerm &exp,
const std::vector<std::string> &args,
const std::vector<std::pair<int,int> > &argpids,
const std::vector<std::string> &stateargs) const;
MpsTerm *ESubst(const std::string &source, const MpsExp &dest) const;
MpsTerm *MSubst(const std::string &source, const MpsMsgType &dest) const;
MpsTerm *GSubst(const std::string &source, const MpsGlobalType &dest, const std::vector<std::string> &args) const;
MpsTerm *LSubst(const std::string &source, const MpsLocalType &dest, const std::vector<std::string> &args) const;
std::set<std::string> FPV() const;
std::set<std::string> EV() const;
std::set<std::string> FEV() const;
MpsTerm *Copy() const;
bool Terminated() const;
MpsTerm *Simplify() const;
std::string ToString(std::string indent="") const;
std::string ToTex(int indent=0, int sw=2) const;
MpsTerm *FlattenFork(bool normLhs, bool normRhs, bool pureMode) const;
MpsTerm *RenameAll() const;
bool Parallelize(const MpsTerm &receives, MpsTerm* &seqTerm, MpsTerm* &parTerm) const;
MpsTerm *Append(const MpsTerm &term) const;
MpsTerm *CopyWrapper(std::map<std::string,void*> &children) const;
MpsTerm *CloseDefsPre(const MpsMsgEnv &Gamma);
MpsTerm *ExtractDefinitions(MpsFunctionEnv &env) const;
std::string GenerateC(const MpsMsgEnv &Gamma, const MpsProcEnv &Omega, const std::map<std::string,void*> &children) const;
std::string GetConsts(const MpsMsgEnv &Gamma, const MpsProcEnv &Omega, const std::map<std::string,void*> &children) const;
std::string ToC(const std::string &taskType) const;
std::string ToCHeader() const;
void ToCConsts(std::vector<std::string> &dest, std::unordered_set<std::string> &existing) const;
std::vector<std::pair<int,int> > GetArgPids() const;
const std::vector<std::string> &GetArgs() const { return myArgs; }
const std::vector<std::string> &GetStateArgs() const { return myStateArgs; }
const std::vector<MpsMsgType*> &GetTypes() const { return myTypes; }
const std::vector<MpsMsgType*> &GetStateTypes() const { return myStateTypes; }
const std::string &GetName() const { return myName; }
const MpsTerm *GetBody() const { return myBody; }
MpsTerm *GetBody() { return myBody; }
const MpsTerm *GetSucc() const { return mySucc; }
MpsTerm *GetSucc() { return mySucc; }
bool IsPure() { return myPure; }
private:
static std::vector<std::pair<int,int> > GetArgPids(const std::vector<MpsMsgType*> &argTypes);
std::string myName;
std::vector<std::string> myStateArgs;
std::vector<MpsMsgType*> myStateTypes;
std::vector<std::string> myArgs;
std::vector<MpsMsgType*> myTypes;
MpsTerm *myBody;
MpsTerm *mySucc;
bool myPure;
}; // }}}
}
#endif
| [
"lasse.nielsen.dk@gmail.com"
] | lasse.nielsen.dk@gmail.com |
e0b0eae1cb35b79fd39b0862f706f07187a9f2ba | 448ea73be517e42ae8327e6598054b03beb7405e | /cppProject01BigIntDec/cppProject01BigIntDec/CommandParser.cpp | f0511cc86a69ef1b2e85b28c084a9538b128aa77 | [] | no_license | cliff101/BigIntBigDecimal | 99393503075f27a92373cef5cbdd284c41009fc1 | 0d75f0d9f39e6cc127a889814507ef1ac9e30fee | refs/heads/master | 2023-04-18T19:04:11.775924 | 2021-05-03T08:11:02 | 2021-05-03T08:11:02 | 360,076,915 | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 16,242 | cpp | #include "CommandParser.h"
#define BIAS_BLANK string(" ")
bool keeprun = true;
void setConsoleColor(WORD c)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
void signal_callback_handler(int signum) {
keeprun = false;
}
CommandParser::retmsg CommandParser::createerrmsg(unsigned long long int i, string info) {
retmsg msg;
msg.ok = false;
msg.errmsg = "";
for (unsigned long long int j = 0; j < i; j++) {
msg.errmsg += " ";
}
msg.errmsg += BIAS_BLANK + "^~~ " + info;
return msg;
}
CommandParser::CommandParser() {
BigValueVar = map<string, CommandParser::BigValue>();
}
void CommandParser::Inputcommand(string in) {
BigDecimal::precision = 120;///////////////////////////////////////
signal(SIGINT, signal_callback_handler);
unsigned long long i = 0;
blankslide(in, i);
if (i == in.length()) {
return;
}
int checkbb = checkb(in, i);
if (checkbb != 0) {
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(checkbb == 1 ? i : 0, "括弧左右不對秤").errmsg << endl;
setConsoleColor(7);
return;
}
i = 0;
keeprun = true;
retmsg setmode = checkset(in, i);
if (setmode.mode == 0) {
i = 0;
}
else if (setmode.mode == 3) {
if (BigValueVar.find(setmode.varname) == BigValueVar.end()) {
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(i - 1, "嘗試刪除未命名的變數").errmsg << endl;
setConsoleColor(7);
}
else {
BigValueVar.erase(setmode.varname);
}
return;
}
retmsg msg = ProceedCommand(in, i, 8);
if (!keeprun) {
setConsoleColor(6);
cout << "SIGNAL CAUGHT." << endl;
setConsoleColor(7);
}
else if (!msg.ok) {
setConsoleColor(FOREGROUND_RED);
cout << msg.errmsg << endl;
setConsoleColor(7);
}
else {
if (setmode.mode == 1) {
if (BigValueVar.find(setmode.varname) != BigValueVar.end()) {
if (BigValueVar[setmode.varname].IsInt) {
if (msg.value.IsInt) {
BigValueVar[setmode.varname] = msg.value;
}
else {
msg.value.IsInt = true;
msg.value.BigIntVal = msg.value.BigDecimalVal;
BigValueVar[setmode.varname] = msg.value;
}
}
else {
if (msg.value.IsInt) {
msg.value.IsInt = false;
msg.value.BigDecimalVal = msg.value.BigIntVal;
BigValueVar[setmode.varname] = msg.value;
}
else {
BigValueVar[setmode.varname] = msg.value;
}
}
}
else {
BigValueVar[setmode.varname] = msg.value;
}
}
else if (setmode.mode == 2) {
BigValueVar[setmode.varname] = msg.value;
if (setmode.value.IsInt && !BigValueVar[setmode.varname].IsInt) {
BigValueVar[setmode.varname].IsInt = true;
BigValueVar[setmode.varname].BigIntVal = BigValueVar[setmode.varname].BigDecimalVal;
}
else if (!setmode.value.IsInt && BigValueVar[setmode.varname].IsInt) {
BigValueVar[setmode.varname].IsInt = false;
BigValueVar[setmode.varname].BigDecimalVal = BigValueVar[setmode.varname].BigIntVal;
}
}
else {
BigDecimal::precision = 100;///////////////////////////////////////
setConsoleColor(10);
if (msg.value.IsInt) {
cout << msg.value.BigIntVal.Getvalreal() << endl;
}
else {
cout << msg.value.BigDecimalVal.Getvalreal() << endl;
}
setConsoleColor(7);
}
}
}
BigDecimal CommandParser::Getcommandvalue(string in, BigDecimal&) {
signal(SIGINT, signal_callback_handler);
unsigned long long i = 0;
int checkbb = checkb(in, i);
if (checkbb != 0) {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(checkbb == 1 ? i : 0, "括弧左右不對秤").errmsg << endl;
setConsoleColor(7);
return 0;
}
i = 0;
keeprun = true;
retmsg setmode = checkset(in, i);
if (setmode.mode == 0) {
i = 0;
}
else {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(i - 1, "非std input模式不支援設定變數").errmsg << endl;
setConsoleColor(7);
return 0;
}
retmsg msg = ProceedCommand(in, i, 8);
if (!keeprun) {
cout << in << endl;
setConsoleColor(6);
cout << "SIGNAL CAUGHT." << endl;
setConsoleColor(7);
}
else if (!msg.ok) {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << msg.errmsg << endl;
setConsoleColor(7);
}
else {
if (msg.value.IsInt) {
return msg.value.BigIntVal;
}
else {
return msg.value.BigDecimalVal;
}
}
}
BigInt CommandParser::Getcommandvalue(string in, BigInt&) {
signal(SIGINT, signal_callback_handler);
unsigned long long i = 0;
int checkbb = checkb(in, i);
if (checkbb != 0) {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(checkbb == 1 ? i : 0, "括弧左右不對秤").errmsg << endl;
setConsoleColor(7);
return 0;
}
i = 0;
keeprun = true;
retmsg setmode = checkset(in, i);
if (setmode.mode == 0) {
i = 0;
}
else {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << createerrmsg(i - 1, "非std input模式不支援設定變數").errmsg << endl;
setConsoleColor(7);
return 0;
}
retmsg msg = ProceedCommand(in, i, 8);
if (!keeprun) {
cout << in << endl;
setConsoleColor(6);
cout << "SIGNAL CAUGHT." << endl;
setConsoleColor(7);
}
else if (!msg.ok) {
cout << BIAS_BLANK + in << endl;
setConsoleColor(FOREGROUND_RED);
cout << msg.errmsg << endl;
setConsoleColor(7);
}
else {
if (msg.value.IsInt) {
return msg.value.BigIntVal;
}
else {
return msg.value.BigDecimalVal;
}
}
}
bool CommandParser::IsCommand(string& in)
{
unsigned long long int i = 0;
blankslide(in, i);
if (i >= in.size()) {
return true;
}
bool dot = false;
if (in[i] == '.') {
dot = true;
}
else if (in[i] != '+' && in[i] != '-' && !isnumeric(in[i])) {
return true;
}
i++;
for (; i < in.length(); i++) {
if (!isnumeric(in[i]) && (in[i] != '.' || in[i] == '.' && dot)) {
return true;
}
else if (in[i] == '.') {
dot = true;
}
}
return false;
}
/*
2 ! 由左至右
3 ^ 由右至左
4 +- (正負號) 由右至左
5 * / 由左至右
6 + - 由左至右
7 ()
8 (empty)
*/
CommandParser::retmsg CommandParser::ProceedCommand(string& cmd, unsigned long long& i, int prevpriority, bool isgiveval1, BigValue giveval1) {
while (keeprun) {
string operatorval = "";
BigValue value1, value2;
retmsg msg;
int thispriority = 0;
if (!isgiveval1) {
msg = getvalue(cmd, i);
if (!msg.ok) {
return msg;
}
else if (msg.description == "(") {//發現(,強制下一層遞迴
value1 = msg.value;
i++;
msg = ProceedCommand(cmd, i, 7);//return時,i停留在operator上
if (!msg.ok) {
return msg;
}
retmsg msg2;
string operatorvaltemp = "*";
msg2 = calculate(value1, operatorvaltemp, msg.value);
value1 = msg2.value;
}
else {
value1 = msg.value;
}
if (msg.description == "endofcmd") {
return msg;
}
}
else {
value1 = giveval1;
}
while (keeprun) {
msg = getoperator(cmd, i);
if (!msg.ok) {
return msg;
}
else if (msg.description == "endofcmd") {
msg.ok = true;
msg.value = value1;
msg.errmsg = "";
msg.priority = 8;
return msg;
}
else if (msg.description == "(") {
operatorval = "*";
thispriority = 5;
}
else if (msg.description == ")") {
msg.ok = true;
msg.errmsg = "";
msg.priority = 7;
msg.value = value1;
i++;
return msg;//return時,i停留在operator上
}
else if (msg.description == "!") {
msg = stagecalc(value1);
if (!msg.ok) {
return createerrmsg(i, msg.description);
}
else {
value1 = msg.value;
}
i++;
continue;
}
else {
operatorval = msg.description;
thispriority = msg.priority;
}
break;
}
if (thispriority > prevpriority || thispriority == prevpriority && operatorval != "^") {
msg.ok = true;
msg.errmsg = "";
msg.priority = thispriority;
msg.value = value1;
return msg;//return時,i停留在operator上
}
else {
i++;
msg = ProceedCommand(cmd, i, thispriority);//return時,i停留在operator上
if (!msg.ok) {
return msg;
}
value2 = msg.value;
retmsg msg2;
msg2 = calculate(value1, operatorval, value2);//return時,i停留在operator上
if (!msg2.ok) {
return createerrmsg(i - 1, msg2.description);
}
else if (msg.description == "endofcmd" || cmd[i - 1] == ')') {//end of command 或出現), 直接return
return msg2;
}
isgiveval1 = true;
giveval1 = msg2.value;
prevpriority = 8;
}
}
retmsg msg;
return msg;//impossibel to happen, just for reduce warning
}
CommandParser::retmsg CommandParser::getoperator(string& cmd, unsigned long long& i) {
blankslide(cmd, i);
retmsg msg;
if (i >= static_cast<unsigned long long>(cmd.length())) {
msg.ok = true;
msg.description = "endofcmd";
return msg;
}
if (cmd[i] != '+' && cmd[i] != '-' && cmd[i] != '*' && cmd[i] != '/' && cmd[i] != '^' && cmd[i] != '!' && cmd[i] != '(' && cmd[i] != ')') {
return createerrmsg(i, "無法辨識運算符");
}
if (cmd[i] == '(') {
msg.priority = 1;
}
else if (cmd[i] == ')') {
msg.priority = 7;
}
else if (cmd[i] == '!') {
msg.priority = 2;
}
else if (cmd[i] == '^') {
msg.priority = 3;
}
else if (cmd[i] == '*' || cmd[i] == '/') {
msg.priority = 5;
}
else if (cmd[i] == '+' || cmd[i] == '-') {
msg.priority = 6;
}
msg.ok = true;
msg.description = cmd[i];
return msg;
}
CommandParser::retmsg CommandParser::getvalue(string& cmd, unsigned long long& i, bool varerr) {
blankslide(cmd, i);
retmsg msg;
if (i < cmd.length() && cmd[i] == '(') {
msg.ok = true;
msg.description = "(";
msg.value.IsInt = true;
msg.value.BigIntVal = BigInt(1);
return msg;
}
string res = "";
while (i < cmd.length() && (cmd[i] == '+' || cmd[i] == '-')) {
if (cmd[i] == '-' && res == "-" || cmd[i] == '+' && (res == "+" || res == "")) {
res = '+';
}
else {
res = '-';
}
i++;
blankslide(cmd, i);
}
bool first = true,
isintbool = true,
isvar = false;
if (i < cmd.length() && isalphabetic(cmd[i])) {
isvar = true;
}
while (i < cmd.length()) {
if (!isvar) {
if (isnumeric(cmd[i])) {
res += cmd[i];
first = false;
}
else if (isintbool && cmd[i] == '.') {
res += '.';
isintbool = false;
}
else {
break;
}
}
else {
if (isalphabetic(cmd[i]) || isnumeric(cmd[i])) {
res += cmd[i];
first = false;
}
else {
break;
}
}
i++;
}
if (cmd[i] == '(') {
msg.description = "(";
}
else if (first) {
return createerrmsg(i, "須為數值");
}
if (!isvar) {
msg.ok = true;
if (isintbool) {
msg.value.IsInt = true;
if (res.length() == 1 && res[0] == '+') {
msg.value.BigIntVal = BigInt(1);
}
else if (res.length() == 1 && res[0] == '-') {
msg.value.BigIntVal = BigInt(-1);
}
else {
msg.value.BigIntVal = BigInt(res);
}
}
else {
msg.value.IsInt = false;
msg.value.BigDecimalVal = BigDecimal(res);
}
return msg;
}
else {
msg.varname = res;
bool sign = true;
bool find = false;
if (res[0] == '+' || res[0] == '-') {
sign = res[0] == '+';
res.erase(res.begin());
find = true;
}
if (BigValueVar.find(res) == BigValueVar.end()) {
if (!varerr && !find) {
msg.ok = true;
msg.errmsg = "";
return msg;
}
else {
return createerrmsg(i - 1, "未命名的變數");
}
}
else {
msg.ok = true;
msg.value = BigValueVar[res];
if (!sign) {
if (msg.value.IsInt) {
msg.value.BigIntVal = msg.value.BigIntVal * -1;
}
else {
msg.value.BigDecimalVal = msg.value.BigDecimalVal * -1;
}
}
return msg;
}
}
}
CommandParser::retmsg CommandParser::calculate(BigValue& val1, string& operatorval, BigValue& val2) {
retmsg msg;
if (val1.IsInt && val2.IsInt) {
msg.ok = true;
msg.value.IsInt = true;
if (operatorval == "+") {
msg.value.BigIntVal = val1.BigIntVal + val2.BigIntVal;
}
else if (operatorval == "-") {
msg.value.BigIntVal = val1.BigIntVal - val2.BigIntVal;
}
else if (operatorval == "*") {
msg.value.BigIntVal = val1.BigIntVal * val2.BigIntVal;
}
else if (operatorval == "/") {
msg.value.BigIntVal = val1.BigIntVal / val2.BigIntVal;
}
else if (operatorval == "^") {
msg.value.BigIntVal = val1.BigIntVal.Power(val2.BigIntVal);
}
}
else {
msg.ok = true;
msg.value.IsInt = false;
if (operatorval == "+") {
msg.value.BigDecimalVal = (val1.IsInt ? BigDecimal(val1.BigIntVal) : val1.BigDecimalVal) + (val2.IsInt ? BigDecimal(val2.BigIntVal) : val2.BigDecimalVal);
}
else if (operatorval == "-") {
msg.value.BigDecimalVal = (val1.IsInt ? BigDecimal(val1.BigIntVal) : val1.BigDecimalVal) - (val2.IsInt ? BigDecimal(val2.BigIntVal) : val2.BigDecimalVal);
}
else if (operatorval == "*") {
msg.value.BigDecimalVal = (val1.IsInt ? BigDecimal(val1.BigIntVal) : val1.BigDecimalVal) * (val2.IsInt ? BigDecimal(val2.BigIntVal) : val2.BigDecimalVal);
}
else if (operatorval == "/") {
msg.value.BigDecimalVal = (val1.IsInt ? BigDecimal(val1.BigIntVal) : val1.BigDecimalVal) / (val2.IsInt ? BigDecimal(val2.BigIntVal) : val2.BigDecimalVal);
}
else if (operatorval == "^") {
BigDecimal temp(val2.IsInt ? BigDecimal(val2.BigIntVal) : val2.BigDecimalVal);
if (temp.GetBigIntdown() > 2) {
msg.ok = false;
msg.description = "不支援非0.5倍數的次方";
return msg;
}
msg.value.BigDecimalVal = (val1.IsInt ? BigDecimal(val1.BigIntVal) : val1.BigDecimalVal).Power(temp);
}
}
return msg;
}
CommandParser::retmsg CommandParser::stagecalc(BigValue& val1) {
retmsg msg;
BigValue cp = val1;
if (!cp.IsInt && cp.BigDecimalVal.GetBigIntdown() != 1) {
msg.ok = false;
msg.description = "不支援浮點數階乘運算";
return msg;
}
if (cp.IsInt) {
if (!cp.BigIntVal.Getsign()) {
msg.ok = false;
msg.description = "不支援浮負數階乘運算";
return msg;
}
else if (cp.BigIntVal < 1) {
cp.BigIntVal = 1;
}
for (BigInt i = cp.BigIntVal - 1; i > 1 && keeprun; i -= 1) {
cp.BigIntVal *= i;
}
msg.ok = true;
msg.value = cp;
}
else {
BigInt valup = val1.BigDecimalVal.GetBigIntup();
if (!valup.Getsign()) {
msg.ok = false;
msg.description = "不支援浮負數階乘運算";
return msg;
}
else if (valup < 1) {
valup = 1;
}
for (BigInt i = valup - 1; i > 1 && keeprun; i -= 1) {
valup *= i;
}
cp.BigDecimalVal = valup;
msg.ok = true;
msg.value = cp;
}
return msg;
}
void CommandParser::blankslide(string& cmd, unsigned long long& i) {
while (i < cmd.length() && cmd[i] == ' ') {
i++;
}
}
bool CommandParser::isnumeric(char c) {
if (c > '9' || c < '0') {
return false;
}
return true;
}
bool CommandParser::isalphabetic(char c) {
if (c > 'z' || c < 'a' && c > 'Z' || c < 'A') {
return false;
}
return true;
}
bool CommandParser::isint(string& in) {
for (unsigned long long int i = 0; i < in.length(); i++) {
if (in[i] == '.') {
return false;
}
}
return true;
}
int CommandParser::checkb(string& in, unsigned long long int& i) {
int total = 0;
for (i; i < in.length(); i++) {
if (in[i] == '(') {
total++;
}
else if (in[i] == ')') {
total--;
}
if (total < 0) {
return -1;
}
}
return total != 0;
}
//mode = 0:normal mode = 1:set mode = 2:set specific mode = 3:del
CommandParser::retmsg CommandParser::checkset(string& cmd, unsigned long long int& i) {
retmsg msg, msg2;
msg = getvalue(cmd, i, false);
msg.mode = 0;
if (i < cmd.length()) {
if (msg.varname == "Del") {
msg2 = getvalue(cmd, i, false);
if (msg2.varname != "") {
msg.mode = 3;
msg.varname = msg2.varname;
}
return msg;
}
else if (msg.varname == "Set") {
msg2 = getvalue(cmd, i, false);
if (msg2.varname == "Integer") {
msg.value.IsInt = true;
}
else if (msg2.varname == "Decimal") {
msg.value.IsInt = false;
}
else {
return msg;
}
msg2 = getvalue(cmd, i, false);
blankslide(cmd, i);
if (msg2.varname != "" && i < cmd.length() && cmd[i] == '=') {
i++;
msg.mode = 2;
msg.varname = msg2.varname;
}
return msg;
}
else if (msg.varname != "") {
blankslide(cmd, i);
if (i < cmd.length() && cmd[i] == '=') {
i++;
msg.mode = 1;
}
}
}
return msg;
} | [
"cliffsu@LAPTOP-T8055VUG"
] | cliffsu@LAPTOP-T8055VUG |
e0102365d2dcc854f7be67832bd076cf52e072b6 | 8bb5198fc8fbf6202c963778c621c18042c4cd20 | /lista.h | a7ddceddab66826347b41b1f4231ba2dac2791bf | [
"MIT"
] | permissive | wafto/propositional-logic | 487dc465b6e2a5df490dd68d76e3b9394950f6b0 | f28c9644ab3d05e816402de7a9d2452ec866cb6f | refs/heads/master | 2020-05-05T12:38:48.738274 | 2019-04-07T23:52:54 | 2019-04-07T23:52:54 | 180,038,365 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,055 | h | #ifndef LISTA_H
#define LISTA_H
#include <iostream>
#include <string>
using namespace std;
template <typename T>
class NodoL{
private:
T Info;
NodoL<T> *ApAnt;
NodoL<T> *ApSig;
public:
NodoL();
NodoL(T inf);
T getInfo();
NodoL<T> *getApAnt();
NodoL<T> *getApSig();
void setInfo(T inf);
void setApAnt(NodoL<T> *ApA);
void setApSig(NodoL<T> *ApS);
};
template <typename T>
NodoL<T>::NodoL(){
ApAnt = ApSig = NULL;
};
template <typename T>
NodoL<T>::NodoL(T inf){
Info = inf;
ApAnt = ApSig = NULL;
};
template <typename T>
T NodoL<T>::getInfo(){
return Info;
};
template <typename T>
NodoL<T> *NodoL<T>::getApAnt(){
return ApAnt;
};
template <typename T>
NodoL<T> *NodoL<T>::getApSig(){
return ApSig;
};
template <typename T>
void NodoL<T>::setInfo(T inf){
Info = inf;
};
template <typename T>
void NodoL<T>::setApAnt(NodoL<T> *ApA){
ApAnt = ApA;
};
template <typename T>
void NodoL<T>::setApSig(NodoL<T> *ApS){
ApSig = ApS;
};
template <typename T>
class Lista{
private:
NodoL<T> *ApInicio;
NodoL<T> *ApFin;
int NumElem;
public:
Lista();
bool pushIni(T inf);
bool pushFin(T inf);
bool popIni(T &inf);
bool popFin(T &inf);
bool estaVacia();
int numElem();
bool contiene(T inf);
int iContiene(T inf);
T getInfoAt(int i);
bool operator==(const T &) const;
bool operator!=(const T &) const;
};
template <typename T>
Lista<T>::Lista(){
ApFin = ApInicio = NULL;
NumElem = 0;
};
template <typename T>
bool Lista<T>::pushIni(T inf){
NodoL<T> *Ap = new NodoL<T>;
Ap->setInfo(inf);
if(estaVacia()){
ApFin = ApInicio = Ap; NumElem++;
return true;
}
Ap->setApSig(ApInicio);
Ap->getApSig()->setApAnt(Ap);
ApInicio = Ap;
NumElem++;
return true;
};
template <typename T>
bool Lista<T>::pushFin(T inf){
NodoL<T> *Ap = new NodoL<T>;
Ap->setInfo(inf);
if(estaVacia()){
ApFin = ApInicio = Ap; NumElem++;
return true;
}
Ap->setApAnt(ApFin);
Ap->getApAnt()->setApSig(Ap);
ApFin = Ap;
NumElem++;
return true;
};
template <typename T>
bool Lista<T>::popIni(T &inf){
if(estaVacia()){
inf = NULL;
return false;
}
NodoL<T> *ApAux = new NodoL<T>;
ApAux = ApInicio;
inf = ApAux->getInfo();
if(NumElem!=1){
ApInicio = ApInicio->getApSig();
ApInicio->setApAnt(NULL);
}
if(NumElem==1){
ApInicio = ApFin = NULL;
}
delete ApAux;
NumElem--;
return true;
};
template <typename T>
bool Lista<T>::popFin(T &inf){
if(estaVacia()){
inf = NULL;
return false;
}
NodoL<T> *ApAux = new NodoL<T>;
ApAux = ApFin;
inf = ApAux->getInfo();
if(NumElem!=1){
ApFin = ApFin->getApAnt();
ApFin->setApSig(NULL);
}
if(NumElem==1){
ApInicio = ApFin = NULL;
}
delete ApAux;
NumElem--;
return true;
};
template <typename T>
bool Lista<T>::estaVacia(){
if(ApInicio==NULL && ApFin==NULL) return true;
return false;
};
template <typename T>
int Lista<T>::numElem(){
return NumElem;
};
template <typename T>
bool Lista<T>::contiene(T inf){
T InfoAux = inf;
NodoL<T> *ApAux;
ApAux = ApInicio;
for(int i=0; i<NumElem; i++){
if(ApAux->getInfo()==InfoAux) return true;
ApAux = ApAux->getApSig();
if(ApAux==NULL) break;
};
return false;
};
template <typename T>
int Lista<T>::iContiene(T inf){
T InfoAux = inf;
NodoL<T> *ApAux;
ApAux = ApInicio;
for(int i=0; i<NumElem; i++){
if(ApAux->getInfo()==InfoAux) return i;
ApAux = ApAux->getApSig();
if(ApAux==NULL) break;
};
return -1;
};
template <typename T>
T Lista<T>::getInfoAt(int i){
NodoL<T> *Ap = NULL;
if(i<0 || i>=NumElem) return Ap->getInfo();
int j = 0;
Ap = ApInicio;
while(j!=i){
Ap = Ap->getApSig();
j++;
}
return Ap->getInfo();
};
template <typename T>
bool Lista<T>::operator==(const T &derecha) const{
if(NumElem!=derecha.numElem()) return false;
for(int i=0; i<NumElem; i++){
if(!contiene(derecha.getInfoAt(i))) return false;
}
return true;
};
template <typename T>
bool Lista<T>::operator!=(const T &derecha) const{
if(NumElem!=derecha.numElem()) return true;
for(int i=0; i<NumElem; i++){
if(!contiene(derecha.getInfoAt(i))) return true;
}
return false;
};
#endif
| [
"wafto.mx@gmail.com"
] | wafto.mx@gmail.com |
f3dd7ea2e8c299553406011d7d589fab24dc1bae | 16e130599e881b7c1782ae822f3c52d88eac5892 | /leetcode/findBottomLeftTreeValue/main.cpp | 04d6f747443f2e4fec1f75163dae54c14696172c | [] | no_license | knightzf/review | 9b40221a908d8197a3288ba3774651aa31aef338 | 8c716b13b5bfba7eafc218f29e4f240700ae3707 | refs/heads/master | 2023-04-27T04:43:36.840289 | 2023-04-22T22:15:26 | 2023-04-22T22:15:26 | 10,069,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 647 | cpp | #include "header.h"
class Solution {
public:
int findBottomLeftValue(TreeNode* root) {
int maxDepth = -1;
int value = 0;
inorder(root, maxDepth, value, 0);
return value;
}
void inorder(TreeNode* node, int& maxDepth, int& value, int currDepth)
{
if(node == nullptr) return;
inorder(node->left, maxDepth, value, currDepth + 1);
if(currDepth > maxDepth)
{
maxDepth = currDepth;
value = node->val;
}
inorder(node->right, maxDepth, value, currDepth + 1);
}
};
int main()
{
Solution s;
}
| [
"knightzf@gmail.com"
] | knightzf@gmail.com |
fc77c0d22f36063b51af3111ee7920ae0cbc2e31 | fd53a68dc04d6fcf066ecf0fcc7e747a6fcbd5bf | /util/include/Basler/pylon/cameralink/BaslerCameraLinkConfigurationEventHandler.h | eadeecd7624391032241c5335477a15c1e538541 | [] | no_license | mikihiroikura/CoaXpressCam | fbbecbc08237602ba755fad70b543a5d5cbb1634 | e9603189e60ce0c7aab11f0db53ca99f62fa6986 | refs/heads/master | 2023-05-25T12:18:43.214695 | 2021-05-28T07:11:46 | 2021-05-28T07:11:46 | 280,502,010 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,816 | h | //-----------------------------------------------------------------------------
// Basler pylon SDK
// Copyright (c) 2010-2020 Basler AG
// http://www.baslerweb.com
// Author: Andreas Gau
//-----------------------------------------------------------------------------
/**
\file
\brief Contains the configuration event handler base class.
*/
#ifndef INCLUDED_BASLERCAMERALINKCONFIGURATIONEVENTHANDLER_H_01627755
#define INCLUDED_BASLERCAMERALINKCONFIGURATIONEVENTHANDLER_H_01627755
#include <pylon/stdinclude.h>
#ifdef _MSC_VER
# pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */
#if _MSC_VER
# pragma warning( push)
# pragma warning( disable : 4100) //warning C4100: 'identifier' : unreferenced formal parameter
#endif
namespace Pylon
{
class CBaslerCameraLinkInstantCamera;
/** \addtogroup Pylon_InstantCameraApiCameraLink
* @{
*/
/**
\class CBaslerCameraLinkConfigurationEventHandler
\brief The configuration event handler base class.
*/
class CBaslerCameraLinkConfigurationEventHandler
{
public:
/**
\brief This method is called before a %Pylon Device (Pylon::IPylonDevice) is attached by calling the Instant Camera object's Attach() method.
This method can not be used for detecting that a camera device has been attached to the PC.
The camera's Attach() method must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnAttach( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after a %Pylon Device (Pylon::IPylonDevice) has been attached by calling the Instant Camera object's Attach() method.
This method can not be used for detecting that a camera device has been attached to the PC.
The camera's Attach() method must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnAttached( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before the attached %Pylon Device is detached from the Instant Camera object.
The camera's Detach() method must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnDetach( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after the attached %Pylon Device has been detached from the Instant Camera object.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnDetached( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before the attached %Pylon Device is destroyed.
Camera DestroyDevice must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnDestroy( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after the attached %Pylon Device has been destroyed.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnDestroyed( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before the attached %Pylon Device is opened.
\param[in] camera The source of the call.
\error
Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnOpen( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after the attached %Pylon Device has been opened.
\param[in] camera The source of the call.
\error
Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnOpened( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before the attached %Pylon Device is closed.
Camera Close must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnClose( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after the attached %Pylon Device has been closed.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnClosed( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before a grab session is started.
Camera StartGrabbing must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnGrabStart( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after a grab session has been started.
\param[in] camera The source of the call.
\error
Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnGrabStarted( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called before a grab session is stopped.
Camera StopGrabbing must not be called from here or from subsequent calls to avoid infinite recursion.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnGrabStop( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called after a grab session has been stopped.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnGrabStopped( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called when an exception has been triggered during grabbing.
An exception has been triggered by a grab thread. The grab will be stopped after this event call.
\param[in] camera The source of the call.
\param[in] errorMessage The message of the exception that signaled an error during grabbing.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnGrabError( CBaslerCameraLinkInstantCamera& camera, const char* errorMessage)
{
}
/**
\brief This method is called when a camera device removal from the PC has been detected.
The %Pylon Device attached to the Instant Camera is not operable after this event.
After it is made sure that no access to the %Pylon Device or any of its node maps is made anymore
the %Pylon Device should be destroyed using InstantCamera::DeviceDestroy().
The access to the %Pylon Device can be protected using the lock provided by GetLock(), e.g. when accessing parameters.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored. All event handlers are notified.
\threading
This method is called inside the lock of the camera object from an additional thread.
*/
virtual void OnCameraDeviceRemoved( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called when the configuration event handler has been registered.
\param[in] camera The source of the call.
\error
Exceptions from this call will propagate through.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnConfigurationRegistered( CBaslerCameraLinkInstantCamera& camera)
{
}
/**
\brief This method is called when the configuration event handler has been deregistered.
The configuration event handler is automatically deregistered when the Instant Camera object
is destroyed.
\param[in] camera The source of the call.
\error
C++ exceptions from this call will be caught and ignored.
\threading
This method is called inside the lock of the camera object.
*/
virtual void OnConfigurationDeregistered( CBaslerCameraLinkInstantCamera& camera)
{
}
/*!
\brief Destroys the configuration event handler.
\error
C++ exceptions from this call will be caught and ignored.
*/
virtual void DestroyConfiguration()
{
//If runtime errors occur here during delete, check the following:
//Check that the cleanup procedure is correctly set when registering.
//Ensure that the registered object has been allocated on the heap using new.
//Ensure that the registered object has not already been deleted.
delete this;
}
/// Create.
CBaslerCameraLinkConfigurationEventHandler()
: m_eventHandlerRegistrationCount(0)
{
}
/// Copy.
CBaslerCameraLinkConfigurationEventHandler(const CBaslerCameraLinkConfigurationEventHandler&)
: m_eventHandlerRegistrationCount(0)
{
}
/// Assign.
CBaslerCameraLinkConfigurationEventHandler& operator=(const CBaslerCameraLinkConfigurationEventHandler&)
{
return *this;
}
/// Destruct.
virtual ~CBaslerCameraLinkConfigurationEventHandler()
{
PYLON_ASSERT2( DebugGetEventHandlerRegistrationCount() == 0, "Error: The event handler must not be destroyed while it is registered.");
}
// Internal use only. Subject to change without notice.
const long& DebugGetEventHandlerRegistrationCount()
{
return m_eventHandlerRegistrationCount;
}
private:
long m_eventHandlerRegistrationCount; // Counts how many times the event handler is registered.
};
/**
* @}
*/
}
#if _MSC_VER
# pragma warning( pop)
#endif
#ifdef _MSC_VER
# pragma pack(pop)
#endif /* _MSC_VER */
#endif /* INCLUDED_BASLERCAMERALINKCONFIGURATIONEVENTHANDLER_H_01627755 */
| [
"miki.ut.sikepuri@gmail.com"
] | miki.ut.sikepuri@gmail.com |
34bc96158fe2eba7584d3498af6a8a31def003d3 | f81124e4a52878ceeb3e4b85afca44431ce68af2 | /re20_2/processor38/70/U | 8a65a420c5ac9d159139167bad86c2aa5ff4b3d8 | [] | no_license | chaseguy15/coe-of2 | 7f47a72987638e60fd7491ee1310ee6a153a5c10 | dc09e8d5f172489eaa32610e08e1ee7fc665068c | refs/heads/master | 2023-03-29T16:59:14.421456 | 2021-04-06T23:26:52 | 2021-04-06T23:26:52 | 355,040,336 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 20,612 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "70";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
392
(
(0.314121 -0.00183143 2.98464e-22)
(0.322686 -0.00179404 -2.22962e-22)
(0.331084 -0.00175724 1.54782e-22)
(0.339317 -0.00172106 2.22115e-22)
(0.315559 -0.0054877 3.67843e-22)
(0.324096 -0.00537573 1.38818e-23)
(0.332465 -0.00526552 -9.83238e-22)
(0.34067 -0.00515715 7.2927e-22)
(0.318428 -0.00912431 -1.65709e-21)
(0.326906 -0.0089383 8.63241e-22)
(0.335219 -0.0087552 -4.15982e-23)
(0.343369 -0.00857515 -3.09554e-22)
(0.322711 -0.0127283 9.11965e-22)
(0.331102 -0.0124692 7.02373e-22)
(0.339331 -0.012214 -2.33612e-21)
(0.347399 -0.0119632 -1.1386e-21)
(0.336659 -0.0159559 1.6455e-21)
(0.344777 -0.0156301 -2.11768e-21)
(0.352736 -0.0153096 2.48912e-21)
(0.343546 -0.0193867 1.82622e-21)
(0.351525 -0.0189916 1.64734e-21)
(0.359351 -0.0186029 5.06389e-22)
(0.351723 -0.0227497 3.98195e-21)
(0.359539 -0.0222873 2.97315e-21)
(0.367205 -0.0218323 -7.45513e-21)
(0.361145 -0.026034 -5.35397e-21)
(0.368773 -0.0255064 -2.04939e-22)
(0.376256 -0.0249873 -9.0941e-23)
(0.371759 -0.029229 -4.59931e-22)
(0.379176 -0.0286388 8.47745e-22)
(0.386453 -0.0280579 -7.89612e-21)
(0.383507 -0.032325 5.37214e-21)
(0.390691 -0.0316748 1.00654e-21)
(0.397741 -0.0310349 2.29762e-21)
(0.396324 -0.0353127 2.87178e-22)
(0.403255 -0.0346057 2.19316e-21)
(0.410059 -0.0339096 1.65285e-21)
(0.410143 -0.038184 -3.20652e-22)
(0.416801 -0.0374233 4.40604e-21)
(0.42334 -0.0366742 -3.37106e-22)
(0.42489 -0.0409313 7.48197e-21)
(0.431259 -0.0401204 2.96953e-21)
(0.437517 -0.0393216 -1.44736e-21)
(0.440488 -0.043548 1.59484e-20)
(0.446553 -0.0426906 -6.65777e-21)
(0.452515 -0.0418456 -2.89127e-21)
(0.456859 -0.0460285 9.84012e-23)
(0.462606 -0.0451283 2.91814e-21)
(0.468259 -0.0442408 5.12408e-22)
(0.479339 -0.047429 -8.18086e-21)
(0.484671 -0.0465028 9.21156e-21)
(0.489918 -0.0455901 -8.12079e-21)
(0.49667 -0.0495889 1.81762e-21)
(0.501672 -0.0486278 -6.68424e-22)
(0.506598 -0.0476804 9.12972e-21)
(0.514517 -0.0516055 -3.32517e-21)
(0.519183 -0.0506134 -1.42585e-21)
(0.523781 -0.049635 -7.74016e-21)
(0.532799 -0.053477 -4.48919e-21)
(0.537122 -0.052458 -1.97042e-21)
(0.541387 -0.0514523 6.79065e-21)
(0.551434 -0.055202 5.64312e-21)
(0.555411 -0.05416 -5.5435e-21)
(0.559339 -0.0531309 1.12649e-20)
(0.570342 -0.0567776 9.36553e-21)
(0.57397 -0.0557167 1.39477e-21)
(0.57756 -0.0546682 -1.85099e-20)
(0.592724 -0.0571327 7.60253e-21)
(0.595976 -0.0560685 2.2719e-21)
(0.599196 -0.0550171 -6.14663e-21)
(0.611598 -0.0584369 -8.20052e-21)
(0.614512 -0.0573591 9.39387e-21)
(0.617405 -0.0562935 1.52951e-21)
(0.63052 -0.0596286 -1.7557e-21)
(0.633101 -0.0585399 -8.52405e-21)
(0.635669 -0.0574626 -3.96476e-21)
(0.665491 -0.0613225 0)
(0.667528 -0.0602368 0)
(0.669565 -0.05916 0)
(0.719733 -0.0629676 0)
(0.720929 -0.0618965 0)
(0.722147 -0.0608312 0)
(0.774215 -0.06378 0)
(0.774591 -0.0627457 0)
(0.775011 -0.0617132 0)
(0.82783 -0.0637274 0)
(0.827437 -0.0627525 0)
(0.827106 -0.0617744 0)
(0.87957 -0.0628761 0)
(0.878481 -0.0619794 0)
(0.87747 -0.0610739 -3.4455e-29)
(0.928559 -0.0613236 0)
(0.926868 -0.0605199 0)
(0.925267 -0.0597016 3.4455e-29)
(0.974083 -0.0591803 0)
(0.971897 -0.0584801 0)
(0.969808 -0.0577592 0)
(1.01561 -0.0565676 0)
(1.01304 -0.0559762 0)
(1.01057 -0.0553586 0)
(1.05279 -0.0536099 0)
(1.04995 -0.0531283 0)
(1.04722 -0.0526151 -3.52164e-29)
(1.08546 -0.0504282 0)
(1.08247 -0.0500529 0)
(1.07957 -0.0496415 3.52164e-29)
(1.11364 -0.0471331 0)
(1.11058 -0.0468573 0)
(1.1076 -0.0465417 0)
(1.13747 -0.0438206 0)
(1.13442 -0.0436351 0)
(1.13146 -0.043407 0)
(1.15722 -0.0405692 0)
(1.15426 -0.0404634 0)
(1.15136 -0.0403128 0)
(1.17325 -0.0374389 0)
(1.17041 -0.0374014 0)
(1.16763 -0.0373178 0)
(1.18595 -0.0344715 3.54793e-28)
(1.18328 -0.0344912 0)
(1.18065 -0.0344642 3.57136e-29)
(1.19577 -0.0316924 -3.54793e-28)
(1.19327 -0.031759 0)
(1.19081 -0.0317787 -3.57136e-29)
(1.20312 -0.0291133 0)
(1.2008 -0.0292173 2.71971e-28)
(1.19852 -0.0292748 -1.00328e-27)
(1.20841 -0.0267348 0)
(1.20628 -0.0268681 -2.71971e-28)
(1.20417 -0.0269557 1.00328e-27)
(1.21202 -0.0245495 -1.65336e-29)
(1.21006 -0.0247052 0)
(1.20812 -0.0248161 0)
(1.21429 -0.0225446 1.65336e-29)
(1.21249 -0.0227169 0)
(1.2107 -0.0228457 0)
(1.2155 -0.0207042 0)
(1.21384 -0.0208885 0)
(1.21219 -0.0210305 0)
(1.21589 -0.0190113 0)
(1.21436 -0.0192035 0)
(1.21284 -0.019355 0)
(1.21568 -0.0174487 0)
(1.21426 -0.0176455 0)
(1.21285 -0.0178033 0)
(1.21503 -0.0160002 0)
(1.21371 -0.0161989 0)
(1.2124 -0.0163602 0)
(1.21407 -0.0146511 0)
(1.21284 -0.0148492 -2.65407e-28)
(1.21161 -0.0150118 9.8517e-28)
(1.2129 -0.0133882 0)
(1.21175 -0.0135836 2.65407e-28)
(1.21059 -0.0137453 -9.8517e-28)
(1.21162 -0.0122 0)
(1.21053 -0.0123908 0)
(1.20944 -0.0125498 0)
(1.21028 -0.0110768 0)
(1.20925 -0.0112611 0)
(1.20821 -0.0114157 0)
(1.20894 -0.0100101 0)
(1.20795 -0.0101861 3.501e-28)
(1.20696 -0.0103347 0)
(1.20763 -0.00899245 0)
(1.20668 -0.00915875 -3.501e-28)
(1.20573 -0.00929976 0)
(1.20637 -0.00801765 -6.34787e-28)
(1.20547 -0.00817274 0)
(1.20455 -0.00830478 0)
(1.2052 -0.00708011 6.34787e-28)
(1.20433 -0.00722264 0)
(1.20344 -0.00734442 0)
(1.20413 -0.00617485 0)
(1.20328 -0.00630359 0)
(1.20243 -0.00641393 0)
(1.20317 -0.00529736 0)
(1.20235 -0.00541122 0)
(1.20151 -0.00550905 0)
(1.20233 -0.00444347 0)
(1.20153 -0.00454147 0)
(1.20071 -0.00462587 0)
(1.20163 -0.00360923 0)
(1.20084 -0.00369055 0)
(1.20004 -0.00376071 0)
(1.20105 -0.00279088 0)
(1.20028 -0.00285485 0)
(1.19949 -0.0029101 0)
(1.20062 -0.0019848 0)
(1.19986 -0.00203087 0)
(1.19908 -0.00207071 0)
(1.20033 -0.00118739 -1.55518e-11)
(1.19957 -0.00121519 -1.52954e-11)
(1.1988 -0.00123924 0)
(1.20018 -0.000395207 1.57188e-11)
(1.19943 -0.0004045 1.54597e-11)
(1.19866 -0.000412545 0)
(0.665491 0.0613225 0)
(0.719733 0.0629676 0)
(0.774215 0.06378 0)
(0.82783 0.0637274 0)
(0.87957 0.0628761 0)
(0.928559 0.0613236 0)
(0.974083 0.0591803 0)
(1.01561 0.0565676 0)
(1.05279 0.0536099 3.5365e-28)
(1.08546 0.0504282 -3.5365e-28)
(1.11364 0.0471331 0)
(1.13747 0.0438206 0)
(1.15722 0.0405692 0)
(1.17325 0.0374389 0)
(1.18595 0.0344715 0)
(1.19577 0.0316924 0)
(1.20312 0.0291133 0)
(1.20841 0.0267348 0)
(1.21202 0.0245495 -1.66042e-11)
(1.21429 0.0225446 1.66042e-11)
(1.2155 0.0207042 0)
(1.21589 0.0190113 0)
(1.21568 0.0174487 0)
(1.21503 0.0160002 0)
(1.21407 0.0146511 1.61986e-11)
(1.2129 0.0133882 -1.61986e-11)
(1.21162 0.0122 0)
(1.21028 0.0110768 0)
(1.20894 0.0100101 -1.58581e-29)
(1.20763 0.00899245 1.58581e-29)
(1.20637 0.00801765 0)
(1.2052 0.00708011 0)
(1.20413 0.00617485 0)
(1.20317 0.00529736 0)
(1.20233 0.00444347 0)
(1.20163 0.00360923 0)
(1.20105 0.00279088 0)
(1.20062 0.0019848 0)
(1.20033 0.00118739 -3.11035e-11)
(1.20018 0.000395207 3.14376e-11)
(0.667528 0.0602368 0)
(0.720929 0.0618965 0)
(0.774591 0.0627457 0)
(0.827437 0.0627525 0)
(0.878481 0.0619794 0)
(0.926868 0.0605199 0)
(0.971897 0.0584801 0)
(1.01304 0.0559762 0)
(1.04995 0.0531283 0)
(1.08247 0.0500529 0)
(1.11058 0.0468573 0)
(1.13442 0.0436351 0)
(1.15426 0.0404634 0)
(1.17041 0.0374014 0)
(1.18328 0.0344912 -7.25337e-28)
(1.19327 0.031759 7.25337e-28)
(1.2008 0.0292173 0)
(1.20628 0.0268681 0)
(1.21006 0.0247052 -3.23394e-11)
(1.21249 0.0227169 3.23394e-11)
(1.21384 0.0208885 0)
(1.21436 0.0192035 0)
(1.21426 0.0176455 0)
(1.21371 0.0161989 0)
(1.21284 0.0148492 1.58482e-11)
(1.21175 0.0135836 -1.58482e-11)
(1.21053 0.0123908 0)
(1.20925 0.0112611 0)
(1.20795 0.0101861 0)
(1.20668 0.00915875 0)
(1.20547 0.00817274 0)
(1.20433 0.00722264 0)
(1.20328 0.00630359 0)
(1.20235 0.00541122 0)
(1.20153 0.00454147 2.57313e-28)
(1.20084 0.00369055 -2.57313e-28)
(1.20028 0.00285485 -2.56542e-28)
(1.19986 0.00203087 2.56542e-28)
(1.19957 0.00121519 -1.52954e-11)
(1.19943 0.0004045 1.54597e-11)
(0.669565 0.05916 0)
(0.722147 0.0608312 0)
(0.775011 0.0617132 0)
(0.827106 0.0617744 0)
(0.87747 0.0610739 0)
(0.925267 0.0597016 0)
(0.969808 0.0577592 0)
(1.01057 0.0553586 0)
(1.04722 0.0526151 3.52164e-29)
(1.07957 0.0496415 -3.52164e-29)
(1.1076 0.0465417 9.9726e-28)
(1.13146 0.043407 -9.9726e-28)
(1.15136 0.0403128 0)
(1.16763 0.0373178 0)
(1.18065 0.0344642 0)
(1.19081 0.0317787 0)
(1.19852 0.0292748 0)
(1.20417 0.0269557 0)
(1.20812 0.0248161 -1.57422e-11)
(1.2107 0.0228457 1.57422e-11)
(1.21219 0.0210305 0)
(1.21284 0.019355 0)
(1.21285 0.0178033 0)
(1.2124 0.0163602 0)
(1.21161 0.0150118 3.09975e-11)
(1.21059 0.0137453 -3.09975e-11)
(1.20944 0.0125498 0)
(1.20821 0.0114157 0)
(1.20696 0.0103347 -9.03891e-28)
(1.20573 0.00929976 9.03891e-28)
(1.20455 0.00830478 1.52243e-11)
(1.20344 0.00734442 -1.52243e-11)
(1.20243 0.00641393 0)
(1.20151 0.00550905 0)
(1.20071 0.00462587 -9.59441e-28)
(1.20004 0.00376071 9.59441e-28)
(1.19949 0.0029101 0)
(1.19908 0.00207071 0)
(1.1988 0.00123924 -8.87642e-28)
(1.19866 0.000412545 8.97176e-28)
(0.63052 0.0596286 1.75204e-21)
(0.633101 0.0585399 8.53543e-21)
(0.635669 0.0574626 3.97567e-21)
(0.611598 0.0584369 8.0541e-21)
(0.614512 0.0573591 -9.30537e-21)
(0.617405 0.0562935 -1.34301e-21)
(0.592724 0.0571327 -7.23498e-21)
(0.595976 0.0560685 -1.77317e-21)
(0.599196 0.0550171 5.95141e-21)
(0.570342 0.0567776 3.16975e-21)
(0.57397 0.0557167 -1.42133e-21)
(0.57756 0.0546682 1.78086e-20)
(0.551434 0.055202 -6.2846e-21)
(0.555411 0.05416 5.75468e-21)
(0.559339 0.0531309 -1.06244e-20)
(0.532799 0.053477 5.30307e-21)
(0.537122 0.052458 1.42272e-21)
(0.541387 0.0514523 -7.04198e-21)
(0.514517 0.0516055 1.61336e-21)
(0.519183 0.0506134 1.45834e-21)
(0.523781 0.049635 7.24605e-21)
(0.49667 0.0495889 -9.68734e-22)
(0.501672 0.0486278 3.12078e-22)
(0.506598 0.0476804 -9.81434e-21)
(0.479339 0.047429 7.91655e-21)
(0.484671 0.0465028 -9.54986e-21)
(0.489918 0.0455901 9.01673e-21)
(0.456859 0.0460285 -1.21453e-21)
(0.462606 0.0451283 -1.56804e-21)
(0.468259 0.0442408 1.16098e-21)
(0.440488 0.043548 -1.56657e-20)
(0.446553 0.0426906 6.02244e-21)
(0.452515 0.0418456 1.00445e-21)
(0.42489 0.0409313 -6.21449e-21)
(0.431259 0.0401204 -3.27329e-21)
(0.437517 0.0393216 2.48108e-21)
(0.410143 0.038184 -7.65174e-22)
(0.416801 0.0374233 -4.15715e-21)
(0.42334 0.0366742 8.88407e-22)
(0.396324 0.0353127 1.6363e-22)
(0.403255 0.0346057 -1.33868e-21)
(0.410059 0.0339096 -2.07559e-21)
(0.383507 0.032325 -4.91445e-21)
(0.390691 0.0316748 -2.21595e-21)
(0.397741 0.0310349 -2.19552e-21)
(0.371759 0.029229 6.7997e-22)
(0.379176 0.0286388 -4.58049e-22)
(0.386453 0.0280579 7.71854e-21)
(0.361145 0.026034 4.21055e-21)
(0.368773 0.0255064 -1.26065e-22)
(0.376256 0.0249873 -8.21358e-23)
(0.351723 0.0227497 -3.14144e-21)
(0.359539 0.0222873 -2.74109e-21)
(0.367205 0.0218323 7.72966e-21)
(0.343546 0.0193867 -2.55932e-21)
(0.351525 0.0189916 -1.50273e-21)
(0.359351 0.0186029 -3.35464e-22)
(0.336659 0.0159559 -1.29199e-21)
(0.344777 0.0156301 1.65147e-21)
(0.352736 0.0153096 -3.23983e-21)
(0.322711 0.0127283 -7.01304e-22)
(0.331102 0.0124692 -7.33618e-22)
(0.339331 0.012214 2.73528e-21)
(0.347399 0.0119632 1.30144e-21)
(0.318428 0.00912431 1.39543e-21)
(0.326906 0.0089383 -7.39709e-22)
(0.335219 0.0087552 8.90737e-23)
(0.343369 0.00857515 5.131e-22)
(0.315559 0.0054877 -2.76672e-22)
(0.324096 0.00537573 -5.91949e-23)
(0.332465 0.00526552 8.02724e-22)
(0.34067 0.00515714 -8.07309e-22)
(0.314121 0.00183143 -3.38459e-22)
(0.322686 0.00179404 3.71873e-22)
(0.331084 0.00175724 -1.91622e-22)
(0.339317 0.00172106 -9.88692e-23)
)
;
boundaryField
{
inlet
{
type uniformFixedValue;
uniformValue constant (1 0 0);
value nonuniform 0();
}
outlet
{
type pressureInletOutletVelocity;
value nonuniform 0();
}
cylinder
{
type fixedValue;
value nonuniform 0();
}
top
{
type symmetryPlane;
}
bottom
{
type symmetryPlane;
}
defaultFaces
{
type empty;
}
procBoundary38to37
{
type processor;
value nonuniform List<vector>
134
(
(0.305386 -0.00186936 1.18497e-22)
(0.306854 -0.00560132 -9.67268e-22)
(0.309782 -0.00931305 -3.85993e-22)
(0.314154 -0.0129912 3.51446e-22)
(0.328382 -0.0162869 2.55919e-21)
(0.328382 -0.0162869 2.55919e-21)
(0.33541 -0.0197879 6.42681e-22)
(0.343755 -0.0232193 5.97587e-21)
(0.35337 -0.0265697 -2.86568e-22)
(0.364201 -0.0298282 -4.1687e-21)
(0.376188 -0.0329848 4.51359e-21)
(0.389265 -0.0360301 3.64212e-21)
(0.403364 -0.0389556 -3.42556e-21)
(0.418408 -0.0417535 2.82932e-21)
(0.434319 -0.044417 9.05722e-21)
(0.451017 -0.0469404 2.23272e-21)
(0.473921 -0.048368 -1.36451e-20)
(0.473921 -0.048368 -1.36451e-20)
(0.491591 -0.0505627 1.25512e-20)
(0.509784 -0.05261 -2.30195e-21)
(0.528419 -0.0545082 -6.49746e-21)
(0.54741 -0.0562557 -3.78749e-21)
(0.566676 -0.0578495 -1.08243e-20)
(0.589444 -0.0582087 1.97016e-21)
(0.589444 -0.0582087 1.97016e-21)
(0.608664 -0.0595256 -8.95834e-21)
(0.62793 -0.0607273 -5.9291e-21)
(0.663459 -0.0624154 0)
(0.718564 -0.0640426 0)
(0.773886 -0.0648136 0)
(0.82829 -0.0646962 0)
(0.880741 -0.0637608 0)
(0.930344 -0.062109 0)
(0.976371 -0.059856 0)
(1.01828 -0.0571283 0)
(1.05573 -0.0540555 0)
(1.08856 -0.0507628 0)
(1.11679 -0.0473643 0)
(1.1406 -0.0439585 0)
(1.16026 -0.0406255 0)
(1.17615 -0.0374257 0)
(1.18868 -0.0344005 -3.65583e-28)
(1.19831 -0.0315747 3.65583e-28)
(1.20547 -0.0289587 -6.89935e-28)
(1.21057 -0.0265518 6.89935e-28)
(1.214 -0.0243453 0)
(1.2161 -0.0223252 0)
(1.21716 -0.0204745 -6.78165e-28)
(1.21742 -0.0187754 6.78165e-28)
(1.2171 -0.0172099 0)
(1.21634 -0.0157615 0)
(1.21529 -0.0144149 0)
(1.21405 -0.0131568 0)
(1.21271 -0.0119755 0)
(1.21131 -0.010861 0)
(1.20991 -0.00980472 0)
(1.20856 -0.00879922 0)
(1.20727 -0.00783805 6.46308e-28)
(1.20606 -0.00691553 -6.46308e-28)
(1.20496 -0.00602656 0)
(1.20398 -0.0051665 0)
(1.20312 -0.00433103 0)
(1.20239 -0.00351607 0)
(1.20181 -0.0027177 -6.35786e-28)
(1.20137 -0.00193213 6.35786e-28)
(1.20107 -0.00115563 0)
(1.20092 -0.000384592 0)
(0.663459 0.0624154 0)
(0.718564 0.0640426 0)
(0.773886 0.0648136 0)
(0.82829 0.0646962 0)
(0.880741 0.0637608 0)
(0.930344 0.062109 0)
(0.976371 0.059856 0)
(1.01828 0.0571283 0)
(1.05573 0.0540555 -3.66481e-28)
(1.08856 0.0507628 3.66481e-28)
(1.11679 0.0473643 0)
(1.1406 0.0439585 0)
(1.16026 0.0406255 0)
(1.17615 0.0374257 0)
(1.18868 0.0344005 -1.72863e-11)
(1.19831 0.0315747 1.72863e-11)
(1.20547 0.0289587 1.71815e-11)
(1.21057 0.0265518 -1.71815e-11)
(1.214 0.0243453 0)
(1.2161 0.0223252 0)
(1.21716 0.0204745 1.68884e-11)
(1.21742 0.0187754 -1.68884e-11)
(1.2171 0.0172099 0)
(1.21634 0.0157615 0)
(1.21529 0.0144149 1.65493e-11)
(1.21405 0.0131568 -1.65493e-11)
(1.21271 0.0119755 0)
(1.21131 0.010861 0)
(1.20991 0.00980472 1.61617e-29)
(1.20856 0.00879922 -1.61617e-29)
(1.20727 0.00783805 0)
(1.20606 0.00691553 0)
(1.20496 0.00602656 0)
(1.20398 0.0051665 0)
(1.20312 0.00433103 0)
(1.20239 0.00351607 0)
(1.20181 0.0027177 0)
(1.20137 0.00193213 0)
(1.20107 0.00115563 -1.58025e-11)
(1.20092 0.000384592 1.59722e-11)
(0.62793 0.0607273 5.90809e-21)
(0.608664 0.0595256 9.1954e-21)
(0.589444 0.0582087 -2.18678e-21)
(0.589444 0.0582087 -2.18678e-21)
(0.566676 0.0578495 -7.52708e-22)
(0.54741 0.0562557 3.5889e-21)
(0.528419 0.0545082 5.22876e-21)
(0.509784 0.05261 2.77025e-21)
(0.491591 0.0505627 -1.09915e-20)
(0.473921 0.048368 1.27046e-20)
(0.473921 0.048368 1.27046e-20)
(0.451017 0.0469404 -1.28152e-21)
(0.434319 0.044417 -9.83616e-21)
(0.418408 0.0417535 -3.07184e-21)
(0.403364 0.0389556 4.1651e-21)
(0.389265 0.0360301 -3.18097e-21)
(0.376188 0.0329848 -1.12236e-20)
(0.364201 0.0298282 4.03707e-21)
(0.35337 0.0265697 -4.20825e-22)
(0.343755 0.0232193 -5.10127e-21)
(0.33541 0.0197879 -5.01134e-22)
(0.328382 0.0162869 -2.94189e-21)
(0.328382 0.0162869 -2.94189e-21)
(0.314154 0.0129912 5.08094e-23)
(0.309782 0.00931305 1.30379e-22)
(0.306854 0.00560132 9.97326e-22)
(0.305386 0.00186936 -3.60016e-23)
)
;
}
procBoundary38to39
{
type processor;
value nonuniform List<vector>
132
(
(0.347387 -0.00168552 1.40854e-22)
(0.348714 -0.00505067 -5.25088e-22)
(0.351359 -0.00839825 3.81464e-22)
(0.355309 -0.0117167 -1.20792e-21)
(0.36054 -0.0149946 2.60144e-22)
(0.367024 -0.018221 3.08234e-21)
(0.374724 -0.0213852 -6.05735e-21)
(0.383596 -0.024477 -3.5352e-21)
(0.393593 -0.0274869 -5.47305e-21)
(0.40466 -0.0304056 -1.67189e-21)
(0.416738 -0.0332249 2.25852e-21)
(0.429762 -0.0359372 -1.15077e-21)
(0.443664 -0.0385355 4.70399e-21)
(0.458374 -0.0410137 -6.49254e-22)
(0.473817 -0.0433667 3.3629e-21)
(0.473817 -0.0433667 3.3629e-21)
(0.495079 -0.0446917 -2.78391e-21)
(0.511448 -0.0467473 7.61772e-21)
(0.528311 -0.0486708 -1.82599e-20)
(0.545593 -0.0504608 8.1541e-21)
(0.563218 -0.0521157 1.28944e-20)
(0.58111 -0.0536331 -5.21496e-21)
(0.58111 -0.0536331 -5.21496e-21)
(0.602385 -0.0539795 4.2817e-21)
(0.620275 -0.0552413 7.76603e-21)
(0.638223 -0.056398 -1.17266e-20)
(0.671602 -0.0580937 0)
(0.723385 -0.0597735 0)
(0.77547 -0.0606846 -1.50143e-11)
(0.826832 -0.0607955 -1.51251e-11)
(0.876532 -0.0601625 0)
(0.92375 -0.0588718 0)
(0.967812 -0.0570214 0)
(1.0082 -0.0547185 -1.55577e-11)
(1.04458 -0.0520746 -1.56532e-11)
(1.07675 -0.0491983 1.63959e-28)
(1.10471 -0.0461907 0)
(1.12856 -0.0431405 0)
(1.14853 -0.0401217 -1.59441e-11)
(1.16491 -0.0371924 -1.59907e-11)
(1.17807 -0.0343946 1.67128e-28)
(1.18839 -0.0317555 -1.67128e-28)
(1.19627 -0.0292897 0)
(1.20208 -0.0270011 0)
(1.2062 -0.0248858 0)
(1.20892 -0.0229343 0)
(1.21055 -0.0211335 0)
(1.21133 -0.0194688 0)
(1.21145 -0.0179248 0)
(1.21108 -0.0164869 0)
(1.21038 -0.0151413 0)
(1.20943 -0.0138757 0)
(1.20834 -0.0126793 0)
(1.20717 -0.0115426 0)
(1.20596 -0.0104575 0)
(1.20477 -0.00941705 0)
(1.20363 -0.0084152 0)
(1.20255 -0.00744672 0)
(1.20156 -0.00650697 0)
(1.20067 -0.00559182 0)
(1.19989 -0.00469746 0)
(1.19923 -0.00382035 0)
(1.19869 -0.00295716 0)
(1.19828 -0.00210468 0)
(1.19801 -0.00125978 0)
(1.19788 -0.000419414 0)
(0.671602 0.0580937 0)
(0.723385 0.0597735 0)
(0.77547 0.0606846 7.20024e-28)
(0.826832 0.0607955 -2.98208e-28)
(0.876532 0.0601625 -1.59954e-28)
(0.92375 0.0588718 1.59954e-28)
(0.967812 0.0570214 0)
(1.0082 0.0547185 1.55577e-11)
(1.04458 0.0520746 1.56532e-11)
(1.07675 0.0491983 -1.63959e-28)
(1.10471 0.0461907 1.51658e-11)
(1.12856 0.0431405 -1.51658e-11)
(1.14853 0.0401217 2.15581e-28)
(1.16491 0.0371924 -8.65917e-28)
(1.17807 0.0343946 0)
(1.18839 0.0317555 0)
(1.19627 0.0292897 0)
(1.20208 0.0270011 0)
(1.2062 0.0248858 -1.53219e-11)
(1.20892 0.0229343 1.53219e-11)
(1.21055 0.0211335 0)
(1.21133 0.0194688 0)
(1.21145 0.0179248 0)
(1.21108 0.0164869 0)
(1.21038 0.0151413 1.51508e-11)
(1.20943 0.0138757 -1.51508e-11)
(1.20834 0.0126793 0)
(1.20717 0.0115426 0)
(1.20596 0.0104575 0)
(1.20477 0.00941705 0)
(1.20363 0.0084152 1.49287e-11)
(1.20255 0.00744672 -1.49287e-11)
(1.20156 0.00650697 -3.02906e-28)
(1.20067 0.00559182 3.02906e-28)
(1.19989 0.00469746 0)
(1.19923 0.00382035 0)
(1.19869 0.00295716 0)
(1.19828 0.00210468 0)
(1.19801 0.00125978 0)
(1.19788 0.000419414 0)
(0.638223 0.056398 1.17371e-20)
(0.620275 0.0552413 -7.57041e-21)
(0.602385 0.0539795 -4.25601e-21)
(0.58111 0.0536331 5.2464e-21)
(0.58111 0.0536331 5.2464e-21)
(0.563218 0.0521157 -1.30206e-20)
(0.545593 0.0504608 -8.02233e-21)
(0.528311 0.0486708 1.81164e-20)
(0.511448 0.0467473 -7.86618e-21)
(0.495079 0.0446917 2.81473e-21)
(0.473817 0.0433667 -2.5764e-21)
(0.473817 0.0433667 -2.5764e-21)
(0.458374 0.0410137 6.44395e-23)
(0.443664 0.0385355 -5.2916e-21)
(0.429762 0.0359372 9.69152e-22)
(0.416738 0.0332249 -7.56029e-22)
(0.40466 0.0304056 5.57738e-22)
(0.393593 0.0274869 6.06101e-21)
(0.383596 0.024477 3.14235e-21)
(0.374724 0.0213852 6.25094e-21)
(0.367024 0.018221 -3.27592e-21)
(0.36054 0.0149946 -7.0524e-22)
(0.355309 0.0117167 1.47997e-21)
(0.351359 0.00839825 -1.96057e-22)
(0.348714 0.00505067 4.35269e-22)
(0.347387 0.00168552 -7.56518e-23)
)
;
}
}
// ************************************************************************* //
| [
"chaseh13@login4.stampede2.tacc.utexas.edu"
] | chaseh13@login4.stampede2.tacc.utexas.edu | |
a576ff09c3ab2dc905b6ea4787f65c561bcd0c69 | 67ce8ff142f87980dba3e1338dabe11af50c5366 | /opencv/src/opencv/modules/dnn/src/vkcom/src/common.hpp | 32fb65818a2141d280242902b19d9413c1f645f3 | [
"Apache-2.0"
] | permissive | checksummaster/depthmovie | 794ff1c5a99715df4ea81abd4198e8e4e68cc484 | b0f1c233afdaeaaa5546e793a3e4d34c4977ca10 | refs/heads/master | 2023-04-19T01:45:06.237313 | 2021-04-30T20:34:16 | 2021-04-30T20:34:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,044 | hpp | // This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
#ifndef OPENCV_DNN_VKCOM_COMMON_HPP
#define OPENCV_DNN_VKCOM_COMMON_HPP
#include <math.h>
#include <string.h>
#include <map>
#include <mutex>
#include <thread>
#include <vector>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <memory>
#ifdef HAVE_VULKAN
#include <vulkan/vulkan.h>
#endif
#include "opencv2/core/utils/logger.hpp"
#include "../vulkan/vk_functions.hpp"
#include "../include/vkcom.hpp"
#include "../shader/spv_shader.hpp"
namespace cv { namespace dnn { namespace vkcom {
#ifdef HAVE_VULKAN
extern VkPhysicalDevice kPhysicalDevice;
extern VkDevice kDevice;
extern VkQueue kQueue;
extern VkCommandPool kCmdPool;
extern cv::Mutex kContextMtx;
enum ShapeIdx
{
kShapeIdxBatch = 0,
kShapeIdxChannel,
kShapeIdxHeight,
kShapeIdxWidth,
};
#define VK_CHECK_RESULT(f) \
{ \
if (f != VK_SUCCESS) \
{ \
CV_LOG_ERROR(NULL, "Vulkan check failed, result = " << (int)f); \
CV_Error(Error::StsError, "Vulkan check failed"); \
} \
}
#define VKCOM_CHECK_BOOL_RET_VAL(val, ret) \
{ \
bool res = (val); \
if (!res) \
{ \
CV_LOG_WARNING(NULL, "Check bool failed"); \
return ret; \
} \
}
#define VKCOM_CHECK_POINTER_RET_VOID(p) \
{ \
if (NULL == (p)) \
{ \
CV_LOG_WARNING(NULL, "Check pointer failed"); \
return; \
} \
}
#define VKCOM_CHECK_POINTER_RET_VAL(p, val) \
{ \
if (NULL == (p)) \
{ \
CV_LOG_WARNING(NULL, "Check pointer failed"); \
return (val); \
} \
}
#endif // HAVE_VULKAN
}}} // namespace cv::dnn::vkcom
#endif // OPENCV_DNN_VKCOM_COMMON_HPP
| [
"alex@shimadzu.ca"
] | alex@shimadzu.ca |
2f992c4c30bca936799dcfb858207fec8174ff6a | 5c70f2a27de4b88720947ab0131d3eb09b12128c | /src/startdialog.cpp | b75fd7b56201658d1dcc77e7c43e69b21a77ee4d | [] | no_license | kyawmyolin8898/SorpSim | 87efe5c037300d0690354d39e10ace5614ac39a0 | 4751bf981d01fd8c40e540f62f9ddde001646421 | refs/heads/master | 2022-03-04T19:24:06.609619 | 2017-08-04T19:28:30 | 2017-08-04T19:28:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,129 | cpp | /*startdialog.cpp
* [SorpSim v1.0 source code]
* [developed by Zhiyao Yang and Dr. Ming Qu for ORNL]
* [last updated: 10/12/15]
*
* first dialog to show at SorpSim's launch with new/load tabs
* user can either start a new case (with/without templates), or load a recent case/locate a case file himself
* the name and location of templates (example cases) should match the case files
* called by mainwindow.cpp
*/
#include "startdialog.h"
#include "ui_startdialog.h"
#include <QCloseEvent>
#include <QLayout>
#include "dataComm.h"
#include "mainwindow.h"
extern globalparameter globalpara;
extern MainWindow*theMainwindow;
startDialog::startDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::startDialog)
{
ui->setupUi(this);
setWindowFlags(Qt::Tool);
setWindowModality(Qt::WindowModal);
setWindowTitle(" ");
ui->label->setText("Welcome to SorpSim!");
ui->label->setFont(QFont("Helvetica",10,QFont::Bold));
loadRecentFiles();
QListWidgetItem *item;
QLabel* label;
foreach(QString fileName,globalpara.recentFileList)
{
item = new QListWidgetItem;
label = new QLabel;
QStringList dir = fileName.split("/");
dir.removeLast();
QString name = fileName.split("/").last();
label->setText(name+"\n"+dir.join("/")+"\n");
item->setSizeHint(QSize(0,50));
ui->recentList->addItem(item);
ui->recentList->setItemWidget(item,label);
}
if(ui->recentList->count()>0)
ui->recentList->setCurrentRow(0);
ui->openButton->hide();
ui->importButton->hide();
item = new QListWidgetItem("Blank project");
ui->templateList->addItem(item);
item = new QListWidgetItem("Single-effect LiBr-water chiller");
ui->templateList->addItem(item);
item = new QListWidgetItem("Double-effect LiBr-water chiller");
ui->templateList->addItem(item);
item = new QListWidgetItem("Double-condenser-coupled, triple-effect LiBr-water chiller");
ui->templateList->addItem(item);
item = new QListWidgetItem("Generator-absorber heat exchanger, water-ammonia heat pump");
ui->templateList->addItem(item);
item = new QListWidgetItem("Adiabatic liquid desiccant cycle");
ui->templateList->addItem(item);
item = new QListWidgetItem("Internally cooled/heated liquid desiccant cycle");
ui->templateList->addItem(item);
ui->templateList->setCurrentRow(0);
QLayout *mainLayout = layout();
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
setWindowModality(Qt::ApplicationModal);
}
startDialog::~startDialog()
{
delete ui;
}
void startDialog::closeEvent(QCloseEvent *event)
{
globalpara.startOption="close";
accept();
}
void startDialog::keyPressEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Escape)
{
}
}
void startDialog::focusInEvent(QFocusEvent *e)
{
QDialog::focusInEvent(e);
}
bool startDialog::event(QEvent *e)
{
if(e->type()==QEvent::ActivationChange)
{
if(qApp->activeWindow()==this)
{
theMainwindow->show();
theMainwindow->raise();
this->raise();
this->setFocus();
}
}
return QDialog::event(e);
}
bool startDialog::loadRecentFiles()
{
#ifdef Q_OS_WIN32
QString fileName(QDir(qApp->applicationDirPath()).absolutePath()+"/platforms/systemSetting.xml");
#endif
#ifdef Q_OS_MAC
QDir dir = qApp->applicationDirPath();
QString fileName(dir.absolutePath()+"/templates/systemSetting.xml");
#endif
QFile ofile(fileName);
QDomDocument doc;
if(!ofile.open(QIODevice::ReadOnly|QIODevice::Text))
return false;
else
{
if(!doc.setContent(&ofile))
{
ofile.close();
return false;
}
}
QDomElement recentFiles = doc.elementsByTagName("recentFiles").at(0).toElement();
int fileCount = recentFiles.childNodes().count();
if(fileCount==0)
return false;
else
{
QStringList fileList;
globalpara.recentFileList.clear();
for(int i = 0; i < fileCount;i++)
{
QDomElement currentFile = recentFiles.childNodes().at(fileCount - 1 - i).toElement();
fileList<<currentFile.attribute("fileDir");
fileList.removeDuplicates();
}
foreach(QString fileName,fileList)
globalpara.recentFileList.append(fileName);
return true;
}
}
void startDialog::on_nextButton_clicked()
{
if(ui->tabWidget->currentIndex()==0)//newTab
{
QString newString = ui->templateList->currentItem()->text();
if(newString == "Blank project")
{
globalpara.startOption="new";
accept();
}
else
{
globalpara.startOption="template@@"+newString;
accept();
}
}
else//openTab
{
globalpara.startOption = "recent@@"+globalpara.recentFileList.at(ui->recentList->currentRow());
accept();
}
}
void startDialog::on_openButton_clicked()
{
globalpara.startOption="browse";
accept();
}
void startDialog::on_tabWidget_currentChanged(int index)
{
if(index==0)//new
{
ui->openButton->hide();
ui->nextButton->setEnabled(true);
ui->importButton->hide();
}
else
{
ui->openButton->show();
if(ui->recentList->count()==0)
ui->nextButton->setDisabled(true);
ui->importButton->show();
}
}
void startDialog::on_templateList_doubleClicked(const QModelIndex &index)
{
QString newString = ui->templateList->item(index.row())->text();
if(newString == "Blank project")
{
globalpara.startOption="new";
accept();
}
else
{
globalpara.startOption="template@@"+newString;
accept();
}
}
void startDialog::on_recentList_doubleClicked(const QModelIndex &index)
{
globalpara.startOption = "recent@@"+globalpara.recentFileList.at(index.row());
accept();
}
void startDialog::on_importButton_clicked()
{
globalpara.startOption = "import";
accept();
}
| [
"zyy@ornl.gov"
] | zyy@ornl.gov |
c00104ada906e6a786fc4e7bad21a3c78fce6451 | 4c87ccd0510c74b5e890d979771161f976690409 | /SoPandom/SoPandom4.cpp | 2b586ffd6375c626ebb0875dced34cd8df96b23a | [] | no_license | sturtle333/Beakjoon | 0329b5ee5fb9224217c746fbb69e4a3a8ccc6afc | 9675bfe100b111cdec67f44e6e82124dc259b6e7 | refs/heads/master | 2021-06-28T12:22:55.174672 | 2021-01-29T05:09:38 | 2021-01-29T05:09:38 | 196,697,615 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 380 | cpp | #include <iostream>
using namespace std;
int main () {
int N;
cin>>N;
int S[N][2];
for(int a=0;a<N;a++){
cin>>S[a][0]>>S[a][1];
}
int min = S[0][1];
int max = S[0][0];
for (int a=0;a<N;a++) {
if (S[a][0] >= max)
max=S[a][0];
if (S[a][1] <= min)
min=S[a][1];
}
int result;
if (max < min)
result = 0;
else
result = max - min;
cout<<result;
}
| [
"sturtle333@gmail.com"
] | sturtle333@gmail.com |
30da4322d9f40a8fe2851a8ed10cb71fd1e5fdaf | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /c++/Chaste/2016/12/AbstractIsotropicCompressibleMaterialLaw.cpp | f40ad2155602ca9e4efa03c42dd996f0c6b76420 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | C++ | false | false | 6,179 | cpp | /*
Copyright (c) 2005-2016, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University of Oxford nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AbstractIsotropicCompressibleMaterialLaw.hpp"
template<unsigned DIM>
AbstractIsotropicCompressibleMaterialLaw<DIM>::~AbstractIsotropicCompressibleMaterialLaw()
{
}
template<unsigned DIM>
void AbstractIsotropicCompressibleMaterialLaw<DIM>::ComputeStressAndStressDerivative(c_matrix<double,DIM,DIM>& rC,
c_matrix<double,DIM,DIM>& rInvC,
double pressure,
c_matrix<double,DIM,DIM>& rT,
FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE,
bool computeDTdE)
{
/*
* This is covered, but gcov doesn't see this as being covered
* because it runs at compile time checking templates I think.
*/
assert((DIM==2) || (DIM==3)); // LCOV_EXCL_LINE
assert(pressure==0.0);
static c_matrix<double,DIM,DIM> identity = identity_matrix<double>(DIM);
double I1 = Trace(rC);
double I2 = SecondInvariant(rC);
double I3 = Determinant(rC);
static c_matrix<double,DIM,DIM> dI2dC;
dI2dC = I1*identity - rC; // MUST be on separate line to above!
double w1 = Get_dW_dI1(I1,I2,I3);
double w2 = Get_dW_dI2(I1,I2,I3);
double w3 = Get_dW_dI3(I1,I2,I3);
// Compute stress: **** See FiniteElementImplementations document. ****
//
// T = dW_dE
// = 2 dW_dC
// = 2 ( w1 dI1/dC + w2 dI2/dC + w3 dI3/dC )
// = 2 ( w1 I + w2 (I1*I - C) + w3 I3 inv(C) )
//
// where w1 = dW/dI1, etc
//
rT = 2*w1*identity + 2*w3*I3*rInvC;
if (DIM==3)
{
rT += 2*w2*dI2dC;
}
// Compute stress derivative if required: **** See FiniteElementImplementations document. ****
//
// The stress derivative dT_{MN}/dE_{PQ} is
//
//
// dT_dE = 2 dT_dC
// = 4 d/dC ( w1 I + w2 (I1*I - C) + w3 I3 inv(C) )
// so (in the following ** represents outer product):
// (1/4) dT_dE = w11 I**I + w12 I**(I1*I-C) + w13 I**inv(C)
// + w21 (I1*I-C)**I + w22 (I1*I-C)**(I1*I-C) + w23 (I1*I-C)**inv(C) + w2 (I**I - dC/dC)
// + w31 I3 inv(C)**I + w32 I3 inv(C)**(I1*I-C) + (w33 I3 + w3) inv(C)**inv(C) + w3 d(invC)/dC
//
// Here, I**I represents the tensor A[M][N][P][Q] = (M==N)*(P==Q) // ie delta(M,N)delta(P,Q), etc
//
if (computeDTdE)
{
double w11 = Get_d2W_dI1(I1,I2,I3);
double w22 = Get_d2W_dI2(I1,I2,I3);
double w33 = Get_d2W_dI3(I1,I2,I3);
double w23 = Get_d2W_dI2I3(I1,I2,I3);
double w13 = Get_d2W_dI1I3(I1,I2,I3);
double w12 = Get_d2W_dI1I2(I1,I2,I3);
for (unsigned M=0; M<DIM; M++)
{
for (unsigned N=0; N<DIM; N++)
{
for (unsigned P=0; P<DIM; P++)
{
for (unsigned Q=0; Q<DIM; Q++)
{
rDTdE(M,N,P,Q) = 4 * w11 * (M==N) * (P==Q)
+ 4 * w13 * I3 * ( (M==N) * rInvC(P,Q) + rInvC(M,N)*(P==Q) ) // the w13 and w31 terms
+ 4 * (w33*I3 + w3) * I3 * rInvC(M,N) * rInvC(P,Q)
- 4 * w3 * I3 * rInvC(M,P) * rInvC(Q,N);
if (DIM==3)
{
rDTdE(M,N,P,Q) += 4 * w22 * dI2dC(M,N) * dI2dC(P,Q)
+ 4 * w12 * ((M==N)*dI2dC(P,Q) + (P==Q)*dI2dC(M,N)) // the w12 and w21 terms
+ 4 * w23 * I3 * ( dI2dC(M,N)*rInvC(P,Q) + rInvC(M,N)*dI2dC(P,Q)) // the w23 and w32 terms
+ 4 * w2 * ((M==N)*(P==Q) - (M==P)*(N==Q));
}
}
}
}
}
}
}
// Explicit instantiation
template class AbstractIsotropicCompressibleMaterialLaw<2>;
template class AbstractIsotropicCompressibleMaterialLaw<3>;
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
2f52df206d562f2da4c928f0439323cbd8b6934f | 24cd2a484588987ce976ca3b9e45e5f1da681074 | /src/masternode-payments.cpp | 9daa7d408fac8830c7010471265f44a64bf6f2ef | [
"MIT"
] | permissive | j00v/TensorCoin | 869a2f15e21b714a62830962c0367189161ea717 | 2c9992b3d4c7a06e237b9025cc6fcdd15fb7a0da | refs/heads/master | 2022-08-23T06:27:05.824979 | 2020-05-23T11:56:07 | 2020-05-23T11:56:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 31,186 | cpp | // Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
// Copyright (c) 2019-2020 The TensorCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "masternode-payments.h"
#include "addrman.h"
#include "chainparams.h"
#include "masternode-budget.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "obfuscation.h"
#include "spork.h"
#include "sync.h"
#include "util.h"
#include "utilmoneystr.h"
#include <boost/filesystem.hpp>
/** Object for who's going to get paid on which blocks */
CMasternodePayments masternodePayments;
CCriticalSection cs_vecPayments;
CCriticalSection cs_mapMasternodeBlocks;
CCriticalSection cs_mapMasternodePayeeVotes;
//
// CMasternodePaymentDB
//
CMasternodePaymentDB::CMasternodePaymentDB()
{
pathDB = GetDataDir() / "mnpayments.dat";
strMagicMessage = "MasternodePayments";
}
bool CMasternodePaymentDB::Write(const CMasternodePayments& objToSave)
{
int64_t nStart = GetTimeMillis();
// serialize, checksum data up to that point, then append checksum
CDataStream ssObj(SER_DISK, CLIENT_VERSION);
ssObj << strMagicMessage; // masternode cache file specific magic message
ssObj << FLATDATA(Params().MessageStart()); // network specific magic number
ssObj << objToSave;
uint256 hash = Hash(ssObj.begin(), ssObj.end());
ssObj << hash;
// open output file, and associate with CAutoFile
FILE* file = fopen(pathDB.string().c_str(), "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
if (fileout.IsNull())
return error("%s : Failed to open file %s", __func__, pathDB.string());
// Write and commit header, data
try {
fileout << ssObj;
} catch (std::exception& e) {
return error("%s : Serialize or I/O error - %s", __func__, e.what());
}
fileout.fclose();
LogPrint("masternode","Written info to mnpayments.dat %dms\n", GetTimeMillis() - nStart);
return true;
}
CMasternodePaymentDB::ReadResult CMasternodePaymentDB::Read(CMasternodePayments& objToLoad, bool fDryRun)
{
int64_t nStart = GetTimeMillis();
// open input file, and associate with CAutoFile
FILE* file = fopen(pathDB.string().c_str(), "rb");
CAutoFile filein(file, SER_DISK, CLIENT_VERSION);
if (filein.IsNull()) {
error("%s : Failed to open file %s", __func__, pathDB.string());
return FileError;
}
// use file size to size memory buffer
int fileSize = boost::filesystem::file_size(pathDB);
int dataSize = fileSize - sizeof(uint256);
// Don't try to resize to a negative number if file is small
if (dataSize < 0)
dataSize = 0;
std::vector<unsigned char> vchData;
vchData.resize(dataSize);
uint256 hashIn;
// read data and checksum from file
try {
filein.read((char*)&vchData[0], dataSize);
filein >> hashIn;
} catch (std::exception& e) {
error("%s : Deserialize or I/O error - %s", __func__, e.what());
return HashReadError;
}
filein.fclose();
CDataStream ssObj(vchData, SER_DISK, CLIENT_VERSION);
// verify stored checksum matches input data
uint256 hashTmp = Hash(ssObj.begin(), ssObj.end());
if (hashIn != hashTmp) {
error("%s : Checksum mismatch, data corrupted", __func__);
return IncorrectHash;
}
unsigned char pchMsgTmp[4];
std::string strMagicMessageTmp;
try {
// de-serialize file header (masternode cache file specific magic message) and ..
ssObj >> strMagicMessageTmp;
// ... verify the message matches predefined one
if (strMagicMessage != strMagicMessageTmp) {
error("%s : Invalid masternode payement cache magic message", __func__);
return IncorrectMagicMessage;
}
// de-serialize file header (network specific magic number) and ..
ssObj >> FLATDATA(pchMsgTmp);
// ... verify the network matches ours
if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp))) {
error("%s : Invalid network magic number", __func__);
return IncorrectMagicNumber;
}
// de-serialize data into CMasternodePayments object
ssObj >> objToLoad;
} catch (std::exception& e) {
objToLoad.Clear();
error("%s : Deserialize or I/O error - %s", __func__, e.what());
return IncorrectFormat;
}
LogPrint("masternode","Loaded info from mnpayments.dat %dms\n", GetTimeMillis() - nStart);
LogPrint("masternode"," %s\n", objToLoad.ToString());
if (!fDryRun) {
LogPrint("masternode","Masternode payments manager - cleaning....\n");
objToLoad.CleanPaymentList();
LogPrint("masternode","Masternode payments manager - result:\n");
LogPrint("masternode"," %s\n", objToLoad.ToString());
}
return Ok;
}
void DumpMasternodePayments()
{
int64_t nStart = GetTimeMillis();
CMasternodePaymentDB paymentdb;
CMasternodePayments tempPayments;
LogPrint("masternode","Verifying mnpayments.dat format...\n");
CMasternodePaymentDB::ReadResult readResult = paymentdb.Read(tempPayments, true);
// there was an error and it was not an error on file opening => do not proceed
if (readResult == CMasternodePaymentDB::FileError)
LogPrint("masternode","Missing budgets file - mnpayments.dat, will try to recreate\n");
else if (readResult != CMasternodePaymentDB::Ok) {
LogPrint("masternode","Error reading mnpayments.dat: ");
if (readResult == CMasternodePaymentDB::IncorrectFormat)
LogPrint("masternode","magic is ok but data has invalid format, will try to recreate\n");
else {
LogPrint("masternode","file format is unknown or invalid, please fix it manually\n");
return;
}
}
LogPrint("masternode","Writting info to mnpayments.dat...\n");
paymentdb.Write(masternodePayments);
LogPrint("masternode","Budget dump finished %dms\n", GetTimeMillis() - nStart);
}
bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue, CAmount nMinted)
{
CBlockIndex* pindexPrev = chainActive.Tip();
if (pindexPrev == NULL) return true;
int nHeight = 0;
if (pindexPrev->GetBlockHash() == block.hashPrevBlock) {
nHeight = pindexPrev->nHeight + 1;
} else { //out of order
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
nHeight = (*mi).second->nHeight + 1;
}
if (nHeight == 0) {
LogPrint("masternode","IsBlockValueValid() : WARNING: Couldn't find previous block\n");
}
//LogPrintf("XX69----------> IsBlockValueValid(): nMinted: %d, nExpectedValue: %d\n", FormatMoney(nMinted), FormatMoney(nExpectedValue));
if (!masternodeSync.IsSynced()) { //there is no budget data to use to check anything
//super blocks will always be on these blocks, max 100 per budgeting
if (nHeight % Params().GetBudgetCycleBlocks() < 100) {
return true;
} else {
if (nMinted > nExpectedValue) {
return false;
}
}
} else { // we're synced and have data so check the budget schedule
//are these blocks even enabled
if (!IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
return nMinted <= nExpectedValue;
}
if (budget.IsBudgetPaymentBlock(nHeight)) {
//the value of the block is evaluated in CheckBlock
return true;
} else {
if (nMinted > nExpectedValue) {
return false;
}
}
}
return true;
}
bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
{
TrxValidationStatus transactionStatus = TrxValidationStatus::InValid;
if (!masternodeSync.IsSynced()) { //there is no budget data to use to check anything -- find the longest chain
LogPrint("mnpayments", "Client not synced, skipping block payee checks\n");
return true;
}
const CTransaction& txNew = (nBlockHeight > Params().LAST_POW_BLOCK() ? block.vtx[1] : block.vtx[0]);
//check if it's a budget block
if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
if (budget.IsBudgetPaymentBlock(nBlockHeight)) {
transactionStatus = budget.IsTransactionValid(txNew, nBlockHeight);
if (transactionStatus == TrxValidationStatus::Valid) {
return true;
}
if (transactionStatus == TrxValidationStatus::InValid) {
LogPrint("masternode","Invalid budget payment detected %s\n", txNew.ToString().c_str());
if (IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT))
return false;
LogPrint("masternode","Budget enforcement is disabled, accepting block\n");
}
}
}
// If we end here the transaction was either TrxValidationStatus::InValid and Budget enforcement is disabled, or
// a double budget payment (status = TrxValidationStatus::DoublePayment) was detected, or no/not enough masternode
// votes (status = TrxValidationStatus::VoteThreshold) for a finalized budget were found
// In all cases a masternode will get the payment for this block
//check for masternode payee
if (masternodePayments.IsTransactionValid(txNew, nBlockHeight))
return true;
LogPrint("masternode","Invalid mn payment detected %s\n", txNew.ToString().c_str());
if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))
return false;
LogPrint("masternode","Masternode payment enforcement is disabled, accepting block\n");
return true;
}
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStake, bool fZTNSRStake)
{
CBlockIndex* pindexPrev = chainActive.Tip();
if (!pindexPrev) return;
if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) {
budget.FillBlockPayee(txNew, nFees, fProofOfStake);
} else {
masternodePayments.FillBlockPayee(txNew, nFees, fProofOfStake, fZTNSRStake);
}
}
std::string GetRequiredPaymentsString(int nBlockHeight)
{
if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)) {
return budget.GetRequiredPaymentsString(nBlockHeight);
} else {
return masternodePayments.GetRequiredPaymentsString(nBlockHeight);
}
}
void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool fProofOfStake, bool fZTNSRStake)
{
CBlockIndex* pindexPrev = chainActive.Tip();
if (!pindexPrev) return;
bool hasPayment = true;
CScript payee;
//spork
if (!masternodePayments.GetBlockPayee(pindexPrev->nHeight + 1, payee)) {
//no masternode detected
CMasternode* winningNode = mnodeman.GetCurrentMasterNode(1);
if (winningNode) {
payee = GetScriptForDestination(winningNode->pubKeyCollateralAddress.GetID());
} else {
LogPrint("masternode","CreateNewBlock: Failed to detect masternode to pay\n");
hasPayment = false;
}
}
CAmount blockValue = GetBlockValue(pindexPrev->nHeight);
CAmount masternodePayment = GetMasternodePayment(pindexPrev->nHeight, blockValue, 0, fZTNSRStake);
if (hasPayment) {
if (fProofOfStake) {
/**For Proof Of Stake vout[0] must be null
* Stake reward can be split into many different outputs, so we must
* use vout.size() to align with several different cases.
* An additional output is appended as the masternode payment
*/
unsigned int i = txNew.vout.size();
txNew.vout.resize(i + 1);
txNew.vout[i].scriptPubKey = payee;
txNew.vout[i].nValue = masternodePayment;
//subtract mn payment from the stake reward
if (!txNew.vout[1].IsZerocoinMint())
if (i == 2) {
// Majority of cases; do it quick and move on
txNew.vout[i - 1].nValue -= masternodePayment;
} else if (i > 2) {
// special case, stake is split between (i-1) outputs
unsigned int outputs = i-1;
CAmount mnPaymentSplit = masternodePayment / outputs;
CAmount mnPaymentRemainder = masternodePayment - (mnPaymentSplit * outputs);
for (unsigned int j=1; j<=outputs; j++) {
txNew.vout[j].nValue -= mnPaymentSplit;
}
// in case it's not an even division, take the last bit of dust from the last one
txNew.vout[outputs].nValue -= mnPaymentRemainder;
}
} else {
txNew.vout.resize(2);
txNew.vout[1].scriptPubKey = payee;
txNew.vout[1].nValue = masternodePayment;
txNew.vout[0].nValue = blockValue - masternodePayment;
}
CTxDestination address1;
ExtractDestination(payee, address1);
CBitcoinAddress address2(address1);
LogPrint("masternode","Masternode payment of %s to %s\n", FormatMoney(masternodePayment).c_str(), address2.ToString().c_str());
}
}
int CMasternodePayments::GetMinMasternodePaymentsProto()
{
if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES))
return ActiveProtocol(); // Allow only updated peers
else
return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; // Also allow old peers as long as they are allowed to run
}
void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
{
if (!masternodeSync.IsBlockchainSynced()) return;
if (fLiteMode) return; //disable all Obfuscation/Masternode related functionality
if (strCommand == "mnget") { //Masternode Payments Request Sync
if (fLiteMode) return; //disable all Obfuscation/Masternode related functionality
int nCountNeeded;
vRecv >> nCountNeeded;
pfrom->FulfilledRequest("mnget");
masternodePayments.Sync(pfrom, nCountNeeded);
LogPrint("mnpayments", "mnget - Sent Masternode winners to peer %i\n", pfrom->GetId());
} else if (strCommand == "mnw") { //Masternode Payments Declare Winner
//this is required in litemodef
CMasternodePaymentWinner winner;
vRecv >> winner;
if (pfrom->nVersion < ActiveProtocol()) return;
int nHeight;
{
TRY_LOCK(cs_main, locked);
if (!locked || chainActive.Tip() == NULL) return;
nHeight = chainActive.Tip()->nHeight;
}
if (masternodePayments.mapMasternodePayeeVotes.count(winner.GetHash())) {
LogPrint("mnpayments", "mnw - Already seen - %s bestHeight %d\n", winner.GetHash().ToString().c_str(), nHeight);
masternodeSync.AddedMasternodeWinner(winner.GetHash());
return;
}
int nFirstBlock = nHeight - (mnodeman.CountEnabled() * 1.25);
if (winner.nBlockHeight < nFirstBlock || winner.nBlockHeight > nHeight + 20) {
LogPrint("mnpayments", "mnw - winner out of range - FirstBlock %d Height %d bestHeight %d\n", nFirstBlock, winner.nBlockHeight, nHeight);
return;
}
std::string strError = "";
if (!winner.IsValid(pfrom, strError)) {
// if(strError != "") LogPrint("masternode","mnw - invalid message - %s\n", strError);
return;
}
if (!masternodePayments.CanVote(winner.vinMasternode.prevout, winner.nBlockHeight)) {
// LogPrint("masternode","mnw - masternode already voted - %s\n", winner.vinMasternode.prevout.ToStringShort());
return;
}
if (!winner.SignatureValid()) {
if (masternodeSync.IsSynced()) {
LogPrintf("CMasternodePayments::ProcessMessageMasternodePayments() : mnw - invalid signature\n");
Misbehaving(pfrom->GetId(), 20);
}
// it could just be a non-synced masternode
mnodeman.AskForMN(pfrom, winner.vinMasternode);
return;
}
CTxDestination address1;
ExtractDestination(winner.payee, address1);
CBitcoinAddress address2(address1);
// LogPrint("mnpayments", "mnw - winning vote - Addr %s Height %d bestHeight %d - %s\n", address2.ToString().c_str(), winner.nBlockHeight, nHeight, winner.vinMasternode.prevout.ToStringShort());
if (masternodePayments.AddWinningMasternode(winner)) {
winner.Relay();
masternodeSync.AddedMasternodeWinner(winner.GetHash());
}
}
}
bool CMasternodePaymentWinner::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
{
std::string errorMessage;
std::string strMasterNodeSignMessage;
std::string strMessage = vinMasternode.prevout.ToStringShort() + std::to_string(nBlockHeight) + payee.ToString();
if (!obfuScationSigner.SignMessage(strMessage, errorMessage, vchSig, keyMasternode)) {
LogPrint("masternode","CMasternodePing::Sign() - Error: %s\n", errorMessage.c_str());
return false;
}
if (!obfuScationSigner.VerifyMessage(pubKeyMasternode, vchSig, strMessage, errorMessage)) {
LogPrint("masternode","CMasternodePing::Sign() - Error: %s\n", errorMessage.c_str());
return false;
}
return true;
}
bool CMasternodePayments::GetBlockPayee(int nBlockHeight, CScript& payee)
{
if (mapMasternodeBlocks.count(nBlockHeight)) {
return mapMasternodeBlocks[nBlockHeight].GetPayee(payee);
}
return false;
}
// Is this masternode scheduled to get paid soon?
// -- Only look ahead up to 8 blocks to allow for propagation of the latest 2 winners
bool CMasternodePayments::IsScheduled(CMasternode& mn, int nNotBlockHeight)
{
LOCK(cs_mapMasternodeBlocks);
int nHeight;
{
TRY_LOCK(cs_main, locked);
if (!locked || chainActive.Tip() == NULL) return false;
nHeight = chainActive.Tip()->nHeight;
}
CScript mnpayee;
mnpayee = GetScriptForDestination(mn.pubKeyCollateralAddress.GetID());
CScript payee;
for (int64_t h = nHeight; h <= nHeight + 8; h++) {
if (h == nNotBlockHeight) continue;
if (mapMasternodeBlocks.count(h)) {
if (mapMasternodeBlocks[h].GetPayee(payee)) {
if (mnpayee == payee) {
return true;
}
}
}
}
return false;
}
bool CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerIn)
{
uint256 blockHash = 0;
if (!GetBlockHash(blockHash, winnerIn.nBlockHeight - 100)) {
return false;
}
{
LOCK2(cs_mapMasternodePayeeVotes, cs_mapMasternodeBlocks);
if (mapMasternodePayeeVotes.count(winnerIn.GetHash())) {
return false;
}
mapMasternodePayeeVotes[winnerIn.GetHash()] = winnerIn;
if (!mapMasternodeBlocks.count(winnerIn.nBlockHeight)) {
CMasternodeBlockPayees blockPayees(winnerIn.nBlockHeight);
mapMasternodeBlocks[winnerIn.nBlockHeight] = blockPayees;
}
}
mapMasternodeBlocks[winnerIn.nBlockHeight].AddPayee(winnerIn.payee, 1);
return true;
}
bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)
{
LOCK(cs_vecPayments);
int nMaxSignatures = 0;
int nMasternode_Drift_Count = 0;
std::string strPayeesPossible = "";
CAmount nReward = GetBlockValue(nBlockHeight);
if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
// Get a stable number of masternodes by ignoring newly activated (< 8000 sec old) masternodes
nMasternode_Drift_Count = mnodeman.stable_size() + Params().MasternodeCountDrift();
}
else {
//account for the fact that all peers do not see the same masternode count. A allowance of being off our masternode count is given
//we only need to look at an increased masternode count because as count increases, the reward decreases. This code only checks
//for mnPayment >= required, so it only makes sense to check the max node count allowed.
nMasternode_Drift_Count = mnodeman.size() + Params().MasternodeCountDrift();
}
CAmount requiredMasternodePayment = GetMasternodePayment(nBlockHeight, nReward, nMasternode_Drift_Count, txNew.HasZerocoinSpendInputs());
//require at least 6 signatures
for (CMasternodePayee& payee : vecPayments)
if (payee.nVotes >= nMaxSignatures && payee.nVotes >= MNPAYMENTS_SIGNATURES_REQUIRED)
nMaxSignatures = payee.nVotes;
// if we don't have at least 6 signatures on a payee, approve whichever is the longest chain
if (nMaxSignatures < MNPAYMENTS_SIGNATURES_REQUIRED) return true;
for (CMasternodePayee& payee : vecPayments) {
bool found = false;
for (CTxOut out : txNew.vout) {
if (payee.scriptPubKey == out.scriptPubKey) {
if(out.nValue >= requiredMasternodePayment)
found = true;
else
LogPrint("masternode","Masternode payment is out of drift range. Paid=%s Min=%s\n", FormatMoney(out.nValue).c_str(), FormatMoney(requiredMasternodePayment).c_str());
}
}
if (payee.nVotes >= MNPAYMENTS_SIGNATURES_REQUIRED) {
if (found) return true;
CTxDestination address1;
ExtractDestination(payee.scriptPubKey, address1);
CBitcoinAddress address2(address1);
if (strPayeesPossible == "") {
strPayeesPossible += address2.ToString();
} else {
strPayeesPossible += "," + address2.ToString();
}
}
}
LogPrint("masternode","CMasternodePayments::IsTransactionValid - Missing required payment of %s to %s\n", FormatMoney(requiredMasternodePayment).c_str(), strPayeesPossible.c_str());
return false;
}
std::string CMasternodeBlockPayees::GetRequiredPaymentsString()
{
LOCK(cs_vecPayments);
std::string ret = "Unknown";
for (CMasternodePayee& payee : vecPayments) {
CTxDestination address1;
ExtractDestination(payee.scriptPubKey, address1);
CBitcoinAddress address2(address1);
if (ret != "Unknown") {
ret += ", " + address2.ToString() + ":" + std::to_string(payee.nVotes);
} else {
ret = address2.ToString() + ":" + std::to_string(payee.nVotes);
}
}
return ret;
}
std::string CMasternodePayments::GetRequiredPaymentsString(int nBlockHeight)
{
LOCK(cs_mapMasternodeBlocks);
if (mapMasternodeBlocks.count(nBlockHeight)) {
return mapMasternodeBlocks[nBlockHeight].GetRequiredPaymentsString();
}
return "Unknown";
}
bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, int nBlockHeight)
{
LOCK(cs_mapMasternodeBlocks);
if (mapMasternodeBlocks.count(nBlockHeight)) {
return mapMasternodeBlocks[nBlockHeight].IsTransactionValid(txNew);
}
return true;
}
void CMasternodePayments::CleanPaymentList()
{
LOCK2(cs_mapMasternodePayeeVotes, cs_mapMasternodeBlocks);
int nHeight;
{
TRY_LOCK(cs_main, locked);
if (!locked || chainActive.Tip() == NULL) return;
nHeight = chainActive.Tip()->nHeight;
}
//keep up to five cycles for historical sake
int nLimit = std::max(int(mnodeman.size() * 1.25), 1000);
std::map<uint256, CMasternodePaymentWinner>::iterator it = mapMasternodePayeeVotes.begin();
while (it != mapMasternodePayeeVotes.end()) {
CMasternodePaymentWinner winner = (*it).second;
if (nHeight - winner.nBlockHeight > nLimit) {
LogPrint("mnpayments", "CMasternodePayments::CleanPaymentList - Removing old Masternode payment - block %d\n", winner.nBlockHeight);
masternodeSync.mapSeenSyncMNW.erase((*it).first);
mapMasternodePayeeVotes.erase(it++);
mapMasternodeBlocks.erase(winner.nBlockHeight);
} else {
++it;
}
}
}
bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
{
CMasternode* pmn = mnodeman.Find(vinMasternode);
if (!pmn) {
strError = strprintf("Unknown Masternode %s", vinMasternode.prevout.hash.ToString());
LogPrint("masternode","CMasternodePaymentWinner::IsValid - %s\n", strError);
mnodeman.AskForMN(pnode, vinMasternode);
return false;
}
if (pmn->protocolVersion < ActiveProtocol()) {
strError = strprintf("Masternode protocol too old %d - req %d", pmn->protocolVersion, ActiveProtocol());
LogPrint("masternode","CMasternodePaymentWinner::IsValid - %s\n", strError);
return false;
}
int n = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight - 100, ActiveProtocol());
if (n > MNPAYMENTS_SIGNATURES_TOTAL) {
//It's common to have masternodes mistakenly think they are in the top 10
// We don't want to print all of these messages, or punish them unless they're way off
if (n > MNPAYMENTS_SIGNATURES_TOTAL * 2) {
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL * 2, n);
LogPrint("masternode","CMasternodePaymentWinner::IsValid - %s\n", strError);
//if (masternodeSync.IsSynced()) Misbehaving(pnode->GetId(), 20);
}
return false;
}
return true;
}
bool CMasternodePayments::ProcessBlock(int nBlockHeight)
{
if (!fMasterNode) return false;
//reference node - hybrid mode
int n = mnodeman.GetMasternodeRank(activeMasternode.vin, nBlockHeight - 100, ActiveProtocol());
if (n == -1) {
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Unknown Masternode\n");
return false;
}
if (n > MNPAYMENTS_SIGNATURES_TOTAL) {
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Masternode not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL, n);
return false;
}
if (nBlockHeight <= nLastBlockHeight) return false;
CMasternodePaymentWinner newWinner(activeMasternode.vin);
if (budget.IsBudgetPaymentBlock(nBlockHeight)) {
//is budget payment block -- handled by the budgeting software
} else {
LogPrint("masternode","CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s. \n", nBlockHeight, activeMasternode.vin.prevout.hash.ToString());
// pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
int nCount = 0;
CMasternode* pmn = mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, nCount);
if (pmn != NULL) {
LogPrint("masternode","CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec \n");
newWinner.nBlockHeight = nBlockHeight;
CScript payee = GetScriptForDestination(pmn->pubKeyCollateralAddress.GetID());
newWinner.AddPayee(payee);
CTxDestination address1;
ExtractDestination(payee, address1);
CBitcoinAddress address2(address1);
LogPrint("masternode","CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n", address2.ToString().c_str(), newWinner.nBlockHeight);
} else {
LogPrint("masternode","CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n");
}
}
std::string errorMessage;
CPubKey pubKeyMasternode;
CKey keyMasternode;
if (!obfuScationSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) {
LogPrint("masternode","CMasternodePayments::ProcessBlock() - Error upon calling SetKey: %s\n", errorMessage.c_str());
return false;
}
LogPrint("masternode","CMasternodePayments::ProcessBlock() - Signing Winner\n");
if (newWinner.Sign(keyMasternode, pubKeyMasternode)) {
LogPrint("masternode","CMasternodePayments::ProcessBlock() - AddWinningMasternode\n");
if (AddWinningMasternode(newWinner)) {
newWinner.Relay();
nLastBlockHeight = nBlockHeight;
return true;
}
}
return false;
}
void CMasternodePaymentWinner::Relay()
{
CInv inv(MSG_MASTERNODE_WINNER, GetHash());
RelayInv(inv);
}
bool CMasternodePaymentWinner::SignatureValid()
{
CMasternode* pmn = mnodeman.Find(vinMasternode);
if (pmn != NULL) {
std::string strMessage = vinMasternode.prevout.ToStringShort() + std::to_string(nBlockHeight) + payee.ToString();
std::string errorMessage = "";
if (!obfuScationSigner.VerifyMessage(pmn->pubKeyMasternode, vchSig, strMessage, errorMessage)) {
return error("CMasternodePaymentWinner::SignatureValid() - Got bad Masternode address signature %s\n", vinMasternode.prevout.hash.ToString());
}
return true;
}
return false;
}
void CMasternodePayments::Sync(CNode* node, int nCountNeeded)
{
LOCK(cs_mapMasternodePayeeVotes);
int nHeight;
{
TRY_LOCK(cs_main, locked);
if (!locked || chainActive.Tip() == NULL) return;
nHeight = chainActive.Tip()->nHeight;
}
int nCount = (mnodeman.CountEnabled() * 1.25);
if (nCountNeeded > nCount) nCountNeeded = nCount;
int nInvCount = 0;
std::map<uint256, CMasternodePaymentWinner>::iterator it = mapMasternodePayeeVotes.begin();
while (it != mapMasternodePayeeVotes.end()) {
CMasternodePaymentWinner winner = (*it).second;
if (winner.nBlockHeight >= nHeight - nCountNeeded && winner.nBlockHeight <= nHeight + 20) {
node->PushInventory(CInv(MSG_MASTERNODE_WINNER, winner.GetHash()));
nInvCount++;
}
++it;
}
node->PushMessage("ssc", MASTERNODE_SYNC_MNW, nInvCount);
}
std::string CMasternodePayments::ToString() const
{
std::ostringstream info;
info << "Votes: " << (int)mapMasternodePayeeVotes.size() << ", Blocks: " << (int)mapMasternodeBlocks.size();
return info.str();
}
int CMasternodePayments::GetOldestBlock()
{
LOCK(cs_mapMasternodeBlocks);
int nOldestBlock = std::numeric_limits<int>::max();
std::map<int, CMasternodeBlockPayees>::iterator it = mapMasternodeBlocks.begin();
while (it != mapMasternodeBlocks.end()) {
if ((*it).first < nOldestBlock) {
nOldestBlock = (*it).first;
}
it++;
}
return nOldestBlock;
}
int CMasternodePayments::GetNewestBlock()
{
LOCK(cs_mapMasternodeBlocks);
int nNewestBlock = 0;
std::map<int, CMasternodeBlockPayees>::iterator it = mapMasternodeBlocks.begin();
while (it != mapMasternodeBlocks.end()) {
if ((*it).first > nNewestBlock) {
nNewestBlock = (*it).first;
}
it++;
}
return nNewestBlock;
}
| [
"ericsoncrypto87@gmail.com"
] | ericsoncrypto87@gmail.com |
ad6e4f548f4e7dcf4f143dc1e56dd35a15591d04 | 853c7b9939fb7d2b2d3ce764597efb743644b3e9 | /Prg8/main.cpp | 6899c41399383edb6978bb5bd75f73ac5266aaa4 | [] | no_license | MRoblesManzanares/Periodo2Progra2 | c63126755197bee45a3f7acef04aa58e29334653 | 8d83a96645554145ec6955789feccee1b13cfc97 | refs/heads/master | 2016-09-05T13:29:34.571689 | 2014-06-11T04:57:17 | 2014-06-11T04:57:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 678 | cpp | #include <iostream>
using namespace std;
//esttructura de repeticion ingresar 5 numeros y presentar el final del ciclo de la suma de los numeros ingresados.
int main()
{
int num,suma,promedio;
int mayor50=0;
int suma2;
int c=0;
suma=0;
suma2=0;
while (c<5)
{
cout<<"\n Ingresar un numero\n";
cin>>num;
if(num>50)
{
mayor50++;
suma2=suma2+num;
}
c++;//c=c+1
suma=suma+num;
}
cout<<"\nLa suma de los numeros son:"<<suma;
cout<<"\nLos numeros mayores a 50 son:"<<mayor50;
cout<<"\nLos suma de los numeros mayores a 50 son:"<<suma2;
}
| [
"Marvin_robles@unitec.edu"
] | Marvin_robles@unitec.edu |
314bcf7a27840c37050a661359eff2107bcf9308 | 48c13a4cd7e959a8343ba0a5e57ac0d9dfa1a855 | /Shared_Source/[1260]DFS와BFS.cpp | 8d48534aff1871a04a9558bb557d15da35b68f96 | [] | no_license | hanwoolsky/Baekjoon | d9d942d8cde39cece067eb09fb7cbde5a710cf7a | f2d20f530f07b3b6a3a4bd3331bb1603e524dbeb | refs/heads/main | 2023-08-06T01:44:00.632424 | 2023-07-23T14:07:18 | 2023-07-23T14:07:18 | 336,282,571 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,283 | cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define MAX_N 1000
int N, M, S;
vector<int> vDfs, vBfs;
bool visited[MAX_N + 1];
vector<int> adjs[MAX_N + 1];
void dfs(const int& cur) {
visited[cur] = true;
vDfs.push_back(cur);
for (int i = 0; i < adjs[cur].size(); ++i) {
if (!visited[adjs[cur][i]]) dfs(adjs[cur][i]);
}
}
void bfs() {
queue<int> que;
que.push(S);
visited[S] = true;
int cur, i;
while (!que.empty()) {
cur = que.front(), que.pop();
vBfs.push_back(cur);
for (i = 0; i < adjs[cur].size(); ++i) {
if (!visited[adjs[cur][i]]) visited[adjs[cur][i]] = true, que.push(adjs[cur][i]);
}
}
}
int main() {
int i, j;
scanf("%d %d %d", &N, &M, &S);
while (M--) {
scanf("%d %d", &i, &j);
adjs[i].push_back(j);
adjs[j].push_back(i);
}
for (i = 1; i <= N; ++i) {
if (adjs[i].size() > 0) sort(adjs[i].begin(), adjs[i].end());
visited[i] = false;
}
dfs(S);
for (i = 1; i <= N; ++i) visited[i] = false;
bfs();
printf("%d", S);
for (i = 1; i < vDfs.size(); ++i) printf(" %d", vDfs[i]);
printf("\n");
printf("%d", S);
for (i = 1; i < vBfs.size(); ++i) printf(" %d", vBfs[i]);
printf("\n");
return 0;
} | [
"hhw0925@naver.com"
] | hhw0925@naver.com |
64fb6167ec44cd7b5eb9fbc2959cf7e7bc75ead5 | d3d66efc3aaff0e1da805b7da707d609b3edcb40 | /Software/LED Display/src/power/Math3D.cpp | b849d7b495d296b756264cf366ddc24c101c07ec | [] | no_license | dotted/Mega-Cube | 0dc739a13ddd85a24915af6820222f1c88e27ea5 | 28290d8baa25a8eb5e683d6bf2586a2eb9c7b5cb | refs/heads/master | 2023-09-02T00:11:32.299513 | 2021-11-19T13:27:32 | 2021-11-19T13:27:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,697 | cpp | #include "Math3D.h"
#include <math.h>
#include <stdint.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
/*------------------------------------------------------------------------------
* Vector3 CLASS
*----------------------------------------------------------------------------*/
Vector3::Vector3() : x(0.0f), y(0.0f), z(0.0f){};
Vector3::Vector3(float x_, float y_, float z_) : x(x_), y(y_), z(z_){};
Vector3::Vector3(const Vector3& v) : x(v.x), y(v.y), z(v.z){};
// add, subtract (operator +, -, +=, -=)
Vector3 Vector3::operator+(const Vector3& v) const {
return Vector3(x + v.x, y + v.y, z + v.z);
}
Vector3 Vector3::operator-(const Vector3& v) const {
return Vector3(x - v.x, y - v.y, z - v.z);
}
Vector3& Vector3::operator+=(const Vector3& v) {
x += v.x;
y += v.y;
z += v.z;
return *this;
}
Vector3& Vector3::operator-=(const Vector3& v) {
x -= v.x;
y -= v.y;
z -= v.z;
return *this;
}
// negative (operator -)
Vector3 Vector3::operator-() const { return Vector3(-x, -y, -z); }
// multiply, divide by scalar (operator *, /, *=, /=)
Vector3 Vector3::operator*(float s) const {
return Vector3(x * s, y * s, z * s);
}
Vector3 Vector3::operator/(float s) const {
return Vector3(x / s, y / s, z / s);
}
Vector3& Vector3::operator*=(float s) {
x *= s;
y *= s;
z *= s;
return *this;
}
Vector3& Vector3::operator/=(float s) {
x /= s;
y /= s;
z /= s;
return *this;
}
// cross product (operator *, *=)
Vector3 Vector3::cross(const Vector3& v) const {
return Vector3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
}
Vector3 Vector3::operator*(const Vector3& v) const { return cross(v); }
Vector3& Vector3::operator*=(const Vector3& v) { return *this = cross(v); }
// dot product (operator %)
float Vector3::dot(const Vector3& v) const {
return x * v.x + y * v.y + z * v.z;
}
float Vector3::operator%(const Vector3& v) const { return dot(v); }
// normalize
Vector3& Vector3::normalize() { return *this /= magnitude(); }
Vector3 Vector3::normalized() const { return *this / magnitude(); }
// magnitude
float Vector3::magnitude() const { return sqrt(norm()); }
float Vector3::norm() const { return x * x + y * y + z * z; }
// rotate v by an angle and this vector holding an axis using Rodrigues formula
Vector3 Vector3::rotate(float angle, const Vector3& v) const {
// Angle is in degree and is converted to radian by multiplying by 2PI/360
float c = cosf(2 * M_PI / 360 * angle);
float s = sinf(2 * M_PI / 360 * angle);
// normalize this vector to get n hat
Vector3 n = normalized();
// (1-cos(0))(v.n)n + cos(0)v + sin(0)(n x v)
return n * v.dot(n) * (1 - c) + v * c + n.cross(v) * s;
}
// Test if this vector (point) is within a spherical radius of v inclusive
bool Vector3::inside(const Vector3& v, float radius) const {
return ((v.x - x) * (v.x - x) + (v.y - y) * (v.y - y) +
(v.z - z) * (v.z - z) <=
radius * radius);
}
// Test if this vector (point) is inside a box, low inclusive, high exclusive
bool Vector3::inside(const Vector3& l, const Vector3& h) const {
return (x < h.x && x >= l.x) && (y < h.y && y >= l.y) &&
(z < h.z && z >= l.z);
}
/*------------------------------------------------------------------------------
* Quaternion CLASS
*----------------------------------------------------------------------------*/
Quaternion::Quaternion() : w(0.0f), v(Vector3(0.0, 0.0, 0.0)) {}
Quaternion::Quaternion(const Quaternion& q) : w(q.w), v(q.v) {}
// Make a unit quaternion from an axis as a vector and an angle
// Theoretically the magnitude of v_ can be used to specify the rotation
// Using an angle makes things more convenient
Quaternion::Quaternion(float a, const Vector3& v_) {
// normalize v to get n hat (unit vector with length = 1)
Vector3 n = v_.normalized();
// Angle is in degree and is converted to radian by 2PI/360 * angle
// Angles are divided by 2 when using quaternions so back to PI/360
a = a * M_PI / 360;
// Multiply n hat by sin(0) (scale n, but no directional change)
// So v still represents the axis of rotation, but changed magnitude
v = n * sinf(a);
// Store cos(0) in the scalar part of the quaternion, results in a
// unit quaternion => w^2+x^2+y^2+z^2=1, since sin(x)^2+cos(x)^2=1
// Magnitude is always one. To stack rotations multiply unit
// quaternions together and keep magnitude 1. So multiple rotations
// without changing size of an object
w = cosf(a);
}
// add, subtract (operator +, -, +=, -=)
Quaternion Quaternion::operator+(const Quaternion& q) const {
return Quaternion(w + q.w, v + q.v);
}
Quaternion Quaternion::operator-(const Quaternion& q) const {
return Quaternion(w - q.w, v - q.v);
}
Quaternion& Quaternion::operator+=(const Quaternion& q) {
w += q.w;
v += q.v;
return *this;
}
Quaternion& Quaternion::operator-=(const Quaternion& q) {
w -= q.w;
v -= q.v;
return *this;
}
// multiply, divide by scalar (operator *, /, *=, /=)
Quaternion Quaternion::operator*(float s) const {
return Quaternion(w * s, v * s);
}
Quaternion Quaternion::operator/(float s) const {
return Quaternion(w / s, v / s);
}
Quaternion& Quaternion::operator*=(float s) {
w *= s;
v *= s;
return *this;
}
Quaternion& Quaternion::operator/=(float s) {
w /= s;
v /= s;
return *this;
}
// multiply quaternions (operator *, /, *=)
Quaternion Quaternion::operator*(const Quaternion& q) const {
Quaternion r;
r.w = w * q.w - v.dot(q.v);
r.v = v * q.w + q.v * w + v.cross(q.v);
return r;
}
Quaternion Quaternion::operator/(const Quaternion& q) const {
return *this * q.inversed();
}
Quaternion& Quaternion::operator*=(const Quaternion& q) {
return *this = operator*(q);
}
// dot product (operator %)
float Quaternion::dot(const Quaternion& q) const {
return w * q.w + v.dot(q.v);
}
float Quaternion::operator%(const Quaternion& q) const { return dot(q); }
// inverse
Quaternion& Quaternion::inverse() {
conjugate();
return *this *= 1 / norm();
}
Quaternion Quaternion::inversed() const { return conjugated() * (1 / norm()); }
// conjugate
Quaternion& Quaternion::conjugate() {
v = -v;
return *this;
}
Quaternion Quaternion::conjugated() const { return Quaternion(w, -v); }
// normalize
Quaternion& Quaternion::normalize() { return *this /= magnitude(); }
Quaternion Quaternion::normalized() const { return *this / magnitude(); }
// magnitude
float Quaternion::magnitude() const { return sqrt(norm()); }
float Quaternion::norm() const { return w * w + v.dot(v); }
// rotate v_ by this quaternion holding an angle and axis
Vector3 Quaternion::rotate(const Vector3& v_) const {
Vector3 vcv_ = v.cross(v_);
return v_ + vcv_ * (2 * w) + v.cross(vcv_) * 2;
} | [
"MaltWhiskey@outlook.com"
] | MaltWhiskey@outlook.com |
1d4f1bb785638a4f728d3f8021dd1b78d5811866 | d44f16b5d5d440dc35bb531172cd6e908a49fc8c | /proyecto/gui/main.cpp | 2ef21d98da4adc98a937113cf2120f85c1126b8d | [] | no_license | camicapde97/proyecto_info | 3ef5a9ee08d79cb547eca703d7a5742b3afaa82e | ca557d664bc50d142febc8cc6e575df3e4659612 | refs/heads/master | 2023-01-10T11:19:20.500431 | 2020-11-14T19:23:43 | 2020-11-14T19:23:43 | 310,912,174 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | cpp | #include <QApplication>
#include "../ui_interfazgrafica.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
MainWindow main_win;
main_win.setupUi(&app);
main_win.show();
return app.exec();
}
| [
"capdevilacamila1@gmail.com"
] | capdevilacamila1@gmail.com |
c80e171a2f990555a586285fee82607c655058a8 | 82748e3bc3b3fd72056b8de4ec5104780dea2b90 | /MergeSort.cpp | 2233999c2ac4e0ada8c37675e2c7378caae806cc | [] | no_license | meghnaraswan/CPSC350Assignment6 | 3c9594c96ad7a1dd908998d1110052cae6f93040 | a5eb5623c88276469f1e865486d86a5bc4fcf9de | refs/heads/master | 2023-02-01T19:47:59.717401 | 2020-12-19T18:33:24 | 2020-12-19T18:33:24 | 322,763,295 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,382 | cpp | #include <stdio.h>
#include <string>
#include <iostream>
#include "MergeSort.hpp"
using namespace std;
//delault constructor
Merge::Merge(){
size = 0;
l = 0;
m = 0;
r = 0;
}
//overloaded constructor
Merge::Merge(int s, int left, int middle, int right){
size = s;
l = left;
m = middle;
r = right;
}
//destructor
Merge::~Merge(){
}
//merge will merge the 2 subarrays
void Merge::merge(double numbers[], int l, int m, int r) {
int n1 = m - l + 1; //left partition size
int n2 = r - m; //right partition size
double L[n1], R[n2]; //temp arrays
for (int i = 0; i < n1; i++)
L[i] = numbers[l + i]; //copy temp array into first subarray from the left most index all the way to the middle index
for (int j = 0; j < n2; j++)
R[j] = numbers[m + 1 + j]; //copy temp array into second subarray from the middle index all the way to the last index
int i = 0; //initial index of first subarray
int j = 0; //initial index of second subarray
int k = l; //initial index of merged subarray
while (i < n1 && j < n2) { //while looping through the entire 2 subarrays
if (L[i] <= R[j]) { //if left subarray's index is less than or equal to right subarray's index
numbers[k] = L[i]; //overall array will include the lowest value
i++;
}
else {
numbers[k] = R[j]; //overall array will include the lowest value
j++;
}
k++;
}
while (i < n1) { //copy the remaining elements into numbers[] from L[]
numbers[k] = L[i];
i++;
k++;
}
while (j < n2) { //copy the remaining elements into numbers[] from R[]
numbers[k] = R[j];
j++;
k++;
}
}
//MergeSort will recusively merge the left and right partitions
void Merge::MergeSort(double numbers[],int l,int r) {
if(l >= r){
return; //returns recursively
}
int m = (l + r - 1) / 2; // Find the midpoint in the partition
MergeSort(numbers, l, m); //recursively sort left partition
MergeSort(numbers, m + 1, r); //recursively sort right partition
merge(numbers, l, m, r); //merge left and right partitions in sorted fashion
}
//printArray prints array
void Merge::printArray(double numbers[], int size)
{
for (int i = 0; i < size; i++)
cout << numbers[i] << " ";
cout << endl;
}
| [
"raswan@chapman.edu"
] | raswan@chapman.edu |
8b3d856d0bdabeb089fd9e13b137ebd416b05fe8 | 557e6ba0de1994b4e85819de84ac57e151dcc321 | /LightPainter/Source/LightPainter/PaintBrushHandController.h | 2b4295cef8b1b90b91d4444c64d0d12d47d4aef2 | [] | no_license | thbach/ue4-vr-playground | c44a60c2f20e37b482c39c733d2c7948556a0049 | 03160ba35d46025a830b07f71e0767a765cb2dba | refs/heads/master | 2022-11-07T08:41:27.376263 | 2020-06-17T09:00:45 | 2020-06-17T09:00:45 | 270,203,419 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 638 | h | // Copyright TB 2020
#pragma once
#include "CoreMinimal.h"
#include "Stroke.h"
#include "HandControllerBase.h"
#include "PaintBrushHandController.generated.h"
UCLASS()
class LIGHTPAINTER_API APaintBrushHandController : public AHandControllerBase
{
GENERATED_BODY()
public:
APaintBrushHandController();
void TriggerPressed() override;
void TriggerReleased() override;
protected:
virtual void BeginPlay() override;
public:
virtual void Tick(float DeltaTime) override;
private:
// Config
UPROPERTY(EditAnywhere)
TSubclassOf<AStroke> StrokeClass;
// Components
// State
AStroke* CurrentStroke;
// functions
};
| [
"thbach@gmail.com"
] | thbach@gmail.com |
79fc8c36dd7cd60ee8357a454240550b4c0858b7 | 2d1643b70b80608671248d13c4707b93e71d1e7f | /Hamming code/Hamming.h | 31f6d24c8925b9d530ca7cd07315e63e31ccfdfd | [] | no_license | BaranovMykola/C-Projects | 947521a7356f8c61a72c71c9e0a6175fae72046e | 5b7bfbc7c0a0f7820b9f6101a8f126765d442c7b | refs/heads/master | 2020-12-03T08:11:45.610412 | 2017-06-28T12:23:53 | 2017-06-28T12:23:53 | 95,665,717 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,352 | h | #pragma once
#include <fstream>
#include <vector>
#include <iomanip>
using std::ostream;
using std::istream;
const int matrix[7] = { 1,2,3,4,5,6,7 };
const int dataOrder[4] = { 3,5,6,7 };
const int checkOrder[4] = { 1,2,4,8 };
const int extendedMatrix[8] = { 9,10,11,12,13,14,15,8 };
class Hamming
{
protected:
unsigned short int code;//no much than 64
public:
Hamming(const unsigned short int = 0);
Hamming(const char*);
~Hamming();
friend ostream& operator<<(ostream&, const Hamming&);
friend istream & operator>>(istream&, Hamming&);
friend unsigned int _btoi(const char*);
const bool* get_p(const int)const;
void get_code(const bool*, int);
void set_code(const unsigned short int);
char* decode()const;
void repair();
unsigned short int get_error()const;
void change_bit(unsigned short int, const unsigned short int = 6);// _k - max index of code. Index of lastest bit;
void format_error(short int&)const;
};
class Hamming8 : public Hamming
{
public:
Hamming8(const unsigned short int = 0);
Hamming8(const char*);
~Hamming8();
friend ostream& operator<<(ostream&, const Hamming8&);
friend istream& operator>>(istream&, Hamming8&);
void get_p8();
char* decode();
unsigned short int get_error()const;
void repair();
void format_error(short int&)const;
friend bool test_decode8();
void change_bit(unsigned short int);
}; | [
"mapsg32@gmail.com"
] | mapsg32@gmail.com |
2a5c01ef5e6e58e88e4f79a39aa74c52b6ecd83e | b494c362dd9a3c2ea0629c4e9bb841c1bdd05b6e | /SDK/SCUM_BreathingBarLungsWIdget_parameters.hpp | 2551c92c570f527f164022d155c677ab571dbbcd | [] | no_license | a-ahmed/SCUM_SDK | 6b55076b4aeb5973c4a1a3770c470fccce898100 | cd5e5089507a638f130cc95a003e0000918a1ec7 | refs/heads/master | 2022-05-20T17:28:10.940288 | 2020-04-03T18:48:52 | 2020-04-03T18:48:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,214 | hpp | #pragma once
// SCUM (Dumped by Hinnie) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function BreathingBarLungsWIdget.BreathingBarLungsWidget_C.GetCriticalLungsAnimation
struct UBreathingBarLungsWidget_C_GetCriticalLungsAnimation_Params
{
class UWidgetAnimation* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData)
};
// Function BreathingBarLungsWIdget.BreathingBarLungsWidget_C.Construct
struct UBreathingBarLungsWidget_C_Construct_Params
{
};
// Function BreathingBarLungsWIdget.BreathingBarLungsWidget_C.ExecuteUbergraph_BreathingBarLungsWidget
struct UBreathingBarLungsWidget_C_ExecuteUbergraph_BreathingBarLungsWidget_Params
{
int EntryPoint; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"hsibma02@gmail.com"
] | hsibma02@gmail.com |
ab54626c4e33c4136d1686f4c2179e1fe08da617 | c202deddfc88af90de949730d4deebfc5b647f8c | /src/lib/elf/ElfMemory.cpp | 283fd81dd90a7ca2babf9842dbbc62efd4c2ceb6 | [] | no_license | parsa/iato | 11523df0aa73290c3eb70129b25e4e9d1c3f95bf | 28d75c28fa96be6aad43d07b9f8e1ca1d42192dd | refs/heads/master | 2020-04-26T16:34:05.303929 | 2019-03-06T20:46:33 | 2019-03-06T20:46:33 | 173,683,631 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,010 | cpp | // ---------------------------------------------------------------------------
// - ElfMemory.cpp -
// - iato:elf library - elf base memory class implementation -
// ---------------------------------------------------------------------------
// - (c) inria 2002-2004 -
// ---------------------------------------------------------------------------
// - authors Amaury Darsch 2002:2004 -
// - Pierre Villalon 2002:2003 -
// - Andre Seznec 2002:2004 -
// ---------------------------------------------------------------------------
// - This program is free software; you can redistribute it and/or modify -
// - it under the terms of the GNU General Public License version 2, as -
// - published by the Free Software Foundation. -
// - -
// - 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 version 2 for more details -
// ---------------------------------------------------------------------------
#include "ElfMemory.hpp"
#include "Interrupt.hpp"
namespace iato {
// create a default elf memory
ElfMemory::ElfMemory (void) {
setprot (PROT_NO);
}
// destroy this elf memory
ElfMemory::~ElfMemory (void) {
typedef vector<Memory*>::iterator t_it;
for (t_it it = d_vmem.begin (); it != d_vmem.end (); it++) {
delete *it;;
}
}
// reset this elf elf memory
void ElfMemory::reset (void) {
long size = d_vmem.size ();
for (long i = 0; i < size; i++) d_vmem[i]->reset ();
}
// return true if the address is valid
bool ElfMemory::isvalid (const t_octa addr) const {
long size = d_vmem.size ();
for (long i = 0; i < size; i++) {
if (d_vmem[i]->isvalid (addr) == true) return true;
}
return false;
}
// read a byte at a certain address
t_byte ElfMemory::readbyte (const t_octa addr) const {
long index = find (addr);
if (index == -1) {
ostringstream os;
os << "data access rights fault at 0x";
os << hex << setw (16) << setfill ('0') << addr;
throw Interrupt (FAULT_IT_DATA_ACRGT, os.str ());
}
return d_vmem[index]->readbyte (addr);
}
// read a byte at a certain address in execute mode
t_byte ElfMemory::readexec (const t_octa addr) const {
long index = find (addr);
if (index == -1) {
ostringstream os;
os << "instruction access rights fault at 0x";
os << hex << setw (16) << setfill ('0') << addr;
throw Interrupt (FAULT_IT_INST_ACRGT, os.str (), addr);
}
if (isvalid (addr) == false) {
ostringstream os;
os << "instruction page not present at 0x";
os << hex << setw (16) << setfill ('0') << addr;
throw Interrupt (FAULT_IT_INST_PAGE, os.str (), addr);
}
return d_vmem[index]->readexec (addr);
}
// write a byte at a certain address
void ElfMemory::writebyte (const t_octa addr, const t_byte byte) {
long index = find (addr);
if (index == -1) {
ostringstream os;
os << "data access rights fault at 0x";
os << hex << setw (16) << setfill ('0') << addr;
throw Interrupt (FAULT_IT_DATA_ACRGT, os.str ());
}
d_vmem[index]->writebyte (addr, byte);
}
// return the number of memories
long ElfMemory::length (void) const {
return d_vmem.size ();
}
// find a memory index by address
long ElfMemory::find (const t_octa addr) const {
long size = d_vmem.size ();
for (long i = 0; i < size; i++) {
if (d_vmem[i]->isvalid (addr) == true) return i;
}
return -1;
}
// add a memory to this elf exec image
void ElfMemory::add (Memory* mem) {
if (!mem) return;
d_vmem.push_back (mem);
}
// return a memory by index
Memory* ElfMemory::getmem (const long index) const {
assert ((index >= 0) && (index < (long) d_vmem.size ()));
return d_vmem[index];
}
// remove a memory by index
bool ElfMemory::remove (const long index) {
long size = d_vmem.size ();
if ((index < 0) || (index >= size)) return false;
// special case with only one element
if (size == 1) {
assert (index == 0);
delete d_vmem[0];
d_vmem.pop_back ();
} else {
// delete the memory element
Memory* mem = d_vmem[index];
delete mem;
// swap the memory element with the last one so we can pop it
d_vmem[index] = d_vmem[size-1];
d_vmem.pop_back ();
}
return true;
}
}
| [
"me@parsaamini.net"
] | me@parsaamini.net |
0e8ad42c3fe73ac3cabd253af0a9047d67a12c4d | ec3184b57577effad1a982c903298c0e511b5a4b | /C/CProgramming/C4thWeek/main.cpp | 55fe706d3bd75cb2f7d3deaa4d799c4837848b55 | [] | no_license | BckLily/yeilGroupStudy | 6535c58922407e0256874bfade305f46541e1e09 | 3e30c19a771baab23636591f28e3d26bd51ae072 | refs/heads/main | 2023-07-17T23:03:55.500076 | 2021-08-29T08:18:39 | 2021-08-29T08:18:39 | 393,947,582 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,857 | cpp | #include <iostream>
void Capital(char*);
void Bigger(int*, int*);
void Total(int, int*);
void SortASC(int*);
int main(void) {
//std::cout << "이전 코드를 이해한 후 문자열을 입력 받은 후 해당 문자열의 내용을 모두 대문자로 바꾸는 함수를 만드시오." << std::endl;
std::cout << "1." << std::endl;
char str[] = "I Don't Know";
Capital(str);
std::cout << "str: " << str << std::endl;
//std::cout << "두 수를 입력 받아 큰 수를 구하시오" << std::endl;
std::cout << "2." << std::endl;
int num1, num2;
std::cin >> num1 >> num2;
Bigger(&num1, &num2);
std::cout << "Bigger: " << num1 << std::endl;
//std::cout << "하나의 숫자를 입력받아 1부터 입력 받은 수 까지의 누적합계를 구하시오" << std::endl;
std::cout << "3." << std::endl;
int num3, result=0;
std::cin >> num3;
Total(num3, &result);
std::cout << "Result: " << result << std::endl;
//std::cout << "임의 수 8개를 int형 배열에 입력 받은 후 오름차순 정렬한 뒤에 출력하시오." << std::endl;
std::cout << "4." << std::endl;
int arr[8];
for (int i = 0; i < 8; i++) {
std::cin >> arr[i];
}
SortASC(arr);
std::cout << "Result: ";
for (int i = 0; i < 8; i++) {
std::cout << arr[i] << " ";
}
return 0;
}
void Capital(char* str) {
for (int i = 0; *(str + i) != '\0'; i++) {
if (*(str + i) >= 'a' && *(str + i) <= 'z') {
*(str + i) += 'A' - 'a';
}
}
return;
}
void Bigger(int* max, int* min) {
if (*max < *min) {
int swap = *max;
*max = *min;
*min = swap;
}
}
void Total(int idx, int* result) {
for (int i = 1; i <= idx; i++) {
*result += i;
}
}
void SortASC(int* arr) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (arr[i] < arr[j]) {
int swap = arr[i];
arr[i] = arr[j];
arr[j] = swap;
}
}
}
}
| [
"52183009+BckLily@users.noreply.github.com"
] | 52183009+BckLily@users.noreply.github.com |
73d43755008fc393b7a538b9a866e8ebfd875b1d | 8732d1522ca54fc5bef969f4d42d27907ac8b071 | /Chapter 5/Lab 5.1.9 (3)/Lab 5.1.9 (3)/stdafx.cpp | 962e5e01b1fe9d657f652850c8aedb56a544213c | [] | no_license | pulupigor/C-Ess-KI3 | f0e9dc641fbb2cd179b19dd88fc20fdbee95cbcc | 46f3a7f001624368c0777c4213dbd2557061029c | refs/heads/master | 2021-08-30T06:16:50.503881 | 2017-12-09T16:51:52 | 2017-12-09T16:51:52 | 107,868,296 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 292 | cpp | // stdafx.cpp : source file that includes just the standard includes
// Lab 5.1.9 (3).pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"pulupigor@ukr.net"
] | pulupigor@ukr.net |
52e5524681f996cb3b9445a4db74fa81cec0ec8c | 4d8974028927ce83ba83bc3fe9b9df8980c9b378 | /Include/Boss.h | 56c098ed5b4562996db6e5b56c7c78a4bf0892be | [] | no_license | liznsalt/zero-Enlightenment | 071ec30b13f4bb9011487c2fb69223e67687320d | 37e2a51bc6ad9cae63380cadaf5da9be7b845d91 | refs/heads/master | 2020-03-23T06:38:05.356028 | 2018-07-23T15:49:13 | 2018-07-23T15:49:13 | 141,220,205 | 0 | 0 | null | null | null | null | EUC-JP | C++ | false | false | 907 | h | #pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <string>
#include "Power.h"
#include "Person.h"
using namespace sf;
using namespace std;
//払移議窃。。。。。。。
class Boss :
public Drawable,
public Transformable
{
public:
int HP, ATK;
bool face_to_right;
bool isMovingLeft, isMovingRight, isJumping;
bool canAtack;
float foot_position;
float speed, jump_speed;
Boss();
void load(const string& p);
void remoteAtack();
vector<Power> Remote;
void gethurt(int atk)
{
HP -= atk;
}
void Shift();
void update(Time dt);
private:
Clock clock;
Time timeSinceLastUpdate;
Time atack_frame;
virtual void draw(RenderTarget& target, RenderStates states) const
{
states.transform *= getTransform();
states.texture = &m_texture;
target.draw(m_vertices, states);
}
VertexArray m_vertices;
Texture m_texture;
};
| [
"2274938013@qq.com"
] | 2274938013@qq.com |
f76d1e0948b59b61e9cc7cdb423cecf387814674 | 24127b4687b8facb0e1cee6a563f184521cf6315 | /Source/S05_TestingGrounds/Terrain/GrassComponent.h | 3961c9515f3f82f97b4fd4c090748471eaf0c019 | [] | no_license | NoahSurprenant/TestingGrounds | d0549192d9b9b0b40bcf5c069bef3b3dafddaa34 | ceea3df900ba8445992c27365033b70db03cef18 | refs/heads/master | 2020-05-18T21:35:45.857740 | 2019-06-26T22:47:00 | 2019-06-26T22:47:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 901 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
#include "GrassComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class S05_TESTINGGROUNDS_API UGrassComponent : public UHierarchicalInstancedStaticMeshComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UGrassComponent();
UPROPERTY(EditDefaultsOnly, Category = Spawning)
FBox SpawningExtents;
UPROPERTY(EditDefaultsOnly, Category = Spawning)
int SpawnCount;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
private:
void SpawnGrass();
};
| [
"noah.surprenant@gmail.com"
] | noah.surprenant@gmail.com |
71a5a989c35843ce8167e02ddfccd3d74dfebc61 | d5b1700286a9adc22c95a87ba2fd09c624fd44ef | /test/gtest/ucs/test_bitops.cc | fe61b00b5ca40885ebc139a3abd11b50d91b14c9 | [
"BSD-3-Clause"
] | permissive | souravzzz/ucx | f46d76a15f100697e5a5c23abbeb6dd6d9880f05 | fa976b66454e606ee8377e2b5b6f482617932550 | refs/heads/master | 2021-08-01T04:02:10.866833 | 2021-07-20T11:24:19 | 2021-07-20T11:24:19 | 225,448,312 | 0 | 0 | NOASSERTION | 2019-12-02T19:04:35 | 2019-12-02T19:04:34 | null | UTF-8 | C++ | false | false | 8,126 | cc | /**
* Copyright (C) Huawei Technologies Co., Ltd. 2020. ALL RIGHTS RESERVED.
* See file LICENSE for terms.
*/
#include <common/test.h>
extern "C" {
#include <ucs/arch/bitops.h>
}
class test_bitops : public ucs::test {
};
UCS_TEST_F(test_bitops, ffs64) {
EXPECT_EQ(0u, ucs_ffs64(0xfffff));
EXPECT_EQ(16u, ucs_ffs64(0xf0000));
EXPECT_EQ(1u, ucs_ffs64(0x4002));
EXPECT_EQ(41u, ucs_ffs64(1ull << 41));
}
UCS_TEST_F(test_bitops, ilog2) {
EXPECT_EQ(0u, ucs_ilog2(1));
EXPECT_EQ(2u, ucs_ilog2(4));
EXPECT_EQ(2u, ucs_ilog2(5));
EXPECT_EQ(2u, ucs_ilog2(7));
EXPECT_EQ(14u, ucs_ilog2(17000));
EXPECT_EQ(40u, ucs_ilog2(1ull << 40));
}
UCS_TEST_F(test_bitops, popcount) {
EXPECT_EQ(0, ucs_popcount(0));
EXPECT_EQ(2, ucs_popcount(5));
EXPECT_EQ(16, ucs_popcount(0xffff));
EXPECT_EQ(48, ucs_popcount(0xffffffffffffUL));
}
UCS_TEST_F(test_bitops, ctz) {
EXPECT_EQ(0, ucs_count_trailing_zero_bits(1));
EXPECT_EQ(28, ucs_count_trailing_zero_bits(0x10000000));
EXPECT_EQ(32, ucs_count_trailing_zero_bits(0x100000000UL));
}
UCS_TEST_F(test_bitops, ptr_ctz) {
uint8_t buffer[20] = {0};
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 0));
ASSERT_EQ(1, ucs_count_ptr_trailing_zero_bits(buffer, 1));
ASSERT_EQ(8, ucs_count_ptr_trailing_zero_bits(buffer, 8));
ASSERT_EQ(10, ucs_count_ptr_trailing_zero_bits(buffer, 10));
ASSERT_EQ(64, ucs_count_ptr_trailing_zero_bits(buffer, 64));
ASSERT_EQ(70, ucs_count_ptr_trailing_zero_bits(buffer, 70));
buffer[0] = 0x10; /* 00010000 */
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 0));
ASSERT_EQ(1, ucs_count_ptr_trailing_zero_bits(buffer, 1));
ASSERT_EQ(4, ucs_count_ptr_trailing_zero_bits(buffer, 8));
ASSERT_EQ(6, ucs_count_ptr_trailing_zero_bits(buffer, 10));
ASSERT_EQ(60, ucs_count_ptr_trailing_zero_bits(buffer, 64));
ASSERT_EQ(66, ucs_count_ptr_trailing_zero_bits(buffer, 70));
buffer[0] = 0x01; /* 00000001 */
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 0));
ASSERT_EQ(1, ucs_count_ptr_trailing_zero_bits(buffer, 1));
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 8));
ASSERT_EQ(2, ucs_count_ptr_trailing_zero_bits(buffer, 10));
ASSERT_EQ(56, ucs_count_ptr_trailing_zero_bits(buffer, 64));
ASSERT_EQ(62, ucs_count_ptr_trailing_zero_bits(buffer, 70));
buffer[8] = 0x01; /* 00000001 */
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 0));
ASSERT_EQ(1, ucs_count_ptr_trailing_zero_bits(buffer, 1));
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 8));
ASSERT_EQ(2, ucs_count_ptr_trailing_zero_bits(buffer, 10));
ASSERT_EQ(56, ucs_count_ptr_trailing_zero_bits(buffer, 64));
ASSERT_EQ(62, ucs_count_ptr_trailing_zero_bits(buffer, 70));
ASSERT_EQ(0, ucs_count_ptr_trailing_zero_bits(buffer, 72));
ASSERT_EQ(8, ucs_count_ptr_trailing_zero_bits(buffer, 80));
ASSERT_EQ(56, ucs_count_ptr_trailing_zero_bits(buffer, 128));
ASSERT_EQ(88, ucs_count_ptr_trailing_zero_bits(buffer, 160));
}
UCS_TEST_F(test_bitops, is_equal) {
uint8_t buffer1[20] = {0};
uint8_t buffer2[20] = {0};
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[19] = 0x1; /* 00000001 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[19] = 0x10; /* 00010000 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[16] = 0xff; /* 11111111 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[9] = 0xff; /* 11111111 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[7] = 0xff; /* 11111111 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[1] = 0xff; /* 11111111 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 65));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 128));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 130));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 159));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 160));
buffer1[0] = 0x1; /* 00000001 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
buffer2[0] = 0x1; /* 00000001 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
buffer2[0] = 0xff; /* 11111111 */
ASSERT_TRUE(ucs_bitwise_is_equal(buffer1, buffer2, 0));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 1));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 8));
ASSERT_FALSE(ucs_bitwise_is_equal(buffer1, buffer2, 64));
}
| [
"alex.margolin@huawei.com"
] | alex.margolin@huawei.com |
c4a13b0c88b0cbff956bcbb3058bae73e0177d19 | c3bca63533a2f9645e255b7109e780b829f5ceb2 | /a/a.h | e30ee730f82657aac216bc60972ddbf3e0d35261 | [] | no_license | jaehong8754/vscode_cmake_setting | ab7abec2dde4449195c19f301e44eb995fb3dd78 | 014c48a81593dcc9e2b4c06c75f6cb67acf65486 | refs/heads/master | 2022-12-06T14:12:30.056262 | 2020-08-30T14:25:46 | 2020-08-30T14:25:46 | 291,483,730 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 56 | h | #include <string>
using namespace std;
string func_a(); | [
"jaehong8754@gmail.com"
] | jaehong8754@gmail.com |
899ea6314ec37bd91817ceaed1321635c63f42b2 | 8253448f3dcc3894c6bf9d1761c834302a417e34 | /http_parser.h | c80b588521937b34ecb34c5da661f141072efa75 | [] | no_license | jean-marc/parser | 77973f87c2cdfc82c348df3c86b05f628bc3dd07 | 081e5dd26f8f4968471521fe3e20e52ecf1a0f09 | refs/heads/master | 2021-05-16T02:42:34.408755 | 2017-08-08T17:23:15 | 2017-08-08T17:23:15 | 31,050,990 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,366 | h | #ifndef HTTP_PARSER_H
#define HTTP_PARSER_H
#include <map>
#include "parser.h"
using namespace parser;
struct http_parser{
/*
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 4
Access-Control-Allow-Origin: *
Content-Type: application/javascript
Date: Sun, 06 Aug 2017 00:59:01 GMT
true
*/
typedef _sqc<'\r','\n'> rn;
typedef _sqc<'H','T','T','P','/','1','.','1'> version;
typedef _rc<'0','9'> digit;
typedef _sq<digit,digit,digit> code;
typedef _kl<_or<_rc<'a','z'>,_rc<'A','Z'>,_c<' '>>> reason;
typedef _sq<code,_c<' '>,reason> status;
struct key:_pl<_or<_rc<'a','z'>,_rc<'A','Z'>,_c<'-'>>>{};
//broken parser: does not backtrack!
//typedef _pl<_or<_nt<_c<'\r'>>,_nt<_c<'\n'>>>> value;
struct value:_pl<_nt<_c<'\r'>>> {};
typedef _sq<key,_c<':'>,_c<' '>,value,rn> header;
typedef _sq<
version,_c<' '>,status,rn,
_kl<header>,
rn
> response;
//does not have to be defined here
template<typename ITERATOR> struct my_handler:parser::handler<
ITERATOR,
std::tuple<
key,
value
>
>{
std::map<string,string> headers;
std::string current_key;
void start(key){}
void stop(key,ITERATOR begin,ITERATOR end,bool v){
if(v)
current_key={begin,end};
}
void start(value){}
void stop(value,ITERATOR begin,ITERATOR end,bool v){
if(v)
headers[current_key]={begin,end};
}
};
};
#endif
| [
"lefebure.jeanmarc@gmail.com"
] | lefebure.jeanmarc@gmail.com |
0010afdf327e182bdb01ad36b33180d428e7004b | f3c6b7b1ca44601164b44a1c376135c82b9f0d8c | /Analysis/TreeFilter/MakeHFRaddamPlots/src/RunAnalysis.cxx | 74a8966dc3ea3a012486d4dda3eb84899cae4e89 | [] | no_license | jkunkle/usercode | 05e398c75277a796e868c5e24c568a24b1a71c06 | 73a6319d684b402931e97ff6c4093b54e076d18a | refs/heads/master | 2021-01-23T20:55:25.344716 | 2018-06-25T08:54:44 | 2018-06-25T08:54:44 | 11,815,481 | 0 | 3 | null | 2017-08-09T11:49:59 | 2013-08-01T11:42:57 | C | UTF-8 | C++ | false | false | 7,786 | cxx | #include "include/RunAnalysis.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <numeric>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#include <stdlib.h>
#include "include/BranchDefs.h"
#include "include/BranchInit.h"
#include "Core/Util.h"
#include "TFile.h"
int main(int argc, char **argv)
{
//TH1::AddDirectory(kFALSE);
CmdOptions options = ParseOptions( argc, argv );
// Parse the text file and form the configuration object
AnaConfig ana_config = ParseConfig( options.config_file, options );
std::cout << "Configured " << ana_config.size() << " analysis modules " << std::endl;
RunModule runmod;
ana_config.Run(runmod, options);
std::cout << "^_^ Finished ^_^" << std::endl;
}
void RunModule::initialize( TChain * chain, TTree * outtree, TFile *outfile,
const CmdOptions & options, std::vector<ModuleConfig> &configs ) {
// *************************
// initialize trees
// *************************
InitINTree(chain);
calib_tdc_vs_evt = new TH2F( "calib_tdc_vs_evt", "PIN diode TDC time vs event",160, 0, 160000, 300, 0, 150 );
}
bool RunModule::execute( std::vector<ModuleConfig> & configs ) {
_evn++;
// loop over configured modules
bool save_event = true;
BOOST_FOREACH( ModuleConfig & mod_conf, configs ) {
save_event &= ApplyModule( mod_conf );
}
return save_event;
}
bool RunModule::ApplyModule( ModuleConfig & config ) {
if( config.GetName() == "PlotHF" ) {
PlotHF( config );
}
return false;
}
// ***********************************
// Define modules here
// The modules can do basically anything
// that you want, fill trees, fill plots,
// caclulate an event filter
// ***********************************
//
// Examples :
void RunModule::PlotHF( ModuleConfig & config ) {
unsigned nch = IN::QIE10DigiIEta->size();
unsigned nts = IN::QIE10DigiADC->at(0).size();
std::map<std::pair<int, int>, float> numerator_sum;
std::map<std::pair<int, int>, float> denominator_sum;
for( unsigned ich = 0; ich < nch; ich++ ) {
int ieta = IN::QIE10DigiIEta->at(ich);
int iphi = IN::QIE10DigiIPhi->at(ich);
int depth = IN::QIE10DigiDepth->at(ich);
int subdet = IN::QIE10DigiSubdet->at(ich);
if( subdet == 4 ) {
EtaPhiDepth channel( ieta, iphi, depth);
if( charge_ratio_ts2_ts3.find( channel ) == charge_ratio_ts2_ts3.end() ) {
std::stringstream name_1;
std::stringstream name_2;
std::stringstream name_3;
std::stringstream title_1;
std::stringstream title_2;
std::stringstream title_3;
name_1 << "charge_ratio_ts1_ts2_" << ieta << "_" << iphi << "_" << depth;
name_2 << "charge_ratio_ts2_ts3_" << ieta << "_" << iphi << "_" << depth;
name_3 << "tdc_time_vs_evt_" << ieta << "_" << iphi << "_" << depth;
title_1 << "Charge ratio in TS1 and TS2, IEta=" << ieta << ", IPhi=" << iphi << ", Depth=" << depth;
title_2 << "Charge ratio in TS2 and TS3, IEta=" << ieta << ", IPhi=" << iphi << ", Depth=" << depth;
title_3 << "TDC time vs event, IEta=" << ieta << ", IPhi=" << iphi << ", Depth=" << depth;
charge_ratio_ts1_ts2[channel] = new TH2F( name_1.str().c_str(), title_1.str().c_str(), 160, 0, 160000, 100, 0, 1 );
charge_ratio_ts2_ts3[channel] = new TH2F( name_2.str().c_str(), title_2.str().c_str(), 160, 0, 160000, 100, 0, 1 );
tdc_time_vs_evt[channel] = new TH2F( name_3.str().c_str(), title_3.str().c_str(), 160, 0, 160000, 300, 0, 150 );
}
std::pair<int,int> ieta_iphi = std::make_pair(ieta, iphi);
if( numerator_sum.find( ieta_iphi ) == numerator_sum.end() ) {
numerator_sum[ieta_iphi] = 0;
denominator_sum[ieta_iphi] = 0;
}
float fc_1 = IN::QIE10DigiFC->at(ich)[1];
float fc_2 = IN::QIE10DigiFC->at(ich)[2];
float fc_3 = IN::QIE10DigiFC->at(ich)[3];
float ts_sum = 0;
for( unsigned its = 0; its < nts; ++its ) {
ts_sum += IN::QIE10DigiFC->at(ich)[its];
}
float tdc_time = 0;
for( unsigned its = 0; its < nts; ++its ) {
int tdc = IN::QIE10DigiLETDC->at(ich)[its];
if( tdc <= 50 ) {
tdc_time += tdc;
break;
}
else {
tdc_time += 50;
}
}
tdc_time = tdc_time /2.;
tdc_time_vs_evt[channel]->Fill( IN::event, tdc_time );
charge_ratio_ts1_ts2[channel]->Fill( IN::event, (fc_1 + fc_2)/ts_sum );
charge_ratio_ts2_ts3[channel]->Fill( IN::event, (fc_2 + fc_3)/ts_sum );
denominator_sum[ieta_iphi] = denominator_sum[ieta_iphi] + ts_sum;
numerator_sum[ieta_iphi] = numerator_sum[ieta_iphi] + fc_2 + fc_3;
}
if( subdet==7 && depth == 12 && ieta == -48 && iphi == 25 ) {
float tdc_time = 0;
for( unsigned its = 0; its < nts; ++its ) {
int tdc = IN::QIE10DigiLETDC->at(ich)[its];
if( tdc <= 50 ) {
tdc_time += tdc;
break;
}
else {
tdc_time += 50;
}
}
tdc_time = tdc_time /2.;
calib_tdc_vs_evt->Fill( IN::event, tdc_time);
}
}
for( std::map<std::pair<int, int>, float>::const_iterator itr = numerator_sum.begin();
itr != numerator_sum.end(); ++itr ) {
if( charge_ratio_ts2_ts3_sum.find( itr->first ) == charge_ratio_ts2_ts3_sum.end() ) {
std::stringstream name;
std::stringstream title;
name << "charge_ratio_ts2_ts3_sum_" << itr->first.first << "_" << itr->first.second;
title << "Charge ratio in TS2 and TS3, Depth sum, IEta=" << itr->first.first << ", IPhi=" << itr->first.second ;
charge_ratio_ts2_ts3_sum[itr->first] = new TH2F( name.str().c_str(), title.str().c_str(), 160, 0, 160000, 100, 0, 1 );
}
charge_ratio_ts2_ts3_sum[itr->first]->Fill( IN::event, itr->second/(denominator_sum[itr->first]) );
}
}
void RunModule::finalize() {
calib_tdc_vs_evt->Write();
for( std::map<EtaPhiDepth, TH2F*>::const_iterator itr = charge_ratio_ts1_ts2.begin(); itr != charge_ratio_ts1_ts2.end(); ++itr ) {
itr->second->Write();
}
for( std::map<EtaPhiDepth, TH2F*>::const_iterator itr = charge_ratio_ts2_ts3.begin(); itr != charge_ratio_ts2_ts3.end(); ++itr ) {
itr->second->Write();
}
for( std::map<EtaPhiDepth, TH2F*>::const_iterator itr = tdc_time_vs_evt.begin(); itr != tdc_time_vs_evt.end(); ++itr ) {
itr->second->Write();
}
for( std::map<std::pair<int,int>, TH2F*>::const_iterator itr = charge_ratio_ts2_ts3_sum.begin(); itr != charge_ratio_ts2_ts3_sum.end(); ++itr ) {
itr->second->Write();
}
}
EtaPhiDepth::EtaPhiDepth( int _ieta, int _iphi, int _depth ) {
ieta = _ieta;
iphi = _iphi;
depth = _depth;
}
bool EtaPhiDepth::operator<( const EtaPhiDepth &r ) const {
if( ieta == r.ieta ) {
if( iphi == r.iphi ) {
return depth < r.depth;
}
else {
return iphi < r.iphi;
}
}
else {
return ieta < r.ieta;
}
}
| [
"jkunkle@cern.ch"
] | jkunkle@cern.ch |
4eb8bff7ae2755a1692b1adfb0fa2da1a2ef356e | 2a9213024770a6c6c6b305bf3cf45f44e6398d47 | /caf/libcaf_core/caf/inspector_access_base.hpp | 614fd8b2f5f9565cb3dab643b22ad7bc55281975 | [
"Unlicense"
] | permissive | wissunpower/WeizenbierGame | 195d36e7a32485dc76f06c2b0d5c11ee6d5b4a60 | 34f027c43055dfa6b05e62ca0b6c31271af013f3 | refs/heads/main | 2023-08-06T06:44:36.240176 | 2021-09-29T07:34:29 | 2021-09-29T07:34:29 | 390,057,582 | 0 | 0 | Unlicense | 2021-09-26T16:22:57 | 2021-07-27T16:43:06 | C++ | UTF-8 | C++ | false | false | 2,925 | hpp | // This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#pragma once
#include "caf/detail/as_mutable_ref.hpp"
#include "caf/sec.hpp"
#include "caf/string_view.hpp"
namespace caf {
/// Provides default implementations for `save_field` and `load_field`.
template <class T>
struct inspector_access_base {
/// Loads a mandatory field from `f`.
template <class Inspector, class IsValid, class SyncValue>
static bool load_field(Inspector& f, string_view field_name, T& x,
IsValid& is_valid, SyncValue& sync_value) {
if (f.begin_field(field_name) && f.apply(x)) {
if (!is_valid(x)) {
f.emplace_error(sec::field_invariant_check_failed,
to_string(field_name));
return false;
}
if (!sync_value()) {
if (!f.get_error())
f.emplace_error(sec::field_value_synchronization_failed,
to_string(field_name));
return false;
}
return f.end_field();
}
return false;
}
/// Loads an optional field from `f`, calling `set_fallback` if the source
/// contains no value for `x`.
template <class Inspector, class IsValid, class SyncValue, class SetFallback>
static bool load_field(Inspector& f, string_view field_name, T& x,
IsValid& is_valid, SyncValue& sync_value,
SetFallback& set_fallback) {
bool is_present = false;
if (!f.begin_field(field_name, is_present))
return false;
if (is_present) {
if (!f.apply(x))
return false;
if (!is_valid(x)) {
f.emplace_error(sec::field_invariant_check_failed,
to_string(field_name));
return false;
}
if (!sync_value()) {
if (!f.get_error())
f.emplace_error(sec::field_value_synchronization_failed,
to_string(field_name));
return false;
}
return f.end_field();
}
set_fallback();
return f.end_field();
}
/// Saves a mandatory field to `f`.
template <class Inspector>
static bool save_field(Inspector& f, string_view field_name, T& x) {
return f.begin_field(field_name) //
&& f.apply(x) //
&& f.end_field();
}
/// Saves an optional field to `f`.
template <class Inspector, class IsPresent, class Get>
static bool save_field(Inspector& f, string_view field_name,
IsPresent& is_present, Get& get) {
if (is_present()) {
auto&& x = get();
return f.begin_field(field_name, true) //
&& f.apply(x) //
&& f.end_field();
}
return f.begin_field(field_name, false) && f.end_field();
}
};
} // namespace caf
| [
"30381759+wissunpower@users.noreply.github.com"
] | 30381759+wissunpower@users.noreply.github.com |
8b16ec3f06935a7b1de0cdca4bccdda4a51a664d | 12bd85aba5f8d51581d3adb44c1c90c797709052 | /process_sched/src/utlis/curr_time.h | a1da1d545163a0d098733682fe052b9195bf3405 | [] | no_license | m0dulo/OS-Assigments | afd85cb77a02c636ff2c3ee8976dcd5e3f4c5b90 | c289b5e26fb97a1cbdc0672e7582c307fc3c70d2 | refs/heads/master | 2020-07-30T10:31:54.400072 | 2020-04-24T17:31:56 | 2020-04-24T17:31:56 | 210,194,225 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 522 | h | #ifndef SRC_LYX_UTLIS_CURR_TIME_H_
#define SRC_LYX_UTLIS_CURR_TIME_H_
#pragma once;
#include <time.h>
#include <string>
#define FORMAT_MAX_SIZE 100
namespace lyx_utlis {
std:: string current_time() {
time_t now = time(0);
struct tm tstruct;
char *curr_time = (char *)malloc(sizeof(char) * FORMAT_MAX_SIZE);
tstruct = *localtime(&now);
strftime(curr_time, sizeof(char) * FORMAT_MAX_SIZE, "%m-%d %X", &tstruct);
return curr_time;
}
}
#endif // SRC_LYX_UTLIS_CURR_TIME_H_ | [
"cuckooegret@gmail.com"
] | cuckooegret@gmail.com |
3d0470023f05e2bec078b75808aa1a86bbf4ab45 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2449486_1/C++/farzadab/b.cpp | fd6d253e32626fae989530a51721043a578e1a49 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 689 | cpp | #include<iostream>
using namespace std;
const int MAX = 1000+1;
int a[MAX+10][MAX+10];
int mx[2][MAX+10];
int n,m;
int main()
{
ios::sync_with_stdio(false);
int t;
cin >> t;
for(int tt=0; tt<t; tt++)
{
cin >> n >> m;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
{
cin >> a[i][j];
mx[0][i] = ( j==0 ? a[i][j] : max( mx[0][i] , a[i][j] ) );
mx[1][j] = ( i==0 ? a[i][j] : max( mx[1][j] , a[i][j] ) );
}
bool f = true;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
if( a[i][j] < mx[0][i] && a[i][j] < mx[1][j] )
f = false;
cout << "Case #" << tt+1 << ": ";
if( f )
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
| [
"eewestman@gmail.com"
] | eewestman@gmail.com |
0637218cae628557cb5314cbebdc44b99e04e043 | efb87e4ac44f9cc98eab0dc162266fa1b99b7e5a | /Google Kickstart/Kickstart 20-RE-C.cpp | 0ad556bae1abbb85849279d504b864e957518650 | [] | no_license | farmerboy95/CompetitiveProgramming | fe4eef85540d3e91c42ff6ec265a3262e5b97d1f | 1998d5ae764d47293f2cd71020bec1dbf5b470aa | refs/heads/master | 2023-08-29T16:42:28.109183 | 2023-08-24T07:00:19 | 2023-08-24T07:00:19 | 206,353,615 | 12 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,229 | cpp | /*
Author: Nguyen Tan Bao
Status: AC
Idea:
- We can easily see that the kid can play all the toys in the first round without any
trouble.
- From the second round, when playing each toy, we need the kid to forget it to continue
our job. Specifically, if R[i] <= sum of all other E[i], the kid would forget about the toy i.
So the kid would cry when R[i] > sum of all other E[i], or R[i] > sum - E[i], or
R[i] + E[i] > sum (1).
- So if the kid cry at a specific toy i, what should we do? We should definitely remove toy i.
Because if we remove another toy j, sum will be reduced and (1) will still be the same.
- So we build a segment tree to find the smallest index of R[i] + E[i] which is larger than sum.
Need to build one binary indexed tree to calculate the result if the kid cries at toy i, which is
sum + E[j] (j < i and toy j is not removed).
*/
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;
struct TreeNode {
int Max, pos;
TreeNode(int Max = 0, int pos = 0) : Max(Max), pos(pos) {}
};
int n, E[MAXN], R[MAXN];
TreeNode t[MAXN * 4];
ll bit[MAXN];
void build(int k, int l, int r) {
if (l > r) return;
if (l == r) {
t[k] = TreeNode(E[l] + R[l], l);
return;
}
int m = (l + r) >> 1;
build(k*2, l, m);
build(k*2+1, m+1, r);
if (t[k*2].Max >= t[k*2+1].Max) t[k] = t[k*2];
else t[k] = t[k*2+1];
}
TreeNode get(int k, int l, int r, ll sum) {
if (l > r) return TreeNode(-1, -1);
if (t[k].Max <= sum) return TreeNode(-1, -1);
if (l == r && t[k].Max > sum) return t[k];
int m = (l + r) >> 1;
TreeNode L = get(k*2, l, m, sum);
if (L.Max > -1) return L;
TreeNode R = get(k*2+1, m+1, r, sum);
if (R.Max > -1) return R;
return TreeNode(-1, -1);
}
void update(int k, int l, int r, int u) {
if (l > r || r < u || u < l) return;
if (l == r) {
t[k] = TreeNode(-1, -1);
return;
}
int m = (l + r) >> 1;
update(k*2, l, m, u);
update(k*2+1, m+1, r, u);
if (t[k*2].Max >= t[k*2+1].Max) t[k] = t[k*2];
else t[k] = t[k*2+1];
}
void updateBIT(int u, int gt) {
while (u <= n) {
bit[u] += gt;
u = u + (u & (-u));
}
}
ll getBIT(int u) {
ll res = 0;
while (u) {
res += bit[u];
u = u - (u & (-u));
}
return res;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(nullptr);
int te;
cin >> te;
FOR(o,1,te) {
cout << "Case #" << o << ": ";
cin >> n;
ll sum = 0, res = 0, del = 0;
FOR(i,1,n) {
cin >> E[i] >> R[i];
sum += E[i];
}
build(1,1,n);
MS(bit, 0);
FOR(i,1,n) updateBIT(i, E[i]);
FOR(x,1,n) {
TreeNode tr = get(1,1,n,sum);
if (tr.Max == -1) {
if (res < 1e18) {
res = 1e18;
del = x-1;
}
break;
}
int pos = tr.pos;
ll now = sum + getBIT(pos-1);
if (now > res) {
res = now;
del = x-1;
}
sum -= E[pos];
updateBIT(pos, -E[pos]);
update(1,1,n,pos);
}
cout << del << ' ';
if (res == 1e18) cout << "INDEFINITELY\n";
else cout << res << "\n";
}
return 0;
}
| [
"jerry.stone.manutd@gmail.com"
] | jerry.stone.manutd@gmail.com |
cc154f59fd6970309216c5e2bc81a658566f7ead | 3fa1397b95e38fb04dac5e009d70c292deff09a9 | /BaiTap_KTLT_0051/Main.cpp | 4b3547349dcf7d6c671ffe65f31a2b4603ff4ad5 | [] | 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 | 190 | cpp | #include"BaiTap_KTLT_0051.h"
#include <iostream>
#include <string>
using namespace std;
void main()
{
int x = Input("Nhap Vao So Nguyen Duong X : ");
SoLonNhat(x);
system("pause");
} | [
"nguyennhattruong96@outlook.com.vn"
] | nguyennhattruong96@outlook.com.vn |
f7ed93244ca572f42e2ad92302ed227befb3ffcc | 222a5cd5c49beb623e85eba7d42f2a4951cd5adf | /code/userprog/progtest.cc | 1800511ef3dcb5a536ac7b8fe18faf5601a0ffff | [
"MIT-Modern-Variant"
] | permissive | lddat170996/Nachos-3.4 | 7e55e945f47f422a88c5b6184e8170e8d5355205 | aced23d58ee4837dbb076854cb97f31d49532fd4 | refs/heads/master | 2020-12-31T01:22:46.407293 | 2016-05-05T14:17:38 | 2016-05-05T14:17:38 | 58,131,760 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,026 | cc | // progtest.cc
// Test routines for demonstrating that Nachos can load
// a user program and execute it.
//
// Also, routines for testing the Console hardware device.
//
// Copyright (c) 1992-1993 The Regents of the University of California.
// All rights reserved. See copyright.h for copyright notice and limitation
// of liability and disclaimer of warranty provisions.
#include "copyright.h"
#include "system.h"
#include "console.h"
#include "addrspace.h"
#include "synch.h"
//Dang Thanh Tung
void StartProcess_2(int id)
{
AddrSpace *space;
char* FileName = pTab->GetFileName(id);
space = new AddrSpace(FileName);
if(!space)
{
printf("\nPCB::Exec : Khong the tao 1 mot AddSpace ");
return;
}
currentThread->space = space;
space->InitRegisters();
space->RestoreState();
machine->Run();
ASSERT(FALSE);
}
//Dang Thanh Tung
//----------------------------------------------------------------------
// StartProcess
// Run a user program. Open the executable, load it into
// memory, and jump to it.
//----------------------------------------------------------------------
void StartProcess(char *filename)
{
// OpenFile *executable = fileSystem->Open(filename);
AddrSpace *space;
//if (executable == NULL) {
//printf("Unable to open file %s\n", filename);
//return;
//}
space = new AddrSpace(filename);
currentThread->space = space;
// delete executable; // close file
space->InitRegisters(); // set the initial register values
space->RestoreState(); // load page table register
machine->Run(); // jump to the user progam
ASSERT(FALSE); // machine->Run never returns;
// the address space exits
// by doing the syscall "exit"
}
// Data structures needed for the console test. Threads making
// I/O requests wait on a Semaphore to delay until the I/O completes.
static Console *console;
static Semaphore *readAvail;
static Semaphore *writeDone;
//----------------------------------------------------------------------
// ConsoleInterruptHandlers
// Wake up the thread that requested the I/O.
//----------------------------------------------------------------------
static void ReadAvail(int arg) { readAvail->V(); }
static void WriteDone(int arg) { writeDone->V(); }
//----------------------------------------------------------------------
// ConsoleTest
// Test the console by echoing characters typed at the input onto
// the output. Stop when the user types a 'q'.
//----------------------------------------------------------------------
void
ConsoleTest (char *in, char *out)
{
char ch;
console = new Console(in, out, ReadAvail, WriteDone, 0);
readAvail = new Semaphore("read avail", 0);
writeDone = new Semaphore("write done", 0);
for (;;) {
readAvail->P(); // wait for character to arrive
ch = console->GetChar();
console->PutChar(ch); // echo it!
writeDone->P() ; // wait for write to finish
if (ch == 'q') return; // if q, quit
}
}
| [
"lddat170996@gmail.com"
] | lddat170996@gmail.com |
de96a0d33e26485119253d455166efefd48862c7 | 6854bf6cf47c68de574f855af19981a74087da7d | /0011 - Container With Most Water/cpp/main.cpp | ab07d4dd7306e91bafb8c455a9a5c8a64053c1a4 | [
"MIT"
] | permissive | xiaoswu/Leetcode | 5a2a864afa3b204badf5034d2124b104edfbbe8e | e4ae8b2f72a312ee247084457cf4e6dbcfd20e18 | refs/heads/master | 2021-08-14T23:21:04.461658 | 2021-08-10T06:15:01 | 2021-08-10T06:15:01 | 152,703,066 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,240 | cpp | //
// main.cpp
// 11 - Container With Most Water
//
// Created by ynfMac on 2018/10/16.
// Copyright © 2018年 ynfMac. All rights reserved.
// 使用双指针法
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
class Solution {
public:
int maxArea(vector<int>& vec){
assert(vec.size() >=2 );
int l = 0;
int r = vec.size() - 1;
int max = 0;
while (l < r) {
int height = __height(vec[l], vec[r]);
int length = __length(l, r);
if (height * length > max) {
max = height *length;
}
if (vec[l] > vec [r]) {
r --;
} else {
l ++;
}
}
return max;
}
private:
inline int __height(int a, int b){
return a > b ? b : a;
}
inline int __length(int a, int b){
assert(b > a);
return b - a;
}
};
int main(int argc, const char * argv[]) {
int arr[] = {1,8,6,2,5,4,8,3,7};
vector<int> cec = vector<int>(arr ,arr + sizeof(arr) / sizeof(int));
cout << Solution().maxArea(cec) << endl;
return 0;
}
| [
"841623395@qq.com"
] | 841623395@qq.com |
c8788ff7ceb19b47446bb60c17f7452352cfc0e9 | f84a0ee6bee670736b64427b93d5141061be22ba | /codeforces/ladder1700/261B.cpp | 5a0c9e33af16691f5ad1b30e68529cfa1fa379f8 | [] | no_license | joseleite19/competitive-programming | eaeb03b6a250619a4490f5da5274da3ba8017b62 | f00e7a6cb84d7b06b09d00fffd7c5ac68a7b99e3 | refs/heads/master | 2020-04-15T14:05:40.261419 | 2017-12-19T18:34:42 | 2017-12-19T18:34:42 | 57,311,825 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 929 | cpp | #include <bits/stdc++.h>
using namespace std;
int n, p, cnt[55];
double fat[100];
long double dp[100][100][100];
int mark[100][100][100];
long double f(int i, int spaces, int sum){
if(sum > p){
return fat[n-spaces] * fat[spaces-1] * (spaces-1);
}
if(sum ==p){
return fat[n-spaces] * fat[spaces] * spaces;
}
if(i == 51) return 0;
long double &ans = dp[i][spaces][sum];
if(mark[i][spaces][sum]) return ans;
mark[i][spaces][sum] = 1;
ans = 0;
for(int q = 0; q <= cnt[i]; q++){
ans += f(i+1, spaces + q, sum + q*i);
}
return ans;
}
int main(){
fat[0] = 1;
for(int i = 1; i < 100; i++)
fat[i] = i*fat[i-1];
scanf("%d", &n);
int tmp = 0;
for(int i = 0; i < n; i++){
int x;
scanf("%d", &x);
cnt[x]++;
tmp += x;
}
scanf("%d", &p);
printf("%.20lf\n", (double)f(0, 0, 0) / fat[n]);
}
| [
"leite.josemarcos@gmail.com"
] | leite.josemarcos@gmail.com |
3b91ccb4f483715c2ffaee3f3bd09b01d2977f9b | 248f56ead26108bf1bdab71774ff60571409f82d | /C++ Scripts/C++/C++/Hello World.cpp | 471a4389430f686c734df446606c5f6be5bb190a | [] | no_license | RowanHarley/Programming-List | b423bc15f7dc0efb47c9deab39c391933c18eb3f | 2ab8a79cbc1ca3444d42517f951485b6bb6b8579 | refs/heads/master | 2021-08-22T17:19:01.775018 | 2017-11-30T18:57:17 | 2017-11-30T18:57:17 | 112,644,305 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,689 | cpp | // Hello World.cpp : main project file.
#include "stdafx.h"
#include "MoreProbability.h"
#include "moneyGame.h"
#include "mathshelp.h"
#include "speech.h"
#include "search.h"
#include "Chance.h"
#include "guessingGame.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main() {
for (;;) {
string str;
string debug;
bool isDebug;
cout << "Hello World!\n";
system("pause");
cout << "Do you want to use debug mode (Y\N)? ";
cin >> debug;
if (debug == "Y" || debug == "y") {
isDebug = true;
}
else if (debug == "N" || debug == "n") {
isDebug = false;
}
else {
cout << debug << " is not a valid answer!" << endl;
cin >> debug;
}
std::cout << "To view maths help, type M,\nTo view Speech, type S,\nTo view Search, type SE,\nOr to exit type E\n";
std::cin >> str;
if (str == "S" || str == "s") {
system("cls");
SpeechTest s;
s.Load(isDebug);
}
else if (str == "M" || str == "m") {
system("cls");
Test t;
t.Load(isDebug);
}
else if (str == "E" || str == "e") {
break;
}
else if (str == "C" || str == "c") {
system("cls");
Chance c;
c.Load(isDebug);
}
else if (str == "P" || str == "p") {
system("cls");
MoreProbability p;
p.Load(isDebug);
}
else if (str == "MG" || str == "mg" || str == "Mg" || str == "mG") {
system("cls");
Game g;
g.Load(isDebug);
}
else if (str == "GG" || str == "gg" || str == "Gg" || str == "gG") {
system("cls");
guessingGame g;
g.Load(isDebug);
}
else if (str == "SE" || str == "se" || str == "Se" || str == "sE") {
system("cls");
Search search;
search.Load(isDebug);
}
}
return 0;
}
| [
"rowanharley01@gmail.com"
] | rowanharley01@gmail.com |
c37beb05900d863cfc12ec642088700ca4cab960 | 3390f604b39fe90933bc4e919ba9d6720dc66537 | /src/common/Common.h | 78ef7b917927c4e76e43d61dac395c7393e606e5 | [] | no_license | hiroshi-mikuriya/nxt | 880aa9ebee679797d8b2d5c25054e027857d2263 | edfd585548447117eb3605ef0f451c8bf8346629 | refs/heads/master | 2021-05-09T07:01:44.238374 | 2018-01-29T07:33:58 | 2018-01-29T07:33:58 | 119,347,875 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 897 | h | /*
* Common.h
*
* Created on: 2012/05/18
* Author: HIROSHI MIKURIYA
*/
#ifndef COMMON_H_
#define COMMON_H_
#include <stddef.h>
/**
* 配列の先頭ポインタを返す
* @param 配列
* @return 先頭ポインタ
*/
template<typename AnyType, size_t n>
AnyType * beginof(AnyType (&a)[n])
{
return a;
}
/**
* 配列の末尾の次のポインタを返す
* @param 配列
* @return 末尾の次のポインタ
*/
template<typename AnyType, size_t n>
AnyType * endof(AnyType (&a)[n])
{
return a + n;
}
/**
* 配列の要素数を返す
* @param 配列
* @return 配列の要素数
*/
template<typename AnyType, size_t n>
size_t countof(AnyType (&a)[n])
{
return n;
}
template<typename AnyType, AnyType Min, AnyType Max>
AnyType compress_cast(AnyType const & a)
{
if (a < Min) {
return Min;
}
if (Max < a) {
return Max;
}
return a;
}
#endif /* COMMON_H_ */
| [
"hiroshi.mikuriya@fxat.co.jp"
] | hiroshi.mikuriya@fxat.co.jp |
2809689e5ecbbaaeff166cd52d233623ad8d2999 | 56148fb60af13e0b7464bf19248ee019998be461 | /Delta-2A_Windows_Demo/sdk/app/frame_grabber/scanView.h | b848a3eb9f144be508ca253f2bf357dc10b32e06 | [] | no_license | shuimuyangsha/Lider_Delta2A | 14a99cd31b783adb8d02c85aea7c119d931db370 | 452b1df04bbc7f3b35d856bc3d7628b8b409e1a5 | refs/heads/master | 2022-11-08T05:59:07.940341 | 2020-07-04T08:41:35 | 2020-07-04T08:41:35 | 276,083,115 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,443 | h | /*
* RSLIDAR System
* Driver Interface
*
* Copyright 2015 RS Team
* All rights reserved.
*
* Author: ruishi, Data:2015-12-25
*
*/
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
struct scanDot {
_u8 quality;
float speed;
float angleoffset;
float angle;
float dist;
};
class CScanView : public CWindowImpl<CScanView>
{
public:
DECLARE_WND_CLASS(NULL)
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP(CScanView)
MSG_WM_MOUSEWHEEL(OnMouseWheel)
MSG_WM_PAINT(OnPaint)
MSG_WM_CREATE(OnCreate)
MSG_WM_ERASEBKGND(OnEraseBkgnd)
MSG_WM_MOUSEMOVE(OnMouseMove)
END_MSG_MAP()
void DoPaint(CDCHandle dc);
const std::vector<scanDot> & getScanList() const {
return _scan_data;
}
void onDrawSelf(CDCHandle dc);
void setScanData(RSLIDAR_SIGNAL_DISTANCE_UNIT_T *buffer, size_t count);
CScanView();
BOOL OnEraseBkgnd(CDCHandle dc);
void OnMouseMove(UINT nFlags, CPoint point);
int OnCreate(LPCREATESTRUCT lpCreateStruct);
void OnPaint(CDCHandle dc);
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
protected:
CFont stdfont;
CFont bigfont;
POINT _mouse_pt;
float _mouse_angle;
std::vector<scanDot> _scan_data;
float _current_display_range;
int _sample_counter;
_u64 _last_update_ts;
};
| [
"dongxh@dadaoii.com"
] | dongxh@dadaoii.com |
d52fd412d85f689b9a7374d2c17bacedcfc5a3fe | 0c83640cf0c7c24f7125a68d82b25f485f836601 | /abc122/c/solution1.cpp | fcc9d11cbccd774af081881d34ad5b831015e834 | [] | no_license | tiqwab/atcoder | f7f3fdc0c72ea7dea276bd2228b0b9fee9ba9aea | c338b12954e8cbe983077c428d0a36eb7ba2876f | refs/heads/master | 2023-07-26T11:51:14.608775 | 2023-07-16T08:48:45 | 2023-07-16T08:48:45 | 216,480,686 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,028 | cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
int main(void) {
int N, Q;
cin >> N >> Q;
string S;
cin >> S;
vector<int> idxes;
{
char prev = ' ';
for (int i = 0; i < N; i++) {
if (prev == 'A' && S[i] == 'C') {
idxes.push_back(i - 1);
}
prev = S[i];
}
}
for (int i = 0; i < Q; i++) {
int l, r;
cin >> l >> r;
l--;
r--;
auto low = lower_bound(idxes.begin(), idxes.end(), l);
auto high = lower_bound(idxes.begin(), idxes.end(), r);
cout << high - low << endl;
}
return 0;
}
| [
"tiqwab.ch90@gmail.com"
] | tiqwab.ch90@gmail.com |
3c07dcc52cbf50c9a79ec1deb1c580677edb99cb | 9f5289c0bb0d3d7a91d1003a4ae7564576cb169e | /Source/BansheeCore/Include/BsCHingeJoint.h | 090cc41f17f985d9ec3922f6a3efeb9c481348a7 | [] | no_license | linuxaged/BansheeEngine | 59fa82828ba0e38841ac280ea1878c9f1e9bf9bd | 12cb86711cc98847709f702e11a577cc7c2f7913 | refs/heads/master | 2021-01-11T00:04:23.661733 | 2016-10-10T13:18:44 | 2016-10-10T13:18:44 | 70,758,880 | 3 | 3 | null | 2016-10-13T01:57:56 | 2016-10-13T01:57:55 | null | UTF-8 | C++ | false | false | 2,351 | h | //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
#pragma once
#include "BsCorePrerequisites.h"
#include "BsHingeJoint.h"
#include "BsCJoint.h"
namespace BansheeEngine
{
/** @addtogroup Components-Core
* @{
*/
/**
* @copydoc HingeJoint
*
* Wraps HingeJoint as a Component.
*/
class BS_CORE_EXPORT CHingeJoint : public CJoint
{
public:
CHingeJoint(const HSceneObject& parent);
/** @copydoc HingeJoint::getAngle */
inline Radian getAngle() const;
/** @copydoc HingeJoint::getSpeed */
inline float getSpeed() const;
/** @copydoc HingeJoint::getLimit */
inline LimitAngularRange getLimit() const;
/** @copydoc HingeJoint::setLimit */
inline void setLimit(const LimitAngularRange& limit);
/** @copydoc HingeJoint::getDrive */
inline HingeJoint::Drive getDrive() const;
/** @copydoc HingeJoint::setDrive */
inline void setDrive(const HingeJoint::Drive& drive);
/** @copydoc HingeJoint::setFlag */
inline void setFlag(HingeJoint::Flag flag, bool enabled);
/** @copydoc HingeJoint::hasFlag */
inline bool hasFlag(HingeJoint::Flag flag) const;
/** @name Internal
* @{
*/
/** Returns the hinge joint that this component wraps. */
HingeJoint* _getInternal() const { return static_cast<HingeJoint*>(mInternal.get()); }
/** @} */
/************************************************************************/
/* COMPONENT OVERRIDES */
/************************************************************************/
protected:
friend class SceneObject;
/** @copydoc CJoint::createInternal */
SPtr<Joint> createInternal() override;
HINGE_JOINT_DESC mDesc;
/************************************************************************/
/* RTTI */
/************************************************************************/
public:
friend class CHingeJointRTTI;
static RTTITypeBase* getRTTIStatic();
RTTITypeBase* getRTTI() const override;
protected:
CHingeJoint(); // Serialization only
};
/** @} */
} | [
"bearishsun@gmail.com"
] | bearishsun@gmail.com |
5c5fbd8571acc5d10b93860993f423608538db10 | c4ed4a33172e01504879c0543f7873880ebf5376 | /cores/RISC-V/RISC-V-Spec/test_add.cc | 489a07a47e81561ae32638ce6fb6d7783f50c9f7 | [
"MIT"
] | permissive | yuex1994/iw_imdb | fb60b616c696fde80db7b19c22ef1f212c2d19ef | 946ce12d1b28075bfc513b2baf0f30601d36558c | refs/heads/master | 2021-01-06T16:04:16.626959 | 2020-04-26T16:20:58 | 2020-04-26T16:20:58 | 241,388,900 | 1 | 1 | MIT | 2020-02-29T19:26:37 | 2020-02-18T14:55:52 | C++ | UTF-8 | C++ | false | false | 459 | cc | #include "riscv.h"
int main() {
riscv ila_;
ila_.riscv_pc = 0;
ila_.riscv_x0 = 0;
ila_.riscv_x1 = 1;
ila_.riscv_x2 = 2;
ila_.riscv_x3 = 3;
ila_.riscv_x4 = 4;
ila_.riscv_x5 = 5;
ila_.riscv_x6 = 6;
ila_.riscv_x7 = 7;
uint32_t inst = 0x00100133;
ila_.riscv_mem[0] = inst;
ila_.compute();
std::cout << ila_.riscv_x0 << std::endl;
std::cout << ila_.riscv_x1 << std::endl;
std::cout << ila_.riscv_x2 << std::endl;
return 0;
}
| [
"yuex@princeton.edu"
] | yuex@princeton.edu |
61cc25ded65755b3637773cb7101c8934ecff19e | 8bbeb7b5721a9dbf40caa47a96e6961ceabb0128 | /cpp/84.Largest Rectangle in Histogram(柱状图中最大的矩形).cpp | 46f0ba0e9b52481b32a884cf7fccc04af72d6b7b | [
"MIT"
] | permissive | lishulongVI/leetcode | bb5b75642f69dfaec0c2ee3e06369c715125b1ba | 6731e128be0fd3c0bdfe885c1a409ac54b929597 | refs/heads/master | 2020-03-23T22:17:40.335970 | 2018-07-23T14:46:06 | 2018-07-23T14:46:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,307 | cpp | /*
<p>Given <em>n</em> non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.</p>
<p><img src="https://leetcode.com/static/images/problemset/histogram.png" /><br />
<small>Above is a histogram where width of each bar is 1, given height = <code>[2,1,5,6,2,3]</code>.</small></p>
<p> </p>
<p><img src="https://leetcode.com/static/images/problemset/histogram_area.png" /><br />
<small>The largest rectangle is shown in the shaded area, which has area = <code>10</code> unit.</small></p>
<p> </p>
<p><strong>Example:</strong></p>
<pre>
<strong>Input:</strong> [2,1,5,6,2,3]
<strong>Output:</strong> 10
</pre>
<p>给定 <em>n</em> 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。</p>
<p>求在该柱状图中,能够勾勒出来的矩形的最大面积。</p>
<p><img src="/static/images/problemset/histogram.png"></p>
<p><small>以上是柱状图的示例,其中每个柱子的宽度为 1,给定的高度为 <code>[2,1,5,6,2,3]</code>。</small></p>
<p><img src="/static/images/problemset/histogram_area.png"></p>
<p><small>图中阴影部分为所能勾勒出的最大矩形面积,其面积为 <code>10</code> 个单位。</small></p>
<p> </p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> [2,1,5,6,2,3]
<strong>输出:</strong> 10</pre>
<p>给定 <em>n</em> 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。</p>
<p>求在该柱状图中,能够勾勒出来的矩形的最大面积。</p>
<p><img src="/static/images/problemset/histogram.png"></p>
<p><small>以上是柱状图的示例,其中每个柱子的宽度为 1,给定的高度为 <code>[2,1,5,6,2,3]</code>。</small></p>
<p><img src="/static/images/problemset/histogram_area.png"></p>
<p><small>图中阴影部分为所能勾勒出的最大矩形面积,其面积为 <code>10</code> 个单位。</small></p>
<p> </p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> [2,1,5,6,2,3]
<strong>输出:</strong> 10</pre>
*/
class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
}
}; | [
"lishulong@wecash.net"
] | lishulong@wecash.net |
afd87b7f94ffa487c6e175091c0fec654890b95d | d69f650bec897c69573e6f9d6104981a17129740 | /cnozzles.cpp | 42a0006ed2e275ddb771dd643953d4f72c8790cb | [] | no_license | Caprock-Instruments/Pick-n-Place | 24053cefb0fcab8641878b786232ac2451231f80 | cdce9ad97f977e2977f5dc13f9712f68ba0529ef | refs/heads/master | 2021-01-19T21:29:32.565112 | 2017-04-20T12:07:55 | 2017-04-20T12:07:55 | 88,658,587 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 110 | cpp | #include "cnozzles.h"
cNozzles::cNozzles()
{
}
bool cNozzles::insert_nozzle_into_list(cNozzle nozzle)
{
}
| [
"mathew.pelletier@ars.usda.gov"
] | mathew.pelletier@ars.usda.gov |
d63aa32a23312916525a5c896f78eb76fd049b59 | 75e49b7e53cf60c99b7ab338127028a457e2721b | /sources/plug_osg/src/luna/bind_osgViewer_CompositeViewer.cpp | e317ad4b4487efa94507d9df575e659851103e43 | [] | no_license | roche-emmanuel/singularity | 32f47813c90b9cd5655f3bead9997215cbf02d6a | e9165d68fc09d2767e8acb1e9e0493a014b87399 | refs/heads/master | 2021-01-12T01:21:39.961949 | 2012-10-05T10:48:21 | 2012-10-05T10:48:21 | 78,375,325 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 51,503 | cpp | #include <plug_common.h>
class luna_wrapper_osgViewer_CompositeViewer {
public:
typedef Luna< osgViewer::CompositeViewer > luna_t;
// Derived class converters:
static int _cast_from_Referenced(lua_State *L) {
// all checked are already performed before reaching this point.
osgViewer::CompositeViewer* ptr= dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!ptr)
return 0;
// Otherwise push the pointer:
Luna< osgViewer::CompositeViewer >::push(L,ptr,false);
return 1;
};
// Constructor checkers:
inline static bool _lg_typecheck_ctor_overload_1(lua_State *L) {
if( lua_gettop(L)!=0 ) return false;
return true;
}
inline static bool _lg_typecheck_ctor_overload_2(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<1 || luatop>2 ) return false;
if( !Luna<void>::has_uniqueid(L,1,50169651) ) return false;
if( luatop>1 && !Luna<void>::has_uniqueid(L,2,27134364) ) return false;
return true;
}
inline static bool _lg_typecheck_ctor_overload_3(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
if( !Luna<void>::has_uniqueid(L,1,99527028) ) return false;
return true;
}
// Function checkers:
inline static bool _lg_typecheck_cloneType(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_clone(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( !Luna<void>::has_uniqueid(L,2,27134364) ) return false;
return true;
}
inline static bool _lg_typecheck_isSameKindAs(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnil(L,2)==0 && !Luna<void>::has_uniqueid(L,2,50169651)) ) return false;
return true;
}
inline static bool _lg_typecheck_libraryName(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_className(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_readConfiguration(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( lua_isstring(L,2)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_setViewerStats(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnil(L,2)==0 && !Luna<void>::has_uniqueid(L,2,50169651)) ) return false;
return true;
}
inline static bool _lg_typecheck_getViewerStats_overload_1(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getViewerStats_overload_2(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_addView(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnil(L,2)==0 && !Luna<void>::has_uniqueid(L,2,50169651)) ) return false;
return true;
}
inline static bool _lg_typecheck_removeView(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnil(L,2)==0 && !Luna<void>::has_uniqueid(L,2,50169651)) ) return false;
return true;
}
inline static bool _lg_typecheck_getView_overload_1(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnumber(L,2)==0 || lua_tointeger(L,2) != lua_tonumber(L,2)) ) return false;
return true;
}
inline static bool _lg_typecheck_getView_overload_2(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnumber(L,2)==0 || lua_tointeger(L,2) != lua_tonumber(L,2)) ) return false;
return true;
}
inline static bool _lg_typecheck_getNumViews(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_isRealized(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_realize(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_setStartTick(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnumber(L,2)==0 || lua_tointeger(L,2) != lua_tonumber(L,2)) ) return false;
return true;
}
inline static bool _lg_typecheck_setReferenceTime(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<1 || luatop>2 ) return false;
if( luatop>1 && lua_isnumber(L,2)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_getFrameStamp_overload_1(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getFrameStamp_overload_2(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_elapsedTime(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getViewerFrameStamp(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_run(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_checkNeedToDoFrame(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_advance(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<1 || luatop>2 ) return false;
if( luatop>1 && lua_isnumber(L,2)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_eventTraversal(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_updateTraversal(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_setCameraWithFocus(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( (lua_isnil(L,2)==0 && !Luna<void>::has_uniqueid(L,2,50169651)) ) return false;
return true;
}
inline static bool _lg_typecheck_getCameraWithFocus_overload_1(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getCameraWithFocus_overload_2(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getViewWithFocus_overload_1(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getViewWithFocus_overload_2(lua_State *L) {
if( lua_gettop(L)!=1 ) return false;
return true;
}
inline static bool _lg_typecheck_getCameras(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<2 || luatop>3 ) return false;
if( !Luna<void>::has_uniqueid(L,2,18740017) ) return false;
if( luatop>2 && lua_isboolean(L,3)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_getContexts(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<2 || luatop>3 ) return false;
if( !Luna<void>::has_uniqueid(L,2,48105087) ) return false;
if( luatop>2 && lua_isboolean(L,3)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_getScenes(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<2 || luatop>3 ) return false;
if( !Luna<void>::has_uniqueid(L,2,98997480) ) return false;
if( luatop>2 && lua_isboolean(L,3)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_getViews(lua_State *L) {
int luatop = lua_gettop(L);
if( luatop<2 || luatop>3 ) return false;
if( !Luna<void>::has_uniqueid(L,2,2917259) ) return false;
if( luatop>2 && lua_isboolean(L,3)==0 ) return false;
return true;
}
inline static bool _lg_typecheck_getUsage(lua_State *L) {
if( lua_gettop(L)!=2 ) return false;
if( !Luna<void>::has_uniqueid(L,2,50169651) ) return false;
return true;
}
// Operator checkers:
// (found 0 valid operators)
// Constructor binds:
// osgViewer::CompositeViewer::CompositeViewer()
static osgViewer::CompositeViewer* _bind_ctor_overload_1(lua_State *L) {
if (!_lg_typecheck_ctor_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osgViewer::CompositeViewer::CompositeViewer() function, expected prototype:\nosgViewer::CompositeViewer::CompositeViewer()\nClass arguments details:\n");
}
return new osgViewer::CompositeViewer();
}
// osgViewer::CompositeViewer::CompositeViewer(const osgViewer::CompositeViewer & , const osg::CopyOp & copyop = osg::CopyOp::SHALLOW_COPY)
static osgViewer::CompositeViewer* _bind_ctor_overload_2(lua_State *L) {
if (!_lg_typecheck_ctor_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osgViewer::CompositeViewer::CompositeViewer(const osgViewer::CompositeViewer & , const osg::CopyOp & copyop = osg::CopyOp::SHALLOW_COPY) function, expected prototype:\nosgViewer::CompositeViewer::CompositeViewer(const osgViewer::CompositeViewer & , const osg::CopyOp & copyop = osg::CopyOp::SHALLOW_COPY)\nClass arguments details:\narg 1 ID = 50169651\narg 2 ID = 27134364\n");
}
int luatop = lua_gettop(L);
const osgViewer::CompositeViewer* _arg1_ptr=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if( !_arg1_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg _arg1 in osgViewer::CompositeViewer::CompositeViewer function");
}
const osgViewer::CompositeViewer & _arg1=*_arg1_ptr;
const osg::CopyOp* copyop_ptr=luatop>1 ? (Luna< osg::CopyOp >::check(L,2)) : NULL;
if( luatop>1 && !copyop_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg copyop in osgViewer::CompositeViewer::CompositeViewer function");
}
const osg::CopyOp & copyop=luatop>1 ? *copyop_ptr : osg::CopyOp::SHALLOW_COPY;
return new osgViewer::CompositeViewer(_arg1, copyop);
}
// osgViewer::CompositeViewer::CompositeViewer(osg::ArgumentParser & arguments)
static osgViewer::CompositeViewer* _bind_ctor_overload_3(lua_State *L) {
if (!_lg_typecheck_ctor_overload_3(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osgViewer::CompositeViewer::CompositeViewer(osg::ArgumentParser & arguments) function, expected prototype:\nosgViewer::CompositeViewer::CompositeViewer(osg::ArgumentParser & arguments)\nClass arguments details:\narg 1 ID = 99527028\n");
}
osg::ArgumentParser* arguments_ptr=(Luna< osg::ArgumentParser >::check(L,1));
if( !arguments_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg arguments in osgViewer::CompositeViewer::CompositeViewer function");
}
osg::ArgumentParser & arguments=*arguments_ptr;
return new osgViewer::CompositeViewer(arguments);
}
// Overload binder for osgViewer::CompositeViewer::CompositeViewer
static osgViewer::CompositeViewer* _bind_ctor(lua_State *L) {
if (_lg_typecheck_ctor_overload_1(L)) return _bind_ctor_overload_1(L);
if (_lg_typecheck_ctor_overload_2(L)) return _bind_ctor_overload_2(L);
if (_lg_typecheck_ctor_overload_3(L)) return _bind_ctor_overload_3(L);
luaL_error(L, "error in function CompositeViewer, cannot match any of the overloads for function CompositeViewer:\n CompositeViewer()\n CompositeViewer(const osgViewer::CompositeViewer &, const osg::CopyOp &)\n CompositeViewer(osg::ArgumentParser &)\n");
return NULL;
}
// Function binds:
// osg::Object * osgViewer::CompositeViewer::cloneType() const
static int _bind_cloneType(lua_State *L) {
if (!_lg_typecheck_cloneType(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::Object * osgViewer::CompositeViewer::cloneType() const function, expected prototype:\nosg::Object * osgViewer::CompositeViewer::cloneType() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::Object * osgViewer::CompositeViewer::cloneType() const");
}
osg::Object * lret = self->cloneType();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Object >::push(L,lret,false);
return 1;
}
// osg::Object * osgViewer::CompositeViewer::clone(const osg::CopyOp & ) const
static int _bind_clone(lua_State *L) {
if (!_lg_typecheck_clone(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::Object * osgViewer::CompositeViewer::clone(const osg::CopyOp & ) const function, expected prototype:\nosg::Object * osgViewer::CompositeViewer::clone(const osg::CopyOp & ) const\nClass arguments details:\narg 1 ID = 27134364\n");
}
const osg::CopyOp* _arg1_ptr=(Luna< osg::CopyOp >::check(L,2));
if( !_arg1_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg _arg1 in osgViewer::CompositeViewer::clone function");
}
const osg::CopyOp & _arg1=*_arg1_ptr;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::Object * osgViewer::CompositeViewer::clone(const osg::CopyOp &) const");
}
osg::Object * lret = self->clone(_arg1);
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Object >::push(L,lret,false);
return 1;
}
// bool osgViewer::CompositeViewer::isSameKindAs(const osg::Object * obj) const
static int _bind_isSameKindAs(lua_State *L) {
if (!_lg_typecheck_isSameKindAs(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in bool osgViewer::CompositeViewer::isSameKindAs(const osg::Object * obj) const function, expected prototype:\nbool osgViewer::CompositeViewer::isSameKindAs(const osg::Object * obj) const\nClass arguments details:\narg 1 ID = 50169651\n");
}
const osg::Object* obj=dynamic_cast< osg::Object* >(Luna< osg::Referenced >::check(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call bool osgViewer::CompositeViewer::isSameKindAs(const osg::Object *) const");
}
bool lret = self->isSameKindAs(obj);
lua_pushboolean(L,lret?1:0);
return 1;
}
// const char * osgViewer::CompositeViewer::libraryName() const
static int _bind_libraryName(lua_State *L) {
if (!_lg_typecheck_libraryName(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const char * osgViewer::CompositeViewer::libraryName() const function, expected prototype:\nconst char * osgViewer::CompositeViewer::libraryName() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const char * osgViewer::CompositeViewer::libraryName() const");
}
const char * lret = self->libraryName();
lua_pushstring(L,lret);
return 1;
}
// const char * osgViewer::CompositeViewer::className() const
static int _bind_className(lua_State *L) {
if (!_lg_typecheck_className(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const char * osgViewer::CompositeViewer::className() const function, expected prototype:\nconst char * osgViewer::CompositeViewer::className() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const char * osgViewer::CompositeViewer::className() const");
}
const char * lret = self->className();
lua_pushstring(L,lret);
return 1;
}
// bool osgViewer::CompositeViewer::readConfiguration(const std::string & filename)
static int _bind_readConfiguration(lua_State *L) {
if (!_lg_typecheck_readConfiguration(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in bool osgViewer::CompositeViewer::readConfiguration(const std::string & filename) function, expected prototype:\nbool osgViewer::CompositeViewer::readConfiguration(const std::string & filename)\nClass arguments details:\n");
}
std::string filename(lua_tostring(L,2),lua_objlen(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call bool osgViewer::CompositeViewer::readConfiguration(const std::string &)");
}
bool lret = self->readConfiguration(filename);
lua_pushboolean(L,lret?1:0);
return 1;
}
// void osgViewer::CompositeViewer::setViewerStats(osg::Stats * stats)
static int _bind_setViewerStats(lua_State *L) {
if (!_lg_typecheck_setViewerStats(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::setViewerStats(osg::Stats * stats) function, expected prototype:\nvoid osgViewer::CompositeViewer::setViewerStats(osg::Stats * stats)\nClass arguments details:\narg 1 ID = 50169651\n");
}
osg::Stats* stats=dynamic_cast< osg::Stats* >(Luna< osg::Referenced >::check(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::setViewerStats(osg::Stats *)");
}
self->setViewerStats(stats);
return 0;
}
// osg::Stats * osgViewer::CompositeViewer::getViewerStats()
static int _bind_getViewerStats_overload_1(lua_State *L) {
if (!_lg_typecheck_getViewerStats_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::Stats * osgViewer::CompositeViewer::getViewerStats() function, expected prototype:\nosg::Stats * osgViewer::CompositeViewer::getViewerStats()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::Stats * osgViewer::CompositeViewer::getViewerStats()");
}
osg::Stats * lret = self->getViewerStats();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Stats >::push(L,lret,false);
return 1;
}
// const osg::Stats * osgViewer::CompositeViewer::getViewerStats() const
static int _bind_getViewerStats_overload_2(lua_State *L) {
if (!_lg_typecheck_getViewerStats_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const osg::Stats * osgViewer::CompositeViewer::getViewerStats() const function, expected prototype:\nconst osg::Stats * osgViewer::CompositeViewer::getViewerStats() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const osg::Stats * osgViewer::CompositeViewer::getViewerStats() const");
}
const osg::Stats * lret = self->getViewerStats();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Stats >::push(L,lret,false);
return 1;
}
// Overload binder for osgViewer::CompositeViewer::getViewerStats
static int _bind_getViewerStats(lua_State *L) {
if (_lg_typecheck_getViewerStats_overload_1(L)) return _bind_getViewerStats_overload_1(L);
if (_lg_typecheck_getViewerStats_overload_2(L)) return _bind_getViewerStats_overload_2(L);
luaL_error(L, "error in function getViewerStats, cannot match any of the overloads for function getViewerStats:\n getViewerStats()\n getViewerStats()\n");
return 0;
}
// void osgViewer::CompositeViewer::addView(osgViewer::View * view)
static int _bind_addView(lua_State *L) {
if (!_lg_typecheck_addView(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::addView(osgViewer::View * view) function, expected prototype:\nvoid osgViewer::CompositeViewer::addView(osgViewer::View * view)\nClass arguments details:\narg 1 ID = 50169651\n");
}
osgViewer::View* view=dynamic_cast< osgViewer::View* >(Luna< osg::Referenced >::check(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::addView(osgViewer::View *)");
}
self->addView(view);
return 0;
}
// void osgViewer::CompositeViewer::removeView(osgViewer::View * view)
static int _bind_removeView(lua_State *L) {
if (!_lg_typecheck_removeView(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::removeView(osgViewer::View * view) function, expected prototype:\nvoid osgViewer::CompositeViewer::removeView(osgViewer::View * view)\nClass arguments details:\narg 1 ID = 50169651\n");
}
osgViewer::View* view=dynamic_cast< osgViewer::View* >(Luna< osg::Referenced >::check(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::removeView(osgViewer::View *)");
}
self->removeView(view);
return 0;
}
// osgViewer::View * osgViewer::CompositeViewer::getView(unsigned i)
static int _bind_getView_overload_1(lua_State *L) {
if (!_lg_typecheck_getView_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osgViewer::View * osgViewer::CompositeViewer::getView(unsigned i) function, expected prototype:\nosgViewer::View * osgViewer::CompositeViewer::getView(unsigned i)\nClass arguments details:\n");
}
unsigned i=(unsigned)lua_tointeger(L,2);
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osgViewer::View * osgViewer::CompositeViewer::getView(unsigned)");
}
osgViewer::View * lret = self->getView(i);
if(!lret) return 0; // Do not write NULL pointers.
Luna< osgViewer::View >::push(L,lret,false);
return 1;
}
// const osgViewer::View * osgViewer::CompositeViewer::getView(unsigned i) const
static int _bind_getView_overload_2(lua_State *L) {
if (!_lg_typecheck_getView_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const osgViewer::View * osgViewer::CompositeViewer::getView(unsigned i) const function, expected prototype:\nconst osgViewer::View * osgViewer::CompositeViewer::getView(unsigned i) const\nClass arguments details:\n");
}
unsigned i=(unsigned)lua_tointeger(L,2);
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const osgViewer::View * osgViewer::CompositeViewer::getView(unsigned) const");
}
const osgViewer::View * lret = self->getView(i);
if(!lret) return 0; // Do not write NULL pointers.
Luna< osgViewer::View >::push(L,lret,false);
return 1;
}
// Overload binder for osgViewer::CompositeViewer::getView
static int _bind_getView(lua_State *L) {
if (_lg_typecheck_getView_overload_1(L)) return _bind_getView_overload_1(L);
if (_lg_typecheck_getView_overload_2(L)) return _bind_getView_overload_2(L);
luaL_error(L, "error in function getView, cannot match any of the overloads for function getView:\n getView(unsigned)\n getView(unsigned)\n");
return 0;
}
// unsigned int osgViewer::CompositeViewer::getNumViews() const
static int _bind_getNumViews(lua_State *L) {
if (!_lg_typecheck_getNumViews(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in unsigned int osgViewer::CompositeViewer::getNumViews() const function, expected prototype:\nunsigned int osgViewer::CompositeViewer::getNumViews() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call unsigned int osgViewer::CompositeViewer::getNumViews() const");
}
unsigned int lret = self->getNumViews();
lua_pushnumber(L,lret);
return 1;
}
// bool osgViewer::CompositeViewer::isRealized() const
static int _bind_isRealized(lua_State *L) {
if (!_lg_typecheck_isRealized(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in bool osgViewer::CompositeViewer::isRealized() const function, expected prototype:\nbool osgViewer::CompositeViewer::isRealized() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call bool osgViewer::CompositeViewer::isRealized() const");
}
bool lret = self->isRealized();
lua_pushboolean(L,lret?1:0);
return 1;
}
// void osgViewer::CompositeViewer::realize()
static int _bind_realize(lua_State *L) {
if (!_lg_typecheck_realize(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::realize() function, expected prototype:\nvoid osgViewer::CompositeViewer::realize()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::realize()");
}
self->realize();
return 0;
}
// void osgViewer::CompositeViewer::setStartTick(unsigned long long tick)
static int _bind_setStartTick(lua_State *L) {
if (!_lg_typecheck_setStartTick(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::setStartTick(unsigned long long tick) function, expected prototype:\nvoid osgViewer::CompositeViewer::setStartTick(unsigned long long tick)\nClass arguments details:\n");
}
unsigned long long tick=(unsigned long long)lua_tointeger(L,2);
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::setStartTick(unsigned long long)");
}
self->setStartTick(tick);
return 0;
}
// void osgViewer::CompositeViewer::setReferenceTime(double time = 0.0)
static int _bind_setReferenceTime(lua_State *L) {
if (!_lg_typecheck_setReferenceTime(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::setReferenceTime(double time = 0.0) function, expected prototype:\nvoid osgViewer::CompositeViewer::setReferenceTime(double time = 0.0)\nClass arguments details:\n");
}
int luatop = lua_gettop(L);
double time=luatop>1 ? (double)lua_tonumber(L,2) : 0.0;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::setReferenceTime(double)");
}
self->setReferenceTime(time);
return 0;
}
// osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp()
static int _bind_getFrameStamp_overload_1(lua_State *L) {
if (!_lg_typecheck_getFrameStamp_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp() function, expected prototype:\nosg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp()");
}
osg::FrameStamp * lret = self->getFrameStamp();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::FrameStamp >::push(L,lret,false);
return 1;
}
// const osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp() const
static int _bind_getFrameStamp_overload_2(lua_State *L) {
if (!_lg_typecheck_getFrameStamp_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp() const function, expected prototype:\nconst osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const osg::FrameStamp * osgViewer::CompositeViewer::getFrameStamp() const");
}
const osg::FrameStamp * lret = self->getFrameStamp();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::FrameStamp >::push(L,lret,false);
return 1;
}
// Overload binder for osgViewer::CompositeViewer::getFrameStamp
static int _bind_getFrameStamp(lua_State *L) {
if (_lg_typecheck_getFrameStamp_overload_1(L)) return _bind_getFrameStamp_overload_1(L);
if (_lg_typecheck_getFrameStamp_overload_2(L)) return _bind_getFrameStamp_overload_2(L);
luaL_error(L, "error in function getFrameStamp, cannot match any of the overloads for function getFrameStamp:\n getFrameStamp()\n getFrameStamp()\n");
return 0;
}
// double osgViewer::CompositeViewer::elapsedTime()
static int _bind_elapsedTime(lua_State *L) {
if (!_lg_typecheck_elapsedTime(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in double osgViewer::CompositeViewer::elapsedTime() function, expected prototype:\ndouble osgViewer::CompositeViewer::elapsedTime()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call double osgViewer::CompositeViewer::elapsedTime()");
}
double lret = self->elapsedTime();
lua_pushnumber(L,lret);
return 1;
}
// osg::FrameStamp * osgViewer::CompositeViewer::getViewerFrameStamp()
static int _bind_getViewerFrameStamp(lua_State *L) {
if (!_lg_typecheck_getViewerFrameStamp(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::FrameStamp * osgViewer::CompositeViewer::getViewerFrameStamp() function, expected prototype:\nosg::FrameStamp * osgViewer::CompositeViewer::getViewerFrameStamp()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::FrameStamp * osgViewer::CompositeViewer::getViewerFrameStamp()");
}
osg::FrameStamp * lret = self->getViewerFrameStamp();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::FrameStamp >::push(L,lret,false);
return 1;
}
// int osgViewer::CompositeViewer::run()
static int _bind_run(lua_State *L) {
if (!_lg_typecheck_run(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in int osgViewer::CompositeViewer::run() function, expected prototype:\nint osgViewer::CompositeViewer::run()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call int osgViewer::CompositeViewer::run()");
}
int lret = self->run();
lua_pushnumber(L,lret);
return 1;
}
// bool osgViewer::CompositeViewer::checkNeedToDoFrame()
static int _bind_checkNeedToDoFrame(lua_State *L) {
if (!_lg_typecheck_checkNeedToDoFrame(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in bool osgViewer::CompositeViewer::checkNeedToDoFrame() function, expected prototype:\nbool osgViewer::CompositeViewer::checkNeedToDoFrame()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call bool osgViewer::CompositeViewer::checkNeedToDoFrame()");
}
bool lret = self->checkNeedToDoFrame();
lua_pushboolean(L,lret?1:0);
return 1;
}
// void osgViewer::CompositeViewer::advance(double simulationTime = DBL_MAX)
static int _bind_advance(lua_State *L) {
if (!_lg_typecheck_advance(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::advance(double simulationTime = DBL_MAX) function, expected prototype:\nvoid osgViewer::CompositeViewer::advance(double simulationTime = DBL_MAX)\nClass arguments details:\n");
}
int luatop = lua_gettop(L);
double simulationTime=luatop>1 ? (double)lua_tonumber(L,2) : DBL_MAX;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::advance(double)");
}
self->advance(simulationTime);
return 0;
}
// void osgViewer::CompositeViewer::eventTraversal()
static int _bind_eventTraversal(lua_State *L) {
if (!_lg_typecheck_eventTraversal(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::eventTraversal() function, expected prototype:\nvoid osgViewer::CompositeViewer::eventTraversal()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::eventTraversal()");
}
self->eventTraversal();
return 0;
}
// void osgViewer::CompositeViewer::updateTraversal()
static int _bind_updateTraversal(lua_State *L) {
if (!_lg_typecheck_updateTraversal(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::updateTraversal() function, expected prototype:\nvoid osgViewer::CompositeViewer::updateTraversal()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::updateTraversal()");
}
self->updateTraversal();
return 0;
}
// void osgViewer::CompositeViewer::setCameraWithFocus(osg::Camera * camera)
static int _bind_setCameraWithFocus(lua_State *L) {
if (!_lg_typecheck_setCameraWithFocus(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::setCameraWithFocus(osg::Camera * camera) function, expected prototype:\nvoid osgViewer::CompositeViewer::setCameraWithFocus(osg::Camera * camera)\nClass arguments details:\narg 1 ID = 50169651\n");
}
osg::Camera* camera=dynamic_cast< osg::Camera* >(Luna< osg::Referenced >::check(L,2));
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::setCameraWithFocus(osg::Camera *)");
}
self->setCameraWithFocus(camera);
return 0;
}
// osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus()
static int _bind_getCameraWithFocus_overload_1(lua_State *L) {
if (!_lg_typecheck_getCameraWithFocus_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus() function, expected prototype:\nosg::Camera * osgViewer::CompositeViewer::getCameraWithFocus()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus()");
}
osg::Camera * lret = self->getCameraWithFocus();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Camera >::push(L,lret,false);
return 1;
}
// const osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus() const
static int _bind_getCameraWithFocus_overload_2(lua_State *L) {
if (!_lg_typecheck_getCameraWithFocus_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus() const function, expected prototype:\nconst osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const osg::Camera * osgViewer::CompositeViewer::getCameraWithFocus() const");
}
const osg::Camera * lret = self->getCameraWithFocus();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osg::Camera >::push(L,lret,false);
return 1;
}
// Overload binder for osgViewer::CompositeViewer::getCameraWithFocus
static int _bind_getCameraWithFocus(lua_State *L) {
if (_lg_typecheck_getCameraWithFocus_overload_1(L)) return _bind_getCameraWithFocus_overload_1(L);
if (_lg_typecheck_getCameraWithFocus_overload_2(L)) return _bind_getCameraWithFocus_overload_2(L);
luaL_error(L, "error in function getCameraWithFocus, cannot match any of the overloads for function getCameraWithFocus:\n getCameraWithFocus()\n getCameraWithFocus()\n");
return 0;
}
// osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus()
static int _bind_getViewWithFocus_overload_1(lua_State *L) {
if (!_lg_typecheck_getViewWithFocus_overload_1(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus() function, expected prototype:\nosgViewer::View * osgViewer::CompositeViewer::getViewWithFocus()\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus()");
}
osgViewer::View * lret = self->getViewWithFocus();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osgViewer::View >::push(L,lret,false);
return 1;
}
// const osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus() const
static int _bind_getViewWithFocus_overload_2(lua_State *L) {
if (!_lg_typecheck_getViewWithFocus_overload_2(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in const osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus() const function, expected prototype:\nconst osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus() const\nClass arguments details:\n");
}
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call const osgViewer::View * osgViewer::CompositeViewer::getViewWithFocus() const");
}
const osgViewer::View * lret = self->getViewWithFocus();
if(!lret) return 0; // Do not write NULL pointers.
Luna< osgViewer::View >::push(L,lret,false);
return 1;
}
// Overload binder for osgViewer::CompositeViewer::getViewWithFocus
static int _bind_getViewWithFocus(lua_State *L) {
if (_lg_typecheck_getViewWithFocus_overload_1(L)) return _bind_getViewWithFocus_overload_1(L);
if (_lg_typecheck_getViewWithFocus_overload_2(L)) return _bind_getViewWithFocus_overload_2(L);
luaL_error(L, "error in function getViewWithFocus, cannot match any of the overloads for function getViewWithFocus:\n getViewWithFocus()\n getViewWithFocus()\n");
return 0;
}
// void osgViewer::CompositeViewer::getCameras(osgViewer::ViewerBase::Cameras & cameras, bool onlyActive = true)
static int _bind_getCameras(lua_State *L) {
if (!_lg_typecheck_getCameras(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::getCameras(osgViewer::ViewerBase::Cameras & cameras, bool onlyActive = true) function, expected prototype:\nvoid osgViewer::CompositeViewer::getCameras(osgViewer::ViewerBase::Cameras & cameras, bool onlyActive = true)\nClass arguments details:\narg 1 ID = 18740017\n");
}
int luatop = lua_gettop(L);
osgViewer::ViewerBase::Cameras* cameras_ptr=(Luna< osgViewer::ViewerBase::Cameras >::check(L,2));
if( !cameras_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg cameras in osgViewer::CompositeViewer::getCameras function");
}
osgViewer::ViewerBase::Cameras & cameras=*cameras_ptr;
bool onlyActive=luatop>2 ? (bool)(lua_toboolean(L,3)==1) : true;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::getCameras(osgViewer::ViewerBase::Cameras &, bool)");
}
self->getCameras(cameras, onlyActive);
return 0;
}
// void osgViewer::CompositeViewer::getContexts(osgViewer::ViewerBase::Contexts & contexts, bool onlyValid = true)
static int _bind_getContexts(lua_State *L) {
if (!_lg_typecheck_getContexts(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::getContexts(osgViewer::ViewerBase::Contexts & contexts, bool onlyValid = true) function, expected prototype:\nvoid osgViewer::CompositeViewer::getContexts(osgViewer::ViewerBase::Contexts & contexts, bool onlyValid = true)\nClass arguments details:\narg 1 ID = 48105087\n");
}
int luatop = lua_gettop(L);
osgViewer::ViewerBase::Contexts* contexts_ptr=(Luna< osgViewer::ViewerBase::Contexts >::check(L,2));
if( !contexts_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg contexts in osgViewer::CompositeViewer::getContexts function");
}
osgViewer::ViewerBase::Contexts & contexts=*contexts_ptr;
bool onlyValid=luatop>2 ? (bool)(lua_toboolean(L,3)==1) : true;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::getContexts(osgViewer::ViewerBase::Contexts &, bool)");
}
self->getContexts(contexts, onlyValid);
return 0;
}
// void osgViewer::CompositeViewer::getScenes(osgViewer::ViewerBase::Scenes & scenes, bool onlyValid = true)
static int _bind_getScenes(lua_State *L) {
if (!_lg_typecheck_getScenes(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::getScenes(osgViewer::ViewerBase::Scenes & scenes, bool onlyValid = true) function, expected prototype:\nvoid osgViewer::CompositeViewer::getScenes(osgViewer::ViewerBase::Scenes & scenes, bool onlyValid = true)\nClass arguments details:\narg 1 ID = 98997480\n");
}
int luatop = lua_gettop(L);
osgViewer::ViewerBase::Scenes* scenes_ptr=(Luna< osgViewer::ViewerBase::Scenes >::check(L,2));
if( !scenes_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg scenes in osgViewer::CompositeViewer::getScenes function");
}
osgViewer::ViewerBase::Scenes & scenes=*scenes_ptr;
bool onlyValid=luatop>2 ? (bool)(lua_toboolean(L,3)==1) : true;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::getScenes(osgViewer::ViewerBase::Scenes &, bool)");
}
self->getScenes(scenes, onlyValid);
return 0;
}
// void osgViewer::CompositeViewer::getViews(osgViewer::ViewerBase::Views & views, bool onlyValid = true)
static int _bind_getViews(lua_State *L) {
if (!_lg_typecheck_getViews(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::getViews(osgViewer::ViewerBase::Views & views, bool onlyValid = true) function, expected prototype:\nvoid osgViewer::CompositeViewer::getViews(osgViewer::ViewerBase::Views & views, bool onlyValid = true)\nClass arguments details:\narg 1 ID = 2917259\n");
}
int luatop = lua_gettop(L);
osgViewer::ViewerBase::Views* views_ptr=(Luna< osgViewer::ViewerBase::Views >::check(L,2));
if( !views_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg views in osgViewer::CompositeViewer::getViews function");
}
osgViewer::ViewerBase::Views & views=*views_ptr;
bool onlyValid=luatop>2 ? (bool)(lua_toboolean(L,3)==1) : true;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::getViews(osgViewer::ViewerBase::Views &, bool)");
}
self->getViews(views, onlyValid);
return 0;
}
// void osgViewer::CompositeViewer::getUsage(osg::ApplicationUsage & usage) const
static int _bind_getUsage(lua_State *L) {
if (!_lg_typecheck_getUsage(L)) {
luna_printStack(L);
luaL_error(L, "luna typecheck failed in void osgViewer::CompositeViewer::getUsage(osg::ApplicationUsage & usage) const function, expected prototype:\nvoid osgViewer::CompositeViewer::getUsage(osg::ApplicationUsage & usage) const\nClass arguments details:\narg 1 ID = 50169651\n");
}
osg::ApplicationUsage* usage_ptr=dynamic_cast< osg::ApplicationUsage* >(Luna< osg::Referenced >::check(L,2));
if( !usage_ptr ) {
luaL_error(L, "Dereferencing NULL pointer for arg usage in osgViewer::CompositeViewer::getUsage function");
}
osg::ApplicationUsage & usage=*usage_ptr;
osgViewer::CompositeViewer* self=dynamic_cast< osgViewer::CompositeViewer* >(Luna< osg::Referenced >::check(L,1));
if(!self) {
luna_printStack(L);
luaL_error(L, "Invalid object in function call void osgViewer::CompositeViewer::getUsage(osg::ApplicationUsage &) const");
}
self->getUsage(usage);
return 0;
}
// Operator binds:
};
osgViewer::CompositeViewer* LunaTraits< osgViewer::CompositeViewer >::_bind_ctor(lua_State *L) {
return luna_wrapper_osgViewer_CompositeViewer::_bind_ctor(L);
}
void LunaTraits< osgViewer::CompositeViewer >::_bind_dtor(osgViewer::CompositeViewer* obj) {
osg::ref_ptr<osg::Referenced> refptr = obj;
}
const char LunaTraits< osgViewer::CompositeViewer >::className[] = "CompositeViewer";
const char LunaTraits< osgViewer::CompositeViewer >::fullName[] = "osgViewer::CompositeViewer";
const char LunaTraits< osgViewer::CompositeViewer >::moduleName[] = "osgViewer";
const char* LunaTraits< osgViewer::CompositeViewer >::parents[] = {"osgViewer.ViewerBase", 0};
const int LunaTraits< osgViewer::CompositeViewer >::hash = 98680734;
const int LunaTraits< osgViewer::CompositeViewer >::uniqueIDs[] = {50169651,0};
luna_RegType LunaTraits< osgViewer::CompositeViewer >::methods[] = {
{"cloneType", &luna_wrapper_osgViewer_CompositeViewer::_bind_cloneType},
{"clone", &luna_wrapper_osgViewer_CompositeViewer::_bind_clone},
{"isSameKindAs", &luna_wrapper_osgViewer_CompositeViewer::_bind_isSameKindAs},
{"libraryName", &luna_wrapper_osgViewer_CompositeViewer::_bind_libraryName},
{"className", &luna_wrapper_osgViewer_CompositeViewer::_bind_className},
{"readConfiguration", &luna_wrapper_osgViewer_CompositeViewer::_bind_readConfiguration},
{"setViewerStats", &luna_wrapper_osgViewer_CompositeViewer::_bind_setViewerStats},
{"getViewerStats", &luna_wrapper_osgViewer_CompositeViewer::_bind_getViewerStats},
{"addView", &luna_wrapper_osgViewer_CompositeViewer::_bind_addView},
{"removeView", &luna_wrapper_osgViewer_CompositeViewer::_bind_removeView},
{"getView", &luna_wrapper_osgViewer_CompositeViewer::_bind_getView},
{"getNumViews", &luna_wrapper_osgViewer_CompositeViewer::_bind_getNumViews},
{"isRealized", &luna_wrapper_osgViewer_CompositeViewer::_bind_isRealized},
{"realize", &luna_wrapper_osgViewer_CompositeViewer::_bind_realize},
{"setStartTick", &luna_wrapper_osgViewer_CompositeViewer::_bind_setStartTick},
{"setReferenceTime", &luna_wrapper_osgViewer_CompositeViewer::_bind_setReferenceTime},
{"getFrameStamp", &luna_wrapper_osgViewer_CompositeViewer::_bind_getFrameStamp},
{"elapsedTime", &luna_wrapper_osgViewer_CompositeViewer::_bind_elapsedTime},
{"getViewerFrameStamp", &luna_wrapper_osgViewer_CompositeViewer::_bind_getViewerFrameStamp},
{"run", &luna_wrapper_osgViewer_CompositeViewer::_bind_run},
{"checkNeedToDoFrame", &luna_wrapper_osgViewer_CompositeViewer::_bind_checkNeedToDoFrame},
{"advance", &luna_wrapper_osgViewer_CompositeViewer::_bind_advance},
{"eventTraversal", &luna_wrapper_osgViewer_CompositeViewer::_bind_eventTraversal},
{"updateTraversal", &luna_wrapper_osgViewer_CompositeViewer::_bind_updateTraversal},
{"setCameraWithFocus", &luna_wrapper_osgViewer_CompositeViewer::_bind_setCameraWithFocus},
{"getCameraWithFocus", &luna_wrapper_osgViewer_CompositeViewer::_bind_getCameraWithFocus},
{"getViewWithFocus", &luna_wrapper_osgViewer_CompositeViewer::_bind_getViewWithFocus},
{"getCameras", &luna_wrapper_osgViewer_CompositeViewer::_bind_getCameras},
{"getContexts", &luna_wrapper_osgViewer_CompositeViewer::_bind_getContexts},
{"getScenes", &luna_wrapper_osgViewer_CompositeViewer::_bind_getScenes},
{"getViews", &luna_wrapper_osgViewer_CompositeViewer::_bind_getViews},
{"getUsage", &luna_wrapper_osgViewer_CompositeViewer::_bind_getUsage},
{0,0}
};
luna_ConverterType LunaTraits< osgViewer::CompositeViewer >::converters[] = {
{"osg::Referenced", &luna_wrapper_osgViewer_CompositeViewer::_cast_from_Referenced},
{0,0}
};
luna_RegEnumType LunaTraits< osgViewer::CompositeViewer >::enumValues[] = {
{0,0}
};
| [
"roche.emmanuel@gmail.com"
] | roche.emmanuel@gmail.com |
cb38a78d9351d181ff40435d08f92442cf2ef0ce | 2aadfcf569ec9cc1496f5e6b4d6f14cc061eed64 | /New folder/crc.cpp | 049b650a9146708f19409ddf4cd6c5afca99e8ce | [] | no_license | yashj302/ERM | d107939af802031e96aac23b7d0599c59ae9f7a3 | 95d7d3e2e463c1ea01c0e6ff7007aa196bc9d7bf | refs/heads/master | 2020-03-26T10:55:16.282395 | 2018-02-04T20:54:21 | 2018-02-04T20:54:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,121 | cpp | #include <iostream>
using namespace std;
int main()
{
int i,j,k,l;
//Get Frame
int fs;
cout<<"\n Enter Frame size: ";
cin>>fs;
int f[20];
cout<<"\n Enter Frame:";
for(i=0;i<fs;i++)
{
cin>>f[i];
}
//Get Generator
int gs;
cout<<"\n Enter Generator size: ";
cin>>gs;
int g[20];
cout<<"\n Enter Generator:";
for(i=0;i<gs;i++)
{
cin>>g[i];
}
cout<<"\n Sender Side:";
cout<<"\n Frame: ";
for(i=0;i<fs;i++)
{
cout<<f[i];
}
cout<<"\n Generator :";
for(i=0;i<gs;i++)
{
cout<<g[i];
}
//Append 0's
int rs=gs-1;
cout<<"\n Number of 0's to be appended: "<<rs;
for (i=fs;i<fs+rs;i++)
{
f[i]=0;
}
int temp[20];
for(i=0;i<20;i++)
{
temp[i]=f[i];
}
cout<<"\n Message after appending 0's :";
for(i=0; i<fs+rs;i++)
{
cout<<temp[i];
}
//Division
for(i=0;i<fs;i++)
{
j=0;
k=i;
//check whether it is divisible or not
if (temp[k]>=g[j])
{
for(j=0,k=i;j<gs;j++,k++)
{
if((temp[k]==1 && g[j]==1) || (temp[k]==0 && g[j]==0))
{
temp[k]=0;
}
else
{
temp[k]=1;
}
}
}
}
//CRC
int crc[15];
for(i=0,j=fs;i<rs;i++,j++)
{
crc[i]=temp[j];
}
cout<<"\n CRC bits: ";
for(i=0;i<rs;i++)
{
cout<<crc[i];
}
cout<<"\n Transmitted Frame: ";
int tf[15];
for(i=0;i<fs;i++)
{
tf[i]=f[i];
}
for(i=fs,j=0;i<fs+rs;i++,j++)
{
tf[i]=crc[j];
}
for(i=0;i<fs+rs;i++)
{
cout<<tf[i];
}
/*------------------------------------------------------------------------------------
cout<<"\n Receiver side : ";
cout<<"\n Received Frame: ";
for(i=0;i<fs+rs;i++)
{
cout<<tf[i];
}
for(i=0;i<fs+rs;i++)
{
temp[i]=tf[i];
}
//Division
for(i=0;i<fs+rs;i++)
{
j=0;
k=i;
if (temp[k]>=g[j])
{
for(j=0,k=i;j<gs;j++,k++)
{
if((temp[k]==1 && g[j]==1) || (temp[k]==0 && g[j]==0))
{
temp[k]=0;
}
else
{
temp[k]=1;
}
}
}
}
cout<<"\n Reaminder: ";
int rrem[15];
for (i=fs,j=0;i<fs+rs;i++,j++)
{
rrem[j]= temp[i];
}
for(i=0;i<rs;i++)
{
cout<<rrem[i];
}
int flag=0;
for(i=0;i<rs;i++)
{
if(rrem[i]!=0)
{
flag=1;
}
}
if(flag==0)
{
cout<<"\n Since Remainder Is 0 Hence Message Transmitted From Sender To Receriver Is Correct";
}
else
{
cout<<"\n Since Remainder Is Not 0 Hence Message Transmitted From Sender To Receriver Contains Error";
}*/
}
| [
"cool_akshat@live.com"
] | cool_akshat@live.com |
ad8af1a63962d7758a331123a5ddc074cb78cdbb | 4aadb120c23f44519fbd5254e56fc91c0eb3772c | /Source/opensteer/include/OpenSteer/AbstractUpdated.h | 09c5be01916c6e3ff17ec1d15119181990a0dd2d | [
"MIT"
] | permissive | janfietz/edunetgames | d06cfb021d8f24cdcf3848a59cab694fbfd9c0ba | 04d787b0afca7c99b0f4c0692002b4abb8eea410 | refs/heads/master | 2016-09-10T19:24:04.051842 | 2011-04-17T11:00:09 | 2011-04-17T11:00:09 | 33,568,741 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,758 | h | #ifndef __ABSTRACTUPDATED_H__
#define __ABSTRACTUPDATED_H__
/*
* AbstractUpdated.h
* OpenSteer
*
* Created by Cyrus Preuss on 11/9/09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "OpenSteer/OpenSteerMacros.h"
#include "OpenSteer/OpenSteerTypes.h"
//-----------------------------------------------------------------------------
namespace OpenSteer {
//-------------------------------------------------------------------------
class AbstractUpdated {
public:
virtual ~AbstractUpdated( void ) { /* Nothing to do. */ }
virtual void updateCustom( AbstractUpdated* pkParent, const osScalar /*currentTime*/, const osScalar /*elapsedTime*/ ) OS_ABSTRACT;
virtual void update( const osScalar /*currentTime*/, const osScalar /*elapsedTime*/ ) OS_ABSTRACT;
virtual void setCustomUpdated( AbstractUpdated* ) OS_ABSTRACT;
virtual AbstractUpdated* getCustomUpdated( void ) const OS_ABSTRACT;
virtual bool isEnabled( void ) const OS_ABSTRACT;
virtual void setEnabled( bool bEnabled ) OS_ABSTRACT;
};
//-------------------------------------------------------------------------
template <class Super>
class AbstractUpdatedMixin : public Super {
public:
AbstractUpdatedMixin( ): m_pkCustomUpdated(0),m_bEnabled(true)
{
}
virtual ~AbstractUpdatedMixin(){}
//-------------------------------------------------------------------
// interface AbstractUpdated
//---------------------------------------------------------------------
virtual void updateCustom( AbstractUpdated* /*pkParent*/, const osScalar /*currentTime*/, const osScalar /*elapsedTime*/ )
{
// nothing to do here
return;
}
virtual void update( const osScalar currentTime, const osScalar elapsedTime )
{
if( 0 != this->m_pkCustomUpdated )
{
// in case the custom updater decides to call the base class
// prevent infinite recursion, store the custom updater locally
// and restore it once done with the update
AbstractUpdated* pkCustomUpdated = this->m_pkCustomUpdated;
this->m_pkCustomUpdated = 0;
pkCustomUpdated->updateCustom( this, currentTime, elapsedTime );
this->m_pkCustomUpdated = pkCustomUpdated;
}
}
virtual void setCustomUpdated( AbstractUpdated* pkUpdated )
{
this->m_pkCustomUpdated = pkUpdated;
}
virtual AbstractUpdated* getCustomUpdated( void ) const
{
return this->m_pkCustomUpdated;
}
virtual bool isEnabled( void ) const { return this->m_bEnabled; };
virtual void setEnabled( bool bEnabled ){ this->m_bEnabled = bEnabled; };
protected:
AbstractUpdated* m_pkCustomUpdated;
bool m_bEnabled;
};
}
#endif //! __ABSTRACTUPDATED_H__
| [
"janfietz@localhost"
] | janfietz@localhost |
da9382286beae72910e89371515fe4afdd8da1bb | 835934c3035770bd2fb0cea752bbe5c93b8ddc83 | /VTKHeaders/vtkDiscreteMarchingCubes.h | 70232080a10241e2bf58a6517cfb872edd6462da | [
"MIT"
] | permissive | jmah/OsiriX-Quad-Buffered-Stereo | d257c9fc1e9be01340fe652f5bf9d63f5c84cde1 | 096491358a5d4d8a0928dc03d7183ec129720c56 | refs/heads/master | 2016-09-05T11:08:48.274221 | 2007-05-02T15:06:45 | 2007-05-02T15:06:45 | 3,008,660 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,359 | h | /*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkDiscreteMarchingCubes.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
// .SECTION Thanks
// Jim Miller at GE Research implemented the original version of this
// filter.
// This work was supported by PHS Research Grant No. 1 P41 RR13218-01
// from the National Center for Research Resources and supported by a
// grant from the DARPA, executed by the U.S. Army Medical Research
// and Materiel Command/TATRC Cooperative Agreement,
// Contract # W81XWH-04-2-0012.
=========================================================================*/
// .NAME vtkDiscreteMarchingCubes - generate object boundaries from
// labelled volumes
// .SECTION Description vtkDiscreteMarchingCubes is a filter that
// takes as input a volume (e.g., 3D structured point set) of
// segmentation labels and generates on output one or more
// models representing the boundaries between the specified label and
// the adjacent structures. One or more label values must be specified to
// generate the models. The boundary positions are always defined to
// be half-way between adjacent voxels. This filter works best with
// integral scalar values.
// If ComputeScalars is on (the default), each output cell will have
// cell data that corresponds to the scalar value (segmentation label)
// of the corresponding cube. Note that this differs from vtkMarchingCubes,
// which stores the scalar value as point data. The rationale for this
// difference is that cell vertices may be shared between multiple
// cells. This also means that the resultant polydata may be
// non-manifold (cell faces may be coincident). To further process the
// polydata, users should either: 1) extract cells that have a common
// scalar value using vtkThreshold, or 2) process the data with
// filters that can handle non-manifold polydata
// (e.g. vtkWindowedSincPolyDataFilter).
// Also note, Normals and Gradients are not computed.
// .SECTION Caveats
// This filter is specialized to volumes. If you are interested in
// contouring other types of data, use the general vtkContourFilter. If you
// want to contour an image (i.e., a volume slice), use vtkMarchingSquares.
// .SECTION See Also
// vtkContourFilter vtkSliceCubes vtkMarchingSquares vtkDividingCubes
#ifndef __vtkDiscreteMarchingCubes_h
#define __vtkDiscreteMarchingCubes_h
#include "vtkMarchingCubes.h"
class VTK_GRAPHICS_EXPORT vtkDiscreteMarchingCubes : public vtkMarchingCubes
{
public:
static vtkDiscreteMarchingCubes *New();
vtkTypeRevisionMacro(vtkDiscreteMarchingCubes,vtkMarchingCubes);
protected:
vtkDiscreteMarchingCubes();
~vtkDiscreteMarchingCubes();
virtual int RequestData(vtkInformation *, vtkInformationVector **,
vtkInformationVector *);
private:
vtkDiscreteMarchingCubes(const vtkDiscreteMarchingCubes&); // Not implemented.
void operator=(const vtkDiscreteMarchingCubes&); // Not implemented.
};
#endif
| [
"me@JonathonMah.com"
] | me@JonathonMah.com |
5306ce33c63abde20c3da7e0eac65a4ee45394d7 | d4cb5e7108e895aae2bde1c84bc6bbc103e3ef5c | /1256. 별 출력하기.cpp | 42e051ddbd91ea3d08d1d76e8277c48871942139 | [] | no_license | KamiPer/Code-Up | 6309776d71a030aec5a97ba3b51fcd49c080a002 | d2ec393e33f62edfc304e9feccb11915e428f8f2 | refs/heads/master | 2020-03-27T08:30:09.354811 | 2018-10-11T11:14:09 | 2018-10-11T11:14:09 | 146,261,236 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 101 | cpp | #include <stdio.h>
int main()
{
int a, i;
scanf("%d", &a);
for(i=0; i<a; i++)
printf("*");
}
| [
"gorjs3540@naver.com"
] | gorjs3540@naver.com |
543ecae4b9f91085fff35394dd136ea292134640 | 9454edee573fe825bca7305d31aa54eda7f124d7 | /mars/mars/boost/detail/winapi/time.hpp | 1e0fe32533a67607be139112b9a6572032d9059f | [
"MIT",
"Zlib",
"LicenseRef-scancode-unknown-license-reference",
"OpenSSL",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"BSL-1.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | AdrianAndroid/lib_android | e8e003175981d538deed8edd8de4c4a04a5e3bc8 | 29abe76e788113ab8a2a4b5f52645ce5d5a5041d | refs/heads/main | 2023-07-16T13:17:29.911772 | 2021-08-24T02:47:43 | 2021-08-24T02:47:43 | 399,311,681 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,318 | hpp | // time.hpp --------------------------------------------------------------//
// Copyright 2010 Vicente J. Botet Escriba
// Copyright (c) Microsoft Corporation 2014
// Copyright 2015 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_DETAIL_WINAPI_TIME_HPP
#define BOOST_DETAIL_WINAPI_TIME_HPP
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/predef/platform.h>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if !defined( BOOST_USE_WINDOWS_H )
extern "C" {
struct _FILETIME;
struct _SYSTEMTIME;
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::VOID_ WINAPI
GetSystemTime(::_SYSTEMTIME* lpSystemTime);
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::VOID_ WINAPI
GetSystemTimeAsFileTime(::_FILETIME* lpSystemTimeAsFileTime);
#endif
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::BOOL_ WINAPI
SystemTimeToFileTime(
const ::_SYSTEMTIME* lpSystemTime,
::_FILETIME* lpFileTime);
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::BOOL_ WINAPI
FileTimeToSystemTime(
const ::_FILETIME* lpFileTime,
::_SYSTEMTIME* lpSystemTime);
#if BOOST_PLAT_WINDOWS_DESKTOP
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::BOOL_ WINAPI
FileTimeToLocalFileTime(
const ::_FILETIME* lpFileTime,
::_FILETIME* lpLocalFileTime);
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::BOOL_ WINAPI
LocalFileTimeToFileTime(
const ::_FILETIME* lpLocalFileTime,
::_FILETIME* lpFileTime);
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::DWORD_ WINAPI
GetTickCount(BOOST_DETAIL_WINAPI_VOID);
#endif
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
BOOST_SYMBOL_IMPORT mars_boost::detail::winapi::ULONGLONG_ WINAPI
GetTickCount64(BOOST_DETAIL_WINAPI_VOID);
#endif
}
#endif
namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
namespace detail {
namespace winapi {
typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _FILETIME {
DWORD_ dwLowDateTime;
DWORD_ dwHighDateTime;
} FILETIME_, *PFILETIME_, *LPFILETIME_;
typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _SYSTEMTIME {
WORD_ wYear;
WORD_ wMonth;
WORD_ wDayOfWeek;
WORD_ wDay;
WORD_ wHour;
WORD_ wMinute;
WORD_ wSecond;
WORD_ wMilliseconds;
} SYSTEMTIME_, *PSYSTEMTIME_, *LPSYSTEMTIME_;
#if BOOST_PLAT_WINDOWS_DESKTOP
using ::GetTickCount;
#endif
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
using ::GetTickCount64;
#endif
BOOST_FORCEINLINE VOID_ GetSystemTime(LPSYSTEMTIME_ lpSystemTime)
{
::GetSystemTime(reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime));
}
#if defined( BOOST_HAS_GETSYSTEMTIMEASFILETIME )
BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(LPFILETIME_ lpSystemTimeAsFileTime)
{
::GetSystemTimeAsFileTime(reinterpret_cast< ::_FILETIME* >(lpSystemTimeAsFileTime));
}
#else
// Windows CE does not define GetSystemTimeAsFileTime
BOOST_FORCEINLINE VOID_ GetSystemTimeAsFileTime(FILETIME_* lpFileTime)
{
mars_boost::detail::winapi::SYSTEMTIME_ st;
mars_boost::detail::winapi::GetSystemTime(&st);
mars_boost::detail::winapi::SystemTimeToFileTime(&st, lpFileTime);
}
#endif
BOOST_FORCEINLINE BOOL_ SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, FILETIME_* lpFileTime)
{
return ::SystemTimeToFileTime(reinterpret_cast< const ::_SYSTEMTIME* >(lpSystemTime), reinterpret_cast< ::_FILETIME* >(lpFileTime));
}
BOOST_FORCEINLINE BOOL_ FileTimeToSystemTime(const FILETIME_* lpFileTime, SYSTEMTIME_* lpSystemTime)
{
return ::FileTimeToSystemTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_SYSTEMTIME* >(lpSystemTime));
}
#if BOOST_PLAT_WINDOWS_DESKTOP
BOOST_FORCEINLINE BOOL_ FileTimeToLocalFileTime(const FILETIME_* lpFileTime, FILETIME_* lpLocalFileTime)
{
return ::FileTimeToLocalFileTime(reinterpret_cast< const ::_FILETIME* >(lpFileTime), reinterpret_cast< ::_FILETIME* >(lpLocalFileTime));
}
BOOST_FORCEINLINE BOOL_ LocalFileTimeToFileTime(const FILETIME_* lpLocalFileTime, FILETIME_* lpFileTime)
{
return ::LocalFileTimeToFileTime(reinterpret_cast< const ::_FILETIME* >(lpLocalFileTime), reinterpret_cast< ::_FILETIME* >(lpFileTime));
}
#endif
}
}
}
#endif // BOOST_DETAIL_WINAPI_TIME_HPP
| [
"zhaojian2@joyy.sg"
] | zhaojian2@joyy.sg |
c8b00ab26ef1d3f7755fc1c711a854bc4f551e1c | 065996eac67c8808ec47f7917859f3cdaaea0a3d | /piLibsCpp/src/libSound/windows/piSoundEngineOVR.h | bde397cea2c273f8ea11aa4b1d91410d78d21913 | [] | no_license | narendraumate/piLibs-1 | da414c87f1f310ff6add33f7cbe7c752a0f8d2a5 | 1b1c5e7d9843daee452ad9fdd14974c14df09e33 | refs/heads/master | 2021-06-19T12:49:45.922383 | 2017-07-20T21:39:00 | 2017-07-20T21:39:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,845 | h | #pragma once
#undef min
#undef max
#include "../../libDataUtils/piArray.h"
#include "../piSound.h"
#include <stdint.h>
#include <dsound.h>
struct IDirectSound8;
struct IDirectSoundBuffer;
namespace piLibs
{
struct Sound;
struct SampleFormat;
static const int32_t kInvalidSound = -1;
class piSoundEngineOVR : public piSoundEngine
{
public:
static const uint32_t kMaxSoundsDefault = 128;
piSoundEngineOVR();
virtual ~piSoundEngineOVR();
virtual bool Init(void* hwnd, int deviceID, int maxSoundsOverride);
virtual void Deinit();
virtual int GetNumDevices(void);
virtual const wchar_t *GetDeviceName(int id) const;
virtual int GetDeviceFromGUID(void *deviceGUID);
virtual bool ResizeMixBuffers(int32_t const& mixSamples, int32_t const& spatialSamples) { return SetupOVRContextAndMixBuffer( mixSamples, spatialSamples ); }
virtual void Tick(double dt);
virtual int32_t AddSound(const wchar_t* filename);
virtual int32_t AddSound(const SampleFormat*, void*) { return -1; } // Init creates mix buffer which is sufficient
virtual void DelSound(int32_t soundIndex);
virtual bool Play(int32_t soundIndex);
virtual bool Play(int32_t soundIndex, bool loop, float volume);
virtual bool Stop(int32_t soundIndex);
virtual bool IsValid(int32_t soundIndex) const { return soundIndex >= 0 && soundIndex < m_maxSounds && m_sounds.GetPtr(soundIndex); }
virtual bool GetIsPlaying(int32_t soundIndex);
virtual bool SetPosition(int32_t soundIndex, const float * position);
virtual bool SetOrientation(int32_t soundIndex, const float * dir, const float * up);
virtual bool GetSpatialize( int32_t soundIndex ) const;
virtual bool SetSpatialize( int32_t soundIndex, bool spatialize );
virtual bool CanChangeSpatialize(int32_t soundIndex) const;
virtual bool GetLooping( int32_t soundIndex ) const;
virtual bool SetLooping( int32_t soundIndex, bool looping );
virtual bool GetPaused(int32_t soundIndex) const;
virtual bool SetPaused(int32_t soundIndex, bool paused);
virtual float GetVolume( int32_t soundIndex ) const;
virtual bool SetVolume( int32_t soundIndex, float volume );
virtual int32_t GetAttenMode(int32_t id) const;
virtual bool SetAttenMode(int32_t id, int32_t attenMode);
virtual float GetAttenRadius(int32_t id) const;
virtual bool SetAttenRadius(int32_t id, float attenRadius);
virtual float GetAttenMin(int32_t id) const;
virtual bool SetAttenMin(int32_t id, float attenMin);
virtual float GetAttenMax(int32_t id) const;
virtual bool SetAttenMax(int32_t id, float attenMax);
virtual void PauseAllSounds();
virtual void ResumeAllSounds();
//virtual void SetListener(const mat4x4d& lst2world);
private:
static BOOL CALLBACK myDSEnumCallback(LPGUID lpGuid, const wchar_t * lpcstrDescription, const wchar_t * lpcstrModule, void * lpContext);
int mNumDevices;
struct DeviceInfo
{
wchar_t *mName;
GUID mGUID;
}mDevice[16];
bool SetupOVRAudio();
bool SetupOVRContextAndMixBuffer(int32_t const& mixBufferSampleCount, int32_t const& spatialProcessSampleCount);
IDirectSound8* m_directSound;
IDirectSoundBuffer* m_primaryBuffer;
IDirectSoundBuffer* m_spatialMixingBuffer;
piArray m_sounds;
void * m_context;
int32_t m_mixBufferSampleCount;
int32_t m_spatialProcessSampleCount;
float* m_frameMixSamplesL;
float* m_frameMixSamplesR;
int16_t* m_frameStereoSamples;
float* m_soundMonoSamplesIn;
float* m_soundStereoSamplesOut;
//mat4x4d m_world2view;
//mat4x4d m_view2world;
int32_t m_lastSegmentWritten;
int32_t m_maxSounds;
bool m_paused;
};
} // namespace piLibs
| [
"plafayette@fb.com"
] | plafayette@fb.com |
a1728ccfd93128f6be56f509729a811f1fe88c9a | cf7ae4ac2644daa52e0f7c5ae30c72b66d15fc7f | /SceneEditor/SceneEditorCore/CommandSystem/CommandScene/CommandSceneShow.h | 5ab4f7570e571aae5803bb88d7076013658b927f | [] | no_license | ZHOURUIH/GameEditor | 13cebb5037a46d1c414c944b4f0229b26d859fb5 | eb391bd8c2bec8976c29047183722f90d75af361 | refs/heads/master | 2023-08-21T10:56:59.318660 | 2023-08-10T16:33:40 | 2023-08-10T16:33:40 | 133,002,663 | 18 | 21 | null | null | null | null | UTF-8 | C++ | false | false | 293 | h | #ifndef _COMMAND_SCENE_SHOW_H_
#define _COMMAND_SCENE_SHOW_H_
#include "EditorCoreCommand.h"
class CommandSceneShow : public EditorCoreCommand
{
public:
virtual void reset()
{
mShow = true;
}
virtual void execute();
virtual std::string showDebugInfo();
public:
bool mShow;
};
#endif | [
"12345678@qq.com"
] | 12345678@qq.com |
188aaf4663da1925d7fdd340a0041a8b6ef14ca2 | 230b7714d61bbbc9a75dd9adc487706dffbf301e | /chrome/browser/web_applications/extensions/bookmark_app_registrar.h | b6a7dafc81bdddb125b3ec955ec8b7fd70c99632 | [
"BSD-3-Clause"
] | permissive | byte4byte/cloudretro | efe4f8275f267e553ba82068c91ed801d02637a7 | 4d6e047d4726c1d3d1d119dfb55c8b0f29f6b39a | refs/heads/master | 2023-02-22T02:59:29.357795 | 2021-01-25T02:32:24 | 2021-01-25T02:32:24 | 197,294,750 | 1 | 2 | BSD-3-Clause | 2019-09-11T19:35:45 | 2019-07-17T01:48:48 | null | UTF-8 | C++ | false | false | 2,436 | h | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_REGISTRAR_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_REGISTRAR_H_
#include "base/callback_forward.h"
#include "base/scoped_observer.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
class Profile;
namespace extensions {
class Extension;
class BookmarkAppRegistrar : public web_app::AppRegistrar,
public ExtensionRegistryObserver {
public:
explicit BookmarkAppRegistrar(Profile* profile);
~BookmarkAppRegistrar() override;
// AppRegistrar:
void Init(base::OnceClosure callback) override;
bool IsInstalled(const GURL& start_url) const override;
bool IsInstalled(const web_app::AppId& app_id) const override;
bool WasExternalAppUninstalledByUser(
const web_app::AppId& app_id) const override;
base::Optional<web_app::AppId> FindAppWithUrlInScope(
const GURL& url) const override;
int CountUserInstalledApps() const override;
std::string GetAppShortName(const web_app::AppId& app_id) const override;
std::string GetAppDescription(const web_app::AppId& app_id) const override;
base::Optional<SkColor> GetAppThemeColor(
const web_app::AppId& app_id) const override;
const GURL& GetAppLaunchURL(const web_app::AppId& app_id) const override;
base::Optional<GURL> GetAppScope(const web_app::AppId& app_id) const override;
// ExtensionRegistryObserver:
void OnExtensionInstalled(content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) override;
void OnExtensionUninstalled(content::BrowserContext* browser_context,
const Extension* extension,
UninstallReason reason) override;
void OnShutdown(ExtensionRegistry* registry) override;
private:
const Extension* GetExtension(const web_app::AppId& app_id) const;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_observer_{this};
};
} // namespace extensions
#endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_REGISTRAR_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
f4cbea2e92bb77353e3fa84c22029914d60a8841 | 5b284bf3d02e26be71cb217999dd3fd223f2a2dc | /parser/src/Main.cpp | 0ad4db9992a52d485b3a0abbc66369ea4656dbec | [] | no_license | zzxuanyuan/ID3 | 5f831d8d9d59c4fae72d31ab722c08d784668f76 | bdd330398ecb7cf3215345e95231850474682177 | refs/heads/master | 2020-05-20T06:01:24.895928 | 2016-09-25T00:27:41 | 2016-09-25T00:27:41 | 68,041,759 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,568 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include "Attribute.h"
#include "Instance.h"
#include "Parser.h"
#include "Main.h"
using namespace std;
int main(int argc, char* argv[]) {
switch (argc) {
case 1:
cout << "Please specify an input file." << endl;
cout << "Syntax: ./decisionTree.o dataFile formatFile" << endl;
return 1;
case 2:
cout << "Please specify a format file." << endl;
cout << "Syntax: ./decisionTree.o dataFile formatFile" << endl;
return 1;
case 3:
break;
default:
cout << "Too many arguments." << endl;
cout << "Syntax: ./decisionTree.o dataFile formatFile" << endl;
return 1;
}
vector< vector<Instance> > data;
vector<Attribute> format;
Parser parser = Parser();
if (parser.parseFormat(&format, argv[2])) return 1;
if (parser.parseData(&format, &data, argv[1])) return 1;
cout << "Format:" << endl;
for (int i = 0; i < format.size(); i++) {
switch(format[i].getType()){
case 0:
cout << "id ";
break;
case 1:
cout << "numeric ";
break;
case 2:
cout << "domain ";
break;
case 3:
cout << "class_numeric ";
break;
case 4:
cout << "class_domain ";
break;
}
}
cout << "data size = " << data.size() << endl;
cout << "format size = " << format.size() << endl;
cout << endl;
for (int i = 0; i < data.size(); i++) {
for (int j = 0; j < format.size(); j++) {
switch (format[j].getType()) {
case 0:
cout << data[i][j].getId() << " ";
break;
case 1:
case 3:
cout << data[i][j].getNumValue() << " ";
break;
case 2:
case 4:
cout << "format[j].getValueForIndex(data[i][j].getDomainIndex()) = " << format[j].getValueForIndex(data[i][j].getDomainIndex()) << endl;
cout << format[j].getValueForIndex(data[i][j].getDomainIndex()) << " ";
break;
default:
cout << "Bad type found: " << format[j].getType() << endl;
}
}
cout << endl;
}
return 0;
}
| [
"zzxuanyuan@gmail.com"
] | zzxuanyuan@gmail.com |
f5422417e8c49685247fd077eae68508a72c42d9 | 5b7e69802b8075da18dc14b94ea968a4a2a275ad | /DRG-SDK/SDK/DRG_MRMesh_functions.cpp | ae35f51300b2f13e80733310aa3a65d10624ccd1 | [] | no_license | ue4sdk/DRG-SDK | 7effecf98a08282e07d5190467c71b1021732a00 | 15cc1f8507ccab588480528c65b9623390643abd | refs/heads/master | 2022-07-13T15:34:38.499953 | 2019-03-16T19:29:44 | 2019-03-16T19:29:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,712 | cpp | // Deep Rock Galactic (0.22) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "DRG_MRMesh_classes.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function MRMesh.MeshReconstructorBase.StopReconstruction
// (FUNC_Native, FUNC_Public, FUNC_BlueprintCallable)
void UMeshReconstructorBase::StopReconstruction()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.StopReconstruction");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MeshReconstructorBase.StartReconstruction
// (FUNC_Native, FUNC_Public, FUNC_BlueprintCallable)
void UMeshReconstructorBase::StartReconstruction()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.StartReconstruction");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MeshReconstructorBase.PauseReconstruction
// (FUNC_Native, FUNC_Public, FUNC_BlueprintCallable)
void UMeshReconstructorBase::PauseReconstruction()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.PauseReconstruction");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MeshReconstructorBase.IsReconstructionStarted
// (FUNC_Native, FUNC_Public, FUNC_BlueprintCallable, FUNC_BlueprintPure, FUNC_Const)
// Parameters:
// bool ReturnValue (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData)
bool UMeshReconstructorBase::IsReconstructionStarted()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.IsReconstructionStarted");
struct
{
bool ReturnValue;
} params;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function MRMesh.MeshReconstructorBase.IsReconstructionPaused
// (FUNC_Native, FUNC_Public, FUNC_BlueprintCallable, FUNC_BlueprintPure, FUNC_Const)
// Parameters:
// bool ReturnValue (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData)
bool UMeshReconstructorBase::IsReconstructionPaused()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.IsReconstructionPaused");
struct
{
bool ReturnValue;
} params;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function MRMesh.MeshReconstructorBase.DisconnectMRMesh
// (FUNC_Native, FUNC_Public)
void UMeshReconstructorBase::DisconnectMRMesh()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.DisconnectMRMesh");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MeshReconstructorBase.ConnectMRMesh
// (FUNC_Native, FUNC_Public)
// Parameters:
// class UMRMeshComponent* Mesh (CPF_Parm, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData)
void UMeshReconstructorBase::ConnectMRMesh(class UMRMeshComponent* Mesh)
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MeshReconstructorBase.ConnectMRMesh");
struct
{
class UMRMeshComponent* Mesh;
} params;
params.Mesh = Mesh;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MRMeshComponent.IsConnected
// (FUNC_Final, FUNC_Native, FUNC_Public, FUNC_BlueprintCallable, FUNC_BlueprintPure, FUNC_Const)
// Parameters:
// bool ReturnValue (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData)
bool UMRMeshComponent::IsConnected()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MRMeshComponent.IsConnected");
struct
{
bool ReturnValue;
} params;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function MRMesh.MRMeshComponent.ForceNavMeshUpdate
// (FUNC_Final, FUNC_Native, FUNC_Public, FUNC_BlueprintCallable)
void UMRMeshComponent::ForceNavMeshUpdate()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MRMeshComponent.ForceNavMeshUpdate");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function MRMesh.MRMeshComponent.Clear
// (FUNC_Final, FUNC_Native, FUNC_Public, FUNC_BlueprintCallable)
void UMRMeshComponent::Clear()
{
static auto fn = UObject::FindObject<UFunction>("Function MRMesh.MRMeshComponent.Clear");
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"igromanru@yahoo.de"
] | igromanru@yahoo.de |
9f3a41381c5b71c97666453211d49660199b5ae2 | 363c76b1a2eb0280e27cee0b0fcbea8e423460eb | /SFML-Box2D-Template/Source/HitSpikeMessage.cpp | 1846afb8579dea024222d433025981eba315f423 | [] | no_license | jhpy1024/1GAM-2014-Jan | 9ef183a4d8218b657ddb8528b0c4cede821ac6c2 | a83bbd8ad90488d630a5683fe86750cd59428d1b | refs/heads/master | 2021-01-02T08:21:05.809303 | 2014-01-26T12:58:10 | 2014-01-26T12:58:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 143 | cpp | #include "../Include/HitSpikeMessage.hpp"
HitSpikeMessage::HitSpikeMessage(const std::string& targetId)
: Message(HitSpikeMsg, targetId)
{
} | [
"jhpy1024@gmail.com"
] | jhpy1024@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.