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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e611954a9d00e7b6b01d423dea0592989a508fbb | b55de06ccfabe67bbe96f439e349c17dab56cf0b | /rendering/include/rendering/Camera.h | 4db99a7314eaf6a351d7dbd51411573cad5b5d35 | [
"MIT"
] | permissive | realratchet/l2mapconv-public | d5e6a31408686816718d42f73842bc5db490e183 | 0be66d3884ab819091cd39367e75ff0e8584e2a4 | refs/heads/master | 2023-04-14T00:31:13.405799 | 2021-04-19T21:13:30 | 2021-04-19T21:13:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,035 | h | Camera.h | #pragma once
#include "Context.h"
#include <math/Frustum.h>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
namespace rendering {
class Camera {
public:
explicit Camera(Context &context, float fov, float near,
const glm::vec3 &position)
: m_context{context}, m_fov{fov}, m_near{near}, m_position{position},
m_orientation{glm::quatLookAt({0.0f, 1.0f, 0.0f}, m_up)} {}
void translate(const glm::vec3 &direction);
void set_position(const glm::vec3 &position);
void rotate(float angle, const glm::vec3 &axis);
auto position() const -> const glm::vec3 &;
auto forward() const -> glm::vec3;
auto right() const -> glm::vec3;
auto up() const -> glm::vec3;
auto view_matrix() const -> glm::mat4;
auto projection_matrix() const -> glm::mat4;
auto frustum() const -> math::Frustum;
private:
const glm::vec3 m_up = {0.0f, 0.0f, 1.0f};
Context &m_context;
float m_fov;
float m_near;
glm::vec3 m_position;
glm::quat m_orientation;
};
} // namespace rendering
|
9754db2e9cd947cd86b243a2a523e808b07c4614 | aa49e42c4e72f5cd5db9168252470601b7d4cffb | /test/门外的树.cpp | e5127b2d8b09d6dbabe748bbdcaf2f2e259bc9a9 | [] | no_license | lancercd/Learning-code | 309b235d833e7081524bcfafb8025b446460d65b | 9d96705243ae73be809118617989ca76e280dcda | refs/heads/master | 2023-08-24T22:08:14.538173 | 2021-09-11T09:00:12 | 2021-09-11T09:00:12 | 288,375,944 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 232 | cpp | 门外的树.cpp | #include "iostream"
using namespace std;
int box[5001][5001];
int r;
int main() {
register int x, y, v, tmp_v=0,j=0;
int n, i = 0;
cin >> n >> r;
for (; i < n; ++i)
{
cin >> x >> y >> v;
box[x][y] = v;
}
return 0;
}
|
29f318cf97555afedcba7c88c9b96ec2e67b02bc | f85adb515c370b4025f1d1b782176a5dbf7e2b75 | /gameserver/src/connection_receiver.h | 279b53e3c264ad18f38917990b57db5d3d31faa0 | [] | no_license | mattiskan/novia | 97b6dbf404e1f2464ae7a041f80fca5bbdd428a9 | ed7b3e7c87f97ad99fa784870cb692db1d939deb | refs/heads/master | 2021-01-13T02:30:27.844185 | 2015-01-09T12:26:12 | 2015-01-09T12:26:12 | 14,426,924 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,795 | h | connection_receiver.h | //-*-c++-*-
#ifndef NOVIA_CONNECTION_RECEIVER_H
#define NOVIA_CONNECTION_RECEIVER_H
#include <map>
#include <thread>
#include <utility>
#include <functional>
#include <memory>
#include "client_connection.h"
#include "controllers.h"
#include "websocket_config.hpp"
#include "protocol/in_message.h"
using websocketpp::lib::bind;
using websocketpp::lib::placeholders::_1;
using websocketpp::lib::placeholders::_2;
typedef websocketpp::server<WebsocketConfig> WebsocketServer;
namespace novia {
class ConnectionReceiver {
public:
typedef std::function< void(const std::shared_ptr<InMessage>&, const std::shared_ptr<ClientConnection>) > MessageHandlerFn;
ConnectionReceiver();
void initiate();
void terminate();
int connected_client_count() const;
void broadcast(std::string msg);
void send_to(int session_id, const std::string& msg);
void set_message_handler(const MessageHandlerFn& handler);
private:
typedef std::map<websocketpp::connection_hdl, std::shared_ptr<ClientConnection>,
std::owner_less<websocketpp::connection_hdl>> con_list;
con_list clients;
std::map<int, websocketpp::connection_hdl> sessions_;
MessageHandlerFn message_handler_;
std::thread* acceptor_thread_ptr_;
WebsocketServer socket_server_;
int next_unassigned_id_;
//Called when a new client have connected
void on_connect(websocketpp::connection_hdl);
//Called when a connection failed to connect to this server
void on_fail(websocketpp::connection_hdl);
//Called when the socket is closed
void on_close(websocketpp::connection_hdl);
//Called when the server retrieved a message from a client
void on_message(websocketpp::connection_hdl, WebsocketServer::message_ptr msg);
};
}
#endif
|
03c07356630b752cb13a530f70cb7d4e08b43e08 | d8d837f62c08585620659b92362755cf83af0197 | /final/dynamic memory allocation/files-binary.cpp | ee37646cf93654de41578079bdd671936071fb58 | [
"MIT"
] | permissive | coderica/effective_cpp | 5034c2c77c8ee0f35ee060e4e4c682d0659d4205 | 456d30cf42c6c71dc7187d88e362651dd79ac3fe | refs/heads/master | 2020-04-15T06:51:23.219731 | 2017-01-20T17:21:10 | 2017-01-20T17:21:10 | 68,049,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 431 | cpp | files-binary.cpp | #include <iostream>
#include <string>
#include <fstream>
using namespace std;
struct person {
char name[10];
int id;
};
void main()
{
person pete = { "Pete",101 };
ofstream ofile("file.dat");
ofile.write((char *)&pete, sizeof(person));
ofile.close();
ifstream ifile("file.dat");
ifile.read((char *)&pete, sizeof(person));
ifile.close();
cout << pete.name << endl;
cout << pete.id << endl;
}
|
231ad4280881fc2c63b04cc47ec34cb069a22304 | fcb170fd38317a042990edad0803e763397e0771 | /samples/common/Utilities.h | 6bb4be5cecbe0dcd2e682a8e860f17b582764553 | [
"MIT",
"Zlib"
] | permissive | dut3062796s/NVIDIAImageScaling | f0633936635c2e64f4aafa4be5be04050e2b04e2 | 38402c9efb67ee5a004d03d3545362b9435d1bae | refs/heads/main | 2023-09-06T03:50:49.421626 | 2021-11-24T22:18:54 | 2021-11-24T22:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,395 | h | Utilities.h | // The MIT License(MIT)
//
// Copyright(c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// 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.
#pragma once
#include <chrono>
#include <filesystem>
#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <unordered_map>
#include <vector>
inline std::vector<std::filesystem::path> getFiles(const std::string& path, const std::string& ext = "")
{
namespace fs = std::filesystem;
std::vector<fs::path> ret;
for (const auto& e : fs::directory_iterator(path)) {
if (ext == "" || e.path().extension() == ext)
ret.push_back(e.path());
}
return ret;
}
class FPS {
public:
FPS(double maxTime = 100000) : m_maxTime(maxTime), m_totalTime(0), m_averageTime(0), m_numFrames(0) {
m_t0 = std::chrono::high_resolution_clock::now();
}
void update() {
m_t1 = std::chrono::high_resolution_clock::now();
m_totalTime += std::chrono::duration_cast<std::chrono::microseconds>(m_t1 - m_t0).count();
m_t0 = m_t1;
m_numFrames++;
// update only when time is up
if (m_totalTime > m_maxTime)
{
m_averageTime = m_totalTime / m_numFrames;
m_totalTime = 0.0;
m_numFrames = 0;
}
}
void setMaxTime(double maxTime) {
m_maxTime = maxTime;
}
double averageTime_us() {
return m_averageTime;
}
double averageTime_ms() {
return m_averageTime / 1E3;
}
double fps() {
return 1 / m_averageTime * 1E6;
}
private:
double m_maxTime;
double m_totalTime;
double m_averageTime;
size_t m_numFrames;
std::chrono::steady_clock::time_point m_t0, m_t1;
};
class ElapsedTimer {
public:
ElapsedTimer(uint32_t maxIterations = 500) : m_maxIterations(maxIterations), m_totalTime(0), m_averageTime(0) {
m_t0 = std::chrono::high_resolution_clock::now();
}
void start() {
m_t0 = std::chrono::high_resolution_clock::now();
}
void end() {
m_t1 = std::chrono::high_resolution_clock::now();
m_totalTime += std::chrono::duration_cast<std::chrono::microseconds>(m_t1 - m_t0).count();
m_numIterations++;
if (m_numIterations > m_maxIterations)
{
m_averageTime = m_totalTime / m_maxIterations;
m_totalTime = 0.0;
m_numIterations = 0;
}
}
void setMaxTime(uint32_t maxTime) {
m_maxIterations = maxTime;
}
double averageTime_us() {
return m_averageTime;
}
double averageTime_ms() {
return m_averageTime / 1E3;
}
private:
uint32_t m_maxIterations;
double m_totalTime;
double m_averageTime;
size_t m_numIterations;
std::chrono::steady_clock::time_point m_t0, m_t1;
};
class ArgParser {
public:
ArgParser(int argc, char* argv[]) {
programName = argv[0];
addOption("-h", "Print this help");
for (size_t i = 1; i < argc; ++i)
arguments.push_back(argv[i]);
}
void addOption(const std::string& opt, const std::string& description) {
options[opt] = description;
}
void printHelp() {
std::cout << "Usage: " << programName << " " << std::endl;
std::cout << "----------------------------------------" << std::endl;
for (auto& e : options) {
std::cout << e.first << " " << e.second << std::endl;;
}
}
bool parse(bool requiredArgs = false) {
if (arguments.size() > 0 && arguments[0] == "-h") {
printHelp();
return false;
}
if (arguments.size() < 1) {
return !requiredArgs;
}
bool lastOpt = false;
size_t i = 0;
while (i < arguments.size()) {
if (options.find(arguments[i]) != options.end() && i < arguments.size() - 1) {
argMap[arguments[i]] = arguments[i + 1];
i += 2;
}
else {
std::cout << "Argument not found : " << arguments[i] << std::endl;
printHelp();
return false;
}
}
return true;
}
template<typename T>
T get(const std::string& opt, T defaultVal = T()) {
T val;
auto sval = argMap.find(opt);
if (sval == argMap.end())
return defaultVal;
std::stringstream ss;
ss << sval->second;
ss >> val;
return val;
}
private:
std::map<std::string, std::string> options;
std::vector<std::string> arguments;
std::unordered_map<std::string, std::string> argMap;
std::string programName;
};
inline std::wstring widen(const std::string& str)
{
int size = MultiByteToWideChar(CP_ACP, 0, str.c_str(), int(str.size()) + 1, 0, 0);
std::vector<wchar_t> temp(size);
MultiByteToWideChar(CP_ACP, 0, str.c_str(), int(str.size()) + 1, &temp[0], int(temp.size()));
return std::wstring(&temp[0]);
}
template <typename T>
inline std::string toStr(T value)
{
return std::to_string(value);
}
template <>
inline std::string toStr<bool>(bool value)
{
return value ? "1" : "0";
}
template <>
inline std::string toStr<std::string>(std::string value)
{
return value;
}
template <>
inline std::string toStr<const char*>(const char* value)
{
return value;
}
|
c96f631aeca1008c0e1639885031c6ed040a2227 | a38d558faf17079808fcc4082cef6852c703611c | /practical work 3/0.cpp | 71f28f4001cfa4cdefef6698693d83c7b1450f70 | [] | no_license | haferf1ocken/IKIT-SFU-Programming-Basics-1-semester | ed4d4e2a14c37a910e41ea2fb8cd9f98cd4a6dd5 | 482774a290c72ad827491b2b78cf6a554711859d | refs/heads/master | 2020-05-16T03:23:01.035304 | 2019-04-22T10:58:21 | 2019-04-22T10:58:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,682 | cpp | 0.cpp | //Разработать программу, которая для двух целых чисел, введенных с клавиатуры,
//вычисляет остаток от целочисленного деления, частное от целочисленного деления первого числа на второе,
//а также частное от вещественного деления.
//Провести трассировку программы с помощью встроенного в среду программирования отладчика,
//анализируя значения переменных после каждого оператора присваивания.
//Выполнить несколько запусков программы для заранее подготовленных тестовых наборов данных.
//Сделать вывод результатов с применением потокового ввода-вывода, используя следующие методы потоков – width(),
//precision() и fill() с различными параметрами (не менее 3 для каждого метода), а также флаги left, right, устанавливаемые с помощью метода setf().
//Проанализировать полученные результаты
#include "pch.h"
#include <iostream>
#include <clocale>
using namespace std;
int main(){
setlocale(LC_ALL, "rus");
int num1, num2, mod, div_int;
float div_float;
cout << "Введите первое число: ";
cin >> num1;
cout << "Введите второе число: ";
cin >> num2;
if (num2 != 0) {
mod = num1 % num2;
div_int = num1 / num2;
div_float = float(num1) / float(num2);
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(25);
cout.precision(2);
cout.fill('*');
cout << "Остаток от деления: " << mod << endl;
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(30);
cout.precision(4);
cout.fill('*');
cout << "Остаток от деления: " << mod << endl;
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(35);
cout.precision(6);
cout.fill('*');
cout << "Остаток от деления: " << mod << endl;
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(50);
cout.precision(7);
cout.fill('#');
cout << "Частное от целочисленного деления : " << div_int << endl;
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(55);
cout.precision(9);
cout.fill('#');
cout << "Частное от целочисленного деления : " << div_int << endl;
cout.setf(ios::fixed);
cout.setf(ios::left);
cout.width(60);
cout.precision(11);
cout.fill('#');
cout << "Частное от целочисленного деления : " << div_int << endl;
cout.setf(ios::fixed);
cout.setf(ios::right);
cout.width(75);
cout.precision(5);
cout.fill('$');
cout << "Частное от вещественного деления : " << div_float << endl;
cout.setf(ios::fixed);
cout.setf(ios::right);
cout.width(80);
cout.precision(8);
cout.fill('$');
cout << "Частное от вещественного деления : " << div_float << endl;
cout.setf(ios::fixed);
cout.setf(ios::right);
cout.width(85);
cout.precision(12);
cout.fill('$');
cout << "Частное от вещественного деления : " << div_float << endl;
}
else {
cout << "Произошла ошибка в вычислениях" << endl;
}
return 0;
}
|
9e8b31c48a8229adfe85bb12d1e8b049a8eebfb7 | b4497c1a4659b70f871fc389effb46ed39c2ee17 | /include/container/op_bucket.h | 750e882d867ca953e3a3266142dad3fb40f17a94 | [] | no_license | supermt/ix_benchmark | 8daf3f1d342d0e5b9644a2d71ed1a444aa4166ad | 69b76e24ccf030b1fb64e68d5f7fee7fc8ef1e29 | refs/heads/master | 2023-03-04T15:48:51.250590 | 2021-01-03T16:16:42 | 2021-01-03T16:16:42 | 324,379,801 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,503 | h | op_bucket.h | //
// Created by jinghuan on 12/25/20.
//
#ifndef IX_BENCHMARK_OP_BUCKET_H
#define IX_BENCHMARK_OP_BUCKET_H
#include "include/format.h"
#include "include/slice.h"
namespace IX_NAME_SPACE {
class Slice;
class RequestEntry {
public:
OperationType _op;
Key _key;
Slice _value; // allow to be empty
Key _endKey;// allow to be empty
public:
RequestEntry(OperationType op, double key) : _op(op), _key(key), _value("12345678"), _endKey(0.0) {}
RequestEntry() : _op(kQuery), _key(0.0), _value("12345678"), _endKey(0.0) {}
RequestEntry(OperationType op, Key key) : _op(op), _key(key), _value("12345678"), _endKey(0.0) {}
RequestEntry(OperationType op, Key key, const char *value) : _op(op), _key(key), _value(value), _endKey(0.0) {}
RequestEntry(OperationType op, double key, const char *value) : _op(op), _key(key), _value(value),
_endKey(0.0) {}
RequestEntry(OperationType op, double key, long long value) : _op(op), _key(key), _endKey(0.0) {
char str[9];
sprintf(str, "%lld", value);
_value = Slice(str);
}
RequestEntry(OperationType op, Key key, Slice value) : _op(op), _key(key), _value(value), _endKey(0.0) {}
RequestEntry(const RequestEntry &x) : _op(x._op), _key(x._key), _value(Slice(x._value)), _endKey(x._endKey) {}
};
};
#endif //IX_BENCHMARK_OP_BUCKET_H
|
cdf426def10a5b03437b508929ced10db24fefe8 | d001af22ded7e7b9735ec98212bdb4c2b97fa1cf | /[2019-01-PI][SASY]Proyecto.cpp | a98a15e7174cab0538efd43b5125b01ae49e8027 | [] | no_license | Sara-yuliana/nuevo-repositorio | 47725b489ada7dc38d921cab98ab6f91b21fac80 | 0a03a46240a9cbec1a6a6b2a06f982f27e4a27cf | refs/heads/master | 2020-07-01T06:28:01.708736 | 2019-08-07T15:16:25 | 2019-08-07T15:16:25 | 201,075,138 | 0 | 0 | null | null | null | null | ISO-8859-10 | C++ | false | false | 4,389 | cpp | [2019-01-PI][SASY]Proyecto.cpp | #include <iostream>
using namespace std;
int main (){
int dia;
int mes;
int edad;
string horoscopo;
string zignozodiacal;
cout<<"Bienvenido al horoscopo 100% real no fake de Madan Sara y Madan Angelica"<<endl;
cout<<"Proporciona los datos que se te piden para saber si los astros se alinearon hoy para ti"<<endl;
cout<<"Introdusca su singno zodiacal"<<endl;
cin>>zignozodiacal;
cout<<"Introdusca el dia en que nacio"<<endl;
cin>>dia;
cout<<"introdusca el mes en que nacio"<<endl;
cin>>mes;
cout<<"Introdusca su edad"<<endl;
cin>>edad;
cout<<zignozodiacal<<" tu fortuna es"<<endl;
switch(dia){
case 1: cout<<"En la noche"<<endl;
break;
case 2: cout<<"Al salir del trabajo"<<endl;
break;
case 3: cout<<"Mientras almuerzas"<<endl;
break;
case 4: cout<<"En los pasillos de Dicis"<<endl;
break;
case 5: cout<<"Mientras haces ejercicio"<<endl;
break;
case 6: cout<<"Antes de ir a dormir"<<endl;
break;
case 7: cout<<"En tu trabajo"<<endl;
break;
case 8: cout<<"Cuando estes en el baņo"<<endl;
break;
case 9: cout<<"En tu casa"<<endl;
break;
case 10: cout<<"En la calle"<<endl;
break;
case 11: cout<<"En la caferetia de la escuela"<<endl;
break;
case 12: cout<<"Al salir del trabajo"<<endl;
break;
case 13: cout<<"En tu Kardex"<<endl;
break;
case 14: cout<<"En el camion de DICIS"<<endl;
break;
case 15: cout<<"En la sala de computo"<<endl;
break;
case 16: cout<<"En el salon 307"<<endl;
break;
case 17: cout<<"Por las escaleras"<<endl;
break;
case 18: cout<<"A un lado de la biblioteca"<<endl;
break;
case 19: cout<<"En el estacionamiento"<<endl;
break;
case 20: cout<<"Por las canchas"<<endl;
break;
case 21: cout<<"En Fimee"<<endl;
break;
case 22: cout<<"Al salir del trabajo"<<endl;
break;
case 23: cout<<"Mientras estudias"<<endl;
break;
case 24: cout<<"En la casa de tu mamá"<<endl;
break;
case 25: cout<<"En la central"<<endl;
break;
case 26: cout<<"Cuando vayas a la tienda"<<endl;
break;
case 27: cout<<"En via alta"<<endl;
break;
case 28: cout<<"EN el templo de San agustin"<<endl;
break;
case 29: cout<<"En la refi"<<endl;
break;
case 30: cout<<"En la plazoleta"<<endl;
break;
case 31: cout<<"En las salitas de DICIS"<<endl;
break;
}
switch(mes){
case 1: cout<<"te encontraras"<<endl;
break;
case 2: cout<<"perderas"<<endl;
break;
case 3: cout<<"abrazaras"<<endl;
break;
case 4: cout<<"saludaras"<<endl;
break;
case 5: cout<<"te golpearan"<<endl;
break;
case 6: cout<<"te asaltaran"<<endl;
break;
case 7: cout<<"empujaras"<<endl;
break;
case 8: cout<<"salvaras a"<<endl;
break;
case 9: cout<<"quemaras"<<endl;
break;
case 10: cout<<"lloraras"<<endl;
break;
case 11: cout<<"se morira"<<endl;
break;
case 12: cout<<"cumpliras"<<endl;
break;
}
switch(edad){
case 18 : cout<<"con un cholo"<<endl;
break;
case 19: cout<<" a tu perro"<<endl;
break;
case 20 : cout<<"con dinero"<<endl;
break;
case 21 : cout<<"al amor de tu vida"<<endl;
break;
case 22 : cout<<"con el rector "<<endl;
break;
case 23 : cout<<"tu ex"<<endl;
break;
case 24 : cout<<"con doņa pelos"<<endl;
break;
case 25 : cout<<"el amigo"<<endl;
break;
case 26 : cout<<"el conserje"<<endl;
break;
case 27 : cout<<"a tu bro"<<endl;
break;
case 28 : cout<<"con tu cuņada"<<endl;
break;
case 29 : cout<<"a tu jefe"<<endl;
break;
case 30 : cout<<"con tu compaņero"<<endl;
break;
case 31 : cout<<"tu novio"<<endl;
break;
case 32 : cout<<"con tus amigos"<<endl;
break;
case 33 : cout<<"tu novio"<<endl;
break;
case 34 : cout<<"con la secretaria"<<endl;
break;
case 35 : cout<<" con el rector"<<endl;
break;
case 36 : cout<<"con tu alumno"<<endl;
break;
case 37 : cout<<"con el profesor Armando Crespo"<<endl;
break;
case 38 : cout<<"con el rector del campus"<<endl;
break;
case 39 : cout<<"con el director de departamento victor hugo"<<endl;
break;
case 40 : cout<<" con la doctora margarita"<<endl;
break;
case 47 : cout<<" con su familia"<<endl;
break;
}
cout<<"Gracias por participar, si los astros no te vieron con gracia hoy, maņana vuelve a salir el sol"<<endl;
cout<<"Tu numero de la suerte es: "<<endl;
cout<<dia<<mes<<edad<<endl;
}
|
b8024c03e7d6bf7de6ed7d9db0e6e565f699623b | be4ed634abaab9032ad7a85802c3a62a4d5de050 | /FMU/Source/Occupant_Zone.cpp | 853c8a74c7c9fc5f09861bbabd25ed3adc2691e2 | [
"MIT"
] | permissive | jacoblchapman/No-MASS | 380b08e56214ea08c885fe7a65d1f35a11bf1181 | 843ccaa461923e227a8e854daaa6952d14cb8bed | refs/heads/Master | 2021-03-27T11:47:05.283200 | 2020-08-28T18:11:39 | 2020-08-28T18:11:39 | 38,058,134 | 0 | 2 | MIT | 2020-08-28T18:11:40 | 2015-06-25T15:37:00 | Jupyter Notebook | UTF-8 | C++ | false | false | 11,200 | cpp | Occupant_Zone.cpp | // Copyright 2016 Jacob Chapman
#include <iostream>
#include <vector>
#include <algorithm>
#include "Environment.hpp"
#include "DataStore.hpp"
#include "Utility.hpp"
#include "Occupant_Zone.hpp"
Occupant_Zone::Occupant_Zone() {}
/**
* @brief is there currently a window action
* @return true if there is a action taking place
*/
bool Occupant_Zone::isActionWindow() const {
return ActionWindow;
}
/**
* @brief is there currently a Light action
* @return true if there is a action taking place
*/
bool Occupant_Zone::isActionLights() const {
return ActionLights;
}
/**
* @brief is there currently a shade action
* @return true if there is a action taking place
*/
bool Occupant_Zone::isActionShades() const {
return ActionShades;
}
/**
* @brief is there currently a heat gain action
* @return true if there is a action taking place
*/
bool Occupant_Zone::isActionHeatGains() const {
return ActionHeatGains;
}
/**
* @brief is there currently a learning action
* @return true if there is a action taking place
*/
bool Occupant_Zone::isActionLearning() const {
return ActionLearning;
}
/**
* @brief Initialises the occupants understanding of a zone
* @details enables the different interactions that can take place in a zone
* @param buildingID The id of the building the zone is in
* @param buldingZone The actual zone
* @param agentid The agents id
* @param agent The configuration struct for the agent
*/
void Occupant_Zone::setup(int buildingID, const Building_Zone & buldingZone,
int agentid, const ConfigStructAgent &agent) {
id = buldingZone.getId();
this->buildingID = buildingID;
if (Configuration::info.agentHeatGains) {
aahg.setup(buildingID, agentid);
availableActions.push_back(0);
}
disableBDI();
ActionHeatGains = false;
ActionLearning = false;
setupWindows(agentid, agent, buldingZone);
setupLights(agent, buldingZone);
setupShades(agent, buldingZone);
if (Configuration::info.learn > 0) {
aalearn.setZoneId(id);
aalearn.setup(agentid, Configuration::info.learn);
}
if (agent.ApplianceDuringDay > 0) {
aaa.setApplianceDuringDay(agent.ApplianceDuringDay);
enableBDI();
}
}
void Occupant_Zone::setupLights(const ConfigStructAgent &agent,
const Building_Zone & buldingZone) {
ActionLights = false;
if ((agent.LightOffDuringAudioVisual > 0 ||
agent.LightOffDuringSleep > 0) &&
Configuration::info.lights
) {
availableActions.push_back(7);
if (buldingZone.hasActivity(2)) {
aalBDI.setOffDuringAudioVisual(agent.LightOffDuringAudioVisual);
}
aalBDI.setOffDuringSleep(agent.LightOffDuringSleep);
aalBDI.setAvailableActivities(buldingZone.getActivities());
enableBDI();
} else if (Configuration::info.lights) {
availableActions.push_back(3);
aal.setAvailableActivities(buldingZone.getActivities());
}
}
void Occupant_Zone::setupShades(const ConfigStructAgent &agent,
const Building_Zone & buldingZone) {
ActionShades = false;
if ((agent.ShadeClosedDuringSleep > 0 ||
agent.ShadeDuringNight > 0 ||
agent.ShadeDuringAudioVisual > 0 ||
agent.ShadeClosedDuringWashing > 0)
&& Configuration::info.shading) {
aasBDI.setup(agent.shadeId);
if (buldingZone.hasActivity(0)) {
aasBDI.setClosedDuringSleep(agent.ShadeClosedDuringSleep);
}
if (buldingZone.hasActivity(6)) {
aasBDI.setClosedDuringWashing(agent.ShadeClosedDuringWashing);
}
aasBDI.setClosedDuringNight(agent.ShadeDuringNight);
if (buldingZone.hasActivity(2)) {
aasBDI.setClosedDuringAudioVisual(agent.ShadeDuringAudioVisual);
}
availableActions.push_back(8);
enableBDI();
} else if (Configuration::info.shading) {
aas.setup(agent.shadeId);
availableActions.push_back(2);
}
}
void Occupant_Zone::setupWindows(int agentid, const ConfigStructAgent &agent,
const Building_Zone & buldingZone) {
ActionWindow = false;
if ((agent.WindowOpenDuringCooking > 0 ||
agent.WindowOpenDuringWashing > 0 ||
agent.WindowOpenDuringSleeping > 0) &&
Configuration::info.windows) {
enableBDI();
aawBDI.setup(agent.windowId, agentid);
if (buldingZone.hasActivity(4)) {
aawBDI.setOpenDuringCooking(agent.WindowOpenDuringCooking);
}
if (buldingZone.hasActivity(6)) {
aawBDI.setOpenDuringWashing(agent.WindowOpenDuringWashing);
}
if (buldingZone.hasActivity(0)) {
aawBDI.setOpenDuringSleeping(agent.WindowOpenDuringSleeping);
}
aawBDI.setAvailableActivities(buldingZone.getActivities());
availableActions.push_back(6);
} else if (Configuration::info.windows) {
aaw.setup(agent.windowId, agentid);
aaw.setAvailableActivities(buldingZone.getActivities());
availableActions.push_back(1);
} else if (Configuration::info.windowsLearn) {
aawLearn.setZoneId(id);
aawLearn.setup(agentid);
availableActions.push_back(4);
}
}
void Occupant_Zone::shuffleActions() {
std::shuffle(availableActions.begin(), availableActions.end(), Utility::engine);
}
void Occupant_Zone::step(const Building_Zone& zone,
const Building_Zone& zonePrevious,
const std::vector<double> &activities) {
bool inZone = zone.getId() == id;
bool previouslyInZone = zonePrevious.getId() == id;
if (isInBuilding()) {
if (inZone) {
shuffleActions();
for (int a : availableActions) {
actionStep(a, zone, inZone, previouslyInZone, activities);
}
}
if (Configuration::info.heating && Configuration::info.learn > 0) {
actionStep(5, zone, inZone, previouslyInZone, activities);
}
}
BDI(activities);
}
void Occupant_Zone::stepPre(const Building_Zone& zone,
const Building_Zone& zonePrevious,
const std::vector<double> &activities) {
bool inZone = zone.getId() == id;
bool previouslyInZone = zonePrevious.getId() == id;
if ( !inZone && previouslyInZone && isInBuilding()) {
shuffleActions();
for (int a : availableActions) {
actionStep(a, zonePrevious, inZone, previouslyInZone, activities);
}
}
if (inZone || previouslyInZone) {
if (Configuration::info.windows){
aaw.saveResult();
}
}
}
void Occupant_Zone::BDI(const std::vector<double> &activities) {
if (hasBDI) {
if (aawBDI.doRecipe(activities)) {
desiredWindowState = aawBDI.getResult();
ActionWindow = true;
}
if (aasBDI.doRecipe(activities)) {
desiredShadeState = aasBDI.getResult();
ActionShades = true;
}
if (aalBDI.doRecipe(activities)) {
desiredLightState = aalBDI.getResult();
ActionLights = true;
}
if (aaa.doRecipe(activities)) {
desiredApplianceState = aaa.getResult();
ActionAppliance = true;
}
}
}
void Occupant_Zone::actionStep(int action,
const Building_Zone &zone, bool inZone, bool preZone,
const std::vector<double> &activities) {
switch (action) {
case 0:
if (inZone) {
ActionHeatGains = true;
aahg.prestep(clo, metabolicRate);
aahg.step(zone, inZone);
heatgains = aahg.getResult();
previous_pmv = pmv;
pmv = aahg.getPMV();
ppd = aahg.getPPD();
}
break;
case 1:
{
ActionWindow = true;
double dailyMeanTe = Environment::getDailyMeanTemperature();
aaw.setDailyMeanTemperature(dailyMeanTe);
aaw.step(zone, inZone, preZone, activities);
desiredWindowState = aaw.getResult();
}
break;
case 2:
{
ActionShades = true;
double ill = zone.getDaylightingReferencePoint1Illuminance();
aas.setIndoorIlluminance(ill);
aas.step(zone, inZone, preZone);
desiredShadeState = aas.getResult();
}
break;
case 3:
ActionLights = true;
aal.step(zone, inZone, preZone, activities);
desiredLightState = aal.getResult();
break;
case 4:
ActionWindow = true;
aawLearn.setReward(pmv);
aawLearn.step(zone, inZone, preZone);
desiredWindowState = aawLearn.getResult();
break;
case 5:
ActionLearning = true;
aalearn.setReward(pmv);
aalearn.step(zone, inZone);
desiredHeatingSetPoint = aalearn.getResult();
break;
case 6:
{
ActionWindow = true;
double dailyMeanTe = Environment::getDailyMeanTemperature();
aawBDI.setDailyMeanTemperature(dailyMeanTe);
aawBDI.step(zone, inZone, preZone, activities);
desiredWindowState = aawBDI.getResult();
}
break;
case 7:
ActionLights = true;
aalBDI.step(zone, inZone, preZone, activities);
desiredLightState = aalBDI.getResult();
break;
case 8:
{
ActionShades = true;
double ill = zone.getDaylightingReferencePoint1Illuminance();
aasBDI.setIndoorIlluminance(ill);
aasBDI.step(zone, inZone, preZone);
desiredShadeState = aasBDI.getResult();
}
break;
}
}
int Occupant_Zone::getId() const {
return id;
}
bool Occupant_Zone::getDesiredWindowState() const {
return desiredWindowState;
}
bool Occupant_Zone::getDesiredLightState() const {
return desiredLightState;
}
double Occupant_Zone::getPMV() const {
return pmv;
}
double Occupant_Zone::getHeatgains() const {
return heatgains;
}
double Occupant_Zone::getDesiredHeatingSetPoint() const {
return desiredHeatingSetPoint;
}
double Occupant_Zone::getDesiredShadeState() const {
return desiredShadeState;
}
void Occupant_Zone::setClo(double clo) {
this->clo = clo;
}
void Occupant_Zone::setMetabolicRate(double metabolicRate) {
this->metabolicRate = metabolicRate;
}
void Occupant_Zone::postprocess() {
if (isInBuilding() && Configuration::info.learn > 0) {
aalearn.print();
aalearn.reset();
}
if (isInBuilding() && Configuration::info.windowsLearn > 0) {
aawLearn.print();
aawLearn.reset();
}
}
void Occupant_Zone::postTimeStep() {
ActionWindow = false;
ActionLights = false;
ActionShades = false;
ActionHeatGains = false;
ActionLearning = false;
}
bool Occupant_Zone::isInBuilding() const {
return id > 0; // 0 is the ID for the outside zone
}
int Occupant_Zone::getDesiredWindowDuration() const {
return aaw.durationOpen();
}
double Occupant_Zone::getDesiredAppliance() const {
return desiredApplianceState;
}
bool Occupant_Zone::isActionAppliance() const {
return ActionAppliance;
}
void Occupant_Zone::disableBDI() {
hasBDI = false;
}
void Occupant_Zone::enableBDI() {
hasBDI = true;
}
|
f427f198f1264f9fc564424e344060213813d46f | 374be07f921a047443dcd8ed8a6e9d8a3aef04bd | /LIWord0030/LMFree.h | f863abad1721ad55f23526a9e75abacebf7eb030 | [] | no_license | mayenjoy/langisle | 811a31f0ae50571d8ab87397b32b5332de571d35 | cb2653583380d038eeaa25d164d86a7b93c927a2 | refs/heads/master | 2021-03-12T19:59:41.210128 | 2015-03-15T07:11:47 | 2015-03-15T07:11:47 | 32,249,053 | 1 | 3 | null | 2016-05-26T06:11:58 | 2015-03-15T07:06:34 | C++ | UTF-8 | C++ | false | false | 226 | h | LMFree.h | #pragma once
#include "LMBase.h"
class LMFree :
public LMBase
{
public:
LMFree(UDataDB *puddb);
virtual ~LMFree(void);
virtual int getNextWord();
virtual void updateMInfo(QMap<QString, QVariant> &tval);
};
|
1577f8e0efae94de3f0af33da25cf0d4d593003a | ab300fa575a73eeedb25cc81d269932a9d6edddf | /cpp/BackTrack.h | daea0c130ff93175ce41852f75cb68741e0b9752 | [] | no_license | amey9004/coding | 7f4ae991b9824e9c7a576964b6c1f9e75616a005 | b99c74c0b0712a43e5c08e64bec1af4fe0674759 | refs/heads/master | 2021-01-17T12:58:12.404786 | 2016-07-17T19:44:26 | 2016-07-17T19:44:26 | 56,968,279 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,748 | h | BackTrack.h | #define _USE_MATH_DEFINES
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <cstdarg>
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <unordered_set>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
class Point{
public:
int x;
int y;
Point(int a, int b){
x = a;
y = b;
};
bool operator==(const Point &anotherLine) const
{
return (x == anotherLine.x && y == anotherLine.y);
}
};
namespace std
{
template <>
struct hash<Point>
{
size_t operator()(const Point& k) const
{
// Compute individual hash values for two data members and combine them using XOR and bit shifting
return ((hash<int>()(k.x) ^ (hash<int>()(k.y) << 1)) >> 1);
}
};
}
unordered_set<Point> visited;
deque<char> path;
bool find(Point start, int max){
if (start.x == 0 && start.y == 0){
return true;
}
if (start.x < max){
path.push_back('R');
Point p(start.x + 1, start.y);
if (visited.find(p) == visited.end()){
visited.insert(p);
bool val = find(p, max);
if (val){
return true;
}
visited.erase(p);
}
path.pop_back();
}
if (start.x > -max){
path.push_back('L');
Point p(start.x - 1, start.y);
if (visited.find(p) == visited.end()){
visited.insert(p);
bool val = find(p, max);
if (val){
return true;
}
visited.erase(p);
}
path.pop_back();
}
if (start.y < max){
path.push_back('U');
Point p(start.x, start.y + 1);
if (visited.find(p) == visited.end()){
visited.insert(p);
bool val = find(p, max);
if (val){
return true;
}
visited.erase(p);
}
path.pop_back();
}
if (start.y > -max){
path.push_back('D');
Point p(start.x, start.y - 1);
if (visited.find(p) == visited.end()){
visited.insert(p);
bool val = find(p, max);
if (val){
return true;
}
visited.erase(p);
}
path.pop_back();
}
return false;
}
// https://www.hackerearth.com/april-circuits/approximate/2b-bear-and-walk-1/
void maze(){
int t;
cin >> t;
while (t--){
visited.clear();
path.clear();
string s;
cin >> s;
int size = s.size();
int x = 0, y = 0, max = 0;
for (int i = 0; i < size; i++){
switch (s[i]){
case 'R':
x++;
break;
case 'L':
x--;
break;
case 'U':
y++;
break;
case 'D':
y--;
break;
}
if (abs(x) > max){
max = abs(x);
}
if (abs(y) > max){
max = abs(y);
}
Point p(x, y);
if (p.x == 0 && p.y == 0){
continue;
}
visited.insert(p);
}
Point p(x, y);
bool val = find(p, max);
if (!val){
cout << "IMPOSSIBLE" << endl;
}
else{
while (!path.empty()){
char direction = path.front();
cout << direction;
path.pop_front();
}
cout << endl;
}
}
}
|
33c8c8af2c86042fc3f41b23fe4788afb5a3f1f5 | af71a91735b20d31f1287f49f525aaf9ddf07836 | /FileManager/FileManager.h | 267c9e334c4f30c3539a396773d7760351a7f1c6 | [
"BSD-3-Clause"
] | permissive | bitfasching/M25P | 868954fff8dc7c2e13be0cc745c5024a4ae8fda2 | 5377b58bb65bda7c5f44b372398f967b1a589180 | refs/heads/master | 2023-04-21T23:12:54.919673 | 2021-05-01T10:33:03 | 2021-05-01T10:35:34 | 363,379,829 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,935 | h | FileManager.h | /**
* File Manager
*
* Nick Schwarzenberg
* 2015
*/
#ifndef FileManager_h
#define FileManager_h
#include <M25P.h>
// message for host indicating ready to write
#define FileManager_readyMessage "READY"
class FileManager
{
public:
// memory capacity in bytes
static const auto capacity = 2097152;
// metadata format
static const auto metaSizeIndex = 0;
static const auto metaLength = 3;
// pointer to driver object
M25P* Memory;
// current memory address
unsigned long address;
// stop address after end of file
unsigned long endOfFile;
// constructor
FileManager( M25P* Memory ) : Memory(Memory), address(0), endOfFile(0) {};
// download/upload file from/to host
void download();
void upload();
// read/write data chunk from/to file on memory
void seek( unsigned long position );
char read();
void longReadBegin();
unsigned char longReadGetByte();
void longReadEnd();
int readBytes( char targetBuffer[], int requestedLength );
void writeBytes( char sourceBuffer[], int sourceLength );
// finish file (write metadata)
void finish();
// rewind memory address counter to beginning
void rewind();
// erase complete memory
void erase();
// metadata methods
void readMetadata( unsigned char targetBuffer[ FileManager::metaLength ] );
void writeMetadata( unsigned char sourceBuffer[ FileManager::metaLength ] );
void saveMetadata( unsigned long fileSize );
unsigned long getFileSize();
unsigned long getPosition();
// discover stored file by reading the metadata
void discover();
private:
// start address for storing the file (next beginning of a page after metadata)
static const auto fileStartAddress = M25P::pageSize * ( FileManager::metaLength / M25P::pageSize + 1 );
// data chunk size in bytes for download & upload
static const auto hostTransferChunkSize = M25P::pageSize;
// timeout for downloading data [ms]
static const auto downloadTimeoutMillis = 2000;
// internal buffer for reading single bytes
char singleByteBuffer[1];
};
/* :: Reading :: */
void FileManager::seek( unsigned long position )
{
// seek to a given byte offset in file
this->address = FileManager::fileStartAddress + position;
}
void FileManager::longReadBegin() { Memory->longReadBegin( this->address ); }
unsigned char FileManager::longReadGetByte() { this->address++; return Memory->longReadGetByte(); }
void FileManager::longReadEnd() { Memory->longReadEnd(); }
int FileManager::readBytes( char targetBuffer[], int requestedLength )
{
// don't read beyond end of file
requestedLength = min( requestedLength, this->endOfFile - this->address );
// read bytes from memory
Memory->readData( this->address, (unsigned char*) targetBuffer, requestedLength );
// increase address by number of read bytes
this->address += requestedLength;
// return number of read bytes
return requestedLength;
}
char FileManager::read()
{
// read and return byte
this->readBytes( singleByteBuffer, 1 );
return singleByteBuffer[0];
}
/* :: Writing :: */
void FileManager::writeBytes( char sourceBuffer[], int sourceLength )
{
// write bytes to memory (doesn't wait to finish)
Memory->writeData( this->address, (unsigned char*) sourceBuffer, sourceLength );
// increase address by number of written bytes
this->address += sourceLength;
}
void FileManager::upload()
{
// data transfer buffer
unsigned char buffer[ FileManager::hostTransferChunkSize ];
// check out stored file (to find end of file)
this->discover();
// reset address counter
this->rewind();
// no check here, loop ends with a break
while ( true )
{
// read a full chunk of data, but not more than until the end of file
int length = min( sizeof(buffer), this->endOfFile - this->address );
// read data
Memory->readData( this->address, buffer, length );
// increase address counter
this->address += length;
// forward to host immediately
// (no waiting needed, the host is definitely faster)
Serial.write( buffer, length );
// read less than a full chunk?
if ( length < sizeof(buffer) )
{
// nothing more to read
break;
}
}
}
/* :: Download & Upload :: */
void FileManager::download()
{
// erase memory (implicitly resets address)
this->erase();
// data transfer buffer
unsigned char buffer[ FileManager::hostTransferChunkSize ];
// set timeout for serial interface to host
Serial.setTimeout( FileManager::downloadTimeoutMillis );
// no check here, loop ends with a break
while ( true )
{
// tell host to send next data chunk
Serial.println( FileManager_readyMessage );
// try to receive data from host
int length = Serial.readBytes( buffer, sizeof(buffer) );
// received something?
if ( length > 0 )
{
// about to write over the memory's capacity?
if ( this->address + length >= FileManager::capacity )
{
// truncate the data to write (-1 because address starts at zero)
length = FileManager::capacity - this->address - 1;
}
// write to memory and wait until done
Memory->writeData( this->address, buffer, length );
Memory->waitToWrite();
// increase address counter
this->address += length;
}
else
{
// nothing received, assume that's all
break;
}
}
// save file size
this->finish();
}
void FileManager::finish()
{
// mark current write address as end of file
this->endOfFile = this->address;
// save file size as metadata on memory
this->saveMetadata( this->address - FileManager::fileStartAddress );
}
void FileManager::rewind()
{
// reset address counter to beginning of file
this->address = FileManager::fileStartAddress;
}
void FileManager::erase()
{
// perform bulk erase
Memory->eraseAll();
// wait to finish
Memory->waitToWrite();
// reset end-of-file mark
this->endOfFile = 0;
// reset address counter
this->rewind();
}
/* :: Metadata :: */
/**
* Read/Save Metadata
* - retrieves/stores metadata from/in reserved page on memory
*/
void FileManager::readMetadata( unsigned char targetBuffer[ FileManager::metaLength ] )
{
// read file information from reserved memory page
Memory->readData( 0, targetBuffer, FileManager::metaLength );
}
void FileManager::writeMetadata( unsigned char sourceBuffer[ FileManager::metaLength ] )
{
// write file information to reserved memory page
Memory->writeData( 0, sourceBuffer, FileManager::metaLength );
Memory->waitToWrite();
}
/**
* Save Metadata
* - saves information about stored file as metadata in memory
*/
void FileManager::saveMetadata( unsigned long fileSize )
{
// buffer for metadata
unsigned char metadata[ FileManager::metaLength ];
// split 24-bit file size on three bytes, MSB first
metadata[ FileManager::metaSizeIndex + 0 ] = (unsigned char)( fileSize >> 16 );
metadata[ FileManager::metaSizeIndex + 1 ] = (unsigned char)( fileSize >> 8 );
metadata[ FileManager::metaSizeIndex + 2 ] = (unsigned char)( fileSize >> 0 );
// write metadata to memory
this->writeMetadata( metadata );
}
/**
* Get File Size
* - retrieves size of stored file from metadata
*/
unsigned long FileManager::getFileSize()
{
// read metadata from memory
unsigned char metadata[ FileManager::metaLength ];
Memory->readData( 0, metadata, sizeof(metadata) );
// add bytes to integer, MSB first
unsigned long fileSize = 0;
fileSize += (unsigned long) metadata[0] << 16;
fileSize += (unsigned long) metadata[1] << 8;
fileSize += (unsigned long) metadata[2] << 0;
// all bits equal to 1? (memory empty?)
if ( fileSize == 0xFFFFFF )
{
// no file size information found
return 0;
}
else
{
// seems valid, return file size
return fileSize;
}
}
unsigned long FileManager::getPosition()
{
return this->address - FileManager::fileStartAddress;
}
/**
* Discover
* - "discovers" the stored file
* - configures FileManager according to metadata
* - must be run before .read()
*/
void FileManager::discover()
{
// determine end of file
this->endOfFile = FileManager::fileStartAddress + this->getFileSize();
}
#endif // see #ifndef on top
|
97fb2cb785a2fcb1fb9eb4a8c095bfcb28ccc066 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5766201229705216_1/C++/h4x/main.cpp | b995aea676c3cf2b4357ba9af37b890ee1a41800 | [] | 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 | 2,160 | cpp | main.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int MaxN = 1100;
struct Edge {
int to, next;
} E[MaxN*2];
int head[MaxN], eptr = 0;
void AddEdge(int u, int v)
{
E[eptr].next = head[u];
E[eptr].to = v;
head[u] = eptr++;
}
int N;
int f[MaxN][2]; // 0-save, 1-del
int idx[MaxN];
//int children[MaxN];
int keys[MaxN];
bool chcmp(const int ch1, const int ch2)
{
return keys[ch1] < keys[ch2];
}
void calc(int u, int fa)
{
for(int e=head[u]; e!=-1; e=E[e].next)
{
int v = E[e].to;
if(v != fa)
calc(v, u);
}
// for 2 child
f[u][0] = N;
int nchild = 0;
int sumdel = 0;
for(int e=head[u]; e!=-1; e=E[e].next)
{
int v = E[e].to;
if(v != fa)
{
sumdel += f[v][1];
//children[nchild] = v;
keys[nchild] = f[v][0] - f[v][1];
idx[nchild] = nchild;
nchild++;
}
}
if(nchild >= 2)
{
sort(idx, idx+nchild, chcmp);
f[u][0] = keys[idx[0]] + keys[idx[1]] + sumdel;
}
f[u][0] = min(f[u][0], sumdel);
// for del
f[u][1] = 1;
for(int e=head[u]; e!=-1; e=E[e].next)
{
int v = E[e].to;
if(v != fa)
f[u][1] += f[v][1];
}
//printf("f[%d][0] = %d\n", u, f[u][0]);
//printf("f[%d][1] = %d\n", u, f[u][1]);
}
int solve(int root)
{
//printf("-- root = %d --\n", root);
calc(root, -1);
return min(f[root][0], f[root][1]);
}
int main()
{
int T;
cin >> T;
for(int c=0; c<T; c++)
{
eptr = 0;
memset(head, -1, sizeof(head));
cin >> N;
for(int i=1; i<N; i++)
{
int u, v;
cin >> u >> v;
AddEdge(u, v);
AddEdge(v, u);
}
int result = N;
for(int r=1; r<=N; r++)
{
int del = solve(r);
if(del < result)
result = del;
}
printf("Case #%d: %d\n", c+1, result);
}
return 0;
}
|
ce9eb68d33e1627b97c08bac2d7ccd73916f5f02 | f02cafd34d4b6a017a4d865af0a20b9c3a5f691c | /src/math/SparseMatrix.h | 3e219f51db006488e3e32eb7a8732723d6314640 | [
"BSL-1.0"
] | permissive | Batmanabcdefg/nuto | 5f9bde81df4b517a76b2aedf22f774cf4079121a | 79b40e0c66013544ff2a61dad5fb5f82880e4db7 | refs/heads/master | 2021-09-23T10:00:03.291034 | 2018-08-22T15:37:56 | 2018-08-22T15:37:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,165 | h | SparseMatrix.h | #pragma once
#include <random>
#include <Eigen/Core>
#include "base/Exception.h"
namespace NuTo
{
template <class T>
class SparseMatrixCSRGeneral;
template <class T>
class SparseMatrixCSRSymmetric;
template <class T>
class SparseMatrixCSRVector2General;
template <class T>
class SparseMatrixCSRVector2Symmetric;
enum class eSparseMatrixType;
//! @author Stefan Eckardt, ISM
//! @date July 2009
//! @brief ... abstract base class for sparse matrices
template <class T>
class SparseMatrix
{
public:
//! @brief ... constructor
SparseMatrix()
{
}
SparseMatrix(const SparseMatrix<T>& rOther)
{
this->mOneBasedIndexing = rOther.mOneBasedIndexing;
this->mPositiveDefinite = rOther.mPositiveDefinite;
}
virtual void Info() const {};
virtual ~SparseMatrix() = default;
//! @brief ... get number of non-zero entries
//! @return number of non-zero matrix entries
virtual int GetNumEntries() const = 0;
//! @brief ... get number of rows
//! @return number of rows
virtual int GetNumRows() const = 0;
//! @brief ... get number of columns
//! @return number of columns
virtual int GetNumColumns() const = 0;
//! @brief ... resize the matrix and initialize everything to zero
//! @param rRow ... number of rows
//! @param rCol ... number of columns
virtual void Resize(int rRow, int rCol) = 0;
//! @brief ... sets all the values to zero while keeping the structure of the matrix constant, this is interesting
//! for stiffness matrices to use the same matrix structure
virtual void SetZeroEntries() = 0;
//! @brief ... add nonzero entry to matrix
//! @param row ... row of the nonzero entry (zero based indexing!!!)
//! @param column ... column of the nonzero entry (zero based indexing!!!)
//! @param value ... value of the nonzero entry
virtual void AddValue(int row, int column, const T& value) = 0;
//! @brief ... switch to one based indexing
virtual void SetOneBasedIndexing() = 0;
//! @brief ... switch to zero based indexing
virtual void SetZeroBasedIndexing() = 0;
//! @brief ... get type of indexing
//! @return true if one based indexing / false if zero based indexing
inline bool HasOneBasedIndexing() const
{
return this->mOneBasedIndexing;
}
//! @brief ... get type of indexing
//! @return false if one based indexing / true if zero based indexing
inline bool HasZeroBasedIndexing() const
{
return !this->mOneBasedIndexing;
}
//! @brief ... get definiteness of matrix
//! @return true if matrix is positive definite / false if matrix is indefinite
inline bool IsPositiveDefinite() const
{
return this->mPositiveDefinite;
}
//! @brief ... set definiteness of matrix to positive definite
inline void SetPositiveDefinite()
{
this->mPositiveDefinite = true;
}
//! @brief ... set definiteness of matrix to indefinite
inline void SetIndefinite()
{
this->mPositiveDefinite = false;
}
//! @brief ... return the matrix type
virtual NuTo::eSparseMatrixType GetSparseMatrixType() const = 0;
//! @brief ... symmetry of the matrix
//! @return ... true if the matrix is symmetric, false otherwise
virtual bool IsSymmetric() const = 0;
//! @brief ... remove zero entries from matrix (all entries with an absolute value which is smaller than a
//! prescribed tolerance)
//! @param rAbsoluteTolerance ... absolute tolerance
//! @param rRelativeTolerance ... relative tolerance (this value is multiplied with the largest matrix entry
//! (absolute values))
virtual int RemoveZeroEntries(double rAbsoluteTolerance = 0, double rRelativeTolerance = 0) = 0;
//! @brief ... returns true if the matrix allows parallel assembly using openmp with maximum independent sets
//! this is essentially true, if adding a value to a specific row does not change the storage position of values in
//! other rows
//! until now, this is only true for SparseMatrixCSRVector2
virtual bool AllowParallelAssemblyUsingMaximumIndependentSets() const
{
return false;
}
//! @brief ... multiply sparse matrix with a full matrix
//! @param rFullMatrix ... full matrix which is multiplied with the sparse matrix
//! @return ... full matrix
virtual Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
operator*(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& rMatrix) const = 0;
//! @brief ... add sparse matrix
//! @param rMatrix ... sparse matrix
//! @return ... this
virtual NuTo::SparseMatrix<T>& operator+=(const SparseMatrixCSRSymmetric<T>&)
{
throw Exception("[NuTo::SparseMatrix<T>& operator += (const SparseMatrixCSRSymmetric<T> rMatrix)] not "
"implemented for this matrix type.");
}
//! @brief ... add sparse matrix
//! @param rMatrix ... sparse matrix
//! @return ... this
virtual NuTo::SparseMatrix<T>& operator+=(const SparseMatrixCSRVector2Symmetric<T>&)
{
throw Exception("[NuTo::SparseMatrix<T>& operator += (const SparseMatrixCSRVector2Symmetric<T> rMatrix)] "
"not implemented for this matrix type.");
}
virtual Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> ConvertToFullMatrix() const = 0;
virtual SparseMatrixCSRGeneral<T>& AsSparseMatrixCSRGeneral()
{
throw Exception(
"[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type SparseMatrixCSRGeneral.");
}
virtual SparseMatrixCSRSymmetric<T>& AsSparseMatrixCSRSymmetric()
{
throw Exception(
"[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type SparseMatrixCSRSymmetric.");
}
virtual SparseMatrixCSRVector2General<T>& AsSparseMatrixCSRVector2General()
{
throw Exception("[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type "
"SparseMatrixCSRVector2General.");
}
virtual SparseMatrixCSRVector2Symmetric<T>& AsSparseMatrixCSRVector2Symmetric()
{
throw Exception("[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type "
"SparseMatrixCSRVector2Symmetric.");
}
#ifndef SWIG
virtual const SparseMatrixCSRGeneral<T>& AsSparseMatrixCSRGeneral() const
{
throw Exception(
"[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type SparseMatrixCSRGeneral.");
}
virtual const SparseMatrixCSRSymmetric<T>& AsSparseMatrixCSRSymmetric() const
{
throw Exception(
"[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type SparseMatrixCSRSymmetric.");
}
virtual const SparseMatrixCSRVector2General<T>& AsSparseMatrixCSRVector2General() const
{
throw Exception("[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type "
"SparseMatrixCSRVector2General.");
}
virtual const SparseMatrixCSRVector2Symmetric<T>& AsSparseMatrixCSRVector2Symmetric() const
{
throw Exception("[SparseMatrixCSRGeneral::SparseMatrixCSRGeneral] matrix is not of type "
"SparseMatrixCSRVector2Symmetric.");
}
#endif // SWIG
//! @brief Calculate the largest matrix entry
//! @param rResultOutput ... largest matrix entry
T Max() const
{
T max;
int row, col;
MaxEntry(row, col, max);
return max;
}
//! @brief Calculate the smallest matrix entry
//! @param rResultOutput ... smallest matrix entry
T Min() const
{
T min;
int row, col;
MinEntry(row, col, min);
return min;
}
virtual void MaxEntry(int& row_output, int& column_output, T& result_output) const = 0;
virtual void MinEntry(int& row_output, int& column_output, T& result_output) const = 0;
//! @brief calculates the largest absolute matrix entry with the corresponding position
//! @param rRow ... row
//! @param rCol ... column
//! @return ... largest absolute matrix entry
T AbsMax(int& rRow, int& rCol) const
{
T max, min;
int row, col;
MaxEntry(rRow, rCol, max);
MinEntry(row, col, min);
if (std::abs(max) > std::abs(min))
{
// (max, rRow, rCol) is abs maximum
return max;
}
else
{
// (min, row, col) is abs maximum
rRow = row;
rCol = col;
return min;
}
}
//! @brief calculates the largest absolute matrix entry
//! @return ... largest absolute matrix entry
T AbsMax() const
{
int row, col;
return AbsMax(row, col);
}
protected:
//! @brief ... internal indexing of the matrix (true if one based indexing / false if zero based indexing)
bool mOneBasedIndexing = false;
//! @brief ... definiteness of the matrix (true if positive definite / false if indefinite)
bool mPositiveDefinite = false;
int mVerboseLevel = 0;
//! @brief ... resizes and fills the matrix rMatrix with rNumValues random values
//! @param rMatrix ... Matrix<T>
//! @param rDensity ... approximate density = numValues / (rNumRows*rNumColumns)
//! @param rSeed ... random seed
static void FillMatrixRandom(SparseMatrix& rMatrix, double rDensity, int rSeed)
{
std::mt19937 gen(rSeed);
std::uniform_real_distribution<double> value_distribution(0., 10.);
std::uniform_int_distribution<int> row_distribution(0, rMatrix.GetNumRows() - 1);
std::uniform_int_distribution<int> col_distribution(0, rMatrix.GetNumColumns() - 1);
int numValues = (int)(rDensity * rMatrix.GetNumRows() * rMatrix.GetNumColumns());
for (int i = 0; i < numValues; ++i)
{
int row = row_distribution(gen);
int col = col_distribution(gen);
double val = value_distribution(gen);
rMatrix.AddValue(row, col, val);
}
}
};
}
|
c8f1936fa6378a33aa850900a26716810ec93f4c | 2c6baef5f9b9508b783b8a078093b735107ce19c | /src/keyboardTest.cpp | 6d66e667d3f65315d859f9bf77f223b58461c1f9 | [] | no_license | Carton9/ChatRoom | cf9282a6011eb086751fefd884f414d1f7736ab8 | ef697054aeddd5a64d3e5010070c4039d4aa25fa | refs/heads/master | 2022-01-09T23:17:59.383110 | 2019-04-29T15:48:24 | 2019-04-29T15:48:24 | 178,771,755 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 859 | cpp | keyboardTest.cpp | #include <termio.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
using namespace std;
int scanKeyboard(){
int in;
struct termios new_settings;
struct termios stored_settings;
tcgetattr(0,&stored_settings);
new_settings = stored_settings;
new_settings.c_lflag &= (~ICANON);
new_settings.c_cc[VTIME] = 0;
tcgetattr(0,&stored_settings);
new_settings.c_cc[VMIN] = 1;
tcsetattr(0,TCSANOW,&new_settings);
in = getchar();
tcsetattr(0,TCSANOW,&stored_settings);
return in;
}
int main(){
vector<int> buffer;
while(1){
int value=scanKeyboard();
if(value==10){
buffer.clear();
}else{
buffer.push_back(value);
}
system("clear");
for(int i=0;i<buffer.size();i++){
printf("%c",buffer[i]);
}
// else
//
}
} |
ca323644a43f5a7e1914bb744023718a208d759a | 47fafe505458bb10fe7329e8767a2e6dacd98452 | /RSAEncoder.cpp | 83e906f4537ed515edc41253b77a5ecf837ac209 | [] | no_license | tmijieux/RSA-encoding | 4dfff171975d1a41c215dcec8f990f99064913ba | 3d21f8ddf16203849198dd9486509976fc711fcc | refs/heads/master | 2021-06-03T00:15:25.393527 | 2016-08-16T13:40:01 | 2016-08-16T13:40:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,444 | cpp | RSAEncoder.cpp | #include <RSAEncoder.hpp>
#include <algorithm>
#include <cmath>
#include <ctgmath>
using std::vector;
using std::string;
using std::min;
using RSA::Encoder;
#ifndef __GNUC__
# define noexcept
#endif
namespace RSA {
class exception : public std::exception {
std::string _s;
public:
exception(std::string s): _s(s) {}
char const *what() const noexcept { return _s.c_str(); }
};
};
Encoder::Encoder(mpz_class const &N, mpz_class const &E):
_N(N), _E(E)
{
_keyBitLength = mpz_sizeinbase(_N.get_mpz_t(), 2);
_keyLength = _keyBitLength / 8;
printf("encoder N key_bit_length = %zu\n", _keyBitLength);
if (_keyBitLength <= CHAR_BIT + 1)
throw exception("key too small");
}
/* if the binary representation 'S' of the ToBeEncoded String is bigger
than N ( N =~ keySize(N) ) it cannot be decoded properly
( rather the decoding algorithm may output something like "S mod N" )
String longer than keyLength are then splitted
*/
vector<mpz_class> &Encoder::SplitData(
std::string &str, vector<mpz_class> &output)
{
size_t len = str.length();
size_t lenCopy = len;
size_t nread = 0;
const char *data = str.c_str();
while (nread < len) {
mpz_class i;
size_t read = min(_keyLength, lenCopy);
mpz_import(i.get_mpz_t(), 1, 1, read, 0, 0, data);
output.push_back(i);
data += read;
nread += read;
lenCopy -= read;
}
return output;
}
string Encoder::MpzToString(mpz_class &c)
{
size_t length = mpz_sizeinbase(c.get_mpz_t(), 10) + 2;
char *c_str = new char[length];
mpz_get_str(c_str, 10, c.get_mpz_t());
string s(c_str);
delete [] c_str;
return s;
}
static string trim(string& str)
{
size_t first = str.find_first_not_of(' ');
size_t last = str.find_last_not_of(' ');
return str.substr(first, (last-first+1));
}
string Encoder::Encrypt(string data)
{
vector<mpz_class> input;
string output = "";
input = SplitData(data, input);
for_each(
input.begin(), input.end(),
[&] (mpz_class m) {
mpz_class c;
mpz_powm_sec(
c.get_mpz_t(),
m.get_mpz_t(),
_E.get_mpz_t(),
_N.get_mpz_t()
);
output += MpzToString(c) + " ";
}
);
return trim(output);
}
|
f31a92cf86179d49e6754722de3ca7b16483471d | 89d113159b17f92e7ee245c0caa2ccccb2aed7c2 | /dynamic_library/thread_group.hpp | 33428595cd61eb3d6e7e111ba158d6404243e410 | [] | no_license | vell999/github-upload | be579d2fadf9ed5a6f56f4c06ce33489abb5cc6c | 988eea89a860e231f7e29763333dcfbe2244c664 | refs/heads/master | 2023-05-12T03:47:29.255213 | 2021-06-02T12:14:38 | 2021-06-02T12:14:38 | 373,141,271 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 703 | hpp | thread_group.hpp | #ifndef THREAD_GROUP_H
#define THREAD_GROUP_H
#include <vector>
#include <mutex>
#include "worker.hpp"
namespace advcpp
{
class ThreadGroup
{
public:
explicit ThreadGroup(WaitableQueue<SharedPointer<ITask> > & a_tasks);
bool AddWorker(size_t a_numOfWorkers = 1);
bool SubstractWorker(size_t a_numOfWorkers = 1);
bool ShutDown();
size_t Size() const;
private:
void throwPoisonApples(size_t numOfApples) const;
size_t joinCloseWorkers();
size_t minThreads(size_t givenNum);
private:
std::vector<SharedPointer<Worker> > m_workers;
WaitableQueue<SharedPointer<ITask> > & m_tasks;
mutable Mutex m_mutex;
};
} // namespace advcpp
#endif // THREAD_GROUP_H |
395cad00b57f67f52efecb5a7ffb42e70351b23e | adccf957cc9d88b9571231e79102ca3646aee39c | /Library/Strings/suffixarray.cpp | 4e0a8abeb65bf73e055173fd5c9080dda80ae5a8 | [
"BSD-3-Clause"
] | permissive | hanrick2000/Competitive-Programming-1 | 20d6cc81988910b7526ac63d4810419915c3fc11 | 29f94315a456c7b9164b8f1c2cd1fc6290edd486 | refs/heads/master | 2020-09-28T02:38:25.103927 | 2019-09-02T13:02:09 | 2019-09-02T13:02:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,588 | cpp | suffixarray.cpp | /*
Suffix Array
Obtiene los sufijos de un string ordenados lexicograficamente
Complejidad: O(n log n)
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define VI vector<int>
#define pii pair<int,int>
#define matrix vector<VI>
#define LL long long
#define ULL unsigned long long
#define uedge(g,a,b) g[a].pb(b), g[b].pb(a)
#define dedge(g,a,b) g[a].pb(b)
using namespace std;
#define MAX_N 200010
char T[MAX_N];
int n;
int RA[MAX_N], tempRA[MAX_N];
int SA[MAX_N], tempSA[MAX_N];
int c[MAX_N];
int Phi[MAX_N];
int LCP[MAX_N], PLCP[MAX_N];
void countingSort(int k){
int i, sum, maxi = max(300, n);
memset(c, 0, sizeof(c));
for(i = 0; i < n; i++) c[i+k < n ? RA[i+k]:0]++;
for(i = sum = 0; i < maxi; i++){
int t = c[i]; c[i] = sum; sum += t;
}
for(i = 0; i < n; i++)
tempSA[c[SA[i]+k < n ? RA[SA[i]+k] : 0]++] = SA[i];
for(i = 0; i < n; i++)
SA[i] =tempSA[i];
}
void constructSA(){
int i, k, r;
for(i = 0; i < n; i++) RA[i] = T[i];
for(i = 0; i < n; i++) SA[i] = i;
for(k = 1; k < n; k <<= 1){
countingSort(k);
countingSort(0);
tempRA[SA[0]] = r = 0;
for(i = 1; i < n; i++)
tempRA[SA[i]] = (RA[SA[i]] == RA[SA[i-1]] && RA[SA[i]+k] == RA[SA[i-1]+k]) ? r : ++r;
for(i = 0; i < n; i++) RA[i] = tempRA[i];
if(RA[SA[n-1]] == n-1) break;
}
}
void computeLCP(){
int i, L;
Phi[SA[0]] = -1;
for(i = 1; i < n; i++)
Phi[SA[i]] = SA[i-1];
for(i = L = 0; i < n; i++){
if(Phi[i] == -1){
PLCP[i] = 0;
continue;
}
while(T[i+L]==T[Phi[i]+L]) L++;
PLCP[i] = L;
L = max(L-1, 0);
}
for(i = 0; i < n; i++)
LCP[i] = PLCP[SA[i]];
} |
b9fb866f71e92029bd7337dcb9d73e4128da24a5 | 880ba6f0ad1090d5c1d837d0e76d1d767ebe20d8 | /source/zhu01.h | 5a374f78e36790056b513c6497ab92459b1c3af9 | [] | no_license | jetma/adso | 7657e02978c0afdc35c66a67771841ddbed69f17 | 56fd41696a542cc9a80da60a6ffe06ebfb2e67f3 | refs/heads/master | 2020-06-18T12:32:10.407939 | 2019-03-03T08:49:52 | 2019-03-03T08:49:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 141 | h | zhu01.h | #ifndef ZHU01_H
#define ZHU01_H
#include "special.h"
class Zhu01: public Special {
public:
Zhu01(Text *t);
~Zhu01();
};
#endif
|
ffe740543711fd84c7e8c6d52093912ed34f6c4f | 0707de6a2514c903858d6b29e5290b86be4800bf | /highway.h | 9d7b6c09d8dec200342b31a05d5f19a61333d08c | [] | no_license | Hepic/ErgasiaOOP | 4a8e797c1d25ae3743940b12b8a4feed3c5b017a | 26f76ce6eb99a7b5aaebb6ed65667f57a49d093c | refs/heads/master | 2021-05-11T21:06:14.908723 | 2016-01-23T12:57:42 | 2016-01-23T12:57:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 413 | h | highway.h | #ifndef _highway_h
#define _highway_h
#include <iostream>
#include <vector>
using namespace std;
class segment;
//const int min_capacity = 10;
//const int max_capacity = 20;
class highway
{
public:
highway(int, int);
~highway();
void operate();
int get_no_of_vehicles() const;
private:
vector <segment*> Segs;
int no_cars;
};
#endif // _highway_h
|
77f54cd12164dd7eb07e7843934bb87d0c8c999c | 36e628616bfa4ecdea25bde2a155a69eb03d6ff0 | /JZ51 构建乘积数组.cpp | dae58eb5e40bc31f2ac04ccddac9f3998cacbe94 | [] | no_license | SnowyyWind1998/JZoffer | a0a4281f29910236046167a99fb563c7d70e6da9 | 58d2c46cb59010643579479f9ba8ad6b1b2b6be5 | refs/heads/main | 2023-03-04T17:53:04.259031 | 2021-02-20T08:56:53 | 2021-02-20T08:56:53 | 340,604,813 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 820 | cpp | JZ51 构建乘积数组.cpp | class Solution {
public:
vector<int> multiply(const vector<int>& A) {
vector<int> B(A);
vector<int> res;
if(A.size() == 0 || A.size() == 1) return B;
vector<int> temp(A.size(), 1);
for(unsigned long i = 0; i < B.size(); i++){
int m = B[i];
B[i] = temp[i];
temp[i] = m;
getNum(A, B, i, res);
m = B[i];
B[i] = temp[i];
temp[i] = m;
}
return res;
}
void getNum(const vector<int> &A, vector<int> &B, unsigned long &i, vector<int> &res){
int k = 1;
for(unsigned long j = 0; j < B.size(); j++){
if(j == i){
continue;
}
k *= A[j];
}
res.push_back(k);
}
}; |
7309f039a38667468752620389a0ecf1235b39b6 | 08d7a5a7e2c9814fec46b459b4bd644e2223ebd7 | /dcmrender [MSVC 6]/src/dcmapi/DcmTherapySequence.h | 8fc2c947fdb2a4d468809575959c5073e609dcaa | [] | no_license | IMAGE-ET/dicom-render | c936924e07840a966ccc0779344c69230c9b0470 | dce9f4c725740c0e46ef060e6022e5694d3a7518 | refs/heads/master | 2020-03-11T15:27:05.459768 | 2012-04-08T19:07:08 | 2012-04-08T19:07:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,433 | h | DcmTherapySequence.h | // DcmTherapySequence.h: interface for the CDcmTherapySequence class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DCMTHERAPYSEQUENCE_H__01849055_9737_43C5_BD36_1C93F498179A__INCLUDED_)
#define AFX_DCMTHERAPYSEQUENCE_H__01849055_9737_43C5_BD36_1C93F498179A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "DcmSequence.h"
#include "DcmCodeSequenceMacro.h"
class AFX_EXT_CLASS CDcmTherapySequence : public CDcmSequence
{
public:
DECLARE_SERIAL( CDcmTherapySequence );
public:
CDcmTherapySequence();
virtual ~CDcmTherapySequence();
public:
CString& InterventionalStatus();
void InterventionalStatus(const CString& Tag_0018_0038_2_CS_VM_1 );
public:
CString& InterventionDrugStartTime();
void InterventionDrugStartTime(const CString& Tag_0018_0035_3_TM_VM_1 );
public:
CString& InterventionDrugStopTime();
void InterventionDrugStopTime(const CString& Tag_0018_0027_3_TM_VM_1 );
public:
CString& TherapyDescription();
void TherapyDescription(const CString& Tag_0018_0039_3_CS_VM_1 );
public:
CDcmCodeSequenceMacroEx& Code();
CDcmCodeSequenceMacroEx& InterventionalDrug();
CDcmCodeSequenceMacroEx& AdministrationRoute();
private:
CDcmCodeSequenceMacroEx m_CodeSequenceMacro, m_DrugSequence_0018_0029_3,
m_AdministrationRoute_0054_0302_3;
};
#endif // !defined(AFX_DCMTHERAPYSEQUENCE_H__01849055_9737_43C5_BD36_1C93F498179A__INCLUDED_)
|
33c204cc981cca212174ccfd65e868619d2d52cf | e2bf5d20fe26632da3214bc623e7c82afe50d63a | /ModernCocoaFarmer/Lua/Source/ScriptCommands/Family/FamilyScriptCommands.cpp | 4b00a093a5f60d4fa9bd9c2668d2feab3b1c1a23 | [] | no_license | AlanWills/ModernCocoaFarmer | ae0d8be36960c1dfe557c59bdf23912a4b3cb37a | d04beb8e6b8d538a4cc468958a80f86803d49a5d | refs/heads/master | 2021-07-11T23:42:08.358865 | 2020-07-21T21:30:49 | 2020-07-21T21:30:49 | 81,137,087 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 575 | cpp | FamilyScriptCommands.cpp | #include "ScriptCommands/Family/FamilyScriptCommands.h"
#include "ScriptCommands/Family/DataSourcesScriptCommands.h"
#include "ScriptCommands/Family/FamilyManagerScriptCommands.h"
#include "ScriptCommands/Family/ChildScriptCommands.h"
namespace MCF::Lua::Family::ScriptCommands
{
//------------------------------------------------------------------------------------------------
void initialize(sol::state& state)
{
DataSourcesScriptCommands::initialize(state);
FamilyManagerScriptCommands::initialize(state);
ChildScriptCommands::initialize(state);
}
} |
6f821e1d09a9e71f798ced84e79c282d181ca712 | a6e16f8b4e3e9dfb7a8b6f323b7e35fb82537222 | /C/Manfred Lippert/Manitor Sources/Manitor 2/200Hz.cp | 783399e615cfae8e605006c86bc7326314a9bd0b | [] | no_license | pjones1063/Atari_ST_Sources | 59cd4af5968d20eb3bf16836fc460f018aa05e7c | fe7d2d16d3919274547efbd007f5e0ec1557396d | refs/heads/master | 2020-09-04T20:21:44.756895 | 2019-10-30T12:54:05 | 2019-10-30T12:54:05 | 219,878,695 | 2 | 0 | null | 2019-11-06T00:40:39 | 2019-11-06T00:40:39 | null | UTF-8 | C++ | false | false | 688 | cp | 200Hz.cp | #include "200Hz.h"
#include <gemdos.h>
#include <XBRA.h>
volatile int32 my_200Hz;
int32 my_200Hz_begin;
extern XBRA XBRA_200Hz;
bool install_200Hz() {
if (check_XBRA_user(&XBRA_200Hz, (xbra_function *)0x114)) {
return false;
}
install_XBRA_user(&XBRA_200Hz, (xbra_function *)0x114);
do {
} while (my_200Hz == 0);
my_200Hz_begin = my_200Hz;
return true;
}
bool deinstall_200Hz(bool is_super, bool wait) {
bool ok;
do {
if (is_super) {
ok = remove_XBRA_super(&XBRA_200Hz, (xbra_function *)0x114);
} else {
ok = remove_XBRA_user(&XBRA_200Hz, (xbra_function *)0x114);
if (wait && !ok) {
Fselect(200, 0L, 0L, 0L);
}
}
} while (wait && !ok);
return ok;
}
|
64068d7f27bf3b6926a1e8d7ec309ac0b304e0e7 | 78b28019e10962bb62a09fa1305264bbc9a113e3 | /common/calculus/ext_polynomial/io.h | b03fdc62e8a69aa607d374a920bb637367c6d769 | [
"MIT"
] | permissive | Loks-/competitions | 49d253c398bc926bfecc78f7d468410702f984a0 | 26a1b15f30bb664a308edc4868dfd315eeca0e0b | refs/heads/master | 2023-06-08T06:26:36.756563 | 2023-05-31T03:16:41 | 2023-05-31T03:16:41 | 135,969,969 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 537 | h | io.h | #pragma once
#include "common/calculus/ext_polynomial/function.h"
#include "common/calculus/ext_polynomial/term.h"
#include <iostream>
namespace calculus {
namespace ext_polynomial {
template <class TValueF, class TValueTerm, class TTerm>
inline std::ostream& operator<<(std::ostream& s,
const Function<TValueF, TValueTerm, TTerm>& f) {
if (f.Empty()) {
s << 0;
} else {
for (auto& t : f.terms) s << t.ToString("x");
}
return s;
}
} // namespace ext_polynomial
} // namespace calculus
|
34e15ca2bf2584c15222224b33751f0211c85ff8 | 898f6fcf48ef680e48617cda241236eae7b501b6 | /graph/DepthFirstOrder.cpp | 9a5ecd64351f0e8da841f00e332ceaed4e751601 | [] | no_license | wuaiu/graph | a6cbdd189760d8baa590c76f3d5ed5a67cf54a4f | 78413abe349f61fc2f5930bf5ce8d4850496ffc0 | refs/heads/master | 2021-01-01T19:36:03.767758 | 2017-08-25T10:43:45 | 2017-08-25T10:43:45 | 98,619,254 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 521 | cpp | DepthFirstOrder.cpp | #include "DepthFirstOrder.h"
DepthFirstOrder::DepthFirstOrder(Digraph G)
{
pre = queue<int> ();
post = queue<int> ();
reversePost = stack<int>();
marked = vector<bool>(G.getV());
for (int v = 0;v< G.getV();v++)
{
if (!marked[v])
{
dfs(G,v);
}
}
}
void DepthFirstOrder::dfs(Digraph G,int v)
{
pre.push(v);
marked[v] = true;
vector<int> vec = G.getAdj(v);
for (auto iter = vec.begin();iter!=vec.end();iter++)
{
if (!marked[*iter])
{
dfs(G,*iter);
}
}
post.push(v);
reversePost.push(v);
} |
6f6389b79237abf4530f40e6f389f7379584cb7d | b172f70ae395079ff24460333e53c8b051570e60 | /problem/Shuffle.cpp | 464c69727a35e1d894d4ec159ccfbe3ef58cedab | [] | no_license | yuanye111/leetcode | f78b1b9f5571d55d110610497832d10925588cae | 277e8432ad185c2d782f3429856a1475421e11d5 | refs/heads/master | 2022-04-10T04:13:22.468029 | 2020-03-24T02:51:49 | 2020-03-24T02:51:49 | 175,430,517 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | cpp | Shuffle.cpp | #include <stdio.h>
#include <vector>
using namespace std;
#include <iostream>
#include <stdlib.h>
#include <time.h>
class Solution {
public:
std::vector<int> InitArr;
Solution(vector<int>& nums) {
InitArr = nums;
}
/** Resets the array to its original configuration and return it. */
vector<int> reset() {
return InitArr;
}
/** Returns a random shuffling of the array. */
vector<int> shuffle() {
vector<int> ShuffleArr = InitArr;
for(int i = ShuffleArr.size() - 1; i >= 0 ; i--)
{
srand((unsigned)time(NULL));
int pos = rand()%(i+1);
int tmp = ShuffleArr[i];
ShuffleArr[i] = ShuffleArr[pos];
ShuffleArr[pos] = tmp;
}
return ShuffleArr;
}
};
int main()
{
for(int i=0;i<10;i++)
printf("%d\n",rand()%100);
}
/**
* Your Solution object will be instantiated and called as such:
* Solution* obj = new Solution(nums);
* vector<int> param_1 = obj->reset();
* vector<int> param_2 = obj->shuffle();
*/ |
e8fa4c7ad3f0df79c290ea1822ca62b13b876d24 | 76eed6bfac0d80b64e459bfdd29f1cfe79443d49 | /INLINE.CPP | 3719ee9c861f31eff3629ae0b647985e32ff8969 | [] | no_license | it-sourabh/Cpp | 6b4779aab50f8e84aa8d4d97912b2188736db5d7 | c76460ce3cb50946190a666282d4c34ffbd2258f | refs/heads/master | 2023-04-03T17:10:59.741416 | 2021-04-03T08:25:19 | 2021-04-03T08:25:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 340 | cpp | INLINE.CPP | #include<iostream.h>
#include<conio.h>
inline sqr(int a) //Defining the inline function
{
return a*a;
}
void main()
{
int x;
clrscr();
cout << "Enter the number: ";
cin >> x; //Taking the number from user
cout << "The square of the number is: " << sqr(x); //Calling the inline function and getting square of the number
getch();
} |
3693c118ab73f2fba09df3117704f0e301b8ca8b | 4592a25c490c52efa8abcd08e7b7d5276c4e0d8e | /EX05/EX05_5/source/Account.cpp | 66809f5d77015a8b69d44dcda119903ce6462b48 | [] | no_license | TommyBClauson/EX05 | 99fa324041119034bb8c87ae1a25fcda9c43c1c5 | ade1eabd5790a9d0d6b41ad5f25642ea279a1560 | refs/heads/master | 2020-06-03T08:03:57.025573 | 2019-06-12T05:36:05 | 2019-06-12T05:36:05 | 191,504,148 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,907 | cpp | Account.cpp | #include "Account.h"
#include "Date.h"
#include "Transaction.h"
#include <vector>
#include <string>
#include <iostream>
using namespace std;
Account::Account() // no-arg constructor
{
// setting vars to be zero as default
id = 0;
balance = 0.0;
annualInterestRate = 0.0;
}
Account::Account(string newName, int newId, double newBalance)
{
name = newName;
id = newId;
balance = newBalance;
}
Account::Account(double newAnnualInterestRate, double newBalance, int newId, string newName)
{
annualInterestRate = newAnnualInterestRate;
balance = newBalance;
id = newId;
name = newName;
}
int Account::GetId()
{
return id;
}
string Account::GetName()
{
return name;
}
double Account::GetBalance()
{
return balance;
}
double Account::GetAnnualInterestRate()
{
return annualInterestRate;
}
double Account::GetMonthlyInterestRate()
{
return Account::annualInterestRate / 12;
}
double Account::Withdraw(double amount)
{
balance -= amount;
Date dateCreated(2019, 11, 06);
Transaction newTrans(dateCreated, 'W', balance, "Withdrawl Made");
transactions.push_back(newTrans);
return balance;
}
double Account::Deposit(double amount)
{
balance += amount;
Date dateCreated(2019, 11, 06);
Transaction newTrans(dateCreated, 'D', balance, "Deposit Made");
transactions.push_back(newTrans);
return balance;
}
void Account::SetId(int newId)
{
id = newId;
}
void Account::SetName(string newName)
{
name = newName;
}
void Account::SetBalance(double newBalance)
{
balance = newBalance;
}
void Account::SetAnnualInterestRate(double newAnnualInterestRate)
{
annualInterestRate = newAnnualInterestRate;
}
void Account::SetDateCreated(Date newDateCreated)
{
dateCreated = newDateCreated;
} |
ecd02adadf9ade35b2af8dd158642070d56fdff9 | 3c1032c786aa63e0768cacabdde78f28e2cbbcb0 | /bin/acmproj_files/template.cpp | 3547471ff923c7c7edaaa3ea6d9ca3bcb016bfa6 | [] | no_license | sich-off/config | eb2a52cf3d427624afa86d4e8112a027e40e1dbf | 63078d864cf2f7182cc5a19fb41cc8929b678b8a | refs/heads/master | 2021-01-20T20:56:53.219487 | 2011-11-17T22:31:29 | 2011-11-17T22:31:29 | 2,781,038 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 496 | cpp | template.cpp | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
const int debug = 0;
const int max_n = 1000;
const double eps = 1e-6;
const double pi = acos(0.0) * 2;
const int inf = 2000000000;
int n;
bool solution()
{/*{{{*/
if (scanf("%d", &n) == EOF)
{
return false;
}
return true;
}/*}}}*/
int main()
{/*{{{*/
while (solution())
{
continue;
}
return 0;
}/*}}}*/
|
b81014391b74e439e539046a9d7a5c775be94848 | 69a99d6c06071bbac21a5a2fb7aeffbd4f4edfe7 | /OrganicGLWinLib/PosZFaceResolver.h | fadf49cf661d32c1d2e410d6b7c43e636cbd7029 | [] | no_license | bigans01/OrganicGLWinLib | 66e9034cee14c0b8e9debd0babc46c9ec36ebbea | 01dafe917155dfe09eb559e889af852dc0b0a442 | refs/heads/master | 2023-07-21T14:37:43.022619 | 2023-07-17T23:13:20 | 2023-07-17T23:13:20 | 156,916,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 577 | h | PosZFaceResolver.h | #pragma once
#ifndef POSZFACERESOLVER_H
#define POSZFACERESOLVER_H
#include "FaceResolverBase.h"
#include "XDimLine.h"
#include "YDimLine.h"
#include "CategorizedLine.h"
#include "CSCorrectionCandidate.h"
#include "SPolyFracturer.h"
class PosZFaceResolver : public FaceResolverBase
{
public:
void setupBorderLineRangesAndDimLoc();
void runResolutionAlgorithm();
void produceMalformedMitigation();
private:
float zLocation = 0.0f; // can be 1, 4, or 32; will be same as dimensionalLimit value, since we are at POS_Z
bool attemptSolveByInvalidCount();
};
#endif
|
afddcb2f8d9a554c38cd995e0bbd3df0911cb4ed | 6a193ed24a6b733a57f31d77b3bf43aab59f903c | /src/camera.h | 6dcb854a7b0653c4bfa2e12e9829667bdf728f49 | [] | no_license | Grulfen/solar | 6e9aa16018a60640ace370749d20da3547a6e2c9 | 4c0d1042089c519d6ff2017fe97419086464c663 | refs/heads/master | 2021-01-10T17:40:43.795687 | 2014-03-13T11:49:10 | 2014-03-13T11:49:10 | 8,434,937 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,113 | h | camera.h | #ifndef CAMERA_H
#define CAMERA_H
#include"VectorUtils3.h"
class Camera {
private:
int program;
// x används för att musen inte ska fastna i kanterna på
// fönstret
int x;
public:
vec3 position;
vec3 look_at_pos;
vec3 up;
mat4 matrix;
void rotate(char direction, float angle);
void translate(float dx, float dy, float dz);
void forward(float d);
void strafe(float d);
void update();
float radius;
float cam_position[3];
void point_to(vec3 pos);
/*************************************************************
* change_look_at_pos:
* Tar xrel från MouseMotionEvent och y som absolut koordinat
* width, height är storlek på nuvarande fönster
* Sätter look_at_pos därefter
* **********************************************************/
void change_look_at_pos(int xrel, int y, int width, int height);
void upload();
Camera(int program);
Camera();
void print_matrix();
};
#endif
|
eebef9179634a64f40a6b10cba294a34e6d14ad3 | 27613fe5b7f8df616cfc9a947d925a56fa107687 | /microreactor/src/Message.cpp | ce0a521e5e3a3e473da18d15e5d933154ed9e9dc | [] | no_license | gzhu108/sg | cbc926b42904065914ab31c9cfde4a8af856a25b | 1dece540ed8a8ec18ba9ff9a26bfcb953f7dc94f | refs/heads/master | 2022-01-16T00:09:27.590573 | 2022-01-05T02:14:04 | 2022-01-05T22:28:19 | 41,080,463 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | cpp | Message.cpp | #include "Message.h"
using namespace microreactor;
Message::Message()
{
}
Message::~Message()
{
}
bool Message::HasTimedOut()
{
if (ResponseTimeout() > std::chrono::milliseconds::zero())
{
auto responseTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - mRequestTime);
return responseTime >= ResponseTimeout();
}
return false;
}
bool Message::Read(const std::string& buffer)
{
std::stringstream stream(buffer);
return Decode(stream);
}
bool Message::Write(std::string& buffer) const
{
std::stringstream stream;
if (Encode(stream))
{
buffer = stream.str();
return true;
}
return false;
}
bool Message::Encode(std::ostream& stream) const
{
return false;
}
bool Message::Decode(std::istream& stream)
{
return false;
}
|
c1dcdc677e39ddf7f4db1fdbdce91d967e262ffc | bf325d30bfc855b6a23ae9874c5bb801f2f57d6d | /acm test/春/5/Abeta.cpp | 36fade2d33121bf7b559d76a82cd9e135f028a8d | [] | no_license | sudekidesu/my-programes | 6d606d2af19da3e6ab60c4e192571698256c0109 | 622cbef10dd46ec82f7d9b3f27e1ab6893f08bf5 | refs/heads/master | 2020-04-09T07:20:32.732517 | 2019-04-24T10:17:30 | 2019-04-24T10:17:30 | 160,151,449 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 643 | cpp | Abeta.cpp | #include<iostream>
using namespace std;
int min(int a,int b);
int main()
{
int au[2005][2]={0},K;
int dp[2005]={0};
int o,N,i;
cin>>N;
for(o=0;o<N;o++)
{
int HH=8,MM=0,SS=0;
cin>>K;
for(i=1;i<=K;i++)
cin>>au[i][0];
for(i=2;i<=K;i++)
cin>>au[i][1];
dp[1]=au[1][0];
for(i=2;i<=K;i++)
dp[i]=min(dp[i-1]+au[i][0],dp[i-2]+min(au[i][0]+au[i-1][0],au[i][1]));
SS+=dp[K];
if(SS>=60)
{
MM+=SS/60;
SS%=60;
}
if(MM>=60)
{
HH+=MM/60;
MM%=60;
}
if(HH>12)
printf("%02d:%02d:%02d pm\n",HH-12,MM,SS);
else
printf("%02d:%02d:%02d am\n",HH,MM,SS);
}
}
int min(int a,int b)
{
return a<b?a:b;
}
|
ec829a041c8f2119a38fcfcec9a8f4b4b51d424e | f950882940764ace71e51a1512c16a5ac3bc47bc | /src/GisEngine/GeoDatabase/SQLiteTransaction.h | ac419767d127cfa4202d2d1939283134877e27f3 | [] | no_license | ViacheslavN/GIS | 3291a5685b171dc98f6e82595dccc9f235e67bdf | e81b964b866954de9db6ee6977bbdf6635e79200 | refs/heads/master | 2021-01-23T19:45:24.548502 | 2018-03-12T09:55:02 | 2018-03-12T09:55:02 | 22,220,159 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 929 | h | SQLiteTransaction.h | #ifndef GIS_ENGINE_GEO_DATABASE_SQLITE_TRANSACTION_H_
#define GIS_ENGINE_GEO_DATABASE_SQLITE_TRANSACTION_H_
#include "GeoDatabase.h"
namespace GisEngine
{
namespace GeoDatabase
{
namespace SQLiteUtils
{
class CSQLiteDB;
}
class CSQLiteTransaction : public ITransaction
{
public:
CSQLiteTransaction(SQLiteUtils::CSQLiteDB *pDB);
~CSQLiteTransaction();
bool begin();
virtual bool commit();
virtual bool rollback();
virtual void GetError(CommonLib::CString& sText);
virtual IInsertCursorPtr CreateInsertCusor(ITable *pTable, IFieldSet *pFileds = 0);
virtual IUpdateCursorPtr CreateUpdateCusor(ITable *pTable, IFieldSet *pFileds = 0);
virtual IDeleteCursorPtr CreateDeleteCusor(ITable *pTable, IFieldSet *pFileds = 0);
private:
SQLiteUtils::CSQLiteDB *m_pDB;
bool m_bCommit;
bool m_bEnd;
bool m_bBegin;
};
}
}
#endif |
ed18327fd74d3344e5dae2845d5d5227ea614ffe | 0fc1fc6dc068c9a0217fad056f538cc40fc02a2a | /Billiards/Billiards/Header/FBXInitialize.h | f110e5a6a6b0a6b7f7c12f7c8d046f78239690f4 | [] | no_license | AStel7th/Billiards | 7637fffa3aa752bd6d6402c66833b82fe848f3b8 | f4d4a95100109a86c159496b13556762ed761f1e | refs/heads/master | 2021-01-09T23:36:53.855350 | 2017-01-05T18:48:51 | 2017-01-05T18:48:51 | 73,210,456 | 1 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,241 | h | FBXInitialize.h | #pragma once
#include "func.h"
#include <fbxsdk.h>
#include <Windows.h>
enum eAXIS_SYSTEM
{
eAXIS_DIRECTX = 0,
eAXIS_OPENGL,
};
static void FBXMatrixToFloat16(FbxMatrix* src, float dest[16])
{
unsigned int nn = 0;
for (int i = 0; i<4; i++)
{
for (int j = 0; j<4; j++)
{
dest[nn] = static_cast<float>(src->Get(i, j));
nn++;
}
}
}
class FBX
{
public:
// FBX SDK
FbxManager* mSdkManager;
FbxScene* mScene;
FbxImporter * mImporter;
FBX()
{
mSdkManager = nullptr;
mScene = nullptr;
mImporter = nullptr;
}
~FBX()
{
if (mImporter)
{
mImporter->Destroy();
mImporter = nullptr;
}
if (mScene)
{
mScene->Destroy();
mScene = nullptr;
}
if (mSdkManager)
{
mSdkManager->Destroy();
mSdkManager = nullptr;
}
}
void TriangulateRecursive(FbxNode* pNode)
{
FbxNodeAttribute* lNodeAttribute = pNode->GetNodeAttribute();
if (lNodeAttribute)
{
if (lNodeAttribute->GetAttributeType() == FbxNodeAttribute::eMesh ||
lNodeAttribute->GetAttributeType() == FbxNodeAttribute::eNurbs ||
lNodeAttribute->GetAttributeType() == FbxNodeAttribute::eNurbsSurface ||
lNodeAttribute->GetAttributeType() == FbxNodeAttribute::ePatch)
{
FbxGeometryConverter lConverter(pNode->GetFbxManager());
// これでどんな形状も三角形化
#if 0
lConverter.TriangulateInPlace(pNode); // 古い手法
#endif // 0
lConverter.Triangulate(mScene, true);
}
}
const int lChildCount = pNode->GetChildCount();
for (int lChildIndex = 0; lChildIndex < lChildCount; ++lChildIndex)
{
// 子ノードを探索
TriangulateRecursive(pNode->GetChild(lChildIndex));
}
}
HRESULT Initialaize(const char* filename, const eAXIS_SYSTEM axis = eAXIS_SYSTEM::eAXIS_OPENGL)
{
if (!filename)
return E_FAIL;
HRESULT hr = S_OK;
//Fbxマネージャ生成
mSdkManager = FbxManager::Create();
if (!mSdkManager)
{
FBXSDK_printf("Error: Unable to create FBX Manager!\n");
exit(1);
}
else FBXSDK_printf("Autodesk FBX SDK version %s\n", mSdkManager->GetVersion());
//IOSettingsオブジェクトを作成します。このオブジェクトはすべてのインポート/エクスポート設定を保持しています。
FbxIOSettings* ios = FbxIOSettings::Create(mSdkManager, IOSROOT);
mSdkManager->SetIOSettings(ios);
//実行ディレクトリから読み込みプラグイン(オプション)
FbxString lPath = FbxGetApplicationDirectory();
mSdkManager->LoadPluginsDirectory(lPath.Buffer());
//FBXシーンを作成します。このオブジェクトは、ファイルへの/からエクスポート、インポートほとんどのオブジェクトを/保持しています。
mScene = FbxScene::Create(mSdkManager, "My Scene");
if (!mScene)
{
FBXSDK_printf("Error: Unable to create FBX scene!\n");
exit(1);
}
// インポータ作成
mImporter = FbxImporter::Create(mSdkManager, "");
int lFileFormat = -1;
if (!mSdkManager->GetIOPluginRegistry()->DetectReaderFileFormat(filename, lFileFormat))
{
// 認識できないファイル形式をバイナリ形式に変換?
lFileFormat = mSdkManager->GetIOPluginRegistry()->FindReaderIDByDescription("FBX binary (*.fbx)");;
}
// ファイル名を用いてインポーター初期化
if (!mImporter || mImporter->Initialize(filename, lFileFormat, mSdkManager->GetIOSettings()) == false)
return E_FAIL;
//
if (!mImporter || mImporter->Import(mScene) == false)
return E_FAIL;
FbxAxisSystem OurAxisSystem = FbxAxisSystem::DirectX;
if (axis == eAXIS_OPENGL)
OurAxisSystem = FbxAxisSystem::OpenGL;
// DirectX系
FbxAxisSystem SceneAxisSystem = mScene->GetGlobalSettings().GetAxisSystem();
if (SceneAxisSystem != OurAxisSystem)
{
FbxAxisSystem::DirectX.ConvertScene(mScene);
}
// 単位系の統一
// 不要でもいいかも
FbxSystemUnit SceneSystemUnit = mScene->GetGlobalSettings().GetSystemUnit();
if (SceneSystemUnit.GetScaleFactor() != 1.0)
{
// センチメーター単位にコンバートする
FbxSystemUnit::cm.ConvertScene(mScene);
}
// 三角形化(三角形以外のデータでもコレで安心)
TriangulateRecursive(mScene->GetRootNode());
return hr;
}
}; |
778f17516cb8d8830b646f0fe38b77b0cd2c67c8 | b6285c1402cd9aa2265823ae59f634e8c3281dd5 | /Sheokand and Numbers.cpp | 53e91848a6be660904c1367a398c812de974af8b | [] | no_license | Aghamarsh/CodeChef-Aug18B | 9be7c9533652b3246dfb65511b7c8e41dc350869 | feba8290a5bfefb4e93be4d14a1019277bb1ea1d | refs/heads/master | 2020-03-30T03:12:01.785447 | 2018-10-01T01:18:28 | 2018-10-01T01:18:28 | 150,675,186 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,404 | cpp | Sheokand and Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll ar[32];
ar[0]=1;
int i=1;
while(i<32)
{
ar[i]=ar[i-1]*2;
i++;
}
//cout<<ar[31];
ll t;
cin>>t;
ll n;
for(ll i=0;i<t;i++)
{
cin>>n;
int c=0;
ll temp=n;
while(temp)
{
if(temp%2==1)
c++;
temp=temp/2;
}
if(c==2)
{
cout<<0<<endl;
}
else
{
ll l=0,r=31;
ll p,q;
while(l<r)
{
ll mid=l+(r-l)/2;
//cout<<l<<" "<<r<<endl;
if(ar[mid]==n)
{
p=mid;
q=mid+1;
// cout<<1<<endl;
break;
}
else if(r-l==1)
{
p=l;
q=r;
//cout<<2<<endl;
break;
}
else if(ar[mid]>n)
{
r=mid;
//cout<<3<<endl;
}
else if(ar[mid]<n)
{
l=mid;
// cout<<4<<endl;
}
}
//cout<<n<<" "<<ar[p]<<" "<<ar[q]<<endl;
//if(n==7)
//{
// cout<<1<<endl;
//}
if(n==1)
cout<<2<<endl;
else if(ar[p]==n)
cout<<1<<endl;
else
{
vector <ll>s;
ll a1=n-ar[p];
ll ans= floor(log(a1));
ll m=0;
while(ans<p)
{
if(n-(ar[p]+ar[ans])<0)
{
s.push_back(ar[p]+ar[ans]-n);
}
else
{
s.push_back(n-ar[p]-ar[ans]);
}
ans++;
}
s.push_back(ar[q]+1-n);
sort(s.begin(),s.end());
cout<<s[0]<<endl;
}
}
}
} |
62e24bae8c89e1d2391a1ac60c7fe8d606cccd5a | 9e21fff10f5b489b7ae03437023147c1f077c74c | /view/IView.h | 8d4da55061333a09bda2447e5f0a65ce0061e107 | [] | no_license | lxie27/Backgammon | 2c4affe7fb767d8ad363fdcca908393ec4939624 | e51d63a6a54a560ad0aaa242a9c272a74f33ae75 | refs/heads/master | 2020-08-01T19:04:52.981790 | 2019-09-26T12:48:10 | 2019-09-26T12:48:10 | 211,085,452 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 308 | h | IView.h | //
// Created by Rikki on 11/9/2017.
//
#ifndef BACKGAMMON_IVIEW_H
#define BACKGAMMON_IVIEW_H
/**
* Represents an interface for a View for a Backgammon game.
*/
class IView {
public:
// Outputs the m_view of the current Backgammon game.
virtual void refresh() =0;
};
#endif //BACKGAMMON_IVIEW_H
|
72a8f1cde9be2cabde3728fa13686d7c7c6fd476 | a2c5dcd0493fbfc69c8823597896195e53361071 | /classes/input/backends/pointerbackend.cpp | 20a37ed224e3f7dda69ecad12879a331992e4116 | [
"Artistic-1.0",
"Artistic-2.0"
] | permissive | enzo1982/smooth | 673fed6eb977ce6e10c9ea3ffe54126561bc041e | 3b8dd663dcd794b7eb6944a309d21b9bef114a58 | refs/heads/master | 2023-07-09T20:02:56.901359 | 2023-07-02T19:57:13 | 2023-07-02T20:03:31 | 100,875,066 | 26 | 13 | Artistic-2.0 | 2023-01-29T23:56:56 | 2017-08-20T16:44:58 | C | UTF-8 | C++ | false | false | 1,501 | cpp | pointerbackend.cpp | /* The smooth Class Library
* Copyright (C) 1998-2013 Robert Kausch <robert.kausch@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of "The Artistic License, Version 2.0".
*
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
#include <smooth/input/backends/pointerbackend.h>
#if defined __WIN32__ && defined SMOOTH_STATIC
#include <smooth/input/backends/win32/pointerwin32.h>
#endif
S::Input::PointerBackend *CreatePointerBackend()
{
return new S::Input::PointerBackend();
}
S::Input::PointerBackend *(*S::Input::PointerBackend::backend_creator)() = &CreatePointerBackend;
S::Int S::Input::PointerBackend::SetBackend(PointerBackend *(*backend)())
{
if (backend == NIL) return Error();
backend_creator = backend;
return Success();
}
S::Input::PointerBackend *S::Input::PointerBackend::CreateBackendInstance()
{
return backend_creator();
}
S::Input::PointerBackend::PointerBackend()
{
#if defined __WIN32__ && defined SMOOTH_STATIC
volatile Bool null = 0;
if (null) PointerWin32();
#endif
type = POINTER_NONE;
}
S::Input::PointerBackend::~PointerBackend()
{
}
S::Short S::Input::PointerBackend::GetPointerType() const
{
return type;
}
S::Bool S::Input::PointerBackend::SetCursor(const GUI::Window *window, Pointer::CursorType mouseCursor)
{
return False;
}
|
11f60d54fafe211e1813a3e2138fb90eb3a4c328 | c8a8dfd4d60448b18541b9610b2e5893fdfdba6d | /src/generate_dynamic_scene/obstacle.cpp | 60a4843513fa9853f854d4a2682175c31d2ac0b3 | [
"MIT"
] | permissive | test-bai-cpu/hdi_plan | f3b4e0fd781fea1462012620d04c2199dc9a485d | 89684bb73832d7e40f3c669f284ffddb56a1e299 | refs/heads/master | 2023-08-03T02:36:57.741358 | 2021-10-06T14:38:56 | 2021-10-06T14:38:56 | 336,105,157 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 307 | cpp | obstacle.cpp | #include "generate_dynamic_scene/obstacle.hpp"
namespace hdi_plan {
Obstacle::Obstacle(std::string name, Obstacle_type type, bool operation, double size, Eigen::Vector3d position)
: name_(name), type_(type), operation_(operation), size_(size), position_(position) {
}
Obstacle::~Obstacle() = default;
} |
0da7c4aa831366e107ba0c423c663f297731ff4e | e0f9fc2e2a8246ead3d4f418a0ebaa9b38c7aa21 | /GroupProject3/GroupProject3/main.cpp | 1ef8cf52aa46b083fddfc7cc3cd88f770d40e129 | [] | no_license | COSC1430/GroupAssignment-3 | 59a6987ced00df04fb8061f2f9f89f6b786676de | 54c4c6828e6b50fd606010b7a6e3956df64180f9 | refs/heads/master | 2021-07-10T06:54:02.009585 | 2017-10-10T13:48:36 | 2017-10-10T13:48:36 | 106,375,553 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 883 | cpp | main.cpp | #include <iostream>
#include "Plane.h"
using namespace std;
int main()
{
plane cosc1430;
cosc1430.display_seats();
while (true)
{
cout << "Pick one of these options" << endl;
cout << "1. Book a Seat," << endl;
cout << "2. Check a Seat" << endl;
cout << "3. Display all Seats" << endl;
cout << "4. Clear a Seat" << endl;
cout << "5. Empty all Seats" << endl;
cout << "6. Exit" << endl;
cout << "input : ";
int user_input;
cin >> user_input;
switch (user_input)
{
case 1: cosc1430.book_seat();
break;
case 2: cosc1430.check_seat();
break;
case 3: cosc1430.display_seats();
break;
case 4: cosc1430.clear_seat();
break;
case 5:cosc1430.clear_all_seats();
break;
case 6: cosc1430.~plane();
exit(0);
default:
cout << "Wrong Choice" << endl;
cout << endl;
}
}
}
|
b564f54299d37306dc6ab77b37d28cfaae6cd5c8 | 33392bbfbc4abd42b0c67843c7c6ba9e0692f845 | /codec/L2/demos/leptonEnc/host/xhpp/xhpp_taskkernel.hpp | b5c9908311665f59d4ca64810a59241e2c8ee59e | [
"Apache-2.0"
] | permissive | Xilinx/Vitis_Libraries | bad9474bf099ed288418430f695572418c87bc29 | 2e6c66f83ee6ad21a7c4f20d6456754c8e522995 | refs/heads/main | 2023-07-20T09:01:16.129113 | 2023-06-08T08:18:19 | 2023-06-08T08:18:19 | 210,433,135 | 785 | 371 | Apache-2.0 | 2023-07-06T21:35:46 | 2019-09-23T19:13:46 | C++ | UTF-8 | C++ | false | false | 11,558 | hpp | xhpp_taskkernel.hpp | /*
* Copyright 2021 Xilinx, Inc.
*
* 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.
*/
/**********
Copyright (c) 2018, Xilinx, Inc.
All rights reserved.
TODO
**********/
#ifndef _XHPP_KERNELTASK_
#define _XHPP_KERNELTASK_
#include <iostream>
#include <string>
#include <functional>
#include <memory>
#include <tuple>
#include "xhpp_taskbase.hpp"
#include "xhpp_context.hpp"
#include "xhpp_bufferdevice.hpp"
#include "xhpp_enums.hpp"
// #define _XHPP_DEBUG_
namespace xhpp {
namespace task {
//! kernel function class
class dev_func : public base {
private:
// cl_kernel mkernel;
std::vector<cl_kernel> mkernels;
//! param list
class dev_func_arglist {
public:
std::vector<size_t> argsize; // sizeof(arg)
std::vector<void*> argvalue;
std::vector<xhpp::buffer::base*> devbuffer;
std::vector<int> startendmark; // when the input arg is starting or ending device vbuffer, mark as 1
} arglist;
//! number of CUs
int _numcu = 0;
int numofcu() { return _numcu; }
//! kernel CU name
std::vector<std::string> _cuname;
std::vector<int> _cubank;
//! kernel params: number of device buffer type
int db_n = 0; // vadd: db_n = 3
bool _cuadded = false;
bool _paramset = false;
bool _bodyallocated = false;
bool _bodyshadowallocated = false;
unsigned int _shadowsize = 0;
//! update _shadowsize for kernel task
// for lienar mode, shadowsize=0,
// pipeline mode, shadowsize=1
int updateshadowsize(const Pattern pattern) {
if (pattern == pipeline) {
_shadowsize = 1;
}
return _shadowsize;
}
//! device buffer type arg index
int argidx_db = 0;
//! setup one kernel arg with dataype T, the params other than dbuf args.
template <typename T>
int set_single_arg(T& value) {
// push to arg list
arglist.argsize.push_back(sizeof(T));
arglist.startendmark.push_back(0);
for (int i = 0; i < _numcu * (_shadowsize + 1); i++) {
arglist.argvalue.push_back((void*)(&value));
}
};
//! setup one kernel arg with dataype cl_mem, the device buffer params
template <typename T>
int set_single_arg(xhpp::vbuffer::device<T>& value) {
// push to arg list
arglist.argsize.push_back(sizeof(cl_mem));
if (value._vbuffer_startorend == false) {
arglist.startendmark.push_back(0);
} else {
arglist.startendmark.push_back(1);
}
value.xmems.resize(_numcu * (_shadowsize + 1));
for (int i = 0; i < _numcu * (_shadowsize + 1); i++) {
arglist.argvalue.push_back((void*)(&(value.xmems[i])));
}
arglist.devbuffer.push_back(&value);
// bankinfo is added to the devicebuffer
for (int i = 0; i < _numcu; i++) {
value.bankinfo.push_back(_cubank[argidx_db + i * db_n]);
#ifdef _XHPP_DEBUG_
std::cout << "bank info is " << _cubank[argidx_db + i * db_n] << std::endl;
#endif
}
argidx_db++;
return 0;
};
//! setup the last kernel arg
template <typename T>
int setargs(T& arg1) {
set_single_arg(arg1);
return 0;
};
//! setup kernel args recursively
template <typename T, typename... U>
int setargs(T& arg1, U&... __args) {
set_single_arg(arg1);
setargs(__args...);
return 0;
};
//! allocate cl_kernel and set cl args
int allocatesetclarg(int ncu, int nsh) {
cl_int err;
int n = ncu * (_shadowsize + 1) + nsh;
std::cout << "n= " << n << std::endl;
// create
mkernels[n] = clCreateKernel(xctx->xprogram, _cuname[ncu].c_str(), &err);
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::allocatesetclarg(), clCreateKernel error.\n");
};
// set args
int argid = 0;
int nparam = arglist.argsize.size();
for (int s = 0; s < nparam; s++) {
size_t ss = (arglist.argsize)[s];
int nv = s * (_numcu * (_shadowsize + 1)) + n;
void* vv = (arglist.argvalue)[nv];
if ((arglist.startendmark)[s] == 0) {
int err = clSetKernelArg(mkernels[n], argid++, ss, vv);
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::allocatesetclarg(), clSetKernelArg error.\n");
};
} else {
std::cout << "not setting arg for " << s << std::endl;
argid++;
}
};
std::cout << "---------" << std::endl;
return 0;
};
public:
//! constructor
dev_func(xhpp::context* ctx) : base(ctx){};
//! deconstructor
~dev_func(){};
//! add CU
int addcu(std::string cuname, int param_num, int* bank) {
_numcu += 1;
_cuname.push_back(cuname);
db_n = param_num;
for (int i = 0; i < param_num; i++) {
_cubank.push_back(bank[i]);
}
_cuadded = true;
return 0;
};
//! set parameters
template <typename... _Args>
int setparam(_Args&... __args) {
updateshadowsize(xctx->pattern);
mkernels.resize(_numcu * (_shadowsize + 1));
std::cout << "_shadowsize = " << _shadowsize << std::endl;
int res = setargs(__args...); // set args
_paramset = true;
return res;
};
// //! setup the kernel
// template<typename... _Args>
// int setup(std::string krn_name, _Args & ... __args){
// krnname = krn_name;
// int res = setparam(__args...);
// return 0;
// };
//! setup kernel (body)
int setupbody() {
if (_bodyallocated == false) {
// buffer
for (int s = 0; s < arglist.devbuffer.size(); s++) {
(arglist.devbuffer)[s]->bodyallocate(_cubank[0]);
};
// kernel obj
allocatesetclarg(0, 0);
_bodyallocated = true;
};
return 0;
};
//! setup kernel (body and shadow)
int setupbodyshadow(unsigned int _nsize) {
if (_bodyshadowallocated == false) {
// buffer
for (int s = 0; s < arglist.devbuffer.size(); s++) {
if ((arglist.devbuffer)[s]->startingendingallocate() == false) {
(arglist.devbuffer)[s]->bodyshadowallocate(_nsize);
} else {
std::cout << "not allocate buffer for starting or ending vbuffer" << std::endl;
}
};
// kernel obj
// std::cout <<"_numcu and _shadowsize is " <<_numcu <<"," <<_shadowsize <<std::endl;
for (int i = 0; i < _numcu; i++) {
for (int j = 0; j < (_shadowsize + 1); j++) {
allocatesetclarg(i, j);
};
};
_bodyshadowallocated = true;
}
return 0;
};
//! update parameters, scalar
template <class T>
int updateparam(const int rcrun, const int nparam, T param) {
cl_int err = clSetKernelArg(mkernels[rcrun], nparam, sizeof(T), ¶m);
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::updateparam, clSetKernelArg error.\n");
};
}
//! update parameters, virtual device buffer
template <class T>
int updateparam(const int rcrun, const int nparam, xhpp::vbuffer::device<T>*& param) {
cl_int err = clSetKernelArg(mkernels[rcrun], nparam, sizeof(cl_mem), &(param.xmems[0]));
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::updateparam, clSetKernelArg error.\n");
};
};
//! update parameters, device buffer
template <class T>
int updateparam(const int rcrun, const int nparam, xhpp::buffer::device<T>*& param) {
cl_int err = clSetKernelArg(mkernels[rcrun], nparam, sizeof(cl_mem), &(param->xmems[0]));
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::updateparam, clSetKernelArg error.\n");
};
};
//! update parameters, virtual host buffer error out
template <class T>
int updateparam(const int rcrun, const int nparam, xhpp::vbuffer::host<T>*& param) {
throw xhpp::error("ERROR: xhpp::task::dev_func::updateparam, input should not be virtual host buffer.\n");
}
//! update parameters, host buffer error out
template <class T>
int updateparam(const int rcrun, const int nparam, xhpp::buffer::host<T>*& param) {
throw xhpp::error("ERROR: xhpp::task::dev_func::updateparam, input should not be host buffer.\n");
}
//! submit a kernel task
int submit(
xhpp::event* waitevt, xhpp::event* outevt, const int rcin = 0, const int rcout = 0, const int rcrun = 0) {
size_t globalsize[] = {1, 1, 1};
size_t localsize[] = {1, 1, 1};
cl_int err;
std::cout << "before kernel" << std::endl;
err = clEnqueueNDRangeKernel(xctx->xqueue, mkernels[rcrun], 1, NULL, globalsize, localsize, waitevt->size(),
waitevt->data(), outevt->data());
std::cout << "kernel end" << std::endl;
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::submit(), kernel launch error.\n");
};
return 0;
};
//! blocking run
int run(const int rcin = 0, const int rcout = 0, const int rcrun = 0) {
size_t globalsize[] = {1, 1, 1};
size_t localsize[] = {1, 1, 1};
cl_int err;
err = clEnqueueNDRangeKernel(xctx->xqueue, mkernels[rcrun], 1, NULL, globalsize, localsize, 0, NULL, NULL);
if (err != CL_SUCCESS) {
throw xhpp::error("ERROR: xhpp::task::dev_func::run(), kernel launch error.\n");
};
xctx->wait();
return 0;
};
//! release task
int release() {
_numcu = 0;
_cuname.resize(0);
_cuadded = false;
_paramset = false;
if (_bodyshadowallocated == true) {
for (int s = 0; s < arglist.devbuffer.size(); s++) { // buffer
(arglist.devbuffer)[s]->bodyshadowrelease();
};
if (_bodyallocated = true) {
clReleaseKernel(mkernels[0]);
_bodyallocated = false;
}
for (int i = 1; i < _numcu * (_shadowsize + 1); i++) {
clReleaseKernel(mkernels[i]);
};
_bodyshadowallocated = false;
_bodyallocated = false;
} else if (_bodyallocated = true) {
clReleaseKernel(mkernels[0]);
for (int s = 0; s < arglist.devbuffer.size(); s++) { // buffer
(arglist.devbuffer)[s]->bodyrelease();
};
_bodyallocated = false;
}
return 0;
};
};
}; // end of namespace task
}; // end of namespace xhpp
#endif
|
fcf461b1c33b99084d2c047617f2884bae00ac13 | 43dca2ec34f85fd0d4d4f4d72e6cb037847ad748 | /Day1_HW_TestUtility/TestUtility.cpp | 7cb4c0d4a9d326d7f0ab9bdf41de6223bed6585e | [] | no_license | hatelove/2016TrendMicro_TDD | 5e723e9d5cfacd56c7c8af47c24c815815793366 | a0ab23e36172751ad43b5dfbdd06b1a085e34d05 | refs/heads/master | 2020-12-25T23:09:34.087519 | 2016-01-04T14:25:48 | 2016-01-04T14:25:48 | 49,010,313 | 0 | 0 | null | 2016-01-04T16:54:39 | 2016-01-04T16:54:38 | null | UTF-8 | C++ | false | false | 222 | cpp | TestUtility.cpp | #include "stdafx.h"
#include "TestUtility.h"
void TestUtility::ReloadTable()
{
m_Table = "{1,1,11,21}{2,2,12,22}{3,3,13,23}{4,4,14,24}{5,5,15,25}{6,6,16,26}{7,7,17,27}{8,8,18,28}{9,9,19,29}{10,10,20,30}{11,11,21,31}";
}
|
c684d56bd8a2a2e972d7a2438b983a1a75fa5ee4 | 1b303513563763dbf6c10e77c96b7448372c2b8e | /GRK15/lightprogram.cpp | fdab0f772afd587ebdf177a70cc95718a9cb2aa1 | [] | no_license | 15465/GRK2020 | 2d70ccb84f9f60bf3d02ce86bb068aeddec09b14 | 4d285f35a0a6ed839cac4d189a4d54ac3f2049cd | refs/heads/master | 2022-12-15T14:23:24.324784 | 2020-09-18T16:56:21 | 2020-09-18T16:56:21 | 296,676,680 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,392 | cpp | lightprogram.cpp | #include "lightprogram.h"
#include <GL/glew.h>
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
void LightProgram::Initialize(const char *vertex_shader_file, const char *fragment_shader_file){
TextureCameraProgram::Initialize(vertex_shader_file, fragment_shader_file);
normal_matrix_location_ = GetUniformLocationOrDie("normal_matrix");
material_locations_.emission = GetUniformLocationOrDie("material.emission");
material_locations_.ambient = GetUniformLocationOrDie("material.ambient");
material_locations_.diffuse = GetUniformLocationOrDie("material.diffuse");
material_locations_.specular = GetUniformLocationOrDie("material.specular");
material_locations_.shininess = GetUniformLocationOrDie("material.shininess");
// glUseProgram(0); //(moved to Window::InitPrograms())
}
void LightProgram::SetMaterial(const Material & material) const{
glUniform4fv(material_locations_.ambient, 1, material.ambient);
glUniform4fv(material_locations_.emission, 1, material.emission);
glUniform4fv(material_locations_.diffuse, 1, material.diffuse);
glUniform4fv(material_locations_.specular, 1, material.specular);
glUniform1f(material_locations_.shininess, material.shininess);
}
void LightProgram::SetNormalMatrix(const Mat3 & matrix) const{
glUniformMatrix3fv(normal_matrix_location_, 1, GL_TRUE, matrix);
}
|
1469ad2589060aff5399df974e75c87482c4d090 | 353488d469f762074c71d41c8e015c433949d4ed | /main.cpp | 1453674e54c239351975713808de7660db8bdbd4 | [] | no_license | fedelebron/bit-packing-matrix | 3ba07f19f5a0d9c01f7f279cd5ccff736874a82f | f650500927c097370380b5fb07b8757ad64a9f8a | refs/heads/master | 2021-01-01T06:17:07.115205 | 2012-10-18T14:21:41 | 2012-10-18T14:21:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,078 | cpp | main.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include "erdos_renyi.hpp"
#include "square_bool_matrix.h"
using namespace std;
int main(int argc, char** argv) {
int n;
if(argc >= 2) n = atoi(argv[1]);
if(argc < 2 || n <= 0 || n & 0x1F) {
cerr << "Usage: " << argv[0] << " n" << endl;
cerr << "n must be a positive multiple of 32." << endl;
return -1;
}
SquareBoolMatrix m = erdos_renyi<SquareBoolMatrix>(n, 0.5);
#ifdef ECHO
cout << "Matrix:" << endl;
cout << "-----------------------------" << endl << endl;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
cout << m.get(i, j) << " ";
}
cout << endl;
}
#endif
vector<vector<int>> normal(n, vector<int>(n, 0));
for(int i = 0; i < n; ++i)
for(int j = 0; j < n; ++j)
normal[i][j] = int(m.get(i, j));
auto t1 = chrono::high_resolution_clock::now();
vector<vector<int>> squared_normal(n, vector<int>(n, 0));
# pragma omp parallel for
for(int i = 0; i < n; ++i) {
for(int j = 0; j <= i; ++j) {
int sum = 0;
for(int k = 0; k < n; ++k)
sum += normal[i][k] * normal[j][k];
squared_normal[i][j] = squared_normal[j][i] = sum;
}
}
auto t2 = chrono::high_resolution_clock::now();
#ifdef ECHO
cout << endl << "Normal:" << endl;
cout << "-----------------------------" << endl << endl;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
cout << squared_normal[i][j] << " ";
}
cout << endl;
}
cout << endl << "Compact:" << endl;
cout << "-----------------------------" << endl << endl;
#endif
auto t3 = chrono::high_resolution_clock::now();
auto square = m.square();
auto t4 = chrono::high_resolution_clock::now();
#ifdef ECHO
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
cout << square[i][j] << " ";
}
cout << endl;
}
#endif
cout << "Normal:\t\t" << duration_cast<duration<double>>(t2 - t1).count() << " seconds." << endl;
cout << "Compact:\t" << duration_cast<duration<double>>(t4 - t3).count() << " seconds. " << endl;
}
|
36ba2b59d1e2e35058e673cc1d798adaed05c7e7 | 021e47d8683036da87a06717e22640921f706b47 | /sketches/WebScalesHX711_new.ino | 71f550bd56d05a3856d91b51da9acdea9a1a2217 | [] | no_license | WeightScale/WebScalesHX711_new | f769a5af47fe66b01895ade333fe1bc270aacfe0 | 41b43ec7b3e6f165c1e369b730f30fcf04e1f8cf | refs/heads/master | 2022-01-17T08:06:51.513866 | 2019-06-21T05:19:06 | 2019-06-21T05:19:06 | 189,754,630 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 706 | ino | WebScalesHX711_new.ino | //Comment out the definition below if you don't want to use the ESP8266 gdb stub.
//#define ESP8266_USE_GDB_STUB
#ifdef ESP8266_USE_GDB_STUB
#include <GDBStub.h>
extern "C" int gdbstub_init();
extern "C" int gdbstub_do_break();
#endif
#include "Board.h"
//using namespace std;
//using namespace std::placeholders;
void shutDown();
void setup() {
#ifdef ESP8266_USE_GDB_STUB
Serial.begin(921600);
gdbstub_init();
gdbstub_do_break();
#endif
Board = new BoardClass();
Board->init();
server.begin();
}
void loop() {
Board->handle();
#ifdef MULTI_POINTS_CONNECT
Board->wifi()->connect();
delay(1);
#endif // MULTI_POINTS_CONNECT
}
void shutDown() {
ESP.deepSleep(0, WAKE_RF_DISABLED);
}
|
417dbabd089c9268da2ded659328befb92e353e9 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/squid/new_hunk_6763.cpp | d3c1b78e8181eeabbe4c8ca14aab17dfdbcf6150 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 218 | cpp | new_hunk_6763.cpp | /*
* $Id: MemBuf.cc,v 1.3 1998/02/21 18:46:34 rousskov Exp $
*
* DEBUG: section 59 auto-growing Memory Buffer with printf
* AUTHOR: Alex Rousskov
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
|
4b22ab976eb433961bc36ad11a144acdae3133d5 | 955129b4b7bcb4264be57cedc0c8898aeccae1ca | /python/mof/cpp/req_pet_study_skill.h | 80bcf1893ba6cf073b5a07b31dbd14661829dc56 | [] | no_license | PenpenLi/Demos | cf270b92c7cbd1e5db204f5915a4365a08d65c44 | ec90ebea62861850c087f32944786657bd4bf3c2 | refs/heads/master | 2022-03-27T07:33:10.945741 | 2019-12-12T08:19:15 | 2019-12-12T08:19:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 279 | h | req_pet_study_skill.h | #ifndef MOF_REQ_PET_STUDY_SKILL_H
#define MOF_REQ_PET_STUDY_SKILL_H
class req_pet_study_skill{
public:
void req_pet_study_skill(void);
void PacketName(void);
void ~req_pet_study_skill();
void encode(ByteArray &);
void decode(ByteArray &);
void build(ByteArray &);
}
#endif |
40413ee56f60306e82c616bdc6f57521edb8ef27 | ae6dbcfd6a333bf598b871e15a7741fef81f964f | /Projects/Fcs/src/Workshare.FCS.Lite.BinaryReader/CleanException.cpp | 53339bbae82125ffc0f5bc3f45d40b9f82ef0d7d | [] | no_license | xeon2007/WSProf | 7d431ec6a23071dde25226437583141f68ff6f85 | d02c386118bbd45237f6defa14106be8fd989cd0 | refs/heads/master | 2016-11-03T17:25:02.997045 | 2015-12-08T22:04:14 | 2015-12-08T22:04:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,076 | cpp | CleanException.cpp | #include "stdafx.h"
#include "CleanException.h"
#include "ReaderHelpers.h"
namespace Workshare
{
namespace FCS
{
namespace Lite
{
namespace BinaryReader
{
CleanException::CleanException(std::string message, Workshare::FCS::Lite::BinaryReader::AbstractTextType::ContentType enumContentTypeError) : m_sErrorDescription(message), m_enumContentTypeError(enumContentTypeError)
{
SetContentTypeName(enumContentTypeError);
}
CleanException::CleanException(std::string message, Workshare::FCS::Lite::BinaryReader::AbstractTextType::ContentType enumContentTypeError, const CsException& ex) : m_sErrorDescription(message), m_enumContentTypeError(enumContentTypeError)
{
m_sErrorDescription += "(" + ReaderHelpers::ConstructErrorText(ex) + ")";
SetContentTypeName(enumContentTypeError);
}
void CleanException::SetContentTypeName(AbstractTextType::ContentType enumContentType)
{
//Not all AbstractTextType::ContentType are used here only those for which cleaning is implemented
switch (enumContentType)
{
case AbstractTextType::HiddenText:
m_sContentTypeName = "HiddenText";
break;
case AbstractTextType::Macro:
m_sContentTypeName = "Macro";
break;
case AbstractTextType::TrackChange:
m_sContentTypeName = "TrackChange";
break;
case AbstractTextType::Version:
m_sContentTypeName = "Version";
break;
case AbstractTextType::Reviewer:
m_sContentTypeName = "Reviewer";
break;
case AbstractTextType::AutoVersion:
m_sContentTypeName = "AutoVersion";
break;
case AbstractTextType::TextBox:
m_sContentTypeName = "TextBox";
break;
case AbstractTextType::WhiteText:
m_sContentTypeName = "WhiteText";
break;
case AbstractTextType::RoutingSlip:
m_sContentTypeName = "RoutingSlip";
break;
case AbstractTextType::SmallText:
m_sContentTypeName = "SmallText";
break;
case AbstractTextType::Field:
m_sContentTypeName = "Field";
break;
case AbstractTextType::Variable:
m_sContentTypeName = "Variable";
break;
case AbstractTextType::SmartTag:
m_sContentTypeName = "SmartTag";
break;
case AbstractTextType::Links:
m_sContentTypeName = "Links";
break;
case AbstractTextType::Hyperlink:
m_sContentTypeName = "Hyperlink";
break;
case AbstractTextType::Comment:
m_sContentTypeName = "Comment";
break;
case AbstractTextType::SpeakerNote:
m_sContentTypeName = "SpeakerNote";
break;
case AbstractTextType::HiddenSlide:
m_sContentTypeName = "HiddenSlide";
break;
default:
m_sContentTypeName = "Unknown Content Type in CleanException.cpp";
}
}
}//end of namespace BinaryReader
}//end of namespace Lite
}//end of namespace FCS
}//end of namespace Workshare
|
019991fb7aa61632048f76ddc065f7eadd038d3b | a6474f899a86898916c4110348247ef218faaf36 | /course6/toyapp-adam/displaylib/camera.cc | 7b06235db6cbeb09dc98475027008f273a9ae7d0 | [] | no_license | david-grs/c-excercises | 420eaf3e5165afdc953bc083c68dfdb75a7deb16 | 2aa9209cc5148d4276d8593fd1656d1b6a376740 | refs/heads/master | 2021-08-08T05:28:40.504646 | 2017-11-09T17:10:01 | 2017-11-09T17:10:01 | 110,030,206 | 1 | 0 | null | 2017-11-08T21:03:09 | 2017-11-08T21:03:09 | null | UTF-8 | C++ | false | false | 340 | cc | camera.cc | #include "camera.h"
namespace Display {
namespace {
const auto DEFAULT_FOV_DEGREES = 60.0f;
}
Camera::Camera()
: mProjection(CreateProjectionMatrix()),
mFieldOfView(DEFAULT_FOV_DEGREES),
mAspectRatio(1.0f)
{}
void Camera::SetAspectRatio(float aspectRatio)
{
mAspectRatio = aspectRatio;
mProjection = CreateProjectionMatrix();
}
}
|
ed4030632cda93dc7809ebac68f547a08ffc7b0b | 65c27ff4e318855653e7684372da125107ecb37c | /src/client/DAO_ResourceManager.cpp | 25da18e4d79510cb036ea400b0a64e9b13f6f715 | [] | no_license | lobermann/PDAO | de72b5bbbf067409420976a6306aa5ba41dee38e | f69a379f7f66b73ea8efe0730d353c09c544ee40 | refs/heads/master | 2021-01-17T17:07:38.427434 | 2015-01-13T23:13:19 | 2015-01-13T23:13:19 | 14,275,677 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,279 | cpp | DAO_ResourceManager.cpp | #include "DAO_ResourceManager.h"
template<> DAO_ResourceManager* Ogre::Singleton<DAO_ResourceManager>::msSingleton = 0;
//#if defined(OD_DEBUG) && OGRE_PLATFORM == OGRE_PLATFORM_WIN32
//On windows, if the application is compiled in debug mode, use the plugins with debug prefix.
const std::string DAO_ResourceManager::PLUGINSCFG = "plugins_d.cfg";
const std::string DAO_ResourceManager::RESOURCECFG = "resources_d.cfg";
//#else
//const std::string DAO_ResourceManager::PLUGINSCFG = "plugins.cfg";
//const std::string DAO_ResourceManager::RESOURCECFG = "resources.cfg";
//#endif
const std::string DAO_ResourceManager::CONFIGFILENAME = "ogre.cfg";
const std::string DAO_ResourceManager::LOGFILENAME = "darkages.log";
DAO_ResourceManager::DAO_ResourceManager(void) :
screenshotCounter_(0),
resourcePath_("config/"),
homePath_("config/"),
pluginsPath_(""),
ogreCfgFile_(""),
ogreLogFile_("")
{
#ifndef OGRE_STATIC_LIB
pluginsPath_ = resourcePath_ + PLUGINSCFG;
#endif
ogreCfgFile_ = homePath_ + CONFIGFILENAME;
ogreLogFile_ = homePath_ + LOGFILENAME;
initResources();
}
void DAO_ResourceManager::initResources()
{
ResourceGroup groupBase("Base");
groupBase.addResource("FileSystem","../media/nvidia");
groupBase.addResource("FileSystem","../media/heightmaps");
groupBase.addResource("FileSystem","../media/materials/scripts");
groupBase.addResource("FileSystem","../media/materials/textures");
//groupBase.addResource("FileSystem","../media/MyGUI_Media");
resources_[groupBase.getName()] = groupBase;
ResourceGroup groupMyGUI("MyGUI");
groupMyGUI.addResource("FileSystem","../media/MyGUI_Media");
resources_[groupMyGUI.getName()] = groupMyGUI;
//Meshs
ResourceGroup groupMesh("Mesh");
groupMesh.addResource("FileSystem","../media/meshs");
resources_[groupMesh.getName()] = groupMesh;
ResourceGroup groupSinbad("Sinbad");
groupSinbad.addResource("Zip","../media/packs/Sinbad.zip");
resources_[groupSinbad.getName()] = groupSinbad;
}
DAO_ResourceManager::~DAO_ResourceManager(void)
{
unloadAllResourceGroups();
}
void DAO_ResourceManager::loadResourceGroup(Ogre::String group)
{
for(std::list<Resource>::iterator iter = resources_[group].getListBegin(); iter != resources_[group].getListEnd(); iter++)
{
if(!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(iter->getPath(),group))
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(iter->getPath(), iter->getType(), group);
}
if(Ogre::ResourceGroupManager::getSingleton().resourceGroupExists(group) && !Ogre::ResourceGroupManager::getSingleton().isResourceGroupInitialised(group))
{
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(group);
}
}
void DAO_ResourceManager::unloadResourceGroup(Ogre::String group)
{
if(Ogre::ResourceGroupManager::getSingleton().resourceGroupExists(group) && Ogre::ResourceGroupManager::getSingleton().isResourceGroupInitialised(group))
{
Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(group);
}
}
void DAO_ResourceManager::unloadAllResourceGroups()
{
for(std::map<std::string, ResourceGroup>::iterator iter = resources_.begin(); iter != resources_.end(); iter++)
{
unloadResourceGroup(iter->first);
}
}
void DAO_ResourceManager::setupResources()
{
Ogre::ConfigFile cf;
cf.load(resourcePath_ + RESOURCECFG);
Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator();
Ogre::String sectionName, typeName, dataname;
while (sectionIter.hasMoreElements())
{
sectionName = sectionIter.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap *settings = sectionIter.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
dataname = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(dataname, typeName, sectionName);
}
}
}
void DAO_ResourceManager::takeScreenshot()
{
//FIXME: the counter is reset after each start, this overwrites existing pictures
std::ostringstream ss;
ss << "DAOscreenshot_" << ++screenshotCounter_ << ".png";
std::cout << getHomePath() << ss.str() << std::endl;
DAO_Application::getSingleton().getWindow()->writeContentsToFile(getHomePath() + ss.str());
} |
8b2c32f74fee5cf256e076d9106f3fbd354f35ae | ee4f338aebedc47b06bd08fd35eada5aa81c7a91 | /SDK/BZ_Character_AnimBP_classes.hpp | 344971ac89cdfcb4314c8977d363b6dd4931e517 | [] | no_license | Hengle/BlazingSails_SDK | 5cf1ff31e0ac314aa841d7b55d0409e3e659e488 | 8a70c90a01d65c6cbd25f3dfdd1a8262714d3a60 | refs/heads/master | 2023-03-17T11:11:09.896530 | 2020-01-28T19:46:17 | 2020-01-28T19:46:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43,473 | hpp | BZ_Character_AnimBP_classes.hpp | #pragma once
// BlazingSails (Dumped by Hinnie) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// AnimBlueprintGeneratedClass Character_AnimBP.Character_AnimBP_C
// 0xB367 (0xB6C7 - 0x0360)
class UCharacter_AnimBP_C : public UAnimInstance
{
public:
struct FPointerToUberGraphFrame UberGraphFrame; // 0x0360(0x0008) (ZeroConstructor, Transient, DuplicateTransient)
struct FAnimNode_Root AnimGraphNode_Root_D9E9A0804062B964B460FCAE828CDEE7; // 0x0368(0x0040)
struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_AD9D9D8A43C5795C46159D8CBC255D96;// 0x03A8(0x0048)
struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_F22DBF8948C812E52BC2E7B9AA7E7459;// 0x03F0(0x0048)
struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_9D0E611F4A746845ECA8C59556C9AEAE;// 0x0438(0x0048)
struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_84547E3A49887BF52570869F0B54719C;// 0x0480(0x0048)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_F16A02124984E51E6CE225ACCD2EF3C4;// 0x04C8(0x00A0)
struct FAnimNode_StateResult AnimGraphNode_StateResult_CE19922E499E74FD1F3A619207ACA131;// 0x0568(0x0040)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_37AEFA9F4D200D9B3704C4B58BC320BA;// 0x05A8(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_01DCAD6C43E9B89D3BEAA49667C19409;// 0x0648(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_FABC2D2F4B1510CEA2261881AAE6C133;// 0x06E8(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_9911A32941DE25BED350A48541D46C69;// 0x0788(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_33F0845C4B3074E15258EDB28710DD8C;// 0x0828(0x00A0)
struct FAnimNode_BlendListByEnum AnimGraphNode_BlendListByEnum_A68CC0984EACBACDA8FB0295A18F5377;// 0x08C8(0x00E0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_F78F9BBA471591BB91C146B95961D039;// 0x09A8(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_035EDAAB4213C04F04F6A08539147B88;// 0x0A78(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_7584A01641CA713E328209A814F74131;// 0x0B18(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_7D5BDD8A400E9D1CDDCE79A4082399AB;// 0x0BB8(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_62E5AC634D7202EB4B4183A15E873001;// 0x0C88(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_0E2734044A0C8C002EBD8DBC57604A29;// 0x0D28(0x00D8)
struct FAnimNode_SequenceEvaluator AnimGraphNode_SequenceEvaluator_E50E6B65476FA671E2EA58AAD047233B;// 0x0E00(0x0070)
struct FAnimNode_StateResult AnimGraphNode_StateResult_EFDE99294D57F64FEEA8E894CCE4F85D;// 0x0E70(0x0040)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_CBE2FBDA4EDF2B5CE9C3D2ADBEB4D495;// 0x0EB0(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_87ADA5ED409E7EA0690C75BAC289527E;// 0x0F80(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_927E20B84362447CEA4E68A2C8584219;// 0x1020(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_A463CC3740FE6CF3AE501BB4F0BEEC6C;// 0x10F0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_4D4691ED4C21C93F6F1318851D7C326A;// 0x1190(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_D202D551412A97668988A6931C817A92;// 0x1260(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_17E96990446D3048B42DA8B8DC073001;// 0x1300(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_693749F14B323482B3FEBA8BEBFFC51E;// 0x13D0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_B6BB48CA4028B59562031E954DA20F3B;// 0x1470(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_D23FEFED4337B2227271EEA76FEE7BD7;// 0x1540(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_3B96F5CC4BF24DF37B29B294631FF87F;// 0x15E0(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_60094DC046752D4C79C650B475F54245;// 0x16B0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_1DE9B5B74DD76430C07700A069F43C1D;// 0x1750(0x00D0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_922B771847535DE15A29C097169586A2;// 0x1820(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_2F1908CF4444A60CE1E48883A0C3BC14;// 0x18F0(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_A88A00204375A18BF1B612A02D86FAE8;// 0x1990(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_E603D123466348438CE14F9B9210B772;// 0x1A30(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_E472686443EA8A45C5ACBAACC405E2BD;// 0x1B00(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_D790F19D4AF3B5FAD32549B1BF7EA23A;// 0x1BA0(0x00D0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_26DF7FEE4265B80FC274FEAF74D07CCD;// 0x1C70(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_C7745A1548C4DF545C8A87A24FB1BE25;// 0x1D98(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_7D011B8A4482C8BC491D0D85DEFCB302;// 0x1E38(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_EBE886CC40E0B610918DCC8BE3A195ED;// 0x1ED8(0x00A0)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_C8E0AABF492AD26947431CAD9E9B91BF;// 0x1F78(0x0138)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_E20AE2B34463209026A0449C512E112E;// 0x20B0(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_4655183648DBB0725D4DF49EB38DF125;// 0x21D8(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_6DF6F12D4CBDDC046CB13DA3257797D3;// 0x22B0(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_7DA646FD4E9957F8A0178D9074E74EFD;// 0x23D8(0x00D0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_D04A9E22484CAFC197131E9072736B35;// 0x24A8(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_0044D2804478C41F80367182FBA57ADE;// 0x2580(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_95B8CE414B48ED0CAC795D833D95602E;// 0x25C0(0x0040)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_B062461B4C51399A6DE1AEA4480BF5FD;// 0x2600(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_67BD6BC14271502B6D723DBB14AE3F97;// 0x26A0(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_9C0129AD47E99FFD7D62A5AA83D0187F;// 0x27C8(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_F167270C4C04195BB2A6A8B8564292C7;// 0x2868(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_24AACAD94566ADADE7DB618C659A9D13;// 0x2908(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_4429DA1F469C74A590CCC0971C522CCE;// 0x2A30(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_F38BF7184BA0810AB16D3E851CADA6DF;// 0x2B58(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_B94143EF4C4BCB7A26C97D80E41DEBE3;// 0x2BF8(0x00D0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_5807D35E4035F58C44DC6690587FBE05;// 0x2CC8(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_545E364B4182FE044343249DCD0F97DB;// 0x2DF0(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_996302AC44A526DF8EE5B3A2C4779496;// 0x2EC8(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_6643F1DE4B702A6E8675E5862F2C16BF;// 0x2FF0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_D35B966440F2386317331BA2624F654C;// 0x3090(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_B13E8E2B4792337601BA82824BA3F2E9;// 0x3160(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_7B5DF17641CE5A18551C46B52758E25E;// 0x3200(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_2F28329A464885A104EF3A81420EE246;// 0x32D0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_A1902AD54F85BE9AF13AD6BADA5B3693;// 0x3370(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_8D78E2F8484FB0F76B05B4B0CDFF1A8B;// 0x3440(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_CB468B64436484A9440C0EBEC151D71E;// 0x34E0(0x00D0)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_E7E2461E4434CEC30D3694B619D2EC0F;// 0x35B0(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_DABAA2504809372CFA5DCBB9C6A987CA;// 0x36E8(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_00A70DC44891CD65EB98E38855E49577;// 0x3820(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_CD58802645651724C3F3C7AB1749FC01;// 0x3958(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_3FAC085E462C40EC7A9614A196D83FCE;// 0x3A90(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_D80CF66C492232827FA3DF8E993CF087;// 0x3BC8(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_82244DAD410142996B02518D1AD027AD;// 0x3D00(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_3CC7302C4CD11F478F42ADA475EEE495;// 0x3E38(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_2AE72E714B80D6A01F820B9A12EF525C;// 0x3F70(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_3C4DAB7B4E9738CD52FF3A963FA5D900;// 0x40A8(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_C535ACE049571A14329C45906E37DE97;// 0x41E0(0x0138)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_AAD2140E45EF56E95EED878ACA50A6EE;// 0x4318(0x0128)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_39A8AAF2487EB01D495EA6A4B8138E2D;// 0x4440(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_B9E9B29944B54B39FAA423BC15004769;// 0x4480(0x0040)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_9BAE5E8A424CF7F664AA3793EBCF885F;// 0x44C0(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_A5446A5E4F4E4F9075D2DFA708908E40;// 0x4598(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_32910DEA4868FF462AB38FAF61D9DC55;// 0x46C0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_3D1BD5D04B40B429D99A19B3C9F16CC8;// 0x4760(0x00D0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_A3D2CBAE4446EA39202B9D83E5BDE1B1;// 0x4830(0x00D0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_7484ECED45BE98E6DCD92EACDBC54A7E;// 0x4900(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_71873944487D9648CFC00F993F1A16B3;// 0x49D8(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_D2E82E79422CA97CE71639AC74FB0A78;// 0x4B00(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_A6D756E84352E62D3F1AEC8949DDA0B8;// 0x4BA0(0x00D0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_2883489E4DF9A3039E308CB011BCF567;// 0x4C70(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_6B9ACA7C4FE102980B92618BD29C3024;// 0x4D98(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_09BA845846B08DC3BE9E64B5461BAE55;// 0x4E70(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_1CA56F27473C6E93B30DDC840CD8FF81;// 0x4F10(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_01B9572C4A0D352936C3E79AC6F2F6D1;// 0x5038(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_10DF9CCB4F334DE00046428229692A0D;// 0x5108(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_4B0072C54418CB70FAD206A780401DE0;// 0x51A8(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_BAAA198D4EAB0D6E432B3C80243CC5A5;// 0x5280(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_7B10A1494632ADDFEE6FED9E8A54BD1E;// 0x52C0(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_AF67F32546A931246075D1B75D2839A3;// 0x5300(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_C47405B043FC985633B0BAA2301F0CC9;// 0x5428(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_F14F4F534B27D0B39502E8B3DFEF434A;// 0x5500(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_A31308EB42F5C775990ACEA97FE541E0;// 0x5628(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_305A43E24257A5321182EF948325AE3E;// 0x56C8(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_D83D944B4FA6C741FDD2919393869023;// 0x5798(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_32EDB65048D4B15847AAC095AC3B4F95;// 0x5838(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_78C86B534DE88D76B91F5F9142498FB1;// 0x5910(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_912056CA4C778C78F472F49E9FB66276;// 0x5950(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_2F774D71423F4AB63827D2A24D329749;// 0x5990(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_A28DC2BC4DBAD5C6B1DCE49FF356D7DA;// 0x5AB8(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_925F5B6446F5E315ADB1F29DD4807830;// 0x5BE0(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_F9CFCFD348DF0DBAC818B5B22B2A8B16;// 0x5D08(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_9A3722EF47AAD39665DCC892050CFD16;// 0x5DE0(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_74F9C2F24AFFEC939E1CF8B516B9A81E;// 0x5E80(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_FF739A384EC27746CEAD988046AC96F0;// 0x5FA8(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_DE0F65A34738CE0BAD696C939089EFB8;// 0x6078(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_FC5B042C45AF86D6C6E5738E31A823FE;// 0x6118(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_4478FA6C45909E46E067F7B5D39B97F8;// 0x61F0(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_D9703BDE4607C244B1E97DA6CF67376B;// 0x6230(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_EC103A634655199DCBD7F4B62BAFE72E;// 0x6270(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_697D099C4ED9C63A6F2D2EB9BB4369F1;// 0x6398(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_4BE4A8AA4E0E864C6A6F64926088D7B4;// 0x6470(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_273020F8410E589A614635B088443313;// 0x6510(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_4CAD156843F1D9D3B1BA1A8204FC568F;// 0x6638(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_C70574484C0FAA617AE114BD6BC95F6E;// 0x6708(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_50DB5B81405F71FDC955D8B841FED152;// 0x67A8(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_F9A4C838451ADB9E1FA0E7B8A15C0CC6;// 0x6880(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_AB34AD5249B538B1607C25A5AE23D63B;// 0x68C0(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_F67ABBF146CB83E2D031D39BA63E87AB;// 0x6900(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_A1721B0C4BC700F0F8B0EF8F05E09FCE;// 0x6A28(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_AB0A98EF48D8B124B6E1BD9DC5E40FCB;// 0x6B00(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_E08C78A34FB61C27439CD8A038C11D8F;// 0x6C28(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_78ED46FD4FC6AFE1DE65C5A5352F00CB;// 0x6CF8(0x00A0)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_007869A24578171574C2C9BB0D7E8C02;// 0x6D98(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_70297C674E83957DEACBB88110D779DC;// 0x6DD8(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_DED7FC204E73A7FB8742F2A590A34675;// 0x6E18(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_C24135674643AD40D68326BBF3A170D8;// 0x6F40(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_15B41B1D4AD409D2CFF04F89F61B5544;// 0x7018(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_7EE47BEE46E05BBB1D7F8197069DF3FB;// 0x70B8(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_098C305E4064322AFECA9690FA3DFFBD;// 0x71E0(0x00D0)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_2B9C633745990BB89E4E35AAFB2B7CCA;// 0x72B0(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_70821F0C4941AF92387842BD559FA89E;// 0x72F0(0x0040)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_ACF6304B4D804BB146996DB7242F9227;// 0x7330(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_A69EDA514677C62C7EAC84ADF506B114;// 0x7408(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_C9CA7AF64AE7C16AA033CCA2D4AEBF18;// 0x7530(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_96B3768A4FB858262639388AFB7506A1;// 0x7658(0x00D8)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_F0F23683460EE8016A8DCE90EC579A58;// 0x7730(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_F689F2EB4A7A64848FCB56A74AA826F3;// 0x7858(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_1382E5EF415D6DCFDFA78E8875ED15AD;// 0x7930(0x00A0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_BCA2E5334CA5D0283C470CAEBF69B864;// 0x79D0(0x0128)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_42B274DC4D9E15FC6DAF4A9855602F2C;// 0x7AF8(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_38CED14E4298A5AE5A7EC0A8349C7F4B;// 0x7BD0(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_97E082B349207CA056B020A897CB7A12;// 0x7C70(0x00D0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_A0B7CCEC4255EE7CFDCE6AA59142D85D;// 0x7D40(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_E2761B0E444C6C756073458286DD3C04;// 0x7E68(0x00D0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_6A0F404E41D7A099568914A5756847AD;// 0x7F38(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_8016E5244FAA8B281CE70398F31008F9;// 0x8010(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_1D5C95304D249CC2CB85A880C7D23984;// 0x8050(0x0040)
struct FAnimNode_BlendListByEnum AnimGraphNode_BlendListByEnum_B61A84404D83786ECCBCA0B1A20A1F6B;// 0x8090(0x00E0)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_B84A40F147352EB2159B1C9945CA9A7D;// 0x8170(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_F8C4014E4C4751825449F8AE76AC5B22;// 0x8298(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_A7A10CF44F9B4306B41AC1893BC79AAA;// 0x83C0(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_A1034E8646514CE4245DC6A8BC11BF03;// 0x8490(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_8825CACF42C2FF3670A78DA0BA03040B;// 0x8530(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_7C5B54C449E55478D8F9A8966D84D7DF;// 0x8608(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_CB328F32485F79EA60547F82FD757070;// 0x8648(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_F67A312A4BD8904ADC42A2B89F9BFC2D;// 0x8688(0x0128)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_8839AFDE4BC4C7370838B4B2DBE84FBF;// 0x87B0(0x0128)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_5DC71AFD4E5103DD14DAACB28A288523;// 0x88D8(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_993052574158436B922BBFAD04C74A35;// 0x89A8(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_1713C1A5414A9753277EFEABC1F89E24;// 0x8A48(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_CD76CD864EE35C49DC09C384B4701415;// 0x8B18(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_C3E0B0724B89B6833DC1B48E2DCCBC45;// 0x8BB8(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_C0AB751C407DDF2994ADA9A02B36C4DB;// 0x8C90(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_0BF3A66A4D2404385ADFCB9C5E6BB81D;// 0x8CD0(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_1BE57BC347AD7B7535269F89E2B2A03A;// 0x8D10(0x0128)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_2AD4E6BA4009DE1A1227FB8E30442E77;// 0x8E38(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_4341CB2B41C8CE71F11FD99992273AEF;// 0x8ED8(0x00D0)
struct FAnimNode_BlendListByEnum AnimGraphNode_BlendListByEnum_D3C512D64B66B8F7AB92B79ECC95CAF9;// 0x8FA8(0x00E0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_CB24DFE1476DD8F442B44BA8699E029A;// 0x9088(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_0C3B3D8545012BD32C4279A6D9EF3671;// 0x9128(0x00D8)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_A5A8AB0C4898B1E8A96865BEBB2553AF;// 0x9200(0x0040)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_8F9AC31F4FF4E91C8D66E0BD78A3FC31;// 0x9240(0x0040)
struct FAnimNode_BlendSpacePlayer AnimGraphNode_BlendSpacePlayer_689193B84F6CFF0EF77188A24230B479;// 0x9280(0x0128)
struct FAnimNode_StateResult AnimGraphNode_StateResult_B95B570D4F9312E4873629B831816AE2;// 0x93A8(0x0040)
struct FAnimNode_StateMachine AnimGraphNode_StateMachine_24EBAC404BA78F0F89B2D9984A99993A;// 0x93E8(0x00E0)
struct FAnimNode_Slot AnimGraphNode_Slot_1A05EF9C4323A36A6F70749099B60F17; // 0x94C8(0x0068)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_DD570C9A48A722A7D86C859447E22A7B;// 0x9530(0x00D8)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_7DEFD20F481DE3839AA90A9948CB5147;// 0x9608(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_593AD5F2425093B67487BA8FC3A7AC3E;// 0x96E0(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_B5E0DDCB43532C7143EFA0BB98493199;// 0x9728(0x0048)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_883BD8E84E3A5DD0F973009C9F00AEC7;// 0x9770(0x00D0)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_772118D44AF91968CE4C5E837CAE85B6;// 0x9840(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_C01DB7D0479D7F3DA23686B4FE75640D;// 0x9918(0x00A0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_CD15FB8547F87928BC72FCBE264EC0A4;// 0x99B8(0x00D8)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_DBA850A445D03212EE356CAC86B53B38;// 0x9A90(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_6CE1BBE646046042F96E8B84F823DEEB;// 0x9B68(0x0048)
struct FAnimNode_BlendListByEnum AnimGraphNode_BlendListByEnum_D5A6509A4806FF19E0156D90FDCBFCEE;// 0x9BB0(0x00E0)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_0A17C1DA4A8B5E81E90E4B9BD22CAFBC;// 0x9C90(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_09BFB35C46B356FB528833AA23F3C239;// 0x9D68(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_5B37A9344247D21F3CAA7C9B756C9942;// 0x9DB0(0x0048)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_907CAF2441787C4407194683E3BE66E1;// 0x9DF8(0x00D0)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_5B9EC6314ED6C699174490ADC375459D;// 0x9EC8(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_25D7F30E439A9A11E243F6B1A97AAFFB;// 0x9FA0(0x0048)
struct FAnimNode_Slot AnimGraphNode_Slot_2EE077AB4F9A4BC7CA505DB1E8DFB448; // 0x9FE8(0x0068)
struct FAnimNode_BlendListByInt AnimGraphNode_BlendListByInt_06E6329D440877503CF21C8F2AE1467D;// 0xA050(0x00D0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_415D43324334437522FDE98B06DDB920;// 0xA120(0x00A0)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_3ECA419E484D1918258784A0290031DD;// 0xA1C0(0x00A0)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_BF0F406E4B8303B312D26288426A2C8B;// 0xA260(0x0048)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_E5D1696E475643F6F07E528B9F940588;// 0xA2A8(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_6B080E1C4B8EE2B40D8611BC4D42C351;// 0xA380(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_88A192ED46B2D17FC8620FB886F528F5;// 0xA3C8(0x0048)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_9B276367400683E52151E191F3CD2506;// 0xA410(0x00D0)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_3D21355E4CA427974861E7B0B6258A99;// 0xA4E0(0x0048)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_C5E373374C7F98C00D661CBD72F421AD;// 0xA528(0x00D0)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_D3BC91A24AC3538BBB21ACA5E5B409B9;// 0xA5F8(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_5F9EC77641287D565F90149167230F32;// 0xA6D0(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_D7A6A01246BB0A4580CC33B08824BBCE;// 0xA718(0x0048)
struct FAnimNode_LayeredBoneBlend AnimGraphNode_LayeredBoneBlend_8D4A90BC466F6C6E3DE924AA10510DE9;// 0xA760(0x00D8)
struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_8CDE97C3466618EAA4D152A3A13C845E;// 0xA838(0x00A0)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_E0DD9D9C45368C272291899EE13B5129;// 0xA8D8(0x00D0)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_179BB1374C83CDCD7D8F329EB7579EDA;// 0xA9A8(0x0048)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_05468FED43B985D8DA3D58A539F586B5;// 0xA9F0(0x00D0)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_2768F45C4A12AEAF6668C2AA75E78773;// 0xAAC0(0x0048)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_905223594A4AA8805B617A986985BBC0;// 0xAB08(0x0040)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_106165644CE2C91A9C999D8BA2D8B4FE;// 0xAB48(0x0040)
struct FAnimNode_BlendListByBool AnimGraphNode_BlendListByBool_7D2E1E724EEDCD4C5216B2980889E231;// 0xAB88(0x00D0)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_BEF54B0D4E594CA9A1E01BA182BFE79E;// 0xAC58(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_4B994116459E8EB1645EE7A89829C5E4;// 0xAD30(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_74DEFCDD4C8888512D97B6AAA9C08898;// 0xAD78(0x0048)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_CC46D53641477E1712001A9E4C0FB215;// 0xADC0(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_310086B24504AE9DE35CD8AC18F57306;// 0xAEF8(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_A8B5106C4F8CB1D22E04A89230CACA04;// 0xB030(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_52D8EEC847D1D3D75404848EAC38011B;// 0xB168(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_5C0C47104251609F4C2730ABC4938AC2;// 0xB2A0(0x0138)
struct FAnimNode_ModifyBone AnimGraphNode_ModifyBone_8C597DD447DDD32A887064A7C852B639;// 0xB3D8(0x0138)
struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose_9D28C3AC4C4C8CDB2FE27DA107C6A684;// 0xB510(0x00D8)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_78060B44460D44F05D31149514FDF7D2;// 0xB5E8(0x0048)
struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_9874BEFC4ADDFFA4D2EA40B528C1F0C6;// 0xB630(0x0048)
int BlockPose; // 0xB678(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float Speed; // 0xB67C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float AmuletSpeed; // 0xB680(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float AmuletTimer; // 0xB684(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float AmuletTime; // 0xB688(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float CurrentSteeringFrame; // 0xB68C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float StomachPitch; // 0xB690(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
struct FVector LookAtLocation; // 0xB694(0x000C) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
struct FVector SteeringWheelLookAtLocation; // 0xB6A0(0x000C) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
TEnumAsByte<E_AnimationType> AnimationType; // 0xB6AC(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
TEnumAsByte<E_Vehicles> VehicleState; // 0xB6AD(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool FPSMode; // 0xB6AE(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool SteeringRight; // 0xB6AF(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool bSteering; // 0xB6B0(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool bInAir; // 0xB6B1(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool bSprinting; // 0xB6B2(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool Obstructed; // 0xB6B3(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool HammerEquiped; // 0xB6B4(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool Repairing; // 0xB6B5(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool FullPose; // 0xB6B6(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool Blocking; // 0xB6B7(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool UsingTeleport; // 0xB6B8(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool LookingAtWorldMap; // 0xB6B9(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool SpyGlassActive; // 0xB6BA(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool Aiming; // 0xB6BB(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool SwitchingWeapons; // 0xB6BC(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool Swimming; // 0xB6BD(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool MakeHammerHitSound; // 0xB6BE(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool IsDead; // 0xB6BF(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
float AimingPlayRate; // 0xB6C0(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool CanRepair; // 0xB6C4(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool OnMovingBase; // 0xB6C5(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool WaterInShip; // 0xB6C6(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("AnimBlueprintGeneratedClass Character_AnimBP.Character_AnimBP_C");
return ptr;
}
void PlayJumpLandSound(class UPhysicalMaterial* PhysicalSurface, const struct FVector& Location);
void PlayJumpLaunchSound(class UPhysicalMaterial* PhysicalSurface, const struct FVector& Location);
void PlayFootstepSound(class UPhysicalMaterial* SurfaceType, bool OwnFootsteps_, const struct FVector& WorldLocation);
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_BlendListByBool_5DC71AFD4E5103DD14DAACB28A288523();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_BlendListByBool_A6D756E84352E62D3F1AEC8949DDA0B8();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_BlendListByBool_3D1BD5D04B40B429D99A19B3C9F16CC8();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_C535ACE049571A14329C45906E37DE97();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_3C4DAB7B4E9738CD52FF3A963FA5D900();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_2AE72E714B80D6A01F820B9A12EF525C();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_3CC7302C4CD11F478F42ADA475EEE495();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_82244DAD410142996B02518D1AD027AD();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_D80CF66C492232827FA3DF8E993CF087();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_3FAC085E462C40EC7A9614A196D83FCE();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_CD58802645651724C3F3C7AB1749FC01();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_00A70DC44891CD65EB98E38855E49577();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_DABAA2504809372CFA5DCBB9C6A987CA();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_E7E2461E4434CEC30D3694B619D2EC0F();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_BlendListByBool_A1902AD54F85BE9AF13AD6BADA5B3693();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_ModifyBone_C8E0AABF492AD26947431CAD9E9B91BF();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_TransitionResult_9D0E611F4A746845ECA8C59556C9AEAE();
void EvaluateGraphExposedInputs_ExecuteUbergraph_Character_AnimBP_AnimGraphNode_TransitionResult_AD9D9D8A43C5795C46159D8CBC255D96();
void BlueprintUpdateAnimation(float* DeltaTimeX);
void UseFullPose(float Duration);
void AnimNotify_Shake1();
void AnimNotify_Shake2();
void AnimNotify_FirstHit();
void AnimNotify_SecondHit();
void AnimNotify_Block1();
void AnimNotify_Block2();
void AnimNotify_Footstep1();
void AnimNotify_Footstep();
void JumpLaunchSound();
void JumpLandSound();
void ExecuteUbergraph_Character_AnimBP(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
52cea06e0f8daf54d74287d4ae8537d97d457445 | 842f832105373f03cafa7988e832085ce760cdc5 | /MathExpressionCalculator/OperandsStack.cpp | e8abaacef5e59e7ddd65bb58ce99414aba4b8fc5 | [
"Unlicense"
] | permissive | ArturVasilov/PracticeITcpp | 3a520557a269fabb8a39050dd1a60c1ea660e0d7 | eb9f8ff20e351dd004396cdc7ad7c7bbfb1fa56e | refs/heads/master | 2021-01-21T04:27:50.101037 | 2016-05-27T16:02:03 | 2016-05-27T16:02:03 | 16,646,162 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,086 | cpp | OperandsStack.cpp | #include "stdafx.h"
#include "OperandsStack.h"
const int VERY_BAD_NUMBER = -666;
OperandsStack::OperandsStack(int count)
{
pointer = 0;
if (count >= 0)
{
this->count = count;
operands = new double[count];
for (int i = 0; i < count; i++)
operands[i] = 0;
}
}
int OperandsStack::getCount()
{
return pointer;
}
void OperandsStack::pushOperand(double operand, int index)
{
if (index >= 0 && index <= pointer)
{
for (int i = count - 1; i > index; i--)
operands[i] = operands[i - 1];
operands[index] = operand;
pointer++;
}
}
double OperandsStack::getOperand(int index)
{
if (index >= 0 && index < pointer)
return operands[index];
return VERY_BAD_NUMBER;
}
double OperandsStack::popOperand(int index)
{
if (index >= 0 && index < pointer)
{
pointer--;
double result = operands[index];
for (int i = index; i < count - 1; i++)
operands[i] = operands[i + 1];
return result;
}
return VERY_BAD_NUMBER;
}
void OperandsStack::pushBack(double operand)
{
pushOperand(operand, pointer);
}
OperandsStack::~OperandsStack(void)
{
delete operands;
}
|
ba55b4903c11036ced0bc51339a891017189b285 | fbb640cce65ced68430e9ca849c0dd819bf588ec | /src/MapTests.h | 62c5eda31ee0a1da86c29be7c509ccb106a87eb4 | [] | no_license | ronw23/ia-osx | 8c452d8516b695f09d11dd5a56bf5a17d9b891b3 | d4c0344c2ab9b1cbe1fe8003850867bc1cde13c6 | refs/heads/master | 2020-04-07T14:20:33.575128 | 2013-04-05T01:06:36 | 2013-04-05T01:06:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,041 | h | MapTests.h | #ifndef MAP_TESTS_H
#define MAP_TESTS_H
#include <vector>
#include "ConstTypes.h"
#include "Config.h"
class Engine;
class TimedEntity;
class Actor;
class Feature;
//Function object for sorting containers by distance to origin
struct IsCloserToOrigin {
public:
IsCloserToOrigin(const coord& c, const Engine* engine) :
c_(c), eng(engine) {
}
bool operator()(const coord& c1, const coord& c2);
coord c_;
const Engine* eng;
};
class MapTests {
public:
MapTests(Engine* engine) {
eng = engine;
}
void makeVisionBlockerArray(const coord& origin, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS], const int MAX_VISION_RANMGE = FOV_MAX_RADI_INT);
void makeMoveBlockerArray(const Actor* const actorMoving, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeMoveBlockerArrayForMoveType(const MoveType_t moveType, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeShootBlockerFeaturesArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeItemBlockerArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeMoveBlockerArrayFeaturesOnly(const Actor* const actorMoving, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeMoveBlockerArrayForMoveTypeFeaturesOnly(const MoveType_t moveType, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void addItemsToBlockerArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void addLivingActorsToBlockerArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void addAllActorsToBlockerArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void addAdjacentLivingActorsToBlockerArray(const coord origin, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
//Mostly for map generation
void makeWalkBlockingArrayFeaturesOnly(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]);
void makeFloodFill(const coord origin, bool blockers[MAP_X_CELLS][MAP_Y_CELLS], int valueArray[MAP_X_CELLS][MAP_Y_CELLS], int travelLimit,
const coord target);
void makeMapVectorFromArray(bool a[MAP_X_CELLS][MAP_Y_CELLS], vector<coord>& vectorToFill);
bool isCellInsideMainScreen(const int x, const int y) const {
if(x < 0) {
return false;
}
if(y < 0) {
return false;
}
if(x >= MAP_X_CELLS) {
return false;
}
if(y >= MAP_Y_CELLS) {
return false;
}
return true;
}
bool isAreaInsideMainScreen(const Rect& area) {
if(area.x0y0.x < 0) {
return false;
}
if(area.x0y0.y < 0) {
return false;
}
if(area.x1y1.x >= MAP_X_CELLS) {
return false;
}
if(area.x1y1.y >= MAP_Y_CELLS) {
return false;
}
return true;
}
bool isAreaStrictlyInsideOrSameAsArea(const Rect& innerArea, const Rect& outerArea) {
return innerArea.x0y0.x >= outerArea.x0y0.x && innerArea.x1y1.x <= outerArea.x1y1.x &&
innerArea.x0y0.y >= outerArea.x0y0.y && innerArea.x1y1.y <= outerArea.x1y1.y;
}
bool isCellInside(const coord& pos, const coord& x0y0, const coord& x1y1) {
return isCellInside(pos, Rect(x0y0, x1y1));
}
bool isCellInside(const coord& pos, const Rect& area) {
return pos.x >= area.x0y0.x && pos.x <= area.x1y1.x && pos.y >= area.x0y0.y && pos.y <= area.x1y1.y;
}
bool isCellInsideMainScreen(const coord& c) const {
return isCellInsideMainScreen(c.x, c.y);
}
bool isCellNextToPlayer(const int x, const int y, const bool COUNT_SAME_CELL_AS_NEIGHBOUR) const;
bool isCellsNeighbours(const int x1, const int y1, const int x2, const int y2, const bool COUNT_SAME_CELL_AS_NEIGHBOUR) const;
bool isCellsNeighbours(const coord c1, const coord c2, const bool COUNT_SAME_CELL_AS_NEIGHBOUR) const;
coord getClosestPos(const coord c, const vector<coord>& positions) const;
Actor* getClosestActor(const coord c, const vector<Actor*>& actors) const;
//getLine stops at first travel limiter (stop at target, max travel distance.
vector<coord> getLine(int originX, int originY, int targetX, int targetY, bool stopAtTarget, int chebTravelLimit);
Actor* getActorAtPos(const coord pos) const;
private:
Engine* eng;
};
#endif
|
0b5ff08b6b272c06c91ab0ee5831d238bf05ea8a | ba22f4765a46f6b8478e77b771c8e3970e8da544 | /src/Events.cpp | 94e491102684010e57a7916d5d60e109a4fa5c0b | [] | no_license | jcarvajal288/RLEngine | ad1da254f54e118fe2e6d31f19d0e8f1cb9eead8 | 2b8373a147d12302bbe932f30bb48dc43c4d7614 | refs/heads/master | 2021-01-20T09:03:28.244928 | 2014-11-22T22:36:31 | 2014-11-22T22:36:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,827 | cpp | Events.cpp | #include "Events.hpp"
using namespace std;
namespace rlns
{
/*--------------------------------------------------------------------------------
Function : interpretCommandString
Description : Executes a command specified on the command line
Inputs : DisplayPtr
Outputs : command prompt
Return : string
--------------------------------------------------------------------------------*/
static void interpretCommandString(const string& command, const DisplayPtr display)
{
if(command.empty()) return;
// Placeholder 'interpret' code that just prints the command to the message log.
display->messageTracker->addStdMessage(command);
display->messageTracker->setPrompt("");
}
/*--------------------------------------------------------------------------------
Function : getTextInput
Description : Prints a colon prompt at the command line and lets the user
input a command, then returns the command as a text string.
Inputs : DisplayPtr
Outputs : command prompt
Return : string
--------------------------------------------------------------------------------*/
static string getTextInput(const DisplayPtr display)
{
TCOD_key_t key;
string prompt(":");
string commandString("");
while(true)
{
display->messageTracker->setPrompt(prompt + commandString);
display->refresh();
TCODConsole::flush();
key = getKeypress();
// pressing enter finishes the command
if(key.vk == TCODK_ENTER)
break;
else if(key.vk == TCODK_BACKSPACE)
{
if(commandString.empty()) break;
else
{
commandString.erase(commandString.length()-2, commandString.length());
continue;
}
}
commandString.append(&key.c);
}
return commandString;
}
/*--------------------------------------------------------------------------------
Function : movePlayer
Description : Moves the current player in the given direction.
Inputs : DirectionType
Outputs : None
Return : bool (indicates successful or failed move)
--------------------------------------------------------------------------------*/
static bool movePlayer(const DirectionType dir, const DisplayPtr display)
{
LevelPtr currentLevel = Level::getCurrentLevel();
ActorPtr player = Party::getPlayerParty()->getLeader();
Point destination = player->getPosition();
destination.shift(dir);
if(currentLevel->moveLegal(destination, player->getMovementType()))
{
player->setPosition(destination);
display->setFocalPoint(destination);
display->inspectTile(currentLevel, destination);
return true;
}
else
{
return currentLevel->signalTile(destination, OPEN) != 0;
}
}
/*--------------------------------------------------------------------------------
Function : pickUpItem()
Description : Queries the current level for any items in the active
character's tile. If it finds any, it adds them to the
character's inventory and passes the turn. If not, it prints
a message to that effect.
Inputs : Pointer to the display
Outputs : Message on whether items were picked up.
Return : bool (whether items were picked up)
--------------------------------------------------------------------------------*/
static bool pickUpItem(const DisplayPtr display)
{
LevelPtr currentLevel = Level::getCurrentLevel();
ActorPtr player = Party::getPlayerParty()->getLeader();
Point location = player->getPosition();
vector<ItemPtr> itemsAtLocation = currentLevel->fetchItemsAtLocation(location);
if(itemsAtLocation.empty())
{
display->messageTracker->setPrompt("There are no items here.");
return false;
}
// TODO: in the future, if there are more than one items at the location,
// prompt the player whether he wants to add each item.
vector<ItemPtr>::const_iterator it, end;
it = itemsAtLocation.begin(); end = itemsAtLocation.end();
for(; it!=end; ++it)
{
player->giveItem(*it);
display->messageTracker->addStdMessage("Picked up " + (*it)->shortDescription() + ".");
}
return true;
}
/*--------------------------------------------------------------------------------
Function : showInventory
Description : Creates an InventoryScreen object and starts its event loop.
Inputs : DisplayPtr
Outputs : inventory screen
Return : bool (whether the action performed in the inventory screen costs
a turn)
--------------------------------------------------------------------------------*/
bool showInventory(const DisplayPtr display)
{
InventoryScreen invScreen(display, Party::getPlayerParty()->getLeader());
return invScreen.eventLoop();
}
/*--------------------------------------------------------------------------------
Function : mainEventContext
Description : Handles events for the main mode of the game: moving the party
around the playfield.
Inputs : EventType
Outputs : Changes to the game state
Return : bool (whether the action costs a turn)
--------------------------------------------------------------------------------*/
bool mainEventContext(const EventType event, const DisplayPtr display)
{
// clear the command prompt, since it should only display during the turn
// it is activated
display->messageTracker->setPrompt("");
switch(event)
{
case COMMAND:
{
string command = getTextInput(display);
interpretCommandString(command, display);
return false;
}
case EXIT:
{
IS_RUNNING = false;
return true;
}
case MOVE_NORTH:
{
return movePlayer(DirectionType::NORTH, display);
}
case MOVE_NORTHEAST:
{
return movePlayer(DirectionType::NORTHEAST, display);
}
case MOVE_EAST:
{
return movePlayer(DirectionType::EAST, display);
}
case MOVE_SOUTHEAST:
{
return movePlayer(DirectionType::SOUTHEAST, display);
}
case MOVE_SOUTH:
{
return movePlayer(DirectionType::SOUTH, display);
}
case MOVE_SOUTHWEST:
{
return movePlayer(DirectionType::SOUTHWEST, display);
}
case MOVE_WEST:
{
return movePlayer(DirectionType::WEST, display);
}
case MOVE_NORTHWEST:
{
return movePlayer(DirectionType::NORTHWEST, display);
}
case ITEM:
{
return pickUpItem(display);
}
case EQUIPMENT:
{
return showInventory(display);
}
default: return false;
}
}
}
|
a82376a1fa331124de3e92af1bc765f6da77b2c0 | 55b7dcc2d67efdf35106f8a9dcc3191333507dac | /sge/source/core/sgeLibrary.cpp | 28c36c5bd765c6199cc536fff600169eb278dab2 | [] | no_license | xiangwencheng1994/GLEngine | e1266e7e4fbc6f62be371a4ddc816a2a2167c537 | 0c60d52fe05a9ba7aeff09d1bab2d9290ace2211 | refs/heads/master | 2020-03-19T02:18:29.420897 | 2019-03-14T13:30:32 | 2019-03-14T13:30:32 | 135,616,823 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,151 | cpp | sgeLibrary.cpp | /**
*
* Simple graphic engine
* "sge" libraiy is a simple graphics engine, named sge.
*
* sgeLibrary.cpp
* date: 2018/11/14
* author: xiang
*
* License
*
* Copyright (c) 2017-2019, Xiang Wencheng <xiangwencheng@outlook.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the names of its contributors may be used to endorse or
* promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <core/sgeLibrary.h>
#include <string.h>
namespace sge
{
sgeLibrary::sgeLibrary(const char* file)
: mModule(NULL), mNeedDelete(false)
{
strcpy(mPath, file);
#if (SGE_TARGET_PLATFORM == SGE_PLATFORM_WIN32)
mModule = LoadLibraryA(mPath);
#else
mModule = dlopen(mPath, RTLD_NOW);
#endif
}
sgeLibrary::~sgeLibrary()
{
unload();
}
sgeLibrary* sgeLibrary::load(const char* file)
{
sgeLibrary* lib = new sgeLibrary(file);
lib->mNeedDelete = true;
if (! lib->isLoaded())
{
lib->release();
lib = NULL;
}
return lib;
}
bool sgeLibrary::unload()
{
bool ret = true;
if (mModule)
{
#if (SGE_TARGET_PLATFORM == SGE_PLATFORM_WIN32)
ret = (TRUE == FreeLibrary(mModule));
#else
dlclose(mModule); //TODO: check return
#endif
mModule = NULL;
}
return ret;
}
void* sgeLibrary::getFunction(const char* funName)
{
if (NULL == mModule)
return NULL;
#if (SGE_TARGET_PLATFORM == SGE_PLATFORM_WIN32)
return GetProcAddress(mModule, funName);
#else
return dlsym(mModule, funName);
#endif
}
void sgeLibrary::release()
{
if (mNeedDelete)
{
delete this;
}
}
} |
cbcd071326d0a00f8e98e04a9decef865142f899 | 4c5d17bf6c0d4901f972e88aac459088a270b301 | /stack/include/hcidefs.h | c6a468b30a741eae9f73bfc34a600650cbc191ad | [
"Apache-2.0"
] | permissive | LineageOS/android_system_bt | 87e40748871e6aa6911cd691f98d957251d01919 | 7d057c89ab62916a31934f6e9a6f527fe7fc87fb | refs/heads/lineage-19.1 | 2023-08-31T13:31:22.112619 | 2023-03-28T18:40:51 | 2023-07-07T13:02:57 | 75,635,542 | 22 | 245 | NOASSERTION | 2022-10-02T20:22:16 | 2016-12-05T14:59:35 | C++ | UTF-8 | C++ | false | false | 62,756 | h | hcidefs.h | /******************************************************************************
*
* Copyright 1999-2014 Broadcom Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
#ifndef HCIDEFS_H
#define HCIDEFS_H
#include "stack/include/hci_error_code.h"
#define HCI_PROTO_VERSION 0x01 /* Version for BT spec 1.1 */
#define HCI_PROTO_VERSION_1_2 0x02 /* Version for BT spec 1.2 */
#define HCI_PROTO_VERSION_2_0 0x03 /* Version for BT spec 2.0 */
#define HCI_PROTO_VERSION_2_1 0x04 /* Version for BT spec 2.1 [Lisbon] */
#define HCI_PROTO_VERSION_3_0 0x05 /* Version for BT spec 3.0 */
#define HCI_PROTO_VERSION_4_0 0x06 /* Version for BT spec 4.0 [LE] */
#define HCI_PROTO_VERSION_4_1 0x07 /* Version for BT spec 4.1 */
#define HCI_PROTO_VERSION_4_2 0x08 /* Version for BT spec 4.2 */
#define HCI_PROTO_VERSION_5_0 0x09 /* Version for BT spec 5.0 */
/*
* Definitions for HCI groups
*/
#define HCI_GRP_LINK_CONTROL_CMDS (0x01 << 10) /* 0x0400 */
#define HCI_GRP_LINK_POLICY_CMDS (0x02 << 10) /* 0x0800 */
#define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10) /* 0x0C00 */
#define HCI_GRP_INFORMATIONAL_PARAMS (0x04 << 10) /* 0x1000 */
#define HCI_GRP_STATUS_PARAMS (0x05 << 10) /* 0x1400 */
#define HCI_GRP_TESTING_CMDS (0x06 << 10) /* 0x1800 */
#define HCI_GRP_BLE_CMDS (0x08 << 10) /* 0x2000 (LE Commands) */
#define HCI_GRP_VENDOR_SPECIFIC (0x3F << 10) /* 0xFC00 */
/*
* Definitions for Link Control Commands
*/
/* Following opcode is used only in command complete event for flow control */
#define HCI_COMMAND_NONE 0x0000
/* Commands of HCI_GRP_LINK_CONTROL_CMDS group */
#define HCI_INQUIRY (0x0001 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_INQUIRY_CANCEL (0x0002 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_PERIODIC_INQUIRY_MODE (0x0003 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_EXIT_PERIODIC_INQUIRY_MODE (0x0004 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CREATE_CONNECTION (0x0005 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_DISCONNECT (0x0006 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ADD_SCO_CONNECTION (0x0007 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CREATE_CONNECTION_CANCEL (0x0008 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ACCEPT_CONNECTION_REQUEST (0x0009 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_REJECT_CONNECTION_REQUEST (0x000A | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_LINK_KEY_REQUEST_REPLY (0x000B | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_LINK_KEY_REQUEST_NEG_REPLY (0x000C | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_PIN_CODE_REQUEST_REPLY (0x000D | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_PIN_CODE_REQUEST_NEG_REPLY (0x000E | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CHANGE_CONN_PACKET_TYPE (0x000F | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_AUTHENTICATION_REQUESTED (0x0011 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_SET_CONN_ENCRYPTION (0x0013 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CHANGE_CONN_LINK_KEY (0x0015 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CENTRAL_LINK_KEY (0x0017 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_RMT_NAME_REQUEST (0x0019 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_RMT_NAME_REQUEST_CANCEL (0x001A | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_READ_RMT_FEATURES (0x001B | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_READ_RMT_EXT_FEATURES (0x001C | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_READ_RMT_VERSION_INFO (0x001D | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_READ_RMT_CLOCK_OFFSET (0x001F | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_READ_LMP_HANDLE (0x0020 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_SETUP_ESCO_CONNECTION (0x0028 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ACCEPT_ESCO_CONNECTION (0x0029 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_REJECT_ESCO_CONNECTION (0x002A | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_IO_CAPABILITY_REQUEST_REPLY (0x002B | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_USER_CONF_REQUEST_REPLY (0x002C | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_USER_CONF_VALUE_NEG_REPLY (0x002D | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_USER_PASSKEY_REQ_REPLY (0x002E | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_USER_PASSKEY_REQ_NEG_REPLY (0x002F | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_REM_OOB_DATA_REQ_REPLY (0x0030 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_REM_OOB_DATA_REQ_NEG_REPLY (0x0033 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_IO_CAP_REQ_NEG_REPLY (0x0034 | HCI_GRP_LINK_CONTROL_CMDS)
/* AMP HCI */
#define HCI_CREATE_PHYSICAL_LINK (0x0035 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ACCEPT_PHYSICAL_LINK (0x0036 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_DISCONNECT_PHYSICAL_LINK (0x0037 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_CREATE_LOGICAL_LINK (0x0038 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ACCEPT_LOGICAL_LINK (0x0039 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_DISCONNECT_LOGICAL_LINK (0x003A | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_LOGICAL_LINK_CANCEL (0x003B | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_FLOW_SPEC_MODIFY (0x003C | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ENH_SETUP_ESCO_CONNECTION (0x003D | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_ENH_ACCEPT_ESCO_CONNECTION (0x003E | HCI_GRP_LINK_CONTROL_CMDS)
/* ConnectionLess Broadcast */
#define HCI_TRUNCATED_PAGE (0x003F | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_TRUNCATED_PAGE_CANCEL (0x0040 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_SET_CLB (0x0041 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_RECEIVE_CLB (0x0042 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_START_SYNC_TRAIN (0x0043 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_RECEIVE_SYNC_TRAIN (0x0044 | HCI_GRP_LINK_CONTROL_CMDS)
#define HCI_LINK_CTRL_CMDS_FIRST HCI_INQUIRY
#define HCI_LINK_CTRL_CMDS_LAST HCI_RECEIVE_SYNC_TRAIN
/* Commands of HCI_GRP_LINK_POLICY_CMDS */
#define HCI_HOLD_MODE (0x0001 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_SNIFF_MODE (0x0003 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_EXIT_SNIFF_MODE (0x0004 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_PARK_MODE (0x0005 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_EXIT_PARK_MODE (0x0006 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_QOS_SETUP (0x0007 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_ROLE_DISCOVERY (0x0009 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_SWITCH_ROLE (0x000B | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_READ_POLICY_SETTINGS (0x000C | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_WRITE_POLICY_SETTINGS (0x000D | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_READ_DEF_POLICY_SETTINGS (0x000E | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_WRITE_DEF_POLICY_SETTINGS (0x000F | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_FLOW_SPECIFICATION (0x0010 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_SNIFF_SUB_RATE (0x0011 | HCI_GRP_LINK_POLICY_CMDS)
#define HCI_LINK_POLICY_CMDS_FIRST HCI_HOLD_MODE
#define HCI_LINK_POLICY_CMDS_LAST HCI_SNIFF_SUB_RATE
/* Commands of HCI_GRP_HOST_CONT_BASEBAND_CMDS */
#define HCI_SET_EVENT_MASK (0x0001 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_RESET (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_EVENT_FILTER (0x0005 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_FLUSH (0x0008 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PIN_TYPE (0x0009 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PIN_TYPE (0x000A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_GET_MWS_TRANS_LAYER_CFG (0x000C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_STORED_LINK_KEY (0x000D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_STORED_LINK_KEY (0x0011 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_DELETE_STORED_LINK_KEY (0x0012 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_CHANGE_LOCAL_NAME (0x0013 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_LOCAL_NAME (0x0014 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_CONN_ACCEPT_TOUT (0x0015 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_CONN_ACCEPT_TOUT (0x0016 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PAGE_TOUT (0x0017 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PAGE_TOUT (0x0018 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_SCAN_ENABLE (0x0019 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_SCAN_ENABLE (0x001A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PAGESCAN_CFG (0x001B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PAGESCAN_CFG (0x001C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_INQUIRYSCAN_CFG (0x001D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_INQUIRYSCAN_CFG (0x001E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_AUTHENTICATION_ENABLE \
(0x001F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_AUTHENTICATION_ENABLE \
(0x0020 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_ENCRYPTION_MODE (0x0021 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_ENCRYPTION_MODE (0x0022 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_CLASS_OF_DEVICE (0x0023 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_CLASS_OF_DEVICE (0x0024 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_VOICE_SETTINGS (0x0025 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_VOICE_SETTINGS (0x0026 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_AUTOMATIC_FLUSH_TIMEOUT \
(0x0027 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT \
(0x0028 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_NUM_BCAST_REXMITS (0x0029 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_NUM_BCAST_REXMITS (0x002A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_HOLD_MODE_ACTIVITY (0x002B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_HOLD_MODE_ACTIVITY (0x002C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_TRANSMIT_POWER_LEVEL (0x002D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_SCO_FLOW_CTRL_ENABLE (0x002E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_SCO_FLOW_CTRL_ENABLE \
(0x002F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_HC_TO_HOST_FLOW_CTRL (0x0031 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_HOST_BUFFER_SIZE (0x0033 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_HOST_NUM_PACKETS_DONE (0x0035 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_LINK_SUPER_TOUT (0x0036 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_LINK_SUPER_TOUT (0x0037 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_NUM_SUPPORTED_IAC (0x0038 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_CURRENT_IAC_LAP (0x0039 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_CURRENT_IAC_LAP (0x003A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PAGESCAN_PERIOD_MODE (0x003B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PAGESCAN_PERIOD_MODE \
(0x003C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PAGESCAN_MODE (0x003D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PAGESCAN_MODE (0x003E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_AFH_CHANNELS (0x003F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_INQSCAN_TYPE (0x0042 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_INQSCAN_TYPE (0x0043 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_INQUIRY_MODE (0x0044 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_INQUIRY_MODE (0x0045 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_PAGESCAN_TYPE (0x0046 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_PAGESCAN_TYPE (0x0047 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_AFH_ASSESSMENT_MODE (0x0048 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_AFH_ASSESSMENT_MODE (0x0049 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_EXT_INQ_RESPONSE (0x0051 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_EXT_INQ_RESPONSE (0x0052 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_REFRESH_ENCRYPTION_KEY (0x0053 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_SIMPLE_PAIRING_MODE (0x0055 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_SIMPLE_PAIRING_MODE (0x0056 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_LOCAL_OOB_DATA (0x0057 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_INQ_TX_POWER_LEVEL (0x0058 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_INQ_TX_POWER_LEVEL (0x0059 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_ERRONEOUS_DATA_RPT (0x005A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_ERRONEOUS_DATA_RPT (0x005B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_ENHANCED_FLUSH (0x005F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SEND_KEYPRESS_NOTIF (0x0060 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
/* AMP HCI */
#define HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT \
(0x0061 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT \
(0x0062 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_EVENT_MASK_PAGE_2 (0x0063 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_LOCATION_DATA (0x0064 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_LOCATION_DATA (0x0065 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_FLOW_CONTROL_MODE (0x0066 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_FLOW_CONTROL_MODE (0x0067 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_BE_FLUSH_TOUT (0x0069 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_BE_FLUSH_TOUT (0x006A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
/* 802.11 only */
#define HCI_SHORT_RANGE_MODE (0x006B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_LE_HOST_SUPPORT (0x006C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_LE_HOST_SUPPORT (0x006D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
/* MWS coexistence */
#define HCI_SET_MWS_CHANNEL_PARAMETERS \
(0x006E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_EXTERNAL_FRAME_CONFIGURATION \
(0x006F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_MWS_SIGNALING (0x0070 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_MWS_TRANSPORT_LAYER (0x0071 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_MWS_SCAN_FREQUENCY_TABLE \
(0x0072 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_SET_MWS_PATTERN_CONFIGURATION \
(0x0073 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
/* Connectionless Broadcast */
#define HCI_SET_RESERVED_LT_ADDR (0x0074 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_DELETE_RESERVED_LT_ADDR (0x0075 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_CLB_DATA (0x0076 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_SYNC_TRAIN_PARAM (0x0077 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_SYNC_TRAIN_PARAM (0x0078 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_READ_SECURE_CONNS_SUPPORT (0x0079 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_WRITE_SECURE_CONNS_SUPPORT \
(0x007A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
#define HCI_CONT_BASEBAND_CMDS_FIRST HCI_SET_EVENT_MASK
#define HCI_CONT_BASEBAND_CMDS_LAST HCI_READ_SYNC_TRAIN_PARAM
/* Commands of HCI_GRP_INFORMATIONAL_PARAMS group */
#define HCI_READ_LOCAL_VERSION_INFO (0x0001 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_LOCAL_SUPPORTED_CMDS (0x0002 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_LOCAL_FEATURES (0x0003 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_LOCAL_EXT_FEATURES (0x0004 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_BUFFER_SIZE (0x0005 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_COUNTRY_CODE (0x0007 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_BD_ADDR (0x0009 | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_DATA_BLOCK_SIZE (0x000A | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_READ_LOCAL_SUPPORTED_CODECS (0x000B | HCI_GRP_INFORMATIONAL_PARAMS)
#define HCI_INFORMATIONAL_CMDS_FIRST HCI_READ_LOCAL_VERSION_INFO
#define HCI_INFORMATIONAL_CMDS_LAST HCI_READ_LOCAL_SUPPORTED_CODECS
/* Commands of HCI_GRP_STATUS_PARAMS group */
#define HCI_READ_FAILED_CONTACT_COUNTER (0x0001 | HCI_GRP_STATUS_PARAMS)
#define HCI_RESET_FAILED_CONTACT_COUNTER (0x0002 | HCI_GRP_STATUS_PARAMS)
#define HCI_GET_LINK_QUALITY (0x0003 | HCI_GRP_STATUS_PARAMS)
#define HCI_READ_RSSI (0x0005 | HCI_GRP_STATUS_PARAMS)
#define HCI_READ_AFH_CH_MAP (0x0006 | HCI_GRP_STATUS_PARAMS)
#define HCI_READ_CLOCK (0x0007 | HCI_GRP_STATUS_PARAMS)
#define HCI_READ_ENCR_KEY_SIZE (0x0008 | HCI_GRP_STATUS_PARAMS)
/* AMP HCI */
#define HCI_READ_LOCAL_AMP_INFO (0x0009 | HCI_GRP_STATUS_PARAMS)
#define HCI_READ_LOCAL_AMP_ASSOC (0x000A | HCI_GRP_STATUS_PARAMS)
#define HCI_WRITE_REMOTE_AMP_ASSOC (0x000B | HCI_GRP_STATUS_PARAMS)
#define HCI_STATUS_PARAMS_CMDS_FIRST HCI_READ_FAILED_CONTACT_COUNTER
#define HCI_STATUS_PARAMS_CMDS_LAST HCI_WRITE_REMOTE_AMP_ASSOC
/* Commands of HCI_GRP_TESTING_CMDS group */
#define HCI_READ_LOOPBACK_MODE (0x0001 | HCI_GRP_TESTING_CMDS)
#define HCI_WRITE_LOOPBACK_MODE (0x0002 | HCI_GRP_TESTING_CMDS)
#define HCI_ENABLE_DEV_UNDER_TEST_MODE (0x0003 | HCI_GRP_TESTING_CMDS)
#define HCI_WRITE_SIMP_PAIR_DEBUG_MODE (0x0004 | HCI_GRP_TESTING_CMDS)
/* AMP HCI */
#define HCI_ENABLE_AMP_RCVR_REPORTS (0x0007 | HCI_GRP_TESTING_CMDS)
#define HCI_AMP_TEST_END (0x0008 | HCI_GRP_TESTING_CMDS)
#define HCI_AMP_TEST (0x0009 | HCI_GRP_TESTING_CMDS)
#define HCI_TESTING_CMDS_FIRST HCI_READ_LOOPBACK_MODE
#define HCI_TESTING_CMDS_LAST HCI_AMP_TEST
#define HCI_VENDOR_CMDS_FIRST 0x0001
#define HCI_VENDOR_CMDS_LAST 0xFFFF
#define HCI_VSC_MULTI_AV_HANDLE 0x0AAA
#define HCI_VSC_BURST_MODE_HANDLE 0x0BBB
/* BLE HCI Group Commands */
/* Commands of BLE Controller setup and configuration */
#define HCI_BLE_SET_EVENT_MASK (0x0001 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_BUFFER_SIZE (0x0002 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_LOCAL_SPT_FEAT (0x0003 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_LOCAL_SPT_FEAT (0x0004 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_RANDOM_ADDR (0x0005 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_ADV_PARAMS (0x0006 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_ADV_CHNL_TX_POWER (0x0007 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_ADV_DATA (0x0008 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_SCAN_RSP_DATA (0x0009 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_ADV_ENABLE (0x000A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_SCAN_PARAMS (0x000B | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_SCAN_ENABLE (0x000C | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CREATE_LL_CONN (0x000D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CREATE_CONN_CANCEL (0x000E | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_ACCEPTLIST_SIZE (0x000F | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CLEAR_ACCEPTLIST (0x0010 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ADD_ACCEPTLIST (0x0011 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_REMOVE_ACCEPTLIST (0x0012 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_UPD_LL_CONN_PARAMS (0x0013 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_HOST_CHNL_CLASS (0x0014 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_CHNL_MAP (0x0015 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_REMOTE_FEAT (0x0016 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ENCRYPT (0x0017 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_RAND (0x0018 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_START_ENC (0x0019 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_LTK_REQ_REPLY (0x001A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_LTK_REQ_NEG_REPLY (0x001B | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_SUPPORTED_STATES (0x001C | HCI_GRP_BLE_CMDS)
/* 0x001D, 0x001E and 0x001F are reserved */
#define HCI_BLE_RECEIVER_TEST (0x001D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_TRANSMITTER_TEST (0x001E | HCI_GRP_BLE_CMDS)
/* BLE TEST COMMANDS */
#define HCI_BLE_TEST_END (0x001F | HCI_GRP_BLE_CMDS)
#define HCI_BLE_RC_PARAM_REQ_REPLY (0x0020 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_RC_PARAM_REQ_NEG_REPLY (0x0021 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_DATA_LENGTH (0x0022 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_DEFAULT_DATA_LENGTH (0x0023 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_DEFAULT_DATA_LENGTH (0x0024 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ADD_DEV_RESOLVING_LIST (0x0027 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_RM_DEV_RESOLVING_LIST (0x0028 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CLEAR_RESOLVING_LIST (0x0029 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_RESOLVING_LIST_SIZE (0x002A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_RESOLVABLE_ADDR_PEER (0x002B | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_RESOLVABLE_ADDR_LOCAL (0x002C | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_ADDR_RESOLUTION_ENABLE (0x002D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_RAND_PRIV_ADDR_TIMOUT (0x002E | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_MAXIMUM_DATA_LENGTH (0x002F | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_PHY (0x0030 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_DEFAULT_PHY (0x0031 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PHY (0x0032 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ENH_RECEIVER_TEST (0x0033 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ENH_TRANSMITTER_TEST (0x0034 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXT_ADVERTISING_RANDOM_ADDRESS (0x35 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXT_ADVERTISING_PARAM (0x36 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXT_ADVERTISING_DATA (0x37 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXT_ADVERTISING_SCAN_RESP (0x38 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXT_ADVERTISING_ENABLE (0x39 | HCI_GRP_BLE_CMDS)
#define HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH (0x003A | HCI_GRP_BLE_CMDS)
#define HCI_LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS \
(0x003B | HCI_GRP_BLE_CMDS)
#define HCI_LE_REMOVE_ADVERTISING_SET (0x003C | HCI_GRP_BLE_CMDS)
#define HCI_LE_CLEAR_ADVERTISING_SETS (0x003D | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_PERIODIC_ADVERTISING_PARAM (0x003E | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_PERIODIC_ADVERTISING_DATA (0x003F | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_PERIODIC_ADVERTISING_ENABLE (0x0040 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS (0x0041 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXTENDED_SCAN_ENABLE (0x0042 | HCI_GRP_BLE_CMDS)
#define HCI_LE_EXTENDED_CREATE_CONNECTION (0x0043 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_PERIODIC_ADVERTISING_CREATE_SYNC (0x0044 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL \
(0x0045 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_PERIODIC_ADVERTISING_TERMINATE_SYNC \
(0x0046 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ADD_DEVICE_TO_PERIODIC_ADVERTISER_LIST \
(0x0047 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISER_LIST \
(0x0048 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CLEAR_PERIODIC_ADVERTISER_LIST (0x0049 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_PERIODIC_ADVERTISER_LIST_SIZE (0x004A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_TRANSMIT_POWER (0x004B | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_RF_COMPENS_POWER (0x004C | HCI_GRP_BLE_CMDS)
#define HCI_BLE_WRITE_RF_COMPENS_POWER (0x004D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_PERIODIC_ADVERTISING_RECEIVE_ENABLE \
(0x0059 | HCI_GRP_BLE_CMDS)
#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER (0x005A | HCI_GRP_BLE_CMDS)
#define HCI_LE_PERIODIC_ADVERTISING_SET_INFO_TRANSFER \
(0x005B | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAM \
(0x005C | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_DEFAULT_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAM \
(0x005D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_READ_BUFFER_SIZE_V2 (0x0060 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_HOST_FEATURE (0x0074 | HCI_GRP_BLE_CMDS)
/* LE Get Vendor Capabilities Command opcode */
#define HCI_BLE_VENDOR_CAP (0x0153 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_LE_READ_ISO_TX_SYNC (0x0061 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_CIG_PARAMS (0x0062 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_CIG_PARAMS_TEST (0x0063 | HCI_GRP_BLE_CMDS)
#define HCI_LE_CREATE_CIS (0x0064 | HCI_GRP_BLE_CMDS)
#define HCI_LE_REMOVE_CIG (0x0065 | HCI_GRP_BLE_CMDS)
#define HCI_LE_ACCEPT_CIS_REQ (0x0066 | HCI_GRP_BLE_CMDS)
#define HCI_LE_REJ_CIS_REQ (0x0067 | HCI_GRP_BLE_CMDS)
#define HCI_LE_CREATE_BIG (0x0068 | HCI_GRP_BLE_CMDS)
#define HCI_LE_CREATE_BIG_TEST (0x0069 | HCI_GRP_BLE_CMDS)
#define HCI_LE_TERM_BIG (0x006A | HCI_GRP_BLE_CMDS)
#define HCI_LE_BIG_CREATE_SYNC (0x006B | HCI_GRP_BLE_CMDS)
#define HCI_LE_BIG_TERM_SYNC (0x006C | HCI_GRP_BLE_CMDS)
#define HCI_LE_REQ_PEER_SCA (0x006D | HCI_GRP_BLE_CMDS)
#define HCI_LE_SETUP_ISO_DATA_PATH (0x006E | HCI_GRP_BLE_CMDS)
#define HCI_LE_REMOVE_ISO_DATA_PATH (0x006F | HCI_GRP_BLE_CMDS)
#define HCI_LE_ISO_TRANSMIT_TEST (0x0070 | HCI_GRP_BLE_CMDS)
#define HCI_LE_ISO_RECEIVE_TEST (0x0071 | HCI_GRP_BLE_CMDS)
#define HCI_LE_ISO_READ_TEST_CNTRS (0x0072 | HCI_GRP_BLE_CMDS)
#define HCI_LE_ISO_TEST_END (0x0073 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_HOST_FEATURE (0x0074 | HCI_GRP_BLE_CMDS)
#define HCI_LE_READ_ISO_LINK_QUALITY (0x0075 | HCI_GRP_BLE_CMDS)
/* Multi adv opcode */
#define HCI_BLE_MULTI_ADV (0x0154 | HCI_GRP_VENDOR_SPECIFIC)
/* Batch scan opcode */
#define HCI_BLE_BATCH_SCAN (0x0156 | HCI_GRP_VENDOR_SPECIFIC)
/* ADV filter opcode */
#define HCI_BLE_ADV_FILTER (0x0157 | HCI_GRP_VENDOR_SPECIFIC)
/* Energy info opcode */
#define HCI_BLE_ENERGY_INFO (0x0159 | HCI_GRP_VENDOR_SPECIFIC)
/* Controller debug info opcode */
#define HCI_CONTROLLER_DEBUG_INFO (0x015B | HCI_GRP_VENDOR_SPECIFIC)
/* A2DP offload opcode */
#define HCI_CONTROLLER_A2DP (0x015D | HCI_GRP_VENDOR_SPECIFIC)
/* Bluetooth Quality Report opcode */
#define HCI_CONTROLLER_BQR (0x015E | HCI_GRP_VENDOR_SPECIFIC)
/* Bluetooth Dynamic Audio Buffer opcode */
#define HCI_CONTROLLER_DAB (0x015F | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_CONTROLLER_DAB_GET_BUFFER_TIME 0x01
#define HCI_CONTROLLER_DAB_SET_BUFFER_TIME 0x02
/* subcode for multi adv feature */
#define BTM_BLE_MULTI_ADV_SET_PARAM 0x01
#define BTM_BLE_MULTI_ADV_WRITE_ADV_DATA 0x02
#define BTM_BLE_MULTI_ADV_WRITE_SCAN_RSP_DATA 0x03
#define BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR 0x04
#define BTM_BLE_MULTI_ADV_ENB 0x05
/* multi adv VSE subcode */
/* multi adv instance state change */
#define HCI_VSE_SUBCODE_BLE_MULTI_ADV_ST_CHG 0x55
/* subcode for batch scan feature */
#define BTM_BLE_BATCH_SCAN_ENB_DISAB_CUST_FEATURE 0x01
#define BTM_BLE_BATCH_SCAN_SET_STORAGE_PARAM 0x02
#define BTM_BLE_BATCH_SCAN_SET_PARAMS 0x03
#define BTM_BLE_BATCH_SCAN_READ_RESULTS 0x04
/* batch scan VSE subcode */
#define HCI_VSE_SUBCODE_BLE_THRESHOLD_SUB_EVT 0x54 /* Threshold event */
/* tracking sub event */
#define HCI_VSE_SUBCODE_BLE_TRACKING_SUB_EVT 0x56 /* Tracking event */
/* debug info sub event */
#define HCI_VSE_SUBCODE_DEBUG_INFO_SUB_EVT 0x57
/* Bluetooth Quality Report sub event */
#define HCI_VSE_SUBCODE_BQR_SUB_EVT 0x58
/* LE Supported States */
constexpr uint8_t HCI_LE_STATES_NON_CONN_ADV_BIT = 0;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_BIT = 1;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_BIT = 2;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_BIT = 3;
constexpr uint8_t HCI_LE_STATES_PASS_SCAN_BIT = 4;
constexpr uint8_t HCI_LE_STATES_ACTIVE_SCAN_BIT = 5;
constexpr uint8_t HCI_LE_STATES_INIT_BIT = 6;
constexpr uint8_t HCI_LE_STATES_PERIPHERAL_BIT = 7;
constexpr uint8_t HCI_LE_STATES_NON_CONN_ADV_PASS_SCAN_BIT = 8;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_PASS_SCAN_BIT = 9;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_PASS_SCAN_BIT = 10;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_BIT = 11;
constexpr uint8_t HCI_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_BIT = 12;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_ACTIVE_SCAN_BIT = 13;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_ACTIVE_SCAN_BIT = 14;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_BIT = 15;
constexpr uint8_t HCI_LE_STATES_NON_CONN_INIT_BIT = 16;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_INIT_BIT = 17;
constexpr uint8_t HCI_LE_STATES_NON_CONN_ADV_CENTRAL_BIT = 18;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_CENTRAL_BIT = 19;
constexpr uint8_t HCI_LE_STATES_NON_CONN_ADV_PERIPHERAL_BIT = 20;
constexpr uint8_t HCI_LE_STATES_SCAN_ADV_PERIPHERAL_BIT = 21;
constexpr uint8_t HCI_LE_STATES_PASS_SCAN_INIT_BIT = 22;
constexpr uint8_t HCI_LE_STATES_ACTIVE_SCAN_INIT_BIT = 23;
constexpr uint8_t HCI_LE_STATES_PASS_SCAN_CENTRAL_BIT = 24;
constexpr uint8_t HCI_LE_STATES_ACTIVE_SCAN_CENTRAL_BIT = 25;
constexpr uint8_t HCI_LE_STATES_PASS_SCAN_PERIPHERAL_BIT = 26;
constexpr uint8_t HCI_LE_STATES_ACTIVE_SCAN_PERIPHERAL_BIT = 27;
constexpr uint8_t HCI_LE_STATES_INIT_CENTRAL_BIT = 28;
constexpr uint8_t HCI_LE_STATES_LOW_DUTY_DIR_ADV_BIT = 29;
constexpr uint8_t HCI_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_BIT = 30;
constexpr uint8_t HCI_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_BIT = 31;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_INIT_BIT = 32;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_INIT_BIT = 33;
constexpr uint8_t HCI_LE_STATES_LO_DUTY_DIR_ADV_INIT_BIT = 34;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_CENTRAL_BIT = 35;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_CENTRAL_BIT = 36;
constexpr uint8_t HCI_LE_STATES_LO_DUTY_DIR_ADV_CENTRAL_BIT = 37;
constexpr uint8_t HCI_LE_STATES_CONN_ADV_PERIPHERAL_BIT = 38;
constexpr uint8_t HCI_LE_STATES_HI_DUTY_DIR_ADV_PERIPHERAL_BIT = 39;
constexpr uint8_t HCI_LE_STATES_LO_DUTY_DIR_ADV_PERIPHERAL_BIT = 40;
constexpr uint8_t HCI_LE_STATES_INIT_CENTRAL_PERIPHERAL_BIT = 41;
/*
* Definitions for HCI Events
*/
#define HCI_INQUIRY_COMP_EVT 0x01
#define HCI_INQUIRY_RESULT_EVT 0x02
#define HCI_CONNECTION_COMP_EVT 0x03
#define HCI_CONNECTION_REQUEST_EVT 0x04
#define HCI_DISCONNECTION_COMP_EVT 0x05
#define HCI_AUTHENTICATION_COMP_EVT 0x06
#define HCI_RMT_NAME_REQUEST_COMP_EVT 0x07
#define HCI_ENCRYPTION_CHANGE_EVT 0x08
#define HCI_CHANGE_CONN_LINK_KEY_EVT 0x09
#define HCI_CENTRAL_LINK_KEY_COMP_EVT 0x0A
#define HCI_READ_RMT_FEATURES_COMP_EVT 0x0B
#define HCI_READ_RMT_VERSION_COMP_EVT 0x0C
#define HCI_QOS_SETUP_COMP_EVT 0x0D
#define HCI_COMMAND_COMPLETE_EVT 0x0E
#define HCI_COMMAND_STATUS_EVT 0x0F
#define HCI_HARDWARE_ERROR_EVT 0x10
#define HCI_FLUSH_OCCURED_EVT 0x11
#define HCI_ROLE_CHANGE_EVT 0x12
#define HCI_NUM_COMPL_DATA_PKTS_EVT 0x13
#define HCI_MODE_CHANGE_EVT 0x14
#define HCI_RETURN_LINK_KEYS_EVT 0x15
#define HCI_PIN_CODE_REQUEST_EVT 0x16
#define HCI_LINK_KEY_REQUEST_EVT 0x17
#define HCI_LINK_KEY_NOTIFICATION_EVT 0x18
#define HCI_LOOPBACK_COMMAND_EVT 0x19
#define HCI_DATA_BUF_OVERFLOW_EVT 0x1A
#define HCI_MAX_SLOTS_CHANGED_EVT 0x1B
#define HCI_READ_CLOCK_OFF_COMP_EVT 0x1C
#define HCI_CONN_PKT_TYPE_CHANGE_EVT 0x1D
#define HCI_QOS_VIOLATION_EVT 0x1E
#define HCI_PAGE_SCAN_MODE_CHANGE_EVT 0x1F
#define HCI_PAGE_SCAN_REP_MODE_CHNG_EVT 0x20
#define HCI_FLOW_SPECIFICATION_COMP_EVT 0x21
#define HCI_INQUIRY_RSSI_RESULT_EVT 0x22
#define HCI_READ_RMT_EXT_FEATURES_COMP_EVT 0x23
#define HCI_ESCO_CONNECTION_COMP_EVT 0x2C
#define HCI_ESCO_CONNECTION_CHANGED_EVT 0x2D
#define HCI_SNIFF_SUB_RATE_EVT 0x2E
#define HCI_EXTENDED_INQUIRY_RESULT_EVT 0x2F
#define HCI_ENCRYPTION_KEY_REFRESH_COMP_EVT 0x30
#define HCI_IO_CAPABILITY_REQUEST_EVT 0x31
#define HCI_IO_CAPABILITY_RESPONSE_EVT 0x32
#define HCI_USER_CONFIRMATION_REQUEST_EVT 0x33
#define HCI_USER_PASSKEY_REQUEST_EVT 0x34
#define HCI_REMOTE_OOB_DATA_REQUEST_EVT 0x35
#define HCI_SIMPLE_PAIRING_COMPLETE_EVT 0x36
#define HCI_LINK_SUPER_TOUT_CHANGED_EVT 0x38
#define HCI_ENHANCED_FLUSH_COMPLETE_EVT 0x39
#define HCI_USER_PASSKEY_NOTIFY_EVT 0x3B
#define HCI_KEYPRESS_NOTIFY_EVT 0x3C
#define HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT 0x3D
/* ULP HCI Event */
#define HCI_BLE_EVENT 0x3e
/* ULP Event sub code */
#define HCI_BLE_CONN_COMPLETE_EVT 0x01
#define HCI_BLE_ADV_PKT_RPT_EVT 0x02
#define HCI_BLE_LL_CONN_PARAM_UPD_EVT 0x03
#define HCI_BLE_READ_REMOTE_FEAT_CMPL_EVT 0x04
#define HCI_BLE_LTK_REQ_EVT 0x05
#define HCI_BLE_RC_PARAM_REQ_EVT 0x06
#define HCI_BLE_DATA_LENGTH_CHANGE_EVT 0x07
#define HCI_BLE_ENHANCED_CONN_COMPLETE_EVT 0x0a
#define HCI_BLE_DIRECT_ADV_EVT 0x0b
#define HCI_BLE_PHY_UPDATE_COMPLETE_EVT 0x0c
#define HCI_LE_EXTENDED_ADVERTISING_REPORT_EVT 0x0D
#define HCI_BLE_PERIODIC_ADV_SYNC_EST_EVT 0x0E
#define HCI_BLE_PERIODIC_ADV_REPORT_EVT 0x0F
#define HCI_BLE_PERIODIC_ADV_SYNC_LOST_EVT 0x10
#define HCI_BLE_SCAN_TIMEOUT_EVT 0x11
#define HCI_LE_ADVERTISING_SET_TERMINATED_EVT 0x12
#define HCI_BLE_SCAN_REQ_RX_EVT 0x13
#define HCI_BLE_CIS_EST_EVT 0x19
#define HCI_BLE_CIS_REQ_EVT 0x1a
#define HCI_BLE_CREATE_BIG_CPL_EVT 0x1b
#define HCI_BLE_TERM_BIG_CPL_EVT 0x1c
#define HCI_BLE_BIG_SYNC_EST_EVT 0x1d
#define HCI_BLE_BIG_SYNC_LOST_EVT 0x1e
#define HCI_BLE_REQ_PEER_SCA_CPL_EVT 0x1f
#define HCI_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */
/*
* Definitions for HCI enable event
*/
#define HCI_INQUIRY_RESULT_EV(p) (*((uint32_t*)(p)) & 0x00000002)
#define HCI_CONNECTION_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00000004)
#define HCI_CONNECTION_REQUEST_EV(p) (*((uint32_t*)(p)) & 0x00000008)
#define HCI_DISCONNECTION_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00000010)
#define HCI_AUTHENTICATION_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00000020)
#define HCI_RMT_NAME_REQUEST_COMPL_EV(p) (*((uint32_t*)(p)) & 0x00000040)
#define HCI_CHANGE_CONN_ENCRPT_ENABLE_EV(p) (*((uint32_t*)(p)) & 0x00000080)
#define HCI_CHANGE_CONN_LINK_KEY_EV(p) (*((uint32_t*)(p)) & 0x00000100)
#define HCI_CENTRAL_LINK_KEY_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00000200)
#define HCI_READ_RMT_FEATURES_COMPL_EV(p) (*((uint32_t*)(p)) & 0x00000400)
#define HCI_READ_RMT_VERSION_COMPL_EV(p) (*((uint32_t*)(p)) & 0x00000800)
#define HCI_QOS_SETUP_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00001000)
#define HCI_COMMAND_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00002000)
#define HCI_COMMAND_STATUS_EV(p) (*((uint32_t*)(p)) & 0x00004000)
#define HCI_HARDWARE_ERROR_EV(p) (*((uint32_t*)(p)) & 0x00008000)
#define HCI_FLASH_OCCURED_EV(p) (*((uint32_t*)(p)) & 0x00010000)
#define HCI_ROLE_CHANGE_EV(p) (*((uint32_t*)(p)) & 0x00020000)
#define HCI_NUM_COMPLETED_PKTS_EV(p) (*((uint32_t*)(p)) & 0x00040000)
#define HCI_MODE_CHANGE_EV(p) (*((uint32_t*)(p)) & 0x00080000)
#define HCI_RETURN_LINK_KEYS_EV(p) (*((uint32_t*)(p)) & 0x00100000)
#define HCI_PIN_CODE_REQUEST_EV(p) (*((uint32_t*)(p)) & 0x00200000)
#define HCI_LINK_KEY_REQUEST_EV(p) (*((uint32_t*)(p)) & 0x00400000)
#define HCI_LINK_KEY_NOTIFICATION_EV(p) (*((uint32_t*)(p)) & 0x00800000)
#define HCI_LOOPBACK_COMMAND_EV(p) (*((uint32_t*)(p)) & 0x01000000)
#define HCI_DATA_BUF_OVERFLOW_EV(p) (*((uint32_t*)(p)) & 0x02000000)
#define HCI_MAX_SLOTS_CHANGE_EV(p) (*((uint32_t*)(p)) & 0x04000000)
#define HCI_READ_CLOCK_OFFSET_COMP_EV(p) (*((uint32_t*)(p)) & 0x08000000)
#define HCI_CONN_PKT_TYPE_CHANGED_EV(p) (*((uint32_t*)(p)) & 0x10000000)
#define HCI_QOS_VIOLATION_EV(p) (*((uint32_t*)(p)) & 0x20000000)
#define HCI_PAGE_SCAN_MODE_CHANGED_EV(p) (*((uint32_t*)(p)) & 0x40000000)
#define HCI_PAGE_SCAN_REP_MODE_CHNG_EV(p) (*((uint32_t*)(p)) & 0x80000000)
/* the event mask for 2.0 + EDR and later (includes Lisbon events) */
#define HCI_DUMO_EVENT_MASK_EXT \
{ 0x3D, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
/* 0x00001FFF FFFFFFFF Default - no Lisbon events
0x00000800 00000000 Synchronous Connection Complete Event
0x00001000 00000000 Synchronous Connection Changed Event
0x00002000 00000000 Sniff Subrate Event
0x00004000 00000000 Extended Inquiry Result Event
0x00008000 00000000 Encryption Key Refresh Complete Event
0x00010000 00000000 IO Capability Request Event
0x00020000 00000000 IO Capability Response Event
0x00040000 00000000 User Confirmation Request Event
0x00080000 00000000 User Passkey Request Event
0x00100000 00000000 Remote OOB Data Request Event
0x00200000 00000000 Simple Pairing Complete Event
0x00400000 00000000 Generic AMP Link Key Notification Event
0x00800000 00000000 Link Supervision Timeout Changed Event
0x01000000 00000000 Enhanced Flush Complete Event
0x04000000 00000000 User Passkey Notification Event
0x08000000 00000000 Keypress Notification Event
0x10000000 00000000 Remote Host Supported Features Notification Event
0x20000000 00000000 LE Meta Event
*/
/*
* Definitions for packet type masks (BT1.2 and BT2.0 definitions)
*/
typedef enum : uint16_t {
HCI_PKT_TYPES_MASK_NO_2_DH1 = 0x0002,
HCI_PKT_TYPES_MASK_NO_3_DH1 = 0x0004,
HCI_PKT_TYPES_MASK_DM1 = 0x0008,
HCI_PKT_TYPES_MASK_DH1 = 0x0010,
HCI_PKT_TYPES_MASK_HV1 = 0x0020,
HCI_PKT_TYPES_MASK_HV2 = 0x0040,
HCI_PKT_TYPES_MASK_HV3 = 0x0080,
HCI_PKT_TYPES_MASK_NO_2_DH3 = 0x0100,
HCI_PKT_TYPES_MASK_NO_3_DH3 = 0x0200,
HCI_PKT_TYPES_MASK_DM3 = 0x0400,
HCI_PKT_TYPES_MASK_DH3 = 0x0800,
HCI_PKT_TYPES_MASK_NO_2_DH5 = 0x1000,
HCI_PKT_TYPES_MASK_NO_3_DH5 = 0x2000,
HCI_PKT_TYPES_MASK_DM5 = 0x4000,
HCI_PKT_TYPES_MASK_DH5 = 0x8000,
} tHCI_PKT_TYPE_BITMASK;
/*
* Define parameters to allow role switch during create connection
*/
#define HCI_CR_CONN_NOT_ALLOW_SWITCH 0x00
#define HCI_CR_CONN_ALLOW_SWITCH 0x01
/* HCI mode defenitions */
typedef enum : uint8_t {
HCI_MODE_ACTIVE = 0x00,
HCI_MODE_HOLD = 0x01,
HCI_MODE_SNIFF = 0x02,
HCI_MODE_PARK = 0x03,
} tHCI_MODE;
inline std::string hci_mode_text(const tHCI_MODE& mode) {
switch (mode) {
case HCI_MODE_ACTIVE:
return std::string("active");
case HCI_MODE_HOLD:
return std::string("hold");
case HCI_MODE_SNIFF:
return std::string("sniff");
case HCI_MODE_PARK:
return std::string("park");
default:
return std::string("UNKNOWN");
}
}
/* Page scan period modes */
#define HCI_PAGE_SCAN_REP_MODE_R1 0x01
/* Page scan modes */
#define HCI_MANDATARY_PAGE_SCAN_MODE 0x00
/* Page and inquiry scan types */
#define HCI_SCAN_TYPE_STANDARD 0x00
#define HCI_DEF_SCAN_TYPE HCI_SCAN_TYPE_STANDARD
/* Definitions for Extended Inquiry Response */
#define HCI_EXT_INQ_RESPONSE_LEN 240
#define HCI_EIR_FLAGS_TYPE BT_EIR_FLAGS_TYPE
#define HCI_EIR_MORE_16BITS_UUID_TYPE BT_EIR_MORE_16BITS_UUID_TYPE
#define HCI_EIR_COMPLETE_16BITS_UUID_TYPE BT_EIR_COMPLETE_16BITS_UUID_TYPE
#define HCI_EIR_MORE_32BITS_UUID_TYPE BT_EIR_MORE_32BITS_UUID_TYPE
#define HCI_EIR_COMPLETE_32BITS_UUID_TYPE BT_EIR_COMPLETE_32BITS_UUID_TYPE
#define HCI_EIR_MORE_128BITS_UUID_TYPE BT_EIR_MORE_128BITS_UUID_TYPE
#define HCI_EIR_COMPLETE_128BITS_UUID_TYPE BT_EIR_COMPLETE_128BITS_UUID_TYPE
#define HCI_EIR_SHORTENED_LOCAL_NAME_TYPE BT_EIR_SHORTENED_LOCAL_NAME_TYPE
#define HCI_EIR_COMPLETE_LOCAL_NAME_TYPE BT_EIR_COMPLETE_LOCAL_NAME_TYPE
#define HCI_EIR_TX_POWER_LEVEL_TYPE BT_EIR_TX_POWER_LEVEL_TYPE
#define HCI_EIR_MANUFACTURER_SPECIFIC_TYPE BT_EIR_MANUFACTURER_SPECIFIC_TYPE
#define HCI_EIR_SERVICE_DATA_TYPE BT_EIR_SERVICE_DATA_TYPE
#define HCI_EIR_SERVICE_DATA_16BITS_UUID_TYPE \
BT_EIR_SERVICE_DATA_16BITS_UUID_TYPE
#define HCI_EIR_SERVICE_DATA_32BITS_UUID_TYPE \
BT_EIR_SERVICE_DATA_32BITS_UUID_TYPE
#define HCI_EIR_SERVICE_DATA_128BITS_UUID_TYPE \
BT_EIR_SERVICE_DATA_128BITS_UUID_TYPE
#define HCI_EIR_OOB_BD_ADDR_TYPE BT_EIR_OOB_BD_ADDR_TYPE
#define HCI_EIR_OOB_COD_TYPE BT_EIR_OOB_COD_TYPE
#define HCI_EIR_OOB_SSP_HASH_C_TYPE BT_EIR_OOB_SSP_HASH_C_TYPE
#define HCI_EIR_OOB_SSP_RAND_R_TYPE BT_EIR_OOB_SSP_RAND_R_TYPE
/* Definitions for Write Simple Pairing Mode */
#define HCI_SP_MODE_ENABLED 0x01
/* Definitions for Write Secure Connections Host Support */
#define HCI_SC_MODE_ENABLED 0x01
/* Filters that are sent in set filter command */
#define HCI_FILTER_CONNECTION_SETUP 0x02
#define HCI_FILTER_COND_NEW_DEVICE 0x00
#define HCI_FILTER_COND_DEVICE_CLASS 0x01
#define HCI_FILTER_COND_BD_ADDR 0x02
/* role switch disabled */
#define HCI_DO_AUTO_ACCEPT_CONNECT 2
/* PIN type */
#define HCI_PIN_TYPE_FIXED 1
/* Scan enable flags */
#define HCI_INQUIRY_SCAN_ENABLED 0x01
#define HCI_PAGE_SCAN_ENABLED 0x02
/* Pagescan timer definitions in 0.625 ms */
#define HCI_DEF_PAGESCAN_INTERVAL 0x0800 /* 1.28 sec */
/* Parameter for pagescan window is passed to LC and is kept in slots */
#define HCI_DEF_PAGESCAN_WINDOW 0x12 /* 11.25 ms */
/* Inquiryscan timer definitions in 0.625 ms */
#define HCI_DEF_INQUIRYSCAN_INTERVAL 0x1000 /* 2.56 sec */
/* Parameter for inquiryscan window is passed to LC and is kept in slots */
#define HCI_DEF_INQUIRYSCAN_WINDOW 0x12 /* 11.25 ms */
/* Encryption modes */
typedef enum : uint8_t {
HCI_ENCRYPT_MODE_DISABLED = 0x00,
HCI_ENCRYPT_MODE_ON = 0x01,
HCI_ENCRYPT_MODE_ON_BR_EDR_AES_CCM = 0x02,
} tHCI_ENCRYPT_MODE;
/* Voice settings */
#define HCI_INP_CODING_LINEAR 0x0000 /* 0000000000 */
#define HCI_INP_CODING_U_LAW 0x0100 /* 0100000000 */
#define HCI_INP_CODING_A_LAW 0x0200 /* 1000000000 */
#define HCI_INP_DATA_FMT_2S_COMPLEMENT 0x0040 /* 0001000000 */
#define HCI_INP_DATA_FMT_SIGN_MAGNITUDE 0x0080 /* 0010000000 */
#define HCI_INP_DATA_FMT_UNSIGNED 0x00c0 /* 0011000000 */
#define HCI_INP_SAMPLE_SIZE_8BIT 0x0000 /* 0000000000 */
#define HCI_INP_SAMPLE_SIZE_16BIT 0x0020 /* 0000100000 */
#define HCI_INP_LINEAR_PCM_BIT_POS_OFFS 2
#define HCI_AIR_CODING_FORMAT_CVSD 0x0000 /* 0000000000 */
#define HCI_AIR_CODING_FORMAT_U_LAW 0x0001 /* 0000000001 */
#define HCI_AIR_CODING_FORMAT_A_LAW 0x0002 /* 0000000010 */
#define HCI_AIR_CODING_FORMAT_TRANSPNT 0x0003 /* 0000000011 */
#define HCI_AIR_CODING_FORMAT_MASK 0x0003 /* 0000000011 */
/* default 0001100000 */
#define HCI_DEFAULT_VOICE_SETTINGS \
(HCI_INP_CODING_LINEAR | HCI_INP_DATA_FMT_2S_COMPLEMENT | \
HCI_INP_SAMPLE_SIZE_16BIT | HCI_AIR_CODING_FORMAT_CVSD)
/* Retransmit timer definitions in 0.625 */
#define HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT 0x07FF
/* Default Link Supervision timeoout */
#define HCI_DEFAULT_INACT_TOUT 0x7D00 /* BR/EDR (20 seconds) */
/* Read transmit power level parameter */
#define HCI_READ_CURRENT 0x00
/* Link types for connection complete event */
#define HCI_LINK_TYPE_SCO 0x00
#define HCI_LINK_TYPE_ACL 0x01
#define HCI_LINK_TYPE_ESCO 0x02
/* Link Key Notification Event (Key Type) definitions */
#define HCI_LKEY_TYPE_COMBINATION 0x00
#define HCI_LKEY_TYPE_REMOTE_UNIT 0x02
#define HCI_LKEY_TYPE_DEBUG_COMB 0x03
#define HCI_LKEY_TYPE_UNAUTH_COMB 0x04
#define HCI_LKEY_TYPE_AUTH_COMB 0x05
#define HCI_LKEY_TYPE_CHANGED_COMB 0x06
#define HCI_LKEY_TYPE_UNAUTH_COMB_P_256 0x07
#define HCI_LKEY_TYPE_AUTH_COMB_P_256 0x08
/* Define an invalid value for a handle */
#define HCI_INVALID_HANDLE 0xFFFF
/* Define the preamble length for all HCI Commands.
* This is 2-bytes for opcode and 1 byte for length
*/
#define HCIC_PREAMBLE_SIZE 3
/* Define the preamble length for all HCI Events
* This is 1-byte for opcode and 1 byte for length
*/
#define HCIE_PREAMBLE_SIZE 2
#define HCI_SCO_PREAMBLE_SIZE 3
// Packet boundary flags
constexpr uint8_t kFIRST_NON_AUTOMATICALLY_FLUSHABLE = 0x0;
constexpr uint8_t kCONTINUING_FRAGMENT = 0x1;
constexpr uint8_t kHCI_FIRST_AUTOMATICALLY_FLUSHABLE = 0x2;
struct HciDataPreambleBits {
uint16_t handle : 12;
uint16_t boundary : 2;
uint16_t broadcast : 1;
uint16_t unused15 : 1;
uint16_t length;
};
struct HciDataPreambleRaw {
uint16_t word0;
uint16_t word1;
};
union HciDataPreamble {
HciDataPreambleBits bits;
HciDataPreambleRaw raw;
void Serialize(uint8_t* data) {
*data++ = ((raw.word0) & 0xff);
*data++ = (((raw.word0) >> 8) & 0xff);
*data++ = ((raw.word1) & 0xff);
*data++ = (((raw.word1 >> 8)) & 0xff);
}
bool IsFlushable() const {
return bits.boundary == kHCI_FIRST_AUTOMATICALLY_FLUSHABLE;
}
void SetFlushable() { bits.boundary = kHCI_FIRST_AUTOMATICALLY_FLUSHABLE; }
};
#define HCI_DATA_PREAMBLE_SIZE sizeof(HciDataPreamble)
static_assert(HCI_DATA_PREAMBLE_SIZE == 4);
static_assert(sizeof(HciDataPreambleRaw) == sizeof(HciDataPreambleBits));
/* local Bluetooth controller id for AMP HCI */
#define LOCAL_BR_EDR_CONTROLLER_ID 0
/* Define the extended flow specification fields used by AMP */
typedef struct {
uint8_t id;
uint8_t stype;
uint16_t max_sdu_size;
uint32_t sdu_inter_time;
uint32_t access_latency;
uint32_t flush_timeout;
} tHCI_EXT_FLOW_SPEC;
/* Parameter information for HCI_BRCM_SET_ACL_PRIORITY */
#define HCI_BRCM_ACL_PRIORITY_PARAM_SIZE 3
#define HCI_BRCM_ACL_PRIORITY_LOW 0x00
#define HCI_BRCM_ACL_PRIORITY_HIGH 0xFF
#define HCI_BRCM_SET_ACL_PRIORITY (0x0057 | HCI_GRP_VENDOR_SPECIFIC)
#define LMP_COMPID_GOOGLE 0xE0
// TODO(zachoverflow): remove this once broadcom specific hacks are removed
#define LMP_COMPID_BROADCOM 15
/*
* Define packet size
*/
#define HCI_DM1_PACKET_SIZE 17
#define HCI_DH1_PACKET_SIZE 27
#define HCI_DM3_PACKET_SIZE 121
#define HCI_DH3_PACKET_SIZE 183
#define HCI_DM5_PACKET_SIZE 224
#define HCI_DH5_PACKET_SIZE 339
#define HCI_AUX1_PACKET_SIZE 29
#define HCI_HV1_PACKET_SIZE 10
#define HCI_HV2_PACKET_SIZE 20
#define HCI_HV3_PACKET_SIZE 30
#define HCI_DV_PACKET_SIZE 9
#define HCI_EDR2_DH1_PACKET_SIZE 54
#define HCI_EDR2_DH3_PACKET_SIZE 367
#define HCI_EDR2_DH5_PACKET_SIZE 679
#define HCI_EDR3_DH1_PACKET_SIZE 83
#define HCI_EDR3_DH3_PACKET_SIZE 552
#define HCI_EDR3_DH5_PACKET_SIZE 1021
/* Feature Pages */
#define HCI_EXT_FEATURES_PAGE_MAX 3 // Parse feature pages 0-3
#define HCI_FEATURE_BYTES_PER_PAGE 8
#define HCI_EXT_FEATURES_SUCCESS_EVT_LEN 13
/* LMP features encoding - page 0 */
#define HCI_3_SLOT_PACKETS_SUPPORTED(x) ((x)[0] & 0x01)
#define HCI_5_SLOT_PACKETS_SUPPORTED(x) ((x)[0] & 0x02)
#define HCI_ENCRYPTION_SUPPORTED(x) ((x)[0] & 0x04)
#define HCI_SLOT_OFFSET_SUPPORTED(x) ((x)[0] & 0x08)
#define HCI_TIMING_ACC_SUPPORTED(x) ((x)[0] & 0x10)
#define HCI_SWITCH_SUPPORTED(x) ((x)[0] & 0x20)
#define HCI_HOLD_MODE_SUPPORTED(x) ((x)[0] & 0x40)
#define HCI_SNIFF_MODE_SUPPORTED(x) ((x)[0] & 0x80)
#define HCI_PARK_MODE_SUPPORTED(x) ((x)[1] & 0x01)
#define HCI_RSSI_SUPPORTED(x) ((x)[1] & 0x02)
#define HCI_CQM_DATA_RATE_SUPPORTED(x) ((x)[1] & 0x04)
#define HCI_SCO_LINK_SUPPORTED(x) ((x)[1] & 0x08)
#define HCI_HV2_PACKETS_SUPPORTED(x) ((x)[1] & 0x10)
#define HCI_HV3_PACKETS_SUPPORTED(x) ((x)[1] & 0x20)
#define HCI_LMP_U_LAW_SUPPORTED(x) ((x)[1] & 0x40)
#define HCI_LMP_A_LAW_SUPPORTED(x) ((x)[1] & 0x80)
#define HCI_LMP_CVSD_SUPPORTED(x) ((x)[2] & 0x01)
#define HCI_PAGING_SCHEME_SUPPORTED(x) ((x)[2] & 0x02)
#define HCI_POWER_CTRL_SUPPORTED(x) ((x)[2] & 0x04)
#define HCI_LMP_TRANSPNT_SUPPORTED(x) ((x)[2] & 0x08)
#define HCI_FLOW_CTRL_LAG_VALUE(x) (((x)[2] & 0x70) >> 4)
#define HCI_LMP_BCAST_ENC_SUPPORTED(x) ((x)[2] & 0x80)
#define HCI_LMP_SCATTER_MODE_SUPPORTED(x) ((x)[3] & 0x01)
#define HCI_EDR_ACL_2MPS_SUPPORTED(x) ((x)[3] & 0x02)
#define HCI_EDR_ACL_3MPS_SUPPORTED(x) ((x)[3] & 0x04)
#define HCI_ENHANCED_INQ_SUPPORTED(x) ((x)[3] & 0x08)
#define HCI_LMP_INTERLACED_INQ_SCAN_SUPPORTED(x) ((x)[3] & 0x10)
#define HCI_LMP_INTERLACED_PAGE_SCAN_SUPPORTED(x) ((x)[3] & 0x20)
#define HCI_LMP_INQ_RSSI_SUPPORTED(x) ((x)[3] & 0x40)
#define HCI_ESCO_EV3_SUPPORTED(x) ((x)[3] & 0x80)
#define HCI_ESCO_EV4_SUPPORTED(x) ((x)[4] & 0x01)
#define HCI_ESCO_EV5_SUPPORTED(x) ((x)[4] & 0x02)
#define HCI_LMP_ABSENCE_MASKS_SUPPORTED(x) ((x)[4] & 0x04)
#define HCI_LMP_AFH_CAP_PERIPHERAL_SUPPORTED(x) ((x)[4] & 0x08)
#define HCI_LMP_AFH_CLASS_PERIPHERAL_SUPPORTED(x) ((x)[4] & 0x10)
#define HCI_BREDR_NOT_SPT_SUPPORTED(x) ((x)[4] & 0x20)
#define HCI_LE_SPT_SUPPORTED(x) ((x)[4] & 0x40)
#define HCI_3_SLOT_EDR_ACL_SUPPORTED(x) ((x)[4] & 0x80)
#define HCI_5_SLOT_EDR_ACL_SUPPORTED(x) ((x)[5] & 0x01)
#define HCI_SNIFF_SUB_RATE_SUPPORTED(x) (static_cast<bool>((x)[5] & 0x02))
#define HCI_ATOMIC_ENCRYPT_SUPPORTED(x) ((x)[5] & 0x04)
#define HCI_LMP_AFH_CAP_MASTR_SUPPORTED(x) ((x)[5] & 0x08)
#define HCI_LMP_AFH_CLASS_MASTR_SUPPORTED(x) ((x)[5] & 0x10)
#define HCI_EDR_ESCO_2MPS_SUPPORTED(x) ((x)[5] & 0x20)
#define HCI_EDR_ESCO_3MPS_SUPPORTED(x) ((x)[5] & 0x40)
#define HCI_3_SLOT_EDR_ESCO_SUPPORTED(x) ((x)[5] & 0x80)
#define HCI_EXT_INQ_RSP_SUPPORTED(x) ((x)[6] & 0x01)
#define HCI_SIMUL_LE_BREDR_SUPPORTED(x) ((x)[6] & 0x02)
#define HCI_ANUM_PIN_CAP_SUPPORTED(x) ((x)[6] & 0x04)
#define HCI_SIMPLE_PAIRING_SUPPORTED(x) ((x)[6] & 0x08)
#define HCI_ENCAP_PDU_SUPPORTED(x) ((x)[6] & 0x10)
#define HCI_ERROR_DATA_SUPPORTED(x) ((x)[6] & 0x20)
/* This feature is causing frequent link drops when doing call switch with
* certain av/hfp headsets */
// TODO: move the disabling somewhere else
#define HCI_NON_FLUSHABLE_PB_SUPPORTED(x) (0) //((x)[6] & 0x40)
#define HCI_LINK_SUP_TO_EVT_SUPPORTED(x) ((x)[7] & 0x01)
#define HCI_INQ_RESP_TX_SUPPORTED(x) ((x)[7] & 0x02)
#define HCI_LMP_EXTENDED_SUPPORTED(x) ((x)[7] & 0x80)
/* LMP features encoding - page 1 */
#define HCI_SSP_HOST_SUPPORTED(x) ((x)[0] & 0x01)
#define HCI_LE_HOST_SUPPORTED(x) ((x)[0] & 0x02)
#define HCI_SIMUL_DUMO_HOST_SUPPORTED(x) ((x)[0] & 0x04)
#define HCI_SC_HOST_SUPPORTED(x) ((x)[0] & 0x08)
/* LMP features encoding - page 2 */
#define HCI_CSB_CENTRAL_SUPPORTED(x) ((x)[0] & 0x01)
#define HCI_CSB_PERIPHERAL_SUPPORTED(x) ((x)[0] & 0x02)
#define HCI_SYNC_TRAIN_CENTRAL_SUPPORTED(x) ((x)[0] & 0x04)
#define HCI_SYNC_SCAN_PERIPHERAL_SUPPORTED(x) ((x)[0] & 0x08)
#define HCI_INQ_RESP_NOTIF_SUPPORTED(x) ((x)[0] & 0x10)
#define HCI_SC_CTRLR_SUPPORTED(x) ((x)[1] & 0x01)
#define HCI_PING_SUPPORTED(x) ((x)[1] & 0x02)
/* LE features encoding - page 0 (the only page for now) */
#define HCI_LE_ENCRYPTION_SUPPORTED(x) ((x)[0] & 0x01)
#define HCI_LE_CONN_PARAM_REQ_SUPPORTED(x) ((x)[0] & 0x02)
#define HCI_LE_EXT_REJ_IND_SUPPORTED(x) ((x)[0] & 0x04)
#define HCI_LE_PERIPHERAL_INIT_FEAT_EXC_SUPPORTED(x) ((x)[0] & 0x08)
#define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[0] & 0x20)
#define HCI_LE_ENHANCED_PRIVACY_SUPPORTED(x) ((x)[0] & 0x40)
#define HCI_LE_EXT_SCAN_FILTER_POLICY_SUPPORTED(x) ((x)[0] & 0x80)
#define HCI_LE_2M_PHY_SUPPORTED(x) ((x)[1] & 0x01)
#define HCI_LE_CODED_PHY_SUPPORTED(x) ((x)[1] & 0x08)
#define HCI_LE_EXTENDED_ADVERTISING_SUPPORTED(x) ((x)[1] & 0x10)
#define HCI_LE_PERIODIC_ADVERTISING_SUPPORTED(x) ((x)[1] & 0x20)
#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_SENDER(x) ((x)[3] & 0x01)
#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECIPIENT(x) ((x)[3] & 0x02)
#define HCI_LE_CIS_CENTRAL(x) ((x)[3] & 0x10)
#define HCI_LE_CIS_PERIPHERAL(x) ((x)[3] & 0x20)
#define HCI_LE_ISO_BROADCASTER(x) ((x)[3] & 0x40)
#define HCI_LE_SYNCHRONIZED_RECEIVER(x) ((x)[3] & 0x80)
/* Supported Commands*/
#define HCI_NUM_SUPP_COMMANDS_BYTES 64
#define HCI_INQUIRY_SUPPORTED(x) ((x)[0] & 0x01)
#define HCI_INQUIRY_CANCEL_SUPPORTED(x) ((x)[0] & 0x02)
#define HCI_PERIODIC_INQUIRY_SUPPORTED(x) ((x)[0] & 0x04)
#define HCI_EXIT_PERIODIC_INQUIRY_SUPPORTED(x) ((x)[0] & 0x08)
#define HCI_CREATE_CONN_SUPPORTED(x) ((x)[0] & 0x10)
#define HCI_DISCONNECT_SUPPORTED(x) ((x)[0] & 0x20)
#define HCI_ADD_SCO_CONN_SUPPORTED(x) ((x)[0] & 0x40)
#define HCI_CANCEL_CREATE_CONN_SUPPORTED(x) ((x)[0] & 0x80)
#define HCI_ACCEPT_CONN_REQUEST_SUPPORTED(x) ((x)[1] & 0x01)
#define HCI_REJECT_CONN_REQUEST_SUPPORTED(x) ((x)[1] & 0x02)
#define HCI_LINK_KEY_REQUEST_REPLY_SUPPORTED(x) ((x)[1] & 0x04)
#define HCI_LINK_KEY_REQUEST_NEG_REPLY_SUPPORTED(x) ((x)[1] & 0x08)
#define HCI_PIN_CODE_REQUEST_REPLY_SUPPORTED(x) ((x)[1] & 0x10)
#define HCI_PIN_CODE_REQUEST_NEG_REPLY_SUPPORTED(x) ((x)[1] & 0x20)
#define HCI_CHANGE_CONN_PKT_TYPE_SUPPORTED(x) ((x)[1] & 0x40)
#define HCI_AUTH_REQUEST_SUPPORTED(x) ((x)[1] & 0x80)
#define HCI_SET_CONN_ENCRYPTION_SUPPORTED(x) ((x)[2] & 0x01)
#define HCI_CHANGE_CONN_LINK_KEY_SUPPORTED(x) ((x)[2] & 0x02)
#define HCI_CENTRAL_LINK_KEY_SUPPORTED(x) ((x)[2] & 0x04)
#define HCI_REMOTE_NAME_REQUEST_SUPPORTED(x) ((x)[2] & 0x08)
#define HCI_CANCEL_REMOTE_NAME_REQUEST_SUPPORTED(x) ((x)[2] & 0x10)
#define HCI_READ_REMOTE_SUPP_FEATURES_SUPPORTED(x) ((x)[2] & 0x20)
#define HCI_READ_REMOTE_EXT_FEATURES_SUPPORTED(x) ((x)[2] & 0x40)
#define HCI_READ_REMOTE_VER_INFO_SUPPORTED(x) ((x)[2] & 0x80)
#define HCI_READ_CLOCK_OFFSET_SUPPORTED(x) ((x)[3] & 0x01)
#define HCI_READ_LMP_HANDLE_SUPPORTED(x) ((x)[3] & 0x02)
/* rest of bits in 3-rd byte are reserved */
#define HCI_HOLD_MODE_CMD_SUPPORTED(x) ((x)[4] & 0x02)
#define HCI_SNIFF_MODE_CMD_SUPPORTED(x) ((x)[4] & 0x04)
#define HCI_EXIT_SNIFF_MODE_SUPPORTED(x) ((x)[4] & 0x08)
#define HCI_PARK_STATE_SUPPORTED(x) ((x)[4] & 0x10)
#define HCI_EXIT_PARK_STATE_SUPPORTED(x) ((x)[4] & 0x20)
#define HCI_QOS_SETUP_SUPPORTED(x) ((x)[4] & 0x40)
#define HCI_ROLE_DISCOVERY_SUPPORTED(x) ((x)[4] & 0x80)
#define HCI_SWITCH_ROLE_SUPPORTED(x) ((x)[5] & 0x01)
#define HCI_READ_LINK_POLICY_SET_SUPPORTED(x) ((x)[5] & 0x02)
#define HCI_WRITE_LINK_POLICY_SET_SUPPORTED(x) ((x)[5] & 0x04)
#define HCI_READ_DEF_LINK_POLICY_SET_SUPPORTED(x) ((x)[5] & 0x08)
#define HCI_WRITE_DEF_LINK_POLICY_SET_SUPPORTED(x) ((x)[5] & 0x10)
#define HCI_FLOW_SPECIFICATION_SUPPORTED(x) ((x)[5] & 0x20)
#define HCI_SET_EVENT_MASK_SUPPORTED(x) ((x)[5] & 0x40)
#define HCI_RESET_SUPPORTED(x) ((x)[5] & 0x80)
#define HCI_SET_EVENT_FILTER_SUPPORTED(x) ((x)[6] & 0x01)
#define HCI_FLUSH_SUPPORTED(x) ((x)[6] & 0x02)
#define HCI_READ_PIN_TYPE_SUPPORTED(x) ((x)[6] & 0x04)
#define HCI_WRITE_PIN_TYPE_SUPPORTED(x) ((x)[6] & 0x08)
#define HCI_READ_STORED_LINK_KEY_SUPPORTED(x) ((x)[6] & 0x20)
#define HCI_WRITE_STORED_LINK_KEY_SUPPORTED(x) ((x)[6] & 0x40)
#define HCI_DELETE_STORED_LINK_KEY_SUPPORTED(x) ((x)[6] & 0x80)
#define HCI_WRITE_LOCAL_NAME_SUPPORTED(x) ((x)[7] & 0x01)
#define HCI_READ_LOCAL_NAME_SUPPORTED(x) ((x)[7] & 0x02)
#define HCI_READ_CONN_ACCEPT_TOUT_SUPPORTED(x) ((x)[7] & 0x04)
#define HCI_WRITE_CONN_ACCEPT_TOUT_SUPPORTED(x) ((x)[7] & 0x08)
#define HCI_READ_PAGE_TOUT_SUPPORTED(x) ((x)[7] & 0x10)
#define HCI_WRITE_PAGE_TOUT_SUPPORTED(x) ((x)[7] & 0x20)
#define HCI_READ_SCAN_ENABLE_SUPPORTED(x) ((x)[7] & 0x40)
#define HCI_WRITE_SCAN_ENABLE_SUPPORTED(x) ((x)[7] & 0x80)
#define HCI_READ_PAGE_SCAN_ACTIVITY_SUPPORTED(x) ((x)[8] & 0x01)
#define HCI_WRITE_PAGE_SCAN_ACTIVITY_SUPPORTED(x) ((x)[8] & 0x02)
#define HCI_READ_INQURIY_SCAN_ACTIVITY_SUPPORTED(x) ((x)[8] & 0x04)
#define HCI_WRITE_INQURIY_SCAN_ACTIVITY_SUPPORTED(x) ((x)[8] & 0x08)
#define HCI_READ_AUTH_ENABLE_SUPPORTED(x) ((x)[8] & 0x10)
#define HCI_WRITE_AUTH_ENABLE_SUPPORTED(x) ((x)[8] & 0x20)
#define HCI_READ_ENCRYPT_ENABLE_SUPPORTED(x) ((x)[8] & 0x40)
#define HCI_WRITE_ENCRYPT_ENABLE_SUPPORTED(x) ((x)[8] & 0x80)
#define HCI_READ_CLASS_DEVICE_SUPPORTED(x) ((x)[9] & 0x01)
#define HCI_WRITE_CLASS_DEVICE_SUPPORTED(x) ((x)[9] & 0x02)
#define HCI_READ_VOICE_SETTING_SUPPORTED(x) ((x)[9] & 0x04)
#define HCI_WRITE_VOICE_SETTING_SUPPORTED(x) ((x)[9] & 0x08)
#define HCI_READ_AUTOMATIC_FLUSH_TIMEOUT_SUPPORTED(x) ((x)[9] & 0x10)
#define HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT_SUPPORTED(x) ((x)[9] & 0x20)
#define HCI_READ_NUM_BROAD_RETRANS_SUPPORTED(x) ((x)[9] & 0x40)
#define HCI_WRITE_NUM_BROAD_RETRANS_SUPPORTED(x) ((x)[9] & 0x80)
#define HCI_READ_HOLD_MODE_ACTIVITY_SUPPORTED(x) ((x)[10] & 0x01)
#define HCI_WRITE_HOLD_MODE_ACTIVITY_SUPPORTED(x) ((x)[10] & 0x02)
#define HCI_READ_TRANS_PWR_LEVEL_SUPPORTED(x) ((x)[10] & 0x04)
#define HCI_READ_SYNCH_FLOW_CTRL_ENABLE_SUPPORTED(x) ((x)[10] & 0x08)
#define HCI_WRITE_SYNCH_FLOW_CTRL_ENABLE_SUPPORTED(x) ((x)[10] & 0x10)
#define HCI_SET_HOST_CTRLR_TO_HOST_FC_SUPPORTED(x) ((x)[10] & 0x20)
#define HCI_HOST_BUFFER_SIZE_SUPPORTED(x) ((x)[10] & 0x40)
#define HCI_HOST_NUM_COMPLETED_PKTS_SUPPORTED(x) ((x)[10] & 0x80)
#define HCI_READ_LINK_SUP_TOUT_SUPPORTED(x) ((x)[11] & 0x01)
#define HCI_WRITE_LINK_SUP_TOUT_SUPPORTED(x) ((x)[11] & 0x02)
#define HCI_READ_NUM_SUPP_IAC_SUPPORTED(x) ((x)[11] & 0x04)
#define HCI_READ_CURRENT_IAC_LAP_SUPPORTED(x) ((x)[11] & 0x08)
#define HCI_WRITE_CURRENT_IAC_LAP_SUPPORTED(x) ((x)[11] & 0x10)
#define HCI_READ_PAGE_SCAN_PER_MODE_SUPPORTED(x) ((x)[11] & 0x20)
#define HCI_WRITE_PAGE_SCAN_PER_MODE_SUPPORTED(x) ((x)[11] & 0x40)
#define HCI_READ_PAGE_SCAN_MODE_SUPPORTED(x) ((x)[11] & 0x80)
#define HCI_WRITE_PAGE_SCAN_MODE_SUPPORTED(x) ((x)[12] & 0x01)
#define HCI_SET_AFH_CHNL_CLASS_SUPPORTED(x) ((x)[12] & 0x02)
#define HCI_READ_INQUIRY_SCAN_TYPE_SUPPORTED(x) ((x)[12] & 0x10)
#define HCI_WRITE_INQUIRY_SCAN_TYPE_SUPPORTED(x) ((x)[12] & 0x20)
#define HCI_READ_INQUIRY_MODE_SUPPORTED(x) ((x)[12] & 0x40)
#define HCI_WRITE_INQUIRY_MODE_SUPPORTED(x) ((x)[12] & 0x80)
#define HCI_READ_PAGE_SCAN_TYPE_SUPPORTED(x) ((x)[13] & 0x01)
#define HCI_WRITE_PAGE_SCAN_TYPE_SUPPORTED(x) ((x)[13] & 0x02)
#define HCI_READ_AFH_CHNL_ASSESS_MODE_SUPPORTED(x) ((x)[13] & 0x04)
#define HCI_WRITE_AFH_CHNL_ASSESS_MODE_SUPPORTED(x) ((x)[13] & 0x08)
#define HCI_READ_LOCAL_VER_INFO_SUPPORTED(x) ((x)[14] & 0x08)
#define HCI_READ_LOCAL_SUP_CMDS_SUPPORTED(x) ((x)[14] & 0x10)
#define HCI_READ_LOCAL_SUPP_FEATURES_SUPPORTED(x) ((x)[14] & 0x20)
#define HCI_READ_LOCAL_EXT_FEATURES_SUPPORTED(x) ((x)[14] & 0x40)
#define HCI_READ_BUFFER_SIZE_SUPPORTED(x) ((x)[14] & 0x80)
#define HCI_READ_COUNTRY_CODE_SUPPORTED(x) ((x)[15] & 0x01)
#define HCI_READ_BD_ADDR_SUPPORTED(x) ((x)[15] & 0x02)
#define HCI_READ_FAIL_CONTACT_CNTR_SUPPORTED(x) ((x)[15] & 0x04)
#define HCI_RESET_FAIL_CONTACT_CNTR_SUPPORTED(x) ((x)[15] & 0x08)
#define HCI_GET_LINK_QUALITY_SUPPORTED(x) ((x)[15] & 0x10)
#define HCI_READ_RSSI_SUPPORTED(x) ((x)[15] & 0x20)
#define HCI_READ_AFH_CH_MAP_SUPPORTED(x) ((x)[15] & 0x40)
#define HCI_READ_BD_CLOCK_SUPPORTED(x) ((x)[15] & 0x80)
#define HCI_READ_LOOPBACK_MODE_SUPPORTED(x) ((x)[16] & 0x01)
#define HCI_WRITE_LOOPBACK_MODE_SUPPORTED(x) ((x)[16] & 0x02)
#define HCI_ENABLE_DEV_UNDER_TEST_SUPPORTED(x) ((x)[16] & 0x04)
#define HCI_SETUP_SYNCH_CONN_SUPPORTED(x) ((x)[16] & 0x08)
#define HCI_ACCEPT_SYNCH_CONN_SUPPORTED(x) ((x)[16] & 0x10)
#define HCI_REJECT_SYNCH_CONN_SUPPORTED(x) ((x)[16] & 0x20)
#define HCI_READ_EXT_INQUIRY_RESP_SUPPORTED(x) ((x)[17] & 0x01)
#define HCI_WRITE_EXT_INQUIRY_RESP_SUPPORTED(x) ((x)[17] & 0x02)
#define HCI_REFRESH_ENCRYPTION_KEY_SUPPORTED(x) ((x)[17] & 0x04)
#define HCI_SNIFF_SUB_RATE_CMD_SUPPORTED(x) ((x)[17] & 0x10)
#define HCI_READ_SIMPLE_PAIRING_MODE_SUPPORTED(x) ((x)[17] & 0x20)
#define HCI_WRITE_SIMPLE_PAIRING_MODE_SUPPORTED(x) ((x)[17] & 0x40)
#define HCI_READ_LOCAL_OOB_DATA_SUPPORTED(x) ((x)[17] & 0x80)
#define HCI_READ_INQUIRY_RESPONSE_TX_POWER_SUPPORTED(x) ((x)[18] & 0x01)
#define HCI_WRITE_INQUIRY_RESPONSE_TX_POWER_SUPPORTED(x) ((x)[18] & 0x02)
#define HCI_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_SUPPORTED(x) ((x)[18] & 0x04)
#define HCI_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_SUPPORTED(x) ((x)[18] & 0x08)
#define HCI_IO_CAPABILITY_REQUEST_REPLY_SUPPORTED(x) ((x)[18] & 0x80)
#define HCI_USER_CONFIRMATION_REQUEST_REPLY_SUPPORTED(x) ((x)[19] & 0x01)
#define HCI_USER_CONFIRMATION_REQUEST_NEG_REPLY_SUPPORTED(x) ((x)[19] & 0x02)
#define HCI_USER_PASSKEY_REQUEST_REPLY_SUPPORTED(x) ((x)[19] & 0x04)
#define HCI_USER_PASSKEY_REQUEST_NEG_REPLY_SUPPORTED(x) ((x)[19] & 0x08)
#define HCI_REMOTE_OOB_DATA_REQUEST_REPLY_SUPPORTED(x) ((x)[19] & 0x10)
#define HCI_WRITE_SIMPLE_PAIRING_DBG_MODE_SUPPORTED(x) ((x)[19] & 0x20)
#define HCI_ENHANCED_FLUSH_SUPPORTED(x) ((x)[19] & 0x40)
#define HCI_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_SUPPORTED(x) ((x)[19] & 0x80)
#define HCI_SEND_NOTIF_SUPPORTED(x) ((x)[20] & 0x04)
#define HCI_IO_CAP_REQ_NEG_REPLY_SUPPORTED(x) ((x)[20] & 0x08)
#define HCI_READ_ENCR_KEY_SIZE_SUPPORTED(x) ((x)[20] & 0x10)
#define HCI_CREATE_PHYSICAL_LINK_SUPPORTED(x) ((x)[21] & 0x01)
#define HCI_ACCEPT_PHYSICAL_LINK_SUPPORTED(x) ((x)[21] & 0x02)
#define HCI_DISCONNECT_PHYSICAL_LINK_SUPPORTED(x) ((x)[21] & 0x04)
#define HCI_CREATE_LOGICAL_LINK_SUPPORTED(x) ((x)[21] & 0x08)
#define HCI_ACCEPT_LOGICAL_LINK_SUPPORTED(x) ((x)[21] & 0x10)
#define HCI_DISCONNECT_LOGICAL_LINK_SUPPORTED(x) ((x)[21] & 0x20)
#define HCI_LOGICAL_LINK_CANCEL_SUPPORTED(x) ((x)[21] & 0x40)
#define HCI_FLOW_SPEC_MODIFY_SUPPORTED(x) ((x)[21] & 0x80)
#define HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_SUPPORTED(x) ((x)[22] & 0x01)
#define HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_SUPPORTED(x) ((x)[22] & 0x02)
#define HCI_SET_EVENT_MASK_PAGE_2_SUPPORTED(x) ((x)[22] & 0x04)
#define HCI_READ_LOCATION_DATA_SUPPORTED(x) ((x)[22] & 0x08)
#define HCI_WRITE_LOCATION_DATA_SUPPORTED(x) ((x)[22] & 0x10)
#define HCI_READ_LOCAL_AMP_INFO_SUPPORTED(x) ((x)[22] & 0x20)
#define HCI_READ_LOCAL_AMP_ASSOC_SUPPORTED(x) ((x)[22] & 0x40)
#define HCI_WRITE_REMOTE_AMP_ASSOC_SUPPORTED(x) ((x)[22] & 0x80)
#define HCI_READ_FLOW_CONTROL_MODE_SUPPORTED(x) ((x)[23] & 0x01)
#define HCI_WRITE_FLOW_CONTROL_MODE_SUPPORTED(x) ((x)[23] & 0x02)
#define HCI_READ_DATA_BLOCK_SIZE_SUPPORTED(x) ((x)[23] & 0x04)
#define HCI_ENABLE_AMP_RCVR_REPORTS_SUPPORTED(x) ((x)[23] & 0x20)
#define HCI_AMP_TEST_END_SUPPORTED(x) ((x)[23] & 0x40)
#define HCI_AMP_TEST_SUPPORTED(x) ((x)[23] & 0x80)
#define HCI_READ_TRANSMIT_POWER_LEVEL_SUPPORTED(x) ((x)[24] & 0x01)
#define HCI_READ_BE_FLUSH_TOUT_SUPPORTED(x) ((x)[24] & 0x04)
#define HCI_WRITE_BE_FLUSH_TOUT_SUPPORTED(x) ((x)[24] & 0x08)
#define HCI_SHORT_RANGE_MODE_SUPPORTED(x) ((x)[24] & 0x10)
#define HCI_ENH_SETUP_SYNCH_CONN_SUPPORTED(x) ((x)[29] & 0x08)
#define HCI_ENH_ACCEPT_SYNCH_CONN_SUPPORTED(x) ((x)[29] & 0x10)
#define HCI_READ_LOCAL_CODECS_SUPPORTED(x) ((x)[29] & 0x20)
#define HCI_SET_MWS_CHANNEL_PARAMETERS_SUPPORTED(x) ((x)[29] & 0x40)
#define HCI_SET_EXTERNAL_FRAME_CONFIGURATION_SUPPORTED(x) ((x)[29] & 0x80)
#define HCI_SET_MWS_SIGNALING_SUPPORTED(x) ((x)[30] & 0x01)
#define HCI_SET_MWS_TRANSPORT_LAYER_SUPPORTED(x) ((x)[30] & 0x02)
#define HCI_SET_MWS_SCAN_FREQUENCY_TABLE_SUPPORTED(x) ((x)[30] & 0x04)
#define HCI_GET_MWS_TRANS_LAYER_CFG_SUPPORTED(x) ((x)[30] & 0x08)
#define HCI_SET_MWS_PATTERN_CONFIGURATION_SUPPORTED(x) ((x)[30] & 0x10)
#define HCI_SET_TRIG_CLK_CAP_SUPPORTED(x) ((x)[30] & 0x20)
#define HCI_TRUNCATED_PAGE_SUPPORTED(x) ((x)[30] & 0x40)
#define HCI_TRUNCATED_PAGE_CANCEL_SUPPORTED(x) ((x)[30] & 0x80)
#define HCI_SET_CONLESS_PERIPHERAL_BRCST_SUPPORTED(x) ((x)[31] & 0x01)
#define HCI_SET_CONLESS_PERIPHERAL_BRCST_RECEIVE_SUPPORTED(x) ((x)[31] & 0x02)
#define HCI_START_SYNC_TRAIN_SUPPORTED(x) ((x)[31] & 0x04)
#define HCI_RECEIVE_SYNC_TRAIN_SUPPORTED(x) ((x)[31] & 0x08)
#define HCI_SET_RESERVED_LT_ADDR_SUPPORTED(x) ((x)[31] & 0x10)
#define HCI_DELETE_RESERVED_LT_ADDR_SUPPORTED(x) ((x)[31] & 0x20)
#define HCI_SET_CONLESS_PERIPHERAL_BRCST_DATA_SUPPORTED(x) ((x)[31] & 0x40)
#define HCI_READ_SYNC_TRAIN_PARAM_SUPPORTED(x) ((x)[31] & 0x80)
#define HCI_WRITE_SYNC_TRAIN_PARAM_SUPPORTED(x) ((x)[32] & 0x01)
#define HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_SUPPORTED(x) ((x)[32] & 0x02)
#define HCI_READ_SECURE_CONNS_SUPPORT_SUPPORTED(x) ((x)[32] & 0x04)
#define HCI_WRITE_SECURE_CONNS_SUPPORT_SUPPORTED(x) ((x)[32] & 0x08)
#define HCI_READ_AUTHENT_PAYLOAD_TOUT_SUPPORTED(x) ((x)[32] & 0x10)
#define HCI_WRITE_AUTHENT_PAYLOAD_TOUT_SUPPORTED(x) ((x)[32] & 0x20)
#define HCI_READ_LOCAL_OOB_EXTENDED_DATA_SUPPORTED(x) ((x)[32] & 0x40)
#define HCI_WRITE_SECURE_CONNECTIONS_TEST_MODE_SUPPORTED(x) ((x)[32] & 0x80)
#define HCI_LE_RC_CONN_PARAM_UPD_RPY_SUPPORTED(x) ((x)[33] & 0x10)
#define HCI_LE_RC_CONN_PARAM_UPD_NEG_RPY_SUPPORTED(x) ((x)[33] & 0x20)
#define HCI_LE_READ_PHY_SUPPORTED(x) ((x)[35] & 0x10)
#define HCI_LE_SET_DEFAULT_PHY_SUPPORTED(x) ((x)[35] & 0x20)
#define HCI_LE_SET_PHY_SUPPORTED(x) ((x)[35] & 0x40)
#define HCI_LE_ENH_RX_TEST_SUPPORTED(x) ((x)[35] & 0x80)
#define HCI_LE_ENH_TX_TEST_SUPPORTED(x) ((x)[36] & 0x01)
#define HCI_LE_SET_PRIVACY_MODE_SUPPORTED(x) ((x)[39] & 0x04)
#define HCI_LE_SET_HOST_FEATURE_SUPPORTED(x) ((x)[44] & 0x02)
#endif
|
3a7a3eb591954abc76d229763a0aa8c1de593ca1 | eb827d7993b146cf507b57a45e420fffdf641eef | /tinkoff/summer2020/gen.cpp | 661d8fe83a2e4179c282a70431defb004cd41ac0 | [] | no_license | khbminus/code2020 | dfdbcae71d61d03d4457aad47ff7d4136e6fcc1e | a0d2230b0905df79ba78cb98353f4ba03f16e8b0 | refs/heads/master | 2023-07-16T16:08:20.629283 | 2021-08-29T20:35:14 | 2021-08-29T20:35:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | gen.cpp | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
int main(){
mt19937 rnd(chrono::steady_clock::steady_clock::now().time_since_epoch().count());
int n = rnd() % 1 + 3, m = rnd() % 1 + 3, k = rnd() % 2 + 1;
cout << n << ' ' << m << ' ' << k << '\n';
cout << rnd() % n + 1 << ' ' << rnd() % m + 1 << '\n';
for (int i = 0; i < k; i++){
cout << rnd() % n + 1 << ' ' << rnd() % m + 1 << ' ' << "RUDL"[rnd() % 4] << '\n';
for (int x = 0; x < n; x++){
for (int y = 0; y < m; y++)
cout << (char)('0' + rnd() % 4);
cout << '\n';
}
}
}
|
7c1d2546253dc8c85e9cb53b04725595eb47e736 | 284d8657b07536bea5d400168a98c1a3ce0bc851 | /xray/editor/world/sources/scene_graph_node.h | 48b08761ae23cef34dcb4c8e06c6fd41fd406887 | [] | no_license | yxf010/xray-2.0 | c6bcd35caa4677ab19cd8be241ce1cc0a25c74a7 | 47461806c25e34005453a373b07ce5b00df2c295 | refs/heads/master | 2020-08-29T21:35:38.253150 | 2019-05-23T16:00:42 | 2019-05-23T16:00:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,047 | h | scene_graph_node.h | ////////////////////////////////////////////////////////////////////////////
// Created : 23.11.2009
// Author : Andrew Kolomiets
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////
#ifndef SCENE_GRAPH_NODE_H_INCLUDED
#define SCENE_GRAPH_NODE_H_INCLUDED
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace xray {
namespace editor {
ref class object_base;
/// <summary>
/// Summary for scene_graph_node
/// </summary>
public ref class scene_graph_node : public controls::hypergraph::node
{
typedef controls::hypergraph::node super;
public:
scene_graph_node(void):m_object(nullptr)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
property object_base^ object{
object_base^ get() {return m_object;}
void set(object_base^ o) {set_object_impl(o);}
}
public:
virtual String^ caption () override;
virtual void on_destroyed () override;
protected:
object_base^ m_object;
void set_object_impl (object_base^ o);
void init_internal ();
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~scene_graph_node()
{
if (components)
{
delete components;
}
}
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}; //namespace editor
}; //namespace xray
#endif // #ifndef SCENE_GRAPH_NODE_H_INCLUDED
|
1eb83595de74439122396bad7d3e59af7261a7ad | 61af2d058ff5b90cbb5a00b5d662c29c8696c8cc | /AtCoder/Regular/63/F.cpp | cff4a8830fe57de961f1d565a27bec4434c35fde | [
"MIT"
] | permissive | sshockwave/Online-Judge-Solutions | eac6963be485ab0f40002f0a85d0fd65f38d5182 | 9d0bc7fd68c3d1f661622929c1cb3752601881d3 | refs/heads/master | 2021-01-24T11:45:39.484179 | 2020-03-02T04:02:40 | 2020-03-02T04:02:40 | 69,444,295 | 7 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 3,944 | cpp | F.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <set>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
T i=0;char c;
while(!isdigit(c=getchar())&&c!='-');
bool flag=c=='-';
flag?c=getchar():0;
while(i=i*10-'0'+c,isdigit(c=getchar()));
return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=300010;
int xm,ym,n,ans=0;
struct Pt{
int x,y;
inline friend bool operator < (const Pt &a,const Pt &b){
return a.y!=b.y?a.y<b.y:a.x<b.x;
}
inline friend ostream & operator << (ostream & out,const Pt &b){
out<<"("<<b.x<<","<<b.y<<")";
return out;
}
}pt[N],lstl[N],lstr[N];
int lsl,lsr;
struct intv{
int l,r,x;
inline friend bool operator < (const intv &a,const intv &b){
return a.l<b.l;
}
}*lv=new intv[N<<1],*rv=new intv[N<<1];
int lvl,lvr;
struct intvcmp2{
inline bool operator () (const intv &a,const intv &b){
return a.r!=b.r?a.r<b.r:a.x<b.x;
}
};
inline void work2(){
typedef set<intv,intvcmp2>::iterator iter;
set<intv,intvcmp2>s;
for(int i=1,j=1;i<=lvl;i++){
for(;j<=lvr&&rv[j].l<=lv[i].l;j++){
if(rv[j].r>lv[i].l){
iter it=s.insert(rv[j]).first;
if(it!=s.begin()){
iter bef=it;
bef--;
if(bef->r+bef->x>=it->r+it->x){
s.erase(it);
continue;
}
if(bef->r==it->r){
s.erase(bef);
}
}
for(iter it2;it2=it,it2++,it2!=s.end()&&it2->r+it2->x<=it->r+it->x;s.erase(it2));
}
}
for(;assert(!s.empty()),s.begin()->r<=lv[i].l;s.erase(s.begin()));
iter it=s.lower_bound((intv){0,lv[i].r+1,-1});
if(it!=s.end()){
assert(it->r>lv[i].r);
apmax(ans,it->x-lv[i].x+lv[i].r-lv[i].l);
}
if(it!=s.begin()){
it--;
assert(it->r<=lv[i].r);
apmax(ans,it->x-lv[i].x+it->r-lv[i].l);
}
}
}
int stk[N],ss;
int pre[N],nxt[N];
inline void work(){
sort(pt+1,pt+n+1);
lsl=lsr=lvl=lvr=0;
int m=xm>>1;
for(int i=1;i<=n;i++){
(pt[i].x<=m?lstl[++lsl]:lstr[++lsr])=pt[i];
}
{//left hand side
lstl[0].y=0;
stk[ss=0]=0;
for(int i=1;i<=lsl;i++){
if(i<lsl&&lstl[i+1].y==lstl[i].y)continue;
for(;ss&&lstl[stk[ss]].x<=lstl[i].x;ss--);
pre[i]=lstl[stk[ss]].y;
stk[++ss]=i;
}
lstl[0].y=ym;
stk[ss=0]=0;
for(int i=lsl;i>=1;i--){
if(i<lsl&&lstl[i+1].y==lstl[i].y)continue;
for(;ss&&lstl[stk[ss]].x<=lstl[i].x;ss--);
nxt[i]=lstl[stk[ss]].y;
stk[++ss]=i;
}
int last=0;
for(int i=1;i<=lsl;i++){
if(i<lsl&&lstl[i+1].y==lstl[i].y)continue;
lv[++lvl]=(intv){pre[i],nxt[i],lstl[i].x};
lv[++lvl]=(intv){last,lstl[i].y,0};
last=lstl[i].y;
}
assert(last!=ym);
lv[++lvl]=(intv){last,ym,0};
sort(lv+1,lv+lvl+1);
}
{//right hand side
lstr[0].y=0;
stk[ss=0]=0;
for(int i=1;i<=lsr;i++){
if(i>1&&lstr[i-1].y==lstr[i].y)continue;
for(;ss&&lstr[stk[ss]].x>=lstr[i].x;ss--);
pre[i]=lstr[stk[ss]].y;
stk[++ss]=i;
}
lstr[0].y=ym;
stk[ss=0]=0;
for(int i=lsr;i>=1;i--){
if(i>1&&lstr[i-1].y==lstr[i].y)continue;
for(;ss&&lstr[stk[ss]].x>=lstr[i].x;ss--);
nxt[i]=lstr[stk[ss]].y;
stk[++ss]=i;
}
int last=0;
for(int i=1;i<=lsr;i++){
if(i>1&&lstr[i-1].y==lstr[i].y)continue;
rv[++lvr]=(intv){pre[i],nxt[i],lstr[i].x};
rv[++lvr]=(intv){last,lstr[i].y,xm};
last=lstr[i].y;
}
assert(last!=ym);
rv[++lvr]=(intv){last,ym,xm};
sort(rv+1,rv+lvr+1);
}
work2();
swap(lv,rv),swap(lvl,lvr);
for(int i=1;i<=lvl;i++){
lv[i].x=xm-lv[i].x;
}
for(int i=1;i<=lvr;i++){
rv[i].x=xm-rv[i].x;
}
work2();
}
int main(){
xm=ni,ym=ni,n=ni;
for(int i=1;i<=n;i++){
pt[i]=(Pt){ni,ni};
if(pt[i].x==0||pt[i].x==xm||pt[i].y==0||pt[i].y==ym){
--i,--n;
}
}
work();
swap(xm,ym);
for(int i=1;i<=n;i++){
swap(pt[i].x,pt[i].y);
}
work();
printf("%d\n",ans<<1);
return 0;
}
|
5de359e5ace611c0b4102e72edba4e577a3b22d1 | 325d0ecf79bec8e3d630c26195da689ea5bb567e | /nimbro/cv/classificator/classificator.cpp | 48c8629d52f9a096d0a3013d66e8d1b5294ffd47 | [] | no_license | nvtienanh/Hitechlab_humanoid | ccaac64885967334f41a161f1684ff3a1571ab0f | 34c899f70af7390b9fbdb1a1ad03faf864a550be | refs/heads/master | 2020-04-22T10:34:21.944422 | 2016-08-28T06:02:00 | 2016-08-28T06:02:00 | 66,521,772 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,540 | cpp | classificator.cpp | // Color classificator
// Author: Max Schwarz <Max@x-quadraht.de>
#include "classificator.h"
#include <pluginlib/class_list_macros.h>
#include <sensor_msgs/image_encodings.h>
#include <boost/make_shared.hpp>
PLUGINLIB_DECLARE_CLASS(openplatform, classificator, Classificator, nodelet::Nodelet)
Classificator::Classificator()
{
}
Classificator::~Classificator()
{
}
void Classificator::onInit()
{
ros::NodeHandle& nh = getNodeHandle();
m_sub_input = nh.subscribe("image", 1, &Classificator::processImage, this);
m_pub_output = nh.advertise<sensor_msgs::Image>("classes", 10);
m_srv_process = getPrivateNodeHandle().advertiseService("processImage", &Classificator::srvProcessImage, this);
m_srv_updateLUT = getPrivateNodeHandle().advertiseService("updateLUT", &Classificator::srvUpdateLUT, this);
}
uint8_t Classificator::getClass(uint8_t y, uint8_t u, uint8_t v)
{
if(!m_lut)
return 255;
int c = m_lut->lut[256*u + v];
if(c == 255)
return c;
const calibration::ColorSpec& spec = m_lut->colors[c];
if(y < spec.minY || y > spec.maxY)
return 255;
return c;
}
void Classificator::processImage(const sensor_msgs::Image::Ptr& img)
{
sensor_msgs::Image::Ptr output = boost::make_shared<sensor_msgs::Image>();
doProcessImage(*img, &*output);
m_pub_output.publish(output);
}
void Classificator::doProcessImage(const sensor_msgs::Image& img, sensor_msgs::Image* output)
{
output->encoding = "classes";
output->data.resize(img.width*img.height);
output->width = img.width;
output->height = img.height;
output->step = img.width;
const uint8_t* line = &img.data[0];
uint8_t* dline = &output->data[0];
for(size_t y = 0; y < img.height; ++y)
{
const uint8_t* base = line;
uint8_t* dbase = dline;
for(size_t x = 0; x < img.width-1; x += 2)
{
uint8_t y1 = base[0];
uint8_t u = base[1];
uint8_t y2 = base[2];
uint8_t v = base[3];
dbase[0] = getClass(y1, u, v);
dbase[1] = getClass(y2, u, v);
base += 4;
dbase += 2;
}
line += img.step;
dline += output->step;
}
output->header.frame_id="base_link";
output->header.stamp = img.header.stamp;
}
bool Classificator::srvUpdateLUT(
calibration::UpdateLUTRequest& req,
calibration::UpdateLUTResponse& response)
{
NODELET_INFO("Got new color LUT");
m_lut = boost::make_shared<calibration::CalibrationLUT>(req.lut);
return true;
}
bool Classificator::srvProcessImage(
calibration::ClassifyImageRequest& req,
calibration::ClassifyImageResponse& response)
{
doProcessImage(req.input, &response.output);
return true;
}
|
ce34d2a7255c2eb6ddfb60b70b453a68ec580edf | 7e3de4703d2d444360a200615c1f14f8f6580e12 | /week2/surfacearea.cpp | 553dad634b2497b2ca13a9ab4906e18e0853286b | [] | no_license | AnthonyValverde/CS-10-Labs | 837ec3fa50eeec1c237a30429a6c9a18f9f30571 | 78e8b99c9cde3cdb353ae9b0c093c8ea760bfa79 | refs/heads/master | 2020-03-28T08:27:06.562784 | 2018-09-08T20:26:06 | 2018-09-08T20:26:06 | 147,966,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 251 | cpp | surfacearea.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
double r = 0.0;
double z = 0.0;
double area = 0.0;
cin >> r >> z;
area = (4 * z * (r * r));
cout << "Area is: " << area << endl;
return 0;
} |
b160e7aa102085b5bde0507e444d931028215506 | 391be069a8c90fe380e772a8ef174fe44a91e8b6 | /Codeforces/A. Case of the Zeros and Ones.cpp | 569869c9a9b10116dfeb66865fa36b9dc60f22d6 | [] | no_license | NahiyanNashrah/ProblemSolving | 6605e4f9382f8fdd8c82856f3161a1ceef2cf3f0 | 8f2498f0a019ffae15c958ed8e4c7a43108bb5f1 | refs/heads/master | 2020-04-27T07:59:13.596924 | 2019-04-02T07:58:49 | 2019-04-02T07:58:49 | 174,155,304 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 450 | cpp | A. Case of the Zeros and Ones.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int stringLength,a=0,b=0;
cin>>stringLength;
string s;
cin>>s;
int length=s.size();
for(int i=0;i<length;i++)
{
if(s[i]=='0')
a++;
else if(s[i]=='1')
b++;
}
if(a==b)
cout<<"0"<<endl;
else if(a>b)
cout<<length-(b*2)<<endl;
else
cout<<length-(a*2)<<endl;
}
|
7c22b9f621b34f7796995e1a4aa6cab92cdbf5e3 | 80e08512a69b537313e1350508797ed8ae6138c9 | /include/nbdl/send_upstream_message.hpp | b5db1615631972866b6968c43976cf9584d41de9 | [
"BSL-1.0"
] | permissive | jonajonlee/nbdl | 960f41fe3295fe0ecbc3f030561e4d1cf5f64c82 | c1e025dc67a9ffbcac1b112b0be50fdc987064e8 | refs/heads/master | 2021-01-11T16:13:59.578895 | 2017-01-01T05:47:49 | 2017-01-01T05:47:49 | 80,044,090 | 0 | 0 | null | 2017-01-25T18:30:54 | 2017-01-25T18:30:54 | null | UTF-8 | C++ | false | false | 1,265 | hpp | send_upstream_message.hpp | //
// Copyright Jason Rice 2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NBDL_SEND_UPSTREAM_MESSAGE_HPP
#define NBDL_SEND_UPSTREAM_MESSAGE_HPP
#include<nbdl/concept/Provider.hpp>
#include<nbdl/concept/UpstreamMessage.hpp>
#include<nbdl/fwd/send_upstream_message.hpp>
#include<boost/hana/core/tag_of.hpp>
#include<boost/hana/core/when.hpp>
namespace nbdl
{
template<typename Provider, typename Message>
constexpr auto send_upstream_message_fn::operator()(Provider&& p, Message&& m) const
{
using Tag = hana::tag_of_t<Provider>;
using Impl = send_upstream_message_impl<Tag>;
static_assert(nbdl::Provider<Provider>::value,
"nbdl::send_upstream_message(p, m) requires 'p' to be a Provider");
static_assert(nbdl::UpstreamMessage<Message>::value,
"nbdl::send_upstream_message(p, m) requires 'm' to be an UpstreamMessage");
return Impl::apply(std::forward<Provider>(p), std::forward<Message>(m));
};
template<typename Tag, bool condition>
struct send_upstream_message_impl<Tag, hana::when<condition>>
: hana::default_
{
static constexpr auto apply(...) = delete;
};
} // nbdl
#endif
|
d95930491e8e137bd170323215fe8c6307369886 | 2daddb84467ec2ddc6db463441b9919e9cf63c26 | /tools/driver-tool/util.posix.hpp | cda6c76ff803f786c241dab8061379232f8205b8 | [
"LicenseRef-scancode-us-govt-public-domain",
"LicenseRef-scancode-ncbi",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | dcroote/sra-tools | 8789d2a05725ffcd47c05329fb1456e121f01e6c | 1307a46c0337359e2fea385ccb536a34c06dd3c7 | refs/heads/master | 2022-08-20T07:34:23.325487 | 2020-05-22T15:14:11 | 2020-05-22T15:14:11 | 268,007,253 | 0 | 0 | NOASSERTION | 2020-05-30T04:13:11 | 2020-05-30T04:13:11 | null | UTF-8 | C++ | false | false | 2,831 | hpp | util.posix.hpp | /* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#pragma once
#include <string>
#include <map>
#include <unistd.h>
static inline std::error_code error_code_from_errno()
{
return std::error_code(errno, std::system_category());
}
static inline bool pathExists(std::string const &path) {
return access(path.c_str(), F_OK) == 0;
}
class EnvironmentVariables {
public:
class Value : public std::string {
bool notSet;
public:
Value(std::string const &value) : std::string(value), notSet(false) {}
Value() : notSet(true) {}
operator bool() const { return !notSet; }
bool operator !() const { return notSet; }
};
using Set = std::map<std::string, Value>;
static Value get(std::string const &name) {
auto const value = getenv(name.c_str());
if (value)
return Value(std::string(value));
return Value();
}
static void set(std::string const &name, Value const &value) {
if (value)
setenv(name.c_str(), value.c_str(), 1);
else
unsetenv(name.c_str());
}
static Set set_with_restore(std::map<std::string, std::string> const &vars) {
auto result = Set();
for (auto && v : vars) {
result[v.first] = get(v.first);
set(v.first, v.second.empty() ? Value() : v.second);
}
return result;
}
static void restore(Set const &save) {
for (auto && v : save) {
set(v.first, v.second);
}
}
static char const *impersonate() {
return getenv("SRATOOLS_IMPERSONATE");
}
};
|
17540396efb43952f1fc5bc0186de6abb45fb515 | ef0d517eb6b95e188aa88569e4d9c8274130a5fe | /main.cpp | ba1392d1cb60355aca372f1a6577446033e32afa | [] | no_license | acoopman/IMU | aadcd8a68397ef743f4bf05e528dcee3de68ec5a | 878d1b8131d45dfb6e9e4fe03b8fa44fafa33280 | refs/heads/master | 2020-09-23T07:56:20.189028 | 2019-12-08T19:05:26 | 2019-12-08T19:05:26 | 225,446,067 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,687 | cpp | main.cpp | //$ ip address
// gcc raw_out.cpp -lm
//./a.out 5555
// This example was modified from TCP/IP Sockets in C: Practical Guide
// for Programmers by Michael J Donahoo
#include <stdio.h> /* for printf() and fprintf() */
#include <stdlib.h> /* for atoi() and exit() */
#include <string.h> /* for memset() */
#include <math.h>
#include "socket.h"
#include "cv.h"
#include "highgui.h"
#include "cvplot.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include "packet.h"
#include <opencv2/plot.hpp>
using namespace cv;
using namespace std;
int sock; /* Socket -- GLOBAL for signal handler */
struct sockaddr_in echoServAddr; /* Server address */
unsigned short echoServPort; /* Server port */
struct sigaction handler; /* Signal handling action definition */
#define ECHOMAX 255 /* Longest string to echo */
char echoBuffer[ECHOMAX]; /* Datagram buffer */
// volatile keyword is a qualifier that is applied to a variable when it is declared.
// It tells the compiler that the value of the variable may change at any time--without a
// ny action being taken by the code the compiler finds nearby.
volatile int packet_count;
int main(int argc, char *argv[])
{
const int N = 400;
float mag_array[N];
float baseline[N];
float signal[N];
packet_t packets[N];
int previous_packet = 0;
packet_count = 0;
// Test for correct number of parameters
if (argc != 2)
{
fprintf(stderr,"Usage: %s <SERVER PORT>\n", argv[0]);
exit(1);
}
// get the port
echoServPort = atoi(argv[1]);
start_socket();
//initialize it to 0
for(int i = 0; i<N; i++)
{
mag_array[i]=9.81;
baseline[i] = 9.81;
signal[i] = 0;
}
// namedWindow( "ORIENTATION", WINDOW_AUTOSIZE );
// do a continous loop and process the samples
// the packets are read in the background
float baseline_value = 9.81;
for (;;)
{
//if we received a packet, than process it
if( (packet_count > 0) && (packet_count > previous_packet))
{
int packet_idx = packet_count%N;
previous_packet = packet_count;
packet_t* curr_ptr = &packets[packet_idx];
//printf("We receive a packet #%i \n", packet_count);
extract_packet(curr_ptr, echoBuffer);
//print_packet(curr_ptr);
float mag = sqrt((curr_ptr->ax*curr_ptr->ax)+(curr_ptr->ay*curr_ptr->ay)+(curr_ptr->az*curr_ptr->az));
//subtract gravity out
// mag -= 9.81f;
//shift over the array to the left to allow new magnitude value
for(int i =0; i < N-1; i++)
{
mag_array[i] = mag_array[i+1];
baseline[i] = baseline[i+1];
signal[i] = signal[i+1];
}
//put new magnitude value in the array at the end
mag_array[N-1] = mag;
// get a baseline
float p = 0.05;
float q = (1-p);
baseline_value = p*mag + q*baseline_value;
baseline[N-1] = baseline_value;
//set the signal
float signal_value = mag-baseline_value;
signal[N-1] = signal_value;
if(abs(signal_value) > 4)
{
cout << "We have a tap\n";
}
if( (packet_count % 10) == 0)
{
//CvPlot::clear("Magnitude");
//CvPlot::clear("Baseline");
CvPlot::clear("Signal");
//CvPlot::plot_float("Magnitude", mag_array, N, 1, 255, 0, 0); //RGB
//CvPlot::plot_float("Baseline", baseline, N, 1, 0, 0, 255); //RGB
CvPlot::plot_float("Signal", signal, N, 1, 0, 0, 255); //RGB
//CvPlot::PlotManger("Magnitude", baseline, N, 1, 0, 0, 255); //RGB
}
}
} //-----------------------------------------------------
} // main
|
90710b6cfaf1892e55e47a6e292c8038b0f522af | ac9515134822fbd4c40ebb4f14ea0c4a0cbff515 | /lab8/Figure.h | 057d84990ad14e936588cc60c78ca83d93f7e1c2 | [] | no_license | DatGuyDied/OOP | 4d59ff4a8378b8be1aec9ba2897298dcb011b7a3 | dbf9685aea4ffaefba31e7096c77d378dfd36676 | refs/heads/master | 2020-05-02T16:35:23.828579 | 2019-03-28T09:24:48 | 2019-03-28T09:24:48 | 178,073,438 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 761 | h | Figure.h | #ifndef FIGURE_H
#define FIGURE_H
#include <memory>
class Figure
{
public:
virtual size_t Square() = 0;
virtual void Print() = 0;
bool operator==(Figure& other) {
return this->Square() == other.Square();
}
bool operator!=(Figure& other) {
return this->Square() != other.Square();
}
bool operator<(Figure& other) {
return this->Square() < other.Square();
}
bool operator>(Figure& other) {
return this->Square() > other.Square();
}
bool operator<=(Figure& other) {
return this->Square() <= other.Square();
}
bool operator>=(Figure& other) {
return this->Square() >= other.Square();
}
virtual ~Figure() {};
};
#endif // FIGURE_H
|
7a56b9a6a3b9aae702bc06c7bb1a31c66d3b94f4 | 9634db777b2944cdd81f257fe54a8d520a6f5b7e | /CPPStudy/CPPStudy/switch_study.cpp | d67a8ed9268485f0c55a34cfbaf1daabef6c4432 | [] | no_license | hanelso/Programming_Study | 91dc2c0736cd0ccbe8dc989fa8445b873e451346 | d9f52b944964c20675a83b4207c31b4f43fd02e3 | refs/heads/master | 2022-12-12T14:22:07.411922 | 2019-11-01T15:53:51 | 2019-11-01T15:53:51 | 196,607,833 | 0 | 1 | null | 2022-12-11T00:26:08 | 2019-07-12T16:01:22 | Turing | UHC | C++ | false | false | 553 | cpp | switch_study.cpp | #include"main.h"
void test_switch(void)
{
int user_input;
std::cout << "저의 정보를 표시해줍니다." << std::endl;
std::cout << "1. 이름 " << std::endl;
std::cout << "2. 나이 " << std::endl;
std::cout << "3. 성별 " << std::endl;
std::cin >> user_input;
switch (user_input)
{
case 1:
std::cout << "Hanelso ! " << std::endl;
break;
case 2:
std::cout << "99 살 " << std::endl;
break;
case 3:
std::cout << "남자" << std::endl;
break;
default:
std::cout << "궁금한게 없군요~" << std::endl;
break;
}
} |
012596c750c6ffc7bb428632f2fbb992468207c5 | 8c465aa1175899e98881d61712bdad270fdc9ae5 | /explicitly.defaulted.and.deleted.special.member.functions.cpp | 349ac8396ee6d2d39c24f072e0830596067cb47d | [] | no_license | hanziliang/algorithms | 074463f2c5e9a71338b6dc38257129a9e28069bb | 7a77a1068bd441246697fa6cddf99a62e0e154b4 | refs/heads/master | 2021-03-03T02:55:57.709232 | 2019-10-25T09:30:39 | 2019-10-25T09:30:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,294 | cpp | explicitly.defaulted.and.deleted.special.member.functions.cpp | /*
* =====================================================================================
*
* Filename: explicitly.defaulted.and.deleted.special.member.functions.cpp
*
* Description:
*
* Version: 1.0
* Created: 03/21/2019 19:16:12
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include <string>
typedef int OTHERTYPE;
class SomeType
{
SomeType() = default; //The default constructor is explicitly stated.
SomeType(OTHERTYPE value);
};
//Alternatively, certain features can be explicitly disabled. For example, this type is non-copyable:
class TestClass
{
private:
int value = 0;
public:
const char *name;
TestClass() { value = 1; name = "null"; } ;// = default;
// ~TestClass() = delete;
TestClass(const TestClass& t) {
printf("copy constructor is call\n");
value = t.value;
}
TestClass(std::initializer_list<int> l) {
printf("initializer_list constructor is call\n");
this->value = *l.begin();
};
TestClass(TestClass &&t):value(t.value),name(t.name) {
t.name = nullptr;
printf("move constructor is call.\n");
}
TestClass& operator =(const TestClass& t) {
printf("operator = is called\n");
value = t.value;
return *this;
}
void Disaplay() { printf("%s.value = %d\n", name, value); };
TestClass& operator++() // ++x
{
printf("++%s is called\n", name);
++value;
return *this;
}
TestClass operator++(int) // x++
{
printf("%s++ is called\n", name);
TestClass tmp = *this;
char *buff = new char[20];
memset(buff, 0, 20);
sprintf(buff, "%s++.Display()", name);
tmp.name = buff;
value++;
return tmp;
}
};
int main(void) {
// TestClass(std::initializer_list<int> l) {};
printf("----------------------------------------\n");
TestClass *a = new TestClass;
TestClass *b = new TestClass[5];
//TestClass *c = static_cast<TestClass*>(::operator new(sizeof(TestClass)));
// c->TestClass::TestClass();
TestClass x = {2};
printf("----------------------------------------\n");
// placement new, 重复使用已经分配好的内存,
// 避反复的分配, 释放内存, 导致内存碎片化问题
TestClass *c = new(&x) TestClass();
c->name = "c";
c->Disaplay();
printf("actually x.Display() is called, now 'x' and 'c' is pointed to the same address..\n");
x.Disaplay();
printf("----------------------------------------\n");
x.name = "x";
printf("----------------------------------------\n");
TestClass y = x;
y.name = "y";
x.Disaplay();
y.Disaplay();
printf("----------------------------------------\n");
x++.Disaplay();
x.Disaplay();
printf("----------------------------------------\n");
(y = x).Disaplay();
printf("----------------------------------------\n");
(++x).Disaplay();
printf("----------------------------------------\n");
x++.Disaplay();
x.Disaplay();
printf("----------------------------------------\n");
}
|
b74144ff6212f08d1fdecdf5cb94a7168bc07b66 | 13fa42173ec62d63c1155e4362703a1aaf1d0f46 | /addons/ams.cpp | 76ed548e25995487ffcb80e99c8f02c6ababaa25 | [] | no_license | proteanthread/classic99 | 7cd6b339449ad05e37a6da88e26735236ca89e23 | 52d8c7e7cd298e8c865f345820277b96d2b2ea87 | refs/heads/master | 2020-03-15T07:55:11.588289 | 2018-02-17T23:30:33 | 2018-02-17T23:30:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,248 | cpp | ams.cpp | /* Code by Joe Delekto! Thanks Joe! */
/* AMS support for Classic99 */
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <memory.h>
#include <windows.h>
#include "tiemul.h"
#include "ams.h"
// define sizes for memory arrays
static const int MaxMapperPages = 0x1000;
static const int MaxPageSize = 0x1000; // TODO: wait.. this is 16MB, but we only support a maximum of 1MB. Why so much data?
// define sizes for register arrays
static const int MaxMapperRegisters = 0x10;
static EmulationMode emulationMode = None; // Default to no emulation mode
static AmsMemorySize memorySize = Mem128k; // Default to 128k AMS Card
static MapperMode mapperMode = Map; // Default to mapping addresses
static Word mapperRegisters[MaxMapperRegisters] = { 0 };
static Byte systemMemory[MaxMapperPages * MaxPageSize] = { 0 };
Byte staticCPU[0x10000] = { 0 }; // 64k for the base memory
static bool mapperRegistersEnabled = false;
// references into C99
extern bool bWarmBoot;
void InitializeMemorySystem(EmulationMode cardMode)
{
// Classic99 specific debug call
debug_write("Initializing AMS mode %d, size %dk", cardMode, 128*(1<<memorySize));
// 1. Save chosen card mode
emulationMode = cardMode;
// 3. Set up initial register values for pass-through and map modes with default page numbers
for (int reg = 0; reg < MaxMapperRegisters; reg++)
{
// TODO: this is wrong, it should be zeroed, but right now the rest of the
// emulation relies on these values being set. Which probably means that
// the passthrough settings are also wrong. ;)
mapperRegisters[reg] = (reg << 8);
}
if (!bWarmBoot) {
memrnd(systemMemory, sizeof(systemMemory));
memrnd(staticCPU, sizeof(staticCPU));
}
}
void SetAmsMemorySize(AmsMemorySize size)
{
//debug_write("Set AMS size to %d", size);
memorySize = size;
}
EmulationMode MemoryEmulationMode()
{
return emulationMode;
}
void ShutdownMemorySystem()
{
// 3. Set up initial register values for pass-through and map modes with default page numbers
for (int reg = 0; reg < MaxMapperRegisters; reg++)
{
mapperRegisters[reg] = (reg << 8);
}
memrnd(systemMemory, sizeof(systemMemory));
memrnd(staticCPU, sizeof(staticCPU));
}
void SetMemoryMapperMode(MapperMode mode)
{
switch (emulationMode)
{
case Ams:
case Sams:
case Tams:
mapperMode = mode;
//debug_write("Set AMS mapper mode to %d", mode);
break;
case None:
default:
mapperMode = Passthrough;
//debug_write("Set AMS mapper mode to PASSTHROUGH");
}
}
void EnableMapperRegisters(bool enabled)
{
switch (emulationMode)
{
case Ams:
case Sams:
case Tams:
mapperRegistersEnabled = enabled;
//debug_write("AMS Mapper registers active");
break;
case None:
default:
mapperRegistersEnabled = false;
//debug_write("AMS Mapper registers disabled");
}
}
bool MapperRegistersEnabled()
{
return mapperRegistersEnabled;
}
// Only call if mapper registers enabled. Reg must be 0-F
void WriteMapperRegisterByte(Byte reg, Byte value, bool highByte)
{
reg &= 0x0F;
if (mapperRegistersEnabled)
{
switch (emulationMode)
{
case Ams:
case Sams: /* only for now */
case Tams:
if (highByte)
{
mapperRegisters[reg] = ((mapperRegisters[reg] & 0x00FF) | (value << 8));
}
else
{
mapperRegisters[reg] = ((mapperRegisters[reg] & 0xFF00) | value);
}
debug_write("AMS Register %X now >%04X", reg, mapperRegisters[reg]);
break;
case None:
// fallthrough
default:
break;
}
}
}
// Only call if mapper registers enabled. Reg must be 0-F
Byte ReadMapperRegisterByte(Byte reg, bool highByte)
{
reg &= 0x0F;
if (mapperRegistersEnabled)
{
switch (emulationMode)
{
case Ams:
case Sams:
case Tams:
if (highByte)
{
return (Byte)((mapperRegisters[reg] & 0xFF00) >> 8);
}
return (Byte)(mapperRegisters[reg] & 0x00FF);
case None:
break;
default:
break;
}
}
// If registers not enabled or not emulating, just return what's at the register address
//debug_write("Reading disabled AMS registers!");
Word address = ((0x4000 + (reg << 1)) + (highByte ? 0 : 1));
return ReadMemoryByte(address);
}
Byte ReadMemoryByte(Word address, bool bTrueAccess)
{
DWord wMask = 0x0000FF00; // TODO: set for appropriate memory size
DWord pageBase = ((DWord)address & 0x00000FFF);
DWord pageOffset = ((DWord)address & 0x0000F000) >> 12;
DWord pageExtension = pageOffset;
bool bIsMapMode = (mapperMode == Map);
bool bIsRAM = (!ROMMAP[address]) && (((pageOffset >= 0x2) && (pageOffset <= 0x3)) || ((pageOffset >= 0xA) && (pageOffset <= 0xF)));
bool bIsMappable = (((pageOffset >= 0x2) && (pageOffset <= 0x3)) || ((pageOffset >= 0xA) && (pageOffset <= 0xF)));
#if 0
// little hack to dump AMS memory for making loader files
// we do a quick RLE to save some memory. Step debugger in
// to execute this code
if (0) {
FILE *fp=fopen("C:\\amsdump.rle", "wb");
int nRun=0;
for (int i=0; i<MaxMapperPages * MaxPageSize; i++) {
if (systemMemory[i] == 0) {
nRun++;
if (nRun == 255) {
fputc(0, fp);
fputc(nRun, fp);
nRun=0;
}
} else {
if (nRun > 0) {
fputc(0, fp);
fputc(nRun, fp);
nRun=0;
}
fputc(systemMemory[i], fp);
}
}
fclose(fp);
}
#endif
if (bIsMapMode && bIsMappable)
{
pageExtension = (DWord)((mapperRegisters[pageOffset] & wMask) >> 8);
}
DWord mappedAddress = (pageExtension << 12) | pageBase;
if (bIsRAM || bIsMappable)
{
return systemMemory[mappedAddress];
}
// this only works with the console RAM, not the AMS RAM
if ((g_bCheckUninit) && (bTrueAccess) && (0 == CPUMemInited[mappedAddress]) && (0 == ROMMAP[mappedAddress])) {
TriggerBreakPoint();
char buf[128];
sprintf(buf, "Breakpoint - reading uninitialized CPU memory at >%04X", mappedAddress);
MessageBox(myWnd, buf, "Classic99 Debugger", MB_OK);
}
return staticCPU[mappedAddress];
}
// allowWrite = do the write, even if it is ROM! Otherwise only if it is RAM.
void WriteMemoryByte(Word address, Byte value, bool allowWrite)
{
DWord wMask = 0x0000FF00; // TODO: set for appropriate memory size
DWord pageBase = ((DWord)address & 0x00000FFF);
DWord pageOffset = ((DWord)address & 0x0000F000) >> 12;
DWord pageExtension = pageOffset;
bool bIsMapMode = (mapperMode == Map);
bool bIsRAM = (((pageOffset >= 0x2) && (pageOffset <= 0x3)) || ((pageOffset >= 0xA) && (pageOffset <= 0xF)));
bool bIsMappable = (((pageOffset >= 0x2) && (pageOffset <= 0x3)) || ((pageOffset >= 0xA) && (pageOffset <= 0xF)));
if (bIsMapMode && bIsMappable)
{
pageExtension = (DWord)((mapperRegisters[pageOffset] & wMask) >> 8);
}
DWord mappedAddress = (pageExtension << 12) | pageBase;
if (bIsMapMode && bIsMappable)
{
systemMemory[mappedAddress] = value;
}
else
{
if (bIsRAM || bIsMappable)
{
CPUMemInited[mappedAddress&0xffff] = 1;
systemMemory[mappedAddress] = value;
}
else if (allowWrite || (!ROMMAP[mappedAddress]))
{
CPUMemInited[mappedAddress] = 1;
staticCPU[mappedAddress] = value;
}
}
}
Byte* ReadMemoryBlock(Word address, void* vData, Word length)
{
Byte* data = (Byte*)vData;
for (Word memIndex = 0; memIndex < length; memIndex++)
{
*(data + memIndex) = ReadMemoryByte((address + memIndex) & 0xFFFF);
}
return data;
}
Byte* WriteMemoryBlock(Word address, void* vData, Word length)
{
Byte* data = (Byte*)vData;
for (Word memIndex = 0; memIndex < length; memIndex++)
{
WriteMemoryByte((address + memIndex) & 0xFFFF, *(data + memIndex), true);
}
return data;
}
void RestoreAMS(unsigned char *pData, int nLen) {
// little hack to restore AMS memory for automatic loader files
// we do a quick RLE to save some memory. This is meant only for
// use by the built-in cartridge loader.
int i=0;
while ((nLen>0) && (i < MaxMapperPages * MaxPageSize)) {
if (*pData == 0) {
if (nLen < 2) {
warn("RLE decode error.");
systemMemory[i++]=0;
return;
}
pData++;
for (int nRun=0; nRun<*pData; nRun++) {
systemMemory[i++]=0;
if (i >= MaxMapperPages * MaxPageSize) {
warn("RLE exceeded AMS memory size.");
return;
}
}
nLen-=2;
} else {
systemMemory[i++]=*pData;
nLen--;
}
pData++;
}
} |
4479272c2a244be23a5841eb54d6c6c1283251dd | f953e2c4405582a804c85ebd5e8a97236ba679ed | /Chapter4/Chapter4_02_E/MyConstants.h | a8150c4247831062429186c8f8abb91899d2525a | [] | no_license | Knabin/TBCppStudy | 384710f935e43bb617d07579f6cadae54732fd8e | ec7c322a035ff8c013c505bf8c64a851e66168fe | refs/heads/master | 2023-04-26T05:35:14.259977 | 2021-06-05T12:56:10 | 2021-06-05T12:56:10 | 254,893,482 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 168 | h | MyConstants.h | #pragma once
// 헤더파일에서는 선언만, 초기화는 MyConstants.cpp에
namespace Constants
{
extern const double pi;
extern const double gravity;
// ...
} |
b05a8d623b041168c6d11ddacb4f8db9b0ee9e8c | 71fb4c240a8448f907840a56278e01fd2e3c2c9b | /Build/GameFrameworkTest/ReferencedObjectTest.cpp | 8505fcea5082b1e4d106bb7208966bc5ca359601 | [] | no_license | wertrain/windows-game-framework | ea5b5b789f07b57203e1307db1d8c0ed2666455b | 9a87704a37b2d164c9b396522fab60e3f5b44361 | refs/heads/master | 2021-06-14T03:49:23.185065 | 2019-08-25T01:35:41 | 2019-08-25T01:35:57 | 103,960,031 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,809 | cpp | ReferencedObjectTest.cpp | #include "stdafx.h"
#include "CppUnitTest.h"
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <nnfw/core/ReferencedObject.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace GameFrameworkTest
{
///
/// 参照オブジェクトのテスト
///
class TestReferencedObject : public fw::sys::ReferencedObject
{
public:
int DoSomething()
{
return 0;
}
};
TEST_CLASS(ReferencedObjectTest)
{
public:
TEST_METHOD(ReferencedObjectTestBasic)
{
// メモリリーク検出テスト
// @see http://puarts.com/?pid=1156
_CrtMemState mem_state_before, mem_state_after, mem_state_diff;
_CrtMemCheckpoint(&mem_state_before);
TestReferencedObject* obj = new TestReferencedObject();
Assert::IsTrue(obj->GetRef() == 1);
{
TestReferencedObject obj2 = *obj;
obj2.DoSomething();
Assert::IsTrue(obj->GetRef() == 2);
TestReferencedObject obj3 = *obj;
obj3.DoSomething();
Assert::IsTrue(obj->GetRef() == 3);
}
Assert::IsTrue(obj->GetRef() == 1);
{
TestReferencedObject obj3 = *obj;
obj3.DoSomething();
}
if (obj->Release() == 0)
{
delete obj;
}
_CrtMemCheckpoint(&mem_state_after);
if (_CrtMemDifference(&mem_state_diff, &mem_state_before, &mem_state_after))
{
_CrtMemDumpStatistics(&mem_state_diff);
Assert::Fail(L"メモリリークが検出されました");
}
}
};
}
|
db965af47dc663aa4f9018bd134d9f7d481e085c | 7e378161bafd53637911fee5891c826d3244d84e | /StringProcessing/StringAlignment(EditDistance)/UV_164_StringComputer.cpp | 11db0c9ebeb1afdb758030327e1a8c8fcec7469b | [] | no_license | vadel/SWERC17 | 29ac21eb00717832b14524c7c73d317de691403f | ffe75d129236edefe45e96ae701a419b6e8fe075 | refs/heads/master | 2021-09-01T15:50:40.558322 | 2017-12-27T20:22:59 | 2017-12-27T20:22:59 | 111,313,997 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,722 | cpp | UV_164_StringComputer.cpp | /*
* Created on: Dec 28, 2016
* Author: jon
*
*
* ACCEPTED!!! :D -- Runtime: 0.03
*/
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <queue>
#include <stack>
using namespace std;
int main(){
string A;
string B;
int N; //length of A
int M; //length of B
int SA[25][25]; //Table to calculate String Alignment
int op1;
int op2;
int op3;
cin >> A;
while(A!="#"){
cin >> B;
N = A.size();
M = B.size();
//Fill String Alignment table
memset(SA, 0, sizeof(SA)); //initialize table with 0
//base case 1
SA[0][0] = 0;
//base case 2 (length of B==0)
for(int k=1; k<N+1; k++){
SA[k][0] = SA[k-1][0]-1;
}
//base case 3 (length of A==0)
for(int k=1; k<M+1; k++){
SA[0][k] = SA[0][k-1]-1;
}
//Recurrences
for(int k=1; k<N+1; k++){
for(int l=1; l<M+1; l++){
//option 1 - consider both
op1 = SA[k-1][l-1];
if(A[k-1]==B[l-1]) op1 = op1 + 2; //if match
else op1 = op1 - 1; //if mismatch
//option 2 - delete A[i]
op2 = SA[k-1][l] - 1;
//option 3 - insert B[j]
op3 = SA[k][l-1] - 1;
SA[k][l] = max(op1,max(op2,op3));
}
}
//Reconstruct the solution
int i=N;
int j=M;
string prog = "E";
string lag = "";
while(i!=0 and j!=0){
lag = "";
if(SA[i][j]==SA[i-1][j-1]+2 and A[i-1]==B[j-1]){ //dejar como esta (copy)
i--;
j--;
continue;
}
else if(SA[i][j]==SA[i-1][j-1]-1){ //change
lag = "C";
lag += B[j-1];
if(j<10){
lag += "0";
lag += to_string(j);
}
else{
lag += to_string(j);
}
i--;
j--;
}
else if(SA[i][j]==SA[i-1][j]-1){ //delete
lag = "D";
lag += A[i-1];
if(j+1<10){
lag += "0";
lag += to_string(j+1);
}
else{
lag += to_string(j+1);
}
i--;
}
else if(SA[i][j]==SA[i][j-1]-1){//insert
lag = "I";
lag += B[j-1];
if(j<10){
lag += "0";
lag += to_string(j);
}
else{
lag += to_string(j);
}
j--;
}
prog = lag + prog;
}
//delete the rest
while(i>0){
lag = "D";
lag += A[i-1];
if(j+1<10){
lag += "0";
lag += to_string(j+1);
}
else{
lag += to_string(j+1);
}
prog = lag + prog;
i--;
}
//insert the rest
while(j>0){
lag = "I";
lag += B[j-1];
if(j<10){
lag += "0";
lag += to_string(j);
}
else{
lag += to_string(j);
}
prog = lag + prog;
j--;
}
cout << prog << endl;
//printf("Optimum alignment %d\n", SA[N][M]);
cin >> A;
}
return 0;
}
|
3f8cfcaf9f5f9c7e09383f95f2c92c7a0a3a3f68 | fc934b588a6ffa043b18682397658ae69e093eb7 | /player.cpp | 3b1c63057d3f288fb52924e03b4e210256c31a3d | [] | no_license | Kyle44/Blackjack | fef7f8f1edc57a88e13d00fa3fda37347351ee80 | 197c1d70aaf35b5b48cd65c786eee3e6a4017b76 | refs/heads/master | 2020-03-28T18:10:38.107168 | 2018-09-14T00:13:59 | 2018-09-14T00:13:59 | 148,858,319 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 423 | cpp | player.cpp | #include "player.h"
Player::Player()
:m_flag(true)
{
}
Player::Player(string name)
{
m_name = name;
}
void Player::hit(){
m_myHand.hit();
handDetails();
}
void Player::getName(){
cout << "This player is named " << m_name << "." << endl;
}
int Player::getHandValue(){
return m_myHand.getTotal();
}
void Player::handDetails(){
m_myHand.getCardsInHand();
m_myHand.getTotalValue();
} |
f4a7ef5ad5747661f4eb02d612553463a22faf94 | 4e38faaa2dc1d03375010fd90ad1d24322ed60a7 | /include/RED4ext/Scripting/Natives/Generated/anim/DangleConstraint_SimulationSpring.hpp | 8fc31b652d554578218649fd3c6c8862b4051108 | [
"MIT"
] | permissive | WopsS/RED4ext.SDK | 0a1caef8a4f957417ce8fb2fdbd821d24b3b9255 | 3a41c61f6d6f050545ab62681fb72f1efd276536 | refs/heads/master | 2023-08-31T08:21:07.310498 | 2023-08-18T20:51:18 | 2023-08-18T20:51:18 | 324,193,986 | 68 | 25 | MIT | 2023-08-18T20:51:20 | 2020-12-24T16:17:20 | C++ | UTF-8 | C++ | false | false | 1,677 | hpp | DangleConstraint_SimulationSpring.hpp | #pragma once
// clang-format off
// This file is generated from the Game's Reflection data
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/Vector2.hpp>
#include <RED4ext/Scripting/Natives/Generated/Vector3.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/DangleConstraint_SimulationSingleBone.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/SpringProjectionType.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/VectorLink.hpp>
namespace RED4ext
{
namespace anim
{
struct DangleConstraint_SimulationSpring : anim::DangleConstraint_SimulationSingleBone
{
static constexpr const char* NAME = "animDangleConstraint_SimulationSpring";
static constexpr const char* ALIAS = NAME;
float simulationFps; // 90
float constraintSphereRadius; // 94
float constraintScale1; // 98
float constraintScale2; // 9C
Vector2 constraintOrientation; // A0
float mass; // A8
float gravityWS; // AC
float damping; // B0
float pullForceFactor; // B4
Vector3 pullForceOriginLS; // B8
Vector3 externalForceWS; // C4
anim::VectorLink externalForceWsLink; // D0
anim::SpringProjectionType projectionType; // F0
float collisionSphereRadius; // F4
float cosOfHalfXAngle; // F8
float cosOfHalfYAngle; // FC
float sinOfHalfXAngle; // 100
float sinOfHalfYAngle; // 104
float invertedMass; // 108
uint8_t unk10C[0x170 - 0x10C]; // 10C
};
RED4EXT_ASSERT_SIZE(DangleConstraint_SimulationSpring, 0x170);
} // namespace anim
using animDangleConstraint_SimulationSpring = anim::DangleConstraint_SimulationSpring;
} // namespace RED4ext
// clang-format on
|
3466e47fcc1829d9fea3cc9dde1077fbcda53e24 | 6c5c683e7578c897be80fa2453e688098d9d66a6 | /task 3 (2).cpp | 28267a67e6109fa17fdf444f4ded15177af6b609 | [] | no_license | alihaasan133/oop | 5329d90b3c22684b3c4b088cb2ca8a76189ca1f0 | 1628f6fe7c1eb2584e0f6f52bdb4abd06d9dd720 | refs/heads/master | 2020-04-01T18:12:18.775230 | 2018-10-17T15:38:40 | 2018-10-17T15:38:40 | 153,465,282 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 155 | cpp | task 3 (2).cpp | #include<iostream>
using namespace std;
int main()
{
for(int i=1;i<=4;i++)
{
for(int x=1;x<=i;x++)
{
cout<<x;
}
cout<<endl;
}
}
|
40bce5544ce3ae4204ad07450d1b78bba4d7fe7a | 50aa0135ee792892095a7e7abe6bea593e95cb14 | /Mainserver.cpp | 8aacb9c5baa513fab15b7410c30e39e3526453d9 | [] | no_license | yuntanghsu/Socket-Programming | dc8b181a71ab49f9f177e261b3127ab20e7e66b6 | f36cc6e4ab64b2099e6b76fee9ba62d690b21f10 | refs/heads/main | 2023-02-22T01:59:48.681242 | 2021-01-25T05:44:53 | 2021-01-25T05:44:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,903 | cpp | Mainserver.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <map>
#include <set>
#include <string>
#define A_UDP_PORT "30126"
#define B_UDP_PORT "31126"
#define MAIN_UDP_PORT "32126"
#define MAIN_TCP_PORT "33126"
#define HOST "localhost"
#define BACKLOG 10
using namespace std;
void sigchld_handler(int s) {
// waitpid() might overwrite errno, so we save and restore it:
int saved_errno = errno;
while(waitpid(-1, NULL, WNOHANG) > 0);
errno = saved_errno;
}
// get sockaddr, IPv4 or IPv6 --- From Beej
void *get_in_addr(struct sockaddr *sa) {
if (sa->sa_family == AF_INET) {
return &(((struct sockaddr_in*)sa)->sin_addr);
}
return &(((struct sockaddr_in6*)sa)->sin6_addr);
}
void list_country(set<string>, set<string>);
int main(){
// Setup UDP structure -- From Beej
int udp_sockfd;
struct addrinfo udp_hints, *udp_servinfo, *udp_p;
int udp_rv;
memset(&udp_hints, 0, sizeof udp_hints);
udp_hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6
udp_hints.ai_socktype = SOCK_DGRAM;
udp_hints.ai_flags = AI_PASSIVE; // use my IP address
if ((udp_rv = getaddrinfo(HOST, MAIN_UDP_PORT, &udp_hints, &udp_servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s€n", gai_strerror(udp_rv));
exit(1);
}
// loop through all the results and bind to the first we can -- From Beej
for(udp_p = udp_servinfo; udp_p != NULL; udp_p = udp_p->ai_next) {
if ((udp_sockfd = socket(udp_p->ai_family, udp_p->ai_socktype,
udp_p->ai_protocol)) == -1) {
perror("ServerA UDP socket");
continue;
}
if (bind(udp_sockfd, udp_p->ai_addr, udp_p->ai_addrlen) == -1) {
close(udp_sockfd);
perror("ServerA bind");
continue;
}
break; // if we get here, we must have connected successfully
}
if (udp_p == NULL) {
// looped off the end of the list with no successful bind
fprintf(stderr, "failed to bind socket€n");
exit(2);
}
// setup tcp -- From Beej
int tcp_sockfd, new_fd; // listen on sock_fd, new connection on new_fd
struct addrinfo tcp_hints, *tcp_servinfo, *tcp_p;
struct sockaddr_storage their_addr; // connector's address information
socklen_t sin_size;
struct sigaction sa;
int yes=1;
char s[INET6_ADDRSTRLEN];
int tcp_rv;
memset(&tcp_hints, 0, sizeof tcp_hints);
tcp_hints.ai_family = AF_UNSPEC;
tcp_hints.ai_socktype = SOCK_STREAM;
tcp_hints.ai_flags = AI_PASSIVE; // use my IP
if ((tcp_rv = getaddrinfo(HOST, MAIN_TCP_PORT, &tcp_hints, &tcp_servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(tcp_rv));
return 1;
}
// loop through all the results and bind to the first we can
for(tcp_p = tcp_servinfo; tcp_p != NULL; tcp_p = tcp_p->ai_next) {
if ((tcp_sockfd = socket(tcp_p->ai_family, tcp_p->ai_socktype,
tcp_p->ai_protocol)) == -1) {
perror("server: socket");
continue;
}
if (setsockopt(tcp_sockfd, SOL_SOCKET, SO_REUSEADDR, &yes,
sizeof(int)) == -1) {
perror("setsockopt");
exit(1);
}
if (bind(tcp_sockfd, tcp_p->ai_addr, tcp_p->ai_addrlen) == -1) {
close(tcp_sockfd);
perror("server: bind");
continue;
}
break;
}
freeaddrinfo(tcp_servinfo); // all done with this structure
if (tcp_p == NULL) {
fprintf(stderr, "server: failed to bind\n");
exit(1);
}
if (listen(tcp_sockfd, BACKLOG) == -1) {
perror("listen");
exit(1);
}
sa.sa_handler = sigchld_handler; // reap all dead processes
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) == -1) {
perror("sigaction");
exit(1);
}
cout << "The Main server is up and running." << endl;
map<int, set<string>> countryMap;
struct sockaddr_in servaddr;
socklen_t fromlen;
memset((char*)&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
char bufA[1024];
servaddr.sin_port = htons(atoi(A_UDP_PORT));
// send the message to server A to ask the country list.
if (sendto(udp_sockfd, bufA, sizeof bufA, 0, (struct sockaddr*)&servaddr, sizeof servaddr) == -1) {
perror("Main sednto ServerA");
exit(1);
}
fromlen = sizeof servaddr;
if (recvfrom(udp_sockfd, bufA, sizeof bufA, 0, (struct sockaddr*)&servaddr, &fromlen) == -1) {
perror("Main receive from Server A");
exit(1);
}
char *tokens;
tokens = strtok(bufA, " ");
set<string> setA;
while(tokens != NULL){
setA.insert(string(tokens));
tokens = strtok(NULL, " ");
}
countryMap[0] = setA;
printf("The Main server has received the country list from server A using UDP over port<%s>\n", MAIN_UDP_PORT);
servaddr.sin_port = htons(atoi(B_UDP_PORT));
char bufB[1024];
// send the message to server B to ask the country list.
if (sendto(udp_sockfd, bufB, sizeof bufB, 0, (struct sockaddr*)&servaddr, sizeof servaddr) == -1) {
perror("Main sednto Server B");
exit(1);
}
fromlen = sizeof servaddr;
if (recvfrom(udp_sockfd, bufB, sizeof bufB, 0, (struct sockaddr*)&servaddr, &fromlen) == -1) {
perror("Main receive from Server B");
exit(1);
}
tokens = strtok(bufB, " ");
set<string> setB;
while(tokens != NULL){
setB.insert(string(tokens));
tokens = strtok(NULL, " ");
}
countryMap[1] = setB;
printf("The Main server has received the country list from server B using UDP over port<%s>\n", MAIN_UDP_PORT);
list_country(setA, setB);
// keep receiving the queries from the clients and sending the message to server A/B, the receicing the result from server A/B and send it back
// to the clients.
while(1){
sin_size = sizeof their_addr;
new_fd = accept(tcp_sockfd, (struct sockaddr *)&their_addr, &sin_size);
if (new_fd == -1) {
perror("accept");
continue;
}
inet_ntop(their_addr.ss_family,get_in_addr((struct sockaddr *)&their_addr),s, sizeof s);
// use fork to create child process in order to have multiple connections.
if(!fork()){
char buf[1024];
close(tcp_sockfd); // child doesn't need the listener
if (recv(new_fd, buf, sizeof buf, 0) == -1){
perror("send");
exit(1);
}
string user_id;
string country;
string result;
user_id = string(strtok(buf, " "));
country = string(strtok(NULL, " "));
printf("The Main server has received the request on User<%s> in <%s> from the client using TCP over port <%s>\n", user_id.c_str(), country.c_str(), MAIN_TCP_PORT);
if(setA.find(country) == setA.end() && setB.find(country) == setB.end()){
printf("<%s> does not show up in server A&B\n", country.c_str());
printf("The Main Server has sent \"Country Name: Not found\" to the client using TCP over port<%s>\n", MAIN_TCP_PORT);
result = "-1 -1";
}else{
printf("<%s> shows up in server A/B\n", country.c_str());
printf("The Main Server has sent request from User<%s> to server A/B using UDP over port <%s>\n", user_id.c_str(), MAIN_UDP_PORT);
memset((char*)&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
if(setA.find(country) != setA.end()){
servaddr.sin_port = htons(atoi(A_UDP_PORT));
}else{
servaddr.sin_port = htons(atoi(B_UDP_PORT));
}
string query = user_id + " " + country;
if ((sendto(udp_sockfd, query.c_str(), strlen(query.c_str()) + 1, 0, (struct sockaddr*)&servaddr, sizeof servaddr)) == -1) {
perror("Main sednto Server A/B");
exit(1);
}
char response[1024];
fromlen = sizeof servaddr;
if (recvfrom(udp_sockfd, response, sizeof response, 0, (struct sockaddr*)&servaddr, &fromlen) == -1) {
perror("Main receive from Server A/B");
exit(1);
}
int friends = atoi(strtok(response, " "));
if(friends == -2){
if(setA.find(country) != setA.end()){
printf("The Main server has received \"User ID: Not found\" from server A\n");
}else {
printf("The Main server has received \"User ID: Not found\" from server B\n");
}
printf("The Main Server has sent error to client using TCP over port <%s>\n", MAIN_TCP_PORT);
result = "-2 -2";
}else{
if(setA.find(country) != setA.end()){
printf("The Main server has received searching result(s) of User<%s> from server A\n", user_id.c_str());
}else{
printf("The Main server has received searching result(s) of User<%s> from server B\n", user_id.c_str());
}
printf("The Main Server has sent searching result(s) to client using TCP over port <%s>\n", MAIN_TCP_PORT);
if(friends == -3){
result = "-3 None";
} else{
result = "0 " + to_string(friends);
}
}
}
if(send(new_fd, result.c_str(), strlen(result.c_str()) + 1, 0) == -1){
perror("send");
}
close(new_fd);
exit(0);
}
close(new_fd); // parent doesn't need this }
}
return 0;
}
// function the used to print the country list in server A and B.
void list_country(set<string> A, set<string> B){
set<string>::iterator itA = A.begin();
set<string>::iterator itB = B.begin();
cout << "Server A | Server B " << endl;
while(itA != A.end() || itB != B.end()){
string ap = "";
string bp = "";
if(itA != A.end()){
ap = *itA;
itA++;
}
if(itB != B.end()){
bp = *itB;
itB++;
}
printf("%-18s| %s\n", ap.c_str(), bp.c_str());
}
}
|
1b00ebe5827a2959e104e021477d9a65af51f16f | af1c32dad69f4568dfd8d0f9de745a8c0cb9f823 | /source.h | 379ab9906aedf10bf8362224054e5336abd0b881 | [
"MIT"
] | permissive | SpintroniK/aal | 8b49ded2e1e78176e52175ba84cac81f1c6b8b11 | 0c78694a4a6aa69f590b8620890e964d5076bba5 | refs/heads/master | 2021-08-08T06:56:15.735190 | 2017-11-09T20:14:50 | 2017-11-09T20:14:50 | 109,739,453 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,809 | h | source.h | /*
* Source.h
*
* Created on: 21 Oct 2017
* Author: jeremy
*/
#ifndef SOURCE_H_
#define SOURCE_H_
#include "effect.h"
#include <string>
#include <vector>
#include <atomic>
#include <algorithm>
namespace aal
{
class device;
class voice;
class source
{
friend class device;
friend class voice;
public:
source() : index{0}, playing{true}, is_loop{false} {}
virtual ~source()
{
// Delete all the effects
std::for_each(effects.begin(), effects.end(), [](auto e) { delete e; });
}
virtual const short* get_chunk(size_t& length) const noexcept
{
const auto data_length = data.size();
auto old_index = index.fetch_add(length, std::memory_order_release);
// Truncate if length is greater than the buffer's size
if(old_index + length >= data_length)
{
length = data_length - old_index;
if(is_loop.load(std::memory_order_acquire))
{
index.store(0, std::memory_order_release);
}
else
{
index.store(length, std::memory_order_release);
playing.store(false, std::memory_order_release);
}
}
return &data[old_index];
}
virtual bool is_playing() const noexcept { return playing.load(std::memory_order_acquire); }
virtual bool is_circular() const noexcept { return is_loop.load(std::memory_order_acquire); }
virtual void add_effect(effect* e) { effects.push_back(e); }
protected:
virtual void play() noexcept
{
index.store(0, std::memory_order_release);
playing.store(true, std::memory_order_release);
}
virtual void stop() noexcept { playing.store(false, std::memory_order_release);}
mutable std::atomic<size_t> index;
mutable std::atomic<bool> playing;
std::atomic<bool> is_loop;
std::vector<short> data;
std::vector<effect*> effects;
};
}
#endif /* SOURCE_H_ */
|
e2d3b11ad9f429ec09aab88445331b15c8143ad9 | 0926ce7b4ab7b18968e5d3ec2dce2afa14e286e2 | /Libraries/open-powerplant/PowerPlantX/SysWrappers/Events/SysAEDesc.cp | 8d7079d0a0f7da9abd3b4c355975c7badc99162f | [
"Apache-2.0"
] | permissive | quanah/mulberry-main | dd4557a8c1fe3bc79bb76a2720278b2332c7d0ae | 02581ac16f849c8d89e6a22cb97b07b7b5e7185a | refs/heads/master | 2020-06-18T08:48:01.653513 | 2019-07-11T01:59:15 | 2019-07-11T01:59:15 | 196,239,708 | 1 | 0 | null | 2019-07-10T16:26:52 | 2019-07-10T16:26:51 | null | WINDOWS-1252 | C++ | false | false | 8,323 | cp | SysAEDesc.cp | // Copyright ©2005, 2006 Freescale Semiconductor, Inc.
// Please see the License for the specific language governing rights and
// limitations under the License.
// ===========================================================================
// SysAEDesc.cp
//
// Copyright © 2003-2005 Metrowerks Corporation. All rights reserved.
//
// $Date: 2006/01/18 01:37:33 $
// $Revision: 1.1.1.1 $
// ===========================================================================
#include <SysAEDesc.h>
namespace PPx {
// ---------------------------------------------------------------------------
// AutoAEDesc
/**
Default constructor */
AutoAEDesc::AutoAEDesc()
{
::AEInitializeDesc(&mAEDesc);
mIsOwner = true;
}
// ---------------------------------------------------------------------------
// AutoAEDesc
/**
Constructs from an existing AEDsc. Caller retains ownership of the AEDesc.
@param inDesc AEDesc to use */
AutoAEDesc::AutoAEDesc(
const AEDesc& inDesc)
{
mIsOwner = false;
mAEDesc = inDesc;
}
// ---------------------------------------------------------------------------
// AutoAEDesc
/**
Copy constructor. Object being copied transfers its ownership rights for
the AEDesc to this object. That is, if inOther was the owner, this
object becomes the owner. If inOther was not the owner, this object
is not the owner either. */
AutoAEDesc::AutoAEDesc(
const AutoAEDesc& inOther)
{
mIsOwner = inOther.mIsOwner;
mAEDesc = inOther.Release();
}
// ---------------------------------------------------------------------------
// AutoAEDesc
/**
Constructs an AEDesc with a particular DescType and data
@param inType DescType to use for the AEDesc
@param inData Pointer to the data for the AEDesc
@param inSize Byte count of the data for the AEDesc */
AutoAEDesc::AutoAEDesc(
DescType inType,
const void* inData,
SInt32 inSize)
{
::AEInitializeDesc(&mAEDesc);
mIsOwner = true;
OSErr err = ::AECreateDesc(inType, inData, inSize, &mAEDesc);
PPx_ThrowIfOSError_(err, "AECreateDesc failed");
}
// ---------------------------------------------------------------------------
// ~AutoAEDesc
/**
Destructor */
AutoAEDesc::~AutoAEDesc()
{
DisposeDesc();
}
// ---------------------------------------------------------------------------
// operator =
/**
Assignment operator. Object being copied transfers its ownership rights
for the AEDesc to this object. That is, if inOther was the owner, this
object becomes the owner. If inOther was not the owner, this object
does not become the owner. */
AutoAEDesc&
AutoAEDesc::operator = (
const AutoAEDesc& inOther)
{
if (&inOther != this) {
DisposeDesc();
mIsOwner = inOther.mIsOwner;
mAEDesc = inOther.mAEDesc;
}
return *this;
}
// ---------------------------------------------------------------------------
// Release
/**
Releases ownership of the AEDesc. If this object was the owner of the
AEDesc, caller becomes the new owner of the AEDesc.
@return AEDesc used by this object */
AEDesc
AutoAEDesc::Release() const
{
mIsOwner = false;
return mAEDesc;
}
// ---------------------------------------------------------------------------
// Reset
/**
Resets this object by disposing its AEDesc and initializing it to
a null descriptor */
void
AutoAEDesc::Reset()
{
DisposeDesc();
::AEInitializeDesc(&mAEDesc);
}
// ---------------------------------------------------------------------------
// Reset
/**
Resets AEDesc of this object to the input one, disposing of its
current AEDesc Caller retains ownership of the AEDesc.
@param inDesc AEDesc to use */
void
AutoAEDesc::Reset(
const AEDesc& inDesc)
{
if (mAEDesc.dataHandle != inDesc.dataHandle) {
DisposeDesc();
mAEDesc = inDesc;
mIsOwner = false;
}
}
// ---------------------------------------------------------------------------
// Adopt
/**
Takes ownership of an AEDesc. Disposes of its current AEDesc.
@param inDesc AEDesc to adopt */
void
AutoAEDesc::Adopt(
AEDesc& inDesc)
{
if (mAEDesc.dataHandle != inDesc.dataHandle) {
DisposeDesc();
mAEDesc = inDesc;
mIsOwner = true;
}
}
// ---------------------------------------------------------------------------
// IsOwner
/**
Returns whether this object owns its AEDesc
@return Whether this object owns its AEDesc */
bool
AutoAEDesc::IsOwner() const
{
return mIsOwner;
}
// ---------------------------------------------------------------------------
// DisposeDesc
void
AutoAEDesc::DisposeDesc()
{
if (mIsOwner and (mAEDesc.dataHandle != nil)) {
::AEDisposeDesc(&mAEDesc);
}
}
// ---------------------------------------------------------------------------
// GetCount
/**
Returns the number of items contained by its AEDesc
@return Number of items contained by its AEDesc */
SInt32
AutoAEDesc::GetCount() const
{
SInt32 count;
OSErr err = ::AECountItems(&mAEDesc, &count);
PPx_ThrowIfOSError_(err, "AECountItems failed");
return count;
}
// ---------------------------------------------------------------------------
// GetNthDesc
/**
Returns a copy of a contained descriptor referred to by index number
@param inIndex Index of descriptor to get
@param inDesiredType Desired type for descriptor
@return AutuAEDesc for the indexed descriptor */
AutoAEDesc
AutoAEDesc::GetNthDesc(
SInt32 inIndex,
DescType inDesiredType) const
{
AEKeyword theKeyword;
return GetNthDesc(inIndex, inDesiredType, theKeyword);
}
// ---------------------------------------------------------------------------
// GetNthDesc
/**
Returns a copy of a contained descriptor referred to by index
number and passes back its keywork name
@param inIndex Index of descriptor to get
@param inDesiredType Desired type for descriptor
@param outKeyword Keyword name for the indexed descriptor
@return AutuAEDesc for the indexed descriptor */
AutoAEDesc
AutoAEDesc::GetNthDesc(
SInt32 inIndex,
DescType inDesiredType,
AEKeyword& outKeyword) const
{
AEDesc resultDesc;
OSErr err = ::AEGetNthDesc( &mAEDesc, inIndex, inDesiredType,
&outKeyword, &resultDesc );
PPx_ThrowIfOSError_(err, "AEGetNthDesc failed");
return AutoAEDesc(resultDesc);
}
// ---------------------------------------------------------------------------
// GetRequiredParamDesc
/**
Gets a required descriptor parameter referred to by keywork name
@param inKeyword Keyword name for parameter
@param inDesiredType Desired type for descriptor
@return AutuAEDesc for the keyword named descriptor
Throws an exception it fails to get the parameter */
AutoAEDesc
AutoAEDesc::GetRequiredParamDesc(
AEKeyword inKeyword,
DescType inDesiredType) const
{
AEDesc resultDesc;
OSErr err = ::AEGetParamDesc( &mAEDesc, inKeyword, inDesiredType,
&resultDesc );
PPx_ThrowIfOSError_(err, "AEGetParamDesc failed");
return AutoAEDesc(resultDesc);
}
// ---------------------------------------------------------------------------
// GetOptionalParamDesc
/**
Gets an optional descriptor parameter referred to by keywork name
@param inKeyword Keyword name for parameter
@param inDesiredType Desired type for descriptor
@return AutuAEDesc for the keyword named descriptor
Returned AEDesc is a null descriptor if the parameter does not exist */
AutoAEDesc
AutoAEDesc::GetOptionalParamDesc(
AEKeyword inKeyword,
DescType inDesiredType) const
{
AEDesc resultDesc;
::AEInitializeDesc(&resultDesc);
OSErr err = ::AEGetParamDesc( &mAEDesc, inKeyword, inDesiredType,
&resultDesc );
return AutoAEDesc(resultDesc);
}
// ---------------------------------------------------------------------------
// GetAttributeDesc
/**
Gets the descriptor for a keyword named attribute
@param inKeyword Keyword name for attribute
@param inDesiredType Desired type for descriptor
@return AutuAEDesc for the keyword named attribute
Throws an exception it fails to get the attribute */
AutoAEDesc
AutoAEDesc::GetAttributeDesc(
AEKeyword inKeyword,
DescType inDesiredType) const
{
AEDesc resultDesc;
OSErr err = ::AEGetAttributeDesc( &mAEDesc, inKeyword, inDesiredType,
&resultDesc );
PPx_ThrowIfOSError_(err, "AEGetAttributeDesc failed");
return AutoAEDesc(resultDesc);
}
} // namespace PPx
|
091a6561e0a66d9f5e04a82dd98ecd958da8e289 | 4f6ae8fa65be671ac4796400f0eda40a9c772b24 | /recognition/Auxiliar.cpp | 5d904276864241a32f0ce9185bc9b1388d0c5184 | [] | no_license | marcelosf/visualmidi | daaa4679cc22ea9b6c871d0c1e104250602ab787 | 7c5e2702cd23e461b98e256877ac4d3878cced91 | refs/heads/main | 2023-04-03T18:25:55.205648 | 2021-03-27T00:37:34 | 2021-03-27T00:37:34 | 351,940,890 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,836 | cpp | Auxiliar.cpp | #include "StdAfx.h"
#include "Auxiliar.h"
Auxiliar::Auxiliar(void)
{
}
Auxiliar::~Auxiliar(void)
{
}
void Auxiliar::mostraImagem(char* nome,IplImage* imagem)
{
cvNamedWindow(nome,1);
cvShowImage(nome,imagem);
//cvReleaseImage(&imagem);
}
void Auxiliar::mostraLinhas( IplImage* imagem, CvSeq* linhas )
{
int tamanho_linha = 150;
for( int i = 0; i < MIN(linhas->total,tamanho_linha); i++ )
{
float* line = (float*)cvGetSeqElem(linhas,i);
float rho = line[0];
float theta = line[1];
CvPoint pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = a*rho, y0 = b*rho;
pt1.x = cvRound(x0 + 10000*(-b));
pt1.y = cvRound(y0 + 1000*(a));
pt2.x = cvRound(x0 - 10000*(-b));
pt2.y = cvRound(y0 - (a));
cvLine(imagem, pt1, pt2, CV_RGB(0,255,0),1, 8 );//desenha as linhas detectadas na imagem.
this->mostraImagem("Linhas", imagem);
printf("Valor de Y = %u\n",pt1.y);
}
}
void Auxiliar::testaSeq()
{
CvMemStorage* memoriaNotas = cvCreateMemStorage(0);
CvSeq* notas = cvCreateSeq(CV_SEQ_ELTYPE_GENERIC,sizeof(CvSeq),sizeof(CvPoint3D32f),memoriaNotas);
CvPoint3D32f nota1 = cvPoint3D32f(50,2,4);
CvPoint3D32f nota2 = cvPoint3D32f(200,4,5);
CvPoint3D32f nota3 = cvPoint3D32f(10,0,3);
cvSeqPush(notas, ¬a1);
cvSeqPush(notas, ¬a2);
cvSeqPush(notas, ¬a3);
for( int i=0; i<notas->total; i++ ){
CvPoint3D32f* aux = (CvPoint3D32f*)cvGetSeqElem(notas,i);
printf( "x = %f nota = %f intervalo = %f\n", aux->x, aux->y, aux->z );
}
// cvSeqSort(notas, criterioPontos,0);
printf( "\n ================================================\n " );
for( int i=0; i<notas->total; i++ ){
CvPoint3D32f* aux = (CvPoint3D32f*)cvGetSeqElem(notas,i);
printf( "x = %f nota = %f intervalo = %f\n", aux->x, aux->y, aux->z );
}
}
|
f442cad28534d0f22e718b0f3f1668cc24abd4de | 9596a7d9ab534702e9a03677e308f46ea60eb516 | /Kinect-2/udp_subscriber.cpp | 212f90f525186c65bc9b601a5febe1b3276d9182 | [] | no_license | TGRHavoc/kinect-track-ir | ce0e2e4ac7d0484e8fce4f3043e5e9881479cb10 | 0a075cbbb121d61c60202a0dda853f42f80ed183 | refs/heads/master | 2020-04-10T05:06:10.211740 | 2018-12-07T12:52:18 | 2018-12-07T13:19:08 | 160,817,638 | 1 | 0 | null | 2018-12-07T11:54:59 | 2018-12-07T11:54:59 | null | UTF-8 | C++ | false | false | 1,244 | cpp | udp_subscriber.cpp | #include "udp_subscriber.h"
#include <iostream>
#include <winsock2.h>
#include <WS2tcpip.h>
#include <tchar.h>
#include <sys/types.h>
#include <stdio.h>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iterator>
#include <iomanip>
#pragma comment(lib, "Ws2_32.lib")
udp_subscriber::udp_subscriber(int port)
{
this->sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
this->serv.sin_family = AF_INET;
this->serv.sin_port = htons(port);
InetPton(this->serv.sin_family, _T("127.0.0.1"), &this->serv.sin_addr.s_addr);
int result = connect(this->sockfd, (struct sockaddr*)&this->serv, sizeof(this->serv));
__yal_log(__YAL_DBG, "Connected? %i\n", result);
}
udp_subscriber::~udp_subscriber()
{
closesocket(this->sockfd);
}
void udp_subscriber::callback(normalized_head_data hd)
{
//rot.axis[i], pos.axis[i]
normalized_rot_t rot = hd.get_rot();
normalized_pos_t pos = hd.get_pos();
double p[6] = { pos.axis[0], pos.axis[1], pos.axis[2], rot.axis[0], rot.axis[1], rot.axis[2] };
int result = sendto(this->sockfd, (char*)&p[0], sizeof(p), 0, (const struct sockaddr *)&this->serv, sizeof(this->serv));
__yal_log(__YAL_DBG, "Sending (%i)\n", result);
}
|
2d5059274440ab5e557fc5eac0b74f8303b372d9 | b32e518e38c87ce0d1f1eda1c7947ee77661f291 | /src/transfo.cpp | 952a9cd11d2602136b9bf88be440c87de02e9cd5 | [] | no_license | Blizarre/aff3D | 0e945dffd59f2e1ece491158585e44cae3264036 | cc6f3b0761af6c40fe6854325c474c18477a98c7 | refs/heads/master | 2022-02-13T09:50:40.768140 | 2022-01-23T12:16:19 | 2022-01-23T12:16:19 | 2,275,163 | 2 | 0 | null | 2018-05-28T10:46:18 | 2011-08-26T16:27:36 | C++ | UTF-8 | C++ | false | false | 3,214 | cpp | transfo.cpp | #include "transfo.h"
#include "math.h"
void Transformation::translate(const float delta[3]) {
m_matrix[3] +=
m_matrix[0] * delta[0] + m_matrix[1] * delta[1] + m_matrix[2] * delta[2];
m_matrix[7] +=
m_matrix[4] * delta[0] + m_matrix[5] * delta[1] + m_matrix[6] * delta[2];
m_matrix[11] +=
m_matrix[8] * delta[0] + m_matrix[9] * delta[1] + m_matrix[10] * delta[2];
}
void Transformation::translate(const std::array<float, 3> &delta) {
translate(delta.data());
}
/**
* 1 0 0
* 0 cosT -sinT
* 0 sinT cosT
* */
void Transformation::rotationX(const float rot) {
float a, b, cosR, sinR;
cosR = cos(rot);
sinR = sin(rot);
a = m_matrix[1];
b = m_matrix[2];
m_matrix[1] = a * cosR - b * sinR;
m_matrix[2] = a * sinR + b * cosR;
a = m_matrix[5];
b = m_matrix[6];
m_matrix[5] = a * cosR - b * sinR;
m_matrix[6] = a * sinR + b * cosR;
a = m_matrix[9];
b = m_matrix[10];
m_matrix[9] = a * cosR - b * sinR;
m_matrix[10] = a * sinR + b * cosR;
}
/**
* cosT 0 sinT
* 0 1 0
* -sinT 0 cosT
* TODO: may be broken, check it
* */
void Transformation::rotationY(const float rot) {
float a, b, cosR, sinR;
cosR = cos(rot);
sinR = sin(rot);
a = m_matrix[0];
b = m_matrix[2];
m_matrix[0] = a * cosR + b * sinR;
m_matrix[2] = -a * sinR + b * cosR;
a = m_matrix[4];
b = m_matrix[6];
m_matrix[4] = a * cosR + b * sinR;
m_matrix[6] = -a * sinR + b * cosR;
a = m_matrix[8];
b = m_matrix[10];
m_matrix[8] = a * cosR - b * sinR;
m_matrix[10] = -a * sinR + b * cosR;
}
/**
* cosT -sinT 0
* sinT cosT 0
* 0 0 1
* */
void Transformation::rotationZ(const float rot) {
float a, b, cosR, sinR;
cosR = static_cast<float>(cos(rot));
sinR = static_cast<float>(sin(rot));
a = m_matrix[0];
b = m_matrix[1];
m_matrix[0] = a * cosR - b * sinR;
m_matrix[1] = a * sinR + b * cosR;
a = m_matrix[4];
b = m_matrix[5];
m_matrix[4] = a * cosR - b * sinR;
m_matrix[5] = a * sinR + b * cosR;
a = m_matrix[8];
b = m_matrix[9];
m_matrix[8] = a * cosR - b * sinR;
m_matrix[9] = a * sinR + b * cosR;
}
Vertex Transformation::applyTo(const Vertex &v) const {
float nx, ny, nz;
nx = v.x * m_matrix[0] + v.y * m_matrix[1] + v.z * m_matrix[2] + m_matrix[3];
ny = v.x * m_matrix[4] + v.y * m_matrix[5] + v.z * m_matrix[6] + m_matrix[7];
nz =
v.x * m_matrix[8] + v.y * m_matrix[9] + v.z * m_matrix[10] + m_matrix[11];
return Vertex(nx, ny, nz);
}
// For normals we must ignore w
Normal Transformation::applyTo(const Normal &n) const {
float nx, ny, nz;
nx = n.x * m_matrix[0] + n.y * m_matrix[1] + n.z * m_matrix[2];
ny = n.x * m_matrix[4] + n.y * m_matrix[5] + n.z * m_matrix[6];
nz = n.x * m_matrix[8] + n.y * m_matrix[9] + n.z * m_matrix[10];
return Normal{nx, ny, nz};
}
void Transformation::applyTo(const Vertex &vIn, Vertex &vOut) const {
vOut.x = vIn.x * m_matrix[0] + vIn.y * m_matrix[1] + vIn.z * m_matrix[2] +
m_matrix[3];
vOut.y = vIn.x * m_matrix[4] + vIn.y * m_matrix[5] + vIn.z * m_matrix[6] +
m_matrix[7];
vOut.z = vIn.x * m_matrix[8] + vIn.y * m_matrix[9] + vIn.z * m_matrix[10] +
m_matrix[11];
}
|
19ee76eb23c2b34b5d1a9d9686e27341a1dfe448 | c53d25b27b443ad7a2d367d91321d041ba1095b6 | /URAL/1654_Cipher Message/1654.cc | 87f9d64ed468fe5e31829362e1e8bac22633452a | [
"MIT"
] | permissive | hangim/ACM | 52323c5e890549e91b17e94ca5f69125e7dc6faf | 956b3d03a5d3f070ef24c940b7459f5cccb11d6c | refs/heads/master | 2021-01-19T13:52:22.072249 | 2015-09-28T12:31:11 | 2015-09-28T12:31:11 | 19,826,325 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 420 | cc | 1654.cc | // std=c++11
#include <iostream>
#include <string>
#include <deque>
using namespace std;
int main() {
string str;
cin >> str;
deque<char> q;
for (char i : str) {
if (not q.empty() and q.back() == i)
q.pop_back();
else
q.push_back(i);
}
while (not q.empty()) {
cout << q.front();
q.pop_front();
}
cout << endl;
return 0;
}
|
7be791b9d3f5bee6ac0258504a6479a955dc39de | d679d9a4725d1d9482936b21a6645a2c9b789036 | /BowObject.h | c7e55e6203c5ab8cb7354689c7203457dd5b0b5d | [] | no_license | mcosmina06/TEMA1-EGC | 26bf34b0c5310664f4aeb603665d87599399ea43 | 019752e8c3f74c5cda5fd87e3a4b65843525e21b | refs/heads/main | 2023-03-18T12:39:01.849418 | 2021-03-12T11:02:54 | 2021-03-12T11:02:54 | 347,031,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 264 | h | BowObject.h | #pragma once
#include "GameObjects.h"
class BowObject : public GameObjects
{
public:
BowObject(float posX, float posY, float scaleX, float scaleY);
~BowObject();
float posX;
float posY;
float scaleX;
float scaleY;
void foo() {
}
};
|
8e0b35c7454d3a5dbaf2c4a14f5a2e60abca263a | ef2899cf618467439ef8063a5311b11c5df159fe | /project_1/src/Program.cpp | 3239204f580c43433fd9cf3c1c7051a210d37007 | [
"MIT"
] | permissive | guilherme1guy/FGA-FSE-2020-2 | 68e2926dfc015bf34eb8a1ee124e744a9e8f6934 | fab86170f10348391b96efe43a359b41ad03a07f | refs/heads/master | 2023-04-24T00:55:17.695620 | 2021-05-18T22:12:20 | 2021-05-18T22:13:07 | 343,207,499 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,469 | cpp | Program.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <thread>
#include <ncurses.h>
#include "Program.hpp"
#include "Logger.h"
#include "TemperatureController.hpp"
using namespace std;
Program::Program()
{
this->temperature_controller = new TemperatureController();
}
Program::~Program()
{
// TODO: call method to safely stop temperature_controller
delete temperature_controller;
}
void Program::draw_logs()
{
auto lines = Logger::get_log_lines();
for (const auto& line : lines)
{
printw(line.c_str());
}
}
void Program::draw_information()
{
printw(
"IT %.2f ET %.2f RT %.2f PID %.2f\n",
this->temperature_controller->get_internal_temperature(),
this->temperature_controller->get_external_temperature(),
this->temperature_controller->get_reference_temperature(),
this->temperature_controller->get_temperature_adjustment());
}
void Program::draw_division()
{
printw("-------------------------------\n");
}
void Program::menu()
{
initscr();
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
nonl();
cbreak();
echo();
if (has_colors())
{
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_CYAN, COLOR_BLACK);
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
}
bool temperature_set = false;
string temperature_chars;
for (;;)
{
clear();
move(1, 1);
//draw_logs();
draw_division();
draw_information();
draw_division();
int c = getch(); /* refresh, accept single keystroke of input */
if (temperature_set)
{
printw("Input desired temperature. A negative value will set it to sensor mode.\n");
printw("Press ENTER when done.\n");
printw("> %s", temperature_chars.c_str());
if (c == '\n' || c == 13) // 13 is carriage return char
{
try
{
float temperature = stof(temperature_chars);
if (temperature > 100)
temperature = 100.0;
this->temperature_controller->set_reference_temperature(temperature);
temperature_chars = "";
temperature_set = false;
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
temperature_chars = "";
}
}
else if (c != -1)
{
temperature_chars += c;
}
}
else
{
printw("Commands: q - Exit // s - Set Reference Temperature\n");
printw("> ");
if (c == 'q')
{
break;
}
else if (c == 's')
{
temperature_set = true;
}
}
refresh();
this_thread::sleep_for(chrono::milliseconds(50));
}
}
void Program::run()
{
this->temperature_controller->start();
menu();
}
void Program::quit()
{
this->temperature_controller->end();
Logger::end_logger();
endwin();
} |
c3a27c4ee4775988f0663a4dcdf6bd917228eff5 | ad822f849322c5dcad78d609f28259031a96c98e | /SDK/PrinterControlPanel_classes.h | e984cdcfad6e9bbfaedc818e4e431d589c73fb83 | [] | no_license | zH4x-SDK/zAstroneer-SDK | 1cdc9c51b60be619202c0258a0dd66bf96898ac4 | 35047f506eaef251a161792fcd2ddd24fe446050 | refs/heads/main | 2023-07-24T08:20:55.346698 | 2021-08-27T13:33:33 | 2021-08-27T13:33:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,409 | h | PrinterControlPanel_classes.h | #pragma once
// Name: Astroneer-SDK, Version: 1.0.0
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass PrinterControlPanel.PrinterControlPanel_C
// 0x00C4 (0x053C - 0x0478)
class APrinterControlPanel_C : public AControlPanel
{
public:
struct FPointerToUberGraphFrame UberGraphFrame; // 0x0478(0x0008) (Transient, DuplicateTransient)
class USceneComponent* TooltipAnchor; // 0x0480(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UTooltipComponent* PrintButtonCover_Tooltip; // 0x0488(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UTooltipComponent* PrintButton_Tooltip; // 0x0490(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USceneComponent* PrintButton_TooltipAnchor; // 0x0498(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UTooltipComponent* ToolTip; // 0x04A0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UWidgetComponent* PrimaryScreen; // 0x04A8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USceneComponent* CrackedOrientation; // 0x04B0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UBoxComponent* BigButtonCoverCollision; // 0x04B8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UBoxComponent* BigButtonCollision; // 0x04C0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCapsuleComponent* RightButtonCollision; // 0x04C8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCapsuleComponent* LeftButtonCollision; // 0x04D0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UPrinterComponent* ControlledPrinterComponent; // 0x04D8(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
class UBreadboardPrinterComponent* ControlledBreadboardPrinterComponent; // 0x04E0(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
bool LeftButtonDown; // 0x04E8(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool RightButtonDown; // 0x04E9(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool LeftButtonHover; // 0x04EA(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool RightButtonHover; // 0x04EB(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool ButtonCoverOpen; // 0x04EC(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool ButtonCoverHover; // 0x04ED(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
bool BigButtonHover; // 0x04EE(0x0001) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
unsigned char UnknownData00[0x1]; // 0x04EF(0x0001) MISSED OFFSET
class UMaterialInstanceDynamic* ButtonsAndIconsMID; // 0x04F0(0x0008) (Edit, BlueprintVisible, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData)
int BigScreenLightBitIndex; // 0x04F8(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int SmallScreenLightBitIndex; // 0x04FC(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int SmallLightBitIndex; // 0x0500(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int ButtonLightBitIndex; // 0x0504(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int ButtonIconSlotIndex; // 0x0508(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int PowerOnIconSlotIndex; // 0x050C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int PowerOffIconSlotIndex; // 0x0510(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int ButtonConfirmIconIndex; // 0x0514(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int PowerOnIconIndex; // 0x0518(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int PowerOffIconIndex; // 0x051C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
class UAnimMontage* ButtonPressMontage; // 0x0520(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int ButtonCancelIconIndex; // 0x0528(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
unsigned char UnknownData01[0x4]; // 0x052C(0x0004) MISSED OFFSET
class UPowerComponent* ControlledPowerComponent; // 0x0530(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
int ButtonUnpoweredIconIndex; // 0x0538(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass PrinterControlPanel.PrinterControlPanel_C");
return ptr;
}
void SetupControlledReferences(class UPrinterComponent* ControlledPrinterComponent, class UBreadboardPrinterComponent* ControlledBreadboardPrinterComponent, class UPowerComponent* ControlledPowerComponent);
void OnPrinterStateChangedInternal();
void GetButtonIconIndex(int* IconIndex);
void UpdateScreenInfo();
void SetScreenVisibility(bool Visible);
void CanPrinterPrint(bool* CanPrint);
void IsPrinterPrinting(bool* IsPrinting);
void PressBigButton();
bool OnCancelBP(class APlayerController* Controller);
bool OnConfirmBP(class APlayerController* Controller);
void UpdateLights();
void UserConstructionScript();
void OnNavigateLeftBP(class APlayerController* Controller);
void OnControlledActorSet();
void OnNavigateRightBP(class APlayerController* Controller);
void ReleaseRightButton();
void ReleaseLeftButton();
void BndEvt__LeftButtonCollision_K2Node_ComponentBoundEvent_0_ComponentBeginCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__RightButtonCollision_K2Node_ComponentBoundEvent_1_ComponentBeginCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCoverCollision_K2Node_ComponentBoundEvent_5_ComponentBeginCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCoverCollision_K2Node_ComponentBoundEvent_7_ComponentOnClickedSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent, const struct FKey& ButtonPressed);
void BndEvt__CrackableActorComponent_K2Node_ComponentBoundEvent_8_OnCrackedStateChanged__DelegateSignature(class UCrackableActorComponent* CrackableActorComponent, bool bIsCracked);
void BndEvt__LeftButtonCollision_K2Node_ComponentBoundEvent_0_ComponentEndCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__RightButtonCollision_K2Node_ComponentBoundEvent_1_ComponentEndCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCoverCollision_K2Node_ComponentBoundEvent_3_ComponentEndCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCollision_K2Node_ComponentBoundEvent_4_ComponentBeginCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCollision_K2Node_ComponentBoundEvent_5_ComponentEndCursorOverSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent);
void BndEvt__BigButtonCollision_K2Node_ComponentBoundEvent_6_ComponentOnClickedSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent, const struct FKey& ButtonPressed);
void ReceiveBeginPlay();
void OnPanelMontageEnded(class UAnimMontage* Montage, bool bInterrupted);
void OnPrinterStateChanged();
void ServerStartOrCancelPrint();
void OnPrinterPowerAvailableChanged(bool HasAvailablePower);
void OnControlledActorUseStateChanged(bool IsUsable);
void BndEvt__SkeletalMesh_K2Node_ComponentBoundEvent_0_ComponentOnClickedSignature__DelegateSignature(class UPrimitiveComponent* TouchedComponent, const struct FKey& ButtonPressed);
void ExecuteUbergraph_PrinterControlPanel(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
78cbf4f3093fd9e0f6eaa21af9518548421ca22f | cf2c2c10737001eadcfa9b04df8052a208d0f035 | /GSPN/ECS-Measures.solution/SD_RemoteMonitoring_Refactored.cc | ffea1c5b893fb62d58745741928039b4a9013429 | [] | no_license | SEALABQualityGroup/JASA | 44fef0a5fc00943c1d38186cc20c4a7fbf575ca4 | fbf272ccf3af75b82a8a82dc514e721f4857f25f | refs/heads/master | 2022-04-18T22:15:42.877668 | 2020-04-17T10:56:13 | 2020-04-17T10:56:13 | 198,239,686 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | cc | SD_RemoteMonitoring_Refactored.cc | 1 15
1 45
1 56
1 66
1 70
1 74
1 78
1 89
1 10
1 11
1 25
1 13
1 14
1 18
1 16
1 17
1 33
1 19
1 20
2 21 22
1 23
1 24
3 9 12 15
3 9 12 15
1 26
1 27
1 28
1 29
1 30
1 31
1 32
3 9 12 15
2 34 48
1 35
3 36 43 81
1 37
3 38 39 42
3 9 12 15
1 41
1 39
1 40
0
3 9 12 15
1 46
2 44 54
1 2
1 62
1 49
1 50
1 51
3 49 52 53
2 44 47
2 55 58
2 34 64
1 57
2 63 64
1 3
0
1 61
1 62
1 55
2 34 55
1 60
1 59
1 67
4 65 69 73 77
1 4
0
1 71
4 65 69 73 77
1 5
0
1 75
4 65 69 73 77
1 6
0
1 79
5 65 69 73 77 92
1 7
0
1 82
1 83
1 84
1 85
3 83 86 87
2 77 80
2 88 91
1 90
2 88 92
1 8
0
1 93
1 94
3 36 43 92
|
58365357e6d1b554f778d95c8b622eb8abad2e76 | 8a9b4a2dcf8896618216bd0216be6c63e54b94be | /Array/Sequential Digits/By String Iteration.cpp | 2b24ad33480e1e26f8572ecf1d2f33ac255585b0 | [
"MIT"
] | permissive | Ajay2521/Competitive-Programming | 1353719239e02d410e3d1fb9b111dbd109435193 | 65a15fe04216fe058abd05c6538a8d30a78a37d3 | refs/heads/main | 2023-07-06T11:56:31.771072 | 2021-08-05T06:10:18 | 2021-08-05T06:10:18 | 382,769,546 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,486 | cpp | By String Iteration.cpp | // Method - String Iteration(Optimised)
// Time Complexity - O(1)
// Space Complexity - O(1)
class Solution {
public:
vector<int> sequentialDigits(int low, int high) {
// declare and define the possible digits
string digits ="123456789";
// variable to store the result
vector<int> result;
// getting the size of low and high
// by converting it to string and finding its length
int sizeLow = to_string(low).length();
int sizeHigh = to_string(high).length();
// outter loop runs for sizeLow to sizeHigh
for(int i = sizeLow; i <= sizeHigh; i++){
// inner loop runs for "0" to "10-i" times
// sinze we iterate through the string and string index starts at "0"
for (int j = 0; j < 10-i; j++){
// getting the sibstring from the digits,
// which is in range of j to i, Ex: 0 to 3
// stoi - Used to convert the obtained substring into int type
int x = stoi(digits.substr(j,i));
// check the value of x in range of "low" and "high"
// if so append the values to the "result" variable
if(x>= low && x<=high){
result.push_back(x);
}
}
}
// printing the result
return result;
}
};
|
d7d19ad961d04db17002e7dd88d761bc7795edb4 | 321c200f18b4c54c1104269a354fa7c616d17928 | /device/Arduino/LightsSerial/LightsSerial.ino | a57522b9cc893a1244beea3533884e52a010b6f7 | [] | no_license | haimianying/arubi | 92ae93989aac8cfc0c4ca3ec0f11a4ba96e6a994 | 545b1bc40a4200ea9dec95b773534bbf7beb56ca | refs/heads/master | 2021-05-26T20:48:12.571717 | 2013-04-23T07:40:08 | 2013-04-23T07:40:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | ino | LightsSerial.ino | int incomingByte = 0; // for incoming serial data
int pinOn = 5;
int pinOff = 6;
void setup() {
pinMode(3, OUTPUT);
digitalWrite(3, LOW);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
pinMode(pinOn, OUTPUT);
pinMode(pinOff, OUTPUT);
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
if(incomingByte == 48)
{
lightsOff();
}
else if(incomingByte == 49)
{
lightsOn();
}
}
}
// turn the lights on
void lightsOn()
{
Serial.println("I'm on");
digitalWrite(pinOff, LOW);
delay(200);
digitalWrite(pinOn, HIGH);
delay(200);
digitalWrite(pinOn, LOW);
}
// turn the lights off
void lightsOff()
{
Serial.println("I'm off");
digitalWrite(pinOn, LOW);
delay(200);
digitalWrite(pinOff, HIGH);
delay(200);
digitalWrite(pinOff, LOW);
}
|
461dd67154c1210d0a60b49059d66d131a2769b7 | d12c0978b6d8dafc9133fe6d8521ebb63ca18111 | /typex_test.cpp | 254c25d1a864c7f0cfdd025bc7700f3ae8ab11a8 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | iiSky101/rmsk2 | f8ef6267ce473c9dfb9ec38e236d3483238f3991 | 812b2e495c9a15c16075d4358ca9b7b950b7a26c | refs/heads/master | 2022-11-19T11:11:33.799881 | 2020-07-28T19:52:05 | 2020-07-28T19:52:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,396 | cpp | typex_test.cpp | /***************************************************************************
* Copyright 2017 Martin Grap
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
/*! \file typex_test.cpp
* \brief Contains tests to verify the correct implementation of the Typex simulator.
*/
#include<boost/scoped_ptr.hpp>
#include<rmsk_globals.h>
#include<typex.h>
#include<typex_test.h>
#include<configurator.h>
namespace test_typex {
/*! \brief A class that verifies the Typex simulator. The main component is a test that encrypts a string of all the
characters in the letters and figures input alphabets and verifies that this produces the expected results.
*/
class typex_encryption_test : public test_case {
public:
/*! \brief Construcor using an STL string to specify the name of the test.
*/
typex_encryption_test(const string& n) : test_case(n) { ; }
/*! \brief Construcor using a C-style zero terminated string to specify the name of the test.
*/
typex_encryption_test(const char *n) : test_case(n) { ; }
/*! \brief Performs the described tests.
*/
virtual bool test();
};
bool typex_encryption_test::test()
{
bool result = false;
// String containing all possible plaintext characters. BTW: > switches machine in figures mode and < switches it back.
ustring plain = "qwertyuiopasdfghjkl cbnm>1234567890-/z%x£*() v,.<a";
// Input to numeric decipherment test.
ustring plain2 = "bbkddivxafwbkynnhtwdcpjhfnmmgz";
typex typex_t(TYPEX_SP_02390_UKW, TYPEX_SP_02390_A, TYPEX_SP_02390_B, TYPEX_SP_02390_C, TYPEX_SP_02390_D, TYPEX_SP_02390_E);
typex typex_t2(TYPEX_SP_02390_UKW, TYPEX_SP_02390_A, TYPEX_SP_02390_B, TYPEX_SP_02390_C, TYPEX_SP_02390_D, TYPEX_SP_02390_E);
vector<pair<char, char> > inv;
ustring enc_result, dec_result;
// Expected encryption result of string contained in variable plain.
ustring result_ref = "hvdngqylgghjokkioxpeqlfemxnwizaomssrmfsvvpuacykucn";
inv.push_back(pair<char, char>('a', 'r'));
inv.push_back(pair<char, char>('b', 'y'));
inv.push_back(pair<char, char>('c', 'u'));
inv.push_back(pair<char, char>('d', 'h'));
inv.push_back(pair<char, char>('e', 'q'));
inv.push_back(pair<char, char>('f', 's'));
inv.push_back(pair<char, char>('g', 'l'));
inv.push_back(pair<char, char>('i', 'x'));
inv.push_back(pair<char, char>('j', 'p'));
inv.push_back(pair<char, char>('k', 'n'));
inv.push_back(pair<char, char>('m', 'o'));
inv.push_back(pair<char, char>('t', 'w'));
inv.push_back(pair<char, char>('v', 'z'));
typex_t.set_reflector(inv);
typex_t2.set_reflector(inv);
// Encryption test
enc_result = typex_t.get_keyboard()->symbols_typed_encrypt(plain);
result = (enc_result == result_ref);
if (!result)
{
append_note(enc_result);
append_note("Typex Encryption Test failed.");
return result;
}
append_note(enc_result);
// Numeric decryption test
append_note("TypeX numeric code decipherment");
dec_result = typex_t2.get_keyboard()->symbols_typed_decrypt(plain2);
append_note(dec_result);
result = (dec_result == "34872 42789 25470 21346 89035");
return result;
}
}
/*! \brief Test to verify the Typex simulator by performing a test decryption.
*/
decipherment_test typex_test_case("Proper TypeX Test");
/*! \brief Test case implementing the described test encryption.
*/
test_typex::typex_encryption_test typex_test_case_enc("TypeX Encryption Test");
void test_typex::register_tests(composite_test_case *container)
{
// Reference values have been created using the Typex simulator available at http://www.hut-six.co.uk/typex/
rotor_machine *typex_t;
typex *typex_t_load = new typex(TYPEX_SP_02390_UKW, TYPEX_SP_02390_E, TYPEX_SP_02390_D, TYPEX_SP_02390_A, TYPEX_SP_02390_C, TYPEX_SP_02390_B);
map<string, string> typex_conf;
typex_conf[KW_TYPEX_ROTOR_SET] = DEFAULT_SET;
typex_conf[KW_TYPEX_ROTORS] = "aNbNcRdNeN";
typex_conf[KW_TYPEX_RINGS] = "aaaaa";
typex_conf[KW_TYPEX_REFLECTOR] = "arbycudheqfsglixjpknmotwvz";
typex_conf[KW_TYPEX_PLUGBOARD] = "";
boost::scoped_ptr<configurator> c(configurator_factory::get_configurator(MNAME_TYPEX));
typex_t = c->make_machine(typex_conf);
(dynamic_cast<enigma_family_base *>(typex_t))->move_all_rotors("aaaaa");
ustring expected_plain = "qwertyuiopasdfghjkl cbnm1234567890-/z%x£*() v',.a";
ustring spruch = "ptwcichvmijbkvcazuschqyaykvlbswgqxrqujjnyqyqptrlaly";
typex_test_case.set_test_parms(spruch, expected_plain, typex_t, typex_t_load);
container->add(&typex_test_case);
container->add(&typex_test_case_enc);
}
|
15f8fe8bbe227cd6193b030a3769db061e8c56f0 | b179ee1c603139301b86fa44ccbbd315a148c47b | /world/tiles/include/AirTile.hpp | aec40990d6093ba387f205ea32d1e2dcc2e72a34 | [
"MIT",
"Zlib"
] | permissive | prolog/shadow-of-the-wyrm | 06de691e94c2cb979756cee13d424a994257b544 | cd419efe4394803ff3d0553acf890f33ae1e4278 | refs/heads/master | 2023-08-31T06:08:23.046409 | 2023-07-08T14:45:27 | 2023-07-08T14:45:27 | 203,472,742 | 71 | 9 | MIT | 2023-07-08T14:45:29 | 2019-08-21T00:01:37 | C++ | UTF-8 | C++ | false | false | 561 | hpp | AirTile.hpp | #pragma once
#include "Tile.hpp"
class AirTile : public Tile
{
public:
AirTile();
TileType get_tile_type() const override;
TileSuperType get_tile_base_super_type() const override;
std::string get_tile_description_sid() const override;
bool get_dangerous(CreaturePtr creature) const override;
std::string get_danger_confirmation_sid() const override;
virtual std::string get_no_exit_up_message_sid() const;
virtual Tile* clone() override;
private:
ClassIdentifier internal_class_identifier() const override;
};
|
3864fd7284abc0fbb02491bc58900ab4e2ed9389 | 5c30eb987fd4f7d2bbcee01ff67c1457b2cf24af | /oneAPI/pagani/quad/GPUquad/PaganiUtils.dp.hpp | 14c08ee9c17d8debc2c475de278ca065a5575911 | [
"BSD-3-Clause"
] | permissive | marcpaterno/gpuintegration | 51d04ea3d70c3e9b12467db172b4c8c7ff3e3d6f | 42b558a5504609f21a2e0121d41daf24498d7f28 | refs/heads/master | 2023-08-09T20:26:51.369094 | 2023-07-25T15:25:08 | 2023-07-25T15:25:08 | 253,514,762 | 7 | 1 | NOASSERTION | 2023-03-13T20:27:36 | 2020-04-06T14:01:59 | C++ | UTF-8 | C++ | false | false | 20,037 | hpp | PaganiUtils.dp.hpp | #ifndef PAGANI_UTILS_CUH
#define PAGANI_UTILS_CUH
#include <CL/sycl.hpp>
#include "common/oneAPI/Volume.dp.hpp"
#include "common/oneAPI/cudaApply.dp.hpp"
#include "common/oneAPI/cudaArray.dp.hpp"
#include "common/oneAPI/cudaUtil.h"
#include "oneAPI/pagani/quad/GPUquad/Phases.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Sample.dp.hpp"
#include "common/oneAPI/cuhreResult.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Rule.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/hybrid.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Sub_regions.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Region_estimates.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Region_characteristics.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Sub_region_filter.dp.hpp"
#include "oneAPI/pagani/quad/quad.h"
#include "oneAPI/pagani/quad/GPUquad/Sub_region_splitter.dp.hpp"
#include "oneAPI/pagani/quad/GPUquad/Func_Eval.hpp"
#include <stdlib.h>
#include <fstream>
#include <string>
template <size_t ndim, bool use_custom = false>
class Cubature_rules {
public:
using Reg_estimates = Region_estimates<ndim>;
using Sub_regs = Sub_regions<ndim>;
using Regs_characteristics = Region_characteristics<ndim>;
std::ofstream outregions;
std::ofstream outgenerators;
double total_time = 0.;
Recorder<true> rfevals;
Recorder<true> rregions;
Recorder<true> rgenerators;
Cubature_rules()
{
rfevals.outfile.open("oneapi_fevals.csv");
rgenerators.outfile.open("generators.csv");
rregions.outfile.open("regions.csv");
auto print_header = [=]() {
rfevals.outfile << "reg, fid,";
for (size_t dim = 0; dim < ndim; ++dim)
rfevals.outfile << "dim" + std::to_string(dim) << +"low"
<< ","
<< "dim" + std::to_string(dim) + "high,";
for (size_t dim = 0; dim < ndim; ++dim)
rfevals.outfile << "gdim" + std::to_string(dim) << +"low"
<< ","
<< "gdim" + std::to_string(dim) + "high,";
for (size_t dim = 0; dim < ndim; ++dim)
rfevals.outfile << "dim" + std::to_string(dim) << ",";
rfevals.outfile << std::scientific << "feval, estimate, errorest"
<< std::endl;
rregions.outfile << "reg, estimate, errorest" << std::endl;
};
print_header();
constexpr size_t fEvalPerRegion = CuhreFuncEvalsPerRegion<ndim>();
quad::Rule<double> rule;
const int key = 0;
const int verbose = 0;
rule.Init(ndim, fEvalPerRegion, key, verbose, &constMem);
generators = quad::cuda_malloc<double>(ndim * fEvalPerRegion);
size_t block_size = 64;
auto q = sycl::queue(sycl::gpu_selector());
q.submit([&](sycl::handler& cgh) {
double* generators_ct0 = generators;
auto constMem_ct2 = constMem;
int FEVAL = fEvalPerRegion;
cgh.parallel_for(sycl::nd_range<1>(block_size, block_size),
[=](sycl::nd_item<1> item_ct1) {
quad::ComputeGenerators<double, ndim>(
generators_ct0, FEVAL, constMem_ct2, item_ct1);
});
})
.wait_and_throw();
integ_space_lows = quad::cuda_malloc<double>(ndim);
integ_space_highs = quad::cuda_malloc<double>(ndim);
set_device_volume();
}
void
Print_region_evals(double* ests, double* errs, const size_t num_regions)
{
for (size_t reg = 0; reg < num_regions; ++reg) {
rregions.outfile << reg << ",";
rregions.outfile << std::scientific << ests[reg] << "," << errs[reg];
rregions.outfile << std::endl;
}
}
void
Print_func_evals(quad::Func_Evals<ndim> fevals,
double* ests,
double* errs,
const size_t num_regions)
{
if (num_regions >= 1024)
return;
auto print_reg = [=](const Bounds* sub_region) {
for (size_t dim = 0; dim < ndim; ++dim) {
rfevals.outfile << std::scientific << sub_region[dim].lower << ","
<< sub_region[dim].upper << ",";
}
};
auto print_global_bounds = [=](const GlobalBounds* sub_region) {
for (size_t dim = 0; dim < ndim; ++dim) {
rfevals.outfile << std::scientific << sub_region[dim].unScaledLower
<< "," << sub_region[dim].unScaledUpper << ",";
}
};
auto print_feval_point = [=](double* x) {
for (size_t dim = 0; dim < ndim; ++dim) {
rfevals.outfile << std::scientific << x[dim] << ",";
}
};
constexpr size_t num_fevals = CuhreFuncEvalsPerRegion<ndim>();
for (size_t reg = 0; reg < num_regions; ++reg) {
for (int feval = 0; feval < fevals.num_fevals; ++feval) {
size_t index = reg * fevals.num_fevals + feval;
rfevals.outfile << reg << "," << fevals[index].feval_index << ",";
print_reg(fevals[index].region_bounds);
print_global_bounds(fevals[index].global_bounds);
print_feval_point(fevals[index].point);
rfevals.outfile << std::scientific << fevals[index].feval << ",";
rfevals.outfile << std::scientific << ests[reg] << "," << errs[reg];
rfevals.outfile << std::endl;
}
}
}
void
print_generators(double* d_generators)
{
rgenerators.outfile << "i, gen" << std::endl;
double* h_generators = new double[ndim * CuhreFuncEvalsPerRegion<ndim>()];
quad::cuda_memcpy_to_host<double>(
h_generators, d_generators, ndim * CuhreFuncEvalsPerRegion<ndim>());
for (int i = 0; i < ndim * CuhreFuncEvalsPerRegion<ndim>(); ++i) {
rgenerators.outfile << i << "," << std::scientific << h_generators[i]
<< std::endl;
}
delete[] h_generators;
}
template <int debug = 0>
void
print_verbose(double* d_generators,
quad::Func_Evals<ndim>& dfevals,
Reg_estimates* estimates)
{
if constexpr (debug >= 1) {
print_generators(d_generators);
constexpr size_t num_fevals = CuhreFuncEvalsPerRegion<ndim>();
const size_t num_regions = estimates->size;
double* ests = new double[num_regions];
double* errs = new double[num_regions];
quad::cuda_memcpy_to_host<double>(
ests, estimates->integral_estimates, num_regions);
quad::cuda_memcpy_to_host<double>(
errs, estimates->error_estimates, num_regions);
Print_region_evals(ests, errs, num_regions);
if constexpr (debug >= 2) {
quad::Func_Evals<ndim>* hfevals = new quad::Func_Evals<ndim>;
hfevals->fevals_list = new quad::Feval<ndim>[num_regions * num_fevals];
quad::cuda_memcpy_to_host<quad::Feval<ndim>>(
hfevals->fevals_list, dfevals.fevals_list, num_regions * num_fevals);
Print_func_evals(*hfevals, ests, errs, num_regions);
delete[] hfevals->fevals_list;
delete hfevals;
cudaFree(dfevals.fevals_list);
}
delete[] ests;
delete[] errs;
}
}
void
set_device_volume(double* lows = nullptr, double* highs = nullptr)
{
if (lows == nullptr && highs == nullptr) {
std::array<double, ndim> _lows = {0.};
std::array<double, ndim> _highs;
std::fill_n(_highs.begin(), ndim, 1.);
quad::cuda_memcpy_to_device<double>(
integ_space_highs, _highs.data(), ndim);
quad::cuda_memcpy_to_device<double>(integ_space_lows, _lows.data(), ndim);
} else {
quad::cuda_memcpy_to_device<double>(integ_space_highs, highs, ndim);
quad::cuda_memcpy_to_device<double>(integ_space_lows, lows, ndim);
}
}
~Cubature_rules()
{
auto q_ct1 = sycl::queue(sycl::gpu_selector());
sycl::free(generators, q_ct1);
sycl::free(integ_space_lows, q_ct1);
sycl::free(integ_space_highs, q_ct1);
}
template <int dim>
void
Setup_cubature_integration_rules()
{
size_t fEvalPerRegion = CuhreFuncEvalsPerRegion<dim>();
quad::Rule<double> rule;
const int key = 0;
const int verbose = 0;
rule.Init(dim, fEvalPerRegion, key, verbose, &constMem);
generators =
quad::cuda_malloc<double>(sizeof(double) * dim * fEvalPerRegion);
size_t block_size = 64;
sycl::queue q;
q.submit([&](sycl::handler& cgh) {
auto generators_ct0 = generators;
auto constMem_ct2 = constMem;
cgh.parallel_for(sycl::nd_range(sycl::range(1, 1, block_size),
sycl::range(1, 1, block_size)),
[=](sycl::nd_item<1> item_ct1) {
quad::ComputeGenerators<double, ndim>(generators_ct0,
fEvalPerRegion,
constMem_ct2,
item_ct1);
});
})
.wait();
}
template <typename IntegT,
bool pre_allocated_integrand = false,
int debug = 0>
cuhreResult<double>
apply_cubature_integration_rules(
IntegT* d_integrand,
/*const*/ Sub_regs* subregions,
/*const*/ Reg_estimates* subregion_estimates,
/*const*/ Regs_characteristics* region_characteristics,
bool compute_error = false)
{
size_t num_regions = subregions->size;
quad::set_device_array<double>(
region_characteristics->active_regions, num_regions, 1.);
auto integral_estimates = subregion_estimates->integral_estimates;
auto error_estimates = subregion_estimates->error_estimates;
auto sub_dividing_dim = region_characteristics->sub_dividing_dim;
auto dLeftCoord = subregions->dLeftCoord;
auto dLength = subregions->dLength;
size_t num_blocks = num_regions;
constexpr size_t block_size = 64;
double epsrel = 1.e-3, epsabs = 1.e-12;
// temp addition
quad::Func_Evals<ndim> dfevals;
if constexpr (debug >= 2) {
constexpr size_t num_fevals = CuhreFuncEvalsPerRegion<ndim>();
dfevals.fevals_list =
quad::cuda_malloc<quad::Feval<ndim>>(num_regions * num_fevals);
}
auto q = sycl::queue(sycl::gpu_selector(),
sycl::property::queue::enable_profiling{});
sycl::event e = q.submit([&](sycl::handler& cgh) {
sycl::accessor<double,
1,
sycl::access_mode::read_write,
sycl::access::target::local>
shared_acc_ct1(
sycl::range(8), cgh); // shared, sdata, jacobian, vol, ranges
// shared[0], shared[8], shared[8+blockDim], shared[8+blockDim +1] ,
// shared[8 blockDIm + 2]
sycl::accessor<double,
1,
sycl::access_mode::read_write,
sycl::access::target::local>
sdata_acc_ct1(sycl::range(block_size), cgh);
sycl::accessor<double,
0,
sycl::access_mode::read_write,
sycl::access::target::local>
Jacobian_acc_ct1(cgh);
sycl::accessor<int,
0,
sycl::access_mode::read_write,
sycl::access::target::local>
maxDim_acc_ct1(cgh);
sycl::accessor<double,
0,
sycl::access_mode::read_write,
sycl::access::target::local>
vol_acc_ct1(cgh);
sycl::accessor<double,
1,
sycl::access_mode::read_write,
sycl::access::target::local>
ranges_acc_ct1(sycl::range(ndim), cgh);
sycl::accessor<Region<ndim>,
1,
sycl::access_mode::read_write,
sycl::access::target::local>
sRegionPool_acc_ct1(sycl::range(1), cgh);
sycl::accessor<GlobalBounds,
1,
sycl::access_mode::read_write,
sycl::access::target::local>
sBound_acc_ct1(sycl::range(ndim), cgh);
auto constMem_ct10 = constMem;
auto integ_space_lows_ct11 = integ_space_lows;
auto integ_space_highs_ct12 = integ_space_highs;
auto generators_ct13 = generators;
cgh.parallel_for(
sycl::nd_range(sycl::range(num_blocks * block_size),
sycl::range(block_size)),
[=](sycl::nd_item<1> item_ct1) [[intel::reqd_sub_group_size(32)]] {
quad::INTEGRATE_GPU_PHASE1<IntegT, double, ndim, block_size, debug>(
d_integrand,
dLeftCoord,
dLength,
num_regions,
integral_estimates,
error_estimates,
sub_dividing_dim,
epsrel,
epsabs,
constMem_ct10,
integ_space_lows_ct11,
integ_space_highs_ct12,
generators_ct13,
item_ct1,
shared_acc_ct1.get_pointer(),
sdata_acc_ct1.get_pointer(),
Jacobian_acc_ct1.get_pointer(),
maxDim_acc_ct1.get_pointer(),
vol_acc_ct1.get_pointer(),
ranges_acc_ct1.get_pointer(),
sRegionPool_acc_ct1.get_pointer(),
sBound_acc_ct1.get_pointer(),
dfevals);
});
});
q.wait();
double time = (e.template get_profiling_info<
sycl::info::event_profiling::command_end>() -
e.template get_profiling_info<
sycl::info::event_profiling::command_start>());
// std::cout<< "time:" << std::scientific << time/1.e6 << "," << ndim <<
// ","<< num_regions << std::endl;
std::cout << "INTEGRATE_GPU_PHASE1-time:" << num_blocks << ","
<< time / 1.e6 << std::endl;
total_time += time;
print_verbose<debug>(generators, dfevals, subregion_estimates);
cuhreResult<double> res;
res.estimate = reduction<double, use_custom>(
subregion_estimates->integral_estimates, num_regions);
res.errorest = compute_error ?
reduction<double, use_custom>(
subregion_estimates->error_estimates, num_regions) :
std::numeric_limits<double>::infinity();
return res;
}
Structures<double> constMem;
double* generators = nullptr;
double* integ_space_lows = nullptr;
double* integ_space_highs = nullptr;
};
template <size_t ndim, bool use_custom = false>
cuhreResult<double>
compute_finished_estimates(const Region_estimates<ndim>& estimates,
const Region_characteristics<ndim>& classifiers,
const cuhreResult<double>& iter)
{
cuhreResult<double> finished;
finished.estimate =
iter.estimate -
dot_product<double, double, use_custom>(
classifiers.active_regions, estimates.integral_estimates, estimates.size);
finished.errorest =
iter.errorest -
dot_product<double, double, use_custom>(
classifiers.active_regions, estimates.error_estimates, estimates.size);
return finished;
}
bool
accuracy_reached(double epsrel, double epsabs, double estimate, double errorest)
{
if (errorest / estimate <= epsrel || errorest <= epsabs)
return true;
return false;
}
bool
accuracy_reached(double epsrel, double epsabs, cuhreResult<double> res)
{
if (res.errorest / res.estimate <= epsrel || res.errorest <= epsabs)
return true;
return false;
}
template <typename IntegT, int ndim>
cuhreResult<double>
pagani_clone(const IntegT& integrand,
Sub_regions<ndim>& subregions,
double epsrel = 1.e-3,
double epsabs = 1.e-12,
bool relerr_classification = true)
{
using Reg_estimates = Region_estimates<ndim>;
using Regs_characteristics = Region_characteristics<ndim>;
using Res = cuhreResult<double>;
using Filter = Sub_regions_filter<ndim>;
using Splitter = Sub_region_splitter<ndim>;
Reg_estimates prev_iter_estimates;
Res cummulative;
Cubature_rules<ndim> cubature_rules;
Heuristic_classifier<ndim> hs_classify(epsrel, epsabs);
bool accuracy_termination = false;
IntegT* d_integrand = quad::make_gpu_integrand<IntegT>(integrand);
for (size_t it = 0; it < 700 && !accuracy_termination; it++) {
size_t num_regions = subregions.size;
Regs_characteristics classifiers(num_regions);
Reg_estimates estimates(num_regions);
Res iter = cubature_rules.apply_cubature_integration_rules(
d_integrand, subregions, estimates, classifiers);
computute_two_level_errorest<ndim>(
estimates, prev_iter_estimates, classifiers, relerr_classification);
// iter_res.estimate = reduction<double>(estimates.integral_estimates,
// num_regions);
iter.errorest = reduction<double>(estimates.error_estimates, num_regions);
accuracy_termination =
accuracy_reached(epsrel,
epsabs,
std::abs(cummulative.estimate + iter.estimate),
cummulative.errorest + iter.errorest);
// where are the conditions to hs_classify (gpu mem and convergence?)
if (!accuracy_termination) {
// 1. store the latest estimate so that we can check whether estimate
// convergence happens
hs_classify.store_estimate(cummulative.estimate + iter.estimate);
// 2.get the actual finished estimates, needs to happen before hs
// heuristic classification
Res finished;
finished.estimate =
iter.estimate - dot_product<int, double>(classifiers.active_regions,
estimates.integral_estimates,
num_regions);
finished.errorest =
iter.errorest - dot_product<int, double>(classifiers.active_regions,
estimates.error_estimates,
num_regions);
// 3. try classification
// THIS SEEMS WRONG WHY WE PASS ITER.ERROREST TWICE? LAST PARAM SHOULD BE
// TOTAL FINISHED ERROREST, SO CUMMULATIVE.ERROREST
Classification_res hs_results =
hs_classify.classify(classifiers.active_regions,
estimates.error_estimates,
num_regions,
iter.errorest,
finished.errorest,
iter.errorest);
// 4. check if classification actually happened or was successful
bool hs_classify_success =
hs_results.pass_mem && hs_results.pass_errorest_budget;
// printf("hs_results will leave %lu regions active\n",
// hs_results.num_active);
if (hs_classify_success) {
// 5. if classification happened and was successful, update finished
// estimates
classifiers.active_regions = hs_results.active_flags;
finished.estimate =
iter.estimate - dot_product<int, double>(classifiers.active_regions,
estimates.integral_estimates,
num_regions);
finished.errorest = hs_results.finished_errorest;
}
// 6. update cummulative estimates with finished contributions
cummulative.estimate += finished.estimate;
cummulative.errorest += finished.errorest;
// printf("num regions pre filtering:%lu\n", subregions->size);
// 7. Filter out finished regions
Filter region_errorest_filter(num_regions);
num_regions = region_errorest_filter.filter(
subregions, classifiers, estimates, prev_iter_estimates);
// printf("num regions after filtering:%lu\n", subregions->size);
quad::CudaCheckError();
// split regions
// printf("num regions pre split:%lu\n", subregions->size);
Splitter reg_splitter(num_regions);
reg_splitter.split(subregions, classifiers);
// printf("num regions after split:%lu\n", subregions->size);
} else {
cummulative.estimate += iter.estimate;
cummulative.errorest += iter.errorest;
}
}
return cummulative;
}
#endif
|
9c1f36883d507945e36e5f3579c0232f8ee2f244 | a3d7a3c92ceb262b7c058bf5c7ba07326aaf67ec | /include/test.h | 117c31245e511303360b9fa2166c5a347237df60 | [] | no_license | yuzhulin/xsvrd | 3e53fde463c532ece1552f3ce8cf597da4ed7bd2 | 89611955f1638eeb27b92182131dd43ecb50124b | refs/heads/master | 2020-12-11T06:06:52.191190 | 2015-11-26T19:29:42 | 2015-11-26T19:29:42 | 46,940,492 | 0 | 0 | null | 2015-11-26T17:53:10 | 2015-11-26T17:53:10 | null | UTF-8 | C++ | false | false | 116 | h | test.h | #ifndef __TEST_H__
#define __TEST_H__
class Test {
public:
Test();
virtual~Test();
void SomePrint();
};
#endif |
a50411d305491545555ad4bb178aff78e9807e48 | f1446dd5a1c9c72834a4690ff9e43abe90b03869 | /einnahmeerfassen.h | 3f737284058923e391520c79abffbe7ac79de7f8 | [] | no_license | ChristophRitzer/software_engineering | caffc346d71fa6e25be06b2c38a52c4eb71b6d2b | 5c3298c8f454c67ecb9ef77e13e6f849a3651138 | refs/heads/master | 2021-05-30T07:06:24.472289 | 2016-01-11T14:57:29 | 2016-01-11T14:57:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 558 | h | einnahmeerfassen.h | #ifndef EINNAHMEERFASSEN_H
#define EINNAHMEERFASSEN_H
#include <QDialog>
#include "Datenbankverwaltung.h"
#include "Transaktion.h"
namespace Ui {
class einnahmeerfassen;
}
class einnahmeerfassen : public QDialog
{
Q_OBJECT
public:
explicit einnahmeerfassen(QWidget *parent = 0);
~einnahmeerfassen();
private slots:
void on_pushButton_abbrechen_clicked();
void on_pushButton_einnahmeerfassen_clicked();
private:
Ui::einnahmeerfassen *ui;
Datenbankverwaltung* db = new Datenbankverwaltung();
};
#endif // EINNAHMEERFASSEN_H
|
fea3d8921fee51a4406094e3b7b33024d90aab8e | 6d8c5e578ba64574257e229ede28d7ac3817ea44 | /pos/Src/Visa_Settle.hpp | 57c061ad6bca041e6b8d746c03d18c1fe0a2ef0b | [] | no_license | suyuti/Hypercom | 0771b4a1a88fdf0077799de6fb9146ae4884c998 | fca325792378f83008d19f9f0f577e3f2ed6cb83 | refs/heads/master | 2021-01-13T01:28:46.126789 | 2015-02-26T20:39:25 | 2015-02-26T20:39:25 | 31,387,832 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,396 | hpp | Visa_Settle.hpp | //=============================================================================
// Company:
// Hypercom Inc
//
// Product:
// Hypercom Foundation Classes
// (c) Copyright 2006
//
// File Name:
// Visa_Settle.hpp
//
// File Contents:
// Declaration of the class Visa_Settle
//
//=============================================================================
#if !defined(_VISA_SETTLE_HPP_)
#define _VISA_SETTLE_HPP_
#if defined(__GNUC__)
#pragma interface
#endif
#include <compiler.h>
#include <HypCTransactionData.hpp>
#include "Visa_Financial.hpp"
//=============================================================================
// Forward definitions
//=============================================================================
class VisaHost;
//=============================================================================
// Public defines and typedefs
//=============================================================================
//=============================================================================
//!
//! \brief
//! Provides functionality for VISA host settlement.
//!
//! This class implements the functionality used only by settlement
//! requests to a Visa host
//!
//! \sa
//! Visa_Financial, Visa_Message, VisaHost
//!
//=============================================================================
class Visa_Settle : public Visa_Financial
{
//=============================================================================
// Member structures, enumerations, and class definitions
//=============================================================================
private:
//! pointer to a function to be called from a script
typedef bool (Visa_Settle::*MoverFunction)();
//! table of movers
struct rec
{
MoverFunction MoveF;
uint16_t Size; // Max or fixed Length
SizeAttr Type;
} ;
//=============================================================================
// Member functions
//=============================================================================
public:
//! Initialize members
Visa_Settle( VisaHost* visa_host );
//! Virtual destructor
virtual ~Visa_Settle( );
//! initialize a settlement message
Visa_Message* Init( HypCTransactionData* pTransData, HString tt );
//! call the specific mover function
bool Mover( uint16_t idx );
//! get the number of entries in the movers table
uint16_t NumMovers( );
//! get the size of the field identified by idx-entry
uint16_t MoverSize( uint16_t idx );
//! get the attribute of the field identified by idx-entry
Visa_Financial::SizeAttr FieldAttr( uint16_t idx );
//! set type for this message object
void SetTransType( HString& tt );
//! move format field for CLBATCH request
bool MoveFormatH( );
//! move record type field for CLBATCH request
bool MoveRecTypeH( );
//! move record type field for CLTERM request
bool MoveRecTypeP( );
//! move record type field for CLBATCHA request
bool MoveRecTypeT( );
//! move record type field for RUPLOAD request
bool MoveRecTypeD( );
//! move agent's bank number
bool MoveAgentBankNum( );
//! move agent's chain number
bool MoveAgentChainNum( );
//! move batch transaction date
bool MoveBatchTransDate( );
//! move batch number
bool MoveBatchNum( );
//! move blocking ID
bool MoveBlockingID( );
//! move ETB field
bool MoveETB( );
//! move returned ACI field
bool MoveRetACI( );
//! move authorization source code
bool MoveAuthSrcCode( );
//! move record count
bool MoveRecCount( );
//! move hash total field
bool MoveHashTotal( );
//! move cashback amount field
bool MoveCashTotal( );
//! move batch net deposit amount
bool MoveBatchNetDeposit( );
//! move account number
bool MoveAccNumber( );
//! move authorization code
bool MoveAuthCode( );
//! move response code
bool MoveRespCode( );
//! move transaction date and time
bool MoveTranDateTime( );
//! move AVS result field
bool MoveAVSResult( );
//! move transaction ID field
bool MoveTranID( );
//! move validation code
bool MoveValidCode( );
//! move void index field
bool MoveVoidInd( );
//! move transaction state code
bool MoveTranStatCode( );
//! move reimbursement attribute
bool MoveReimb( );
//! move settlement amount
bool MoveSettleAmt( );
//! move authorization amount
bool MoveAuthAmt( );
//! translate reponse code to the unified format
HString TransResponse( const HString& rsp );
//! decode packet sent by host
bool DecodeMessagePacket( char* pData, size_t length );
protected:
//=============================================================================
// Member variables
//=============================================================================
private:
//! reference to the host host
VisaHost* m_VisaHost;
//! reference to the used movers table for a sepcific settlement request
rec * p_m_UsedTAB;
//! size of the movers table to walk through
uint64_t m_TabSize;
//! movers table for settlement header request
static const rec TAB_Header[];
//! movers table for settlement parameters request
static const rec TAB_Params[];
//! movers table for settlement details request
static const rec TAB_Details[];
//! movers table for settlement trailer request
static const rec TAB_Trail[];
//! number of packets sent
uint64_t m_RecCount;
//! hash total
uint64_t m_HashTotal;
//! cash total
uint64_t m_CashTotal;
//! net deposit
uint64_t m_NetDeposit;
};
// Visa_Settle
//-----------------------------------------------------------------------------
//!
//! Just initializes the data elements
//!
//! \param
//! visa_host reference to the host object, which created this
//! message
//!
//! \return
//! Nothing
//!
//! \note
//!
inline Visa_Settle::Visa_Settle( VisaHost* visa_host ) :
Visa_Financial( ),
m_VisaHost( visa_host ),
p_m_UsedTAB( 0 ),
m_TabSize( 0 ),
m_RecCount( 0 ),
m_HashTotal( 0 ),
m_CashTotal( 0 ),
m_NetDeposit( 0 )
{
}
//-----------------------------------------------------------------------------
//!
//! destructor
//!
//! \return
//! Nothing
//!
//! \note
//!
inline Visa_Settle::~Visa_Settle()
{
}
#endif // !defined(_VISA_SETTLE_HPP_)
|
42146abe0202994f2d3e6199e5fcf94e22b6a9e7 | bb06a4a7a9b638da62f4f6f77b390fd3a3878796 | /source/exceptions/EMemoryAllocationException.hpp | ac023ff8083d674549253eeb0c9340c8c933e82d | [] | no_license | evandroluizvieira/EToolkit | 7942b489ca38dfa136b0190715b49f23558f1128 | 6c21be2d288c91b9faa4a15bc0fd1fd09ef4e00d | refs/heads/master | 2023-09-01T15:05:01.029758 | 2023-08-24T05:25:11 | 2023-08-24T05:25:11 | 297,410,960 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 683 | hpp | EMemoryAllocationException.hpp | #ifndef EMEMORYALLOCATIONEXCEPTION_HPP
#define EMEMORYALLOCATIONEXCEPTION_HPP
#include <EException>
/*
* @description: Evandro's toolkit.
*/
namespace EToolkit{
/*
* @description: A exception class used to throw a memory allocation failure.
*/
class ETOOLKIT_API MemoryAllocationException : public Exception{
public:
/*
* @description: Default constructor what create the exception with the "cannot allocate memory" message.
* @return: None.
*/
MemoryAllocationException();
/*
* @description: Default inheritable destructor.
* @return: None.
*/
virtual ~MemoryAllocationException();
};
}
#endif /* EMEMORYALLOCATIONEXCEPTION_HPP */
|
d22cb4bea1adb6be000d18d07106d5d60d1dd241 | 9475967af2ec9e96d9cb6b0935adc0a5660abb15 | /stage01/cpp_course/unit07/section03/test_read_file.cpp | f3c1324e816f0013dba09e0165c803a3f3360538 | [] | no_license | koffuxu/linux-c | f5cf2b07428270fd869ba8a4c81fa80a0a924975 | e89f4eba9aff27ad5db2fd6432524bee4f5448a3 | refs/heads/master | 2021-05-15T02:19:12.427728 | 2018-01-06T03:21:36 | 2018-01-06T03:21:36 | 27,625,192 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 747 | cpp | test_read_file.cpp | /*************************************************************************
> File Name: test_read_file.cpp
> Author: koffuxu
> Mail: koffuxu@gmail.com
> Created Time: 2016年05月02日 星期一 12时21分07秒
************************************************************************/
#include<iostream>
#include<fstream>
using namespace std;
int main(void) {
ifstream input;
char fname[10];
char mname;
char lname[10];
int score;
input.open("scores.txt");
//
if( input.fail() ) {
cout<<"file NOT FOUND"<<endl;
} else {
while(!input.eof()){
//read 1 line,blank is a Word token
input>>fname>>mname>>lname>>score;
cout<<fname<<" "<<mname<<" "<<lname<<" "<<score<<endl;
}
input.close();
return 0;
}
}
|
971b18e6e29e52cc1a5c96c521674f4aa8f04054 | be15f376f94b44594bd5c64a75d0a80f5e4c60d6 | /RayTracer GFX II/Raytracer.h | 2d29e019f720d0ede8f5c77a5c64ee47a3445005 | [] | no_license | avicarpio/MonteCarlo_RayTracer | 128a643f0d0375dd2b84c1c92d65167b0e05f99c | 7b5553de2becd4cbe5998e4b42827d01d62e2595 | refs/heads/master | 2022-09-23T14:57:05.502002 | 2020-05-31T17:01:32 | 2020-05-31T17:01:32 | 263,588,982 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,808 | h | Raytracer.h | #ifndef RAYTRACER_H
#define RAYTRACER_H
/***************************************************************************
* *
* This is the header file for a "Toy" ray tracer. This ray tracer is very *
* minimal, and is intended simply for learning the basics of ray tracing. *
* Here is a partial list of things that are missing from this program that *
* a serious ray tracer would have: *
* *
* 1) A method of reading in the geometry of a scene from a file. *
* *
* 2) At least one technique for speeding up ray-object intersection when *
* there are a large number of object (e.g. thousands). In contrast, *
* this toy ray tracer uses "brute force" or "naive" ray intersection. *
* That is, it simply tests all objects and keeps the closest hit. *
* *
* 3) Some method of anti-aliasing; that is, a method for removing the *
* jagged edges, probably by casting multiple rays per pixel. *
* *
* *
***************************************************************************/
#include "Utils.h"
#include "Image.h"
#include "World.h"
#include <GL/glut.h>
class Raytracer
{
Image* I;
int resolutionX;
int resolutionY;
int currentLine;
bool isDone;
public:
Raytracer( int x, int y )
{
I = new Image(x, y);
resolutionX = x;
resolutionY = y;
currentLine = 0;
isDone = false;
}
virtual ~Raytracer(){
delete I;
}
void draw( void );
void cast_line( World world );
bool IsDone( void )
{
return isDone;
}
private:
Pixel ToneMap( const Color &color );
Color Trace( // What color do I see looking along this ray?
const Ray &ray, // Root of ray tree to recursively trace in scene.
const Scene &scene, // Global scene description, including lights.
int max_tree_depth // Limit to depth of the ray tree.
);
Color Shade( // Surface shader.
const HitInfo &hitinfo, // Geometry of ray-object hit + surface material.
const Scene &scene, // Global scene description, including lights.
int max_tree_depth // Limit to depth of the ray tree.
);
Color Shade2( // Surface shader.
const HitInfo &hitinfo, // Geometry of ray-object hit + surface material.
const Scene &scene, // Global scene description, including lights.
int max_tree_depth // Limit to depth of the ray tree.
);
int Cast( // Casts a single ray to see what it hits.
const Ray &ray, // The ray to cast into the scene.
const Scene &scene, // Global scene description, including lights.
HitInfo &hitinfo, // All information about ray-object intersection.
Object *ignore = false // Object that will be ignored for the intersection
);
int Cast2( // Casts a single ray to see what it hits.
const Ray &ray, // The ray to cast into the scene.
const Scene &scene, // Global scene description, including lights.
HitInfo &hitinfo, // All information about ray-object intersection.
Object *ignore = false // Object that will be ignored for the intersection
);
Sample SampleProjectedHemisphere(
const Vec3 &N // Normal of the surface
);
Sample SampleSpecularLobe(
const Vec3 &R, // Perfect reflective direction
float phong_exp // Phong exponent
);
};
#endif |
efa2388741de2aa66ff6098143261375ae5d2f86 | 1b6801f4575f1d401f739bccb8ba6e323647193b | /3MC Server/source/egp-net-framework/Game/mainServerLoop.cpp | 57702f13011111b71e8534e20b573a11bff88800 | [] | no_license | Staszk/Mighty-Morphing-Monster-Cards | 7a0c1305f00bad4b153335eac243243745dff6df | 9b917eb900569d3fedc0a400226b4eeb281f03d4 | refs/heads/master | 2022-12-29T04:20:01.714725 | 2020-10-21T17:47:45 | 2020-10-21T17:47:45 | 306,103,471 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,500 | cpp | mainServerLoop.cpp | /////////////////////////////////////////////
// ChampNet| Written by John Imgrund (c) 2019
/////////////////////////////////////////////
#include "mainServerLoop.h"
serverMain::serverMain()
{
//Get the Networking Instance
NetworkingInstance& gpInstance = NetworkingInstance::getInstance();
//Set Timers
mDrawTime = 0;
mPlayerOneAttackTime = 0;
mPlayerTwoAttackTime = 0;
mPlayerOneSpeed = gpInstance.getPlayerOneSpeed(); //Turn it into a percentage
mPlayerTwoSpeed = gpInstance.getPlayerTwoSpeed(); //Turn it into a percentage
}
float serverMain::DamageMultiplierArray[6][6] =
{ //Normal, Bronze, Steel, Brass, Pewter, Electrum
{1, 1, 1, 1, 1, 1}, //Normal
{1, 1, 1.5, 1, 1, 0.5}, //Water
{1, 1.5f, 0.5f, 1, 1, 1}, //Fire
{1, 0.5f, 1, 1, 1.5f, 1}, //Earth
{1, 1, 1, 1.5f, 0.5f, 1}, //Air
{1, 1, 1, 0.5f, 1, 1.5f} //Lightning
};
serverMain::~serverMain()
{
}
void serverMain::serverLoop(float elapsed)
{
//Get the Networking Instance
NetworkingInstance& gpInstance = NetworkingInstance::getInstance();
//Handle updates from players
if (gpInstance.getGameMode() == 0) //Waiting for players
{
//Nothing, just waiting for other people to join
}
else if (gpInstance.getGameMode() == 1) //morphing phase
{
//Update Timer
mDrawTime += elapsed;
morphingPhaseLoop(gpInstance);
}
else if (gpInstance.getGameMode() == 2) //battle phase
{
//Update Timers
mPlayerOneAttackTime += elapsed;
mPlayerTwoAttackTime += elapsed;
battlePhaseLoop(gpInstance);
}
else if (gpInstance.getGameMode() == 3) //End State
{
//Sleep(5000);
//Reset the server
//gpInstance.restartHostInstance();
}
}
void serverMain::morphingPhaseLoop(NetworkingInstance& instance)
{
//Check timer to see if players should draw cards
if (mDrawTime > CARD_DRAW_TIME)
{
//Check to see if enough cards have been drawn for the morph phase
if (mCardsDrawn >= CARD_DRAW_LIMIT)
{
printf("Go to Battle Phase\n");
//Create new BattlePhase Message
BattlePhase* BattleMessage = new BattlePhase();
BattleMessage->networkMessageID = 140; //BattlePhase ID
//Add to Sender
instance.addToSender(BattleMessage);
//Go to next game mode
instance.setGameMode(2);
}
else
{
printf("draw\n");
//reset timer
mDrawTime = 0;
//Create new DrawCard Message
DrawCard* draw = new DrawCard();
draw->networkMessageID = 139; //Draw card ID
//Add to sender
instance.addToSender(draw);
++mCardsDrawn;
}
}
}
void serverMain::battlePhaseLoop(NetworkingInstance& instance)
{
if (instance.getPlayerOneAttackReset())
{
//Reset Attack Timer
mPlayerOneAttackTime = 0;
instance.setPlayerOneReset(false);
}
//Check First players Timer
if ((*mPlayerOneSpeed * BASE_SPEED) < mPlayerOneAttackTime)
{
//Player One Attacks
AttackMessage* attack = new AttackMessage();
attack->networkMessageID = 142; //Attack Message ID
attack->playerNum = 1;
//Add to Sender
instance.addToSender(attack);
//Reset Timer
mPlayerOneAttackTime = 0;
}
if (instance.getPlayerTwoAttackReset())
{
//Reset Attack Timer
mPlayerTwoAttackTime = 0;
instance.setPlayerTwoReset(false);
}
//Check Second Players Timer
if ((*mPlayerTwoSpeed * BASE_SPEED) < mPlayerTwoAttackTime)
{
//Player Two Attacks
AttackMessage* attack = new AttackMessage();
attack->networkMessageID = 142; //Attack Message ID
attack->playerNum = 2;
//Add to Sender
instance.addToSender(attack);
//Reset Timer
mPlayerTwoAttackTime = 0;
}
} |
86dc2ecb33bdb46203760b20e27df69e40429a3e | 5af7675b03adcbe19d95f81ba360f1a1b34f3513 | /YRenderLab/YRenderLab/Private/Lights/Light.cpp | 38e3398569c72e0075b424819e516fe9f89c3b02 | [] | no_license | fakersaber/YRenderLab | 278d271edc5aae61a04b32587eee2530e657581f | c5b370255acd58d51f07416cc24651b53e30ade7 | refs/heads/master | 2021-06-22T17:23:53.009354 | 2021-03-01T06:09:26 | 2021-03-01T06:09:26 | 198,810,518 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 36 | cpp | Light.cpp | #include <Public/Lights/Light.h>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.