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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
25bad15a3b618a3089ad6116fbf797933a20fffc | 9396d9fb0d28de2d126061caff9ad7a8704d2464 | /TSorter.cpp | 0ce48928aca699ef6f73a994f05c642630b4d1d8 | [] | no_license | mmerali1/CS240-Lab5-TemplatedSorters | 8dfd58be3cdbc6d51fa8017f3389d34ec5f7355c | 7834cf83519f2259ebbc0d0baaa381d55f9ae7ee | refs/heads/master | 2021-07-16T16:37:19.341292 | 2017-10-20T17:47:01 | 2017-10-20T17:47:01 | 107,708,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,570 | cpp | TSorter.cpp | #include <iostream>
using namespace std;
#include "TSorter.h"
template <class T>
void TSorter<T>::swap(typename vector<T>::iterator i, typename vector<T>::iterator j) {
T tmp;
tmp = *i;
*i = *j;
*j = tmp;
return;
}
template <class T>
TSorter<T>::TSorter() {
numElements = vec.size();
}
template <class T>
void TSorter<T>::clear() {
vec.clear();
return;
}
template <class T>
void TSorter<T>::insert(T element) {
vec.push_back(element);
numElements++;
}
template <class T>
TSorter<T>::~TSorter() {
// if (vec) {
// delete vec;
numElements = 0;
// }
}
// Shuffle array elements
template <class T>
void TSorter<T>::shuffle() {
std::random_shuffle(vec.begin(), vec.end());
}
// Show the first n elements, k per line, using <<
template <class T>
void TSorter<T>::show() {
for (iter=vec.begin();iter!=vec.end();iter++) {
cout << *iter << " ";
}
cout << endl << endl;
}
// Iterative Insertion Sort
template <class T>
void TSorter<T>::insertionSortI() {
//cout << "Sorter::insertionSortI() not implemented yet." << endl << endl;
typename vector<T>::iterator i, j;
T temp;
for(i=(vec.begin()+1);i!=vec.end();i++){
temp=*i;
j=i;
while((j!=vec.begin()) && (*(j-1) > temp)){
swap(j, j-1);
j = j-1;
}
}
}
// Iterative Selection Sort
template <class T>
void TSorter<T>::selectionSortI() {
//cout << "Sorter::selectionSortI()" << endl << endl;
typename vector<T>::iterator i,j , min;
for (i=vec.begin(); i!=vec.end()-1;i++){
min = i;
for(j=i+1; j<vec.end();j++){
if (*j < *min) {min=j;}
}
swap(i,min);
}
}
// Iterative Bubble Sort
template <class T>
void TSorter<T>::bubbleSortI() {
//cout << "Sorter::bubbleSortI() not implemented yet." << endl << endl;
typename vector<T>::iterator i,j , min;
for (i=vec.end(); vec.begin()!=i ; i--){
for (j=vec.begin()+1; j!=i; j++){
if (*(j-1) > *j){
swap(j-1, j);
}
}
}
}
//Recursive Insertion Sort
template <class T>
void TSorter<T>::insertionSortR() {
//cout << "Sorter::insertionSortI() not implemented yet." << endl << endl;
if (insertSortR(vec.begin()+1)){
insertionSortR();
}
}
template <class T>
bool TSorter<T>::insertSortR(typename vector<T>::iterator i){
typename vector<T>::iterator j;
T temp;
if (i>vec.end()-1){
return false;
}
temp = *i;
j=i;
bool isGrt = (*(j-1) > temp);
if (isGrt){
swap(j, j-1);
j=j-1;
}
return isGrt or insertSortR(i+1);
}
// Recursive Selection Sort
template <class T>
void TSorter<T>::selectionSortR() {
//cout << "Sorter::selectionSortR() not implemented yet." << endl << endl;
if (selSortR(vec.begin())){
selectionSortR();
}
}
template <class T>
bool TSorter<T>::selSortR(typename vector<T>::iterator i){
if (i >= vec.end()-1){
return false;
}
typename vector<T>::iterator min = i, j=i+1;
bool isGtr = *j < *min;
if (isGtr){
min = j;
}
swap(i,min);
return isGtr or selSortR(i+1);
}
// Recursive Bubble Sort
template <class T>
void TSorter<T>::bubbleSortR() {
//cout << "Sorter::bubbleSortR() not implemented yet." << endl << endl;
if(bubbleNest1(vec.begin())){
bubbleSortR();
}
}
template <class T>
bool TSorter<T>::bubbleNest1(typename vector<T>::iterator i){
if (i>=vec.end()-1){
return false;
}
bool bub = (*i > *(i+1));
if (bub){
swap(i, i+1);
}
return bub or bubbleNest1(i+1);
}
template class TSorter<int>;
template class TSorter<string>;
template class TSorter<Circle>;
|
207a78a7c683247af371896c5b3912f3e4b57b5c | b28a4f0231dceec2a8c083f7a9a6bf5e739e1f93 | /src/statslab.hpp | c8d209f958c3f3733142d4de572e6df432689d96 | [
"MIT"
] | permissive | apetcho/statslab | e6bd865faeea7010859c04d62b9cd4bc4d20d5e2 | f3ba97bd8712ca02289e30feeaf8f1d6ff0c65ac | refs/heads/master | 2023-04-22T06:43:07.752236 | 2021-04-24T17:54:26 | 2021-04-24T17:54:26 | 314,516,834 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,395 | hpp | statslab.hpp | #ifndef _STATSLAB_H
#define _STATSLAB_H
#include<valarray>
#include<vector>
#include<array>
#include<string>
#include<exception>
#include<list>
namespace statslab {
class NormalDist; // forward declaration
class CenterInfo;
class DispersionInfo;
class ShapeInfo;
class SummaryTable;
class DescStats{
friend class CenterInfo;
friend class DispersionInfo;
friend class ShapeInfo;
friend class SummaryTable;
public:
DescStats();
private:
std::valarray<double> data;
CenterInfo center;
DispersionInfo dispersion;
ShapeInfo shapeOfDist;
};
//
class CenterInfo{
public:
explicit CenterInfo()
: data_(std::valarray<double>()){}
explicit CenterInfo(std::valarray<double> &observation)
: data_{observation}{}
CenterInfo(const CenterInfo& centerObj) = delete;
CenterInfo(CenterInfo&& centerObj) = delete;
CenterInfo operator=(const CenterInfo& centerObj) = delete;
CenterInfo operator=(CenterInfo&& centerObj) = delete;
~CenterInfo(){}
double mean();
double geometric_mean();
double harmonic_mean(std::vector<double>& weights);
double median();
double median_low();
double median_high();
double median_grouped(double interval=1.0);
double mode();
std::string mode(const std::vector<std::string>& nominal_data);
std::vector<double> multimode();
std::vector<std::string> multimode(const std::vector<std::string>&
nominal_data);
private:
//
std::valarray<double> data_;
};
//
class DispersionInfo{};
//
class ShapeInfo{};
// NormalDist
class NormalDist{
public:
NormalDist(double mu=0.0, double sigma=1.0);
/* properties */
double get_mean();
double get_median();
double get_mode();
double get_stdev();
double get_variance();
/* methods */
NormalDist from_samples(std::valarray<double>&);
std::valarray<double> samples(int n, int seed=0);
double pdf(double x);
double cdf(double x);
double inv_cdf(double p);
double overlap(NormalDist&);
//std::array<double> quantiles(int n=4);
double zscore(double x);
// TODO: Load appropriate operators
// +, -, *, /, copy ctor, negation, ++, --,
// __hash__, to_string (aka ostream)
private:
double mean;
double median;
double mode;
double stdev;
double variance;
};
} // namespace statslab
#endif // _STATSLAB_H
|
e0274122de22ed8e34fbb4d05161d8ec14831f12 | 4a080d82d7819e4390f17d9e2c982e8a3ab50f63 | /ecoo14_S2_scratch.cpp | 54a979a322e58488f82cb3408d51b3a416ce8bdf | [] | no_license | qhadron/contest-solutions | dae8b1f8162618d9109b51015964f380311cd0c7 | 5f715e49777cbca6f334d476e0fb02788b8e9783 | refs/heads/master | 2021-01-10T04:44:27.300319 | 2016-01-11T23:20:56 | 2016-01-11T23:20:56 | 49,460,833 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,508 | cpp | ecoo14_S2_scratch.cpp | #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int type[10] = {1,2,5,10,50,100,1000,10000,500000,1000000};
int main() {
char c;
int data[9];
int cnt[10];
for (int testcase = 0; testcase < 10; testcase++) {
memset(data,0,sizeof(data));
memset(cnt,0,sizeof(cnt));
int qmark = 0;
for (int i = 0; i < 9; i++) {
while((c=getchar())=='\n');
if (c=='?') {
qmark++;
continue;
}
cin >> data[i];
}
for (int i = 0; i < 9; i++) {
if (data[i]) {
int pos = 4;
//binary search
for (int s = 0, t = 8; type[pos]!=data[i];pos = (s+t) >> 1) {
if (type[pos]< data[i]) {
s = ++pos;;
} else {
t = --pos; ;
}
}
cnt[pos] ++;
}
}
bool flag = false;
for (int i = 0; i < 10; i++) {
if (cnt[i]>2) {
flag = true;
cout << "$" << type[i];
break;
}
if (cnt[i]+qmark > 2) {
cout <<"$" << type[i] << " ";
flag = true;
}
}
if (!flag) cout << "No Prizes Possible" << endl;
else cout << endl;
}
}
/*
$10
$100
?
$10
$1
$50
$50
$1000
$1
$1
$2
$5
$10
$50
$100
$1000
$10000
?
*/
|
473587040acda5b0fd7bf7f81b0442140df9ae4d | 5f77fc108cc12fcc99df01a64c1a52285ccab4fe | /okulprojesi/analiz/analiz_siniflari/ogrenci_analiz.cpp | 277f93ffc988524fcf082a7de6eb25d573dcfa5e | [] | no_license | RamazanBozkurt/OkulOtomasyonu | 2e44b0032df4af1f9602eb1b038154cea2f277ff | e4a1ddccf29e0b5ee1dac1193dfd987ada9e795f | refs/heads/main | 2023-03-25T22:04:11.219479 | 2021-03-28T12:52:35 | 2021-03-28T12:52:35 | 323,713,256 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,643 | cpp | ogrenci_analiz.cpp | #include "ogrenci_analiz.h"
#include <veritabani.h>
#include <QtMath>
ogrenci_analiz::ogrenci_analiz(QObject *parent) : QObject(parent){}
void ogrenci_analiz::Hesapla()
{ _analizSonucListesi.clear();
auto ogrenciler = VeriTabani::veritabani().ogrenci().ara([](OgrenciProfil::ptr){return true;});
for (auto ogrenci: ogrenciler) {
auto notlar = VeriTabani::veritabani().notlar().ara([ogrenci](Notlar::ptr notlar){
return notlar->ogrenciId() == ogrenci->Id();});
int elemanSayisi = 0;
OgrenciProfil::ondalikli toplam = 0.0;
OgrenciProfil::ondalikli ortalama = 0.0;
OgrenciProfil::ondalikli standartSapma = 0.0;
for (auto Notlar: notlar) {
elemanSayisi++;
toplam += Notlar->toplamNot();
}
if (elemanSayisi >= 1) {
ortalama = toplam / elemanSayisi;
}
if(elemanSayisi > 1) {
for (auto Notlar: notlar) {
standartSapma += (Notlar->toplamNot() - ortalama) * (Notlar->toplamNot() - ortalama);
}
standartSapma = standartSapma / (elemanSayisi - 1);
standartSapma = qSqrt(standartSapma);
}
AnalizSonucu sonuc;
sonuc.setOgrenciId(ogrenci->Id());
sonuc.setOgrenciAdi(ogrenci->ogrenciAdi());
sonuc.setOgrenciSoyadi(ogrenci->ogrenciSoyadi());
sonuc.setNotSayisi(elemanSayisi);
sonuc.setNotToplami(toplam);
sonuc.setNotOrtalamasi(ortalama);
sonuc.setNotStandartSapmasi(standartSapma);
_analizSonucListesi.append(sonuc);
}}
|
2165b067191633f817f88a32a14be73efa4e8115 | b31b9b6f3d47a845cfb2e2e4025d960862235882 | /Source/KitchenGuardians/SaveGameKitchenGuardian.cpp | ef6af48c3fe7c466918439c462c87e56d5920e1c | [] | no_license | Xazen/KitchenGuardians | 7b746e7e3e2c4f3ba37f04788abf668e2b2afaaf | d5e16d1d37d96fa27f6db9369548283673b17dca | refs/heads/master | 2021-06-19T16:29:12.579236 | 2016-07-24T18:33:30 | 2016-07-24T18:33:30 | 34,900,394 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,021 | cpp | SaveGameKitchenGuardian.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "KitchenGuardians.h"
#include "SaveGameKitchenGuardian.h"
USaveGameKitchenGuardian::USaveGameKitchenGuardian(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
wasRestart = false;
}
void USaveGameKitchenGuardian::AddFirstScore(int32 firstScore)
{
highScoreList.Add(firstScore);
playerNameList.Add("Player X");
}
int32 USaveGameKitchenGuardian::SaveNewScoreAndReturnIndex(int32 newScore)
{
// If SaveGame already exists AddFirstScore will never be called
if (highScoreList.Num() == 0)
{
highScoreList.Add(newScore);
playerNameList.Add("Player X");
return 2015;
}
// Add new Element to playerNameList
playerNameList.Add("Player X");
bool valueIsInArray = false;
uint8 listSize = highScoreList.Num();
// Check if newScore is already in highScoreList
for (int i = 0; i < listSize; i++)
{
if (highScoreList[i] == newScore)
{
valueIsInArray = true;
return 0;
break;
}
}
// Array index out of bounds : -1 from an array of size 3
if (!valueIsInArray)
{
// UE4 Add empty item for ordering list
highScoreList.Add(0);
listSize = highScoreList.Num() - 1;
for (int j = listSize; j >= 0; j--)
{
if (highScoreList[j] < newScore)
{
if(j != 0)
{
int32 counter1 = j - 1;
highScoreList[j] = highScoreList[counter1];
// Move Playernames, too
playerNameList[j] = playerNameList[counter1];
}
}
else
{
int32 counter2 = j + 1;
highScoreList[counter2] = newScore;
// return counter2++
return (counter2 + 1);
// break
break;
}
if (j == 0)
{
highScoreList[j] = newScore;
// Set playername from old tier 1 to second tier
playerNameList[1] = playerNameList[0];
// return 1 or 2???
return 1;
// break
break;
}
}
}
return 0;
}
void USaveGameKitchenGuardian::ChangePlayerName(int32 listIndex, FString newPlayerName)
{
playerNameList[listIndex] = newPlayerName;
}
|
3fbee3a90d52607a6e0e621e96a4943947eef72b | 4c02806175a78eba1b6e4b6115f3e4f17d4a5bae | /src/Tokenizer.cpp | f5f42d3efdea36bc51ad744b886c97cd975a4fc7 | [
"BSD-3-Clause"
] | permissive | A1-Triard/fetlang | c88322eae0ea3589f732796c7a0c0e0d6b332b12 | ee31da66b9b01f5ffe827958140baa6ed2a10081 | refs/heads/master | 2022-06-05T04:22:26.584869 | 2021-12-18T16:17:32 | 2021-12-18T16:47:37 | 117,335,134 | 1 | 0 | null | 2018-01-13T10:38:22 | 2018-01-13T10:38:22 | null | UTF-8 | C++ | false | false | 10,019 | cpp | Tokenizer.cpp | #include "Tokenizer.h"
#include <algorithm>
#include <sstream>
#include "FetlangManager.h"
#include "FractionParser.h"
Tokenizer::Tokenizer(const std::string& code) {
this->code = code;
have_tokenized = false;
}
std::vector<Token> Tokenizer::splitCode() {
std::vector<Token> tokens;
std::string token = "";
// Record line number
int line = 1; // The convention is to start at 1
int parenthesis_level = 0; // Are we in parenthetical comment?
int i = 0;
int indent = 0;
while (code[i + 1] == '\t' || code[i + 1] == ' ') {
indent++;
i++;
}
line_indents.push_back(indent);
for (i = 0; code[i] != '\0'; i++) {
if (code[i] == '\n') {
line++;
int indent = 0;
while (code[i + 1] == '\t' || code[i + 1] == ' ') {
indent++;
i++;
}
line_indents.push_back(indent);
} else if (code[i] == '(') {
token = "";
tokens.push_back(Token("(", line));
parenthesis_level++;
} else if (code[i] == ')') {
if (parenthesis_level == 0) {
throw FetlangException(line, "Did not expect ')' at this time (not in a comment)");
}
tokens.push_back(Token(token, line));
token = "";
tokens.push_back(Token(")", line));
parenthesis_level--;
} else if (parenthesis_level == 0) {
if (code[i] == '"') {
/* Chain literal */
// Record whole chain
do {
if (code[i] == '\n') line++; /*Allow for multiline literals*/
// Deal with backslash quotes
if (code[i] == '\\' && code[i + 1] == '\"') {
token += "\"";
i += 1;
} else {
token += code[i];
}
// Check for end of chain
i++;
} while (code[i] != '\0' && code[i] != '"');
if (code[i] == '\0') { /*Raise error upon unfinished quote*/
};
token += '"';
tokens.push_back(Token(token, line));
token = "";
}else if(! isspace(code[i]) && code[i]!='"'/*We have to add this last part just in case gag is on to avoid a potential segfault */){
/* Identifier, keyword, fraction literal etc */
// Record whole word until whitespace or start of quote or end of string
// or a parenthesis
while (!isspace(code[i]) && code[i] != '(' && code[i] != ')' && code[i] != '"' &&
code[i] != '\0') {
token += code[i];
i++;
}
i--;
tokens.push_back(Token(token, line));
token = ""; // Make clean for next time
}
} else {
token += tolower(code[i]);
if (token == "i have a fetish for") {
tokens.push_back(Token(token, line));
token = "";
}
}
}
if (parenthesis_level != 0) {
throw FetlangException("Reached end of program without comment terminator");
}
return tokens;
}
std::vector<Token> Tokenizer::removeGags(const std::vector<Token>& tokens) const {
std::vector<Token> new_tokens;
int parenthesis_level = 0;
bool loading_fetishes = false;
std::string load_string = "";
for (Token token : tokens) {
if (token.isNullToken()) {
throw FetlangException("Encountered NULL token while removing gags");
}
// Non-nesting
if (token.getValue() == "(") {
parenthesis_level++;
} else if (token.getValue() == ")") {
parenthesis_level--;
// Load fetishes specified
if (loading_fetishes) {
std::istringstream ss(load_string);
std::string fetish;
while (std::getline(ss, fetish, ',')) {
// Trim whitespace
fetish.erase(fetish.begin(),
std::find_if(fetish.begin(), fetish.end(),
[](int ch) { return !std::isspace(ch); }));
fetish.erase(std::find_if(fetish.rbegin(), fetish.rend(),
[](int ch) { return !std::isspace(ch); })
.base(),
fetish.end());
manager.loadFetish(fetish);
}
}
loading_fetishes = false;
continue;
}
if (parenthesis_level == 0) {
new_tokens.push_back(token);
}
// Check if we're loading fetishes
else if (!loading_fetishes) {
if (token.getValue() == "i have a fetish for") {
loading_fetishes = true;
load_string = "";
}
} else {
load_string += token.getValue();
}
}
return new_tokens;
}
/*
Since both keywords and identifiers can be more than one word, this is slightly tricky
If we come across part of a keyphrase, we check ahead to find the longest valid keyphrase
if no valid keyphrase is found, that word ends up being part of an identifier (either continuing
or starting)
*/
std::vector<Token> Tokenizer::mergeTokens(const std::vector<Token>& tokens) const {
// This is used in the subsequent nested loops
// List of potential phrases like ["is","is dominant", "is dominant towards"]
// Farthest valid phrase to the right is selected as the keyphrase
std::vector<std::string> potential_phrases;
// Function return value
std::vector<Token> new_tokens;
const int tokens_size = tokens.size();
for (int i = 0; i < tokens_size; i++) {
if (tokens[i].isNullToken()) {
throw FetlangException("Encountered NULL token while merging tokens");
}
if (manager.isPartOfKeyphrase(tokens[i].getValue())) {
// Current token is a keyword
int last_valid_phrase = -1;
potential_phrases.clear();
potential_phrases.push_back(tokens[i].getValue());
int j;
// Also have to make sure it's all on the same line :P
for (j = 0; j < manager.getMaxKeyphraseSize() &&
(tokens[i].getLine() == tokens[i + j].getLine());
j++) {
if (i + j >= tokens_size) {
break;
}
// Chain words into phrases
if (j > 0) {
potential_phrases.push_back(potential_phrases.back() + " " +
tokens[i + j].getValue());
}
if (manager.isKeyphrase(potential_phrases[j])) {
// Current phrase is a keyphrase, so take note
last_valid_phrase = j;
}
}
if (last_valid_phrase != -1) {
// Yay! Phrase is valid, add it to new_tokens!
Token token(potential_phrases[last_valid_phrase], tokens[i].getLine());
token.setCategory(Token::KEYPHRASE_TOKEN);
new_tokens.push_back(token);
// Don't forget to forward past phrase before continuing
i = i + last_valid_phrase;
continue;
}
// Or not...
}
// Current token is NOT part of a keyphrase
// So then what kind of token is it? :O
Token token = Token(tokens[i].getValue(), tokens[i].getLine());
if (tokens[i].getValue().length() <= 0) {
FetlangException(tokens[i].getLine(), "Token has null value");
}
// Could it be a chain literal!?
if (tokens[i].getValue()[0] == '"') {
token.setCategory(Token::CHAIN_LITERAL_TOKEN);
// Or maybe a fraction literal?
} else if (FractionParser::startsFractionLiteral(tokens[i].getValue())) {
// Collect the whole fraction string
std::string fraction_string = tokens[i].getValue();
while (i + 1 < tokens_size &&
FractionParser::partOfFractionLiteral(tokens[i + 1].getValue())) {
fraction_string += " " + tokens[i + 1].getValue();
i++;
}
// Raise exceptions if you got 'em
FractionParser::stringToFraction(fraction_string);
token = Token(fraction_string, tokens[i].getLine());
token.setCategory(Token::FRACTION_LITERAL_TOKEN);
} else {
// Not a keyphrase or a chain or a fraction? Guess it's an identifier!
// But, what if there was an identifier before it on the same line? Then combine them :O
const auto new_tokens_size = new_tokens.size();
if ((new_tokens_size > 0) &&
(new_tokens[new_tokens_size - 1].getCategory() == Token::IDENTIFIER_TOKEN) &&
(new_tokens[new_tokens_size - 1].getLine() == tokens[i].getLine())) {
// Now kiss(concat tokens)
new_tokens[new_tokens_size - 1] =
Token(new_tokens[new_tokens_size - 1].getValue() + " " + tokens[i].getValue(),
tokens[i].getLine());
new_tokens[new_tokens_size - 1].setCategory(Token::IDENTIFIER_TOKEN);
continue;
} else {
// Nvm - just make a new token
token.setCategory(Token::IDENTIFIER_TOKEN);
}
}
// Cool, it's a valid token now, just add it friend
new_tokens.push_back(token);
}
return new_tokens;
}
inline static bool tokenIsPossessivePronoun(const Token& t) {
if (t.getCategory() == Token::KEYPHRASE_TOKEN &&
t.getKeyphraseCategory() == PRONOUN_KEYPHRASE) {
return manager.getPronoun(t.getValue()).isPossessive();
}
return false;
}
std::vector<Token> Tokenizer::removePossessions(const std::vector<Token>& old_tokens) {
try {
std::vector<Token> tokens;
for (auto it = old_tokens.begin(); it != old_tokens.end(); it++) {
tokens.push_back(*it);
if (it->getCategory() == Token::IDENTIFIER_TOKEN) {
// Identifier, so remove everything after ' character
if (it->getValue().find("\'") != std::string::npos) {
tokens.back().setValue(it->getValue().substr(0, it->getValue().find("\'")));
}
} else if (tokenIsPossessivePronoun(*it)) {
// Possessive pronoun, so eliminate following identifiers
int have_skipped = false;
if (it->getValue() == "her") {
have_skipped = true; // Because "her" can be possessive or not
}
while ((it + 1) != old_tokens.end() &&
(it + 1)->getCategory() == Token::IDENTIFIER_TOKEN) {
// Must be on the same line
if (it->getLine() != (it + 1)->getLine()) break;
it++;
have_skipped = true;
}
if (!have_skipped) {
throw TokenException("Expected possessions to follow possessive pronoun", *it);
}
}
}
return tokens;
} catch (const FetlangException&) {
throw;
} catch (const std::exception& e) {
throw std::runtime_error(std::string("Well, removePossessions is broken: ") + e.what());
}
}
std::vector<Token> Tokenizer::tokenize() {
if (have_tokenized) {
throw FetlangException("Cannot tokenize twice");
}
have_tokenized = true;
actual_tokens = removePossessions(mergeTokens(removeGags(splitCode())));
return getTokens();
}
std::vector<Token> Tokenizer::getTokens() const {
if (!have_tokenized) {
throw FetlangException("Can't getTokens without tokenizing first");
}
return actual_tokens;
}
std::vector<int> Tokenizer::getLineIndents() const {
if (!have_tokenized) {
throw FetlangException("Can't getLineIndents without tokenizing first");
}
return line_indents;
}
|
53715bbe1681841b776fe0e2ccc76b533c091c3f | 13971e68bec98c2ced9869b6b7e8dac517c0a5ce | /Lab03/mergesort(1).cpp | 970e7533c7bad15e32c0e5be48b93787eece70f6 | [] | no_license | jaredml/CSE100 | da912496aafe6b97936c8668759288ccbc3b04e2 | 6358a7d95f65774ec0ec442ccdb006986b1a7b15 | refs/heads/master | 2021-01-10T23:03:58.571289 | 2017-03-15T18:03:19 | 2017-03-15T18:03:19 | 70,428,287 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,202 | cpp | mergesort(1).cpp | //mergesort
#include <iostream>
using namespace std;
template <class T>
void merge_sort(T array[],int beg, int end){
if (beg == end){
return;
}
int mid = (beg+end)/2;
merge_sort(array,beg,mid);
merge_sort(array,mid+1,end);
int i = beg,j = mid+1;
int l = end-beg+1;
T *temp = new T [l];
for (int k = 0;k < l; k++){
if (j > end || (i <= mid && array[i] < array[j])){
temp[k] = array[i];
i++;
}
else{
temp[k] = array[j];
j++;
}
}
for (int k = 0,i = beg; k<l; k++, i++){
array[i] = temp[k];
}
delete temp;
}
int main() {
int i, n, k;
cout << "Enter number of elements: ";
cin >> n;
int array[n];
cout << "Enter elements\n";
while(n != 0){
int l = sizeof(array)/sizeof(array[0]);
for(i = 0; i < n; i++){
cin >> array[i];
}
merge_sort(array, 0, l-1);
cout << "After sorting the elements are\n";
for (k = 0;k < l; k++){
cout << array[k] << endl;
}
cin >> n;
}
return 0;
}
|
ce379be6fedb92d35582cc6b4960dc78317da414 | 27c75711bbe10b3120c158971bb4e830af0c33e8 | /AsZ/2015.08.20/H.cpp | fb3879b4a6fe92cab4c606c0a05488e0c6697ead | [] | no_license | yl3i/ACM | 9d2f7a6f3faff905eb2ed6854c2dbf040a002372 | 29bb023cb13489bda7626f8105756ef64f89674f | refs/heads/master | 2021-05-22T02:00:56.486698 | 2020-04-04T05:45:10 | 2020-04-04T05:45:10 | 252,918,033 | 0 | 0 | null | 2020-04-04T05:36:11 | 2020-04-04T05:36:11 | null | UTF-8 | C++ | false | false | 827 | cpp | H.cpp | #include <bits/stdc++.h>
using namespace std;
const long long oo = (long long) 1e18;
long long ans;
typedef long long ll;
ll dfs(ll L, ll R)
{
if (R > ans) return oo;
if (L == 0) return R;
if (L < 0) return oo;
// cout << R;
if (R - L + 1 > L + 1)
return oo;
ll nl, nr, tmp = oo;
//lson
nl = L;
//a
nr = R * 2 - nl;
if (nr > nl)
tmp = min(tmp, dfs(nl, nr));
nr++;
if (nr > nl)
tmp = min(tmp, dfs(nl, nr));
//rson
nr = R;
nl = 2 * (L - 1) - nr;
if (nr > nl)
tmp = min(tmp, dfs(nl, nr));
nl ++;
if (nr > nl)
tmp = min(tmp, dfs(nl, nr));
return tmp;
}
int main()
{
//freopen("H.in", "r", stdin);
int L, R;
for (; scanf("%d%d", &L, &R) != EOF;)
{
ans = oo;
ans = dfs(1LL * L, 1LL * R);
if (ans == oo)
cout << -1 << endl;
else cout << ans << endl;
}
return 0;
}
|
2e95b5ca58ef9bfe0374aae7c3ef6471da1c55a1 | e91b7432ac78b5aae4d9b47d1d23fbe71e39f08f | /src/yars/configuration/xsd/graphviz/graph/XsdRegularExpressionGraphNode.h | 0100ed9969c995be9abbc76fe03382e50f73e3c7 | [
"MIT"
] | permissive | kzahedi/YARS | 90818b69c3fee12b3812b52f722ac52b728f064b | 48d9fe4178d699fba38114d3b299a228da41293d | refs/heads/master | 2020-05-21T03:29:48.826895 | 2019-04-24T13:44:25 | 2019-04-24T13:44:25 | 64,328,589 | 4 | 1 | null | 2017-02-23T19:55:08 | 2016-07-27T17:30:54 | C++ | UTF-8 | C++ | false | false | 745 | h | XsdRegularExpressionGraphNode.h | #ifndef __XSD_REGULAR_EXPRESSION_GRAPH_NODE_H__
#define __XSD_REGULAR_EXPRESSION_GRAPH_NODE_H__
#include <yars/configuration/xsd/graphviz/graph/XsdGraphNode.h>
#include <yars/configuration/xsd/specification/XsdRegularExpression.h>
#include <string>
#include <sstream>
using namespace std;
class XsdRegularExpressionGraphNode : public XsdGraphNode
{
public:
XsdRegularExpressionGraphNode(XsdRegularExpression *spec);
string customLabel(string label);
string name();
string content();
XsdRegularExpression* spec();
private:
stringstream _oss;
XsdRegularExpression *_spec;
string _specification;
string _type;
};
#endif // __XSD_REGULAR_EXPRESSION_GRAPH_NODE_H__
|
997fe86bca315abb7576bc3a094a2128b23a7605 | 816387bfc88fd5832ee12715ec6f8ad4e3a721ee | /SearchingSorting/104SquareRoor.cpp | 8119728a6c32194bd4670f2a8d3ae51c937a2067 | [] | no_license | Siriayanur/DSA | 2710163f93e65878d0985307cc838128bfcfb8f5 | 11679a585b2aec2d5b1eeefb97e469ac6f95ef84 | refs/heads/master | 2023-06-18T04:54:38.886743 | 2021-07-17T12:37:50 | 2021-07-17T12:37:50 | 314,945,846 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 266 | cpp | 104SquareRoor.cpp | #include <iostream>
#include <math.h>
using namespace std;
class Solution
{
public:
int countSquares(int n)
{
// code here
float a = sqrt(n);
if (floor(a) == a)
{
return a - 1;
}
return a;
}
}; |
3f490a742e21992b746f5c049a6586adf76a9e82 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/mutt/gumtree/mutt_repos_function_1463.cpp | cab7e231834427f7d90880771448163cf36f9f8b | [] | 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 | 142 | cpp | mutt_repos_function_1463.cpp | static int crypt_mod_pgp_check_traditional (FILE *fp, BODY *b, int tagged_only)
{
return pgp_gpgme_check_traditional (fp, b, tagged_only);
} |
2747321a52f52115c8e1f22dd43c59ea1f5c81b8 | 6c9c5133fb5328fc63d7c981077cf93d63901116 | /src/interconnect/test/TestScanRequest.h | 20dc623d1624ce61a3351dcae69856d8b5f88676 | [] | no_license | phrocker/BjarneClient | c6f41b2811376f9cb63d4aed8d96c650b1ac9579 | 7d8001140b141631f241e2053b9ea0f80081ba3e | refs/heads/master | 2021-01-20T11:44:19.555301 | 2017-02-02T16:38:44 | 2017-02-02T16:38:44 | 5,772,220 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,907 | h | TestScanRequest.h | /**
* Hello, this is BjarneClient, a free and open implementation of Accumulo
* and big table. This is meant to be the client that accesses Accumulo
* and BjarneTable -- the C++ implemenation of Accumulo. Copyright (C)
* 2013 -- BinaryStream LLC
*
* 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 TESTSCANREQUEST_H_
#define TESTSCANREQUEST_H_
#define SIGNED_RIGHT_SHIFT_IS 5
#define ARITHMETIC_RIGHT_SHIFT 5
#include <string>
using namespace std;
#include <protocol/TBinaryProtocol.h>
#include <protocol/TCompactProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TServerTransport.h>
#include <transport/TTransport.h>
#include <transport/TSocket.h>
#include <transport/TTransportException.h>
#include <transport/TBufferTransports.h>
#include <concurrency/ThreadManager.h>
#include <pthread.h>
#include <sys/time.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
#include "../../data/constructs/test/RunUnit.h"
#include "../../data/constructs/Key.h"
#include "../../data/constructs/value.h"
#include "../scanrequest/ScanRequest.h"
#include "../scanrequest/ScanIdentifier.h"
#include "../../data/extern/thrift/ThriftWrapper.h"
#include "../../data/extern/thrift/data_types.h"
#include <assert.h>
using namespace cclient::data;
using namespace interconnect;
using namespace cclient::test;
class TestIdentifier: public RunUnit
{
public:
bool testCreate()
{
ScanIdentifier<string, string> identifier;
identifier.getIdentifiers("autos").push_back("ford");
vector<string> st = identifier.getGlobalMapping();
if (st.size() != 1)
return false;
return true;
}
TestIdentifier()
{
addUnit(
unit("Test Creating Scan Identifier",
(unitFunc) &TestIdentifier::testCreate));
}
};
class TestThrift: public RunUnit
{
public:
bool testCreateAllSet()
{
AuthInfo info("testUser", "testPassword", "testInstanceId");
list<string> authList;
authList.push_back("one");
authList.push_back("two");
Authorizations auths(authList);
ServerConnection connection("127.0.0.1", 35533, 209023L);
ScanIdentifier<KeyExtent*, Range*> identifier;
KeyExtent ex("!0", ";");
Key key;
key.setColFamily("first");
key.setColQualifier("first");
Key key2;
key.setColFamily("first");
key.setColQualifier("first2");
Range range(&key,true,&key2,false);
identifier.getIdentifiers(&ex).push_back(&range);
ScanRequest<ScanIdentifier<KeyExtent*, Range*>> *request =
new ScanRequest<ScanIdentifier<KeyExtent*, Range*>>(&info, &auths,
&connection);
Column c("columnFam", "colQual", "viz");
request->addColumn(&c);
request->putIdentifier( &identifier );
UNIT_ASSERT( request->getIterators()->size() == 0 )
accumulo::security::AuthInfo authVer = ThriftWrapper::convert(request->getCredentials());
UNIT_ASSERT( (authVer.instanceId == info.getInstanceId()) )
UNIT_ASSERT( authVer.password == info.getPassword() )
UNIT_ASSERT( (authVer.user == info.getUserName()) )
vector<accumulo::data::IterInfo> iterList = ThriftWrapper::convert( request->getIterators() );
UNIT_ASSERT( iterList.size() == 0 )
/**
* ThriftWrapper::convert(request->getCredentials()),
ThriftWrapper::convert(request->getRangeIdentifier()),
ThriftWrapper::convert(request->getColumns()),
ThriftWrapper::convert(iters), iterOptions,
*/
return true;
}
TestThrift()
{
addUnit(
unit("Tests thrift conversion by populating all members",
(unitFunc) &TestThrift::testCreateAllSet));
}
};
class TestScanRequest: public RunUnit
{
public:
bool testCreate()
{
return true;
}
bool testBadConstructor()
{
ScanRequest<ScanIdentifier<string, string> > *request = NULL;
BEGIN_EXPECTED_EXCEPTION(IllegalArgumentException)request = new ScanRequest<ScanIdentifier<string,string>>(NULL, NULL, NULL);
END_EXPECTED_EXCEPTION(IllegalArgumentException)
return true;
}
TestScanRequest()
{
addUnit(
unit("Test Creating Scan Request",
(unitFunc) &TestScanRequest::testCreate));
addUnit(
unit("Ensure a failure occurs with null inputs",
(unitFunc) &TestScanRequest::testBadConstructor));
}
};
#endif /* TESTKEY_H_ */
|
10fb380ce07cd389d7bc7d42172b3525d536676f | 9c5ed15b94f72a1c8d61cdc4d817ef41ea0e4edd | /2016/January-June/sudest/main.cpp | 9cf42159cd800abc4585ca0ee88d8285c43e7648 | [] | no_license | caprariuap/infoarena | 6a2e74aa61472b4f9d429ad03710726d60856324 | a3a740d2c179f21b7177e5422072dfa61033437e | refs/heads/master | 2020-04-04T21:28:32.588930 | 2018-11-05T22:14:52 | 2018-11-05T22:14:52 | 156,287,370 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,027 | cpp | main.cpp | #include <fstream>
using namespace std;
ifstream fin("sudest.in");
ofstream fout("sudest.out");
short n,a[102][102],nrpasi,pas[200];
struct pasii{short cx,cy;};pasii solutie[200],curent[200];
short p[102][102];
int dx[]={0,1};
int dy[]={1,0};
short smax;
short s;
int interior(int x,int y)
{if (x>=1&&x<=n&&y>=1&&y<=n)
return 1;
return 0;
}
void bkt(int x,int y,int nrpas)
{int k;
if (x==n&&y==n)
{if (s>smax)
{smax=s;for (k=1;k<=nrpasi;k++)
solutie[k]=curent[k];}}
else
{for (k=0;k<2;k++)
{int dxk=x+dx[k]*pas[nrpas];
int dyk=y+dy[k]*pas[nrpas];
if (interior(dxk,dyk)&&p[dxk][dyk]<s+a[dxk][dyk])
curent[nrpas].cx=dxk,curent[nrpas].cy=dyk,p[dxk][dyk]=p[x][y]+a[dxk][dyk],s+=a[dxk][dyk],bkt(dxk,dyk,nrpas+1),s-=a[dxk][dyk];
}
}
}
int main()
{fin>>n;
int i,j;
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
fin>>a[i][j];
fin>>nrpasi;
for (i=1;i<=nrpasi;i++)
fin>>pas[i];
bkt(1,1,1);fout<<p[n][n]+a[1][1]<<'\n';fout<<'1'<<' '<<'1'<<'\n';
for (i=1;i<=nrpasi;i++)
fout<<solutie[i].cx<<' '<<solutie[i].cy<<'\n';
}
|
ec85fb15a96b6c7b10026864693c3182f8650324 | d415e0e611c1aef5cc349c99e870623ed80117fd | /Pacote-Download/ProgramasVS/VariaveisLocais/VariavelLocalEscopo.cpp | c3cabf1f38870995a667eb0efeca040857c67665 | [
"MIT"
] | permissive | julianerf/CursoCpp | eb00bdd940b43b34dfbff011d0154f6d738ef5e8 | e596fb558c240c4c0c3b11a60591879c5cc74d42 | refs/heads/master | 2022-12-14T18:13:14.196503 | 2020-09-14T22:13:35 | 2020-09-14T22:13:35 | 295,543,986 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 167 | cpp | VariavelLocalEscopo.cpp | #include <iostream>
int main()
{
int i;
for (int i = 0; i < 5; i++)
{
int j = i + 2;
std::cout << i << " " << j << std::endl;
}
system("PAUSE");
return 0;
} |
fd621a099312a0587008e7328bbdfd705c930c9d | 1fb357bb753988011e0f20c4ca8ec6227516b84b | /NewPhysics/src/NP_couplings.cpp | ceae2e8ce67a78ba6a9f2308a62d4b578d174c73 | [
"DOC"
] | permissive | silvest/HEPfit | 4240dcb05938596558394e97131872269cfa470e | cbda386f893ed9d8d2d3e6b35c0e81ec056b65d2 | refs/heads/master | 2023-08-05T08:22:20.891324 | 2023-05-19T09:12:45 | 2023-05-19T09:12:45 | 5,481,938 | 18 | 11 | null | 2022-05-15T19:53:40 | 2012-08-20T14:03:58 | C++ | UTF-8 | C++ | false | false | 59,036 | cpp | NP_couplings.cpp | /*
* Copyright (C) 2014 HEPfit Collaboration
*
*
* For the licensing terms see doc/COPYING.
*/
#include "NP_couplings.h"
#include "NPbase.h"
//----- Zff couplings observables ----------
/* -------------------------------------*/
deltagZveveL::deltagZveveL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZveveL::~deltagZveveL()
{}
double deltagZveveL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::NEUTRINO_1));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::NEUTRINO_1));
double gSM = (SM.getLeptons(StandardModel::NEUTRINO_1)).getIsospin()
- ((SM.getLeptons(StandardModel::NEUTRINO_1)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZvmuvmuL::deltagZvmuvmuL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZvmuvmuL::~deltagZvmuvmuL()
{}
double deltagZvmuvmuL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::NEUTRINO_2));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::NEUTRINO_2));
double gSM = (SM.getLeptons(StandardModel::NEUTRINO_2)).getIsospin()
- ((SM.getLeptons(StandardModel::NEUTRINO_2)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZvtavtaL::deltagZvtavtaL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZvtavtaL::~deltagZvtavtaL()
{}
double deltagZvtavtaL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::NEUTRINO_3));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::NEUTRINO_3));
double gSM = (SM.getLeptons(StandardModel::NEUTRINO_3)).getIsospin()
- ((SM.getLeptons(StandardModel::NEUTRINO_3)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZeeL::deltagZeeL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZeeL::~deltagZeeL()
{}
double deltagZeeL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::ELECTRON));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::ELECTRON));
double gSM = (SM.getLeptons(StandardModel::ELECTRON)).getIsospin()
- ((SM.getLeptons(StandardModel::ELECTRON)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZeeR::deltagZeeR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZeeR::~deltagZeeR()
{}
double deltagZeeR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::ELECTRON));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::ELECTRON));
double gSM = - ((SM.getLeptons(StandardModel::ELECTRON)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZmumuL::deltagZmumuL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZmumuL::~deltagZmumuL()
{}
double deltagZmumuL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::MU));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::MU));
double gSM = (SM.getLeptons(StandardModel::MU)).getIsospin()
- ((SM.getLeptons(StandardModel::MU)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZmumuR::deltagZmumuR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZmumuR::~deltagZmumuR()
{}
double deltagZmumuR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::MU));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::MU));
double gSM = - ((SM.getLeptons(StandardModel::MU)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZtataL::deltagZtataL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZtataL::~deltagZtataL()
{}
double deltagZtataL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::TAU));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::TAU));
double gSM = (SM.getLeptons(StandardModel::TAU)).getIsospin()
- ((SM.getLeptons(StandardModel::TAU)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZtataR::deltagZtataR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZtataR::~deltagZtataR()
{}
double deltagZtataR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getLeptons(StandardModel::TAU));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(StandardModel::TAU));
double gSM = - ((SM.getLeptons(StandardModel::TAU)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZuuL::deltagZuuL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZuuL::~deltagZuuL()
{}
double deltagZuuL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::UP));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::UP));
double gSM = (SM.getQuarks(StandardModel::UP)).getIsospin()
- ((SM.getQuarks(StandardModel::UP)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZuuR::deltagZuuR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZuuR::~deltagZuuR()
{}
double deltagZuuR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::UP));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::UP));
double gSM = - ((SM.getQuarks(StandardModel::UP)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZuuV::deltagZuuV(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZuuV::~deltagZuuV()
{}
double deltagZuuV::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::UP));
double gSM = ((SM.getQuarks(StandardModel::UP)).getIsospin()) * (1.0 - 4.0*fabs(SM.getQuarks(StandardModel::UP).getCharge())*sw2_tree);
return dgV/gSM;
}
/* -------------------------------------*/
deltagZuuA::deltagZuuA(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZuuA::~deltagZuuA()
{}
double deltagZuuA::computeThValue()
{
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::UP));
double gSM = (SM.getQuarks(StandardModel::UP)).getIsospin();
return dgA/gSM;
}
/* -------------------------------------*/
deltagZccL::deltagZccL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZccL::~deltagZccL()
{}
double deltagZccL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::CHARM));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::CHARM));
double gSM = (SM.getQuarks(StandardModel::CHARM)).getIsospin()
- ((SM.getQuarks(StandardModel::CHARM)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZccR::deltagZccR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZccR::~deltagZccR()
{}
double deltagZccR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::CHARM));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::CHARM));
double gSM = - ((SM.getQuarks(StandardModel::CHARM)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZttL::deltagZttL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZttL::~deltagZttL()
{}
double deltagZttL::computeThValue()
{
// Corrections to Ztt eff. couplings are 0 by default in NPBase, unless overrriden.
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::TOP));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::TOP));
double gSM = (SM.getQuarks(StandardModel::TOP)).getIsospin()
- ((SM.getQuarks(StandardModel::TOP)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZttR::deltagZttR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZttR::~deltagZttR()
{}
double deltagZttR::computeThValue()
{
// Corrections to Ztt eff. couplings are 0 by default in NPBase, unless overrriden.
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::TOP));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::TOP));
double gSM = - ((SM.getQuarks(StandardModel::TOP)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZttV::deltagZttV(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZttV::~deltagZttV()
{}
double deltagZttV::computeThValue()
{
// Corrections to Ztt eff. couplings are 0 by default in NPBase, unless overrriden.
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::TOP));
double gSM = ((SM.getQuarks(StandardModel::TOP)).getIsospin()) * (1.0 - 4.0*fabs(SM.getQuarks(StandardModel::TOP).getCharge())*sw2_tree);
return dgV/gSM;
}
/* -------------------------------------*/
deltagZttA::deltagZttA(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZttA::~deltagZttA()
{}
double deltagZttA::computeThValue()
{
// Corrections to Ztt eff. couplings are 0 by default in NPBase, unless overrriden.
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::TOP));
double gSM = (SM.getQuarks(StandardModel::TOP)).getIsospin();
return dgA/gSM;
}
/* -------------------------------------*/
deltagZddL::deltagZddL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZddL::~deltagZddL()
{}
double deltagZddL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::DOWN));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::DOWN));
double gSM = (SM.getQuarks(StandardModel::DOWN)).getIsospin()
- ((SM.getQuarks(StandardModel::DOWN)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZddV::deltagZddV(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZddV::~deltagZddV()
{}
double deltagZddV::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::DOWN));
double gSM = ((SM.getQuarks(StandardModel::DOWN)).getIsospin()) * (1.0 - 4.0*fabs(SM.getQuarks(StandardModel::DOWN).getCharge())*sw2_tree);
return dgV/gSM;
}
/* -------------------------------------*/
deltagZddA::deltagZddA(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZddA::~deltagZddA()
{}
double deltagZddA::computeThValue()
{
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::DOWN));
double gSM = (SM.getQuarks(StandardModel::DOWN)).getIsospin();
return dgA/gSM;
}
/* -------------------------------------*/
deltagZddR::deltagZddR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZddR::~deltagZddR()
{}
double deltagZddR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::DOWN));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::DOWN));
double gSM = - ((SM.getQuarks(StandardModel::DOWN)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZssL::deltagZssL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZssL::~deltagZssL()
{}
double deltagZssL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::STRANGE));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::STRANGE));
double gSM = (SM.getQuarks(StandardModel::STRANGE)).getIsospin()
- ((SM.getQuarks(StandardModel::STRANGE)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZssR::deltagZssR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZssR::~deltagZssR()
{}
double deltagZssR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::STRANGE));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::STRANGE));
double gSM = - ((SM.getQuarks(StandardModel::STRANGE)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
deltagZbbL::deltagZbbL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZbbL::~deltagZbbL()
{}
double deltagZbbL::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::BOTTOM));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::BOTTOM));
double gSM = (SM.getQuarks(StandardModel::BOTTOM)).getIsospin()
- ((SM.getQuarks(StandardModel::BOTTOM)).getCharge())*sw2_tree;
return 0.5*(dgV + dgA)/gSM;
}
/* -------------------------------------*/
deltagZbbR::deltagZbbR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagZbbR::~deltagZbbR()
{}
double deltagZbbR::computeThValue()
{
double sw2_tree = 1.0 - (SM.StandardModel::Mw_tree())*(SM.StandardModel::Mw_tree())/(SM.getMz())/(SM.getMz());
double dgV = myNPbase->deltaGV_f(SM.getQuarks(StandardModel::BOTTOM));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(StandardModel::BOTTOM));
double gSM = - ((SM.getQuarks(StandardModel::BOTTOM)).getCharge())*sw2_tree;
return 0.5*(dgV - dgA)/gSM;
}
/* -------------------------------------*/
//----- Wff couplings observables ----------
/* -------------------------------------*/
deltaUWeve::deltaUWeve(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaUWeve::~deltaUWeve()
{}
double deltaUWeve::computeThValue()
{
double dU = myNPbase->deltaGL_Wff(SM.getLeptons(StandardModel::NEUTRINO_1), SM.getLeptons(StandardModel::ELECTRON)).real();
double gSM = 1.;
return dU/gSM;
}
/* -------------------------------------*/
deltaUWmuvmu::deltaUWmuvmu(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaUWmuvmu::~deltaUWmuvmu()
{}
double deltaUWmuvmu::computeThValue()
{
double dU = myNPbase->deltaGL_Wff(SM.getLeptons(StandardModel::NEUTRINO_2), SM.getLeptons(StandardModel::MU)).real();
double gSM = 1.;
return dU/gSM;
}
/* -------------------------------------*/
deltaUWtavta::deltaUWtavta(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaUWtavta::~deltaUWtavta()
{}
double deltaUWtavta::computeThValue()
{
double dU = myNPbase->deltaGL_Wff(SM.getLeptons(StandardModel::NEUTRINO_3), SM.getLeptons(StandardModel::TAU)).real();
double gSM = 1.;
return dU/gSM;
}
/* -------------------------------------*/
deltaVudL::deltaVudL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVudL::~deltaVudL()
{}
double deltaVudL::computeThValue()
{
double dV = myNPbase->deltaGL_Wff(SM.getQuarks(StandardModel::UP), SM.getQuarks(StandardModel::DOWN)).real();
double gSM = 1.;
return dV/gSM;
}
/* -------------------------------------*/
deltaVudR::deltaVudR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVudR::~deltaVudR()
{}
double deltaVudR::computeThValue()
{
double dV = myNPbase->deltaGR_Wff(SM.getQuarks(StandardModel::UP), SM.getQuarks(StandardModel::DOWN)).real();
return dV;
}
/* -------------------------------------*/
deltaVcsL::deltaVcsL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVcsL::~deltaVcsL()
{}
double deltaVcsL::computeThValue()
{
double dV = myNPbase->deltaGL_Wff(SM.getQuarks(StandardModel::CHARM), SM.getQuarks(StandardModel::STRANGE)).real();
double gSM = 1.;
return dV/gSM;
}
/* -------------------------------------*/
deltaVcsR::deltaVcsR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVcsR::~deltaVcsR()
{}
double deltaVcsR::computeThValue()
{
double dV = myNPbase->deltaGR_Wff(SM.getQuarks(StandardModel::CHARM), SM.getQuarks(StandardModel::STRANGE)).real();
return dV;
}
/* -------------------------------------*/
deltaVtbL::deltaVtbL(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVtbL::~deltaVtbL()
{}
double deltaVtbL::computeThValue()
{
double dV = myNPbase->deltaGL_Wff(SM.getQuarks(StandardModel::TOP), SM.getQuarks(StandardModel::BOTTOM)).real();
double gSM = 1.;
return dV/gSM;
}
/* -------------------------------------*/
deltaVtbR::deltaVtbR(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaVtbR::~deltaVtbR()
{}
double deltaVtbR::computeThValue()
{
double dV = myNPbase->deltaGR_Wff(SM.getQuarks(StandardModel::TOP), SM.getQuarks(StandardModel::BOTTOM)).real();
return dV;
}
/* -------------------------------------*/
//----- Hff couplings observables ----------
/* -------------------------------------*/
deltagHee::deltagHee(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHee::~deltagHee()
{}
double deltagHee::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getLeptons(StandardModel::ELECTRON)).real();
double gSM = -(SM.getLeptons(StandardModel::ELECTRON)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
deltagHmumu::deltagHmumu(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHmumu::~deltagHmumu()
{}
double deltagHmumu::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getLeptons(StandardModel::MU)).real();
double gSM = -(SM.getLeptons(StandardModel::MU)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHmumueff::gHmumueff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHmumueff::~gHmumueff()
{}
double gHmumueff::computeThValue()
{
return myNPbase->kappamueff();
}
/* -------------------------------------*/
deltagHtata::deltagHtata(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHtata::~deltagHtata()
{}
double deltagHtata::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getLeptons(StandardModel::TAU)).real();
double gSM = -(SM.getLeptons(StandardModel::TAU)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHtataeff::gHtataeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHtataeff::~gHtataeff()
{}
double gHtataeff::computeThValue()
{
return myNPbase->kappataueff();
}
/* -------------------------------------*/
deltagHuu::deltagHuu(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHuu::~deltagHuu()
{}
double deltagHuu::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::UP)).real();
double gSM = -(SM.getQuarks(StandardModel::UP)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
deltagHcc::deltagHcc(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHcc::~deltagHcc()
{}
double deltagHcc::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::CHARM)).real();
double gSM = -(SM.getQuarks(StandardModel::CHARM)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHcceff::gHcceff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHcceff::~gHcceff()
{}
double gHcceff::computeThValue()
{
return myNPbase->kappaceff();
}
/* -------------------------------------*/
deltagHtt::deltagHtt(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHtt::~deltagHtt()
{}
double deltagHtt::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::TOP)).real();
double gSM = -(SM.getMtpole()) / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
deltagHdd::deltagHdd(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHdd::~deltagHdd()
{}
double deltagHdd::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::DOWN)).real();
double gSM = -(SM.getQuarks(StandardModel::DOWN)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
deltagHss::deltagHss(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHss::~deltagHss()
{}
double deltagHss::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::STRANGE)).real();
double gSM = -(SM.getQuarks(StandardModel::STRANGE)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
deltagHbb::deltagHbb(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHbb::~deltagHbb()
{}
double deltagHbb::computeThValue()
{
double dg = myNPbase->deltaG_hff(SM.getQuarks(StandardModel::BOTTOM)).real();
double gSM = -(SM.getQuarks(StandardModel::BOTTOM)).getMass() / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHbbeff::gHbbeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHbbeff::~gHbbeff()
{}
double gHbbeff::computeThValue()
{
return myNPbase->kappabeff();
}
/* -------------------------------------*/
//----- HGG couplings observables ----------
/* -------------------------------------*/
deltagHGG::deltagHGG(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHGG::~deltagHGG()
{}
double deltagHGG::computeThValue()
{
return myNPbase->deltaG_hggRatio();
}
/* -------------------------------------*/
gHGGeff::gHGGeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHGGeff::~gHGGeff()
{}
double gHGGeff::computeThValue()
{
return myNPbase->kappaGeff();
}
/* -------------------------------------*/
//----- HZZ couplings observables ----------
/* -------------------------------------*/
deltagHZZ::deltagHZZ(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHZZ::~deltagHZZ()
{}
double deltagHZZ::computeThValue()
{
double dg = myNPbase->deltaG3_hZZ();
double gSM = (SM.getMz()) * (SM.getMz()) / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHZZeff::gHZZeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHZZeff::~gHZZeff()
{}
double gHZZeff::computeThValue()
{
return myNPbase->kappaZeff();
}
/* -------------------------------------*/
gHZZ1::gHZZ1(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHZZ1::~gHZZ1()
{}
double gHZZ1::computeThValue()
{
return myNPbase->deltaG1_hZZ();
}
/* -------------------------------------*/
gHZZ2::gHZZ2(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHZZ2::~gHZZ2()
{}
double gHZZ2::computeThValue()
{
return myNPbase->deltaG2_hZZ();
}
/* -------------------------------------*/
//----- HAA couplings observables ----------
/* -------------------------------------*/
deltagHAA::deltagHAA(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHAA::~deltagHAA()
{}
double deltagHAA::computeThValue()
{
return myNPbase->deltaG_hAARatio();
}
/* -------------------------------------*/
gHAAeff::gHAAeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHAAeff::~gHAAeff()
{}
double gHAAeff::computeThValue()
{
return myNPbase->kappaAeff();
}
/* -------------------------------------*/
//----- HZA couplings observables ----------
/* -------------------------------------*/
deltagHZA::deltagHZA(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHZA::~deltagHZA()
{}
double deltagHZA::computeThValue()
{
return myNPbase->deltaG1_hZARatio();
}
/* -------------------------------------*/
gHZAeff::gHZAeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHZAeff::~gHZAeff()
{}
double gHZAeff::computeThValue()
{
return myNPbase->kappaZAeff();
}
/* -------------------------------------*/
gHZA2::gHZA2(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHZA2::~gHZA2()
{}
double gHZA2::computeThValue()
{
return myNPbase->deltaG2_hZA();
}
/* -------------------------------------*/
//----- HWW couplings observables ----------
/* -------------------------------------*/
deltagHWW::deltagHWW(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltagHWW::~deltagHWW()
{}
double deltagHWW::computeThValue()
{
double dg = myNPbase->deltaG3_hWW();
double gSM = 2.0 * (SM.StandardModel::Mw_tree())* (SM.StandardModel::Mw_tree()) / (SM.v());
return dg/gSM;
}
/* -------------------------------------*/
gHWWeff::gHWWeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHWWeff::~gHWWeff()
{}
double gHWWeff::computeThValue()
{
return myNPbase->kappaWeff();
}
/* -------------------------------------*/
gHWW1::gHWW1(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHWW1::~gHWW1()
{}
double gHWW1::computeThValue()
{
return myNPbase->deltaG1_hWW();
}
/* -------------------------------------*/
gHWW2::gHWW2(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHWW2::~gHWW2()
{}
double gHWW2::computeThValue()
{
return myNPbase->deltaG2_hWW();
}
/* -------------------------------------*/
//----- Other couplings observables ----------
/* -------------------------------------*/
/* -------------------------------------*/
gHWZeff::gHWZeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHWZeff::~gHWZeff()
{}
double gHWZeff::computeThValue()
{
return (myNPbase->kappaWeff())/(myNPbase->kappaZeff());
}
/* -------------------------------------*/
gHWZSMLin::gHWZSMLin(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHWZSMLin::~gHWZSMLin()
{}
double gHWZSMLin::computeThValue()
{
double dgZ = myNPbase->deltaG3_hZZ();
double gZSM = (SM.getMz()) * (SM.getMz()) / (SM.v());
double dgW = myNPbase->deltaG3_hWW();
double gWSM = 2.0 * (SM.StandardModel::Mw_tree())* (SM.StandardModel::Mw_tree()) / (SM.v());
return (1.0 + dgW/gWSM - dgZ/gZSM);
}
/* -------------------------------------*/
gHbWeff::gHbWeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHbWeff::~gHbWeff()
{}
double gHbWeff::computeThValue()
{
return (myNPbase->kappabeff())/(myNPbase->kappaWeff());
}
/* -------------------------------------*/
gHtaWeff::gHtaWeff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
gHtaWeff::~gHtaWeff()
{}
double gHtaWeff::computeThValue()
{
return (myNPbase->kappataueff())/(myNPbase->kappaWeff());
}
/* -------------------------------------*/
//----- HHH couplings observables ----------
/* -------------------------------------*/
deltalHHH::deltalHHH(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltalHHH::~deltalHHH()
{}
double deltalHHH::computeThValue()
{
return myNPbase->deltaG_hhhRatio();
}
/* -------------------------------------*/
//----- VVV couplings observables ----------
// See aTGC in EW. Here we define only the Effective couplings used in arXiv: 1708.09079 [hep-ph]
/* -------------------------------------*/
deltag1ZEff::deltag1ZEff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltag1ZEff::~deltag1ZEff()
{}
double deltag1ZEff::computeThValue()
{
return myNPbase->deltag1ZNPEff();
}
/* -------------------------------------*/
deltaKgammaEff::deltaKgammaEff(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaKgammaEff::~deltaKgammaEff()
{}
double deltaKgammaEff::computeThValue()
{
return myNPbase->deltaKgammaNPEff();
}
/* -------------------------------------*/
//----- Basic interactions of the so-called Higgs basis ----------
/* -------------------------------------*/
deltaytHB::deltaytHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaytHB::~deltaytHB()
{}
double deltaytHB::computeThValue()
{
return myNPbase->deltayt_HB();
}
/* -------------------------------------*/
deltaybHB::deltaybHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaybHB::~deltaybHB()
{}
double deltaybHB::computeThValue()
{
return myNPbase->deltayb_HB();
}
/* -------------------------------------*/
deltaytauHB::deltaytauHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaytauHB::~deltaytauHB()
{}
double deltaytauHB::computeThValue()
{
return myNPbase->deltaytau_HB();
}
/* -------------------------------------*/
deltaycHB::deltaycHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaycHB::~deltaycHB()
{}
double deltaycHB::computeThValue()
{
return myNPbase->deltayc_HB();
}
/* -------------------------------------*/
deltaymuHB::deltaymuHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaymuHB::~deltaymuHB()
{}
double deltaymuHB::computeThValue()
{
return myNPbase->deltaymu_HB();
}
/* -------------------------------------*/
deltacZHB::deltacZHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltacZHB::~deltacZHB()
{}
double deltacZHB::computeThValue()
{
return myNPbase->deltacZ_HB();
}
/* -------------------------------------*/
cZBoxHB::cZBoxHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cZBoxHB::~cZBoxHB()
{}
double cZBoxHB::computeThValue()
{
return myNPbase->cZBox_HB();
}
/* -------------------------------------*/
cZZHB::cZZHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cZZHB::~cZZHB()
{}
double cZZHB::computeThValue()
{
return myNPbase->cZZ_HB();
}
/* -------------------------------------*/
cZgaHB::cZgaHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cZgaHB::~cZgaHB()
{}
double cZgaHB::computeThValue()
{
return myNPbase->cZga_HB();
}
/* -------------------------------------*/
cgagaHB::cgagaHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cgagaHB::~cgagaHB()
{}
double cgagaHB::computeThValue()
{
return myNPbase->cgaga_HB();
}
/* -------------------------------------*/
cggHB::cggHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cggHB::~cggHB()
{}
double cggHB::computeThValue()
{
return myNPbase->cgg_HB();
}
/* -------------------------------------*/
cggEffHB::cggEffHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
cggEffHB::~cggEffHB()
{}
double cggEffHB::computeThValue()
{
return myNPbase->cggEff_HB();
}
/* -------------------------------------*/
lambzHB::lambzHB(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
lambzHB::~lambzHB()
{}
double lambzHB::computeThValue()
{
return myNPbase->lambz_HB();
}
/* -------------------------------------*/
//----- Other useful observables to work with new physics ----------
/* -------------------------------------*/
/* -------------------------------------*/
//----- Relative correction to W mass ----------
/* -------------------------------------*/
deltaMW::deltaMW(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
deltaMW::~deltaMW()
{}
double deltaMW::computeThValue()
{
return (myNPbase->Mw())/SM.StandardModel::Mw() - 1.;
}
/* -------------------------------------*/
//----- Absolute correction to some EW couplings (factoring e/sc or e/sqrt(2)s ----------
/* -------------------------------------*/
/* -------------------------------------*/
delgZlL::delgZlL(const StandardModel& SM_i, const StandardModel::lepton lepton):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
this->lepton = lepton;
}
delgZlL::~delgZlL()
{}
double delgZlL::computeThValue()
{
double dgV = myNPbase->deltaGV_f(SM.getLeptons(lepton));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(lepton));
return 0.5*(dgV + dgA);
}
/* -------------------------------------*/
delgZlR::delgZlR(const StandardModel& SM_i, const StandardModel::lepton lepton):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
this->lepton = lepton;
}
delgZlR::~delgZlR()
{}
double delgZlR::computeThValue()
{
double dgV = myNPbase->deltaGV_f(SM.getLeptons(lepton));
double dgA = myNPbase->deltaGA_f(SM.getLeptons(lepton));
return 0.5*(dgV - dgA);
}
/* -------------------------------------*/
delgZqL::delgZqL(const StandardModel& SM_i, const StandardModel::quark quark):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
this->quark = quark;
}
delgZqL::~delgZqL()
{}
double delgZqL::computeThValue()
{
double dgV = myNPbase->deltaGV_f(SM.getQuarks(quark));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(quark));
return 0.5*(dgV + dgA);
}
/* -------------------------------------*/
delgZqR::delgZqR(const StandardModel& SM_i, const StandardModel::quark quark):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
this->quark = quark;
}
delgZqR::~delgZqR()
{}
double delgZqR::computeThValue()
{
double dgV = myNPbase->deltaGV_f(SM.getQuarks(quark));
double dgA = myNPbase->deltaGA_f(SM.getQuarks(quark));
return 0.5*(dgV - dgA);
}
/* -------------------------------------*/
//----- Oblique parameters ----------
/* -------------------------------------*/
/* -------------------------------------*/
oblS::oblS(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
oblS::~oblS()
{}
double oblS::computeThValue()
{
return (myNPbase->obliqueS());
}
/* -------------------------------------*/
oblT::oblT(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
oblT::~oblT()
{}
double oblT::computeThValue()
{
return (myNPbase->obliqueT());
}
/* -------------------------------------*/
oblW::oblW(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
oblW::~oblW()
{}
double oblW::computeThValue()
{
return (myNPbase->obliqueW());
}
/* -------------------------------------*/
oblY::oblY(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
oblY::~oblY()
{}
double oblY::computeThValue()
{
return (myNPbase->obliqueY());
}
/* -------------------------------------*/
/* -------------------------------------*/
//----- Combinations of Warsaw basis coefficients constrained by EWPO ----------
/* -------------------------------------*/
/* -------------------------------------*/
CEWHL111::CEWHL111(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL111::~CEWHL111()
{}
double CEWHL111::computeThValue()
{
return (myNPbase->CEWHL111());
}
/* -------------------------------------*/
CEWHL122::CEWHL122(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL122::~CEWHL122()
{}
double CEWHL122::computeThValue()
{
return (myNPbase->CEWHL122());
}
/* -------------------------------------*/
CEWHL133::CEWHL133(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL133::~CEWHL133()
{}
double CEWHL133::computeThValue()
{
return (myNPbase->CEWHL133());
}
/* -------------------------------------*/
CEWHL311::CEWHL311(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL311::~CEWHL311()
{}
double CEWHL311::computeThValue()
{
return (myNPbase->CEWHL311());
}
/* -------------------------------------*/
CEWHL322::CEWHL322(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL322::~CEWHL322()
{}
double CEWHL322::computeThValue()
{
return (myNPbase->CEWHL322());
}
/* -------------------------------------*/
CEWHL333::CEWHL333(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHL333::~CEWHL333()
{}
double CEWHL333::computeThValue()
{
return (myNPbase->CEWHL333());
}
/* -------------------------------------*/
CEWHQ111::CEWHQ111(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ111::~CEWHQ111()
{}
double CEWHQ111::computeThValue()
{
return (myNPbase->CEWHQ111());
}
/* -------------------------------------*/
CEWHQ122::CEWHQ122(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ122::~CEWHQ122()
{}
double CEWHQ122::computeThValue()
{
return (myNPbase->CEWHQ122());
}
/* -------------------------------------*/
CEWHQ133::CEWHQ133(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ133::~CEWHQ133()
{}
double CEWHQ133::computeThValue()
{
return (myNPbase->CEWHQ133());
}
/* -------------------------------------*/
CEWHQ311::CEWHQ311(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ311::~CEWHQ311()
{}
double CEWHQ311::computeThValue()
{
return (myNPbase->CEWHQ311());
}
/* -------------------------------------*/
CEWHQ322::CEWHQ322(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ322::~CEWHQ322()
{}
double CEWHQ322::computeThValue()
{
return (myNPbase->CEWHQ322());
}
/* -------------------------------------*/
CEWHQ333::CEWHQ333(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQ333::~CEWHQ333()
{}
double CEWHQ333::computeThValue()
{
return (myNPbase->CEWHQ333());
}
/* -------------------------------------*/
CEWHQd33::CEWHQd33(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHQd33::~CEWHQd33()
{}
double CEWHQd33::computeThValue()
{
return (myNPbase->CEWHQd33());
}
/* -------------------------------------*/
CEWHe11::CEWHe11(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHe11::~CEWHe11()
{}
double CEWHe11::computeThValue()
{
return (myNPbase->CEWHe11());
}
/* -------------------------------------*/
CEWHe22::CEWHe22(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHe22::~CEWHe22()
{}
double CEWHe22::computeThValue()
{
return (myNPbase->CEWHe22());
}
/* -------------------------------------*/
CEWHe33::CEWHe33(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHe33::~CEWHe33()
{}
double CEWHe33::computeThValue()
{
return (myNPbase->CEWHe33());
}
/* -------------------------------------*/
CEWHu11::CEWHu11(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHu11::~CEWHu11()
{}
double CEWHu11::computeThValue()
{
return (myNPbase->CEWHu11());
}
/* -------------------------------------*/
CEWHu22::CEWHu22(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHu22::~CEWHu22()
{}
double CEWHu22::computeThValue()
{
return (myNPbase->CEWHu22());
}
/* -------------------------------------*/
CEWHu33::CEWHu33(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHu33::~CEWHu33()
{}
double CEWHu33::computeThValue()
{
return (myNPbase->CEWHu33());
}
/* -------------------------------------*/
CEWHd11::CEWHd11(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHd11::~CEWHd11()
{}
double CEWHd11::computeThValue()
{
return (myNPbase->CEWHd11());
}
/* -------------------------------------*/
CEWHd22::CEWHd22(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHd22::~CEWHd22()
{}
double CEWHd22::computeThValue()
{
return (myNPbase->CEWHd22());
}
/* -------------------------------------*/
CEWHd33::CEWHd33(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
CEWHd33::~CEWHd33()
{}
double CEWHd33::computeThValue()
{
return (myNPbase->CEWHd33());
}
/* -------------------------------------*/
/* -------------------------------------*/
/* -------------------------------------*/
//----- Auxiliary observables ----------
/* -------------------------------------*/
/* -------------------------------------*/
AuxObsNP1::AuxObsNP1(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP1::~AuxObsNP1()
{}
double AuxObsNP1::computeThValue()
{
return (myNPbase->AuxObs_NP1());
}
/* -------------------------------------*/
AuxObsNP2::AuxObsNP2(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP2::~AuxObsNP2()
{}
double AuxObsNP2::computeThValue()
{
return (myNPbase->AuxObs_NP2());
}
/* -------------------------------------*/
AuxObsNP3::AuxObsNP3(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP3::~AuxObsNP3()
{}
double AuxObsNP3::computeThValue()
{
return (myNPbase->AuxObs_NP3());
}
/* -------------------------------------*/
AuxObsNP4::AuxObsNP4(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP4::~AuxObsNP4()
{}
double AuxObsNP4::computeThValue()
{
return (myNPbase->AuxObs_NP4());
}
/* -------------------------------------*/
AuxObsNP5::AuxObsNP5(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP5::~AuxObsNP5()
{}
double AuxObsNP5::computeThValue()
{
return (myNPbase->AuxObs_NP5());
}
/* -------------------------------------*/
AuxObsNP6::AuxObsNP6(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP6::~AuxObsNP6()
{}
double AuxObsNP6::computeThValue()
{
return (myNPbase->AuxObs_NP6());
}
/* -------------------------------------*/
AuxObsNP7::AuxObsNP7(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP7::~AuxObsNP7()
{}
double AuxObsNP7::computeThValue()
{
return (myNPbase->AuxObs_NP7());
}
/* -------------------------------------*/
AuxObsNP8::AuxObsNP8(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP8::~AuxObsNP8()
{}
double AuxObsNP8::computeThValue()
{
return (myNPbase->AuxObs_NP8());
}
/* -------------------------------------*/
AuxObsNP9::AuxObsNP9(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP9::~AuxObsNP9()
{}
double AuxObsNP9::computeThValue()
{
return (myNPbase->AuxObs_NP9());
}
/* -------------------------------------*/
AuxObsNP10::AuxObsNP10(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP10::~AuxObsNP10()
{}
double AuxObsNP10::computeThValue()
{
return (myNPbase->AuxObs_NP10());
}
/* -------------------------------------*/
AuxObsNP11::AuxObsNP11(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP11::~AuxObsNP11()
{}
double AuxObsNP11::computeThValue()
{
return (myNPbase->AuxObs_NP11());
}
/* -------------------------------------*/
AuxObsNP12::AuxObsNP12(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP12::~AuxObsNP12()
{}
double AuxObsNP12::computeThValue()
{
return (myNPbase->AuxObs_NP12());
}
/* -------------------------------------*/
AuxObsNP13::AuxObsNP13(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP13::~AuxObsNP13()
{}
double AuxObsNP13::computeThValue()
{
return (myNPbase->AuxObs_NP13());
}
/* -------------------------------------*/
AuxObsNP14::AuxObsNP14(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP14::~AuxObsNP14()
{}
double AuxObsNP14::computeThValue()
{
return (myNPbase->AuxObs_NP14());
}
/* -------------------------------------*/
AuxObsNP15::AuxObsNP15(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP15::~AuxObsNP15()
{}
double AuxObsNP15::computeThValue()
{
return (myNPbase->AuxObs_NP15());
}
/* -------------------------------------*/
AuxObsNP16::AuxObsNP16(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP16::~AuxObsNP16()
{}
double AuxObsNP16::computeThValue()
{
return (myNPbase->AuxObs_NP16());
}
/* -------------------------------------*/
AuxObsNP17::AuxObsNP17(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP17::~AuxObsNP17()
{}
double AuxObsNP17::computeThValue()
{
return (myNPbase->AuxObs_NP17());
}
/* -------------------------------------*/
AuxObsNP18::AuxObsNP18(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP18::~AuxObsNP18()
{}
double AuxObsNP18::computeThValue()
{
return (myNPbase->AuxObs_NP18());
}
/* -------------------------------------*/
AuxObsNP19::AuxObsNP19(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP19::~AuxObsNP19()
{}
double AuxObsNP19::computeThValue()
{
return (myNPbase->AuxObs_NP19());
}
/* -------------------------------------*/
AuxObsNP20::AuxObsNP20(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP20::~AuxObsNP20()
{}
double AuxObsNP20::computeThValue()
{
return (myNPbase->AuxObs_NP20());
}
/* -------------------------------------*/
AuxObsNP21::AuxObsNP21(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP21::~AuxObsNP21()
{}
double AuxObsNP21::computeThValue()
{
return (myNPbase->AuxObs_NP21());
}
/* -------------------------------------*/
AuxObsNP22::AuxObsNP22(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP22::~AuxObsNP22()
{}
double AuxObsNP22::computeThValue()
{
return (myNPbase->AuxObs_NP22());
}
/* -------------------------------------*/
AuxObsNP23::AuxObsNP23(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP23::~AuxObsNP23()
{}
double AuxObsNP23::computeThValue()
{
return (myNPbase->AuxObs_NP23());
}
/* -------------------------------------*/
AuxObsNP24::AuxObsNP24(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP24::~AuxObsNP24()
{}
double AuxObsNP24::computeThValue()
{
return (myNPbase->AuxObs_NP24());
}
/* -------------------------------------*/
AuxObsNP25::AuxObsNP25(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP25::~AuxObsNP25()
{}
double AuxObsNP25::computeThValue()
{
return (myNPbase->AuxObs_NP25());
}
/* -------------------------------------*/
AuxObsNP26::AuxObsNP26(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP26::~AuxObsNP26()
{}
double AuxObsNP26::computeThValue()
{
return (myNPbase->AuxObs_NP26());
}
/* -------------------------------------*/
AuxObsNP27::AuxObsNP27(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP27::~AuxObsNP27()
{}
double AuxObsNP27::computeThValue()
{
return (myNPbase->AuxObs_NP27());
}
/* -------------------------------------*/
AuxObsNP28::AuxObsNP28(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP28::~AuxObsNP28()
{}
double AuxObsNP28::computeThValue()
{
return (myNPbase->AuxObs_NP28());
}
/* -------------------------------------*/
AuxObsNP29::AuxObsNP29(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP29::~AuxObsNP29()
{}
double AuxObsNP29::computeThValue()
{
return (myNPbase->AuxObs_NP29());
}
/* -------------------------------------*/
AuxObsNP30::AuxObsNP30(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{}
AuxObsNP30::~AuxObsNP30()
{}
double AuxObsNP30::computeThValue()
{
return (myNPbase->AuxObs_NP30());
}
/* -------------------------------------*/
//----- Deviations of SM inputs with respect to reference value ----------
// (To use in future collider studies where the predictions are assumed to be SM at some
// reference point)
/* -------------------------------------*/
dalphaMzRef::dalphaMzRef(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
dalphaMzRef::~dalphaMzRef()
{}
double dalphaMzRef::computeThValue()
{
double aMz = SM.alphaMz();
return (aMz - 0.007754942001072636)/0.007754942001072636;
}
/* -------------------------------------*/
dalphaSMzRef::dalphaSMzRef(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
dalphaSMzRef::~dalphaSMzRef()
{}
double dalphaSMzRef::computeThValue()
{
double aSMz = SM.getAlsMz();
return (aSMz - 0.1180)/0.1180;
}
/* -------------------------------------*/
dMzRef::dMzRef(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
dMzRef::~dMzRef()
{}
double dMzRef::computeThValue()
{
double Mz = SM.getMz();
return (Mz - 91.1882)/91.1882;
}
/* -------------------------------------*/
dMHRef::dMHRef(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
dMHRef::~dMHRef()
{}
double dMHRef::computeThValue()
{
double Mh = SM.getMHl();
return (Mh - 125.1)/125.1;
}
/* -------------------------------------*/
dmtRef::dmtRef(const StandardModel& SM_i):
ThObservable(SM_i),
myNPbase(static_cast<const NPbase*> (&SM_i))
{
}
dmtRef::~dmtRef()
{}
double dmtRef::computeThValue()
{
double mTop = SM.getMtpole();
return (mTop - 173.2)/173.2;
}
/* -------------------------------------*/ |
61f3f0c1d0655eabe81d9726ad8f6dfbdad4a6f4 | 380b9a026d0e805879bdce274af09995606c6c52 | /original/original.ino | 198f98bb6ccf9062d8f684fe3a70f5316a0345ce | [] | no_license | gaspardpetit/KRIDADimmerSample | 6d83d95caa387db094ae15378a2d1daa12ccc0e1 | 13538eee358bfffde1c5d5057934e94f6f1bd7cd | refs/heads/master | 2021-01-22T18:51:08.286938 | 2016-05-24T19:41:01 | 2016-05-24T19:41:01 | 59,587,576 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,383 | ino | original.ino | //-----------------------------------------------
// Sample code provided by KRIDA Electronics
// https://www.facebook.com/krida.electronics/
//-----------------------------------------------
unsigned char AC_LOAD = 7; // Output to Opto Triac pin
unsigned char dimming = 3; // Dimming level (0-100)
unsigned char i;
void setup() {
// put your setup code here, to run once:
pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
attachInterrupt(1, zero_crosss_int, RISING);
// Serial.begin(9600);
}
void zero_crosss_int() // function to be fired at the zero crossing to dim the light
{
// Firing angle calculation : 1 full 50Hz wave =1/50=20ms
// Every zerocrossing : (50Hz)-> 10ms (1/2 Cycle) For 60Hz (1/2 Cycle) => 8.33ms
// 10ms=10000us
int dimtime = (100*dimming); // For 60Hz =>65
delayMicroseconds(dimtime); // Off cycle
digitalWrite(AC_LOAD, HIGH); // triac firing
delayMicroseconds(10); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(AC_LOAD, LOW); // triac Off
}
void loop() {
// Serial.println(pulseIn(8, HIGH));
for (i=5;i<85;i++)
{
dimming=i;
delay(20);
}
for (i=85;i>5;i--)
{
dimming=i;
delay(20);
}
}
|
b567fa694fd5a30c8728108c3af0378ac7226409 | 42229050e2a047c5e3f9e8ba1217c2abc578b0ed | /src/system_monitor.cpp | 4b8d78e8c4d858e5b6e4b30d502f46d477c64cf9 | [
"Apache-2.0"
] | permissive | Auterion/system_monitor_ros | 6a6c988ba25e3715d4070715b0d975dc64f66631 | 4ac4a9cd371210b6e54765e66adf91c74fb8a33d | refs/heads/master | 2021-08-17T03:06:42.852445 | 2021-07-28T16:40:10 | 2021-07-28T16:40:10 | 160,644,942 | 9 | 3 | Apache-2.0 | 2021-07-28T16:38:41 | 2018-12-06T08:41:34 | C++ | UTF-8 | C++ | false | false | 5,546 | cpp | system_monitor.cpp | /*
* system_monitor.cpp
*
* Created on: Aug 21, 2019
* Author: Jaeyoung Lim
*
*/
#include <system_monitor_ros/system_monitor.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <numeric>
#include <sstream>
using namespace std::chrono_literals;
SystemMonitor::SystemMonitor() {
// Defaulting to 255, so unused CPU cores can be ignored in logs
cpu_cores_.fill(UINT8_MAX);
// Start the combined CPU usage histogram
cpu_combined_hist_th_ = std::thread(&SystemMonitor::SetCPUCombinedHist, this);
}
SystemMonitor::~SystemMonitor() {
hist_stop_.store(true);
cpu_combined_hist_th_.join();
}
void SystemMonitor::SetCPUCombinedHist() {
while (!hist_stop_.load()) {
std::vector<CpuData> cpu_times = GetCpuTimes();
std::unique_lock<std::mutex> lock(hist_mtx_);
// Update process times
if (prev_cpu_times_.size() == 0) prev_cpu_times_ = cpu_times; // Handle exception
const CpuData& e1 = prev_cpu_times_[0];
const CpuData& e2 = cpu_times[0];
const float active_time = static_cast<float>(GetActiveTime(e2) - GetActiveTime(e1));
const float idle_time = static_cast<float>(GetIdleTime(e2) - GetIdleTime(e1));
const float total_time = active_time + idle_time;
// Update the histogram
if (cpu_combined_.size() == HISTOGRAM_ARRAY_SIZE) {
cpu_combined_.pop_front();
}
cpu_combined_.push_back(uint8_t(100.f * active_time / total_time));
lock.unlock();
std::this_thread::sleep_for(100ms);
}
}
std::vector<CpuData> SystemMonitor::GetCpuTimes() {
std::vector<CpuData> entries;
const std::string STR_CPU("cpu");
const std::size_t LEN_STR_CPU = STR_CPU.size();
const std::string STR_TOT("total");
std::string line;
std::ifstream proc_stat("/proc/stat");
while (std::getline(proc_stat, line)) {
if (!line.compare(0, LEN_STR_CPU, STR_CPU)) {
std::istringstream ss(line);
// store entry
entries.emplace_back(CpuData());
CpuData& entry = entries.back();
// read cpu label
ss >> entry.cpu;
if (entry.cpu.size() > LEN_STR_CPU)
entry.cpu.erase(0, LEN_STR_CPU);
else
entry.cpu = STR_TOT;
// read times
for (int i = 0; i < NUM_CPU_STATES; ++i) ss >> entry.times[i];
}
}
return entries;
}
size_t SystemMonitor::GetIdleTime(const CpuData& e) { return e.times[CpuStates::IDLE] + e.times[CpuStates::IOWAIT]; }
size_t SystemMonitor::GetActiveTime(const CpuData& e) {
return e.times[CpuStates::USER] + e.times[CpuStates::NICE] + e.times[CpuStates::SYSTEM] + e.times[CpuStates::IRQ] +
e.times[CpuStates::SOFTIRQ] + e.times[CpuStates::STEAL] + e.times[CpuStates::GUEST] +
e.times[CpuStates::GUEST_NICE];
}
void SystemMonitor::readUpTime() {
FILE* uptimeinfo = fopen("/proc/uptime", "r");
char line[256];
float up_time, up_time2;
if (fgets(line, sizeof(line), uptimeinfo) != NULL) {
sscanf(line, "%f %f", &up_time, &up_time2);
}
fclose(uptimeinfo);
up_time_ = uint32_t(up_time * 1000.0);
}
void SystemMonitor::readCpuUsage() {
std::vector<CpuData> cpu_times = GetCpuTimes();
if (prev_cpu_times_.size() == 0) prev_cpu_times_ = cpu_times; // Handle exception
for (size_t i = 0; i < cpu_times.size(); ++i) {
std::unique_lock<std::mutex> lock(hist_mtx_);
const CpuData& e1 = prev_cpu_times_[i];
lock.unlock();
const CpuData& e2 = cpu_times[i];
const float active_time = static_cast<float>(GetActiveTime(e2) - GetActiveTime(e1));
const float idle_time = static_cast<float>(GetIdleTime(e2) - GetIdleTime(e1));
const float total_time = active_time + idle_time;
if (i > 0) {
cpu_cores_[i - 1] = uint8_t(100.f * active_time / total_time);
}
}
prev_cpu_times_ = cpu_times;
}
void SystemMonitor::readBoardTemperature() {
// Read first board temperature sensor that is visible as there is only one field for temperature
std::ifstream proc_stat("/sys/class/thermal/thermal_zone0/temp");
std::string line;
size_t board_temperature;
std::getline(proc_stat, line);
std::istringstream ss(line);
ss >> board_temperature;
board_temp_ = int8_t(board_temperature / 1000);
}
uint32_t SystemMonitor::getUpTime() {
readUpTime();
return up_time_;
}
std::array<uint8_t, 8> SystemMonitor::getCpuCores() {
readCpuUsage();
return cpu_cores_;
}
std::array<uint8_t, 10> SystemMonitor::getCpuCombined() {
std::array<uint8_t, 10> cpu_combined;
cpu_combined.fill(UINT8_MAX);
for (size_t i = 0; i < cpu_combined.size(); i++) {
if (cpu_combined_.size() >= i) {
std::unique_lock<std::mutex> lock(hist_mtx_);
cpu_combined[i] = cpu_combined_[i];
lock.unlock();
}
}
return cpu_combined;
}
int8_t SystemMonitor::getBoardTemperature() {
readBoardTemperature();
return board_temp_;
}
uint32_t SystemMonitor::getRamTotal() {
FILE* meminfo = fopen("/proc/meminfo", "r");
char line[256];
int ram;
while (fgets(line, sizeof(line), meminfo)) {
if (sscanf(line, "MemTotal: %d kB", &ram) == 1) {
fclose(meminfo);
return uint32_t(ram / 1000);
}
}
fclose(meminfo);
return 0;
}
uint32_t SystemMonitor::getRamUsage() {
FILE* meminfo = fopen("/proc/meminfo", "r");
char line[256];
int ram_total;
int ram_free;
while (fgets(line, sizeof(line), meminfo)) {
sscanf(line, "MemTotal: %d kB", &ram_total);
if (sscanf(line, "MemAvailable: %d kB", &ram_free) == 1) {
fclose(meminfo);
return uint32_t((ram_total - ram_free) / 1000);
}
}
fclose(meminfo);
return 0;
}
|
a6d7b487dd7e5e901473d9f3ca0e02a1dcfa4368 | b7128624d25b8a34431751fe504e3c8ad79ee0ce | /src/base/hsi/macroif.h | f847e179f37ced965f25b2e05bd6ef1ec4e6aef3 | [
"LicenseRef-scancode-x11-xconsortium-veillard",
"BSD-2-Clause"
] | permissive | DOORS-Framework/DOORS | e7a0e9d84064334822f20722ad48d9330ee9368f | 999343fc3a40d9c5ec6e8ef7b46cce95bc751fcd | refs/heads/master | 2022-03-31T16:07:06.960467 | 2019-12-23T15:06:31 | 2019-12-23T15:06:31 | 209,012,574 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,617 | h | macroif.h | // -*- C++ -*-
//
// Copyright 1999
// Telecom Lab, Lappeenranta University of Technology.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY TAMPERE UNIVERSITY OF TECHNOLOGY 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 UNIVERSITY
// 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.
/*
$Log: macroif.h,v $
Revision 1.4 2005/02/01 10:13:36 bilhanan
Added RENAME_SYMBOL macro
Revision 1.3 2002/08/14 09:31:37 bilhanan
ONS_ macros are now renamed. Refer to top-level ChangeLog for details.
Revision 1.2 2002/07/23 14:25:17 ik
Od{Boolean,False,True} -> {bool,false,true}
Revision 1.1.1.1 2002/04/30 12:32:52 bilhanan
Development
Revision 1.2 2001/06/08 16:45:40 bilhanan
Full Licence clause into DOORS 0.2
Revision 1.3 2001/06/08 08:39:05 bilhanan
Full licence clause added into doors 0.1
*/
#ifndef MACROIF_H
#define MACROIF_H
#include <doors/symbol.h>
//+ OBL_SYMBOL_CREATE_STATIC
//. Creates a new static symbol for an object. The symbol
//. gets a handler to handle a symbol. Then it is added
//. into a global symbol table.
//.
//. The first parameter object is a object for a new symbol
//. to be created. The second parameter mother is a parent
//. of the new symbol. If it is zero the symbol will be set
//. as a global symbol.
//-
#define OBL_SYMBOL_CREATE_STATIC(object,mother) \
do { \
Symbol *symbol = new Symbol((void *)&object,#object,(void *)mother,true); \
symbolTable.add(symbol); \
TQueueListIterator<HandlerCreator> tools(HandlerCreatorPool::instance()->creators()); \
HandlerCreator *creator; \
while (creator = tools.next()) { \
creator->createHandler (&object, symbol); \
} \
} while(0)
//+ OBL_SYMBOL_CREATE_DYNAMIC
//. Creates a new dynamic symbol for an object. The symbol
//. gets a handler to handle a symbol. Then it is added
//. into a global symbol table.
//.
//. The first parameter object is a object of a new symbol
//. to be created. The second parameter mother is a parent
//. of the new symbol. If it is zero the symbol will be set
//. into a temporary symbol tree.
//-
#define OBL_SYMBOL_CREATE_DYNAMIC(object,name,mother) \
do { \
Symbol *symbol = new Symbol((void *)object,name,(void *)mother,false); \
symbolTable.add(symbol); \
TQueueListIterator<HandlerCreator> tools(HandlerCreatorPool::instance()->creators()); \
HandlerCreator *creator; \
while (creator = tools.next ()) { \
creator->createHandler(object, symbol); \
} \
} while(0)
//+ OBL_SYMBOL_MOVE
//. Moves a symbol to a given location in the symbol tree
//.
//. The first parameter object is a object of the symbol
//. to be moved. The second parameter mother is a new parent
//. to the symbol. If it is zero the symbol will be set
//. into a temporary symbol tree (dynamic symbol) or as a
//. global symbol (static symbol).
//-
#define OBL_SYMBOL_MOVE(object,mother) \
do { \
symbolTable.updateRelation((void*)object,(void*)mother); \
} while(0);
//+ OBL_SYMBOL_DESTROY
//. Destroy symbol from symboltree and subsequent symbolhandlers.
//-
#define OBL_SYMBOL_DESTROY(object) \
do { \
symbolTable.remove((void*)object); \
} while(0)
//+ OBL_SYMBOL_UPDATE
//. Tell to symbolhandler system to update the change of the state of the
//. symbol.
//-
#define OBL_SYMBOL_UPDATE(ptr) \
do { \
TreeSearcher searcher(symbolTable.getStaticTree()); \
Symbol *symbol = searcher.get(ptr); \
if(!symbol) { \
searcher.reset(symbolTable.getDynamicTree()); \
symbol = searcher.get(ptr); \
} \
if(symbol) symbol->update(); \
} while(0)
#define RENAME_SYMBOL(ptr,name) \
do { \
TreeSearcher searcher(symbolTable.getStaticTree()); \
Symbol *symbol = searcher.get(ptr); \
if(!symbol) { \
searcher.reset(symbolTable.getDynamicTree()); \
symbol = searcher.get(ptr); \
} \
if(symbol) symbol->setName(name); \
} while(0)
// synonyms
#define _MT_TRACE_TASK OBL_SYMBOL_UPDATE(this)
#define TRACE_TASK(task) OBL_SYMBOL_UPDATE(task)
#define TRACE_MSG(msg) OBL_SYMBOL_UPDATE(msg)
#define DELETE_SYMBOL(object) OBL_SYMBOL_DESTROY(object)
#define MOVE_SYMBOL(object,mother) OBL_SYMBOL_MOVE(object,mother)
#define DYNAMIC_SYMBOL(object,name,mother) OBL_SYMBOL_CREATE_DYNAMIC(object,name,mother)
#define STATIC_SYMBOL(object,mother) OBL_SYMBOL_CREATE_STATIC(object,mother)
#endif // MACROIF_H
|
95d7ae29fb0c6ca8c5010e6602ea9fb0cecd4734 | 45b0d5b7193bc468b927f0e42ba2a2a3a9df1698 | /sumaimparcpp.cpp | ad43df493e4cfe37903fbf2558aa4c0162a80257 | [] | no_license | laushahidi/FP_Laboratorio7_00365919 | 7012ee392c445a2a6815d1353887d26c9c83ecb0 | cbfd9032243548cb69d28ced7f01f915f07da201 | refs/heads/master | 2020-08-14T01:56:11.997668 | 2019-10-20T22:07:09 | 2019-10-20T22:07:09 | 215,076,664 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 512 | cpp | sumaimparcpp.cpp | #include <iostream>
using namespace std;
int rango(int i){
int a, b, j, suma=0, inicio;
cout<<"\nInicio de rango "<<i<<": ";
cin>>a;
cout<<"Fin de rango "<<i<<": ";
cin>>b;
if(a%2!=0){
inicio=a;
}
else{
inicio=a+1;
}
for(j=inicio;j<=b;j=j+2){
suma+=j;
}
cout<<"Caso"<<i<<": "<<suma<<"\n";
cout<<" ";
return 0;
}
int main(){
int casos, i;
cout<<"Numero de casos de prueba: ";
cin>>casos;
for(i=1;i<=casos;i++){
rango(i);
}
system("pause");
return 0;
} |
3940fb7d645dd9ad41bed422dd3e002c5dbccc26 | 86dcea4619590879ad9b1938d80ffe0a035cd041 | /NeuroKernel/engine/layers/PoolingLayerCudaEngine.h | 88ac444cee2fbcaf1fce0ca858fb4657dd437578 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | smmzhang/NeuroStudio | aaa4826ef732963e4f748a46625a468a1ae810d3 | f505065d694a8614587e7cc243ede72c141bd80b | refs/heads/master | 2022-01-08T23:37:52.361831 | 2019-01-07T11:29:45 | 2019-01-07T11:29:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 974 | h | PoolingLayerCudaEngine.h | #pragma once
#include "PoolingLayerEngine.h"
#include "core/cuda_platform.h"
namespace np
{
namespace engine
{
namespace layers
{
class PoolingLayerCudaEngine : public PoolingLayerEngine
{
public:
PoolingLayerCudaEngine(const NetworkParameter& net_param, const network::HiddenLayer& layer);
virtual ~PoolingLayerCudaEngine();
virtual bool OnInitialized() override;
virtual bool OnOutputBufferInitialized(const _NEURO_TENSOR_DATA& buf) override;
protected:
bool ForwardData(bool bTrain, const _NEURO_TENSOR_DATA& input_data, const _NEURO_TENSOR_DATA& output_data) override;
bool BackwardError(const _NEURO_TENSOR_DATA& output_data
, const _NEURO_TENSOR_DATA& current_error
, const _NEURO_TENSOR_DATA& input_data
, const _NEURO_TENSOR_DATA& input_error) override;
cudnnHandle_t m_handle;
cudnnTensorDescriptor_t m_input_desc, m_output_desc;
cudnnPoolingDescriptor_t m_pooling_desc;
};
}
}
}
|
3956828c1970c73ab230141b5ae87c49c3a42862 | 26939077b9131cbea8b6604bbcd93d1b69ed49d0 | /include/River/River/Graphics/Text/FontInstance.h | d88287beb115edfbb609955f5dda0d5b79ecc1f6 | [] | no_license | maltebp/StarFighter | 505859c052353999b75d32c97aea07011c106b8f | 32fddb374dde9404ccfdb5c66d5e5be39ff19562 | refs/heads/master | 2023-07-14T02:41:09.697483 | 2021-08-29T08:39:06 | 2021-08-29T08:39:06 | 306,422,936 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,386 | h | FontInstance.h | #pragma once
#include <string>
#include <unordered_map>
#include "River/Graphics/Texture/Sprite.h"
namespace River {
class FontInstance {
public:
struct Glyph {
Texture* const texture;
const int bearingX, bearingY;
const int advance;
const int yMax, yMin;
Glyph(Texture* texture, int bearingX, int bearingY, int advance, int yMax, int yMin)
: texture(texture), bearingX(bearingX), bearingY(bearingY), advance(advance), yMax(yMax), yMin(yMin) {
}
};
public:
FontInstance(unsigned int size, void* nativeFontType);
const Glyph &getGlyph(unsigned int characterValue);
struct TextSize { unsigned int width = 0, height = 0; };
TextSize calculateTextSize(const std::string& text);
/**
* @brief Cleans this FontInstance and calls delete on 'this' once cleaned.
* This may throw an exception (unlike calling the delete directly)
*/
void destroy();
/**
* @brief Returns the Font's Height. Note: some glyphs may go beyond this height
*/
unsigned int getHeight();
private:
~FontInstance();
FontInstance(const FontInstance& other) = delete;
FontInstance& operator=(const FontInstance&) = delete;
const Glyph &createGlyph(unsigned int characterValue);
private:
const void* nativeFontType;
const unsigned int size;
unsigned int height;
std::unordered_map<unsigned int, Glyph> glyphMap;
};
}
|
6b1dbd495528890d4e850b4915dac4a4c5a994ab | 732a804c70b5253185271cf171ba8d44d6cb13bf | /List/List.h | c37e13fef5f8530561f303bec61d0c83aa393e15 | [] | no_license | hansionz/Cpp_Code | fc0823a074c58a67d310bc7045ac598717f4eb82 | ab8ccc30dc01e21af3a5bf3fe6360f56f49ba157 | refs/heads/master | 2020-04-04T09:27:19.583350 | 2019-05-24T14:39:45 | 2019-05-24T14:39:45 | 155,818,598 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,283 | h | List.h | #ifndef __LIST_H__
#define __LIST_H__
#include <iostream>
#include <vector>
#include <assert.h>
using namespace std;
/**
* 模拟实现STL中的list(双向带头循环链表)
*/
namespace zsc
{
template<class T>
//为什么不用struct而用class?
//如果不使用访问限定符使用struct,struct默认访问限定符为public
//如果使用访问此限定符使用class,class默认访问限定符为class
struct ListNode
{
//构造函数(T()相当于是一个匿名对象)
ListNode(const T& data = T())
:_data(data)
,_next(nullptr)
,_prev(nullptr)
{}
T _data; //数据域
ListNode<T>* _next;//指向前一个结点的指针
ListNode<T>* _prev;//指向回一个结点的指针
};
/**
* 模拟实现list的迭代器类
*/
template<class T, class Ref, class Ptr>
struct ListIterator
{
typedef ListNode<T> Node;
typedef ListIterator<T, Ref, Ptr> iterator;
//构造
ListIterator(Node* node)
:_node(node)
{}
//拷贝构造
ListIterator(const iterator& i)
:_node(i._node)
{}
/**
* 重载迭代器的解引用、++、!=、==
*/
// *it
Ref operator*()
{
return _node -> _data;
}
// it ->
Ptr operator->()
{
return &(operator*());
}
// ++it
iterator& operator++()
{
_node = _node -> _next;
return *this;
}
// it++
iterator operator++(int)
{
iterator tmp(*this);
_node = _node -> _next;
return tmp;
}
// --it
iterator& operator--()
{
_node = _node -> _prev;
return *this;
}
// it--
iterator operator--(int)
{
iterator tmp(*this);
_node = _node -> _prev;
return tmp;
}
// it1 != it2
bool operator!=(const iterator& it)
{
return _node != it._node;
}
// it1 == it2
bool operator==(const iterator& it)
{
return _node == it._node;
}
Node* _node;
};
/**
* 反向迭代器
*/
template<class T, class Ref, class Ptr, class Iterator>
class ReverseIterator
{
typedef ReverseIterator<T, Ref, Ptr, Iterator> Self;
public:
ReverseIterator(const Iterator& it)
:_it(it)
{}
ReverseIterator(const Self& s)
:_it(s._it)
{}
// *rit
Ref operator*()
{
//Iterator temp(_it);
//return *(--temp);
return *_it;
}
// rit ->
Ptr operator->()
{
return &(operator*());
}
// ++rit
Self& operator++()
{
--_it;
return *this;
}
// it++
Self operator++(int)
{
Self temp(*this);
--_it;
return temp;
}
// --rit;
Self& operator--()
{
++_it;
return *this;
}
// rit--
Self operator--(int)
{
Self temp(*this);
++_it;
return temp;
}
// operator s1 == s2
bool operator==(const Self& s)
{
return _it == s._it;
}
// s1 != s2
bool operator!=(const Self& s)
{
return _it != s._it;
}
private:
Iterator _it;
};
/**
* 模拟实现list类
*/
template<class T>
class List
{
typedef ListNode<T> Node;
public:
//迭代器定义为和库一样的名字可以支持语法糖
//定义为公有的是因为外部会用到它
typedef ListIterator<T, T&, T*> iterator;
typedef ListIterator<T,const T&, const T*> const_iterator;
typedef ReverseIterator<T, T&, T*, iterator> reverse_iterator;
typedef ReverseIterator<T,const T&, const T*, const_iterator> const_reverse_iterator;
/**
* 构造函数
*/
//无参构造函数,构造一条只有头结点的空链表
List()
:_head(new Node)
{
_head -> _next = _head;
_head -> _prev = _head;
}
//构造一条含有n个值为data的结点的链表
List(int n, const T& data = T())
:_head(new Node)
{
_head -> _next = _head;
_head -> _prev = _head;
for(int i = 0;i < n;i++)
{
PushBack(data);
}
}
//迭代器区间构造
template<class InputIterator>
List(InputIterator first,InputIterator last)
:_head(new Node)
{
_head -> _next = _head;
_head -> _prev = _head;
while(first != last)
{
PushBack(*first);
++first;
}
}
//拷贝构造(现代方法)
List(List<T>& l)
:_head(new Node)
{
_head -> _next = _head;
_head -> _prev = _head;
//利用迭代器区间构造拷贝
//List<T> tmp(l.begin(),l.end());
//swap(_head, tmp._head);
//复用PushBack拷贝构造
iterator it = l.begin();
while(it != l.end())
{
PushBack(*it);
++it;
}
}
//赋值运算符重载
List<T>& operator=(List<T>& l)
{
if(this != &l)
{
List<T> tmp(l);
swap(_head, l._head);
}
return *this;
}
//析构函数
~List()
{
Clear();
delete _head;
_head = nullptr;
}
//清空链表
void Clear()
{
//也可以使用迭代器
Node* cur = _head -> _next;
while(cur != _head)
{
_head = cur -> _next;
delete cur;
cur = _head;
}
_head -> _next = _head;
_head -> _prev = _head;
}
/**
* 迭代器
*/
iterator begin()
{
return iterator(_head -> _next);
}
iterator end()
{
return iterator(_head);
}
const_iterator cbegin() const
{
return const_iterator(_head -> _next);
}
const_iterator cend() const
{
return const_iterator(_head);
}
//反向迭代器
reverse_iterator rbegin()
{
return reverse_iterator(iterator(_head -> _prev));
}
reverse_iterator rend()
{
return reverse_iterator(iterator(_head));
}
const_reverse_iterator crbegin() const
{
return reverse_iterator(iterator(_head));
}
const_reverse_iterator crend() const
{
return reverse_iterator(iterator(_head -> _next));
}
/**
* List Modify
*/
void PushBack(const T& data)
{
//Node* tail = _head -> _prev;
//Node* newnode = new Node(data);
////_head tail newnode
//tail -> _next = newnode;
//newnode -> _prev = tail;
//newnode -> _next = _head;
//_head -> _prev = newnode;
//复用Insert
Insert(end(),data);
}
void PopBack()
{
//Node* del = _head -> _prev;
//if(del != _head)
//{
// _head -> _prev = del -> _prev;
// del -> _prev -> _next = _head;
// delete del;
// del = nullptr;
//}
//复用Erase
Erase(--end());
}
void PushFront(const T& data)
{
//Node* first = _head -> _next;
//Node* newnode = new Node(data);
//
//// _head newnode first
//_head -> _next = newnode;
//newnode -> _prev = _head;
//newnode -> _next = first;
//first -> _prev = newnode;
//复用Insert
Insert(begin(),data);
}
void PopFront()
{
//Node* second = _head -> _next -> _next;
//_head -> _next = second;
//delete second -> _prev;
//second -> _prev = _head;
//复用erase
Erase(begin());
}
void Insert(iterator pos, const T& data)
{
Node* cur = pos._node;
Node* pre = cur -> _prev;
Node* newnode = new Node(data);
// pre newnode cur
cur -> _prev = newnode;
newnode -> _next = cur;
newnode -> _prev = pre;
pre -> _next = newnode;
}
void Erase(iterator pos)
{
Node* del = pos._node;
Node* next = del -> _next;
Node* pre = del -> _prev;
pre -> _next = next;
next -> _prev = pre;
delete del;
del = nullptr;
}
/**
* List Access
*/
T& Front()
{
return _head -> _next -> _data;
}
const T& Front() const
{
return _head -> _next -> _data;
}
T& Back()
{
return _head -> _prev -> _data;
}
const T& Back() const
{
return _head -> _prev -> _data;
}
/**
* 返回值为val结点的迭代器
*/
iterator Find(const T& data)
{
Node* cur = _head -> _next;
while(cur != _head)
{
if(cur->_data == data)
return iterator(cur);
cur = cur -> _next;
}
}
/**
* List capacity
*/
//链表的长度
size_t Size() const
{
size_t count = 0;
Node* cur = _head -> _next;
while(cur != _head)
{
++count;
cur = cur -> _next;
}
return count;
}
// 判断链表是否为空
bool Empty()
{
return _head -> _next == _head;
}
//调整链表的有效长度
void Resize(int newsize, const T& data = T())
{
int oldsize = Size();
if(newsize < oldsize)
{
for(int i = 0;i < (oldsize - newsize);i++)
{
PopBack();
}
}
else
{
for(int i = 0;i < (newsize - oldsize);i++)
{
PushBack(data);
}
}
}
private:
Node* _head;
};
}
#endif //__LIST_H__
|
f63e25aa1df27498a9fb6d1f7cd93639e8128491 | 275cbbde1781b3ebb91f889ffffa575c19c60067 | /Homework2/cxx/src/tcpNode/TcpNodeMain.h | e314886c280a94784c0450d56473838ea6a736c1 | [] | no_license | davidliyutong/SPEIT-CS457 | 090ac9e1dcb8046f2e9aa498629b171460a50e09 | d6d3707345f2f5fff0e7fab207878af6db962132 | refs/heads/master | 2022-12-31T13:24:22.626307 | 2020-10-19T02:26:09 | 2020-10-19T02:26:09 | 293,683,962 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,023 | h | TcpNodeMain.h | //
// Created by liyutong on 2020/10/5. 头文件
//
#ifndef P2P_FILE_SHARE_TCPNODEMAIN_H
#define P2P_FILE_SHARE_TCPNODEMAIN_H
#include <cstring>
#include <arpa/inet.h>
#include <thread>
#include <map>
#include <deque>
#include <csignal>
#include "../common/macros.h"
#include "../common/MsgInterpreter.h"
#include "../common/data.h"
#include "../common/utils.h"
#include "../common/StorageDaemon.h"
#include "../common/ConnectionDaemon.h"
using namespace std;
void NodeServeForever(int argc, char *argv[], StorageDaemon &a_Storage, string &a_TrackerHostName, int a_TrackerPort,
SharedPeers &a_PeerAddr);
void
NodeSyncForever(queue<string> &a_FilePathQueue, StorageDaemon &a_Storage, SharedPeers &a_PeerAddr);
bool RegisterNode(int a_Sock, const string &a_RemoteHostName, int a_RemotePort, int a_CurrPort);
vector<sockaddr_in> GetPeersFromTracker(int a_Sock, const string &a_RemoteHostName, int a_RemotePort, int a_CurrPort);
bool
GetBlockFromRemote(int Sock, sockaddr_in a_Target, const string &a_FilePath, uint64_t a_nBlockNumber, FILE *a_pFOUT);
vector<bool> GetBlockInfoFromRemote(sockaddr_in a_Target, const string &a_FilePath);
bool GetFileInfoFromRemote(sockaddr_in a_Target, const string &a_FilePath, uint64_t *a_nFileLen);
void
HandleConnection(int a_ClientSock, struct sockaddr_in a_ClientAddr, queue<int> &a_MsgQueue, StorageDaemon &a_Storage);
void SyncBlocksWithPeer(string &a_FilePath, sockaddr_in a_PeerAddr, vector<uint64_t> a_BlockNumbers,
FileDelegate *pFDelegate);
void SyncFileWithPeers(string &a_FilePath, SharedPeers &a_PeerAddrs, StorageDaemon &a_Storage);
class NodeConnectionDaemon : public ConnectionDaemon {
public:
void m_AddConnection(int a_ClientSock, struct sockaddr_in a_ClientAddr, StorageDaemon &a_Storage) {
auto *pThread = new thread(HandleConnection, a_ClientSock, a_ClientAddr, ref(qMsgQueue), ref(a_Storage));
mapActiveClients[a_ClientSock] = pThread;
}
};
#endif //P2P_FILE_SHARE_TCPSERVERMAIN_H
|
800de8440f47835d90e20e65bac07fe7d0dd17da | b3a44c8c5319afba2870928b976d4ae543ece143 | /mcucpp/ARM/MDR32Fx/usart.h | d4a29a4aa490fb1d236013d34f4209839540e0e3 | [
"BSD-3-Clause"
] | permissive | evugar/Mcucpp | 58446aedc37746ae89dc2e9c0d0f1dbe30aacbf6 | 202d98587e8b9584370a32c1bafa2c7315120c9e | refs/heads/master | 2021-07-11T19:07:39.871347 | 2020-07-21T19:01:42 | 2020-07-21T19:01:42 | 281,441,055 | 0 | 0 | NOASSERTION | 2020-07-21T15:52:45 | 2020-07-21T15:52:44 | null | UTF-8 | C++ | false | false | 2,812 | h | usart.h |
#pragma once
#include <clock.h>
#include <ioreg.h>
#include <iopins.h>
namespace Mcucpp
{
class UsartBase
{
public:
enum UsartMode
{
FifoEnabled = UART_LCR_H_FEN,
DataBits5 = 0 << UART_LCR_H_WLEN_Pos,
DataBits6 = 1 << UART_LCR_H_WLEN_Pos,
DataBits7 = 2 << UART_LCR_H_WLEN_Pos,
DataBits8 = 3 << UART_LCR_H_WLEN_Pos,
NoneParity = 0,
EvenParity = UART_LCR_H_PEN ,
OddParity = UART_LCR_H_PEN | UART_LCR_H_EPS,
OneParity = UART_LCR_H_PEN | UART_LCR_H_SPS,
ZeroParity = UART_LCR_H_PEN | UART_LCR_H_SPS | UART_LCR_H_EPS,
OneStopBit = 0,
TwoStopBits = UART_LCR_H_STP2,
Disabled = 0,
RxEnable = (UART_CR_UARTEN | UART_CR_RXE) << 16,
TxEnable = (UART_CR_UARTEN | UART_CR_TXE) << 16,
RxTxEnable = RxEnable | TxEnable,
Default = RxTxEnable | FifoEnabled | DataBits8
};
};
inline UsartBase::UsartMode operator|(UsartBase::UsartMode left, UsartBase::UsartMode right)
{ return static_cast<UsartBase::UsartMode>(static_cast<int>(left) | static_cast<int>(right));}
namespace Private
{
template<class Regs, class ClockControl, class TxPin, class RxPin>
class Usart :public UsartBase
{
public:
typedef ClockControl Clock;
static bool Init(unsigned baud, UsartMode flags = Default)
{
TxPin:: template SetConfiguration<TxPin::Port::Alt2OutFastest>();
RxPin:: template SetConfiguration<TxPin::Port::In>();
ClockControl::Enable();
uint32_t clockSpeed = ClockControl::GetFreq();
uint32_t divider = clockSpeed / (baud >> 2);
uint32_t intDivider = divider >> 6;
uint32_t fractDivider = divider & 63;
uint32_t realSpeed = clockSpeed * 4 / divider;
uint32_t error = (realSpeed - baud) * 256 / baud;
if (error > 4)
return false;
Regs()->IBRD = intDivider;
Regs()->FBRD = fractDivider;
Regs()->LCR_H = flags & 0xff;
Regs()->CR = ((flags >> 16) & 0xffff);
return true;
}
static uint8_t Read()
{
uint32_t c = 0;
if(!ReadReady())
return 0;
c = Regs()->DR;
Regs()->RSR_ECR = 0;
return (uint8_t)c;
}
static bool Write(uint8_t c)
{
if(!WriteReady())
return false;
Regs()->DR = c;
return true;
}
static bool WriteReady()
{
return (Regs()->FR & UART_FR_TXFF) == 0;
}
static bool ReadReady()
{
return (Regs()->FR & UART_FR_RXFE) == 0;
}
};
IO_STRUCT_WRAPPER(MDR_UART1, Usart1Regs, MDR_UART_TypeDef);
IO_STRUCT_WRAPPER(MDR_UART2, Usart2Regs, MDR_UART_TypeDef);
}
typedef Private::Usart<Private::Usart1Regs, Clock::Uart1Clock, IO::Pb5, IO::Pb6> Usart1;
typedef Private::Usart<Private::Usart2Regs, Clock::Uart2Clock, IO::Pd1, IO::Pd0> Usart2;
} |
87ee94618ff1c850fef3a89f3d62b65482472d37 | 1c4c28a8462d91afe69733fc9dac01daa17b3dcc | /BFS/1926.cpp | 2970a1c1b54c9c687c3e69719fe7f54622faf63c | [] | no_license | HimanshuKGP007/Source-Code | a4e44f0ac3590b12a5ab4dcf9c8b8a7c6b655006 | c3bebea98d889a0d838b133acd5a544533ab1272 | refs/heads/main | 2023-06-28T21:04:18.576367 | 2021-08-05T15:55:25 | 2021-08-05T15:55:25 | 386,203,723 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,762 | cpp | 1926.cpp | #define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ins insert
#define vii vector<int>
#define pii pair<int,int>
const int N=101;
int dp[N][N];
bool check[N][N];
int n,m;
pii start;
int X[4]={0,1,0,-1};
int Y[4]={-1,0,1,0};
int ans=INT_MAX;
bool valid(int x,int y)
{
if(x>=0 && y>=0 && x<n && y<m)return true;
else return false;
}
void bfs(pii a)
{
int x=a.fi;
int y=a.se;
check[x][y]=true;
dp[x][y]=0;
deque<pair<pii,int>>dq;
dq.pb(mp(mp(x,y),0));
while(dq.size()>0)
{
pair<pii,int> top=dq.front();
dq.pop_front();
x=top.fi.fi;
y=top.fi.se;
int height=top.se;
if(x==0 || y==0 || x==n-1 || y==m-1)
{
if(!(x==start.fi && y==start.se))
{
if(height<ans)ans=height;
}
}
for(int i=0;i<4;i++)
{
int newX=x+X[i];
int newY=y+Y[i];
if(valid(newX,newY) && check[newX][newY]==false && dp[newX][newY]==1)
{
check[newX][newY]=true;
dq.pb(mp(mp(newX,newY),height+1));
}
}
}
}
class Solution {
public:
int nearestExit(vector<vector<char>>& maze, vector<int>& entrance)
{
n=maze.size();
m=maze[0].size();
ans=INT_MAX;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
{
if(maze[i][j]=='+')
dp[i][j]=0;
else dp[i][j]=1;
check[i][j]=false;
}
}
start=mp(entrance[0],entrance[1]);
bfs(start);
if(ans==INT_MAX)ans=-1;
return ans;
}
};
|
babae0c4febe947b5fce2a4ed2560e04312f51dc | aa64bc1ff0095318d2f9833db9d67932516364ec | /DBSCAN/Main.cpp | 820f983281a593561d2417cfc5bef5300efc9ab9 | [] | no_license | ma29579/DBSCAN | 8183a6c121e63a67514195f8fa4cc3cad713b179 | 3ae827805d035262995ee085feb8485cc6d38699 | refs/heads/master | 2020-08-22T06:59:17.146109 | 2019-10-20T10:17:55 | 2019-10-20T10:17:55 | 216,342,296 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 6,808 | cpp | Main.cpp | #include "Dataset.h"
#include <iostream>
#include <vector>
#include <sstream>
#include <fstream>
#include <cmath>
// Durch diese Funktion werden die zu analysierenden Datensätze der Zoo-Besucher eingelesen und in dem übergebenen Vektor für Zoo-Besucher abgelegt
void datenEinlesen(std::vector<Dataset*>& data, std::string csvPfad)
{
std::ifstream csvDatei(csvPfad);
std::string csvInhalt;
// Überprüfung ob die angegebene Datei erfolgreich gefunden und geöffnet werden kann.
if (!csvDatei.good())
return;
// Die Titelzeile der CSV-Spalten wird eingelesen, aber nicht verwertet.
std::getline(csvDatei, csvInhalt);
/* Die geöffnete CSV-Datei wird zeilenweise eingelesen, solange das Datei-Ende noch nicht erreicht wurde.
Dabei wird die eingelesene Zeile, anhand des verwendeten Trennzeichens in mehrere Bestandteile aufgeteilt,
diese werden unteranderem mit der Hilfe der Typ-Konvertierungsfunktion std::stof dem Konstruktor der Dataset-Besucher-Klasse übergeben,
um einen Zeiger auf ein Dataset-Objekt zu erzeugen. Der besagte Zeiger wird dem übergebenen Vektor für Zeiger auf Datesets hinzugefügt. */
while (std::getline(csvDatei, csvInhalt))
{
std::stringstream st(csvInhalt);
std::string tmpString;
std::vector<std::string> zeilenBestandteile;
while (std::getline(st, tmpString, ';'))
zeilenBestandteile.push_back(tmpString);
Dataset* d = new Dataset(std::stof(zeilenBestandteile[0]), std::stof(zeilenBestandteile[1]));
data.push_back(d);
}
}
void erstelleCluster(std::vector<Dataset*>& data, float radius, int minPts)
{
// wird für die Zuweisung eines Datensatzes in ein Cluster verwendet, bei jedem neu erzeugten Cluster, wird diese Variable inkrementiert
int clusterID = 0;
// Iteration über alle zu analysierenden Datensätze
for (int i = 0; i < data.size(); i++)
{
std::vector<std::vector<Dataset*>>erreichbareDatensaetze;
std::vector<Dataset*> erreichbareDatensaetzeKernobjekt;
// Wurde der Datensatz noch nicht besucht, erfolgt eine tiefergehende Betrachtung
if (!data[i]->kontrolliereBesuch())
{
// Der zuvor noch nicht besuchte Datensatz, wird nun als besucht markiert
data[i]->markiereAlsBesucht();
/* Alle Datensaetze werden dahingehend untersucht, ob sie von dem aktuellen Objekt aus erreichbar sind
und ihre Distanz geringer als der Parameter "radius" ist*/
for (int j = 0; j < data.size(); j++)
{
// Berechnung der euklidischen Distanz
float abstand = sqrt((pow(data[i]->erhalteX() - data[j]->erhalteX(), 2) + pow(data[i]->erhalteY() - data[j]->erhalteY(), 2)));
/* Sollte die berechnete Distanz geringer als der Grenzwert "radius" ausfallen,
wird der jeweilige Datensatz, dem Vektor "erreichbareDatensaetzeKernobjekt" hinzugefügt */
if (abstand < radius)
erreichbareDatensaetzeKernobjekt.push_back(data[j]);
}
/* Sollte das zuvor potentielle Kernobjekt, mindestens so viele Datensätze erreichen können,
wie durch den Parameter "minPts" vorgebeben wurde, so wird dieser dem Vektor "erreichbareDatensaetze" hinzugefügt,
und alle erreichbaren Datensätze werden anschließend weitergehend auf wiederum erreichbare Datensätze untersucht werden,
sofern diese noch nicht besucht wurden, ist das jedoch nicht der Fall, wird der Datensatz als "Rauschen" identifiziert*/
if (erreichbareDatensaetzeKernobjekt.size() >= minPts)
{
// Die ClusterID wird erhöht, da es sich bei dem zuvor ausgewählten Datensatz wirklich um ein Kernobjekt handelt
clusterID++;
// Zuweisung des Kernobjekts in das neue Cluster
data[i]->clusterzuweisung(clusterID);
// Die Menge an erreichbaren Datensätzen des Kernobjekts, wird dem Vektor erreichbareDatensaetze hinzugefügt
erreichbareDatensaetze.push_back(erreichbareDatensaetzeKernobjekt);
// Alle Vektoren die dem Vektor für erreichbare Datensätze hinzugefügt wurden, werden untersucht
for(int k = 0; k < erreichbareDatensaetze.size();k++)
{
// Iteration der einzelnen Datensätze, in den jeweiligen Vektoren, die sich in dem Vektor "erreichbareDatensaetze" befinden
for (int l = 0; l < erreichbareDatensaetze[k].size(); l++)
{
Dataset* aktuellerDatensatz = erreichbareDatensaetze[k][l];
/* Überprüfung ob der aktuelle Datensatz bereits besucht wurde,
trifft dies zu, wird der aktuelle Datensatz nicht weitergehend berücksichtigt */
if (!aktuellerDatensatz->kontrolliereBesuch())
{
// Speicherort für gefundene Datensätze, die für den aktuellen Datensatz erreichbar sind
std::vector<Dataset*> benachbarteDatensaetze;
// Der aktuelle Datensatz wird als besucht markiert
aktuellerDatensatz->markiereAlsBesucht();
// Wurde der Datensatz noch keinem Cluster zugewiesen, wird er nun dem Cluster des entsprechenden Kernobjekts hinzugefügt
if (aktuellerDatensatz->erhalteClusterID() == 0)
aktuellerDatensatz->clusterzuweisung(clusterID);
// Alle Datensätze werden dahingehend untersucht, welche Distanz sie zu dem aktuellen Datensatz besitzen
for (int j = 0; j < data.size(); j++)
{
// Berechnung der euklidischen Distanz
float abstand = sqrt((pow(aktuellerDatensatz->erhalteX() - data[j]->erhalteX(), 2) + pow(aktuellerDatensatz->erhalteY() - data[j]->erhalteY(), 2)));
// Ist der Abstand geringer als der vorgegebene Grenzwert, wird er dem Vektor "benachbarteDatensaetze" hinzugefügt
if (abstand < radius)
benachbarteDatensaetze.push_back(data[j]);
}
/* Besitzt der aktuelle Datensatz mindestens so viele Datenpunkte, wie durch den Parameter "minPts" vorgegeben,
wird der Vektor "benachbarteDatensaetze" dem Vektor für erreichbare Datensätze des Kernobjekts hinzugefügt */
if(benachbarteDatensaetze.size() >= minPts)
erreichbareDatensaetze.push_back(benachbarteDatensaetze);
}
}
}
}
else
data[i]->clusterzuweisung(-1);
}
}
}
/* Die Funktion gibt die ermittelten Cluster, mit den Informationen über die Zoo-Besucher in einer CSV-Datei aus,
dafür müssen die Datenstruktur, in welcher die Zoo-Besucher gespeichert wurden und eine Zeichenkette, für den Namen der CSV-Datei übergeben werden. */
void erstelleCSVDatei(std::vector<Dataset*>& data, std::string dateiname)
{
std::ofstream datei;
datei.open(dateiname);
datei << "X;Y;Cluster" << std::endl;
for (int i = 0; i < data.size(); i++)
{
datei << data[i]->erhalteX() << ";" << data[i]->erhalteY() << ";" << data[i]->erhalteClusterID() << std::endl;
}
datei.close();
}
int main(int argc, char** argv)
{
std::vector<Dataset*> data;
datenEinlesen(data, "Ausgangsdaten.csv");
erstelleCluster(data, 0.05, 5);
erstelleCSVDatei(data, "Ergebnis.csv");
return EXIT_SUCCESS;
}
|
5d02492de29c34b62002c80dcac6274aeb9f04fd | 080b649df23685d0967204af1aeb880d79e5fb5b | /1.两数之和.cpp | 7d1c98764f5d8b61c0c297a27b5cdd531ef88cd3 | [] | no_license | wang-y-z/leetcode-algorithm | 85d444a3269a8a4245ed7d480111541ac2caf16b | 1c5c3aff341b1ced0d8c7df163a24805da724ba0 | refs/heads/main | 2023-04-17T13:21:50.617568 | 2021-05-05T03:01:47 | 2021-05-05T03:01:47 | 321,834,298 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 565 | cpp | 1.两数之和.cpp | /*
* @lc app=leetcode.cn id=1 lang=cpp
*
* [1] 两数之和
*/
// @lc code=start
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int> record;
vector<int> res;
for(int i=0;i<nums.size();i++){
int tmp=target-nums[i];
if(record.find(tmp)!=record.end()){
res.push_back(i);
res.push_back(record[tmp]);
break;
}else
record[nums[i]]=i;
}
return res;
}
};
// @lc code=end
|
79347a960d38557e5aec930fdf613fa887f53770 | 64c3a10f23b7064214a161f0382caad90ed59d8b | /DT_Arduino/UNO/ledmatrix8x8/ledmatrix8x8.ino | 9c3ff3a14a6e71c449c70161cda9a968af0f5113 | [] | no_license | techHappyWater/SPI_between_RPi_and_STM32 | f74c09fee0890767b86b2922a5f3f0bedd8126bc | 214e9cd8272071330858a8ce799fe1caf9c9b402 | refs/heads/master | 2022-05-13T12:14:53.863116 | 2020-01-26T15:21:52 | 2020-01-26T15:21:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,071 | ino | ledmatrix8x8.ino | byte row[8]={9,10,11,12,13,14,15,16};
byte column[8]={1,2,3,4,5,6,7,8};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
for (int i=0;i<=7;i++)
{
pinMode(row[i],OUTPUT);
pinMode(column[i],OUTPUT);
digitalWrite(row[i],LOW);
digitalWrite(column[i],LOW);
}}
void loop() {
// put your main code here, to run repeatedly:
char* c;
c=chartable('A');
char A[8]={0x00,0x66,0xFF,0xFF,0x7E,0x3C,0x18,0x00};
led8x8(A,100);
}
/*
input: all point we need to display
*/
void led8x8(char* point,uint8_t holdtime)
{
do {
for (int i=0;i<=7;i++) {
for (int j=0;j<=7;j++)
{
if ((point[i]>>j)&1)
digitalWrite(column[7-j],LOW);
else
digitalWrite(column[7-j],HIGH);
}
digitalWrite(row[i],HIGH);
delay(2);
digitalWrite(row[i],LOW);
}
holdtime--;
} while(holdtime!=0);
}
/*
input: character want to map
return: 8 byte array
*/
char* chartable(char x)
{
char charsymbol[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9',' ','&'};
int n;
n=sizeof(charsymbol)/sizeof(charsymbol[0]);
char characterHEX[][8] = {
{0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x66},//A
{0x78,0x64,0x68,0x78,0x64,0x66,0x66,0x7C},//B
{0x3C,0x62,0x60,0x60,0x60,0x62,0x62,0x3C},//C
{0x78,0x64,0x66,0x66,0x66,0x66,0x64,0x78},//D
{0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x7E},//E
{0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x60},//F
{0x3C,0x62,0x60,0x60,0x66,0x62,0x62,0x3C},//G
{0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x66},//H
{0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x7E},//I
{0x7E,0x18,0x18,0x18,0x18,0x18,0x1A,0x0C},//J
{0x62,0x64,0x68,0x70,0x70,0x68,0x64,0x62},//K
{0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E},//L
{0xC3,0xE7,0xDB,0xDB,0xC3,0xC3,0xC3,0xC3},//M
{0x62,0x62,0x52,0x52,0x4A,0x4A,0x46,0x46},//N
{0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C},//O
{0x7C,0x62,0x62,0x7C,0x60,0x60,0x60,0x60},//P
{0x38,0x64,0x64,0x64,0x64,0x6C,0x64,0x3A},//Q
{0x7C,0x62,0x62,0x7C,0x70,0x68,0x64,0x62},//R
{0x1C,0x22,0x30,0x18,0x0C,0x46,0x46,0x3C},//S
{0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18},//T
{0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C},//U
{0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x18},//V
{0x81,0x81,0x81,0x81,0x81,0x99,0x99,0x66},//W
{0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42},//X
{0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x18},//Y
{0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E},//Z
{0x3C,0x66,0x66,0x6E,0x76,0x66,0x66,0x3C},//0
{0x18,0x38,0x58,0x18,0x18,0x18,0x18,0x7E},//1
{0x3C,0x66,0x66,0x0C,0x18,0x30,0x7E,0x7E},//2
{0x7E,0x0C,0x18,0x3C,0x06,0x06,0x46,0x3C},//3
{0x0C,0x18,0x30,0x6C,0x6C,0x7E,0x0C,0x0C},//4
{0x7E,0x60,0x60,0x7C,0x06,0x06,0x46,0x3C},//5
{0x04,0x08,0x10,0x38,0x6C,0x66,0x66,0x3C},//6
{0x7E,0x46,0x0C,0x18,0x18,0x18,0x18,0x18},//7
{0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C},//8
{0x3C,0x66,0x66,0x36,0x1C,0x08,0x10,0x20},//9
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},// khoảng trắng
{0x00,0x66,0xFF,0xFF,0x7E,0x3C,0x18,0x00}// hình trái tim, kí hiệu là '&'
};
for (int i=0;i<=n;i++)
{
if (x==charsymbol[i])
return characterHEX[i];
}}
|
f5b0786b1cc3134d5b59f2b68d0f4685c5f4b630 | cd5953b74f164a741393dac24a760ce054d270ca | /lesson7/code1.cpp | cb863f680f715e78051790d07bc167bfb23a2a70 | [] | no_license | cy66666/xd0615 | 02bd8f3f9b3d31e252f3ec8832b8ff8fd0ac5b81 | 4d262f061777a85e3ca6a0101f0b08dfd55e7e4d | refs/heads/master | 2022-11-13T02:09:47.124395 | 2020-06-24T09:23:48 | 2020-06-24T09:23:48 | 272,459,338 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 258 | cpp | code1.cpp | #include <MsTimer2.h>
int tick = 0;
void onTimer()
{
Serial.print("timer ");
Serial.println(tick++);
}
void setup()
{
Serial.begin(9600);
MsTimer2::set(1000, onTimer);
MsTimer2::start();
}
void loop()
{
}
|
63c69a9db1648d8e3461b34ad8093033a8e890fd | e1d5fbe7823d9e54e2717e7cb86bd36afe9e3d76 | /libraries/keybrd/l_ShiftManager.h | 3cb7103f178c50436807589b58ad42f0a28449bf | [
"MIT"
] | permissive | dualsky/keybrd | 8d1d7117de88b8efedbf8947b7dba8c96e04d955 | 696b6dd9c93b9e1597739db5efd74aa8e07baf28 | refs/heads/master | 2021-01-18T20:07:39.059986 | 2015-05-08T07:39:32 | 2015-05-08T07:39:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,294 | h | l_ShiftManager.h | #ifndef L_SHIFTMANAGER_H
#define L_SHIFTMANAGER_H
#include <Arduino.h>
#include <inttypes.h>
#include "l_Code_Shift.h"
/* Class l_ShiftManager is used on multi-layered keyboards.
* It is composed of an array of l_Code_Shift pointers, one for each shift key.
* It can manage any number of shift keys.
*
* l_ShiftManager changes and restores the shift state for l_Code_SS, l_Code_SNS, and l_Code_SNS_00:
* l_Code_SS object is a scancode shifted e.g. '%' in symbols layer
* l_Code_SNS object is a scancode not shifted e.g. '5' in numbers layer
*
* keyboards without l_Code_SS, l_Code_SNS, and l_Code_SNS_00 can omit l_ShiftManager
* and place scancode MODIFIERKEY_SHIFT directly in k_Key_1
*/
class l_ShiftManager
{
private:
l_Code_Shift*const *const ptrsShifts; //array of shift pointers
const uint8_t SHIFT_COUNT;
public:
l_ShiftManager(l_Code_Shift *const ptrsShifts[], const uint8_t SHIFT_COUNT)
: ptrsShifts(ptrsShifts), SHIFT_COUNT(SHIFT_COUNT) {}
void pressShift0(); //press first element of ptrsShifts[] array
void restoreShift0(); //restore first element of ptrsShifts[] array
void releaseAllShifts();
void restoreAllShifts();
};
#endif
|
6667dc2329328c21fc3b6cf12b8760e070c745ba | 3a01bc40368b415eac43890febbe9c7777b9e86d | /Src/SkyProject/DrvD3D11/Systems/skyD3D11GfxDevice.cpp | 16c05431c1a74ac6e561aff1b4f5d130bbb538b0 | [] | no_license | gbarnes12/skyengine | a45b1094d54eb2259c51be59c50f14567189a3bb | c78861a5d3a1bd50f69321a71f529c217d4b31e9 | refs/heads/master | 2021-01-10T11:15:06.673814 | 2015-11-23T15:10:20 | 2015-11-23T15:10:20 | 46,712,226 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,791 | cpp | skyD3D11GfxDevice.cpp | #include "stdafx.h"
#include "skyD3D11GfxDevice.h"
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::Spawn ( sGfxDeviceDesc a_sDesc, skyD3D11GfxDevice** a_pDevice)
{
ID3D11DeviceContext* l_pContext = nullptr;
ID3D11Device* l_pDevice = nullptr;
IDXGISwapChain* l_pChain = nullptr;
skyD3D11GfxSwapChain* l_pSwapChain = nullptr;
skyD3D11ResourceManager* l_pResourceManager = nullptr;
skyD3D11GfxStateManager* l_pStateManager = nullptr;
skyD3D11DepthBuffer* l_pDepthBuffer = nullptr;
skyD3D11RasterizerState* l_pRasterizerState = nullptr;
skyD3D11DepthStencilState* l_pDepthState = nullptr;
DXGI_SWAP_CHAIN_DESC l_desc;
sGfxDepthStencilDesc l_depthDesc;
sGfxRasterizerDesc l_rasterizerDesc;
skyResult hr;
SKY_ZERO_MEM(&l_desc, sizeof(DXGI_SWAP_CHAIN_DESC));
l_desc.BufferCount = 1;
l_desc.BufferDesc.Width = a_sDesc.m_uiWidth;
l_desc.BufferDesc.Height = a_sDesc.m_uiHeight;
l_desc.BufferDesc.Format = static_cast<DXGI_FORMAT>(a_sDesc.m_eFormat);
l_desc.BufferDesc.RefreshRate.Numerator = 60;
l_desc.BufferDesc.RefreshRate.Denominator = 1;
l_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
l_desc.OutputWindow = a_sDesc.m_pHandle;
l_desc.Windowed = a_sDesc.m_bWindowed;
l_desc.SampleDesc.Count = 1;
D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE, D3D_DRIVER_TYPE_SOFTWARE
};
skyUInt totalDriverTypes = ARRAYSIZE( driverTypes );
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0
};
skyUInt totalFeatureLevels = ARRAYSIZE( featureLevels );
skyUInt creationFlags = 0;
#ifdef SKY_BUILD_DEBUG
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT pResult;
skyUInt uiDriver = 0;
D3D_DRIVER_TYPE eType;
D3D_FEATURE_LEVEL eFeatureLevel;
for( uiDriver = 0; uiDriver < totalDriverTypes; ++uiDriver )
{
pResult = D3D11CreateDeviceAndSwapChain( 0, driverTypes[uiDriver], 0, creationFlags,
featureLevels, totalFeatureLevels,
D3D11_SDK_VERSION, &l_desc, &l_pChain,
&l_pDevice, &eFeatureLevel, &l_pContext );
if( SUCCEEDED( pResult ) )
{
eType = driverTypes[uiDriver];
break;
}
}
if( FAILED( pResult ) )
{
DXTRACE_MSG( L"Failed to create the Direct3D device!" );
return SKY_ERROR;
}
// Create Objects, Swap Chain, Resource Manager and so on!
hr = skyD3D11ResourceManager::Spawn(&l_pResourceManager);
if(hr != SKY_OK)
{
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
hr = skyD3D11GfxStateManager::Spawn(l_pContext, &l_pStateManager);
if(hr != SKY_OK)
{
SKY_SAFE_DELETE(l_pSwapChain);
SKY_SAFE_DELETE(l_pResourceManager);
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
// finally create the device
*a_pDevice = SKY_NEW skyD3D11GfxDevice(l_pDevice, l_pContext, l_pResourceManager, l_pStateManager);
// create the swap chain ;)
hr = skyD3D11GfxSwapChain::Spawn(*a_pDevice, l_pChain, &l_pSwapChain);
if(hr != SKY_OK)
{
SKY_SAFE_DELETE(l_pStateManager);
SKY_SAFE_DELETE(l_pResourceManager);
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
// set swap chain ;)
(*a_pDevice)->SetSwapChain(l_pSwapChain);
// Depth Stencil Buffer
SKY_ZERO_MEM(&l_depthDesc, sizeof(sGfxDepthStencilDesc));
l_depthDesc.m_bDepthEnable = true;
l_depthDesc.m_eDepthWriteMask = eGfxDepthWriteMask_MaskAll;
l_depthDesc.m_eDepthFunc = eGfxTextureComparisonFunc_Less;
l_depthDesc.m_bStencilEnable = true;
l_depthDesc.m_uiStencilReadMask = 0xFF;
l_depthDesc.m_uiStencilWriteMask = 0xFF;
// Stencil operations if pixel is front-facing.
l_depthDesc.m_sFrontFace.m_eStencilFailOp = eGfxStencilOp_Keep;
l_depthDesc.m_sFrontFace.m_eStencilDepthFailOp = eGfxStencilOp_Incr;
l_depthDesc.m_sFrontFace.m_eStencilPassOp = eGfxStencilOp_Keep;
l_depthDesc.m_sFrontFace.m_eStencilFunc = eGfxTextureComparisonFunc_Always;
// Stencil operations if pixel is back-facing.
l_depthDesc.m_sBackFace.m_eStencilFailOp = eGfxStencilOp_Keep;
l_depthDesc.m_sBackFace.m_eStencilDepthFailOp = eGfxStencilOp_Decr;
l_depthDesc.m_sBackFace.m_eStencilPassOp = eGfxStencilOp_Keep;
l_depthDesc.m_sBackFace.m_eStencilFunc = eGfxTextureComparisonFunc_Always;
hr = skyD3D11DepthBuffer::Spawn(*a_pDevice, l_depthDesc, &l_pDepthBuffer);
if(hr != SKY_OK)
{
SKY_SAFE_DELETE(l_pStateManager);
SKY_SAFE_DELETE(l_pSwapChain);
SKY_SAFE_DELETE(l_pResourceManager);
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
// bind the depth buffer!
(*a_pDevice)->SetDepthBuffer(l_pDepthBuffer);
// Depth Stencil State
hr = skyD3D11DepthStencilState::Spawn(*a_pDevice, l_depthDesc, &l_pDepthState);
if(hr != SKY_OK)
{
SKY_SAFE_DELETE(l_pDepthBuffer);
SKY_SAFE_DELETE(l_pStateManager);
SKY_SAFE_DELETE(l_pSwapChain);
SKY_SAFE_DELETE(l_pResourceManager);
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
// set state!
l_pStateManager->SetDepthStencilState(l_pDepthState);
// Rasterizer
SKY_ZERO_MEM(&l_rasterizerDesc, sizeof(sGfxRasterizerDesc));
l_rasterizerDesc.m_eFillMode = eGfxFillMode_Solid;
l_rasterizerDesc.m_eCullMode = eGfxCullMode_None;
l_rasterizerDesc.m_bAntialiasedLineEnable = true;
l_rasterizerDesc.m_iDepthBias = 0;
l_rasterizerDesc.m_fDepthBiasClamp = 0.0f;
l_rasterizerDesc.m_bDepthClipEnable = true;
l_rasterizerDesc.m_bFrontCounterClockwise = true;
l_rasterizerDesc.m_bMultisampleEnable = false;
l_rasterizerDesc.m_bScissorEnable = false;
l_rasterizerDesc.m_fSlopeScaledDepthBias = 0.0f;
hr = skyD3D11RasterizerState::Spawn(*a_pDevice, l_rasterizerDesc, &l_pRasterizerState);
if(hr != SKY_OK)
{
SKY_SAFE_DELETE(l_pDepthState);
SKY_SAFE_DELETE(l_pDepthBuffer);
SKY_SAFE_DELETE(l_pStateManager);
SKY_SAFE_DELETE(l_pSwapChain);
SKY_SAFE_DELETE(l_pResourceManager);
SKY_RELEASE(l_pChain);
SKY_RELEASE(l_pContext);
SKY_RELEASE(l_pDevice);
SKY_TODO("error message implementation!");
return SKY_INVALID_POINTER;
}
// set state!
l_pStateManager->SetRasterizerState(l_pRasterizerState);
return SKY_OK;
}
skyD3D11GfxDevice::skyD3D11GfxDevice(ID3D11Device* a_pDevice, ID3D11DeviceContext* a_pContext,
skyD3D11ResourceManager* a_pResourceManager, skyD3D11GfxStateManager* a_pStateManager)
: m_pDevice(a_pDevice)
, m_pContext(a_pContext)
, m_pDepthBuffer(NULL)
, m_pSwapChain(NULL)
, m_pResourceManager(a_pResourceManager)
, m_pStateManager(a_pStateManager)
{
for(skyUInt i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
m_pRenderTargets[i] = nullptr;
}
}
skyD3D11GfxDevice::~skyD3D11GfxDevice()
{
for(skyUInt i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
m_pRenderTargets[i] = nullptr;
}
SKY_SAFE_DELETE(m_pDepthBuffer);
SKY_SAFE_DELETE(m_pStateManager);
SKY_SAFE_DELETE(m_pSwapChain);
SKY_SAFE_DELETE(m_pResourceManager);
SKY_RELEASE(m_pContext);
SKY_RELEASE(m_pDevice);
}
skyVoid skyD3D11GfxDevice::SetSwapChain ( skyIGfxSwapChain* a_pChain )
{
SKY_SAFE_DELETE(m_pSwapChain);
this->m_pSwapChain = static_cast<skyD3D11GfxSwapChain*>(a_pChain);
}
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::CreateTexture ( skyIGfxTexture** a_pTexture, sGfxTextureDesc& a_sDesc )
{
skyD3D11Texture* l_pTexture = nullptr;
skyResult hr;
if(!a_sDesc.m_sBlob)
{
hr = skyD3D11Texture::Spawn(this, &a_sDesc, &l_pTexture);
if(hr != SKY_OK)
return hr;
}
else
{
hr = skyD3D11Texture::Spawn(a_sDesc.m_eMode, this, a_sDesc.m_sBlob, &l_pTexture);
if(hr != SKY_OK)
return hr;
}
*a_pTexture = l_pTexture;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateRenderTarget ( skyIGfxRenderTarget** a_pRT, sGfxTextureDesc& a_sDesc )
{
skyD3D11RenderTarget* l_pRenderTarget = nullptr;
skyResult hr;
hr = skyD3D11RenderTarget::Spawn(this, a_sDesc, &l_pRenderTarget);
if(hr != SKY_OK)
return hr;
*a_pRT = l_pRenderTarget;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateRenderTarget ( skyIGfxRenderTarget** a_pRT, skyIGfxTexture* a_pTexture )
{
skyD3D11RenderTarget* l_pRenderTarget = nullptr;
skyD3D11Texture* l_pTexture = nullptr;
skyResult hr;
l_pTexture = static_cast<skyD3D11Texture*>(a_pTexture);
if(!l_pTexture)
return SKY_INVALID_POINTER;
hr = skyD3D11RenderTarget::Spawn( l_pTexture, this, &l_pRenderTarget);
if(hr != SKY_OK)
return hr;
*a_pRT = l_pRenderTarget;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateIndexBuffer ( skyIGfxIndexBuffer** a_pBuffer, sGfxIndexDesc& a_sDesc )
{
skyD3D11IndexBuffer* l_pBuffer = nullptr;
skyResult hr = skyD3D11IndexBuffer::Spawn(this, a_sDesc, &l_pBuffer);
if(hr != SKY_OK)
return hr;
*a_pBuffer = l_pBuffer;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateVertexBuffer ( skyIGfxVertexBuffer** a_pBuffer, sGfxVertexDesc& a_sDesc )
{
skyD3D11VertexBuffer* l_pBuffer = nullptr;
a_sDesc.m_eBindFlags = eGfxBindFlags_VertexBuffer;
skyResult hr = skyD3D11VertexBuffer::Spawn(this, a_sDesc, &l_pBuffer);
if(hr != SKY_OK)
return hr;
*a_pBuffer = l_pBuffer;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateConstantBuffer ( skyIGfxConstantBuffer** a_pBuffer, sGfxConstantDesc& a_sDesc )
{
skyD3D11ConstantBuffer* l_pBuffer = nullptr;
skyResult hr = skyD3D11ConstantBuffer::Spawn(this, a_sDesc, &l_pBuffer);
if(hr != SKY_OK)
return hr;
*a_pBuffer = l_pBuffer;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreatePrimitive ( skyIGfxPrimitive** a_pPrimitive )
{
skyResult hr;
skyD3D11Primitive* pPrimitive = NULL;
SKY_VR(skyD3D11Primitive::Spawn(this, &pPrimitive));
*a_pPrimitive = pPrimitive;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateShader ( skyIGfxShader** a_pShader, sGfxShaderDesc& a_sDesc )
{
if(a_sDesc.m_eType == eGfxShaderType_Pixel) {
skyResult hr;
skyD3D11PixelShader* pShader = NULL;
SKY_VR(skyD3D11PixelShader::Spawn ( a_sDesc.m_eMode, this, a_sDesc.m_sBlob, a_sDesc.m_sFileName, &pShader));
*a_pShader = pShader;
}
else if(a_sDesc.m_eType == eGfxShaderType_Vertex) {
skyResult hr;
skyD3D11VertexShader* pShader = NULL;
SKY_VR(skyD3D11VertexShader::Spawn ( a_sDesc.m_eMode, this, a_sDesc.m_pLayout, a_sDesc.m_u32ElementCount, a_sDesc.m_sBlob, a_sDesc.m_sFileName, &pShader));
*a_pShader = pShader;
}
return SKY_OK;
}
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::SetRenderTarget ( skyUInt a_uiIndex, skyIGfxRenderTarget* a_pTarget, skyBool a_bUseDepthStencil = true )
{
skyD3D11RenderTarget* l_pD3DTarget = nullptr;
m_pRenderTargets[a_uiIndex] = a_pTarget;
// cast to skyD3D11RenderTarget
l_pD3DTarget = static_cast<skyD3D11RenderTarget*>(a_pTarget);
if(!l_pD3DTarget)
return SKY_INVALID_POINTER;
ID3D11RenderTargetView* pView = l_pD3DTarget->AsView();
m_pContext->OMSetRenderTargets(1, &pView, (a_bUseDepthStencil) ? m_pDepthBuffer->AsView() : NULL);
return SKY_OK;
}
skyResult skyD3D11GfxDevice::GetRenderTarget ( skyUInt a_uiIndex, skyIGfxRenderTarget** a_pTarget )
{
skyIGfxRenderTarget* pTarget = m_pRenderTargets[a_uiIndex];
if(!pTarget)
return SKY_INVALID_POINTER;
*a_pTarget = pTarget;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::ClearRenderTarget ( skyUInt a_uiIndex, sGfxColor& a_sColor )
{
DX_START_SECTION(skyColor(1.0f, 0.0f, 0.0f, 1.0f), L"Clear Rendertarget");
skyIGfxRenderTarget* l_pTarget = m_pRenderTargets[a_uiIndex];
skyD3D11RenderTarget* l_pD3DTarget = nullptr;
if(!l_pTarget)
return SKY_INVALID_POINTER;
// cast to skyD3D11RenderTarget
l_pD3DTarget = static_cast<skyD3D11RenderTarget*>(l_pTarget);
if(!l_pD3DTarget)
return SKY_INVALID_POINTER;
m_pContext->ClearRenderTargetView(l_pD3DTarget->AsView(), a_sColor);
ClearDepthBuffer();
DX_END_SECTION();
return SKY_OK;
}
skyResult skyD3D11GfxDevice::ResetRenderTarget ( skyUInt a_uiIndex )
{
SKY_UNTESTED_METHOD("not yet implemented");
return SKY_NOT_SUPPORTED;
}
skyResult skyD3D11GfxDevice::ResetRenderTargets ( skyVoid )
{
ID3D11RenderTargetView* l_pTargets[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
m_pContext->OMSetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, l_pTargets, NULL);
for(skyUInt i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
m_pRenderTargets[i] = nullptr;
}
return SKY_OK;
}
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::SetBlendState ( skyIGfxBlendState* a_pState )
{
return m_pStateManager->SetBlendState(a_pState);
}
skyResult skyD3D11GfxDevice::SetDepthState ( skyIGfxDepthStencilState* a_pState )
{
return m_pStateManager->SetDepthStencilState(a_pState);
}
skyResult skyD3D11GfxDevice::SetRasterizerState ( skyIGfxRasterizerState* a_pState )
{
return m_pStateManager->SetRasterizerState(a_pState);
}
skyResult skyD3D11GfxDevice::SetSamplerState ( eGfxShaderType a_eType, const skyUInt a_uiSlot, skyIGfxSamplerState* a_pState )
{
return m_pStateManager->SetSamplerState(a_eType, a_uiSlot, a_pState);
}
skyResult skyD3D11GfxDevice::CreateBlendState ( sGfxBlendDesc a_sDesc, skyIGfxBlendState** a_pState )
{
SKY_UNTESTED_METHOD("not yet implemented");
return SKY_NOT_SUPPORTED;
}
skyResult skyD3D11GfxDevice::CreateDepthState ( sGfxDepthStencilDesc a_sDesc, skyIGfxDepthStencilState** a_pState )
{
skyD3D11DepthStencilState* pState = nullptr;
skyResult hr = skyD3D11DepthStencilState::Spawn(this, a_sDesc, &pState);
if(hr != SKY_OK)
return hr;
*a_pState = pState;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateRasterizerState ( sGfxRasterizerDesc a_sDesc, skyIGfxRasterizerState** a_pState )
{
skyD3D11RasterizerState* pState = nullptr;
skyResult hr = skyD3D11RasterizerState::Spawn(this, a_sDesc, &pState);
if(hr != SKY_OK)
return hr;
*a_pState = pState;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::CreateSamplerState ( sGfxSamplerDesc a_sDesc, skyIGfxSamplerState** a_pState )
{
skyD3D11SamplerState* pState = nullptr;
skyResult hr = skyD3D11SamplerState::Spawn(this, a_sDesc, &pState);
if(hr != SKY_OK)
return hr;
*a_pState = pState;
return SKY_OK;
}
skyResult skyD3D11GfxDevice::GetBackBuffer ( skyIGfxTexture** a_pTexture )
{
return this->m_pSwapChain->GetBackBuffer(a_pTexture);
}
//--------------------------------------------------------------------------------------------------------
skyVoid skyD3D11GfxDevice::SetConstantbuffer ( eGfxShaderType a_eType, const skyUInt a_uiSlot, const skyIGfxConstantBuffer* a_pBuffer )
{
skyD3D11ConstantBuffer* pBuffer = static_cast<skyD3D11ConstantBuffer*>((skyIGfxConstantBuffer*)a_pBuffer);
if(pBuffer)
{
ID3D11Buffer* pBaseBuffer = pBuffer->GetBaseBuffer();
if(pBaseBuffer)
{
if(a_eType == eGfxShaderType_Pixel)
this->m_pContext->PSSetConstantBuffers(a_uiSlot, 1, &pBaseBuffer);
else if(a_eType == eGfxShaderType_Vertex)
this->m_pContext->VSSetConstantBuffers(a_uiSlot, 1, &pBaseBuffer);
}
}
}
skyVoid skyD3D11GfxDevice::SetTexture ( eGfxShaderType a_eType, const skyUInt a_uiSlot, const skyIGfxTexture* a_pTexture )
{
skyD3D11Texture* pTexture = static_cast<skyD3D11Texture*>((skyIGfxTexture*)a_pTexture);
if(pTexture)
{
ID3D11ShaderResourceView* pView = pTexture->AsResourceView();
if(pView)
{
if(a_eType == eGfxShaderType_Pixel)
this->m_pContext->PSSetShaderResources(a_uiSlot, 1, &pView);
else if(a_eType == eGfxShaderType_Vertex)
this->m_pContext->VSSetShaderResources(a_uiSlot, 1, &pView);
}
}
}
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::SetIndexBuffer ( skyIGfxIndexBuffer* a_pBuffer )
{
if(!a_pBuffer)
return SKY_INVALID_POINTER;
skyD3D11IndexBuffer* pBuffer = static_cast<skyD3D11IndexBuffer*>(a_pBuffer);
if(!pBuffer)
return SKY_INVALID_CAST;
this->m_pContext->IASetIndexBuffer(pBuffer->GetBaseBuffer(), DXGI_FORMAT_R32_UINT, 0);
return SKY_OK;
}
skyResult skyD3D11GfxDevice::SetVertexBuffer ( skyIGfxVertexBuffer* a_pBuffer, skyUInt a_u32Offset )
{
if(!a_pBuffer)
return SKY_INVALID_POINTER;
skyD3D11VertexBuffer* pBuffer = static_cast<skyD3D11VertexBuffer*>(a_pBuffer);
if(!pBuffer)
return SKY_INVALID_CAST;
sGfxVertexDesc sDesc = pBuffer->GetDesc();
ID3D11Buffer* pBaseBuffer = pBuffer->GetBaseBuffer();
skyUInt u32Stride = a_pBuffer->GetStride();
this->m_pContext->IASetVertexBuffers(0, 1, &pBaseBuffer, &u32Stride, &a_u32Offset);
return SKY_OK;
}
//--------------------------------------------------------------------------------------------------------
skyResult skyD3D11GfxDevice::SetDepthBuffer ( skyIGfxDepthBuffer* a_pBuffer)
{
if(!a_pBuffer)
return SKY_INVALID_POINTER;
SKY_SAFE_DELETE(m_pDepthBuffer);
m_pDepthBuffer = static_cast<skyD3D11DepthBuffer*>(a_pBuffer);
return SKY_OK;
}
skyIGfxDepthBuffer* skyD3D11GfxDevice::GetDepthBuffer ( ) const
{
return this->m_pDepthBuffer;
}
skyVoid skyD3D11GfxDevice::ClearDepthBuffer ( )
{
m_pContext->ClearDepthStencilView(m_pDepthBuffer->AsView(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 0.0f, 0);
}
//--------------------------------------------------------------------------------------------------------
skyVoid skyD3D11GfxDevice::SetViewport ( const sGfxViewport& a_sViewport )
{
D3D11_VIEWPORT sViewport;
SKY_ZERO_MEM(&sViewport, sizeof(D3D11_VIEWPORT));
sViewport.Width = a_sViewport.m_fWidth;
sViewport.Height = a_sViewport.m_fHeight;
sViewport.TopLeftX = a_sViewport.m_fTopLeftX;
sViewport.TopLeftY = a_sViewport.m_fTopLeftY;
sViewport.MinDepth = a_sViewport.m_fMinDepth;
sViewport.MaxDepth = a_sViewport.m_fMaxDepth;
this->m_pContext->RSSetViewports(1, &sViewport);
}
sGfxViewport skyD3D11GfxDevice::GetViewport ( skyVoid )
{
sGfxViewport sOutViewport;
SKY_ZERO_MEM(&sOutViewport, sizeof(sGfxViewport));
D3D11_VIEWPORT sViewport[1];
SKY_ZERO_MEM(&sViewport[0], sizeof(D3D11_VIEWPORT));
skyUInt i = 1;
this->m_pContext->RSGetViewports(&i, &sViewport[0]);
return sOutViewport;
}
//--------------------------------------------------------------------------------------------------------
skyVoid skyD3D11GfxDevice::Draw ( skyIGfxPrimitive* a_pPrimitive )
{
if(!a_pPrimitive)
return;
skyIGfxIndexBuffer* pIndexBuffer = a_pPrimitive->GetIndices();
skyIGfxVertexBuffer* pVertexBuffer = a_pPrimitive->GetVertices();
skyBool bHasIndices = SKY_FALSE;
if(!pVertexBuffer)
return;
if(pIndexBuffer)
bHasIndices = SKY_TRUE;
sGfxVertexDesc sVDesc = pVertexBuffer->GetDesc();
sGfxIndexDesc sIDesc = (bHasIndices) ? pIndexBuffer->GetDesc() : sGfxIndexDesc();
sGfxDrawDesc sDesc;
sDesc.m_bInstanced = SKY_FALSE;
sDesc.m_ePrimitiveType = eGfxPrimitiveType_TriangleList;
sDesc.m_uiIndexCount = (!bHasIndices) ? 0 : sIDesc.m_uiCount;
sDesc.m_uiIndexLocation = 0;
sDesc.m_uiVertexLocation = 0;
sDesc.m_uiVertexCount = pVertexBuffer->GetElementCount();
sDesc.m_uiInstanceCount = 0;
if(bHasIndices)
this->SetIndexBuffer(pIndexBuffer);
this->SetVertexBuffer(pVertexBuffer, 0);
this->Draw(sDesc);
}
skyVoid skyD3D11GfxDevice::Draw ( sGfxDrawDesc& a_sDesc )
{
this->m_pContext->IASetPrimitiveTopology(static_cast<D3D11_PRIMITIVE_TOPOLOGY>(a_sDesc.m_ePrimitiveType));
// draw the vertex buffer to the back buffer
if ( a_sDesc.m_uiIndexCount > 0 )
{
if(a_sDesc.m_bInstanced)
{
this->m_pContext->DrawIndexedInstanced(a_sDesc.m_uiIndexCount, a_sDesc.m_uiInstanceCount, a_sDesc.m_uiIndexLocation, 0, 0);
}
else
{
this->m_pContext->DrawIndexed(a_sDesc.m_uiIndexCount, a_sDesc.m_uiIndexLocation, 0);
}
}
else
{
if(a_sDesc.m_bInstanced)
{
this->m_pContext->DrawInstanced(a_sDesc.m_uiVertexCount, a_sDesc.m_uiInstanceCount, a_sDesc.m_uiVertexLocation, 0);
}
else
{
this->m_pContext->Draw(a_sDesc.m_uiVertexCount, a_sDesc.m_uiVertexLocation);
}
}
}
skyVoid skyD3D11GfxDevice::Present ( sGfxPresentDesc& a_sDesc )
{
this->m_pSwapChain->Present(a_sDesc);
}
skyVoid skyD3D11GfxDevice::Resize ( skyVoid )
{
}
|
bc529af19e472d175f288be7de93ab67bc5b5b95 | 6bb87e58cc38de28b0e0b6d981bd8ba49244cfa9 | /P2T2/main.cpp | 136745c08790338c42fd04a90e82b2a9f657a773 | [] | no_license | szxie/CS308-Compiler | f4ed36f94faeeacb2a7af93a0c30679416ac6b3d | 6cd1a748c20c3b0423c8a357b15b083eb3d46ac8 | refs/heads/master | 2020-04-04T19:51:15.145873 | 2013-12-29T01:43:58 | 2013-12-29T01:43:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 416 | cpp | main.cpp | #include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include "node.h"
using namespace std;
extern int yyparse();
extern FILE *yyin;
extern Node *program;
int main(int argc, char **argv)
{
yyin = fopen(argv[1], "r");
ofstream fout("test.s");
yyparse();
content* a = new content();
a->clear();
string re = program->codeGen(a);
cout << re;
fout << re;
fout.close();
return 0;
}
|
f1b7334fbf04baed1cc69045bc20da3884ee0807 | 18c1ae5aab30f9d003a6081a91d803142254738e | /src/chartsmodel.h | bba64cb00e9628abcdb807820fdbd60090040db6 | [] | no_license | nvek/testAIDRiller | 212a5b74660d678bbcc474fb8939d42a06efedec | 40499125f4a9038ace4e17158442061843ca5527 | refs/heads/master | 2020-08-22T22:16:13.094745 | 2019-10-21T07:37:23 | 2019-10-21T07:37:23 | 216,486,684 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 238 | h | chartsmodel.h | #pragma once
#include "src/csvreader.h"
class ChartsModel
{
public:
// make coords
struct Point
{
qreal x;
qreal y;
qreal z;
};
QVector<Point> _points;
ChartsModel(const CSVReader::CSVRecords& data);
};
|
9e49374ea1e7ef9a0d836559706843686ce98ad3 | 6ef6837af1efb4a4ed8a890a9a98d132153ec673 | /test.cpp | 6a1705e940fc26899938703b58814e9fee7aa6ba | [] | no_license | japneet644/Random-codes | 8cfd76f4607b261bce75e3cc407eb83c189772af | 7b799707070ff0988745efe9973a2c704cbd8a68 | refs/heads/master | 2020-04-11T16:07:56.343529 | 2019-08-12T05:55:31 | 2019-08-12T05:55:31 | 161,913,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 275 | cpp | test.cpp | #include<iostream>
using namespace std;
int modulo(int a,int b, int c)
{
if(b==1) return a%c;
int ans = modulo(a,b/2,c);
if(b%2==0) return (ans*ans)%c;
return (a*ans*ans)%c;
}
int main(int argc, char const *argv[]) {
if(5>3-1) std::cout << "ajbajma " << '\n';
}
|
f9d499096a7846e319d402ae4667503f915a733d | 7f62f204ffde7fed9c1cb69e2bd44de9203f14c8 | /DboServer/Server/GameServer/TqsAlgoAction_Wait.cpp | 7d233fc5b62ba07221c5ccb998a93d3851f6c335 | [] | no_license | 4l3dx/DBOGLOBAL | 9853c49f19882d3de10b5ca849ba53b44ab81a0c | c5828b24e99c649ae6a2953471ae57a653395ca2 | refs/heads/master | 2022-05-28T08:57:10.293378 | 2020-05-01T00:41:08 | 2020-05-01T00:41:08 | 259,094,679 | 3 | 3 | null | 2020-04-29T17:06:22 | 2020-04-26T17:43:08 | null | UTF-8 | C++ | false | false | 1,191 | cpp | TqsAlgoAction_Wait.cpp | #include "stdafx.h"
#include "TqsAlgoAction_Wait.h"
#include "TQSNodeAction_Wait.h"
CTqsAlgoAction_Wait::CTqsAlgoAction_Wait(CTqsAlgoObject* pObject) :
CTqsAlgoAction_Base(pObject, TQS_ALGOCONTROLID_ACTION_WAIT, "TQS_ALGOCONTROLID_ACTION_WAIT")
{
m_nCondCount = 100000;
}
CTqsAlgoAction_Wait::~CTqsAlgoAction_Wait()
{
}
bool CTqsAlgoAction_Wait::AttachControlScriptNode(CControlScriptNode* pControlScriptNode)
{
CTQSNodeAction_Wait* pNode = dynamic_cast<CTQSNodeAction_Wait*>(pControlScriptNode);
if (pNode)
{
m_bOperationAND = pNode->m_bOperationAND;
return true;
}
return false;
}
void CTqsAlgoAction_Wait::OnEnter()
{
if(m_nCondCount == 100000)
m_nCondCount = m_subControlList.GetCount();
}
int CTqsAlgoAction_Wait::OnUpdate(DWORD dwTickDiff, float fMultiple)
{
///info: m_bOperationAND | (and)true = COMPLETE when all conditions done | (or)false = when at least one finished
int nStatus = UpdateSubControlList(dwTickDiff, fMultiple); //UPDATE CONDITION
if (m_bOperationAND)
{
if (m_subControlList.GetCount() == 0)
{
m_status = COMPLETED;
}
}
else if (m_nCondCount != m_subControlList.GetCount())
{
m_status = COMPLETED;
}
return m_status;
}
|
210aa2d909bd647659258a7edc60674e64f954c2 | e21c2723414b08cfda4b96140f0a7f837af8d2d2 | /Code(大一)/51nod/1102面积最大的矩形.cpp | f3049be09f86fb74e88ed041ba58076ac666d2a3 | [] | no_license | liarchgh/MyCode | e060da5489facf36523c5e58a8dbf1e4fecdc01e | 2f0ba2759caa5f732b6edb023af6fbc13e8c0916 | refs/heads/master | 2021-10-08T07:08:28.604123 | 2021-09-26T17:55:09 | 2021-09-26T17:55:09 | 73,447,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 946 | cpp | 1102面积最大的矩形.cpp | //思路很早就想到了 然而对时间复杂度的分析发生了错误 太过于谨慎了 计算得不够仔细 细节忽略了
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <fstream>
#include <iostream>
using namespace std;
const int mx = 50005;
int zhi[mx], l[mx] = {0}, r[mx] = {0};
int main() {
#ifndef ONLINE_JUDGE
freopen("C:\\in.txt", "r", stdin);
freopen("C:\\out.txt", "w", stdout);
#endif
int n;
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d", &zhi[i]);
}
int x;
for (int i = 1; i < n; ++i) {
x = i;
while (x && zhi[x - 1] >= zhi[i]) {
x = l[x - 1];
}
l[i] = x;
//printf("%d\n", x);
}
r[n - 1] = n - 1;
for (int i = n - 2; i >= 0; --i) {
x = i;
while (x && zhi[x + 1] >= zhi[i]) {
x = r[x + 1];
}
r[i] = x;
}
long long ans = 0;
for (int i = 0; i < n; ++i) {
ans = max(ans, ((long long)r[i] - l[i] + 1) * zhi[i]);
}
printf("%lld\n", ans);
return 0;
}
|
b1472db4dfbcd21ca6fad7970f52ee49d43d8bef | 0e8ae7bc3a8a282a09ff11344249d89ec3777f1e | /vcm/ui/win32/vcmSpin.h | 1eaf4ee811ed53d984c3b5403635ba85b3b88411 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | bbbradsmith/nsfplay | cbe082176fc0ecfbc01bb66e049d2cef8e2bbea6 | f563b9fe32df9ef0a94944026642d8ce5144c000 | refs/heads/master | 2023-07-21T21:09:21.386106 | 2023-07-06T23:48:52 | 2023-07-06T23:48:52 | 37,961,833 | 255 | 49 | null | 2023-06-22T05:59:48 | 2015-06-24T04:16:29 | C++ | SHIFT_JIS | C++ | false | false | 762 | h | vcmSpin.h | #pragma once
#include "afxwin.h"
#include "afxcmn.h"
// CvcmSpin ダイアログ
class CvcmSpin : public CvcmCtrl
{
DECLARE_DYNAMIC(CvcmSpin)
public:
vcm::VT_SPIN *m_vt;
CvcmSpin(const std::string &id, vcm::VT_SPIN *vt, CWnd* pParent = NULL); // 標準コンストラクタ
virtual ~CvcmSpin();
void ReadWork();
void WriteWork();
// ダイアログ データ
enum { IDD = IDD_SPIN };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV サポート
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
CStatic m_label;
CEdit m_edit;
CSpinButtonCtrl m_spin;
afx_msg void OnEnKillfocusEdit();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};
|
482c5f57e1da2c9c004a1c6df0a16f14be9d1427 | 69dd4bd4268e1c361d8b8d95f56b5b3f5264cc96 | /GPU Pro4/02_Rendering/06_Progressive Screen-space Multi-channel Surface Voxelization/src/SceneGraph/SceneGraph_Aux.cpp | 10ac7fddf056c97d832a5ee2e5374d5451436d30 | [
"MIT"
] | permissive | AnabaenaQing/Source-Code_ShaderX_GPU-Pro_GPU-Zen | 65c16710d1abb9207fd7e1116290336a64ddfc86 | f442622273c6c18da36b61906ec9acff3366a790 | refs/heads/master | 2022-12-15T00:40:42.931271 | 2020-09-07T16:48:25 | 2020-09-07T16:48:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,243 | cpp | SceneGraph_Aux.cpp | //////////////////////////////////////////////////////////////////////////////
// //
// Scene Graph 3D //
// Georgios Papaioannou, 2009 //
// //
// This is a free, extensible scene graph management library that works //
// along with the EaZD deferred renderer. Both libraries and their source //
// code are free. If you use this code as is or any part of it in any kind //
// of project or product, please acknowledge the source and its author. //
// //
// For manuals, help and instructions, please visit: //
// http://graphics.cs.aueb.gr/graphics/ //
// //
//////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <sstream>
#ifndef WIN32
#include <ctype.h>
#else
#pragma warning (disable : 4996)
#endif
#include "SceneGraph.h"
using namespace std;
int parseVec2(Vector2D &vec, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%f%*[ ,\t]%f", &(vec.x), &(vec.y)) < 2 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseVec3(Vector3D &vec, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%f%*[ ,\t]%f%*[ ,\t]%f", &(vec.x), &(vec.y), &(vec.z)) < 3 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseVec4(float &s, Vector3D &vec, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%f%*[ ,\t]%f%*[ ,\t]%f%*[ ,\t]%f", &(s), &(vec.x), &(vec.y), &(vec.z)) < 4 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseFloat(float &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%f", &(val)) < 1 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseShort(short &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%hd", &(val)) < 1 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseUShort(unsigned short &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%hd", &(val)) < 1 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseInteger(int &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%d", &(val)) < 1 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseUInteger(unsigned int &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if ( sscanf(text, "%d", &(val)) < 1 )
return SCENE_GRAPH_ERROR_PARSING;
else
return SCENE_GRAPH_ERROR_NONE;
}
int parseIVec (vector <int> &vec, const string& text)
{
string temp, str = text;
int tempi = 0;
size_t pos;
// does the string have a space a comma or a tab in it?
// store the position of the delimiter
while ((pos = str.find_first_of (" ,\t", 0)) != string::npos)
{
temp = str.substr (0, pos); // get the token
stringstream ss (temp);
ss >> tempi; // check if the token is an integer
if (ss.fail ())
return SCENE_GRAPH_ERROR_PARSING;
vec.push_back (tempi); // and put it into the array
str.erase (0, pos + 1); // erase it from the source
}
stringstream ss (str);
ss >> tempi;
if (ss.fail ())
return SCENE_GRAPH_ERROR_PARSING;
vec.push_back (tempi); // the last token is all alone
return SCENE_GRAPH_ERROR_NONE;
}
int parseBoolean(bool &val, char * text)
{
if (!text)
return SCENE_GRAPH_ERROR_PARSING;
if (STR_EQUAL(text,"off"))
val=false;
else if (STR_EQUAL(text,"on"))
val=true;
else if (STR_EQUAL(text,"true"))
val=true;
else if (STR_EQUAL(text,"false"))
val=false;
else if (STR_EQUAL(text,"1"))
val=true;
else if (STR_EQUAL(text,"0"))
val=false;
else if (STR_EQUAL(text,"yes"))
val=true;
else if (STR_EQUAL(text,"no"))
val=false;
return SCENE_GRAPH_ERROR_NONE;
}
int parseStringsVector (vector <string> &vec, const string& text)
{
string temp, str = text;
size_t pos;
// does the string have a space a comma or a tab in it?
// store the position of the delimiter
while ((pos = str.find_first_of (" ,\t", 0)) != string::npos)
{
vec.push_back (str.substr (0, pos)); // get the token and put it into the array
str.erase (0, pos + 1); // erase it from the source
}
vec.push_back (str); // the last token is all alone
return SCENE_GRAPH_ERROR_NONE;
}
char *skipParameterName(char *buf)
{
char * first = buf, * found;
int next;
while (first==(char*)'\n' || first==(char*)' ' || first == (char*)'\t')
first++;
next = strcspn(first," \t\n");
found = first+next;
return found;
}
|
e48076f951e127c90beca51da7eeaf462122a782 | 471f29d511854d157accb758fb60a9489765d9c3 | /VivenciaManager3/backupdialog.cpp | a25fd93b922a8b61d475e04686f822cfcb33e049 | [
"MIT"
] | permissive | vivencia/VivenciaManager3 | fb0c4612e4da65cdea70bcf863b5affe9de9addd | b26e1313febeb2b6e9be102c91afba13c2c609b5 | refs/heads/master | 2020-12-25T17:00:57.396371 | 2018-01-30T12:36:44 | 2018-01-30T12:36:44 | 48,883,737 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25,079 | cpp | backupdialog.cpp | #include "backupdialog.h"
#include "global.h"
#include "vmlist.h"
#include "vivenciadb.h"
#include "vmcompress.h"
#include "configops.h"
#include "fileops.h"
#include "vmnotify.h"
#include "system_init.h"
#include "heapmanager.h"
#include "emailconfigdialog.h"
#include "crashrestore.h"
#include <QVBoxLayout>
#include <QProgressBar>
#include <QRadioButton>
#include <QPushButton>
#include <QLabel>
#include <QListWidgetItem>
#include <QDesktopWidget>
BackupDialog* BackupDialog::s_instance ( nullptr );
void deleteBackupDialogInstance ()
{
heap_del ( BackupDialog::s_instance );
}
const uint BACKUP_IDX ( 0 );
const uint RESTORE_IDX ( 1 );
BackupDialog::BackupDialog ()
: QDialog ( nullptr ), ui ( new Ui::BackupDialog ), tdb ( nullptr ),
b_IgnoreItemListChange ( false ), mb_success ( false ), mb_nodb ( false ),
progress_bar_steps ( 5 ), dlgNoDB ( nullptr ), m_after_close_action ( ACA_CONTINUE )
{
backupNotify = new vmNotify ( QStringLiteral ( "TL" ), this );
ui->setupUi ( this );
setWindowTitle ( TR_FUNC ( "Backup/Restore - " ) + PROGRAM_NAME );
setWindowIcon ( ICON ( "vm-logo-22x22" ) );
setupConnections ();
fillTable ();
readFromBackupList ();
Sys_Init::addPostRoutine ( deleteBackupDialogInstance );
}
BackupDialog::~BackupDialog ()
{
heap_del ( tdb );
heap_del ( ui );
}
void BackupDialog::setupConnections ()
{
ui->pBar->setVisible ( false );
ui->btnApply->setEnabled ( false );
connect ( ui->btnApply, &QPushButton::clicked, this, [&] () { return btnApply_clicked (); } );
connect ( ui->btnClose, &QPushButton::clicked, this, [&] () { return btnClose_clicked (); } );
connect ( ui->txtBackupFilename, &QLineEdit::textEdited, this, [&] ( const QString& text ) { return ui->btnApply->setEnabled ( text.length () > 3 ); } );
connect ( ui->txtExportPrefix, &QLineEdit::textEdited, this, [&] ( const QString& text ) { return ui->btnApply->setEnabled ( text.length () > 3 ); } );
connect ( ui->txtExportFolder, &QLineEdit::textEdited, this, [&] ( const QString& text ) { return ui->btnApply->setEnabled ( fileOps::exists ( text ).isOn () ); } );
ui->txtRestoreFileName->setCallbackForContentsAltered ( [&] ( const vmWidget* ) {
return ui->btnApply->setEnabled ( checkFile ( ui->txtRestoreFileName->text () ) ); } );
connect ( ui->rdChooseKnownFile, &QRadioButton::toggled, this, [&] ( const bool checked ) {
return rdChooseKnownFile_toggled ( checked ); } );
connect ( ui->rdChooseAnotherFile, &QRadioButton::toggled, this, [&] ( const bool checked ) {
return rdChooseAnotherFile_toggled ( checked ); } );
connect ( ui->btnDefaultFilename, &QToolButton::clicked, this, [&] () {
return ui->txtBackupFilename->setText ( standardDefaultBackupFilename () ); } );
connect ( ui->btnDefaultPrefix, &QToolButton::clicked, this, [&] () {
return ui->txtExportPrefix->setText ( vmNumber::currentDate.toDate ( vmNumber::VDF_FILE_DATE ) + QLatin1String ( "-Table_" ) ); } );
connect ( ui->btnChooseBackupFolder, &QToolButton::clicked, this, [&] () {
return ui->txtBackupFolder->setText ( fileOps::getExistingDir ( CONFIG ()->backupDir () ) ); } );
connect ( ui->btnChooseExportFolder, &QToolButton::clicked, this, [&] () {
return ui->txtExportFolder->setText ( fileOps::getExistingDir ( CONFIG ()->backupDir () ) ); } );
connect ( ui->btnChooseImportFile, &QToolButton::clicked, this, [&] () {
return btnChooseImportFile_clicked (); } );
connect ( ui->btnRemoveFromList, &QToolButton::clicked, this, [&] () {
return btnRemoveFromList_clicked (); } );
connect ( ui->btnRemoveAndDelete, &QToolButton::clicked, this, [&] () {
return btnRemoveAndDelete_clicked (); } );
connect ( ui->btnSendMail, &QToolButton::clicked, this, [&] () {
return btnSendMail_clicked () ; } );
connect ( ui->grpBackup, &QGroupBox::clicked, this, [&] ( const bool checked ) {
return grpBackup_clicked ( checked ); } );
connect ( ui->grpExportToText, &QGroupBox::clicked, this, [&] ( const bool checked ) {
return grpExportToText_clicked ( checked ); } );
connect ( ui->restoreList, &QListWidget::currentRowChanged, this, [&] ( const int row ) {
return ui->btnApply->setEnabled ( row != -1 ); } );
connect ( ui->restoreList, &QListWidget::itemActivated, this, [&] ( QListWidgetItem* item ) {
return ui->btnApply->setEnabled ( item != nullptr ); } );
ui->chkTables->setCallbackForContentsAltered ( [&] ( const vmWidget* ) {
return ui->tablesList->setEnabled ( ui->chkTables->isChecked () ); } );
}
bool BackupDialog::canDoBackup () const
{
bool ret ( ui->tablesList->count () > 0 );
if ( ret )
{
ret = !( fileOps::appPath ( VivenciaDB::backupApp () ).isEmpty () );
backupNotify->notifyMessage ( TR_FUNC ( "Backup" ), ret
? TR_FUNC ( "Choose backup method" ) : VivenciaDB::backupApp () + TR_FUNC ( " must be installed to do backups" ) );
}
else
backupNotify->notifyMessage ( TR_FUNC ( "Backup - Error" ), TR_FUNC ( "Database has no tables to backup" ) );
return ret;
}
bool BackupDialog::canDoRestore () const
{
if ( fileOps::appPath ( VivenciaDB::restoreApp () ).isEmpty () )
{
backupNotify->notifyMessage ( TR_FUNC ( "Restore - Error" ),
VivenciaDB::restoreApp () + TR_FUNC ( " must be installed to restore a database" ) );
return false;
}
else
{
backupNotify->notifyMessage ( TR_FUNC ( "Restore - Next step" ), ( ui->restoreList->count () > 0 )
? TR_FUNC ( "Choose restore method" ) : TR_FUNC ( "Choose a file containing a saved database to be restored" ) );
}
return true;
}
void BackupDialog::showWindow ()
{
if ( ui->tablesList->count () == 0 )
fillTable ();
const bool b_backupEnabled ( canDoBackup () );
const bool b_restoreEnabled ( canDoRestore () );
ui->pageBackup->setEnabled ( b_backupEnabled );
ui->pageRestore->setEnabled ( b_restoreEnabled );
ui->toolBox->setCurrentIndex ( b_backupEnabled ? BACKUP_IDX : ( b_restoreEnabled ? RESTORE_IDX : BACKUP_IDX ) );
ui->txtBackupFilename->clear ();
ui->txtBackupFolder->clear ();
ui->txtExportFolder->clear ();
ui->txtExportPrefix->clear ();
ui->txtRestoreFileName->clear ();
ui->btnApply->setEnabled ( false );
const bool hasRestoreList ( ui->restoreList->count () > 0 );
ui->btnSendMail->setEnabled ( hasRestoreList );
ui->rdChooseKnownFile->setChecked ( hasRestoreList );
ui->rdChooseAnotherFile->setChecked ( !hasRestoreList );
m_after_close_action = ACA_RETURN_TO_PREV_WINDOW;
this->exec ();
}
void BackupDialog::fillTable ()
{
if ( VDB () != nullptr )
{
// this function will be called by Data after a restore. Because the tables might be different, we must clear the last used list
if ( ui->tablesList->count () != 0 )
{
ui->tablesList->clear ();
disconnect ( ui->tablesList, nullptr, nullptr, nullptr );
}
QListWidgetItem* widgetitem ( new QListWidgetItem ( ui->tablesList ) );
widgetitem->setText ( TR_FUNC ( "Select all " ) );
widgetitem->setFlags ( Qt::ItemIsEnabled|Qt::ItemIsTristate|Qt::ItemIsSelectable|Qt::ItemIsUserCheckable );
widgetitem->setCheckState ( Qt::Checked );
for ( uint i ( 0 ); i < TABLES_IN_DB; ++i )
{
widgetitem = new QListWidgetItem ( ui->tablesList );
widgetitem->setText ( VivenciaDB::tableInfo ( i )->table_name );
widgetitem->setFlags ( Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsUserCheckable );
widgetitem->setCheckState ( Qt::Checked );
}
connect ( ui->tablesList, &QListWidget::itemChanged, this,
[&] ( QListWidgetItem* item ) { return selectAll ( item ); } );
}
}
bool BackupDialog::doBackup ( const QString& filename, const QString& path, const bool bUserInteraction )
{
BackupDialog* bDlg ( bUserInteraction ? BACKUP () : nullptr );
if ( !BackupDialog::checkDir ( path ) )
{
if ( bDlg )
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Backup - Error"), TR_FUNC ( "You must select a valid directory before proceeding" ) );
return false;
}
if ( filename.isEmpty () )
{
if ( bDlg )
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Backup - Error"), TR_FUNC ( "A filename must be supplied" ) );
return false;
}
QString backupFile ( path + filename + QLatin1String ( ".sql" ) );
bool ok ( false );
if ( Sys_Init::EXITING_PROGRAM || checkThatFileDoesNotExist ( backupFile + QLatin1String ( ".bz2" ), bUserInteraction ) )
{
QString tables;
if ( bDlg )
{
if ( bDlg->ui->chkDocs->isChecked () )
bDlg->addDocuments ( backupFile );
if ( bDlg->ui->chkImages->isChecked () )
bDlg->addImages ( backupFile );
if ( bDlg->ui->chkTables->isChecked () )
{
bDlg->initProgressBar ( 7 );
if ( bDlg->ui->tablesList->item ( 0 )->checkState () == Qt::Unchecked )
{
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Backup - Error" ), TR_FUNC ( "One table at least must be selected." ) );
return false;
}
if ( bDlg->ui->tablesList->item ( 0 )->checkState () == Qt::PartiallyChecked )
{
for ( int i ( 1 ); i < bDlg->ui->tablesList->count (); ++i )
{
if ( bDlg->ui->tablesList->item ( i )->checkState () == Qt::Checked )
tables += bDlg->ui->tablesList->item ( i )->text () + CHR_SPACE;
}
}
}
BackupDialog::incrementProgress ( bDlg ); //1
}
ok = VDB ()->doBackup ( backupFile, tables, bDlg );
BackupDialog::incrementProgress ( bDlg ); //5
if ( ok )
{
if ( VMCompress::compress ( backupFile, backupFile + QLatin1String ( ".bz2" ) ) )
{
fileOps::removeFile ( backupFile );
backupFile += QLatin1String ( ".bz2" );
BackupDialog::incrementProgress ( bDlg ); //6
const QString dropBoxDir ( CONFIG ()->dropboxDir () );
if ( fileOps::isDir ( dropBoxDir ).isOn () )
fileOps::copyFile ( dropBoxDir, backupFile );
BackupDialog::incrementProgress ( bDlg ); //7
}
}
if ( bDlg )
{
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Backup" ), TR_FUNC ( "Standard backup to file %1 was %2" ).arg (
filename, QLatin1String ( ok ? " successfull" : " unsuccessfull" ) ) );
}
if ( ok )
BackupDialog::addToRestoreList ( backupFile, bDlg );
}
return ok;
}
void BackupDialog::doDayBackup ()
{
if ( !VDB ()->backUpSynced () )
BackupDialog::doBackup ( standardDefaultBackupFilename (), CONFIG ()->backupDir () );
}
bool BackupDialog::doExport ( const QString& prefix, const QString& path, const bool bUserInteraction )
{
BackupDialog* bDlg ( bUserInteraction ? BACKUP () : nullptr );
if ( bDlg )
{
if ( bDlg->ui->tablesList->item ( 0 )->checkState () == Qt::Unchecked )
{
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Export - Error" ), TR_FUNC ( "One table at least must be selected." ) );
return false;
}
}
if ( !BackupDialog::checkDir ( path ) )
{
if ( bDlg )
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Export - Error" ), TR_FUNC ( "Error: you must select a valid directory before proceeding" ) );
return false;
}
if ( prefix.isEmpty () )
{
if ( bDlg )
bDlg->backupNotify->notifyMessage ( TR_FUNC ( "Export - Error" ), TR_FUNC ( "Error: a prefix must be supplied" ) );
return false;
}
QString filepath;
bool ok ( false );
if ( bDlg )
{
bDlg->initProgressBar ( (bDlg->ui->tablesList->count () - 1) * 5 );
for ( int i ( 1 ); i < bDlg->ui->tablesList->count (); ++i )
{
if ( bDlg->ui->tablesList->item ( i )->checkState () == Qt::Checked )
{
filepath = path + CHR_F_SLASH + prefix + bDlg->ui->tablesList->item ( i )->text ();
if ( checkThatFileDoesNotExist ( filepath, true ) )
{
BackupDialog::incrementProgress ( bDlg ); //1
ok = VDB ()->exportToCSV ( static_cast<uint>(2<<(i-1)), filepath, bDlg );
if ( ok )
BackupDialog::addToRestoreList ( filepath, bDlg );
}
}
}
ui->pBar->hide ();
backupNotify->notifyMessage ( TR_FUNC ( "Export" ), TR_FUNC ( "Export to CSV file was " ) + ( ok ? TR_FUNC ( " successfull" ) : TR_FUNC ( " unsuccessfull" ) ) );
}
else
{
for ( uint i ( 0 ); i < TABLES_IN_DB; ++i )
{
filepath = path + CHR_F_SLASH + prefix + VDB ()->tableName ( static_cast<TABLE_ORDER>(i) );
if ( checkThatFileDoesNotExist ( filepath, false ) )
{
ok = VDB ()->exportToCSV ( static_cast<uint>(2)<<i, filepath, bDlg );
if ( ok )
BackupDialog::addToRestoreList ( filepath, bDlg );
}
}
}
return ok;
}
bool BackupDialog::doRestore ( const QString& files )
{
QStringList files_list ( files.split ( CHR_SPACE, QString::SkipEmptyParts ) );
if ( files_list.count () <= 0 )
return false;
QString filepath;
initProgressBar ( 5 * files_list.count () );
bool ok ( false );
QStringList::const_iterator itr ( files_list.constBegin () );
const QStringList::const_iterator itr_end ( files_list.constEnd () );
BackupDialog::incrementProgress ( this ); //1
for ( ; itr != itr_end; ++itr )
{
filepath = static_cast<QString> ( *itr );
if ( !checkFile ( filepath ) )
{
backupNotify->notifyMessage ( TR_FUNC ( "Restore - Error " ), filepath + TR_FUNC ( "is an invalid file" ) );
continue;
}
if ( fileOps::exists ( filepath ).isOn () )
{
BackupDialog::incrementProgress ( this ); //2
if ( textFile::isTextFile ( filepath, textFile::TF_DATA ) )
ok |= VDB ()->importFromCSV ( filepath, this );
else
{
ok |= VDB ()->doRestore ( filepath, this );
BackupDialog::incrementProgress ( this );//5
}
}
}
if ( ok )
{
if ( files_list.count () == 1 )
addToRestoreList ( files, this );
/* Force rescan of all tables, which is done in updateGeneralTable (called by VivenciaDB
* when general table cannot be found or there is a version mismatch
*/
VDB ()->clearTable ( VDB ()->tableInfo ( TABLE_GENERAL_ORDER ) );
m_after_close_action = mb_nodb ? ACA_RETURN_TO_PREV_WINDOW : ACA_RESTART;
backupNotify->notifyMessage ( TR_FUNC ( "Importing was sucessfull." ),
TR_FUNC ( "Click on the Close button to resume the application." ) );
}
else
{
m_after_close_action = mb_nodb ? ACA_RETURN_TO_PREV_WINDOW : ACA_CONTINUE;
backupNotify->notifyMessage ( TR_FUNC ( "Importing failed!" ),
TR_FUNC ( "Try importing from another file or click on Close to exit the program." ) );
}
return ok;
}
void BackupDialog::addToRestoreList ( const QString& filepath, BackupDialog* bDlg )
{
if ( bDlg )
{
for ( int i ( 0 ); i < bDlg->ui->restoreList->count (); ++i )
if ( bDlg->ui->restoreList->item ( i )->text () == filepath ) return;
bDlg->ui->restoreList->addItem ( filepath );
bDlg->ui->btnSendMail->setEnabled ( bDlg->ui->restoreList->count () != 0 );
bDlg->tdb->appendRecord ( filepath );
bDlg->tdb->commit ();
}
else
{
dataFile* df ( new dataFile ( CONFIG ()->appDataDir () + QLatin1String ( "/backups.db" ) ) );
df->load ();
df->appendRecord ( filepath );
df->commit ();
delete df;
}
}
void BackupDialog::readFromBackupList ()
{
if ( !tdb )
tdb = new dataFile ( CONFIG ()->appDataDir () + QLatin1String ( "/backups.db" ) );
if ( tdb->load ().isOn () )
{
stringRecord files;
if ( tdb->getRecord ( files, 0 ) )
{
if ( files.first () )
{
do
{
if ( checkFile ( files.curValue () ) )
ui->restoreList->addItem ( files.curValue () );
else // file does not exist; do not add to the list and remove it from database
{
files.removeFieldByValue ( files.curValue (), true );
tdb->changeRecord ( 0, files );
}
} while ( files.next () );
tdb->commit ();
}
}
}
}
void BackupDialog::incrementProgress ( BackupDialog* bDlg )
{
if ( bDlg != nullptr )
{
static int current_val ( 0 );
if ( current_val < bDlg->progress_bar_steps )
bDlg->ui->pBar->setValue ( ++current_val );
else
current_val = 0;
}
}
void BackupDialog::showNoDatabaseOptionsWindow ()
{
mb_nodb = true;
m_after_close_action = ACA_RETURN_TO_PREV_WINDOW;
if ( dlgNoDB == nullptr )
{
dlgNoDB = new QDialog ( this );
dlgNoDB->setWindowIcon ( ICON ( "vm-logo-22x22" ) );
dlgNoDB->setWindowTitle ( TR_FUNC ( "Database inexistent" ) );
QLabel* lblExplanation ( new QLabel ( TR_FUNC (
"There is no database present. This either means that this is the first time this program "
"is used or the current database was deleted. You must choose one of the options below:" ) ) );
lblExplanation->setAlignment ( Qt::AlignJustify );
lblExplanation->setWordWrap ( true );
rdImport = new QRadioButton ( TR_FUNC ( "Import from backup" ) );
rdImport->setMinimumHeight ( 30 );
rdImport->setChecked ( true );
rdStartNew = new QRadioButton ( TR_FUNC ( "Start a new database" ) );
rdStartNew->setMinimumHeight ( 30 );
rdStartNew->setChecked ( false );
rdNothing = new QRadioButton ( TR_FUNC ( "Do nothing and exit" ) );
rdNothing->setMinimumHeight ( 30 );
rdNothing->setChecked ( false );
btnProceed = new QPushButton ( TR_FUNC ( "&Proceed" ) );
btnProceed->setMinimumSize ( 100, 30 );
btnProceed->setDefault ( true );
connect ( btnProceed, &QPushButton::clicked, this, [&] () { return btnNoDBProceed_clicked (); } );
QVBoxLayout* layout ( new QVBoxLayout );
layout->addWidget ( lblExplanation, 1, Qt::AlignJustify );
layout->addWidget ( rdImport, 1, Qt::AlignLeft );
layout->addWidget ( rdStartNew, 1, Qt::AlignLeft );
layout->addWidget ( rdNothing, 1, Qt::AlignLeft );
layout->addWidget ( btnProceed, 1, Qt::AlignCenter );
layout->setMargin ( 0 );
layout->setSpacing ( 1 );
dlgNoDB->adjustSize ();
dlgNoDB->setLayout ( layout );
const QRect desktopGeometry ( qApp->desktop ()->availableGeometry ( -1 ) );
dlgNoDB->move ( ( desktopGeometry.width () - width () ) / 2, ( desktopGeometry.height () - height () ) / 2 );
}
dlgNoDB->exec ();
}
void BackupDialog::btnNoDBProceed_clicked ()
{
if ( !rdNothing->isChecked () )
{
ui->toolBox->setCurrentIndex ( 1 );
ui->toolBox->setEnabled ( true );
ui->toolBox->widget ( 0 )->setEnabled ( false );
APP_RESTORER ()->setNewDBSession ();
if ( VDB ()->createDatabase () )
{
if ( VDB ()->createUser () )
{
if ( rdImport->isChecked ( ) )
{
dlgNoDB->hide ();
exec ();
}
else
mb_success = VDB ()->createAllTables ();
if ( actionSuccess () )
{
mb_nodb = false;
dlgNoDB->done ( QDialog::Accepted );
return;
}
}
}
dlgNoDB->done ( QDialog::Rejected );
backupNotify->notifyMessage ( TR_FUNC ( "Database creation failed" ),
TR_FUNC ( "Please try again. If the problem persists ... who knows?" ), 3000, true );
close ();
}
else
qApp->exit ( 1 );
}
void BackupDialog::selectAll ( QListWidgetItem* item )
{
if ( b_IgnoreItemListChange ) return;
b_IgnoreItemListChange = true;
if ( item == ui->tablesList->item ( 0 ) )
{
for ( int i ( 1 ); i < ui->tablesList->count (); ++i )
ui->tablesList->item ( i )->setCheckState ( item->checkState () );
}
else
{
int checked ( 0 );
for ( int i ( 1 ); i < ui->tablesList->count (); ++i )
{
if ( ui->tablesList->item ( i )->checkState () == Qt::Checked )
++checked;
else
--checked;
}
if ( checked == ui->tablesList->count () - 1 )
ui->tablesList->item ( 0 )->setCheckState ( Qt::Checked );
else if ( checked == 0 - ( ui->tablesList->count () - 1 ) )
ui->tablesList->item ( 0 )->setCheckState ( Qt::Unchecked );
else
ui->tablesList->item ( 0 )->setCheckState ( Qt::PartiallyChecked );
}
b_IgnoreItemListChange = false;
}
void BackupDialog::btnApply_clicked ()
{
ui->btnClose->setEnabled ( false );
mb_success = false;
if ( ui->toolBox->currentIndex () == 0 )
{ // backup
if ( ui->grpBackup->isChecked () )
{
if ( !ui->txtBackupFolder->text ().isEmpty () )
{
if ( ui->txtBackupFolder->text ().at ( ui->txtBackupFolder->text ().length () - 1 ) != '/' )
ui->txtBackupFolder->setText ( ui->txtBackupFolder->text () + CHR_F_SLASH );
mb_success = doBackup ( ui->txtBackupFilename->text (), ui->txtBackupFolder->text (), true );
}
}
else
mb_success = doExport ( ui->txtExportPrefix->text (), ui->txtExportFolder->text (), true );
}
else
{ // restore
QString selected;
if ( ui->rdChooseKnownFile->isChecked () )
{
if ( ui->restoreList->currentRow () <= 0 )
ui->restoreList->setCurrentRow ( ui->restoreList->count () - 1 );
selected = ui->restoreList->currentItem ()->text ();
}
else
selected = ui->txtRestoreFileName->text ();
mb_success = doRestore ( selected );
}
ui->btnApply->setEnabled ( false );
ui->btnClose->setEnabled ( true );
}
void BackupDialog::btnClose_clicked ()
{
switch ( m_after_close_action )
{
case ACA_RETURN_TO_PREV_WINDOW:
done ( actionSuccess () );
break;
case ACA_RESTART:
Sys_Init::restartProgram ();
break;
case ACA_CONTINUE:
ui->btnApply->setEnabled ( true );
break;
}
}
void BackupDialog::grpBackup_clicked ( const bool checked )
{
ui->grpExportToText->setChecked ( !checked );
ui->chkTables->setChecked ( checked );
ui->tablesList->setEnabled ( checked );
ui->btnApply->setEnabled ( true );
}
void BackupDialog::grpExportToText_clicked ( const bool checked )
{
ui->grpBackup->setChecked ( !checked );
ui->btnApply->setEnabled ( true );
}
//-----------------------------------------------------------RESTORE---------------------------------------------------
bool BackupDialog::getSelectedItems ( QString& selected )
{
if ( !ui->restoreList->selectedItems ().isEmpty () )
{
selected.clear ();
const QList<QListWidgetItem*> sel_items ( ui->restoreList->selectedItems () );
QList<QListWidgetItem*>::const_iterator itr ( sel_items.constBegin () );
const QList<QListWidgetItem*>::const_iterator itr_end ( sel_items.constEnd () );
for ( ; itr != itr_end; ++itr )
{
if ( !selected.isEmpty () )
selected += CHR_SPACE;
selected += static_cast<QListWidgetItem*> ( *itr )->text ();
}
return true;
}
else
backupNotify->notifyMessage ( TR_FUNC ( "Restore - Error" ), TR_FUNC ( "No file selected" ) );
return false;
}
void BackupDialog::initProgressBar ( const int max )
{
progress_bar_steps = max;
ui->pBar->setRange ( 0, progress_bar_steps );
ui->pBar->setValue ( 0 );
ui->pBar->setVisible ( true );
}
bool BackupDialog::checkThatFileDoesNotExist ( const QString& filepath, const bool bUserInteraction )
{
if ( fileOps::exists ( filepath ).isOn () )
{
if ( bUserInteraction )
{
const QString question ( QString ( TR_FUNC ( "The file %1 already exists. Overwrite it?" ) ).arg ( filepath ) );
if ( !BACKUP ()->backupNotify->questionBox ( TR_FUNC ( "Same filename" ), question ) )
return false;
fileOps::removeFile ( filepath );
}
else
return false;
}
return true;
}
bool BackupDialog::checkDir ( const QString& dir )
{
if ( fileOps::isDir ( dir ).isOn () )
{
if ( fileOps::canWrite ( dir ).isOn () )
{
if ( fileOps::canRead ( dir ).isOn () )
return fileOps::canExecute ( dir ).isOn ();
}
}
return false;
}
bool BackupDialog::checkFile ( const QString& file )
{
if ( fileOps::isFile ( file ).isOn () )
{
return fileOps::canRead ( file ).isOn ();
}
return false;
}
void BackupDialog::addDocuments ( const QString& tar_file )
{
tar_file.toInt ();
// Browse CONFIG ()->projectsBaseDir () for files with CONFIG ()->xxxExtension
// Copy them to the temporary dir (in /tmp)
// Add temp dir to tar_file
// erase temp dir whatever the result
//TODO
}
void BackupDialog::addImages ( const QString& tar_file )
{
tar_file.toInt ();
}
void BackupDialog::rdChooseKnownFile_toggled ( const bool checked )
{
ui->rdChooseAnotherFile->setChecked ( !checked );
ui->txtRestoreFileName->setEnabled ( !checked );
ui->btnChooseImportFile->setEnabled ( !checked );
ui->restoreList->setEnabled ( checked );
ui->btnApply->setEnabled ( checked && ui->restoreList->count () > 0 );
}
void BackupDialog::rdChooseAnotherFile_toggled ( const bool checked )
{
ui->rdChooseKnownFile->setChecked ( !checked );
ui->txtRestoreFileName->setEnabled ( checked );
ui->btnChooseImportFile->setEnabled ( checked );
ui->restoreList->setEnabled ( !checked );
ui->btnApply->setEnabled ( checked && !ui->txtRestoreFileName->text ().isEmpty () );
}
void BackupDialog::btnChooseImportFile_clicked ()
{
const QString selectedFile ( fileOps::getOpenFileName ( CONFIG ()->backupDir (), TR_FUNC ( "Database files ( *.bz2 *.sql )" ) ) );
if ( !selectedFile.isEmpty () )
ui->txtRestoreFileName->setText ( selectedFile );
ui->btnApply->setEnabled ( !selectedFile.isEmpty () );
}
void BackupDialog::btnRemoveFromList_clicked ()
{
if ( ui->restoreList->currentItem () != nullptr )
{
QListWidgetItem* item ( ui->restoreList->currentItem () );
stringRecord files;
if ( tdb->getRecord ( files, 0 ) )
{
files.removeField ( static_cast<uint>(ui->restoreList->currentRow ()) );
tdb->changeRecord ( 0, files );
tdb->commit ();
}
ui->restoreList->removeItemWidget ( item );
delete item;
}
}
void BackupDialog::btnRemoveAndDelete_clicked ()
{
if ( ui->restoreList->currentItem () != nullptr )
{
fileOps::removeFile( ui->restoreList->currentItem ()->text () );
btnRemoveFromList_clicked ();
}
}
void BackupDialog::btnSendMail_clicked ()
{
QString selected;
if ( getSelectedItems ( selected ) )
EMAIL_CONFIG ()->sendEMail ( CONFIG ()->defaultEmailAddress (), TR_FUNC ( "Backup file" ), selected );
}
|
b9352fb722b90ed916419f30b8e9992de935a3e7 | 9129ef1deab894e7ea70b0c1dd6a4d33d3ff35a6 | /examples/IntelliKeys/IntelliKeys.ino | 9541880856a0701cf0e42843b4d5890b9484ccd5 | [
"MIT"
] | permissive | gdsports/IntelliKeys_t36 | 8a8df1c179e1f58db7bea1b8bc7eb0270c1bf9d7 | 407297cc131aa3f6e7e336973e08bbfc41a08ad6 | refs/heads/master | 2020-04-10T21:41:25.429735 | 2018-12-20T02:20:08 | 2018-12-20T02:20:08 | 161,303,478 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,299 | ino | IntelliKeys.ino | /*
* Demonstrate the use of the Teensy 3.6 IntelliKeys (IK) USB host driver.
* Translate IK touch and switch events into USB keyboard and mouse inputs. The
* Teensy 3.6 has one USB host and one USB device port so it plugs in between
* the IK and the computer.
*/
#include <USBHost_t36.h>
#include <intellikeys.h>
#include <keymouse_play.h> // https://github.com/gdsports/keymouse_t3
#include "keymouse.h"
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
IntelliKeys ikey1(myusb);
keymouse_play keyplay;
elapsedMillis beepTime;
bool Connected = false;
void IK_press(int x, int y)
{
Serial.printf("membrane press (%d,%d)\n", x, y);
process_membrane_press(ikey1, x, y);
}
void IK_release(int x, int y)
{
Serial.printf("membrane release (%d,%d)\n", x, y);
process_membrane_release(ikey1, x, y);
}
const char keysequence[] =
"GUI-KEY_R ~100 'chrome' SPACE 'https://www.google.com/' ENTER";
void IK_switch(int switch_number, int switch_state)
{
Serial.printf("switch[%d] = %d\n", switch_number, switch_state);
if (switch_state == 0) return;
switch (switch_number) {
case 1:
keyplay.start(keysequence);
break;
case 2:
break;
}
}
void IK_sensor(int sensor_number, int sensor_value)
{
Serial.printf("sensor[%d] = %d\n", sensor_number, sensor_value);
}
void IK_version(int major, int minor)
{
Serial.printf("IK firmware Version %d.%d\n", major, minor);
}
void IK_connect(void)
{
Serial.println("IK connect");
Connected = true;
}
void IK_disconnect(void)
{
Serial.println("IK disconnect");
Connected = false;
}
void IK_onoff(int onoff)
{
Serial.printf("On/Off switch = %d\n", onoff);
if (onoff == 0) {
clear_membrane();
ikey1.setLED(IntelliKeys::IK_LED_SHIFT, 0);
ikey1.setLED(IntelliKeys::IK_LED_CAPS_LOCK, 0);
ikey1.setLED(IntelliKeys::IK_LED_MOUSE, 0);
ikey1.setLED(IntelliKeys::IK_LED_ALT, 0);
ikey1.setLED(IntelliKeys::IK_LED_CTRL_CMD, 0);
ikey1.setLED(IntelliKeys::IK_LED_NUM_LOCK, 0);
}
}
char mySN[IK_EEPROM_SN_SIZE+1]; //+1 for terminating NUL
void IK_get_SN(uint8_t SN[IK_EEPROM_SN_SIZE])
{
memcpy(mySN, SN, IK_EEPROM_SN_SIZE);
mySN[IK_EEPROM_SN_SIZE] = '\0';
Serial.printf("Serial Number = %s\n", mySN);
}
void IK_correct_membrane(int x, int y)
{
Serial.printf("correct membrane (%d,%d)\n", x, y);
}
void IK_correct_switch(int switch_number, int switch_state)
{
Serial.printf("correct switch[%d] = %d\n", switch_number, switch_state);
}
void IK_correct_done(void)
{
Serial.println("correct done");
}
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 2000) ; // wait for Arduino Serial Monitor
Serial.println("IntelliKeys USB Test");
myusb.begin();
ikey1.begin();
ikey1.onConnect(IK_connect);
ikey1.onDisconnect(IK_disconnect);
ikey1.onMembranePress(IK_press);
ikey1.onMembraneRelease(IK_release);
ikey1.onSwitch(IK_switch);
ikey1.onSensor(IK_sensor);
ikey1.onVersion(IK_version);
ikey1.onOnOffSwitch(IK_onoff);
ikey1.onSerialNum(IK_get_SN);
ikey1.onCorrectMembrane(IK_correct_membrane);
ikey1.onCorrectSwitch(IK_correct_switch);
ikey1.onCorrectDone(IK_correct_done);
}
void loop() {
myusb.Task();
keyplay.loop();
if (Connected && beepTime > 30000) {
//ikey1.sound(1000, 100, 500);
beepTime = 0;
}
}
|
6694ef4b5f685dbc0f056bc6adba80a94aa481a3 | de168fba98a45901c338c24eac35f7a3995485ff | /soar_bot/Bot.h | 77055e71edc151351d2f131f62a6b8f847336a2b | [
"Apache-2.0"
] | permissive | mtinkerhess/SoarAnts | e8d82c075d6eaf9dfb7cac6c839e036919aef4ba | 818ea70b7415430191c966e19ad89960aa671113 | refs/heads/master | 2016-09-06T07:32:09.820231 | 2012-03-13T04:25:22 | 2012-03-13T04:25:22 | 3,321,230 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 614 | h | Bot.h | #ifndef BOT_H_
#define BOT_H_
#include <fstream>
#include "State.h"
#include "sml_Client.h"
using namespace sml;
using namespace std;
/*
This struct represents your bot in the game of Ants
*/
struct Bot
{
State state;
Bot(const char *agent_name);
~Bot();
Kernel *kernel;
ofstream soar_log;
void playGame(); //plays a single game of Ants
void makeMoves(); //makes moves for a single turn
void endTurn(); //indicates to the engine that it has made its moves
bool checkKernelError(Kernel *kernel);
bool running;
string agent_name;
};
#endif //BOT_H_
|
013bed299a137076d4c05071e19535adbdf77d9c | 3d6771218a21f42aa519ea850d33728a4a7b0cef | /Goncharov/main.cpp | 24f3f74c946e08df3fa10c51865ee8457b6f1035 | [] | no_license | Aldirion/Goncharov | 926c3970a581be68fb97a06fb66632fc0ef3fe7a | f0f68d41080e3fac807513d8cc0f2b1b1d94911b | refs/heads/master | 2020-03-19T17:49:20.870935 | 2018-06-10T04:41:41 | 2018-06-10T04:41:41 | 136,779,659 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 83 | cpp | main.cpp | #include "TWorker.h"
int main()
{
setlocale(LC_ALL, "rus");
demo();
return 0;
} |
77722765a8f79f09875e40718541299fd4561bfb | f27c36fe5c07c407f0bb26d0358c5c6537bd00b1 | /BinarySearch/ClosestBinarySearchTree.cpp | f88fd36b0db677ec064d897fa1b1a6b9c74601bb | [] | no_license | A1exrebys/tasks | 8f013cfd30c4a2298be84bcd5b0647155cc8ee07 | d8ad8896707780433b2418ba2f60bd6df668813c | refs/heads/master | 2020-04-26T12:18:55.540265 | 2019-03-26T19:13:34 | 2019-03-26T19:13:34 | 173,545,402 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 537 | cpp | ClosestBinarySearchTree.cpp | #include <iostream>
using namespace std;
class Solution {
public:
int closestValue(TreeNode* root, double target) {
int min = root->val;
while (root != NULL) {
min = abs(target - root->val) < abs(min - target) ? root->val : min;
if (root->val < target)
root = root->right;
else
root = root->left;
}
return min;
}
};
|
040704c2a7ea39288bf91bacf83d7bcc7c623c6d | 4049a6686e7cecc41d334f517800ea7b66039606 | /2.1_sort3.cpp | d36a2aeefb77c01d3a8bbd2a1c276a2472633ad2 | [] | no_license | cnwsycf/usaco | 02dae1dcd6891e08c765601aa220fbb8c8198485 | 316b58938eecc5cdb42e207b8b3d582385104a12 | refs/heads/master | 2016-09-07T02:15:58.296833 | 2014-02-13T05:41:20 | 2014-02-13T05:41:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,626 | cpp | 2.1_sort3.cpp | /*
ID: LovelyBobo
PROG: sort3
LANG: C++
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long lld;
void FPre(){
freopen("sort3.in", "r", stdin);
freopen("sort3.out", "w", stdout);
}
const int maxn = 1005;
int n, a[maxn], b[maxn];
int mp[4][4];
void Init(){
memset(mp, 0, sizeof(mp));
}
void Read(){
scanf("%d", &n);
for (int i = 1; i <= n; i++){
scanf("%d", &a[i]);
}
}
void debug(){
for (int i = 1; i <= 3; i++){
for (int j = 1; j <= 3; j++)printf("%d ", mp[i][j]);
printf("\n");
}
}
void Solve(){
int num[4] = {0};
for (int i = 1; i <= n; i++){
num[a[i]]++;
}
for (int i = 1; i <= n; i++){
if (num[1])b[i] = 1, num[1]--;
else if (num[2])b[i] = 2, num[2]--;
else b[i] = 3, num[3]--;
}
//for (int i = 1; i <= n; i++)printf("%d ", a[i]); printf("\n");
//for (int i = 1; i <= n; i++)printf("%d ", b[i]); printf("\n");
for (int i = 1; i <= n; i++){
mp[a[i]][b[i]]++;
}
//debug();
int sum = 0, tmp = 0;
for (int i = 1; i <= 3; i++){
for (int j = i; j <= 3; j++){
int Min = min(mp[i][j], mp[j][i]);
if (i != j){
sum += Min;
}
if (i != j)mp[i][j] -= Min; mp[j][i] -= Min;
}
}
//debug(); printf("%d\n", sum);
for (int i = 1; i <= 3; i++){
for (int j = 1; j <= 3; j++){
tmp += mp[i][j];
}
}
printf("%d\n", sum + tmp / 3 * 2);
return ;
}
int main(){
FPre();
Read();
Init();
Solve();
return 0;
}
|
e290885c1351aa52aca30d521dd5853ebb84923e | 81367424de01ed24244148bb386d4869d6d62598 | /ordered_multiset/src/multiset.cc | ab1d3311c6acfc19c94b6f6ccf19da01b112e591 | [] | no_license | easy-testing/easytesting | eb0c0bc9ffc5d92d46be3a008dd28ccd539a16b2 | b98b49699d40d08a0c248d53df2036a10eb7ee74 | refs/heads/master | 2016-09-10T22:13:35.158396 | 2014-10-28T14:04:16 | 2014-10-28T14:04:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,105 | cc | multiset.cc | // Copyright 2014 Universidade Federal de Minas Gerais (UFMG)
#include "src/multiset.h"
// Define como os elementos da árvore serão organizados na memória.
struct Node {
SType key; // Valor da chave do nó.
int count; // Número de ocorrências da chave.
Node* left; // Ponteiro para o nó a esquerda.
Node* right; // Ponteiro para o nó a direita.
Node* parent; // Ponteiro para o nó acima.
};
// Implementação das funções auxiliares que operam sobre os nós da árvore.
////////////////////////////////////////////////////////////////////////////////
// Retorna o nó da árvore x cuja chave é k em O(log n),
// ou NULL caso k não esteja na árvore x.
Node* TreeSearch(Node* x, SType k) {
while (x != NULL && k != x->key) {
if (k < x->key) {
x = x->left;
} else {
x = x->right;
}
}
return x;
}
// Retorna o nó com o menor elemento da árvore x em O(log n).
// Precondição: x não é uma árvore vazia.
Node* TreeMinimum(Node* x) {
while (x->left != NULL) {
x = x->left;
}
return x;
}
// Retorna o nó com o maior elemento da árvore x em O(log n).
// Precondição: x não é uma árvore vazia.
Node* TreeMaximum(Node* x) {
while (x->right != NULL) {
x = x->right;
}
return x;
}
// Dado o nó x, retorna o sucessor de x, ou seja, o nó cuja chave é o menor
// elemento maior que a chave de x. Caso x seja o maior elemento da árvore,
// retorna NULL.
Node* TreeSuccessor(Node* x) {
if (x->right != NULL) {
return TreeMinimum(x->right);
} else {
Node* y = x->parent;
while (y != NULL && x == y->right) {
x = y;
y = y->parent;
}
return y;
}
}
// Dado o nó x, retorna o predecessor de x, ou seja, o nó cuja chave é o maior
// elemento menor que a chave de x. Caso x seja o menor elemento da árvore,
// retorna NULL.
Node* TreePredecessor(Node* x) {
if (x->left != NULL) {
return TreeMaximum(x->left);
} else {
Node* y = x->parent;
while (y != NULL && x == y->left) {
x = y;
y = y->parent;
}
return y;
}
}
// Insere uma FOLHA z na árvore cujo nó raiz é 'root' de forma consistente.
// NOTA: Esta função NÃO aloca a memória para z.
void TreeInsert(Node*& root, Node* z) { // NOLINT
// Procura qual vai ser o pai y de z na árvore.
Node* y = NULL;
Node* x = root;
while (x != NULL) {
y = x;
if (z->key < x->key) {
x = x->left;
} else {
x = x->right;
}
}
// Insere z em baixo do nó y.
z->parent = y;
if (y == NULL) {
root = z; // z se torna a raiz da árvore.
} else if (z->key < y->key) {
y->left = z;
} else {
y->right = z;
}
}
// Desconecta o nó z da árvore de forma consistente e depois retorna z.
// NOTA: Esta função NÃO desaloca a memória alocada para z.
Node* TreeDelete(Node*& root, Node* z) { // NOLINT
Node* y; // Nó que será desconectado da árvore.
if (z->left == NULL || z->right == NULL) {
y = z;
} else {
y = TreeSuccessor(z);
}
Node* x; // Nó que vai ser o novo filho do pai de y.
if (y->left != NULL) {
x = y->left;
} else {
x = y->right;
}
if (x != NULL) {
x->parent = y->parent;
}
if (y->parent == NULL) {
root = x;
} else {
if (y == y->parent->left) {
y->parent->left = x;
} else {
y->parent->right = x;
}
}
if (y->key != z->key) {
z->key = y->key;
z->count = y->count;
}
return y;
}
// Implementação das funções do TAD multiset.
////////////////////////////////////////////////////////////////////////////////
multiset::multiset() {
root_ = NULL;
size_= 0;
}
Node* multiset::begin() const {
if (empty()) {
return end();
} else {
return TreeMinimum(root_);
}
}
Node* multiset::end() const {
return NULL;
}
Node* multiset::next(Node* x) const {
return TreeSuccessor(x);
}
Node* multiset::prev(Node* x) const {
if (x == end()) {
return TreeMaximum(root_);
} else {
return TreePredecessor(x);
}
}
int multiset::count(SType k) const {
Node* x = find(k);
if (x == end()) {
return 0;
} else {
return x->count;
}
}
SType multiset::key(Node* x) const {
return x->key;
}
bool multiset::empty() const {
return size_ == 0;
}
int multiset::size() const {
return size_;
}
Node* multiset::find(SType k) const {
return TreeSearch(root_, k);
}
void multiset::insert(SType k) {
Node* x = find(k);
if (x != end()) {
x->count++;
} else {
Node* z = new Node;
z->key = k;
z->count = 1;
z->parent = z->left = z->right = NULL;
TreeInsert(root_, z);
}
size_++;
}
void multiset::erase(SType k) {
Node* z = find(k);
if (z != end()) {
if (z->count > 1) {
z->count--;
} else {
delete TreeDelete(root_, z);
}
size_--;
}
}
void multiset::clear() {
while (!empty()) {
erase(begin()->key);
}
}
void multiset::operator=(const multiset& s) {
clear();
for (Node* i = s.begin(); i != s.end(); i = s.next(i)) {
for (int j = 0; j < i->count; j++) {
insert(i->key);
}
}
}
multiset::~multiset() {
clear();
}
|
19f6616237764d8215c269556b57cc059155b40e | 2f85ea1b415b0a5b14c3f67a43bc7c8266c2d1b3 | /Greedy/weightedjob.cpp | 5e6e27357fe915143fd8c4ab47601a7e48bd91a4 | [] | no_license | ratankumar19/Competitive-Programming | 960c565fcbf91c282bcfb0d8141ed85335985310 | d19f1678f4695b8057d619651a8c05310f212c5c | refs/heads/master | 2022-11-13T22:06:59.396406 | 2020-07-11T13:16:08 | 2020-07-11T13:16:08 | 278,863,021 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 988 | cpp | weightedjob.cpp | #include<bits/stdc++.h>
using namespace std;
struct job{
int start,finish,profit;
};
bool compare(struct job a,struct job b){
return a.finish<b.finish;
}
int binary(struct job arr[],int i){
int l=0;int h=i-1;
while(l<=h){
int mid=(l+h)/2;//
//jb value exist kree
if(arr[mid].finish==arr[i].start){
return mid;
}else if(arr[mid].finish<=arr[i].start){
l=mid+1;
}
else h=mid-1;
}return -1;
}
int helper(struct job arr[],int n){
sort(arr,arr+n,compare);
int *dp=new int[n];
dp[0]=arr[0].profit;
for(int i=1;i<n;i++){
int inc=arr[i].profit;
int j=binary(arr,i);
inc+=dp[j];
dp[i]=max(inc,dp[i-1]);
}
int ans=dp[n-1];
return ans;
}
int main()
{
int n;cin>>n;
struct job j[n];
for(int i=0;i<n;i++){
cin>>j[i].start>>j[i].finish>>j[i].profit;
}
cout<<helper(j,n)<<"\n";
return 0;
}
|
81938065afdb6d8b6d9f22d18def98051e90808c | 7746e5ffb24e2a8b699fd1d4663505450a8706fe | /ErrorsElement.cpp | 2a7493f4ed17f18edc94c12666197eab77b24052 | [] | no_license | abrioy/OneWaySync | 0a1cc3a8e5ee54de26e6af4f69c4399274a1b49c | 43887e8c941e4a25386910bebc7d96f101e7061c | refs/heads/master | 2021-01-22T14:15:16.554941 | 2014-09-03T16:52:51 | 2014-09-03T16:52:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,447 | cpp | ErrorsElement.cpp | #include "ErrorsElement.h"
#include "IOfunction.h"
using namespace std;
ErrorsElement::ErrorsElement(OperationType operation, std::String errorMessage, std::String elementPath, std::String optionalCopyPath)
{
Operation = operation;
ErrorMessage = errorMessage;
ElementPath = elementPath;
OptionalCopyPath = optionalCopyPath;
}
void ErrorsElement::Print()
{
//wcerr.exceptions(iostream::failbit | iostream::badbit);
wcerr << endl << endl << L"Error - ";
switch (Operation)
{
case OperationType::FileCopy:
wcerr << L"File copy: " << endl
<< L" from: " << ElementPath << endl
<< L" to: " << OptionalCopyPath;
break;
case OperationType::FileDelete:
wcerr << L"File delete: " << endl
<< ElementPath;
break;
case OperationType::FolderCreate:
wcerr << L"Directory creation: " << endl
<< OptionalCopyPath;
break;
case OperationType::FolderRemove:
wcerr << L"Directory delete: " << endl
<< ElementPath;
break;
}
wcerr << endl << ErrorMessage;
}
void ErrorsElement::Fix()
{
switch (Operation)
{
case OperationType::FileCopy:
IOfunction::CopyFileByPath(ElementPath, OptionalCopyPath);
break;
case OperationType::FileDelete:
IOfunction::DeleteFileByPath(ElementPath);
break;
case OperationType::FolderCreate:
IOfunction::CreateDirectoryByPath(ElementPath, OptionalCopyPath);
break;
case OperationType::FolderRemove:
IOfunction::DeleteFolderByPath(ElementPath);
break;
}
} |
9f49ecfc45637b47dc013622289d147ead8df5db | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive2/38/e0682d8c446367/main.cpp | 41a73a51b956d68db7ec3b9cae266ab820331a0b | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,086 | cpp | main.cpp | #include <iostream>
#include <array>
const std::size_t SIZE = 10;
// int sequence
template <int... I>
struct sizes { using type = sizes <I...>; };
// construction of range [0, S] as int sequence
template <int S, int... I>
struct range_t : range_t <S - 1, S, I...> { };
template <int... I>
struct range_t <0, I...> : sizes <0, I...> { };
template <int S>
using range = typename range_t <S - 1>::type;
// is number Q in int sequence [A, An...]?
template <int Q>
constexpr bool in() { return false; }
template <int Q, int A, int... An>
constexpr bool in() { return Q == A || in <Q, An...>(); }
// convert int sequence [A...] to array<bool, sizeof...(N)>
template <int... A, int... N>
std::array<bool, sizeof...(N)>
func(sizes <N...>) {
return std::array<bool, sizeof...(N)>{{in <N, A...>()...}};
}
template <int... A>
std::array<bool, SIZE>
func() {
return func <A...>(range <SIZE>());
}
int main() {
std::array<bool, SIZE> b = func<SIZE, 1,3,7>();
// I want b[1]=true, b[3] = true, b[7] = true, all others false
for (int x: b) std::cout << x << std::endl;
}
|
fd1fe9b8a584af762b7abc89485b4112b64ae1e7 | 875c93415211ff5f1fbaa92fffe008cb5856e985 | /xii/sir_practical_scripts/xi_revision/ques_9.cpp | a20c65288dfe8505c241fafdec936865cb4e0418 | [] | no_license | Uchiha-Senju/practicals | 384774c5db544f7b1bcabe7f952eabb4fbed91cd | f18a5d7df14ced5bb93306eda210d3c4c860a211 | refs/heads/master | 2022-04-05T18:23:02.522784 | 2020-01-28T15:59:03 | 2020-01-28T16:01:02 | 151,337,483 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,383 | cpp | ques_9.cpp | #include <iostream>
using namespace std;
int main() {
int size_arr, no_of_duplicates = 0;
cout << "Give size of array : "; cin >> size_arr;
int arr[size_arr];
bool arr_tracker[size_arr];
for (int i = 0; i < size_arr; ++i)
arr_tracker[i] = true;
// Get input
cout << "Enter array : ";
for (int i = 0; i < size_arr; ++i)
cin >> arr[i];
cout << "\nOriginal Array : ";
for (int i = 0; i < size_arr; ++i)
cout << arr[i] << ' ';
cout << '\n';
// cout << "\nOriginal Array (shadow) : ";
// for (int i = 0; i < size_arr; ++i)
// cout << arr_tracker[i] << ' ';
// cout << '\n';
// Mark and remove all duplicate entries
for (int i = 0; i < size_arr; ++i) {
int in_focus = arr[i];
for (int j = i + 1; j < size_arr; ++j)
if (arr[j] == in_focus) {
arr_tracker[j] = false;
no_of_duplicates++;
}
}
// cout << "\nduplicate-removed Array : ";
// for (int i = 0; i < size_arr; ++i)
// cout << arr[i] << ' ';
// cout << '\n';
// cout << "\nduplicate-removed Array (shadow) : ";
// for (int i = 0; i < size_arr; ++i)
// cout << arr_tracker[i] << ' ';
// cout << '\n';
for (int i = 0, j; i < size_arr - 1; ++i) {
if (arr_tracker[i] == false) {
// find next non-duplicate entry
j = i + 1;
while (j < size_arr) {
if(arr_tracker[j] == true)
break;
else j++;
}
// No need to continue if is all duplcates till the end of the array
if (j == size_arr) break;
// Swap values
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
// Swap duplication status
arr_tracker[i] = true;
arr_tracker[j] = false;
// cout << "\nFinal Array : ";
// for (int i = 0; i < size_arr; ++i)
// cout << arr[i] << ' ';
// cout << '\n';
// cout << "\nFinal Array (shadow) : ";
// for (int i = 0; i < size_arr; ++i)
// cout << arr_tracker[i] << ' ';
// cout << '\n';
}
}
cout << "\nFinal Array : ";
for (int i = 0; i < size_arr - no_of_duplicates; ++i)
cout << arr[i] << ' ';
cout << '\n';
// cout << "\nFinal Array (shadow) : ";
// for (int i = 0; i < size_arr - no_of_duplicates; ++i)
// cout << arr_tracker[i] << ' ';
// cout << '\n';
while(getchar() != '\n');
getchar();
}
|
db48621df16994934b00f1d7cdabec40e5bbd9ac | 198806ccd0b5a7d476c701be5943e9a7afacb7d0 | /xdaq/include/ws/addressing/Headers.h | 0efccf6eb1fc2e6bb7223b865b804806cb715d89 | [] | no_license | marcomuzio/EMULib_CLCT_Timing | df5999b5f1187725d7f5b6196ba566045ba60f55 | 04e930d46cadaa0c73b94a0c22e4478f55fac844 | refs/heads/master | 2021-01-16T13:47:26.141865 | 2014-08-14T12:04:33 | 2014-08-14T12:04:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,139 | h | Headers.h | // $Id: Headers.h,v 1.2 2008/07/18 15:27:43 gutleber Exp $
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2009, CERN. *
* All rights reserved. *
* Authors: J. Gutleber and L. Orsini *
* *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
*************************************************************************/
#ifndef _ws_addressing_Headers_h_
#define _ws_addressing_Headers_h_
#include <string>
#include "xoap/SOAPEnvelope.h"
#include "ws/addressing/exception/Exception.h"
#include "xoap/MessageReference.h"
namespace ws
{
namespace addressing
{
class Headers
{
public:
Headers();
bool hasAction();
std::string getAction();
void setAction ( const std::string & value );
bool hasFaultTo();
std::string getFaultTo();
void setFaultTo ( const std::string & value );
bool hasFrom();
std::string getFrom();
void setFrom ( const std::string & value );
bool hasMessageId();
std::string getMessageId();
void setMessageId(const std::string & id);
bool hasRelatesTo();
std::string getRelatesTo();
void setRelatesTo ( const std::string & value );
bool hasReplyAfter();
std::string getReplyAfter();
void setReplyAfter ( const std::string & value );
bool hasReplyTo();
std::string getReplyTo();
void setReplyTo ( const std::string & value );
bool hasTo();
std::string getTo();
void setTo ( const std::string & value );
void fromSOAP(xoap::MessageReference& msg) throw (ws::addressing::exception::Exception);
void toSOAP(xoap::MessageReference& msg) throw (ws::addressing::exception::Exception);
private:
std::string action_;
std::string faultTo_;
std::string from_;
std::string messageId_;
std::string relatesTo_;
std::string replyAfter_;
std::string replyTo_;
std::string to_;
};
}
}
#endif
|
0cd2dffe217424999a39a8234474366714ea3283 | 87cef2edd1852a05de145a685de1122db57445a6 | /src/GnuplotDriver.cpp | 21b85f3ef803a12443e2101c69d2399b72a68770 | [
"MIT"
] | permissive | tbellosta/simplePlot | c132b67cba89790b45bc0b2b5ff6a3779dc9709e | ea44fc7f4472f3f43b516409235eb51ef3dfa968 | refs/heads/master | 2020-07-04T01:07:12.158571 | 2019-10-28T13:02:30 | 2019-10-28T13:02:30 | 202,105,868 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,402 | cpp | GnuplotDriver.cpp | //============================================================
//
// Type: simplePlot implementation file
//
// Author: Tommaso Bellosta
// Dipartimento di Scienze e Tecnologie Aerospaziali
// Politecnico di Milano
// Via La Masa 34, 20156 Milano, ITALY
// e-mail: tommaso.bellosta@polimi.it
//
// Copyright: 2019, Tommaso Bellosta and the simplePlot contributors.
// This software is distributed under the MIT license, see LICENSE.txt
//
//============================================================
#include "GnuplotDriver.h"
#include <iostream>
#include <execinfo.h>
#include <unistd.h>
vector<vector<vector<double>>> GnuplotDriver::videoData = {};
GnuplotDriver::GnuplotDriver(gnuplot_action_type action_type, string fileName, gnuplot_save_type format) {
this->id = rand();
this->commandFileName = "/tmp/gnuplotFile" + to_string(this->id) + ".txt";
this->dataFileName = "/tmp/tmp_gnuplot_data" + to_string(this->id) + ".txt";
this->action = action_type;
this->commandFile.open(this->commandFileName,ios::trunc);
this->plotOptions = " w l";
if (fileName == "plot.png" && format == GNUPLOT_EPS) fileName = "plot.eps";
this->saveName = fileName;
this->saveType = format;
if(this->action == GNUPLOT_SAVE) write_action_save();
}
GnuplotDriver::~GnuplotDriver() {
// this->commandFile.close();
}
void GnuplotDriver::write_command(const string& command) {
this->commandFile << command << endl;
}
void GnuplotDriver::setTitle(const string &title) {
write_command("set title \"" + title + "\"");
}
void GnuplotDriver::setXRange(const double &x0, const double &x1) {
write_command("set xrange [" + to_string(x0) + ":" + to_string(x1) + "]");
}
void GnuplotDriver::setYRange(const double &y0, const double &y1) {
write_command("set xrange [" + to_string(y0) + ":" + to_string(y1) + "]");
}
void GnuplotDriver::setPlotOptions(const string &opts) {
this->plotOptions = " " + opts;
}
void GnuplotDriver::setTitleFont(const int &size) {
write_command("set title font \"," + to_string(size) + "\"");
}
string GnuplotDriver::getTitle(const string& str){
return " title \"" + str + "\"";
}
void GnuplotDriver::plot(const vector<double> &x, const vector<double> &y) {
if(this->action == GNUPLOT_NONE){
cout << "[WARNING] gnuplot action is set to GNUPLOT_NONE." << endl;
return;
}
if(x.size() != y.size()){
cout<<"\n\n[ERROR] x and y must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double> &x, const vector<double> &y)");
}
bool noLegend = false;
if (this->legendTitles.empty()) {
legendTitles = vector<string>(1);
noLegend = true;
}
if(this->action != GNUPLOT_VIDEO) {
// creates (tmp) data file
ofstream tmp;
tmp.open(this->dataFileName, ios::trunc);
for (int i = 0; i < x.size(); ++i) {
tmp << x[i] << " " << y[i] << endl;
}
tmp.close();
if (noLegend) write_command("set nokey"); // hides legend
write_command("plot \"" + this->dataFileName + "\"" + this->plotOptions + getTitle(this->legendTitles[0]));
this->commandFile.close();
// execute gnuplot
executeGnuplot();
}
else{
if(this->videoData.empty()) this->videoData = vector<vector<vector<double>>>(1);
this->videoData[0].push_back(y);
}
}
void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0,
const vector<double>& x1, const vector<double>& y1) {
if(this->action == GNUPLOT_NONE){
cout << "[WARNING] gnuplot action is set to GNUPLOT_NONE." << endl;
return;
}
if(x0.size() != y0.size()){
cout<<"\n\n[ERROR] x0 and y0 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
if(x1.size() != y1.size()){
cout<<"\n\n[ERROR] x1 and y1 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
bool noLegend = false;
if (this->legendTitles.empty()) {
legendTitles = vector<string>(2);
noLegend = true;
}
if(this->action != GNUPLOT_VIDEO) {
// creates (tmp) data file
ofstream tmp;
tmp.open(this->dataFileName, ios::trunc);
for (int i = 0; i < x0.size(); ++i) {
tmp << x0[i] << " " << y0[i] << " " << x1[i] << " " << y1[i] << endl;
}
tmp.close();
if (noLegend) write_command("set nokey"); // hides legend
write_command(
"plot \"" + this->dataFileName + "\" u 1:2" + this->plotOptions + getTitle(legendTitles[0]) + ", '' u 3:4" + this->plotOptions + getTitle(legendTitles[1]));
this->commandFile.close();
// execute gnuplot
executeGnuplot();
}
else{
if(this->videoData.empty()) this->videoData = vector<vector<vector<double>>>(2);
this->videoData[0].push_back(y0);
this->videoData[1].push_back(y1);
}
}
void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0,
const vector<double>& x1, const vector<double>& y1,
const vector<double>& x2, const vector<double>& y2) {
if(this->action == GNUPLOT_NONE){
cout << "[WARNING] gnuplot action is set to GNUPLOT_NONE." << endl;
return;
}
if(x0.size() != y0.size()){
cout<<"\n\n[ERROR] x0 and y0 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
if(x1.size() != y1.size()){
cout<<"\n\n[ERROR] x1 and y1 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
if(x2.size() != y2.size()){
cout<<"\n\n[ERROR] x2 and y2 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1, "
"const vector<double>& x2, const vector<double>& y2)");
}
bool noLegend = false;
if (this->legendTitles.empty()) {
legendTitles = vector<string>(3);
noLegend = true;
}
if(this->action != GNUPLOT_VIDEO) {
// creates (tmp) data file
ofstream tmp;
tmp.open(this->dataFileName, ios::trunc);
for (int i = 0; i < x0.size(); ++i) {
tmp << x0[i] << " " << y0[i] << " " << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << endl;
}
tmp.close();
if (noLegend) write_command("set nokey"); // hides legend
write_command(
"plot \"" + this->dataFileName + "\" u 1:2" + this->plotOptions + getTitle(legendTitles[0]) + ", '' u 3:4" + this->plotOptions + getTitle(legendTitles[1]) + ", '' u 5:6" + this->plotOptions + getTitle(legendTitles[2]));
this->commandFile.close();
// execute gnuplot
executeGnuplot();
}
else{
if(this->videoData.empty()) this->videoData = vector<vector<vector<double>>>(3);
this->videoData[0].push_back(y0);
this->videoData[1].push_back(y1);
this->videoData[2].push_back(y2);
}
}
void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0,
const vector<double>& x1, const vector<double>& y1,
const vector<double>& x2, const vector<double>& y2,
const vector<double>& x3, const vector<double>& y3) {
if(this->action == GNUPLOT_NONE){
cout << "[WARNING] gnuplot action is set to GNUPLOT_NONE." << endl;
return;
}
if(x0.size() != y0.size()){
cout<<"\n\n[ERROR] x0 and y0 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
if(x1.size() != y1.size()){
cout<<"\n\n[ERROR] x1 and y1 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1)");
}
if(x2.size() != y2.size()){
cout<<"\n\n[ERROR] x2 and y2 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1, "
"const vector<double>& x2, const vector<double>& y2)");
}
if(x3.size() != y3.size()){
cout<<"\n\n[ERROR] x3 and y3 must have same dimension.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0, "
"const vector<double>& x1, const vector<double>& y1, "
"const vector<double>& x2, const vector<double>& y2, "
"const vector<double>& x3, const vector<double>& y3)");
}
bool noLegend = false;
if (this->legendTitles.empty()) {
legendTitles = vector<string>(4);
noLegend = true;
}
if(this->action != GNUPLOT_VIDEO) {
// creates (tmp) data file
ofstream tmp;
tmp.open(this->dataFileName, ios::trunc);
for (int i = 0; i < x0.size(); ++i) {
tmp << x0[i] << " " << y0[i] << " " << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << " " << x3[i] << " " << y3[i] << endl;
}
tmp.close();
if (noLegend) write_command("set nokey"); // hides legend
write_command(
"plot \"" + this->dataFileName + "\" u 1:2" + this->plotOptions + getTitle(legendTitles[0]) + ", '' u 3:4" + this->plotOptions + getTitle(legendTitles[1]) + ", '' u 5:6" + this->plotOptions + getTitle(legendTitles[2]) + ", '' u 7:8" + this->plotOptions + getTitle(legendTitles[3]));
this->commandFile.close();
// execute gnuplot
executeGnuplot();
}
else{
if(this->videoData.empty()) this->videoData = vector<vector<vector<double>>>(4);
this->videoData[0].push_back(y0);
this->videoData[1].push_back(y1);
this->videoData[2].push_back(y2);
this->videoData[3].push_back(y2);
}
}
void GnuplotDriver::write_action_save() {
switch(this->saveType){
case GNUPLOT_EPS:
write_command("set term epscairo");
break;
case GNUPLOT_PNG:
write_command("set term png");
break;
default:
cout<<"\n\n[ERROR] wrong output file type.\n\n"<<endl;
throw std::runtime_error("void GnuplotDriver::write_action_save()");
}
write_command("set output \"" + this->saveName + "\"");
}
void GnuplotDriver::playAnimation(const vector<double> &x, const double &dt) {
if(this->action != GNUPLOT_VIDEO){
cout << "[WARNING] calling function GnuplotDriver::playAnimation\n"
"but gnuplot action is not set to GNUPLOT_VIDEO." << endl;
return;
}
ofstream tmp;
tmp.open(this->dataFileName, ios::trunc);
for (int i = 0; i < x.size(); ++i) {
tmp << x[i] << " ";
for (int j = 0; j < this->videoData[0].size(); ++j) {
for (int k = 0; k < this->videoData.size(); ++k) {
tmp << this->videoData[k][j][i] << " ";
}
}
tmp << endl;
}
tmp.close();
int nCurves = this->videoData.size();
int nFrames = this->videoData[0].size();
// find bounding box for computed data
double min = 999;
double max = -999;
for (int i = 0; i < this->videoData[0].size(); ++i) {
for (int j = 0; j < this->videoData[0][i].size(); ++j) {
if (this->videoData[0][i][j] < min) min = this->videoData[0][i][j];
if (this->videoData[0][i][j] > max) max = this->videoData[0][i][j];
}
}
min -= (max > 0) ? (max*0.05) : (-max*0.05);
max += (max > 0) ? (max*0.05) : (-max*0.05);
write_command("set nokey");
write_command("do for [t=2:" + to_string(nFrames+1) + "] {");
write_command("set yrange [" + to_string(min) + " : " + to_string(max) + "]");
if (nCurves == 1)
write_command("plot \"" + this->dataFileName + "\" u 1:t" + this->plotOptions);
else if (nCurves == 2)
write_command("plot \"" + this->dataFileName + "\" u 1:2*t-2" + this->plotOptions + ", '' u 1:2*t-1" + this->plotOptions);
write_command("pause " + to_string(dt));
write_command("}");
this->commandFile.close();
// execute gnuplot
executeGnuplot();
}
void GnuplotDriver::executeGnuplot() {
pid_t child = fork();
pid_t wpid;
int status = 0;
if (child < 0) {
cout << "\n\n[ERROR] could not fork process.\n\n" << endl;
throw std::runtime_error("void GnuplotDriver::plot(const vector<double>& x0, const vector<double>& y0,\n"
" const vector<double>& x1, const vector<double>& y1)");
} else if (child == 0) {
// executes gnuplot
execlp("gnuplot", "gnuplot", this->commandFileName.c_str(), "--persist", (char *) NULL);
} else {
//main, wait for child
while ((wpid = wait(&status)) > 0);
}
}
void GnuplotDriver::setLegendTitles(const vector<string>& ss){
this->legendTitles = ss;
}
|
49bd58c6f1355bc4bea31911f97c1e586c6f1394 | bee6ec740d56b497070d02eec84cb6a7b55c6e95 | /src/ssa/ssa_unwinder.cpp | cf087b7c16e01440aa40e3a80cfe584be6817b7c | [] | no_license | neomatrix369/deltacheck | bee8704aa774f3e829ac260bea64cebf27fdeb73 | 0511ae2b09925f91d3b6b642792d2075b453b25e | refs/heads/master | 2021-06-01T09:09:54.441270 | 2016-03-09T07:32:39 | 2016-03-09T07:32:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,712 | cpp | ssa_unwinder.cpp | /*******************************************************************\
Module: SSA Unwinder
Author: Peter Schrammel
\*******************************************************************/
#include <iostream>
#include <util/i2string.h>
#include "ssa_unwinder.h"
/*******************************************************************\
Function: ssa_unwindert::unwind
Inputs:
Outputs:
Purpose: unwinds all loops the given number of times
\*******************************************************************/
void ssa_unwindert::unwind(local_SSAt &SSA, unsigned unwind_max)
{
if(unwind_max==0) return;
forall_goto_program_instructions(i_it, SSA.goto_function.body)
{
if(i_it->is_backwards_goto()) //we've found a loop
{
local_SSAt::locationt loop_head = i_it->get_target();
// get variables at beginning and end of loop body
std::map<exprt, exprt> pre_post_exprs;
const ssa_domaint::phi_nodest &phi_nodes =
SSA.ssa_analysis[i_it->get_target()].phi_nodes;
for(local_SSAt::objectst::const_iterator
o_it=SSA.ssa_objects.objects.begin();
o_it!=SSA.ssa_objects.objects.end();
o_it++)
{
ssa_domaint::phi_nodest::const_iterator p_it =
phi_nodes.find(o_it->get_identifier());
if(p_it==phi_nodes.end()) continue; // object not modified in this loop
symbol_exprt pre = SSA.name(*o_it, local_SSAt::LOOP_BACK, i_it);
symbol_exprt post = SSA.read_rhs(*o_it, i_it);
pre_post_exprs[pre] = post;
}
// unwind that loop
for(unsigned unwind=unwind_max; unwind>0; unwind--)
{
// insert loop_head
local_SSAt::nodet node = SSA.nodes[loop_head]; //copy
for(local_SSAt::nodet::equalitiest::iterator
e_it = node.equalities.begin();
e_it != node.equalities.end(); e_it++)
{
if(e_it->rhs().id()!=ID_if)
{
rename(*e_it,unwind);
continue;
}
if_exprt &e = to_if_expr(e_it->rhs());
if(unwind==unwind_max)
{
rename(e_it->lhs(),unwind);
e_it->rhs() = e.false_case();
}
else
{
e_it->rhs() = pre_post_exprs[e.true_case()];
rename(e_it->rhs(),unwind+1);
rename(e_it->lhs(),unwind);
}
}
merge_into_nodes(new_nodes,loop_head,node);
// insert body
local_SSAt::locationt it = loop_head; it++;
for(;it != i_it; it++)
{
local_SSAt::nodest::const_iterator n_it = SSA.nodes.find(it);
if(n_it==SSA.nodes.end()) continue;
local_SSAt::nodet n = n_it->second; //copy;
rename(n,unwind);
merge_into_nodes(new_nodes,it,n);
}
}
// feed last unwinding into original loop_head
local_SSAt::nodet &node = SSA.nodes[loop_head]; //modify in place
for(local_SSAt::nodet::equalitiest::iterator
e_it = node.equalities.begin();
e_it != node.equalities.end(); e_it++)
{
if(e_it->rhs().id()!=ID_if) continue;
if_exprt &e = to_if_expr(e_it->rhs());
e.false_case() = pre_post_exprs[e.true_case()];
rename(e.false_case(),1);
}
}
}
commit_nodes(SSA.nodes); //apply changes
}
/*******************************************************************\
Function: ssa_unwindert::rename()
Inputs:
Outputs:
Purpose:
\*******************************************************************/
void ssa_unwindert::rename(exprt &expr, unsigned index)
{
if(expr.id()==ID_symbol)
{
symbol_exprt &sexpr = to_symbol_expr(expr);
irep_idt id = id2string(sexpr.get_identifier())+"%"+i2string(index);
sexpr.set_identifier(id);
}
for(exprt::operandst::iterator it = expr.operands().begin();
it != expr.operands().end(); it++)
{
rename(*it, index);
}
}
/*******************************************************************\
Function: ssa_inlinert::rename()
Inputs:
Outputs:
Purpose:
\*******************************************************************/
void ssa_unwindert::rename(local_SSAt::nodet &node, unsigned index)
{
for(local_SSAt::nodet::equalitiest::iterator e_it = node.equalities.begin();
e_it != node.equalities.end(); e_it++)
{
rename(*e_it, index);
}
for(local_SSAt::nodet::constraintst::iterator c_it = node.constraints.begin();
c_it != node.constraints.end(); c_it++)
{
rename(*c_it, index);
}
for(local_SSAt::nodet::assertionst::iterator a_it = node.assertions.begin();
a_it != node.assertions.end(); a_it++)
{
rename(*a_it, index);
}
for(local_SSAt::nodet::function_callst::iterator
f_it = node.function_calls.begin();
f_it != node.function_calls.end(); f_it++)
{
rename(*f_it, index);
}
}
/*******************************************************************\
Function: ssa_unwindert::commit_nodes()
Inputs:
Outputs:
Purpose:
\*******************************************************************/
void ssa_unwindert::commit_nodes(local_SSAt::nodest &nodes)
{
//insert new nodes
for(local_SSAt::nodest::const_iterator n_it = new_nodes.begin();
n_it != new_nodes.end(); n_it++)
{
merge_into_nodes(nodes,n_it->first,n_it->second);
}
new_nodes.clear();
}
/*******************************************************************\
Function: ssa_unwindert::merge_node()
Inputs:
Outputs:
Purpose: merges equalities and constraints of two nodes into the first one
\*******************************************************************/
void ssa_unwindert::merge_into_nodes(local_SSAt::nodest &nodes,
const local_SSAt::locationt &loc, const local_SSAt::nodet &new_n)
{
local_SSAt::nodest::iterator it = nodes.find(loc);
if(it==nodes.end()) //insert
{
debug() << "insert new node" << eom;
nodes[loc] = new_n;
}
else //merge nodes
{
debug() << "merge node " << eom;
for(local_SSAt::nodet::equalitiest::const_iterator
e_it = new_n.equalities.begin();
e_it != new_n.equalities.end(); e_it++)
{
it->second.equalities.push_back(*e_it);
}
for(local_SSAt::nodet::constraintst::const_iterator
c_it = new_n.constraints.begin();
c_it != new_n.constraints.end(); c_it++)
{
it->second.constraints.push_back(*c_it);
}
for(local_SSAt::nodet::assertionst::const_iterator
a_it = new_n.assertions.begin();
a_it != new_n.assertions.end(); a_it++)
{
it->second.assertions.push_back(*a_it);
}
for(local_SSAt::nodet::function_callst::const_iterator
f_it = new_n.function_calls.begin();
f_it != new_n.function_calls.end(); f_it++)
{
it->second.function_calls.push_back(*f_it);
}
}
}
|
88d40a73d8ab91baee7318290b27ae0e0a7ebda0 | 6bb9a1de7df6cf72d93dd5b6fdc449a6109c8c05 | /d04/ex00/Peon.hpp | 4b6a3eac183e92c1d10a45d5783913262544902b | [] | no_license | enriquenc/cpp | b57afb279b465640bfe66cd6bd867448c69eb464 | 2b54745aaf1645437ccb2230a10161577456358f | refs/heads/master | 2020-03-30T13:04:35.202290 | 2018-10-14T19:07:17 | 2018-10-14T19:07:17 | 151,254,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | hpp | Peon.hpp | // ************************************************************************** //
// //
// ::: :::::::: //
// Peon.hpp :+: :+: :+: //
// +:+ +:+ +:+ //
// By: tmaslyan <tmaslyan@student.unit.ua> +#+ +:+ +#+ //
// +#+#+#+#+#+ +#+ //
// Created: 2018/10/06 14:55:33 by tmaslyan #+# #+# //
// Updated: 2018/10/06 14:55:34 by tmaslyan ### ########.fr //
// //
// ************************************************************************** //
#ifndef PEON_HPP
#define PEON_HPP
#include "Victim.hpp"
class Peon : public Victim
{
public:
Peon(void);
Peon(std::string const & name);
~Peon(void);
void getPolymorphed(void) const;
};
#endif |
3de6ad437b994e99a487e3a3b6e690a00f6460ee | c27f72097c11f49faf6fa93291407c7edaaf8165 | /Vivid3D/Solution/Engine/VividEngine/VSceneEntity.cpp | 911594c77ec7a58774a550ae2d602e7808ad6dff | [
"Zlib"
] | permissive | VividCoder/Vivid3D | 9e363de82b41316947976803d797b45edd4b8929 | dec8215df1640be2e5b74fc50f537bbd474a5385 | refs/heads/master | 2022-07-22T11:33:49.932071 | 2020-05-20T02:02:31 | 2020-05-20T02:02:31 | 259,988,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 859 | cpp | VSceneEntity.cpp | #include "pch.h"
#include "VSceneEntity.h"
using namespace Vivid::Scene::Nodes;
//using namespace Vivid::Scene::Nodes
VSceneEntity::VSceneEntity() {
meshes.resize(0);
rendermode = RenderMode::Lit;
}
bool VSceneEntity::RayToTri(float3 origin, float3 vec, float3& out) {
float sd = 1000.0f;
bool first = true;
float3 shit;
//printf("Checking meshes.\n");
for (int i = 0; i < meshes.size(); i++) {
auto mesh = meshes[i];
float3 out2;
// printf("Checking mesh:%d \n", i);
if (mesh->RayToTri(this->GetWorld(), origin, vec, out2)) {
float dis = Maths::MathsUtil::Distance(origin, out2);
if (dis < sd || first) {
sd = dis;
first = false;
shit = out2;
}
}
}
if (!first) {
out = shit;
return true;
}
return false;
}
void VSceneEntity::AddMesh(Vivid::Mesh::Mesh3D* mesh) {
meshes.push_back(mesh);
} |
297b2ebeff5a42ba7a90e8c74fe0029780c7538a | 792ad26fd812df30bf9a4cc286cca43b87986685 | /poj 1363 Rails.cpp | 5f71dcb6440ac67ac9e3c05b8477ed8567fb1eae | [] | no_license | Clqsin45/acmrec | 39fbf6e02bb0c1414c05ad7c79bdfbc95dc26bf6 | 745b341f2e73d6b1dcf305ef466a3ed3df2e65cc | refs/heads/master | 2020-06-18T23:44:21.083754 | 2016-11-28T05:10:44 | 2016-11-28T05:10:44 | 74,934,363 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 481 | cpp | poj 1363 Rails.cpp | #include <stdio.h>
int stack[15004];
int main(void)
{
int t, n, i, j, top, in, flag, sign, x;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
stack[0] = 0;
top = 1;
x = 1;
stack[top] = x;
flag = 1;
i = n;
while(i--){
scanf("%d", &in);
while(stack[top] != in){
if(x > n) {
flag = 0;
break;
}
else stack[++top] = (++x);
}
top--;
}
if(flag) printf("Yes\n");
else printf("No\n");
}
return 0;
}
|
9a0b09ea17c26e23b344fda20d098f3f9629227d | 091afb7001e86146209397ea362da70ffd63a916 | /inst/include/nt2/include/functions/cummax.hpp | c0b35de4caf72a1a39c123c55a650fc07c8ae0eb | [] | no_license | RcppCore/RcppNT2 | f156b58c08863243f259d1e609c9a7a8cf669990 | cd7e548daa2d679b6ccebe19744b9a36f1e9139c | refs/heads/master | 2021-01-10T16:15:16.861239 | 2016-02-02T22:18:25 | 2016-02-02T22:18:25 | 50,460,545 | 15 | 1 | null | 2019-11-15T22:08:50 | 2016-01-26T21:29:34 | C++ | UTF-8 | C++ | false | false | 158 | hpp | cummax.hpp | #ifndef NT2_INCLUDE_FUNCTIONS_CUMMAX_HPP_INCLUDED
#define NT2_INCLUDE_FUNCTIONS_CUMMAX_HPP_INCLUDED
#include <nt2/swar/include/functions/cummax.hpp>
#endif
|
19ba3c2bdc66e5f4be418394a590211abffa5d5f | 88aa223a99c9a2a1d94e0424f00fc554dfb0b19a | /20-type-template/implementation.h | b4747643a0803d9ba1abef0e96c99deccb3e56de | [] | no_license | ProjectsInCpp/NA-templates | 125b196d24ebab0d523f0db7d399f1787358a89a | 1ba1ac46671f820ceaf19107575a1ef9fff5993f | refs/heads/master | 2021-06-24T01:57:02.881799 | 2017-08-10T13:20:05 | 2017-08-10T13:20:05 | 99,815,586 | 0 | 0 | null | 2017-08-09T14:09:00 | 2017-08-09T14:09:00 | null | UTF-8 | C++ | false | false | 921 | h | implementation.h | #pragma once
#include <boost/optional.hpp>
template<typename T>
struct size_trait
{
static std::size_t size(const T& t)
{
return !!t;
}
};
template<typename T>
struct size_trait<boost::optional<T>>
{
static std::size_t size(const boost::optional<T> & t)
{
return !!t;
}
};
template<typename T>
class container_wrapper
{
public:
container_wrapper() = default;
container_wrapper(const T t) : container_{std::move(t)}
{
}
std::size_t size() const
{
return size_trait<T>::size(container_);
}
private:
T container_;
};
/*
template<typename T>
class container_wrapper<boost::optional<T>>
{
public:
container_wrapper() = default;
container_wrapper(boost::optional<T> t) : container_{std::move(t)}
{
}
std::size_t size() const
{
return !!container_;
}
private:
boost::optional<T> container_;
};
*/
|
ea5acaba6f38f2b2c7ffea9bed5fce78a61e61d4 | b2b2340172e133e5a0e59d26258ff135e03760ef | /Fournier_one.h | 1cdfe848c40ca2cfda4ea1d932ae0e6744a34359 | [] | no_license | JediWattson/open_cl_fft | 7dbb19a54794aa364ffea456bc87bdbd036c607c | 6ccf31fb0c8bece6acd6934290b2d256f2afa70c | refs/heads/master | 2021-01-17T05:05:03.479637 | 2017-03-04T00:25:52 | 2017-03-04T00:25:52 | 83,065,980 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 143 | h | Fournier_one.h | #include "Driver_fft.h"
#ifndef FOURNIER_ONE
#define FOURNIER_ONE
class Fournier_one: public Driver_fft{
public:
void FFT_1();
};
#endif
|
0ff94c581344ac8a254314088317894d374cde9c | fcd63f3ea2b39d38c34538291d65afe0530a31f2 | /D2Hackit/Modules/filter/ItemFilter.cpp | 84092954e35a6190fb9408bd28654902e4bf4888 | [] | no_license | nooperation/d2es-stuff | 551d0de4e45c85656115515cfa597efad0d364c4 | 2d84c2c3b2ffa7cef367ffc32aae73bda4f6d03c | refs/heads/master | 2023-08-11T07:39:00.647535 | 2023-08-08T05:15:14 | 2023-08-08T05:15:14 | 28,574,701 | 17 | 10 | null | 2023-08-08T05:15:15 | 2014-12-29T00:05:03 | C++ | UTF-8 | C++ | false | false | 10,272 | cpp | ItemFilter.cpp | #include <fstream>
#include "ItemFilter.h"
#define FILTER_SETTINGS_PATH ".\\plugin\\filter.ini"
bool ItemFilter::OnItemAction(ITEM &item)
{
switch(item.iAction)
{
case ITEM_ACTION_NEW_GROUND:
case ITEM_ACTION_OLD_GROUND:
case ITEM_ACTION_DROP:
{
return OnItemFind(item);
}
break;
}
return true;
}
bool ItemFilter::LoadItems()
{
if(!LoadItemMap(".\\plugin\\filterDeny.txt", filteredItems))
{
return false;
}
if(!LoadItemMap(".\\plugin\\filterAllow.txt", allowedItems))
{
return false;
}
if(!LoadItemMap(".\\plugin\\filterUniqueWhitelist.txt", allowedItemsUnique))
{
return false;
}
if(!LoadItemMap(".\\plugin\\filterSetWhitelist.txt", allowedItemsSet))
{
return false;
}
//filterTown = GetPrivateProfileInt("Filter", "FilterTown", 1, FILTER_SETTINGS_PATH);
showUnique = GetPrivateProfileInt("WeaponArmor", "Unique", 1, FILTER_SETTINGS_PATH) == TRUE;
showRare = GetPrivateProfileInt("WeaponArmor", "Rare", 1, FILTER_SETTINGS_PATH) == TRUE;
showCraft = GetPrivateProfileInt("WeaponArmor", "Craft", 1, FILTER_SETTINGS_PATH) == TRUE;
showSet = GetPrivateProfileInt("WeaponArmor", "Set", 1, FILTER_SETTINGS_PATH) == TRUE;
showMagic = GetPrivateProfileInt("WeaponArmor", "Magic", 0, FILTER_SETTINGS_PATH) == TRUE;
showEthSoc = GetPrivateProfileInt("WeaponArmor", "EthSock", 0, FILTER_SETTINGS_PATH) == TRUE;
showEthereal = GetPrivateProfileInt("WeaponArmor", "Ethereal", 0, FILTER_SETTINGS_PATH) == TRUE;
showSocketed = GetPrivateProfileInt("WeaponArmor", "Socketed", 0, FILTER_SETTINGS_PATH) == TRUE;
showSuperior = GetPrivateProfileInt("WeaponArmor", "Superior", 0, FILTER_SETTINGS_PATH) == TRUE;
showNormal = GetPrivateProfileInt("WeaponArmor", "Normal", 0, FILTER_SETTINGS_PATH) == TRUE;
showInferior = GetPrivateProfileInt("WeaponArmor", "Inferior", 0, FILTER_SETTINGS_PATH) == TRUE;
showMagicRingAmulet = GetPrivateProfileInt("Jewellery", "MagicRingAmulet", 1, FILTER_SETTINGS_PATH) == TRUE;
showRareRingAmulet = GetPrivateProfileInt("Jewellery", "RareRingAmulet", 1, FILTER_SETTINGS_PATH) == TRUE;
showMagicCharms = GetPrivateProfileInt("Charms", "MagicCharms", 1, FILTER_SETTINGS_PATH) == TRUE;
showRareCharms = GetPrivateProfileInt("Charms", "RareCharms", 1, FILTER_SETTINGS_PATH) == TRUE;
showMagicJewels = GetPrivateProfileInt("Jewels", "MagicJewels", 1, FILTER_SETTINGS_PATH) == TRUE;
showRareJewels = GetPrivateProfileInt("Jewels", "RareJewels", 1, FILTER_SETTINGS_PATH) == TRUE;
minGoldAmount = GetPrivateProfileInt("Misc", "MinGoldAmount", 0, FILTER_SETTINGS_PATH);
hideRejuvsWhenBeltFull = GetPrivateProfileInt("Misc", "HideRejuvsWenBeltFull", 1, FILTER_SETTINGS_PATH) == TRUE;
return true;
}
bool ItemFilter::IsAllowed(char *itemCode)
{
if(allowedItems.count(itemCode) > 0)
return true;
return false;
}
bool ItemFilter::IsFiltered(char *itemCode)
{
if(filteredItems.count(itemCode) > 0)
return true;
return false;
}
bool ItemFilter::OnItemFind(ITEM &item)
{
//if(!filterTown && me->IsInTown())
// return true;
if(IsAllowed(item.szItemCode))
return true;
if(item.iQuality == ITEM_LEVEL_UNIQUE && allowedItemsUnique.find(item.szItemCode) != allowedItemsUnique.end())
return true;
if(item.iQuality == ITEM_LEVEL_SET && allowedItemsSet.find(item.szItemCode) != allowedItemsSet.end())
return true;
if(IsFiltered(item.szItemCode))
return false;
if (hideRejuvsWhenBeltFull && (strcmp(item.szItemCode, "rvs") == 0 || strcmp(item.szItemCode, "rvl") == 0))
{
//If any column is fully empty, show it
for (int col = 0; col < 4; col++)
{
for (int row = 0; row < me->GetBeltRows(); row++)
{
if (me->GetBeltItem(row, col)->dwItemID != 0)
{
break;
}
if (row == me->GetBeltRows() - 1)
{
return true;
}
}
}
//If any columns start with a rejuv, and have empty slots, show it
for (int col = 0; col < 4; col++)
{
if (strcmp(me->GetBeltItem(0, col)->szItemCode, "rvs") == 0 || strcmp(me->GetBeltItem(0, col)->szItemCode, "rvl") == 0)
{
for (int row = 0; row < me->GetBeltRows(); row++)
{
if (me->GetBeltItem(row, col)->dwItemID == 0)
{
return true;
}
}
}
}
return false;
}
if (strcmp(item.szItemCode, "gld") == 0) {
return item.dwGoldAmount >= minGoldAmount;
}
if(IsGoodItemCode(item.szItemCode))
return true;
if(IsRingAmulet(item.szItemCode))
{
if(item.iSocketed)
return true;
if(!showMagicRingAmulet && item.iQuality == ITEM_LEVEL_MAGIC)
return false;
if(!showRareRingAmulet && item.iQuality == ITEM_LEVEL_RARE)
return false;
return true;
}
if(IsCharm(item.szItemCode))
{
if(item.iSocketed)
return true;
if(!showMagicCharms && item.iQuality == ITEM_LEVEL_MAGIC)
return false;
if(!showRareCharms && item.iQuality == ITEM_LEVEL_RARE)
return false;
return true;
}
if (IsJewel(item.szItemCode))
{
if (!showMagicJewels && item.iQuality == ITEM_LEVEL_MAGIC)
return false;
if (!showRareJewels && item.iQuality == ITEM_LEVEL_RARE)
return false;
return true;
}
if(server->IsWeapon(item.szItemCode) || server->IsArmor(item.szItemCode))
{
if(showEthereal && item.iEthereal)
return true;
if(showSocketed && item.iSocketed)
return true;
if(showEthSoc && item.iEthereal && item.iSocketed)
return true;
if(!showUnique && item.iQuality == ITEM_LEVEL_UNIQUE)
return false;
if(!showRare && item.iQuality == ITEM_LEVEL_RARE)
return false;
if(!showCraft && item.iQuality == ITEM_LEVEL_CRAFT)
return false;
if(!showSet && item.iQuality == ITEM_LEVEL_SET)
return false;
if(!showMagic && item.iQuality == ITEM_LEVEL_MAGIC)
return false;
if(!showSuperior && item.iQuality == ITEM_LEVEL_SUPERIOR)
return false;
if(!showInferior && item.iQuality == ITEM_LEVEL_INFERIOR)
return false;
if(!showNormal && item.iQuality == ITEM_LEVEL_NORMAL)
return false;
}
return true;
}
bool ItemFilter::LoadItemMap(const std::string& fileName, std::unordered_map<std::string, std::string>& itemMap)
{
std::ifstream inFile(fileName);
if (!inFile)
{
return false;
}
itemMap.clear();
std::string readBuff;
while (std::getline(inFile, readBuff))
{
if (readBuff.length() <= 4 || readBuff.at(3) != ' ')
{
continue;
}
const auto itemName = readBuff.substr(0, 3);
const auto itemDesc = readBuff.substr(4);
itemMap.insert({ itemName, itemDesc });
}
return true;
}
bool ItemFilter::IsValidItem(ITEM &item)
{
if(IsGoodItemCode(item.szItemCode))
{
return true;
}
return false;
}
bool ItemFilter::IsGoodItemCode(char *itemCode)
{
if(strlen(itemCode) < 3)
{
return false;
}
if(IsRareSpecial(itemCode) || IsRuneDecalScroll(itemCode))
{
return true;
}
if(strcmp(itemCode, "xu0") == 0 ||
strcmp(itemCode, "s51") == 0 ||
strcmp(itemCode, "s01") == 0 ||
strcmp(itemCode, "t51") == 0 ||
strcmp(itemCode, "s22") == 0 ||
strcmp(itemCode, "w56") == 0 ||
strcmp(itemCode, "w31") == 0 ||
strcmp(itemCode, "t01") == 0 ||
strcmp(itemCode, "kv0") == 0 ||
strcmp(itemCode, "ko0") == 0 ||
strcmp(itemCode, "leg") == 0)
{
return true;
}
return false;
}
bool ItemFilter::IsCharm(char *itemCode)
{
if(itemCode[0] == 'c' && (itemCode[1] == 'x' || itemCode[1] == 'm') && isdigit(itemCode[2]))
{
return true;
}
if((itemCode[0] == 'm' || itemCode[0] == 'n') && itemCode[1] == 'c' && isdigit(itemCode[2]))
{
// Charms and such
return true;
}
return false;
}
bool ItemFilter::IsJewel(char* itemCode)
{
if (strcmp(itemCode, "jew") == 0)
{
return true;
}
return false;
}
bool ItemFilter::IsRareSpecial(char *itemCode)
{
// Unique boss parts
if(itemCode[0] == '0' && itemCode[1] == '0')
{
if(itemCode[2] == 'g' || itemCode[2] == 't' || itemCode[2] == 'r' || itemCode[2] == 'h')
{
return true;
}
}
// D-Stone, cookbook, ancient decipherer, etc
if(itemCode[0] >= 'd' && itemCode[0] < 'z' && itemCode[0] == itemCode[1] && itemCode[1] == itemCode[2])
{
return true;
}
// Fake note, Maple leaf, Forging hammer, Holy symbol, socket donut
if(strcmp(itemCode, "fkn") == 0 ||
strcmp(itemCode, "map") == 0 ||
strcmp(itemCode, "hh2") == 0 ||
strcmp(itemCode, "hly") == 0 ||
strcmp(itemCode, "sdo") == 0)
{
return true;
}
// special potions
if(itemCode[0] == 'p' && itemCode[1] == 'o' && isdigit(itemCode[2]))
{
return true;
}
// Aura Stones, unique stones
if(itemCode[0] == 'a' && itemCode[1] == 'n' && (itemCode[2] >= '0' && itemCode[2] <= '9'))
{
return true;
}
if(strcmp(itemCode, "sbs") == 0 ||
strcmp(itemCode, "srj") == 0 ||
strcmp(itemCode, "sbk") == 0 ||
strcmp(itemCode, "toa") == 0 ||
strcmp(itemCode, "zz0") == 0)
{
return true;
}
return false;
}
bool ItemFilter::IsRuneDecalScroll(char *itemCode)
{
// Runes
if(itemCode[0] == 'r' && (itemCode[1] >= '0' && itemCode[1] <= '9'))
{
return true;
}
// Decals, unidentified ancient scrolls
if(isdigit(itemCode[0]) && isdigit(itemCode[1]) && (itemCode[2] == 'b' || itemCode[2] == 'l' ))
{
return true;
}
return false;
}
bool ItemFilter::IsRingAmulet(char *itemCode)
{
if(strcmp(itemCode, "amu") == 0 ||
strcmp(itemCode, "rin") == 0 ||
strcmp(itemCode, "zrn") == 0 ||
strcmp(itemCode, "srn") == 0 ||
strcmp(itemCode, "nrn") == 0 ||
strcmp(itemCode, "prn") == 0 ||
strcmp(itemCode, "brg") == 0 ||
strcmp(itemCode, "drn") == 0 ||
strcmp(itemCode, "arn") == 0 ||
strcmp(itemCode, "zam") == 0 ||
strcmp(itemCode, "sam") == 0 ||
strcmp(itemCode, "nam") == 0 ||
strcmp(itemCode, "pam") == 0 ||
strcmp(itemCode, "bam") == 0 ||
strcmp(itemCode, "dam") == 0 ||
strcmp(itemCode, "aam") == 0)
{
return true;
}
return false;
}
bool ItemFilter::IsMonsterPart(char *itemCode)
{
if(strcmp(itemCode, "hrt") == 0 ||
strcmp(itemCode, "brz") == 0 ||
strcmp(itemCode, "jaw") == 0 ||
strcmp(itemCode, "eyz") == 0 ||
strcmp(itemCode, "hrn") == 0 ||
strcmp(itemCode, "tal") == 0 ||
strcmp(itemCode, "flg") == 0 ||
strcmp(itemCode, "fng") == 0 ||
strcmp(itemCode, "qll") == 0 ||
strcmp(itemCode, "sol") == 0 ||
strcmp(itemCode, "scz") == 0 ||
strcmp(itemCode, "ear") == 0 ||
strcmp(itemCode, "spe") == 0)
{
return true;
}
return false;
}
|
7907230b7e84cd6780ace29d0b253b2a6c0457be | b47810042bae260494a798b3da3f92009130ef44 | /程序设计与算法/1 计算导论与C语言基础/homework/39.cpp | 15a83f7ec26ecd5f3b334169092beb8b215f4191 | [] | no_license | GurayKilinc/Coursera | aa64799f033ecb3b1d70edec1b48d7b61c57bdd7 | affc8a7b7399703fc17310e8a250bab5a078ad79 | refs/heads/master | 2020-05-09T17:17:53.290456 | 2018-01-25T23:40:51 | 2018-01-25T23:40:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 575 | cpp | 39.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main() {
char str[11] = {'\0'}, substr[4], out[14], max = 0;
int n = 0;
cin >> str >> substr;
for (int i=0; i<10; i++) {
if (max < str[i]) {
max = str[i];
n = i;
}
}
for (int i=0; i<n+1; i++) {
out[i] = str[i];
}
for (int i=n+1; i<n+4; i++) {
out[i] = substr[i-n-1];
}
for (int i=n+4; i<13; i++) {
out[i] = str[i-3];
}
out[13] = '\0';
cout << out << endl;
return 0;
}
|
2df45c651ec912a369a454e69122e3b42b353852 | cfeac52f970e8901871bd02d9acb7de66b9fb6b4 | /generated/src/aws-cpp-sdk-sso-admin/include/aws/sso-admin/model/UpdatePermissionSetRequest.h | e8a5c681c7e902ac37a6bede969670ecdb5758f0 | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | aws/aws-sdk-cpp | aff116ddf9ca2b41e45c47dba1c2b7754935c585 | 9a7606a6c98e13c759032c2e920c7c64a6a35264 | refs/heads/main | 2023-08-25T11:16:55.982089 | 2023-08-24T18:14:53 | 2023-08-24T18:14:53 | 35,440,404 | 1,681 | 1,133 | Apache-2.0 | 2023-09-12T15:59:33 | 2015-05-11T17:57:32 | null | UTF-8 | C++ | false | false | 11,960 | h | UpdatePermissionSetRequest.h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/sso-admin/SSOAdmin_EXPORTS.h>
#include <aws/sso-admin/SSOAdminRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace SSOAdmin
{
namespace Model
{
/**
*/
class UpdatePermissionSetRequest : public SSOAdminRequest
{
public:
AWS_SSOADMIN_API UpdatePermissionSetRequest();
// 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 "UpdatePermissionSet"; }
AWS_SSOADMIN_API Aws::String SerializePayload() const override;
AWS_SSOADMIN_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline const Aws::String& GetInstanceArn() const{ return m_instanceArn; }
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline bool InstanceArnHasBeenSet() const { return m_instanceArnHasBeenSet; }
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline void SetInstanceArn(const Aws::String& value) { m_instanceArnHasBeenSet = true; m_instanceArn = value; }
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline void SetInstanceArn(Aws::String&& value) { m_instanceArnHasBeenSet = true; m_instanceArn = std::move(value); }
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline void SetInstanceArn(const char* value) { m_instanceArnHasBeenSet = true; m_instanceArn.assign(value); }
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline UpdatePermissionSetRequest& WithInstanceArn(const Aws::String& value) { SetInstanceArn(value); return *this;}
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline UpdatePermissionSetRequest& WithInstanceArn(Aws::String&& value) { SetInstanceArn(std::move(value)); return *this;}
/**
* <p>The ARN of the IAM Identity Center instance under which the operation will be
* executed. For more information about ARNs, see <a
* href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names
* (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
*/
inline UpdatePermissionSetRequest& WithInstanceArn(const char* value) { SetInstanceArn(value); return *this;}
/**
* <p>The ARN of the permission set.</p>
*/
inline const Aws::String& GetPermissionSetArn() const{ return m_permissionSetArn; }
/**
* <p>The ARN of the permission set.</p>
*/
inline bool PermissionSetArnHasBeenSet() const { return m_permissionSetArnHasBeenSet; }
/**
* <p>The ARN of the permission set.</p>
*/
inline void SetPermissionSetArn(const Aws::String& value) { m_permissionSetArnHasBeenSet = true; m_permissionSetArn = value; }
/**
* <p>The ARN of the permission set.</p>
*/
inline void SetPermissionSetArn(Aws::String&& value) { m_permissionSetArnHasBeenSet = true; m_permissionSetArn = std::move(value); }
/**
* <p>The ARN of the permission set.</p>
*/
inline void SetPermissionSetArn(const char* value) { m_permissionSetArnHasBeenSet = true; m_permissionSetArn.assign(value); }
/**
* <p>The ARN of the permission set.</p>
*/
inline UpdatePermissionSetRequest& WithPermissionSetArn(const Aws::String& value) { SetPermissionSetArn(value); return *this;}
/**
* <p>The ARN of the permission set.</p>
*/
inline UpdatePermissionSetRequest& WithPermissionSetArn(Aws::String&& value) { SetPermissionSetArn(std::move(value)); return *this;}
/**
* <p>The ARN of the permission set.</p>
*/
inline UpdatePermissionSetRequest& WithPermissionSetArn(const char* value) { SetPermissionSetArn(value); return *this;}
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline const Aws::String& GetDescription() const{ return m_description; }
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; }
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); }
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline UpdatePermissionSetRequest& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline UpdatePermissionSetRequest& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;}
/**
* <p>The description of the <a>PermissionSet</a>.</p>
*/
inline UpdatePermissionSetRequest& WithDescription(const char* value) { SetDescription(value); return *this;}
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline const Aws::String& GetSessionDuration() const{ return m_sessionDuration; }
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline bool SessionDurationHasBeenSet() const { return m_sessionDurationHasBeenSet; }
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline void SetSessionDuration(const Aws::String& value) { m_sessionDurationHasBeenSet = true; m_sessionDuration = value; }
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline void SetSessionDuration(Aws::String&& value) { m_sessionDurationHasBeenSet = true; m_sessionDuration = std::move(value); }
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline void SetSessionDuration(const char* value) { m_sessionDurationHasBeenSet = true; m_sessionDuration.assign(value); }
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline UpdatePermissionSetRequest& WithSessionDuration(const Aws::String& value) { SetSessionDuration(value); return *this;}
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline UpdatePermissionSetRequest& WithSessionDuration(Aws::String&& value) { SetSessionDuration(std::move(value)); return *this;}
/**
* <p>The length of time that the application user sessions are valid for in the
* ISO-8601 standard.</p>
*/
inline UpdatePermissionSetRequest& WithSessionDuration(const char* value) { SetSessionDuration(value); return *this;}
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline const Aws::String& GetRelayState() const{ return m_relayState; }
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline bool RelayStateHasBeenSet() const { return m_relayStateHasBeenSet; }
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline void SetRelayState(const Aws::String& value) { m_relayStateHasBeenSet = true; m_relayState = value; }
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline void SetRelayState(Aws::String&& value) { m_relayStateHasBeenSet = true; m_relayState = std::move(value); }
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline void SetRelayState(const char* value) { m_relayStateHasBeenSet = true; m_relayState.assign(value); }
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline UpdatePermissionSetRequest& WithRelayState(const Aws::String& value) { SetRelayState(value); return *this;}
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline UpdatePermissionSetRequest& WithRelayState(Aws::String&& value) { SetRelayState(std::move(value)); return *this;}
/**
* <p>Used to redirect users within the application during the federation
* authentication process.</p>
*/
inline UpdatePermissionSetRequest& WithRelayState(const char* value) { SetRelayState(value); return *this;}
private:
Aws::String m_instanceArn;
bool m_instanceArnHasBeenSet = false;
Aws::String m_permissionSetArn;
bool m_permissionSetArnHasBeenSet = false;
Aws::String m_description;
bool m_descriptionHasBeenSet = false;
Aws::String m_sessionDuration;
bool m_sessionDurationHasBeenSet = false;
Aws::String m_relayState;
bool m_relayStateHasBeenSet = false;
};
} // namespace Model
} // namespace SSOAdmin
} // namespace Aws
|
d348856d4f26a5fc9bba8cc2862b2dd30a9b9921 | 2f6bb7058eb0f8cddd8bee614a98234c4eb86294 | /src/offboard_pkg/src/offboard_node.cpp | 312f7a9b42acf5675844b04c380b3fbff76c9d6c | [] | no_license | Screw888/workspace | 6f97334aed801d5980dfa1eca1c6dd8cdccd1def | 375760070433a542f1b2d8399e9992c536a6c40e | refs/heads/master | 2020-09-26T18:05:24.991009 | 2019-12-06T09:05:58 | 2019-12-06T09:05:58 | 226,309,215 | 2 | 0 | null | 2019-12-06T10:57:29 | 2019-12-06T10:57:28 | null | UTF-8 | C++ | false | false | 4,148 | cpp | offboard_node.cpp | /**
* @file offb_node.cpp
* @brief Offboard control example node, written with MAVROS version 0.19.x, PX4 Pro Flight
* Stack and tested in Gazebo SITL
*/
#include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
//#include <offboard_node.h>
//function:消息接受函数
//接受消息主要是当前飞机状态
mavros_msgs::State current_state;
void state_cb(const mavros_msgs::State::ConstPtr& msg){
current_state = *msg;
}
//这个消息主要接收的是飞机的实时状态数据
geometry_msgs::PoseStamped current_local_pos;
void local_pos_cb(const geometry_msgs::PoseStamped::ConstPtr& msg){
current_local_pos = *msg;
}
//设置一个函数主要目的:检测飞机目标点和实际点的距离 返回值是一个bool型,因此可以直接通过if语句调用
bool pos_reached(geometry_msgs::PoseStamped current_pos, geometry_msgs::PoseStamped target_pos){
float err_px = current_pos.pose.position.x - target_pos.pose.position.x;
float err_py = current_pos.pose.position.y - target_pos.pose.position.y;
float err_pz = current_pos.pose.position.z - target_pos.pose.position.z;
ROS_INFO("pose.z = %.2f", sqrt(err_px * err_px + err_py * err_py + err_pz * err_pz));
return sqrt(err_px * err_px + err_py * err_py + err_pz * err_pz) < 0.08f;
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "offb_node");
ros::NodeHandle nh;
ros::Subscriber state_sub = nh.subscribe<mavros_msgs::State>
("mavros/state", 10, state_cb);
ros::Subscriber local_position_sub = nh.subscribe<geometry_msgs::PoseStamped>
("mavros/local_position/pose", 10, local_pos_cb);
ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped>
("mavros/setpoint_position/local", 10);
ros::ServiceClient arming_client = nh.serviceClient<mavros_msgs::CommandBool>
("mavros/cmd/arming");
ros::ServiceClient set_mode_client = nh.serviceClient<mavros_msgs::SetMode>
("mavros/set_mode");
//the setpoint publishing rate MUST be faster than 2Hz
ros::Rate rate(20.0);
// wait for FCU connection
while(ros::ok() && !current_state.connected){
ros::spinOnce();
rate.sleep();
}
geometry_msgs::PoseStamped pose;
pose.pose.position.x = 4;
pose.pose.position.y = 4;
pose.pose.position.z = 5;
//send a few setpoints before starting
for(int i = 100; ros::ok() && i > 0; --i){
local_pos_pub.publish(pose);
ros::spinOnce();
rate.sleep();
}
mavros_msgs::SetMode offb_set_mode;
offb_set_mode.request.custom_mode = "OFFBOARD";
mavros_msgs::CommandBool arm_cmd;
arm_cmd.request.value = true;
ros::Time last_request = ros::Time::now();
while(ros::ok()){
if( current_state.mode != "OFFBOARD" &&
(ros::Time::now() - last_request > ros::Duration(5.0))){
if( set_mode_client.call(offb_set_mode) &&
offb_set_mode.response.mode_sent){
ROS_INFO("Offboard enabled");
}
last_request = ros::Time::now();
} else {
if( !current_state.armed &&
(ros::Time::now() - last_request > ros::Duration(5.0))){
if( arming_client.call(arm_cmd) &&
arm_cmd.response.success){
ROS_INFO("Vehicle armed");
}
last_request = ros::Time::now();
}
}
local_pos_pub.publish(pose);
ros::spinOnce();
rate.sleep();
//if( (ros::Time::now() - last_request > ros::Duration(30.0))) break;
//如果你想要多个点可以在这个if下面重新设点
if(pos_reached(current_local_pos,pose)) break;
}
offb_set_mode.request.custom_mode = "AUTO.LAND";
if( set_mode_client.call(offb_set_mode) && offb_set_mode.response.mode_sent)
{
ROS_INFO("AUTO.LAND enabled");
last_request = ros::Time::now();
}
return 0;
}
|
e04e0312d2c6408d3e7e091632469bc529e2aac2 | d12bc94c947bad3e490755189e70f76a619167c3 | /texture_mapping/HW9_Code_Part1/assignment9_part1.cpp | 89a63867eb16f31fb97fb072840aab9e24530d78 | [] | no_license | ShardulVinchurkar/interactive_computer_graphics | 1dcbc66162b7f237fefaa811a668549b9d108d94 | f5c098d8bb8ff1e12baf0d956c051c4d056ab5a5 | refs/heads/master | 2020-03-15T02:20:42.422304 | 2018-05-02T23:33:36 | 2018-05-02T23:33:36 | 131,915,452 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,666 | cpp | assignment9_part1.cpp | #define GLEW_STATIC
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include "Angel.h"
#include <math.h>
#include <sstream>
using namespace std;
void
bufferGenerator(struct vec4 polygonPoints[],int polyPoints_size, struct vec4 colorPonts[],int colorPoints_size,
struct mat4 viewing_object , struct mat4 projection_type , int u_v_size , struct vec2 u_v_point[]);
int fact_func(int number);
double Basis_func(int i,double u, int degree);
void generate_bezier_vertices();
void fill_face_values();
GLuint program;
void create_object ();
vector<vec4> colors , points , control_points , copy_control_points;
vector<vec3> normals;
mat4 transformed_matrix, scaling_matrix, translating_matrix;
float theta[3] = {0.0 , 0.0 , 0.0} , scale_by = 1.0 , translate_by;
float theta_delta = 1 , scale_delta = 0.1 , translate_delta = 0.1;
vector<vec4> vertices , faces;
vector<vec2> u_v , point_2d;
vec4 location_eye = vec4(0.0 , 0.0 , 3.0 , 0.0) , at_model = vec4(0.0 , 0.0 , 0.0 , 0.0) , up_axis = vec4(0.0 , 1.0 , 0.0 , 0.0);
vec4 normalized_value;
vec3 vector1 , centroid_value;
mat4 projection_type , viewing_object;
float minX , minY , minZ , maxX , maxY , maxZ;
float min_values[3] , max_values[3];
void find_min(); void find_max();
float range_value , get_max_value , get_min_value;
void get_range();
float eye_x , eye_y , eye_z, light_x , light_y , light_z , light1_x , light1_y , light1_z;
float angle = 90 , height = 0.0 , radius = 3.0, theta_light = 90, light_height = 0.0, light_radius = 1.5;
float angle_delta = 1 , height_delta = 0.5 , radius_delta = 0.1 , theta_light_delta = 3;
int projection_flag = 2;
int shader_flag = 1;
int num_u=12;
int num_v=12;
vector<vec4> points_colors , axes_lines , axes_colors;
int point_number = 0;
vec4 material_diffuse = vec4(0.5, 0.5, 1.0 , 1.0);
vec4 material_ambience = vec4(0.5, 0.5, 0.5 , 1.0);
vec4 material_specular = vec4(1.0, 1.0, 1.0 , 1.0);
vec4 light1_diffuse = vec4(0.8 , 0.8 , 0.8 , 1.0);
vec4 light1_ambience = vec4(0.0, 0.0, 0.0 , 1.0);
vec4 light1_specular = vec4(1.0, 1.0, 1.0 , 1.0);
vec4 light1_pos = vec4(0.0 , 0.0 , 2.0 , 1.0);
vec4 light_diffuse = vec4(0.8 , 0.8 , 0.8 , 1.0);
vec4 light_ambience = vec4(0.0, 0.0, 0.0 , 1.0);
vec4 light_specular = vec4(0.0, 0.0, 0.0 , 1.0);
vec4 light0_pos = vec4(0.0 , 0.0 , 3.0 , 0.0);
vec4 specular0 = vec4(1.0, 1.0, 1.0 , 1.0);
GLfloat shine = 100.0;
vec4 diffuse1 = light_diffuse * material_diffuse;
vec4 ambient1 = light_ambience * material_ambience;
vec4 specular1 = vec4(1.0, 1.0, 1.0 , 1.0);
GLubyte image[500][500][3];
void generate_texture() {
//GLubyte image[500][500][3];
// Create a 64 x 64 checkerboard pattern
for ( int i = 0; i < 500; i++ ) {
for ( int j = 0; j < 500; j++ ) {
GLubyte c = (((i & 0x8) == 0) ^ ((j & 0x8) == 0)) * 255;
image[i][j][0] = c;
image[i][j][1] = c;
image[i][j][2] = c;
}
}
}
void quad( int a, int b, int c )
{
points.push_back(vertices[a]);
points.push_back(vertices[b]);
points.push_back(vertices[c]);
point_2d.push_back(u_v[a]);
point_2d.push_back(u_v[b]);
point_2d.push_back(u_v[c]);
vec3 get_n = normalize(cross((vertices[b] - vertices[a]),(vertices[c] - vertices[a])));
normals[a] += get_n;
normals[b] += get_n;
normals[c] += get_n;
}
void construct_cube () {
for(int i=0 ; i<faces.size() ; i++) {
quad( (int)(faces[i].x) , (int)(faces[i].y), (int)(faces[i].z) );
}
vec4 normal_data;
for(int i=0 ; i<faces.size() ; i++) {
normal_data = normalize(normals[(int)(faces[i].x)]);
normal_data.w = 0.0;
colors.push_back(normal_data);
vec4 temporay_var = normals[(int)(faces[i].x)];
normal_data = normalize(normals[(int)(faces[i].y)]);
normal_data.w = 0.0;
colors.push_back(normal_data);
normal_data = normalize(normals[(int)(faces[i].z)]);
normal_data.w = 0.0;
colors.push_back(normal_data);
}
}
void
display()
{
glClearColor(0.0 , 0.0 , 0.0 , 0.0);
glClear( GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT ); // clear the window
eye_x = radius * cos(angle*M_PI/180.0);
eye_y = height;
eye_z = radius * sin(angle*M_PI/180.0);
location_eye = vec4(eye_x , eye_y , eye_z , 1.0);
viewing_object = LookAt(location_eye , at_model , up_axis);
light_x = light_radius * cos(theta_light*M_PI/180.0);
light_y = light_height;
light_z = light_radius * sin(theta_light*M_PI/180.0);
light0_pos = vec4(eye_x , eye_y , eye_z , 1.0);
light1_pos = vec4(light_x , light_y , light_z , 1.0);
if(projection_flag == 1)
projection_type = Perspective(82.0 , 1.0 , 0.1 , 15);
else if(projection_flag == 2)
projection_type = Ortho(-1.0 , 1.0 , -1.0 , 1.0 , 0.01 , 10.0);
vec4 colors_vec_value[colors.size()];
vec4 points_vec_value[points.size()];
vec2 two_dimensional_points[point_2d.size()];
copy(points.begin(),points.end(),points_vec_value);
copy(colors.begin(),colors.end(),colors_vec_value);
copy(point_2d.begin(),point_2d.end(),two_dimensional_points);
bufferGenerator(points_vec_value , sizeof(points_vec_value) , colors_vec_value , sizeof(colors_vec_value),
viewing_object , projection_type , sizeof(two_dimensional_points) , two_dimensional_points);
GLint uniform_color_flag = glGetUniformLocation(program, "color_flag");
glUniform1i(uniform_color_flag , 0);
glDrawArrays( GL_TRIANGLES, 0, points.size()-control_points.size()-6 );
// uniform_color_flag = glGetUniformLocation(program, "color_flag");
// glUniform1i(uniform_color_flag , 1);
// glDrawArrays(GL_POINTS , points.size()-control_points.size()-6 , points.size()-6);
//
// uniform_color_flag = glGetUniformLocation(program, "color_flag");
// glUniform1i(uniform_color_flag , 1);
// glDrawArrays(GL_LINES , points.size()-6 , points.size());
glutSwapBuffers();
}
void create_texture_object() {
GLuint textures[1];
glGenTextures( 1, textures );
glBindTexture( GL_TEXTURE_2D, textures[0] );
glTexImage2D( GL_TEXTURE_2D , 0 , GL_RGB , 500 , 500 , 0 , GL_RGB , GL_UNSIGNED_BYTE , image );
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_MAG_FILTER , GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST );
glActiveTexture( GL_TEXTURE0 );
}
void
init( void )
{
for(int i = 0 ; i < 16 ; i++) {
if(i == 0)
points_colors.push_back(vec4(1.0 , 0.0 , 0.0 , 1.0));
else
points_colors.push_back(vec4(1.0 , 1.0 , 1.0 , 1.0));
}
axes_lines.push_back(vec4(0.0 , 0.0 , 0.0 , 1.0));
axes_lines.push_back(vec4(1.0 , 0.0 , 0.0 , 1.0));
axes_lines.push_back(vec4(0.0 , 0.0 , 0.0 , 1.0));
axes_lines.push_back(vec4(0.0 , 1.0 , 0.0 , 1.0));
axes_lines.push_back(vec4(0.0 , 0.0 , 0.0 , 1.0));
axes_lines.push_back(vec4(0.0 , 0.0 , 1.0 , 1.0));
axes_colors.push_back(vec4(1.0 , 0.0 , 0.0 , 1.0));
axes_colors.push_back(vec4(1.0 , 0.0 , 0.0 , 1.0));
axes_colors.push_back(vec4(0.0 , 1.0 , 0.0 , 1.0));
axes_colors.push_back(vec4(0.0 , 1.0 , 0.0 , 1.0));
axes_colors.push_back(vec4(0.0 , 0.0 , 1.0 , 1.0));
axes_colors.push_back(vec4(0.0 , 0.0 , 1.0 , 1.0));
generate_bezier_vertices();
for(int i = 0 ; i < vertices.size() ; i++)
normals.push_back(vec3(1.0 , 1.0 , 1.0));
fill_face_values();
construct_cube();
program = InitShader( "vshader21.glsl",
"fshader21.glsl" );
create_object();
generate_texture();
create_texture_object();
}
void create_object () {
find_max();
find_min();
centroid_value = vec3((minX+maxX)/2 , (minY+maxY)/2 , (minZ+maxZ)/2);
translating_matrix = Translate(vec3(-centroid_value.x , -centroid_value.y , -centroid_value.z));
get_range();
scaling_matrix = Scale(vec3((1.0/range_value) , (1.0/range_value) , (1.0/range_value)));
transformed_matrix = scaling_matrix * translating_matrix ;
for(int i=0 ; i < control_points.size() ; i++) {
points.push_back(control_points[i]);
colors.push_back(points_colors[i]);
}
for(int i = 0 ; i < 6 ; i++) {
points.push_back(axes_lines[i]);
colors.push_back(axes_colors[i]);
}
for(int i=0 ; i<points.size(); i++)
points[i] = transformed_matrix * points[i];
}
void find_min() {
minX = points[0].x;
minY = points[0].y;
minZ = points[0].z;
for(int i=1 ; i<points.size() ; i++) {
if(points[i].x < minX)
minX = points[i].x;
if(points[i].y < minY)
minY = points[i].y;
if(points[i].z < minZ)
minZ = points[i].z;
}
}
void find_max() {
maxX = points[0].x;
maxY = points[0].y;
maxZ = points[0].z;
for(int i=1 ; i<points.size() ; i++) {
if(points[i].x > maxX)
maxX = points[i].x;
if(points[i].y > maxY)
maxY = points[i].y;
if(points[i].z > maxZ)
maxZ = points[i].z;
}
}
void get_range() {
range_value = abs(maxX - minX);
if((maxY - minY) > (maxX - minX) && (maxY - minY) > (maxZ - minZ)){
range_value = abs(maxY - minY);
}
else if((maxZ - minZ) > (maxX - minX) && (maxZ - minZ) > (maxY - minY)) {
range_value = abs(maxZ - minZ);
}
}
void update_tessalation(int u_v , int inc_dec) {
if(inc_dec == 0){
if(u_v == 0) {
num_u += 1;
}
else {
num_v += 1;
}
}
else if(inc_dec == 1){
if(u_v == 0) {
num_u -= 1;
if(num_u < 2)
num_u = 2;
}
else {
num_v -= 1;
if(num_v < 2)
num_v = 2;
}
}
vertices.clear();
faces.clear();
points.clear();
colors.clear();
generate_bezier_vertices();
fill_face_values();
construct_cube();
create_object();
}
void update_controlpoints(int axis, int i_d){
if(i_d == 0){
switch(axis){
case 0: control_points[point_number].x+=0.1;break;
case 1: control_points[point_number].y+=0.1;break;
case 2: control_points[point_number].z+=0.1;break;
}
}
else{
switch(axis){
case 0: control_points[point_number].x-=0.1;break;
case 1: control_points[point_number].y-=0.1;break;
case 2: control_points[point_number].z-=0.1;break;
}
}
vertices.clear();
faces.clear();
points.clear();
colors.clear();
generate_bezier_vertices();
fill_face_values();
construct_cube();
create_object();
}
void calling_all_func () {
vertices.clear();
faces.clear();
points.clear();
colors.clear();
generate_bezier_vertices();
fill_face_values();
construct_cube();
create_object();
}
void reset() {
control_points.clear();
points_colors.clear();
num_u=12;
num_v=12;
point_number = 0;
angle = 90 , height = 0.0 , radius = 3.0, theta_light = 90, light_height = 0.0, light_radius = 1.5;
for(int i = 0 ; i < copy_control_points.size() ; i++)
control_points.push_back(copy_control_points[i]);
init();
calling_all_func();
}
void keyboard_function( unsigned char key, int x, int y )
{
switch ( key ) {
case 'q': exit( EXIT_SUCCESS ); break;
case 'x': angle += angle_delta;
if(angle > 360.0)
angle = 0.0;
break;
case 's': angle -= angle_delta;
if(angle < -360.0)
angle = 0.0;
break;
case 'y': height += height_delta;
break;
case 'h': height -= height_delta;
break;
case 'z': radius += radius_delta;
break;
case 'a': radius -= radius_delta;
if(radius < 1.0)
radius = 1.0;
break;
case 'r': angle = 90.0 ; height = 0.0 ; radius = 3.0; projection_flag = 2;
reset();
break;
case 'l': theta_light += theta_light_delta;
if(theta_light > 360.0)
theta_light = 0.0;
break;
case 'o': theta_light -= theta_light_delta;
if(theta_light < -360.0)
theta_light = 0.0;
break;
case 'k': light_height += height_delta;
break;
case 'i': light_height -= height_delta;
break;
case 'j': light_radius += radius_delta;
if(light_radius < 1.0)
light_radius = 1.0;
break;
case 'u': light_radius -= radius_delta;
if(light_radius < 1.0)
light_radius = 1.0;
break;
}
glutPostRedisplay();
}
void
bufferGenerator(struct vec4 polygonPoints[],int polyPoints_size, struct vec4 colorPonts[],int colorPoints_size,
struct mat4 viewing_object , struct mat4 projection_type , int u_v_size , struct vec2 u_v_point[]) {
GLuint buffer_name_polygon;
glGenBuffers( 1, &buffer_name_polygon );
glBindBuffer( GL_ARRAY_BUFFER, buffer_name_polygon );
glBufferData( GL_ARRAY_BUFFER, polyPoints_size, polygonPoints, GL_STATIC_DRAW );
GLuint loc = glGetAttribLocation( program, "vPosition" );
glEnableVertexAttribArray( loc );
glVertexAttribPointer( loc, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
GLuint buffer_name_color;
glGenBuffers( 1, &buffer_name_color );
glBindBuffer( GL_ARRAY_BUFFER, buffer_name_color );
glBufferData( GL_ARRAY_BUFFER, colorPoints_size, colorPonts, GL_STATIC_DRAW );
GLuint loc_color = glGetAttribLocation( program, "vColor" );
glEnableVertexAttribArray( loc_color );
glVertexAttribPointer( loc_color, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
GLuint buffer_name_u_v;
glGenBuffers( 1 , &buffer_name_u_v );
glBindBuffer( GL_ARRAY_BUFFER , buffer_name_u_v );
glBufferData( GL_ARRAY_BUFFER , u_v_size , u_v_point , GL_STATIC_DRAW );
GLuint u_v_loc = glGetAttribLocation( program, "vTexCoord" );
glEnableVertexAttribArray( u_v_loc );
glVertexAttribPointer( u_v_loc, 2, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
// GLuint vTexCoord = glGetAttribLocation( program, "vTexCoord" );
// glEnableVertexAttribArray( vTexCoord );
// glVertexAttribPointer( vTexCoord, 2, GL_FLOAT, GL_FALSE, 0,
// BUFFER_OFFSET(0) );
glUniform1i( glGetUniformLocation(program, "texture"), 0 );
GLint uniform_m_transform_vo = glGetUniformLocation(program, "viewing_object");
glUniformMatrix4fv(uniform_m_transform_vo , 1 , GL_TRUE , &viewing_object[0][0]);
GLint uniform_m_transform_pt = glGetUniformLocation(program, "projection_type");
glUniformMatrix4fv(uniform_m_transform_pt , 1 , GL_TRUE , &projection_type[0][0]);
vec4 diffuse0 = light_diffuse * material_diffuse;
vec4 ambient0 = light_ambience * material_ambience;
GLint uniform_ambient = glGetUniformLocation(program, "AmbientProduct");
glUniform4f(uniform_ambient , ambient0.x , ambient0.y , ambient0.z , ambient0.w);
GLint uniform_diffuse = glGetUniformLocation(program, "DiffuseProduct");
glUniform4f(uniform_diffuse , diffuse0.x , diffuse0.y , diffuse0.z , diffuse0.w);
GLint uniform_spec = glGetUniformLocation(program, "SpecularProduct");
glUniform4f(uniform_spec , specular0.x , specular0.y , specular0.z , specular0.w);
//light1_pos = viewing_object * light1_pos;
vec4 diffuse1 = light1_diffuse * material_diffuse;
vec4 ambient1 = light1_ambience * material_ambience;
GLint uniform_ambient1 = glGetUniformLocation(program, "AmbientProduct1");
glUniform4f(uniform_ambient1 , ambient1.x , ambient1.y , ambient1.z , ambient1.w);
GLint uniform_diffuse1 = glGetUniformLocation(program, "DiffuseProduct1");
glUniform4f(uniform_diffuse1 , diffuse1.x , diffuse1.y , diffuse1.z , diffuse1.w);
GLint uniform_spec1 = glGetUniformLocation(program, "SpecularProduct1");
glUniform4f(uniform_spec1 , specular1.x , specular1.y , specular1.z , specular1.w);
GLint uniform_shine = glGetUniformLocation(program, "Shininess");
glUniform1f(uniform_shine , shine);
vec4 light_pos = light0_pos;
//vec4 light_pos = viewing_object * light0_pos;
GLint uniform_light = glGetUniformLocation(program, "LightPosition");
glUniform4f(uniform_light , light_pos.x , light_pos.y , light_pos.z , light_pos.w);
GLint uniform_light1 = glGetUniformLocation(program, "Light1Position");
glUniform4f(uniform_light1 , light1_pos.x , light1_pos.y , light1_pos.z , light1_pos.w);
GLint uniform_eye_loc = glGetUniformLocation(program, "EyePosition");
glUniform3f(uniform_eye_loc , location_eye.x , location_eye.y , location_eye.z);
GLint uniform_shader_flag = glGetUniformLocation(program, "shader_flag");
glUniform1i(uniform_shader_flag , shader_flag);
}
void process_menu_events(int option) {
switch (option) {
case 1: projection_flag = 1;
break;
case 2: projection_flag = 2;
break;
}
glutPostRedisplay();
}
void getInput() {
control_points.push_back(vec4(0.0 , 0.0 , 0.0 , 1.0));
control_points.push_back(vec4(2.0 , 0.0 , 1.5 , 1.0));
control_points.push_back(vec4(4.0 , 0.0 , 2.9 , 1.0));
control_points.push_back(vec4(6.0 , 0.0 , 0.0 , 1.0));
control_points.push_back(vec4(0.0 , 2.0 , 1.1 , 1.0));
control_points.push_back(vec4(2.0 , 2.0 , 3.9 , 1.0));
control_points.push_back(vec4(4.0 , 2.0 , 3.1 , 1.0));
control_points.push_back(vec4(6.0 , 2.0 , 0.7 , 1.0));
control_points.push_back(vec4(0.0 , 4.0 , -0.5 , 1.0));
control_points.push_back(vec4(2.0 , 4.0 , 2.6 , 1.0));
control_points.push_back(vec4(4.0 , 4.0 , 2.4 , 1.0));
control_points.push_back(vec4(6.0 , 4.0 , 0.4 , 1.0));
control_points.push_back(vec4(0.0 , 6.0 , 0.3 , 1.0));
control_points.push_back(vec4(2.0 , 6.0 , -1.1 , 1.0));
control_points.push_back(vec4(4.0 , 6.0 , 1.3 , 1.0));
control_points.push_back(vec4(6.0 , 6.0 , -0.2 , 1.0));
}
double roundOffDecimals(string increment)
{
double roundedDecimal=0.0;
string digitsAfterDecimal=increment.substr(increment.find('.')+1);
if(digitsAfterDecimal.length()>6)
{
digitsAfterDecimal=digitsAfterDecimal.substr(0, 6);
roundedDecimal=::atof(("0."+digitsAfterDecimal).c_str());
}
else
{
roundedDecimal=::atof((increment).c_str());
}
return roundedDecimal;
}
void generate_bezier_vertices() {
int degree = 3;
int i=0 ;
double u = 0.0 , v = 0.0;
double du = 1.0/(num_u-1.0) , dv = 1.0/(num_v-1.0);
std::ostringstream stringVal;
stringVal << du;
std::string deltaU = stringVal.str();
std::ostringstream stringVal1;
stringVal1 << dv;
std::string deltaV = stringVal1.str();
du=roundOffDecimals(deltaU);
dv=roundOffDecimals(deltaV);
double sumx = 0.0 , sumy = 0.0 , sumz = 0.0;
int index = 0;
double condition_sum_v = 0.0 , condition_sum_u = 0.0;
int condition_counter_u = 0 , condition_counter_v = 0;
for(u = 0.0 ; u <= 1.0 ; u += du)//Blending Function of the curve
{
condition_counter_v = 0;
for(v = 0.0 ; v <= 1.0 ; v += dv)
{
for(i = 0 ; i <= 12 ; i += 4)
{
int k=0;
if(i<12)
k=i%3;
else if(i==12)
k=3;
for(int j = 0 ; j < 4 ; j++)
{
sumx += control_points[i+j].x * (Basis_func(k,u,degree) * Basis_func(j,v,degree));
sumy += control_points[i+j].y * (Basis_func(k,u,degree) * Basis_func(j,v,degree));
sumz += control_points[i+j].z * (Basis_func(k,u,degree) * Basis_func(j,v,degree));
}
}
sumx = round(sumx*1000000.0)/1000000.0;
sumy = round(sumy*1000000.0)/1000000.0;
sumz = round(sumz*1000000.0)/1000000.0;
vertices.push_back(vec4(sumx , sumy , sumz , 1.0));
u_v.push_back(vec2((float)u,(float)v));
sumx=0;sumy=0;sumz=0;
condition_sum_v = v+dv;
condition_counter_v++;
if(condition_sum_v > 1 && condition_counter_v == num_v-1) {
v = 1-dv;
}
}
condition_counter_u++;
condition_sum_u = u+du;
if(condition_sum_u > 1 && condition_counter_u == num_u-1) {
u = 1-du;
}
}
}
double Basis_func(int i,double u, int degree)
{
double temp = 0;
int ncr = fact_func(degree) / (fact_func(degree-i) * fact_func(i));
double term1 = pow((1-u) , (degree-i));
double term2 = pow(u, i);
temp = (ncr) * term1 * term2;
return temp;
}
int fact_func(int number)
{
if(number==0)
return 1;
else
return number * fact_func(number-1);
}
void fill_face_values() {
int increamenter = 0;
int n=(int)num_u;
int m=(int)num_v;
float faceting[num_u][num_v];
for(int i=0 ; i<num_u ; i++)
{
for(int j=0 ; j<num_v ; j++)
{
faceting[i][j] = increamenter;
increamenter++;
}
}
for(int i=0 ; i<n ; i++ )
{
for(int j=0 ; j<m ; j++)
{
if(i < n-1 && j < m-1)
{
faces.push_back(vec4(faceting[i][j] , faceting[i+1][j] , faceting[i][j+1] , 1.0));
faces.push_back(vec4(faceting[i][j+1] , faceting[i+1][j] , faceting[i+1][j+1] , 1.0));
}
}
}
}
int window_id;
int
main( int argc, char **argv )
{
printf("\n Once the program is up and running : ");
printf("\n The default value is set at Perspective Gouroud and Gold material with white light");
printf("\n To change - Right click of mouse button will show you a drop down menu containing \n Projection Type \n Shading Type \n Light Type \n Material Type");
printf("\n On selecting any one from the menu you will be able to perform the following : ");
printf("\n key press 'x' : Increases the angle of camera to rotate around the object");
printf("\n key press 's' : Decreases the angle of camera to rotate around the object");
printf("\n key press 'y' : Increases the height of the camera");
printf("\n key press 'h' : Decreases the height of the camera");
printf("\n key press 'z' : The camera goes away from the object");
printf("\n key press 'a' : The camera goes near the object");
printf("\n key press 'l' : Increases the angle of light to rotate around the object");
printf("\n key press 'o' : Decreases the angle of light to rotate around the object");
printf("\n key press 'k' : Increases the height of the light");
printf("\n key press 'i' : Decreases the height of the light");
printf("\n key press 'j' : The light goes away from the object");
printf("\n key press 'u' : The light goes near to the object");
printf("\n key press 'r' : Resets to default values");
printf("\n key press 'q' : Quits from output window\n\n");
getInput();
for(int i = 0 ; i < control_points.size() ; i++)
copy_control_points.push_back(control_points[i]);
glutInit( &argc, argv );
#ifdef __APPLE__
glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | GLUT_RGBA );
#else
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
#endif
glutInitWindowPosition(100,100);
glutInitWindowSize( 500, 500 );
window_id = glutCreateWindow( "assignment 9_Part1" );
#ifndef __APPLE__
GLenum err = glewInit();
if (GLEW_OK != err)
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
#endif
init();
glutKeyboardFunc( keyboard_function );
int window_menu , projection_menu , shading_menu , light_menu , material_menu;
projection_menu = glutCreateMenu(process_menu_events);
glutAddMenuEntry("Perspective",1);
glutAddMenuEntry("Parallel",2);
glutCreateMenu(process_menu_events);
glutAddSubMenu("Projection Type", projection_menu);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glEnable(GL_PROGRAM_POINT_SIZE);
glutMainLoop();
return 0;
}
|
bc17694dd578b829527d9d1e502c31ae7d48fc0f | d4c6151c86413dfd0881706a08aff5953a4aa28b | /zircon/system/fidl/fuchsia-hardware-display/gen/llcpp/include/fuchsia/hardware/display/llcpp/fidl.h | ecba2255c4dd13f369509aec2d446177a5b11ba3 | [
"BSD-3-Clause",
"MIT"
] | permissive | opensource-assist/fuschia | 64e0494fe0c299cf19a500925e115a75d6347a10 | 66646c55b3d0b36aae90a4b6706b87f1a6261935 | refs/heads/master | 2022-11-02T02:11:41.392221 | 2019-12-27T00:43:47 | 2019-12-27T00:43:47 | 230,425,920 | 0 | 1 | BSD-3-Clause | 2022-10-03T10:28:51 | 2019-12-27T10:43:28 | C++ | UTF-8 | C++ | false | false | 230,955 | h | fidl.h | // WARNING: This file is machine generated by fidlgen.
#pragma once
#include <lib/fidl/internal.h>
#include <lib/fidl/txn_header.h>
#include <lib/fidl/llcpp/array.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/service_handler_interface.h>
#include <lib/fidl/llcpp/string_view.h>
#include <lib/fidl/llcpp/sync_call.h>
#include <lib/fidl/llcpp/traits.h>
#include <lib/fidl/llcpp/transaction.h>
#include <lib/fidl/llcpp/vector_view.h>
#include <lib/fit/function.h>
#include <lib/zx/channel.h>
#include <lib/zx/event.h>
#include <lib/zx/vmo.h>
#include <zircon/fidl.h>
#include <fuchsia/sysmem/llcpp/fidl.h>
namespace llcpp {
namespace fuchsia {
namespace hardware {
namespace display {
struct ImageConfig;
enum class VirtconMode : uint8_t {
INACTIVE = 0u,
FALLBACK = 1u,
FORCED = 2u,
};
enum class Transform : uint8_t {
IDENTITY = 0u,
REFLECT_X = 1u,
REFLECT_Y = 2u,
ROT_90 = 3u,
ROT_180 = 4u,
ROT_270 = 5u,
ROT_90_REFLECT_X = 6u,
ROT_90_REFLECT_Y = 7u,
};
class Provider;
struct Mode;
struct Frame;
struct CursorInfo;
struct Info;
struct Controller_StartCapture_Response;
struct Controller_StartCapture_Result;
struct Controller_ReleaseCapture_Response;
struct Controller_ReleaseCapture_Result;
struct Controller_IsCaptureSupported_Response;
struct Controller_IsCaptureSupported_Result;
struct Controller_ImportImageForCapture_Response;
struct Controller_ImportImageForCapture_Result;
enum class ConfigResult : uint32_t {
OK = 0u,
INVALID_CONFIG = 1u,
UNSUPPORTED_CONFIG = 2u,
TOO_MANY_DISPLAYS = 3u,
UNSUPPORTED_DISPLAY_MODES = 4u,
};
enum class ClientCompositionOpcode : uint8_t {
CLIENT_USE_PRIMARY = 0u,
CLIENT_MERGE_BASE = 1u,
CLIENT_MERGE_SRC = 2u,
CLIENT_FRAME_SCALE = 3u,
CLIENT_SRC_FRAME = 4u,
CLIENT_TRANSFORM = 5u,
CLIENT_COLOR_CONVERSION = 6u,
CLIENT_ALPHA = 7u,
};
struct ClientCompositionOp;
enum class AlphaMode : uint8_t {
DISABLE = 0u,
PREMULTIPLIED = 1u,
HW_MULTIPLY = 2u,
};
class Controller;
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_StartCapture_ResultTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_StartCapture_ResultTable;
struct Controller_StartCapture_Result {
Controller_StartCapture_Result() : ordinal_(Ordinal::Invalid), envelope_{} {}
enum class Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; }
bool is_response() const { return ordinal_ == Ordinal::kResponse; }
static Controller_StartCapture_Result WithResponse(::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response* val) {
Controller_StartCapture_Result result;
result.set_response(val);
return result;
}
void set_response(::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response* elem) {
ordinal_ = Ordinal::kResponse;
envelope_.data = static_cast<void*>(elem);
}
::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response& mutable_response() {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response*>(envelope_.data);
}
const ::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response& response() const {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response*>(envelope_.data);
}
bool is_err() const { return ordinal_ == Ordinal::kErr; }
static Controller_StartCapture_Result WithErr(int32_t* val) {
Controller_StartCapture_Result result;
result.set_err(val);
return result;
}
void set_err(int32_t* elem) {
ordinal_ = Ordinal::kErr;
envelope_.data = static_cast<void*>(elem);
}
int32_t& mutable_err() {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
const int32_t& err() const {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_StartCapture_ResultTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_StartCapture_ResultTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 8;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
Ordinal ordinal_;
FIDL_ALIGNDECL
fidl_envelope_t envelope_;
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_ReleaseCapture_ResultTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_ReleaseCapture_ResultTable;
struct Controller_ReleaseCapture_Result {
Controller_ReleaseCapture_Result() : ordinal_(Ordinal::Invalid), envelope_{} {}
enum class Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; }
bool is_response() const { return ordinal_ == Ordinal::kResponse; }
static Controller_ReleaseCapture_Result WithResponse(::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response* val) {
Controller_ReleaseCapture_Result result;
result.set_response(val);
return result;
}
void set_response(::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response* elem) {
ordinal_ = Ordinal::kResponse;
envelope_.data = static_cast<void*>(elem);
}
::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response& mutable_response() {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response*>(envelope_.data);
}
const ::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response& response() const {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response*>(envelope_.data);
}
bool is_err() const { return ordinal_ == Ordinal::kErr; }
static Controller_ReleaseCapture_Result WithErr(int32_t* val) {
Controller_ReleaseCapture_Result result;
result.set_err(val);
return result;
}
void set_err(int32_t* elem) {
ordinal_ = Ordinal::kErr;
envelope_.data = static_cast<void*>(elem);
}
int32_t& mutable_err() {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
const int32_t& err() const {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_ReleaseCapture_ResultTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_ReleaseCapture_ResultTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 8;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
Ordinal ordinal_;
FIDL_ALIGNDECL
fidl_envelope_t envelope_;
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_IsCaptureSupported_ResultTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_IsCaptureSupported_ResultTable;
struct Controller_IsCaptureSupported_Result {
Controller_IsCaptureSupported_Result() : ordinal_(Ordinal::Invalid), envelope_{} {}
enum class Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; }
bool is_response() const { return ordinal_ == Ordinal::kResponse; }
static Controller_IsCaptureSupported_Result WithResponse(::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response* val) {
Controller_IsCaptureSupported_Result result;
result.set_response(val);
return result;
}
void set_response(::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response* elem) {
ordinal_ = Ordinal::kResponse;
envelope_.data = static_cast<void*>(elem);
}
::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response& mutable_response() {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response*>(envelope_.data);
}
const ::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response& response() const {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response*>(envelope_.data);
}
bool is_err() const { return ordinal_ == Ordinal::kErr; }
static Controller_IsCaptureSupported_Result WithErr(int32_t* val) {
Controller_IsCaptureSupported_Result result;
result.set_err(val);
return result;
}
void set_err(int32_t* elem) {
ordinal_ = Ordinal::kErr;
envelope_.data = static_cast<void*>(elem);
}
int32_t& mutable_err() {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
const int32_t& err() const {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_IsCaptureSupported_ResultTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_IsCaptureSupported_ResultTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 8;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
Ordinal ordinal_;
FIDL_ALIGNDECL
fidl_envelope_t envelope_;
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_ImportImageForCapture_ResultTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_ImportImageForCapture_ResultTable;
struct Controller_ImportImageForCapture_Result {
Controller_ImportImageForCapture_Result() : ordinal_(Ordinal::Invalid), envelope_{} {}
enum class Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; }
bool is_response() const { return ordinal_ == Ordinal::kResponse; }
static Controller_ImportImageForCapture_Result WithResponse(::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response* val) {
Controller_ImportImageForCapture_Result result;
result.set_response(val);
return result;
}
void set_response(::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response* elem) {
ordinal_ = Ordinal::kResponse;
envelope_.data = static_cast<void*>(elem);
}
::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response& mutable_response() {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response*>(envelope_.data);
}
const ::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response& response() const {
ZX_ASSERT(ordinal_ == Ordinal::kResponse);
return *static_cast<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response*>(envelope_.data);
}
bool is_err() const { return ordinal_ == Ordinal::kErr; }
static Controller_ImportImageForCapture_Result WithErr(int32_t* val) {
Controller_ImportImageForCapture_Result result;
result.set_err(val);
return result;
}
void set_err(int32_t* elem) {
ordinal_ = Ordinal::kErr;
envelope_.data = static_cast<void*>(elem);
}
int32_t& mutable_err() {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
const int32_t& err() const {
ZX_ASSERT(ordinal_ == Ordinal::kErr);
return *static_cast<int32_t*>(envelope_.data);
}
Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_ImportImageForCapture_ResultTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_ImportImageForCapture_ResultTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 8;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kResponse = 1, // 0x1
kErr = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
Ordinal ordinal_;
FIDL_ALIGNDECL
fidl_envelope_t envelope_;
};
constexpr uint32_t typeSimple = 0u;
extern "C" const fidl_type_t fuchsia_hardware_display_ImageConfigTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ImageConfigTable;
struct ImageConfig {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ImageConfigTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ImageConfigTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint32_t width = {};
uint32_t height = {};
uint32_t pixel_format = {};
uint32_t type = {};
};
constexpr uint32_t typeCapture = 10u;
constexpr int32_t modeInterlaced = 1u;
constexpr uint64_t invalidId = 0u;
constexpr uint32_t identifierMaxLen = 128u;
extern "C" const fidl_type_t fuchsia_hardware_display_ProviderOpenVirtconControllerRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ProviderOpenVirtconControllerRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ProviderOpenVirtconControllerResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ProviderOpenVirtconControllerResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ProviderOpenControllerRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ProviderOpenControllerRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ProviderOpenControllerResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ProviderOpenControllerResponseTable;
// Provider for display controllers.
//
// The driver supports two simultaneous clients - a primary client and a virtcon
// client.
class Provider final {
Provider() = delete;
public:
struct OpenVirtconControllerResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t s;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ProviderOpenVirtconControllerResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ProviderOpenVirtconControllerResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct OpenVirtconControllerRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel device;
::zx::channel controller;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ProviderOpenVirtconControllerRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ProviderOpenVirtconControllerRequestTable;
static constexpr uint32_t MaxNumHandles = 2;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = OpenVirtconControllerResponse;
};
struct OpenControllerResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t s;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ProviderOpenControllerResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ProviderOpenControllerResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct OpenControllerRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::channel device;
::zx::channel controller;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ProviderOpenControllerRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ProviderOpenControllerRequestTable;
static constexpr uint32_t MaxNumHandles = 2;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = OpenControllerResponse;
};
// Collection of return types of FIDL calls in this interface.
class ResultOf final {
ResultOf() = delete;
private:
template <typename ResponseType>
class OpenVirtconController_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
OpenVirtconController_Impl(::zx::unowned_channel _client_end, ::zx::channel device, ::zx::channel controller);
~OpenVirtconController_Impl() = default;
OpenVirtconController_Impl(OpenVirtconController_Impl&& other) = default;
OpenVirtconController_Impl& operator=(OpenVirtconController_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class OpenController_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
OpenController_Impl(::zx::unowned_channel _client_end, ::zx::channel device, ::zx::channel controller);
~OpenController_Impl() = default;
OpenController_Impl(OpenController_Impl&& other) = default;
OpenController_Impl& operator=(OpenController_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
public:
using OpenVirtconController = OpenVirtconController_Impl<OpenVirtconControllerResponse>;
using OpenController = OpenController_Impl<OpenControllerResponse>;
};
// Collection of return types of FIDL calls in this interface,
// when the caller-allocate flavor or in-place call is used.
class UnownedResultOf final {
UnownedResultOf() = delete;
private:
template <typename ResponseType>
class OpenVirtconController_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
OpenVirtconController_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
~OpenVirtconController_Impl() = default;
OpenVirtconController_Impl(OpenVirtconController_Impl&& other) = default;
OpenVirtconController_Impl& operator=(OpenVirtconController_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class OpenController_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
OpenController_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
~OpenController_Impl() = default;
OpenController_Impl(OpenController_Impl&& other) = default;
OpenController_Impl& operator=(OpenController_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
public:
using OpenVirtconController = OpenVirtconController_Impl<OpenVirtconControllerResponse>;
using OpenController = OpenController_Impl<OpenControllerResponse>;
};
class SyncClient final {
public:
explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {}
~SyncClient() = default;
SyncClient(SyncClient&&) = default;
SyncClient& operator=(SyncClient&&) = default;
const ::zx::channel& channel() const { return channel_; }
::zx::channel* mutable_channel() { return &channel_; }
// Open a virtcon client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a virtcon controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::OpenVirtconController OpenVirtconController(::zx::channel device, ::zx::channel controller);
// Open a virtcon client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a virtcon controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::OpenVirtconController OpenVirtconController(::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
// Open a primary client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a primary controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::OpenController OpenController(::zx::channel device, ::zx::channel controller);
// Open a primary client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a primary controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::OpenController OpenController(::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
private:
::zx::channel channel_;
};
// Methods to make a sync FIDL call directly on an unowned channel, avoiding setting up a client.
class Call final {
Call() = delete;
public:
// Open a virtcon client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a virtcon controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::OpenVirtconController OpenVirtconController(::zx::unowned_channel _client_end, ::zx::channel device, ::zx::channel controller);
// Open a virtcon client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a virtcon controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::OpenVirtconController OpenVirtconController(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
// Open a primary client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a primary controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::OpenController OpenController(::zx::unowned_channel _client_end, ::zx::channel device, ::zx::channel controller);
// Open a primary client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a primary controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::OpenController OpenController(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::channel device, ::zx::channel controller, ::fidl::BytePart _response_buffer);
};
// Messages are encoded and decoded in-place when these methods are used.
// Additionally, requests must be already laid-out according to the FIDL wire-format.
class InPlace final {
InPlace() = delete;
public:
// Open a virtcon client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a virtcon controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
static ::fidl::DecodeResult<OpenVirtconControllerResponse> OpenVirtconController(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<OpenVirtconControllerRequest> params, ::fidl::BytePart response_buffer);
// Open a primary client. `device` should be a handle to one endpoint of a
// channel that (on success) will become an open connection to a new
// instance of a display client device. A protocol request `controller`
// provides an interface to the Controller for the new device. Closing the
// connection to `device` will also close the `controller` interface. If
// the display device already has a primary controller then this method
// will return `ZX_ERR_ALREADY_BOUND`.
static ::fidl::DecodeResult<OpenControllerResponse> OpenController(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<OpenControllerRequest> params, ::fidl::BytePart response_buffer);
};
// Pure-virtual interface to be implemented by a server.
class Interface {
public:
Interface() = default;
virtual ~Interface() = default;
using _Outer = Provider;
using _Base = ::fidl::CompleterBase;
class OpenVirtconControllerCompleterBase : public _Base {
public:
void Reply(int32_t s);
void Reply(::fidl::BytePart _buffer, int32_t s);
void Reply(::fidl::DecodedMessage<OpenVirtconControllerResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using OpenVirtconControllerCompleter = ::fidl::Completer<OpenVirtconControllerCompleterBase>;
virtual void OpenVirtconController(::zx::channel device, ::zx::channel controller, OpenVirtconControllerCompleter::Sync _completer) = 0;
class OpenControllerCompleterBase : public _Base {
public:
void Reply(int32_t s);
void Reply(::fidl::BytePart _buffer, int32_t s);
void Reply(::fidl::DecodedMessage<OpenControllerResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using OpenControllerCompleter = ::fidl::Completer<OpenControllerCompleterBase>;
virtual void OpenController(::zx::channel device, ::zx::channel controller, OpenControllerCompleter::Sync _completer) = 0;
};
// Attempts to dispatch the incoming message to a handler function in the server implementation.
// If there is no matching handler, it returns false, leaving the message and transaction intact.
// In all other cases, it consumes the message and returns true.
// It is possible to chain multiple TryDispatch functions in this manner.
static bool TryDispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn);
// Dispatches the incoming message to one of the handlers functions in the interface.
// If there is no matching handler, it closes all the handles in |msg| and closes the channel with
// a |ZX_ERR_NOT_SUPPORTED| epitaph, before returning false. The message should then be discarded.
static bool Dispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn);
// Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used with |fidl::Bind|
// to reduce template expansion.
// Do not call this method manually. Use |Dispatch| instead.
static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, ::fidl::Transaction* txn) {
return Dispatch(static_cast<Interface*>(impl), msg, txn);
}
// Helper functions to fill in the transaction header in a |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
static void OpenVirtconControllerRequest(const ::fidl::DecodedMessage<Provider::OpenVirtconControllerRequest>& _msg);
static void OpenVirtconControllerResponse(const ::fidl::DecodedMessage<Provider::OpenVirtconControllerResponse>& _msg);
static void OpenControllerRequest(const ::fidl::DecodedMessage<Provider::OpenControllerRequest>& _msg);
static void OpenControllerResponse(const ::fidl::DecodedMessage<Provider::OpenControllerResponse>& _msg);
};
};
extern "C" const fidl_type_t fuchsia_hardware_display_ModeTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ModeTable;
struct Mode {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ModeTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ModeTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint32_t horizontal_resolution = {};
uint32_t vertical_resolution = {};
uint32_t refresh_rate_e2 = {};
uint32_t flags = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_FrameTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_FrameTable;
struct Frame {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_FrameTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_FrameTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 16;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint32_t x_pos = {};
uint32_t y_pos = {};
uint32_t width = {};
uint32_t height = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_CursorInfoTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_CursorInfoTable;
struct CursorInfo {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_CursorInfoTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_CursorInfoTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 12;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 12;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint32_t width = {};
uint32_t height = {};
uint32_t pixel_format = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_InfoTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_InfoTable;
struct Info {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_InfoTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_InfoTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 104;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 104;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
uint64_t id = {};
::fidl::VectorView<::llcpp::fuchsia::hardware::display::Mode> modes = {};
::fidl::VectorView<uint32_t> pixel_format = {};
::fidl::VectorView<::llcpp::fuchsia::hardware::display::CursorInfo> cursor_configs = {};
::fidl::StringView manufacturer_name = {};
::fidl::StringView monitor_name = {};
::fidl::StringView monitor_serial = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_StartCapture_ResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_StartCapture_ResponseTable;
struct Controller_StartCapture_Response {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_StartCapture_ResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_StartCapture_ResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint8_t __reserved = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_ReleaseCapture_ResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_ReleaseCapture_ResponseTable;
struct Controller_ReleaseCapture_Response {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_ReleaseCapture_ResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_ReleaseCapture_ResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint8_t __reserved = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_IsCaptureSupported_ResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_IsCaptureSupported_ResponseTable;
struct Controller_IsCaptureSupported_Response {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_IsCaptureSupported_ResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_IsCaptureSupported_ResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 1;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
bool supported = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_Controller_ImportImageForCapture_ResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_Controller_ImportImageForCapture_ResponseTable;
struct Controller_ImportImageForCapture_Response {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_Controller_ImportImageForCapture_ResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_Controller_ImportImageForCapture_ResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 8;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 8;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint64_t image_id = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_ClientCompositionOpTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ClientCompositionOpTable;
struct ClientCompositionOp {
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ClientCompositionOpTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ClientCompositionOpTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
[[maybe_unused]]
static constexpr uint32_t AltMaxOutOfLine = 0;
uint64_t display_id = {};
uint64_t layer_id = {};
::llcpp::fuchsia::hardware::display::ClientCompositionOpcode opcode = {};
};
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerDisplaysChangedRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerDisplaysChangedRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerDisplaysChangedEventTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerDisplaysChangedEventTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportVmoImageRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportVmoImageRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportVmoImageResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportVmoImageResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportImageRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportImageRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportImageResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportImageResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseImageRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseImageRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseImageResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseImageResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportEventRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportEventRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportEventResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportEventResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseEventRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseEventRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseEventResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseEventResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerCreateLayerRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerCreateLayerRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerCreateLayerResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerCreateLayerResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerDestroyLayerRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerDestroyLayerRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerDestroyLayerResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerDestroyLayerResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayModeRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayModeRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayModeResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayModeResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayColorConversionRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayColorConversionRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayColorConversionResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayColorConversionResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayLayersRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayLayersRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetDisplayLayersResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetDisplayLayersResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryConfigRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryConfigRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryConfigResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryConfigResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryPositionRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryPositionRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryPositionResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryPositionResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerCursorConfigRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerCursorConfigRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerCursorConfigResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerCursorConfigResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerCursorPositionRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerCursorPositionRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerCursorPositionResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerCursorPositionResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerColorConfigRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerColorConfigRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerColorConfigResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerColorConfigResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerImageRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerImageRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetLayerImageResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetLayerImageResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerCheckConfigRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerCheckConfigRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerCheckConfigResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerCheckConfigResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerApplyConfigRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerApplyConfigRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerApplyConfigResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerApplyConfigResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerEnableVsyncRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerEnableVsyncRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerEnableVsyncResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerEnableVsyncResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerVsyncRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerVsyncRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerVsyncEventTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerVsyncEventTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetVirtconModeRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetVirtconModeRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetVirtconModeResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetVirtconModeResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerClientOwnershipChangeRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerClientOwnershipChangeRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerClientOwnershipChangeEventTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerClientOwnershipChangeEventTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportBufferCollectionRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportBufferCollectionRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportBufferCollectionResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportBufferCollectionResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseBufferCollectionRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseBufferCollectionRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseBufferCollectionResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseBufferCollectionResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerGetSingleBufferFramebufferRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerGetSingleBufferFramebufferRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerGetSingleBufferFramebufferResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerGetSingleBufferFramebufferResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerIsCaptureSupportedRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerIsCaptureSupportedRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerIsCaptureSupportedResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerIsCaptureSupportedResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportImageForCaptureRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportImageForCaptureRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerImportImageForCaptureResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerImportImageForCaptureResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerStartCaptureRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerStartCaptureRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerStartCaptureResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerStartCaptureResponseTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseCaptureRequestTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseCaptureRequestTable;
extern "C" const fidl_type_t fuchsia_hardware_display_ControllerReleaseCaptureResponseTable;
extern "C" const fidl_type_t v1_fuchsia_hardware_display_ControllerReleaseCaptureResponseTable;
// Interface for accessing the display hardware.
//
// A display configuration can be separated into two parts: the layer layout and
// the layer contents. The layout includes all parts of a configuration other
// than the image handles. The active configuration is composed of the most
// recently applied layout and an active image from each layer - see
// SetLayerImage for details on how the active image is defined. Note the
// requirement that each layer has an active image. Whenever a new active
// configuration is available, it is immediately given to the hardware. This
// allows the layout and each layer's contents to advance independently when
// possible.
//
// Performing illegal actions on the interface will result in the interface
// being closed.
class Controller final {
Controller() = delete;
public:
struct DisplaysChangedResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::fidl::VectorView<::llcpp::fuchsia::hardware::display::Info> added;
::fidl::VectorView<uint64_t> removed;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerDisplaysChangedEventTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerDisplaysChangedEventTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportVmoImageResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
uint64_t image_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportVmoImageResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportVmoImageResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportVmoImageRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::ImageConfig image_config;
::zx::vmo vmo;
int32_t offset;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportVmoImageRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportVmoImageRequestTable;
static constexpr uint32_t MaxNumHandles = 1;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = ImportVmoImageResponse;
};
struct ImportImageResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
uint64_t image_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportImageResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportImageResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportImageRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::ImageConfig image_config;
uint64_t collection_id;
uint32_t index;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportImageRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportImageRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = ImportImageResponse;
};
struct ReleaseImageRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t image_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerReleaseImageRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerReleaseImageRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct ImportEventRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::zx::event event;
uint64_t id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportEventRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportEventRequestTable;
static constexpr uint32_t MaxNumHandles = 1;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct ReleaseEventRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerReleaseEventRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerReleaseEventRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct CreateLayerResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
uint64_t layer_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerCreateLayerResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerCreateLayerResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using CreateLayerRequest = ::fidl::AnyZeroArgMessage;
struct DestroyLayerRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerDestroyLayerRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerDestroyLayerRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetDisplayModeRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t display_id;
::llcpp::fuchsia::hardware::display::Mode mode;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetDisplayModeRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetDisplayModeRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetDisplayColorConversionRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t display_id;
::fidl::Array<float, 3> preoffsets;
::fidl::Array<float, 9> coefficients;
::fidl::Array<float, 3> postoffsets;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetDisplayColorConversionRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetDisplayColorConversionRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 88;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 88;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetDisplayLayersRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t display_id;
::fidl::VectorView<uint64_t> layer_ids;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetDisplayLayersRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetDisplayLayersRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerPrimaryConfigRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
::llcpp::fuchsia::hardware::display::ImageConfig image_config;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerPrimaryConfigRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerPrimaryConfigRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerPrimaryPositionRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
::llcpp::fuchsia::hardware::display::Transform transform;
::llcpp::fuchsia::hardware::display::Frame src_frame;
::llcpp::fuchsia::hardware::display::Frame dest_frame;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerPrimaryPositionRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerPrimaryPositionRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 64;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 64;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerPrimaryAlphaRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
::llcpp::fuchsia::hardware::display::AlphaMode mode;
float val;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerPrimaryAlphaRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerCursorConfigRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
::llcpp::fuchsia::hardware::display::ImageConfig image_config;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerCursorConfigRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerCursorConfigRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerCursorPositionRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
int32_t x;
int32_t y;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerCursorPositionRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerCursorPositionRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerColorConfigRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
uint32_t pixel_format;
::fidl::VectorView<uint8_t> color_bytes;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerColorConfigRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerColorConfigRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetLayerImageRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t layer_id;
uint64_t image_id;
uint64_t wait_event_id;
uint64_t signal_event_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetLayerImageRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetLayerImageRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct CheckConfigResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::ConfigResult res;
::fidl::VectorView<::llcpp::fuchsia::hardware::display::ClientCompositionOp> ops;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerCheckConfigResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerCheckConfigResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct CheckConfigRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
bool discard;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerCheckConfigRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerCheckConfigRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = CheckConfigResponse;
};
using ApplyConfigRequest = ::fidl::AnyZeroArgMessage;
struct EnableVsyncRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
bool enable;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerEnableVsyncRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerEnableVsyncRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct VsyncResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t display_id;
uint64_t timestamp;
::fidl::VectorView<uint64_t> images;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerVsyncEventTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerVsyncEventTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 4294967295;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct SetVirtconModeRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint8_t mode;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetVirtconModeRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetVirtconModeRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct ClientOwnershipChangeResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
bool has_ownership;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerClientOwnershipChangeEventTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerClientOwnershipChangeEventTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportBufferCollectionResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportBufferCollectionResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportBufferCollectionResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportBufferCollectionRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t collection_id;
::zx::channel collection_token;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportBufferCollectionRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportBufferCollectionRequestTable;
static constexpr uint32_t MaxNumHandles = 1;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = ImportBufferCollectionResponse;
};
struct ReleaseBufferCollectionRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t collection_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerReleaseBufferCollectionRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerReleaseBufferCollectionRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
};
struct SetBufferCollectionConstraintsResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct SetBufferCollectionConstraintsRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t collection_id;
::llcpp::fuchsia::hardware::display::ImageConfig config;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerSetBufferCollectionConstraintsRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 40;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = SetBufferCollectionConstraintsResponse;
};
struct GetSingleBufferFramebufferResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t res;
::zx::vmo vmo;
uint32_t stride;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerGetSingleBufferFramebufferResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerGetSingleBufferFramebufferResponseTable;
static constexpr uint32_t MaxNumHandles = 1;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using GetSingleBufferFramebufferRequest = ::fidl::AnyZeroArgMessage;
struct IsCaptureSupportedResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Result result;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerIsCaptureSupportedResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerIsCaptureSupportedResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 8;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
using IsCaptureSupportedRequest = ::fidl::AnyZeroArgMessage;
struct ImportImageForCaptureResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Result result;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportImageForCaptureResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportImageForCaptureResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 8;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ImportImageForCaptureRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::ImageConfig image_config;
uint64_t collection_id;
uint32_t index;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerImportImageForCaptureRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerImportImageForCaptureRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 48;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 48;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = ImportImageForCaptureResponse;
};
struct StartCaptureResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::Controller_StartCapture_Result result;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerStartCaptureResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerStartCaptureResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 8;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct StartCaptureRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t signal_event_id;
uint64_t image_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerStartCaptureRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerStartCaptureRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 32;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 32;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = StartCaptureResponse;
};
struct ReleaseCaptureResponse final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Result result;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerReleaseCaptureResponseTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerReleaseCaptureResponseTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 40;
static constexpr uint32_t MaxOutOfLine = 8;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 8;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = true;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kResponse;
};
struct ReleaseCaptureRequest final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint64_t image_id;
static constexpr const fidl_type_t* Type = &v1_fuchsia_hardware_display_ControllerReleaseCaptureRequestTable;
static constexpr const fidl_type_t* AltType = &fuchsia_hardware_display_ControllerReleaseCaptureRequestTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
static constexpr uint32_t AltPrimarySize = 24;
static constexpr uint32_t AltMaxOutOfLine = 0;
static constexpr bool HasFlexibleEnvelope = false;
static constexpr bool ContainsUnion = false;
static constexpr ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
using ResponseType = ReleaseCaptureResponse;
};
struct EventHandlers {
fit::callback<zx_status_t(::fidl::VectorView<::llcpp::fuchsia::hardware::display::Info> added, ::fidl::VectorView<uint64_t> removed)> displays_changed;
fit::callback<zx_status_t(uint64_t display_id, uint64_t timestamp, ::fidl::VectorView<uint64_t> images)> vsync;
fit::callback<zx_status_t(bool has_ownership)> client_ownership_change;
// Fallback handler when an unknown ordinal is received.
// Caller may put custom error handling logic here.
fit::callback<zx_status_t()> unknown;
};
// Collection of return types of FIDL calls in this interface.
class ResultOf final {
ResultOf() = delete;
private:
template <typename ResponseType>
class ImportVmoImage_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
ImportVmoImage_Impl(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset);
~ImportVmoImage_Impl() = default;
ImportVmoImage_Impl(ImportVmoImage_Impl&& other) = default;
ImportVmoImage_Impl& operator=(ImportVmoImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ImportImage_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
ImportImage_Impl(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
~ImportImage_Impl() = default;
ImportImage_Impl(ImportImage_Impl&& other) = default;
ImportImage_Impl& operator=(ImportImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ReleaseImage_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseImage_Impl(::zx::unowned_channel _client_end, uint64_t image_id);
~ReleaseImage_Impl() = default;
ReleaseImage_Impl(ReleaseImage_Impl&& other) = default;
ReleaseImage_Impl& operator=(ReleaseImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class ImportEvent_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ImportEvent_Impl(::zx::unowned_channel _client_end, ::zx::event event, uint64_t id);
~ImportEvent_Impl() = default;
ImportEvent_Impl(ImportEvent_Impl&& other) = default;
ImportEvent_Impl& operator=(ImportEvent_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class ReleaseEvent_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseEvent_Impl(::zx::unowned_channel _client_end, uint64_t id);
~ReleaseEvent_Impl() = default;
ReleaseEvent_Impl(ReleaseEvent_Impl&& other) = default;
ReleaseEvent_Impl& operator=(ReleaseEvent_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class CreateLayer_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
CreateLayer_Impl(::zx::unowned_channel _client_end);
~CreateLayer_Impl() = default;
CreateLayer_Impl(CreateLayer_Impl&& other) = default;
CreateLayer_Impl& operator=(CreateLayer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class DestroyLayer_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
DestroyLayer_Impl(::zx::unowned_channel _client_end, uint64_t layer_id);
~DestroyLayer_Impl() = default;
DestroyLayer_Impl(DestroyLayer_Impl&& other) = default;
DestroyLayer_Impl& operator=(DestroyLayer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayMode_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayMode_Impl(::zx::unowned_channel _client_end, uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
~SetDisplayMode_Impl() = default;
SetDisplayMode_Impl(SetDisplayMode_Impl&& other) = default;
SetDisplayMode_Impl& operator=(SetDisplayMode_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayColorConversion_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayColorConversion_Impl(::zx::unowned_channel _client_end, uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
~SetDisplayColorConversion_Impl() = default;
SetDisplayColorConversion_Impl(SetDisplayColorConversion_Impl&& other) = default;
SetDisplayColorConversion_Impl& operator=(SetDisplayColorConversion_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayLayers_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayLayers_Impl(::zx::unowned_channel _client_end, uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
~SetDisplayLayers_Impl() = default;
SetDisplayLayers_Impl(SetDisplayLayers_Impl&& other) = default;
SetDisplayLayers_Impl& operator=(SetDisplayLayers_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryConfig_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
~SetLayerPrimaryConfig_Impl() = default;
SetLayerPrimaryConfig_Impl(SetLayerPrimaryConfig_Impl&& other) = default;
SetLayerPrimaryConfig_Impl& operator=(SetLayerPrimaryConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryPosition_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryPosition_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
~SetLayerPrimaryPosition_Impl() = default;
SetLayerPrimaryPosition_Impl(SetLayerPrimaryPosition_Impl&& other) = default;
SetLayerPrimaryPosition_Impl& operator=(SetLayerPrimaryPosition_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryAlpha_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryAlpha_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
~SetLayerPrimaryAlpha_Impl() = default;
SetLayerPrimaryAlpha_Impl(SetLayerPrimaryAlpha_Impl&& other) = default;
SetLayerPrimaryAlpha_Impl& operator=(SetLayerPrimaryAlpha_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerCursorConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerCursorConfig_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
~SetLayerCursorConfig_Impl() = default;
SetLayerCursorConfig_Impl(SetLayerCursorConfig_Impl&& other) = default;
SetLayerCursorConfig_Impl& operator=(SetLayerCursorConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerCursorPosition_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerCursorPosition_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, int32_t x, int32_t y);
~SetLayerCursorPosition_Impl() = default;
SetLayerCursorPosition_Impl(SetLayerCursorPosition_Impl&& other) = default;
SetLayerCursorPosition_Impl& operator=(SetLayerCursorPosition_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerColorConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerColorConfig_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
~SetLayerColorConfig_Impl() = default;
SetLayerColorConfig_Impl(SetLayerColorConfig_Impl&& other) = default;
SetLayerColorConfig_Impl& operator=(SetLayerColorConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerImage_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerImage_Impl(::zx::unowned_channel _client_end, uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
~SetLayerImage_Impl() = default;
SetLayerImage_Impl(SetLayerImage_Impl&& other) = default;
SetLayerImage_Impl& operator=(SetLayerImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class CheckConfig_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
CheckConfig_Impl(::zx::unowned_channel _client_end, bool discard);
~CheckConfig_Impl() = default;
CheckConfig_Impl(CheckConfig_Impl&& other) = default;
CheckConfig_Impl& operator=(CheckConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ApplyConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ApplyConfig_Impl(::zx::unowned_channel _client_end);
~ApplyConfig_Impl() = default;
ApplyConfig_Impl(ApplyConfig_Impl&& other) = default;
ApplyConfig_Impl& operator=(ApplyConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class EnableVsync_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
EnableVsync_Impl(::zx::unowned_channel _client_end, bool enable);
~EnableVsync_Impl() = default;
EnableVsync_Impl(EnableVsync_Impl&& other) = default;
EnableVsync_Impl& operator=(EnableVsync_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetVirtconMode_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetVirtconMode_Impl(::zx::unowned_channel _client_end, uint8_t mode);
~SetVirtconMode_Impl() = default;
SetVirtconMode_Impl(SetVirtconMode_Impl&& other) = default;
SetVirtconMode_Impl& operator=(SetVirtconMode_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class ImportBufferCollection_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
ImportBufferCollection_Impl(::zx::unowned_channel _client_end, uint64_t collection_id, ::zx::channel collection_token);
~ImportBufferCollection_Impl() = default;
ImportBufferCollection_Impl(ImportBufferCollection_Impl&& other) = default;
ImportBufferCollection_Impl& operator=(ImportBufferCollection_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ReleaseBufferCollection_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseBufferCollection_Impl(::zx::unowned_channel _client_end, uint64_t collection_id);
~ReleaseBufferCollection_Impl() = default;
ReleaseBufferCollection_Impl(ReleaseBufferCollection_Impl&& other) = default;
ReleaseBufferCollection_Impl& operator=(ReleaseBufferCollection_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class SetBufferCollectionConstraints_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
SetBufferCollectionConstraints_Impl(::zx::unowned_channel _client_end, uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config);
~SetBufferCollectionConstraints_Impl() = default;
SetBufferCollectionConstraints_Impl(SetBufferCollectionConstraints_Impl&& other) = default;
SetBufferCollectionConstraints_Impl& operator=(SetBufferCollectionConstraints_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class GetSingleBufferFramebuffer_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
GetSingleBufferFramebuffer_Impl(::zx::unowned_channel _client_end);
~GetSingleBufferFramebuffer_Impl() = default;
GetSingleBufferFramebuffer_Impl(GetSingleBufferFramebuffer_Impl&& other) = default;
GetSingleBufferFramebuffer_Impl& operator=(GetSingleBufferFramebuffer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class IsCaptureSupported_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
IsCaptureSupported_Impl(::zx::unowned_channel _client_end);
~IsCaptureSupported_Impl() = default;
IsCaptureSupported_Impl(IsCaptureSupported_Impl&& other) = default;
IsCaptureSupported_Impl& operator=(IsCaptureSupported_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ImportImageForCapture_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
ImportImageForCapture_Impl(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
~ImportImageForCapture_Impl() = default;
ImportImageForCapture_Impl(ImportImageForCapture_Impl&& other) = default;
ImportImageForCapture_Impl& operator=(ImportImageForCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class StartCapture_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
StartCapture_Impl(::zx::unowned_channel _client_end, uint64_t signal_event_id, uint64_t image_id);
~StartCapture_Impl() = default;
StartCapture_Impl(StartCapture_Impl&& other) = default;
StartCapture_Impl& operator=(StartCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ReleaseCapture_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>;
public:
ReleaseCapture_Impl(::zx::unowned_channel _client_end, uint64_t image_id);
~ReleaseCapture_Impl() = default;
ReleaseCapture_Impl(ReleaseCapture_Impl&& other) = default;
ReleaseCapture_Impl& operator=(ReleaseCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
public:
using ImportVmoImage = ImportVmoImage_Impl<ImportVmoImageResponse>;
using ImportImage = ImportImage_Impl<ImportImageResponse>;
using ReleaseImage = ReleaseImage_Impl;
using ImportEvent = ImportEvent_Impl;
using ReleaseEvent = ReleaseEvent_Impl;
using CreateLayer = CreateLayer_Impl<CreateLayerResponse>;
using DestroyLayer = DestroyLayer_Impl;
using SetDisplayMode = SetDisplayMode_Impl;
using SetDisplayColorConversion = SetDisplayColorConversion_Impl;
using SetDisplayLayers = SetDisplayLayers_Impl;
using SetLayerPrimaryConfig = SetLayerPrimaryConfig_Impl;
using SetLayerPrimaryPosition = SetLayerPrimaryPosition_Impl;
using SetLayerPrimaryAlpha = SetLayerPrimaryAlpha_Impl;
using SetLayerCursorConfig = SetLayerCursorConfig_Impl;
using SetLayerCursorPosition = SetLayerCursorPosition_Impl;
using SetLayerColorConfig = SetLayerColorConfig_Impl;
using SetLayerImage = SetLayerImage_Impl;
using CheckConfig = CheckConfig_Impl<CheckConfigResponse>;
using ApplyConfig = ApplyConfig_Impl;
using EnableVsync = EnableVsync_Impl;
using SetVirtconMode = SetVirtconMode_Impl;
using ImportBufferCollection = ImportBufferCollection_Impl<ImportBufferCollectionResponse>;
using ReleaseBufferCollection = ReleaseBufferCollection_Impl;
using SetBufferCollectionConstraints = SetBufferCollectionConstraints_Impl<SetBufferCollectionConstraintsResponse>;
using GetSingleBufferFramebuffer = GetSingleBufferFramebuffer_Impl<GetSingleBufferFramebufferResponse>;
using IsCaptureSupported = IsCaptureSupported_Impl<IsCaptureSupportedResponse>;
using ImportImageForCapture = ImportImageForCapture_Impl<ImportImageForCaptureResponse>;
using StartCapture = StartCapture_Impl<StartCaptureResponse>;
using ReleaseCapture = ReleaseCapture_Impl<ReleaseCaptureResponse>;
};
// Collection of return types of FIDL calls in this interface,
// when the caller-allocate flavor or in-place call is used.
class UnownedResultOf final {
UnownedResultOf() = delete;
private:
template <typename ResponseType>
class ImportVmoImage_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
ImportVmoImage_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset, ::fidl::BytePart _response_buffer);
~ImportVmoImage_Impl() = default;
ImportVmoImage_Impl(ImportVmoImage_Impl&& other) = default;
ImportVmoImage_Impl& operator=(ImportVmoImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ImportImage_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
ImportImage_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
~ImportImage_Impl() = default;
ImportImage_Impl(ImportImage_Impl&& other) = default;
ImportImage_Impl& operator=(ImportImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ReleaseImage_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseImage_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t image_id);
~ReleaseImage_Impl() = default;
ReleaseImage_Impl(ReleaseImage_Impl&& other) = default;
ReleaseImage_Impl& operator=(ReleaseImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class ImportEvent_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ImportEvent_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::event event, uint64_t id);
~ImportEvent_Impl() = default;
ImportEvent_Impl(ImportEvent_Impl&& other) = default;
ImportEvent_Impl& operator=(ImportEvent_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class ReleaseEvent_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseEvent_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t id);
~ReleaseEvent_Impl() = default;
ReleaseEvent_Impl(ReleaseEvent_Impl&& other) = default;
ReleaseEvent_Impl& operator=(ReleaseEvent_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class CreateLayer_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
CreateLayer_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
~CreateLayer_Impl() = default;
CreateLayer_Impl(CreateLayer_Impl&& other) = default;
CreateLayer_Impl& operator=(CreateLayer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class DestroyLayer_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
DestroyLayer_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id);
~DestroyLayer_Impl() = default;
DestroyLayer_Impl(DestroyLayer_Impl&& other) = default;
DestroyLayer_Impl& operator=(DestroyLayer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayMode_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayMode_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
~SetDisplayMode_Impl() = default;
SetDisplayMode_Impl(SetDisplayMode_Impl&& other) = default;
SetDisplayMode_Impl& operator=(SetDisplayMode_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayColorConversion_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayColorConversion_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
~SetDisplayColorConversion_Impl() = default;
SetDisplayColorConversion_Impl(SetDisplayColorConversion_Impl&& other) = default;
SetDisplayColorConversion_Impl& operator=(SetDisplayColorConversion_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetDisplayLayers_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetDisplayLayers_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
~SetDisplayLayers_Impl() = default;
SetDisplayLayers_Impl(SetDisplayLayers_Impl&& other) = default;
SetDisplayLayers_Impl& operator=(SetDisplayLayers_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryConfig_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
~SetLayerPrimaryConfig_Impl() = default;
SetLayerPrimaryConfig_Impl(SetLayerPrimaryConfig_Impl&& other) = default;
SetLayerPrimaryConfig_Impl& operator=(SetLayerPrimaryConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryPosition_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryPosition_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
~SetLayerPrimaryPosition_Impl() = default;
SetLayerPrimaryPosition_Impl(SetLayerPrimaryPosition_Impl&& other) = default;
SetLayerPrimaryPosition_Impl& operator=(SetLayerPrimaryPosition_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerPrimaryAlpha_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerPrimaryAlpha_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
~SetLayerPrimaryAlpha_Impl() = default;
SetLayerPrimaryAlpha_Impl(SetLayerPrimaryAlpha_Impl&& other) = default;
SetLayerPrimaryAlpha_Impl& operator=(SetLayerPrimaryAlpha_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerCursorConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerCursorConfig_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
~SetLayerCursorConfig_Impl() = default;
SetLayerCursorConfig_Impl(SetLayerCursorConfig_Impl&& other) = default;
SetLayerCursorConfig_Impl& operator=(SetLayerCursorConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerCursorPosition_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerCursorPosition_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, int32_t x, int32_t y);
~SetLayerCursorPosition_Impl() = default;
SetLayerCursorPosition_Impl(SetLayerCursorPosition_Impl&& other) = default;
SetLayerCursorPosition_Impl& operator=(SetLayerCursorPosition_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerColorConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerColorConfig_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
~SetLayerColorConfig_Impl() = default;
SetLayerColorConfig_Impl(SetLayerColorConfig_Impl&& other) = default;
SetLayerColorConfig_Impl& operator=(SetLayerColorConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetLayerImage_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetLayerImage_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
~SetLayerImage_Impl() = default;
SetLayerImage_Impl(SetLayerImage_Impl&& other) = default;
SetLayerImage_Impl& operator=(SetLayerImage_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class CheckConfig_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
CheckConfig_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, bool discard, ::fidl::BytePart _response_buffer);
~CheckConfig_Impl() = default;
CheckConfig_Impl(CheckConfig_Impl&& other) = default;
CheckConfig_Impl& operator=(CheckConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ApplyConfig_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ApplyConfig_Impl(::zx::unowned_channel _client_end);
~ApplyConfig_Impl() = default;
ApplyConfig_Impl(ApplyConfig_Impl&& other) = default;
ApplyConfig_Impl& operator=(ApplyConfig_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class EnableVsync_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
EnableVsync_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, bool enable);
~EnableVsync_Impl() = default;
EnableVsync_Impl(EnableVsync_Impl&& other) = default;
EnableVsync_Impl& operator=(EnableVsync_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
class SetVirtconMode_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
SetVirtconMode_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint8_t mode);
~SetVirtconMode_Impl() = default;
SetVirtconMode_Impl(SetVirtconMode_Impl&& other) = default;
SetVirtconMode_Impl& operator=(SetVirtconMode_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class ImportBufferCollection_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
ImportBufferCollection_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id, ::zx::channel collection_token, ::fidl::BytePart _response_buffer);
~ImportBufferCollection_Impl() = default;
ImportBufferCollection_Impl(ImportBufferCollection_Impl&& other) = default;
ImportBufferCollection_Impl& operator=(ImportBufferCollection_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
class ReleaseBufferCollection_Impl final : private ::fidl::internal::StatusAndError {
using Super = ::fidl::internal::StatusAndError;
public:
ReleaseBufferCollection_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id);
~ReleaseBufferCollection_Impl() = default;
ReleaseBufferCollection_Impl(ReleaseBufferCollection_Impl&& other) = default;
ReleaseBufferCollection_Impl& operator=(ReleaseBufferCollection_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
};
template <typename ResponseType>
class SetBufferCollectionConstraints_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
SetBufferCollectionConstraints_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config, ::fidl::BytePart _response_buffer);
~SetBufferCollectionConstraints_Impl() = default;
SetBufferCollectionConstraints_Impl(SetBufferCollectionConstraints_Impl&& other) = default;
SetBufferCollectionConstraints_Impl& operator=(SetBufferCollectionConstraints_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class GetSingleBufferFramebuffer_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
GetSingleBufferFramebuffer_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
~GetSingleBufferFramebuffer_Impl() = default;
GetSingleBufferFramebuffer_Impl(GetSingleBufferFramebuffer_Impl&& other) = default;
GetSingleBufferFramebuffer_Impl& operator=(GetSingleBufferFramebuffer_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class IsCaptureSupported_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
IsCaptureSupported_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
~IsCaptureSupported_Impl() = default;
IsCaptureSupported_Impl(IsCaptureSupported_Impl&& other) = default;
IsCaptureSupported_Impl& operator=(IsCaptureSupported_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ImportImageForCapture_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
ImportImageForCapture_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
~ImportImageForCapture_Impl() = default;
ImportImageForCapture_Impl(ImportImageForCapture_Impl&& other) = default;
ImportImageForCapture_Impl& operator=(ImportImageForCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class StartCapture_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
StartCapture_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t signal_event_id, uint64_t image_id, ::fidl::BytePart _response_buffer);
~StartCapture_Impl() = default;
StartCapture_Impl(StartCapture_Impl&& other) = default;
StartCapture_Impl& operator=(StartCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
template <typename ResponseType>
class ReleaseCapture_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> {
using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>;
public:
ReleaseCapture_Impl(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t image_id, ::fidl::BytePart _response_buffer);
~ReleaseCapture_Impl() = default;
ReleaseCapture_Impl(ReleaseCapture_Impl&& other) = default;
ReleaseCapture_Impl& operator=(ReleaseCapture_Impl&& other) = default;
using Super::status;
using Super::error;
using Super::ok;
using Super::Unwrap;
using Super::value;
using Super::operator->;
using Super::operator*;
};
public:
using ImportVmoImage = ImportVmoImage_Impl<ImportVmoImageResponse>;
using ImportImage = ImportImage_Impl<ImportImageResponse>;
using ReleaseImage = ReleaseImage_Impl;
using ImportEvent = ImportEvent_Impl;
using ReleaseEvent = ReleaseEvent_Impl;
using CreateLayer = CreateLayer_Impl<CreateLayerResponse>;
using DestroyLayer = DestroyLayer_Impl;
using SetDisplayMode = SetDisplayMode_Impl;
using SetDisplayColorConversion = SetDisplayColorConversion_Impl;
using SetDisplayLayers = SetDisplayLayers_Impl;
using SetLayerPrimaryConfig = SetLayerPrimaryConfig_Impl;
using SetLayerPrimaryPosition = SetLayerPrimaryPosition_Impl;
using SetLayerPrimaryAlpha = SetLayerPrimaryAlpha_Impl;
using SetLayerCursorConfig = SetLayerCursorConfig_Impl;
using SetLayerCursorPosition = SetLayerCursorPosition_Impl;
using SetLayerColorConfig = SetLayerColorConfig_Impl;
using SetLayerImage = SetLayerImage_Impl;
using CheckConfig = CheckConfig_Impl<CheckConfigResponse>;
using ApplyConfig = ApplyConfig_Impl;
using EnableVsync = EnableVsync_Impl;
using SetVirtconMode = SetVirtconMode_Impl;
using ImportBufferCollection = ImportBufferCollection_Impl<ImportBufferCollectionResponse>;
using ReleaseBufferCollection = ReleaseBufferCollection_Impl;
using SetBufferCollectionConstraints = SetBufferCollectionConstraints_Impl<SetBufferCollectionConstraintsResponse>;
using GetSingleBufferFramebuffer = GetSingleBufferFramebuffer_Impl<GetSingleBufferFramebufferResponse>;
using IsCaptureSupported = IsCaptureSupported_Impl<IsCaptureSupportedResponse>;
using ImportImageForCapture = ImportImageForCapture_Impl<ImportImageForCaptureResponse>;
using StartCapture = StartCapture_Impl<StartCaptureResponse>;
using ReleaseCapture = ReleaseCapture_Impl<ReleaseCaptureResponse>;
};
class SyncClient final {
public:
explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {}
~SyncClient() = default;
SyncClient(SyncClient&&) = default;
SyncClient& operator=(SyncClient&&) = default;
const ::zx::channel& channel() const { return channel_; }
::zx::channel* mutable_channel() { return &channel_; }
// Allocates 72 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ImportVmoImage ImportVmoImage(::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ImportVmoImage ImportVmoImage(::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset, ::fidl::BytePart _response_buffer);
// Allocates 80 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ImportImage ImportImage(::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ImportImage ImportImage(::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ReleaseImage ReleaseImage(uint64_t image_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ReleaseImage ReleaseImage(::fidl::BytePart _request_buffer, uint64_t image_id);
// Imports an event into the driver and associates it with the given id.
//
// It is illegal for id to be equal to invalidId, and it is undefined to
// import one event with two different ids or to import two different events
// with the same id (note that ids map well to koids).
//
// If a client is reusing events, they must clear the signal
// before referencing the id again.
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ImportEvent ImportEvent(::zx::event event, uint64_t id);
// Imports an event into the driver and associates it with the given id.
//
// It is illegal for id to be equal to invalidId, and it is undefined to
// import one event with two different ids or to import two different events
// with the same id (note that ids map well to koids).
//
// If a client is reusing events, they must clear the signal
// before referencing the id again.
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ImportEvent ImportEvent(::fidl::BytePart _request_buffer, ::zx::event event, uint64_t id);
// Releases the event imported with the given id.
//
// If any images are currently using the given event, the event
// will still be waited up or signaled as appropriate before its
// resources are released. It is an error to reuse an ID while the
// active config has references to it.
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ReleaseEvent ReleaseEvent(uint64_t id);
// Releases the event imported with the given id.
//
// If any images are currently using the given event, the event
// will still be waited up or signaled as appropriate before its
// resources are released. It is an error to reuse an ID while the
// active config has references to it.
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ReleaseEvent ReleaseEvent(::fidl::BytePart _request_buffer, uint64_t id);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::CreateLayer CreateLayer();
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::CreateLayer CreateLayer(::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::DestroyLayer DestroyLayer(uint64_t layer_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::DestroyLayer DestroyLayer(::fidl::BytePart _request_buffer, uint64_t layer_id);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetDisplayMode SetDisplayMode(uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetDisplayMode SetDisplayMode(::fidl::BytePart _request_buffer, uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
// Allocates 88 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetDisplayColorConversion SetDisplayColorConversion(uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetDisplayColorConversion SetDisplayColorConversion(::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
// Request is heap-allocated.
ResultOf::SetDisplayLayers SetDisplayLayers(uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetDisplayLayers SetDisplayLayers(::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerPrimaryConfig SetLayerPrimaryConfig(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerPrimaryConfig SetLayerPrimaryConfig(::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerPrimaryPosition SetLayerPrimaryPosition(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerPrimaryPosition SetLayerPrimaryPosition(::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerPrimaryAlpha SetLayerPrimaryAlpha(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerPrimaryAlpha SetLayerPrimaryAlpha(::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerCursorConfig SetLayerCursorConfig(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerCursorConfig SetLayerCursorConfig(::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerCursorPosition SetLayerCursorPosition(uint64_t layer_id, int32_t x, int32_t y);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerCursorPosition SetLayerCursorPosition(::fidl::BytePart _request_buffer, uint64_t layer_id, int32_t x, int32_t y);
// Request is heap-allocated.
ResultOf::SetLayerColorConfig SetLayerColorConfig(uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerColorConfig SetLayerColorConfig(::fidl::BytePart _request_buffer, uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetLayerImage SetLayerImage(uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetLayerImage SetLayerImage(::fidl::BytePart _request_buffer, uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
// Allocates 24 bytes of request buffer on the stack. Response is heap-allocated.
ResultOf::CheckConfig CheckConfig(bool discard);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::CheckConfig CheckConfig(::fidl::BytePart _request_buffer, bool discard, ::fidl::BytePart _response_buffer);
// Allocates 16 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ApplyConfig ApplyConfig();
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::EnableVsync EnableVsync(bool enable);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::EnableVsync EnableVsync(::fidl::BytePart _request_buffer, bool enable);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetVirtconMode SetVirtconMode(uint8_t mode);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetVirtconMode SetVirtconMode(::fidl::BytePart _request_buffer, uint8_t mode);
// Allocates 56 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ImportBufferCollection ImportBufferCollection(uint64_t collection_id, ::zx::channel collection_token);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ImportBufferCollection ImportBufferCollection(::fidl::BytePart _request_buffer, uint64_t collection_id, ::zx::channel collection_token, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ReleaseBufferCollection ReleaseBufferCollection(uint64_t collection_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ReleaseBufferCollection ReleaseBufferCollection(::fidl::BytePart _request_buffer, uint64_t collection_id);
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::SetBufferCollectionConstraints SetBufferCollectionConstraints(uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config);
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::SetBufferCollectionConstraints SetBufferCollectionConstraints(::fidl::BytePart _request_buffer, uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config, ::fidl::BytePart _response_buffer);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::GetSingleBufferFramebuffer GetSingleBufferFramebuffer();
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::GetSingleBufferFramebuffer GetSingleBufferFramebuffer(::fidl::BytePart _response_buffer);
// Returns true if Capture is supported on the platform.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::IsCaptureSupported IsCaptureSupported();
// Returns true if Capture is supported on the platform.
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::IsCaptureSupported IsCaptureSupported(::fidl::BytePart _response_buffer);
// Imports a buffer collection backed VMO into the display controller. The VMO
// will be used by display controller to capture the image being displayed.
// Returns ZX_OK along with an image_id.
// image_id must be used by the client to start capture and/or release
// resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 88 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ImportImageForCapture ImportImageForCapture(::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
// Imports a buffer collection backed VMO into the display controller. The VMO
// will be used by display controller to capture the image being displayed.
// Returns ZX_OK along with an image_id.
// image_id must be used by the client to start capture and/or release
// resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ImportImageForCapture ImportImageForCapture(::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
// Starts capture. Client must provide a valid signal_event_id and
// image_id. signal_event_id must have been imported into the driver
// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
// The client will get notified once capture is complete via signal_event_id.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::StartCapture StartCapture(uint64_t signal_event_id, uint64_t image_id);
// Starts capture. Client must provide a valid signal_event_id and
// image_id. signal_event_id must have been imported into the driver
// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
// The client will get notified once capture is complete via signal_event_id.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::StartCapture StartCapture(::fidl::BytePart _request_buffer, uint64_t signal_event_id, uint64_t image_id, ::fidl::BytePart _response_buffer);
// Releases resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 56 bytes of message buffer on the stack. No heap allocation necessary.
ResultOf::ReleaseCapture ReleaseCapture(uint64_t image_id);
// Releases resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
UnownedResultOf::ReleaseCapture ReleaseCapture(::fidl::BytePart _request_buffer, uint64_t image_id, ::fidl::BytePart _response_buffer);
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the corresponding handler
// defined in |EventHandlers|. The return status of the handler function is folded with any
// transport-level errors and returned.
zx_status_t HandleEvents(EventHandlers handlers);
private:
::zx::channel channel_;
};
// Methods to make a sync FIDL call directly on an unowned channel, avoiding setting up a client.
class Call final {
Call() = delete;
public:
// Allocates 72 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ImportVmoImage ImportVmoImage(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ImportVmoImage ImportVmoImage(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset, ::fidl::BytePart _response_buffer);
// Allocates 80 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ImportImage ImportImage(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ImportImage ImportImage(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ReleaseImage ReleaseImage(::zx::unowned_channel _client_end, uint64_t image_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ReleaseImage ReleaseImage(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t image_id);
// Imports an event into the driver and associates it with the given id.
//
// It is illegal for id to be equal to invalidId, and it is undefined to
// import one event with two different ids or to import two different events
// with the same id (note that ids map well to koids).
//
// If a client is reusing events, they must clear the signal
// before referencing the id again.
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ImportEvent ImportEvent(::zx::unowned_channel _client_end, ::zx::event event, uint64_t id);
// Imports an event into the driver and associates it with the given id.
//
// It is illegal for id to be equal to invalidId, and it is undefined to
// import one event with two different ids or to import two different events
// with the same id (note that ids map well to koids).
//
// If a client is reusing events, they must clear the signal
// before referencing the id again.
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ImportEvent ImportEvent(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::zx::event event, uint64_t id);
// Releases the event imported with the given id.
//
// If any images are currently using the given event, the event
// will still be waited up or signaled as appropriate before its
// resources are released. It is an error to reuse an ID while the
// active config has references to it.
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ReleaseEvent ReleaseEvent(::zx::unowned_channel _client_end, uint64_t id);
// Releases the event imported with the given id.
//
// If any images are currently using the given event, the event
// will still be waited up or signaled as appropriate before its
// resources are released. It is an error to reuse an ID while the
// active config has references to it.
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ReleaseEvent ReleaseEvent(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t id);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::CreateLayer CreateLayer(::zx::unowned_channel _client_end);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::CreateLayer CreateLayer(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::DestroyLayer DestroyLayer(::zx::unowned_channel _client_end, uint64_t layer_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::DestroyLayer DestroyLayer(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetDisplayMode SetDisplayMode(::zx::unowned_channel _client_end, uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetDisplayMode SetDisplayMode(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode);
// Allocates 88 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetDisplayColorConversion SetDisplayColorConversion(::zx::unowned_channel _client_end, uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetDisplayColorConversion SetDisplayColorConversion(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets);
// Request is heap-allocated.
static ResultOf::SetDisplayLayers SetDisplayLayers(::zx::unowned_channel _client_end, uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetDisplayLayers SetDisplayLayers(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerPrimaryConfig SetLayerPrimaryConfig(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerPrimaryConfig SetLayerPrimaryConfig(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerPrimaryPosition SetLayerPrimaryPosition(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerPrimaryPosition SetLayerPrimaryPosition(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame);
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerPrimaryAlpha SetLayerPrimaryAlpha(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerPrimaryAlpha SetLayerPrimaryAlpha(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val);
// Allocates 40 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerCursorConfig SetLayerCursorConfig(::zx::unowned_channel _client_end, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerCursorConfig SetLayerCursorConfig(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config);
// Allocates 32 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerCursorPosition SetLayerCursorPosition(::zx::unowned_channel _client_end, uint64_t layer_id, int32_t x, int32_t y);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerCursorPosition SetLayerCursorPosition(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, int32_t x, int32_t y);
// Request is heap-allocated.
static ResultOf::SetLayerColorConfig SetLayerColorConfig(::zx::unowned_channel _client_end, uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerColorConfig SetLayerColorConfig(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetLayerImage SetLayerImage(::zx::unowned_channel _client_end, uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetLayerImage SetLayerImage(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id);
// Allocates 24 bytes of request buffer on the stack. Response is heap-allocated.
static ResultOf::CheckConfig CheckConfig(::zx::unowned_channel _client_end, bool discard);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::CheckConfig CheckConfig(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, bool discard, ::fidl::BytePart _response_buffer);
// Allocates 16 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ApplyConfig ApplyConfig(::zx::unowned_channel _client_end);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::EnableVsync EnableVsync(::zx::unowned_channel _client_end, bool enable);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::EnableVsync EnableVsync(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, bool enable);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetVirtconMode SetVirtconMode(::zx::unowned_channel _client_end, uint8_t mode);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetVirtconMode SetVirtconMode(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint8_t mode);
// Allocates 56 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ImportBufferCollection ImportBufferCollection(::zx::unowned_channel _client_end, uint64_t collection_id, ::zx::channel collection_token);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ImportBufferCollection ImportBufferCollection(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id, ::zx::channel collection_token, ::fidl::BytePart _response_buffer);
// Allocates 24 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ReleaseBufferCollection ReleaseBufferCollection(::zx::unowned_channel _client_end, uint64_t collection_id);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ReleaseBufferCollection ReleaseBufferCollection(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id);
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::SetBufferCollectionConstraints SetBufferCollectionConstraints(::zx::unowned_channel _client_end, uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::SetBufferCollectionConstraints SetBufferCollectionConstraints(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config, ::fidl::BytePart _response_buffer);
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::GetSingleBufferFramebuffer GetSingleBufferFramebuffer(::zx::unowned_channel _client_end);
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::GetSingleBufferFramebuffer GetSingleBufferFramebuffer(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
// Returns true if Capture is supported on the platform.
// Allocates 48 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::IsCaptureSupported IsCaptureSupported(::zx::unowned_channel _client_end);
// Returns true if Capture is supported on the platform.
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::IsCaptureSupported IsCaptureSupported(::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer);
// Imports a buffer collection backed VMO into the display controller. The VMO
// will be used by display controller to capture the image being displayed.
// Returns ZX_OK along with an image_id.
// image_id must be used by the client to start capture and/or release
// resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 88 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ImportImageForCapture ImportImageForCapture(::zx::unowned_channel _client_end, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index);
// Imports a buffer collection backed VMO into the display controller. The VMO
// will be used by display controller to capture the image being displayed.
// Returns ZX_OK along with an image_id.
// image_id must be used by the client to start capture and/or release
// resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ImportImageForCapture ImportImageForCapture(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ::fidl::BytePart _response_buffer);
// Starts capture. Client must provide a valid signal_event_id and
// image_id. signal_event_id must have been imported into the driver
// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
// The client will get notified once capture is complete via signal_event_id.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 64 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::StartCapture StartCapture(::zx::unowned_channel _client_end, uint64_t signal_event_id, uint64_t image_id);
// Starts capture. Client must provide a valid signal_event_id and
// image_id. signal_event_id must have been imported into the driver
// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
// The client will get notified once capture is complete via signal_event_id.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::StartCapture StartCapture(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t signal_event_id, uint64_t image_id, ::fidl::BytePart _response_buffer);
// Releases resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Allocates 56 bytes of message buffer on the stack. No heap allocation necessary.
static ResultOf::ReleaseCapture ReleaseCapture(::zx::unowned_channel _client_end, uint64_t image_id);
// Releases resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
// Caller provides the backing storage for FIDL message via request and response buffers.
static UnownedResultOf::ReleaseCapture ReleaseCapture(::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, uint64_t image_id, ::fidl::BytePart _response_buffer);
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the corresponding handler
// defined in |EventHandlers|. The return status of the handler function is folded with any
// transport-level errors and returned.
static zx_status_t HandleEvents(::zx::unowned_channel client_end, EventHandlers handlers);
};
// Messages are encoded and decoded in-place when these methods are used.
// Additionally, requests must be already laid-out according to the FIDL wire-format.
class InPlace final {
InPlace() = delete;
public:
static ::fidl::DecodeResult<ImportVmoImageResponse> ImportVmoImage(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ImportVmoImageRequest> params, ::fidl::BytePart response_buffer);
static ::fidl::DecodeResult<ImportImageResponse> ImportImage(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ImportImageRequest> params, ::fidl::BytePart response_buffer);
static ::fidl::internal::StatusAndError ReleaseImage(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ReleaseImageRequest> params);
// Imports an event into the driver and associates it with the given id.
//
// It is illegal for id to be equal to invalidId, and it is undefined to
// import one event with two different ids or to import two different events
// with the same id (note that ids map well to koids).
//
// If a client is reusing events, they must clear the signal
// before referencing the id again.
static ::fidl::internal::StatusAndError ImportEvent(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ImportEventRequest> params);
// Releases the event imported with the given id.
//
// If any images are currently using the given event, the event
// will still be waited up or signaled as appropriate before its
// resources are released. It is an error to reuse an ID while the
// active config has references to it.
static ::fidl::internal::StatusAndError ReleaseEvent(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ReleaseEventRequest> params);
static ::fidl::DecodeResult<CreateLayerResponse> CreateLayer(::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer);
static ::fidl::internal::StatusAndError DestroyLayer(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<DestroyLayerRequest> params);
static ::fidl::internal::StatusAndError SetDisplayMode(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetDisplayModeRequest> params);
static ::fidl::internal::StatusAndError SetDisplayColorConversion(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetDisplayColorConversionRequest> params);
static ::fidl::internal::StatusAndError SetDisplayLayers(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetDisplayLayersRequest> params);
static ::fidl::internal::StatusAndError SetLayerPrimaryConfig(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerPrimaryConfigRequest> params);
static ::fidl::internal::StatusAndError SetLayerPrimaryPosition(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerPrimaryPositionRequest> params);
static ::fidl::internal::StatusAndError SetLayerPrimaryAlpha(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerPrimaryAlphaRequest> params);
static ::fidl::internal::StatusAndError SetLayerCursorConfig(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerCursorConfigRequest> params);
static ::fidl::internal::StatusAndError SetLayerCursorPosition(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerCursorPositionRequest> params);
static ::fidl::internal::StatusAndError SetLayerColorConfig(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerColorConfigRequest> params);
static ::fidl::internal::StatusAndError SetLayerImage(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetLayerImageRequest> params);
static ::fidl::DecodeResult<CheckConfigResponse> CheckConfig(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<CheckConfigRequest> params, ::fidl::BytePart response_buffer);
static ::fidl::internal::StatusAndError ApplyConfig(::zx::unowned_channel _client_end);
static ::fidl::internal::StatusAndError EnableVsync(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<EnableVsyncRequest> params);
static ::fidl::internal::StatusAndError SetVirtconMode(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetVirtconModeRequest> params);
static ::fidl::DecodeResult<ImportBufferCollectionResponse> ImportBufferCollection(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ImportBufferCollectionRequest> params, ::fidl::BytePart response_buffer);
static ::fidl::internal::StatusAndError ReleaseBufferCollection(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ReleaseBufferCollectionRequest> params);
static ::fidl::DecodeResult<SetBufferCollectionConstraintsResponse> SetBufferCollectionConstraints(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<SetBufferCollectionConstraintsRequest> params, ::fidl::BytePart response_buffer);
static ::fidl::DecodeResult<GetSingleBufferFramebufferResponse> GetSingleBufferFramebuffer(::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer);
// Returns true if Capture is supported on the platform.
static ::fidl::DecodeResult<IsCaptureSupportedResponse> IsCaptureSupported(::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer);
// Imports a buffer collection backed VMO into the display controller. The VMO
// will be used by display controller to capture the image being displayed.
// Returns ZX_OK along with an image_id.
// image_id must be used by the client to start capture and/or release
// resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
static ::fidl::DecodeResult<ImportImageForCaptureResponse> ImportImageForCapture(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ImportImageForCaptureRequest> params, ::fidl::BytePart response_buffer);
// Starts capture. Client must provide a valid signal_event_id and
// image_id. signal_event_id must have been imported into the driver
// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
// The client will get notified once capture is complete via signal_event_id.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
static ::fidl::DecodeResult<StartCaptureResponse> StartCapture(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<StartCaptureRequest> params, ::fidl::BytePart response_buffer);
// Releases resources allocated for capture.
// Returns ZX_ERR_NOT_SUPPORTED if controller does not support capture
static ::fidl::DecodeResult<ReleaseCaptureResponse> ReleaseCapture(::zx::unowned_channel _client_end, ::fidl::DecodedMessage<ReleaseCaptureRequest> params, ::fidl::BytePart response_buffer);
};
// Pure-virtual interface to be implemented by a server.
class Interface {
public:
Interface() = default;
virtual ~Interface() = default;
using _Outer = Controller;
using _Base = ::fidl::CompleterBase;
class ImportVmoImageCompleterBase : public _Base {
public:
void Reply(int32_t res, uint64_t image_id);
void Reply(::fidl::BytePart _buffer, int32_t res, uint64_t image_id);
void Reply(::fidl::DecodedMessage<ImportVmoImageResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using ImportVmoImageCompleter = ::fidl::Completer<ImportVmoImageCompleterBase>;
virtual void ImportVmoImage(::llcpp::fuchsia::hardware::display::ImageConfig image_config, ::zx::vmo vmo, int32_t offset, ImportVmoImageCompleter::Sync _completer) = 0;
class ImportImageCompleterBase : public _Base {
public:
void Reply(int32_t res, uint64_t image_id);
void Reply(::fidl::BytePart _buffer, int32_t res, uint64_t image_id);
void Reply(::fidl::DecodedMessage<ImportImageResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using ImportImageCompleter = ::fidl::Completer<ImportImageCompleterBase>;
virtual void ImportImage(::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ImportImageCompleter::Sync _completer) = 0;
using ReleaseImageCompleter = ::fidl::Completer<>;
virtual void ReleaseImage(uint64_t image_id, ReleaseImageCompleter::Sync _completer) = 0;
using ImportEventCompleter = ::fidl::Completer<>;
virtual void ImportEvent(::zx::event event, uint64_t id, ImportEventCompleter::Sync _completer) = 0;
using ReleaseEventCompleter = ::fidl::Completer<>;
virtual void ReleaseEvent(uint64_t id, ReleaseEventCompleter::Sync _completer) = 0;
class CreateLayerCompleterBase : public _Base {
public:
void Reply(int32_t res, uint64_t layer_id);
void Reply(::fidl::BytePart _buffer, int32_t res, uint64_t layer_id);
void Reply(::fidl::DecodedMessage<CreateLayerResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using CreateLayerCompleter = ::fidl::Completer<CreateLayerCompleterBase>;
virtual void CreateLayer(CreateLayerCompleter::Sync _completer) = 0;
using DestroyLayerCompleter = ::fidl::Completer<>;
virtual void DestroyLayer(uint64_t layer_id, DestroyLayerCompleter::Sync _completer) = 0;
using SetDisplayModeCompleter = ::fidl::Completer<>;
virtual void SetDisplayMode(uint64_t display_id, ::llcpp::fuchsia::hardware::display::Mode mode, SetDisplayModeCompleter::Sync _completer) = 0;
using SetDisplayColorConversionCompleter = ::fidl::Completer<>;
virtual void SetDisplayColorConversion(uint64_t display_id, ::fidl::Array<float, 3> preoffsets, ::fidl::Array<float, 9> coefficients, ::fidl::Array<float, 3> postoffsets, SetDisplayColorConversionCompleter::Sync _completer) = 0;
using SetDisplayLayersCompleter = ::fidl::Completer<>;
virtual void SetDisplayLayers(uint64_t display_id, ::fidl::VectorView<uint64_t> layer_ids, SetDisplayLayersCompleter::Sync _completer) = 0;
using SetLayerPrimaryConfigCompleter = ::fidl::Completer<>;
virtual void SetLayerPrimaryConfig(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, SetLayerPrimaryConfigCompleter::Sync _completer) = 0;
using SetLayerPrimaryPositionCompleter = ::fidl::Completer<>;
virtual void SetLayerPrimaryPosition(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::Transform transform, ::llcpp::fuchsia::hardware::display::Frame src_frame, ::llcpp::fuchsia::hardware::display::Frame dest_frame, SetLayerPrimaryPositionCompleter::Sync _completer) = 0;
using SetLayerPrimaryAlphaCompleter = ::fidl::Completer<>;
virtual void SetLayerPrimaryAlpha(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::AlphaMode mode, float val, SetLayerPrimaryAlphaCompleter::Sync _completer) = 0;
using SetLayerCursorConfigCompleter = ::fidl::Completer<>;
virtual void SetLayerCursorConfig(uint64_t layer_id, ::llcpp::fuchsia::hardware::display::ImageConfig image_config, SetLayerCursorConfigCompleter::Sync _completer) = 0;
using SetLayerCursorPositionCompleter = ::fidl::Completer<>;
virtual void SetLayerCursorPosition(uint64_t layer_id, int32_t x, int32_t y, SetLayerCursorPositionCompleter::Sync _completer) = 0;
using SetLayerColorConfigCompleter = ::fidl::Completer<>;
virtual void SetLayerColorConfig(uint64_t layer_id, uint32_t pixel_format, ::fidl::VectorView<uint8_t> color_bytes, SetLayerColorConfigCompleter::Sync _completer) = 0;
using SetLayerImageCompleter = ::fidl::Completer<>;
virtual void SetLayerImage(uint64_t layer_id, uint64_t image_id, uint64_t wait_event_id, uint64_t signal_event_id, SetLayerImageCompleter::Sync _completer) = 0;
class CheckConfigCompleterBase : public _Base {
public:
void Reply(::llcpp::fuchsia::hardware::display::ConfigResult res, ::fidl::VectorView<::llcpp::fuchsia::hardware::display::ClientCompositionOp> ops);
void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::hardware::display::ConfigResult res, ::fidl::VectorView<::llcpp::fuchsia::hardware::display::ClientCompositionOp> ops);
void Reply(::fidl::DecodedMessage<CheckConfigResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using CheckConfigCompleter = ::fidl::Completer<CheckConfigCompleterBase>;
virtual void CheckConfig(bool discard, CheckConfigCompleter::Sync _completer) = 0;
using ApplyConfigCompleter = ::fidl::Completer<>;
virtual void ApplyConfig(ApplyConfigCompleter::Sync _completer) = 0;
using EnableVsyncCompleter = ::fidl::Completer<>;
virtual void EnableVsync(bool enable, EnableVsyncCompleter::Sync _completer) = 0;
using SetVirtconModeCompleter = ::fidl::Completer<>;
virtual void SetVirtconMode(uint8_t mode, SetVirtconModeCompleter::Sync _completer) = 0;
class ImportBufferCollectionCompleterBase : public _Base {
public:
void Reply(int32_t res);
void Reply(::fidl::BytePart _buffer, int32_t res);
void Reply(::fidl::DecodedMessage<ImportBufferCollectionResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using ImportBufferCollectionCompleter = ::fidl::Completer<ImportBufferCollectionCompleterBase>;
virtual void ImportBufferCollection(uint64_t collection_id, ::zx::channel collection_token, ImportBufferCollectionCompleter::Sync _completer) = 0;
using ReleaseBufferCollectionCompleter = ::fidl::Completer<>;
virtual void ReleaseBufferCollection(uint64_t collection_id, ReleaseBufferCollectionCompleter::Sync _completer) = 0;
class SetBufferCollectionConstraintsCompleterBase : public _Base {
public:
void Reply(int32_t res);
void Reply(::fidl::BytePart _buffer, int32_t res);
void Reply(::fidl::DecodedMessage<SetBufferCollectionConstraintsResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using SetBufferCollectionConstraintsCompleter = ::fidl::Completer<SetBufferCollectionConstraintsCompleterBase>;
virtual void SetBufferCollectionConstraints(uint64_t collection_id, ::llcpp::fuchsia::hardware::display::ImageConfig config, SetBufferCollectionConstraintsCompleter::Sync _completer) = 0;
class GetSingleBufferFramebufferCompleterBase : public _Base {
public:
void Reply(int32_t res, ::zx::vmo vmo, uint32_t stride);
void Reply(::fidl::BytePart _buffer, int32_t res, ::zx::vmo vmo, uint32_t stride);
void Reply(::fidl::DecodedMessage<GetSingleBufferFramebufferResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using GetSingleBufferFramebufferCompleter = ::fidl::Completer<GetSingleBufferFramebufferCompleterBase>;
virtual void GetSingleBufferFramebuffer(GetSingleBufferFramebufferCompleter::Sync _completer) = 0;
class IsCaptureSupportedCompleterBase : public _Base {
public:
void Reply(::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Result result);
void ReplySuccess(bool supported);
void ReplyError(int32_t error);
void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Result result);
void ReplySuccess(::fidl::BytePart _buffer, bool supported);
void Reply(::fidl::DecodedMessage<IsCaptureSupportedResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using IsCaptureSupportedCompleter = ::fidl::Completer<IsCaptureSupportedCompleterBase>;
virtual void IsCaptureSupported(IsCaptureSupportedCompleter::Sync _completer) = 0;
class ImportImageForCaptureCompleterBase : public _Base {
public:
void Reply(::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Result result);
void ReplySuccess(uint64_t image_id);
void ReplyError(int32_t error);
void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Result result);
void ReplySuccess(::fidl::BytePart _buffer, uint64_t image_id);
void Reply(::fidl::DecodedMessage<ImportImageForCaptureResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using ImportImageForCaptureCompleter = ::fidl::Completer<ImportImageForCaptureCompleterBase>;
virtual void ImportImageForCapture(::llcpp::fuchsia::hardware::display::ImageConfig image_config, uint64_t collection_id, uint32_t index, ImportImageForCaptureCompleter::Sync _completer) = 0;
class StartCaptureCompleterBase : public _Base {
public:
void Reply(::llcpp::fuchsia::hardware::display::Controller_StartCapture_Result result);
void ReplySuccess();
void ReplyError(int32_t error);
void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::hardware::display::Controller_StartCapture_Result result);
void ReplySuccess(::fidl::BytePart _buffer);
void Reply(::fidl::DecodedMessage<StartCaptureResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using StartCaptureCompleter = ::fidl::Completer<StartCaptureCompleterBase>;
virtual void StartCapture(uint64_t signal_event_id, uint64_t image_id, StartCaptureCompleter::Sync _completer) = 0;
class ReleaseCaptureCompleterBase : public _Base {
public:
void Reply(::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Result result);
void ReplySuccess();
void ReplyError(int32_t error);
void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Result result);
void ReplySuccess(::fidl::BytePart _buffer);
void Reply(::fidl::DecodedMessage<ReleaseCaptureResponse> params);
protected:
using ::fidl::CompleterBase::CompleterBase;
};
using ReleaseCaptureCompleter = ::fidl::Completer<ReleaseCaptureCompleterBase>;
virtual void ReleaseCapture(uint64_t image_id, ReleaseCaptureCompleter::Sync _completer) = 0;
};
// Attempts to dispatch the incoming message to a handler function in the server implementation.
// If there is no matching handler, it returns false, leaving the message and transaction intact.
// In all other cases, it consumes the message and returns true.
// It is possible to chain multiple TryDispatch functions in this manner.
static bool TryDispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn);
// Dispatches the incoming message to one of the handlers functions in the interface.
// If there is no matching handler, it closes all the handles in |msg| and closes the channel with
// a |ZX_ERR_NOT_SUPPORTED| epitaph, before returning false. The message should then be discarded.
static bool Dispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn);
// Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used with |fidl::Bind|
// to reduce template expansion.
// Do not call this method manually. Use |Dispatch| instead.
static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, ::fidl::Transaction* txn) {
return Dispatch(static_cast<Interface*>(impl), msg, txn);
}
static zx_status_t SendDisplaysChangedEvent(::zx::unowned_channel _chan, ::fidl::VectorView<::llcpp::fuchsia::hardware::display::Info> added, ::fidl::VectorView<uint64_t> removed);
// Caller provides the backing storage for FIDL message via response buffers.
static zx_status_t SendDisplaysChangedEvent(::zx::unowned_channel _chan, ::fidl::BytePart _buffer, ::fidl::VectorView<::llcpp::fuchsia::hardware::display::Info> added, ::fidl::VectorView<uint64_t> removed);
// Messages are encoded in-place.
static zx_status_t SendDisplaysChangedEvent(::zx::unowned_channel _chan, ::fidl::DecodedMessage<DisplaysChangedResponse> params);
static zx_status_t SendVsyncEvent(::zx::unowned_channel _chan, uint64_t display_id, uint64_t timestamp, ::fidl::VectorView<uint64_t> images);
// Caller provides the backing storage for FIDL message via response buffers.
static zx_status_t SendVsyncEvent(::zx::unowned_channel _chan, ::fidl::BytePart _buffer, uint64_t display_id, uint64_t timestamp, ::fidl::VectorView<uint64_t> images);
// Messages are encoded in-place.
static zx_status_t SendVsyncEvent(::zx::unowned_channel _chan, ::fidl::DecodedMessage<VsyncResponse> params);
static zx_status_t SendClientOwnershipChangeEvent(::zx::unowned_channel _chan, bool has_ownership);
// Caller provides the backing storage for FIDL message via response buffers.
static zx_status_t SendClientOwnershipChangeEvent(::zx::unowned_channel _chan, ::fidl::BytePart _buffer, bool has_ownership);
// Messages are encoded in-place.
static zx_status_t SendClientOwnershipChangeEvent(::zx::unowned_channel _chan, ::fidl::DecodedMessage<ClientOwnershipChangeResponse> params);
// Helper functions to fill in the transaction header in a |DecodedMessage<TransactionalMessage>|.
class SetTransactionHeaderFor final {
SetTransactionHeaderFor() = delete;
public:
static void DisplaysChangedResponse(const ::fidl::DecodedMessage<Controller::DisplaysChangedResponse>& _msg);
static void ImportVmoImageRequest(const ::fidl::DecodedMessage<Controller::ImportVmoImageRequest>& _msg);
static void ImportVmoImageResponse(const ::fidl::DecodedMessage<Controller::ImportVmoImageResponse>& _msg);
static void ImportImageRequest(const ::fidl::DecodedMessage<Controller::ImportImageRequest>& _msg);
static void ImportImageResponse(const ::fidl::DecodedMessage<Controller::ImportImageResponse>& _msg);
static void ReleaseImageRequest(const ::fidl::DecodedMessage<Controller::ReleaseImageRequest>& _msg);
static void ImportEventRequest(const ::fidl::DecodedMessage<Controller::ImportEventRequest>& _msg);
static void ReleaseEventRequest(const ::fidl::DecodedMessage<Controller::ReleaseEventRequest>& _msg);
static void CreateLayerRequest(const ::fidl::DecodedMessage<Controller::CreateLayerRequest>& _msg);
static void CreateLayerResponse(const ::fidl::DecodedMessage<Controller::CreateLayerResponse>& _msg);
static void DestroyLayerRequest(const ::fidl::DecodedMessage<Controller::DestroyLayerRequest>& _msg);
static void SetDisplayModeRequest(const ::fidl::DecodedMessage<Controller::SetDisplayModeRequest>& _msg);
static void SetDisplayColorConversionRequest(const ::fidl::DecodedMessage<Controller::SetDisplayColorConversionRequest>& _msg);
static void SetDisplayLayersRequest(const ::fidl::DecodedMessage<Controller::SetDisplayLayersRequest>& _msg);
static void SetLayerPrimaryConfigRequest(const ::fidl::DecodedMessage<Controller::SetLayerPrimaryConfigRequest>& _msg);
static void SetLayerPrimaryPositionRequest(const ::fidl::DecodedMessage<Controller::SetLayerPrimaryPositionRequest>& _msg);
static void SetLayerPrimaryAlphaRequest(const ::fidl::DecodedMessage<Controller::SetLayerPrimaryAlphaRequest>& _msg);
static void SetLayerCursorConfigRequest(const ::fidl::DecodedMessage<Controller::SetLayerCursorConfigRequest>& _msg);
static void SetLayerCursorPositionRequest(const ::fidl::DecodedMessage<Controller::SetLayerCursorPositionRequest>& _msg);
static void SetLayerColorConfigRequest(const ::fidl::DecodedMessage<Controller::SetLayerColorConfigRequest>& _msg);
static void SetLayerImageRequest(const ::fidl::DecodedMessage<Controller::SetLayerImageRequest>& _msg);
static void CheckConfigRequest(const ::fidl::DecodedMessage<Controller::CheckConfigRequest>& _msg);
static void CheckConfigResponse(const ::fidl::DecodedMessage<Controller::CheckConfigResponse>& _msg);
static void ApplyConfigRequest(const ::fidl::DecodedMessage<Controller::ApplyConfigRequest>& _msg);
static void EnableVsyncRequest(const ::fidl::DecodedMessage<Controller::EnableVsyncRequest>& _msg);
static void VsyncResponse(const ::fidl::DecodedMessage<Controller::VsyncResponse>& _msg);
static void SetVirtconModeRequest(const ::fidl::DecodedMessage<Controller::SetVirtconModeRequest>& _msg);
static void ClientOwnershipChangeResponse(const ::fidl::DecodedMessage<Controller::ClientOwnershipChangeResponse>& _msg);
static void ImportBufferCollectionRequest(const ::fidl::DecodedMessage<Controller::ImportBufferCollectionRequest>& _msg);
static void ImportBufferCollectionResponse(const ::fidl::DecodedMessage<Controller::ImportBufferCollectionResponse>& _msg);
static void ReleaseBufferCollectionRequest(const ::fidl::DecodedMessage<Controller::ReleaseBufferCollectionRequest>& _msg);
static void SetBufferCollectionConstraintsRequest(const ::fidl::DecodedMessage<Controller::SetBufferCollectionConstraintsRequest>& _msg);
static void SetBufferCollectionConstraintsResponse(const ::fidl::DecodedMessage<Controller::SetBufferCollectionConstraintsResponse>& _msg);
static void GetSingleBufferFramebufferRequest(const ::fidl::DecodedMessage<Controller::GetSingleBufferFramebufferRequest>& _msg);
static void GetSingleBufferFramebufferResponse(const ::fidl::DecodedMessage<Controller::GetSingleBufferFramebufferResponse>& _msg);
static void IsCaptureSupportedRequest(const ::fidl::DecodedMessage<Controller::IsCaptureSupportedRequest>& _msg);
static void IsCaptureSupportedResponse(const ::fidl::DecodedMessage<Controller::IsCaptureSupportedResponse>& _msg);
static void ImportImageForCaptureRequest(const ::fidl::DecodedMessage<Controller::ImportImageForCaptureRequest>& _msg);
static void ImportImageForCaptureResponse(const ::fidl::DecodedMessage<Controller::ImportImageForCaptureResponse>& _msg);
static void StartCaptureRequest(const ::fidl::DecodedMessage<Controller::StartCaptureRequest>& _msg);
static void StartCaptureResponse(const ::fidl::DecodedMessage<Controller::StartCaptureResponse>& _msg);
static void ReleaseCaptureRequest(const ::fidl::DecodedMessage<Controller::ReleaseCaptureRequest>& _msg);
static void ReleaseCaptureResponse(const ::fidl::DecodedMessage<Controller::ReleaseCaptureResponse>& _msg);
};
};
} // namespace display
} // namespace hardware
} // namespace fuchsia
} // namespace llcpp
namespace fidl {
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::ImageConfig> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::ImageConfig>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ImageConfig, width) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ImageConfig, height) == 4);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ImageConfig, pixel_format) == 8);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ImageConfig, type) == 12);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::ImageConfig) == ::llcpp::fuchsia::hardware::display::ImageConfig::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest)
== ::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest, device) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerRequest, controller) == 20);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerResponse)
== ::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenVirtconControllerResponse, s) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest)
== ::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest, device) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenControllerRequest, controller) == 20);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Provider::OpenControllerResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Provider::OpenControllerResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Provider::OpenControllerResponse)
== ::llcpp::fuchsia::hardware::display::Provider::OpenControllerResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Provider::OpenControllerResponse, s) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Mode> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Mode>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Mode, horizontal_resolution) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Mode, vertical_resolution) == 4);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Mode, refresh_rate_e2) == 8);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Mode, flags) == 12);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Mode) == ::llcpp::fuchsia::hardware::display::Mode::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Frame> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Frame>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Frame, x_pos) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Frame, y_pos) == 4);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Frame, width) == 8);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Frame, height) == 12);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Frame) == ::llcpp::fuchsia::hardware::display::Frame::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::CursorInfo> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::CursorInfo>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::CursorInfo, width) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::CursorInfo, height) == 4);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::CursorInfo, pixel_format) == 8);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::CursorInfo) == ::llcpp::fuchsia::hardware::display::CursorInfo::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Info> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Info>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, id) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, modes) == 8);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, pixel_format) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, cursor_configs) == 40);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, manufacturer_name) == 56);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, monitor_name) == 72);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Info, monitor_serial) == 88);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Info) == ::llcpp::fuchsia::hardware::display::Info::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response, __reserved) == 0);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response) == ::llcpp::fuchsia::hardware::display::Controller_StartCapture_Response::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Result> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_StartCapture_Result>);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response, __reserved) == 0);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response) == ::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Response::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Result> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_ReleaseCapture_Result>);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response, supported) == 0);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response) == ::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Response::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Result> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_IsCaptureSupported_Result>);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response, image_id) == 0);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response) == ::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Response::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Result> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::Controller_ImportImageForCapture_Result>);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::ClientCompositionOp> : public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fuchsia::hardware::display::ClientCompositionOp>);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ClientCompositionOp, display_id) == 0);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ClientCompositionOp, layer_id) == 8);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::ClientCompositionOp, opcode) == 16);
static_assert(sizeof(::llcpp::fuchsia::hardware::display::ClientCompositionOp) == ::llcpp::fuchsia::hardware::display::ClientCompositionOp::PrimarySize);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse)
== ::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse, added) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::DisplaysChangedResponse, removed) == 32);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest, image_config) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest, vmo) == 32);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageRequest, offset) == 36);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse, res) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportVmoImageResponse, image_id) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest, image_config) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest, collection_id) == 32);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageRequest, index) == 40);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse, res) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageResponse, image_id) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ReleaseImageRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ReleaseImageRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ReleaseImageRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ReleaseImageRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ReleaseImageRequest, image_id) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest, event) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportEventRequest, id) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ReleaseEventRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ReleaseEventRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ReleaseEventRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ReleaseEventRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ReleaseEventRequest, id) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse)
== ::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse, res) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::CreateLayerResponse, layer_id) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::DestroyLayerRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::DestroyLayerRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::DestroyLayerRequest)
== ::llcpp::fuchsia::hardware::display::Controller::DestroyLayerRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::DestroyLayerRequest, layer_id) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest, display_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayModeRequest, mode) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest, display_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest, preoffsets) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest, coefficients) == 36);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayColorConversionRequest, postoffsets) == 72);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest, display_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetDisplayLayersRequest, layer_ids) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryConfigRequest, image_config) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest, transform) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest, src_frame) == 28);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryPositionRequest, dest_frame) == 44);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest, mode) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerPrimaryAlphaRequest, val) == 28);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorConfigRequest, image_config) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest, x) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerCursorPositionRequest, y) == 28);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest, pixel_format) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerColorConfigRequest, color_bytes) == 32);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest, layer_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest, image_id) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest, wait_event_id) == 32);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetLayerImageRequest, signal_event_id) == 40);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::CheckConfigRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::CheckConfigRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::CheckConfigRequest)
== ::llcpp::fuchsia::hardware::display::Controller::CheckConfigRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::CheckConfigRequest, discard) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse)
== ::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse, res) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::CheckConfigResponse, ops) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::EnableVsyncRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::EnableVsyncRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::EnableVsyncRequest)
== ::llcpp::fuchsia::hardware::display::Controller::EnableVsyncRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::EnableVsyncRequest, enable) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::VsyncResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::VsyncResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::VsyncResponse)
== ::llcpp::fuchsia::hardware::display::Controller::VsyncResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::VsyncResponse, display_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::VsyncResponse, timestamp) == 24);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::VsyncResponse, images) == 32);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetVirtconModeRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetVirtconModeRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetVirtconModeRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetVirtconModeRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetVirtconModeRequest, mode) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ClientOwnershipChangeResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ClientOwnershipChangeResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ClientOwnershipChangeResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ClientOwnershipChangeResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ClientOwnershipChangeResponse, has_ownership) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest, collection_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionRequest, collection_token) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportBufferCollectionResponse, res) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ReleaseBufferCollectionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ReleaseBufferCollectionRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ReleaseBufferCollectionRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ReleaseBufferCollectionRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ReleaseBufferCollectionRequest, collection_id) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest)
== ::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest, collection_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsRequest, config) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsResponse)
== ::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::SetBufferCollectionConstraintsResponse, res) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse)
== ::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse, res) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse, vmo) == 20);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::GetSingleBufferFramebufferResponse, stride) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::IsCaptureSupportedResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::IsCaptureSupportedResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::IsCaptureSupportedResponse)
== ::llcpp::fuchsia::hardware::display::Controller::IsCaptureSupportedResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::IsCaptureSupportedResponse, result) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest, image_config) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest, collection_id) == 32);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureRequest, index) == 40);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ImportImageForCaptureResponse, result) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest)
== ::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest, signal_event_id) == 16);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::StartCaptureRequest, image_id) == 24);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::StartCaptureResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::StartCaptureResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::StartCaptureResponse)
== ::llcpp::fuchsia::hardware::display::Controller::StartCaptureResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::StartCaptureResponse, result) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureRequest> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureRequest)
== ::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureRequest::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureRequest, image_id) == 16);
template <>
struct IsFidlType<::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureResponse> : public std::true_type {};
static_assert(sizeof(::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureResponse)
== ::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureResponse::PrimarySize);
static_assert(offsetof(::llcpp::fuchsia::hardware::display::Controller::ReleaseCaptureResponse, result) == 16);
} // namespace fidl
|
be41468dc02fba4b2b6a9b2cd7f19a8220f520c4 | 54360595202a856c974d10aebb7ee9c705c37421 | /Node.hpp | 3a5828443c5c5153d518417ec6f07cba1bb87999 | [] | no_license | mcf171/SocialNetWork | 2e238c4bbcd37446c11395b8100f5f7894ea0a4a | bf01abb8afb546acb1b1a1d07bf17890c19a3a7f | refs/heads/master | 2021-01-10T07:28:59.013002 | 2015-12-26T19:31:24 | 2015-12-26T19:31:24 | 48,357,772 | 0 | 1 | null | 2015-12-26T19:31:24 | 2015-12-21T07:37:26 | C++ | UTF-8 | C++ | false | false | 1,777 | hpp | Node.hpp | //
// Node.h
// SocialNetWork
//
// Created by 王珏 on 15/12/21.
// Copyright © 2015年 王珏. All rights reserved.
//
#ifndef Node_h
#define Node_h
#include <vector>
#include <map>
#include <iostream>
#include "ConstantFile.h"
using namespace std;
class Edge;
class Tree;
class Node{
public:
//vector<Edge*> neighbourEdge;
map<int, Edge*> neighbourEdge;
Tree* MIA;
Node();
Node(int num);
void Init();
~Node();
void insertEdge(int targetPoint, Edge* edge);
status currentStatus;
//Node的影响力
double weight;
double influence;
double ap_node_S_gamma;
double hat_delta_sigma_p;
//Node在图中的序号
int number;
double deta_u;
bool operator < (const Node &target) const{
return this->influence < target.influence;
}
bool operator == (const Node& target)
{
return this->number == target.number;
}
bool operator == (Node* target)
{
return this->number == target->number;
}
bool operator != (const Node& target)
{
return this->number != target.number;
}
bool operator < ( Node* target) const
{
return this->influence < target->influence;
}
bool operator <=(const Node& target) const
{
return this->influence <= target.influence;
}
};
Node findNode(map<int, Node> S, int key);
bool findNode(vector<Node> nodes, Node node);
bool findKey(map<int, Node> S, int key);
vector<Node>::const_iterator findNodeIter(vector<Node> nodes, Node node);
vector<int>::const_iterator findIntIter(vector<int> nodes, int nodeid);
#endif /* Node_h */
|
968d5a586987e87cf512a1fe64538a76542d5f66 | e1e93edc0edce83f673f502d25b67796708e2d51 | /include/pam_interface/driver.hxx | a073a59a9cc4b8de171e794a0776e91690c2f210 | [
"BSD-3-Clause"
] | permissive | intelligent-soft-robots/pam_interface | 3ca16b7ad0078eb0e810807505be67976d69865a | d40010b750dcf940018998603a6a870621e06d7c | refs/heads/master | 2023-04-12T04:27:11.985684 | 2023-04-05T09:39:53 | 2023-04-05T09:39:53 | 254,175,310 | 0 | 0 | BSD-3-Clause | 2023-04-05T09:39:55 | 2020-04-08T18:59:18 | C | UTF-8 | C++ | false | false | 1,367 | hxx | driver.hxx |
template <int NB_DOFS>
Driver<NB_DOFS>::Driver(const Configuration<NB_DOFS>& config)
: hw_interface_(nullptr), config_(config)
{
}
template <int NB_DOFS>
Driver<NB_DOFS>::~Driver()
{
hw_interface_->terminate();
}
/**
* Assigns passed pressures of pressure_action to each muscle
* of each degree of freedom via the hardware interface of FPGA.
*
* @tparam NB_DOFS Number of degrees of freedom.
* @param pressure_action Object of PressureAction class specifying
* the pressures values via get-method.
*/
template <int NB_DOFS>
void Driver<NB_DOFS>::in(const PressureAction<2 * NB_DOFS>& pressure_action)
{
int dof;
for (unsigned int actuator = 0; actuator < 2 * NB_DOFS; actuator++)
{
dof = actuator / 2;
int pressure = pressure_action.get(actuator);
if (actuator % 2 == 0)
{
hw_interface_->set_pressure(dof, Sign::AGONIST, pressure);
}
else
{
hw_interface_->set_pressure(dof, Sign::ANTAGONIST, pressure);
}
}
hw_interface_->finalize_iteration();
}
/**
* Fetches all states from hardware interface and
* returns them for each degree of freedom.
*
* @tparam NB_DOFS number of degrees of freedom.
* @return RobotState<NB_DOFS>
*/
template <int NB_DOFS>
RobotState<NB_DOFS> Driver<NB_DOFS>::out()
{
return hw_interface_->get_state();
}
|
d66a74b318aca1edbe57458c21b245aa8317e09a | 2e4fa73aad031a4affea34bbd495338cab898f67 | /1508.cpp | 67a88e0da9e9e327b5b285a012c8136317531655 | [] | no_license | linux-wang/jobdu-onlinejudge | ef9ecafeb0e6e312b664ede2a91c265779e9d2ab | e2b5186cbdc9daddca852ea23f3f0522b73b5dfd | refs/heads/master | 2021-01-10T08:45:33.831221 | 2016-03-28T10:56:07 | 2016-03-28T10:56:07 | 49,616,130 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,057 | cpp | 1508.cpp | /*
url:http://ac.jobdu.com/problem.php?pid=1508
*/
#include<string>
#include<vector>
#include<iostream>
using namespace std;
int is_number(char a)
{
if(a=='1'||a=='2'||a=='3'||a=='4'||a=='5'||a=='6'||a=='7'||a=='8'||a=='9'||a=='0')
return 1;
else
return 0;
}
int is_pm(char a)
{
if(a=='+'||a=='-')
return 1;
else
return 0;
}
void is_right_num(string s)
{
int t;
for(int i=0;i<s.size();i++)
{
if(i==0)
{
if(is_pm(s[i])&&s.size()>1)
{
t=1;
}
else
{
if(is_pm(s[i])&&s.size()==1)
{
cout<<"oh my god";
break;
}
if(is_number(s[i]))
{
t=1;
}
else
{
t=0;
break;
}
}
}
else
{
if(is_number(s[i]))
{
t=1;
}
else
{
t=0;
break;
}
}
}
if(t==1)
{
if(is_pm(s[0]))
{
if(s[0]=='+')
for(int i=1;i<s.size();i++)
{
cout<<s[i];
}
else
cout<<s<<endl;
}
else
{
cout<<s<<endl;
}
}
else
{
cout<<"oh my god"<<endl;
}
}
int main(void)
{
string s;
cin>>s;
is_right_num(s);
}
|
9a8814f06a26c091d43c092f9992df756d79621a | eb335b71da3dc313904a9d637d69fcbec00a1801 | /p2.cpp | 652ed5764d9102d21001a7d74cf1f59f67b94866 | [] | no_license | abhi7631/Cpp | ae85ac14277e9a86ff126f577362dcf9ffbea9e1 | 8e46254dfeee1c2b0291007dd9b29d7213bf2830 | refs/heads/master | 2020-03-13T15:52:13.561588 | 2019-04-18T17:20:36 | 2019-04-18T17:20:36 | 131,185,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,054 | cpp | p2.cpp | #include<iostream>
#include<cmath>
using namespace std;
class Point
{
int xx,yy;
public:
~Point();
Point();
Point(double,double);
void show();
void show1();
void show3(double);
double sum(Point);
};
Point ::~Point()
{
}
Point ::Point()
{
xx=yy=0;
}
Point ::Point(double h,double m)
{
xx=h;
yy=m;
}
void Point:: show()
{
cout<<"value of x1 = "<<xx<<"value of y1 = "<<yy<<endl;
}
void Point:: show1()
{
cout<<"value of x2 = "<<xx<<"value of y2 = "<<yy<<endl;
}
void Point ::show3(double res )
{
cout<<"dist betwm two points = "<<res<<endl;
}
double Point ::sum(Point t)
{
Point c3;
c3.xx=pow((t.xx-xx),2);
c3.yy=pow((t.yy-yy),2);
return (sqrt(c3.xx+c3.yy));
}
main()
{
int xx,yy;
cout<<"enter first time"<<endl;
cin>>xx>>yy;
Point c1(xx,yy),c3;
c1.show();
cout<<"enter second time"<<endl;
cin>>xx>>yy;
Point c2(xx,yy);
c2.show1();
double res=c1.sum(c2);
c3.show3(res);
}
|
4b71b2b56021c1a1552319de6dabff7707388a02 | 9e23b764efe353f1b1b1022b81fc0384ddffa6fa | /framework/node.hpp | 12f39de210a5d747494c38ad54c1350da08853e6 | [
"MIT",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | oanaucs/triangulation | 0e0697a9a071b6c7ec8831a7e1ae3d8202a4c8a0 | 356cc18273d935172312e210133cf18375231764 | refs/heads/master | 2021-06-09T20:15:39.560723 | 2017-02-08T10:42:59 | 2017-02-08T10:42:59 | 79,435,105 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 365 | hpp | node.hpp | #ifndef NODE_HPP
#define NODE_HPP
#include <glm/vec2.hpp>
#include <vector>
class Node
{
public:
Node();
Node(int const number, glm::vec2 const coordinates);
~Node();
int getNumber();
glm::vec2 getCoordinates();
void setNumber(int const number);
void setCoordinates(glm::vec2 const coordinates);
private:
int m_number;
glm::vec2 m_coordinates;
};
#endif |
c4b6763f1f4498c63638d2de9666b40d3570cd13 | 092f83af8daf07844bef4f5c61b1ca7d298488b8 | /libs/game/src/resources.cpp | 31433337a85e85dc091336104e29f3d280e1901d | [
"MIT"
] | permissive | tiaanl/red5 | 1fd0d1ab0f86f8f70fc27d8b7b072d1eb1e956ad | ea7593b38f61f64f8aeb7d58854106bd58c05736 | refs/heads/main | 2023-01-07T05:11:57.569662 | 2020-11-14T19:19:46 | 2020-11-14T19:19:46 | 305,490,400 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,212 | cpp | resources.cpp | #include "game/resources.h"
namespace game {
Resources::Resources(fs::path resourceRoot) : m_resourceRoot{std::move(resourceRoot)} {}
bool Resources::addResourceFile(std::string_view resourceFileName) {
auto path = pathToResourceFile(resourceFileName);
auto entries = ResourceFile{path}.loadEntries();
for (auto& entry : entries) {
// spdlog::info("entry: {} ({})", entry.name(), resourceTypeToString(entry.type()));
m_entries.emplace_back(std::move(entry));
}
return true;
}
ResourceEntry* Resources::findResource(ResourceType type, std::string_view name) {
auto it = std::find_if(std::begin(m_entries), std::end(m_entries),
[&](const ResourceEntry& resourceEntry) {
return resourceEntry.type() == type && resourceEntry.name() == name;
});
if (it == std::end(m_entries)) {
spdlog::warn("Resource not found: {} ({})", name, resourceTypeToString(type));
return nullptr;
}
return &*it;
}
fs::path Resources::pathToResourceFile(std::string_view resourceFileName) {
std::string fileName{resourceFileName};
fileName.append(".LFD");
return m_resourceRoot / fileName;
}
} // namespace game
|
fb80a06ee26048e89bdce4cba1706a1307815cf9 | a093c172823083b98ed177a7b95f21ac66f25c29 | /PGG Assignment 1/entities/Bullet.cpp | e36f19216a3e4c86ce4a5ae1449ef5eed404b313 | [] | no_license | RichardHancock/PGG-Assignment-1 | 431189d9a61f9a4d426bcfc4ed8954beee48b383 | f078517b44479fc171be4a8070deb77cf881f91b | refs/heads/master | 2020-04-17T10:46:39.055468 | 2015-01-19T03:08:27 | 2015-01-19T03:08:27 | 24,952,225 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 290 | cpp | Bullet.cpp | #include "Bullet.h"
Bullet::Bullet(Texture* inputTexture, Vec2 inputPos, bool facingRight)
:EntityWithMotion(inputTexture, inputPos), facingRight(facingRight)
{
}
void Bullet::update(float dt)
{
pos += velocity * dt;
}
void Bullet::render()
{
(*sprite).draw(pos, facingRight);
}
|
8f681fa0b413ce1249dba0b37178b0bdabb83a02 | 377de437f4118aa170855469e30c1468c32bf344 | /source/Needleman/mainNW.cpp | 6dd3f8830668f50c9626484732b82afc6ed793b8 | [] | no_license | nuzelac/Bioinformatika-4Russians | 475da4a9808db7ca1788ede937939862080745f0 | a03967ec008bc6a228f6ab0e20e180b17e8bc9da | refs/heads/master | 2021-01-10T05:53:34.313601 | 2016-01-14T16:58:03 | 2016-01-14T16:58:03 | 49,661,582 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,324 | cpp | mainNW.cpp | /*---------------------------------------------------------------
*
* main.c++ for nw program.
*
* Implements the Needleman-Wunsch algorithm
* for global nucleotide sequence alignment.
*
* Rolf Muertter, rolf@dslextreme.com
* 9/5/2006
*
---------------------------------------------------------------*/
#include "nw.h"
#include <time.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char ** argv)
{
char * program = *argv;
bool prm = true;
if (argc > 2)
{
cerr << "\n Usage: " << program << " inputfile\n";
exit(1);
}
// Sequences to be aligned
string seq_1 = "ATTTGGCA";
string seq_2 = "TCGGA";
string seq_1_al;
string seq_2_al;
string text;
// Aligned sequences
ifstream infile(argv[1]);
if (!infile.is_open()) {
cout << " Failed to open file" << endl;
}
else {
cout << "Opened OK" << endl;
}
int cnt = 0;
while (!infile.eof()) // To get you all the lines.
{
getline(infile, text); // Saves the line in STRING.
if (cnt == 0)
seq_1 = text;
else if (cnt == 1)
seq_2 = text;
cnt++;
}
infile.close();
const clock_t begin_time = clock();
nw(seq_1, seq_2, seq_1_al, seq_2_al, prm);
std::cout <<"Min distance calculation time:" <<float(clock() - begin_time) / CLOCKS_PER_SEC << "sec";
getchar();
return 0;
}
|
eb41adbbf7a2eb9148db2fd587bc59713448381e | c534c34d907cce01d6d45ef3725f8e564b37200a | /cs3/svn/Lab3/testCollection.cpp | fd403293d2d7e6fcfcf46597ab83d78ec5716e26 | [] | no_license | PJ-Leyden/cs_projects | 4b32904a22b9d0b326a05b261eed60d6001126bf | 46b40d9364d2eff7e205e8316bd33622ecbf607a | refs/heads/master | 2021-06-11T21:10:49.365719 | 2019-12-06T00:04:32 | 2019-12-06T00:04:32 | 149,900,613 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 2,562 | cpp | testCollection.cpp | // testing the implementation of templated list collection
// Mikhail Nesterenko
// 9/10/2015
#include <iostream>
#include <string>
#include "list.hpp" // template definition
using std::cout; using std::endl;
using std::string;
int main(){
// manipulating integers
Collection<int> cone;
cout << "Integer collection: ";
cone.addItem(1); cone.addItem(2); cone.addItem(3);
cone.printCollection();
cone.removeItem(2);
cone.printCollection();
if(equal(cone, cone))
cout << "cone is equal to itself" << endl;
// uncomment when you debug the code above
// manipulating strings
string sa[] = {"yellow", "orange", "green", "blue"};
Collection<string> ctwo;
for(auto s : sa)
ctwo.addItem(s);
cout << "String collection: ";
ctwo.printCollection();
// manipulating character collections
// individal collections
Collection<char> a2g, h2n, o2u;
for(char c='a'; c <='g'; ++c) a2g.addItem(c);
for(char c='h'; c <='n'; ++c) h2n.addItem(c);
for(char c='o'; c <='u'; ++c) o2u.addItem(c);
if(!equal(a2g, h2n))
cout << "a2g is not equal to h2n" << endl;
// collection of collections
Collection<Collection<char>> cpile;
// adding individual collections
cpile.addItem(a2g);
cpile.addItem(h2n);
cpile.addItem(o2u);
// printing characters from last collection added
cout << "Last added character collection: ";
cpile.lastItem().printCollection();
Collection<int> col;
col.addItem(5); col.addItem(5); col.addItem(5);
col.addItem(2);
col.addItem(5);
col.addItem(2);
col.addItem(5); col.addItem(5);
std::cout << "Init: ";
col.printCollection();
//std::cout << "=================================\n";
//col.debugPrint();
//std::cout << "=================================\n";
std::cout << '\n';
col.removeItem(5);
std::cout << "Removed 5: ";
col.printCollection();
//std::cout << "=================================\n";
//col.debugPrint();
//std::cout << "=================================\n";
std::cout << '\n';
col.removeItem(2);
std::cout << "Removed 2: ";
col.printCollection();
//std::cout << "=================================\n";
//col.debugPrint();
//std::cout << "=================================\n";
std::cout << '\n';
col.removeItem(3);
std::cout << "Removed 3: ";
col.printCollection();
//std::cout << "=================================\n";
//col.debugPrint();
//std::cout << "=================================\n";
std::cout << '\n';
}
|
f71e640f4a1bb1108453a3689135327ec16d5ba3 | 827405b8f9a56632db9f78ea6709efb137738b9d | /CodingWebsites/LeetCode/CPP/Volume2/189.cpp | c704662fc7e3bde5c749226ddb6db7de79aa2a4c | [] | no_license | MingzhenY/code-warehouse | 2ae037a671f952201cf9ca13992e58718d11a704 | d87f0baa6529f76e41a448b8056e1f7ca0ab3fe7 | refs/heads/master | 2020-03-17T14:59:30.425939 | 2019-02-10T17:12:36 | 2019-02-10T17:12:36 | 133,694,119 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,221 | cpp | 189.cpp | #include <cstdlib>
#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <list>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
if(!n) return;
k %= n;
if(!k) return;
// k * C = 0 (mod n)
//There are G cicles with C elements each
int G = gcd(k,n);
int C = n / G;
for(int i = 0 ; i < G ; i++){
int j = i;
int V = nums[j];
for(int t = 0 ; t < C ; t++){
int nextj = (j + k) % n;
int nV = nums[nextj];
nums[nextj] = V;
V = nV;
j = nextj;
}
}
}
int gcd(int x,int y){
while(y){
int t = x % y;
x = y;
y = t;
}
return x;
}
void Test(){
vector<int> V = {1,2,3,4,5,6};
rotate(V,4);
for(auto x:V){
cout<<x<<" ";
}
cout<<endl;
}
};
int main(){
Solution S;
S.Test();
return 0;
}
|
bd39b2c746d83df72f84ef1f160c5b7b123b1e4f | a5a99f646e371b45974a6fb6ccc06b0a674818f2 | /Alignment/TwoBodyDecay/interface/TwoBodyDecay.h | 3935fd0e50c15a16b442b204340f13fbc278de25 | [
"Apache-2.0"
] | permissive | cms-sw/cmssw | 4ecd2c1105d59c66d385551230542c6615b9ab58 | 19c178740257eb48367778593da55dcad08b7a4f | refs/heads/master | 2023-08-23T21:57:42.491143 | 2023-08-22T20:22:40 | 2023-08-22T20:22:40 | 10,969,551 | 1,006 | 3,696 | Apache-2.0 | 2023-09-14T19:14:28 | 2013-06-26T14:09:07 | C++ | UTF-8 | C++ | false | false | 2,087 | h | TwoBodyDecay.h | #ifndef Alignment_TwoBodyDecay_TwoBodyDecay_h
#define Alignment_TwoBodyDecay_TwoBodyDecay_h
#include "Alignment/TwoBodyDecay/interface/TwoBodyDecayParameters.h"
#include "Alignment/TwoBodyDecay/interface/TwoBodyDecayVirtualMeasurement.h"
/** /class TwoBodyDecay
*
* Container-class for all information associated with a two-body decay
* (estimated parameters, chi2 of the fit, validity-flag).
*
* /author Edmund Widl
*/
class TwoBodyDecay {
public:
typedef TwoBodyDecayParameters::ParameterName ParameterName;
TwoBodyDecay(void)
: theDecayParameters(), theChi2(0.), theValidityFlag(false), thePrimaryMass(0.), thePrimaryWidth(0.) {}
TwoBodyDecay(const TwoBodyDecayParameters ¶m, double chi2, bool valid, const TwoBodyDecayVirtualMeasurement &vm)
: theDecayParameters(param),
theChi2(chi2),
theValidityFlag(valid),
thePrimaryMass(vm.primaryMass()),
thePrimaryWidth(vm.primaryWidth()) {}
~TwoBodyDecay(void) {}
inline const TwoBodyDecayParameters &decayParameters(void) const { return theDecayParameters; }
inline const AlgebraicVector ¶meters(void) const { return theDecayParameters.parameters(); }
inline const AlgebraicSymMatrix &covariance(void) const { return theDecayParameters.covariance(); }
/// Get specified decay parameter.
inline double operator[](ParameterName name) const { return theDecayParameters[name]; }
/// Get specified decay parameter.
inline double operator()(ParameterName name) const { return theDecayParameters(name); }
inline bool hasError(void) const { return theDecayParameters.hasError(); }
inline double chi2(void) const { return theChi2; }
inline bool isValid(void) const { return theValidityFlag; }
inline void setInvalid(void) { theValidityFlag = false; }
inline double primaryMass(void) const { return thePrimaryMass; }
inline double primaryWidth(void) const { return thePrimaryWidth; }
private:
TwoBodyDecayParameters theDecayParameters;
double theChi2;
bool theValidityFlag;
double thePrimaryMass;
double thePrimaryWidth;
};
#endif
|
7916eb97882ab2e5fcf94aef4836814142356e81 | 9c079c10fb9f90ff15181b3bdd50ea0435fbc0cd | /Codeforces/864B.cpp | 2df8ced159f3282420bb0937cc06f96d505bd7eb | [] | no_license | shihab122/Competitive-Programming | 73d5bd89a97f28c8358796367277c9234caaa9a4 | 37b94d267fa03edf02110fd930fb9d80fbbe6552 | refs/heads/master | 2023-04-02T20:57:50.685625 | 2023-03-25T09:47:13 | 2023-03-25T09:47:13 | 148,019,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 487 | cpp | 864B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,mx=0,c=0;
scanf("%d",&n);
string a;
cin>>a;
char v;
map<char,int>mymap;
for(int i=0;i<a.size();i++){
if(a[i]>='A'&&a[i]<='Z'){
mx=max(mx,c);
c=0;
mymap.clear();
}
else if(mymap[a[i]]==0){
mymap[a[i]]=1;
c++;
}
else if(v==a[i]) continue;
}
printf("%d\n",max(mx,c));
return 0;
}
|
21e16346caedaa9134060d16e007e7b79506277f | 4048dc505f87f5dc27fd8a8c920e51cd72e44aa2 | /applications/digedag.v2-CR/src/checkpoint.hpp | 827d6fea5296103294680d4bc8d1e689e79096b3 | [] | no_license | saga-project/saga-cpp-legacy-projects | 007af3860994a3f10c7163b4b271cccd7eb10eb8 | 2874ff6714776ee721a46f5b68f317e0d1dbfbf9 | refs/heads/master | 2023-04-05T00:47:38.636238 | 2023-03-31T14:47:42 | 2023-03-31T14:47:42 | 5,780,249 | 0 | 3 | null | 2023-03-31T14:47:43 | 2012-09-12T13:38:02 | TeX | UTF-8 | C++ | false | false | 2,362 | hpp | checkpoint.hpp | /*
# Copyright (c) 2010 Katerina Stamou (kstamou@cct.lsu.edu)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef DIGEDAG_CHECKPOINT_HPP
#define DIGEDAG_CHECKPOINT_HPP
#include <saga/saga.hpp>
#include "config.hpp"
#include "dag.hpp"
#include "node.hpp"
#include "edge.hpp"
#include "enum.hpp"
#include "util/hash.hpp"
#include "util/scoped_lock.hpp"
#include <boost/dynamic_bitset.hpp>
namespace digedag
{
class checkpoint_mgr
{
private:
boost::dynamic_bitset<> nodeset;
boost::dynamic_bitset<> edgeset;
bool dagcomplete;
struct checkpoint_conf_t
{
bool compress;
bool verbose;
bool hashlog;
checkpoint_method method;
std::string filename;
std::string filepath;
} checkpoint_;
void dumptofile (void);
void dumptoadvert (void);
void restorefromfile (std::map <node_id_t, node_map_t> &dag_nodes, std::map <edge_id_t, edge_map_t> &dag_edges);
void restorefromadvert (void);
public:
checkpoint_mgr ();
~checkpoint_mgr (void);
void set_dag_size (int node_size, int edge_size);
void set_file (std::string daghash);
std::string get_filename (void);
void set_filepath (std::string fpath);
void set_verbose (bool flag);
bool get_verbose (void);
void set_compress (bool flag);
bool get_compress (void);
void set_hashlog (bool flag);
bool get_hashlog (void);
void set_method (checkpoint_method m);
checkpoint_method get_method (void);
void node_commit (boost::shared_ptr <node> n, std::map <node_id_t, node_map_t> dag_nodes);
void edge_commit (boost::shared_ptr <edge> e, std::map <edge_id_t, edge_map_t> dag_edges);
void dump (std::map <node_id_t, node_map_t> dag_nodes, std::map <edge_id_t, edge_map_t> dag_edges);
void restore (std::map <node_id_t, node_map_t> &dag_nodes, std::map <edge_id_t, edge_map_t> &dag_edges);
void dag_complete (void);
};
} // namespace digedag
#endif // DIGEDAG_CHECKPOINT_HPP
|
9444a0eeaea7b8158c71e302c0dcbc00b57e171e | 54f52c08f92c48072465ffea27551cc023ba3e0a | /src/gui/AdicionarEsferasSistematicamenteDialog.cpp | be89b94e00648856130256193b32bb4f930a7b4f | [] | no_license | lucassimao/Simulacao-Estereologica | e744a5a545a76af67095bb2bf079bcce8c4b0179 | 44ebd4720b3c7108d2106ff1a38a3e2e609db1de | refs/heads/master | 2020-05-17T13:29:55.260804 | 2012-02-26T15:19:52 | 2012-02-26T15:19:52 | 346,206 | 1 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 7,002 | cpp | AdicionarEsferasSistematicamenteDialog.cpp | #include <QDialog>
#include <QtGui>
#include <QDebug>
#include <QMessageBox>
#include "ColorListEditor.h"
#include "TextBoxDelegate.h"
#include "AdicionarEsferasSistematicamenteDialog.h"
#include "..\model\SimulacaoCaixa.h"
#include "..\model\atores\Esfera.h"
using namespace simulacao::gui;
using namespace simulacao::model;
using namespace simulacao::model::atores;
AdicionarEsferasSistematicamenteDialog::AdicionarEsferasSistematicamenteDialog(QWidget *parent, SimulacaoCaixa *simulacao):QDialog(parent){
ui = new Ui_AdicionarEsferasSistematicamenteDialog();
ui->setupUi(this);
this->command = 0;
this->simulacao = simulacao;
this->raise();
QIntValidator *valQuantidade = new QIntValidator(this);
valQuantidade->setBottom(0);
QDoubleValidator *valPercentual = new QDoubleValidator(this);
valPercentual->setBottom(0);
valPercentual->setDecimals(10);
valPercentual->setTop(100);
ui->textFaseSolida->setValidator(valPercentual);
ui->textFaseSolida->setText("50");
QItemEditorFactory *factory = new QItemEditorFactory;
QItemEditorCreatorBase *colorListCreator = new QStandardItemEditorCreator<ColorListEditor>();
factory->registerEditor(QVariant::Color, colorListCreator);
QItemEditorFactory::setDefaultFactory(factory);
model = new QStandardItemModel(0,4,this);
model->setHeaderData( COLUNA_RAIO, Qt::Horizontal, QObject::tr("Raio") );
model->setHeaderData( COLUNA_PORCENTAGEM, Qt::Horizontal, QObject::tr("Porcentagem") );
model->setHeaderData( COLUNA_QUANTIDADE, Qt::Horizontal, QObject::tr("Quantidade") );
model->setHeaderData( COLUNA_COR, Qt::Horizontal, QObject::tr("Cor") );
ui->tableEspecificacao->setModel(model);
ui->tableEspecificacao->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableEspecificacao->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableEspecificacao->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
TextBoxDelegate *textBox = new TextBoxDelegate(valPercentual);
TextBoxDelegate *textBox2 = new TextBoxDelegate(valQuantidade);
ui->tableEspecificacao->setItemDelegateForColumn(0,textBox);
ui->tableEspecificacao->setItemDelegateForColumn(1,textBox);
ui->tableEspecificacao->setItemDelegateForColumn(2,textBox2);
ui->tableEspecificacao->setColumnWidth(3,160);
connect(model,SIGNAL(itemChanged(QStandardItem *)),this,SLOT(manterProporcaoEntrePorcentagemEQuantidade(QStandardItem *)));
connect(ui->textFaseSolida,SIGNAL(textChanged (const QString &)),this,SLOT(manterProporcaoEntrePorcentagemEQuantidade()));
}
void AdicionarEsferasSistematicamenteDialog::manterProporcaoEntrePorcentagemEQuantidade(){
QStandardItem *item;
for(int i=0;i< this->model->rowCount();++i)
{
item = this->model->item(i,COLUNA_PORCENTAGEM);
manterProporcaoEntrePorcentagemEQuantidade(item);
}
}
void AdicionarEsferasSistematicamenteDialog::manterProporcaoEntrePorcentagemEQuantidade(QStandardItem *item){
int row = item->row();
QModelIndex colunaPorcentagem = this->model->index(row,COLUNA_PORCENTAGEM);
QModelIndex colunaQtde = this->model->index(row,COLUNA_QUANTIDADE);
double porcentagem = this->model->data(colunaPorcentagem, Qt::DisplayRole).toDouble();
double porcentagemFaseSolida = getPorcentagemFaseSolida();
double raio = getRaio(row);
double volumeTotalDaCaixa = this->simulacao->getVolumeDaCaixa();
double volumeDaFaseSolida = (volumeTotalDaCaixa * porcentagemFaseSolida)/100.0;
double volumeDeUmaEsfera = Esfera::calcularVolume(raio);
this->model->blockSignals(true);
switch(item->column()){
case COLUNA_QUANTIDADE:
{
int qtde = this->model->data(colunaQtde, Qt::DisplayRole).toInt();
double volumeTotalDasEsferas = qtde*volumeDeUmaEsfera;
double porcentagemDaFaseSolida = (100.0 * volumeTotalDasEsferas)/volumeDaFaseSolida;
if (porcentagemDaFaseSolida>0) this->model->setData(colunaPorcentagem,QVariant(porcentagemDaFaseSolida));
}
break;
default:
{
double volumeTotalDasEsferas = (porcentagem*volumeDaFaseSolida)/100.0;
if (volumeDeUmaEsfera>0){
int qtde = volumeTotalDasEsferas/volumeDeUmaEsfera;
this->model->setData(colunaQtde,QVariant(qtde));
}
}
break;
}
this->model->blockSignals(false);
}
double AdicionarEsferasSistematicamenteDialog::getPorcentagemFaseSolida(){
bool valorValido = false;
double porcentagemFaseSolida = ui->textFaseSolida->text().toDouble(&valorValido);
if (valorValido)
return porcentagemFaseSolida;
else return 0;
}
double AdicionarEsferasSistematicamenteDialog::getRaio(int linha){
QModelIndex coluna = this->model->index(linha,COLUNA_RAIO);
return this->model->data(coluna, Qt::DisplayRole).toDouble();
}
void AdicionarEsferasSistematicamenteDialog::adicionarDescricao(){
int row = model->rowCount();
model->insertRow(row);
QModelIndex cell1 = model->index(row,COLUNA_RAIO);
QModelIndex cell2 = model->index(row,COLUNA_PORCENTAGEM);
QModelIndex cell3 = model->index(row,COLUNA_QUANTIDADE);
QModelIndex cell4 = model->index(row,COLUNA_COR);
model->setData(cell1,QVariant(0.0));
model->setData(cell2,QVariant(0.0));
model->setData(cell3,QVariant(0.0));
model->setData(cell4,QColor("red"));
}
void AdicionarEsferasSistematicamenteDialog::removerDescricao(){
QItemSelectionModel *selectionModel = ui->tableEspecificacao->selectionModel();
QModelIndexList list = selectionModel->selectedRows();
if (list.size()==0)
{
QMessageBox *msg = new QMessageBox(QMessageBox::Information,tr("Informação"),
tr("Selecione primeiro a linha na tabela que deseja excluir"),QMessageBox::Ok,this);
msg->show();
}
else{
// como apenas um item estara selecionado devido configurações anteriores ...
QModelIndex index = list.at(0);
this->model->removeRow(index.row());
}
}
void AdicionarEsferasSistematicamenteDialog::sair(){
this->reject();
}
void AdicionarEsferasSistematicamenteDialog::adicionarEsferas(){
bool valorValido = false;
double porcentagemFaseSolida = ui->textFaseSolida->text().toDouble(&valorValido);
if (valorValido){
int linhas = this->model->rowCount();
command = new AdicionarObjetosCommand(this->simulacao,porcentagemFaseSolida);
for(int row=0;row<linhas;++row){
QModelIndex colunaRaio = this->model->index(row,COLUNA_RAIO);
QModelIndex colunaCor = this->model->index(row,COLUNA_COR);
QModelIndex colunaPorcentagem = this->model->index(row,COLUNA_PORCENTAGEM);
double raio = this->model->data(colunaRaio, Qt::DisplayRole).toDouble();
QColor cor = qVariantValue<QColor>(this->model->data(colunaCor, Qt::DisplayRole));
double porcentagem = this->model->data(colunaPorcentagem, Qt::DisplayRole).toDouble();
Cor c = {cor.red()/255.0f,cor.green()/255.0f,cor.blue()/255.0f};
command->adicionarEsferas(raio,porcentagem,c);
}
this->accept();
}
else
{
QMessageBox *msg = new QMessageBox(QMessageBox::Information,tr("Informação"),
tr("Forneça a porcentagem da fase sólida!"),QMessageBox::Ok,this);
ui->textFaseSolida->setFocus();
msg->show();
}
} |
6dc1eacb1da37d2c855d26eb6ab4b36088469203 | eb8a7687ff25da18b068eb7bd65b73574aa6f8d6 | /GuitarTabStudio/GuitarEventFactory.h | 5e76bf6737aa2d7fd595ae3ba8ae17988adee1dc | [] | no_license | stasokrosh/guitar-tab-studio | 3d8231275c636dd2432434df91b694e56ac45234 | 75087031c3df8247b776cd8054f56cd00f877be7 | refs/heads/master | 2021-09-13T10:46:43.638314 | 2018-04-28T14:39:45 | 2018-04-28T14:39:45 | 111,589,754 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 264 | h | GuitarEventFactory.h | #pragma once
#include "EventFactory.h"
#include "GuitarEvent.h"
class GuitarEventFactory :
public EventFactory {
public:
GuitarEventFactory(Guitar* guitar);
~GuitarEventFactory();
virtual Event* createEvent(EventInfo eventInfo);
private:
Guitar* guitar;
};
|
4a27f9293a730865efb7535ffc157277a818bc21 | e572fe7da635214a975ab8aebd4a8e8565183d60 | /populating-next-right-pointers-in-each-node-ii.cpp | 299d0df7ea6a3b826f121bb3c035c30b633f1b78 | [] | no_license | LloydSSS/LintCode-LeetCode | 3713dc63019fbf4af8dbb9b21c72c1d03874893f | fb55572a219f51e015672768090cbda1edcef707 | refs/heads/master | 2020-12-25T22:58:26.399559 | 2015-09-14T16:09:18 | 2015-09-14T16:09:18 | 35,087,006 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,473 | cpp | populating-next-right-pointers-in-each-node-ii.cpp | // https://leetcode.com/problems/populating-next-right-pointers-in-each-node/
// 一般二叉树
// 对于每个节点
// 如果它没有孩子,直接返回
// 如果有两个孩子,将左孩子的next指向右孩子
// 将剩下孩子的next指向父亲兄弟的第一个孩子
// 注意要处理右孩子,再处理左孩子否则上一步无法进行
#include "lc.h"
// Definition for binary tree with next pointer.
struct TreeLinkNode {
int val;
TreeLinkNode *left, *right, *next;
TreeLinkNode(int x) : val(x), left(nullptr), right(nullptr), next(nullptr) {}
};
class Solution {
public:
void connect(TreeLinkNode *root) {
if (root == NULL)
return;
if (root->left == NULL && root->right == NULL)
return;
if (root->left != NULL && root->right != NULL)
root->left->next = root->right;
TreeLinkNode *root_next = root->next;
TreeLinkNode *last = root->right != NULL ? root->right : root->left;
while (root_next != NULL) {
if (root_next->left != NULL) {
last->next = root_next->left;
break;
}
if (root_next->right != NULL) {
last->next = root_next->right;
break;
}
root_next = root_next->next;
}
connect(root->right);
connect(root->left);
}
};
int main(int argc, char const *argv[]) {
Solution sol;
return 0;
}
|
53da79f81f767418cd7f55346e0f8f8e9b144fd0 | a696549255433a0d499d7c5dda18d3128ab66055 | /src/rdb_protocol/batching.hpp | 307517cb3e742e68e7fd529e9bc4cbc81b8ffb16 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | dk-dev/rethinkdb | 90cdfdff672a2693842f779d21d60d87c290a39d | bb4f5cc28242dc1e29e9a46a8a931ec54420070c | refs/heads/next | 2022-03-14T15:43:50.758116 | 2021-11-30T02:49:09 | 2022-02-20T22:47:44 | 12,976,019 | 0 | 0 | Apache-2.0 | 2022-02-21T01:10:42 | 2013-09-20T14:50:36 | C++ | UTF-8 | C++ | false | false | 4,667 | hpp | batching.hpp | // Copyright 2010-2014 RethinkDB, all rights reserved.
#ifndef RDB_PROTOCOL_BATCHING_HPP_
#define RDB_PROTOCOL_BATCHING_HPP_
#include <utility>
#include "btree/keys.hpp"
#include "containers/archive/archive.hpp"
#include "containers/archive/versioned.hpp"
#include "containers/optional.hpp"
#include "rdb_protocol/datum.hpp"
#include "rpc/serialize_macros.hpp"
#include "time.hpp"
template<class T>
class counted_t;
namespace ql {
class datum_t;
class env_t;
enum class batch_type_t {
// A normal batch.
NORMAL = 0,
// The first batch in a series of normal batches. The size limit is reduced
// to help minimizing the latency until a user receives their first response.
NORMAL_FIRST = 1,
// A batch fetched for a terminal or terminal-like term, e.g. a big batched
// insert. Ignores latency caps because the latency the user encounters is
// determined by bandwidth instead.
TERMINAL = 2,
// If we're ordering by an sindex, get a batch with a constant value for
// that sindex. We sometimes need a batch with that invariant for sorting.
// (This replaces that SORTING_HINT_NEXT stuff.)
SINDEX_CONSTANT = 3
};
ARCHIVE_PRIM_MAKE_RANGED_SERIALIZABLE(
batch_type_t, int8_t, batch_type_t::NORMAL, batch_type_t::SINDEX_CONSTANT);
enum ignore_latency_t { NO, YES };
class batcher_t {
public:
bool note_el(const datum_t &t) {
seen_one_el = true;
els_left -= 1;
min_els_left -= 1;
size_left -= serialized_size<cluster_version_t::CLUSTER>(t);
return should_send_batch();
}
bool should_send_batch(
ignore_latency_t ignore_latency = ignore_latency_t::NO) const;
batcher_t(batcher_t &&other) :
batch_type(std::move(other.batch_type)),
seen_one_el(std::move(other.seen_one_el)),
min_els_left(std::move(other.min_els_left)),
els_left(std::move(other.els_left)),
size_left(std::move(other.size_left)),
end_time(std::move(other.end_time)) { }
kiloticks_t kiloticks_left() {
kiloticks_t cur_time = get_kiloticks();
return kiloticks_t{end_time.micros > cur_time.micros ?
end_time.micros - cur_time.micros :
0};
}
batch_type_t get_batch_type() { return batch_type; }
private:
DISABLE_COPYING(batcher_t);
friend class batchspec_t;
batcher_t(batch_type_t batch_type, int64_t min_els, int64_t max_els,
int64_t max_size, kiloticks_t end_time);
const batch_type_t batch_type;
bool seen_one_el;
int64_t min_els_left, els_left, size_left;
const kiloticks_t end_time;
};
class batchspec_t {
public:
static batchspec_t user(batch_type_t batch_type, env_t *env);
static batchspec_t all(); // Gimme everything.
static batchspec_t empty() { return batchspec_t(); }
static batchspec_t default_for(batch_type_t batch_type);
batch_type_t get_batch_type() const { return batch_type; }
batchspec_t with_new_batch_type(batch_type_t new_batch_type) const;
batchspec_t with_min_els(int64_t new_min_els) const;
batchspec_t with_max_dur(kiloticks_t new_max_dur) const;
batchspec_t with_at_most(uint64_t max_els) const;
// These are used to allow batchspecs to override the default ordering on a
// stream. This is only really useful when a stream is being treated as a
// set, as in the case of `include_initial` changefeeds where always using
// `ASCENDING` ordering allows the logic to be simpler.
batchspec_t with_lazy_sorting_override(sorting_t sort) const;
sorting_t lazy_sorting(sorting_t base) const {
return lazy_sorting_override.value_or(base);
}
batchspec_t scale_down(int64_t divisor) const;
batcher_t to_batcher() const;
private:
// I made this private and accessible through a static function because it
// was being accidentally default-initialized.
batchspec_t() { } // USE ONLY FOR SERIALIZATION
batchspec_t(batch_type_t batch_type, int64_t min_els, int64_t max_els,
int64_t max_size, int64_t first_scaledown,
kiloticks_t max_dur, kiloticks_t start_time);
template<cluster_version_t W>
friend void serialize(write_message_t *wm, const batchspec_t &batchspec);
template<cluster_version_t W>
friend archive_result_t deserialize(read_stream_t *s, batchspec_t *batchspec);
batch_type_t batch_type;
int64_t min_els, max_els, max_size, first_scaledown_factor;
kiloticks_t max_dur;
kiloticks_t start_time;
optional<sorting_t> lazy_sorting_override;
};
RDB_DECLARE_SERIALIZABLE(batchspec_t);
} // namespace ql
#endif // RDB_PROTOCOL_BATCHING_HPP_
|
429b5ab3cb2505ece4bd79dc3932b74813dfe3bf | 5ddad2a210ea87f427f0ddc7b42c91464fa169a3 | /src/c/schemas/ModioModfile.cpp | 41d6dbf9c93fae2d6da34579c9f0e9b95c1b2023 | [
"MIT"
] | permissive | nlspartanNL/SDK | 877478fda8dc342c2f39453d9a5022c9e4a0b64c | 291f1e5869210baedbb5447f8f7388f50ec93950 | refs/heads/master | 2022-06-19T21:09:35.725926 | 2019-12-09T23:17:26 | 2019-12-09T23:17:26 | 236,233,205 | 1 | 0 | MIT | 2020-01-25T21:36:57 | 2020-01-25T21:36:56 | null | UTF-8 | C++ | false | false | 3,394 | cpp | ModioModfile.cpp | #include "c/schemas/ModioModfile.h"
extern "C"
{
void modioInitModfile(ModioModfile* modfile, nlohmann::json modfile_json)
{
modfile->id = 0;
if(modio::hasKey(modfile_json, "id"))
modfile->id = modfile_json["id"];
modfile->mod_id = 0;
if(modio::hasKey(modfile_json, "mod_id"))
modfile->mod_id = modfile_json["mod_id"];
modfile->virus_status = 0;
if(modio::hasKey(modfile_json, "virus_status"))
modfile->virus_status = modfile_json["virus_status"];
modfile->virus_positive = 0;
if(modio::hasKey(modfile_json, "virus_positive"))
modfile->virus_positive = modfile_json["virus_positive"];
modfile->date_added = 0;
if(modio::hasKey(modfile_json, "date_added"))
modfile->date_added = modfile_json["date_added"];
modfile->date_scanned = 0;
if(modio::hasKey(modfile_json, "date_scanned"))
modfile->date_scanned = modfile_json["date_scanned"];
modfile->filesize = 0;
if(modio::hasKey(modfile_json, "filesize"))
modfile->filesize = modfile_json["filesize"];
modfile->filename = NULL;
if(modio::hasKey(modfile_json, "filename"))
{
std::string filename_str = modfile_json["filename"];
modfile->filename = new char[filename_str.size() + 1];
strcpy(modfile->filename, filename_str.c_str());
}
modfile->version = NULL;
if(modio::hasKey(modfile_json, "version"))
{
std::string version_str = modfile_json["version"];
modfile->version = new char[version_str.size() + 1];
strcpy(modfile->version, version_str.c_str());
}
modfile->virustotal_hash = NULL;
if(modio::hasKey(modfile_json, "virustotal_hash"))
{
std::string virustotal_hash_str = modfile_json["virustotal_hash"];
modfile->virustotal_hash = new char[virustotal_hash_str.size() + 1];
strcpy(modfile->virustotal_hash, virustotal_hash_str.c_str());
}
modfile->changelog = NULL;
if(modio::hasKey(modfile_json, "changelog"))
{
std::string changelog_str = modfile_json["changelog"];
modfile->changelog = new char[changelog_str.size() + 1];
strcpy(modfile->changelog, changelog_str.c_str());
}
modfile->metadata_blob = NULL;
if(modio::hasKey(modfile_json, "metadata_blob"))
{
std::string metadata_blob_str = modfile_json["metadata_blob"];
modfile->metadata_blob = new char[metadata_blob_str.size() + 1];
strcpy(modfile->metadata_blob, metadata_blob_str.c_str());
}
nlohmann::json filehash_json;
if(modio::hasKey(modfile_json, "filehash"))
filehash_json = modfile_json["filehash"];
modioInitFilehash(&(modfile->filehash), filehash_json);
nlohmann::json download_json;
if(modio::hasKey(modfile_json, "download"))
download_json = modfile_json["download"];
modioInitDownload(&(modfile->download), download_json);
}
void modioFreeModfile(ModioModfile* modfile)
{
if(modfile)
{
if(modfile->filename)
delete[] modfile->filename;
if(modfile->version)
delete[] modfile->version;
if(modfile->virustotal_hash)
delete[] modfile->virustotal_hash;
if(modfile->changelog)
delete[] modfile->changelog;
if(modfile->metadata_blob)
delete[] modfile->metadata_blob;
modioFreeFilehash(&(modfile->filehash));
modioFreeDownload(&(modfile->download));
}
}
}
|
1e9c008c1e9aa3a32d15b8e7f720f4db331e6bc8 | 424c7098a182cb3f67f334765a225d0531a0d5a5 | /java/c/src/main/cpp/jni_wrapper.cc | cfb0af9bcbb0b1480859ca527f0df62b2f392888 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"BSD-2-Clause",
"JSON",
"OpenSSL",
"CC-BY-3.0",
"NTP",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LLVM-exception",
"Zlib",
"CC-BY-4.0",
"LicenseRef-scancode-protobuf",
"ZPL-2.1",
"BSL-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | romainfrancois/arrow | 08b7d1ae810438c8507c50ba33a9cabc35b4ee74 | 8cebc4948ab5c5792c20a3f463e2043e01c49828 | refs/heads/master | 2022-03-12T02:08:17.793883 | 2021-12-05T06:19:46 | 2021-12-05T06:19:46 | 124,081,421 | 16 | 3 | Apache-2.0 | 2018-03-06T13:21:29 | 2018-03-06T13:21:28 | null | UTF-8 | C++ | false | false | 7,840 | cc | jni_wrapper.cc | // 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.
#include <jni.h>
#include <cassert>
#include <memory>
#include <stdexcept>
#include <string>
#include "./abi.h"
#include "org_apache_arrow_c_jni_JniWrapper.h"
namespace {
jclass CreateGlobalClassReference(JNIEnv* env, const char* class_name) {
jclass local_class = env->FindClass(class_name);
jclass global_class = (jclass)env->NewGlobalRef(local_class);
env->DeleteLocalRef(local_class);
return global_class;
}
jclass illegal_access_exception_class;
jclass illegal_argument_exception_class;
jclass runtime_exception_class;
jclass private_data_class;
jmethodID private_data_close_method;
jint JNI_VERSION = JNI_VERSION_1_6;
class JniPendingException : public std::runtime_error {
public:
explicit JniPendingException(const std::string& arg) : std::runtime_error(arg) {}
};
void ThrowPendingException(const std::string& message) {
throw JniPendingException(message);
}
void JniThrow(std::string message) { ThrowPendingException(message); }
jmethodID GetMethodID(JNIEnv* env, jclass this_class, const char* name, const char* sig) {
jmethodID ret = env->GetMethodID(this_class, name, sig);
if (ret == nullptr) {
std::string error_message = "Unable to find method " + std::string(name) +
" within signature " + std::string(sig);
ThrowPendingException(error_message);
}
return ret;
}
class InnerPrivateData {
public:
InnerPrivateData(JavaVM* vm, jobject private_data)
: vm_(vm), j_private_data_(private_data) {}
JavaVM* vm_;
jobject j_private_data_;
};
class JNIEnvGuard {
public:
explicit JNIEnvGuard(JavaVM* vm) : vm_(vm), should_detach_(false) {
JNIEnv* env;
jint code = vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION);
if (code == JNI_EDETACHED) {
JavaVMAttachArgs args;
args.version = JNI_VERSION;
args.name = NULL;
args.group = NULL;
code = vm->AttachCurrentThread(reinterpret_cast<void**>(&env), &args);
should_detach_ = (code == JNI_OK);
}
if (code != JNI_OK) {
ThrowPendingException("Failed to attach the current thread to a Java VM");
}
env_ = env;
}
JNIEnv* env() { return env_; }
~JNIEnvGuard() {
if (should_detach_) {
vm_->DetachCurrentThread();
should_detach_ = false;
}
}
private:
bool should_detach_;
JavaVM* vm_;
JNIEnv* env_;
};
template <typename T>
void release_exported(T* base) {
// This should not be called on already released structure
assert(base->release != nullptr);
// Release children
for (int64_t i = 0; i < base->n_children; ++i) {
T* child = base->children[i];
if (child->release != nullptr) {
child->release(child);
assert(child->release == nullptr);
}
}
// Release dictionary
T* dict = base->dictionary;
if (dict != nullptr && dict->release != nullptr) {
dict->release(dict);
assert(dict->release == nullptr);
}
// Release all data directly owned by the struct
InnerPrivateData* private_data =
reinterpret_cast<InnerPrivateData*>(base->private_data);
JNIEnvGuard guard(private_data->vm_);
JNIEnv* env = guard.env();
env->CallObjectMethod(private_data->j_private_data_, private_data_close_method);
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
env->ExceptionClear();
ThrowPendingException("Error calling close of private data");
}
env->DeleteGlobalRef(private_data->j_private_data_);
delete private_data;
base->private_data = nullptr;
// Mark released
base->release = nullptr;
}
} // namespace
#define JNI_METHOD_START try {
// macro ended
#define JNI_METHOD_END(fallback_expr) \
} \
catch (JniPendingException & e) { \
env->ThrowNew(runtime_exception_class, e.what()); \
return fallback_expr; \
}
// macro ended
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK) {
return JNI_ERR;
}
JNI_METHOD_START
illegal_access_exception_class =
CreateGlobalClassReference(env, "Ljava/lang/IllegalAccessException;");
illegal_argument_exception_class =
CreateGlobalClassReference(env, "Ljava/lang/IllegalArgumentException;");
runtime_exception_class =
CreateGlobalClassReference(env, "Ljava/lang/RuntimeException;");
private_data_class =
CreateGlobalClassReference(env, "Lorg/apache/arrow/c/jni/PrivateData;");
private_data_close_method = GetMethodID(env, private_data_class, "close", "()V");
return JNI_VERSION;
JNI_METHOD_END(JNI_ERR)
}
void JNI_OnUnload(JavaVM* vm, void* reserved) {
JNIEnv* env;
vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION);
env->DeleteGlobalRef(illegal_access_exception_class);
env->DeleteGlobalRef(illegal_argument_exception_class);
env->DeleteGlobalRef(runtime_exception_class);
}
/*
* Class: org_apache_arrow_c_jni_JniWrapper
* Method: releaseSchema
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_apache_arrow_c_jni_JniWrapper_releaseSchema(
JNIEnv* env, jobject, jlong address) {
JNI_METHOD_START
ArrowSchema* schema = reinterpret_cast<ArrowSchema*>(address);
if (schema->release != nullptr) {
schema->release(schema);
}
JNI_METHOD_END()
}
/*
* Class: org_apache_arrow_c_jni_JniWrapper
* Method: releaseArray
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_org_apache_arrow_c_jni_JniWrapper_releaseArray(JNIEnv* env, jobject, jlong address) {
JNI_METHOD_START
ArrowArray* array = reinterpret_cast<ArrowArray*>(address);
if (array->release != nullptr) {
array->release(array);
}
JNI_METHOD_END()
}
/*
* Class: org_apache_arrow_c_jni_JniWrapper
* Method: exportSchema
* Signature: (JLorg/apache/arrow/c/jni/PrivateData;)V
*/
JNIEXPORT void JNICALL Java_org_apache_arrow_c_jni_JniWrapper_exportSchema(
JNIEnv* env, jobject, jlong address, jobject private_data) {
JNI_METHOD_START
ArrowSchema* schema = reinterpret_cast<ArrowSchema*>(address);
JavaVM* vm;
if (env->GetJavaVM(&vm) != JNI_OK) {
JniThrow("Unable to get JavaVM instance");
}
jobject private_data_ref = env->NewGlobalRef(private_data);
schema->private_data = new InnerPrivateData(vm, private_data_ref);
schema->release = &release_exported<ArrowSchema>;
JNI_METHOD_END()
}
/*
* Class: org_apache_arrow_c_jni_JniWrapper
* Method: exportArray
* Signature: (JLorg/apache/arrow/c/jni/PrivateData;)V
*/
JNIEXPORT void JNICALL Java_org_apache_arrow_c_jni_JniWrapper_exportArray(
JNIEnv* env, jobject, jlong address, jobject private_data) {
JNI_METHOD_START
ArrowArray* array = reinterpret_cast<ArrowArray*>(address);
JavaVM* vm;
if (env->GetJavaVM(&vm) != JNI_OK) {
JniThrow("Unable to get JavaVM instance");
}
jobject private_data_ref = env->NewGlobalRef(private_data);
array->private_data = new InnerPrivateData(vm, private_data_ref);
array->release = &release_exported<ArrowArray>;
JNI_METHOD_END()
}
|
17755fa0af4868677414bf0cf16a5bbdb1e3a221 | 7c33f1ef83b4461f046ad712ec9839cc4a72173d | /lmc_emu/CPU.cpp | 8bc310476f6b2ad701cec5a27c22fa528d0bd545 | [] | no_license | Atem2069/lmc-emu | 727d7eeff05ff7625ee64fe39837fe08d6fa1f71 | 5f0774ea07dcd9bb45bcc09bad1efbc1af513ef2 | refs/heads/master | 2023-04-27T14:33:43.967859 | 2021-05-09T20:56:45 | 2021-05-09T20:56:45 | 363,627,823 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,151 | cpp | CPU.cpp | #include "CPU.h"
CPU::CPU(std::vector<int> memory, bool debug)
{
m_memory = memory;
m_PC = 0;
m_ACC = 0;
m_curInstruction = 0;
m_shouldRun = true;
m_debug = debug;
}
CPU::~CPU()
{
//todo
}
bool CPU::run()
{
while (m_shouldRun)
{
m_fetch();
m_decode();
}
std::cout << "CPU has halted! " << std::endl;
return true;
}
void CPU::m_fetch()
{
if(m_debug)
std::cout << "[INFO] Fetch instruction at PC=" << m_PC << std::endl;
m_curInstruction = m_memory[m_PC];
m_PC++;
}
void CPU::m_decode()
{
int instr = m_curInstruction;
if(m_debug)
std::cout << "[INFO] Decoding opcode " << instr << std::endl;
int op = instr / 100;
switch (op)
{
case 1:
m_add(instr - 100); //-100 to extract memory address (as instruction is 1xx where xx is mem address)
break;
case 2:
m_sub(instr - 200);
break;
case 3:
m_store(instr - 300);
break;
case 5:
m_load(instr - 500);
break;
case 6:
m_jmp(instr - 600);
break;
case 7:
m_jmpZero(instr - 700);
break;
case 8:
m_jmpPos(instr - 800);
break;
case 9:
if (instr == 901)
m_input();
else
{
if (instr == 902)
m_output();
else if (instr == 922)
m_outputChar();
}
break;
case 0:
m_shouldRun = false;
break;
default:
std::cout << "[FATAL] Invalid opcode at PC=" << m_PC - 1 << "\nHalting.." << std::endl;
m_shouldRun = false;
}
if (m_shouldRun && m_debug)
std::cout << "Instruction executed successfully; PC=" << m_PC << " ACC=" << m_ACC << std::endl;
}
void CPU::m_add(int addr)
{
int num = m_memory[addr];
m_ACC += num;
}
void CPU::m_sub(int addr)
{
int num = m_memory[addr];
m_ACC -= num;
}
void CPU::m_store(int addr)
{
m_memory[addr] = m_ACC;
}
void CPU::m_load(int addr)
{
m_ACC = m_memory[addr];
}
void CPU::m_jmp(int addr)
{
m_PC = addr;
}
void CPU::m_jmpZero(int addr)
{
if (m_ACC <= 0)
m_PC = addr;
}
void CPU::m_jmpPos(int addr)
{
if (m_ACC >= 0)
m_PC = addr;
}
void CPU::m_input()
{
std::cout << "INPUT Required: ";
std::cin >> m_ACC;
}
void CPU::m_output()
{
std::cout << "[OUT] " << m_ACC << std::endl;
}
void CPU::m_outputChar()
{
std::cout << "[OUT] " << (char)m_ACC << std::endl;
} |
1c4839bba4811a428ff95c9edc78d24a3bfd697f | 34fb2c48d29b4aac014571cbb0d4232896380742 | /数据结构/数据结构实验课文件/EXP4/代码3.24/20354012/task3.cpp | 9628e837aeffb34cd972ee220e38e7dd759c88ef | [] | no_license | dkhonker/sysu | 2aca46818fc9bf77ededa0d8922859c3cabbd1e7 | ef3b8d0f6d5bb03b408081c932716dbd37ad0a22 | refs/heads/master | 2023-06-17T01:09:03.174593 | 2021-07-14T04:27:07 | 2021-07-14T04:27:07 | 382,212,051 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 216 | cpp | task3.cpp | #include<stdio.h>
#include<string.h>
#define MAX 20001
char a[MAX];
int main()
{
int pos,len;
scanf("%d %d",&pos,&len);
getchar();
gets(a);
for(int i = pos;i<pos+len;i++)
printf("%c",a[i-1]);
return 0;
}
|
51ebe99af8ff7790f8e92b4abc2b3d521b410376 | 4d405f617444dd34e7cc95a940c4b5f75922fffe | /Source/SampleDirectory.h | 3d9364e3dc0e42821e43693e448495ef6a9ba91a | [] | no_license | Jacob-Rose/SamplifyPlus-JUCE | 2818edcd12119f9d48d308a5568b540e89c9dfd8 | 14fc9a59dee51bdcc08f61bf8b55054ea47f9a7d | refs/heads/master | 2023-04-07T18:38:03.468624 | 2023-03-25T21:39:17 | 2023-03-25T21:39:17 | 170,420,927 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,805 | h | SampleDirectory.h | /*
==============================================================================
SampleDirectory.h
Created: 13 Sep 2019 5:43:59pm
Author: jacob
==============================================================================
*/
#ifndef SAMPLEDIRECTORY_H
#define SAMPLEDIRECTORY_H
#include <JuceHeader.h>
#include <vector>
#include "Sample.h"
namespace samplify
{
enum class CheckStatus
{
NotLoaded = -1,
Enabled,
Disabled,
Mixed,
};
class SampleDirectory: public ChangeBroadcaster, public ChangeListener
{
public:
SampleDirectory(File file);
File getFile() const { return mDirectory; }
Sample::List getChildSamplesRecursive(juce::String query, bool ignoreCheckSystem);
Sample::List getChildSamples();
void updateChildrenItems(CheckStatus checkStatus);
void changeListenerCallback(ChangeBroadcaster* source) override;
void cycleCurrentCheck();
void setCheckStatus(CheckStatus newCheckStatus);
CheckStatus getCheckStatus() { return mCheckStatus; }
int getChildDirectoryCount() { return mChildDirectories.size(); }
void recursiveRefresh();
std::shared_ptr<SampleDirectory> getChildDirectory(int index);
friend class SamplifyPlusApplication; //sets the wildcard really fucking early
friend class DirectoryExplorerTreeViewItem;
private:
SampleDirectory(const samplify::SampleDirectory& samplify) {}; //dont call me
CheckStatus mCheckStatus = CheckStatus::Enabled;
File mDirectory;
bool mIncludeChildSamples = true; //if the folder should load its own samples when getsamples is called
std::vector<std::shared_ptr<Sample>> mChildSamples; //safer
std::vector<std::shared_ptr<SampleDirectory>> mChildDirectories;
static String mWildcard; //set by SampleLibrary using the audioplayer to get all supported formats
};
}
#endif
|
52879bff619af3ea0ca279bb62428f60b5118b3c | d147d30ab7a9789c4fd7fb5e28cda35ce8ab334d | /csgo_internal/Draw.cpp | 29aee20ce761955ad82d3907cb2a9416bf0cd008 | [
"MIT"
] | permissive | XGOD4/REDHOOK | 3480ff27198065ba5f56bd07c2ffb78baaf638b6 | ee8d4addf2051c07defa6df494ce00cdddefd709 | refs/heads/master | 2020-03-06T22:04:31.323283 | 2018-03-31T21:40:42 | 2018-03-31T21:40:42 | 127,094,092 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,841 | cpp | Draw.cpp | #include "Cheat.h"
HFont F::Meme;
HFont F::ESP;
HFont F::Watermark;
void D::SetupFonts()
{
// fuck these non windows fonts
I::Surface->SetFontGlyphSet( F::Meme = I::Surface->Create_Font(), charenc( "Comic Sans MS" ), 30, FW_DONTCARE, NULL, NULL, FONTFLAG_ANTIALIAS );
I::Surface->SetFontGlyphSet( F::ESP = I::Surface->Create_Font(), charenc( "Consolas" ), 12, FW_DONTCARE, NULL, NULL, FONTFLAG_OUTLINE );
I::Surface->SetFontGlyphSet( F::Watermark = I::Surface->Create_Font(), charenc( "MS Sans Serif" ), 12, FW_DONTCARE, NULL, NULL, FONTFLAG_OUTLINE );
}
void D::DrawString( HFont font, int x, int y, Color color, DWORD alignment, const char* msg, ... )
{
va_list va_alist;
char buf[1024];
va_start( va_alist, msg );
_vsnprintf( buf, sizeof( buf ), msg, va_alist );
va_end( va_alist );
wchar_t wbuf[1024];
MultiByteToWideChar( CP_UTF8, 0, buf, 256, wbuf, 256 );
int r = 255, g = 255, b = 255, a = 255;
color.GetColor( r, g, b, a );
int width, height;
I::Surface->GetTextSize( font, wbuf, width, height );
if( alignment & FONT_RIGHT )
x -= width;
if( alignment & FONT_CENTER )
x -= width / 2;
I::Surface->DrawSetTextFont( font );
I::Surface->DrawSetTextColor( r, g, b, a );
I::Surface->DrawSetTextPos( x, y - height / 2 );
I::Surface->DrawPrintText( wbuf, wcslen( wbuf ) );
}
void D::DrawStringUnicode( HFont font, int x, int y, Color color, bool bCenter, const wchar_t* msg, ... )
{
int r = 255, g = 255, b = 255, a = 255;
color.GetColor( r, g, b, a );
int iWidth, iHeight;
I::Surface->GetTextSize( font, msg, iWidth, iHeight );
I::Surface->DrawSetTextFont( font );
I::Surface->DrawSetTextColor( r, g, b, a );
I::Surface->DrawSetTextPos( !bCenter ? x : x - iWidth / 2, y - iHeight / 2 );
I::Surface->DrawPrintText( msg, wcslen( msg ) );
}
void D::DrawRect( int x, int y, int w, int h, Color col )
{
I::Surface->DrawSetColor( col );
I::Surface->DrawFilledRect( x, y, x + w, y + h );
}
void D::DrawRectRainbow( int x, int y, int width, int height, float flSpeed, float& flRainbow )
{
Color colColor( 0, 0, 0 );
flRainbow += flSpeed;
if( flRainbow > 1.f )
flRainbow = 0.f;
for( int i = 0; i < width; i++ )
{
float hue = ( 1.f / ( float ) width ) * i;
hue -= flRainbow;
if( hue < 0.f )
hue += 1.f;
Color colRainbow = colColor.FromHSB( hue, 1.f, 1.f );
D::DrawRect( x + i, y, 1, height, colRainbow );
}
}
void D::DrawRectGradientHorizontal( int x, int y, int width, int height, Color color1, Color color2 )
{
float flDifferenceR = ( float ) ( color2.r() - color1.r() ) / ( float ) width;
float flDifferenceG = ( float ) ( color2.g() - color1.g() ) / ( float ) width;
float flDifferenceB = ( float ) ( color2.b() - color1.b() ) / ( float ) width;
for( float i = 0.f; i < width; i++ )
{
Color colGradient = Color( color1.r() + ( flDifferenceR * i ), color1.g() + ( flDifferenceG * i ), color1.b() + ( flDifferenceB * i ), color1.a() );
D::DrawRect( x + i, y, 1, height, colGradient );
}
}
void D::DrawPixel( int x, int y, Color col )
{
I::Surface->DrawSetColor( col );
I::Surface->DrawFilledRect( x, y, x + 1, y + 1 );
}
void D::DrawOutlinedRect( int x, int y, int w, int h, Color col )
{
I::Surface->DrawSetColor( col );
I::Surface->DrawOutlinedRect( x, y, x + w, y + h );
}
void D::DrawOutlinedCircle( int x, int y, int r, Color col )
{
I::Surface->DrawSetColor( col );
I::Surface->DrawOutlinedCircle( x, y, r, 1 );
}
void D::DrawLine( int x0, int y0, int x1, int y1, Color col )
{
I::Surface->DrawSetColor( col );
I::Surface->DrawLine( x0, y0, x1, y1 );
}
void D::DrawCorner( int iX, int iY, int iWidth, int iHeight, bool bRight, bool bDown, Color colDraw )
{
int iRealX = bRight ? iX - iWidth : iX;
int iRealY = bDown ? iY - iHeight : iY;
if( bDown && bRight )
iWidth = iWidth + 1;
D::DrawRect( iRealX, iY, iWidth, 1, colDraw );
D::DrawRect( iX, iRealY, 1, iHeight, colDraw );
D::DrawRect( iRealX, bDown ? iY + 1 : iY - 1, !bDown && bRight ? iWidth + 1 : iWidth, 1, Color( 0, 0, 0, 255 ) );
D::DrawRect( bRight ? iX + 1 : iX - 1, bDown ? iRealY : iRealY - 1, 1, bDown ? iHeight + 2 : iHeight + 1, Color( 0, 0, 0, 255 ) );
}
void D::DrawPolygon( int count, Vertex_t* Vertexs, Color color )
{
static int Texture = I::Surface->CreateNewTextureID( true );
unsigned char buffer[4] = { 255, 255, 255, 255 };
I::Surface->DrawSetTextureRGBA( Texture, buffer, 1, 1 );
I::Surface->DrawSetColor( color );
I::Surface->DrawSetTexture( Texture );
I::Surface->DrawTexturedPolygon( count, Vertexs );
}
void D::DrawRoundedBox( int x, int y, int w, int h, int r, int v, Color col )
{
std::vector< Vertex_t > p;
for( int _i = 0; _i < 3; _i++ )
{
int _x = x + ( _i < 2 && r || w - r );
int _y = y + ( _i % 3 > 0 && r || h - r );
for( int i = 0; i < v; i++ )
{
int a = RAD2DEG( ( i / v ) * -90 - _i * 90 );
p.push_back( Vertex_t( Vector2D( _x + sin( a ) * r, _y + cos( a ) * r ) ) );
}
}
D::DrawPolygon( 4 * ( v + 1 ), &p[ 0 ], col );
/*
function DrawRoundedBox(x, y, w, h, r, v, col)
local p = {};
for _i = 0, 3 do
local _x = x + (_i < 2 && r || w - r)
local _y = y + (_i%3 > 0 && r || h - r)
for i = 0, v do
local a = math.rad((i / v) * - 90 - _i * 90)
table.insert(p, {x = _x + math.sin(a) * r, y = _y + math.cos(a) * r})
end
end
surface.SetDrawColor(col.r, col.g, col.b, 255)
draw.NoTexture()
surface.DrawPoly(p)
end
*/
// Notes: amount of vertexes is 4(v + 1) where v is the number of vertices on each corner bit.
// I did it in lua cause I have no idea how the vertex_t struct works and i'm still aids at C++
}
bool D::ScreenTransform( const Vector& point, Vector& screen ) // tots not pasted
{
float w;
const VMatrix& worldToScreen = I::Engine->WorldToScreenMatrix();
screen.x = worldToScreen[ 0 ][ 0 ] * point[ 0 ] + worldToScreen[ 0 ][ 1 ] * point[ 1 ] + worldToScreen[ 0 ][ 2 ] * point[ 2 ] + worldToScreen[ 0 ][ 3 ];
screen.y = worldToScreen[ 1 ][ 0 ] * point[ 0 ] + worldToScreen[ 1 ][ 1 ] * point[ 1 ] + worldToScreen[ 1 ][ 2 ] * point[ 2 ] + worldToScreen[ 1 ][ 3 ];
w = worldToScreen[ 3 ][ 0 ] * point[ 0 ] + worldToScreen[ 3 ][ 1 ] * point[ 1 ] + worldToScreen[ 3 ][ 2 ] * point[ 2 ] + worldToScreen[ 3 ][ 3 ];
screen.z = 0.0f;
bool behind = false;
if( w < 0.001f )
{
behind = true;
screen.x *= 100000;
screen.y *= 100000;
}
else
{
behind = false;
float invw = 1.0f / w;
screen.x *= invw;
screen.y *= invw;
}
return behind;
}
bool D::WorldToScreen( const Vector& origin, Vector& screen )
{
if( !ScreenTransform( origin, screen ) )
{
int ScreenWidth, ScreenHeight;
I::Engine->GetScreenSize( ScreenWidth, ScreenHeight );
float x = ScreenWidth / 2;
float y = ScreenHeight / 2;
x += 0.5 * screen.x * ScreenWidth + 0.5;
y -= 0.5 * screen.y * ScreenHeight + 0.5;
screen.x = x;
screen.y = y;
return true;
}
return false;
}
int D::GetStringWidth( HFont font, const char* msg, ... )
{
va_list va_alist;
char buf[1024];
va_start( va_alist, msg );
_vsnprintf( buf, sizeof( buf ), msg, va_alist );
va_end( va_alist );
wchar_t wbuf[1024];
MultiByteToWideChar( CP_UTF8, 0, buf, 256, wbuf, 256 );
int iWidth, iHeight;
I::Surface->GetTextSize( font, wbuf, iWidth, iHeight );
return iWidth;
}
void D::Draw3DBox( Vector* boxVectors, Color color )
{
Vector boxVectors0, boxVectors1, boxVectors2, boxVectors3,
boxVectors4, boxVectors5, boxVectors6, boxVectors7;
if( D::WorldToScreen( boxVectors[ 0 ], boxVectors0 ) &&
D::WorldToScreen( boxVectors[ 1 ], boxVectors1 ) &&
D::WorldToScreen( boxVectors[ 2 ], boxVectors2 ) &&
D::WorldToScreen( boxVectors[ 3 ], boxVectors3 ) &&
D::WorldToScreen( boxVectors[ 4 ], boxVectors4 ) &&
D::WorldToScreen( boxVectors[ 5 ], boxVectors5 ) &&
D::WorldToScreen( boxVectors[ 6 ], boxVectors6 ) &&
D::WorldToScreen( boxVectors[ 7 ], boxVectors7 ) )
{
/*
.+--5---+
.8 4 6'|
+--7---+' 11
9 | 10 |
| ,+--|3--+
|.0 | 2'
+--1---+'
*/
Vector2D lines[ 12 ][ 2 ];
//bottom of box
lines[ 0 ][ 0 ] = { boxVectors0.x, boxVectors0.y };
lines[ 0 ][ 1 ] = { boxVectors1.x, boxVectors1.y };
lines[ 1 ][ 0 ] = { boxVectors1.x, boxVectors1.y };
lines[ 1 ][ 1 ] = { boxVectors2.x, boxVectors2.y };
lines[ 2 ][ 0 ] = { boxVectors2.x, boxVectors2.y };
lines[ 2 ][ 1 ] = { boxVectors3.x, boxVectors3.y };
lines[ 3 ][ 0 ] = { boxVectors3.x, boxVectors3.y };
lines[ 3 ][ 1 ] = { boxVectors0.x, boxVectors0.y };
lines[ 4 ][ 0 ] = { boxVectors0.x, boxVectors0.y };
lines[ 4 ][ 1 ] = { boxVectors6.x, boxVectors6.y };
// top of box
lines[ 5 ][ 0 ] = { boxVectors6.x, boxVectors6.y };
lines[ 5 ][ 1 ] = { boxVectors5.x, boxVectors5.y };
lines[ 6 ][ 0 ] = { boxVectors5.x, boxVectors5.y };
lines[ 6 ][ 1 ] = { boxVectors4.x, boxVectors4.y };
lines[ 7 ][ 0 ] = { boxVectors4.x, boxVectors4.y };
lines[ 7 ][ 1 ] = { boxVectors7.x, boxVectors7.y };
lines[ 8 ][ 0 ] = { boxVectors7.x, boxVectors7.y };
lines[ 8 ][ 1 ] = { boxVectors6.x, boxVectors6.y };
lines[ 9 ][ 0 ] = { boxVectors5.x, boxVectors5.y };
lines[ 9 ][ 1 ] = { boxVectors1.x, boxVectors1.y };
lines[ 10 ][ 0 ] = { boxVectors4.x, boxVectors4.y };
lines[ 10 ][ 1 ] = { boxVectors2.x, boxVectors2.y };
lines[ 11 ][ 0 ] = { boxVectors7.x, boxVectors7.y };
lines[ 11 ][ 1 ] = { boxVectors3.x, boxVectors3.y };
for( int i = 0; i < 12; i++ )
{
D::DrawLine( lines[ i ][ 0 ].x, lines[ i ][ 0 ].y, lines[ i ][ 1 ].x, lines[ i ][ 1 ].y, color );
}
}
}
void D::DrawCircle( float x, float y, float r, float s, Color color )
{
float Step = M_PI * 2.0 / s;
for( float a = 0; a < ( M_PI * 2.0 ); a += Step )
{
float x1 = r * cos( a ) + x;
float y1 = r * sin( a ) + y;
float x2 = r * cos( a + Step ) + x;
float y2 = r * sin( a + Step ) + y;
DrawLine( x1, y1, x2, y2, color );
}
}
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class hlahrvn {
public:
double zsjdhlc;
double vyrxenvcqjym;
double corlddn;
double eitksxkn;
hlahrvn();
bool ufzctbwynozwvtjmkxwjkqirg(string xsdcmoqpub, bool czfmrjo, bool inwvpoffk, int atkrwabyscog, bool oporjsdersrwqu, string svdpbyxkyv, double fgscspirjejgnn, double gjfgdycq);
protected:
bool bdpsopkbejarv;
string grsubzpxqlvenbe;
bool crlhieuvuxfft;
bool redlgpbswfilv(double rkyrbhmwpdm, bool ezhjlxcehnwko, double fosnwxzbqkxja, bool fpkgjdibl, int imqtqcqosx, string ealsjomilm, double brluhxmfjg);
string xkuzdzuiuepl(double xiclrcuoz, string srruyn, int abvcbnqczfo, string ryditznltycyn);
private:
double oktjjjvnlk;
string atxkpzounqr;
double rknlkf;
double wqjbc;
bool howaolcjluug(int xryxk, int scfpivx, double bajsglgowbdjjie);
double wqbkramwyrkpmybligtagdjs(int cabzgryrqk, bool rklopdhznicvn, bool kudbhhwqwvkuyz, bool uaxxivctgfp, double kraihzsvclc, bool idhuwn, bool vuhumnsivpteogx, bool vqlqosbowa);
double dbomswldqkwl(int rcapg, bool trpmx, int hqqnanjwejzbr, string ityvpigoawtvw, int kggxjozcwig, bool wjpvcgsqwynf, double owmnkghqxeik, int uxqaa, double qdpvegzhrum);
string ndavztdgosflpfuvstv(int jxmdvzfrbyl, bool ebenvpfwjlsfvo, double vjqykjz, string nooifoog, int gcybz);
double dexhuzsfhageavppgvik(double zffkgkttyhquypu, bool qhrwatezb, bool goookeeb, int hpnblgfo, int xncutcjcu, string jjbjmukkcun);
void lpfvcpzjelu(bool fszjsubweoioooe, bool bvblzejfohlzqbh, int pviur, int vcckm, string xojuy, string qjqvn, int tbypkdyk, double uytmk, string skwumqdr);
double tozsswtsuavfkhsjdaejy(int jdteqzjsel, bool lznzrcaazvhpr, int fgfluwzyuzwawh, double dxvcr, string shkrdfd, bool tknqsoznmghb, string qprcixagboqk, string lfjzfqvfjifiism, int fswge, bool bdevcrcggor);
bool hsziojoaoztotfx(int zrqcadmqmil, string sttzedtcmwkzx, int taqsowjwtevw, double vnygypzqseea, double xgkttcoyl, string wokhhsnbacpvif, int grtdyauttxwpa, bool ulobiiq, bool ipyiaxdhxaezuip, int soybhxr);
void gzbrzyoponssburrkki(string fbijubeebyq, string crcjrepg, bool xyhbcypx, int ntwvfqchpw, string sprdxpemvxphja);
double vejjsfglrxppmjdntuqmx(string sojfjxnexkiby, double hrubrdukynseyjw, double ysnuznkia, bool opqhqkjhab, int japqa, double qxljifavdpd, string knlfefqbebmtgmt, string znedjepcpgodfse, bool bklmxvluq);
};
bool hlahrvn::howaolcjluug(int xryxk, int scfpivx, double bajsglgowbdjjie) {
double ddepnrbjny = 19450;
if (19450 == 19450) {
int rmlp;
for (rmlp=48; rmlp > 0; rmlp--) {
continue;
}
}
return true;
}
double hlahrvn::wqbkramwyrkpmybligtagdjs(int cabzgryrqk, bool rklopdhznicvn, bool kudbhhwqwvkuyz, bool uaxxivctgfp, double kraihzsvclc, bool idhuwn, bool vuhumnsivpteogx, bool vqlqosbowa) {
int mvzndkbmie = 2609;
if (2609 == 2609) {
int mhaafa;
for (mhaafa=52; mhaafa > 0; mhaafa--) {
continue;
}
}
if (2609 != 2609) {
int sbpqd;
for (sbpqd=31; sbpqd > 0; sbpqd--) {
continue;
}
}
return 97474;
}
double hlahrvn::dbomswldqkwl(int rcapg, bool trpmx, int hqqnanjwejzbr, string ityvpigoawtvw, int kggxjozcwig, bool wjpvcgsqwynf, double owmnkghqxeik, int uxqaa, double qdpvegzhrum) {
double hqhjzyw = 11311;
string ctvee = "vakdnkmmvragfsvjlohslgnzahybbpgvccxy";
int bedxlfauuj = 2348;
if (2348 != 2348) {
int qvqe;
for (qvqe=20; qvqe > 0; qvqe--) {
continue;
}
}
if (string("vakdnkmmvragfsvjlohslgnzahybbpgvccxy") != string("vakdnkmmvragfsvjlohslgnzahybbpgvccxy")) {
int qiqnvlo;
for (qiqnvlo=21; qiqnvlo > 0; qiqnvlo--) {
continue;
}
}
if (2348 != 2348) {
int eccvlti;
for (eccvlti=70; eccvlti > 0; eccvlti--) {
continue;
}
}
if (2348 == 2348) {
int rjbtcduwtg;
for (rjbtcduwtg=4; rjbtcduwtg > 0; rjbtcduwtg--) {
continue;
}
}
return 62172;
}
string hlahrvn::ndavztdgosflpfuvstv(int jxmdvzfrbyl, bool ebenvpfwjlsfvo, double vjqykjz, string nooifoog, int gcybz) {
double lchoebuidn = 4109;
int ccbzzrhpvvyfvzf = 3952;
int ikwxuskhrphol = 2355;
double rhdntdvruboty = 22440;
int aizbwe = 368;
int urqaqrplfdk = 987;
int itlloebelq = 161;
double tuzwickdjjn = 17217;
bool xvfhenoxhew = false;
double glvfoqehgjxjpu = 33339;
return string("fukwsbk");
}
double hlahrvn::dexhuzsfhageavppgvik(double zffkgkttyhquypu, bool qhrwatezb, bool goookeeb, int hpnblgfo, int xncutcjcu, string jjbjmukkcun) {
bool sqaxjmjozptyg = true;
int jqnppzeupoxv = 4086;
string nehbnpllqzdyjw = "sfzqqwgperwyieelcsehzsapbnrgyiavkfugb";
bool vavncmjwmin = true;
if (true == true) {
int myavlso;
for (myavlso=72; myavlso > 0; myavlso--) {
continue;
}
}
if (true != true) {
int tepwg;
for (tepwg=30; tepwg > 0; tepwg--) {
continue;
}
}
if (true != true) {
int bcbhdi;
for (bcbhdi=100; bcbhdi > 0; bcbhdi--) {
continue;
}
}
if (string("sfzqqwgperwyieelcsehzsapbnrgyiavkfugb") != string("sfzqqwgperwyieelcsehzsapbnrgyiavkfugb")) {
int fqgfxb;
for (fqgfxb=66; fqgfxb > 0; fqgfxb--) {
continue;
}
}
return 91762;
}
void hlahrvn::lpfvcpzjelu(bool fszjsubweoioooe, bool bvblzejfohlzqbh, int pviur, int vcckm, string xojuy, string qjqvn, int tbypkdyk, double uytmk, string skwumqdr) {
string uqiwfyhpq = "rhonlrbegzyktdodirycfphceiiqvdxzgoxcapgwomotpzeuy";
double nteihbk = 28367;
string xjjtvtkxli = "mbwrsknzgyyocojkkqhkfznfdelnwwioibcfkvstxv";
bool euhcdpgwdb = true;
double cvgfzayi = 32073;
double ewchfeitazqxbm = 26344;
double zvqubkbxzyy = 63859;
if (28367 == 28367) {
int jssdpnzhew;
for (jssdpnzhew=33; jssdpnzhew > 0; jssdpnzhew--) {
continue;
}
}
}
double hlahrvn::tozsswtsuavfkhsjdaejy(int jdteqzjsel, bool lznzrcaazvhpr, int fgfluwzyuzwawh, double dxvcr, string shkrdfd, bool tknqsoznmghb, string qprcixagboqk, string lfjzfqvfjifiism, int fswge, bool bdevcrcggor) {
string tvbcjrm = "jyhvkdfifbtckuxtzfjvmievvqxnsdksnkfhjrrsproqud";
if (string("jyhvkdfifbtckuxtzfjvmievvqxnsdksnkfhjrrsproqud") == string("jyhvkdfifbtckuxtzfjvmievvqxnsdksnkfhjrrsproqud")) {
int xlllbm;
for (xlllbm=38; xlllbm > 0; xlllbm--) {
continue;
}
}
return 18860;
}
bool hlahrvn::hsziojoaoztotfx(int zrqcadmqmil, string sttzedtcmwkzx, int taqsowjwtevw, double vnygypzqseea, double xgkttcoyl, string wokhhsnbacpvif, int grtdyauttxwpa, bool ulobiiq, bool ipyiaxdhxaezuip, int soybhxr) {
return false;
}
void hlahrvn::gzbrzyoponssburrkki(string fbijubeebyq, string crcjrepg, bool xyhbcypx, int ntwvfqchpw, string sprdxpemvxphja) {
double cgmravvofvx = 2124;
bool gcoowjpd = false;
string issjdkwyjlsc = "nqjsqzwfzdmztzqnaroeuhvohhqdvkmpcbebmlznicwrepdbfnbwsduagjibcmvoxglcvasogo";
double dkbuajm = 3519;
int nurqvaji = 7595;
if (false == false) {
int zkpczflwv;
for (zkpczflwv=56; zkpczflwv > 0; zkpczflwv--) {
continue;
}
}
if (2124 == 2124) {
int avyhfhof;
for (avyhfhof=1; avyhfhof > 0; avyhfhof--) {
continue;
}
}
if (3519 != 3519) {
int nwpha;
for (nwpha=2; nwpha > 0; nwpha--) {
continue;
}
}
if (7595 == 7595) {
int iezds;
for (iezds=97; iezds > 0; iezds--) {
continue;
}
}
}
double hlahrvn::vejjsfglrxppmjdntuqmx(string sojfjxnexkiby, double hrubrdukynseyjw, double ysnuznkia, bool opqhqkjhab, int japqa, double qxljifavdpd, string knlfefqbebmtgmt, string znedjepcpgodfse, bool bklmxvluq) {
int xijmokzs = 58;
bool dzllihahqcggrx = false;
bool atgvfnlwhqpgsc = false;
bool oqedneupr = true;
double nyfbfviiwbkni = 48235;
string hmqykleu = "ampakxeufkjwlhcvgwnshhbzaaehpaxnrkpjxcgfmjivtvpximrmejlkqcytabnxpiwzildvjmfw";
bool qjlgfclrm = false;
double snitsetkihjpd = 26444;
if (58 == 58) {
int zkdnpfd;
for (zkdnpfd=100; zkdnpfd > 0; zkdnpfd--) {
continue;
}
}
if (string("ampakxeufkjwlhcvgwnshhbzaaehpaxnrkpjxcgfmjivtvpximrmejlkqcytabnxpiwzildvjmfw") != string("ampakxeufkjwlhcvgwnshhbzaaehpaxnrkpjxcgfmjivtvpximrmejlkqcytabnxpiwzildvjmfw")) {
int rsuipvso;
for (rsuipvso=29; rsuipvso > 0; rsuipvso--) {
continue;
}
}
if (string("ampakxeufkjwlhcvgwnshhbzaaehpaxnrkpjxcgfmjivtvpximrmejlkqcytabnxpiwzildvjmfw") == string("ampakxeufkjwlhcvgwnshhbzaaehpaxnrkpjxcgfmjivtvpximrmejlkqcytabnxpiwzildvjmfw")) {
int uivrceoklo;
for (uivrceoklo=18; uivrceoklo > 0; uivrceoklo--) {
continue;
}
}
return 85844;
}
bool hlahrvn::redlgpbswfilv(double rkyrbhmwpdm, bool ezhjlxcehnwko, double fosnwxzbqkxja, bool fpkgjdibl, int imqtqcqosx, string ealsjomilm, double brluhxmfjg) {
bool gxdtbwesy = true;
string iaojmwycdfz = "itncc";
bool ichyytvruau = false;
bool iuyvnr = false;
string zjsfl = "vrlqyapbdnj";
string yjmprviewimm = "njeqiziemmlqpbhrsqeujilykrxvwebralryqtsxstqtimdqlyrjwrqltomjencrczbvdfwwqisopjdglhpmfsmothgis";
int rluevitlgl = 6031;
string cnhgmsnzw = "ujrilahvcfdyojgdjwicyeqtneikfwghtsfpavqzn";
if (string("vrlqyapbdnj") != string("vrlqyapbdnj")) {
int bjhl;
for (bjhl=58; bjhl > 0; bjhl--) {
continue;
}
}
if (true == true) {
int fqufpyoxrr;
for (fqufpyoxrr=48; fqufpyoxrr > 0; fqufpyoxrr--) {
continue;
}
}
return false;
}
string hlahrvn::xkuzdzuiuepl(double xiclrcuoz, string srruyn, int abvcbnqczfo, string ryditznltycyn) {
double ilrclxtmgbacqz = 9267;
string dcjtrukdb = "ts";
string qhpcrozqi = "baowsedtlsbigfxjaohoiwuqiazjwiqgtwvyhbdjpldujlmevlbkbmynlodcwekwrxdpbtbjgrxuzvidudwlhwxldogqgegali";
bool fqjxcqugnlp = false;
string slqcsbaim = "yzlskemwzfnmajfmceyiygctlbkvklkjrxweneionycobkfrodnabheorrtdddsigujcrxdkqoqmuufbgcol";
int wmqgkjkzuscowbt = 956;
double amnyadcdqgt = 1565;
string jkgsqhbusfyqarc = "eehefwytcsveqfzvqiulcqnxibtzdywueajbtgebipncvupnxtvtrge";
int jsmvzrn = 1180;
if (string("yzlskemwzfnmajfmceyiygctlbkvklkjrxweneionycobkfrodnabheorrtdddsigujcrxdkqoqmuufbgcol") == string("yzlskemwzfnmajfmceyiygctlbkvklkjrxweneionycobkfrodnabheorrtdddsigujcrxdkqoqmuufbgcol")) {
int vfrpr;
for (vfrpr=80; vfrpr > 0; vfrpr--) {
continue;
}
}
return string("hlqtdftmukdt");
}
bool hlahrvn::ufzctbwynozwvtjmkxwjkqirg(string xsdcmoqpub, bool czfmrjo, bool inwvpoffk, int atkrwabyscog, bool oporjsdersrwqu, string svdpbyxkyv, double fgscspirjejgnn, double gjfgdycq) {
bool jikwpnmtqhjpl = true;
bool bjygotwoqxwik = true;
if (true == true) {
int glhcbm;
for (glhcbm=50; glhcbm > 0; glhcbm--) {
continue;
}
}
return true;
}
hlahrvn::hlahrvn() {
this->ufzctbwynozwvtjmkxwjkqirg(string("zrlidmwrbuqthihhwhtqvazgsfhhjypvdmuzhrdilsas"), false, true, 1113, true, string("dhujokgnbdn"), 23043, 54537);
this->redlgpbswfilv(5614, true, 21264, false, 954, string("wanxymvemqyroyuhprcumwfukkvehoazlwqthiboxrmihdkxlqxmeyyenallkgytaudfld"), 4983);
this->xkuzdzuiuepl(32707, string("vxwclhneebwhfoxzjezdfoqrrynalxmuwhxlksijflviaozpxfuhqaxmugjhrhwqwzxchg"), 3600, string("xdaumuxgjajmanjykbymtamzgrcdycccvppsicmwftbrjqhwnhzjkpnmseavwmilxcizjgniyhosoulwfxkimaiierwf"));
this->howaolcjluug(877, 1254, 15768);
this->wqbkramwyrkpmybligtagdjs(1498, false, true, false, 33024, true, true, true);
this->dbomswldqkwl(3002, true, 1597, string(""), 4162, false, 11516, 8314, 27334);
this->ndavztdgosflpfuvstv(204, false, 8437, string("pipxoknmsrfzmlipybvsixjhrphfkanhlpwipavpccejkbrgtsxjwrdmxozpsvevdkrzgqycfnmcyewhjlxqfmiqisbljvpuq"), 2227);
this->dexhuzsfhageavppgvik(30699, false, true, 5912, 475, string("djxmuwuxklthjuqulhhqygbqttdhigjsilvfvcmvoboyrccgfvmavaoqqdydchnwhiytq"));
this->lpfvcpzjelu(false, true, 404, 687, string("gsvzptujjkbfhh"), string("rlxgypbfijzoislmchoeaqvkpuhbmhwmhhshyhytjhrsyfykemvtu"), 5648, 46521, string("ggnjbfsblaxaflspjomiypdjasbs"));
this->tozsswtsuavfkhsjdaejy(4336, false, 4025, 6903, string("flsgqoehqocdixtbsnqjzuzaoifgunhkppyziptptduwqpdoaoabgttbjhxkqolimogtnopnhtzjmekcntzca"), false, string("hcqdtrxhgbv"), string("opkebokogidqa"), 19, false);
this->hsziojoaoztotfx(2235, string("ojthbzxrmttchhnfxqagwfqsvwtkmcsytrsiecwhtiqpyaevklljobmpxgojmcnxkdzqvvmhdkyuyhmlvrykefegtgzya"), 3621, 22466, 2228, string("nouyepmxycjvlucchwxcsrgijlrfwltoobpwlzneblamlhqchmsppqahihgcvdjmyhjkxzataplsxuasytisxhaj"), 1467, true, false, 1186);
this->gzbrzyoponssburrkki(string("otblxznomnliybywtpawkfmoymkdqjupyzlfnsoocxzuixgc"), string("yotnnspqvwbdlalezribjmqqlqewlptatdqeydtojqwjbugeqnquqwsywmzxsjaydnpwglapdlkqrtdblgnslssjqdzh"), true, 368, string("uq"));
this->vejjsfglrxppmjdntuqmx(string("xxjpoomopxzneqmlvlvltqqfyaq"), 14678, 21494, true, 3958, 31421, string("vvchcdaikaxkrdkdwhajidqnleijtevbsvbbujihogsawdozkluujexjbmzkskdqwffcwgclihngwgkinmvyhxwmvlailtzxnp"), string("rlqhtozyujswcnprxikqykpbuhxv"), true);
}
|
7483b667c96f27f43abeb7a69d925933088a81c7 | 54ecc5086e465eea123604a9be10ffc013ba8cd0 | /src/random_piecewise_linear_distribution.cpp | b13e00457f1bfd8dc2f986bab0b7b345ee165bee | [
"MIT"
] | permissive | Toxe/test-cpp | 9786b97f05f725c38ee3db75e5a4858bd8fa7432 | 80bcfb9e6446253b6c48759aefa116ab3e71d29b | refs/heads/master | 2022-11-10T00:53:53.559649 | 2022-10-19T16:28:53 | 2022-10-19T16:28:53 | 242,742,642 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 840 | cpp | random_piecewise_linear_distribution.cpp | #include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <random>
#include <vector>
int main()
{
std::vector<float> intervals{ 0, 10, 20, 30, 40};
std::vector<float> densities{10, 2, 4, 4, 10};
std::random_device rd;
std::mt19937 gen(rd());
std::piecewise_linear_distribution<float> dist(intervals.begin(), intervals.end(), densities.begin());
std::array<unsigned int, 40> counts{0};
for (int i = 0; i < 100000; ++i)
++counts[static_cast<std::size_t>(dist(gen))];
unsigned int m = *std::max_element(counts.begin(), counts.end());
for (std::size_t i = 0; i != counts.size(); ++i) {
std::cout << std::setw(2) << i << ": "
<< std::setw(4) << counts[i] << " "
<< std::string((40 * counts[i]) / m, '*') << '\n';
}
}
|
0b02eef90970aeb18fd9136c5bc53270ff5a358f | 58163838aa787e8ed6899cf01bac71162fb9cee8 | /MBED Monitor/src/ReadingData.cpp | b53d833c26667f5a7404933d942dec3e1e2aa34c | [] | no_license | koson/WeatherStation | 6dcc84c62c323d54b5fa60ca84b0cad2dc97a336 | f4f1cf35c92a2219949a0cc57e10dbef13224c7e | refs/heads/master | 2021-01-18T11:16:01.276039 | 2014-06-28T23:45:49 | 2014-06-28T23:45:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,772 | cpp | ReadingData.cpp | /*
=======================================================================================================================
File : ReadingData.cpp
-----------------------------------------------------------------------------------------------------------------------
Author : Kleber Kruger
Email : kleberkruger@gmail.com
Date : 2014-04-02
Version : 1.0
Copyright : Faculty of Computing, FACOM - UFMS
-----------------------------------------------------------------------------------------------------------------------
Description: Fault-Injection Monitor System
=======================================================================================================================
*/
#include "ReadingData.h"
ReadingData::ReadingData() {
/* Initialize time and CRC variables with zero */
tm = crc = 0;
/* Clean names array */
memset(paramNames, 0, sizeof (paramNames));
/*
* Initialize parameters with NAN value
*/
for (int i; i < NUMBER_OF_PARAMETERS; i++)
paramValues[i] = NAN;
/*
* Set attribute names
*/
sprintf(paramNames[0], "%s", "Anemometer");
sprintf(paramNames[1], "%s", "Pluviometer");
sprintf(paramNames[2], "%s", "Wetting");
sprintf(paramNames[3], "%s", "Temperature");
sprintf(paramNames[4], "%s", "Humidity");
sprintf(paramNames[5], "%s", "Soil temperature");
sprintf(paramNames[6], "%s", "Soil humidity");
sprintf(paramNames[7], "%s", "Solar radiation");
sprintf(paramNames[8], "%s", "Battery voltage");
}
ReadingData::~ReadingData() {
/* Nothing to do */
}
ReadingData * ReadingData::create(ReadingData *data_1, ReadingData *data_2, ReadingData *data_3) {
ReadingData *reading = new ReadingData();
/*
* Set time
*/
if (data_1->getTime() == data_2->getTime())
reading->setTime(data_1->getTime());
else if (data_1->getTime() == data_3->getTime())
reading->setTime(data_1->getTime());
else if (data_2->getTime() == data_3->getTime())
reading->setTime(data_2->getTime());
else {
free(reading);
return NULL;
}
/*
* Set parameters
*/
for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) {
if (data_1->getParameterValue(i) == data_2->getParameterValue(i))
reading->setParameterValue(i, data_1->getParameterValue(i));
else if (data_1->getParameterValue(i) == data_3->getParameterValue(i))
reading->setParameterValue(i, data_1->getParameterValue(i));
else if (data_2->getParameterValue(i) == data_3->getParameterValue(i))
reading->setParameterValue(i, data_2->getParameterValue(i));
else {
free(reading);
return NULL;
}
}
/*
* Set CRC
*/
if (data_1->getCRC() == data_2->getCRC())
reading->setCRC(data_1->getCRC());
else if (data_1->getCRC() == data_3->getCRC())
reading->setCRC(data_1->getCRC());
else if (data_2->getCRC() == data_3->getCRC())
reading->setCRC(data_2->getCRC());
else {
free(reading);
return NULL;
}
return reading;
}
ReadingData* ReadingData::load(const char *filepath) {
fstream file(filepath, ios::binary | ios::in);
if (!file.is_open())
return NULL;
ReadingData *data = new ReadingData();
// file.read(reinterpret_cast<char *> (data), sizeof (ReadingData));
file.read(reinterpret_cast<char *> (&(data->tm)), sizeof (data->tm));
file.read(reinterpret_cast<char *> (data->paramNames), sizeof (data->paramNames));
file.read(reinterpret_cast<char *> (data->paramValues), sizeof (data->paramValues));
file.read(reinterpret_cast<char *> (&(data->crc)), sizeof (data->crc));
file.close();
return data;
}
bool ReadingData::save(const char *filepath) {
fstream file(filepath, ios::binary | ios::out);
if (!file.is_open())
return false;
// file.write(reinterpret_cast<char *> (this), sizeof (ReadingData));
file.write(reinterpret_cast<char *> (&tm), sizeof (tm));
file.write(reinterpret_cast<char *> (paramNames), sizeof (paramNames));
file.write(reinterpret_cast<char *> (paramValues), sizeof (paramValues));
file.write(reinterpret_cast<char *> (&crc), sizeof (crc));
file.close();
return true;
}
uint32_t ReadingData::calculateCRC() {
FloatUInt value;
uint32_t crc = tm;
for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) {
value.float_t = paramValues[i];
crc ^= value.uint_t;
}
return crc;
}
bool ReadingData::checkCRC() {
return checkCRC(this->crc);
}
bool ReadingData::checkCRC(uint32_t crc) {
if ((calculateCRC() ^ crc) == 0)
return true;
return false;
}
|
239a5ee6fcb37f81a50bf12830d3de602b353fb0 | bb38c44037a99d0a12a12d92059678f2faebbc80 | /src/gausskernel/optimizer/commands/packagecmds.cpp | b2d6c63ec2195e1c77bb5a4ca90042ad64b709d6 | [
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference",
"PostgreSQL",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unicode",
"LicenseRef-scancode-warranty-disclaimer",
"curl",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"CC-BY-4.0",
... | permissive | opengauss-mirror/openGauss-server | a9c5a62908643492347830826c56da49f0942796 | 310e84631c68c8bf37b004148b66f94064f701e4 | refs/heads/master | 2023-07-26T19:29:12.495484 | 2023-07-17T12:23:32 | 2023-07-17T12:23:32 | 276,117,477 | 591 | 208 | MulanPSL-2.0 | 2023-04-28T12:30:18 | 2020-06-30T14:08:59 | C++ | UTF-8 | C++ | false | false | 11,967 | cpp | packagecmds.cpp | /* -------------------------------------------------------------------------
*
* packagecmds.cpp
*
* Routines for CREATE and DROP PACKAGE commands and CREATE and DROP
* CAST commands.
*
* Portions Copyright (c) 2021 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/gausskernel/optimizer/commands/functioncmds.cpp
*
* DESCRIPTION
* These routines take the parse tree and pick out the
* appropriate arguments/flags, and pass the results to the
* corresponding "FooDefine" routines (in src/catalog) that do
* the actual catalog-munging. These routines also verify permission
* of the user to execute the command.
*
* NOTES
* These things must be defined and committed in the following order:
* "create package":
* input/output, recv/send procedures
* "create type":
* type
* "create operator":
* operators
*
* -------------------------------------------------------------------------
*/
#include "postgres.h"
#include "knl/knl_variable.h"
#include "access/heapam.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_control.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_object.h"
#include "catalog/gs_package.h"
#include "catalog/gs_package_fn.h"
#include "catalog/gs_db_privilege.h"
#include "commands/defrem.h"
#include "commands/typecmds.h"
#include "pgxc/pgxc.h"
#include "storage/tcap.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/rel.h"
#include "utils/rel_gs.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"
#include "tcop/utility.h"
static void create_package_error_callback(void *arg)
{
CreatePackageStmt* stmt = (CreatePackageStmt*)arg;
int cur_pos;
if (stmt->pkgspec_location <= 0)
return;
cur_pos = geterrposition();
if (cur_pos > 0)
{
cur_pos += (stmt->pkgspec_location - stmt->pkgspec_prefix_len);
errposition(cur_pos);
}
}
void CreatePackageCommand(CreatePackageStmt* stmt, const char* queryString)
{
#ifdef ENABLE_MULTIPLE_NODES
ereport(ERROR, (errcode(ERRCODE_INVALID_PACKAGE_DEFINITION),
errmsg("not support create package in distributed database")));
#endif
u_sess->plsql_cxt.debug_query_string = pstrdup(queryString);
Oid packageId;
Oid namespaceId;
char* pkgname = NULL;
char* pkgspecsrc = NULL;
Oid pkgOwner;
ErrorContextCallback err_context;
/* Convert list of names to a name and namespace */
namespaceId = QualifiedNameGetCreationNamespace(stmt->pkgname, &pkgname);
if (!OidIsValid(namespaceId)) {
ereport(ERROR, (errcode(ERRCODE_INVALID_PACKAGE_DEFINITION),
errmsg("Invalid namespace")));
}
if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) {
ereport(ERROR, (errcode(ERRCODE_INVALID_PACKAGE_DEFINITION),
errmsg("Package only allowed create in A compatibility")));
}
/*
* isAlter is true, change the owner of the objects as the owner of the
* namespace, if the owner of the namespce has the same name as the namescpe
*/
bool isAlter = false;
bool anyResult = CheckCreatePrivilegeInNamespace(namespaceId, GetUserId(), CREATE_ANY_PACKAGE);
//@Temp Table. Lock Cluster after determine whether is a temp object,
// so we can decide if locking other coordinator
pgxc_lock_for_utility_stmt((Node*)stmt, namespaceId == u_sess->catalog_cxt.myTempNamespace);
pkgspecsrc = stmt->pkgspec;
if (u_sess->attr.attr_sql.enforce_a_behavior) {
pkgOwner = GetUserIdFromNspId(namespaceId, false, anyResult);
if (!OidIsValid(pkgOwner))
pkgOwner = GetUserId();
else if (pkgOwner != GetUserId())
isAlter = true;
if (isAlter) {
(void)CheckCreatePrivilegeInNamespace(namespaceId, pkgOwner, CREATE_ANY_PACKAGE);
}
} else {
pkgOwner = GetUserId();
}
/* Create the package */
if (pkgname == NULL) {
ereport(ERROR,
(errmodule(MOD_PLSQL), errcode(ERRCODE_INVALID_NAME),
errmsg("package name is null"),
errdetail("empty package name is not allowed"),
errcause("package name is null"),
erraction("rename package")));
}
err_context.arg = (void*)stmt;
err_context.previous = t_thrd.log_cxt.error_context_stack;
err_context.callback = create_package_error_callback;
t_thrd.log_cxt.error_context_stack = &err_context;
packageId = PackageSpecCreate(namespaceId, pkgname, pkgOwner, pkgspecsrc, stmt->replace, stmt->pkgsecdef);
t_thrd.log_cxt.error_context_stack = err_context.previous;
/* Advance cmd counter to make the package visible */
if (OidIsValid(packageId)) {
CommandCounterIncrement();
} else {
ereport(ERROR,
(errmodule(MOD_PLSQL), errcode(ERRCODE_INVALID_NAME),
errmsg("package spec has error"),
errdetail("empty package spec is not allowed"),
errcause("debug mode"),
erraction("check package spec")));
}
if (u_sess->plsql_cxt.debug_query_string) {
pfree_ext(u_sess->plsql_cxt.debug_query_string);
}
}
void CreatePackageBodyCommand(CreatePackageBodyStmt* stmt, const char* queryString)
{
#ifdef ENABLE_MULTIPLE_NODES
ereport(ERROR, (errcode(ERRCODE_INVALID_PACKAGE_DEFINITION),
errmsg("not support create package in distributed database")));
#endif
u_sess->plsql_cxt.debug_query_string = pstrdup(queryString);
//Oid packageId;
Oid namespaceId;
char* pkgname = NULL;
char* pkgBodySrc = NULL;
Oid pkgOwner;
/* Convert list of names to a name and namespace */
namespaceId = QualifiedNameGetCreationNamespace(stmt->pkgname, &pkgname);
/*
* isAlter is true, change the owner of the objects as the owner of the
* namespace, if the owner of the namespce has the same name as the namescpe
*/
bool isAlter = false;
bool anyResult = CheckCreatePrivilegeInNamespace(namespaceId, GetUserId(), CREATE_ANY_PACKAGE);
//@Temp Table. Lock Cluster after determine whether is a temp object,
// so we can decide if locking other coordinator
pgxc_lock_for_utility_stmt((Node*)stmt, namespaceId == u_sess->catalog_cxt.myTempNamespace);
pkgBodySrc = stmt->pkgbody;
if (u_sess->attr.attr_sql.enforce_a_behavior) {
pkgOwner = GetUserIdFromNspId(namespaceId, false, anyResult);
if (!OidIsValid(pkgOwner))
pkgOwner = GetUserId();
else if (pkgOwner != GetUserId())
isAlter = true;
if (isAlter) {
(void)CheckCreatePrivilegeInNamespace(namespaceId, pkgOwner, CREATE_ANY_PACKAGE);
}
} else {
pkgOwner = GetUserId();
}
/* Create the package */
Oid packageOid = InvalidOid;
packageOid = PackageBodyCreate(namespaceId, pkgname, pkgOwner, pkgBodySrc , stmt->pkginit, stmt->replace);
/* Advance cmd counter to make the package visible */
if (OidIsValid(packageOid)) {
CommandCounterIncrement();
} else {
ereport(ERROR,
(errmodule(MOD_PLSQL), errcode(ERRCODE_INVALID_NAME),
errmsg("package body has error"),
errdetail("empty package body is not allowed"),
errcause("package body is null"),
erraction("check package body")));
}
if (u_sess->plsql_cxt.debug_query_string) {
pfree_ext(u_sess->plsql_cxt.debug_query_string);
}
}
/*
* Change package owner by name
*/
ObjectAddress AlterPackageOwner(List* name, Oid newOwnerId)
{
#ifdef ENABLE_MULTIPLE_NODES
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("package not supported in distributed database")));
#endif
Oid pkgOid = PackageNameListGetOid(name, false, false);
Relation rel;
HeapTuple tup;
ObjectAddress address;
if (IsSystemObjOid(pkgOid)) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PACKAGE_DEFINITION),
errmsg("ownerId change failed for package %u, because it is a builtin package.", pkgOid)));
}
rel = heap_open(PackageRelationId, RowExclusiveLock);
tup = SearchSysCache1(PACKAGEOID, ObjectIdGetDatum(pkgOid));
/* should not happen */
if (!HeapTupleIsValid(tup)) {
ereport(
ERROR, (errcode(ERRCODE_CACHE_LOOKUP_FAILED), errmsg("cache lookup failed for package %u", pkgOid)));
}
TrForbidAccessRbObject(PACKAGEOID, pkgOid);
Form_gs_package gs_package_tuple = (Form_gs_package)GETSTRUCT(tup);
/*
* If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes.
*/
if (gs_package_tuple->pkgowner == newOwnerId) {
ReleaseSysCache(tup);
/* Recode time of change the funciton owner. */
UpdatePgObjectMtime(pkgOid, OBJECT_TYPE_PKGSPEC);
heap_close(rel, NoLock);
ObjectAddressSet(address, PackageRelationId, pkgOid);
return address;
}
Datum repl_val[Natts_gs_package];
bool repl_null[Natts_gs_package];
bool repl_repl[Natts_gs_package];
Acl* newAcl = NULL;
Datum aclDatum;
bool isNull = false;
HeapTuple newtuple;
AclResult aclresult;
/* Superusers can always do it */
if (!superuser()) {
/* Otherwise, must be owner of the existing object */
if (!pg_package_ownercheck(pkgOid, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PACKAGE, NameStr(gs_package_tuple->pkgname));
/* Must be able to become new owner */
check_is_member_of_role(GetUserId(), newOwnerId);
/* New owner must have CREATE privilege on namespace */
aclresult = pg_namespace_aclcheck(gs_package_tuple->pkgnamespace, newOwnerId, ACL_CREATE);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(gs_package_tuple->pkgnamespace));
}
/* alter owner of procedure in packgae */
AlterFunctionOwnerByPkg(pkgOid, newOwnerId);
/* alter packgae type onwer */
AlterTypeOwnerByPkg(pkgOid, newOwnerId);
errno_t errorno = EOK;
errorno = memset_s(repl_null, sizeof(repl_null), false, sizeof(repl_null));
securec_check(errorno, "\0", "\0");
errorno = memset_s(repl_repl, sizeof(repl_repl), false, sizeof(repl_repl));
securec_check(errorno, "\0", "\0");
repl_repl[Anum_gs_package_pkgowner - 1] = true;
repl_val[Anum_gs_package_pkgowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
* Determine the modified ACL for the new owner. This is only
* necessary when the ACL is non-null.
*/
aclDatum = SysCacheGetAttr(PACKAGEOID, tup, Anum_gs_package_pkgacl, &isNull);
if (!isNull) {
newAcl = aclnewowner(DatumGetAclP(aclDatum), gs_package_tuple->pkgowner, newOwnerId);
repl_repl[Anum_gs_package_pkgacl - 1] = true;
repl_val[Anum_gs_package_pkgacl - 1] = PointerGetDatum(newAcl);
}
newtuple = (HeapTuple) tableam_tops_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
tableam_tops_free_tuple(newtuple);
/* Update owner dependency reference */
changeDependencyOnOwner(PackageRelationId, pkgOid, newOwnerId);
ReleaseSysCache(tup);
/* Recode time of change the funciton owner. */
UpdatePgObjectMtime(pkgOid, OBJECT_TYPE_PKGSPEC);
heap_close(rel, NoLock);
ObjectAddressSet(address, PackageRelationId, pkgOid);
return address;
}
|
4c843a66c1f775d1420340bfc73877c9fd93b646 | 24004e1c3b8005af26d5890091d3c207427a799e | /Win32/NXOPEN/NXOpen/Annotations_PmiFilterByPart.hxx | 6694bf598e956a9ae83e1867201f0d625eb78282 | [] | 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,800 | hxx | Annotations_PmiFilterByPart.hxx | #ifndef NXOpen_ANNOTATIONS_PMIFILTERBYPART_HXX_INCLUDED
#define NXOpen_ANNOTATIONS_PMIFILTERBYPART_HXX_INCLUDED
//--------------------------------------------------------------------------
// Header for C++ interface to JA API
//--------------------------------------------------------------------------
//
// Source File:
// Annotations_PmiFilterByPart.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/Annotations_PmiFilter.hxx>
#include <NXOpen/libnxopencpp_annotations_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 Annotations
{
class PmiFilterByPart;
}
namespace Annotations
{
class PmiFilter;
}
namespace Annotations
{
class _PmiFilterByPartBuilder;
class PmiFilterByPartImpl;
/** Represents a PMI filter defined by a set of parts.
<br> Created in NX4.0.0. <br>
*/
class NXOPENCPP_ANNOTATIONSEXPORT PmiFilterByPart : public Annotations::PmiFilter
{
private: PmiFilterByPartImpl * m_pmifilterbypart_impl;
private: friend class _PmiFilterByPartBuilder;
protected: PmiFilterByPart();
public: ~PmiFilterByPart();
};
}
}
#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
|
664ed928ab0697add7924f610d0e5a85b418d17f | e11b2493f55c60685c3ea76f900be73e6a454b2f | /C++ Primer/11_Associative_Containers/11_36.cpp | e7ee6773edc0ce6b5eff238341be66537c97e24a | [] | no_license | zpoint/Reading-Exercises-Notes | 29e566dd86d97eadb84d7bb6f8f640b85486557c | 31b38fe927232ba8e6f6a0e7ab9c58026eefcffb | refs/heads/master | 2021-06-04T08:12:42.777309 | 2021-04-19T02:12:22 | 2021-04-19T02:12:22 | 70,507,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cpp | 11_36.cpp | #include <iostream>
#include <string>
/*
* Will throw a runtime error
*/
int main()
{
std::string str(" ");
std::cout << str.substr(1).size() << " " << str.substr(1) << std::endl;
return 0;
}
|
6b85e1dfb0ea4e99af0f9f4ba5a32161f13d2234 | 7bcc51362468098bbb9ddd241230e02cdbeea6e4 | /standard/src/StdConfig.cpp | 1e9400556eb37ac35ee5602bd3d5f13fef1395d4 | [
"ISC"
] | permissive | Marko10-000/clonk-rage | af4ac62b7227c00874ecd49431a29a984a417fbb | 230e715f2abe65966d5e5467cb18382062d1dec6 | refs/heads/master | 2021-01-18T07:29:38.108084 | 2015-09-07T01:34:56 | 2015-09-07T01:34:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,465 | cpp | StdConfig.cpp | /* Copyright (C) 1998-2000 Matthes Bender RedWolf Design */
/* Auto-registering data structures */
#include <Standard.h>
#include <StdRegistry.h>
#include <StdConfig.h>
#include <stdio.h>
CStdConfig::CStdConfig()
{
}
CStdConfig::~CStdConfig()
{
}
BOOL CStdConfig::Load(CStdConfigValue *pCfgMap, void *vpData)
{
#ifdef _WIN32
if (!pCfgMap || !vpData) return FALSE;
char szCompany[100+1]="Company";
char szProduct[100+1]="Product";
char szSection[100+1]="Section";
char szSubkey[1024+1];
DWORD dwValue;
char szValue[CFG_MaxString+1];
for (; pCfgMap && (pCfgMap->Type!=CFG_End); pCfgMap++)
switch (pCfgMap->Type)
{
case CFG_Company: SCopy(pCfgMap->Name,szCompany,100); break;
case CFG_Section: SCopy(pCfgMap->Name,szSection,100); break;
case CFG_Product: SCopy(pCfgMap->Name,szProduct,100); break;
case CFG_Integer:
sprintf(szSubkey,"Software\\%s\\%s\\%s",szCompany,szProduct,szSection);
if (!pCfgMap->Name || !GetRegistryDWord(szSubkey,pCfgMap->Name,&dwValue))
dwValue=pCfgMap->Default;
*((int*)(((BYTE*)vpData)+pCfgMap->Offset)) = dwValue;
break;
case CFG_String:
sprintf(szSubkey,"Software\\%s\\%s\\%s",szCompany,szProduct,szSection);
if (!pCfgMap->Name || !GetRegistryString(szSubkey,pCfgMap->Name,szValue,CFG_MaxString))
SCopy((char*)pCfgMap->Default,szValue,CFG_MaxString);
SCopy(szValue,((char*)vpData)+pCfgMap->Offset);
break;
}
#endif
return TRUE;
}
BOOL CStdConfig::Save(CStdConfigValue *pCfgMap, void *vpData)
{
#ifdef _WIN32
if (!pCfgMap || !vpData) return FALSE;
char szCompany[100+1]="Company";
char szProduct[100+1]="Product";
char szSection[100+1]="Section";
char szSubkey[1024+1];
for (; pCfgMap && (pCfgMap->Type!=CFG_End); pCfgMap++)
switch (pCfgMap->Type)
{
case CFG_Company: SCopy(pCfgMap->Name,szCompany,100); break;
case CFG_Section: SCopy(pCfgMap->Name,szSection,100); break;
case CFG_Product: SCopy(pCfgMap->Name,szProduct,100); break;
case CFG_Integer:
sprintf(szSubkey,"Software\\%s\\%s\\%s",szCompany,szProduct,szSection);
if (pCfgMap->Name)
SetRegistryDWord(szSubkey,pCfgMap->Name, *((int*)(((BYTE*)vpData)+pCfgMap->Offset)) );
break;
case CFG_String:
// Compose value path
sprintf(szSubkey,"%s",szSection);
// Write if value
if (*(((char*)vpData)+pCfgMap->Offset))
{
if (pCfgMap->Name)
SetRegistryString(szSubkey,pCfgMap->Name, ((char*)vpData)+pCfgMap->Offset );
}
// Else delete value
else
{
DeleteRegistryValue(szSubkey,pCfgMap->Name);
}
break;
}
#endif
return TRUE;
}
void CStdConfig::LoadDefault(CStdConfigValue *pCfgMap, void *vpData, const char *szOnlySection)
{
if (!pCfgMap || !vpData) return;
char szCompany[100+1]="Company";
char szProduct[100+1]="Product";
char szSection[100+1]="Section";
for (; pCfgMap && (pCfgMap->Type!=CFG_End); pCfgMap++)
switch (pCfgMap->Type)
{
case CFG_Company: SCopy(pCfgMap->Name,szCompany,100); break;
case CFG_Section: SCopy(pCfgMap->Name,szSection,100); break;
case CFG_Product: SCopy(pCfgMap->Name,szProduct,100); break;
case CFG_Integer:
if (!szOnlySection || SEqual(szSection,szOnlySection))
*((int*)(((BYTE*)vpData)+pCfgMap->Offset)) = pCfgMap->Default;
break;
case CFG_String:
if (!szOnlySection || SEqual(szSection,szOnlySection))
SCopy((char*)pCfgMap->Default,((char*)vpData)+pCfgMap->Offset,CFG_MaxString);
break;
}
}
|
1029a77b44741a60b2c309e865816faf6562dd81 | be379c5decf2b8a8a7aac102e489563ae0da8593 | /trunk/src/core/GameObject/CWayPoint.h | 6f358e4c23efe4176e8b7ace2fa5f4b5ed409c4c | [] | no_license | codeman001/gsleveleditor | 6050daf26d623af4f6ab9fa97f032d958fb4c5ae | d30e54874a4c7ae4fd0a364aa92a2082f73a5d7c | refs/heads/master | 2021-01-10T13:09:01.347502 | 2013-05-12T09:14:47 | 2013-05-12T09:14:47 | 44,381,635 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,411 | h | CWayPoint.h | #ifndef _WAYPOINT_
#define _WAYPOINT_
#include "CGameObject.h"
class CWayPoint: public CGameObject
{
protected:
CWayPoint *m_next;
CWayPoint *m_back;
long m_timeWait;
public:
CWayPoint();
CWayPoint(CGameObject *parent);
virtual ~CWayPoint();
// setNext
// set the next way point
inline void setNext( CWayPoint *p )
{
m_next = p;
}
// setBack
// set the next way point
inline void setBack( CWayPoint *p )
{
m_back = p;
}
// getNext
// get next waypoint
inline CWayPoint * getNext()
{
return m_next;
}
// getBack
// get prev waypoint
inline CWayPoint * getBack()
{
return m_back;
}
// setTimeWay
// way milisecond time
inline void setTimeWay(long timeWait)
{
m_timeWait = timeWait;
}
// saveData
// save data to serializable ( use for save in game .sav )
virtual void saveData( CSerializable* pObj );
// loadData
// load data to serializable ( use for load in game .sav )
virtual void loadData( CSerializable* pObj );
// getData
// get basic data to serializable
virtual void getData( CSerializable* pObj );
// updateData
// update data
virtual void updateData( CSerializable* pObj );
// getSpline
// getspline
void getSpline( std::vector<core::vector3df>& points, bool loop);
#ifdef GSEDITOR
// drawObject
virtual void drawObject();
#endif
};
#endif |
7c21a9fd8cea73e28437f04a1753a49c017ce59a | ccbbe314cb8478868dd8c7de3937150379dacc29 | /lab11/lab11-2/main.cpp | 7bd41c8e22c0b5a11ebfb7366fcb2f5527f98418 | [] | no_license | AnmolAgarwal141/Ds-lab | 3d8430178653ab6bb6881e0547982a0ed9715368 | 70111c5eb83fb1f94b8d91cc7125934c28ba0c82 | refs/heads/master | 2020-06-07T21:42:48.247694 | 2019-06-21T13:05:13 | 2019-06-21T13:05:13 | 193,099,407 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,970 | cpp | main.cpp |
#include<iostream>
#include<process.h>
#include<conio.h>
using namespace std;
class bst
{
bst *lchild;
int data;
bst *rchild;
public:
bst(int ele=0)
{
lchild=NULL;
rchild=NULL;
data=ele;
}
void insert(int);
void display(bst *root);
bst *del();
};
bst *root=NULL;
void bst::insert(int ele)
{
bst *temp=new bst(ele);
if(root==NULL){root=temp;return;}
else
{
bst *curr=root,*prev=NULL;
while(curr)
{
prev=curr;
if(temp->data<curr->data) curr=curr->lchild;
else if(temp->data>curr->data) curr=curr->rchild;
else
{
cout<<"Insertion is not possible";
return;
}
}
if(temp->data>prev->data)
prev->rchild=temp;
else if(temp->data<prev->data)
prev->lchild=temp;
}
return;
}
void bst::display(bst *ptr)
{
if(ptr){
display(ptr->lchild);
cout<<" "<<ptr->data;
display(ptr->rchild);
}
}
bst* bst::del()
{
bst *c, *p, *s,*q;
int ele;
cout<<"Enter the key value to be deleted ";
cin>>ele;
if(root==NULL)
return root;
p=NULL;
c=root;
while(c!=NULL)
{
if(ele==c->data)
break;
p=c;
if(ele<c->data)
c=c->lchild;
else
c=c->rchild;
}
if(c==NULL)
return root;
if(c->lchild==NULL)
q=c->rchild;
else if(c->rchild==NULL)
q=c->lchild;
else
{
s=c->rchild;
while(s->lchild)
s=s->lchild;
s->lchild=c->lchild;
q=c->rchild;
}
if(!p)
{
delete c;
return q;
}
if(c==p->lchild)
p->lchild=q;
else
p->rchild=q;
delete(c);
return(root);
}
int main()
{
int ch,ele;
bst b;
while(1){
cout<<"\n1. insert 2. display 3. delete 4. exit\n";
cin>>ch;
switch(ch)
{
case 1: cout<<"Enter the element to be inserted: ";
cin>>ele;
b.insert(ele);
b.display(root);
break;
case 2: b.display(root);
break;
case 3:
root=b.del();
b.display(root);
break;
case 4: break;
}
if(ch==4)
break;
}
return 0;
}
|
cc73bd8b3d6ae6ca43d039b2ce881412f6a7399e | 3b379f81604986b5768a4420632ed1c27ce98242 | /leetcode37.cpp | cc194ade02af032f6e4e4562841d083cd0661e26 | [
"MIT"
] | permissive | SJTUGavinLiu/Leetcodes | a7866e945d5699be40012f527d2080047582b172 | 99d4010bc34e78d22e3c8b6436e4489a7d1338da | refs/heads/master | 2021-07-24T03:26:56.258953 | 2020-07-19T03:59:09 | 2020-07-19T03:59:09 | 199,461,174 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,212 | cpp | leetcode37.cpp | #include<vector>
using namespace std;
/*
class Solution {
public:
void solveSudoku(vector<vector<char>>& board) {
result(board,0,0);
}
bool result(vector<vector<char>>& board,int row,int column)
{
if(row==9)
return true;
if(column==9)
return result(board,row+1,0);
if(board[row][column]=='.')
{
for(char index='1';index<='9';index++)
{
if(isValidSudoku(board,row,column,index))
{
board[row][column] = index;
if(result(board,row,column+1))
return true;
board[row][column] = '.';
}
}
}
else
return (result(board,row,column+1));
return false;
}
bool isValidSudoku(vector<vector<char>>& board,int i,int j,char val ) {
for( int h=0;h<9;h++)
{
if(board[i][h]==val) return false; // check row
if(board[h][j]==val) return false; // check column
if(board[i-i%3+h/3][j-j%3+h%3]==val)return false; // check cub
}
return true;
}
};
*/
class Solution {
private:
vector<vector<bool>> rows;
vector<vector<bool>> cols;
vector<vector<bool>> blocks;
bool sudokuSolved;
public:
Solution():rows(9,vector<bool>(9,false)),
cols(9,vector<bool>(9,false)),
blocks(9,vector<bool>(9,false)),
sudokuSolved(false){};
bool isValid(int x, int y, int num)
{
num--;
return !rows[x][num] && !cols[y][num] && !blocks[blockId(x,y)][num];
}
int blockId(int x, int y)
{
return x / 3 + (y / 3) * 3;
}
void placeNum(int x, int y, int num, vector<vector<char>>& board)
{
num--;
rows[x][num] = true;
cols[y][num] = true;
blocks[blockId(x,y)][num] = true;
board[x][y] = char(num + '1');
}
void removeNum(int x, int y, int num, vector<vector<char>>& board)
{
num--;
rows[x][num] = false;
cols[y][num] = false;
blocks[blockId(x,y)][num] = false;
board[x][y] = '.';
}
void nextNum(int x, int y, vector<vector<char>>& board)
{
if(y < 8) backward(x,y+1,board);
else
{
if(x < 8) backward(x+1,0,board);
else sudokuSolved = true;
}
}
void backward(int x, int y, vector<vector<char>>& board)
{
//if(x == 9) return;
if(board[x][y] != '.') nextNum(x,y,board);
else
{
for(int i = 1; i <= 9; i++)
{
if(!isValid(x,y,i)) continue;
placeNum(x,y,i,board);
nextNum(x,y,board);
if(sudokuSolved) return;
removeNum(x,y,i,board);
}
}
}
void solveSudoku(vector<vector<char>>& board) {
for(int i = 0; i < 9; i++)
{
for(int j = 0; j < 9; j++)
{
if(board[i][j] == '.') continue;
placeNum(i,j,board[i][j]-'0',board);
}
}
backward(0,0,board);
}
}; |
9088a135308c3143fa8f6c13271fc884cc1e15b6 | 28e8e80ce36427059d108277f11529a2ec18a89d | /CoOS/M3/CoOS_Signal.h | cc4b56440ead0e1585f52eca58e271206e27b2f9 | [] | no_license | AdrianGin/CoOS | 6e28da3200679a32e0d9fc1f63851a08cd14c932 | c76e124ebc7341c4e0d2d5326bde33771d6b77d3 | refs/heads/master | 2022-10-28T02:05:07.861718 | 2019-12-23T07:39:25 | 2019-12-23T07:39:25 | 273,622,561 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 792 | h | CoOS_Signal.h | /*
* CoOS_Signal.h
*
* Created on: 12/10/2019
* Author: AdrianDesk
*/
#ifndef SRC_COOS_COOS_SIGNAL_H_
#define SRC_COOS_COOS_SIGNAL_H_
#include "CoOS_Conf.h"
namespace CoOS {
class SignalFlags {
public:
typedef uint32_t Flags;
SignalFlags() : state(0) {}
inline void Set(Flags mask) {
do {
__LDREXW(&state);
} while( __STREXW( state | mask, &state) );
}
inline void Clear(Flags mask) {
do {
__LDREXW(&state);
} while( __STREXW( (state & (~mask)) , &state) );
}
inline Flags Get() {
Flags ret = __LDREXW(&state);
__CLREX();
return ret;
}
inline void Reset() {
Clear(0xFFFFFFFF);
}
private:
Flags state;
};
} /* namespace CoOS */
#endif /* SRC_COOS_COOS_SIGNAL_H_ */
|
5dcf7600dce1613411a2cab5d6c6cf19e9955664 | 01ed3ed38c5d61975ff616e1d15564299378fcdc | /test/classwork_test/10_assign_test/10_assign_tests.cpp | 78e374af3de220a1d0e939b90f7477667c8e3413 | [
"MIT"
] | permissive | acc-cosc-1337-summer-2020-classroom/acc-cosc-1337-summer-2020-AmyMichelle87 | 5e8f9c7614f9bd35d2ae52d6d694a00c4856d19d | 333ccf13f1045989110b38d6b337edcd229c68d4 | refs/heads/master | 2022-11-21T12:26:20.167368 | 2020-07-24T23:45:42 | 2020-07-24T23:45:42 | 268,945,653 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 855 | cpp | 10_assign_tests.cpp | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"
#include "employee.h"
#include "engineer.h"
#include "sales_employee.h"
TEST_CASE("Verify Test Configuration", "verification") {
REQUIRE(true == true);
}
//this is correct syntax but the other classes/constructors need to be fixed.
TEST_CASE("Test class function Engineer::get_pay()"){
Employee *engineer = new Engineer(1500, 400);
double result = engineer -> get_pay();
REQUIRE(result == 1900);
delete engineer;
engineer = nullptr;
}
TEST_CASE("Test class function SalesPerson::get_pay()"){
Employee *salesEmp = new SalesEmployee(40, 10, 500);
double result = salesEmp -> get_pay();
REQUIRE(result == 900);
delete salesEmp;
salesEmp = nullptr;
}
|
9b2d08d5bb1210114a4186defa11efa73ad18480 | f8c0512388d7bd2128beb4ffbd6a0d3c47396239 | /Playing With Strings/Solutions/luismo/J - Ada and Pet/J - Ada and Pet.cpp | 50634f40124f0862f6562e2d98792134413cc5b2 | [
"MIT"
] | permissive | luismoax/axon_training | 3b45080e6cc0e87f9089a26058b8cdcb3b21d913 | fe4a8cee81034f140650b6c21f723d339ea02c00 | refs/heads/master | 2020-05-20T07:34:04.794876 | 2019-08-20T15:26:17 | 2019-08-20T15:26:17 | 184,371,665 | 0 | 0 | null | 2019-05-01T05:08:43 | 2019-05-01T05:08:43 | null | UTF-8 | C++ | false | false | 1,314 | cpp | J - Ada and Pet.cpp | /*
Author: Luis Manuel D?az Bar?n (LUISMO)
Problem: Ada and the Pet
Online Judge:
Idea: Use Prefix Function
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#define ull unsigned long long
// IO
#define sf scanf
#define pf printf
#define mkp make_pair
#define fi first
#define se second
#define endl "\n"
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e16 + 3;
const int mod = 1e9 + 7;
const int lim = 1e6 + 2;
int tc;
string str;
ll k;
int pi[lim];
void buildPrefix()
{
pi[0] = 0;
int matched = 0;
for(int i = 1; i < str.size(); i++)
{
while(matched > 0 && str[i] != str[matched])
matched = pi[matched - 1];
if(str[i] == str[matched])
matched++;
pi[i] = matched;
}
}
void solve()
{
cin >> tc;
while(tc-- > 0)
{
cin >> str >> k;
buildPrefix();
ll answ = str.size() * k - ( (k - 1) * pi[str.size() - 1] );
cout << answ << endl;
}
}
void fastIO()
{
cin.sync_with_stdio(false);
cin.tie(0);
}
void IO()
{
if(fopen("d:\\lmo.in","r") != NULL)
{
freopen("d:\\lmo.in","r",stdin);
}
else if(fopen("/media/Beijing/lmo.in","r") != NULL)
{
freopen("/media/Beijing/lmo.in", "r", stdin);
}
}
int main()
{
IO();
fastIO();
solve();
}
|
29cbd485e0a5333d62e7b6f220515b23fc4e8be2 | 2740b47bbd8b70c69a9104591ce8284fe18b1d04 | /chap15/weatherballoon/weatherballoon.h | 911c74b7325709a04d97ab6c5a9183d1c5a3f10f | [
"MIT"
] | permissive | mutse/qt5-book-code | d427ce5d943bd4cbda08daacb1cf4d120eb75b31 | ffc8517e28f11864e049f1dc93d098365347387a | refs/heads/master | 2022-08-27T09:56:44.261403 | 2022-07-23T15:06:00 | 2022-07-23T15:06:00 | 8,292,311 | 492 | 211 | null | 2020-02-29T01:12:33 | 2013-02-19T14:57:57 | C++ | UTF-8 | C++ | false | false | 419 | h | weatherballoon.h | #ifndef WEATHERBALLOON_H
#define WEATHERBALLOON_H
#include <QPushButton>
#include <QTimer>
#include <QUdpSocket>
class WeatherBalloon : public QPushButton
{
Q_OBJECT
public:
WeatherBalloon(QWidget *parent = 0);
double temperature() const;
double humidity() const;
double altitude() const;
private slots:
void sendDatagram();
private:
QUdpSocket udpSocket;
QTimer timer;
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.