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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
869a2b3e6a5a7b40363901976f740272fa01c4f2 | 23d867b5ea84823bc070e9b1c6cfff00d8eadea7 | /source/ConsoleBuffer.cpp | 2247f15c587bf44c2c1e8affd3c1b616a2caa994 | [
"BSD-2-Clause"
] | permissive | samizzo/hexed | e95862caef781236f76ed7506631e0b223c5a524 | a92a696fd8ce4cf9636219b2e8c1e56727715363 | refs/heads/master | 2023-04-28T08:12:24.741129 | 2023-04-22T13:36:25 | 2023-04-22T13:36:25 | 96,723,641 | 182 | 31 | BSD-2-Clause | 2018-08-24T12:43:02 | 2017-07-10T01:31:52 | C++ | UTF-8 | C++ | false | false | 6,113 | cpp | ConsoleBuffer.cpp | #include "ConsoleBuffer.h"
#include "Colours.h"
#include <assert.h>
#include <stdio.h>
#include <malloc.h>
ConsoleBuffer::ConsoleBuffer(HANDLE stdoutHandle)
{
m_stdoutHandle = stdoutHandle;
m_width = 0;
m_height = 0;
m_buffer = 0;
m_backBuffer = 0;
}
ConsoleBuffer::~ConsoleBuffer()
{
delete[] m_buffer;
delete[] m_backBuffer;
}
void ConsoleBuffer::Write(int x, int y, WORD attributes, const char* format, ...)
{
assert(m_buffer != 0);
assert(m_width > 0);
assert(m_height > 0);
va_list args;
va_start(args, format);
int count = _vscprintf(format, args);
char* buffer = (char*)_alloca(count + 1);
vsprintf_s(buffer, count + 1, format, args);
int offset = x + (y * m_width);
for (int i = 0; i < count; i++, offset++)
{
m_buffer[offset].Char.AsciiChar = buffer[i];
m_buffer[offset].Attributes = attributes;
}
va_end(args);
}
void ConsoleBuffer::SetAttributes(int x, int y, WORD attributes)
{
assert(m_buffer != 0);
assert(m_width > 0);
assert(m_height > 0);
int offset = x + (y * m_width);
m_buffer[offset].Attributes = attributes;
}
void ConsoleBuffer::DrawWindow(int x, int y, int width, int height, WORD colour)
{
WORD shadowColour = Colours::Shadow;
for (int j = 0; j < height; j++)
{
for (int i = 0; i < width; i++)
{
unsigned char c = ' ';
// Horizontal border.
if (j == 0 || j == height - 1)
c = 205;
Write(i + x, j + y, colour, "%c", c);
if (j == 0)
{
// Bottom shadow.
SetAttributes(i + x + 2, y + height, shadowColour);
}
}
// Vertical border.
if (j > 0 && j < height - 1)
{
Write(x, j + y, colour, "%c", 186);
Write(x + width - 1, j + y, colour, "%c", 186);
}
// Right shadow.
SetAttributes(x + width, j + y + 1, shadowColour);
SetAttributes(x + width + 1, j + y + 1, shadowColour);
}
// Corners of box.
Write(x, y, colour, "%c", 201);
Write(x + width - 1, y, colour, "%c", 187);
Write(x, y + height - 1, colour, "%c", 200);
Write(x + width - 1, y + height - 1, colour, "%c", 188);
}
void ConsoleBuffer::FillLine(int y, char c, WORD attributes)
{
assert(m_buffer != 0);
assert(m_width > 0);
assert(m_height > 0);
int offset = y * m_width;
for (int i = 0; i < m_width; i++, offset++)
{
m_buffer[offset].Char.AsciiChar = c;
m_buffer[offset].Attributes = attributes;
}
}
void ConsoleBuffer::FillRect(int x, int y, int width, int height, char c, WORD attributes)
{
assert(m_buffer != 0);
assert(m_width > 0);
assert(m_height > 0);
for (int j = y; j < y + height; j++)
{
for (int i = x; i < x + width; i++)
{
CHAR_INFO& charInfo = m_buffer[i + (j * m_width)];
charInfo.Char.AsciiChar = c;
charInfo.Attributes = attributes;
}
}
}
void ConsoleBuffer::Clear(WORD clearColour)
{
assert(m_buffer != 0);
assert(m_width > 0);
assert(m_height > 0);
for (int i = 0; i < m_width * m_height; i++)
{
CHAR_INFO& info = m_buffer[i];
info.Char.AsciiChar = ' ';
info.Attributes = clearColour;
}
}
void ConsoleBuffer::OnWindowResize(int width, int height)
{
delete[] m_buffer;
m_width = width;
m_height = height;
m_buffer = new CHAR_INFO[width * height];
delete[] m_backBuffer;
m_width = width;
m_height = height;
m_backBuffer = new CHAR_INFO[width * height];
}
void ConsoleBuffer::Flush(bool fullDraw)
{
assert(m_stdoutHandle != 0);
assert(m_buffer != 0);
assert(m_backBuffer);
assert(m_width > 0);
assert(m_height > 0);
COORD bufferSize;
bufferSize.X = m_width;
bufferSize.Y = m_height;
COORD bufferCoord;
bufferCoord.X = 0;
bufferCoord.Y = 0;
SMALL_RECT rect;
rect.Top = 0;
rect.Left = 0;
rect.Bottom = m_height - 1;
rect.Right = m_width - 1;
if (fullDraw)
{
memcpy(m_backBuffer, m_buffer, m_width * m_height * sizeof(CHAR_INFO));
WriteConsoleOutput(m_stdoutHandle, m_buffer, bufferSize, bufferCoord, &rect);
}
else
{
int index = 0;
for (int y = 0; y < m_height; y++)
{
for (int x = 0; x < m_width; x++, index++)
{
CHAR_INFO& c = m_buffer[index];
CHAR_INFO& bc = m_backBuffer[index];
COORD coord;
coord.X = x;
coord.Y = y;
//if (c.Attributes != bc.Attributes || c.Char.AsciiChar != bc.Char.AsciiChar)
//{
// bufferSize.X = 1;
// bufferSize.Y = 1;
// coord.X = 0;
// coord.Y = 0;
// rect.Top = y;
// rect.Left = x;
// rect.Bottom = y;
// rect.Right = x;
// bc.Attributes = c.Attributes;
// bc.Char.AsciiChar = c.Char.AsciiChar;
// WriteConsoleOutput(m_stdoutHandle, &c, bufferSize, coord, &rect);
//}
if (c.Attributes != bc.Attributes)
{
bc.Attributes = c.Attributes;
DWORD numWritten;
WriteConsoleOutputAttribute(m_stdoutHandle, &bc.Attributes, 1, coord, &numWritten);
}
if (c.Char.AsciiChar != bc.Char.AsciiChar)
{
bc.Char.AsciiChar = c.Char.AsciiChar;
DWORD numWritten;
WriteConsoleOutputCharacter(m_stdoutHandle, &bc.Char.AsciiChar, 1, coord, &numWritten);
}
}
}
}
}
void ConsoleBuffer::SetCursor(bool visible, unsigned int size)
{
CONSOLE_CURSOR_INFO info;
info.bVisible = visible;
info.dwSize = size;
SetConsoleCursorInfo(m_stdoutHandle, &info);
}
|
fb358a987e5037912f8f8a13d4b31fb31c66a503 | 737ea06f67f9624cc3c51b3c72ca01441e52c364 | /examples/polish-notation.cpp | c6d5e99b6b4a6a158a885ef3f0542d352dd68f1e | [
"BSL-1.0"
] | permissive | libjv/TreeAlgorithms | 16e72c69b9220f48507167b63fe4b248461e52c7 | a0bab16c8021b6701b1a59e9361d34833f67e44b | refs/heads/master | 2022-12-04T02:32:38.488987 | 2020-08-01T14:27:34 | 2020-08-01T14:27:34 | 276,624,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,300 | cpp | polish-notation.cpp | #include <jv/tree-algorithms.hpp>
#include <algorithm>
#include <cassert>
#include <charconv>
#include <cmath>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string_view>
std::vector<std::string_view> split_tokens(std::string_view str)
{
std::vector<std::string_view> result;
while (true) {
// removing spaces at beginning of str
str.remove_prefix(std::min(str.find_first_not_of(" \r\t\n"), str.size()));
if (str.empty())
// no tokens left
return result;
// getting index of the token end
auto token_end = std::min(str.find_first_of(" \r\t\n"), str.size());
// adding the token to the list
result.push_back(str.substr(0, token_end));
// removing the token
str.remove_prefix(token_end);
}
}
// Using virtual dispatch (may have use std::variant instead)
struct Node {
virtual ~Node() noexcept = default;
virtual int getNbChildren() noexcept = 0;
virtual double getValue(double* child_begin, double* child_end) noexcept = 0;
};
using NodePtr = std::unique_ptr<Node>;
struct Number : Node {
double value;
Number(double v) noexcept : value{v} {}
// Number is a leaf node
virtual int getNbChildren() noexcept { return 0; }
virtual double getValue([[maybe_unused]] double* begin, [[maybe_unused]] double* end) noexcept
{
assert(begin == end); // ensures a number has no children
return value;
}
};
struct Operation : Node {
enum Op { Add, Sub, Mult, Div, Sqrt, Pow };
Op operation;
// Parsing the token
Operation(std::string_view token)
{
static constexpr std::string_view tokens[] = {"+", "-", "x", "/", "sqrt", "pow"};
if (auto it = std::find(std::begin(tokens), std::end(tokens), token);
it != std::end(tokens)) {
operation = static_cast<Op>(it - std::begin(tokens));
}
else
throw std::invalid_argument("Invalid token for Operation");
}
virtual int getNbChildren() noexcept
{
static constexpr int nb_children[] = {2, 2, 2, 2, 1, 2};
return nb_children[static_cast<int>(operation)];
}
virtual double getValue(double* it, [[maybe_unused]] double* end) noexcept
{
assert(it + getNbNodes() == end); // ensures it has the appropriate number of children
switch (operation) {
case Add: return it[0] + it[1];
case Sub: return it[0] - it[1];
case Mult: return it[0] * it[1];
case Div: return it[0] / it[1];
case Sqrt: return std::sqrt(it[0]);
case Pow: return std::pow(it[0], it[1]);
default: return 0;
}
}
};
// conversion from a token to a node
NodePtr token_to_node(std::string_view token)
{
auto token_end = token.data() + token.size();
char* num_end = nullptr;
if (double value = std::strtod(token.data(), &num_end); num_end == token_end) {
return std::make_unique<Number>(value);
}
return std::make_unique<Operation>(token);
}
using MathTree = std::vector<NodePtr>;
// conversion from a list of tokens to a MathTree
MathTree parse_expression(std::string_view expression)
{
auto tokens = split_tokens(expression);
MathTree tree(tokens.size());
std::transform(tokens.begin(), tokens.end(), tree.begin(), token_to_node);
return tree;
}
struct NodeTraits : jv::NodeTraits<MathTree::const_iterator, NodeTraits> {
static std::size_t getChildrenCount(iterator it) noexcept { return (*it)->getNbChildren(); }
};
double evaluate(MathTree const& tree) noexcept
{
auto [value, _] = NodeTraits::evaluationTraversal<double>(
tree.begin(),
[](auto node, double* begin, double* end) { return (*node)->getValue(begin, end); });
return value;
}
double evaluate(std::string_view expression) noexcept
{
return evaluate(parse_expression(expression));
}
int main()
{
// (3 * 5) - (8 / 2) = 15 - 4 = 11
std::string_view expression = "- x 3 5 / 8 2";
std::cout << expression << " => " << evaluate(expression) << " (expected: 11)\n";
// sqrt( (3^2) + (4^2) ) = sqrt(9 + 16) = 5
expression = "sqrt + pow 3 2 pow 4 2";
std::cout << expression << " => " << evaluate(expression) << " (expected: 5)\n";
return 0;
} |
5504aa90e3b8e6ee1ab7abb896444b17f1916642 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /chrome/chrome_cleaner/test/scoped_file.cc | 337b3705e323f0210bc1e05a2430bfacc5fbac93 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 1,139 | cc | scoped_file.cc | // Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/chrome_cleaner/test/scoped_file.h"
#include <string>
#include "base/base_paths_win.h"
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
// static
std::unique_ptr<ScopedFile> ScopedFile::Create(const base::FilePath& dir,
const std::wstring& file_name,
const std::string& contents) {
base::FilePath file_path = dir.Append(file_name);
CHECK(base::PathExists(file_path.DirName()));
CHECK_LE(contents.length(),
static_cast<size_t>(std::numeric_limits<int>::max()));
base::WriteFile(file_path, contents);
return std::make_unique<ScopedFile>(file_path);
}
ScopedFile::ScopedFile(const base::FilePath& file_path)
: file_path_(file_path) {}
ScopedFile::~ScopedFile() {
if (base::PathExists(file_path_))
PCHECK(base::DeleteFile(file_path_));
}
const base::FilePath& ScopedFile::file_path() {
return file_path_;
}
|
91e9940184c99b8dd0f42d89bb7054685136035d | 77bbbc25fa71d0aba7f0d0dee2e3d35631eba0d1 | /src/vec3.h | 1a2c5e96d98953723153105835b742b79fd230d1 | [
"MIT"
] | permissive | masonium/twinkle | 238ef2880cc85c3119c143fda7e5263b0a1402e9 | 853ae84ebd1fd8dcd3dda47eb3fb1c2cf0b8f0c6 | refs/heads/master | 2016-09-06T09:31:52.300227 | 2016-02-08T05:49:23 | 2016-02-08T05:49:23 | 35,869,172 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,456 | h | vec3.h | #pragma once
#include "vector.h"
#include <memory>
#include <cmath>
using std::pair;
class Mat33;
class Vec3 : public VectorT3<Vec3>
{
public:
Vec3() : VectorT3<Vec3>() { }
explicit Vec3(scalar s) : VectorT3<Vec3>(s) { }
Vec3(scalar x, scalar y, scalar z) : VectorT3<Vec3>(x, y, z) { }
Vec3(VectorT3<Vec3>& s) : VectorT3<Vec3>(s) { }
Vec3& operator=(const Vec3& x);
Vec3(const Vec3&);
Vec3(Vec3&&) = default;
Vec3 normal() const
{
scalar len = norm();
return Vec3(x / len, y / len, z / len);
}
using VectorT3<Vec3>::operator+;
using VectorT3<Vec3>::operator/;
scalar min() const { return std::min(x, std::min(y, z)); }
scalar max() const { return std::max(x, std::max(y, z)); }
/**
* Return the index of the minumum element, with a preference for the lower
* indexed elements.
*/
int min_element() const;
/**
* Return the index of the maximum element, with a preference for the lower
* indexed elements.
*/
int max_element() const;
Vec3 elem_div(const Vec3& rhs) const
{
return Vec3{x / rhs.x, y / rhs.y, z / rhs.z};
}
Vec3 elem_mult(const Vec3& rhs) const
{
return Vec3{x * rhs.x, y * rhs.y, z * rhs.z};
}
Vec3 abs() const
{
return Vec3(fabs(x), fabs(y), fabs(z));
}
Vec3 cross(const Vec3& other) const
{
return Vec3(y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x);
}
/*
* Return the vector corresponding to given euler angles. Assumes phi == 0 is
* the (0, 0, 1) vector.
*/
static Vec3 from_euler(scalar theta, scalar phi);
/*
* Assumes that the calling vector is normal.
*/
void to_euler(scalar& theta, scalar& phi) const;
pair<scalar, scalar> to_euler() const;
Vec3 project_onto(const Vec3& res) const
{
return res * (this->dot(res) / (res.dot(res)));
}
Vec3 reflect_over(const Vec3& n) const
{
Vec3 proj = project_onto(n);
return 2.0 * proj - *this;
}
Vec3 rotateMatch(const Vec3& from, const Vec3& to) const;
Vec3 rotateAxisAngle(const Vec3& axis, scalar angle) const;
Mat33 tensor_product(const Vec3& a) const;
static Vec3 x_axis;
static Vec3 y_axis;
static Vec3 z_axis;
static Vec3 zero;
private:
Vec3 _rotateAxisAngle(const Vec3& axis, scalar cos_angle, scalar sin_angle) const;
};
ostream& operator <<(ostream& out, const Vec3& v);
Vec3 min(const Vec3& a, const Vec3& b);
Vec3 max(const Vec3& a, const Vec3& b);
|
f53e7bfdc1c70bbe3e86c9bccd2cad4b64289bfc | 416108a9e20635b36f8e82de4ea3aaed00d9a3e7 | /advent-2019/01.cpp | 0939baf491ce8614339b8ead88d1c4243467085e | [] | no_license | annoviko/sandbox | b2cfb11ce24bb477a188e1cc5f71a92835ff1b91 | bc9d89f4b37984ffa052a252639e6535fb88a308 | refs/heads/master | 2023-08-30T23:43:12.940520 | 2023-08-19T11:20:10 | 2023-08-19T11:20:10 | 72,368,789 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 737 | cpp | 01.cpp | #include <fstream>
#include <iostream>
#include <list>
#include <cstdint>
std::list<std::int64_t> read_values() {
std::list<std::int64_t> result;
std::ifstream infile("input.txt");
std::int64_t value;
while (infile >> value) {
result.push_back(value);
}
infile.close();
return result;
}
std::int64_t get_total_fuel() {
auto masses = read_values();
long long result = 0;
for (auto mass : masses) {
mass = mass / 3 - 2;
while (mass >= 0) {
result += mass;
mass = mass / 3 - 2;
}
}
return result;
}
int main() {
std::cout << "Result: " << get_total_fuel() << std::endl;
return 0;
} |
4bb534b5369a117ad52dabf04efa7fe05d9ea451 | 027ba1e389d45e253dce892220555d6f9826f0cd | /packages/ipnoise-pipe/pipe-rc/src/api/commands/init.cpp | 443fd63bd102c949c6b33532d0c65f2cfac7c453 | [] | no_license | m0r1k/IPNoise | 1f371ed6a7cd6ba5637edbbe8718190d7f514827 | dbab828d48aa1ab626fd528e71b1c28e3702be09 | refs/heads/master | 2021-01-02T23:09:51.193762 | 2018-02-04T11:23:27 | 2018-02-04T11:23:27 | 99,478,087 | 1 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 354 | cpp | init.cpp | #include "api.hpp"
#include "init.hpp"
ApiCommandInit::ApiCommandInit(
Api *a_api)
: ApiCommand(a_api, "init")
{
}
ApiCommandInit::~ApiCommandInit()
{
}
void ApiCommandInit::process(
const ApiCommandArgs &a_args)
{
QString cmd;
cmd += cmdStart(a_args, "flags=\"init\"");
cmd += cmdEnd(a_args);
getApi()->queue(cmd);
}
|
e800fd75676e175094c18c26339ec246e341e92c | 1608247b1118a71bb9260b12ea03bf23bff40d65 | /Server/my_pokemon.cpp | 79c9dbf2996d6c63974fd41f69eedb002f947658 | [] | no_license | lioran19/Pokemon | d3f5b9e436fb8fe3811db4c337fa19793665843d | 3fd30127243ebdc9304aa0126defb33b85f1bc24 | refs/heads/master | 2021-10-09T23:45:57.612241 | 2019-01-04T16:36:47 | 2019-01-04T16:36:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,670 | cpp | my_pokemon.cpp | #include "my_pokemon.h"
my_pokemon::my_pokemon()
{
}
my_pokemon::my_pokemon(my_pokemon &sample)
{
num = sample.num;
id = sample.id;
name = sample.name;
level = sample.level;
exp = sample.exp;
hp = sample.hp;
power = sample.power;
defence = sample.defence;
attack_interval = sample.attack_interval;
user_id = sample.user_id;
}
my_pokemon::my_pokemon(int id, int num, QString user_id)
{
qDebug()<<"id=" <<id;
this->num = num;
level = 1;
exp = 0;
hp = 300;
power = 30;
defence = 30;
attack_interval = 500;
this->user_id = user_id;
this->id = id;
switch (id)
{
case PIKACHU:
name = "Pikachu";
attack_interval = 400;
break;
case HITOKAGE:
name = "Hitokage";
power = 40;
break;
case ZENIGAME:
name = "Zenigame";
power = 40;
break;
case FUSHIGIDANE:
name = "Fushigidane";
hp = 350;
break;
case DEWGONG:
name = "Dewgong";
hp = 350;
break;
case PERORINGA:
name = "Peroringa";
defence = 40;
break;
}
}
void my_pokemon::print()
{
qDebug() << "user_id:" << user_id;
qDebug() << "id:" << id << endl;
qDebug() << "name:" << name << endl;
qDebug() << "level:" << level << endl;
qDebug() << "exp:" << exp << endl;
qDebug() << "hp:" << hp << endl;
qDebug() << "power:" << power << endl;
qDebug() << "defence:" << defence << endl;
qDebug() << "attack_interval:" << attack_interval << endl;
}
|
f4972a4a1f0d8900af520b88600955218967834a | a5715c220f339415004eacd218ad8a232d239147 | /Zajecia01/Zaj01_dodatkowe zadania/Zaj01/zad1.cpp | c1487d3de0ba1258427d2285f0fa30000c01fd9e | [] | no_license | Misiek29/Grafika | f90bd9f0697ca3b59f8ebde986d41637f5c67874 | 9f60adebdcb8782b672d28680691b719fd42b954 | refs/heads/master | 2021-01-21T17:23:18.381781 | 2017-04-20T18:32:48 | 2017-04-20T18:32:48 | 85,240,417 | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 681 | cpp | zad1.cpp |
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
// Funkcja wywoływana w celu narysowania sceny
void RenderScene(void) {
// Wyczyszczenie okna aktualnym kolorem czyszczącym
glClear(GL_COLOR_BUFFER_BIT);
/// Przekazanie polecenia czyszczenia do wykonania
glFlush();
}
// Ustalenie stanu rendrowania
void SetupRC(void) {
glClearColor(0.5f, 0.35f, 0.05f,0.0f);
}
// Główny punki wejścia programu
void main(int argc, char **argv) {
//this is init function
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Mój pierwszy program w GLUT");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}
|
0e3c5945382ad45b727b0500289d2b3adc82d0f3 | 92548377fb4a91af7cc56570242aa3168cc6c9c6 | /Algospot/CHRISTMAS.cpp | 96644ec9ab627f663f4114172019c8e6d25f1e40 | [] | no_license | LaLlorona/Algorithms | d993a05f5dbc22850d0f6a061a5f35ecff5f8af3 | 6d02a9552c22acefa58686e909bc8ae0479a6e4b | refs/heads/master | 2023-05-24T17:37:14.993992 | 2023-05-17T05:33:14 | 2023-05-17T05:33:14 | 220,796,924 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,209 | cpp | CHRISTMAS.cpp |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
using namespace std;
int num_box;
int num_children;
int dolls[100001], partialsum[100002];
void fillPartialSum() {
partialsum[0] = 0;
for (int i = 1; i < num_box + 1; i++) {
partialsum[i] = (partialsum[i - 1] + dolls[i - 1]) % num_children;
}
}
long long calculateOneOrder() {
vector<long long>have_seen(num_children, 0);
long long ret = 0;
for (int i = 0; i < num_box + 1; i++) {
have_seen[partialsum[i]]++;
}
for (int i = 0; i < num_children; i++) {
if (have_seen[i] >= 2) {
ret = (ret +(have_seen[i] * (have_seen[i] - 1) / 2)) % 20091101;
}
}
return ret;
}
int calculateMultiplerOrder() {
// int& ret = cache[buy_until];
// int& prev_same_index = prevcache[buy_until];
// if (ret != -1) {
// return ret;
// }
// if (prev_same_index == -1) {
// for (int i = buy_until; i >= 0; i--) {
// if (partialsum[i] == partialsum[buy_until + 1]) {
// prev_same_index = i;
// break;
// }
// }
// }
// ret = calculateMultiplerOrder(buy_until - 1);
// if (prev_same_index != -1) {
// ret = max(ret, calculateMultiplerOrder(prev_same_index) + 1);
// }
// return ret;
vector<int> ret(num_box + 1, 0);
vector<int> prev(num_children, -1);
for (int i = 0; i < num_box + 1; i++) {
if (i > 0) {
ret[i] = ret[i-1];
}
else{
ret[i] = 0;
}
int loc = prev[partialsum[i]];
if (loc != -1) {
ret[i] = max(ret[i], ret[loc] + 1);
}
prev[partialsum[i]] = i;
}
return ret.back();
}
int main()
{
int num_testcase;
cin >> num_testcase;
for (int i = 0; i < num_testcase; i++) {
cin >> num_box;
cin >> num_children;
for (int k = 0; k < num_box; k++) {
cin >> dolls[k];
}
fillPartialSum();
cout << calculateOneOrder() << " ";
cout << calculateMultiplerOrder() << endl;;
}
return 0;
}
|
ba6728bf4345ced72f27b1e45da00f6b6c2797b5 | ac8399bf92a5c062876a019f4652e3e7b2cbd4ee | /1373countOneFromOneToN/main.cpp | 65371c9b2affd019b9d6815b1d38a417f9c02b57 | [] | no_license | LucasYang7/JobduOJ-InterviewQuestions | ecc792f4354e9625b8f2f95bdab6a44c38ffb263 | 3008c3e922d5b6e83b5c15eeb4c9d2466191bb40 | refs/heads/master | 2020-12-25T19:15:09.046520 | 2015-06-21T06:06:37 | 2015-06-21T06:06:37 | 37,798,693 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,823 | cpp | main.cpp | #include<stdio.h>
/**
* 统计区间[1,n]中1出现的次数
* @param n 输入的整数n
* @return count 返回区间[1,n]中1出现的次数
*/
long long countOneFromOneToN(int n)
{
long long count = 0; // 统计1 ~ n中1出现的次数
if(n < 1)
return count;
else
{
int tempN = n; // 用于保存处理过程中的n
int lowBits = 0; // 整数n中比当前进制位更低的低位部分
int highBits = n; // 整数n中比当前进制位更高的高位部分
int currentDecimalBit = 0; // 整数n当前被处理数位所对应的数字,最先处理个位上的数字
int currentDecimalWeight = 1; // 整数n当前正在处理的进制位,最先处理个位
while(tempN > 0)
{
highBits = n / (10 * currentDecimalWeight); // 求高位部分
if(currentDecimalWeight > 1)
{
lowBits = n % currentDecimalWeight; // 求低位部分
}
currentDecimalBit = tempN % 10; // 求正在被处理的当前位
// 将当前位与1进行比较,然后分类讨论统计1出现的次数
if(currentDecimalBit > 1)
{
count += (highBits + 1) * currentDecimalWeight;
}
else if(currentDecimalBit == 1)
{
count += highBits * currentDecimalWeight + lowBits + 1;
}
else
{
count += highBits * currentDecimalWeight;
}
tempN = tempN / 10;
currentDecimalWeight = 10 * currentDecimalWeight; // 跳到n的下一个高位,例如从个位跳到十位
}
return count;
}
}
/**
* 交换两个整数
* @param a 整数a的地址
* @param b 整数b的地址
* @return void
*/
void swap(int * a,int * b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int main()
{
long long result; // [a,b]区间中1出现的次数
long long CountA; // [1,a-1]区间中1出现的次数
long long CountB; // [1,b]区间中1出现的次数
int a,b;
while(EOF != scanf("%d%d",&a,&b))
{
if(a > b) // 如果输入的a比b大,则需要交换两个数
{
swap(&a,&b);
}
CountA = countOneFromOneToN(a - 1); // 统计[1,a-1]区间中1出现的次数
CountB = countOneFromOneToN(b); // 统计[1,b]区间中1出现的次数
result = CountB - CountA;
printf("%lld\n",result);
}
return 0;
}
/**************************************************************
解题报告:http://blog.csdn.net/pengyan0812/article/details/46439491
****************************************************************/ |
a76baf13117b0bfa42c94361a950206b1ef9b85c | 6702a19fb2dded0e8cfa09870b20d86259b085d2 | /SDKs/NoesisGUI/Include/NsCore/CharConverter.h | e917772398a6d263df69f7414490c531dcf6945d | [] | no_license | whztt07/IceCrystal | e1096f31b1032170b04c1af64c89109b555b94d0 | 288e18d179d0968327e29791462834f1ce9134e6 | refs/heads/master | 2023-08-31T15:02:01.193081 | 2021-10-06T12:17:44 | 2021-10-06T12:17:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,146 | h | CharConverter.h | ////////////////////////////////////////////////////////////////////////////////////////////////////
// NoesisGUI - http://www.noesisengine.com
// Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __CORE_CHARCONVERTER_H__
#define __CORE_CHARCONVERTER_H__
#include <NsCore/Noesis.h>
#include <NsCore/TypeConverterApi.h>
#include <NsCore/TypeConverter.h>
#include <NsCore/ReflectionDeclare.h>
namespace Noesis
{
////////////////////////////////////////////////////////////////////////////////////////////////////
/// Converter for char
////////////////////////////////////////////////////////////////////////////////////////////////////
class NS_CORE_TYPECONVERTER_API CharConverter: public TypeConverter
{
public:
/// From TypeConverter
//@{
bool CanConvertFrom(const Type* type) const override;
bool TryConvertFromString(const char* str, Ptr<BaseComponent>& result) const override;
//@}
NS_DECLARE_REFLECTION(CharConverter, TypeConverter)
};
}
#endif
|
24e87d6fa1d50f9c76265e93807d15f60dacff3c | df86b2ee7bd04af8f3cdd0a759060bf0ae2f4dd4 | /NeoOnnx/src/NodeUtils.h | 3f463c2636a03a5834330296ef5d01975dbddd94 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"NCSA",
"MIT",
"LicenseRef-scancode-protobuf",
"LicenseRef-scancode-arm-llvm-sga",
"Intel",
"LLVM-exception"
] | permissive | azureopen/neoml | 5cccfc4d315d7a56988ed6a2c2dc947750a8f3ec | 2fb337396c8de6f9c1ac20fe1f76b05827229f2b | refs/heads/master | 2023-02-16T12:37:13.849244 | 2021-01-14T10:33:16 | 2021-01-14T10:33:16 | 286,489,414 | 0 | 1 | NOASSERTION | 2020-11-05T11:34:35 | 2020-08-10T13:55:45 | null | UTF-8 | C++ | false | false | 1,575 | h | NodeUtils.h | /* Copyright © 2017-2020 ABBYY Production LLC
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 "Tensor.h"
#include "GraphCache.h"
// Forward declaration(s)
namespace onnx {
class NodeProto;
} // namespace onnx
namespace NeoOnnx {
// Pooling type
enum TPoolingType {
PT_Max, // Max pooling
PT_Mean, // Mean pooling
PT_Count
};
// Calculates the padding of the operation with 'attributes' for the last 'kernelShape.Size()' dimensions of the 'inputShape'
void CalculatePadding( const CString& autoPad, const CTensorShape& inputShape,
const CTensorShape& kernelShape, CFastArray<int, 8>& pads, const onnx::NodeProto& onnxNode );
// Repacks weights from channel-frst to channel-last if node if flatten operator
// Required for Gemm, LSTM etc
// Returns the pointer to the same blob if repack isn't needed
CPtr<CDnnBlob> RepackWeightIfFlattened( const CNode* node, const CTensorCache& tensors, const CDimCache& dims, CDnnBlob* weight );
} // namespace NeoOnnx
|
8e2a0c8dced97bca9a8468908247bcf482bc5f86 | afe2f9f53a1e2bc0a48cd965dcddc3341c9e5c56 | /Sources/CZ3/math/dd/dd_fdd.h | e17233aa40c09f923dd4a4265e06341742fb08d0 | [
"MIT"
] | permissive | LuizZak/swift-z3 | 2b9e039148c44bf76c38f1468c96c3930dc7ed2c | 5c5d85e2d9e6b727486d872fbd8e6fa8eceeaf72 | refs/heads/master | 2023-05-25T06:24:41.617541 | 2023-05-16T12:41:37 | 2023-05-16T12:41:37 | 238,067,756 | 8 | 4 | MIT | 2023-05-12T17:46:57 | 2020-02-03T21:41:37 | C++ | UTF-8 | C++ | false | false | 3,531 | h | dd_fdd.h | /*++
Copyright (c) 2021 Microsoft Corporation
Module Name:
dd_fdd
Abstract:
Finite domain abstraction for using BDDs as sets of integers, inspired by BuDDy's fdd module.
Author:
Jakob Rath 2021-04-20
Nikolaj Bjorner (nbjorner) 2021-04-20
--*/
#pragma once
#include "math/dd/dd_bdd.h"
#include "util/vector.h"
#include "util/rational.h"
namespace dd {
enum class find_t { empty, singleton, multiple };
std::ostream& operator<<(std::ostream& out, find_t x);
/**
* Finite domain abstraction over BDDs.
*/
class fdd {
unsigned_vector m_pos2var; // pos -> BDD var
unsigned_vector m_var2pos; // var -> pos (pos = place number in the bit representation, 0 is LSB's place)
bdd_manager* m;
bddv m_var;
static unsigned_vector seq(unsigned count, unsigned start = 0, unsigned step = 1) {
unsigned_vector result;
unsigned k = start;
for (unsigned i = 0; i < count; ++i, k += step)
result.push_back(k);
return result;
}
unsigned var2pos(unsigned var) const;
bool contains(bdd const& b, bool_vector const& value) const;
rational bits2rational(bool_vector const& v) const;
bool_vector rational2bits(rational const& r) const;
public:
/** Initialize FDD using BDD variables from 0 to num_bits-1. */
fdd(bdd_manager& manager, unsigned num_bits, unsigned start = 0, unsigned step = 1) : fdd(manager, seq(num_bits, start, step)) { }
fdd(bdd_manager& manager, unsigned_vector const& vars) : fdd(manager, unsigned_vector(vars)) { }
fdd(bdd_manager& manager, unsigned_vector&& vars);
unsigned num_bits() const { return m_pos2var.size(); }
unsigned_vector const& bdd_vars() const { return m_pos2var; }
bddv const& var() const { return m_var; }
/** Equivalent to var() != 0 */
bdd non_zero() const;
/** Checks whether the integer val is contained in the BDD when viewed as set of integers.
* Precondition: the bdd only contains variables managed by this fdd.
*/
bool contains(bdd b, rational const& val) const;
/** Returns an integer contained in the BDD, if any, and whether the BDD is a singleton.
* Precondition: the bdd only contains variables managed by this fdd.
*/
find_t find(bdd b, rational& out_val) const;
/** Like find, but returns hint if it is contained in the BDD. */
find_t find_hint(bdd b, rational const& hint, rational& out_val) const;
/*
* find largest value at lo or above such that bdd b evaluates to true
* at lo and all values between.
* dually, find smallest value below hi that evaluates b to true
* and all values between the value and hi also evaluate b to true.
* \param b - a bdd using variables from this
* \param lo/hi - bound to be traversed.
* \return false if b is false at lo/hi
* \pre variables in b are a subset of variables from the fdd
*/
bool sup(bdd const& b, bool_vector& lo) const;
bool inf(bdd const& b, bool_vector& hi) const;
bool sup(bdd const& b, rational& lo) const;
bool inf(bdd const& b, rational& hi) const;
/*
* Find the min-max satisfying assignment.
* \pre b is not false.
*/
rational max(bdd b) const;
rational min(bdd b) const;
};
}
|
8d2ef31846ef91d34f698d980f3d3e8f78bc1707 | 37cabc06e7a1f39e086c4e797884dc4b54fe54f8 | /noudar-rendering/GraphicNode.h | 31d558c3578bde91901619a7a538dd0e9105266c | [
"BSD-2-Clause"
] | permissive | msgpo/dungeons-of-noudar | fb0da65c82516a2dce313e49b06d446a7cd2cc5e | 40fe44c4a180d7daf3fe97eff4ddbfd2cd558c62 | refs/heads/master | 2021-10-16T10:53:07.510397 | 2019-02-10T20:06:06 | 2019-02-10T20:06:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 589 | h | GraphicNode.h | //
// Created by monty on 15-03-2017.
//
#ifndef DUNGEONS_OF_NOUDAR_X11_GRAPHICNODE_H
#define DUNGEONS_OF_NOUDAR_X11_GRAPHICNODE_H
namespace odb {
class GraphicNode {
public:
explicit GraphicNode(std::string aFrameId, glm::vec2 aRelativePosition, glm::vec2 aFinalPosition );
explicit GraphicNode(std::string aFrameId, glm::vec2 aRelativePosition );
std::string mFrameId;
glm::vec2 mRelativePosition;
glm::vec2 mFinalPosition;
glm::vec2 getPositionForTime( float progress );
};
}
#endif //DUNGEONS_OF_NOUDAR_X11_GRAPHICNODE_H
|
39ea4c489aeff8c3edff242240981d2d24ffecae | ef4efdce45614455f697025b0e6c42f7b6aa6161 | /BOJ2502_떡 먹는 호랑이/Ricecake_Tiger/Tiger.cpp | 2c330c5974448f906ebb6c28c478c10340ac1934 | [] | no_license | jungjai/Alogorithm | 49a17524ede3d6e4188d393360df2b546742b9e2 | f367bfb136fde6d3153960225b40ff5e3b81a4b1 | refs/heads/master | 2020-05-08T22:48:39.222867 | 2019-10-17T02:51:12 | 2019-10-17T02:51:12 | 180,970,321 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 526 | cpp | Tiger.cpp | #include<stdio.h>
#pragma warning (disable : 4996)
int main()
{
freopen("input.txt", "r", stdin);
int pra = 1, prb = 0, a = 0, b = 1, tpa = 0, tpb = 0;
int day, rice, checkA = 0, checkB = 0;
scanf("%d %d", &day, &rice);
for (int i = 3; i <= day; i++) {
tpa = a; tpb = b;
a += pra; b += prb;
pra = tpa; prb = tpb;
}
checkA = rice / (a + b) + 1;
for (int i = 1; i <= checkA; i++) {
checkB = rice - i * a;
if (checkB % b == 0) {
printf("%d\n%d\n", i, checkB / b);
i = rice;
}
}
return 0;
} |
a5dac5da31f0c71b9a660984de40e6656b8888cc | 24c263f2d5cb4f35e8d2757b0f2eb335c87c5bf4 | /進階程式設計/HW4英文字母.cpp | c03e25a496eb4afaadb4d430608d0479a3ebf6f7 | [] | no_license | smallweii/NCUE | e78b511486ec91a7f4357fcf4da98ef34ca95dea | 4e276cc08a263e963a1ae44e7119c2f9598df84c | refs/heads/master | 2021-05-17T03:12:28.452181 | 2020-03-28T13:19:11 | 2020-03-28T13:19:11 | 250,591,985 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 873 | cpp | HW4英文字母.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char input1[50],input2[50],input3[50];
int num,n,i,sum=0;
FILE *DataIn;
DataIn=fopen("T4.txt","r");
if(DataIn!=NULL)
{
if((fscanf(DataIn,"%d",&num))==1)
{
while(fscanf(DataIn,"%s",input1)==1&&fscanf(DataIn,"%s",input2)==1)
{
sum=0;
n=strlen(input1);
for(i=0;i<n;i++)
{
input1[i]=(int)input1[i]-(int)'0';
input2[i]=(int)input2[i]-(int)'0';
input3[i]=input1[i]-input2[i];
if(input3[i]<0)
{
input3[i]*=-1;
}
sum+=input3[i];
}
printf("%d\n",sum);
}
}
}
fclose(DataIn);
system("pause");
return 0;
}
|
6a3d440bdfad5e390d3dceec605adfeff7a332cf | ed40a9344f0b3dfb4b1fbf506b011e66a2d694cc | /include/perfect/detail/turbo/linux_power.hpp | 2caf2bff1ca5f8ddd727e6301f2ba6038cc1ca72 | [] | no_license | abduld/perfect | 74fa50dc78eea4ec26d0ad1cbc5aa09639d646a7 | fabfecd30688f3f62bc861d06f257b9b1d49d025 | refs/heads/master | 2023-04-09T20:44:56.062989 | 2019-10-02T12:34:58 | 2019-10-02T12:34:58 | 499,846,900 | 0 | 0 | null | 2023-04-04T00:22:47 | 2022-06-04T14:18:16 | null | UTF-8 | C++ | false | false | 964 | hpp | linux_power.hpp | #pragma once
#include "perfect/result.hpp"
#include "perfect/detail/fs.hpp"
namespace perfect {
namespace detail {
bool has_acpi_cpufreq_boost() {
return bool(std::ifstream("/sys/devices/system/cpu/cpufreq/boost"));
}
Result write_acpi_cpufreq_boost(const std::string &s) {
assert(has_acpi_cpufreq_boost());
std::string path("/sys/devices/system/cpu/cpufreq/boost");
return write_str(path, s);
}
std::string read_acpi_cpufeq_boost() {
assert(has_acpi_cpufreq_boost());
std::string path("/sys/devices/system/cpu/cpufreq/boost");
std::ifstream ifs(path, std::ifstream::in);
std::string result;
std::getline(ifs, result);
return result;
}
bool is_turbo_enabled() {
return "1" == read_acpi_cpufeq_boost();
}
Result disable_cpu_turbo() {
return write_acpi_cpufreq_boost("0");
}
Result enable_cpu_turbo() {
return write_acpi_cpufreq_boost("1");
}
} // namespace detail
} // namespace perfect
|
39252f4394d7e77b6e5d377111e13d45a43cd93a | b3ad475382cd2962ad0073b664d55141950a87fe | /non_deduced_context.cpp | faa2e5ddacee9e3bb8cb795182a928f050774bcc | [
"MIT"
] | permissive | vsoftco/snippets | 764edce0f82f9f03a52c4709921f3e3b27cfc078 | 467520e285f9c83024416f050a5357bf659f4860 | refs/heads/main | 2022-09-16T06:37:07.666403 | 2021-01-14T14:40:51 | 2021-01-14T14:40:51 | 34,310,463 | 15 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 517 | cpp | non_deduced_context.cpp | // Non-deduced context in templates
template <typename T>
struct non_deduced_context {
using type = T;
};
template <typename T>
using non_deduced_context_t = typename non_deduced_context<T>::type;
template <typename T>
void f(T x) {} // can deduce the context
template <typename T>
void g(non_deduced_context_t<T> x) {} // cannot deduce the context
int main() {
int x = 0;
f(x); // ok
// g(x); // doesn't compile, cannot deduce the type of x
g<int>(x); // compiles, explicit type deduction
}
|
39e9db06fe3a62861e644ac0a5327c0d8f9793a3 | 3565cc3249e37e061ccbad965d5dc19c09acfaa1 | /src/color.cpp | b29c4c6cff89b86101a751a99383d739c764190e | [] | no_license | fried-ice/connect_four | d0e65d5e1bd859dc38ba05509660fbb0863797b0 | 724bef21f8d781416ec85e8822f6f143f1334143 | refs/heads/master | 2020-04-05T19:00:52.827855 | 2016-01-16T17:38:20 | 2016-01-16T17:38:20 | 43,495,504 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 935 | cpp | color.cpp | #include "color.h"
Color::Color() {
r = 0;
g = 0;
b = 0;
}
Color::Color(unsigned char newR, unsigned char newG, unsigned char newB, std::string* newToken) {
r = newR;
g = newG;
b = newB;
token = *newToken;
}
void Color::setColor(unsigned char newR, unsigned char newG, unsigned char newB) {
r = newR;
g = newG;
b = newB;
}
void Color::setToken(std::string* newToken) {
token = *newToken;
}
unsigned char Color::getR() {
return r;
}
unsigned char Color::getG() {
return g;
}
unsigned char Color::getB() {
return b;
}
std::string* Color::getToken() {
return &token;
}
extern std::ostream& operator<<(std::ostream& os, Color* col) {
col->print(os);
return os;
}
std::ostream& Color::print(std::ostream& os) {
os << "Token: " << token << " | Red:" << (int)this->getR() << " Green: " << (int)this->getG() << " Blue: " << (int)this->getB();
return os;
}
|
d888c148de0e9a4d7285bb7a67c94ad3721027ed | 3845902292b2848e4df543741fef8e988b035284 | /UserInterface.cpp | 40df10539de4ad8ca83dd86f6dfa9ea99911af8c | [] | no_license | LauraDiosan-CS/lab8-11-polimorfism-DanTheStud | 3add818cde287a042e38113794e0f120c6bcddaf | c3bdae043571a2ef5fe7476824c1680f7936343b | refs/heads/master | 2022-09-15T21:55:49.746808 | 2020-05-21T15:56:24 | 2020-05-21T15:56:24 | 265,890,018 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,006 | cpp | UserInterface.cpp | #include <iostream>
#include <fstream>
#include "UserInterface.h"
#include "Repository_CSV.h"
#include "Repository_TXT.h"
#include "ValidationException.h"
#include "ReadFromFileException.h"
#include "Exceptions.h"
#include "Artist.h"
#include "Film.h"
#include "RepositoryException.h"
#include "Util.h"
void UI::display_manu()
{
cout << "1. Afiseaza toate evenimentele.\n";
cout << "2. Cautare evenimente dupa zi.\n";
cout << "3. Cumpara bilete la un eveniment.\n";
cout << "4. Adaugare eveniment cu artisti.\n";
cout << "5. Adaugare evenimente cu filme.\n";
cout << "6. Sterge eveniment.\n";
cout << "7. Modifica eveniment.\n";
cout << "0. Exit\n";
}
void UI::display_user_manu()
{
cout << "1. Login\n";
cout << "2. Sign up\n";
cout << "0. Exit\n";
}
void UI::choose_file_type()
{
int option = 0;
cout << "Alegeti tipul de fisier dorit: 1 - .CSV || 2 - .TXT\noptiunea alease: ";
cin >> option;
while (option != 1 && option != 2)
{
cout << "Optiunea aleasa trebuie sa fie: 1 - .CSV SAU 2 - .TXT! Mai incercati!\noptiune aleasa: ";
cin >> option;
}
if (option == 1)
{
this->service.set_repository(new Repository_CSV("File_CSV.csv"));
}
else
{
this->service.set_repository(new Repository_TXT("File_TXT.txt"));
}
}
void UI::add_film()
{
string titlu, actori, data, locatie;
int nr_locuri_disponibile, nr_locuri_vandute;
cout << " Titlul filumui: "; cin >> titlu;
cout << " Actorii filmului: "; cin >> actori;
cout << " Data la care va avea loc filmul: "; cin >> data;
cout << " Locatia unde se va difuza filmul: "; cin >> locatie;
cout << " Numarul locurilor disponibile: "; cin >> nr_locuri_disponibile;
cout << " Numarul locurilor vandute: "; cin >> nr_locuri_vandute;
try
{
this->service.add_film(titlu, actori, data, locatie, nr_locuri_disponibile, nr_locuri_vandute);
this->service.save_to_file();
}
catch (ValidationException& e)
{
cout << e.what() << endl;
}
catch (RepositoryException& e)
{
cout << e.what() << endl;
}
}
void UI::add_artist()
{
string nume, data, locatie;
int nr_locuri_disponibile, nr_locuri_vandute;
cout << " Numle artistului: ";
getline(cin, nume);
cout << " Data la care va avea loc evenimentul: ";
getline(cin, data);
cout << " Locatia unde se va difuza evenimentul: ";
getline(cin, locatie);
cout << " Numarul locurilor disponibile: ";
cin >> nr_locuri_disponibile;
cout << " Numarul locurilor vandute: ";
cin >> nr_locuri_vandute;
try
{
this->service.add_artist(nume, data, locatie, nr_locuri_disponibile, nr_locuri_vandute);
this->service.save_to_file();
}
catch (ValidationException& e)
{
cout << e.what() << endl;
}
catch (RepositoryException& e)
{
cout << e.what() << endl;
}
}
void UI::modify_festival()
{
vector<Festival*> festivale = service.get_all();
string data, locatie;
int raspuns;
cout << "Ce doriti sa modificati? 1 - Film || 2 - Artist.\n raspuns: ";
cin >> raspuns;
if (raspuns == 1)
{
string titlu, actori, data_new, locatie_new;
int nr_loc_val, nr_loc_vand;
cout << "Data evenimentului care doriti sa il modificati: ";
cin >> data;
cout << "Locatia evenimentului care doriti sa il modificati: ";
cin >> locatie;
cout << "titlu noua: ";
cin >> titlu;
cout << "actori noua: ";
cin >> actori;
cout << "data noua: ";
cin >> data_new;
cout << "locatie noua: ";
cin >> locatie_new;
cout << "numar locuri valabile noua: ";
cin >> nr_loc_val;
cout << "numar locuri vandute noua: ";
cin >> nr_loc_vand;
service.update_film(data, locatie, titlu, actori, data_new, locatie_new, nr_loc_val, nr_loc_vand);
}
else if (raspuns == 2)
{
string nume, data_new, locatie_new;
int nr_loc_val, nr_loc_vand;
cout << "Data evenimentului care doriti sa il modificati: ";
cin >> data;
cout << "Locatia evenimentului care doriti sa il modificati: ";
cin >> locatie;
cout << "nume noua: ";
cin >> nume;
cout << "data noua: ";
cin >> data_new;
cout << "locatie noua: ";
cin >> locatie_new;
cout << "numar locuri valabile noua: ";
cin >> nr_loc_val;
cout << "numar locuri vandute noua: ";
cin >> nr_loc_vand;
service.update_artist(data, locatie, nume, data_new, locatie_new, nr_loc_val, nr_loc_vand);
}
else
{
cout << "Nu ati ales o optiune buna, mai incercati.\n";
}
}
void UI::delete_festival()
{
string data, locatie;
cout << "Data evenimentului care doriti sa il stergeti: ";
cin >> data;
cout << "Locatia evenimentului care doriti sa il stergeti: ";
cin >> locatie;
vector<Festival*> festivale = service.get_all();
for (int i = 0; i < festivale.size(); i++)
{
if (festivale[i]->get_data() == data && festivale[i]->get_loc() == locatie)
{
service.delete_festival(festivale[i]->get_data(), festivale[i]->get_loc(), festivale[i]->get_numar_locuri_disponibile(), festivale[i]->get_numar_locuri_vandute());
}
}
}
void UI::show()
{
this->print_festival(this->service.get_all());
}
void UI::print_festival(vector<Festival*> festivale)
{
for (Festival* festival : festivale)
{
cout << festival->toString(" ").erase(0, 3) << endl;
}
}
void UI::login(string& username, string& password)
{
Repository_Users repository_users("Users.txt");
Service_Users service_users(repository_users);
try
{
while (true)
{
string username;
cout << "USERNAME: ", cin >> username;
if (service_users.verify_username(username) == 1)
{
string password;
cout << "PASSWORD: ", cin >> password;
if (service_users.verify_password(password) == 1)
{
cout << "Login successful!" << "\n";
break;
}
else
{
cout << "Username sau password gresit!\n";
}
}
else
{
cout << "Username gresit, mai incearca.\n";
}
}
}
catch (MyException e)
{
cout << "ERROR: " << e.what() << endl;
}
}
void UI::add_new_user()
{
Repository_Users repository_users("Users.txt");
Service_Users service_users(repository_users);
string username, password;
cout << "Username: ";
cin >> username;
cout << "Password: ";
cin >> password;
service_users.add_user(username, password);
}
void UI::modify_user(string& username, string& password)
{
Repository_Users repository_users("Users.txt");
Service_Users service_users(repository_users);
int raspuns;
string old_username = username;
string old_password = password;
cout << "Doriti sa modificati username-ul? 1 - Da -- 2 - Nu.\nraspuns: ";
cin >> raspuns;
if (raspuns == 1)
{
cout << "noul username: ";
cin >> username;
}
cout << "Doriti sa modificati password-ul? 1 - Da -- 2 - Nu.\nraspuns: ";
cin >> raspuns;
if (raspuns == 1)
{
cout << "noul password: ";
cin >> password;
}
Users old_user(old_username, old_password);
Users new_user(username, password);
service_users.update_user(old_user, new_user);
}
void UI::del_user(Users user_to_del)
{
Repository_Users repository_users("Users.txt");
Service_Users service_users(repository_users);
try
{
service_users.delete_user(user_to_del);
}
catch (MyException e)
{
cout << "ERROR: " << e.what() << endl;
}
}
void UI::cumpara_bilet()
{
string data, locatie;
int raspuns;
vector<Festival*> festivale = service.get_all();
cout << "Data si locatia evenimentului pentru care doriti sa cumparati bilete:\n";
cout << "data: ";
cin >> data;
cout << "locatie: ";
cin >> locatie;
cout << "Cate bilete doriti sa cumparati?\nraspuns: ";
cin >> raspuns;
for (int i = 0; i < festivale.size(); i++)
{
if (festivale[i]->get_data() == data && festivale[i]->get_loc() == locatie)
{
if (festivale[i]->get_numar_locuri_disponibile() >= raspuns)
{
festivale[i]->set_numar_locuri_disponibile(festivale[i]->get_numar_locuri_disponibile() - raspuns);
festivale[i]->set_numar_locuri_vandute(festivale[i]->get_numar_locuri_vandute() + raspuns);
break;
}
else
{
cout << "Nu sunt destule locuri disponibile!\n";
}
}
}
}
void UI::cauta_eveniment_dupa_zi()
{
string zi;
vector<Festival*> festivale = service.get_all();
cout << "Ziua cautata: ";
cin >> zi;
for (int i = 0; i < festivale.size(); i++)
{
if (festivale[i]->get_data()[0] == zi[0] && festivale[i]->get_data()[1] == zi[1])
{
cout << festivale[i]->toString(" ") << "\n";
}
}
}
UI::UI()
{
}
UI::~UI()
{
}
void UI::run_UI()
{
bool logged_in = false, ok = true;
int option;
string usename_loged, password_loged;
while (!logged_in)
{
this->display_user_manu();
cout << "Optiunea aleasa: ";
cin >> option;
if (option == 1)
{
try
{
this->login(usename_loged, password_loged);
logged_in = true;
}
catch (MyException e)
{
cout << "ERROR: " << e.what() << endl;
}
}
else if (option == 2)
{
try
{
this->add_new_user();
}
catch (MyException e)
{
cout << "ERROR: " << e.what() << endl;
}
}
else if (option == 0)
{
ok = false;
break;
}
else
{
cout << "Alege o optiune corecta!";
}
}
if (ok == true)
{
this->choose_file_type();
bool running = true;
this->show();
while (running)
{
this->display_manu();
cout << "\noption: \n";
cin >> option;
cin.ignore();
if (option == 1)
{
this->show();
}
if (option == 2)
{
this->cauta_eveniment_dupa_zi();
}
if (option == 3)
{
this->cumpara_bilet();
this->service.save_to_file();
}
if (option == 4)
{
this->add_artist();
}
if (option == 5)
{
this->add_film();
}
if (option == 6)
{
this->delete_festival();
}
if (option == 7)
{
this->modify_festival();
}
if (option == 0)
{
running = false;
}
}
}
}
|
c4666c6a778402dd6a4d96bcf8c3be30356d020b | 264d7b318e20d0cb0c81cc4b67e44a622a9ede3b | /Device_2021_05_V3/Activity/Home.h | 51c2aa81d210063be59cbb51ebb4442c257908ec | [] | no_license | ManhHung-Nguyen/SimulatedSecuritySystem | 686739ff6b376020493ffb7cb464d3afc366f255 | c3417568a7e730e8a92dcdad1f6b71fa5c2ab054 | refs/heads/main | 2023-06-04T00:09:36.725756 | 2021-06-25T04:15:04 | 2021-06-25T04:15:04 | 380,118,750 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 619 | h | Home.h | #pragma once
#include "Mode.h"
#include "Constants.h"
#include "../System/Clock.h"
class HomePage : public Mode
{
static PMODE* arms;
int current_arm_index;
int current_mode_index;
bool unlocked;
byte* zone_config;
byte* input_config;
protected:
void go_home() override;
void go_up() override;
void select_item(int dir) override;
public:
HomePage();
PMODE* Handle() { return arms; }
public:
PMODE GetDisarm() { return arms[0]; }
PMODE GetArm(int index = 0);
void Activate() override;
void Activate(int index);
void Lock();
void Unlock();
};
|
e0e5e7bd5d579a50e52f5ef05b2c444de56440d2 | eff140a5fde1756b374c94e670b3b95d7cc36d4b | /firmware/application/application.ino | a0e91e6a6cf7210ec88a0d393b7b7af32db1ff2f | [] | no_license | mogorman/bluemoon | bc4d07f6d1375e4aca2914561613a763ca2b67ea | d80cd601a11a146f761fb3b09b9897c9b8e932a1 | refs/heads/master | 2016-09-06T02:37:27.270088 | 2015-02-28T06:47:41 | 2015-02-28T06:47:41 | 28,713,206 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,505 | ino | application.ino | /*
*
* Battery discharge formula
* equivalent_current_mA = (percent_monthly_discharge_rate / 100) * capacity_maH / (24 * 30)
*/
//#include <Wire.h>
#include <RFduinoBLE.h>
uint8_t sequence, sequence_check_code;
uint8_t door_state, check_state;
uint8_t lock[] = {0xbd, 0x04, 0x0c, 0xe7, 0x03, 0x13};
uint8_t unlock[] = {0xbd, 0x04, 0x09, 0xe7, 0x05, 0x10};
uint8_t status[] = {0xbd, 0x04, 0x07, 0xe7, 0x07, 0x1c};
uint8_t bat_status[] = {0xbd, 0x04, 0x07, 0xe7, 0x09, 0x1c};
uint8_t unpair[] = {0xbd, 0x04, 0x03, 0xe7, 0x0e, 0x11};
uint8_t add_code[] = {0xbd, 0x0a, 0x0f, 0xe7, 0x0b, 0x00, 0x01, 0x12, 0x34, 0x56, 0x78, 0x1f};
uint8_t delete_code[] = {0xbd, 0x06, 0x1c, 0xe7, 0x0d, 0x00, 0x01, 0x0c};
uint8_t check_code[]= {0xbd, 0x06, 0x10, 0xe7, 0x0c, 0x00, 0x01, 0x03};
uint8_t pair_0[] = {0xbd, 0x04, 0x01, 0xe7, 0x18, 0x05};
uint8_t pair_1[] = {0xbd, 0x04, 0x08, 0xe7, 0x09, 0x1d};
uint8_t pair_2[] = {0xbd, 0x0b, 0x09, 0xe7, 0x0f, 0x14, 0x06, 0x21, 0x03, 0x33, 0x52, 0x06, 0x42};
uint8_t pair_3[] = {0xbd, 0x04, 0x0a, 0xe7, 0x10, 0x06};
uint8_t pair_4[] = {0xbd, 0x0b, 0x0b, 0xe7, 0x0f, 0x14, 0x06, 0x20, 0x20, 0x33, 0x54, 0x05, 0x67};
void check_code_message(uint8_t slot)
{
check_code[6] = slot;
send_message(check_code);
}
void delete_code_message(uint8_t slot)
{
check_code[6] = slot;
send_message(delete_code);
}
void set_code_message(uint8_t *code,uint8_t slot)
{
add_code[6] = slot;
send_message(add_code);
}
void send_message(uint8_t *message)
{
uint8_t i;
uint8_t length = message[1] + 2;
message[2] = sequence;
message[length - 1] = 0xff;
for(i = 1; i < length - 1; i++) {
message[length -1] ^= message[i];
}
for(i = 0 ; i < length; i++) {
Serial.write(message[i]);
}
sequence++;
}
/*
This RFduino sketch demonstrates a full bi-directional Bluetooth Low
Energy 4 connection between an iPhone application and an RFduino.
This sketch works with the rfduinoLedButton iPhone application.
The button on the iPhone can be used to turn the green led on or off.
The button state of button 1 is transmitted to the iPhone and shown in
the application.
*/
/*
Copyright (c) 2014 OpenSourceRF.com. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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.
*/
// pin 3 on the RGB shield is the red led
// (can be turned on/off from the iPhone app)
int led = 2;
// pin 5 on the RGB shield is button 1
// (button press will be shown on the iPhone app)
int button = 3;
int motor = 4;
// debounce time (in ms)
int debounce_time = 10;
// maximum debounce timeout (in ms)
int debounce_timeout = 100;
void setup() {
// led turned on/off from the iPhone app
// pinMode(led, OUTPUT);
// button press will be shown on the iPhone app)
pinMode(button, INPUT);
pinMode(motor, OUTPUT);
Serial.begin(9600);
// this is the data we want to appear in the advertisement
// (if the deviceName and advertisementData are too long to fix into the 31 byte
// ble advertisement packet, then the advertisementData is truncated first down to
// a single byte, then it will truncate the deviceName)
RFduinoBLE.advertisementData = "bluemoon";
// start the BLE stack
RFduinoBLE.begin();
}
int debounce(int state)
{
int start = millis();
int debounce_start = start;
while (millis() - start < debounce_timeout)
if (digitalRead(button) == state)
{
if (millis() - debounce_start >= debounce_time)
return 1;
}
else
debounce_start = millis();
return 0;
}
int delay_until_button(int state)
{
// set button edge to wake up on
if (state)
RFduino_pinWake(button, HIGH);
else
RFduino_pinWake(button, LOW);
do
// switch to lower power mode until a button edge wakes us up
RFduino_ULPDelay(INFINITE);
while (! debounce(state));
// if multiple buttons were configured, this is how you would determine what woke you up
if (RFduino_pinWoke(button))
{
// execute code here
RFduino_resetPinWake(button);
}
}
void loop() {
uint8_t input;
// delay(100);
while (Serial.available()) {
input = Serial.read();
}
// delay_until_button(HIGH);
// RFduinoBLE.send(1);
// delay_until_button(LOW);
// RFduinoBLE.send(0);
}
void RFduinoBLE_onDisconnect()
{
// don't leave the led on if they disconnect
// digitalWrite(led, LOW);
}
void RFduinoBLE_onReceive(char *data, int len)
{
// if the first byte is 0x01 / on / true
RFduinoBLE.send(data[0]);
switch(data[0]) {
case 0:
RFduinoBLE.send('U');
delay(100);
send_message(unpair);
break;
case 2:
RFduinoBLE.send('l');
digitalWrite(motor, HIGH);
delay(900);
digitalWrite(motor, LOW);
delay(300);
digitalWrite(motor, HIGH);
delay(700);
digitalWrite(motor, LOW);
delay(100);
send_message(lock);
break;
case 3:
RFduinoBLE.send('u');
digitalWrite(motor, LOW);
delay(100);
send_message(unlock);
break;
case 4:
RFduinoBLE.send('s');
delay(100);
send_message(status);
break;
/* case 'S': */
/* Serial.print("battery status"); */
/* send_message(bat_status); */
/* break; */
case 1:
RFduinoBLE.send('r');
send_message(pair_2);
break;
default:
break;
}
}
|
f66bcab6d02034f37c9c74ba1ba8518ff9385e57 | ce885991c5786b81b8a2fbb460e9c71a6d906ae2 | /modules/hamsandwich/pdata.cpp | 9a476de97ecb08422e777cb5516b2b433add3afa | [] | no_license | Nextra/amxmodx | 952c7a4f25c87fcf622efd6b56bbafec1eb80c6f | c5f6e26802434370a0dd4f4752c376444a3f5abd | refs/heads/master | 2021-01-17T20:17:06.679307 | 2015-05-10T15:12:50 | 2015-05-10T15:12:50 | 19,426,788 | 0 | 1 | null | 2015-03-09T16:46:24 | 2014-05-04T13:13:48 | C | UTF-8 | C++ | false | false | 3,906 | cpp | pdata.cpp | // vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Ham Sandwich Module
//
#include "amxxmodule.h"
#include "offsets.h"
#include "NEW_Util.h"
#include "ham_utils.h"
inline edict_t* INDEXENT2( int iEdictNum )
{
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
return MF_GetPlayerEdict(iEdictNum);
else
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
}
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
#define FM_CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
if (x <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
} \
}
#endif
#define FM_CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else if (x != 0 && FNullEnt(INDEXENT2(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
}
// Return -1 on null, -2 on invalid, and the the index of any other.
static cell AMX_NATIVE_CALL get_pdata_cbase_safe(AMX *amx, cell *params)
{
int index=params[1];
FM_CHECK_ENTITY(index);
int iOffset=params[2];
#ifdef __linux__
iOffset += params[3];
#elif defined __APPLE__
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
iOffset += params[3];
else
iOffset += params[4];
#endif
if (iOffset <0)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
return 0;
}
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
if (ptr == 0)
{
return -1;
}
for (int i=0; i<gpGlobals->maxEntities; ++i)
{
if (ptr == INDEXENT_NEW(i)->pvPrivateData)
{
return i;
}
}
return -2;
}
static cell AMX_NATIVE_CALL get_pdata_cbase(AMX *amx, cell *params)
{
int index=params[1];
FM_CHECK_ENTITY(index);
int iOffset=params[2];
#ifdef __linux__
iOffset += params[3];
#elif defined __APPLE__
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
iOffset += params[3];
else
iOffset += params[4];
#endif
if (iOffset <0)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
return 0;
}
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
return PrivateToIndex(ptr);
}
static cell AMX_NATIVE_CALL set_pdata_cbase(AMX *amx, cell *params)
{
int index=params[1];
FM_CHECK_ENTITY(index);
int target=params[3];
if (target != -1)
{
FM_CHECK_ENTITY(target);
}
int iOffset=params[2];
#ifdef __linux__
iOffset += params[4];
#elif defined __APPLE__
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
iOffset += params[4];
else
iOffset += params[5];
#endif
if (iOffset <0)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
return 0;
}
if (target == -1)
{
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = NULL;
}
else
{
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = INDEXENT_NEW(target)->pvPrivateData;
}
return 1;
}
AMX_NATIVE_INFO pdata_natives_safe[] =
{
{ "get_pdata_cbase_safe", get_pdata_cbase_safe },
{ NULL, NULL }
};
AMX_NATIVE_INFO pdata_natives[] =
{
{ "get_pdata_cbase", get_pdata_cbase },
{ "set_pdata_cbase", set_pdata_cbase },
{ NULL, NULL }
};
|
809b2f604351b45b86c478dd659064bcd8d04afb | 077efd5b690b44507bd26bc85521ef7de7f98203 | /RegionAreas.h | 9b5e4a5b69f60c389c2320d29fdbc45afdcc7661 | [] | no_license | maa2023/Mike_Projects | 0d3126ea6be41c5ba4feed62ebbc7fecb7a5d9e5 | 69e46abd5267b1b652955b0cfdc62d72698d3c6d | refs/heads/master | 2022-11-21T20:39:04.997982 | 2020-07-23T18:39:36 | 2020-07-23T18:39:36 | 282,025,201 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | h | RegionAreas.h | #ifndef REGIONAREAS_H
#define REGIONAREAS_H
#include <iostream>
#include <vector>
#include "KeyValuePair.h"
#include "InputHelper.h"
#include "RegionArea.h"
using namespace std;
class RegionAreas
{
private:
vector<RegionArea> areas;
vector<vector <int> > adjacencyList;
int listSize;
public:
RegionAreas();
int size() const;
RegionArea getArea(int areaId) const;
void setAdjacencyList(vector <vector <int> > list);
vector<vector <int> > getList();
int getListSize();
static RegionAreas loadFromFile(const string& fileName);
void printAdjacency();
};
#endif
|
710c27485abf3cf188305a62a1e43da3e4ba2e2f | 5b251abbc46deb030e7d165e47b9cf4e3c3ae697 | /SouthProject/GameObject.h | 87fd81adcd8cd8726bb6418331b24116b13a0cbf | [] | no_license | drcxd/SouthProject | f212eef1eec83f03fab2e44bd844e11c5fa62a82 | 29e44c8d43b837f59f40f8af5a0253ea36f7c188 | refs/heads/master | 2021-01-12T03:07:48.496276 | 2020-09-16T18:21:52 | 2020-09-16T18:21:52 | 78,162,553 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 397 | h | GameObject.h | /* The virtual class which only provide a pattern. */
#ifndef __GameObject__
#define __GameObject__
#include <string>
#include <SDL.h>
#include "LoaderParams.h"
class GameObject
{
public:
virtual void draw(void) = 0;
virtual void update(void) = 0;
virtual void clean(void) = 0;
protected:
GameObject(const LoaderParams* pParams) {}
virtual ~GameObject() {}
};
#endif // !__GameObject__
|
3116b2eaaf27595ccd8131d45b6c761e722e5ac8 | 0b853cec122cecdf398c9e46989b7654a296fcf8 | /patrol/statement/kien.cpp | 66eb4043377f5cd2b6ab5e47f058003ea98974cc | [] | no_license | KDuyVu/Problems | 3eed16a64fbf09d5e978ff7a2ded65047179c097 | aa7437c111d460ac1c30b759235ba41c53fb4e7f | refs/heads/master | 2023-06-07T16:43:35.829948 | 2016-05-13T10:28:23 | 2016-05-13T10:28:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 594 | cpp | kien.cpp | #include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define long long long
#define N 1003
int n, x[N], y[N];
int ax, bx, mx;
int ay, by, my;
main(){
cin >> n;
cin >> ax >> bx >> mx;
cin >> ay >> by >> my;
for (int i=1; i<=n; i++) {
x[i] = (ax*x[i-1]+bx)%mx;
y[i] = (ay*y[i-1]+by)%my;
}
long Sum = 0;
for (int i=1; i<=n; i++)
for (int j=i+1; j<=n; j++) {
int A=0, B=0;
for (int k=1; k<=n; k++)
if ((x[i]<x[k]) == (x[k]<x[j])) {
if (y[k]<y[i] && y[k]<y[j]) A++;
if (y[k]>y[i] && y[k]>y[j]) B++;
}
Sum += A*B;
}
cout << Sum << endl;
}
|
44e593d7e0eab6e54cfb77e789684219d180ddb0 | 76fe93cafa4fc550884f3fe4d8e38c900967ca13 | /TP3/server_Pelicula.cpp | ebf4243bb8dc89ac19e180afa8ac2d6750a2894d | [] | no_license | santiago-alvarezjulia/Taller2c | 8dac45be376380678ec042dbf3c4f361f28805fb | 23391846613581248ecae984a9b4acc118c0c4d1 | refs/heads/master | 2020-03-29T06:27:19.643476 | 2018-12-15T19:32:13 | 2018-12-15T19:32:13 | 149,625,281 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 311 | cpp | server_Pelicula.cpp | #include "server_Pelicula.h"
#include <string>
using std::string;
Pelicula::Pelicula(string& titulo, string& idioma, string& edad,
string& genero) : titulo(titulo), idioma(idioma), edad(edad),
genero(genero) {}
const string& Pelicula::getTitulo() const{
return this->titulo;
}
Pelicula::~Pelicula() {}
|
6c9588e0a13f35ab66b4e096ec9db770f06655db | d048d8c0bef283a890e30f958c4906a42121d6f5 | /Firmware/Firmware/src/graphics/fonts/LcdNova24px.cpp | a063232c646c72a4ce8826b76bd36cb2121e9e88 | [
"MIT"
] | permissive | bluecodecat/GradWork | ac33dffd55d47510492e0b268bc0a6e0d6e46f4b | a67e68963859d34b2a8a7f7b705b3cd86b2cc022 | refs/heads/master | 2022-11-03T04:54:04.381237 | 2020-04-28T20:26:00 | 2020-04-28T20:26:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 57,275 | cpp | LcdNova24px.cpp | #include "lvgl/lvgl.h"
/*******************************************************************************
* Size: 24 px
* Bpp: 2
* Opts:
******************************************************************************/
#ifndef LCDNOVA24PX
#define LCDNOVA24PX 1
#endif
#if LCDNOVA24PX
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
/* U+20 " " */
/* U+21 "!" */
0xc, 0xd4, 0x87, 0xa8, 0xb5, 0x3, 0x21, 0xff,
0xef, 0x43, 0xff, 0x81, 0x45, 0xa8, 0x1f, 0xfc,
0x5a, 0x2d, 0x40, 0xc8, 0x7f, 0xf2, 0xdd, 0x9,
0xc3, 0x9a, 0x34, 0x43, 0x9e, 0x6d, 0xe, 0xc3,
0xb0, 0xea, 0x2d, 0x40, 0x0,
/* U+22 "\"" */
0xc, 0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0xff, 0xf8, 0x52, 0xfa,
0xff, 0xfe, 0x14, 0x87, 0xff, 0x3d, 0xf, 0xff,
0xf8, 0x7f, 0xff, 0xc3, 0xff, 0xa2, 0x87, 0xff,
0x69, 0x97, 0x48, 0x7f, 0xff, 0xc3, 0xe6, 0x5d,
0x21, 0xff, 0xdf, 0x43, 0xff, 0xfe, 0x1f, 0xff,
0xf0, 0xff, 0xff, 0x21, 0xff, 0xda, 0x65, 0xd2,
0x1f, 0xfc, 0x60,
/* U+55 "U" */
0xc, 0xd4, 0x87, 0xff, 0x21, 0xa9, 0xe, 0xa2,
0xd4, 0xf, 0xfe, 0x2b, 0x45, 0xa8, 0x12, 0x1f,
0xff, 0xf0, 0xff, 0xff, 0x87, 0xff, 0x45, 0xf,
0xfe, 0xc5, 0x16, 0xa0, 0x7f, 0xf1, 0x5a, 0x23,
0x40, 0xff, 0xea, 0x21, 0xf5, 0x16, 0xa0, 0x7f,
0xf1, 0x5a, 0x2d, 0x40, 0x90, 0xff, 0xff, 0x87,
0xff, 0xe1, 0xf, 0x90, 0xff, 0xe5, 0xe1, 0xae,
0x5d, 0x7f, 0xff, 0x12, 0x5d, 0x68, 0x79, 0xa6,
0x87, 0xff, 0x19, 0xe8, 0x84,
/* U+56 "V" */
0xc, 0xd4, 0x87, 0xff, 0x19, 0xa9, 0xf, 0xa8,
0xb5, 0x3, 0xff, 0x89, 0x45, 0xa8, 0x1c, 0x87,
0xff, 0x49, 0xf, 0xff, 0xf8, 0x7f, 0xff, 0x50,
0xff, 0xe9, 0x21, 0xd4, 0x5a, 0x81, 0xff, 0xc3,
0x45, 0xd, 0x3, 0xff, 0x9a, 0xdc, 0xa2, 0x88,
0x7d, 0x45, 0xa8, 0x1f, 0xcd, 0xc8, 0x72, 0x1f,
0x90, 0xff, 0xe0, 0xb7, 0x21, 0x9b, 0x83, 0xff,
0x90, 0xdc, 0x86, 0x6e, 0x43, 0xff, 0x8f, 0x4e,
0x43, 0x37, 0x21, 0xff, 0xcb, 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90, 0xff, 0xe2, 0xb4, 0x43, 0xce, 0x84,
/* U+7C "|" */
0xc, 0xd4, 0x87, 0xa8, 0xb5, 0x3, 0x21, 0xff,
0xef, 0x43, 0xff, 0x81, 0x45, 0xa8, 0x1f, 0xfc,
0x5a, 0x2d, 0x40, 0xc8, 0x7f, 0xfb, 0xd0, 0xff,
0xe0, 0x51, 0x6a, 0x0,
/* U+7D "}" */
0xe, 0x7f, 0xe4, 0x3f, 0xf9, 0xe, 0x1f, 0x74,
0x43, 0xff, 0x8a, 0xdf, 0xe9, 0x6b, 0x90, 0xff,
0xe5, 0x61, 0xff, 0xff, 0xf, 0xff, 0x6, 0x1f,
0xfd, 0x17, 0x97, 0x5f, 0xa4, 0x3f, 0xfa, 0xe,
0x87, 0xff, 0xd, 0xe5, 0xd7, 0xf4, 0x87, 0xff,
0xf, 0xf, 0xff, 0xf8, 0x7f, 0xf8, 0x30, 0xff,
0xe4, 0xb7, 0xfa, 0x5a, 0xe4, 0x3f, 0xf8, 0x4e,
0x1f, 0x74, 0x43, 0xff, 0x82,
/* U+7E "~" */
0xf, 0xfe, 0x2, 0xa8, 0xba, 0x58, 0x3f, 0xf8,
0xaa, 0xa2, 0x1f, 0xf3, 0x74, 0x55, 0xe9, 0xab,
0x90, 0xff, 0x9b, 0xa2, 0xa4, 0x3e, 0x6e, 0x43,
0x35, 0x90, 0xcd, 0xc8, 0x73, 0x72, 0x19, 0x90,
0xcd, 0xc8, 0x66, 0xe4, 0xd, 0xc8, 0x66, 0xea,
0xe4, 0x33, 0x72, 0x1f, 0xf3, 0x72, 0x1f, 0x9b,
0x90, 0xf2, 0x19, 0xb9, 0xe
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 98, .box_w = 6, .box_h = 0, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 0, .adv_w = 69, .box_w = 12, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 37, .adv_w = 132, .box_w = 24, .box_h = 6, .ofs_x = 0, .ofs_y = 12},
{.bitmap_index = 61, .adv_w = 255, .box_w = 54, .box_h = 20, .ofs_x = -1, .ofs_y = -1},
{.bitmap_index = 191, .adv_w = 202, .box_w = 36, .box_h = 24, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 311, .adv_w = 333, .box_w = 63, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 477, .adv_w = 227, .box_w = 45, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 575, .adv_w = 69, .box_w = 12, .box_h = 6, .ofs_x = 0, .ofs_y = 12},
{.bitmap_index = 590, .adv_w = 115, .box_w = 21, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 637, .adv_w = 115, .box_w = 21, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 681, .adv_w = 173, .box_w = 39, .box_h = 12, .ofs_x = -1, .ofs_y = 3},
{.bitmap_index = 780, .adv_w = 196, .box_w = 42, .box_h = 14, .ofs_x = -1, .ofs_y = 2},
{.bitmap_index = 832, .adv_w = 69, .box_w = 12, .box_h = 6, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 848, .adv_w = 136, .box_w = 30, .box_h = 3, .ofs_x = -1, .ofs_y = 8},
{.bitmap_index = 859, .adv_w = 69, .box_w = 12, .box_h = 4, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 870, .adv_w = 142, .box_w = 30, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 959, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1075, .adv_w = 202, .box_w = 39, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1134, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1201, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1284, .adv_w = 202, .box_w = 39, .box_h = 19, .ofs_x = -1, .ofs_y = -1},
{.bitmap_index = 1372, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1439, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1516, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 1580, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1661, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1733, .adv_w = 69, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1757, .adv_w = 69, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1786, .adv_w = 131, .box_w = 24, .box_h = 10, .ofs_x = 0, .ofs_y = 4},
{.bitmap_index = 1837, .adv_w = 161, .box_w = 30, .box_h = 7, .ofs_x = 0, .ofs_y = 6},
{.bitmap_index = 1864, .adv_w = 131, .box_w = 24, .box_h = 10, .ofs_x = 0, .ofs_y = 4},
{.bitmap_index = 1914, .adv_w = 182, .box_w = 36, .box_h = 19, .ofs_x = -1, .ofs_y = -1},
{.bitmap_index = 1989, .adv_w = 328, .box_w = 60, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2119, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 2194, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2273, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2356, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2429, .adv_w = 172, .box_w = 33, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2493, .adv_w = 172, .box_w = 33, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 2555, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2641, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2706, .adv_w = 201, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2761, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2822, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 2922, .adv_w = 166, .box_w = 33, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2971, .adv_w = 269, .box_w = 51, .box_h = 19, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3093, .adv_w = 202, .box_w = 36, .box_h = 20, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 3186, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3263, .adv_w = 205, .box_w = 39, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 3336, .adv_w = 202, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 3447, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3544, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3636, .adv_w = 214, .box_w = 45, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 3703, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3772, .adv_w = 192, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3861, .adv_w = 269, .box_w = 51, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 3986, .adv_w = 214, .box_w = 39, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4126, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4189, .adv_w = 190, .box_w = 39, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 4285, .adv_w = 103, .box_w = 21, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4331, .adv_w = 142, .box_w = 30, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 4416, .adv_w = 103, .box_w = 21, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 4463, .adv_w = 159, .box_w = 33, .box_h = 7, .ofs_x = -1, .ofs_y = 12},
{.bitmap_index = 4503, .adv_w = 290, .box_w = 60, .box_h = 3, .ofs_x = -1, .ofs_y = -4},
{.bitmap_index = 4514, .adv_w = 80, .box_w = 21, .box_h = 5, .ofs_x = -1, .ofs_y = 13},
{.bitmap_index = 4537, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 4612, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4691, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4774, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4847, .adv_w = 172, .box_w = 33, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4911, .adv_w = 172, .box_w = 33, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 4973, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5059, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5124, .adv_w = 201, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5179, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5240, .adv_w = 202, .box_w = 36, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 5340, .adv_w = 166, .box_w = 33, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5389, .adv_w = 269, .box_w = 51, .box_h = 19, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5511, .adv_w = 202, .box_w = 36, .box_h = 20, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 5604, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5681, .adv_w = 205, .box_w = 39, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 5754, .adv_w = 202, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 5865, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5962, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6054, .adv_w = 214, .box_w = 45, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 6121, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6190, .adv_w = 192, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6279, .adv_w = 269, .box_w = 51, .box_h = 19, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 6404, .adv_w = 214, .box_w = 39, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6544, .adv_w = 202, .box_w = 36, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6607, .adv_w = 190, .box_w = 39, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 6703, .adv_w = 133, .box_w = 30, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 6758, .adv_w = 69, .box_w = 12, .box_h = 18, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6786, .adv_w = 133, .box_w = 30, .box_h = 18, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 6847, .adv_w = 236, .box_w = 48, .box_h = 5, .ofs_x = -1, .ofs_y = 7}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
/*Store all the custom data of the font*/
static lv_font_fmt_txt_dsc_t font_dsc = {
.glyph_bitmap = gylph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 2,
.kern_classes = 0,
.bitmap_format = 1
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
lv_font_t LcdNova24px = {
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 26, /*The maximum line height required by the font*/
.base_line = 5, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_HOR,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if LCDNOVA24PX*/
|
293a23a207534eaa615c7ec47d034654abde8048 | 10af881fc3ad2e7fa86f7e6e48e2b1ce9e4e411e | /Source/Renderer/Camera.h | 45e479609fd1a67353c1710cc680da779395a9de | [] | no_license | Ackak/Khazad | 694808ff27701ee7d131f2f5c7520ee343f21334 | d7a3c2632dc3b490f012a24125f8e3b966f256dd | refs/heads/master | 2020-04-05T23:45:24.373584 | 2013-03-28T21:26:50 | 2013-03-28T21:26:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,851 | h | Camera.h | #ifndef CAMERA_HEADER
#define CAMERA_HEADER
#include <stdafx.h>
#include <Ogre.h>
class Camera
{
public:
Camera();
bool Init();
~Camera();
void ZoomCamera(float ZoomChange);
void RotateCamera(float RotationFactor);
void ElevateCamera(float ElevationFactor);
void PitchCamera(float PitchFactor);
void TranslateCamera(float X, float Y);
void ChangeViewLevel(int32_t Change);
void SetSlice(int16_t newTop, int16_t newBottome);
void SetSliceTop(int16_t newValue);
uint16_t getSliceTop() { return SliceTop; }
void SetSliceBottom(int16_t newValue);
uint16_t getSliceBottom() { return SliceBottom; }
bool InSlice(int16_t Zlevel);
float getShading(int16_t Zlevel);
void setPitchLock(bool NewLock) { PitchLock = NewLock; }
bool getPitchLock() { return PitchLock; }
Ogre::Degree getPitch() { return TiltNode->getOrientation().getPitch(); }
float getTranslationFactor() { return TranslationFactor; }
Ogre::Vector3 getMouseRayIntersection(float X, float Y, float Z);
Ogre::Vector3 getMouseRayIntersection(float X, float Y);
Ogre::Vector3 ConvertMouseToVector(float X, float Y);
Ogre::Ray getMouseRay(float MouseX, float MouseY);
void FocusAt(Ogre::Vector3 FocalPoint);
void SetDefaultView();
private:
bool PitchLock;
Ogre::SceneNode* CameraNode;
Ogre::SceneNode* RotationNode;
Ogre::SceneNode* TiltNode;
Ogre::SceneNode* TargetNode;
uint16_t SliceTop;
uint16_t SliceBottom;
uint16_t ViewLevels;
Ogre::Camera* OgreCamera;
Ogre::Viewport* OgreViewPort;
Ogre::RaySceneQuery* RayQuery;
Ogre::Real ZoomFactor;
float TranslationFactor;
};
#endif // CAMERA_HEADER
|
0df740b28abfce7c82b3264703a1fcd8c58a194b | 63bdd0faf26c5da9dd237f61981d9b07c48dd6f6 | /src/Mesh.cpp | 616c8153861dfa518b20a02265c72b3c80f1ecab | [] | no_license | gDan15/opengl-fluid | cced007210e8ab75d0b15a0227b192c8efa2cba9 | 5f5f0fc438d2a09e6522a28c3b6196eee12f02bd | refs/heads/master | 2020-03-18T12:59:59.140740 | 2018-06-22T22:11:18 | 2018-06-22T22:11:18 | 134,755,108 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,023 | cpp | Mesh.cpp | #include "Mesh.h"
#include <fstream>
#include <sstream>
#include <iostream>
Mesh::Mesh(Buffer* vertex, size_t vertexCount, Buffer* index, size_t indexCount)
{
vertexData = vertex;
indexData = index;
this->vertexCount = vertexCount;
this->indexCount = indexCount;
}
Mesh::~Mesh()
{
if(indexData) delete indexData;
if(vertexData) delete vertexData;
}
Mesh* Mesh::fromOBJ(string path)
{
vector<VertexData> vertex;
vector<GUInt> index;
ifstream file(path);
for(string line; getline(file, line); )
{
if(line.size() == 0) continue;
istringstream str(line);
char cmd;
switch(line[0])
{
case 'v':
GFloat x, y, z;
str >> cmd >> x >> y >> z;
vertex.push_back(VertexData(vec3(x, y, z), vec3(0)));
break;
case 'f':
GUInt v1, v2, v3;
str >> cmd >> v1 >> v2 >> v3;
index.push_back(v1-1);
index.push_back(v2-1);
index.push_back(v3-1);
break;
}
}
for(int i = 0; i < index.size()/3; i++)
{
vec3 faceNormal = normalize(cross(
vertex[index[3*i+1]].position-vertex[index[3*i]].position,
vertex[index[3*i+2]].position-vertex[index[3*i]].position
));
vertex[index[3*i]].normal += faceNormal;
vertex[index[3*i+1]].normal += faceNormal;
vertex[index[3*i+2]].normal += faceNormal;
}
for(int i = 0; i < vertex.size(); i++)
{
vertex[i].normal = normalize(vertex[i].normal);
}
Mesh* mesh = new Mesh(
new Buffer(vertex.data(), vertex.size()*sizeof(VertexData)), vertex.size(),
new Buffer(index.data(), index.size()*sizeof(GUInt)), index.size()
);
return mesh;
}
Buffer* Mesh::getVertex()
{
return vertexData;
}
Buffer* Mesh::getIndex()
{
return indexData;
}
size_t Mesh::getVertexCount()
{
}
size_t Mesh::getIndexCount()
{
}
|
7a8ba16367f30d4bc20d7d45454029a0f798b8c2 | 1507ecff84940b1fcaa16b269151fa93465f86bb | /Homework/Assignment 5/main.cpp | 49ca2c6af1e9ed145610f39b5d4c03a8c7db0cfd | [] | no_license | bn2595114/NguyenBryan_CSC17A_48096 | 44e27a74a26950886f5b81552a52f11d8bdcb7d2 | f20c9b2c7c0576a364549e734749328210843b43 | refs/heads/master | 2020-04-05T22:57:29.029293 | 2017-04-19T20:32:15 | 2017-04-19T20:32:15 | 68,042,561 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,780 | cpp | main.cpp | /*
* File: main.cpp
* Author: Bryan
*
* Created on November 30, 2016, 8:25 PM
*/
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
#include "Employee.h"
#include "Time.h"
#include "Essay.h"
#include "MinMax.h"
#include "Absolute.h"
#include "Total.h"
void problem1();
void problem2();
void problem3();
void problem4();
void problem5();
void problem6();
void problem7();
void problem8();
void problem9();
int main(int argc, char** argv) {
int inN;
do{
cout << "Enter the number of the program: " << endl;
cout << "1) Employee and ProductionWorker Classes" << endl;
cout << "2) Time Format" << endl;
cout << "3) Essay Class" << endl;
cout << "4) Shift Supervisor Class" << endl;
cout << "5) Time Clock" << endl;
cout << "6) Time Format Exceptions" << endl;
cout << "7) Minimum/Maximum Templates" << endl;
cout << "8) Absolute Value Template" << endl;
cout << "9) Total Template" << endl;
cin >> inN;
switch(inN)
{
case 1:{problem1();break;}
case 2:{problem2();break;}
case 3:{problem3();break;}
case 4:{problem4();break;}
case 5:{problem5();break;}
case 6:{problem6();break;}
case 7:{problem7();break;}
case 8:{problem8();break;}
case 9:{problem9();break;}
default:cout<<"Program Exiting...";
}
cout << endl << endl << endl << endl;
} while(inN >0 && inN < 11);
return 0;
}
void problem1()
{
string name, num, date;
int shift;
float pay;
cout << "Enter name: ";
cin >> name;
cout << "Enter number: ";
cin >> num;
cout << "Enter date: ";
cin >> date;
cout << "Enter 1 for day shift and 2 for night shift: ";
cin >> shift;
while(shift < 1 || shift > 2)
{
cout << "Invalid Input. Enter Valid Number: ";
cin >> shift;
}
cout << "Enter hourly pay: ";
cin >> pay;
ProductionWorker data;
data.setName(name);
data.setNum(num);
data.setDate(date);
data.setShift(shift);
data.setPay(pay);
cout << "Name: " << data.getName() << endl;
cout << "Number: " << data.getNumber() << endl;
cout << "Date: " << data.getDate() << endl;
if(data.getShift() == 1)
cout << "Day Shift" << endl;
else
cout << "Night Shift" << endl;
cout << "Hourly Pay: " << data.getPayRate() << endl;
}
void problem2()
{
int mili;
cout << "Enter Time in military format: ";
cin >> mili;
try{
MilTime time(mili);
cout << "The time in standard format is: " << endl;
cout << time.getHr() << ":";
if(time.getMin() == 0)
cout << "0" << time.getMin();
else
cout << time.getMin();
}
catch(string exceptionString)
{
cout << exceptionString;
}
}
void problem3()
{
int g, s, l, c;
cout << "Enter grammar grade(maximum 30): ";
cin >> g;
cout << "Enter spelling grade(max 20): ";
cin >> s;
while(s<0 || s>20)
{
cout << "Invalid Input. Enter a valid score: ";
cin >> s;
}
cout << "Enter Correct Length grade(max 20): ";
cin >> l;
while(l<0 || l>20)
{
cout << "Invalid Input. Enter a valid score: ";
cin >> l;
}
cout << "Enter Content grade(max 30): ";
cin >> c;
while(c<0 || c>30)
{
cout << "Invalid Input. Enter a valid score: ";
cin >> c;
}
Essay test(g, s, l, c);
try{
Essay test(g, s, l, c);
}
catch(string exception)
{
cout << exception;
}
int total = g+s+l+c;
cout << "Total Score is: " << test.getTotal() << endl;
GradedActivity x(total);
cout << "Letter Grade: " << x.getLetterGrade() << endl;
}
void problem4()
{
float salary;
ShiftSupervisor x;
cout << "Enter your yearly salary: ";
cin >> salary;
if(salary >= 60000)
{
x.setSalary(salary+10000);
cout << "You have received a yearly bonus!" << endl;
}
else
x.setSalary(salary);
cout << "Your total salary: " << x.getSalary();
}
void problem5()
{
cout << "Enter two military times: " << endl;
cout << "1: ";
int a, b;
cin >> a;
while(a<0 || a>2399)
{
cout << "Invalid Input. Enter another number: ";
cin >> a;
}
cout << "2: ";
cin >> b;
while(b<0 || b>2399)
{
cout << "Invalid Input. Enter another number: ";
cin >> b;
}
MilTime c(a);
MilTime d(b);
TimeClock f(c.getTime(), d.getTime());
cout << "Time elapsed: " << f.getElapse();
}
void problem6()
{
int mili;
cout << "Enter Time in military format: ";
cin >> mili;
try{
MilTime time(mili);
cout << "The time in standard format is: " << endl;
cout << time.getHr() << ":";
if(time.getMin() == 0)
cout << "0" << time.getMin();
else
cout << time.getMin();
}
catch(string exceptionString)
{
cout << exceptionString;
}
}
void problem7()
{
float a, b;
cout << "Enter two numbers: " << endl;
cout << "Number 1: ";
cin >> a;
cout << "Number 2: " ;
cin >> b;
cout << "Minimum Number is: " << Min(a,b) << endl;
cout << "Max Number is: " << Max(a,b);
}
void problem8()
{
float num;
cout << "Enter a number: ";
cin >> num;
cout << "The Absolute Value: " << Absolute(num);
}
void problem9()
{
char input;
float num = 0, tot = 0;
do{
cout << "Enter a number: ";
cin >> num;
cout << "Total: " << Total(num, tot) << endl;
tot += num;
cout << "Enter n to stop. Enter anything else to add another number: ";
cin >> input;
} while(tolower(input)!= 'n');
} |
2f278d14a566e86efb8aef5d31b34c1d16275023 | 1ad14377c65c624aac3de787e86ad232faacf8e6 | /tree.cpp | 82f3e01dad5de27d56bae5305c238eec4e3569c8 | [] | no_license | juh1128/SGA-Monarch2Weeks | 5c5aba87619da193314679951034617e8e365dbe | f77c799572f21c5350cce2eed5a4aeb31b690e6e | refs/heads/master | 2021-10-08T22:53:39.082264 | 2018-12-18T18:28:32 | 2018-12-18T18:28:32 | 106,794,815 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 834 | cpp | tree.cpp | #include "stdafx.h"
#include "tree.h"
HRESULT tree::init(int xIndex, int yIndex)
{
mncObjectBase::init("나무", "tree", xIndex, yIndex, 50, false);
_frame = 0;
return S_OK;
}
void tree::release()
{
mncObjectBase::release();
}
void tree::update()
{
mncObjectBase::update();
//체력에 따라 프레임 설정
float hpRatio = (float)_hp / (float)_maxHp;
if (hpRatio > 0.66f)
{
_frame = 0;
}
else if (hpRatio >= 0.33f)
{
_frame = 1;
}
else
{
_frame = 2;
}
}
void tree::render()
{
mncObjectBase::frameRender(_frame, 0);
}
HRESULT weed::init(int xIndex, int yIndex)
{
mncObjectBase::init("잡초", "weed", xIndex, yIndex, 20, false);
return S_OK;
}
void weed::release()
{
mncObjectBase::release();
}
void weed::update()
{
mncObjectBase::update();
}
void weed::render()
{
mncObjectBase::render();
}
|
94988d663adc2c789cf1e48a457b859626fbb55e | 0123a1fbc1f71b589042e9b7844714e068762a8f | /Część 1/Kompilacja.cpp | 5525ed58e2e780bd89a15f2ba923a84894500c1d | [] | no_license | PiotrMajecki/Drukarka_Laserowa_cz.1 | 8f90de9bd783858e365d8678ab39ba88d20c4812 | 2cd603d52ae43103572a876777430232d60f9c74 | refs/heads/master | 2022-04-10T12:02:23.233573 | 2020-03-26T18:09:44 | 2020-03-26T18:09:44 | 250,335,565 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,829 | cpp | Kompilacja.cpp | #include "DrukarkaLaserowa.h"
#include <iostream>
#include <string>
using namespace std;
string nowa_nazwa;
string nowa_marka;
int opcja;
int main()
{
#ifdef _DEBUG
//Testowanie klas
cout << "Wywolanie konstruktora obiektu." << endl;
DrukarkaLaserowa test1(4), test2(6), test3(8);
cout << "Obiekt: ";
test1.wyswietlUrzadzenie();
cout << endl;
cout << "Zmieniono nazwe drukarki na Advantage" << endl;
test1.zmienNazwe("Advantage");
cout << "Zmieniono model drukarki na Samsung" << endl;
test1.zmienMarke("Samsung");
test1.wyswietlUrzadzenie();
cout << endl;
cout << "Ilosc elementow obiektu test1: ";
test1.wyswietlIlosc();
cout << endl;
//Kopiowanie obiektu
DrukarkaLaserowa kopiaObiektu(test1);
test1.wyswietlUrzadzenie();
cout << endl << "Skopiowano obiekt test1" << endl;
cout << "Obiekt: " << endl;
kopiaObiektu.wyswietlRodzajDrukarki();
cout << endl;
cout << "------------------------------" << endl;
//Operatory
cout << endl << "Testowanie operatorow:" << endl << endl;
cout << "Testowanie operatora ==" << endl;
if (test1 == test2)
cout << "Prawdziwe" << endl << endl;
else
cout << "Falszywe" << endl << endl;
cout << "Testowanie operatora >" << endl;
if (test1 > test2)
cout << "Falszywe" << endl << endl;
else
cout << "Prawdziwe" << endl << endl;
cout << "Testowanie operatora <" << endl;
if (test1 < test2)
cout << "Falszywe" << endl << endl;
else
cout << "Prawdziwe" << endl << endl;
cout << endl;
DrukarkaLaserowa test4;
test1.wyswietlRodzajDrukarki();
test2.wyswietlRodzajDrukarki();
test3.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora +" << endl;
test3 = test1 + test2;
test1.wyswietlRodzajDrukarki();
test2.wyswietlRodzajDrukarki();
test3.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora *" << endl;
test3 = test1 * test2;
test1.wyswietlRodzajDrukarki();
test2.wyswietlRodzajDrukarki();
test3.wyswietlRodzajDrukarki();
cout << endl;
cout << "Testowanie operatora =" << endl;
test1 = test2;
test2 = test3;
test1.wyswietlRodzajDrukarki();
test2.wyswietlRodzajDrukarki();
test3.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora +=" << endl;
test3 += test2;
test2.wyswietlRodzajDrukarki();
test3.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora -=" << endl;
test2 -= test1;
test1.wyswietlRodzajDrukarki();
test2.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora ++" << endl;
test1++;
test1.wyswietlRodzajDrukarki();
cout << endl << "Testowanie operatora --" << endl;
test1--;
test1.wyswietlRodzajDrukarki();
cout << endl << "------------------------------" << endl;
//Tworzenie i testowanie obiektu dynamicznego
cout << endl << "Tworzenie obiektu dynamicznego test3" << endl;
DrukarkaLaserowa *test6 = new DrukarkaLaserowa;
cout << "Obiekt: " << endl;
test6->wyswietlUrzadzenie();
cout << endl;
cout << "Zmieniono marke drukarki na Samsung" << endl;
test6->zmienMarke("Samsung");
cout << "Zmieniono marke drukarki na drukarke_dynamiczna" << endl;
test6->zmienNazwe("drukarka_dynamiczna");
test6->wyswietlUrzadzenie();
cout << endl;
cout << "Ilosc elementow obiektu test3: ";
test6->wyswietlIlosc();
cout << endl;
cout << "Wywolanie destruktora obiektu test3" << endl;
if (test6 != NULL)
{
delete test6;
test6 = NULL;
}
cout << "Ilosc elementow obiektu: ";
test6->wyswietlIlosc();
cout << endl;
cout << endl << "Nacisnij klawisz [ENTER] aby kontynuowac.";
cin.get();
system("cls");
#endif
DrukarkaLaserowa drukarka_laserowa(6);
//Menu programu
cout << "Poczatek programu testujacego" << endl;
do {
switch (opcja)
{
case 0:
cout << "-------------------------------" << endl;
cout << "Wybierz opcje:" << endl;
cout << "1: Wyswietl rodzaj drukarki" << endl;
cout << "2: Wyswietl urzadzenie" << endl;
cout << "3: Zmien nazwe drukarki" << endl;
cout << "4: Zmien model drukarki" << endl;
cout << "9: Zamknij program" << endl;
cout << "-------------------------------" << endl;
cout << "Opcja: ";
cin >> opcja;
break;
case 1:
system("cls");
drukarka_laserowa.wyswietlRodzajDrukarki();
opcja = 0;
break;
case 2:
system("cls");
drukarka_laserowa.wyswietlUrzadzenie();
opcja = 0;
break;
case 3:
system("cls");
cout << "Wpisz nowa nazwe drukarki: ";
cin >> nowa_nazwa;
drukarka_laserowa.zmienNazwe(nowa_nazwa);
cout << "Nazwa drukarki zostala zmieniona." << endl;
opcja = 0;
break;
case 4:
system("cls");
cout << "Wpisz nowy model drukarki: ";
cin >> nowa_marka;
drukarka_laserowa.zmienMarke(nowa_marka);
cout << "Model drukarki zostal zmieniony." << endl;
opcja = 0;
break;
default:
cout << "Wybrano niepoprawna opcje.";
opcja = 0;
}
} while (opcja != 9);
return 0;
} |
fd39806631e3905b8e9604d932403ccf7fbc1dfe | 286b5540c3343932aecd60bcd755ce4b918c3af0 | /louisB_10420.cpp | d2db884676780e8dcbaffa5a1ee44b76c1325fbd | [] | no_license | Algue-Rythme/ACM | 4d1274d383ae8437c268b89db116eeba4fff7ce5 | 45eafdfb4003690fe55615da7d8b131b3da4805f | refs/heads/master | 2021-01-22T21:28:33.917032 | 2017-05-15T16:03:30 | 2017-05-15T16:03:30 | 85,436,739 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | cpp | louisB_10420.cpp | #include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <map>
#include <sstream>
using namespace std;
int main() {
unsigned int nbCountries;
cin >> nbCountries;
map<string, unsigned int> girls;
for (unsigned int country = 0; country < nbCountries; ++country) {
string countryName; cin >> countryName;
cin.ignore(75, '\n');
if (girls.find(countryName) == end(girls))
girls[countryName] = 0;
girls[countryName] += 1;
}
for (auto girl : girls) {
cout << girl.first << " " << girl.second << "\n";
}
}
|
7cec3579b6a8d0dcd06e60e0a69fccdaac494909 | f5c6aa7ab071c426d81d01c966a5a4bd353798d6 | /nnlib.h | 202041c32297e0b36fb54bf619d642f37e5796e5 | [
"MIT"
] | permissive | arataca89/nnlang | 5f270223e361d797d1b1e3ee97e09d2be497af3f | a9746b6e15664277cfc0521f67b06692934ad0d4 | refs/heads/main | 2023-04-01T04:27:32.800938 | 2021-04-03T22:14:50 | 2021-04-03T22:14:50 | 353,033,975 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | h | nnlib.h | // nnlib.h
// arataca89@gmail.com
// 20210330
// Last updated: 20210403
#include <algorithm>
#include <string>
using std::string;
// if word can represent an decimal number, return 1; otherwise, return 0
int isFloat(const string& word);
// if word can represent an integer, return 1; otherwise, return 0
int isInt(const string& word);
// if word is an ID return 1; otherwise return 0
int isID(const string& word);
// return 1 if 'word' is a keyword; otherwise return 0
int isKeyWord(const string& word);
// return 1 if 'c' is equal to ';', otherwise return 0
int isEndCommand(char c);
// return 1 if 'c' is a delimiter; otherwise return 0
// delimiters: ( ) { } [ ]
int isDelimiter(char c);
// return 1 if c is comparison operator; otherwise return 0
// comparison operators:
// grater than >
// less then <
int isCompOperator(char c);
// 20210331
// return 1 if 'c' is equal to '='; otherwise return 0
int isAssigOperator(char c);
// 20210331
// return 1 if 'c' is arithmetic operator; otherwise return 0
// arithmetic operators:
// addition +
// subtraction -
// multiplication *
// division /
// modulus %
int isAritOperator(char c);
// 20210330
string removeSpaces(const string& text);
string removeTabs(const string& text);
// end of nnlib.h
|
720b0af71cfadf5e2676473a05e3d8edb7336736 | 72489760a574cf1cab1115af8072118070ab5eb0 | /21.最大值與最小值.cpp | 3615bb6dee01049648ad20e086a1b1039052055b | [] | no_license | TracyLin98/OOPITSA | 41e3acc8db4b68f596e20cca19ac07fefdff0ac9 | d4dc6dfc56032469696df0ab6a32cb9be663793d | refs/heads/main | 2023-06-04T19:52:24.164618 | 2021-06-28T04:33:35 | 2021-06-28T04:33:35 | 380,904,114 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 677 | cpp | 21.最大值與最小值.cpp | #include <string>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <climits>
#include <functional>
#include <iomanip>
#include <stack>
#include <cmath>
#include <cfloat>
#include <cstdlib>
#include <cstring>
using namespace std;
int main() {
float arr[10];
for (int i = 0; i < 10; i++) {
cin >> arr[i];
}
float max = arr[0];
float min = arr[0];
for (int i = 1; i < 10; i++) {
if (arr[i] > max)
max = arr[i];
if (arr[i] < min) {
min = arr[i];
}
}
cout << fixed;
cout << setprecision(2) << "maximum:" << max << endl
<< setprecision(2) << "minimum:" << min << endl;
return 0;
}
|
e4b86816c82c5747377a6350b79770736a98114e | 8ee5416ec56b9cc1d9ad2ce48cf690fa012c5ce4 | /PhysX.Net-3/Source/SerializableEnum.h | bd775bb8fcaa715815c170f56975294465eea82f | [] | no_license | HalcyonGrid/PhysX.net | a573e0ceb9153c3777e71cb9d1434c5d74589df6 | 2a4bfc7a6619091bb3be20cb058f65306e4d8bac | refs/heads/master | 2020-03-26T12:30:31.701484 | 2015-09-10T04:24:00 | 2015-09-10T04:24:00 | 144,896,344 | 3 | 2 | null | 2018-08-15T19:44:31 | 2018-08-15T19:44:30 | null | UTF-8 | C++ | false | false | 1,275 | h | SerializableEnum.h | #pragma once
namespace PhysX
{
public enum class ConcreteType
{
Undefined = PxConcreteType::eUNDEFINED,
Heightfield = PxConcreteType::eHEIGHTFIELD,
ConvexMesh = PxConcreteType::eCONVEX_MESH,
TriangleMesh = PxConcreteType::eTRIANGLE_MESH,
ClothFabric = PxConcreteType::eCLOTH_FABRIC,
RigidDynamic = PxConcreteType::eRIGID_DYNAMIC,
RigidStatic = PxConcreteType::eRIGID_STATIC,
Shape = PxConcreteType::eSHAPE,
Material = PxConcreteType::eMATERIAL,
Constraint = PxConcreteType::eCONSTRAINT,
Cloth = PxConcreteType::eCLOTH,
ParticleSystem = PxConcreteType::ePARTICLE_SYSTEM,
ParticleFluid = PxConcreteType::ePARTICLE_FLUID,
Aggregate = PxConcreteType::eAGGREGATE,
Articulation = PxConcreteType::eARTICULATION,
ArticulationLink = PxConcreteType::eARTICULATION_LINK,
ArticulationJoin = PxConcreteType::eARTICULATION_JOINT,
UserSphericalJoint = PxConcreteType::eUSER_SPHERICAL_JOINT,
UserRevoluteJoint = PxConcreteType::eUSER_REVOLUTE_JOINT,
UserPrismaticJoint = PxConcreteType::eUSER_PRISMATIC_JOINT,
UserFixedJoin = PxConcreteType::eUSER_FIXED_JOINT,
UserDistanceJoint = PxConcreteType::eUSER_DISTANCE_JOINT,
UserD6Joint = PxConcreteType::eUSER_D6_JOINT,
UserObserver = PxConcreteType::eUSER_OBSERVER
};
}; |
f1c77e36aceedb114192862547fb8eed6c3a1567 | 25cf9168e5e33fd9b3ec4c87c555c783ebbedf80 | /ACE_wrappers/ace/PaxHeaders.2489/OS_NS_devctl.cpp | a6fe45b5911ec84cf18a38953e723f582b3430c3 | [] | no_license | XZM-CN/ACE-6.4.3 | 3441f1c39e3b4e14a70c1e48cd4a4cf038a0d83f | 6020a9362e2350aaa4899705e657ae1426bb10dd | refs/heads/master | 2021-01-15T17:29:12.476083 | 2017-08-09T06:13:33 | 2017-08-09T06:13:33 | 99,753,918 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 90 | cpp | OS_NS_devctl.cpp | 30 mtime=1492674726.796646645
30 atime=1492674730.040646059
30 ctime=1492674726.796646645
|
5f1672052b5a7746307dd51a9b75d4e4c27f53b7 | 66c6c2d054777c3738297e6606c1385737345b90 | /codeforces/627div3/D.cpp | 78c70e0eac8d60cd28d24cfeb3bab45ef6116ae6 | [
"MIT"
] | permissive | xenowits/cp | f4a72bea29defd77f2412d6dee47c3e17f4d4e81 | 963b3c7df65b5328d5ce5ef894a46691afefb98c | refs/heads/master | 2023-01-03T18:19:29.859876 | 2020-10-23T10:35:48 | 2020-10-23T10:35:48 | 177,056,380 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,489 | cpp | D.cpp | //xenowitz -- Jai Shree Ram
#include<bits/stdc++.h>
using namespace std;
#define fori(i,a,b) for (long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 1000000007
#define pb push_back
#define vec vector<long long int>
#define ll long long
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count())
#define pi pair<long long int,long long int>
#define sc second
#define fs first
#define mem(x,y) memset(x,y,sizeof(x))
ll dp[2005][2005];
int solve(ll* arr,int n,int h,int l,int r,int i,int total) {
if(i == n) {
return 0;
}
if(dp[i][total]!=-1){
return dp[i][total];
}
else {
int time1 = total+arr[i];
int time2 = total+arr[i]-1;
time1 %= h;
time2 %= h;
int flag1 = 0;
bool flag2 = 0;
if(time1>=l and time1<=r){
flag1 = 1;
}
if(time2>=l and time2<=r){
flag2 = 1;
}
dp[i][total] = max(flag1 + solve(arr,n,h,l,r,i+1,time1),flag2+solve(arr,n,h,l,r,i+1,time2));
return dp[i][total];
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
//cin >> t;
t = 1;
while(t--){
int n, h, l, r;
cin >> n >> h >> l >> r;
ll arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
mem(dp,-1);
int ans = solve(arr,n,h,l,r,0,0);
cout<<ans<<endl;
}
return 0;
}
|
9f4a2a87aafed5d7090931f371139d6652cab311 | 08f953cc67cf699ec1d8e5bfe11335fa3c3acefd | /工程文件夹/DNF/SceneChange.cpp | b4c5153de56552b9d798c03c337ae6fce57cbc28 | [] | no_license | aoyuming/dnf-win32 | cb5e8cb325d6745616c29ba41b9f021476dd9742 | 1f7c6f433911d9cea3d518748f3e9608068323fc | refs/heads/main | 2023-07-15T12:21:11.274685 | 2021-08-27T07:21:19 | 2021-08-27T07:21:19 | 400,421,317 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 136 | cpp | SceneChange.cpp | #include "SceneChange.h"
CSceneChange::CSceneChange(int AllFrame)
:
m_AllFrame(AllFrame)
{}
void CSceneChange::Render(int CurFrame)
{} |
d19dbc921f277aedeb21c68bde8aac76b62d6b3d | 1669a23933a10cf916a009281f5499c43225028b | /Dynamic Programming/5.(IMP) Best Time to sell stocks- II .cpp | 39e7fec7196ad706d84d9a8facdeb0ec872d28ea | [] | no_license | SinghVikram97/Interview-Prep | 55257a0cbe7f2232207a837f3e57728c8e694cf2 | eaa0dcf5dcf69b75fa375a6dae73eeb1f703ee8f | refs/heads/master | 2021-12-02T10:36:40.482710 | 2021-11-18T13:08:20 | 2021-11-18T13:08:20 | 136,036,711 | 42 | 21 | null | null | null | null | UTF-8 | C++ | false | false | 3,115 | cpp | 5.(IMP) Best Time to sell stocks- II .cpp | https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
We need to find difference between max peak and lowest valley
........................................
BRUTE FORCE
https://drive.google.com/open?id=1ka4G1_S3DTXDHfPYsHqWGCvwEQlkiWqt
int maxProfit(vector<int>& prices) {
int n=prices.size();
int max_profit=0;
int profit;
for(int i=0;i<n-1;i++){
// Buy ith stock and try to sell it at every day after it
for(int j=i+1;j<n;j++){
// If we sell ith stock on jth day
profit=prices[j]-prices[i];
if(profit>max_profit){
max_profit=profit;
}
}
}
return max_profit;
}
...................................
DP
https://drive.google.com/open?id=1tcjpbuErL3NOfIIt3l84uyaQ5XfkOMww
https://drive.google.com/open?id=1m-7PLUf76gZGLaBL_P6zfbeOLjIqKOrO
int maxProfit(vector<int>& prices) {
int n=prices.size();
// n=1 as can't buy and sell on same day
if(n==0 || n==1){
return 0;
}
int dp[n];
dp[0]=0; // n=1 as can't buy and sell on same day
int min_price=prices[0];
for(int i=1;i<n;i++){
dp[i]=max(dp[i-1],prices[i]-min_price);
min_price=min(min_price,prices[i]);
}
return dp[n-1];
}
WITHOUT DP
..................................
Since dp[i-1] is just one variable we can keep it a variable prevProfit
int maxProfit(vector<int>& prices) {
int n=prices.size();
// n=1 as can't buy and sell on same day
if(n==0 || n==1){
return 0;
}
int prevProfit=0;
int profit;
int min_price=prices[0];
for(int i=1;i<n;i++){
profit=max(prevProfit,prices[i]-min_price);
min_price=min(min_price,prices[i]);
prevProfit=profit;
}
return profit;
}
....................................................
USING KADANE'S ALGO (IMP)
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/discuss/39038/Kadane's-Algorithm-Since-no-one-has-mentioned-about-this-so-far-:)-(In-case-if-interviewer-twists-the-input)
int maxProfit(vector<int>& prices) {
int n=prices.size();
// n=1 as can't buy and sell on same day
if(n==0 || n==1){
return 0;
}
int max_so_far=0,cur_sum=0;
for(int i=1;i<n;i++){
if(cur_sum<=0){
cur_sum=0;
}
cur_sum=cur_sum+(prices[i]-prices[i-1]);
if(cur_sum>max_so_far){
max_so_far=cur_sum;
}
}
return max_so_far;
}
|
eab031cc68be28364d17f2234c6539c926ef2416 | b965340041ffcddaaa6581d2beb27373e8a4b7f2 | /Data Structures/Arrays/Array-DS.cc | 0da65b51bb53719284422629dc912c334da9bcce | [
"MIT"
] | permissive | Sunhick/hacker-rank | 2ebf3ed221699c1d2a7b47ad1b3634f60754980d | 27d3e1b2cdfd2e719b70894b87588ff789f60d55 | refs/heads/master | 2021-01-13T06:18:02.356327 | 2016-05-25T23:55:42 | 2016-05-25T23:55:42 | 46,993,940 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 439 | cc | Array-DS.cc | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n; //Size of Array
cin>>n;
int *ip = (int*)calloc(n, sizeof(int));
int *op = (int*)calloc(n, sizeof(int));
for(int i = 0;i<n ; i++)
{
scanf("%d",&ip[i]);
op[n-1-i] = ip[i];
}
for(int j=0;j<n;j++)
cout<<op[j]<< " ";
cout<<endl;
return 0;
}
|
7796893045d503dac272cf1d136bd5ab1825d3cd | b7e97047616d9343be5b9bbe03fc0d79ba5a6143 | /src/protocols/loops/LoopsFileOptions.cc | 1f29fe71b314b1eebccdd1df97a08ffb06a49eb9 | [] | no_license | achitturi/ROSETTA-main-source | 2772623a78e33e7883a453f051d53ea6cc53ffa5 | fe11c7e7cb68644f404f4c0629b64da4bb73b8f9 | refs/heads/master | 2021-05-09T15:04:34.006421 | 2018-01-26T17:10:33 | 2018-01-26T17:10:33 | 119,081,547 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,365 | cc | LoopsFileOptions.cc | // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington CoMotion, email: license@uw.edu.
/// @file protocols/loops/LoopsFileOptions.hh
/// @brief
/// @author
//unit headers
#include <protocols/loops/LoopsFileOptions.hh>
#include <protocols/loops/LoopsFileOptionsCreator.hh>
//utility headers
#include <utility/tag/Tag.hh>
//C++ headers
namespace protocols {
namespace loops {
/// @details Return a string specifying the type of %ResourceOptions to create (LoopsFileOptions).
std::string
LoopsFileOptionsCreator::options_type() const { return "LoopsFileOptions"; }
/// @details Return an owning pointer to a newly constructed default instance of LoopsFileOptions.
basic::resource_manager::ResourceOptionsOP
LoopsFileOptionsCreator::create_options() const { return basic::resource_manager::ResourceOptionsOP( new LoopsFileOptions ); }
/// @details The prohibit_single_residue_loops property is set to true by default.
LoopsFileOptions::LoopsFileOptions() : prohibit_single_residue_loops_( true ) {}
LoopsFileOptions::~LoopsFileOptions() = default;
/// @details Read the resource definitions file's tag and set the value for prohibit_single_residue_loops appropriately.
/// If this option is omitted it is set to true by default.
void
LoopsFileOptions::parse_my_tag(
utility::tag::TagCOP tag
)
{
prohibit_single_residue_loops( tag->getOption< bool >( "prohibit_single_residue_loops", true ));
}
/// @details Return the string value for the name of this class (LoopsFileOptions).
std::string
LoopsFileOptions::type() const
{
return "LoopsFileOptions";
}
// No details necessary - the @brief's for these methods (in the header) are sufficient.
bool LoopsFileOptions::prohibit_single_residue_loops() const { return prohibit_single_residue_loops_; }
void LoopsFileOptions::prohibit_single_residue_loops( bool setting ) { prohibit_single_residue_loops_ = setting; }
} // namespace loops
} // namespace protocols
|
4428d66a1a320d61be72a0d308b7899e1a011f05 | 0d70d5f6cfae2dc7a2bd55e6cefeee4d9b636371 | /src/CLGLLinux.cpp | c798663ac3384a73259bcc0eb4883a0d1df1100e | [] | no_license | tlgimenes/clgl | 496eff24fc5d0167cd531495e2a29a007578b4f3 | 159e92e0766beb16e15fed98ca854cf0b6f2237a | refs/heads/master | 2021-01-20T22:31:09.589493 | 2013-01-14T22:00:40 | 2013-01-14T22:00:40 | 7,115,282 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,623 | cpp | CLGLLinux.cpp | //--------------------------------//
// //
// Author: Tiago Lobato Gimenes //
// email: tlgimenes@gmail.com //
// //
//--------------------------------//
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glu.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glx.h>
#include "CLGLLinux.hpp"
#include "CLGLWindow.hpp"
// ----------- //
// Constructor //
// ----------- //
CLGLLinux::CLGLLinux(void):CLGL(){}
/*
* Create Context. For each Platform this method must be diferent
*/
void CLGLLinux::CLGLCreateContext(void)
{
// Creates the Properties Array
cl_context_properties properties[] =
{
CL_GL_CONTEXT_KHR, (cl_context_properties) glXGetCurrentContext(),
CL_GLX_DISPLAY_KHR, (cl_context_properties) glXGetCurrentDisplay(),
CL_CONTEXT_PLATFORM, (cl_context_properties) (this->platform[0])(),
0
};
try{
// Creates the Context
this->context = cl::Context(this->dev, properties);
}
catch(cl::Error error){
std::cout << error.what() << CLGLError::errToStr(error.err())->c_str() << std::endl;
exit(1);
}
}
/*
* Creates the Command Queue. This Method associates the command
* queue to the first OpenCL device found, if you want another
* device just change the index on the device array below
*/
void CLGLLinux::CLGLCreateCommandQueue(void)
{
try{
this->commandQueue = cl::CommandQueue(this->context, this->device[0], 0);
}
catch(cl::Error error){
std::cout << error.what() << ' ' << CLGLError::errToStr(error.err()) << std::endl;
exit(1);
}
return;
}
|
229936042d709579983530ecba285d2f0d747de6 | 32fcc41cc1b59a46932158e5062c8c37f88cd989 | /core/lexer.cpp | 31599f4d7e2ef2c2bb035001d3fa9aa5b6f7222b | [
"Apache-2.0"
] | permissive | google/jsonnet | 4cb224b7836e215df4bac809ad1ffed628a4d3d7 | e605e4673294d2bf43eb8351fb8f5d9ba26d5e68 | refs/heads/master | 2023-08-28T16:27:58.576444 | 2023-08-14T12:02:45 | 2023-08-14T12:02:45 | 22,527,161 | 6,616 | 546 | Apache-2.0 | 2023-08-14T12:02:46 | 2014-08-01T20:29:12 | Jsonnet | UTF-8 | C++ | false | false | 30,163 | cpp | lexer.cpp | /*
Copyright 2015 Google Inc. 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.
*/
#include <cassert>
#include <map>
#include <sstream>
#include <string>
#include "lexer.h"
#include "static_error.h"
#include "unicode.h"
namespace jsonnet::internal {
static const std::vector<std::string> EMPTY;
/** Is the char whitespace (excluding \n). */
static bool is_horz_ws(char c)
{
return c == ' ' || c == '\t' || c == '\r';
}
/** Is the char whitespace. */
static bool is_ws(char c)
{
return c == '\n' || is_horz_ws(c);
}
/** Strip whitespace from both ends of a string, but only up to margin on the left hand side. */
static std::string strip_ws(const std::string &s, unsigned margin)
{
if (s.size() == 0)
return s; // Avoid underflow below.
size_t i = 0;
while (i < s.length() && is_horz_ws(s[i]) && i < margin)
i++;
size_t j = s.size();
while (j > i && is_horz_ws(s[j - 1])) {
j--;
}
return std::string(&s[i], &s[j]);
}
/** Split a string by \n and also strip left (up to margin) & right whitespace from each line. */
static std::vector<std::string> line_split(const std::string &s, unsigned margin)
{
std::vector<std::string> ret;
std::stringstream ss;
for (size_t i = 0; i < s.length(); ++i) {
if (s[i] == '\n') {
ret.emplace_back(strip_ws(ss.str(), margin));
ss.str("");
} else {
ss << s[i];
}
}
ret.emplace_back(strip_ws(ss.str(), margin));
return ret;
}
/** Consume whitespace.
*
* Return number of \n and number of spaces after last \n. Convert \t to spaces.
*/
static void lex_ws(const char *&c, unsigned &new_lines, unsigned &indent, const char *&line_start,
unsigned long &line_number)
{
indent = 0;
new_lines = 0;
for (; *c != '\0' && is_ws(*c); c++) {
switch (*c) {
case '\r':
// Ignore.
break;
case '\n':
indent = 0;
new_lines++;
line_number++;
line_start = c + 1;
break;
case ' ': indent += 1; break;
// This only works for \t at the beginning of lines, but we strip it everywhere else
// anyway. The only case where this will cause a problem is spaces followed by \t
// at the beginning of a line. However that is rare, ill-advised, and if re-indentation
// is enabled it will be fixed later.
case '\t': indent += 8; break;
}
}
}
/**
# Consume all text until the end of the line, return number of newlines after that and indent
*/
static void lex_until_newline(const char *&c, std::string &text, unsigned &blanks, unsigned &indent,
const char *&line_start, unsigned long &line_number)
{
const char *original_c = c;
const char *last_non_space = c;
for (; *c != '\0' && *c != '\n'; c++) {
if (!is_horz_ws(*c))
last_non_space = c;
}
text = std::string(original_c, last_non_space - original_c + 1);
// Consume subsequent whitespace including the '\n'.
unsigned new_lines;
lex_ws(c, new_lines, indent, line_start, line_number);
blanks = new_lines == 0 ? 0 : new_lines - 1;
}
static bool is_upper(char c)
{
return c >= 'A' && c <= 'Z';
}
static bool is_lower(char c)
{
return c >= 'a' && c <= 'z';
}
static bool is_number(char c)
{
return c >= '0' && c <= '9';
}
static bool is_identifier_first(char c)
{
return is_upper(c) || is_lower(c) || c == '_';
}
static bool is_identifier(char c)
{
return is_identifier_first(c) || is_number(c);
}
static bool is_symbol(char c)
{
switch (c) {
case '!':
case '$':
case ':':
case '~':
case '+':
case '-':
case '&':
case '|':
case '^':
case '=':
case '<':
case '>':
case '*':
case '/':
case '%': return true;
}
return false;
}
bool allowed_at_end_of_operator(char c) {
switch (c) {
case '+':
case '-':
case '~':
case '!':
case '$': return false;
}
return true;
}
static const std::map<std::string, Token::Kind> keywords = {
{"assert", Token::ASSERT},
{"else", Token::ELSE},
{"error", Token::ERROR},
{"false", Token::FALSE},
{"for", Token::FOR},
{"function", Token::FUNCTION},
{"if", Token::IF},
{"import", Token::IMPORT},
{"importstr", Token::IMPORTSTR},
{"importbin", Token::IMPORTBIN},
{"in", Token::IN},
{"local", Token::LOCAL},
{"null", Token::NULL_LIT},
{"self", Token::SELF},
{"super", Token::SUPER},
{"tailstrict", Token::TAILSTRICT},
{"then", Token::THEN},
{"true", Token::TRUE},
};
Token::Kind lex_get_keyword_kind(const std::string &identifier)
{
auto it = keywords.find(identifier);
if (it == keywords.end())
return Token::IDENTIFIER;
return it->second;
}
std::string lex_number(const char *&c, const std::string &filename, const Location &begin)
{
// This function should be understood with reference to the linked image:
// https://www.json.org/img/number.png
// Note, we deviate from the json.org documentation as follows:
// There is no reason to lex negative numbers as atomic tokens, it is better to parse them
// as a unary operator combined with a numeric literal. This avoids x-1 being tokenized as
// <identifier> <number> instead of the intended <identifier> <binop> <number>.
enum State {
BEGIN,
AFTER_ZERO,
AFTER_ONE_TO_NINE,
AFTER_DOT,
AFTER_DIGIT,
AFTER_E,
AFTER_EXP_SIGN,
AFTER_EXP_DIGIT
} state;
std::string r;
state = BEGIN;
while (true) {
switch (state) {
case BEGIN:
switch (*c) {
case '0': state = AFTER_ZERO; break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_ONE_TO_NINE; break;
default: throw StaticError(filename, begin, "couldn't lex number");
}
break;
case AFTER_ZERO:
switch (*c) {
case '.': state = AFTER_DOT; break;
case 'e':
case 'E': state = AFTER_E; break;
default: goto end;
}
break;
case AFTER_ONE_TO_NINE:
switch (*c) {
case '.': state = AFTER_DOT; break;
case 'e':
case 'E': state = AFTER_E; break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_ONE_TO_NINE; break;
default: goto end;
}
break;
case AFTER_DOT:
switch (*c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_DIGIT; break;
default: {
std::stringstream ss;
ss << "couldn't lex number, junk after decimal point: " << *c;
throw StaticError(filename, begin, ss.str());
}
}
break;
case AFTER_DIGIT:
switch (*c) {
case 'e':
case 'E': state = AFTER_E; break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_DIGIT; break;
default: goto end;
}
break;
case AFTER_E:
switch (*c) {
case '+':
case '-': state = AFTER_EXP_SIGN; break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_EXP_DIGIT; break;
default: {
std::stringstream ss;
ss << "couldn't lex number, junk after 'E': " << *c;
throw StaticError(filename, begin, ss.str());
}
}
break;
case AFTER_EXP_SIGN:
switch (*c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_EXP_DIGIT; break;
default: {
std::stringstream ss;
ss << "couldn't lex number, junk after exponent sign: " << *c;
throw StaticError(filename, begin, ss.str());
}
}
break;
case AFTER_EXP_DIGIT:
switch (*c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': state = AFTER_EXP_DIGIT; break;
default: goto end;
}
break;
}
r += *c;
c++;
}
end:
return r;
}
// Check that b has at least the same whitespace prefix as a and returns the amount of this
// whitespace, otherwise returns 0. If a has no whitespace prefix than return 0.
static int whitespace_check(const char *a, const char *b)
{
int i = 0;
while (a[i] == ' ' || a[i] == '\t') {
if (b[i] != a[i])
return 0;
i++;
}
return i;
}
/*
static void add_whitespace(Fodder &fodder, const char *s, size_t n)
{
std::string ws(s, n);
if (fodder.size() == 0 || fodder.back().kind != FodderElement::WHITESPACE) {
fodder.emplace_back(FodderElement::WHITESPACE, ws);
} else {
fodder.back().data += ws;
}
}
*/
Tokens jsonnet_lex(const std::string &filename, const char *input)
{
unsigned long line_number = 1;
const char *line_start = input;
Tokens r;
const char *c = input;
Fodder fodder;
bool fresh_line = true; // Are we tokenizing from the beginning of a new line?
while (*c != '\0') {
// Used to ensure we have actually advanced the pointer by the end of the iteration.
const char *original_c = c;
Token::Kind kind;
std::string data;
std::string string_block_indent;
std::string string_block_term_indent;
unsigned new_lines, indent;
lex_ws(c, new_lines, indent, line_start, line_number);
// If it's the end of the file, discard final whitespace.
if (*c == '\0')
break;
if (new_lines > 0) {
// Otherwise store whitespace in fodder.
unsigned blanks = new_lines - 1;
fodder.emplace_back(FodderElement::LINE_END, blanks, indent, EMPTY);
fresh_line = true;
}
Location begin(line_number, c - line_start + 1);
switch (*c) {
// The following operators should never be combined with subsequent symbols.
case '{':
kind = Token::BRACE_L;
c++;
break;
case '}':
kind = Token::BRACE_R;
c++;
break;
case '[':
kind = Token::BRACKET_L;
c++;
break;
case ']':
kind = Token::BRACKET_R;
c++;
break;
case ',':
kind = Token::COMMA;
c++;
break;
case '.':
kind = Token::DOT;
c++;
break;
case '(':
kind = Token::PAREN_L;
c++;
break;
case ')':
kind = Token::PAREN_R;
c++;
break;
case ';':
kind = Token::SEMICOLON;
c++;
break;
// Numeric literals.
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
kind = Token::NUMBER;
data = lex_number(c, filename, begin);
break;
// UString literals.
case '"': {
c++;
for (;; ++c) {
if (*c == '\0') {
throw StaticError(filename, begin, "unterminated string");
}
if (*c == '"') {
break;
}
if (*c == '\\' && *(c + 1) != '\0') {
data += *c;
++c;
}
if (*c == '\n') {
// Maintain line/column counters.
line_number++;
line_start = c + 1;
}
data += *c;
}
c++; // Advance beyond the ".
kind = Token::STRING_DOUBLE;
} break;
// UString literals.
case '\'': {
c++;
for (;; ++c) {
if (*c == '\0') {
throw StaticError(filename, begin, "unterminated string");
}
if (*c == '\'') {
break;
}
if (*c == '\\' && *(c + 1) != '\0') {
data += *c;
++c;
}
if (*c == '\n') {
// Maintain line/column counters.
line_number++;
line_start = c + 1;
}
data += *c;
}
c++; // Advance beyond the '.
kind = Token::STRING_SINGLE;
} break;
// Verbatim string literals.
// ' and " quoting is interpreted here, unlike non-verbatim strings
// where it is done later by jsonnet_string_unescape. This is OK
// in this case because no information is lost by resoving the
// repeated quote into a single quote, so we can go back to the
// original form in the formatter.
case '@': {
c++;
if (*c != '"' && *c != '\'') {
std::stringstream ss;
ss << "couldn't lex verbatim string, junk after '@': " << *c;
throw StaticError(filename, begin, ss.str());
}
const char quot = *c;
c++; // Advance beyond the opening quote.
for (;; ++c) {
if (*c == '\0') {
throw StaticError(filename, begin, "unterminated verbatim string");
}
if (*c == quot) {
if (*(c + 1) == quot) {
c++;
} else {
break;
}
}
data += *c;
}
c++; // Advance beyond the closing quote.
if (quot == '"') {
kind = Token::VERBATIM_STRING_DOUBLE;
} else {
kind = Token::VERBATIM_STRING_SINGLE;
}
} break;
// Keywords
default:
if (is_identifier_first(*c)) {
std::string id;
for (; is_identifier(*c); ++c)
id += *c;
kind = lex_get_keyword_kind(id);
data = id;
} else if (is_symbol(*c) || *c == '#') {
// Single line C++ and Python style comments.
if (*c == '#' || (*c == '/' && *(c + 1) == '/')) {
std::vector<std::string> comment(1);
unsigned blanks;
unsigned indent;
lex_until_newline(c, comment[0], blanks, indent, line_start, line_number);
auto kind = fresh_line ? FodderElement::PARAGRAPH : FodderElement::LINE_END;
fodder.emplace_back(kind, blanks, indent, comment);
fresh_line = true;
continue; // We've not got a token, just fodder, so keep scanning.
}
// Multi-line C style comment.
if (*c == '/' && *(c + 1) == '*') {
unsigned margin = c - line_start;
const char *initial_c = c;
c += 2; // Avoid matching /*/: skip the /* before starting the search for
// */.
while (!(*c == '*' && *(c + 1) == '/')) {
if (*c == '\0') {
auto msg = "multi-line comment has no terminating */.";
throw StaticError(filename, begin, msg);
}
if (*c == '\n') {
// Just keep track of the line / column counters.
line_number++;
line_start = c + 1;
}
++c;
}
c += 2; // Move the pointer to the char after the closing '/'.
std::string comment(initial_c,
c - initial_c); // Includes the "/*" and "*/".
// Lex whitespace after comment
unsigned new_lines_after, indent_after;
lex_ws(c, new_lines_after, indent_after, line_start, line_number);
std::vector<std::string> lines;
if (comment.find('\n') >= comment.length()) {
// Comment looks like /* foo */
lines.push_back(comment);
fodder.emplace_back(FodderElement::INTERSTITIAL, 0, 0, lines);
if (new_lines_after > 0) {
fodder.emplace_back(FodderElement::LINE_END,
new_lines_after - 1,
indent_after,
EMPTY);
fresh_line = true;
}
} else {
lines = line_split(comment, margin);
assert(lines[0][0] == '/');
// Little hack to support PARAGRAPHs with * down the LHS:
// Add a space to lines that start with a '*'
bool all_star = true;
for (auto &l : lines) {
if (l[0] != '*')
all_star = false;
}
if (all_star) {
for (auto &l : lines) {
if (l[0] == '*')
l = " " + l;
}
}
if (new_lines_after == 0) {
// Ensure a line end after the paragraph.
new_lines_after = 1;
indent_after = 0;
}
fodder_push_back(fodder,
FodderElement(FodderElement::PARAGRAPH,
new_lines_after - 1,
indent_after,
lines));
fresh_line = true;
}
continue; // We've not got a token, just fodder, so keep scanning.
}
// Text block
if (*c == '|' && *(c + 1) == '|' && *(c + 2) == '|') {
c += 3; // Skip the "|||".
while (is_horz_ws(*c)) ++c; // Chomp whitespace at end of line.
if (*c != '\n') {
auto msg = "text block syntax requires new line after |||.";
throw StaticError(filename, begin, msg);
}
std::stringstream block;
c++; // Skip the "\n"
line_number++;
// Skip any blank lines at the beginning of the block.
while (*c == '\n') {
line_number++;
++c;
block << '\n';
}
line_start = c;
const char *first_line = c;
int ws_chars = whitespace_check(first_line, c);
string_block_indent = std::string(first_line, ws_chars);
if (ws_chars == 0) {
auto msg = "text block's first line must start with whitespace.";
throw StaticError(filename, begin, msg);
}
while (true) {
assert(ws_chars > 0);
// Read up to the \n
for (c = &c[ws_chars]; *c != '\n'; ++c) {
if (*c == '\0')
throw StaticError(filename, begin, "unexpected EOF");
block << *c;
}
// Add the \n
block << '\n';
++c;
line_number++;
line_start = c;
// Skip any blank lines
while (*c == '\n') {
line_number++;
++c;
block << '\n';
}
// Examine next line
ws_chars = whitespace_check(first_line, c);
if (ws_chars == 0) {
// End of text block
// Skip over any whitespace
while (*c == ' ' || *c == '\t') {
string_block_term_indent += *c;
++c;
}
// Expect |||
if (!(*c == '|' && *(c + 1) == '|' && *(c + 2) == '|')) {
auto msg = "text block not terminated with |||";
throw StaticError(filename, begin, msg);
}
c += 3; // Leave after the last |
data = block.str();
kind = Token::STRING_BLOCK;
break; // Out of the while loop.
}
}
break; // Out of the switch.
}
const char *operator_begin = c;
for (; is_symbol(*c); ++c) {
// Not allowed // in operators
if (*c == '/' && *(c + 1) == '/')
break;
// Not allowed /* in operators
if (*c == '/' && *(c + 1) == '*')
break;
// Not allowed ||| in operators
if (*c == '|' && *(c + 1) == '|' && *(c + 2) == '|')
break;
}
// Not allowed to end with a + - ~ ! unless a single char.
// So, wind it back if we need to (but not too far).
while (c > operator_begin + 1 && !allowed_at_end_of_operator(*(c - 1))) {
c--;
}
data += std::string(operator_begin, c);
if (data == "$") {
kind = Token::DOLLAR;
data = "";
} else {
kind = Token::OPERATOR;
}
} else {
std::stringstream ss;
ss << "Could not lex the character ";
auto uc = (unsigned char)(*c);
if (*c < 32)
ss << "code " << unsigned(uc);
else
ss << "'" << *c << "'";
throw StaticError(filename, begin, ss.str());
}
}
// Ensure that a bug in the above code does not cause an infinite memory consuming loop due
// to pushing empty tokens.
if (c == original_c) {
throw StaticError(filename, begin, "internal lexing error: pointer did not advance");
}
Location end(line_number, (c + 1) - line_start);
r.emplace_back(kind,
fodder,
data,
string_block_indent,
string_block_term_indent,
LocationRange(filename, begin, end));
fodder.clear();
fresh_line = false;
}
Location begin(line_number, c - line_start + 1);
Location end(line_number, (c + 1) - line_start + 1);
r.emplace_back(Token::END_OF_FILE, fodder, "", "", "", LocationRange(filename, begin, end));
return r;
}
std::string jsonnet_unlex(const Tokens &tokens)
{
std::stringstream ss;
for (const auto &t : tokens) {
for (const auto &f : t.fodder) {
switch (f.kind) {
case FodderElement::LINE_END: {
if (f.comment.size() > 0) {
ss << "LineEnd(" << f.blanks << ", " << f.indent << ", " << f.comment[0]
<< ")\n";
} else {
ss << "LineEnd(" << f.blanks << ", " << f.indent << ")\n";
}
} break;
case FodderElement::INTERSTITIAL: {
ss << "Interstitial(" << f.comment[0] << ")\n";
} break;
case FodderElement::PARAGRAPH: {
ss << "Paragraph(\n";
for (const auto &line : f.comment) {
ss << " " << line << '\n';
}
ss << ")" << f.blanks << "\n";
} break;
}
}
if (t.kind == Token::END_OF_FILE) {
ss << "EOF\n";
break;
}
if (t.kind == Token::STRING_DOUBLE) {
ss << "\"" << t.data << "\"\n";
} else if (t.kind == Token::STRING_SINGLE) {
ss << "'" << t.data << "'\n";
} else if (t.kind == Token::STRING_BLOCK) {
ss << "|||\n";
ss << t.stringBlockIndent;
for (const char *cp = t.data.c_str(); *cp != '\0'; ++cp) {
ss << *cp;
if (*cp == '\n' && *(cp + 1) != '\n' && *(cp + 1) != '\0') {
ss << t.stringBlockIndent;
}
}
ss << t.stringBlockTermIndent << "|||\n";
} else {
ss << t.data << "\n";
}
}
return ss.str();
}
} // namespace jsonnet::internal
|
c63b8b4cb2db01ac1c7c8140ef8b6faa78d9fc47 | 88b130d5ff52d96248d8b946cfb0faaadb731769 | /searchcore/src/vespa/searchcore/proton/metrics/document_db_commit_metrics.cpp | c5b7d71a98288212590a15c6ce63e99c8a16106c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vespa-engine/vespa | b8cfe266de7f9a9be6f2557c55bef52c3a9d7cdb | 1f8213997718c25942c38402202ae9e51572d89f | refs/heads/master | 2023-08-16T21:01:12.296208 | 2023-08-16T17:03:08 | 2023-08-16T17:03:08 | 60,377,070 | 4,889 | 619 | Apache-2.0 | 2023-09-14T21:02:11 | 2016-06-03T20:54:20 | Java | UTF-8 | C++ | false | false | 551 | cpp | document_db_commit_metrics.cpp | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "document_db_commit_metrics.h"
namespace proton {
DocumentDBCommitMetrics::DocumentDBCommitMetrics(metrics::MetricSet* parent)
: MetricSet("commit", {}, "commit metrics for feeding in a document database", parent),
operations("operations", {}, "Number of operations included in a commit", this),
latency("latency", {}, "Latency for commit", this)
{
}
DocumentDBCommitMetrics::~DocumentDBCommitMetrics() = default;
}
|
b6d6ac73a6c20f065abfdb9093dd398763092f6d | 9449475efec1a3dc02dd79dea42a9bed31ee99e6 | /Figure HW/Figure/Triangle.cpp | 4f521469a2eec5704448d64eaa900e7d69b46d27 | [] | no_license | Dmitriy011/mp1-2020-1 | 8a63ef1cdd6620a9b8f03fbd1f9dc0d969c7cd6c | e5cda10031bfb1aeb82648165c6e6b4745c7bfa1 | refs/heads/master | 2021-05-19T08:20:18.426412 | 2020-05-26T13:46:37 | 2020-05-26T13:46:37 | 251,601,848 | 1 | 0 | null | 2020-03-31T12:52:15 | 2020-03-31T12:52:15 | null | UTF-8 | C++ | false | false | 1,135 | cpp | Triangle.cpp | #include "Triangle.h"
void Triangle::Check_triangle()
{
if ((Get_point(0) != Get_point(1)) && (Get_point(0) != Get_point(2)) && (Get_point(1) != Get_point(2)))
{
Point p1 = Get_point(1) - Get_point(0);
Point p2 = Get_point(2) - Get_point(1);
Point p3 = Get_point(0) - Get_point(2);
if ((p3 * p3 <= p1 * p1 + p2 * p2) && (p2 * p2 <= p1 * p1 + p3 * p3) && (p1 * p1 <= p2 * p2 + p3 * p3))
{
std::cout << "All right!" << std::endl;
}
else
{
std::cout << "It is not triangle" << std::endl;
}
}
else
{
std::cout << "It is not triangle" << std::endl;
}
}
double Triangle::Get_side_a()
{
Point p1 = (Get_point(1) - Get_point(0)) * (Get_point(1) - Get_point(0));
int x = p1.Get_x();
int y = p1.Get_y();
return (x + y);
}
double Triangle::Get_side_b()
{
Point p1 = (Get_point(2) - Get_point(1)) * (Get_point(2) - Get_point(1));
int x = p1.Get_x();
int y = p1.Get_y();
return (x + y);
}
double Triangle::Get_side_c()
{
Point p1 = (Get_point(0) - Get_point(2)) * (Get_point(0) - Get_point(2));
int x = p1.Get_x();
int y = p1.Get_y();
return (x + y);
} |
4ea02fa95000aee2d90a125b853367f22206dffb | d851bcf96775dc836bd810ba3ee1bd56c23531de | /LinkedList/main.cpp | 6b9c91936c4b510bd5e11204c157a96d895a265c | [] | no_license | jasdipsekhon/Review | 7faf2890d4bcd8301d62d2f3ddfe1385f5e9b815 | 464225f8809e4934701fcd4d3868a06dfa8f3228 | refs/heads/main | 2023-08-31T12:42:33.713539 | 2021-10-25T03:34:12 | 2021-10-25T03:34:12 | 394,512,401 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 201 | cpp | main.cpp | #include "linkedList.h"
#include <iostream>
using namespace std;
int main()
{
Node *head = NULL;
LinkedList *list = new LinkedList();
list->insertAtNthPosition(head, 5, 1);
return 0;
} |
67204de8ac648941dac34917c653529e2c68efd9 | a71a53e399e30bc3e8141ff1ea3c61b3be3ae68f | /Dice Combinations/main.cpp | 7279a9a10e25f9c45aa256faa81df5813cced5c4 | [] | no_license | Kpriyansh/CSES-Problem-Set | d1572c54b43f5e580ea511f96b9b23659e951800 | 44c045db2c72ba0ca2b42f0e593b898575f152a7 | refs/heads/main | 2023-04-03T01:45:16.807880 | 2021-04-13T14:32:50 | 2021-04-13T14:32:50 | 326,010,236 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 442 | cpp | main.cpp | #include <iostream>
#include<cstring>
#define mod 1000000007
using namespace std;
typedef long long ll;
ll dp[10000001];
ll cntSum(ll n){
for(ll i=1;i<=n;i++){
for(ll j=1;j<=6;j++){
if(j>i)
break;
dp[i]=(dp[i]+dp[i-j])%mod;
}
}
return dp[n];
}
int main()
{
ll n;
cin>>n;
memset(dp,0,sizeof(dp));
dp[0]=1;
// dp[1]=1;
ll x=cntSum(n);
cout<<x<<endl;
return 0;
}
|
55403ee560baba270d69d592421b4fbbe7719a5f | baa397979f7c74572aba5fd18ea55c735b34dbfc | /TwinStickGame/Engine/Scene/Primitive.h | 71d6ded6f32dabfe6c980ff4440ff474e2f2027e | [
"MIT"
] | permissive | Isetta-Team/Isetta-Game | ae9e6fd2dc69b72f198019655406727c5fcf5cdc | a4c7e37b51d567d875ed0e3f10b6206df1de39b9 | refs/heads/master | 2021-10-08T13:40:56.681156 | 2018-12-12T16:50:09 | 2018-12-12T16:50:09 | 157,443,731 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 683 | h | Primitive.h | /*
* Copyright (c) 2018 Isetta
*/
#pragma once
#include <string>
#include "ISETTA_API.h"
namespace Isetta {
struct ISETTA_API Primitive {
enum class Type {
Capsule,
Cube,
Cylinder,
Grid,
Quad,
Sphere,
};
/**
* \brief Create a primitive with the given name, with the option to specific
* if it has a collider attached
*/
static class Entity* Create(Type type, const std::string_view name,
bool withCollider);
/**
* \brief Create a primitive, with the option to specific if it has a collider
* attached
*/
static class Entity* Create(Type type, bool withCollider = false);
};
} // namespace Isetta |
76dd0d1746d4a841bb2df9766d7e8855cfce2385 | 24c3b6ee3e2b06288bed587e34751969b4a73e31 | /Codeforces/Div1/Round 664/A.cpp | b29e4ec1ec212a3c546b2519e4c32f7979e9fcb0 | [] | no_license | KatsuyaKikuchi/ProgrammingContest | 89afbda50d1cf59fc58d8a9e25e6660334f18a2a | d9254202eec56f96d8c5b508556464a3f87a0a4f | refs/heads/master | 2023-06-05T20:07:36.334182 | 2021-06-13T13:55:06 | 2021-06-13T13:55:06 | 318,641,671 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,412 | cpp | A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, D, M;
cin >> N >> D >> M;
priority_queue<ll, vector<ll> > q0;
vector<ll> v;
REP(i, N) {
ll a;
cin >> a;
if (a > M)
q0.push(a);
else
v.push_back(a);
}
sort(v.begin(), v.end());
deque<ll> q1;
REP(i, v.size()) {
q1.push_back(v[i]);
}
ll ans = 0;
ll n = q0.size();
ll x = std::max(0LL, n - 1) % (D + 1);
REP(_, (n + D) / (D + 1)) {
ll t = q0.top();
q0.pop();
ans += t;
}
while (!q0.empty() && q1.size() > D) {
ll t = q0.top();
q0.pop();
ll s = 0;
ll d = D;
if (x-- <= 0)
d++;
REP(_, d) {
s += q1.front();
q1.pop_front();
}
ans += std::max(s, t);
if (s >= t)
break;
if (d == D) {
ans += q1.back();
q1.pop_back();
}
}
while (!q1.empty()) {
ll t = q1.front();
q1.pop_front();
ans += t;
}
cout << ans << endl;
return 0;
} |
6cc038183c5164586f92399231cd39554d1a59c0 | a7764174fb0351ea666faa9f3b5dfe304390a011 | /inc/BOPTools_RoughShapeIntersector.hxx | 0731ead6c0804676ed05dd6366a32075dd72dbe6 | [] | no_license | uel-dataexchange/Opencascade_uel | f7123943e9d8124f4fa67579e3cd3f85cfe52d91 | 06ec93d238d3e3ea2881ff44ba8c21cf870435cd | refs/heads/master | 2022-11-16T07:40:30.837854 | 2020-07-08T01:56:37 | 2020-07-08T01:56:37 | 276,290,778 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,350 | hxx | BOPTools_RoughShapeIntersector.hxx | // This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BOPTools_RoughShapeIntersector_HeaderFile
#define _BOPTools_RoughShapeIntersector_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _BooleanOperations_PShapesDataStructure_HeaderFile
#include <BooleanOperations_PShapesDataStructure.hxx>
#endif
#ifndef _Handle_Bnd_HArray1OfBox_HeaderFile
#include <Handle_Bnd_HArray1OfBox.hxx>
#endif
#ifndef _Handle_BOPTools_HArray2OfIntersectionStatus_HeaderFile
#include <Handle_BOPTools_HArray2OfIntersectionStatus.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _BOPTools_IntersectionStatus_HeaderFile
#include <BOPTools_IntersectionStatus.hxx>
#endif
class Bnd_HArray1OfBox;
class BOPTools_HArray2OfIntersectionStatus;
//! The class RoughShapeIntersector describes the algorithm of <br>
//! intersection of bounding boxes of <br>
//! shapes stored in ShapesDataStructure. <br>
//! It stores statuses of intersection in 2 dimension array. <br>
class BOPTools_RoughShapeIntersector {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Initializes algorithm by shapes data structure <br>
Standard_EXPORT BOPTools_RoughShapeIntersector(const BooleanOperations_PShapesDataStructure& PDS);
//! Perform computations. <br>
Standard_EXPORT void Perform() ;
//! Returns 2 dimension array of status flags. <br>
//! First indices of the array corresponds to indices of <br>
//! subshapes of Object of myPDS. <br>
//! Second indices of array corresponds to indices of <br>
//! subshapes of Tool of myPDS. <br>
Standard_EXPORT const Handle_BOPTools_HArray2OfIntersectionStatus& TableOfStatus() const;
//! Returns False if some errors occured during <br>
//! computations or method Perform <br>
//! was not invoked before, <br>
//! otherwise returns True. <br>
Standard_EXPORT Standard_Boolean IsDone() const;
protected:
private:
Standard_EXPORT void Prepare() ;
Standard_EXPORT void PropagateForSuccessors1(const Standard_Integer AncestorsIndex1,const Standard_Integer AncestorsIndex2,const BOPTools_IntersectionStatus theStatus) ;
Standard_EXPORT void PropagateForSuccessors2(const Standard_Integer AncestorsIndex1,const Standard_Integer AncestorsIndex2,const BOPTools_IntersectionStatus theStatus) ;
BooleanOperations_PShapesDataStructure myPDS;
Handle_Bnd_HArray1OfBox myBoundingBoxes;
Handle_BOPTools_HArray2OfIntersectionStatus myTableOfStatus;
Standard_Boolean myIsDone;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif
|
06a5f51ef9e6f6ee5edef528c7ea96378e4bab20 | 3033fad29813eef9d066bb4a41348b26115c23af | /LLVMRuntime/CompiledModuleBuilder.h | 037867c610bca5985c6eedaae2a25578984b9ebb | [
"MIT"
] | permissive | MatthewSmit/CPVulkan | ec957340c3be48e0cde224d115c3c0cade8f40a8 | d96f2f6db4cbbabcc41c2023a48ec63d1950dec0 | refs/heads/master | 2020-09-08T16:41:07.981655 | 2020-01-07T12:12:18 | 2020-01-07T12:12:18 | 221,184,270 | 1 | 0 | MIT | 2019-11-29T02:30:52 | 2019-11-12T09:53:36 | C++ | UTF-8 | C++ | false | false | 17,064 | h | CompiledModuleBuilder.h | #pragma once
#include <Base.h>
#include "Jit.h"
#include <llvm-c/Core.h>
#include <llvm-c/Types.h>
namespace Intrinsics
{
enum ID
{
not_intrinsic = 0,
// Get the intrinsic enums generated from Intrinsics.td
#define GET_INTRINSIC_ENUM_VALUES
#include "llvm/IR/IntrinsicEnums.inc"
#undef GET_INTRINSIC_ENUM_VALUES
};
}
class CPJit;
class CompiledModuleBuilder
{
public:
CPJit* jit{};
LLVMContextRef context{};
LLVMModuleRef module{};
LLVMBuilderRef builder{};
virtual ~CompiledModuleBuilder() = default;
void Initialise(CPJit* jit, LLVMContextRef context, LLVMModuleRef module);
LLVMValueRef CompileMainFunction();
virtual LLVMValueRef CompileMainFunctionImpl() = 0;
// Generic Helpers
bool HasName(LLVMValueRef value);
std::string GetName(LLVMValueRef value);
void SetName(LLVMValueRef value, const std::string& name);
// Constant Helpers
LLVMValueRef ConstF32(float value);
LLVMValueRef ConstF64(double value);
LLVMValueRef ConstBool(bool value);
LLVMValueRef ConstI8(int8_t value);
LLVMValueRef ConstI16(int16_t value);
LLVMValueRef ConstI32(int32_t value);
LLVMValueRef ConstI64(int64_t value);
LLVMValueRef ConstU8(uint8_t value);
LLVMValueRef ConstU16(uint16_t value);
LLVMValueRef ConstU32(uint32_t value);
LLVMValueRef ConstU64(uint64_t value);
// Type Helpers
template<typename T>
LLVMTypeRef GetType();
LLVMTypeRef ScalarType(LLVMTypeRef type);
LLVMTypeRef StructType(std::vector<LLVMTypeRef>& members, const std::string& name, bool isPacked = false);
// Builder helpers
template<int NumberValues>
LLVMValueRef CreateIntrinsic(Intrinsics::ID intrinsic, std::array<LLVMValueRef, NumberValues> values)
{
std::array<LLVMTypeRef, NumberValues> parameterTypes;
for (auto i = 0u; i < NumberValues; i++)
{
parameterTypes[i] = LLVMTypeOf(values[i]);
}
const auto declaration = LLVMGetIntrinsicDeclaration(module, intrinsic, parameterTypes.data(), parameterTypes.size());
return LLVMBuildCall(builder, declaration, values.data(), static_cast<uint32_t>(values.size()), "");
}
LLVMValueRef GlobalVariable(LLVMTypeRef type, LLVMLinkage linkage, const std::string& name);
LLVMValueRef GlobalVariable(LLVMTypeRef type, bool isConstant, LLVMLinkage linkage, LLVMValueRef initialiser, const std::string& name);
LLVMValueRef CreateRetVoid();
LLVMValueRef CreateRet(LLVMValueRef value);
LLVMValueRef CreateAggregateRet(LLVMValueRef* returnValues, uint32_t numberValues);
LLVMValueRef CreateBr(LLVMBasicBlockRef destination);
LLVMValueRef CreateCondBr(LLVMValueRef conditional, LLVMBasicBlockRef thenBlock, LLVMBasicBlockRef elseBlock);
LLVMValueRef CreateSwitch(LLVMValueRef value, LLVMBasicBlockRef elseBlock, uint32_t numberCases);
LLVMValueRef CreateIndirectBr(LLVMValueRef address, uint32_t numberDestinations);
LLVMValueRef CreateInvoke(LLVMValueRef function, LLVMValueRef* arguments, uint32_t numberArguments, LLVMBasicBlockRef thenBlock, LLVMBasicBlockRef catchBlock, const std::string& name = "");
LLVMValueRef CreateUnreachable();
LLVMValueRef CreateResume(LLVMValueRef exception);
LLVMValueRef CreateLandingPad(LLVMTypeRef type, LLVMValueRef PersFn, uint32_t numClauses, const std::string& name = "");
LLVMValueRef CreateCleanupRet(LLVMValueRef catchPad, LLVMBasicBlockRef block);
LLVMValueRef CreateCatchRet(LLVMValueRef catchPad, LLVMBasicBlockRef block);
LLVMValueRef CreateCatchPad(LLVMValueRef parentPad, LLVMValueRef* args, uint32_t numArgs, const std::string& name = "");
LLVMValueRef CreateCleanupPad(LLVMValueRef parentPad, LLVMValueRef* args, uint32_t numArgs, const std::string& name = "");
LLVMValueRef CreateCatchSwitch(LLVMValueRef parentPad, LLVMBasicBlockRef unwindBlock, uint32_t numHandlers, const std::string& name = "");
LLVMValueRef CreateAdd(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNSWAdd(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNUWAdd(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFAdd(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateSub(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNSWSub(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNUWSub(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFSub(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateMul(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNSWMul(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNUWMul(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFMul(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateUDiv(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateExactUDiv(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateSDiv(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateExactSDiv(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFDiv(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateURem(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateSRem(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFRem(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateShl(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateLShr(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateAShr(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateAnd(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateOr(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateXor(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateBinOp(LLVMOpcode opcode, LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateNeg(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateNSWNeg(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateNUWNeg(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateFNeg(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateNot(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateMalloc(LLVMTypeRef type, const std::string& name = "");
LLVMValueRef CreateArrayMalloc(LLVMTypeRef type, LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateMemSet(LLVMValueRef pointer, LLVMValueRef value, LLVMValueRef length, uint32_t alignment);
LLVMValueRef CreateMemCpy(LLVMValueRef destination, uint32_t destinationAlignment, LLVMValueRef source, uint32_t sourceAlignment, LLVMValueRef size, bool isVolatile = false);
LLVMValueRef CreateMemMove(LLVMValueRef destination, uint32_t destinationAlignment, LLVMValueRef source, uint32_t sourceAlignment, LLVMValueRef size, bool isVolatile = false);
LLVMValueRef CreateAlloca(LLVMTypeRef type, const std::string& name = "");
LLVMValueRef CreateAlloca(LLVMTypeRef type, LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateFree(LLVMValueRef pointer);
LLVMValueRef CreateLoad(LLVMValueRef pointer, bool isVolatile = false, const std::string& name = "");
LLVMValueRef CreateLoad(LLVMTypeRef type, LLVMValueRef pointer, bool isVolatile = false, const std::string& name = "");
LLVMValueRef CreateStore(LLVMValueRef value, LLVMValueRef pointer, bool isVolatile = false);
LLVMValueRef CreateGEP(LLVMValueRef pointer, uint32_t index0);
LLVMValueRef CreateGEP(LLVMValueRef pointer, uint32_t index0, uint32_t index1);
LLVMValueRef CreateGEP(LLVMValueRef pointer, const std::vector<uint32_t>& indices);
LLVMValueRef CreateGEP(LLVMValueRef pointer, std::vector<LLVMValueRef> indices);
LLVMValueRef CreateInBoundsGEP(LLVMValueRef pointer, uint32_t index0);
LLVMValueRef CreateInBoundsGEP(LLVMValueRef pointer, uint32_t index0, uint32_t index1);
LLVMValueRef CreateInBoundsGEP(LLVMValueRef pointer, std::vector<LLVMValueRef> indices);
LLVMValueRef CreateGlobalString(const std::string& str, const std::string& name = "");
LLVMValueRef CreateGlobalStringPtr(const std::string& str, const std::string& name = "");
LLVMValueRef CreateTrunc(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateZExt(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateSExt(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateFPToUI(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateFPToSI(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateUIToFP(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateSIToFP(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateFPTrunc(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateFPExt(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateFPExtOrTrunc(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreatePtrToInt(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateIntToPtr(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateBitCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateAddrSpaceCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateZExtOrTrunc(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateZExtOrBitCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateSExtOrTrunc(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateSExtOrBitCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateTruncOrBitCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateCast(LLVMOpcode opcode, LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreatePointerCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateIntCast(LLVMValueRef value, LLVMTypeRef destinationType, bool isSigned, const std::string& name = "");
LLVMValueRef CreateFPCast(LLVMValueRef value, LLVMTypeRef destinationType, const std::string& name = "");
LLVMValueRef CreateICmp(LLVMIntPredicate opcode, LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateICmpEQ(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntEQ, lhs, rhs, name);
}
LLVMValueRef CreateICmpNE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntNE, lhs, rhs, name);
}
LLVMValueRef CreateICmpUGT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntUGT, lhs, rhs, name);
}
LLVMValueRef CreateICmpUGE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntUGE, lhs, rhs, name);
}
LLVMValueRef CreateICmpULT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntULT, lhs, rhs, name);
}
LLVMValueRef CreateICmpULE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntULE, lhs, rhs, name);
}
LLVMValueRef CreateICmpSGT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntSGT, lhs, rhs, name);
}
LLVMValueRef CreateICmpSGE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntSGE, lhs, rhs, name);
}
LLVMValueRef CreateICmpSLT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntSLT, lhs, rhs, name);
}
LLVMValueRef CreateICmpSLE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateICmp(LLVMIntSLE, lhs, rhs, name);
}
LLVMValueRef CreateFCmp(LLVMRealPredicate opcode, LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFCmpOEQ(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealOEQ, lhs, rhs, name);
}
LLVMValueRef CreateFCmpOGT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealOGT, lhs, rhs, name);
}
LLVMValueRef CreateFCmpOGE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealOGE, lhs, rhs, name);
}
LLVMValueRef CreateFCmpOLT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealOLT, lhs, rhs, name);
}
LLVMValueRef CreateFCmpOLE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealOLE, lhs, rhs, name);
}
LLVMValueRef CreateFCmpONE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealONE, lhs, rhs, name);
}
LLVMValueRef CreateFCmpORD(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealORD, lhs, rhs, name);
}
LLVMValueRef CreateFCmpUNO(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealUNO, lhs, rhs, name);
}
LLVMValueRef CreateFCmpUEQ(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealUEQ, lhs, rhs, name);
}
LLVMValueRef CreateFCmpUGT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealUGT, lhs, rhs, name);
}
LLVMValueRef CreateFCmpUGE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealUGE, lhs, rhs, name);
}
LLVMValueRef CreateFCmpULT(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealULT, lhs, rhs, name);
}
LLVMValueRef CreateFCmpULE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealULE, lhs, rhs, name);
}
LLVMValueRef CreateFCmpUNE(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "")
{
return CreateFCmp(LLVMRealUNE, lhs, rhs, name);
}
LLVMValueRef CreatePhi(LLVMTypeRef type, const std::string& name = "");
LLVMValueRef CreateCall(LLVMValueRef function, LLVMValueRef* arguments, uint32_t numberArguments, const std::string& name = "");
LLVMValueRef CreateCall(LLVMValueRef function, std::vector<LLVMValueRef> arguments, const std::string& name = "");
LLVMValueRef CreateSelect(LLVMValueRef conditional, LLVMValueRef thenValue, LLVMValueRef elseValue, const std::string& name = "");
LLVMValueRef CreateVAArg(LLVMValueRef list, LLVMTypeRef type, const std::string& name = "");
LLVMValueRef CreateExtractElement(LLVMValueRef vector, LLVMValueRef Index, const std::string& name = "");
LLVMValueRef CreateInsertElement(LLVMValueRef vector, LLVMValueRef element, LLVMValueRef index, const std::string& name = "");
LLVMValueRef CreateShuffleVector(LLVMValueRef value1, LLVMValueRef value2, LLVMValueRef mask, const std::string& name = "");
LLVMValueRef CreateExtractValue(LLVMValueRef aggregate, uint32_t index, const std::string& name = "");
LLVMValueRef CreateInsertValue(LLVMValueRef aggregate, LLVMValueRef element, uint32_t index, const std::string& name = "");
LLVMValueRef CreateIsNull(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreateIsNotNull(LLVMValueRef value, const std::string& name = "");
LLVMValueRef CreatePtrDiff(LLVMValueRef lhs, LLVMValueRef rhs, const std::string& name = "");
LLVMValueRef CreateFence(LLVMAtomicOrdering ordering, bool singleThread, const std::string& name = "");
LLVMValueRef CreateAtomicRMW(LLVMAtomicRMWBinOp opcode, LLVMValueRef pointer, LLVMValueRef value, LLVMAtomicOrdering ordering, bool singleThread = false);
LLVMValueRef CreateAtomicCmpXchg(LLVMValueRef pointer, LLVMValueRef cmp, LLVMValueRef New, LLVMAtomicOrdering successOrdering, LLVMAtomicOrdering failureOrdering, bool singleThread = false);
LLVMValueRef CreateVectorSplat(uint32_t vectorSize, LLVMValueRef value, const std::string& name = "");
};
|
db1c2225cf1578db2e8498c3d0344156a9efc3a3 | 5d7d3341c7c374320dd9a1f2e52ed9c99557e405 | /main.cpp | 8f89928b0024c3f39367a1d19e228edde03ae958 | [] | no_license | pqok/DrDDNS-Ali | b5d133ad20bb6bbb14e8b8cbb37e1e0ab334a7ab | cd168dede488b37697f314b9b7be5da016788d97 | refs/heads/master | 2022-04-13T11:54:13.356559 | 2020-03-04T04:27:25 | 2020-03-04T04:27:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,126 | cpp | main.cpp | #include <QCoreApplication>
#include "Aliyun.h"
#include "DescribeDomainRecords.h"
#include "UpdateDomainRecord.h"
#include "ConfigHelper.h"
using namespace AliyunNameSpace;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
/* 读取配置文件 */
ConfigHelper confHelper;
if(!confHelper.load()) {
QCoreApplication::exit();
return -1;
}
#if 0
DescribeDomainRecords mDescribeDomainRecords;
mDescribeDomainRecords.setAccessKeyId(confHelper.accessKeyId());
mDescribeDomainRecords.setAccessKeySecret(confHelper.accessKeySecret());
mDescribeDomainRecords.setDomain(confHelper.domain());
mDescribeDomainRecords.doIt();
#endif
UpdateDomainRecord mUpdateDomainRecord;
mUpdateDomainRecord.setAccessKeyId(confHelper.accessKeyId());
mUpdateDomainRecord.setAccessKeySecret(confHelper.accessKeySecret());
mUpdateDomainRecord.setDomain(confHelper.domain());
mUpdateDomainRecord.setDomainRecords(confHelper.domainRecords());
mUpdateDomainRecord.doIt();
return a.exec();
}
//LTAI4FpMXrNAWu5tnZuhgVAm
//dewee2gfoAq1QvHmmAEidM8eAMnMdK
|
9ce80c0f8c0ce5c2dbbc4f57211702dab7ba62ce | 4c93ca76318969f1624a0e77749bcdea3e7809d3 | /~9999/4153_직각삼각형.cpp | c4dd2a94c067a601f501d83218259bf93b437838 | [] | no_license | root-jeong/BOJ | 080925f6cfbb5dcbdf13c4c3a3c7e0a444908e6e | ec1ef5ad322597883b74d276078da8a508f164a8 | refs/heads/master | 2022-04-03T22:33:44.866564 | 2020-01-08T12:21:19 | 2020-01-08T12:21:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 491 | cpp | 4153_직각삼각형.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<unsigned long long> vec;
int main() {
unsigned long long a, b, c;
unsigned long long s, m, l;
while (true) {
cin >> a >> b >> c;
if (a == 0) break;
vec.clear();
vec.push_back(a);
vec.push_back(b);
vec.push_back(c);
sort(vec.begin(), vec.end());
s = vec[0];
m = vec[1];
l = vec[2];
if ((s * s) + (m*m) == (l*l)) {
cout << "right\n";
}
else {
cout << "wrong\n";
}
}
} |
ef2c406104060c57fb3a970413a2f5b23c0cede3 | 22c7ca97ad943c572949bf564d3e65bd587ebb3c | /include/matrix.hpp | 1dc25c0d206410141814c5330beca9c1494180d8 | [] | no_license | AliKhudiyev/CDT-Model | 67b675cb237d40d8a204aabead6c239b08aebfe4 | 20b21855d9547f057798b2d6b915eec8ceacd64d | refs/heads/master | 2022-03-31T08:02:48.759117 | 2020-01-24T18:06:17 | 2020-01-24T18:06:17 | 233,613,617 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,912 | hpp | matrix.hpp |
#ifndef _MATRIX_
#define _MATRIX_
#include <vector>
#include <iostream>
#include <functional>
#include <string>
#include "shape.hpp"
#define Matrix_d Matrix<double>
#define Matrix_f Matrix<float>
#define Matrix_l Matrix<long>
#define Matrix_i Matrix<int>
#define Matrix_u Matrix<unsigned>
#define Matrix_c Matrix<char>
// using fp = void (*)(Matrix&);
// Function Type
enum FT{
READ=0,
WRITE,
COMPARE,
ADD,
SUBTRACT,
MULTIPLY,
MULTIPLY_COEFFICIENT,
MULTIPLY_ELEMENTWISE
};
template<class T=double>
class Matrix{
private:
Shape m_shape=Shape{0,0};
std::vector<std::vector<T>> m_elems;
public:
Matrix()=default;
Matrix(const Shape& shape);
Matrix(unsigned n_row, unsigned n_col);
Matrix(unsigned n_diog);
~Matrix();
T get(unsigned row, unsigned col) const;
std::vector<T> get(unsigned row) const;
void initialize(T beg, T end);
void set(const FT& ft, std::function<void(Matrix& mat, void* argument)>& function);
void reshape(const Shape& shape);
void reshape(unsigned n_row, unsigned n_col=0);
void add_row(unsigned n_row=1);
void add_col(unsigned n_col=1);
void set_shape(unsigned n_row, unsigned n_col);
void swap(unsigned row1, unsigned row2);
Shape shape() const;
Matrix<T> compile(unsigned beg_col, unsigned end_col) const;
static Matrix<T> transpose(const Matrix<T>& mat);
Matrix<T>& transpose();
Matrix<T> mult(const Matrix& mat) const;
Matrix<T> mul(const T& coef) const;
Matrix<T> mulew(const Matrix<T>& mat) const;
Matrix<T>& mult_eq(const Matrix<T>& mat);
Matrix<T>& mul_eq(const T& coef);
Matrix<T>& mulew_eq(const Matrix<T>& mat);
std::vector<T>& operator[](unsigned index);
Matrix<T> operator+(const Matrix<T>& mat) const;
Matrix<T> operator-(const Matrix<T>& mat) const;
Matrix<T> operator*(const Matrix<T>& mat) const;
Matrix<T>& operator+=(const Matrix<T>& mat);
Matrix<T>& operator-=(const Matrix<T>& mat);
Matrix<T>& operator*=(const Matrix<T>& mat);
template<class C>
friend std::ostream& operator<<(std::ostream& out, const Matrix<C>& mat);
template<class C>
friend std::istream& operator>>(std::istream& in, Matrix<C>& mat);
private:
void (*m_functions[7])(Matrix&, void*);
void read(const std::string& filepath);
void write(const std::string& filepath) const;
Matrix<T>& add(const Matrix& mat);
Matrix<T>& subtract(const Matrix& mat);
Matrix<T>& multiply(const Matrix& mat);
Matrix<T>& multiply_coefficient(const T& coef);
Matrix<T>& multiply_elementwise(const Matrix<T>& mat);
void init();
};
template<class C>
std::ostream& operator<<(std::ostream& out, const Matrix<C>& mat);
template<class C>
std::istream& operator>>(std::istream& in, Matrix<C>& mat);
#ifndef _MATRIX_CPP_
#include "../src/matrix.cpp"
#endif
#endif
|
59a091dd560a6f439c726d1aae8720cf47e08a99 | 72ff9c76725948e4534594840c31dcd0648c80f7 | /Array/minimum_distance2.cpp | 5e3309bfe8d857eb85bd75346d2cb2341c29dd6e | [] | no_license | Vaibhav123v/356-Days-With-DataStructure | b08b2e427b01618b4083aef50af9345e15d9bcd8 | a8315668cce700892369c4cc3cee157b0051c809 | refs/heads/main | 2023-08-11T17:11:49.194690 | 2021-09-18T15:22:08 | 2021-09-18T15:22:08 | 356,337,651 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 800 | cpp | minimum_distance2.cpp | // Tricky Method to solve this problem in O(n) time.
#include<bits/stdc++.h>
using namespace std;
int minDist(int array[],int n , int x ,int y)
{
int i,prev;
int min_dist = INT_MAX;
for(i=0;i<n;i++)
{
if(array[i]==x || array[i]==y)
{
prev = i;
break;
}
}
for(;i<n;i++)
{
if(array[i]==x || array[i]==y)
{
if(array[prev]!=array[i] && (i-prev) < min_dist)
{
min_dist = i - prev;
prev = i;
}
else
{
prev = i;
}
}
}
return min_dist;
}
int main()
{
int array[]={3,5,4,2,6,3,5,0,0,5,4,6,3};
int n = sizeof(array)/sizeof(array[0]);
int x = 3,y =6; // We can take input from the user......................
cout<<minDist(array,n,x,y);
return 0;
} |
19170d7c47d5e287d3bb36f61f4c489237448f64 | 1834c0796ee324243f550357c67d8bcd7c94de17 | /SDK/TCF_Debug_ReplaySlot_WBP_classes.hpp | f28d67e315a81ffc9e1f09133da0b2035e9234af | [] | no_license | DarkCodez/TCF-SDK | ce41cc7dab47c98b382ad0f87696780fab9898d2 | 134a694d3f0a42ea149a811750fcc945437a70cc | refs/heads/master | 2023-08-25T20:54:04.496383 | 2021-10-25T11:26:18 | 2021-10-25T11:26:18 | 423,337,506 | 1 | 0 | null | 2021-11-01T04:31:21 | 2021-11-01T04:31:20 | null | UTF-8 | C++ | false | false | 3,029 | hpp | TCF_Debug_ReplaySlot_WBP_classes.hpp | #pragma once
// The Cycle Frontier (1.X) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "TCF_Debug_ReplaySlot_WBP_structs.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// WidgetBlueprintGeneratedClass Debug_ReplaySlot_WBP.Debug_ReplaySlot_WBP_C
// 0x0070 (0x02D0 - 0x0260)
class UDebug_ReplaySlot_WBP_C : public UUserWidget
{
public:
struct FPointerToUberGraphFrame UberGraphFrame; // 0x0260(0x0008) (CPF_ZeroConstructor, CPF_Transient, CPF_DuplicateTransient)
class UButton* DeleteReplayButton; // 0x0268(0x0008) (CPF_BlueprintVisible, CPF_ExportObject, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData, CPF_RepSkip, CPF_NoDestructor, CPF_PersistentInstance, CPF_HasGetValueTypeHash)
class UButton* PlayButton; // 0x0270(0x0008) (CPF_BlueprintVisible, CPF_ExportObject, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData, CPF_RepSkip, CPF_NoDestructor, CPF_PersistentInstance, CPF_HasGetValueTypeHash)
class UEditableTextBox* ReplayNameTextBox; // 0x0278(0x0008) (CPF_BlueprintVisible, CPF_ExportObject, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData, CPF_RepSkip, CPF_NoDestructor, CPF_PersistentInstance, CPF_HasGetValueTypeHash)
struct FString ReplayName; // 0x0280(0x0010) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_ExposeOnSpawn, CPF_HasGetValueTypeHash)
struct FString ReplayFriendlyName; // 0x0290(0x0010) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_ExposeOnSpawn, CPF_HasGetValueTypeHash)
struct FS_ReplayInfo ReplayInfo; // 0x02A0(0x0030) (CPF_Edit, CPF_BlueprintVisible, CPF_DisableEditOnInstance)
static UClass* StaticClass()
{
static auto ptr = UObject::FindObject<UClass>("WidgetBlueprintGeneratedClass Debug_ReplaySlot_WBP.Debug_ReplaySlot_WBP_C");
return ptr;
}
void Tick(const struct FGeometry& MyGeometry, float InDeltaTime);
void BndEvt__ReplayButton_K2Node_ComponentBoundEvent_235_OnButtonClickedEvent__DelegateSignature();
void BndEvt__DeleteReplayButton_K2Node_ComponentBoundEvent_252_OnButtonClickedEvent__DelegateSignature();
void BndEvt__ReplayNameTextBox_K2Node_ComponentBoundEvent_271_OnEditableTextBoxCommittedEvent__DelegateSignature(const struct FText& Text, TEnumAsByte<ETextCommit> CommitMethod);
void Construct();
void ExecuteUbergraph_Debug_ReplaySlot_WBP(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
05c7fbdcc2fc6bdd6127366d5ffe8812ad85899a | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /components/viz/common/quads/frame_deadline.h | 4f3963fc0b0441efe9c753a0b847934f7660c423 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 3,235 | h | frame_deadline.h | // Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_VIZ_COMMON_QUADS_FRAME_DEADLINE_H_
#define COMPONENTS_VIZ_COMMON_QUADS_FRAME_DEADLINE_H_
#include <string>
#include "base/time/time.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/viz_common_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace viz {
// FrameDeadline is a class that represents a CompositorFrame's deadline for
// activation. The deadline consists of three components: start time, deadline
// in frames, and frame interval. All three components are stored individually
// in this class in order to allow resolution of this deadline that incorporates
// a system default deadline in the Viz service. In particular, the computation
// to translate FrameDeadline into wall time is:
// if use system default lower bound deadline:
// start time + max(deadline in frames, default deadline) * frame interval
// else:
// start time + deadline in frames * frame interval
class VIZ_COMMON_EXPORT FrameDeadline {
public:
static FrameDeadline MakeZero();
FrameDeadline() = default;
FrameDeadline(base::TimeTicks frame_start_time,
uint32_t deadline_in_frames,
base::TimeDelta frame_interval,
bool use_default_lower_bound_deadline)
: frame_start_time_(frame_start_time),
deadline_in_frames_(deadline_in_frames),
frame_interval_(frame_interval),
use_default_lower_bound_deadline_(use_default_lower_bound_deadline) {}
FrameDeadline(const FrameDeadline& other) = default;
FrameDeadline& operator=(const FrameDeadline& other) = default;
// Converts this FrameDeadline object into a wall time given a system default
// deadline in frames.
base::TimeTicks ToWallTime(
absl::optional<uint32_t> default_deadline_in_frames =
absl::nullopt) const;
bool operator==(const FrameDeadline& other) const {
return other.frame_start_time_ == frame_start_time_ &&
other.deadline_in_frames_ == deadline_in_frames_ &&
other.frame_interval_ == frame_interval_ &&
other.use_default_lower_bound_deadline_ ==
use_default_lower_bound_deadline_;
}
bool operator!=(const FrameDeadline& other) const {
return !(*this == other);
}
base::TimeTicks frame_start_time() const { return frame_start_time_; }
uint32_t deadline_in_frames() const { return deadline_in_frames_; }
base::TimeDelta frame_interval() const { return frame_interval_; }
bool use_default_lower_bound_deadline() const {
return use_default_lower_bound_deadline_;
}
bool IsZero() const;
std::string ToString() const;
private:
base::TimeTicks frame_start_time_;
uint32_t deadline_in_frames_ = 0u;
base::TimeDelta frame_interval_ = BeginFrameArgs::DefaultInterval();
bool use_default_lower_bound_deadline_ = true;
};
VIZ_COMMON_EXPORT std::ostream& operator<<(std::ostream& out,
const FrameDeadline& frame_deadline);
} // namespace viz
#endif // COMPONENTS_VIZ_COMMON_QUADS_FRAME_DEADLINE_H_
|
a07bafbb2f847c79528838cf446e5375a10c4fc7 | 7c5d7fb6a64df1a118a64bdf6087ecf395a3a722 | /data/final-24/sources/29859.cpp | 639b2e3dc13f888a1db4d171c3e877bf2f0ebbaa | [] | no_license | alexhein189/code-plagiarism-detector | e66df71c46cc5043b6825ef76a940b658c0e5015 | 68d21639d4b37bb2c801befe6f7ce0007d7eccc5 | refs/heads/master | 2023-03-18T06:02:45.508614 | 2016-05-04T14:29:57 | 2016-05-04T14:54:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,972 | cpp | 29859.cpp | #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<memory.h>
#include<set>
#include<map>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
#define abs(a) ((a)>0?(a):-(a))
#define MIN(a,b) ((a)>(b)?(b):(a))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define fill(a,k) memset(a,k,sizeof(a))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define for(i,a,n) for(int i=a;i<n;i++)
#define inf 2e+18
#define fr(a) freopen(a,"r",stdin)
#define fw(a) freopen(a,"w",stdout)
/*
int dsu_get(int v)
{
return (p[v]==v?v:p[v]=dsu_get(p[v]));
}
void dsu_union(int a,int b)
{
a=dsu_get(a);
b=dsu_get(b);
if(rand()&1)
swap(a,b);
p[a]=b;
}
*/
/*
void add(int a,int k)
{
for(int i=a;a<n;i|=i+1)
fen[i]+=k;
}
int get(int a)
{
int s=0;
for(int i=a;i>=0;i=(i&i+1)-1)
s+=fen[i];
return s;
}
*/
int main()
{
fr("input.txt");
fw("output.txt");
int k;
string s;
cin>>k>>s;
bool a=0,b=0,c=0;
int rk=0;
for(i,0,(int)s.length())
{
if(s[i]=='a' && !a)
{
a=1;
rk++;
}
if(s[i]=='b' && !b)
{
b=1;
rk++;
}
if(s[i]=='c' && !c)
{
c=1;
rk++;
}
}
string tm;
for(l,0,k)
{
tm+=s[l];
bool j=0;
if(!((int)s.length()%(l+1)))
{
string gh;
while(gh.size()<s.size())
gh+=tm;
if(gh==s)
{
cout<<1<<endl<<tm;
return 0;
}
}
}
if(s.length()<=k)
{
cout<<1<<endl<<s;
return 0;
}
if(rk==2)
{
cout<<2;
if(a)
cout<<endl<<'a';
if(b)
cout<<endl<<'b';
if(c)
cout<<endl<<'c';
return 0;
}
cout<<3<<endl<<'a'<<endl<<'b'<<endl<<'c';
return 0;
} |
e4b2eb1babaae5a326b8cd6d42bcf7c6c040eb2d | 6f286be4a4e16867cc6e488080b8e3eced1dcd62 | /src/GSvar/ExternalToolDialog.cpp | a095339fc61bfa199794608254a97af95bc5f98b | [
"MIT"
] | permissive | imgag/ngs-bits | 3587404be01687d52c5a77b933874ca77faf8e6b | 0597c96f6bc09067598c2364877d11091350bed8 | refs/heads/master | 2023-09-03T20:20:16.975954 | 2023-09-01T13:17:35 | 2023-09-01T13:17:35 | 38,034,492 | 110 | 36 | MIT | 2023-09-12T14:21:59 | 2015-06-25T07:23:55 | C++ | UTF-8 | C++ | false | false | 8,099 | cpp | ExternalToolDialog.cpp | #include <QMessageBox>
#include "ExternalToolDialog.h"
#include "Exceptions.h"
#include "Settings.h"
#include "Helper.h"
#include "BedFile.h"
#include "QCCollection.h"
#include "QFileDialog"
#include "Statistics.h"
#include "SampleSimilarity.h"
#include "LoginManager.h"
#include "ProcessedSampleSelector.h"
#include "GlobalServiceProvider.h"
#include "GSvarHelper.h"
ExternalToolDialog::ExternalToolDialog(QString tool_name, QString mode, QWidget* parent)
: QDialog(parent)
, ui_()
, tool_name_(tool_name)
, mode_(mode)
{
ui_.setupUi(this);
setWindowTitle(tool_name);
if (mode!="")
{
ui_.type->setText("Mode: " + mode);
}
connect(ui_.browse, SIGNAL(clicked()), this, SLOT(browse()));
connect(ui_.browse_ngsd, SIGNAL(clicked()), this, SLOT(browse()));
ui_.browse_ngsd->setEnabled(LoginManager::active());
}
void ExternalToolDialog::browse()
{
ui_.output->clear();
QString output;
QTextStream stream(&output);
bool ngsd_instead_of_filesystem = sender()==ui_.browse_ngsd;
try
{
if (tool_name_ == "BED file information")
{
QString filename = getFileName(BED, ngsd_instead_of_filesystem);
if (filename=="") return;
//process
QApplication::setOverrideCursor(Qt::BusyCursor);
BedFile file;
file.load(filename);
QCCollection stats = Statistics::region(file, true);
QApplication::restoreOverrideCursor();
//output
stream << "Regions: " << stats.value("roi_fragments").toString()<< "<br>";
stream << "Bases: " << stats.value("roi_bases").toString(0)<< "<br>";
stream << "Chromosomes: " << stats.value("roi_chromosomes").toString()<< "<br>";
stream<< "<br>";
stream << "Is sorted: " << stats.value("roi_is_sorted").toString()<< "<br>";
stream << "Is merged: " << stats.value("roi_is_merged").toString()<< "<br>";
stream<< "<br>";
stream << "Fragment size (min): " << stats.value("roi_fragment_min").toString()<< "<br>";
stream << "Fragment size (max): " << stats.value("roi_fragment_max").toString()<< "<br>";
stream << "Fragment size (mean): " << stats.value("roi_fragment_mean").toString()<< "<br>";
stream << "Fragment size (stdev): " << stats.value("roi_fragment_stdev").toString()<< "<br>";
}
else if (tool_name_ == "Determine gender")
{
QString filename = getFileName(BAM, ngsd_instead_of_filesystem);
if (filename=="") return;
//process
QApplication::setOverrideCursor(Qt::BusyCursor);
GenderEstimate estimate;
if (mode_=="xy")
{
estimate = Statistics::genderXY(filename);
}
else if (mode_=="hetx")
{
estimate = Statistics::genderHetX(GSvarHelper::build(), filename);
}
else if (mode_=="sry")
{
estimate = Statistics::genderSRY(GSvarHelper::build(), filename);
}
QApplication::restoreOverrideCursor();
//output
foreach(auto info, estimate.add_info)
{
stream << info.key << ": " << info.value<< "<br>";
}
stream<< "<br>";
stream << "gender: " << estimate.gender<< "<br>";
}
else if (tool_name_ == "Sample similarity")
{
//get file names
FileType type = GSVAR;
if (mode_=="vcf") type = VCF;
if (mode_=="bam") type = BAM;
QString filename1 = getFileName(type, ngsd_instead_of_filesystem);
if (filename1=="") return;
QString filename2 = getFileName(type, ngsd_instead_of_filesystem);
if (filename2=="") return;
//process
QApplication::setOverrideCursor(Qt::BusyCursor);
if (mode_=="bam")
{
SampleSimilarity::VariantGenotypes geno1 = SampleSimilarity::genotypesFromBam(GSvarHelper::build(), filename1, 30, 500, false);
SampleSimilarity::VariantGenotypes geno2 = SampleSimilarity::genotypesFromBam(GSvarHelper::build(), filename2, 30, 500, false);
SampleSimilarity sc;
sc.calculateSimilarity(geno1, geno2);
stream << "Variants overlapping: " << QString::number(sc.olCount())<< "<br>";
stream << "Correlation: " << QString::number(sc.sampleCorrelation(), 'f', 4)<< "<br>";
}
else //VCF/GSvar
{
SampleSimilarity::VariantGenotypes geno1;
SampleSimilarity::VariantGenotypes geno2;
if (mode_=="vcf")
{
geno1 = SampleSimilarity::genotypesFromVcf(filename1, false, true);
geno2 = SampleSimilarity::genotypesFromVcf(filename2, false, true);
}
else
{
geno1 = SampleSimilarity::genotypesFromGSvar(filename1, false);
geno2 = SampleSimilarity::genotypesFromGSvar(filename2, false);
}
SampleSimilarity sc;
sc.calculateSimilarity(geno1, geno2);
stream << "Variants file1: " << QString::number(sc.noVariants1())<< "<br>";
stream << "Variants file2: " << QString::number(sc.noVariants2())<< "<br>";
stream << "Variants overlapping: " << QString::number(sc.olCount()) << " (" << sc.olPerc() << "%)"<< "<br>";
stream << "Correlation: " << QString::number(sc.sampleCorrelation(), 'f', 4)<< "<br>";
}
QApplication::restoreOverrideCursor();
stream<< "<br>";
stream << "For more information about the similarity scores see the <a href=\"https://github.com/imgag/ngs-bits/blob/master/doc/tools/SampleSimilarity/index.md\">documentation</a>." << "<br>";
stream << ""<< "<br>";
}
else if (tool_name_ == "Sample ancestry")
{
QString filename = getFileName(VCF, ngsd_instead_of_filesystem);
if (filename=="") return;
//process
QApplication::setOverrideCursor(Qt::BusyCursor);
AncestryEstimates ancestry = Statistics::ancestry(GSvarHelper::build(), filename);
stream << "Informative SNPs: " << QString::number(ancestry.snps)<< "<br>";
stream<< "<br>";
stream << "Correlation AFR: " << QString::number(ancestry.afr, 'f', 4)<< "<br>";
stream << "Correlation EUR: " << QString::number(ancestry.eur, 'f', 4)<< "<br>";
stream << "Correlation SAS: " << QString::number(ancestry.sas, 'f', 4)<< "<br>";
stream << "Correlation EAS: " << QString::number(ancestry.eas, 'f', 4)<< "<br>";
stream<< "<br>";
stream << "Population: " << ancestry.population<< "<br>";
QApplication::restoreOverrideCursor();
stream<< "<br>";
stream << "For more information about the population scores see the <a href=\"https://github.com/imgag/ngs-bits/blob/master/doc/tools/SampleAncestry/index.md\">documentation</a>." << "<br>";
}
else
{
THROW(ProgrammingException, "Unknown tool '" + tool_name_ + "' requested in ExternalToolDialog!");
}
}
catch(Exception& e)
{
QApplication::restoreOverrideCursor();
output = "Execution failed:\n" + e.message();
}
ui_.output->setHtml(output);
}
QString ExternalToolDialog::getFileName(FileType type, bool ngsd_instead_of_filesystem)
{
//prepare title
QString title = "";
if (type==BAM) title = "Select BAM file";
if (type==GSVAR) title = "Select single-sample GSvar file";
if (type==VCF) title = "Select single-sample VCF file";
if (type==BED) title = "Select BED file";
if (ngsd_instead_of_filesystem && type==BED) //BED not supported from NGSD
{
QMessageBox::information(this, title, "Please select BED file from file system!");
}
else if (ngsd_instead_of_filesystem) //from NGSD
{
ProcessedSampleSelector dlg(this, false);
if (dlg.exec()==QDialog::Accepted && dlg.isValidSelection())
{
QString ps_id = dlg.processedSampleId();
if (type==BAM) return GlobalServiceProvider::database().processedSamplePath(ps_id, PathType::BAM).filename;
if (type==GSVAR) return GlobalServiceProvider::database().processedSamplePath(ps_id, PathType::GSVAR).filename;
if (type==VCF) return GlobalServiceProvider::database().processedSamplePath(ps_id, PathType::VCF).filename;
}
}
else //from filesystem
{
//prepare filters
QStringList filters;
if (type==BAM) filters << "BAM files (*.bam *.cram)";
if (type==GSVAR) filters << "GSvar files (*.GSvar)";
if (type==VCF) filters << "VCF files (*.vcf *.vcf.gz)";
if (type==BED) filters << "BED files (*.bed)";
filters << "All files(*.*)";
QString open_path = Settings::path("path_variantlists", true);
QString file_name = QFileDialog::getOpenFileName(this, title, open_path, filters.join(";;"));
if (file_name!="")
{
Settings::setPath("path_variantlists", file_name);
return file_name;
}
}
return "";
}
|
3d0a3e32dbca9e86474c30eace860d0102dc7126 | ae9ca3bb98b24b4cb274dcf82f4bd015641b8cf8 | /include/CQChartsViewError.h | 0315cf43493fa6007f53c467225abae3f6142f5d | [
"MIT"
] | permissive | lineCode/CQCharts | 5748e9e379eff7dc0b288435c38c8cac65e4fbf2 | f128d46df8a92d8bcb1ea0867c1821aa2bb7e6ba | refs/heads/master | 2022-12-19T05:49:19.336982 | 2020-09-19T12:05:08 | 2020-09-19T12:05:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 577 | h | CQChartsViewError.h | #ifndef CQChartsViewError_H
#define CQChartsViewError_H
#include <QFrame>
#include <map>
class CQChartsView;
class CQChartsPlot;
class CQTabSplit;
class QTextBrowser;
/*!
* \brief Widget to show View/Plot errors
* \ingroup Charts
*/
class CQChartsViewError : public QFrame {
Q_OBJECT
public:
CQChartsViewError(CQChartsView *view);
void updatePlots();
QSize sizeHint() const override;
private:
using Texts = std::map<CQChartsPlot *, QTextBrowser *>;
CQChartsView* view_ { nullptr };
CQTabSplit* tab_ { nullptr };
Texts texts_;
};
#endif
|
ffce5257bec481eb5018c10c0d510268e2f1c5bc | 075af5b714733ac10309ee264df63567d1d86ec8 | /cpp/Drawable.cpp | c9b67c079a27520e2c793e83024f5b51a5f22e6f | [] | no_license | asdf6161/win_log_graphic | b5169d4656080b5e2e85a99c41757278df3175b8 | 8d8cd2b3f9a48c72a689cb3173f309fa02a16ab8 | refs/heads/master | 2020-05-01T11:47:44.821090 | 2019-07-02T17:20:42 | 2019-07-02T17:20:42 | 177,452,107 | 1 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 3,122 | cpp | Drawable.cpp | /*
* Drawable.cpp
*
* Created on: 17 мар. 2019 г.
* Author: yura
*/
/*
* How to use
* Create object
Drawable *dr = new Drawable();
Draw new windows or objects
and call dr->swap_buffers();
* */
#include <Drawable.h>
Drawable::Drawable() {
// TODO Auto-generated constructor stub
color.set_color(0x1F, 0, 0);
text_back_color.set_color(COLOR_MAX_R, COLOR_MAX_G, COLOR_MAX_B);
set_draw_color(color);
set_text_back_color(text_back_color);
init_font();
swap_buffers();
set_draw_color(color);
set_text_back_color(text_back_color);
init_font();
/*BSP_LCD_SelectLayer(1);
clear_display();
BSP_LCD_SelectLayer(0);
clear_display();
swap_buffers();*/
}
Drawable::~Drawable() {
// TODO Auto-generated destructor stub
}
void Drawable::draw_line(Point2d p1, Point2d p2){
BSP_LCD_DrawLine(p1.x, p1.y, p2.x, p2.y);
}
void Drawable::draw_point(Point2d p){
BSP_LCD_DrawPixel(p.x, p.y, color.get_color());
}
void Drawable::draw_rect(Point2d p1, x16 width, x16 height){
BSP_LCD_DrawRect(p1.x, p1.y, width, height);
}
void Drawable::draw_rect(x16 x, x16 y, x16 width, x16 height){
BSP_LCD_DrawRect(x, y, width, height);
}
void Drawable::draw_fill_rect(Point2d p1, x16 width, x16 height){
BSP_LCD_FillRect(p1.x, p1.y, width, height);
}
void Drawable::draw_fill_rect(x16 x, x16 y, x16 width, x16 height){
BSP_LCD_FillRect(x, y, width, height);
}
void Drawable::draw_polygon(Polygon *p){
BSP_LCD_DrawPolygon(convert_to_point(p), p->p_cnt);
}
void Drawable::draw_fill_polygon(Polygon *p){
BSP_LCD_FillPolygon(convert_to_point(p), p->p_cnt);
}
////////////////////////////////////////////////TEST////////////////////////
Point *convert_to_point(Polygon *p){
Point points[p->p_cnt];
for (uint8_t i = 0; i < p->p_cnt; ++i) {
points[i].X = p->points[i].x;
points[i].Y = p->points[i].y;
}
return points;
}
void Drawable::draw_text(unsigned char *text, Point2d pos){
BSP_LCD_DisplayStringAt(pos.x, pos.y, text, Text_AlignModeTypdef::LEFT_MODE);
}
void Drawable::clear_display(){
BSP_LCD_Clear(background_color.get_color());
}
void Drawable::set_draw_color(Color c){
color = c;
BSP_LCD_SetTextColor(color.get_color());
}
void Drawable::set_text_back_color(Color c){
text_back_color = c;
BSP_LCD_SetBackColor(text_back_color.get_color());
}
Color *Drawable::get_draw_color(){
return &color;
}
Color *Drawable::get_text_back_color(){
return &text_back_color;
}
void Drawable::swap_buffers(){
set_active_layer(active_layer);
active_layer ^= 1;
BSP_LCD_SelectLayer(active_layer);
clear_display();
}
void Drawable::set_active_layer(x8 layer){
if (layer == 1){
LTDC_Layer1->CFBAR = BUFFER1_ADDR;
LTDC->SRCR = LTDC_SRCR_VBR; // reload shadow registers on vertical blank
while ((LTDC->CDSR & LTDC_CDSR_VSYNCS) == 0){}
} else {
LTDC_Layer1->CFBAR = BUFFER0_ADDR;
LTDC->SRCR = LTDC_SRCR_VBR; // reload shadow registers on vertical blank
while ((LTDC->CDSR & LTDC_CDSR_VSYNCS) == 0){}
}
}
x8 Drawable::get_active_layer(){
return active_layer;
}
void Drawable::init_font(){
BSP_LCD_SetFont(&font);
}
|
2e85a624813ca1bb2b5fb10f5e4715f3ac24be44 | 7f95a7de14c1e2822950a6422d2f0e16ea5a5dbe | /eHTTP/httpParsing/httpUtils.cpp | 55ca62ae909176472c67e0bfd0480c32a4cdbfef | [] | no_license | SS-03-MAC/SS-03_MAC | 5a314847f3a53c3a9c0fdd2e32d8338b53a22375 | d6fb41f0e8db3311629b88f50fe1f9ce74b39a9e | refs/heads/master | 2021-08-31T15:00:35.981511 | 2017-12-21T19:53:46 | 2017-12-21T19:53:46 | 75,872,823 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,189 | cpp | httpUtils.cpp | //===-- eHTTP/httpParsing/httpUtils.cpp -------------------------*- C++ -*-===//
//
// eHTTP - Web Server with CGI
//
// This file is distributed under the MIT License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains utilities that are helpful for HTTP request and response
/// parsing.
///
//===----------------------------------------------------------------------===//
#include "httpUtils.h"
const char httpUtils::URI_EXTRA[] = {'!', '*', '\'', '(', ')', ','};
const char httpUtils::URI_PCHAR[] = {':', '@', '&', '=', '+'}; // and UCHAR
const char httpUtils::URI_UNSAFE[] = {'\127', ' ', '"', '#', '%', '<', '>'};// and CTL (0 through 31 and DEL(127))
const char httpUtils::URI_SAFE[] = {'$', '-', '_', '.'};
const char httpUtils::URL_RESERVED[] = {';', '/', '?', ':', '@', '&', '=', '+'};
char httpUtils::hexToChar(char c1, char c2) {
return (char) ((hexToInt(c1) << 4) + hexToInt(c2));
}
int httpUtils::hexToInt(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'a' && c <= 'f') {
return (c - 'a') + 10;
}
if (c >= 'A' && c <= 'F') {
return (c - 'A') + 10;
}
throw "Invalid hex character.";
}
bool httpUtils::charArrayContains(const char *c, int size, char search) {
for (int i = 0; i < size; i++) {
if (c[i] == search) {
return true;
}
}
return false;
}
std::string httpUtils::readToken(std::istream *in) {
std::stringstream out;
int read;
bool endOfToken = false;
ingestWSP(in);
do {
read = in->get();
if (read == EOF) {
endOfToken = true;
} else if (isWSP(read)) {
endOfToken = true;
} else {
out << (char) read;
}
} while (!endOfToken);
ingestWSP(in);
return out.str();
}
bool httpUtils::isQueryStringSafe(char c) {
return isUriUchar(c) || isUriReserved(c);
}
bool httpUtils::isUriSafe(char c) {
return charArrayContains(URI_SAFE, sizeof(URI_SAFE), c);
}
bool httpUtils::isUriUnsafe(char c) {
if (c < 32) {
return true;
}
for (unsigned int i = 0; i < sizeof(URI_UNSAFE); i++) {
if (c == URI_UNSAFE[i]) {
return true;
}
}
return false;
}
bool httpUtils::isUriReserved(char c) {
for (unsigned int i = 0; i < sizeof(URL_RESERVED); i++) {
if (c == URL_RESERVED[i]) {
return true;
}
}
return false;
}
bool httpUtils::isUriExtra(char c) {
return charArrayContains(URI_EXTRA, sizeof(URI_EXTRA), c);
}
bool httpUtils::isUriPchar(char c) {
return isUriUchar(c) || charArrayContains(URI_PCHAR, sizeof(URI_PCHAR), c);
}
bool httpUtils::isUriUchar(char c) {
// Warning: this is a partial check! The next two characters should be checked if it's escaped ('%').
return isUriUnreserved(c) || c == '%';
}
bool httpUtils::isUriUnreserved(char c) {
return isalnum(c) || isUriSafe(c) || isUriExtra(c) || isUriNational(c);
}
bool httpUtils::isUriNational(char c) {
return !(isalnum(c) || isUriReserved(c) || isUriExtra(c) || isUriSafe(c) || isUriUnsafe(c));
}
std::string httpUtils::uriDecode(std::string &uri) {
std::stringstream decoded;
for (unsigned int i = 0; i < uri.length(); i++) {
switch (uri[i]) {
case '%':
// Validate % HEX HEX
if (i + 2 < uri.length()) {
if (isxdigit(uri[i + 1]) && isxdigit(uri[i + 2])) {
char decodedChar = hexToChar(uri[i + 1], uri[i + 2]);
decoded << decodedChar;
i += 2;
break;
}
}
// Intentional flow to default case
default:decoded << uri[i];
}
}
return decoded.str();
}
std::string httpUtils::uriEncode(std::string &uri) {
std::stringstream out;
for (unsigned int i = 0; i < uri.length(); i++) {
if (isUriReserved(uri[i]) || isUriUnsafe(uri[i])) {
out << '%';
out << std::hex << (int) uri[i];
} else {
out << uri[i];
}
}
return out.str();
}
bool httpUtils::equalsCaseInsensitive(std::string &s1, std::string &s2) {
if (s1.size() != s2.size()) {
return false;
}
for (int i = 0; i < s1.size(); i++) {
if (tolower(s1[i]) != tolower(s2[i])) {
return false;
}
}
return true;
} |
f6c9b2af2f0ca9a4988ba716220b985a40156a8e | 0d17f83d284b5e1b114fd090d90f3ab9573deb74 | /src/SFilterEngine.cpp | 37f0ded8c83726e0ca2475a3e733c5e571b34f53 | [] | no_license | bagobor/ScIll-library | 7363596a3c98fa26d417dd08fdb0385e864bbe92 | 20e568f2a402a677e0b1a97909fa4d2429c5821c | refs/heads/master | 2021-01-18T00:08:42.473024 | 2013-07-15T23:01:56 | 2013-07-15T23:02:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,614 | cpp | SFilterEngine.cpp | /*
* SFilterEngine.cpp
*
* Created on: Feb 13, 2011
* Author: numb3r23
*/
#include "stdafx.h"
#include "SFilterEngine.h"
#include "CGLInfo.h"
int SciIllLib::SFilterEngine::m_width, SciIllLib::SFilterEngine::m_height;
int SciIllLib::SFilterEngine::m_widthOld, SciIllLib::SFilterEngine::m_heightOld;
GLuint SciIllLib::SFilterEngine::m_vao;
GLuint SciIllLib::SFilterEngine::m_vab[3];
GLuint SciIllLib::SFilterEngine::m_fbo, SciIllLib::SFilterEngine::m_depthTex;
SciIllLib::ATexture* SciIllLib::SFilterEngine::m_texDummy;
GLuint SciIllLib::SFilterEngine::m_rbo;
/**
* Construct a new instance, initialize width and height ...
*/
SciIllLib::SFilterEngine::SFilterEngine() {
}
SciIllLib::SFilterEngine::~SFilterEngine() {
glDeleteBuffers(3, &m_vab[0]);
glDeleteVertexArrays(1, &m_vao);
glDeleteRenderbuffers(1, &m_depthTex);
glDeleteFramebuffers(1, &m_fbo);
delete m_texDummy;
}
/**
* Initialize VBO/VAO for the creenaligned quad and generate Frame- and Renderbuffer
* @param width the current Viewport width
* @param height the current Viewport height
* @returns success?
*/
bool SciIllLib::SFilterEngine::Initialize(int width, int height)
{
m_texDummy = new ATexture(0);
m_width = -1;
m_height = -1;
m_widthOld = width;
m_heightOld = height;
//Something to draw...
float arrVertex[] = {
-1.0f, -1.0f,
1.0f, -1.0f,
1.0f, 1.0f,
-1.0f, 1.0f
};
float arrTexCoord[] =
{
0.0f, 0.0f,
1.0f, 0.0f,
1.0f, 1.0f,
0.0f, 1.0f
};
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
glGenBuffers(3, &m_vab[0]);
int idx = 0;
glBindBuffer(GL_ARRAY_BUFFER, m_vab[idx++]);
glBufferData(GL_ARRAY_BUFFER, 4 * 2 * sizeof(GLfloat), arrVertex, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, m_vab[idx++]);
glBufferData(GL_ARRAY_BUFFER, 4 * 2 * sizeof(GLfloat), arrTexCoord, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
//somewhere to draw to
glGenFramebuffers(1, &m_fbo);
glGenRenderbuffers(1, &m_depthTex);
SetSize(width, height);
return true;
}
/**
* Apply a filter sequence - as indicated by the missing parameters the functions is NOP
*/
void SciIllLib::SFilterEngine::ApplySequence()
{
}
/**
* Apply a pure filter
* @deprecated Use another Apply function!
* @param source the source TextureID
* @param target the target TextureID
*/
void SciIllLib::SFilterEngine::Apply(GLuint source, GLuint target)
{
ApplyPure(source, target);
}
void SciIllLib::SFilterEngine::Apply(SciIllLib::AFilter *shader, GLuint source, SciIllLib::ATexture *target, glm::vec4 clear){
//CGLInfo::CheckError("PreFilter");
PreRender(target);
glClearColor(clear.r, clear.g, clear.b, clear.a);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
//Clear(&clear);
ToScreen(shader, source);
/*
shader->bind();
shader->BindSampler(0, source);
DrawQuad();
shader->BindSampler(0, 0);
shader->release();
*/
PostRender();
//CGLInfo::CheckError("PostFilter");
}
/*
void SciIllLib::SFilterEngine::Apply(SciIllLib::AFilter *shader, SciIllLib::ATexture *source, SciIllLib::ATexture *target){
Apply(shader, source->GetID(), target);
}
void SciIllLib::SFilterEngine::Apply(SFilterCommon::Filter flt, ATexture* source, ATexture* target)
{
Apply(SFilterCommon::Get(flt), source, target);
}
*/
/**
* Prepare Multiple Rendering to Texture and set all Framebuffers and activate the Buffers
* @param count number of framebuffers/RenderTargets
* @param targets pointer to a textureID array
* @param buffers pointer to a bufferID array
*/
void SciIllLib::SFilterEngine::PreRender(int count, GLuint* targets, GLenum* buffers)
{
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
for (int i=0; i < count; i++)
glFramebufferTexture(GL_FRAMEBUFFER,buffers[i],targets[i], 0);
glDrawBuffers(count, buffers);
}
/**
* Prepare single Rendering to Texture and set all Framebuffers and activate the Buffers
* @param target the RenderTextures textureID
*/
void SciIllLib::SFilterEngine::PreRender(ATexture * target)
{
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glFramebufferTexture(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0, target->GetID(), 0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthTex);
glViewport(0.0, 0.0, target->GetWidth(), target->GetHeight());
}
void SciIllLib::SFilterEngine::PreRender(GLuint target)
{
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glFramebufferTexture(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0, target, 0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
}
/**
* Unset the Framebuffer
*/
void SciIllLib::SFilterEngine::PostRender()
{
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
/**
* Return the current width
*/
int SciIllLib::SFilterEngine::GetWidth()
{
return m_width;
}
/**
* Return the current height
*/
int SciIllLib::SFilterEngine::GetHeight()
{
return m_height;
}
/**
* Apply a pure filter
* @deprecated Use another Apply function!
* @param source the source TextureID
* @param target the target TextureID
*/
void SciIllLib::SFilterEngine::ApplyPure(GLuint source, GLuint target)
{
PreRender(target);
DrawQuad();
PostRender();
}
/**
* Bind the shaders from the Filter and filter the source texture to screen
* @param shader the filter that should be used
* @param texture the TextureID of the base image that is filtered
*/
void SciIllLib::SFilterEngine::ToScreen(AFilter* shader, GLuint texture)
{
shader->bind();
shader->BindSampler(0, texture);
DrawQuad();
shader->BindSampler(0, 0);
shader->release();
}
/**
* Bind the shaders from the Filter and filter the source texture to screen
* @param shader the filter that should be used
* @param texture the TextureID of the base image that is filtered
void SciIllLib::SFilterEngine::ToScreen(SFilterCommon::Filter flt, ATexture* texture)
{
ToScreen(SFilterCommon::Get(flt), texture->GetID());
}
*/
/**
* Bind the shaders from the Filter and filter the source texture to screen
* @param shader the filter that should be used
* @param texture the TextureID of the base image that is filtered
void SciIllLib::SFilterEngine::ToScreen(AFilter* shader, ATexture* texture)
{
ToScreen(shader, texture->GetID());
}
*/
/**
* Bind the shaders from the Filter and filter to screen.
* The Filter should have the textures already assigned!
* @param shader the filter that should be used
*/
void SciIllLib::SFilterEngine::ToScreen(AFilter* shader)
{
shader->bind();
DrawQuad();
shader->release();
}
/**
* Apply a filter and filter the source into the target. Clear with color (0, 0, 0, 0)!
* @param shader the filter that should be used
* @param source the TextureID of the base image
* @param target the TextureID of the target image
void SciIllLib::SFilterEngine::Apply(AFilter* shader, GLuint source, GLuint target)
{
PreRender(target);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
ToScreen(shader, source);
PostRender();
}
*/
/**
* Apply a filter and filter the source into the target, Use the assigned clearcolor
* @param shader the filter that should be used
* @param source the TextureID of the base image
* @param target the TextureID of the target image
* @param color use this color for clearing before rendering
void SciIllLib::SFilterEngine::Apply(AFilter* shader, GLuint source, GLuint target, glm::vec4 clear)
{
PreRender(target);
glClearColor(clear.r, clear.g, clear.b, clear.a);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
ToScreen(shader, source);
PostRender();
}
*/
/**
* Set the Rendertarget, clear with color (0, 0, 0, 0) and render a screen-aligned-quad
* @param target the TextureID of the target image
*/
void SciIllLib::SFilterEngine::Filter(GLuint target)
{
//used by APostProcessor
//draws a ScreenAlignedQuad in a texture; clears the FB first
PreRender(target);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawQuad();
PostRender();
}
/**
* Set the Rendertarget, clear with the assigned color and render a screen-aligned-quad
* @param target the TextureID of the target image
* @param color use this color for clearing before rendering
*/
void SciIllLib::SFilterEngine::Filter(GLuint target, GLfloat* color)
{
//used by APostProcessor
//draws a ScreenAlignedQuad in a texture; clears the FB first
PreRender(target);
glClearColor(color[0], color[1], color[2], color[3]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawQuad();
PostRender();
}
/**
* Draw a screen-aligned-quad (using a trinagle fan if anyone cares)
*/
void SciIllLib::SFilterEngine::DrawQuad()
{
glBindVertexArray(m_vao);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
/**
* Resize the Viewport means resize all reandertargets
* @param width the viewport width
* @param height the viewport height
*/
void SciIllLib::SFilterEngine::SetSize(int width, int height)
{
if ((width == m_width) && (height == m_height))
return;
m_widthOld = m_width;
m_heightOld = m_height;
m_width = width;
m_height = height;
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glBindRenderbuffer(GL_RENDERBUFFER, m_depthTex);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32F ,m_width, m_height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthTex);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void SciIllLib::SFilterEngine::SetSizeOld()
{
SetSize(m_widthOld, m_heightOld);
}
void SciIllLib::SFilterEngine::ReCreateDepthBuffer(GLuint* rboId, int width, int height){
if (*rboId > 0)
glDeleteRenderbuffers(1, rboId);
*rboId = 0;
glGenRenderbuffers(1, rboId);
glBindRenderbuffer(GL_RENDERBUFFER, *rboId);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
/**
* (Re)Generate a Texture (possible use: RenderTarget) with the specified type, if oldTex is !+= 0 the texture is deleted first
* @param oldTex a pointer to the old & new TextureID
* @param type Specifies the data type of the pixel data. If set to GL_FLOAT, use GL_RGBA32F for internal format, otherwise GL_RGBA8
*/
void SciIllLib::SFilterEngine::ReGenerateTexture(GLuint*oldTex, GLenum type)
{
GLint intFormat = GL_RGBA8;
if (type == GL_FLOAT)
intFormat = GL_RGBA32F;
ReGenerateTexture(oldTex, intFormat, type);
}
/**
* Generate a Texture (possible use: RenderTarget) with the specified type, if oldTex is !+= 0 the texture is deleted first
* @param oldTex a pointer to the old & new TextureID
* @param format Specifies the number of color components in the texture.
* @param type Specifies the data type of the pixel data.
*/
void SciIllLib::SFilterEngine::ReGenerateTexture(GLuint*oldTex, GLenum format, GLenum type)
{
DeleteTexture(oldTex);
glGenTextures(1, oldTex);
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); // switch to the new framebuffer
// initialize color texture
glBindTexture(GL_TEXTURE_2D, *oldTex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, format, m_width, m_height, 0,GL_RGBA, type, NULL);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_FRAMEBUFFER, 0); // Swithch back to normal framebuffer rendering
}
/**
* (Re)Generate a Texture (possible use: RenderTarget) with the specified type, if oldTex is !+= 0 the texture is deleted first.
* Use the specified size!
* @param oldTex a pointer to the old & new TextureID
* @param type Specifies the data type of the pixel data. If set to GL_FLOAT, use GL_RGBA32F for internal format, otherwise GL_RGBA8
* @param width width of the texture
* @param height height of the texture
*/
void SciIllLib::SFilterEngine::ReGenerateTextureSize(GLuint*oldTex, GLenum type, int width, int height)
{
GLint intFormat = GL_RGBA8;
if (type == GL_FLOAT)
intFormat = GL_RGBA32F;
ReGenerateTextureSize(oldTex, intFormat, type, width, height);
}
/**
* Generate a Texture (possible use: RenderTarget) with the specified type, if oldTex is !+= 0 the texture is deleted first
* Use the specified size!
* @param oldTex a pointer to the old & new TextureID
* @param format Specifies the number of color components in the texture.
* @param type Specifies the data type of the pixel data.
* @param width width of the texture
* @param height height of the texture
*/
void SciIllLib::SFilterEngine::ReGenerateTextureSize(GLuint*oldTex, GLenum format, GLenum type, int width, int height)
{
DeleteTexture(oldTex);
glGenTextures(1, oldTex);
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); // switch to the new framebuffer
// initialize color texture
glBindTexture(GL_TEXTURE_2D, *oldTex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0,GL_RGBA, type, NULL);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_FRAMEBUFFER, 0); // Swithch back to normal framebuffer rendering
}
/**
* Delete the texture if the ID is > 0
* @param oldTex a pointer to the old TextureID
*/
void SciIllLib::SFilterEngine::DeleteTexture(GLuint* oldTex)
{
if (*oldTex > 0)
glDeleteTextures(1, oldTex);
*oldTex = 0;
}
SciIllLib::ATexture* SciIllLib::SFilterEngine::DummyTexture(){
return m_texDummy;
}
|
3c12555f6ad455b73879552d433734bd1cf1c766 | e2d31e3754624eeb0a2dace8691c5c25ed3b988e | /runtime/RHI/Vulkan/Vulkan_SwapChain.cpp | 76d91697993b0cb5952b36502f0d067e3ca976e9 | [
"MIT"
] | permissive | PanosK92/SpartanEngine | da7950d3e5a673b3fd7881c6e9370d84c8e361a1 | 9cf38d84c344dad43a2cb45f018914f7504f1047 | refs/heads/master | 2023-09-01T09:01:47.784814 | 2023-08-24T09:42:53 | 2023-08-24T09:42:53 | 61,415,047 | 1,655 | 169 | MIT | 2023-09-11T15:08:52 | 2016-06-18T03:27:49 | C++ | UTF-8 | C++ | false | false | 22,144 | cpp | Vulkan_SwapChain.cpp | /*
Copyright(c) 2016-2023 Panos Karabelas
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.
*/
//= INCLUDES =====================
#include "pch.h"
#include "Window.h"
#include "../RHI_Device.h"
#include "../RHI_SwapChain.h"
#include "../RHI_Implementation.h"
#include "../RHI_Semaphore.h"
#include "../RHI_CommandPool.h"
#include "../Display/Display.h"
SP_WARNINGS_OFF
#include <SDL_vulkan.h>
SP_WARNINGS_ON
//================================
//= NAMESPACES ===============
using namespace std;
using namespace Spartan::Math;
//============================
namespace Spartan
{
namespace
{
static VkColorSpaceKHR get_color_space(bool is_hdr)
{
// VK_COLOR_SPACE_HDR10_ST2084_EXT represents the HDR10 color space with the ST.2084 (PQ)electro - optical transfer function.
// This is the most common HDR format used for HDR TVs and monitors.
// VK_COLOR_SPACE_SRGB_NONLINEAR_KHR represents the sRGB color space.
// This is the standard color space for the web and is supported by most modern displays.
// sRGB is a nonlinear color space, which means that the values stored in an image are not directly proportional to the perceived brightness of the colors.
// When displaying an image in sRGB, the values must be converted to linear space before they are displayed.
return is_hdr ? VK_COLOR_SPACE_HDR10_ST2084_EXT : VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
}
static VkSurfaceCapabilitiesKHR get_surface_capabilities(const VkSurfaceKHR surface)
{
VkSurfaceCapabilitiesKHR surface_capabilities;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(RHI_Context::device_physical, surface, &surface_capabilities);
return surface_capabilities;
}
static vector<VkPresentModeKHR> get_supported_present_modes(const VkSurfaceKHR surface)
{
uint32_t present_mode_count;
vkGetPhysicalDeviceSurfacePresentModesKHR(RHI_Context::device_physical, surface, &present_mode_count, nullptr);
vector<VkPresentModeKHR> surface_present_modes(present_mode_count);
vkGetPhysicalDeviceSurfacePresentModesKHR(RHI_Context::device_physical, surface, &present_mode_count, &surface_present_modes[0]);
return surface_present_modes;
}
static VkPresentModeKHR get_present_mode(const VkSurfaceKHR surface, const RHI_Present_Mode present_mode)
{
// Convert RHI_Present_Mode to VkPresentModeKHR
VkPresentModeKHR vk_present_mode = VK_PRESENT_MODE_FIFO_KHR;
if (present_mode == RHI_Present_Mode::Immediate)
{
vk_present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
}
else if (present_mode == RHI_Present_Mode::Mailbox)
{
vk_present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
}
// Return the present mode as is if the surface supports it
vector<VkPresentModeKHR> surface_present_modes = get_supported_present_modes(surface);
for (const VkPresentModeKHR supported_present_mode : surface_present_modes)
{
if (vk_present_mode == supported_present_mode)
{
return vk_present_mode;
}
}
// At this point we call back to VK_PRESENT_MODE_FIFO_KHR, which as per spec is always present
SP_LOG_WARNING("Requested present mode is not supported. Falling back to VK_PRESENT_MODE_FIFO_KHR");
return VK_PRESENT_MODE_FIFO_KHR;
}
static vector<VkSurfaceFormatKHR> get_supported_surface_formats(const VkSurfaceKHR surface)
{
uint32_t format_count;
SP_VK_ASSERT_MSG(vkGetPhysicalDeviceSurfaceFormatsKHR(RHI_Context::device_physical, surface, &format_count, nullptr),
"Failed to get physical device surface format count");
vector<VkSurfaceFormatKHR> surface_formats(format_count);
SP_VK_ASSERT_MSG(vkGetPhysicalDeviceSurfaceFormatsKHR(RHI_Context::device_physical, surface, &format_count, &surface_formats[0]),
"Failed to get physical device surfaces");
return surface_formats;
}
static bool is_format_and_color_space_supported(const VkSurfaceKHR surface, RHI_Format* format, VkColorSpaceKHR color_space)
{
// Get supported surface formats
vector<VkSurfaceFormatKHR> supported_formats = get_supported_surface_formats(surface);
// NV supports RHI_Format::B8R8G8A8_Unorm instead of RHI_Format::R8G8B8A8_Unorm.
if ((*format) == RHI_Format::R8G8B8A8_Unorm && RHI_Device::GetPrimaryPhysicalDevice()->IsNvidia())
{
(*format) = RHI_Format::B8R8G8A8_Unorm;
}
for (const VkSurfaceFormatKHR& supported_format : supported_formats)
{
bool support_format = supported_format.format == vulkan_format[rhi_format_to_index(*format)];
bool support_color_space = supported_format.colorSpace == color_space;
if (support_format && support_color_space)
return true;
}
return false;
}
static VkCompositeAlphaFlagBitsKHR get_supported_composite_alpha_format(const VkSurfaceKHR surface)
{
vector<VkCompositeAlphaFlagBitsKHR> composite_alpha_flags =
{
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
};
// Get physical device surface capabilities
VkSurfaceCapabilitiesKHR surface_capabilities;
SP_VK_ASSERT_MSG(
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(RHI_Context::device_physical, surface, &surface_capabilities),
"Failed to get surface capabilities");
// Simply select the first composite alpha format available
for (VkCompositeAlphaFlagBitsKHR& composite_alpha : composite_alpha_flags)
{
if (surface_capabilities.supportedCompositeAlpha & composite_alpha)
{
return composite_alpha;
};
}
return VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
}
}
RHI_SwapChain::RHI_SwapChain(
void* sdl_window,
const uint32_t width,
const uint32_t height,
const RHI_Present_Mode present_mode,
const uint32_t buffer_count,
const char* name
)
{
SP_ASSERT_MSG(RHI_Device::IsValidResolution(width, height), "Invalid resolution");
// Copy parameters
m_format = format_sdr; // for now, we use SDR by default as HDR doesn't look rigth - Display::GetHdr() ? format_hdr : format_sdr;
m_buffer_count = buffer_count;
m_width = width;
m_height = height;
m_sdl_window = sdl_window;
m_object_name = name;
m_present_mode = present_mode;
Create();
AcquireNextImage();
SP_SUBSCRIBE_TO_EVENT(EventType::WindowResized, SP_EVENT_HANDLER(ResizeToWindowSize));
SP_SUBSCRIBE_TO_EVENT(EventType::WindowFullscreen, SP_EVENT_HANDLER(ResizeToWindowSize));
}
RHI_SwapChain::~RHI_SwapChain()
{
Destroy();
}
void RHI_SwapChain::Create()
{
SP_ASSERT(m_sdl_window != nullptr);
// Create surface
VkSurfaceKHR surface = nullptr;
{
SP_ASSERT_MSG(
SDL_Vulkan_CreateSurface(static_cast<SDL_Window*>(m_sdl_window), RHI_Context::instance, &surface),
"Failed to created window surface");
VkBool32 present_support = false;
SP_VK_ASSERT_MSG(vkGetPhysicalDeviceSurfaceSupportKHR(
RHI_Context::device_physical,
RHI_Device::GetQueueIndex(RHI_Queue_Type::Graphics),
surface,
&present_support),
"Failed to get physical device surface support");
SP_ASSERT_MSG(present_support, "The device does not support this kind of surface");
}
// Get surface capabilities
VkSurfaceCapabilitiesKHR capabilities = get_surface_capabilities(surface);
// Ensure that the surface supports the requested format and color space
VkColorSpaceKHR color_space = get_color_space(IsHdr());
SP_ASSERT_MSG(is_format_and_color_space_supported(surface, &m_format, color_space), "The surface doesn't support the requested format");
// Clamp size between the supported min and max
m_width = Math::Helper::Clamp(m_width, capabilities.minImageExtent.width, capabilities.maxImageExtent.width);
m_height = Math::Helper::Clamp(m_height, capabilities.minImageExtent.height, capabilities.maxImageExtent.height);
// Swap chain
VkSwapchainKHR swap_chain;
{
VkSwapchainCreateInfoKHR create_info = {};
create_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
create_info.surface = surface;
create_info.minImageCount = m_buffer_count;
create_info.imageFormat = vulkan_format[rhi_format_to_index(m_format)];
create_info.imageColorSpace = color_space;
create_info.imageExtent = { m_width, m_height };
create_info.imageArrayLayers = 1;
create_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; // fer rendering on it
create_info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; // for blitting to it
uint32_t queueFamilyIndices[] = { RHI_Device::GetQueueIndex(RHI_Queue_Type::Compute), RHI_Device::GetQueueIndex(RHI_Queue_Type::Graphics) };
if (queueFamilyIndices[0] != queueFamilyIndices[1])
{
create_info.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
create_info.queueFamilyIndexCount = 2;
create_info.pQueueFamilyIndices = queueFamilyIndices;
}
else
{
create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
create_info.queueFamilyIndexCount = 0;
create_info.pQueueFamilyIndices = nullptr;
}
create_info.preTransform = capabilities.currentTransform;
create_info.compositeAlpha = get_supported_composite_alpha_format(surface);
create_info.presentMode = get_present_mode(surface, m_present_mode);
create_info.clipped = VK_TRUE;
create_info.oldSwapchain = nullptr;
SP_VK_ASSERT_MSG(vkCreateSwapchainKHR(RHI_Context::device, &create_info, nullptr, &swap_chain),
"Failed to create swapchain");
}
// Images
{
uint32_t image_count = 0;
SP_VK_ASSERT_MSG(vkGetSwapchainImagesKHR(RHI_Context::device, swap_chain, &image_count, nullptr), "Failed to get swapchain image count");
SP_VK_ASSERT_MSG(vkGetSwapchainImagesKHR(RHI_Context::device, swap_chain, &image_count, reinterpret_cast<VkImage*>(m_rhi_rt.data())), "Failed to get swapchain image count");
// Transition layouts to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
if (RHI_CommandList* cmd_list = RHI_Device::ImmediateBegin(RHI_Queue_Type::Graphics))
{
for (uint32_t i = 0; i < m_buffer_count; i++)
{
cmd_list->InsertMemoryBarrierImage(
m_rhi_rt[i],
VK_IMAGE_ASPECT_COLOR_BIT,
0,
1,
1,
RHI_Image_Layout::Undefined,
RHI_Image_Layout::Color_Attachment_Optimal
);
m_layouts[i] = RHI_Image_Layout::Color_Attachment_Optimal;
}
// End/flush
RHI_Device::ImmediateSubmit(cmd_list);
}
}
// image views
{
for (uint32_t i = 0; i < m_buffer_count; i++)
{
RHI_Device::SetResourceName(m_rhi_rt[i], RHI_Resource_Type::Texture, string(string("swapchain_image_") + to_string(i)));
VkImageViewCreateInfo create_info = {};
create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
create_info.image = static_cast<VkImage>(m_rhi_rt[i]);
create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
create_info.format = vulkan_format[rhi_format_to_index(m_format)];
create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
create_info.subresourceRange.baseMipLevel = 0;
create_info.subresourceRange.levelCount = 1;
create_info.subresourceRange.baseArrayLayer = 0;
create_info.subresourceRange.layerCount = 1;
create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
SP_ASSERT_MSG(vkCreateImageView(RHI_Context::device, &create_info, nullptr, reinterpret_cast<VkImageView*>(&m_rhi_rtv[i])) == VK_SUCCESS, "Failed to create swapchain RTV");
}
}
m_rhi_surface = static_cast<void*>(surface);
m_rhi_swapchain = static_cast<void*>(swap_chain);
// Semaphores
for (uint32_t i = 0; i < m_buffer_count; i++)
{
string name = (string("swapchain_image_acquired_") + to_string(i));
m_acquire_semaphore[i] = make_shared<RHI_Semaphore>(false, name.c_str());
}
}
void RHI_SwapChain::Destroy()
{
for (void* image_view : m_rhi_rtv)
{
if (image_view)
{
RHI_Device::DeletionQueue_Add(RHI_Resource_Type::TextureView, image_view);
}
}
m_rhi_rtv.fill(nullptr);
m_acquire_semaphore.fill(nullptr);
RHI_Device::QueueWaitAll();
vkDestroySwapchainKHR(RHI_Context::device, static_cast<VkSwapchainKHR>(m_rhi_swapchain), nullptr);
m_rhi_swapchain = nullptr;
vkDestroySurfaceKHR(RHI_Context::instance, static_cast<VkSurfaceKHR>(m_rhi_surface), nullptr);
m_rhi_surface = nullptr;
}
void RHI_SwapChain::Resize(const uint32_t width, const uint32_t height, const bool force /*= false*/)
{
SP_ASSERT(RHI_Device::IsValidResolution(width, height));
// Only resize if needed
if (!force)
{
if (m_width == width && m_height == height)
return;
}
// Save new dimensions
m_width = width;
m_height = height;
// Reset image index
m_image_index = numeric_limits<uint32_t>::max();
m_image_index_previous = m_image_index;
Destroy();
Create();
AcquireNextImage();
SP_LOG_INFO("Resolution has been set to %dx%d", width, height);
}
void RHI_SwapChain::ResizeToWindowSize()
{
Resize(Window::GetWidth(), Window::GetHeight());
}
void RHI_SwapChain::AcquireNextImage()
{
// This is a blocking function, it will stop execution until an image becomes available
constexpr uint64_t timeout = numeric_limits<uint64_t>::max();
// Return if the swapchain has a single buffer and it has already been acquired
if (m_buffer_count == 1 && m_image_index != numeric_limits<uint32_t>::max())
return;
// Get signal semaphore
m_sync_index = (m_sync_index + 1) % m_buffer_count;
RHI_Semaphore* signal_semaphore = m_acquire_semaphore[m_sync_index].get();
// Ensure semaphore state
SP_ASSERT_MSG(signal_semaphore->GetStateCpu() != RHI_Sync_State::Submitted, "The semaphore is already signaled");
m_image_index_previous = m_image_index;
// Acquire next image
SP_VK_ASSERT_MSG(vkAcquireNextImageKHR(
RHI_Context::device, // device
static_cast<VkSwapchainKHR>(m_rhi_swapchain), // swapchain
timeout, // timeout
static_cast<VkSemaphore>(signal_semaphore->GetRhiResource()), // signal semaphore
nullptr, // signal fence
&m_image_index // pImageIndex
), "Failed to acquire next image");
// Update semaphore state
signal_semaphore->SetStateCpu(RHI_Sync_State::Submitted);
}
void RHI_SwapChain::Present()
{
SP_ASSERT_MSG(!(SDL_GetWindowFlags(static_cast<SDL_Window*>(m_sdl_window)) & SDL_WINDOW_MINIMIZED), "Present should not be called for a minimized window");
SP_ASSERT_MSG(m_rhi_swapchain != nullptr, "Invalid swapchain");
SP_ASSERT_MSG(m_image_index != m_image_index_previous, "No image was acquired");
SP_ASSERT_MSG(m_layouts[m_image_index] == RHI_Image_Layout::Present_Src, "Invalid layout");
// Get the semaphores that present should wait for
m_wait_semaphores.clear();
{
// Semaphores which are signaled when command lists have finished executing
for (const shared_ptr<RHI_CommandPool>& cmd_pool : RHI_Device::GetCommandPools())
{
// The editor supports multiple windows, so we can be dealing with multiple swapchains
if (m_object_id == cmd_pool->GetSwapchainId())
{
RHI_Semaphore* semaphore_cmd_list = cmd_pool->GetCurrentCommandList()->GetSemaphoreProccessed();
if (semaphore_cmd_list->GetStateCpu() == RHI_Sync_State::Submitted)
{
m_wait_semaphores.emplace_back(semaphore_cmd_list);
}
}
}
SP_ASSERT_MSG(!m_wait_semaphores.empty(), "Present() present should not be called if no work is to be presented");
// Semaphore that's signaled when the image is acquired
RHI_Semaphore* semaphore_image_aquired = m_acquire_semaphore[m_sync_index].get();
SP_ASSERT(semaphore_image_aquired->GetStateCpu() == RHI_Sync_State::Submitted);
m_wait_semaphores.emplace_back(semaphore_image_aquired);
}
RHI_Device::QueuePresent(m_rhi_swapchain, &m_image_index, m_wait_semaphores);
AcquireNextImage();
}
void RHI_SwapChain::SetLayout(const RHI_Image_Layout& layout, RHI_CommandList* cmd_list)
{
if (m_layouts[m_image_index] == layout)
return;
cmd_list->InsertMemoryBarrierImage(
m_rhi_rt[m_image_index],
VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 1,
m_layouts[m_image_index],
layout
);
m_layouts[m_image_index] = layout;
}
void RHI_SwapChain::SetHdr(const bool enabled)
{
if (enabled)
{
SP_ASSERT_MSG(Display::GetHdr(), "This display doesn't support HDR");
}
RHI_Format new_format = enabled ? format_hdr : format_sdr;
if (new_format != m_format)
{
m_format = new_format;
Resize(m_width, m_height, true);
SP_LOG_INFO("HDR has been %s", enabled ? "enabled" : "disabled");
}
}
void RHI_SwapChain::SetVsync(const bool enabled)
{
// For v-sync, we could Mailbox for lower latency, but Fifo is always supported, so we'll assume that
if ((m_present_mode == RHI_Present_Mode::Fifo) != enabled)
{
m_present_mode = enabled ? RHI_Present_Mode::Fifo : RHI_Present_Mode::Immediate;
Resize(m_width, m_height, true);
Timer::OnVsyncToggled(enabled);
SP_LOG_INFO("VSync has been %s", enabled ? "enabled" : "disabled");
}
}
bool RHI_SwapChain::GetVsync()
{
// For v-sync, we could Mailbox for lower latency, but Fifo is always supported, so we'll assume that
return m_present_mode == RHI_Present_Mode::Fifo;
}
RHI_Image_Layout RHI_SwapChain::GetLayout() const
{
return m_layouts[m_image_index];
}
}
|
cdadca6b31c5c1b6f15669fd651d0f77b1ae91c6 | 7f4297c06da8509969ff2a5f9f246f59525ce52d | /LeshkovAV/Data/Data/Data.cpp | aa8f29cd5bb91a7fa54c562bd4e04d208a4650cd | [] | no_license | bugslayer312/StudentHomeworks | ab1fcfc84681a58dc236c9d8f965f7295fc4737f | ab4fc6c320f28b3f04fbb18af4efaaec8b37bcc2 | refs/heads/master | 2021-01-20T04:50:13.785101 | 2017-07-12T21:29:47 | 2017-07-12T21:29:47 | 89,739,092 | 2 | 15 | null | 2017-07-17T11:48:24 | 2017-04-28T19:38:50 | C++ | UTF-8 | C++ | false | false | 732 | cpp | Data.cpp | #include "stdafx.h"
#include "Data.h"
#include <cstdlib>
#include <cstring>
#include <iostream>
struct Data* CreateData(char const* name, int salary)
{
struct Data* result = (struct Data*)malloc(sizeof(struct Data));
strncpy(result->Name, name, 20);
result->Salary = salary;
return result;
}
struct Data* ReadData()
{
struct Data* result = (struct Data*)malloc(sizeof(struct Data));
std::cout << "Enter name and salary" << std::endl;
std::cin >> result->Name >> result->Salary;
return result;
}
void PrintData(struct Data* data)
{
std::cout << "Name: " << data->Name << ", Salary: " << data->Salary << std::endl;
}
int CompareByName(const struct Data* d1, const struct Data* d2)
{
return strcmp(d1->Name, d2->Name);
} |
48f619646493cd4751923ebdd1ef8fef946cb088 | 39687a63b28378681f0309747edaaf4fb465c034 | /examples/04-fileIO_String/Mesh_io/include/gotools_core/BoundingBox.h | c406e88a5c382b6bedf67aab50e6e07e801b54b2 | [] | no_license | aldongqing/jjcao_code | 5a65ac654c306b96f0892eb20746b17276aa56e4 | 3b04108ed5c24f22899a31b0ee50ee177a841828 | refs/heads/master | 2021-01-18T11:35:25.515882 | 2015-10-29T01:52:33 | 2015-10-29T01:52:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,650 | h | BoundingBox.h | //===========================================================================
// GoTools - SINTEF Geometry Tools version 1.0.1
//
// GoTools module: CORE
//
// Copyright (C) 2000-2005 SINTEF ICT, Applied Mathematics, Norway.
//
// 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 version 2 of the 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
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc.,
// 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
// Contact information: e-mail: tor.dokken@sintef.no
// SINTEF ICT, Department of Applied Mathematics,
// P.O. Box 124 Blindern,
// 0314 Oslo, Norway.
//
// Other licenses are also available for this software, notably licenses
// for:
// - Building commercial software.
// - Building software whose source code you wish to keep private.
//===========================================================================
#ifndef _GOBOUNDINGBOX_H
#define _GOBOUNDINGBOX_H
#include "Point.h"
#include <vector>
namespace Go
{
///\addtogroup utils
///\{
/** Axis-aligned bounding box.
* A BoundingBox object can be an axis-aligned box in any
* number of dimensions.
*/
class BoundingBox
{
public:
/// The default constructor makes an
/// uninitialized object, with dimension zero.
BoundingBox() : valid_(false) {}
/// Creates a BoundingBox of the specified dimension,
/// but apart from that still uninitialized.
explicit BoundingBox(int dim)
: low_(dim), high_(dim), valid_(false) {}
/// Creates a BoundingBox with the Point low specifying
/// the lower bound in all dimensions and high specifying
/// the upper bound.
BoundingBox(const Point& low, const Point& high)
: low_(low), high_(high), valid_(false) { check(); }
/// Do not inherit from this class -- nonvirtual destructor.
~BoundingBox();
/// Makes the bounding box have lower bounds as specified in low
/// and upper bounds as specified in high.
void setFromPoints(const Point& low, const Point& high);
/// Given an array of dim-dimensional points stored as doubles
/// or floats, makes the smallest bounding box containing all
/// points in the array.
template <typename FloatType>
void setFromArray(const FloatType* start, const FloatType* end, int dim)
{
low_ = Point(start, start+dim);
high_ = Point(start, start+dim);
start += dim;
while (start != end) {
for (int d = 0; d < dim; ++d) {
if (start[d] < low_[d]) {
low_[d] = start[d];
} else if (start[d] > high_[d]) {
high_[d] = start[d];
}
}
start += dim;
}
check();
}
/// Given an array of dim-dimensional points stored as doubles
/// or floats, makes the smallest bounding box containing all
/// points in the array.
template <typename ForwardIterator>
void setFromArray(ForwardIterator start,
ForwardIterator end, int dim)
{
low_ = Point(start, start+dim);
high_ = Point(start, start+dim);
start += dim;
while (start != end) {
for (int d = 0; d < dim; ++d) {
if (start[d] < low_[d]) {
low_[d] = start[d];
} else if (start[d] > high_[d]) {
high_[d] = start[d];
}
}
start += dim;
}
check();
}
/// Given a vector of dim-dimensional points, makes the smallest
/// bounding box containing all points in the array.
void setFromPoints(const std::vector<Point>& points)
{
int dim = points[0].dimension();
low_ = points[0];
high_ = points[0];
for (size_t i = 1; i < points.size(); ++i) {
for (int d = 0; d < dim; ++d) {
if (points[i][d] < low_[d]) {
low_[d] = points[i][d];
} else if (points[i][d] > high_[d]) {
high_[d] = points[i][d];
}
}
}
check();
}
/// Read a bounding box from a standard istream.
void read(std::istream& is);
/// Write a bounding box to a standard ostream.
void write(std::ostream& os) const;
/// The dimension of the bounding box.
int dimension() const { return low_.size(); }
/// The lower bound of the bounding box.
const Point& low() const { return low_; }
/// The upper bound of the bounding box.
const Point& high() const { return high_; }
/// Returns true if the point pt is inside the
/// box, or within tol of the boundary.
bool containsPoint(const Point& pt, double tol = 0.0) const;
/// Returns true if the two boxes overlap, or are a
/// distance less than tol apart.
bool overlaps(const BoundingBox& box, double tol = 0.0) const;
bool getOverlap(const BoundingBox& box, double& overlap, double tol = 0.0) const;
/// Returns true if this box contain the box passed as a parameter,
/// if enlarged by tol in all directions.
bool containsBox(const BoundingBox& box, double tol = 0.0) const;
/// After the call, the bounding box will contain
/// both this box and the given point.
void addUnionWith(const Point& pt);
/// After the call, the bounding box will contain
/// both initial boxes.
void addUnionWith(const BoundingBox& box);
/// Is the bounding box initialized?
bool valid() const { return valid_; }
/// Check that box validity.
/// Call valid() to find out if check succeeded.
void check() const;
private:
// Data members
Point low_;
Point high_;
mutable bool valid_;
};
///\}
} // namespace Go
///\}
namespace std {
///\addtogroup utils
///\{
/// Read BoundingBox from input stream
inline std::istream& operator >> (std::istream& is,
Go::BoundingBox& bbox)
{
bbox.read(is);
return is;
}
/// Write BoundingBox to output stream
inline std::ostream& operator << (std::ostream& os,
const Go::BoundingBox& bbox)
{
bbox.write(os);
return os;
}
///\}
} // namespace std
#endif // _GOBOUNDINGBOX_H
|
f3436d8845751f79a024995786070a03b65064c3 | 8861315906a090ca59c848f30898737d08565504 | /Async-Finish/src/task.cpp | cc28352de355482fb9297dc45096c8e256d9f9b0 | [] | no_license | Anunay-Yadav/Practice-Temp | 427e1a27740e3c0516b04ca0aeb5148252914190 | 6f3afdc9c9fa436100c4b6242670f979e7e8c265 | refs/heads/main | 2023-05-13T16:10:42.466299 | 2021-06-06T11:25:36 | 2021-06-06T11:25:36 | 362,561,264 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 878 | cpp | task.cpp |
#ifndef TASK
#include "../header files/task.hpp"
#endif
#include <thread>
#include <mutex>
#include <queue>
#include <vector>
task::task(void (*func)(void*),void* arguments): heap_f(func),arguments(arguments){
}
task::task(task && a): heap_f(a.heap_f), arguments(a.arguments){
a.heap_f = nullptr;
a.arguments = nullptr;
}
task::task(task & a): heap_f(a.heap_f), arguments(a.arguments){}
bool task::execute(){
try{
heap_f(arguments);
}
catch(char* mess){
std::cout << "Exception :" << mess << std::endl;
return 0;
}
catch(...){
std::cout << "Default Exception" << std::endl;
return 0;
}
return 1;
}
void task::operator()(){
int x = execute();
if(!x){
std::cout << "Execution stopped" << std::endl;
}
}
task::~task(){
int* a = static_cast<int*>(arguments);
delete[] a;
} |
dd364ae4f536b8ba332656401e1a2fcc0d4b1f1c | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Source/Runtime/Slate/Private/Widgets/Layout/SSpacer.cpp | 5f09331cd5a251b7c696a6405979caa582ddab41 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 718 | cpp | SSpacer.cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "Widgets/Layout/SSpacer.h"
/**
* Construct this widget
*
* @param InArgs The declaration data for this widget
*/
void SSpacer::Construct( const FArguments& InArgs )
{
SpacerSize = InArgs._Size;
}
int32 SSpacer::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
// We did not paint anything. The parent's current LayerId is probably the max we were looking for.
return LayerId;
}
FVector2D SSpacer::ComputeDesiredSize( float ) const
{
return SpacerSize.Get();
}
|
2893c923cd7c3c472bf83c0b75ab887a8f5e19b7 | 92d3ed6fbfe46b8f4c715708d99e3db5c7b574e5 | /engine/core/include/TFormatInfo.h | b7b5b36c32321919197a92e33e47525db69205ff | [
"MIT"
] | permissive | FuXiii/Turbo | a2b8c023b737106d4befedd74a56b50dcc82cfde | 6710ac735b9068f32995d73b25b6f9da28641d5a | refs/heads/master | 2023-09-03T13:17:51.174002 | 2023-08-31T02:39:15 | 2023-08-31T02:39:15 | 486,079,006 | 87 | 8 | null | null | null | null | UTF-8 | C++ | false | false | 21,584 | h | TFormatInfo.h | #pragma once
#ifndef TURBO_CORE_TFORMAT_H
#define TURBO_CORE_TFORMAT_H
#include "TObject.h"
namespace Turbo
{
namespace Core
{
class TDevice;
typedef enum class TFormatType
{
UNDEFINED = VkFormat::VK_FORMAT_UNDEFINED,
R4G4_UNORM_PACK8 = VkFormat::VK_FORMAT_R4G4_UNORM_PACK8,
R4G4B4A4_UNORM_PACK16 = VkFormat::VK_FORMAT_R4G4B4A4_UNORM_PACK16,
B4G4R4A4_UNORM_PACK16 = VkFormat::VK_FORMAT_B4G4R4A4_UNORM_PACK16,
R5G6B5_UNORM_PACK16 = VkFormat::VK_FORMAT_R5G6B5_UNORM_PACK16,
B5G6R5_UNORM_PACK16 = VkFormat::VK_FORMAT_B5G6R5_UNORM_PACK16,
R5G5B5A1_UNORM_PACK16 = VkFormat::VK_FORMAT_R5G5B5A1_UNORM_PACK16,
B5G5R5A1_UNORM_PACK16 = VkFormat::VK_FORMAT_B5G5R5A1_UNORM_PACK16,
A1R5G5B5_UNORM_PACK16 = VkFormat::VK_FORMAT_A1R5G5B5_UNORM_PACK16,
R8_UNORM = VkFormat::VK_FORMAT_R8_UNORM,
R8_SNORM = VkFormat::VK_FORMAT_R8_SNORM,
R8_USCALED = VkFormat::VK_FORMAT_R8_USCALED,
R8_SSCALED = VkFormat::VK_FORMAT_R8_SSCALED,
R8_UINT = VkFormat::VK_FORMAT_R8_UINT,
R8_SINT = VkFormat::VK_FORMAT_R8_SINT,
R8_SRGB = VkFormat::VK_FORMAT_R8_SRGB,
R8G8_UNORM = VkFormat::VK_FORMAT_R8G8_UNORM,
R8G8_SNORM = VkFormat::VK_FORMAT_R8G8_SNORM,
R8G8_USCALED = VkFormat::VK_FORMAT_R8G8_USCALED,
R8G8_SSCALED = VkFormat::VK_FORMAT_R8G8_SSCALED,
R8G8_UINT = VkFormat::VK_FORMAT_R8G8_UINT,
R8G8_SINT = VkFormat::VK_FORMAT_R8G8_SINT,
R8G8_SRGB = VkFormat::VK_FORMAT_R8G8_SRGB,
R8G8B8_UNORM = VkFormat::VK_FORMAT_R8G8B8_UNORM,
R8G8B8_SNORM = VkFormat::VK_FORMAT_R8G8B8_SNORM,
R8G8B8_USCALED = VkFormat::VK_FORMAT_R8G8B8_USCALED,
R8G8B8_SSCALED = VkFormat::VK_FORMAT_R8G8B8_SSCALED,
R8G8B8_UINT = VkFormat::VK_FORMAT_R8G8B8_UINT,
R8G8B8_SINT = VkFormat::VK_FORMAT_R8G8B8_SINT,
R8G8B8_SRGB = VkFormat::VK_FORMAT_R8G8B8_SRGB,
B8G8R8_UNORM = VkFormat::VK_FORMAT_B8G8R8_UNORM,
B8G8R8_SNORM = VkFormat::VK_FORMAT_B8G8R8_SNORM,
B8G8R8_USCALED = VkFormat::VK_FORMAT_B8G8R8_USCALED,
B8G8R8_SSCALED = VkFormat::VK_FORMAT_B8G8R8_SSCALED,
B8G8R8_UINT = VkFormat::VK_FORMAT_B8G8R8_UINT,
B8G8R8_SINT = VkFormat::VK_FORMAT_B8G8R8_SINT,
B8G8R8_SRGB = VkFormat::VK_FORMAT_B8G8R8_SRGB,
R8G8B8A8_UNORM = VkFormat::VK_FORMAT_R8G8B8A8_UNORM,
R8G8B8A8_SNORM = VkFormat::VK_FORMAT_R8G8B8A8_SNORM,
R8G8B8A8_USCALED = VkFormat::VK_FORMAT_R8G8B8A8_USCALED,
R8G8B8A8_SSCALED = VkFormat::VK_FORMAT_R8G8B8A8_SSCALED,
R8G8B8A8_UINT = VkFormat::VK_FORMAT_R8G8B8A8_UINT,
R8G8B8A8_SINT = VkFormat::VK_FORMAT_R8G8B8A8_SINT,
R8G8B8A8_SRGB = VkFormat::VK_FORMAT_R8G8B8A8_SRGB,
B8G8R8A8_UNORM = VkFormat::VK_FORMAT_B8G8R8A8_UNORM,
B8G8R8A8_SNORM = VkFormat::VK_FORMAT_B8G8R8A8_SNORM,
B8G8R8A8_USCALED = VkFormat::VK_FORMAT_B8G8R8A8_USCALED,
B8G8R8A8_SSCALED = VkFormat::VK_FORMAT_B8G8R8A8_SSCALED,
B8G8R8A8_UINT = VkFormat::VK_FORMAT_B8G8R8A8_UINT,
B8G8R8A8_SINT = VkFormat::VK_FORMAT_B8G8R8A8_SINT,
B8G8R8A8_SRGB = VkFormat::VK_FORMAT_B8G8R8A8_SRGB,
A8B8G8R8_UNORM_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_UNORM_PACK32,
A8B8G8R8_SNORM_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_SNORM_PACK32,
A8B8G8R8_USCALED_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_USCALED_PACK32,
A8B8G8R8_SSCALED_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_SSCALED_PACK32,
A8B8G8R8_UINT_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_UINT_PACK32,
A8B8G8R8_SINT_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_SINT_PACK32,
A8B8G8R8_SRGB_PACK32 = VkFormat::VK_FORMAT_A8B8G8R8_SRGB_PACK32,
A2R10G10B10_UNORM_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_UNORM_PACK32,
A2R10G10B10_SNORM_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_SNORM_PACK32,
A2R10G10B10_USCALED_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_USCALED_PACK32,
A2R10G10B10_SSCALED_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_SSCALED_PACK32,
A2R10G10B10_UINT_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_UINT_PACK32,
A2R10G10B10_SINT_PACK32 = VkFormat::VK_FORMAT_A2R10G10B10_SINT_PACK32,
A2B10G10R10_UNORM_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_UNORM_PACK32,
A2B10G10R10_SNORM_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_SNORM_PACK32,
A2B10G10R10_USCALED_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_USCALED_PACK32,
A2B10G10R10_SSCALED_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_SSCALED_PACK32,
A2B10G10R10_UINT_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_UINT_PACK32,
A2B10G10R10_SINT_PACK32 = VkFormat::VK_FORMAT_A2B10G10R10_SINT_PACK32,
R16_UNORM = VkFormat::VK_FORMAT_R16_UNORM,
R16_SNORM = VkFormat::VK_FORMAT_R16_SNORM,
R16_USCALED = VkFormat::VK_FORMAT_R16_USCALED,
R16_SSCALED = VkFormat::VK_FORMAT_R16_SSCALED,
R16_UINT = VkFormat::VK_FORMAT_R16_UINT,
R16_SINT = VkFormat::VK_FORMAT_R16_SINT,
R16_SFLOAT = VkFormat::VK_FORMAT_R16_SFLOAT,
R16G16_UNORM = VkFormat::VK_FORMAT_R16G16_UNORM,
R16G16_SNORM = VkFormat::VK_FORMAT_R16G16_SNORM,
R16G16_USCALED = VkFormat::VK_FORMAT_R16G16_USCALED,
R16G16_SSCALED = VkFormat::VK_FORMAT_R16G16_SSCALED,
R16G16_UINT = VkFormat::VK_FORMAT_R16G16_UINT,
R16G16_SINT = VkFormat::VK_FORMAT_R16G16_SINT,
R16G16_SFLOAT = VkFormat::VK_FORMAT_R16G16_SFLOAT,
R16G16B16_UNORM = VkFormat::VK_FORMAT_R16G16B16_UNORM,
R16G16B16_SNORM = VkFormat::VK_FORMAT_R16G16B16_SNORM,
R16G16B16_USCALED = VkFormat::VK_FORMAT_R16G16B16_USCALED,
R16G16B16_SSCALED = VkFormat::VK_FORMAT_R16G16B16_SSCALED,
R16G16B16_UINT = VkFormat::VK_FORMAT_R16G16B16_UINT,
R16G16B16_SINT = VkFormat::VK_FORMAT_R16G16B16_SINT,
R16G16B16_SFLOAT = VkFormat::VK_FORMAT_R16G16B16_SFLOAT,
R16G16B16A16_UNORM = VkFormat::VK_FORMAT_R16G16B16A16_UNORM,
R16G16B16A16_SNORM = VkFormat::VK_FORMAT_R16G16B16A16_SNORM,
R16G16B16A16_USCALED = VkFormat::VK_FORMAT_R16G16B16A16_USCALED,
R16G16B16A16_SSCALED = VkFormat::VK_FORMAT_R16G16B16A16_SSCALED,
R16G16B16A16_UINT = VkFormat::VK_FORMAT_R16G16B16A16_UINT,
R16G16B16A16_SINT = VkFormat::VK_FORMAT_R16G16B16A16_SINT,
R16G16B16A16_SFLOAT = VkFormat::VK_FORMAT_R16G16B16A16_SFLOAT,
R32_UINT = VkFormat::VK_FORMAT_R32_UINT,
R32_SINT = VkFormat::VK_FORMAT_R32_SINT,
R32_SFLOAT = VkFormat::VK_FORMAT_R32_SFLOAT,
R32G32_UINT = VkFormat::VK_FORMAT_R32G32_UINT,
R32G32_SINT = VkFormat::VK_FORMAT_R32G32_SINT,
R32G32_SFLOAT = VkFormat::VK_FORMAT_R32G32_SFLOAT,
R32G32B32_UINT = VkFormat::VK_FORMAT_R32G32B32_UINT,
R32G32B32_SINT = VkFormat::VK_FORMAT_R32G32B32_SINT,
R32G32B32_SFLOAT = VkFormat::VK_FORMAT_R32G32B32_SFLOAT,
R32G32B32A32_UINT = VkFormat::VK_FORMAT_R32G32B32A32_UINT,
R32G32B32A32_SINT = VkFormat::VK_FORMAT_R32G32B32A32_SINT,
R32G32B32A32_SFLOAT = VkFormat::VK_FORMAT_R32G32B32A32_SFLOAT,
R64_UINT = VkFormat::VK_FORMAT_R64_UINT,
R64_SINT = VkFormat::VK_FORMAT_R64_SINT,
R64_SFLOAT = VkFormat::VK_FORMAT_R64_SFLOAT,
R64G64_UINT = VkFormat::VK_FORMAT_R64G64_UINT,
R64G64_SINT = VkFormat::VK_FORMAT_R64G64_SINT,
R64G64_SFLOAT = VkFormat::VK_FORMAT_R64G64_SFLOAT,
R64G64B64_UINT = VkFormat::VK_FORMAT_R64G64B64_UINT,
R64G64B64_SINT = VkFormat::VK_FORMAT_R64G64B64_SINT,
R64G64B64_SFLOAT = VkFormat::VK_FORMAT_R64G64B64_SFLOAT,
R64G64B64A64_UINT = VkFormat::VK_FORMAT_R64G64B64A64_UINT,
R64G64B64A64_SINT = VkFormat::VK_FORMAT_R64G64B64A64_SINT,
R64G64B64A64_SFLOAT = VkFormat::VK_FORMAT_R64G64B64A64_SFLOAT,
B10G11R11_UFLOAT_PACK32 = VkFormat::VK_FORMAT_B10G11R11_UFLOAT_PACK32,
E5B9G9R9_UFLOAT_PACK32 = VkFormat::VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
D16_UNORM = VkFormat::VK_FORMAT_D16_UNORM,
X8_D24_UNORM_PACK32 = VkFormat::VK_FORMAT_X8_D24_UNORM_PACK32,
D32_SFLOAT = VkFormat::VK_FORMAT_D32_SFLOAT,
S8_UINT = VkFormat::VK_FORMAT_S8_UINT,
D16_UNORM_S8_UINT = VkFormat::VK_FORMAT_D16_UNORM_S8_UINT,
D24_UNORM_S8_UINT = VkFormat::VK_FORMAT_D24_UNORM_S8_UINT,
D32_SFLOAT_S8_UINT = VkFormat::VK_FORMAT_D32_SFLOAT_S8_UINT,
BC1_RGB_UNORM_BLOCK = VkFormat::VK_FORMAT_BC1_RGB_UNORM_BLOCK,
BC1_RGB_SRGB_BLOCK = VkFormat::VK_FORMAT_BC1_RGB_SRGB_BLOCK,
BC1_RGBA_UNORM_BLOCK = VkFormat::VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
BC1_RGBA_SRGB_BLOCK = VkFormat::VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
BC2_UNORM_BLOCK = VkFormat::VK_FORMAT_BC2_UNORM_BLOCK,
BC2_SRGB_BLOCK = VkFormat::VK_FORMAT_BC2_SRGB_BLOCK,
BC3_UNORM_BLOCK = VkFormat::VK_FORMAT_BC3_UNORM_BLOCK,
BC3_SRGB_BLOCK = VkFormat::VK_FORMAT_BC3_SRGB_BLOCK,
BC4_UNORM_BLOCK = VkFormat::VK_FORMAT_BC4_UNORM_BLOCK,
BC4_SNORM_BLOCK = VkFormat::VK_FORMAT_BC4_SNORM_BLOCK,
BC5_UNORM_BLOCK = VkFormat::VK_FORMAT_BC5_UNORM_BLOCK,
BC5_SNORM_BLOCK = VkFormat::VK_FORMAT_BC5_SNORM_BLOCK,
BC6H_UFLOAT_BLOCK = VkFormat::VK_FORMAT_BC6H_UFLOAT_BLOCK,
BC6H_SFLOAT_BLOCK = VkFormat::VK_FORMAT_BC6H_SFLOAT_BLOCK,
BC7_UNORM_BLOCK = VkFormat::VK_FORMAT_BC7_UNORM_BLOCK,
BC7_SRGB_BLOCK = VkFormat::VK_FORMAT_BC7_SRGB_BLOCK,
ETC2_R8G8B8_UNORM_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
ETC2_R8G8B8_SRGB_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
ETC2_R8G8B8A1_UNORM_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
ETC2_R8G8B8A1_SRGB_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
ETC2_R8G8B8A8_UNORM_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
ETC2_R8G8B8A8_SRGB_BLOCK = VkFormat::VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
EAC_R11_UNORM_BLOCK = VkFormat::VK_FORMAT_EAC_R11_UNORM_BLOCK,
EAC_R11_SNORM_BLOCK = VkFormat::VK_FORMAT_EAC_R11_SNORM_BLOCK,
EAC_R11G11_UNORM_BLOCK = VkFormat::VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
EAC_R11G11_SNORM_BLOCK = VkFormat::VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
ASTC_4x4_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
ASTC_4x4_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
ASTC_5x4_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
ASTC_5x4_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
ASTC_5x5_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
ASTC_5x5_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
ASTC_6x5_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
ASTC_6x5_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
ASTC_6x6_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
ASTC_6x6_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
ASTC_8x5_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
ASTC_8x5_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
ASTC_8x6_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
ASTC_8x6_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
ASTC_8x8_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
ASTC_8x8_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
ASTC_10x5_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
ASTC_10x5_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
ASTC_10x6_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
ASTC_10x6_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
ASTC_10x8_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
ASTC_10x8_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
ASTC_10x10_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
ASTC_10x10_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
ASTC_12x10_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
ASTC_12x10_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
ASTC_12x12_UNORM_BLOCK = VkFormat::VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
ASTC_12x12_SRGB_BLOCK = VkFormat::VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
// Provided by VK_VERSION_1_1
G8B8G8R8_422_UNORM = VkFormat::VK_FORMAT_G8B8G8R8_422_UNORM,
// Provided by VK_VERSION_1_1
B8G8R8G8_422_UNORM = VkFormat::VK_FORMAT_B8G8R8G8_422_UNORM,
// Provided by VK_VERSION_1_1
G8_B8_R8_3PLANE_420_UNORM = VkFormat::VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM,
// Provided by VK_VERSION_1_1
G8_B8R8_2PLANE_420_UNORM = VkFormat::VK_FORMAT_G8_B8R8_2PLANE_420_UNORM,
// Provided by VK_VERSION_1_1
G8_B8_R8_3PLANE_422_UNORM = VkFormat::VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM,
// Provided by VK_VERSION_1_1
G8_B8R8_2PLANE_422_UNORM = VkFormat::VK_FORMAT_G8_B8R8_2PLANE_422_UNORM,
// Provided by VK_VERSION_1_1
G8_B8_R8_3PLANE_444_UNORM = VkFormat::VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM,
// Provided by VK_VERSION_1_1
R10X6_UNORM_PACK16 = VkFormat::VK_FORMAT_R10X6_UNORM_PACK16,
// Provided by VK_VERSION_1_1
R10X6G10X6_UNORM_2PACK16 = VkFormat::VK_FORMAT_R10X6G10X6_UNORM_2PACK16,
// Provided by VK_VERSION_1_1
R10X6G10X6B10X6A10X6_UNORM_4PACK16 = VkFormat::VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = VkFormat::VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = VkFormat::VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = VkFormat::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = VkFormat::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = VkFormat::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = VkFormat::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = VkFormat::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
R12X4_UNORM_PACK16 = VkFormat::VK_FORMAT_R12X4_UNORM_PACK16,
// Provided by VK_VERSION_1_1
R12X4G12X4_UNORM_2PACK16 = VkFormat::VK_FORMAT_R12X4G12X4_UNORM_2PACK16,
// Provided by VK_VERSION_1_1
R12X4G12X4B12X4A12X4_UNORM_4PACK16 = VkFormat::VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = VkFormat::VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = VkFormat::VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16,
// Provided by VK_VERSION_1_1
G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = VkFormat::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = VkFormat::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = VkFormat::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = VkFormat::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = VkFormat::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16,
// Provided by VK_VERSION_1_1
G16B16G16R16_422_UNORM = VkFormat::VK_FORMAT_G16B16G16R16_422_UNORM,
// Provided by VK_VERSION_1_1
B16G16R16G16_422_UNORM = VkFormat::VK_FORMAT_B16G16R16G16_422_UNORM,
// Provided by VK_VERSION_1_1
G16_B16_R16_3PLANE_420_UNORM = VkFormat::VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM,
// Provided by VK_VERSION_1_1
G16_B16R16_2PLANE_420_UNORM = VkFormat::VK_FORMAT_G16_B16R16_2PLANE_420_UNORM,
// Provided by VK_VERSION_1_1
G16_B16_R16_3PLANE_422_UNORM = VkFormat::VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM,
// Provided by VK_VERSION_1_1
G16_B16R16_2PLANE_422_UNORM = VkFormat::VK_FORMAT_G16_B16R16_2PLANE_422_UNORM,
// Provided by VK_VERSION_1_1
G16_B16_R16_3PLANE_444_UNORM = VkFormat::VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM
} TFormatTypeEnum;
typedef enum TFormatContentType
{
UNDEFINED = 0x000,
RED = 0x001,
GREEN = 0x002,
BLUE = 0x004,
ALPHA = 0x008,
DEPTH = 0x010,
STENCIL = 0x020,
EXPONENT = 0x040, //???
UNUSED = 0x080, ///???
} TFormatContentTypeEnum;
typedef enum TFormatDataTypeBits
{
UNSIGNED_NORMALIZED = 0x00000001, // UNORM : float : unsigned normalized values in the range [0,1]
SIGNED_NORMALIZED = 0x00000002, // SNORM : float : signed normalized values in the range [-1,1]
UNSIGNED_SCALED = 0x00000004, // USCALED : float : unsigned integer values that get converted to floating-point in the range [0,(2^n)-1]
SIGNED_SCALED = 0x00000008, // SSCALED :float : signed integer values that get converted to floating-point in the range [(-2^(n-1)),(2^(n-1))-1]
UNSIGNED_INTEGER = 0x00000010, // UINT : uint : unsigned integer values in the range [0,(2^n)-1]
SIGNED_INTEGER = 0x00000020, // SINT : int : signed integer values in the range [-2^(n-1),(2^(n-1))-1]
SRGB = 0x00000040, // SRGB : float : The R, G, and B components are unsigned normalized values that represent values using sRGB nonlinear encoding, while the A component (if one exists) is a regular unsigned normalized value
SIGNED_FLOAT = 0x00000080, // SFLOAT : float : signed floating-point numbers
UNSIGNED_FLOAT = 0x00000100 // UFLOAT : float : unsigned floating-point numbers (used by packed, shared exponent, and some compressed formats)
} TFormatDataTypeBitsEnum;
typedef VkFlags TFormatDataTypes;
typedef enum class TFormatCompression
{
NONE = 0,
BC, // Block Compression
ETC2, // Ericsson Texture Compression
EAC, // ETC2 Alpha Compression
ASTC // Adaptive Scalable Texture Compression (LDR Profile).
} TFormatCompression;
typedef enum class TFormatReduceFactor
{
NONE = 0,
FACTOR_422, // planes other than the first are reduced in size by a factor of two horizontally or that the R and B values appear at half the horizontal frequency of the G values
FACTOR_420, // planes other than the first are reduced in size by a factor of two both horizontally and vertically
FACTOR_444, // all three planes of a three-planar image are the same size.
} TFormatReduceFactor;
typedef enum TFormatFeatureBits
{
FEATURE_SAMPLED_IMAGE_BIT = 0x00000001,
FEATURE_STORAGE_IMAGE_BIT = 0x00000002,
FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004,
FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008,
FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010,
FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020,
FEATURE_VERTEX_BUFFER_BIT = 0x00000040,
FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080,
FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100,
FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200,
FEATURE_BLIT_SRC_BIT = 0x00000400,
FEATURE_BLIT_DST_BIT = 0x00000800,
FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
} TFormatFeatureBits;
typedef VkFlags TFormatFeatures;
class TPhysicalDevice;
class TFormatInfo : public TObject
{
private:
TFormatType formatType = TFormatType::UNDEFINED;
TFormatProperties formatProperties = {};
public:
static std::vector<TFormatInfo> GetSupportFormats(TPhysicalDevice *physicalDevice);
static bool IsSupportFormat(TPhysicalDevice *physicalDevice, TFormatType formatType);
public:
TFormatInfo();
//[[deprecated]] TFormatInfo(TFormatType formatType = TFormatType::UNDEFINED);
explicit TFormatInfo(TFormatType formatType, TFormatProperties formatProperties);
~TFormatInfo();
public:
TFormatType GetFormatType();
VkFormat GetVkFormat();
TFormatDataTypes GetFormatDataType();
// bool IsPacked();
// uint32_t GetPackGroup();
// uint32_t GetPackBits();
// bool IsCompressed();
// TFormatCompression GetFormatCompression
// bool IsMultiPlanar();
// uint32_t GetPlaneNumber();
// TFormatReduceFactor GetReduceFactor();
uint32_t GetTexelBlockSize(); // unit byte
// uint8_t GetRedBitSize();//unit bit
// uint8_t GetGreenBitSize();//unit bit
// uint8_t GetBlueBitSize();//unit bit
// uint8_t GetAlphaBitSize();//unit bit
// uint8_t GetDepthBitSize();//unit bit
// uint8_t GetStencilBitSize();//unit bit
bool IsSupportBuffer();
bool IsSupportVertexBuffer();
bool IsSupportLinearTiling();
bool IsLinearTilingSupportSampledImage();
bool IsLinearTilingSupportStorageImage();
bool IsLinearTilingSupportStorageImageAtomic();
bool IsLinearTilingSupportColorAttachment();
bool IsLinearTilingSupportColorAttachmentBlend();
bool IsLinearTilingSupportDepthStencilAttachment();
bool IsLinearTilingSupportBlitSrc();
bool IsLinearTilingSupportBlitDst();
bool IsLinearTilingSupportSampledImageFilterLinear();
bool IsLinearTilingSupportTransferSrc();
bool IsLinearTilingSupportTransferDst();
bool IsSupportOptimalTiling();
bool IsOptimalTilingSupportSampledImage();
bool IsOptimalTilingSupportStorageImage();
bool IsOptimalTilingSupportStorageImageAtomic();
bool IsOptimalTilingSupportColorAttachment();
bool IsOptimalTilingSupportColorAttachmentBlend();
bool IsOptimalTilingSupportDepthStencilAttachment();
bool IsOptimalTilingSupportBlitSrc();
bool IsOptimalTilingSupportBlitDst();
bool IsOptimalTilingSupportSampledImageFilterLinear();
bool IsOptimalTilingSupportTransferSrc();
bool IsOptimalTilingSupportTransferDst();
bool operator==(const TFormatInfo &format) const; // TODO: Format Compatibility Classes
bool operator!=(const TFormatInfo &format) const;
virtual std::string ToString() override;
};
} // namespace Core
} // namespace Turbo
#endif // !TURBO_CORE_TFORMAT_H |
7f19344264a89993de7d7d41d526c25e92c91334 | 97108b56d681860b2bad6896e1d723fe792f3b6f | /devel/electron17/files/patch-chrome_browser_ui_browser__dialogs.h | f80e4ec105ce613a7bc401b286b3bffe27b6fa05 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | AMDmi3/freebsd-ports | c36418a1023792ee4809250dc05b86134a489d3b | c6ddef13d6e3013d88089e15a2f047cc9aac59c4 | refs/heads/master | 2022-08-26T08:53:23.129504 | 2022-05-17T14:36:02 | 2022-05-17T14:41:55 | 355,688,492 | 0 | 1 | NOASSERTION | 2021-04-07T21:37:47 | 2021-04-07T21:37:46 | null | UTF-8 | C++ | false | false | 1,269 | h | patch-chrome_browser_ui_browser__dialogs.h | --- chrome/browser/ui/browser_dialogs.h.orig 2022-05-11 07:16:49 UTC
+++ chrome/browser/ui/browser_dialogs.h
@@ -26,7 +26,7 @@
#include "ui/base/models/dialog_model.h"
#include "ui/gfx/native_widget_types.h"
-#if defined(OS_WIN) || defined(OS_MAC) || \
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_BSD) || \
(defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
#include "chrome/browser/web_applications/web_app_id.h"
#endif
@@ -80,7 +80,7 @@ class WebDialogDelegate;
struct SelectedFileInfo;
} // namespace ui
-#if defined(OS_WIN) || defined(OS_MAC) || \
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_BSD) || \
(defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
namespace web_app {
struct UrlHandlerLaunchParams;
@@ -207,7 +207,7 @@ void ShowWebAppFileLaunchDialog(const std::vector<base
WebAppLaunchAcceptanceCallback close_callback);
#endif // !defined(OS_ANDROID)
-#if defined(OS_WIN) || defined(OS_MAC) || \
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_BSD) || \
(defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
// Callback that runs when the Web App URL Handler Intent Picker dialog is
// closed. `accepted` is true when the dialog is accepted, false otherwise.
|
d93234ebfbd3861ce2889ae0bd13c2f4468f27c9 | d92394ff8f07e0e2fc5260c42d8ce7c6266ecc30 | /files/gameobject.cpp | 096891a54122e5fc9f933297129ea45a7f55e651 | [] | no_license | IreneArapogiorgi/CPP-Assignment | 243533dbb821a92a7581a002f2cf46742bfa9aea | 9cd60871fa5ae6610ef31b724c6887486da8c39a | refs/heads/master | 2023-03-01T14:15:37.137077 | 2021-02-06T14:46:13 | 2021-02-06T14:46:13 | 320,896,137 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 315 | cpp | gameobject.cpp | #include "gameobject.h"
void GameObject::draw()
{
// Draw game object
drawRect(pos_x, pos_y, width, height, br);
}
GameObject::GameObject(const Game& mygame, float x, float y, float width, float height) : game(mygame),
pos_x(x), pos_y(y), width(width), height(height)
{
}
GameObject::~GameObject()
{
} |
fd159ec4c18cabc9d043de14a6d081d2fefd7fcf | 9083561a9ca4b6ef54f2f012f89813a5b45a0641 | /vpr7_x2p/libprinthandler/SRC/TC_Common/TC_StringUtils.h | ebe4972f002724a87d7f8feb52085887daec94cf | [
"MIT"
] | permissive | mithro/OpenFPGA | ea825e3acaa2ffef4b46c065347edf4ed8296c31 | c95fea268dc9789cf5ccecae938be8418e8f8680 | refs/heads/master | 2020-08-10T10:37:04.332111 | 2019-07-27T21:20:53 | 2019-07-27T21:20:53 | 214,326,071 | 2 | 0 | MIT | 2019-10-11T02:28:43 | 2019-10-11T02:28:43 | null | UTF-8 | C++ | false | false | 2,147 | h | TC_StringUtils.h | //===========================================================================//
// Purpose : Function prototypes for miscellaneous helpful string functions.
//
//===========================================================================//
#ifndef TC_STRING_UTILS_H
#define TC_STRING_UTILS_H
#include <string>
using namespace std;
#include "TC_Typedefs.h"
//===========================================================================//
// Purpose : Function prototypes
// Author : Jeff Rudolph
//---------------------------------------------------------------------------//
// Version history
// 05/01/12 jeffr : Original
//===========================================================================//
int TC_CompareStrings( const char* pszStringA,
const char* pszStringB );
int TC_CompareStrings( const string& srStringA,
const string& srStringB );
int TC_CompareStrings( const void* pvoidA,
const void* pvoidB );
bool TC_FormatStringCentered( const char* pszString,
size_t lenRefer,
char* pszCentered,
size_t lenCentered );
bool TC_FormatStringFilled( char cFill,
char* pszFilled,
size_t lenFilled );
bool TC_FormatStringDateTimeStamp( char* pszDateTimeStamp,
size_t lenDateTimeStamp,
const char* pszPrefix = 0,
const char* pszPostfix = 0 );
void TC_ExtractStringSideMode( TC_SideMode_t sideMode,
string* psrSideMode );
void TC_ExtractStringTypeMode( TC_TypeMode_t typeMode,
string* psrTypeMode );
bool TC_AddStringPrefix( char* pszString,
const char* pszPrefix );
bool TC_AddStringPostfix( char* pszString,
const char* pszPostfix );
int TC_stricmp( const char* pszStringA, const char* pszStringB );
int TC_strnicmp( const char* pszStringA, const char* pszStringB, int i );
#endif
|
3fcd1e974753917a54b11c692ba139d8ea005978 | b9404a88c13d723be44f7c247e1417689ce7981a | /SRC/External/stlib/packages/array/ArrayBase.h | 88b3efaf20aa1ec335c7dee753df4254d6b69da1 | [
"BSD-2-Clause"
] | permissive | bxl295/m4extreme | c3d0607711e268d22d054a8c3d9e6d123bbf7d78 | 2a4a20ebb5b4e971698f7c981de140d31a5e550c | refs/heads/master | 2022-12-06T19:34:30.460935 | 2020-08-29T20:06:40 | 2020-08-29T20:06:40 | 291,333,994 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,889 | h | ArrayBase.h | // -*- C++ -*-
/*!
\file array/ArrayBase.h
\brief Base class for arrays.
*/
#if !defined(__array_ArrayBase_h__)
#define __array_ArrayBase_h__
#include "IndexTypes.h"
#include "IndexRange.h"
namespace array {
//! Base class for arrays.
class
ArrayBase {
//
// Types.
//
private:
typedef IndexTypes Types;
public:
// Types for STL compliance.
//! The size type.
typedef Types::size_type size_type;
//! Pointer difference type.
typedef Types::difference_type difference_type;
// Other types.
//! An array index is a signed integer.
typedef Types::Index Index;
//! An index range.
typedef IndexRange Range;
//
// Member data.
//
protected:
//! The number of elements.
size_type _size;
//! The lower bound.
Index _base;
//! The stride for indexing.
Index _stride;
//--------------------------------------------------------------------------
//! \name Constructors etc.
//@{
public:
// The default copy constructor and assignment operator are fine.
//! Construct from the array size, the index bases, the storage order, and the strides.
ArrayBase(const size_type size, const Index base, const Index stride) :
_size(size),
_base(base),
_stride(stride) {
}
//! Destructor does nothing.
virtual
~ArrayBase() {
}
protected:
//! Rebuild the data structure.
void
rebuild(const size_type size, const Index base, const Index stride) {
_size = size;
_base = base;
_stride = stride;
}
private:
//! Default constructor not implemented.
ArrayBase();
//@}
//--------------------------------------------------------------------------
//! \name Random Access Container.
//@{
public:
//! Return true if the range is empty.
bool
empty() const {
return _size == 0;
}
//! Return the size (number of elements) of the range.
size_type
size() const {
return _size;
}
//! Return the size of the range.
/*! The the max_size and the size are the same. */
size_type
max_size() const {
return size();
}
//@}
//--------------------------------------------------------------------------
//! \name Array indexing.
//@{
public:
//! The index lower bound.
Index
base() const {
return _base;
}
//! Set the index lower bound.
void
setBase(const Index base) {
_base = base;
}
//! The index range.
Range
range() const {
return Range(size(), base());
}
//! The stride for indexing.
Index
stride() const {
return _stride;
}
//! The offset for indexing the base.
difference_type
offset() const {
return _base * _stride;
}
protected:
//! Return the array index for the given index list.
/*!
For arrays with contiguous storage, this index is in the range
[0..size()-1].
*/
Index
arrayIndex(const Index index) const {
return (index - _base) * _stride;
}
//@}
};
// CONTINUE: Doxygen thinks these equality operators clash with those
// defined in other groups. I don't know why.
//----------------------------------------------------------------------------
//! \defgroup ArrayBaseEquality Equality Operators
//@{
//! Return true if the member data are equal.
/*! \relates ArrayBase */
inline
bool
operator==(const ArrayBase& x, const ArrayBase& y) {
return x.size() == y.size() && x.base() == y.base() &&
x.stride() == y.stride();
}
//! Return true if they are not equal.
/*! \relates ArrayBase */
inline
bool
operator!=(const ArrayBase& x, const ArrayBase& y) {
return !(x == y);
}
//@}
} // namespace array
#endif
|
7051845c81bbc5f24543a72796f40efcee8e6e7b | deb94701d969da811dcd53143c9468692941338c | /Labs/lab-arrays/diceplot.cpp | d1072e1d816beac37ccd84e9b5700f8cca9220ae | [] | no_license | DominatingDonut/CSCI-103 | c5849303a8a2eac27f5190eb56085a13a461a242 | c763ec38fd3a5385d4c2b40bb8e90cc6c2341790 | refs/heads/master | 2021-05-21T09:18:52.771865 | 2018-06-07T10:28:17 | 2018-06-07T10:28:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,486 | cpp | diceplot.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
/*
Written by: Stanley Kim
Email: stanlejk@usc.edu
Diceplot: Takes an integer, n, from the user, and plots out a histogram
showing the results of n experiments. Each experiment records the sum of
4 dice rolls.
*/
int roll();
void printHistogram(int []);
/*
int main()
{
srand(time(0));
cout << roll() << endl;
return 0;
}
int main()
{
srand(time(0));
int testCounts[21];
for (int i = 0; i < 21; i++)
{
testCounts[i] = i / 2;
}
printHistogram(testCounts);
return 0;
}
*/
int main()
{
srand(time(0));
int n;
int sum = 0;
int results[21] = {0};
cout << "Enter a number, n: "; //Prompts user
cin >> n;
for (int x = n; x > 0; x--) //Runs through the experiments n times
{
for (int y = 4; y > 0; y--) //Each exp. rolls 4 dice
{
sum = sum + roll(); //Adds each roll to previous sum
}
results[sum - 4]++; //Records result into array
sum = 0; //Reinitializes sum to 0
}
printHistogram(results);
return 0;
}
int roll()
{
int r = (rand() % 6) + 1;
return r;
}
void printHistogram(int counts[])
{
for (int i = 0; i < 21; i++)
{
cout << i + 4 << ":";
for (int j = counts[i]; j > 0; j--)
{
cout << 'X';
}
cout << endl;
}
}
|
d6fabbbbf89976dcfeede08f387787391dd93937 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1482494_0/C++/pchenz/b.cc | 48bc0e51eb1dfa7c687ade67ac61675eca17b3a6 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,600 | cc | b.cc | #include <cstdio>
#include <algorithm>
using namespace std;
#define MAX_LEN 1005
typedef struct
{
int a;
int b;
int s;
}Item;
Item buf[MAX_LEN];
Item * bufa[MAX_LEN];
Item * bufb[MAX_LEN];
void print(Item **x, int n) {
for (int i=0; i<n; i++) {
printf("%d:%d %d->%d\n", i, x[i]->a, x[i]->b, x[i]->s);
}
}
bool comparea(const Item * x, const Item * y){
return x->a < y->a;
}
bool compareb(const Item * x, const Item * y){
return x->b < y->b;
}
int main(int argc, char const *argv[])
{
freopen("x.in", "r", stdin);
int t, ti, n, ni;
scanf("%d", &t);
ti = 0;
while (ti++ < t) {
scanf("%d", &n);
for (ni=0; ni<n; ni++) {
scanf("%d %d", &(buf[ni].a), &(buf[ni].b));
buf[ni].s = 0;
bufa[ni] = &buf[ni];
bufb[ni] = &buf[ni];
}
sort(bufa, bufa+n, comparea);
sort(bufb, bufb+n, compareb);
//print(bufa, n);
//print(bufb, n);
int sum = 0;
int star = 0;
int i = 0;
int j = 0;
int x = 0;
for (i=0; i<n; i++) {
//printf("i=%d: %d %d\n", i, bufb[i]->b, star);
if (bufb[i]->b <= star) {
++sum;
++star;
if (bufb[i]->s==0) {
++star;
}
bufb[i]->s = -1;
//printf("pass: %d %d\n", sum, star);
} else {
for (x=0; x<n; x++) {
if (bufa[x]->s == 0) {
if (bufa[x]->a <= star) {
//printf("x=%d: %d %d\n", x, bufa[x]->a, star);
++sum;
++star;
bufa[x]->s = 1;
break;
}
}
}
--i;
if (x == n) {
break;
}
}
}
if (i !=n) {
printf("Case #%d: Too Bad\n", ti);
}else {
printf("Case #%d: %d\n", ti, sum);
}
}
return 0;
} |
412b42b0aef2f1a5d42f929329d49054c7820f25 | c15f487ef96abcf034bd2b1e55e018f525f95c8b | /Source/Project_ESTRA/Public/Turret/TurretAIController.h | 0aeb2aa5ff2f571a17143736a7349c0034125944 | [] | no_license | Everixel/Project_ESTRA | 9d0aff1d896cdea531bee0903586dbcd33724b50 | 12650436f7063e8bb15656369f107cffc129c19e | refs/heads/master | 2020-04-09T06:45:00.315286 | 2019-01-02T10:09:59 | 2019-01-02T10:09:59 | 160,125,504 | 0 | 0 | null | null | null | null | WINDOWS-1258 | C++ | false | false | 841 | h | TurretAIController.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIController.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "TurretAIController.generated.h"
/**
*
*/
UCLASS()
class PROJECT_ESTRA_API ATurretAIController : public AAIController
{
GENERATED_BODY()
public:
ATurretAIController(const FObjectInitializer & ObjectInitializer);
void BeginPlay() override;
private:
// ̉hese are the behavior tree and the according blackboard that controls our controller (the AI happens in them)
UPROPERTY(EditDefaultsOnly, Category = "Blackboard")
UBlackboardData * BlackboardToUse;
UPROPERTY(EditDefaultsOnly, Category = "Blackboard")
UBehaviorTree* BehaviorTreeToUse;
UPROPERTY()
UBlackboardComponent* BB;
};
|
c24c06ee79571a751fbaa3dd66838cbcde1d28bf | 32acecf9f1040c263da9c8bc7033073d8caf3311 | /c++/d4/d4_3819_p_최대부분배열_틀렸다고하지만end.cpp | 4cdf3c673a9b316a8addd9ec2755b176bd4b9847 | [] | no_license | diterun/AlgorithmCode | c951a0a69622fd917c303eccde8bb9d5c532a612 | 24b4b0033f5366bccee9a166a0876c4232f74ae5 | refs/heads/master | 2020-04-18T00:52:28.842500 | 2020-02-27T01:37:06 | 2020-02-27T01:37:06 | 167,095,115 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | cpp | d4_3819_p_최대부분배열_틀렸다고하지만end.cpp | #include<iostream>
using namespace std;
#define MAX 200001
#define getMax(a, b) (a > b ? a : b)
int A[MAX], n;
int processing(){
int sum = 0;
for(int i = 0; i < n; i++){
sum += A[i];
sum = getMax(sum, 0);
}
return sum;
}
// 데이터 입력
void inputData(){
cin >> n;
for(int i = 0; i < n; i++){
cin >> A[i];
}
}
int main(){
int T, t;
cin >> T;
for(t = 1; t <= T; ++t){
inputData();
cout <<"#" << t << " " << processing() << endl;
}
return 0;
} |
5c59f1c15434d017221f16bc62b6cc26dc5da311 | 99d9e52202b7f00d870dd41ed40c98499165b380 | /src/selfie_stm32_bridge/src/usb.cpp | cbbd79c9f3718bb18bdc30e4d0bf58aef44d91e0 | [
"BSD-3-Clause"
] | permissive | luroess/selfie_carolocup2020 | 6329ec1e2329a3a00bb2014e68ed20e84c2faa02 | 9a28805f37cfe3462d94ddcc06ea94ed17ce2115 | refs/heads/master | 2020-12-18T11:53:10.552700 | 2019-12-11T20:11:46 | 2019-12-11T20:11:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,271 | cpp | usb.cpp | #include <selfie_stm32_bridge/usb.hpp>
int USB_STM::init(int speed)
{
char port[] = "/dev/serial/by-id/usb-KNR_Selfie_F7_00000000001A-if00";
//char port[] = "/dev/serial/by-id/STM32F407";
fd = open(port, O_RDWR | O_NOCTTY | O_SYNC);
if (fd < 0){
ROS_ERROR("Could not open serial communication on port!.\n Make sure you did: chmod u +rw /dev/serial/by-id/usb-KNR_Selfie_F7_00000000001A-if00\n");
return -1;
}
else
{
ROS_INFO("Opened serial communication on port\n");
}
// Get attributes of transmission
struct termios tty;
if (tcgetattr(fd, &tty) < 0)
{
ROS_ERROR("Error while getting attributes!");
return -2;
}
// Set input and output speed
cfsetospeed(&tty, B921600);
cfsetispeed(&tty, B921600);
tty.c_cflag |= (CLOCAL | CREAD); // program will not become owner of port
tty.c_cflag &= ~CSIZE; // bit mask for data bits
tty.c_cflag |= CS8; // 8 bit data lenght
tty.c_cflag |= PARENB; // enable parity
tty.c_cflag &= ~PARODD; // even parity
tty.c_cflag &= ~CSTOPB; // 1 stop bit
tty.c_cflag &= ~CRTSCTS; // no hardware flowcontrol
// non-canonical mode
tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
tty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
tty.c_oflag &= ~OPOST;
// fetch bytes asap
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
// Set new parameters of transmission
if (tcsetattr(fd, TCSANOW, &tty) != 0)
{
ROS_ERROR("Error while setting attributes!");
return -3;
}
//send ACK command
unsigned char data_enable[3] = {frame_startbyte, cmd_data_enable, frame_endbyte};
write(fd, data_enable, 3);
return 1;
}
bool USB_STM::read_from_STM()
{
int read_state = read(fd, &read_buffer[0], 512) ;
//cast read_buffer to frame
read_frame = (UsbReadFrame_s *)read_buffer;
if (read_state == USB_RECEIVE_SIZE && read_frame->startbyte == frame_startbyte
&& read_frame->code == frame_code && read_frame->length == USB_RECEIVE_SIZE - 4
&& read_frame->endByte == frame_endbyte)
{
return true; //correct data
}
else
{
return false; //no new data
}
}
void USB_STM::send_to_STM(uint32_t timestamp_ms, Sub_messages to_send)
{
send_frame = (UsbSendFrame_s *)send_buffer;
send_frame->startbyte = frame_startbyte;
send_frame->code = frame_code;
send_frame->length = USB_SEND_SIZE - 4;
send_frame->timestamp_ms = timestamp_ms;
send_frame->steering_angle = (int16_t)(to_send.ackerman.steering_angle * 10000);
send_frame->steering_angle_velocity = (int16_t)(to_send.ackerman.steering_angle_velocity * 10000);
send_frame->speed = (int16_t)(to_send.ackerman.speed * 1000);
send_frame->acceleration = (int16_t)(to_send.ackerman.acceleration * 1000);
send_frame->jerk = (int16_t)(to_send.ackerman.jerk * 1000);
send_frame->left_indicator = (uint8_t)(to_send.indicator.left);
send_frame->right_indicator = (uint8_t)(to_send.indicator.right);
send_frame->endbyte = frame_endbyte;
write(fd, &send_buffer, USB_SEND_SIZE);
}
void USB_STM::fill_publishers(Pub_messages &pub_data)
{
pub_data.imu_msg.header.frame_id = "imu";
pub_data.imu_msg.header.stamp = ros::Time::now();
//calculate imu quaternions
pub_data.imu_msg.orientation.x = (float)(read_frame->x / 32767.f);
pub_data.imu_msg.orientation.y = (float)(read_frame->y / 32767.f);
pub_data.imu_msg.orientation.z = (float)(read_frame->z / 32767.f);
pub_data.imu_msg.orientation.w = (float)(read_frame->w / 32767.f);
pub_data.imu_msg.linear_acceleration.x = (float)(read_frame->acc[0] / 8192.f * 9.80655f);
pub_data.imu_msg.linear_acceleration.y = (float)(read_frame->acc[1] / 8192.f * 9.80655f);
pub_data.imu_msg.linear_acceleration.z = (float)(read_frame->acc[2] / 8192.f * 9.80655f);
pub_data.imu_msg.angular_velocity.x = (float)(read_frame->rates[0] / 65.535f);
pub_data.imu_msg.angular_velocity.y = (float)(read_frame->rates[1] / 65.535f);
pub_data.imu_msg.angular_velocity.z = (float)(read_frame->rates[2] / 65.535f);
//acctual car velocity
pub_data.velo_msg.data = (float)read_frame->velocity / 1000;
//distance from encoders
pub_data.dist_msg.data = (float)read_frame->distance / 1000;
//buttons
pub_data.button1_msg.data = read_frame->start_button1;
pub_data.button2_msg.data = read_frame->start_button2;
//reset states
pub_data.reset_vision_msg.data = read_frame->reset_vision;
pub_data.switch_state_msg.data = read_frame->switch_state;
//unused
// read_frame->timestamp
// read_frame->yaw
}
USB_STM::~USB_STM()
{
send_frame = (UsbSendFrame_s *)send_buffer;
send_frame->startbyte = frame_startbyte;
send_frame->code = frame_code;
send_frame->length = USB_SEND_SIZE - 4;
send_frame->timestamp_ms = 0;
send_frame->steering_angle = 0;
send_frame->steering_angle_velocity = 0;
send_frame->speed = 0;
send_frame->acceleration = 0;
send_frame->jerk = 0;
send_frame->left_indicator = 0;
send_frame->right_indicator = 0;
send_frame->endbyte = frame_endbyte;
write(fd, &send_buffer, USB_SEND_SIZE);
} |
d70c241a539efa4e280ecc193e5776d7cbbf5e07 | 03bf03cc21bfc44f473d3c1265563da9a9d4acbe | /MultiTranslator/MTDEV/Dialogs/FindInFilesDlg.h | 1333c888ecfd117f721a02709e400580f4c8d1fc | [] | no_license | 15831944/Cpp-7 | 4606f7b0bbb63d0d0795c283bcde78ba5e2bdbe0 | c7ffd07379f4f39cc9b1d24b5e8bfe8f7c1ad9bd | refs/heads/master | 2023-03-16T18:35:11.729612 | 2017-06-09T08:06:03 | 2017-06-09T08:06:03 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 2,807 | h | FindInFilesDlg.h | /********************************************************************
created: 2002/06/15
created: 15:6:2002 9:28
filename: $(Projects)\sources\mtdev\dialogs\findinfilesdlg.h
file path: $(Projects)\sources\mtdev\dialogs
file base: findinfilesdlg
file ext: h
author: Fadeyev R.V.
purpose: Диалог поиска текста в файлах
*********************************************************************/
#pragma once
#include <MfcUtils.h>
#include "CObjectEx.h" //Один из родителей
#include "MTDevDialog_B.h" //Один из родителей
#include "BaseStructs.h"
// CdlgFindInFiles dialog
class CdlgFindInFiles : public CdlgDialog_B,public CCObjectEx, public IFindInFilesLink
{
DECLARE_DYNAMIC(CdlgFindInFiles)
private:
CString m_strText; // Переменная для отображения текста контрола IDC_COMBO_FIND
CString m_strLookIn; // IDC_COMBO_LOOK_IN
CString m_strFileTypes; // IDC_COMBO_FILE_TYPES (string)
BOOL m_bWholeWord; // IDC_CHECK_WHOLE_WORD
BOOL m_bMatchCase; // IDC_CHECK_MATCH_CASE
BOOL m_bLookInSubFolders; // IDC_CHECK_LOOK_IN_SUBFOLDERS
INT m_nFileTypes; // IDC_COMBO_FILE_TYPES (index)
INT m_nLookIn; // IDC_COMBO_LOOK_IN (index)
// Список применяемых строк для поиска (история)
mfc_utils::CRecentlyList m_RecentlyText;
mfc_utils::CRecentlyList m_RecentlyFileTypes;
// Переменная хранит последнее значение директории по выбору
CString m_strLastCustomPath;
enum { IDD = IDD_FIND_IN_FILES };
//Список заранее определенных типов поиска. Используется для вып списка "Look In"
enum {lkinCurrentProject,lkinAllOpenedDocuments,lkinAllOpenedProjects,lkinOther,lkinHighBound__};
static cstr mc_szLookIn[lkinHighBound__];
//Дает путь к текущему активному проекту
string_smart GetActiveProjectPath();
string_smart GetAllProjectsPathes();
//Запускает процесс поиска текста в указанных файлах
void DoFind(IOutputLink * pOutput);
protected:
//Работа с загрузкой/сохранением параметров в реестре
override void LoadSettings();
override void SaveSettings();
// From IFindInFilesLink
override bool Run(cstr szFindWhat, IOutputLink * pOutput);
// From CdlgDialog_B
override void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
override BOOL OnInitDialog();
override void OnOK();
afx_msg void OnCbnSelchangeComboLookIn();
DECLARE_MESSAGE_MAP()
public:
CdlgFindInFiles(CWnd* pParent = NULL); // standard constructor
virtual ~CdlgFindInFiles();
};
|
46026461fdfb93382d739104c11b9457f5c93cc0 | 9c346ccb24363c004dd0b89533c7e75a78240721 | /src/RMSEupdate.cpp | 2572545c7f8a7223f385bd155e0594cea4d78ea0 | [] | no_license | shreyatpandey/Pattern-Recognition-for-OSM-Data | 047a9e9b1bc459ed96ece27ffc101bea3f166627 | 0c41932abc59aeabac812f7e85974dc90790402b | refs/heads/master | 2023-07-07T11:54:44.820190 | 2023-07-04T16:38:54 | 2023-07-04T16:38:54 | 129,358,952 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,013 | cpp | RMSEupdate.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <math.h>
/*#include "preprocessing.h"*/
using namespace std;
#define nofFeatures 2
#define FLOAT_MAX 33554430
void printArray(double arr[],int n){
for (int i = 0; i < n;i++){
cout << arr[i]<<" ";
if((i%10)==9)
cout<<endl;
}
}
int main(int argc, char *argv[])
{
/*********************************************************************
This first stage is to process the information for TWO input files */
if(argc < 3){
cout << argv[0] << " expects two input files";
cout << " on the command line to run tests" << endl;
return 1;
}
// first file will be reference, second file will be "tested"
ifstream fileref(argv[1]);
ifstream filecom(argv[2]);
string separator;
int linesref = 0, linescom = 0;
/*Count number of streets in file REFERENCE*/
while (1){
getline(fileref,separator);
if (fileref.eof()) break;
else linesref++;
}
fileref.close();
cout<<"N of lines for REFERENCE text file: "<< --linesref<<endl;
/*Count number of streets in file TEST*/
while (1){
getline(filecom,separator);
if (filecom.eof()) break;
else linescom++;
}
filecom.close();
cout<<"N of lines for COMPARE text file: "<< --linescom<<endl;
/*Store values into a matrix REFERENCE*/
double matrixref[linesref][nofFeatures]; //definition of the matrix reference
fileref.open(argv[1]);
getline(fileref,separator);
for(int row = 0; row < linesref; row++)
{
string line;
getline(fileref, line);
if ( !fileref.good() )
break;
stringstream iss(line);
for (int col = 0; col <= nofFeatures; col++)
{
string val;
getline(iss, val, ' ');
if ( !iss.good() ){
stringstream convertor(val);
convertor >> matrixref[row][col];
break;
}
stringstream convertor(val);
convertor >> matrixref[row][col];
}
}
//printing of the stored data array
/*cout<<"Matrix for reference"<<endl;
for (int i = 0; i < linesref;i++){
for (int j = 0; j < nofFeatures;j++){
cout << matrixref[i][j]<<" ";
}
cout<<endl;
}*/
/*Store values into a matrix TEST*/
double matrixcom[linescom][nofFeatures]; //definition of the matrix test
filecom.open(argv[2]);
getline(filecom,separator);
for(int row = 0; row < linescom; row++)
{
string line;
getline(filecom, line);
if ( !filecom.good() )
break;
stringstream iss(line);
for (int col = 0; col <= nofFeatures; col++)
{
string val;
getline(iss, val, ' ');
if ( !iss.good() ){
stringstream convertor(val);
convertor >> matrixcom[row][col];
break;
}
stringstream convertor(val);
convertor >> matrixcom[row][col];
}
}
//printing of the stored data array
/*cout<<"Matrix for Comparison"<<endl;
for (int i = 0; i < linescom;i++){
for (int j = 0; j < nofFeatures;j++){
cout << matrixcom[i][j]<<" ";
}
cout<<endl;
} */
/********************************************************************************
This stage is to run the Closest Neighbor algorithm to get the combined RMSE */
/* For each point in the COMPARISON MATRIX we will FIRST find the CLOSEST
NEIGHBOR,then SECOND we calculate the result and will store it in a matrix*/
double matrixsol[linescom];
double minimum = FLOAT_MAX;
double distance;
for (int i=0;i<linescom;i++){
// every round we start assigning a comparison entry as PIVOT
for(int j=0;j<linesref;j++){
//compare each reference matrix entry with the PIVOT comparison entry
double a0 = matrixcom[i][0];
double a1 = matrixcom[i][1];
double b0 = matrixref[j][0];
double b1 = matrixref[j][1];
distance = sqrt(pow(a0-b0,2)+pow(a1-b1,2));
if (distance < minimum) minimum = distance;
}
matrixsol[i] = minimum;// the minimum will be the neighbor
minimum = FLOAT_MAX;
}
//printing of the stored solution array
/*cout<<"Matrix of Solutions: "<<endl;
for (int i = 0; i < linescom;i++){
cout << matrixsol[i]<<" ";
}
cout<<endl;*/
//Combine the results from the matrix solution to generate the RMSE for the two input cities
double sum = 0;
for (int i = 0; i < linescom;i++){
sum = sum + pow(matrixsol[i],2);
}
double RMSE = sqrt( (double) sum/linescom);
ofstream output("rmse.txt");
cout<<"The final RMSE is: "<< RMSE<<endl;
output<<RMSE<<endl;
return 0;
}
|
5a810e349b3c093d6fb4c886801643dbf71af1d5 | 2ea14dcc11ec462f6211bb414fcb826b22900f68 | /1755.cpp | 29792c209905787039e1473b4d2dc5828b892557 | [] | no_license | netanel0909/Cses | f0d7c2a5ed8a474e81560ab3dd421df4736a0ca9 | 300f99cefeb0271a83829d939870b77e7b78f4d4 | refs/heads/master | 2021-04-22T02:31:10.761206 | 2020-03-25T05:31:30 | 2020-03-25T05:31:30 | 249,844,080 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 942 | cpp | 1755.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define MAX 1000000007
using namespace std;
int main()
{
string str;
cin >> str;
vector<char> r;
int cnt = 0;
vector<long long int> a(26, 0);
for(auto i : str)
{
a[i - 'A']++;
}
for(auto i : a)
{
if(i%2==1) cnt++;
}
if(cnt > 1){cout << "NO SOLUTION";return 0;}
for (int i = 0; i < 26; i++)
{
if (!(a[i] % 2))
{
for (int j = 0; j < a[i] / 2; j++) r.push_back(i + 'A');
}
}
for (int i = 0; i < 26; i++)
{
if (a[i] % 2)
{
for (int j = 0; j < a[i]; j++) r.push_back(i + 'A');
}
}
for (int i = 25; i >= 0; i--)
{
if (!(a[i] % 2))
{
for (int j = 0; j < a[i] / 2; j++) r.push_back(i + 'A');
}
}
for(auto c : r)cout << c;
cout << endl;
return 0;
} |
b828e7a82edf082c80449344b7c09ff7d946da0d | 5d334d89e22028b95d4924a42bc0623fe013316d | /modules/core/core/osx/CocoaInterface.h | da61243d2f477a7f64df8be7b95374adfe9efe85 | [] | no_license | alxarsenault/axlib | e2369e20664c01f004e989e24e595475bdf85e5d | b4b4241ffc9b58849925fe4e8b966e8199990c35 | refs/heads/master | 2021-06-18T12:23:08.901204 | 2017-07-13T17:26:40 | 2017-07-13T17:26:40 | 64,876,596 | 6 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,284 | h | CocoaInterface.h | #pragma once
#include <string>
#include "Util.hpp"
namespace cocoa {
void AddEventToDispatchQueue();
void HideMouse();
void ShowMouse();
std::string OpenFileDialog();
std::string SaveFileDialog();
ax::Size GetScreenSize();
std::string GetPasteboardContent();
void SetPasteboardContent(const std::string& str);
std::string GetAppPath();
std::string GetAppDirectory();
void CreateWindow();
void* CreateWindow(const ax::Rect& rect);
void* CreateNSWindowFromApp(void* parent, void*& child, void*& appDelegate);
//{
//
//#ifdef _AX_VST_APP_
// NSView* parentView = (__bridge NSView*)parent;
//
// if (appDelegate == nullptr) {
// // std::cout << "CREATE axVstAppDelegate WINDOW" << std::endl;
// axSize size = axApp::GetInstance()->GetCore()->GetGlobalSize();
// axVstAppDelegate* app = [[axVstAppDelegate alloc] initWithFrame:NSMakeRect(0, 0, size.x, size.y)];
// appDelegate = (__bridge void*)app;
// //[appDelegate retain];
// [parentView addSubview:app];
// }
// else {
// // std::cout << "ATTACH WINDOW" << std::endl;
// [parentView addSubview:(__bridge axVstAppDelegate*)appDelegate];
// }
//
// return (__bridge void*)parentView;
//
//#else
// return nullptr;
//#endif // _AX_VST_APP_
//}
}
|
5b844bb3e96371ca60a8c44ced59be48b41fb22a | 31aa0bd1eaad4cd452d0e2c367d8905f8ed44ba3 | /algorithms/increasingTripletSubsequence/increasingTripletSubsequence.cpp | 6fc425c14aa105b5d8e9824408fe10a4daca6bd1 | [] | no_license | Sean-Lan/leetcode | 0bb0bfaf3a63d483794a0e5213a983db3bbe6ef6 | 1583c1b81c30140df78d188c327413a351d8c0af | refs/heads/master | 2021-04-19T02:49:33.572569 | 2021-01-04T01:40:06 | 2021-01-04T01:40:06 | 33,580,092 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,769 | cpp | increasingTripletSubsequence.cpp | /**
*
* Sean
* 2017-06-30
*
* https://leetcode.com/problems/increasing-triplet-subsequence/#/description
*
* Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.
*
* Formally the function should:
* Return true if there exists i, j, k
* such that arr[i] < arr[j] < arr[k] given 0 ≤ i < j < k ≤ n-1 else return false.
* Your algorithm should run in O(n) time complexity and O(1) space complexity.
*
* Examples:
* Given [1, 2, 3, 4, 5],
* return true.
*
* Given [5, 4, 3, 2, 1],
* return false.
*
*/
#include <vector>
using namespace std;
// Greedy
// `aStack` stores current smallest increasing sequence
//
// One trick used here is that we can use the size of `aStack` to avoid endless edge cases
class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int n = nums.size();
if (n < 3) return false;
vector<int> aStack;
int smallest;
int cur;
for (int i=0; i<n; ++i) {
cur = nums[i];
if (aStack.empty()) {
aStack.push_back(cur);
smallest = cur;
} else if (aStack.size() == 1) {
if (cur < smallest) {
aStack[0] = cur;
smallest = cur;
} else if (cur > smallest){
aStack.push_back(cur);
}
} else { // size == 2
if (cur > aStack[1]) return true;
if (cur > smallest) {
aStack[0] = smallest;
aStack[1] = cur;
} else {
smallest = cur;
}
}
}
return false;
}
};
int main() {
return 0;
}
|
7b494d99e19a4bff0033bcbc5be31faa5163991e | 85ea5e5080681aceef16dd73e85ad56644080da3 | /tensorvis/TensorDataFileProvider.h | 5c3ec1456c0f89fac53d193b7fa21a3acccc466e | [] | no_license | shermnonic/sdmvis | b7f18517631f6db04b54679e1935d22eb2254dbb | ec8ed51a181c968386c2d191175129c347777866 | refs/heads/master | 2022-12-17T22:34:01.959489 | 2020-09-25T19:32:56 | 2020-09-25T19:32:56 | 298,663,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,590 | h | TensorDataFileProvider.h | #ifndef TENSORDATAFILEPROVIDER_H
#define TENSORDATAFILEPROVIDER_H
#include "TensorDataProvider.h"
#include "TensorData.h"
#ifndef VTKPTR
#include <vtkSmartPointer.h>
#define VTKPTR vtkSmartPointer
#endif
// Forwards
class vtkImageData;
/// Thin wrapper around \a TensorData to load our custom raw tensor fileformat.
/// The old version of our custom fileformat had no notion of physical space.
/// As a workaround to give legacy support the ImageDataSpace can be explicitly
/// specified from the outside when calling \a setup().
class TensorDataFileProvider : public TensorDataProvider
{
public:
/// Load raw tensor data for reference volume. \deprecated
bool setup( const char* filename, VTKPTR<vtkImageData> refvol );
/// Load tensor data (in the new mxvol format)
bool setup( const char* filename );
protected:
/// Load raw tensor data of given dimensionality from disk.
/// (Note that the dimensionality may be overridden if one is given in
/// the tensor data file, i.e. if it is a MXVOL file.)
bool load( const char* filename, ImageDataSpace space );
///@{ Implementation of TensorDataProvider
virtual void getTensor( double x, double y, double z,
float (&tensor3x3)[9] );
virtual void getVector( double x, double y, double z,
float (&vec)[3] );
virtual bool isValidSamplePoint( double x, double y, double z );
///@}
private:
TensorData m_tdata;
VTKPTR<vtkImageData> m_refvol; // store reference image for thresholding
};
#endif // TENSORDATAFILEPROVIDER_H
|
7f16cfc121a68da718f5294b55a0cf027bf70862 | 0f20f7612184e447ae037606711ae9b208c5f8d6 | /ElasticFile/include/TEFileCursor.h | 4a8628ef94aae74597b0e442ab04c5c49da24a03 | [] | no_license | skalexey/elastic_file_framework | e5703a685b770827700d710bb43fd73598544573 | b12f11c06f4a83bda59fc2f1a102aea739980bbf | refs/heads/master | 2021-06-27T03:13:59.145963 | 2017-09-14T12:57:49 | 2017-09-14T12:57:49 | 103,531,413 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 951 | h | TEFileCursor.h | #pragma once
#include <efile_types.h>
class ElasticFile;
class TEFileCursor
{
public:
TEFileCursor(ElasticFile& file);
~TEFileCursor(void);
void SetPosition(const size_file_t& offset, TEFileCursorMoveMode mode);
const size_file_t& GetPosition();
void Update(TEFileSectorsList::iterator sector);
void Update(TEFileSectorsList::iterator sector, const size_file_t& offset_in_sector);
void Update(TEFileSectorsList::iterator sector, const size_file_t& offset_in_sector, const size_file_t& position);
TEFileSectorsList::iterator GetCurrentSector();
TEFileSectorsList::iterator GetSectorInPosition(const size_file_t& position, size_file_t& offset_in_sector);
TEFileSectorsList::iterator GetSectorInPosition2(const size_file_t& position, size_file_t& offset_in_sector);
const size_file_t& GetOffsetInSector();
private:
size_file_t m_position;
TEFileSectorsList::iterator m_sector;
size_file_t m_offset_in_sector;
ElasticFile& m_file;
};
|
1a52de63e132e087da4e6b2699bda1be570d959c | 3a7628f8de0697e920e013d6705f4e58aa45f341 | /源代码/YZCG/mainwindow.cpp | b5d35890c1fb5814163ecc94f8d41968fd34b5ce | [
"MIT"
] | permissive | mamatalim/YZCG | dfd6872acef377195de7be3fb4358db54af65c2b | 15b9cc7391606c2e5c09066c72c1fdfa204699d3 | refs/heads/master | 2022-06-02T12:06:37.606702 | 2019-08-16T09:08:11 | 2019-08-16T09:08:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,617 | cpp | mainwindow.cpp | #include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
initUI();
//DockWidget - ExplorerWidget
explorer = new ExplorerWidget;
QDockWidget *leftDock = new QDockWidget(tr("文件系统"),this);
leftDock->setAllowedAreas(Qt::LeftDockWidgetArea);
leftDock->setWidget(explorer);
addDockWidget(Qt::LeftDockWidgetArea,leftDock);
viewMenu->addAction(leftDock->toggleViewAction());
//DockWidget - DataContainer
dataContainer = new DataContainerWidget;
QDockWidget *rightDock = new QDockWidget(tr("可选数据"),this);
rightDock->setAllowedAreas(Qt::RightDockWidgetArea);
rightDock->setWidget(dataContainer);
addDockWidget(Qt::RightDockWidgetArea,rightDock);
viewMenu->addAction(rightDock->toggleViewAction());
mdiArea = new QMdiArea(this);
setCentralWidget(mdiArea);
connect(explorer,SIGNAL(requestViewFile(QString)),this,SLOT(viewFileSlot(QString)));
connect(explorer,SIGNAL(requestEditFile(QString)),this,SLOT(editFileSlot(QString)));
connect(explorer,SIGNAL(requestOpenProject(QString)),this,SLOT(openProjectSlot(QString)));
connect(explorer,SIGNAL(requestOpenData(QString)),dataContainer,SLOT(openDataSlot(QString)));
selectData = new SelectDataWidget;
selectData->hide();
selectData->setListViewModel(dataContainer->getModel());
}
bool MainWindow::createSubWindow(QString windowname)
{
if(windowname == "SpaceResection"){
resectionSlot();
}
if(windowname == "SpaceIntersection"){
interSectionSlot();
}
if(windowname == "RelativeOrientation"){
relativeSlot();
}
if(windowname == "AbsoluteOrientation"){
absoluteSlot();
}
return true;
}
void MainWindow::openProjectSlot()
{
QString filename = QFileDialog::getOpenFileName(this,tr("打开..."),"",tr("YZCG Project(*.ycp)"));
if(!filename.isEmpty()){
IO::readFromxmlFile(filename,this,mdiArea);
}
else{
return;
}
}
void MainWindow::saveProjectSlot()
{
if (!mdiArea->subWindowList().size())
return;
QString filename = QFileDialog::getSaveFileName(this,tr("保存..."),"",tr("YZCG Project(*.ycp)"));
if (!filename.isEmpty()){
QWidget *widget = static_cast<QWidget *>(mdiArea->activeSubWindow()->widget());
IO::save2xmlFile(widget,filename);
}
}
void MainWindow::exitSlot()
{
close();
}
void MainWindow::resectionSlot()
{
SpaceResectionWidget *widget = new SpaceResectionWidget;
connect(widget,SIGNAL(requestData(QWidget*,QString,int,int)),selectData,SLOT(requestDataSlot(QWidget*,QString,int,int)));
connect(selectData,SIGNAL(replyData(QWidget*,QString,QStringList,int,int)),widget,SLOT(replyDataSlot(QWidget*,QString,QStringList,int,int)));
createSubWindow(widget,"SpaceResection",tr("空间后方交会"));
}
void MainWindow::interSectionSlot()
{
SpaceIntersectionWidget *widget = new SpaceIntersectionWidget;
connect(widget,SIGNAL(requestData(QWidget*,QString,int,int)),selectData,SLOT(requestDataSlot(QWidget*,QString,int,int)));
connect(selectData,SIGNAL(replyData(QWidget*,QString,QStringList,int,int)),widget,SLOT(replyDataSlot(QWidget*,QString,QStringList,int,int)));
createSubWindow(widget,"SpaceIntersection",tr("空间前方交会"));
}
void MainWindow::relativeSlot()
{
RelativeOrientationWidget *widget = new RelativeOrientationWidget;
connect(widget,SIGNAL(requestData(QWidget*,QString,int,int)),selectData,SLOT(requestDataSlot(QWidget*,QString,int,int)));
connect(selectData,SIGNAL(replyData(QWidget*,QString,QStringList,int,int)),widget,SLOT(replyDataSlot(QWidget*,QString,QStringList,int,int)));
createSubWindow(widget,"RelativeOrientation",tr("相对定向"));
}
void MainWindow::absoluteSlot()
{
AbsoluteOrientationWidget *widget = new AbsoluteOrientationWidget;
connect(widget,SIGNAL(requestData(QWidget*,QString,int,int)),selectData,SLOT(requestDataSlot(QWidget*,QString,int,int)));
connect(selectData,SIGNAL(replyData(QWidget*,QString,QStringList,int,int)),widget,SLOT(replyDataSlot(QWidget*,QString,QStringList,int,int)));
createSubWindow(widget,"AbsoluteOrientation",tr("绝对定向"));
}
void MainWindow::pointLocationSlot()
{
PointLocation *pl = new PointLocation(this);
pl->setWindowTitle(tr("像点坐标量测 - YZCG "));
connect(pl->returnmView(),SIGNAL(addData(QStringList,int,int,QString,QString)),dataContainer,SLOT(addDataSlot(QStringList,int,int,QString,QString)));
pl->show();
}
void MainWindow::aboutSlot()
{
QMessageBox::about(this,tr("关于"),tr("<h2>作者:于留传<br>"
"指导老师:王仁礼<br>"
"学校:山东科技大学<br>"
"学号:201101180723<br>"
"班级:遥感科学与技术2011级1班<br>"
"Last Modified:2015-06-15 10:29</h2>"));
}
void MainWindow::aboutQtSlot()
{
qApp->aboutQt();
}
void MainWindow::viewFileSlot(const QString &filePath)
{
#ifdef QT_DEBUG
qDebug()<<"view File Slot";
#endif
FileViewer *viewer = new FileViewer(NULL,filePath);
viewer->show();
}
void MainWindow::editFileSlot(const QString &filePath)
{
#ifdef QT_DEBUG
qDebug()<<"edit File Slot";
qDebug()<<"File Type:" + QFileInfo(QFile(filePath)).suffix();
#endif
if(QFileInfo(QFile(filePath)).suffix() != "txt"){
QMessageBox::critical(this,tr("错误"),tr("不支持该类型文件的编辑!"),QMessageBox::Ok);
return;
}
TableEditWidget *widget = new TableEditWidget(filePath);
connect(widget,SIGNAL(addData2DataContainer(QStringList,int,int,QString,QString)),dataContainer,SLOT(addDataSlot(QStringList,int,int,QString,QString)));
widget->show();
}
void MainWindow::openProjectSlot(const QString &filepath)
{
IO::readFromxmlFile(filepath,this,mdiArea);
}
void MainWindow::updateLabel()
{
dateTimeLabel->setText(tr("<h3>%1</h3>").arg(QDateTime::currentDateTime().toString("yyyy-MM-d hh:mm:ss")));
}
void MainWindow::openUrl(QString url)
{
QDesktopServices::openUrl(url);
}
void MainWindow::initUI()
{
//menus
fileMenu = new QMenu(tr("文件"),this);
spaceMenu = new QMenu(tr("交会"),this);
orientationMenu = new QMenu(tr("定向"),this);
toolMenu = new QMenu(tr("工具"),this);
viewMenu = new QMenu(tr("窗口"),this);
helpMenu = new QMenu(tr("帮助"),this);
//actions
openProjectAction = new QAction(tr("打开"),this);
saveProjectAction = new QAction(tr("保存"),this);
exitAction = new QAction(tr("退出"),this);
resectionAction = new QAction(tr("空间后方交会"),this);
interSectionAction = new QAction(tr("空间前方交会"),this);
relativeAction = new QAction(tr("相对定向"),this);
absoluteAction = new QAction(tr("绝对定向"),this);
pointLocationAction = new QAction(tr("像点坐标量测"),this);
aboutAction = new QAction(tr("关于"),this);
aboutQtAction = new QAction(tr("关于Qt"),this);
fileMenu->addAction(openProjectAction);
fileMenu->addAction(saveProjectAction);
fileMenu->addAction(exitAction);
spaceMenu->addAction(resectionAction);
spaceMenu->addAction(interSectionAction);
orientationMenu->addAction(relativeAction);
orientationMenu->addAction(absoluteAction);
toolMenu->addAction(pointLocationAction);
helpMenu->addAction(aboutAction);
helpMenu->addAction(aboutQtAction);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(spaceMenu);
menuBar()->addMenu(orientationMenu);
menuBar()->addMenu(toolMenu);
menuBar()->addMenu(viewMenu);
menuBar()->addMenu(helpMenu);
connect(openProjectAction,SIGNAL(triggered()),this,SLOT(openProjectSlot()));
connect(saveProjectAction,SIGNAL(triggered()),this,SLOT(saveProjectSlot()));
connect(exitAction,SIGNAL(triggered()),this,SLOT(exitSlot()));
connect(resectionAction,SIGNAL(triggered()),this,SLOT(resectionSlot()));
connect(interSectionAction,SIGNAL(triggered()),this,SLOT(interSectionSlot()));
connect(relativeAction,SIGNAL(triggered()),this,SLOT(relativeSlot()));
connect(absoluteAction,SIGNAL(triggered()),this,SLOT(absoluteSlot()));
connect(pointLocationAction,SIGNAL(triggered()),this,SLOT(pointLocationSlot()));
connect(aboutAction,SIGNAL(triggered()),this,SLOT(aboutSlot()));
connect(aboutQtAction,SIGNAL(triggered()),this,SLOT(aboutQtSlot()));
//状态栏
bar = new QStatusBar(this);
authorLabel = new QLabel(tr("<style> a {text-decoration: none} </style><a href=\"http://user.qzone.qq.com/1096050539\"><h3><font color = blue>Author:yuliuchuan@RS2011.SDUST</font></h3></a>"),this);
connect(authorLabel,SIGNAL(linkActivated(QString)),this,SLOT(openUrl(QString)));
bar->addPermanentWidget(authorLabel,0);
dateTimeLabel = new QLabel(tr("<h3>%1</h3>").arg(QDateTime::currentDateTime().toString("yyyy-MM-d hh:mm:ss")),this);
timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(updateLabel()));
timer->start(1000);
bar->addWidget(dateTimeLabel,0);
this->setStatusBar(bar);
}
void MainWindow::createSubWindow(QWidget *widget, const QString &objName, const QString &title)
{
QMdiSubWindow *subWindow = new QMdiSubWindow(this);
subWindow->setObjectName(objName);
subWindow->setWindowTitle(title);
subWindow->setWidget(widget);
subWindow->setAttribute(Qt::WA_DeleteOnClose);
mdiArea->addSubWindow(subWindow);
subWindow->show();
}
|
406b6ea1399d037e0fa9f2efbe62d747a481d197 | 23e29dd9514bc137306f38515408a8ae45e5e076 | /test/pre_test.cpp | a433dafb657f7f997bf21326c6464a6a39c69c72 | [] | no_license | mokoing/kbqa2018 | 4383580b65576f7501f7aa32340e8cbe67a1e414 | ead08a7366bda5446dad4c0240dbee93f04043a7 | refs/heads/master | 2020-04-08T10:29:34.052553 | 2018-03-02T06:31:46 | 2018-03-02T06:31:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,260 | cpp | pre_test.cpp | #include <iostream>
#include "utils.h"
#include <pthread.h>
#include "logger.h"
#include "preprocessor.h"
preprocess_dict* pdict;
pthread_mutex_t global_mutex;
int qid;
void* run_preprocess_thread(void* dict){
Question question;
Preprocessor thread;
if (thread.thread_init() != 0){
Logger::logging("thread init error", "ERROR");
return NULL;
}
std::string line;
while(1){
pthread_mutex_lock(&global_mutex);
if (std::cin.eof() || !std::getline(std::cin, line)){
pthread_mutex_unlock(&global_mutex);
break;
}
question.qid = qid++;
pthread_mutex_unlock(&global_mutex);
question.original_sent = line;
int ret = thread.preprocess(question, pdict);
if (ret != 0){
Logger::logging("preprocessing error!", "ERROR");
break;
}
std::string ostr;
std::string tmp_str;
ostr = question.original_sent + "\n" + question.lower_sent + "\n" +
question.question_sent + "\n";
Utils::join(question.word_seg, " ||| ", tmp_str);
ostr += tmp_str + "\n";
Utils::join(question.char_vec, " ||| ", tmp_str);
ostr += tmp_str + "\n";
for (int i = 0; i < question.char_seg.size(); ++i){
Utils::join(question.char_seg[i], " | ", tmp_str);
ostr += tmp_str;
if (i == question.char_seg.size() - 1){
ostr += "\n";
}else{
ostr += " ||| ";
}
}
pthread_mutex_lock(&global_mutex);
std::cout << "qid: " << question.qid << "\n" << ostr << "\n";
pthread_mutex_unlock(&global_mutex);
}
thread.thread_destroy();
}
int main(int argc, char *argv[]){
pthread_mutex_init(&global_mutex, NULL);
pthread_t pids[20];
int thread_num = 1;
if (argc < 2){
Logger::logging("arguement error !", "ERROR");
return -1;
}
if (argc >= 3){
thread_num = Utils::str2int(argv[2]);
}
pdict = Preprocessor::global_init(argv[1]);
if (pdict == NULL){
Logger::logging("global init error !", "ERROR");
return -1;
}
for (int i = 0; i < thread_num; ++i){
if (pthread_create(&pids[i], 0, run_preprocess_thread, NULL) != 0){
Logger::logging("pthread init error", "ERROR");
return -1;
}
}
for (int i = 0; i < thread_num; ++i){
pthread_join(pids[i], NULL);
}
Preprocessor::global_destroy(pdict);
return 0;
}
|
71d515c7b9eea61c1d01b275e4355d16f770068a | 0271b7f67d29e0aaedb60f7d917c083515ccd0fe | /Contests/Codeforces/Codeforces Round #560 (Div. 3)/a-remainder.cpp | aa5b264b7529265bef9c5b127930211663fb5f8d | [
"MIT"
] | permissive | Pradyuman7/AwesomeDataStructuresAndAlgorithms | bfe1f335487f3f9ed94bb68073c0f29766738ea8 | 6d995c7a3ce2a227733b12b1749de647c5172e8e | refs/heads/master | 2020-04-06T17:33:05.673731 | 2019-10-07T10:46:36 | 2019-10-07T10:46:36 | 157,664,451 | 7 | 0 | MIT | 2019-07-19T06:40:45 | 2018-11-15T06:39:53 | Java | UTF-8 | C++ | false | false | 449 | cpp | a-remainder.cpp | #include<math.h>
#include<iostream>
using namespace std;
int main()
{
int n,x,y;
cin>>n>>x>>y;
char num[n];
for(int i=0;i<n;i++)
cin>>num[i];
int steps=0;
for(int i=n-1;i>n-1-x;i--)
{
// cout<<i<<" "<<num[i]<<" ";
if(n-1-i==y)
{
if(num[i]!='1')
{
steps++;
// cout<<"inc\n";
}
}
else
{
if(num[i]!='0')
{
steps++;
// cout<<"inc2\n";
}
}
}
cout<<steps;
return 0;
}
|
7ca2e2d5d410256fecfffc7fcd04b95c963b3a0b | 51635684d03e47ebad12b8872ff469b83f36aa52 | /external/gcc-12.1.0/gcc/genextract.cc | 6259cb57908399e1bb5f52eba8e6b34eed2cb8cf | [
"Zlib",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"FSFAP",
"LGPL-3.0-only",
"GPL-3.0-only",
"GPL-2.0-only",
"GCC-exception-3.1",
"LGPL-2.0-or-later"
] | 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 | 13,101 | cc | genextract.cc | /* Generate code from machine description to extract operands from insn as rtl.
Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
/* This structure contains all the information needed to describe one
set of extractions methods. Each method may be used by more than
one pattern if the operands are in the same place.
The string for each operand describes that path to the operand and
contains `0' through `9' when going into an expression and `a' through
`z' then 'A' through to 'Z' when going into a vector. We assume here that
only the first operand of an rtl expression is a vector. genrecog.cc makes
the same assumption (and uses the same representation) and it is currently
true. */
typedef char *locstr;
struct extraction
{
unsigned int op_count;
unsigned int dup_count;
locstr *oplocs;
locstr *duplocs;
int *dupnums;
struct code_ptr *insns;
struct extraction *next;
};
/* Holds a single insn code that uses an extraction method. */
struct code_ptr
{
int insn_code;
struct code_ptr *next;
};
/* All extractions needed for this machine description. */
static struct extraction *extractions;
/* All insn codes for old-style peepholes. */
static struct code_ptr *peepholes;
/* This structure is used by gen_insn and walk_rtx to accumulate the
data that will be used to produce an extractions structure. */
class accum_extract
{
public:
accum_extract () : oplocs (10), duplocs (10), dupnums (10), pathstr (20) {}
auto_vec<locstr> oplocs;
auto_vec<locstr> duplocs;
auto_vec<int> dupnums;
auto_vec<char> pathstr;
};
/* Forward declarations. */
static void walk_rtx (md_rtx_info *, rtx, class accum_extract *);
#define UPPER_OFFSET ('A' - ('z' - 'a' + 1))
/* Convert integer OPERAND into a character - either into [a-zA-Z] for vector
operands or [0-9] for integer operands - and push onto the end of the path
in ACC. */
static void
push_pathstr_operand (int operand, bool is_vector,
class accum_extract *acc)
{
if (is_vector && 'a' + operand > 'z')
acc->pathstr.safe_push (operand + UPPER_OFFSET);
else if (is_vector)
acc->pathstr.safe_push (operand + 'a');
else
acc->pathstr.safe_push (operand + '0');
}
static void
gen_insn (md_rtx_info *info)
{
int i;
unsigned int op_count, dup_count, j;
struct extraction *p;
struct code_ptr *link;
class accum_extract acc;
/* Walk the insn's pattern, remembering at all times the path
down to the walking point. */
rtx insn = info->def;
if (XVECLEN (insn, 1) == 1)
walk_rtx (info, XVECEXP (insn, 1, 0), &acc);
else
for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
{
push_pathstr_operand (i, true, &acc);
walk_rtx (info, XVECEXP (insn, 1, i), &acc);
acc.pathstr.pop ();
}
link = XNEW (struct code_ptr);
link->insn_code = info->index;
/* See if we find something that already had this extraction method. */
op_count = acc.oplocs.length ();
dup_count = acc.duplocs.length ();
gcc_assert (dup_count == acc.dupnums.length ());
for (p = extractions; p; p = p->next)
{
if (p->op_count != op_count || p->dup_count != dup_count)
continue;
for (j = 0; j < op_count; j++)
{
char *a = p->oplocs[j];
char *b = acc.oplocs[j];
if (a != b && (!a || !b || strcmp (a, b)))
break;
}
if (j != op_count)
continue;
for (j = 0; j < dup_count; j++)
if (p->dupnums[j] != acc.dupnums[j]
|| strcmp (p->duplocs[j], acc.duplocs[j]))
break;
if (j != dup_count)
continue;
/* This extraction is the same as ours. Just link us in. */
link->next = p->insns;
p->insns = link;
return;
}
/* Otherwise, make a new extraction method. We stash the arrays
after the extraction structure in memory. */
p = XNEWVAR (struct extraction, sizeof (struct extraction)
+ op_count*sizeof (char *)
+ dup_count*sizeof (char *)
+ dup_count*sizeof (int));
p->op_count = op_count;
p->dup_count = dup_count;
p->next = extractions;
extractions = p;
p->insns = link;
link->next = 0;
p->oplocs = (char **)((char *)p + sizeof (struct extraction));
p->duplocs = p->oplocs + op_count;
p->dupnums = (int *)(p->duplocs + dup_count);
memcpy (p->oplocs, acc.oplocs.address (), op_count * sizeof (locstr));
memcpy (p->duplocs, acc.duplocs.address (), dup_count * sizeof (locstr));
memcpy (p->dupnums, acc.dupnums.address (), dup_count * sizeof (int));
}
/* Helper subroutine of walk_rtx: given a vec<locstr>, an index, and a
string, insert the string at the index, which should either already
exist and be NULL, or not yet exist within the vector. In the latter
case the vector is enlarged as appropriate. INFO describes the
containing define_* expression. */
static void
VEC_safe_set_locstr (md_rtx_info *info, vec<locstr> *vp,
unsigned int ix, char *str)
{
if (ix < (*vp).length ())
{
if ((*vp)[ix])
{
message_at (info->loc, "repeated operand number %d", ix);
have_error = 1;
}
else
(*vp)[ix] = str;
}
else
{
while (ix > (*vp).length ())
vp->safe_push (NULL);
vp->safe_push (str);
}
}
/* Another helper subroutine of walk_rtx: given a vec<char>, convert it
to a NUL-terminated string in malloc memory. */
static char *
VEC_char_to_string (const vec<char> &v)
{
size_t n = v.length ();
char *s = XNEWVEC (char, n + 1);
memcpy (s, v.address (), n);
s[n] = '\0';
return s;
}
static void
walk_rtx (md_rtx_info *info, rtx x, class accum_extract *acc)
{
RTX_CODE code;
int i, len;
const char *fmt;
if (x == 0)
return;
code = GET_CODE (x);
switch (code)
{
case PC:
case CONST_INT:
case SYMBOL_REF:
return;
case MATCH_OPERAND:
case MATCH_SCRATCH:
VEC_safe_set_locstr (info, &acc->oplocs, XINT (x, 0),
VEC_char_to_string (acc->pathstr));
break;
case MATCH_OPERATOR:
case MATCH_PARALLEL:
VEC_safe_set_locstr (info, &acc->oplocs, XINT (x, 0),
VEC_char_to_string (acc->pathstr));
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
{
push_pathstr_operand (i, code != MATCH_OPERATOR, acc);
walk_rtx (info, XVECEXP (x, 2, i), acc);
acc->pathstr.pop ();
}
return;
case MATCH_DUP:
case MATCH_PAR_DUP:
case MATCH_OP_DUP:
acc->duplocs.safe_push (VEC_char_to_string (acc->pathstr));
acc->dupnums.safe_push (XINT (x, 0));
if (code == MATCH_DUP)
break;
for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
{
push_pathstr_operand (i, code != MATCH_OP_DUP, acc);
walk_rtx (info, XVECEXP (x, 1, i), acc);
acc->pathstr.pop ();
}
return;
default:
break;
}
fmt = GET_RTX_FORMAT (code);
len = GET_RTX_LENGTH (code);
for (i = 0; i < len; i++)
{
if (fmt[i] == 'e' || fmt[i] == 'u')
{
push_pathstr_operand (i, false, acc);
walk_rtx (info, XEXP (x, i), acc);
acc->pathstr.pop ();
}
else if (fmt[i] == 'E')
{
int j;
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
{
push_pathstr_operand (j, true, acc);
walk_rtx (info, XVECEXP (x, i, j), acc);
acc->pathstr.pop ();
}
}
}
}
/* Given a PATH, representing a path down the instruction's
pattern from the root to a certain point, output code to
evaluate to the rtx at that point. */
static void
print_path (const char *path)
{
int len = strlen (path);
int i;
if (len == 0)
{
/* Don't emit "pat", since we may try to take the address of it,
which isn't what is intended. */
fputs ("PATTERN (insn)", stdout);
return;
}
/* We first write out the operations (XEXP or XVECEXP) in reverse
order, then write "pat", then the indices in forward order. */
for (i = len - 1; i >= 0 ; i--)
{
if (ISLOWER (path[i]) || ISUPPER (path[i]))
fputs ("XVECEXP (", stdout);
else if (ISDIGIT (path[i]))
fputs ("XEXP (", stdout);
else
gcc_unreachable ();
}
fputs ("pat", stdout);
for (i = 0; i < len; i++)
{
if (ISUPPER (path[i]))
printf (", 0, %d)", path[i] - UPPER_OFFSET);
else if (ISLOWER (path[i]))
printf (", 0, %d)", path[i] - 'a');
else if (ISDIGIT (path[i]))
printf (", %d)", path[i] - '0');
else
gcc_unreachable ();
}
}
static void
print_header (void)
{
/* N.B. Code below avoids putting squiggle braces in column 1 inside
a string, because this confuses some editors' syntax highlighting
engines. */
puts ("\
/* Generated automatically by the program `genextract'\n\
from the machine description file `md'. */\n\
\n\
#define IN_TARGET_CODE 1\n\
#include \"config.h\"\n\
#include \"system.h\"\n\
#include \"coretypes.h\"\n\
#include \"tm.h\"\n\
#include \"rtl.h\"\n\
#include \"insn-config.h\"\n\
#include \"recog.h\"\n\
#include \"diagnostic-core.h\"\n\
\n\
/* This variable is used as the \"location\" of any missing operand\n\
whose numbers are skipped by a given pattern. */\n\
static rtx junk ATTRIBUTE_UNUSED;\n");
puts ("\
void\n\
insn_extract (rtx_insn *insn)\n{\n\
rtx *ro = recog_data.operand;\n\
rtx **ro_loc = recog_data.operand_loc;\n\
rtx pat = PATTERN (insn);\n\
int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\
\n\
if (flag_checking)\n\
{\n\
memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\
memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\
}\n");
puts ("\
switch (INSN_CODE (insn))\n\
{\n\
default:\n\
/* Control reaches here if insn_extract has been called with an\n\
unrecognizable insn (code -1), or an insn whose INSN_CODE\n\
corresponds to a DEFINE_EXPAND in the machine description;\n\
either way, a bug. */\n\
if (INSN_CODE (insn) < 0)\n\
fatal_insn (\"unrecognizable insn:\", insn);\n\
else\n\
fatal_insn (\"insn with invalid code number:\", insn);\n");
}
int
main (int argc, const char **argv)
{
unsigned int i;
struct extraction *p;
struct code_ptr *link;
const char *name;
progname = "genextract";
if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
/* Read the machine description. */
md_rtx_info info;
while (read_md_rtx (&info))
switch (GET_CODE (info.def))
{
case DEFINE_INSN:
gen_insn (&info);
break;
case DEFINE_PEEPHOLE:
{
struct code_ptr *link = XNEW (struct code_ptr);
link->insn_code = info.index;
link->next = peepholes;
peepholes = link;
}
break;
default:
break;
}
if (have_error)
return FATAL_EXIT_CODE;
print_header ();
/* Write out code to handle peepholes and the insn_codes that it should
be called for. */
if (peepholes)
{
for (link = peepholes; link; link = link->next)
printf (" case %d:\n", link->insn_code);
/* The vector in the insn says how many operands it has.
And all it contains are operands. In fact, the vector was
created just for the sake of this function. We need to set the
location of the operands for sake of simplifications after
extraction, like eliminating subregs. */
puts (" for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)\n"
" ro[i] = *(ro_loc[i] = &XVECEXP (pat, 0, i));\n"
" break;\n");
}
/* Write out all the ways to extract insn operands. */
for (p = extractions; p; p = p->next)
{
for (link = p->insns; link; link = link->next)
{
i = link->insn_code;
name = get_insn_name (i);
if (name)
printf (" case %d: /* %s */\n", i, name);
else
printf (" case %d:\n", i);
}
for (i = 0; i < p->op_count; i++)
{
if (p->oplocs[i] == 0)
{
printf (" ro[%d] = const0_rtx;\n", i);
printf (" ro_loc[%d] = &junk;\n", i);
}
else
{
printf (" ro[%d] = *(ro_loc[%d] = &", i, i);
print_path (p->oplocs[i]);
puts (");");
}
}
for (i = 0; i < p->dup_count; i++)
{
printf (" recog_data.dup_loc[%d] = &", i);
print_path (p->duplocs[i]);
puts (";");
printf (" recog_data.dup_num[%d] = %d;\n", i, p->dupnums[i]);
}
puts (" break;\n");
}
puts (" }\n}");
fflush (stdout);
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
}
|
f03fe2868479a8f5bd1fabb6829b96b0bff5c135 | d46781119d149425c22352155987a2d984c7b230 | /src/settings.cpp | 2ce6934d1858b07d3240a2d6c0597870e6f269d5 | [] | no_license | LZP-2020-1-0200/Niagara2 | e94d2b6f6e751eee0c49b117d327637957958025 | 1da409ad22f525b379e30af485c0154e43e8c251 | refs/heads/main | 2023-04-15T21:08:01.368824 | 2021-04-19T13:24:03 | 2021-04-19T13:24:03 | 345,391,538 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 694 | cpp | settings.cpp | #include "settings.h"
#include "LittleFS.h"
#include "buffers.h"
Settings settings;
Settings::Settings(/* args */)
{
}
void Settings::load(void)
{
Serial.begin(DEFAULT_BAUD);
if (LittleFS.begin())
{
File f = LittleFS.open("/banner.txt", "r");
if (!f)
{
Serial.println(F("banner.txt file open failed"));
}
else
{
int n = 0;
do
{
n = f.readBytes(tmp.buf(), tmp.len);
Serial.write(tmp.buf(), n);
} while (n == tmp.len);
f.close();
}
}
else
Serial.println(F("LittleFS failed"));
}
Settings::~Settings()
{
}
|
5bc564e16b24c4a9f29820265b08d14a7067616b | 377d69a058a0b5a1c66352fe7d5f27c9ef99a987 | /14_dynamic_programming/exercises/14.1-4.cpp | 462ed993999ba6929e08873cc060940cd5ff5921 | [
"Apache-2.0"
] | permissive | frozenca/CLRS | 45782d67343eb285f2d95d8c25184b9973079e65 | 408a86c4c0ec7d106bdaa6f5526b186df9f65c2e | refs/heads/main | 2022-09-24T14:55:38.542993 | 2022-09-12T02:59:10 | 2022-09-12T02:59:10 | 337,278,655 | 55 | 15 | null | null | null | null | UTF-8 | C++ | false | false | 318 | cpp | 14.1-4.cpp | #include <14_dynamic_programming/inc/easy.h>
#include <iostream>
#include <vector>
int main() {
namespace fc = frozenca;
using namespace std;
vector<fc::index_t> p{1, 5, 8, 9, 10, 17, 17, 20, 24, 30};
cout << fc::cut_rod_memoized(p) << '\n';
cout << fc::cut_rod_memoized_half(p) << '\n';
} |
506679c9af7f3bd4d8435f942fbb055e0d6687d6 | 581d6eeb48dbd442dca27c1fa83689c58ffea2c9 | /Sources/Elastos/LibCore/src/elastos/net/CInet6AddressHelper.cpp | 5a3eed28f5b7674cda2ef2bde150cf26cbc22aec | [
"Apache-2.0"
] | permissive | TheTypoMaster/ElastosRDK5_0 | bda12b56271f38dfb0726a4b62cdacf1aa0729a7 | e59ba505e0732c903fb57a9f5755d900a33a80ab | refs/heads/master | 2021-01-20T21:00:59.528682 | 2015-09-19T21:29:08 | 2015-09-19T21:29:08 | 42,790,116 | 0 | 0 | null | 2015-09-19T21:23:27 | 2015-09-19T21:23:26 | null | UTF-8 | C++ | false | false | 778 | cpp | CInet6AddressHelper.cpp |
#include "CInet6AddressHelper.h"
#include "CInet6Address.h"
namespace Elastos {
namespace Net {
CAR_INTERFACE_IMPL(CInet6AddressHelper, Singleton, IInet6AddressHelper)
CAR_SINGLETON_IMPL(CInet6AddressHelper)
ECode CInet6AddressHelper::GetByAddress(
/* [in] */ const String& host,
/* [in] */ ArrayOf<Byte>* addr,
/* [in] */ Int32 scope_id,
/* [out] */ IInet6Address** address)
{
return CInet6Address::GetByAddress(host, addr, scope_id, address);
}
ECode CInet6AddressHelper::GetByAddress(
/* [in] */ const String& host,
/* [in] */ ArrayOf<Byte>* addr,
/* [in] */ INetworkInterface* nif,
/* [out] */ IInet6Address** address)
{
return CInet6Address::GetByAddress(host, addr, nif, address);
}
} // namespace Net
} // namespace Elastos
|
12b9cd1e6fdc67d2c92dd8712cac12b17593df89 | ec6b160394c66ab8731646518fcce620ee2abe8a | /leetcode/122. Best Time to Buy and Sell Stock II.cpp | 2843211c1110ad3c74f12f07fc072ed1b05fb5f8 | [] | no_license | LilySpark/Algorithm | d4e251c56e3a9ed76496409042d251652efc0000 | f9a4e3f5ca9479dfdde2feeabd4f44976662ee9b | refs/heads/master | 2021-01-10T16:55:41.835979 | 2016-04-10T06:14:43 | 2016-04-10T06:14:43 | 50,002,104 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 820 | cpp | 122. Best Time to Buy and Sell Stock II.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
本题由于是可以操作任意次数,只为获得最大收益,而且对于一个上升子序列,
比如:[5, 1, 2, 3, 4]中的1, 2, 3, 4序列来说,对于两种操作方案:
1 在1买入,4卖出
2 在1买入,2卖出同时买入,3卖出同时买入,4卖出
这两种操作下,收益是一样的。
所以可以从头到尾扫描prices,如果price[i] – price[i-1]大于零则计入最后的收益中。
即贪心法
*/
class Solution {
public:
int maxProfit(vector<int>& prices) {
int profit = 0;
for(int i = 1; i < prices.size(); i++)
{
if(prices[i] > prices[i-1])
profit += prices[i] - prices[i-1];
}
return profit;
}
};
|
725c729d44bd23ad43c809574af60a1b4b8655be | 1ee212a65c442fc16b4b0d39d58c726fb8b9305e | /Appartement.cpp | 38ed0f7e1fc7327418931438148b35a29f7e5acd | [] | no_license | MarinaBoudin/POO_agence | bd27fe222f454cc77d1d8d391ac69640818db184 | 0ab5a4819980c697dbd36a755658062753fec20e | refs/heads/master | 2020-04-26T23:35:02.667137 | 2019-04-19T17:40:49 | 2019-04-19T17:40:49 | 173,906,683 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,861 | cpp | Appartement.cpp | #include "Appartement.h"
#include "Adresse.h"
#include "Bien.h"
#include "Acheteur.h"
#include <iostream>
#include <map>
#include <vector>
using namespace std;
Appartement::Appartement(Adresse _adresse, int _prix, int _m2, int _ref_client, int _pieces, int _etage, bool _garage,
bool _cave, bool _balcon,
int _nb_appart) : Bien(_adresse, _prix, _m2, _ref_client) {
pieces = _pieces;
etage = _etage;
garage = _garage;
cave = _cave;
balcon = _balcon;
nb_appart = _nb_appart;
}
int Appartement::get_etage() {
return etage;
}
bool Appartement::get_garage() {
return garage;
}
bool Appartement::get_cave() {
return cave;
}
bool Appartement::get_balcon() {
return balcon;
}
int Appartement::get_nb_appart() {
return nb_appart;
}
void Appartement::affiche(){
cout << "Type : APPARTEMENT" << endl;
Bien::affiche();
cout << "Nombre de pièces : " << pieces << endl;
cout << "Etages où se trouve l'appartement : " << etage << endl;
if (garage==true){
cout << "Présence d'un garage." << endl;
}
if (cave==true){
cout << "Présence d'une cave." << endl;
}
if (balcon==true){
cout << "Présence d'un balcon." << endl;
}
cout << "Nombre d'appartement dans l'immeuble : " << nb_appart << "\n"<< endl;
}
void Appartement::recherche(){
cout << "PIECES -> Entrez le nombre de pièces minimales :" << endl;
int choixpieces;
cin >> choixpieces;
cout << "BALCON -> Oui(1) ou Non(2)" << endl;
int choixbalcon;
cin >> choixbalcon;
cout << " Ci-dessous, la liste des biens correspondant à votre recherche :\n" << endl;
if ((pieces <= choixpieces) || (choixpieces==0)){
if ((choixbalcon==0) || ((choixbalcon==1) && (balcon==true))){
cout << "\n#######\n" << endl;
affiche();
cout << "\n" << endl;
}
}
}
|
75cce054069e7c12353e69cc2949640824c48930 | f0d46b324b0123f5e7f0b290136e1a149db57c58 | /components/phase_space_sheet/sheets_macros.h | 7deda1e58669d4eb521ff90f740cd2e947556cfb | [
"MIT"
] | permissive | cwru-pat/cosmograph | 916713097013ccc25885a4d62d7a2595106fff99 | dbd0cb1014666ad47fbbb48831989a1b79923eb0 | refs/heads/master | 2023-08-10T17:46:12.066807 | 2019-10-21T21:05:44 | 2019-10-21T21:05:44 | 20,486,997 | 9 | 2 | MIT | 2019-10-21T20:31:18 | 2014-06-04T14:31:45 | C++ | UTF-8 | C++ | false | false | 2,695 | h | sheets_macros.h | #ifndef SHEET_MACROS
#define SHEET_MACROS
#define SET_GAMMAI_DER_ZERO(I) \
d##I##gammai11_a(i, j, k) = 0.0; \
d##I##gammai22_a(i, j, k) = 0.0; \
d##I##gammai33_a(i, j, k) = 0.0; \
d##I##gammai12_a(i, j, k) = 0.0; \
d##I##gammai13_a(i, j, k) = 0.0; \
d##I##gammai23_a(i, j, k) = 0.0
#define SET_GAMMAI_DER(I) \
d##I##gammai11_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai11 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma22_a) + derivative(i, j, k, I, DIFFgamma33_a) - 2.0*DIFFgamma23_a(i, j, k)*derivative(i, j, k, I, DIFFgamma23_a) + derivative(i, j, k, I, DIFFgamma22_a)*DIFFgamma33_a(i, j, k) + DIFFgamma22_a(i, j, k)*derivative(i, j, k, I, DIFFgamma33_a)); \
\
d##I##gammai22_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai22 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma11_a) + derivative(i, j, k, I, DIFFgamma33_a) - 2.0*DIFFgamma13_a(i, j, k)*derivative(i, j, k, I, DIFFgamma13_a) + derivative(i, j, k, I, DIFFgamma11_a)*DIFFgamma33_a(i, j, k) + DIFFgamma11_a(i, j, k)*derivative(i, j, k, I, DIFFgamma33_a)); \
\
d##I##gammai33_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai33 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma11_a) + derivative(i, j, k, I, DIFFgamma22_a) - 2.0*DIFFgamma12_a(i,j,k)*derivative(i, j, k, I, DIFFgamma12_a) + derivative(i, j, k, I, DIFFgamma11_a)*DIFFgamma22_a(i, j, k) + DIFFgamma11_a(i, j, k)*derivative(i, j, k, I, DIFFgamma22_a)); \
\
d##I##gammai12_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai12 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma13_a)*DIFFgamma23_a(i, j, k) + DIFFgamma13_a(i, j, k)*derivative(i, j, k, I, DIFFgamma23_a) - derivative(i, j, k, I, DIFFgamma12_a)*(1.0 + DIFFgamma33_a(i, j, k)) - DIFFgamma12_a(i, j, k)*derivative(i, j, k, I, DIFFgamma33_a)); \
\
d##I##gammai13_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai13 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma12_a)*DIFFgamma23_a(i, j, k) + DIFFgamma12_a(i, j, k)*derivative(i, j, k, I, DIFFgamma23_a) - derivative(i, j, k, I, DIFFgamma13_a)*(1.0 + DIFFgamma22_a(i, j, k)) - DIFFgamma13_a(i, j, k)*derivative(i, j, k, I, DIFFgamma22_a)); \
\
d##I##gammai23_a(i, j, k) = -4.0*derivative(i, j, k, I, DIFFphi_a)*gammai23 \
+ std::exp(-4.0*DIFFphi_a(i, j, k))*(derivative(i, j, k, I, DIFFgamma12_a)*DIFFgamma13_a(i, j, k) + DIFFgamma12_a(i, j, k)*derivative(i, j, k, I, DIFFgamma13_a) - derivative(i, j, k, I, DIFFgamma23_a)*(1.0 + DIFFgamma11_a(i, j, k)) - DIFFgamma23_a(i, j, k)*derivative(i, j, k, I, DIFFgamma11_a))
#endif
|
ae85b407bfdaa9d705159926442a38306827e08f | aa560fae08d07b3eae4b9abfa4039e270d84ea4c | /SocketService/socketservice.cpp | fbbb0b99a346db911baa4785c5758afdfa650ef8 | [] | no_license | 519984307/ContainerOfMiddleware_20201113 | 2ac404b8d171f140ae8ebe83a2642c26d22cbfd7 | 9d0b04d8fe80c2a0e7e79520a54b49f9da639dad | refs/heads/master | 2023-05-31T09:07:24.713056 | 2021-07-07T07:27:07 | 2021-07-07T07:27:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,552 | cpp | socketservice.cpp | #include "socketservice.h"
SocketService::SocketService(QObject *parent)
{
this->setParent(parent);
heartBeat=false;
isConnected=false;
pTcpServer=nullptr;
pTcpSocket=nullptr;
pTimerLink=nullptr;
}
SocketService::~SocketService()
{
if(pTcpSocket!=nullptr){
pTcpSocket->abort();
}
if(pTcpServer!=nullptr){
pTcpServer->close();
}
delete pTcpServer;
delete pTcpSocket;
delete pTimerLink;
pTcpServer=nullptr;
pTcpSocket=nullptr;
pTimerLink=nullptr;
}
void SocketService::InitializationParameterSlot(const QString &address, const quint16 &port, const int &serviceType,const int& serviceMode)
{
this->address=address;
this->port=port;
if(serviceMode==1){/* 服务器模式 */
pTcpServer=new SocketServer (this);
pTcpServer->setServiceType(serviceType);/* 设置服务模式 */
/* 日志信息 */
connect(pTcpServer,&SocketServer::messageSignal,this,&SocketService::messageSignal);
/* 心跳包状态设置 */
connect(this,&SocketService::sendHeartPacketSignal,pTcpServer,&SocketServer::sendHeartPacketSlot);
/* 绑定客户端数量 */
connect(pTcpServer,&SocketServer::socketConnectCountSignal,this,&SocketService::socketConnectCountSignal);
/* 发送识别结果 */
connect(this,&SocketService::sendResultSignal,pTcpServer,&SocketServer::sendResultSlot);
startListen();
}
else if (serviceMode==0) {/* 客户端模式 */
pTcpSocket=new QTcpSocket(this);
pTimerLink=new QTimer (this);
/* 发送识别结果 */
connect(this,&SocketService::sendResultSignal,this,&SocketService::sendResultSlot);
/* 心跳包状态设置 */
connect(this,&SocketService::sendHeartPacketSignal,this,&SocketService::sendHeartPacketSlot);
connect(pTcpSocket,&QIODevice::readyRead,this,&SocketService::readFortune);
connect(pTcpSocket,&QAbstractSocket::connected,this,&SocketService::connected);
connect(pTcpSocket,&QAbstractSocket::disconnected,this,&SocketService::disconnected);
connect(pTcpSocket,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),this,&SocketService::displayError);
connect(pTimerLink,&QTimer::timeout,this,&SocketService::heartbeatSlot);
startLink();
}
}
void SocketService::startLink()
{
if(!isConnected){
pTcpSocket->abort();
pTcpSocket->connectToHost(address,port);
// if(!pTcpSocket->waitForConnected(1000)){
// displayError(pTcpSocket->error());
// }
}
}
void SocketService::startListen()
{
if(!pTcpServer->listen(QHostAddress::AnyIPv4,port)){/* 服务器使用本机地址 */
emit messageSignal(ZBY_LOG("ERROR"),tr("IP:%1 Listen Error<errocCode=%2>").arg(QHostAddress::AnyIPv4).arg(pTcpServer->errorString()));
}
else {
emit messageSignal(ZBY_LOG("INFO"),tr("IP:%1 Start Listen.").arg(QHostAddress::AnyIPv4));
}
}
void SocketService::heartbeatSlot()
{
if(heartBeat){
if(pTcpSocket->isOpen()){
pTcpSocket->write("[H]");/* 心跳包数据 */
}
}
}
void SocketService::connected()
{
isConnected=true;
if(!pTimerLink->isActive()){
pTimerLink->start(15000);
}
emit socketConnectCountSignal(1);
emit messageSignal(ZBY_LOG("INFO"), tr("IP:%1:%2 Socket Link Successful").arg(address).arg(port));
emit socketLinkStateSingal(address,true);
}
void SocketService::readFortune()
{
/* 读取服务器数据 */
QByteArray buf=pTcpSocket->readAll();
if (buf.indexOf("[R")!=-1) {/* 找到取结果标志位 */
if(pTcpSocket->isOpen()){
pTcpSocket->write(resultOfMemory.toLocal8Bit());/* 重新发送 */
}
}
else{
if(pTcpSocket->isOpen()){
emit socketReadDataSignal(buf);
}
}
emit messageSignal(ZBY_LOG("INFO"),buf);
}
void SocketService::socketSendDataSlot(const QString &data)
{
if(pTcpSocket->isOpen()){
pTcpSocket->write(data.toLocal8Bit());
}
}
void SocketService::disconnected()
{
isConnected=false;
emit socketConnectCountSignal(-1);
emit socketLinkStateSingal(address,false);
}
void SocketService::displayError(QAbstractSocket::SocketError socketError)
{
//emit socketLinkStateSingal(address,false);
isConnected=false;
QTimer::singleShot(15000, this, SLOT(startLink()));
emit messageSignal(ZBY_LOG("ERROR"), tr("IP:%1:%3 Socket Error<errorCode=%2>").arg(address).arg(socketError).arg(port));
}
void SocketService::sendHeartPacketSlot(bool state)
{
heartBeat=state;
}
void SocketService::releaseResourcesSlot()
{
if(pTcpSocket!=nullptr){
pTcpSocket->abort();
}
isConnected=false;
if(pTimerLink!=nullptr && pTimerLink->isActive()){
pTimerLink->stop();
}
if(pTcpServer!=nullptr){
pTcpServer->releaseResourcesSlot();
}
}
void SocketService::sendResultSlot(int channel, const QString &result)
{
//QString ret=QString("%1\n\r").arg(result);
resultOfMemory=result;/* 存储结果,用于主动获取 */
if(pTcpSocket->isOpen()){
pTcpSocket->write(result.toLocal8Bit());
/*****************************
* @brief:发送完成主动断开
******************************/
pTcpSocket->waitForBytesWritten();
pTcpSocket->abort();
pTcpSocket->close();
QTimer::singleShot(10000,this,SLOT(startLink()));
}
}
|
5cd7415fd538228ebb01098255ac5ef1ad7a4b36 | aa9efd961d751b33f64531a908f8b5b650b24f48 | /Network/TCPClientConnection.cpp | a19392f525b2e0051d2ed8b7f9d1a92b50e0a2ec | [] | no_license | gaper94/LoveLetter | f91ab6e9e86c9ceb3ef9b38c4760b261aad7d984 | 73395d2e79a0f13480c073e6ff19f815aa36d230 | refs/heads/master | 2020-03-09T22:34:45.390357 | 2018-04-21T16:05:44 | 2018-04-21T16:05:44 | 129,037,360 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,728 | cpp | TCPClientConnection.cpp | #include "TCPClientConnection.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
TCPClientConnection::TCPClientConnection( const std::string& address,
uint16_t port)
: m_address(address), m_port(port)
{
}
TCPClientConnection::~TCPClientConnection()
{
_onServerDisconnect();
}
bool TCPClientConnection::Run()
{
struct addrinfo hints, *servinfo, *p;
int rv;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
std::string strPort = std::to_string(m_port);
if ((rv = getaddrinfo(m_address.c_str(), strPort.c_str(), &hints, &servinfo)) != 0)
{
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
return 1;
}
for(p = servinfo; p != NULL; p = p->ai_next)
{
if ((m_fd = socket(p->ai_family, p->ai_socktype,
p->ai_protocol)) == -1)
{
continue;
}
//
if (connect(m_fd, p->ai_addr, p->ai_addrlen) == -1)
{
_shutDownSocket();
continue;
}
break;
}
if(m_fd < 0)
{
return false;
}
fcntl(m_fd, F_SETFL, O_NONBLOCK);
if(m_ctx.onConnect != nullptr)
{
m_ctx.onConnect(0);
}
return true;
}
void TCPClientConnection::SendMsg(ConnectionId, const Msg& msg)
{
if(m_fd < 0)
{
return;
}
// First send size of message
Serializer os;
os << msg;
uint32_t msgSize = os.GetBuffer().size();
uint32_t sendItems = write(m_fd, &msgSize, sizeof(msgSize));
if(sendItems == 0)
{
// Can't write to socket
return;
}
uint32_t currentPos = 0;
while (msgSize > 0)
{
sendItems = write(m_fd, os.GetBuffer().data() + currentPos, msgSize);
if(sendItems == 0)
{
break;
}
currentPos += sendItems;
msgSize -= sendItems;
}
}
void TCPClientConnection::Update()
{
if(m_fd < 0)
{
return;
}
if(m_pendingMessage == false)
{
auto receivedItems = read(m_fd, &m_msgSize, sizeof(m_msgSize));
if(receivedItems > 0)
{
m_rawMsg.resize(m_msgSize);
m_pendingMessage = true;
}
else if(receivedItems == 0)
{
_onServerDisconnect();
}
}
else
{
auto bytesToReceive = m_msgSize;
uint32_t currentPos = 0;
auto receivedItems = read(m_fd, m_rawMsg.data() + currentPos, bytesToReceive);
if(receivedItems > 0)
{
bytesToReceive -= receivedItems;
currentPos += receivedItems;
while (bytesToReceive > 0)
{
receivedItems = read(m_fd, m_rawMsg.data() + currentPos, m_msgSize);
currentPos += receivedItems;
bytesToReceive -= receivedItems;
}
if(m_ctx.onMsg != nullptr)
{
Deserializer is;
is.Load(m_rawMsg);
Msg msg;
is >> msg;
m_ctx.onMsg(0, msg);
}
m_pendingMessage = false;
}
else if(receivedItems == 0)
{
_onServerDisconnect();
}
}
}
void TCPClientConnection::_shutDownSocket()
{
if(m_fd > 0)
{
close(m_fd);
m_fd = -1;
}
}
void TCPClientConnection::_onServerDisconnect()
{
_shutDownSocket();
//
if(m_ctx.onDisconnect != nullptr)
{
m_ctx.onDisconnect(0);
}
}
|
b0c0d437ea456080c5b793208edfbd2a12b17f9e | 8d46b233583965b403cb1dfaa26b06b48940a880 | /ihm_creerreservationchoixequipement.h | cf31c5ae1b2056d39476bc78927bdda095442ccb | [] | no_license | GamerBishop/projetENT_GL | 8e9f91c6c53fea91d20115a380b5f522c181b004 | aa8bea50ae02e7bf6d39f3e58f5acda5fa424978 | refs/heads/master | 2021-01-19T12:58:23.904366 | 2014-04-04T11:53:19 | 2014-04-04T11:53:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 598 | h | ihm_creerreservationchoixequipement.h | #ifndef IHM_CREERRESERVATIONCHOIXEQUIPEMENT_H
#define IHM_CREERRESERVATIONCHOIXEQUIPEMENT_H
#include <QMainWindow>
#include "BDD.h"
namespace Ui {
class IHM_CreerReservationChoixEquipement;
}
class IHM_CreerReservationChoixEquipement : public QMainWindow
{
Q_OBJECT
public:
explicit IHM_CreerReservationChoixEquipement(BDD *b,QWidget *parent = 0);
~IHM_CreerReservationChoixEquipement();
private:
Ui::IHM_CreerReservationChoixEquipement *ui;
BDD * bdd;
signals:
void signalRetour();
public slots:
void retour();
};
#endif // IHM_CREERRESERVATIONCHOIXEQUIPEMENT_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.