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
b79e6723155f4fa9db925ece6942bda041a0ac8e
67e8364603f885231b6057abd6859e60562a4008
/Cpp/340_LongestSubstringWithAtMostKDistinctCharacters/002.cpp
6aad93c99a44bda066f493107c6de1d6927980a3
[]
no_license
NeighborUncleWang/Leetcode
988417721c4a395ac8800cd04e4d5d973b54e9d4
d5bdbdcd698006c9997ef0e368ffaae6f546ac44
refs/heads/master
2021-01-18T22:03:27.400480
2019-02-22T04:45:52
2019-02-22T04:45:52
36,253,135
0
0
null
null
null
null
UTF-8
C++
false
false
808
cpp
002.cpp
class Solution { public: int lengthOfLongestSubstringKDistinct(string s, int k) { vector<int> indices(256, -1); int distinct = 0, res = 0; for (int left = 0, right = 0; right < s.size(); ++right) { if (indices[s[right]] == -1) { ++distinct; } indices[s[right]] = right; if (distinct > k) { int new_left = INT_MAX; for (int index: indices) { if (index != -1) { new_left = min(new_left, index); } } indices[s[new_left]] = -1; --distinct; left = new_left + 1; } res = max(res, right - left + 1); } return res; } };
f1d9274e0103c723118c7275b13a5a43489916f8
7f506b25d31c4a86bdd2215bcc27cecb71ad90c3
/medium-problem_078/sllist.hpp
5b57f15c0a76470e975533a382936a52842713eb
[]
no_license
davidr69/daily-coding-problems
5ad5ede2c17cf089a896c8ebc8e09559aa0545d1
ab50da84d04ed0aa9ede46af6181c493c3741033
refs/heads/master
2020-12-14T15:31:04.350435
2020-01-18T20:49:58
2020-01-18T20:49:58
234,789,209
0
0
null
null
null
null
UTF-8
C++
false
false
345
hpp
sllist.hpp
class LinkedList { private: struct Node { int value; Node *next; }; Node *head = nullptr; Node *tail = nullptr; // makes appending easy Node *iter = nullptr; // keeps track of "next" public: void append(int); void display(); int *next(); // Why a pointer? Because no value can represent end-of-list; nullptr will be used for that };
727686b262b4455a578405ce3ab5ddf8d8c0fe67
7c7e5147f6dce5f3e465a79be7915ac88c99be64
/Mathematics/absoluteValue.cpp
e5a1bc15e3b097877639e44d8b72465e98b12909
[ "MIT" ]
permissive
Yuvrajchandra/DSAPractice
3974c2672b237bab3d0e97a3bb6b809c10ac73f3
d3e396bcd16289722988bd5a90b29bd87c0df1da
refs/heads/main
2023-02-12T18:40:43.432431
2021-01-11T12:12:33
2021-01-11T12:12:33
328,637,445
0
0
null
null
null
null
UTF-8
C++
false
false
123
cpp
absoluteValue.cpp
int absolute(int I) { // code here if(I<0) { return -I; } else { return I; } }
8dac1daf4859b1cf3b83152f3e50fa754a13cb8c
f8f4cbc5ff1d4fbb8d98729432bd5aea1b249e1c
/TemplateParserDlg.cpp
8af4f2cb95e811e6ea68a424c81cde2096c06ac8
[]
no_license
Onglu/TemplateMaker
b1756ee3f893a1a1f229177b476fafb0cb68a5d5
3279e3af8489d1a27d78965bf047e8ef44d35234
refs/heads/master
2020-03-25T13:22:13.603840
2013-08-19T10:27:38
2013-08-19T10:28:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
38,992
cpp
TemplateParserDlg.cpp
#include "TemplateParserDlg.h" #include "ui_TemplateParserDlg.h" #include "json.h" #include <QDebug> #include <QFileDialog> #include <QUuid> #include <QSettings> #include <QDateTime> #include <QMessageBox> #include <QCloseEvent> #define CHANGED_SUFFIX " *" #define TEMP_FOLDER "tlpt" #define TEMP_FILE "/DDECF6B7F103CFC11B2.png" #define PREVIEW_PICTURE "preview.png" #define PKG_FMT ".xcmb" #define PKG_PASSWORD "123123" #define PKG_LEN_FIXED 21 #define PKG_ENCRYPT 0 #define LOG_TRACE 0 using namespace QtJson; QProcess TemplateParserDlg::m_tmaker; TemplateParserDlg::ZipUsage TemplateParserDlg::m_usage = TemplateParserDlg::ZipUsageCompress; TemplateParserDlg::TemplateParserDlg(QWidget *parent) : QDialog(parent, Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint), ui(new Ui::TemplateParserDlg), m_pInfo(NULL), m_pkg(NULL), m_pic(NULL), m_finished(false), m_make(false), m_opened(false), m_changed(false) { ui->setupUi(this); m_wndTitle = windowTitle(); //ui->tmplToolButton->setEnabled(false); ui->frame->setEnabled(false); //ui->tmplToolButton->hide(); ui->progressBar->hide(); QSettings settings("Jizhiyou", "TemplateParser"); m_dirName = settings.value("dir_name").toString(); if (m_dirName.isEmpty()) { m_dirName = QDir::toNativeSeparators(QDir::homePath()) + "\\"; } connect(ui->wpCoverRadioButton, SIGNAL(clicked()), SLOT(selectType())); connect(ui->wpPageRadioButton, SIGNAL(clicked()), SLOT(selectType())); connect(&m_timer, SIGNAL(timeout()), SLOT(end())); connect(&m_parser, SIGNAL(finished()), SLOT(ok()), Qt::BlockingQueuedConnection); #if PKG_ENCRYPT connect(&m_maker, SIGNAL(finished()), SLOT(make()), Qt::BlockingQueuedConnection); #endif connect(&m_tmaker, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(processFinished(int,QProcess::ExitStatus))); #if LOG_TRACE QFile file(QDir::tempPath() + "/tlpt/.message.log"); if (file.open(QIODevice::WriteOnly)) { file.close(); } #endif //QFile::copy("C:\\Users\\Onglu\\Desktop\\test\\branch.png", "G:\\Images\\PSD\\branch.png"); } TemplateParserDlg::~TemplateParserDlg() { // if (m_opened && !m_pkgFile.isEmpty()) // { // hide(); // useZip(ZipUsageEncrypt, m_pkgFile + " " + PKG_PASSWORD); // } if (m_timer.isActive()) { m_timer.stop(); } psd_release(m_pInfo); deleteDir(tr("%1/%2").arg(QDir::tempPath()).arg(TEMP_FOLDER), false); if (QFile::exists(m_tmpFile)) { redirect(__LINE__, m_tmpFile); QFile::remove(m_tmpFile); } unlock(); delete ui; } void TemplateParserDlg::redirect(int line, const QString &message) { #if LOG_TRACE //QFile file(QDir::tempPath() + "/tlpt/.message.log"); QFile file("message.log"); if (file.open(QIODevice::Text | QIODevice::Append)) { char buf[270] = {0}; snprintf(buf, 270, "%d: %s\n", line, message.toStdString().c_str()); file.write(buf); file.close(); } #else qDebug() << __FILE__ << line << message; #endif } bool TemplateParserDlg::deleteDir(const QString &dirName, bool delSelf) { //qDebug() << __FILE__ << __LINE__ << dirName; QDir directory(dirName); if (dirName.isEmpty() || !directory.exists()) { return true; } QStringList files = directory.entryList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden); QList<QString>::iterator f = files.begin(); bool error = false; while (f != files.end()) { QString filePath = QDir::convertSeparators(directory.path() + '/' + (*f)); QFileInfo fi(filePath); if (fi.isFile() || fi.isSymLink()) { QFile::setPermissions(filePath, QFile::WriteOwner); if (!QFile::remove(filePath)) { error = true; } } else if (fi.isDir()) { if (!deleteDir(filePath)) { error = true; } } ++f; } if (delSelf) { return directory.rmdir(QDir::convertSeparators(directory.path())); } return error; } inline void TemplateParserDlg::mkTempDir() { if (!m_xcmb.contains("id")) { return; } QString tmpDir(QDir::tempPath() + "/tlpt"), id = m_xcmb["id"].toString(); QDir dir(tmpDir); if (!dir.exists()) { dir.mkdir(tmpDir); } dir.mkdir(id); m_tmpDir = QDir::toNativeSeparators(tr("%1/%2/").arg(tmpDir).arg(id)); } bool TemplateParserDlg::moveTo(QString &fileName, QString dirName, bool overwrite) { QFile file(fileName); if (!file.exists()) { return false; } QChar sep = QDir::separator(); QString tl(sep), oldDir, name = fileName.right(fileName.length() - fileName.lastIndexOf(sep) - 1); if (tl != dirName.right(1)) { dirName = QDir::toNativeSeparators(dirName) + tl; } oldDir = fileName.left(fileName.lastIndexOf(QDir::separator()) + 1); QDir dir(dirName); if (!dir.exists() || oldDir == dirName) { return false; } if (!overwrite) { if (dir.exists(name)) { QMessageBox::warning(this, tr("保存失败"), tr("该目录下已经存在一个同名的相册模板包,请更名后再重新进行保存!"), tr("确定") ); return false; } } name = dirName + name; if (overwrite) { dir.remove(name); } if (file.copy(name)) { file.remove(); fileName = name; } return true; } void TemplateParserDlg::change() { #if PKG_ENCRYPT if (!m_make) { useZip(ZipUsageAppend, m_pkgFile + " " + m_tmpFile, true); if (QFile::exists(m_tmpFile)) { QFile::remove(m_tmpFile); } m_tmpFile.clear(); } ui->psdToolButton->setEnabled(false); ui->tmplToolButton->setEnabled(false); ui->frame->setEnabled(false); ui->progressBar->setVisible(true); ui->progressBar->setValue(0); m_finished = false; m_make = !m_make; m_maker.crypt(m_make, m_pkgFile + " " + PKG_PASSWORD); m_maker.start(); m_timer.start(m_make ? 30 : 50); #else QString args; if (!m_xcmb.isEmpty()) { useZip(ZipUsageAppend, args2(args, m_pkgFile, m_tmpFile), true); if (QFile::exists(m_tmpFile)) { QFile::remove(m_tmpFile); } m_tmpFile.clear(); setWindowTitle(tr("%1 - %2").arg(m_wndTitle).arg(m_pkgFile)); //qDebug() << __FILE__ << __LINE__ << m_pkgFile << m_picFile; QMessageBox::information(this, tr("保存成功"), tr("相册模板包已经保存成功!"), tr("确定")); } else { useZip(ZipUsageRead, args2(args, m_pkgFile, "page.dat")); } lock(); #endif } inline void TemplateParserDlg::lock() { if (m_pkg) { fclose(m_pkg); } m_pkg = fopen(m_pkgFile.toStdString().c_str(), "rb"); if (m_pic) { fclose(m_pic); } m_pic = fopen(m_picFile.toStdString().c_str(), "rb"); } inline void TemplateParserDlg::unlock() { if (m_pkg) { fclose(m_pkg); m_pkg = NULL; } if (m_pic) { fclose(m_pic); m_pic = NULL; } } void TemplateParserDlg::make() { if (!m_finished) { m_finished = true; //qDebug() << __FILE__ << __LINE__ << m_make; if (!m_make) { if (m_xcmb.size()) { useZip(ZipUsageAppend, m_pkgFile + " " + m_tmpFile, true); useZip(ZipUsageEncrypt, m_pkgFile + " " + PKG_PASSWORD, true); } else { useZip(ZipUsageRead, m_pkgFile + " page.dat"); } //qDebug() << __FILE__ << __LINE__ << program; if (QFile::exists(m_tmpFile)) { QFile::remove(m_tmpFile); } m_tmpFile.clear(); } //m_maker.quit(); } } void CryptThread::run() { TemplateParserDlg::useZip(m_encrypt ? TemplateParserDlg::ZipUsageEncrypt : TemplateParserDlg::ZipUsageDecrypt, m_arg, true); emit finished(); } void TemplateParserDlg::processFinished(int ret, QProcess::ExitStatus exitStatus) { Q_UNUSED(ret); if (exitStatus == QProcess::CrashExit) { //qDebug() << __FILE__ << __LINE__ << "Crash Exit"; } else { QByteArray out = m_tmaker.readAllStandardOutput(); QString content(out); m_tmaker.close(); if (content.startsWith("compress:")) { moveTo(m_picFile, m_tmpDir); deleteDir(content.mid(9)); qDebug() << __FILE__ << __LINE__ << m_tmpDir << content.mid(9); } if (ZipUsageAppend == m_usage && !m_pkgFile.isEmpty()) { qDebug() << __FILE__ << __LINE__ << m_pkgFile; } if (content.startsWith("data:")) { bool ok; QString data = content.mid(5); //qDebug() << __FILE__ << __LINE__ << data; if (data.isEmpty()) { ui->psdToolButton->setEnabled(true); ui->tmplToolButton->setEnabled(true); redirect(__LINE__, "empty data"); return; } m_xcmb = QtJson::parse(data, ok).toMap(); QVariantMap bkSize = m_xcmb["size"].toMap(); m_bkSize.setWidth(bkSize["width"].toInt()); m_bkSize.setHeight(bkSize["height"].toInt()); //qDebug() << __FILE__ << __LINE__ << m_xcmb; #if !PKG_ENCRYPT m_finished = true; end(); mkTempDir(); QVariantList tags = m_xcmb["tags"].toList(); foreach (const QVariant &tag, tags) { QVariantMap data = tag.toMap(); QString name = data["name"].toString(); QString type = data["type"].toString(); //qDebug() << __FILE__ << __LINE__ << name << ":" << type; if (tr("风格") != type) { if (tr("种类") == type) { setTag(1, true, name); } else if (tr("版式") == type) { setTag(2, true, name); } else if (tr("色系") == type) { setTag(3, true, name); } m_tags.insert(name, type); } else { ui->styleLineEdit->setText(name); } } QString args; useZip(ZipUsageRead, args2(args, m_pkgFile, "preview.png")); #endif } if (content.startsWith("picture:")) { QString name = content.mid(8); QString file = QDir::toNativeSeparators(name); QPixmap pix(file); //qDebug() << __FILE__ << __LINE__ << file << pix.isNull(); if (!pix.isNull()) { pix = pix.scaled(ui->pictureLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); ui->pictureLabel->setPixmap(pix); } QFile::remove(file); } } } void TemplateParserDlg::on_psdToolButton_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("选择文件"), m_dirName, tr("PSD文档 (*.psd)")); if (fileName.isEmpty()) { return; } unlock(); deleteDir(m_tmpDir); m_tmpDir.clear(); m_pkgFile.clear(); m_pkgName.clear(); m_xcmb.clear(); m_tags.clear(); fileName = QDir::toNativeSeparators(fileName); setWindowTitle(tr("%1 - %2").arg(m_wndTitle).arg(fileName)); m_dirName = fileName.left(fileName.lastIndexOf(QDir::separator()) + 1); QSettings settings("Jizhiyou", "TemplateParser"); settings.setValue("dir_name", m_dirName); //qDebug() << __FILE__ << __LINE__ << fileName << m_dirName; psd_release(m_pInfo); m_pInfo = (PSD_LAYERS_INFO *)calloc(1, sizeof(PSD_LAYERS_INFO)); strcpy(m_pInfo->file, fileName.toStdString().c_str()); psd_parse(m_pInfo); for (int i = 0; i < m_pInfo->count; i++) { if (!strlen(m_pInfo->layers[i].name)) { continue; } if (m_pInfo->layers[i].canvas) { m_bkSize = QSize(m_pInfo->layers[i].bound.width, m_pInfo->layers[i].bound.height); } QString uuid = QUuid::createUuid().toString().mid(1, 36); strcpy(m_pInfo->layers[i].lid, uuid.toStdString().c_str()); } m_xcmb.insert("id", QUuid::createUuid().toString().mid(1, 36)); m_xcmb.insert("ver", "1.0"); m_xcmb.insert("backgroundColor", "#FFFFFFFF"); int start = fileName.lastIndexOf('\\') + 1; int end = fileName.lastIndexOf(".psd", -1, Qt::CaseInsensitive); QString name = fileName.mid(start, end - start); m_xcmb.insert("name", name); deleteDir(m_dirName + name + "_png", false); QVariantMap bkSize; bkSize.insert("width", m_bkSize.width()); bkSize.insert("height", m_bkSize.height()); m_xcmb.insert("size", bkSize); ui->psdToolButton->setEnabled(false); ui->tmplToolButton->setEnabled(false); ui->wpCoverRadioButton->setChecked(false); ui->wpPageRadioButton->setChecked(false); ui->frame->setEnabled(false); ui->progressBar->setVisible(true); ui->progressBar->setValue(0); ui->pictureLabel->clear(); ui->sizeLabel->setText(tr("模板大小:0x0")); ui->styleLineEdit->clear(); ui->nameLineEdit->clear(); setTag(1, false); setTag(2, false); setTag(3, false); m_changed = true; m_finished = m_make = false; m_parser.initLayersInfo(m_pInfo); m_parser.start(); m_timer.start(60); } void TemplateParserDlg::on_tmplToolButton_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("选择文件"), m_dirName, tr("相册模板 (*.xcmb)")); if (fileName.isEmpty()) { return; } fileName = QDir::toNativeSeparators(fileName); if (m_pkgFile == fileName) { return; } unlock(); setWindowTitle(tr("%1 - %2").arg(m_wndTitle).arg(fileName)); QString filePath = fileName.left(fileName.lastIndexOf(QDir::separator())); ui->pathLineEdit->setText(filePath); m_dirName = filePath.append(QDir::separator()); QString name = fileName.mid(m_dirName.length(), fileName.length() - m_dirName.length() - strlen(PKG_FMT)); if (PKG_LEN_FIXED < name.length()) { m_pkgName = name.right(name.length() - PKG_LEN_FIXED); } else { m_pkgName.clear(); } ui->nameLineEdit->setText(m_pkgName); m_pkgFile = fileName; int pos = fileName.lastIndexOf(PKG_FMT, -1, Qt::CaseInsensitive); if (-1 != pos) { m_picFile = fileName.replace(pos, strlen(PKG_FMT), ".png"); } lock(); m_changed = m_make = m_opened = true; m_xcmb.clear(); m_tags.clear(); ui->psdToolButton->setEnabled(false); ui->tmplToolButton->setEnabled(false); ui->savePushButton->setEnabled(false); ui->wpCoverRadioButton->setChecked(false); ui->wpPageRadioButton->setChecked(false); ui->styleLineEdit->clear(); setTag(1, false); setTag(2, false); setTag(3, false); QString args; useZip(ZipUsageRead, args2(args, m_pkgFile, "page.dat")); } void TemplateParserDlg::end() { int v = ui->progressBar->value(); const int m = ui->progressBar->maximum(); if (m_finished) { m_timer.stop(); if (m != v) { ui->progressBar->setValue(m); } ui->psdToolButton->setEnabled(true); ui->tmplToolButton->setEnabled(true); ui->frame->setEnabled(true); ui->progressBar->setVisible(false); ui->sizeLabel->setText(tr("模板大小:%1x%2").arg(m_bkSize.width()).arg(m_bkSize.height())); if (!m_xcmb.contains("pagetype")) { if (720 == m_bkSize.width()) { if (1080 == m_bkSize.height()) { ui->wpCoverRadioButton->setChecked(true); } if (1280 == m_bkSize.height()) { ui->wpPageRadioButton->setChecked(true); } } } else { int page = m_xcmb["pagetype"].toInt(); if (1 == page) { ui->wpCoverRadioButton->setChecked(true); } else { ui->wpPageRadioButton->setChecked(true); } } } else { if (m > ++v) { ui->progressBar->setValue(v); QString pro = m_parser.isRunning() ? tr("解析进度:") : tr("生成进度:"); ui->progressBar->setFormat(tr("%1%2%").arg(pro).arg(100 * v / m)); } } } void TemplateParserDlg::ok() { if (m_finished) { return; } QString file(m_pInfo->file); int pos = file.lastIndexOf(".psd", -1, Qt::CaseInsensitive); if (-1 != pos) { QString tmplDir = file.replace(pos, 4, "_png"), tmplName = m_xcmb["name"].toString(); tmplDir.append("\\"); m_picFile = tr("%1%2.psd.png").arg(tmplDir).arg(tmplName); mkTempDir(); m_pkgFile = tr("%1%2%3").arg(m_tmpDir).arg(tmplName).arg(PKG_FMT); redirect(__LINE__, m_pkgFile); QVariantList list; int landscapeCount = 0, portraitCount = 0; /* add layers */ for (int i = 0; i < m_pInfo->count; i++) { if (!strlen(m_pInfo->layers[i].lid) || !strlen(m_pInfo->layers[i].name)) { continue; } QVariantMap layer; layer.insert("id", m_pInfo->layers[i].lid); layer.insert("name", QString(m_pInfo->layers[i].name)); layer.insert("rotation", m_pInfo->layers[i].angle); layer.insert("opacity", QString("%1").arg(m_pInfo->layers[i].opacity)); layer.insert("type", m_pInfo->layers[i].type); if (strlen(m_pInfo->layers[i].mid)) { layer.insert("maskLayer", m_pInfo->layers[i].mid); } QString name = tmplDir + QString("%1.png").arg(m_pInfo->layers[i].lid); QImage img(name); if (m_pInfo->layers[i].type) { if ((int)m_pInfo->layers[i].angle) { img = img.transformed(QTransform().rotate(-1 * m_pInfo->layers[i].angle)); } if (LT_Photo == m_pInfo->layers[i].type) { if (img.width() > img.height()) { landscapeCount++; } else { portraitCount++; } QFile::remove(name); pos = name.lastIndexOf("png", -1, Qt::CaseInsensitive); name.replace(pos, 3, "jpg"); img.save(name); //qDebug() << __FILE__ << __LINE__ << name << m_pInfo->layers[i].angle; } if (LT_Mask == m_pInfo->layers[i].type && QString(m_pInfo->layers[i].name).contains("lmask", Qt::CaseInsensitive)) { QVector<QRgb> rgbVector = img.colorTable(); for (int i = 0; i < rgbVector.size(); ++i) { QColor clr(rgbVector.at(i)); clr.setAlpha((clr.red() + clr.blue() + clr.green()) / 3); img.setColor(i, clr.rgba()); } } } if (name.endsWith("png")) { img.save(name, "png", 0); } m_pInfo->layers[i].actual.width = img.width(); m_pInfo->layers[i].actual.height = img.height(); layer.insert("orientation", m_pInfo->layers[i].actual.width > m_pInfo->layers[i].actual.height ? 1 : 0); //qDebug() << __FILE__ << __LINE__ << name; //qDebug() << __FILE__ << __LINE__ << m_pInfo->layers[i].type << m_pInfo->layers[i].name << m_pInfo->layers[i].lid; QVariantMap frame; frame.insert("width", m_pInfo->layers[i].actual.width); frame.insert("height", m_pInfo->layers[i].actual.height); frame.insert("x", m_pInfo->layers[i].center.x); frame.insert("y", m_pInfo->layers[i].center.y); layer.insert("frame", frame); list << layer; } m_xcmb.insert("layers", list); m_xcmb.insert("landscapeCount", landscapeCount); m_xcmb.insert("portraitCount", portraitCount); qDebug() << __FILE__ << __LINE__ << m_picFile << tmplDir + PREVIEW_PICTURE; QPixmap pix(m_picFile); if (!pix.isNull()) { ui->pictureLabel->setPixmap(pix.scaled(ui->pictureLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); QString picFile = m_picFile; m_picFile = tmplDir + PREVIEW_PICTURE; QFile::rename(picFile, m_picFile); } if (list.size()) { QString args; useZip(ZipUsageCompress, args2(args, m_pkgFile, tmplDir)); } } m_finished = true; m_parser.quit(); } void TemplateParserDlg::setTag(int type, bool checked, const QString &name) { if (checked && name.isEmpty()) { return; } if (1 == type) { if (!checked) { ui->typeChildrenCheckBox->setChecked(checked); ui->typePictorialCheckBox->setChecked(checked); ui->typeWeddingCheckBox->setChecked(checked); } else { if (name == ui->typeChildrenCheckBox->text()) { ui->typeChildrenCheckBox->setChecked(checked); } else if (name == ui->typePictorialCheckBox->text()) { ui->typePictorialCheckBox->setChecked(checked); } else if (name == ui->typeWeddingCheckBox->text()) { ui->typeWeddingCheckBox->setChecked(checked); } } } else if (2 == type) { if (!checked) { ui->styleFramelessCheckBox->setChecked(checked); ui->styleFrameCheckBox->setChecked(checked); ui->styleNonmaskCheckBox->setChecked(checked); ui->styleMaskCheckBox->setChecked(checked); } else { if (name == ui->styleFramelessCheckBox->text()) { ui->styleFramelessCheckBox->setChecked(checked); } else if (name == ui->styleFrameCheckBox->text()) { ui->styleFrameCheckBox->setChecked(checked); } else if (name == ui->styleNonmaskCheckBox->text()) { ui->styleNonmaskCheckBox->setChecked(checked); } else if (name == ui->styleMaskCheckBox->text()) { ui->styleMaskCheckBox->setChecked(checked); } } } else if (3 == type) { if (!checked) { ui->colorBlackCheckBox->setChecked(checked); ui->colorWhiteCheckBox->setChecked(checked); ui->colorGrayCheckBox->setChecked(checked); ui->colorCoffeeCheckBox->setChecked(checked); ui->colorRedCheckBox->setChecked(checked); ui->colorPinkCheckBox->setChecked(checked); ui->colorOrangeCheckBox->setChecked(checked); ui->colorYellowCheckBox->setChecked(checked); ui->colorCyanCheckBox->setChecked(checked); ui->colorGreenCheckBox->setChecked(checked); ui->colorBlueCheckBox->setChecked(checked); ui->colorPurpleCheckBox->setChecked(checked); } else { if (name == ui->colorBlackCheckBox->text()) { ui->colorBlackCheckBox->setChecked(checked); } else if (name == ui->colorWhiteCheckBox->text()) { ui->colorWhiteCheckBox->setChecked(checked); } else if (name == ui->colorGrayCheckBox->text()) { ui->colorGrayCheckBox->setChecked(checked); } else if (name == ui->colorCoffeeCheckBox->text()) { ui->colorCoffeeCheckBox->setChecked(checked); } if (name == ui->colorRedCheckBox->text()) { ui->colorRedCheckBox->setChecked(checked); } else if (name == ui->colorPinkCheckBox->text()) { ui->colorPinkCheckBox->setChecked(checked); } else if (name == ui->colorOrangeCheckBox->text()) { ui->colorOrangeCheckBox->setChecked(checked); } else if (name == ui->colorYellowCheckBox->text()) { ui->colorYellowCheckBox->setChecked(checked); } if (name == ui->colorCyanCheckBox->text()) { ui->colorCyanCheckBox->setChecked(checked); } else if (name == ui->colorGreenCheckBox->text()) { ui->colorGreenCheckBox->setChecked(checked); } else if (name == ui->colorBlueCheckBox->text()) { ui->colorBlueCheckBox->setChecked(checked); } else if (name == ui->colorPurpleCheckBox->text()) { ui->colorPurpleCheckBox->setChecked(checked); } } } } inline void TemplateParserDlg::addTag(const QCheckBox *cb) { QString value, name = cb->objectName(); if (name.startsWith("type")) { value = tr("种类"); } else if (name.startsWith("style")) { value = tr("版式"); } else if (name.startsWith("color")) { value = tr("色系"); } else { return; } name = cb->text(); if (cb->isChecked() && !value.isEmpty()) { m_tags.insert(name, value); } else { m_tags.remove(name); } updateWnd(); } inline void TemplateParserDlg::updateWnd() { if (!m_changed) { m_changed = true; } QString title = windowTitle(); if (CHANGED_SUFFIX != title.right(2)) { setWindowTitle(title + CHANGED_SUFFIX); ui->savePushButton->setEnabled(true); } } void TemplateParserDlg::closeEvent(QCloseEvent *event) { if (CHANGED_SUFFIX == windowTitle().right(2) && QMessageBox::AcceptRole == QMessageBox::question(this, tr("保存提示"), tr("当前相册模板包的数据已经被修改,是否要保存这些修改?"), tr("保存"), tr("不保存"))) { on_savePushButton_clicked(); } event->accept(); } void TemplateParserDlg::on_typeChildrenCheckBox_clicked() { addTag(ui->typeChildrenCheckBox); } void TemplateParserDlg::on_typePictorialCheckBox_clicked() { addTag(ui->typePictorialCheckBox); } void TemplateParserDlg::on_typeWeddingCheckBox_clicked() { addTag(ui->typeWeddingCheckBox); } void TemplateParserDlg::on_styleFramelessCheckBox_clicked() { addTag(ui->styleFramelessCheckBox); } void TemplateParserDlg::on_styleFrameCheckBox_clicked() { addTag(ui->styleFrameCheckBox); } void TemplateParserDlg::on_styleNonmaskCheckBox_clicked() { addTag(ui->styleNonmaskCheckBox); } void TemplateParserDlg::on_styleMaskCheckBox_clicked() { addTag(ui->styleMaskCheckBox); } void TemplateParserDlg::on_colorBlackCheckBox_clicked() { addTag(ui->colorBlackCheckBox); } void TemplateParserDlg::on_colorWhiteCheckBox_clicked() { addTag(ui->colorWhiteCheckBox); } void TemplateParserDlg::on_colorGrayCheckBox_clicked() { addTag(ui->colorGrayCheckBox); } void TemplateParserDlg::on_colorCoffeeCheckBox_clicked() { addTag(ui->colorCoffeeCheckBox); } void TemplateParserDlg::on_colorRedCheckBox_clicked() { addTag(ui->colorRedCheckBox); } void TemplateParserDlg::on_colorPinkCheckBox_clicked() { addTag(ui->colorPinkCheckBox); } void TemplateParserDlg::on_colorOrangeCheckBox_clicked() { addTag(ui->colorOrangeCheckBox); } void TemplateParserDlg::on_colorYellowCheckBox_clicked() { addTag(ui->colorYellowCheckBox); } void TemplateParserDlg::on_colorCyanCheckBox_clicked() { addTag(ui->colorCyanCheckBox); } void TemplateParserDlg::on_colorGreenCheckBox_clicked() { addTag(ui->colorGreenCheckBox); } void TemplateParserDlg::on_colorBlueCheckBox_clicked() { addTag(ui->colorBlueCheckBox); } void TemplateParserDlg::on_colorPurpleCheckBox_clicked() { addTag(ui->colorPurpleCheckBox); } void TemplateParserDlg::on_nameLineEdit_textChanged(const QString &arg1) { if (m_pkgName != arg1) { updateWnd(); } } void TemplateParserDlg::on_browsePushButton_clicked() { m_dirName = QFileDialog::getExistingDirectory(this, tr("选择文件夹"), m_dirName); if (m_dirName.isEmpty()) { return; } ui->pathLineEdit->setText(m_dirName); m_dirName.append(QDir::separator()); QSettings settings("Jizhiyou", "TemplateParser"); settings.setValue("dir_name", m_dirName); } void TemplateParserDlg::on_savePushButton_clicked() { if (!m_changed || m_pkgFile.isEmpty()) { return; } if (!ui->wpCoverRadioButton->isChecked() && !ui->wpPageRadioButton->isChecked()) { QMessageBox::warning(this, tr("缺少类型"), tr("请选择一种模板类型!"), tr("确定")); return; } if (!ui->typeChildrenCheckBox->isChecked() && !ui->typePictorialCheckBox->isChecked() && !ui->typeWeddingCheckBox->isChecked()) { QMessageBox::warning(this, tr("缺少种类"), tr("请选择一种模板种类!"), tr("确定")); return; } if (!ui->styleFramelessCheckBox->isChecked() && !ui->styleFrameCheckBox->isChecked() && !ui->styleNonmaskCheckBox->isChecked() && !ui->styleMaskCheckBox->isChecked()) { QMessageBox::warning(this, tr("缺少版式"), tr("请选择一种模板版式!"), tr("确定")); return; } if (!ui->colorBlackCheckBox->isChecked() && !ui->colorWhiteCheckBox->isChecked() && !ui->colorGrayCheckBox->isChecked() && !ui->colorCoffeeCheckBox->isChecked() && !ui->colorRedCheckBox->isChecked() && !ui->colorPinkCheckBox->isChecked() && !ui->colorOrangeCheckBox->isChecked() && !ui->colorYellowCheckBox->isChecked() && !ui->colorCyanCheckBox->isChecked() && !ui->colorGreenCheckBox->isChecked() && !ui->colorBlueCheckBox->isChecked() && !ui->colorPurpleCheckBox->isChecked()) { QMessageBox::warning(this, tr("缺少色系"), tr("请选择一种模板色系!"), tr("确定")); return; } QString savePath = ui->pathLineEdit->text(); if (savePath.isEmpty()) { if (QMessageBox::AcceptRole == QMessageBox::question(this, tr("无效路径"), tr("本地目录不能为空,请点击确定按钮进行选择,点击取消按钮则放弃本次操作。"), tr("确定"), tr("取消"))) { on_browsePushButton_clicked(); } return; } savePath.append(QDir::separator()); QVariantList tagsList; QVariantMap::const_iterator iter = m_tags.constBegin(); while (iter != m_tags.constEnd()) { QVariantMap tagMap; tagMap.insert("name", iter.key()); tagMap.insert("type", iter.value()); tagsList << tagMap; //qDebug() << __FILE__ << __LINE__ << iter.key() << ":" << iter.value().toString(); ++iter; } QString style = ui->styleLineEdit->text(); if (!style.isEmpty()) { QVariantMap tagMap; tagMap.insert("name", style); tagMap.insert("type", tr("风格")); tagsList << tagMap; } m_xcmb.insert("tags", tagsList); if (0 == m_xcmb["landscapeCount"].toInt() + m_xcmb["portraitCount"].toInt() && QMessageBox::RejectRole == QMessageBox::question(this, tr("无效路径"), tr("该模板中未发现类型为照片的图层,请检查PSD文件中照片图层的命名格式是否\n符合“名称+@photo”规范?若要继续生成,请点击确定按钮,否则点击取消按钮放弃本次操作。"), tr("确定"), tr("取消"))) { return; } int cover = ui->wpCoverRadioButton->isChecked() ? 1 : 0; m_xcmb.insert("pagetype", cover); QString name = ui->nameLineEdit->text(); m_xcmb.insert("name", name); m_tmpFile = m_tmpDir + "page.dat"; QFile jf(m_tmpFile); if (!jf.open(QIODevice::WriteOnly | QIODevice::Text)) { return; } QByteArray result = QtJson::serialize(m_xcmb); jf.write(result); jf.close(); //qDebug() << __FILE__ << __LINE__ << m_tmpFile; int count = m_xcmb["landscapeCount"].toInt() + m_xcmb["portraitCount"].toInt(); QDateTime dt = QDateTime::currentDateTime(); QString tmplName = QString("MP_%1_P%2_%3_").arg(cover ? 'C' : 'P').arg(count).arg(dt.toString("yyyyMMddhhmm")); if (!name.isEmpty()) { tmplName += name; } QString pkgFile = tr("%1%2%3").arg(savePath).arg(tmplName).arg(PKG_FMT); QFile file(pkgFile); redirect(__LINE__, savePath + ", " + tmplName + ", " + m_pkgFile + ", " + pkgFile); if (file.exists()) { QMessageBox::warning(this, tr("保存失败"), tr("目录下已经存在一个同名的相册模板\"%2\",请更名后再进行保存!").arg(savePath).arg(tmplName), tr("确定")); return; } unlock(); QString picFile = tr("%1%2.png").arg(savePath).arg(tmplName); qDebug() << __FILE__ << __LINE__ << m_picFile << picFile; //moveTo(m_picFile, savePath); //QFile::rename(m_picFile, picFile); if (QFile::exists(m_picFile)) { QFile::rename(m_picFile, picFile); } else { QFile::copy(m_picFile, picFile); } m_picFile = picFile; //moveTo(m_pkgFile, savePath); //QFile::rename(m_pkgFile, pkgFile); if (QFile::exists(m_pkgFile)) { QFile::rename(m_pkgFile, pkgFile); } else { QFile::copy(m_pkgFile, pkgFile); } m_pkgFile = pkgFile; m_changed = false; redirect(__LINE__, m_pkgFile); #if PKG_ENCRYPT if (m_opened) { m_make = m_opened = false; } #endif QString args; useZip(ZipUsageAppend, args2(args, m_pkgFile, m_tmpFile)); if (QFile::exists(m_tmpFile)) { QFile::remove(m_tmpFile); } m_tmpFile.clear(); lock(); setWindowTitle(tr("%1 - %2").arg(m_wndTitle).arg(m_pkgFile)); //qDebug() << __FILE__ << __LINE__ << m_pkgFile << m_picFile; ui->savePushButton->setEnabled(false); QMessageBox::information(this, tr("保存成功"), tr("相册模板包已经保存成功!"), tr("确定")); } void TemplateParserDlg::useZip(ZipUsage usage, const QString &arguments, bool block) { if (arguments.isEmpty()) { return; } QString program(MAKER_NAME); //QString program = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + MAKER_NAME); m_usage = usage; switch (usage) { case ZipUsageCompress: program += QString(" -c "); break; case ZipUsageAppend: program += QString(" -a "); break; case ZipUsageRemove: program += QString(" -x "); break; case ZipUsageUncompress: program += QString(" -u "); break; case ZipUsageList: program += QString(" -l "); break; case ZipUsageRead: program += QString(" -r "); break; case ZipUsageEncrypt: program += QString(" -e "); break; case ZipUsageDecrypt: program += QString(" -d "); break; default: return; } program += arguments; redirect(__LINE__, program); if (!block) { m_tmaker.start(program); m_tmaker.waitForFinished(); } else { m_tmaker.execute(program); } }
b6987ad9c2e3e65a8e9aa5783f76b883f7ab709c
5cc00bad4391ef53636a6316ca04f9cdcdb51147
/mqtt.cpp
1a653c2b65f82f2edeba111b365ecf7dfa70d377
[ "MIT" ]
permissive
TylerWilley/familylight
5755b4e3ed72ccff856ac2749617f97a5de42df9
5eab330b312439fdc2e17b9ebc36c0804f801f2e
refs/heads/master
2023-04-28T21:41:41.448199
2021-05-25T03:46:54
2021-05-25T03:46:54
296,750,587
0
1
MIT
2021-05-25T03:46:54
2020-09-18T23:38:33
C++
UTF-8
C++
false
false
3,569
cpp
mqtt.cpp
#include "mqtt.h" #include "storage.h" #include "neo.h" WiFiClient espClient; WiFiClientSecure espClientSsl; extern ConfigMap config; PubSubClient *client = NULL; String clientId = ""; uint32_t next_connect_attempt = 0; void callback(char* topic, byte* payload, unsigned int length) { /* Called on MQTT message recieved (color update) */ Serial.print(F("[MQTT] Message arrived [")); Serial.print(topic); Serial.print(F("] ")); char payload_str[40]; for (int i = 0; i < length; i++) { Serial.print((char)payload[i]); if(i < 40) payload_str[i] = (char)payload[i]; } payload_str[39] = 0; Serial.println(); if(strncmp(topic, "familylight/color", 17) == 0) { Serial.println("[MQTT] Got color update"); client->publish("familylight/checkin", "recieved"); } else { Serial.println("[MQTT] Other light acked, blink"); } int rgb[3]; int idx = 0; char* command = strtok(payload_str, ","); while (command != 0) { Serial.print("p[MQTT] art:"); Serial.println(command); rgb[idx] = atoi(command); idx += 1; command = strtok(0, ","); } Serial.print("[MQTT] Setting color:"); Serial.print(rgb[0]); Serial.print(","); Serial.print(rgb[1]); Serial.print(","); Serial.println(rgb[2]); set_neo_color(rgb[0], rgb[1], rgb[2]); } void send_color(String color) { /* Publish a color update to the neopixel topic */ client->publish("familylight/color", color.c_str()); } void setup_mqtt() { /* Initialize MQTT using SSL or non-SSL based on wifi manager settings */ Serial.println(F("[MQTT] Setting up")); clientId += String("family_light_"); clientId += String(random(0xffff), HEX); Serial.print(F("[MQTT] Client ID: ")); Serial.println(clientId); if(config.bSsl) { Serial.print(F("[MQTT] SSL: ")); if(config.szFingerprint[0] == '\0') { Serial.println(F("[MQTT] Insecure")); espClientSsl.setInsecure(); // No fingerprint, no validation } else { Serial.print(F("[MQTT] Fingerprinted:")); Serial.println(config.szFingerprint); espClientSsl.setFingerprint(config.szFingerprint); } client = new PubSubClient(espClientSsl); } else { Serial.println(F("[MQTT] No-SSL")); client = new PubSubClient(espClient); } Serial.print(F("[MQTT] Connecting: ")); Serial.print(config.szServer); Serial.print(':'); Serial.println(config.port); client->setServer(config.szServer, config.port); client->setCallback(callback); } bool loop_mqtt() { /* Reconnect MQTT if disconnected. Attempt every 5s If connected, run the client loop */ if (!client->connected() && millis() > next_connect_attempt) { set_neo_setup_mode(); Serial.println(F("[MQTT] Disconnected. Connecting...")); bool res = false; if(config.szUsername[0] != '\0') { Serial.print("[MQTT] Connecting with username"); res = client->connect(clientId.c_str(), config.szUsername, config.szPassword); } else { Serial.print("[MQTT] Connecting anonymously"); res = client->connect(clientId.c_str()); } if (res) { Serial.println(F("[MQTT] Connected")); client->subscribe("familylight/color"); //client.subscribe("familylight/checkin"); set_neo_off(); } else { Serial.print(F("[MQTT] Connection failed, rc=")); Serial.print(client->state()); Serial.println(F(" try again in 5 seconds")); next_connect_attempt = millis() + 5000; return false; } } client->loop(); return true; }
5807c3a1abcef479b03d53b720af606e5960ea22
8ed7af43f519d5f70f9162e91390b97e3e4a7fb8
/app/main.cpp
cd8883a775fc58258c1697174c2f2924f534693e
[]
no_license
ibradam/voronoi
75c4fc2f03e353dd64e11b6dd0021904826a3d44
a184752edbd21fde2c9ec4bc04ed091485ef4a3b
refs/heads/master
2021-01-10T10:16:05.515021
2016-03-18T11:39:02
2016-03-18T11:39:02
47,836,117
1
0
null
null
null
null
UTF-8
C++
false
false
164
cpp
main.cpp
#include <iostream> using namespace std; int main() { int resultat(0), a(5), b(8); resultat = a + b; cout << "5 + 8 = " << resultat << endl; return 0; }
3b5c01624737290cb6d1b7f58ea151bfd022b2ba
ebfea37709e91365d41748f90e1831461ca7eae7
/IChannel.h
cf4ba96b4bb12c616420e3994e05a42ab93ac0d1
[]
no_license
ocarizr/Cpp-Project
872e26b320e546ee1f3e978f0ea4a7ed07d77524
d99082392559e793049b2770de557968c2a962b3
refs/heads/master
2021-02-16T10:03:34.081573
2020-03-23T21:42:12
2020-03-23T21:42:12
244,993,246
2
1
null
2020-03-23T21:42:13
2020-03-04T20:06:31
C++
UTF-8
C++
false
false
762
h
IChannel.h
#ifndef ICHANNEL_H #define ICHANNEL_H #include "ConfigManager/ConfigManagerLib.h" #include "LogManager/LogManagerLib.h" template<typename T> class IChannel { protected: LogManager::Logger<T> m_logger; // Add Pipe Information uint16_t m_ID; public: IChannel() = delete; IChannel(LogManager::Logger<T>& logger, uint16_t id) : m_logger(logger), m_ID(id) {} IChannel(const IChannel&) = default; IChannel(IChannel&&) = default; IChannel& operator=(const IChannel&) = default; IChannel& operator=(IChannel&&) = default; virtual ~IChannel(){} virtual void Start() = 0; virtual bool ReadData() = 0; virtual bool GetState() = 0; LogManager::Logger<T>& GetLogger() { return m_logger; } }; #endif // ICHANNEL_H
5b0299be88473415ff1282026508602980cc61b0
cee93f32358764aa2fa586a7455e314e51bd91c0
/code/c and c++/ML_backpropagation/Neuron.h
5bda65f7ede930516071ead5a80b6299a8f626a6
[]
no_license
starrain3/Blog-samples
2cdb8403a0eabfd7baeeff506dead0159be6aac1
5e448a579780eeb1e51ea13ed75d4049209091a4
refs/heads/master
2022-11-23T22:27:36.741032
2020-07-27T15:36:43
2020-07-27T15:36:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
500
h
Neuron.h
#pragma once #include <vector> using namespace std; #pragma once class Neuron { public: Neuron(int dendritesSize); ~Neuron(); void pushInput(double* in); void activity(); double output(); void correct(int index,double detla); double getWeight(int index); int dendritySize(); int WeightSize(); private: double _bais; double _synapse; vector<double> _dendrites; double *_signals; int _dendritySize; const double _arfa = -0.5; const double momentum = 1; double summation(); };
4b35e14c3bc59e902f22e039a23f4848f0edf1e6
04b1803adb6653ecb7cb827c4f4aa616afacf629
/services/tracing/test_util.h
821a7eb023c01c623f68fdf62186129e18a57f50
[ "BSD-3-Clause" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
C++
false
false
1,385
h
test_util.h
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_TRACING_TEST_UTIL_H_ #define SERVICES_TRACING_TEST_UTIL_H_ #include <string> #include <vector> #include "base/trace_event/trace_log.h" #include "base/values.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/tracing/public/mojom/tracing.mojom.h" namespace base { class TimeTicks; } // namespace base namespace tracing { class MockAgent : public mojom::Agent { public: MockAgent(); ~MockAgent() override; mojom::AgentPtr CreateAgentPtr(); std::vector<std::string> call_stat() const { return call_stat_; } // Set these variables to configure the agent. std::vector<std::string> data_; base::DictionaryValue metadata_; std::string categories_; base::trace_event::TraceLogStatus trace_log_status_; private: // mojom::Agent void StartTracing(const std::string& config, base::TimeTicks coordinator_time, StartTracingCallback cb) override; void StopAndFlush(mojom::RecorderPtr recorder) override; void RequestBufferStatus(RequestBufferStatusCallback cb) override; mojo::Binding<mojom::Agent> binding_; std::vector<std::string> call_stat_; }; } // namespace tracing #endif // SERVICES_TRACING_TEST_UTIL_H_
e6271a3f15d39f1705ffb5a3806cece66c6cb383
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp
3967784fe9491c9b391663a9655ba4130690f561
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
C++
false
false
15,157
cpp
xfa_utils.cpp
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "xfa/fxfa/parser/xfa_utils.h" #include "core/fxcrt/fx_ext.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/xfa_basic_data.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" namespace { const FX_DOUBLE fraction_scales[] = {0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, 0.00000001, 0.000000001, 0.0000000001, 0.00000000001, 0.000000000001, 0.0000000000001, 0.00000000000001, 0.000000000000001, 0.0000000000000001}; FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { CFX_WideString wsValue = wsStringVal; wsValue.TrimLeft(); wsValue.TrimRight(); int64_t nIntegral = 0; uint32_t dwFractional = 0; int32_t nExponent = 0; int32_t cc = 0; bool bNegative = false; bool bExpSign = false; const FX_WCHAR* str = wsValue.c_str(); int32_t len = wsValue.GetLength(); if (str[0] == '+') { cc++; } else if (str[0] == '-') { bNegative = true; cc++; } int32_t nIntegralLen = 0; while (cc < len) { if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || nIntegralLen > 17) { break; } if (!FXSYS_isDecimalDigit(str[cc])) { return 0; } nIntegral = nIntegral * 10 + str[cc] - '0'; cc++; nIntegralLen++; } nIntegral = bNegative ? -nIntegral : nIntegral; int32_t scale = 0; FX_DOUBLE fraction = 0.0; if (cc < len && str[cc] == '.') { cc++; while (cc < len) { fraction += fraction_scales[scale] * (str[cc] - '0'); scale++; cc++; if (cc == len) { break; } if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || str[cc] == 'E' || str[cc] == 'e') { break; } if (!FXSYS_isDecimalDigit(str[cc])) { return 0; } } dwFractional = (uint32_t)(fraction * 4294967296.0); } if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { cc++; if (cc < len) { if (str[cc] == '+') { cc++; } else if (str[cc] == '-') { bExpSign = true; cc++; } } while (cc < len) { if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { return 0; } nExponent = nExponent * 10 + str[cc] - '0'; cc++; } nExponent = bExpSign ? -nExponent : nExponent; } FX_DOUBLE dValue = (dwFractional / 4294967296.0); dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); if (nExponent != 0) { dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); } return dValue; } } // namespace CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { CXFA_Node* pNodeValue = pWidgetData->GetNode()->GetChild(0, XFA_Element::Value); if (!pNodeValue) { return CXFA_LocaleValue(); } CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild); if (!pValueChild) { return CXFA_LocaleValue(); } int32_t iVTType = XFA_VT_NULL; switch (pValueChild->GetElementType()) { case XFA_Element::Decimal: iVTType = XFA_VT_DECIMAL; break; case XFA_Element::Float: iVTType = XFA_VT_FLOAT; break; case XFA_Element::Date: iVTType = XFA_VT_DATE; break; case XFA_Element::Time: iVTType = XFA_VT_TIME; break; case XFA_Element::DateTime: iVTType = XFA_VT_DATETIME; break; case XFA_Element::Boolean: iVTType = XFA_VT_BOOLEAN; break; case XFA_Element::Integer: iVTType = XFA_VT_INTEGER; break; case XFA_Element::Text: iVTType = XFA_VT_TEXT; break; default: iVTType = XFA_VT_NULL; break; } return CXFA_LocaleValue(iVTType, pWidgetData->GetRawValue(), pWidgetData->GetNode()->GetDocument()->GetLocalMgr()); } void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFX_WideString& wsPlainText) { if (!pXMLNode) { return; } switch (pXMLNode->GetType()) { case FDE_XMLNODE_Element: { CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); CFX_WideString wsTag; pXMLElement->GetLocalTagName(wsTag); uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true); if (uTag == 0x0001f714) { wsPlainText += L"\n"; } else if (uTag == 0x00000070) { if (!wsPlainText.IsEmpty()) { wsPlainText += L"\n"; } } else if (uTag == 0xa48ac63) { if (!wsPlainText.IsEmpty() && wsPlainText[wsPlainText.GetLength() - 1] != '\n') { wsPlainText += L"\n"; } } } break; case FDE_XMLNODE_Text: { CFX_WideString wsContent; static_cast<CFDE_XMLText*>(pXMLNode)->GetText(wsContent); wsPlainText += wsContent; } break; case FDE_XMLNODE_CharData: { CFX_WideString wsCharData; static_cast<CFDE_XMLCharData*>(pXMLNode)->GetCharData(wsCharData); wsPlainText += wsCharData; } break; default: break; } for (CFDE_XMLNode* pChildXML = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pChildXML; pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) { XFA_GetPlainTextFromRichText(pChildXML, wsPlainText); } } FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { FX_BOOL bRet = FALSE; if (!pFieldNode) return bRet; CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui); if (pUIChild) { CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); if (pFirstChild && pFirstChild->GetElementType() == XFA_Element::ChoiceList) { bRet = pFirstChild->GetEnum(XFA_ATTRIBUTE_Open) == XFA_ATTRIBUTEENUM_MultiSelect; } } return bRet; } FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); return WideStringToDouble(wsValue); } int32_t XFA_MapRotation(int32_t nRotation) { nRotation = nRotation % 360; nRotation = nRotation < 0 ? nRotation + 360 : nRotation; return nRotation; } const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_Element eElement, const CFX_WideStringC& wsAttributeName) { if (wsAttributeName.IsEmpty()) return nullptr; int32_t iElementIndex = static_cast<int32_t>(eElement); while (iElementIndex != -1) { const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; int32_t icount = scriptIndex->wAttributeCount; if (icount == 0) { iElementIndex = scriptIndex->wParentIndex; continue; } uint32_t uHash = FX_HashCode_GetW(wsAttributeName, false); int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_SCRIPTATTRIBUTEINFO* pInfo = g_SomAttributeData + iMid; if (uHash == pInfo->uHash) return pInfo; if (uHash < pInfo->uHash) iEnd = iMid - 1; else iStart = iMid + 1; } while (iStart <= iEnd); iElementIndex = scriptIndex->wParentIndex; } return nullptr; } const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, XFA_ATTRIBUTE eAttribute, XFA_ATTRIBUTETYPE eType) { int32_t iStart = 0, iEnd = g_iXFANotsureCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_NOTSUREATTRIBUTE* pAttr = g_XFANotsureAttributes + iMid; if (eElement == pAttr->eElement) { if (pAttr->eAttribute == eAttribute) { if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) return pAttr; return nullptr; } int32_t iBefore = iMid - 1; if (iBefore >= 0) { pAttr = g_XFANotsureAttributes + iBefore; while (eElement == pAttr->eElement) { if (pAttr->eAttribute == eAttribute) { if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) return pAttr; return nullptr; } iBefore--; if (iBefore < 0) break; pAttr = g_XFANotsureAttributes + iBefore; } } int32_t iAfter = iMid + 1; if (iAfter <= g_iXFANotsureCount - 1) { pAttr = g_XFANotsureAttributes + iAfter; while (eElement == pAttr->eElement) { if (pAttr->eAttribute == eAttribute) { if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) return pAttr; return nullptr; } iAfter++; if (iAfter > g_iXFANotsureCount - 1) break; pAttr = g_XFANotsureAttributes + iAfter; } } return nullptr; } if (eElement < pAttr->eElement) iEnd = iMid - 1; else iStart = iMid + 1; } while (iStart <= iEnd); return nullptr; } const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, XFA_Element eProperty, uint32_t dwPacket) { int32_t iCount = 0; const XFA_PROPERTY* pProperties = XFA_GetElementProperties(eElement, iCount); if (!pProperties || iCount < 1) return nullptr; auto it = std::find_if(pProperties, pProperties + iCount, [eProperty](const XFA_PROPERTY& prop) { return prop.eName == eProperty; }); if (it == pProperties + iCount) return nullptr; const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); ASSERT(pInfo); if (dwPacket != XFA_XDPPACKET_UNKNOWN && !(dwPacket & pInfo->dwPackets)) return nullptr; return it; } const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, int32_t& iCount) { if (eElement == XFA_Element::Unknown) return nullptr; const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementPropertyIndex + static_cast<int32_t>(eElement); iCount = pElement->wCount; return g_XFAElementPropertyData + pElement->wStart; } const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount) { if (eElement == XFA_Element::Unknown) return nullptr; const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementAttributeIndex + static_cast<int32_t>(eElement); iCount = pElement->wCount; return g_XFAElementAttributeData + pElement->wStart; } const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName) { return eName != XFA_Element::Unknown ? g_XFAElementData + static_cast<int32_t>(eName) : nullptr; } XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) { if (wsName.IsEmpty()) return XFA_Element::Unknown; uint32_t uHash = FX_HashCode_GetW(wsName, false); const XFA_ELEMENTINFO* pEnd = g_XFAElementData + g_iXFAElementCount; auto pInfo = std::lower_bound(g_XFAElementData, pEnd, uHash, [](const XFA_ELEMENTINFO& info, uint32_t hash) { return info.uHash < hash; }); if (pInfo < pEnd && pInfo->uHash == uHash) return pInfo->eName; return XFA_Element::Unknown; } CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement, XFA_ATTRIBUTE eAttribute, uint32_t dwPacket) { void* pValue; if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, XFA_ATTRIBUTETYPE_Measure, dwPacket)) { return *(CXFA_Measurement*)pValue; } return CXFA_Measurement(); } FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, XFA_Element eElement, XFA_ATTRIBUTE eAttribute, XFA_ATTRIBUTETYPE eType, uint32_t dwPacket) { const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); if (!pInfo) return FALSE; if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) return FALSE; if (pInfo->eType == eType) { pValue = pInfo->pDefValue; return TRUE; } if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { const XFA_NOTSUREATTRIBUTE* pAttr = XFA_GetNotsureAttribute(eElement, eAttribute, eType); if (pAttr) { pValue = pAttr->pValue; return TRUE; } } return FALSE; } const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { if (wsName.IsEmpty()) return nullptr; uint32_t uHash = FX_HashCode_GetW(wsName, false); int32_t iStart = 0; int32_t iEnd = g_iXFAAttributeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_ATTRIBUTEINFO* pInfo = g_XFAAttributeData + iMid; if (uHash == pInfo->uHash) return pInfo; if (uHash < pInfo->uHash) iEnd = iMid - 1; else iStart = iMid + 1; } while (iStart <= iEnd); return nullptr; } const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : nullptr; } const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( const CFX_WideStringC& wsName) { if (wsName.IsEmpty()) return nullptr; uint32_t uHash = FX_HashCode_GetW(wsName, false); int32_t iStart = 0; int32_t iEnd = g_iXFAEnumCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_ATTRIBUTEENUMINFO* pInfo = g_XFAEnumData + iMid; if (uHash == pInfo->uHash) return pInfo; if (uHash < pInfo->uHash) iEnd = iMid - 1; else iStart = iMid + 1; } while (iStart <= iEnd); return nullptr; } const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { return g_XFAPacketData + ePacket; } const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) { int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; uint32_t dwFind = (g_XFAPacketData + iMid)->eName; if (dwPacket == dwFind) return g_XFAPacketData + iMid; if (dwPacket < dwFind) iEnd = iMid - 1; else iStart = iMid + 1; } while (iStart <= iEnd); return nullptr; }
316765da1a9783a41841227cf00bf559eaa46be4
afa15c758963822802704f76086602d5c8235424
/src/led_strip_controller/hsv_helper.h
d1ad7ecaa4821d076dc67350f73f1d1179567b12
[ "MIT" ]
permissive
moonfall/Pixel-Styles-Host
47df8d27f553fda370ff098d2a126074307a6afb
d407761ed03e8d4facf0ef00912004ba7730b949
refs/heads/master
2021-01-22T09:20:41.239378
2016-03-03T07:54:22
2016-03-03T07:54:22
58,141,942
1
0
null
2016-05-05T15:40:13
2016-05-05T15:40:12
null
UTF-8
C++
false
false
1,414
h
hsv_helper.h
/* * hsv_helper.h - Colors manipulations helpers * * Copyright (C) 2013 William Markezana <william.markezana@me.com> * */ #pragma once #include <stdlib.h> #include <stdint.h> #include <string> #if !defined(min_of) #define min_of(A,B) ( A < B ? A : B ) #endif #if !defined(max_of) #define max_of(A,B) ( A < B ? B : A ) #endif /* * public types * */ typedef struct { uint8_t R; uint8_t G; uint8_t B; uint8_t A; } rgb_color; typedef struct { uint16_t H; uint8_t S; uint8_t V; uint8_t A; } hsv_color; /* * public prototypes * */ rgb_color hsv_to_rgb(hsv_color pHsvColor); rgb_color hue_to_rgb(uint16_t pHue); rgb_color inc_hue_of_color(rgb_color pRgbColor, uint16_t pInc); rgb_color hue_float_to_rgb(float &pHue); rgb_color hue_val_float_to_rgb(float &pHue, float &pSat); hsv_color hue_to_hsv(uint16_t pHue); uint16_t rgb_to_hue(rgb_color pRgbColor); hsv_color rgb_to_hsv(rgb_color pRgbColor); uint32_t rgb_to_int(rgb_color pRgbColor); rgb_color int_to_rgb(uint32_t pIntColor); hsv_color int_to_hsv(uint32_t pIntColor); std::string rgb_to_string(rgb_color pRgbColor); rgb_color alpha_blend(rgb_color pColor1, rgb_color pColor2); extern rgb_color ColorRed; extern rgb_color ColorGreen; extern rgb_color ColorBlue; extern rgb_color ColorYellow; extern rgb_color ColorMagenta; extern rgb_color ColorAqua; extern rgb_color ColorBlack; extern rgb_color ColorWhite; extern rgb_color ColorClear;
e7a255c944ec4f9f8f69d112afd84167711c9455
331a1e6356e0080b72571f373338dcd92d5159ce
/leetcode/1.cpp
8cdb4714b2c856f3371a03003eab4d0f1a314996
[]
no_license
fgcmaster/MyCode
d339e2ab3c1278b3304f3e9b9bd29cdcc8f750c4
1fa3ff57bb94062aa136b5b831cc85d2ac886cd2
refs/heads/master
2021-06-13T10:30:33.163615
2021-04-27T01:25:45
2021-04-27T01:25:45
31,703,716
0
0
null
null
null
null
UTF-8
C++
false
false
1,322
cpp
1.cpp
#include <stdlib.h> #include <stdio.h> #include <vector> #include <iostream> #include <unordered_map> using namespace std; typedef vector<int> IntVec; typedef unordered_map<int, int> IntMap; class Solution { public: vector<int> twoSum(const vector<int>& nums, int target) { IntMap numMap; for(int i = 0; i < nums.size(); ++i) { numMap[nums[i]]= i; } IntVec result; int minusNum = 0; for(int i = 0; i < nums.size(); ++i) { minusNum = target - nums[i]; if(numMap.find(minusNum) !=numMap.end() && numMap[minusNum] > i) { int indices = numMap[minusNum]; result.push_back(i); result.push_back(indices); } } return result; } }; void printArray(const IntVec& nums) { for(IntVec::const_iterator iter = nums.begin(); iter != nums.end(); ++iter) { printf("%d\t", *iter); } printf("\n"); } void checkResult(const IntVec& leftNums, int value, const IntVec& target) { Solution sol; IntVec result = sol.twoSum(leftNums, value); if(result[0] == target[0] && result[1] == target[1]) { printf("\ttrue.\n"); } else { printf("\tfalse, %d %d != %d %d\n", result[0], result[1], target[0], target[1]); } } int main() { checkResult({2,7,11,15}, 9, {0,1}); checkResult({2,7,11,15, 7}, 14, {1,4}); checkResult({3,2,4}, 6, {1,2}); return 0; }
529c54114413e3e9a2d28fd189ebe40990c21f24
8de0009236b21045d5b043ccb2d1f4216f1a76c3
/magic_item.cpp
12baf46935bc33affd981b51926f5fbff56ea63b
[]
no_license
B-Techie/Derived-Class
0c388b3ca6434f2a62b59ea99ce029498fec620a
a2a01d35046c4e75128c02f2660f8bc6b6081efe
refs/heads/master
2016-09-01T08:37:54.169090
2015-12-09T01:48:36
2015-12-09T01:48:36
47,661,191
0
0
null
null
null
null
UTF-8
C++
false
false
1,322
cpp
magic_item.cpp
#include "magic_item.h" // Overloaded derived Constructor // @param name // @param value // @param desciption // @param mana_required // Constructor call to class Item MagicItem::MagicItem(string name, unsigned int value, string description, unsigned int mana_required) : Item(name, value), description_(description), mana_required_(mana_required) { } // Destructor MagicItem::~MagicItem() {} // Accessor for description_ variable string MagicItem::description() const { return description_; } // Mutator for description_ variable // @param const string &description void MagicItem::set_description(const string& description) { description_ = description; } // Accessor for mana_required_ variable unsigned int MagicItem::mana_required() const { return mana_required_; } // Mutator for mana_required_ variable // @param unsigned int mana_required void MagicItem::set_mana_required(unsigned int mana_required) { mana_required_ = mana_required; } // Manipulator function for derived and class variabls // Format name, $value, description, mana_required string MagicItem::ToString() { stringstream ss; ss.setf(std::ios::fixed|std::ios::showpoint); ss.precision(2); ss << name() << ", $" << value() << ", " << description() << ", requires " << mana_required() << " mana"; return ss.str(); }
40d549f5bad8eb7962f95c8747906392abf9d711
3ad2482be0d2487ad0b24fbe569ea4e7f7e97974
/src/Utils.cpp
e47717b4448c9447a827194e7fb4a833c91f9f53
[ "Unlicense" ]
permissive
falki147/mkatlas
25d0d77d21487763611f4d7cae20bdd1f7aa0df1
f0f81d91134982365d1a597242db05744e9f1484
refs/heads/master
2023-01-06T05:55:46.678957
2017-02-12T16:28:41
2023-01-02T18:06:05
46,113,106
0
0
null
null
null
null
UTF-8
C++
false
false
251
cpp
Utils.cpp
#include "Utils.hpp" unsigned int makeRGBFromString(const std::string& color, unsigned char alpha) { auto num = std::stoul(color, nullptr, 16); return makeRBGA((unsigned char) (num >> 16), (unsigned char) (num >> 8), (unsigned char) num, alpha); }
a7c8883144e2656520b2f5985fcbe139729d928d
c4c134e39d011165e951c8aeda497e542a0d3932
/res/zoom_panel.cxx
b4bd92a757feff81f58d02dfe826eb93d14cdfd3
[]
no_license
kolkhi/CVtool
c734074ed0a9fe2aed2bd1dce6ae66ce7250c02a
689cf0df9fcc7e8840d15ef873ef11f03c53b18a
refs/heads/master
2020-03-07T03:36:20.794634
2018-05-09T15:39:25
2018-05-09T15:39:25
127,241,138
0
0
null
null
null
null
UTF-8
C++
false
false
43,605
cxx
zoom_panel.cxx
// generated by Fast Light User Interface Designer (fluid) version 1.0304 #include "zoom_panel.h" #include <FL/Fl_Image.H> static const unsigned char idata_line[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,235,150,150, 150,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150, 150,150,53,150,150,150,246,150,150,150,253,150,150,150,194,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,246,150,150, 150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,150,150,150,53,150,150,150,246,150,150,150,253,150,150,150,215,150, 150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53, 150,150,150,246,150,150,150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,246,150,150,150, 253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,150,150,150,53,150,150,150,246,150,150,150,253,150,150,150,215,150,150, 150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150, 150,150,246,150,150,150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,246,150,150,150,253, 150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,150,150,150,53,150,150,150,246,150,150,150,253,150,150,150,215,150,150,150, 28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150, 150,246,150,150,150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,246,150,150,150,253,150, 150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 150,150,150,53,150,150,150,246,150,150,150,253,150,150,150,215,150,150,150,28,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150, 246,150,150,150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,150,150,150,53,150,150,150,246,150,150,150,253,150,150, 150,215,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,150,150,150,235,150,150,150,253,150,150,150,215,150,150,150,28,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,246,150,150, 150,194,150,150,150,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static Fl_Image *image_line() { static Fl_Image *image = new Fl_RGB_Image(idata_line, 22, 22, 4, 0); return image; } static const unsigned char idata_rect[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,151,151,255, 151,151,151,255,151,151,151,255,151,151,151,255,152,152,152,255,151,151,151,255, 151,151,151,255,152,152,152,255,151,151,151,255,151,151,151,255,151,151,151,255, 150,150,150,255,151,151,151,255,152,152,152,255,151,151,151,255,151,151,151,255, 152,152,152,255,152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,151,151,255, 150,150,150,242,150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255, 150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255, 150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255, 150,150,150,242,151,151,151,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,151,151,255, 150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150, 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150,255,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,151,151,151,255,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,151,151,151,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150, 150,150,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,152,152,255,150, 150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,152,152,152,255,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,151,151,255,150,150,150,255,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,150,150,150,255,151,151,151,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,151,151,151,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150, 150,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,151,151,255,150,150, 150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150,255,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,150,150,150,255,152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 150,150,150,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150, 255,152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150, 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,151,151,151,255,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,151,151,151,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,150,150,150,255,151,151,151,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151, 151,151,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255, 152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,150,150,150,255, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,255,152,152,152,255,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,151,151,151,255,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,150,150,150,255,152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151, 151,151,255,150,150,150,242,150,150,150,255,150,150,150,255,150,150,150,255,150, 150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150, 150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150,150,150,255,150, 150,150,255,150,150,150,242,150,150,150,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152, 152,152,255,151,151,151,255,151,151,151,255,150,150,150,255,151,151,151,255,152, 152,152,255,152,152,152,255,151,151,151,255,151,151,151,255,152,152,152,255,151, 151,151,255,152,152,152,255,152,152,152,255,152,152,152,255,152,152,152,255,151, 151,151,255,152,152,152,255,152,152,152,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0}; static Fl_Image *image_rect() { static Fl_Image *image = new Fl_RGB_Image(idata_rect, 22, 22, 4, 0); return image; } static const unsigned char idata_clear_drawing[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,156,156,255,167, 167,167,254,167,167,167,255,167,167,167,254,167,167,167,255,167,167,167,254,167, 167,167,255,167,167,167,254,167,167,167,255,166,166,166,254,166,166,166,255,167, 167,167,254,166,166,166,255,166,166,166,254,160,160,160,255,86,86,86,98,57,57, 57,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,167,167,167,255,244,244,244,254, 241,241,241,255,240,240,240,254,240,240,240,255,239,239,239,254,238,238,238,255, 237,237,237,254,236,236,236,255,235,235,235,254,234,234,234,255,233,233,233,254, 232,232,232,255,230,230,230,254,188,188,188,255,86,86,86,131,57,57,57,34,0,0,0, 0,0,0,0,0,156,156,156,255,167,167,167,254,167,167,167,255,167,167,167,255,167, 167,167,255,167,167,167,255,167,167,167,255,167,167,167,255,167,167,167,255,166, 166,166,255,166,166,166,255,167,167,167,255,166,166,166,255,166,166,166,255,160, 160,160,255,168,168,168,255,209,209,209,255,181,181,181,255,86,86,86,143,58,58, 58,41,0,0,0,0,0,0,0,0,167,167,167,255,244,244,244,254,241,241,241,255,240,240, 240,255,240,240,240,255,239,239,239,255,238,238,238,255,237,237,237,255,236,236, 236,255,235,235,235,255,234,234,234,255,233,233,233,255,232,232,232,255,230,230, 230,255,188,188,188,255,150,150,150,255,194,194,194,254,181,181,181,255,86,86, 86,143,57,57,57,41,0,0,0,0,0,0,0,0,167,167,167,255,241,241,241,255,233,233,233, 255,233,233,233,255,232,232,232,255,231,231,231,255,229,229,229,255,228,228,228, 255,226,226,226,255,224,224,224,255,222,222,222,255,221,221,221,255,219,219,219, 255,217,217,217,255,181,181,181,255,143,143,143,255,189,189,189,255,181,181,181, 255,86,86,86,143,58,58,58,41,0,0,0,0,0,0,0,0,167,167,167,255,240,240,240,254, 233,233,233,255,232,232,232,255,231,231,231,255,230,230,230,255,228,228,228,255, 223,222,222,255,212,183,183,255,220,210,210,255,221,221,221,255,219,219,219,255, 217,217,217,255,215,215,215,255,181,181,181,255,143,143,143,255,189,181,181,254, 180,145,145,255,86,83,83,146,57,57,57,41,0,0,0,0,0,0,0,0,168,168,168,255,240, 240,240,255,232,232,232,255,231,231,231,255,230,230,230,255,228,228,228,255,227, 227,227,255,201,186,186,255,210,137,139,255,210,160,160,255,220,217,217,255,218, 218,218,255,216,216,216,255,214,214,214,255,181,181,181,255,142,141,141,255,187, 138,138,255,198,115,117,255,90,60,60,168,58,58,58,41,0,0,0,0,0,0,0,0,167,167, 167,255,239,239,239,254,230,230,230,255,229,229,229,255,228,228,228,255,224,224, 224,255,182,177,177,255,150,85,87,255,251,200,208,255,216,110,112,255,207,149, 149,255,215,212,212,255,215,215,215,255,213,213,213,255,180,177,177,255,150,100, 101,255,208,94,99,255,249,176,185,255,133,54,57,234,35,20,20,95,0,0,0,3,0,0,0,0, 167,167,167,255,238,238,238,255,229,229,229,255,228,228,228,255,227,227,227,255, 159,156,157,255,132,84,88,255,235,107,116,255,246,109,120,255,250,124,134,255, 218,79,83,255,210,159,159,255,215,214,214,255,212,212,212,255,184,139,139,255, 208,68,72,255,249,121,132,255,246,110,122,255,237,113,123,255,119,47,53,226,34, 18,22,97,0,0,0,0,166,166,166,255,237,237,237,254,227,227,227,255,225,225,225, 255,225,225,225,255,128,97,108,255,206,109,120,255,248,59,68,255,231,56,65,255, 236,74,83,255,250,91,101,255,218,63,66,255,209,155,155,255,205,155,155,255,208, 54,58,255,249,74,84,255,234,64,73,255,231,54,63,255,248,60,69,255,208,66,76, 255,106,50,63,214,0,0,0,0,166,166,166,255,237,237,237,255,226,226,226,255,224, 224,224,255,223,223,223,255,182,174,176,255,91,72,73,255,194,37,41,255,232,12, 13,255,218,15,16,255,235,51,52,255,251,47,49,255,239,89,92,255,237,72,76,255, 248,19,21,255,233,18,20,255,218,12,13,255,230,10,11,255,200,22,23,253,53,13,15, 207,49,12,20,72,0,0,0,0,166,166,166,255,235,235,235,254,223,223,223,255,223,223, 223,255,222,222,222,255,219,219,219,255,184,184,184,255,110,75,76,255,187,14,16, 255,201,3,3,255,190,0,0,255,219,0,0,255,242,23,25,255,230,14,15,255,209,0,0,255, 189,0,0,255,198,1,1,255,189,4,5,255,71,18,18,225,22,21,21,87,46,11,19,2,0,0,0,0, 166,166,166,255,234,234,234,255,223,223,223,255,222,222,222,255,220,220,220,255, 218,218,218,255,217,217,217,255,190,186,186,255,130,69,70,255,180,17,19,255,179, 2,2,255,174,0,0,255,187,0,0,255,180,0,0,255,173,0,0,255,177,0,0,255,175,5,6, 255,118,45,46,255,73,62,62,163,57,57,57,42,0,0,0,0,0,0,0,0,166,166,166,255,232, 232,232,254,221,221,221,255,219,219,219,255,218,218,218,255,216,216,216,255,215, 215,215,255,213,213,213,255,189,169,169,255,177,70,71,255,189,23,25,255,155,0,0, 255,156,0,0,255,157,0,0,255,153,0,0,255,178,12,14,255,171,47,49,255,155,129,129, 255,86,86,86,143,57,57,57,41,0,0,0,0,0,0,0,0,166,166,166,255,231,231,231,255, 219,219,219,255,217,217,217,255,216,216,216,255,214,214,214,255,213,213,213,255, 204,184,184,255,177,65,66,255,183,17,18,255,165,1,2,255,160,0,0,255,164,0,0,255, 164,0,0,255,161,0,0,255,162,1,1,255,184,15,16,255,164,50,50,255,101,67,67,159, 58,58,58,41,0,0,0,0,0,0,0,0,166,166,166,255,230,230,230,254,216,216,216,255, 215,215,215,254,214,214,214,255,212,211,211,255,203,175,175,255,181,58,58,255, 193,11,13,255,177,1,1,255,181,0,0,255,186,0,0,255,204,13,14,255,208,18,20,255, 186,0,0,255,182,0,0,255,177,1,1,255,194,11,12,255,160,17,17,220,108,21,21,77, 136,0,0,2,0,0,0,0,160,160,160,255,188,188,188,255,181,181,181,255,181,181,181, 255,181,181,181,255,187,152,153,255,185,51,51,255,197,9,9,255,187,0,0,255,196,0, 0,255,205,1,0,255,219,8,8,255,207,40,41,255,207,50,50,255,221,10,10,255,206,1, 1,255,196,0,0,255,186,0,0,255,198,9,10,255,179,14,15,214,153,16,18,82,0,0,0,0, 87,87,87,98,86,86,86,131,86,86,86,143,86,86,86,143,87,87,87,143,198,89,92,235, 214,47,48,255,192,1,1,255,204,0,0,255,214,0,0,255,233,12,11,255,197,19,18,246, 153,38,38,194,146,44,43,186,194,20,20,243,234,16,16,255,216,0,0,255,204,0,0,255, 193,1,1,255,210,23,25,255,202,51,54,223,0,0,0,0,58,58,58,13,58,58,58,34,58,58, 58,41,58,58,58,41,58,58,58,41,154,41,44,105,184,12,12,210,217,12,12,252,226,6, 6,255,238,13,13,255,198,15,15,228,169,13,13,124,91,45,45,50,78,51,50,46,161, 16,16,108,196,17,17,220,238,17,17,255,226,3,3,255,219,13,14,253,195,10,10,214, 193,23,22,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,34,37,3,176,0, 0,56,211,12,10,190,238,64,64,255,207,28,28,222,207,1,1,86,207,0,0,5,0,0,0,0,0, 0,0,0,207,0,0,2,206,0,0,70,203,16,16,213,238,41,41,255,214,12,12,204,182,0,0, 69,190,21,21,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,0,0, 1,199,4,4,53,195,53,52,205,219,20,20,94,216,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,215,0,0,3,215,11,10,78,198,44,43,202,202,5,5,63,182,0,0,2,0,0,0,0}; static Fl_Image *image_clear_drawing() { static Fl_Image *image = new Fl_RGB_Image(idata_clear_drawing, 22, 22, 4, 0); return image; } static const unsigned char idata_poly[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,150,150,150,254,150,150,150,253,150,150,150,246,150,150,150,251, 150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246, 150,150,150,246,150,150,150,246,150,150,150,248,150,150,150,248,150,150,150,164, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,171,150, 150,150,223,150,150,150,225,150,150,150,246,150,150,150,246,150,150,150,246,150, 150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150, 150,150,191,150,150,150,199,150,150,150,216,150,150,150,109,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,250,150,150,150,225,150,150, 150,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150, 150,97,150,150,150,242,150,150,150,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,150,150,150,171,150,150,150,223,150,150,150,136,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,250,150, 150,150,225,150,150,150,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,150,150,150,250,150,150,150,225,150,150,150,27,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,171,150,150,150,223,150,150, 150,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,171, 150,150,150,223,150,150,150,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,150,150,150,51,150,150,150,251,150,150,150,218,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,250,150,150,150, 225,150,150,150,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,150,150,150,239,150,150,150,215,150,150,150,54,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,171,150,150,150,223,150,150,150,136, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150, 138,150,150,150,233,150,150,150,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,150,150,150,251,150,150,150,234,150,150,150,51,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,251,150,150, 150,234,150,150,150,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,150,150,150,171,150,150,150,223,150,150,150,136,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,138,150,150,150,233,150, 150,150,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,150,150,150,250,150,150,150,225,150,150,150,27,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,199,150,150,150,216,150,150, 150,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150, 150,97,150,150,150,242,150,150,150,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,250,150,150,150,225,150,150,150, 27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150, 239,150,150,150,215,150,150,150,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,150,150,150,51,150,150,150,251,150,150,150,218,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,51,150,150, 150,251,150,150,150,218,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,150,150,150,171,150,150,150,223,150,150,150,136,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,199,150,150,150, 216,150,150,150,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,150,150,150,223,150,150,150,213,150,150,150,82,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,51,150,150,150,254,150,150, 150,252,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150, 150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150, 150,248,150,150,150,248,150,150,150,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,150,150,150,191,150,150,150,246,150,150,150,246,150, 150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150, 150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150,150,150,246,150, 150,150,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0}; static Fl_Image *image_poly() { static Fl_Image *image = new Fl_RGB_Image(idata_poly, 22, 22, 4, 0); return image; } static const unsigned char idata_save[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,183,183,242,183,183,183,255,183,183,183, 254,183,183,183,253,183,183,183,240,183,183,183,199,183,183,183,165,183,183,183, 165,183,183,183,165,183,183,183,168,183,183,183,179,183,183,183,189,183,183,183, 184,183,183,183,172,183,183,183,200,183,183,183,240,183,183,183,253,183,183,183, 164,183,183,183,42,182,182,182,3,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184, 255,184,184,184,255,184,184,184,252,183,183,183,215,184,184,184,98,0,0,0,0,0,0, 0,0,0,0,0,0,184,184,184,26,184,184,184,109,184,184,184,185,184,184,184,151, 184,184,184,55,184,184,184,105,184,184,184,215,184,184,184,252,184,184,184,255, 184,184,184,164,183,183,183,42,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255, 183,183,183,254,184,184,184,252,183,183,183,214,183,183,183,98,0,0,0,0,0,0,0,0, 0,0,0,0,183,183,183,26,183,183,183,109,184,184,184,184,183,183,183,151,183, 183,183,55,183,183,183,104,183,183,183,215,184,184,184,252,183,183,183,254,184, 184,184,255,183,183,183,164,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255,184, 184,184,255,184,184,184,252,183,183,183,215,184,184,184,98,0,0,0,0,0,0,0,0,0,0, 0,0,184,184,184,25,184,184,184,108,184,184,184,183,184,184,184,149,184,184, 184,54,184,184,184,105,184,184,184,215,184,184,184,252,184,184,184,255,184,184, 184,255,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255,183,183, 183,254,184,184,184,252,183,183,183,215,183,183,183,98,0,0,0,0,0,0,0,0,0,0,0,0, 183,183,183,22,184,184,184,92,184,184,184,156,183,183,183,128,184,184,184,46, 183,183,183,104,184,184,184,215,184,184,184,252,183,183,183,254,184,184,184,255, 183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255,183,183,183,254, 184,184,184,252,183,183,183,215,183,183,183,103,183,183,183,8,183,183,183,8,184, 184,184,8,183,183,183,18,183,183,183,50,184,184,184,79,183,183,183,66,183,183, 183,29,183,183,183,105,183,183,183,216,184,184,184,252,183,183,183,254,184,184, 184,255,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255,183,183, 183,254,184,184,184,252,183,183,183,225,183,183,183,139,183,183,183,68,183,183, 183,68,184,184,184,68,183,183,183,68,184,184,184,68,184,184,184,68,183,183,183, 68,183,183,183,68,183,183,183,140,184,184,184,225,184,184,184,252,183,183,183, 254,184,184,184,255,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184, 255,183,183,183,254,184,184,184,254,183,183,183,244,183,183,183,214,183,183,183, 189,183,183,183,189,184,184,184,189,183,183,183,189,183,183,183,189,184,184,184, 189,183,183,183,189,183,183,183,189,183,183,183,214,183,183,183,244,184,184,184, 254,183,183,183,254,184,184,184,255,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184, 255,184,184,184,255,184,184,184,255,184,184,184,255,183,183,183,254,184,184,184, 255,184,184,184,255,184,184,184,255,184,184,184,255,184,184,184,255,184,184,184, 255,184,184,184,255,184,184,184,255,184,184,184,255,184,184,184,255,184,184,184, 255,184,184,184,255,184,184,184,255,184,184,184,255,183,183,183,254,0,0,0,0,0,0, 0,0,184,184,184,255,184,184,184,255,183,183,183,253,184,184,184,240,183,183, 183,223,183,183,183,223,184,184,184,223,183,183,183,223,184,184,184,223,184,184, 184,223,184,184,184,223,184,184,184,223,183,183,183,223,184,184,184,223,183,183, 183,223,184,184,184,223,184,184,184,240,183,183,183,253,184,184,184,255,183,183, 183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,255,183,183,183,245,184,184, 184,193,183,183,183,119,183,183,183,119,183,183,183,119,183,183,183,119,184,184, 184,119,183,183,183,119,184,184,184,119,184,184,184,119,183,183,183,119,183,183, 183,119,183,183,183,119,183,183,183,119,184,184,184,193,183,183,183,245,184,184, 184,254,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,254,184,184, 184,239,184,184,184,150,183,183,183,24,184,184,184,24,184,184,184,24,184,184, 184,24,184,184,184,24,184,184,184,24,184,184,184,24,184,184,184,24,184,184,184, 24,184,184,184,24,184,184,184,24,184,184,184,24,184,184,184,151,184,184,184, 239,184,184,184,254,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184, 254,183,183,183,237,184,184,184,139,183,183,183,2,183,183,183,11,183,183,183,36, 183,183,183,53,184,184,184,53,183,183,183,53,183,183,183,53,184,184,184,53,183, 183,183,53,183,183,183,36,183,183,183,11,183,183,183,2,184,184,184,140,183,183, 183,237,184,184,184,254,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184, 184,254,183,183,183,237,184,184,184,139,183,183,183,2,183,183,183,18,183,183, 183,58,183,183,183,85,184,184,184,85,183,183,183,85,184,184,184,85,184,184,184, 85,183,183,183,85,183,183,183,58,183,183,183,18,184,184,184,2,184,184,184,140, 183,183,183,238,184,184,184,254,183,183,183,254,0,0,0,0,0,0,0,0,184,184,184,255, 184,184,184,254,183,183,183,237,184,184,184,139,183,183,183,3,183,183,183,24, 183,183,183,78,183,183,183,114,184,184,184,114,183,183,183,114,183,183,183,114, 184,184,184,114,183,183,183,114,183,183,183,78,183,183,183,24,183,183,183,3,184, 184,184,140,183,183,183,237,184,184,184,254,183,183,183,254,0,0,0,0,0,0,0,0,183, 183,183,254,184,184,184,254,183,183,183,237,183,183,183,139,183,183,183,2,183, 183,183,18,183,183,183,56,183,183,183,82,183,183,183,83,183,183,183,82,183,183, 183,83,183,183,183,83,183,183,183,82,183,183,183,56,183,183,183,18,183,183,183, 2,183,183,183,140,183,183,183,237,183,183,183,254,183,183,183,254,0,0,0,0,0,0, 0,0,184,184,184,255,184,184,184,254,184,184,184,237,184,184,184,139,183,183, 183,3,184,184,184,28,184,184,184,89,184,184,184,130,184,184,184,130,184,184,184, 130,184,184,184,130,184,184,184,130,184,184,184,130,184,184,184,89,184,184,184, 28,184,184,184,3,184,184,184,140,184,184,184,238,184,184,184,254,183,183,183, 254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,254,183,183,183,237,184,184,184, 139,183,183,183,2,183,183,183,13,183,183,183,42,183,183,183,61,184,184,184,61, 183,183,183,61,183,183,183,61,184,184,184,61,183,183,183,61,183,183,183,42,183, 183,183,13,183,183,183,2,184,184,184,140,183,183,183,237,184,184,184,254,183, 183,183,254,0,0,0,0,0,0,0,0,184,184,184,255,184,184,184,254,184,184,184,237,184, 184,184,139,184,184,184,1,184,184,184,2,184,184,184,5,184,184,184,7,184,184,184, 7,184,184,184,7,184,184,184,7,184,184,184,7,184,184,184,7,184,184,184,5,184, 184,184,2,184,184,184,1,184,184,184,140,184,184,184,238,184,184,184,254,183,183, 183,255,0,0,0,0,0,0,0,0,184,184,184,242,184,184,184,255,184,184,184,248,184,184, 184,214,183,183,183,165,184,184,184,165,184,184,184,165,184,184,184,165,184,184, 184,165,184,184,184,165,184,184,184,166,184,184,184,165,184,184,184,165,184,184, 184,165,184,184,184,165,184,184,184,165,184,184,184,214,184,184,184,249,184,184, 184,254,183,183,183,242,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static Fl_Image *image_save() { static Fl_Image *image = new Fl_RGB_Image(idata_save, 22, 22, 4, 0); return image; } static const unsigned char idata_undo[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,235,236,1,235,235,235,9,234, 234,234,20,233,233,233,27,233,233,234,29,233,233,233,29,232,233,233,28,234,234, 234,23,235,235,236,13,235,235,235,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,233,233,233,10,238,238,238,50,236, 237,237,122,228,228,229,195,192,193,193,251,184,185,185,255,184,185,185,255,192, 193,193,253,200,201,202,236,234,234,235,145,238,238,238,62,230,230,230,21,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,222,223,223,83,226,226,226,68,234, 234,235,7,229,230,230,15,219,220,220,110,196,197,197,236,204,204,205,254,205, 205,206,255,250,250,250,255,252,252,252,255,251,251,251,255,251,251,251,255,243, 243,244,255,195,196,196,254,193,193,194,248,227,227,228,140,232,232,232,37,231, 231,231,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,195,195,250,199,199,200,239,228, 229,229,117,225,226,226,112,196,197,197,240,231,232,232,255,252,252,252,255,255, 255,255,255,255,255,255,255,255,255,255,255,254,254,254,254,255,255,255,255,254, 254,254,255,253,253,253,255,244,244,244,255,198,199,199,250,222,222,223,175,230, 230,230,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,192,192,255,233,233,233,254,192, 193,193,251,192,193,193,248,238,238,238,255,251,251,251,255,253,253,253,255,253, 253,253,255,253,253,253,255,253,253,253,255,253,253,253,254,253,253,253,255,252, 252,252,255,252,252,252,255,251,251,251,255,237,238,238,255,193,194,194,252,214, 214,215,167,221,221,221,33,0,0,0,0,0,0,0,0,0,0,0,0,193,193,194,255,239,239,239, 255,242,243,243,255,242,242,242,255,249,249,249,255,250,250,250,255,250,250,250, 255,249,249,249,255,249,249,249,255,248,248,248,255,247,247,247,255,247,247,247, 255,246,246,246,255,246,246,246,255,245,245,245,255,245,245,245,255,232,232,232, 255,190,191,191,251,214,215,215,123,221,221,221,11,0,0,0,0,0,0,0,0,184,184,184, 255,234,234,234,255,243,243,243,255,246,246,246,255,246,246,246,255,245,245,245, 255,244,244,244,255,244,244,244,255,242,242,242,255,241,241,241,255,240,240,240, 254,235,235,235,255,233,233,233,255,237,237,237,255,238,238,238,255,236,236,236, 255,236,236,236,255,221,221,221,255,191,191,192,239,211,211,212,47,0,0,0,0,0,0, 0,0,173,174,175,255,228,228,228,255,238,238,238,255,240,240,240,255,239,239, 239,255,238,238,238,255,237,237,237,255,235,235,235,255,234,234,234,255,214,214, 215,254,189,189,189,247,183,183,185,240,182,183,183,240,185,185,186,243,195,195, 196,249,215,215,216,254,225,225,225,255,229,229,229,255,196,196,196,254,219,219, 219,131,215,215,215,15,0,0,0,0,164,164,165,255,221,221,221,255,230,230,230,255, 232,232,232,255,230,230,230,255,229,229,229,255,227,227,227,255,226,226,226,255, 199,201,201,255,186,186,187,222,224,225,225,103,0,0,0,0,225,225,225,3,239,239, 239,40,210,211,211,137,184,185,185,219,192,193,193,249,213,214,214,255,213,213, 213,255,193,193,194,240,213,213,214,38,0,0,0,0,155,155,156,255,213,213,213,255, 220,220,220,255,222,222,222,255,220,220,220,255,218,218,218,255,216,216,216,255, 211,211,211,255,172,172,173,253,227,227,227,98,221,222,222,5,0,0,0,0,0,0,0,0,0, 0,0,0,223,223,223,5,221,222,222,66,183,184,184,187,181,182,182,247,207,207, 207,255,179,179,180,255,228,228,229,87,210,210,210,4,145,146,147,255,203,203, 203,255,206,206,206,255,208,208,208,255,207,207,207,255,204,204,204,255,202,202, 202,255,204,204,204,255,181,181,181,252,197,197,198,156,228,228,228,20,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,202,203,57,176,177,177,183,176,176,176, 247,182,182,183,255,199,200,200,174,204,204,204,13,136,137,137,255,192,192,192, 255,198,198,198,255,200,200,200,255,199,199,199,255,197,197,197,255,194,194,194, 255,199,199,199,255,204,204,204,255,174,174,175,246,194,194,194,143,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,211,211,212,60,171,171,172,197,176,176, 176,252,169,170,171,226,198,199,199,18,131,132,133,247,149,150,150,255,153,153, 154,255,153,154,154,255,153,153,154,255,152,153,153,255,151,152,152,255,151,152, 152,255,156,156,157,255,155,155,156,255,138,138,139,244,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,209,209,209,3,203,203,204,91,159,160,161,224,133,134, 135,250,191,192,192,20,179,180,181,57,179,180,180,60,179,179,179,60,178,179,179, 60,178,178,178,60,178,178,178,60,178,178,179,60,178,178,179,60,181,181,181,60, 184,184,185,60,182,182,182,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,197,197,197,12,162,162,162,161,126,126,126,243,186,186,187,20,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,185,186,186, 17,181,181,181,28,186,187,187,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0}; static Fl_Image *image_undo() { static Fl_Image *image = new Fl_RGB_Image(idata_undo, 22, 22, 4, 0); return image; } static const unsigned char idata_load[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,201,201,201,7,166,166,166, 40,180,180,180,53,190,190,190,65,200,200,200,77,191,191,191,70,200,200,200,21, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,206,206,5,169,169,169,84,141,141,141, 177,166,166,166,199,184,184,184,221,201,201,201,241,186,186,186,229,174,174,174, 124,204,204,204,19,0,0,0,0,0,0,0,0,130,130,130,6,138,138,138,20,148,148,148,34, 161,161,161,49,162,162,162,51,179,179,179,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,161,161,161,22,177,177,177,211,228,228,228,254,229,229,229,254,229,229, 229,254,229,229,229,254,228,228,228,254,193,193,193,231,186,186,186,135,200,200, 200,109,208,208,208,124,118,118,118,135,130,130,130,152,145,145,145,169,163,163, 163,186,154,154,154,186,115,115,115,89,160,160,160,4,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,159,159,159,73,215,215,215,253,229,229,229,253,229,229,229,254,228,228, 228,253,229,229,229,254,229,229,229,253,227,227,227,253,210,210,210,242,212,212, 212,240,220,220,220,252,223,223,223,253,225,225,225,253,227,227,227,254,229,229, 229,254,207,207,207,249,86,86,86,133,117,117,117,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,188,188,188,112,221,221,221,254,229,229,229,254,228,229,229,254,228,228, 228,254,229,229,229,254,228,228,228,254,228,228,228,254,229,229,229,254,229,229, 229,255,228,228,228,254,229,229,229,254,228,229,229,254,224,223,224,254,208,208, 208,254,188,188,188,253,160,160,160,224,130,130,130,65,207,207,207,79,206,206, 206,106,202,202,202,94,0,0,0,0,176,176,176,108,221,221,221,254,228,228,228,253, 228,228,228,254,228,228,228,253,228,228,228,254,228,228,228,254,228,228,228,253, 228,228,228,254,227,228,228,253,212,213,213,254,182,182,182,254,177,177,177,255, 177,177,177,255,179,179,179,255,180,180,180,255,179,179,179,252,178,178,178,252, 181,181,181,250,191,191,191,244,209,209,209,150,199,199,199,7,171,171,171,96, 217,217,217,254,227,227,227,253,227,227,227,254,226,226,226,253,225,225,225,254, 226,226,226,253,226,226,226,253,221,221,221,254,184,184,184,255,180,180,180,255, 208,208,208,254,230,230,230,253,234,234,235,253,234,234,234,254,232,232,232,253, 231,231,231,246,232,232,232,235,231,231,231,233,189,189,189,248,224,224,224,80, 197,197,197,11,170,170,170,83,214,214,214,254,225,225,225,253,225,225,225,254, 225,225,225,253,222,222,222,254,208,208,208,253,186,186,186,254,183,183,183,255, 198,198,198,254,223,223,223,254,235,235,235,253,234,234,234,253,231,231,231,253, 230,230,230,254,227,227,227,253,223,223,223,243,223,223,223,229,204,204,204,238, 188,188,188,220,196,196,196,30,200,200,200,4,142,142,142,67,210,210,210,254,222, 222,222,254,221,221,221,254,200,200,200,254,184,184,184,255,191,191,191,255,223, 223,223,254,234,234,234,254,232,232,232,254,230,230,230,254,227,227,227,254,226, 226,226,254,224,224,224,254,223,223,223,254,220,220,220,254,214,214,214,240,214, 214,214,223,182,182,182,248,205,205,205,113,192,192,192,9,0,0,0,0,138,138,138, 55,207,207,207,254,221,221,221,253,188,188,188,255,196,196,196,254,226,226,226, 254,230,230,230,254,228,228,228,253,226,226,226,254,224,225,224,253,223,222,223, 254,221,221,221,253,219,219,219,253,217,217,217,253,214,214,214,254,209,209,209, 254,196,196,196,236,184,184,184,228,180,180,180,219,191,191,191,42,0,0,0,0,0,0, 0,0,137,137,137,42,203,203,203,254,217,217,217,254,188,188,188,255,215,215, 215,254,225,225,225,254,222,222,222,254,221,221,221,254,219,219,219,254,218,218, 218,254,215,215,215,254,215,215,215,254,211,211,211,254,206,206,206,254,199,199, 199,254,193,192,193,254,184,184,184,234,177,177,177,245,201,201,201,131,201,201, 201,18,0,0,0,0,0,0,0,0,152,152,152,30,200,200,200,254,211,211,211,253,183,183, 183,255,213,213,213,253,218,218,218,254,216,216,216,253,213,213,213,253,213,213, 213,254,210,210,210,253,208,208,208,254,204,204,204,253,197,197,197,253,193,193, 193,253,194,194,194,254,193,192,193,253,181,181,181,243,179,179,179,224,214,214, 214,64,204,204,204,1,0,0,0,0,0,0,0,0,189,189,189,24,197,197,197,252,201,201,201, 254,187,187,187,255,211,211,211,253,211,211,211,254,209,209,209,254,207,207,207, 253,206,206,206,254,203,203,203,254,197,197,197,254,193,193,193,253,193,193,193, 253,193,193,193,254,194,194,194,254,192,192,192,254,177,177,177,251,193,193,193, 155,200,200,200,30,0,0,0,0,0,0,0,0,0,0,0,0,186,186,186,20,193,193,193,245,198, 198,198,254,186,186,186,255,206,206,206,254,204,204,204,254,202,202,202,254,200, 200,200,254,197,197,197,254,194,194,194,254,193,193,193,254,192,192,192,254,193, 193,193,254,193,193,193,254,194,194,194,255,188,188,188,255,176,176,176,241,188, 188,188,94,196,196,196,6,0,0,0,0,0,0,0,0,0,0,0,0,183,183,183,19,185,185,185,237, 187,187,187,255,189,189,189,254,197,197,197,253,196,196,196,254,194,194,194,253, 193,193,193,253,193,193,193,254,193,192,193,253,193,193,193,254,195,195,195,254, 196,196,196,254,194,194,194,254,180,180,180,248,166,166,166,244,108,108,108,168, 132,132,132,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,179,179,179,18,170,170,170,226, 184,184,184,255,188,188,188,254,193,193,193,254,193,193,193,254,193,193,193,254, 194,194,194,254,196,196,196,254,196,196,196,254,187,187,187,252,150,150,150,229, 113,113,113,196,78,78,78,154,55,55,55,113,87,87,87,80,132,132,132,40,153,153, 153,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,176,176,17,164,164,164,215,179,179, 179,255,193,193,193,255,196,196,196,255,196,196,196,255,186,186,186,251,154,154, 154,233,112,112,112,199,71,71,71,153,46,46,46,106,42,42,42,68,149,149,149,42, 136,136,136,25,129,129,129,12,148,148,148,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,171,171,171,15,160,160,160,198,180,180,180,254,158,158,158,236, 111,111,111,201,67,67,67,153,36,36,36,102,22,22,22,62,120,120,120,34,148,148, 148,19,141,141,141,9,143,143,143,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,156,156,3,20,20,20,51,23,23,23,91,12, 12,12,51,71,71,71,23,156,156,156,11,153,153,153,6,152,152,152,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static Fl_Image *image_load() { static Fl_Image *image = new Fl_RGB_Image(idata_load, 22, 22, 4, 0); return image; } static Fl_Double_Window* make_window() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(809, 624); w = o; if (w) {/* empty */} { Fl_Group* o = new Fl_Group(0, 0, 810, 115); { Fl_Button* o = new Fl_Button(10, 5, 30, 30); o->image( image_line() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(50, 5, 30, 30); o->image( image_rect() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(210, 5, 30, 30, "Line color "); o->color(FL_FOREGROUND_COLOR); o->align(Fl_Align(FL_ALIGN_LEFT)); } // Fl_Button* o { Fl_Choice* o = new Fl_Choice(320, 5, 50, 30, "Line width "); o->down_box(FL_BORDER_BOX); } // Fl_Choice* o { Fl_Box* o = new Fl_Box(378, 3, 3, 34); o->box(FL_THIN_DOWN_BOX); } // Fl_Box* o { Fl_Box* o = new Fl_Box(129, 3, 3, 35); o->box(FL_THIN_DOWN_BOX); } // Fl_Box* o { Fl_Slider* o = new Fl_Slider(428, 6, 300, 27, "Zoom"); o->type(5); o->box(FL_FLAT_BOX); o->align(Fl_Align(FL_ALIGN_LEFT)); } // Fl_Slider* o { new Fl_Box(728, 5, 25, 25, "x1"); } // Fl_Box* o { Fl_Button* o = new Fl_Button(90, 5, 30, 30); o->image( image_clear_drawing() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(10, 40, 30, 30); o->image( image_poly() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(50, 40, 30, 30); o->image( image_save() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(90, 40, 30, 30); o->image( image_undo() ); } // Fl_Button* o { Fl_Button* o = new Fl_Button(130, 40, 30, 30); o->image( image_load() ); } // Fl_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(15, 129, 780, 441); o->end(); } // Fl_Group* o o->end(); } // Fl_Double_Window* o return w; }
c7bf0664174c6281b09ca07ccbf14baa8dd95b8e
8ff320e31e8ad83c75c93cd8f71347a38e718e71
/src/lib/views/volumeBar/volumeBar.h
1afffdd2289636fd07864e9d862c624d3287e8d1
[]
no_license
tavu/karakaxa
60ff6e3e79196f5a3e079c5dc1cc1c430d9ff1be
03f3df0f22a6a001438589d72c42c34a3f3dd519
refs/heads/master
2021-01-01T18:22:49.392260
2013-09-04T13:42:02
2013-09-04T13:42:02
4,357,814
2
0
null
null
null
null
UTF-8
C++
false
false
324
h
volumeBar.h
#ifndef VOLUMEBAR_H #define VOLUMEBAR_H #include <KToolBar> #include<QAction> #include <Phonon/VolumeSlider> namespace views { class volumeBar :public KToolBar { Q_OBJECT public: volumeBar(QWidget *parent=0); private: QAction *volumeAction; Phonon::VolumeSlider *volume; }; }; #endif
160ae55d298e3ab7eb03549a83cb2e1f78f1ab28
4fc25c2d1c9b68cdb5f34ecd585dd52fe187184e
/Projet_health_monitoring/Sensor.cpp
63f91e4532a64561ed790af256ed742e93ea052b
[]
no_license
Assianguyen/BE_Cpp
c48fe41754b54c25d9312ed655c2f87360f941a1
6217bebc57ceea94c28a8c4366ca373445c8c697
refs/heads/main
2023-04-25T06:05:32.839984
2021-05-19T13:54:04
2021-05-19T13:54:04
355,508,506
1
1
null
null
null
null
UTF-8
C++
false
false
656
cpp
Sensor.cpp
#include "Sensor.h" //constructeur vide Sensor::Sensor(){ atRisk = false; minValue = 0.0; maxValue = 0.0; } //constructeur avec attributs Sensor::Sensor(bool stateRisk, bool stateWarning, float min, float max, int port){ atRisk = stateRisk; warning = stateWarning; minValue = min; maxValue = max; numPort = port; } //setters void Sensor::setAtRisk(bool state){ atRisk = state; } void Sensor::setWarning(bool state){ warning = state; } //getters float Sensor::getMinValue(){ return minValue; } float Sensor::getMaxValue(){ return maxValue; } bool Sensor::getAtRisk(){ return atRisk; } bool Sensor::getWarning(){ return warning; }
dbacc685f31d1394baa2e70ac5bd710f3fb81750
f64a28df46d7f3b2558ca9eeca004bb7a71ac593
/project/core/game/Wall/Wall.hpp
4f01e4ac17d58a2773582bd51f3452acf9fdcafa
[]
no_license
DbilliT/cpp_bomberman
e297265af7134e6a0d04e5c5e96c4617bf40ca8d
7c7ed242bccc9445c289a7067c7d7fc6f45d9356
refs/heads/master
2021-01-25T12:30:24.956107
2018-03-05T21:58:12
2018-03-05T21:58:12
123,474,085
0
0
null
null
null
null
UTF-8
C++
false
false
485
hpp
Wall.hpp
// // Wall.hpp for Wall in /home/david_k/cpp_rendu/cpp_bomberman/project/core/game/Wall // // Made by paul david // Login <david_k@epitech.net> // // Started on Thu May 21 14:55:04 2015 paul david // Last update Thu May 21 16:22:20 2015 paul david // #ifndef WALL_HPP_ #define WALL_HPP_ #include "ICase.hpp" class Wall : public ICase { public: Wall(); virtual ~Wall(); virtual CaseType getType() const; virtual bool isFree() const; private: CaseType type; }; #endif
65ef4718dd16f3d4900c151e8f0fba48260ba493
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Common/Models/CONTROL1/GenStats.cpp
a0cb7b064d9bdf54c131a5ab626b843530e93e38
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,637
cpp
GenStats.cpp
//================== SysCAD - Copyright Kenwalt (Pty) Ltd =================== // $Nokeywords: $ //=========================================================================== #include "stdafx.h" #include "sc_defs.h" #include "pgm_e.h" #include "genstats.h" #if !SKIPIT //========================================================================== const long FunctSubsStartIndex = 500; //========================================================================== GenStatInfo::GenStatInfo(): m_MeasVar(BXO_Blank) { //m_MeasVar.Init(FALSE, TRUE); bValid = 0; iPriority = 0; ResetStats(); } //-------------------------------------------------------------------------- GenStatInfo::~GenStatInfo() { } //-------------------------------------------------------------------------- void GenStatInfo::Init(int iNo) { sTagSuffix.Set("FS_%d", iNo); iPriority = iNo; //pXRM = ERH; } //-------------------------------------------------------------------------- void GenStatInfo::ResetStats() { dMeas = 0.0; dTtlTime = 0.0; dZeroTime = 0.0; dTotal = 0.0; dMax = -1e99; dMin = 1e99; } //-------------------------------------------------------------------------- void GenStatInfo::ExecIns(double dT) { dTtlTime += dT; if (fabs(dMeas)<1e-6) dZeroTime += dT; dTotal += (dMeas*dT); if (dMeas>dMax) dMax = dMeas; if (dMeas<dMin) dMin = dMeas; } //========================================================================== // // Statistics // //========================================================================== static double Drw_GenStats[] = { DD_Poly, -3,-3, -3,3, 3,3, 3,-3, -3,-3, DD_Poly, -2,-2, -2,2, 2,2, 2,-2, -2,-2, DD_TagPos, 0, -6.5, DD_End }; IMPLEMENT_MODELUNIT(CGenStats, "GenStats", "", Drw_GenStats, "Control", "GS", TOC_ALL|TOC_DYNAMICFLOW|TOC_GRP_GENERAL|TOC_STD_KENWALT, "Statistics:General", "General Statistics model.") flag CGenStats::bWithCnvComment = true; //-------------------------------------------------------------------------- CGenStats::CGenStats(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach) : FlwNode(pClass_, TagIn, pAttach, eAttach) //, m_MXRH(this) { AttachClassInfo(nc_Control, NULL, &NullFlwGroup); SetActiveOptions(true, true); bOn = 1; bResetOnStart = 0; bResetOnInit = 1; bResetOnEmpty = 1; bResetOnPreSet = 1; //bDoneXRefs = 0; bAboutToStart = 0; iCount = 0; DataBlk = NULL; for (int i=0; i<3; i++) m_StateLine[i] = ""; m_StateLine[0] = "OK"; SetCount(1); } //-------------------------------------------------------------------------- CGenStats::~CGenStats() { SetCount(0); } //-------------------------------------------------------------------------- void CGenStats::SetCount(long NewSize) { NewSize = max(NewSize, 0L); if (NewSize!=iCount) { GenStatInfo** NewDataBlk = NULL; if (NewSize<iCount) { for (int i=NewSize; i<iCount; i++) delete DataBlk[i]; } if (NewSize>0) { NewDataBlk = new pGenStatInfo[NewSize]; for (int i=0; (i<NewSize && i<iCount); i++) NewDataBlk[i] = DataBlk[i]; for (i=iCount; i<NewSize; i++) { NewDataBlk[i] = new GenStatInfo; NewDataBlk[i]->Init(i); } } if (DataBlk) delete []DataBlk; DataBlk = NewDataBlk; iCount = NewSize; if (SortRqd()) Sort(); StructureChanged(this); } } //-------------------------------------------------------------------------- flag CGenStats::SortRqd() { for (int i=1; i<iCount; i++) { if (DataBlk[i-1]->iPriority>DataBlk[i]->iPriority) return true; } return false; } //-------------------------------------------------------------------------- void CGenStats::Sort() { for (int i=0; i<iCount; i++) { int MinPos = -1; long MinVal = DataBlk[i]->iPriority; for (int j=i+1; j<iCount; j++) { if (DataBlk[j]->iPriority<MinVal) { MinPos = j; MinVal = DataBlk[j]->iPriority; } } if (MinPos>=0) { GenStatInfo* p = DataBlk[i]; DataBlk[i] = DataBlk[MinPos]; DataBlk[MinPos] = p; } } StructureChanged(this); } //-------------------------------------------------------------------------- void CGenStats::ResetData(flag Complete) { } //-------------------------------------------------------------------------- const word idmCount = 1000; const word idmCheckBtn = 1001; const word idmResetBtn = 1002; const word idmCfgTags = 1100; const word NoOfCfgTags = 10; //-------------------------------------------------------------------------- void CGenStats::BuildDataDefn(DataDefnBlk & DDB) { DDB.BeginStruct(this, "CGenStats", NULL, DDB_NoPage); DDB.Text(""); DDB.CheckBoxBtn("On", "", DC_, "", &bOn, this, isParmStopped, DDBYesNo); DDB.CheckBoxBtn("ShowCnv", "", DC_, "", &bWithCnvComment,this, isParmStopped, DDBYesNo); DDB.Visibility(NSHM_All, iCount>0); DDB.CheckBoxBtn("ResetOnStart", "", DC_, "", &bResetOnStart, this, isParm, DDBYesNo); DDB.Visibility(NM_Probal|SM_All|HM_All, iCount>0); DDB.CheckBoxBtn("ResetOnInit", "", DC_, "", &bResetOnInit, this, isParm, DDBYesNo); DDB.Visibility(NSHM_All, iCount>0); DDB.CheckBoxBtn("ResetOnEmpty", "", DC_, "", &bResetOnEmpty, this, isParm, DDBYesNo); DDB.Visibility(NM_Dynamic|SM_All|HM_All, iCount>0); DDB.CheckBoxBtn("ResetOnPreSet","", DC_, "", &bResetOnPreSet,this, isParm, DDBYesNo); DDB.Visibility(); DDB.Long("Number_of_Stats", "No_of_Stats", DC_, "", idmCount, this, isParmStopped/*|AffectsStruct*/); DDB.Text(""); if (iCount>0) { DDB.Button("Check_tags"/* and functions"*/, "", DC_, "", idmCheckBtn, this, isParmStopped); DDB.Button("Reset_All", "", DC_, "", idmResetBtn, this, isParm); DDB.Text(""); DDB.String("State", "", DC_, "", &m_StateLine[0], this, noSnap|noFile); DDB.Text("Error:"); DDB.String("Msg_1", "", DC_, "", &m_StateLine[1], this, noSnap|noFile); DDB.String("Msg_2", "", DC_, "", &m_StateLine[2], this, noSnap|noFile); DDB.Text(""); } DDB.Text("----------------------------------------"); char Buff[128]; Strng Tag; if (DDB.BeginArray(this, "Cfg", "Gen_Cfg", iCount)) { for (int i=0; i<iCount; i++) { if (i>0 && (i % 4)==2) { sprintf(Buff, "Cfg_%d", i); DDB.Page(Buff, DDB_RqdPage); } DDB.BeginElement(this, i); GenStatInfo* p = DataBlk[i]; Strng CnvTxt; if (bWithCnvComment && XRefsValid() && p->bValid) GetValidCnvTxt(p->m_MeasVar, CnvTxt); //DDB.String("Name", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+0, this, isParmStopped); not needed? DDB.String("Description", "Desc", DC_, "", idmCfgTags+(i*NoOfCfgTags)+7, this, isParm); DDB.String("StatTag", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+2, this, isParmStopped|isTag); DDB.Button("Reset_Stats", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+3, this, isParm); DDB.Double("Time", "Tm", DC_Time, "s", &(p->dTtlTime), this, isResult); //DDB.Visibility(NSHM_All, (p->iType & FSWhatQm)); DDB.Double("Meas", "", DC_, "", &(p->dMeas), this, isResult|InitHidden|noFileAtAll); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); DDB.Double("Total", "Ttl", DC_, "", &(p->dTotal), this, isResult); DDB.Double("Average", "Ave", DC_, "", idmCfgTags+(i*NoOfCfgTags)+5, this, isResult|noFileAtAll); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); DDB.Double("ZeroTime", "ZeroTm", DC_Time, "s", &(p->dZeroTime), this, isResult); DDB.Double("On_Average", "OnAve", DC_, "", idmCfgTags+(i*NoOfCfgTags)+6, this, isResult|InitHidden|noFileAtAll); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); DDB.Double("Min", "", DC_, "", &(p->dMin), this, isResult);//|InitHidden); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); DDB.Double("Max", "", DC_, "", &(p->dMax), this, isResult);//|InitHidden); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); DDB.Text(""); DDB.Long ("Priority", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+4, this, isParmStopped); DDB.Text("----------------------------------------"); } } DDB.EndArray(); DDB.EndStruct(); } //-------------------------------------------------------------------------- flag CGenStats::DataXchg(DataChangeBlk & DCB) { if (FlwNode::DataXchg(DCB)) return 1; switch (DCB.lHandle) { case idmCount: if (DCB.rL) { if (*DCB.rL!=iCount) StructureChanged(this); SetCount(Range(0L, *DCB.rL, 50L)); } DCB.L = iCount; return True; case idmCheckBtn: if (DCB.rB && (*DCB.rB!=0)) { //AccNodeWnd::RefreshData(TRUE); ??? //TODO: need to accept current data before processing button push! if (PreStartCheck()) LogNote(Tag(), 0, "No bad external tag references or function errors"); bAboutToStart = 0; } DCB.B=0; return True; case idmResetBtn: if (DCB.rB && (*DCB.rB!=0)) ResetAllStats(); DCB.B=0; return True; default: if (DCB.lHandle>=idmCfgTags) { int Index = (DCB.lHandle - idmCfgTags) / NoOfCfgTags; if (Index<iCount) { GenStatInfo* p = DataBlk[Index]; switch ((DCB.lHandle - idmCfgTags) - (Index * NoOfCfgTags)) { case 0: if (DCB.rpC) { if (p->sTagSuffix.IsEmpty() || p->sTagSuffix.XStrICmp(DCB.rpC)!=0) { StructureChanged(this); //bDoneXRefs = 0; } if (strlen(DCB.rpC)) p->sTagSuffix = DCB.rpC; } DCB.pC = p->sTagSuffix(); break; case 2: { flag Chg = (p->m_MeasVar.DoDataXchg(DCB)==1); if (Chg) { MyTagsHaveChanged(); } DCB.pC = p->m_MeasVar.sVar(); break; } case 3: if (DCB.rB) p->ResetStats(); DCB.B = 0; break; case 4: if (DCB.rL) { p->iPriority = *DCB.rL; if (SortRqd()) { Sort(); } } DCB.L = p->iPriority; break; case 5: //if (DCB.rD) // xxx = *DCB.rD; DCB.D = p->dTotal/GTZ(p->dTtlTime); break; case 6: //if (DCB.rD) // xxx = *DCB.rD; DCB.D = p->dTotal/GTZ(p->dTtlTime - p->dZeroTime); break; case 7: { if (DCB.rpC) p->sDesc = DCB.rpC; DCB.pC = p->sDesc(); break; } } } return True; } } return False; } //-------------------------------------------------------------------------- flag CGenStats::ValidateData(ValidateDataBlk & VDB) { for (int i=0; i<iCount; i++) { TaggedObject::ValidateTag(DataBlk[i]->sTagSuffix); } Sort(); return FlwNode::ValidateData(VDB); } //-------------------------------------------------------------------------- flag CGenStats::PreStartCheck() { for (int i=0; i<3; i++) m_StateLine[i] = ""; m_StateLine[0] = "OK"; if (bOn) { bAboutToStart = 1; } return FlwNode::PreStartCheck(); } //-------------------------------------------------------------------------- bool CGenStats::TestXRefListActive() { return SetXRefListActive(!GetActiveHold() && bOn!=0); } //--------------------------------------------------------------------------- int CGenStats::UpdateXRefLists(CXRefBuildResults & Results) { if (1)//bOn) { FnMngrClear(); int FunctNo = 0; for (int i=0; i<iCount; i++) { GenStatInfo* p = DataBlk[i]; Strng S; S.Set("%s.Cfg.[%i].%s", Tag(), i, "Meas"); int RetCode = p->m_MeasVar.UpdateXRef(p, 0, 1, FunctNo, this, -1, S(), S(), "GenStats:Meas", Results); p->bValid = (RetCode==BXR_OK); } FnMngrTryUpdateXRefLists(Results); } return Results.m_nMissing; } //-------------------------------------------------------------------------- void CGenStats::UnlinkAllXRefs() { FnMngrClear(); FnMngrTryUnlinkAllXRefs(); for (int i=0; i<iCount; i++) { GenStatInfo* p = DataBlk[i]; p->m_MeasVar.UnlinkXRefs(); } CNodeXRefMngr::UnlinkAllXRefs(); }; //-------------------------------------------------------------------------- void CGenStats::ResetAllStats() { for (int i=0; i<iCount; i++) DataBlk[i]->ResetStats(); } //-------------------------------------------------------------------------- void CGenStats::EvalStatistics(eScdCtrlTasks Tasks) { if (XRefListActive() && ICGetTimeInc() > 0.0) { GetNearXRefValues(); //for (int i=0; i<m_NearXRefs.GetSize(); i++) // if (m_NearXRefs[i]->bMustGet) // m_NearXRefs[i]->GetNearXRefValue(); if (bAboutToStart && bResetOnStart) ResetAllStats(); //solve pgm functions... CGExecContext ECtx(this); ECtx.dIC_Time = ICGetTime(); ECtx.dIC_dTime = ICGetTimeInc(); ECtx.OnStart = bAboutToStart; ECtx.m_HoldNearXRefGet=true; ECtx.m_HoldNearXRefSet=true; FnMngr().Execute(ECtx); bAboutToStart = 0; if (ECtx.DoXStop) { LogError(Tag(), 0, "SysCAD stopped by function"); ExecObj()->XStop(); } if (ECtx.DoXIdle) { LogError(Tag(), 0, "SysCAD paused by function"); ExecObj()->XIdle(); } //solve GenStats... for (int i=0; i<iCount; i++) { GenStatInfo* p = DataBlk[i]; if (p->bValid) { p->m_MeasVar.GetValue(p->dMeas); p->ExecIns(ICGetTimeInc()); } } } } //-------------------------------------------------------------------------- void CGenStats::SetState(eScdMdlStateActs RqdState) { FlwNode::SetState(RqdState); flag DoReset = false; switch (RqdState) { case MSA_PBInit : if (bResetOnInit) DoReset = true; break; case MSA_ZeroFlows: break; case MSA_Empty : if (bResetOnEmpty) DoReset = true; break; case MSA_PreSet : if (bResetOnPreSet) DoReset = true; break; case MSA_DynStatsRunInit: DoReset = true; break; default: break; } if (DoReset) ResetAllStats(); } //-------------------------------------------------------------------------- void CGenStats::EvalProducts(CNodeEvalIndex & NEI) { } //-------------------------------------------------------------------------- int CGenStats::ChangeTag(pchar pOldTag, pchar pNewTag) { BOOL DidChange = FALSE; for (int i=0; i<iCount; i++) { if (DataBlk[i]->m_MeasVar.DoChangeTag(pOldTag, pNewTag)) DidChange = TRUE; } if (DidChange) { UnlinkAllXRefs(); //PreStartCheck(); bAboutToStart = 0; } return FlwNode::ChangeTag(pOldTag, pNewTag); } //-------------------------------------------------------------------------- int CGenStats::DeleteTag(pchar pDelTag) { BOOL FoundOne = FALSE; for (int i=0; i<iCount; i++) { if (DataBlk[i]->m_MeasVar.ContainsTag(pDelTag)) FoundOne = TRUE; } if (FoundOne) { LogNote(Tag(), 0, "Delete tag '%s' affects Gen Statistics model '%s'.", pDelTag, Tag()); UnlinkAllXRefs(); //PreStartCheck(); bAboutToStart = 0; } return FlwNode::DeleteTag(pDelTag); } //-------------------------------------------------------------------------- dword CGenStats::ModelStatus() { dword Status=FlwNode::ModelStatus(); Status|=bOn ? FNS_On : FNS_Off; return Status; } //-------------------------------------------------------------------------- flag CGenStats::CIStrng(int No, pchar & pS) { // NB check CBCount is large enough. switch (No-CBContext()) { case 1: pS="E\t?????????"; return 1; default: return FlwNode::CIStrng(No, pS); } } //========================================================================== #endif
6d68c8fa48dcb4555695cfbdff29c0cfc81f42cb
076e59ce9746a07e6cacdbb745f0a62775428542
/contests/sumitrust2019/sumitb2019_b/main.cpp
1bdcedbdc83a906eda3fc9c4f3e4baf091360437
[]
no_license
tsugitta/atcoder
faea5a301818fda11016d8a656398e9468cf945f
f399e1672f50aee69eabf69959c4b7328f971b64
refs/heads/master
2023-03-07T23:06:01.227474
2021-09-23T05:45:00
2021-09-23T05:46:05
191,819,586
10
0
null
2023-02-24T18:59:24
2019-06-13T19:12:38
C++
UTF-8
C++
false
false
2,372
cpp
main.cpp
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b #include "algorithm" #include "cmath" #include "functional" #include "iomanip" #include "iostream" #include "numeric" #include "queue" #include "set" #include "string" #include "vector" #define rep(i, to) for (ll i = 0; i < (to); ++i) #define repf(i, from, to) for (ll i = from; i < (to); ++i) #define repr(i, from) for (ll i = from - 1; i >= 0; --i) #define all(vec) vec.begin(), vec.end() #define fi first #define se second using namespace std; typedef long long ll; template <typename T> using V = vector<T>; using VL = V<ll>; using VVL = V<VL>; template <typename T, typename U> using P = pair<T, U>; using PL = P<ll, ll>; using VPL = V<PL>; template <typename T> inline bool chmax(T& a, T b); template <typename T> inline bool chmin(T& a, T b); void print_ints(vector<ll> v); template <typename T> void drop(T a); const ll INF = 1e18; void solve() { ll N; cin >> N; rep(num, N + 1) { double taxed = num * 1.08; if (floor(taxed) == N) drop(num); } drop(":("); } void solve2() { ll N; cin >> N; ll cand1 = floor(N / 1.08); ll cand2 = floor((N + 1) / 1.08); if (cand1 + cand1 * 8 / 100 == N) drop(cand1); if (cand2 + cand2 * 8 / 100 == N) drop(cand2); drop(":("); } void solve3() { ll N; cin >> N; double l = N / 1.08; double h = (N + 1) / 1.08; // l <= X < h なる整数があるか // l が整数か if (floor(l) == ceil(l)) drop(floor(l)); // l < X <= h なる整数 X がある(l, h の整数部が異なる)かつ X != h か if (floor(l) != floor(h) && floor(h) != ceil(h)) { drop(floor(h)); } drop(":("); } struct exit_exception : public std::exception { const char* what() const throw() { return "Exited"; } }; #ifndef TEST int main() { cin.tie(0); ios::sync_with_stdio(false); try { solve3(); } catch (exit_exception& e) { } return 0; } #endif template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } void print_ints(vector<ll> v) { rep(i, v.size()) { if (i > 0) { cout << " "; } cout << v[i]; } cout << endl; } template <typename T> void drop(T res) { cout << res << endl; throw exit_exception(); }
9e641d5cddbc661f6ac7c21e560d06455adc7552
ed7a5d83d559f0b16656bdbdc3f1c0591d45df1d
/_MODEL_FOLDERS_/copperEntrance/copperEntrance_GLOBALS.cpp
73e71aed7ee770f21ca628eb66374a0353833f5c
[]
no_license
marcclintdion/sin_cos
3b391f1f9d07bb1fab1546aa74b538bef67e00da
67633c39556e5f99301548ec590c68b0692ab045
refs/heads/master
2021-01-10T21:17:35.033174
2015-07-29T06:00:49
2015-07-29T06:00:49
39,876,133
0
0
null
null
null
null
UTF-8
C++
false
false
3,943
cpp
copperEntrance_GLOBALS.cpp
void load_copperEntrance_FromHDtoSystemRAM(void*); void delete_copperEntrance_FromSystemRAM(void); //The VOID pointer is a potential mistake,(it's not a thread function?) //------------------------------------ FREE_IMAGE_FORMAT fifmt_copperEntrance; FIBITMAP *dib_copperEntrance; FIBITMAP *temp_copperEntrance; BYTE *pixels_copperEntrance; //------------------------------------------------------------- bool copperEntrance_isLoadedFromDriveAndWaiting = false; bool copperEntrance_isLoaded = false; char *copperEntrance_FilePath; bool copperEntrance_isActive = false; //========================--------------------------======================== void load_copperEntrance_DOT3_FromHDtoSystemRAM(void*); void delete_copperEntrance_DOT3_FromSystemRAM(void); //The VOID pointer is a potential mistake,(it's not a thread function?) //------------------------------------ FREE_IMAGE_FORMAT fifmt_copperEntrance_DOT3; FIBITMAP *dib_copperEntrance_DOT3; FIBITMAP *temp_copperEntrance_DOT3; BYTE *pixels_copperEntrance_DOT3; //------------------------------------------------------------- bool copperEntrance_DOT3_isLoadedFromDriveAndWaiting = false; bool copperEntrance_DOT3_isLoaded = false; char *copperEntrance_DOT3_FilePath; bool copperEntrance_DOT3_isActive = false; //=================================================================================================================== GLfloat copperEntrance_POSITION[] = { -61.086781f, -39.965790f, 1.766200f, 1.0 }; GLfloat copperEntrance_ROTATION[] = { 0.000000f, 0.000000f, 1.000000f, 0.000000f }; GLfloat copperEntrance_SCALE[] = { 1.000000f, 1.000000f, 1.000000f, 1.0 }; //----------------------------------------------------------------- GLuint copperEntrance_VBO; GLuint copperEntrance_INDICES_VBO; //----------------------------------------------------------------- GLuint copperEntrance_NORMALMAP; GLuint copperEntrance_COLORMAP; GLuint copperEntrance_MASK0MAP; //----------------------------------------------------------------- GLfloat copperEntrance_boundingBox[6]; //=================================================================================================================== void load_copperEntrance_VBOs(void) { #include "copperEntrance.cpp" glGenBuffers(1, &copperEntrance_VBO); glBindBuffer(GL_ARRAY_BUFFER, copperEntrance_VBO); glBufferData(GL_ARRAY_BUFFER, sizeof(copperEntrance), copperEntrance, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); //------------------------------------------------------------------------------ #include "copperEntrance_INDICES.cpp" glGenBuffers(1, &copperEntrance_INDICES_VBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, copperEntrance_INDICES_VBO); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(copperEntrance_INDICES), copperEntrance_INDICES, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //======================================================================================================== }
43aadcb338954e84b19588c433202fded951034d
1061216c2c33c1ed4ffb33e6211565575957e48f
/cpp-qt-qhttpengine-server/server/src/models/OAIDraft.cpp
82766b4bcd16d60b29f10775ca7ebeecca9e4324
[ "MIT" ]
permissive
MSurfer20/test2
be9532f54839e8f58b60a8e4587348c2810ecdb9
13b35d72f33302fa532aea189e8f532272f1f799
refs/heads/main
2023-07-03T04:19:57.548080
2021-08-11T19:16:42
2021-08-11T19:16:42
393,920,506
0
0
null
null
null
null
UTF-8
C++
false
false
5,782
cpp
OAIDraft.cpp
/** * Zulip REST API * Powerful open source group chat * * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIDraft.h" #include <QDebug> #include <QJsonArray> #include <QJsonDocument> #include <QObject> #include "OAIHelpers.h" namespace OpenAPI { OAIDraft::OAIDraft(QString json) { this->initializeModel(); this->fromJson(json); } OAIDraft::OAIDraft() { this->initializeModel(); } OAIDraft::~OAIDraft() {} void OAIDraft::initializeModel() { m_id_isSet = false; m_id_isValid = false; m_type_isSet = false; m_type_isValid = false; m_to_isSet = false; m_to_isValid = false; m_topic_isSet = false; m_topic_isValid = false; m_content_isSet = false; m_content_isValid = false; m_timestamp_isSet = false; m_timestamp_isValid = false; } void OAIDraft::fromJson(QString jsonString) { QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIDraft::fromJsonObject(QJsonObject json) { m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; m_type_isValid = ::OpenAPI::fromJsonValue(type, json[QString("type")]); m_type_isSet = !json[QString("type")].isNull() && m_type_isValid; m_to_isValid = ::OpenAPI::fromJsonValue(to, json[QString("to")]); m_to_isSet = !json[QString("to")].isNull() && m_to_isValid; m_topic_isValid = ::OpenAPI::fromJsonValue(topic, json[QString("topic")]); m_topic_isSet = !json[QString("topic")].isNull() && m_topic_isValid; m_content_isValid = ::OpenAPI::fromJsonValue(content, json[QString("content")]); m_content_isSet = !json[QString("content")].isNull() && m_content_isValid; m_timestamp_isValid = ::OpenAPI::fromJsonValue(timestamp, json[QString("timestamp")]); m_timestamp_isSet = !json[QString("timestamp")].isNull() && m_timestamp_isValid; } QString OAIDraft::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIDraft::asJsonObject() const { QJsonObject obj; if (m_id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); } if (m_type_isSet) { obj.insert(QString("type"), ::OpenAPI::toJsonValue(type)); } if (to.size() > 0) { obj.insert(QString("to"), ::OpenAPI::toJsonValue(to)); } if (m_topic_isSet) { obj.insert(QString("topic"), ::OpenAPI::toJsonValue(topic)); } if (m_content_isSet) { obj.insert(QString("content"), ::OpenAPI::toJsonValue(content)); } if (m_timestamp_isSet) { obj.insert(QString("timestamp"), ::OpenAPI::toJsonValue(timestamp)); } return obj; } qint32 OAIDraft::getId() const { return id; } void OAIDraft::setId(const qint32 &id) { this->id = id; this->m_id_isSet = true; } bool OAIDraft::is_id_Set() const{ return m_id_isSet; } bool OAIDraft::is_id_Valid() const{ return m_id_isValid; } QString OAIDraft::getType() const { return type; } void OAIDraft::setType(const QString &type) { this->type = type; this->m_type_isSet = true; } bool OAIDraft::is_type_Set() const{ return m_type_isSet; } bool OAIDraft::is_type_Valid() const{ return m_type_isValid; } QList<qint32> OAIDraft::getTo() const { return to; } void OAIDraft::setTo(const QList<qint32> &to) { this->to = to; this->m_to_isSet = true; } bool OAIDraft::is_to_Set() const{ return m_to_isSet; } bool OAIDraft::is_to_Valid() const{ return m_to_isValid; } QString OAIDraft::getTopic() const { return topic; } void OAIDraft::setTopic(const QString &topic) { this->topic = topic; this->m_topic_isSet = true; } bool OAIDraft::is_topic_Set() const{ return m_topic_isSet; } bool OAIDraft::is_topic_Valid() const{ return m_topic_isValid; } QString OAIDraft::getContent() const { return content; } void OAIDraft::setContent(const QString &content) { this->content = content; this->m_content_isSet = true; } bool OAIDraft::is_content_Set() const{ return m_content_isSet; } bool OAIDraft::is_content_Valid() const{ return m_content_isValid; } double OAIDraft::getTimestamp() const { return timestamp; } void OAIDraft::setTimestamp(const double &timestamp) { this->timestamp = timestamp; this->m_timestamp_isSet = true; } bool OAIDraft::is_timestamp_Set() const{ return m_timestamp_isSet; } bool OAIDraft::is_timestamp_Valid() const{ return m_timestamp_isValid; } bool OAIDraft::isSet() const { bool isObjectUpdated = false; do { if (m_id_isSet) { isObjectUpdated = true; break; } if (m_type_isSet) { isObjectUpdated = true; break; } if (to.size() > 0) { isObjectUpdated = true; break; } if (m_topic_isSet) { isObjectUpdated = true; break; } if (m_content_isSet) { isObjectUpdated = true; break; } if (m_timestamp_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIDraft::isValid() const { // only required properties are required for the object to be considered valid return m_type_isValid && m_to_isValid && m_topic_isValid && m_content_isValid && true; } } // namespace OpenAPI
ff2552db992866e2b76cb5db849b58cb2eb88063
f60f62d0b915df9dbea9564ae696372d47874667
/code forces/A. Arrival of the General.cpp
56e693e2a51c243a1ad1eaff8294b24b00f6c256
[]
no_license
AbdelrahmanRadwan/Competitive-Programming-Staff
1256d8615f7b445a17c9f2c53ba1461dbc385d2a
f2010a11aba7c524099a7066bebee16b29c6cd41
refs/heads/master
2021-01-02T09:06:48.755299
2017-12-15T18:50:08
2017-12-15T18:50:08
99,144,416
1
0
null
null
null
null
UTF-8
C++
false
false
691
cpp
A. Arrival of the General.cpp
#include<iostream> #include<algorithm> #include<climits> using namespace std; int change(int arr[],int size,int &max,int mini) { int counter=0; for(int i=mini;i<size-1;i++) { swap(arr[i],arr[i+1]); counter++; } if(mini<max) { max--; } for(int i=max;i>0;i--) { swap(arr[i],arr[i-1]); counter++; } return counter; } int main () { int *arr,size,max,mini,maxindex,miniindex; while(cin>>size) { max=INT_MIN ; mini=INT_MAX; arr=new int[size]; for(int i=0;i<size;i++) { cin>>arr[i]; if(arr[i]<=mini) { mini=arr[i]; miniindex=i; } if(arr[i]>max) { max=arr[i]; maxindex=i; } } cout<<change(arr,size,maxindex,miniindex)<<endl; } return 0; }
84918af4b6f39103bf851281b1e3b9471dc2cc6f
36716f5db03da1d0de16cf9b8ab7c95db5275cfb
/epi/chapter10/1.test_if_height_balanced.cpp
ec4d6d235cb259b1450cf23a935fc3062c453239
[]
no_license
mbiggio/cpp_algo
831d9742bed229ff440c3f56cf898de74300814f
a33bb1c5ec8c1c08e4322ddba465dd4276bcb587
refs/heads/master
2020-06-14T21:52:33.342526
2019-07-17T07:36:25
2019-07-17T07:36:25
195,136,129
0
0
null
null
null
null
UTF-8
C++
false
false
667
cpp
1.test_if_height_balanced.cpp
#include <bits/stdc++.h> #include "binaryTree.hpp" using namespace std; template <typename T> pair<bool,int> isHeightBalancedHelper(const unique_ptr<binaryTreeNode<T>> &root) { if (!root) return {true,-1}; int hl = -1, hr = -1; auto pl = isHeightBalancedHelper(root->left); if (!pl.first) return {false,0}; hl=pl.second; auto pr = isHeightBalancedHelper(root->right); if (!pr.first) return {false,0}; hr=pr.second; return {abs(hl-hr) <= 1, 1+max(hl,hr)}; } template <typename T> bool isHeightBalanced(const unique_ptr<binaryTreeNode<T>> &root) { return isHeightBalancedHelper(root).first; } int main(int argc, char *argv[]) { return 0; }
3d3fffa6cb3f919bc5ba6ed8386c19d75208b114
b3812a6eba173f43edbe58c67124bccdc6369489
/Cpp/studyCPP/ds-hash.cpp
22fee6f4622fc1aa52f0ed02ba51ad5310a20da8
[]
no_license
OsmondYe/studyWindows
14cf87887c97fcf03da225a17044e7ceb5b090d4
cf0fa556eb5b8a9a52401fe212bf361047d9be95
refs/heads/master
2021-08-08T21:58:11.732795
2021-07-26T07:07:24
2021-07-26T07:07:24
124,972,867
0
1
null
null
null
null
UTF-8
C++
false
false
373
cpp
ds-hash.cpp
#include "pch.h" #include "helper.hpp" template<typename Key, typename Value> class base_dictionary { public: virtual ~base_dictionary() {} virtual bool empty() =0; virtual int size() =0; virtual const Value& find(const Key& key)=0; virtual void erase(const Key& key) =0; virtual void insert(const Key& key, const Value& value)=0; }; TEST(DSKVHash, ArrayList) { }
28b4a5eb589df8a4af137da634751ff3c81d579f
a7128536d3a8c077251de5f3a1eaa6be2000fd21
/test/compiling-test/compile-nothrow-assignable.cpp
a266046ee9868d73333c14b49a5a19c620c9cccc
[ "MIT" ]
permissive
Bosswestfalen/stopwatch
1b8ead9269d3d781467a62e760c850ee86af26a9
32780e9a599caa17c5d7597bc7da51244c2352c6
refs/heads/master
2020-04-23T04:43:09.231592
2019-02-24T15:26:13
2019-02-24T15:26:13
170,916,705
0
0
null
null
null
null
UTF-8
C++
false
false
112
cpp
compile-nothrow-assignable.cpp
#include "bosswestfalen/stopwatch.hpp" int main() { unsigned tmp; bosswestfalen::stopwatch x{tmp}; }
c092505d4a1c9be3375e5a610aaf2e028d8f1a8d
005e18b6032988b395656b836eaef0db8e438e97
/ConsentiumThings v1.1/ConsentiumThings.cpp
045dc5671b6cc54b38854ae3c128f02672f5f1c1
[ "MIT" ]
permissive
ConsentiumInc/Edge-Beta-Firmware
eda5abe3e459924346127abbf9b12daccc337f10
f973db34cf47cf500dce160eb6762453448e7ab7
refs/heads/main
2023-06-09T14:05:18.414815
2021-06-30T17:04:01
2021-06-30T17:04:01
378,160,141
0
0
null
null
null
null
UTF-8
C++
false
false
6,275
cpp
ConsentiumThings.cpp
#include <ConsentiumThings.h> #define EspBaud 115200 ConsentiumThings::ConsentiumThings(){} bool sendAT(String command,char response[]){ Serial.println(command); delay(5000); if(Serial.find(response)){ return true; } else return false; } void ConsentiumThings::connect(){ Serial.begin(EspBaud); } double ConsentiumThings::InternalTemp(){ unsigned int wADC; double t; ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3)); ADCSRA |= _BV(ADEN); // enable the ADC delay(20); // wait for voltages to become stable. ADCSRA |= _BV(ADSC); // Start the ADC while (bit_is_set(ADCSRA,ADSC)); wADC = ADCW; t = (wADC - 324.31 ) / 1.22; return (t); } void ConsentiumThings::initWiFi(const char* ssid, const char* password){ sendAT("AT", (char*) "OK"); sendAT("AT+CWMODE=3", (char*) "OK"); String cmd="AT+CWJAP=\""+(String)ssid+"\",\""+(String)password+"\"";//join access point if (sendAT(cmd, (char*) "OK")){ Serial.println("WiFi connected"); } else { Serial.println("WiFi not connected"); } } void ConsentiumThings::sendREST(const char* ip, const char* port, const char* key, String info[], int sensor_num, float data[]){ String serverURL; sendAT("AT+CIPMUX=0", (char*) "OK"); String tcp_str = "AT+CIPSTART=\"TCP\",\""+(String)ip + "\","+(String)port; bool tcp_resp = sendAT(tcp_str, (char*) "OK"); if(tcp_resp=true){ delay(2000); if (sensor_num == 1){ float sensor_0 = data[0]; String sensor_0_type = info[0]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type; } else if (sensor_num == 2){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type; } else if (sensor_num == 3){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; float sensor_2 = data[2]; String sensor_2_type = info[2]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type + "&sensor3=" + (String)sensor_2 + "&info3=" + sensor_2_type; } else if (sensor_num == 4){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; float sensor_2 = data[2]; String sensor_2_type = info[2]; float sensor_3 = data[3]; String sensor_3_type = info[3]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type + "&sensor3=" + (String)sensor_2 + "&info3=" + sensor_2_type + "&sensor4=" + (String)sensor_3 + "&info4=" + sensor_3_type; } else if (sensor_num == 5){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; float sensor_2 = data[2]; String sensor_2_type = info[2]; float sensor_3 = data[3]; String sensor_3_type = info[3]; float sensor_4 = data[4]; String sensor_4_type = info[4]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type + "&sensor3=" + (String)sensor_2 + "&info3=" + sensor_2_type + "&sensor4=" + (String)sensor_3 + "&info4=" + sensor_3_type + "&sensor5=" + (String)sensor_4 + "&info5=" + sensor_4_type; } else if (sensor_num == 6){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; float sensor_2 = data[2]; String sensor_2_type = info[2]; float sensor_3 = data[3]; String sensor_3_type = info[3]; float sensor_4 = data[4]; String sensor_4_type = info[4]; float sensor_5 = data[5]; String sensor_5_type = info[5]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type + "&sensor3=" + (String)sensor_2 + "&info3=" + sensor_2_type + "&sensor4=" + (String)sensor_3 + "&info4=" + sensor_3_type + "&sensor5=" + (String)sensor_4 + "&info5=" + sensor_4_type + "&sensor6=" + (String)sensor_5 + "&info6=" + sensor_5_type; } else if (sensor_num == 7){ float sensor_0 = data[0]; String sensor_0_type = info[0]; float sensor_1 = data[1]; String sensor_1_type = info[1]; float sensor_2 = data[2]; String sensor_2_type = info[2]; float sensor_3 = data[3]; String sensor_3_type = info[3]; float sensor_4 = data[4]; String sensor_4_type = info[4]; float sensor_5 = data[5]; String sensor_5_type = info[5]; float sensor_6 = data[6]; String sensor_6_type = info[6]; serverURL = "GET /update?send_key=" + (String)key + "&sensor1=" + (String)sensor_0 + "&info1=" + sensor_0_type + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type + "&sensor3=" + (String)sensor_2 + "&info3=" + sensor_2_type + "&sensor4=" + (String)sensor_3 + "&info4=" + sensor_3_type + "&sensor5=" + (String)sensor_4 + "&info5=" + sensor_4_type + "&sensor6=" + (String)sensor_5 + "&info6=" + sensor_5_type + "&sensor7=" + (String)sensor_6 + "&info7=" + sensor_6_type; } //String serverPath = serverName + "&sensor2=" + (String)sensor_1 + "&info2=" + sensor_1_type; bool rstatus = sendAT("AT+CIPSEND="+String(serverURL.length()), (char*) ">"); if(rstatus=true){ delay(5000); if(sendAT(serverURL, (char*) "OK")){ sendAT("AT+CIPCLOSE", (char*) "OK"); } else{ Serial.println("No response"); } } else{ Serial.println("AT+CIPSEND error!"); } } else{ Serial.println("TCP error!"); } }
7d3957024cf562c6addd92d0da642eba40fe3a2b
a559776b3a8b8e21bb7041c3d76e55ac9889bfb4
/213lizi/ZhengTaiFenBu.cpp
acfefbefdcc981c719f4a7e846034e1265d039d4
[]
no_license
113dilei/Test11
0424d8760918c726b3a2f5e112685c4d71debe4b
850a47b75a4d43fe9739419a57ac767b3ff6ffbc
refs/heads/main
2023-01-24T05:43:08.361299
2020-11-26T07:38:07
2020-11-26T07:38:07
315,935,413
0
0
null
null
null
null
GB18030
C++
false
false
2,280
cpp
ZhengTaiFenBu.cpp
// ZhengTaiFenBu.cpp: implementation of the ZhengTaiFenBu class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "213lizi.h" #include "ZhengTaiFenBu.h" #include "math.h" #define PI 3.14159 #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// ZhengTaiFenBu::ZhengTaiFenBu() { m_n = 10000; m_YD.x = 400; m_YD.y = 600; int i; for(i=0;i<10000;i++) m_s[i]=0; QiuShuJu(); } ZhengTaiFenBu::~ZhengTaiFenBu() { } void ZhengTaiFenBu::Draw(CDC *p) { pDC = p; DrawZhengTai(); DrawZuoBiaoXi(); } void ZhengTaiFenBu::QiuShuJu() { int i; for(i=0;i<m_n;i++) { m_x1[i] = rand()%m_n; m_x1[i] = 1.0*m_x1[i]/m_n; m_x2[i] = rand()%m_n; m_x2[i] = 1.0*m_x2[i]/m_n; } for(i=0;i<m_n;i+=2) { m_y1[i] = sqrt(-2.0*log(m_x1[i]))*cos(2*PI*m_x2[i+1]); m_y1[i+1] = sqrt(-2.0*log(m_x1[i]))*sin(2*PI*m_x2[i+1]); /* m_y2[i] = sqrt(-2.0*log(m_x2[i]))*cos(2*PI*m_x1[i+1]); m_y2[i+1] = sqrt(-2.0*log(m_x2[i]))*sin(2*PI*m_x1[i+1]);*/ } int k; for(i=0;i<m_n;i++) { m_y1[i] +=4; if(m_y1[i]<0)//0.1一个区间 m_y1[i] = 0; m_y1[i] *=10; k = m_y1[i]; m_s[k]++; } i=0; } void ZhengTaiFenBu::DrawZhengTai() { int i; int x,y; x = m_YD.x; y = m_YD.y - m_s[0]; pDC->MoveTo(x,y); for(i=0;i<150;i++) { x = m_YD.x +i*5; y = m_YD.y -m_s[i]; pDC->LineTo(x,y); } } void ZhengTaiFenBu::DrawZuoBiaoXi() { int i,n; float x,y,m; pDC->MoveTo(m_YD); x = m_YD.x; y = m_YD.y -500; pDC->LineTo(x,y); pDC->MoveTo(m_YD); x = m_YD.x +500; y = m_YD.y; pDC->LineTo(x,y); CString str; m = -4.8; for(i=0;i<440;i+=40) { m += 0.8; x = m_YD.x + i; y = m_YD.y + 5; str.Format("%.1f",m); pDC->TextOut(x,y,str); } n = 0; for(i=0;i<520;i+=50) { n = i; x = m_YD.x - 30; y = m_YD.y - i; str.Format("%d",n); pDC->TextOut(x,y,str); } CPen cPen;//声明画笔 cPen.CreatePen(PS_DASH,1,RGB(100,100,100)) ; pDC->SelectObject(&cPen); n = 0; for(i=50;i<520;i+=50) { n = i; x = m_YD.x; y = m_YD.y - i; pDC->MoveTo(x,y); x += 500; pDC->LineTo(x,y); } }
7c4b69795830bd07461956d5d3a3068a95b32adb
477c64cc295740de10c54ae67c09a61d9d724677
/Multiplication/Multiplication/Karatsuba.cpp
465a6fac2c7f619fe5551fcadaec5b9f063a2850
[]
no_license
yunjaena/multiplication_multicore_programming
a6f64bab1f3a092ce533cad93bdc46a9633b4d60
84ac86d4221bd4bb27bc79a43a2f9d7592511af2
refs/heads/master
2022-05-28T17:39:08.244769
2020-05-08T12:12:17
2020-05-08T12:12:17
256,092,214
5
0
null
2020-05-08T12:12:18
2020-04-16T02:46:43
C++
UTF-8
C++
false
false
4,696
cpp
Karatsuba.cpp
#include "Karatsuba.h" #include <omp.h> string Karatsuba::get_serial_result(const string &s1, const string &s2) { set_vector(s1, s2); vector<int> result = serial_karatsuba(v1, v2); return seial_get_result_from_vector(result); } string Karatsuba::seial_get_result_from_vector(const vector<int> &vec) { string ret; for (int i : vec) ret += i + '0'; reverse(ret.begin(), ret.end()); return ret; } string Karatsuba::get_parallel_result(const string& s1, const string& s2) { set_vector(s1, s2); vector<int> result = parallel_karatsuba(v1, v2); return parallel_get_result_from_vector(result); } string Karatsuba::parallel_get_result_from_vector(const vector<int> &vec) { int n = vec.size(); string ret(n, 0); #pragma omp parallel for for (int i = 0; i < n; ++i) { ret[i] = vec[i] + '0'; } reverse(ret.begin(), ret.end()); return ret; } void Karatsuba::set_vector(const string &s1, const string &s2) { v1 = string_to_vi(s1); v2 = string_to_vi(s2); reverse(v1.begin(), v1.end()); reverse(v2.begin(), v2.end()); } void Karatsuba::normalize(vector<int> &num) { num.push_back(0); int n = num.size() - 1; for (int i = 0; i < n; ++i) { if (num[i] < 0) { int borrow = (abs(num[i]) + 9) / 10; num[i + 1] -= borrow; num[i] += borrow * 10; } else { num[i + 1] += num[i] / 10; num[i] %= 10; } } while (num.size() > 1 && num.back() == 0) num.pop_back(); } void Karatsuba::addTo(vector<int> &a, const vector<int> &b, int k) { int bn = b.size(); a.resize(max<int>(a.size(), bn + k) + 1); for (int i = 0; i < bn; ++i) a[i + k] += b[i]; normalize(a); } void Karatsuba::parallel_addTo(vector<int> &a, const vector<int> &b, int k) { int bn = b.size(); a.resize(max<int>(a.size(), bn + k) + 1); #pragma omp parallel for for (int i = 0; i < bn; ++i) a[i + k] += b[i]; normalize(a); } void Karatsuba::subFrom(vector<int> &a, const vector<int> &b) { int bn = b.size(); for (int i = 0; i < bn; ++i) a[i] -= b[i]; normalize(a); } void Karatsuba::parallel_subFrom(vector<int> &a, const vector<int> &b) { int bn = b.size(); #pragma omp parallel for for (int i = 0; i < bn; ++i) a[i] -= b[i]; normalize(a); } vector<int> Karatsuba::multiply(const vector<int> &a, const vector<int> &b) { int an = a.size(), bn = b.size(); vector<int> ret(an + bn + 1, 0); for (int i = 0; i < an; ++i) for (int j = 0; j < bn; ++j) ret[i + j] += a[i] * b[j]; normalize(ret); return ret; } vector<int> Karatsuba::parallel_multiply(const vector<int> &a, const vector<int> &b) { int an = a.size(), bn = b.size(), lim = an + bn - 1; vector<int> ret(an + bn + 1, 0); #pragma omp parallel for schedule(static, 1) for (int i = 0; i < lim; ++i) { int lim2 = min(i, bn - 1); for (int j = max(0, i - an + 1); j <= lim2; ++j) ret[i] += a[i - j] * b[j]; } normalize(ret); return ret; } vector<int> Karatsuba::serial_karatsuba(const vector<int> &a, const vector<int> &b) { int an = a.size(), bn = b.size(); if (an < bn) return serial_karatsuba(b, a); if (an == 0 || bn == 0) return {}; if (an <= 50) return multiply(a, b); int half = an >> 1; vector<int> a0(a.begin(), a.begin() + half); vector<int> a1(a.begin() + half, a.end()); vector<int> b0(b.begin(), b.begin() + min<int>(b.size(), half)); vector<int> b1(b.begin() + min<int>(b.size(), half), b.end()); vector<int> z2 = serial_karatsuba(a1, b1); vector<int> z0 = serial_karatsuba(a0, b0); addTo(a0, a1, 0); addTo(b0, b1, 0); vector<int> z1 = serial_karatsuba(a0, b0); subFrom(z1, z0); subFrom(z1, z2); vector<int> ret; addTo(ret, z0, 0); addTo(ret, z1, half); addTo(ret, z2, half << 1); return ret; } vector<int> Karatsuba::parallel_karatsuba(const vector<int> &a, const vector<int> &b) { int an = a.size(), bn = b.size(); if (an < bn) return parallel_karatsuba(b, a); if (an == 0 || bn == 0) return {}; if (an <= 50) return parallel_multiply(a, b); int half = an >> 1; vector<int> a0(a.begin(), a.begin() + half); vector<int> a1(a.begin() + half, a.end()); vector<int> b0(b.begin(), b.begin() + min<int>(b.size(), half)); vector<int> b1(b.begin() + min<int>(b.size(), half), b.end()); vector<int> z2 = parallel_karatsuba(a1, b1); vector<int> z0 = parallel_karatsuba(a0, b0); parallel_addTo(a0, a1, 0); parallel_addTo(b0, b1, 0); vector<int> z1 = parallel_karatsuba(a0, b0); parallel_subFrom(z1, z0); parallel_subFrom(z1, z2); vector<int> ret; parallel_addTo(ret, z0, 0); parallel_addTo(ret, z1, half); parallel_addTo(ret, z2, half << 1); return ret; }
fe4d67fa7e9d2ceaa06b64dadf9f3acdb9674171
219da4ddbd1a71c50325dd6e07d3013d23655012
/Типи даних/main3.cpp
d124638bfd4cbc0e0e8c1786861c85bf0a6a1457
[]
no_license
rustyMacintosh/cPractice
94fafcc52089083af9af6481402dc0de80bd0367
644e0096b2bc90173c89b94c56e7c740bfedbdaf
refs/heads/master
2020-04-26T00:07:11.814674
2019-05-05T10:48:19
2019-05-05T10:48:19
173,167,384
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
2,099
cpp
main3.cpp
#include <conio.h> #include <iostream> #include <climits> using std::cout; using std::cin; using std::endl; int main() { /* ЦІЛОЧИСЛЕННІ *unsigned відрізає відємні і відповідно розширює діапазон int a; // 4 bytes машинозалежний і може мінятися на різних системах. також він може зберігати число в інших системах числення: // шістнадцяткова - int a = 0x10 = 16 вісімкова int a = 010 = 8; short b; // 2 bytes зарезервований long c; // 4 bytes зарезервований long long d; // 8 bytes char e; // 1 byte збергігає символи кодовані по ascii */ /* ДІЙСНІ *unsigned відрізає відємні і відповідно розширює діапазон double d; //8 bytes має погрішність тобто 12.0 по факту буде 12.0000000000000000000000000000567457346245 d = 12.0; d = 123e-1; //123*10^(-1) = 12.3 float f; //4 bytes точність ще менша ніж в double f = 10.0 / 3; // хоча б один опернанд треба записати як дійсне число так весь вираз стане дійсним числом, інакше отримаємо ділення ціле cout.precision(12); // кількість розрядів після коми для об'єкту cout cout << f; */ /* cout << "\t\t***BMI**\n\n"; double bmi, weight, height; cout << "Enter your height in metres and weight in kilograms:\n"; cin >> height >> weight; bmi = weight / (height * height) ; cout << "Your BMI is: " << bmi; */ // Домашка кількість секунд переводимо в години хвилини і решту секунд int sec, hour, min; cout << "Enter seconds:\n"; cin >> sec; hour = sec / 3600; min = (sec % 3600) / 60; sec = sec % 60; cout << "Hour(s): " << hour << ", minute(s): " << min << ", second(s): " << sec; _getch(); return 0; }
0576b459b6e3ed9fce6ad1d65a563ad1e034cab4
c778d082d9dcf2db72c618509bdaa46b31f2a658
/NANO_AM2305_SD_fat_mod_nuevo_reles/EEPROM.ino
dc034416483635c5a085a8da3f25b264328ae74d
[]
no_license
CStevenO/MCI
07793f7e3f9f989304267f2d8b3dd040618750a1
1cb5aae856351c2ab9f003eda51ef6ad249fe26b
refs/heads/master
2020-12-10T14:22:40.336229
2020-09-30T20:51:32
2020-09-30T20:51:32
233,615,678
1
0
null
2020-01-14T15:43:51
2020-01-13T14:33:35
C++
UTF-8
C++
false
false
502
ino
EEPROM.ino
void cargar() { hora1Sub = EEPROM.read(0); min1Sub = EEPROM.read(1); hora2Sub = EEPROM.read(2); min2Sub = EEPROM.read(3); //////////////////////////////////////// actHSub = EEPROM.read(10); } void guardar() { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Datos Guardados!"); EEPROM.write(0, hora1Sub); EEPROM.write(1, min1Sub); EEPROM.write(2, hora2Sub); EEPROM.write(3, min2Sub); EEPROM.write(10, actHSub); delay(1500); lcd.clear(); estado = 0; }
b89318504189ff6872761bf1b345dd6b1ae819dd
216ecd2f955d333aecce9d905f42583e99794c05
/ContinuumEngine3D/Engine/Renderer/GameObject/Model.h
3a32967b33caea588bd89f661f1c3166305e4eeb
[ "MIT" ]
permissive
Arieandel/ContinuumEngine
1014ca2bb395ccf5a1635e4b3282bedf0e258865
46688dd99195dd88ab15a4ffe0532ac03bc8e373
refs/heads/master
2020-05-17T16:14:52.004911
2019-04-27T19:38:31
2019-04-27T19:38:31
183,811,783
1
0
null
null
null
null
UTF-8
C++
false
false
1,183
h
Model.h
#ifndef MODEL_H #define MODEL_H #include "Mesh.h" #include <OpenGL/glm/gtc/matrix_transform.hpp> #include "LoadOBJModel.h" #include "../Graphics/ShaderHandler.h" namespace ContinuumEngine3D { class Model { public: Model(const std::string& objPath_, const std::string& matPath_, const std::string& shaderProgram_, bool isGlowing_, bool isParallax_); ~Model(); void Render(Camera* camera_, const std::string& shaderProgram_); void AddMesh(Mesh* mesh_); GLuint CreateInstance(glm::vec3 position_, float angle_, glm::vec3 rotation_, glm::vec3 scale_); void DeleteInstance(GLuint index_); void UpdateInstance(GLuint index_, glm::vec3 position_, float angle_, glm::vec3 rotation_, glm::vec3 scale_); glm::mat4 GetTransform(GLuint index_) const; BoundaryBox GetBoundaryBox(); BoundaryBox BoundaryBox; bool isGlowing; bool isParallax; std::vector<glm::mat4> modelInstances; std::string name; private: std::vector<Mesh*> subMeshes; std::map<std::string, GLuint> shaderProgram; glm::mat4 GetTransform(glm::vec3 position_, float angle_, glm::vec3 rotation_, glm::vec3 scale_) const; void LoadModel(); LoadOBJModel* obj; }; } #endif // !MODEL_H
f45a77b4064f8b9160f1efa98879a7542c24c1a2
cba54fda668bdbadbfe04130b17d2f703a53971c
/sr2/src/items/weapons/WeaponTypeExclusionList.cpp
933b352490dbff6bfcb530dc759cf9702747b98c
[]
no_license
Nightwind0/stonering
85af318ad90c6698bc424c86a031481cb6d67ee0
f6c31db3840bfdc3d9a5da7f66aed9186615a2c9
refs/heads/master
2021-01-17T18:45:07.301920
2018-08-29T20:19:56
2018-08-29T20:19:56
65,499,984
0
0
null
null
null
null
UTF-8
C++
false
false
807
cpp
WeaponTypeExclusionList.cpp
#include "WeaponTypeExclusionList.h" #include "WeaponTypeRef.h" using namespace StoneRing; WeaponTypeExclusionList::WeaponTypeExclusionList() { } WeaponTypeExclusionList::~WeaponTypeExclusionList() { // std::for_each(mWeaponTypes.begin(),mWeaponTypes.end(),del_fun<WeaponTypeRef>()); } std::list<WeaponTypeRef*>::const_iterator WeaponTypeExclusionList::GetWeaponTypeRefsBegin() { return m_WeaponTypes.begin(); } std::list<WeaponTypeRef*>::const_iterator WeaponTypeExclusionList::GetWeaponTypeRefsEnd() { return m_WeaponTypes.end(); } bool WeaponTypeExclusionList::handle_element(eElement element, Element * pElement) { if(element == EWEAPONTYPEREF) { m_WeaponTypes.push_back ( dynamic_cast<WeaponTypeRef*>(pElement) ); return true; } else return false; }
22d8478a26ec740f137d14333a89cb83f6ac8e01
9c8e08103673d59d00688ba6b674f95df969e2d6
/TP2_Filters/canny.cpp
5aaf116f59fec0cb5d0cb567725ab0f5f4c5186a
[]
no_license
cepedus/ComputerVision
9528fd0b99202561b5313d1be8548b28b22a31c6
fd845a97d741c91b4be709593dca7efbae7dbb4d
refs/heads/main
2022-12-28T10:43:00.839936
2020-10-16T17:18:33
2020-10-16T17:18:33
304,691,671
0
0
null
null
null
null
UTF-8
C++
false
false
5,543
cpp
canny.cpp
#include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> #include <queue> #define PI 3.14159265 using namespace cv; using namespace std; // Step 1: complete gradient and threshold DONE // Step 2: complete sobel DONE // Step 3: complete canny (recommended substep: return Max instead of C to check it) DONE // Raw gradient. No denoising void gradient(const Mat&Ic, Mat& G2) { Mat I; cvtColor(Ic, I, COLOR_BGR2GRAY); int m = I.rows, n = I.cols; G2 = Mat(m, n, CV_32F); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { float Ix, Iy; // Compute squared gradient (except on borders) if (i > 0 && i < m - 1 && j > 0 && j < n - 1) { Ix = 0.5 * (-I.at<uchar>(i, j - 1) + I.at<uchar>(i, j + 1)); Iy = 0.5 * (-I.at<uchar>(i - 1, j) + I.at<uchar>(i + 1, j)); G2.at<float>(i, j) = sqrt(Ix * Ix + Iy * Iy); } else G2.at<float>(i, j) = 0.0; } } } // Gradient (and derivatives), Sobel denoising void sobel(const Mat&Ic, Mat& Ix, Mat& Iy, Mat& G2) { Mat I; cvtColor(Ic, I, COLOR_BGR2GRAY); int m = I.rows, n = I.cols; Ix = Mat(m, n, CV_32F); Iy = Mat(m, n, CV_32F); G2 = Mat(m, n, CV_32F); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { Ix.at<float>(i, j) = 0.0; Iy.at<float>(i, j) = 0.0; if (i > 0 && i < m - 1 && j > 0 && j < n - 1) { // Sobel kernel Ix.at<float>(i, j) += -I.at<uchar>(i - 1, j - 1) + I.at<uchar>(i - 1, j + 1); Ix.at<float>(i, j) += -2 * I.at<uchar>(i, j - 1) + 2 * I.at<uchar>(i, j + 1); Ix.at<float>(i, j) += -I.at<uchar>(i + 1, j - 1) + I.at<uchar>(i + 1, j + 1); Iy.at<float>(i, j) += -I.at<uchar>(i - 1, j - 1) + -2 * I.at<uchar>(i - 1, j) - I.at<uchar>(i - 1, j + 1); Iy.at<float>(i, j) += I.at<uchar>(i + 1, j - 1) + 2 * I.at<uchar>(i + 1, j) + I.at<uchar>(i + 1, j + 1); // Normalize magnitude (1/8) G2.at<float>(i, j) = 0.125 * sqrt(Ix.at<float>(i, j) * Ix.at<float>(i, j) + Iy.at<float>(i, j) * Iy.at<float>(i, j)); } else G2.at<float>(i, j) = 0.0; } } } // Gradient thresholding, default = do not denoise Mat threshold(const Mat& Ic, float s, bool denoise = false) { Mat Ix, Iy, G2; if (denoise) sobel(Ic, Ix, Iy, G2); else gradient(Ic, G2); int m = Ic.rows, n = Ic.cols; Mat C(m, n, CV_8U); for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) { if (G2.at<float>(i, j) > s) C.at<uchar>(i, j) = 255; else C.at<uchar>(i, j) = 0; } return C; } // Canny edge detector Mat canny(const Mat& Ic, float s1) { Mat Ix, Iy, G2; sobel(Ic, Ix, Iy, G2); float s2 = 2.0 * s1; int m = Ic.rows, n = Ic.cols; Mat Max(m, n, CV_8U); // Max pixels ( G2 > s1 && max in the direction of the gradient ) queue<Point> Q; // Enqueue seeds ( Max pixels for which G2 > s2 ) for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { float l = 255.0, r = 255.0; // store directional pixel values (4 possible directions: 2 axes + 2 diagonals) float angle = atan2(Iy.at<float>(i, j), Ix.at<float>(i, j)) * 180 / PI; if ((angle > -22.5 && angle <= -22.5) || (angle > 157.5 && angle <= 180) || (angle > -180 && angle <= -157.5) ) { l = G2.at<float>(min(i + 1, m), j); r = G2.at<float>(max(i - 1, 0), j); } else if ((angle > 22.5 && angle <= 67.5) || (angle > -157.5 && angle <= -112.5)) { l = G2.at<float>(min(i + 1, m), min(j + 1, n)); r = G2.at<float>(max(i - 1, 0), max(j - 1, 0)); } else if ((angle > 67.5 && angle <= 112.5) || (angle > -112.5 && angle <= -67.5)) { l = G2.at<float>(i, min(j + 1, n)); r = G2.at<float>(i, max(j - 1, 0)); } else if ((angle > 112.5 && angle <= 157.5) || (angle > -67.5 && angle <= -22.5) ) { l = G2.at<float>(min(i + 1, m), max(j - 1, 0)); r = G2.at<float>(max(i - 1, 0), min(j + 1, n)); } // Recover if max in gradient direction, else set to 0 if (G2.at<float>(i, j) > l && G2.at<float>(i, j) > r && G2.at<float>(i, j) > s1) { //Max.at<uchar>(i, j) = G2.at<float>(i, j); Max.at<uchar>(i, j) = 255; } else Max.at<uchar>(i, j) = 0.0; if (G2.at<float>(i, j) > s2) { Q.push(Point(j, i)); } } } // Testing imshow("Max", Max); waitKey(); // Propagate seeds Mat C(m, n, CV_8U); C.setTo(0); while (!Q.empty()) { int i = Q.front().y, j = Q.front().x; Q.pop(); C.at<uchar>(i, j) = 255; if (G2.at<float>(min(i + 1, m), min(j + 1, n)) > s1) C.at<uchar>(min(i + 1, m), min(j + 1, n)) = 255; if (Max.at<float>(min(i + 1, m), j ) > s1) C.at<uchar>(min(i + 1, m), j) = 255; if (Max.at<float>(min(i + 1, m), max(j - 1, 0)) > s1) C.at<uchar>(min(i + 1, m), max(j - 1, 0)) = 255; if (Max.at<float>(max(i - 1, 0), min(j + 1, n)) > s1) C.at<uchar>(max(i - 1, 0), min(j + 1, n)) = 255; if (Max.at<float>(max(i - 1, 0), j ) > s1) C.at<uchar>(max(i - 1, 0), j) = 255; if (Max.at<float>(max(i - 1, 0), max(j - 1, 0)) > s1) C.at<uchar>(max(i - 1, 0), max(j - 1, 0)) = 255; if (Max.at<float>(i , min(j + 1, n)) > s1) C.at<uchar>(i, min(j + 1, n)) = 255; if (Max.at<float>(i , max(j - 1, 0)) > s1) C.at<uchar>(i, max(j - 1, 0)) = 255; } return C; } int main() { Mat I = imread("../road.jpg"); imshow("Input", I); imshow("Threshold", threshold(I, 15)); imshow("Threshold + denoising", threshold(I, 15, true)); imshow("Canny", canny(I, 15)); waitKey(); return 0; }
feb627365471113b185163ad3e307f339412d95b
959cd3ca5f4780ae39b6f75a16fcecac50f10583
/Dates.h
c1238d0da9c04aab8798941ec4bd4377dc473e8e
[]
no_license
buecktobias/Praktikum_PAD4_08_06
55fbde7f244ce8188ed3f6a1a1b18e02ccc750c1
b8bb80aa196653d1b0bc521df98462d038a99e45
refs/heads/master
2023-06-04T18:43:50.887813
2021-06-24T16:30:09
2021-06-24T16:30:09
379,988,272
0
0
null
null
null
null
UTF-8
C++
false
false
243
h
Dates.h
// // Created by bueck on 09.06.2021. // #ifndef PRAKTIKUM_PAD4_08_06_DATES_H #define PRAKTIKUM_PAD4_08_06_DATES_H #include "Date.h" class Dates { public: static bool isSchaltJahr(Date date); }; #endif //PRAKTIKUM_PAD4_08_06_DATES_H
6ef6dcfd35d5e9eee86a217653969ee8e2ef6d0d
9c7c58220a546d583e22f8737a59e7cc8bb206e6
/Project/MyProject/MyProject/Source/MyProject/Private/BaseFrame/Libs/Ui/Base/Form.cpp
9c6fcc57edb8f033094dcc540baf9732998d003a
[]
no_license
SiCoYu/UE
7176f9ece890e226f21cf972e5da4c3c4c4bfe41
31722c056d40ad362e5c4a0cba53b05f51a19324
refs/heads/master
2021-03-08T05:00:32.137142
2019-07-03T12:20:25
2019-07-03T12:20:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,641
cpp
Form.cpp
#include "MyProject.h" #include "UMGForm.h" #include "Prequisites.h" #include "UtilEngineWrap.h" #include "PointF.h" #include "MyGameInstanceBase.h" // UMyGameInstanceBase #include "UMGWidget.h" // UUMGWidget #include "WindowAnchor.h" #include "SafePointer.h" void UForm::loadUWidget(const TCHAR* name) { UClass* widgetClass = StaticLoadClass(UUserWidget::StaticClass(), NULL, name); if (widgetClass != NULL) { //m_umgWidget = Cast<UUserWidget>(StaticConstructObject(widgetClass, GEngine->GameViewport->GetWorld()->GetGameInstance())); //m_umgWidget = Cast<UUserWidget>(StaticConstructObject(widgetClass, MyCtx::getSingletonPtr()->getGameInstance())); // warning C4996: 'StaticConstructObject': StaticConstructObject is deprecated, please use NewObject instead. For internal CoreUObject module usage, please use StaticConstructObject_Internal. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile. //m_umgWidget = Cast<UUserWidget>(StaticConstructObject(widgetClass, Ctx::getSingletonPtr()->getEngineApi()->getGameInstance())); // 直接构造一个抽象类是报错误的 // NewObject<UUserWidget>(); // 构造一个类的子类,最新的 api 如下就可以了 //mWinRender->mUiRoot = NewObject<UUserWidget>(UtilEngineWrap::getGameInstance(), widgetClass); this->mWinRender->mUiRoot = NewObject<UUMGWidget>(UtilEngineWrap::GetGameInstance(), widgetClass); } } UForm::UForm(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { this->mIsExitMode = true; this->mIsHideOnCreate = false; this->mIsReady = false; this->mIsBlurBg = false; this->mIsHandleExitBtn = false; this->mAlignVertial = (int)WindowAnchor::eCENTER; this->mAlignHorizontal = (int)WindowAnchor::eCENTER; this->mIsVisible = false; } UiFormId UForm::getId() { return this->mId; } void UForm::setId(UiFormId value) { this->mId = value; } bool UForm::getHideOnCreate() { return this->mIsHideOnCreate; } void UForm::setHideOnCreate(bool value) { this->mIsHideOnCreate = value; } bool UForm::getExitMode() { return this->mIsExitMode; } void UForm::setExitMode(bool value) { this->mIsExitMode = value; } bool UForm::isReady() { return this->mIsReady; } std::string UForm::getFormName() { return this->mFormName; } void UForm::setFormName(std::string value) { this->mFormName = value; } //LuaCSBridgeForm* UForm::getLuaCSBridgeForm() //{ // return m_luaCSBridgeForm; //} //void UForm::getLuaCSBridgeForm(LuaCSBridgeForm* value) //{ // m_luaCSBridgeForm = value; //} void UForm::init() { this->onInit(); } void UForm::show() { GUiMgr->showForm(mId); } //private void UForm::hide() //{ // GUiMgr->hideForm(mId); //} void UForm::exit() { GUiMgr->exitForm(mId); } // 界面代码创建后就调用 void UForm::onInit() { //if (m_luaCSBridgeForm != nullptr) //{ // m_luaCSBridgeForm.CallMethod(LuaCSBridgeForm.ON_INIT); //} Super::onInit(); } // 第一次显示之前会调用一次 void UForm::onReady() { //if (m_luaCSBridgeForm != nullptr) //{ // m_luaCSBridgeForm.CallMethod(LuaCSBridgeForm.ON_READY); //} this->mIsReady = true; if (this->mIsHandleExitBtn) { //UtilSysLibWrap::addEventHandle(mWinRender.mUiRoot, "BtnClose", onExitBtnClick); // 关闭事件 } } // 每一次显示都会调用一次 void UForm::onShow() { this->mIsVisible = true; //if (m_luaCSBridgeForm != nullptr) //{ // m_luaCSBridgeForm.CallMethod(LuaCSBridgeForm.ON_SHOW); //} if (this->mIsBlurBg) { //GUiMgr->showForm(eUIBlurBg); // 显示模糊背景界面 } //adjustPosWithAlign(); } // 每一次隐藏都会调用一次 void UForm::onHide() { this->mIsVisible = false; //if (m_luaCSBridgeForm != nullptr) //{ // m_luaCSBridgeForm.CallMethod(LuaCSBridgeForm.ON_HIDE); //} //if (mIsBlurBg) //{ // GUiMgr->exitForm(UiFormId.eUIBlurBg); //} } // 每一次关闭都会调用一次 void UForm::onExit() { this->mIsVisible = false; this->mIsReady = false; //if (m_luaCSBridgeForm != nullptr) //{ // m_luaCSBridgeForm.CallMethod(LuaCSBridgeForm.ON_EXIT); //} //if (mIsBlurBg) //{ // GUiMgr->exitForm(UiFormId.eUIBlurBg); //} this->mAuxMUIClassLoader->unload(); MY_SAFE_DISPOSE(this->mAuxMUIClassLoader); Super::onExit(); } bool UForm::isVisible() { //return mWinRender->mUiRoot->activeSelf; // 仅仅是自己是否可见 return this->mIsVisible; } /* * stage的大小发生变化后,这个函数会被调用。子类可重载这个函数 */ void UForm::onStageReSize() { this->adjustPosWithAlign(); } void UForm::adjustPosWithAlign() { PointF* pos = this->computeAdjustPosWithAlign(); this->setPosX(pos->getX()); this->setPosY(pos->getY()); } PointF* UForm::computeAdjustPosWithAlign() { PointF* ret = MY_NEW PointF(0, 0); //int widthStage = 0; //int heightStage = 0; //if (mAlignVertial == (int)CENTER) //{ // ret->setX((heightStage - this->m_height) / 2); //} //else if (mAlignVertial == (int)TOP) //{ // ret->setY(this->m_marginTop); //} //else //{ // ret->setY(heightStage - this->m_height - this->m_marginBottom); //} //if (mAlignHorizontal == (int)CENTER) //{ // ret->setX((widthStage - this->m_width) / 2); //} //else if (mAlignHorizontal == (int)LEFT) //{ // ret->setX(m_marginLeft); //} //else //{ // ret->setX(widthStage - this->m_width - mMarginRight); //} return ret; } // 按钮点击关闭 void UForm::onExitBtnClick() { this->exit(); } AuxMUiClassLoader* UForm::getAuxMUIClassLoader() { return this->mAuxMUIClassLoader; } void UForm::setAuxMUIClassLoader(AuxMUiClassLoader* value) { this->mAuxMUIClassLoader = value; }
1bd51f7a2fc4bd8f2c0d915b7cad13410b15324d
506f7c7e18a20ce6fb9198bc020621273201e36b
/vm/src/any/prims/glueDefs.cpp
a61b05f73444497f61dc5fe8f30c7c49f05bca3c
[]
no_license
doublec/self
b49e5af8db3869ef3759ae7e8875bbfd8a59654c
43ebab6c80544803afbc02847d3ae8bfc54f3c4a
refs/heads/master
2020-12-24T23:18:25.069800
2015-05-25T01:58:11
2015-05-25T01:58:11
256,688
3
0
null
null
null
null
UTF-8
C++
false
false
270
cpp
glueDefs.cpp
/* Sun-$Revision: 30.9 $ */ /* Copyright 1992-2012 AUTHORS. See the LICENSE file for license information. */ # include "generation_inline.hh" # include "glueDefs.hh" # include "space_inline.hh" bool xlib_semaphore = false; bool quartz_semaphore = false;
83757ffbfeaf3afd9fc04b8edc9eaf9d45a28c2d
258abfd3c0ac304af263fdfff5c549e43bd18364
/include/parAlmond/parAlmondCoarseSolver.hpp
3cd08c7910f34d0acb28e1e785945127ad9c4969
[ "MIT" ]
permissive
CEED/libParanumal
6919025b47cbf877e8c59b62f6c6c9472e039f18
cee9c5eeb1a5d95339affd384c82e582c0fedbc5
refs/heads/master
2023-08-17T01:15:18.143119
2022-06-08T00:21:50
2022-06-08T00:21:50
164,707,123
1
0
null
null
null
null
UTF-8
C++
false
false
3,518
hpp
parAlmondCoarseSolver.hpp
/* The MIT License (MIT) Copyright (c) 2017-2022 Tim Warburton, Noel Chalmers, Jesse Chan, Ali Karakus, Rajesh Gandham Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef PARALMOND_COARSESOLVE_HPP #define PARALMOND_COARSESOLVE_HPP #include "settings.hpp" #include "platform.hpp" #include "solver.hpp" #include "parAlmond.hpp" #include "parAlmond/parAlmondDefines.hpp" #include "parAlmond/parAlmondparCSR.hpp" namespace libp { namespace parAlmond { class coarseSolver_t: public operator_t { public: platform_t platform; settings_t settings; comm_t comm; int Nrows; int Ncols; int rank, size; coarseSolver_t(platform_t& _platform, settings_t& _settings, comm_t _comm): platform(_platform), settings(_settings), comm(_comm) {} virtual int getTargetSize()=0; virtual void setup(parCSR& A, bool nullSpace, memory<dfloat> nullVector, dfloat nullSpacePenalty)=0; virtual void syncToDevice()=0; virtual void Report(int lev)=0; virtual void solve(deviceMemory<dfloat>& o_rhs, deviceMemory<dfloat>& o_x)=0; }; class exactSolver_t: public coarseSolver_t { public: parCSR A; int coarseTotal; int coarseOffset; memory<int> coarseOffsets; memory<int> coarseCounts; memory<int> sendOffsets; memory<int> sendCounts; int N; int offdTotal=0; memory<dfloat> diagInvAT, offdInvAT; deviceMemory<dfloat> o_diagInvAT, o_offdInvAT; memory<dfloat> diagRhs, offdRhs; deviceMemory<dfloat> o_offdRhs; exactSolver_t(platform_t& _platform, settings_t& _settings, comm_t _comm): coarseSolver_t(_platform, _settings, _comm) {} int getTargetSize(); void setup(parCSR& A, bool nullSpace, memory<dfloat> nullVector, dfloat nullSpacePenalty); void syncToDevice(); void Report(int lev); void solve(deviceMemory<dfloat>& o_rhs, deviceMemory<dfloat>& o_x); }; class oasSolver_t: public coarseSolver_t { public: parCSR A; int N; int diagTotal=0, offdTotal=0; memory<dfloat> diagInvAT, offdInvAT; deviceMemory<dfloat> o_diagInvAT, o_offdInvAT; oasSolver_t(platform_t& _platform, settings_t& _settings, comm_t _comm): coarseSolver_t(_platform, _settings, _comm) {} int getTargetSize(); void setup(parCSR& A, bool nullSpace, memory<dfloat> nullVector, dfloat nullSpacePenalty); void syncToDevice(); void Report(int lev); void solve(deviceMemory<dfloat>& o_rhs, deviceMemory<dfloat>& o_x); }; } //namespace parAlmond } //namespace libp #endif
200d9f77f7cbb54fb43861b6870662346cf83c2a
fe3d7da03dad0238c90274283b39d0a72fa6d7f6
/DirectShowFilters/MPAudioRenderer/source/AudioClockTracker.cpp
6d7b013652fe03ed05ee6f92f7a1fcb935c795ac
[]
no_license
morpheusxx/MediaPortal-1
d39f55ea833f2e236d409698f46c1e2c7f8c8b54
91418996e35b76f08b5885246a84f131fff0c731
refs/heads/EXP-TVE3.5-MP1-MP2
2023-08-03T12:07:08.853789
2014-07-20T08:48:57
2014-07-20T08:48:57
11,057,754
1
4
null
2023-06-04T11:10:11
2013-06-29T19:00:10
C#
UTF-8
C++
false
false
2,487
cpp
AudioClockTracker.cpp
// Copyright (C) 2005-2012 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>. #include "AudioClockTracker.h" #include "alloctracing.h" AudioClockTracker::AudioClockTracker() { Reset(); } AudioClockTracker::~AudioClockTracker() { } void AudioClockTracker::Reset() { m_dAudioProcessedError = 0.0; m_dAudioResampledError = 0.0; m_llAudioProcessed = 0; m_llAudioResampled = 0; m_dUndriftedAudioProcessed = 0.0; m_dDriftedAudioProcessed = 0.0; } void AudioClockTracker::ResampleComplete(double sampleTime, double resampleTime, double bias, double adjustment, double AVMult) { // Work out how much the resampling would have been if not for the hardware clock adjustment // it is unreliable as it applies over the whole stream length - not just this sample // i.e. a change in the hardware clock adjustment needs to be applied retrospectively to any // already processed samples m_dUndriftedAudioProcessed += sampleTime * bias * adjustment; m_dDriftedAudioProcessed += resampleTime; m_llAudioProcessed += (INT64)sampleTime; m_llAudioResampled += (INT64)resampleTime; m_dAudioProcessedError += sampleTime - (double)((INT64)sampleTime); m_dAudioResampledError += resampleTime - (double)((INT64)resampleTime); if (m_dAudioProcessedError > 1.0) { m_llAudioProcessed++; m_dAudioProcessedError -= 1.0; } if (m_dAudioResampledError > 1.0) { m_llAudioResampled++; m_dAudioResampledError -= 1.0; } } double AudioClockTracker::GetCurrentDrift(double AVMult) const { return m_dDriftedAudioProcessed - m_dUndriftedAudioProcessed * AVMult; } INT64 AudioClockTracker::GetAudioProcessed() const { return m_llAudioProcessed; } INT64 AudioClockTracker::GetAudioResampled() const { return m_llAudioResampled; }
f7e9c8a55229792d64c991b40370a249f3ac61ed
78e2c512ca819c2dddb72ced9f48b35f430daba1
/Europa v6s/Europa v6/CMesh.cpp
b1c7b46ce590b391ccbe0e1c9fa017911df0f1b3
[]
no_license
thedarkprincedc/Europa
5bd0225d3b14c8e46b9f24b3531ef7b9b4fe4e7c
67d8b871485668ec014bec0ac4f734543956ad09
refs/heads/master
2021-01-18T13:58:34.223954
2014-12-04T04:52:31
2014-12-04T04:52:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,871
cpp
CMesh.cpp
#include "./CMesh.h" CMesh::CMesh(IDirect3DDevice9* pDevice, char *pszFilename, char *pszTexturepath) { LoadMesh(pDevice, pszFilename, pszTexturepath); } HRESULT CMesh::LoadMesh(IDirect3DDevice9* pDevice, char *pszFileName, char *pszTexturePath) { ID3DXBuffer *adjBuffer = 0; ID3DXBuffer *mtrlBuffer = 0; DWORD numMtrls = 0; IDirect3DTexture9 *tex = NULL; WCHAR wchfilename[255]; //unicode char mbstowcs(wchfilename, pszFileName, 255); // conversion if(FAILED(D3DXLoadMeshFromX(wchfilename, D3DXMESH_MANAGED, pDevice, &adjBuffer, &mtrlBuffer, 0, &numMtrls, &m_pMesh))){ ::MessageBox(0, L"D3DXLoadMeshFromX() - FAILED", 0, 0); return false; } if(mtrlBuffer != 0 && numMtrls != 0) { D3DXMATERIAL *mtrls = (D3DXMATERIAL*) mtrlBuffer->GetBufferPointer(); for(int i = 0; i < numMtrls; i++) { mtrls[i].MatD3D.Ambient = mtrls[i].MatD3D.Diffuse; m_vMaterials.push_back(mtrls[i].MatD3D); if(mtrls[i].pTextureFilename != 0) { tex = NULL; char texName[64]; strcpy(texName,pszTexturePath); if(strlen(texName) > 2) strcat(texName, "/"); strcat(texName,mtrls[i].pTextureFilename); mbstowcs(wchfilename, texName, 255); // conversion D3DXCreateTextureFromFile(pDevice, wchfilename, &tex); m_vTextures.push_back(tex); } else m_vTextures.push_back(0); } } mtrlBuffer->Release(); if(FAILED(m_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT|D3DXMESHOPT_COMPACT|D3DXMESHOPT_VERTEXCACHE, (DWORD*)adjBuffer->GetBufferPointer(),0, 0, 0))) { MessageBox(0, L"OptimizeInplace() - FAILED", 0, 0); return false; } adjBuffer->Release(); return S_OK; } void CMesh::Render(IDirect3DDevice9* pDevice, D3DXMATRIX *transMatrix) { pDevice->SetTransform(D3DTS_WORLD, transMatrix); for(int i = 0; i < m_vMaterials.size(); i++) { pDevice->SetMaterial( &m_vMaterials[i] ); pDevice->SetTexture(0, m_vTextures[i]); m_pMesh->DrawSubset(i); } } void CMesh::Render(IDirect3DDevice9* pDevice, D3DXVECTOR3 position, D3DXVECTOR3 rotation, D3DXVECTOR3 scale) { D3DXMATRIX matTransform; D3DXMATRIX matRotation; D3DXMATRIX matTranslation; D3DXMATRIX matScale; D3DXMatrixIdentity(&matTransform); D3DXMatrixIdentity(&matRotation); D3DXMatrixIdentity(&matTranslation); D3DXMatrixIdentity(&matScale); D3DXMatrixTranslation(&matTranslation, position.x, position.y, position.z); D3DXMatrixRotationYawPitchRoll(&matRotation, rotation.y, rotation.x, rotation.z); D3DXMatrixScaling(&matScale, scale.x, scale.y, scale.z); matTransform = matScale * matRotation * matTranslation; pDevice->SetTransform(D3DTS_WORLD, &matTransform); for(int i = 0; i < m_vMaterials.size(); i++) { pDevice->SetMaterial( &m_vMaterials[i] ); pDevice->SetTexture(0, m_vTextures[i]); m_pMesh->DrawSubset(i); } }
b2cbc5f008b6fe8fc6d42a9e01c452ca6ef085ea
dfa6ddf5fb513d553d43a028add28cdf40b46249
/719. Find K-th Smallest Pair Distance.cpp
f83cb7009ea443dc710020f4f45604a16132884b
[]
no_license
brucechin/Leetcode
c58eb6eedf3a940841a0ccae18d543fd88b76f65
798e6f1fa128982c7fd141a725b99805131361cb
refs/heads/master
2021-11-22T14:31:53.143147
2021-10-08T06:50:28
2021-10-08T06:50:28
109,366,643
4
0
null
null
null
null
UTF-8
C++
false
false
1,193
cpp
719. Find K-th Smallest Pair Distance.cpp
/* The distance of a pair of integers a and b is defined as the absolute difference between a and b. Given an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] and nums[j] where 0 <= i < j < nums.length. Example 1: Input: nums = [1,3,1], k = 1 Output: 0 Explanation: Here are all the pairs: (1,3) -> 2 (1,1) -> 0 (3,1) -> 2 Then the 1st smallest distance pair is (1,1), and its distance is 0. Example 2: Input: nums = [1,1,1], k = 2 Output: 0 Example 3: Input: nums = [1,6,1], k = 3 Output: 5 Constraints: n == nums.length 2 <= n <= 104 0 <= nums[i] <= 106 1 <= k <= n * (n - 1) / 2 */ class Solution { public: int smallestDistancePair(vector<int>& nums, int k) { sort(nums.begin(), nums.end()); int n = nums.size(), low = 0, high = 1000000; while (low < high) { int mid = (low + high)/2, cnt = 0; for (int i = 0, j = 0; i < n; i++) { while (j < n && nums[j]-nums[i] <= mid) j++; cnt += j-i-1; } if (cnt < k) low = mid+1; else high = mid; } return low; } };
5bf8c3da8805a752d0726caa709eb7cfb6474c5d
151b1ed23a4d972582cdd26b21c49d8689c804bb
/eventlib/eventI_noninv_infY.cc
0ff01697abb1e168c625e607174924bece4f83ca
[]
no_license
Chuzzle/masters_thesis
63cf48996c35e6752f82e4ef169d6bace16e83eb
f785d0d6a4ddc45490f73c343fc23d7c686c631a
refs/heads/master
2020-05-21T19:10:22.282789
2017-08-12T18:01:28
2017-08-12T18:01:28
61,619,714
0
0
null
null
null
null
UTF-8
C++
false
false
441
cc
eventI_noninv_infY.cc
#include "eventI_noninv_infY.h" using namespace std; double EventI_noninv_infY::update_prob(double t) { prob = constants.get_prob("PROB_NON_INVASION_INVASIVE") * pop.get_pop("YOUNG_INF_INVASIVE"); return prob; } void EventI_noninv_infY::execute_event() { pop.move_pop("YOUNG_INF_INVASIVE", "YOUNG_CARRIERS_INVASIVE"); } string EventI_noninv_infY::description() { return "Young infected becoming carrier of an invasive strain"; }
ad486586c2c0e77bc67d8c18f7b3df1f6820220d
0681a9fd09f690149472c28587e2ed387c449ab5
/src/model/cell.cpp
adcc59b3f8e46c9695a4fab314ea0df7dac46222
[]
no_license
zhzh2001/tnpquest
8b50c857cf5d6b8032d873d82bb0876dabd1f9ee
26d0e4540bbc9b309460f4a886e500856551193f
refs/heads/master
2022-09-09T10:16:29.394325
2022-08-28T03:55:12
2022-08-28T03:55:12
202,351,368
0
0
null
null
null
null
UTF-8
C++
false
false
2,896
cpp
cell.cpp
#include "cell.h" #include "enemy.h" #include "star.h" #include "../utils/utils.h" #include "../utils/msgbox.h" #ifdef _WIN32 #include "../pdcurses/curses.h" #else #include "../ncurses/ncurses.h" #endif #include <typeinfo> Cell::Cell() : visibility(none), item(nullptr), terrain(nullptr), star(nullptr) {} void Cell::setItem(const Item *item) { this->item = item; } void Cell::setTerrain(const Terrain *terrain) { this->terrain = terrain; } void Cell::setStar(const Star *star) { this->star = star; } void Cell::setVisibility(Visibility visibility) { if (!item) return; if (visibility == none) this->visibility = none; else if (visibility == exists) // try to set it to exists { if (item->getScent()) this->visibility = exists; // item is scentable else this->visibility = none; // item is not scentable, so it's not visible } else if (visibility == visible) // try to set it to visible { if (item->getExplore()) // explorable implys scentable this->visibility = visible; else if (item->getScent()) this->visibility = exists; else this->visibility = none; } } void Cell::renderTerrain(bool current) { if (terrain) printw(paddingMid(std::string(terrain->getName()), current).c_str()); else printw("ERROR!!!"); // unexpected error } void Cell::renderItem(bool current) { if (!item) printw(" "); else if (visibility == visible) { if (star) // print star first printw(MultiString({" Vital ", " 必需品 "})); else printw(paddingMid(std::string(item->getName()), current).c_str()); } else if (visibility == exists) printw(paddingMid(std::string(MultiString({"Unknown", "未知"})), current).c_str()); else printw(" "); } bool Cell::trigger(Cat &cat) { if (!item) return false; item->trigger(cat); if (typeid(*item) == typeid(Enemy)) // use RTTI to check if the item is an enemy { if (cat.hasFled()) return true; std::string msg; if (star) { msg = MultiString({"You found " + star->getName(), "你找到了" + star->getName()}); cat.incStar(); } else msg = MultiString({"You defeated " + item->getName(), "你击败了" + item->getName()}); msg += MultiString({", great work!", ", 太棒了!"}); MsgBox::create(msg.c_str()); } item = nullptr; // remove triggered item return true; } bool Cell::isEnemy() const { return item && typeid(*item) == typeid(Enemy); } bool Cell::hunt(Cat &cat) { if (item && typeid(*item) == typeid(Prey)) { dynamic_cast<const Prey *>(item)->hunt(cat); // don't use trigger() here, as it will cause the prey to be scared away return true; } MsgBox::create(MultiString({"Nothing to hunt here.", "这里没有可以捕猎的东西。"})); return false; } const Terrain *Cell::getTerrain() const { return terrain; }
f6c3e91d9f5185340c27ad9caab732a455df0dd7
8dfc879a6e98055a5d62b334b56f5e2c1f278913
/AtCoder/contest_atcoder/ABC118/proC.cpp
33e71e7007ed606189befb094c3ed0d09cd6ff7c
[]
no_license
sitRyo/templateCpp_atcoder
fcdad44ea348c76a9bde4a320cf2925df7d8a751
cec7103ab55af136a8fb03efdaae0a9c2b460ff5
refs/heads/master
2021-06-25T19:33:31.043330
2019-06-20T06:57:57
2019-06-20T06:57:57
142,314,195
0
0
null
null
null
null
UTF-8
C++
false
false
1,351
cpp
proC.cpp
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <functional> #include <queue> #include <string> #include <cstring> #include <numeric> #include <cstdlib> #include <cmath> #include <map> #include <set> using namespace std; typedef long long ll; #define INF 10e17 // 4倍しても(4回足しても)long longを溢れない #define rep(i,n) for(int i=0; i<n; i++) #define rep_r(i,n,m) for(int i=m; i<n; i++) #define END cout << endl #define MOD 1000000007 #define pb push_back #define sorti(x) sort(x.begin(), x.end()) #define sortd(x) sort(x.begin(), x.end(), std::greater<int>()) // 約数の列挙 template<typename T> set<T> div_count(T x) { set<T> st; for (int i = 1; i * i <= x; ++i) { if (x % i == 0) { st.insert(i); st.insert(x/i); } } return st; } int main() { int n; cin >> n; vector<ll> a(n); rep(i,n) { cin >> a[i]; } set<ll> st; map<ll,bool> mp; for (auto itr : div_count(a[0])) { st.insert(itr); mp[itr] = true; } ll ans = -1; for (int i = 1; i < n; ++i) { for (auto itr : mp) { if (itr.second) { if (itr.first > a[i] or a[i] % itr.first != 0) { mp[itr.first] = false; } } } } for (auto itr : mp) { if (itr.second) ans = max(ans, itr.first); } cout << ans << endl; }
d11fbb0a6641af42a5bdaec5f43f2bf7d5004bbf
dcbf00e94e3f01ad549f63e41b0590f5833f6ca8
/source/projects/abc.audio_tilde/abc.audio_tilde.cpp
a6a55ad62070e65aa668599228c50fafc54f590e
[]
no_license
Badokas/max-external
58c95cfdd2ec0251cb5b92e9700b0d710998b890
298fd99da962ce051aac8846404f70750b0e5e22
refs/heads/master
2022-10-29T07:47:39.473908
2020-06-10T08:51:45
2020-06-10T08:51:45
220,852,807
0
0
null
null
null
null
UTF-8
C++
false
false
2,572
cpp
abc.audio_tilde.cpp
#include "c74_msp.h" #include "c74_common.h" // for usage of Attributes using namespace c74::max; #define OBJECT_NAME "abc.audio~" // name of the object static t_class *this_class = nullptr; // required global pointer to this class typedef struct _abc { t_pxobject x_obj; t_symbol name; // used in Attribute } t_abc; void *abc_new(t_symbol *s, short ac, t_atom *av); void abc_free(t_abc *x); void abc_in1(t_abc *x, long n); void abc_perform64(t_abc *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam); void abc_dsp64(t_abc *x, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags); void abc_assist(t_abc *x, void *b, long m, long a, char *s); void ext_main(void *r) { this_class = class_new(OBJECT_NAME, (method)abc_new, (method)abc_free, (short)sizeof(t_abc), 0L, A_DEFFLOAT, 0); class_addmethod(this_class, (method)abc_in1, "in1", A_SYM, 0); class_addmethod(this_class, (method)abc_dsp64, "dsp64", A_CANT, 0); class_addmethod(this_class, (method)abc_assist, "assist", A_CANT, 0); /* Attributes */ CLASS_ATTR_SYM(this_class, "name", 0, t_abc, name); CLASS_ATTR_ACCESSORS(this_class, "name", NULL, (method)abc_getter_attribute); CLASS_ATTR_CATEGORY(this_class, "name", 0, "My Category"); CLASS_ATTR_LABEL(this_class, "name", 0, "Name"); CLASS_ATTR_BASIC(this_class, "name", 0); class_dspinit(this_class); class_register(CLASS_BOX, this_class); } void abc_in1(t_abc *x, long n) {} void abc_dsp64(t_abc *x, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags) { dsp_add64(dsp64, (t_object *)x, (t_perfroutine64)abc_perform64, 0, NULL); } void abc_perform64(t_abc *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam) { double *in = ins[0]; double *out = outs[0]; int n = (int)sampleframes; while(n--) *out++ = *in++; } void abc_assist(t_abc *x, void *b, long m, long a, char *s) { if(m == ASSIST_OUTLET) sprintf(s, "(signal) Audio input"); else sprintf(s, "(signal) Audio output"); } void abc_free(t_abc *x) { dsp_free((t_pxobject *)x); } void *abc_new(t_symbol *s, short ac, t_atom *av) { t_abc *x = (t_abc *)object_alloc((t_class *)this_class); if(!x) return (x); dsp_setup((t_pxobject *)x, 1); outlet_new((t_object *)x, "signal"); object_post((t_object *)x, "Hello from abc.audio~"); return (x); }
ff51348bb34486f4ea08411f877d9b9e3f8d51aa
385476063e09e7c629bb4796c6d59e9be3e1fb6d
/src/main.cc
ee173384249fb127a0e100f41c3a14136c13ede9
[ "BSD-2-Clause" ]
permissive
interval1066/filecryptor
57e2fa2366516dc0fc5c8534fecda4c36c783305
323b78651d04e73a20f4ebdd0563462d55dfad53
refs/heads/main
2023-04-12T02:38:08.967891
2021-05-19T22:53:44
2021-05-19T22:53:44
328,503,171
2
1
null
null
null
null
UTF-8
C++
false
false
362
cc
main.cc
#include "include/mainwindow.h" #include <QApplication> #include <QSharedMemory> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; QSharedMemory shared("c53d1e4a-7b10-40a2-8a77-7b0f8e1a357a"); if(!shared.create( 512, QSharedMemory::ReadWrite)) exit(0); w.show(); return a.exec(); }
573dd2d6a8f67b6a95c6bba358fb873f57c9411a
51635684d03e47ebad12b8872ff469b83f36aa52
/external/gcc-12.1.0/libstdc++-v3/testsuite/20_util/optional/84601.cc
fbfa8fdeebf23fab14f7134ec3c131073b90977d
[ "LGPL-2.1-only", "GPL-3.0-only", "GCC-exception-3.1", "GPL-2.0-only", "LGPL-3.0-only", "LGPL-2.0-or-later", "Zlib", "LicenseRef-scancode-public-domain" ]
permissive
zhmu/ananas
8fb48ddfe3582f85ff39184fc7a3c58725fe731a
30850c1639f03bccbfb2f2b03361792cc8fae52e
refs/heads/master
2022-06-25T10:44:46.256604
2022-06-12T17:04:40
2022-06-12T17:04:40
30,108,381
59
8
Zlib
2021-09-26T17:30:30
2015-01-31T09:44:33
C
UTF-8
C++
false
false
429
cc
84601.cc
// { dg-do compile { target c++17 } } #include <optional> #include <utility> using pair_t = std::pair<int, int>; using opt_t = std::optional<pair_t>; static_assert(std::is_copy_constructible_v<opt_t::value_type>); static_assert(std::is_copy_assignable_v<opt_t::value_type>); static_assert(std::is_copy_assignable_v<opt_t>); // assertion fails. class A { void f(const opt_t& opt) { _opt = opt; } opt_t _opt; };
fb173d46e7dbd1c3de509dab97b1a74d772c4c44
7c104ee1b6b00343f9f436a3374aaeec132584c9
/DXRPG.Engine/Platform/Common/World/Map/Map.cpp
c58b2e68114b023bc29b20196c40e6e281601e76
[]
no_license
FBLipke/DXRPG-Engine
5885480ce124a50d0dd0ed33e236174f549c6cd4
94aa0308ece33a05ef374c4610df28413c0472aa
refs/heads/master
2020-08-02T09:12:33.048408
2019-09-28T16:58:19
2019-09-28T16:58:19
211,299,152
0
0
null
null
null
null
UTF-8
C++
false
false
545
cpp
Map.cpp
#include <Platform/Platform.h> Map::Map(const glm::vec3& mapSize) { this->mapSize = mapSize; } Map::~Map() = default; void Map::Add_Layer(const int& layerId, const glm::vec3& size) { this->map_layers.emplace_back(layerId); for (auto iY = 0; iY < size.y; iY++) { for (auto iX = 0; iX < size.x; iX++) { this->map_layers.at(layerId).Add_Tile (glm::vec2(iX * 32, iY * 32)); } } } void Map::Generate() { this->mapSize = glm::vec3(80, 80, 16); for (auto iL = 0; iL < this->mapSize.z; iL++) Add_Layer(iL, this->mapSize); }
cf90c67d4c15d021cbb584a9bc12c87137352de2
0490f71df4da7778d5555ffbfabd5af7d6a415d1
/apps/RAMDanceToolkit/src/scenes/Future/Future.h
74b8d8f0fecb7b03b8513654e82b34aeb17d7208
[ "Apache-2.0" ]
permissive
ofxyz/RAMDanceToolkit
050d231266b1318db7b921a732ac1d2efc5ea108
5db15135f4ad6f6a9116610b909df99036f74797
refs/heads/master
2021-05-23T18:42:04.342125
2018-02-09T02:57:07
2018-02-09T02:57:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,535
h
Future.h
// // Future.h - RAMDanceToolkit // // Copyright 2012-2013 YCAM InterLab, Yoshito Onishi, Satoru Higa, Motoi Shimizu, and Kyle McDonald // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include "ParticleEngine.h" class Future : public ramBaseScene { ramFilterEach<ramGhost> ghostFilters; ramFilterEach<ramLowPassFilter> lowPassFilters; float speed, distance; public: bool draw_line; Future() : distance(150), speed(27), draw_line(false) {} struct Preset { ramGhost *self; float distance; float speed; Preset(ramGhost *self, float distance, float speed) : self(self), distance(distance), speed(speed) {} void operator()() { self->setSpeed(speed); self->setDistance(distance); } }; void setupControlPanel() { ramGetGUI().addToggle("Draw line from actor to ghost", &draw_line); ofAddListener(ramGetGUI().addButton("Speed: Ghost"), this, &Future::onPresetGhost); ofAddListener(ramGetGUI().addButton("Speed: Slow"), this, &Future::onPresetSlow); ofAddListener(ramGetGUI().addButton("Speed: Normal"), this, &Future::onPresetNormal); ofAddListener(ramGetGUI().addButton("Speed: Fast"), this, &Future::onPresetFast); ramGetGUI().addSlider("Distance", 0.0, 255.0, &distance); ramGetGUI().addSlider("Speed", 0.0, 255.0, &speed); ofAddListener(ramGetGUI().getCurrentUIContext()->newGUIEvent, this, &Future::onValueChanged); } void draw() { const vector<ramNodeArray>& NAs = ghostFilters.update(getAllNodeArrays()); const vector<ramNodeArray>& lowPassedNAs = lowPassFilters.update(NAs); ramBeginCamera(); for(int i=0; i<lowPassedNAs.size(); i++) { const ramNodeArray &NA = getNodeArray(i); const ramNodeArray &processedNA = lowPassedNAs[i]; glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_DEPTH_TEST); ofPushStyle(); ofNoFill(); const ofColor gcolor = i==0 ? ramColor::RED_LIGHT : i==1 ? ramColor::YELLOW_DEEP : ramColor::BLUE_LIGHT; ofSetColor(gcolor); ramDrawNodes(processedNA); if (draw_line) { ofSetColor(gcolor); ramDrawNodeCorresponds(NA, processedNA); } ofPopStyle(); glPopAttrib(); } ramEndCamera(); } void onPresetGhost(ofEventArgs &e) { speed = 1.5; distance = 240; } void onPresetSlow(ofEventArgs &e) { speed = 8.3; distance = 74.4; } void onPresetNormal(ofEventArgs &e) { speed = 9.4; distance = 150; } void onPresetFast(ofEventArgs &e) { speed = 38.9; distance = 211; } void updateFilters() { for(int i=0; i<ghostFilters.getNumFilters(); i++) { ramGhost &filter = ghostFilters.getFilter(i); filter.setDistance(distance); filter.setSpeed(speed); } } void onValueChanged(ofxUIEventArgs &e) { updateFilters(); } void loadPreset(size_t preset_id=0) { for (int i=0; i<ghostFilters.getNumFilters(); i++) { ghostFilters.getFilter(i).setDistance(150); ghostFilters.getFilter(i).setSpeed(27); } } string getName() const { return "Future"; } };
6d476af2cde86ff9cb19fcb4bed8b02eb7547d68
58158c18390549157070514f34c56e85188327af
/[Codeforces 997C] Sky Full of Stars.cpp
27f0ac248b97b13bbf6a61be32c1d2330159bf71
[]
no_license
TosakaUCW/Solution_Source_Code
8c24e3732570bb813d5d713987a99fea17618e1f
8469cc7a177ed17e013a5fb17482983d8e61911e
refs/heads/master
2021-11-26T21:23:50.423916
2021-11-19T02:34:01
2021-11-19T02:34:01
149,946,420
7
0
null
null
null
null
UTF-8
C++
false
false
1,432
cpp
[Codeforces 997C] Sky Full of Stars.cpp
#include <stdio.h> #include <algorithm> #define int long long int read(int x = 0, int f = 0, char ch = getchar()) { while ('0' > ch or ch > '9') f = ch == '-', ch = getchar(); while ('0' <= ch and ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar(); return f ? -x : x; } const int N = 1e6 + 5; const int P = 998244353; int n, ans, res; int inv[N], fac[N]; int pow(int x, int k, int res = 1) { for (x = (x + P) % P, k = k % (P - 1); k; k >>= 1, x = x * x % P) if (k & 1) res = res * x % P; return res; } int C(int n, int m) { return fac[n] * inv[m] % P * inv[n - m] % P; } signed main() { n = read(), fac[0] = 1; for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % P; inv[n] = pow(fac[n], P - 2); for (int i = n; i; i--) inv[i - 1] = inv[i] * i % P; for (int i = 1; i <= n; i++) { int tmp = C(n, i) * pow(pow(3, i * n), P - 2) % P * (pow(1 - pow(pow(3, n - i), P - 2), n) - 1 + P) % P; if (i & 1) ans = (ans - tmp + P) % P; else ans = (ans + tmp + P) % P; } for (int i = 1; i <= n; i++) { int tmp = C(n, i) * pow(3, n * (n - i) + i) % P; if (i & 1) res = (res - tmp + P) % P; else res = (res + tmp + P) % P; }; ans = (ans * -pow(3, n * n + 1) - 2 * res + P) % P; printf("%lld", (ans + P) % P); return 0; }
15d6749de532fa637029dcb02361e350a563103d
57df95c78857a9a421a60537c78d4ea9154a5e3e
/minigl.cpp
be7ac57fadcabc13c950dbdc881b5252f6fc1243
[]
no_license
anoopjk/OpenGLPipeLine
9b9887ce92eebb635dc876ccf232efa42eb4fb85
27f3a5ca0a3d772d456e4324de3d3bb199042d73
refs/heads/master
2020-06-27T05:01:17.030283
2017-08-09T01:38:13
2017-08-09T01:38:13
97,046,985
0
0
null
null
null
null
UTF-8
C++
false
false
20,647
cpp
minigl.cpp
/** * minigl.cpp * ------------------------------- * Implement miniGL here. * Do not use any additional files */ // #includes of all the necessary libraries #include <iostream> #include <algorithm> #include <vector> #include <stack> #include <cstdio> #include <cstdlib> // including the minigl header file #include "minigl.h" //declaring global variables for matrix row and column size const unsigned int mrow_size = 4; const unsigned int mcol_size = 4; #define PI 3.14159265 //namespace of std using namespace std; /////////////////////////////////////////////////////////// //declarations of global variables MGLpixel pixel_RGB[3]; //declaring the classes required for the operations class mMatrix; class mVertex; class mPixel; int mgl_shape; int mgl_matrix; // class definitions class mMatrix { public: MGLfloat M[4][4]; //////////////////////////////////////////////////////// // matrix constructors mMatrix() { zero_matrix(); initialize_matrix(0, 0, 0); } ///////////////////////////////////////////////////////// mMatrix(MGLfloat X, MGLfloat Y, MGLfloat Z) { zero_matrix(); initialize_matrix(X, Y, Z); } //////////////////////////////////////////// // constructing a zero matrix void zero_matrix() { for (unsigned int i = 0; i < mrow_size; ++i) { for (unsigned int j = 0; j < mcol_size; ++j) { M[i][j] = 0.0; } } } void initialize_matrix(MGLfloat X, MGLfloat Y, MGLfloat Z) { M[3][3] = 1; //w // set the x, y, z coordinate M[0][3] = X; M[1][3] = Y; M[2][3] = Z; } //////////////////////////////////////////////////////// //Assignement operator overloading mMatrix& operator=(const mMatrix& rhs) { if (this != &rhs) { for (unsigned int i = 0; i < mrow_size; ++i) { for (unsigned int j = 0; j < mcol_size; ++j) { M[i][j] = rhs.M[i][j]; } } } return *this; } ///////////////////////////////////////////////////////////// // Currently unused. mglMultMatrix is used instead. //matrix multiplication overloaded* mMatrix operator*(const mMatrix& rhs) { mMatrix result; result.zero_matrix(); for (unsigned int i = 0; i < mrow_size; ++i) { for (unsigned int j = 0; j < mcol_size; ++j) { for (unsigned int k = 0; k < mcol_size; ++k) { result.M[i][j] += M[i][k] * rhs.M[k][j]; } } } return result; } ///////////////////////////////////////////////////////////////////////// // outputting a matrix, overloading << operator friend ostream& operator<<(ostream& out, const mMatrix& matrix) { for (unsigned int i = 0; i < mrow_size; ++i) { for (unsigned int j = 0; j < mcol_size; ++j) { out << matrix.M[i][j] << " "; } out << "\n"; } return out; } /////////////////////////////////////////////////////////////////////////// //setup a scaling matrix void scale_matrix(float X, float Y, float Z) { zero_matrix(); //setting the main diagonal part M[0][0] = X; M[1][1] = Y; M[2][2] = Z; M[3][3] = 1; } //////////////////////////////////////////////////////////////////////////// //translation operation void translate_matrix(MGLfloat X, MGLfloat Y, MGLfloat Z) { zero_matrix(); M[0][0] = 1; M[1][1] = 1; M[2][2] = 1; M[3][3] = 1; // setting the translation part M[0][3] = X; M[1][3] = Y; M[2][3] = Z; } //////////////////////////////////////////////////////////////////////////// }; ///matrix stacks declaration stack<mMatrix> Model_stack; stack<mMatrix> Projection_stack; /////////////////////////////////////////////////////////////// class mPixel { public: int x, y; MGLpixel pixel_color; MGLfloat z; mPixel(int X, int Y, MGLpixel c, MGLfloat Z) { x = X; y = Y; pixel_color = c; z = Z; } }; /////////////////////////////////////// vector<mPixel> frame_buffer; vector<mPixel> z_buffer; //////////////////////////////////////////////////////////////////// //class mVertex class mVertex { public: MGLfloat x, y, z, w; MGLfloat x_image, y_image, z_image, w_image; MGLpixel vertex_color[3]; mVertex() { x = 0; y = 0; z = 0; w = 1; for (unsigned int i = 0; i < 3; ++i) { vertex_color[i] = pixel_RGB[i]; } } mVertex(MGLfloat X, MGLfloat Y, MGLfloat Z, MGLfloat W) { x = X; y = Y; z = Z; w = W; for (unsigned int i = 0; i < 3; ++i) { vertex_color[i] = pixel_RGB[i]; } } //////////////////////////////////////////////// //overloaded assignement operator mVertex& operator=(const mVertex& rhs) { if (this != &rhs) { x = rhs.x; y = rhs.y; z = rhs.z; w = rhs.w; x_image = rhs.x_image; y_image = rhs.y_image; z_image = rhs.z_image; w_image = rhs.w_image; for (unsigned int i = 0; i < 3; ++i) { vertex_color[i] = rhs.vertex_color[i]; } } return *this; } /////////////////////////////////////////////////////// //vector-matrix multiplication (v*M) mVertex operator*(const mMatrix& rhs) { MGLfloat v[4] = { x, y, z, w }; MGLfloat result_vector[4] = { 0,0,0,0 }; for (unsigned int i = 0; i < mrow_size; ++i) { for (unsigned int j = 0; j < mcol_size; ++j) { result_vector[i] += v[j] * rhs.M[i][j]; } } mVertex result(result_vector[0], result_vector[1], result_vector[2], result_vector[3]); return result; } void world2screen(MGLsize width, MGLsize height) { MGLfloat xtilde = (x*width) / 2; MGLfloat ytilde = (y*height) / 2; // perspective division x = xtilde / w; y = ytilde / w; z = z / w; w = 1; if (x > width) { x = width; } x_image = x; y_image = y; z_image = z; w_image = w; } //////////////////////////////////////////////// void transform() { mMatrix model = Model_stack.top(); mMatrix project = Projection_stack.top(); mMatrix Mtrans; Mtrans.translate_matrix(1, 1, 1); mVertex V(x, y, z, w); // conversion is in the order , // Modelview -> projection -> translation -> updating //operations represented in vertex*matrix multiplication V = V*model; V = V*project; V = V*Mtrans; x = V.x; y = V.y; z = V.z; w = V.w; } }; ////////////////////////////////////////////// vector< vector<mVertex> > geometry_list; vector<mVertex> vertex_list; //////////////////////////////////////////////////////////////// void set_pixel(int x, int y, MGLpixel c, MGLfloat z) { mPixel P(x, y, c, z); frame_buffer.push_back(P); z_buffer.push_back(P); } ////////////////////////////////////////////////////////// vector<float> BB_cord(const vector<mVertex>& v) { vector<float> result; unsigned int num_vertices = v.size(); float xmin = v[0].x_image; float ymin = v[0].y_image; float xmax = v[0].x_image; float ymax = v[0].y_image; for (unsigned int i = 1; i < num_vertices; ++i) { if (v[i].x_image < xmin) xmin = v[i].x_image; if (v[i].y_image < ymin) ymin = v[i].y_image; if (v[i].x_image > xmax) xmax = v[i].x_image; if (v[i].y_image > ymax) ymax = v[i].y_image; } result.push_back(xmin); result.push_back(ymin); result.push_back(xmax); result.push_back(ymax); return result; } /////////////////////////////////////////////////// void world2screen_list(MGLsize width, MGLsize height, vector<mVertex>& vl) { for (unsigned int i = 0; i < vl.size(); ++i) { vl[i].world2screen(width, height); } } /////////////////////////////////////////////////// //line equation float line(float x, float y,float x0, float y0, float x1,float y1) { float A = y0 - y1; float B = x1 - x0; float C = (x0*y1) - (x1*y0); //cout << "line" << A*x + B*y + C << endl; return A*x + B*y + C; } /////////////////////////////////////////// //gouraud shading MGLpixel gouraud(float alpha, float beta, float gamma, const MGLpixel* c0, const MGLpixel* c1, const MGLpixel* c2) { MGLfloat cr = alpha*c0[0] + beta*c1[0] + gamma*c2[0]; MGLfloat cg = alpha*c0[1] + beta*c1[1] + gamma*c2[1]; MGLfloat cb = alpha*c0[2] + beta*c1[2] + gamma*c2[2]; MGLpixel result = 0; MGL_SET_RED(result, (MGLpixel)cr); MGL_SET_GREEN(result, (MGLpixel)cg); MGL_SET_BLUE(result, (MGLpixel)cb); return result; } //Drawing a triangle based on barycentric coordinates void draw_triangle(float x, float y, const mVertex& a, const mVertex& b, const mVertex& c) { float xa = a.x_image; float ya = a.y_image; float xb = b.x_image; float yb = b.y_image; float xc = c.x_image; float yc = c.y_image; float alpha = line(x, y, xb, yb, xc, yc) / line(xa, ya, xb, yb, xc, yc); float beta = line(x, y, xc, yc, xa, ya) / line(xb, yb, xc, yc, xa , ya); float gamma = line(x, y, xa, ya, xb, yb) / line(xc, yc, xa, ya, xb, yb); if ((alpha >= 0 && alpha < 1) && (beta >= 0 && beta < 1) && (gamma >= 0 && gamma < 1)) { MGLpixel color = gouraud(alpha, beta, gamma, a.vertex_color, b.vertex_color, c.vertex_color); MGLfloat Z = alpha*a.z_image + beta*b.z_image + gamma*c.z_image; set_pixel((int)x, (int)y, color, Z); } } ////////////////////////////////////////////////////// void rasterize_triangle(MGLsize width, MGLsize height, const vector<mVertex>& v) { vector<float> BBox = BB_cord(v); float xmin = BBox.at(0); float ymin = BBox.at(1); float xmax = BBox.at(2); float ymax = BBox.at(3); cout << "bbox" << xmax << ' ' << ymax << endl; for (float x = xmin; x <= xmax; ++x) { for (float y = ymin; y <= ymax; ++y) { draw_triangle(x, y, v.at(0), v.at(1), v.at(2)); } } } ////////////////////////////////////////////////////////// void rasterize_quad(MGLsize width, MGLsize height, const vector<mVertex>& v) { vector<float> BBox = BB_cord(v); float xmin = BBox.at(0); float ymin = BBox.at(1); float xmax = BBox.at(2); float ymax = BBox.at(3); for (float x = xmin; x <= xmax; ++x) { for (float y = ymin; y <= ymax; ++y) { draw_triangle(x, y, v.at(0), v.at(1), v.at(2)); draw_triangle(x, y, v.at(0), v.at(2), v.at(3)); } } } /** * Standard macro to report errors */ inline void MGL_ERROR(const char* description) { printf("%s\n", description); exit(1); } bool z_sort(mPixel a, mPixel b) { return a.z > b.z; //check condition for sorting the pixels based on z } /** * Read pixel data starting with the pixel at coordinates * (0, 0), up to (width, height), into the array * pointed to by data. The boundaries are lower-inclusive, * that is, a call with width = height = 1 would just read * the pixel at (0, 0). * * Rasterization and z-buffering should be performed when * this function is called, so that the data array is filled * with the actual pixel values that should be displayed on * the two-dimensional screen. */ void mglReadPixels(MGLsize width, MGLsize height, MGLpixel *data) { for (unsigned int i = 0; i < geometry_list.size(); ++i) { world2screen_list(width, height, geometry_list.at(i)); MGLsize vertex_count = geometry_list.at(i).size(); if (vertex_count == 3) { rasterize_triangle(width, height, geometry_list.at(i)); } else if (vertex_count == 4) { rasterize_quad(width, height, geometry_list.at(i)); } } //sort function http://www.cplusplus.com/reference/algorithm/sort/ sort(z_buffer.begin(), z_buffer.end(), z_sort);//sorting based on the z element of each pixel for (unsigned int i = 0; i < z_buffer.size(); ++i) { int x = z_buffer.at(i).x; int y = z_buffer.at(i).y; MGLpixel color = z_buffer.at(i).pixel_color; data[y*width + x] = color; // all the pixel coordinates are represented by this data array } geometry_list.clear(); } /** * Start specifying the vertices for a group of primitives, * whose type is specified by the given mode. */ void mglBegin(MGLpoly_mode mode) { if (mode == MGL_TRIANGLES || mode == MGL_QUADS) mgl_shape = mode; else mgl_shape = -1; } /** * Stop specifying the vertices for a group of primitives. */ void mglEnd() { if (!vertex_list.empty()) { geometry_list.push_back(vertex_list); vertex_list.clear(); } } /** * Specify a two-dimensional vertex; the x- and y-coordinates * are explicitly specified, while the z-coordinate is assumed * to be zero. Must appear between calls to mglBegin() and * mglEnd(). */ void mglVertex2(MGLfloat x, MGLfloat y) { if (mgl_shape == -1) { MGL_ERROR("Error: Missing mglBegin! Aborting mission.\n"); exit(1); } if (mgl_shape == MGL_TRIANGLES && vertex_list.size() == 3) { geometry_list.push_back(vertex_list); vertex_list.clear(); } if (mgl_shape == MGL_QUADS && vertex_list.size() == 4) { geometry_list.push_back(vertex_list); vertex_list.clear(); } mVertex v(x, y, 0, 1); v.transform(); vertex_list.push_back(v); } /** * Specify a three-dimensional vertex. Must appear between * calls to mglBegin() and mglEnd(). */ void mglVertex3(MGLfloat x, MGLfloat y, MGLfloat z) { if (mgl_shape == -1) { MGL_ERROR("Error: Missing mglBegin! Aborting mission.\n"); exit(1); } if (mgl_shape == MGL_TRIANGLES && vertex_list.size() == 3) { geometry_list.push_back(vertex_list); vertex_list.clear(); } if (mgl_shape == MGL_QUADS && vertex_list.size() == 4) { geometry_list.push_back(vertex_list); vertex_list.clear(); } mVertex v(x, y, z, 1); v.transform(); vertex_list.push_back(v); } /** * Set the current matrix mode (modelview or projection). */ void mglMatrixMode(MGLmatrix_mode mode) { if (mode == MGL_MODELVIEW || mode == MGL_PROJECTION) mgl_matrix = mode; else mgl_matrix = -1; } /** * Push a copy of the current matrix onto the stack for the * current matrix mode. */ void mglPushMatrix() { if (mgl_matrix == MGL_MODELVIEW && !Model_stack.empty()) Model_stack.push(Model_stack.top()); else if (mgl_matrix == MGL_PROJECTION && !Projection_stack.empty()) Projection_stack.push(Projection_stack.top()); } /** * Pop the top matrix from the stack for the current matrix * mode. */ void mglPopMatrix() { if (mgl_matrix == MGL_MODELVIEW && !Model_stack.empty()) { if (!Model_stack.empty()) Model_stack.pop(); } else if (mgl_matrix == MGL_PROJECTION && !Projection_stack.empty()) { if (!Projection_stack.empty()) Projection_stack.pop(); } } /** * Replace the current matrix with the identity. */ void mglLoadIdentity() { mMatrix Identity; Identity.zero_matrix(); //cout << Identity.M; Identity.M[0][0] = 1; Identity.M[1][1] = 1; Identity.M[2][2] = 1; Identity.M[3][3] = 1; //cout << Identity; if (mgl_matrix == MGL_PROJECTION) { if (!Projection_stack.empty()) { Projection_stack.pop(); } Projection_stack.push(Identity); } else if (mgl_matrix == MGL_MODELVIEW) { if (!Model_stack.empty()) { Model_stack.pop(); } Model_stack.push(Identity); } } /** * Replace the current matrix with an arbitrary 4x4 matrix, * specified in column-major order. That is, the matrix * is stored as: * * ( a0 a4 a8 a12 ) * ( a1 a5 a9 a13 ) * ( a2 a6 a10 a14 ) * ( a3 a7 a11 a15 ) * * where ai is the i'th entry of the array. */ void mglLoadMatrix(const MGLfloat *matrix) { mMatrix m; for (MGLsize k = 0; k < 16; ++k) { for (MGLsize i = 0; i < mrow_size; ++i) { for (MGLsize j = 0; j < mcol_size; ++j) { m.M[i][j] = matrix[k]; } } } if (mgl_matrix == MGL_MODELVIEW && !Model_stack.empty()) Model_stack.push(m); else if (mgl_matrix == MGL_PROJECTION && !Projection_stack.empty()) Projection_stack.push(m); } /** * Multiply the current matrix by an arbitrary 4x4 matrix, * specified in column-major order. That is, the matrix * is stored as: * * ( a0 a4 a8 a12 ) * ( a1 a5 a9 a13 ) * ( a2 a6 a10 a14 ) * ( a3 a7 a11 a15 ) * * where ai is the i'th entry of the array. */ void mglMultMatrix(const MGLfloat *matrix) { mMatrix m; for (MGLsize k = 0; k < 16; ++k) { for (MGLsize i = 0; i < mrow_size; ++i) { for (MGLsize j = 0; j < mcol_size; ++j) { m.M[i][j] = matrix[k]; } } } if (mgl_matrix == MGL_MODELVIEW && !Model_stack.empty()) Model_stack.top() = Model_stack.top()*m; else if (mgl_matrix == MGL_PROJECTION && !Projection_stack.empty()) Projection_stack.top() = Projection_stack.top()*m; } /** * Multiply the current matrix by the translation matrix * for the translation vector given by (x, y, z). */ void mglTranslate(MGLfloat x, MGLfloat y, MGLfloat z) { mMatrix Mtrans; Mtrans.translate_matrix(x, y, z); if (mgl_matrix == MGL_PROJECTION){ Projection_stack.top() = Projection_stack.top()*Mtrans; } else if (mgl_matrix == MGL_MODELVIEW){ Model_stack.top() = Model_stack.top()*Mtrans; } } /** * Multiply the current matrix by the rotation matrix * for a rotation of (angle) degrees about the vector * from the origin to the point (x, y, z). */ //the equations are given in the following link //reference https://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml void mglRotate(MGLfloat angle, MGLfloat x, MGLfloat y, MGLfloat z) { MGLfloat s = sin(angle * PI / 180);//converting into radians MGLfloat c = cos(angle * PI / 180); MGLfloat magnitude = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)); if (magnitude != 0) { x = x / magnitude; y = y / magnitude; z = z / magnitude; } mMatrix R(0, 0, 0); R.M[0][0] = x*x * (1 - c) + c; R.M[0][1] = x*y * (1 - c) - z*s; R.M[0][2] = x*z * (1 - c) + y*s; R.M[1][0] = y*x * (1 - c) + z*s; R.M[1][1] = y*y * (1 - c) + c; R.M[1][2] = y*z * (1 - c) - x*s; R.M[2][0] = x*z * (1 - c) - y*s; R.M[2][1] = y*z * (1 - c) + x*s; R.M[2][2] = z*z * (1 - c) + c; if (mgl_matrix == MGL_PROJECTION) Projection_stack.top() = Projection_stack.top()*R; else if (mgl_matrix == MGL_MODELVIEW) Model_stack.top() = Model_stack.top()*R; } /** * Multiply the current matrix by the scale matrix * for the given scale factors. */ void mglScale(MGLfloat x, MGLfloat y, MGLfloat z) { mMatrix Mscale; Mscale.scale_matrix(x, y, z); if (mgl_matrix == MGL_PROJECTION) Projection_stack.top() = Projection_stack.top()*Mscale; else if (mgl_matrix == MGL_MODELVIEW) Model_stack.top() = Model_stack.top()*Mscale; } /** * Multiply the current matrix by the perspective matrix * with the given clipping plane coordinates. */ //http://www.songho.ca/opengl/gl_transform.html void mglFrustum(MGLfloat left, MGLfloat right, MGLfloat bottom, MGLfloat top, MGLfloat near, MGLfloat far) { mMatrix Mfrustum; Mfrustum.M[0][0] = (2 * near) / (right - left); Mfrustum.M[1][1] = (2 * near) / (top - bottom); Mfrustum.M[0][2] = (right + left)/(right-left); Mfrustum.M[1][2] = (top + bottom) / (top - bottom); Mfrustum.M[2][2] = -(far + near) / (far - near); Mfrustum.M[2][3] = -(2 * far*near) / (far - near); Mfrustum.M[3][2] = -1; Mfrustum.M[3][3] = 0; if (mgl_matrix == MGL_PROJECTION) Projection_stack.top() = Projection_stack.top()*Mfrustum; else if (mgl_matrix == MGL_MODELVIEW) Model_stack.top() = Model_stack.top()*Mfrustum; } /** * Multiply the current matrix by the orthographic matrix * with the given clipping plane coordinates. *///http://www.songho.ca/opengl/gl_transform.html void mglOrtho(MGLfloat left, MGLfloat right, MGLfloat bottom, MGLfloat top, MGLfloat near, MGLfloat far) { mMatrix Mortho; Mortho.M[0][0] = 2 / (right - left); Mortho.M[0][3] = -(right + left) / (right - left); Mortho.M[1][1] = 2 / (top - bottom); Mortho.M[1][3] = -(top + bottom) / (top - bottom); Mortho.M[2][2] = -2 / (far - near); Mortho.M[0][3] = -(right + left) / (right - left); Mortho.M[2][3] = -(far + near) / (far - near); if (mgl_matrix == MGL_PROJECTION) Projection_stack.top() = Projection_stack.top()*Mortho; else if (mgl_matrix == MGL_MODELVIEW) Model_stack.top() = Model_stack.top()*Mortho; } /** * Set the current color for drawn shapes. */ void mglColor(MGLbyte red, MGLbyte green, MGLbyte blue) { //I am assigning this colours in the class mVertex pixel_RGB[0] = red; pixel_RGB[1] = green; pixel_RGB[2] = blue; }
24400a7c1ab4e17259d41879475c7948ac75a872
464b8d5c5cc9b459f68cd0f443bd69cff110303a
/src/os_x/read_benchmark.cpp
1a6549d271bd09080d3567186e55df61ae2637ea
[ "CC-BY-4.0" ]
permissive
lukaspustina/io_benchmark
62958d1191656378613b09db2e6761dadfae35be
2581a2b738b275821892547e41ce544dffe265ce
refs/heads/master
2020-06-27T07:04:21.545795
2019-08-04T07:51:21
2019-08-04T07:51:43
199,878,851
0
0
null
2019-07-31T15:05:34
2019-07-31T15:05:33
null
UTF-8
C++
false
false
6,091
cpp
read_benchmark.cpp
/* ** File Name: read_benchmark.cpp ** Author: Aditya Ramesh ** Date: 06/03/2014 ** Contact: _@adityaramesh.com ** ** This is a simple benchmark that compares various methods for sequentially ** reading a file. */ #include <algorithm> #include <cassert> #include <cstdlib> #include <cstdint> #include <functional> #include <memory> #include <ccbase/format.hpp> #include <read_common.hpp> #include <test.hpp> static auto read_nocache(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf = allocate_aligned(4096, buf_size); disable_cache(fd); auto count = read_loop(fd, buf.get(), buf_size); ::close(fd); return count; } static auto read_rdahead(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdahead(fd); auto count = read_loop(fd, buf.get(), buf_size); ::close(fd); return count; } static auto read_rdadvise(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); auto buf = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdadvise(fd, fs); auto count = read_loop(fd, buf.get(), buf_size); ::close(fd); return count; } static auto read_aio_nocache(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf1 = allocate_aligned(4096, buf_size); auto buf2 = allocate_aligned(4096, buf_size); disable_cache(fd); auto count = aio_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_aio_rdahead(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf1 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); auto buf2 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdahead(fd); auto count = aio_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_aio_rdadvise(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); auto buf1 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); auto buf2 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdadvise(fd, fs); auto count = aio_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_async_nocache(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf1 = allocate_aligned(4096, buf_size); auto buf2 = allocate_aligned(4096, buf_size); disable_cache(fd); auto count = async_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_async_rdahead(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto buf1 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); auto buf2 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdahead(fd); auto count = async_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_async_rdadvise(const char* path, size_t buf_size) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); auto buf1 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); auto buf2 = std::unique_ptr<uint8_t[]>(new uint8_t[buf_size]); enable_rdadvise(fd, fs); auto count = async_read_loop(fd, buf1.get(), buf2.get(), buf_size); ::close(fd); return count; } static auto read_mmap_nocache(const char* path) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); disable_cache(fd); auto p = (uint8_t*)::mmap(nullptr, fs, PROT_READ, MAP_SHARED, fd, 0); auto count = std::count_if(p, p + fs, [](auto x) { return x == needle; }); ::munmap(p, fs); return count; } static auto read_mmap_rdahead(const char* path) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); enable_rdahead(fd); auto p = (uint8_t*)::mmap(nullptr, fs, PROT_READ, MAP_SHARED, fd, 0); auto count = std::count_if(p, p + fs, [](auto x) { return x == needle; }); ::munmap(p, fs); return count; } static auto read_mmap_rdadvise(const char* path) { auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); enable_rdadvise(fd, fs); auto p = (uint8_t*)::mmap(nullptr, fs, PROT_READ, MAP_SHARED, fd, 0); auto count = std::count_if(p, p + fs, [](auto x) { return x == needle; }); ::munmap(p, fs); return count; } int main(int argc, char** argv) { if (argc < 2) { cc::errln("Error: too few arguments."); return EXIT_FAILURE; } else if (argc > 2) { cc::errln("Error: too many arguments."); return EXIT_FAILURE; } auto path = argv[1]; auto fd = safe_open(path, O_RDONLY).get(); auto fs = file_size(fd).get(); safe_close(fd).get(); auto count = check(path); auto sizes = {4, 8, 12, 16, 24, 32, 40, 48, 56, 64, 256, 1024, 4096, 16384, 65536, 262144}; purge_cache().get(); std::printf("%s, %s, %s, %s\n", "File Size", "Method", "Mean (ms)", "Stddev (ms)"); std::fflush(stdout); test_read_range(read_plain, path, "read_plain", sizes, fs, count); test_read_range(read_nocache, path, "read_nocache", sizes, fs, count); test_read_range(read_rdahead, path, "read_rdahead", sizes, fs, count); test_read_range(read_rdadvise, path, "read_rdadvise", sizes, fs, count); //test_read_range(read_aio_nocache, path, "read_aio_nocache", sizes, fs, count); //test_read_range(read_aio_rdahead, path, "read_aio_rdahead", sizes, fs, count); //test_read_range(read_aio_rdadvise, path, "read_aio_rdadvise", sizes, fs, count); test_read_range(read_async_nocache, path, "read_async_nocache", sizes, fs, count); test_read_range(read_async_rdahead, path, "read_async_rdahead", sizes, fs, count); test_read_range(read_async_rdadvise, path, "read_async_rdadvise", sizes, fs, count); test_read(std::bind(read_mmap_plain, path), "mmap_plain", count, fs); test_read(std::bind(read_mmap_nocache, path), "mmap_nocache", count, fs); test_read(std::bind(read_mmap_rdahead, path), "mmap_rdahead", count, fs); test_read(std::bind(read_mmap_rdadvise, path), "mmap_rdadvise", count, fs); }
fe58a3f4bd75b33d2e3b6451ba39419ebce2831e
38e2760e5687d7447f006179696b2ac695f9e346
/index.h
94c53b19698dae9fff531c74e8944ed690ac20f1
[ "MIT" ]
permissive
lehoangha/tomo2d_HeriotWatt
c96d735ec9eff3814064f7251b8ac1fe1dab036e
48477115ed2455a8255521570e4e81ffe754be08
refs/heads/master
2021-01-10T08:37:27.282716
2015-10-02T12:31:24
2015-10-02T12:31:24
43,548,323
3
2
null
2015-10-04T08:18:14
2015-10-02T11:01:13
C++
UTF-8
C++
false
false
391
h
index.h
/* * index.h * * Jun Korenaga, MIT/WHOI * January 19999 */ #ifndef _TOMO_INDEX_H_ #define _TOMO_INDEX_H_ class Index2d { public: Index2d(){} Index2d(int i1, int i2){ i_[0]=i1; i_[1]=i2; } int i() const { return i_[0]; } int k() const { return i_[1]; } void set(int i1, int i2) { i_[0]=i1; i_[1]=i2; } private: int i_[2]; }; #endif /* _TOMO_INDEX_H_ */
0666991471147f084b4998fd44d734f6b4a4f86a
8450b112624cb33e8062e307f04cb66df0634606
/common_knowledge/references/test4.cpp
93f5a98ac4d103e9801756a4942bba861e1f9b5d
[]
no_license
pcbhanjdeo/codeprac
870a86aca3494b7437f8fd9174ee0e780d0b0267
13989ca49dfce43062682680a7faa2ebccee150e
refs/heads/master
2021-01-22T09:58:03.497583
2015-11-07T18:40:29
2015-11-07T18:40:29
15,540,827
0
0
null
null
null
null
UTF-8
C++
false
false
202
cpp
test4.cpp
#include <iostream> using namespace std; int f(const int& a) { cout <<"inside function f val of a = " << a << endl; return a; } int main() { cout <<"enter main" << endl; f(10); return 0; }
f983acd4d49fb961da4f63deb55f2253e3bebb32
2d5b147e9fce070bc2a21a22a6b71c8b3a7cde30
/gotocomm.h
6fe2c1971cb2ca8d1fb13a6d82bb6c412222cf84
[]
no_license
AnthonyGOAT/Interactive-Fiction-Interpreter
90ad49a014c169fce9cd35b4675e941c4cafa4e8
0fed4e44c4f8d4114661b76b5222b2ebe06bc786
refs/heads/master
2020-07-19T14:56:03.438336
2019-09-05T03:56:52
2019-09-05T03:56:52
206,468,162
0
0
null
null
null
null
UTF-8
C++
false
false
350
h
gotocomm.h
#ifndef __GOTOCOMM_H__ #define __GOTOCOMM_H__ #include <string> #include <iostream> #include <sstream> #include "part.h" class GoToComm : public Part{ private: string target; public: GoToComm(PartToken& in); virtual void print(); virtual string getTarget() const {return target;} }; #endif
6403afcf28083123fb44a87541439ba56746d8b3
b8f2cf6a2e6bd435455091e517cbe38616927473
/WhileIf.h
812c84f2cdb139d37695d5e58758818f751390e6
[]
no_license
wszeborowskimateusz/ScriptLanguage
2706325e055a01d1142a16f0e43f215966f0eeb8
49477cc3d8bb648d354338814ce6203218c231c9
refs/heads/master
2021-04-30T03:48:02.264912
2018-02-14T14:53:42
2018-02-14T14:53:42
121,522,550
0
0
null
null
null
null
UTF-8
C++
false
false
382
h
WhileIf.h
#pragma once #define MAX_SIZE 300 #include "KodWhileIf.h" #include "Int.h" class WhileIf { public: char*warunek; KodWhileIf* first; KodWhileIf* last; char* getWarunek() { return warunek; } void setWarunek(char* war); void addWhile(); void addIf(); void addIns(char * instrukcja, Int** zmienne, int &ile_zmiennych); WhileIf(); ~WhileIf(); };
55032ff12f227463a9b886c66a1ce94712207a02
2ae0b8d95d439ccfd55ea7933ad4a2994ad0f6c5
/src/plugins/intel_gpu/src/graph/include/strided_slice_inst.h
d51f7a3c783eb77235f9adba6a343126c6be6aa3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
openvinotoolkit/openvino
38ea745a247887a4e14580dbc9fc68005e2149f9
e4bed7a31c9f00d8afbfcabee3f64f55496ae56a
refs/heads/master
2023-08-18T03:47:44.572979
2023-08-17T21:24:59
2023-08-17T21:24:59
153,097,643
3,953
1,492
Apache-2.0
2023-09-14T21:42:24
2018-10-15T10:54:40
C++
UTF-8
C++
false
false
1,523
h
strided_slice_inst.h
// Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include "intel_gpu/primitives/strided_slice.hpp" #include "primitive_inst.h" #include <string> #include <vector> namespace cldnn { template <> struct typed_program_node<strided_slice> : public typed_program_node_base<strided_slice> { using parent = typed_program_node_base<strided_slice>; typed_program_node(const std::shared_ptr<strided_slice> prim, program& prog) : parent(prim, prog) { support_padding_all(true); } public: using parent::parent; program_node& input(size_t index = 0) const { return get_dependency(index); } std::vector<size_t> get_shape_infer_dependencies() const override { return {1, 2, 3}; } }; using strided_slice_node = typed_program_node<strided_slice>; template <> class typed_primitive_inst<strided_slice> : public typed_primitive_inst_base<strided_slice> { using parent = typed_primitive_inst_base<strided_slice>; using parent::parent; public: template<typename ShapeType> static std::vector<layout> calc_output_layouts(strided_slice_node const& /*node*/, const kernel_impl_params& impl_param); static layout calc_output_layout(strided_slice_node const& node, kernel_impl_params const& impl_param); static std::string to_string(strided_slice_node const& node); typed_primitive_inst(network& network, strided_slice_node const& desc); }; using strided_slice_inst = typed_primitive_inst<strided_slice>; } // namespace cldnn
0219c28df67d185927a87b14ce9dbdff3220afba
4f4b084a889207c4b38817b8b3a36e9c4b1d9739
/Source/InventorySystem/Private/Inventory/Actors/PreviewActor.cpp
ef74ddc8931c8a31cf694c58170244d0f2b58d5e
[ "MIT" ]
permissive
phalasz/Threshold
adfa4bd582e55a7609056e1bc5ce2d81cb18f779
b0178e322548ca7cbe31cbf26943df3d4c616c8a
refs/heads/master
2023-01-13T22:24:11.338463
2020-11-17T21:00:23
2020-11-17T21:00:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
451
cpp
PreviewActor.cpp
// Copyright (c) 2020 Spencer Melnick #include "Inventory/Actors/PreviewActor.h" // APreviewActor // Component name constants FName APreviewActor::OriginComponentName(TEXT("RootComponent")); // Default constructor APreviewActor::APreviewActor() { // Create an empty scene component to serve as a center point OriginSceneComponent = CreateDefaultSubobject<USceneComponent>(OriginComponentName); RootComponent = OriginSceneComponent; }
12b01834b08a7286407a26faa6e0bb67bd613cbb
85aed0bcac5d6aea781dff64029c2d23fcba984b
/RanClientUILib/Interface/VideoOption.h
d885603cbba9d26396dbd66e18795f99fa6fc482
[]
no_license
youdontknowme17/ura
3c76bf05eccd38b454b389841f1db49b59217e46
e31bc9fd9c2312175d250dc4dc1f9c656c7f2004
refs/heads/master
2020-03-28T15:49:00.379682
2018-09-15T09:57:49
2018-09-15T09:57:49
148,628,762
0
2
null
null
null
null
UTF-8
C++
false
false
4,152
h
VideoOption.h
#pragma once #include "../EngineUILib/GUInterface/UIGroup.h" class CBasicTextBox; class CBasicButton; class CD3DFontPar; class CBasicComboBox; class CBasicComboBoxRollOver; enum EMSCREEN_FORMAT; #define DEFAULT_OPTION_SIZE 4 #define DEFAULT_ZOOM_SIZE 3 class CBasicVideoOption : public CUIGroup { static const char cRESOLUTION_SEPERATOR; protected: enum { HWOPTION_VIDEO_DEFAULT_COMBO_OPEN = NO_ID + 1, HWOPTION_VIDEO_DEFAULT_COMBO_ROLLOVER, HWOPTION_VIDEO_RESOLUTION_COMBO_OPEN, HWOPTION_VIDEO_RESOLUTION_COMBO_ROLLOVER, HWOPTION_VIDEO_SHADOW_COMBO_OPEN, HWOPTION_VIDEO_SHADOW_COMBO_ROLLOVER, HWOPTION_VIDEO_DETAIL_COMBO_OPEN, HWOPTION_VIDEO_CHARDETAIL_COMBO_ROLLOVER, HWOPTION_VIDEO_SIGHT_COMBO_OPEN, HWOPTION_VIDEO_SIGHT_COMBO_ROLLOVER, HWOPTION_VIDEO_BUFF_BUTTON, HWOPTION_VIDEO_SHADOWLAND_BUTTON, HWOPTION_VIDEO_REFLECT_BUTTON, HWOPTION_VIDEO_REFRACT_BUTTON, HWOPTION_VIDEO_GLOW_BUTTON, HWOPTION_VIDEO_POSTPROCESSING_BUTTON, HWOPTION_VIDEO_FRAME_LIMIT_BUTTON, HWOPTION_VIDEO_CLICK_EFFECT_BUTTON, HWOPTION_VIDEO_TARGET_EFEFCT_BUTTON, HWOPTION_VIDEO_ITEMDROP_EFFECT_BUTTON, HWOPTION_VIDEO_MAX_GAMEZOOM_COMBO_ROLLOVER, HWOPTION_VIDEO_MAX_GAMEZOOM_COMBO_OPEN }; public: CBasicVideoOption (); virtual ~CBasicVideoOption (); public: void CreateSubControl (); private: CBasicButton* CreateFlipButton ( char* szButton, char* szButtonFlip, UIGUID ControlID ); CBasicTextBox* CreateStaticControl ( char* szControlKeyword, CD3DFontPar* pFont, D3DCOLOR D3DCOLOR, int nAlign ); public: virtual void Update ( int x, int y, BYTE LB, BYTE MB, BYTE RB, int nScroll, float fElapsedTime, BOOL bFirstControl ); virtual void TranslateUIMessage ( UIGUID ControlID, DWORD dwMsg ); virtual void SetVisibleSingle ( BOOL bVisible ); private: void LoadComboData (); void SetTextSightCombo( DWORD dwIndex ); void SetTextSkinDetailCombo( DWORD dwIndex ); void SetTextShadowCharCombo( DWORD dwIndex ); void SetTextResolutionCombo( DWORD dwWidth, DWORD dwHeight, EMSCREEN_FORMAT emFormat); void SetTextDefaultOptionCombo( DWORD dwIndex ); void SetTextGameZoomCombo( DWORD dwIndex ); public: void LoadCurrentOption (); private: void LoadResolution (); void LoadShadow (); void LoadSkinDetail (); void LoadSight (); void LoadBuffButton(); void LoadShadowlandButton (); void LoadReflectButton (); void LoadRefractButton (); void LoadGlowButton (); void LoadPostButton (); void LoadFrameLimitButton (); void LoadDefaultOption(); void LoadGameZoom(); void LoadClickEffectButton(); void LoadTarGetEffectButton(); void LoadItemDropEffectButton(); void SetVideoLevel(int nIndex ); void SetLowLevel(); void SetMediumLevel(); void SetHighLevel(); private: CD3DFontPar* m_pFont; private: CBasicButton* m_pBuffButton; CBasicButton* m_pShadowlandButton; CBasicButton* m_pReflectButton; CBasicButton* m_pRefractButton; CBasicButton* m_pGlowButton; CBasicButton* m_pPostButton; CBasicButton* m_pFrameLimitButton; CBasicButton* m_pClickEffectButton; CBasicButton* m_pTargetEffectButton; CBasicButton* m_pItemDropEffectButton; private: CBasicComboBox* m_pComboBoxResolutionOpen; CBasicComboBoxRollOver* m_pComboBoxResolutionRollOver; CBasicComboBox* m_pComboBoxShadowOpen; CBasicComboBoxRollOver* m_pComboBoxShadowRollOver; CBasicComboBox* m_pComboBoxCharDetailOpen; CBasicComboBoxRollOver* m_pComboBoxCharDetailRollOver; CBasicComboBox* m_pComboBoxSightOpen; CBasicComboBoxRollOver* m_pComboBoxSightRollOver; CBasicComboBox* m_pComboBoxDefaultOpen; CBasicComboBoxRollOver* m_pComboBoxDefaultRollOver; CBasicComboBox* m_pComboBoxGameZoomOpen; CBasicComboBoxRollOver* m_pComboBoxGameZoomRollOver; private: UIGUID m_RollOverID; BOOL m_bFirstLBUP; public: BOOL m_bBuff; BOOL m_bShadowLand; BOOL m_bRealReflect; BOOL m_bRefract; BOOL m_bGlow; BOOL m_bPost; BOOL m_bFrameLimit; BOOL m_bClickEffect; BOOL m_bTargetEffect; BOOL m_bMineEffect; DWORD m_dwSight; DWORD m_dwSkinDetail; DWORD m_dwShadowChar; DWORD m_dwVideoLevel; DWORD m_dwScreenZoom; DWORD m_dwScrHeight; DWORD m_dwScrWidth; EMSCREEN_FORMAT m_emScrFormat; };
8994fedabc1fc22b136f51584855bb4222fe1857
ccb3b042a3ea1cb921a8c320e335146aeed0a272
/stdafx.cpp
59b5291aeb4da9ff038fcde934d9036ba69df53d
[]
no_license
thilovonbraun/bird
7db96560631a2ea9f468a61e3695c229b1bec810
f1d04a6ed9244ca4c153646eb02c964c693e85b9
refs/heads/master
2020-05-18T01:24:24.820365
2012-08-17T21:06:16
2012-08-17T21:06:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
484
cpp
stdafx.cpp
// Copyright (c) 2012 Thilo von Braun // Distributed under the EUPL v1.1 software license, see the accompanying // file license.txt or http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 // stdafx.cpp : source file that includes just the standard includes // BiRD.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
75d7a2956e0184bf8f380cc4bedd9f5380113708
4e530e2a28cd0f0d30b488f66997f300b053e3dc
/OperatorOverloading/Room.h
db84b6c4270acc792374f4ad013df559d2515d15
[]
no_license
sodell72/OperatorOverloading
8a62cd855776cde2f6777376973c23dd217bbc22
4f93462429d6e55b864e1af164aab2b5b914a599
refs/heads/master
2020-04-20T17:25:32.511064
2019-02-03T20:07:13
2019-02-03T20:07:13
168,988,079
0
0
null
null
null
null
UTF-8
C++
false
false
391
h
Room.h
#pragma once #include<string> class Room { private: std::string name; double cost; static int unNamedRooms; static const int minCost = 1000; public: Room(); Room(std::string, double = 0); ~Room(); std::string getName(); double getCost(); Room operator+(const Room &rm) const; Room operator+=(const Room &rm); bool operator==(const Room &rm) const; Room operator--(int); };
b6fcc23e3204d3f6aa03d4269b9cf96cf7d46c00
c5ca8f817997f2933d20bbcd4cfb016933bc9dad
/ext/MitsubaLoader/CMitsubaPipelineMetadata.h
518706fe9f1789af1977d3e4c32040d78df441b7
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
VisarBuza/Nabla
0a873a5bd79f2e496ae7496afdd1203f44233f6c
881deedeac39b6141d061756fa9b00951fb57f28
refs/heads/master
2022-12-25T02:57:47.612218
2020-10-07T18:54:15
2020-10-07T18:54:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,488
h
CMitsubaPipelineMetadata.h
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O. // This file is part of the "Nabla Engine". // For conditions of distribution and use, see copyright notice in nabla.h #ifndef __IRR_C_MITSUBA_PIPELINE_METADATA_H_INCLUDED__ #define __IRR_C_MITSUBA_PIPELINE_METADATA_H_INCLUDED__ #include "irr/core/IReferenceCounted.h" #include "irr/core/memory/refctd_dynamic_array.h" #include "irr/asset/ICPUDescriptorSet.h" #include "irr/asset/IPipelineMetadata.h" namespace irr { namespace ext { namespace MitsubaLoader { //TODO make it inherit from IMitsubaMetadata so that it has global mitsuba metadata ptr class CMitsubaPipelineMetadata final : public asset::IPipelineMetadata { public: CMitsubaPipelineMetadata(core::smart_refctd_ptr<asset::ICPUDescriptorSet>&& _ds0, core::smart_refctd_dynamic_array<ShaderInputSemantic>&& _inputs) : m_ds0(std::move(_ds0)), m_shaderInputs(std::move(_inputs)) { } core::SRange<const ShaderInputSemantic> getCommonRequiredInputs() const override { return {m_shaderInputs->begin(), m_shaderInputs->end()}; } asset::ICPUDescriptorSet* getDescriptorSet() const { return m_ds0.get(); } _IRR_STATIC_INLINE_CONSTEXPR const char* LoaderName = "CMitsubaLoader"; const char* getLoaderName() const override { return LoaderName; } private: core::smart_refctd_ptr<asset::ICPUDescriptorSet> m_ds0; core::smart_refctd_dynamic_array<ShaderInputSemantic> m_shaderInputs; }; }}} #endif
b2002f72ee90d6526dd28d3c65bce3ba016e8ffe
0128e9ecab5239a135682412e9b41479e1f05f19
/lib/ops/reduce_boxes_only_op.cc
0cc00d814d66f47bc446f7ba87541c34f9c8ea5f
[]
no_license
LuoweiZhou/detectron-vlp
e29dd777c135359dd15af364aecde3b8c6baabe8
aa22e50935b463e52d69bd790b2d8351bc26014e
refs/heads/master
2021-06-23T03:55:36.886160
2020-11-21T04:12:38
2020-11-21T04:12:38
140,052,204
21
5
null
null
null
null
UTF-8
C++
false
false
5,585
cc
reduce_boxes_only_op.cc
#include "reduce_boxes_only_op.h" using std::pair; using std::make_pair; using std::priority_queue; namespace caffe2 { namespace { // to compare two values template <typename T> struct _compare_value { bool operator()( const pair<T, int>& lhs, const pair<T, int>& rhs) { return (lhs.first > rhs.first); } }; int _build_heap(priority_queue<pair<float, int>, vector<pair<float, int>>, _compare_value<float>>* PQ, const float* boxes_pointer, const int num_total, const int top_n) { for (int i=0; i<num_total; i++) { const float prob = boxes_pointer[i * 12 + 4]; if (PQ->size() < top_n || prob > PQ->top().first) { PQ->push(make_pair(prob, i)); } if (PQ->size() > top_n) { PQ->pop(); } } return PQ->size(); } float _assign_level(const float area, const int k_min, const int k_max, const float s0, const float k) { const float s = sqrt(area); float lvl = floor(log2(s / s0 + 1e-6)) + k; lvl = (lvl < k_min) ? k_min : lvl; lvl = (lvl > k_max) ? k_max : lvl; return lvl; } void _zeros(const int size, int* target) { for (int i=0; i<size; i++) { *(target++) = 0; } } } template<> bool ReduceBoxesOnlyOp<float, CPUContext>::RunOnDevice() { auto& boxes = Input(0); const int num_total = boxes.dim32(0); const int num_levels = k_max_ - k_min_ + 1; const float* boxes_pointer = boxes.data<float>(); if (num_total == 0) { Output(0)->Resize(0, 11); Output(1)->Resize(num_levels); Output(0)->mutable_data<float>(); int* output_stats_pointer = Output(1)->mutable_data<int>(); // set the stats to zero _zeros(num_levels, output_stats_pointer); return true; } else if (num_total <= dpi_) { auto* output_boxes = Output(0); output_boxes->Resize(num_total, 11); float* output_boxes_pointer = output_boxes->mutable_data<float>(); auto* output_stats = Output(1); output_stats->Resize(num_levels); int* output_stats_pointer = output_stats->mutable_data<int>(); _zeros(num_levels, output_stats_pointer); // copy directly for (int i=0, j=0, k=0; i<num_total; i++, j+=12, k+=11) { output_boxes_pointer[k] = im_float_; output_boxes_pointer[k+1] = boxes_pointer[j]; output_boxes_pointer[k+2] = boxes_pointer[j+1]; output_boxes_pointer[k+3] = boxes_pointer[j+2]; output_boxes_pointer[k+4] = boxes_pointer[j+3]; const float lvl_assign = _assign_level(boxes_pointer[j+5], k_min_, k_max_, c_scale_f_, c_level_f_); output_boxes_pointer[k+5] = lvl_assign; const int lvl = static_cast<int>(lvl_assign) - k_min_; output_stats_pointer[lvl] ++; output_boxes_pointer[k+6] = boxes_pointer[j+6]; output_boxes_pointer[k+7] = boxes_pointer[j+8]; output_boxes_pointer[k+8] = boxes_pointer[j+9]; output_boxes_pointer[k+9] = boxes_pointer[j+10]; output_boxes_pointer[k+10] = boxes_pointer[j+11]; } return true; } // get scores priority_queue<pair<float, int>, vector<pair<float, int>>, _compare_value<float>> PQ; int num_left = _build_heap(&PQ, boxes_pointer, num_total, dpi_); // final outputs auto* output_boxes = Output(0); output_boxes->Resize(num_left, 11); float* output_boxes_pointer = output_boxes->mutable_data<float>(); auto* output_stats = Output(1); output_stats->Resize(num_levels); int* output_stats_pointer = output_stats->mutable_data<int>(); _zeros(num_levels, output_stats_pointer); for (int i=0, k=0; i<num_left; i++, k+=11) { auto& pqelm = PQ.top(); const int j = (pqelm.second) * 12; output_boxes_pointer[k] = im_float_; output_boxes_pointer[k+1] = boxes_pointer[j]; output_boxes_pointer[k+2] = boxes_pointer[j+1]; output_boxes_pointer[k+3] = boxes_pointer[j+2]; output_boxes_pointer[k+4] = boxes_pointer[j+3]; const float lvl_assign = _assign_level(boxes_pointer[j+5], k_min_, k_max_, c_scale_f_, c_level_f_); output_boxes_pointer[k+5] = lvl_assign; const int lvl = static_cast<int>(lvl_assign) - k_min_; output_stats_pointer[lvl] ++; output_boxes_pointer[k+6] = boxes_pointer[j+6]; output_boxes_pointer[k+7] = boxes_pointer[j+8]; output_boxes_pointer[k+8] = boxes_pointer[j+9]; output_boxes_pointer[k+9] = boxes_pointer[j+10]; output_boxes_pointer[k+10] = boxes_pointer[j+11]; PQ.pop(); } return true; } REGISTER_CPU_OPERATOR(ReduceBoxesOnly, ReduceBoxesOnlyOp<float, CPUContext>); OPERATOR_SCHEMA(ReduceBoxesOnly) .NumInputs(1) .NumOutputs(2) .SetDoc(R"DOC( Reduce the boxes from the same image. )DOC") .Arg( "im", "(int) image index.") .Arg( "dpi", "(int) number of detections per image.") .Input( 0, "boxes_in", "bounding box information of shape (R, 12): x1, y1, x2, y2, score, area, c, im, lvl, a, h, w.") .Output( 0, "rois", "2D tensor of shape (R, 11): im, x1, y1, x2, y2, lvl, c, lvl, a, h, w.") .Output( 1, "stats", "statistics for each level, of shape (num_levels)"); SHOULD_NOT_DO_GRADIENT(ReduceBoxesOnly); } // namespace caffe2
e93e7885bb12538804bb16aa720ce56ef2d0dc07
a4515918f56dd7ab527e4999aa7fce818b6dd6f6
/Data Structures/LinkedLists/linked_list_decimal_equivalent.cpp
a96d20bf4bc93fb21b2f09cbff463aa84c96a45f
[ "MIT" ]
permissive
rathoresrikant/HacktoberFestContribute
0e2d4692a305f079e5aebcd331e8df04b90f90da
e2a69e284b3b1bd0c7c16ea41217cc6c2ec57592
refs/heads/master
2023-06-13T09:22:22.554887
2021-10-27T07:51:41
2021-10-27T07:51:41
151,832,935
102
901
MIT
2023-06-23T06:53:32
2018-10-06T11:23:31
C++
UTF-8
C++
false
false
737
cpp
linked_list_decimal_equivalent.cpp
#include <bits/stdc++.h> using namespace std; struct Node { int data; Node *next; }; void push(Node **head, int new_data) { Node *new_node = new Node; new_node->data = new_data; new_node->next = (*head); (*head) = new_node; } void printList(Node *head) { Node *temp = head; while(temp != NULL) { cout<<temp->data<<" "; temp = temp->next; } } int decimal(Node *head) { int sum = 0; Node *curr = head; while(curr != NULL) { sum = (sum << 1) + curr->data; curr = curr->next; } return sum; } int main() { Node *head = NULL; push(&head,1); push(&head,1); push(&head,1); push(&head,1); printList(head); cout<<decimal(head); return 0; }
d251d54a0cb7151752650456ace26a1985ca5b34
6000873cbd6ba769f87205d03989a09415c04000
/mill/peoplemgr.h
9a6b1463669fb095397c25eae94efbaa4123f35d
[]
no_license
timepp/mill
251657320508dbd5652a24a7b1d2f8630a8d8071
aacabaa92937ce3a2a7b5683920f34e1cb921716
refs/heads/master
2021-01-20T08:49:07.247306
2012-10-22T10:55:56
2012-10-22T10:55:56
5,385,304
1
0
null
null
null
null
GB18030
C++
false
false
1,709
h
peoplemgr.h
#pragma once #include "serviceid.h" #include <tplib/include/service.h> #include <string> #include <vector> #include <map> #include "mill.h" struct People { std::wstring name; std::wstring gender; std::wstring contact; std::wstring pinyin; time_t birthday; std::wstring idnumber; std::wstring address; std::wstring comment; }; struct Prescription /// 处方 { struct MedicineItem { std::wstring name; double dosage; }; std::vector<MedicineItem> medicines; int timePerDay; // 每天服几次 int dose; // 每次用量 std::wstring note; // 关于如何服药的建议 }; struct MedicalRecord /// 医疗记录 { time_t datetime; // 日期 std::wstring description; // 病情描述 std::wstring diagnose; // 诊断结果 Prescription ps; // 处方 }; class PeopleMgr : public tp::service_impl<SID_PeopleMgr>, public SuggestionProvider { public: /// 通过名字获取人员信息 People* GetPeople(const std::wstring& name, bool create_new_if_not_exist = false); /// 检索人员信息 std::vector<const People*> Search(const std::wstring& str) const; /// 调用excel编辑 void ShellEditPeopleData(); virtual std::vector<std::wstring> GetSuggestion(const std::wstring& input); PeopleMgr(); ~PeopleMgr(); private: std::vector<People> m_peoples; std::map<std::wstring, People*> m_map; std::wstring m_path; private: void LoadPeopleInfo(); void SavePeopleInfo(); void Clear(); People* AddPeople(const std::wstring& name); }; DEFINE_SERVICE(PeopleMgr, L"人员信息管理器");
cdb976b7f8d2f4a29b2bfee43627a005f4b2f957
277af3cd48d2fc481b85cad361ac11d95985bebf
/01_C++_Programs/07_deci_to_bin_hex_oct_vice_versa/07_deci_to_bin_hex_oct_vice_versa.cpp
02b9ebbf005e90b0c0bc4bf00c4fd0a67dff0400
[]
no_license
AbhiAbzs/CIS_Training
8864bb4b38fb0fb6f835b3290f782481364707ca
7fc4cc79f1b7d89c63c22707b214728478936199
refs/heads/master
2020-04-17T17:38:08.662662
2019-02-12T15:01:17
2019-02-12T15:01:17
166,469,824
0
0
null
null
null
null
UTF-8
C++
false
false
2,304
cpp
07_deci_to_bin_hex_oct_vice_versa.cpp
/* * Write a program to convert decimal to binary, octal, hexadecimal & vice versa. **/ #include <iostream> #include <string> #include <string.h> using namespace std; //For decimal to any. void deci2any(); string deci2bin(int); string deci2oct(int); string deci2hex(int); //For binary to any. void bin2any(); //For octal to any. void oct2any(); //For hexadecimal to any. void hex2any(); main(int argc, char const *argv[]) { int opt = 0; do { cout << "Press 1 for Decimal to (Binary, Octal, Hexadecimal)\n"; /* cout << "Press 2 for Binary to (Octal, Decimal, Hexadecimal)\n"; cout << "Press 3 for Octal to (Binary, Decimal, Hexadecimal)\n"; cout << "Press 4 for Hexadecimal to (Binary, Octal, Decimal)\n"; */ cout << "Press 5 to quit.\n"; cin >> opt; switch (opt) { case 1: deci2any(); break; /* case 2: bin2any(); break; case 3: oct2any(); break; case 4: hex2any(); break; */ case 5: break; default: cout << "Select a valid option.\n"; } } while (opt!=5); return 0; } void deci2any() { int num = 0; cout << "Enter a decimal number to find its corresponding binary, octal and hexadecimal conversion.\n"; cin >> num; cout << "The binary conversion is " << deci2bin(num) << endl; cout << "The octal conversion is " << deci2oct(num) << endl; cout << "The hexadecimal conversion is " << deci2hex(num) << endl; } string deci2bin(int num) { string val = ""; while (num != 0) { val = to_string(num % 2) + val; num /= 2; } return val; } string deci2oct(int num) { string val = ""; while (num != 0) { val = to_string(num % 8) + val; num /= 8; } return val; } string deci2hex(int num) { string val = ""; int temp = 0; while (num != 0) { temp = num % 16; if (temp < 10) val = to_string(temp) + val; else val = (char(temp + 55)) + val; num /= 16; } return val; }
fabc3e6cec0004e4dc4b55cfaac41ad8200014fc
d860a2c1fa8fffc76a9101e4f91cecc80c27e802
/hihocoder/weekly/053_1184_连通性二·边的双连通分量.cpp
f2522591539d48059e674113fe077f46c25489fb
[]
no_license
heroming/algorithm
80ea8f00ac049b0bc815140253568484e49c39e3
18e510f02bff92bc45cceb7090a79fbd40c209ec
refs/heads/master
2021-01-19T01:27:31.676356
2019-06-09T08:51:16
2019-06-09T08:51:16
62,952,889
3
1
null
null
null
null
UTF-8
C++
false
false
2,232
cpp
053_1184_连通性二·边的双连通分量.cpp
/* * Author:heroming * File:heroming.cpp * Time:2017/01/14 07:45:56 */ #include <vector> #include <list> #include <set> #include <map> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <string> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> using namespace std; #define px first #define py second #define pb push_back #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() #define clr(v, e) memset(v, e, sizeof(v)) #define rep(it, v) for (auto it : v) #define forn(i, n) for (int i = 0; i < (n); ++ i) #define rforn(i, n) for (int i = (n) - 1; i >= 0; -- i) #define form(i, a, b) for (int i = (a); i <= (b); ++ i) #define rform(i, a, b) for (int i = (b); i >= (a); -- i) #define forv(i, v) for (int i = 0; i < sz(v); ++ i) #define iter(it, v) for (auto it = v.begin(); it != v.end(); ++ it) typedef long long lint; typedef vector<int> vint; typedef vector<string> vstring; typedef pair<int, int> pint; typedef vector<lint> vlint; typedef vector<pint> vpint; const int maxn = 20010; int n, m, component; int idx, dfn[maxn], low[maxn]; int top, sta[maxn]; int belong[maxn]; vint g[maxn]; void tarjan(const int u, const int p) { sta[++ top] = u; dfn[u] = low[u] = ++ idx; rep (v, g[u]) { if (dfn[v] == -1) { tarjan(v, u); low[u] = min(low[u], low[v]); } else if (v != p) { low[u] = min(low[u], dfn[v]); } } if (low[u] == dfn[u]) { vint vertex; ++ component; int v = 0, mi = maxn; do { v = sta[top --]; vertex.pb(v); mi = min(mi, v); } while (v != u); rep (it, vertex) belong[it] = mi; } } int main() { scanf("%d%d", &n, &m); int u, v; forn (i, m) { scanf("%d%d", &u, &v); g[u].pb(v); g[v].pb(u); } clr(dfn, -1); tarjan(1, 0); printf("%d\n", component); form (u, 1, n) { if (u != 1) printf(" "); printf("%d", belong[u]); } printf("\n"); return 0; }
b297ee03d27fe5fd18285a37dc733e76a80c68b5
a2d63ccd34ded40c1323673dbc97eafafdba36f7
/src/Configuration.cpp
949f0a18606716e0bb0f9142c74ac07ccab8dd7e
[]
no_license
viniciusbandeira/Dauphine
47ea464b7b81cae59e4f865f089174a34b1bed19
a51f222cbb96bbfef3e2a91ed9d089944a2ded90
refs/heads/master
2021-08-22T19:40:51.261964
2017-11-18T06:14:07
2017-11-18T06:14:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,840
cpp
Configuration.cpp
/* Dauphine * Universidade de Brasília - FGA * Técnicas de Programação, 2/2017 * @Configuration.cpp * Game configuration class * License: Copyright (C) 2014 Alke Games. */ #include "Configuration.h" #include "LuaScript.h" // Default screen ratio is 16:10 const unsigned int Configuration::resolutionWidth = 192; const unsigned int Configuration::resolutionHeight = 108; uint32_t Configuration::maxFramerate = 0; std::string Configuration::window_title = ""; unsigned int Configuration::logicalRenderSize = 0; unsigned int Configuration::screenWidth = 0; unsigned int Configuration::screenHeight = 0; unsigned int Configuration::cameraDistanceWidth = 0; unsigned int Configuration::cameraDistanceHeight = 0; // Starts the settings menu. void Configuration::initialize () { // Initializing all settings through the Lua. LuaScript luaConfig( "lua/Config.lua" ); Configuration::maxFramerate = (uint32_t) luaConfig.unlua_get < int > ( "config.maxFramerate" ); Configuration::window_title = luaConfig.unlua_get < std::string >( "config.window_title" ); Configuration::logicalRenderSize = (unsigned int) luaConfig.unlua_get < int > ( "config.cameraDistance" ); Configuration::cameraDistanceWidth = Configuration::resolutionWidth * Configuration::logicalRenderSize; Configuration::cameraDistanceHeight = Configuration::resolutionHeight * Configuration::logicalRenderSize; Configuration::screenWidth = (unsigned int) luaConfig.unlua_get < int > ( "config.initialScreenSize.width" ); Configuration::screenHeight = (unsigned int) luaConfig.unlua_get < int > ( "config.initialScreenSize.height" ); } // @return The game's width resolution. (16) unsigned int Configuration::getResolutionWidth () { return Configuration::resolutionWidth; } // @return The game's height resolution. (10) unsigned int Configuration::getResolutionHeight () { return Configuration::resolutionHeight; } // @return The game's max framerate uint32_t Configuration::getMaxFramerate () { return Configuration::maxFramerate; } // @return The game window's title. std::string Configuration::getWindowTitle () { return Configuration::window_title; } // @return The size of the logical rendering. unsigned int Configuration::getLogicalRenderSize () { return Configuration::logicalRenderSize; } // @return The screen width. unsigned int Configuration::getScreenWidth () { return Configuration::screenWidth; } // @return The screen height. unsigned int Configuration::getScreenHeight () { return Configuration::screenHeight; } // @return The width distance of the camera. unsigned int Configuration::getCameraDistanceWidth () { return Configuration::cameraDistanceWidth; } // @return The height distance of the camera. unsigned int Configuration::getCameraDistanceHeight () { return Configuration::cameraDistanceHeight; }
a089da655fa23af7de1e2c2130484f9a4b655584
8a87f5b889a9ce7d81421515f06d9c9cbf6ce64a
/3rdParty/boost/1.78.0/boost/interprocess/smart_ptr/scoped_ptr.hpp
f480428ca894f884151ca05c17d6dd158dd254a8
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause", "ICU", "Zlib", "GPL-1.0-or-later", "OpenSSL", "ISC", "LicenseRef-scancode-gutenberg-2020", "MIT", "GPL-2.0-only", "CC0-1.0", "LicenseRef-scancode-autoconf-simple-exception", "LicenseRef-scancode-pcre", "Bison-exception-2.2", "LicenseRef-scancode-public-domain", "JSON", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "Unlicense", "BSD-4-Clause", "Python-2.0", "LGPL-2.1-or-later" ]
permissive
arangodb/arangodb
0980625e76c56a2449d90dcb8d8f2c485e28a83b
43c40535cee37fc7349a21793dc33b1833735af5
refs/heads/devel
2023-08-31T09:34:47.451950
2023-08-31T07:25:02
2023-08-31T07:25:02
2,649,214
13,385
982
Apache-2.0
2023-09-14T17:02:16
2011-10-26T06:42:00
C++
UTF-8
C++
false
false
5,921
hpp
scoped_ptr.hpp
////////////////////////////////////////////////////////////////////////////// // // This file is the adaptation for Interprocess of boost/scoped_ptr.hpp // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // (C) Copyright Peter Dimov 2001, 2002 // (C) Copyright Ion Gaztanaga 2006-2012. 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) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED #define BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED #ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> #endif # #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include <boost/interprocess/detail/config_begin.hpp> #include <boost/interprocess/detail/workaround.hpp> #include <boost/interprocess/detail/pointer_type.hpp> #include <boost/interprocess/detail/utilities.hpp> #include <boost/assert.hpp> #include <boost/move/adl_move_swap.hpp> //!\file //!Describes the smart pointer scoped_ptr namespace boost { namespace interprocess { //!scoped_ptr stores a pointer to a dynamically allocated object. //!The object pointed to is guaranteed to be deleted, either on destruction //!of the scoped_ptr, or via an explicit reset. The user can avoid this //!deletion using release(). //!scoped_ptr is parameterized on T (the type of the object pointed to) and //!Deleter (the functor to be executed to delete the internal pointer). //!The internal pointer will be of the same pointer type as typename //!Deleter::pointer type (that is, if typename Deleter::pointer is //!offset_ptr<void>, the internal pointer will be offset_ptr<T>). template<class T, class Deleter> class scoped_ptr : private Deleter { #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) scoped_ptr(scoped_ptr const &); scoped_ptr & operator=(scoped_ptr const &); typedef scoped_ptr<T, Deleter> this_type; typedef typename ipcdetail::add_reference<T>::type reference; #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED public: typedef T element_type; typedef Deleter deleter_type; typedef typename ipcdetail::pointer_type<T, Deleter>::type pointer; //!Constructs a scoped_ptr, storing a copy of p(which can be 0) and d. //!Does not throw. explicit scoped_ptr(const pointer &p = 0, const Deleter &d = Deleter()) : Deleter(d), m_ptr(p) // throws if pointer/Deleter copy ctor throws {} //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. //!calling the operator() of the stored deleter. Never throws ~scoped_ptr() { if(m_ptr){ Deleter &del = static_cast<Deleter&>(*this); del(m_ptr); } } //!Deletes the object pointed to by the stored pointer and then //!stores a copy of p. Never throws void reset(const pointer &p = 0) // never throws { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p).swap(*this); } //!Deletes the object pointed to by the stored pointer and then //!stores a copy of p and a copy of d. void reset(const pointer &p, const Deleter &d) // never throws { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p, d).swap(*this); } //!Assigns internal pointer as 0 and returns previous pointer. This will //!avoid deletion on destructor pointer release() BOOST_NOEXCEPT { pointer tmp(m_ptr); m_ptr = 0; return tmp; } //!Returns a reference to the object pointed to by the stored pointer. //!Never throws. reference operator*() const BOOST_NOEXCEPT { BOOST_ASSERT(m_ptr != 0); return *m_ptr; } //!Returns the internal stored pointer. //!Never throws. pointer &operator->() BOOST_NOEXCEPT { BOOST_ASSERT(m_ptr != 0); return m_ptr; } //!Returns the internal stored pointer. //!Never throws. const pointer &operator->() const BOOST_NOEXCEPT { BOOST_ASSERT(m_ptr != 0); return m_ptr; } //!Returns the stored pointer. //!Never throws. pointer & get() BOOST_NOEXCEPT { return m_ptr; } //!Returns the stored pointer. //!Never throws. const pointer & get() const BOOST_NOEXCEPT { return m_ptr; } typedef pointer this_type::*unspecified_bool_type; //!Conversion to bool //!Never throws operator unspecified_bool_type() const BOOST_NOEXCEPT { return m_ptr == 0? 0: &this_type::m_ptr; } //!Returns true if the stored pointer is 0. //!Never throws. bool operator! () const BOOST_NOEXCEPT // never throws { return m_ptr == 0; } //!Exchanges the internal pointer and deleter with other scoped_ptr //!Never throws. void swap(scoped_ptr & b) BOOST_NOEXCEPT // never throws { ::boost::adl_move_swap(static_cast<Deleter&>(*this), static_cast<Deleter&>(b)); ::boost::adl_move_swap(m_ptr, b.m_ptr); } #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: pointer m_ptr; #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED }; //!Exchanges the internal pointer and deleter with other scoped_ptr //!Never throws. template<class T, class D> inline void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b) BOOST_NOEXCEPT { a.swap(b); } //!Returns a copy of the stored pointer //!Never throws template<class T, class D> inline typename scoped_ptr<T, D>::pointer to_raw_pointer(scoped_ptr<T, D> const & p) { return p.get(); } } // namespace interprocess #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #if defined(_MSC_VER) && (_MSC_VER < 1400) template<class T, class D> inline T *to_raw_pointer(boost::interprocess::scoped_ptr<T, D> const & p) { return p.get(); } #endif #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED } // namespace boost #include <boost/interprocess/detail/config_end.hpp> #endif // #ifndef BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED
aa52c795b076c00d4d45b9d502e2e2a7879d6c2f
4622e2012258d10738b6de76467df4963f03d121
/src/Common2/Common2/Container/Interface/istring.hpp
72c9928ffc6e29765a09bb74ae2e42695a27ea5b
[]
no_license
ldalzotto/Engine
d4389fe0009d9df704dcafb4c9de51e7c909855a
a3dfa3dd5d4da8af3a3d62f93e1185cb8073f7b2
refs/heads/master
2023-06-28T01:16:34.554196
2021-06-28T05:30:13
2021-06-28T18:05:14
331,091,291
0
0
null
null
null
null
UTF-8
C++
false
false
1,183
hpp
istring.hpp
#pragma once template <class _String> struct iString { _String& string; inline void append(const Slice<int8>& p_elements) { this->string.append(p_elements); }; inline void insert_array_at(const Slice<int8>& p_elements, const uimax p_index) { this->string.insert_array_at(p_elements, p_index); }; inline void erase_array_at(const uimax p_index, const uimax p_size) { this->string.erase_array_at(p_index, p_size); }; inline void pop_back_array(const uimax p_size) { this->string.pop_back_array(p_size); }; inline void erase_array_at_always(const uimax p_index, const uimax p_size) { this->string.erase_array_at_always(p_index, p_size); }; inline int8& get(const uimax p_index) { return this->string.get(p_index); }; inline uimax get_size() const { return this->string.get_size(); }; inline uimax get_length() const { return this->string.get_length(); }; inline void clear() { this->string.clear(); }; inline Slice<int8> to_slice() { return this->string.to_slice(); }; };
82ca8d0d61dd2c89bed6ca5b9c725c2c261521fd
902fc8de6c8eae81f3d379ff98e48ea832a68dc5
/src/toxi/geom/mesh/STLWriter.h
277d6b6fbb07848604cb7b9f8500dab53d9ec6e2
[]
no_license
Jornason/ofxToxiclibs
d4dfa3105925ebea3f24ff6cdc9547cae270f998
abe4fe29fd04ea7772dad8a47688b2bb00b6a2b1
refs/heads/master
2021-01-15T20:08:23.534814
2013-10-06T18:56:02
2013-10-06T18:56:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
624
h
STLWriter.h
#pragma once #ifndef __STLWRITER_H__ #define __STLWRITER_H__ #include <string> //#include "../Vec3D.h" #include "Vertex.h" namespace toxi { namespace geom { namespace mesh { class STLWriter { public: STLWriter(void); ~STLWriter(void); void beginSave( std::string path, int numFaces ); void endSave(); void setScale( const toxi::geom::Vec3D & v ); void face( const toxi::geom::mesh::Vertex & a, const toxi::geom::mesh::Vertex & b, const toxi::geom::mesh::Vertex & c, const toxi::geom::Vec3D & normal, const int & type); static const int DEFAULT_RGB = 1; }; } } } #endif
bfbfc4acb6aea981d3ab4c4456868150a25adbb9
d4d7fd0a4521b9f8d99d69ad50a38cd29642bec5
/HConfig.cpp
4a9a58121b4bfb500dda5a42b9c004674fc0d42e
[]
no_license
Servayejc/Home
eb60e7621d4135dc3cdd6785b96f95b871b8453b
1cba4d2590adb22ddaa2ed19bd1a4fae6ddfc1db
refs/heads/master
2016-08-04T18:52:34.811576
2015-04-19T01:20:13
2015-04-19T01:20:13
29,815,984
0
0
null
null
null
null
UTF-8
C++
false
false
2,292
cpp
HConfig.cpp
#include <EEPROMEx.h> #include "HConfig.h" #include "Globals.h" #include "Utils.h" HConfig::HConfig() { } byte HConfig::calcTime(byte H, byte M) { return H*6 + M/10; // period of 10 minutes } void HConfig::setDefaultConfig() { for (byte c = 0; c < 6; c++) { for (byte g = 0; g < 2; g++) { setTime(c, g, c, calcTime(6,00)); setSetPoint(c, g, c, 22); setTime(c, g, c, calcTime(7,00)); setSetPoint(c, g, c, 18); setTime(c, g, c, calcTime(16,00)); setSetPoint(c, g, c, 22); setTime(c, g, c, calcTime(22,00)); setSetPoint(c, g, c, 18); } } } void HConfig::loadFromEEPROM() { EEPROM.readBlock<_config>(0, data); } void HConfig::saveToEEPROM() { EEPROM.writeBlock<_config>(0, data); } byte HConfig::getSetPoint(byte channel, byte group, byte ndx) { return data.channel[channel].group[group].setpoint[ndx]; } void HConfig::setSetPoint(byte channel, byte group, byte ndx, byte value){ data.channel[channel].group[group].setpoint[ndx] = value; } void HConfig::setTime(byte channel, byte group, byte ndx, byte value) { data.channel[channel].group[group].time[ndx] = value; } byte HConfig::getTime(byte channel, byte group, byte ndx) { return data.channel[channel].group[group].time[ndx]; } String HConfig::getTimeString(byte channel, byte group, byte ndx) { byte x = data.channel[channel].group[group].time[ndx]; byte H = x/6; byte M = x % 6; String result(' '); if (H < 10) { result += '0'; result += H; } else { result += H; } result += ':'; if (M > 0) { result += M*10; } else { result += "00"; } return result; } void HConfig::setPair(byte EditIndex, String tag, String val) { int value; int tagNum = tag.toInt(); if (tagNum < 100) { int ndx = val.indexOf("%3A"); // %3A = ':' // Serial.println(val); if (ndx > -1) { int H = val.substring(0,ndx).toInt(); int M = val.substring(ndx+3, val.length()).toInt(); value = calcTime(H,M); } else { value = val.toInt(); } byte x = tagNum % 10 -1; switch (tagNum / 10) { case 1 : setTime(EditIndex,0,x,value); break; case 2 : setSetPoint(EditIndex,0,x,value); break; case 3 : setTime(EditIndex,1,x,value); break; case 4 : setSetPoint(EditIndex,1,x,value); break; } } } HConfig Config;
700586cd2806c08f61a66bb898f138c6a2582944
283394dd0e0fa94ec07795114cd5d353073065f7
/base64.cpp
547f7f6bc07e73222cae69cdacba68e99ab57714
[]
no_license
gitdxj/simple-SMTP-server
5122aa286713141369c03f2a96bcdc9d317fde92
f8657e6c35ec8065cf97cefd09ebb7408f017473
refs/heads/master
2020-04-14T01:52:58.410778
2018-12-30T08:01:35
2018-12-30T08:01:35
163,571,609
3
1
null
null
null
null
UTF-8
C++
false
false
3,946
cpp
base64.cpp
#include "base64.h" using namespace std; char* base64_decode(char *s) { char *unit = s, *e, *r, *_ret; int len = strlen(s); unsigned char i; e = s + len; len = len / 4 * 3 + 1; r = _ret = new char[len]; while (unit < e) { for (i = 0; unit[0] != Alp[i] && i < 64; i++) ; if (i == 64) { unit[0] = 0; } else { unit[0] = i; } for (i = 0; unit[1] != Alp[i] && i < 64; i++) ; if (i == 64) { unit[1] = 0; } else { unit[1] = i; } for (i = 0; unit[2] != Alp[i] && i < 64; i++) ; if (i == 64) { unit[2] = 0; } else { unit[2] = i; } for (i = 0; unit[3] != Alp[i] && i < 64; i++) ; if (i == 64) { unit[3] = 0; } else { unit[3] = i; } *r++ = (unit[0] << 2) | (unit[1] >> 4); *r++ = (unit[1] << 4) | (unit[2] >> 2); *r++ = (unit[2] << 6) | unit[3]; unit += 4; } *r = 0; return _ret; } char* base64_encode(char *s) { char *unit = s, *e, *r, *_ret; int len = strlen(s); unsigned char i; e = s + len; if (len % 3 == 0) { len = len / 3 * 4; r = _ret = new char[len]; while (unit < e) { *r++ = Alp[unit[0] / 4]; *r++ = Alp[(unit[0] % 4) * 16 + (unit[1]) / 16]; *r++ = Alp[(unit[1] % 16) * 4 + unit[2] / 64]; *r++ = Alp[unit[2] % 64]; unit += 3; } *r = 0; return _ret; } else if (len % 3 == 1) { len = (len / 3 + 1) * 4 + 1; r = _ret = new char[len]; while (unit < e) { if ((unit + 3) < e) { *r++ = Alp[unit[0] / 4]; *r++ = Alp[(unit[0] % 4) * 16 + (unit[1]) / 16]; *r++ = Alp[(unit[1] % 16) * 4 + unit[2] / 64]; *r++ = Alp[unit[2] % 64]; } else { *r++ = Alp[unit[0] / 4]; *r++ = Alp[(unit[0] % 4) * 16]; *r++ = '='; *r++ = '='; } unit += 3; } *r = 0; return _ret; } else if (len % 3 == 2) { len = (len / 3 + 1) * 4 + 1; r = _ret = new char[len]; while (unit < e) { if ((unit + 3) < e) { *r++ = Alp[unit[0] / 4]; *r++ = Alp[(unit[0] % 4) * 16 + (unit[1]) / 16]; *r++ = Alp[(unit[1] % 16) * 4 + unit[2] / 64]; *r++ = Alp[unit[2] % 64]; } else { *r++ = Alp[unit[0] / 4]; *r++ = Alp[(unit[0] % 4) * 16 + (unit[1]) / 16]; *r++ = Alp[(unit[1] % 16) * 4]; *r++ = '='; } unit += 3; } *r = 0; return _ret; } } void outputImage(string filename) { ifstream in(filename + "\\image.txt"); ofstream out(filename+"\\"+"image.png", ios::binary); char *read_ = new char[4]; char *write_ = new char[3]; in >> read_[0] >> read_[1] >> read_[2] >> read_[3]; while (!in.eof()) { write_ = base64_decode(read_); out << write_[0] << write_[1] << write_[2]; in >> read_[0] >> read_[1] >> read_[2] >> read_[3]; } in.close(); out.close(); } string std_base64_decode(string str) { char* c_str = const_cast<char *>(str.c_str()); char* c_decodedStr = base64_decode(c_str); string decodeStr = c_decodedStr; return decodeStr; }
851fb9d77d9605922229ee16e9247dd703fc2236
c10a283ad259089ef4955b0cd4c3378436fbc1a2
/Client/Library/Project/BaseClass/DShowAPI.cpp
111a5c7b6282536ea16c1c55be51668a8bc8a8b2
[]
no_license
sunjiangbo/NetRadio-1
d829248c2703b9ac3b4cde33492f7d84244b3925
8d86116268963952364ab0325f53f494e1124eab
refs/heads/master
2020-05-01T07:51:39.857544
2012-07-05T08:40:01
2012-07-05T08:40:01
null
0
0
null
null
null
null
GB18030
C++
false
false
32,123
cpp
DShowAPI.cpp
#include <string> #include "DShowAPI.h" #pragma warning(disable : 4996) // 文件相关 //============================================================================= // Filter是否已注册 BOOL IsFilterRegistered(CLSID FilterID) { IBaseFilter * pFilter = NULL; if (SUCCEEDED(CoCreateInstance(FilterID, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&pFilter))) { pFilter->Release(); return TRUE; } return FALSE; } // 注册Filter BOOL RegisterFilter(const WCHAR* szFileName) { typedef (WINAPI * REGISTER_FUNC) (void); REGISTER_FUNC MyFunc = NULL; HMODULE hModule = ::LoadLibrary(szFileName); if (hModule) { MyFunc = (REGISTER_FUNC) GetProcAddress(hModule, "DllRegisterServer\r\n"); BOOL pass = (MyFunc != NULL); if (pass) { MyFunc(); } ::FreeLibrary(hModule); return pass; } return FALSE; } // 注销Filter BOOL UnRegisterFilter(const WCHAR* szFileName) { typedef (WINAPI * REGISTER_FUNC) (void); REGISTER_FUNC MyFunc = NULL; HMODULE hModule = ::LoadLibrary(szFileName); if (hModule) { MyFunc = (REGISTER_FUNC) GetProcAddress(hModule, "DllUnRegisterServer\r\n"); BOOL pass = (MyFunc != NULL); if (pass) { MyFunc(); } ::FreeLibrary(hModule); return pass; } return FALSE; } //============================================================================= //保存Graph到文件 HRESULT SaveGraphFile(IGraphBuilder* pGraphBuilder, const WCHAR* szPathName) { const WCHAR wszStreamName[] = L"ActiveMovieGraph"; HRESULT hr; IStorage *pStorage = NULL; hr = StgCreateDocfile(szPathName, STGM_CREATE | STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pStorage); if(FAILED(hr)) { return hr; } IStream *pStream; hr = pStorage->CreateStream( wszStreamName, STGM_WRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream); if (FAILED(hr)) { pStorage->Release(); return hr; } IPersistStream *pPersist = NULL; pGraphBuilder->QueryInterface(IID_IPersistStream, reinterpret_cast<void**>(&pPersist)); hr = pPersist->Save(pStream, TRUE); pStream->Release(); pPersist->Release(); if (SUCCEEDED(hr)) { hr = pStorage->Commit(STGC_DEFAULT); } pStorage->Release(); return hr; } // 加载Graph到文件 HRESULT LoadGraphFile(IGraphBuilder* pGraphBuilder, const WCHAR* szPathName) { IStorage *pStorage = 0; if (S_OK != StgIsStorageFile(szPathName)) { return E_FAIL; } HRESULT hr = StgOpenStorage(szPathName, 0, STGM_TRANSACTED | STGM_READ | STGM_SHARE_DENY_WRITE, 0, 0, &pStorage); if (FAILED(hr)) { return hr; } IPersistStream *pPersistStream = 0; hr = pGraphBuilder->QueryInterface(IID_IPersistStream, reinterpret_cast<void**>(&pPersistStream)); if (SUCCEEDED(hr)) { IStream *pStream = 0; hr = pStorage->OpenStream(L"ActiveMovieGraph", 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); if(SUCCEEDED(hr)) { hr = pPersistStream->Load(pStream); pStream->Release(); } pPersistStream->Release(); } pStorage->Release(); return hr; } // 在GraphBuilder中查找指定Filter HRESULT FindRenderer(IGraphBuilder* pGraphBuilder, const GUID* MediaTypeID, IBaseFilter **ppFilter) { HRESULT hr; IEnumFilters *pEnum = NULL; IBaseFilter *pFilter = NULL; IPin *pPin; ULONG ulFetched; BOOL bFound=FALSE; // Verify graph builder interface if (!pGraphBuilder) return E_NOINTERFACE; // Verify that a media type was passed if (!MediaTypeID) return E_POINTER; // Clear the filter pointer in case there is no match if (ppFilter) *ppFilter = NULL; // Get filter enumerator hr = pGraphBuilder->EnumFilters(&pEnum); if (FAILED(hr)) return hr; pEnum->Reset(); // Enumerate all filters in the graph while(!bFound && (pEnum->Next(1, &pFilter, &ulFetched) == S_OK)) { #ifdef DEBUG // Read filter name for debugging purposes FILTER_INFO FilterInfo; WCHAR szName[256] = {0}; hr = pFilter->QueryFilterInfo(&FilterInfo); if (SUCCEEDED(hr)) { FilterInfo.pGraph->Release(); } #endif uint16_t nInPinCount, nOutPinCount; // Find a filter with one input and no output pins hr = GetPinCount(pFilter, &nInPinCount, &nOutPinCount); if (FAILED(hr)) break; if ((nInPinCount == 1) && (nOutPinCount == 0)) { // Get the first pin on the filter pPin=0; pPin = GetInputPin(pFilter, (uint16_t)0); // Read this pin's major media type AM_MEDIA_TYPE type={0}; hr = pPin->ConnectionMediaType(&type); if (FAILED(hr)) break; // Is this pin's media type the requested type? // If so, then this is the renderer for which we are searching. // Copy the interface pointer and return. if (type.majortype == *MediaTypeID) { // Found our filter *ppFilter = pFilter; bFound = TRUE; } // This is not the renderer, so release the interface. else pFilter->Release(); // Delete memory allocated by ConnectionMediaType() UtilFreeMediaType(type); } else { // No match, so release the interface pFilter->Release(); } } pEnum->Release(); return hr; } // 在GraphBuilder中查找音频播放Filter HRESULT FindAudioRenderer(IGraphBuilder* pGraphBuilder, IBaseFilter** ppFilter) { return FindRenderer(pGraphBuilder, &MEDIATYPE_Audio, ppFilter); } // 在GraphBuilder中查找视频播放Filter HRESULT FindVideoRenderer(IGraphBuilder* pGraphBuilder, IBaseFilter **ppFilter) { return FindRenderer(pGraphBuilder, &MEDIATYPE_Video, ppFilter); } // 在GraphBuilder中查找FILTER IBaseFilter* FindFilterByCLSID(IGraphBuilder* pGraphBuilder, REFCLSID inClsid) { IBaseFilter * pReturnFilter = NULL; IEnumFilters * pEnumFilters = NULL; pGraphBuilder->EnumFilters(&pEnumFilters); if (pEnumFilters) { IBaseFilter * pFilter = NULL; IPersist * pPersist = NULL; CLSID clsid; ULONG fetchCount = 0; while (S_OK == pEnumFilters->Next(1, &pFilter, &fetchCount) && fetchCount && !pReturnFilter) { HRESULT hr = pFilter->QueryInterface(IID_IPersist, (void**)&pPersist); if (SUCCEEDED(hr)) { pPersist->GetClassID(&clsid); pPersist->Release(); if (IsEqualCLSID(clsid, inClsid)) { pFilter->AddRef(); pReturnFilter = pFilter; } } pFilter->Release(); } pEnumFilters->Release(); } return pReturnFilter; } // 在GraphBuilder中删除指定Filter之后的所有Filter void NukeDownstream(IGraphBuilder* pGraphBuilder, IBaseFilter* pFilter) { if (NULL == pGraphBuilder || NULL == pFilter) return ; IEnumPins * pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); IPin * pin = NULL; ULONG fetched = 0; while (SUCCEEDED(pinEnum->Next(1, &pin, &fetched)) && fetched) { if (pin) { IPin * connectedPin = NULL; pin->ConnectedTo(&connectedPin); if (connectedPin) { PIN_INFO pininfo; if (SUCCEEDED(connectedPin->QueryPinInfo(&pininfo))) { pininfo.pFilter->Release(); if (pininfo.dir == PINDIR_INPUT) { NukeDownstream(pGraphBuilder, pininfo.pFilter); pGraphBuilder->Disconnect(connectedPin); pGraphBuilder->Disconnect(pin); pGraphBuilder->RemoveFilter(pininfo.pFilter); } } connectedPin->Release(); } pin->Release(); } } pinEnum->Release(); } } // 在GraphBuilder中删除指定Filter之前的所有Filter void NukeUpstream(IGraphBuilder* pGraphBuilder, IBaseFilter* pFilter) { if (NULL == pGraphBuilder || NULL == pFilter) return ; IEnumPins * pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); IPin * pin = NULL; ULONG fetched = 0; BOOL pass = TRUE; while (pass && SUCCEEDED(pinEnum->Next(1, &pin, &fetched)) && fetched) { if (pin) { IPin * connectedPin = NULL; pin->ConnectedTo(&connectedPin); if(connectedPin) { PIN_INFO pininfo; if (SUCCEEDED(connectedPin->QueryPinInfo(&pininfo))) { if(pininfo.dir == PINDIR_OUTPUT) { NukeUpstream(pGraphBuilder, pininfo.pFilter); pGraphBuilder->Disconnect(connectedPin); pGraphBuilder->Disconnect(pin); pGraphBuilder->RemoveFilter(pininfo.pFilter); } pininfo.pFilter->Release(); } connectedPin->Release(); } pin->Release(); } else { pass = FALSE; } } pinEnum->Release(); } } // 设备相关 //============================================================================= // 得到捕获设备列表 uint16_t QueryDeviceCategory(GUID CategoryID, device_info_t* pInfoArr, uint16_t nInfoCount) { if(NULL == pInfoArr || 0 == nInfoCount) return 0; uint16_t nDeviceCount = 0; HRESULT hr = NOERROR; ICreateDevEnum * enumHardware = NULL; hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_ALL, IID_ICreateDevEnum, (void**)&enumHardware); if (SUCCEEDED(hr)) { IEnumMoniker* enumMoniker = NULL; hr = enumHardware->CreateClassEnumerator(CategoryID, &enumMoniker, 0); if (enumMoniker) { enumMoniker->Reset(); ULONG fetched = 0; IMoniker * moniker = NULL; while(SUCCEEDED(enumMoniker->Next(1, &moniker, &fetched)) && fetched) { if(nDeviceCount >= nInfoCount) break; if (moniker) { WCHAR * wzDisplayName = NULL; IPropertyBag * propertyBag = NULL; IBaseFilter * filter = NULL; VARIANT name; // Get display name hr = moniker->GetDisplayName(NULL, NULL, &wzDisplayName); if (SUCCEEDED(hr)) { wcsncpy(pInfoArr[nDeviceCount].m_szDisplayName, wzDisplayName, MAX_DEVICE_NAME_SIZE); CoTaskMemFree(wzDisplayName); hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&propertyBag); } if (SUCCEEDED(hr)) { name.vt = VT_BSTR; // Get friendly name hr = propertyBag->Read(L"FriendlyName", &name, NULL); } if (SUCCEEDED(hr)) { wcsncpy(pInfoArr[nDeviceCount].m_szDeviceName, name.bstrVal, MAX_DEVICE_NAME_SIZE); SysFreeString(name.bstrVal); hr = moniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&filter); } if (SUCCEEDED(hr)) { ++nDeviceCount; } // Release interfaces if (filter) { filter->Release(); filter = NULL; } if (propertyBag) { propertyBag->Release(); propertyBag = NULL; } moniker->Release(); } } enumMoniker->Release(); } enumHardware->Release(); } return nDeviceCount; } // 得到视频设备列表 uint16_t QueryVideoCaptureDevices(device_info_t* pInfoArr, uint16_t nInfoCount) { return QueryDeviceCategory(CLSID_VideoInputDeviceCategory, pInfoArr, nInfoCount); } // 得到音频设备列表 uint16_t QueryAudioCaptureDevices(device_info_t* pInfoArr, uint16_t nInfoCount) { return QueryDeviceCategory(CLSID_AudioInputDeviceCategory, pInfoArr, nInfoCount); } // 得到Filter类型 ENUM_DEVICE_TYPE DecideDeviceType(IBaseFilter* inFilter) { // Check if DV device IAMExtTransport * pAMExtTransPost = NULL; inFilter->QueryInterface(IID_IAMExtTransport, (void **)&pAMExtTransPost); if (pAMExtTransPost) { pAMExtTransPost->Release(); return ENUM_DEVICE_DV; } // Check if WDM analog IAMAnalogVideoDecoder * pDecoder = NULL; inFilter->QueryInterface(IID_IAMAnalogVideoDecoder, (void **)&pDecoder); if (pDecoder) { pDecoder->Release(); return ENUM_DEVICE_WDM; } // Check if VFW analog IAMVfwCaptureDialogs * pVfwDlgs = NULL; inFilter->QueryInterface(IID_IAMVfwCaptureDialogs, (void **)&pVfwDlgs); if (pVfwDlgs) { pVfwDlgs->Release(); return ENUM_DEVICE_VFW; } // Check if audio capture device IAMAudioInputMixer * pAudioMixer = NULL; inFilter->QueryInterface(IID_IAMAudioInputMixer, (void **)&pAudioMixer); if (pAudioMixer) { pAudioMixer->Release(); return ENUM_DEVICE_AUDIO; } return ENUM_DEVICE_UNKNOWN; } // 创建视频设备Filter IBaseFilter* CreateVideoDeviceFilter(const WCHAR* szFriendlyName) { return CreateHardwareFilter(CLSID_VideoInputDeviceCategory, szFriendlyName); } // 创建音频设备Filter IBaseFilter* CreateAudioDeviceFilter(const WCHAR* szFriendlyName) { return CreateHardwareFilter(CLSID_AudioInputDeviceCategory, szFriendlyName); } // 创建视频设备Filter IBaseFilter* CreateVideoDeviceFilter(const WCHAR* szDisplayName, WCHAR* szFriendlyName, uint16_t nFriendlyNameSize) { return CreateHardwareFilter(CLSID_VideoInputDeviceCategory, szDisplayName, szFriendlyName, nFriendlyNameSize); } // 创建音频设备Filter IBaseFilter* CreateAudioDeviceFilter(const WCHAR* szDisplayName, WCHAR* szFriendlyName, uint16_t nFriendlyNameSize) { return CreateHardwareFilter(CLSID_AudioInputDeviceCategory, szDisplayName, szFriendlyName, nFriendlyNameSize); } // 创建视频编码器Filter IBaseFilter* CreateVideoCompressorFilter(const WCHAR* szFilterName) { return CreateHardwareFilter(CLSID_VideoCompressorCategory, szFilterName); } // 创建音频编码器Filter IBaseFilter* CreateAudioCompressorFilter(const WCHAR* szFilterName) { return CreateHardwareFilter(CLSID_AudioCompressorCategory, szFilterName); } // 创建硬件Filter IBaseFilter* CreateHardwareFilter(GUID CategoryID, const WCHAR* szFriendlyName) { ICreateDevEnum * enumHardware = NULL; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_ALL, IID_ICreateDevEnum, (void**)&enumHardware); if (FAILED(hr)) { return NULL; } IBaseFilter * hardwareFilter = NULL; IEnumMoniker * enumMoniker = NULL; hr = enumHardware->CreateClassEnumerator(CategoryID, &enumMoniker, 0); if (enumMoniker) { enumMoniker->Reset(); ULONG fetched = 0; IMoniker * moniker = NULL; char friendlyName[256]; while (!hardwareFilter && SUCCEEDED(enumMoniker->Next(1, &moniker, &fetched)) && fetched) { if (moniker) { IPropertyBag * propertyBag = NULL; VARIANT name; friendlyName[0] = 0; hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&propertyBag); if (SUCCEEDED(hr)) { name.vt = VT_BSTR; hr = propertyBag->Read(L"FriendlyName", &name, NULL); } if (SUCCEEDED(hr)) { if (wcscmp(name.bstrVal, szFriendlyName) == 0) { moniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&hardwareFilter); } SysFreeString(name.bstrVal); } // Release interfaces if (propertyBag) { propertyBag->Release(); propertyBag = NULL; } moniker->Release(); } } enumMoniker->Release(); } enumHardware->Release(); return hardwareFilter; } // 创建设备Filter IBaseFilter* CreateHardwareFilter(GUID CategoryID, const WCHAR* szDisplayName, WCHAR* szFriendlyName, uint16_t nFriendlyNameSize) { ICreateDevEnum * enumHardware = NULL; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_ALL, IID_ICreateDevEnum, (void**)&enumHardware); if (FAILED(hr)) { return NULL; } IBaseFilter * hardwareFilter = NULL; IEnumMoniker * enumMoniker = NULL; hr = enumHardware->CreateClassEnumerator(CategoryID, &enumMoniker, 0); if (enumMoniker) { enumMoniker->Reset(); ULONG fetched = 0; IMoniker * moniker = NULL; while (!hardwareFilter && SUCCEEDED(enumMoniker->Next(1, &moniker, &fetched)) && fetched) { if (moniker) { WCHAR* pDisplayName = NULL; // Get display name hr = moniker->GetDisplayName(NULL, NULL, &pDisplayName); if (SUCCEEDED(hr)) { CoTaskMemFree(pDisplayName); if (IsSameDevice(pDisplayName, szDisplayName)) { moniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&hardwareFilter); } } // Get the friendly name if (szFriendlyName && hardwareFilter) { IPropertyBag * propertyBag = NULL; if (SUCCEEDED(moniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&propertyBag))) { VARIANT name; name.vt = VT_BSTR; if (SUCCEEDED(propertyBag->Read(L"FriendlyName", &name, NULL))) { wcsncpy(szFriendlyName, name.bstrVal, nFriendlyNameSize); SysFreeString(name.bstrVal); } propertyBag->Release(); } } moniker->Release(); } } enumMoniker->Release(); } enumHardware->Release(); return hardwareFilter; } // 两个设备是否相同 BOOL IsSameDevice(const WCHAR* szDeviceName1, const WCHAR* szDeviceName2) { std::wstring temp1, temp2, deviceName1, deviceName2; temp1 = szDeviceName1; temp2 = szDeviceName2; int backSlash1 = temp1.find(L"\\\\", 0); int backSlash2 = temp2.find(L"\\\\", 0); if (backSlash1 >= 0 && backSlash2 >= 0) { deviceName1 = temp1.substr(temp1.length() - backSlash1); deviceName2 = temp2.substr(temp2.length() - backSlash2); return (_wcsicmp(deviceName1.c_str(), deviceName2.c_str()) == 0); } else { return (_wcsicmp(temp1.c_str(), temp2.c_str()) == 0); } } // Filter 相关 //============================================================================= BOOL IsSupportPropertyPage(IBaseFilter* pFilter) { HRESULT hr; ISpecifyPropertyPages *pSpecify; // Discover if this filter contains a property page hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify); if (SUCCEEDED(hr)) { pSpecify->Release(); return TRUE; } return FALSE; } // 显示Filter属性页 HRESULT ShowFilterPropertyPage(IBaseFilter* pFilter, HWND hwndParent) { HRESULT hr; ISpecifyPropertyPages *pSpecify=0; if (!pFilter) return E_NOINTERFACE; // Discover if this filter contains a property page hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify); if (SUCCEEDED(hr)) { do { FILTER_INFO FilterInfo; hr = pFilter->QueryFilterInfo(&FilterInfo); if (FAILED(hr)) break; CAUUID caGUID; hr = pSpecify->GetPages(&caGUID); if (FAILED(hr)) break; // Display the filter's property page OleCreatePropertyFrame( hwndParent, // Parent window 0, // x (Reserved) 0, // y (Reserved) FilterInfo.achName, // Caption for the dialog box 1, // Number of filters (IUnknown **)&pFilter, // Pointer to the filter caGUID.cElems, // Number of property pages caGUID.pElems, // Pointer to property page CLSIDs 0, // Locale identifier 0, // Reserved NULL // Reserved ); CoTaskMemFree(caGUID.pElems); FilterInfo.pGraph->Release(); } while(0); } // Release interfaces if (pSpecify) pSpecify->Release(); pFilter->Release(); return hr; } // Filter是否完成连接 BOOL IsCompletelyConnected(IBaseFilter* pFilter) { if (pFilter == NULL) return FALSE; BOOL allConnected = FALSE; IEnumPins * pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); IPin * pin = NULL; ULONG fetchCount = 0; while (SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount && allConnected) { if (pin) { pin->Release(); IPin * connected = NULL; pin->ConnectedTo(&connected); if (connected) { connected->Release(); allConnected = TRUE; } } } pinEnum->Release(); } return allConnected; } // 得到上一个/下一个Filter HRESULT GetNextFilter(IBaseFilter* pFilter, PIN_DIRECTION enPinType, IBaseFilter** ppNext) { if(NULL == pFilter || NULL == ppNext) return E_POINTER; IEnumPins* pEnum = NULL; IPin* pPin = NULL; HRESULT hr = pFilter->EnumPins(&pEnum); // 枚举Filter上所有的Pin if(FAILED(hr)) return hr; while(S_OK == pEnum->Next(1, &pPin, 0)) { PIN_DIRECTION ThisPinDir; hr = pPin->QueryDirection(&ThisPinDir); if(FAILED(hr)) { hr = E_UNEXPECTED; pPin->Release(); break; } if(ThisPinDir == enPinType) { IPin* pPinNext = NULL; hr = pPin->ConnectedTo(&pPinNext); if(SUCCEEDED(hr)) { PIN_INFO PinInfo; hr = pPinNext->QueryPinInfo(&PinInfo); pPinNext->Release(); pPin->Release(); pEnum->Release(); if(FAILED(hr) || (PinInfo.pFilter == NULL)) return E_UNEXPECTED; *ppNext = PinInfo.pFilter; // Client Must Release return S_OK; } } pPin->Release(); } pEnum->Release(); return E_FAIL; } // pin相关 //============================================================================= // 得到Filter中Pin的数量 BOOL GetPinCount(IBaseFilter* pFilter, uint16_t* pInPinCount, uint16_t* pOutPinCount) { HRESULT hr = S_OK; IEnumPins *pEnum=0; ULONG ulFound; IPin *pPin; // Verify input if (!pFilter || !pInPinCount || !pOutPinCount) return E_POINTER; // Clear number of pins found *pInPinCount = 0; *pOutPinCount = 0; // Get pin enumerator hr = pFilter->EnumPins(&pEnum); if(FAILED(hr)) return hr; pEnum->Reset(); // Count every pin on the filter while(S_OK == pEnum->Next(1, &pPin, &ulFound)) { PIN_DIRECTION pindir = (PIN_DIRECTION) 3; hr = pPin->QueryDirection(&pindir); if(pindir == PINDIR_INPUT) (*pInPinCount)++; else (*pOutPinCount)++; pPin->Release(); } pEnum->Release(); return hr; } // 得到Filter中输入Pin信息列表 uint16_t GetInputPinInfo(IBaseFilter* pFilter, pin_info_t* pInfoArr, uint16_t nInfoCount) { if(NULL == pInfoArr || 0 == nInfoCount) return 0; uint16_t nPinCount = 0; if (pFilter) { IEnumPins * pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); BOOL pass = TRUE; IPin * pin = NULL; ULONG fetchCount = 0; UINT nPinIndex = 0; while (pass && SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount) { if (pin) { PIN_INFO pinInfo; if (SUCCEEDED(pin->QueryPinInfo(&pinInfo))) { pinInfo.pFilter->Release(); if (pinInfo.dir == PINDIR_INPUT) { wcsncpy(pInfoArr[nPinCount].m_szPinName, pinInfo.achName, MAX_PIN_NAME_SIZE); nPinCount++; } } pin->Release(); pin = NULL; } else { pass = FALSE; } } pinEnum->Release(); } } return nPinCount; } // 得到Filter中输出Pin信息列表 uint16_t GetOutputPinInfo(IBaseFilter* pFilter, pin_info_t* pInfoArr, uint16_t nInfoCount) { if(NULL == pInfoArr || 0 == nInfoCount) return 0; uint16_t nPinCount = 0; if (pFilter) { IEnumPins * pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); BOOL pass = TRUE; IPin * pin = NULL; ULONG fetchCount = 0; UINT nPinIndex = 0; while (pass && SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount) { if (pin) { PIN_INFO pinInfo; if (SUCCEEDED(pin->QueryPinInfo(&pinInfo))) { pinInfo.pFilter->Release(); if (pinInfo.dir == PINDIR_OUTPUT) { wcsncpy(pInfoArr[nPinCount].m_szPinName, pinInfo.achName, MAX_PIN_NAME_SIZE); nPinCount++; } } pin->Release(); pin = NULL; } else { pass = FALSE; } } pinEnum->Release(); } } return nPinCount; } // 得到Filter中的接口指针 static IPin* GetPin(IBaseFilter* pFilter, PIN_DIRECTION enPinType, uint16_t nIndex) { if(NULL == pFilter) return NULL; IPin* foundPin = NULL; IEnumPins* pinEnum = NULL; HRESULT hr = pFilter->EnumPins(&pinEnum); if(SUCCEEDED(hr)) { ULONG ulFound; IPin *pPin; hr = E_FAIL; while(S_OK == pinEnum->Next(1, &pPin, &ulFound)) { PIN_DIRECTION pindir = (PIN_DIRECTION)3; pPin->QueryDirection(&pindir); if(pindir == enPinType) { if(nIndex == 0) { pPin->AddRef(); foundPin = pPin; // Return the pin's interface break; } nIndex--; } pPin->Release(); } pinEnum->Release(); } // We don't keep outstanding reference count if (foundPin) { foundPin->Release(); } return foundPin; } // 得到Filter的Pin static IPin* GetPin(IBaseFilter* pFilter, PIN_DIRECTION pinDir, const WCHAR* szPinName) { IPin* foundPin = NULL; if(pFilter) { IEnumPins* pinEnum = NULL; if(SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); IPin * pin = NULL; ULONG fetchCount = 0; while (!foundPin && SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount) { if (pin) { PIN_INFO pinInfo; if (SUCCEEDED(pin->QueryPinInfo(&pinInfo))) { if (pinInfo.dir == pinDir) { // Ignore the pin name if (NULL == szPinName) { pin->AddRef(); foundPin = pin; } else { if (NULL != wcsstr(pinInfo.achName, szPinName)) { pin->AddRef(); foundPin = pin; } } } pinInfo.pFilter->Release(); } pin->Release(); } } pinEnum->Release(); } } // We don't keep outstanding reference count if (foundPin) { foundPin->Release(); } return foundPin; } // 得到Filter的输入Pin IPin* GetInputPin(IBaseFilter* pFilter, const WCHAR* szPinName) { return GetPin(pFilter, PINDIR_INPUT, szPinName); } // 得到Filter中的输入接口指针 IPin* GetInputPin(IBaseFilter* pFilter, uint16_t nIndex) { return GetPin(pFilter, PINDIR_INPUT, nIndex); } // 得到Filter的输出Pin IPin* GetOutputPin(IBaseFilter* pFilter, const WCHAR* szPinName) { return GetPin(pFilter, PINDIR_OUTPUT, szPinName); } // 得到Filter中的输出接口指针 IPin* GetOutputPin(IBaseFilter* pFilter, uint16_t nIndex) { return GetPin(pFilter, PINDIR_OUTPUT, nIndex); } // 得到Filter未连接的Pin static IPin* GetUnconnectPin(IBaseFilter* pFilter, PIN_DIRECTION pinDir) { IPin* foundPin = NULL; if (pFilter) { IEnumPins* pinEnum = NULL; if (SUCCEEDED(pFilter->EnumPins(&pinEnum))) { pinEnum->Reset(); IPin* pin = NULL; ULONG fetchCount = 0; while (!foundPin && SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount) { if (pin) { PIN_INFO pinInfo; if (SUCCEEDED(pin->QueryPinInfo(&pinInfo))) { pinInfo.pFilter->Release(); if (pinInfo.dir == pinDir) { IPin* connected = NULL; pin->ConnectedTo(&connected); if (connected) { connected->Release(); } else { pin->AddRef(); foundPin = pin; } } } pin->Release(); } } pinEnum->Release(); } } // We don't keep outstanding reference count if (foundPin) { foundPin->Release(); } return foundPin; } // 得到Filter未连接的输入Pin IPin* GetUnconnectInputPin(IBaseFilter* pFilter) { return GetUnconnectPin(pFilter, PINDIR_INPUT); } // 得到Filter未连接的输出Pin IPin* GetUnconnectOutputPin(IBaseFilter* pFilter) { return GetUnconnectPin(pFilter, PINDIR_OUTPUT); } // 得到音频设备输入Pin名称 BOOL GetAudioInputPinName(uint16_t nLineType, WCHAR* szPinName, uint16_t nPinNameSize) { if(NULL == szPinName || 0 == nPinNameSize) return FALSE; DWORD ComponentType = nLineType; HMIXER hMixer; MIXERLINE mxl; HRESULT hr; hr = mixerOpen(&hMixer, 0, 0, 0, 0); if(FAILED(hr)) return FALSE; mxl.cbStruct = sizeof(mxl); mxl.dwComponentType = ComponentType; hr = mixerGetLineInfo((HMIXEROBJ)hMixer, &mxl, MIXER_GETLINEINFOF_COMPONENTTYPE); if(SUCCEEDED(hr)) { wcsncpy(szPinName, mxl.szName, nPinNameSize); return TRUE; } return FALSE; } //其他函数 //============================================================================= // 删除媒体类型 void UtilDeleteMediaType(AM_MEDIA_TYPE* pMediaType) { // Allow NULL pointers for coding simplicity if (pMediaType == NULL) { return; } // Free media type's format data if (pMediaType->cbFormat != 0) { CoTaskMemFree((PVOID)pMediaType->pbFormat); // Strictly unnecessary but tidier pMediaType->cbFormat = 0; pMediaType->pbFormat = NULL; } // Release interface if (pMediaType->pUnk != NULL) { pMediaType->pUnk->Release(); pMediaType->pUnk = NULL; } // Free media type CoTaskMemFree((PVOID)pMediaType); } // 释放媒体类型 void UtilFreeMediaType(AM_MEDIA_TYPE& MediaType) { if(MediaType.cbFormat != 0) { CoTaskMemFree((PVOID)MediaType.pbFormat); // Strictly unnecessary but tidier MediaType.cbFormat = 0; MediaType.pbFormat = NULL; } if(MediaType.pUnk != NULL) { MediaType.pUnk->Release(); MediaType.pUnk = NULL; } } // 得到媒体播放信息 HRESULT GetDurationString(IMediaSeeking* pMediaSeek, WCHAR* szDuration, uint16_t nDurationSize) { HRESULT hr; if (!pMediaSeek) return E_NOINTERFACE; if (!szDuration) return E_POINTER; // Initialize the display in case we can't read the duration wcscpy(szDuration, L"<00:00.000>\0"); // Is media time supported for this file? if (S_OK != pMediaSeek->IsFormatSupported(&TIME_FORMAT_MEDIA_TIME)) return E_NOINTERFACE; // Read the time format to restore later GUID guidOriginalFormat; hr = pMediaSeek->GetTimeFormat(&guidOriginalFormat); if (FAILED(hr)) return hr; // Ensure media time format for easy display hr = pMediaSeek->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME); if (FAILED(hr)) return hr; // Read the file's duration LONGLONG llDuration; hr = pMediaSeek->GetDuration(&llDuration); if (FAILED(hr)) return hr; // Return to the original format if (guidOriginalFormat != TIME_FORMAT_MEDIA_TIME) { hr = pMediaSeek->SetTimeFormat(&guidOriginalFormat); if (FAILED(hr)) return hr; } // Convert the LONGLONG duration into human-readable format unsigned long nTotalMS = (unsigned long) llDuration / 10000; // 100ns -> ms int nMS = nTotalMS % 1000; int nSeconds = nTotalMS / 1000; int nMinutes = nSeconds / 60; nSeconds %= 60; // Update the string swprintf(szDuration, L"%02dm:%02d.%03ds\0", nMinutes, nSeconds, nMS); return hr; }
9c7e16463be4c38827f77c7c96cc8a44750f985d
07dbd95507b1acf1bd8587e669b8ea8df2052ea5
/Trainings/2018My_All/2018.9.12/G.cpp
943aae1c45b7ddef4b969ce7b05be8c01d238fd5
[]
no_license
LargeDumpling/Programming-Contest
20fc063a944253da9f0a96d059c3fd4c0f6917ad
001f75b6bc4af6f63bd2c250d649b70b77f92ebe
refs/heads/master
2021-06-21T12:01:23.015714
2019-09-16T14:13:08
2019-09-16T14:13:08
107,221,521
0
0
null
2017-10-18T14:38:35
2017-10-17T05:22:16
C++
UTF-8
C++
false
false
1,382
cpp
G.cpp
/* Author: LargeDumpling Email: LargeDumpling@qq.com Edit History: 2018-09-12 File created. */ #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #define INF f[14][2049] using namespace std; const int MAXV=2050; const int MAXN=15; int v,n; int cnt[MAXN],f[MAXN][MAXV],pre[MAXN][MAXV],fv[MAXN]; void count(int lev,int x) { if(lev==n+1||!v) return; if(pre[lev][x]!=x) { cnt[lev]+=(f[lev][x]-f[lev][pre[lev][x]]); count(lev,pre[lev][x]); } else count(lev-1,x); return; } int main() { while(scanf("%d",&v)!=-1) { memset(cnt,0,sizeof(cnt)); memset(f,127,sizeof(f)); memset(pre,-1,sizeof(pre)); scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&fv[i]); f[n+1][0]=0; for(int i=n;i;i--) { for(int j=0;j<=v;j++) { f[i][j]=f[i+1][j]; pre[i][j]=j; } for(int k=0;k<=11;k++) { int cost=(1<<k)*fv[i]; for(int j=cost;j<=v;j++) if(f[i][j-cost]!=INF&&(f[i][j-cost]+(1<<k))<f[i][j]) { f[i][j]=f[i][j-cost]+(1<<k); pre[i][j]=j-cost; } } } if(f[1][v]==INF) puts("-1"); else { int left=v; for(int i=1,k;i<=n;i++) { k=0; while(fv[i]*(k+1)<=left&&f[i+1][left-fv[i]*(k+1)]+(k+1)==f[i][left]) k++; cnt[i]=k; } for(int i=1;i<=n;i++) printf("%d%c",cnt[i],i==n?'\n':' '); } } fclose(stdin); fclose(stdout); return 0; }
97dfaba1bdb2a67f623eff33a62e21778dc4811d
dad702b35a39f0a87fa8ff296c6a2fca2e08c9ff
/gxemul/tags/0.5-devel/src/ir/IRBackend.cc
fe017cc67fd730a4871b9df8a288b1a7a208ada0
[ "LicenseRef-scancode-public-domain", "BSD-3-Clause" ]
permissive
skrll/gxemul
d207f28ea004ce83626557f0ae8acfef1333b496
609431d26909b6e4d99530ba752331d6934a60b0
refs/heads/master
2023-07-08T14:39:10.702343
2021-08-21T10:49:03
2021-08-21T14:10:39
394,869,934
2
0
null
null
null
null
UTF-8
C++
false
false
3,222
cc
IRBackend.cc
/* * Copyright (C) 2009 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "IRBackend.h" #include "IRBackendPortable.h" #ifdef NATIVE_ABI_AMD64 #include "IRBackendAMD64.h" #endif #ifdef NATIVE_ABI_ALPHA #include "IRBackendAlpha.h" #endif refcount_ptr<IRBackend> IRBackend::GetIRBackend(bool useNativeIfAvailable) { if (useNativeIfAvailable) { #ifndef NATIVE_CODE_GENERATION return new IRBackendPortable(); #endif #ifdef NATIVE_ABI_AMD64 return new IRBackendAMD64(); #endif #ifdef NATIVE_ABI_ALPHA return new IRBackendAlpha(); #endif } else { return new IRBackendPortable(); } } void IRBackend::SetAddress(void* address) { m_address = address; } void* IRBackend::GetAddress() const { return m_address; } /* * Note: This .cc module needs to be compiled without -ansi -pedantic, * since calling generated code like this gives a warning. */ void IRBackend::Execute(void *addr, void *cpustruct) { void (*func)(void *) = (void (*)(void *)) addr; func(cpustruct); } /*****************************************************************************/ #ifdef WITHUNITTESTS static int variable; struct something { int dummy1; int dummy2; }; static void SmallFunction(void *input) { struct something* s = (struct something*) input; variable = s->dummy1 + s->dummy2; } static void Test_IRBackend_Execute() { // Tests that it is possible to execute code, given a pointer to // a void function. variable = 42; UnitTest::Assert("variable before", variable, 42); struct something testStruct; testStruct.dummy1 = 120; testStruct.dummy2 = 3; IRBackend::Execute((void*)&SmallFunction, &testStruct); UnitTest::Assert("variable after", variable, 123); } UNITTESTS(IRBackend) { UNITTEST(Test_IRBackend_Execute); } #endif
f17aeb9a1ea12ffb016d61ad10e4cf4c76ef1b3c
09989042f69b1f10ea7c9f6c669ff491a5991f34
/tuioRect/src/ofApp.cpp
9012696a4659c2cb129d25236e5bdf2ac2af8a82
[]
no_license
LYHSH/tuioRect_LianYunGang
660569d35e4b4f69bb73c0149d823490191daea9
55ec719ee242ad8bd4306ebe20f91b46f93a86ea
refs/heads/master
2020-07-01T11:29:22.540708
2019-08-08T14:31:40
2019-08-08T14:31:40
201,162,265
2
0
null
null
null
null
UTF-8
C++
false
false
3,993
cpp
ofApp.cpp
#include "ofApp.h" #include "ofxIdentificationMgr.h" //-------------------------------------------------------------- void ofApp::setup(){ { int nums = 5; ofxIdentificationMgr::setExtraInfo(ofToString(nums)); ofxIdentificationMgr::setup(); } myBoxMgr.setup(); gui.setup(); video.setup(); bSetting = false; //Connect to Port myTuio.connect(3333); //Assign Global TUIO Callback Functions ofAddListener(ofEvents().touchDown, this, &ofApp::touchDown); ofAddListener(ofEvents().touchUp, this, &ofApp::touchUp); ofAddListener(ofEvents().touchMoved, this, &ofApp::touchMoved); lasttimer = 0.0f; ofSetWindowShape(screen_w, screen_h); ofSetFullscreen(true); ofHideCursor(); ofSetFrameRate(60); } //-------------------------------------------------------------- void ofApp::update(){ myBoxMgr.update(); video.update(); myTuio.update(); } //-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0); /*int activeIndex = video.getActiveIndex(); if (video.isStoped()) { video.draw(0, 0, screen_w,screen_h); } else { auto rect = myBoxMgr.getRect(activeIndex); video.draw(rect.getX(),rect.getY(),rect.getWidth(),rect.getHeight()); }*/ video.draw(0, 0, screen_w, screen_h); if (bSetting) { myBoxMgr.draw(); gui.begin(); myBoxMgr.showGui(); gui.end(); } } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ if (key == OF_KEY_RETURN) { bSetting = !bSetting; bSetting ? ofShowCursor() : ofHideCursor(); } if (bSetting) { myBoxMgr.keyPressed(key); } } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ if (bSetting) { myBoxMgr.mouseMoved(x, y); } } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ if (bSetting) { myBoxMgr.mouseDragged(x, y, button); } } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ if (bSetting) { myBoxMgr.mousePressed(x, y, button); } else { if (ofGetElapsedTimef() - lasttimer > 2.0f) { int id = myBoxMgr.touch(x, y); if (id != -1) { video.reloadVideo(id); lasttimer = ofGetElapsedTimef(); } } } } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ if (bSetting) { myBoxMgr.mouseReleased(x, y, button); } } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ } void ofApp::exit() { ofRemoveListener(ofEvents().touchDown, this, &ofApp::touchDown); ofRemoveListener(ofEvents().touchUp, this, &ofApp::touchUp); ofRemoveListener(ofEvents().touchMoved, this, &ofApp::touchMoved); } void ofApp::touchDown(ofTouchEventArgs & touch) { int x = touch.x * screen_w; int y = touch.y * screen_h; if (ofGetElapsedTimef() - lasttimer > 2.0f) { int id = myBoxMgr.touch(x, y); if (id != -1) { video.reloadVideo(id); lasttimer = ofGetElapsedTimef(); } } } void ofApp::touchUp(ofTouchEventArgs & touch) { } void ofApp::touchMoved(ofTouchEventArgs & touch) { int x = touch.x * screen_w; int y = touch.y * screen_h; if (ofGetElapsedTimef() - lasttimer > 2.0f) { int id = myBoxMgr.touch(x, y); if (id != -1) { video.reloadVideo(id); lasttimer = ofGetElapsedTimef(); } } }
c28ed77efc6cd4c67675fd7c381e6410e05e8ff6
c961ec8c298b1bdae3faf4a536830f73fc58e3fd
/branches/geoaida-v2/tools/image_view/SaveSelectionDialog.h
515b9135459652ccff817b9771d4df09f8a23f74
[]
no_license
BackupTheBerlios/geoaida-svn
3d91bcc812dbb68e65fb8af0964a5e61b386f184
f549b14a7d877af737123c98a3113890ad18c525
refs/heads/master
2020-12-30T10:36:49.757432
2010-09-03T13:23:35
2010-09-03T13:23:35
40,669,877
0
0
null
null
null
null
UTF-8
C++
false
false
1,888
h
SaveSelectionDialog.h
/*************************************************************************** SaveSelectionDialog.h - ------------------- begin : Mon Nov 2 2009 copyright : (C) 2009 TNT, Uni Hannover authors : Karsten Vogt email : vogt@tnt.uni-hannover.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef _SAVESELECTIONDIALOG_H_ #define _SAVESELECTIONDIALOG_H_ #include <QDialog> #include <QLineEdit> #include <QCheckBox> #include <QRadioButton> #include "ImageWidget.h" class SaveSelectionDialog : public QDialog { Q_OBJECT public: SaveSelectionDialog(int channelCount, QString currentDirectoy, QWidget *parent=0); QString filename(); QVector<bool> channels(); ColorDepth colordepth(); bool separatechannels(); bool applycontrastbrightness(); private slots: void FilenameRequested(); private: QString _currentDirectory; QLineEdit *_filenameEdit; QVector<QCheckBox *> _channelCheckBoxes; QRadioButton *_8bitButton; QRadioButton *_16bitButton; QRadioButton *_floatButton; QCheckBox *_separatechannelsCheckBox; QCheckBox *_applycbCheckBox; }; #endif
29ef38c73e2a1ba828d6f8b568df54805218f343
36183993b144b873d4d53e7b0f0dfebedcb77730
/GameDevelopment/Game Programming Gems 3/Source Code/02 Mathematics/05 Weber/CoralTree/wds/initlook.cc
23da4025773085b23ff3f6c429a69a888f64f45a
[ "Artistic-2.0", "Intel", "LicenseRef-scancode-unknown-license-reference" ]
permissive
alecnunn/bookresources
b95bf62dda3eb9b0ba0fb4e56025c5c7b6d605c0
4562f6430af5afffde790c42d0f3a33176d8003b
refs/heads/master
2020-04-12T22:28:54.275703
2018-12-22T09:00:31
2018-12-22T09:00:31
162,790,540
20
14
null
null
null
null
UTF-8
C++
false
false
32,375
cc
initlook.cc
/****************************************************************************** Coral Tree wds/initlook.cc Copyright (C) 1998 Infinite Monkeys Incorporated This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License. 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 Artistic License for more details. You should have received a copy of the Artistic License along with this program (see meta/ART_LICE); if not, write to coral@imonk.com. ******************************************************************************/ #include "wds.h" #define WDS_MENU_COLOR TRUE // colorize borderless menu widgets #define WDS_ELEMENT_INIT_DUMP FALSE #define WDS_ELEMENT_CALLBACK_DEBUG FALSE #define WDS_DEFAULT_BEVEL_DEPTH 4 // default beveling depth in pixels // multiple of 2 much prefered #define WDS_DEFAULT_BEVEL_INSET 0 // default beveling inset in pixels // default beveling modes #define WDS_DEFAULT_BEVEL_ACTIVE WDS_BEVELBOX_IN #define WDS_DEFAULT_BEVEL_INACTIVE WDS_BEVELBOX_OUT /****************************************************************************** void WDS_Looks::Initialize(long set,WDS_Looks *default_looks) if default_looks is not NULL, it supplies a potential source for more initialization callbacks no longer supports multiple built-in looks Win32 mode retained and updated Keywords: ******************************************************************************/ void WDS_Looks::Initialize(long set,WDS_Looks *default_looks) { WDS_Look look; if(set!=WDS_LOOK_WIN32) EW_PRINT(EW_WIDGET,EW_WARN,"WDS_Looks::Initialize() only supports WDS_LOOK_WIN32, use WDS_Looks::LoadFromFile()"); // looklist.Clear(); // printf("WDS_Looks::Initialize(%d,0x%x)\n",set,default_looks); // general defaults look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, EW_BLACK); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_LIGHTGREY); look.SetElement(WDS_STATE_ALL, EW_COLOR_BACKGROUND, EW_LIGHTGREY); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, EW_LIGHTGREY); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, EW_DARKGREY); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, EW_BLACK); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_DEFAULT_BEVEL_INACTIVE); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_DEFAULT_BEVEL_ACTIVE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, WDS_DEFAULT_BEVEL_DEPTH); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, WDS_DEFAULT_BEVEL_INSET); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 2); RegisterLook(WDS_TYPE_DEFAULT,WDS_Widget::GetClassIdStatic(),"WDS_Widget",&look); // WDS_Button // state 0: inactive // state 1: being pressed // state 2: locked // state 3,4,5: bevel figures for above look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BUTTON_SENSE_ANNOTATION,TRUE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 3); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_1, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_1, WDS_ELEMENT_LABEL_X, 1); look.SetElement(WDS_STATE_1, WDS_ELEMENT_LABEL_Y, -1); WDS_REGISTER_LOOK(WDS_Button,&look); // WDS_ToggleButton look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Button::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_ANNOTATION_MODE, WDS_WIDGET_ANNOTATION_RIGHT| WDS_WIDGET_ANNOTATION_SQUARE_WIDGET); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_ANNOTATION_X, 4); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_ANNOTATION_Y, 13); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_3, WDS_ELEMENT_BORDER, WDS_BEVELBOX_CHECKMARK); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_3, EW_COLOR_WIDGET, EW_BLACK); look.SetElement(WDS_STATE_3, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_3, WDS_ELEMENT_INSET, 3); WDS_REGISTER_LOOK(WDS_ToggleButton,&look); // WDS_RadioButton look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_ToggleButton::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_ANNOTATION_Y, 12); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH| WDS_BEVELBOX_ELLIPTICAL); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH| WDS_BEVELBOX_ELLIPTICAL); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_3, WDS_ELEMENT_BORDER, WDS_BEVELBOX_ELLIPTICAL); look.SetElement(WDS_STATE_3, WDS_ELEMENT_INSET, 4); WDS_REGISTER_LOOK(WDS_RadioButton,&look); #define WDS_HIER_WIN32_LINE EW_DARKGREY // WDS_HierarchyToggle // state 0/3: unopenable 1/4: closed 2/5: open // states 3-5 are bevel figures look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Button::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, WDS_HIER_WIN32_LINE); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, WDS_HIER_WIN32_LINE); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_HIER_WIN32_LINE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PREF_X, 9); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PREF_Y, 9); look.SetElement(WDS_STATE_0, EW_COLOR_WIDGET, WDS_HIER_WIN32_LINE); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_0, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_0, WDS_ELEMENT_INSET, 4); look.SetElement(WDS_STATE_3, EW_COLOR_WIDGET, WDS_HIER_WIN32_LINE); look.SetElement(WDS_STATE_3, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_3, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_3, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_4, EW_COLOR_WIDGET, EW_BLACK); look.SetElement(WDS_STATE_4, WDS_ELEMENT_BORDER, WDS_BEVELBOX_PLUSMARK); look.SetElement(WDS_STATE_4, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_4, WDS_ELEMENT_INSET, 2); look.SetElement(WDS_STATE_5, EW_COLOR_WIDGET, EW_BLACK); look.SetElement(WDS_STATE_5, WDS_ELEMENT_BORDER, WDS_BEVELBOX_MINUSMARK); look.SetElement(WDS_STATE_5, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_5, WDS_ELEMENT_INSET, 2); WDS_REGISTER_LOOK(WDS_HierarchyToggle,&look); // WDS_HierarchyNode look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Button::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, EW_BLACK); look.SetElement(WDS_STATE_ALL, EW_COLOR_BACKGROUND, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_LABEL_Y, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INDENT, 15); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_HNODE_LINES, TRUE); look.SetElement(WDS_STATE_1, EW_COLOR_PEN, EW_WHITE); look.SetElement(WDS_STATE_1, EW_COLOR_WIDGET, EW_BLUE); WDS_REGISTER_LOOK(WDS_HierarchyNode,&look); // WDS_HierarchyForm // state 0: unannotated 1: annotated look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Form::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, EW_COLOR_BACKGROUND, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_INDENT, 16); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_INDENT_AFTER, 1); WDS_REGISTER_LOOK(WDS_HierarchyForm,&look); // WDS_Partition // state 0: immobile // state 1: mobile look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN); look.SetElement(WDS_STATE_0, WDS_ELEMENT_DEPTH, 1); look.SetElement(WDS_STATE_0, WDS_ELEMENT_PARTITION_SEPARATOR, 2); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_1, WDS_ELEMENT_PARTITION_SEPARATOR, 7); look.SetElement(WDS_STATE_1, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PARTITION_KNOB_OFFSET, -1); WDS_REGISTER_LOOK(WDS_Partition,&look); #define WDS_TABLE_WIN32_BG EW_LIGHTGREY // WDS_TablePartition, modification of WDS_Partition look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Partition::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, EW_COLOR_BACKGROUND, WDS_TABLE_WIN32_BG); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP| EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PARTITION_SEPARATOR, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PARTITION_KNOB_OFFSET, -1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PARTITION_GRAB_WIDTH, 8); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PARTITION_GRAB_LENGTH, 16); WDS_REGISTER_LOOK(WDS_TablePartition,&look); // WDS_MFD, modification of WDS_Partition look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Partition::GetTypeCodeStatic()); WDS_REGISTER_LOOK(WDS_MFD,&look); // WDS_TextList // state 0: Header Editable // state 1: Header Uneditable // state 2: Header Uneditable Selected // state 3: Entry Editable // state 4: Entry Uneditable // state 5: Entry Uneditable Selected look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_SMOOTH|WDS_BEVELBOX_OUT|WDS_BEVELBOX_LABEL_LEFT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_LABEL_X, 3); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET_MODY, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_TEXTLIST_HIGHLIGHT_BG, EW_YELLOW); look.SetElement(WDS_STATE_5, WDS_ELEMENT_TEXTLIST_HIGHLIGHT_BG, EW_DARKGREY); look.SetElement(WDS_STATE_5, EW_COLOR_PEN, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_BACKGROUND, WDS_TABLE_WIN32_BG); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_1, EW_COLOR_WIDGET, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP|EW_COLOR_WIDGET); look.SetElement(WDS_STATE_2, EW_COLOR_WIDGET, EW_MEDGREY); look.SetElement(WDS_STATE_5, EW_COLOR_WIDGET, EW_DARKBLUE); look.SetElement(WDS_STATE_5, EW_COLOR_LIT, EW_DARKBLUE); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, EW_WHITE); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_LIT, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_2, EW_COLOR_HALF_LIT, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_5, EW_COLOR_HALF_LIT, EW_DARKBLUE); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, EW_WHITE); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_2, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_INHERIT|WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_5, EW_COLOR_HALF_SHADOW, EW_DARKBLUE); look.SetElement(WDS_STATE_0, EW_COLOR_SHADOW, EW_DARKGREY); look.SetElement(WDS_STATE_3, EW_COLOR_SHADOW, EW_LIGHTGREY); look.SetElement(WDS_STATE_4, EW_COLOR_SHADOW, EW_WHITE); look.SetElement(WDS_STATE_5, EW_COLOR_SHADOW, EW_DARKBLUE); WDS_REGISTER_LOOK(WDS_TextList,&look); // WDS_GetString look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_GETSTR_FLAGS, FALSE); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_GETSTR_SELECT_FG, EW_WHITE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_GETSTR_SELECT_BG, EW_DARKBLUE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_GETSTR_HIGHLIGHT_BG, EW_YELLOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 3); look.SetElement(WDS_STATE_3, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_WIDGET); look.SetElement(WDS_STATE_3, WDS_ELEMENT_DEPTH, 0); WDS_REGISTER_LOOK(WDS_GetString,&look); // WDS_TextList_GetString look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_GetString::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 1); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, EW_BLACK); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, EW_BLACK); WDS_REGISTER_LOOK(WDS_TextList_GetString,&look); // WDS_TipString look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_GetString::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 2); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_YELLOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_COLOR_WIDGET_DITHER, EW_WHITE); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, EW_BLACK); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, EW_BLACK); WDS_REGISTER_LOOK(WDS_TipString,&look); // WDS_Paragraph look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_GetString::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); WDS_REGISTER_LOOK(WDS_Paragraph,&look); // WDS_DocumentForm look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Form::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 1); WDS_REGISTER_LOOK(WDS_DocumentForm,&look); // WDS_Document look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_ScrollRegion::GetTypeCodeStatic()); look.SetElement(WDS_STATE_0, WDS_ELEMENT_SCROLLREGION_SCROLLABLE,WDS_SCROLLABLE_OFF); look.SetElement(WDS_STATE_1, WDS_ELEMENT_SCROLLREGION_SCROLLABLE,WDS_SCROLLABLE_VISIBLE | WDS_SCROLLABLE_PERSISTANT | WDS_SCROLLABLE_OPPOSE ); WDS_REGISTER_LOOK(WDS_Document,&look); // WDS_ScrollBarButton (why the inactive lighting is reversed, I don't know) look.Reset(); look.SetElement(WDS_STATE_0, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_0, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_1, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_1, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Button::GetTypeCodeStatic()); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_POINT_45); look.SetElement(WDS_STATE_2, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_2, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_2, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_2, WDS_ELEMENT_INSET, 4); look.SetElement(WDS_STATE_3, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_POINT_45); look.SetElement(WDS_STATE_3, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_3, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_3, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_3, WDS_ELEMENT_INSET, 4); WDS_REGISTER_LOOK(WDS_ScrollBarButton,&look); // WDS_ScrollBar // state 0: horizontal scrollbar // state 1: vertical scrollbar look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SCROLLBAR_CHILDREN, WDS_SCROLLBAR_CHILDREN_SLAVES | WDS_SCROLLBAR_CHILDREN_ALTERNATE | WDS_SCROLLBAR_CHILDREN_INSIDE ); // state 0: cylinder shaft // state 1: piston without fields // state 2: piston with fields (no Win32 equivalent) look.SetElement(WDS_STATE_0, EW_COLOR_WIDGET, EW_LIGHTGREY); look.SetElement(WDS_STATE_0, WDS_ELEMENT_COLOR_WIDGET_DITHER, EW_WHITE); look.SetElement(WDS_STATE_1, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_2, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, EW_BLUE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SCROLLBAR_WIDTH, 15); look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_0, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_0, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_0, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_0, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_0, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_1, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_1, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_1, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_RIDGED); look.SetElement(WDS_STATE_2, WDS_ELEMENT_DEPTH, 3); WDS_REGISTER_LOOK(WDS_ScrollBar,&look); // WDS_ScrollRegion look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); // scrollbar placement // state 0: horizontal scrollbar // state 1: vertical scrollbar look.SetElement(WDS_STATE_0, WDS_ELEMENT_SCROLLREGION_SCROLLABLE,WDS_SCROLLABLE_VISIBLE); look.SetElement(WDS_STATE_1, WDS_ELEMENT_SCROLLREGION_SCROLLABLE,WDS_SCROLLABLE_VISIBLE | WDS_SCROLLABLE_OPPOSE); // scrollable region // state 0: overall widget // state 1: subregion less the scrollbars (remember, inset includes state 0 depth) look.SetElement(WDS_STATE_0, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_0, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_0, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_1, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_1, WDS_ELEMENT_INSET, 0); WDS_REGISTER_LOOK(WDS_ScrollRegion,&look); // WDS_Pick look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Popup::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN|WDS_BEVELBOX_SMOOTH| WDS_BEVELBOX_LABEL_LEFT); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_LABEL_X, 3); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 3); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PICK_AUTO_OFFSET, FALSE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PICK_MAINTAIN_BUTTON, FALSE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PICK_WIN_HEIGHT_MAX, 128); WDS_REGISTER_LOOK(WDS_Pick,&look); // WDS_PickScroll // state 0: overall widget // state 1: subregion less the scrollbars (remember, inset includes state 0 depth) look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_ScrollRegion::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_IN); look.SetElement(WDS_STATE_ALL, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_SHADOW); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 1); look.SetElement(WDS_STATE_1, WDS_ELEMENT_DEPTH, 0); WDS_REGISTER_LOOK(WDS_PickScroll,&look); // WDS_PickList look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_TextList::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS|WDS_BEVELBOX_LABEL_LEFT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_LABEL_X, 3); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_TEXTLIST_IDLE_ECHO, TRUE); WDS_REGISTER_LOOK(WDS_PickList,&look); // WDS_PickButton look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_ScrollBarButton::GetTypeCodeStatic()); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_POINT_DOWN| WDS_BEVELBOX_POINT_45); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 2); look.SetElement(WDS_STATE_2, WDS_ELEMENT_INSET, 6); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_PICKBUTTON_WIDTH, -1); WDS_REGISTER_LOOK(WDS_PickButton,&look); // WDS_PopupBase look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); WDS_REGISTER_LOOK(WDS_PopupBase,&look); // WDS_Popup look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_0, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_1, EW_COLOR_WIDGET, EW_DARKBLUE); WDS_REGISTER_LOOK(WDS_Popup,&look); // WDS_MenuButton look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_ScrollBarButton::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_MENUBUTTON_WIDTH, 8); look.SetElement(WDS_STATE_0, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_1, EW_COLOR_WIDGET, EW_DARKBLUE); look.SetElement(WDS_STATE_3, EW_COLOR_WIDGET, EW_WHITE); look.SetElement(WDS_STATE_2, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_POINT_45); look.SetElement(WDS_STATE_3, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_POINT_45); look.SetElement(WDS_STATE_2, WDS_ELEMENT_INSET, 2); look.SetElement(WDS_STATE_3, WDS_ELEMENT_INSET, 2); WDS_REGISTER_LOOK(WDS_MenuButton,&look); // WDS_MenuBar look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Form::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 0); WDS_REGISTER_LOOK(WDS_MenuBar,&look); // WDS_MenuForm look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Form::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 0); WDS_REGISTER_LOOK(WDS_MenuForm,&look); // WDS_MenuNode look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Popup::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS|WDS_BEVELBOX_LABEL_LEFT); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINDENT, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBOUTDENT, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_POPUP_IDLE_HANDOFF, TRUE); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_POPUP_DELAY, 300); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, EW_DARKBLUE); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, EW_WHITE); look.SetElement(WDS_STATE_0, EW_COLOR_WIDGET, WDS_ELEMENT_INHERIT|WDS_ELEMENT_DEFAULT); look.SetElement(WDS_STATE_0, EW_COLOR_PEN, WDS_ELEMENT_INHERIT|WDS_ELEMENT_DEFAULT); WDS_REGISTER_LOOK(WDS_MenuNode,&look); // WDS_Divider look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_SMOOTH); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 4); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 8); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DIVIDER_SLIDEFORM, 2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DIVIDER_OVERLAP, 2); WDS_REGISTER_LOOK(WDS_Divider,&look); // WDS_DividerTab look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Popup::GetTypeCodeStatic()); look.SetElement(WDS_STATE_ALL, EW_COLOR_LIT, WDS_ELEMENT_MAP|EW_COLOR_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_HALF_LIT, WDS_ELEMENT_MAP|EW_COLOR_HALF_LIT); look.SetElement(WDS_STATE_ALL, EW_COLOR_WIDGET, WDS_ELEMENT_MAP|EW_COLOR_BACKGROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_OUT|WDS_BEVELBOX_OMIT_BOTTOM| WDS_BEVELBOX_SMOOTH|WDS_BEVELBOX_ROUND); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_1, WDS_ELEMENT_INSET, -2); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 1); look.SetElement(WDS_STATE_1, WDS_ELEMENT_SUBINSET, 3); look.SetElement(WDS_STATE_1, WDS_ELEMENT_LABEL_X, 0); look.SetElement(WDS_STATE_1, WDS_ELEMENT_LABEL_Y, 2); WDS_REGISTER_LOOK(WDS_DividerTab,&look); // WDS_DividerForm look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_Form::GetTypeCodeStatic()); WDS_REGISTER_LOOK(WDS_DividerForm,&look); // WDS_Form look.Reset(); look.SetElement(WDS_STATE_ALL, EW_COLOR_PEN, EW_BLACK); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_BORDER, WDS_BEVELBOX_BORDERLESS); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_DEPTH, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INSET, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_SUBINSET, 0); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_SEPARATOR, 1); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_FORM_COLOR_SELECT, EW_RED); look.SetElement(WDS_STATE_1, EW_COLOR_SHADOW, WDS_ELEMENT_MAP|EW_COLOR_HALF_SHADOW); look.SetElement(WDS_STATE_1, WDS_ELEMENT_BORDER, WDS_BEVELBOX_GROOVE); look.SetElement(WDS_STATE_1, WDS_ELEMENT_DEPTH, 2); look.SetElement(WDS_STATE_1, WDS_ELEMENT_INSET, 4); look.SetElement(WDS_STATE_1, WDS_ELEMENT_SUBINSET, 8); WDS_REGISTER_LOOK(WDS_Form,&look); // WDS_PointerEntry look.Reset(); look.SetElement(WDS_STATE_ALL, WDS_ELEMENT_INHERITANCE, (long)WDS_GetString::GetTypeCodeStatic()); WDS_REGISTER_LOOK(WDS_PointerEntry,&look); // call initialization callbacks for all nodes on looklist WDS_LookEntry *node; WDS_Looks *a_looks; WDS_Look a_look; void (*callback)(WDS_Look *,long); long pass; for(pass=0; pass<1+(default_looks!=NULL && default_looks!=this); pass++) { a_looks= pass? default_looks: this; a_looks->GetLookList()->ToHead(); while( (node=a_looks->GetLookList()->PostIncrement()) != NULL ) { osdMemcpy(&a_look,node->GetLook(),sizeof(WDS_Look)); callback=(void (*)(WDS_Look *,long))a_look.GetElement(WDS_STATE_ALL,WDS_ELEMENT_CALLBACK_INIT); #if WDS_ELEMENT_CALLBACK_DEBUG printf("for look=0x%x typecode=0x%x (%s) ", node->GetLook(),node->GetTypeCode(),node->GetTypeName()); #endif if(callback && (WDS_Typecode)callback!=WDS_TYPE_UNDEFINED) { #if WDS_ELEMENT_CALLBACK_DEBUG printf("calling callback 0x%x\n",(long)callback); #endif (*callback)(&a_look,set); #if WDS_ELEMENT_CALLBACK_DEBUG printf(" callback done\n"); #endif this->RegisterLook(node->GetTypeCode(),node->GetClassID(),node->GetTypeName(),&a_look); } #if WDS_ELEMENT_CALLBACK_DEBUG else printf("no callback\n"); #endif // in case something reset the pointer a_looks->GetLookList()->SetCurrent(node); a_looks->GetLookList()->PostIncrement(); } } #if WDS_ELEMENT_CALLBACK_DEBUG printf("all callbacks done\n"); #endif // invalidate old look pointers WDS_Widget::IncrementLookCounter(); #if WDS_ELEMENT_INIT_DUMP Dump(0); #endif }
d5a544776c56809aeeb426e6ba3372d9ff927a46
923e7df48e06716797ba0010e07c6d49c87754cc
/internal/core/src/pb/segcore.pb.cc
9b2b0800803b2d9e4273619563c655233a413724
[ "Apache-2.0" ]
permissive
xiaocai2333/milvus
b22269545f7b9f3f52a59a5f35422018c08fe8ff
82edb4d2df25b289fb5b5fe364e693f50f9a170f
refs/heads/master
2023-08-28T12:43:43.095519
2023-01-05T07:33:39
2023-01-05T07:33:39
219,463,625
1
0
Apache-2.0
2019-11-04T09:28:29
2019-11-04T09:28:28
null
UTF-8
C++
false
true
58,376
cc
segcore.pb.cc
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: segcore.proto #include "segcore.pb.h" #include <algorithm> #include <google/protobuf/stubs/common.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> extern PROTOBUF_INTERNAL_EXPORT_schema_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_FieldData_schema_2eproto; extern PROTOBUF_INTERNAL_EXPORT_schema_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_IDs_schema_2eproto; extern PROTOBUF_INTERNAL_EXPORT_segcore_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_LoadFieldMeta_segcore_2eproto; namespace milvus { namespace proto { namespace segcore { class RetrieveResultsDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<RetrieveResults> _instance; } _RetrieveResults_default_instance_; class LoadFieldMetaDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LoadFieldMeta> _instance; } _LoadFieldMeta_default_instance_; class LoadSegmentMetaDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LoadSegmentMeta> _instance; } _LoadSegmentMeta_default_instance_; class InsertRecordDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<InsertRecord> _instance; } _InsertRecord_default_instance_; } // namespace segcore } // namespace proto } // namespace milvus static void InitDefaultsscc_info_InsertRecord_segcore_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::milvus::proto::segcore::_InsertRecord_default_instance_; new (ptr) ::milvus::proto::segcore::InsertRecord(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::milvus::proto::segcore::InsertRecord::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_InsertRecord_segcore_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_InsertRecord_segcore_2eproto}, { &scc_info_FieldData_schema_2eproto.base,}}; static void InitDefaultsscc_info_LoadFieldMeta_segcore_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::milvus::proto::segcore::_LoadFieldMeta_default_instance_; new (ptr) ::milvus::proto::segcore::LoadFieldMeta(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::milvus::proto::segcore::LoadFieldMeta::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_LoadFieldMeta_segcore_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_LoadFieldMeta_segcore_2eproto}, {}}; static void InitDefaultsscc_info_LoadSegmentMeta_segcore_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::milvus::proto::segcore::_LoadSegmentMeta_default_instance_; new (ptr) ::milvus::proto::segcore::LoadSegmentMeta(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::milvus::proto::segcore::LoadSegmentMeta::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_LoadSegmentMeta_segcore_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_LoadSegmentMeta_segcore_2eproto}, { &scc_info_LoadFieldMeta_segcore_2eproto.base,}}; static void InitDefaultsscc_info_RetrieveResults_segcore_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::milvus::proto::segcore::_RetrieveResults_default_instance_; new (ptr) ::milvus::proto::segcore::RetrieveResults(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::milvus::proto::segcore::RetrieveResults::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_RetrieveResults_segcore_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_RetrieveResults_segcore_2eproto}, { &scc_info_IDs_schema_2eproto.base, &scc_info_FieldData_schema_2eproto.base,}}; static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_segcore_2eproto[4]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_segcore_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_segcore_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_segcore_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::RetrieveResults, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::RetrieveResults, ids_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::RetrieveResults, offset_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::RetrieveResults, fields_data_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadFieldMeta, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadFieldMeta, min_timestamp_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadFieldMeta, max_timestamp_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadFieldMeta, row_count_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadSegmentMeta, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadSegmentMeta, metas_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::LoadSegmentMeta, total_size_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::InsertRecord, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::InsertRecord, fields_data_), PROTOBUF_FIELD_OFFSET(::milvus::proto::segcore::InsertRecord, num_rows_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::milvus::proto::segcore::RetrieveResults)}, { 8, -1, sizeof(::milvus::proto::segcore::LoadFieldMeta)}, { 16, -1, sizeof(::milvus::proto::segcore::LoadSegmentMeta)}, { 23, -1, sizeof(::milvus::proto::segcore::InsertRecord)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::segcore::_RetrieveResults_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::segcore::_LoadFieldMeta_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::segcore::_LoadSegmentMeta_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::segcore::_InsertRecord_default_instance_), }; const char descriptor_table_protodef_segcore_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\rsegcore.proto\022\024milvus.proto.segcore\032\014s" "chema.proto\"}\n\017RetrieveResults\022%\n\003ids\030\001 " "\001(\0132\030.milvus.proto.schema.IDs\022\016\n\006offset\030" "\002 \003(\003\0223\n\013fields_data\030\003 \003(\0132\036.milvus.prot" "o.schema.FieldData\"P\n\rLoadFieldMeta\022\025\n\rm" "in_timestamp\030\001 \001(\003\022\025\n\rmax_timestamp\030\002 \001(" "\003\022\021\n\trow_count\030\003 \001(\003\"Y\n\017LoadSegmentMeta\022" "2\n\005metas\030\001 \003(\0132#.milvus.proto.segcore.Lo" "adFieldMeta\022\022\n\ntotal_size\030\002 \001(\003\"U\n\014Inser" "tRecord\0223\n\013fields_data\030\001 \003(\0132\036.milvus.pr" "oto.schema.FieldData\022\020\n\010num_rows\030\002 \001(\003B6" "Z4github.com/milvus-io/milvus/internal/p" "roto/segcorepbb\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_segcore_2eproto_deps[1] = { &::descriptor_table_schema_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_segcore_2eproto_sccs[4] = { &scc_info_InsertRecord_segcore_2eproto.base, &scc_info_LoadFieldMeta_segcore_2eproto.base, &scc_info_LoadSegmentMeta_segcore_2eproto.base, &scc_info_RetrieveResults_segcore_2eproto.base, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_segcore_2eproto_once; static bool descriptor_table_segcore_2eproto_initialized = false; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_segcore_2eproto = { &descriptor_table_segcore_2eproto_initialized, descriptor_table_protodef_segcore_2eproto, "segcore.proto", 502, &descriptor_table_segcore_2eproto_once, descriptor_table_segcore_2eproto_sccs, descriptor_table_segcore_2eproto_deps, 4, 1, schemas, file_default_instances, TableStruct_segcore_2eproto::offsets, file_level_metadata_segcore_2eproto, 4, file_level_enum_descriptors_segcore_2eproto, file_level_service_descriptors_segcore_2eproto, }; // Force running AddDescriptors() at dynamic initialization time. static bool dynamic_init_dummy_segcore_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_segcore_2eproto), true); namespace milvus { namespace proto { namespace segcore { // =================================================================== void RetrieveResults::InitAsDefaultInstance() { ::milvus::proto::segcore::_RetrieveResults_default_instance_._instance.get_mutable()->ids_ = const_cast< ::milvus::proto::schema::IDs*>( ::milvus::proto::schema::IDs::internal_default_instance()); } class RetrieveResults::_Internal { public: static const ::milvus::proto::schema::IDs& ids(const RetrieveResults* msg); }; const ::milvus::proto::schema::IDs& RetrieveResults::_Internal::ids(const RetrieveResults* msg) { return *msg->ids_; } void RetrieveResults::clear_ids() { if (GetArenaNoVirtual() == nullptr && ids_ != nullptr) { delete ids_; } ids_ = nullptr; } void RetrieveResults::clear_fields_data() { fields_data_.Clear(); } RetrieveResults::RetrieveResults() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:milvus.proto.segcore.RetrieveResults) } RetrieveResults::RetrieveResults(const RetrieveResults& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), offset_(from.offset_), fields_data_(from.fields_data_) { _internal_metadata_.MergeFrom(from._internal_metadata_); if (from.has_ids()) { ids_ = new ::milvus::proto::schema::IDs(*from.ids_); } else { ids_ = nullptr; } // @@protoc_insertion_point(copy_constructor:milvus.proto.segcore.RetrieveResults) } void RetrieveResults::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_RetrieveResults_segcore_2eproto.base); ids_ = nullptr; } RetrieveResults::~RetrieveResults() { // @@protoc_insertion_point(destructor:milvus.proto.segcore.RetrieveResults) SharedDtor(); } void RetrieveResults::SharedDtor() { if (this != internal_default_instance()) delete ids_; } void RetrieveResults::SetCachedSize(int size) const { _cached_size_.Set(size); } const RetrieveResults& RetrieveResults::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_RetrieveResults_segcore_2eproto.base); return *internal_default_instance(); } void RetrieveResults::Clear() { // @@protoc_insertion_point(message_clear_start:milvus.proto.segcore.RetrieveResults) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; offset_.Clear(); fields_data_.Clear(); if (GetArenaNoVirtual() == nullptr && ids_ != nullptr) { delete ids_; } ids_ = nullptr; _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* RetrieveResults::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // .milvus.proto.schema.IDs ids = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(mutable_ids(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // repeated int64 offset = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(mutable_offset(), ptr, ctx); CHK_(ptr); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { add_offset(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // repeated .milvus.proto.schema.FieldData fields_data = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr -= 1; do { ptr += 1; ptr = ctx->ParseMessage(add_fields_data(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool RetrieveResults::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; // @@protoc_insertion_point(parse_start:milvus.proto.segcore.RetrieveResults) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // .milvus.proto.schema.IDs ids = 1; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( input, mutable_ids())); } else { goto handle_unusual; } break; } // repeated int64 offset = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, this->mutable_offset()))); } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( 1, 18u, input, this->mutable_offset()))); } else { goto handle_unusual; } break; } // repeated .milvus.proto.schema.FieldData fields_data = 3; case 3: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( input, add_fields_data())); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:milvus.proto.segcore.RetrieveResults) return true; failure: // @@protoc_insertion_point(parse_failure:milvus.proto.segcore.RetrieveResults) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void RetrieveResults::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:milvus.proto.segcore.RetrieveResults) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // .milvus.proto.schema.IDs ids = 1; if (this->has_ids()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( 1, _Internal::ids(this), output); } // repeated int64 offset = 2; if (this->offset_size() > 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTag(2, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); output->WriteVarint32(_offset_cached_byte_size_.load( std::memory_order_relaxed)); } for (int i = 0, n = this->offset_size(); i < n; i++) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64NoTag( this->offset(i), output); } // repeated .milvus.proto.schema.FieldData fields_data = 3; for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_data_size()); i < n; i++) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( 3, this->fields_data(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:milvus.proto.segcore.RetrieveResults) } ::PROTOBUF_NAMESPACE_ID::uint8* RetrieveResults::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:milvus.proto.segcore.RetrieveResults) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // .milvus.proto.schema.IDs ids = 1; if (this->has_ids()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( 1, _Internal::ids(this), target); } // repeated int64 offset = 2; if (this->offset_size() > 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTagToArray( 2, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream::WriteVarint32ToArray( _offset_cached_byte_size_.load(std::memory_order_relaxed), target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: WriteInt64NoTagToArray(this->offset_, target); } // repeated .milvus.proto.schema.FieldData fields_data = 3; for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_data_size()); i < n; i++) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( 3, this->fields_data(static_cast<int>(i)), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:milvus.proto.segcore.RetrieveResults) return target; } size_t RetrieveResults::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:milvus.proto.segcore.RetrieveResults) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated int64 offset = 2; { size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: Int64Size(this->offset_); if (data_size > 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); _offset_cached_byte_size_.store(cached_size, std::memory_order_relaxed); total_size += data_size; } // repeated .milvus.proto.schema.FieldData fields_data = 3; { unsigned int count = static_cast<unsigned int>(this->fields_data_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( this->fields_data(static_cast<int>(i))); } } // .milvus.proto.schema.IDs ids = 1; if (this->has_ids()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *ids_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void RetrieveResults::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:milvus.proto.segcore.RetrieveResults) GOOGLE_DCHECK_NE(&from, this); const RetrieveResults* source = ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<RetrieveResults>( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.proto.segcore.RetrieveResults) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.proto.segcore.RetrieveResults) MergeFrom(*source); } } void RetrieveResults::MergeFrom(const RetrieveResults& from) { // @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.segcore.RetrieveResults) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; offset_.MergeFrom(from.offset_); fields_data_.MergeFrom(from.fields_data_); if (from.has_ids()) { mutable_ids()->::milvus::proto::schema::IDs::MergeFrom(from.ids()); } } void RetrieveResults::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:milvus.proto.segcore.RetrieveResults) if (&from == this) return; Clear(); MergeFrom(from); } void RetrieveResults::CopyFrom(const RetrieveResults& from) { // @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.segcore.RetrieveResults) if (&from == this) return; Clear(); MergeFrom(from); } bool RetrieveResults::IsInitialized() const { return true; } void RetrieveResults::InternalSwap(RetrieveResults* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); offset_.InternalSwap(&other->offset_); CastToBase(&fields_data_)->InternalSwap(CastToBase(&other->fields_data_)); swap(ids_, other->ids_); } ::PROTOBUF_NAMESPACE_ID::Metadata RetrieveResults::GetMetadata() const { return GetMetadataStatic(); } // =================================================================== void LoadFieldMeta::InitAsDefaultInstance() { } class LoadFieldMeta::_Internal { public: }; LoadFieldMeta::LoadFieldMeta() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:milvus.proto.segcore.LoadFieldMeta) } LoadFieldMeta::LoadFieldMeta(const LoadFieldMeta& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&min_timestamp_, &from.min_timestamp_, static_cast<size_t>(reinterpret_cast<char*>(&row_count_) - reinterpret_cast<char*>(&min_timestamp_)) + sizeof(row_count_)); // @@protoc_insertion_point(copy_constructor:milvus.proto.segcore.LoadFieldMeta) } void LoadFieldMeta::SharedCtor() { ::memset(&min_timestamp_, 0, static_cast<size_t>( reinterpret_cast<char*>(&row_count_) - reinterpret_cast<char*>(&min_timestamp_)) + sizeof(row_count_)); } LoadFieldMeta::~LoadFieldMeta() { // @@protoc_insertion_point(destructor:milvus.proto.segcore.LoadFieldMeta) SharedDtor(); } void LoadFieldMeta::SharedDtor() { } void LoadFieldMeta::SetCachedSize(int size) const { _cached_size_.Set(size); } const LoadFieldMeta& LoadFieldMeta::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LoadFieldMeta_segcore_2eproto.base); return *internal_default_instance(); } void LoadFieldMeta::Clear() { // @@protoc_insertion_point(message_clear_start:milvus.proto.segcore.LoadFieldMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; ::memset(&min_timestamp_, 0, static_cast<size_t>( reinterpret_cast<char*>(&row_count_) - reinterpret_cast<char*>(&min_timestamp_)) + sizeof(row_count_)); _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* LoadFieldMeta::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // int64 min_timestamp = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { min_timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // int64 max_timestamp = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { max_timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // int64 row_count = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool LoadFieldMeta::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; // @@protoc_insertion_point(parse_start:milvus.proto.segcore.LoadFieldMeta) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // int64 min_timestamp = 1; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &min_timestamp_))); } else { goto handle_unusual; } break; } // int64 max_timestamp = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &max_timestamp_))); } else { goto handle_unusual; } break; } // int64 row_count = 3; case 3: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &row_count_))); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:milvus.proto.segcore.LoadFieldMeta) return true; failure: // @@protoc_insertion_point(parse_failure:milvus.proto.segcore.LoadFieldMeta) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void LoadFieldMeta::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:milvus.proto.segcore.LoadFieldMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // int64 min_timestamp = 1; if (this->min_timestamp() != 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(1, this->min_timestamp(), output); } // int64 max_timestamp = 2; if (this->max_timestamp() != 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(2, this->max_timestamp(), output); } // int64 row_count = 3; if (this->row_count() != 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(3, this->row_count(), output); } if (_internal_metadata_.have_unknown_fields()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:milvus.proto.segcore.LoadFieldMeta) } ::PROTOBUF_NAMESPACE_ID::uint8* LoadFieldMeta::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:milvus.proto.segcore.LoadFieldMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // int64 min_timestamp = 1; if (this->min_timestamp() != 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->min_timestamp(), target); } // int64 max_timestamp = 2; if (this->max_timestamp() != 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->max_timestamp(), target); } // int64 row_count = 3; if (this->row_count() != 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->row_count(), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:milvus.proto.segcore.LoadFieldMeta) return target; } size_t LoadFieldMeta::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:milvus.proto.segcore.LoadFieldMeta) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // int64 min_timestamp = 1; if (this->min_timestamp() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->min_timestamp()); } // int64 max_timestamp = 2; if (this->max_timestamp() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->max_timestamp()); } // int64 row_count = 3; if (this->row_count() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->row_count()); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void LoadFieldMeta::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:milvus.proto.segcore.LoadFieldMeta) GOOGLE_DCHECK_NE(&from, this); const LoadFieldMeta* source = ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LoadFieldMeta>( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.proto.segcore.LoadFieldMeta) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.proto.segcore.LoadFieldMeta) MergeFrom(*source); } } void LoadFieldMeta::MergeFrom(const LoadFieldMeta& from) { // @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.segcore.LoadFieldMeta) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from.min_timestamp() != 0) { set_min_timestamp(from.min_timestamp()); } if (from.max_timestamp() != 0) { set_max_timestamp(from.max_timestamp()); } if (from.row_count() != 0) { set_row_count(from.row_count()); } } void LoadFieldMeta::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:milvus.proto.segcore.LoadFieldMeta) if (&from == this) return; Clear(); MergeFrom(from); } void LoadFieldMeta::CopyFrom(const LoadFieldMeta& from) { // @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.segcore.LoadFieldMeta) if (&from == this) return; Clear(); MergeFrom(from); } bool LoadFieldMeta::IsInitialized() const { return true; } void LoadFieldMeta::InternalSwap(LoadFieldMeta* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); swap(min_timestamp_, other->min_timestamp_); swap(max_timestamp_, other->max_timestamp_); swap(row_count_, other->row_count_); } ::PROTOBUF_NAMESPACE_ID::Metadata LoadFieldMeta::GetMetadata() const { return GetMetadataStatic(); } // =================================================================== void LoadSegmentMeta::InitAsDefaultInstance() { } class LoadSegmentMeta::_Internal { public: }; LoadSegmentMeta::LoadSegmentMeta() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:milvus.proto.segcore.LoadSegmentMeta) } LoadSegmentMeta::LoadSegmentMeta(const LoadSegmentMeta& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), metas_(from.metas_) { _internal_metadata_.MergeFrom(from._internal_metadata_); total_size_ = from.total_size_; // @@protoc_insertion_point(copy_constructor:milvus.proto.segcore.LoadSegmentMeta) } void LoadSegmentMeta::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_LoadSegmentMeta_segcore_2eproto.base); total_size_ = PROTOBUF_LONGLONG(0); } LoadSegmentMeta::~LoadSegmentMeta() { // @@protoc_insertion_point(destructor:milvus.proto.segcore.LoadSegmentMeta) SharedDtor(); } void LoadSegmentMeta::SharedDtor() { } void LoadSegmentMeta::SetCachedSize(int size) const { _cached_size_.Set(size); } const LoadSegmentMeta& LoadSegmentMeta::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LoadSegmentMeta_segcore_2eproto.base); return *internal_default_instance(); } void LoadSegmentMeta::Clear() { // @@protoc_insertion_point(message_clear_start:milvus.proto.segcore.LoadSegmentMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; metas_.Clear(); total_size_ = PROTOBUF_LONGLONG(0); _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* LoadSegmentMeta::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // repeated .milvus.proto.segcore.LoadFieldMeta metas = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr -= 1; do { ptr += 1; ptr = ctx->ParseMessage(add_metas(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10); } else goto handle_unusual; continue; // int64 total_size = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { total_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool LoadSegmentMeta::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; // @@protoc_insertion_point(parse_start:milvus.proto.segcore.LoadSegmentMeta) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .milvus.proto.segcore.LoadFieldMeta metas = 1; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( input, add_metas())); } else { goto handle_unusual; } break; } // int64 total_size = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &total_size_))); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:milvus.proto.segcore.LoadSegmentMeta) return true; failure: // @@protoc_insertion_point(parse_failure:milvus.proto.segcore.LoadSegmentMeta) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void LoadSegmentMeta::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:milvus.proto.segcore.LoadSegmentMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated .milvus.proto.segcore.LoadFieldMeta metas = 1; for (unsigned int i = 0, n = static_cast<unsigned int>(this->metas_size()); i < n; i++) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( 1, this->metas(static_cast<int>(i)), output); } // int64 total_size = 2; if (this->total_size() != 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(2, this->total_size(), output); } if (_internal_metadata_.have_unknown_fields()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:milvus.proto.segcore.LoadSegmentMeta) } ::PROTOBUF_NAMESPACE_ID::uint8* LoadSegmentMeta::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:milvus.proto.segcore.LoadSegmentMeta) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated .milvus.proto.segcore.LoadFieldMeta metas = 1; for (unsigned int i = 0, n = static_cast<unsigned int>(this->metas_size()); i < n; i++) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( 1, this->metas(static_cast<int>(i)), target); } // int64 total_size = 2; if (this->total_size() != 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->total_size(), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:milvus.proto.segcore.LoadSegmentMeta) return target; } size_t LoadSegmentMeta::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:milvus.proto.segcore.LoadSegmentMeta) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated .milvus.proto.segcore.LoadFieldMeta metas = 1; { unsigned int count = static_cast<unsigned int>(this->metas_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( this->metas(static_cast<int>(i))); } } // int64 total_size = 2; if (this->total_size() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->total_size()); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void LoadSegmentMeta::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:milvus.proto.segcore.LoadSegmentMeta) GOOGLE_DCHECK_NE(&from, this); const LoadSegmentMeta* source = ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LoadSegmentMeta>( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.proto.segcore.LoadSegmentMeta) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.proto.segcore.LoadSegmentMeta) MergeFrom(*source); } } void LoadSegmentMeta::MergeFrom(const LoadSegmentMeta& from) { // @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.segcore.LoadSegmentMeta) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; metas_.MergeFrom(from.metas_); if (from.total_size() != 0) { set_total_size(from.total_size()); } } void LoadSegmentMeta::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:milvus.proto.segcore.LoadSegmentMeta) if (&from == this) return; Clear(); MergeFrom(from); } void LoadSegmentMeta::CopyFrom(const LoadSegmentMeta& from) { // @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.segcore.LoadSegmentMeta) if (&from == this) return; Clear(); MergeFrom(from); } bool LoadSegmentMeta::IsInitialized() const { return true; } void LoadSegmentMeta::InternalSwap(LoadSegmentMeta* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); CastToBase(&metas_)->InternalSwap(CastToBase(&other->metas_)); swap(total_size_, other->total_size_); } ::PROTOBUF_NAMESPACE_ID::Metadata LoadSegmentMeta::GetMetadata() const { return GetMetadataStatic(); } // =================================================================== void InsertRecord::InitAsDefaultInstance() { } class InsertRecord::_Internal { public: }; void InsertRecord::clear_fields_data() { fields_data_.Clear(); } InsertRecord::InsertRecord() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:milvus.proto.segcore.InsertRecord) } InsertRecord::InsertRecord(const InsertRecord& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), fields_data_(from.fields_data_) { _internal_metadata_.MergeFrom(from._internal_metadata_); num_rows_ = from.num_rows_; // @@protoc_insertion_point(copy_constructor:milvus.proto.segcore.InsertRecord) } void InsertRecord::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_InsertRecord_segcore_2eproto.base); num_rows_ = PROTOBUF_LONGLONG(0); } InsertRecord::~InsertRecord() { // @@protoc_insertion_point(destructor:milvus.proto.segcore.InsertRecord) SharedDtor(); } void InsertRecord::SharedDtor() { } void InsertRecord::SetCachedSize(int size) const { _cached_size_.Set(size); } const InsertRecord& InsertRecord::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_InsertRecord_segcore_2eproto.base); return *internal_default_instance(); } void InsertRecord::Clear() { // @@protoc_insertion_point(message_clear_start:milvus.proto.segcore.InsertRecord) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; fields_data_.Clear(); num_rows_ = PROTOBUF_LONGLONG(0); _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* InsertRecord::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // repeated .milvus.proto.schema.FieldData fields_data = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr -= 1; do { ptr += 1; ptr = ctx->ParseMessage(add_fields_data(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10); } else goto handle_unusual; continue; // int64 num_rows = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { num_rows_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool InsertRecord::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; // @@protoc_insertion_point(parse_start:milvus.proto.segcore.InsertRecord) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .milvus.proto.schema.FieldData fields_data = 1; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( input, add_fields_data())); } else { goto handle_unusual; } break; } // int64 num_rows = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &num_rows_))); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:milvus.proto.segcore.InsertRecord) return true; failure: // @@protoc_insertion_point(parse_failure:milvus.proto.segcore.InsertRecord) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void InsertRecord::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:milvus.proto.segcore.InsertRecord) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated .milvus.proto.schema.FieldData fields_data = 1; for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_data_size()); i < n; i++) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( 1, this->fields_data(static_cast<int>(i)), output); } // int64 num_rows = 2; if (this->num_rows() != 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(2, this->num_rows(), output); } if (_internal_metadata_.have_unknown_fields()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:milvus.proto.segcore.InsertRecord) } ::PROTOBUF_NAMESPACE_ID::uint8* InsertRecord::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:milvus.proto.segcore.InsertRecord) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated .milvus.proto.schema.FieldData fields_data = 1; for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_data_size()); i < n; i++) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( 1, this->fields_data(static_cast<int>(i)), target); } // int64 num_rows = 2; if (this->num_rows() != 0) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->num_rows(), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:milvus.proto.segcore.InsertRecord) return target; } size_t InsertRecord::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:milvus.proto.segcore.InsertRecord) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated .milvus.proto.schema.FieldData fields_data = 1; { unsigned int count = static_cast<unsigned int>(this->fields_data_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( this->fields_data(static_cast<int>(i))); } } // int64 num_rows = 2; if (this->num_rows() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->num_rows()); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void InsertRecord::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:milvus.proto.segcore.InsertRecord) GOOGLE_DCHECK_NE(&from, this); const InsertRecord* source = ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<InsertRecord>( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.proto.segcore.InsertRecord) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.proto.segcore.InsertRecord) MergeFrom(*source); } } void InsertRecord::MergeFrom(const InsertRecord& from) { // @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.segcore.InsertRecord) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; fields_data_.MergeFrom(from.fields_data_); if (from.num_rows() != 0) { set_num_rows(from.num_rows()); } } void InsertRecord::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:milvus.proto.segcore.InsertRecord) if (&from == this) return; Clear(); MergeFrom(from); } void InsertRecord::CopyFrom(const InsertRecord& from) { // @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.segcore.InsertRecord) if (&from == this) return; Clear(); MergeFrom(from); } bool InsertRecord::IsInitialized() const { return true; } void InsertRecord::InternalSwap(InsertRecord* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); CastToBase(&fields_data_)->InternalSwap(CastToBase(&other->fields_data_)); swap(num_rows_, other->num_rows_); } ::PROTOBUF_NAMESPACE_ID::Metadata InsertRecord::GetMetadata() const { return GetMetadataStatic(); } // @@protoc_insertion_point(namespace_scope) } // namespace segcore } // namespace proto } // namespace milvus PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::milvus::proto::segcore::RetrieveResults* Arena::CreateMaybeMessage< ::milvus::proto::segcore::RetrieveResults >(Arena* arena) { return Arena::CreateInternal< ::milvus::proto::segcore::RetrieveResults >(arena); } template<> PROTOBUF_NOINLINE ::milvus::proto::segcore::LoadFieldMeta* Arena::CreateMaybeMessage< ::milvus::proto::segcore::LoadFieldMeta >(Arena* arena) { return Arena::CreateInternal< ::milvus::proto::segcore::LoadFieldMeta >(arena); } template<> PROTOBUF_NOINLINE ::milvus::proto::segcore::LoadSegmentMeta* Arena::CreateMaybeMessage< ::milvus::proto::segcore::LoadSegmentMeta >(Arena* arena) { return Arena::CreateInternal< ::milvus::proto::segcore::LoadSegmentMeta >(arena); } template<> PROTOBUF_NOINLINE ::milvus::proto::segcore::InsertRecord* Arena::CreateMaybeMessage< ::milvus::proto::segcore::InsertRecord >(Arena* arena) { return Arena::CreateInternal< ::milvus::proto::segcore::InsertRecord >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
491a7dcfd3e00f912dbe038ab24a22ca35669087
4d2c78fddb365ec874b379ec9c6accbf142bd464
/ibubble/ibubble/Classes/scenes/SettingScene.h
3f3c283adf226499b85dc8bc41daecedf3082201
[]
no_license
lkeplei/QeeQoo
c5c695060756c6c6d622d25eccf9eea7a972408f
9ce31e28bb0d9dbd09af865c7584e6dfd45e7ac0
refs/heads/master
2021-01-10T08:15:51.900831
2015-01-09T13:42:41
2015-01-09T13:42:41
22,003,087
0
0
null
null
null
null
UTF-8
C++
false
false
2,501
h
SettingScene.h
// // SettingScene.h // ibubble // // Created by Ryan Yuan on 12-11-24. // Copyright (c) 2012年 __MyCompanyName__. All rights reserved. // #ifndef ibubble_SettingScene_h #define ibubble_SettingScene_h #include "cocos2d.h" #include <string> #include "GameMacros.h" #include "cocos-ext.h" USING_NS_CC_EXT; USING_NS_CC; NS_KAI_BEGIN #pragma mark- #pragma mark SettingScene class SettingScene : public cocos2d::CCLayer ,public cocos2d::extension::CCBSelectorResolver ,public cocos2d::extension::CCBMemberVariableAssigner ,public cocos2d::extension::CCNodeLoaderListener{ public: CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SettingScene, create); virtual ~SettingScene(); SettingScene(); static cocos2d::CCScene* scene(); static SettingScene* createWithCCB(); virtual void press_back(); virtual void press_next(); virtual void onEnter(); virtual void onExit(); void slidervalueChanged(CCObject * sender, CCControlEvent controlEvent); public: #pragma mark- #pragma mark CCBSelectorResolver virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName); virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName); #pragma mark- #pragma mark CCBMemberVariableAssigner virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode); #pragma mark- #pragma mark CCBNodeLoaderListener virtual void onNodeLoaded(CCNode * pNode, cocos2d::extension::CCNodeLoader * pNodeLoader); private: CCNode * _audio_node; CCNode * _bgmusic_node; }; #pragma mark- #pragma mark SettingSceneLayerLoader class SettingSceneLayerLoader:public cocos2d::extension::CCLayerLoader { public: CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(SettingSceneLayerLoader, loader); protected: CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(SettingScene); }; class SettingInLevelScene :public SettingScene { public: CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SettingInLevelScene, create); static cocos2d::CCScene* scene(); static SettingInLevelScene * createWithCCB(); virtual void press_back(); }; #pragma mark- #pragma mark SettingSceneLayerLoader class SettingInLevelSceneLayerLoader:public cocos2d::extension::CCLayerLoader { public: CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(SettingInLevelSceneLayerLoader, loader); protected: CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(SettingInLevelScene); }; NS_KAI_END #endif
33c2b44a1d6016d7e292af38f082cb2fd566ecfe
768a290ac7f08cb3ceb830922cad2efe60d540ef
/Engine/EntityManager.cpp
399995e87d21c466ed44adbd4faba89dc06d693c
[]
no_license
lim-james/-Old-Allure
5fa74861ef163e03ebf8d791b1bd35f1824a3271
4dc3ded3be5711bc7711618cb93c2bbe90a1c592
refs/heads/master
2022-04-01T05:18:41.213667
2020-01-23T17:37:26
2020-01-23T17:37:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
883
cpp
EntityManager.cpp
#include "EntityManager.h" #include "Transform.h" #include <Helpers/VectorHelpers.h> unsigned EntityManager::Create() { if (unused.empty()) Expand(); const unsigned id = unused.front(); unused.erase(unused.begin()); used.push_back(id); GetComponent<Transform>(id)->SetActive(true); return id; } EntityManager::~EntityManager() { for (auto& entity : entities) { for (auto& component : entity) { delete component.second; } entity.clear(); } entities.clear(); } void EntityManager::Destroy(const unsigned & id) { if (Helpers::Remove(used, id)) { for (auto& pair : entities[id]) { if (pair.second) { pair.second->Initialize(); pair.second->SetActive(false); } } unused.push_back(id); } } void EntityManager::Expand() { const unsigned id = entities.size(); entities.push_back({}); unused.push_back(id); AddComponent<Transform>(id); }
69cf786e492fce5655246cb3b8ee3c9a3364ac92
7579107b4bc53472e9a98d0dfdcc40979687a096
/apps/exercices/ch09_TextureMapping_Vulkan/TextureImage.h
a0c709584685158d4751c696b8228c39ae19f237
[]
no_license
cpvrlab/SLProject
d29ef6f62c7e044c0718dd6a1186272108607a2a
f624fbeb7fb69f3904c73ab73810734cac6962ce
refs/heads/master
2023-06-09T17:25:02.193744
2023-05-12T16:27:36
2023-05-12T16:27:36
30,246,579
58
30
null
2021-01-20T09:56:08
2015-02-03T14:26:56
C++
UTF-8
C++
false
false
2,139
h
TextureImage.h
#ifndef IMAGE_H #define IMAGE_H #include "Buffer.h" // forward decalaration class Buffer; class CommandBuffer; class Device; class Sampler; //----------------------------------------------------------------------------- // TODO: Rename to Image + remove sampler + make class Texture for textures (has a image and sampler) class TextureImage { public: TextureImage(Device& device) : _device{device} { ; } void destroy(); // Getter VkImage image() const { return _image; } VkImageView imageView() const { return _imageView; } Sampler& sampler() const { return *_sampler; } // Setter // void setSampler(Sampler& sampler) { _sampler = &sampler; } void createTextureImage(void* pixels, unsigned int texWidth, unsigned int texHeight); void createDepthImage(Swapchain& swapchain); private: void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties); void transitionImageLayout(VkImage& image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout); void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height); VkImageView createImageView(VkImage& image, VkFormat format, VkImageAspectFlags aspectFlags); public: Device& _device; VkImage _image; VkDeviceMemory _imageMemory; VkImageView _imageView; Sampler* _sampler = nullptr; }; //----------------------------------------------------------------------------- #endif
0eb2655264f7102591c31a49b8893e2c8855a5d8
fe3b751188aa334a58a6aabcbcc212bb4a7780be
/lib/include/adschain/crypto/Signer.h
b3960dd5b02e4aebc08f96e8b0850761d5af7354
[ "Apache-2.0" ]
permissive
apastor/ads-chain-cpp-library
a59c289a84ffb65486e03a077edbb348aef31a70
323d9c731f14031532dc072703d24e237d0a252e
refs/heads/master
2022-06-16T18:50:06.388333
2020-05-10T23:01:23
2020-05-10T23:01:23
262,840,390
2
0
null
null
null
null
UTF-8
C++
false
false
374
h
Signer.h
#pragma once #include <string> #include <openssl/evp.h> #include "adschain/crypto/PrivateKey.h" namespace adschain { class Signer { public: virtual std::string signB64(std::string str) = 0; }; fruit::Component<PrivateKey, Signer> getSignerComponent(); fruit::Component<PrivateKey, Signer> getSignerComponentFromFile(const char *filePath); } // namespace adschain
a798f3aff1ae225b2abac3186c3ee6aa974abea5
d228c045d5a49edba42108e69521a71c32eb4bb2
/nebula/net/engine/rpc_client.h
b53d4a3cc5d6179977899a32a3dbbc269fa3f7f9
[ "Apache-2.0" ]
permissive
iineva/nebula
11a889ad0fc1ba1cc2ac6f8258336c2dc73dae24
feb4f309d896210aeda7a606d38aab4af5cb6ada
refs/heads/master
2021-02-12T09:23:00.307402
2020-03-13T04:28:05
2020-03-13T04:28:05
244,581,726
0
0
Apache-2.0
2020-03-03T08:30:42
2020-03-03T08:30:41
null
UTF-8
C++
false
false
1,203
h
rpc_client.h
/* * Copyright (c) 2016, https://github.com/zhatalk * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NEBULA_NET_ENGINE_RPC_CLIENT_H_ #define NEBULA_NET_ENGINE_RPC_CLIENT_H_ #include "nebula/net/engine/tcp_client.h" namespace nebula { template <typename Pipeline = DefaultPipeline> class RpcClient : public TcpClient<Pipeline> { public: RpcClient(const ServiceConfig& config, const IOThreadPoolExecutorPtr& io_group) : TcpClient<Pipeline>(config, io_group) { } virtual ~RpcClient() = default; // Impl from TcpServiceBase ServiceModuleType GetModuleType() const override { return ServiceModuleType::RPC_CLIENT; } }; } #endif
6a62653c54727fe56385f90bd8cd60a0461e333c
99e0cb2bf37987e10b1f79c3e7712438da5e522e
/src/GraphicGenerator.cpp
f3e48d67bbcf6b5a572e646d3c0b0d64156ff23e
[]
no_license
urbanpixellab/DRaaimolen2019_ArtnetControler
1dae0a7fcbe0b02329bf5bf2973b56586dd15769
1057ccee4774b22b373476c3c397bd6a0932a17c
refs/heads/master
2020-06-04T09:14:58.003588
2019-09-14T07:48:33
2019-09-14T07:48:33
191,960,880
0
0
null
null
null
null
UTF-8
C++
false
false
2,160
cpp
GraphicGenerator.cpp
// // GraphicGenerator.cpp // Sequencer // // Created by Enrico Becker on 14/08/2019. // #include "GraphicGenerator.hpp" GraphicGenerator::GraphicGenerator() { shader.load("test.vert","test.frag"); mesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); mesh.addVertex(ofVec3f(0,0,0)); mesh.addTexCoord(ofVec2f(0,0)); mesh.addVertex(ofVec3f(100,0,0)); mesh.addTexCoord(ofVec2f(100,0)); mesh.addVertex(ofVec3f(0,100,0)); mesh.addTexCoord(ofVec2f(0,100)); mesh.addVertex(ofVec3f(100,100,0)); mesh.addTexCoord(ofVec2f(100,100)); previewShader.load("test2.vert","test2.frag"); } GraphicGenerator::~GraphicGenerator(){} void GraphicGenerator::drawToFbo(ofFbo &screen,ofTexture &tex,float &delta,float &bright,float &master,float &freq,float &shift,ofColor &ca,ofColor &cb) { screen.begin(); ofClear(0, 0, 0); shader.begin(); shader.setUniform1f("freq",freq*10); shader.setUniform2f("res",ofVec2f(100,100)); shader.setUniform1f("bright", bright*master); shader.setUniform1f("shift",shift *delta * 200);//delta time removed delta shader.setUniform3f("colA", ca.r/255.,ca.g/255.,ca.b/255.); shader.setUniform3f("colB", cb.r,cb.g,cb.b); shader.setUniformTexture("tex",tex, 0); mesh.draw(); shader.end(); screen.end(); } void GraphicGenerator::drawToPreviewFbo(ofFbo &screen,ofTexture &tex,float &delta,float &bright,float &master,float &freq,float &shift,ofColor &ca,ofColor &cb) { screen.begin(); ofClear(0, 0, 0); previewShader.begin(); previewShader.setUniform1f("freq",freq*10); previewShader.setUniform2f("res",ofVec2f(100,100)); previewShader.setUniform1f("bright", bright*master); previewShader.setUniform1f("shift",shift *delta * 200);//delta time removed delta previewShader.setUniform3f("colA", ca.r/255.,ca.g/255.,ca.b/255.); previewShader.setUniform3f("colB", cb.r,cb.g,cb.b); previewShader.setUniformTexture("tex",tex, 0); mesh.draw(); previewShader.end(); screen.end(); } void GraphicGenerator::reloadShader() { shader.load("test.vert","test.frag"); previewShader.load("test2.vert","test2.frag"); }
aac0d2cd06c32052033cc3fbf047d41acf06cb4d
6247051fc105ee0f7847c9ad7d64e6dd22e2e5e2
/codeforces/527-A/527-A-23230100.cpp
59dcfbc8ead13a1b68abb4590ec04d13fe6b2391
[]
no_license
satishrdd/comp-coding
5aa01c79bd1269287f588a064d5d09f824daa8fd
96d22817488d55623d77a2e7f3d4ef0955028086
refs/heads/master
2020-04-07T06:50:53.743622
2017-04-16T09:05:25
2017-04-16T09:05:25
46,654,615
1
1
null
null
null
null
UTF-8
C++
false
false
293
cpp
527-A-23230100.cpp
#include<iostream> #include<bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { /* code */ long long a,b,count=0; cin>>a>>b; while(a>0 && b>0){ if(a>=b){ count+=a/b; a = a%b; }else{ count+=b/a; b = b%a; } } cout<<count<<endl; return 0; }
22bcc2baa3530987bbef7b8c46c0db5c7719b066
db32e1a75c36287fdd150f88e4a2e6b778337ced
/Chapter1/3_urlify.cpp
26b49e281241c05a75fb8ebf737e371ba051b519
[]
no_license
jlstr/CtCi6
fd5eea779c513bb611b2b92cc26a32800fcbced4
0267b9fc1fd5db2d23d4a9e4f1ab5f6bc7515cc9
refs/heads/master
2020-12-02T19:21:25.664740
2018-11-26T20:36:10
2018-11-26T20:36:10
96,328,126
1
0
null
null
null
null
UTF-8
C++
false
false
549
cpp
3_urlify.cpp
#include <iostream> #include <string> #include <sstream> using namespace std; std::string urlify(const string&, const int); int main() { const string str = "Mr John Smith "; const int size = 13; cout << urlify(str, size) << endl; return 0; } std::string urlify(const string &original, const int size) { std::stringstream stream; for (string::size_type i = 0; static_cast<int>(i) < size; ++i) { if (i > 0 && original[i] == ' ') { stream << "%20"; } else stream << original[i]; } return stream.str(); }
705296ed838da3d1824300f6ce7bec238e5610d8
b4803e8dbacb16bde18818a51cc57bfa1341779c
/src/imageFilters/ImageFilter.cpp
3252e8d815aca6e794181e4689d54b261edd5e7f
[]
no_license
HustStevenZ/OclExample
97dbec79c72bb7042f31d37c3f4befd944b1fd83
3aa4f47a0d5ab0d8eda1915d8c1bde945f0d05ae
refs/heads/master
2020-04-06T09:03:56.023997
2016-08-31T11:39:21
2016-08-31T11:39:21
63,135,775
0
0
null
null
null
null
UTF-8
C++
false
false
15,963
cpp
ImageFilter.cpp
// // Created by Sanqian on 16/7/8. // #include <cassert> #include <src/io/clSource.h> #include <iostream> #include "ImageFilter.h" #ifdef __APPLE__ #include <OpenGL/gl.h> #endif ////////////////////////// // 3*3 Filter //[ * * * ] //[ * * * ] * 1/factorsum //[ * * * ] //////////////////////// std::string imageFilterKernel="/*********\n" "*\n" "*Author: Sanqian Zhao\n" "**********/\n" "\n" "__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;\n" "\n" "__kernel void image_filter( __read_only image2d_t input, __write_only image2d_t output,__global float* filter) {\n" "\n" " int width = get_global_size(0);\n" " int height = get_global_size(1);\n" " int2 coord = (int2)(get_global_id(0),get_global_id(1));\n" "\n" " int2 leftupCord = (int2)(coord.x-1,coord.y-1);\n" " int2 upCord = (int2)(coord.x,coord.y);\n" " int2 rightupCord = (int2)(coord.x+1,coord.y-1);\n" " int2 leftCord = (int2)(coord.x-1,coord.y);\n" " int2 rightCord = (int2)(coord.x+1,coord.y);\n" " int2 leftDowCord= (int2)(coord.x-1,coord.y+1);\n" " int2 downCord = (int2)(coord.x,coord.y+1);\n" " int2 rightDownCord = (int2)(coord.x+1,coord.y+1);\n" "\n" " //BOUNARY\n" " //Treat column[0]=column1,clumn[width+1]=column[width] etc\n" " if(coord.x==1)\n" " {\n" " leftupCord.x=1;\n" " leftCord.x=1;\n" " leftDowCord.x=1;\n" " }\n" " if(coord.x==width)\n" " {\n" " rightCord.x=width;\n" " rightDownCord.x=width;\n" " rightupCord.x=width;\n" " }\n" " if(coord.y==1)\n" " {\n" " leftupCord.y=1;\n" " upCord.y=1;\n" " rightupCord.y=1;\n" " }\n" " if(coord.y==height)\n" " {\n" " leftDowCord.y=height;\n" " downCord.y=height;\n" " rightDownCord.y=height;\n" " }\n" " uint4 pixel = read_imageui(input,sampler,coord);\n" " uint4 pleftup = read_imageui(input,sampler,leftupCord);\n" " uint4 pup = read_imageui(input,sampler,upCord);\n" " uint4 prightup = read_imageui(input,sampler,rightupCord);\n" " uint4 pleft = read_imageui(input,sampler,leftCord);\n" " uint4 pright = read_imageui(input,sampler,rightCord);\n" " uint4 pleftdown = read_imageui(input,sampler,leftDowCord);\n" " uint4 pdown = read_imageui(input,sampler,downCord);\n" " uint4 prightdown = read_imageui(input,sampler,rightDownCord);\n" "\n" "\n" " if(get_image_channel_data_type(input) == CLK_UNORM_INT8)\n" " {\n" " pixel = convert_uint4(read_imagef(input,sampler,coord)*255);\n" " pleftup = convert_uint4(read_imagef(input,sampler,leftupCord)*255);\n" " pup = convert_uint4(read_imagef(input,sampler,upCord)*255);\n" " prightup = convert_uint4(read_imagef(input,sampler,rightupCord)*255);\n" " pleft = convert_uint4(read_imagef(input,sampler,leftCord)*255);\n" " pright = convert_uint4(read_imagef(input,sampler,rightCord)*255);\n" " pleftdown = convert_uint4(read_imagef(input,sampler,leftDowCord)*255);\n" " pdown = convert_uint4(read_imagef(input,sampler,downCord)*255);\n" " prightdown = convert_uint4(read_imagef(input,sampler,rightDownCord)*255);\n" "\n" " }\n" "\n" "\n" " uint4 resultpixelf =convert_uint4((convert_float4(pleftup)*filter[0]+convert_float4(pup)*filter[1]+convert_float4(prightup)*filter[2]+\n" " convert_float4(pleft)*filter[3]+convert_float4(pixel)*filter[4]+convert_float4(pright)*filter[5]+\n" " convert_float4(pleftdown)*filter[6]+convert_float4(pdown)*filter[7]+convert_float4(prightdown)*filter[8]));\n" "\n" " write_imageui(output,coord,resultpixelf);\n" " }"; ImageFilter::ImageFilter() { _program = _context->createProgramFromSource(imageFilterKernel); _kernel = _program->createKernel("image_filter"); } QImage* ImageFilter::blurImage(QImage *image) { float filter[9]={ 1.0/16.0,2.0/16.0,1.0/16.0, 2.0f/16.0, 4.0f/16.0,2.0f/16.0, 1.0f/16.0,2.0f/16.0,1.0f/16.0}; return filterImage3x3(image,filter); } QImage* ImageFilter::sharpingImage(QImage *image) { float filter[9]={-1.0,-1.0,-1.0, -1.0,9.0,-1.0, -1.0,-1.0,-1.0}; return filterImage3x3(image,filter); } QImage* ImageFilter::embossingImage(QImage *image) { float filter[9]={-1.0f,-0.5f,-0.0f, -0.5f,0.5f,0.5f, 0.0f,0.5f,1.0f}; return filterImage3x3(image,filter); } QImage* ImageFilter::blurImage(GLuint textureObj,int width,int height) { float filter[9]={ 1.0/16.0,2.0/16.0,1.0/16.0, 2.0f/16.0, 4.0f/16.0,2.0f/16.0, 1.0f/16.0,2.0f/16.0,1.0f/16.0}; return filterImage3x3(textureObj,filter,width,height); } QImage* ImageFilter::embossingImage(GLuint textureObj,int width,int height) { float filter[9]={-1.0f,-0.5f,-0.0f, -0.5f,0.5f,0.5f, 0.0f,0.5f,1.0f}; return filterImage3x3(textureObj,filter,width,height); } QImage* ImageFilter::sharpingImage(GLuint textureObj,int width,int height) { float filter[9]={-1.0,-1.0,-1.0, -1.0,9.0,-1.0, -1.0,-1.0,-1.0}; return filterImage3x3(textureObj,filter,width,height); } QImage* ImageFilter::filterImage3x3(GLuint textureObj, const float *filter,int width,int height) { OclKernel* oclKernel=_kernel; cl_image_format rgb_format; rgb_format.image_channel_order = CL_RGBA; rgb_format.image_channel_data_type = CL_UNSIGNED_INT8; int w = width; int h = height; OclImage *inputBuffer = _context->createImage2DFromGLTex(OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,0,textureObj); if(inputBuffer== nullptr) return nullptr; int ifsize; // clGetImageInfo(inputBuffer->getClBuffer(),CL_IMAGE_FORMAT, sizeof(cl_image_format),&rgb_format,NULL); OclImage *outputBuffer =_context->createImage2D(OclBuffer::BufferMode::OCL_BUFFER_WRITE_ONLY,&rgb_format,w,h,w*4,NULL); OclBuffer *filterBuffer = _context->createBuffer(9*sizeof(float),OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,NULL); _context->enqueueWriteBuffer(filterBuffer,0,9*sizeof(float),(char*)(filter)); oclKernel->setKernelArgBuffer(0,inputBuffer); oclKernel->setKernelArgBuffer(1,outputBuffer); oclKernel->setKernelArgBuffer(2,filterBuffer); size_t local_w = 16; size_t local_h = 16; size_t work_size[]= {((size_t)w/local_w)*local_w,((size_t)h/local_h)*local_h}; size_t local_size[]={local_w,local_h}; size_t offset_size[]={work_size[0]%local_w,work_size[1]%local_h}; _context->enqueueKernel(oclKernel,2,offset_size,work_size,local_size); _context->flush(); unsigned int* buffer = new unsigned int[w*h]; _context->enqueueReadImage2D(outputBuffer,w,h,(char*)buffer); // _context->enqueueReadImage2D(inputBuffer,w,h,(char*)buffer); QSize imageSize(w,h); // if(rgb_format.image_channel_data_type==CL_RGBA // && rgb_format.image_channel_data_type == CL_UNORM_INT8) QImage *resultImage = new QImage(imageSize,QImage::Format_RGBX8888); // QRgb *imageData = new QRgb[image->width()*image->height()]; for(int i = 0;i<w;i++) { for(int j=0;j<h;j++) { int index = w*j+i; int alpha=((*(buffer+index))&0xff000000)>>24; int blue=((*(buffer+index))&0x00ff0000)>>16; int green=((*(buffer+index))&0x0000ff00)>>8; int red=((*(buffer+index))&0x000000ff); // *(imageData+index)=qRgba(red,green,blue,alpha); resultImage->setPixel(i,j,qRgba(red,green,blue,alpha)); //resultImage->setColor(index,qRgba(red,green,blue,alpha)); } } delete inputBuffer; // delete outputBuffer; // delete filterBuffer; // delete data; delete buffer; return resultImage; } QImage* ImageFilter::filterImage3x3(QImage *image, const float *filter){ // clSource source("cl/imageFilters/programes/imageFilter.cl"); OclKernel* oclKernel=_kernel; cl_image_format rgb_format; rgb_format.image_channel_order = CL_RGBA; rgb_format.image_channel_data_type = CL_UNSIGNED_INT8; cl_event profileevent; OclImage *inputBuffer =_context->createImage2D(OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,&rgb_format,image->width(),image->size().height(),image->width()*4,NULL); OclImage *outputBuffer =_context->createImage2D(OclBuffer::BufferMode::OCL_BUFFER_WRITE_ONLY,&rgb_format,image->width(),image->size().height(),image->width()*4,NULL); OclBuffer *filterBuffer = _context->createBuffer(9*sizeof(float),OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,NULL); _context->enqueueWriteBuffer(filterBuffer,0,9*sizeof(float),(char*)(filter)); unsigned int *data = new unsigned int[image->width()*image->height()]; for(int i = 0;i<image->width();i++) { for(int j=0;j<image->height();j++) { int index = image->width()*j+i; QRgb color = image->pixel(i,j); *(data+image->width()*j+i)=0x00000000; *(data+image->width()*j+i)|=(0xff000000&(qRed(color)<<24)); *(data+image->width()*j+i)|=(0x00ff0000&(qGreen(color)<<16)); *(data+image->width()*j+i)|=(0x0000ff00&(qBlue(color)<<8)); *(data+image->width()*j+i)|=(0x000000ff&(qAlpha(color))); // *(data+image->width()*j+i)=0xff000000; } } _context->enqueueWriteImage2D(inputBuffer,image->width(),image->height(),(char*)(data)); oclKernel->setKernelArgBuffer(0,inputBuffer); oclKernel->setKernelArgBuffer(1,outputBuffer); oclKernel->setKernelArgBuffer(2,filterBuffer); size_t local_w = 16; size_t local_h = 16; size_t work_size[]= {((size_t)image->width()/local_w)*local_w,((size_t)image->height()/local_h)*local_h}; size_t local_size[]={local_w,local_h}; size_t offset_size[]={work_size[0]%local_w,work_size[1]%local_h}; // clEnqueueNDRangeKernel(_context->get_command_queue(),oclKernel->getClKernel(),2,offset_size,work_size,local_size,0,NULL,&profileevent); _context->enqueueKernel(oclKernel,2,offset_size,work_size,local_size,profileevent); _context->flush(); unsigned int* buffer = new unsigned int[image->width()*image->height()]; _context->enqueueReadImage2D(outputBuffer,image->width(),image->height(),(char*)buffer); QSize imageSize(image->width(),image->height()); QImage *resultImage = new QImage(imageSize,QImage::Format_RGBX8888); // QRgb *imageData = new QRgb[image->width()*image->height()]; for(int i = 0;i<image->width();i++) { for(int j=0;j<image->height();j++) { int index = image->width()*j+i; int red=((*(buffer+index))&0xff000000)>>24; int green=((*(buffer+index))&0x00ff0000)>>16; int blue=((*(buffer+index))&0x0000ff00)>>8; int alpha=((*(buffer+index))&0x000000ff); // *(imageData+index)=qRgba(red,green,blue,alpha); resultImage->setPixel(i,j,qRgba(red,green,blue,alpha)); //resultImage->setColor(index,qRgba(red,green,blue,alpha)); } } cl_int start,end; size_t return_size; clGetEventProfilingInfo(profileevent,CL_PROFILING_COMMAND_START, sizeof(cl_int),&start,&return_size); clGetEventProfilingInfo(profileevent,CL_PROFILING_COMMAND_END, sizeof(cl_int),&end,&return_size); std::cout<<"kernel finished in "<< end-start<< "ns"<<std::endl; delete inputBuffer; delete outputBuffer; delete filterBuffer; delete data; delete buffer; return resultImage; } std::string ImageFilter::testHelloWorld() { clSource source("cl/imageFilters/programes/helloKernel.cl"); OclProgram *oclProgram = _context->createProgramFromSource(source.getSource()); OclKernel *oclKernel = oclProgram->createKernel("hello_kernel"); OclBuffer *inputoclBuffer = _context->createBuffer(1024*sizeof(int),OclBuffer::BufferMode::OCL_BUFFER_WRITE_ONLY,NULL); oclKernel->setKernelArgBuffer(0,inputoclBuffer); size_t work_size= 1024; _context->enqueueKernel(oclKernel,1,NULL,&work_size,NULL); _context->flush(); char* buffer = new char[1024*sizeof(int)]; _context->enqueueReadBuffer(inputoclBuffer,0,1024*sizeof(int),(buffer)); return std::string(buffer); } QImage* ImageFilter::blurImage(QOpenGLTexture *textureObj) { float filter[9]={ 1.0/16.0,2.0/16.0,1.0/16.0, 2.0f/16.0, 4.0f/16.0,2.0f/16.0, 1.0f/16.0,2.0f/16.0,1.0f/16.0}; return filterImage3x3(textureObj,filter); } QImage* ImageFilter::sharpingImage(QOpenGLTexture *textureObj) { } QImage* ImageFilter::embossingImage(QOpenGLTexture *textureObj) { } QImage* ImageFilter::filterImage3x3(QOpenGLTexture *textureObj, const float *filter) { OclKernel* oclKernel=_kernel; cl_image_format rgb_format; rgb_format.image_channel_order = CL_RGBA; rgb_format.image_channel_data_type = CL_UNSIGNED_INT8; int w, h; int miplevel = 0; w = textureObj->width(); h = textureObj->height(); // glBindTexture(GL_TEXTURE_2D,textureObj); int err=CL_FALSE; OclImage *inputBuffer = _context->createImage2DFromGLTex(OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,0,textureObj->textureId()); if(inputBuffer== nullptr) return nullptr; OclImage *outputBuffer =_context->createImage2D(OclBuffer::BufferMode::OCL_BUFFER_WRITE_ONLY,&rgb_format,w,h,w*4,NULL); OclBuffer *filterBuffer = _context->createBuffer(9*sizeof(float),OclBuffer::BufferMode::OCL_BUFFER_READ_ONLY,NULL); _context->enqueueWriteBuffer(filterBuffer,0,9*sizeof(float),(char*)(filter)); oclKernel->setKernelArgBuffer(0,inputBuffer); oclKernel->setKernelArgBuffer(1,outputBuffer); oclKernel->setKernelArgBuffer(2,filterBuffer); size_t local_w = 16; size_t local_h = 16; size_t work_size[]= {((size_t)w/local_w)*local_w,((size_t)h/local_h)*local_h}; size_t local_size[]={local_w,local_h}; size_t offset_size[]={work_size[0]%local_w,work_size[1]%local_h}; _context->enqueueKernel(oclKernel,2,offset_size,work_size,local_size); _context->flush(); unsigned int* buffer = new unsigned int[w*h]; // _context->enqueueReadImage2D(outputBuffer,w,h,(char*)buffer); QSize imageSize(w,h); QImage *resultImage = new QImage(imageSize,QImage::Format_RGBX8888); // QRgb *imageData = new QRgb[image->width()*image->height()]; for(int i = 0;i<w;i++) { for(int j=0;j<h;j++) { int index = w*j+i; int red=((*(buffer+index))&0xff000000)>>24; int green=((*(buffer+index))&0x00ff0000)>>16; int blue=((*(buffer+index))&0x0000ff00)>>8; int alpha=((*(buffer+index))&0x000000ff); // *(imageData+index)=qRgba(red,green,blue,alpha); resultImage->setPixel(i,j,qRgba(red,green,blue,alpha)); //resultImage->setColor(index,qRgba(red,green,blue,alpha)); } } delete inputBuffer; delete outputBuffer; delete filterBuffer; // delete data; delete buffer; return resultImage; }
7837d10fa00581c9dc7758c061d68ea2fdf6535b
905a210043c8a48d128822ddb6ab141a0d583d27
/viewer/mainwindow.cpp
c9f434fec9e94290e89e87423f489527dee71e1a
[]
no_license
mweiguo/sgt
50036153c81f35356e2bfbba7019a8307556abe4
7770cdc030f5e69fef0b2150b92b87b7c8b56ba5
refs/heads/master
2020-04-01T16:32:21.566890
2011-10-31T04:35:02
2011-10-31T04:35:02
1,139,668
0
0
null
null
null
null
UTF-8
C++
false
false
10,087
cpp
mainwindow.cpp
#include <QtGui> #include <QActionGroup> #include <QList> #include "mainwindow.h" #include "sgr_render2d.h" #include "layermanagerwidget.h" #include "tools.h" #include <exception> #include <iostream> #include <list> using namespace std; MainWindow::MainWindow() { doc = new Document; context = new ViewerContext; context->doc = doc; context->mainwindow = this; QGLFormat fmt; fmt.setDepth ( true ); fmt.setDoubleBuffer ( true ); fmt.setRgba ( true ); shareWidget = new QGLWidget ( fmt ); // displayer mainviewtools = new Tools ( context, 0 ); ToolsEntry entry[] = { {Tools::NONE_TOOL, new NoneTool(mainviewtools)}, {Tools::ZOOM_TOOL, new ZoomTool(mainviewtools)}, {Tools::HAND_TOOL, new HandTool(mainviewtools)}, {0, 0} }; mainviewtools->setTools ( entry ); GLMainView* mainview = new GLMainView(context, mainviewtools, &(doc->sceneid), fmt, 0, shareWidget ); displayer = new GLScrollWidget ( context, mainview ); mainviewtools->parent = displayer; // birdview birdview = new GLBirdView (context, 0, &(doc->sceneid), fmt, 0, shareWidget ); connect ( displayer, SIGNAL(transformChanged(float,float,float,float)), this, SLOT(onMainViewTransformChanged(float,float,float,float)) ); setCentralWidget(displayer); createActions(); createMenus(); createToolBars(); createStatusBar(); createDockWindows(); setWindowTitle(tr("Dock Widgets")); setUnifiedTitleAndToolBarOnMac(true); setMouseTracking ( false ); r2d_init (); } MainWindow::~MainWindow() { delete context; delete doc; delete mainviewtools; delete shareWidget; } void MainWindow::init () { doc->init ( displayer->widget, shareWidget ); } void MainWindow::open() { try { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a file name"), ".", tr("SLC (*.slc *.slc)")); if (fileName.isEmpty()) return; cout << "file name = " << fileName.toStdString() << endl; open ( fileName.toStdString().c_str() ); } catch ( exception& ex ) { cout << ex.what() << endl; } } void MainWindow::open ( const char* filename ) { doc->openScene ( displayer->widget, filename ); layerManagerWidget->loadFromScene ( doc->sceneid ); displayer->homeposition(); birdview->homeposition(); } void MainWindow::about() { QMessageBox::about(this, tr("About Dock Widgets"), tr("The <b>Dock Widgets</b> example demonstrates how to " "use Qt's dock widgets. You can enter your own text, " "click a customer to add a customer name and " "address, and click standard paragraphs to add them.")); } void MainWindow::actionEvent( QAction* action ) { try { if ( action == winzoomAct ) displayer->widget->tools->selectTool ( Tools::ZOOM_TOOL ); else if ( action == handAct ) displayer->widget->tools->selectTool ( Tools::HAND_TOOL ); } catch ( exception& ex ) { cerr << ex.what() << endl; } } //================================================================================ void MainWindow::onMainViewTransformChanged(float x1, float y1, float x2, float y2 ) { try { // cout << "-----------------MainWindow::onMainViewTransformChanged" << endl; if ( doc->birdviewmiscid != -1 ) { if ( birdview->rectid == -1 ) { int sid = doc->birdviewmiscid; r2d_to_element ( sid, R2D_ROOT ); r2d_to_element ( sid, R2D_FIRST_CHILD ); // layer r2d_to_element ( sid, R2D_FIRST_CHILD ); // lod r2d_to_element ( sid, R2D_FIRST_CHILD ); // lodpage birdview->rectid = r2d_to_element ( sid, R2D_FIRST_CHILD ); // rect } float pnts[] = {x1, y1, 2.1, x2, y2, 2.1 }; r2d_rect_points ( doc->birdviewmiscid, birdview->rectid, pnts ); // cout << "r2d_rect_points (" << doc->birdviewmiscid << ", " << birdview->rectid << ", " << x1 << ", " << y1 << ", " << // 50 << ", " << x2 << ", " << y2 << ", " << 50 << " )" << endl; birdview->update(); } } catch ( exception& ex ) { cerr << ex.what() << endl; } } //================================================================================ void MainWindow::createActions() { openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open a New Scene")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); quitAct = new QAction(tr("&Quit"), this); QList<QKeySequence> lst; lst.push_back ( QKeySequence::Quit ); lst.push_back ( QKeySequence( Qt::Key_Escape ) ); quitAct->setShortcuts( lst ); quitAct->setStatusTip(tr("Quit the application")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); lst.clear(); lst.push_back ( QKeySequence::ZoomIn ); lst.push_back ( QKeySequence (Qt::CTRL + Qt::Key_PageUp) ); zoominAct = new QAction(QIcon(":/images/zoomin.png"), tr("&ZoomIn..."), this); zoominAct->setAutoRepeat ( true ); zoominAct->setShortcuts( lst ); zoominAct->setStatusTip(tr("Zoom In Scene")); connect(zoominAct, SIGNAL(triggered()), displayer, SLOT(zoomin())); lst.clear(); lst.push_back ( QKeySequence::ZoomOut ); lst.push_back ( QKeySequence (Qt::CTRL + Qt::Key_PageDown) ); zoomoutAct = new QAction(QIcon(":/images/zoomout.png"), tr("&ZoomOut..."), this); zoomoutAct->setAutoRepeat ( true ); zoomoutAct->setShortcuts( lst ); zoomoutAct->setStatusTip(tr("Zoom Out Scene")); connect(zoomoutAct, SIGNAL(triggered()), displayer, SLOT(zoomout())); winzoomAct = new QAction(QIcon(":/images/windowzoom.png"), tr("&Window Zoom..."), this); winzoomAct->setStatusTip(tr("window Zoom tool")); winzoomAct->setCheckable ( true ); handAct = new QAction(QIcon(":/images/hand.png"), tr("&HandMove..."), this); handAct->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_P ) ); handAct->setStatusTip(tr("use a hand tool to move the canvas")); handAct->setCheckable ( true ); navigroup = new QActionGroup( this ); navigroup->setExclusive ( true ); navigroup->addAction ( winzoomAct ); navigroup->addAction ( handAct ); connect(navigroup, SIGNAL(triggered(QAction*)), this, SLOT(actionEvent(QAction*))); leftAct = new QAction(tr("Left Translate "), this); leftAct->setShortcut( QKeySequence( Qt::Key_Left ) ); leftAct->setStatusTip(tr("move objects left")); connect(leftAct, SIGNAL(triggered()), displayer, SLOT(lefttranslate())); rightAct = new QAction(tr("Right Translate"), this); rightAct->setShortcut( QKeySequence( Qt::Key_Right ) ); rightAct->setStatusTip(tr("move objects right")); connect(rightAct, SIGNAL(triggered()), displayer, SLOT(righttranslate())); upAct = new QAction(tr("&Up Translate"), this); upAct->setShortcut( QKeySequence( Qt::Key_Up ) ); upAct->setStatusTip(tr("move objects up")); connect(upAct, SIGNAL(triggered()), displayer, SLOT(uptranslate())); downAct = new QAction(tr("&Down Translate"), this); downAct->setShortcut( QKeySequence( Qt::Key_Down ) ); downAct->setStatusTip(tr("move objects down")); connect(downAct, SIGNAL(triggered()), displayer, SLOT(downtranslate())); fullextentAct = new QAction(QIcon(":/images/home_32.png"), tr("&view whole scene ..."), this); fullextentAct->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_H ) ); fullextentAct->setStatusTip(tr("to home position")); connect(fullextentAct, SIGNAL(triggered()), displayer, SLOT(homeposition())); } void MainWindow::createMenus() { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(openAct); fileMenu->addSeparator(); fileMenu->addAction(quitAct); viewMenu = menuBar()->addMenu(tr("&View")); viewMenu->addAction(zoominAct); viewMenu->addAction(zoomoutAct); viewMenu->addActions( navigroup->actions()); // viewMenu->addAction(winzoomAct); // viewMenu->addAction(handAct); viewMenu->addAction(leftAct); viewMenu->addAction(rightAct); viewMenu->addAction(upAct); viewMenu->addAction(downAct); viewMenu->addAction(fullextentAct); menuBar()->addSeparator(); helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(aboutAct); helpMenu->addAction(aboutQtAct); } void MainWindow::createToolBars() { fileToolBar = addToolBar(tr("File")); fileToolBar->addAction(openAct); navToolBar = addToolBar(tr("Navigation")); navToolBar->addAction(fullextentAct); navToolBar->addActions( navigroup->actions()); // navToolBar->addAction(handAct); // navToolBar->addAction(winzoomAct); navToolBar->addAction(zoominAct); navToolBar->addAction(zoomoutAct); } void MainWindow::createStatusBar() { statusBar()->showMessage(tr("Ready")); } void MainWindow::createDockWindows() { QDockWidget *dock = new QDockWidget(tr("Layers"), this); list<QGLWidget*> lst; lst.push_back ( displayer->widget ); lst.push_back ( birdview ); layerManagerWidget = new LayerManagerWidget(lst, dock); dock->setWidget(layerManagerWidget); addDockWidget(Qt::RightDockWidgetArea, dock); dock = new QDockWidget(tr("birdview"), this); dock->setMinimumSize ( 230, 200 ); dock->setMaximumSize ( 230, 200 ); dock->setWidget(birdview); addDockWidget(Qt::RightDockWidgetArea, dock); }
3ecdc8730fcd9f637dd008e4eafc279cfc4ecc3c
c13cf8f0375e1d904d2dfebd5db9ead8404c8a38
/17 Letter Combinations of a Phone Num.cpp
01d4227001493e171a8e6dfed41c5641ff162158
[]
no_license
xuzhaocheng/LeetCode
f92eec2aa0de06ed8c8f2d41fa5f86064dd6efcb
53b54f0bc81c15589be06ea8ef17ebe7fe2bc4f3
refs/heads/master
2016-09-11T12:13:08.172151
2015-02-26T15:14:04
2015-02-26T15:14:04
31,371,452
1
0
null
null
null
null
GB18030
C++
false
false
989
cpp
17 Letter Combinations of a Phone Num.cpp
// 17 Letter Combinations of a Phone Num.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <string> #include <vector> #include <iostream> using namespace std; class Solution { public: vector<string> letterCombinations(string digits) { string letters[] = {" ", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; vector<string> ret(1, ""); for (int i = 0; i < digits.size(); i++) { if (digits[i] == '1') continue; vector<string> tmp = ret; ret.clear(); for(int j = 0; j < letters[digits[i]-'0'].length(); j++) { for (int k = 0; k < tmp.size(); k++) { ret.push_back(tmp[k] + letters[digits[i] - '0'][j]); } } } return ret; } }; int _tmain(int argc, _TCHAR* argv[]) { Solution s; vector <string> strs = s.letterCombinations("1234"); for (int i = 0; i < strs.size(); i++) { cout << strs[i] << endl; } cout << strs.size() << endl; return 0; }
025f02a4833e5f3e4d77b76c35a1f57d4dfc2c3a
80de881ed1406aaf2c16baf58370437864d920bc
/src/parsers/wikiArticleHandlers/allLinksArticleHandler.h
7a971d4cae2402d77351c62234d62d68e61f999c
[ "MIT" ]
permissive
bencabrera/wikiMainPath
84a49318edc175677b38ee300aa2c5844c33439a
a42e81a8fbe119e858548045653b2a22068a34f8
refs/heads/master
2021-03-24T09:23:25.604093
2018-11-17T14:45:35
2018-11-17T14:45:35
68,536,693
0
0
null
null
null
null
UTF-8
C++
false
false
1,702
h
allLinksArticleHandler.h
#pragma once #include <vector> #include <set> #include <map> #include <boost/container/flat_set.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/adjacency_list.hpp> #include "../../../libs/wiki_xml_dump_xerces/src/handlers/abstractWikiPageHandler.hpp" #include "vectorMutex.hpp" #include "../../core/graph.h" class AllLinksArticleHander : public WikiXmlDumpXerces::AbstractWikiPageHandler { public: AllLinksArticleHander( const std::vector<std::string>& article_titles, const std::vector<std::string>& category_titles, const std::map<std::string, std::string>& redirs, std::vector<boost::container::flat_set<std::size_t>>& category_has_article, CategoryHirachyGraph& category_hirachy_graph, std::vector<boost::container::flat_set<std::size_t>>& article_adjacency_list, VectorMutex<1000>& vecMut ); void HandleArticle(const WikiXmlDumpXerces::WikiPageData&); private: static std::vector<std::string> parse_all_links(const std::string& content); inline static bool get_position(const std::vector<std::string>& vec, std::string str, std::size_t& pos) { auto it = std::lower_bound(vec.begin(), vec.end(), str); if(it == vec.end() || *it != str) return false; else { pos = it - vec.begin(); return true; } } const std::vector<std::string>& _article_titles; const std::vector<std::string>& _category_titles; const std::map<std::string, std::string>& _redirects; std::vector<boost::container::flat_set<std::size_t>>& _category_has_article; CategoryHirachyGraph& _category_hirachy_graph; std::vector<boost::container::flat_set<std::size_t>>& _article_adjacency_list; VectorMutex<1000>& _vecMutex; };
b6cbe80779f8c80312fab83a6b428e16635bda12
998c9177b2d0ff4c66e5592c2e43297afe0a2956
/beginner/OOP/Animals.cpp
e7ea9159c556928487a4165646408e10439361d6
[]
no_license
marcusjwhelan/cppcourses
571ab5f742a3c1477693965865225d114ac5c344
88a5eef92c7cc4325fd92818512eec08f4874b6b
refs/heads/master
2020-03-31T00:27:20.111093
2018-10-05T15:20:20
2018-10-05T15:20:20
151,740,256
0
0
null
null
null
null
UTF-8
C++
false
false
200
cpp
Animals.cpp
#include "Animals.h" #include <iostream> using namespace std; namespace mjw { Dog::Dog() { } Dog::~Dog() { } void Dog::speak() { cout << "Bark! Bark!" << endl; } }
8514ed008068d23331fe2aad704fd0299a300784
72f5e54a4cba2a4293af314510feb2eb69b0a6b2
/ThemeSwitcher/source/fs.hpp
7ea486ec8a115fe5d655695a72433575d4e94edd
[]
no_license
exelix11/SysThemeSwitcher
59e398e9ba8ed26deda3ad9e436c47d1433558ef
f94392938cef25f8a78df17d3fdd8975fa271a62
refs/heads/master
2020-04-14T06:13:06.367061
2019-01-01T11:59:48
2019-01-01T11:59:48
163,680,336
7
0
null
null
null
null
UTF-8
C++
false
false
693
hpp
fs.hpp
#pragma once #include "MyTypes.h" #include <switch.h> #include <stdio.h> #include <vector> #include <string> #include <dirent.h> extern std::string CfwFolder; bool StrEndsWith(const std::string &str, const std::string &suffix); void CopyFile(const std::string &original, const std::string &target); bool CheckThemesFolder(); std::vector<std::string> SearchCfwFolders(); std::vector<std::string> GetShuffleTargets(); void InstallShuffleTarget(const std::string &path); void UninstallTheme(); void CreateThemeStructure(const std::string &tid); std::string GetFileName(const std::string &path); std::string GetPath(const std::string &path); std::string GetParentDir(const std::string &path);
946e31e8c3b8cd9633da0aceac155797404f679f
3729bd41bc37c5c4f08b3b2675aa6576030fb9cf
/a5.cpp
d3b94c0e648f0328901f8639ee1b767b5ff244f4
[]
no_license
kamalpreetk701/STL-Iterators-and-Algorithms-in-C-
93e55ee1abf11d52d191937332ed1a6765d3d907
67d6a21dae367b7bb20b81e0e3d099de898f7cc6
refs/heads/master
2021-01-19T17:54:29.212113
2017-08-22T19:51:57
2017-08-22T19:51:57
101,096,457
0
0
null
null
null
null
UTF-8
C++
false
false
5,291
cpp
a5.cpp
#include"iostream" #include<string> #include<algorithm> #include<iterator> #include<vector> #include"fstream" #include<map> #include<sstream> #include<iomanip> #include<set> using namespace std; bool is_Palindrome(const std::string &phrase) { string temp; auto lambda = [](char x) {return !isalpha(x); }; remove_copy_if(phrase.begin(), phrase.end(), back_inserter(temp),lambda) ; transform(temp.begin(), temp.end(), temp.begin(), [](char x) {return tolower(x);}); int mid = temp.length()/2; bool result=equal(temp.begin(), temp.begin() + mid, temp.rbegin(), [](char x, char y) {return (x == y); }); return result; } void test_is_palindrome() { string str_i = string("was it a car or a cat i saw?"); string str_u = string("was it a car or a cat u saw?"); cout << "the phrase \"" << str_i << "\" is" << (is_Palindrome(str_i) ? " " : " not ") << "a palindrome \n"; cout << "the phrase \"" << str_u << "\" is" << (is_Palindrome(str_u) ? " " : " not ") << "a palindrome\n"; } template<class Iterator> std::pair<Iterator, bool> second_max(Iterator start, Iterator finish) { pair<Iterator, bool> result; int count = 0; int len = finish - start; Iterator secmax = start; Iterator max=start; if (start == finish) { result.first = finish; result.second = false; } else { while (start != finish) { if (*start > *max) { secmax = max; max = start; } else if (*start<*max && *start > *secmax) { secmax = start; } else if (*start == *max) { count++; } else if(*start<*max&& *max==*secmax) { secmax = start; } start++; } } if(len==count) { result.first = max; result.second = false; } else { result.first = secmax; result.second = true; } return result; } void test_second_max() { vector<int> int_vec{1,1,5,5,7,7}; auto retval = second_max(int_vec.begin(), int_vec.end()); if (retval.second) cout << "second largest elemnt is: " << *retval.first<<endl; else { if (retval.first == int_vec.end()) cout << "List Empty,no Elements"<<endl; else cout << "Containers element are all equal"<<endl; } } class MyCompare : public std::binary_function<string, string, bool> { public: bool operator()(const string & lhs, const string & rhs) const { string temp1 = lhs; string temp2 = rhs; transform(lhs.begin(), lhs.end(), temp1.begin(), tolower); transform(rhs.begin(), rhs.end(), temp2.begin(), tolower); return temp1 < temp2; } }; string remove_leading_trailing_nonalpha(string & word) { if (!isalpha(*(--word.end()))) { word.pop_back(); } if (!isalpha(word[0])) { word.erase(word[0]); } return word; } void print_word_frequency1(const std::string &filename) { ifstream ifs; ifs.open(filename); if (!ifs.is_open()) throw invalid_argument(string("could not open file") + filename); map<string, int>word_frequency_map; string line; while (getline(ifs, line)) { std::istringstream iss(line); string word; while (iss >> word) { ++word_frequency_map[remove_leading_trailing_nonalpha(word)]; } } for (const auto &word : word_frequency_map) { cout << setw(10) << word.first << " " << word.second << endl; } } void print_word_frequency2(const std::string &filename) { ifstream ifs; ifs.open(filename); if (!ifs.is_open()) throw invalid_argument(string("could not open file") + filename); map<string, int,MyCompare>word_frequency_map; string line; while (getline(ifs, line)) { std::istringstream iss(line); string word; while (iss >> word) { ++word_frequency_map[remove_leading_trailing_nonalpha(word)]; } } for (const auto &word : word_frequency_map) { cout << setw(10) << word.first << " " << word.second << endl; } } void print_word_index(const std::string &filename) { ifstream ifs; ifs.open(filename); if (!ifs.is_open()) throw invalid_argument(string("could not open file") + filename); int count = 0; map<string,set<int>, MyCompare>word_frequency_map; string word; string line; set<int> set1; while (getline(ifs, line)) { count++; std::istringstream iss(line); while (iss >> word) { word_frequency_map[remove_leading_trailing_nonalpha(word)].insert(count); } } for (const auto & word : word_frequency_map) { cout << setw(10) << word.first; set<int> temp = word.second; set<int>::iterator iter; for (iter = temp.begin(); iter != temp.end(); ++iter) { cout <<" "<< *iter; } cout << endl; } } void main() { test_is_palindrome(); cout << "--------------------------------------------------------"<<endl; test_second_max(); cout << "--------------------------------------------------------"<<endl; string filename = "C:/Users/kamal/Desktop/input1.txt"; print_word_frequency1(filename); cout << "---------------------------------------------------------"<<endl; print_word_frequency2(filename); cout << "----------------------------------------------------------"<<endl; print_word_index(filename); cin.get(); }
d3bb16389c964780b46a545a51584db7422deb9b
bc4dd48807e10ac159d6802774ceff49c3af8af1
/src/Interface/YesNo.hpp
634f310bd31a3e9924f62d8c307099796a39032c
[]
no_license
kshiraki3/SHIRAKI-Project
c60df17e8e781599385a2cd9d87581e1d8ceeb9e
6e7151ddb313a69d873112dc9aa4b6948df8d03e
refs/heads/master
2021-05-04T00:30:11.638519
2016-10-25T12:38:49
2016-10-25T12:38:49
71,855,327
0
0
null
null
null
null
UTF-8
C++
false
false
452
hpp
YesNo.hpp
// // Interface/YesNo.hpp // SHIRAKI Project // // Created by 白木滉平 on 2016/10/20. // Copyright (C) 2016 SHIRAKI System. All rights reserved. // #ifndef Included_Interface_YesNo_hpp #define Included_Interface_YesNo_hpp #include <string> class YesNo { public: YesNo(); explicit YesNo(const std::string& text); ~YesNo(); bool Run(); void SetText(const std::string& text); private: std::string mText; }; #endif /* YesNo_hpp */
7ce5cae40a6bb137625b3546832302da187ac8d9
d1241da8c1d5ca251a80da8fcb1e4df535b1d7f0
/include/sim/KineticParameter.h
ec3548f5b0d097fc860272803a4f5909e721c7dd
[]
no_license
reogac/salib
296b310655286254bb375665fd88107cd582a593
b209f91314f74a77b31e2925a6545a071f5472c7
refs/heads/master
2016-09-06T10:10:18.397835
2015-05-27T02:45:55
2015-05-27T02:45:55
35,530,443
0
0
null
null
null
null
UTF-8
C++
false
false
805
h
KineticParameter.h
/** @file KineticParameter.h @brief Header file for KineticParameter class @author Thai Quang Tung (tungtq), tungtq@gmail.com */ #ifndef KineticParameter_INC #define KineticParameter_INC #include "OdeModelVariable.h" BIO_NAMESPACE_BEGIN class KineticParameter : public OdeModelVariable { public: KineticParameter(const std::string reaction, const std::string name); ~KineticParameter(); std::string getReaction() const; std::string getLocalName() const; protected: std::string m_Reaction; // reaction name std::string m_LocalName; // local name private: static std::string local2Global(const std::string reaction, const std::string name); //convert local name to global name }; BIO_NAMESPACE_END #endif /* ----- #ifndef KineticParameter_INC ----- */
1a86b99d03bb1440e76a96133e32c16b061d4dea
aadf624bd4b79ad68d26fedc03c93d9263d9f690
/SuperMarioBros3/SuperMarioBros3/Ultis.h
21a00e598e48cb47cbd23e5127b461da101ccd4e
[]
no_license
th-tuan-1402/DirectX-SuperMarioBros3
5e4f4f92c0c46864e196834f7708b7c1d18e1ce0
531140c6123d749d98dd71d153987b84fa0a736f
refs/heads/main
2023-05-13T04:25:27.221122
2021-01-23T05:43:43
2021-01-23T05:43:43
629,717,572
0
0
null
2023-04-18T22:16:48
2023-04-18T22:16:47
null
UTF-8
C++
false
false
807
h
Ultis.h
#pragma once #include <Windows.h> #include <signal.h> #include <stdio.h> #include <stdarg.h> #include <time.h> #include <stdlib.h> #include <string> #include <vector> #include <map> using namespace std; #define _W(x) __W(x) #define __W(x) L##x #define VA_PRINTS(s) { \ va_list argp; \ va_start(argp, fmt); \ vswprintf_s(s, fmt, argp); \ va_end(argp); \ } void DebugOut(const wchar_t* fmt, ...); void DebugOutTitle(const wchar_t* fmt, ...); void SetDebugWindow(HWND hwnd); std::vector<std::string> split(std::string line, std::string delimeter = "\t"); std::wstring ToWSTR(std::string st); LPCWSTR ToLPCWSTR(std::string st); float Clamp(float target, float inf, float sup); int Sign(float x); bool InRange(float target, float inf, float sup); bool RectEqual(RECT a, RECT b);
6a3c0bb789ed8684e0fc0cd8397da74e47919731
e99c20155e9b08c7e7598a3f85ccaedbd127f632
/ sjtu-project-pipe/thirdparties/VTK.Net/src/Rendering/vtkOpenGLImageMapperDotNet.cxx
bfcae0a6bd63e736962952763423161115abfb01
[ "BSD-3-Clause" ]
permissive
unidevop/sjtu-project-pipe
38f00462d501d9b1134ce736bdfbfe4f9d075e4a
5a09f098db834d5276a2921d861ef549961decbe
refs/heads/master
2020-05-16T21:32:47.772410
2012-03-19T01:24:14
2012-03-19T01:24:14
38,281,086
1
1
null
null
null
null
UTF-8
C++
false
false
4,119
cxx
vtkOpenGLImageMapperDotNet.cxx
// managed includes #include "vtkDotNetConvert.h" #include "vtkOpenGLImageMapperDotNet.h" // native includes #include "strstream" #include "vtkOpenGLImageMapper.h" #include "vtkActor2D.h" #include "vtkImageData.h" #include "vtkObject.h" #include "vtkViewport.h" using namespace System; namespace vtk { System::String^ vtkOpenGLImageMapper::GetClassName() { const char* retVal = vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->GetClassName(); System::String^ sRetVal = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(IntPtr(const_cast<char*>(retVal))); return sRetVal; } int vtkOpenGLImageMapper::IsA(System::String^ name) { char* nameWrap = static_cast<char*>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(name).ToPointer()); int retVal = vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->IsA(nameWrap); System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(nameWrap)); return retVal; } vtkOpenGLImageMapper^ vtkOpenGLImageMapper::NewInstance() { ::vtkOpenGLImageMapper* retVal = static_cast<::vtkOpenGLImageMapper*>(vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->NewInstance()); return gcnew vtkOpenGLImageMapper(IntPtr(retVal), false); } vtkOpenGLImageMapper^ vtkOpenGLImageMapper::SafeDownCast(vtkObject^ o) { ::vtkObject* oWrap = vtk::ConvertManagedToNative<::vtkObject>(o->GetNativePointer()); ::vtkOpenGLImageMapper* retVal = static_cast<::vtkOpenGLImageMapper*>(::vtkOpenGLImageMapper::SafeDownCast(oWrap)); return gcnew vtkOpenGLImageMapper(IntPtr(retVal), false); } /// <summary> /// PrintSelf writes the state of this object to a TextWriter. /// </summary> void vtkOpenGLImageMapper::PrintSelf(System::IO::TextWriter^ writer, int indentLevel) { std::ostrstream writeStream; vtkIndent indent(indentLevel); vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->PrintSelf(writeStream,indent); System::String^ sRetVal = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(IntPtr(const_cast<char*>(writeStream.str()))); writer->Write(sRetVal); } /// <summary> /// This returns the state of this object as a string. It is equivalent to PrintSelf. /// </summary> System::String^ vtkOpenGLImageMapper::ToString() { std::ostrstream writeStream; vtkIndent indent; vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->PrintSelf(writeStream,indent); System::String^ sRetVal = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(IntPtr(const_cast<char*>(writeStream.str()))); return sRetVal; } void vtkOpenGLImageMapper::RenderOverlay(vtkViewport^ viewport, vtkActor2D^ actor) { ::vtkViewport* viewportWrap = vtk::ConvertManagedToNative<::vtkViewport>(viewport->GetNativePointer()); ::vtkActor2D* actorWrap = vtk::ConvertManagedToNative<::vtkActor2D>(actor->GetNativePointer()); vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->RenderOverlay(viewportWrap, actorWrap); } void vtkOpenGLImageMapper::RenderData(vtkViewport^ viewport, vtkImageData^ data, vtkActor2D^ actor) { ::vtkViewport* viewportWrap = vtk::ConvertManagedToNative<::vtkViewport>(viewport->GetNativePointer()); ::vtkImageData* dataWrap = vtk::ConvertManagedToNative<::vtkImageData>(data->GetNativePointer()); ::vtkActor2D* actorWrap = vtk::ConvertManagedToNative<::vtkActor2D>(actor->GetNativePointer()); vtk::ConvertManagedToNative<::vtkOpenGLImageMapper>(m_instance)->RenderData(viewportWrap, dataWrap, actorWrap); } vtkOpenGLImageMapper::vtkOpenGLImageMapper(System::IntPtr native, bool bConst) : vtkImageMapper(native, bConst) {} vtkOpenGLImageMapper::vtkOpenGLImageMapper(bool donothing) : vtkImageMapper(donothing) {} vtkOpenGLImageMapper::vtkOpenGLImageMapper() : vtkImageMapper(false) { this->SetNativePointer(IntPtr(::vtkOpenGLImageMapper::New())); } vtkOpenGLImageMapper::~vtkOpenGLImageMapper() { } } // end namespace vtkRendering
e64759ae6129c6f15387fb5955ed67d581487d5b
c74a5b242c7470b38cdb1e9b1c2f57a1266c589a
/src/persistence/contractdb.h
c64b3872608e18b26c3b542fa35de5bc5fe6bf1a
[ "MIT" ]
permissive
zhenc520/WaykiChain
2097f8bb5c73a0e80e608f9386e9655515f332c4
5a67aabfcd79bf9a41afc7ff6607d0fcd0c8cdd1
refs/heads/master
2020-06-05T18:24:19.436545
2019-06-04T10:20:21
2019-06-04T10:20:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,077
h
contractdb.h
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2017-2019 The WaykiChain Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PERSIST_CONTRACTDB_H #define PERSIST_CONTRACTDB_H #include "commons/arith_uint256.h" #include "dbconf.h" #include "persistence/leveldbwrapper.h" #include "vm/appaccount.h" #include <map> #include <string> #include <utility> #include <vector> class CVmOperate; class CKeyID; class CRegID; class CAccount; class CAccountLog; class CContractDB; struct CDiskTxPos; class IContractView { public: virtual bool GetData(const vector<unsigned char> &vKey, vector<unsigned char> &vValue) = 0; virtual bool SetData(const vector<unsigned char> &vKey, const vector<unsigned char> &vValue) = 0; virtual bool BatchWrite(const map<vector<unsigned char>, vector<unsigned char> > &mapContractDb) = 0; virtual bool EraseKey(const vector<unsigned char> &vKey) = 0; virtual bool HaveData(const vector<unsigned char> &vKey) = 0; virtual bool GetScript(const int nIndex, vector<unsigned char> &vScriptId, vector<unsigned char> &vValue) = 0; virtual bool GetContractData(const int nCurBlockHeight, const vector<unsigned char> &vScriptId, const int &nIndex, vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData) = 0; virtual Object ToJsonObj(string prefix) { return Object(); } //FIXME: useless prefix // virtual bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) = 0; // virtual bool WriteTxIndex(const vector<pair<uint256, CDiskTxPos> > &list, vector<CDbOpLog> &vTxIndexOperDB) = 0; // virtual bool WriteTxOutPut(const uint256 &txid, const vector<CVmOperate> &vOutput, CDbOpLog &operLog) = 0; // virtual bool ReadTxOutPut(const uint256 &txid, vector<CVmOperate> &vOutput) = 0; virtual bool GetTxHashByAddress(const CKeyID &keyId, int nHeight, map<vector<unsigned char>, vector<unsigned char> > &mapTxHash) = 0; // virtual bool SetTxHashByAddress(const CKeyID &keyId, int nHeight, int nIndex, const string &strTxHash, CDbOpLog &operLog) = 0; virtual bool GetAllContractAcc(const CRegID &scriptId, map<vector<unsigned char>, vector<unsigned char> > &mapAcc) = 0; virtual ~IContractView(){}; }; class CContractCache : public IContractView { protected: IContractView *pBase; public: map<vector<unsigned char>, vector<unsigned char> > mapContractDb; /*取脚本 时 第一个vector 是scriptKey = "def" + "scriptid"; 取应用账户时第一个vector是scriptKey = "acct" + "scriptid"+"_" + "accUserId"; 取脚本总条数时第一个vector是scriptKey ="snum", 取脚本数据总条数时第一个vector是scriptKey ="sdnum"; 取脚本数据时第一个vector是scriptKey ="data" + "vScriptId" + "_" + "vScriptKey" 取交易关联账户时第一个vector是scriptKey ="tx" + "txHash" */ public: CContractCache(): pBase(nullptr) {} CContractCache(IContractView &pBaseIn): pBase(&pBaseIn) { mapContractDb.clear(); }; bool GetScript(const CRegID &scriptId, vector<unsigned char> &vValue); bool GetScript(const int nIndex, CRegID &scriptId, vector<unsigned char> &vValue); bool GetScriptAcc(const CRegID &scriptId, const vector<unsigned char> &vKey, CAppUserAccount &appAccOut); bool SetScriptAcc(const CRegID &scriptId, const CAppUserAccount &appAccIn, CDbOpLog &operlog); bool EraseScriptAcc(const CRegID &scriptId, const vector<unsigned char> &vKey); bool SetScript(const CRegID &scriptId, const vector<unsigned char> &vValue); bool HaveScript(const CRegID &scriptId); bool EraseScript(const CRegID &scriptId); bool GetContractItemCount(const CRegID &scriptId, int &nCount); bool EraseAppData(const CRegID &scriptId, const vector<unsigned char> &vScriptKey, CDbOpLog &operLog); bool HaveScriptData(const CRegID &scriptId, const vector<unsigned char> &vScriptKey); bool GetContractData(const int nCurBlockHeight, const CRegID &scriptId, const vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData); bool GetContractData(const int nCurBlockHeight, const CRegID &scriptId, const int &nIndex, vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData); bool SetContractData(const CRegID &scriptId, const vector<unsigned char> &vScriptKey, const vector<unsigned char> &vScriptData, CDbOpLog &operLog); bool SetDelegateData(const CAccount &delegateAcct, CDbOpLog &operLog); bool SetDelegateData(const vector<unsigned char> &vKey); bool EraseDelegateData(const CAccountLog &delegateAcct, CDbOpLog &operLog); bool EraseDelegateData(const vector<unsigned char> &vKey); bool UndoScriptData(const vector<unsigned char> &vKey, const vector<unsigned char> &vValue); bool SetDelegateData(const string& key) { return SetDelegateData(vector<unsigned char>(key.begin(), key.end())); } // TODO: bool EraseDelegateData(const string &key) { return EraseDelegateData(vector<unsigned char>(key.begin(), key.end())); } // TODO:... bool UndoScriptData(const string& key, const string& value); // TODO:... /** * @brief Get all number of scripts in scriptdb * @param nCount * @return true if get succeed, otherwise false */ bool GetScriptCount(int &nCount); bool SetTxRelAccout(const uint256 &txHash, const set<CKeyID> &relAccount); bool GetTxRelAccount(const uint256 &txHash, set<CKeyID> &relAccount); bool EraseTxRelAccout(const uint256 &txHash); /** * @brief write all data in the caches to script db * @return */ bool Flush(); bool Flush(IContractView *pView); unsigned int GetCacheSize(); Object ToJsonObj() const; IContractView * GetBaseScriptDB() { return pBase; } bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos); bool WriteTxIndex(const vector<pair<uint256, CDiskTxPos> > &list, vector<CDbOpLog> &vTxIndexOperDB); void SetBaseView(IContractView *pBaseIn) { pBase = pBaseIn; }; string ToString(); bool WriteTxOutPut(const uint256 &txid, const vector<CVmOperate> &vOutput, CDbOpLog &operLog); bool ReadTxOutPut(const uint256 &txid, vector<CVmOperate> &vOutput); bool GetTxHashByAddress(const CKeyID &keyId, int nHeight, map<vector<unsigned char>, vector<unsigned char> > &mapTxHash); bool SetTxHashByAddress(const CKeyID &keyId, int nHeight, int nIndex, const string &strTxHash, CDbOpLog &operLog); bool GetAllContractAcc(const CRegID &scriptId, map<vector<unsigned char>, vector<unsigned char> > &mapAcc); private: bool GetData(const vector<unsigned char> &vKey, vector<unsigned char> &vValue); bool SetData(const vector<unsigned char> &vKey, const vector<unsigned char> &vValue); bool BatchWrite(const map<vector<unsigned char>, vector<unsigned char> > &mapContractDb); bool EraseKey(const vector<unsigned char> &vKey); bool HaveData(const vector<unsigned char> &vKey); /** * @brief Get script content from scriptdb by scriptid * @param vScriptId * @param vValue * @return true if get script succeed,otherwise false */ bool GetScript(const vector<unsigned char> &vScriptId, vector<unsigned char> &vValue); /** * @brief Get Script content from scriptdb by index * @param nIndex the value must be non-negative * @param vScriptId * @param vValue * @return true if get script succeed, otherwise false */ bool GetScript(const int nIndex, vector<unsigned char> &vScriptId, vector<unsigned char> &vValue); /** * @brief Save script content to scriptdb * @param vScriptId * @param vValue * @return true if save succeed, otherwise false */ bool SetScript(const vector<unsigned char> &vScriptId, const vector<unsigned char> &vValue); /** * @brief Detect if scriptdb contains the script by scriptid * @param vScriptId * @return true if contains script, otherwise false */ bool HaveScript(const vector<unsigned char> &vScriptId); /** * @brief Save all number of scripts in scriptdb * @param nCount * @return true if save count succeed, otherwise false */ bool SetScriptCount(const int nCount); /** * @brief Delete script from script db by scriptId * @param vScriptId * @return true if delete succeed, otherwise false */ bool EraseScript(const vector<unsigned char> &vScriptId); /** * @brief Get total number of contract data elements in contract db * @param vScriptId * @param nCount * @return true if get succeed, otherwise false */ bool GetContractItemCount(const vector<unsigned char> &vScriptId, int &nCount); /** * @brief Save count of the Contract's data into contract db * @param vScriptId * @param nCount * @return true if save succeed, otherwise false */ bool SetContractItemCount(const vector<unsigned char> &vScriptId, int nCount); /** * @brief Delete the item of the scirpt's data by scriptId and scriptKey * @param vScriptId * @param vScriptKey must be 8 bytes * @return true if delete succeed, otherwise false */ bool EraseAppData(const vector<unsigned char> &vScriptId, const vector<unsigned char> &vScriptKey, CDbOpLog &operLog); bool EraseAppData(const vector<unsigned char> &vKey); /** * @brief Detect if scriptdb contains the item of script's data by scriptid and scriptkey * @param vScriptId * @param vScriptKey must be 8 bytes * @return true if contains the item, otherwise false */ bool HaveScriptData(const vector<unsigned char> &vScriptId, const vector<unsigned char> &vScriptKey); /** * @brief Get smart contract App data and valid height by scriptid and scriptkey * @param vScriptId * @param vScriptKey must be 8 bytes * @param vScriptData * @param nHeight valide height of script data * @return true if get succeed, otherwise false */ bool GetContractData(const int nCurBlockHeight, const vector<unsigned char> &vScriptId, const vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData); /** * @brief Get smart contract app data and valid height by scriptid and nIndex * @param vScriptId * @param nIndex get first script data will be 0, otherwise be 1 * @param vScriptKey must be 8 bytes, get first script data will be empty, otherwise get next scirpt data will be previous script key * @param vScriptData * @param nHeight valid height of script data * @return true if get succeed, otherwise false */ bool GetContractData(const int nCurBlockHeight, const vector<unsigned char> &vScriptId, const int &nIndex, vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData); /** * @brief Save script data and valid height into script db * @param vScriptId * @param vScriptKey must be 8 bytes * @param vScriptData * @param nHeight valide height of script data * @return true if save succeed, otherwise false */ bool SetContractData(const vector<unsigned char> &vScriptId, const vector<unsigned char> &vScriptKey, const vector<unsigned char> &vScriptData, CDbOpLog &operLog); }; class CContractDB : public IContractView { private: CLevelDBWrapper db; public: CContractDB(const string &name, size_t nCacheSize, bool fMemory = false, bool fWipe = false) : db(GetDataDir() / "blocks" / name, nCacheSize, fMemory, fWipe) {} CContractDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false) : db(GetDataDir() / "blocks" / "contract", nCacheSize, fMemory, fWipe) {} private: CContractDB(const CContractDB &); void operator=(const CContractDB &); public: bool GetData(const vector<unsigned char> &vKey, vector<unsigned char> &vValue) { return db.Read(vKey, vValue); }; bool SetData(const vector<unsigned char> &vKey, const vector<unsigned char> &vValue) { return db.Write(vKey, vValue); }; bool BatchWrite(const map<vector<unsigned char>, vector<unsigned char> > &mapContractDb); bool EraseKey(const vector<unsigned char> &vKey); bool HaveData(const vector<unsigned char> &vKey); bool GetScript(const int nIndex, vector<unsigned char> &vScriptId, vector<unsigned char> &vValue); bool GetContractData(const int curBlockHeight, const vector<unsigned char> &vScriptId, const int &nIndex, vector<unsigned char> &vScriptKey, vector<unsigned char> &vScriptData); int64_t GetDbCount() { return db.GetDbCount(); } bool GetTxHashByAddress(const CKeyID &keyId, int nHeight, map<vector<unsigned char>, vector<unsigned char> > &mapTxHash); Object ToJsonObj(string Prefix); bool GetAllContractAcc(const CRegID &contractRegId, map<vector<unsigned char>, vector<unsigned char> > &mapAcc); }; #endif // PERSIST_CONTRACTDB_H