blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
84be06e2460b916cb4c1429a70f2736bfa81239f | 8355f9d0804cb458b51ff1acd82d5677aedbd38c | /最短路径/Dijkstra.cpp | 7f16d4f6bcee7a71bb301f415f553a6d8b69615b | [
"MIT"
] | permissive | jiaqiangwjq/Algorithm-learning | 88f8477fc8383b32c485dc33372ac2b13f6a9e80 | 7190ce1ec866d8b40d89224db86e3ae09b02c4b2 | refs/heads/master | 2022-05-05T11:42:46.151962 | 2022-05-03T03:11:32 | 2022-05-03T03:11:32 | 147,054,179 | 0 | 0 | MIT | 2019-03-19T09:18:31 | 2018-09-02T04:27:01 | C++ | UTF-8 | C++ | false | false | 1,737 | cpp | Dijkstra.cpp | /*
* 单源最短路径
* 求的是某个固定的点,到其他所有点的最短距离
*/
#include <cstdio>
using namespace std;
int main()
{
int e[10][10], dis[10], book[10];
int inf = 999;
/* n 表示顶点个数,m 表示边的条数 */
int n, m;
scanf("%d %d", &n, &m);
/* 初始化 */
int i, j;
for(i = 1; i <= n; i++)
for(j = 1; j <= n; j++)
if(i == j)
e[i][j] = 0;
else
e[i][j] = inf;
/* 读入边 */
int t1, t2, t3;
for(i = 1; i <= n; i++)
{
scanf("%d %d %d", &t1, &t2, &t3);
e[t1][t2] = t3; /* 有向图,所以只存一次 */
}
/* 初始化 dis 数组, 这里是 1 号顶点到其余各个顶点的初始距离 */
for(i = 1; i <= n; i++)
dis[i] = e[1][i];
/* book 数组初始化 */
for(i = 1; i <= n; i++)
book[i] = 0;
book[1] = 1;
/* Dijkstra 算法核心语句 */
int u, min, v;
for(i = 1; i <= n-1; i++)
{
/* 找到离 1 号顶点最近的顶点 */
min = inf;
for(j = 1; j <= n; j++)
{
/* 在未松弛的点中找离源点最近的点 */
if(book[j] == 0 && dis[j] < min)
{
min = dis[j];
u = j;
}
}
/* 从离源点最近的那个点开始松弛 */
book[u] = 1;
for(v = 1; v <= n; v++)
{
if(e[u][v] < inf)
{
if(dis[v] > dis[u] + e[u][v])
dis[v] = dis[u] + e[u][v];
}
}
}
/* 输出最终结果 */
for(i = 1; i <= n; i++)
printf("%d ", dis[i]);
return 0;
} |
abb4b41b6fbf24386f5f1e34c37e3eea13a7b998 | 5d7739bd360a447ee1c7285483d2f37d521fa99e | /Volume 006 (600-699)/665.cpp | a65243891b62193072758625b0835c1f1c5c32a8 | [] | no_license | aaafwd/Online-Judge | c4b23272d95a1c1f73cc3da2c95be8087a3d523c | b264f445db2787c5fc40ddef8eb3139adae72608 | refs/heads/main | 2023-04-02T01:01:26.303389 | 2021-04-11T14:17:58 | 2021-04-11T14:17:58 | 356,840,772 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 982 | cpp | 665.cpp | /* @JUDGE_ID: 19899RK 665 C++ "By Anadan" */
// False coin
// Accepted (0.020 seconds with low memory spent)
#include <stdio.h>
#include <string.h>
int main(){
long set;
int N, K, P, i, j, l;
char flags[100], tmpf[100], ch;
scanf("%ld\n\n", &set);
while(set--){
scanf("%d %d\n", &N, &K);
memset(flags, 0, N);
for (l = 0; l < K; l++){
memset(tmpf, 0, N);
scanf("%d", &P); P <<= 1;
for (i = 0; i < P; i++){
scanf("%d", &j); j--;
tmpf[j] = 1;
}
scanf("\n%c\n", &ch);
if (ch == '='){
for (i = 0; i < N; i++){
if (tmpf[i]) flags[i] = 1;
}
}else{
for (i = 0; i < N; i++){
if (!tmpf[i]) flags[i] = 1;
}
}
}
for (i = 0; i < N; i++) if (!flags[i]) break;
if (i < N){
for (j = i + 1; j < N; j++) if (!flags[j]) break;
if (j < N) printf("0\n"); else printf("%d\n", i + 1);
}else printf("0\n");
if (set) printf("\n");
}
return 0;
}
/* @END_OF_SOURCE_CODE */
|
aa41fed491c436e82e8c17be9c3b6083900894fe | 6ab099a6216b069536ee35d31330a49654a7f8ec | /etf/src/TAParameter.cxx | f04908abdf436f19fe056111aa8cda080c79557c | [
"MIT"
] | permissive | asiarabbit/BINGER | 3b47ea26088a8dd29f74d8f2954c8c6e1f574d36 | f525a7445be1aa3ac3f8fb235f6097c999f25f2d | refs/heads/master | 2021-06-06T19:03:16.881231 | 2020-05-10T11:39:30 | 2020-05-10T11:39:30 | 111,820,270 | 1 | 0 | MIT | 2018-09-04T16:39:04 | 2017-11-23T14:41:42 | C | UTF-8 | C++ | false | false | 1,303 | cxx | TAParameter.cxx | ///////////////////////////////////////////////////////////////////////////////////////
// Data Analysis Code Project for the External Target Facility, HIRFL-CSR, @IMP //
// //
// BINGER/inc/etf/TAParameter.C //
// TAParameter.C -- source file for class TAParameter //
// Introduction: base class for unit parameter storage, derived from TAStuff. //
// Direct instantiation of this class is supposed to store physical constants. //
// //
// Author: SUN Yazhou, asia.rabbit@163.com. //
// Created: 2017/9/24. //
// Last modified: 2017/9/25, SUN Yazhou. //
// //
// //
// Copyright (C) 2017-2018, SUN Yazhou. //
// All rights reserved. //
///////////////////////////////////////////////////////////////////////////////////////
#include "TAParameter.h"
#include "TAPopMsg.h"
TAParameter::TAParameter(const string &name, const string &title, unsigned uid)
: TAStuff(name, title, uid){
fValue = -9999.;
}
TAParameter::~TAParameter(){};
double TAParameter::GetValue() const{
if(-9999. == fValue)
TAPopMsg::Error(fName.c_str(), "Parameter may have not been assigned.");
return fValue;
}
|
41a7668d127c5dd378edbe07942cd1cb27b2b99d | 9a50b12a723096773f5d96b96a43b5d5c27e2e8b | /master/advpt/ex04/main9.cpp | 0cad883aa640f75e1b595165f3e8e57da6c282e1 | [] | no_license | anygo/uniprojectsdn | fdbbcc16e63a9450afd86f039c6b33af66b6450d | a44181ee62594aaf029486bf70372bf0b2c62785 | refs/heads/master | 2020-04-25T13:44:54.380314 | 2012-02-17T09:41:36 | 2012-02-17T09:41:36 | 42,488,310 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,007 | cpp | main9.cpp | //=================================================================================================
//
// Advanced Programming Techniques (AdvPT)
// Winter Term 2010
// Assignment 4 - Task 9
//
// Create a 'set' of unsigned integers sorted according to the following rule: the elements
// are sorted according to the first digit of the value. In case two values have the same
// first digit, they are sorted according to the second digit, etc. Values with a smaller
// number of digits are sorted before values with a higher number of digits. Fill the 'set'
// with appropriate values and print all elements. Afterwards, erase all values, whose first
// digit is 1 and reprint the set.
//
//=================================================================================================
#include <iostream>
#include <sstream>
#include <set>
#include <cstdlib>
struct comp {
bool operator() (const unsigned int& lhs, const unsigned int& rhs) {
std::stringstream ss;
ss << lhs;
std::stringstream ss2;
ss2 << rhs;
std::string l = ss.str();
std::string r = ss2.str();
//we could have done some awesome stuff:
//Math.log(Math.abs(lhs)) + 1
//... whatever
if (r.size() == l.size()) {
return l < r;
} else {
return l.size() < r.size();
}
}
};
int main(int argc, char* argv[]) {
std::set<unsigned int, comp> s;
for (int i = 0; i < 15; ++i) {
s.insert(std::rand()%10000);
}
for (std::set<unsigned int, comp>::iterator it = s.begin(); it != s.end(); ++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
for (std::set<unsigned int, comp>::iterator it = s.begin(); it != s.end();) {
std::set<unsigned int, comp>::iterator here = it++;
std::stringstream ss;
ss << *here;
if (ss.str().c_str()[0] == '1')
s.erase(here);
}
for (std::set<unsigned int, comp>::iterator it = s.begin(); it != s.end(); ++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
}
|
2d179eea4722ddc658aff41bc0d25284e4070084 | 30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a | /CodesNew/863.cpp | be0b626176d0506c155fed57ea216468e43124f6 | [] | no_license | thegamer1907/Code_Analysis | 0a2bb97a9fb5faf01d983c223d9715eb419b7519 | 48079e399321b585efc8a2c6a84c25e2e7a22a61 | refs/heads/master | 2020-05-27T01:20:55.921937 | 2019-11-20T11:15:11 | 2019-11-20T11:15:11 | 188,403,594 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 565 | cpp | 863.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1e3+10;
map <string,int> M;
string s1[N],s2[N];
int main(){
ios::sync_with_stdio(false);
int n,m,cnt=0;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>s1[i];
M[s1[i]]++;
}
for(int i=1;i<=m;i++){
cin>>s2[i];
M[s2[i]]++;
if(M[s2[i]]==2) cnt++;
}
if(cnt%2) n=n-(cnt/2)+1,m=m-(cnt/2);
else n=n-(cnt/2),m=m-(cnt/2);
if(n>m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
|
5e6a5126946e6027db086e3bef7ed907d9c0640f | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/CMake/CMake-gumtree/Kitware_CMake_repos_basic_block_block_4117.cpp | 0ce723e7aaf2bcd98079ae6e167a88d2813e5d30 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 114 | cpp | Kitware_CMake_repos_basic_block_block_4117.cpp | {
/* the given address is numerical only, prevent a reverse lookup */
hints.ai_flags = AI_NUMERICHOST;
} |
28cc26b1b9531a0fffa2553f84b904d913a85d09 | 37ba0094ac51b92ddfb49e901ff60183b12aed57 | /codeblocks/yolosfml/main.cpp | f83c94da874be182d612eeac443d5f6f4b35dba0 | [] | no_license | ziomas3/cpp-sem2 | ad78a31f512abfac003c580694abeb9878b2f6ab | 4c026c6aeeeba45934448e77017d49f659066c04 | refs/heads/master | 2021-02-11T03:23:22.804116 | 2020-03-02T18:50:26 | 2020-03-02T18:50:26 | 244,447,220 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,139 | cpp | main.cpp | #include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
int main()
{
//textura tlo_s_txt
sf::Texture piestxt;
if (!piestxt.loadFromFile("tlo_s.png"))
{
return -3;
}
piestxt.setSmooth(true);
//spirit
vector<sf::Sprite> pies(73);
for (int i=1; i<=72; i++)
{
pies[i].setTexture(piestxt);
pies[i].setPosition(sf::Vector2f(500,200));
pies[i].setScale(sf::Vector2f(0.5f, 0.5f));
for(int j=0; j<i; j++)
{
pies[i].rotate(5);
pies[i].scale(sf::Vector2f(0.98f, 0.98f));
}
}
sf::Sprite tlo_s;
tlo_s.setTexture(piestxt);
//ustawienia okna
sf::RenderWindow window(sf::VideoMode(1366,768), "test");
window.setFramerateLimit(45);
window.setVerticalSyncEnabled(true);
while (window.isOpen())
{
for (int i=1; i<360/5; i++)
{
window.clear();
window.draw(tlo_s);
for(int j=1; j<=i; j++)
{
window.draw(pies[j]);
}
window.display();
}
}
return 0;
}
|
b47f17cb67c2a4b646b7a8684088252a9d036a31 | 9eb72d37e42708e570642fca3cb4e3909231a96d | /daemon/tests/unittests/QueueBundleEventTest.cpp | 1c692809fa3a2ced379ed8063758499d17bb6f9a | [
"Apache-2.0"
] | permissive | niojuju/ibrdtn | ed786b4211d994580fdeb18f3308868a8dd4eb79 | 0505267fbd83587e52bd288e2360f90d953d8ffb | refs/heads/master | 2021-01-17T17:43:55.328441 | 2011-12-22T08:01:35 | 2011-12-22T08:01:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,182 | cpp | QueueBundleEventTest.cpp | /* $Id: templateengine.py 2241 2006-05-22 07:58:58Z fischer $ */
///
/// @file QueueBundleEventTest.cpp
/// @brief CPPUnit-Tests for class QueueBundleEvent
/// @author Author Name (email@mail.address)
/// @date Created at 2010-11-01
///
/// @version $Revision: 2241 $
/// @note Last modification: $Date: 2006-05-22 09:58:58 +0200 (Mon, 22 May 2006) $
/// by $Author: fischer $
///
#include "QueueBundleEventTest.hh"
CPPUNIT_TEST_SUITE_REGISTRATION(QueueBundleEventTest);
/*========================== tests below ==========================*/
/*=== BEGIN tests for class 'QueueBundleEvent' ===*/
void QueueBundleEventTest::testGetName()
{
/* test signature () const */
CPPUNIT_FAIL("not implemented");
}
void QueueBundleEventTest::testToString()
{
/* test signature () const */
CPPUNIT_FAIL("not implemented");
}
void QueueBundleEventTest::testRaise()
{
/* test signature (const dtn::data::MetaBundle &bundle, const dtn::data::EID &origin) */
CPPUNIT_FAIL("not implemented");
}
/*=== END tests for class 'QueueBundleEvent' ===*/
void QueueBundleEventTest::setUp()
{
}
void QueueBundleEventTest::tearDown()
{
}
|
04b9132fe9126b320dd603c2d80ddc1d92ea9c64 | 31539b25751349da7fb4a0fcca99fd5a6d807e1d | /Serial monitor led control/Serial monitor led control.ino | 64ac8bf271c35a8170fa976447ec4d27823af309 | [] | no_license | NirmalKnock/Arduino-Projects | 3c92db0d3db3b934bd1d5fa128a97df18f0b270f | 2179d2e95d4a3b336bec783508d86d5db5464fdc | refs/heads/master | 2022-11-27T22:14:25.087609 | 2020-08-08T15:34:15 | 2020-08-08T15:34:15 | 266,035,526 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 402 | ino | Serial monitor led control.ino |
int led=13;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);
while(!Serial);
Serial.print("type 0 or 1");
}
void loop() {
if (Serial.available()){
char value=Serial.read();
if (value=='1'){
digitalWrite(led,HIGH);
Serial.println("ON");
}
else if(value=='0'){
digitalWrite(led,LOW);
Serial.println("OFF");
}
}
} |
3d3c4d007879d17c31f327c9a4182d1be25d607f | e537ccf5cec931491ab74bec6eda6603cd3db173 | /wardrobe/wardrobedialog.cpp | 06c44a946101fd456c80bfd044206825845e9c4d | [] | no_license | H-K-ai/Qt-4.7.4 | 47b8f5e84a96a1448c78f690b63453f296d67561 | b5f857e75799e711e48bda1e29e023c17557cfe6 | refs/heads/master | 2021-05-28T07:22:34.300373 | 2015-03-02T19:10:15 | 2015-03-02T19:10:15 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,422 | cpp | wardrobedialog.cpp | #include "wardrobedialog.h"
#include "ui_wardrobedialog.h"
wardrobeDialog::wardrobeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::wardrobeDialog)
{
ui->setupUi(this);
ui->comboBox_4->setCurrentIndex(0);
ui->label_14->setText("共计 : 0 件");
ui->label->clear();
ui->comboBox_5->setCurrentIndex(0);
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->comboBox->setCurrentIndex(0);
ui->comboBox_2->setCurrentIndex(0);
ui->comboBox_3->setCurrentIndex(0);
ui->dateEdit->setDate(QDate::currentDate());
ui->textEdit->clear();
initDialog();
}
wardrobeDialog::~wardrobeDialog()
{
delete ui;
}
void wardrobeDialog::showEvent(QShowEvent *)
{
//显示窗口
ui->comboBox_4->setCurrentIndex(0);
ui->label_14->setText("共计 : 0 件");
ui->label->clear();
ui->comboBox_5->setCurrentIndex(0);
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->comboBox->setCurrentIndex(0);
ui->comboBox_2->setCurrentIndex(0);
ui->comboBox_3->setCurrentIndex(0);
ui->dateEdit->setDate(QDate::currentDate());
ui->textEdit->clear();
initDialog();
}
void wardrobeDialog::on_comboBox_4_currentIndexChanged(int index)
{
//存放地选择
QSqlQuery query;
ui->comboBox_5->clear();
query.exec("select distinct name from clothes where storeplace = '" + ui->comboBox_4->currentText() + "'");
while(query.next())
ui->comboBox_5->addItem(query.value(0).toString());
ui->label->clear();
ui->comboBox_5->setCurrentIndex(0);
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->comboBox->setCurrentIndex(0);
ui->comboBox_2->setCurrentIndex(0);
ui->comboBox_3->setCurrentIndex(0);
ui->dateEdit->setDate(QDate::currentDate());
ui->textEdit->clear();
}
void wardrobeDialog::on_comboBox_5_currentIndexChanged(int index)
{
//衣物选择
QSqlQuery query;
query.exec("select * from clothes where name = '" + ui->comboBox_5->currentText() + "'");
while(query.next())
{
ui->comboBox->setCurrentIndex(query.value(2).toInt());
ui->comboBox_2->setCurrentIndex(query.value(3).toInt());
ui->comboBox_3->setCurrentIndex(query.value(4).toInt());
ui->lineEdit_2->setText(query.value(5).toString());
ui->lineEdit_3->setText(query.value(6).toString());
ui->dateEdit->setDate(QDate::fromString(query.value(7).toString(), "yyyy.MM.dd"));
ui->lineEdit_4->setText(query.value(8).toString());
ui->lineEdit_5->setText(query.value(9).toString());
ui->textEdit->setPlainText(query.value(10).toString());
ui->label->setScaledContents(true);
ui->label->setPixmap(query.value(11).toString());
}
}
void wardrobeDialog::initDialog()
{
//初始化
QSqlQuery query;
ui->comboBox_4->clear();
ui->comboBox_5->clear();
query.exec("select distinct storeplace from clothes");
while(query.next())
ui->comboBox_4->addItem(query.value(0).toString());
query.exec("select count(distinct name) from clothes where storeplace = '" + ui->comboBox_4->currentText() + "'");
while(query.next())
ui->label_14->setText("共计 : " + query.value(0).toString() + " 件");
}
|
3282a137ff65fc9b6bb5c3ae14ca501dcd6e6811 | c491e20ed812cb917aac88724312a721c568c41b | /A-plus-B/generate.cpp | 15693a4bcffdd897dab2c5558ef24abc35d85732 | [] | no_license | quangtung97-study/20181-design-algorithms | 6ebf67d277933e956bf8ef90db9c4282f84b199b | fb26f7fc25641cc8222f8e1002e87533cff81865 | refs/heads/master | 2020-04-02T10:45:07.784229 | 2018-12-18T02:03:02 | 2018-12-18T02:03:02 | 154,353,145 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 577 | cpp | generate.cpp | #include <iostream>
#include <random>
#include <cstdlib>
const int MAX = 50000;
std::uniform_int_distribution<int> dist(-MAX, MAX);
int main() {
std::random_device rd;
std::mt19937 gen(rd());
const int N = 1000;
std::cout << N << std::endl;
for (int i = 0; i < N; i++)
std::cout << dist(gen) << " ";
std::cout << std::endl;
for (int i = 0; i < N; i++)
std::cout << dist(gen) << " ";
std::cout << std::endl;
for (int i = 0; i < N; i++)
std::cout << dist(gen) << " ";
std::cout << std::endl;
return 0;
}
|
685e49efb5062be6266809d9c932dd03d218eb50 | d81f38221a92667fd5069fc1478db8e225ece823 | /src/ACES.cpp | b3d28c768be9e0d4e88e4a9a23821d091b776843 | [
"BSD-3-Clause"
] | permissive | cinecert/asdcplib | c903b610f024b48737eae8e707202ebecbaf757a | 029917a06659f4fa313e41f7bc77b4273166609d | refs/heads/master | 2023-09-03T16:08:01.009179 | 2023-07-31T15:03:01 | 2023-07-31T15:03:01 | 171,813,615 | 65 | 50 | NOASSERTION | 2023-08-27T18:23:21 | 2019-02-21T06:29:40 | C++ | UTF-8 | C++ | false | false | 15,732 | cpp | ACES.cpp | /*
Copyright (c) 2018, Bjoern Stresing, Patrick Bichiou, Wolfgang Ruppel,
John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR 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 "ACES.h"
#include "KM_log.h"
namespace
{
const std::string AttrAcesImageContainerFlag("acesImageContainerFlag");
const std::string AttrChannels("channels");
const std::string AttrChromaticities("chromaticities");
const std::string AttrCompression("compression");
const std::string AttrDataWindow("dataWindow");
const std::string AttrDisplayWindow("displayWindow");
const std::string AttrLineOrder("lineOrder");
const std::string AttrPixelAspectRatio("pixelAspectRatio");
const std::string AttrScreenWindowCenter("screenWindowCenter");
const std::string AttrScreenWindowWidth("screenWindowWidth");
const std::string TypeUnsignedChar("unsigned char");
const std::string TypeUnsignedChar_("unsignedChar");
const std::string TypeShort("short");
const std::string TypeUnsignedShort("unsigned short");
const std::string TypeUnsignedShort_("unsignedShort");
const std::string TypeInt("int");
const std::string TypeUnsignedInt("unsigned int");
const std::string TypeUnsignedInt_("unsignedInt");
const std::string TypeUnsignedLong("unsigned long");
const std::string TypeUnsignedLong_("unsignedLong");
const std::string TypeHalf("half");
const std::string TypeFloat("float");
const std::string TypeDouble("double");
const std::string TypeBox2i("box2i");
const std::string TypeChlist("chlist");
const std::string TypeChromaticities("chromaticities");
const std::string TypeCompression("compression");
const std::string TypeLineOrder("lineOrder");
const std::string TypeKeycode("keycode");
const std::string TypeRational("rational");
const std::string TypeString("string");
const std::string TypeStringVector("stringVector");
const std::string TypeTimecode("timecode");
const std::string TypeV2f("v2f");
const std::string TypeV3f("v3f");
} // namespace
void AS_02::ACES::Attribute::Move(const byte_t *buf)
{
mAttrType = Invalid;
mType = Unknown_t;
mAttrName.clear();
mpValue = NULL;
mDataSize = 0;
mValueSize = 0;
if(buf)
{
mpData = buf;
while(*buf != 0x00 && buf - mpData < 256)
{
buf++;
}
if(buf - mpData < 1)
{
Kumu::DefaultLogSink().Error("Size of attribute name == 0 Bytes\n");
return;
}
else if(buf - mpData > 255)
{
Kumu::DefaultLogSink().Error("Size of attribute name > 255 Bytes\n");
return;
}
mAttrName.assign((const char*)mpData, buf - mpData); // We don't want the Null termination.
buf++; // Move to "attribute type name".
const byte_t *ptmp = buf;
while(*buf != 0x00 && buf - ptmp < 256)
{
buf++;
}
if(buf - ptmp < 1)
{
Kumu::DefaultLogSink().Error("Size of attribute type == 0 Bytes\n");
return;
}
else if(buf - ptmp > 255)
{
Kumu::DefaultLogSink().Error("Size of attribute type > 255 Bytes\n");
return;
}
std::string attribute_type_name;
attribute_type_name.assign((const char*)ptmp, buf - ptmp); // We don't want the Null termination.
buf++; // Move to "attribute size".
i32_t size = KM_i32_LE(*(i32_t*)(buf));
if(size < 0)
{
Kumu::DefaultLogSink().Error("Attribute size is negative\n");
return;
}
mValueSize = size;
mpValue = buf + 4;
mDataSize = mpValue - mpData + mValueSize;
MatchAttribute(mAttrName);
MatchType(attribute_type_name);
}
}
void AS_02::ACES::Attribute::MatchAttribute(const std::string &Type)
{
if(Type == AttrAcesImageContainerFlag) mAttrType = AcesImageContainerFlag;
else if(Type == AttrChannels) mAttrType = Channels;
else if(Type == AttrChromaticities) mAttrType = Chromaticities;
else if(Type == AttrCompression) mAttrType = Compression;
else if(Type == AttrDataWindow) mAttrType = DataWindow;
else if(Type == AttrDisplayWindow) mAttrType = DisplayWindow;
else if(Type == AttrLineOrder) mAttrType = LineOrder;
else if(Type == AttrPixelAspectRatio) mAttrType = PixelAspectRatio;
else if(Type == AttrScreenWindowCenter) mAttrType = ScreenWindowCenter;
else if(Type == AttrScreenWindowWidth) mAttrType = SreenWindowWidth;
else mAttrType = Other;
}
void AS_02::ACES::Attribute::MatchType(const std::string &Type)
{
if(Type == TypeUnsignedChar || Type == TypeUnsignedChar_) mType = UnsignedChar_t;
else if(Type == TypeShort) mType = Short_t;
else if(Type == TypeUnsignedShort || Type == TypeUnsignedShort_) mType = UnsignedShort_t;
else if(Type == TypeInt) mType = Int_t;
else if(Type == TypeUnsignedInt || Type == TypeUnsignedInt_) mType = UnsignedInt_t;
else if(Type == TypeUnsignedLong || Type == TypeUnsignedLong_) mType = UnsignedLong_t;
else if(Type == TypeHalf) mType = Half_t;
else if(Type == TypeFloat) mType = Float_t;
else if(Type == TypeDouble) mType = Double_t;
else if(Type == TypeBox2i) mType = Box2i_t;
else if(Type == TypeChlist) mType = Chlist_t;
else if(Type == TypeChromaticities) mType = Chromaticities_t;
else if(Type == TypeCompression) mType = Compression_t;
else if(Type == TypeLineOrder) mType = LineOrder_t;
else if(Type == TypeKeycode) mType = Keycode_t;
else if(Type == TypeRational) mType = Rational_t;
else if(Type == TypeString) mType = String_t;
else if(Type == TypeStringVector) mType = StringVector_t;
else if(Type == TypeTimecode) mType = Timecode_t;
else if(Type == TypeV2f) mType = V2f_t;
else if(Type == TypeV3f) mType = V3f_t;
else mType = Unknown_t;
}
AS_02::Result_t AS_02::ACES::Attribute::CopyToGenericContainer(other &value) const
{
generic gen;
if(mValueSize > sizeof(gen.data)) return RESULT_FAIL;
memcpy(gen.data, mpValue, mValueSize);
gen.type = mType;
gen.size = mValueSize;
gen.attributeName = mAttrName;
value.push_back(gen);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(ui8_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(i16_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(ui16_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(i32_t &value) const {
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(ui32_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(ui64_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(real32_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBasicType(real64_t &value) const
{
if(sizeof(value) != mValueSize) return RESULT_FAIL;
ACESDataAccessor::AsBasicType(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsBox2i(box2i &value) const
{
ACESDataAccessor::AsBox2i(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsChlist(chlist &value) const
{
ACESDataAccessor::AsChlist(mpValue, mValueSize, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsChromaticities(chromaticities &value) const
{
ACESDataAccessor::AsChromaticities(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsKeycode(keycode &value) const
{
ACESDataAccessor::AsKeycode(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsRational(ASDCP::Rational &value) const
{
ACESDataAccessor::AsRational(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsString(std::string &value) const
{
ACESDataAccessor::AsString(mpValue, mValueSize, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsStringVector(stringVector &value) const
{
ACESDataAccessor::AsStringVector(mpValue, mValueSize, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsV2f(v2f &value) const
{
ACESDataAccessor::AsV2f(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsV3f(v3f &value) const
{
ACESDataAccessor::AsV3f(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::Attribute::GetValueAsTimecode(timecode &value) const
{
ACESDataAccessor::AsTimecode(mpValue, value);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::GetNextAttribute(const byte_t **buf, Attribute &attr)
{
assert((buf != NULL) && (*buf != NULL));
while(**buf != 0x00) { (*buf)++; }
(*buf)++;
while(**buf != 0x00) { (*buf)++; }
(*buf)++;
i32_t size = KM_i32_LE(*(i32_t*)(*buf));
if(size < 0)
{
Kumu::DefaultLogSink().Error("Attribute size is negative\n");
return RESULT_FAIL;
}
*buf += 4 + size;
if(**buf == 0x00)
{
return RESULT_ENDOFFILE; // Indicates end of header.
}
attr.Move(*buf);
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::CheckMagicNumber(const byte_t **buf)
{
assert((buf != NULL) && (*buf != NULL));
if(memcmp(Magic, *buf, 4) != 0) return RESULT_FAIL;
*buf += 4;
return RESULT_OK;
}
AS_02::Result_t AS_02::ACES::CheckVersionField(const byte_t **buf)
{
assert((buf != NULL) && (*buf != NULL));
if(memcmp(Version_short, *buf, 4) != 0 && memcmp(Version_long, *buf, 4) != 0) return RESULT_FAIL;
*buf += 4;
return RESULT_OK;
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, ui8_t &value)
{
value = *(ui8_t*)(buf);
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, i16_t &value)
{
value = KM_i16_LE(*(i16_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, ui16_t &value)
{
value = KM_i16_LE(*(ui16_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, i32_t &value)
{
value = KM_i32_LE(*(i32_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, ui32_t &value)
{
value = KM_i32_LE(*(ui32_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, ui64_t &value)
{
value = KM_i64_LE(*(ui64_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, real32_t &value)
{
value = KM_i32_LE(*(real32_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBasicType(const byte_t *buf, real64_t &value)
{
value = KM_i64_LE(*(real64_t*)(buf));
}
void AS_02::ACES::ACESDataAccessor::AsBox2i(const byte_t *buf, box2i &value)
{
value.xMin = KM_i32_LE(*(i32_t*)(buf));
value.yMin = KM_i32_LE(*(i32_t*)(buf + 4));
value.xMax = KM_i32_LE(*(i32_t*)(buf + 8));
value.yMax = KM_i32_LE(*(i32_t*)(buf + 12));
}
void AS_02::ACES::ACESDataAccessor::AsChlist(const byte_t *buf, ui32_t size, chlist &value)
{
const byte_t *end = buf + size - 1;
while(buf < end)
{
const byte_t *ptmp = buf;
while(*buf != 0x00 && buf - ptmp < 256) { buf++; }
if(buf - ptmp < 1)
{
Kumu::DefaultLogSink().Error("Size of name == 0 Bytes\n");
return;
}
else if(buf - ptmp > 255)
{
Kumu::DefaultLogSink().Error("Size of name > 255 Bytes\n");
return;
}
channel ch;
ch.name.assign((const char*)ptmp, buf - ptmp); // We don't want the Null termination.
buf++;
ch.pixelType = KM_i32_LE(*(i32_t*)(buf));
buf += 4;
ch.pLinear = KM_i32_LE(*(ui32_t*)(buf));
buf += 4;
ch.xSampling = KM_i32_LE(*(i32_t*)(buf));
buf += 4;
ch.ySampling = KM_i32_LE(*(i32_t*)(buf));
buf += 4;
value.push_back(ch);
}
}
void AS_02::ACES::ACESDataAccessor::AsChromaticities(const byte_t *buf, chromaticities &value)
{
value.red.x = KM_i32_LE(*(real32_t*)(buf));
value.red.y = KM_i32_LE(*(real32_t*)(buf + 4));
value.green.x = KM_i32_LE(*(real32_t*)(buf + 8));
value.green.y = KM_i32_LE(*(real32_t*)(buf + 12));
value.blue.x = KM_i32_LE(*(real32_t*)(buf + 16));
value.blue.y = KM_i32_LE(*(real32_t*)(buf + 20));
value.white.x = KM_i32_LE(*(real32_t*)(buf + 24));
value.white.y = KM_i32_LE(*(real32_t*)(buf + 28));
}
void AS_02::ACES::ACESDataAccessor::AsKeycode(const byte_t *buf, keycode &value)
{
value.filmMfcCode = KM_i32_LE(*(i32_t*)(buf));
value.filmType = KM_i32_LE(*(i32_t*)(buf + 4));
value.prefix = KM_i32_LE(*(i32_t*)(buf + 8));
value.count = KM_i32_LE(*(i32_t*)(buf + 12));
value.perfOffset = KM_i32_LE(*(i32_t*)(buf + 16));
value.perfsPerFrame = KM_i32_LE(*(i32_t*)(buf + 20));
value.perfsPerCount = KM_i32_LE(*(i32_t*)(buf + 24));
}
void AS_02::ACES::ACESDataAccessor::AsRational(const byte_t *buf, ASDCP::Rational &value)
{
value.Numerator = KM_i32_LE(*(i32_t*)(buf));
value.Denominator = KM_i32_LE(*(ui32_t*)(buf + 4));
}
void AS_02::ACES::ACESDataAccessor::AsString(const byte_t *buf, ui32_t size, std::string &value)
{
value.assign((const char*)buf, size);
}
void AS_02::ACES::ACESDataAccessor::AsStringVector(const byte_t *buf, ui32_t size, stringVector &value)
{
const byte_t *end = buf + size - 1;
while(buf < end)
{
i32_t str_length = KM_i32_LE(*(i32_t*)(buf));
std::string str;
str.assign((const char*)buf, str_length);
value.push_back(str);
if(buf + str_length >= end) break;
else buf += str_length;
}
}
void AS_02::ACES::ACESDataAccessor::AsV2f(const byte_t *buf, v2f &value)
{
value.x = KM_i32_LE(*(real32_t*)(buf));
value.y = KM_i32_LE(*(real32_t*)(buf + 4));
}
void AS_02::ACES::ACESDataAccessor::AsV3f(const byte_t *buf, v3f &value)
{
value.x = KM_i32_LE(*(real32_t*)(buf));
value.y = KM_i32_LE(*(real32_t*)(buf + 4));
value.z = KM_i32_LE(*(real32_t*)(buf + 8));
}
void AS_02::ACES::ACESDataAccessor::AsTimecode(const byte_t *buf, timecode &value)
{
value.timeAndFlags = KM_i32_LE(*(ui32_t*)(buf));
value.userData = KM_i32_LE(*(ui32_t*)(buf + 4));
}
|
4c345fef900902861804449f2fcd76d663ee7f45 | f1dc64e3c270e626f9e2c4ac04502079aaba6e1d | /hw2/main.cpp | 71bd969af337c7a8f6ad5bac6c31ac8ae8da3b1e | [] | no_license | haVincy/OOP | 7f1f6851a75229d4d22c3ece29c722caa8b4c486 | 3ad2ba1b0c1325aa462e886083ec2fe81730a996 | refs/heads/master | 2021-06-01T04:09:43.523762 | 2016-04-08T18:01:28 | 2016-04-08T18:01:28 | null | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 4,273 | cpp | main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdlib>
#define MAX_POWER 5
#define NUMBER_OF_COEFFICIENTS highpow+1
#define DEBUG 1
int fun_one(float array[]);
void fun_two(int highpow,float array[]);
void fun_three(int highpow,float array[],float derivative[]);
float fun_four(int highpow,float array[],float value);
using namespace std;
ifstream inp; //建立輸入檔案物件
int main()
{
inp.open("polydata.txt",ios::in);//打開檔案
int i,control,highest_power;
float array[20],derivative[20];
float temp,result,value = 0.0;
while(1)
{
cout << "Please enter 1 to start this program,or enter 0 to stop." << endl;
cin >> control;
if(control == 1) // start program
{
highest_power = fun_one(array);
if(highest_power > MAX_POWER) // 最高項次有誤
{
cout << "Error!MaxPower is limit to 5,please enter again." << endl;
continue;
}
else if(highest_power == -2) // 多項式係數個數有誤
{
cout << "Error!Number of Coefficients must equal MaxPower+1,please enter again." << endl;
continue;
}
fun_two(highest_power,array);
//用迴圈逐一傳入帶入值
for(value = 0.0 ; value <= 1.0 ;value = value + 0.2)
{
result = fun_four(highest_power,array,value);
cout << result; //印出結果
if(value < 1.0)
cout << ", ";
}
cout << endl;
//微分多項式並印出帶入值
fun_three(highest_power,array,derivative);
for(value = 0.0 ; value <= 1.0 ;value = value + 0.2)
{
result = fun_four(highest_power-1,derivative,value);
cout << result;
if(value < 1.0)
cout << ", ";
}
cout << endl;
}
else
{
inp.close(); //關閉檔案
cout << "Program over.";
return 0;
}
}
}
//function1 讀入多項式
int fun_one(float array[])
{
int i,option,highpow,n=0;
float temp;
char buf[300];
char *ptr;
cout << "Please enter 1 or 0,[1->read from keyboard,0->read from file]" << endl;
cin >> option;
if(option == DEBUG) // read from keyboard
{
cin >> highpow;
cin.getline(buf,sizeof(buf),'\n'); // 抓MAXPOWER後面的一行數字
ptr = strtok(buf," ");
while(ptr != NULL)
{
array[n] = atof(ptr);
n++;
ptr = strtok(NULL," ");
}
}
else // read from file
{
inp >> highpow; // highpow = 最高次方 , highpow+1 = 總共有幾筆數字
inp.getline(buf,sizeof(buf),'\n'); // 抓MAXPOWER後面的一行數字
ptr = strtok(buf," ");
while(ptr != NULL)
{
array[n] = atof(ptr);
cout << array[n] << endl;
n++;
ptr = strtok(NULL," ");
}
}
cout << "n=" << n << endl;
if( (NUMBER_OF_COEFFICIENTS) != n ) // 如果多項式係數輸入有誤,則回傳-2
highpow = -2;
return highpow;
}
//function2 印出多項式
void fun_two(int highpow,float array[])
{
int i,j,n;
if((highpow == -1) || (highpow == 0 && array[0] == 0))
cout << 0;
for(i=0;i<=highpow;i++)
{
if(array[i] == 0)
continue;
cout << array[i];
for(j=0;j<i;j++)
cout << "*x";
if(i<highpow)
cout << "+";
}
cout << endl;
}
//function3 微分多項式
void fun_three(int highpow,float array[],float derivative[])
{
int i;
//依序做微分並存入陣列中
for(i=1;i<=highpow;i++)
derivative[i-1] = i*array[i];
fun_two(highpow-1,derivative); // 因為微分,所以項數會少1,故傳入highpow-1
}
//function4 將數值帶入多項式
float fun_four(int highpow,float array[],float value)
{
int i;
float sum;
sum = 0;
for(i=0;i<=highpow;i++)
sum = sum + array[i]*pow(value,i); //compute x^
return sum;
}
|
10d3182095c9f11b2e62723937d36b6d66fd1874 | 0f3d51da06efbeabc951e78ed82f53551c46687f | /homeworks/MetaProg_hw1/main.cpp | 4815944db87af9a75c85d871036213ae1e5fd31e | [] | no_license | femoiseev/mipt-metaprog-2018 | 8dcb02a08b66c9fb02a9d8288caaaeb0da90fb76 | 1622fe7594ac684df1fb620cf48da23876278e02 | refs/heads/master | 2020-04-01T12:06:10.599603 | 2018-12-18T21:10:07 | 2018-12-18T21:10:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,899 | cpp | main.cpp | //
// main.cpp
// MetaProg_hw1
//
// Created by Teodor Moiseev on 16/10/2018.
// Copyright © 2018 Teodor Moiseev. All rights reserved.
//
#include <iostream>
#include <vector>
#include <functional>
class IB {
public:
virtual ~IB() {}
virtual void foo() = 0;
};
class B : public IB {
public:
void foo() override {
std::cout << "B" << std::endl;
}
};
enum PatternType {
PROXY,
MEDIATOR,
OBSERVED
};
template <PatternType T>
class Pattern {};
template <>
class Pattern<PatternType::PROXY> : public IB {
public:
Pattern(IB& _object) : object(_object) {}
void foo() override {
std::cout << "Proxed: ";
object.foo();
}
private:
IB& object;
};
template <>
class Pattern<PatternType::MEDIATOR> : public IB {
public:
typedef std::reference_wrapper<IB> IB_ref;
void foo() override {
if (objects.empty()) {
std::cout << "No objects inside" << std::endl;
} else {
std::cout << "Mediator chose object " << objects.size() - 1 << ":";
objects.back().get().foo();
}
}
void add_object(IB& b) {
objects.push_back(b);
}
private:
std::vector<IB_ref> objects;
};
class IObserver {
public:
virtual ~IObserver() {}
virtual void handle(IB& b) = 0;
};
class IA : public IObserver {
public:
virtual ~IA() {}
virtual void bar(IB& b) = 0;
};
class A : public IA {
public:
void bar(IB& b) override {
b.foo();
}
void handle(IB& b) override {
std::cout << "I'm notified!" << std::endl;
}
};
template <>
class Pattern<PatternType::OBSERVED> : public IB {
public:
typedef std::reference_wrapper<IObserver> IObserver_ref;
Pattern(IB& _object) : object(_object) {}
void foo() override {
object.foo();
}
void reset() {
for (std::size_t i = 0; i < observers.size(); i++) {
std::cout << "Observer " << i << ":";
observers[i].get().handle(*this);
}
}
void add_observer(IObserver& observer) {
observers.push_back(observer);
}
private:
IB& object;
std::vector<IObserver_ref> observers;
};
int main() {
std::cout << "Proxy example:" << std::endl;
B b;
Pattern<PROXY> proxed_b(b);
A a;
a.bar(proxed_b);
std::cout << std::endl;
std::cout << "Mediator example:" << std::endl;
B b2;
B b3;
Pattern<MEDIATOR> mediator;
mediator.add_object(b);
mediator.add_object(b2);
mediator.add_object(b3);
a.bar(mediator);
std::cout << std::endl;
std::cout << "Observer example:" << std::endl;
A a2;
A a3;
Pattern<OBSERVED> observed_b(b);
observed_b.add_observer(a);
observed_b.add_observer(a2);
observed_b.add_observer(a3);
observed_b.reset();
return EXIT_SUCCESS;
}
|
8fd3c04a604dcac7d2722174bc0bd2cfe98295eb | 24004e1c3b8005af26d5890091d3c207427a799e | /Win32/NXOPEN/NXOpen/Mechatronics_HingeJoint.hxx | 9665092d6f2ff7d0cf693209e047d48a50e6e494 | [] | no_license | 15831944/PHStart | 068ca6f86b736a9cc857d7db391b2f20d2f52ba9 | f79280bca2ec7e5f344067ead05f98b7d592ae39 | refs/heads/master | 2022-02-20T04:07:46.994182 | 2019-09-29T06:15:37 | 2019-09-29T06:15:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,960 | hxx | Mechatronics_HingeJoint.hxx | #ifndef NXOpen_MECHATRONICS_HINGEJOINT_HXX_INCLUDED
#define NXOpen_MECHATRONICS_HINGEJOINT_HXX_INCLUDED
//--------------------------------------------------------------------------
// Header for C++ interface to JA API
//--------------------------------------------------------------------------
//
// Source File:
// Mechatronics_HingeJoint.ja
//
// Generated by:
// apiwrap
//
// WARNING:
// This file is automatically generated - do not edit by hand
//
#ifdef _MSC_VER
#pragma once
#endif
#include <NXOpen/NXDeprecation.hxx>
#include <vector>
#include <NXOpen/NXString.hxx>
#include <NXOpen/Callback.hxx>
#include <NXOpen/Mechatronics_PhysicsJoint.hxx>
#include <NXOpen/libnxopencpp_mechatronics_exports.hxx>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
#endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace NXOpen
{
namespace Mechatronics
{
class HingeJoint;
}
namespace Mechatronics
{
class PhysicsJoint;
}
namespace Mechatronics
{
class _HingeJointBuilder;
class HingeJointImpl;
/** Represents the Hinge Joint. A Hinge Joint causes objects to
be connected along an axis of rotation. <br> To create or edit an instance of this class, use @link Mechatronics::HingeJointBuilder Mechatronics::HingeJointBuilder@endlink <br>
<br> Created in NX7.5.1. <br>
*/
class NXOPENCPP_MECHATRONICSEXPORT HingeJoint : public Mechatronics::PhysicsJoint
{
private: HingeJointImpl * m_hingejoint_impl;
private: friend class _HingeJointBuilder;
protected: HingeJoint();
public: ~HingeJoint();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifdef __GNUC__
#ifndef NX_NO_GCC_DEPRECATION_WARNINGS
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#endif
#endif
#undef EXPORTLIBRARY
#endif
|
dcf5302a328d78f313f3718e37e37aa91acdc353 | d2432b6336ae059c5d8af0c3988aa8cbdde19171 | /modules/14_from_c_to_cpp/classes_and_privacy.cpp | 3a47a7588e39800049d392c561f23e2bba020a64 | [] | no_license | ecotner/learning-c | 37ccee5701c4f3723487aeb23c5d7c14fee1d9eb | c4647b161df769d67b5d27f7636aed5958fe47b1 | refs/heads/master | 2022-12-19T06:35:38.931305 | 2020-09-12T22:57:52 | 2020-09-12T22:57:52 | 294,571,474 | 0 | 1 | null | 2020-10-02T01:36:53 | 2020-09-11T02:17:28 | C | UTF-8 | C++ | false | false | 1,070 | cpp | classes_and_privacy.cpp | #include <stdio.h>
class Connection { // `class` is very similar to `struct`
// one of the main differences is that `class` assumes members
// are "private" by default, and `struct` assumes "public" by
// default. we can always be explicit though
private: // "private" means that this member is not accessable
// from outside the class. i.e. `db.SomeState` does not
// work
int SomeState;
public: // "public" means that this member IS accessable from
// outside the class
Connection() {
SomeState = 0;
printf("Connection constructor\n");
}
void Open(char * filename) {
this->SomeState = 1;
}
void Execute(char * statement) {
}
void Close() {
SomeState = 0;
}
~Connection() {
Close();
printf("Connection destructor\n");
}
};
int main() {
Connection db;
db.Open("C:\\temp\\stuff.db");
db.Execute("CREATE TABLE Hens (ID int, Name test)");
// db.SomeState; // this member is now not accessible because of the "private" declaration
} |
3353ae4e53bdf6a438ad567f93a7d7b7533910f3 | bd1cbd63c59d1f0c7fe11f7284b89f778c54f905 | /prx_packages/manipulation/simulation/systems/plants/motoman/motoman_parallel_unigripper.hpp | fc604cd2a3a8a4f5194e4493ef84ef5d6169b1d0 | [] | no_license | warehouse-picking-automation-challenges/rutgers_arm | e40019bec4b00838909c593466f8d3af320752fa | 647f5f7a3a87ad5fdc5dae04d61fc252885199c9 | refs/heads/master | 2021-06-03T20:08:16.371078 | 2016-08-26T16:37:56 | 2016-08-26T16:37:56 | 65,869,656 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,829 | hpp | motoman_parallel_unigripper.hpp | /**
* @file motoman.hpp
*
* @copyright Software License Agreement (BSD License)
* Copyright (c) 2015, Rutgers the State University of New Jersey, New Brunswick
* All Rights Reserved.
* For a full description see the file named LICENSE.
*
* Authors: Andrew Dobson, Andrew Kimmel, Athanasios Krontiris, Zakary Littlefield, Kostas Bekris
*
* Email: pracsys@googlegroups.com
*/
#pragma once
#ifndef PRX_MOTOMAN_PARALLEL_UNIGRIPPER_HPP
#define PRX_MOTOMAN_PARALLEL_UNIGRIPPER_HPP
#include "prx/utilities/definitions/defs.hpp"
#include "simulation/systems/plants/manipulator.hpp"
namespace prx
{
namespace packages
{
namespace manipulation
{
/**
*
*/
class motoman_parallel_unigripper_t : public manipulator_t
{
public:
motoman_parallel_unigripper_t();
virtual ~motoman_parallel_unigripper_t(){ }
/** @copydoc plant_t::init(const util::parameter_reader_t *, const util::parameter_reader_t*) */
virtual void init(const util::parameter_reader_t * reader, const util::parameter_reader_t* template_reader = NULL);
/** @copoydoc plant_t::update_phys_configs(util::config_list_t&, unsigned&) const */
virtual void update_phys_configs(util::config_list_t& configs, unsigned& index) const;
virtual void update_collision_info();
virtual bool is_end_effector_closed(int index) const;
virtual void propagate(const double simulation_step);
protected:
virtual void create_spaces();
void update_right_hand() const;
std::vector<double*> parallel_offsets;
};
}
}
}
#endif
|
2bdacf57b8b5e4f9603bcd4c415e1441e1aafb6f | 62dd2ff74f1a8f3ad55aa6c81eebd8091e4c84a0 | /khrgenerator/cpp/templates/khrbinding/SingleContextBinding.h | 0481ac630fe58f15b89ef3dde9586abc7c05280c | [
"MIT"
] | permissive | cginternals/khrbinding-generator | c4b758c86a5ee09f1dc33327520d9ce43afeddcf | b58b5a7b68da1f5b7f504f60798fd03919037237 | refs/heads/master | 2023-03-11T13:47:13.166984 | 2023-02-13T12:48:08 | 2023-02-13T12:48:08 | 126,962,191 | 7 | 2 | MIT | 2021-11-04T09:21:05 | 2018-03-27T09:27:16 | C++ | UTF-8 | C++ | false | false | 9,998 | h | SingleContextBinding.h |
#pragma once
#include <string>
#include <set>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#ifdef {{binding.useboostthread}}
#include <boost/thread.hpp>
namespace std_boost = boost;
#else
#include <mutex>
namespace std_boost = std;
#endif
#include <{{binding.identifier}}/{{binding.identifier}}_api.h>
#include <{{binding.identifier}}/{{binding.identifier}}_features.h>
#include <{{binding.identifier}}/AbstractFunction.h>
#include <{{binding.identifier}}/ContextHandle.h>
#include <{{binding.identifier}}/Function.h>
#include <{{binding.identifier}}/CallbackMask.h>
#include <{{binding.identifier}}/FunctionCall.h>
#include <{{binding.identifier}}/ProcAddress.h>
#include <{{binding.identifier}}/{{api.identifier}}/types.h>
namespace {{binding.namespace}}
{
/**
* @brief
* The main interface to handle additional features to OpenGL functions besides regular function calls
*
* Additional features include binding initialization (even for multi-threaded environments), additional function registration,
* context switches (for multi-context environments) and basic reflection in form of accessors to the full list of functions
*/
class {{binding.apiExport}} Binding
{
public:
/**
* @brief
* The callback type of a simple function callback without parameters and return value
*/
using SimpleFunctionCallback = std::function<void(const AbstractFunction &)>;
/**
* @brief
* The callback type of a function callback with parameters and return value
*/
using FunctionCallback = std::function<void(const FunctionCall &)>;
/**
* @brief
* The callback type of a function log callback with parameters and return value
*/
using FunctionLogCallback = std::function<void(FunctionCall &&)>;
using array_t = std::array<AbstractFunction *, {{functions|count}}>; ///< The type of the build-in functions collection
public:
/**
* @brief
* Deleted Constructor as all functions are static
*/
Binding() = delete;
/**
* @brief
* Initializes the binding for the current active OpenGL context
*
* @param[in] functionPointerResolver
* A function pointer to resolve binding functions for this context
* @param[in] resolveFunctions (optional)
* Whether to resolve function pointers lazy (resolveFunctions = false) or immediately
*
* @remarks
* After this call, the initialized context is already set active for the current thread.
* A functionPointerResolver with value 'nullptr' will get initialized with the function
* pointer from the initial thread.
*/
static void initialize({{binding.identifier}}::GetProcAddress functionPointerResolver, bool resolveFunctions = true);
/**
* @brief
* Registers an additional function for the additional features
*
* @param[in] function
* The function to register
*
* @remarks
* The additional features are callbacks, and use in multi-context environments
*/
static void registerAdditionalFunction(AbstractFunction * function);
/**
* @brief
* Resolve a single function pointer by given name
*
* @param[in] name
* The name of the function
*/
static ProcAddress resolveFunction(const char * name);
/**
* @brief
* Resolves the funtion pointers of all registered OpenGL functions immediately for the current context
*/
static void resolveFunctions();
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state
*
* @param[in] mask
* The new CallbackMask
*/
static void setCallbackMask(CallbackMask mask);
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state, excluding the blacklisted functions
*
* @param[in] mask
* The new CallbackMask
* @param[in] blackList
* The blacklist of functions to exclude in this update
*/
static void setCallbackMaskExcept(CallbackMask mask, const std::set<std::string> & blackList);
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state to include the passed CallbackMask
*
* @param[in] mask
* The CallbackMask to include
*/
static void addCallbackMask(CallbackMask mask);
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state to include the passed CallbackMask, excluding the blacklisted functions
*
* @param[in] mask
* The CallbackMask to include
* @param[in] blackList
* The blacklist of functions to exclude in this update
*/
static void addCallbackMaskExcept(CallbackMask mask, const std::set<std::string> & blackList);
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state to exclude the passed CallbackMask
*
* @param[in] mask
* The CallbackMask to exclude
*/
static void removeCallbackMask(CallbackMask mask);
/**
* @brief
* Updates the callback mask of all registered OpenGL functions in the current state to exclude the passed CallbackMask, excluding the blacklisted functions
*
* @param[in] mask
* The CallbackMask to exclude
* @param[in] blackList
* The blacklist of functions to exclude in this update
*/
static void removeCallbackMaskExcept(CallbackMask mask, const std::set<std::string> & blackList);
/**
* @brief
* Unresolved callback accessor
*
* @return
* The callback to use instead of unresolved function calls
*
* @remarks
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the After flag to enable the callback
*/
static SimpleFunctionCallback unresolvedCallback();
/**
* @brief
* Updates the unresolved callback that is called upon invocation of an OpenGL function which have no counterpart in the OpenGL driver
*
* @param[in] callback
* The callback to use instead of unresolved function calls
*
* @remarks
* This callback is registered globally across all states.
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the Unresolved flag to enable the callback
*/
static void setUnresolvedCallback(SimpleFunctionCallback callback);
/**
* @brief
* Before callback accessor
*
* @return
* The callback to use before an OpenGL function call
*
* @remarks
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the After flag to enable the callback
*/
static FunctionCallback beforeCallback();
/**
* @brief
* Updates the before callback that is called before the actual OpenGL function invocation
*
* @param[in] callback
* The callback to use before an OpenGL function call
*
* @remarks
* This callback is registered globally across all states.
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the Before flag to enable the callback
*/
static void setBeforeCallback(FunctionCallback callback);
/**
* @brief
* After callback accessor
*
* @return
* The callback to use after an OpenGL function call
*
* @remarks
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the After flag to enable the callback
*/
static FunctionCallback afterCallback();
/**
* @brief
* Updates the after callback that is called after the actual OpenGL function invocation
*
* @param[in] callback
* The callback to use after an OpenGL function call
*
* @remarks
* This callback is registered globally across all states.
* Keep in mind that in addition to a registered callback, the callback mask of the current Function has to include the After flag to enable the callback
*/
static void setAfterCallback(FunctionCallback callback);
static FunctionLogCallback logCallback();
static void setLogCallback(FunctionLogCallback callback);
/**
* @brief
* The accessor for all build-in functions
*
* @return
* The list of all build-in functions
*/
static const array_t & functions();
static const std::vector<AbstractFunction *> & additionalFunctions();
static size_t size();
static void unresolved(const AbstractFunction * function);
static void before(const FunctionCall & call);
static void after(const FunctionCall & call);
static void log(FunctionCall && call);
static int maxPos();
static int currentPos();
public:
{%- for function in functions|sort(attribute='identifier') %}
static Function<{{function.returnType.namespacedIdentifier}}{{ ", " if function.parameters|length > 0 }}{% for param in function.parameters %}{{ param.type.namespacedIdentifier }}{{ ", " if not loop.last }}{% endfor %}> {{function.namespaceLessIdentifier}}; ///< Wrapper for {{function.identifier}}
{%- endfor %}
protected:
static const array_t s_functions; ///< The list of all build-in functions
static std::vector<AbstractFunction *> & s_additionalFunctions();
static SimpleFunctionCallback & s_unresolvedCallback();
static FunctionCallback & s_beforeCallback();
static FunctionCallback & s_afterCallback();
static FunctionLogCallback & s_logCallback();
static {{binding.identifier}}::GetProcAddress & s_getProcAddress();
static std_boost::recursive_mutex & s_mutex();
};
} // namespace {{binding.namespace}}
|
25168905509cdc860e0ff052b52988fb0bc59353 | 302945a362836fb2e3c453f1aa981500a792f6e1 | /Validator/GenICam/library/CPP/include/cppunitex/TestCaseEx.h | 16e6b757779e18ef908b45810e907ac02ddba0b7 | [
"Apache-2.0"
] | permissive | genicam/GenICamXmlValidator | a39b0802a0b9fda51021a435fcc0f2f79b8ade5a | f3d0873dc2f39e09e98933aee927274a087a2a90 | refs/heads/master | 2023-01-13T01:14:26.518680 | 2020-11-09T02:07:32 | 2020-11-09T02:07:32 | 268,628,419 | 2 | 1 | Apache-2.0 | 2020-11-09T01:55:48 | 2020-06-01T20:44:51 | C++ | UTF-8 | C++ | false | false | 1,328 | h | TestCaseEx.h | #ifndef CPPUNIT_TESTCASEEX_H
#define CPPUNIT_TESTCASEEX_H
#include <cppunit/Portability.h>
#include <cppunit/TestLeaf.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/TestCase.h>
#include "LogEx.h"
CPPUNIT_NS_BEGIN
class TestResult;
class CPPUNIT_API TestCaseEx : public CPPUNIT_NS::TestCase
{
//friend class TestCallerEx;
public:
TestCaseEx();
TestCaseEx( const std::string &name );
virtual ~TestCaseEx();
void openParams(const std::string & fixtureName);
void closeParams();
//~log4cplus::helpers::Properties & getParams()
//~{
//~ return m_fixtureParams;
//~};
//~const log4cplus::helpers::Properties& getParams() const
//~{
//~ return m_fixtureParams;
//~}
protected:
std::string getFixtureName() const
{
return m_fixtureName;
};
std::string getPropertyFilename() const
{
return m_propertyFilename;
};
void debug(const char* stringFormat, ...) throw();
private:
TestCaseEx( const TestCaseEx &other );
TestCaseEx &operator=( const TestCaseEx &other );
std::string m_fixtureName;
std::string m_propertyFilename;
//~log4cplus::helpers::Properties m_fixtureParams;
LOG4CPP_NS::Category *m_pLogger;
};
CPPUNIT_NS_END
#endif // CPPUNIT_TESTCASE_H
|
045c4c18cad2b976589b5a80878437d2c6408838 | 1abf9817e862fb4258881b3cdc4601ca5ed7e40b | /OpenGL-terrain and teture/ConsoleApplication7/mygl.h | 2fce0dd11508d4146e14454fcbec9dde6f3f4c57 | [] | no_license | Hankang-Hu/OpenGL | 49966fdd3dd0e5b77536b9722ebb6c26d90255be | 792535f229c5829add6d1886884376296a97f28e | refs/heads/master | 2020-03-10T14:00:42.050870 | 2018-05-24T07:19:39 | 2018-05-24T07:19:39 | 129,414,961 | 1 | 0 | null | 2018-05-11T14:33:10 | 2018-04-13T14:40:39 | C++ | UTF-8 | C++ | false | false | 338 | h | mygl.h | #include <core/core.hpp>
#include <highgui/highgui.hpp>
#include <imgproc/imgproc.hpp>
#include <iostream>
#include <GL/glut.h>
using namespace std;
using namespace cv;
struct Vect
{
GLfloat x, y, z;
};
struct terr_map{
int rows;
int cols;
Vect *point;
};
terr_map mapdata(const string& filename);
Vect *Vertex_normal(terr_map map); |
99eb175ab12b9eae04d0df3eb51146e99965f13e | 9d2f0d0220ddd28281c14f4bd74d23875c079a91 | /include/RadonFramework/IO/SeekOrigin.hpp | f814e0d97476754dd370351b0c19e1d1933647b1 | [
"Apache-2.0"
] | permissive | tak2004/RadonFramework | 4a07b217aa2b5e27a6569f6bb659ac4aec7bdca7 | e916627a54a80fac93778d5010c50c09b112259b | refs/heads/master | 2021-04-18T23:47:52.810122 | 2020-06-11T21:01:50 | 2020-06-11T21:01:50 | 17,737,460 | 3 | 1 | null | 2015-12-11T16:56:34 | 2014-03-14T06:29:16 | C++ | UTF-8 | C++ | false | false | 390 | hpp | SeekOrigin.hpp | #ifndef RF_IO_SEEKORIGIN_HPP
#define RF_IO_SEEKORIGIN_HPP
#if _MSC_VER > 1000
#pragma once
#endif
namespace RadonFramework::IO
{
namespace SeekOrigin
{
enum Type
{
Begin = 0,
Current,
End,
MAX
};
}
} // namespace RadonFramework::IO
#ifndef RF_SHORTHAND_NAMESPACE_IO
#define RF_SHORTHAND_NAMESPACE_IO
namespace RF_IO = RadonFramework::IO;
#endif
#endif // RF_IO_SEEKORIGIN_HPP
|
dd53131c0728d95777ba282d6bdf748b493ada6e | bc730c93d6c4f8d41ae8d717bd5c5e92b1f63074 | /PSS_HomeWork4/Additional_classes/order.cpp | 5b2fdd76d678e2d8ca8724adc4a0df8ef8a2e2d9 | [] | no_license | V-Roman-V/PSS_HomeWork4 | 15ca4d0ea75d526c5fdc8f11194ba267d7fdad26 | d22874c1f1f6ddb6f5c23b56c2eff8da238ee672 | refs/heads/main | 2023-04-19T23:39:01.148768 | 2021-04-26T19:16:20 | 2021-04-26T19:16:20 | 355,178,484 | 0 | 0 | null | 2021-05-06T05:18:53 | 2021-04-06T12:21:52 | C++ | UTF-8 | C++ | false | false | 732 | cpp | order.cpp | #include "order.h"
std::ostream& operator<<(std::ostream &out, const Order &O){
out<<"Order{number: "<<O.number<<",";
out<<"car: " <<O.car<<",";
out<<"price: " <<O.price<<",";
out<<"time: " <<O.time.toString().toStdString()<<",";
out<<"date: " <<O.date<<"}";
return out;
}
void Order::print() const
{
std::cout<<"Order number: "<<number<<std::endl;
std::cout<<" from : "<<from<<std::endl;
std::cout<<" to : "<<to<<std::endl;
std::cout<<" car : "<<car<<std::endl;
std::cout<<" price : "<<price<<std::endl;
std::cout<<" time : "<<time.toString().toStdString()<<std::endl;
std::cout<<" date : "<<date<<std::endl;
}
|
d09cbd2819b5cbdee0e5e573158a0f99b2e4b38b | 33b9fdcf9a1fe13a5814649b968d935d9b657914 | /NxS Balloon Tip Source/NxSTrayIcon.h | c06b63e133297e00fe824c362ff41bf0843334c5 | [
"MIT"
] | permissive | saivert/winamp-plugins | 062899b22177bfcee9363c8141903843c90d89cf | 5dae16e80bb63e3de258b4279c444bf2434de564 | refs/heads/master | 2021-08-09T02:52:18.652137 | 2020-06-10T11:38:50 | 2020-06-10T11:38:50 | 190,212,102 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,668 | h | NxSTrayIcon.h | /*
** Written by Saivert
**
** License:
** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
** liable for any damages arising from the use of this software.
**
** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
** alter it and redistribute it freely, subject to the following restrictions:
**
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
**
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
**
** 3. This notice may not be removed or altered from any source distribution.
**
*/
#if !defined(__NXSTRAYICON_H)
#define __NXSTRAYICON_H
#if _MSC_VER > 1000
#pragma once
#endif
#include <windows.h>
#include <shellapi.h>
class CNxSTrayIcon
{
private:
bool m_IsNewShell;
bool m_created;
bool m_visible;
DWORD m_timeout;
NOTIFYICONDATA m_nid;
public:
CNxSTrayIcon(void);
virtual ~CNxSTrayIcon(void);
// Sets the callback message for the tray icon. Returns previous value.
UINT SetCallbackMsg(UINT uMsg);
// Associates a window with the tray icon. Returns previous value.
HWND SetWnd(HWND hWnd);
// Methods to manipulate tray icon after it is setup
BOOL Show(void); // Shows the tray icon, or adds it to the taskbar if it's not already added.
BOOL Hide(void); // Hides the tray icon
BOOL IsVisible(void) { return m_visible; } // Don't rely on this to be true though.
BOOL Remove(void); // Removes the tray icon from the taskbar. Do not confuse with Hide()!!
DWORD SetTimeout(DWORD newtimeout); // Returns old timeout value
DWORD GetTimeout(void) { return m_timeout; }
HICON SetIcon(HICON newicon); // Returns previous icon.
HICON GetIcon(void) { return m_nid.hIcon; }
void SetTooltip(const char *newtip);
const char * GetTooltip(void) { return m_nid.szTip; }
// Balloon Popup methods
// Displays a balloon style tooltip withs it's stem pointing at the tray icon
BOOL ShowBalloon(const char *szInfo, const char *szInfoTitle, DWORD dwFlags);
void HideBalloon(void);
// Special stuff
// Sets the id used for the tray icon. Normally you don't need to call this.
void SetID(UINT uID) { m_nid.uID = uID; }
// Sets the version for the tray icon. Modifies the messaging style and so on...
BOOL SetVersion(int version);
// Sets the focus to the tray icon. A side effect of this is that the
// tooltip is displayed for about a second.
BOOL SetFocus(void);
// Sets the GUID for the tray icon. Used to uniquely distinguish between tray icons.
BOOL SetGUID(const GUID Guid);
// Call this when your window procedure receives the "TaskbarCreated" message
// registered using RegisterWindowMessage(). It will add the icon to the taskbar
// and show it, if it was previously visible. It will add it but not show it, if it
// was previously hidden.
void Restore(void);
bool IsTaskbarAvailable(void); // Returns true if the taskbar is available
// Attaches the CNxSTrayIcon object to an existing tray icon.
// No error checking is performed, so make sure the parameters are valid.
// This is actually the same as calling both SetWnd and SetID methods,
// but I inluded this methods to follow the MFC style classes.
void Attach(HWND wnd, UINT id);
void Detach();
};
#endif // !defined(__NXSTRAYICON_H)
|
1c12c15fc0cefd09c50cf7814285b060d239b0bc | 8dd6b944bd0a4c102ea18c236a90797b97ad2a98 | /Plugins/GoreMod/Source/GoreMod/Public/BaseGoreCharacter.h | 3bbef9279ed115f67f9531fca7779960ddd4cc37 | [] | no_license | jorgemmm/BoneBrakePlugin | 2e291fc57424210117c613224906062727023c63 | 3f6983c6c0ac8135134be42bc7f8c4c8fb5aadda | refs/heads/master | 2023-03-21T15:30:20.053322 | 2021-03-18T20:42:34 | 2021-03-18T20:42:34 | 349,211,727 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,217 | h | BaseGoreCharacter.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "BaseGoreCharacter.generated.h"
class UPrimitiveComponent;
UCLASS()
class GOREMOD_API ABaseGoreCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ABaseGoreCharacter();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UFUNCTION()
void OnCharacterHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExploteBone")//, meta = (AllowPrivateAccess = "true"))
FName BoneName = TEXT("spine_01");
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExploteBone")
TArray<FName> BoneNames;
UFUNCTION(BlueprintCallable)
void BreakBone(FVector Direction,FName inBoneName);
};
|
cd7f82a4707549cd4c1628185af9042b68994dbf | 2812fdd8abcc6feb1e5414ee41aa12bd0f57e7bb | /src/util/hash.cpp | 163cfa0f5451b1cd3b928e726bc4d808fd00fdd8 | [
"MIT"
] | permissive | 3DStris/3DStris | b1e343f23be1e1cbd0ee1c2b89bcd3b5de0ac386 | a99be7997a0bdb351260aad720a79059bc09258d | refs/heads/master | 2023-09-04T20:02:35.335231 | 2021-04-27T00:48:46 | 2021-04-27T00:48:46 | 221,584,586 | 32 | 8 | MIT | 2020-09-30T12:13:09 | 2019-11-14T01:25:19 | C++ | UTF-8 | C++ | false | false | 3,216 | cpp | hash.cpp | // Hashing taken from https://github.com/martinus/robin-hood-hashing,
// Copyright (c) 2018-2020 Martin Ankerl, 2020 Contributors to the 3DStris
// 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.
extern "C" {
#include <3ds/types.h>
}
#include <string.h>
#include <3dstris/util/hash.hpp>
template <typename T>
inline T unaligned_load(const void* ptr) noexcept {
// using memcpy so we don't get into unaligned load problems.
// compiler should optimize this very well anyways.
T t;
memcpy(&t, ptr, sizeof(T));
return t;
}
#if __has_cpp_attribute(clang::fallthrough)
#define FALLTHROUGH() [[clang::fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
#define FALLTHROUGH() [[gnu::fallthrough]]
#else
#define FALLTHROUGH()
#endif
static size_t hash_bytes(const void* ptr, const size_t len) noexcept {
static constexpr u64 m = UINT64_C(0xc6a4a7935bd1e995);
static constexpr u64 seed = UINT64_C(0xe17a1465);
static constexpr u32 r = 47;
const auto data64 = static_cast<const u64*>(ptr);
u64 h = seed ^ (len * m);
const size_t n_blocks = len / 8;
for (size_t i = 0; i < n_blocks; ++i) {
auto k = unaligned_load<u64>(data64 + i);
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
}
const auto data8 = reinterpret_cast<const u8*>(data64 + n_blocks);
switch (len & 7U) {
case 7:
h ^= static_cast<u64>(data8[6]) << 48U;
FALLTHROUGH(); // FALLTHROUGH
case 6:
h ^= static_cast<u64>(data8[5]) << 40U;
FALLTHROUGH(); // FALLTHROUGH
case 5:
h ^= static_cast<u64>(data8[4]) << 32U;
FALLTHROUGH(); // FALLTHROUGH
case 4:
h ^= static_cast<u64>(data8[3]) << 24U;
FALLTHROUGH(); // FALLTHROUGH
case 3:
h ^= static_cast<u64>(data8[2]) << 16U;
FALLTHROUGH(); // FALLTHROUGH
case 2:
h ^= static_cast<u64>(data8[1]) << 8U;
FALLTHROUGH(); // FALLTHROUGH
case 1:
h ^= static_cast<u64>(data8[0]);
h *= m;
FALLTHROUGH(); // FALLTHROUGH
default:
break;
}
h ^= h >> r;
h *= m;
h ^= h >> r;
return static_cast<size_t>(h);
}
size_t StringHash::operator()(StringView v) const {
return hash_bytes(v.data(), v.length());
}
bool StringEq::operator()(StringView lhs, StringView rhs) const {
return lhs == rhs;
}
|
9549652cffe599eb0aa5f61854350022a780ad16 | 8d52c40a3c5acc0a374198566d6b98d071aa1f86 | /cppcheck/data/c_files/591.cpp | 00cde2f6f4c1f7b24051b13684a473726e4b8908 | [
"MIT"
] | permissive | awsm-research/LineVul | 8f6e6a7ee34c50b2b8d7d4a2d79b680f38c141d6 | e739809970189f715aef6a707c1543786e3a9ec8 | refs/heads/main | 2023-04-29T04:03:06.454615 | 2023-04-15T06:59:41 | 2023-04-15T06:59:41 | 449,643,469 | 51 | 23 | null | null | null | null | UTF-8 | C++ | false | false | 6,556 | cpp | 591.cpp | decompileAction(int n, SWF_ACTION *actions, int maxn)
{
if( n > maxn ) SWF_error("Action overflow!!");
#ifdef DEBUG
fprintf(stderr,"%d:\tACTION[%3.3d]: %s\n",
actions[n].SWF_ACTIONRECORD.Offset, n,
actionName(actions[n].SWF_ACTIONRECORD.ActionCode));
#endif
switch(actions[n].SWF_ACTIONRECORD.ActionCode)
{
case SWFACTION_END:
return 0;
case SWFACTION_CONSTANTPOOL:
decompileCONSTANTPOOL(&actions[n]);
return 0;
case SWFACTION_GOTOLABEL:
return decompileGOTOFRAME(n, actions, maxn,1);
case SWFACTION_GOTOFRAME:
return decompileGOTOFRAME(n, actions, maxn,0);
case SWFACTION_GOTOFRAME2:
return decompileGOTOFRAME2(n, actions, maxn);
case SWFACTION_WAITFORFRAME:
decompileWAITFORFRAME(&actions[n]);
return 0;
case SWFACTION_GETURL2:
decompileGETURL2(&actions[n]);
return 0;
case SWFACTION_GETURL:
decompileGETURL(&actions[n]);
return 0;
case SWFACTION_PUSH:
decompilePUSH(&actions[n]);
return 0;
case SWFACTION_PUSHDUP:
decompilePUSHDUP(&actions[n]);
return 0;
case SWFACTION_STACKSWAP:
decompileSTACKSWAP(&actions[n]);
return 0;
case SWFACTION_SETPROPERTY:
decompileSETPROPERTY(n, actions, maxn);
return 0;
case SWFACTION_GETPROPERTY:
decompileGETPROPERTY(n, actions, maxn);
return 0;
case SWFACTION_GETTIME:
return decompileGETTIME(n, actions, maxn);
case SWFACTION_TRACE:
decompileTRACE(n, actions, maxn);
return 0;
case SWFACTION_CALLFRAME:
decompileCALLFRAME(n, actions, maxn);
return 0;
case SWFACTION_EXTENDS:
decompileEXTENDS(n, actions, maxn);
return 0;
case SWFACTION_INITOBJECT:
decompileINITOBJECT(n, actions, maxn);
return 0;
case SWFACTION_NEWOBJECT:
decompileNEWOBJECT(n, actions, maxn);
return 0;
case SWFACTION_NEWMETHOD:
decompileNEWMETHOD(n, actions, maxn);
return 0;
case SWFACTION_GETMEMBER:
decompileGETMEMBER(n, actions, maxn);
return 0;
case SWFACTION_SETMEMBER:
decompileSETMEMBER(n, actions, maxn);
return 0;
case SWFACTION_GETVARIABLE:
decompileGETVARIABLE(n, actions, maxn);
return 0;
case SWFACTION_SETVARIABLE:
decompileSETVARIABLE(n, actions, maxn, 0);
return 0;
case SWFACTION_DEFINELOCAL:
decompileSETVARIABLE(n, actions, maxn, 1);
return 0;
case SWFACTION_DEFINELOCAL2:
decompileDEFINELOCAL2(n, actions, maxn);
return 0;
case SWFACTION_DECREMENT:
return decompileINCR_DECR(n, actions, maxn, 0);
case SWFACTION_INCREMENT:
return decompileINCR_DECR(n, actions, maxn,1);
case SWFACTION_STOREREGISTER:
decompileSTOREREGISTER(n, actions, maxn);
return 0;
case SWFACTION_JUMP:
return decompileJUMP(n, actions, maxn);
case SWFACTION_RETURN:
decompileRETURN(n, actions, maxn);
return 0;
case SWFACTION_LOGICALNOT:
return decompileLogicalNot(n, actions, maxn);
case SWFACTION_IF:
return decompileIF(n, actions, maxn);
case SWFACTION_WITH:
decompileWITH(n, actions, maxn);
return 0;
case SWFACTION_ENUMERATE:
return decompileENUMERATE(n, actions, maxn, 0);
case SWFACTION_ENUMERATE2 :
return decompileENUMERATE(n, actions, maxn,1);
case SWFACTION_INITARRAY:
return decompileINITARRAY(n, actions, maxn);
case SWFACTION_DEFINEFUNCTION:
return decompileDEFINEFUNCTION(n, actions, maxn,0);
case SWFACTION_DEFINEFUNCTION2:
return decompileDEFINEFUNCTION(n, actions, maxn,1);
case SWFACTION_CALLFUNCTION:
return decompileCALLFUNCTION(n, actions, maxn);
case SWFACTION_CALLMETHOD:
return decompileCALLMETHOD(n, actions, maxn);
case SWFACTION_INSTANCEOF:
case SWFACTION_SHIFTLEFT:
case SWFACTION_SHIFTRIGHT:
case SWFACTION_SHIFTRIGHT2:
case SWFACTION_ADD:
case SWFACTION_ADD2:
case SWFACTION_SUBTRACT:
case SWFACTION_MULTIPLY:
case SWFACTION_DIVIDE:
case SWFACTION_MODULO:
case SWFACTION_BITWISEAND:
case SWFACTION_BITWISEOR:
case SWFACTION_BITWISEXOR:
case SWFACTION_EQUAL:
case SWFACTION_EQUALS2:
case SWFACTION_LESS2:
case SWFACTION_LOGICALAND:
case SWFACTION_LOGICALOR:
case SWFACTION_GREATER:
case SWFACTION_LESSTHAN:
case SWFACTION_STRINGEQ:
case SWFACTION_STRINGCOMPARE:
case SWFACTION_STRICTEQUALS:
return decompileArithmeticOp(n, actions, maxn);
case SWFACTION_POP:
pop();
return 0;
case SWFACTION_STARTDRAG:
return decompileSTARTDRAG(n, actions, maxn);
case SWFACTION_DELETE:
return decompileDELETE(n, actions, maxn,0);
case SWFACTION_DELETE2:
return decompileDELETE(n, actions, maxn,1);
case SWFACTION_TARGETPATH:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"targetPath");
case SWFACTION_TYPEOF:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"typeof");
case SWFACTION_ORD:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"ord");
case SWFACTION_CHR:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"chr");
case SWFACTION_INT:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"int");
case SWFACTION_TOSTRING:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"String");
case SWFACTION_TONUMBER:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"Number");
case SWFACTION_RANDOMNUMBER:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"random");
case SWFACTION_STRINGLENGTH:
return decompileSingleArgBuiltInFunctionCall(n, actions, maxn,"length");
case SWFACTION_PLAY:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"play");
case SWFACTION_STOP:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"stop");
case SWFACTION_NEXTFRAME:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"nextFrame");
case SWFACTION_PREVFRAME:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"prevFrame");
case SWFACTION_ENDDRAG:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"stopDrag");
case SWFACTION_STOPSOUNDS:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"stopAllSounds");
case SWFACTION_TOGGLEQUALITY:
return decompile_Null_ArgBuiltInFunctionCall(n, actions, maxn,"toggleHighQuality");
case SWFACTION_MBSUBSTRING:
case SWFACTION_SUBSTRING:
return decompileSUBSTRING(n, actions, maxn);
case SWFACTION_STRINGCONCAT:
return decompileSTRINGCONCAT(n, actions, maxn);
case SWFACTION_REMOVECLIP:
return decompileREMOVECLIP(n, actions, maxn);
case SWFACTION_DUPLICATECLIP:
return decompileDUPLICATECLIP(n, actions, maxn);
case SWFACTION_SETTARGET:
return decompileSETTARGET(n, actions, maxn,0);
case SWFACTION_SETTARGET2:
return decompileSETTARGET(n, actions, maxn,1);
case SWFACTION_IMPLEMENTSOP:
return decompileIMPLEMENTS(n, actions, maxn);
case SWFACTION_CASTOP:
return decompileCAST(n, actions, maxn);
case SWFACTION_THROW:
return decompileTHROW(n, actions, maxn);
case SWFACTION_TRY:
return decompileTRY(n, actions, maxn);
default:
outputSWF_ACTION(n,&actions[n]);
return 0;
}
}
|
c1c41d90bd3be9351d79ec8957d3018d1b8b9955 | 459924c7157eaa988b5f36261c9ed5d453761c8d | /net_training/internal_msg.h | e6dafa9607c991abf93dd970ff32ea022d2b4812 | [] | no_license | atomolcl/net_training | 8c2f113d7273fe651f54216fc0164ee71b6ed16f | 52ef629b7b87d128ddabb4cdb0d8f169e36b94ca | refs/heads/master | 2018-12-31T20:29:48.818677 | 2014-05-05T05:17:18 | 2014-05-05T05:17:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 668 | h | internal_msg.h | #ifndef INTERNAL_MSG_H
#define INTERNAL_MSG_H
#include <stdint.h>
namespace net_training {
#define INTERNAL_MSG_TYPE_SHIFT 24
#define make_msg_type(t, s) (t << INTERNAL_MSG_TYPE_SHIFT | s)
#define mask_msg_type_high(t) ((t >> INTERNAL_MSG_TYPE_SHIFT) & ((1 << (sizeof(t)*8 - INTERNAL_MSG_TYPE_SHIFT))-1))
#define mask_msg_type_low(t) (t & (1 << INTERNAL_MSG_TYPE_SHIFT) - 1)
enum internal_msg_type {
IMT_SYS = 1,
IMT_NET = 2
};
enum imt_sys_sub {
ISS_CONNECT = 1,
ISS_DISCONNECT = 2
};
struct internal_msg {
int type;
void* dst;
void* data;
//size_t size;
internal_msg() {
data = 0;
}
};
struct net_msg_head {
int size;
int op_type;
};
}
#endif |
8926862a400135dfc9ed7bebc88456f166fe1536 | 90e46b80788f2e77eb68825011c682500cabc59c | /Codeforces/1155A.cpp | 4ace41e5100ce3e24974c1e02e9f86d0de56e2d5 | [] | no_license | yashsoni501/Competitive-Programming | 87a112e681ab0a134b345a6ceb7e817803bee483 | 3b228e8f9a64ef5f7a8df4af8c429ab17697133c | refs/heads/master | 2023-05-05T13:40:15.451558 | 2021-05-31T10:04:26 | 2021-05-31T10:04:26 | 298,651,663 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 245 | cpp | 1155A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll cha(char a,char b)
{
return min((a-b+26)%26,(b-a+26)%26);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
} |
f0943018b114881692fdd3cdb0323344b0c96891 | 57a5a4ba2f1af35e2284552d94e34c1b3b11aa3c | /3D学生管理系统/shader/effect demo.cpp | be41d261286b3c5928fbbf440b5700db4a5dcfdd | [] | no_license | poigwym/3DstudentSystem | 132fc2bd9dfdf6aef07b72395569a3b9f8dd14c0 | f0280aef44a955166679cc26aeca88fb0d7a0f59 | refs/heads/master | 2021-01-10T04:36:18.315403 | 2016-02-02T14:38:39 | 2016-02-02T14:38:39 | 50,907,810 | 2 | 0 | null | 2016-02-02T14:54:20 | 2016-02-02T09:04:39 | C++ | WINDOWS-1252 | C++ | false | false | 3,228 | cpp | effect demo.cpp | //
//
//
//
//#include"d3dutil.h"
//#include"animation.h"
//#include"camera.h"
//#include"inputsystem.h"
//using namespace d3d;
//
//using namespace std;
//#define FUCK MessageBox(0, "fuck",0,0)
//#define mout(x) MessageBox(0, x, 0, 0)
//
//HWND ghwnd;
//LPDIRECT3DDEVICE9 d3dDevice;
//Camera *camera;
//InputController *dxinput;
//ID3DXMesh *teapot;
//char *Xname = "lxq.X";
//SkinMesh *ani;
//
//
//
//
//struct Shader {
// LPDIRECT3DDEVICE9 d3dDevice;
//
// Shader() { memset(this, 0, sizeof(*this)); }
// Shader(LPDIRECT3DDEVICE9 _d3dDevice) : d3dDevice(_d3dDevice) {}
// virtual ~Shader() {}
// virtual void init() {}
// virtual void render() {}
//};
//
//
//struct EffectShader : public Shader {
// ID3DXEffect *es;
// ID3DXBuffer *errorbuf;
// D3DXHANDLE hW, hVP;
// D3DXHANDLE hL;
// EffectShader(LPDIRECT3DDEVICE9 d3dDevice, const char*filename):Shader(d3dDevice) {
// if(FAILED(D3DXCreateEffectFromFile(d3dDevice, filename, 0, 0, 0, 0, &es, &errorbuf)))
// {
// mout((char*)errorbuf->GetBufferPointer());
// exit(1);
// return;
// }
// hW = es->GetParameterBySemantic(0, "WORLD");
// hVP = es->GetParameterBySemantic(0, "VIEWPROJ");
// hL = es->GetParameterBySemantic(0, "LIGHTPOS");
//
// }
//
// void render() {
// es->SetTechnique("Lighting");
// es->SetTechnique("Shadow");
// D3DXVECTOR4 lightpos = { 50, 50, 0, 1 };
//
// es->SetVector(hL, &lightpos);
// D3DXMATRIX viewproj, world;
// D3DXMatrixIdentity(&world);
// es->SetMatrix("WorldMat", &world);
// viewproj = camera->GetView()*camera-> GetProj();
// es->SetMatrix("ViewProjMat", &viewproj);
// UINT c;
//
// es->Begin(&c, 0);
// for(int i=0;i<c;++i) {
// es->BeginPass(i);
// es->CommitChanges();
// teapot->DrawSubset(0);
// ani->Render();
// es->EndPass();
// }
// es->End();
// }
//};
//
//EffectShader *es;
//void init() {
// es = new EffectShader(d3dDevice, "eff.hlsl");
//
// camera = new Camera(d3dDevice, WID, HEI);
// camera->SetEye(0, 0, -50);
// camera->SetTar(0, 0, 0);
// camera->SetView();
// camera->SetProj();
// camera->SetViewport();
//
// D3DXCreateTeapot(d3dDevice, &teapot, 0);
// ani = new SkinMesh(Xname, d3dDevice);
//
//}
//
//void update() {
// dxinput->update();
// if (dxinput->KeyDown(DIK_A)) camera->move(-0.1f, 0, 0);
// else if (dxinput->KeyDown(DIK_D))camera->move(0.1f, 0, 0);
// else if (dxinput->KeyDown(DIK_W))camera->move(0, 0, 0.1f);
// else if (dxinput->KeyDown(DIK_S))camera->move(0, 0, -0.1f);
//
// camera->rot(Camera::up, 0.01*dxinput->GetMouseX());
// camera->rot(Camera::rig, 0.01*dxinput->GetMouseY());
//}
//
//void render() {
// update();
// d3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0);
// d3dDevice->BeginScene();
//
// teapot->DrawSubset(0);
// es->render();
//
// d3dDevice->EndScene();
// d3dDevice->Present(0, 0, 0, 0);
//}
//
//
//void clear() {
//
// RELEASE(d3dDevice);
// DELETE(camera);
// DELETE(dxinput);
//}
////Èë¿Úº¯Êý
//int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lptCmdLine, int nCmd)
//{
// if (!(ghwnd = WinInit(hInstance, &d3dDevice))) {
// return 0;
// }
// dxinput = new InputController(hInstance, ghwnd, 0);
//
// init();
//
// GameLoop(render);
//
// return 0;
//} |
a39d5f261c5f739c2a37763547b0724798ed4457 | d5dcf9cdee57033dd304ee6896f5d23982e0eff3 | /PublicUtils/include/public_utils/timer/time.h | f283aed3cfd23639603232e5997148952ef8b104 | [] | no_license | qjajdccyqt/ThirdParty | 24c2b6ac34022bf99629e65a4661f480c9b59f85 | f4a0ff8d19ec89e2b713bf32967332629ac725bd | refs/heads/master | 2023-07-11T14:08:03.782783 | 2021-08-03T12:05:30 | 2021-08-03T12:05:30 | 391,966,626 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 374 | h | time.h | #pragma once
#include <chrono>
namespace PublicUtils
{
void Sleep(const std::chrono::milliseconds & duration);
void Sleep(const std::chrono::seconds & duration);
class TimeClock
{
public:
TimeClock();
~TimeClock();
std::chrono::nanoseconds Elapsed() const;
void Reset();
private:
std::chrono::steady_clock::time_point _clock;
};
}
|
5c052ca487acab8c4bac4f3294cc7742ee21e7b9 | 55d0224c99ce313246c6d7aada74458923d57822 | /test/issues/github_252.cpp | 34df48d2873cc4f33d244648a9b893d5bd56f56d | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | boostorg/hana | 94535aadaa43cb88f09dde9172a578b2b049dc95 | d3634a3e9ce49a2207bd7870407c05e74ce29ef5 | refs/heads/master | 2023-08-24T11:47:37.357757 | 2023-03-17T14:00:22 | 2023-03-17T14:00:22 | 19,887,998 | 1,480 | 245 | BSL-1.0 | 2023-08-08T05:39:22 | 2014-05-17T14:06:06 | C++ | UTF-8 | C++ | false | false | 1,145 | cpp | github_252.cpp | // Copyright Sergey Nizovtsev 2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <boost/hana/assert.hpp>
#include <boost/hana/core/is_a.hpp>
#include <boost/hana/functional/partial.hpp>
#include <boost/hana/product.hpp>
#include <boost/hana/range.hpp>
#include <boost/hana/traits.hpp>
#include <boost/hana/transform.hpp>
#include <boost/hana/tuple.hpp>
#include <boost/hana/type.hpp>
namespace hana = boost::hana;
int main() {
constexpr auto type = hana::type_c<int[2][3][4]>;
BOOST_HANA_CONSTANT_CHECK(
hana::is_an<hana::integral_constant_tag<size_t>>(
hana::traits::extent(type, hana::uint_c<1>)
)
);
// Check that we can multiple extents in size_t's ring
hana::product<hana::integral_constant_tag<size_t>>(
hana::transform(
hana::to_tuple(
hana::make_range(
hana::size_c<0>,
hana::traits::rank(type)
)
),
hana::partial(hana::traits::extent, type)
)
);
}
|
d39791d84c17ad6ae8544ab657544c4644422f75 | 3c02b7eeaf248b16e3cdc48454a560ebf69bea95 | /ktlt/graph2.cpp | 0ee9870de4e93e1db2c52ce9f68cdcd3616168b9 | [] | no_license | longvd336/ds-algo | 26ab489e2a5dd1499df14cef2b5bfc4445054456 | 789d24befc5f80395748dab48c96fcb01f0915cf | refs/heads/main | 2023-07-01T10:01:18.139286 | 2021-08-07T07:03:53 | 2021-08-07T07:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,186 | cpp | graph2.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX 100
struct graph
{
int V, E;
int a[MAX][MAX];
};
void docDSC(graph &g) {
FILE*f = fopen("DSC.txt", "r");
fscanf(f,"%d%d", &g.V, &g.E);
int i, j;
// tao MTK 0
for(i = 1; i <= g.V; i++) {
for(j = 1; j <= g.V; j++) {
g.a[i][j] = 0;
}
}
// gan gia tri MTK
for(i = 1; i <= g.E; i++) {
int u, v;
fscanf(f, "%d%d",&v, &u);
g.a[u][v] = g.a[v][u] = 1;
}
fclose(f);
}
void ghiMTK(graph g) {
int i, j;
FILE*f = fopen("MTK1.txt","w");
fprintf(f, "%d\n", g.V);
for(i = 1; i <= g.V; i++) {
for(j = 1;j <= g.V; j++) {
fprintf(f, "%3d", g.a[i][j]);
}
fprintf(f,"\n");
}
fclose(f);
}
void ghiDSK(graph g) {
int i, j;
FILE*f = fopen("DSK1.txt", "w");
fprintf(f, "%d\n", g.V);
for(i = 1; i <= g.V; i++) {
for(j = 1; j <= g.V; j++) {
if(g.a[i][j] == 1) {
fprintf(f,"%3d", j);
}
}
fprintf(f, "\n");
}
fclose(f);
}
int main() {
graph g;
docDSC(g);
ghiDSK(g);
ghiMTK(g);
return 0;
} |
44d64a8de2638c8d84ab9c5e6349d4c8c5dd7f72 | 209f6d4f820012a72297804f5bc9bf2e554a43f3 | /SLOUCH/SLOUCH.ino | 0a276b10909eff71b019f70d3f6b118ca55b2cef | [] | no_license | jlee0627/iat320 | e8ebb4bfc21c3a755e979687c38022b560c7fcce | 4738cc8492b3642524824fb31d347386f1d96ba8 | refs/heads/master | 2023-01-20T11:17:39.748072 | 2020-11-23T16:33:28 | 2020-11-23T16:33:28 | 295,597,147 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,180 | ino | SLOUCH.ino | #include <Adafruit_CircuitPlayground.h>
#define SLOUCH_ANGLE 10.0 // allowable slouch angle (deg)
#define SLOUCH_TIME 3000 // allowable slouch time (secs)
#define GRAVITY 9.80665 // standard gravity (m/s^s)
#define RAD2DEG 52.29578 // convert radians to degrees
#define SLOUCH_OVERTIME 9000
float currentAngle;
float targetAngle;
unsigned long slouchStartTime;
bool slouching;
int presets[3][2][3] = {
{
{27, 167, 132}, {152, 54, 128}
},
{
{0, 0, 255}, {255, 215, 26}
},
{
{230, 50, 50}, {255, 0, 0}
}
};
int preset = 0;
///////////////////////////////////////////////////////////////////////////////
void setup() {
// Initialize Circuit Playground
CircuitPlayground.begin();
// Initialize target angle to zero.
targetAngle = 0;
CircuitPlayground.setBrightness(255);
}
///////////////////////////////////////////////////////////////////////////////
void loop() {
// Compute current angle
currentAngle = RAD2DEG * asin(-CircuitPlayground.motionZ() / GRAVITY);
// Set target angle on button press
if ((CircuitPlayground.leftButton()) || (CircuitPlayground.rightButton())) {
targetAngle = currentAngle;
CircuitPlayground.playTone(900,100);
delay(100);
CircuitPlayground.playTone(900,100);
delay(100);
}
// Check for slouching
if (currentAngle - targetAngle > SLOUCH_ANGLE) {
if (!slouching) slouchStartTime = millis();
slouching = true;
} else {
slouching = false;
}
// If we are slouching
if (slouching) {
// Check how long we've been slouching
if (millis() - slouchStartTime > SLOUCH_TIME) {
// Play a tone
CircuitPlayground.playTone(300, 500);
delay(50);
}
if (slouching) {
if (millis() - slouchStartTime > SLOUCH_OVERTIME) {
CircuitPlayground.playTone(600, 500);
for (int i = 0; i < 10; i++) {
CircuitPlayground.setPixelColor(i, presets[preset][i % 2][0], presets[preset][i % 2][1], presets[preset][i % 2][2]);
}
delay(100);
CircuitPlayground.clearPixels();
delay(50);
}
}
}
}
|
cbafd3624dbf9f2c73bc69993bd92954439dbc64 | 4ebdf4749ae5d036897669f1f2eb5cb33960dba8 | /5_state_button/5_state_button.ino | 9a1d7afe1642a4b9959bba0d68de440bc4bc49cd | [] | no_license | margocrawf/poe-miscellaneous | f234dea0797e0307071420b7d277b4d35950c954 | 84e4afa6198b1deeef2fef51c980a948b8091d1e | refs/heads/master | 2021-01-23T08:34:10.597013 | 2017-10-12T03:26:46 | 2017-10-12T03:26:46 | 102,535,200 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,450 | ino | 5_state_button.ino | int buttonInput = 3;
int buttonState = 0;
int prevButtonState = 0;
int lightState = 0;
int redLightOutput = 13;
int yellowLightOutput = 12;
int greenLightOutput = 11;
int blinkSpeed = 1000;
int potPin = 2;
int lastFlashTime = millis();
int flashState = HIGH;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
boolean shouldToggle() {
// determines if should be toggled, based on previous button state
// and debouncing
int reading = digitalRead(buttonInput);
if (reading != prevButtonState) {
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay) {
if (reading != buttonState) {
buttonState = reading;
if (buttonState == HIGH) {
return true;
}
}
}
prevButtonState = reading;
return false;
}
void writeLights(int state) {
//set lights to high or low depending on the state
if (state == 0) {
digitalWrite(redLightOutput, LOW);
digitalWrite(greenLightOutput, LOW);
digitalWrite(yellowLightOutput, LOW);
}
else if (state == 1) {
digitalWrite(redLightOutput, HIGH);
digitalWrite(greenLightOutput, HIGH);
digitalWrite(yellowLightOutput, HIGH);
}
else if (state == 2) {
if ((millis()-lastFlashTime) > blinkSpeed) {
flashState = !flashState;
lastFlashTime = millis();
}
digitalWrite(redLightOutput, flashState);
digitalWrite(greenLightOutput, flashState);
digitalWrite(yellowLightOutput, flashState);
}
else if (state == 3) {
digitalWrite(redLightOutput, LOW);
digitalWrite(greenLightOutput, LOW);
digitalWrite(yellowLightOutput, HIGH);
}
else if (state == 4) {
digitalWrite(redLightOutput, LOW);
digitalWrite(greenLightOutput, HIGH);
digitalWrite(yellowLightOutput, LOW);
}
}
void setup() {
// digital pin 13 is the light output pin, 3 is the button input
pinMode(redLightOutput, OUTPUT);
pinMode(yellowLightOutput, OUTPUT);
pinMode(greenLightOutput, OUTPUT);
pinMode(buttonInput, INPUT);
digitalWrite(buttonInput, HIGH);
}
void loop() {
//get the value from the pot's analog pin
int potRead = analogRead(potPin);
blinkSpeed = 10000/potRead;
//button being pressed
if (shouldToggle()) {
//if the button was just pressed, switch the state
lightState = (lightState + 1) % 5;
writeLights(lightState);
}
else {
//don't change the state, just write it
writeLights(lightState);
}
}
|
1bf009ccae5159a3fafa998478d45aa3a530753c | 61a62af6e831f3003892abf4f73bb1aa4d74d1c7 | /Google KickStart/2020/Round B/C.cpp | 14c6e4b57578d1e20076b66da6107219b5bdd18d | [] | no_license | amsraman/Competitive_Programming | 7e420e5d029e8adfbe7edf845db77f96bd1ae80d | 6f869a1e1716f56b081769d7f36ffa23ae82e356 | refs/heads/master | 2023-03-17T00:20:19.866063 | 2023-03-11T00:24:29 | 2023-03-11T00:24:29 | 173,763,104 | 16 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,033 | cpp | C.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000000
typedef long long ll;
using namespace std;
ll t, cx, cy;
stack<ll> coef;
stack<pair<ll,ll> > lvl;
string s;
int main()
{
cin >> t;
for(int cs = 0; cs<t; cs++)
{
cin >> s;
cx = cy = 0;
for(int i = 0; i<s.length(); i++)
{
if(s[i]=='N')
cy = (cy+MOD-1)%MOD;
else if(s[i]=='S')
cy = (cy+1)%MOD;
else if(s[i]=='E')
cx = (cx+1)%MOD;
else if(s[i]=='W')
cx = (cx+MOD-1)%MOD;
else if(isdigit(s[i]))
coef.push(s[i]-'0'), lvl.push({cx,cy}), cx = cy = 0, i++;
else if(s[i]=='(')
coef.push(1), lvl.push({cx,cy}), cx = cy = 0;
else
cx = (cx*coef.top()+lvl.top().f)%MOD, cy = (cy*coef.top()+lvl.top().s)%MOD, coef.pop(), lvl.pop();
}
cout << "Case #" << cs+1 << ": " << 1+cx << " " << 1+cy << endl;
}
}
|
1140cccf5a36a3ee5fcb129d4533ab51c4eebb5e | b9b8ab1ba3da2f971b3e8651ab9b99fd26e00119 | /qtlearning/mvc/mvc/tablewidget.h | 8d4925ac53910e55f472cc7d2dded7f558d15773 | [] | no_license | farthought/qt | d01b399dd5fbfccaf73f13a072ea23b8cf8b5e52 | a513b7f9f68f37efcd5405c9d1e46c3f3d338b79 | refs/heads/master | 2020-05-25T20:25:57.438783 | 2017-03-14T04:21:47 | 2017-03-14T04:21:47 | 84,305,476 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 304 | h | tablewidget.h | #ifndef TABLEWIDGET_H
#define TABLEWIDGET_H
#include <QWidget>
#include <QTableWidget>
#include <QHBoxLayout>
class TableWidget : public QWidget
{
Q_OBJECT
public:
explicit TableWidget(QWidget *parent = 0);
private:
QTableWidget *table;
signals:
public slots:
};
#endif // TABLEWIDGET_H
|
4eff3a6421cf8aeac95cbd5c0694aff94ce36fcc | 7e48d392300fbc123396c6a517dfe8ed1ea7179f | /RodentVR/Intermediate/Build/Win64/RodentVR/Inc/RodentVR/XmlFileWriter.gen.cpp | 279bf975fb79310e82a9dbc5527f5e9116376cb9 | [] | no_license | WestRyanK/Rodent-VR | f4920071b716df6a006b15c132bc72d3b0cba002 | 2033946f197a07b8c851b9a5075f0cb276033af6 | refs/heads/master | 2021-06-14T18:33:22.141793 | 2020-10-27T03:25:33 | 2020-10-27T03:25:33 | 154,956,842 | 1 | 1 | null | 2018-11-29T09:56:21 | 2018-10-27T11:23:11 | C++ | UTF-8 | C++ | false | false | 3,227 | cpp | XmlFileWriter.gen.cpp | // Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/GeneratedCppIncludes.h"
#include "RodentVR/Private/XML/XmlFileWriter.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeXmlFileWriter() {}
// Cross Module References
RODENTVR_API UClass* Z_Construct_UClass_UXmlFileWriter_NoRegister();
RODENTVR_API UClass* Z_Construct_UClass_UXmlFileWriter();
COREUOBJECT_API UClass* Z_Construct_UClass_UObject();
UPackage* Z_Construct_UPackage__Script_RodentVR();
// End Cross Module References
void UXmlFileWriter::StaticRegisterNativesUXmlFileWriter()
{
}
UClass* Z_Construct_UClass_UXmlFileWriter_NoRegister()
{
return UXmlFileWriter::StaticClass();
}
struct Z_Construct_UClass_UXmlFileWriter_Statics
{
static UObject* (*const DependentSingletons[])();
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[];
#endif
static const FCppClassTypeInfoStatic StaticCppClassTypeInfo;
static const UE4CodeGen_Private::FClassParams ClassParams;
};
UObject* (*const Z_Construct_UClass_UXmlFileWriter_Statics::DependentSingletons[])() = {
(UObject* (*)())Z_Construct_UClass_UObject,
(UObject* (*)())Z_Construct_UPackage__Script_RodentVR,
};
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UXmlFileWriter_Statics::Class_MetaDataParams[] = {
{ "Comment", "/**\n * \n */" },
{ "IncludePath", "XML/XmlFileWriter.h" },
{ "ModuleRelativePath", "Private/XML/XmlFileWriter.h" },
};
#endif
const FCppClassTypeInfoStatic Z_Construct_UClass_UXmlFileWriter_Statics::StaticCppClassTypeInfo = {
TCppClassTypeTraits<UXmlFileWriter>::IsAbstract,
};
const UE4CodeGen_Private::FClassParams Z_Construct_UClass_UXmlFileWriter_Statics::ClassParams = {
&UXmlFileWriter::StaticClass,
nullptr,
&StaticCppClassTypeInfo,
DependentSingletons,
nullptr,
nullptr,
nullptr,
UE_ARRAY_COUNT(DependentSingletons),
0,
0,
0,
0x000000A0u,
METADATA_PARAMS(Z_Construct_UClass_UXmlFileWriter_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_UXmlFileWriter_Statics::Class_MetaDataParams))
};
UClass* Z_Construct_UClass_UXmlFileWriter()
{
static UClass* OuterClass = nullptr;
if (!OuterClass)
{
UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_UXmlFileWriter_Statics::ClassParams);
}
return OuterClass;
}
IMPLEMENT_CLASS(UXmlFileWriter, 609174034);
template<> RODENTVR_API UClass* StaticClass<UXmlFileWriter>()
{
return UXmlFileWriter::StaticClass();
}
static FCompiledInDefer Z_CompiledInDefer_UClass_UXmlFileWriter(Z_Construct_UClass_UXmlFileWriter, &UXmlFileWriter::StaticClass, TEXT("/Script/RodentVR"), TEXT("UXmlFileWriter"), false, nullptr, nullptr, nullptr);
DEFINE_VTABLE_PTR_HELPER_CTOR(UXmlFileWriter);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif
|
25b04e6756959112435261d1980104b837ba16c5 | 4d0b16affc394f939d3120e41107cab8f3a197f4 | /source/mines.cpp | f6087e7f919846c109f0b1dea0933f6219179d0b | [] | no_license | v15h41/minesweeper-nx | f7ba241e78a501c56790623cb19107ad00f513f2 | e8a471d0058aaf2172a1b7416fc2a1454fb1c473 | refs/heads/master | 2020-04-11T06:31:12.740856 | 2018-12-13T06:25:04 | 2018-12-13T06:25:04 | 161,583,077 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,839 | cpp | mines.cpp | #include "mines.hpp"
#define BOMB -1
// initialise the minesweeper instance
Mines::Mines(u32 h, u32 w, u32 mines) {
this->h = h;
this->w = w;
this->mines = mines;
this->flags = 0;
this->openned = 0;
this->state = Mines::RUNNING;
this->board = std::vector<std::vector<std::pair<int, Mines::TileState>>>(h, std::vector<std::pair<int, Mines::TileState>>(w));
// randomize mine locations and populate board with numbers
Mines::addMines();
Mines::countMines();
}
// attempt to open a block
void Mines::attemptOpenBlock(u32 x, u32 y) {
// if a block is already open on a number
if (this->board[y][x].second == Mines::OPEN) {
Mines::flagRemaining(x, y);
Mines::checkNumberSatisfied(x, y);
// otherwise open the block
} else {
Mines::openBlock(x, y);
}
}
// get value of square
int Mines::getValue(u32 x, u32 y) {
return this->board[y][x].first;
}
// get state of square
Mines::TileState Mines::getState(u32 x, u32 y) {
return this->board[y][x].second;
}
// check if all blocks except mines have been openned
void Mines::checkWin() {
if (this->h*this->w - this->openned == this->mines) {
this->state = Mines::WON;
}
}
// get the state of game
Mines::GameState Mines::getGameState() {
return this->state;
}
// if the number of surrounding unopenned tiles are the same as the value of the
// tile, flag all unopenned tiles
void Mines::flagRemaining(u32 x, u32 y) {
int blocks = 0;
// count blocks
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!Mines::outOfBounds(x+i, y+j) && (this->board[y+j][x+i].second == Mines::UNOPENNED || this->board[y+j][x+i].second == Mines::FLAGGED)) {
blocks++;
}
}
}
// flag unopenned blocks
if (blocks == this->board[y][x].first) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!Mines::outOfBounds(x+i, y+j) && this->board[y+j][x+i].second == Mines::UNOPENNED) {
Mines::flagBlock(x+i, y+j);
}
}
}
}
}
// randomly generate mines on the board
void Mines::addMines() {
// init the board with unopenned blocks
u32 i, j;
for (i = 0; i < this->h; i++) {
for (j = 0; j < this->w; j++) {
this->board[i][j] = std::make_pair(0, Mines::UNOPENNED);
}
}
// for each mine, attempt to place it in a random position on the board
srand(time(NULL));
for (i = 0; i < this->mines; i++) {
int x, y;
do {
x = rand() % this->w;
y = rand() % this->h;
}
while (this->board[y][x].first == BOMB);
this->board[y][x].first = BOMB;
}
}
// open a block
void Mines::openBlock(u32 x, u32 y) {
// only open if the block is within bounds and not flagged or open
if (!Mines::outOfBounds(x, y) && this->board[y][x].second != Mines::FLAGGED
&& this->board[y][x].second != Mines::OPEN) {
// if the block is a bomb, you lose
if (this->board[y][x].first == BOMB) {
this->state = Mines::LOST;
// otherwise open the block and check if we have won
} else {
this->board[y][x].second = Mines::OPEN;
this->openned++;
Mines::checkWin();
// open surrounding blocks if there are no mines touching the current one
if (this->board[y][x].first == 0) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
Mines::openBlock(x+i, y+j);
}
}
}
}
}
}
// toggle the flagging of a block
void Mines::flagBlock(u32 x, u32 y) {
if (this->board[y][x].second == Mines::UNOPENNED) {
this->flags++;
this->board[y][x].second = Mines::FLAGGED;
} else if (this->board[y][x].second == Mines::FLAGGED) {
this->flags--;
this->board[y][x].second = Mines::UNOPENNED;
}
}
// if the number of flags surrounding a block satisfy its value, then open all
// other non-flagged blocked
void Mines::checkNumberSatisfied(u32 x, u32 y) {
int flags = 0;
// count the number of flags surrounding a block
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!Mines::outOfBounds(x+i, y+j) && this->board[y+j][x+i].second == Mines::FLAGGED) {
flags++;
}
}
}
// if the number of flags match the value of the tile, open surrounding blocks
if (flags == this->board[y][x].first) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
Mines::openBlock(x+i, y+j);
}
}
}
}
// check if a coordinate is out of bounds
bool Mines::outOfBounds(int x, int y) {
if (x >= this->w || x < 0 || y >= this->h || y < 0) {
return true;
}
return false;
}
// check if a block is out of bounds or is a mine
bool Mines::isMine(u32 x, u32 y) {
if (Mines::outOfBounds(x, y)) {
return false;
} else if (this->board[y][x].first == BOMB) {
return true;
} else {
return false;
}
}
// count the number of mines that surround a non-mine block
void Mines::countMines() {
u32 i, j;
for (i = 0; i < this->h; i++) {
for (j = 0; j < this->w; j++) {
if (board[i][j].first != BOMB) {
for (int k = -1; k <= 1; k++) {
for (int l = -1; l <= 1; l++) {
board[i][j].first += isMine(j+k, i+l) ? 1 : 0;
}
}
}
}
}
} |
b76a222783a28dcabcc0d4b65898bcb734c0d8bf | 28ae1453e6fbb1bd41a0d866eecbe11b4daf1e0f | /src/GOF Four/Behavioral/visitor_/visitor_.cpp | 4fff6acabfd4af3254056c390c5ef384547eb30a | [
"MIT"
] | permissive | haomiao/DesignPattern | f4a874e273feb6bf8245d6cbd0bc81735ee732d2 | 3841fca5e8f08348e60af42566e57951d7d1c4dd | refs/heads/master | 2021-04-15T12:49:02.635962 | 2019-10-19T04:14:54 | 2019-10-19T04:14:54 | 63,339,913 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 718 | cpp | visitor_.cpp | // visitor_.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "data_struct.h"
#include "visitor_a.h"
#include "visitor_b.h"
void ClientToUseDataStructObj( CDataStruct *pdata_struct, CBaseVisitor *pvisitor)
{
if ( pdata_struct != nullptr && pvisitor != nullptr)
{
pdata_struct->ErgodicElement(pvisitor);
}
}
int _tmain(int argc, _TCHAR* argv[])
{
CDataStruct data_struct_obj;
CVisitorA *pelementA = new CVisitorA();
ClientToUseDataStructObj( &data_struct_obj, pelementA );
CVisitorB *pelementB = new CVisitorB();
ClientToUseDataStructObj( &data_struct_obj, pelementB );
delete pelementA;
delete pelementB;
return 0;
}
|
f513b9417cd5bc452b3fc98c4a8f7ca02deddebf | 9ecb8d6f2a3be82a17893779925c59a137ea7ca0 | /hist_compare2.cpp | e5e7dce2a89f728954df117005600dda69338528 | [] | no_license | yjwudi/opencv_examples | 8a83c481b98a3f06b726283cd8aba8a0a31f6df8 | c89be02fee1ceb308862fde623b88275e1cbf877 | refs/heads/master | 2021-01-10T18:33:46.751600 | 2016-05-03T02:35:50 | 2016-05-03T02:35:50 | 57,935,840 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,912 | cpp | hist_compare2.cpp | #include <map>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ml/ml.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
int i, j;
char name[50]={"/home/yjwudi/tpic/tooth/ground/ground_truth1.png"};
char namew[50]={"/home/yjwudi/tpic/tooth/patches/white0.png"};
Mat half_arr[15], white_arr[15];
//Mat halfImg=imread("/home/yjwudi/tpic/tooth/patches/half.png");
Mat halfImg = imread("/home/yjwudi/tpic/tooth/ground/ground_truth1.png");
Mat conImg[3];
conImg[1]=imread("/home/yjwudi/tpic/tooth/patches/confuse1.png");
conImg[2]=imread("/home/yjwudi/tpic/tooth/patches/confuse2.png");
for(i = 1; i <= 10; i++)
{
int len = strlen(name);
name[len-5] = i + '0';
printf("%s\n", name);
half_arr[i] = imread(name);
}
//为计算直方图配置变量
//首先是需要计算的图像的通道,就是需要计算图像的哪个通道(bgr空间需要确定计算 b或g或r空间)
int channels = 0;
//然后是配置输出的结果存储的空间 ,用MatND类型来存储结果
MatND halfHist, half_arr_hist[5], con_hist[3], white_hist[15];
//接下来是直方图的每一个维度的 柱条的数目(就是将数值分组,共有多少组)
int histSize[] = { 32 }; //如果这里写成int histSize = 32; 那么下面调用计算直方图的函数的时候,该变量需要写 &histSize
//最后是确定每个维度的取值范围,就是横坐标的总数
//首先得定义一个变量用来存储 单个维度的 数值的取值范围
float midRanges[] = { 0, 256 };
const float *ranges[] = { midRanges };
calcHist(&halfImg, 1, &channels, Mat(), halfHist, 1, histSize, ranges, true, false);
for(i = 1; i <= 10; i++)
{
calcHist(&half_arr[i], 1, &channels, Mat(), half_arr_hist[i], 1, histSize, ranges, true, false);
if(i < 3)
calcHist(&conImg[i], 1, &channels, Mat(), con_hist[i], 1, histSize, ranges, true, false);
}
for(i = 0; i < 10; i++)
{
calcHist(&white_arr[i], 1, &channels, Mat(), white_hist[i], 1, histSize, ranges, true, false);
}
double dist_arr[5], con_dist_arr[3], white_dist_arr[15];
cout << "half:\n";
for(i = 1; i <=10 ; i++)
{
dist_arr[i] = compareHist(halfHist,half_arr_hist[i],CV_COMP_CORREL);
cout << dist_arr[i] << endl;
}
/*
cout << "confuse:\n";
for(i = 1; i < 3; i++)
{
con_dist_arr[i] = compareHist(halfHist,con_hist[i],CV_COMP_CORREL);
cout << con_dist_arr[i] << endl;
}
cout << "white:\n";
for(i = 0; i < 10; i++)
{
white_dist_arr[i] = compareHist(halfHist,white_hist[i],CV_COMP_CORREL);
cout << white_dist_arr[i] << endl;
}
*/
return 0;
}
|
9b2e536e39c47b7705f3f5a68d9bd45ff38004bc | bf36007ca46372cb9c4e04eccfbdc460a021cb66 | /src/mpeg2_syntax.cpp | 9dc3648025bdc93812689eed4620301752a6a5ce | [
"MIT"
] | permissive | sergeyrachev/khaotica | bfbb3ed32afc570f6e0aa2d1ac732076a61eb502 | e44b92e5579ecd0fe1c92061d49151a70197997b | refs/heads/master | 2021-05-03T13:09:25.458561 | 2018-11-08T14:22:19 | 2018-11-08T14:22:19 | 72,132,090 | 5 | 1 | null | 2017-10-11T20:45:23 | 2016-10-27T17:31:35 | C | UTF-8 | C++ | false | false | 83 | cpp | mpeg2_syntax.cpp | #include "mpeg2_syntax.h"
#include <stack>
#include <cassert>
#include <iostream>
|
34d1bafb73f5565964477739757d782227e63841 | dbd3648f648bd8b6d5b61d6797a7d521e740ce24 | /Nuclear.Engine/include/Rendering/RenderPasses/DefferedPass.h | a2ee10061f563c1a30c7f25ea1db944b7ed7e531 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"Zlib",
"Apache-2.0",
"MIT"
] | permissive | Zone-organization/Nuclear-Engine | 1c1b1f9eab42e75c13ea2f8166ba4c90e31e4ee2 | 1b5671fd703abd990601097bfb1afe06459aa49b | refs/heads/master | 2023-07-07T18:58:06.596561 | 2023-06-27T11:54:08 | 2023-06-27T11:54:08 | 108,473,651 | 94 | 12 | null | null | null | null | UTF-8 | C++ | false | false | 236 | h | DefferedPass.h | #pragma once
#include <Rendering\RenderPass.h>
namespace Nuclear
{
namespace Rendering
{
class NEAPI DefferedPass : public RenderPass
{
public:
DefferedPass();
void Update(FrameRenderData* framedata) override;
};
}
} |
d5b87f368b4a24b8f8929fd68774f6feeff48283 | f1655db8a73a7b575f9f7ab342cde3d9997cab04 | /heatMap/heatMap_2D/scalar2D.small/constant/polyMesh/owner | e717277aee03411b3801be2335a4d504968d2ff8 | [] | no_license | cecesuigeneris/OpenFOAMDataCenter | cd2e28555625b66574e96e21312e219e9b671e39 | 779bffd9885cb6254c5f34db27e3068501d8049a | refs/heads/master | 2016-09-14T09:48:54.047666 | 2016-05-26T23:39:35 | 2016-05-26T23:39:35 | 59,784,337 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 21,485 | owner | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class labelList;
note "nPoints:2688 nCells:1227 nFaces:5026 nInternalFaces:2336";
location "constant/polyMesh";
object owner;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5026
(
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
35
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
105
105
106
106
107
107
108
108
109
109
110
110
111
112
112
113
113
114
114
115
115
116
116
117
117
118
118
119
120
120
121
121
122
122
123
123
124
124
125
125
126
127
127
128
128
129
129
130
130
131
131
132
132
133
133
134
135
135
136
136
137
137
138
138
139
139
140
140
141
142
142
143
143
144
144
145
145
146
146
147
147
148
148
149
150
150
151
151
152
152
153
153
154
154
155
155
156
157
157
158
158
159
159
160
160
161
161
162
162
163
163
164
165
165
166
166
167
167
168
168
169
169
170
170
171
172
172
173
173
174
174
175
175
176
176
177
177
178
178
179
180
180
181
181
182
182
183
183
184
184
185
185
186
187
187
188
188
189
189
190
190
191
191
192
192
193
193
194
195
195
196
196
197
197
198
198
199
199
200
200
201
202
202
203
203
204
204
205
205
206
206
207
207
208
208
209
210
210
211
211
212
212
213
213
214
214
215
215
216
217
217
218
218
219
219
220
220
221
221
222
222
223
223
224
225
225
226
226
227
227
228
228
229
229
230
230
231
231
232
232
233
233
234
234
235
235
236
236
237
237
238
238
239
239
240
240
241
241
242
242
243
243
244
244
245
245
246
246
247
247
248
248
249
249
250
250
251
251
252
252
253
253
254
254
255
255
256
256
257
257
258
258
259
260
260
261
261
262
262
263
263
264
264
265
265
266
266
267
267
268
268
269
269
270
270
271
271
272
272
273
273
274
274
275
275
276
276
277
277
278
278
279
279
280
280
281
281
282
282
283
283
284
284
285
285
286
286
287
287
288
288
289
289
290
290
291
291
292
292
293
293
294
295
295
296
296
297
297
298
298
299
299
300
300
301
301
302
302
303
303
304
304
305
305
306
306
307
307
308
308
309
309
310
310
311
311
312
312
313
313
314
314
315
315
316
316
317
317
318
318
319
319
320
320
321
321
322
322
323
323
324
324
325
325
326
326
327
327
328
328
329
330
330
331
331
332
332
333
333
334
334
335
335
336
336
337
337
338
338
339
339
340
340
341
341
342
342
343
343
344
344
345
345
346
346
347
347
348
348
349
349
350
350
351
351
352
352
353
353
354
354
355
355
356
356
357
357
358
358
359
359
360
360
361
361
362
362
363
363
364
365
365
366
366
367
367
368
368
369
369
370
370
371
371
372
372
373
373
374
374
375
375
376
376
377
377
378
378
379
379
380
380
381
381
382
382
383
383
384
384
385
385
386
386
387
387
388
388
389
389
390
390
391
391
392
392
393
393
394
394
395
395
396
396
397
397
398
398
399
400
400
401
401
402
402
403
403
404
404
405
405
406
406
407
407
408
408
409
409
410
410
411
411
412
412
413
413
414
414
415
415
416
416
417
417
418
418
419
419
420
420
421
421
422
422
423
423
424
424
425
425
426
426
427
427
428
428
429
429
430
430
431
431
432
432
433
433
434
435
435
436
436
437
437
438
438
439
439
440
440
441
441
442
442
443
443
444
444
445
445
446
446
447
447
448
448
449
449
450
450
451
451
452
452
453
453
454
454
455
455
456
456
457
457
458
458
459
459
460
460
461
461
462
462
463
463
464
464
465
465
466
466
467
467
468
468
469
470
470
471
471
472
472
473
473
474
474
475
475
476
476
477
477
478
478
479
479
480
480
481
481
482
482
483
483
484
484
485
485
486
486
487
487
488
488
489
489
490
490
491
491
492
492
493
493
494
494
495
495
496
496
497
497
498
498
499
499
500
500
501
501
502
502
503
503
504
505
505
506
506
507
507
508
508
509
509
510
510
511
511
512
512
513
513
514
514
515
515
516
516
517
517
518
518
519
519
520
520
521
521
522
522
523
523
524
524
525
525
526
526
527
527
528
528
529
529
530
530
531
531
532
532
533
533
534
534
535
535
536
536
537
537
538
538
539
540
540
541
541
542
542
543
543
544
544
545
545
546
546
547
547
548
548
549
549
550
550
551
551
552
552
553
553
554
554
555
555
556
556
557
557
558
558
559
559
560
560
561
561
562
562
563
563
564
564
565
565
566
566
567
567
568
568
569
569
570
570
571
571
572
572
573
573
574
575
575
576
576
577
577
578
578
579
579
580
580
581
581
582
582
583
583
584
584
585
585
586
586
587
587
588
588
589
589
590
590
591
591
592
592
593
593
594
594
595
595
596
596
597
597
598
598
599
599
600
600
601
601
602
602
603
603
604
604
605
605
606
606
607
607
608
608
609
610
610
611
611
612
612
613
613
614
614
615
615
616
616
617
617
618
618
619
619
620
620
621
622
623
624
625
626
627
627
628
628
629
629
630
630
631
631
632
632
633
633
634
634
635
635
636
636
637
637
638
638
639
639
640
640
641
641
642
642
643
643
644
645
645
646
646
647
647
648
648
649
649
650
650
651
651
652
652
653
653
654
654
655
656
656
657
657
658
658
659
659
660
660
661
661
662
662
663
663
664
664
665
665
666
666
667
667
668
668
669
669
670
670
671
671
672
672
673
674
674
675
675
676
676
677
677
678
678
679
679
680
680
681
681
682
682
683
683
684
685
685
686
686
687
687
688
688
689
689
690
690
691
691
692
692
693
693
694
694
695
695
696
696
697
697
698
698
699
699
700
700
701
701
702
703
703
704
704
705
705
706
706
707
707
708
708
709
709
710
710
711
711
712
712
713
714
714
715
715
716
716
717
717
718
718
719
719
720
720
721
721
722
722
723
723
724
724
725
725
726
726
727
727
728
728
729
729
730
730
731
732
732
733
733
734
734
735
735
736
736
737
737
738
738
739
739
740
740
741
741
742
743
743
744
744
745
745
746
746
747
747
748
748
749
749
750
750
751
751
752
752
753
753
754
754
755
755
756
756
757
757
758
758
759
759
760
761
761
762
762
763
763
764
764
765
765
766
766
767
767
768
768
769
769
770
770
771
772
772
773
773
774
774
775
775
776
776
777
777
778
778
779
779
780
780
781
781
782
782
783
783
784
784
785
785
786
786
787
787
788
788
789
790
790
791
791
792
792
793
793
794
794
795
795
796
796
797
797
798
798
799
799
800
801
801
802
802
803
803
804
804
805
805
806
806
807
807
808
808
809
809
810
810
811
811
812
812
813
813
814
814
815
815
816
816
817
817
818
819
819
820
820
821
821
822
822
823
823
824
824
825
825
826
826
827
827
828
828
829
830
830
831
831
832
832
833
833
834
834
835
835
836
836
837
837
838
838
839
839
840
840
841
841
842
842
843
843
844
844
845
845
846
846
847
848
848
849
849
850
850
851
851
852
852
853
853
854
854
855
855
856
856
857
857
858
859
859
860
860
861
861
862
862
863
863
864
864
865
865
866
866
867
867
868
868
869
869
870
870
871
871
872
872
873
873
874
874
875
875
876
877
877
878
878
879
879
880
880
881
881
882
882
883
883
884
884
885
885
886
886
887
887
888
888
889
889
890
890
891
891
892
892
893
893
894
894
895
895
896
896
897
897
898
898
899
899
900
900
901
901
902
902
903
903
904
904
905
905
906
906
907
907
908
908
909
909
910
910
911
912
912
913
913
914
914
915
915
916
916
917
917
918
918
919
919
920
920
921
921
922
922
923
923
924
924
925
925
926
926
927
927
928
928
929
929
930
930
931
931
932
932
933
933
934
934
935
935
936
936
937
937
938
938
939
939
940
940
941
941
942
942
943
943
944
944
945
945
946
947
947
948
948
949
949
950
950
951
951
952
952
953
953
954
954
955
955
956
956
957
957
958
958
959
959
960
960
961
961
962
962
963
963
964
964
965
965
966
966
967
967
968
968
969
969
970
970
971
971
972
972
973
973
974
974
975
975
976
976
977
977
978
978
979
979
980
980
981
982
982
983
983
984
984
985
985
986
986
987
987
988
988
989
989
990
990
991
991
992
992
993
993
994
994
995
995
996
996
997
997
998
998
999
999
1000
1000
1001
1001
1002
1002
1003
1003
1004
1004
1005
1005
1006
1006
1007
1007
1008
1008
1009
1009
1010
1010
1011
1011
1012
1012
1013
1013
1014
1014
1015
1015
1016
1017
1017
1018
1018
1019
1019
1020
1020
1021
1021
1022
1022
1023
1023
1024
1024
1025
1025
1026
1026
1027
1027
1028
1028
1029
1029
1030
1030
1031
1031
1032
1032
1033
1033
1034
1034
1035
1035
1036
1036
1037
1037
1038
1038
1039
1039
1040
1040
1041
1041
1042
1042
1043
1043
1044
1044
1045
1045
1046
1046
1047
1047
1048
1048
1049
1049
1050
1050
1051
1052
1052
1053
1053
1054
1054
1055
1055
1056
1056
1057
1057
1058
1058
1059
1059
1060
1060
1061
1061
1062
1062
1063
1063
1064
1064
1065
1065
1066
1066
1067
1067
1068
1068
1069
1069
1070
1070
1071
1071
1072
1072
1073
1073
1074
1074
1075
1075
1076
1076
1077
1077
1078
1078
1079
1079
1080
1080
1081
1081
1082
1082
1083
1083
1084
1084
1085
1085
1086
1087
1087
1088
1088
1089
1089
1090
1090
1091
1091
1092
1092
1093
1093
1094
1094
1095
1095
1096
1096
1097
1097
1098
1098
1099
1099
1100
1100
1101
1101
1102
1102
1103
1103
1104
1104
1105
1105
1106
1106
1107
1107
1108
1108
1109
1109
1110
1110
1111
1111
1112
1112
1113
1113
1114
1114
1115
1115
1116
1116
1117
1117
1118
1118
1119
1119
1120
1120
1121
1122
1122
1123
1123
1124
1124
1125
1125
1126
1126
1127
1127
1128
1128
1129
1129
1130
1130
1131
1131
1132
1132
1133
1133
1134
1134
1135
1135
1136
1136
1137
1137
1138
1138
1139
1139
1140
1140
1141
1141
1142
1142
1143
1143
1144
1144
1145
1145
1146
1146
1147
1147
1148
1148
1149
1149
1150
1150
1151
1151
1152
1152
1153
1153
1154
1154
1155
1155
1156
1157
1157
1158
1158
1159
1159
1160
1160
1161
1161
1162
1162
1163
1163
1164
1164
1165
1165
1166
1166
1167
1167
1168
1168
1169
1169
1170
1170
1171
1171
1172
1172
1173
1173
1174
1174
1175
1175
1176
1176
1177
1177
1178
1178
1179
1179
1180
1180
1181
1181
1182
1182
1183
1183
1184
1184
1185
1185
1186
1186
1187
1187
1188
1188
1189
1189
1190
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
0
35
70
105
120
135
150
165
180
195
210
225
260
295
330
365
400
435
470
505
540
575
610
645
674
703
732
761
790
819
848
877
912
947
982
1017
1052
1087
1122
1157
1192
1
36
71
106
121
136
151
166
181
196
211
226
261
296
331
366
401
436
471
506
541
576
611
646
675
704
733
762
791
820
849
878
913
948
983
1018
1053
1088
1123
1158
1193
2
37
72
107
122
137
152
167
182
197
212
227
262
297
332
367
402
437
472
507
542
577
612
647
676
705
734
763
792
821
850
879
914
949
984
1019
1054
1089
1124
1159
1194
3
38
73
108
123
138
153
168
183
198
213
228
263
298
333
368
403
438
473
508
543
578
613
648
677
706
735
764
793
822
851
880
915
950
985
1020
1055
1090
1125
1160
1195
4
39
74
109
124
139
154
169
184
199
214
229
264
299
334
369
404
439
474
509
544
579
614
649
678
707
736
765
794
823
852
881
916
951
986
1021
1056
1091
1126
1161
1196
5
40
75
110
125
140
155
170
185
200
215
230
265
300
335
370
405
440
475
510
545
580
615
650
679
708
737
766
795
824
853
882
917
952
987
1022
1057
1092
1127
1162
1197
6
41
76
111
126
141
156
171
186
201
216
231
266
301
336
371
406
441
476
511
546
581
616
651
680
709
738
767
796
825
854
883
918
953
988
1023
1058
1093
1128
1163
1198
7
42
77
232
267
302
337
372
407
442
477
512
547
582
617
652
681
710
739
768
797
826
855
884
919
954
989
1024
1059
1094
1129
1164
1199
8
43
78
233
268
303
338
373
408
443
478
513
548
583
618
653
682
711
740
769
798
827
856
885
920
955
990
1025
1060
1095
1130
1165
1200
9
44
79
234
269
304
339
374
409
444
479
514
549
584
619
654
683
712
741
770
799
828
857
886
921
956
991
1026
1061
1096
1131
1166
1201
10
45
80
235
270
305
340
375
410
445
480
515
550
585
620
655
684
713
742
771
800
829
858
887
922
957
992
1027
1062
1097
1132
1167
1202
11
46
81
236
271
306
341
376
411
446
481
516
551
586
621
888
923
958
993
1028
1063
1098
1133
1168
1203
12
47
82
237
272
307
342
377
412
447
482
517
552
587
622
889
924
959
994
1029
1064
1099
1134
1169
1204
13
48
83
238
273
308
343
378
413
448
483
518
553
588
623
890
925
960
995
1030
1065
1100
1135
1170
1205
14
49
84
239
274
309
344
379
414
449
484
519
554
589
624
891
926
961
996
1031
1066
1101
1136
1171
1206
15
50
85
240
275
310
345
380
415
450
485
520
555
590
625
892
927
962
997
1032
1067
1102
1137
1172
1207
16
51
86
241
276
311
346
381
416
451
486
521
556
591
626
893
928
963
998
1033
1068
1103
1138
1173
1208
17
52
87
242
277
312
347
382
417
452
487
522
557
592
627
656
685
714
743
772
801
830
859
894
929
964
999
1034
1069
1104
1139
1174
1209
18
53
88
243
278
313
348
383
418
453
488
523
558
593
628
657
686
715
744
773
802
831
860
895
930
965
1000
1035
1070
1105
1140
1175
1210
19
54
89
244
279
314
349
384
419
454
489
524
559
594
629
658
687
716
745
774
803
832
861
896
931
966
1001
1036
1071
1106
1141
1176
1211
20
55
90
245
280
315
350
385
420
455
490
525
560
595
630
659
688
717
746
775
804
833
862
897
932
967
1002
1037
1072
1107
1142
1177
1212
21
56
91
246
281
316
351
386
421
456
491
526
561
596
631
660
689
718
747
776
805
834
863
898
933
968
1003
1038
1073
1108
1143
1178
1213
22
57
92
247
282
317
352
387
422
457
492
527
562
597
632
661
690
719
748
777
806
835
864
899
934
969
1004
1039
1074
1109
1144
1179
1214
23
58
93
248
283
318
353
388
423
458
493
528
563
598
633
662
691
720
749
778
807
836
865
900
935
970
1005
1040
1075
1110
1145
1180
1215
24
59
94
249
284
319
354
389
424
459
494
529
564
599
634
663
692
721
750
779
808
837
866
901
936
971
1006
1041
1076
1111
1146
1181
1216
25
60
95
250
285
320
355
390
425
460
495
530
565
600
635
664
693
722
751
780
809
838
867
902
937
972
1007
1042
1077
1112
1147
1182
1217
26
61
96
251
286
321
356
391
426
461
496
531
566
601
636
665
694
723
752
781
810
839
868
903
938
973
1008
1043
1078
1113
1148
1183
1218
27
62
97
112
127
142
157
172
187
202
217
252
287
322
357
392
427
462
497
532
567
602
637
666
695
724
753
782
811
840
869
904
939
974
1009
1044
1079
1114
1149
1184
1219
28
63
98
113
128
143
158
173
188
203
218
253
288
323
358
393
428
463
498
533
568
603
638
667
696
725
754
783
812
841
870
905
940
975
1010
1045
1080
1115
1150
1185
1220
29
64
99
114
129
144
159
174
189
204
219
254
289
324
359
394
429
464
499
534
569
604
639
668
697
726
755
784
813
842
871
906
941
976
1011
1046
1081
1116
1151
1186
1221
30
65
100
115
130
145
160
175
190
205
220
255
290
325
360
395
430
465
500
535
570
605
640
669
698
727
756
785
814
843
872
907
942
977
1012
1047
1082
1117
1152
1187
1222
31
66
101
116
131
146
161
176
191
206
221
256
291
326
361
396
431
466
501
536
571
606
641
670
699
728
757
786
815
844
873
908
943
978
1013
1048
1083
1118
1153
1188
1223
32
67
102
117
132
147
162
177
192
207
222
257
292
327
362
397
432
467
502
537
572
607
642
671
700
729
758
787
816
845
874
909
944
979
1014
1049
1084
1119
1154
1189
1224
33
68
103
118
133
148
163
178
193
208
223
258
293
328
363
398
433
468
503
538
573
608
643
672
701
730
759
788
817
846
875
910
945
980
1015
1050
1085
1120
1155
1190
1225
34
69
104
119
134
149
164
179
194
209
224
259
294
329
364
399
434
469
504
539
574
609
644
673
702
731
760
789
818
847
876
911
946
981
1016
1051
1086
1121
1156
1191
1226
0
35
70
105
120
135
150
165
180
195
210
225
260
295
330
365
400
435
470
505
540
575
610
645
674
703
732
761
790
819
848
877
912
947
982
1017
1052
1087
1122
1157
1192
1
36
71
106
121
136
151
166
181
196
211
226
261
296
331
366
401
436
471
506
541
576
611
646
675
704
733
762
791
820
849
878
913
948
983
1018
1053
1088
1123
1158
1193
2
37
72
107
122
137
152
167
182
197
212
227
262
297
332
367
402
437
472
507
542
577
612
647
676
705
734
763
792
821
850
879
914
949
984
1019
1054
1089
1124
1159
1194
3
38
73
108
123
138
153
168
183
198
213
228
263
298
333
368
403
438
473
508
543
578
613
648
677
706
735
764
793
822
851
880
915
950
985
1020
1055
1090
1125
1160
1195
4
39
74
109
124
139
154
169
184
199
214
229
264
299
334
369
404
439
474
509
544
579
614
649
678
707
736
765
794
823
852
881
916
951
986
1021
1056
1091
1126
1161
1196
5
40
75
110
125
140
155
170
185
200
215
230
265
300
335
370
405
440
475
510
545
580
615
650
679
708
737
766
795
824
853
882
917
952
987
1022
1057
1092
1127
1162
1197
6
41
76
111
126
141
156
171
186
201
216
231
266
301
336
371
406
441
476
511
546
581
616
651
680
709
738
767
796
825
854
883
918
953
988
1023
1058
1093
1128
1163
1198
7
42
77
232
267
302
337
372
407
442
477
512
547
582
617
652
681
710
739
768
797
826
855
884
919
954
989
1024
1059
1094
1129
1164
1199
8
43
78
233
268
303
338
373
408
443
478
513
548
583
618
653
682
711
740
769
798
827
856
885
920
955
990
1025
1060
1095
1130
1165
1200
9
44
79
234
269
304
339
374
409
444
479
514
549
584
619
654
683
712
741
770
799
828
857
886
921
956
991
1026
1061
1096
1131
1166
1201
10
45
80
235
270
305
340
375
410
445
480
515
550
585
620
655
684
713
742
771
800
829
858
887
922
957
992
1027
1062
1097
1132
1167
1202
11
46
81
236
271
306
341
376
411
446
481
516
551
586
621
888
923
958
993
1028
1063
1098
1133
1168
1203
12
47
82
237
272
307
342
377
412
447
482
517
552
587
622
889
924
959
994
1029
1064
1099
1134
1169
1204
13
48
83
238
273
308
343
378
413
448
483
518
553
588
623
890
925
960
995
1030
1065
1100
1135
1170
1205
14
49
84
239
274
309
344
379
414
449
484
519
554
589
624
891
926
961
996
1031
1066
1101
1136
1171
1206
15
50
85
240
275
310
345
380
415
450
485
520
555
590
625
892
927
962
997
1032
1067
1102
1137
1172
1207
16
51
86
241
276
311
346
381
416
451
486
521
556
591
626
893
928
963
998
1033
1068
1103
1138
1173
1208
17
52
87
242
277
312
347
382
417
452
487
522
557
592
627
656
685
714
743
772
801
830
859
894
929
964
999
1034
1069
1104
1139
1174
1209
18
53
88
243
278
313
348
383
418
453
488
523
558
593
628
657
686
715
744
773
802
831
860
895
930
965
1000
1035
1070
1105
1140
1175
1210
19
54
89
244
279
314
349
384
419
454
489
524
559
594
629
658
687
716
745
774
803
832
861
896
931
966
1001
1036
1071
1106
1141
1176
1211
20
55
90
245
280
315
350
385
420
455
490
525
560
595
630
659
688
717
746
775
804
833
862
897
932
967
1002
1037
1072
1107
1142
1177
1212
21
56
91
246
281
316
351
386
421
456
491
526
561
596
631
660
689
718
747
776
805
834
863
898
933
968
1003
1038
1073
1108
1143
1178
1213
22
57
92
247
282
317
352
387
422
457
492
527
562
597
632
661
690
719
748
777
806
835
864
899
934
969
1004
1039
1074
1109
1144
1179
1214
23
58
93
248
283
318
353
388
423
458
493
528
563
598
633
662
691
720
749
778
807
836
865
900
935
970
1005
1040
1075
1110
1145
1180
1215
24
59
94
249
284
319
354
389
424
459
494
529
564
599
634
663
692
721
750
779
808
837
866
901
936
971
1006
1041
1076
1111
1146
1181
1216
25
60
95
250
285
320
355
390
425
460
495
530
565
600
635
664
693
722
751
780
809
838
867
902
937
972
1007
1042
1077
1112
1147
1182
1217
26
61
96
251
286
321
356
391
426
461
496
531
566
601
636
665
694
723
752
781
810
839
868
903
938
973
1008
1043
1078
1113
1148
1183
1218
27
62
97
112
127
142
157
172
187
202
217
252
287
322
357
392
427
462
497
532
567
602
637
666
695
724
753
782
811
840
869
904
939
974
1009
1044
1079
1114
1149
1184
1219
28
63
98
113
128
143
158
173
188
203
218
253
288
323
358
393
428
463
498
533
568
603
638
667
696
725
754
783
812
841
870
905
940
975
1010
1045
1080
1115
1150
1185
1220
29
64
99
114
129
144
159
174
189
204
219
254
289
324
359
394
429
464
499
534
569
604
639
668
697
726
755
784
813
842
871
906
941
976
1011
1046
1081
1116
1151
1186
1221
30
65
100
115
130
145
160
175
190
205
220
255
290
325
360
395
430
465
500
535
570
605
640
669
698
727
756
785
814
843
872
907
942
977
1012
1047
1082
1117
1152
1187
1222
31
66
101
116
131
146
161
176
191
206
221
256
291
326
361
396
431
466
501
536
571
606
641
670
699
728
757
786
815
844
873
908
943
978
1013
1048
1083
1118
1153
1188
1223
32
67
102
117
132
147
162
177
192
207
222
257
292
327
362
397
432
467
502
537
572
607
642
671
700
729
758
787
816
845
874
909
944
979
1014
1049
1084
1119
1154
1189
1224
33
68
103
118
133
148
163
178
193
208
223
258
293
328
363
398
433
468
503
538
573
608
643
672
701
730
759
788
817
846
875
910
945
980
1015
1050
1085
1120
1155
1190
1225
34
69
104
119
134
149
164
179
194
209
224
259
294
329
364
399
434
469
504
539
574
609
644
673
702
731
760
789
818
847
876
911
946
981
1016
1051
1086
1121
1156
1191
1226
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
0
34
35
69
70
104
105
119
120
134
135
149
150
164
165
179
180
194
195
209
210
224
225
259
260
294
295
329
330
364
365
399
400
434
435
469
470
504
505
539
540
574
575
609
610
644
645
673
674
702
703
731
732
760
761
789
790
818
819
847
848
876
877
911
912
946
947
981
982
1016
1017
1051
1052
1086
1087
1121
1122
1156
1157
1191
1192
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1226
655
684
713
742
771
800
829
858
656
685
714
743
772
801
830
859
888
889
890
891
892
893
621
622
623
624
625
626
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
111
126
141
156
171
186
201
216
112
127
142
157
172
187
202
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
217
251
)
// ************************************************************************* //
| |
885014635c8b1ef8be85b8d9d2e33285afe80058 | 36c421eab202ad519edb10bb2d469e4f6f6e1597 | /CSE-150 Project/Level Zero/STL/Stack.cpp | bec06c70656f1b8ce22a2ee9e65d974542f215ea | [] | no_license | Mufassir-Chowdhury/Academic | a3890476e1abed5f6e6b090ef7d3577c45c1a955 | 0bd9868bc3bb929824a6f1d2e13dbdff33c34ad8 | refs/heads/main | 2023-07-20T13:00:51.752073 | 2021-08-27T14:16:25 | 2021-08-27T14:16:25 | 362,184,243 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,136 | cpp | Stack.cpp | #include<iostream>
#include<stack>
#include<vector>
using namespace std;
int main(){
stack<int> first;
stack<int> second({1, 2, 3, 4});
stack<int> copy_of_second(second);
cout << first.size() << "\n";
cout << second.size() << "\n";
cout << copy_of_second.size() << "\n";
cout << "Is the first stack empty: " << first.empty() << "\n";
cout << second.top() << "\n";
second.top() += 1;
cout << second.top() << "\n";
second.push(100);
cout << second.top() << " " << second.size() << "\n";
first.swap(second);
cout << "Is the first stack empty now: " << first.empty() << "\n";
cout << first.size() << " " << first.top() << "\n";
first.pop();
cout << first.size() << " " << first.top() << "\n";
first.emplace(29);
while(!first.empty()){
cout << first.top() << " ";
first.pop();
}
cout << "\n";
vector<int> values = {1, 2, 4, 2, 4};
stack<int, vector<int> > fourth(values);
while(!fourth.empty()){
cout << fourth.top() << " ";
fourth.pop();
}
cout << "\n";
return 0;
} |
caa6f65c3879d3d5100fed72470d380ae8bd0b1c | dc83dc82a1850443893be13807a34665ce2083c4 | /main.cc | 86cf14479881a2971a5771176530093095d000f7 | [] | no_license | amitjoshi24/Extended-ARM-Emulator | b3f63c9c0687e9eb25416086cbbeb19a0ec33d78 | c2080aa1eda5d1ef994cddd2213999921ea82cf3 | refs/heads/master | 2022-01-06T16:32:04.060028 | 2019-05-04T02:46:31 | 2019-05-04T02:46:31 | 261,576,453 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 69,494 | cc | main.cc | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <linux/kernel.h>
#include <unistd.h>
#include <linux/aio_abi.h>
#include "mem.h"
#include "elf.h"
#include "functions.h"
#include "sparse_array_3.h"
using namespace std;
#define NUMREG 32
A3 *memory = new A3();
int main(int argc, const char * argv[]) {
bool debug = true;
uint64_t reg[NUMREG];
uint64_t sys_reg[65536];
unsigned __int128 simd_reg[NUMREG];
// initializing registers
for ( int i = 0; i < 32; i++ ) {
reg[i] = 0;
simd_reg[i] = 0;
}
for ( int i = 0; i < 65536; i++ ) {
sys_reg[i] = 0;
}
const char* fileName = argv[1];
uint64_t entry = loadElf(fileName); // entry = init value for PC (program counter)
uint64_t pcLocal = entry;
uint8_t nzcvLocal = 0;
// have ALL the cores been terminated yet?
bool allTerminated = false;
// syscall variables
while ( !allTerminated ) {
// whether to change the PC
bool pcChange = false;
uint32_t instr_int = memory_get_32(pcLocal);
if ( debug ) {
printf("instruction %x at address %lx ", instr_int, pcLocal);
printf("X30: %lx\n", reg[30]);
}
// PC-specific debug
// if ( pcLocal == 0x408c28 ) {
// printf("%d\n", nzcvLocal);
// printf(" X0: %lx\nX20: %lx\n", reg[0], reg[20]);
// }
if ( is_instruction(instr_int, 0xfa400800) ) {
// CCMP immediate 64
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm5 = extract(instr_int, 20, 16);
uint8_t flags = extract(instr_int, 3, 0);
// uint8_t cond = extract32(instr_int, 15, 13);
// uint8_t condLast = extract_single32(instr_int, 12);
uint8_t fullcond = extract32(instr_int, 15, 12);
// bool condHolds = false;
// if ( cond == 0 ) {
// condHolds = (extract_single32(fullcond, 2) == 1); // Z == 1 <-> EQ or NE
// } else if ( cond == 1 ) {
// condHolds = (extract_single32(fullcond, 1) == 1); // C == 1 <-> CS or CC
// } else if ( cond == 2 ) {
// condHolds = (extract_single32(fullcond, 3) == 1); // N == 1 <-> MI or PL
// } else if ( cond == 3 ) {
// condHolds = (extract_single32(fullcond, 0) == 1); // V == 1 <-> VS or VC
// } else if ( cond == 4 ) {
// condHolds = (extract_single32(fullcond, 1) == 1 && extract_single32(fullcond, 2) == 0); // C == 1 && Z == 0 <-> HI or LS
// } else if ( cond == 5 ) {
// condHolds = (extract_single32(fullcond, 3) == extract_single32(fullcond, 0)); // N == V <-> GE or LT
// } else if ( cond == 6 ) {
// condHolds = (extract_single32(fullcond, 3) == extract_single32(fullcond, 0) && extract_single32(fullcond, 2) == 0); // N == V && Z == 0 <-> GT or LE
// } else {
// condHolds = true; // AL
// }
// if ( extract_single32(condLast, 0) == 1 && cond != 7 ) {
// condHolds = !condHolds;
// }
bool condHolds = conditionHolds(fullcond, fullcond);
uint64_t operand1 = reg[n];
uint64_t operand2 = 0;
uint64_t result_throwaway = 0;
uint8_t flags_result = 0;
if ( condHolds ) {
operand2 = ~imm5;
add_with_carry64(operand1, operand2, 1, &result_throwaway, &flags_result);
nzcvLocal = flags_result;
} else {
nzcvLocal = flags;
}
} else if ( is_instruction(instr_int, 0xf9400000) ) {
// LDR immediate unsigned offset 64
// cout << "LDR immediate unsigned offset 64" << endl;
uint64_t imm12 = extract(instr_int, 21, 10);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = imm12 << 3;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = memory_get_64(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0xf9000000) ) {
// STR immediate unsigned offset 64
// cout << "STR immediate unsigned offset 64" << endl;
uint8_t size = extract32(instr_int, 31, 30);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t offset = logical_shift_left(imm, size);
uint64_t address = reg[n];
address = address + offset;
uint64_t data = reg[t];
memory_set_64(address, data);
} else if ( is_instruction(instr_int, 0xf8400c00) ) {
// LDR immediate pre-index 64
// cout << "LDR immediate pre-index 64" << endl;
uint64_t imm9 = extract(instr_int, 20, 12);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = sign_extend_64(imm9, 9);
uint64_t address = 0;
address = reg[n];
address = address + offset;
uint64_t data = memory_get_64(address);
if ( t != 31 ) {
reg[t] = data;
}
reg[n] = address;
} else if ( is_instruction(instr_int, 0xf8400400) ) {
// LDR immediate post-index 64
// cout << "LDR immediate post-index 64" << endl;
uint64_t imm9 = extract(instr_int, 20, 12);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = sign_extend_64(imm9, 9);
uint64_t address = 0;
address = reg[n];
uint64_t data = memory_get_64(address);
if ( t != 31 ) {
reg[t] = data;
}
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0xf8000c00) ) {
// STR immediate pre-index 64
// cout << "STR immediate pre-index 64" << endl;
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 20, 12);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = reg[n];
address = address + offset;
uint64_t data = reg[t];
memory_set_64(address, data);
reg[n] = address;
} else if ( is_instruction(instr_int, 0xf8000400) ) {
// STR immediate post-index 64
// cout << "STR immediate post-index 64" << endl;
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 20, 12);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = reg[n];
uint64_t data = reg[t];
memory_set_64(address, data);
address = address + offset;
reg[n] = address;
} else if( is_instruction(instr_int, 0xF2000000) ){
//ANDS immediate 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imms = extract(instr_int, 15, 10);
uint64_t immr = extract(instr_int, 21, 16);
uint64_t N = extract(instr_int, 22, 22);
uint64_t nah = 0;
uint64_t imm = 0;
decode_bit_masks(N, imms, immr, true, &imm, &nah);
uint64_t operand1 = n == 31 ? 0 : reg[n];
uint64_t result = operand1 & imm;
uint32_t lastBit = result >> 63;
nzcvLocal = (lastBit << 3) | ((result==0) <<2);
if(d != 31){
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xf1000000) ) {
// SUBS immediate 64
// cout << "SUBS immediate 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint64_t result = 0;
uint64_t operand1 = reg[n];
uint64_t operand2 = ~imm;
uint8_t nzcv_temp = 0;
add_with_carry64(operand1, operand2, 1, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xeb000000) ) {
// SUBS shifted register 64
uint64_t Rd = extract(instr_int, 4, 0);
uint64_t Rn = extract(instr_int, 9, 5);
uint64_t imm6 = extract(instr_int, 15, 10);
uint64_t Rm = extract(instr_int, 20, 16);
uint64_t shift = extract(instr_int, 23, 22);
uint64_t result = 0;
uint64_t operand1 = Rn == 31 ? 0 : reg[Rn];
uint64_t operand2 = shift_reg64(reg[Rm], shift, imm6);
uint8_t nzcv = 0;
operand2 = ~(operand2);
add_with_carry64(operand1, operand2, (uint8_t) 1, &result, &nzcv);
nzcvLocal = nzcv;
if ( Rd != 31 ) {
reg[Rd] = result;
}
} else if ( is_instruction(instr_int, 0xea200000) ){
//bics 64 bit
//BICS 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_amount = extract(instr_int, 10, 15);
uint64_t shift_type = extract(instr_int, 23, 22);
//uint64_t datasize = 32;
uint64_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint64_t operand2 = shift_reg64(m, shift_type, shift_amount);
operand2 = ~operand2;
uint64_t result = operand1 & operand2;
nzcvLocal = (extract_single(result, 63) << 3) | ((result == 0) << 2) | 0;
if(d != 31){
reg[d] = result;
}
} else if( is_instruction(instr_int, 0xdac01000) ){
//clz 64 bit
//CLZ 64 bit
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t result = 0;
uint64_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
result = count_leading_zero_bits64(operand1);
if(d != 31){
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xdac00800) ) {
// REV
uint64_t n = extract(instr_int, 9, 5);
uint64_t d = extract(instr_int, 4, 0);
if ( n == 31 && d != 31 ) {
reg[d] = 0;
} else if ( n != 31 && d != 31 ) {
uint64_t orig = reg[n];
uint64_t rev = 0;
for ( int i = 0; i < 64; i++ ) {
rev |= ((orig >> i) & 1) << (63 - i);
}
reg[d] = rev;
}
} else if( is_instruction(instr_int, 0xda800000) ){
//csinv 64 bit
//CSINV 64 bit
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint8_t cond = extract(instr_int, 15, 12);
uint64_t result = 0;
uint64_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint64_t operand2 = 0;
if(m != 31){
operand2 = reg[m];
}
if(conditionHolds(cond, nzcvLocal)){
result = operand1;
}
else{
result = ~operand2;
}
if(d != 31){
reg[d] = result;
}
}
else if ( is_instruction(instr_int, 0xd65f0000) ) {
// RET
// cout << "RET" << endl;
uint64_t n = extract(instr_int, 9, 5);
pcChange = true;
if ( n != 31 ) {
pcLocal = reg[n];
} else {
pcLocal = 0;
}
} else if ( is_instruction(instr_int, 0xd61f0000) ) {
// BR
uint64_t n = extract(instr_int, 9, 5);
pcChange = true;
pcLocal = n == 31 ? 0 : reg[n];
} else if ( is_instruction(instr_int, 0xd5300000) ) {
// MRS
uint64_t t = extract(instr_int, 4, 0);
uint64_t sys_op0 = 2 + extract_single(instr_int, 19);
uint64_t sys_op1 = extract(instr_int, 18, 16);
uint64_t sys_op2 = extract(instr_int, 7, 5);
uint64_t sys_crn = extract(instr_int, 15, 12);
uint64_t sys_crm = extract(instr_int, 11, 8);
uint64_t sys_regnum = (sys_op0 << 14) | (sys_crn << 10) | (sys_op1 << 7) | (sys_op2 << 4) | sys_crm;
// sys_op0 + sys_crn + sys_op1 + sys_op2 + sys_crm
if ( t != 31 ) {
reg[t] = sys_reg[sys_regnum];
}
} else if ( is_instruction(instr_int, 0xd503201f) ) {
// NOP
} else if ( is_instruction(instr_int, 0xd4000001) ) {
// SVC
// Supervisor Call
uint64_t imm16 = extract(instr_int, 20, 5);
if ( imm16 == 0x0 ) {
// I/O setup
// io_setup(nr_events, ctx_idp);
reg[0] = 10000000;
printf("io_setup\n");
} else {
printf("\n\n%ld\n\n\n", imm16);
}
// syscall(imm16);
// } else if (is_instruction(instr_int, 0xd4200000)) {
// BRK
// exit(0);
} else if ( is_instruction(instr_int, 0xd3000000) ) {
// UBFM 64
// cout << "UBFM 64" << endl;
uint64_t N = extract_single(instr_int, 22);
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t immr = extract(instr_int, 21, 16);
uint64_t imms = extract(instr_int, 15, 10);
uint64_t wmask = 0;
uint64_t tmask = 0;
decode_bit_masks(N, imms, immr, false, &wmask, &tmask);
uint64_t src = 0;
if ( n != 31 ) {
src = reg[n];
}
uint64_t bot = rotate_right(src, immr) & wmask;
if ( d != 31 ) {
reg[d] = bot & tmask;
}
} else if ( is_instruction(instr_int, 0xd2800000) ) {
// MOVZ 64
// cout << "MOVZ 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t imm = extract(instr_int, 20, 5);
uint64_t pos = (extract(instr_int, 22, 21)) << 4;
uint64_t result = 0;
uint64_t j = 0;
for ( uint64_t i = pos; i < pos + 16; i++ ) {
result |= (extract_single(imm, j++) << i);
}
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xd1000000) ) {
// SUB immediate 64
// cout << "SUB immediate 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint64_t operand1 = reg[n];
uint64_t operand2 = ~imm;
uint64_t result = operand1 + operand2 + 1;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xc85ffc00) ) {
// LDAXR 64
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t address = reg[n];
uint64_t data = memory_get_64(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0xc8007c00) ) {
// STXR 64
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t s = extract(instr_int, 20, 16);
uint64_t address = reg[n];
uint64_t data = reg[t];
memory_set_64(address, data);
if ( s != 31 ) {
reg[s] = 0;
}
} else if ( is_instruction(instr_int, 0xb9400000) ) {
// LDR immediate unsigned offset 32
// cout << "LDR immediate unsigned offset 32" << endl;
uint64_t imm12 = extract(instr_int, 21, 10);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = imm12 << 2;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = memory_get_32(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0xb9000000) ) {
// STR immediate unsigned offset 32
// cout << "STR immediate unsigned offset 32" << endl;
uint8_t size = extract32(instr_int, 31, 30);
uint32_t t = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t imm = extract32(instr_int, 21, 10);
uint64_t offset = logical_shift_left32(imm, size);
uint64_t address = reg[n];
address = address + offset;
uint64_t data = reg[t];
memory_set_32(address, data);
} else if ( is_instruction(instr_int, 0xb8800400) ) {
// LDRSW immediate post-index
// cout << "LDRSW immediate post-index" << endl;
uint64_t Rt = extract(instr_int, 4, 0);
uint64_t Rn = extract(instr_int, 9, 5);
uint64_t imm9 = extract(instr_int, 20, 12);
uint64_t offset = sign_extend_64(imm9, 9);
uint64_t address = reg[Rn];
uint32_t data = memory_get_32(address);
if (Rt != 31) {
reg[Rt] = sign_extend_64(data, 32);
}
address = address + offset;
reg[Rn] = address;
} else if ( is_instruction(instr_int, 0xb8400c00) ) {
// LDR immediate pre-index 32
// cout << "LDR immediate pre-index 32" << endl;
uint64_t imm9 = extract(instr_int, 20, 12);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = sign_extend_32(imm9, 9);
uint64_t address = 0;
address = reg[n];
address = address + offset;
uint32_t data = memory_get_32(address);
if ( t != 31 ) {
reg[t] = data;
}
reg[n] = address;
} else if ( is_instruction(instr_int, 0xb8400400) ) {
// LDR immediate post-index 32
// cout << "LDR immediate post-index 32" << endl;
uint64_t imm9 = extract(instr_int, 20, 12);
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t offset = sign_extend_32(imm9, 9);
uint64_t address = 0;
address = reg[n];
uint32_t data = memory_get_32(address);
if ( t != 31 ) {
reg[t] = data;
}
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0xb8000c00) ) {
// STR immediate pre-index 32
// cout << "STR immediate pre-index 32" << endl;
uint32_t t = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t imm = extract32(instr_int, 20, 12);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = reg[n];
address = address + offset;
uint64_t data = reg[t];
memory_set_32(address, data);
reg[n] = address;
} else if ( is_instruction(instr_int, 0xb8000400) ) {
// STR immediate post-index 32
// cout << "STR immediate post-index 32" << endl;
uint32_t t = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t imm = extract32(instr_int, 20, 12);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = reg[n];
uint64_t data = reg[t];
memory_set_32(address, data);
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0xb7000000) ) {
// TBNZ 64
uint64_t t = extract(instr_int, 4, 0);
uint64_t bitpos = (1 << 4) | extract(instr_int, 23, 19);
uint64_t imm14 = extract(instr_int, 18, 5);
uint64_t offset = sign_extend_32(imm14 << 2, 16);
uint64_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( extract_single(regVal, bitpos) != 0 ) {
isZero = false;
}
if ( !isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0xb6000000) ) {
// TBZ 64
uint64_t t = extract(instr_int, 4, 0);
uint64_t bitpos = (1 << 4) | extract(instr_int, 23, 19);
uint64_t imm14 = extract(instr_int, 18, 5);
uint64_t offset = sign_extend_32(imm14 << 2, 16);
uint64_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = false;
if ( extract_single(regVal, bitpos) == 0 ) {
isZero = true;
}
if ( isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0xb5000000) ) {
// CBNZ 64
// cout << "CBNZ 64" << endl;
uint64_t imm = extract(instr_int, 23, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm << 2, 21);
uint32_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( regVal != 0 ) {
isZero = false;
}
if ( !isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0xb4000000) ) {
// CBZ 64
// cout << "CBZ 64" << endl;
uint64_t imm = extract(instr_int, 23, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm << 2, 21);
uint32_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( regVal != 0 ) {
isZero = false;
}
if ( isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0xb1000000) ) {
// ADDS immediate 64
// cout << "ADDS immediate 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint64_t result = 0;
uint64_t operand1 = reg[n];
uint64_t operand2 = imm;
uint8_t nzcv_temp = 0;
add_with_carry64(operand1, operand2, 0, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x1b000000) ) {
// MADD 32
// cout << "MADD 32" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t a = extract(instr_int, 14, 10);
uint64_t aval = a != 31 ? reg[a] : 0, nval = n != 31 ? reg[n] : 0, mval = m != 31 ? reg[m] : 0;
if ( d != 31 ) {
reg[d] = aval + (nval * mval);
}
} else if ( is_instruction(instr_int, 0xab000000) ) {
// ADDS shifted register 64
// cout << "ADD shifted register 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t imm = extract(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint64_t shift_type = extract(instr_int, 23, 22);
uint64_t shift_amt = imm;
uint64_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint64_t operand2 = 0;
if ( m != 31 ) {
operand2 = reg[m];
}
operand2 = shift_reg64(operand2, shift_type, shift_amt);
uint64_t result = 0;
uint8_t nzcv_temp = 0; // useless
add_with_carry64(operand1, operand2, 0, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xaa000000) ) {
// ORR shifted register 64
// cout << "ORR shifted register 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t imm = extract(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint64_t shift_type = extract(instr_int, 23, 22);
uint64_t shift_amt = imm;
uint64_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint64_t regVal = 0;
if ( m != 31 ) {
regVal = reg[m];
}
uint64_t operand2 = shift_reg64(regVal, shift_type, shift_amt);
uint64_t result = operand1 | operand2;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0xa9800000) ) {
// STP pre-index 64-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_64(address, data);
memory_set_64(address + 8, data2);
reg[n] = address;
} else if ( is_instruction(instr_int, 0xa9400000) ) {
// LDP signed offset 64-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = memory_get_64(address);
uint64_t data2 = memory_get_64(address + 8);
if ( t != 31 ) {
reg[t] = data;
}
if ( t2 != 31 ) {
reg[t2] = data2;
}
} else if ( is_instruction(instr_int, 0xa9c00000) ) {
// LDP pre-index 64
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = memory_get_64(address);
uint64_t data2 = memory_get_64(address + 8);
if ( t != 31 ) {
reg[t] = data;
}
if ( t2 != 31 ) {
reg[t2] = data2;
}
reg[n] = address;
} else if ( is_instruction(instr_int, 0xa9000000) ) {
// STP signed offset 64-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_64(address, data);
memory_set_64(address + 8, data2);
} else if ( is_instruction(instr_int, 0xa8c00000) ) {
// LDP post-index 64-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
uint64_t data = memory_get_64(address);
uint64_t data2 = memory_get_64(address + 8);
if ( t != 31 ) {
reg[t] = data;
}
if ( t2 != 31 ) {
reg[t2] = data2;
}
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0xa8800000) ) {
// STP post-index 64-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 3;
uint64_t address = reg[n];
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_64(address, data);
memory_set_64(address + 8, data2);
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0x9b000000) ) {
// MADD 64
// cout << "MADD 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t a = extract(instr_int, 14, 10);
uint64_t aval = a != 31 ? reg[a] : 0, nval = n != 31 ? reg[n] : 0, mval = m != 31 ? reg[m] : 0;
if ( d != 31 ) {
reg[d] = aval + (nval * mval);
}
} else if ( is_instruction(instr_int, 0x9a800400) ) {
// CSINC 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint8_t fullcond = extract32(instr_int, 15, 12);
uint64_t result = 0;
uint64_t operand1 = n == 31 ? 0 : reg[n];
uint64_t operand2 = m == 31 ? 0 : reg[m];
bool condHolds = conditionHolds(fullcond, nzcvLocal);
if ( condHolds ) {
result = operand1;
} else {
result = operand2 + 1;
}
if ( d != 31 ) {
reg[d] = result;
}
} else if( is_instruction(instr_int, 0x9a800000) ){
//CSEL 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint8_t cond = extract(instr_int, 15, 12);
uint64_t m = extract(instr_int, 20, 16);
uint64_t result = 0;
uint64_t operand1 = n == 31 ? 0 : reg[n];
uint64_t operand2 = m == 31 ? 0 : reg[m];
if(conditionHolds(cond, nzcvLocal))
result = operand1;
else
result = operand2;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x94000000) ) {
// BL
// cout << "BL" << endl;
uint64_t imm = extract(instr_int, 25, 0);
imm = sign_extend_64(imm << 2, 28);
reg[30] = pcLocal + 4;
pcLocal += imm;
pcChange = true;
} else if ( is_instruction(instr_int, 0x93000000) ) {
// SBFM 64
// cout << "SBFM 64" << endl;
uint64_t N = extract_single(instr_int, 22);
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t immr = extract(instr_int, 21, 16);
uint64_t imms = extract(instr_int, 15, 10);
uint64_t wmask = 0;
uint64_t tmask = 0;
decode_bit_masks(N, imms, immr, false, &wmask, &tmask);
uint64_t src = 0;
if ( n != 31 ) {
src = reg[n];
}
uint64_t bot = rotate_right(src, immr) & wmask;
uint64_t top = replicate(extract_single(src, imms), 1, 64);
if ( d != 31 ) {
reg[d] = (top & ~tmask) | (bot & tmask);
}
} else if ( is_instruction(instr_int, 0x92800000) ) {
// MOVN 64
// cout << "MOVN 64" << endl;
uint32_t d = extract(instr_int, 4, 0);
uint32_t pos = extract(instr_int, 22, 21);
uint32_t imm = extract(instr_int, 20, 5);
pos = pos << 4;
uint64_t result = imm << pos;
result = ~result;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x92000000) ) {
// AND immediate 64
// cout << "AND immediate 64" << endl;
uint64_t N = extract_single(instr_int, 22);
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t immr = extract(instr_int, 21, 16);
uint64_t imms = extract(instr_int, 15, 10);
uint64_t imm = 0;
uint64_t nah = 0; // throwaway value
decode_bit_masks(N, imms, immr, true, &imm, &nah);
if ( d != 31 ) {
if ( n == 31 ) {
reg[d] = 0;
} else {
reg[d] = reg[n] & imm;
}
}
} else if ( is_instruction(instr_int, 0x91000000) ) {
// ADD immediate 64
// cout << "ADD immediate 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract(instr_int, 23, 22);
uint64_t source_val = reg[n];
if ( shift == 1 ) {
imm = imm << 12;
}
uint64_t result = source_val + imm;
reg[d] = result;
} else if ( is_instruction(instr_int, 0x90000000) ) {
// ADRP
// cout << "ADRP" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t immhi = extract(instr_int, 23, 5);
uint64_t immlo = extract(instr_int, 30, 29);
uint64_t imm = sign_extend_64(((immhi << 2) | immlo) << 12, 33);
uint64_t base = pcLocal;
base = (base >> 12) << 12;
if ( d != 31 ) {
reg[d] = base + imm;
}
} else if ( is_instruction(instr_int, 0x8b000000) ) {
// ADD shifted register 64
// cout << "ADD shifted register 64" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t imm = extract(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint64_t shift_type = extract(instr_int, 23, 22);
uint64_t shift_amt = imm;
uint64_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint64_t operand2 = 0;
if ( m != 31 ) {
operand2 = reg[m];
}
operand2 = shift_reg64(operand2, shift_type, shift_amt);
uint64_t result = operand1 + operand2;
// uint8_t nzcv_temp = 0; // useless
// add_with_carry64(operand1, operand2, 0, &result, &nzcv_temp);
if ( d != 31 ) {
reg[d] = result;
}
} else if(is_instruction(instr_int, 0x8a200000) ){
//bic 64
//BIC 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_amount = extract(instr_int, 10, 15);
uint64_t shift_type = extract(instr_int, 23, 22);
// uint64_t datasize = 64;
uint64_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint64_t operand2 = shift_reg64(m, shift_type, shift_amount);
operand2 = ~operand2;
uint64_t result = operand1 & operand2;
if(d != 31){
reg[d] = result;
}
} else if(is_instruction(instr_int, 0x8a000000) ){
//and shifted register 64
//AND SHIFTED REGISTER 64
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_type = extract(instr_int, 23, 22);
uint64_t shift_amount = extract(instr_int, 15, 10);
uint64_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint64_t operand2 = shift_reg64(m, shift_type, shift_amount);
uint64_t result = operand1 & operand2;
if(d != 31){
reg[d] = result;
}
}
else if ( is_instruction(instr_int, 0x885ffc00) ) {
// LDAXR 32
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t address = reg[n];
uint32_t data = memory_get_32(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0x88007c00) ) {
// STXR 32
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t s = extract(instr_int, 20, 16);
uint64_t address = reg[n];
uint32_t data = reg[t];
memory_set_32(address, data);
if ( s != 31 ) {
reg[s] = 0;
}
} else if ( is_instruction(instr_int, 0x7a400800) ) {
// CCMP immediate 32
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm5 = extract(instr_int, 20, 16);
uint8_t flags = extract(instr_int, 3, 0);
uint8_t fullcond = extract32(instr_int, 15, 12);
// bool condHolds = false;
// if ( cond == 0 ) {
// condHolds = (extract_single32(nzcvLocal, 2) == 1); // Z == 1 <-> EQ or NE
// } else if ( cond == 1 ) {
// condHolds = (extract_single32(nzcvLocal, 1) == 1); // C == 1 <-> CS or CC
// } else if ( cond == 2 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == 1); // N == 1 <-> MI or PL
// } else if ( cond == 3 ) {
// condHolds = (extract_single32(nzcvLocal, 0) == 1); // V == 1 <-> VS or VC
// } else if ( cond == 4 ) {
// condHolds = (extract_single32(nzcvLocal, 1) == 1 && extract_single32(nzcvLocal, 2) == 0); // C == 1 && Z == 0 <-> HI or LS
// } else if ( cond == 5 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == extract_single32(nzcvLocal, 0)); // N == V <-> GE or LT
// } else if ( cond == 6 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == extract_single32(nzcvLocal, 0) && extract_single32(nzcvLocal, 2) == 0); // N == V && Z == 0 <-> GT or LE
// } else {
// condHolds = true; // AL
// }
// if ( extract_single32(condLast, 0) == 1 && cond != 7 ) {
// condHolds = !condHolds;
// }
bool condHolds = conditionHolds(fullcond, nzcvLocal);
uint64_t operand1 = reg[n];
uint64_t operand2 = 0;
uint32_t result_throwaway = 0;
uint8_t flags_result = 0;
if ( condHolds ) {
operand2 = ~imm5;
add_with_carry32(operand1, operand2, 1, &result_throwaway, &flags_result);
nzcvLocal = flags_result;
} else {
nzcvLocal = flags;
}
} else if( is_instruction(instr_int, 0x72000000) ){
//ANDS immediate 32
uint32_t d = extract(instr_int, 4, 0);
uint32_t n = extract(instr_int, 9, 5);
uint32_t imms = extract(instr_int, 15, 10);
uint32_t immr = extract(instr_int, 21, 16);
uint32_t N = extract(instr_int, 22, 22);
uint64_t nah = 0;
uint64_t imm = 0;
decode_bit_masks(N, imms, immr, true, &imm, &nah);
uint32_t operand1 = n == 31 ? 0 : reg[n];
uint32_t result = operand1 & imm;
uint32_t lastBit = result >> 31;
nzcvLocal = (lastBit << 3) | ((result==0) <<2);
if(d != 31){
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x71000000) ) {
// SUBS immediate 32
// cout << "SUBS immediate 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t imm = extract32(instr_int, 21, 10);
uint32_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint32_t result = 0;
uint32_t operand1 = reg[n];
uint32_t operand2 = ~imm;
uint8_t nzcv_temp = 0;
add_with_carry32(operand1, operand2, 1, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x6b0003e0) ) {
// SUBS shifted register 32
uint64_t Rd = extract(instr_int, 4, 0);
uint64_t Rn = extract(instr_int, 9, 5);
uint64_t imm6 = extract(instr_int, 15, 10);
uint64_t Rm = extract(instr_int, 20, 16);
uint64_t shift = extract(instr_int, 23, 22);
//uint64_t sf = extract(instr_int, 31, 31);
uint32_t result;
uint32_t operand1 = reg[Rn];
uint32_t operand2 = shift_reg32((uint32_t) Rm, (uint32_t) shift, (int) imm6);
uint8_t nzcv;
operand2 = ~(operand2);
add_with_carry32(operand1, operand2, (uint8_t) 1, &result, &nzcv);
if ( Rd != 31 ) {
reg[Rd] = result;
}
} else if( is_instruction(instr_int, 0x6a200000) ){
// bics 32 bit
// BICS 32 BIT
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_amount = extract(instr_int, 10, 15);
uint64_t shift_type = extract(instr_int, 23, 22);
//uint64_t datasize = 32;
uint32_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint32_t operand2 = shift_reg32(m, shift_type, shift_amount);
operand2 = ~operand2;
uint32_t result = operand1 & operand2;
nzcvLocal = (extract_single32(result, 31) << 3) | ((result == 0) << 2) | 0;
if(d != 31){
reg[d] = result;
}
}
else if( is_instruction(instr_int, 0x5ac01000) ){
//clz 32 bit
//CLZ 32 bit
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint32_t result = 0;
uint32_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
result = count_leading_zero_bits32(operand1);
if(d != 31){
reg[d] = result;
}
}
else if( is_instruction(instr_int, 0x5a800000) ){
//csinv 32 bit
//CSINV 32 bit
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint8_t cond = extract(instr_int, 15, 12);
uint32_t result = 0;
uint32_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint32_t operand2 = 0;
if(m != 31){
operand2 = reg[m];
}
if(conditionHolds(cond, nzcvLocal)){
result = operand1;
}
else{
result = ~operand2;
}
if(d != 31){
reg[d] = result;
}
}
else if ( is_instruction(instr_int, 0x58000000) ) {
// LDR (literal) 64-bit
uint64_t imm = extract(instr_int, 23, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm << 2, 21);
uint64_t address = pcLocal + offset;
uint64_t data = memory_get_64(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0x54000000) ) {
// B.cond
// cout << "B.cond" << endl;
uint64_t imm = extract(instr_int, 23, 5);
uint64_t offset = sign_extend_64(imm << 2, 21);
// uint8_t cond = extract32(instr_int, 3, 1);
// uint8_t condLast = extract_single32(instr_int, 0);
uint8_t fullcond = extract32(instr_int, 3, 0);
// bool condHolds = false;
// if ( cond == 0 ) {
// condHolds = (extract_single32(nzcvLocal, 2) == 1); // Z == 1 <-> EQ or NE
// } else if ( cond == 1 ) {
// condHolds = (extract_single32(nzcvLocal, 1) == 1); // C == 1 <-> CS or CC
// } else if ( cond == 2 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == 1); // N == 1 <-> MI or PL
// } else if ( cond == 3 ) {
// condHolds = (extract_single32(nzcvLocal, 0) == 1); // V == 1 <-> VS or VC
// } else if ( cond == 4 ) {
// condHolds = (extract_single32(nzcvLocal, 1) == 1 && extract_single32(nzcvLocal, 2) == 0); // C == 1 && Z == 0 <-> HI or LS
// } else if ( cond == 5 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == extract_single32(nzcvLocal, 0)); // N == V <-> GE or LT
// } else if ( cond == 6 ) {
// condHolds = (extract_single32(nzcvLocal, 3) == extract_single32(nzcvLocal, 0) && extract_single32(nzcvLocal, 2) == 0); // N == V && Z == 0 <-> GT or LE
// } else {
// condHolds = true; // AL
// }
// if ( extract_single32(condLast, 0) == 1 && cond != 7 ) {
// condHolds = !condHolds;
// }
bool condHolds = conditionHolds(fullcond, nzcvLocal);
if ( condHolds ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0x53000000) ) {
// UBFM 32
// cout << "UBFM 32" << endl;
uint32_t N = extract_single32(instr_int, 22);
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t immr = extract32(instr_int, 21, 16);
uint32_t imms = extract32(instr_int, 15, 10);
uint64_t wmask = 0;
uint64_t tmask = 0;
decode_bit_masks(N, imms, immr, false, &wmask, &tmask);
uint64_t src = 0;
if ( n != 31 ) {
src = reg[n];
}
uint64_t bot = rotate_right32(src, immr) & wmask;
if ( d != 31 ) {
reg[d] = set_reg_32(reg[d], bot & tmask);
}
} else if ( is_instruction(instr_int, 0x52800000) ) {
// MOVZ 32
// cout << "MOVZ 32" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t imm = extract(instr_int, 20, 5);
uint64_t pos = (extract(instr_int, 22, 21)) << 4;
uint32_t result = 0;
uint8_t j = 0;
for ( uint64_t i = pos; i < pos + 16; i++ ) {
result |= (extract_single32(imm, j++) << i);
}
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x51000000) ) {
// SUB immediate 32
// cout << "SUB immediate 32" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint32_t operand1 = reg[n];
uint32_t operand2 = ~imm;
uint32_t result = operand1 + operand2 + 1;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x3d800000) ) {
// STR immediate unsigned offset SIMD 128
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t offset = imm << 4;
uint64_t address = reg[n];
address = address + offset;
unsigned __int128 data = simd_reg[t];
memory_set_128(address, data);
} else if ( is_instruction(instr_int, 0x39400000) ) {
// LDRB immediate unsigned offset 32
// cout << "LDRB immediate unsigned offset 32" << endl;
uint64_t imm = extract(instr_int, 21, 10);
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = imm;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = memory_get(address);
if ( t != 31 ) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0x39000000) ) {
// STRB immediate unsigned offset 32
// cout << "STRB immediate unsigned offset 32" << endl;
uint64_t imm = extract(instr_int, 21, 10);
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = imm;
uint64_t address = reg[n];
address = reg[n];
address = address + offset;
uint8_t data = reg[t];
memory_set(address, data);
} else if( is_instruction(instr_int, 0x38600800) ){
//ldrb register
//LDRB register
//LDRB REGISTER
// how the
// hell do we do this
// thats what they said
uint64_t t = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t option = extract(instr_int, 15, 13);
//uint64_t extend_type = decode_reg_extend(option);
uint64_t extend_type = option;
uint64_t offset = extend_reg64(m, extend_type, 0, reg);
uint64_t address;
uint8_t data;
address = reg[n];
address = address + offset;
data = memory_get(address);
if (t != 31) {
reg[t] = data;
}
} else if ( is_instruction(instr_int, 0x38400c00) ) {
// LDRB immediate pre-index 32
// cout << "LDRB immediate pre-index 32" << endl;
uint64_t imm = extract(instr_int, 20, 12);
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = 0;
address = reg[n];
address = address + offset;
uint64_t data = memory_get(address);
if ( t != 31 ) {
reg[t] = data;
}
reg[n] = address;
} else if ( is_instruction(instr_int, 0x38400400) ) {
// LDRB immediate post-index 32
// cout << "LDRB immediate post-index 32" << endl;
uint64_t imm = extract(instr_int, 20, 12);
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm, 9);
uint64_t address = 0;
address = reg[n];
uint64_t data = memory_get(address);
address = address + offset;
if ( t != 31 ) {
reg[t] = data;
}
reg[n] = address;
} else if ( is_instruction(instr_int, 0x37000000) ) {
// TBNZ 32
uint64_t t = extract(instr_int, 4, 0);
uint64_t bitpos = extract(instr_int, 23, 19);
uint64_t imm14 = extract(instr_int, 18, 5);
uint64_t offset = sign_extend_32(imm14 << 2, 16);
uint64_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( extract_single32(regVal, bitpos) != 0 ) {
isZero = false;
}
if ( !isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0x36000000) ) {
// TBZ 32
uint64_t t = extract(instr_int, 4, 0);
uint64_t bitpos = extract(instr_int, 23, 19);
uint64_t imm14 = extract(instr_int, 18, 5);
uint64_t offset = sign_extend_32(imm14 << 2, 16);
uint64_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = false;
if ( extract_single32(regVal, bitpos) == 0 ) {
isZero = true;
}
if ( isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0x35000000) ) {
// CBNZ 32
// cout << "CBNZ 32" << endl;
uint64_t imm = extract(instr_int, 23, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm << 2, 21);
uint32_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( regVal != 0 ) {
isZero = false;
}
if ( !isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0x34000000) ) {
// CBZ 32
// cout << "CBZ 32" << endl;
uint64_t imm = extract(instr_int, 23, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t offset = sign_extend_64(imm << 2, 21);
uint32_t regVal = 0;
if ( t != 31 ) {
regVal = reg[t];
}
bool isZero = true;
if ( regVal != 0 ) {
isZero = false;
}
if ( isZero ) {
pcChange = true;
pcLocal = pcLocal + offset;
}
} else if ( is_instruction(instr_int, 0x31000000) ) {
// ADDS immediate 32
// cout << "ADDS immediate 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t imm = extract32(instr_int, 21, 10);
uint32_t shift = extract_single32(instr_int, 22);
if ( shift == 1 ) {
imm = imm << 12;
}
uint32_t result = 0;
uint32_t operand1 = reg[n];
uint32_t operand2 = imm;
uint8_t nzcv_temp = 0;
add_with_carry32(operand1, operand2, 0, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x2a000000) ) {
// ORR shifted register 32
// cout << "ORR shifted register 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t m = extract32(instr_int, 20, 16);
uint32_t imm = extract32(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint32_t shift_type = extract32(instr_int, 23, 22);
uint32_t shift_amt = imm;
uint32_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint32_t regVal = 0;
if ( m != 31 ) {
regVal = (uint32_t) reg[m];
}
uint32_t operand2 = shift_reg32(regVal, shift_type, shift_amt);
uint32_t result = operand1 | operand2;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x29800000) ) {
// STP pre-index 32-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_32(extract32(instr_int, 21, 15), 7) << 2;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_32(address, data);
memory_set_32(address + 4, data2);
reg[n] = address;
} else if ( is_instruction(instr_int, 0x29000000) ) {
// STP signed offset 32-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_32(extract32(instr_int, 21, 15), 7) << 2;
uint64_t address = reg[n];
address = address + offset;
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_32(address, data);
memory_set_32(address + 4, data2);
} else if ( is_instruction(instr_int, 0x2b000000) ) {
// ADDS shifted register 32
// cout << "ADD shifted register 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t m = extract32(instr_int, 20, 16);
uint32_t imm = extract32(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint32_t shift_type = extract32(instr_int, 23, 22);
uint32_t shift_amt = imm;
uint32_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint32_t operand2 = 0;
if ( m != 31 ) {
operand2 = reg[m];
}
operand2 = shift_reg32(operand2, shift_type, shift_amt);
uint32_t result = 0;
uint8_t nzcv_temp = 0;
add_with_carry32(operand1, operand2, 0, &result, &nzcv_temp);
nzcvLocal = nzcv_temp;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x28c00000) ) {
// LDP post-index 32-bit
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_64(extract(instr_int, 21, 15), 7) << 2;
uint64_t address = reg[n];
uint64_t data = memory_get_64(address);
uint64_t data2 = memory_get_64(address + 4);
if ( t != 31 ) {
reg[t] = data;
}
if ( t2 != 31 ) {
reg[t2] = data2;
}
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0x28800000) ) {
// STP post-index 32
uint64_t n = extract(instr_int, 9, 5);
uint64_t t = extract(instr_int, 4, 0);
uint64_t t2 = extract(instr_int, 14, 10);
uint64_t offset = sign_extend_32(extract32(instr_int, 21, 15), 7) << 2;
uint64_t address = reg[n];
uint64_t data = t == 31 ? 0 : reg[t];
uint64_t data2 = t2 == 31 ? 0 : reg[t2];
memory_set_32(address, data);
memory_set_32(address + 4, data2);
address = address + offset;
reg[n] = address;
} else if ( is_instruction(instr_int, 0x1a800400) ) {
// CSINC 32
uint32_t d = extract(instr_int, 4, 0);
uint32_t n = extract(instr_int, 9, 5);
uint32_t m = extract(instr_int, 20, 16);
uint8_t fullcond = extract32(instr_int, 15, 12);
uint32_t result = 0;
uint32_t operand1 = n == 31 ? 0 : reg[n];
uint32_t operand2 = m == 31 ? 0 : reg[m];
bool condHolds = conditionHolds(fullcond, nzcvLocal);
if ( condHolds ) {
result = operand1;
} else {
result = operand2 + 1;
}
if ( d != 31 ) {
reg[d] = result;
}
} else if( is_instruction(instr_int, 0x1a800000) ){
//CSEL 32
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t cond = extract(instr_int, 15, 12);
uint64_t m = extract(instr_int, 20, 16);
uint32_t result = 0;
uint32_t operand1 = n == 31 ? 0 : reg[n];
uint32_t operand2 = m == 31 ? 0 : reg[m];
if(conditionHolds((uint8_t)cond, nzcvLocal))
result = operand1;
else
result = operand2;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x14000000) ) {
// B
// cout << "B" << endl;
uint64_t imm = extract(instr_int, 25, 0);
uint64_t offset = sign_extend_64(imm << 2, 28);
pcChange = true;
pcLocal = pcLocal + offset;
} else if ( is_instruction(instr_int, 0x12800000) ) {
// MOVN 32
// cout << "MOVN 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t pos = extract32(instr_int, 22, 21);
uint32_t imm = extract32(instr_int, 20, 5);
pos = pos << 4;
uint64_t result = imm << pos;
result = ~result;
if ( d != 31 ) {
reg[d] = result;
}
} else if ( is_instruction(instr_int, 0x12000000) ) {
// AND immediate 32
// cout << "AND immediate 32" << endl;
uint32_t N = extract_single32(instr_int, 22);
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t immr = extract32(instr_int, 21, 16);
uint32_t imms = extract32(instr_int, 15, 10);
uint64_t imm = 0;
uint64_t nah = 0; // throwaway value
decode_bit_masks(N, imms, immr, true, &imm, &nah);
uint32_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
reg[d] = set_reg_32(reg[d], operand1 & imm);
} else if ( is_instruction(instr_int, 0x11000000) ) {
// ADD immediate 32
// cout << "ADD immediate 32" << endl;
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t imm = extract(instr_int, 21, 10);
uint64_t shift = extract(instr_int, 23, 22);
uint64_t source_val = reg[n];
if ( shift == 1 ) {
imm = imm << 12;
}
uint32_t result = source_val + imm;
reg[d] = result;
} else if ( is_instruction(instr_int, 0xb000000) ) {
// ADD shifted register 32
// cout << "ADD shifted register 32" << endl;
uint32_t d = extract32(instr_int, 4, 0);
uint32_t n = extract32(instr_int, 9, 5);
uint32_t m = extract32(instr_int, 20, 16);
uint32_t imm = extract32(instr_int, 15, 10);
// shift = 0 => LSL
// shift = 1 => LSR
// shift = 2 => ASR
// shift = 3 => ROR
uint32_t shift_type = extract32(instr_int, 23, 22);
uint32_t shift_amt = imm;
uint32_t operand1 = 0;
if ( n != 31 ) {
operand1 = reg[n];
}
uint32_t operand2 = 0;
if ( m != 31 ) {
operand2 = reg[m];
}
operand2 = shift_reg32(operand2, shift_type, shift_amt);
uint32_t result = operand1 + operand2;
// uint8_t nzcv_temp = 0; // useless
// add_with_carry32(operand1, operand2, 0, &result, &nzcv_temp);
if ( d != 31 ) {
reg[d] = result;
}
} else if( is_instruction(instr_int, 0xa200000) ){
//bic 32
//BIC 32
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_amount = extract(instr_int, 10, 15);
uint64_t shift_type = extract(instr_int, 23, 22);
//uint64_t datasize = 32;
uint32_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint32_t operand2 = shift_reg32(m, shift_type, shift_amount);
operand2 = ~operand2;
uint32_t result = operand1 & operand2;
if(d != 31){
reg[d] = result;
}
} else if( is_instruction(instr_int, 0xa000000) ){
//and shifted register 32
//AND SHIFTED REGISTER 32
uint64_t d = extract(instr_int, 4, 0);
uint64_t n = extract(instr_int, 9, 5);
uint64_t m = extract(instr_int, 20, 16);
uint64_t shift_type = extract(instr_int, 23, 22);
uint64_t shift_amount = extract(instr_int, 15, 10);
uint32_t operand1 = 0;
if(n != 31){
operand1 = reg[n];
}
uint32_t operand2 = shift_reg32(m, shift_type, shift_amount);
uint32_t result = operand1 & operand2;
if(d != 31){
reg[d] = result;
}
} else {
allTerminated = termin(pcLocal, instr_int, reg, simd_reg, debug);
}
/*
printf("instruction %x at address %lx\n", instr_int, pcLocal);
for ( int i = 0; i < 32; i++ ) {
unsigned long val = reg[i];
if ( i == 31 ) {
printf("XSP : %016lX\n", val);
} else {
printf("X%02d : %016lX\n", i, val);
}
}
*/
if ( !pcChange ) {
pcLocal += 4;
}
}
return 0;
}
|
55f742eaaee484a5a0ed170118fb9d2765c3b848 | 1f443b6ba738ebe5b8826e9dbd003f25a27a4b2a | /S2.h | ca5adf7bf17531cf56152e534dc9505dffc6ace3 | [] | no_license | vshengyu/k1 | bda2d255103744650692ba7c7fe20239c31deb39 | 642190e7d5c9938fda7dca802a47aed35b51dcc7 | refs/heads/master | 2022-12-21T06:29:03.590073 | 2020-09-21T13:17:35 | 2020-09-21T13:17:35 | 297,347,127 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 265 | h | S2.h | #pragma once
#include"Scene.h"
class CFrame;
class CHero;
class CBarrier;
class CS2 :public CScene
{
struct MYPOINT
{
int x;
int y;
int dir;
};
POINT m_Pos;
/*int m_W;
int m_H;*/
CFrame* m_Frame;
public:
void Init();
void Run();
void End();
}; |
b6dea05b3224a59bed6478de3f787b85c89c4574 | 9b11f561510070d40be43addeccc743f91025cfa | /codeforces/1140/A.cpp | 875351bff4b9e934a8b338862ef63d6cdea23a7e | [] | no_license | MasterMind90/cppractice | a5a1774fc87047c9c9f18ed6df2a58af4a027256 | ce1b74d9e682e5d369df62f3ad9494798dceda85 | refs/heads/master | 2023-02-21T04:58:50.101142 | 2019-05-08T14:41:00 | 2021-01-14T21:11:38 | 328,998,830 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 640 | cpp | A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n ;
cin >> n ;
vector<int> v(n+1);
map<int,vector<int> > m ;
for(int i=1;i<=n;i++){
cin >> v[i] ;
m[v[i]].push_back(i);
}
vector<bool> flag(n+1,0);
int days = 0 ;
for(int i=1;i<=n;i++){
for(int j=0;j<m[i].size();j++){
flag[m[i][j]] = true ;
}
bool ok = true ;
for(int j=1;j<=i;j++){
if ( flag[j] == false ){
ok = false ;
break;
}
}
if ( ok ) days++;
}
cout << days << endl;
return 0 ;
}
|
d745d33426ef7cabe06ba319e2a2d9b10bbcb6a8 | 8194c153de598eaca637559443f71d13b729d4d2 | /ogsr_engine/xrGame/Needles.h | 8e12fd4639aa59fb6cbbbf51597b3723c951cdf3 | [
"Apache-2.0"
] | permissive | NikitaNikson/X-Ray_Renewal_Engine | 8bb464b3e15eeabdae53ba69bd3c4c37b814e33e | 38cfb4a047de85bb0ea6097439287c29718202d2 | refs/heads/dev | 2023-07-01T13:43:36.317546 | 2021-08-01T15:03:31 | 2021-08-01T15:03:31 | 391,685,134 | 4 | 4 | Apache-2.0 | 2021-08-01T16:52:09 | 2021-08-01T16:52:09 | null | UTF-8 | C++ | false | false | 349 | h | Needles.h | ///////////////////////////////////////////////////////////////
// Needles.h
// Needles - артефакт иголки
///////////////////////////////////////////////////////////////
#pragma once
#include "artifact.h"
class CNeedles: public CArtefact
{
private:
typedef CArtefact inherited;
public:
CNeedles(void);
virtual ~CNeedles(void);
}; |
b74e35d15d847b971c9f1c178d2772cd335f50a7 | 6435a280c5f2c809a9238894e23661dc8e16312a | /Client/Shreck/trance.cpp | 334fe76b595c7969a04ca345178211220211305b | [] | no_license | wangweihao/CloudBackup | de088ffeb67c03580b8c9cf54f91a4c17c6740aa | 9ed1d79753b179be3a09b5aa0aa350d83f16cdad | refs/heads/master | 2021-01-15T08:52:02.394369 | 2016-01-24T13:34:02 | 2016-01-24T13:34:02 | 39,867,697 | 7 | 1 | null | 2016-02-28T02:29:30 | 2015-07-29T02:01:28 | C++ | UTF-8 | C++ | false | false | 3,575 | cpp | trance.cpp | /*************************************************************************
> File Name: trance.cpp
> Author: MiaoShuai
> Mail: 945970809@qq.com
> Created Time: 2015年08月04日 星期二 20时01分54秒
************************************************************************/
#include<iostream>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<stdlib.h>
#include<assert.h>
//#include<pthread.h>
#include<fcntl.h>
#include<sys/types.h>
#include<sys/sendfile.h>
#include<string.h>
#include<sys/stat.h>
using namespace std;
void RequstDownload(int sockFd,std::string filename)
{
std::cout<<"开始下载"<<endl;
cout<<"sockFd = "<<sockFd<<endl;
//打开并创建与上面filename相同的文件
int fileFd;
if((fileFd = open(filename.c_str(),O_WRONLY | O_CREAT | O_EXCL,S_IRUSR | S_IWUSR | S_IXUSR)) < 0)
{
std::cout<<"文件打开失败"<<endl;
exit(1);
}
cout<<"fileFd = "<<fileFd<<endl;
//获取文件属性
struct stat statFile;
fstat(sockFd,&statFile);
//使用splice拷贝文件
int pipeFd[2];
int ret;
//创建管道
ret = pipe(pipeFd);
if(ret < 0)
{
std::cout<<"管道创建失败"<<endl;
}
int sum = 0;
//从发送端套接字将文件读入到管道
while((ret = splice(sockFd,NULL,pipeFd[1],NULL,32768,SPLICE_F_MOVE)) > 0)
{
sum = sum + ret;
//cout<<"ret11 = "<<ret<<endl;
//从管道读出内容写入文件
ret = splice(pipeFd[0],NULL,fileFd,NULL,32768,SPLICE_F_MOVE);
//cout<<"ret22 = "<<ret<<endl;
if(ret <= 0)
{
break;
}
}
if(ret == -1)
{
cout<<"splice调用失败"<<endl;
}
cout<<"sum = "<<sum<<endl;
if(sum == statFile.st_size)
{
cout<<"文件写入成功"<<endl;
}
}
void RequestUpload(int sockFd,string filename)
{
std::cout<<"开始上传"<<endl;
//打开文件
int fileFd;
if((fileFd = open(filename.c_str(),O_RDONLY)) == -1)
{
std::cout<<"文件打开失败"<<endl;
}
//获取文件属性
struct stat statFile;
cout<<"111"<<endl;
fstat(fileFd,&statFile);
//用sendfile将文件发给接收端
cout<<"statFile.st_size = "<<statFile.st_size<<endl;
int sum = 0;
ssize_t ret = 0;
cout<<"nihao"<<endl;
cout<<"sockFd = "<<sockFd<<endl;
cout<<"fileFd = "<<fileFd<<endl;
off_t pos = lseek(fileFd,0,SEEK_SET);
if(pos < 0)
{
cout<<"error"<<endl;
}
ret = sendfile(sockFd,fileFd,&pos,statFile.st_size);
cout<<"statFile.st_size = "<<statFile.st_size<<endl;
cout<<"ret = "<<ret<<endl;
sum = sum + ret;
close(fileFd);
cout<<"sum = "<<sum<<endl;
if(ret == -1)
{
std::cout<<"使用sendfile失败"<<endl;
}
if(sum >= statFile.st_size)
{
std::cout<<"文件上传成功"<<endl;
}
}
int main(int argc,char **argv)
{
if(argc < 3)
{
std::cout<<"您输入的参数有误"<<endl;
exit(1);
}
const char *ip = argv[1];
int port = atoi(argv[2]);
sockaddr_in address;
bzero(&address,sizeof(address));
address.sin_family = AF_INET;
inet_pton(AF_INET,ip,&address.sin_addr);
address.sin_port = htons(port);
int connFd = socket(AF_INET,SOCK_STREAM,0);
assert(connFd >= 0);
int ret = 0;
ret = connect(connFd,(sockaddr *)&address,sizeof(address));
char s[50] = "{\"mark\":1,\"md5\":\"/home/shreck/haha.jpg\"}";
//std::cout<<"1.选择上传\n"<<"2.选择下载"<<endl;
assert(ret >= 0);
send(connFd,s,50,0);
//int x;
//cin>>x;
string filename = "/tmp/haha.jpg";
//if(x == 1)
//{
//RequestUpload(connFd,filename);
//}
//else if(x == 2)
//{
RequstDownload(connFd,filename);
//}
return 0;
}
|
3bc7d9e74fac0efd5b111c34e02b2d27b34330cf | ddb3c4859ac27b68be09067af0596a75d4a14a03 | /src/memory_space.h | 8f4a9bc6f94d082ea79a926f8eefb754b9464b59 | [] | no_license | econde/p16_assembler | d30addab37c28942484129704d427fa504b3cb39 | 57c35eaddd51e28894ec6177ed843e78294d77c0 | refs/heads/master | 2023-06-22T07:48:26.208816 | 2023-06-21T16:28:02 | 2023-06-21T16:28:02 | 142,189,463 | 6 | 3 | null | 2020-07-03T15:12:11 | 2018-07-24T17:10:06 | C++ | UTF-8 | C++ | false | false | 1,525 | h | memory_space.h | /*
Copyright 2020 Ezequiel Conde
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.
*/
/*
Simulação de sistema de memória paginado de um nível.
Dimensão da página e dimensão total do espaço de endereçamento parametrizáveis.
*/
#ifndef MEMORY_SPACE_H
#define MEMORY_SPACE_H
#include <stddef.h>
#include <stdint.h>
class Memory_space {
typedef struct page_entry {
uint32_t present: 1;
uint8_t *data;
} Page_entry;
unsigned page_size, page_bits, page_mask,
page_table_size, page_table_bits, page_table_mask;
Page_entry *page_table;
uint8_t *page_zero;
public:
explicit Memory_space(size_t page_size, size_t space_size);
~Memory_space();
void read(uint32_t address, uint8_t *buffer, size_t size);
void write(uint32_t address, uint8_t *data, size_t size);
void write8(uint32_t address, uint8_t data);
void write16(uint32_t address, uint16_t data);
void write32(uint32_t address, uint32_t data);
uint8_t read8(uint32_t address);
uint16_t read16(uint32_t address);
uint32_t read32(uint32_t address);
};
#endif
|
88939aec4d9dfebe37d023b6153bb3e9e0818d31 | 1e78f3cda1781129fee29d4bdd72d7f10dba90a3 | /lovegl/core/texture.cpp | 9aa27ca6b64eb064f9784969e6fd33ceb28cc446 | [] | no_license | michealyy/LoveGL | 0c9381dfb70f3d5554c6d8474f11f15e9f07871e | 16c289cfce07800d16c9261ee0dfdec06966d46f | refs/heads/master | 2020-05-20T05:49:36.544305 | 2019-03-03T16:07:10 | 2019-03-03T16:07:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,748 | cpp | texture.cpp | #include <GL/glew.h>
#include <gli/gli.hpp>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include "texture.h"
#include <resource_manager.h>
using namespace std;
namespace kd
{
Texture::Texture(const std::string &name)
{
auto tex = ResourceManager::GetInstance()->GetTexture(name);
if (tex != nullptr)
{
fprintf(stderr, "[Texture] have same name texture: %s\n", name.c_str());
return;
}
name_ = name;
ResourceManager::GetInstance()->AddTexture(name, this);
}
Texture::~Texture()
{
glDeleteTextures(1, &texture_id_);
}
void Texture::Bind()
{
if (texture_id_ == 0)
{
fprintf(stderr, "[Texture] opengl texture id error: %s\n", name_.c_str());
}
glBindTexture(GL_TEXTURE_2D, texture_id_);
}
void Texture::LoadFormFile(const std::string &path)
{
unsigned texture(0);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
int width, height, channels;
unsigned char *data = stbi_load(path.c_str(), &width, &height, &channels, 0);
if (data)
{
this->width_ = width;
this->height_ = height;
this->texture_id_ = texture;
if (channels > 3)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, data);
}
else
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, bits);
}
}
else
{
fprintf(stderr, "[Texture] Texture File Not Find or Not Support: %s\n", path.c_str());
}
stbi_image_free(data);
}
void Texture::LoadFormData(int width, int height, int channels, vector<unsigned char> &data)
{
unsigned texture(0);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
this->width_ = width;
this->height_ = height;
this->texture_id_ = texture;
if (channels > 3)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, &data[0]);
}
unsigned GLILoadCreateGLTexture(const string &file, bool srgb)
{
gli::texture Texture = gli::load(file.c_str());
if (Texture.empty())
return 0;
gli::gl GL(gli::gl::PROFILE_GL33);
gli::gl::format const Format = GL.translate(Texture.format(), Texture.swizzles());
GLenum Target = GL.translate(Texture.target());
GLuint TextureName = 0;
glGenTextures(1, &TextureName);
glBindTexture(Target, TextureName);
glTexParameteri(Target, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(Target, GL_TEXTURE_MAX_LEVEL, static_cast<GLint>(Texture.levels() - 1));
glTexParameteri(Target, GL_TEXTURE_SWIZZLE_R, Format.Swizzles[0]);
glTexParameteri(Target, GL_TEXTURE_SWIZZLE_G, Format.Swizzles[1]);
glTexParameteri(Target, GL_TEXTURE_SWIZZLE_B, Format.Swizzles[2]);
glTexParameteri(Target, GL_TEXTURE_SWIZZLE_A, Format.Swizzles[3]);
glm::tvec3<GLsizei> const Extent(Texture.extent());
GLsizei const FaceTotal = static_cast<GLsizei>(Texture.layers() * Texture.faces());
switch (Texture.target())
{
case gli::TARGET_1D:
glTexStorage1D(
Target, static_cast<GLint>(Texture.levels()), srgb ? GL_SRGB : Format.Internal, Extent.x);
break;
case gli::TARGET_1D_ARRAY:
case gli::TARGET_2D:
case gli::TARGET_CUBE:
glTexStorage2D(
Target, static_cast<GLint>(Texture.levels()), srgb ? GL_SRGB : Format.Internal,
Extent.x, Texture.target() != gli::TARGET_1D_ARRAY ? Extent.y : FaceTotal);
break;
case gli::TARGET_2D_ARRAY:
case gli::TARGET_3D:
case gli::TARGET_CUBE_ARRAY:
glTexStorage3D(
Target, static_cast<GLint>(Texture.levels()), srgb ? GL_SRGB : Format.Internal,
Extent.x, Extent.y,
Texture.target() == gli::TARGET_3D ? Extent.z : FaceTotal);
break;
default:
assert(0);
break;
}
for (std::size_t Layer = 0; Layer < Texture.layers(); ++Layer)
{
for (std::size_t Face = 0; Face < Texture.faces(); ++Face)
{
for (std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
GLsizei const LayerGL = static_cast<GLsizei>(Layer);
glm::tvec3<GLsizei> Extent(Texture.extent(Level));
Target = gli::is_target_cube(Texture.target())
? static_cast<GLenum>(GL_TEXTURE_CUBE_MAP_POSITIVE_X + Face)
: Target;
switch (Texture.target())
{
case gli::TARGET_1D:
if (gli::is_compressed(Texture.format()))
glCompressedTexSubImage1D(
Target, static_cast<GLint>(Level), 0, Extent.x,
srgb ? GL_SRGB : Format.Internal, static_cast<GLsizei>(Texture.size(Level)),
Texture.data(Layer, Face, Level));
else
glTexSubImage1D(
Target, static_cast<GLint>(Level), 0, Extent.x,
Format.External, Format.Type,
Texture.data(Layer, Face, Level));
break;
case gli::TARGET_1D_ARRAY:
case gli::TARGET_2D:
case gli::TARGET_CUBE:
if (gli::is_compressed(Texture.format()))
glCompressedTexSubImage2D(
Target, static_cast<GLint>(Level),
0, 0,
Extent.x,
Texture.target() == gli::TARGET_1D_ARRAY ? LayerGL : Extent.y,
srgb ? GL_SRGB : Format.Internal, static_cast<GLsizei>(Texture.size(Level)),
Texture.data(Layer, Face, Level));
else
glTexSubImage2D(
Target, static_cast<GLint>(Level),
0, 0,
Extent.x,
Texture.target() == gli::TARGET_1D_ARRAY ? LayerGL : Extent.y,
Format.External, Format.Type,
Texture.data(Layer, Face, Level));
break;
case gli::TARGET_2D_ARRAY:
case gli::TARGET_3D:
case gli::TARGET_CUBE_ARRAY:
if (gli::is_compressed(Texture.format()))
glCompressedTexSubImage3D(
Target, static_cast<GLint>(Level),
0, 0, 0,
Extent.x, Extent.y,
Texture.target() == gli::TARGET_3D ? Extent.z : LayerGL,
srgb ? GL_SRGB : Format.Internal, static_cast<GLsizei>(Texture.size(Level)),
Texture.data(Layer, Face, Level));
else
glTexSubImage3D(
Target, static_cast<GLint>(Level),
0, 0, 0,
Extent.x, Extent.y,
Texture.target() == gli::TARGET_3D ? Extent.z : LayerGL,
Format.External, Format.Type,
Texture.data(Layer, Face, Level));
break;
default:
assert(0);
break;
}
}
}
}
return TextureName;
}
} |
0fa0383a22efbd01d97ed01eb66fbba98caa36f1 | 37e0b5df87a990d5217d6b81747c068df1883212 | /LevelEditor/Layer.cpp | 4f61c95b9dc48ca6624014a886957b4141a64399 | [] | no_license | thekevinbutler/sfmlbox2d | 130cf0b3579d2665d9ce6420d4b1f4d5d031f417 | 78f30a33277c920bd33d33a9e9c7a4ad6ec33911 | refs/heads/master | 2021-05-01T23:52:19.112390 | 2017-01-04T15:01:59 | 2017-01-04T15:01:59 | 78,023,988 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,113 | cpp | Layer.cpp | #include "Layer.h"
Layer::Layer(sf::RenderWindow& pwindow) : window(pwindow)
{
hide = false;
}
void Layer::draw()
{
if (!hide)
{
for (std::vector<VisibleObject*>::iterator it = objs.begin(); it != objs.end(); ++it)
{
VisibleObject* curObj = *it;
window.draw(*curObj);
}
}
}
void Layer::addObj(VisibleObject* obj)
{
objs.emplace_back(obj);
}
VisibleObject* Layer::getObjectUnderCursor(sf::Vector2f pos)
{
for (std::vector<VisibleObject*>::iterator it = objs.begin(); it != objs.end(); ++it)
{
VisibleObject* curObj = *it;
if (curObj->occupiesPos(pos))
{
return curObj;
}
}
return NULL;
}
void Layer::removeObj(VisibleObject* objToRemove)
{
for (std::vector<VisibleObject*>::iterator it = objs.begin(); it != objs.end(); ++it)
{
VisibleObject* curObj = *it;
if (curObj == objToRemove)
{
objs.erase(it);
return;
}
}
}
bool Layer::save(std::ofstream& saveFile)
{
//save object count
saveFile << objs.size() << std::endl;
//for through obj vector and save each object
for (int i = 0; i < objs.size(); i++)
{
objs[i]->save(saveFile);
}
return true;
} |
7eb3621d40e8e33bb0eb77b285f0e2c5f9d48851 | 44ea47b42d0590d95109c03ecab03df3457b46ac | /TaskThread.cpp | 8f872b49776b20d7371c218af4de241105c69a86 | [
"LicenseRef-scancode-philippe-de-muyter"
] | permissive | heyker/epoll_threads | d5e3b3646bc88b9331815a3c3fb22e2b9025151b | 00ed037cc41b1fc069db95531fd48f746a331496 | refs/heads/master | 2020-03-15T11:42:19.888543 | 2016-12-28T12:59:02 | 2016-12-28T12:59:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,796 | cpp | TaskThread.cpp | #include "TaskThread.h"
TaskThread::TaskThread(int nCapacity)
: iEpoll(nCapacity)
{
m_ActiveConns = {0};
m_socket = new iSocket();
if (NULL == m_socket)
{
myepollLog(MY_WARNING, "new iSocket() err");
return;
}
}
TaskThread::~TaskThread()
{
if (NULL != m_socket)
{
delete m_socket;
m_socket = NULL;
}
}
void TaskThread::Run()
{
i_epoll_wait();
}
int TaskThread::GetActiveConns()
{
return m_ActiveConns.counter;
}
void TaskThread::IncrementActiveConns()
{
atomic_inc(&m_ActiveConns);
}
int TaskThread::iRead(int sockfd)
{
char sBuf[MIN_BUFSZ] = "";
int bytes = m_socket->recvn(sockfd, sBuf, sizeof(sBuf));
if (bytes <= 0)
{
myepollLog(MY_WARNING, "recv %d err, sockfd=%d", bytes, sockfd);
return -1;
}
myepollLog(MY_DEBUG, "Recv %d bytes, data=%s", bytes, sBuf);
i_epoll_change_mode(sockfd, I_EPOLL_WRITE, I_EPOLL_EDGE_TRIGGERED);
return 0;
}
int TaskThread::iWrite(int sockfd)
{
struct timeval t_timeval;
gettimeofday(&t_timeval, NULL);
char sBuf[MIN_BUFSZ] = "";
sprintf(sBuf, "Hi %d welcome %d", sockfd, (int)t_timeval.tv_usec);
int bytes = m_socket->sendn(sockfd, sBuf, strlen(sBuf));
if (bytes <= 0)
{
myepollLog(MY_WARNING, "send %d err, sockfd=%d", bytes, sockfd);
return -1;
}
i_epoll_change_mode(sockfd, I_EPOLL_READ, I_EPOLL_EDGE_TRIGGERED);
return 0;
}
int TaskThread::iError(int sockfd)
{
myepollLog(MY_WARNING, "Get an err(%s) on sockfd %d",
strerror(errno), sockfd);
return -1;
}
int TaskThread::iClose(int sockfd)
{
myepollLog(MY_DEBUG, "Client %d is closed", sockfd);
i_epoll_del(sockfd);
close(sockfd);
atomic_dec(&m_ActiveConns);
myepollLog(MY_DEBUG, "The totally of ActiveConns=%d",
m_ActiveConns.counter);
return 0;
}
int TaskThread::iTimeout(int sockfd)
{
return 0;
}
|
f0cf5beae5146ee454befc0608d81b9733f4ffb1 | 42fe59653d38f90be0d75ccebe40504e3096bc39 | /Core/Object3D.cpp | 74e8a350108d693eced3f692c343d0163a3d3c11 | [] | no_license | principal6/TessellationTest | 7072a973f39a60898647dfe9e8a54a35ef8d64fa | af42fb21ae2f158d280f736bc0293e8645d5aff9 | refs/heads/master | 2020-08-20T15:13:33.629747 | 2019-12-26T13:27:38 | 2019-12-26T13:27:38 | 216,037,243 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,611 | cpp | Object3D.cpp | #include "Object3D.h"
#include "Game.h"
using std::max;
using std::min;
using std::vector;
using std::string;
using std::to_string;
using std::make_unique;
void CObject3D::Create(const SMesh& Mesh)
{
m_Model.vMeshes.clear();
m_Model.vMeshes.emplace_back(Mesh);
m_Model.vMaterialData.clear();
m_Model.vMaterialData.emplace_back();
CreateMeshBuffers();
CreateMaterialTextures();
m_bIsCreated = true;
}
void CObject3D::Create(const SMesh& Mesh, const CMaterialData& MaterialData)
{
m_Model.vMeshes.clear();
m_Model.vMeshes.emplace_back(Mesh);
m_Model.vMaterialData.clear();
m_Model.vMaterialData.emplace_back(MaterialData);
CreateMeshBuffers();
CreateMaterialTextures();
m_bIsCreated = true;
}
void CObject3D::Create(const SModel& Model)
{
m_Model = Model;
CreateMeshBuffers();
CreateMaterialTextures();
m_bIsCreated = true;
}
void CObject3D::CreatePatches(size_t ControlPointCountPerPatch, size_t PatchCount)
{
assert(ControlPointCountPerPatch > 0);
assert(PatchCount > 0);
m_ControlPointCountPerPatch = ControlPointCountPerPatch;
m_PatchCount = PatchCount;
m_bIsPatch = true;
ShouldTessellate(true);
m_bIsCreated = true;
}
void CObject3D::AddMaterial(const CMaterialData& MaterialData)
{
m_Model.vMaterialData.emplace_back(MaterialData);
m_Model.vMaterialData.back().Index(m_Model.vMaterialData.size() - 1);
CreateMaterialTexture(m_Model.vMaterialData.size() - 1);
}
void CObject3D::SetMaterial(size_t Index, const CMaterialData& MaterialData)
{
assert(Index < m_Model.vMaterialData.size());
m_Model.vMaterialData[Index] = MaterialData;
m_Model.vMaterialData[Index].Index(Index);
CreateMaterialTexture(Index);
}
size_t CObject3D::GetMaterialCount() const
{
return m_Model.vMaterialData.size();
}
void CObject3D::CreateMeshBuffers()
{
m_vMeshBuffers.clear();
m_vMeshBuffers.resize(m_Model.vMeshes.size());
for (size_t iMesh = 0; iMesh < m_Model.vMeshes.size(); ++iMesh)
{
CreateMeshBuffer(iMesh);
}
}
void CObject3D::CreateMeshBuffer(size_t MeshIndex)
{
const SMesh& Mesh{ m_Model.vMeshes[MeshIndex] };
{
D3D11_BUFFER_DESC BufferDesc{};
BufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
BufferDesc.ByteWidth = static_cast<UINT>(sizeof(SVertex3D) * Mesh.vVertices.size());
BufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
BufferDesc.MiscFlags = 0;
BufferDesc.StructureByteStride = 0;
BufferDesc.Usage = D3D11_USAGE_DYNAMIC;
D3D11_SUBRESOURCE_DATA SubresourceData{};
SubresourceData.pSysMem = &Mesh.vVertices[0];
m_PtrDevice->CreateBuffer(&BufferDesc, &SubresourceData, &m_vMeshBuffers[MeshIndex].VertexBuffer);
}
{
D3D11_BUFFER_DESC BufferDesc{};
BufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
BufferDesc.ByteWidth = static_cast<UINT>(sizeof(STriangle) * Mesh.vTriangles.size());
BufferDesc.CPUAccessFlags = 0;
BufferDesc.MiscFlags = 0;
BufferDesc.StructureByteStride = 0;
BufferDesc.Usage = D3D11_USAGE_DEFAULT;
D3D11_SUBRESOURCE_DATA SubresourceData{};
SubresourceData.pSysMem = &Mesh.vTriangles[0];
m_PtrDevice->CreateBuffer(&BufferDesc, &SubresourceData, &m_vMeshBuffers[MeshIndex].IndexBuffer);
}
}
void CObject3D::CreateMaterialTextures()
{
m_vMaterialTextureSets.clear();
for (CMaterialData& MaterialData : m_Model.vMaterialData)
{
// @important
m_vMaterialTextureSets.emplace_back(make_unique<CMaterialTextureSet>(m_PtrDevice, m_PtrDeviceContext));
if (MaterialData.HasAnyTexture())
{
m_vMaterialTextureSets.back()->CreateTextures(MaterialData);
}
}
}
void CObject3D::CreateMaterialTexture(size_t Index)
{
if (Index == m_vMaterialTextureSets.size())
{
m_vMaterialTextureSets.emplace_back(make_unique<CMaterialTextureSet>(m_PtrDevice, m_PtrDeviceContext));
}
else
{
m_vMaterialTextureSets[Index] = make_unique<CMaterialTextureSet>(m_PtrDevice, m_PtrDeviceContext);
}
m_vMaterialTextureSets[Index]->CreateTextures(m_Model.vMaterialData[Index]);
}
void CObject3D::UpdateQuadUV(const XMFLOAT2& UVOffset, const XMFLOAT2& UVSize)
{
float U0{ UVOffset.x };
float V0{ UVOffset.y };
float U1{ U0 + UVSize.x };
float V1{ V0 + UVSize.y };
m_Model.vMeshes[0].vVertices[0].TexCoord = XMVectorSet(U0, V0, 0, 0);
m_Model.vMeshes[0].vVertices[1].TexCoord = XMVectorSet(U1, V0, 0, 0);
m_Model.vMeshes[0].vVertices[2].TexCoord = XMVectorSet(U0, V1, 0, 0);
m_Model.vMeshes[0].vVertices[3].TexCoord = XMVectorSet(U1, V1, 0, 0);
UpdateMeshBuffer();
}
void CObject3D::UpdateMeshBuffer(size_t MeshIndex)
{
D3D11_MAPPED_SUBRESOURCE MappedSubresource{};
if (SUCCEEDED(m_PtrDeviceContext->Map(m_vMeshBuffers[MeshIndex].VertexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedSubresource)))
{
memcpy(MappedSubresource.pData, &m_Model.vMeshes[MeshIndex].vVertices[0], sizeof(SVertex3D) * m_Model.vMeshes[MeshIndex].vVertices.size());
m_PtrDeviceContext->Unmap(m_vMeshBuffers[MeshIndex].VertexBuffer.Get(), 0);
}
}
void CObject3D::LimitFloatRotation(float& Value, const float Min, const float Max)
{
if (Value > Max) Value = Min;
if (Value < Min) Value = Max;
}
void CObject3D::UpdateWorldMatrix()
{
LimitFloatRotation(ComponentTransform.Pitch, CGame::KRotationMinLimit, CGame::KRotationMaxLimit);
LimitFloatRotation(ComponentTransform.Yaw, CGame::KRotationMinLimit, CGame::KRotationMaxLimit);
LimitFloatRotation(ComponentTransform.Roll, CGame::KRotationMinLimit, CGame::KRotationMaxLimit);
if (XMVectorGetX(ComponentTransform.Scaling) < CGame::KScalingMinLimit)
ComponentTransform.Scaling = XMVectorSetX(ComponentTransform.Scaling, CGame::KScalingMinLimit);
if (XMVectorGetY(ComponentTransform.Scaling) < CGame::KScalingMinLimit)
ComponentTransform.Scaling = XMVectorSetY(ComponentTransform.Scaling, CGame::KScalingMinLimit);
if (XMVectorGetZ(ComponentTransform.Scaling) < CGame::KScalingMinLimit)
ComponentTransform.Scaling = XMVectorSetZ(ComponentTransform.Scaling, CGame::KScalingMinLimit);
XMMATRIX Translation{ XMMatrixTranslationFromVector(ComponentTransform.Translation) };
XMMATRIX Rotation{ XMMatrixRotationRollPitchYaw(ComponentTransform.Pitch,
ComponentTransform.Yaw, ComponentTransform.Roll) };
XMMATRIX Scaling{ XMMatrixScalingFromVector(ComponentTransform.Scaling) };
// @important
float ScalingX{ XMVectorGetX(ComponentTransform.Scaling) };
float ScalingY{ XMVectorGetY(ComponentTransform.Scaling) };
float ScalingZ{ XMVectorGetZ(ComponentTransform.Scaling) };
float MaxScaling{ max(ScalingX, max(ScalingY, ScalingZ)) };
ComponentPhysics.BoundingSphere.Radius = ComponentPhysics.BoundingSphere.RadiusBias * MaxScaling;
XMMATRIX BoundingSphereTranslation{ XMMatrixTranslationFromVector(ComponentPhysics.BoundingSphere.CenterOffset) };
XMMATRIX BoundingSphereTranslationOpposite{ XMMatrixTranslationFromVector(-ComponentPhysics.BoundingSphere.CenterOffset) };
ComponentTransform.MatrixWorld = Scaling * BoundingSphereTranslationOpposite * Rotation * Translation * BoundingSphereTranslation;
}
void CObject3D::ShouldTessellate(bool Value)
{
m_bShouldTesselate = Value;
}
void CObject3D::TessellationType(ETessellationType eType)
{
m_eTessellationType = eType;
}
CObject3D::ETessellationType CObject3D::TessellationType() const
{
return m_eTessellationType;
}
void CObject3D::SetTessFactorData(const CObject3D::SCBTessFactorData& Data)
{
m_CBTessFactorData = Data;
}
const CObject3D::SCBTessFactorData& CObject3D::GetTessFactorData() const
{
return m_CBTessFactorData;
}
void CObject3D::SetDisplacementData(const CObject3D::SCBDisplacementData& Data)
{
m_CBDisplacementData = Data;
}
const CObject3D::SCBDisplacementData& CObject3D::GetDisplacementData() const
{
return m_CBDisplacementData;
}
CMaterialTextureSet* CObject3D::GetMaterialTextureSet(size_t iMaterial)
{
if (iMaterial >= m_vMaterialTextureSets.size()) return nullptr;
return m_vMaterialTextureSets[iMaterial].get();
}
void CObject3D::Draw(bool bIgnoreOwnTexture, bool bIgnoreInstances) const
{
if (IsPatches())
{
switch (m_ControlPointCountPerPatch)
{
default:
case 1:
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST);
break;
case 2:
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST);
break;
case 3:
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST);
break;
case 4:
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST);
break;
}
m_PtrDeviceContext->Draw((uint32_t)m_PatchCount, 0);
}
else
{
for (size_t iMesh = 0; iMesh < m_Model.vMeshes.size(); ++iMesh)
{
const SMesh& Mesh{ m_Model.vMeshes[iMesh] };
const CMaterialData& MaterialData{ m_Model.vMaterialData[Mesh.MaterialID] };
// per mesh
m_PtrGame->UpdateCBMaterialData(MaterialData);
if (MaterialData.HasAnyTexture() && !bIgnoreOwnTexture)
{
const CMaterialTextureSet* MaterialTextureSet{ m_vMaterialTextureSets[Mesh.MaterialID].get() };
MaterialTextureSet->UseTextures();
}
if (ShouldTessellate())
{
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST);
}
else
{
m_PtrDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
}
m_PtrDeviceContext->IASetIndexBuffer(m_vMeshBuffers[iMesh].IndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0);
m_PtrDeviceContext->IASetVertexBuffers(0, 1, m_vMeshBuffers[iMesh].VertexBuffer.GetAddressOf(),
&m_vMeshBuffers[iMesh].VertexBufferStride, &m_vMeshBuffers[iMesh].VertexBufferOffset);
m_PtrDeviceContext->DrawIndexed(static_cast<UINT>(Mesh.vTriangles.size() * 3), 0, 0);
}
}
} |
9854a8dd23f36d03128c4dde6f27c637ad53c604 | e23dcd67b653f263ff3037bc0ed7b93838891665 | /src/LogitWrapper.cpp | 1fa02367658c60aeb54a2b80f03a99d110c09410 | [] | no_license | cran/effectFusion | e809d4d15ebafe0a37c94ee9456c8ad53dbd0208 | 2a3e96c59cb25cbffd41d4ef1175a56389ed5c56 | refs/heads/master | 2021-10-26T17:33:08.468751 | 2021-10-13T20:10:05 | 2021-10-13T20:10:05 | 75,076,353 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,421 | cpp | LogitWrapper.cpp | // Copyright 2016 Nick Polson, James Scott, and Jesse Windle.
// Extracted from the R package "BayesLogit" (Version: 0.6).
////////////////////////////////////////////////////////////////////////////////
#ifdef USE_R
#include "R.h"
#include "Rmath.h"
#endif
#include "LogitWrapper.h"
#include "Logit.h"
#include "RNG.h"
#include "PolyaGamma.h"
#include "PolyaGammaAlt.h"
#include "PolyaGammaSP.h"
#include <exception>
#include <stdio.h>
using std::pow;
using std::fabs;
using std::sqrt;
using std::log;
using std::exp;
////////////////////////////////////////////////////////////////////////////////
// PolyaGamma //
////////////////////////////////////////////////////////////////////////////////
void rpg_hybrid(double *x, double *h, double *z, int* num)
{
RNG r;
PolyaGamma dv;
PolyaGammaAlt alt;
PolyaGammaSP sp;
#ifdef USE_R
GetRNGstate();
#endif
for(int i=0; i < *num; ++i){
double b = h[i];
if (b > 170) {
double m = dv.pg_m1(b,z[i]);
double v = dv.pg_m2(b,z[i]) - m*m;
x[i] = r.norm(m, sqrt(v));
}
else if (b > 13) {
sp.draw(x[i], b, z[i], r);
}
else if (b==1 || b==2) {
x[i] = dv.draw((int)b, z[i], r);
}
else if (b > 1) {
x[i] = alt.draw(b, z[i], r);
}
else if (b > 0) {
x[i] = dv.draw_sum_of_gammas(b, z[i], r);
}
else {
x[i] = 0.0;
}
}
#ifdef USE_R
PutRNGstate();
#endif
}
////////////////////////////////////////////////////////////////////////////////
// POSTERIOR INFERENCE //
////////////////////////////////////////////////////////////////////////////////
// Posterior by Gibbs.
//------------------------------------------------------------------------------
void gibbs(double *wp, double *betap, // Posterior
double *yp, double *tXp, double *np, // Data
double *m0p, double *P0p, // Prior
int *N, int *P, // Dim
int *samp, int *burn) // MCMC
{
// Set up data.
Matrix y (yp, *N, 1);
Matrix tX(tXp, *P, *N);
Matrix n (np, *N, 1);
Matrix m0(m0p, *P, 1);
Matrix P0(P0p, *P, *P);
// Declare posteriors.
Matrix w, beta;
// Random number generator.
RNG r;
#ifdef USE_R
GetRNGstate();
#endif
// Logit Gibbs
try{
Logit logit(y, tX, n);
logit.set_prior(m0, P0);
// logit.compress();
// Set the correct dimensions after combining data.
w.resize(logit.get_N(), 1, *samp);
beta.resize(logit.get_P(), 1, *samp);
MatrixFrame w_mf (wp , w.rows() , w.cols() , w.mats());
MatrixFrame beta_mf (betap, beta.rows(), beta.cols(), beta.mats());
// Copy values to test code. Must be using known value with correct dim.
// w.copy(w_mf);
// beta.copy(beta_mf);
// Run gibbs.
logit.gibbs(w, beta, *samp, *burn, r);
// Copy values to return.
w_mf.copy(w);
beta_mf.copy(beta);
// Adjust for combined data.
*N = w.rows();
}
catch (std::exception& e) {
Rprintf("Error: %s\n", e.what());
Rprintf("Aborting Gibbs sampler.\n");
}
#ifdef USE_R
PutRNGstate();
#endif
} // gibbs
////////////////////////////////////////////////////////////////////////////////
// combine_data
//------------------------------------------------------------------------------
void combine(double *yp, double *tXp, double *np, // Data
int *N, int *P)
{
// Set up data.
Matrix y (yp, *N, 1);
Matrix tX(tXp, *P, *N);
Matrix n (np, *N, 1);
// Logit Gibbs
try{
Logit logit(y, tX, n);
logit.compress();
logit.get_data(y, tX, n);
// Copy.
MatrixFrame y_mf (yp , y.rows(), y.cols(), y.mats());
MatrixFrame tX_mf (tXp, tX.rows(), tX.cols(), tX.mats());
MatrixFrame n_mf (np , n.rows(), n.cols(), n.mats());
y_mf.copy(y);
tX_mf.copy(tX);
n_mf.copy(n);
*N = tX.cols();
}
catch (std::exception& e) {
Rprintf("Error: %s\n", e.what());
Rprintf("Aborting combine.\n");
}
} // combine_data
|
c00cd6876baf2c7de0db576bc947711b5175e666 | d79248cc5ea3f89e456dac5fd4483d2d76ef88c4 | /atcoder/abc/abc002/d.cpp | 26a3486b0dabbeb4a3208825f1db7f371b511278 | [] | no_license | wheson/Competitive-programming | 70f7e6dd576f3db9433d293fc39852a6fa178c44 | 70212076a3013b6327367d03f580c6b9e57f2185 | refs/heads/master | 2021-06-25T15:15:54.365825 | 2019-04-21T13:47:39 | 2019-04-21T13:47:39 | 103,837,409 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,107 | cpp | d.cpp | #include <bits/stdc++.h>
//#define int long long
using namespace std;
using LL = long long;
using P = pair<int, int>;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<vector<bool>> friends(n, vector<bool>(n, false));
REP(i, m){
int a, b;
cin >> a >> b;
a--, b--;
friends[a][b] = true;
friends[b][a] = true;
}
int ans = 0;
for(int mask = 1; mask < (1 << n); mask++){
bool flag = true;
for(int i = 0; i < n; i++) if(mask & (1 << i)){
for(int j = 0; j < n; j++) if(i != j && mask & (1 << j)){
if(!friends[i][j]){
flag = false;
}
}
}
if(flag){
ans = max(ans, __builtin_popcount(mask));
}
}
cout << ans << endl;
}
|
7f6843e7afbb69e7e704c5ce51b67b9a04924648 | 17026d153b81b42dabf1ae277f4705c69dfdb52c | /src/YarpDev/YarpJointDev.h | 626c56e9a10fcd7db5cb5ac9489e8cc5635c4b95 | [] | no_license | cbm/NaoYARP | 080269a9b4798e2436f91dd63805c72a0afd4f84 | 02c82c5f23fcc12118fb89ee683014dc3cdad05a | refs/heads/master | 2021-01-23T08:39:07.901613 | 2012-06-21T13:46:25 | 2012-06-21T13:46:25 | 1,811,168 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 39,249 | h | YarpJointDev.h | /*
NaoYARP: a YARP interface for Aldebaran's Nao robot.
Copyright (C) 2011 Alexandros Paraschos <Alexandros.Paraschos@newport.ac.uk>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef YARPJOINTDEV_H
#define YARPJOINTDEV_H
#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/CartesianControl.h>
#include "NaoRobot/NaoJointChain.h"
#include <boost/smart_ptr.hpp>
class YarpJointDev :
public yarp::dev::DeviceDriver,
public yarp::dev::IPositionControl,
public yarp::dev::IControlLimits,
public yarp::dev::IEncoders,
public yarp::dev::IImpedanceControl,
public yarp::dev::ICartesianControl {
public:
YarpJointDev ();
virtual ~YarpJointDev();
virtual bool open ( yarp::os::Searchable& config );
virtual bool close();
/**@{ @name Methods inherit from IPositionControl */
/**
* Check if the current trajectory of all is terminated.
*
* Non blocking. Not implemented for Nao robot.
*
* @param flag pointer to return value.
* @return always false.
*/
virtual bool checkMotionDone ( bool* flag ) {
return false;
}
/**
* Check if the current trajectory of a single axis is terminated.
*
* Non blocking. Not implemented for Nao robot.
*
* @param flag pointer to return value.
* @return always false.
*/
virtual bool checkMotionDone ( int j, bool* flag ) {
return false;
}
/**
* Get the number of controlled axes.
*
* @param ax pointer to store the number.
* @return true, except if uninitialized
*/
virtual bool getAxes ( int* ax );
/**
* Get reference acceleration of a joint. Returns the acceleration used to
* generate the trajectory profile.
*
* Not implemented for Nao robot.
*
* @param j joint number
* @param acc pointer to storage for the return value
* @return always false.
*/
virtual bool getRefAcceleration ( int j, double* acc ) {
return false;
}
/**
* Get reference acceleration of all joints. These are the values used during the
* interpolation of the trajectory.
*
* Not implemented for Nao robot.
*
* @param accs pointer to the array that will store the acceleration values.
* @return always false.
*/
virtual bool getRefAccelerations ( double* accs ) {
return false;
}
/**
* Get reference speed for a joint. Returns the speed used to
* generate the trajectory profile.
*
* @note Speed as a fraction of the max speed of the joint.
* @todo Return speed in deg/s
*
*
* @param j joint number
* @param ref pointer to storage for the return value
* @return true/false on success or failure *
*/
virtual bool getRefSpeed ( int j, double* ref );
/**
* Get reference speed on all joints. These values are used during the
* interpolation of the trajectory.
*
* @note Speed as a fraction of the max speed of the joints.
* @todo Return speeds in deg/s
*
* @param spds pointer to the array of speed values.
* @return true/false upon success or failure
*/
virtual bool getRefSpeeds ( double* spds );
/**
* Set new reference point for a single axis.
*
* Blocking call.
*
* @param j joint number.
* @param ref specifies the new target point.
* @return true iff target is inside limits.
*/
virtual bool positionMove ( int j, double ref );
/**
* Set new reference point for all axes.
*
* Blocking call.
*
* @param refs array of new reference points.
* @return true iff target is inside limits.
*/
virtual bool positionMove ( const double* refs );
/**
* Set new reference point for a single axis,
* relative to current position.
*
* Blocking call.
*
* @param j joint number.
* @param delta specifies the new target point.
* @return true iff target is inside limits.
*/
virtual bool relativeMove ( int j, double delta );
/**
* Set new reference point for a all axes,
* relative to current position.
*
* Blocking call.
*
* @param deltas joint number.
* @param delta array of new reference points.
* @return true iff target is inside limits.
*/
virtual bool relativeMove ( const double* deltas );
/**
* Command is required by control boards implementing
* different control methods.
*
* @return Always false.
*/
virtual bool setPositionMode();
/**
* Set reference acceleration for a joint. This value is used during the
* trajectory generation.
*
* Not implemented for Nao robot.
*
* @param j joint number
* @param acc acceleration value
* @return always false.
*/
virtual bool setRefAcceleration ( int j, double acc ) {
return false;
}
/**
* Set reference acceleration on all joints. This is the value that is
* used during the generation of the trajectory.
*
* Not implemented for Nao robot.
*
* @param accs pointer to the array of acceleration values
* @return always false.
*/
virtual bool setRefAccelerations ( const double* accs ) {
return false;
}
/**
* Set reference speed for a joint, this is the speed used during the
* interpolation of the trajectory.
*
* @note Speed as a fraction of the max speed of the joint.
* @todo Set speed in deg/s
*
* @param j joint number
* @param sp speed value
* @return true/false upon success/failure
*/
virtual bool setRefSpeed ( int j, double sp );
/**
* Set reference speed on all joints. These values are used during the
* interpolation of the trajectory.
*
* @note Speed as a fraction of the max speed of the joint.
* @todo Set speed in deg/s
*
* @param spds pointer to the array of speed values.
* @return true/false upon success/failure
*/
virtual bool setRefSpeeds ( const double* spds );
/**
* Stop motion, all joints.
*
* Not implemented as all action calls are blocking.
*
* @todo Implement for cartesian space control?
*
* @return always false.
*/
virtual bool stop() {
return false;
}
/**
* Stop motion, single joint.
*
* Not implemented as all action calls are blocking.
*
* @todo Implement for Cartesian space control?
*
* @param j joint number
* @return always false.
*/
virtual bool stop ( int j ) {
return false;
}
/**@}*/
/**@{ @name Methods inherit from IControlLimits */
/**
* Get the software limits for a particular axis.
*
* Limits are read from NaoQi on initialization, and thus can not be set.
*
* @param axis joint number (not regarded as there is only one axis).
* @param pointer to store the value of the lower limit.
* @param pointer to store the value of the upper limit.
* @return always true.
*/
virtual bool getLimits ( int axis, double* min, double* max );
/**
* Set the software limits for a particular axis.
*
* Limits are read from NaoQi on initialization, and thus can not be set.
*
* @todo Set software limits
*
* @param axis joint number (not regarded as there is only one axis).
* @param min the value of the lower limit
* @param max the value of the upper limit
* @return always false.
*/
virtual bool setLimits ( int axis, double min, double max ) {
return false;
}
/**@}*/
/**@{ @name Methods inherit from IEncoders */
/// \todo what about getAxes from IEncoders?
/**
* Read the value of an encoder.
*
* @param j encoder number
* @param v pointer to storage for the return value
* @return true/false, upon success/failure (you knew it, uh?)
*/
virtual bool getEncoder ( int j, double* v );
/**
* Read the position of all axes.
*
* @param encs pointer to the array that will contain the output
* @return true/false on success/failure
*/
virtual bool getEncoders ( double* encs );
/**
* Read the instantaneous acceleration of an axis.
*
* Not implemented for Nao robot.
*
* @param j axis number.
* @param spds pointer to the array that will contain the output.
* @return always false.
*/
virtual bool getEncoderAcceleration ( int j, double* spds ) {
return false;
}
/**
* Read the instantaneous acceleration of all axes.
*
* Not implemented for Nao robot.
*
* @param accs pointer to the array that will contain the output.
* @return always false.
*/
virtual bool getEncoderAccelerations ( double* accs ) {
return false;
}
/**
* Read the instantaneous speed of an axis.
*
* Not implemented for Nao robot.
*
* @param j axis number
* @param sp pointer to storage for the output
* @return always false.
*/
virtual bool getEncoderSpeed ( int j, double* sp ) {
return false;
}
/**
* Read the instantaneous speed of all axes.
*
* Not implemented for Nao robot.
*
* @param spds pointer to storage for the output values
* @return always false.
*/
virtual bool getEncoderSpeeds ( double* spds ) {
return false;
}
/**
* Reset encoder, single joint. Set the encoder value to zero.
*
* Not implemented for Nao robot.
*
* @param j encoder number
* @return always false.
*/
virtual bool resetEncoder ( int j ) {
return false;
}
/**
* Reset encoders. Set the encoders value to zero.
*
* Not implemented for Nao robot.
*
* @return always false.
*/
virtual bool resetEncoders() {
return false;
}
/**
* Set the value of the encoder for a given joint.
*
* Not implemented for Nao robot.
*
* @param j encoder number.
* @param val new value.
* @return always false.
*/
virtual bool setEncoder ( int j, double val ) {
return false;
}
/**
* Set the value of all encoders.
*
* Not implemented for Nao robot.
*
* @param vals pointer to the new values.
* @return always false.
*/
virtual bool setEncoders ( const double* vals ) {
return false;
}
/**@}*/
/**@{ @name Methods inherit from IImpedanceControl */
//TODO what about getAxes from IImpedanceControl?
/**
* Get the current impedandance limits for a specific joint.
*
* @note Damping and offset parameters are not implemented for Nao.
*
* @param j joint number.
* @param min_stiff pointer to store min stiffness value. (not really used, set to 0)
* @param max_stiff pointer to store max stiffness value (not really used, set to 1).
* @param min_damp pointer to store damping value (not used, set to 0).
* @param max_damp pointer to store damping value (not used, set to 0).
* @return true on success, otherwise false.
*/
virtual bool getCurrentImpedanceLimit ( int j, double* min_stiff, double* max_stiff,
double* min_damp, double* max_damp );
/**
* Get current impedance gains (stiffness,damping,offset) for a specific joint.
*
* @note Damping and offset parameters are not implemented for Nao.
*
* @param j joint number.
* @param stiffness pointer to store stiffness value.
* @param damping pointer to store damping value (not used).
* @param offset pointer to store offset value (not used).
* @return true on success, otherwise false.
*/
virtual bool getImpedance ( int j, double* stiffness, double* damping );
/**
* Get current force Offset for a specific joint.
*
* @note Offset parameter is not implemented for Nao.
*
* @param j joint number.
* @param offset pointer to store offset value (not used).
* @return always false.
*/
virtual bool getImpedanceOffset ( int j, double* offset ) {
return false;
}
/**
* Set current impedance gains (stiffness,damping,offset) for a specific joint.
*
* @note Damping and offset parameters are not implemented for Nao.
*
* @param j joint number.
* @param stiffness stiffness value.
* @param damping damping value (not used).
* @param offset offset value (not used).
* @return true on success, otherwise false.
*/
virtual bool setImpedance ( int j, double stiffness, double damping );
/**
* Set current force Offset for a specific joint.
*
* @note Offset parameter is not implemented for Nao.
*
* @param j joint number.
* @param offset offset value (not used).
* @return always false.
*/
virtual bool setImpedanceOffset ( int j, double offset ) {
return false;
}
/**@}*/
/**@{ @name Methods inherit from ICartesianControl */
/**
* Ask for inverting a given pose without actually moving there.
*
* Not implemented for Nao.
*
* @param xd a 3-d vector which contains the desired
* position x,y,z (meters).
* @param od a 4-d vector which contains the desired
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians).
* @param xdhat a 3-d vector which is filled with the final
* position x,y,z (meters); it may differ from the
* commanded xd.
* @param odhat a 4-d vector which is filled with the final
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians); it may differ from
* the commanded od.
* @param qdhat the joints configuration through which the
* couple (xdhat,odhat) is achieved (degrees).
* @return always false.
*/
virtual bool askForPose ( const yarp::sig::Vector& xd,
const yarp::sig::Vector& od,
yarp::sig::Vector& xdhat,
yarp::sig::Vector& odhat,
yarp::sig::Vector& qdhat ) {
return false;
}
/**
* Ask for inverting a given pose without actually moving there.
*
* Not implemented for Nao.
*
* @param q0 a vector of length DOF which contains the starting
* joints configuration (degrees), made compatible with
* the chain.
* @param xd a 3-d vector which contains the desired
* position x,y,z (meters).
* @param od a 4-d vector which contains the desired
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians).
* @param xdhat a 3-d vector which is filled with the final
* position x,y,z (meters); it may differ from the
* commanded xd.
* @param odhat a 4-d vector which is filled with the final
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians); it may differ from
* the commanded od.
* @param qdhat the joints configuration through which the
* couple (xdhat,odhat) is achieved (degrees).
* @return always false.
*/
virtual bool askForPose ( const yarp::sig::Vector& q0,
const yarp::sig::Vector& xd,
const yarp::sig::Vector& od,
yarp::sig::Vector& xdhat,
yarp::sig::Vector& odhat,
yarp::sig::Vector& qdhat ) {
return false;
}
/**
* Ask for inverting a given position without actually moving there.
*
* Not implemented for Nao.
*
* @param xd a 3-d vector which contains the desired
* position x,y,z (meters).
* @param xdhat a 3-d vector which is filled with the final
* position x,y,z (meters); it may differ from the
* commanded xd.
* @param odhat a 4-d vector which is filled with the final
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians); it may differ from
* the commanded od.
* @param qdhat the joints configuration through which the
* couple (xdhat,odhat) is achieved (degrees).
* @return always false.
*/
virtual bool askForPosition ( const yarp::sig::Vector& q0,
const yarp::sig::Vector& xd,
yarp::sig::Vector& xdhat,
yarp::sig::Vector& odhat,
yarp::sig::Vector& qdhat ) {
return false;
}
/**
* Ask for inverting a given position without actually moving there.
*
* Not implemented for Nao.
*
* @param q0 a vector of length DOF which contains the starting
* joints configuration (degrees), made compatible with
* the chain.
* @param xd a 3-d vector which contains the desired
* position x,y,z (meters).
* @param xdhat a 3-d vector which is filled with the final
* position x,y,z (meters); it may differ from the
* commanded xd.
* @param odhat a 4-d vector which is filled with the final
* orientation using axis-angle representation xa, ya,
* za, theta (meters and radians); it may differ from
* the commanded od.
* @param qdhat the joints configuration through which the
* couple (xdhat,odhat) is achieved (degrees).
* @return always false.
*/
virtual bool askForPosition ( const yarp::sig::Vector& xd,
yarp::sig::Vector& xdhat,
yarp::sig::Vector& odhat,
yarp::sig::Vector& qdhat ) {
return false;
}
/**
* Get the actual desired pose and joints configuration as result
* of kinematic inversion.
*
* Blocking call.
*
* Not implemented for Nao.
*
* @param xdhat a 3-d vector which is filled with the actual
* desired position x,y,z (meters); it may differ from
* the commanded xd.
* @param odhat a 4-d vector which is filled with the actual
* desired orientation using axis-angle representation
* xa, ya, za, theta (meters and radians); it may differ
* from the commanded od.
* @param qdhat the joints configuration through which the
* couple (xdhat,odhat) is achieved (degrees).
* @return always false.
*/
virtual bool getDesired ( yarp::sig::Vector& xdhat,
yarp::sig::Vector& odhat,
yarp::sig::Vector& qdhat ) {
return false;
}
/**
* Get the current DOF configuration of the limb.
*
* @param curDof a vector which is filled with the actual DOF
* configuration.
* @return true/false on success/failure.
*
* @note The vector lenght is equal to the number of limb's
* joints; each vector's position is filled with 1 if the
* associated joint is controlled (i.e. it is an actuated
* DOF), 0 otherwise.
*/
virtual bool getDOF ( yarp::sig::Vector& curDof );
/**
* Return tolerance for in-target check.
*
* Not implemented on Nao robot.
*
* @param tol the memory location where tolerance is returned.
* @return always false.
*
* @note The trajectory is supposed to be completed as soon as
* norm(xd-end_effector)<tol.
*/
virtual bool getInTargetTol ( double* tol ) {
return false;
}
/**
* Return velocities of the end-effector in the task space.
*
* Not implemented on Nao robot.
*
*
* @param xdot the 3-d vector containing the derivative of x,y,z
* position [m/s] of the end-effector while moving in
* the task space as result of the commanded joints
* velocities.
* @param odot the 4-d vector containing the derivative of
* end-effector orientation [rad/s] while moving in
* the task space as result of the commanded joints
* velocities.
* @return always false.
*/
virtual bool getJointsVelocities ( yarp::sig::Vector& qdot ) {
return false;
}
// /**
// * Get the current range for the axis.
// *
// * @bug Redundant! Call IControlLimits::getLimits instead.
// *
// * @param axis joint index (regardless if it is actuated or
// * not).
// * @param min where the minimum value is returned [deg].
// * @param max where the maximum value is returned [deg].
// * @return true/false on success/failure.
// */
// virtual bool getLimits ( const int axis, double* min, double* max ) {
// return getLimits(const_cast<int>(axis), min, max );
// }
/**
* Get the current pose of the end-effector.
*
* @param x a 3-d vector which is filled with the actual
* position x,y,z (meters).
* @param od a 4-d vector which is filled with the actual
* orientation using axis-angle representation xa, ya, za, theta
* (meters and radians).
* @param stamp is ignored.
* @return true/false
*/
virtual bool getPose ( yarp::sig::Vector& x, yarp::sig::Vector& od, yarp::os::Stamp *stamp=NULL);
/**
* Get the current pose of the specified link belonging to the
* kinematic chain.
*
* Not implemented in Nao robot.
*
* @param axis joint index (regardless if it is actuated or not).
* @param x a 3-d vector which is filled with the actual position
* x,y,z (meters) of the given link reference frame.
* @param od a 4-d vector which is filled with the actual
* orientation of the given link reference frame using axis-angle
* representation xa, ya, za, theta (meters and radians).
* @return always false.
*/
virtual bool getPose ( const int axis, yarp::sig::Vector& x, yarp::sig::Vector& od, yarp::os::Stamp *stamp=NULL) {
return false;
}
/**
* Get the current joints rest position.
*
* Not implemented in Nao robot.
*
* @param curRestPos a vector which is filled with the current
* joints rest position components in degrees.
* @return always false.
*
* @note While solving the inverse kinematic, the user may
* specify a secondary task that minimizes against a joints
* rest position; further, each rest component may be
* weighted differently providing the weights vector.
*/
virtual bool getRestPos ( yarp::sig::Vector& curRestPos ) {
return false;
}
/**
* Get the current joints rest weights.
*
* Not implemented in Nao robot.
*
* @param curRestWeights a vector which is filled with the
* current joints rest weights.
* @return always false.
*
* @note While solving the inverse kinematic, the user may
* specify a secondary task that minimizes against a joints
* rest position; further, each rest component may be
* weighted differently providing the weights vector.
*/
virtual bool getRestWeights ( yarp::sig::Vector& curRestWeights ) {
return false;
}
/**
* Return joints velocities.
*
* Not implemented in Nao robot.
*
* @param qdot the vector containing the joints velocities
* [deg/s] sent to the robot by the controller.
* @return always false..
*/
virtual bool getTaskVelocities ( yarp::sig::Vector& xdot, yarp::sig::Vector& odot ) {
return false;
}
/**
* Get the current controller mode.
*
* @note Nao robot is always in, angle-space, tracking mode, via the Impedance
* mechanism.
*
*
* @param f is returned true (as the controller is always in tracking
* mode).
* @return always true.
*/
virtual bool getTrackingMode ( bool* f );
/**
* Get the current trajectory duration.
*
* @param t time (seconds).
* @return true/false on success/failure.
*/
virtual bool getTrajTime ( double* t );
/**
* Move the end-effector to a specified pose (position
* and orientation) in cartesian space.
*
* Non blocking call.
*
* @param xd a 3-d vector which contains the desired position
* x,y,z
* @param od a 4-d vector which contains the desired orientation
* using axis-angle representation (xa, ya, za, theta).
* @param t set the trajectory duration time (seconds). If t<=0
* (as by default) the current execution time is kept.
* @return true/false on success/failure.
*
* @note Intended for streaming mode.
*/
virtual bool goToPose ( const yarp::sig::Vector& xd, const yarp::sig::Vector& od, const double t = 0.0 );
/**
* Move the end-effector to a specified pose (position
* and orientation) in cartesian space.
*
* Blocking call.
*
* @param xd a 3-d vector which contains the desired position
* x,y,z (meters).
* @param od a 4-d vector which contains the desired orientation
* using axis-angle representation (xa, ya, za, theta).
* @param t set the trajectory duration time (seconds). If t<=0
* (as by default) the current execution time is kept.
* @return true/false on success/failure.
*/
virtual bool goToPoseSync ( const yarp::sig::Vector& xd, const yarp::sig::Vector& od, const double t = 0.0 );
/**
* Move the end-effector to a specified position in cartesian
* space, ignore the orientation.
*
* Non blocking call.
*
* @param xd a 3-d vector which contains the desired position
* x,y,z (meters).
* @param t set the trajectory duration time (seconds). If t<=0
* (as by default) the current execution time is kept.
* @return true/false on success/failure.
*
* @note Intended for streaming mode.
*/
virtual bool goToPosition ( const yarp::sig::Vector& xd, const double t = 0.0 );
/**
* Move the end-effector to a specified position in cartesian
* space, ignore the orientation.
*
* Blocking call.
*
* @param xd a 3-d vector which contains the desired position
* x,y,z (meters).
* @param t set the trajectory duration time (seconds). If t<=0
* (as by default) the current execution time is kept.
* @return true/false on success/failure.
*/
virtual bool goToPositionSync ( const yarp::sig::Vector& xd, const double t = 0.0 );
/**
* Restore the controller context previously stored.
*
* @param id specify the context id to be restored
* @return true/false on success/failure.
*
* @note The context comprises the values of internal controller
* variables, such as the tracking mode, the active dofs,
* the trajectory time and so on.
*/
virtual bool restoreContext ( const int id );
/**
* Set a new DOF configuration for the limb.
*
* Not implemented for Nao robot.
*
* @param newDof a vector which contains the new DOF
* configuration.
* @param curDof a vector where the DOF configuration is
* returned as it has been processed after the
* request (it may differ from newDof due to the
* presence of some internal limb's constraints).
* @return always false.
*
* @note Each vector's position shall contain 1 if the
* associated joint can be actuated, 0 otherwise. The
* special value 2 indicates that the joint status won't be
* modified (useful as a placeholder).
*/
virtual bool setDOF ( const yarp::sig::Vector& newDof, yarp::sig::Vector& curDof ) {
return false;
}
/**
* Set tolerance for in-target check.
*
* Not implemented for Nao robot.
*
* @param tol tolerance.
* @return always false.
*
* @note The trajectory is supposed to be completed as soon as
* norm(xd-end_effector)<tol.
*/
virtual bool setInTargetTol ( const double tol ) {
return false;
}
// /**
// * Set new range for the axis. Allowed range shall be a valid
// * subset of the real control limits.
// *
// * @bug Redundant! Call IControlLimits::getLimits instead.
// *
// * @param axis joint index (regardless it it is actuated or
// * not).
// * @param min the new minimum value [deg].
// * @param max the new maximum value [deg].
// * @return true/false on success/failure.
// */
// virtual bool setLimits ( const int axis, const double min, const double max ) {
// return setLimits( const_cast<int>(axis), const_cast<double>(min), const_cast<double>(max) );
// }
/**
* Set a new joints rest position.
*
* Not implemented for Nao robot.
*
* @param newRestPos a vector which contains the new joints rest
* position components in degrees.
* @param curRestPos a vector which is filled with the current
* joints rest position components in degrees as result
* from thresholding with joints bounds.
* @return always false.
*
* @note While solving the inverse kinematic, the user may
* specify a secondary task that minimizes against a joints
* rest position; further, each rest component may be
* weighted differently providing the weights vector.
*/
virtual bool setRestPos ( const yarp::sig::Vector& newRestPos, yarp::sig::Vector& curRestPos ) {
return false;
}
/**
* Set a new joints rest position.
*
* Not implemented for Nao robot.
*
* @param newRestWeights a vector which contains the new joints
* rest weights.
* @param curRestWeights a vector which is filled with the
* current joints rest weights as result from
* saturation (w>=0.0).
* @return always false.
*
* @note While solving the inverse kinematic, the user may
* specify a secondary task that minimizes against a joints
* rest position; further, each rest component may be
* weighted differently providing the weights vector.
*/
virtual bool setRestWeights ( const yarp::sig::Vector& newRestWeights, yarp::sig::Vector& curRestWeights ) {
return false;
}
/**
* Set the reference velocities of the end-effector in the task space.
*
* Not implemented for Nao robot.
*
* @param xdot the 3-d vector containing the x,y,z reference velocities
* [m/s] of the end-effector.
* @param odot the 4-d vector containing the orientation reference
* velocity [rad/s] of the end-effector.
* @return always false.
*/
virtual bool setTaskVelocities ( const yarp::sig::Vector& xdot, const yarp::sig::Vector& odot ) {
return false;
}
/**
* Set the controller in tracking or non-tracking mode.
*
* Nao's implementation supports only tracking mode!
*
* @param f true for tracking mode, false otherwise.
* @return always false.
*
* @note In tracking mode when the controller reaches the target,
* it keeps on running in order to maintain the limb in the
* desired pose. In non-tracking mode the controller
* releases the limb as soon as the desired pose is
* reached.
*/
virtual bool setTrackingMode ( const bool f ) {
return false;
}
/**
* Set the duration of the trajectory.
*
* @param t time in seconds.
* @return always true.
*/
virtual bool setTrajTime ( const double t );
/**
* Ask for an immediate stop motion.
* @return true/false on success/failure.
*
* @note The control is completely released, i.e. a direct switch
* to non-tracking mode is executed.
*/
virtual bool stopControl();
/**
* Store the controller context.
*
* @param id specify where to store the returned context id.
* @return true/false on success/failure.
*
* @note The context comprises the values of internal controller
* variables, such as the tracking mode, the active dofs,
* the trajectory time and so on.
*/
virtual bool storeContext ( int* id );
/**
* Wait until the current trajectory is terminated.
*
* @note In the current implementation the period is not
* used, but instead is using the NaoQi's proxy wait method.
*
* @param period specify the check time period (seconds).
* @param timeout specify the check expiration time (seconds). If
* timeout<=0 (as by default) the check will be performed
* without time limitation.
* @return true for success, false for failure and timeout
* expired.
*/
virtual bool waitMotionDone ( const double period = 0.1, const double timeout = 0.0 );
/**@}*/
private:
/**
* Converts axis-angle representation for orientation, into Euler
* angles.
*
* @param xa In axis-angle X-axis.
* @param ya In axis-angle Y-axis.
* @param za In axis-angle Z-axis.
* @param theta In axis-angle Theta.
*
* @param wx Out Euler representation X rotation.
* @param wy Out Euler representation Y rotation.
* @param wz Out Euler representation Z rotation.
*
* @note Assuming the angles are in radians.
*/
void AxisAngle_To_Euler ( const float& xa, const float& ya, const float& za, const float& theta,
float& wx, float& wy, float& wz );
/**
* Converts Euler angles describing orientation, into the
* Axis-angle representation.
*
* @param wx In Euler representation X rotation.
* @param wy In Euler representation Y rotation.
* @param wz In Euler representation Z rotation.
*
* @param xa Out axis-angle X-axis.
* @param ya Out axis-angle Y-axis.
* @param za Out axis-angle Z-axis.
* @param theta Out axis-angle Theta.
*
* @note Assuming the angles are in radians.
*/
void Euler_To_AxisAngle ( const float& wx, const float& wy, const float& wz,
float& xa, float& ya, float& za, float& theta );
/**
* Convenient conversion between two YARP vectors describing
* position and orientation to a single std vector containing both.
*
* The first representation is mostly used by the YARP Cartesian
* interfaces, while the second one, is used by Aldebaran.
*
* @note Parameter od can be empty. In that case the result will still
* be a 6D vector, but it will only contain position information. The rest
* positions will be filled with 0's.
*
* @note Assuming the angles are in radians.
*
* @param xd Yarp 3D vector with the position.
* @param od Yarp 4D vector with axis-angle representation (xa, ya, za, theta).
* @param pos Std 6D vector with position and Euler orientation representation
* (x,y,z,wx,wy,wz).
*
*
*/
void PosAxisAngle_To_PosEulerSingle ( const yarp::sig::Vector& xd,
const yarp::sig::Vector& od,
std::vector<float>& pos );
/**
* Convenient conversion between two YARP vectors describing
* position and orientation to a single std vector containing both.
*
* The first representation is mostly used by the YARP Cartesian
* interfaces, while the second one, is used by Aldebaran.
*
* @note Assuming the angles are in radians.
*
* @param pos Std 6D vector with position and Euler orientation representation
* (x,y,z,wx,wy,wz).
* @param xd returns Yarp 3D vector with the position.
* @param od returns Yarp 4D vector with axis-angle representation (xa, ya, za, theta).
*/
void PosEulerSingle_To_PosAxisAngle ( const std::vector<float>& pos,
yarp::sig::Vector& xd,
yarp::sig::Vector& od );
boost::shared_ptr<NaoJointChain> _chain;
std::vector<double> _refSpeeds;
double _maxRefSpeed; //used for chain angle-space ctl.
double _trajTime;
/**
* Returns useful info on the operating state of the controller.
* [wait for reply]
* @param info is a property-like bottle containing the info.
* @return always return false, FIXME!
*/
virtual bool getInfo(yarp::os::Bottle &info){
return false;
}
/**
* Register an event.
* @param event the event to be registered.
* @return always return false, FIXME!
*
* @note the special type "*" can be used to attach a callback to
* all the available events.
*/
virtual bool registerEvent(yarp::dev::CartesianEvent &event){
return false;
}
/**
* Unregister an event.
* @param event the event to be unregistered.
* @return @return always return false, FIXME!.
*/
virtual bool unregisterEvent(yarp::dev::CartesianEvent &event){
return false;
}
};
#endif // YARPJOINTDEV_H
|
741b2f54db5b30a9f3d942a85f7a0c4657fd846e | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/third_party/WebKit/Source/core/svg/SVGElementRareData.h | 91a69d938c546e7b605f79568fd1f6a07812d4fe | [
"LGPL-2.0-only",
"BSD-2-Clause",
"LGPL-2.1-only",
"MIT",
"BSD-3-Clause",
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"Apache-2.0"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 4,820 | h | SVGElementRareData.h | /*
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGElementRareData_h
#define SVGElementRareData_h
#include "core/css/StylePropertySet.h"
#include "core/css/resolver/StyleResolver.h"
#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
#include "wtf/StdLibExtras.h"
namespace WebCore {
class CSSCursorImageValue;
class SVGCursorElement;
class SVGElement;
class SVGElementInstance;
class SVGElementRareData {
WTF_MAKE_NONCOPYABLE(SVGElementRareData); WTF_MAKE_FAST_ALLOCATED;
public:
SVGElementRareData()
: m_cursorElement(0)
, m_cursorImageValue(0)
, m_correspondingElement(0)
, m_instancesUpdatesBlocked(false)
, m_useOverrideComputedStyle(false)
, m_needsOverrideComputedStyleUpdate(false)
{
}
typedef HashMap<const SVGElement*, SVGElementRareData*> SVGElementRareDataMap;
static SVGElementRareDataMap& rareDataMap()
{
DEFINE_STATIC_LOCAL(SVGElementRareDataMap, rareDataMap, ());
return rareDataMap;
}
static SVGElementRareData* rareDataFromMap(const SVGElement* element)
{
return rareDataMap().get(element);
}
HashSet<SVGElementInstance*>& elementInstances() { return m_elementInstances; }
const HashSet<SVGElementInstance*>& elementInstances() const { return m_elementInstances; }
bool instanceUpdatesBlocked() const { return m_instancesUpdatesBlocked; }
void setInstanceUpdatesBlocked(bool value) { m_instancesUpdatesBlocked = value; }
SVGCursorElement* cursorElement() const { return m_cursorElement; }
void setCursorElement(SVGCursorElement* cursorElement) { m_cursorElement = cursorElement; }
SVGElement* correspondingElement() { return m_correspondingElement; }
void setCorrespondingElement(SVGElement* correspondingElement) { m_correspondingElement = correspondingElement; }
CSSCursorImageValue* cursorImageValue() const { return m_cursorImageValue; }
void setCursorImageValue(CSSCursorImageValue* cursorImageValue) { m_cursorImageValue = cursorImageValue; }
MutableStylePropertySet* animatedSMILStyleProperties() const { return m_animatedSMILStyleProperties.get(); }
MutableStylePropertySet* ensureAnimatedSMILStyleProperties()
{
if (!m_animatedSMILStyleProperties)
m_animatedSMILStyleProperties = MutableStylePropertySet::create(SVGAttributeMode);
return m_animatedSMILStyleProperties.get();
}
void destroyAnimatedSMILStyleProperties()
{
m_animatedSMILStyleProperties.clear();
}
RenderStyle* overrideComputedStyle(Element* element, RenderStyle* parentStyle)
{
ASSERT(element);
if (!m_useOverrideComputedStyle)
return 0;
if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) {
// The style computed here contains no CSS Animations/Transitions or SMIL induced rules - this is needed to compute the "base value" for the SMIL animation sandwhich model.
m_overrideComputedStyle = element->document().ensureStyleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);
m_needsOverrideComputedStyleUpdate = false;
}
ASSERT(m_overrideComputedStyle);
return m_overrideComputedStyle.get();
}
bool useOverrideComputedStyle() const { return m_useOverrideComputedStyle; }
void setUseOverrideComputedStyle(bool value) { m_useOverrideComputedStyle = value; }
void setNeedsOverrideComputedStyleUpdate() { m_needsOverrideComputedStyleUpdate = true; }
private:
HashSet<SVGElementInstance*> m_elementInstances;
SVGCursorElement* m_cursorElement;
CSSCursorImageValue* m_cursorImageValue;
SVGElement* m_correspondingElement;
bool m_instancesUpdatesBlocked : 1;
bool m_useOverrideComputedStyle : 1;
bool m_needsOverrideComputedStyleUpdate : 1;
RefPtr<MutableStylePropertySet> m_animatedSMILStyleProperties;
RefPtr<RenderStyle> m_overrideComputedStyle;
};
}
#endif
|
431cbd9637101380047cdbc64cc4c21108b73cf2 | f38352736856c6ed18267be24e3e89e476e76c45 | /1152.cpp | 4ad95aa6cbf51b5c607178d27d34f02e99b97f8b | [] | no_license | qornwh/BOJ | 5e01d489f17426734fd6fdbc604bb13e64e079e0 | b04d3e3b268e9f0c99631eeb980c1fbb9a648738 | refs/heads/main | 2023-08-04T21:03:38.131493 | 2021-09-25T11:08:17 | 2021-09-25T11:08:17 | 302,886,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 514 | cpp | 1152.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main(){
string str;
char tick = false;
int counter = 0;
int len;
getline(cin, str);
len = str.length();
for(int i=0; i<len; i++){
if(str.at(i) != ' '){
if(!tick){
counter++;
tick = true;
}
}
else if(str.at(i) == ' '){
if(tick){
tick = false;
}
}
}
cout << counter;
return 0;
} |
a093c7104c57ffe03bb45e15411b6988cc98fb06 | e711039670ac74a8e8abd55874815794f5b812b0 | /include/DeleteNode.hpp | d131505f33aedfdaf41f02c787550e7540498887 | [] | no_license | proudzhu/leetcode | 1e08ffd0a7197722f7b954c2884c3d8a824c0f9e | e0c9788e6b26f3cdc98f080f22217412d09ac7ee | refs/heads/master | 2022-09-24T02:40:23.405383 | 2022-09-05T12:22:45 | 2022-09-05T12:22:45 | 44,177,044 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 115 | hpp | DeleteNode.hpp | #ifndef _DELETENODE_HPP
#define _DELETENODE_HPP
#include "ListNode.hpp"
void deleteNode(ListNode *node);
#endif
|
7783bcc9e90403f15f4dc708b3ed031ec993e25b | d23001042eb0c91e2380dd2582285166e95e7d62 | /SDL2/controlUnits.cpp | 57b4aeab7877207281233ef6774c9f713b7f3a04 | [] | no_license | vasilevx/wow-game | 63712933391286573c727f3e8c48392aa6c0e565 | 4e7b91a4e7650d834c19f86efc36b3303fa98ef6 | refs/heads/master | 2021-09-02T06:41:44.914026 | 2017-12-31T03:42:18 | 2017-12-31T03:42:18 | 115,257,404 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,393 | cpp | controlUnits.cpp | #include "controlUnits.h"
controlUnits::controlUnits() : keyControl(0) {}
void controlUnits::show(){
move(keyControl);
//контроль выхода за границы окна
if(dest.x > (W_WIDTH - dest.w))
dest.x = (W_WIDTH - dest.w);
else if(dest.x < 0) dest.x = 0;
SDL_RenderCopy(ren, texture, NULL, &dest);
}
void controlUnits::move(char flag){
if (flag == 'r')
dest.x += 5;
if (flag == 'l')
dest.x -= 5;
if (flag == 'f')
dest.y -= 20;
}
int controlUnits::KeyEvent (SDL_KeyboardEvent & event){
if(event.type==SDL_KEYDOWN || event.type == SDL_TEXTINPUT) {
if(event.keysym.sym==SDLK_LEFT){
mouseControl = 0;
keyControl = 'l';
}
if(event.keysym.sym==SDLK_RIGHT){
mouseControl = 0;
keyControl = 'r';
}
if(event.keysym.sym==SDLK_SPACE){
keyControl = 'f';
}
return 1;
}
else if(event.type == SDL_KEYUP){
if(event.keysym.sym==SDLK_LEFT || event.keysym.sym==SDLK_RIGHT){
keyControl = 0;
}
}
return 0;
}
int controlUnits::MouseMotionEvent(SDL_MouseMotionEvent & motion, int x) {
mouseControl = 1;
keyControl = 0;
if (x > (dest.x + dest.w / 2))
move('r');
if (x < (dest.x + dest.w / 2))
move('l');
return 0;
}
int controlUnits::MouseButtonEvent(SDL_MouseButtonEvent & button) {
return 0;
}
|
d45e14122c6ab0e864f2cf3a00ea2667a619cb7d | 20bb9978f57e452e7ee3b28f785c7201aeb1f1e7 | /DT_Scales.ino | 6922eefe28ffa0c9817b53f3c1b0dd5b5e89a4c2 | [] | no_license | oliverh57/DT_Scales | 3c1c98eef930a1d02afd85db83b63cd179a920a3 | 008fd536c39f7f94237b263f9f5a30afa192508c | refs/heads/master | 2020-04-15T05:19:15.115233 | 2019-01-23T08:55:25 | 2019-01-23T08:55:25 | 164,416,720 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,069 | ino | DT_Scales.ino | #include "HX711.h" //include lib for scale ADC
HX711 scale(7,8); //initiate scale on pins 7 &
#include <LCD.h> //include LCD libs
#include <LiquidCrystal_I2C.h> //i2c LIB for LCD
#define I2C_ADDR 0x27 // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //Decalre LCD
void lcdREFRESH(){
lcd.clear(); //refresh lcd
lcd.setCursor(1, 0);// set lcd to "home"
}
//TEAR
#define tear_pin 10 //pin for tear button
int tear_offset = 0; //declare the tear veriable as a global
int read_scale_adjusted(bool tear){ //return the adjusteed readering of the scale
//int RAW_read = scale.read(); //read the scale for procesing later
//int MAP_read = (RAW_read+198729);
//MAP_read = MAP_read/-369;
int MAP_read = map(scale.read(), -196601.7354, -208234.47, 0, 41);
delay(100);
if(tear == true){
return(MAP_read+tear_offset);
}else{
return(MAP_read);
}
}
//FOODS
String foods[3] = {"Flower ", "Eggs ", "Suggar3 "};
//SHIFT REGISTER
#define SER 6 // data in
#define SRCLK 5 // shift register clock
#define SRCLR 4 // clear shift register
#define RCLK 3 // storage register
// clear the shift registers without affecting the storage registers.
void clearShiftRegisters() {
digitalWrite(SRCLR,LOW);
digitalWrite(SRCLR,HIGH);
}
// All the data in the shift registers moves over 1 unit and the new data goes in at shift register 0.
// The data that was in the shift register 7 goes to the next register (if any).
void shiftDataIn(int data) {
digitalWrite(SER,data);
digitalWrite(SRCLK,HIGH);
digitalWrite(SRCLK,LOW);
}
// copy the 8 shift registers into the shift registers,
// which changes the output voltage of the pins.
void copyShiftToStorage() {
digitalWrite(RCLK,HIGH);
digitalWrite(RCLK,LOW);
}
//output two numbers to the shift registers.
void outputLED(int v1, int v2){
clearShiftRegisters();
for (int i = 0; i < 10; i++){
if(v1>0){
shiftDataIn(1);
v1=v1-1;
}else{
shiftDataIn(0);
}
}
for (int i = 0; i < 10; i++){
if(v2>0){
shiftDataIn(1);
v2=v2-1;
}else{
shiftDataIn(0);
}
}
copyShiftToStorage();
}//end outputLED
//ROTARY ENCODER
#define DT 2 //pin for rot encoder
#define CLK 9 //pin for rot encoder
unsigned short int encoder0POS = 0; //value for rot encoder mode A
volatile bool turndetected;
volatile bool up;
void encoderisr () {
turndetected = true;
up = (digitalRead(CLK) == digitalRead(DT));
}
void encoderREFRESH(){ //function to update encoder
if (turndetected) {//if isr flag is set
if(up){
encoder0POS++;
}else{
encoder0POS--;
}
turndetected = false; //rest isr flag
#if defined(SERIAL_DEBUG)
Serial.println("ENCODER REFRESHED");
#endif
}
}//end encoderREFRESH
void setup() {
pinMode(13, OUTPUT);
lcd.begin(16, 2); //begin LCD
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);// Switch on the backlight
lcd.setBacklight(HIGH);
lcd.home(); // go home
pinMode(SER,OUTPUT);
pinMode(SRCLK,OUTPUT);
pinMode(SRCLR,OUTPUT);
pinMode(RCLK,OUTPUT);
pinMode(tear_pin, INPUT_PULLUP);
clearShiftRegisters();
lcdREFRESH();//clear LCD
tear_offset = 0 - read_scale_adjusted(false);
Serial.begin(9600);
attachInterrupt (digitalPinToInterrupt(2),encoderisr,FALLING); //rotary encoder isr
}
void loop() {
encoderREFRESH();//refresh encoder
//outputLED(map(read_scale_adjusted(true), 0, 50,0,10), 5);
outputLED(10,10);
char msg[21];
lcd.setCursor(0, 0);// Next line
lcd.print("Food: " + foods[encoder0POS % 3]);
sprintf(msg, "Mass: %-7d", encoder0POS);
lcd.setCursor(0, 1);// Next line
lcd.print(msg);
if(digitalRead(tear_pin) == LOW){//if the tear button has been pressed
tear_offset = 0 - read_scale_adjusted(false);
digitalWrite(13,HIGH);
}
}
|
ff3422a24463017c5534c87083e9fd5ced4e5670 | 2d05050d0ada29f7680b4df20c10bb85b0530e45 | /include/tvm/runtime/container/adt.h | 013a055bd003ce5c16e460088ee9066f39c59c89 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"Zlib",
"LLVM-exception",
"BSD-2-Clause"
] | permissive | apache/tvm | 87cb617f9a131fa44e1693303aaddf70e7a4c403 | d75083cd97ede706338ab413dbc964009456d01b | refs/heads/main | 2023-09-04T11:24:26.263032 | 2023-09-04T07:26:00 | 2023-09-04T07:26:00 | 70,746,484 | 4,575 | 1,903 | Apache-2.0 | 2023-09-14T19:06:33 | 2016-10-12T22:20:28 | Python | UTF-8 | C++ | false | false | 4,290 | h | adt.h | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 tvm/runtime/container/adt.h
* \brief Runtime ADT container types.
*/
#ifndef TVM_RUNTIME_CONTAINER_ADT_H_
#define TVM_RUNTIME_CONTAINER_ADT_H_
#include <utility>
#include <vector>
#include "./base.h"
namespace tvm {
namespace runtime {
/*! \brief An object representing a structure or enumeration. */
class ADTObj : public Object, public InplaceArrayBase<ADTObj, ObjectRef> {
public:
/*! \brief The tag representing the constructor used. */
int32_t tag;
/*! \brief Number of fields in the ADT object. */
uint32_t size;
// The fields of the structure follows directly in memory.
static constexpr const uint32_t _type_index = TypeIndex::kRuntimeADT;
static constexpr const char* _type_key = "runtime.ADT";
TVM_DECLARE_FINAL_OBJECT_INFO(ADTObj, Object);
private:
/*!
* \return The number of elements in the array.
*/
size_t GetSize() const { return size; }
/*!
* \brief Initialize the elements in the array.
*
* \tparam Iterator Iterator type of the array.
* \param begin The begin iterator.
* \param end The end iterator.
*/
template <typename Iterator>
void Init(Iterator begin, Iterator end) {
size_t num_elems = std::distance(begin, end);
this->size = 0;
auto it = begin;
for (size_t i = 0; i < num_elems; ++i) {
InplaceArrayBase::EmplaceInit(i, *it++);
// Only increment size after the initialization succeeds
this->size++;
}
}
friend class ADT;
friend InplaceArrayBase<ADTObj, ObjectRef>;
};
/*! \brief reference to algebraic data type objects. */
class ADT : public ObjectRef {
public:
/*!
* \brief construct an ADT object reference.
* \param tag The tag of the ADT object.
* \param fields The fields of the ADT object.
*/
ADT(int32_t tag, std::vector<ObjectRef> fields) : ADT(tag, fields.begin(), fields.end()){};
/*!
* \brief construct an ADT object reference.
* \param tag The tag of the ADT object.
* \param begin The begin iterator to the start of the fields array.
* \param end The end iterator to the end of the fields array.
*/
template <typename Iterator>
ADT(int32_t tag, Iterator begin, Iterator end) {
size_t num_elems = std::distance(begin, end);
auto ptr = make_inplace_array_object<ADTObj, ObjectRef>(num_elems);
ptr->tag = tag;
ptr->Init(begin, end);
data_ = std::move(ptr);
}
/*!
* \brief construct an ADT object reference.
* \param tag The tag of the ADT object.
* \param init The initializer list of fields.
*/
ADT(int32_t tag, std::initializer_list<ObjectRef> init) : ADT(tag, init.begin(), init.end()){};
/*!
* \brief Access element at index.
*
* \param idx The array index
* \return const ObjectRef
*/
const ObjectRef& operator[](size_t idx) const { return operator->()->operator[](idx); }
/*!
* \brief Return the ADT tag.
*/
int32_t tag() const { return operator->()->tag; }
/*!
* \brief Return the number of fields.
*/
size_t size() const { return operator->()->size; }
/*!
* \brief Construct a tuple object.
*
* \tparam Args Type params of tuple feilds.
* \param args Tuple fields.
* \return ADT The tuple object reference.
*/
template <typename... Args>
static ADT Tuple(Args&&... args) {
return ADT(0, std::forward<Args>(args)...);
}
TVM_DEFINE_OBJECT_REF_METHODS(ADT, ObjectRef, ADTObj);
};
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_CONTAINER_ADT_H_
|
97652cf8b4e271b06b6b45ebe0744eca04b5cd6f | 9c56a1548ee24fa679b831bca5e796fa86dbb583 | /baekjoon/23295/source.cpp | 7593c83364a461c5ab4ad22cc69fb8ea9a4c7282 | [
"CC-BY-4.0",
"CC-BY-3.0"
] | permissive | qilip/ACMStudy | 1a006f759d52dc6afbb0cd4b6c2060a8bf5377d8 | da7361b09a4519b3c721d54cd6df6ff00337fa27 | refs/heads/master | 2023-04-21T17:50:52.806789 | 2023-04-10T17:39:57 | 2023-04-10T17:39:57 | 124,194,483 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 923 | cpp | source.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
int n, t;
int add[10'0010] = {0};
int sub[10'0010] = {0};
scanf("%d %d", &n, &t);
for(int i=0;i<n;i++){
int k;
scanf("%d", &k);
for(int j=0;j<k;j++){
int a, b;
scanf("%d %d", &a, &b);
add[a]++;
sub[b]++;
}
}
int stu[10'0010] = {0};
ll ans = 0;
pair<int, int> ans_time = {0, 0};
ll cur = 0;
stu[0] = add[0] - sub[0];
for(int i=1;i<=100000;i++){
stu[i] = stu[i-1] + add[i] - sub[i];
}
for(int i=0;i<t;i++) cur += stu[i];
ans = cur;
ans_time = {0, t};
for(int i=t;i<=100000;i++){
cur += stu[i] - stu[i-t];
if(cur > ans){
ans = cur;
ans_time = {i-t+1, i+1};
}
}
printf("%d %d", ans_time.first, ans_time.second);
return 0;
}
|
4d22433d9dfa56ce1a534d067b3fafcdea6b7e52 | 79eb83cc3e7f4324ad3f7e56f094384ee494a7a9 | /User/AchieveLayer.h | 94f011a7e8ac28fcc76b67d875262d1fbae7b327 | [] | no_license | JiaoMing/Blackcat | 4a32ab2ec1abc356a4494ec9177ad0b3128d575b | 95fa6f74429ead752741cbff3debca8bb0cbdb6e | refs/heads/master | 2020-04-15T11:08:28.111536 | 2014-11-13T08:40:57 | 2014-11-13T08:40:57 | 30,082,134 | 0 | 4 | null | 2015-01-30T17:10:54 | 2015-01-30T17:10:53 | null | UTF-8 | C++ | false | false | 958 | h | AchieveLayer.h | //
// AchieveLayer.h
// Blackcat
//
// Created by haojunhua on 14-5-30.
//
//
#ifndef __Blackcat__AchieveLayer__
#define __Blackcat__AchieveLayer__
#include "DialogLayer.h"
#include "resource.h"
#include "cocos-ext.h"
USING_NS_CC_EXT;
class AchieveLayer : public DialogLayer, public CCTableViewDataSource, public CCTableViewDelegate
{
public:
virtual bool init();
CREATE_FUNC(AchieveLayer);
virtual void enableTouch();
virtual void scrollViewDidScroll(CCScrollView* view) {};
virtual void scrollViewDidZoom(CCScrollView* view) {};
virtual void tableCellTouched(CCTableView* table, CCTableViewCell* cell);
virtual CCSize cellSizeForTable(CCTableView *table);
virtual CCTableViewCell* tableCellAtIndex(CCTableView *table, unsigned int idx);
virtual unsigned int numberOfCellsInTableView(CCTableView *table);
private:
CCTableView* m_pTableView;
};
#endif /* defined(__Blackcat__AchieveLayer__) */
|
ea874365579bdf7aaba7e7fa912e694a3d6ff964 | 642742cd1138f8e0fd9bb19271af676d1ae5facc | /core/optimization/gradientBased/SecondOrderTrustRegion.h | ab6728af00d9f031b7cfd1432be7d270229af3e1 | [] | no_license | cvjena/nice-core | d64f3b1b873047eb383ad116323f3f8617978886 | d9578e23f5f9818e7c777f6976eab535b74dc62f | refs/heads/master | 2021-01-20T05:32:01.068843 | 2019-02-01T16:17:13 | 2019-02-01T16:17:13 | 3,012,683 | 4 | 4 | null | 2018-10-22T20:37:52 | 2011-12-19T15:01:13 | C++ | UTF-8 | C++ | false | false | 1,995 | h | SecondOrderTrustRegion.h | /*
* NICE-Core - efficient algebra and computer vision methods
* - liboptimization - An optimization/template for new NICE libraries
* See file License for license information.
*/
/*****************************************************************************/
#ifndef _SECONDORDERTRUSTREGION_OPTIMIZATION_H
#define _SECONDORDERTRUSTREGION_OPTIMIZATION_H
#include <iostream>
#include <core/basics/NonCopyable.h>
#include <core/optimization/gradientBased/OptimizationAlgorithmSecond.h>
#include <core/optimization/gradientBased/TrustRegionBase.h>
namespace NICE {
/**
* A second order trust region algorithm.
* Notation as in Ferid Bajramovic: Kernel-basierte Objektverfolgung,
* Master's thesis (Diplomarbeit),
* Computer Science Department, University Passau
*
* \ingroup optimization_algorithms
*/
class SecondOrderTrustRegion : public OptimizationAlgorithmSecond,
public TrustRegionBase {
public:
SecondOrderTrustRegion(double typicalGradient = 0.1)
: TrustRegionBase(typicalGradient), kappa(0.1),
epsilonLambda(1E5 * epsilonM), maxSubIterations(150),
tolerance(1E-14) {}
virtual ~SecondOrderTrustRegion();
/**
* Set epsilonLambda relative to epsilonM
*/
inline void setEpsilonLambdaRelative(double factor) {
epsilonLambda = factor * epsilonM;
}
/**
* Set epsilonLambda
*/
inline void setEpsilonLambdaAbsolute(double newValue) {
epsilonLambda = newValue;
}
protected:
virtual void doOptimize(OptimizationProblemSecond& problem);
private:
//! \f$\kappa\f$
double kappa;
//! \f$\epsilon_{\lambda}\f$
double epsilonLambda;
unsigned int maxSubIterations;
double tolerance;
/**
* Compute the initial trust region radius.
*/
double computeInitialDelta(const Vector& gradient,
const Matrix& hessian);
};
}; // namespace NICE
#endif /* _SECONDORDERTRUSTREGION_OPTIMIZATION_H */
|
9a85a989d8acd49785e80ea8d53931b482cc683d | 3db233d14bc4f9f350db3b69a7b18ee287381813 | /BinarySearchTree/bst.cpp | 4d53b6ee93667014a5252defda5644726abede25 | [] | no_license | pinakdas163/CPP-Projects | e6f5d2d7403f220860d399c0c75213ecbad12553 | 08981f3894225d7f591d051ce9b749191f343aa1 | refs/heads/master | 2020-04-10T05:10:29.176672 | 2017-02-02T08:26:23 | 2017-02-02T08:26:23 | 68,132,474 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,314 | cpp | bst.cpp | // bst.cpp
// Das, Pinak
// pdas
#include "bst.h"
#include <vector>
#include <queue>
#include <cmath>
#include <iostream>
using namespace std;
string BST::smallestprivate(Node* cur_root)
{
if(cur_root==NULL)
{
return "empty";
}
else{
if(cur_root->m_left!=NULL)
{
return smallestprivate(cur_root->m_left);
}
else
{
return cur_root->m_str;
}
}
}
bool BST::insert(string str, Node* &cur_root)
{
if(cur_root==NULL)
{
cur_root=new Node(str);
return true;
}
if(str == cur_root->m_str)
{
return false;
}
if(str < cur_root->m_str)
{
return insert(str, cur_root->m_left);
}
else
{
return insert(str, cur_root->m_right);
}
}
bool BST::find(string target, Node* cur_root)
{
if(cur_root==NULL)
{
return false;
}
if(cur_root->m_str==target)
{
return true;
}
if(target < cur_root->m_str)
{
return find(target, cur_root->m_left);
}
else
{
return find(target, cur_root->m_right);
}
}
void BST::dft(vector<string> &value, Node* cur_root)
{
if(cur_root!=NULL)
{
dft(value, cur_root->m_left);
value.push_back(cur_root->m_str);
dft(value, cur_root->m_right);
}
}
void BST::bft(vector<string> &value)
{
if(m_root!=NULL)
{
que.push(m_root);
}
while(que.empty()==false)
{
Node* tmp=que.front();
que.pop();
value.push_back(tmp->m_str);
if(tmp->m_left!=NULL){
que.push(tmp->m_left);
}
if(tmp->m_right!=NULL){
que.push(tmp->m_right);
}
}
}
int BST::distance(Node* cur_root, int dist)
{
if(cur_root== NULL)
return 0;
return dist + distance(cur_root->m_left, dist+1) +
distance(cur_root->m_right, dist+1);
}
double BST::distance()
{
int total=distance(m_root, 0);
int nodes=countNodes(m_root);
double avg=(double)total/nodes;
return avg;
}
int BST::countNodes(Node* cur_root)
{
if(cur_root==NULL)
{
return 0;
}
return 1+countNodes(cur_root->m_left) + countNodes(cur_root->m_right);
}
int BST::balanced(Node *cur_root)
{
if(cur_root==NULL)
{
return 0;
}
int left=balanced(cur_root->m_left);
int right=balanced(cur_root->m_right);
if(left==-1 || right==-1)
{
return -1;
}
if(abs(left-right) > 1)
{
return -1;
}
else
return 1+max(left, right);
}
bool BST::balanced()
{
if(balanced(m_root)==-1)
{
return false;
}
else
return true;
}
void BST::insert_from_vector(vector <string> &elements, int start_index, int end_index)
{
if(start_index==end_index)
{
insert(elements[start_index]);
return;
}
if(start_index > end_index)
{
return;
}
else
{
int middle_index= (start_index+end_index)/2;
insert(elements[middle_index]);
insert_from_vector(elements, start_index, middle_index -1);
insert_from_vector(elements, middle_index+1, end_index);
}
}
void BST::deleteNodes(Node* cur_root)
{
if (cur_root == NULL)
return;
if(cur_root->m_left!=NULL)
deleteNodes(cur_root->m_left);
if(cur_root->m_right!=NULL)
deleteNodes(cur_root->m_right);
if(cur_root->m_right==NULL && cur_root->m_left==NULL)
delete cur_root;
}
void BST::rebalance()
{
vector<string> strings;
dft(strings);
m_root=NULL;
deleteNodes(m_root);
insert_from_vector( strings, 0 , strings.size()-1);
} |
936d6b638898ddf7e7a15b50731b562a1be73b84 | 3f3095dbf94522e37fe897381d9c76ceb67c8e4f | /Current/BP_CreeperVine_Large_01.hpp | 9c5c49d35d432c7cdc9a6ce0ac714806da52ac20 | [] | no_license | DRG-Modding/Header-Dumps | 763c7195b9fb24a108d7d933193838d736f9f494 | 84932dc1491811e9872b1de4f92759616f9fa565 | refs/heads/main | 2023-06-25T11:11:10.298500 | 2023-06-20T13:52:18 | 2023-06-20T13:52:18 | 399,652,576 | 8 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 171 | hpp | BP_CreeperVine_Large_01.hpp | #ifndef UE4SS_SDK_BP_CreeperVine_Large_01_HPP
#define UE4SS_SDK_BP_CreeperVine_Large_01_HPP
class ABP_CreeperVine_Large_01_C : public ABP_CreeperVine_Base_C
{
};
#endif
|
92699245411cbf4db431581dc5f87de636ed5dc4 | fd4b3775dd8f63c69b08b003fc4eb3f76fd017b5 | /insertsort.cpp | 12cba76c7d5dc7d9743b64c35dd7f1997e93d557 | [] | no_license | jw6/COP3530 | 89bed1c6ede1f8b6458d9d664135165d1c50a9ae | fe8c9d185858c3be154914c909b69cae3557b6e6 | refs/heads/master | 2021-03-27T16:10:18.619341 | 2018-02-09T23:00:48 | 2018-02-09T23:00:48 | 49,458,907 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 782 | cpp | insertsort.cpp | //
// main.cpp
// insectionSort
//
// Created by Jay on 1/11/16.
// Copyright (c) 2016 Jay. All rights reserved.
//
#include <iostream>
using namespace std;
void insertion_sort(int arr[], int size){
for(int i = 1; i < size; i++){
int insert = arr[i];
int j = i - 1;
while(j >= 0 && insert < arr[j]){
arr[j+1] = arr[j];
j--;
/*compare right to left*/
}
arr[j+1] = insert;
}
}
int main(int argc, const char * argv[]) {
int size;
cin >> size ;
int nums[size];
for(int i = 0; i < size; i++){
cin >> nums[i];
}
insertion_sort(nums, size);
cout << endl;
for(int i = 0; i < size; i++){
cout << nums[i] << endl;
}
return 0;
}
|
339e618d7f0f7b693c1fa74737ae7ed812ccd1e1 | 003c726bf3f7773d6a9a6b00c84d72a193818f7d | /CPP/C++Primer Plus/9Make/3.cpp | 94e0406a1d3eacae4065a2d83b6246b50939b6a7 | [] | no_license | 18616378431/myCode | b83a40ab3e2b59665bc57915432819ed2b96a7f5 | 737f5b98850c7943dd5192425b253061274e97f6 | refs/heads/master | 2022-09-16T15:42:28.218709 | 2021-08-27T09:13:50 | 2021-08-27T09:13:50 | 40,103,180 | 0 | 0 | null | 2022-06-17T01:37:09 | 2015-08-03T03:26:11 | HTML | GB18030 | C++ | false | false | 1,328 | cpp | 3.cpp | ////new布局操作符指定区域分配内存和heap分配内存
//#include<iostream>
//#include<new>
//
//const int LEN = 512;
//const int N = 2;
//
//char buffer[LEN];
//
//struct chaff{
// char dross[20];
// int slag;
//};
//
//void set_value(struct chaff & c);
//void show_value(const struct chaff & c);
//
//int main()
//{
// //布局new操作符需包含头文件new
// struct chaff * pcn = new (buffer) chaff[N];
// //堆分配
// struct chaff * pch = new chaff[N];
// int i = 0;
//
// std::cout << "Buffer address\n" << "Heap:\t" << pch;
// std::cout << "\nStatic:\t" << (void *)buffer << std::endl;
// for(i = 0;i < N;i++)
// {
// std::cout << "Enter new\n";
// set_value(pcn[i]);
// std::cout << "Enter heap\n";
// set_value(pch[i]);
// }
// for(i = 0;i < N;i++)
// {
// std::cout << "new\n";
// show_value(pcn[i]);
// std::cout << "heap\n";
// show_value(pch[i]);
// }
// return 0;
//}
//void set_value(struct chaff & c)
//{
// char tmp[LEN];
//
// std::cout << "Enter dross:";
// std::cin >> tmp;
// strcpy(c.dross,tmp);
// std::cout << "Enter slag:";
// std::cin >> c.slag;
//}
//void show_value(const struct chaff & c)
//{
// std::cout << "Dross:" << c.dross;
// std::cout << ",slag:" << c.slag;
// std::cout << ",address:" << &c << std::endl;
//} |
abe01961717e6cf455ceec8b0f4b8825e1c46083 | 82dc3e0092f329b6f60f04771b289d420224e96d | /Demo1/build-TalkingClient-Desktop_Qt_5_4_2_GCC_64bit-Debug/ui_friendlist.h | 8fa32ef1e22d1eedbe1aecb857218618e7d6d818 | [] | no_license | DeutschThorben/Talking | 88f21bd7ac90bcb63303e128242a76d4fd141e20 | 9542a373a7ef23b653e5f19de611de96ec1e1e63 | refs/heads/master | 2021-01-22T22:20:00.313765 | 2017-05-03T02:49:51 | 2017-05-03T02:49:51 | 85,528,171 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,780 | h | ui_friendlist.h | /********************************************************************************
** Form generated from reading UI file 'friendlist.ui'
**
** Created by: Qt User Interface Compiler version 5.4.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_FRIENDLIST_H
#define UI_FRIENDLIST_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_FriendList
{
public:
QLabel *label_name;
QComboBox *comboBox;
QWidget *layoutWidget;
QVBoxLayout *verticalLayout;
QListWidget *list_friend;
QGridLayout *gridLayout;
QPushButton *btn_addFriend;
QSpacerItem *horizontalSpacer;
QPushButton *btn_makeMasses;
QPushButton *btn_exit;
void setupUi(QWidget *FriendList)
{
if (FriendList->objectName().isEmpty())
FriendList->setObjectName(QStringLiteral("FriendList"));
FriendList->resize(245, 690);
label_name = new QLabel(FriendList);
label_name->setObjectName(QStringLiteral("label_name"));
label_name->setGeometry(QRect(12, 12, 121, 21));
comboBox = new QComboBox(FriendList);
comboBox->setObjectName(QStringLiteral("comboBox"));
comboBox->setGeometry(QRect(140, 10, 85, 27));
layoutWidget = new QWidget(FriendList);
layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
layoutWidget->setGeometry(QRect(10, 46, 211, 621));
verticalLayout = new QVBoxLayout(layoutWidget);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
list_friend = new QListWidget(layoutWidget);
list_friend->setObjectName(QStringLiteral("list_friend"));
verticalLayout->addWidget(list_friend);
gridLayout = new QGridLayout();
gridLayout->setObjectName(QStringLiteral("gridLayout"));
btn_addFriend = new QPushButton(layoutWidget);
btn_addFriend->setObjectName(QStringLiteral("btn_addFriend"));
gridLayout->addWidget(btn_addFriend, 0, 0, 1, 2);
horizontalSpacer = new QSpacerItem(68, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout->addItem(horizontalSpacer, 0, 2, 1, 1);
btn_makeMasses = new QPushButton(layoutWidget);
btn_makeMasses->setObjectName(QStringLiteral("btn_makeMasses"));
gridLayout->addWidget(btn_makeMasses, 1, 0, 1, 1);
btn_exit = new QPushButton(layoutWidget);
btn_exit->setObjectName(QStringLiteral("btn_exit"));
gridLayout->addWidget(btn_exit, 1, 1, 1, 2);
verticalLayout->addLayout(gridLayout);
retranslateUi(FriendList);
QMetaObject::connectSlotsByName(FriendList);
} // setupUi
void retranslateUi(QWidget *FriendList)
{
FriendList->setWindowTitle(QApplication::translate("FriendList", "Form", 0));
label_name->setText(QString());
btn_addFriend->setText(QApplication::translate("FriendList", "Add new friend", 0));
btn_makeMasses->setText(QApplication::translate("FriendList", "Make Masses", 0));
btn_exit->setText(QApplication::translate("FriendList", "exit", 0));
} // retranslateUi
};
namespace Ui {
class FriendList: public Ui_FriendList {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_FRIENDLIST_H
|
88614aff7be630b13224da17347e8a0264c7d7fb | 62fe6f7e97b3792d7085909a826bd545554d91ff | /Rasterizer/Color.cpp | 0887a1706d96576c4a3f40a125f7dffaceffc438 | [] | no_license | Valentineed/Rasterizer | 7734cbfb1ad92ecc72fc65f2331fe42c66b16829 | 7befe6d4f121f707f2add10d0a943e6245f6eb28 | refs/heads/master | 2022-07-25T21:19:27.514480 | 2020-05-23T15:31:40 | 2020-05-23T15:31:40 | 266,364,434 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,397 | cpp | Color.cpp | #include "pch.h"
#include "Color.h"
#include <cassert>
namespace Rasterizer
{
Color::Color(float red, float green, float blue, float alpha) :
m_red(red),
m_green(green),
m_blue(blue),
m_alpha(alpha)
{
}
Color::Color(float value)
{
m_red = value;
m_green = value;
m_blue = value;
m_alpha = 1.f;
}
Color::Color(Color const& other, float alpha) :
m_red(other.m_red),
m_green(other.m_green),
m_blue(other.m_blue),
m_alpha(other.m_alpha * alpha)
{
}
float Color::operator[](size_t index) const
{
switch (index)
{
case 0:
return m_red;
case 1:
return m_green;
case 2:
return m_blue;
case 3:
return m_alpha;
default:
assert(false); // kill function;
return 0; // return 0 to remove warning
}
}
float& Color::operator[](size_t index)
{
switch (index)
{
case 0:
return m_red;
case 1:
return m_green;
case 2:
return m_blue;
case 3:
return m_alpha;
default:
assert(false); // kill function;
return m_red; // return first value to remove warning
}
}
Color Color::operator+(Color const& color)
{
m_red += color.m_red;
m_green += color.m_green;
m_blue += color.m_blue;
m_alpha = color.m_alpha * (1.f - m_alpha) + m_alpha;
return *this;
}
Color Color::operator*(float const& alpha)
{
m_red *= alpha;
m_green *= alpha;
m_blue *= alpha;
m_alpha *= alpha;
return *this;
}
} |
98f6c234487f1e946e35224f738e13d447144d69 | 6f286be4a4e16867cc6e488080b8e3eced1dcd62 | /src/cppNGS/VariantScores.h | a2dbc08172c004cc8c651e24f5772b28f71aaf45 | [
"MIT"
] | permissive | imgag/ngs-bits | 3587404be01687d52c5a77b933874ca77faf8e6b | 0597c96f6bc09067598c2364877d11091350bed8 | refs/heads/master | 2023-09-03T20:20:16.975954 | 2023-09-01T13:17:35 | 2023-09-01T13:17:35 | 38,034,492 | 110 | 36 | MIT | 2023-09-12T14:21:59 | 2015-06-25T07:23:55 | C++ | UTF-8 | C++ | false | false | 2,786 | h | VariantScores.h | #ifndef VARIANTSCORES_H
#define VARIANTSCORES_H
#include "cppNGS_global.h"
#include "VariantList.h"
#include "BedFile.h"
#include "Phenotype.h"
//Variant scoring/ranking class.
class CPPNGSSHARED_EXPORT VariantScores
{
public:
//Scoring parameters
struct Parameters
{
bool use_ngsd_classifications = true;
bool use_blacklist = false;
bool use_clinvar = true;
};
//Scoring result
struct Result
{
//Algorithm name
QString algorithm;
//Scores per variant. Scores below 0 indicate that no score was calculated for the variant. -1 means that the variant did not pass the pre-filtering. -2 means that the variant was blacklisted.
QList<double> scores;
//Score explanations per variant.
QList<QStringList> score_explanations;
//Ranks per variant. Ranks below 0 indicate that no rank was calculated for the variant.
QList<int> ranks;
//General warnings.
QStringList warnings;
};
//Default constructor
VariantScores();
//Returns the list of algorithms
static QStringList algorithms();
//Returns the algorithm description.
static QString description(QString algorithm);
//Returns a variant scores. Throws an error if the input is invalid.
static Result score(QString algorithm, const VariantList& variants, QHash<Phenotype, BedFile> phenotype_rois, const Parameters& parameters);
//Annotates a variant list with the scoring result. Returns the number of variants that were scored.
static int annotate(VariantList& variants, const Result& result, bool add_explanations = false);
private:
//Returns the variant blackist from the settings file.
static QList<Variant> loadBlacklist();
static Result score_GSvar_v1(const VariantList& variants, QHash<Phenotype, BedFile> phenotype_rois, const Parameters& parameters);
static Result score_GSvar_v2_dominant(const VariantList& variants, QHash<Phenotype, BedFile> phenotype_rois, const Parameters& parameters);
static Result score_GSvar_v2_recessive(const VariantList& variants, QHash<Phenotype, BedFile> phenotype_rois, const Parameters& parameters);
};
//Helper struct for scoring
class CategorizedScores
: protected QHash<QByteArray, QHash<QByteArray, double>>
{
public:
//Adds score (not gene-specific)
void add(const QByteArray& category, double value);
//Adds score for a specific gene
void add(const QByteArray& category, double value, const QByteArray& gene);
//Returns the maximum score of all genes
double score(QByteArrayList& best_genes) const;
//Returns the explanations for the given gene. If an empty gene is given, only the gene-independent scores are returned.
QStringList explainations(const QByteArray& gene) const;
//Returns the explanations for the given genes.
QStringList explainations(const QByteArrayList& best_genes) const;
};
#endif // VARIANTSCORES_H
|
0526e78742cf8f8a95264e56791e1f4d5456789f | 600df3590cce1fe49b9a96e9ca5b5242884a2a70 | /ui/app_list/speech_ui_model.cc | 927619df3294aaa755c0bb4f80474b7a9651f2f1 | [
"BSD-3-Clause"
] | permissive | metux/chromium-suckless | efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a | 72a05af97787001756bae2511b7985e61498c965 | refs/heads/orig | 2022-12-04T23:53:58.681218 | 2017-04-30T10:59:06 | 2017-04-30T23:35:58 | 89,884,931 | 5 | 3 | BSD-3-Clause | 2022-11-23T20:52:53 | 2017-05-01T00:09:08 | null | UTF-8 | C++ | false | false | 3,384 | cc | speech_ui_model.cc | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/app_list/speech_ui_model.h"
#include <stdint.h>
#include <algorithm>
#include <limits>
namespace app_list {
namespace {
// The default sound level, just gotten from the developer device.
const int16_t kDefaultSoundLevel = 200;
} // namespace
SpeechUIModel::SpeechUIModel()
: is_final_(false),
sound_level_(0),
state_(app_list::SPEECH_RECOGNITION_OFF),
minimum_sound_level_(kDefaultSoundLevel),
maximum_sound_level_(kDefaultSoundLevel) {
}
SpeechUIModel::~SpeechUIModel() {}
void SpeechUIModel::SetSpeechResult(const base::string16& result,
bool is_final) {
if (result_ == result && is_final_ == is_final)
return;
result_ = result;
is_final_ = is_final;
FOR_EACH_OBSERVER(SpeechUIModelObserver,
observers_,
OnSpeechResult(result, is_final));
}
void SpeechUIModel::UpdateSoundLevel(int16_t level) {
if (sound_level_ == level)
return;
sound_level_ = level;
// Tweak the sound level limits adaptively.
// - min is the minimum value during the speech recognition starts but speech
// itself hasn't started.
// - max is the maximum value when the user speaks.
if (state_ == SPEECH_RECOGNITION_IN_SPEECH)
maximum_sound_level_ = std::max(level, maximum_sound_level_);
else
minimum_sound_level_ = std::min(level, minimum_sound_level_);
if (maximum_sound_level_ < minimum_sound_level_) {
maximum_sound_level_ = std::max(
static_cast<int16_t>(minimum_sound_level_ + kDefaultSoundLevel),
std::numeric_limits<int16_t>::max());
}
int16_t range = maximum_sound_level_ - minimum_sound_level_;
uint8_t visible_level = 0;
if (range > 0) {
int16_t visible_level_in_range = std::min(
std::max(minimum_sound_level_, sound_level_), maximum_sound_level_);
visible_level = (visible_level_in_range - minimum_sound_level_) *
std::numeric_limits<uint8_t>::max() / range;
}
FOR_EACH_OBSERVER(SpeechUIModelObserver,
observers_,
OnSpeechSoundLevelChanged(visible_level));
}
void SpeechUIModel::SetSpeechRecognitionState(SpeechRecognitionState new_state,
bool always_show_ui) {
// Don't show the speech view on a change to a network error or if the state
// has not changed, unless |always_show_ui| is true.
if (!always_show_ui &&
(state_ == new_state || new_state == SPEECH_RECOGNITION_NETWORK_ERROR)) {
state_ = new_state;
return;
}
state_ = new_state;
// Revert the min/max sound level to the default.
if (state_ != SPEECH_RECOGNITION_RECOGNIZING &&
state_ != SPEECH_RECOGNITION_IN_SPEECH) {
minimum_sound_level_ = kDefaultSoundLevel;
maximum_sound_level_ = kDefaultSoundLevel;
}
FOR_EACH_OBSERVER(SpeechUIModelObserver,
observers_,
OnSpeechRecognitionStateChanged(new_state));
}
void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) {
observers_.AddObserver(observer);
}
void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) {
observers_.RemoveObserver(observer);
}
} // namespace app_list
|
3d12f60466b531cee3f36500c1d975b0be51de8e | 9f55c5a594fb660238ea01d544b963f7a20c7c91 | /PatientFeesGroupProject/PatientFeesGroupProject/Main.cpp | 1f195c428d8a12425d9d1279c6365f578cad6a17 | [] | no_license | eaplatt3/CppPrograms | 6c8e38e41bbc0d7eafcd42b862c388bcc3aa8362 | c5cec9f112e6105069e8033b2f2b3d6d93f06789 | refs/heads/master | 2021-05-01T12:10:03.140583 | 2018-02-12T16:35:26 | 2018-02-12T16:35:26 | 121,057,372 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,538 | cpp | Main.cpp | #include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
string name;
//Check-in Date Data Type
//Check-out Date Data Type
char choice;
int surgery;
int meds;
cout << "Welcome to Smith Town General's Patient Portal" << endl;
cout << "----------------------------------------------" << endl;
cout << "/n";
cout << "Enter the Patients Name: ";
cin >> name;
while (cin.fail())
{
cout << "Invalid Input Please Re-enter The Patient's Name" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> surgery;
}
//setPatientsName
cout << "Enter Check-in Date: ";
//cin << ChkInDate;
//setPatientsChkInDate
cout << "What Type of Surgery is to be Preformed" << endl;
cout << "1)'SurgeryType'" << endl;
cout << "2)'SurgeryType'" << endl;
cout << "3)'SurgeryType'" << endl;
cout << "3)'SurgeryType'" << endl;
cout << "4)'SurgeryType'" << endl;
cin >> surgery;
while (cin.fail())
{
cout << "Invalid Input Please Re-enter Your Choice" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> surgery;
}
//setSurgery
cout << "What Medications will the Patient Take" << endl;
cout << "1)'MedType'" << endl;
cout << "2)'MedType'" << endl;
cout << "3)'MedType'" << endl;
cout << "4)'MedType'" << endl;
cout << "5)'MedType'" << endl;
cin >> meds;
while (cin.fail())
{
cout << "Invalid Input Please Re-enter Your Choice" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> meds;
}
//setmeds
do
{
cout << "Is There Anymore Medications Needed? ((y)yes or (n)no)" << endl;
cin >> choice;
if (choice == 'y' || choice == 'Y')
{
cout << "1)'MedType'" << endl;
cout << "2)'MedType'" << endl;
cout << "3)'MedType'" << endl;
cout << "4)'MedType'" << endl;
cout << "5)'MedType'" << endl;
cin >> meds;
while (cin.fail())
{
cout << "Invalid Input Please Re-enter Your Choice" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> meds;
}
//setmeds
}
else;
} while (choice != 'n' || choice != 'N');
cout << "Please Enter Check-out Date: ";
//cin >> ChkOutDate;
//setPatintChkOutDate
cout << " " << name << "Total Cost is " /*get patient cost*/ << endl;
cout << "Day(s) spent: " << /*get days spent*/ "At a Rate of: " << '$' << /*Daily Rate*/ "is " << '$' << /*get Total dates pent cost*/ endl;
cout << "Surgery Preformed: " << /*get Surgery*/ "Costing: " << '$' << /*get surgery price*/ endl;
cout << "Medication Provided: " << endl;
cout << /*get med*/ '$' << /*get med cost*/ endl;
return 0;
} |
f64067ed5443dec9ed94aed0616a0d4c7b296415 | a036225726a61f25e9a4ac2968ee82a0237ce306 | /二分法求根.cpp | 810e81eaeb95318971027b2b3c17cb739d00b18d | [] | no_license | ei0/programme | 240d2c69736f845d0376066e2f36481170491796 | b2ac6e6494778b7b2d5d4f28752a74fd48374324 | refs/heads/master | 2020-09-04T01:37:07.331104 | 2020-05-23T10:48:21 | 2020-05-23T10:48:21 | 219,630,809 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 831 | cpp | 二分法求根.cpp | #include<iostream>
#include<cmath>
using namespace std;
double fun(double x){
return x*exp(x) - 1;
}
int _imain(){
double a, b;
double pre = 1e-3;
while (1)
{
int s;
cout << "请输入隔根区间上限 a = ";
cin >> a;
cout << "请输入隔根区间下限 b = ";
cin >> b;
if (a > b){
cout << "精度默认1e-3\n想要修改输入1\n不做修改输入0" << endl;
cin >> s;
if (s == 1){
cout << "请输入精度";
cin >> pre;
}
break;
}
else{
cout << "求根区间输入有误";
continue;
}
}
double y=1;
double d=1;
double x;
while ((y != 0) && (d>pre)){
x = (a + b) / 2;
y = fun(x);
if ((fun(x)*fun(b)) < 0){
a = x;
}
if ((fun(x)*fun(a)) < 0){
b = x;
}
d = fabs(b - a);
}
cout << "所求根为x = " << x<<endl;
system("pause");
return 0;
} |
fb4b6ea013f3f052abf86298cd9c3eaf2b827a4e | 66ad9dcf885ff39d5ac400eef5b1a2ab70dc2720 | /EngineBrake/Score/ScoreCalculator.h | 7e3eb01ac0c530ade90118b35d38636c8e0bec68 | [] | no_license | alin-corodescu/EngineBrake | 00163cc532e5f68b6062e722ba8bb4d4f533d5e4 | 78cd0216352b09503f1b3620ec05e3e0f31a8a6a | refs/heads/master | 2021-06-16T00:37:14.384560 | 2017-05-01T18:41:29 | 2017-05-01T18:41:29 | 87,808,430 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 615 | h | ScoreCalculator.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include <utility>
/**
*
*/
class ENGINEBRAKE_API ScoreCalculator
{
private:
static ScoreCalculator* instance;
std::pair<float, float> GoodShiftThresholds;
ScoreCalculator();
~ScoreCalculator();
public:
//! Value of the Score Multiplier, may be used later on when requesting fuel
float ScoreMultiplier;
float ComputeUpshiftScore(float RPM);
float ComputeTickingScore(float Delta);
static ScoreCalculator* GetInstance() {
if (instance == NULL)
instance = new ScoreCalculator();
return instance;
}
};
|
ce89b022adea8cb8862c06b8e638eedc8704c991 | 24cb3a4494179cf40fd5f4d964d853d516d15d80 | /leetcode/plus-one.cpp | 31127401e37011e511c703fa1f20a6703b7df6e9 | [] | no_license | Garciat/competitive | 5dd7c82205292a34da6a4026955747407539f897 | 5567f19ec8b3d3303dc38670fe8a95aec201fe9e | refs/heads/master | 2021-07-09T20:29:36.339551 | 2021-04-21T20:43:44 | 2021-04-21T20:43:44 | 83,537,147 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 552 | cpp | plus-one.cpp | // https://leetcode.com/problems/plus-one/
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
reverse(digits.begin(), digits.end());
digits[0] += 1;
int carry = 0;
for (int i = 0; i < digits.size(); ++i) {
int s = digits[i] + carry;
carry = s / 10;
digits[i] = s % 10;
}
if (carry) {
digits.push_back(carry);
}
reverse(digits.begin(), digits.end());
return digits;
}
};
|
430c4cd1e33b49d4346caca0317c1135dbc269a0 | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/rarefied-flows/impingment/sims/test/nozzle1/0.1/grad(rho) | 5338e037bc904ade9f2bdceeeb3931408f81bcdb | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 40,770 | grad(rho) | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0.1";
object grad(rho);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -4 0 0 0 0 0];
internalField nonuniform List<vector>
1900
(
(-1.77636e-11 -1.77636e-11 0)
(0 0 0)
(1.77636e-11 -1.77636e-11 0)
(0 0 0)
(-1.77636e-11 -3.55271e-11 0)
(1.77636e-11 -1.77636e-11 0)
(0 -3.55271e-11 0)
(-1.77636e-11 -1.77636e-11 0)
(1.77636e-11 0 0)
(0 -3.55271e-11 0)
(0 1.77636e-11 0)
(0 0 0)
(-1.77636e-11 1.77636e-11 0)
(1.77636e-11 0 0)
(0 0 0)
(0 1.77636e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(0 -1.77636e-11 0)
(1.77636e-11 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 0 0)
(-1.77636e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 1.77636e-11 0)
(0 0 0)
(0 1.77636e-11 0)
(0 0 0)
(-1.77636e-11 0 0)
(4.47307e-09 0 1.3749e-11)
(3.68906e-08 -3.66179e-09 -1.66435e-11)
(-7.56481e-07 -3.3208e-08 -2.10818e-11)
(-6.61149e-05 -1.24237e-06 0)
(-0.000462147 1.19291e-06 -9.03505e-11)
(4.02255e-11 0 1.3749e-11)
(5.41477e-09 -3.7397e-09 1.66435e-11)
(-1.58403e-06 -6.76002e-08 2.10818e-11)
(-6.55457e-05 -3.16023e-06 0)
(-0.000402002 -2.05555e-05 0)
(2.41353e-11 0 0)
(-2.80331e-08 3.89552e-10 0)
(-2.88272e-06 -4.14483e-09 0)
(-7.50428e-05 7.40149e-10 0)
(-0.000449517 -3.91221e-09 0)
(5.06841e-10 0 1.3749e-11)
(1.6556e-09 3.97343e-09 1.66435e-11)
(-1.58414e-06 6.66627e-08 2.10818e-11)
(-6.55434e-05 3.15869e-06 0)
(-0.000402004 2.05532e-05 0)
(4.77879e-09 0 -4.1247e-11)
(3.59946e-08 3.54492e-09 -1.66435e-11)
(-7.56654e-07 3.6366e-08 -2.10818e-11)
(-6.6116e-05 1.24022e-06 -5.74958e-11)
(-0.000462148 -1.19132e-06 9.03505e-11)
(0.0101438 0.000257019 3.83305e-11)
(10.0573 0.0767276 -3.24335e-11)
(267.919 -3.79154 0)
(1466.19 -303.708 2.48751e-11)
(371.823 -2249.78 -1.13038e-11)
(0.0336417 4.27273e-05 -1.91653e-11)
(8.73055 0.256017 1.62168e-11)
(148.256 -0.815827 0)
(486.514 -429.279 -1.5538e-11)
(-109.565 -2763.81 2.78819e-12)
(0.088546 -3.94746e-09 0)
(9.76678 -2.65694e-09 0)
(98.8969 5.46065e-09 0)
(281.2 -1.16102e-09 6.21002e-12)
(-60.4617 3.06448e-09 -5.57639e-12)
(0.0336417 -4.27374e-05 -1.91653e-11)
(8.73055 -0.256017 1.62168e-11)
(148.256 0.815827 0)
(486.514 429.279 -1.5538e-11)
(-109.565 2763.81 2.78819e-12)
(0.0101438 -0.000257025 1.91653e-11)
(10.0573 -0.0767276 -2.31078e-18)
(267.919 3.79154 0)
(1466.19 303.708 -9.14668e-15)
(371.823 2249.78 1.13038e-11)
(-2112.12 -3984.39 0)
(-627.277 4469.23 0)
(1042.44 642.518 0)
(178.686 15.7529 0)
(4.92643 0.0367845 0)
(0.0121163 5.15738e-06 0)
(1.7229e-06 0 0)
(-1.61487e-11 -1.2919e-10 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 6.45948e-11 0)
(1.61487e-11 -6.45948e-11 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 -6.45948e-11 0)
(0 0 0)
(-4.03868e-06 -6.45948e-11 0)
(-0.0281187 -5.74894e-09 0)
(-11.581 1.67946e-09 0)
(-441.25 -8.7203e-09 0)
(-2838.7 -3.29433e-09 0)
(2972.42 -5.23218e-09 0)
(-91080.8 -6.45948e-09 0)
(-784.518 -1505.58 0)
(-175.026 3011.63 0)
(397.021 492.208 0)
(81.3106 11.7533 0)
(2.47779 0.0211953 0)
(0.00632978 1.65621e-06 0)
(9.15567e-07 0 0)
(-1.61487e-11 0 0)
(0 6.45948e-11 0)
(1.61487e-11 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(1.61487e-11 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(-4.04082e-06 0 0)
(-0.0281187 -5.61975e-09 0)
(-11.581 2.5192e-09 0)
(-441.25 -4.58623e-09 0)
(-2838.7 5.16758e-10 0)
(2972.42 3.29433e-09 0)
(-91080.8 1.67946e-09 0)
(-401.41 -9.17246e-09 0)
(-46.1029 -8.07435e-09 0)
(169.748 -2.5192e-09 0)
(35.5046 8.52651e-09 0)
(1.50729 -6.45948e-10 0)
(0.00595036 -2.58379e-09 0)
(1.24108e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(1.61487e-11 0 0)
(0 0 0)
(0 6.45948e-11 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(1.61487e-11 0 0)
(-1.61487e-11 0 0)
(-4.04032e-06 0 0)
(-0.0281187 2.64839e-09 0)
(-11.581 0 0)
(-441.25 -2.4546e-09 0)
(-2838.7 1.80865e-09 0)
(2972.42 1.61487e-09 0)
(-91080.8 7.94516e-09 0)
(-784.518 1505.58 0)
(-175.026 -3011.63 0)
(397.021 -492.208 0)
(81.3106 -11.7533 0)
(2.47779 -0.0211953 0)
(0.00632978 -1.65763e-06 0)
(9.16309e-07 0 0)
(-1.61487e-11 6.45948e-11 0)
(0 -6.45948e-11 0)
(1.61487e-11 0 0)
(0 0 0)
(1.61487e-11 0 0)
(-3.22974e-11 0 0)
(1.61487e-11 -6.45948e-11 0)
(1.61487e-11 -6.45948e-11 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(1.61487e-11 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(1.61487e-11 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04003e-06 0 0)
(-0.0281187 6.52407e-09 0)
(-11.581 -3.10055e-09 0)
(-441.25 -5.42596e-09 0)
(-2838.7 4.9092e-09 0)
(2972.42 3.29433e-09 0)
(-91080.8 2.32541e-09 0)
(-2112.12 3984.39 0)
(-627.277 -4469.23 0)
(1042.44 -642.518 0)
(178.686 -15.7529 0)
(4.92643 -0.0367845 0)
(0.0121163 -5.15596e-06 0)
(1.72331e-06 0 0)
(-1.61487e-11 6.45948e-11 0)
(0 0 0)
(1.61487e-11 6.45948e-11 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03843e-06 0 0)
(-0.0281187 3.61731e-09 0)
(-11.581 -2.32541e-09 0)
(-441.25 5.03839e-09 0)
(-2838.7 4.84461e-09 0)
(2972.42 7.55759e-09 0)
(-91080.8 9.68922e-10 0)
(91179.3 3122.05 0)
(-2554.45 -2642.99 0)
(2444.3 -377.789 0)
(371.731 -9.39267 0)
(9.52791 -0.022287 0)
(0.0227131 -3.19963e-06 0)
(3.21738e-06 0 0)
(0 -3.90006e-11 0)
(0 0 0)
(0 -3.90006e-11 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03963e-06 0 0)
(-0.0281187 -3.62706e-09 0)
(-11.581 -1.17002e-09 0)
(-441.25 5.81109e-09 0)
(-2838.7 1.44302e-09 0)
(2972.42 6.82511e-10 0)
(-91080.8 1.11152e-09 0)
(91087.8 361.6 0)
(-2966.44 -411.388 0)
(2828.54 -72.1419 0)
(439.199 -2.13036 0)
(11.5101 -0.00560885 0)
(0.0279104 -8.52398e-07 0)
(4.00542e-06 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.0413e-06 0 0)
(-0.0281187 -3.51006e-10 0)
(-11.581 -1.09202e-09 0)
(-441.25 -4.68008e-10 0)
(-2838.7 4.68008e-10 0)
(2972.42 -4.87508e-10 0)
(-91080.8 -3.31505e-10 0)
(91080.8 4.07554 0)
(-2972.41 -10.6185 0)
(2838.68 -2.12852 0)
(441.244 -0.0736259 0)
(11.5808 -0.000216091 0)
(0.028118 -3.48081e-08 0)
(4.03877e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03996e-06 0 0)
(-0.0281187 7.99513e-10 0)
(-11.581 -2.34004e-10 0)
(-441.25 -3.43206e-09 0)
(-2838.7 -2.67154e-09 0)
(2972.42 -3.70506e-10 0)
(-91080.8 -3.12005e-09 0)
(91080.8 0.00138526 0)
(-2972.42 -0.0296818 0)
(2838.7 -0.0063284 0)
(441.25 -0.0002391 0)
(11.581 -7.40193e-07 0)
(0.0281187 -7.02011e-10 0)
(4.03896e-06 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04054e-06 0 0)
(-0.0281187 1.13102e-09 0)
(-11.581 4.09507e-10 0)
(-441.25 -2.67154e-09 0)
(-2838.7 -4.48507e-10 0)
(2972.42 3.70506e-10 0)
(-91080.8 3.31505e-10 0)
(91080.8 -1.61385e-07 0)
(-2972.42 -5.40112e-06 0)
(2838.7 -1.19092e-06 0)
(441.25 -4.54162e-08 0)
(11.581 -2.35954e-09 0)
(0.0281187 -2.28154e-09 0)
(4.03947e-06 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03887e-06 0 0)
(-0.0281187 1.30652e-09 0)
(-11.581 -4.87508e-10 0)
(-441.25 -5.65509e-10 0)
(-2838.7 3.12005e-09 0)
(2972.42 1.11152e-09 0)
(-91080.8 2.34004e-09 0)
(91080.8 -4.15357e-09 0)
(-2972.42 -5.26509e-10 0)
(2838.7 -3.15905e-09 0)
(441.25 -3.90006e-11 0)
(11.581 -8.97015e-10 0)
(0.0281187 -1.13102e-09 0)
(4.04115e-06 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(1.95003e-11 1.95003e-11 0)
(0 -1.95003e-11 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 -1.95003e-11 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-4.0393e-06 0 0)
(-0.0281187 -1.30652e-09 0)
(-11.581 -2.14503e-10 0)
(-441.25 -3.90006e-10 0)
(-2838.7 6.4351e-10 0)
(2972.42 -9.94516e-10 0)
(-91080.8 -2.28154e-09 0)
(91080.8 -1.38452e-09 0)
(-2972.42 1.95003e-11 0)
(2838.7 -3.90006e-10 0)
(441.25 -9.75016e-10 0)
(11.581 -1.73553e-09 0)
(0.0281187 -1.95003e-10 0)
(4.04054e-06 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 -1.95003e-11 0)
(-1.95003e-11 1.95003e-11 0)
(1.95003e-11 0 0)
(0 1.95003e-11 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(-4.04009e-06 0 0)
(-0.0281187 -1.40402e-09 0)
(-11.581 -3.70506e-10 0)
(-441.25 -3.90006e-10 0)
(-2838.7 -2.18404e-09 0)
(2972.42 -3.31505e-09 0)
(-91080.8 -3.47106e-09 0)
(91080.8 3.29555e-09 0)
(-2972.42 1.11152e-09 0)
(2838.7 -2.53504e-10 0)
(441.25 -3.31505e-10 0)
(11.581 2.49604e-09 0)
(0.0281187 1.75503e-10 0)
(4.04134e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04066e-06 0 0)
(-0.0281187 -7.80013e-11 0)
(-11.581 7.41012e-10 0)
(-441.25 2.39854e-09 0)
(-2838.7 9.94516e-10 0)
(2972.42 1.01402e-09 0)
(-91080.8 -1.95003e-11 0)
(91080.8 -4.48507e-10 0)
(-2972.42 -1.09202e-09 0)
(2838.7 1.01402e-09 0)
(441.25 -7.41012e-10 0)
(11.581 1.95003e-11 0)
(0.0281187 1.26752e-09 0)
(4.04039e-06 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 1.95003e-11 0)
(1.95003e-11 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(-4.04015e-06 0 0)
(-0.0281187 5.85009e-10 0)
(-11.581 1.54052e-09 0)
(-441.25 3.52956e-09 0)
(-2838.7 -3.90006e-10 0)
(2972.42 1.65753e-09 0)
(-91080.8 1.81353e-09 0)
(91080.8 -2.67154e-09 0)
(-2972.42 -1.15052e-09 0)
(2838.7 6.0451e-10 0)
(441.25 7.80013e-11 0)
(11.581 -2.61304e-09 0)
(0.0281187 5.26509e-10 0)
(4.04015e-06 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 -1.95003e-11 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-4.04009e-06 0 0)
(-0.0281187 3.12005e-10 0)
(-11.581 -3.13955e-09 0)
(-441.25 1.15052e-09 0)
(-2838.7 -3.31505e-10 0)
(2972.42 -2.28154e-09 0)
(-91080.8 -1.56003e-10 0)
(91080.8 -7.41012e-10 0)
(-2972.42 5.65509e-10 0)
(2838.7 -1.17002e-09 0)
(441.25 2.53504e-10 0)
(11.581 9.75016e-11 0)
(0.0281187 -1.24802e-09 0)
(4.03986e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(1.95003e-11 0 0)
(-1.95003e-11 -1.95003e-11 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03986e-06 0 0)
(-0.0281187 -1.09202e-09 0)
(-11.581 -2.24254e-09 0)
(-441.25 -3.17855e-09 0)
(-2838.7 -3.31505e-10 0)
(2972.42 -2.30104e-09 0)
(-91080.8 -2.16453e-09 0)
(91080.8 -3.51006e-10 0)
(-2972.42 2.00853e-09 0)
(2838.7 7.21512e-10 0)
(441.25 1.75503e-10 0)
(11.581 3.80256e-09 0)
(0.0281187 -8.38514e-10 0)
(4.04134e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04117e-06 0 0)
(-0.0281187 -1.36502e-09 0)
(-11.581 7.41012e-10 0)
(-441.25 -4.29007e-10 0)
(-2838.7 1.50152e-09 0)
(2972.42 -3.31505e-10 0)
(-91080.8 -1.81353e-09 0)
(91080.8 7.80013e-11 0)
(-2972.42 -4.68008e-10 0)
(2838.7 7.21512e-10 0)
(441.25 -1.95003e-10 0)
(11.581 -3.12005e-10 0)
(0.0281187 1.26752e-09 0)
(4.04066e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(-4.04115e-06 0 0)
(-0.0281187 1.09202e-09 0)
(-11.581 1.17002e-10 0)
(-441.25 3.37355e-09 0)
(-2838.7 2.08653e-09 0)
(2972.42 8.19013e-10 0)
(-91080.8 2.37904e-09 0)
(91080.8 -6.83057e-06 0)
(-2972.42 -6.09859e-06 0)
(2838.7 -6.64998e-06 0)
(441.25 -6.74508e-06 0)
(11.581 -6.74892e-06 0)
(0.0281187 -6.75042e-06 0)
(4.04013e-06 -6.75085e-06 0)
(1.95003e-11 -6.74994e-06 0)
(0 -6.74806e-06 0)
(0 -6.74914e-06 0)
(-1.95003e-11 -6.74789e-06 0)
(0 -6.74803e-06 0)
(0 -6.74994e-06 0)
(0 -6.7497e-06 0)
(1.95003e-11 -6.74787e-06 0)
(-1.95003e-11 -6.74824e-06 0)
(0 -6.7491e-06 0)
(1.95003e-11 -6.74834e-06 0)
(0 -6.74779e-06 0)
(-1.95003e-11 -6.74779e-06 0)
(1.95003e-11 -6.74779e-06 0)
(-1.95003e-11 -6.74787e-06 0)
(1.95003e-11 -6.74922e-06 0)
(0 -6.74805e-06 0)
(0 -6.74779e-06 0)
(0 -6.74779e-06 0)
(0 -6.74787e-06 0)
(0 -6.74922e-06 0)
(0 -6.74799e-06 0)
(0 -6.74982e-06 0)
(0 -6.74799e-06 0)
(-1.95003e-11 -6.74789e-06 0)
(0 -6.74951e-06 0)
(-4.04013e-06 -6.74805e-06 0)
(-0.0281187 -6.74955e-06 0)
(-11.581 -6.74623e-06 0)
(-441.25 -6.74487e-06 0)
(-2838.7 -6.65378e-06 0)
(2972.42 -6.09317e-06 0)
(-91080.8 -6.82747e-06 0)
(91080.8 -0.040774 0)
(-2972.42 -0.0367 0)
(2838.7 -0.039414 0)
(441.25 -0.0398855 0)
(11.581 -0.0398999 0)
(0.0281187 -0.0398999 0)
(4.04115e-06 -0.0398999 0)
(2.67154e-09 -0.0398999 0)
(7.60512e-10 -0.0398999 0)
(1.75503e-10 -0.0398999 0)
(1.05302e-09 -0.0398999 0)
(-1.96953e-09 -0.0398999 0)
(-1.57953e-09 -0.0398999 0)
(1.96953e-09 -0.0398999 0)
(1.40402e-09 -0.0398999 0)
(-1.17002e-09 -0.0398999 0)
(-9.75016e-11 -0.0398999 0)
(1.24802e-09 -0.0398999 0)
(5.26509e-10 -0.0398999 0)
(0 -0.0398999 0)
(-7.80013e-11 -0.0398999 0)
(-1.36502e-09 -0.0398999 0)
(-1.56003e-10 -0.0398999 0)
(1.36502e-09 -0.0398999 0)
(2.34004e-10 -0.0398999 0)
(-7.80013e-11 -0.0398999 0)
(-1.36502e-09 -0.0398999 0)
(-1.17002e-10 -0.0398999 0)
(-5.85009e-10 -0.0398999 0)
(0 -0.0398999 0)
(1.87203e-09 -0.0398999 0)
(-1.48202e-09 -0.0398999 0)
(-1.36502e-10 -0.0398999 0)
(-4.04121e-06 -0.0398999 0)
(-0.0281187 -0.0398999 0)
(-11.581 -0.0398999 0)
(-441.25 -0.0398855 0)
(-2838.7 -0.039414 0)
(2972.42 -0.0367 0)
(-91080.8 -0.040774 0)
(91080.7 -14.9635 0)
(-2972.42 -13.5128 0)
(2838.7 -14.3399 0)
(441.25 -14.4872 0)
(11.581 -14.4918 0)
(0.0281186 -14.4918 0)
(4.04138e-06 -14.4918 0)
(4.38757e-09 -14.4918 0)
(-9.75016e-11 -14.4918 0)
(7.80013e-11 -14.4918 0)
(2.94455e-09 -14.4918 0)
(1.95003e-11 -14.4918 0)
(-5.07008e-10 -14.4918 0)
(-2.53504e-09 -14.4918 0)
(-1.71603e-09 -14.4918 0)
(9.36015e-10 -14.4918 0)
(-4.09507e-10 -14.4918 0)
(-2.41804e-09 -14.4918 0)
(-1.17002e-09 -14.4918 0)
(9.94516e-10 -14.4918 0)
(-4.87508e-10 -14.4918 0)
(-9.75016e-10 -14.4918 0)
(-4.09507e-10 -14.4918 0)
(5.07008e-10 -14.4918 0)
(1.52102e-09 -14.4918 0)
(5.85009e-10 -14.4918 0)
(1.50152e-09 -14.4918 0)
(2.14503e-10 -14.4918 0)
(-2.12553e-09 -14.4918 0)
(0 -14.4918 0)
(1.63803e-09 -14.4918 0)
(2.47654e-09 -14.4918 0)
(-1.59903e-09 -14.4918 0)
(-4.0444e-06 -14.4918 0)
(-0.0281186 -14.4918 0)
(-11.581 -14.4918 0)
(-441.25 -14.4872 0)
(-2838.7 -14.3399 0)
(2972.42 -13.5128 0)
(-91080.7 -14.9635 0)
(91052.3 -534.436 0)
(-2971.82 -477.373 0)
(2837.77 -502.054 0)
(441.104 -506.479 0)
(11.5766 -506.618 0)
(0.0281064 -506.618 0)
(4.04142e-06 -506.618 0)
(-2.59354e-09 -506.618 0)
(-3.51006e-09 -506.618 0)
(1.40402e-09 -506.618 0)
(8.19013e-10 -506.618 0)
(-7.99513e-10 -506.618 0)
(4.29007e-10 -506.618 0)
(-1.91103e-09 -506.618 0)
(1.83303e-09 -506.618 0)
(3.49056e-09 -506.618 0)
(-1.01402e-09 -506.618 0)
(-5.85009e-11 -506.618 0)
(1.57953e-09 -506.618 0)
(2.53504e-10 -506.618 0)
(-3.31505e-10 -506.618 0)
(-1.87203e-09 -506.618 0)
(-8.58014e-10 -506.618 0)
(-2.16453e-09 -506.618 0)
(-2.32054e-09 -506.618 0)
(3.19805e-09 -506.618 0)
(2.00853e-09 -506.618 0)
(0 -506.618 0)
(-1.52102e-09 -506.618 0)
(2.14503e-10 -506.618 0)
(2.76904e-09 -506.618 0)
(-1.65753e-09 -506.618 0)
(-1.98903e-09 -506.618 0)
(-4.03967e-06 -506.618 0)
(-0.0281064 -506.618 0)
(-11.5766 -506.618 0)
(-441.104 -506.479 0)
(-2837.77 -502.054 0)
(2971.82 -477.373 0)
(-91052.3 -534.436 0)
(90064.6 -3294.97 0)
(-2941.22 -2911.37 0)
(2810.65 -3090.58 0)
(436.852 -3117.52 0)
(11.4466 -3118.38 0)
(0.0277397 -3118.38 0)
(3.97732e-06 -3118.38 0)
(3.70506e-10 -3118.38 0)
(1.17002e-10 -3118.38 0)
(-2.22304e-09 -3118.38 0)
(2.14503e-10 -3118.38 0)
(6.63011e-10 -3118.38 0)
(-1.79403e-09 -3118.38 0)
(-8.58014e-10 -3118.38 0)
(2.51554e-09 -3118.38 0)
(2.69104e-09 -3118.38 0)
(-1.36502e-10 -3118.38 0)
(2.34004e-10 -3118.38 0)
(-2.04753e-09 -3118.38 0)
(-1.56003e-10 -3118.38 0)
(-2.73004e-10 -3118.38 0)
(-1.95003e-09 -3118.38 0)
(9.36015e-10 -3118.38 0)
(-7.41012e-10 -3118.38 0)
(1.32602e-09 -3118.38 0)
(2.96405e-09 -3118.38 0)
(-1.42352e-09 -3118.38 0)
(-2.34004e-10 -3118.38 0)
(2.14503e-10 -3118.38 0)
(5.26509e-10 -3118.38 0)
(1.34552e-09 -3118.38 0)
(-2.43754e-09 -3118.38 0)
(-1.95003e-11 -3118.38 0)
(-3.9759e-06 -3118.38 0)
(-0.0277397 -3118.38 0)
(-11.4466 -3118.38 0)
(-436.852 -3117.52 0)
(-2810.65 -3090.58 0)
(2941.22 -2911.37 0)
(-90064.6 -3294.97 0)
(84796.1 3441.23 0)
(-2774.86 3093.66 0)
(2639.11 3270.14 0)
(414.321 3300.85 0)
(10.7534 3301.4 0)
(0.0257317 3301.4 0)
(3.62723e-06 3301.4 0)
(2.74954e-09 3301.4 0)
(7.41012e-10 3301.4 0)
(-1.56003e-09 3301.4 0)
(-1.17002e-10 3301.4 0)
(-1.36502e-09 3301.4 0)
(-3.12005e-10 3301.4 0)
(1.46252e-09 3301.4 0)
(-2.16453e-09 3301.4 0)
(-9.55515e-10 3301.4 0)
(2.20354e-09 3301.4 0)
(1.01402e-09 3301.4 0)
(1.36502e-10 3301.4 0)
(1.03352e-09 3301.4 0)
(-3.12005e-10 3301.4 0)
(-1.65753e-09 3301.4 0)
(-8.97015e-10 3301.4 0)
(1.28702e-09 3301.4 0)
(8.97015e-10 3301.4 0)
(3.31505e-10 3301.4 0)
(-1.98903e-09 3301.4 0)
(-4.09507e-10 3301.4 0)
(2.22304e-09 3301.4 0)
(2.92505e-10 3301.4 0)
(-9.75016e-10 3301.4 0)
(-2.55454e-09 3301.4 0)
(8.58014e-10 3301.4 0)
(-3.62499e-06 3301.4 0)
(-0.0257317 3301.4 0)
(-10.7534 3301.4 0)
(-414.321 3300.85 0)
(-2639.11 3270.14 0)
(2774.86 3093.66 0)
(-84796.1 3441.23 0)
(96146.5 -99433 0)
(-3106.08 -88339.8 0)
(3010.31 -93542.2 0)
(466.975 -94470.8 0)
(11.9773 -94495.3 0)
(0.0287657 -94495.3 0)
(4.09253e-06 -94495.3 0)
(-1.83303e-09 -94495.3 0)
(3.49056e-09 -94495.3 0)
(1.89153e-09 -94495.3 0)
(-2.71054e-09 -94495.3 0)
(-1.48202e-09 -94495.3 0)
(1.17002e-10 -94495.3 0)
(-1.89153e-09 -94495.3 0)
(-1.32602e-09 -94495.3 0)
(2.98355e-09 -94495.3 0)
(3.15905e-09 -94495.3 0)
(8.58014e-10 -94495.3 0)
(7.60512e-10 -94495.3 0)
(3.12005e-10 -94495.3 0)
(-3.70506e-10 -94495.3 0)
(-2.88605e-09 -94495.3 0)
(-2.14503e-10 -94495.3 0)
(2.37904e-09 -94495.3 0)
(-2.10603e-09 -94495.3 0)
(-2.73004e-10 -94495.3 0)
(-3.12005e-10 -94495.3 0)
(-1.75503e-10 -94495.3 0)
(9.75016e-11 -94495.3 0)
(5.26509e-10 -94495.3 0)
(2.55454e-09 -94495.3 0)
(-2.59354e-09 -94495.3 0)
(-1.89153e-09 -94495.3 0)
(-4.09329e-06 -94495.3 0)
(-0.0287657 -94495.3 0)
(-11.9773 -94495.3 0)
(-466.975 -94470.8 0)
(-3010.31 -93542.2 0)
(3106.08 -88339.8 0)
(-96146.5 -99433 0)
(96146.5 99433 0)
(-3106.08 88339.8 0)
(3010.31 93542.2 0)
(466.975 94470.8 0)
(11.9773 94495.3 0)
(0.0287657 94495.3 0)
(4.09317e-06 94495.3 0)
(-9.75016e-11 94495.3 0)
(1.93053e-09 94495.3 0)
(-1.36502e-09 94495.3 0)
(-2.63254e-09 94495.3 0)
(1.50152e-09 94495.3 0)
(2.24254e-09 94495.3 0)
(-5.46009e-10 94495.3 0)
(6.4351e-10 94495.3 0)
(2.06703e-09 94495.3 0)
(-1.75503e-09 94495.3 0)
(-1.73553e-09 94495.3 0)
(-1.56003e-09 94495.3 0)
(-1.75503e-10 94495.3 0)
(-2.73004e-10 94495.3 0)
(-8.38514e-10 94495.3 0)
(5.46009e-10 94495.3 0)
(-3.12005e-10 94495.3 0)
(5.26509e-10 94495.3 0)
(1.30652e-09 94495.3 0)
(-1.95003e-11 94495.3 0)
(2.73004e-10 94495.3 0)
(6.0451e-10 94495.3 0)
(0 94495.3 0)
(-7.41012e-10 94495.3 0)
(-7.60512e-10 94495.3 0)
(-1.95003e-11 94495.3 0)
(-4.09325e-06 94495.3 0)
(-0.0287657 94495.3 0)
(-11.9773 94495.3 0)
(-466.975 94470.8 0)
(-3010.31 93542.2 0)
(3106.08 88339.8 0)
(-96146.5 99433 0)
(84796.1 -3441.23 0)
(-2774.86 -3093.66 0)
(2639.11 -3270.14 0)
(414.321 -3300.85 0)
(10.7534 -3301.4 0)
(0.0257317 -3301.4 0)
(3.6271e-06 -3301.4 0)
(3.31505e-09 -3301.4 0)
(6.63011e-10 -3301.4 0)
(-3.15905e-09 -3301.4 0)
(-3.70506e-10 -3301.4 0)
(5.26509e-10 -3301.4 0)
(7.80013e-10 -3301.4 0)
(1.63803e-09 -3301.4 0)
(-2.26204e-09 -3301.4 0)
(-1.67703e-09 -3301.4 0)
(1.38452e-09 -3301.4 0)
(1.81353e-09 -3301.4 0)
(-1.36502e-10 -3301.4 0)
(8.19013e-10 -3301.4 0)
(-5.07008e-10 -3301.4 0)
(-1.77453e-09 -3301.4 0)
(1.56003e-10 -3301.4 0)
(1.17002e-10 -3301.4 0)
(8.77514e-10 -3301.4 0)
(1.28702e-09 -3301.4 0)
(-2.28154e-09 -3301.4 0)
(4.09507e-10 -3301.4 0)
(2.32054e-09 -3301.4 0)
(-5.46009e-10 -3301.4 0)
(-1.50152e-09 -3301.4 0)
(-2.26204e-09 -3301.4 0)
(8.19013e-10 -3301.4 0)
(-3.62511e-06 -3301.4 0)
(-0.0257317 -3301.4 0)
(-10.7534 -3301.4 0)
(-414.321 -3300.85 0)
(-2639.11 -3270.14 0)
(2774.86 -3093.66 0)
(-84796.1 -3441.23 0)
(90064.6 3294.97 0)
(-2941.22 2911.37 0)
(2810.65 3090.58 0)
(436.852 3117.52 0)
(11.4466 3118.38 0)
(0.0277397 3118.38 0)
(3.97561e-06 3118.38 0)
(2.35954e-09 3118.38 0)
(2.74954e-09 3118.38 0)
(-2.22304e-09 3118.38 0)
(-1.28702e-09 3118.38 0)
(1.98903e-09 3118.38 0)
(9.75016e-10 3118.38 0)
(-1.67703e-09 3118.38 0)
(-1.75503e-10 3118.38 0)
(-1.95003e-10 3118.38 0)
(-8.97015e-10 3118.38 0)
(2.67154e-09 3118.38 0)
(-1.13102e-09 3118.38 0)
(7.80013e-11 3118.38 0)
(-2.14503e-10 3118.38 0)
(-1.40402e-09 3118.38 0)
(2.53504e-09 3118.38 0)
(-1.48202e-09 3118.38 0)
(-1.91103e-09 3118.38 0)
(3.15905e-09 3118.38 0)
(1.03352e-09 3118.38 0)
(0 3118.38 0)
(7.80013e-11 3118.38 0)
(2.92505e-10 3118.38 0)
(1.15052e-09 3118.38 0)
(-2.26204e-09 3118.38 0)
(-1.32602e-09 3118.38 0)
(-3.97662e-06 3118.38 0)
(-0.0277397 3118.38 0)
(-11.4466 3118.38 0)
(-436.852 3117.52 0)
(-2810.65 3090.58 0)
(2941.22 2911.37 0)
(-90064.6 3294.97 0)
(91052.3 534.436 0)
(-2971.82 477.373 0)
(2837.77 502.054 0)
(441.104 506.479 0)
(11.5766 506.618 0)
(0.0281064 506.618 0)
(4.03931e-06 506.618 0)
(7.80013e-10 506.618 0)
(6.0451e-10 506.618 0)
(-1.65753e-09 506.618 0)
(-7.21512e-10 506.618 0)
(1.44302e-09 506.618 0)
(2.02803e-09 506.618 0)
(-1.03352e-09 506.618 0)
(1.56003e-10 506.618 0)
(2.08653e-09 506.618 0)
(-1.63803e-09 506.618 0)
(1.56003e-10 506.618 0)
(-1.50152e-09 506.618 0)
(0 506.618 0)
(-3.12005e-10 506.618 0)
(-2.69104e-09 506.618 0)
(1.38452e-09 506.618 0)
(5.85009e-11 506.618 0)
(1.57953e-09 506.618 0)
(3.37355e-09 506.618 0)
(-1.20902e-09 506.618 0)
(-5.07008e-10 506.618 0)
(0 506.618 0)
(4.87508e-10 506.618 0)
(1.54052e-09 506.618 0)
(-2.04753e-09 506.618 0)
(2.14503e-10 506.618 0)
(-4.03898e-06 506.618 0)
(-0.0281064 506.618 0)
(-11.5766 506.618 0)
(-441.104 506.479 0)
(-2837.77 502.054 0)
(2971.82 477.373 0)
(-91052.3 534.436 0)
(91080.7 14.9635 0)
(-2972.42 13.5128 0)
(2838.7 14.3399 0)
(441.25 14.4872 0)
(11.581 14.4918 0)
(0.0281186 14.4918 0)
(4.0413e-06 14.4918 0)
(4.13407e-09 14.4918 0)
(-1.75503e-10 14.4918 0)
(9.75016e-11 14.4918 0)
(2.82755e-09 14.4918 0)
(2.73004e-10 14.4918 0)
(-3.51006e-10 14.4918 0)
(-2.71054e-09 14.4918 0)
(-1.77453e-09 14.4918 0)
(6.63011e-10 14.4918 0)
(-2.39854e-09 14.4918 0)
(-2.41804e-09 14.4918 0)
(7.21512e-10 14.4918 0)
(1.54052e-09 14.4918 0)
(1.15052e-09 14.4918 0)
(2.28154e-09 14.4918 0)
(-1.28702e-09 14.4918 0)
(-1.07252e-09 14.4918 0)
(1.22852e-09 14.4918 0)
(3.51006e-10 14.4918 0)
(1.44302e-09 14.4918 0)
(-1.28702e-09 14.4918 0)
(-2.39854e-09 14.4918 0)
(-4.09507e-10 14.4918 0)
(-4.29007e-10 14.4918 0)
(2.35954e-09 14.4918 0)
(2.41804e-09 14.4918 0)
(-4.04294e-06 14.4918 0)
(-0.0281186 14.4918 0)
(-11.581 14.4918 0)
(-441.25 14.4872 0)
(-2838.7 14.3399 0)
(2972.42 13.5128 0)
(-91080.7 14.9635 0)
(91080.8 0.040774 0)
(-2972.42 0.0367 0)
(2838.7 0.039414 0)
(441.25 0.0398855 0)
(11.581 0.0398999 0)
(0.0281187 0.0398999 0)
(4.04288e-06 0.0398999 0)
(-1.32602e-09 0.0398999 0)
(-4.68008e-10 0.0398999 0)
(1.56003e-09 0.0398999 0)
(-1.96953e-09 0.0398999 0)
(-7.60512e-10 0.0398999 0)
(2.39854e-09 0.0398999 0)
(8.77514e-10 0.0398999 0)
(1.95003e-10 0.0398999 0)
(-3.90006e-11 0.0398999 0)
(-4.87508e-10 0.0398999 0)
(0 0.0398999 0)
(4.87508e-10 0.0398999 0)
(0 0.0398999 0)
(-6.4351e-10 0.0398999 0)
(-1.09202e-09 0.0398999 0)
(0 0.0398999 0)
(1.03352e-09 0.0398999 0)
(-2.00853e-09 0.0398999 0)
(-2.14503e-10 0.0398999 0)
(8.19013e-10 0.0398999 0)
(1.95003e-11 0.0398999 0)
(-8.38514e-10 0.0398999 0)
(2.14503e-10 0.0398999 0)
(2.00853e-09 0.0398999 0)
(-8.77514e-10 0.0398999 0)
(-1.52102e-09 0.0398999 0)
(-4.04191e-06 0.0398999 0)
(-0.0281187 0.0398999 0)
(-11.581 0.0398999 0)
(-441.25 0.0398855 0)
(-2838.7 0.039414 0)
(2972.42 0.0367 0)
(-91080.8 0.040774 0)
(91080.8 6.83158e-06 0)
(-2972.42 6.09521e-06 0)
(2838.7 6.65216e-06 0)
(441.25 6.74424e-06 0)
(11.581 6.74748e-06 0)
(0.0281187 6.75029e-06 0)
(4.04013e-06 6.74883e-06 0)
(0 6.74799e-06 0)
(0 6.75017e-06 0)
(0 6.74847e-06 0)
(0 6.74853e-06 0)
(-1.95003e-11 6.75052e-06 0)
(1.95003e-11 6.74937e-06 0)
(0 6.74805e-06 0)
(0 6.74844e-06 0)
(-1.95003e-11 6.74783e-06 0)
(1.95003e-11 6.74847e-06 0)
(0 6.74834e-06 0)
(0 6.74847e-06 0)
(0 6.74781e-06 0)
(0 6.74847e-06 0)
(-1.95003e-11 6.74847e-06 0)
(0 6.74961e-06 0)
(1.95003e-11 6.74847e-06 0)
(0 6.74855e-06 0)
(0 6.75056e-06 0)
(0 6.74879e-06 0)
(0 6.74968e-06 0)
(-1.95003e-11 6.74877e-06 0)
(1.95003e-11 6.75056e-06 0)
(0 6.74855e-06 0)
(-1.95003e-11 6.74847e-06 0)
(0 6.74945e-06 0)
(-4.03943e-06 6.75005e-06 0)
(-0.0281187 6.75076e-06 0)
(-11.581 6.74961e-06 0)
(-441.25 6.74569e-06 0)
(-2838.7 6.65499e-06 0)
(2972.42 6.09732e-06 0)
(-91080.8 6.83406e-06 0)
(91080.8 -2.78855e-09 0)
(-2972.42 -3.13955e-09 0)
(2838.7 -2.20354e-09 0)
(441.25 -8.38514e-10 0)
(11.581 -1.48202e-09 0)
(0.0281187 -6.4351e-10 0)
(4.04066e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04068e-06 0 0)
(-0.0281187 -1.79403e-09 0)
(-11.581 1.17002e-10 0)
(-441.25 3.54906e-09 0)
(-2838.7 1.34552e-09 0)
(2972.42 4.87508e-10 0)
(-91080.8 -3.12005e-09 0)
(91080.8 2.04753e-09 0)
(-2972.42 1.42352e-09 0)
(2838.7 -1.09202e-09 0)
(441.25 3.90006e-11 0)
(11.581 -1.32602e-09 0)
(0.0281187 9.75016e-10 0)
(4.04074e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04115e-06 0 0)
(-0.0281187 1.32602e-09 0)
(-11.581 3.12005e-10 0)
(-441.25 -6.82511e-10 0)
(-2838.7 9.16515e-10 0)
(2972.42 5.85009e-11 0)
(-91080.8 1.57953e-09 0)
(91080.8 -2.73004e-10 0)
(-2972.42 1.36502e-10 0)
(2838.7 1.26752e-09 0)
(441.25 7.02011e-10 0)
(11.581 4.87508e-10 0)
(0.0281187 6.82511e-10 0)
(4.03972e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 1.95003e-11 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03939e-06 0 0)
(-0.0281187 1.13102e-09 0)
(-11.581 -1.61853e-09 0)
(-441.25 -1.17002e-10 0)
(-2838.7 -6.2401e-10 0)
(2972.42 -2.04753e-09 0)
(-91080.8 1.17002e-09 0)
(91080.8 8.58014e-10 0)
(-2972.42 -1.75503e-10 0)
(2838.7 -4.68008e-10 0)
(441.25 -9.75016e-11 0)
(11.581 -1.48202e-09 0)
(0.0281187 -6.82511e-10 0)
(4.04009e-06 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 3.90006e-11 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 3.90006e-11 0)
(0 3.90006e-11 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-4.04008e-06 0 0)
(-0.0281187 -8.19013e-10 0)
(-11.581 -1.98903e-09 0)
(-441.25 2.35954e-09 0)
(-2838.7 -5.07008e-10 0)
(2972.42 -1.01402e-09 0)
(-91080.8 -1.69653e-09 0)
(91080.8 8.38514e-10 0)
(-2972.42 1.13102e-09 0)
(2838.7 -1.24802e-09 0)
(441.25 -2.73004e-10 0)
(11.581 -8.97015e-10 0)
(0.0281187 -1.30652e-09 0)
(4.04037e-06 1.95003e-11 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 -1.95003e-11 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 -3.90006e-11 0)
(0 -1.95003e-11 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(-4.04015e-06 0 0)
(-0.0281187 -6.0451e-10 0)
(-11.581 -2.35954e-09 0)
(-441.25 -3.00305e-09 0)
(-2838.7 9.94516e-10 0)
(2972.42 -7.02011e-10 0)
(-91080.8 -1.71603e-09 0)
(91080.8 -1.11152e-09 0)
(-2972.42 1.30652e-09 0)
(2838.7 1.17002e-10 0)
(441.25 -4.09507e-10 0)
(11.581 7.80013e-11 0)
(0.0281187 5.85009e-11 0)
(4.04134e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04066e-06 0 0)
(-0.0281187 7.80013e-11 0)
(-11.581 3.12005e-10 0)
(-441.25 -5.26509e-10 0)
(-2838.7 -1.61853e-09 0)
(2972.42 -1.20902e-09 0)
(-91080.8 -2.34004e-10 0)
(91080.8 9.75016e-10 0)
(-2972.42 1.77453e-09 0)
(2838.7 1.83303e-09 0)
(441.25 1.56003e-10 0)
(11.581 1.42352e-09 0)
(0.0281187 2.12553e-09 0)
(4.04033e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(-4.04008e-06 0 0)
(-0.0281187 1.40402e-09 0)
(-11.581 3.31505e-09 0)
(-441.25 6.63011e-10 0)
(-2838.7 1.57953e-09 0)
(2972.42 2.73004e-09 0)
(-91080.8 3.52956e-09 0)
(91080.8 2.41804e-09 0)
(-2972.42 5.65509e-10 0)
(2838.7 1.63803e-09 0)
(441.25 1.13102e-09 0)
(11.581 4.11457e-09 0)
(0.0281187 1.54052e-09 0)
(4.0393e-06 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(3.90006e-11 0 0)
(0 -1.95003e-11 0)
(-3.90006e-11 0 0)
(1.95003e-11 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(1.95003e-11 1.95003e-11 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(1.95003e-11 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.0393e-06 0 0)
(-0.0281187 1.56003e-09 0)
(-11.581 1.65753e-09 0)
(-441.25 -2.73004e-09 0)
(-2838.7 -1.28702e-09 0)
(2972.42 1.36502e-10 0)
(-91080.8 2.20354e-09 0)
(91080.8 1.60234e-07 0)
(-2972.42 5.40012e-06 0)
(2838.7 1.18702e-06 0)
(441.25 4.71128e-08 0)
(11.581 4.29007e-10 0)
(0.0281187 -1.38452e-09 0)
(4.03887e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(1.95003e-11 -1.95003e-11 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(1.95003e-11 0 0)
(-1.95003e-11 0 0)
(0 0 0)
(0 0 0)
(-4.03859e-06 0 0)
(-0.0281187 4.29007e-10 0)
(-11.581 6.82511e-10 0)
(-441.25 2.22304e-09 0)
(-2838.7 -2.43754e-09 0)
(2972.42 -3.12005e-10 0)
(-91080.8 -2.37904e-09 0)
(91080.8 -0.00138526 0)
(-2972.42 0.0296818 0)
(2838.7 0.0063284 0)
(441.25 0.000239103 0)
(11.581 7.3719e-07 0)
(0.0281187 -3.31505e-10 0)
(4.0406e-06 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.03889e-06 0 0)
(-0.0281187 -1.17002e-09 0)
(-11.581 -5.85009e-10 0)
(-441.25 2.78855e-09 0)
(-2838.7 6.63011e-10 0)
(2972.42 1.93053e-09 0)
(-91080.8 1.36502e-10 0)
(91080.8 -4.07554 0)
(-2972.41 10.6185 0)
(2838.68 2.12852 0)
(441.244 0.0736259 0)
(11.5808 0.000216093 0)
(0.028118 3.51591e-08 0)
(4.03918e-06 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.0397e-06 0 0)
(-0.0281187 -2.71054e-09 0)
(-11.581 -8.58014e-10 0)
(-441.25 9.75016e-10 0)
(-2838.7 9.16515e-10 0)
(2972.42 3.90006e-11 0)
(-91080.8 1.91103e-09 0)
(91087.8 -361.6 0)
(-2966.44 411.388 0)
(2828.54 72.1419 0)
(439.199 2.13036 0)
(11.5101 0.00560885 0)
(0.0279104 8.53041e-07 0)
(4.00671e-06 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-4.04148e-06 0 0)
(-0.0281187 1.95003e-11 0)
(-11.581 6.4351e-10 0)
(-441.25 7.80013e-10 0)
(-2838.7 -3.12005e-10 0)
(2972.42 -5.85009e-11 0)
(-91080.8 0 0)
(91179.3 -3122.05 0)
(-2554.45 2642.99 0)
(2444.3 377.789 0)
(371.731 9.39267 0)
(9.52791 0.022287 0)
(0.0227131 3.20154e-06 0)
(3.21716e-06 0 0)
(0 3.90006e-11 0)
(0 0 0)
(0 3.90006e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -1.95003e-11 0)
(0 3.90006e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 1.95003e-11 0)
(0 0 0)
(-4.03972e-06 1.95003e-11 0)
(-0.0281187 3.49056e-09 0)
(-11.581 -1.75503e-10 0)
(-441.25 -1.40402e-09 0)
(-2838.7 -2.74954e-09 0)
(2972.42 -3.43206e-09 0)
(-91080.8 -1.40402e-09 0)
)
;
boundaryField
{
inlet
{
type extrapolatedCalculated;
value nonuniform List<vector> 5((-3.63798e-11 -1.77636e-11 0) (0 1.77636e-11 0) (0 0 0) (0 0 0) (0 0 0));
}
outlet
{
type extrapolatedCalculated;
value nonuniform List<vector>
165
(
(191632 3122.05 0)
(192910 361.6 0)
(192924 4.07554 0)
(192924 0.00138526 0)
(192924 -1.61385e-07 0)
(192924 -4.15357e-09 0)
(192924 -1.38452e-09 0)
(192924 3.29555e-09 0)
(192924 -4.48507e-10 0)
(192924 -2.67154e-09 0)
(192924 -7.41012e-10 0)
(192924 -3.51006e-10 0)
(192924 7.80013e-11 0)
(192924 -6.83057e-06 0)
(192924 -0.040774 0)
(192924 -14.9635 0)
(192865 -534.436 0)
(190782 -3294.97 0)
(179613 3441.23 0)
(203616 -99433 0)
(96146.5 -211299 0)
(-3106.08 -187762 0)
(3010.31 -198830 0)
(466.975 -200794 0)
(11.9773 -200846 0)
(0.0287657 -200846 0)
(4.09253e-06 -200846 0)
(-1.83303e-09 -200846 0)
(3.49056e-09 -200846 0)
(1.89153e-09 -200846 0)
(-2.71054e-09 -200846 0)
(-1.48202e-09 -200846 0)
(1.17002e-10 -200846 0)
(-1.89153e-09 -200846 0)
(-1.32602e-09 -200846 0)
(2.98355e-09 -200846 0)
(3.15905e-09 -200846 0)
(8.58014e-10 -200846 0)
(7.60512e-10 -200846 0)
(3.12005e-10 -200846 0)
(-3.70506e-10 -200846 0)
(-2.88605e-09 -200846 0)
(-2.14503e-10 -200846 0)
(2.37904e-09 -200846 0)
(-2.10603e-09 -200846 0)
(-2.73004e-10 -200846 0)
(-3.12005e-10 -200846 0)
(-1.75503e-10 -200846 0)
(9.75016e-11 -200846 0)
(5.26509e-10 -200846 0)
(2.55454e-09 -200846 0)
(-2.59354e-09 -200846 0)
(-1.89153e-09 -200846 0)
(-4.09329e-06 -200846 0)
(-0.0287657 -200846 0)
(-11.9773 -200846 0)
(-466.975 -200794 0)
(-3010.31 -198830 0)
(3106.08 -187762 0)
(-96146.5 -211299 0)
(-192924 1.11152e-09 0)
(-192924 -3.31505e-10 0)
(-192924 -3.12005e-09 0)
(-192924 3.31505e-10 0)
(-192924 2.34004e-09 0)
(-192924 -2.28154e-09 0)
(-192924 -3.47106e-09 0)
(-192924 -1.95003e-11 0)
(-192924 1.81353e-09 0)
(-192924 -1.56003e-10 0)
(-192924 -2.16453e-09 0)
(-192924 -1.81353e-09 0)
(-192924 2.37904e-09 0)
(-192924 -6.82747e-06 0)
(-192924 -0.040774 0)
(-192924 -14.9635 0)
(-192865 -534.436 0)
(-190782 -3294.97 0)
(-179613 3441.23 0)
(-203616 -99433 0)
(-192924 -6.45948e-09 0)
(-192924 1.67946e-09 0)
(-192924 7.94516e-09 0)
(-192924 2.32541e-09 0)
(-192924 9.68922e-10 0)
(-203616 99433 0)
(-179613 -3441.23 0)
(-190782 3294.97 0)
(-192865 534.436 0)
(-192924 14.9635 0)
(-192924 0.040774 0)
(-192924 6.83406e-06 0)
(-192924 -3.12005e-09 0)
(-192924 1.57953e-09 0)
(-192924 1.17002e-09 0)
(-192924 -1.69653e-09 0)
(-192924 -1.71603e-09 0)
(-192924 -2.34004e-10 0)
(-192924 3.52956e-09 0)
(-192924 2.20354e-09 0)
(-192924 -2.37904e-09 0)
(-192924 1.36502e-10 0)
(-192924 1.91103e-09 0)
(-192924 0 0)
(-192924 -1.40402e-09 0)
(96146.5 211299 0)
(-3106.08 187762 0)
(3010.31 198830 0)
(466.975 200794 0)
(11.9773 200846 0)
(0.0287657 200846 0)
(4.09317e-06 200846 0)
(-9.75016e-11 200846 0)
(1.93053e-09 200846 0)
(-1.36502e-09 200846 0)
(-2.63254e-09 200846 0)
(1.50152e-09 200846 0)
(2.24254e-09 200846 0)
(-5.46009e-10 200846 0)
(6.4351e-10 200846 0)
(2.06703e-09 200846 0)
(-1.75503e-09 200846 0)
(-1.73553e-09 200846 0)
(-1.56003e-09 200846 0)
(-1.75503e-10 200846 0)
(-2.73004e-10 200846 0)
(-8.38514e-10 200846 0)
(5.46009e-10 200846 0)
(-3.12005e-10 200846 0)
(5.26509e-10 200846 0)
(1.30652e-09 200846 0)
(-1.95003e-11 200846 0)
(2.73004e-10 200846 0)
(6.0451e-10 200846 0)
(0 200846 0)
(-7.41012e-10 200846 0)
(-7.60512e-10 200846 0)
(-1.95003e-11 200846 0)
(-4.09325e-06 200846 0)
(-0.0287657 200846 0)
(-11.9773 200846 0)
(-466.975 200794 0)
(-3010.31 198830 0)
(3106.08 187762 0)
(-96146.5 211299 0)
(203616 99433 0)
(179613 -3441.23 0)
(190782 3294.97 0)
(192865 534.436 0)
(192924 14.9635 0)
(192924 0.040774 0)
(192924 6.83158e-06 0)
(192924 -2.78855e-09 0)
(192924 2.04753e-09 0)
(192924 -2.73004e-10 0)
(192924 8.58014e-10 0)
(192924 8.38514e-10 0)
(192924 -1.11152e-09 0)
(192924 9.75016e-10 0)
(192924 2.41804e-09 0)
(192924 1.60234e-07 0)
(192924 -0.00138526 0)
(192924 -4.07554 0)
(192910 -361.6 0)
(191632 -3122.05 0)
)
;
}
obstacle
{
type extrapolatedCalculated;
value nonuniform List<vector>
40
(
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 3.63798e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.77636e-11 0 0)
(-1.77636e-11 -3.63798e-11 0)
(0 0 0)
(1.77636e-11 -3.63798e-11 0)
(0 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 -3.63798e-11 0)
(0 0 0)
(-1.77636e-11 0 0)
(1.77636e-11 -3.63798e-11 0)
(0 0 0)
(3.09674e-09 2.06449e-09 1.3749e-11)
(2.38496e-08 1.58997e-08 -1.66435e-11)
(-5.39045e-07 -3.59363e-07 -2.10818e-11)
(-4.63452e-05 -3.08969e-05 0)
(-0.000319398 -0.000212932 -9.03505e-11)
(3.33469e-09 -2.16615e-09 -4.1247e-11)
(2.32832e-08 -1.55221e-08 -1.66435e-11)
(-5.40622e-07 3.60414e-07 -2.10818e-11)
(-4.6345e-05 3.08967e-05 -5.74958e-11)
(-0.000319399 0.000212933 9.03505e-11)
(0.00999188 0.00111021 1.91653e-11)
(9.92626 1.10292 3.32163e-17)
(265.068 29.452 0)
(1481.65 164.627 -4.95804e-15)
(614.215 68.2462 1.12381e-11)
(0.00999189 -0.00111021 3.83305e-11)
(9.92626 -1.10292 -3.24336e-11)
(265.068 -29.452 0)
(1481.65 -164.627 2.48709e-11)
(614.215 -68.2462 -1.12381e-11)
)
;
}
empty
{
type empty;
}
}
// ************************************************************************* //
| |
2424fad6f90aff588cc17b25a9b03d678116a13f | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/clang/test/Driver/warning-options_pedantic.cpp | e40f7716f4136bfad4d0d85b9cc0e8ffec0480e7 | [
"MIT",
"NCSA"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 483 | cpp | warning-options_pedantic.cpp | // RUN: %clang -### -pedantic -no-pedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC %s
// RUN: %clang -### -pedantic -Wno-pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC %s
// NO_PEDANTIC-NOT: -pedantic
// RUN: %clang -### -pedantic -pedantic -no-pedantic -pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC %s
// RUN: %clang -### -pedantic -pedantic -no-pedantic -Wpedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC %s
// PEDANTIC: -pedantic
// REQUIRES: clang-driver
|
d3e5b28045c382a8189f1e59410cf415aba27908 | 95a03f4b55cb1ded62395d90baeae33283aaadd5 | /src/main.cpp | de890a4464b742e16f13d3344716faac462d7e69 | [] | no_license | cld-gh/cpp-with-gtest-example | 406454cbb5c55304d31f83979e04fa4f8268c157 | adf5dd5d5a7e5ad847754777b13c8d70be7f9083 | refs/heads/master | 2022-12-08T06:28:00.777100 | 2019-10-20T16:20:36 | 2019-10-20T16:20:36 | 216,345,701 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 252 | cpp | main.cpp | // Copyright 2019, CLD.
#include <iostream>
#include <array>
#include "foo.h"
int main() {
int x = 2;
int y = 4;
int result;
result = x + y;
std::cout << "executing project code: value = " << result << std::endl;
return 0;
}
|
b09e12afddd39a600f3098566ef1900d6e3034d3 | 4b8823d80f49f1338875131f100416d6fbe75965 | /game.cpp | 2f9bf3b6878cfeb90adc6c196a0cf02865962867 | [
"MIT"
] | permissive | ThatOtherOtherBob/Solitaire | 519c7e4263047d245d4fe10c880b135e08637eef | bc228c8affb9467d85ecf44ff42485f42fe835a1 | refs/heads/main | 2023-05-31T02:07:51.080942 | 2021-06-06T01:54:07 | 2021-06-06T01:54:07 | 374,246,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | cpp | game.cpp | #include "game.hpp"
#include "Field.hpp"
Field field;
///////////////////////////////////////////////////////////////////////////
//
// init()
//
// setup your game here
//
void init()
{
field.Setup();
}
///////////////////////////////////////////////////////////////////////////
//
// render(time)
//
// This function is called to perform rendering of the game. time is the
// amount if milliseconds elapsed since the start of your game
//
void render(uint32_t time)
{
field.Render();
}
///////////////////////////////////////////////////////////////////////////
//
// update(time)
//
// This is called to update your game state. time is the
// amount if milliseconds elapsed since the start of your game
//
void update(uint32_t time)
{
field.Update();
} |
9f807b9de769bbd350659ae6b89c7131aa74cd25 | 549729e902d3eb24112d88cc1428eb287c2107b8 | /QuantCommunitySecurity/src/Capturer.h | 4b911b002dbad6f3ae3eafb7b84dc3efb787f504 | [] | no_license | u12206050/Andrologists2014 | 94ef039b70eb3e26753b7cfdbfdf5ede330ef8d3 | 9daa4e993ed8e9e28e1f02d342b0a38724499bee | refs/heads/master | 2020-05-31T04:01:33.413553 | 2014-10-19T20:55:21 | 2014-10-19T20:55:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 170 | h | Capturer.h | #ifndef CAPTURER_H
#define CAPTURER_H
#include "ImageData.h"
class Capturer
{
public:
virtual ~Capturer();
virtual ImageData* getNextImage() = 0;
};
#endif
|
940d1757d312a3c56f1387012ff7811722d66f70 | 1f78692f10efe1b9d172869b34f16aaf3c14e1f0 | /72editdistance.cpp | 327dd24da96063582646bbe17fd51221210e3298 | [] | no_license | isVoid/Leet_codebase | 5b2a77f87639f24dd81d9c2e23f24fffc2c1c179 | e28685d84248f26462eede0513aa2853528b37c2 | refs/heads/master | 2022-01-22T17:06:56.399192 | 2019-07-20T03:19:01 | 2019-07-20T03:19:01 | 197,872,934 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,284 | cpp | 72editdistance.cpp | #include <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include "dbg.hpp"
using namespace std;
struct ListNode;
struct TreeNode;
class Solution {
public:
//12ms 92.85%
//11.3MB 37.42%
int minDistance(string word1, string word2) {
vector< vector<int> > dp(word1.length()+1, vector<int>(word2.length()+1, 0));
for (int i = 0; i <= word1.length(); i++) {
dp[i][0] = i;
}
for (int j = 0; j <= word2.length(); j++) {
dp[0][j] = j;
}
for (int i = 1; i <= word1.length(); i++) {
for (int j = 1; j <= word2.length(); j++) {
if (word1[i-1] == word2[j-1]) {
dp[i][j] = dp[i-1][j-1];
}
else {
dp[i][j] = min(min(dp[i-1][j] + 1, dp[i][j-1] + 1), dp[i-1][j-1] + 1);
}
}
}
printMatrix(dp);
return dp[word1.length()][word2.length()];
}
};
int main(int argc, char ** argv) {
// string a = "horse", b = "ros";
string a = "intention", b = "execution";
cout << Solution().minDistance(a, b) << endl;
return 0;
} |
b3d3c84a324b22924294831c625e0301b47c4f7e | 700da8c16757ba295296d9e6e25491e0cd89d494 | /src/gui/GLVertexArray.cpp | e261e5e749563ece8f2abdcf16fbdd88bb75698e | [
"BSD-3-Clause"
] | permissive | mlivesu/NSEssentials | 99a3ac6a0830b650669bee579f227769ae960fa7 | e5bceb01708368756528fdc95054bd3d05b7b745 | refs/heads/master | 2022-04-01T03:53:47.302670 | 2019-08-30T23:42:32 | 2019-08-30T23:42:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 696 | cpp | GLVertexArray.cpp | /*
This file is part of NSEssentials.
Use of this source code is granted via a BSD-style license, which can be found
in License.txt in the repository root.
@author Nico Schertler
*/
#ifdef HAVE_NANOGUI
#include "nsessentials/gui/GLVertexArray.h"
using namespace nse::gui;
GLVertexArray::GLVertexArray()
: vaoId(0)
{
}
GLVertexArray::~GLVertexArray()
{
if (vaoId > 0)
glDeleteVertexArrays(1, &vaoId);
}
void GLVertexArray::generate()
{
if (vaoId == 0)
glGenVertexArrays(1, &vaoId);
}
void GLVertexArray::bind() const
{
glBindVertexArray(vaoId);
}
void GLVertexArray::unbind() const
{
glBindVertexArray(0);
}
bool GLVertexArray::valid() const
{
return vaoId != 0;
}
#endif |
fbc4101ea0dbd1e5ad18787bbd1986bd4804fd07 | 7ed01a1a9903f6ad3f4391cb4039d78d010e5173 | /Trabalho3/Principais.cpp | 22be1562925a0b05843325f49e57516daadf4b32 | [] | no_license | wilsonufrj/LigProg | 9bbe875db934e6bdc0076f6163ed9ea63b869a67 | 7f92d33fe5454f3fed13bea25a6752504ad96684 | refs/heads/master | 2023-06-04T02:15:58.705705 | 2021-06-21T12:35:18 | 2021-06-21T12:35:18 | 352,169,626 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,309 | cpp | Principais.cpp | #include "Principais.h"
void AdicionaFilme(Catalogo &catalogo){
Filme *aux = new Filme();
cin>>*aux;
catalogo+=*aux;
}
//Falta testar
void RemoveFilme(Catalogo &catalogo){
string nomeFilme;
bool deletou = false;
cout<<"Insira o nome do filme que sera removido "<<endl;
cin>>nomeFilme;
for(unsigned i=0; i<catalogo.cont;i++){
if(nomeFilme == catalogo.filmes[i]->nome){
catalogo-=*(catalogo.filmes[i]);
cout<<"Filme Deletado"<<endl;
deletou= true;
}
}
if(!deletou)
cout<<"Filme não encontrado"<<endl;
}
//FALTA TESTAR
void EditaFilme(Catalogo &catalogo){
string novoValor;
string filme;
int nota;
cout<<"Qual da propriedades editar ?"<<endl;
cout<<" 1 - Editar Filme ou Produtora"<<endl;
cout<<" 2 - Editar Nota do filme"<<endl;
int escolha=0;
cin>>escolha;
switch(escolha){
case 1:{
cout<<"Insira o nome do filme"<<endl;
cin>>filme;
cout<<"Insira o novo nome que sera adicionado"<<endl;
cin>>novoValor;
//Rever para a entrega
if(catalogo.operator()(filme,novoValor)!=NULL){
cout<<"Filme Modificado"<<endl;
}
else cout<<"Filme inexistente";
break;
}
case 2:{
cout<<"Insira o nome do filme"<<endl;
cin>>filme;
cout<<"Insira o valor a ser editado"<<endl;
cin>>nota;
//Rever para a entrega
if(catalogo.operator()(filme,nota)!=NULL){
cout<<"Filme Modificado"<<endl;
}
else cout<<"Filme inexistente";
break;
}
}
}
//FALTA TESTAR
void MostraCatalogo(Catalogo &catalogo){
cout<<catalogo;
}
//FALTA TESTAR
void MostraFilmeCatalogo(Catalogo &catalogo){
string nomeFilme;
bool achou=false;
cout<<"Qual o nome do filme? "<<endl;
cin>>nomeFilme;
for(unsigned i=0; i<catalogo.cont;i++){
if(nomeFilme == catalogo.filmes[i]->nome){
cout<<*(catalogo.filmes[i]);
achou = true;
}
}
if(!achou)
cout<<"Filme não encontrado"<<endl;
}
void melhorFilme(Catalogo &catalogo){
catalogo.melhorFilme();
}
|
eb46df175cc3661b69f5b964147752d99459c130 | 0e330acab757857fb0855b8a03e4f1c113e64b13 | /include/latmrg/Rank1Lattice.h | f16a4bae8460478d6864ef0ca07e12a9763b3771 | [] | no_license | erwanbou/LatMRG | 8ce14730ac68feba840f1c04d45a0ce251bff8f1 | 8ecc3a9c95c211f0fe534de54c4217f1baaf1a63 | refs/heads/master | 2021-01-23T12:33:45.686517 | 2017-09-01T22:09:56 | 2017-09-01T22:09:56 | 93,171,349 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,768 | h | Rank1Lattice.h | #ifndef RANK1LATTICE_H
#define RANK1LATTICE_H
#include "latticetester/Types.h"
#include "latticetester/Const.h"
#include "latmrg/IntLattice.h"
namespace LatMRG {
/**
* This class implements a general rank 1 lattice basis. For the values
* \f$a_1, a_2, …, a_d\f$ given, the \f$d\f$-dimensional lattice basis is
* formed as:
* \f[
* \mathbf{b_1} = (a_1, a_2, …, a_d),\quad\mathbf{b_2} = (0, n, 0, …, 0),\quad…, \quad\mathbf{b_d} = (0, …, 0, n)
* \f]
* Without loss of generality, one may choose \f$a_1 = 1\f$.
*
* \warning There is some code duplication with LatticeTester::Rank1Lattice. This
* should be fixed in the future.
*
*/
class Rank1Lattice: public LatMRG::IntLattice {
public:
/**
* Constructor. \f$d\f$ represents the number of multipliers in the array
* `a`.
*/
Rank1Lattice (const MScal & n, const MVect & a, int d,
LatticeTester::NormType norm = LatticeTester::L2NORM);
/**
* Copy constructor.
*/
Rank1Lattice (const Rank1Lattice & Lat);
/**
* Assigns `Lat` to this object.
*/
Rank1Lattice & operator= (const Rank1Lattice & Lat);
/**
* Destructor.
*/
~Rank1Lattice();
/**
* Returns the vector of multipliers \f$a\f$ as a string.
*/
std::string toStringCoef() const;
/**
* Builds the basis in dimension \f$d\f$.
*/
void buildBasis (int d);
/**
* Dualize the matrix. The matrix entered need to have
* the particular shape describe ERWAN
*/
void dualize ();
/**
* Increases the dimension by 1.
*/
void incDim ();
protected:
/**
* Initializes the rank 1 lattice.
*/
void init();
/**
* The multipliers of the rank 1 lattice rule.
*/
MVect m_a;
};
}
#endif
|
d3cec421c5d3e18d826f17bc906e64f489f17b0b | 55f4f491da985c7e9c623a7e9836325a658f6dd5 | /include/cutf/stream.hpp | 49270cc7f190400e55ee5119436925c12fe9a7cb | [
"MIT"
] | permissive | enp1s0/cutf | 6e66a781cc25522724bba0d32cab40abc08254f4 | 061c484d98d8b87d1a86c58806c0e8d9df8e02f6 | refs/heads/master | 2023-08-22T09:09:13.264257 | 2023-08-09T13:49:39 | 2023-08-09T13:49:39 | 156,302,548 | 13 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | hpp | stream.hpp | #ifndef __CUTF_STREAM_HPP__
#define __CUTF_STREAM_HPP__
#include <memory>
#include <cuda_runtime.h>
#include "cuda.hpp"
namespace cutf{
namespace stream{
struct stream_deleter{
void operator()(cudaStream_t *stream){
cudaStreamDestroy(*stream);
delete stream;
}
};
using stream_unique_ptr = std::unique_ptr<cudaStream_t, stream_deleter>;
inline stream_unique_ptr get_stream_unique_ptr(){
stream_unique_ptr stream(new cudaStream_t);
cutf::error::check(cudaStreamCreate(stream.get()), __FILE__, __LINE__, __func__, "@ Creating stream");
return stream;
}
} // stream
} // cutf
#endif // __CUTF_STREAM_HPP__
|
af4d6eaa7bb443cf03c04ce769b12e5adab960e5 | 54831db914ba448de3917265324430d4145e4a84 | /src/game/uniform_mat4.h | 070c35447d35e99b6d7d63ce005429ad38e8e917 | [] | no_license | kitohe/game | cddb674d6d290453d095b4113467ffad500bd3f0 | 5c10be9233d379af1f942a34b0f15811cb62afea | refs/heads/master | 2023-01-03T20:54:38.140308 | 2020-10-23T21:22:03 | 2020-10-23T21:22:03 | 300,284,226 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 190 | h | uniform_mat4.h | #pragma once
#include "uniform.h"
class uniform_mat4 : public uniform
{
public:
uniform_mat4(const GLchar* name): uniform(name) { }
void load_matrix(glm::mat4 matrix) const;
};
|
2b88770d92bb271dba285231d9d85c5b4d5819f3 | e5e63362c73829083ebcfcb9fb3605204a4e5a5a | /kcms/colors/editor/scmeditorcolors.cpp | 348ddee88c6fa0a6b5d5504326b7fead72c75030 | [] | no_license | KDE/plasma-workspace | 7e5d1ebb3d21051d7ad410a8957770fe0b94a07e | c2666b9afba51a897e006ea7b68c5a693519cf15 | refs/heads/master | 2023-08-31T14:30:21.743316 | 2023-08-31T10:48:26 | 2023-08-31T13:28:32 | 42,736,075 | 216 | 108 | null | 2022-01-28T03:28:04 | 2015-09-18T17:13:10 | C++ | UTF-8 | C++ | false | false | 24,378 | cpp | scmeditorcolors.cpp | /* KDE Display color scheme setup module
SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
SPDX-FileCopyrightText: 2007 Jeremy Whiting <jpwhiting@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "scmeditorcolors.h"
#include <QColorDialog>
#include <KColorButton>
#include <KConfigGroup>
// BEGIN WindecoColors
SchemeEditorColors::WindecoColors::WindecoColors(const KSharedConfigPtr &config)
{
load(config);
}
void SchemeEditorColors::WindecoColors::load(const KSharedConfigPtr &config)
{
// NOTE: keep this in sync with kdelibs/kdeui/kernel/kglobalsettings.cpp
KConfigGroup group(config, "WM");
m_colors[ActiveBackground] = group.readEntry("activeBackground", QColor(48, 174, 232));
m_colors[ActiveForeground] = group.readEntry("activeForeground", QColor(255, 255, 255));
m_colors[InactiveBackground] = group.readEntry("inactiveBackground", QColor(224, 223, 222));
m_colors[InactiveForeground] = group.readEntry("inactiveForeground", QColor(75, 71, 67));
m_colors[ActiveBlend] = group.readEntry("activeBlend", m_colors[ActiveForeground]);
m_colors[InactiveBlend] = group.readEntry("inactiveBlend", m_colors[InactiveForeground]);
}
QColor SchemeEditorColors::WindecoColors::color(WindecoColors::Role role) const
{
return m_colors[role];
}
// END WindecoColors
SchemeEditorColors::SchemeEditorColors(KSharedConfigPtr config, QWidget *parent)
: QWidget(parent)
, m_config(config)
{
setupUi(this);
setupColorTable();
connect(colorSet, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SchemeEditorColors::updateColorTable);
}
void SchemeEditorColors::updateValues()
{
const int currentSet = colorSet->currentIndex() - 1;
setPreview->setPalette(m_config, (KColorScheme::ColorSet)currentSet);
colorPreview->setPalette(m_config);
}
void SchemeEditorColors::setupColorTable()
{
// first setup the common colors table
commonColorTable->verticalHeader()->hide();
commonColorTable->horizontalHeader()->hide();
commonColorTable->setShowGrid(false);
commonColorTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
int minWidth = QPushButton(i18n("Varies")).minimumSizeHint().width();
commonColorTable->horizontalHeader()->setMinimumSectionSize(minWidth);
commonColorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
for (int i = 0; i < 26; ++i) {
KColorButton *button = new KColorButton(this);
commonColorTable->setRowHeight(i, button->sizeHint().height());
button->setObjectName(QString::number(i));
connect(button, &KColorButton::changed, this, &SchemeEditorColors::colorChanged);
m_commonColorButtons << button;
if (i > 8 && i < 18) {
// Inactive Text row through Positive Text role all need a varies button
QPushButton *variesButton = new QPushButton(nullptr);
variesButton->setText(i18n("Varies"));
variesButton->setObjectName(QString::number(i));
connect(variesButton, &QPushButton::clicked, this, &SchemeEditorColors::variesClicked);
QStackedWidget *widget = new QStackedWidget(this);
widget->addWidget(button);
widget->addWidget(variesButton);
m_stackedWidgets.append(widget);
commonColorTable->setCellWidget(i, 1, widget);
} else {
commonColorTable->setCellWidget(i, 1, button);
}
}
// then the colorTable that the colorSets will use
colorTable->verticalHeader()->hide();
colorTable->horizontalHeader()->hide();
colorTable->setShowGrid(false);
colorTable->setRowCount(12);
colorTable->horizontalHeader()->setMinimumSectionSize(minWidth);
colorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
createColorEntry(i18n("Normal Background"), QStringLiteral("BackgroundNormal"), m_backgroundButtons, 0);
createColorEntry(i18n("Alternate Background"), QStringLiteral("BackgroundAlternate"), m_backgroundButtons, 1);
createColorEntry(i18n("Normal Text"), QStringLiteral("ForegroundNormal"), m_foregroundButtons, 2);
createColorEntry(i18n("Inactive Text"), QStringLiteral("ForegroundInactive"), m_foregroundButtons, 3);
createColorEntry(i18n("Active Text"), QStringLiteral("ForegroundActive"), m_foregroundButtons, 4);
createColorEntry(i18n("Link Text"), QStringLiteral("ForegroundLink"), m_foregroundButtons, 5);
createColorEntry(i18n("Visited Text"), QStringLiteral("ForegroundVisited"), m_foregroundButtons, 6);
createColorEntry(i18n("Negative Text"), QStringLiteral("ForegroundNegative"), m_foregroundButtons, 7);
createColorEntry(i18n("Neutral Text"), QStringLiteral("ForegroundNeutral"), m_foregroundButtons, 8);
createColorEntry(i18n("Positive Text"), QStringLiteral("ForegroundPositive"), m_foregroundButtons, 9);
createColorEntry(i18n("Focus Decoration"), QStringLiteral("DecorationFocus"), m_decorationButtons, 10);
createColorEntry(i18n("Hover Decoration"), QStringLiteral("DecorationHover"), m_decorationButtons, 11);
colorTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
colorTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
updateColorSchemes();
updateColorTable();
}
void SchemeEditorColors::createColorEntry(const QString &text, const QString &key, QList<KColorButton *> &list, int index)
{
KColorButton *button = new KColorButton(this);
button->setObjectName(QString::number(index));
connect(button, &KColorButton::changed, this, &SchemeEditorColors::colorChanged);
list.append(button);
m_colorKeys.insert(index, key);
QTableWidgetItem *label = new QTableWidgetItem(text);
colorTable->setItem(index, 0, label);
colorTable->setCellWidget(index, 1, button);
colorTable->setRowHeight(index, button->sizeHint().height());
}
void SchemeEditorColors::variesClicked()
{
// find which button was changed
const int row = sender()->objectName().toInt();
QColor color = QColorDialog::getColor(QColor(), this);
if (color.isValid()) {
changeColor(row, color);
m_stackedWidgets[row - 9]->setCurrentIndex(0);
}
}
void SchemeEditorColors::colorChanged(const QColor &newColor)
{
// find which button was changed
const int row = sender()->objectName().toInt();
changeColor(row, newColor);
}
void SchemeEditorColors::changeColor(int row, const QColor &newColor)
{
// update the m_colorSchemes for the selected colorSet
const int currentSet = colorSet->currentIndex() - 1;
if (currentSet == -1) {
// common colors is selected
switch (row) {
case 0:
// View Background button
KConfigGroup(m_config, "Colors:View").writeEntry("BackgroundNormal", newColor);
break;
case 1:
// View Text button
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNormal", newColor);
break;
case 2:
// Window Background Button
KConfigGroup(m_config, "Colors:Window").writeEntry("BackgroundNormal", newColor);
break;
case 3:
// Window Text Button
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNormal", newColor);
break;
case 4:
// Button Background button
KConfigGroup(m_config, "Colors:Button").writeEntry("BackgroundNormal", newColor);
break;
case 5:
// Button Text button
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNormal", newColor);
break;
case 6:
// Selection Background Button
KConfigGroup(m_config, "Colors:Selection").writeEntry("BackgroundNormal", newColor);
break;
case 7:
// Selection Text Button
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNormal", newColor);
break;
case 8:
// Selection Inactive Text Button
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundInactive", newColor);
break;
// buttons that could have varies in their place
case 9:
// Inactive Text Button (set all but Selection Inactive Text color)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundInactive", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundInactive", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundInactive", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundInactive", newColor);
break;
case 10:
// Active Text Button (set all active text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundActive", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundActive", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundActive", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundActive", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundActive", newColor);
break;
case 11:
// Link Text Button (set all link text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundLink", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundLink", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundLink", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundLink", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundLink", newColor);
break;
case 12:
// Visited Text Button (set all visited text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundVisited", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundVisited", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundVisited", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundVisited", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundVisited", newColor);
break;
case 13:
// Negative Text Button (set all negative text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNegative", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNegative", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNegative", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNegative", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNegative", newColor);
break;
case 14:
// Neutral Text Button (set all neutral text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNeutral", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNeutral", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNeutral", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNeutral", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNeutral", newColor);
break;
case 15:
// Positive Text Button (set all positive text colors)
KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundPositive", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundPositive", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundPositive", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundPositive", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundPositive", newColor);
break;
case 16:
// Focus Decoration Button (set all focus decoration colors)
KConfigGroup(m_config, "Colors:View").writeEntry("DecorationFocus", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("DecorationFocus", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("DecorationFocus", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("DecorationFocus", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("DecorationFocus", newColor);
break;
case 17:
// Hover Decoration Button (set all hover decoration colors)
KConfigGroup(m_config, "Colors:View").writeEntry("DecorationHover", newColor);
KConfigGroup(m_config, "Colors:Window").writeEntry("DecorationHover", newColor);
KConfigGroup(m_config, "Colors:Selection").writeEntry("DecorationHover", newColor);
KConfigGroup(m_config, "Colors:Button").writeEntry("DecorationHover", newColor);
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("DecorationHover", newColor);
break;
case 18:
// Tooltip Background button
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("BackgroundNormal", newColor);
break;
case 19:
// Tooltip Text button
KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNormal", newColor);
break;
case 20:
// Active Title Background
KConfigGroup(m_config, "WM").writeEntry("activeBackground", newColor);
break;
case 21:
// Active Title Text
KConfigGroup(m_config, "WM").writeEntry("activeForeground", newColor);
break;
case 22:
// Active Title Secondary
KConfigGroup(m_config, "WM").writeEntry("activeBlend", newColor);
break;
case 23:
// Inactive Title Background
KConfigGroup(m_config, "WM").writeEntry("inactiveBackground", newColor);
break;
case 24:
// Inactive Title Text
KConfigGroup(m_config, "WM").writeEntry("inactiveForeground", newColor);
break;
case 25:
// Inactive Title Secondary
KConfigGroup(m_config, "WM").writeEntry("inactiveBlend", newColor);
break;
}
m_commonColorButtons[row]->blockSignals(true);
m_commonColorButtons[row]->setColor(newColor);
m_commonColorButtons[row]->blockSignals(false);
} else {
QString group = colorSetGroupKey(currentSet);
KConfigGroup(m_config, group).writeEntry(m_colorKeys[row], newColor);
}
updateColorSchemes();
Q_EMIT changed(true);
}
QString SchemeEditorColors::colorSetGroupKey(int colorSet)
{
QString group;
switch (colorSet) {
case KColorScheme::Window:
group = QStringLiteral("Colors:Window");
break;
case KColorScheme::Button:
group = QStringLiteral("Colors:Button");
break;
case KColorScheme::Selection:
group = QStringLiteral("Colors:Selection");
break;
case KColorScheme::Tooltip:
group = QStringLiteral("Colors:Tooltip");
break;
case KColorScheme::Complementary:
group = QStringLiteral("Colors:Complementary");
break;
case KColorScheme::Header:
group = QStringLiteral("Colors:Header");
break;
default:
group = QStringLiteral("Colors:View");
}
return group;
}
void SchemeEditorColors::updateColorSchemes()
{
m_colorSchemes.clear();
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::View, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Window, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Button, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Selection, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Tooltip, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Complementary, m_config));
m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Header, m_config));
m_wmColors.load(m_config);
}
void SchemeEditorColors::updateColorTable()
{
// subtract one here since the 0 item is "Common Colors"
const int currentSet = colorSet->currentIndex() - 1;
if (currentSet == -1) {
// common colors is selected
stackColors->setCurrentIndex(0);
stackPreview->setCurrentIndex(0);
for (KColorButton *button : std::as_const(m_commonColorButtons)) {
button->blockSignals(true);
}
m_commonColorButtons[0]->setColor(m_colorSchemes[KColorScheme::View].background(KColorScheme::NormalBackground).color());
m_commonColorButtons[1]->setColor(m_colorSchemes[KColorScheme::View].foreground(KColorScheme::NormalText).color());
m_commonColorButtons[2]->setColor(m_colorSchemes[KColorScheme::Window].background(KColorScheme::NormalBackground).color());
m_commonColorButtons[3]->setColor(m_colorSchemes[KColorScheme::Window].foreground(KColorScheme::NormalText).color());
m_commonColorButtons[4]->setColor(m_colorSchemes[KColorScheme::Button].background(KColorScheme::NormalBackground).color());
m_commonColorButtons[5]->setColor(m_colorSchemes[KColorScheme::Button].foreground(KColorScheme::NormalText).color());
m_commonColorButtons[6]->setColor(m_colorSchemes[KColorScheme::Selection].background(KColorScheme::NormalBackground).color());
m_commonColorButtons[7]->setColor(m_colorSchemes[KColorScheme::Selection].foreground(KColorScheme::NormalText).color());
m_commonColorButtons[8]->setColor(m_colorSchemes[KColorScheme::Selection].foreground(KColorScheme::InactiveText).color());
setCommonForeground(KColorScheme::InactiveText, 0, 9);
setCommonForeground(KColorScheme::ActiveText, 1, 10);
setCommonForeground(KColorScheme::LinkText, 2, 11);
setCommonForeground(KColorScheme::VisitedText, 3, 12);
setCommonForeground(KColorScheme::NegativeText, 4, 13);
setCommonForeground(KColorScheme::NeutralText, 5, 14);
setCommonForeground(KColorScheme::PositiveText, 6, 15);
setCommonDecoration(KColorScheme::FocusColor, 7, 16);
setCommonDecoration(KColorScheme::HoverColor, 8, 17);
m_commonColorButtons[18]->setColor(m_colorSchemes[KColorScheme::Tooltip].background(KColorScheme::NormalBackground).color());
m_commonColorButtons[19]->setColor(m_colorSchemes[KColorScheme::Tooltip].foreground(KColorScheme::NormalText).color());
m_commonColorButtons[20]->setColor(m_wmColors.color(WindecoColors::ActiveBackground));
m_commonColorButtons[21]->setColor(m_wmColors.color(WindecoColors::ActiveForeground));
m_commonColorButtons[22]->setColor(m_wmColors.color(WindecoColors::ActiveBlend));
m_commonColorButtons[23]->setColor(m_wmColors.color(WindecoColors::InactiveBackground));
m_commonColorButtons[24]->setColor(m_wmColors.color(WindecoColors::InactiveForeground));
m_commonColorButtons[25]->setColor(m_wmColors.color(WindecoColors::InactiveBlend));
for (KColorButton *button : std::as_const(m_commonColorButtons)) {
button->blockSignals(false);
}
} else {
// a real color set is selected
setPreview->setPalette(m_config, (KColorScheme::ColorSet)currentSet);
stackColors->setCurrentIndex(1);
stackPreview->setCurrentIndex(1);
for (int i = KColorScheme::NormalBackground; i <= KColorScheme::AlternateBackground; ++i) {
m_backgroundButtons[i]->blockSignals(true);
m_backgroundButtons[i]->setColor(m_colorSchemes[currentSet].background(KColorScheme::BackgroundRole(i)).color());
m_backgroundButtons[i]->blockSignals(false);
}
for (int i = KColorScheme::NormalText; i <= KColorScheme::PositiveText; ++i) {
m_foregroundButtons[i]->blockSignals(true);
m_foregroundButtons[i]->setColor(m_colorSchemes[currentSet].foreground(KColorScheme::ForegroundRole(i)).color());
m_foregroundButtons[i]->blockSignals(false);
}
for (int i = KColorScheme::FocusColor; i <= KColorScheme::HoverColor; ++i) {
m_decorationButtons[i]->blockSignals(true);
m_decorationButtons[i]->setColor(m_colorSchemes[currentSet].decoration(KColorScheme::DecorationRole(i)).color());
m_decorationButtons[i]->blockSignals(false);
}
}
}
void SchemeEditorColors::setCommonForeground(KColorScheme::ForegroundRole role, int stackIndex, int buttonIndex)
{
QColor color = m_colorSchemes[KColorScheme::View].foreground(role).color();
for (int i = KColorScheme::Window; i < KColorScheme::Tooltip; ++i) {
if (i == KColorScheme::Selection && role == KColorScheme::InactiveText)
break;
if (m_colorSchemes[i].foreground(role).color() != color) {
m_stackedWidgets[stackIndex]->setCurrentIndex(1);
return;
}
}
m_stackedWidgets[stackIndex]->setCurrentIndex(0);
m_commonColorButtons[buttonIndex]->setColor(color);
}
void SchemeEditorColors::setCommonDecoration(KColorScheme::DecorationRole role, int stackIndex, int buttonIndex)
{
QColor color = m_colorSchemes[KColorScheme::View].decoration(role).color();
for (int i = KColorScheme::Window; i < KColorScheme::Tooltip; ++i) {
if (m_colorSchemes[i].decoration(role).color() != color) {
m_stackedWidgets[stackIndex]->setCurrentIndex(1);
return;
}
}
m_stackedWidgets[stackIndex]->setCurrentIndex(0);
m_commonColorButtons[buttonIndex]->setColor(color);
}
void SchemeEditorColors::updateFromColorSchemes()
{
for (int i = KColorScheme::View; i <= KColorScheme::Tooltip; ++i) {
KConfigGroup group(m_config, colorSetGroupKey(i));
group.writeEntry("BackgroundNormal", m_colorSchemes[i].background(KColorScheme::NormalBackground).color());
group.writeEntry("BackgroundAlternate", m_colorSchemes[i].background(KColorScheme::AlternateBackground).color());
group.writeEntry("ForegroundNormal", m_colorSchemes[i].foreground(KColorScheme::NormalText).color());
group.writeEntry("ForegroundInactive", m_colorSchemes[i].foreground(KColorScheme::InactiveText).color());
group.writeEntry("ForegroundActive", m_colorSchemes[i].foreground(KColorScheme::ActiveText).color());
group.writeEntry("ForegroundLink", m_colorSchemes[i].foreground(KColorScheme::LinkText).color());
group.writeEntry("ForegroundVisited", m_colorSchemes[i].foreground(KColorScheme::VisitedText).color());
group.writeEntry("ForegroundNegative", m_colorSchemes[i].foreground(KColorScheme::NegativeText).color());
group.writeEntry("ForegroundNeutral", m_colorSchemes[i].foreground(KColorScheme::NeutralText).color());
group.writeEntry("ForegroundPositive", m_colorSchemes[i].foreground(KColorScheme::PositiveText).color());
group.writeEntry("DecorationFocus", m_colorSchemes[i].decoration(KColorScheme::FocusColor).color());
group.writeEntry("DecorationHover", m_colorSchemes[i].decoration(KColorScheme::HoverColor).color());
}
KConfigGroup WMGroup(m_config, "WM");
WMGroup.writeEntry("activeBackground", m_wmColors.color(WindecoColors::ActiveBackground));
WMGroup.writeEntry("activeForeground", m_wmColors.color(WindecoColors::ActiveForeground));
WMGroup.writeEntry("inactiveBackground", m_wmColors.color(WindecoColors::InactiveBackground));
WMGroup.writeEntry("inactiveForeground", m_wmColors.color(WindecoColors::InactiveForeground));
WMGroup.writeEntry("activeBlend", m_wmColors.color(WindecoColors::ActiveBlend));
WMGroup.writeEntry("inactiveBlend", m_wmColors.color(WindecoColors::InactiveBlend));
}
|
70eb9f7d1d1e1a05146a8ed6f40febdcb59dfae9 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-translate/include/aws/translate/model/StartTextTranslationJobRequest.h | a527809ebecefea3c35176e62730d8b2e77300d7 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 22,771 | h | StartTextTranslationJobRequest.h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/translate/Translate_EXPORTS.h>
#include <aws/translate/TranslateRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/translate/model/InputDataConfig.h>
#include <aws/translate/model/OutputDataConfig.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>
#include <aws/core/utils/UUID.h>
namespace Aws
{
namespace Translate
{
namespace Model
{
/**
*/
class AWS_TRANSLATE_API StartTextTranslationJobRequest : public TranslateRequest
{
public:
StartTextTranslationJobRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "StartTextTranslationJob"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline const Aws::String& GetJobName() const{ return m_jobName; }
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline bool JobNameHasBeenSet() const { return m_jobNameHasBeenSet; }
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline void SetJobName(const Aws::String& value) { m_jobNameHasBeenSet = true; m_jobName = value; }
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline void SetJobName(Aws::String&& value) { m_jobNameHasBeenSet = true; m_jobName = std::move(value); }
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline void SetJobName(const char* value) { m_jobNameHasBeenSet = true; m_jobName.assign(value); }
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline StartTextTranslationJobRequest& WithJobName(const Aws::String& value) { SetJobName(value); return *this;}
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline StartTextTranslationJobRequest& WithJobName(Aws::String&& value) { SetJobName(std::move(value)); return *this;}
/**
* <p>The name of the batch translation job to be performed.</p>
*/
inline StartTextTranslationJobRequest& WithJobName(const char* value) { SetJobName(value); return *this;}
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline const InputDataConfig& GetInputDataConfig() const{ return m_inputDataConfig; }
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline bool InputDataConfigHasBeenSet() const { return m_inputDataConfigHasBeenSet; }
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline void SetInputDataConfig(const InputDataConfig& value) { m_inputDataConfigHasBeenSet = true; m_inputDataConfig = value; }
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline void SetInputDataConfig(InputDataConfig&& value) { m_inputDataConfigHasBeenSet = true; m_inputDataConfig = std::move(value); }
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline StartTextTranslationJobRequest& WithInputDataConfig(const InputDataConfig& value) { SetInputDataConfig(value); return *this;}
/**
* <p>Specifies the format and S3 location of the input documents for the
* translation job.</p>
*/
inline StartTextTranslationJobRequest& WithInputDataConfig(InputDataConfig&& value) { SetInputDataConfig(std::move(value)); return *this;}
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline const OutputDataConfig& GetOutputDataConfig() const{ return m_outputDataConfig; }
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline bool OutputDataConfigHasBeenSet() const { return m_outputDataConfigHasBeenSet; }
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline void SetOutputDataConfig(const OutputDataConfig& value) { m_outputDataConfigHasBeenSet = true; m_outputDataConfig = value; }
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline void SetOutputDataConfig(OutputDataConfig&& value) { m_outputDataConfigHasBeenSet = true; m_outputDataConfig = std::move(value); }
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline StartTextTranslationJobRequest& WithOutputDataConfig(const OutputDataConfig& value) { SetOutputDataConfig(value); return *this;}
/**
* <p>Specifies the S3 folder to which your job output will be saved. </p>
*/
inline StartTextTranslationJobRequest& WithOutputDataConfig(OutputDataConfig&& value) { SetOutputDataConfig(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline const Aws::String& GetDataAccessRoleArn() const{ return m_dataAccessRoleArn; }
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline bool DataAccessRoleArnHasBeenSet() const { return m_dataAccessRoleArnHasBeenSet; }
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline void SetDataAccessRoleArn(const Aws::String& value) { m_dataAccessRoleArnHasBeenSet = true; m_dataAccessRoleArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline void SetDataAccessRoleArn(Aws::String&& value) { m_dataAccessRoleArnHasBeenSet = true; m_dataAccessRoleArn = std::move(value); }
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline void SetDataAccessRoleArn(const char* value) { m_dataAccessRoleArnHasBeenSet = true; m_dataAccessRoleArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline StartTextTranslationJobRequest& WithDataAccessRoleArn(const Aws::String& value) { SetDataAccessRoleArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline StartTextTranslationJobRequest& WithDataAccessRoleArn(Aws::String&& value) { SetDataAccessRoleArn(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM)
* role that grants Amazon Translate read access to your input data. For more
* nformation, see <a>identity-and-access-management</a>.</p>
*/
inline StartTextTranslationJobRequest& WithDataAccessRoleArn(const char* value) { SetDataAccessRoleArn(value); return *this;}
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline const Aws::String& GetSourceLanguageCode() const{ return m_sourceLanguageCode; }
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline bool SourceLanguageCodeHasBeenSet() const { return m_sourceLanguageCodeHasBeenSet; }
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline void SetSourceLanguageCode(const Aws::String& value) { m_sourceLanguageCodeHasBeenSet = true; m_sourceLanguageCode = value; }
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline void SetSourceLanguageCode(Aws::String&& value) { m_sourceLanguageCodeHasBeenSet = true; m_sourceLanguageCode = std::move(value); }
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline void SetSourceLanguageCode(const char* value) { m_sourceLanguageCodeHasBeenSet = true; m_sourceLanguageCode.assign(value); }
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline StartTextTranslationJobRequest& WithSourceLanguageCode(const Aws::String& value) { SetSourceLanguageCode(value); return *this;}
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline StartTextTranslationJobRequest& WithSourceLanguageCode(Aws::String&& value) { SetSourceLanguageCode(std::move(value)); return *this;}
/**
* <p>The language code of the input language. For a list of language codes, see
* <a>what-is-languages</a>.</p> <p>Amazon Translate does not automatically detect
* a source language during batch translation jobs.</p>
*/
inline StartTextTranslationJobRequest& WithSourceLanguageCode(const char* value) { SetSourceLanguageCode(value); return *this;}
/**
* <p>The language code of the output language.</p>
*/
inline const Aws::Vector<Aws::String>& GetTargetLanguageCodes() const{ return m_targetLanguageCodes; }
/**
* <p>The language code of the output language.</p>
*/
inline bool TargetLanguageCodesHasBeenSet() const { return m_targetLanguageCodesHasBeenSet; }
/**
* <p>The language code of the output language.</p>
*/
inline void SetTargetLanguageCodes(const Aws::Vector<Aws::String>& value) { m_targetLanguageCodesHasBeenSet = true; m_targetLanguageCodes = value; }
/**
* <p>The language code of the output language.</p>
*/
inline void SetTargetLanguageCodes(Aws::Vector<Aws::String>&& value) { m_targetLanguageCodesHasBeenSet = true; m_targetLanguageCodes = std::move(value); }
/**
* <p>The language code of the output language.</p>
*/
inline StartTextTranslationJobRequest& WithTargetLanguageCodes(const Aws::Vector<Aws::String>& value) { SetTargetLanguageCodes(value); return *this;}
/**
* <p>The language code of the output language.</p>
*/
inline StartTextTranslationJobRequest& WithTargetLanguageCodes(Aws::Vector<Aws::String>&& value) { SetTargetLanguageCodes(std::move(value)); return *this;}
/**
* <p>The language code of the output language.</p>
*/
inline StartTextTranslationJobRequest& AddTargetLanguageCodes(const Aws::String& value) { m_targetLanguageCodesHasBeenSet = true; m_targetLanguageCodes.push_back(value); return *this; }
/**
* <p>The language code of the output language.</p>
*/
inline StartTextTranslationJobRequest& AddTargetLanguageCodes(Aws::String&& value) { m_targetLanguageCodesHasBeenSet = true; m_targetLanguageCodes.push_back(std::move(value)); return *this; }
/**
* <p>The language code of the output language.</p>
*/
inline StartTextTranslationJobRequest& AddTargetLanguageCodes(const char* value) { m_targetLanguageCodesHasBeenSet = true; m_targetLanguageCodes.push_back(value); return *this; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline const Aws::Vector<Aws::String>& GetTerminologyNames() const{ return m_terminologyNames; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline bool TerminologyNamesHasBeenSet() const { return m_terminologyNamesHasBeenSet; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline void SetTerminologyNames(const Aws::Vector<Aws::String>& value) { m_terminologyNamesHasBeenSet = true; m_terminologyNames = value; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline void SetTerminologyNames(Aws::Vector<Aws::String>&& value) { m_terminologyNamesHasBeenSet = true; m_terminologyNames = std::move(value); }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline StartTextTranslationJobRequest& WithTerminologyNames(const Aws::Vector<Aws::String>& value) { SetTerminologyNames(value); return *this;}
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline StartTextTranslationJobRequest& WithTerminologyNames(Aws::Vector<Aws::String>&& value) { SetTerminologyNames(std::move(value)); return *this;}
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline StartTextTranslationJobRequest& AddTerminologyNames(const Aws::String& value) { m_terminologyNamesHasBeenSet = true; m_terminologyNames.push_back(value); return *this; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline StartTextTranslationJobRequest& AddTerminologyNames(Aws::String&& value) { m_terminologyNamesHasBeenSet = true; m_terminologyNames.push_back(std::move(value)); return *this; }
/**
* <p>The name of the terminology to use in the batch translation job. For a list
* of available terminologies, use the <a>ListTerminologies</a> operation.</p>
*/
inline StartTextTranslationJobRequest& AddTerminologyNames(const char* value) { m_terminologyNamesHasBeenSet = true; m_terminologyNames.push_back(value); return *this; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline const Aws::Vector<Aws::String>& GetParallelDataNames() const{ return m_parallelDataNames; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline bool ParallelDataNamesHasBeenSet() const { return m_parallelDataNamesHasBeenSet; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline void SetParallelDataNames(const Aws::Vector<Aws::String>& value) { m_parallelDataNamesHasBeenSet = true; m_parallelDataNames = value; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline void SetParallelDataNames(Aws::Vector<Aws::String>&& value) { m_parallelDataNamesHasBeenSet = true; m_parallelDataNames = std::move(value); }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline StartTextTranslationJobRequest& WithParallelDataNames(const Aws::Vector<Aws::String>& value) { SetParallelDataNames(value); return *this;}
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline StartTextTranslationJobRequest& WithParallelDataNames(Aws::Vector<Aws::String>&& value) { SetParallelDataNames(std::move(value)); return *this;}
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline StartTextTranslationJobRequest& AddParallelDataNames(const Aws::String& value) { m_parallelDataNamesHasBeenSet = true; m_parallelDataNames.push_back(value); return *this; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline StartTextTranslationJobRequest& AddParallelDataNames(Aws::String&& value) { m_parallelDataNamesHasBeenSet = true; m_parallelDataNames.push_back(std::move(value)); return *this; }
/**
* <p>The names of the parallel data resources to use in the batch translation job.
* For a list of available parallel data resources, use the <a>ListParallelData</a>
* operation.</p>
*/
inline StartTextTranslationJobRequest& AddParallelDataNames(const char* value) { m_parallelDataNamesHasBeenSet = true; m_parallelDataNames.push_back(value); return *this; }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline const Aws::String& GetClientToken() const{ return m_clientToken; }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline bool ClientTokenHasBeenSet() const { return m_clientTokenHasBeenSet; }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline void SetClientToken(const Aws::String& value) { m_clientTokenHasBeenSet = true; m_clientToken = value; }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline void SetClientToken(Aws::String&& value) { m_clientTokenHasBeenSet = true; m_clientToken = std::move(value); }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline void SetClientToken(const char* value) { m_clientTokenHasBeenSet = true; m_clientToken.assign(value); }
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline StartTextTranslationJobRequest& WithClientToken(const Aws::String& value) { SetClientToken(value); return *this;}
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline StartTextTranslationJobRequest& WithClientToken(Aws::String&& value) { SetClientToken(std::move(value)); return *this;}
/**
* <p>A unique identifier for the request. This token is auto-generated when using
* the Amazon Translate SDK.</p>
*/
inline StartTextTranslationJobRequest& WithClientToken(const char* value) { SetClientToken(value); return *this;}
private:
Aws::String m_jobName;
bool m_jobNameHasBeenSet;
InputDataConfig m_inputDataConfig;
bool m_inputDataConfigHasBeenSet;
OutputDataConfig m_outputDataConfig;
bool m_outputDataConfigHasBeenSet;
Aws::String m_dataAccessRoleArn;
bool m_dataAccessRoleArnHasBeenSet;
Aws::String m_sourceLanguageCode;
bool m_sourceLanguageCodeHasBeenSet;
Aws::Vector<Aws::String> m_targetLanguageCodes;
bool m_targetLanguageCodesHasBeenSet;
Aws::Vector<Aws::String> m_terminologyNames;
bool m_terminologyNamesHasBeenSet;
Aws::Vector<Aws::String> m_parallelDataNames;
bool m_parallelDataNamesHasBeenSet;
Aws::String m_clientToken;
bool m_clientTokenHasBeenSet;
};
} // namespace Model
} // namespace Translate
} // namespace Aws
|
5da84c81eb7a6eceb4fb6ce290b8ade37016ed9a | fae7789cf55bb08a0e67a8c2ae9f081db4c01500 | /qbsplugin/qbsinterface.h | 0deda685e09f58da089846b0c200ddaa2de8b5a6 | [
"Apache-2.0"
] | permissive | dudochkin-victor/WebKitSupplemental | c772196465a86d74e90274ba59d6de179f07d466 | 0dddbdbc97ebb1c7ad81ef508e03f92cb2ec1019 | refs/heads/master | 2021-01-16T19:44:05.670624 | 2013-05-21T00:14:06 | 2013-05-21T00:14:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,152 | h | qbsinterface.h | /* @@@LICENSE
*
* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
*
* 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.
*
LICENSE@@@ */
#ifndef qbsinterface_h
#define qbsinterface_h
class QWidget;
class QBsDriver {
public:
virtual void setBuffers(unsigned char* buffer1, int size1, unsigned char* buffer2, int size2) = 0;
virtual void setBufferState(int buffer, bool active) = 0;
virtual void releaseBuffers() = 0;
};
class QBsClient {
public:
virtual void flushBuffer(int buffer) = 0;
};
extern "C" {
typedef QBsDriver* (*qpa_qbs_register_client_function)(QWidget *window, QBsClient* client);
};
#endif // qbsinterface_h
|
a441beb4c7bf16721a1494b8db99729513e62dea | 14e00a226015c07522cc99b70fbcee5a2a8747d7 | /lab1/catkin_ws/src/libclfsm/include/CLState.h | 55e6a54bbb66fa0926241cf89487fe382f132204 | [
"Apache-2.0"
] | permissive | Joshua-Mitchell/robotics | 031fa1033bda465b813c40633da57886c3446a2c | 3f60f72bfaf9de4e2d65c7baac0dd57ee2d556b8 | refs/heads/master | 2020-04-27T13:01:25.073103 | 2019-03-10T14:49:08 | 2019-03-10T14:49:08 | 174,352,695 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,495 | h | CLState.h | /*
* CLState.h
* gufsm
*
* Created by Rene Hexel on 1/08/12.
* Copyright (c) 2012, 2013 Rene Hexel. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgement:
*
* This product includes software developed by Rene Hexel.
*
* 4. Neither the name of the author nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -----------------------------------------------------------------------
* This program is free software; you can redistribute it and/or
* modify it under the above terms or under the terms of the GNU
* General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see http://www.gnu.org/licenses/
* or write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __clfsm__CLState__
#define __clfsm__CLState__
#include "CLAction.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wweak-vtables"
namespace FSM
{
class State;
class CLMachine;
class CLTransition;
class CLState
{
const char *_name; /// name fo the state
class State *_stateContext; /// FSM context
CLAction &_onEntryAction; /// onEntry
CLAction &_onExitAction; /// onExit
CLAction &_internalAction; /// internal
public:
/** default constructor */
CLState(const char *name, CLAction &onEntry, CLAction &onExit, CLAction &internal, class State *context = 0): _name(name), _stateContext(context), _onEntryAction(onEntry), _onExitAction(onExit), _internalAction(internal) {}
/** destructor (subclass responsibility!) */
virtual ~CLState() {}
/** name getter */
const char *name() const { return _name; }
/** name setter */
void setName(const char *name) { _name = name; }
/** state context getter */
class State *stateContext() const { return _stateContext; }
/** state context setter */
void setStateContext(class State *state) { _stateContext = state; }
/** onEntry action getter */
CLAction &onEntryAction() const { return _onEntryAction; }
/** onExit action getter */
CLAction &onExitAction() const { return _onExitAction; }
/** internal action getter */
CLAction &internalAction()const { return _internalAction; }
/** perform the onEntry action */
void performOnEntry(CLMachine *m) { _onEntryAction.perform(m, this); }
/** perform the onExit action */
void performOnExit(CLMachine *m) { _onExitAction.perform(m, this); }
/** perform the internal action */
void performInternal(CLMachine *m){ _internalAction.perform(m, this); }
/** return the ith transition leading out of this state */
CLTransition *transition(int i) const { return transitions()[i]; }
/** return the array of transitions for this state */
virtual CLTransition * const *transitions() const = 0;
/** return the number of transitions leading out of this state */
virtual int numberOfTransitions() const = 0;
};
}
#pragma clang diagnostic pop
#endif /* defined(__gufsm__CLState__) */
|
daafd5bb5adb7b1686913dd595a5d103b2add9da | 4194a94583f31eada5fd79abf87baf6057a88260 | /ch09/9.21.cpp | 334e4aca0fc3cc23fb2ad51e69b32139b66adca7 | [] | no_license | shuaitq/CppPrimer | d918887f01b840c57e6d593419ca6feb3b41e0e8 | cc8feca756d5ca07d0cb0a7c1d6c4f2577c7b071 | refs/heads/master | 2020-03-16T22:04:37.315663 | 2018-05-27T06:06:13 | 2018-05-27T06:06:13 | 133,025,768 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 542 | cpp | 9.21.cpp | #include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
int main()
{
string word;
vector<string> vec;
auto iter = vec.begin();
while(cin >> word)
{
iter = vec.insert(iter, word);
}
// insert before vec.begin() and return the iter of insert element
// assign iter become the return iterator
// continue insert until end of file
for(auto &s : vec)
{
cout << s << endl;
}
return 0;
} |
6f2866f7925d836d85dd49272236da8f107fa9fb | 4e51a9bcf881e7a9ede4c8cbafcaab44fc4875ae | /CNL/A6/TCP/tcp2.cpp | a1b21b372d2c27dab18cfa821317b8d88a09694c | [] | no_license | divyajyotiarch/V-SEM | e98292f3224ca51b744a4c1b2a14f2818ba689a5 | 43707326640ad248aa45af9f125512ddf4362ae2 | refs/heads/master | 2022-03-08T04:17:45.111114 | 2019-11-15T16:26:37 | 2019-11-15T16:26:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,151 | cpp | tcp2.cpp | #include <iostream>
#include <stdio.h>
#include <sys/socket.h>
#include<arpa/inet.h>
#include<stdlib.h>
#include<string.h>
#include <unistd.h>
#include <errno.h>
#include<fstream>
using namespace std;
#define PORT_NUMBER 5002
#define SERVER_ADDRESS "127.0.0.1"
class myClient
{
int client_socket;
sockaddr_in remote_addr;
public:
void c_construct();
void c_create();
void c_connect();
void c_close()
{
close(client_socket);
}
void c_chat();
void c_file();
void trigo();
};
void myClient::c_create()
{
client_socket = socket(AF_INET, SOCK_STREAM, 0);
if (client_socket == -1)
{
fprintf(stderr, "Error creating socket --> %s\n", strerror(errno));
exit(1);
}
else
{
cout<<"Socket created sucessfully\n";
}
}
void myClient::c_construct()
{
/* Zeroing remote_addr struct */
memset(&remote_addr, 0, sizeof(remote_addr));
/* Construct remote_addr struct */
remote_addr.sin_family = AF_INET;
inet_pton(AF_INET, SERVER_ADDRESS, &(remote_addr.sin_addr));
remote_addr.sin_port = htons(PORT_NUMBER);
}
void myClient::c_connect()
{
/* Connect to the server */
if (connect(client_socket, (struct sockaddr *)&remote_addr, sizeof(struct sockaddr)) == -1)
{
fprintf(stderr, "Error on connect --> %s\n", strerror(errno));
exit(1);
}
else
{
cout<<"Connection established\n";
}
}
void myClient::c_chat()
{
char buffer[256];
cin.ignore();
while(1)
{
bzero((char *)buffer,256);
cout<<"\nmsg >> ";
string data;
getline(cin, data);
strcpy(buffer,data.c_str());
send(client_socket,buffer,strlen(buffer),0);
bzero(buffer,256);
cout <<endl<< "..." << endl;
recv(client_socket,(char*)&buffer,sizeof(buffer),0);
cout<<"Server: "<<buffer<<endl;
if(buffer[0]=='e' && buffer[1]=='x' && buffer[2]=='i' && buffer[3]=='t'){
c_close();
break;
}
}
}
void myClient::c_file()
{
long long int msg_len;
char buffer[256];
char filename[BUFSIZ];
cout<<"\nEnter filename: ";
cin>>filename;
msg_len = send(client_socket,filename,BUFSIZ,0);
if(msg_len==-1)
{
fprintf(stderr, "Error sending filename --> %s", strerror(errno));
}
else
{
cout<<"File requested to Server: "<<filename<<endl;
}
char *filebuff=new char[90000*80];
bzero((char *)filebuff,sizeof(filebuff));
msg_len = recv(client_socket,filebuff,90000*80,0);
ofstream fout;
fout.open(filename,ios::out|ios::binary);
if(!fout)
fprintf(stderr, "Could not create file --> %s", strerror(errno));
else
{
fout.write(filebuff,msg_len);
fout.close();
cout<<"File received";
}
c_close();
}
void myClient::trigo()
{
char angle[3],op[1];
char s_ans[20],c_ans[20],t_ans[20];
cout<<"Enter angle "<<endl;
cin>>angle;
send(client_socket,angle,strlen(angle),0);
cout<<"Enter trigo op: 's-sin'/'c-cos'/'t-tan' \n";
cin>>op;
send(client_socket,op,strlen(op),0);
if(op[0]=='s')
{
cout<<"Sine of angle "<<angle<<" is ";
recv(client_socket,s_ans,20,0);
cout<<s_ans<<endl;
//bzero((char*)s_ans,sizeof(s_ans));
}
else if(op[0]=='c')
{
cout<<"Cosine of angle "<<angle<<" is ";
//bzero((char*)c_ans,sizeof(c_ans));
recv(client_socket,c_ans,20,0);
cout<<c_ans<<endl;
}
else if(op[0]=='t')
{
cout<<"Tangent of angle "<<angle<<" is ";
//bzero((char*)t_ans,sizeof(t_ans));
recv(client_socket,t_ans,20,0);
cout<<t_ans<<endl;
}
c_close();
}
int main()
{
myClient cl;
int choice;
do{
cout<<"\n1.Chat \n";
cout<<"2.File Transfer\n";
cout<<"3.Trigonometric Calci\n";
cout<<"4.Exit\n";
cin>>choice;
switch(choice)
{
case 1:
cl.c_create();
cl.c_construct();
cl.c_connect();
cl.c_chat();
break;
case 2:
cl.c_create();
cl.c_construct();
cl.c_connect();
cl.c_file();
break;
case 3:
cl.c_create();
cl.c_construct();
cl.c_connect();
cl.trigo();
cl.c_close();
break;
case 4:
cl.c_close();
exit(1);
}
}while(choice<=4);
return 0;
}
|
2a1b914ee4e46f385956b905c0a111f1b91d57f8 | cffff0edf6d6361d369ea3a628123c584edaab9b | /src/playground/background.h | f556d7e4214790636d888fe415fb3e37edea0fbc | [] | no_license | peto184/ppgso | 74df68e3d5a875dc98aa69694fe6da13213ed4fd | 146c67e9070e3ed7545cb9d2833b1226efdd95a6 | refs/heads/master | 2021-03-24T12:08:37.336695 | 2019-05-24T13:21:24 | 2019-05-24T13:21:24 | 108,121,517 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | h | background.h | //
// Created by peto184 on 27-Oct-17.
//
#ifndef PPGSO_BACKGROUND_H
#define PPGSO_BACKGROUND_H
class Scene;
#include "scene.h"
#include <glm/glm.hpp>
#include <ppgso.h>
class Background {
public:
Background();
glm::vec3 mPosition{0.0, 0.0, 0.0};
glm::vec3 mRotation{1.0,1.0,1.0};
glm::vec3 mScale{1.0,1.0,1.0};
glm::mat4 mModelMatrix{1};
glm::vec2 mTextureOffset;
bool update(Scene& scene, float dt);
void render(Scene &scene);
private:
static std::unique_ptr<ppgso::Mesh> mMesh;
static std::unique_ptr<ppgso::Shader> mShader;
static std::unique_ptr<ppgso::Texture> mTexture;
};
#endif //PPGSO_BACKGROUND_H
|
0ee39f46b729e326a13111535d097e3cc72165aa | 6d6c7f15d12b27b0ddac46251d6741272f452fa1 | /Tilescape_D3D_Editor/Buffer_Class.cpp | 641b559337d9a1273fee1c779bbd86c0723a2271 | [] | no_license | cacttus/tilescape | d17bee4e8895f64a56ef27338f769ecd756dbb5f | c0f82cca030a72a8a55fa693df7be957ffeb8a61 | refs/heads/master | 2022-12-09T18:26:41.643404 | 2020-09-15T07:23:06 | 2020-09-15T07:23:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,945 | cpp | Buffer_Class.cpp | #include "Buffer_Class.h"
void Buffer_Class::CreateBuffer( int size, DWORD flags )
{
HRESULT hr;
//Fill the D3D buffer
if( flags & D3DUSAGE_DYNAMIC )
{
FLAG_DYNAMIC = true;
hr = g_D3D_Struct->g_pD3DDevice->CreateVertexBuffer( size, //size of buffer
flags,
FVF_DESCRIPTOR,
D3DPOOL_DEFAULT,
&D3DBuffer, //the vertex buffer (d3d)
NULL );
}
else
{
FLAG_DYNAMIC = false;
hr = g_D3D_Struct->g_pD3DDevice->CreateVertexBuffer( size, //size of buffer
flags,
FVF_DESCRIPTOR,
D3DPOOL_MANAGED,
&D3DBuffer, //the vertex buffer (d3d)
NULL );
}
if(hr!=D3D_OK) Fatal_Error("Failed to create vertex buffer");
}
void Buffer_Class::AddPoly( Polygon* Poly )
{
}
void Buffer_Class::Init( int Num_Polys, char* Tex, DWORD Flags )
{
Num_Polygons = (int)Num_Polys;
Num_Verts = (int)Num_Polys*3;
Active_Polygons = Num_Polygons;
Polygons = new Polygon[ Num_Polygons ];
memset(Polygons,0,sizeof(Polygon)*Num_Polygons);
bCan_Draw = new bool[ Num_Polygons ];
CreateBuffer( Num_Polygons*sizeof(Polygon), Flags );
Set_Draw_Flags();
D3DTexture.Load( Tex, g_D3D_Struct->g_pD3DDevice );
}
void Buffer_Class::FillBuffer_Conditional()//Slower than FillBuffer, but checks if polygons are used
{
int cur=0;
int n=0;
Polygon* temp;
for(int i=0; i<Num_Polygons; ++i )
if(bCan_Draw[i])n++;
temp = new Polygon[n];
for( int i=0; i<Num_Polygons; ++i )
if(bCan_Draw[i]){
memcpy( (temp+cur), &Polygons[i], 3*sizeof(Vertex));
cur++;
}
//Fill the buffer
if(FLAG_DYNAMIC)
{
VOID* lpVoid;
D3DBuffer->Lock( 0, 0, &lpVoid, D3DLOCK_DISCARD );
memcpy( lpVoid, temp, cur*3*sizeof(Vertex) );
D3DBuffer->Unlock();
}
else
{
VOID* lpVoid;
D3DBuffer->Lock( 0, 0, &lpVoid, 0 );
memcpy( lpVoid, temp, cur*3*sizeof(Vertex) );
D3DBuffer->Unlock();
}
delete [] temp;
}
void Buffer_Class::FillBuffer()
{
if(FLAG_DYNAMIC)
{
VOID* lpVoid;
D3DBuffer->Lock( 0, 0, &lpVoid, D3DLOCK_DISCARD );
memcpy( lpVoid, Polygons, Num_Polygons*3*sizeof(Vertex) );
D3DBuffer->Unlock();
}
else
{
VOID* lpVoid;
D3DBuffer->Lock( 0, 0, &lpVoid, 0 );
memcpy( lpVoid, Polygons, Num_Polygons*3*sizeof(Vertex) );
D3DBuffer->Unlock();
}
}
void Buffer_Class::FillBuffer( VOID* data )
{
VOID* lpVoid;
D3DBuffer->Lock( 0, 0, &lpVoid, 0 );
memcpy( lpVoid, data, Num_Polygons*3*sizeof(Vertex) );
D3DBuffer->Unlock();
}
void Buffer_Class::Set_Draw_Flags() //Sets all the polygon flags to 1 (Draw)
{
memset(bCan_Draw,1,sizeof(bool)*Num_Polygons);
}
void Buffer_Class::Clear_Draw_Flags() //Sets all the polygon flags to 0 (Don't Draw )
{
memset(bCan_Draw,0,sizeof(bool)*Num_Polygons);
}
void Buffer_Class::Check_Draw_Flags()
{
Active_Polygons=0;
for( int i=0; i<Num_Polygons; ++i )
{
if( bCan_Draw[i]==1 )
Active_Polygons++;
}
}
void Buffer_Class::DrawBuffer(void)
{
;
}
void Buffer_Class::Free()
{
D3DTexture.Free();
D3DBuffer->Release();
delete [] Polygons;
delete [] bCan_Draw;
} |
ca1428d1cc11d73f26a0861babc7eb1de703a6ec | 0d5f546ec5255b73ffcbb855f58520a211f60ee4 | /newton.hpp | 54f22353f6d81d3bc7bc3c37d8cc043441befbe4 | [] | no_license | doulouUS/Importance-Sampling | 2293119d5db46f33bee2aabfd8cf9b94b195edf9 | c219fcd10c05b280010e232d7ff8f7598b21368e | refs/heads/master | 2021-01-11T17:39:22.334685 | 2017-01-24T01:44:47 | 2017-01-24T01:44:47 | 79,814,763 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,562 | hpp | newton.hpp | //
// newton.hpp
// echantillonnage_preferentiel
//
// Created by DOUGE Louis on 4/11/16.
// Copyright © 2016 DOUGE Louis. All rights reserved.
//
#ifndef newton_hpp
#define newton_hpp
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
//#include <Eigen/dense> pour les matrices ?
#include "random.hpp"
#include "mean_f.hpp"
#include "matrice.hpp"
#include <vector>
//--------
// estimateur du gradient de la variance
//--------
// unidimensionnel
double u(double S, double r, double sigma, double T, double K,int N,vector<double>& x,double theta);
//--------
// Gradient de l'estimateur du gradient de la variance (unidimensionnel)
//--------
double grad_u(double S0, double r, double sigma, double T, double K,vector<double>& X, double theta);
//--------
// Programme d'optimisation
//--------
double newton (double S0, double r, double sigma, double T, double K, vector<double>& X);
//----------------------------------------------------------------------
//
// OPTIMISATION MULTIDIMENSIONNELLE
//
//----------------------------------------------------------------------
/// PANIER
double dot_product(vector<double> X, vector<double> theta);
vector<double> u_panier(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X, vector<double> theta, double rho1, double rho2, double rho3, vector<double> lambda);
///--------
/// Gradient de l'estimateur de la variance (multidimensionnel)
///--------
matrice grad_u_panier(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X, vector<double> theta, double rho1, double rho2, double rho3, vector<double> lambda);
///--------
/// Programme d'optimisation dimension 3
/// Renvoie un vecteur theta star de dimension 3
///--------
vector<double> newton_D3_panier(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X,double rho1, double rho2, double rho3, vector<double> lambda);
/// ALTIPLANO
vector<double> u_altiplano(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X, vector<double> theta, double rho1, double rho2, double rho3);
matrice grad_u_altiplano(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X, vector<double> theta, double rho1, double rho2, double rho3);
vector<double> newton_D3_altiplano(vector<double> S0, double r, vector<double> sigma, double T, double K, int N, matrice& X,double rho1, double rho2, double rho3);
#endif /* newton_hpp */
|
dcfe9d9c73f54c0789198843834986e9122e72ec | 09b62b21d4450cf737a62da16d2d6006dbcba86a | /yl_32/.svn/pristine/dc/dcfe9d9c73f54c0789198843834986e9122e72ec.svn-base | f5fbd3ce0202f8b22bba98f81ff366de0bc5fabc | [] | no_license | hw233/clua_yol | fa16cf913092286f9ea3d11db1e911568f569363 | bbc2e55290c185f6cfff72af9e1b9a96f9e6f074 | refs/heads/master | 2020-03-19T06:24:23.486101 | 2016-02-23T10:04:58 | 2016-02-23T10:04:58 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,588 | dcfe9d9c73f54c0789198843834986e9122e72ec.svn-base | /* -------------------------------------------------------------------------
// 文件名 : bufsetting.h
// 创建者 : zhangjunjie
// 创建时间 : 2012-5-10
// 功能描述 : buff配置读取
// -----------------------------------------------------------------------*/
#ifndef bufsetting_h__
#define bufsetting_h__
#include <map>
#include <vector>
#include "onlinegamemodule/bufferdef.h"
#include "bufcommand.h"
#include "buftimereffect.h"
#include "buftriggereffect.h"
#include "onlinegameworld/kluacharacter.h"
#include "onlinegameworld/kcharacter.h"
class ITabFile;
class KCharacter;
//buffer的模板
struct BufferTemplate
{
BOOL Init(ITabFile* piFile, int nRow);
BYTE m_nBuffLevel; //buff等级
INT m_nBuffTemplateID; // Buffer ID
INT m_nBuffPersist; // Buffer 持续时间,帧数
INT m_nStackCount; //叠加层数
FLOAT m_fBuffRadius; //影响范围
INT m_nBuffEffectNum; //buff影响数量
INT m_nBuffType; //buff类型
INT m_nStackCategory; //叠加规则
INT m_nStackCategory1; //划分1
INT m_nStackCategory2; //划分2
INT m_nMagnification; //系数
INT m_nGrow; //成长
BOOL m_bSync; //是否要同步到客户端
BOOL m_bSave; //是否下线保存
BOOL m_bDeath; //死亡是否保留
BOOL m_bPlus; //是否可以点掉
BOOL m_bNeedAgree; //是否需求确认
BOOL m_abRelation[RELATION_NUM]; // 关系判断([0]自己、[1]友方、[2]敌人)
BOOL m_bIsGroundBuffer; //是否是对地技能
INT m_nBuffDelayFrame; //时间延迟
INT m_nK; // buff的K值
INT m_nIfUseSkillLv; // 是否使用技能等级
CHAR m_szEffectMapType[MAX_NAME_LEN]; // 生效的地图类型
BufferGroupType m_eBuffType;
BUFFER_POSITION m_BuffPosition; // 触发位置
BufConditionCommand m_cBuffPrecondition; //前置条件
std::vector<INT> m_vecBufTimerEffectID; // 持续性效果ID
std::vector<INT> m_vecBufTriggerEffectID; // 触发性效果ID
};
// Buffer数值保存
struct BufferNumber
{
INT m_nBufferId;
INT m_nValue; // 数值
INT m_nSkillCoefficientMin; // 最小技能缩放系数
INT m_nSkillCoefficientMax; // 最大技能缩放系数
INT m_nSkillLevel;
CHAR m_szCommand[SCRIPT_MAX_LENGTH]; // 指令
BOOL Init(ITabFile* tabFile, int nRow);
};
class BuffSetting
{
typedef std::map<INT, BufferTemplate*> BUFFER_TEMPLATE_MAP;
typedef std::map<INT, BufTimerEffect*> BUFFER_TIMER_EFFECT_MAP;
typedef std::map<INT, BufTriggerEffect*> BUFFER_TRIGGER_EFFECT_MAP;
typedef std::map<std::string, BufferNumber*> BUFFER_NUMBER_MAP;
public:
BuffSetting();
~BuffSetting();
BOOL Init();
BOOL UnInit();
BufferTemplate* GetBufferTemplate(INT nID);
BufTimerEffect* GetTimerEffect(INT nID);
TriggerData GetTriggerEffect(INT nID);
// 获取buffer数值
BufferNumber* GetBufferNumber(INT nBufferId, INT nSkillLevel, std::string szCommand);
//检测前置条件,在能否加上buff之前进行判断,因为前置条件是相对于模板而言,而不是相对于buff实体
BOOL CheckPreCondition(INT nBuffTemplateId,KCharacter* m_pSender,KCharacter* m_pReceiver);
private:
BUFFER_TEMPLATE_MAP m_mapBuffers;
BUFFER_TIMER_EFFECT_MAP m_mapTimerEffects;
BUFFER_TRIGGER_EFFECT_MAP m_mapTriggerEffects;
std::map<DWORD, BUFFER_NUMBER_MAP> m_mapBufferNumbers; // 保存buffer等级数值
};
extern BuffSetting g_cBufferSetting;
#endif // bufsetting_h__
| |
6af4fb0e0ec985a9c2e552ecd56c422333b0b96c | 9c51ff37abe496d675d2d0f738be3a08f2713c37 | /PA5/problem_32/pizza.h | e27ca86bb8441e1736b79e6698925850a6a3201d | [] | no_license | ZhuoerFeng/2019-OOP | 3dd49c2b9f895e048fa4e4c6be15cd540801eedf | a80c9db1a1daa1fa07e31e2de7209bca60e963ee | refs/heads/master | 2022-04-03T20:48:21.884268 | 2020-02-07T07:05:55 | 2020-02-07T07:05:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,898 | h | pizza.h | #pragma once
#include <cstring>
#include <iostream>
#include "plate.h"
class Pizza {
protected:
std::string name;
int ketchup, cheese;
bool cooked;
bool cutted;
Plate *plate;
public:
Pizza(const std::string &name, int ketchup, int cheese)
: name(name), ketchup(ketchup), cheese(cheese), cooked(false), cutted(false), plate(nullptr) {}
virtual void cook() {
this->cooked = true;
}
virtual void cut() {
this->cutted = true;
}
virtual void put_on(Plate *plate) {
this->plate = plate;
plate->hold_pizza(this);
}
virtual void eat() {
std::cout << "Eating " << this->name << " (";
float total = (this->ketchup + this->cheese) / 100.0f;
if (total == 0.0f) total = 1.0f;
std::cout << static_cast<int>(round(this->ketchup / total)) << "% ketchup";
std::cout << " and ";
std::cout << static_cast<int>(round(this->cheese / total)) << "% cheese";
if (this->cooked || this->cutted) {
std::cout << " that is";
if (this->cooked) std::cout << " cooked";
if (this->cooked && this->cutted) std::cout << " and";
if (this->cutted) std::cout << " cutted";
}
std::cout << ") from " << this->plate->id() << " plate.";
std::cout << std::endl;
}
virtual ~Pizza() {
this->plate->hold_pizza(nullptr);
std::cout << "Washed " << this->plate->id() << " plate." << std::endl;
}
};
class Seafood_Pizza : public Pizza {
Seafood_Pizza() : Pizza("Seafood Pizza", 30, 90) {}
};
class Beef_Pizza : public Pizza {
Beef_Pizza() : Pizza("Beef Pizza", 20, 40) {}
};
class Fruit_Pizza : public Pizza {
Fruit_Pizza() : Pizza("Fruit Pizza", 0, 0) {}
};
class Sausage_Pizza : public Pizza {
Sausage_Pizza() : Pizza("Sausage Pizza", 40, 20) {}
};
class Tomato_Pizza : public Pizza {
Tomato_Pizza() : Pizza("Tomato Pizza", 20, 0) {}
};
class Cheese_Pizza : public Pizza {
Cheese_Pizza() : Pizza("Cheese Pizza", 0, 20) {}
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.