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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19ef0461a93e3f6aeb28f7b2c10dc5fe53b5d7d6 | 43e38e777937e9e250ac16de70694fea7d991575 | /sections/section11FriendClaseB.h | 7553bc7bfca943f7f77eca3f315c17d1279bb426 | [] | no_license | locus0002/c-plus-plus | 1fd89535bd297c606e155e09292017571066e968 | 8a1456ea3ce739b9f9a957db810dc6a310b296da | refs/heads/master | 2023-03-08T03:43:15.878868 | 2021-02-10T07:16:56 | 2021-02-10T07:16:56 | 124,449,057 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 183 | h | section11FriendClaseB.h | #ifndef FRIEND_CLASS_B
#define FRIEND_CLASS_B
class B{
friend class A;
int attributeB;
public:
void setValueinB(int);
int getAttribute();
};
#endif |
7253fb544c6b5dd23d1d6f7cb4e6d7ea4b1166ba | 6f73f1bc4a8debbdaf582eb89854eefb27641ac0 | /LunaEngine/LunaEngine/Systems/EntityManager.h | e28b550cc8f3367a1b51e582fde604c1fbcba97c | [] | no_license | junming1901/LunaEngine | b45fa1c541f547520e9f6ba06cd4cb5d2a11c136 | 4b809c4ad6dcc251c8a45352f5b200bf4814fee3 | refs/heads/master | 2021-05-25T13:38:21.258753 | 2020-04-14T06:51:03 | 2020-04-14T06:51:03 | 253,775,232 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | h | EntityManager.h | #pragma once
#include "Entity.h"
#include "System.h"
#define MAX_ENTITIES 1000
class EntityManager : public System
{
public:
template <typename T, T... ints>
EntityManager(std::integer_sequence<T, ints...> seq);
private:
Entity m_EntitiesList[MAX_ENTITIES];
};
// Initialize the entities with their ID at compile time
template <typename T, T ...ints>
inline EntityManager::EntityManager(std::integer_sequence<T, ints...> seq)
: m_EntitiesList { ints... }
{
UNREFERENCED_PARAMETER(seq);
}
|
456930e470173f7c70395cbe78967767497948ac | c0068537b6428ab7b60f9579c6921a568cb8b30b | /src/input/win/win_input.cpp | 7062c94284c06224a16997b4aec84ab46c3f7ea0 | [] | no_license | kyuu/sphere | 76756f3f19bb9293f273b14dbe4dc8dcd43f5331 | ecda66a17be1cc4191dea520198b274fe3399088 | refs/heads/master | 2021-01-10T20:36:33.835137 | 2012-03-21T02:51:45 | 2012-03-21T02:51:45 | 2,723,079 | 8 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,140 | cpp | win_input.cpp | #include <cassert>
#include <vector>
#include <deque>
#include <cassert>
#include <vector>
#include <windows.h>
#include <SDL.h>
#include <SDL_Haptic.h>
#include "../input.hpp"
#define PRESSED 1
#define RELEASED 0
namespace sphere {
namespace input {
//-----------------------------------------------------------------
struct Joystick {
SDL_Joystick* joystick;
SDL_Haptic* haptic;
std::string name;
std::vector<int> buttons;
std::vector<int> axes;
std::vector<int> hats;
};
//-----------------------------------------------------------------
// globals
std::vector<Joystick> g_Joysticks;
//-----------------------------------------------------------------
int GetNumJoysticks()
{
return (int)g_Joysticks.size();
}
//-----------------------------------------------------------------
const char* GetJoystickName(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
return g_Joysticks[joy].name.c_str();
}
return 0;
}
//-----------------------------------------------------------------
int GetNumJoystickButtons(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
return (int)g_Joysticks[joy].buttons.size();
}
return 0;
}
//-----------------------------------------------------------------
int GetNumJoystickAxes(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
return (int)g_Joysticks[joy].axes.size();
}
return 0;
}
//-----------------------------------------------------------------
int GetNumJoystickHats(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
return (int)g_Joysticks[joy].hats.size();
}
return 0;
}
//-----------------------------------------------------------------
bool IsJoystickButtonDown(int joy, int button)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
if (button >= 0 && button < (int)g_Joysticks[joy].buttons.size()) {
return g_Joysticks[joy].buttons[button] == PRESSED;
}
}
return false;
}
//-----------------------------------------------------------------
int GetJoystickAxis(int joy, int axis)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
if (axis >= 0 && axis < (int)g_Joysticks[joy].axes.size()) {
return g_Joysticks[joy].axes[axis];
}
}
return 0;
}
//-----------------------------------------------------------------
int GetJoystickHat(int joy, int hat)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
if (hat >= 0 && hat < (int)g_Joysticks[joy].hats.size()) {
return g_Joysticks[joy].hats[hat];
}
}
return JOY_HAT_CENTERED;
}
//-----------------------------------------------------------------
bool IsJoystickHaptic(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size()) {
return g_Joysticks[joy].haptic != 0;
}
return false;
}
//-----------------------------------------------------------------
int CreateJoystickForce(int joy, int strength, int duration)
{
if (joy >= 0 && joy < (int)g_Joysticks.size() && g_Joysticks[joy].haptic) {
SDL_HapticEffect effect;
memset(&effect, 0, sizeof(SDL_HapticEffect));
effect.constant.type = SDL_HAPTIC_CONSTANT;
effect.constant.length = (duration < 0 ? SDL_HAPTIC_INFINITY : (Uint32)duration);
effect.constant.level = (Sint16)(strength * 327.67);
effect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
int effect_id = SDL_HapticNewEffect(g_Joysticks[joy].haptic, &effect);
if (effect_id >= 0) {
return effect_id;
}
}
return -1;
}
//-----------------------------------------------------------------
bool ApplyJoystickForce(int joy, int force, int times)
{
if (joy >= 0 && joy < (int)g_Joysticks.size() && g_Joysticks[joy].haptic) {
Uint32 iters = (times < 0 ? SDL_HAPTIC_INFINITY : times);
return SDL_HapticRunEffect(g_Joysticks[joy].haptic, force, iters) == 0;
}
return false;
}
//-----------------------------------------------------------------
bool StopJoystickForce(int joy, int force)
{
if (joy >= 0 && joy < (int)g_Joysticks.size() && g_Joysticks[joy].haptic) {
return SDL_HapticStopEffect(g_Joysticks[joy].haptic, force) == 0;
}
return false;
}
//-----------------------------------------------------------------
bool StopAllJoystickForces(int joy)
{
if (joy >= 0 && joy < (int)g_Joysticks.size() && g_Joysticks[joy].haptic) {
return SDL_HapticStopAll(g_Joysticks[joy].haptic) == 0;
}
return false;
}
//-----------------------------------------------------------------
void DestroyJoystickForce(int joy, int force)
{
if (joy >= 0 && joy < (int)g_Joysticks.size() && g_Joysticks[joy].haptic) {
SDL_HapticDestroyEffect(g_Joysticks[joy].haptic, force);
}
}
namespace internal {
//-----------------------------------------------------------------
bool InitInput(const Log& log)
{
// initialize SDL
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) != 0) {
log.error() << "Could not initialize SDL: " << SDL_GetError();
return false;
}
// ensure SDL will be properly deinitialized
atexit(SDL_Quit);
// disable joystick events, we are not using SDL's event system
SDL_JoystickEventState(SDL_IGNORE);
// open all available joysticks
int num_joysticks = SDL_NumJoysticks();
if (num_joysticks > 0) {
for (int i = 0; i < num_joysticks; ++i) {
std::string name = SDL_JoystickName(i);
// open joystick
SDL_Joystick* joystick = SDL_JoystickOpen(i);
if (!joystick) {
log.error() << "Could not open joystick " << i << ": " << SDL_GetError();
return false;
}
// get capabilities
int num_buttons = SDL_JoystickNumButtons(joystick);
int num_axes = SDL_JoystickNumAxes(joystick);
int num_hats = SDL_JoystickNumHats(joystick);
// open haptic, if available
SDL_Haptic* haptic = SDL_HapticOpenFromJoystick(joystick);
log.info() << "Joystick " \
<< i \
<< " (" \
<< name \
<< "): " \
<< num_buttons \
<< " buttons, " \
<< num_axes \
<< " axes, " \
<< num_hats \
<< " POV hats, " \
<< (haptic ? "supports" : "does not support") \
<< " force feedback";
// create joystick
Joystick j;
j.joystick = joystick;
j.haptic = haptic;
j.name = name;
// initialize buttons
j.buttons.resize(num_buttons);
for (size_t button = 0; button < j.buttons.size(); button++) {
j.buttons[button] = RELEASED;
}
// initialize axes
j.axes.resize(num_axes);
for (size_t axis = 0; axis < j.axes.size(); axis++) {
j.axes[axis] = 0;
}
// initialize hats
j.hats.resize(num_hats);
for (size_t hat = 0; hat < j.hats.size(); hat++) {
j.hats[hat] = JOY_HAT_CENTERED;
}
// store joystick
g_Joysticks.push_back(j);
}
} else {
log.info() << "No joysticks available";
}
return true;
}
//-----------------------------------------------------------------
void DeinitInput()
{
// close joysticks and their haptic devices
for (size_t i = 0; i < g_Joysticks.size(); ++i) {
if (g_Joysticks[i].haptic) {
SDL_HapticClose(g_Joysticks[i].haptic);
}
SDL_JoystickClose(g_Joysticks[i].joystick);
}
g_Joysticks.clear();
// quit SDL subsystems
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
//-----------------------------------------------------------------
void UpdateInput()
{
// update joysticks
SDL_JoystickUpdate();
for (size_t joy = 0; joy < g_Joysticks.size(); joy++) {
// update buttons
for (size_t button = 0; button < g_Joysticks[joy].buttons.size(); button++) {
g_Joysticks[joy].buttons[button] = SDL_JoystickGetButton(g_Joysticks[joy].joystick, button);
}
// update axes
for (size_t axis = 0; axis < g_Joysticks[joy].axes.size(); axis++) {
g_Joysticks[joy].axes[axis] = (int)(SDL_JoystickGetAxis(g_Joysticks[joy].joystick, axis) / 327.67f);
}
// update hats
for (size_t hat = 0; hat < g_Joysticks[joy].hats.size(); hat++) {
int value = JOY_HAT_CENTERED;
switch (SDL_JoystickGetHat(g_Joysticks[joy].joystick, hat)) {
case SDL_HAT_UP: value = JOY_HAT_UP; break;
case SDL_HAT_RIGHT: value = JOY_HAT_RIGHT; break;
case SDL_HAT_DOWN: value = JOY_HAT_DOWN; break;
case SDL_HAT_LEFT: value = JOY_HAT_LEFT; break;
case SDL_HAT_RIGHTUP: value = JOY_HAT_RIGHTUP; break;
case SDL_HAT_RIGHTDOWN: value = JOY_HAT_RIGHTDOWN; break;
case SDL_HAT_LEFTUP: value = JOY_HAT_LEFTUP; break;
case SDL_HAT_LEFTDOWN: value = JOY_HAT_LEFTDOWN; break;
};
g_Joysticks[joy].hats[hat] = value;
}
}
}
} // namespace internal
} // namespace input
} // namespace sphere
|
0c7e092c82135e1a35e3b5d2842f1e5cad31b950 | a1809f8abdb7d0d5bbf847b076df207400e7b08a | /Simpsons Hit&Run/game/libs/pure3d/p3d/refcounted.cpp | 9560b1aed236d4abe52b14f7c7cb7fc73fb8ca9e | [] | no_license | RolphWoggom/shr.tar | 556cca3ff89fff3ff46a77b32a16bebca85acabf | 147796d55e69f490fb001f8cbdb9bf7de9e556ad | refs/heads/master | 2023-07-03T19:15:13.649803 | 2021-08-27T22:24:13 | 2021-08-27T22:24:13 | 400,380,551 | 8 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 764 | cpp | refcounted.cpp | //=============================================================================
// Copyright (c) 2002 Radical Games Ltd. All rights reserved.
//=============================================================================
#include <p3d/refcounted.hpp>
#include <p3d/error.hpp>
#include <p3d/utility.hpp>
//#include <radmemory.hpp>
#include <string.h>
// Overloaded allocator/deallocatorry ref counted objects
void* tRefCountedTemp::operator new(size_t size)
{
void *memPtr = p3d::MallocTemp(size); // get the memory
#ifdef RADLOAD_HEAP_DEBUGGING
radLoadHeapDebugAddAddress( memPtr );
#endif
return memPtr;
}
void tRefCountedTemp::operator delete(void *ptr)
{
p3d::FreeTemp(ptr);
}
|
972a6d17a483d4ac4c1b43a335d091d8dd68b193 | 7daf22d2ac55a3c2ef54b4102451f7a9a79662b8 | /algorithms/cpp/longestCommonPrefix/longestCommonPrefix.cpp | c88d36e793e233fb013991325e93f2a2b922d28d | [] | no_license | RobinC94/leetcode | 63691fc7766cefeedac3299acb283a182f3f2ded | ccec111075eb3327974058868650da86b37f1da5 | refs/heads/master | 2021-04-18T21:38:16.789390 | 2020-09-11T11:01:31 | 2020-09-11T11:01:31 | 126,580,222 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,097 | cpp | longestCommonPrefix.cpp | // Source : https://oj.leetcode.com/problems/longest-common-prefix/
// Author : Robin Chen
// Date : 2018.4.1
/**********************************************************************************
*
* Write a function to find the longest common prefix string amongst an array of strings.
*
*
**********************************************************************************/
// ๆ่ทฏๅพ็ฎๅ
// ๆณจๆ็ๆฏstring่ฝ็ถๅฅฝ็จ๏ผไฝๆฏๅ่ฝไธๆฏๆ ้ๅค
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if (strs.size()==0) return "";
string s = strs[0];
for(auto str:strs){
int len = str.length();
if(len == 0) return "";
if(s.length()>len)
s=s.erase(len);
for (int i = 0; i<len ;++i){
if(s[i] == '\0') break;
if(str[i] != s[i]){
s = s.erase(i);
break;
}
}
}
return s;
}
};
// Status: Accepted
// Runtime: 9 ms
// 33.34%
|
b7e993a51262334b58720b7350c57b11cbd02a8c | aaf75a8db5b5d0993e1e6f03c77265fa88309fac | /cli/process_requests.hpp | bb449e2d1d177166e71642d1713afa741c6f7137 | [] | no_license | hanchon/bitprim-dojo | 8849abc416a08f62fe2991f793b41b3ab1355f23 | 297ccc1063cf7c355021c870680e9ac680a33612 | refs/heads/master | 2021-07-24T10:27:00.565138 | 2018-07-06T01:58:41 | 2018-07-06T02:02:52 | 135,053,018 | 0 | 1 | null | 2018-06-16T00:29:05 | 2018-05-27T14:18:54 | C++ | UTF-8 | C++ | false | false | 11,723 | hpp | process_requests.hpp | //
// Created by hanchon on 6/3/18.
//
#ifndef BITPRIM_DOJO_PROCESS_REQUESTS_HPP
#define BITPRIM_DOJO_PROCESS_REQUESTS_HPP
#include <string>
#include <bitcoin/bitcoin.hpp>
#include <wallet/wallet_functions.hpp>
#include <simple_web_client/requester.hpp>
#include <wallet/transaction_functions.hpp>
namespace bitprim {
// CONSTS
// TODO: set this value using a configuration file
static const std::string SERVER = "localhost:18332";
// Utis:
bool char_to_bool(char *in, bool &out) {
// char * can only be "true" or "false"
std::stringstream ss(in);
if (!(ss >> std::boolalpha >> out)) {
return false;
}
return true;
}
std::vector<std::string> comma_delimited_to_array(char *argv) {
std::vector<std::string> result;
std::stringstream raw(argv);
while (raw.good()) {
std::string substr;
getline(raw, substr, ',');
result.push_back(substr);
}
return result;
}
// TODO: validate parameters types and count
// TODO: split this file in subclasses
/************** WALLET FUNCTIONS **************/
std::string process_priv_key(int argc, char *argv[]) {
// example: priv_key aaeb587496cc54912bbcef874fa9a61c
bitprim_wallet wallet_functions;
auto priv_key = wallet_functions.generate_priv_key(argv[2]);
return libbitcoin::encode_base16(priv_key);
}
std::string process_seed_to_wif(int argc, char *argv[]) {
// example: seed_to_wif aaeb587496cc54912bbcef874fa9a61c true
// the bool parameter is mainnet/testnet (mainnet = true)
bitprim_wallet wallet_functions;
auto priv_key = wallet_functions.generate_priv_key(argv[2]);
bool mainnet;
if (!char_to_bool(argv[3], mainnet)) {
return "Bool parsing error";
}
return wallet_functions.priv_key_to_wif(priv_key, mainnet);
}
std::string process_seed_to_pub(int argc, char *argv[]) {
// example: seed_to_pub aaeb587496cc54912bbcef874fa9a61c true
// the bool parameter is compressed or not (compressed = true)
bitprim_wallet wallet_functions;
auto priv_key = wallet_functions.generate_priv_key(argv[2]);
bool compress;
if (!char_to_bool(argv[3], compress)) {
return "Bool parsing error";
}
return wallet_functions.priv_key_to_public(priv_key, compress).encoded();
}
std::string process_seed_to_wallet(int argc, char *argv[]) {
// example: seed_to_wallet aaeb587496cc54912bbcef874fa9a61c true true
// first bool parameter is compressed (compressed = true)
// second bool parameter is mainnet/testnet (mainnet = true)
bitprim_wallet wallet_functions;
auto priv_key = wallet_functions.generate_priv_key(argv[2]);
bool compress;
if (!char_to_bool(argv[3], compress)) {
return "Bool parsing error";
}
auto pub_key = wallet_functions.priv_key_to_public(priv_key, compress).encoded();
bool mainnet;
if (!char_to_bool(argv[4], mainnet)) {
return "Bool parsing error";
}
auto new_wallet = wallet_functions.pub_key_to_addr(pub_key, mainnet);
return new_wallet.encoded();
}
#ifdef BITPRIM_CURRENCY_BCH
std::string process_seed_to_cashaddr(int argc, char *argv[]) {
// example: seed_to_cashaddr aaeb587496cc54912bbcef874fa9a61c true true
// first bool parameter is compressed (compressed = true)
// second bool parameter is mainnet/testnet (mainnet = true)
bitprim_wallet wallet_functions;
auto priv_key = wallet_functions.generate_priv_key(argv[2]);
bool compress;
if (!char_to_bool(argv[3], compress)) {
return "Bool parsing error";
}
auto pub_key = wallet_functions.priv_key_to_public(priv_key, compress).encoded();
bool mainnet;
if (!char_to_bool(argv[4], mainnet)) {
return "Bool parsing error";
}
auto new_wallet = wallet_functions.pub_key_to_addr(pub_key, mainnet);
return new_wallet.encoded_cashaddr();
}
#endif
/************** RPC FUNCTIONS **************/
std::string process_rpc_call(std::string method, std::string params) {
http_requester requester(SERVER);
std::string query = requester.create_query(method, params);
auto reply = requester.request(query);
if (reply.first) {
return reply.second;
} else {
return "RPC call failed";
}
}
std::string process_getinfo(int argc, char *argv[]) {
// example: getinfo
return process_rpc_call("getinfo", "\"\"");
}
std::string process_getrawtransaction(int argc, char *argv[]) {
return process_rpc_call("getrawtransaction", argv[2]);
}
std::string process_getaddressbalance(int argc, char *argv[]) {
return process_rpc_call("getaddressbalance", argv[2]);
}
std::string process_getspentinfo(int argc, char *argv[]) {
return process_rpc_call("getspentinfo", argv[2]);
}
std::string process_getaddresstxids(int argc, char *argv[]) {
// example: getaddresstxids, "[{\"addresses\": [\"n3GNqMveyvaPvUbH469vDRadqpJMPc84JA\"]}]"
return process_rpc_call("getaddresstxids", argv[2]);
}
std::string process_getaddressdeltas(int argc, char *argv[]) {
return process_rpc_call("getaddressdeltas", argv[2]);
}
std::string process_getaddressutxos(int argc, char *argv[]) {
return process_rpc_call("getaddressutxos", argv[2]);
}
std::string process_getblockhashes(int argc, char *argv[]) {
return process_rpc_call("getblockhashes", argv[2]);
}
std::string process_getaddressmempool(int argc, char *argv[]) {
return process_rpc_call("getaddressmempool", argv[2]);
}
std::string process_getbestblockhash(int argc, char *argv[]) {
return process_rpc_call("getbestblockhash", argv[2]);
}
std::string process_getblock(int argc, char *argv[]) {
return process_rpc_call("getblock", argv[2]);
}
std::string process_getblockhash(int argc, char *argv[]) {
return process_rpc_call("getblockhash", argv[2]);
}
std::string process_getblockchaininfo(int argc, char *argv[]) {
return process_rpc_call("getblockchaininfo", argv[2]);
}
std::string process_getblockheader(int argc, char *argv[]) {
return process_rpc_call("getblockheader", argv[2]);
}
std::string process_getblockcount(int argc, char *argv[]) {
return process_rpc_call("getblockcount", argv[2]);
}
std::string process_getdifficulty(int argc, char *argv[]) {
return process_rpc_call("getdifficulty", argv[2]);
}
std::string process_getchaintips(int argc, char *argv[]) {
return process_rpc_call("getchaintips", argv[2]);
}
std::string process_validateaddress(int argc, char *argv[]) {
return process_rpc_call("validateaddress", argv[2]);
}
std::string process_getblocktemplate(int argc, char *argv[]) {
return process_rpc_call("getblocktemplate", argv[2]);
}
std::string process_getmininginfo(int argc, char *argv[]) {
return process_rpc_call("getmininginfo", argv[2]);
}
std::string process_submitblock(int argc, char *argv[]) {
return process_rpc_call("submitblock", argv[2]);
}
std::string process_sendrawtransaction(int argc, char *argv[]) {
return process_rpc_call("sendrawtransaction", argv[2]);
}
/************** TRANSACTION FUNCTIONS **************/
std::string process_create_txn(int argc, char *argv[]) {
// example: create_txn -i "980de6ce12c29698d54323c6b0f358e1a9ae867598b840ee0094b9df22b07393:1" -o "mwx2YDHgpdfHUmCpFjEi9LarXf7EkQN6YG:199999000" -m ""
std::vector<std::string> inputs;
std::vector<std::string> outputs;
std::string message = "";
// Parse values
for (int i = 1; i < argc; ++i) {
if (std::string(argv[i]) == "-i") {
if (i + 1 < argc) {
inputs = comma_delimited_to_array(argv[++i]);
} else {
return "Error, inputs requires one argument";
}
} else if (std::string(argv[i]) == "-o") {
if (i + 1 < argc) {
outputs = comma_delimited_to_array(argv[++i]);
} else {
return "Error, outputs requires one argument";
}
} else if (std::string(argv[i]) == "-m") {
if (i + 1 < argc) {
message = argv[++i];
} else {
return "Error, message requires one argument";
}
}
}
// Create txn
bitprim::bitprim_transaction transaction;
return transaction.tx_encode(inputs, outputs, message);
}
std::string process_create_signature(int argc, char *argv[]) {
// example: create_signature
// -seed "fffb587496cc54912bbcef874fa9a61a"
// -script "dup hash160 [b43ff4532569a00bcab4ce60f87cdeebf985b69a] equalverify checksig"
// -amount "200000000"
// -txn "01000000019373b022dfb99400ee40b8987586aea9e158f3b0c62343d59896c212cee60d980100000000ffffffff0118beeb0b000000001976a914b43ff4532569a00bcab4ce60f87cdeebf985b69a88ac00000000"
// TODO: add index, by default it signs the input 0
std::string seed;
std::string script;
uint64_t amount;
std::string txn;
// Parse values
for (int i = 1; i < argc; ++i) {
if (std::string(argv[i]) == "-seed") {
if (i + 1 < argc) {
seed = argv[++i];
} else {
return "Error, seed requires one argument";
}
} else if (std::string(argv[i]) == "-script") {
if (i + 1 < argc) {
script = argv[++i];
} else {
return "Error, script requires one argument";
}
} else if (std::string(argv[i]) == "-txn") {
if (i + 1 < argc) {
txn = argv[++i];
} else {
return "Error, txn requires one argument";
}
} else if (std::string(argv[i]) == "-amount") {
if (i + 1 < argc) {
std::stringstream temp(argv[++i]);
temp >> amount;
} else {
return "Error, amount requires one argument";
}
}
}
// Seed to private
bitprim::bitprim_wallet wallet_functions;
const auto priv_key = wallet_functions.generate_priv_key(seed);
const auto priv_key_string = libbitcoin::encode_base16(priv_key);
// Sign the txn
bitprim::bitprim_transaction transaction;
return transaction.input_signature(priv_key_string, script, txn, amount);
}
std::string process_set_input_script(int argc, char *argv[]) {
// example: set_input_script
// -seed "fffb587496cc54912bbcef874fa9a61a"
// -signature "30440220433c405e4cb7698ad5f58e0ea162c3c3571d46d96ff1b3cb9232a06eba3b444d02204bc5f48647c0f052ade7cf85eac3911f7afbfa69fa5ebd92084191a5da33f88d41"
// -txn "01000000019373b022dfb99400ee40b8987586aea9e158f3b0c62343d59896c212cee60d980100000000ffffffff0118beeb0b000000001976a914b43ff4532569a00bcab4ce60f87cdeebf985b69a88ac00000000"
// TODO: add index, by default it sets the input 0
// TODO: create a new function that accepts pub_key instead of seed in case the user wants privacy
// TODO: the current code only set compressed public keys (created from the seed), it can be parametrized to support the no-compressed format
std::string seed;
std::string signature;
std::string txn;
// Parse values
for (int i = 1; i < argc; ++i) {
if (std::string(argv[i]) == "-seed") {
if (i + 1 < argc) {
seed = argv[++i];
} else {
return "Error, seed requires one argument";
}
} else if (std::string(argv[i]) == "-signature") {
if (i + 1 < argc) {
signature = argv[++i];
} else {
return "Error, signature requires one argument";
}
} else if (std::string(argv[i]) == "-txn") {
if (i + 1 < argc) {
txn = argv[++i];
} else {
return "Error, txn requires one argument";
}
}
}
// Seed to private
bitprim::bitprim_wallet wallet_functions;
const auto priv_key = wallet_functions.generate_priv_key(seed);
// Private to public
auto pub_key = wallet_functions.priv_key_to_public(priv_key, true);
// Set the script
bitprim::bitprim_transaction transaction;
return transaction.input_set(signature, pub_key.encoded(), txn);
}
std::string process_new_seed(int argc, char *argv[]) {
bitprim::bitprim_wallet wallet_functions;
return wallet_functions.new_seed();
}
}// end namespace bitprim
#endif //BITPRIM_DOJO_PROCESS_REQUESTS_HPP
|
a0c7983515df46ae5a2da476532b13a3bc679c7a | e17a68cd5152658c05599b3d7f52b22c1319a019 | /Maquina_de_busca/consulta.cpp | 5561e3a2082d09cef07f9d099de88d522e6cfef1 | [] | no_license | BrunaoW/Maquina_de_Busca | ab03f6217dd719d0f8b2e3cb1ceda5c590181118 | 4b3a1cd99f029b23ffadfc92441fad6f1212084f | refs/heads/master | 2020-05-17T05:21:42.984690 | 2019-06-13T22:42:44 | 2019-06-13T22:42:44 | 183,532,251 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,253 | cpp | consulta.cpp | #include "consulta.h"
Consulta::Consulta()
{
}
map<Palavra, double> Consulta::ObterCoordenada()
{
return coordenada_.ObterPosicao();
}
Consulta::~Consulta()
{
}
void Consulta::AtribuirCoordenada(Coordenada coordenada)
{
this->coordenada_ = coordenada;
}
void Consulta::CalcularCoordenadasParaPalavras(IndiceInvertido& indiceInvertido, int numeroDeDocumentos)
{
for (auto& palavra : palavras_) {
double tf = palavra.second;
double quantidadeDeDocumentosAssociadosAPalavra = indiceInvertido.BuscarQuantidadeDeDocumentosAssociadosAUmaPalavra(palavra.first);
double idf = log10(quantidadeDeDocumentosAssociadosAPalavra == 0 ? 1 : numeroDeDocumentos / quantidadeDeDocumentosAssociadosAPalavra);
this->coordenada_.AtualizarValorDaPalavra(palavra.first, tf * idf);
}
}
void Consulta::AtribuirPalavras(string frase)
{
char* fraseASeparar = &frase[0u];
char* tokenSeparador = new char(' ');
strtok(fraseASeparar, tokenSeparador);
while (fraseASeparar != NULL) {
string fraseAAdicionar(fraseASeparar);
LeituraArquivos::NormalizarPalavra(fraseAAdicionar);
this->palavras_[Palavra(fraseAAdicionar)]++;
fraseASeparar = strtok(NULL, tokenSeparador);
}
}
map<Palavra, int> Consulta::ObterPalavras()
{
return this->palavras_;
}
|
7377813987121ebbd9e2cad755920095639dfb3e | e245c0b9e6a011f5017f85a1d144b75f0a2ab376 | /ambarella/app/cloud/common/base/runtime_config/xml/runtime_config_xml.h | 8accdfdb10e567a40254a74d54d8ebee69c8f8e7 | [] | no_license | EricChen2013/SS001_SDK2.6 | e31172cc2edb6933a6f93d5697dd4df1a7f66f59 | d536bb6cf699b9b4959c0dded6c3ef238668d503 | refs/heads/master | 2016-10-19T04:27:45.668386 | 2016-05-11T03:08:53 | 2016-05-11T03:08:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,798 | h | runtime_config_xml.h | /**
* runtime_config_xml.h
*
* History:
* 2013/05/24- [Zhi He] create file
*
* Copyright (C) 2014 - 2024, the Ambarella Inc.
*
* All rights reserved. No Part of this file may be reproduced, stored
* in a retrieval system, or transmitted, in any form, or by any means,
* electronic, mechanical, photocopying, recording, or otherwise,
* without the prior consent of the Ambarella Inc.
*/
#ifndef __RUNTIME_CONFIG_XML_H__
#define __RUNTIME_CONFIG_XML_H__
DCONFIG_COMPILE_OPTION_HEADERFILE_BEGIN
DCODE_DELIMITER;
#if 0
#define DMEDIA_CONFIGFILE_DEFAULT_NAME "media.config"
#define DLOG_CONFIGFILE_DEFAULT_NAME "log.config"
#define DMEDIA_CONFIGFILE_ROOT_NAME "MediaConfig"
#define DLOG_CONFIGFILE_ROOT_NAME "LogConfig"
#endif
class CXMLRunTimeConfigAPI: public CObject, public IRunTimeConfigAPI
{
public:
CXMLRunTimeConfigAPI();
virtual ~CXMLRunTimeConfigAPI();
public:
virtual ERunTimeConfigType QueryConfigType() const;
virtual EECode OpenConfigFile(const TChar *config_file_name, TU8 read_or_write = 0, TU32 read_once = 0);
virtual EECode GetContentValue(const TChar *content_path, TChar *content_value);
virtual EECode SetContentValue(const TChar *content_path, TChar *content_value);
virtual EECode SaveConfigFile(const TChar *config_file_name);
virtual EECode CloseConfigFile();
virtual EECode NewFile(const TChar *root_name, void *&root_node);
virtual void *AddContent(void *p_parent, const TChar *content_name);
virtual void *AddContentChild(void *p_parent, const TChar *child_name, const TChar *value);
virtual EECode FinalizeFile(const TChar *file_name);
private:
xmlDocPtr mpDoc;
xmlNodePtr mpRootNode;
xmlXPathContextPtr mpContext;
};
DCONFIG_COMPILE_OPTION_HEADERFILE_END
#endif//__RUNTIME_CONFIG_XML_H__
|
a7931b5bec38f888b243dd4e150662412ad7a6de | 05c98687243a5b15602e4fdcddc14d23582be12f | /Assignment_2/src/reactive_robot/main.cpp | 06b6259eb37a62528e078f4b91d4e2a46d27d713 | [] | no_license | FilipeMRibeiro/FEUP-ROBO | 85713ef8884596ccac0a5e54af76ce2bb98fbff1 | ac7fd8735b567fd60850bbe98d9e0296f0331cbd | refs/heads/master | 2021-04-28T07:44:24.758619 | 2018-01-02T14:50:31 | 2018-01-02T14:50:31 | 122,230,385 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,646 | cpp | main.cpp | #include <ros/ros.h>
#include <geometry_msgs/Twist.h>
#include <limits>
#include <sensor_msgs/LaserScan.h>
#include <string>
using namespace std;
// handle conversion between radians and degrees
#define PI 3.14159265358979323846
float toDegrees(float angle) { return angle * (180 / PI); }
float toRadians(float angle) { return angle * (PI / 180); }
ros::Publisher publisher;
// callback function to process arriving laser readings
void laserReadingReceived(const sensor_msgs::LaserScan& msg)
{
geometry_msgs::Twist response;
float distanceRightSide = numeric_limits<float>::max();
float distanceLeftSide = numeric_limits<float>::max();
float robotAngle = 0.0;
// for each of the laser rays...
for(int i = 0; i < msg.ranges.size(); i++)
{
float distance = msg.ranges[i];
float rayAngle = -100 + toDegrees(msg.angle_increment) * i;
// obtain minimum distance from robot's right side
if (rayAngle >= -100 && rayAngle <= 0)
{
if(distance < distanceRightSide)
{
distanceRightSide = distance;
robotAngle = rayAngle;
}
}
// obtain minimum distance from robot's left side
else if (rayAngle > 0 && rayAngle <= 100)
{
if(distance < distanceLeftSide)
{
distanceLeftSide = distance;
robotAngle = rayAngle;
}
}
}
float minWallDistance = min(distanceRightSide, distanceLeftSide);
float alpha = 90.0 - abs(robotAngle);
// check if wall is within the sensor range
if(minWallDistance <= msg.range_max)
{
// follow the wall
response.linear.x = 0.4;
response.angular.z = (-20 * (sin(toRadians(alpha)) - (minWallDistance - 1.46))) * response.linear.x;
}
else
{
// go forward
response.linear.x = 0.4;
response.angular.z = 0.0;
}
publisher.publish(response);
}
// main function
int main(int argc, char** argv)
{
// verify if number of arguments passed is valid
if(argc != 3)
{
ROS_ERROR_STREAM("Usage : reactive_robot <STDR_robot_id> <STDR_laser_frame_id>");
exit(-1);
}
// initialize the ROS system and become a node
ros::init(argc, argv, "reactive_robot");
ros::NodeHandle nh;
// subscribes to topic '/<STDR_robot_id>/<STDR_laser_frame_id>'
// to obtain laser readings
string subTopic = "/"+ string(argv[1]) + "/" + string(argv[2]);
ros::Subscriber subscriber = nh.subscribe(subTopic, 1, &laserReadingReceived);
// advertise to topic '/<STDR_robot_id>/cmd_vel'
// in order to change robot orientation and velocity
string pubTopic = string("/") + string(argv[1]) + string("/cmd_vel");
publisher = nh.advertise<geometry_msgs::Twist>(pubTopic, 1);
// let ROS take over
ros::spin();
return 0;
}
|
eb06670c196346a0e93b5bb8fd84b585efcd1af6 | 951f4bcf0c99630a7d60f9facd1fb11a9e887568 | /session10a/Mouse.cpp | a1e4937402f13afc151b1db34b920fd341f69f3b | [] | no_license | utec-cs1102-2019-2/ec1 | f387ae34a5a42102216f886c4c210b3ecc1ba254 | 6494f54b4f220f41547740c2ddc12b85a2992992 | refs/heads/master | 2020-07-24T10:58:10.003131 | 2019-11-27T21:38:34 | 2019-11-27T21:38:34 | 207,901,124 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 313 | cpp | Mouse.cpp | #include "Mouse.h"
#include <iostream>
using namespace std;
void Mouse::printDescripcion(){
cout<<"-----------------------"<<endl;
cout<<"Mouse features:"<<endl;
cout<<this->color[0]<<" "<<this->color[1] << this->color[2]<<endl ;
cout<<this->precision<<endl;
cout<<"-----------------------";
} |
2266edc61ae7b4487b43759ca971f69d6b1abb7f | f20e965e19b749e84281cb35baea6787f815f777 | /LHCb/Hlt/HltDAQ/src/HltDiffHltDecReports.cpp | 51561c1fe98847bd2af55226b1927990876e63f1 | [] | no_license | marromlam/lhcb-software | f677abc9c6a27aa82a9b68c062eab587e6883906 | f3a80ecab090d9ec1b33e12b987d3d743884dc24 | refs/heads/master | 2020-12-23T15:26:01.606128 | 2016-04-08T15:48:59 | 2016-04-08T15:48:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,868 | cpp | HltDiffHltDecReports.cpp | // $Id: HltDiffHltDecReports.cpp,v 1.1.1.1 2009-06-24 15:38:52 tskwarni Exp $
// Include files
// from Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
#include "Event/HltDecReports.h"
#include <iterator>
class HltDiffHltDecReports : public GaudiAlgorithm {
public:
/// Standard constructor
HltDiffHltDecReports( const std::string& name, ISvcLocator* pSvcLocator );
~HltDiffHltDecReports() override = default; ///< Destructor
StatusCode execute () override; ///< Algorithm execution
private:
std::string m_lhs;
std::string m_rhs;
};
//-----------------------------------------------------------------------------
// Implementation file for class : HltDiffHltDecReports
//
// 2009-05-26 : Gerhard Raven
//-----------------------------------------------------------------------------
DECLARE_ALGORITHM_FACTORY( HltDiffHltDecReports )
//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
HltDiffHltDecReports::HltDiffHltDecReports( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiAlgorithm ( name , pSvcLocator )
{
declareProperty("HltDecReportsLHS",m_lhs);
declareProperty("HltDecReportsRHS",m_rhs);
}
//=============================================================================
// Main execution
//=============================================================================
StatusCode
HltDiffHltDecReports::execute() {
// grab the two reports...
auto lhs = get<LHCb::HltDecReports>( m_lhs );
auto rhs = get<LHCb::HltDecReports>( m_rhs );
if (lhs->configuredTCK() != rhs->configuredTCK() ) {
always() << " configuredTCK: "
<< m_lhs << " : " << lhs->configuredTCK()
<< m_rhs << " : " << rhs->configuredTCK()
<< endmsg;
}
auto l = lhs->begin(), r = rhs->begin();
while ( l != lhs->end() || r != rhs->end()) {
auto rend = ( r == rhs->end() );
auto lend = ( l == lhs->end() );
if ( !lend && ( rend || l->first < r->first )) {
always() << " only in " << m_lhs << " : " << l->first << " : " << l->second << endmsg;
++l;
} else if ( !rend && ( lend || r->first < l->first ) ) {
always() << " only in " << m_rhs << " : " << r->first << " : " << r->second << endmsg;
++r;
} else {
if ( l->second.decReport() != r->second.decReport()) {
always() << " dif: " << l->first << " : " << l->second << " <-> " << r->second << endmsg;
} else {
// always() << " match: " << l->first << " : " << l->second << endmsg;
}
++l;
++r;
}
}
return StatusCode::SUCCESS;
}
|
b0d711f96c3e82f6e6064b7f30b4540863d199c0 | 2d9fc118ad13bae59803d96fca34096ebcedfcee | /src/lvm_wt/lvm_wt_bin_map_item.cpp | f5d722b8c671f9b4bf377f493046a5fd83546c44 | [] | no_license | MetaBarj0/test_driven_bin_mapping | 436619bff2daa60a20204a9e49f1c6df85d326dc | 49a4f02765c4508e4cf0d05ef2faf8494917e811 | refs/heads/master | 2020-05-01T16:10:42.409136 | 2018-11-14T14:41:56 | 2018-12-05T20:54:18 | 177,565,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 785 | cpp | lvm_wt_bin_map_item.cpp | #include "lvm_wt_bin_map_item.h"
#include "common/string_manipulations.h"
#include <utility>
namespace Qx
{
namespace BinMapping
{
LvmWtBinMapItem::LvmWtBinMapItem(std::string &&aTestName, int aTestNumber, int aBinNumber, std::string &&aBinName) noexcept :
mTestName{ Qx::TrimStringLeftSideOf( std::move( aTestName ), ' ' ) },
mTestNumber{ aTestNumber },
mBinNumber{ aBinNumber },
mBinName{ std::move( aBinName ) } {}
const std::string & LvmWtBinMapItem::GetTestName() const noexcept
{
return mTestName;
}
int LvmWtBinMapItem::GetTestNumber() const noexcept
{
return mTestNumber;
}
int LvmWtBinMapItem::GetBinNumber() const noexcept
{
return mBinNumber;
}
const std::string & LvmWtBinMapItem::GetBinName() const noexcept
{
return mBinName;
}
}
} |
7f484336cf451fd0ea031971e50de3f9567299e4 | 4bf4c257299f2e70b387483cb348c5060ede309d | /NDNc/face/transport.hpp | 7ae1c2dffb6f15d0c7cd1b18023fcace01ff8b30 | [
"MIT"
] | permissive | cmscaltech/sandie-ndn | ba436f1b7c1c923cc0e0147b91e2de7ee14d3f19 | 528efdaaa6da4b6528b12b201f2648f54088503b | refs/heads/master | 2023-08-15T08:36:54.891243 | 2023-07-22T11:13:04 | 2023-07-22T11:13:04 | 136,227,335 | 6 | 4 | MIT | 2023-02-25T09:43:21 | 2018-06-05T19:49:51 | C++ | UTF-8 | C++ | false | false | 2,902 | hpp | transport.hpp | /*
* N-DISE: NDN for Data Intensive Science Experiments
* Author: Catalin Iordache <catalin.iordache@cern.ch>
*
* MIT License
*
* Copyright (c) 2021 California Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef NDNC_FACE_TRANSPORT_HPP
#define NDNC_FACE_TRANSPORT_HPP
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include <ndn-cxx/encoding/block.hpp>
namespace ndnc {
namespace face {
namespace transport {
class Transport {
public:
using OnDisconnectCallback = void (*)(void *ctx);
using OnReceiveCallback = void (*)(void *ctx, const ndn::Block &&pkt);
public:
virtual bool connect() noexcept = 0;
virtual bool isConnected() noexcept = 0;
virtual bool loop() noexcept = 0;
virtual int send(const ndn::Block pkt) noexcept = 0;
virtual int send(const std::vector<ndn::Block> *pkts,
uint16_t n) noexcept = 0;
void setOnDisconnectCallback(OnDisconnectCallback cb, void *ctx) noexcept {
this->onDisconnectCtx = ctx;
this->onDisconnect = cb;
}
void setOnReceiveCallback(OnReceiveCallback cb, void *ctx) noexcept {
this->onReceiveCtx = ctx; // face object
this->onReceive = cb;
}
protected:
void disconnect() noexcept {
if (onDisconnect != nullptr && onDisconnectCtx != nullptr) {
onDisconnect(onDisconnectCtx);
}
}
void receive(const ndn::Block &&pkt) noexcept {
if (onReceive != nullptr && onReceiveCtx != nullptr) {
onReceive(onReceiveCtx, std::move(pkt));
}
}
private:
void *onDisconnectCtx = nullptr;
void *onReceiveCtx = nullptr;
OnDisconnectCallback onDisconnect = nullptr;
OnReceiveCallback onReceive = nullptr;
};
}; // namespace transport
}; // namespace face
}; // namespace ndnc
#endif // NDNC_FACE_TRANSPORT_HPP
|
cde7316eacc720a0af63f108ab800b8da050cb1a | 9230eb69c9e43e3c330b4a1c6a1ce5a328535176 | /Sort/Problems/MergeSort/CollinearPoints/brute_collinear.cpp | 543e76d43a89a94feb5d3370e9072cbbdad74a70 | [] | no_license | babhijit/algo | c34e6d0599352eafecc039e10761e68417768bc9 | 33032474d109a9b8a89aa9129f1e6e6b8d94f5e5 | refs/heads/master | 2021-01-12T03:38:49.352834 | 2017-04-19T03:30:46 | 2017-04-19T03:30:46 | 78,245,449 | 0 | 2 | null | 2017-02-08T00:09:14 | 2017-01-06T23:04:16 | C++ | UTF-8 | C++ | false | false | 1,958 | cpp | brute_collinear.cpp | #include "brute_collinear.h"
#include <algorithm>
#include <map>
namespace algo {
namespace problems {
/**
* @brief This finds line segments (containing at least 4 collinear points).
* The line segment may also contain more than 4 collinear points
*
* @param line_segments : the output parameter that would contain the number of line segments found
* @return
*/
std::size_t BruteCollinear::get_line_segments(std::vector<LineSegment> *line_segments) {
std::vector<LineSegment>& lines = *line_segments;
for(auto first = std::begin(points_); first != std::end(points_); ++first) {
Point pt_first = *first;
for(auto second = std::next(first); second != std::end(points_); ++second) {
Point pt_second = *second;
double slope = pt_first.slope(pt_second);
for(auto third = std::next(second); third != std::end(points_); ++third) {
if(pt_first.slope(*third) == slope) {
for(auto fourth = std::next(third); fourth != std::end(points_); ++fourth) {
if(pt_first.slope(*fourth) == slope) {
LineSegment line_segment(pt_first, *fourth);
// look up to see if its already present or not
auto lines_itr = std::find_if(lines.begin(),
lines.end(),
[&line_segment](const LineSegment ls) { // the comparator lambda
return line_segment.slope() == ls.slope();
});
if(lines_itr == lines.end()) {
lines.push_back(line_segment);
} else {
if(*fourth < (*lines_itr).from_)
(*lines_itr).from_ = *fourth;
else if((*lines_itr).to_ < *fourth)
(*lines_itr).to_ = *fourth;
}
}
}
}
}
}
}
return lines.size();
}
}
}
|
2f4bb428ce149039e55f9a84d6e3cb6320fc0670 | 7e74e920ac19648aae67d4d0e6ab92a6ca31f2e8 | /src/server/JasmineGraphInstanceService.cpp | d565e0a435661955cdb34a667dac7769d8060c02 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"MIT"
] | permissive | miyurud/jasminegraph | ec0553969e5ee7a106f71763460292eeb7fb47e8 | 0112710523199eafcdc5193b50df67077d003dbf | refs/heads/master | 2023-08-17T15:59:07.513075 | 2023-08-10T14:10:40 | 2023-08-10T14:10:40 | 149,000,275 | 32 | 27 | Apache-2.0 | 2023-09-12T18:37:38 | 2018-09-16T13:50:05 | C | UTF-8 | C++ | false | false | 232,857 | cpp | JasmineGraphInstanceService.cpp | /**
Copyright 2018 JasminGraph Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "JasmineGraphInstanceService.h"
#include <cctype>
#include <cmath>
#include <string>
#include "../server/JasmineGraphServer.h"
#include "../util/logger/Logger.h"
#include "JasmineGraphInstance.h"
#include "../server/JasmineGraphServer.h"
#include <stdio.h>
using namespace std;
Logger instance_logger;
pthread_mutex_t file_lock;
pthread_mutex_t map_lock;
StatisticCollector collector;
int JasmineGraphInstanceService::partitionCounter = 0;
std::map<int, std::vector<std::string>> JasmineGraphInstanceService::iterationData;
const string JasmineGraphInstanceService::END_OF_MESSAGE = "eom";
int highestPriority = Conts::DEFAULT_THREAD_PRIORITY;
std::atomic<int> workerHighPriorityTaskCount;
std::mutex threadPriorityMutex;
std::vector<std::string> loadAverageVector;
bool collectValid = false;
char *converter(const std::string &s) {
char *pc = new char[s.size() + 1];
std::strcpy(pc, s.c_str());
return pc;
}
void *instanceservicesession(void *dummyPt) {
instanceservicesessionargs *sessionargs = (instanceservicesessionargs *)dummyPt;
int connFd = sessionargs->connFd;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores = sessionargs->graphDBMapLocalStores;
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores =
sessionargs->graphDBMapCentralStores;
std::map<std::string, JasmineGraphHashMapDuplicateCentralStore> graphDBMapDuplicateCentralStores =
sessionargs->graphDBMapDuplicateCentralStores;
std::map<std::string, JasmineGraphIncrementalLocalStore*> incrementalLocalStoreMap =
sessionargs->incrementalLocalStore;
string serverName = sessionargs->host;
string masterHost = sessionargs->masterHost;
string profile = sessionargs->profile;
int serverPort = sessionargs->port;
int serverDataPort = sessionargs->dataPort;
instance_logger.log("New service session started on thread " + to_string(pthread_self()), "info");
Utils utils;
collector.init();
utils.createDirectory(utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder"));
char data[INSTANCE_DATA_LENGTH + 1];
bool loop = false;
while (!loop) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string line = (data);
if (line.length() == 0) {
continue;
}
line = utils.trim_copy(line, " \f\n\r\t\v");
Utils utils;
line = utils.trim_copy(line, " \f\n\r\t\v");
if (line.compare(JasmineGraphInstanceProtocol::HANDSHAKE) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::HANDSHAKE, "info");
write(connFd, JasmineGraphInstanceProtocol::HANDSHAKE_OK.c_str(),
JasmineGraphInstanceProtocol::HANDSHAKE_OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::HANDSHAKE_OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
line = utils.trim_copy(line, " \f\n\r\t\v");
string server_hostname = line;
write(connFd, JasmineGraphInstanceProtocol::HOST_OK.c_str(), JasmineGraphInstanceProtocol::HOST_OK.size());
instance_logger.log("Received hostname : " + line, "info");
std::cout << "ServerName : " << server_hostname << std::endl;
} else if (line.compare(JasmineGraphInstanceProtocol::CLOSE) == 0) {
write(connFd, JasmineGraphInstanceProtocol::CLOSE_ACK.c_str(),
JasmineGraphInstanceProtocol::CLOSE_ACK.size());
close(connFd);
} else if (line.compare(JasmineGraphInstanceProtocol::SHUTDOWN) == 0) {
write(connFd, JasmineGraphInstanceProtocol::SHUTDOWN_ACK.c_str(),
JasmineGraphInstanceProtocol::SHUTDOWN_ACK.size());
close(connFd);
exit(0);
} else if (line.compare(JasmineGraphInstanceProtocol::READY) == 0) {
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
} else if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
// int fileSize = atoi(size.c_str());
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
string partitionID = rawname.substr(rawname.find_last_of("_") + 1);
pthread_mutex_lock(&file_lock);
writeCatalogRecord(graphID + ":" + partitionID);
pthread_mutex_unlock(&file_lock);
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CENTRAL) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CENTRAL, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_COMPOSITE_CENTRAL) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_COMPOSITE_CENTRAL, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::UPLOAD_RDF_ATTRIBUTES) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::UPLOAD_RDF_ATTRIBUTES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
// fileName = utils.trim_copy(fileName, " \f\n\r\t\v");
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::UPLOAD_RDF_ATTRIBUTES_CENTRAL) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::UPLOAD_RDF_ATTRIBUTES_CENTRAL, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
// fileName = utils.trim_copy(fileName, " \f\n\r\t\v");
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::DELETE_GRAPH) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::DELETE_GRAPH, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_PARTITION_ID.c_str(),
JasmineGraphInstanceProtocol::SEND_PARTITION_ID.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_PARTITION_ID, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
instance_logger.log("Received partition ID: " + partitionID, "info");
deleteGraphPartition(graphID, partitionID);
// pthread_mutex_lock(&file_lock);
// TODO :: Update catalog file
// pthread_mutex_unlock(&file_lock);
string result = "1";
write(connFd, result.c_str(), result.size());
instance_logger.log("Sent : " + result, "info");
} else if (line.compare(JasmineGraphInstanceProtocol::DELETE_GRAPH_FRAGMENT) == 0) {
// Conditional block for deleting all graph fragments when protocol is used
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::DELETE_GRAPH_FRAGMENT, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
// Read the message
read(connFd, data, INSTANCE_DATA_LENGTH);
// Get graph ID from message
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
// Method call for graph fragment deletion
removeGraphFragments(graphID);
// pthread_mutex_lock(&file_lock);
// TODO :: Update catalog file
// pthread_mutex_unlock(&file_lock);
string result = "1";
write(connFd, result.c_str(), result.size());
instance_logger.log("Sent : " + result, "info");
} else if (line.compare(JasmineGraphInstanceProtocol::DP_CENTRALSTORE) == 0) {
instance_logger.log("Received : DP_CENTRALSTORE from server", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
JasmineGraphInstanceService::duplicateCentralStore(serverPort, stoi(graphID), stoi(partitionID), workerSockets, "localhost");
} else if (line.compare(JasmineGraphInstanceProtocol::WORKER_IN_DEGREE_DISTRIBUTION) == 0) {
instance_logger.log("Received : In degree distribution to aggregator", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
map<long, long> degreeDistribution = calculateLocalInDegreeDist(graphID, partitionID,
graphDBMapLocalStores,
graphDBMapCentralStores);
instance_logger.log("In Degree Dist size: " + to_string(degreeDistribution.size()), "info");
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_idd_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, long>::iterator it = degreeDistribution.begin(); it != degreeDistribution.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
} else if (line.compare(JasmineGraphInstanceProtocol::IN_DEGREE_DISTRIBUTION) == 0) {
instance_logger.log("Received : in degree distribution from server", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
// Calculate the in degree distribution
map<long, long> degreeDistribution = calculateInDegreeDist(graphID, partitionID, serverPort,
graphDBMapLocalStores,
graphDBMapCentralStores, workerSockets);
} else if (line.compare(
JasmineGraphInstanceProtocol::WORKER_OUT_DEGREE_DISTRIBUTION) == 0) {
instance_logger.log("Received : Out degree distribution to aggregator", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
map<long, long> degreeDistribution = calculateLocalOutDegreeDist(graphID, partitionID,
graphDBMapLocalStores,
graphDBMapCentralStores);
instance_logger.log("Degree Dist size: " + to_string(degreeDistribution.size()), "info");
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_odd_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, long>::iterator it = degreeDistribution.begin(); it != degreeDistribution.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
} else if (line.compare(JasmineGraphInstanceProtocol::OUT_DEGREE_DISTRIBUTION) == 0) {
instance_logger.log("Received : out degree distribution from server", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
// Calculate the out degree distribution in the current super worker.
map<long, long> degreeDistribution = calculateOutDegreeDist(graphID, partitionID, serverPort,
graphDBMapLocalStores,
graphDBMapCentralStores,
workerSockets);
} else if (line.compare(JasmineGraphInstanceProtocol::PAGE_RANK) == 0) {
instance_logger.log("Received : page rank from server", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphVertexCount = (data);
graphVertexCount = utils.trim_copy(graphVertexCount, " \f\n\r\t\v");
instance_logger.log("Received Graph ID:" + graphID + " Vertex Count: " + graphVertexCount, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string alphaValue = (data);
alphaValue = utils.trim_copy(alphaValue, " \f\n\r\t\v");
instance_logger.log("Received alpha: " + alphaValue, "info");
double alpha = std::stod(alphaValue);
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string iterationsValue = (data);
iterationsValue = utils.trim_copy(iterationsValue, " \f\n\r\t\v");
instance_logger.log("Received iteration count: " + iterationsValue, "info");
int iterations = std::stoi(iterationsValue);
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStoresPgrnk;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStoresPgrnk);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStoresPgrnk[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
instance_logger.log("Start : Calculate Local page rank", "info");
map<long, double> pageRankResults = calculateLocalPageRank(graphID, alpha, partitionID, serverPort, TOP_K_PAGE_RANK,
graphVertexCount, graphDB, centralDB,
workerSockets, iterations);
instance_logger.log("Page rank size: " + to_string(pageRankResults.size()), "info");
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_pgrnk_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, double>::iterator it = pageRankResults.begin(); it != pageRankResults.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
for (vector<string>::iterator workerIt = workerSockets.begin(); workerIt != workerSockets.end(); ++workerIt) {
instance_logger.log("Worker pair " + *workerIt, "info");
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
if (std::to_string(serverPort).compare(workerSocketPair[1]) == 0) {
continue;
}
string host = workerSocketPair[0];
int port = stoi(workerSocketPair[1]);
int sockfd;
char data[301];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cout << "Cannot accept connection" << std::endl;
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cout << "ERROR, no host named " << server << std::endl;
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
std::cout << "ERROR connecting" << std::endl;
//TODO::exit
}
bzero(data, 301);
int result_wr = write(sockfd, JasmineGraphInstanceProtocol::WORKER_PAGE_RANK_DISTRIBUTION.c_str(),
JasmineGraphInstanceProtocol::WORKER_PAGE_RANK_DISTRIBUTION.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::WORKER_PAGE_RANK_DISTRIBUTION,
"info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
result_wr = write(sockfd, graphID.c_str(), graphID.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Graph ID " + graphID, "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
string degreeDistString;
int partitionID = stoi(workerSocketPair[2]);
result_wr = write(sockfd, std::to_string(partitionID).c_str(), std::to_string(partitionID).size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Partition ID " + std::to_string(partitionID), "info");
}
}
}
instance_logger.log("Finish : Calculate Local page rank.", "info");
} else if (line.compare(
JasmineGraphInstanceProtocol::WORKER_PAGE_RANK_DISTRIBUTION) == 0) {
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphVertexCount = (data);
graphVertexCount = utils.trim_copy(graphVertexCount, " \f\n\r\t\v");
instance_logger.log("Received Graph ID:" + graphID + " Vertex Count: " + graphVertexCount, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string alphaValue = (data);
alphaValue = utils.trim_copy(alphaValue, " \f\n\r\t\v");
instance_logger.log("Received alpha: " + alphaValue, "info");
double alpha = std::stod(alphaValue);
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string iterationsValue = (data);
iterationsValue = utils.trim_copy(iterationsValue, " \f\n\r\t\v");
instance_logger.log("Received iterations: " + iterationsValue, "info");
int iterations = std::stoi(iterationsValue);
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStoresPgrnk;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStoresPgrnk);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStoresPgrnk[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
map<long, double> pageRankResults = calculateLocalPageRank(graphID, alpha, partitionID, serverPort, TOP_K_PAGE_RANK,
graphVertexCount, graphDB, centralDB,
workerSockets, iterations);
instance_logger.log("Page rank size: " + to_string(pageRankResults.size()), "info");
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_pgrnk_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, double>::iterator it = pageRankResults.begin(); it != pageRankResults.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
} else if (line.compare(JasmineGraphInstanceProtocol::EGONET) == 0) {
instance_logger.log("Received : EGONET from instance", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = data;
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStoresPgrnk;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStoresPgrnk);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStoresPgrnk[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
calculateEgoNet(graphID, partitionID, serverPort, graphDB, centralDB, workerList);
} else if (line.compare(JasmineGraphInstanceProtocol::WORKER_EGO_NET) == 0) {
instance_logger.log("Received : SEND_EGO_NET_TO_AGGREGATOR from instance", "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string workerList = (data);
workerList = utils.trim_copy(workerList, " \f\n\r\t\v");
instance_logger.log("Received Worker List " + workerList, "info");
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStoresPgrnk;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStoresPgrnk);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStoresPgrnk[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
map<long, map<long, unordered_set<long>>> egonetMap = calculateLocalEgoNet(graphID, partitionID,
serverPort, graphDB, centralDB,
workerSockets);
Utils utils;
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_egonet_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, map<long, unordered_set<long>>>::iterator it = egonetMap.begin(); it != egonetMap.end(); ++it) {
map<long, unordered_set<long>> egonetInternalMap = it->second;
for (map<long, unordered_set<long>>::iterator itm = egonetInternalMap.begin(); itm != egonetInternalMap.end(); ++itm) {
unordered_set<long> egonetInternalMapEdges = itm->second;
for (unordered_set<long>::iterator ite = egonetInternalMapEdges.begin(); ite != egonetInternalMapEdges.end(); ++ite) {
partfile << to_string(it->first) << "\t" << to_string(itm->first) << "\t" << to_string(*ite) << endl;
}
}
}
partfile.close();
instance_logger.log("Egonet calculation complete", "info");
} else if (line.compare(JasmineGraphInstanceProtocol::TRIANGLES) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::TRIANGLES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionId = (data);
partitionId = utils.trim_copy(partitionId, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionId, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string priority = (data);
priority = utils.trim_copy(priority, " \f\n\r\t\v");
instance_logger.log("Received Priority : " + priority, "info");
int threadPriority = std::atoi(priority.c_str());
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount++;
highestPriority = threadPriority;
threadPriorityMutex.unlock();
}
long localCount = countLocalTriangles(graphID, partitionId, graphDBMapLocalStores, graphDBMapCentralStores,
graphDBMapDuplicateCentralStores, threadPriority);
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount--;
if (workerHighPriorityTaskCount == 0) {
highestPriority = Conts::DEFAULT_THREAD_PRIORITY;
}
threadPriorityMutex.unlock();
}
std::string result = to_string(localCount);
write(connFd, result.c_str(), result.size());
} else if (line.compare(JasmineGraphInstanceProtocol::SEND_CENTRALSTORE_TO_AGGREGATOR) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_CENTRALSTORE_TO_AGGREGATOR, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
std::string aggregatorFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
DIR *dir = opendir(aggregatorFilePath.c_str());
if (dir) {
closedir(dir);
} else {
std::string createDirCommand = "mkdir -p " + aggregatorFilePath;
FILE *createDirInput = popen(createDirCommand.c_str(), "r");
pclose(createDirInput);
}
std::string copyCommand = "cp " + fullFilePath + " " + aggregatorFilePath;
FILE *copyInput = popen(copyCommand.c_str(), "r");
pclose(copyInput);
std::string movedFullFilePath = aggregatorFilePath + "/" + rawname;
while (!utils.fileExists(movedFullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::SEND_COMPOSITE_CENTRALSTORE_TO_AGGREGATOR) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_COMPOSITE_CENTRALSTORE_TO_AGGREGATOR,
"info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (true) {
if (utils.fileExists(fullFilePath)) {
while (utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
break;
} else {
sleep(1);
continue;
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
instance_logger.log("File received and saved to " + fullFilePath, "info");
loop = true;
utils.unzipFile(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string rawname = fileName.substr(0, lastindex);
fullFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + rawname;
std::string aggregatorFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
DIR *dir = opendir(aggregatorFilePath.c_str());
if (dir) {
closedir(dir);
} else {
std::string createDirCommand = "mkdir -p " + aggregatorFilePath;
FILE *createDirInput = popen(createDirCommand.c_str(), "r");
pclose(createDirInput);
}
std::string copyCommand = "cp " + fullFilePath + " " + aggregatorFilePath;
FILE *copyInput = popen(copyCommand.c_str(), "r");
pclose(copyInput);
std::string movedFullFilePath = aggregatorFilePath + "/" + rawname;
while (!utils.fileExists(movedFullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::AGGREGATE_CENTRALSTORE_TRIANGLES) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::AGGREGATE_CENTRALSTORE_TRIANGLES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphId = (data);
graphId = utils.trim_copy(graphId, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphId, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionId = (data);
partitionId = utils.trim_copy(partitionId, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionId, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionIdList = (data);
partitionIdList = utils.trim_copy(partitionIdList, " \f\n\r\t\v");
instance_logger.log("Received Partition ID List : " + partitionIdList, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string priority = (data);
priority = utils.trim_copy(priority, " \f\n\r\t\v");
instance_logger.log("Received priority: " + priority, "info");
int threadPriority = std::atoi(priority.c_str());
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount++;
highestPriority = threadPriority;
threadPriorityMutex.unlock();
}
std::string aggregatedTriangles= JasmineGraphInstanceService::aggregateCentralStoreTriangles(graphId,
partitionId,
partitionIdList,
threadPriority);
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount--;
if (workerHighPriorityTaskCount == 0) {
highestPriority = Conts::DEFAULT_THREAD_PRIORITY;
}
threadPriorityMutex.unlock();
}
std::vector<std::string> chunksVector;
for (unsigned i = 0; i < aggregatedTriangles.length(); i += INSTANCE_DATA_LENGTH - 10) {
std::string chunk = aggregatedTriangles.substr(i, INSTANCE_DATA_LENGTH - 10);
if (i + INSTANCE_DATA_LENGTH - 10 < aggregatedTriangles.length()) {
chunk += "/SEND";
} else {
chunk += "/CMPT";
}
chunksVector.push_back(chunk);
}
for (int loopCount = 0; loopCount < chunksVector.size(); loopCount++) {
if (loopCount == 0) {
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
} else {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string chunkStatus = (data);
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
}
}
} else if (line.compare(JasmineGraphInstanceProtocol::AGGREGATE_COMPOSITE_CENTRALSTORE_TRIANGLES) == 0) {
instance_logger.log(
"Received : " + JasmineGraphInstanceProtocol::AGGREGATE_COMPOSITE_CENTRALSTORE_TRIANGLES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string availableFiles = (data);
availableFiles = utils.trim_copy(availableFiles, " \f\n\r\t\v");
instance_logger.log("Received Available Files: " + availableFiles, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
string status = response.substr(response.size() - 5);
std::string compositeFileList = response.substr(0, response.size() - 5);
while (status == "/SEND") {
write(connFd, status.c_str(), status.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
status = response.substr(response.size() - 5);
std::string fileList = response.substr(0, response.size() - 5);
compositeFileList = compositeFileList + fileList;
}
response = compositeFileList;
instance_logger.log("Received Composite File List : " + compositeFileList, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string priority = (data);
priority = utils.trim_copy(priority, " \f\n\r\t\v");
instance_logger.log("Received priority: " + priority, "info");
int threadPriority = std::atoi(priority.c_str());
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount++;
highestPriority = threadPriority;
threadPriorityMutex.unlock();
}
std::string aggregatedTriangles= JasmineGraphInstanceService::aggregateCompositeCentralStoreTriangles(
response, availableFiles, threadPriority);
if (threadPriority > Conts::DEFAULT_THREAD_PRIORITY) {
threadPriorityMutex.lock();
workerHighPriorityTaskCount--;
if (workerHighPriorityTaskCount == 0) {
highestPriority = Conts::DEFAULT_THREAD_PRIORITY;
}
threadPriorityMutex.unlock();
}
std::vector<std::string> chunksVector;
for (unsigned i = 0; i < aggregatedTriangles.length(); i += INSTANCE_DATA_LENGTH - 10) {
std::string chunk = aggregatedTriangles.substr(i, INSTANCE_DATA_LENGTH - 10);
if (i + INSTANCE_DATA_LENGTH - 10 < aggregatedTriangles.length()) {
chunk += "/SEND";
} else {
chunk += "/CMPT";
}
chunksVector.push_back(chunk);
}
for (int loopCount = 0; loopCount < chunksVector.size(); loopCount++) {
if (loopCount == 0) {
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
} else {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string chunkStatus = (data);
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
}
}
} else if (line.compare(JasmineGraphInstanceProtocol::PERFORMANCE_STATISTICS) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::PERFORMANCE_STATISTICS, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string isVMStatManager = (data);
isVMStatManager = utils.trim_copy(isVMStatManager, " \f\n\r\t\v");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string isResourceAllocationRequired = (data);
isResourceAllocationRequired = utils.trim_copy(isResourceAllocationRequired, " \f\n\r\t\v");
std::string memoryUsage = JasmineGraphInstanceService::requestPerformanceStatistics(
isVMStatManager, isResourceAllocationRequired);
write(connFd, memoryUsage.c_str(), memoryUsage.size());
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_FILES) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_FILES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread *workerThreads = new std::thread[2];
workerThreads[0] = std::thread(&JasmineGraphInstanceService::createPartitionFiles, graphID, partitionID,
"local");
workerThreads[1] = std::thread(&JasmineGraphInstanceService::createPartitionFiles, graphID, partitionID,
"centralstore");
for (int threadCount = 0; threadCount < 2; threadCount++) {
workerThreads[threadCount].join();
}
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_SERVER) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_SERVER, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread workerThread = std::thread(&JasmineGraphInstanceService::initServer, trainData);
workerThread.join();
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_ORG_SERVER) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_ORG_SERVER, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread workerThread = std::thread(&JasmineGraphInstanceService::initOrgServer, trainData);
workerThread.join();
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_AGG) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_AGG, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread workerThread = std::thread(&JasmineGraphInstanceService::initAgg, trainData);
workerThread.join();
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_CLIENT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_CLIENT, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread workerThread = std::thread(&JasmineGraphInstanceService::initClient, trainData);
workerThread.join();
} else if (line.compare(JasmineGraphInstanceProtocol::MERGE_FILES) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::MERGE_FILES, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread workerThread = std::thread(&JasmineGraphInstanceService::mergeFiles, trainData);
workerThread.join();
} else if (line.compare(JasmineGraphInstanceProtocol::START_STAT_COLLECTION) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::START_STAT_COLLECTION, "debug");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "debug");
collectValid = true;
JasmineGraphInstanceService::startCollectingLoadAverage();
} else if (line.compare(JasmineGraphInstanceProtocol::REQUEST_COLLECTED_STATS) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::REQUEST_COLLECTED_STATS, "info");
collectValid = false;
std::string loadAverageString;
std::vector<std::string>::iterator loadVectorIterator;
for (loadVectorIterator = loadAverageVector.begin(); loadVectorIterator!= loadAverageVector.end(); ++ loadVectorIterator) {
std::string tempLoadAverage = *loadVectorIterator;
loadAverageString = loadAverageString + "," + tempLoadAverage;
}
loadAverageVector.clear();
loadAverageString = loadAverageString.substr(1, loadAverageString.length() - 1);
std::vector<std::string> chunksVector;
for (unsigned i = 0; i < loadAverageString.length(); i += INSTANCE_DATA_LENGTH - 10) {
std::string chunk = loadAverageString.substr(i, INSTANCE_DATA_LENGTH - 10);
if (i + INSTANCE_DATA_LENGTH - 10 < loadAverageString.length()) {
chunk += "/SEND";
} else {
chunk += "/CMPT";
}
chunksVector.push_back(chunk);
}
for (int loopCount = 0; loopCount < chunksVector.size(); loopCount++) {
if (loopCount == 0) {
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
} else {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string chunkStatus = (data);
std::string chunk = chunksVector.at(loopCount);
write(connFd, chunk.c_str(), chunk.size());
}
}
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_TRAIN) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_TRAIN, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string trainData(data);
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::thread *workerThreads = new std::thread[2];
workerThreads[0] =
std::thread(&JasmineGraphInstanceService::createPartitionFiles, graphID, partitionID, "local");
workerThreads[1] =
std::thread(&JasmineGraphInstanceService::createPartitionFiles, graphID, partitionID, "centralstore");
for (int threadCount = 0; threadCount < 2; threadCount++) {
workerThreads[threadCount].join();
std::cout << "Thread " << threadCount << " joined" << std::endl;
}
write(connFd, JasmineGraphInstanceProtocol::SEND_PARTITION_ITERATION.c_str(),
JasmineGraphInstanceProtocol::SEND_PARTITION_ITERATION.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_PARTITION_ITERATION, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partIteration(data);
write(connFd, JasmineGraphInstanceProtocol::SEND_PARTITION_COUNT.c_str(),
JasmineGraphInstanceProtocol::SEND_PARTITION_ITERATION.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_PARTITION_COUNT, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partCount(data);
instance_logger.log("Received partition iteration - " + partIteration, "info");
JasmineGraphInstanceService::collectExecutionData(partIteration, trainData, partCount);
instance_logger.log("After calling collector ", "info");
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_PREDICT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_PREDICT, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string vertexCount = (data);
vertexCount = utils.trim_copy(vertexCount, " \f\n\r\t\v");
instance_logger.log("Received vertexCount: " + vertexCount, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string ownPartitions = (data);
ownPartitions = utils.trim_copy(ownPartitions, " \f\n\r\t\v");
instance_logger.log("Received Own Partitions No: " + ownPartitions, "info");
/*Receive hosts' detail*/
write(connFd, JasmineGraphInstanceProtocol::SEND_HOSTS.c_str(),
JasmineGraphInstanceProtocol::SEND_HOSTS.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_HOSTS, "info");
char dataBuffer[INSTANCE_LONG_DATA_LENGTH + 1];
bzero(dataBuffer, INSTANCE_LONG_DATA_LENGTH + 1);
read(connFd, dataBuffer, INSTANCE_LONG_DATA_LENGTH);
string hostList = (dataBuffer);
instance_logger.log("Received Hosts List: " + hostList, "info");
// Put all hosts to a map
std::map<std::string, JasmineGraphInstanceService::workerPartitions> graphPartitionedHosts;
std::vector<std::string> hosts = Utils::split(hostList, '|');
int count = 0;
int totalPartitions = 0;
for (std::vector<std::string>::iterator it = hosts.begin(); it != hosts.end(); ++it) {
if (count != 0) {
std::vector<std::string> hostDetail = Utils::split(*it, ',');
std::string hostName;
int port;
int dataport;
std::vector<string> partitionIDs;
for (std::vector<std::string>::iterator j = hostDetail.begin(); j != hostDetail.end(); ++j) {
int index = std::distance(hostDetail.begin(), j);
if (index == 0) {
hostName = *j;
} else if (index == 1) {
port = stoi(*j);
} else if (index == 2) {
dataport = stoi(*j);
} else {
partitionIDs.push_back(*j);
totalPartitions += 1;
}
}
graphPartitionedHosts.insert(pair<string, JasmineGraphInstanceService::workerPartitions>(
hostName, {port, dataport, partitionIDs}));
}
count++;
}
/*Receive file*/
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (utils.fileExists(fullFilePath) && utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(connFd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
if (totalPartitions != 0) {
JasmineGraphInstanceService::collectTrainedModels(sessionargs, graphID, graphPartitionedHosts,
totalPartitions);
}
std::vector<std::string> predictargs;
predictargs.push_back(graphID);
predictargs.push_back(vertexCount);
predictargs.push_back(fullFilePath);
predictargs.push_back(utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder"));
predictargs.push_back(to_string(totalPartitions + stoi(ownPartitions)));
std::vector<char *> predict_agrs_vector;
std::transform(predictargs.begin(), predictargs.end(), std::back_inserter(predict_agrs_vector), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.graphsage") + " && ";
std::string command = path + "python3.11 predict.py ";
int argc = predictargs.size();
for (int i = 0; i < argc; ++i) {
command += predictargs[i];
command += " ";
}
cout << command << endl;
system(command.c_str());
loop = true;
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_MODEL_COLLECTION) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_MODEL_COLLECTION, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string serverHostName = (data);
serverHostName = utils.trim_copy(serverHostName, " \f\n\r\t\v");
instance_logger.log("Received HostName: " + serverHostName, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string serverHostPort = (data);
serverHostPort = utils.trim_copy(serverHostPort, " \f\n\r\t\v");
instance_logger.log("Received Port: " + serverHostPort, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string serverHostDataPort = (data);
serverHostDataPort = utils.trim_copy(serverHostDataPort, " \f\n\r\t\v");
instance_logger.log("Received Data Port: " + serverHostDataPort, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphID = (data);
graphID = utils.trim_copy(graphID, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphID, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionID = (data);
partitionID = utils.trim_copy(partitionID, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionID, "info");
std::string fileName = graphID + "_model_" + partitionID;
std::string filePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder") + "/" + fileName;
// zip the folder
utils.compressDirectory(filePath);
fileName = fileName + ".tar.gz";
filePath = filePath + ".tar.gz";
int fileSize = utils.getFileSize(filePath);
std::string fileLength = to_string(fileSize);
// send file name
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::SEND_FILE_NAME) == 0) {
write(connFd, fileName.c_str(), fileName.size());
instance_logger.log("Sent : File name " + fileName, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
// send file length
if (line.compare(JasmineGraphInstanceProtocol::SEND_FILE_LEN) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
write(connFd, fileLength.c_str(), fileLength.size());
instance_logger.log("Sent : File length in bytes " + fileLength, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
// send content
if (line.compare(JasmineGraphInstanceProtocol::SEND_FILE_CONT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
instance_logger.log("Going to send file through service", "info");
JasmineGraphInstance::sendFileThroughService(serverHostName, stoi(serverHostDataPort), fileName,
filePath);
}
}
}
int count = 0;
while (true) {
write(connFd, JasmineGraphInstanceProtocol::FILE_RECV_CHK.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_CHK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
instance_logger.log("Checking if file is received", "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::FILE_RECV_WAIT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_WAIT, "info");
instance_logger.log("Checking file status : " + to_string(count), "info");
count++;
sleep(1);
continue;
} else if (line.compare(JasmineGraphInstanceProtocol::FILE_ACK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
instance_logger.log("File transfer completed", "info");
break;
}
}
while (true) {
write(connFd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
line = (data);
if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
sleep(1);
continue;
} else if (line.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
instance_logger.log("Trained Model Batch upload completed", "info");
break;
}
}
loop = true;
} else if (line.compare(JasmineGraphInstanceProtocol::INITIATE_FRAGMENT_RESOLUTION) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::INITIATE_FRAGMENT_RESOLUTION, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string listOfPartitions = (data);
listOfPartitions = utils.trim_copy(listOfPartitions, " \f\n\r\t\v");
instance_logger.log("Received ===>: " + listOfPartitions, "info");
std::stringstream ss;
ss << listOfPartitions;
while (true) {
write(connFd, JasmineGraphInstanceProtocol::FRAGMENT_RESOLUTION_CHK.c_str(),
JasmineGraphInstanceProtocol::FRAGMENT_RESOLUTION_CHK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FRAGMENT_RESOLUTION_CHK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string listOfPartitions = (data);
if (listOfPartitions.compare(JasmineGraphInstanceProtocol::FRAGMENT_RESOLUTION_DONE) == 0) {
break;
} else {
instance_logger.log("Received ===>: " + listOfPartitions, "info");
ss << listOfPartitions;
}
}
std::vector<std::string> partitions = Utils::split(ss.str(), ',');
std::vector<std::string> graphIDs;
for (std::vector<string>::iterator x = partitions.begin(); x != partitions.end(); ++x) {
string graphID = x->substr(0, x->find_first_of("_"));
graphIDs.push_back(graphID);
}
Utils utils;
string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::vector<string> listOfFiles = utils.getListOfFilesInDirectory(dataFolder);
std::vector<std::string> graphIDsFromFileSystem;
for (std::vector<string>::iterator x = listOfFiles.begin(); x != listOfFiles.end(); ++x) {
string graphID = x->substr(0, x->find_first_of("_"));
graphIDsFromFileSystem.push_back(graphID);
}
std::vector<string> notInGraphIDList;
for (std::vector<std::string>::iterator it = graphIDsFromFileSystem.begin();
it != graphIDsFromFileSystem.end(); it++) {
bool found = false;
for (std::vector<std::string>::iterator itRemoteID = graphIDs.begin(); itRemoteID != graphIDs.end();
itRemoteID++) {
if (it->compare(itRemoteID->c_str()) == 0) {
found = true;
break;
}
}
if (!found) {
notInGraphIDList.push_back(it->c_str());
}
}
string notInItemsString = "";
std::vector<int> notInItemsList;
for (std::vector<string>::iterator it = notInGraphIDList.begin(); it != notInGraphIDList.end(); it++) {
if (isdigit(it->c_str()[0])) {
bool found = false;
for (std::vector<int>::iterator it2 = notInItemsList.begin(); it2 != notInItemsList.end(); it2++) {
if (atoi(it->c_str()) == *it2) {
found = true;
break;
}
}
if (!found) {
notInItemsList.push_back(stoi(it->c_str()));
}
}
}
bool firstFlag = true;
for (std::vector<int>::iterator it = notInItemsList.begin(); it != notInItemsList.end(); it++) {
int x = *it;
if (firstFlag) {
notInItemsString = std::to_string(x);
firstFlag = false;
} else {
notInItemsString = notInItemsString + "," + std::to_string(x);
};
}
string graphIDList = notInItemsString;
write(connFd, graphIDList.c_str(), graphIDList.size());
instance_logger.log("Sent : " + graphIDList, "info");
} else if (line.compare(JasmineGraphInstanceProtocol::CHECK_FILE_ACCESSIBLE) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::CHECK_FILE_ACCESSIBLE, "info");
write(connFd, JasmineGraphInstanceProtocol::SEND_FILE_TYPE.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_TYPE.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_TYPE, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileType = (data);
fileType = utils.trim_copy(fileType, " \f\n\r\t\v");
if (fileType.compare(JasmineGraphInstanceProtocol::FILE_TYPE_CENTRALSTORE_AGGREGATE) == 0) {
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string graphId = (data);
graphId = utils.trim_copy(graphId, " \f\n\r\t\v");
instance_logger.log("Received Graph ID: " + graphId, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string partitionId = (data);
partitionId = utils.trim_copy(partitionId, " \f\n\r\t\v");
instance_logger.log("Received Partition ID: " + partitionId, "info");
string aggregateLocation =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
string fileName = graphId + "_centralstore_" + partitionId;
string fullFilePath = aggregateLocation + "/" + fileName;
string result = "false";
bool fileExists = utils.fileExists(fullFilePath);
if (fileExists) {
result = "true";
}
write(connFd, result.c_str(), result.size());
instance_logger.log("Sent : " + result, "info");
} else if (fileType.compare(JasmineGraphInstanceProtocol::FILE_TYPE_CENTRALSTORE_COMPOSITE) == 0) {
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
fileName = utils.trim_copy(fileName, " \f\n\r\t\v");
instance_logger.log("Received File name: " + fileName, "info");
string aggregateLocation =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
string fullFilePath = aggregateLocation + "/" + fileName;
string result = "false";
bool fileExists = utils.fileExists(fullFilePath);
if (fileExists) {
result = "true";
}
write(connFd, result.c_str(), result.size());
instance_logger.log("Sent : " + result, "info");
}
} else if (line.compare(JasmineGraphInstanceProtocol::GRAPH_STREAM_START) == 0) {
write(connFd, JasmineGraphInstanceProtocol::GRAPH_STREAM_START_ACK.c_str(),
JasmineGraphInstanceProtocol::GRAPH_STREAM_START_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::GRAPH_STREAM_START_ACK, "info");
int content_length;
instance_logger.log("Waiting for edge content length", "info");
auto return_status = read(connFd, &content_length, sizeof(4));
if (return_status > 0) {
content_length = ntohl(content_length);
instance_logger.log("Received content_length = " + std::to_string(content_length), "info");
} else {
instance_logger.log("Error while reading content length", "error");
}
std::string nodeString(content_length, 0);
send(connFd, JasmineGraphInstanceProtocol::GRAPH_STREAM_C_length_ACK.c_str(),
JasmineGraphInstanceProtocol::GRAPH_STREAM_C_length_ACK.size(), 0);
instance_logger.log("Acked for content length", "info");
instance_logger.log("Waiting for edge data", "info");
return_status = read(connFd, &nodeString[0], content_length);
if (return_status > 0) {
instance_logger.log("Received edge data = " + nodeString, "info");
} else {
instance_logger.log("Error while reading content length", "error");
}
auto graphIdPartitionId = JasmineGraphIncrementalLocalStore::getIDs(nodeString);
std::string graphId = graphIdPartitionId.first;
std::string partitionId = std::to_string(graphIdPartitionId.second);
std::string graphIdentifier = graphId + "_" + partitionId;
JasmineGraphIncrementalLocalStore* incrementalLocalStoreInstance;
if (incrementalLocalStoreMap.find(graphIdentifier) == incrementalLocalStoreMap.end()) {
incrementalLocalStoreInstance =
JasmineGraphInstanceService::loadStreamingStore(graphId, partitionId, incrementalLocalStoreMap);
} else {
incrementalLocalStoreInstance = incrementalLocalStoreMap[graphIdentifier];
}
incrementalLocalStoreInstance->addEdgeFromString(nodeString);
send(connFd, JasmineGraphInstanceProtocol::GRAPH_STREAM_END_OF_EDGE.c_str(),
JasmineGraphInstanceProtocol::GRAPH_STREAM_END_OF_EDGE.size(), 0);
instance_logger.log("Sent CRLF string to mark the end", "info");
} else if (line.compare(JasmineGraphInstanceProtocol::SEND_PRIORITY) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_PRIORITY, "info");
write(connFd, JasmineGraphInstanceProtocol::OK.c_str(), JasmineGraphInstanceProtocol::OK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::OK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(connFd, data, INSTANCE_DATA_LENGTH);
string priority = (data);
priority = utils.trim_copy(priority, " \f\n\r\t\v");
instance_logger.log("Received Priority: " + priority, "info");
int retrievedPriority = atoi(priority.c_str());
highestPriority = retrievedPriority;
}
}
instance_logger.log("Closing thread " + to_string(pthread_self()), "info");
close(connFd);
return NULL;
}
JasmineGraphInstanceService::JasmineGraphInstanceService() {}
void JasmineGraphInstanceService::run(string profile, string masterHost, string host, int serverPort,
int serverDataPort) {
int listenFd;
socklen_t len;
struct sockaddr_in svrAdd;
struct sockaddr_in clntAdd;
// create socket
listenFd = socket(AF_INET, SOCK_STREAM, 0);
if (listenFd < 0) {
std::cerr << "Cannot open socket" << std::endl;
return;
}
bzero((char *)&svrAdd, sizeof(svrAdd));
svrAdd.sin_family = AF_INET;
svrAdd.sin_addr.s_addr = INADDR_ANY;
svrAdd.sin_port = htons(serverPort);
int yes = 1;
if (setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes) == -1) {
perror("setsockopt");
exit(1);
}
// bind socket
if (bind(listenFd, (struct sockaddr *)&svrAdd, sizeof(svrAdd)) < 0) {
std::cerr << "Cannot bind on port " + serverPort << std::endl;
return;
}
listen(listenFd, 10);
len = sizeof(clntAdd);
int connectionCounter = 0;
pthread_mutex_init(&file_lock, NULL);
pthread_t threadA[MAX_CONNECTION_COUNT];
struct instanceservicesessionargs serviceArguments;
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores;
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores;
std::map<std::string, JasmineGraphHashMapDuplicateCentralStore> graphDBMapDuplicateCentralStores;
std::map<std::string, JasmineGraphIncrementalLocalStore*> incrementalLocalStore;
serviceArguments.graphDBMapLocalStores = graphDBMapLocalStores;
serviceArguments.graphDBMapCentralStores = graphDBMapCentralStores;
serviceArguments.graphDBMapDuplicateCentralStores = graphDBMapDuplicateCentralStores;
serviceArguments.incrementalLocalStore = incrementalLocalStore;
serviceArguments.profile = profile;
serviceArguments.masterHost = masterHost;
serviceArguments.port = serverPort;
serviceArguments.dataPort = serverDataPort;
serviceArguments.host = host;
// TODO :: What is the maximum number of connections allowed??
instance_logger.log("Worker listening on port " + to_string(serverPort), "info");
while (connectionCounter < MAX_CONNECTION_COUNT) {
int connFd = accept(listenFd, (struct sockaddr *)&clntAdd, &len);
if (connFd < 0) {
instance_logger.log("Cannot accept connection to port " + to_string(serverPort), "error");
} else {
instance_logger.log("Connection successful to port " + to_string(serverPort), "info");
serviceArguments.connFd = connFd;
pthread_create(&threadA[connectionCounter], NULL, instanceservicesession, &serviceArguments);
// pthread_detach(threadA[connectionCounter]);
// pthread_join(threadA[connectionCounter], NULL);
connectionCounter++;
}
}
for (int i = 0; i < connectionCounter; i++) {
pthread_join(threadA[i], NULL);
std::cout << "service Threads joined" << std::endl;
}
pthread_mutex_destroy(&file_lock);
}
void deleteGraphPartition(std::string graphID, std::string partitionID) {
Utils utils;
string partitionFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" +
graphID + +"_" + partitionID;
utils.deleteDirectory(partitionFilePath);
string centalStoreFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" +
graphID + +"_centralstore_" + partitionID;
utils.deleteDirectory(centalStoreFilePath);
string centalStoreDuplicateFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") +
"/" + graphID + +"_centralstore_dp_" + partitionID;
utils.deleteDirectory(centalStoreDuplicateFilePath);
string attributeFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" +
graphID + +"_attributes_" + partitionID;
utils.deleteDirectory(attributeFilePath);
string attributeCentalStoreFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") +
"/" + graphID + +"_centralstore_attributes_" + partitionID;
utils.deleteDirectory(attributeCentalStoreFilePath);
instance_logger.log("Graph partition and centralstore files are now deleted", "info");
}
/** Method for deleting all graph fragments given a graph ID
*
* @param graphID ID of graph fragments to be deleted in the instance
*/
void removeGraphFragments(std::string graphID) {
Utils utils;
// Delete all files in the datafolder starting with the graphID
string partitionFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + graphID + "_*";
utils.deleteDirectory(partitionFilePath);
}
void writeCatalogRecord(string record) {
Utils utils;
utils.createDirectory(utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder"));
string catalogFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/catalog.txt";
ofstream outfile;
outfile.open(catalogFilePath.c_str(), std::ios_base::app);
outfile << record << endl;
outfile.close();
}
long countLocalTriangles(std::string graphId, std::string partitionId,
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores,
std::map<std::string, JasmineGraphHashMapDuplicateCentralStore> graphDBMapDuplicateCentralStores,
int threadPriority) {
long result;
instance_logger.log("###INSTANCE### Local Triangle Count : Started", "info");
std::string graphIdentifier = graphId + "_" + partitionId;
std::string centralGraphIdentifier = graphId + +"_centralstore_" + partitionId;
std::string duplicateCentralGraphIdentifier = graphId + +"_centralstore_dp_" + partitionId;
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralGraphDB;
JasmineGraphHashMapDuplicateCentralStore duplicateCentralGraphDB;
std::map<std::string, JasmineGraphHashMapLocalStore>::iterator localMapIterator =
graphDBMapLocalStores.find(graphIdentifier);
std::map<std::string, JasmineGraphHashMapCentralStore>::iterator centralStoreIterator =
graphDBMapCentralStores.find(graphIdentifier);
std::map<std::string, JasmineGraphHashMapDuplicateCentralStore>::iterator duplicateCentralStoreIterator =
graphDBMapDuplicateCentralStores.find(graphIdentifier);
if (localMapIterator == graphDBMapLocalStores.end()) {
if (JasmineGraphInstanceService::isGraphDBExists(graphId, partitionId)) {
JasmineGraphInstanceService::loadLocalStore(graphId, partitionId, graphDBMapLocalStores);
}
graphDB = graphDBMapLocalStores[graphIdentifier];
} else {
graphDB = graphDBMapLocalStores[graphIdentifier];
}
if (centralStoreIterator == graphDBMapCentralStores.end()) {
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphId, partitionId)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphId, partitionId, graphDBMapCentralStores);
}
centralGraphDB = graphDBMapCentralStores[centralGraphIdentifier];
} else {
centralGraphDB = graphDBMapCentralStores[centralGraphIdentifier];
}
if (duplicateCentralStoreIterator == graphDBMapDuplicateCentralStores.end()) {
if (JasmineGraphInstanceService::isInstanceDuplicateCentralStoreExists(graphId, partitionId)) {
JasmineGraphInstanceService::loadInstanceDuplicateCentralStore(graphId, partitionId,
graphDBMapDuplicateCentralStores);
}
duplicateCentralGraphDB = graphDBMapDuplicateCentralStores[duplicateCentralGraphIdentifier];
} else {
duplicateCentralGraphDB = graphDBMapDuplicateCentralStores[duplicateCentralGraphIdentifier];
}
result = Triangles::run(graphDB, centralGraphDB, duplicateCentralGraphDB, graphId, partitionId, threadPriority);
instance_logger.log("###INSTANCE### Local Triangle Count : Completed: Triangles: " + to_string(result), "info");
return result;
}
bool JasmineGraphInstanceService::isGraphDBExists(std::string graphId, std::string partitionId) {
Utils utils;
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string fileName = dataFolder + "/" + graphId + "_" + partitionId;
std::ifstream dbFile(fileName, std::ios::binary);
if (!dbFile) {
return false;
}
return true;
}
bool JasmineGraphInstanceService::isInstanceCentralStoreExists(std::string graphId, std::string partitionId) {
Utils utils;
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string filename = dataFolder + "/" + graphId + +"_centralstore_" + partitionId;
std::ifstream dbFile(filename, std::ios::binary);
if (!dbFile) {
return false;
}
return true;
}
bool JasmineGraphInstanceService::isInstanceDuplicateCentralStoreExists(std::string graphId, std::string partitionId) {
Utils utils;
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string filename = dataFolder + "/" + graphId + +"_centralstore_dp_" + partitionId;
std::ifstream dbFile(filename, std::ios::binary);
if (!dbFile) {
return false;
}
return true;
}
JasmineGraphIncrementalLocalStore* JasmineGraphInstanceService::loadStreamingStore(
std::string graphId, std::string partitionId,
std::map<std::string, JasmineGraphIncrementalLocalStore*> &graphDBMapStreamingStores) {
std::string graphIdentifier = graphId + "_" + partitionId;
instance_logger.log("###INSTANCE### Loading streaming Store for" + graphIdentifier + " : Started", "info");
Utils utils;
std::string folderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
JasmineGraphIncrementalLocalStore *jasmineGraphStreamingLocalStore =
new JasmineGraphIncrementalLocalStore(atoi(graphId.c_str()), atoi(partitionId.c_str()));
graphDBMapStreamingStores.insert(std::make_pair(graphIdentifier, jasmineGraphStreamingLocalStore));
auto sg = graphDBMapStreamingStores.find(graphIdentifier);
instance_logger.log("###INSTANCE### Loading Local Store : Completed", "info");
return jasmineGraphStreamingLocalStore;
}
void JasmineGraphInstanceService::loadLocalStore(
std::string graphId, std::string partitionId,
std::map<std::string, JasmineGraphHashMapLocalStore> &graphDBMapLocalStores) {
instance_logger.log("###INSTANCE### Loading Local Store : Started", "info");
std::string graphIdentifier = graphId + "_" + partitionId;
Utils utils;
std::string folderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
JasmineGraphHashMapLocalStore *jasmineGraphHashMapLocalStore =
new JasmineGraphHashMapLocalStore(atoi(graphId.c_str()), atoi(partitionId.c_str()), folderLocation);
jasmineGraphHashMapLocalStore->loadGraph();
graphDBMapLocalStores.insert(std::make_pair(graphIdentifier, *jasmineGraphHashMapLocalStore));
instance_logger.log("###INSTANCE### Loading Local Store : Completed", "info");
}
void JasmineGraphInstanceService::loadInstanceCentralStore(
std::string graphId, std::string partitionId,
std::map<std::string, JasmineGraphHashMapCentralStore> &graphDBMapCentralStores) {
std::string graphIdentifier = graphId + +"_centralstore_" + partitionId;
Utils utils;
JasmineGraphHashMapCentralStore *jasmineGraphHashMapCentralStore =
new JasmineGraphHashMapCentralStore(atoi(graphId.c_str()), atoi(partitionId.c_str()));
jasmineGraphHashMapCentralStore->loadGraph();
graphDBMapCentralStores.insert(std::make_pair(graphIdentifier, *jasmineGraphHashMapCentralStore));
}
void JasmineGraphInstanceService::loadInstanceDuplicateCentralStore(
std::string graphId, std::string partitionId,
std::map<std::string, JasmineGraphHashMapDuplicateCentralStore> &graphDBMapDuplicateCentralStores) {
std::string graphIdentifier = graphId + +"_centralstore_dp_" + partitionId;
Utils utils;
JasmineGraphHashMapDuplicateCentralStore *jasmineGraphHashMapCentralStore =
new JasmineGraphHashMapDuplicateCentralStore(atoi(graphId.c_str()), atoi(partitionId.c_str()));
jasmineGraphHashMapCentralStore->loadGraph();
graphDBMapDuplicateCentralStores.insert(std::make_pair(graphIdentifier, *jasmineGraphHashMapCentralStore));
}
JasmineGraphHashMapCentralStore JasmineGraphInstanceService::loadCentralStore(std::string centralStoreFileName) {
instance_logger.log("###INSTANCE### Loading Central Store File : Started " + centralStoreFileName, "info");
JasmineGraphHashMapCentralStore *jasmineGraphHashMapCentralStore = new JasmineGraphHashMapCentralStore();
jasmineGraphHashMapCentralStore->loadGraph(centralStoreFileName);
instance_logger.log("###INSTANCE### Loading Central Store File : Completed", "info");
return *jasmineGraphHashMapCentralStore;
}
std::string JasmineGraphInstanceService::copyCentralStoreToAggregator(std::string graphId, std::string partitionId,
std::string aggregatorHost,
std::string aggregatorPort, std::string host) {
Utils utils;
char buffer[128];
std::string result = "SUCCESS";
std::string centralGraphIdentifier = graphId + +"_centralstore_" + partitionId;
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphId, partitionId)) {
std::string centralStoreFile = dataFolder + "/" + centralGraphIdentifier;
std::string copyCommand;
DIR *dir = opendir(aggregatorFilePath.c_str());
if (dir) {
closedir(dir);
} else {
std::string createDirCommand = "mkdir -p " + aggregatorFilePath;
FILE *createDirInput = popen(createDirCommand.c_str(), "r");
pclose(createDirInput);
}
if (aggregatorHost == host) {
copyCommand = "cp " + centralStoreFile + " " + aggregatorFilePath;
} else {
copyCommand = "scp " + centralStoreFile + " " + aggregatorHost + ":" + aggregatorFilePath;
}
FILE *copyInput = popen(copyCommand.c_str(), "r");
if (copyInput) {
// read the input
while (!feof(copyInput)) {
if (fgets(buffer, 128, copyInput) != NULL) {
result.append(buffer);
}
}
if (!result.empty()) {
std::cout << result << std::endl;
}
pclose(copyInput);
}
}
return result;
}
string JasmineGraphInstanceService::aggregateCentralStoreTriangles(std::string graphId, std::string partitionId,
std::string partitionIdList,
int threadPriority) {
Utils utils;
instance_logger.log("###INSTANCE### Started Aggregating Central Store Triangles", "info");
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
std::vector<std::string> fileNames;
map<long, unordered_set<long>> aggregatedCentralStore;
std::string centralGraphIdentifier = graphId + +"_centralstore_" + partitionId;
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string workerCentralStoreFile = dataFolder + "/" + centralGraphIdentifier;
instance_logger.log("###INSTANCE### Loading Central Store : Started " + workerCentralStoreFile, "info");
JasmineGraphHashMapCentralStore workerCentralStore =
JasmineGraphInstanceService::loadCentralStore(workerCentralStoreFile);
instance_logger.log("###INSTANCE### Loading Central Store : Completed", "info");
map<long, unordered_set<long>> workerCentralGraphMap = workerCentralStore.getUnderlyingHashMap();
map<long, unordered_set<long>>::iterator workerCentalGraphIterator;
for (workerCentalGraphIterator = workerCentralGraphMap.begin();
workerCentalGraphIterator != workerCentralGraphMap.end(); ++workerCentalGraphIterator) {
long startVid = workerCentalGraphIterator->first;
unordered_set<long> endVidSet = workerCentalGraphIterator->second;
unordered_set<long> aggregatedEndVidSet = aggregatedCentralStore[startVid];
aggregatedEndVidSet.insert(endVidSet.begin(), endVidSet.end());
aggregatedCentralStore[startVid] = aggregatedEndVidSet;
}
std::vector<std::string> paritionIdList = Utils::split(partitionIdList, ',');
std::vector<std::string>::iterator partitionIdListIterator;
for (partitionIdListIterator = paritionIdList.begin(); partitionIdListIterator != paritionIdList.end();
++partitionIdListIterator) {
std::string aggregatePartitionId = *partitionIdListIterator;
struct stat s;
std::string centralGraphIdentifier = graphId + +"_centralstore_" + aggregatePartitionId;
std::string centralStoreFile = aggregatorFilePath + "/" + centralGraphIdentifier;
if (stat(centralStoreFile.c_str(), &s) == 0) {
if (s.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore =
JasmineGraphInstanceService::loadCentralStore(centralStoreFile);
map<long, unordered_set<long>> centralGraphMap = centralStore.getUnderlyingHashMap();
map<long, unordered_set<long>>::iterator centralGraphMapIterator;
for (centralGraphMapIterator = centralGraphMap.begin();
centralGraphMapIterator != centralGraphMap.end(); ++centralGraphMapIterator) {
long startVid = centralGraphMapIterator->first;
unordered_set<long> endVidSet = centralGraphMapIterator->second;
unordered_set<long> aggregatedEndVidSet = aggregatedCentralStore[startVid];
aggregatedEndVidSet.insert(endVidSet.begin(), endVidSet.end());
aggregatedCentralStore[startVid] = aggregatedEndVidSet;
}
}
}
}
instance_logger.log("###INSTANCE### Central Store Aggregation : Completed", "info");
map<long, long> distributionHashMap =
JasmineGraphInstanceService::getOutDegreeDistributionHashMap(aggregatedCentralStore);
std::string triangles = Triangles::countCentralStoreTriangles(aggregatedCentralStore, distributionHashMap, threadPriority);
return triangles;
}
string JasmineGraphInstanceService::aggregateCompositeCentralStoreTriangles(std::string compositeFileList,
std::string availableFileList, int threadPriority) {
Utils utils;
instance_logger.log("###INSTANCE### Started Aggregating Composite Central Store Triangles", "info");
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
std::string dataFolder = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
map<long, unordered_set<long>> aggregatedCompositeCentralStore;
std::vector<std::string> compositeCentralStoreFileList = Utils::split(compositeFileList, ':');
std::vector<std::string>::iterator compositeCentralStoreFileIterator;
std::vector<std::string> availableCompositeFileList = Utils::split(availableFileList, ':');
std::vector<std::string>::iterator availableCompositeFileIterator;
for (availableCompositeFileIterator = availableCompositeFileList.begin();
availableCompositeFileIterator != availableCompositeFileList.end(); ++availableCompositeFileIterator) {
std::string availableCompositeFileName = *availableCompositeFileIterator;
size_t lastindex = availableCompositeFileName.find_last_of(".");
string rawFileName = availableCompositeFileName.substr(0, lastindex);
struct stat st;
std::string availableCompositeFile = dataFolder + "/" + rawFileName;
if (stat(availableCompositeFile.c_str(), &st) == 0) {
if (st.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore =
JasmineGraphInstanceService::loadCentralStore(availableCompositeFile);
map<long, unordered_set<long>> compositeCentralGraphMap = centralStore.getUnderlyingHashMap();
map<long, unordered_set<long>>::iterator compositeCentralGraphMapIterator;
for (compositeCentralGraphMapIterator = compositeCentralGraphMap.begin();
compositeCentralGraphMapIterator != compositeCentralGraphMap.end();
++compositeCentralGraphMapIterator) {
long startVid = compositeCentralGraphMapIterator->first;
unordered_set<long> endVidSet = compositeCentralGraphMapIterator->second;
unordered_set<long> aggregatedEndVidSet = aggregatedCompositeCentralStore[startVid];
aggregatedEndVidSet.insert(endVidSet.begin(), endVidSet.end());
aggregatedCompositeCentralStore[startVid] = aggregatedEndVidSet;
}
}
}
}
for (compositeCentralStoreFileIterator = compositeCentralStoreFileList.begin();
compositeCentralStoreFileIterator != compositeCentralStoreFileList.end();
++compositeCentralStoreFileIterator) {
std::string compositeCentralStoreFileName = *compositeCentralStoreFileIterator;
size_t lastindex = compositeCentralStoreFileName.find_last_of(".");
string rawFileName = compositeCentralStoreFileName.substr(0, lastindex);
struct stat s;
std::string compositeCentralStoreFile = aggregatorFilePath + "/" + rawFileName;
if (stat(compositeCentralStoreFile.c_str(), &s) == 0) {
if (s.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore =
JasmineGraphInstanceService::loadCentralStore(compositeCentralStoreFile);
map<long, unordered_set<long>> centralGraphMap = centralStore.getUnderlyingHashMap();
map<long, unordered_set<long>>::iterator centralGraphMapIterator;
for (centralGraphMapIterator = centralGraphMap.begin();
centralGraphMapIterator != centralGraphMap.end(); ++centralGraphMapIterator) {
long startVid = centralGraphMapIterator->first;
unordered_set<long> endVidSet = centralGraphMapIterator->second;
unordered_set<long> aggregatedEndVidSet = aggregatedCompositeCentralStore[startVid];
aggregatedEndVidSet.insert(endVidSet.begin(), endVidSet.end());
aggregatedCompositeCentralStore[startVid] = aggregatedEndVidSet;
}
}
}
}
instance_logger.log("###INSTANCE### Central Store Aggregation : Completed", "info");
map<long, long> distributionHashMap =
JasmineGraphInstanceService::getOutDegreeDistributionHashMap(aggregatedCompositeCentralStore);
std::string triangles = Triangles::countCentralStoreTriangles(aggregatedCompositeCentralStore, distributionHashMap,
threadPriority);
return triangles;
}
map<long, long> JasmineGraphInstanceService::getOutDegreeDistributionHashMap(map<long, unordered_set<long>> graphMap) {
map<long, long> distributionHashMap;
for (map<long, unordered_set<long>>::iterator it = graphMap.begin(); it != graphMap.end(); ++it) {
long distribution = (it->second).size();
distributionHashMap.insert(std::make_pair(it->first, distribution));
}
return distributionHashMap;
}
string JasmineGraphInstanceService::requestPerformanceStatistics(std::string isVMStatManager,
std::string isResourceAllocationRequested) {
Utils utils;
int memoryUsage = collector.getMemoryUsageByProcess();
double cpuUsage = collector.getCpuUsage();
double loadAverage = collector.getLoadAverage();
std::string vmLevelStatistics = collector.collectVMStatistics(isVMStatManager, isResourceAllocationRequested);
auto executedTime = std::chrono::system_clock::now();
std::time_t reportTime = std::chrono::system_clock::to_time_t(executedTime);
std::string reportTimeString(std::ctime(&reportTime));
reportTimeString = utils.trim_copy(reportTimeString, " \f\n\r\t\v");
std::string usageString = reportTimeString + "," + to_string(memoryUsage) + "," + to_string(cpuUsage) + "," +
to_string(loadAverage);
if (!vmLevelStatistics.empty()) {
usageString = usageString + "," + vmLevelStatistics;
}
return usageString;
}
void JasmineGraphInstanceService::collectTrainedModels(
instanceservicesessionargs *sessionargs, std::string graphID,
std::map<std::string, JasmineGraphInstanceService::workerPartitions> graphPartitionedHosts, int totalPartitions) {
int total_threads = totalPartitions;
std::thread *workerThreads = new std::thread[total_threads];
int count = 0;
std::map<std::string, JasmineGraphInstanceService::workerPartitions>::iterator mapIterator;
for (mapIterator = graphPartitionedHosts.begin(); mapIterator != graphPartitionedHosts.end(); mapIterator++) {
string hostName = mapIterator->first;
JasmineGraphInstanceService::workerPartitions workerPartitions = mapIterator->second;
std::vector<std::string>::iterator it;
for (it = workerPartitions.partitionID.begin(); it != workerPartitions.partitionID.end(); it++) {
workerThreads[count] =
std::thread(&JasmineGraphInstanceService::collectTrainedModelThreadFunction, sessionargs, hostName,
workerPartitions.port, workerPartitions.dataPort, graphID, *it);
count++;
}
}
for (int threadCount = 0; threadCount < count; threadCount++) {
workerThreads[threadCount].join();
std::cout << "Thread [C]: " << threadCount << " joined" << std::endl;
}
}
int JasmineGraphInstanceService::collectTrainedModelThreadFunction(instanceservicesessionargs *sessionargs,
std::string host, int port, int dataPort,
std::string graphID, std::string partition) {
Utils utils;
bool result = true;
std::cout << pthread_self() << " host : " << host << " port : " << port << " DPort : " << dataPort << std::endl;
int sockfd;
char data[INSTANCE_DATA_LENGTH + 1];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cerr << "Cannot accept connection" << std::endl;
return 0;
}
if (host.find('@') != std::string::npos) {
host = utils.split(host, '@')[1];
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cerr << "ERROR, no host named " << server << std::endl;
}
bzero((char *)&serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
std::cerr << "ERROR connecting" << std::endl;
// TODO::exit
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
write(sockfd, JasmineGraphInstanceProtocol::HANDSHAKE.c_str(), JasmineGraphInstanceProtocol::HANDSHAKE.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::HANDSHAKE, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::HANDSHAKE_OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::HANDSHAKE_OK, "info");
string server_host = sessionargs->host;
write(sockfd, server_host.c_str(), server_host.size());
instance_logger.log("Sent : " + server_host, "info");
write(sockfd, JasmineGraphInstanceProtocol::INITIATE_MODEL_COLLECTION.c_str(),
JasmineGraphInstanceProtocol::INITIATE_MODEL_COLLECTION.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::INITIATE_MODEL_COLLECTION, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
string server_host = sessionargs->host;
write(sockfd, server_host.c_str(), server_host.size());
instance_logger.log("Sent : " + server_host, "info");
int server_port = sessionargs->port;
write(sockfd, to_string(server_port).c_str(), to_string(server_port).size());
instance_logger.log("Sent : " + server_port, "info");
int server_data_port = sessionargs->dataPort;
write(sockfd, to_string(server_data_port).c_str(), to_string(server_data_port).size());
instance_logger.log("Sent : " + server_data_port, "info");
write(sockfd, graphID.c_str(), (graphID).size());
instance_logger.log("Sent : Graph ID " + graphID, "info");
write(sockfd, partition.c_str(), (partition).size());
instance_logger.log("Sent : Partition ID " + partition, "info");
write(sockfd, JasmineGraphInstanceProtocol::SEND_FILE_NAME.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_NAME.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string fileName = (data);
instance_logger.log("Received File name: " + fileName, "info");
write(sockfd, JasmineGraphInstanceProtocol::SEND_FILE_LEN.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_LEN.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string size = (data);
instance_logger.log("Received file size in bytes: " + size, "info");
write(sockfd, JasmineGraphInstanceProtocol::SEND_FILE_CONT.c_str(),
JasmineGraphInstanceProtocol::SEND_FILE_CONT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
string fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + fileName;
int fileSize = atoi(size.c_str());
while (utils.fileExists(fullFilePath) && utils.getFileSize(fullFilePath) < fileSize) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
write(sockfd, JasmineGraphInstanceProtocol::FILE_RECV_WAIT.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_WAIT.size());
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::FILE_RECV_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
write(sockfd, JasmineGraphInstanceProtocol::FILE_ACK.c_str(),
JasmineGraphInstanceProtocol::FILE_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
}
utils.unzipDirectory(fullFilePath);
size_t lastindex = fileName.find_last_of(".");
string pre_rawname = fileName.substr(0, lastindex);
size_t next_lastindex = pre_rawname.find_last_of(".");
string rawname = fileName.substr(0, next_lastindex);
fullFilePath =
utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder") + "/" + rawname;
while (!utils.fileExists(fullFilePath)) {
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(sockfd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
}
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
write(sockfd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK.size());
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
}
}
} else {
instance_logger.log("There was an error in the model collection process and the response is :: " + response,
"error");
}
close(sockfd);
return 0;
}
void JasmineGraphInstanceService::createPartitionFiles(std::string graphID, std::string partitionID,
std::string fileType) {
Utils utils;
utils.createDirectory(utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder"));
JasmineGraphHashMapLocalStore *hashMapLocalStore = new JasmineGraphHashMapLocalStore();
string inputFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" +
graphID + "_" + partitionID;
string outputFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder") + "/" +
graphID + "_" + partitionID;
if (fileType == "centralstore") {
inputFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder") + "/" + graphID +
"_centralstore_" + partitionID;
outputFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder") + "/" +
graphID + "_centralstore_" + partitionID;
}
std::map<int, std::vector<int>> partEdgeMap = hashMapLocalStore->getEdgeHashMap(inputFilePath);
if (!partEdgeMap.empty()) {
std::ofstream localFile(outputFilePath);
if (localFile.is_open()) {
for (auto it = partEdgeMap.begin(); it != partEdgeMap.end(); ++it) {
int vertex = it->first;
std::vector<int> destinationSet = it->second;
if (!destinationSet.empty()) {
for (std::vector<int>::iterator itr = destinationSet.begin(); itr != destinationSet.end(); ++itr) {
string edge;
edge = std::to_string(vertex) + " " + std::to_string((*itr));
localFile << edge;
localFile << "\n";
}
}
}
}
localFile.flush();
localFile.close();
}
}
void JasmineGraphInstanceService::collectExecutionData(string iteration, string trainArgs, string partCount) {
pthread_mutex_lock(&map_lock);
if (iterationData.find(stoi(iteration)) == iterationData.end()) {
vector<string> trainData;
trainData.push_back(trainArgs);
iterationData[stoi(iteration)] = trainData;
} else {
vector<string> trainData = iterationData[stoi(iteration)];
trainData.push_back(trainArgs);
iterationData[stoi(iteration)] = trainData;
}
partitionCounter++;
pthread_mutex_unlock(&map_lock);
if (partitionCounter == stoi(partCount)) {
int maxPartCountInVector = 0;
instance_logger.log("Data collection done for all iterations", "info");
for (auto bin = iterationData.begin(); bin != iterationData.end(); ++bin) {
if (maxPartCountInVector < bin->second.size()) {
maxPartCountInVector = bin->second.size();
}
}
JasmineGraphInstanceService::executeTrainingIterations(maxPartCountInVector);
return;
} else {
return;
}
}
void JasmineGraphInstanceService::executeTrainingIterations(int maxThreads) {
int iterCounter = 0;
std::thread *threadList = new std::thread[maxThreads];
for (auto bin = iterationData.begin(); bin != iterationData.end(); ++bin) {
vector<string> partVector = bin->second;
int count = 0;
for (auto trainarg = partVector.begin(); trainarg != partVector.end(); ++trainarg) {
string trainData = *trainarg;
threadList[count] = std::thread(trainPartition, trainData);
count++;
}
iterCounter++;
instance_logger.log("Trainings initiated for iteration " + to_string(iterCounter), "info");
for (int threadCount = 0; threadCount < count; threadCount++) {
threadList[threadCount].join();
}
instance_logger.log("Trainings completed for iteration " + to_string(iterCounter), "info");
}
iterationData.clear();
partitionCounter = 0;
}
void JasmineGraphInstanceService::trainPartition(string trainData) {
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::vector<char *> vc;
std::transform(trainargs.begin(), trainargs.end(), std::back_inserter(vc), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.graphsage") + " && ";
std::string command = path + "python3.11 -m unsupervised_train ";
int argc = trainargs.size();
for (int i = 0; i < argc - 2; ++i) {
command += trainargs[i + 2];
command += " ";
}
system(command.c_str());
}
map<long, long> JasmineGraphInstanceService::calculateLocalOutDegreeDistribution(
string graphID, string partitionID, std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores) {
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore>::iterator it;
std::map<std::string, JasmineGraphHashMapCentralStore>::iterator itcen;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStores);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStores[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
map<long, long> degreeDistribution = graphDB.getInDegreeDistributionHashMap();
std::map<long, long>::iterator its;
map<long, long> degreeDistributionCentral = centralDB.getInDegreeDistributionHashMap();
std::map<long, long>::iterator itcentral;
for (its = degreeDistributionCentral.begin(); its != degreeDistributionCentral.end(); ++its) {
bool centralNodeFound = false;
for (itcentral = degreeDistribution.begin(); itcentral != degreeDistribution.end(); ++itcentral) {
if ((its->first) == (itcentral->first)) {
degreeDistribution[its->first] = (its->second) + (itcentral->second);
centralNodeFound = true;
}
}
if (!centralNodeFound) {
degreeDistribution.insert(std::make_pair(its->first, its->second));
}
}
}
bool JasmineGraphInstanceService::duplicateCentralStore(int thisWorkerPort, int graphID, int partitionID,
std::vector<string> workerSockets, std::string masterIP) {
Utils utils;
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.aggregatefolder");
std::string dataFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string centralGraphIdentifierUnCompressed = to_string(graphID) +"_centralstore_"+ to_string(partitionID);
std::string centralStoreFileUnCompressed = dataFilePath + "/" + centralGraphIdentifierUnCompressed;
std::string centralStoreFileUnCompressedDestination = aggregatorFilePath + "/" + centralGraphIdentifierUnCompressed;
// temporary copy the central store into the aggregate folder in order to compress and send
utils.copyFile(centralStoreFileUnCompressed, aggregatorFilePath);
// compress the central store file before sending
utils.compressFile(centralStoreFileUnCompressedDestination);
std::string centralGraphIdentifier = to_string(graphID) +"_centralstore_"+ to_string(partitionID) + ".gz";
std::string centralStoreFile = aggregatorFilePath + "/" + centralGraphIdentifier;
instance_logger.log("###INSTANCE### centralstore " + centralStoreFile,"info");
for (vector<string>::iterator workerIt=workerSockets.begin(); workerIt!=workerSockets.end(); ++workerIt) {
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
if (workerSocketPair.size() != 4) {
instance_logger.log("Received worker socket information is invalid " , "error");
return 0;
}
struct stat fileStat;
if (stat(centralStoreFile.c_str(),&fileStat) == 0) {
if (fileStat.st_mode & S_IFREG) {
string host = workerSocketPair[0];
int port = stoi(workerSocketPair[1]);
int workerGraphID = stoi(workerSocketPair[2]);
int dataPort = stoi(workerSocketPair[3]);
if (port == thisWorkerPort) {
continue;
}
Utils utils;
bool result = true;
std::cout << pthread_self() << " host : " << host << " port : " << port << " DPort : " << dataPort << std::endl;
int sockfd;
char data[INSTANCE_DATA_LENGTH + 1];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
instance_logger.log( "Cannot accept connection" , "error");
return 0;
}
if (host.find('@') != std::string::npos) {
host = utils.split(host, '@')[1];
}
server = gethostbyname(host.c_str());
if (server == NULL) {
instance_logger.log("ERROR, no host named " , "error");;
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
instance_logger.log("ERROR connecting", "error");
//TODO::exit
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
int result_wr = write(sockfd, JasmineGraphInstanceProtocol::HANDSHAKE.c_str(), JasmineGraphInstanceProtocol::HANDSHAKE.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::HANDSHAKE, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::HANDSHAKE_OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::HANDSHAKE_OK, "info");
result_wr = write(sockfd, masterIP.c_str(), masterIP.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + masterIP, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::HOST_OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::HOST_OK, "info");
} else {
instance_logger.log("Received : " + response, "error");
}
result_wr = write(sockfd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_CENTRAL.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_CENTRAL.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CENTRAL, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
result_wr = write(sockfd, std::to_string(graphID).c_str(), std::to_string(graphID).size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Graph ID " + std::to_string(graphID), "info");
std::string fileName = utils.getFileName(centralStoreFile);
int fileSize = utils.getFileSize(centralStoreFile);
std::string fileLength = to_string(fileSize);
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::SEND_FILE_NAME) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_FILE_NAME, "info");
result_wr = write(sockfd, fileName.c_str(), fileName.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : File name " + fileName, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::SEND_FILE_LEN) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_FILE_LEN, "info");
result_wr = write(sockfd, fileLength.c_str(), fileLength.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : File length in bytes " + fileLength, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::SEND_FILE_CONT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::SEND_FILE_CONT, "info");
instance_logger.log("Going to send file through service", "info");
JasmineGraphInstanceService::sendFileThroughService(host, dataPort, fileName, centralStoreFile, masterIP);
}
}
}
int count = 0;
while (true) {
result_wr = write(sockfd, JasmineGraphInstanceProtocol::FILE_RECV_CHK.c_str(),
JasmineGraphInstanceProtocol::FILE_RECV_CHK.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::FILE_RECV_CHK, "info");
instance_logger.log("Checking if file is received", "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::FILE_RECV_WAIT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_RECV_WAIT, "info");
instance_logger.log("Checking file status : " + to_string(count), "info");
count++;
sleep(1);
continue;
} else if (response.compare(JasmineGraphInstanceProtocol::FILE_ACK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::FILE_ACK, "info");
instance_logger.log("File transfer completed for file : " + centralStoreFile, "info");
break;
}
};
//Next we wait till the batch upload completes
while (true) {
result_wr = write(sockfd, JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK.c_str(),
JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_CHK, "info");
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
response = (data);
if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_WAIT, "info");
sleep(1);
continue;
} else if (response.compare(JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::BATCH_UPLOAD_ACK, "info");
instance_logger.log("Batch upload completed", "info");
break;
}
}
}
} else {
instance_logger.log("There was an error in the upload process and the response is :: " + response, "error");
}
close(sockfd);
}
}
}
return 0;
}
bool JasmineGraphInstanceService::sendFileThroughService(std::string host, int dataPort, std::string fileName,
std::string filePath, std::string masterIP) {
Utils utils;
int sockfd;
char data[INSTANCE_DATA_LENGTH + 1];
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cerr << "Cannot accept connection" << std::endl;
return false;
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cerr << "ERROR, no host named " << server << std::endl;
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(dataPort);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
std::cerr << "ERROR connecting to port " << dataPort << std::endl;
}
int result_wr = write(sockfd, fileName.c_str(), fileName.size());
if(result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
bzero(data, INSTANCE_DATA_LENGTH + 1);
read(sockfd, data, INSTANCE_DATA_LENGTH);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::SEND_FILE) == 0) {
std::cout << "Sending file " << filePath << " through port " << dataPort << std::endl;
FILE *fp = fopen(filePath.c_str(), "r");
if (fp == NULL) {
instance_logger.log("Error opening file", "error");
close(sockfd);
return false;
}
for (;;) {
unsigned char buff[INSTANCE_FILE_BUFFER_LENGTH] = {0};
int nread = fread(buff, 1, INSTANCE_FILE_BUFFER_LENGTH, fp);
instance_logger.log("Bytes read " + to_string(nread), "info");
/* If read was success, send data. */
if (nread > 0) {
instance_logger.log("Sending", "info");
write(sockfd, buff, nread);
}
if (nread < INSTANCE_FILE_BUFFER_LENGTH) {
if (feof(fp))
printf("End of file\n");
if (ferror(fp))
printf("Error reading\n");
break;
}
}
fclose(fp);
close(sockfd);
return true;
}
return false;
}
map<long, long> calculateOutDegreeDist(string graphID, string partitionID, int serverPort,
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores,
std::vector<string> workerSockets) {
Utils utils;
map<long, long> degreeDistribution = calculateLocalOutDegreeDist(graphID, partitionID,
graphDBMapLocalStores,
graphDBMapCentralStores);
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_odd_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, long>::iterator it = degreeDistribution.begin(); it != degreeDistribution.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
// Invoke other workers to calculate their own out degree distributions
//todo invoke other workers asynchronously
for (vector<string>::iterator workerIt = workerSockets.begin();
workerIt != workerSockets.end(); ++workerIt) {
instance_logger.log("Worker pair " + *workerIt, "info");
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
if (std::to_string(serverPort).compare(workerSocketPair[1]) == 0) {
continue;
}
string host = workerSocketPair[0];
int port = stoi(workerSocketPair[1]);
int sockfd;
char data[301];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cout << "Cannot accept connection" << std::endl;
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cout << "ERROR, no host named " << server << std::endl;
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
std::cout << "ERROR connecting" << std::endl;
//TODO::exit
}
bzero(data, 301);
int result_wr = write(sockfd,
JasmineGraphInstanceProtocol::WORKER_OUT_DEGREE_DISTRIBUTION.c_str(),
JasmineGraphInstanceProtocol::WORKER_OUT_DEGREE_DISTRIBUTION.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " +
JasmineGraphInstanceProtocol::WORKER_OUT_DEGREE_DISTRIBUTION,
"info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
result_wr = write(sockfd, graphID.c_str(), graphID.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Graph ID " + graphID, "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
instance_logger.log("Partition ID : " + workerSocketPair[2], "info");
string degreeDistString;
int partitionID = stoi(workerSocketPair[2]);
result_wr = write(sockfd, std::to_string(partitionID).c_str(),
std::to_string(partitionID).size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Partition ID " + std::to_string(partitionID), "info");
}
}
}
return degreeDistribution;
}
map<long, long> calculateLocalOutDegreeDist(string graphID, string partitionID,
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores) {
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore>::iterator it;
std::map<std::string, JasmineGraphHashMapCentralStore>::iterator itcen;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStores);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID,
graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStores[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
map<long, long> degreeDistributionLocal = graphDB.getOutDegreeDistributionHashMap();
std::map<long, long>::iterator itlocal;
map<long, long> degreeDistributionCentral = centralDB.getOutDegreeDistributionHashMap();
std::map<long, long>::iterator itcentral;
map<long, long> degreeDistributionCentralTotal;
map<long, unordered_set<long>> centralGraphMap = centralDB.getUnderlyingHashMap();
map<long, unordered_set<long>> localGraphMap = graphDB.getUnderlyingHashMap();
//combine the degree distributions from local store and central store
for (itcentral = degreeDistributionCentral.begin(); itcentral != degreeDistributionCentral.end(); ++itcentral) {
bool centralNodeFound = false;
for (itlocal = degreeDistributionLocal.begin(); itlocal != degreeDistributionLocal.end(); ++itlocal) {
if ((itcentral->first) == (itlocal->first)) {
degreeDistributionCentralTotal.insert(
std::make_pair(itcentral->first, (itlocal->second + itcentral->second)));
centralNodeFound = true;
break;
}
}
if (!centralNodeFound) {
degreeDistributionCentralTotal.insert(std::make_pair(itcentral->first, itcentral->second));
}
}
return degreeDistributionCentralTotal;
}
map<long, long> calculateLocalInDegreeDist(string graphID, string partitionID,
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores) {
JasmineGraphHashMapLocalStore graphDB;
JasmineGraphHashMapCentralStore centralDB;
std::map<std::string, JasmineGraphHashMapLocalStore>::iterator it;
std::map<std::string, JasmineGraphHashMapCentralStore>::iterator itcen;
if (JasmineGraphInstanceService::isGraphDBExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadLocalStore(graphID, partitionID, graphDBMapLocalStores);
}
if (JasmineGraphInstanceService::isInstanceCentralStoreExists(graphID, partitionID)) {
JasmineGraphInstanceService::loadInstanceCentralStore(graphID, partitionID, graphDBMapCentralStores);
}
graphDB = graphDBMapLocalStores[graphID + "_" + partitionID];
centralDB = graphDBMapCentralStores[graphID + "_centralstore_" + partitionID];
map<long, long> degreeDistribution = graphDB.getInDegreeDistributionHashMap();
std::map<long, long>::iterator its;
map<long, long> degreeDistributionCentral = centralDB.getInDegreeDistributionHashMap();
std::map<long, long>::iterator itcentral;
for (its = degreeDistributionCentral.begin(); its != degreeDistributionCentral.end(); ++its) {
bool centralNodeFound = false;
for (itcentral = degreeDistribution.begin(); itcentral != degreeDistribution.end(); ++itcentral) {
if ((its->first) == (itcentral->first)) {
degreeDistribution[its->first] = (its->second) + (itcentral->second);
centralNodeFound = true;
}
}
if (!centralNodeFound) {
degreeDistribution.insert(std::make_pair(its->first, its->second));
}
}
return degreeDistribution;
}
map<long, long> calculateInDegreeDist(string graphID, string partitionID, int serverPort,
std::map<std::string, JasmineGraphHashMapLocalStore> graphDBMapLocalStores,
std::map<std::string, JasmineGraphHashMapCentralStore> graphDBMapCentralStores,
std::vector<string> workerSockets) {
Utils utils;
map<long, long> degreeDistribution = calculateLocalInDegreeDist(graphID, partitionID, graphDBMapLocalStores,
graphDBMapCentralStores);
instance_logger.log("In Degree Dist size: " + to_string(degreeDistribution.size()), "info");
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_idd_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, long>::iterator it = degreeDistribution.begin(); it != degreeDistribution.end(); ++it) {
partfile << to_string(it -> first) << "\t" << to_string(it -> second) << endl;
}
partfile.close();
// Invoke other workers to calculate their own in degree distributions
//todo invoke other workers asynchronously
for (vector<string>::iterator workerIt = workerSockets.begin(); workerIt != workerSockets.end(); ++workerIt) {
instance_logger.log("Worker pair " + *workerIt, "info");
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
if (std::to_string(serverPort).compare(workerSocketPair[1]) == 0) {
continue;
}
string host = workerSocketPair[0];
int port = stoi(workerSocketPair[1]);
int sockfd;
char data[301];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cout << "Cannot accept connection" << std::endl;
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cout << "ERROR, no host named " << server << std::endl;
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
std::cout << "ERROR connecting" << std::endl;
//TODO::exit
}
bzero(data, 301);
int result_wr = write(sockfd, JasmineGraphInstanceProtocol::WORKER_IN_DEGREE_DISTRIBUTION.c_str(),
JasmineGraphInstanceProtocol::WORKER_IN_DEGREE_DISTRIBUTION.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " + JasmineGraphInstanceProtocol::WORKER_IN_DEGREE_DISTRIBUTION,
"info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
result_wr = write(sockfd, graphID.c_str(), graphID.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Graph ID " + graphID, "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
string degreeDistString;
int partitionID = stoi(workerSocketPair[2]);
result_wr = write(sockfd, std::to_string(partitionID).c_str(), std::to_string(partitionID).size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Partition ID " + std::to_string(partitionID), "info");
}
}
}
return degreeDistribution;
}
map<long, map<long, unordered_set<long>>> calculateLocalEgoNet(string graphID, string partitionID,
int serverPort, JasmineGraphHashMapLocalStore localDB,
JasmineGraphHashMapCentralStore centralDB,
std::vector<string> workerSockets) {
std::map<long, map<long, unordered_set<long>>> egonetMap;
map<long, unordered_set<long>> centralGraphMap = centralDB.getUnderlyingHashMap();
map<long, unordered_set<long>> localGraphMap = localDB.getUnderlyingHashMap();
for (map<long, unordered_set<long >>::iterator it = localGraphMap.begin(); it != localGraphMap.end(); ++it) {
unordered_set<long> neighbours = it->second;
map<long, unordered_set<long>> individualEgoNet;
individualEgoNet.insert(std::make_pair(it->first, neighbours));
for (unordered_set<long>::iterator neighbour = neighbours.begin(); neighbour != neighbours.end(); ++neighbour) {
unordered_set<long> neighboursOfNeighboursInSameEgoNet;
map<long, unordered_set<long>>::iterator localGraphMapItr = localGraphMap.find(*neighbour);
if (localGraphMapItr != localGraphMap.end()) {
unordered_set<long> neighboursOfNeighbour = localGraphMapItr->second;
for (auto neighboursOfNeighbourItr = neighboursOfNeighbour.begin(); neighboursOfNeighbourItr != neighboursOfNeighbour.end();
++neighboursOfNeighbourItr) {
unordered_set<long>::iterator neighboursItr = neighbours.find(*neighboursOfNeighbourItr);
if (neighboursItr != neighbours.end()) {
neighboursOfNeighboursInSameEgoNet.insert(*neighboursItr);
}
}
}
individualEgoNet.insert(std::make_pair(*neighbour, neighboursOfNeighboursInSameEgoNet));
}
egonetMap.insert(std::make_pair(it->first, individualEgoNet));
}
for (map<long, unordered_set<long>>::iterator it = centralGraphMap.begin(); it != centralGraphMap.end(); ++it) {
unordered_set<long> distribution = it->second;
map<long, map<long, unordered_set<long>>>::iterator egonetMapItr = egonetMap.find(it->first);
if (egonetMapItr == egonetMap.end()) {
map<long, unordered_set<long>> vertexMapFromCentralStore;
vertexMapFromCentralStore.insert(std::make_pair(it->first,
distribution)); // Here we do not have the relation information among neighbours
egonetMap.insert(std::make_pair(it->first, vertexMapFromCentralStore));
} else {
map<long, unordered_set<long>> egonetSubGraph = egonetMapItr->second;
map<long, unordered_set<long>>::iterator egonetSubGraphItr = egonetSubGraph.find(it->first);
if (egonetSubGraphItr != egonetSubGraph.end()) {
unordered_set<long> egonetSubGraphNeighbours = egonetSubGraphItr->second;
egonetSubGraphNeighbours.insert(distribution.begin(), distribution.end());
egonetSubGraphItr->second = egonetSubGraphNeighbours;
}
}
}
for (vector<string>::iterator workerIt = workerSockets.begin(); workerIt != workerSockets.end(); ++workerIt) {
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
Utils utils;
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string centralGraphIdentifier = graphID + +"_centralstore_" + workerSocketPair[2];
std::string centralStoreFile = aggregatorFilePath + "/" + centralGraphIdentifier;
instance_logger.log("###INSTANCE### centralstore " + centralStoreFile, "info");
struct stat centralStoreFileBuffer;
if (stat(centralStoreFile.c_str(), ¢ralStoreFileBuffer) == 0) {
if (centralStoreFileBuffer.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore = JasmineGraphInstanceService::loadCentralStore(
centralStoreFile);
map<long, unordered_set<long>> centralGraphMap = centralStore.getUnderlyingHashMap();
for (map<long, unordered_set<long>>::iterator centralGraphMapIterator = centralGraphMap.begin();
centralGraphMapIterator != centralGraphMap.end(); ++centralGraphMapIterator) {
long startVid = centralGraphMapIterator->first;
unordered_set<long> endVidSet = centralGraphMapIterator->second;
for (auto itr = endVidSet.begin(); itr != endVidSet.end(); ++itr) {
map<long, map<long, unordered_set<long>>>::iterator egonetMapItr = egonetMap.find(*itr);
if (egonetMapItr != egonetMap.end()) {
map<long, unordered_set<long>> egonetSubGraph = egonetMapItr->second;
map<long, unordered_set<long>>::iterator egonetSubGraphItr = egonetSubGraph.find(*itr);
if (egonetSubGraphItr != egonetSubGraph.end()) {
unordered_set<long> egonetSubGraphNeighbours = egonetSubGraphItr->second;
egonetSubGraphNeighbours.insert(startVid);
egonetSubGraphItr->second = egonetSubGraphNeighbours;
}
}
}
}
}
}
}
return egonetMap;
}
void calculateEgoNet(string graphID, string partitionID,
int serverPort, JasmineGraphHashMapLocalStore localDB,
JasmineGraphHashMapCentralStore centralDB,
string workerList) {
std::vector<string> workerSockets;
stringstream wl(workerList);
string intermediate;
while (getline(wl, intermediate, ',')) {
workerSockets.push_back(intermediate);
}
map<long, map<long, unordered_set<long>>> egonetMap = calculateLocalEgoNet(graphID, partitionID,
serverPort, localDB, centralDB,
workerSockets);
Utils utils;
string instanceDataFolderLocation = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
string attributeFilePart = instanceDataFolderLocation + "/" + graphID + "_egonet_" + partitionID;
ofstream partfile;
partfile.open(attributeFilePart, std::fstream::trunc);
for (map<long, map<long, unordered_set<long>>>::iterator it = egonetMap.begin(); it != egonetMap.end(); ++it) {
map<long, unordered_set<long>> egonetInternalMap = it->second;
for (map<long, unordered_set<long>>::iterator itm = egonetInternalMap.begin(); itm != egonetInternalMap.end(); ++itm) {
unordered_set<long> egonetInternalMapEdges = itm->second;
for (unordered_set<long>::iterator ite = egonetInternalMapEdges.begin(); ite != egonetInternalMapEdges.end(); ++ite) {
partfile << to_string(it->first) << "\t" << to_string(itm->first) << "\t" << to_string(*ite) << endl;
}
}
}
partfile.close();
//todo invoke other workers asynchronously
for (vector<string>::iterator workerIt = workerSockets.begin();
workerIt != workerSockets.end(); ++workerIt) {
instance_logger.log("Worker pair " + *workerIt, "info");
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
if (std::to_string(serverPort).compare(workerSocketPair[1]) == 0) {
continue;
}
Utils utils;
string host = workerSocketPair[0];
int port = stoi(workerSocketPair[1]);
int sockfd;
char data[301];
bool loop = false;
socklen_t len;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
std::cout << "Cannot accept connection" << std::endl;
}
server = gethostbyname(host.c_str());
if (server == NULL) {
std::cout << "ERROR, no host named " << server << std::endl;
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr,
(char *) &serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
std::cout << "ERROR connecting" << std::endl;
//TODO::exit
}
bzero(data, 301);
int result_wr = write(sockfd,
JasmineGraphInstanceProtocol::WORKER_EGO_NET.c_str(),
JasmineGraphInstanceProtocol::WORKER_EGO_NET.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : " +
JasmineGraphInstanceProtocol::WORKER_EGO_NET, "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
result_wr = write(sockfd, graphID.c_str(), graphID.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Graph ID " + graphID, "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
instance_logger.log("Partition ID : " + workerSocketPair[2], "info");
string egonetString;
int partitionID = stoi(workerSocketPair[2]);
result_wr = write(sockfd, std::to_string(partitionID).c_str(),
std::to_string(partitionID).size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Partition ID " + std::to_string(partitionID), "info");
bzero(data, 301);
read(sockfd, data, 300);
string response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (!response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Error reading from socket", "error");
}
result_wr = write(sockfd, workerList.c_str(), workerList.size());
if (result_wr < 0) {
instance_logger.log("Error writing to socket", "error");
}
instance_logger.log("Sent : Host List ", "info");
bzero(data, 301);
read(sockfd, data, 300);
response = (data);
response = utils.trim_copy(response, " \f\n\r\t\v");
if (response.compare(JasmineGraphInstanceProtocol::OK) == 0) {
instance_logger.log("Received : " + JasmineGraphInstanceProtocol::OK, "info");
} else {
instance_logger.log("Error reading from socket", "error");
}
}
}
}
}
map<long, double> calculateLocalPageRank(string graphID, double alpha, string partitionID, int serverPort, int top_k_page_rank_value,
string graphVertexCount, JasmineGraphHashMapLocalStore localDB,
JasmineGraphHashMapCentralStore centralDB,
std::vector<string> workerSockets, int iterations) {
map<long, unordered_set<long>> centralGraphMap = centralDB.getUnderlyingHashMap();
map<long, unordered_set<long>> localGraphMap = localDB.getUnderlyingHashMap();
map<long, unordered_set<long>>::iterator localGraphMapIterator;
map<long, unordered_set<long>>::iterator centralGraphMapIterator;
std::vector<long> vertexVector;
for (localGraphMapIterator = localGraphMap.begin();
localGraphMapIterator != localGraphMap.end(); ++localGraphMapIterator) {
long startVid = localGraphMapIterator->first;
unordered_set<long> endVidSet = localGraphMapIterator->second;
for (auto itr = endVidSet.begin(); itr != endVidSet.end(); ++itr) {
if (localGraphMap.find(*itr) == localGraphMap.end()) {
unordered_set<long> valueSet;
localGraphMap.insert(std::make_pair(*itr, valueSet));
}
}
}
map<long, long> localOutDegreeDistMap = localDB.getOutDegreeDistributionHashMap();
long partitionVertexCount = localGraphMap.size();
long worldOnlyVertexCount = atol(graphVertexCount.c_str()) - partitionVertexCount;
double damp = 1 - alpha;
int M = partitionVertexCount + 1;
long adjacencyIndex[M];
int counter = 0;
for (localGraphMapIterator = localGraphMap.begin();
localGraphMapIterator != localGraphMap.end(); ++localGraphMapIterator) {
long startVid = localGraphMapIterator->first;
adjacencyIndex[counter] = startVid;
counter++;
}
adjacencyIndex[partitionVertexCount] = -1;
map<long, float> hMapAuthorityFlowWorldToLocal = getAuthorityScoresWorldToLocal(graphID, partitionID, serverPort,
graphVertexCount, localDB,
centralDB,
localGraphMap, workerSockets,
worldOnlyVertexCount);
map<long, unordered_set<long>> hMapFromVerticesWorldToLocalFLow = getEdgesWorldToLocal(graphID, partitionID,
serverPort, graphVertexCount,
localDB, centralDB,
localGraphMap,
workerSockets);
long entireGraphSize = atol(graphVertexCount.c_str());
float mu = (damp / entireGraphSize);
unordered_map<float, float> resultTreeMap;
// calculating local pagerank
map<long, double> rankMap;
// add world to local authority scores to the ranks of the current partition
for (auto &hMapAuthorityFlowWorldToLocalIterator: hMapAuthorityFlowWorldToLocal) {
long vertex = hMapAuthorityFlowWorldToLocalIterator.first;
float worldToLocalRank = hMapAuthorityFlowWorldToLocalIterator.second;
auto rankMapItr = rankMap.find(vertex);
if (rankMapItr != rankMap.end()) {
double existingRank = rankMapItr->second;
double finalRank = existingRank + worldToLocalRank;
rankMapItr->second = finalRank;
} else {
rankMap.insert(std::make_pair(vertex, worldToLocalRank));
}
}
int count = 0;
while (count < iterations) {
for (localGraphMapIterator = localGraphMap.begin();
localGraphMapIterator != localGraphMap.end(); ++localGraphMapIterator) {
long startVid = localGraphMapIterator->first;
unordered_set<long> endVidSet = localGraphMapIterator->second;
double existingParentRank = 1;
auto rankMapItr = rankMap.find(startVid);
if (rankMapItr != rankMap.end()) {
existingParentRank = rankMapItr->second;
} else {
rankMap.insert(std::make_pair(startVid, existingParentRank));
}
long degree = endVidSet.size();
double distributedRank = alpha * (existingParentRank / degree) + mu;
for (long itr: endVidSet) {
auto rankMapItr = rankMap.find(itr);
double existingChildRank = 0;
double finalRank = 0;
if (rankMapItr != rankMap.end()) {
existingChildRank = rankMapItr->second;
finalRank = existingChildRank + distributedRank;
rankMapItr->second = finalRank;
} else {
finalRank = existingChildRank + distributedRank;
rankMap.insert(std::make_pair(itr, finalRank));
}
}
}
count++;
}
map<double, long> rankMapResults;
map<long, double> finalPageRankResults;
if (top_k_page_rank_value == -1) {
instance_logger.log("Page rank is not implemented", "info");
} else {
std::string resultTree = "";
for (map<long, double>::iterator rankMapItr = rankMap.begin(); rankMapItr != rankMap.end(); ++rankMapItr) {
rankMapResults.insert(std::make_pair(rankMapItr->second, rankMapItr->first));
}
int count = 0;
for (map<double, long>::iterator rankMapItr = rankMapResults.end();
rankMapItr != rankMapResults.begin(); --rankMapItr) {
if (count > top_k_page_rank_value) {
break;
}
finalPageRankResults.insert(std::make_pair(rankMapItr->second, rankMapItr->first));
count++;
}
}
return finalPageRankResults;
}
map<long, float> getAuthorityScoresWorldToLocal(string graphID, string partitionID, int serverPort,
string graphVertexCount, JasmineGraphHashMapLocalStore localDB,
JasmineGraphHashMapCentralStore centralDB,
map<long, unordered_set<long>> graphVertexMap,
std::vector<string> workerSockets, long worldOnlyVertexCount) {
map<long, unordered_set<long>> worldToLocalVertexMap;
map<long, long> fromDegreeDist;
for (vector<string>::iterator workerIt = workerSockets.begin(); workerIt != workerSockets.end(); ++workerIt) {
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
Utils utils;
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string centralGraphIdentifier = graphID + +"_centralstore_" + workerSocketPair[2];
std::string centralStoreFile = aggregatorFilePath + "/" + centralGraphIdentifier;
instance_logger.log("###INSTANCE### centralstore " + centralStoreFile, "info");
struct stat s;
if (stat(centralStoreFile.c_str(), &s) == 0) {
if (s.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore = JasmineGraphInstanceService::loadCentralStore(
centralStoreFile);
map<long, unordered_set<long>> centralGraphMap = centralStore.getUnderlyingHashMap();
for (map<long, unordered_set<long>>::iterator centralGraphMapIterator = centralGraphMap.begin();
centralGraphMapIterator != centralGraphMap.end(); ++centralGraphMapIterator) {
long startVid = centralGraphMapIterator->first;
unordered_set<long> endVidSet = centralGraphMapIterator->second;
for (auto itr = endVidSet.begin(); itr != endVidSet.end(); ++itr) {
map<long, long>::iterator fromDegreeDistIterator = fromDegreeDist.find(startVid);
if (fromDegreeDistIterator != fromDegreeDist.end()) {
long degree = fromDegreeDistIterator->second;
fromDegreeDistIterator->second = degree + 1;
} else {
fromDegreeDist.insert(std::make_pair(startVid, 1));
}
if (graphVertexMap.find(*itr) != graphVertexMap.end()) {
map<long, unordered_set<long>>::iterator toIDiterator = worldToLocalVertexMap.find(*itr);
if (toIDiterator != worldToLocalVertexMap.end()) {
unordered_set<long> fromIDs = toIDiterator->second;
fromIDs.insert(startVid);
toIDiterator->second = fromIDs;
} else {
unordered_set<long> fromIDs;
fromIDs.insert(startVid);
worldToLocalVertexMap.insert(std::make_pair(*itr, fromIDs));
}
}
}
}
}
}
}
double alpha = 0.85;
double damp = 1 - alpha;
long entireGraphSize = atol(graphVertexCount.c_str());
float mu = (damp / entireGraphSize);
map<long, float> authResultMap;
float authorityScore = 0;
for (map<long, unordered_set<long>>::iterator it = worldToLocalVertexMap.begin();
it != worldToLocalVertexMap.end(); ++it) {
unordered_set<long> distribution = it->second;
for (auto itr = distribution.begin(); itr != distribution.end(); ++itr) {
map<long, long>::iterator oddIterator = fromDegreeDist.find(*itr);
if (oddIterator != fromDegreeDist.end()) {
long degree = oddIterator->second;
map<long, float>::iterator authResultMapItr = authResultMap.find(it->first);
if (authResultMapItr != authResultMap.end()) {
authorityScore = authResultMapItr->second;
authResultMapItr->second = authorityScore + (alpha * (1.0 / degree) + mu);
} else {
authResultMap.insert(std::make_pair(it->first, (alpha * (1.0 / degree) + mu)));
}
}
}
}
map<long, float> authResultMapAdjusted;
for (map<long, float>::iterator it = authResultMap.begin(); it != authResultMap.end(); ++it) {
float adjustedResult = (it->second) / worldOnlyVertexCount;
authResultMapAdjusted.insert(std::make_pair(it->first, adjustedResult));
}
return authResultMapAdjusted;
}
map<long, unordered_set<long>> getEdgesWorldToLocal(string graphID, string partitionID, int serverPort,
string graphVertexCount, JasmineGraphHashMapLocalStore localDB,
JasmineGraphHashMapCentralStore centralDB,
map<long, unordered_set<long>> graphVertexMap,
std::vector<string> workerSockets) {
map<long, unordered_set<long>> worldToLocalVertexMap;
for (vector<string>::iterator workerIt = workerSockets.begin(); workerIt != workerSockets.end(); ++workerIt) {
std::vector<string> workerSocketPair;
stringstream wl(*workerIt);
string intermediate;
while (getline(wl, intermediate, ':')) {
workerSocketPair.push_back(intermediate);
}
Utils utils;
std::string aggregatorFilePath = utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder");
std::string centralGraphIdentifier = graphID + +"_centralstore_" + workerSocketPair[2];
std::string centralStoreFile = aggregatorFilePath + "/" + centralGraphIdentifier;
instance_logger.log("###INSTANCE### centralstore " + centralStoreFile, "info");
struct stat s;
if (stat(centralStoreFile.c_str(), &s) == 0) {
if (s.st_mode & S_IFREG) {
JasmineGraphHashMapCentralStore centralStore = JasmineGraphInstanceService::loadCentralStore(
centralStoreFile);
map<long, unordered_set<long>> centralGraphMap = centralStore.getUnderlyingHashMap();
for (map<long, unordered_set<long>>::iterator centralGraphMapIterator = centralGraphMap.begin();
centralGraphMapIterator != centralGraphMap.end(); ++centralGraphMapIterator) {
long startVid = centralGraphMapIterator->first;
unordered_set<long> endVidSet = centralGraphMapIterator->second;
for (auto itr = endVidSet.begin(); itr != endVidSet.end(); ++itr) {
if (graphVertexMap.find(*itr) != graphVertexMap.end()) {
map<long, unordered_set<long>>::iterator toIDiterator = worldToLocalVertexMap.find(*itr);
if (toIDiterator != worldToLocalVertexMap.end()) {
unordered_set<long> fromIDs = toIDiterator->second;
fromIDs.insert(startVid);
toIDiterator->second = fromIDs;
} else {
unordered_set<long> fromIDs;
fromIDs.insert(startVid);
worldToLocalVertexMap.insert(std::make_pair(*itr, fromIDs));
}
}
}
}
}
}
}
return worldToLocalVertexMap;
}
void JasmineGraphInstanceService::startCollectingLoadAverage() {
int elapsedTime = 0;
time_t start;
time_t end;
StatisticCollector statisticCollector;
start = time(0);
while(collectValid)
{
if(time(0)-start == Conts::LOAD_AVG_COLLECTING_GAP)
{
elapsedTime += Conts::LOAD_AVG_COLLECTING_GAP*1000;
double loadAgerage = statisticCollector.getLoadAverage();
loadAverageVector.push_back(std::to_string(loadAgerage));
start = start + Conts::LOAD_AVG_COLLECTING_GAP;
}
}
}
void JasmineGraphInstanceService::initServer(string trainData){
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::vector<char *> vc;
std::transform(trainargs.begin(), trainargs.end(), std::back_inserter(vc), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.fl.location") + " && ";
std::string command = path + "python3.11 fl_server.py "+ utils.getJasmineGraphProperty("org.jasminegraph.fl.weights") + " "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")+ " "+ graphID + " 0 "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl_clients")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.epochs") +" localhost 5000 > server_logs.txt";
popen(command.c_str(), "r");
}
void JasmineGraphInstanceService::initOrgServer(string trainData){
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
std::string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::vector<char *> vc;
std::transform(trainargs.begin(), trainargs.end(), std::back_inserter(vc), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.fl.location") + " && ";
std::string command = path + "python3.11 org_server.py " + graphID+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl_clients")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.epochs")
+" localhost 5050 > org_server_logs.txt";
popen(command.c_str(), "r");
}
void JasmineGraphInstanceService::initAgg(string trainData){
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::vector<char *> vc;
std::transform(trainargs.begin(), trainargs.end(), std::back_inserter(vc), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.fl.location") + " && ";
std::string command = path + "python3.11 org_agg.py "+ " "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")+ " " + "4" + " 0 "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.num.orgs")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.epochs") +" localhost 5000 > agg_logs.txt";
popen(command.c_str(), "r");
}
void JasmineGraphInstanceService::initClient(string trainData){
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID;
string partitionID = trainargs[trainargs.size() - 1];
for (int i = 0; i < trainargs.size(); i++) {
if (trainargs[i] == "--graph_id") {
graphID = trainargs[i + 1];
break;
}
}
std::vector<char *> vc;
std::transform(trainargs.begin(), trainargs.end(), std::back_inserter(vc), converter);
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.fl.location") + " && ";
std::string command = path + "python3.11 fl_client.py "+ utils.getJasmineGraphProperty("org.jasminegraph.fl.weights") + " "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")
+ " " + utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir")+ " "+ graphID + " " + partitionID + " "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.epochs")
+ " localhost " + utils.getJasmineGraphProperty("org.jasminegraph.fl.org.port")
+ " > client_logs_" + partitionID +".txt";
popen(command.c_str(), "r");
}
void JasmineGraphInstanceService::mergeFiles(string trainData){
Utils utils;
std::vector<std::string> trainargs = Utils::split(trainData, ' ');
string graphID = trainargs[1];
string partitionID = trainargs[2];
std::string path = "cd " + utils.getJasmineGraphProperty("org.jasminegraph.fl.location") + " && ";
std::string command = path + "python3.11 merge.py "+ utils.getJasmineGraphProperty("org.jasminegraph.server.instance.datafolder")+ " "
+ utils.getJasmineGraphProperty("org.jasminegraph.server.instance.trainedmodelfolder") + " "
+ utils.getJasmineGraphProperty("org.jasminegraph.fl.dataDir") + " " + graphID + " " + partitionID + " > merge_logs"
+ partitionID +".txt";
popen(command.c_str(), "r");
}
|
a2171105394fdcb25a0ec1d034d349c2bb2f79e9 | 9cb7a1c7086deedfc5967a6bed7bf90434c1770e | /src/utils/BufferStream.h | aff0bc3a6220b17bf61b4316039528795576b699 | [
"MIT"
] | permissive | after12am/sunflow | 23d2bfbf6b8c4e30b4cf51fe4f926307106a62e6 | 77c3455ba80b93e51158407989135a1d7ffdb2fb | refs/heads/master | 2021-01-20T10:42:47.733834 | 2015-02-18T05:59:02 | 2015-02-18T05:59:02 | 4,174,260 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,522 | h | BufferStream.h | //
// BufferStream.h
// sunflow
//
// Created by Okami Satoshi on 12/04/27.
// Copyright (c) 2012 Okami Satoshi. All rights reserved.
//
#ifndef _BufferStream_h
#define _BufferStream_h
#include <sstream>
#include <iostream.h>
#include "Constants.h"
class BufferStream {
private:
std::ostringstream osstream;
std::string filePath;
int depth;
// delete sc file
void clear();
float omit(float v);
public:
BufferStream() {
depth = 0;
}
~BufferStream() {
depth = 0;
osstream.clear();
//clear();
}
/// output as sc file and clear osstream buffer
void save(string name);
// get sc file path
std::string getPath();
// output osstream buffer to console
void dump();
// output buffer to stream
void push(const std::string name);
void writeIndent(int depth);
void write(const std::string name);
void write(const std::string name, const std::string v1);
void write(const std::string name, const int v1);
void write(const std::string name, const float v1);
void write(const std::string name, const int v1, const int v2);
void write(const std::string name, const float v1, const float v2);
void write(const std::string name, const int v1, const int v2, const int v3);
void write(const std::string name, const float v1, const float v2, const float v3);
void write(const std::string name, const int v1, const int v2, const int v3, const int v4);
void write(const std::string name, const float v1, const float v2, const float v3, const float v4);
void pop();
};
#endif
|
488fbf39f3c9862a2f7c13eac8de5d837ddcecec | 4cf533a3d03c3979a39fa308f06c6a515c9f1bee | /osi_laba_4/lab4_p1/writer.cpp | f6cd8d8a058051e35d9d834386460ecd86481bee | [] | no_license | Milllkyway/osi_projects | 923c77246b32ab7ae74fd3f7ef88ccdea3245e9d | 9884cf1afdf439feec6f5fc4114a1d177d0ea430 | refs/heads/master | 2023-02-22T13:47:39.531543 | 2021-01-29T06:24:16 | 2021-01-29T06:24:16 | 307,385,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,355 | cpp | writer.cpp | ๏ปฟ#include <iostream>
#include <string>
#include <fstream>
#include <windows.h>
#include <random>
#include <ctime>
#pragma comment(lib, "winmm.lib")
using namespace std;
const char* text = "HelloThisIsBigData";
const int PAGE_NUM = 18;
const int PG_SIZE = 4096;
int main() {
string s1 = "fileMapped";
string s2 = "wSemaphore";
string s3 = "rSemaphore";
srand(time(NULL));
HANDLE mappedHandle = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, s1.c_str()); // ะฝะต ะฝะฐัะปะตะดัะตััั
std::fstream log;
string logerName = "D:\\LOG_WRITER.txt";
log.open(logerName, std::fstream::out | std::fstream::app);
// ะฒะพะทะฒัะฐัะฐะตั ะฝะฐัะฐะปัะฝัะน ะฐะดัะตั ะพัะพะฑัะฐะถะฐะตะผะพะณะพ ะฟัะตะดััะฐะฒะปะตะฝะธั
LPVOID mapFile = MapViewOfFile(mappedHandle, FILE_MAP_ALL_ACCESS, 0, 0, PAGE_NUM * PG_SIZE); // ััะฐััะตะต ะธ ะผะปะฐะดัะตะต ัะปะพะฒะพ ัะผะตัะตะฝะธั, ะฟะพัะปะตะดะฝะตะต - ัะธัะปะพ ะพัะพะฑัะฐะถะฐะตะผัั
ะฑะฐะนัะพะฒ
if (!mapFile) cout << "error opening write file";
HANDLE wSemaphore = OpenSemaphoreA(SEMAPHORE_MODIFY_STATE | SYNCHRONIZE, FALSE, s2.c_str()); // ะฝะต ะฝะฐัะปะตะดัะตััั
if (wSemaphore == 0) cout << "semaphore_error";
HANDLE rSemaphore = OpenSemaphoreA(SEMAPHORE_MODIFY_STATE | SYNCHRONIZE, FALSE, s3.c_str());
if (rSemaphore == 0) cout << "read_semaphore_error";
HANDLE mtxLogFileArr[PAGE_NUM];
for (int i = 0; i < PAGE_NUM; i++) {
mtxLogFileArr[i] = OpenMutexA(MUTEX_ALL_ACCESS, FALSE, ("mtx" + to_string(i)).c_str());
if (mtxLogFileArr[i] == 0) cout << "writer_mutex_error " << i;
}
log << "Time: " << GetTickCount() << " || Writer thread ID: " << GetCurrentThreadId() << " || start " << endl;
// ะฑะปะพะบะธััะตั ัะบะฐะทะฐะฝะฝัั ะพะฑะปะฐััั ะฒะธัััะฐะปัะฝะพะณะพ ะฐะดัะตัะฝะพะณะพ ะฟัะพัััะฐะฝััะฒะฐ ะฟัะพัะตััะฐ ะฒ ัะธะทะธัะตัะบัั ะฟะฐะผััั
VirtualLock(mapFile, PG_SIZE * PAGE_NUM); // 2 - ัะฐะทะผะตั ะพะฑะปะฐััะธ, ะฟะพะดะปะตะถะฐัะตะน ะฑะปะพะบะธัะพะฒะบะต
for (int i = 0; i < 3; i++) {
log << "Time: " << GetTickCount() << " || Writer thread ID: " << GetCurrentThreadId() << " || waiting for semaphore " << endl;
if (wSemaphore != 0) WaitForSingleObject(wSemaphore, INFINITE);
else cout << " write error";
int index = WaitForMultipleObjects(PAGE_NUM, mtxLogFileArr, FALSE, INFINITE) - WAIT_OBJECT_0; // ะฝะต ะดะพะถะธะดะฐะตะผัั ะฒัะตั
ะพะฑัะตะบัะพะฒ (WAIT_OBJECT_0 + i - 1)
void* start = (void*)((char*)mapFile + index * PG_SIZE);
CopyMemory(start, text, PG_SIZE);
log << "Time: " << GetTickCount() << " || Writer thread ID: " << GetCurrentThreadId() << " || writing page (num of page = " << index << ") || DATA = " << text << endl;
unsigned int pause = (rand() % 1000) + 500;
Sleep((DWORD)pause);
log << "Time: " << GetTickCount() << " || Writer thread ID: " << GetCurrentThreadId() << " || releasing sources" << endl;
ReleaseMutex(mtxLogFileArr[index]);
ReleaseSemaphore(rSemaphore, 1, NULL); // ัะฒะตะปะธัะธะฒะฐะตะผ ััะตััะธะบ ะฝะฐ 1
}
VirtualUnlock(mapFile, PG_SIZE * PAGE_NUM);
for (int i = 0; i < PAGE_NUM; i++)
CloseHandle(mtxLogFileArr[i]);
log << "Time: " << GetTickCount() << " || Writer thread ID: " << GetCurrentThreadId() << " || exit" << endl;
UnmapViewOfFile(mapFile);
CloseHandle(mappedHandle);
CloseHandle(wSemaphore);
CloseHandle(rSemaphore);
return 0;
} |
f7bc3c9760fa9e03a4899e765a0ea515990bfd2b | e2e3e85061e35b622a8b172235d8d99f734848a5 | /Cubixcraft_v0.0.3-alpha_2021.05.18_src_VisualC++2019/Cubixcraft/utils.h | e94102bb17a71a55b6751fe77909218c8ea8cd02 | [] | no_license | BlackMightyRavenDark/Cubixcraft | e2bfebc7f79efedf3992d3a12fbb5b7d559a2a0d | a76bfb64f9b9d60a63145ee03c57d2cc4f63fe7b | refs/heads/master | 2023-04-12T11:25:02.220385 | 2021-05-18T09:41:59 | 2021-05-18T09:41:59 | 258,738,515 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 465 | h | utils.h | #include <iostream>
#include <codecvt>
#include <GL/gl.h>
class CBlock;
class CTessellator;
enum class MOUSE_WHEEL_DIRECTION { MW_UP = 0, MW_DOWN = 1 };
int RenderCubeSideHud(CBlock* block, CTessellator* t, float x, float y, float z, float cubeSize, int cubeSideId);
int CheckOpenGlError(std::string t);
std::string WideStringToString(std::wstring wideString);
std::wstring ExtractDirectoryName(std::wstring wideString);
bool KeyPressed(int vKey);
|
8e06f1e7dd4a9c7a71f7a15d230d0eb09124f56d | 490923eb35803c92a1dc931e51e8c5eee635b628 | /HermitianCode_LCC/[FacCheating]Herm(512,314)_LCC/FiniteFieldBasisGF(64).cpp | 697a453698475acdafda703f05a30ebc9eba1c88 | [] | no_license | codywsy/Simulation-by-C | 60814a934bc191fcbe5adfda99216c02eef3ef20 | 6ac645452447357b3d63a3a80b2004b916918bd3 | refs/heads/master | 2021-01-21T14:08:33.144358 | 2017-10-21T14:24:28 | 2017-10-21T14:24:28 | 54,982,938 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,223 | cpp | FiniteFieldBasisGF(64).cpp | //FiniteFieldBasis.cpp
//int mularray[] = {1,2,4,8,3,6,12,11,5,10,7,14,15,13,9}; //this array is used to the infinite field element mul
//int root[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; //n+1 be used to the factorization
//int logNum[] = {-1,0,1,4,2,8,5,10,3,14,9,7,6,13,11,12}; //used to locate the degree of finitefield element through the value of finitefield element
int mularray[]={1,2,4,8,16,32,3,6,12,24,48,35,5,10,20,40,
19,38,15,30,60,59,53,41,17,34,7,14,28,56,51,37,
9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,
13,26,52,43,21,42,23,46,31,62,63,61,57,49,33}; //this array is used to the infinite field element mul
int root[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,
49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; //n+1 be used to the factorization
int logNum[] = {-1,0,1,6,2,12,7,26,3,32,13,35,8,48,27,18,
4,24,33,16,14,52,36,54,9,45,49,38,28,41,19,
56,5,62,25,11,34,31,17,47,15,23,53,51,37,44,
55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,
59,57,58}; //used to locate the degree of finitefield element through the value of finitefield element |
31f6c102cadce9f6e40e250a4952fd99f102bedb | cf95dd4509488daefa10defabdb4d8665237ff67 | /src/core/src/SpatialInertia.cpp | a1d68d1744c7a62f72890faacdf06ecf27fed916 | [
"BSD-3-Clause"
] | permissive | robotology/idyntree | c5c71172a0411ae56084074462edc401ce658610 | eab099dd9d457ce33e476ab73a8fe7b26a0627c6 | refs/heads/master | 2023-08-27T21:00:36.746627 | 2023-08-18T08:41:19 | 2023-08-18T08:41:19 | 17,824,536 | 130 | 72 | BSD-3-Clause | 2023-09-12T13:58:57 | 2014-03-17T10:35:53 | C++ | UTF-8 | C++ | false | false | 9,683 | cpp | SpatialInertia.cpp | // SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT)
// SPDX-License-Identifier: BSD-3-Clause
#include <iDynTree/Core/Position.h>
#include <iDynTree/Core/SpatialInertia.h>
#include <iDynTree/Core/SpatialMomentum.h>
#include <iDynTree/Core/Twist.h>
#include <iDynTree/Core/SpatialAcc.h>
#include <iDynTree/Core/Wrench.h>
#include <Eigen/Dense>
#include <iDynTree/Core/EigenHelpers.h>
#include <cassert>
#include <iostream>
#include <sstream>
namespace iDynTree
{
SpatialInertia::SpatialInertia(const double mass,
const PositionRaw& com,
const RotationalInertiaRaw& rotInertia): SpatialInertiaRaw(mass, com, rotInertia)
{
}
SpatialInertia::SpatialInertia(const SpatialInertiaRaw& other): SpatialInertiaRaw(other)
{
}
SpatialInertia::SpatialInertia(const SpatialInertia& other): SpatialInertiaRaw(other)
{
}
SpatialInertia SpatialInertia::combine(const SpatialInertia& op1, const SpatialInertia& op2)
{
return SpatialInertiaRaw::combine(op1,op2);
}
// \todo TODO have a unique mySkew
template<class Derived>
inline Eigen::Matrix<typename Derived::Scalar, 3, 3> mySkewIn(const Eigen::MatrixBase<Derived> & vec)
{
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
return (Eigen::Matrix<typename Derived::Scalar, 3, 3>() << 0.0, -vec[2], vec[1], vec[2], 0.0, -vec[0], -vec[1], vec[0], 0.0).finished();
}
Matrix6x6 SpatialInertia::asMatrix() const
{
Matrix6x6 ret;
// Implementing the 2.63 formula in Featherstone 2008
// compare with ::multiply method for consistency
Eigen::Map< Eigen::Matrix<double,6,6,Eigen::RowMajor> > retEigen(ret.data());
Eigen::Map<const Eigen::Vector3d> mcom(this->m_mcom);
Eigen::Map<const Eigen::Matrix<double,3,3,Eigen::RowMajor> > I(this->m_rotInertia.data());
retEigen.block<3,3>(0,0) = this->getMass()*Eigen::Matrix<double,3,3,Eigen::RowMajor>::Identity();
retEigen.block<3,3>(0,3) = -mySkewIn(mcom);
retEigen.block<3,3>(3,0) = mySkewIn(mcom);
retEigen.block<3,3>(3,3) = I;
return ret;
}
Twist SpatialInertia::applyInverse(const SpatialMomentum& mom) const
{
Twist vel;
Eigen::Matrix<double,6,1> momEigen = toEigen(mom.asVector());
Matrix6x6 I = this->asMatrix();
Eigen::Matrix<double,6,1> velEigen = toEigen(I).householderQr().solve(momEigen);
toEigen(vel.getLinearVec3()) = velEigen.block<3,1>(0,0);
toEigen(vel.getAngularVec3()) = velEigen.block<3,1>(3,0);
return vel;
}
Matrix6x6 SpatialInertia::getInverse() const
{
Matrix6x6 ret;
Matrix6x6 In = this->asMatrix();
toEigen(ret) = toEigen(In).inverse();
return ret;
}
SpatialInertia SpatialInertia::operator+(const SpatialInertia& other) const
{
return SpatialInertia::combine(*this,other);
}
SpatialForceVector SpatialInertia::operator*(const SpatialMotionVector& other) const
{
return SpatialInertiaRaw::multiply(other);
}
Wrench SpatialInertia::operator*(const SpatialAcc& other) const
{
return SpatialInertiaRaw::multiply(other);
}
SpatialMomentum SpatialInertia::operator*(const Twist& other) const
{
return SpatialInertiaRaw::multiply(other);
}
Wrench SpatialInertia::biasWrench(const Twist& V) const
{
Wrench ret;
Eigen::Map<Eigen::Vector3d> linearBiasForce(ret.getLinearVec3().data());
Eigen::Map<Eigen::Vector3d> angularBiasForce(ret.getAngularVec3().data());
Eigen::Map<const Eigen::Vector3d> linearVel(V.getLinearVec3().data());
Eigen::Map<const Eigen::Vector3d> angularVel(V.getAngularVec3().data());
Eigen::Map<const Eigen::Vector3d> mcom(this->m_mcom);
Eigen::Map<const Eigen::Matrix<double,3,3,Eigen::RowMajor> > I(this->m_rotInertia.data());
linearBiasForce = this->m_mass*(angularVel.cross(linearVel)) - angularVel.cross(mcom.cross(angularVel));
angularBiasForce = mcom.cross(angularVel.cross(linearVel)) + angularVel.cross(I*angularVel);
return ret;
}
Matrix6x6 SpatialInertia::biasWrenchDerivative(const Twist& V) const
{
Matrix6x6 ret;
Eigen::Map<const Eigen::Vector3d> linearVel(V.getLinearVec3().data());
Eigen::Map<const Eigen::Vector3d> angularVel(V.getAngularVec3().data());
Eigen::Map< Eigen::Matrix<double,6,6,Eigen::RowMajor> > retEigen(ret.data());
Eigen::Map<const Eigen::Vector3d> mcom(this->m_mcom);
Eigen::Map<const Eigen::Matrix<double,3,3,Eigen::RowMajor> > I(this->m_rotInertia.data());
Eigen::Matrix<double,3,3,Eigen::RowMajor> mcCrossOmegaCross = mySkewIn(mcom)*mySkewIn(angularVel);
retEigen.block<3,3>(0,0) = mySkewIn(this->m_mass*angularVel);
retEigen.block<3,3>(0,3) = -mySkewIn(this->m_mass*linearVel) + mySkewIn(mcom.cross(angularVel)) - mcCrossOmegaCross.transpose();
retEigen.block<3,3>(3,0) = mcCrossOmegaCross;
retEigen.block<3,3>(3,3) = -mySkewIn(mcom)*mySkewIn(linearVel) + mySkewIn(angularVel)*I - mySkewIn(I*angularVel);
return ret;
}
SpatialInertia SpatialInertia::Zero()
{
SpatialInertia ret;
ret.zero();
return ret;
}
Vector10 SpatialInertia::asVector() const
{
Vector10 ret;
Eigen::Map< Eigen::Matrix<double,10,1> > inertialParams = toEigen(ret);
// Mass
inertialParams(0) = m_mass;
// First moment of mass
inertialParams(1) = m_mcom[0];
inertialParams(2) = m_mcom[1];
inertialParams(3) = m_mcom[2];
// Inertia matrix
inertialParams(4) = m_rotInertia(0,0);
inertialParams(5) = m_rotInertia(0,1);
inertialParams(6) = m_rotInertia(0,2);
inertialParams(7) = m_rotInertia(1,1);
inertialParams(8) = m_rotInertia(1,2);
inertialParams(9) = m_rotInertia(2,2);
return ret;
}
void SpatialInertia::fromVector(const Vector10& inertialParams)
{
// mass
this->m_mass = inertialParams(0);
// First moment of mass
this->m_mcom[0] = inertialParams(1);
this->m_mcom[1] = inertialParams(2);
this->m_mcom[2] = inertialParams(3);
// Inertia matrix
this->m_rotInertia(0,0) = inertialParams(4);
this->m_rotInertia(0,1) = this->m_rotInertia(1,0) = inertialParams(5);
this->m_rotInertia(0,2) = this->m_rotInertia(2,0) = inertialParams(6);
this->m_rotInertia(1,1) = inertialParams(7);
this->m_rotInertia(1,2) = this->m_rotInertia(2,1) = inertialParams(8);
this->m_rotInertia(2,2) = inertialParams(9);
}
bool SpatialInertia::isPhysicallyConsistent() const
{
using namespace Eigen;
bool isConsistent = true;
// check that the mass is positive
if( this->m_mass <= 0 )
{
isConsistent = false;
return isConsistent;
}
// We get the inertia at the COM
RotationalInertiaRaw inertiaAtCOM = this->getRotationalInertiaWrtCenterOfMass();
// We get the inertia at the principal axis using eigen
SelfAdjointEigenSolver<Matrix<double,3,3,RowMajor> > eigenValuesSolver;
// We check both the positive definitiveness of the matrix and the triangle
// inequality by directly checking the central second moment of mass of the rigid body
// In a nutshell, we have that:
// Ixx = Cyy + Czz
// Iyy = Cxx + Czz
// Izz = Cxx + Cyy
// so
// Cxx = (Iyy + Izz - Ixx)/2
// Cyy = (Ixx + Izz - Iyy)/2
// Czz = (Ixx + Iyy - Izz)/2
// Then all the condition boils down to:
// Cxx >= 0 , Cyy >= 0 , Czz >= 0
eigenValuesSolver.compute( toEigen(inertiaAtCOM) );
double Ixx = eigenValuesSolver.eigenvalues()(0);
double Iyy = eigenValuesSolver.eigenvalues()(1);
double Izz = eigenValuesSolver.eigenvalues()(2);
double Cxx = (Iyy + Izz - Ixx)/2;
double Cyy = (Ixx + Izz - Iyy)/2;
double Czz = (Ixx + Iyy - Izz)/2;
// We are accepting the configuration where C** is zero
// so that we don't mark a point mass as physically inconsistent
if( Cxx < 0 ||
Cyy < 0 ||
Czz < 0 )
{
isConsistent = false;
}
return isConsistent;
}
Eigen::Matrix<double, 3, 6> rotationalMomentumRegressor(const Vector3 & w)
{
Eigen::Matrix<double, 3, 6> ret;
ret << w(0), w(1), w(2), 0, 0, 0,
0, w(0), 0, w(1), w(2), 0,
0, 0, w(0), 0, w(1), w(2);
return ret;
}
Matrix6x10 SpatialInertia::momentumRegressor(const Twist& v)
{
using namespace Eigen;
Matrix6x10 ret;
Map< Matrix<double,6,10, Eigen::RowMajor> > res = toEigen(ret);
res << toEigen(v.getLinearVec3()), mySkewIn(toEigen(v.getAngularVec3())), Matrix<double, 3, 6>::Zero(),
Vector3d::Zero(), -mySkewIn(toEigen(v.getLinearVec3())), rotationalMomentumRegressor(v.getAngularVec3());
return ret;
}
Matrix6x10 SpatialInertia::momentumDerivativeRegressor(const Twist& v,
const SpatialAcc& a)
{
Matrix6x10 ret;
Eigen::Map< Eigen::Matrix<double,6,10,Eigen::RowMajor> > res = toEigen(ret);
res = toEigen(momentumRegressor(a)) +
toEigen(v.asCrossProductMatrixWrench())*toEigen(momentumRegressor(v));
return ret;
}
Matrix6x10 SpatialInertia::momentumDerivativeSlotineLiRegressor(const Twist& v,
const Twist& vRef,
const SpatialAcc& aRef)
{
Matrix6x10 ret;
Eigen::Map< Eigen::Matrix<double,6,10,Eigen::RowMajor> > res = toEigen(ret);
// The momentum derivative according to the Slotine-Li regressor is given by:
// \dot{h} = I*a + v.crossWrench(I*vRef) - I*(v.cross(vRef))
res = toEigen(momentumRegressor(aRef)) +
toEigen(v.asCrossProductMatrixWrench())*toEigen(momentumRegressor(vRef)) -
toEigen(momentumRegressor(v.cross(vRef)));
return ret;
}
}
|
9f72b352aaa94c592f90b0e945fb4ca9d15a9c86 | b22588340d7925b614a735bbbde1b351ad657ffc | /athena/Simulation/ISF/ISF_Core/ISF_Tools/src/components/ISF_Tools_entries.cxx | ba698c84402d3c3131da7ad84e2c787486e69278 | [] | no_license | rushioda/PIXELVALID_athena | 90befe12042c1249cbb3655dde1428bb9b9a42ce | 22df23187ef85e9c3120122c8375ea0e7d8ea440 | refs/heads/master | 2020-12-14T22:01:15.365949 | 2020-01-19T03:59:35 | 2020-01-19T03:59:35 | 234,836,993 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,351 | cxx | ISF_Tools_entries.cxx | #include "GaudiKernel/DeclareFactoryEntries.h"
#include "../ParticleHelper.h"
#include "../MemoryMonitoringTool.h"
#include "../GenericBarcodeFilter.h"
#include "../EntryLayerFilter.h"
#include "../KinematicParticleFilter.h"
#include "../CosmicEventFilterTool.h"
#include "../GenericParticleOrderingTool.h"
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , ParticleHelper )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , MemoryMonitoringTool )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , GenericBarcodeFilter )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , EntryLayerFilter )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , KinematicParticleFilter )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , CosmicEventFilterTool )
DECLARE_NAMESPACE_TOOL_FACTORY( ISF , GenericParticleOrderingTool )
DECLARE_FACTORY_ENTRIES( ISF_Tools ) {
DECLARE_NAMESPACE_TOOL( ISF , ParticleHelper )
DECLARE_NAMESPACE_TOOL( ISF , MemoryMonitoringTool )
DECLARE_NAMESPACE_TOOL( ISF , GenericBarcodeFilter )
DECLARE_NAMESPACE_TOOL( ISF , EntryLayerFilter )
DECLARE_NAMESPACE_TOOL( ISF , KineamticParticleFilter )
DECLARE_NAMESPACE_TOOL( ISF , CosmicEventFilterTool )
DECLARE_NAMESPACE_TOOL( ISF , GenericParticleOrderingTool )
}
|
2d3bd74db7f0b56c900f1f97f404336c1ec9c449 | 9e3a878f6579f68e41bf8de5dd26cc6b908119ae | /eigen.cpp | d04e28df42394381b64ab300637c4220fc695204 | [] | no_license | TazdingoDing/P.O.S.C | d4ff15e48a3961c57bcd8299951a76d8092a3d50 | 71f63279c8449973229d510ebaf718f6a11fdfbb | refs/heads/master | 2020-03-21T07:09:16.086279 | 2018-07-18T08:58:23 | 2018-07-18T08:58:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,704 | cpp | eigen.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <functions.h>
#define NR_END 1
#define RADIX 2.0
#define FREE_ARG char*
#define SWAP(a,b) do { double t = (a); (a) = (b); (b) = t; } while (0)
#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
#define SQR(a) ((a)*(a))
const int length = 3;
static double maxarg1,maxarg2;
#define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ?\
(maxarg1) : (maxarg2))
static int iminarg1,iminarg2;
#define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1) < (iminarg2) ?\
(iminarg1) : (iminarg2))
static void balanc(double **a, int n)
{
int i, j, last = 0;
double s, r, g, f, c, sqrdx;
sqrdx = RADIX * RADIX;
while (last == 0) {
last = 1;
for (i = 0; i < n; i++) {
r = c = 0.0;
for (j = 0; j < n; j++)
if (j != i) {
c += fabs(a[j][i]);
r += fabs(a[i][j]);
}
if (c != 0.0 && r != 0.0) {
g = r / RADIX;
f = 1.0;
s = c + r;
while (c < g) {
f *= RADIX;
c *= sqrdx;
}
g = r * RADIX;
while (c > g) {
f /= RADIX;
c /= sqrdx;
}
if ((c + r) / f < 0.95 * s) {
last = 0;
g = 1.0 / f;
for (j = 0; j < n; j++)
a[i][j] *= g;
for (j = 0; j < n; j++)
a[j][i] *= f;
}
}
}
}
}
static void elmhes(double **a, int n)
{
int i, j, m;
double y, x;
for (m = 1; m < n - 1; m++) {
x = 0.0;
i = m;
for (j = m; j < n; j++) {
if (fabs(a[j][m - 1]) > fabs(x)) {
x = a[j][m - 1];
i = j;
}
}
if (i != m) {
for (j = m - 1; j < n; j++)
SWAP(a[i][j], a[m][j]);
for (j = 0; j < n; j++)
SWAP(a[j][i], a[j][m]);
}
if (x != 0.0) {
for (i = m + 1; i < n; i++) {
if ((y = a[i][m - 1]) != 0.0) {
y /= x;
a[i][m - 1] = y;
for (j = m; j < n; j++)
a[i][j] -= y * a[m][j];
for (j = 0; j < n; j++)
a[j][m] += y * a[j][i];
}
}
}
}
}
static void hqr(double **a, int n, double *wr, double *wi)
{
int nn, m, l, k, j, its, i, mmin;
double z, y, x, w, v, u, t, s, r, q, p, anorm;
p = q = r = 0.0;
anorm = 0.0;
for (i = 0; i < n; i++)
for (j = i - 1 > 0 ? i - 1 : 0; j < n; j++)
anorm += fabs(a[i][j]);
nn = n - 1;
t = 0.0;
while (nn >= 0) {
its = 0;
do {
for (l = nn; l > 0; l--) {
s = fabs(a[l - 1][l - 1]) + fabs(a[l][l]);
if (s == 0.0)
s = anorm;
if (fabs(a[l][l - 1]) + s == s) {
a[l][l - 1] = 0.0;
break;
}
}
x = a[nn][nn];
if (l == nn) {
wr[nn] = x + t;
wi[nn--] = 0.0;
} else {
y = a[nn - 1][nn - 1];
w = a[nn][nn - 1] * a[nn - 1][nn];
if (l == nn - 1) {
p = 0.5 * (y - x);
q = p * p + w;
z = sqrt(fabs(q));
x += t;
if (q >= 0.0) {
z = p + SIGN(z, p);
wr[nn - 1] = wr[nn] = x + z;
if (z != 0.0)
wr[nn] = x - w / z;
wi[nn - 1] = wi[nn] = 0.0;
} else {
wr[nn - 1] = wr[nn] = x + p;
wi[nn - 1] = -(wi[nn] = z);
}
nn -= 2;
} else {
if (its == 30) {
fprintf(stderr, "[hqr] too many iterations.\n");
break;
}
if (its == 10 || its == 20) {
t += x;
for (i = 0; i < nn + 1; i++)
a[i][i] -= x;
s = fabs(a[nn][nn - 1]) + fabs(a[nn - 1][nn - 2]);
y = x = 0.75 * s;
w = -0.4375 * s * s;
}
++its;
for (m = nn - 2; m >= l; m--) {
z = a[m][m];
r = x - z;
s = y - z;
p = (r * s - w) / a[m + 1][m] + a[m][m + 1];
q = a[m + 1][m + 1] - z - r - s;
r = a[m + 2][m + 1];
s = fabs(p) + fabs(q) + fabs(r);
p /= s;
q /= s;
r /= s;
if (m == l)
break;
u = fabs(a[m][m - 1]) * (fabs(q) + fabs(r));
v = fabs(p) * (fabs(a[m - 1][m - 1]) + fabs(z) + fabs(a[m + 1][m + 1]));
if (u + v == v)
break;
}
for (i = m; i < nn - 1; i++) {
a[i + 2][i] = 0.0;
if (i != m)
a[i + 2][i - 1] = 0.0;
}
for (k = m; k < nn; k++) {
if (k != m) {
p = a[k][k - 1];
q = a[k + 1][k - 1];
r = 0.0;
if (k + 1 != nn)
r = a[k + 2][k - 1];
if ((x = fabs(p) + fabs(q) + fabs(r)) != 0.0) {
p /= x;
q /= x;
r /= x;
}
}
if ((s = SIGN(sqrt(p * p + q * q + r * r), p)) != 0.0) {
if (k == m) {
if (l != m)
a[k][k - 1] = -a[k][k - 1];
} else
a[k][k - 1] = -s * x;
p += s;
x = p / s;
y = q / s;
z = r / s;
q /= p;
r /= p;
for (j = k; j < nn + 1; j++) {
p = a[k][j] + q * a[k + 1][j];
if (k + 1 != nn) {
p += r * a[k + 2][j];
a[k + 2][j] -= p * z;
}
a[k + 1][j] -= p * y;
a[k][j] -= p * x;
}
mmin = nn < k + 3 ? nn : k + 3;
for (i = l; i < mmin + 1; i++) {
p = x * a[i][k] + y * a[i][k + 1];
if (k != (nn)) {
p += z * a[i][k + 2];
a[i][k + 2] -= p * r;
}
a[i][k + 1] -= p * q;
a[i][k] -= p;
}
}
}
}
}
} while (l + 1 < nn);
}
}
void n_eigen(double *_a, int n, double *wr, double *wi)
{
int i;
double **a = (double **) calloc(n, sizeof(void *));
for (i = 0; i < n; ++i)
a[i] = _a + i * n;
balanc(a, n);
elmhes(a, n);
/*
int o, p;
for (o = 0; o < n; o++) {
for (p = 0; p < n; p++)
printf("%13.7e ", a[o][p]);
printf("\n");
}
*/
hqr(a, n, wr, wi);
free(a);
}
static double pythag(double a, double b)
{
double absa, absb;
absa = fabs(a);
absb = fabs(b);
if (absa > absb) return absa * sqrt(1.0 + SQR(absb / absa));
else return (absb == 0.0 ? 0.0 : absb * sqrt(1.0 + SQR(absa / absb)));
}
double *vector(long nl, long nh)
/* allocate a double vector with subscript range v[nl..nh] */
{
double *v;
v=(double *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(double)));
if (!v) printf("allocation failure in vector()");
return v-nl+NR_END;
}
void free_vector(double *v, long nl, long nh)
/* free a double vector allocated with vector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
double** newDoubleArray(int m, int n)
{
int i, j;
double **NewMetrix;
NewMetrix = new double*[m];
for (i=0;i<m;i++)
{
NewMetrix[i] = new double[n];
for (j=0;j<n;j++)
{
NewMetrix[i][j] = 0;
}
}
return NewMetrix;
}
double** dot(double** A, double** B, int Am, int An, int Bm, int Bn)
{
//if (An != Bm)
// return ;
int i, j, k;
double tmp;
double** M = newDoubleArray(Am, Bn);
for (i=0;i<Am;i++)
{
for (j=0;j<Bn;j++)
{
tmp=0;
for(k=0;k<Bm;k++)
{
tmp += A[i][k] * B[k][j];
}
M[i][j] = tmp;
}
}
return M;
}
void svdcmp(double **a, int m,int n,double w[],double **v)
{
int flag,i,its,j,jj,k,l,nm;
double anorm,c,f,g,h,s,scale,x,y,z,*rv1;
rv1=vector(1,n);
g=scale=anorm=0.0;
for (i=1;i<=n;i++) {
l=i+1;
rv1[i]=scale*g;
g=s=scale=0.0;
if (i <= m) {
for (k=i;k<=m;k++) scale += fabs(a[k][i]);
if (scale) {
for (k=i;k<=m;k++) {
a[k][i] /= scale;
s += a[k][i]*a[k][i];
}
f=a[i][i];
g = -SIGN(sqrt(s),f);
h=f*g-s;
a[i][i]=f-g;
for (j=l;j<=n;j++) {
for (s=0.0,k=i;k<=m;k++) s += a[k][i]*a[k][j];
f=s/h;
for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
}
for (k=i;k<=m;k++) a[k][i] *= scale;
}
}
w[i]=scale *g;
g=s=scale=0.0;
if (i <= m && i != n) {
for (k=l;k<=n;k++) scale += fabs(a[i][k]);
if (scale) {
for (k=l;k<=n;k++) {
a[i][k] /= scale;
s += a[i][k]*a[i][k];
}
f=a[i][l];
g = -SIGN(sqrt(s),f);
h=f*g-s;
a[i][l]=f-g;
for (k=l;k<=n;k++) rv1[k]=a[i][k]/h;
for (j=l;j<=m;j++) {
for (s=0.0,k=l;k<=n;k++) s += a[j][k]*a[i][k];
for (k=l;k<=n;k++) a[j][k] += s*rv1[k];
}
for (k=l;k<=n;k++) a[i][k] *= scale;
}
}
anorm=FMAX(anorm,(fabs(w[i])+fabs(rv1[i])));
}
for (i=n;i>=1;i--) {
if (i < n) {
if (g) {
for (j=l;j<=n;j++)
v[j][i]=(a[i][j]/a[i][l])/g;
for (j=l;j<=n;j++) {
for (s=0.0,k=l;k<=n;k++) s += a[i][k]*v[k][j];
for (k=l;k<=n;k++) v[k][j] += s*v[k][i];
}
}
for (j=l;j<=n;j++) v[i][j]=v[j][i]=0.0;
}
v[i][i]=1.0;
g=rv1[i];
l=i;
}
for (i=IMIN(m,n);i>=1;i--) {
l=i+1;
g=w[i];
for (j=l;j<=n;j++) a[i][j]=0.0;
if (g) {
g=1.0/g;
for (j=l;j<=n;j++) {
for (s=0.0,k=l;k<=m;k++) s += a[k][i]*a[k][j];
f=(s/a[i][i])*g;
for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
}
for (j=i;j<=m;j++) a[j][i] *= g;
} else for (j=i;j<=m;j++) a[j][i]=0.0;
++a[i][i];
}
for (k=n;k>=1;k--) {
for (its=1;its<=30;its++) {
flag=1;
for (l=k;l>=1;l--) {
nm=l-1;
if ((double)(fabs(rv1[l])+anorm) == anorm) {
flag=0;
break;
}
if ((double)(fabs(w[nm])+anorm) == anorm) break;
}
if (flag) {
c=0.0;
s=1.0;
for (i=l;i<=k;i++) {
f=s*rv1[i];
rv1[i]=c*rv1[i];
if ((double)(fabs(f)+anorm) == anorm) break;
g=w[i];
h=pythag(f,g);
w[i]=h;
h=1.0/h;
c=g*h;
s = -f*h;
for (j=1;j<=m;j++) {
y=a[j][nm];
z=a[j][i];
a[j][nm]=y*c+z*s;
a[j][i]=z*c-y*s;
}
}
}
z=w[k];
if (l == k) {
if (z < 0.0) {
w[k] = -z;
for (j=1;j<=n;j++) v[j][k] = -v[j][k];
}
break;
}
if (its == 30) printf("no convergence in 30 svdcmp iterations");
x=w[l];
nm=k-1;
y=w[nm];
g=rv1[nm];
h=rv1[k];
f=((y-z)*(y+z)+(g-h)*(g+h))/(2.0*h*y);
g=pythag(f,1.0);
f=((x-z)*(x+z)+h*((y/(f+SIGN(g,f)))-h))/x;
c=s=1.0;
for (j=l;j<=nm;j++) {
i=j+1;
g=rv1[i];
y=w[i];
h=s*g;
g=c*g;
z=pythag(f,h);
rv1[j]=z;
c=f/z;
s=h/z;
f=x*c+g*s;
g = g*c-x*s;
h=y*s;
y *= c;
for (jj=1;jj<=n;jj++) {
x=v[jj][j];
z=v[jj][i];
v[jj][j]=x*c+z*s;
v[jj][i]=z*c-x*s;
}
z=pythag(f,h);
w[j]=z;
if (z) {
z=1.0/z;
c=f*z;
s=h*z;
}
f=c*g+s*y;
x=c*y-s*g;
for (jj=1;jj<=m;jj++) {
y=a[jj][j];
z=a[jj][i];
a[jj][j]=y*c+z*s;
a[jj][i]=z*c-y*s;
}
}
rv1[l]=0.0;
rv1[k]=f;
w[k]=x;
}
}
free_vector(rv1,1,n);
}
double** inv(double **M)
{
int i,j,k;
double tmp, *w, **u, **v, **uT, **vT, **dia, **res;
w=vector(1,length);
u = newDoubleArray(length+1,length+1);
v = newDoubleArray(length+1,length+1);
uT = newDoubleArray(length,length);
vT = newDoubleArray(length,length);
dia = newDoubleArray(length,length);
res = newDoubleArray(length,length);
//svd
for (i=0;i<length;i++)
{
for (j=0;j<length;j++)
{
u[i+1][j+1] = M[i][j];
}
}
svdcmp(u, length, length, w, v);
//svd
for (i=0;i<length;i++)
{
for (j=0;j<length;j++)
{
uT[i][j] = u[j+1][i+1];
vT[i][j] = v[i+1][j+1];
//v return from svd is not vT.
//no need to transpose here.
}
if (w[i+1] > 0)
{
dia[i][i] = 1.0/w[i+1];
}
}
res = dot(vT, dia, length,length,length,length);
M = dot(res, uT, length,length,length,length);
return M;
}
double norm(double** M, int m, int n)
{
int i, j;
double total = 0;
for (i=0;i<m;i++)
{
for (j=0;j<n;j++)
{
total += pow(M[i][j], 2);
}
}
return sqrt(total);
}
void MatMinusLambda(double** mat, double lambda)
{
int i;
for(i=0;i<length;i++)
{
mat[i][i] = mat[i][i] - lambda;
}
}
void eigTest(double **cov)
{
int length = 3;
double u[3], v[3];
double matrix[3][3];
double **mat = newDoubleMatrix(length, length);
for(int i =0;i<3;i++)
{
for(int j =0;j<3;j++)
{
matrix[i][j] = cov[i][j];
mat[i][j] = cov[i][j];
}
}
n_eigen(matrix[0], 3, u, v);
printf("\n");
for (int i = 0; i < 3; i++)
{
printf("eigen value %d: %13.7e + %13.7e J\n",i+1, u[i], v[i]);
}
printf("\n");
for (int i = 0; i < length; i++)
{
double **A = newDoubleMatrix(length, length);
copyMatrix(mat, A, length, length);
MatMinusLambda(A, u[i]);
A = inv(A);
double ** b = newDoubleArray(3,1);
b[0][0] = 1;
b[1][0] = 2;
b[2][0] = 3;
for(int j=0;j<30;j++)
{
double ** WB = dot(A, b,3,3,3,1);
double nor = norm(WB,3,1);
for(int k=0;k<3;k++)
{
b[k][0] = WB[k][0] / nor;
}
}
printf("eigen vector %d:\n", i+1);
for(int j=0;j<3;j++)
{
printf(" %13.7e \n", b[j][0]);
}
}
}
void test2()
{
int i, j, k;
static double u[length], v[length];
static double mat_[length][length] = {{3,2,1},{6,5,4}, {9,8,7}};
static double ori[length][length] = {{1.0, 6.0, 8.0},{8.0, -15, 17}, {18.0, -3, -24}};
double **mat = newDoubleArray(length, length);
mat[0][0] = mat_[0][0];
mat[0][1] = mat_[0][1];
mat[0][2] = mat_[0][2];
mat[1][0] = mat_[1][0];
mat[1][1] = mat_[1][1];
mat[1][2] = mat_[1][2];
mat[2][0] = mat_[2][0];
mat[2][1] = mat_[2][1];
mat[2][2] = mat_[2][2];
n_eigen(mat_[0], length, u, v);
for (i = 0; i < length; i++)
printf("%13.7e +J %13.7e\n", u[i], v[i]);
printf("\n");
for (i = 0; i < length; i++)
{
double **A = newDoubleArray(length, length);
copyMatrix(mat, A, length, length);
MatMinusLambda(A, u[i]);
A = inv(A);
double ** b = newDoubleArray(3,1);
b[0][0] = 1;
b[1][0] = 2;
b[2][0] = 3;
for(j=0;j<30;j++)
{
double ** WB = dot(A, b,3,3,3,1);
double nor = norm(WB,3,1);
for(k=0;k<3;k++)
{
b[k][0] = WB[k][0] / nor;
}
}
for(j=0;j<3;j++)
{
printf("%13.7e \n", b[j][0]);
}
}
/*
a[0][0] = -6.68465844;
a[0][1] = 4;
a[0][2] = 1;
a[1][0] = 8;
a[1][1] = -8.68465844;
a[1][2] = 2;
a[2][0] = 9;
a[2][1] = 6;
a[2][2] = -10.68465844;
printf("MAT H IS:\n");
for (i = 0; i < length; i++) {
for (j = 0; j < length; j++)
printf("%13.7e ", a[i][j]);
printf("\n");
}
printf("\n");
a = inv(a);
double ** b = newDoubleArray(3,1);
b[0][0] = 1;
b[1][0] = 2;
b[2][0] = 3;
for(i=0;i<30;i++)
{
double ** WB = dot(a, b,3,3,3,1);
double nor = norm(WB,3,1);
for(j=0;j<3;j++)
{
b[j][0] = WB[j][0] / nor;
}
}
for(j=0;j<3;j++)
{
printf("%13.7e \n", b[j][0]);
}
*/
/*
printf("res IS:\n");
for (i = 0; i < length; i++) {
for (j = 0; j < length; j++)
printf("%13.7e ", a[i][j]);
printf("\n");
}
printf("\n");
*/
/*
n_eigen(a[0], length, u, v);
for (i = 0; i < length; i++)
printf("%13.7e +J %13.7e\n", u[i], v[i]);
printf("\n");
//init eigenvector array
double **vec = new double*[length];
for (i = 0;i<length;i++)
{
vec[i] = new double[length];
for (j = 0;j<length;j++)
{
vec[i][j] = 1.0;
}
}
for (i = 0;i<length;i++)
{
for (j = 0;j<length;j++)
{
printf("%13.7e ", vec[i][j]);
}
printf("\n");
}
*/
//return 0;
}
|
63292aa96217eb406c0fd38d6b48e6e6d0863477 | a5411e0b1108ca85e424e7095009661f36a315b0 | /soundPlayer.h | 21d51545cae9798f0944fa3cc9c73991cd868062 | [] | no_license | andras-szabo/project-shmup | de402a4683cdaf2cc03d1864d1985b8380736b50 | 41003a62a74e59695bd35766f2ac125a9d91153b | refs/heads/master | 2020-05-18T15:16:58.238431 | 2014-05-27T09:56:25 | 2014-05-27T09:56:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 684 | h | soundPlayer.h | #ifndef __shmup_project__soundPlayer__
#define __shmup_project__soundPlayer__
#include <SFML/Audio.hpp>
#include "resourceHolders.h"
#include "globalVariables.h"
#include <list>
class cSoundPlayer {
public:
cSoundPlayer();
void play(SfxID);
void removeStoppedSounds();
void setVolume(unsigned short int v) { mVolume = v; }
unsigned short int getVolume() const { return mVolume; }
private:
ResourceHolder<sf::SoundBuffer, SfxID> mSoundBuffers;
std::list<sf::Sound> mSounds;
unsigned short int mVolume;
};
#endif /* defined(__shmup_project__soundPlayer__) */
|
de308833320e402f4349c5b1595ffb1bdc4cda01 | 8545842a34af43dcd60cd271fa17913f3cc432c5 | /GalaxyNotes/GalaxyNotes/Context.h | b6b65805676420dcd3d9be157872e9943a3d35c6 | [] | no_license | pamhrituc/Design_Patterns | cb17bc9583d64f98842035cb2dd8516af531a82a | 139790a63a9f3c8cc80af21ee4eface5c1601587 | refs/heads/master | 2022-11-05T06:54:05.182326 | 2020-06-23T19:07:49 | 2020-06-23T19:07:49 | 259,892,935 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 260 | h | Context.h | #pragma once
#include "Strategy.h"
class Context
{
private:
Strategy* strategy;
public:
Context();
Context(Strategy* strategy) : strategy(strategy) {}
StarListIterator* executeStrategy(std::string how, StarListIterator* star_list_iterator);
~Context();
}; |
fbca6f73f5ff667234b1fc4b971f6bba89956c1c | 3693a4c271684c2b6d913ea694b100806ed28dbd | /Classes/Models/Characters/States/StateHandlers/Ryunosuke/InEdgeObstacleStateHandler.h | 355e75f67b4428f01f24fc2819bcd304068cbb96 | [
"MIT"
] | permissive | HectorHernandezMarques/NinjaNoMeiyo | 1f99d13a66a3203df5a3dbb55cc8d86ffca53394 | 4ae0b99e12d172a34e84de990e47817deed632e2 | refs/heads/master | 2021-03-24T12:16:15.388635 | 2018-06-04T23:31:25 | 2018-06-04T23:31:25 | 84,374,001 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,085 | h | InEdgeObstacleStateHandler.h | #ifndef NINJANOMEIYO_MODELS_CHARACTERS_STATES_STATEHANDLERS_RYUNOSUKE_INEDGEOBSTACLESTATEHANDLER_H
#define NINJANOMEIYO_MODELS_CHARACTERS_STATES_STATEHANDLERS_RYUNOSUKE_INEDGEOBSTACLESTATEHANDLER_H
#include "../CharacterStateHandler.h"
namespace NinjaNoMeiyo {
namespace Models {
namespace Characters {
namespace States {
namespace StateHandlers {
namespace Ryunosuke {
class InEdgeObstacleStateHandler : public CharacterStateHandler {
public:
InEdgeObstacleStateHandler(Characters::Ryunosuke &ryunosuke);
InEdgeObstacleStateHandler(Characters::Ryunosuke &ryunosuke, StateHandler &next);
virtual ~InEdgeObstacleStateHandler();
protected:
cocos2d::Node* searchEdgeWall(std::pair<std::unordered_multimap<int, cocos2d::Node*>::iterator, std::unordered_multimap<int, cocos2d::Node*>::iterator> edgeWallsIterators,
std::pair<std::unordered_multimap<int, cocos2d::Node*>::iterator, std::unordered_multimap<int, cocos2d::Node*>::iterator> edgeFloorsIterators);
};
}
}
}
}
}
}
#endif |
95c192f89ec2df7007013b8a3914786f16aa51cb | 9fbff544471056f0816fa52d1bbf0c4db47c1f24 | /leetcode/696.่ฎกๆฐไบ่ฟๅถๅญไธฒ.cpp | c63188fbfcb47eb61fe51e962c0d799c4e95bb4b | [] | no_license | theDreamBear/algorithmn | 88d1159fb70e60b5a16bb64673d7383e20dc5fe5 | c672d871848a7453ac3ddb8335b1e38d112626ee | refs/heads/master | 2023-06-08T15:47:08.368054 | 2023-06-02T13:00:30 | 2023-06-02T13:00:30 | 172,293,806 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,414 | cpp | 696.่ฎกๆฐไบ่ฟๅถๅญไธฒ.cpp | /*
* @lc app=leetcode.cn id=696 lang=cpp
*
* [696] ่ฎกๆฐไบ่ฟๅถๅญไธฒ
*/
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
// @lc code=start
class Solution {
public:
/*
ไธคๆ นๆ้
*/
int countBinarySubstrings1(string s) {
if (s.size() <= 1) {
return 0;
}
int sum = 0;
int i = 0, j = 1, ct_zero = 0, ct_one = 0;
if (s[0] == '0') {
ct_zero++;
} else {
ct_one++;
}
while (j < s.size()) {
while (j < s.size() && s[j] == s[i]) {
if (s[j] == '0') {
++ct_zero;
} else {
++ct_one;
}
++j;
}
while (j < s.size() && s[j] != s[i]) {
if (s[j] == '0') {
++ct_zero;
} else {
++ct_one;
}
++j;
}
sum += min(ct_zero, ct_one);
if (s[i] == '0') {
i += ct_zero;
ct_zero = 0;
} else {
i += ct_one;
ct_one = 0;
}
}
sum += min(ct_zero, ct_one);
return sum;
}
int countBinarySubstrings2(string s) {
vector<int> nums;
int i = 0;
while (i < s.size()) {
int count = 0;
char c = s[i];
while (i < s.size() && s[i] == c) {
++count;
++i;
}
nums.push_back(count);
}
int sum = 0;
for (int m = 1; m < nums.size(); ++m) {
sum += min(nums[m - 1], nums[m]);
}
return sum;
}
/*
่ฎก็ฎๆฏไธๆฎต็้ฟๅบฆๅไธไธๆฎต็้ฟๅบฆไฝๆฏ่พ
*/
int countBinarySubstrings(string s) {
int i = 0, pre = 0, cur = 0;
int sum = 0;
while (i < s.size()) {
char c = s[i];
cur = 0;
while (i < s.size() && s[i] == c) {
++i;
++cur;
}
sum += min(pre, cur);
pre = cur;
}
return sum;
}
};
// @lc code=end
|
48fd36fa5e5609db1d1e3c5066bde54adce06855 | 85381529f7a09d11b2e2491671c2d5e965467ac6 | /ๆฏ่ตๆบ็ /2015 Multi-University Training Contest 06/1002.cc | 192c3a6d3d2fffb736940733be538eebff3e2846 | [] | no_license | Mr-Phoebe/ACM-ICPC | 862a06666d9db622a8eded7607be5eec1b1a4055 | baf6b1b7ce3ad1592208377a13f8153a8b942e91 | refs/heads/master | 2023-04-07T03:46:03.631407 | 2023-03-19T03:41:05 | 2023-03-19T03:41:05 | 46,262,661 | 19 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 3,274 | cc | 1002.cc | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10, MAXM = 1e5 + 10;
struct edge {
int x, y, st, ed;
} e[MAXM << 2];
char ret[MAXM];
namespace dsu {
int fa[MAXN], d[MAXN], a[MAXN];
int s[MAXN << 4], top;
int find(int x) {
while (fa[x] != x) x = fa[x];
return x;
}
int dep(int x) {
static int res;
for (res = 0; fa[x] != x; x = fa[x])
res ^= a[x];
return res;
}
void set_union(int x, int y, int _d) {
if (d[x] > d[y]) swap(x, y);
if (d[x] == d[y]) ++d[y], s[++top] = -y;
fa[x] = y, a[x] = _d, s[++top] = x;
}
void set_resume(int t) {
for (; top != t; --top) {
if (s[top] < 0) --d[-s[top]];
else fa[s[top]] = s[top], a[s[top]] = 0;
}
}
}
using namespace dsu;
void work(int l, int r, int m) {
int mid = l + r >> 1, now = top;
int i, j, fx, fy, _d;
for (i = 1; i <= m; ++i) {
if (e[i].st <= l && r <= e[i].ed) {
fx = find(e[i].x), fy = find(e[i].y), _d = !(dep(e[i].x) ^ dep(e[i].y));
if (fx != fy) set_union(fx, fy, _d);
else if (_d) {
while (l <= r)
ret[l - 1] = '0', ++l;
set_resume(now);
return;
}
swap(e[m--], e[i--]);
}
}
if (l == r) ret[l - 1] = '1';
else {
for (i = 1, j = m; i <= j; ++i)
if (e[i].st > mid) swap(e[j--], e[i--]);
work(l, mid, j);
for (i = 1, j = m; i <= j; ++i)
if (e[i].ed <= mid) swap(e[j--], e[i--]);
work(mid + 1, r, j);
}
set_resume(now);
}
void solve(int n, int m, int time) {
dsu::top = 0;
for (int i = 1; i <= n; ++i) fa[i] = i, d[i] = 1, a[i] = 0;
work(1, time, m);
}
vector<int> G[MAXN], invalid[MAXM];
int u[MAXM], v[MAXM];
int main() {
int T; scanf("%d", &T);
for (int cas = 1; cas <= T; ++ cas) {
int n, m; scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++ i) G[i].clear();
for (int i = 1; i <= m; ++ i) {
invalid[i].clear();
scanf("%d%d", u + i, v + i);
G[u[i]].push_back(i);
G[v[i]].push_back(i);
}
for (int i = 1; i <= n; ++ i) {
for (size_t j = 0; j < G[i].size(); ++ j) {
invalid[G[i][j]].push_back(i);
}
}
int sz(0);
for (int i = 1; i <= m; ++ i) {
assert(invalid[i].size() <= 2);
if (invalid[i].size() == 0) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = 1; e[sz].ed = n;
}
else if (invalid[i].size() == 1) {
if (1 < invalid[i][0]) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = 1; e[sz].ed = invalid[i][0] - 1;
}
if (invalid[i][0] < n) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = invalid[i][0] + 1; e[sz].ed = n;
}
}
else {
if (1 < invalid[i][0]) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = 1; e[sz].ed = invalid[i][0] - 1;
}
if (invalid[i][0] + 1 <= invalid[i][1] - 1) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = invalid[i][0] + 1; e[sz].ed = invalid[i][1] - 1;
}
if (invalid[i][1] < n) {
e[++ sz].x = u[i]; e[sz].y = v[i];
e[sz].st = invalid[i][1] + 1; e[sz].ed = n;
}
}
}
solve(n, sz, n);
ret[n] = 0; puts(ret);
}
return 0;
} |
f504413e3b0059b36574a541e61c6c688439b26f | 6463da9a716e1267cf0505e230b5801bc5b175aa | /compress_code/main.cpp | 236e66067b48e73119756139feb85ccd1359ae0f | [
"LicenseRef-scancode-public-domain"
] | permissive | lianzeng/cplusplus11.Examples | c333948f70a16b84ce139f1e5812ab9f0ba45afe | f27335ec622938d0af17d664877f5934e418dcd3 | refs/heads/master | 2021-01-24T18:38:42.216365 | 2016-11-16T17:13:53 | 2016-11-16T17:13:53 | 84,463,090 | 0 | 1 | null | 2018-01-31T04:22:41 | 2017-03-09T16:15:43 | C++ | UTF-8 | C++ | false | false | 1,500 | cpp | main.cpp | #include"lexer.hpp"
#include<iostream>
#include<string>
#include<fstream>
#include<thread>
#include<chrono>
int main(int argc, char **argv) {
if(argc == 3) {
std::fstream source;
source.open(argv[1], std::ios::in);
if(!source.is_open()) {
std::cerr << "Error could not open file: " << argv[1] << "\n";
exit(0);
}
std::fstream out;
out.open(argv[2], std::ios::out);
if(!out.is_open()) {
std::cerr << "Could not open output file: " << argv[2] << "\n";
source.close();
exit(0);
}
out << "<html><head><title>" << argv[1] << "</title></head><br /><body>";
out << "<table border=\"2\"><tr><td>Index</td><td>Token</td><td>Type</td></tr>\n\n";
lex::Scanner scan(source);
lex::Token token;
unsigned int t_count = 0;
while(scan.valid()) {
scan >> token;
++t_count;
out << "<tr><td>" << t_count << "</td><td>" << token.getToken() << "</td><td>";
out << token.getType() << "</td></tr>\n";
}
out << "</table>\n";
out << "\n</body></html>";
source.close();
out.close();
std::cout << "Processed: " << t_count << " Tokens \n";
}
else {
std::cerr << "Error program requires arguments..\ncompress-code sourcefile outfile\n";
}
return 0;
} |
e7c43f86bdac44df4d1ddf1a29d5f4d995dbcbda | 3ddfed50cea6d0c0c9f46788f33088915128a569 | /Lab03/Exercise03.cpp | 7b5b89f059d5f24697dfea7ae6fe960e8a99ef05 | [] | no_license | ITITIU20337/LabCProgramming-Solution | 429a9677dfe4dc147cdc24d96e6a136d27bedade | 88fce65335ed4546dd95b9f55065a03331fa6b42 | refs/heads/main | 2023-08-28T00:52:05.300969 | 2021-10-29T15:00:34 | 2021-10-29T15:00:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,176 | cpp | Exercise03.cpp | /*
3. Input an array of n integers. Find the largest sorted sub array
(sorted array increasing/decreasing and has the largest number of elements)
Ex:
_____________________________________________
| Input: 2 5 3 4 8 9 7 6 10 |
| Output: Increasing 3 4 8 9 Decreasing 9 7 6 |
|_____________________________________________|
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Increasing : typeSublength = 1; decreasing : typeSublength = 0
void Ex3(int arr[], int n, int typeSublength = 1)
{
int Length = 1;
int max = 1;
int start = 0;
int end = 0;
for (int i = 0; i < n - 1; i++)
{
if ((arr[i] < arr[i + 1]) == typeSublength)
{
Length++;
if (Length > max)
{
max = Length;
start = i + 2 - Length;
end = i + 2;
}
}
else
Length = 1;
}
for (int i = start; i < end; i++)
printf("%2d", arr[i]);
}
// Way 2:
void maxSizeDecrease(int a[], int n)
{
int i, j;
int temp = 0;
int max = 0;
int tempArr[n];
int idx = 0;
for (i = 0; i < n; i++)
{
if (a[i] > a[i + 1] && i < n - 1)
{
temp++;
}
else
{
temp++;
if (max < temp)
{
max = temp;
}
temp = 0;
}
}
for (i = 0; i < n; i++)
{
if (a[i] > a[i + 1])
{
tempArr[idx] = a[i];
idx++;
}
else
{
tempArr[idx] = a[i];
idx++;
if (idx == max)
{
for (j = 0; j < max; j++)
{
printf(" %d", tempArr[j]);
}
}
idx = 0;
}
}
}
void maxSizeIncrease(int a[], int n)
{
int i, j;
int temp = 0;
int max = 0;
int tempArr[n];
int idx = 0;
for (i = 0; i < n; i++)
{
if (a[i] < a[i + 1] && i < n - 1)
{
temp++;
}
else
{
temp++;
if (max < temp)
{
max = temp;
}
temp = 0;
}
}
for (i = 0; i < n; i++)
{
if (a[i] < a[i + 1])
{
tempArr[idx] = a[i];
idx++;
}
else
{
tempArr[idx] = a[i];
idx++;
if (idx == max)
{
for (j = 0; j < max; j++)
{
printf(" %d ", tempArr[j]);
}
}
idx = 0;
}
}
}
int main(int argc, char *argv[])
{
//testing variable, applying it to your algorithm for auto-evaluating
argc--;
int testcase[50], i;
for (i = 0; i < argc; i++)
{
testcase[i] = atoi(argv[i + 1]);
}
// printf("\nIncreasing");
// Ex3(testcase, argc);
// printf(" Decreasing");
// Ex3(testcase, argc, 0);
printf("\nIncreasing");
maxSizeIncrease(testcase, argc);
printf(" Decreasing");
maxSizeDecrease(testcase, argc);
return 0;
} |
297e9d4f7d2917a7e5a72949fee4788b9e279c02 | 71633e529e35d66c5f0376058cf1a14d378625b2 | /032. Longest Valid ParenthesesโDynamic Programming/Longest Valid Parentheses.cpp | 81bccb737bb0d8cb74091e61fb43ab17132cf0b6 | [] | no_license | MilesWangSeven/leetcode-DailyProblem | 01277087d2554d271f108fee9633b4492d9ecff8 | 946809e39d66a9d32aa39b7d2fad58b23439e1c4 | refs/heads/master | 2020-04-04T00:32:58.612671 | 2019-04-19T00:33:05 | 2019-04-19T00:33:05 | 155,653,646 | 1 | 0 | null | 2018-11-01T02:56:29 | 2018-11-01T02:56:29 | null | UTF-8 | C++ | false | false | 710 | cpp | Longest Valid Parentheses.cpp | class Solution {
public:
int longestValidParentheses(string s) {
int max_len = 0, last = -1; // the position of last '('
stack<int> lefts;
for (int i = 0; i < s.size(); ++i) {
if (s[i] == '(') {
lefts.push(i);
} else {
if (lefts.empty()) {
last = i;
} else {
lefts.pop();
if (lefts.empty()) {
max_len = max(max_len, i - last);
} else {
max_len = max(max_len, i - lefts.top());
}
}
}
}
return max_len;
}
}; |
079ab3ebb91c90676a29a299cf19e7d38a539c7b | 0e0a39875ad5089ca1d49d1e1c68d6ef337941ff | /inc/Core/ForEach.h | 5c4267abfb4eaaab046468a78d6783e1724e0985 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | FloodProject/flood | aeb30ba9eb969ec2470bd34be8260423cd83ab9f | 466ad3f4d8758989b883f089f67fbc24dcb29abd | refs/heads/master | 2020-05-18T01:56:45.619407 | 2016-02-14T17:00:53 | 2016-02-14T17:18:40 | 4,555,061 | 6 | 2 | null | 2014-06-21T18:08:53 | 2012-06-05T02:49:39 | C# | WINDOWS-1252 | C++ | false | false | 2,582 | h | ForEach.h | /************************************************************************
*
* Flood Project ยฉ (2008-201x)
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/
#pragma once
#include "Core/API.h"
#include "Core/Task.h"
#include <functional>
NAMESPACE_CORE_BEGIN
template < class IterType >
class ALIGN_BEGIN(16) ForTask : public TaskBase
{
// -- Types --
public:
typedef std::function< void (IterType, IterType) > Func;
// -- Member Data --
protected:
IterType Begin_;
IterType End_;
Func Func_; // the function to call each iteration, passing in the current iterator
uint32 MinSliceSize_; // the smallest size that a slice of the range should be; example: do not sub-divide a range 16 items long
public:
ForTask(Completion * comp, IterType begin, IterType end, Func const & func, uint32 minSliceSize );
// <summary>
// Iterates between the beginning and the end, calling the provided function object passing the current iterator. Once
// completed, "this" is deleted.
// </summary>
INLINE virtual void Do();
// <summary>
// Attempts to split the range evenly across numSlices. There are two conditions that this may not happen:
// 1) (End_ - Begin_) < (MinSliceSize_ * 2) : In this instance, Split will simply return nullptr, and not attempt
// to sub-divide the task.
// 2) ((End_ - Begin_) / numSlices) < MinSliceSize_ : Here, numSlices becomes the smallest number to hold completely MinSliceSize_
// as a range. Any rollover is placed into the "this" task.
// </summary>
virtual TaskBase::Range * Split( uint32 numSlices );
// <summary>
// Attempts to slice the range in half. This can fail if (End_ - Begin_) < (MinSliceSize_ * 2), in which case outTask is left
// alone.
// </summary>
INLINE virtual bool Slice( TaskBase *& outTask );
} ALIGN_END(16);
// <summary>
// Provides a convenient function-call syntax to iterate across a range in parallel.
// NOTE: I don't like just putting 16 down for the minSliceSize.. but what can you do?
// </summary>
template < class IterType >
void ForEach( IterType begin, IterType end, typename ForTask<IterType>::Func const & func, uint32 minSliceSize = 16)
{
Completion completion;
ForTask<IterType> * task = new ForTask<IterType>( &completion, begin, end, func, minSliceSize ); // this will get deleted whenever the Do finishes
WorkerThread::This()->Push( task );
WorkerThread::This()->YieldUntil( &completion );
}
NAMESPACE_CORE_END
#include "ForEach.inl" |
8fb46765fce87db4c6536b986c06e9f25e87275a | baebb4f11b771713e76ddf60e437ea53260af7ec | /src/Acceptor.h | 4536bb24e4bc636173783b3e225b9256a85a4141 | [] | no_license | xeon2007/rtmp_relay | 3f333406c4624baf545acf8d953958957c03b434 | 8e14eb38188e4224a1dcb3579507de2941766321 | refs/heads/master | 2018-05-13T05:20:50.271786 | 2016-05-12T15:22:34 | 2016-05-12T15:22:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 510 | h | Acceptor.h | //
// rtmp_relay
//
#pragma once
#include <vector>
#include <functional>
#include "Socket.h"
class Acceptor: Socket
{
public:
Acceptor(Network& network, int socketFd = -1);
virtual ~Acceptor();
Acceptor(Acceptor&& other);
Acceptor& operator=(Acceptor&& other);
bool startAccept(uint16_t newPort);
void setAcceptCallback(const std::function<void(Socket)>& newAcceptCallback);
protected:
virtual bool read();
std::function<void(Socket)> acceptCallback;
};
|
d862d4df68ea5c8617e88aa23bcd900654e93f10 | dd1a4ca7020ba5cac93d90829798a3a6f80d33a1 | /Loj/loj102.cpp | 7e4d4cb93ba632710bb7b9ebe7e33ee3a0bc1cb9 | [] | no_license | Exbilar/Source | a0f85b8b47840a4212fd4a9f713f978cab13e9a3 | b8bc0dc52e51f6c4986bd0f37de61b13d98e6e8c | refs/heads/master | 2022-05-03T22:35:57.300520 | 2022-03-14T09:03:03 | 2022-03-14T09:03:03 | 97,890,246 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,488 | cpp | loj102.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
static const int maxm = 1e6 + 10;
static const int INF = ~(1 << 31);
int fst[maxm],nxt[maxm],to[maxm],cst[maxm],cap[maxm];
int inq[maxm],vis[maxm],dis[maxm],que[maxm];
int S,T,allc,n,m,cnt = 1;
void ins(int f,int t,int v,int c){
nxt[++cnt] = fst[f],to[cnt] = t,cap[cnt] = v,cst[cnt] = c,fst[f] = cnt;
nxt[++cnt] = fst[t],to[cnt] = f,cap[cnt] = 0,cst[cnt] = -c,fst[t] = cnt;
}
bool spfa(){
for(int i = 1;i <= n;i++) dis[i] = INF,inq[i] = 0;
int head = 1,tail = 0;
inq[S] = 1,dis[S] = 0;
que[++tail] = S;
while(head <= tail){
int x = que[head++]; inq[x] = 0;
for(int u = fst[x];u;u = nxt[u]){
int v = to[u];
if(cap[u] && dis[v] > dis[x] + cst[u]){
dis[v] = dis[x] + cst[u];
if(!inq[v]) inq[que[++tail] = v] = 1;
}
}
}
return dis[T] ^ INF;
}
int dfs(int x,int flow){
if(vis[x]) return 0;
if(x == T || !flow) return allc += dis[T] * flow,flow;
vis[x] = 1; int res = 0,f = 0;
for(int u = fst[x];u;u = nxt[u]){
int v = to[u];
if(dis[v] == dis[x] + cst[u] && cap[u]){
if(f = dfs(v,std :: min(flow,cap[u]))){
cap[u] -= f,cap[u ^ 1] += f;
res += f,flow -= f;
}
}
}
vis[x] = 0;
return res;
}
int mcmf(){
int res = 0,flow = 0;
while(spfa()) res += dfs(S,INF);
return res;
}
int main(){
int x,y,z,w;
scanf("%d%d",&n,&m);
while(m--){
scanf("%d%d%d%d",&x,&y,&z,&w);
ins(x,y,z,w);
}
S = 1,T = n;
int ans = mcmf();
printf("%d %d\n",ans,allc);
return 0;
}
|
442d508fc00b7d86fe0612acd12b440607742cc9 | c6f4505920e0ef7a4c6b9fff5fed4c9ce24d97af | /VisitorMode/ListVisitor.h | 78865dafcf208db82557b08c724df96ace18c7f7 | [] | no_license | luzh0422/DesignPatterns | 43f47e85fbc6a73d24435e2117ea726a17d7cf55 | ca59713c9fa59115742da63ef0afbea1e7c6a8b2 | refs/heads/master | 2021-06-07T02:27:40.188342 | 2020-05-06T14:37:25 | 2020-05-06T14:37:25 | 153,556,496 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 359 | h | ListVisitor.h | //
// Created by Luzh on 2019/2/21.
//
#ifndef VISITORMODE_LISTVISITOR_H
#define VISITORMODE_LISTVISITOR_H
#include "Visitor.h"
#include <string>
class ListVisitor : public Visitor{
public:
void visit(File *file) override;
void visit(Directory *directory) override;
private:
std::string currentDir = "";
};
#endif //VISITORMODE_LISTVISITOR_H
|
7916dd7ed4df5155329029bc3fd743897d32ed71 | aa0168a62f7629c08f4d30d8719fe4239e978cfb | /libVcf/VCFInputFile.cpp | dd2ab70d0bd50bf891268536cfc3192316cfd154 | [] | no_license | Shicheng-Guo/rvtests | e41416785f42e4ff7da87f633ffff86dd64eaf60 | be1bd88b2bd663804bb8c2aff8a4d990a29850d2 | refs/heads/master | 2020-04-07T10:51:02.496565 | 2018-10-05T05:59:27 | 2018-10-05T05:59:27 | 158,302,712 | 1 | 0 | null | 2018-11-19T23:20:09 | 2018-11-19T23:20:08 | null | UTF-8 | C++ | false | false | 8,597 | cpp | VCFInputFile.cpp | #include "VCFInputFile.h"
#include "base/IO.h"
#include "base/Utils.h"
#include "BCFReader.h"
#include "TabixReader.h"
// use current subset of included people
// to reconstruct a new VCF header line
void VCFInputFile::rewriteVCFHeader() {
std::string s = "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT";
VCFPeople& people = this->record.getPeople();
for (unsigned int i = 0; i < people.size(); i++) {
s += '\t';
s += people[i]->getName();
}
this->header[this->header.size() - 1] = s;
}
void VCFInputFile::setRangeMode() {
if (mode == VCF_LINE_MODE) {
this->tabixReader = new TabixReader(this->fileName);
if (!this->tabixReader->good()) {
fprintf(stderr,
"[ERROR] Cannot read VCF by range, please verify you have the "
"index file"
"(or create one using tabix).\nQuitting...");
abort();
} else {
this->mode = VCFInputFile::VCF_RANGE_MODE;
}
} else if (mode == VCF_RANGE_MODE) {
// Auto-merge should be handled by VCFInputFile, not in tabixReader
// if (this->autoMergeRange) {
// this->tabixReader->enableAutoMerge();
// }
} else if (mode == BCF_MODE) {
if (!this->bcfReader->good() || !this->bcfReader->indexed()) {
fprintf(stderr,
"[ERROR] Cannot read BCF by range, please verify you have the "
"index file "
"(or create one using bcftools).\nQuitting...");
abort();
}
// Auto-merge should be handled by VCFInputFile, not in bcfReader
// if (this->autoMergeRange) {
// this->bcfReader->enableAutoMerge();
// }
}
// if (this->autoMergeRange) {
// this->range.sort();
// }
// this->rangeBegin = this->range.begin();
// this->rangeEnd = this->range.end();
// this->rangeIterator = this->range.begin();
}
// void VCFInputFile::clearRange() {
// #ifndef NDEBUG
// if (this->range.size()) {
// fprintf(stderr, "Clear existing %zu range.\n", this->range.size());
// }
// #endif
// if (mode == BCF_MODE) {
// this->bcfReader->clearRange();
// } else if (mode == VCF_RANGE_MODE) {
// this->VCFRecord->clearRange();
// }
// // this->range.clear();
// // this->ti_line = 0;
// };
/**
* @param fn: the file contains two column: old_id new_id
*/
int VCFInputFile::updateId(const char* fn) {
// load conversion table
LineReader lr(fn);
std::map<std::string, std::string> tbl;
std::vector<std::string> fd;
while (lr.readLineBySep(&fd, "\t ")) {
if (tbl.find(fd[0]) != tbl.end()) {
fprintf(stderr,
"Duplicated original ids: [ %s ], replace it to new id anyway.\n",
fd[0].c_str());
};
if (fd.empty() || fd[0].empty() || fd.size() < 2) continue;
tbl[fd[0]] = fd[1];
}
// rewrite each people's name
std::string s = "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT";
VCFPeople& people = this->record.getPeople();
int n = 0;
for (unsigned int i = 0; i < people.size(); i++) {
if (tbl.find(people[i]->getName()) != tbl.end()) {
++n;
people[i]->setName(tbl[people[i]->getName()]);
}
}
this->rewriteVCFHeader();
// return result
return n;
}
void VCFInputFile::init(const char* fn) {
this->fileName = fn;
this->fp = NULL;
this->tabixReader = NULL;
this->bcfReader = NULL;
this->autoMergeRange = false;
// check whether file exists.
FILE* fp = fopen(fn, "rb");
if (!fp) {
fprintf(stderr, "[ERROR] Failed to open file [ %s ]\n", fn);
// quit to avoid segfault in the future
exit(1);
}
fclose(fp);
bool headerLoaded = false;
// use file name to check file type
if (endsWith(fn, ".bcf") || endsWith(fn, ".bcf.gz")) {
this->mode = BCF_MODE;
this->bcfReader = new BCFReader(fn);
const std::string& h = this->bcfReader->getHeader();
this->header.setHeader(h);
this->record.createIndividual(this->header[this->header.size() - 1]);
headerLoaded = true;
} else {
if (!endsWith(fn, ".vcf") && !endsWith(fn, "vcf.gz")) {
fprintf(stderr, "[WARN] File name does not look like a VCF/BCF file.\n");
}
this->mode = VCF_LINE_MODE;
this->fp = new LineReader(fn);
// open file
// read header
while (this->fp->readLine(&line)) {
if (line[0] == '#') {
this->header.push_back(line);
if (line.substr(0, 6) == "#CHROM") {
this->record.createIndividual(line);
headerLoaded = true;
break;
}
continue;
}
if (line[0] != '#') {
FATAL("Wrong VCF header");
}
}
// this->hasIndex = this->openIndex();
}
if (headerLoaded == false) {
FATAL("VCF/BCF File does not have header!");
}
// this->clearRange();
}
void VCFInputFile::close() {
// closeIndex();
this->record.deleteIndividual();
if (this->fp) {
delete this->fp;
this->fp = NULL;
}
if (this->tabixReader) {
delete this->tabixReader;
this->tabixReader = NULL;
}
if (this->bcfReader) {
delete this->bcfReader;
this->bcfReader = NULL;
}
}
bool VCFInputFile::readRecord() {
int nRead = 0;
while (true) {
if (this->mode == VCF_LINE_MODE) {
nRead = this->fp->readLine(&this->line);
} else if (this->mode == VCF_RANGE_MODE) {
nRead = this->tabixReader->readLine(&this->line);
} else if (this->mode == BCF_MODE) {
nRead = this->bcfReader->readLine(&this->line);
}
if (!nRead) return false;
// star parsing
int ret;
this->record.attach(&this->line);
ret = this->record.parseSite();
if (ret) {
reportReadError(this->line);
}
if (!this->isAllowedSite()) continue;
ret = this->record.parseIndividual();
if (ret) {
reportReadError(this->line);
}
if (!this->passFilter()) continue;
// break;
return true;
}
}
//////////////////////////////////////////////////
// Sample inclusion/exclusion
void VCFInputFile::includePeople(const char* s) {
this->record.includePeople(s);
}
void VCFInputFile::includePeople(const std::vector<std::string>& v) {
this->record.includePeople(v);
}
void VCFInputFile::includePeopleFromFile(const char* fn) {
this->record.includePeopleFromFile(fn);
}
void VCFInputFile::includeAllPeople() { this->record.includeAllPeople(); }
void VCFInputFile::excludePeople(const char* s) {
this->record.excludePeople(s);
}
void VCFInputFile::excludePeople(const std::vector<std::string>& v) {
this->record.excludePeople(v);
}
void VCFInputFile::excludePeopleFromFile(const char* fn) {
this->record.excludePeopleFromFile(fn);
}
void VCFInputFile::excludeAllPeople() { this->record.excludeAllPeople(); }
//////////////////////////////////////////////////
// Adjust range collections
void VCFInputFile::enableAutoMerge() { this->autoMergeRange = true; }
void VCFInputFile::disableAutoMerge() { this->autoMergeRange = false; }
// void clearRange();
void VCFInputFile::setRangeFile(const char* fn) {
if (!fn || strlen(fn) == 0) return;
RangeList r;
r.addRangeFile(fn);
this->setRange(r);
}
// @param l is a string of range(s)
void VCFInputFile::setRange(const char* chrom, int begin, int end) {
RangeList r;
r.addRange(chrom, begin, end);
this->setRange(r);
}
void VCFInputFile::setRange(const RangeList& rl) { this->setRangeList(rl); }
void VCFInputFile::setRangeList(const std::string& l) {
if (l.empty()) return;
RangeList r;
r.addRangeList(l);
this->setRange(r);
}
// this function the entry point for all function add/change region list
void VCFInputFile::setRangeList(const RangeList& rl) {
if (rl.size() == 0) return;
this->setRangeMode();
RangeList l;
l.setRange(rl);
if (this->autoMergeRange) l.sort();
if (mode == VCF_RANGE_MODE) {
this->tabixReader->setRange(l);
} else if (mode == BCF_MODE) {
this->bcfReader->setRange(l);
} else {
fprintf(stderr, "[ERROR] invalid reading mode, quitting...\n");
abort();
}
}
int VCFInputFile::setSiteFile(const std::string& fn) {
if (fn.empty()) return 0;
std::vector<std::string> fd;
LineReader lr(fn);
int pos;
std::string chromPos;
while (lr.readLineBySep(&fd, "\t ")) {
if (fd.empty()) continue;
if (fd[0].find(':') != std::string::npos) {
this->allowedSite.insert(fd[0]);
continue;
}
if (fd.size() >= 2 && str2int(fd[1], &pos) && pos > 0) {
chromPos = fd[0];
chromPos += ':';
chromPos += fd[1];
this->allowedSite.insert(chromPos);
continue;
}
}
return 0;
}
void VCFInputFile::getIncludedPeopleName(std::vector<std::string>* p) {
record.getIncludedPeopleName(p);
}
|
fadfe19e6b3497f5f3c4160c6bfa3379bee9748c | d308dcec76de6e76c8f504d520cbd3a690322e0b | /Robot/group03/Traffic Light Detection (Final Project)/Traffic_Light_Detection/Traffic_Light_Detection.ino | c804c96eaa094d4e8ccc6feea17da5054eae7899 | [] | no_license | asla9709/MobileRobotics | 188c6edf35e0c043c105b2698577ff82c487c415 | 0d7828866f551ce9df9eed4299cd027cb41d7cae | refs/heads/master | 2020-03-11T16:13:53.934986 | 2018-06-14T04:20:45 | 2018-06-14T04:20:45 | 130,110,061 | 0 | 0 | null | 2018-04-24T05:43:17 | 2018-04-18T19:10:32 | C++ | UTF-8 | C++ | false | false | 1,690 | ino | Traffic_Light_Detection.ino | #include "Motor.h"
#include "Wire.h"
const int startButton = 10;
const int trigPin = 12;
const int echoPin = 13;
const int ledPin = 7;
//initialize car components
Motor leftMotor(2,3);
Motor rightMOtor(4,5);
//initialize car
bool start_motion = true;
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long DELAY_TIME = 10;
void setup(){
pinMode(ledPin, OUTPUT);
//put your setup code here, to run once:
Serial.begin(9600);
pinMode(startButton, INPUT);
while(digitalRead(startButton)==LOW){
delay(3);
}
}
const int targetX = 128;
const int targetY = 170;
long x;
long y;
const float Kturning = 0.8;
const float Kmoving = 1.5;
void move(int leftPower, int rightPower){
if(leftPower >= 0){
leftMotor.forward(leftPower);
} else {
leftMotor.backward(abs(leftPower));
}
if(right if(rightPower >= 0){
rightMotor.forward(leftPower);
} else {
rightMotor.backward(abs(leftPower));
}
}
void readSerial()
{
while(Serial.available() > 0){
//while(Serial.read() != 'X'){} //Skip chars until 'X'
x = Serial.parseInt();
//while(Serial.read() != 'Y'){} //Skip chars until 'Y'
y = Serial.parseInt();
while(Serial.read() != '\n'){}
return;
}
}
void loop()
{
// find out where the traffic light circle is
readSerial();
if(RED == true && GREEN == false){
move(0,0);
}
else {
// based on ball Y location, determine overall power
int movePower = floor(-1 * Kmoving * (y - targetY));
// based on ball X location, determine turning power
int turnPower = floor(Kturning * (x - targetX));
// move based on powers.
move(movePower + turnPower, movePower - turnPower);
}
}
|
92c510813a43cbe0a622b5922863f7b671e623dd | 4416d4c599f175b68f54e0ee2aca97b18639567f | /DXBase/DXBase/sources/Actor/Person/Enemy/Bosses/MiniBoss/MediumBoss/BossScrollPoint.cpp | 63154402e61108cbf52ccbb53903122220889e5f | [] | no_license | kentatakiguchi/GameCompetition2016_2 | 292fa9ab574e581406ff146cc98b15efc0d66446 | df1eb6bf29aba263f46b850d268f49ef417a134b | refs/heads/master | 2021-01-11T18:21:34.377644 | 2017-03-03T08:25:39 | 2017-03-03T08:25:39 | 69,625,978 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 3,095 | cpp | BossScrollPoint.cpp | #include "BossScrollPoint.h"
#include "../../../../Player/PlayerBody.h"
#include "../../../../Player/PlayerConnector.h"
#include "../../../../../../World/IWorld.h"
#include "../../../../../../Define.h"
BossScrollPoint::BossScrollPoint(IWorld * world, const Vector2 & position) :
Actor(world, "BossScrollPoint",
position + Vector2::Right * (CHIPSIZE / 3.0f),
CollisionBase()),
isPlayerIn_(false),
prevPlayerDirection_(Vector2::Zero),
player_(nullptr)
{
}
void BossScrollPoint::onUpdate(float deltaTime)
{
// ใใฌใคใคใผใ็ฏๅฒๅ
ใซใใใ
playerPosition("PlayerBody1");
playerPosition("PlayerBody2");
if (!isPlayerIn_) return;
scrollMove(deltaTime);
auto boss = world_->findActor("Boss");
// ไธญใในใใใชใใชใใๅ้คใใ
if (boss == nullptr) {
isPlayerIn_ = false;
world_->setIsMBossStage(false);
dead();
}
}
bool BossScrollPoint::isInMBossStage()
{
return isPlayerIn_;
}
// ใใฌใคใคใผใฎไฝ็ฝฎใ่จ็ฎ
void BossScrollPoint::playerPosition(const std::string name)
{
// ใใงใซในใฏใญใผใซใใๅ ดๅใฏ่ฟใ
if (world_->isMBossStage()) return;
auto player = world_->findActor(name);
if (player != nullptr) {
// ็ฏๅฒๅคใซๅฑ
ใๅ ดๅใฏ่ฟใ
auto distance = Vector2(position_ - player->getPosition());
if (std::abs(distance.x) > CHIPSIZE * 9.5f ||
std::abs(distance.y) > CHIPSIZE * 5.5f) return;
// ็ฏๅฒๅ
ใซใใๅฆ็
world_->PlayerNotMove(true);
player_ = player;
isPlayerIn_ = true;
}
else return;
}
// ในใฏใญใผใซๆใฎ็งปๅ
void BossScrollPoint::scrollMove(float deltaTime)
{
if (world_->isMBossStage()) return;
// ใใฎใชใใธใงใฏใใฎไฝ็ฝฎใซในใฏใญใผใซใใ
auto player1 = dynamic_cast<PlayerBody*>(world_->findActor("PlayerBody1").get());
if (player1 == nullptr) return;
//auto direction = position_ -
// ็งปๅๆนๅใฎ่จญๅฎ
if (prevPlayerDirection_.x == 0.0f)
prevPlayerDirection_ = Vector2(player1->getPosition() - position_).Normalize();
auto direction = Vector2::Right;
if (prevPlayerDirection_.x < 0.0f) direction.x = -1.0f;
auto scroolPos = position_+ Vector2(CHIPSIZE * 4 * direction.x, CHIPSIZE * 6);
// ๆๅฎใฎไฝ็ฝฎใซ็ใใๅ ดๅใฏ่ฟใ
if (player_->getPosition().x == scroolPos.x) {
world_->setIsMBossStage(true);
//world_->PlayerNotMove(false);
return;
}
// ใใฌใคใคใผใๅใใ
auto player2 = dynamic_cast<PlayerBody*>(world_->findActor("PlayerBody2").get());
if (player2 == nullptr) return;
// ็งปๅ้ๅบฆ
auto speed = min(250.0f / 60.0f,
std::abs(scroolPos.x - player_->getPosition().x) / 60.0f);
if (speed < 250.0f / 60.0f) {
world_->setIsMBossStage(true);
//world_->PlayerNotMove(false);
return;
}
auto velocity = direction * -(speed * 60.0f);
player1->ForcedMove(velocity);
player2->ForcedMove(velocity);
auto playerConnecter = dynamic_cast<PlayerConnector*>(world_->findActor("PlayerConnector").get());
if (playerConnecter == nullptr) return;
playerConnecter->ForcedMove(velocity);
//dynamic_cast<PlayerBody*>(world_->findActor("PlayerBody1").get())->ForcedMove(Vector2(150.0f, 0.0f));
}
|
978a435ba82bb8b86ec3daeadaac18ba07d0fef0 | fb5545a27eba0d1df279a11ebe2c0e47921f9ff3 | /Science/FFTData.cpp | e2aa566f9d2bc93e0a6ef61bc7689c3fe29bc2f6 | [] | no_license | OpenEngineDK/projects-MRISIM | f9e187652847c42ed49e30df34fb5d608c553071 | f2ccfc41e84f3b61448ec0b99ad12baed7bd49ca | refs/heads/master | 2020-12-24T20:15:30.488997 | 2016-05-05T00:43:11 | 2016-05-05T00:43:11 | 58,077,385 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 632 | cpp | FFTData.cpp | #include "FFTData.h"
namespace MRI {
namespace Science {
FFTData::FFTData() {
}
void FFTData::SetFFTOutput(vector<complex<double> > data) {
convertedData.clear();
for(vector<complex<double> >::iterator itr = data.begin();
itr != data.end();
itr++) {
complex<double> c = *itr;
convertedData.push_back(abs(c));
}
}
void FFTData::SetSampleRate(float dt) {
max_x = 1/(dt*2);
}
pair<float,float> FFTData::GetXRange() {
return std::make_pair(0,max_x);
}
string FFTData::GetYName() {
return "FFT";
}
vector<float> FFTData::GetYData() {
return convertedData;
}
}
}
|
3abcc5b0f6bbbf31ba68ebde29752eb57cd72254 | 51ac3033058d790645e1e91ebf962ea9deaf96d0 | /src/include/evaluate.h | b74cee24a791a45c6a4826d72013142bb4d755a3 | [] | no_license | YznMur/kitti_deep_vo | 4247dfc7de0abd14c0046f0c3070e3ce297583c9 | 90b46f500ac326cb2b3c2fcde1d4e4a0f44e0f0d | refs/heads/main | 2023-07-15T22:44:50.985512 | 2021-08-26T08:32:09 | 2021-08-26T08:32:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 740 | h | evaluate.h | #ifndef VO_EVALUATE_H
#define VO_EVALUATE_H
#include "matrix.h"
#include "common.h"
struct Error
{
double r_err, t_err;
};
bool LoadPoses(std::vector<Matrix>& poses, const std::string& filename);
std::vector<double> ComputeTrajectoryDistances(const std::vector<Matrix>& poses);
int ComputeLastFrame(const std::vector<double>& dist, const int first_frame, const double len);
double ComputeRotationError(const Matrix& pose_error);
double ComputeTranslationError(const Matrix& pose_error);
std::vector<Error> ComputeErrors (const std::vector<Matrix>& poses_gt, const std::vector<Matrix>& poses_est);
void PrintErrors (const std::vector<Error>& err);
bool EvaluateResults(const std::string& path_gt, const std::string& path_est);
#endif
|
0b0c9e7180cfa666686de943cd38e572afe3a0bf | e7aeb9c49f0d35caa1cea7f416ee1d238c8a2426 | /HDUOJ/HDU2097-Skyๆฐ.cpp | dd7d4e54e83114f93a0cdf6e2a840a6ef0361955 | [] | no_license | protectors/ACM | 1ee0c2ade796c5bda80fc0551647661c2b40c65a | a9b33912d8763c6af37fbbae4135b2761a69a2a8 | refs/heads/master | 2022-07-26T13:57:40.590234 | 2022-06-21T03:41:13 | 2022-06-21T03:41:13 | 85,793,349 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 638 | cpp | HDU2097-Skyๆฐ.cpp | #include <iostream>
using namespace std;
bool issky(int n){
int tmp,t10,t12,t16;
t10=t12=t16=0;
tmp=n;
while(tmp){
t10+=tmp%10;
tmp/=10;
}
tmp=n;
while(tmp){
t12+=tmp%12;
tmp/=12;
}
tmp=n;
while(tmp){
t16+=tmp%16;
tmp/=16;
}
//cout<<t10<<endl<<t12<<endl<<t16<<endl;
if(t12==t16 && t10==t12)
return true;
else
return false;
}
int main(){
int n;
while(cin>>n&&n){
if(issky(n))
cout<<n<<" is a Sky Number.\n";
else
cout<<n<<" is not a Sky Number.\n";
}
return 0;
}
|
d23115fbd0f1dfc6c507f3d93f4aa63f31fae124 | bf7141f609a670741dc5e07299e378412f37ed84 | /XtractL/XtractL/tools/TransducerActionOStream.cpp | ee339f6a296aaad76f05b51f873da80df3b059e5 | [] | no_license | ADozois/GPA789_Lab1 | 874ed96e28a800f6e6fd300d12c3cee6746a854b | 1ecc2c149116334d66902bb95e2b4abb8698ccec | refs/heads/master | 2021-07-16T07:53:45.831016 | 2017-10-22T21:30:27 | 2017-10-22T21:30:27 | 104,134,175 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 135 | cpp | TransducerActionOStream.cpp | #include "TransducerActionOStream.h"
TransducerActionOStream::TransducerActionOStream(ostream * oStream)
: mOStream{ oStream }
{
}
|
da6a984c62f8f2268fcdc694c64cf1069b0f40d2 | 85fe031ad1b7ba918fd2de0ccc68185b0e19439e | /source-code/Find_Duplicate_Subtrees.cpp | 80e51d7f25e87318897d45bead4aa11285175b76 | [] | no_license | Mogileeswaran/LeetCode_problems_solution | e7bbe0387bd98fed115ba4c73ea549270aa7a7bd | f31032c69fcb0d549797023584aa131507e7471e | refs/heads/master | 2021-01-09T00:21:28.139841 | 2019-01-13T07:00:39 | 2019-01-13T07:00:39 | 242,186,579 | 1 | 0 | null | 2020-02-21T16:46:29 | 2020-02-21T16:46:28 | null | UTF-8 | C++ | false | false | 2,921 | cpp | Find_Duplicate_Subtrees.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// AC
// postorder and preorder signature will work, inorder not.
class Solution {
string preorder(TreeNode* root, unordered_map<string, int>& preOrderMap, vector<TreeNode*>& result) {
if(!root) {
return "#";
}
signature += "," + to_string(root->val);
string signature = preorder(root->left, preOrderMap, result);
signature += "," + preorder(root->right, preOrderMap, result);
// signature += "," + to_string(root->val); would work too
if(preOrderMap[signature] == 1) {
result.push_back(root);
}
preOrderMap[signature]++;
return signature;
}
public:
vector<TreeNode*> findDuplicateSubtrees(TreeNode* root) {
vector<TreeNode*> result;
unordered_map<string, int> preOrderMap;
preorder(root, preOrderMap, result);
return result;
}
};
// brute-force, TLE, 121/167 testcases passed
class Solution {
bool isSame(TreeNode* rootA, TreeNode* rootB) {
if(!rootA and !rootB) {
return true;
}
if(!rootA or !rootB) {
return false;
}
return rootA->val == rootB->val and isSame(rootA->left, rootB->left) and isSame(rootA->right, rootB->right);
}
bool hasDuplicate(TreeNode* node, TreeNode* root, unordered_set<TreeNode*>& visited) {
if(!root) {
return false;
}
if(visited.find(root) == visited.end() and isSame(node, root)) {
visited.insert(root);
return true;
}
int leftDuplicate = hasDuplicate(node, root->left, visited);
int rightDuplicate = hasDuplicate(node, root->right, visited);
return leftDuplicate or rightDuplicate;
}
void findDuplicateSubtrees(TreeNode* node, TreeNode* root, vector<TreeNode*>& result, unordered_set<TreeNode*>& visited) {
if(!node) {
return;
}
if(visited.find(node) == visited.end()) {
visited.insert(node);
if(hasDuplicate(node, root, visited)) {
result.push_back(node);
}
}
findDuplicateSubtrees(node->left, root, result, visited);
findDuplicateSubtrees(node->right, root, result, visited);
}
public:
vector<TreeNode*> findDuplicateSubtrees(TreeNode* root) {
unordered_set<TreeNode*> visited;
vector<TreeNode*> result;
findDuplicateSubtrees(root, root, result, visited);
return result;
}
}; |
91c0d03a5164fdc9b7e4e0cd2eed4ba3b00911cc | 66deb611781cae17567efc4fd3717426d7df5e85 | /ppro/PrivacyProtection/rule/KVariableString.cpp | 84730b5276f4136b7b8727087d89b7e7070c8e58 | [
"Apache-2.0"
] | permissive | heguoxing98/knoss-pcmanager | 4671548e14b8b080f2d3a9f678327b06bf9660c9 | 283ca2e3b671caa85590b0f80da2440a3fab7205 | refs/heads/master | 2023-03-19T02:11:01.833194 | 2020-01-03T01:45:24 | 2020-01-03T01:45:24 | 504,422,245 | 1 | 0 | null | 2022-06-17T06:40:03 | 2022-06-17T06:40:02 | null | GB18030 | C++ | false | false | 2,214 | cpp | KVariableString.cpp | #include "stdafx.h"
#include "KVariableString.h"
#include "KSystemEnvirVar.h"
BOOL KVariableString::SetVariable(LPCTSTR szName, LPCTSTR szString)
{
BOOL bReturn = TRUE;
CString strName(szName);
CString strString(szString);
std::map<CString, CString>::iterator iter;
strName.MakeLower();
strString.MakeLower();
iter = m_mapVariable.find(strName);
if (iter != m_mapVariable.end())
bReturn = FALSE;
else
m_mapVariable.insert(std::make_pair(strName, strString));
return bReturn;
}
CString KVariableString::GetVariable(LPCTSTR szName)
{
CString strName(szName);
std::map<CString, CString>::iterator iter;
strName.MakeLower();
iter = m_mapVariable.find(strName);
if (iter != m_mapVariable.end())
return iter->second;
KSystemEnvirVar envir;
CString strValue = envir.GetValue(szName);
if (!strValue.IsEmpty())
{
strValue.MakeLower();
m_mapVariable.insert(std::make_pair(strName, strValue));
return strValue;
}
return _T("");
}
BOOL KVariableString::RelpaceVariable(CString& strString)
{
BOOL bReturn = TRUE;
int nStartPos;
int nEndPos;
CString strTemp(strString);
CString strVariable;
CString strValue;
for (;;)
{
nStartPos = strTemp.Find(_T('%'), 0);
if (nStartPos != -1)
nEndPos = strTemp.Find(_T('%'), nStartPos + 1);
if (nStartPos == -1 || nEndPos == -1)
break;
strVariable = strTemp.Mid(nStartPos, nEndPos - nStartPos + 1);
strValue = GetVariable(strVariable);
if (strValue.IsEmpty())
break;
strTemp.Replace(strVariable, strValue);
}
if (strTemp.Find(_T('%')) != -1)
{
#ifdef OUTPUT_INIT_WARNING
#ifdef __log_file__
CString strTempVar(strString);
strTempVar.Replace(_T("%"), _T("%%"));
DPrintW(L"KVariableString::RelpaceVariable fail, variablename:%s\n", strTempVar);
CString strMsg;
strMsg.Format(_T("ๆฅๆพ็ฏๅขๅ้ๅคฑ่ดฅ:%s"), strString);
::MessageBox(NULL, strMsg, _T("้็งไฟๆคๅจ"), MB_OK);
#endif
#endif
return FALSE;
}
do
{
nStartPos = strTemp.Find(_T("\\\\"));
if (nStartPos == -1)
break;
strTemp.Replace(_T("\\\\"), _T("\\"));
} while (true);
strString = strTemp;
return TRUE;
} |
5035cb03ad37557871b68fa468354f82e2be8206 | 71cae6e39c666be24a1e5c55e110a15a0d65faed | /Ants/main1.cpp | fa7e127908de1bc391c77363efc37161ef9717ca | [] | no_license | crazyjerryh/Practice | 18bb7a885e7652ba867fbbe8cf844d56cf19eb29 | e8862083d37066dac1a395c652e2f36793ab48e3 | refs/heads/master | 2021-01-18T13:57:26.490761 | 2015-10-29T14:08:45 | 2015-10-29T14:08:45 | 33,871,665 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,855 | cpp | main1.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#define N 110
using namespace std;
typedef long long ll;
const double inf=1e40;
const double eps=1e-6;
double s[N][N],slack[N];
double lx[N],ly[N];
int mat[N],n;
bool vx[N],vy[N];
bool dfs(int u){
vx[u]=1;
for(int i=1;i<=n;i++){
if(!vy[i]){
double t=lx[u]+ly[i]-s[u][i];
if(fabs(t)<eps){
vy[i]=1;
if(mat[i]==-1||dfs(mat[i])){
mat[i]=u;
return 1;
}
}
else
slack[i]=min(slack[i],t);
}
}
return 0;
}
void KM(){
memset(mat,-1,sizeof(mat));
memset(ly,0,sizeof(ly));
for(int i=1;i<=n;i++){
lx[i]=-inf;
for(int j=1;j<=n;j++)
lx[i]=max(lx[i],s[i][j]);
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)slack[j]=inf;
while(1){
memset(vx,0,sizeof(vx));
memset(vy,0,sizeof(vy));
if(dfs(i))break;
double d=inf;
for(int j=1;j<=n;j++)
if(!vy[j])d=min(d,slack[j]);
for(int j=1;j<=n;j++)
if(vx[j])lx[j]-=d;
for(int j=1;j<=n;j++)
if(vy[j])ly[j]+=d;
}
}
for(int i=1;i<=n;i++)
printf("%d\n",mat[i]);
}
double bx[N],by[N],wx[N],wy[N];
double dis(int i,int j){
return sqrt((wx[i]-bx[j])*(wx[i]-bx[j])+(wy[i]-by[j])*(wy[i]-by[j]));
}
int main(){
int flag=0;
//freopen("debug.txt","r",stdin);
while(cin>>n){
for(int i=1;i<=n;i++)cin>>bx[i]>>by[i];
for(int i=1;i<=n;i++)cin>>wx[i]>>wy[i];
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
s[i][j]=-dis(i,j);
if(flag)printf("\n");
KM();
flag=1;
}
return 0;
}
|
87d7f19107134f784bebe1876e2822fcbfcb05dc | 07074962be026c67519a0ccfb3d48bd95ede38ed | /Reports/cr5saleremoveddishes.cpp | 2c9955295a70ec88c8dfbd6f5177d4e834b8d871 | [] | no_license | End1-1/Cafe5 | 2fa65c62f395c186e2204f3fb941a2f93fd3a653 | ba2b695c627cf59260a3ac1134927198c004fe53 | refs/heads/master | 2023-08-17T02:39:29.224396 | 2023-08-14T06:37:55 | 2023-08-14T06:37:55 | 151,380,276 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,635 | cpp | cr5saleremoveddishes.cpp | #include "cr5saleremoveddishes.h"
#include "c5tablemodel.h"
#include "c5waiterorder.h"
#include "c5mainwindow.h"
#include "cr5saleremoveddishesfilter.h"
CR5SaleRemovedDishes::CR5SaleRemovedDishes(const QStringList &dbParams, QWidget *parent) :
C5ReportWidget(dbParams, parent)
{
fIcon = ":/delete.png";
fLabel = tr("Sales, removed dishes");
fSimpleQuery = false;
fMainTable = "o_body ob";
fLeftJoinTables << "left join o_header oh on oh.f_id=ob.f_header [oh]"
<< "left join h_halls h on h.f_id=oh.f_hall [h]"
<< "left join h_tables t on t.f_id=oh.f_table [t]"
<< "left join o_state os on os.f_id=oh.f_state [os]"
<< "left join o_body_state bs on bs.f_id=ob.f_state [bs]"
<< "left join d_dish d on d.f_id=ob.f_dish [d]"
<< "left join d_part2 dp on dp.f_id=d.f_part [dp]"
;
fColumnsFields << "oh.f_id as f_header"
<< "concat(oh.f_prefix, oh.f_hallid) as f_order"
<< "os.f_name as f_statename"
<< "h.f_name as f_hallname"
<< "t.f_name as f_tablename"
<< "oh.f_datecash"
<< "dp.f_name as f_dishpart"
<< "d.f_name as f_dishname"
<< "bs.f_name as f_dishstate"
<< "ob.f_removereason"
<< "sum(ob.f_qty2) as f_qty"
<< "sum(ob.f_total) as f_total"
;
fColumnsGroup << "oh.f_id as f_header"
<< "concat(oh.f_prefix, oh.f_hallid) as f_order"
<< "h.f_name as f_hallname"
<< "t.f_name as f_tablename"
<< "os.f_name as f_statename"
<< "oh.f_datecash"
<< "dp.f_name as f_dishpart"
<< "d.f_name as f_dishname"
<< "bs.f_name as f_dishstate"
<< "ob.f_removereason"
;
fColumnsSum << "f_qty"
<< "f_total"
;
fTranslation["f_header"] = tr("Header");
fTranslation["f_order"] = tr("Order");
fTranslation["f_hallname"] = tr("Hall");
fTranslation["f_tablename"] = tr("Table");
fTranslation["f_statename"] = tr("Order state");
fTranslation["f_datecash"] = tr("Date, cash");
fTranslation["f_dishpart"] = tr("Type of dish");
fTranslation["f_dishname"] = tr("Dish");
fTranslation["f_dishstate"] = tr("Dish state");
fTranslation["f_removereason"] = tr("Remove reason");
fTranslation["f_qty"] = tr("Qty");
fTranslation["f_total"] = tr("Total");
fColumnsVisible["oh.f_id as f_header"] = true;
fColumnsVisible["oh.f_datecash"] = true;
fColumnsVisible["os.f_name as f_statename"] = true;
fColumnsVisible["concat(oh.f_prefix, oh.f_hallid) as f_order"] = true;
fColumnsVisible["h.f_name as f_hallname"] = true;
fColumnsVisible["t.f_name as f_tablename"] = true;
fColumnsVisible["dp.f_name as f_dishpart"] = true;
fColumnsVisible["d.f_name as f_dishname"] = true;
fColumnsVisible["bs.f_name as f_dishstate"] = true;
fColumnsVisible["ob.f_removereason"] = true;
fColumnsVisible["sum(ob.f_qty2) as f_qty"] = true;
fColumnsVisible["sum(ob.f_total) as f_total"] = true;
restoreColumnsVisibility();
fFilterWidget = new CR5SaleRemovedDishesFilter(fDBParams);
fFilter = static_cast<CR5SaleRemovedDishesFilter*>(fFilterWidget);
}
QToolBar *CR5SaleRemovedDishes::toolBar()
{
if (!fToolBar) {
QList<ToolBarButtons> btn;
btn << ToolBarButtons::tbFilter
<< ToolBarButtons::tbClearFilter
<< ToolBarButtons::tbRefresh
<< ToolBarButtons::tbExcel
<< ToolBarButtons::tbPrint;
fToolBar = createStandartToolbar(btn);
}
return fToolBar;
}
void CR5SaleRemovedDishes::restoreColumnsWidths()
{
C5Grid::restoreColumnsWidths();
if (fColumnsVisible["oh.f_id as f_header"]) {
fTableView->setColumnWidth(fModel->fColumnNameIndex["f_id"], 0);
}
}
bool CR5SaleRemovedDishes::tblDoubleClicked(int row, int column, const QList<QVariant> &v)
{
Q_UNUSED(row);
Q_UNUSED(column);
if (!fColumnsVisible["oh.f_id as f_header"]) {
C5Message::info(tr("Column 'Header' must be checked in filter"));
return true;
}
if (v.count() == 0) {
return true;
}
C5WaiterOrder *wo = __mainWindow->createTab<C5WaiterOrder>(fDBParams);
wo->setOrder(v.at(fModel->fColumnNameIndex["f_id"]).toString());
return true;
}
|
3f695417651a60347685ec3a4a17ec6c293dfc16 | 9d01fb26dc549de3fa424ec31f0ca6caa5c7f9de | /Clases/Ventana_principal.h | 9759b222c82dc2e056a6e0e27646304fbe07f706 | [] | no_license | alrus2797/FLDSMDFR | 6a8158d0dd69fd98c111f8e5f958737b56a53f14 | 2e6a6a449c6f94b684cb27582f1a8bac3f3827fc | refs/heads/master | 2021-08-14T08:27:40.890771 | 2017-11-15T04:58:47 | 2017-11-15T04:58:47 | 104,372,516 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,271 | h | Ventana_principal.h | #ifndef VENTANAPRINCIPAL_H
#define VENTANAPRINCIPAL_H
#include "Ventana.h"
#include "Politica.h"
#include "PoliticaFIFO.h"
#include "PoliticaPRIO.h"
#include "PoliticaSPF.h"
#include "PoliticaRSPF.h"
#include "PoliticaRoundRobin.h"
#include "PoliticaRoundRobinPrio.h"
class VentanaPrincipal: public Ventana{
public:
VentanaPrincipal(){}
~VentanaPrincipal(){}
void loadWidgets();
void post_inicio();
void actualizar();
void actualizar_politicas();
void actualizarLabelsProcesos();
void posicionarProcesos();
private:
vector<Politica*> politicas;
vector<proceso*> procesos;
Time quantum = seconds(0);
float pos_x = 20;
float pos_y = 200;
vector<string> estados = {"creating", "ready", "running", "blocked", "finished"};
vector<sf::Color> colores = {sf::Color::Yellow, sf::Color::Green, sf::Color::Blue, sf::Color::Red, sf::Color::Magenta};
//seleccionar Politica
ComboBox::Ptr choose_politica;
int politica;
};
void VentanaPrincipal::loadWidgets(){
auto theme = tgui::Theme::create("widgets/Black.txt");
// Get a bound version of the window size
// Passing this to setPosition or setSize will make the widget automatically update when the view of the gui changes
auto windowWidth = tgui::bindWidth(*gui);
auto windowHeight = tgui::bindHeight(*gui);
// Create the background image (picture is of type tgui::Picture::Ptr or std::shared_widget<Picture>)
auto picture = tgui::Picture::create();
picture->setSize(tgui::bindMax(800, windowWidth), tgui::bindMax(600, windowHeight));
gui->add(picture);
// process name edit box
EditBox::Ptr nombreP = EditBox::create();
nombreP->setSize(200, 30);
nombreP->setPosition(50, 50);
nombreP->setDefaultText("Nombre del Proceso");
gui->add(nombreP, "nombreP");
// service time edit box
EditBox::Ptr tiempoServ = EditBox::create();
tiempoServ->setSize(150, 30);
tiempoServ->setPosition(300, 50);
tiempoServ->setDefaultText("Tiempo de Servicio");
gui->add(tiempoServ, "tiempoServ");
// priority edit box
EditBox::Ptr prioridad = EditBox::create();
prioridad->setSize(150, 30);
prioridad->setPosition(500, 50);
prioridad->setDefaultText("prioridad");
gui->add(prioridad, "prioridad");
Button::Ptr crearProc = Button::create();
crearProc->setSize(150, 50);
crearProc->setPosition(50, 100);
crearProc->setText("Crear Proceso");
gui->add(crearProc, "crearProc");
Label::Ptr nomPro = Label::create();
nomPro->setSize(100, 30);
nomPro->setPosition(pos_x + 50, pos_y - 35);
nomPro->setText("Nombre");
gui->add(nomPro);
auto rend1 = nomPro-> getRenderer();
rend1->setBackgroundColor(sf::Color(180, 180, 180));
Label::Ptr tiemServ = Label::create();
tiemServ->setSize(100, 30);
tiemServ->setPosition(pos_x + 350, pos_y - 35);
tiemServ->setText("T. servicio");
gui->add(tiemServ);
auto rend2 = tiemServ-> getRenderer();
rend2->setBackgroundColor(sf::Color(180, 180, 180));
Label::Ptr nomEstado = Label::create();
nomEstado->setSize(100, 30);
nomEstado->setPosition(pos_x + 220, pos_y - 35);
nomEstado->setText("Estado");
gui->add(nomEstado);
auto rend3 = nomEstado-> getRenderer();
rend3->setBackgroundColor(sf::Color(180, 180, 180));
choose_politica = ComboBox::create();
choose_politica->setSize(100,30);
choose_politica->setPosition(400,100);
choose_politica->addItem("FIFO");
choose_politica->addItem("Prioridad");
choose_politica->addItem("SPF");
choose_politica->addItem("RSPF");
choose_politica->addItem("RoundRobin");
choose_politica->addItem("RoundRobinPrio");
choose_politica->setSelectedItemByIndex(0);
gui->add(choose_politica);
//politica=0;
auto createProccess = [&](EditBox::Ptr prioridad, EditBox::Ptr nombreP, EditBox::Ptr tiempoServ) {
string nombreProceso = nombreP->getText().toAnsiString();
proceso* proc = new proceso(nombreProceso, tgui::stoi(prioridad->getText().toAnsiString()), tgui::stoi(tiempoServ->getText().toAnsiString()) );
proc->l_nombre = Label::create();
proc->l_nombre->setSize(150, 30);
proc->l_nombre->setText(nombreProceso);
proc->l_estado = Label::create();
proc->l_estado->setSize(100, 30);
proc->l_estado->setText("nuevo");
proc->l_tiempo = Label::create();
proc->l_tiempo->setSize(100, 30);
proc->l_tiempo->setText("0");
proc->b_bloquear = Button::create();
proc->b_bloquear->setSize(150, 30);
proc->b_bloquear->setText("bloquear");
proc->b_desbloquear = Button::create();
proc->b_desbloquear->setSize(150, 30);
proc->b_desbloquear->setText("desbloquear");
gui->add(proc->b_bloquear);
gui->add(proc->b_desbloquear);
auto rend1 = proc->l_nombre-> getRenderer();
rend1->setBackgroundColor(sf::Color(210, 210, 210));
gui->add(proc->l_nombre);
auto rend2 = proc->l_estado-> getRenderer();
rend2->setBackgroundColor(sf::Color(210, 210, 210));
gui->add(proc->l_estado);
auto rend3 = proc->l_tiempo-> getRenderer();
rend3->setBackgroundColor(sf::Color(210, 210, 210));
gui->add(proc->l_tiempo);
cout<<politica<<endl;
politicas.at(politica)->add_proceso(proc);
procesos.push_back(proc);
auto block = [&](int pos){
//proc->bloqueado = true;
//procesos.at(pos)->estado = 1;
};
auto unblock = [&](int pos){
//procesos.at(pos)->bloqueado = false;
};
int pos = procesos.size() - 1;
proc->b_bloquear->connect("pressed", block, pos);
proc->b_desbloquear->connect("pressed", unblock, pos);
};
crearProc->connect("pressed", createProccess, prioridad, nombreP, tiempoServ);
}
void VentanaPrincipal::post_inicio(){
politicas = {new PoliticaFIFO(reloj), new PoliticaPRIO(reloj), new PoliticaSPF(reloj), new PoliticaRSPF(reloj), new PoliticaRoundRobin(reloj), new PoliticaRoundRobinPrio(reloj)};
// politicas = {new PoliticaFIFO(reloj)};
politicas.at(0)->b_actualizar = true;
politicas.at(1)->b_actualizar = true;
politicas.at(2)->b_actualizar = true;
politicas.at(3)->b_actualizar = true;
politicas.at(4)->b_actualizar = true;
politicas.at(5)->b_actualizar = true;
}
void VentanaPrincipal::actualizar(){
//cout<<"pol: "<<politica<<endl;
reloj->actualizar();
politica=choose_politica->getSelectedItemIndex();
actualizar_politicas();
actualizarLabelsProcesos();
posicionarProcesos();
}
void VentanaPrincipal::actualizar_politicas(){
for(auto pol : politicas){
pol->actualizar();
}
}
void VentanaPrincipal::actualizarLabelsProcesos(){
for(int i = 0; i < procesos.size(); i++){
procesos.at(i)->l_tiempo->setText(to_string(procesos.at(i)->tiempo_actual));
procesos.at(i)->l_estado->setText(estados[procesos.at(i)->estado]);
procesos.at(i)->l_estado->setTextColor(colores.at(procesos.at(i)->estado));
}
}
void VentanaPrincipal::posicionarProcesos(){
for(int i = 0; i < procesos.size(); i++){
procesos.at(i)->l_nombre->setPosition(pos_x + 50, pos_y + i * 50);
procesos.at(i)->l_estado->setPosition(pos_x + 220, pos_y + i * 50);
procesos.at(i)->l_tiempo->setPosition(pos_x + 350, pos_y + i * 50);
procesos.at(i)->b_bloquear->setPosition(pos_x + 480, pos_y + i * 50);
procesos.at(i)->b_desbloquear->setPosition(pos_x + 610, pos_y + i * 50);
}
}
#endif
|
714ff83569005c6f2509f723c80b306a0b96f4d0 | 374d23f6a603046a5299596fc59171dc1c6b09b4 | /tensores/FltkImageViewer/fltkRGBImage2DViewerGUI.h | 46be05a26a7179d3910cba02b13b2bd31125a9f9 | [] | no_license | mounyeh/tensorespablo | aa9b403ceef82094872e50f7ddd0cdd89b6b7421 | f045a5c1e1decf7302de17f4448abbd284b3c2de | refs/heads/master | 2021-01-10T06:09:53.357175 | 2010-09-19T22:57:16 | 2010-09-19T22:57:16 | 51,831,049 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 892 | h | fltkRGBImage2DViewerGUI.h | // generated by Fast Light User Interface Designer (fluid) version 1.0107
#ifndef fltkRGBImage2DViewerGUI_h
#define fltkRGBImage2DViewerGUI_h
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <fltkRGBImage2DViewerWindow.h>
#include <FL/Fl_Value_Slider.H>
class fltkRGBImage2DViewerGUI {
public:
fltkRGBImage2DViewerGUI();
Fl_Double_Window *externalWindow;
fltk::RGBImage2DViewerWindow *imageViewer;
Fl_Double_Window *intensityWindow;
private:
void cb_Min_i(Fl_Value_Slider*, void*);
static void cb_Min(Fl_Value_Slider*, void*);
void cb_Max_i(Fl_Value_Slider*, void*);
static void cb_Max(Fl_Value_Slider*, void*);
public:
virtual ~fltkRGBImage2DViewerGUI();
void SetLabel(const char *label);
void Show(void);
void Hide(void);
void Redraw(void);
virtual void SetMin(double val);
virtual void SetMax(double val);
virtual void Update(void);
};
#endif
|
e3e394dfb2dab1057e14aafb86104a37c005cb9d | c9e2d2523f0fe58d592f0c975a80de58be6fd5c3 | /src/storm/events/cInput.h | 5759c43bc1e6c7e56b47518be59d53a22d6c2daf | [
"MIT"
] | permissive | master312/quantum-kidney | 85e00d0f30402a36815fba09211dec9612afebc6 | 042e97e9a9998be4fc062eb703c51141ea7bd2e4 | refs/heads/master | 2021-01-23T11:33:53.932861 | 2015-08-27T00:27:41 | 2015-08-27T00:27:41 | 40,671,890 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,348 | h | cInput.h | //Created by Petar Ostojic
//Tue Feb 24 00:55:00 2015
#include "../defines.h"
#include "../graphics/cGraphics.h"
#include "eKeys.h"
#include <map>
#include <vector>
#ifndef CINPUT_H
#define CINPUT_H
//DONE: Window resize event
//DONE: Dont ignore arrows, functions, backspace, escape, shift tab, and ctrl, keys while text input is enabled
//TODO: Key repeat interval
class cInput{
public:
//Map of keys
std::map<int, char> keys;
//Mouse coordinates
int mouseX;
int mouseY;
//True if mouse button is down; MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT or MOUSE_BUTTON_MIDDLE
bool mouseButton[3];
int mouseScroll;
//True, if quit signal is received
bool toQuit;
//True if manager is checking for text input, and not key events
bool textScan;
//This string contains text input from user
std::string strText;
//Pointer to graphics class
cGraphics *graphics;
//Was there new event, in this logic loop
bool isNew;
cInput(){
mouseX = mouseY = 0;
mouseButton[0] = mouseButton[1] = mouseButton[2] = false;
mouseScroll = 0;
graphics = NULL;
toQuit = false;
textScan = false;
strText = "";
isNew = false;
}
virtual ~cInput(){}
//Handle key events
//While returns true, there is new event. If returns false, there is no anymore events
virtual bool Update() { return false; }
//Sets pointer to graphics manager
//If graphics manager is not set, window resize event will be ignoredั
void SetGraphics(cGraphics *g){ graphics = g; }
//Return true if key is pressed
bool IsKeyDown(eKey key) { return keys[key] == 'd'; }
//Return true if key is not pressed
bool IsKeyUp(eKey key) { return keys[key] != 'd'; }
//Return mouse coordinates
int GetMouseX() { return mouseX; }
int GetMouseY() { return mouseY; }
bool IsMouseLeft() { return mouseButton[0]; }
bool IsMouseRight() { return mouseButton[1]; }
bool IsMouseMiddle() { return mouseButton[2]; }
int GetMouseScroll() { int tmp = mouseScroll; mouseScroll = 0; return tmp; }
//Reset all buttons to default state
void ResetAll() { keys.clear(); }
//Start scanning for text input
void StartTextInput() { textScan = true; ResetAll(); strText = ""; }
//Get text inputed
std::string GetText() { return strText; }
//Stop text input
void StopTextInput() { textScan = false; }
//Return true if program should be closed
bool ToQuit() { return toQuit; }
};
#endif |
2c7635a6d019c3a82643d05a465ba75e6295eb7d | ed182c04b6b91a978d2fbc3c99ebd7bed525390e | /GUI/ui_mainwindow.h | d9f7f5c30ca7188060d6aefac7ef56b6627b8739 | [] | no_license | matheusmlopess-zz/Expenditure-Weights-Calculator | e281725ada4fd35b36296c3a51a471b6fe4df5ba | 6a1ea1ebd0b11d36a02adff1130557d930375007 | refs/heads/master | 2021-06-17T22:16:13.727611 | 2017-06-19T19:34:52 | 2017-06-19T19:34:52 | 69,246,292 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 36,864 | h | ui_mainwindow.h | /********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created by: Qt User Interface Compiler version 5.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QDate>
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDateEdit>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLCDNumber>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QSlider>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QTextEdit>
#include <QtWidgets/QWidget>
#include <piechart.h>
#include "qcustomplot.h"
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QAction *actionSalvar;
QAction *actionExportar;
QWidget *centralWidget;
QGroupBox *groupBox;
QPushButton *pushButton;
QPushButton *pushButton_3;
QPushButton *pushButton_4;
QPushButton *pushButton_13;
QGroupBox *groupBox_2;
QPushButton *pushButton_9;
QPushButton *pushButton_10;
QPushButton *pushButton_12;
QTabWidget *tabWidget;
QWidget *tab;
QTextBrowser *textBrowser_2;
QWidget *tab_2;
QSlider *horizontalSlider;
QLCDNumber *lcdNumber;
QTextBrowser *textBrowser_5;
QDateEdit *dateEdit;
QRadioButton *radioButton_2;
QTextBrowser *textBrowser_6;
QTextEdit *salJan;
QTextEdit *salFev;
QTextEdit *salNov;
QTextEdit *salDez;
QTextEdit *salSet;
QTextEdit *salOut;
QTextEdit *salJul;
QTextEdit *salAgo;
QTextEdit *salMai;
QTextEdit *salJun;
QTextEdit *salMar;
QTextEdit *salAbr;
QTextEdit *textEdit_14;
QTextEdit *textEdit_15;
QTextEdit *textEdit_16;
QTextEdit *textEdit_17;
QTextEdit *textEdit_18;
QTextEdit *textEdit_19;
QTextEdit *textEdit_20;
QTextEdit *textEdit_21;
QTextEdit *textEdit_22;
QTextEdit *textEdit_23;
QTextEdit *textEdit_24;
QTextEdit *textEdit_25;
QCustomPlot *grafico;
QPushButton *pushButton_5;
QRadioButton *radioButton_3;
QWidget *tab_3;
pieChart *widget_2;
QTextBrowser *textBrowser;
QListWidget *listWidget;
QPushButton *pushButton_11;
QMenuBar *menuBar;
QMenu *menuArqivo;
QMenu *menuEditar;
QMenu *menuAbout;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QStringLiteral("MainWindow"));
MainWindow->resize(880, 371);
actionSalvar = new QAction(MainWindow);
actionSalvar->setObjectName(QStringLiteral("actionSalvar"));
actionExportar = new QAction(MainWindow);
actionExportar->setObjectName(QStringLiteral("actionExportar"));
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
groupBox = new QGroupBox(centralWidget);
groupBox->setObjectName(QStringLiteral("groupBox"));
groupBox->setGeometry(QRect(10, 20, 121, 161));
pushButton = new QPushButton(groupBox);
pushButton->setObjectName(QStringLiteral("pushButton"));
pushButton->setGeometry(QRect(10, 20, 101, 31));
pushButton_3 = new QPushButton(groupBox);
pushButton_3->setObjectName(QStringLiteral("pushButton_3"));
pushButton_3->setGeometry(QRect(10, 50, 101, 21));
pushButton_4 = new QPushButton(groupBox);
pushButton_4->setObjectName(QStringLiteral("pushButton_4"));
pushButton_4->setGeometry(QRect(10, 70, 101, 21));
pushButton_13 = new QPushButton(groupBox);
pushButton_13->setObjectName(QStringLiteral("pushButton_13"));
pushButton_13->setGeometry(QRect(10, 120, 101, 21));
groupBox_2 = new QGroupBox(centralWidget);
groupBox_2->setObjectName(QStringLiteral("groupBox_2"));
groupBox_2->setGeometry(QRect(10, 180, 121, 141));
pushButton_9 = new QPushButton(groupBox_2);
pushButton_9->setObjectName(QStringLiteral("pushButton_9"));
pushButton_9->setGeometry(QRect(10, 20, 101, 21));
pushButton_10 = new QPushButton(groupBox_2);
pushButton_10->setObjectName(QStringLiteral("pushButton_10"));
pushButton_10->setGeometry(QRect(10, 50, 101, 21));
pushButton_12 = new QPushButton(groupBox_2);
pushButton_12->setObjectName(QStringLiteral("pushButton_12"));
pushButton_12->setGeometry(QRect(10, 80, 101, 21));
tabWidget = new QTabWidget(centralWidget);
tabWidget->setObjectName(QStringLiteral("tabWidget"));
tabWidget->setGeometry(QRect(350, 10, 521, 311));
tabWidget->setStyleSheet(QStringLiteral(""));
tab = new QWidget();
tab->setObjectName(QStringLiteral("tab"));
textBrowser_2 = new QTextBrowser(tab);
textBrowser_2->setObjectName(QStringLiteral("textBrowser_2"));
textBrowser_2->setEnabled(true);
textBrowser_2->setGeometry(QRect(0, 10, 361, 251));
textBrowser_2->setMouseTracking(false);
textBrowser_2->setAutoFillBackground(true);
textBrowser_2->setStyleSheet(QStringLiteral("background-color: rgb(225, 225, 225);"));
textBrowser_2->setReadOnly(true);
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
tab_2->setObjectName(QStringLiteral("tab_2"));
horizontalSlider = new QSlider(tab_2);
horizontalSlider->setObjectName(QStringLiteral("horizontalSlider"));
horizontalSlider->setGeometry(QRect(120, 0, 231, 31));
horizontalSlider->setSizeIncrement(QSize(1, 0));
horizontalSlider->setMinimum(1);
horizontalSlider->setMaximum(12);
horizontalSlider->setPageStep(1);
horizontalSlider->setOrientation(Qt::Horizontal);
lcdNumber = new QLCDNumber(tab_2);
lcdNumber->setObjectName(QStringLiteral("lcdNumber"));
lcdNumber->setGeometry(QRect(360, 0, 31, 31));
QFont font;
font.setBold(true);
font.setWeight(75);
lcdNumber->setFont(font);
lcdNumber->setLayoutDirection(Qt::LeftToRight);
lcdNumber->setAutoFillBackground(false);
lcdNumber->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 255)"));
lcdNumber->setDigitCount(2);
lcdNumber->setSegmentStyle(QLCDNumber::Flat);
lcdNumber->setProperty("intValue", QVariant(1));
textBrowser_5 = new QTextBrowser(tab_2);
textBrowser_5->setObjectName(QStringLiteral("textBrowser_5"));
textBrowser_5->setEnabled(false);
textBrowser_5->setGeometry(QRect(70, 10, 41, 21));
QFont font1;
font1.setBold(true);
font1.setWeight(75);
font1.setKerning(true);
textBrowser_5->setFont(font1);
textBrowser_5->setAutoFillBackground(false);
textBrowser_5->setFrameShape(QFrame::NoFrame);
textBrowser_5->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
dateEdit = new QDateEdit(tab_2);
dateEdit->setObjectName(QStringLiteral("dateEdit"));
dateEdit->setGeometry(QRect(0, 0, 61, 31));
dateEdit->setDate(QDate(2016, 1, 1));
radioButton_2 = new QRadioButton(tab_2);
radioButton_2->setObjectName(QStringLiteral("radioButton_2"));
radioButton_2->setGeometry(QRect(270, 40, 101, 17));
textBrowser_6 = new QTextBrowser(tab_2);
textBrowser_6->setObjectName(QStringLiteral("textBrowser_6"));
textBrowser_6->setEnabled(false);
textBrowser_6->setGeometry(QRect(0, 40, 81, 31));
textBrowser_6->setFont(font1);
textBrowser_6->setAutoFillBackground(false);
textBrowser_6->setStyleSheet(QStringLiteral("background-color:rgb(252, 252, 252)"));
textBrowser_6->setFrameShape(QFrame::NoFrame);
textBrowser_6->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJan = new QTextEdit(tab_2);
salJan->setObjectName(QStringLiteral("salJan"));
salJan->setGeometry(QRect(40, 74, 41, 16));
salJan->setContextMenuPolicy(Qt::DefaultContextMenu);
salJan->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salJan->setFrameShape(QFrame::NoFrame);
salJan->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJan->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salFev = new QTextEdit(tab_2);
salFev->setObjectName(QStringLiteral("salFev"));
salFev->setGeometry(QRect(40, 90, 41, 16));
salFev->setContextMenuPolicy(Qt::DefaultContextMenu);
salFev->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salFev->setFrameShape(QFrame::NoFrame);
salFev->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salFev->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salNov = new QTextEdit(tab_2);
salNov->setObjectName(QStringLiteral("salNov"));
salNov->setGeometry(QRect(40, 224, 41, 16));
salNov->setContextMenuPolicy(Qt::DefaultContextMenu);
salNov->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salNov->setFrameShape(QFrame::NoFrame);
salNov->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salNov->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salDez = new QTextEdit(tab_2);
salDez->setObjectName(QStringLiteral("salDez"));
salDez->setGeometry(QRect(40, 240, 41, 16));
salDez->setContextMenuPolicy(Qt::DefaultContextMenu);
salDez->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salDez->setFrameShape(QFrame::NoFrame);
salDez->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salDez->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salSet = new QTextEdit(tab_2);
salSet->setObjectName(QStringLiteral("salSet"));
salSet->setGeometry(QRect(40, 194, 41, 16));
salSet->setContextMenuPolicy(Qt::DefaultContextMenu);
salSet->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salSet->setFrameShape(QFrame::NoFrame);
salSet->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salSet->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salOut = new QTextEdit(tab_2);
salOut->setObjectName(QStringLiteral("salOut"));
salOut->setGeometry(QRect(40, 210, 41, 16));
salOut->setContextMenuPolicy(Qt::DefaultContextMenu);
salOut->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salOut->setFrameShape(QFrame::NoFrame);
salOut->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salOut->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJul = new QTextEdit(tab_2);
salJul->setObjectName(QStringLiteral("salJul"));
salJul->setGeometry(QRect(40, 164, 41, 16));
salJul->setContextMenuPolicy(Qt::DefaultContextMenu);
salJul->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salJul->setFrameShape(QFrame::NoFrame);
salJul->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJul->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salAgo = new QTextEdit(tab_2);
salAgo->setObjectName(QStringLiteral("salAgo"));
salAgo->setGeometry(QRect(40, 180, 41, 16));
salAgo->setContextMenuPolicy(Qt::DefaultContextMenu);
salAgo->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salAgo->setFrameShape(QFrame::NoFrame);
salAgo->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salAgo->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salMai = new QTextEdit(tab_2);
salMai->setObjectName(QStringLiteral("salMai"));
salMai->setGeometry(QRect(40, 134, 41, 16));
salMai->setContextMenuPolicy(Qt::DefaultContextMenu);
salMai->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salMai->setFrameShape(QFrame::NoFrame);
salMai->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salMai->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJun = new QTextEdit(tab_2);
salJun->setObjectName(QStringLiteral("salJun"));
salJun->setGeometry(QRect(40, 150, 41, 16));
salJun->setContextMenuPolicy(Qt::DefaultContextMenu);
salJun->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salJun->setFrameShape(QFrame::NoFrame);
salJun->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salJun->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salMar = new QTextEdit(tab_2);
salMar->setObjectName(QStringLiteral("salMar"));
salMar->setGeometry(QRect(40, 104, 41, 16));
salMar->setContextMenuPolicy(Qt::DefaultContextMenu);
salMar->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salMar->setFrameShape(QFrame::NoFrame);
salMar->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salMar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salAbr = new QTextEdit(tab_2);
salAbr->setObjectName(QStringLiteral("salAbr"));
salAbr->setGeometry(QRect(40, 120, 41, 16));
salAbr->setContextMenuPolicy(Qt::DefaultContextMenu);
salAbr->setStyleSheet(QStringLiteral("background-color:rgb(255, 255, 208)"));
salAbr->setFrameShape(QFrame::NoFrame);
salAbr->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
salAbr->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_14 = new QTextEdit(tab_2);
textEdit_14->setObjectName(QStringLiteral("textEdit_14"));
textEdit_14->setEnabled(false);
textEdit_14->setGeometry(QRect(0, 194, 41, 16));
textEdit_14->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_14->setStyleSheet(QStringLiteral(""));
textEdit_14->setFrameShape(QFrame::NoFrame);
textEdit_14->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_14->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_15 = new QTextEdit(tab_2);
textEdit_15->setObjectName(QStringLiteral("textEdit_15"));
textEdit_15->setEnabled(false);
textEdit_15->setGeometry(QRect(0, 210, 41, 16));
textEdit_15->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_15->setStyleSheet(QStringLiteral(""));
textEdit_15->setFrameShape(QFrame::NoFrame);
textEdit_15->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_15->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_16 = new QTextEdit(tab_2);
textEdit_16->setObjectName(QStringLiteral("textEdit_16"));
textEdit_16->setEnabled(false);
textEdit_16->setGeometry(QRect(0, 134, 41, 16));
textEdit_16->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_16->setStyleSheet(QStringLiteral(""));
textEdit_16->setFrameShape(QFrame::NoFrame);
textEdit_16->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_16->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_17 = new QTextEdit(tab_2);
textEdit_17->setObjectName(QStringLiteral("textEdit_17"));
textEdit_17->setEnabled(false);
textEdit_17->setGeometry(QRect(0, 74, 41, 16));
textEdit_17->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_17->setStyleSheet(QStringLiteral(""));
textEdit_17->setFrameShape(QFrame::NoFrame);
textEdit_17->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_17->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_18 = new QTextEdit(tab_2);
textEdit_18->setObjectName(QStringLiteral("textEdit_18"));
textEdit_18->setEnabled(false);
textEdit_18->setGeometry(QRect(0, 120, 41, 16));
textEdit_18->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_18->setStyleSheet(QStringLiteral(""));
textEdit_18->setFrameShape(QFrame::NoFrame);
textEdit_18->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_18->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_19 = new QTextEdit(tab_2);
textEdit_19->setObjectName(QStringLiteral("textEdit_19"));
textEdit_19->setEnabled(false);
textEdit_19->setGeometry(QRect(0, 164, 41, 16));
textEdit_19->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_19->setStyleSheet(QStringLiteral(""));
textEdit_19->setFrameShape(QFrame::NoFrame);
textEdit_19->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_19->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_20 = new QTextEdit(tab_2);
textEdit_20->setObjectName(QStringLiteral("textEdit_20"));
textEdit_20->setEnabled(false);
textEdit_20->setGeometry(QRect(0, 180, 41, 16));
textEdit_20->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_20->setStyleSheet(QStringLiteral(""));
textEdit_20->setFrameShape(QFrame::NoFrame);
textEdit_20->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_20->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_21 = new QTextEdit(tab_2);
textEdit_21->setObjectName(QStringLiteral("textEdit_21"));
textEdit_21->setEnabled(false);
textEdit_21->setGeometry(QRect(0, 240, 41, 16));
textEdit_21->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_21->setStyleSheet(QStringLiteral(""));
textEdit_21->setFrameShape(QFrame::NoFrame);
textEdit_21->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_21->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_22 = new QTextEdit(tab_2);
textEdit_22->setObjectName(QStringLiteral("textEdit_22"));
textEdit_22->setEnabled(false);
textEdit_22->setGeometry(QRect(0, 90, 41, 16));
textEdit_22->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_22->setStyleSheet(QStringLiteral(""));
textEdit_22->setFrameShape(QFrame::NoFrame);
textEdit_22->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_22->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_23 = new QTextEdit(tab_2);
textEdit_23->setObjectName(QStringLiteral("textEdit_23"));
textEdit_23->setEnabled(false);
textEdit_23->setGeometry(QRect(0, 150, 41, 16));
textEdit_23->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_23->setStyleSheet(QStringLiteral(""));
textEdit_23->setFrameShape(QFrame::NoFrame);
textEdit_23->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_23->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_24 = new QTextEdit(tab_2);
textEdit_24->setObjectName(QStringLiteral("textEdit_24"));
textEdit_24->setEnabled(false);
textEdit_24->setGeometry(QRect(0, 104, 41, 16));
textEdit_24->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_24->setStyleSheet(QStringLiteral(""));
textEdit_24->setFrameShape(QFrame::NoFrame);
textEdit_24->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_24->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_25 = new QTextEdit(tab_2);
textEdit_25->setObjectName(QStringLiteral("textEdit_25"));
textEdit_25->setEnabled(false);
textEdit_25->setGeometry(QRect(0, 224, 41, 16));
textEdit_25->setContextMenuPolicy(Qt::DefaultContextMenu);
textEdit_25->setStyleSheet(QStringLiteral(""));
textEdit_25->setFrameShape(QFrame::NoFrame);
textEdit_25->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
textEdit_25->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
grafico = new QCustomPlot(tab_2);
grafico->setObjectName(QStringLiteral("grafico"));
grafico->setEnabled(true);
grafico->setGeometry(QRect(80, 50, 431, 231));
pushButton_5 = new QPushButton(tab_2);
pushButton_5->setObjectName(QStringLiteral("pushButton_5"));
pushButton_5->setGeometry(QRect(400, 0, 111, 31));
radioButton_3 = new QRadioButton(tab_2);
radioButton_3->setObjectName(QStringLiteral("radioButton_3"));
radioButton_3->setGeometry(QRect(150, 40, 101, 20));
tabWidget->addTab(tab_2, QString());
grafico->raise();
textBrowser_6->raise();
textBrowser_5->raise();
horizontalSlider->raise();
lcdNumber->raise();
dateEdit->raise();
radioButton_2->raise();
salJan->raise();
salFev->raise();
salNov->raise();
salDez->raise();
salSet->raise();
salOut->raise();
salJul->raise();
salAgo->raise();
salMai->raise();
salJun->raise();
salMar->raise();
salAbr->raise();
textEdit_14->raise();
textEdit_15->raise();
textEdit_16->raise();
textEdit_17->raise();
textEdit_18->raise();
textEdit_19->raise();
textEdit_20->raise();
textEdit_21->raise();
textEdit_22->raise();
textEdit_23->raise();
textEdit_24->raise();
textEdit_25->raise();
pushButton_5->raise();
radioButton_3->raise();
tab_3 = new QWidget();
tab_3->setObjectName(QStringLiteral("tab_3"));
widget_2 = new pieChart(tab_3);
widget_2->setObjectName(QStringLiteral("widget_2"));
widget_2->setGeometry(QRect(10, 10, 351, 281));
tabWidget->addTab(tab_3, QString());
textBrowser = new QTextBrowser(centralWidget);
textBrowser->setObjectName(QStringLiteral("textBrowser"));
textBrowser->setGeometry(QRect(140, 140, 205, 181));
textBrowser->setStyleSheet(QStringLiteral("background-color: rgb(225, 225, 225);"));
listWidget = new QListWidget(centralWidget);
listWidget->setObjectName(QStringLiteral("listWidget"));
listWidget->setGeometry(QRect(140, 30, 205, 104));
pushButton_11 = new QPushButton(centralWidget);
pushButton_11->setObjectName(QStringLiteral("pushButton_11"));
pushButton_11->setEnabled(true);
pushButton_11->setGeometry(QRect(710, 0, 151, 24));
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(8);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(pushButton_11->sizePolicy().hasHeightForWidth());
pushButton_11->setSizePolicy(sizePolicy);
pushButton_11->setMaximumSize(QSize(16777215, 16777215));
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 880, 21));
menuArqivo = new QMenu(menuBar);
menuArqivo->setObjectName(QStringLiteral("menuArqivo"));
menuEditar = new QMenu(menuBar);
menuEditar->setObjectName(QStringLiteral("menuEditar"));
menuAbout = new QMenu(menuBar);
menuAbout->setObjectName(QStringLiteral("menuAbout"));
MainWindow->setMenuBar(menuBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QStringLiteral("statusBar"));
MainWindow->setStatusBar(statusBar);
menuBar->addAction(menuArqivo->menuAction());
menuBar->addAction(menuEditar->menuAction());
menuBar->addAction(menuAbout->menuAction());
menuArqivo->addAction(actionExportar);
retranslateUi(MainWindow);
tabWidget->setCurrentIndex(2);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
actionSalvar->setText(QApplication::translate("MainWindow", "Salvar", 0));
actionExportar->setText(QApplication::translate("MainWindow", "Exportar", 0));
groupBox->setTitle(QApplication::translate("MainWindow", "Menu Inicial", 0));
pushButton->setText(QApplication::translate("MainWindow", "ADD entrada", 0));
pushButton_3->setText(QApplication::translate("MainWindow", "Alterar entrada", 0));
pushButton_4->setText(QApplication::translate("MainWindow", "Excluir entrada", 0));
pushButton_13->setText(QApplication::translate("MainWindow", "Help!", 0));
groupBox_2->setTitle(QApplication::translate("MainWindow", "Menu principal ", 0));
pushButton_9->setText(QApplication::translate("MainWindow", "ADD despesas", 0));
pushButton_10->setText(QApplication::translate("MainWindow", "Analise Financeira", 0));
pushButton_12->setText(QApplication::translate("MainWindow", "Listar Por Familia", 0));
textBrowser_2->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("MainWindow", "Pag. 1", 0));
textBrowser_5->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Sans Serif'; font-size:10pt; font-weight:400; color:#aa0000;\">M\303\252s :</span></p></body></html>", 0));
dateEdit->setDisplayFormat(QApplication::translate("MainWindow", "yyyy", 0));
radioButton_2->setText(QApplication::translate("MainWindow", "Analise Por Ano", 0));
textBrowser_6->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; color:#000000;\">Salario<br />Mes | R$</span></p></body></html>", 0));
salJan->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
textEdit_14->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Set</p></body></html>", 0));
textEdit_15->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Out</p></body></html>", 0));
textEdit_16->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Mai</p></body></html>", 0));
textEdit_17->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Jan</p></body></html>", 0));
textEdit_18->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Abr</p></body></html>", 0));
textEdit_19->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Jul</p></body></html>", 0));
textEdit_20->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Ago</p></body></html>", 0));
textEdit_21->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Dez</p></body></html>", 0));
textEdit_22->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Fev</p></body></html>", 0));
textEdit_23->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Jun</p></body></html>", 0));
textEdit_24->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Mar</p></body></html>", 0));
textEdit_25->setHtml(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Nov</p></body></html>", 0));
pushButton_5->setText(QApplication::translate("MainWindow", "Comparar Salario", 0));
radioButton_3->setText(QApplication::translate("MainWindow", "Analise Por M\303\252s", 0));
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("MainWindow", "Pag. 2", 0));
tabWidget->setTabText(tabWidget->indexOf(tab_3), QApplication::translate("MainWindow", "Pag. 3", 0));
pushButton_11->setText(QApplication::translate("MainWindow", "Exportar Resultados", 0));
menuArqivo->setTitle(QApplication::translate("MainWindow", "Arquivo", 0));
menuEditar->setTitle(QApplication::translate("MainWindow", "Editar", 0));
menuAbout->setTitle(QApplication::translate("MainWindow", "About", 0));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H
|
cc2e3efe0337881c7c178def932b90c9b5bfaaa7 | 783279f7d64424fd4535a819cc19be335a3ce196 | /atcoder/con/B.cpp | d335ab2d27c6b292b05716d67873ef4f0290d89b | [] | no_license | rish-singhal/CompetitiveProgramming | 2bfa88e086c084c9d68624f176ee3cbcb20b8577 | 5ed290ea7e28b81e38679f8c0e99c9c3f80da231 | refs/heads/master | 2023-07-02T18:59:11.817298 | 2021-08-10T04:15:52 | 2021-08-10T04:15:52 | 248,025,974 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 567 | cpp | B.cpp | #include <bits/stdc++.h>
using namespace std;
#define LL long long
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s; cin>>s;
LL n = s.size();
LL l = 0, r = ((n-1)/2) - 1;
int b = 1;
while(l<r){
if(s[l]!=s[r]){
b =0;
break;
}
l++, r--;
}
l = ((n+3)/2) -1, r = (n) - 1;
while(l<r){
if(s[l]!=s[r]){
b =0;
break;
}
l++, r--;
}
l = 0, r = (n) - 1;
while(l<r){
if(s[l]!=s[r]){
b =0;
break;
}
l++, r--;
}
cout<<(b?"Yes":"No")<<endl;
return 0;
}
|
4ee0505f27f9fe3ab71468e629741bbe78e763ba | 3eb4d2f547185dd0a97153206c5516ce274186aa | /categories_dlg.h | d5172d4fe8aa9e6ddead250abc789d017eea997c | [] | no_license | joaodeus/yuc | 5b98ea4a39be86693e3634145803cfbf305abaab | 5dda3d9339f851d94f200772a9c66bb7cbfb7b27 | refs/heads/master | 2021-01-10T20:26:09.118015 | 2012-04-10T22:48:20 | 2012-04-10T22:48:20 | 32,681,481 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 594 | h | categories_dlg.h | #ifndef CATEGORIES_DLG_H
#define CATEGORIES_DLG_H
#include <QDialog>
#include <QModelIndex>
#include "categories_units/categories_units.h"
namespace Ui {
class categories_dlg;
}
class categories_dlg : public QDialog
{
Q_OBJECT
public:
explicit categories_dlg(QWidget *parent = 0);
~categories_dlg();
QList<Categories_units> *m_categoriesList_ptr;
int index_selected;
void showEvent(QShowEvent * event);
private slots:
void on_listWidget_categories_clicked(const QModelIndex &index);
private:
Ui::categories_dlg *ui;
};
#endif // CATEGORIES_DLG_H
|
94816e0787744cd4e11aeb9d7ee94976bd1335e9 | fa3ec96179a2929a1b2ab24839750a5f8e05b4dc | /CP/Codeforces/Oct2020/797_OddSum.cpp | 01bdaf0ce5941a8739704c972fec5ccd8179007c | [] | no_license | sankalp1999/Competitive-Programming | d0b92c3f87b428867ced747accbeca4aba625cfb | 246bb46e5b853c5099e480ea3b66afcce761babb | refs/heads/master | 2023-08-14T12:26:33.153259 | 2021-10-15T06:16:41 | 2021-10-15T06:16:41 | 201,873,733 | 13 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 1,227 | cpp | 797_OddSum.cpp | #include<bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
#define endl '\n'
#define gcd __gcd
const double PI = 3.141592653589793238460;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
lli sum = 0;
// Take all the positive numbers.
// Take the min pos or min neg number
// to get odd sum if already not.
int min_odd= INT_MAX;
int min_odd_pos = INT_MAX;
// Note only odd numbers can change parity
for (int i = 0; i < v.size(); i++)
{
if(v[i] > 0)
{
sum += v[i];
if(v[i] & 1)
{
min_odd_pos = min(min_odd_pos, v[i]);
}
}
else
{
if(v[i] & 1)
min_odd = min(abs(v[i]), min_odd);
}
}
if(sum % 2 == 1)
{
cout << sum << endl;
return 0;
}
cout << sum - (min(min_odd, min_odd_pos)) << endl;
} |
c64e7549b2c4bb34c24050af64a39ad2537e227a | 395c2efeba8ec9db03eb5cfe162dc8352b95d7e3 | /lab6/lab6/OperationSubtract.cpp | 2a903647a54cf58045e04118fc08d7535837d469 | [] | no_license | jonazeiselt/da378a | 48ce6e68389f9f3481ad9b0f1fcef1468bee13b3 | 13189644b75a012e17b64338d608c0a4d140d944 | refs/heads/master | 2020-03-28T19:34:21.932455 | 2018-09-16T11:20:30 | 2018-09-16T11:20:30 | 148,988,137 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 160 | cpp | OperationSubtract.cpp | #include "stdafx.h"
#include "OperationSubtract.h"
int OperationSubtract::compute(int operandOne, int operandTwo) const
{
return (operandOne - operandTwo);
}
|
c28d287b6d1c8527bcc3b9fff173da6a0cd95910 | 9e18e0527e80c48159c015bab032a57dca4c4224 | /src/hud/TooltipManager.cpp | 85c4054ff9ba3ace0855f01ecf0487c8739447cc | [] | no_license | Smeky/Tower-Defense-Game | 4fa4675580ab12d1d9b81a7ed1167e77edd06046 | afcaaaf033412be7cb0b5c2d2ce5cc012e2f8e79 | refs/heads/master | 2020-03-27T10:41:38.599359 | 2018-08-28T11:44:29 | 2018-08-28T11:44:29 | 146,438,803 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,953 | cpp | TooltipManager.cpp | #include "hud/TooltipManager.h"
#include "hud/TooltipWarning.h"
#include "hud/TooltipDescription.h"
#include "iostream"
using namespace std;
void TooltipManager::createTooltipDescription( Engine* game, Tower_data data, int x, int y ) {
m_description = new TooltipDescription( game, data, x, y );
}
void TooltipManager::createTooltipDescription( Engine* game, Enemy_data data, int x, int y ) {
m_description = new TooltipDescription( game, data, x, y );
}
void TooltipManager::createTooltipWarning( Engine* game, std::string text, int x, int y, bool timed ) {
setupTooltipWarning( game, text, x, y, TOOLTIP_NONE, timed );
}
void TooltipManager::createTooltipWarningLeft( Engine* game, std::string text, int x, int y, bool timed ) {
setupTooltipWarning( game, text, x, y, TOOLTIP_LEFT, timed );
}
void TooltipManager::createTooltipWarningRight( Engine* game, std::string text, int x, int y, bool timed ) {
setupTooltipWarning( game, text, x, y, TOOLTIP_RIGHT, timed );
}
void TooltipManager::createTooltipWarningUp( Engine* game, std::string text, int x, int y, bool timed ) {
setupTooltipWarning( game, text, x, y, TOOLTIP_UP, timed );
}
void TooltipManager::createTooltipWarningDown( Engine* game, std::string text, int x, int y, bool timed ) {
setupTooltipWarning( game, text, x, y, TOOLTIP_DOWN, timed );
}
void TooltipManager::close() {
if( m_warning != NULL ) {
delete m_warning;
m_warning = NULL;
}
if( m_description != NULL ) {
delete m_description;
m_description = NULL;
}
}
void TooltipManager::closeWarning() {
if( m_warning != NULL ) {
delete m_warning;
m_warning = NULL;
}
}
void TooltipManager::closeDescription() {
if( m_description != NULL ) {
delete m_description;
m_description = NULL;
}
}
void TooltipManager::update( Engine* game ) {
if( m_warning != NULL ) {
m_warning->update( game );
if( m_displayFade ) {
m_displayProgress += m_displayVelocity * game->getTimeDelta();
if( m_displayProgress >= m_displayTime ) {
m_warning->doFade();
}
if( m_warning->isFaded() ) {
delete m_warning;
m_warning = NULL;
}
}
}
}
void TooltipManager::render( Engine* game ) {
if( m_warning != NULL ) {
m_warning->render( game );
}
if( m_description != NULL ) {
m_description->render( game );
}
}
void TooltipManager::setupTooltipWarning( Engine* game, std::string text, int x, int y, int side, bool timed ) {
m_warning = new TooltipWarning( text, { x, y, game->getTextureW( text ) + 40, game->getTextureH( text ) + 15 }, side );
m_displayProgress = 0;
if( timed ) m_displayFade = true;
else m_displayFade = false;
}
|
b9f428889d1d69618cd73e99f1670812e0fecbe0 | 80e7fc9aa5ea6f4031386f4e1ae9eb5b9aae4346 | /include/particle_system/effect_compiler.hpp | c932518218fa9e4687e0faba4f3cd977b047138a | [] | no_license | UCAS-IIGROUP/graphics-engine | f556d9e176e40019243f13f1ef323ee8add812b9 | f0049f05c9911d5878894c33b40b6382f82ee471 | refs/heads/master | 2023-02-07T20:21:34.237981 | 2020-12-30T21:46:08 | 2020-12-30T21:46:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 538 | hpp | effect_compiler.hpp | #pragma once
#include <material_system/material_compiler.hpp>
namespace GraphicsEngine {
class Emitter;
class SpriteEmitter;
class MeshEmitter;
class EffectInstance;
class EffectCompiler : public MaterialCompiler {
private:
std::string getEmitterDefines(const Emitter& emitter) noexcept;
void compile(const SpriteEmitter& emitter);
void compile(const MeshEmitter& emitter);
public:
using ShaderCompiler::compile;
void compile(const EffectInstance& instance);
};
} |
4eaffcebd959c122f3bc2de4a4ab61b703291b7a | 10e407aae7222d381fdaee71d7edd9750c6d022e | /ransac_circle 2.cpp | b6c679d99b0a4c9fcb4d1d75c2ab75c5771e2778 | [] | no_license | kumar00786/Ransac_circle | 0b23e2cf916abd3338cbec573bb566cde44d9498 | 56451e4479a3c786f81e8553bce48b4f765efcca | refs/heads/master | 2020-03-23T02:45:35.841517 | 2018-07-15T01:28:25 | 2018-07-15T01:28:25 | 140,990,676 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 956 | cpp | ransac_circle 2.cpp |
/// Ransac for drawing the Circle
Circle::Circle(){
this-> radius = 0;
this-> center = mypoint2f();
this-> isSingular = true;
}
Circle::Circle(double radius, mypoint2f center){
this-> radius = radius;
this->center = center;
this-> isSingular = false;
}
Circle::Circle(mypoint2f a, mypoint2f b, mypoint2f c){
LinearEqu equ1 = LinearEqu(a,b);
LinearEqu equ2 = LinearEqu(b,c);
internsectionPoint intesecPoint = solveLinearEquation(equ1, equ2);
double radius = distance(a, intesecPoint.point);
this-> center = intesecPoint.point;
this->radius = radius;
this->isSingular = intesecPoint.doesIntersect;
}
bool Circle::getSingular(){
return this->isSingular;
}
mypoint2f Circle::getCenter(){
return this->center;
}
double Circle::getRadius(){
return this->radius;
}
std::ostream& operator <<(std::ostream& out, Circle& c){
out<<"radius:"<<c.radius<<" ";
out<<c.center;
return out;
}
|
b0a8493d4ad3355c3f8b81d279ba843a3a26999a | da3e8cddd0ec0e42cbd280a42d231553d96ced80 | /z-series/foundations/cpp/written/written_35.cpp | 02b74d077f5fd5eab30b68320f7d1854fcf6a58b | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | kwonus/Digital-AV | 1f0a61f3abbcaf446bcb6a2b5fd176dcfea5760a | 5bdbba76e82ff65ae5ceeef86dc11e160f16d67a | refs/heads/master | 2023-05-11T19:13:46.911206 | 2023-05-09T04:25:59 | 2023-05-09T04:25:59 | 144,848,042 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 123,980 | cpp | written_35.cpp | #include "written.h"
AVXWritten::AVXWrit const AVXWritten::written_35[] = {
{ 4853, 0, 0, 0, 22732, 0x8136, 0x00, 0xE0, 0x0D00, 0x00000094, 0x0136 },
{ 4853, 0, 0, 0, 22732, 0x0D83, 0x00, 0x00, 0x4010, 0x000001DC, 0x0D83 },
{ 2265, 0, 0, 0, 22732, 0x0C14, 0x00, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 2265, 0, 0, 0, 22732, 0xA03C, 0x00, 0x00, 0x4032, 0x00003A1C, 0x203C },
{ 5030, 0, 0, 0, 22732, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5030, 0, 0, 0, 22732, 0x1ABF, 0x00, 0x00, 0x4010, 0x000001DC, 0x1ABF },
{ 2372, 0, 0, 0, 22732, 0x006F, 0x00, 0x00, 0x0100, 0x00005884, 0x000D },
{ 2372, 0, 0, 0, 22732, 0x011F, 0xE0, 0x34, 0x0100, 0x00005AC9, 0x011F },
{ 3068, 0, 0, 0, 22733, 0x0003, 0x00, 0x20, 0x0000, 0x000002A8, 0x0003 },
{ 3068, 0, 0, 0, 22733, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 7768, 0, 0, 0, 22733, 0x00AE, 0x00, 0x00, 0xCC00, 0x40018E51, 0x00AE },
{ 7768, 0, 0, 0, 22733, 0x03B0, 0x00, 0x00, 0x0F00, 0x800006CA, 0x03B0 },
{ 7768, 0, 0, 0, 22733, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 7768, 0, 0, 0, 22733, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 7768, 0, 0, 0, 22733, 0x0066, 0x40, 0x01, 0x0100, 0x00005AC9, 0x0066 },
{ 8085, 0, 0, 0, 22733, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 8085, 0, 0, 0, 22733, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 8085, 0, 0, 0, 22733, 0x057D, 0x00, 0x00, 0x6100, 0x000059BD, 0x457D },
{ 8085, 0, 0, 0, 22733, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 8085, 0, 0, 0, 22733, 0x0311, 0x80, 0x04, 0x0100, 0x00005AC9, 0x0311 },
{ 0, 0, 0, 0, 22733, 0x028B, 0x02, 0x00, 0x0F00, 0x00000036, 0x028B },
{ 2199, 0, 0, 0, 22733, 0x0066, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0066 },
{ 2199, 0, 0, 0, 22733, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 0, 0, 0, 0, 22733, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 0, 0, 0, 0, 22733, 0x0519, 0x00, 0x00, 0x60C0, 0x01073FBC, 0x051F },
{ 0, 0, 0, 0, 22733, 0x001D, 0x02, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2555, 0, 0, 0, 22733, 0x2424, 0x40, 0x01, 0x4010, 0x000001DC, 0x2424 },
{ 3467, 0, 0, 0, 22733, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3467, 0, 0, 0, 22733, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 3467, 0, 0, 0, 22733, 0x057D, 0x00, 0x00, 0x6100, 0x000059BD, 0x457D },
{ 3467, 0, 0, 0, 22733, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 3467, 0, 0, 0, 22733, 0x04A7, 0x80, 0x34, 0x0100, 0x00005AC9, 0x04A7 },
{ 7200, 0, 0, 0, 22734, 0x8153, 0x00, 0x20, 0xC020, 0x40088E51, 0x0153 },
{ 7200, 0, 0, 0, 22734, 0x0256, 0x00, 0x00, 0x7100, 0x0000589D, 0x4256 },
{ 7200, 0, 0, 0, 22734, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 7200, 0, 0, 0, 22734, 0x04C1, 0x00, 0x00, 0x0100, 0x00005AC9, 0x44C1 },
{ 205, 0, 0, 0, 22734, 0x001A, 0x00, 0x00, 0x40C0, 0x01073F9C, 0x0002 },
{ 205, 0, 0, 0, 22734, 0x20A6, 0x40, 0x01, 0x4010, 0x000001DC, 0x20A6 },
{ 0, 0, 0, 0, 22734, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22734, 0x06D8, 0x00, 0x00, 0x0100, 0x00005AC2, 0x06D8 },
{ 0, 0, 0, 0, 22734, 0x001A, 0x02, 0x00, 0x40C0, 0x01073F9C, 0x0002 },
{ 5027, 0, 0, 0, 22734, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 5027, 0, 0, 0, 22734, 0x0D2B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0D2B },
{ 5999, 0, 0, 0, 22734, 0x26BC, 0xC0, 0x04, 0x4010, 0x000001DC, 0x26BC },
{ 7701, 0, 0, 0, 22734, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 7701, 0, 0, 0, 22734, 0x235D, 0x00, 0x00, 0x0100, 0x00005AC7, 0x0B34 },
{ 2555, 0, 0, 0, 22734, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2555, 0, 0, 0, 22734, 0x2424, 0x00, 0x00, 0x4010, 0x000001DC, 0x2424 },
{ 0, 0, 0, 0, 22734, 0x003E, 0x02, 0x00, 0x0100, 0x00005852, 0x000B },
{ 0, 0, 0, 0, 22734, 0x0D24, 0x00, 0x00, 0x00E0, 0x40080470, 0x0D24 },
{ 0, 0, 0, 0, 22734, 0x001A, 0x60, 0x02, 0x40C0, 0x01073F9C, 0x0002 },
{ 0, 0, 0, 0, 22734, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22734, 0x0B99, 0x00, 0x00, 0x3E00, 0x81018470, 0x0B99 },
{ 0, 0, 0, 0, 22734, 0x003E, 0x00, 0x00, 0x0100, 0x00005852, 0x000B },
{ 0, 0, 0, 0, 22734, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5375, 0, 0, 0, 22734, 0x0A45, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0A45 },
{ 5375, 0, 0, 0, 22734, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 7379, 0, 0, 0, 22734, 0x13AC, 0x00, 0x00, 0x4010, 0x000001DC, 0x13AC },
{ 4066, 0, 0, 0, 22734, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4066, 0, 0, 0, 22734, 0x2ABB, 0xE0, 0x34, 0x4010, 0x000001DC, 0x2ABB },
{ 8451, 0, 0, 0, 22735, 0xA953, 0x00, 0x20, 0x0F00, 0x00000036, 0x2953 },
{ 8451, 0, 0, 0, 22735, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8451, 0, 0, 0, 22735, 0x00CA, 0x00, 0x00, 0x4010, 0x000001DC, 0x00CA },
{ 6313, 0, 0, 0, 22735, 0x0017, 0x00, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 6313, 0, 0, 0, 22735, 0x1C03, 0x40, 0x01, 0x0100, 0x00005ACE, 0x0AFF },
{ 4941, 0, 0, 0, 22735, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4941, 0, 0, 0, 22735, 0x20EB, 0x00, 0x00, 0x4010, 0x000001DC, 0x20EB },
{ 5331, 0, 0, 0, 22735, 0x0258, 0x00, 0x00, 0x0100, 0x0000589A, 0x000D },
{ 5331, 0, 0, 0, 22735, 0x09C4, 0x00, 0x00, 0x0F00, 0x800006D8, 0x09C4 },
{ 3318, 0, 0, 0, 22735, 0x0010, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0010 },
{ 3318, 0, 0, 0, 22735, 0x07DB, 0x60, 0x02, 0x0F00, 0x00000036, 0x07DB },
{ 7563, 0, 0, 0, 22735, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 7563, 0, 0, 0, 22735, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7563, 0, 0, 0, 22735, 0x148E, 0x00, 0x00, 0x0A00, 0x0000000A, 0x148E },
{ 3803, 0, 0, 0, 22735, 0x0258, 0x00, 0x00, 0x0100, 0x0000589A, 0x000D },
{ 3803, 0, 0, 0, 22735, 0x1664, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1664 },
{ 6662, 0, 0, 0, 22735, 0x05B9, 0x00, 0x00, 0x00E0, 0x40080470, 0x05B9 },
{ 6662, 0, 0, 0, 22735, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6662, 0, 0, 0, 22735, 0x28A2, 0x20, 0x01, 0x0A00, 0x0000000A, 0x28A2 },
{ 6127, 0, 0, 0, 22735, 0x2953, 0x00, 0x00, 0x0F00, 0x00000036, 0x2953 },
{ 6127, 0, 0, 0, 22735, 0x0C3B, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0C3B },
{ 4941, 0, 0, 0, 22735, 0x20EB, 0x00, 0x00, 0x4010, 0x000001DC, 0x20EB },
{ 3318, 0, 0, 0, 22735, 0x2C7A, 0xE0, 0x34, 0x0100, 0x00005ADA, 0x1AB6 },
{ 7200, 0, 0, 0, 22736, 0x8D2B, 0x08, 0x20, 0x0100, 0x00005AC2, 0x0D2B },
{ 1471, 0, 0, 0, 22736, 0x002B, 0x00, 0x00, 0x20C0, 0x00083BBD, 0x402B },
{ 1471, 0, 0, 0, 22736, 0x060A, 0x00, 0x00, 0x00E0, 0x40080470, 0x060A },
{ 1471, 0, 0, 0, 22736, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1471, 0, 0, 0, 22736, 0x1855, 0x40, 0x01, 0x0A00, 0x4000294E, 0x1855 },
{ 5027, 0, 0, 0, 22736, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5027, 0, 0, 0, 22736, 0x1271, 0x40, 0x01, 0x4010, 0x000001DC, 0x1271 },
{ 8539, 0, 0, 0, 22736, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 8539, 0, 0, 0, 22736, 0x14A1, 0x00, 0x00, 0x0100, 0x00005AC2, 0x14A1 },
{ 8539, 0, 0, 0, 22736, 0x2FFC, 0x60, 0x02, 0x0F00, 0x800006CA, 0x2BFE },
{ 0, 0, 0, 0, 22736, 0x008E, 0x00, 0x00, 0x0C00, 0x40018470, 0x008E },
{ 0, 0, 0, 0, 22736, 0x8002, 0x02, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 6466, 0, 0, 0, 22736, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 6466, 0, 0, 0, 22736, 0x0590, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0590 },
{ 6467, 0, 0, 0, 22736, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 6467, 0, 0, 0, 22736, 0x0590, 0x00, 0x00, 0x4010, 0x000001DC, 0x0590 },
{ 3117, 0, 0, 0, 22736, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 3117, 0, 0, 0, 22736, 0x0598, 0x00, 0x00, 0xA028, 0x00083FBD, 0x0598 },
{ 3117, 0, 0, 0, 22736, 0x023D, 0x40, 0x01, 0x8010, 0x000001DD, 0x006C },
{ 0, 0, 0, 0, 22736, 0x0C14, 0x02, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 539, 0, 0, 0, 22736, 0x002B, 0x00, 0x00, 0x20C0, 0x00083BBD, 0x402B },
{ 539, 0, 0, 0, 22736, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 539, 0, 0, 0, 22736, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 539, 0, 0, 0, 22736, 0x1592, 0x40, 0x01, 0x0100, 0x00005AC9, 0x1592 },
{ 5608, 0, 0, 0, 22736, 0x13FF, 0x00, 0x00, 0x0C00, 0x00000073, 0x13FF },
{ 5608, 0, 0, 0, 22736, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 5608, 0, 0, 0, 22736, 0x000B, 0x00, 0x00, 0x0100, 0x00005842, 0x000B },
{ 5608, 0, 0, 0, 22736, 0x052B, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0511 },
{ 0, 0, 0, 0, 22736, 0x015C, 0xE2, 0x34, 0x20C0, 0x00083BBD, 0x015C },
{ 6965, 0, 0, 0, 22737, 0x808E, 0x40, 0x21, 0x00E0, 0x40080470, 0x008E },
{ 6965, 0, 0, 0, 22737, 0x0019, 0x40, 0x01, 0x0800, 0x000002A8, 0x0019 },
{ 6965, 0, 0, 0, 22737, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 6965, 0, 0, 0, 22737, 0x0A45, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0A45 },
{ 6965, 0, 0, 0, 22737, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 3778, 0, 0, 0, 22737, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3778, 0, 0, 0, 22737, 0xA557, 0x40, 0x01, 0x8010, 0x00072A1D, 0x1E7D },
{ 0, 0, 0, 0, 22737, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 4751, 0, 0, 0, 22737, 0x0D54, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0D54 },
{ 4116, 0, 0, 0, 22737, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4116, 0, 0, 0, 22737, 0x0857, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0857 },
{ 1471, 0, 0, 0, 22737, 0x1180, 0x40, 0x01, 0x4010, 0x000001DC, 0x1180 },
{ 1980, 0, 0, 0, 22737, 0x0C14, 0x00, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 1980, 0, 0, 0, 22737, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 1980, 0, 0, 0, 22737, 0x096F, 0x00, 0x00, 0x0100, 0x00005AC9, 0x096F },
{ 4800, 0, 0, 0, 22737, 0x1CB3, 0x00, 0x00, 0x00E0, 0x40080470, 0x1CB3 },
{ 4800, 0, 0, 0, 22737, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4800, 0, 0, 0, 22737, 0x15DB, 0x00, 0x00, 0x4010, 0x000001DC, 0x15DB },
{ 776, 0, 0, 0, 22737, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 776, 0, 0, 0, 22737, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22737, 0x0386, 0x40, 0x01, 0x4010, 0x000001DC, 0x0386 },
{ 3423, 0, 0, 0, 22737, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 3423, 0, 0, 0, 22737, 0x1A99, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1A99 },
{ 4908, 0, 0, 0, 22737, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4908, 0, 0, 0, 22737, 0x30D2, 0x00, 0x00, 0x8010, 0x000001DD, 0x3078 },
{ 0, 0, 0, 0, 22737, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 0, 0, 0, 0, 22737, 0x003E, 0x02, 0x00, 0x0100, 0x00005852, 0x000B },
{ 0, 0, 0, 0, 22737, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 0, 0, 0, 0, 22737, 0x13F6, 0xE0, 0x34, 0xB0C8, 0x01071FDD, 0x051C },
{ 0, 0, 0, 0, 22738, 0x851C, 0x00, 0x20, 0xB080, 0x01074FDD, 0x051C },
{ 0, 0, 0, 0, 22738, 0x003E, 0x02, 0x00, 0x0100, 0x00005852, 0x000B },
{ 366, 0, 0, 0, 22738, 0x23C1, 0x00, 0x00, 0x0A00, 0x0000000A, 0x23C1 },
{ 3372, 0, 0, 0, 22738, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3372, 0, 0, 0, 22738, 0x1F4A, 0x60, 0x02, 0x0A00, 0x0000000A, 0x1F4A },
{ 4941, 0, 0, 0, 22738, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 4941, 0, 0, 0, 22738, 0x20EB, 0x00, 0x00, 0x4010, 0x000001DC, 0x20EB },
{ 7613, 0, 0, 0, 22738, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7613, 0, 0, 0, 22738, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 7613, 0, 0, 0, 22738, 0x16EF, 0x00, 0x00, 0x4010, 0x000001DC, 0x16EF },
{ 3318, 0, 0, 0, 22738, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3318, 0, 0, 0, 22738, 0x1AB6, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1AB6 },
{ 0, 0, 0, 0, 22738, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 0, 0, 0, 0, 22738, 0x2D1E, 0xE0, 0x34, 0xB100, 0x000863DD, 0x2D1E },
{ 5483, 0, 0, 0, 22739, 0x8B98, 0x00, 0x20, 0xB028, 0x00083FDD, 0x0B98 },
{ 5483, 0, 0, 0, 22739, 0x0FE7, 0x00, 0x00, 0x8010, 0x000001DD, 0x089B },
{ 7043, 0, 0, 0, 22739, 0x0186, 0x00, 0x00, 0x0F00, 0x00000036, 0x0186 },
{ 7043, 0, 0, 0, 22739, 0x003E, 0x00, 0x00, 0x0100, 0x00005852, 0x000B },
{ 7043, 0, 0, 0, 22739, 0x1C76, 0x00, 0x00, 0x0A00, 0x00000143, 0x0B6C },
{ 5246, 0, 0, 0, 22739, 0x0517, 0x00, 0x00, 0x0C00, 0x00000073, 0x0517 },
{ 5246, 0, 0, 0, 22739, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5246, 0, 0, 0, 22739, 0x2115, 0x40, 0x01, 0x8010, 0x000001DD, 0x1942 },
{ 2300, 0, 0, 0, 22739, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2300, 0, 0, 0, 22739, 0x003E, 0x00, 0x00, 0x0100, 0x00005852, 0x000B },
{ 2300, 0, 0, 0, 22739, 0x03EC, 0x00, 0x00, 0x0F00, 0x8000D883, 0x03EC },
{ 2300, 0, 0, 0, 22739, 0x0EE2, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0EE2 },
{ 6153, 0, 0, 0, 22739, 0x0517, 0x00, 0x00, 0x0C00, 0x00000073, 0x0517 },
{ 6153, 0, 0, 0, 22739, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6153, 0, 0, 0, 22739, 0x1769, 0x00, 0x00, 0x4010, 0x000001DC, 0x1769 },
{ 2061, 0, 0, 0, 22739, 0x14A0, 0x60, 0x02, 0x8010, 0x000001DD, 0x14A0 },
{ 6571, 0, 0, 0, 22739, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6571, 0, 0, 0, 22739, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 6571, 0, 0, 0, 22739, 0x2083, 0x00, 0x00, 0x8010, 0x000001DD, 0x2082 },
{ 6335, 0, 0, 0, 22739, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6335, 0, 0, 0, 22739, 0x138D, 0x00, 0x00, 0x0100, 0x00005AC9, 0x138D },
{ 6571, 0, 0, 0, 22739, 0x2D1E, 0x40, 0x01, 0xB100, 0x000863DD, 0x2D1E },
{ 6571, 0, 0, 0, 22739, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6571, 0, 0, 0, 22739, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 6571, 0, 0, 0, 22739, 0x2083, 0x00, 0x00, 0x8010, 0x000001DD, 0x2082 },
{ 935, 0, 0, 0, 22739, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 935, 0, 0, 0, 22739, 0x0222, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0222 },
{ 7350, 0, 0, 0, 22739, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 7350, 0, 0, 0, 22739, 0x0086, 0x20, 0x01, 0x0F00, 0x800006CA, 0x0086 },
{ 5774, 0, 0, 0, 22739, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 5774, 0, 0, 0, 22739, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 5774, 0, 0, 0, 22739, 0x008D, 0x00, 0x00, 0x0100, 0x00005AC9, 0x008D },
{ 5404, 0, 0, 0, 22739, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 5404, 0, 0, 0, 22739, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5404, 0, 0, 0, 22739, 0x0766, 0x00, 0x00, 0x4010, 0x000001DC, 0x0766 },
{ 0, 0, 0, 0, 22739, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 2363, 0, 0, 0, 22739, 0x1840, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0856 },
{ 398, 0, 0, 0, 22739, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 398, 0, 0, 0, 22739, 0x0079, 0xE0, 0x34, 0x0100, 0x00005AC9, 0x0079 },
{ 935, 0, 0, 0, 22740, 0x851C, 0x00, 0x20, 0xB080, 0x01074FDD, 0x051C },
{ 935, 0, 0, 0, 22740, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 935, 0, 0, 0, 22740, 0x0222, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0222 },
{ 2555, 0, 0, 0, 22740, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 2555, 0, 0, 0, 22740, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 2555, 0, 0, 0, 22740, 0x2424, 0x60, 0x02, 0x4010, 0x000001DC, 0x2424 },
{ 6440, 0, 0, 0, 22740, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 6440, 0, 0, 0, 22740, 0x07AB, 0x00, 0x00, 0x8010, 0x000001DD, 0x0296 },
{ 4041, 0, 0, 0, 22740, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 4041, 0, 0, 0, 22740, 0x0132, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0132 },
{ 4041, 0, 0, 0, 22740, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 0, 0, 0, 0, 22740, 0x0009, 0x02, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 6921, 0, 0, 0, 22740, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6921, 0, 0, 0, 22740, 0x026B, 0x00, 0x00, 0x4010, 0x000001DC, 0x026B },
{ 6921, 0, 0, 0, 22740, 0x057E, 0x40, 0x01, 0x4010, 0x000001DC, 0x057E },
{ 622, 0, 0, 0, 22740, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 622, 0, 0, 0, 22740, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 622, 0, 0, 0, 22740, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 622, 0, 0, 0, 22740, 0x0F25, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0F25 },
{ 7628, 0, 0, 0, 22740, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7628, 0, 0, 0, 22740, 0x254A, 0x00, 0x00, 0x4010, 0x000001DC, 0x254A },
{ 2344, 0, 0, 0, 22740, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 2344, 0, 0, 0, 22740, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2344, 0, 0, 0, 22740, 0x04A1, 0xE0, 0x34, 0x4010, 0x000001DC, 0x04A1 },
{ 7046, 0, 0, 0, 22741, 0x8038, 0x00, 0x20, 0x0C00, 0x00000063, 0x0038 },
{ 7046, 0, 0, 0, 22741, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 7046, 0, 0, 0, 22741, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 7046, 0, 0, 0, 22741, 0x0A9D, 0x00, 0x00, 0x4010, 0x000001DC, 0x0A9D },
{ 4428, 0, 0, 0, 22741, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 4428, 0, 0, 0, 22741, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4428, 0, 0, 0, 22741, 0x0910, 0x40, 0x01, 0x8010, 0x000001DD, 0x036E },
{ 7336, 0, 0, 0, 22741, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7336, 0, 0, 0, 22741, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7336, 0, 0, 0, 22741, 0x1AB1, 0x00, 0x00, 0x8010, 0x000001DD, 0x122A },
{ 4890, 0, 0, 0, 22741, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 4890, 0, 0, 0, 22741, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 4890, 0, 0, 0, 22741, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 4890, 0, 0, 0, 22741, 0x0A9E, 0x00, 0x00, 0x4010, 0x000001DC, 0x0A9E },
{ 7832, 0, 0, 0, 22741, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 7832, 0, 0, 0, 22741, 0x051A, 0x60, 0x02, 0xB0C0, 0x01073FDD, 0x051C },
{ 7832, 0, 0, 0, 22741, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 7832, 0, 0, 0, 22741, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 7832, 0, 0, 0, 22741, 0x0E45, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0E45 },
{ 4013, 0, 0, 0, 22741, 0x07A1, 0x00, 0x00, 0x0D00, 0x00000004, 0x07A1 },
{ 4013, 0, 0, 0, 22741, 0x13B3, 0x00, 0x00, 0x0A00, 0x0000000A, 0x13B3 },
{ 4013, 0, 0, 0, 22741, 0x032C, 0x20, 0x01, 0x4010, 0x000001DC, 0x032C },
{ 6651, 0, 0, 0, 22741, 0x008E, 0x00, 0x00, 0x0C00, 0x40018470, 0x008E },
{ 6651, 0, 0, 0, 22741, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 6651, 0, 0, 0, 22741, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6651, 0, 0, 0, 22741, 0x0310, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0310 },
{ 6083, 0, 0, 0, 22741, 0x0265, 0x40, 0x01, 0x4010, 0x000001DC, 0x0265 },
{ 3920, 0, 0, 0, 22741, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3920, 0, 0, 0, 22741, 0x0508, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0508 },
{ 0, 0, 0, 0, 22741, 0x0018, 0xE0, 0x34, 0x30C1, 0x00083BDC, 0x0018 },
{ 0, 0, 0, 0, 22742, 0x851B, 0x00, 0x20, 0x0F00, 0x00000036, 0x051B },
{ 0, 0, 0, 0, 22742, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 0, 0, 0, 0, 22742, 0x00A9, 0x02, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 7307, 0, 0, 0, 22742, 0x03DF, 0x00, 0x00, 0x4010, 0x000001DC, 0x03DF },
{ 2498, 0, 0, 0, 22742, 0x0DBA, 0x40, 0x01, 0x4010, 0x000001DC, 0x0DBA },
{ 5674, 0, 0, 0, 22742, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5674, 0, 0, 0, 22742, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 5674, 0, 0, 0, 22742, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 5674, 0, 0, 0, 22742, 0x043B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x043B },
{ 5674, 0, 0, 0, 22742, 0x042B, 0x40, 0x01, 0x0F00, 0x40008470, 0x042B },
{ 816, 0, 0, 0, 22742, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 816, 0, 0, 0, 22742, 0x11A6, 0x40, 0x01, 0x0100, 0x00005AC9, 0x11A6 },
{ 0, 0, 0, 0, 22742, 0x209A, 0x02, 0x00, 0x0100, 0x00005AC7, 0x1008 },
{ 2098, 0, 0, 0, 22742, 0x051E, 0x00, 0x00, 0x0D00, 0x00000004, 0x051E },
{ 3581, 0, 0, 0, 22742, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 3581, 0, 0, 0, 22742, 0x0A27, 0x00, 0x00, 0x4010, 0x000001DC, 0x0A27 },
{ 433, 0, 0, 0, 22742, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 433, 0, 0, 0, 22742, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 433, 0, 0, 0, 22742, 0x0098, 0xE0, 0x34, 0x4010, 0x000001DC, 0x0098 },
{ 0, 0, 0, 0, 22743, 0x8041, 0x0A, 0x20, 0x6100, 0x000B0BB2, 0x000B },
{ 6924, 0, 0, 0, 22743, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 6924, 0, 0, 0, 22743, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 6924, 0, 0, 0, 22743, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 6924, 0, 0, 0, 22743, 0x2E2D, 0x40, 0x01, 0x0A00, 0x0000000A, 0x2E2D },
{ 3068, 0, 0, 0, 22743, 0x0003, 0x00, 0x00, 0x0800, 0x000002A8, 0x0003 },
{ 3068, 0, 0, 0, 22743, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22743, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 0, 0, 0, 0, 22743, 0x8098, 0x40, 0x01, 0x4030, 0x000001DC, 0x0098 },
{ 6918, 0, 0, 0, 22743, 0x03E0, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 6918, 0, 0, 0, 22743, 0x832E, 0x00, 0x00, 0x0A00, 0x0000000A, 0x032E },
{ 6918, 0, 0, 0, 22743, 0x80F4, 0xC0, 0x04, 0x3020, 0x00004127, 0x00F4 },
{ 4191, 0, 0, 0, 22743, 0x002A, 0x00, 0x00, 0x8080, 0x01074F9D, 0x002A },
{ 4191, 0, 0, 0, 22743, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 4191, 0, 0, 0, 22743, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 4191, 0, 0, 0, 22743, 0x0070, 0xE0, 0x04, 0x0100, 0x00005AC9, 0x0070 },
{ 3068, 0, 0, 0, 22743, 0x0003, 0x00, 0x00, 0x0000, 0x000002A8, 0x0003 },
{ 3068, 0, 0, 0, 22743, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 7760, 0, 0, 0, 22743, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 7760, 0, 0, 0, 22743, 0x0307, 0x00, 0x00, 0x6100, 0x0000591D, 0x4307 },
{ 7760, 0, 0, 0, 22743, 0x21CC, 0x00, 0x00, 0x0100, 0x00005ACE, 0x11B3 },
{ 4941, 0, 0, 0, 22743, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 4941, 0, 0, 0, 22743, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 4941, 0, 0, 0, 22743, 0x20EB, 0x20, 0x01, 0x4010, 0x000001DC, 0x20EB },
{ 6697, 0, 0, 0, 22743, 0x0038, 0x40, 0x01, 0x0C00, 0x00000063, 0x0038 },
{ 6697, 0, 0, 0, 22743, 0x0003, 0x00, 0x00, 0x0800, 0x000002A8, 0x0003 },
{ 6697, 0, 0, 0, 22743, 0x113C, 0x00, 0x00, 0x0A00, 0x0000000A, 0x113C },
{ 6697, 0, 0, 0, 22743, 0x8098, 0x40, 0x01, 0x4030, 0x000001DC, 0x0098 },
{ 3245, 0, 0, 0, 22743, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 3245, 0, 0, 0, 22743, 0x0307, 0x00, 0x00, 0x6100, 0x0000591D, 0x4307 },
{ 3245, 0, 0, 0, 22743, 0x2E29, 0x00, 0x00, 0x0100, 0x00005ACE, 0x263D },
{ 3198, 0, 0, 0, 22743, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 3198, 0, 0, 0, 22743, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 3198, 0, 0, 0, 22743, 0x2AC6, 0xE0, 0x34, 0x4010, 0x000001DC, 0x2AC6 },
{ 0, 0, 0, 0, 22744, 0x851F, 0x02, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 0, 0, 0, 0, 22744, 0x0041, 0x02, 0x00, 0x6100, 0x000B0BB2, 0x000B },
{ 2889, 0, 0, 0, 22744, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2889, 0, 0, 0, 22744, 0x0A35, 0x00, 0x00, 0x0A00, 0x00000143, 0x045D },
{ 5869, 0, 0, 0, 22744, 0x0290, 0x00, 0x00, 0x8010, 0x000001DD, 0x0084 },
{ 7200, 0, 0, 0, 22744, 0x0517, 0x00, 0x00, 0x0C00, 0x00000073, 0x0517 },
{ 7200, 0, 0, 0, 22744, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 7200, 0, 0, 0, 22744, 0x0D2B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0D2B },
{ 7451, 0, 0, 0, 22744, 0x028D, 0x40, 0x01, 0x0A00, 0x4000294E, 0x028D },
{ 3201, 0, 0, 0, 22744, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3201, 0, 0, 0, 22744, 0x06D0, 0x00, 0x00, 0x6100, 0x000059BD, 0x46D0 },
{ 5027, 0, 0, 0, 22744, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 5027, 0, 0, 0, 22744, 0x03B1, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03B1 },
{ 5999, 0, 0, 0, 22744, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 5999, 0, 0, 0, 22744, 0x20A6, 0x60, 0x02, 0x4010, 0x000001DC, 0x20A6 },
{ 5027, 0, 0, 0, 22744, 0x29B7, 0x00, 0x00, 0xC020, 0x40088E51, 0x29B7 },
{ 5027, 0, 0, 0, 22744, 0x1968, 0x00, 0x00, 0x0100, 0x00005ADD, 0x5968 },
{ 898, 0, 0, 0, 22744, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 898, 0, 0, 0, 22744, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 898, 0, 0, 0, 22744, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 898, 0, 0, 0, 22744, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 898, 0, 0, 0, 22744, 0x0240, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0240 },
{ 898, 0, 0, 0, 22744, 0x30BB, 0x40, 0x01, 0x0F00, 0x800006CA, 0x2F3F },
{ 0, 0, 0, 0, 22744, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2790, 0, 0, 0, 22744, 0x1874, 0x00, 0x00, 0x0100, 0x00005ADD, 0x5874 },
{ 2790, 0, 0, 0, 22744, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 2790, 0, 0, 0, 22744, 0x141A, 0x00, 0x00, 0x4010, 0x000001DC, 0x141A },
{ 7563, 0, 0, 0, 22744, 0x0574, 0x00, 0x00, 0xCC00, 0x40018E51, 0x0574 },
{ 7563, 0, 0, 0, 22744, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7563, 0, 0, 0, 22744, 0x148E, 0x00, 0x00, 0x0A00, 0x0000000A, 0x148E },
{ 1104, 0, 0, 0, 22744, 0x25EE, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0E4F },
{ 0, 0, 0, 0, 22744, 0x0136, 0x02, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 0, 0, 0, 0, 22744, 0x00DA, 0x02, 0x00, 0x4010, 0x000001DC, 0x00DA },
{ 0, 0, 0, 0, 22744, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 0, 0, 0, 0, 22744, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 6662, 0, 0, 0, 22744, 0x03EC, 0x00, 0x00, 0x0F00, 0x8000D883, 0x03EC },
{ 6662, 0, 0, 0, 22744, 0x28A2, 0x00, 0x00, 0x0A00, 0x0000000A, 0x28A2 },
{ 0, 0, 0, 0, 22744, 0x0517, 0x00, 0x00, 0x0C00, 0x00000073, 0x0517 },
{ 0, 0, 0, 0, 22744, 0x0012, 0xC0, 0x34, 0x7082, 0x01074FDC, 0x0012 },
{ 6213, 0, 0, 0, 22745, 0x8038, 0x00, 0x20, 0x0C00, 0x00000063, 0x0038 },
{ 6213, 0, 0, 0, 22745, 0x10FF, 0x00, 0x00, 0x0100, 0x00005ADD, 0x50FF },
{ 120, 0, 0, 0, 22745, 0x00DF, 0x00, 0x00, 0x8010, 0x000001DD, 0x00DA },
{ 1709, 0, 0, 0, 22745, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 1709, 0, 0, 0, 22745, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1709, 0, 0, 0, 22745, 0x0EEC, 0x00, 0x00, 0x8010, 0x000001DD, 0x02B0 },
{ 3220, 0, 0, 0, 22745, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3220, 0, 0, 0, 22745, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3220, 0, 0, 0, 22745, 0x011E, 0x40, 0x01, 0x4010, 0x000001DC, 0x011E },
{ 7431, 0, 0, 0, 22745, 0x0009, 0x00, 0x00, 0x0C00, 0x40018470, 0x0009 },
{ 7431, 0, 0, 0, 22745, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7431, 0, 0, 0, 22745, 0x1EE0, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x0712 },
{ 7431, 0, 0, 0, 22745, 0x13F9, 0x40, 0x01, 0x8010, 0x000001DD, 0x0B9F },
{ 0, 0, 0, 0, 22745, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 0, 0, 0, 0, 22745, 0x030B, 0x02, 0x00, 0x0100, 0x00005902, 0x030B },
{ 4910, 0, 0, 0, 22745, 0x001C, 0x00, 0x00, 0x0D01, 0x00003A1C, 0x001C },
{ 4910, 0, 0, 0, 22745, 0x0A7F, 0x00, 0x00, 0x4010, 0x000001DC, 0x0A7F },
{ 0, 0, 0, 0, 22745, 0x042B, 0x00, 0x00, 0x00E0, 0x40080470, 0x042B },
{ 0, 0, 0, 0, 22745, 0x051A, 0xC0, 0x34, 0xB0C0, 0x01073FDD, 0x051C },
{ 5927, 0, 0, 0, 22746, 0x851C, 0x00, 0x20, 0xB080, 0x01074FDD, 0x051C },
{ 5927, 0, 0, 0, 22746, 0x0508, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0508 },
{ 5927, 0, 0, 0, 22746, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 2443, 0, 0, 0, 22746, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 2443, 0, 0, 0, 22746, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2443, 0, 0, 0, 22746, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 2443, 0, 0, 0, 22746, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 2443, 0, 0, 0, 22746, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2443, 0, 0, 0, 22746, 0x0610, 0x40, 0x01, 0x4010, 0x000001DC, 0x0610 },
{ 1641, 0, 0, 0, 22746, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 1641, 0, 0, 0, 22746, 0x06D6, 0x00, 0x00, 0x0100, 0x00005AC2, 0x06D6 },
{ 2764, 0, 0, 0, 22746, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 2764, 0, 0, 0, 22746, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 2764, 0, 0, 0, 22746, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 2764, 0, 0, 0, 22746, 0x00E3, 0x40, 0x01, 0x4010, 0x000001DC, 0x00E3 },
{ 622, 0, 0, 0, 22746, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 622, 0, 0, 0, 22746, 0x0F25, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0F25 },
{ 4365, 0, 0, 0, 22746, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 4365, 0, 0, 0, 22746, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 4365, 0, 0, 0, 22746, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 4365, 0, 0, 0, 22746, 0x025B, 0x60, 0x02, 0x4010, 0x000001DC, 0x025B },
{ 8055, 0, 0, 0, 22746, 0x2953, 0x00, 0x00, 0x0F00, 0x00000036, 0x2953 },
{ 8055, 0, 0, 0, 22746, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 8055, 0, 0, 0, 22746, 0x1B10, 0x00, 0x00, 0x0100, 0x00005AC2, 0x1B10 },
{ 1523, 0, 0, 0, 22746, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 1523, 0, 0, 0, 22746, 0x003E, 0x00, 0x00, 0x0100, 0x00005852, 0x000B },
{ 1523, 0, 0, 0, 22746, 0x02E7, 0xE0, 0x34, 0x0A00, 0x0000000A, 0x02E7 },
{ 2076, 0, 0, 0, 22747, 0xA953, 0x00, 0x20, 0x0F00, 0x00000036, 0x2953 },
{ 2076, 0, 0, 0, 22747, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 2076, 0, 0, 0, 22747, 0x28A5, 0x00, 0x00, 0x0100, 0x00005AC2, 0x28A5 },
{ 2764, 0, 0, 0, 22747, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 2764, 0, 0, 0, 22747, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 2764, 0, 0, 0, 22747, 0x00E3, 0x40, 0x01, 0x4010, 0x000001DC, 0x00E3 },
{ 6999, 0, 0, 0, 22747, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6999, 0, 0, 0, 22747, 0x01FF, 0x00, 0x00, 0x0100, 0x00005AC9, 0x01FF },
{ 6999, 0, 0, 0, 22747, 0x1899, 0x00, 0x00, 0x4010, 0x000001DC, 0x1899 },
{ 4365, 0, 0, 0, 22747, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 4365, 0, 0, 0, 22747, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 4365, 0, 0, 0, 22747, 0x025B, 0x20, 0x01, 0x4010, 0x000001DC, 0x025B },
{ 1992, 0, 0, 0, 22747, 0x158B, 0x00, 0x00, 0x0C00, 0x40018470, 0x158B },
{ 1992, 0, 0, 0, 22747, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 1992, 0, 0, 0, 22747, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 2506, 0, 0, 0, 22747, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 2506, 0, 0, 0, 22747, 0x1A98, 0x00, 0x00, 0x4010, 0x000001DC, 0x1A98 },
{ 0, 0, 0, 0, 22747, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 8082, 0, 0, 0, 22747, 0x0087, 0x40, 0x01, 0x0A00, 0x0000000A, 0x0087 },
{ 3978, 0, 0, 0, 22747, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3978, 0, 0, 0, 22747, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 3978, 0, 0, 0, 22747, 0x03D2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03D2 },
{ 1277, 0, 0, 0, 22747, 0x2819, 0xE0, 0x34, 0x0A00, 0x0000000A, 0x2819 },
{ 7324, 0, 0, 0, 22748, 0x8ABC, 0x00, 0x20, 0x0100, 0x000059A2, 0x0ABC },
{ 7324, 0, 0, 0, 22748, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 7324, 0, 0, 0, 22748, 0x2953, 0x00, 0x00, 0x0F00, 0x00000036, 0x2953 },
{ 7324, 0, 0, 0, 22748, 0x0787, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0787 },
{ 2764, 0, 0, 0, 22748, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 2764, 0, 0, 0, 22748, 0x00E3, 0x40, 0x01, 0x4010, 0x000001DC, 0x00E3 },
{ 2550, 0, 0, 0, 22748, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2550, 0, 0, 0, 22748, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 2550, 0, 0, 0, 22748, 0x0B28, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0B28 },
{ 8548, 0, 0, 0, 22748, 0x2DEB, 0x00, 0x00, 0x0F00, 0x800006CA, 0x259B },
{ 2026, 0, 0, 0, 22748, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 2026, 0, 0, 0, 22748, 0x04DB, 0x00, 0x00, 0x0100, 0x00005AC9, 0x04DB },
{ 1471, 0, 0, 0, 22748, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1471, 0, 0, 0, 22748, 0x19F5, 0xC0, 0x74, 0x8010, 0x000001DD, 0x1180 },
{ 5975, 0, 0, 0, 22749, 0x8002, 0x00, 0x60, 0x4080, 0x01074F9C, 0x0002 },
{ 5975, 0, 0, 0, 22749, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 5975, 0, 0, 0, 22749, 0x0B3E, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0B3E },
{ 4931, 0, 0, 0, 22749, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 4931, 0, 0, 0, 22749, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 4931, 0, 0, 0, 22749, 0x0C01, 0x40, 0x01, 0x4010, 0x000001DC, 0x0C01 },
{ 3320, 0, 0, 0, 22749, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3320, 0, 0, 0, 22749, 0x0121, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0121 },
{ 4692, 0, 0, 0, 22749, 0x001A, 0x00, 0x00, 0x40C0, 0x01073F9C, 0x0002 },
{ 4692, 0, 0, 0, 22749, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 4692, 0, 0, 0, 22749, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4692, 0, 0, 0, 22749, 0x0BBE, 0x40, 0x01, 0x4010, 0x000001DC, 0x0BBE },
{ 6822, 0, 0, 0, 22749, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6822, 0, 0, 0, 22749, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 6822, 0, 0, 0, 22749, 0x0C01, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0C01 },
{ 7200, 0, 0, 0, 22749, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 7200, 0, 0, 0, 22749, 0x011F, 0x00, 0x00, 0x0100, 0x00005AC9, 0x011F },
{ 1696, 0, 0, 0, 22749, 0x0573, 0x00, 0x00, 0xC020, 0x40090E51, 0x0573 },
{ 1696, 0, 0, 0, 22749, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 1696, 0, 0, 0, 22749, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 1696, 0, 0, 0, 22749, 0x011D, 0x00, 0x00, 0x0100, 0x00005AC9, 0x011D },
{ 7725, 0, 0, 0, 22749, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 7725, 0, 0, 0, 22749, 0x001A, 0x40, 0x01, 0x40C0, 0x01073F9C, 0x0002 },
{ 7725, 0, 0, 0, 22749, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7725, 0, 0, 0, 22749, 0x0573, 0x00, 0x00, 0xC020, 0x40090E51, 0x0573 },
{ 7725, 0, 0, 0, 22749, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 7725, 0, 0, 0, 22749, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 7725, 0, 0, 0, 22749, 0x0CB6, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0CB6 },
{ 8433, 0, 0, 0, 22749, 0x0574, 0x00, 0x00, 0xCC00, 0x40018E51, 0x0574 },
{ 8433, 0, 0, 0, 22749, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 8433, 0, 0, 0, 22749, 0x0006, 0x00, 0x00, 0x4120, 0x0000584D, 0x000B },
{ 8433, 0, 0, 0, 22749, 0x22A3, 0xE0, 0x34, 0x0100, 0x00005ACE, 0x1B1D },
{ 3068, 0, 0, 0, 22750, 0x8038, 0x00, 0x20, 0x0C00, 0x00000063, 0x0038 },
{ 3068, 0, 0, 0, 22750, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22750, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22750, 0x1DB9, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0CB6 },
{ 559, 0, 0, 0, 22750, 0x001A, 0x40, 0x01, 0x40C0, 0x01073F9C, 0x0002 },
{ 559, 0, 0, 0, 22750, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 559, 0, 0, 0, 22750, 0x0499, 0x40, 0x01, 0x0100, 0x00005AC4, 0x011D },
{ 3789, 0, 0, 0, 22750, 0x8C3A, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0C3A },
{ 2377, 0, 0, 0, 22750, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2377, 0, 0, 0, 22750, 0x145F, 0x40, 0x01, 0x4010, 0x000001DC, 0x145F },
{ 0, 0, 0, 0, 22750, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22750, 0x03C2, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03C2 },
{ 0, 0, 0, 0, 22750, 0x0018, 0x02, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 874, 0, 0, 0, 22750, 0x0A1A, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0A1A },
{ 3871, 0, 0, 0, 22750, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 3871, 0, 0, 0, 22750, 0x13CC, 0x40, 0x01, 0x8010, 0x000001DD, 0x0B73 },
{ 7323, 0, 0, 0, 22750, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7323, 0, 0, 0, 22750, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 7323, 0, 0, 0, 22750, 0x00DD, 0x00, 0x00, 0x0100, 0x000059A2, 0x00DD },
{ 7323, 0, 0, 0, 22750, 0x0118, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0118 },
{ 7121, 0, 0, 0, 22750, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7121, 0, 0, 0, 22750, 0x1AF5, 0x00, 0x00, 0x0100, 0x00005ADA, 0x046E },
{ 0, 0, 0, 0, 22750, 0x0018, 0xE0, 0x34, 0x30C1, 0x00083BDC, 0x0018 },
{ 2377, 0, 0, 0, 22751, 0x808E, 0x00, 0x20, 0x00E0, 0x40080470, 0x008E },
{ 2377, 0, 0, 0, 22751, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2377, 0, 0, 0, 22751, 0x145F, 0x00, 0x00, 0x4010, 0x000001DC, 0x145F },
{ 0, 0, 0, 0, 22751, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 4150, 0, 0, 0, 22751, 0x015B, 0x00, 0x00, 0x0F00, 0x00000036, 0x015B },
{ 4150, 0, 0, 0, 22751, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 4150, 0, 0, 0, 22751, 0x0007, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 4150, 0, 0, 0, 22751, 0x24B6, 0x00, 0x00, 0x0A00, 0x40055ACE, 0x1538 },
{ 4150, 0, 0, 0, 22751, 0x0524, 0x40, 0x01, 0x4010, 0x000001DC, 0x0524 },
{ 7093, 0, 0, 0, 22751, 0x005D, 0x00, 0x00, 0x0C00, 0x80318470, 0x005D },
{ 7093, 0, 0, 0, 22751, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 7093, 0, 0, 0, 22751, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7093, 0, 0, 0, 22751, 0x007D, 0x00, 0x00, 0x4010, 0x000001DC, 0x007D },
{ 6315, 0, 0, 0, 22751, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 6315, 0, 0, 0, 22751, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6315, 0, 0, 0, 22751, 0x0B2A, 0x40, 0x01, 0x0100, 0x00005AC9, 0x0B2A },
{ 3576, 0, 0, 0, 22751, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3576, 0, 0, 0, 22751, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 3576, 0, 0, 0, 22751, 0x00D0, 0x60, 0x02, 0x0100, 0x00005AC9, 0x00D0 },
{ 4102, 0, 0, 0, 22751, 0x13FF, 0x00, 0x00, 0x0C00, 0x00000073, 0x13FF },
{ 4102, 0, 0, 0, 22751, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 4102, 0, 0, 0, 22751, 0x0B80, 0x40, 0x01, 0x0100, 0x00005AC2, 0x0B80 },
{ 2442, 0, 0, 0, 22751, 0x0559, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0559 },
{ 935, 0, 0, 0, 22751, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 935, 0, 0, 0, 22751, 0x0018, 0x20, 0x01, 0x30C1, 0x00083BDC, 0x0018 },
{ 935, 0, 0, 0, 22751, 0x158B, 0x00, 0x00, 0x0C00, 0x40018470, 0x158B },
{ 935, 0, 0, 0, 22751, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 935, 0, 0, 0, 22751, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 935, 0, 0, 0, 22751, 0x13C3, 0x00, 0x00, 0x0F00, 0x800006CA, 0x0503 },
{ 935, 0, 0, 0, 22751, 0x0222, 0x40, 0x01, 0x0100, 0x00005AC9, 0x0222 },
{ 309, 0, 0, 0, 22751, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 309, 0, 0, 0, 22751, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 309, 0, 0, 0, 22751, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 309, 0, 0, 0, 22751, 0x0B80, 0xE0, 0x34, 0x0100, 0x00005AC9, 0x0B80 },
{ 5315, 0, 0, 0, 22752, 0x8D2B, 0x40, 0x21, 0x0100, 0x00005AC2, 0x0D2B },
{ 5315, 0, 0, 0, 22752, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 5315, 0, 0, 0, 22752, 0x04EC, 0x00, 0x00, 0x4010, 0x000001DC, 0x04EC },
{ 0, 0, 0, 0, 22752, 0x0C14, 0x02, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 6075, 0, 0, 0, 22752, 0x0017, 0x00, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 6075, 0, 0, 0, 22752, 0x10C4, 0x00, 0x00, 0x0100, 0x00005ACE, 0x03A2 },
{ 6075, 0, 0, 0, 22752, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 3474, 0, 0, 0, 22752, 0x0017, 0x00, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 3474, 0, 0, 0, 22752, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 3474, 0, 0, 0, 22752, 0x1CEE, 0x00, 0x00, 0x0F00, 0x800006CA, 0x1CEE },
{ 6662, 0, 0, 0, 22752, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 6662, 0, 0, 0, 22752, 0x00A6, 0x60, 0x02, 0x70C0, 0x01073FDC, 0x0012 },
{ 6662, 0, 0, 0, 22752, 0x005D, 0x00, 0x00, 0x0C00, 0x80318470, 0x005D },
{ 6662, 0, 0, 0, 22752, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6662, 0, 0, 0, 22752, 0x0365, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0365 },
{ 2421, 0, 0, 0, 22752, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 2421, 0, 0, 0, 22752, 0x03AA, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03AA },
{ 530, 0, 0, 0, 22752, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 530, 0, 0, 0, 22752, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 530, 0, 0, 0, 22752, 0x07AE, 0xE0, 0x34, 0x4010, 0x000001DC, 0x07AE },
{ 898, 0, 0, 0, 22753, 0x8159, 0x08, 0x20, 0x0800, 0x000002A8, 0x0159 },
{ 898, 0, 0, 0, 22753, 0x0186, 0x40, 0x01, 0x0F00, 0x00000036, 0x0186 },
{ 898, 0, 0, 0, 22753, 0x158B, 0x00, 0x00, 0x0C00, 0x40018470, 0x158B },
{ 898, 0, 0, 0, 22753, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 898, 0, 0, 0, 22753, 0x30B7, 0x00, 0x00, 0x0100, 0x00005ADA, 0x2D2E },
{ 3196, 0, 0, 0, 22753, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 3196, 0, 0, 0, 22753, 0x057F, 0x40, 0x01, 0x4010, 0x000001DC, 0x057F },
{ 0, 0, 0, 0, 22753, 0x0012, 0x02, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 0, 0, 0, 0, 22753, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 3093, 0, 0, 0, 22753, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 3093, 0, 0, 0, 22753, 0x0A2F, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0A2F },
{ 1397, 0, 0, 0, 22753, 0x00DA, 0x40, 0x01, 0x4010, 0x000001DC, 0x00DA },
{ 5115, 0, 0, 0, 22753, 0x19FF, 0x00, 0x00, 0x0F00, 0x8000D898, 0x19FF },
{ 5115, 0, 0, 0, 22753, 0x1901, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0366 },
{ 5115, 0, 0, 0, 22753, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 5115, 0, 0, 0, 22753, 0x032F, 0x40, 0x01, 0x4010, 0x8007702E, 0x032F },
{ 7337, 0, 0, 0, 22753, 0x0152, 0x00, 0x00, 0xC020, 0x40090E51, 0x0152 },
{ 7337, 0, 0, 0, 22753, 0x262B, 0x00, 0x00, 0x0100, 0x00005ADA, 0x1749 },
{ 5315, 0, 0, 0, 22753, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 5315, 0, 0, 0, 22753, 0x0E48, 0x00, 0x00, 0x4010, 0x000001DC, 0x0E48 },
{ 7585, 0, 0, 0, 22753, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 7585, 0, 0, 0, 22753, 0x0319, 0x40, 0x01, 0x4010, 0x000001DC, 0x0319 },
{ 0, 0, 0, 0, 22753, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22753, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 4194, 0, 0, 0, 22753, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 4194, 0, 0, 0, 22753, 0x072B, 0x40, 0x01, 0x4010, 0x000001DC, 0x072B },
{ 7646, 0, 0, 0, 22753, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7646, 0, 0, 0, 22753, 0x0DA1, 0x00, 0x00, 0x0100, 0x000B3458, 0x0061 },
{ 7646, 0, 0, 0, 22753, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 7646, 0, 0, 0, 22753, 0x28B1, 0x40, 0x01, 0x0100, 0x00005ACE, 0x1B62 },
{ 622, 0, 0, 0, 22753, 0x005D, 0x00, 0x00, 0x0C00, 0x80318470, 0x005D },
{ 622, 0, 0, 0, 22753, 0x26A7, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0F25 },
{ 1471, 0, 0, 0, 22753, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 1471, 0, 0, 0, 22753, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 1471, 0, 0, 0, 22753, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 1471, 0, 0, 0, 22753, 0x19F5, 0x40, 0x01, 0x8010, 0x000001DD, 0x1180 },
{ 6908, 0, 0, 0, 22753, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6908, 0, 0, 0, 22753, 0x184E, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0310 },
{ 5971, 0, 0, 0, 22753, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 5971, 0, 0, 0, 22753, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 5971, 0, 0, 0, 22753, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 5971, 0, 0, 0, 22753, 0x11DC, 0x60, 0x32, 0x4010, 0x000001DC, 0x11DC },
{ 5375, 0, 0, 0, 22754, 0x8ABC, 0x00, 0x20, 0x0100, 0x000059A2, 0x0ABC },
{ 5375, 0, 0, 0, 22754, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 5375, 0, 0, 0, 22754, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 5375, 0, 0, 0, 22754, 0x0B9A, 0x00, 0x00, 0x0D00, 0x00000004, 0x0B9A },
{ 5375, 0, 0, 0, 22754, 0x0508, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0508 },
{ 5375, 0, 0, 0, 22754, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 4912, 0, 0, 0, 22754, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 4912, 0, 0, 0, 22754, 0x1A40, 0x00, 0x00, 0x4010, 0x000001DC, 0x1A40 },
{ 4426, 0, 0, 0, 22754, 0x1505, 0x00, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 4426, 0, 0, 0, 22754, 0x00A6, 0x40, 0x01, 0x70C0, 0x01073FDC, 0x0012 },
{ 4426, 0, 0, 0, 22754, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4426, 0, 0, 0, 22754, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 4426, 0, 0, 0, 22754, 0x23AE, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x0B83 },
{ 2420, 0, 0, 0, 22754, 0x1AC3, 0x00, 0x00, 0x4010, 0x000001DC, 0x1AC3 },
{ 559, 0, 0, 0, 22754, 0x1505, 0x00, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 559, 0, 0, 0, 22754, 0x00A6, 0x40, 0x01, 0x70C0, 0x01073FDC, 0x0012 },
{ 559, 0, 0, 0, 22754, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 559, 0, 0, 0, 22754, 0x011D, 0x40, 0x01, 0x0100, 0x00005AC9, 0x011D },
{ 1945, 0, 0, 0, 22754, 0x8156, 0x00, 0x00, 0x4010, 0x000001DC, 0x0156 },
{ 7235, 0, 0, 0, 22754, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 7235, 0, 0, 0, 22754, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 7235, 0, 0, 0, 22754, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7235, 0, 0, 0, 22754, 0x2BB4, 0x00, 0x00, 0x0100, 0x00005ADA, 0x209F },
{ 0, 0, 0, 0, 22754, 0x0518, 0x02, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 0, 0, 0, 0, 22754, 0x0C14, 0x02, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 0, 0, 0, 0, 22754, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 3513, 0, 0, 0, 22754, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 3513, 0, 0, 0, 22754, 0x00A9, 0x80, 0x04, 0x702B, 0x00083FDC, 0x00A9 },
{ 3513, 0, 0, 0, 22754, 0x00AE, 0x00, 0x00, 0xCC00, 0x40018E51, 0x00AE },
{ 3513, 0, 0, 0, 22754, 0x03B0, 0xC0, 0x04, 0x0F00, 0x800006CA, 0x03B0 },
{ 3513, 0, 0, 0, 22754, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3513, 0, 0, 0, 22754, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 3513, 0, 0, 0, 22754, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 3513, 0, 0, 0, 22754, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 3513, 0, 0, 0, 22754, 0x109B, 0x00, 0x00, 0x0100, 0x00005ADA, 0x037B },
{ 5671, 0, 0, 0, 22754, 0x186C, 0x00, 0x00, 0x7102, 0x000863DC, 0x186C },
{ 5671, 0, 0, 0, 22754, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 5671, 0, 0, 0, 22754, 0x0B9B, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0B9B },
{ 5671, 0, 0, 0, 22754, 0x021C, 0x80, 0x34, 0x4010, 0x000001DC, 0x021C },
{ 6965, 0, 0, 0, 22755, 0x8ABC, 0x00, 0x20, 0x0100, 0x000059A2, 0x0ABC },
{ 6965, 0, 0, 0, 22755, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 6965, 0, 0, 0, 22755, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 6965, 0, 0, 0, 22755, 0x047F, 0x00, 0x00, 0x0100, 0x00005AC9, 0x047F },
{ 6965, 0, 0, 0, 22755, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 6621, 0, 0, 0, 22755, 0x238D, 0x00, 0x00, 0x0F00, 0x800006CA, 0x13BA },
{ 5391, 0, 0, 0, 22755, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5391, 0, 0, 0, 22755, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 5391, 0, 0, 0, 22755, 0x01E2, 0x00, 0x00, 0x0100, 0x00005AC9, 0x01E2 },
{ 3364, 0, 0, 0, 22755, 0x0519, 0x40, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 3364, 0, 0, 0, 22755, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3364, 0, 0, 0, 22755, 0x0643, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0643 },
{ 2111, 0, 0, 0, 22755, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 2111, 0, 0, 0, 22755, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 2111, 0, 0, 0, 22755, 0x0148, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0148 },
{ 4933, 0, 0, 0, 22755, 0x0519, 0x40, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 4933, 0, 0, 0, 22755, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4933, 0, 0, 0, 22755, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 4933, 0, 0, 0, 22755, 0x0ABD, 0x00, 0x00, 0x6100, 0x000059BD, 0x4ABD },
{ 4933, 0, 0, 0, 22755, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 4933, 0, 0, 0, 22755, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 4933, 0, 0, 0, 22755, 0x15D0, 0x00, 0x00, 0x8010, 0x000001DD, 0x069E },
{ 0, 0, 0, 0, 22755, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 0, 0, 0, 0, 22755, 0x051A, 0xC0, 0x34, 0xB0C0, 0x01073FDD, 0x051C },
{ 7997, 0, 0, 0, 22756, 0x958B, 0x00, 0x20, 0x00E0, 0x40080470, 0x158B },
{ 7997, 0, 0, 0, 22756, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 7997, 0, 0, 0, 22756, 0x0307, 0x00, 0x00, 0x6100, 0x0000591D, 0x4307 },
{ 7997, 0, 0, 0, 22756, 0x1C32, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0B34 },
{ 7227, 0, 0, 0, 22756, 0x03C4, 0x00, 0x00, 0x0D00, 0x00000004, 0x03C4 },
{ 1471, 0, 0, 0, 22756, 0x19F5, 0x40, 0x01, 0x8010, 0x000001DD, 0x1180 },
{ 3499, 0, 0, 0, 22756, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 3499, 0, 0, 0, 22756, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3499, 0, 0, 0, 22756, 0x1B13, 0x00, 0x00, 0x4010, 0x000001DC, 0x1B13 },
{ 5971, 0, 0, 0, 22756, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 5971, 0, 0, 0, 22756, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5971, 0, 0, 0, 22756, 0x11DC, 0x00, 0x00, 0x4010, 0x000001DC, 0x11DC },
{ 7997, 0, 0, 0, 22756, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 7997, 0, 0, 0, 22756, 0x0B34, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0B34 },
{ 120, 0, 0, 0, 22756, 0x0519, 0x20, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 120, 0, 0, 0, 22756, 0x158B, 0x00, 0x00, 0x0C00, 0x40018470, 0x158B },
{ 120, 0, 0, 0, 22756, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 120, 0, 0, 0, 22756, 0x00DF, 0x10, 0x00, 0x8018, 0x000038FD, 0x00DA },
{ 1818, 0, 0, 0, 22756, 0x0691, 0x40, 0x01, 0x4010, 0x000001DC, 0x0691 },
{ 0, 0, 0, 0, 22756, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22756, 0x008E, 0x02, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 2555, 0, 0, 0, 22756, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2555, 0, 0, 0, 22756, 0x2424, 0x00, 0x00, 0x4010, 0x000001DC, 0x2424 },
{ 776, 0, 0, 0, 22756, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 776, 0, 0, 0, 22756, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22756, 0x0386, 0x40, 0x01, 0x4010, 0x000001DC, 0x0386 },
{ 7151, 0, 0, 0, 22756, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7151, 0, 0, 0, 22756, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7151, 0, 0, 0, 22756, 0x0219, 0x40, 0x01, 0x4010, 0x000001DC, 0x0219 },
{ 3427, 0, 0, 0, 22756, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3427, 0, 0, 0, 22756, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3427, 0, 0, 0, 22756, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 3427, 0, 0, 0, 22756, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 3427, 0, 0, 0, 22756, 0x0763, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0763 },
{ 0, 0, 0, 0, 22756, 0x1CA5, 0xE0, 0x34, 0x0F00, 0x00000036, 0x1CA5 },
{ 1945, 0, 0, 0, 22757, 0x8156, 0x00, 0x20, 0x4010, 0x000001DC, 0x0156 },
{ 1214, 0, 0, 0, 22757, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 1214, 0, 0, 0, 22757, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 1214, 0, 0, 0, 22757, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 1214, 0, 0, 0, 22757, 0x1ED8, 0x00, 0x00, 0x0100, 0x00005ADA, 0x070D },
{ 7451, 0, 0, 0, 22757, 0x0007, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 7451, 0, 0, 0, 22757, 0x028D, 0x00, 0x00, 0x0A00, 0x4000294E, 0x028D },
{ 1215, 0, 0, 0, 22757, 0x2FAE, 0x00, 0x00, 0x4010, 0x000001DC, 0x2FAE },
{ 1004, 0, 0, 0, 22757, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 1004, 0, 0, 0, 22757, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 1004, 0, 0, 0, 22757, 0x08A3, 0x40, 0x01, 0x4010, 0x000001DC, 0x08A3 },
{ 7760, 0, 0, 0, 22757, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7760, 0, 0, 0, 22757, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 7760, 0, 0, 0, 22757, 0x00DD, 0x00, 0x00, 0x0100, 0x000059A2, 0x00DD },
{ 7760, 0, 0, 0, 22757, 0x0121, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0121 },
{ 7064, 0, 0, 0, 22757, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 7064, 0, 0, 0, 22757, 0x0405, 0x00, 0x00, 0x4010, 0x000001DC, 0x0405 },
{ 4791, 0, 0, 0, 22757, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 4791, 0, 0, 0, 22757, 0x0326, 0x40, 0x01, 0x0A00, 0x0000000A, 0x0326 },
{ 5337, 0, 0, 0, 22757, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5337, 0, 0, 0, 22757, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 5337, 0, 0, 0, 22757, 0x00DD, 0x00, 0x00, 0x0100, 0x000059A2, 0x00DD },
{ 5337, 0, 0, 0, 22757, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 5337, 0, 0, 0, 22757, 0x25D5, 0x00, 0x00, 0x0100, 0x00005ACE, 0x16D6 },
{ 3709, 0, 0, 0, 22757, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 3709, 0, 0, 0, 22757, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3709, 0, 0, 0, 22757, 0x0A27, 0x00, 0x00, 0x4010, 0x000001DC, 0x0A27 },
{ 7451, 0, 0, 0, 22757, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7451, 0, 0, 0, 22757, 0x028D, 0x80, 0x34, 0x0010, 0x4000394E, 0x028D },
{ 3289, 0, 0, 0, 22758, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 3289, 0, 0, 0, 22758, 0x0307, 0x00, 0x00, 0x6100, 0x0000591D, 0x4307 },
{ 3289, 0, 0, 0, 22758, 0x2594, 0x00, 0x00, 0x0100, 0x00005ACE, 0x1671 },
{ 1322, 0, 0, 0, 22758, 0x0ABF, 0x00, 0x00, 0x4010, 0x000001DC, 0x0ABF },
{ 1004, 0, 0, 0, 22758, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 1004, 0, 0, 0, 22758, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 1004, 0, 0, 0, 22758, 0x08A3, 0x00, 0x00, 0x4010, 0x000001DC, 0x08A3 },
{ 7096, 0, 0, 0, 22758, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 7096, 0, 0, 0, 22758, 0x16A6, 0x00, 0x00, 0x0100, 0x00005AC7, 0x0069 },
{ 7096, 0, 0, 0, 22758, 0x00F0, 0x00, 0x00, 0x0F00, 0x40008470, 0x00F0 },
{ 7227, 0, 0, 0, 22758, 0x03C4, 0x00, 0x00, 0x0D00, 0x00000004, 0x03C4 },
{ 5971, 0, 0, 0, 22758, 0x11DC, 0x40, 0x01, 0x4010, 0x000001DC, 0x11DC },
{ 2398, 0, 0, 0, 22758, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2398, 0, 0, 0, 22758, 0x0307, 0x00, 0x00, 0x6100, 0x0000591D, 0x4307 },
{ 2398, 0, 0, 0, 22758, 0x135A, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0125 },
{ 0, 0, 0, 0, 22758, 0x1505, 0x02, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 5315, 0, 0, 0, 22758, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 5315, 0, 0, 0, 22758, 0x04EC, 0xE0, 0x34, 0x4010, 0x000001DC, 0x04EC },
{ 68, 0, 0, 0, 22759, 0x808E, 0x00, 0x20, 0x00E0, 0x40080470, 0x008E },
{ 68, 0, 0, 0, 22759, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 68, 0, 0, 0, 22759, 0x0B52, 0x00, 0x00, 0x4010, 0x000001DC, 0x0B52 },
{ 2199, 0, 0, 0, 22759, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 2199, 0, 0, 0, 22759, 0x0066, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0066 },
{ 2199, 0, 0, 0, 22759, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 7023, 0, 0, 0, 22759, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7023, 0, 0, 0, 22759, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7023, 0, 0, 0, 22759, 0x055C, 0x40, 0x01, 0x4010, 0x000001DC, 0x055C },
{ 3714, 0, 0, 0, 22759, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3714, 0, 0, 0, 22759, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3714, 0, 0, 0, 22759, 0x01CC, 0x00, 0x00, 0x4010, 0x000001DC, 0x01CC },
{ 3714, 0, 0, 0, 22759, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 6086, 0, 0, 0, 22759, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 6086, 0, 0, 0, 22759, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6086, 0, 0, 0, 22759, 0x140E, 0x00, 0x00, 0x4010, 0x000001DC, 0x140E },
{ 6030, 0, 0, 0, 22759, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6030, 0, 0, 0, 22759, 0x0CB6, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0CB6 },
{ 0, 0, 0, 0, 22759, 0x0018, 0xE0, 0x34, 0x30C1, 0x00083BDC, 0x0018 },
{ 1945, 0, 0, 0, 22760, 0x8156, 0x00, 0x20, 0x4010, 0x000001DC, 0x0156 },
{ 1129, 0, 0, 0, 22760, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 1129, 0, 0, 0, 22760, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 1129, 0, 0, 0, 22760, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 1129, 0, 0, 0, 22760, 0x1E58, 0x00, 0x00, 0x0100, 0x00005ADA, 0x06BD },
{ 5892, 0, 0, 0, 22760, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 5892, 0, 0, 0, 22760, 0x0533, 0x00, 0x00, 0x4010, 0x000001DC, 0x0533 },
{ 1818, 0, 0, 0, 22760, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 1818, 0, 0, 0, 22760, 0x0691, 0x40, 0x01, 0x4010, 0x000001DC, 0x0691 },
{ 3559, 0, 0, 0, 22760, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3559, 0, 0, 0, 22760, 0x2F1E, 0x00, 0x00, 0x0100, 0x00005ADA, 0x263D },
{ 7151, 0, 0, 0, 22760, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 7151, 0, 0, 0, 22760, 0x0219, 0x00, 0x00, 0x4010, 0x000001DC, 0x0219 },
{ 5766, 0, 0, 0, 22760, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 5766, 0, 0, 0, 22760, 0x20A6, 0x80, 0x34, 0x4010, 0x000001DC, 0x20A6 },
{ 0, 0, 0, 0, 22761, 0x8D2B, 0x40, 0x21, 0x0100, 0x00005AC2, 0x0D2B },
{ 0, 0, 0, 0, 22761, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 0, 0, 0, 0, 22761, 0x0018, 0x02, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 3068, 0, 0, 0, 22761, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 3068, 0, 0, 0, 22761, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3068, 0, 0, 0, 22761, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22761, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22761, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 0, 0, 0, 0, 22761, 0x089F, 0x00, 0x00, 0x8010, 0x000001DD, 0x0335 },
{ 5971, 0, 0, 0, 22761, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5971, 0, 0, 0, 22761, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5971, 0, 0, 0, 22761, 0x11DC, 0x00, 0x00, 0x4010, 0x000001DC, 0x11DC },
{ 3021, 0, 0, 0, 22761, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3021, 0, 0, 0, 22761, 0x1098, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1098 },
{ 1767, 0, 0, 0, 22761, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 1767, 0, 0, 0, 22761, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1767, 0, 0, 0, 22761, 0x0550, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0550 },
{ 784, 0, 0, 0, 22761, 0x02AE, 0x40, 0x01, 0x4010, 0x000001DC, 0x02AE },
{ 3816, 0, 0, 0, 22761, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3816, 0, 0, 0, 22761, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3816, 0, 0, 0, 22761, 0x11DC, 0x00, 0x00, 0x4010, 0x000001DC, 0x11DC },
{ 3286, 0, 0, 0, 22761, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3286, 0, 0, 0, 22761, 0x0C07, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0C07 },
{ 1767, 0, 0, 0, 22761, 0x2D1E, 0x00, 0x00, 0xB100, 0x000863DD, 0x2D1E },
{ 1767, 0, 0, 0, 22761, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 1767, 0, 0, 0, 22761, 0x0550, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0550 },
{ 7385, 0, 0, 0, 22761, 0x1450, 0xC0, 0x34, 0x4010, 0x000001DC, 0x1450 },
{ 776, 0, 0, 0, 22762, 0x808E, 0x00, 0x20, 0x00E0, 0x40080470, 0x008E },
{ 776, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22762, 0x0769, 0x00, 0x00, 0x4010, 0x000001DC, 0x0769 },
{ 4390, 0, 0, 0, 22762, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 4390, 0, 0, 0, 22762, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 4390, 0, 0, 0, 22762, 0x0EE4, 0x00, 0x00, 0x0100, 0x00005ACE, 0x02AA },
{ 3045, 0, 0, 0, 22762, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 3045, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3045, 0, 0, 0, 22762, 0x2743, 0x00, 0x00, 0x4010, 0x000001DC, 0x2743 },
{ 3519, 0, 0, 0, 22762, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3519, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3519, 0, 0, 0, 22762, 0x0813, 0x00, 0x00, 0x4010, 0x000001DC, 0x0813 },
{ 3068, 0, 0, 0, 22762, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3068, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22762, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 4325, 0, 0, 0, 22762, 0x0009, 0x00, 0x00, 0x0C00, 0x40018470, 0x0009 },
{ 4325, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4325, 0, 0, 0, 22762, 0x1479, 0x00, 0x00, 0x8010, 0x000001DD, 0x0C02 },
{ 3680, 0, 0, 0, 22762, 0x070C, 0x00, 0x00, 0x0100, 0x00005AC2, 0x070C },
{ 3220, 0, 0, 0, 22762, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3220, 0, 0, 0, 22762, 0x011E, 0xE0, 0x34, 0x4010, 0x000001DC, 0x011E },
{ 1945, 0, 0, 0, 22763, 0x8156, 0x08, 0x20, 0x4010, 0x000001DC, 0x0156 },
{ 7453, 0, 0, 0, 22763, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 7453, 0, 0, 0, 22763, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 7453, 0, 0, 0, 22763, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7453, 0, 0, 0, 22763, 0x0F40, 0x00, 0x00, 0x0100, 0x00005ADA, 0x02E6 },
{ 7453, 0, 0, 0, 22763, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 7453, 0, 0, 0, 22763, 0x27A8, 0x00, 0x00, 0x4010, 0x000001DC, 0x27A8 },
{ 8248, 0, 0, 0, 22763, 0x0758, 0x40, 0x01, 0x0100, 0x00005AC9, 0x0758 },
{ 5596, 0, 0, 0, 22763, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5596, 0, 0, 0, 22763, 0x1AD8, 0x00, 0x00, 0x0100, 0x00005ADD, 0x5AD8 },
{ 2573, 0, 0, 0, 22763, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 2573, 0, 0, 0, 22763, 0x0D65, 0x00, 0x00, 0x4010, 0x000001DC, 0x0D65 },
{ 0, 0, 0, 0, 22763, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 0, 0, 0, 0, 22763, 0x00A6, 0x42, 0x01, 0x70C0, 0x01073FDC, 0x0012 },
{ 0, 0, 0, 0, 22763, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22763, 0x10FF, 0x00, 0x00, 0x0100, 0x00005ADD, 0x50FF },
{ 0, 0, 0, 0, 22763, 0x00A6, 0x02, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 7937, 0, 0, 0, 22763, 0x1716, 0x00, 0x00, 0x0A00, 0x0000000A, 0x1716 },
{ 5027, 0, 0, 0, 22763, 0x0186, 0x40, 0x01, 0x0F00, 0x00000036, 0x0186 },
{ 5027, 0, 0, 0, 22763, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5027, 0, 0, 0, 22763, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 5027, 0, 0, 0, 22763, 0x111B, 0x00, 0x00, 0x6100, 0x000059BD, 0x511B },
{ 5027, 0, 0, 0, 22763, 0x03B1, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03B1 },
{ 4589, 0, 0, 0, 22763, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 4589, 0, 0, 0, 22763, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 4589, 0, 0, 0, 22763, 0x279C, 0x80, 0x34, 0x4010, 0x000001DC, 0x279C },
{ 7646, 0, 0, 0, 22764, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 7646, 0, 0, 0, 22764, 0x0041, 0x00, 0x00, 0x6100, 0x000B0BB2, 0x000B },
{ 7646, 0, 0, 0, 22764, 0x0EE4, 0x00, 0x00, 0x0100, 0x00005ACE, 0x02AA },
{ 7036, 0, 0, 0, 22764, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 7036, 0, 0, 0, 22764, 0x0ABF, 0x00, 0x00, 0x4010, 0x000001DC, 0x0ABF },
{ 3519, 0, 0, 0, 22764, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 3519, 0, 0, 0, 22764, 0x0813, 0x60, 0x02, 0x4010, 0x000001DC, 0x0813 },
{ 8354, 0, 0, 0, 22764, 0x0758, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0758 },
{ 6188, 0, 0, 0, 22764, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 6188, 0, 0, 0, 22764, 0x0186, 0x40, 0x01, 0x0F00, 0x00000036, 0x0186 },
{ 6188, 0, 0, 0, 22764, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6188, 0, 0, 0, 22764, 0x00CE, 0x00, 0x00, 0x0100, 0x00005AC2, 0x00CE },
{ 6188, 0, 0, 0, 22764, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 6188, 0, 0, 0, 22764, 0x1FEA, 0x00, 0x00, 0x4010, 0x000001DC, 0x1FEA },
{ 6188, 0, 0, 0, 22764, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 6188, 0, 0, 0, 22764, 0x2984, 0x60, 0x02, 0x0100, 0x00005ACE, 0x1CE5 },
{ 3563, 0, 0, 0, 22764, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3563, 0, 0, 0, 22764, 0x0068, 0x00, 0x00, 0x4010, 0x000001DC, 0x0068 },
{ 3068, 0, 0, 0, 22764, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3068, 0, 0, 0, 22764, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22764, 0x83B2, 0x10, 0x00, 0x4018, 0x000038FC, 0x03B2 },
{ 0, 0, 0, 0, 22764, 0x0A68, 0x00, 0x00, 0x0A00, 0x4000294E, 0x0A68 },
{ 0, 0, 0, 0, 22764, 0x02FF, 0x00, 0x00, 0x4010, 0x000001DC, 0x02FF },
{ 5437, 0, 0, 0, 22764, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 5437, 0, 0, 0, 22764, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 5437, 0, 0, 0, 22764, 0x142C, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0538 },
{ 7022, 0, 0, 0, 22764, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 7022, 0, 0, 0, 22764, 0x0519, 0x40, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 7022, 0, 0, 0, 22764, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7022, 0, 0, 0, 22764, 0x2303, 0x00, 0x00, 0x0A00, 0x0000000A, 0x2303 },
{ 7022, 0, 0, 0, 22764, 0x1C2B, 0x00, 0x00, 0x0100, 0x00005AC7, 0x8431 },
{ 0, 0, 0, 0, 22764, 0x0ABC, 0x02, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 0, 0, 0, 0, 22764, 0x000B, 0x02, 0x00, 0x0100, 0x00005849, 0x000B },
{ 3519, 0, 0, 0, 22764, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 3519, 0, 0, 0, 22764, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 3519, 0, 0, 0, 22764, 0x0813, 0xE0, 0x34, 0x4010, 0x000001DC, 0x0813 },
{ 2555, 0, 0, 0, 22765, 0x808E, 0x00, 0x20, 0x00E0, 0x40080470, 0x008E },
{ 2555, 0, 0, 0, 22765, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2555, 0, 0, 0, 22765, 0x2424, 0x00, 0x00, 0x4010, 0x000001DC, 0x2424 },
{ 3844, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3844, 0, 0, 0, 22765, 0x9939, 0x00, 0x00, 0x4031, 0x00003A1C, 0x1939 },
{ 3680, 0, 0, 0, 22765, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3680, 0, 0, 0, 22765, 0x070C, 0x00, 0x00, 0x0100, 0x00005AC9, 0x070C },
{ 7701, 0, 0, 0, 22765, 0x0519, 0x40, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 7701, 0, 0, 0, 22765, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7701, 0, 0, 0, 22765, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7701, 0, 0, 0, 22765, 0x0B34, 0x00, 0x00, 0x4010, 0x000001DC, 0x0B34 },
{ 929, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 929, 0, 0, 0, 22765, 0x0D19, 0x40, 0x01, 0x8010, 0x000001DD, 0x066A },
{ 0, 0, 0, 0, 22765, 0x0C14, 0x02, 0x00, 0xC020, 0x40090E51, 0x0C14 },
{ 2865, 0, 0, 0, 22765, 0x03BF, 0x00, 0x00, 0x0100, 0x00005AC4, 0x03C2 },
{ 2865, 0, 0, 0, 22765, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 2865, 0, 0, 0, 22765, 0x0C8D, 0x40, 0x01, 0x0A00, 0x0000000A, 0x0C8D },
{ 120, 0, 0, 0, 22765, 0x158B, 0x00, 0x00, 0x0C00, 0x40018470, 0x158B },
{ 120, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 120, 0, 0, 0, 22765, 0x00DF, 0x10, 0x00, 0x8018, 0x000038FD, 0x00DA },
{ 1818, 0, 0, 0, 22765, 0x0691, 0x40, 0x01, 0x4010, 0x000001DC, 0x0691 },
{ 2555, 0, 0, 0, 22765, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2555, 0, 0, 0, 22765, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 2555, 0, 0, 0, 22765, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2555, 0, 0, 0, 22765, 0x2424, 0x00, 0x00, 0x4010, 0x000001DC, 0x2424 },
{ 776, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 776, 0, 0, 0, 22765, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22765, 0x0386, 0x40, 0x01, 0x4010, 0x000001DC, 0x0386 },
{ 7151, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7151, 0, 0, 0, 22765, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7151, 0, 0, 0, 22765, 0x0219, 0x40, 0x01, 0x4010, 0x000001DC, 0x0219 },
{ 3427, 0, 0, 0, 22765, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3427, 0, 0, 0, 22765, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3427, 0, 0, 0, 22765, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 3427, 0, 0, 0, 22765, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 3427, 0, 0, 0, 22765, 0x0763, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0763 },
{ 0, 0, 0, 0, 22765, 0x1CA5, 0xE0, 0x34, 0x0F00, 0x00000036, 0x1CA5 },
{ 3276, 0, 0, 0, 22766, 0x8573, 0x00, 0x20, 0xC020, 0x40088E51, 0x0573 },
{ 3276, 0, 0, 0, 22766, 0x2840, 0x00, 0x00, 0x0100, 0x00005ADA, 0x122E },
{ 6459, 0, 0, 0, 22766, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6459, 0, 0, 0, 22766, 0x0F51, 0x00, 0x00, 0x0A00, 0x40055ACE, 0x0829 },
{ 6459, 0, 0, 0, 22766, 0x08AD, 0x00, 0x00, 0x4010, 0x000001DC, 0x08AD },
{ 3335, 0, 0, 0, 22766, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 3335, 0, 0, 0, 22766, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3335, 0, 0, 0, 22766, 0x0968, 0x00, 0x00, 0x4010, 0x000001DC, 0x0968 },
{ 6458, 0, 0, 0, 22766, 0x1CA6, 0x00, 0x00, 0x0F00, 0x00000036, 0x1CA6 },
{ 6458, 0, 0, 0, 22766, 0x0309, 0x00, 0x00, 0x0100, 0x0000591A, 0x030B },
{ 6458, 0, 0, 0, 22766, 0x0F51, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0829 },
{ 4541, 0, 0, 0, 22766, 0x0018, 0x20, 0x01, 0x30C1, 0x00083BDC, 0x0018 },
{ 4541, 0, 0, 0, 22766, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4541, 0, 0, 0, 22766, 0x1156, 0x00, 0x00, 0x0A00, 0x40055ACE, 0x03D6 },
{ 4541, 0, 0, 0, 22766, 0x08AD, 0x40, 0x01, 0x4010, 0x000001DC, 0x08AD },
{ 3384, 0, 0, 0, 22766, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3384, 0, 0, 0, 22766, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 3384, 0, 0, 0, 22766, 0x1C8F, 0x00, 0x00, 0x4010, 0x000001DC, 0x1C8F },
{ 8267, 0, 0, 0, 22766, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 8267, 0, 0, 0, 22766, 0x03A0, 0x40, 0x01, 0x8010, 0x000001DD, 0x00D0 },
{ 3335, 0, 0, 0, 22766, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 3335, 0, 0, 0, 22766, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3335, 0, 0, 0, 22766, 0x0968, 0x00, 0x00, 0x4010, 0x000001DC, 0x0968 },
{ 3336, 0, 0, 0, 22766, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3336, 0, 0, 0, 22766, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 3336, 0, 0, 0, 22766, 0x0590, 0x00, 0x00, 0x4010, 0x000001DC, 0x0590 },
{ 982, 0, 0, 0, 22766, 0x23FA, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0BCD },
{ 6213, 0, 0, 0, 22766, 0x1CA5, 0x40, 0x01, 0x0F00, 0x00000036, 0x1CA5 },
{ 6213, 0, 0, 0, 22766, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 6213, 0, 0, 0, 22766, 0x03C2, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03C2 },
{ 483, 0, 0, 0, 22766, 0x0262, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0262 },
{ 457, 0, 0, 0, 22766, 0x08AB, 0xC0, 0x34, 0x8010, 0x000001DD, 0x0342 },
{ 1945, 0, 0, 0, 22767, 0x8156, 0x00, 0x20, 0x4010, 0x000001DC, 0x0156 },
{ 559, 0, 0, 0, 22767, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 559, 0, 0, 0, 22767, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 559, 0, 0, 0, 22767, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 559, 0, 0, 0, 22767, 0x0A87, 0x00, 0x00, 0x0100, 0x00005ADA, 0x011D },
{ 6086, 0, 0, 0, 22767, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 6086, 0, 0, 0, 22767, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6086, 0, 0, 0, 22767, 0x058C, 0x40, 0x01, 0x4010, 0x000001DC, 0x058C },
{ 6974, 0, 0, 0, 22767, 0x8643, 0x20, 0x01, 0x0100, 0x00005AC2, 0x0643 },
{ 1748, 0, 0, 0, 22767, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 1748, 0, 0, 0, 22767, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1748, 0, 0, 0, 22767, 0x0262, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0262 },
{ 68, 0, 0, 0, 22767, 0x0B52, 0x40, 0x01, 0x4010, 0x000001DC, 0x0B52 },
{ 5782, 0, 0, 0, 22767, 0x8625, 0x40, 0x01, 0x0100, 0x00005AC2, 0x0625 },
{ 3384, 0, 0, 0, 22767, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 3384, 0, 0, 0, 22767, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3384, 0, 0, 0, 22767, 0x0B86, 0x80, 0x04, 0x0100, 0x00005AC9, 0x0B86 },
{ 0, 0, 0, 0, 22767, 0x8D2B, 0x40, 0x01, 0x0100, 0x00005AC2, 0x0D2B },
{ 0, 0, 0, 0, 22767, 0x0018, 0x00, 0x00, 0x30C1, 0x00083BDC, 0x0018 },
{ 0, 0, 0, 0, 22767, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 8610, 0, 0, 0, 22767, 0x037F, 0x00, 0x00, 0x0100, 0x00005ACE, 0x00CB },
{ 2091, 0, 0, 0, 22767, 0x042B, 0x00, 0x00, 0x0F00, 0x40008470, 0x042B },
{ 2091, 0, 0, 0, 22767, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 2091, 0, 0, 0, 22767, 0x02ED, 0x00, 0x00, 0x4010, 0x000001DC, 0x02ED },
{ 3701, 0, 0, 0, 22767, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3701, 0, 0, 0, 22767, 0x1351, 0x40, 0x01, 0x4010, 0x000001DC, 0x1351 },
{ 0, 0, 0, 0, 22767, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22767, 0x0B99, 0x02, 0x00, 0x3E00, 0x81018470, 0x0B99 },
{ 0, 0, 0, 0, 22767, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 7307, 0, 0, 0, 22767, 0x001C, 0x00, 0x00, 0x0D01, 0x00003A1C, 0x001C },
{ 7307, 0, 0, 0, 22767, 0x0D76, 0x00, 0x00, 0x4010, 0x000001DC, 0x0D76 },
{ 7130, 0, 0, 0, 22767, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 7130, 0, 0, 0, 22767, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 7130, 0, 0, 0, 22767, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 7130, 0, 0, 0, 22767, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7130, 0, 0, 0, 22767, 0x098A, 0x00, 0x00, 0x4010, 0x000001DC, 0x8403 },
{ 0, 0, 0, 0, 22767, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 0, 0, 0, 0, 22767, 0x0018, 0xE0, 0x34, 0x30C1, 0x00083BDC, 0x0018 },
{ 3068, 0, 0, 0, 22768, 0x805D, 0x00, 0x20, 0x00E0, 0x40080470, 0x005D },
{ 3068, 0, 0, 0, 22768, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22768, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22768, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 6944, 0, 0, 0, 22768, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 6944, 0, 0, 0, 22768, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 6944, 0, 0, 0, 22768, 0x032E, 0x00, 0x00, 0x0A00, 0x0000000A, 0x032E },
{ 1964, 0, 0, 0, 22768, 0x13EB, 0x60, 0x02, 0x4010, 0x000001DC, 0x13EB },
{ 776, 0, 0, 0, 22768, 0x00CE, 0x00, 0x00, 0x0100, 0x00005AC2, 0x00CE },
{ 776, 0, 0, 0, 22768, 0x0036, 0x00, 0x00, 0x0D00, 0x00000004, 0x0036 },
{ 776, 0, 0, 0, 22768, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22768, 0x0769, 0x00, 0x00, 0x4010, 0x000001DC, 0x0769 },
{ 2013, 0, 0, 0, 22768, 0x0366, 0x00, 0x00, 0x0100, 0x00005AC2, 0x0366 },
{ 2013, 0, 0, 0, 22768, 0x1BF1, 0x00, 0x00, 0x4010, 0x000001DC, 0x1BF1 },
{ 6440, 0, 0, 0, 22768, 0x0D24, 0x00, 0x00, 0x00E0, 0x40080470, 0x0D24 },
{ 0, 0, 0, 0, 22768, 0x00A6, 0xE0, 0x74, 0x70C0, 0x01073FDC, 0x0012 },
{ 8605, 0, 0, 0, 22769, 0x0001, 0x00, 0x60, 0x0D00, 0x00000094, 0x0001 },
{ 8605, 0, 0, 0, 22769, 0x1224, 0x00, 0x00, 0x4010, 0x000001DC, 0x1224 },
{ 2265, 0, 0, 0, 22769, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2265, 0, 0, 0, 22769, 0xA03C, 0x00, 0x00, 0x4032, 0x00003A1C, 0x203C },
{ 5030, 0, 0, 0, 22769, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5030, 0, 0, 0, 22769, 0x1ABF, 0x00, 0x00, 0x4010, 0x000001DC, 0x1ABF },
{ 7692, 0, 0, 0, 22769, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 7692, 0, 0, 0, 22769, 0xACDA, 0xE0, 0x34, 0x4030, 0x000001DC, 0x2CDA },
{ 3068, 0, 0, 0, 22770, 0x0003, 0x00, 0x20, 0x0000, 0x000002A8, 0x0003 },
{ 3068, 0, 0, 0, 22770, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 8085, 0, 0, 0, 22770, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 8085, 0, 0, 0, 22770, 0x030B, 0x00, 0x00, 0x0100, 0x00005902, 0x030B },
{ 8085, 0, 0, 0, 22770, 0x0861, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0311 },
{ 8088, 0, 0, 0, 22770, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 8088, 0, 0, 0, 22770, 0x1381, 0x40, 0x01, 0x4010, 0x000001DC, 0x1381 },
{ 0, 0, 0, 0, 22770, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3372, 0, 0, 0, 22770, 0x014C, 0x00, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 3372, 0, 0, 0, 22770, 0x0C8D, 0x60, 0x02, 0x0A00, 0x0000000A, 0x0C8D },
{ 3068, 0, 0, 0, 22770, 0x0003, 0x00, 0x00, 0x0000, 0x000002A8, 0x0003 },
{ 3068, 0, 0, 0, 22770, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 2421, 0, 0, 0, 22770, 0x128C, 0x00, 0x00, 0x0100, 0x00005AC2, 0x128C },
{ 6467, 0, 0, 0, 22770, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 6467, 0, 0, 0, 22770, 0x0590, 0x00, 0x00, 0x4010, 0x000001DC, 0x0590 },
{ 7130, 0, 0, 0, 22770, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 7130, 0, 0, 0, 22770, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7130, 0, 0, 0, 22770, 0x098A, 0x00, 0x00, 0x4010, 0x000001DC, 0x8403 },
{ 8141, 0, 0, 0, 22770, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 8141, 0, 0, 0, 22770, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8141, 0, 0, 0, 22770, 0x0C40, 0x40, 0x01, 0x8010, 0x000001DD, 0x0595 },
{ 7130, 0, 0, 0, 22770, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 7130, 0, 0, 0, 22770, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7130, 0, 0, 0, 22770, 0x098A, 0x00, 0x00, 0x4010, 0x000001DC, 0x8403 },
{ 8141, 0, 0, 0, 22770, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 8141, 0, 0, 0, 22770, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8141, 0, 0, 0, 22770, 0x0C40, 0x00, 0x00, 0x8010, 0x000001DD, 0x0595 },
{ 3045, 0, 0, 0, 22770, 0x03C2, 0x00, 0x00, 0x0100, 0x00005AC2, 0x03C2 },
{ 3045, 0, 0, 0, 22770, 0x0919, 0x20, 0x01, 0x0100, 0x00005ACE, 0x0376 },
{ 7267, 0, 0, 0, 22770, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 7267, 0, 0, 0, 22770, 0x0C37, 0x00, 0x00, 0x4010, 0x000001DC, 0x0C37 },
{ 2142, 0, 0, 0, 22770, 0x2290, 0x00, 0x00, 0x0100, 0x00005AC2, 0x2290 },
{ 7355, 0, 0, 0, 22770, 0x0980, 0xE0, 0x34, 0x4010, 0x000001DC, 0x0980 },
{ 433, 0, 0, 0, 22771, 0x8098, 0x00, 0x20, 0x4030, 0x000001DC, 0x0098 },
{ 935, 0, 0, 0, 22771, 0x020A, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0222 },
{ 8487, 0, 0, 0, 22771, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 8487, 0, 0, 0, 22771, 0x8B8F, 0x40, 0x01, 0x4032, 0x00003A1C, 0x0B8F },
{ 6918, 0, 0, 0, 22771, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 6918, 0, 0, 0, 22771, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6918, 0, 0, 0, 22771, 0x832E, 0x00, 0x00, 0x0A00, 0x0000000A, 0x032E },
{ 6918, 0, 0, 0, 22771, 0x80F4, 0x00, 0x00, 0x3020, 0x00004127, 0x00F4 },
{ 2022, 0, 0, 0, 22771, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 2022, 0, 0, 0, 22771, 0x099F, 0x00, 0x00, 0x4010, 0x000001DC, 0x099F },
{ 6290, 0, 0, 0, 22771, 0x89FE, 0xE0, 0x04, 0x4031, 0x00003A1C, 0x09FE },
{ 5542, 0, 0, 0, 22771, 0x8AAA, 0xE0, 0x04, 0x4031, 0x00003A1C, 0x0AAA },
{ 1935, 0, 0, 0, 22771, 0x80A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 1935, 0, 0, 0, 22771, 0x0813, 0x00, 0x00, 0x4010, 0x000001DC, 0x0813 },
{ 3680, 0, 0, 0, 22771, 0x168A, 0x00, 0x00, 0x0100, 0x00005AC4, 0x070C },
{ 8064, 0, 0, 0, 22771, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8064, 0, 0, 0, 22771, 0x1856, 0x40, 0x01, 0x8010, 0x000001DD, 0x0FA3 },
{ 776, 0, 0, 0, 22771, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 776, 0, 0, 0, 22771, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22771, 0x0769, 0x00, 0x00, 0x4010, 0x000001DC, 0x0769 },
{ 4390, 0, 0, 0, 22771, 0x014C, 0x00, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 4390, 0, 0, 0, 22771, 0x02D0, 0x00, 0x00, 0x0A00, 0x0000000A, 0x02D0 },
{ 8416, 0, 0, 0, 22771, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 8416, 0, 0, 0, 22771, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 8416, 0, 0, 0, 22771, 0x1222, 0xE0, 0x34, 0x4010, 0x000001DC, 0x1222 },
{ 0, 0, 0, 0, 22772, 0x8038, 0x00, 0x20, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22772, 0x00A9, 0x02, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 5051, 0, 0, 0, 22772, 0x2A53, 0x00, 0x00, 0x4010, 0x000001DC, 0x2A53 },
{ 216, 0, 0, 0, 22772, 0x014C, 0x00, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 216, 0, 0, 0, 22772, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 216, 0, 0, 0, 22772, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 216, 0, 0, 0, 22772, 0x093A, 0x20, 0x01, 0x4010, 0x000001DC, 0x093A },
{ 7161, 0, 0, 0, 22772, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 7161, 0, 0, 0, 22772, 0x009C, 0x00, 0x00, 0x0100, 0x00005904, 0x030B },
{ 7161, 0, 0, 0, 22772, 0x089A, 0x00, 0x00, 0x8010, 0x000001DD, 0x0334 },
{ 0, 0, 0, 0, 22772, 0x0DEF, 0x02, 0x00, 0x0100, 0x00005AC7, 0x0222 },
{ 3027, 0, 0, 0, 22772, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 3027, 0, 0, 0, 22772, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3027, 0, 0, 0, 22772, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 3027, 0, 0, 0, 22772, 0x02FF, 0x60, 0x02, 0x4010, 0x000001DC, 0x02FF },
{ 0, 0, 0, 0, 22772, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22772, 0x0B99, 0x00, 0x00, 0x0F00, 0x40008470, 0x0B99 },
{ 0, 0, 0, 0, 22772, 0x014C, 0x02, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 2253, 0, 0, 0, 22772, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2253, 0, 0, 0, 22772, 0x0FC9, 0x00, 0x00, 0x0100, 0x00005AC7, 0x0324 },
{ 5797, 0, 0, 0, 22772, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 5797, 0, 0, 0, 22772, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 5797, 0, 0, 0, 22772, 0x0A27, 0xE0, 0x34, 0x4010, 0x000001DC, 0x0A27 },
{ 6440, 0, 0, 0, 22773, 0x8D24, 0x00, 0x20, 0x00E0, 0x40080470, 0x0D24 },
{ 3212, 0, 0, 0, 22773, 0x00A6, 0x00, 0x00, 0x70C0, 0x01073FDC, 0x0012 },
{ 3212, 0, 0, 0, 22773, 0x056E, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0010 },
{ 1698, 0, 0, 0, 22773, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1698, 0, 0, 0, 22773, 0x2C59, 0x40, 0x01, 0x4010, 0x000001DC, 0x2C59 },
{ 7565, 0, 0, 0, 22773, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7565, 0, 0, 0, 22773, 0x15F6, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x01FF },
{ 7565, 0, 0, 0, 22773, 0x06FE, 0x00, 0x00, 0x8010, 0x000001DD, 0x021D },
{ 3318, 0, 0, 0, 22773, 0x056E, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0010 },
{ 3318, 0, 0, 0, 22773, 0x07DB, 0x00, 0x00, 0x0F00, 0x00000036, 0x07DB },
{ 7272, 0, 0, 0, 22773, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 7272, 0, 0, 0, 22773, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 7272, 0, 0, 0, 22773, 0x02A4, 0xE0, 0x34, 0x8010, 0x000001DD, 0x02C4 },
{ 5975, 0, 0, 0, 22774, 0x8012, 0x00, 0x20, 0x7082, 0x01074FDC, 0x0012 },
{ 5975, 0, 0, 0, 22774, 0x0B54, 0x40, 0x01, 0x0100, 0x00005AC4, 0x0B3E },
{ 4128, 0, 0, 0, 22774, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4128, 0, 0, 0, 22774, 0x214D, 0x00, 0x00, 0x0100, 0x00005AC4, 0x19A2 },
{ 776, 0, 0, 0, 22774, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22774, 0x0769, 0x60, 0x02, 0x4010, 0x000001DC, 0x0769 },
{ 7200, 0, 0, 0, 22774, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 7200, 0, 0, 0, 22774, 0x0D29, 0x40, 0x01, 0x0100, 0x00005AC4, 0x0D2B },
{ 5425, 0, 0, 0, 22774, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5425, 0, 0, 0, 22774, 0x075C, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0759 },
{ 5425, 0, 0, 0, 22774, 0x1556, 0x00, 0x00, 0x0F00, 0x00000036, 0x1556 },
{ 1471, 0, 0, 0, 22774, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1471, 0, 0, 0, 22774, 0x19F5, 0x20, 0x01, 0x8010, 0x000001DD, 0x1180 },
{ 5703, 0, 0, 0, 22774, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5703, 0, 0, 0, 22774, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5703, 0, 0, 0, 22774, 0x2E2D, 0x00, 0x00, 0x0A00, 0x0000000A, 0x2E2D },
{ 2042, 0, 0, 0, 22774, 0x2793, 0x00, 0x00, 0x8010, 0x000001DD, 0x2184 },
{ 6327, 0, 0, 0, 22774, 0x0570, 0x00, 0x00, 0x8100, 0x000B0892, 0x000B },
{ 6327, 0, 0, 0, 22774, 0x28B4, 0x40, 0x01, 0x0100, 0x00005ACE, 0x1B6B },
{ 5769, 0, 0, 0, 22774, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5769, 0, 0, 0, 22774, 0x2804, 0x00, 0x00, 0x0A00, 0x0000000A, 0x2804 },
{ 1389, 0, 0, 0, 22774, 0x0883, 0x00, 0x00, 0x8010, 0x000001DD, 0x0327 },
{ 7817, 0, 0, 0, 22774, 0x006F, 0x00, 0x00, 0x0100, 0x00005884, 0x000D },
{ 7817, 0, 0, 0, 22774, 0x0058, 0x60, 0x02, 0x0100, 0x00005AC9, 0x0058 },
{ 1979, 0, 0, 0, 22774, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 1979, 0, 0, 0, 22774, 0x0567, 0x00, 0x00, 0x8010, 0x000001DD, 0x014E },
{ 0, 0, 0, 0, 22774, 0x003E, 0x02, 0x00, 0x0100, 0x00005852, 0x000B },
{ 5769, 0, 0, 0, 22774, 0x2E2D, 0xE0, 0x34, 0x0A00, 0x0000000A, 0x2E2D },
{ 7200, 0, 0, 0, 22775, 0x8002, 0x00, 0x20, 0x4080, 0x01074F9C, 0x0002 },
{ 7200, 0, 0, 0, 22775, 0x011C, 0x00, 0x00, 0x0100, 0x00005AC4, 0x011F },
{ 168, 0, 0, 0, 22775, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 168, 0, 0, 0, 22775, 0x0B93, 0x00, 0x00, 0x8010, 0x000001DD, 0x0515 },
{ 3572, 0, 0, 0, 22775, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3572, 0, 0, 0, 22775, 0x8E14, 0x00, 0x00, 0x4030, 0x000001DC, 0x0E14 },
{ 205, 0, 0, 0, 22775, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 205, 0, 0, 0, 22775, 0x29F9, 0x60, 0x02, 0x4010, 0x000001DC, 0x29F9 },
{ 0, 0, 0, 0, 22775, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3407, 0, 0, 0, 22775, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3407, 0, 0, 0, 22775, 0x1EEB, 0x00, 0x00, 0x8010, 0x000001DD, 0x16A1 },
{ 776, 0, 0, 0, 22775, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 776, 0, 0, 0, 22775, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22775, 0x0386, 0x00, 0x00, 0x4010, 0x000001DC, 0x0386 },
{ 4080, 0, 0, 0, 22775, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 4080, 0, 0, 0, 22775, 0x913A, 0x00, 0x00, 0x0A02, 0x00003A1C, 0x113A },
{ 7264, 0, 0, 0, 22775, 0x006F, 0x00, 0x00, 0x0100, 0x00005884, 0x000D },
{ 7264, 0, 0, 0, 22775, 0x1CD3, 0xE0, 0x34, 0x0100, 0x00005AC9, 0x1CD3 },
{ 3068, 0, 0, 0, 22776, 0x814C, 0x00, 0x20, 0x0100, 0x000B0893, 0x000B },
{ 3068, 0, 0, 0, 22776, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22776, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22776, 0x2B00, 0x00, 0x00, 0x0100, 0x00005ACE, 0x2605 },
{ 5104, 0, 0, 0, 22776, 0x1505, 0x00, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 5104, 0, 0, 0, 22776, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5104, 0, 0, 0, 22776, 0x12A5, 0xC0, 0x04, 0x8010, 0x000001DD, 0x0A6C },
{ 0, 0, 0, 0, 22776, 0x014C, 0x02, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 639, 0, 0, 0, 22776, 0x0B9E, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 639, 0, 0, 0, 22776, 0x060F, 0x00, 0x00, 0x4010, 0x000001DC, 0x060F },
{ 5104, 0, 0, 0, 22776, 0x1505, 0x00, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 5104, 0, 0, 0, 22776, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5104, 0, 0, 0, 22776, 0x12A5, 0xC0, 0x04, 0x8010, 0x000001DD, 0x0A6C },
{ 0, 0, 0, 0, 22776, 0x014C, 0x02, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 5678, 0, 0, 0, 22776, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 5678, 0, 0, 0, 22776, 0x0C37, 0x00, 0x00, 0x4010, 0x000001DC, 0x0C37 },
{ 3220, 0, 0, 0, 22776, 0x1505, 0x00, 0x00, 0x00E0, 0x40080470, 0x1505 },
{ 3220, 0, 0, 0, 22776, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3220, 0, 0, 0, 22776, 0x011E, 0x40, 0x01, 0x4010, 0x000001DC, 0x011E },
{ 7392, 0, 0, 0, 22776, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 7392, 0, 0, 0, 22776, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 7392, 0, 0, 0, 22776, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 7392, 0, 0, 0, 22776, 0x047B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x047B },
{ 5483, 0, 0, 0, 22776, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 5483, 0, 0, 0, 22776, 0x0B9E, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 5483, 0, 0, 0, 22776, 0x0FE7, 0x00, 0x00, 0x8010, 0x000001DD, 0x089B },
{ 0, 0, 0, 0, 22776, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 4818, 0, 0, 0, 22776, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 4818, 0, 0, 0, 22776, 0x1E8B, 0x00, 0x00, 0x8010, 0x000001DD, 0x1623 },
{ 3444, 0, 0, 0, 22776, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3444, 0, 0, 0, 22776, 0x28AA, 0xC0, 0x34, 0x4010, 0x000001DC, 0x28AA },
{ 7198, 0, 0, 0, 22777, 0x8137, 0x00, 0x20, 0x6028, 0x00083FBC, 0x0137 },
{ 7198, 0, 0, 0, 22777, 0x0058, 0x00, 0x00, 0x4010, 0x000001DC, 0x0058 },
{ 6181, 0, 0, 0, 22777, 0x014C, 0x00, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 6181, 0, 0, 0, 22777, 0x03BF, 0x00, 0x00, 0x0100, 0x00005ACE, 0x03C2 },
{ 6181, 0, 0, 0, 22777, 0x0A3D, 0x00, 0x00, 0x0F00, 0x00000036, 0x0A3D },
{ 5783, 0, 0, 0, 22777, 0x09B4, 0x40, 0x01, 0x0A00, 0x0000000A, 0x09B4 },
{ 0, 0, 0, 0, 22777, 0x2484, 0x02, 0x00, 0x0100, 0x00005AC7, 0x0C76 },
{ 7621, 0, 0, 0, 22777, 0x0025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 7621, 0, 0, 0, 22777, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7621, 0, 0, 0, 22777, 0x09D6, 0x00, 0x00, 0x8010, 0x000001DD, 0x0414 },
{ 4294, 0, 0, 0, 22777, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 4294, 0, 0, 0, 22777, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4294, 0, 0, 0, 22777, 0x1424, 0x40, 0x01, 0x8010, 0x000001DD, 0x0BC6 },
{ 0, 0, 0, 0, 22777, 0x028B, 0x02, 0x00, 0x0F00, 0x00000036, 0x028B },
{ 0, 0, 0, 0, 22777, 0x0137, 0x02, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 562, 0, 0, 0, 22777, 0x058F, 0xE0, 0x04, 0x4010, 0x000001DC, 0x058F },
{ 5542, 0, 0, 0, 22777, 0x8AAA, 0xE0, 0x04, 0x4031, 0x00003A1C, 0x0AAA },
{ 1234, 0, 0, 0, 22777, 0x851F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 1234, 0, 0, 0, 22777, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 1234, 0, 0, 0, 22777, 0x0DD7, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0DD7 },
{ 776, 0, 0, 0, 22777, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22777, 0x0769, 0x00, 0x00, 0x4010, 0x000001DC, 0x0769 },
{ 5104, 0, 0, 0, 22777, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 5104, 0, 0, 0, 22777, 0x12A5, 0xE0, 0x34, 0x8010, 0x000001DD, 0x0A6C },
{ 2022, 0, 0, 0, 22778, 0x8136, 0x00, 0x20, 0x0D00, 0x00000094, 0x0136 },
{ 2022, 0, 0, 0, 22778, 0x2793, 0x00, 0x00, 0x8010, 0x000001DD, 0x2184 },
{ 7200, 0, 0, 0, 22778, 0x011C, 0x00, 0x00, 0x0100, 0x00005AC4, 0x011F },
{ 0, 0, 0, 0, 22778, 0x0519, 0x40, 0x01, 0x60C0, 0x01073FBC, 0x051F },
{ 0, 0, 0, 0, 22778, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 2342, 0, 0, 0, 22778, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 2342, 0, 0, 0, 22778, 0x23F2, 0x60, 0x02, 0x0100, 0x00005AC4, 0x1CD3 },
{ 2230, 0, 0, 0, 22778, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2230, 0, 0, 0, 22778, 0x2EBE, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x21D5 },
{ 4325, 0, 0, 0, 22778, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 4325, 0, 0, 0, 22778, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4325, 0, 0, 0, 22778, 0x0C02, 0x00, 0x00, 0x4010, 0x000001DC, 0x0C02 },
{ 5674, 0, 0, 0, 22778, 0x11CE, 0x00, 0x00, 0x0100, 0x00005AC4, 0x043B },
{ 5674, 0, 0, 0, 22778, 0x000C, 0x60, 0x02, 0x00E0, 0x40080470, 0x000C },
{ 8415, 0, 0, 0, 22778, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8415, 0, 0, 0, 22778, 0x0245, 0x00, 0x00, 0x0A00, 0x4000294E, 0x0245 },
{ 5414, 0, 0, 0, 22778, 0x1CEF, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0BE7 },
{ 6963, 0, 0, 0, 22778, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 6963, 0, 0, 0, 22778, 0x0BF5, 0x40, 0x01, 0x4010, 0x000001DC, 0x0BF5 },
{ 0, 0, 0, 0, 22778, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5375, 0, 0, 0, 22778, 0x10C4, 0x00, 0x00, 0x0100, 0x00005AC4, 0x03A2 },
{ 5375, 0, 0, 0, 22778, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 3027, 0, 0, 0, 22778, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 3027, 0, 0, 0, 22778, 0x084A, 0x00, 0x00, 0x8010, 0x000001DD, 0x02FF },
{ 7315, 0, 0, 0, 22778, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 7315, 0, 0, 0, 22778, 0x0326, 0xE0, 0x34, 0x0A00, 0x0000000A, 0x0326 },
{ 8121, 0, 0, 0, 22779, 0x8136, 0x00, 0x20, 0x0D00, 0x00000094, 0x0136 },
{ 8121, 0, 0, 0, 22779, 0x0131, 0x00, 0x00, 0x4010, 0x000001DC, 0x0131 },
{ 0, 0, 0, 0, 22779, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 3394, 0, 0, 0, 22779, 0x03EB, 0x00, 0x00, 0x4010, 0x000001DC, 0x03EB },
{ 5975, 0, 0, 0, 22779, 0x0B54, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0B3E },
{ 5975, 0, 0, 0, 22779, 0x0B4C, 0x00, 0x00, 0x0F00, 0x00000036, 0x0B4C },
{ 2073, 0, 0, 0, 22779, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 2073, 0, 0, 0, 22779, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 2073, 0, 0, 0, 22779, 0x2B83, 0x60, 0x02, 0x4010, 0x000001DC, 0x2B83 },
{ 216, 0, 0, 0, 22779, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 216, 0, 0, 0, 22779, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 216, 0, 0, 0, 22779, 0x093A, 0x00, 0x00, 0x4010, 0x000001DC, 0x093A },
{ 2671, 0, 0, 0, 22779, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2671, 0, 0, 0, 22779, 0x0B9E, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 2671, 0, 0, 0, 22779, 0x0CD2, 0x00, 0x00, 0x8010, 0x000001DD, 0x062E },
{ 1980, 0, 0, 0, 22779, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 1980, 0, 0, 0, 22779, 0x056E, 0x40, 0x01, 0x0100, 0x00005AC4, 0x0010 },
{ 0, 0, 0, 0, 22779, 0x0038, 0x02, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 5051, 0, 0, 0, 22779, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 5051, 0, 0, 0, 22779, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5051, 0, 0, 0, 22779, 0x1BD4, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x0AD0 },
{ 1300, 0, 0, 0, 22779, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 1300, 0, 0, 0, 22779, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 1300, 0, 0, 0, 22779, 0x2B71, 0x00, 0x00, 0x0A00, 0x40055AC7, 0x1808 },
{ 2595, 0, 0, 0, 22779, 0x0B2B, 0xE0, 0x34, 0x4010, 0x000001DC, 0x0B2B },
{ 6805, 0, 0, 0, 22780, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 6805, 0, 0, 0, 22780, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 6805, 0, 0, 0, 22780, 0x096F, 0x00, 0x00, 0x0100, 0x00005AC9, 0x096F },
{ 6805, 0, 0, 0, 22780, 0x1CB3, 0x00, 0x00, 0x00E0, 0x40080470, 0x1CB3 },
{ 776, 0, 0, 0, 22780, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 776, 0, 0, 0, 22780, 0x0386, 0x00, 0x00, 0x4010, 0x000001DC, 0x0386 },
{ 2195, 0, 0, 0, 22780, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 2195, 0, 0, 0, 22780, 0x2E69, 0x40, 0x01, 0x4010, 0x000001DC, 0x2E69 },
{ 1758, 0, 0, 0, 22780, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 1758, 0, 0, 0, 22780, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 1758, 0, 0, 0, 22780, 0x1401, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1401 },
{ 1471, 0, 0, 0, 22780, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1471, 0, 0, 0, 22780, 0x1855, 0x00, 0x00, 0x0A00, 0x4000294E, 0x1855 },
{ 639, 0, 0, 0, 22780, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 639, 0, 0, 0, 22780, 0x060F, 0xE0, 0x34, 0x4010, 0x000001DC, 0x060F },
{ 3318, 0, 0, 0, 22781, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 3318, 0, 0, 0, 22781, 0x1D32, 0x00, 0x00, 0x6100, 0x000B589D, 0x0010 },
{ 3318, 0, 0, 0, 22781, 0x07DB, 0x00, 0x00, 0x0F00, 0x00000036, 0x07DB },
{ 3468, 0, 0, 0, 22781, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 3468, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3468, 0, 0, 0, 22781, 0x28AA, 0x00, 0x00, 0x4010, 0x000001DC, 0x28AA },
{ 5971, 0, 0, 0, 22781, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 5971, 0, 0, 0, 22781, 0x0137, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 5971, 0, 0, 0, 22781, 0x11DC, 0x40, 0x01, 0x4010, 0x000001DC, 0x11DC },
{ 0, 0, 0, 0, 22781, 0x028B, 0x02, 0x00, 0x0F00, 0x00000036, 0x028B },
{ 3468, 0, 0, 0, 22781, 0x008E, 0x00, 0x00, 0x00E0, 0x40080470, 0x008E },
{ 3468, 0, 0, 0, 22781, 0x28AA, 0x00, 0x00, 0x4010, 0x000001DC, 0x28AA },
{ 4899, 0, 0, 0, 22781, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 4899, 0, 0, 0, 22781, 0x0B9E, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 4899, 0, 0, 0, 22781, 0x1DB8, 0x20, 0x01, 0x0A00, 0x40055ACE, 0x0CB5 },
{ 4272, 0, 0, 0, 22781, 0x051F, 0x00, 0x00, 0x4080, 0x01074FBC, 0x051F },
{ 4272, 0, 0, 0, 22781, 0x29D0, 0x00, 0x00, 0x6100, 0x000B589D, 0x29D0 },
{ 7218, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7218, 0, 0, 0, 22781, 0x030E, 0x00, 0x00, 0x4010, 0x000001DC, 0x030E },
{ 1004, 0, 0, 0, 22781, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 1004, 0, 0, 0, 22781, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 1004, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1004, 0, 0, 0, 22781, 0x08A3, 0x00, 0x00, 0x4010, 0x000001DC, 0x08A3 },
{ 7563, 0, 0, 0, 22781, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7563, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7563, 0, 0, 0, 22781, 0x148E, 0x40, 0x01, 0x0A00, 0x0000000A, 0x148E },
{ 6168, 0, 0, 0, 22781, 0x000C, 0x00, 0x00, 0x00E0, 0x40080470, 0x000C },
{ 6168, 0, 0, 0, 22781, 0x2E08, 0x00, 0x00, 0x0100, 0x00005AC7, 0x1F2D },
{ 3247, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3247, 0, 0, 0, 22781, 0x2B58, 0x00, 0x00, 0x4010, 0x000001DC, 0x2B58 },
{ 6677, 0, 0, 0, 22781, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 6677, 0, 0, 0, 22781, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6677, 0, 0, 0, 22781, 0x0401, 0xE0, 0x04, 0x4010, 0x000001DC, 0x0401 },
{ 5542, 0, 0, 0, 22781, 0x8AAA, 0xE0, 0x34, 0x4031, 0x00003A1C, 0x0AAA },
{ 5344, 0, 0, 0, 22782, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 5344, 0, 0, 0, 22782, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 5344, 0, 0, 0, 22782, 0x13AD, 0x00, 0x00, 0x0100, 0x00005AC9, 0x13AD },
{ 5344, 0, 0, 0, 22782, 0x1CB3, 0x00, 0x00, 0x00E0, 0x40080470, 0x1CB3 },
{ 4294, 0, 0, 0, 22782, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 4294, 0, 0, 0, 22782, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 4294, 0, 0, 0, 22782, 0x139B, 0x00, 0x00, 0x8010, 0x000001DD, 0x139B },
{ 7218, 0, 0, 0, 22782, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7218, 0, 0, 0, 22782, 0x030E, 0x00, 0x00, 0x4010, 0x000001DC, 0x030E },
{ 6518, 0, 0, 0, 22782, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 6518, 0, 0, 0, 22782, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 6518, 0, 0, 0, 22782, 0x2421, 0x60, 0x02, 0x8010, 0x000001DD, 0x1CFB },
{ 5590, 0, 0, 0, 22782, 0x051C, 0x00, 0x00, 0xB080, 0x01074FDD, 0x051C },
{ 5590, 0, 0, 0, 22782, 0x020A, 0x00, 0x00, 0x0100, 0x00005AC4, 0x0222 },
{ 5590, 0, 0, 0, 22782, 0x00F7, 0x00, 0x00, 0x0F00, 0x00000036, 0x00F7 },
{ 5590, 0, 0, 0, 22782, 0x0009, 0x00, 0x00, 0x00E0, 0x40080470, 0x0009 },
{ 5590, 0, 0, 0, 22782, 0x0001, 0x00, 0x00, 0x0D00, 0x00000094, 0x0001 },
{ 5590, 0, 0, 0, 22782, 0x29BC, 0x00, 0x00, 0x4010, 0x000001DC, 0x29BC },
{ 6327, 0, 0, 0, 22782, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 6327, 0, 0, 0, 22782, 0x1B6B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1B6B },
{ 5951, 0, 0, 0, 22782, 0x001A, 0x60, 0x02, 0x40C0, 0x01073F9C, 0x0002 },
{ 5951, 0, 0, 0, 22782, 0x0B98, 0x00, 0x00, 0xB028, 0x00083FDD, 0x0B98 },
{ 5951, 0, 0, 0, 22782, 0x2875, 0x00, 0x00, 0x0010, 0x40075AC7, 0x1B10 },
{ 0, 0, 0, 0, 22782, 0x014C, 0x02, 0x00, 0x0100, 0x000B0893, 0x000B },
{ 398, 0, 0, 0, 22782, 0x0009, 0x00, 0x00, 0x0F00, 0x40008470, 0x0009 },
{ 398, 0, 0, 0, 22782, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 398, 0, 0, 0, 22782, 0x0E4F, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0E4F },
{ 6041, 0, 0, 0, 22782, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6041, 0, 0, 0, 22782, 0x0454, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0454 },
{ 4565, 0, 0, 0, 22782, 0x22E5, 0xE0, 0x34, 0x0F00, 0x8000D94E, 0x12EC },
{ 1869, 0, 0, 0, 22783, 0x851F, 0x00, 0x20, 0x4080, 0x01074FBC, 0x051F },
{ 1869, 0, 0, 0, 22783, 0x073D, 0x00, 0x00, 0x6100, 0x000B109D, 0x000D },
{ 1869, 0, 0, 0, 22783, 0x055B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x055B },
{ 3220, 0, 0, 0, 22783, 0x1CB3, 0x00, 0x00, 0x00E0, 0x40080470, 0x1CB3 },
{ 3220, 0, 0, 0, 22783, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3220, 0, 0, 0, 22783, 0x011E, 0x00, 0x00, 0x4010, 0x000001DC, 0x011E },
{ 5483, 0, 0, 0, 22783, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 5483, 0, 0, 0, 22783, 0x0B9E, 0x00, 0x00, 0x6028, 0x00083FBC, 0x0137 },
{ 5483, 0, 0, 0, 22783, 0x0FE7, 0x40, 0x01, 0x8010, 0x000001DD, 0x089B },
{ 0, 0, 0, 0, 22783, 0x1CB3, 0x02, 0x00, 0x00E0, 0x40080470, 0x1CB3 },
{ 2563, 0, 0, 0, 22783, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2563, 0, 0, 0, 22783, 0x0310, 0x00, 0x00, 0x4010, 0x000001DC, 0x0310 },
{ 7227, 0, 0, 0, 22783, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 7227, 0, 0, 0, 22783, 0x082A, 0x00, 0x00, 0x0A00, 0x0000000A, 0x082A },
{ 4325, 0, 0, 0, 22783, 0x1479, 0xE0, 0x34, 0x8010, 0x000001DD, 0x0C02 },
{ 8085, 0, 0, 0, 22784, 0x8574, 0x00, 0x20, 0xCC00, 0x40018E51, 0x0574 },
{ 8085, 0, 0, 0, 22784, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 8085, 0, 0, 0, 22784, 0x0861, 0x40, 0x01, 0x0100, 0x00005AC4, 0x0311 },
{ 990, 0, 0, 0, 22784, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 990, 0, 0, 0, 22784, 0x067A, 0x00, 0x00, 0x4010, 0x000001DC, 0x067A },
{ 7264, 0, 0, 0, 22784, 0x23F2, 0x20, 0x01, 0x0100, 0x00005AC4, 0x1CD3 },
{ 8193, 0, 0, 0, 22784, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 8193, 0, 0, 0, 22784, 0x03A9, 0x00, 0x00, 0x8010, 0x000001DD, 0x00D1 },
{ 6750, 0, 0, 0, 22784, 0x2267, 0x00, 0x00, 0x0100, 0x00005ACE, 0x1247 },
{ 6963, 0, 0, 0, 22784, 0x000A, 0x00, 0x00, 0x00E0, 0x40080470, 0x000A },
{ 6963, 0, 0, 0, 22784, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6963, 0, 0, 0, 22784, 0x0BF5, 0x60, 0x02, 0x4010, 0x000001DC, 0x0BF5 },
{ 7538, 0, 0, 0, 22784, 0x2CB6, 0x00, 0x00, 0x4010, 0x000001DC, 0x2CB6 },
{ 935, 0, 0, 0, 22784, 0x174E, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0790 },
{ 6106, 0, 0, 0, 22784, 0x0349, 0x00, 0x00, 0x00E0, 0x40080470, 0x0349 },
{ 6106, 0, 0, 0, 22784, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 6106, 0, 0, 0, 22784, 0x069B, 0x40, 0x01, 0x8010, 0x000001DD, 0x01F0 },
{ 7264, 0, 0, 0, 22784, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7264, 0, 0, 0, 22784, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 7264, 0, 0, 0, 22784, 0x23F2, 0x00, 0x00, 0x0100, 0x00005AC4, 0x1CD3 },
{ 5117, 0, 0, 0, 22784, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 5117, 0, 0, 0, 22784, 0x116F, 0x40, 0x01, 0x4100, 0x0008639C, 0x116F },
{ 5117, 0, 0, 0, 22784, 0x0518, 0x00, 0x00, 0x0C00, 0x00000E74, 0x0518 },
{ 5117, 0, 0, 0, 22784, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 5117, 0, 0, 0, 22784, 0x098B, 0x00, 0x00, 0x0100, 0x000059A4, 0x00DD },
{ 5117, 0, 0, 0, 22784, 0x0478, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0478 },
{ 3117, 0, 0, 0, 22784, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 3117, 0, 0, 0, 22784, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3117, 0, 0, 0, 22784, 0x006C, 0x00, 0x00, 0x4010, 0x000001DC, 0x006C },
{ 6869, 0, 0, 0, 22784, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 6869, 0, 0, 0, 22784, 0x1CD8, 0x60, 0x02, 0x4010, 0x000001DC, 0x1CD8 },
{ 5927, 0, 0, 0, 22784, 0x0574, 0x00, 0x00, 0xCC00, 0x40018E51, 0x0574 },
{ 5927, 0, 0, 0, 22784, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 5927, 0, 0, 0, 22784, 0x0DEE, 0x00, 0x00, 0x0100, 0x00005ADA, 0x0222 },
{ 5927, 0, 0, 0, 22784, 0x0026, 0x00, 0x00, 0x0F00, 0x40008470, 0x0026 },
{ 5971, 0, 0, 0, 22784, 0x0540, 0x00, 0x00, 0x00E0, 0x40080470, 0x0540 },
{ 5971, 0, 0, 0, 22784, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5971, 0, 0, 0, 22784, 0x11DC, 0x40, 0x01, 0x4010, 0x000001DC, 0x11DC },
{ 1464, 0, 0, 0, 22784, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 1464, 0, 0, 0, 22784, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 1464, 0, 0, 0, 22784, 0x1010, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1010 },
{ 1464, 0, 0, 0, 22784, 0x051A, 0x00, 0x00, 0xB0C0, 0x01073FDD, 0x051C },
{ 1464, 0, 0, 0, 22784, 0x0586, 0x00, 0x00, 0x00E0, 0x40080470, 0x0586 },
{ 1464, 0, 0, 0, 22784, 0x00A9, 0x00, 0x00, 0x702B, 0x00083FDC, 0x00A9 },
{ 1464, 0, 0, 0, 22784, 0x1427, 0xE0, 0x34, 0x8010, 0x000001DD, 0x0BCA },
{ 8384, 0, 0, 0, 22785, 0x9DAE, 0x00, 0x20, 0x0C00, 0x00000073, 0x1DAE },
{ 8384, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 8384, 0, 0, 0, 22785, 0x008A, 0x00, 0x00, 0x4010, 0x000001DC, 0x008A },
{ 8384, 0, 0, 0, 22785, 0x0535, 0x00, 0x00, 0x4010, 0x000001DC, 0x0535 },
{ 6524, 0, 0, 0, 22785, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6524, 0, 0, 0, 22785, 0x00EA, 0x00, 0x00, 0x0A00, 0x00000318, 0x00EA },
{ 6524, 0, 0, 0, 22785, 0x15C4, 0x40, 0x01, 0x0100, 0x00005AC9, 0x15C4 },
{ 0, 0, 0, 0, 22785, 0x19FF, 0x00, 0x00, 0x0D00, 0x00000098, 0x19FF },
{ 0, 0, 0, 0, 22785, 0x0ABC, 0x02, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 2981, 0, 0, 0, 22785, 0x07EB, 0x00, 0x00, 0x4010, 0x000001DC, 0x07EB },
{ 0, 0, 0, 0, 22785, 0x000B, 0x02, 0x00, 0x0100, 0x00005849, 0x000B },
{ 1612, 0, 0, 0, 22785, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 1612, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 1612, 0, 0, 0, 22785, 0x0BF1, 0x20, 0x01, 0x8010, 0x000001DD, 0x0554 },
{ 4639, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4639, 0, 0, 0, 22785, 0x1098, 0x00, 0x00, 0x4010, 0x000001DC, 0x1098 },
{ 2132, 0, 0, 0, 22785, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 2132, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 2132, 0, 0, 0, 22785, 0x09DD, 0x00, 0x00, 0x4010, 0x000001DC, 0x09DD },
{ 3584, 0, 0, 0, 22785, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 3584, 0, 0, 0, 22785, 0x0298, 0x40, 0x01, 0x0100, 0x00005AC9, 0x0298 },
{ 7709, 0, 0, 0, 22785, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7709, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7709, 0, 0, 0, 22785, 0x0EE1, 0x00, 0x00, 0x8010, 0x000001DD, 0x07BB },
{ 6213, 0, 0, 0, 22785, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 6213, 0, 0, 0, 22785, 0x0C41, 0x00, 0x00, 0x0100, 0x00005AC9, 0x0C41 },
{ 400, 0, 0, 0, 22785, 0x001C, 0x00, 0x00, 0x0D01, 0x00003A1C, 0x001C },
{ 400, 0, 0, 0, 22785, 0x03D2, 0x20, 0x01, 0x4010, 0x000001DC, 0x03D2 },
{ 6629, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 6629, 0, 0, 0, 22785, 0x07CD, 0x00, 0x00, 0x4010, 0x000001DC, 0x07CD },
{ 1504, 0, 0, 0, 22785, 0x0ABC, 0x00, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 1504, 0, 0, 0, 22785, 0x000B, 0x00, 0x00, 0x0100, 0x00005849, 0x000B },
{ 1504, 0, 0, 0, 22785, 0x0069, 0x00, 0x00, 0x0100, 0x00005ACE, 0x0069 },
{ 1504, 0, 0, 0, 22785, 0x00F0, 0x00, 0x00, 0x0F00, 0x40008470, 0x00F0 },
{ 4356, 0, 0, 0, 22785, 0x02CE, 0x00, 0x00, 0x00E0, 0x40080470, 0x02CE },
{ 4356, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 4356, 0, 0, 0, 22785, 0x02C0, 0x40, 0x01, 0x4010, 0x000001DC, 0x02C0 },
{ 0, 0, 0, 0, 22785, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 0, 0, 0, 0, 22785, 0x0B99, 0x02, 0x00, 0x3E00, 0x81018470, 0x0B99 },
{ 0, 0, 0, 0, 22785, 0x0ABC, 0x02, 0x00, 0x0100, 0x000059A2, 0x0ABC },
{ 0, 0, 0, 0, 22785, 0x000B, 0x02, 0x00, 0x0100, 0x00005849, 0x000B },
{ 1241, 0, 0, 0, 22785, 0x001C, 0x00, 0x00, 0x0D01, 0x00003A1C, 0x001C },
{ 1241, 0, 0, 0, 22785, 0x031F, 0x00, 0x00, 0x4010, 0x000001DC, 0x031F },
{ 7517, 0, 0, 0, 22785, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 7517, 0, 0, 0, 22785, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 7517, 0, 0, 0, 22785, 0x139A, 0x60, 0x32, 0x8010, 0x000001DD, 0x0B3C },
{ 5937, 0, 0, 0, 22786, 0x815B, 0x00, 0x20, 0x0F00, 0x00000036, 0x015B },
{ 5937, 0, 0, 0, 22786, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 5937, 0, 0, 0, 22786, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 5937, 0, 0, 0, 22786, 0x1B10, 0x00, 0x00, 0x0100, 0x00005AC9, 0x1B10 },
{ 3068, 0, 0, 0, 22786, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 3068, 0, 0, 0, 22786, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 3068, 0, 0, 0, 22786, 0x83B2, 0x40, 0x01, 0x4010, 0x000001DC, 0x03B2 },
{ 1523, 0, 0, 0, 22786, 0x8002, 0x00, 0x00, 0x4080, 0x01074F9C, 0x0002 },
{ 1523, 0, 0, 0, 22786, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 1523, 0, 0, 0, 22786, 0x00C1, 0x00, 0x00, 0x0100, 0x00005AC9, 0x00C1 },
{ 430, 0, 0, 0, 22786, 0x0015, 0x00, 0x00, 0x00E0, 0x40080470, 0x0015 },
{ 430, 0, 0, 0, 22786, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 430, 0, 0, 0, 22786, 0x8098, 0x00, 0x00, 0x4010, 0x000001DC, 0x0098 },
{ 3468, 0, 0, 0, 22786, 0x001D, 0x00, 0x00, 0x0400, 0x80004206, 0x001D },
{ 3468, 0, 0, 0, 22786, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 3468, 0, 0, 0, 22786, 0x28AA, 0xE0, 0x34, 0x4010, 0x000001DC, 0x28AA },
{ 3069, 0, 0, 0, 22787, 0x8136, 0x00, 0x20, 0x0D00, 0x00000094, 0x0136 },
{ 3069, 0, 0, 0, 22787, 0x83B2, 0x00, 0x00, 0x4010, 0x000001DC, 0x03B2 },
{ 0, 0, 0, 0, 22787, 0x8098, 0x00, 0x00, 0x4030, 0x000001DC, 0x0098 },
{ 0, 0, 0, 0, 22787, 0x0017, 0x02, 0x00, 0x0100, 0x0000585A, 0x000B },
{ 2428, 0, 0, 0, 22787, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 2428, 0, 0, 0, 22787, 0x237C, 0x40, 0x01, 0x4010, 0x000001DC, 0x237C },
{ 7760, 0, 0, 0, 22787, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 7760, 0, 0, 0, 22787, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 7760, 0, 0, 0, 22787, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 7760, 0, 0, 0, 22787, 0x03C2, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03C2 },
{ 7272, 0, 0, 0, 22787, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 7272, 0, 0, 0, 22787, 0x02A4, 0x00, 0x00, 0x8010, 0x000001DD, 0x02C4 },
{ 355, 0, 0, 0, 22787, 0x03A4, 0x00, 0x00, 0x0F00, 0x800006CA, 0x03A4 },
{ 355, 0, 0, 0, 22787, 0x0884, 0x10, 0x00, 0x8010, 0x000001DD, 0x0328 },
{ 0, 0, 0, 0, 22787, 0x02A4, 0x42, 0x01, 0x8010, 0x000001DD, 0x02C4 },
{ 1869, 0, 0, 0, 22787, 0x0038, 0x00, 0x00, 0x0C00, 0x00000063, 0x0038 },
{ 1869, 0, 0, 0, 22787, 0x0012, 0x00, 0x00, 0x7082, 0x01074FDC, 0x0012 },
{ 1869, 0, 0, 0, 22787, 0x057C, 0x00, 0x00, 0x0100, 0x000059A2, 0x057C },
{ 1869, 0, 0, 0, 22787, 0x03C2, 0x00, 0x00, 0x0100, 0x00005AC9, 0x03C2 },
{ 1869, 0, 0, 0, 22787, 0x001A, 0x00, 0x00, 0x40C0, 0x01073F9C, 0x0002 },
{ 1869, 0, 0, 0, 22787, 0x0025, 0x00, 0x00, 0x3E00, 0x81018470, 0x0025 },
{ 1869, 0, 0, 0, 22787, 0x055B, 0x00, 0x00, 0x0100, 0x00005AC9, 0x055B },
{ 1116, 0, 0, 0, 22787, 0x0541, 0x00, 0x00, 0x00E0, 0x40080470, 0x0541 },
{ 1116, 0, 0, 0, 22787, 0x03E0, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 1116, 0, 0, 0, 22787, 0x0326, 0x00, 0x00, 0x0A00, 0x0000000A, 0x0326 },
{ 1116, 0, 0, 0, 22787, 0x1203, 0xE0, 0x04, 0x8010, 0x000001DD, 0x0A19 },
{ 5329, 0, 0, 0, 22787, 0x8025, 0x00, 0x00, 0x00E0, 0x40080470, 0x0025 },
{ 5329, 0, 0, 0, 22787, 0x0136, 0x00, 0x00, 0x0D00, 0x00000094, 0x0136 },
{ 5329, 0, 0, 0, 22787, 0x06E7, 0x00, 0x00, 0x0A00, 0x4000294E, 0x06E7 },
{ 5329, 0, 0, 0, 22787, 0x1357, 0x00, 0x00, 0x4010, 0x000001DC, 0x1357 },
{ 5058, 0, 0, 0, 22787, 0x0020, 0x00, 0x00, 0x00E0, 0x00003A1C, 0x0020 },
{ 5058, 0, 0, 0, 22787, 0x001B, 0x00, 0x00, 0x4028, 0x00083F9C, 0x001B },
{ 5058, 0, 0, 0, 22787, 0x237F, 0x00, 0x00, 0x0A00, 0x0000000A, 0x237F },
{ 5058, 0, 0, 0, 22787, 0x2E77, 0xE0, 0xF4, 0x8010, 0x000001DD, 0x2BC4 }
};
|
75157015dfb366f6b213090ecaf9797b994b51da | 6a310dfa54ed2bb17adeada34f5952d4c2216dab | /MathsLib/Matrix4.cpp | b1d727827836ed147e8c058194a739a950e6a92d | [] | no_license | Mondotrasho/MathsLib | 3a144ff09d985e5bc51c5f71f934084af81b00c8 | 26837881312d2b62c044a3f72bc0f251f0c7f89c | refs/heads/master | 2020-03-20T21:02:44.214132 | 2019-03-07T02:36:14 | 2019-03-07T02:36:14 | 137,720,721 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,722 | cpp | Matrix4.cpp | #include "Matrix4.h"
#include <math.h>
Matrix4::Matrix4(): data{ { 0,0,0,0 },{ 0,0,0,0 },{ 0,0,0,0 },{ 0,0,0,0 } }
{
}
Matrix4::~Matrix4()
= default;
Matrix4::Matrix4(const Matrix4& Matrix) : x_axis(Matrix.x_axis), y_axis(Matrix.y_axis), z_axis(Matrix.z_axis), translation(Matrix.translation)
{
}
Matrix4::Matrix4(const Vector4& new_x_ax, const Vector4& new_y_ax, const Vector4& new_z_ax, const Vector4& new_w_ax) : x_axis(new_x_ax), y_axis(new_y_ax), z_axis(new_z_ax), translation(new_w_ax)
{
}
Matrix4::Matrix4(const float a, const float b, const float c, const float d, const float e, const float f, const float g, const float h, const float i, const float j, const float k, const float l, const float m, const float n, const float o, const float p) : data{ { a,b,c,d },{ e,f,g,h },{ i,j,k,l },{ m,n,o,p } }
{
}
// create a static const identity Matrix
const Matrix4 Matrix4::identity = Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
// reference access so it can be modified
Vector4& Matrix4::operator [] (const int index) {
return axis[index];
}
// const access for read-only
const Vector4& Matrix4::operator [] (const int index) const {
return axis[index];
}
Matrix4 Matrix4::operator * (const Matrix4& other) const {
Matrix4 result;
for (auto r = 0; r < 4; ++r) {
for (auto c = 0; c < 4; ++c) {
result.data[c][r] =
data[0][r] * other.data[c][0] +
data[1][r] * other.data[c][1] +
data[2][r] * other.data[c][2] +
data[3][r] * other.data[c][3];
}
}
return result;
}
Vector4 Matrix4::operator * (const Vector4& v) const {
Vector4 result;
for (auto r = 0; r < 4; ++r) {
result[r] =
data[0][r] * v[0] +
data[1][r] * v[1] +
data[2][r] * v[2] +
data[3][r] * v[3];
}
return result;
}
Matrix4& Matrix4::operator=(const Matrix4& other)
{
x_axis = other.x_axis;
y_axis = other.y_axis;
z_axis = other.z_axis;
translation = other.translation;
return *this;
}
Matrix4 Matrix4::transposed() const {
Matrix4 result;
// flip row and column
for (int r = 0; r < 4; ++r)
for (int c = 0; c < 4; ++c)
result.data[r][c] = data[c][r];
return result;
}
void Matrix4::setScaled(float x, float y, float z) {
// set scale of each axis
x_axis = { x, 0, 0, 0 };
y_axis = { 0, y, 0, 0 };
z_axis = { 0, 0, z, 0 };
translation = { 0, 0, 0, 1 };
}
void Matrix4::setRotateX(float radians) { //WHY IS THIS HERE
// leave X axis and elements unchanged
x_axis = { 1, 0, 0, 0 };
y_axis = { 0, cosf(radians), sinf(radians), 0 };
z_axis = { 0, -sinf(radians), cosf(radians), 0 };
translation = { 0, 0, 0, 1 };
}
void Matrix4::rotate_x(const float radians) {
Matrix4 m;
m.setRotateX(radians);
*this = *this * m;
}
void Matrix4::setRotateY(const float radians) {
// leave X axis and elements unchanged
x_axis = { cosf(radians), 0,-sinf(radians),0 };
y_axis = { 0, 1, 0,0 };
z_axis = { sinf(radians),0 , cosf(radians),0 };
translation = { 0, 0, 0, 1 };
}
void Matrix4::rotate_y(const float radians) {
Matrix4 m;
m.setRotateY(radians);
*this = *this * m;
}
void Matrix4::setRotateZ(const float radians) {
// leave X axis and elements unchanged
x_axis = { cosf(radians), sinf(radians), 0,0 };
y_axis = { -sinf(radians), cosf(radians),0,0 };
z_axis = { 0, 0,1,0 };
translation = { 0, 0, 0, 1 };
}
void Matrix4::rotate_z(const float radians) {
Matrix4 m;
m.setRotateZ(radians);
*this = *this * m;
}
void Matrix4::set_euler(const float pitch, const float yaw, const float roll) {
Matrix4 x, y, z;
x.setRotateX(pitch);
y.setRotateY(yaw);
z.setRotateZ(roll);
// combine rotations in a specific order
*this = z * y * x;
}
void Matrix4::translate(float x, float y, float z) {
// apply vector offset
translation += Vector4(x, y, z, 0);
}
|
641700ca1c855ec881efe32b8d87cc4bf6c2be33 | 6068b59b73cb2897d508c3c966291658c7da864e | /meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-clang.inc | c5b746341fe9c54b3677e7ad1708fb797a6062aa | [
"MIT"
] | permissive | HCLOpenBMC/openbmc | 4f0699074168d75773ee23d879e4508ab0bc19c8 | 6b38051dd74ae395e774daa8593afa79e6f07023 | refs/heads/master | 2023-04-07T11:28:58.829854 | 2023-03-22T09:02:03 | 2023-03-29T06:50:48 | 246,829,632 | 1 | 1 | NOASSERTION | 2020-06-22T07:18:46 | 2020-03-12T12:33:52 | Python | UTF-8 | C++ | false | false | 300 | inc | linux-arm64-ack-clang.inc | # Clang-specific configuration of kernel build
# We need to add this dependency as the kernel configuration depends on the compiler
do_kernel_configme[depends] += "androidclang-native:do_populate_sysroot"
DEPENDS:append = " androidclang-native"
KERNEL_CC = "${CCACHE}clang ${HOST_CC_KERNEL_ARCH}"
|
6a7a3300bc650814a813e870cdba5f293da48ccb | 279067393024ac3bbced2c1fd51a6cbf556bb237 | /Projects/RGB-LED-Wireling-Driver/software/Wireling-Driver-for-RGB-LED/Wireling-Driver-for-RGB-LED.ino | 3d00f912e3195470b124d131322d7fd1390bd830 | [] | no_license | TinyCircuits/Wiki-Tutorials-Supporting-Files | 282fe9d139ec2c291091f6dfd02dbd0f12a51f53 | a59605dddcc655574f5eb4fd811898ebfe0bf39f | refs/heads/master | 2022-10-18T06:26:31.614773 | 2022-09-19T19:14:48 | 2022-09-19T19:14:48 | 190,281,098 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,205 | ino | Wireling-Driver-for-RGB-LED.ino | /*
TinyCircuits Wireling Driver for RGB LED
This program uses three separate Wireling inputs to drive a strip of RGB LEDs.
Port 0: RGB LED Strip
Port 1: Capacitive Touch - drives the brightness of the LEDs
Port 2: Rotary - drives the color of the LEDs
Port 3: Joystick - drives the position and number of LEDs shown
Written March 2020
By Hunter Hykes
https://TinyCircuits.com
*/
#include <Wire.h>
#include <Wireling.h>
#include <FastLED.h> // For interfacing with the RGB LED
#include <SX1505.h> // For interfacing with Joystick and Rotary Switch Wirelings
#include <ATtiny841Lib.h> // For ATtiny841 on Cap Touch Wireling
#include <CapTouchWireling.h> // For Cap Touch Wireling
// Universal Serial Monitor Config
#if defined (ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#endif
/* * * * * * * * * * RGB LED * * * * * * * * * */
#define NUM_LEDS 60 //this is the number of LEDs in your strip
#define DATA_PIN A0 //this is the number on the silkscreen you want to use
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
int brightness = 10; //value from 0-255 to manipulate brightness
CRGB color = CRGB(0, 255, 0); // (g, r, b) -> red
/* * * * * * * * * Cap Touch * * * * * * * * * */
#define CAP_PORT 2
CapTouchWireling capTouch;
int pos;
int mag;
/* * * * * * * * * * Rotary * * * * * * * * * */
#define ROT_PORT 1
TinyRotary rotary = TinyRotary();
uint8_t rotaryValue;
/* * * * * * * * * * Joystick * * * * * * * * * */
#define JS_PORT 3
TinyJoystick joystick = TinyJoystick();
int width = 1, LEDpos = 0;
void setup() {
SerialMonitorInterface.begin(9600);
Wire.begin();
Wireling.begin();
/* * * * * * * RGB LED * * * * * * */
pinMode(DATA_PIN, OUTPUT);
FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(brightness);
/* * * * * * Cap Touch * * * * * * */
Wireling.selectPort(CAP_PORT);
while(millis() < 5000);
if(capTouch.begin()) {
SerialMonitorInterface.println("Capacitive touch Wireling not detected!");
}
/* * * * * * Rotary Init * * * * */
Wireling.selectPort(ROT_PORT);
rotary.begin();
/* * * * * * Joystick Init * * * * */
Wireling.selectPort(JS_PORT);
joystick.begin();
delay(500);
}
void loop() {
// Read Rotary
Wireling.selectPort(ROT_PORT);
rotaryValue = rotary.getPosition();
// Read Joystick
Wireling.selectPort(JS_PORT);
joystick.getPosition();
// Read Capacitive Touch Slider
Wireling.selectPort(CAP_PORT);
getCapPos();
// Output to the LEDs based on input
driveLEDs();
//writeToMonitor(); // for debugging inputs
}
void driveLEDs() {
updateFromJS();
updateLEDs();
// this is hardcoded for speed purposes
for (int i = 0; i < LEDpos; i++) {
leds[i] = CRGB(0, 0, 0); // set leading "unused" LEDs to "off"
FastLED.show(); // update the LEDs
}
for (int i = LEDpos; i < LEDpos + width; i++) {
leds[i] = color; // set active LEDs to desired color (from rotary switch)
FastLED.show(); // update the LEDs
}
for (int i = LEDpos + width; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 0, 0); // set trailing "unused" LEDs to "off"
FastLED.show(); // update the LEDs
}
}
// drive LED color based on value received by Rotary Switch
void updateLEDs() {
switch (rotaryValue) {
case 0:
color = CRGB(0, 255, 0); // (g, r, b) -> red
break;
case 1:
color = CRGB(140, 220, 0); // (g, r, b) -> orange
break;
case 2:
color = CRGB(220, 140, 0); // (g, r, b) -> yellow
break;
case 3:
color = CRGB(255, 0, 0); // (g, r, b) -> green
break;
case 4:
color = CRGB(220, 0, 140); // (g, r, b) -> green/blue
break;
case 5:
color = CRGB(140, 0, 220); // (g, r, b) -> blue/green
break;
case 6:
color = CRGB(0, 0, 255); // (g, r, b) -> blue
break;
case 7:
color = CRGB(0, 140, 220); // (g, r, b) -> indigo
break;
case 8:
color = CRGB(0, 220, 140); // (g, r, b) -> violet
break;
case 9:
color = CRGB(255, 255, 255); // (g, r, b) -> white
break;
}
}
void updateFromJS() {
int wCap = NUM_LEDS - LEDpos;
int posCap = NUM_LEDS - width;
if (joystick.left) {
LEDpos = constrain(LEDpos + 1, 0, posCap); // shift LEDs to the left
} else if (joystick.right) {
LEDpos = constrain(LEDpos - 1, 0, posCap); // shift LEDs to the right
} else if (joystick.up) {
width = constrain(width + 1, 1, wCap); // increase the number of LEDs that are on
} else if (joystick.down) {
width = constrain(width - 1, 1, wCap); // decrease the number of LEDs that are on
}
}
void getCapPos() {
bool completedTouch = capTouch.update();
if (completedTouch) {
// do something on completion of touch
}
if (capTouch.isTouched()) {
pos = capTouch.getPosition(); //getPosition() returns a position value from 0 to 100 across the sensor
mag = capTouch.getMagnitude(); //getMagnitude() returns a relative 'pressure' value of about 50 to 500
brightness = map(pos, 0, 100, 0, 255);
FastLED.setBrightness(brightness);
}
}
// updates all LEDs to the RGB value specified
void setLEDs(uint8_t r, uint8_t g, uint8_t b) {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(g, r, b);
FastLED.show(); //update the LEDs
}
}
// this can be used to debug inputs received from the Rotary Switch, Joystick, and Capacitive Touch Slider
void writeToMonitor() {
// Rotary Switch value
SerialMonitorInterface.println("Rotary: " + String(rotaryValue));
// Joystick values
SerialMonitorInterface.print("Joystick: ");
if (joystick.up) {
SerialMonitorInterface.print("UP\t");
}
else if (joystick.down) {
SerialMonitorInterface.print("DOWN\t");
}
else if (joystick.left) {
SerialMonitorInterface.print("LEFT\t");
}
else if (joystick.right) {
SerialMonitorInterface.print("RIGHT\t");
}
SerialMonitorInterface.println();
// Capacitive Touch Slider values
SerialMonitorInterface.println("Cap Touch: " + String(pos));
delay(100);
}
|
d782114c477f49e0898f5a98e66862f65439fb84 | 3fa272b5821148c9ebfff02be860368143bf6f28 | /observer.hpp | 9b589f0df483b97365004cf45e27263a64d7f699 | [] | no_license | medarezki/cppdesignpatterns | 76ebbb7356902ef552d6df4d3dbd1fcd9b86cdf9 | b7a3335d6ba2c2b36214db6236b604e9a3f6187b | refs/heads/master | 2023-04-05T16:19:07.520676 | 2021-04-25T01:46:34 | 2021-04-25T01:46:34 | 270,881,772 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,649 | hpp | observer.hpp | #include <iostream>
#include <vector>
//Observer Design Pattern (Basic)
template<class T >
class ObserverPattern{
public:
ObserverPattern();
ObserverPattern(T& observed_);
virtual ~ObserverPattern<T>();
void observe(T& );
void update(T& );
private:
T observed;
};
template<class T>
ObserverPattern<T>::ObserverPattern():observed(0){}
template<class T>
ObserverPattern<T>::ObserverPattern(T& observed_){}
template <class T>
ObserverPattern<T>::~ObserverPattern(){
}
template<class T>
void ObserverPattern<T>::observe(T& value){
std::cout<<"Observing..."<<std::endl;
update(value);
}
template<class T>
void ObserverPattern<T>::update(T& value){
try{
observed= value;
}catch(std::exception& e){
std::cout<<e.what()<<std::endl;
}
std::cout<<"Value observed :"<< observed<<std::endl;
}
template<class U>
class Object{
public:
Object();
Object(std::vector<U >& values_, U& value_);
virtual ~Object<U>();
void setvalue(U&);
private:
std::deque<U > values;
U value;
ObserverPattern<U >* obsvrptr;
};
template<class U>
Object<U>::Object():value(0){}
template<class U>
Object<U>::Object(std::vector<U>& values_, U& value_){
obsvrptr= new ObserverPattern<U>;
}
template <class U>
Object<U>::~Object(){
}
template<class U>
void Object<U>::setvalue(U& value_){
value =value_;
obsvrptr->observe(value_);
}
int main(){
std::vector<int> values{1,2,3};
int value{2};
int setting_val{42};
Object<int> obj(values, value);
obj.setvalue(setting_val);
return 0;
}
|
4fc8a36689d7f1ae64fa2b743ca6ea66324ddcd6 | cf8e31d2a06f164caf7412e33552e309fefd51fb | /MyStopWatch/mainwindow.cpp | b16edf684701412ae21b3d6e05127b736fbea8b9 | [] | no_license | pustowoitow/my_StopWatch | aaeb228bc5ba5380309d5ca9f8e3ae2cb3a13737 | 28af8d2e92cee17438ced73cf349bb488b780b93 | refs/heads/master | 2020-04-29T11:26:28.613911 | 2019-03-17T19:08:11 | 2019-03-17T19:08:11 | 176,098,241 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,222 | cpp | mainwindow.cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow),
mRunning(false), mStartTime(), zero('0'), ms_all(0), ms_saved(0)
{
ui->setupUi(this);
connect(ui->StartStopButton, SIGNAL(clicked()), SLOT(start_stop()));
connect(ui->ResetButton, SIGNAL(clicked()), SLOT(reset()));
connect(ui->SetFileButton, SIGNAL(clicked()), SLOT(set_file()));
startTimer(0);
}
void MainWindow::start_stop(void)
{
if(mRunning==false)
{
mStartTime=QTime::currentTime();
mRunning = true;
ui->StartStopButton->setText("ะกัะพะฟ");
ui->ResetButton->setEnabled(false);
}
else
{
mRunning = false;
ui->StartStopButton->setText("ะกัะฐัั");
ui->ResetButton->setEnabled(true);
}
}
void MainWindow::reset(void)
{
ms_saved=0;
ms_all=0;
ui->MainLabel->setText("00:00:000");
}
void MainWindow::set_file(void)
{
QString str = QFileDialog::getOpenFileName(0, "Directory Dialog", QDir::currentPath());
ui->FilePath->setText(str);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_SaveButton_clicked()
{
if(ui->FilePath->text().isEmpty()) QMessageBox::information(this, "Info", "ะัะฑะตัะธัะต ัะฐะนะป ะดะปั ัะพั
ัะฐะฝะตะฝะธั ัะตะทัะปััะฐัะฐ!");
else
{
QFile mFile(ui->FilePath->text());
if (!mFile.open(QFile::WriteOnly | QFile::Text |QFile::Append))
{
QMessageBox::information(this, "Error", "ะััั ะฝะตะฒะตัะตะฝ!");
return;
}
QTextStream stream(&mFile);
stream<<ui->lineComment->text()<<ui->MainLabel->text()<<"\n";
mFile.close();
if (stream.status() != QTextStream::Ok)
{
QMessageBox::information(this, "Error", "ะัะธะฑะบะฐ ะทะฐะฟะธัะธ ัะฐะนะปะฐ!");
}
else
QMessageBox::information(this, "Success", "ะฃัะฟะตัะฝะพ!");
}
}
void MainWindow::on_action_triggered()
{
close();
}
void MainWindow::on_actionAbout_triggered()
{
QMessageBox::information(this, "About", "ะะฒัะพั: ะัััะพะฒะพะนัะพะฒ ะะปะตะบัะฐะฝะดั");
}
|
d5ad34c84244428ede2f69820141bf16cca76a42 | 19af2ab7a4796a0e39363abb9e0ef99a7b481b1d | /coursework2015/Robots/robotbase.01/robotbase.cpp | 8e7a1085786b9487b2a9c56819e2fad2d85d7d15 | [] | no_license | mustafinas1205/AS.1204.SysProg.2 | 26e51149af46fc9a77dd095780d9e0ffd0c7d217 | e3ac3eec2b99a895e0716e0ab1a5b61256bebe6b | refs/heads/master | 2021-01-21T07:30:15.040233 | 2015-06-18T13:28:08 | 2015-06-18T13:28:08 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 23,359 | cpp | robotbase.cpp | // robotbase.cpp: ะพะฟัะตะดะตะปัะตั ัะบัะฟะพััะธัะพะฒะฐะฝะฝัะต ััะฝะบัะธะธ ะดะปั ะฟัะธะปะพะถะตะฝะธั DLL.
//
#include "stdafx.h"
#include "robotbase.h"
using namespace std;
int xx1,yy1,xxarh1,yyarh1,xx11,yy11,xxarh11,yyarh11;
int type;//1=Ne; -1=Nl
int fl=-1,fl2=-1,fl3=-1,fl4=-1,fl5=-1;//ะตัะปะธ ะฝะต ะดะพัะปะธ ะดะพ ะฝัะถะฝัั
ััะฐะฝัะธะน ะฟะตัะฒัะน ัะฐะท
int f=0,f2=0,f3=0,f4=0,f5=0;
int h=-1,h2=-1,h3=-1,h4=-1,h5=-1; //hh=0 ะตัะปะธ ะฝะตั ะฟะฐััะฝะตัะฐ ะฒะพะพะฑัะต
int xL,xE,yL,yE;
extern "C"
void DoStep(stepinfo *Info, step *Step)
{//100000000000000000000000000000
double Rrob[400];
double Rrobarh[400];
double RNeNl[400];
int Ne[100];
int Nl[100];
double ourvic[400];
double myvic[400];
int nstep;
int i,j,z,idarh,id,Nrob,yarh,xarh,W,H,min,imin,min2,imin2,NeNl,x,y,x1,y1,xarh1,yarh1,L,Larh,A,Aarh,E,Earh,Lmax,Emax,buf,SSIN,SCOS;
double RasNl,RasNe,RasNlarh,RasNearh,s,Smax,SAmax,FA,Smaxarh,SAmaxarh,FAarh;
int idarh2,idarh3,idarh4,idarh5,hh;
////////////////////////////////////////
z=0; imin=0;idarh=0; int Ncmd=0; int Ncmdarh=0;
hh=0;//hh=0 ะตัะปะธ ะฝะตั ะฟะฐััะฝะตัะฐ ะฒะพะพะฑัะต
Lmax=Info->field->Lmax;
Emax=Info->field->Emax;
NeNl=(Info->field->Ne)+(Info->field->Nl);
W=Info->field->fieldWidth;
H=Info->field->fieldHeight;
Nrob=Info->field->rivals;
id=Info->yourNumber;
int Plid,Plidarh;
if ((Info->robots[id]->name=="robotbase.01")||(Info->robots[id]->name=="robotbase.01.1"))
for (i=0;i<Nrob;i++)
if ((Info->robots[i]->name=="robotbase.10")||(Info->robots[i]->name=="robotbase.10.1"))
{idarh=i;hh=1;}
if ((Info->robots[id]->name=="robotbase.01.2"))
for (i=0;i<Nrob;i++)
if (Info->robots[i]->name=="robotbase.10.2")
{idarh=i;hh=1;}
if ((Info->robots[id]->name=="robotbase.01.3"))
for (i=0;i<Nrob;i++)
if (Info->robots[i]->name=="robotbase.10.3")
{idarh=i;hh=1;}
if ((Info->robots[id]->name=="robotbase.01.4"))
for (i=0;i<Nrob;i++)
if (Info->robots[i]->name=="robotbase.10.4")
{idarh=i;hh=1;}
if ((Info->robots[id]->name=="robotbase.01.5"))
for (i=0;i<Nrob;i++)
if (Info->robots[i]->name=="robotbase.10.5")
{idarh=i;hh=1;}
Plid=Info->robots[id]->playerid;
for (i=0;i<Nrob;i++)
{ ourvic[i]=-999999;
myvic[i]=-999999;
if ((Info->robots[i]->playerid==Info->robots[id]->playerid)&&(Info->robots[i]->alive))
Ncmd++;
if ((Info->robots[i]->playerid==Info->robots[idarh]->playerid)&&(Info->robots[i]->alive))
Ncmdarh++;
}
L=Info->robots[id]->L;
E=Info->robots[id]->E;
A=Info->robots[id]->A;
Larh=Info->robots[idarh]->L;
Earh=Info->robots[idarh]->E;
Aarh=Info->robots[idarh]->A;
yarh = Info->robots[idarh]->y;
y=Info->robots[id]->y;
xarh= Info->robots[idarh]->x; //ะบะพะพัะดะธะฝะฐัั ะฐัั
x= Info->robots[id]->x;
for (i=0;i<Nrob;i++)
if ((Info->robots[i]->alive)&&(i!=idarh)&&(i!=id))
Rrob[i]=(sqrt((((Info->robots[i]->x)-x)*((Info->robots[i]->x)-x)+((Info->robots[i]->y)-y)*((Info->robots[i]->y)-y))));
else Rrob[i]=W*H;
for (i=0;i<Nrob;i++)
if ((Info->robots[i]->alive)&&(i!=idarh)&&(i!=id))
Rrobarh[i]=(sqrt((((Info->robots[i]->x)-xarh)*((Info->robots[i]->x)-xarh)+((Info->robots[i]->y)-yarh)*((Info->robots[i]->y)-yarh))));
else Rrobarh[i]=W*H;
Smaxarh=((Info->field->Vmax)*(Info->robots[idarh]->V)/(Info->field->Lmax)*(Info->robots[idarh]->E)/(Info->field->Emax));// ะผะฐั
ะฟะตัะตะผะตัะตะฝะธะต ะฐัั
Smax=((Info->field->Vmax)*(Info->robots[id]->V)/(Info->field->Lmax)*(Info->robots[id]->E)/(Info->field->Emax));// ะผะฐั
ะฟะตัะตะผะตัะตะฝะธะต
SAmaxarh=((Info->field->Rmax)*(Info->robots[idarh]->V)/(Info->field->Lmax)*(Info->robots[idarh]->E)/(Info->field->Emax));// max ัะฐัััะพัะฝะธะต ะฐัะฐะบะธ ะฐัั
SAmax=((Info->field->Rmax)*(Info->robots[id]->V)/(Info->field->Lmax)*(Info->robots[id]->E)/(Info->field->Emax));// max ัะฐัััะพัะฝะธะต ะฐัะฐะบะธ
FAarh=((Info->robots[idarh]->A)*(Info->robots[idarh]->E)/(Info->field->Emax));// โ max ัะธะปะฐ ะฐัะฐะบะธ ะฐัั
FA=((Info->robots[id]->A)*(Info->robots[id]->E)/(Info->field->Emax));// โ max ัะธะปะฐ ะฐัะฐะบะธ
////////////////////////////////////////////
////////////////////////////////////////////
if (hh==1)
{if (Info->stepnum==1)//ะฝะฐ ะฟะตัะฒะพะผ ัะฐะณะต ะฝะฐั
ะพะดะธะผ ะผะธะฝะธะผะฐะปัะฝะพะต ัะฐัััะพัะฝะธะต ะผะตะถะดั ััะฐะฝัะธัะผะธ ะ ะธ L
{
if ((Info->robots[id]->name=="robotbase.01")|| (Info->robots[id]->name=="robotbase.01.1"))
fl=0;
if ((Info->robots[id]->name=="robotbase.01.2"))
fl2=0;
if ((Info->robots[id]->name=="robotbase.01.3"))
fl3=0;
if ((Info->robots[id]->name=="robotbase.01.4"))
fl4=0;
if ((Info->robots[id]->name=="robotbase.01.5"))
fl5=0;
DoAction(Step, ACT_TECH, 0, 0, 0, 0.5*L, 0.5*L);
for (i=0;i<NeNl;i++)
if (Info->objects[i]->type==OBJ_CHARGER)
{
for (j=0;j<NeNl;j++)
{
if (Info->objects[j]->type==OBJ_TECH)
{
RNeNl[z]=(sqrt(((Info->objects[i]->x)-(Info->objects[j]->x))*((Info->objects[i]->x)-(Info->objects[j]->x))+((Info->objects[i]->y)-(Info->objects[j]->y))*((Info->objects[i]->y)-(Info->objects[j]->y))));
Ne[z]=i;
Nl[z]=j;
z=z+1;
}
}
}
min=1000;
for (i=0;i<z-1;i++)
if (RNeNl[i]<min)
{
min=RNeNl[i];
imin=i;
}
RasNl=(sqrt((((Info->objects[Nl[imin]]->x)-(x))*((Info->objects[Nl[imin]]->x)-(x))+((Info->objects[Nl[imin]]->y)-(y))*((Info->objects[Nl[imin]]->y)-(y)))));
RasNe=(sqrt((((Info->objects[Ne[imin]]->x)-(x))*((Info->objects[Ne[imin]]->x)-(x))+((Info->objects[Ne[imin]]->y)-(y))*((Info->objects[Ne[imin]]->y)-(y)))));
RasNlarh=(sqrt((((Info->objects[Nl[imin]]->x)-(xarh))*((Info->objects[Nl[imin]]->x)-(xarh))+((Info->objects[Nl[imin]]->y)-(yarh))*((Info->objects[Nl[imin]]->y)-(yarh)))));
RasNearh=(sqrt((((Info->objects[Ne[imin]]->x)-(xarh))*((Info->objects[Ne[imin]]->x)-(xarh))+((Info->objects[Ne[imin]]->y)-(yarh))*((Info->objects[Ne[imin]]->y)-(yarh)))));
xL=Info->objects[Nl[imin]]->x;
xE=Info->objects[Ne[imin]]->x;
yL=Info->objects[Nl[imin]]->y;
yE=Info->objects[Ne[imin]]->y;
/////////ะฒัะฑะธัะฐะตะผ ะบัะพ ะบ ะบะฐะบะพะน ััะฐะฝัะธะธ ะฟะพะนะดะตั////////////
if ((RasNl>=RasNlarh)&&(RasNe<=RasNearh))
{
x1=Info->objects[Ne[imin]]->x; y1=Info->objects[Ne[imin]]->y;
xarh1=Info->objects[Nl[imin]]->x; yarh1=Info->objects[Nl[imin]]->y;
type=1;
}
else if ((RasNl<RasNlarh)&&(RasNe>RasNearh))
{
x1=Info->objects[Nl[imin]]->x; y1=Info->objects[Nl[imin]]->y;
xarh1=Info->objects[Ne[imin]]->x; yarh1=Info->objects[Ne[imin]]->y;
type=-1;
}
else if ((RasNl>=RasNlarh)&&(RasNe>=RasNearh))
{
if (RasNl>=RasNe)
{
x1=Info->objects[Ne[imin]]->x; y1=Info->objects[Ne[imin]]->y;
xarh1=Info->objects[Nl[imin]]->x; yarh1=Info->objects[Nl[imin]]->y;
type=1;
}
else
{
x1=Info->objects[Nl[imin]]->x; y1=Info->objects[Nl[imin]]->y;
xarh1=Info->objects[Ne[imin]]->x; yarh1=Info->objects[Ne[imin]]->y;
type=-1;
}
}
else
{
if (RasNlarh>=RasNearh)
{
x1=Info->objects[Nl[imin]]->x; y1=Info->objects[Nl[imin]]->y;
xarh1=Info->objects[Ne[imin]]->x; yarh1=Info->objects[Ne[imin]]->y;
type=-1;
}
else
{
x1=Info->objects[Ne[imin]]->x; y1=Info->objects[Ne[imin]]->y;
xarh1=Info->objects[Nl[imin]]->x; yarh1=Info->objects[Nl[imin]]->y;
type=1;
}
}
xx1=x1;yy1=y1;xxarh1=xarh1;yyarh1=yarh1;//ะทะฐะฟะพะผะฝะธะปะธ ะบะพะพัะดะธะฝะฐัั ะฒัะฑัะฐะฝะฝะพะน ะบะฐะถะดัะผ ััะฐะฝัะธะธ
}
else
// if (hh==1)
{if ((fl==0)||(fl2==0)||(fl3==0)||(fl4==0)||(fl5==0))//ะตัะปะธ ะธะดะตะผ ะดะพ ััะฐะฝัะธะน ะฒ ะฟะตัะฒัะน ัะฐะท
{
if ((x!=xx1)||(y!=yy1))//ะฟะพะบะฐ ะฝะต ะดะพัะปะธ
{
s=(sqrt((x-xx1)*(x-xx1)+(y-yy1)*(y-yy1)));
if (s<=Smax)//ะตัะปะธ ะผะพะถะตะผ ะดะพะนัะธ ะทะฐ 1 ัะฐะณ
{
DoAction(Step, ACT_MOVE, (xx1-x), (yy1-y), 0, 0, 0);//ะดะตะปะฐะตะผ ะตะณะพ
}
else
{//ะผะตะดะปะตะฝะฝะพ ะฝะพ ะฒะตัะฝะพ ะดะฒะธะถะตะผัั ะบ ัะตะปะธ ะฒ ะฝัะถะฝะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ
if (xx1==x)
{
SCOS=0;
SSIN=Smax;
}
else
{
SCOS=Smax*cos(atan(abs(yy1-y)/abs(xx1-x)));
SSIN=Smax*sin(atan(abs(yy1-y)/abs(xx1-x)));
}
if (xx1<x) SCOS=-SCOS;
if (yy1<y) SSIN=-SSIN;
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
}
else
{
if (((Info->robots[id]->name=="robotbase.01")||(Info->robots[id]->name=="robotbase.01.1")))
fl=1;
if (((Info->robots[id]->name=="robotbase.01.2")))
fl2=1;
if (((Info->robots[id]->name=="robotbase.01.3")))
fl3=1;
if (((Info->robots[id]->name=="robotbase.01.4")))
fl4=1;
if (((Info->robots[id]->name=="robotbase.01.5")))
fl5=1;
DoAction(Step, ACT_TECH, 0, 0, (0.36-0.03*Ncmd)*L, 0.3*L, (1-0.3-(0.36-0.03*Ncmd))*L);
}
}
////////////ะฝะฐะฟะฐัะฝะธะบ ะถะธะฒ////////////////////////
else if (Info->robots[idarh]->alive)
{
//////////ะบะพะณะดะฐ ะฝะฐัะปะธ ะฝัะถะฝัะต ััะฐะฝัะธะธ///////////
DoAction(Step, ACT_TECH, 0, 0, (0.36-0.03*Ncmd)*L, 0.3*L, (1-0.3-(0.36-0.03*Ncmd))*L);
if ((x==xL)&&(y==yL))
if ((xarh==xE)&&(yarh==yE))
{type=-1;
xx1=xL;
xxarh1=xE;
yy1=yL;
yyarh1=yE;}
else
{
type=0;
}
if ((x==xE)&&(y==yE))
if ((xarh==xL)&&(yarh==yL))
{type=1;
xx1=xE;
xxarh1=xL;
yy1=yE;
yyarh1=yL;}
else
{
type=0;
}
if ( ((type==1)&&((L<0.8*Lmax)||(Earh<0.9*Emax))) || ((type==-1)&&((E<0.9*Emax)||(Larh<0.8*Lmax))) )
{
if (xxarh1==x) {SCOS=0; SSIN=Smax;}
else
{
SCOS=Smax*cos(atan(abs(yyarh1-y)/abs(xxarh1-x)));
SSIN=Smax*sin(atan(abs(yyarh1-y)/abs(xxarh1-x)));
}
if (((x!=xxarh1)||(y!=yyarh1)))//ะฟะพะบะฐ ะฝะต ะดะพัะปะธ
{
if (xxarh1<x) SCOS=-SCOS;
if (yyarh1<y) SSIN=-SSIN;
s=(sqrt((x-xxarh1)*(x-xxarh1)+(y-yyarh1)*(y-yyarh1)));
if (s<Smax)//ะตัะปะธ ะผะพะถะตะผ ะดะพะนัะธ ะทะฐ 1 ัะฐะณ
{
DoAction(Step, ACT_MOVE, (xxarh1-x), (yyarh1-y), 0, 0, 0); //ะดะตะปะฐะตะผ ะตะณะพ
}
else
{//ะผะตะดะปะตะฝะฝะพ ะฝะพ ะฒะตัะฝะพ ะดะฒะธะถะตะผัั ะบ ัะตะปะธ ะฒ ะฝัะถะฝะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ
for (i=0;i<NeNl;i++)//ะธะทะฑะตะณะฐั ะฟะพะฟะฐะดะฐะฝะธั ะฝะฐ ะปะตะฒัั ััะฐะฝัะธั
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
{
SCOS--; SSIN--;
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
else
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
}
}
////ะะขะะะ////////////////
Plidarh=Info->robots[idarh]->playerid;
for (i=0;i<Nrob;i++)
{
if ((Rrob[i]<=SAmax)&&(Rrobarh[i]<=SAmaxarh)&&(Info->robots[i]->alive)&&(Info->robots[i]->name!="robotbase.10")&&(Info->robots[i]->name!="robotbase.10.1")&&(Info->robots[i]->name!="robotbase.10.2")&&(Info->robots[i]->name!="robotbase.10.3")&&(Info->robots[i]->name!="robotbase.10.4")&&(Info->robots[i]->name!="robotbase.10.5")&&(Info->robots[i]->name!="robotbase.01")&&(Info->robots[i]->name!="robotbase.01.1")&&(Info->robots[i]->name!="robotbase.01.2")&&(Info->robots[i]->name!="robotbase.01.3")&&(Info->robots[i]->name!="robotbase.01.4")&&(Info->robots[i]->name!="robotbase.01.5"))
ourvic[i]= ((Info->field->rndmin)*(FA*Ncmd)+(Info->field->rndmin)*(FAarh*Ncmdarh))-((1-(Info->field->rndmin))*(Info->robots[i]->P)*(Info->robots[i]->E))/Emax;
if ((Rrob[i]<=SAmax)&&(Rrobarh[i]>SAmaxarh)&&(Info->robots[i]->alive)&&(Info->robots[i]->name!="robotbase.10")&&(Info->robots[i]->name!="robotbase.10.1")&&(Info->robots[i]->name!="robotbase.10.2")&&(Info->robots[i]->name!="robotbase.10.3")&&(Info->robots[i]->name!="robotbase.10.4")&&(Info->robots[i]->name!="robotbase.10.5")&&(Info->robots[i]->name!="robotbase.01")&&(Info->robots[i]->name!="robotbase.01.1")&&(Info->robots[i]->name!="robotbase.01.2")&&(Info->robots[i]->name!="robotbase.01.3")&&(Info->robots[i]->name!="robotbase.01.4")&&(Info->robots[i]->name!="robotbase.01.5"))
myvic[i]= (Info->field->rndmin)*FA*Ncmd-((1-(Info->field->rndmin))*(Info->robots[i]->P)*(Info->robots[i]->E))/Emax;
}
int maxourv=-999999;
int nmaxourv=0;
int maxmyv=-999999;
int nmaxmyv=0;
for (i=0;i<Nrob;i++)
{
if (ourvic[i]>maxourv)
{
maxourv=ourvic[i];
nmaxourv=i;
}
if (myvic[i]>maxmyv)
{
maxmyv=myvic[i];
nmaxmyv=i;
}
}
if (
((Info->robots[nmaxourv]->x==xL)&&(Info->robots[nmaxourv]->y==yL))||((Info->robots[nmaxourv]->x==xE)&&(Info->robots[nmaxourv]->y==yE))
||((Info->robots[nmaxmyv]->x==xL)&&(Info->robots[nmaxmyv]->y==yL))||((Info->robots[nmaxmyv]->x==xE)&&(Info->robots[nmaxmyv]->y==yL))
)
{ourvic[nmaxourv]=-999999;
myvic[nmaxmyv]=-999999;
maxourv=-999999;
maxmyv=-999999;}
if (maxourv>0)
{
DoAction(Step, ACT_ATTACK, (Info->robots[nmaxourv]->x)-x, (Info->robots[nmaxourv]->y)-y, 0,0,0);
}
else if (maxmyv>0)
{
DoAction(Step, ACT_ATTACK, (Info->robots[nmaxmyv]->x)-x, (Info->robots[nmaxmyv]->y)-y, 0,0,0);
}
////////ะะะะะฆ ะะขะะะ/////////////
}
else //ะตัะปะธ ัะดะพั
ะฝะฐะฟะฐัะฝะธะบ :'(
{
DoAction(Step, ACT_TECH, 0, 0, (0.36-0.03*Ncmd)*L, 0.3*L, (1-0.3-(0.36-0.03*Ncmd))*L);
if ((x==xL)&&(y==yL))
{type=-1;
xx1=xL;
xxarh1=xE;
yy1=yL;
yyarh1=yE;}
if ((x==xE)&&(y==yE))
{type=1;
xx1=xE;
xxarh1=xL;
yy1=yE;
yyarh1=yL;}
if ( ((type==1)&&((L<0.8*Lmax)&&(E>0.3*Emax))) || ((type==-1)&&((E<0.9*Emax)&&(L>0.3*Lmax))) )
{
if (xxarh1==x) {SCOS=0; SSIN=Smax;}
else
{
SCOS=Smax*cos(atan(abs(yyarh1-y)/abs(xxarh1-x)));
SSIN=Smax*sin(atan(abs(yyarh1-y)/abs(xxarh1-x)));
}
if (((x!=xxarh1)||(y!=yyarh1)))//ะฟะพะบะฐ ะฝะต ะดะพัะปะธ
{
if (xxarh1<x) SCOS=-SCOS;
if (yyarh1<y) SSIN=-SSIN;
s=(sqrt((x-xxarh1)*(x-xxarh1)+(y-yyarh1)*(y-yyarh1)));
if (s<Smax)//ะตัะปะธ ะผะพะถะตะผ ะดะพะนัะธ ะทะฐ 1 ัะฐะณ
{
DoAction(Step, ACT_MOVE, (xxarh1-x), (yyarh1-y), 0, 0, 0); //ะดะตะปะฐะตะผ ะตะณะพ
}
else
{//ะผะตะดะปะตะฝะฝะพ ะฝะพ ะฒะตัะฝะพ ะดะฒะธะถะตะผัั ะบ ัะตะปะธ ะฒ ะฝัะถะฝะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ
for (i=0;i<NeNl;i++)//ะธะทะฑะตะณะฐั ะฟะพะฟะฐะดะฐะฝะธั ะฝะฐ ะปะตะฒัั ััะฐะฝัะธั
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
{
SCOS--; SSIN--;
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
else
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
}
}
////ะะขะะะ////////////////
for (i=0;i<Nrob;i++)
{
if ((Rrob[i]<=SAmax)&&(Rrobarh[i]>SAmaxarh)&&(Info->robots[i]->alive)&&(Info->robots[i]->name!="robotbase.10")&&(Info->robots[i]->name!="robotbase.10.1")&&(Info->robots[i]->name!="robotbase.10.2")&&(Info->robots[i]->name!="robotbase.10.3")&&(Info->robots[i]->name!="robotbase.10.4")&&(Info->robots[i]->name!="robotbase.10.5")&&(Info->robots[i]->name!="robotbase.01")&&(Info->robots[i]->name!="robotbase.01.1")&&(Info->robots[i]->name!="robotbase.01.2")&&(Info->robots[i]->name!="robotbase.01.3")&&(Info->robots[i]->name!="robotbase.01.4")&&(Info->robots[i]->name!="robotbase.01.5"))
myvic[i]= (Info->field->rndmin)*FA*Ncmd-((1-(Info->field->rndmin))*(Info->robots[i]->P)*(Info->robots[i]->E))/Emax;
}
int maxmyv=-999999;
int nmaxmyv=0;
for (i=0;i<Nrob;i++)
{
if (myvic[i]>maxmyv)
{
maxmyv=myvic[i];
nmaxmyv=i;
}
}
if (
((Info->robots[nmaxmyv]->x==xx1)&&(Info->robots[nmaxmyv]->y==yy1))||((Info->robots[nmaxmyv]->x==xxarh1)&&(Info->robots[nmaxmyv]->y==yyarh1))
)
{
myvic[nmaxmyv]=-999999;
maxmyv=-999999;}
if (maxmyv>0)
{
DoAction(Step, ACT_ATTACK, (Info->robots[nmaxmyv]->x)-x, (Info->robots[nmaxmyv]->y)-y, 0,0,0);
}
////////ะะะะะฆ ะะขะะะ/////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
else//hh=0 !
{
if (Info->stepnum==1)//ะฝะฐ ะฟะตัะฒะพะผ ัะฐะณะต ะฝะฐั
ะพะดะธะผ ะผะธะฝะธะผะฐะปัะฝะพะต ัะฐัััะพัะฝะธะต ะผะตะถะดั ััะฐะฝัะธัะผะธ ะ ะธ L
{
DoAction(Step, ACT_TECH, 0, 0, 0, 0.5*L, 0.5*L);
for (i=0;i<NeNl;i++)
if (Info->objects[i]->type==OBJ_CHARGER)
{
for (j=0;j<NeNl;j++)
{
if (Info->objects[j]->type==OBJ_TECH)
{
RNeNl[z]=(sqrt(((Info->objects[i]->x)-(Info->objects[j]->x))*((Info->objects[i]->x)-(Info->objects[j]->x))+((Info->objects[i]->y)-(Info->objects[j]->y))*((Info->objects[i]->y)-(Info->objects[j]->y))));
Ne[z]=i;
Nl[z]=j;
z=z+1;
}
}
}
min=1000;
for (i=0;i<z-1;i++)
if (RNeNl[i]<min)
{
min=RNeNl[i];
imin=i;
}
RasNl=(sqrt((((Info->objects[Nl[imin]]->x)-(x))*((Info->objects[Nl[imin]]->x)-(x))+((Info->objects[Nl[imin]]->y)-(y))*((Info->objects[Nl[imin]]->y)-(y)))));
RasNe=(sqrt((((Info->objects[Ne[imin]]->x)-(x))*((Info->objects[Ne[imin]]->x)-(x))+((Info->objects[Ne[imin]]->y)-(y))*((Info->objects[Ne[imin]]->y)-(y)))));
xL=Info->objects[Nl[imin]]->x;
xE=Info->objects[Ne[imin]]->x;
yL=Info->objects[Nl[imin]]->y;
yE=Info->objects[Ne[imin]]->y;
/////////ะฒัะฑะธัะฐะตะผ ะบัะพ ะบ ะบะฐะบะพะน ััะฐะฝัะธะธ ะฟะพะนะดะตั////////////
if (RasNl>=RasNe)
{
x1=Info->objects[Ne[imin]]->x; y1=Info->objects[Ne[imin]]->y;
xarh1=Info->objects[Nl[imin]]->x; yarh1=Info->objects[Nl[imin]]->y;
type=1;
}
else
{
x1=Info->objects[Nl[imin]]->x; y1=Info->objects[Nl[imin]]->y;
xarh1=Info->objects[Ne[imin]]->x; yarh1=Info->objects[Ne[imin]]->y;
type=-1;
}
xx11=x1;yy11=y1;xxarh11=xarh1;yyarh11=yarh1;//ะทะฐะฟะพะผะฝะธะปะธ ะบะพะพัะดะธะฝะฐัั ะฒัะฑัะฐะฝะฝะพะน ะบะฐะถะดัะผ ััะฐะฝัะธะธ
}
else {
if ((h==0)||(h2==0)||(h3==0)||(h4==0)||(h5==0))//ะตัะปะธ ะธะดะตะผ ะดะพ ััะฐะฝัะธะน ะฒ ะฟะตัะฒัะน ัะฐะท
{
if ((x!=xx11)||(y!=yy11))//ะฟะพะบะฐ ะฝะต ะดะพัะปะธ
{
s=(sqrt((x-xx11)*(x-xx11)+(y-yy11)*(y-yy11)));
if (s<=Smax)//ะตัะปะธ ะผะพะถะตะผ ะดะพะนัะธ ะทะฐ 1 ัะฐะณ
{
DoAction(Step, ACT_MOVE, (xx11-x), (yy11-y), 0, 0, 0);//ะดะตะปะฐะตะผ ะตะณะพ
}
else
{//ะผะตะดะปะตะฝะฝะพ ะฝะพ ะฒะตัะฝะพ ะดะฒะธะถะตะผัั ะบ ัะตะปะธ ะฒ ะฝัะถะฝะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ
if (xx11==x)
{
SCOS=0;
SSIN=Smax;
}
else
{
SCOS=Smax*cos(atan(abs(yy11-y)/abs(xx11-x)));
SSIN=Smax*sin(atan(abs(yy11-y)/abs(xx11-x)));
}
if (xx11<x) SCOS=-SCOS;
if (yy11<y) SSIN=-SSIN;
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
}
else
{
if (((Info->robots[id]->name=="robotbase.01")||(Info->robots[id]->name=="robotbase.01.1")))
h=1;
if (((Info->robots[id]->name=="robotbase.01.2")))
h2=1;
if (((Info->robots[id]->name=="robotbase.01.3")))
h3=1;
if (((Info->robots[id]->name=="robotbase.01.4")))
h4=1;
if (((Info->robots[id]->name=="robotbase.01.5")))
h5=1;
DoAction(Step, ACT_TECH, 0, 0, (0.36-0.03*Ncmd)*L, 0.3*L, (1-0.3-(0.36-0.03*Ncmd))*L);
}
}
else
{
//////////ะบะพะณะดะฐ ะฝะฐัะปะธ ะฝัะถะฝัะต ััะฐะฝัะธะธ///////////
DoAction(Step, ACT_TECH, 0, 0, (0.36-0.03*Ncmd)*L, 0.3*L, (1-0.3-(0.36-0.03*Ncmd))*L);
if ((x==xL)&&(y==yL))
{type=-1;
xx11=xL;
xxarh11=xE;
yy11=yL;
yyarh11=yE;}
if ((x==xE)&&(y==yE))
{type=1;
xx11=xE;
xxarh11=xL;
yy11=yE;
yyarh11=yL;}
if ( ((type==1)&&((L<0.8*Lmax)&&(E>0.3*Emax))) || ((type==-1)&&((E<0.9*Emax)&&(L>0.3*Lmax))) )
{
if (xxarh11==x) {SCOS=0; SSIN=Smax;}
else
{
SCOS=Smax*cos(atan(abs(yyarh11-y)/abs(xxarh11-x)));
SSIN=Smax*sin(atan(abs(yyarh11-y)/abs(xxarh11-x)));
}
if (((x!=xxarh11)||(y!=yyarh11)))//ะฟะพะบะฐ ะฝะต ะดะพัะปะธ
{
if (xxarh11<x) SCOS=-SCOS;
if (yyarh11<y) SSIN=-SSIN;
s=(sqrt((x-xxarh11)*(x-xxarh11)+(y-yyarh11)*(y-yyarh11)));
if (s<Smax)//ะตัะปะธ ะผะพะถะตะผ ะดะพะนัะธ ะทะฐ 1 ัะฐะณ
{
DoAction(Step, ACT_MOVE, (xxarh11-x), (yyarh11-y), 0, 0, 0); //ะดะตะปะฐะตะผ ะตะณะพ
}
else
{//ะผะตะดะปะตะฝะฝะพ ะฝะพ ะฒะตัะฝะพ ะดะฒะธะถะตะผัั ะบ ัะตะปะธ ะฒ ะฝัะถะฝะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ
for (i=0;i<NeNl;i++)//ะธะทะฑะตะณะฐั ะฟะพะฟะฐะดะฐะฝะธั ะฝะฐ ะปะตะฒัั ััะฐะฝัะธั
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
{
SCOS--; SSIN--;
if (((x+SCOS)==Info->objects[i]->x)&&(y+SSIN)==Info->objects[i]->y)
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
else
DoAction(Step, ACT_MOVE, SCOS, SSIN, 0, 0, 0);
}
}
}
////ะะขะะะ////////////////
for (i=0;i<Nrob;i++)
{
if ((Rrob[i]<=SAmax)&&(Rrobarh[i]>SAmaxarh)&&(Info->robots[i]->alive)&&(Info->robots[i]->name!="robotbase.10")&&(Info->robots[i]->name!="robotbase.10.1")&&(Info->robots[i]->name!="robotbase.10.2")&&(Info->robots[i]->name!="robotbase.10.3")&&(Info->robots[i]->name!="robotbase.10.4")&&(Info->robots[i]->name!="robotbase.10.5")&&(Info->robots[i]->name!="robotbase.01")&&(Info->robots[i]->name!="robotbase.01.1")&&(Info->robots[i]->name!="robotbase.01.2")&&(Info->robots[i]->name!="robotbase.01.3")&&(Info->robots[i]->name!="robotbase.01.4")&&(Info->robots[i]->name!="robotbase.01.5"))
myvic[i]= (Info->field->rndmin)*FA*Ncmd-((1-(Info->field->rndmin))*(Info->robots[i]->P)*(Info->robots[i]->E))/Emax;
}
int maxmyv=-999999;
int nmaxmyv=0;
for (i=0;i<Nrob;i++)
{
if (myvic[i]>maxmyv)
{
maxmyv=myvic[i];
nmaxmyv=i;
}
}
if (
((Info->robots[nmaxmyv]->x==xx11)&&(Info->robots[nmaxmyv]->y==yy11))||((Info->robots[nmaxmyv]->x==xxarh11)&&(Info->robots[nmaxmyv]->y==yyarh11))
)
{
myvic[nmaxmyv]=-999999;
maxmyv=-999999;}
if (maxmyv>0)
{
DoAction(Step, ACT_ATTACK, (Info->robots[nmaxmyv]->x)-x, (Info->robots[nmaxmyv]->y)-y, 0,0,0);
}
////////ะะะะะฆ ะะขะะะ/////////////
}
}
}
return;
} |
ee8d6a94dcfe3bb7d9b385a6d074b1eb2964e912 | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive2/62/f2ddca6bdaee24/main.cpp | c2b3e3b38e81ceb26aef698b827063e4b25952d7 | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 367 | cpp | main.cpp | #include <iostream>
struct A
{
int a;
int b;
A() : a(10) { std::cout << "default ctor" << std::endl;}
~A(){ }
A(const A&){ std::cout << "copy ctor" << std::endl; }
A(const A&&){ std::cout << "move ctor" << std::endl; }
};
A init()
{
A a;
a.b = 20;
return a;
}
int main()
{
A a = init();
std::cout << a.b << std::endl;
}
|
170424128c433ad2c693913d0e631cc21361d9b8 | ece500c4d68f4fec02bfeeb106a86c8cc686673c | /src/eclipse/render/interactive_renderer.h | f990eefe246f0319d3987b68da541cef156ff656 | [] | no_license | jo-va/eclipse | 8037f53f09b1131ace0ea472ceb57a4ea7b54d37 | 95af16c1a4094b921f70c89b2e8d66150b953794 | refs/heads/master | 2021-01-21T11:36:17.296482 | 2017-09-08T15:25:24 | 2017-09-08T15:25:24 | 102,016,157 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,211 | h | interactive_renderer.h | #pragma once
#include "eclipse/render/renderer.h"
#include "eclipse/render/window.h"
#include "eclipse/scene/scene.h"
#include "eclipse/math/vec3.h"
#include <cstdint>
#include <vector>
#include <memory>
namespace eclipse { namespace render {
struct StackedSeries
{
void init(size_t num_series, size_t max_len);
void append(size_t index, float value);
void render(size_t ypos, size_t height);
void clear();
std::vector<std::vector<float>> series;
std::vector<Vec3> colors;
size_t curr_index;
size_t total_size;
};
class InteractiveRenderer : public Renderer
{
public:
InteractiveRenderer(std::shared_ptr<scene::Scene> scene, const Options& options);
~InteractiveRenderer();
int render();
private:
void init_gl();
void init_ui();
void render_ui();
void on_before_show_ui();
void key_callback(int key, int scancode, int action, int mods);
void mouse_button_callback(int button, int action, int mods);
void cursor_pos_callback(double xpos, double ypos);
private:
std::unique_ptr<Window> m_window;
StackedSeries m_series;
uint32_t m_fbo_id;
uint32_t m_tex_id;
bool m_show_ui;
};
} } // namespace eclipse::render
|
eac88b35e439db512ac6cfecaea84aafb0e223b0 | c369b6c7f1c461c0af778f4a5e0ec307cfb6a3be | /KLibrary/KinectManager.h | d1b1f095edab8b857373e0954d7e990aa3c7c717 | [] | no_license | PhoenixDigitalFX/FaceCap | 3f328bb63e3449fa6172adfde38cb8f3e8c0556d | ec44e1ab506110703293467c5554efdc241204e2 | refs/heads/main | 2023-07-19T17:16:58.130825 | 2021-07-16T03:16:58 | 2021-07-16T03:16:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,468 | h | KinectManager.h |
#ifndef __HW_KINECT_MANAGER_H
#define __HW_KINECT_MANAGER_H
#include "SensorManager.h"
#include "../src/stdafx.h"
class SensorManager::Impl
{
public:
Impl();
~Impl();
bool init();
void update();
bool getDepth(unsigned short *dest);
bool getColor(unsigned char *dest);
unsigned char* getColorFrame();
unsigned short* getDepthFrame();
long* getColorCoord();
/* Function to map color frame to the depth frame */
bool MapColorToDepth(unsigned char* colorFrame, unsigned short* depthFrame);
int getColorWidth();
int getColorHeight();
int getDepthWidth();
int getDepthHeight();
private:
// Resolution of the streams
static const NUI_IMAGE_RESOLUTION colorResolution = NUI_IMAGE_RESOLUTION_640x480;
static const NUI_IMAGE_RESOLUTION depthResolution = NUI_IMAGE_RESOLUTION_640x480;
// Mapped color coordinates from color frame to depth frame
LONG* colorCoordinates;
// Event handlers
HANDLE rgbStream;
HANDLE depthStream;
HANDLE NextDepthFrameEvent;
HANDLE NextColorFrameEvent;
// Variables related to resolution assigned in constructor
int CtoDdiv;
long int cwidth;
long int dwidth;
long int cheight;
long int dheight;
// Actual sensor connected to the Computer
INuiSensor* sensor;
// Color and depth frames
unsigned char* colordata;
unsigned short* depthdata;
/****** Class function declarations *******/
};
#endif
|
8dd803f7fa1ae26abda5bdebd295dcb1fc26486a | 0eadc9647b56ac23bddc50a2f1d69349f5a243e6 | /08-threads-I/exemplo1-threads.cpp | a042bd2c05eab4c1312ab5597c3c731e5a68691a | [] | no_license | fredericocurti/supercomp | 3ef5a2edac0e8a04b3a8576da6d27c1ad50f83d8 | 9f96463d3f4127693ec5cc7e4963684387631b03 | refs/heads/master | 2020-07-03T06:22:34.225857 | 2019-12-04T02:59:38 | 2019-12-04T02:59:38 | 201,818,004 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 936 | cpp | exemplo1-threads.cpp | #include <thread>
#include <iostream>
void funcao_rodando_em_paralelo(int a, int *b, int tid) {
std::cout << "Thread: " << tid << "a=" << a << std::endl;
*b = 5;
}
int main() {
int b = 10;
int tid = 0;
unsigned concurentThreadsSupported = std::thread::hardware_concurrency();
std::thread *threads = new std::thread[concurentThreadsSupported];
std::cout << "Threads supported:" << concurentThreadsSupported << std::endl;
// Os argumentos em seguida sรฃo passados diretamente
// para a funรงรฃo passada no primeiro argumento.
for (int i = 0; i < concurentThreadsSupported; i++) {
threads[i] = std::thread(funcao_rodando_em_paralelo, 15, &b, tid);
tid++;
std::cout << "Antes do join b=" << b << std::endl;
}
for (int i = 0; i < concurentThreadsSupported; i++) {
threads[i].join();
}
std::cout << "Depois do join b=" << b << std::endl;
}
|
2f3a2e462affc4a89549693efd9870753be447cd | bf5732d30e477f932b91c48ad4d779ba46d4a915 | /sys.cpp | ea1859b1464a9b80cafe420c61c25f747d8e49c6 | [] | no_license | sharadkejriwal/FTP-Server-and-Client | 2654ac22fe0d12b776daa73b977065aa556b0682 | e039944cf07eea25f073434cb07373e4a269f086 | refs/heads/master | 2021-01-20T16:59:07.678404 | 2017-02-22T20:34:36 | 2017-02-22T20:34:36 | 82,849,362 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 449 | cpp | sys.cpp | #include "sys.h"
int sys::changedir(char *dir)
{
int r = chdir(dir);
return r;
}
//cmd can be "ls" or "pwd"
char *sys::cmdinfo(char *cmd)
{
//if(cmd == "ls")
// strcat(cmd,"- l");
FILE *fp = popen(cmd, "r");
char *buffer = (char *)malloc(buffer_len * sizeof(char));
fread(buffer, 1, ftell(fp), fp);
return buffer;
}
FILE *sys::openfile(char *fname)
{
return fopen(fname,"r"); //return FILE pointer on success or null on error
} |
bfd7fe2721aa447f6aca2d27ad1e28b984c7d53e | 6c9cf05c8fd15cb33d1b6d99496ae54fabdba4b0 | /src/backend/backendconnection.hpp | c480d9224672cc28ed33cca84220e411535ce6d8 | [
"MIT"
] | permissive | dmitritt/qlb | 3a7efcb44158305963983cb4c2345259ada60cf4 | 936f2a7c7546b7d74cdf6a552012deed87e4ab79 | refs/heads/master | 2021-01-22T00:06:08.689241 | 2016-01-26T02:09:07 | 2016-01-26T02:09:07 | 46,975,767 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,694 | hpp | backendconnection.hpp | /*
* Copyright (c) 2016 Dmitri
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef BACKEND_CONNECTION_HPP
#define BACKEND_CONNECTION_HPP
#include <memory>
#include <boost/asio.hpp>
#include "backend.hpp"
#include "../config.hpp"
#include "../ipc/requestresponse.hpp"
#include "../ipc/message.hpp"
using boost::asio::ip::tcp;
namespace IPC {
class BackendConnection : public std::enable_shared_from_this<BackendConnection> {
public:
typedef std::shared_ptr<BackendConnection> Ptr;
BackendConnection(BufferPool& bufferPoll, Backend::Ptr backend, boost::asio::io_service& ioService);
BackendConnection(const BackendConnection&) = delete;
BackendConnection& operator=(const BackendConnection&) = delete;
~BackendConnection();
bool isConnected() {return connected;}
void start(IPC::HandshakeRequest& request, IPC::HandshakeResponse& response);
bool take() {return backend->take();}
void executeRequest(const IPC::Message& request, IPC::Response& response);
void close();
bool operator==(Backend::Ptr& other) {return backend==other;}
private:
void markBroken();
void connect(tcp::resolver::iterator i);
void handshake();
void readHandshakeResponse();
void writeRequestHeader();
void writeRequestBody();
void readResponseHeader();
void readResponseBody(uint32_t bodySize);
private:
BufferPool& bufferPool;
bool connected;
Backend::Ptr backend;
tcp::socket socket;
IPC::HandshakeRequest* handshakeRequest;
IPC::HandshakeResponse* handshakeResponse;
char handshakeResponseByte;
const IPC::Message* request;
IPC::Response* response;
};
} // namespace IPC
#endif /* BACKEND_CONNECTION_HPP */ |
959d712cc81d829bd9a9464e65f92b51836b222f | 96fb1353679afdd341415db403e7eed6dfd50be7 | /roadrunner/ludum/Player.cpp | 841543c3d267fb1de91f2d1db78771b2a276389b | [] | no_license | maxime1907/minigames | c4e740eac7ea42b00c6c675d265d0166de4032c4 | 40ba4d20b63e73fd72fefbd1ef40bcfaeb623c78 | refs/heads/master | 2022-06-27T17:40:17.361041 | 2020-05-05T15:21:28 | 2020-05-05T15:21:28 | 261,506,944 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,493 | cpp | Player.cpp | #include "stdafx.h"
#include "Player.h"
#include "Common.h"
Player::Player(const std::string & pseudo, std::string & t_name, int id)
: Sprite(t_name)
{
this->t_score = new Text(R_FONT("Roboto.ttf"));
this->pseudo = pseudo;
this->id = id;
this->setSpeed(sf::Vector2f(D_SPEED_X, D_SPEED_Y));
this->setScore(0);
}
Player::~Player()
{
}
void Player::setScore(int score)
{
this->v_score = score;
this->t_score->setString(std::to_string(this->v_score));
this->t_score->setPosition(W_WIDTH - (this->t_score->getLocalBounds().width * 2), 0);
}
int Player::getScore() const
{
return (v_score);
}
void Player::setSpeed(const sf::Vector2f speed)
{
this->speed = speed;
}
sf::Vector2f Player::getSpeed() const
{
return (this->speed);
}
Text *Player::getScoreText() const
{
return (t_score);
}
void Player::move(sf::Keyboard::Key dir)
{
sf::Vector2f pos(getPosition().x, getPosition().y);
if (dir == sf::Keyboard::Left)
pos.x -= 4.0f * this->speed.x;
else if (dir == sf::Keyboard::Right)
pos.x += 4.0f * this->speed.x;
else if (dir == sf::Keyboard::Up)
pos.y -= 4.0f * this->speed.y;
else if (dir == sf::Keyboard::Down)
pos.y += 4.0f * this->speed.y;
setPosition(pos);
}
bool Player::isColliding(Sprite object) const
{
return (getGlobalBounds().intersects(object.getGlobalBounds()));
}
void Player::die()
{
this->alive = false;
}
bool Player::isAlive() const
{
return (this->alive);
} |
4e12d838d3ca0f39e5ce4732ea6c843899d77000 | 41b977ea112430d4e249635be5645de7111a1d6b | /CarRentalManagement/ui/dialog/contract/contracttabledialog.cpp | 4b04edbab1babc0f43b6c684cdbc469d8319fa79 | [] | no_license | longcp/CarRentalManagement | 168956e0767b451c82dec7ac7d5792d418431a24 | 1b2c8b0d94cc23f9c7b8d790dd911913326d9935 | refs/heads/master | 2021-01-11T17:39:26.219784 | 2017-09-03T16:56:33 | 2017-09-03T16:56:33 | 79,816,071 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,000 | cpp | contracttabledialog.cpp | #include "contracttabledialog.h"
#include "ui_contracttabledialog.h"
#include <database/database.h>
#include <rentaldocument.h>
#include <tablemodel.h>
#include <contract.h>
#define LOG_TAG "CONTRACT_TABLE_DIALOG"
#include "utils/Log.h"
ContractTableDialog::ContractTableDialog(QWidget *parent) :
QDialog(parent),
mDb(DataBase::getInstance()),
ui(new Ui::ContractTableDialog)
{
ui->setupUi(this);
this->setFixedSize(750, 700);
initView();
}
ContractTableDialog::~ContractTableDialog()
{
delete ui;
}
void
ContractTableDialog::initView()
{
this->setWindowTitle("้ๆฉๅๅ");
//่ฎพ็ฝฎ้ฆ่กๆ ้ข
QStringList headerList;
headerList << "ๅๅๅท" << "ๅฎขๆทๅ็งฐ" << "ๅทฅ็จๅ" << "ๅทฅ็จๅฐๅ"
<< "็ญพ่ฎขๆฅๆ";
mModel = new TableModel(0, headerList.size());
ui->contractTableView->setModel(mModel);
mModel->setHorizontalHeaderLabels(headerList);
//่ฎพ็ฝฎๅๅ
ๆ ผไธๅฏ็ผ่พ,ๅๅป้ไธญไธ่กไธๅช่ฝ้ไธญไธ่ก
ui->contractTableView->setEditTriggers(
QAbstractItemView::NoEditTriggers);
ui->contractTableView->setSelectionBehavior(
QAbstractItemView::SelectRows);
ui->contractTableView->setSelectionMode(
QAbstractItemView::SingleSelection);
ui->contractTableView->horizontalHeader()->setSectionResizeMode(headerList.size()-1, QHeaderView::Stretch);
ui->contractTableView->verticalHeader()->setVisible(false); //้่่ก่กจๅคด
ui->contractTableView->horizontalHeader()->setStyleSheet(
"QHeaderView::section{"
"background-color:rgb(234, 234, 234)}"); //่กจๅคด้ข่ฒ
ui->contractTableView->setAlternatingRowColors(true);
ui->contractTableView->setStyleSheet(
"QTableWidget{background-color:rgb(250, 250, 250);"
"alternate-background-color:rgb(255, 255, 224);}"); //่ฎพ็ฝฎ้ด้่ก้ข่ฒๅๅ
ui->contractTableView->setSortingEnabled(true);
ui->contractTableView->setColumnWidth(0, 150);
ui->contractTableView->setColumnWidth(1, 150);
ui->contractTableView->setColumnWidth(2, 150);
ui->contractTableView->setColumnWidth(3, 150);
ui->contractTableView->setColumnWidth(4, 150);
}
void
ContractTableDialog::initTableView(QString clientNumber)
{
int size, ret;
QList<Contract>contracts;
Contract contract;
if (mModel->rowCount() > 0)
mModel->removeRows(0, mModel->rowCount());
if (clientNumber != "")
ret = mDb->getContractInClientNumber(clientNumber, contracts);
else
ret = mDb->getAllContractData(contracts);
if (ret)
return;
size = contracts.size();
for (int i = 0; i < size; i++) {
contract = contracts.at(i);
addContractItem(contract);
}
}
void
ContractTableDialog::addContractItem(Contract &contract)
{
QStandardItem* num
= new QStandardItem(contract.number);
QStandardItem* clientName
= new QStandardItem(contract.clientName);
QStandardItem* projectName
= new QStandardItem(contract.projectName);
QStandardItem* projectAddr
= new QStandardItem(contract.projectAddress);
QStandardItem* signedDate
= new QStandardItem(contract.signedDate.toString(DATE_FORMAT_STR));
QList<QStandardItem*> items;
items << num << clientName << projectName << projectAddr << signedDate;
mModel->appendRow(items);
}
void
ContractTableDialog::openWindow(QString clientNumber)
{
ALOGDTRACE();
initTableView(clientNumber);
this->exec();
}
void
ContractTableDialog::openWindow()
{
ALOGDTRACE();
initTableView("");
this->exec();
}
void
ContractTableDialog::on_contractTableView_doubleClicked(const QModelIndex &index)
{
ALOGDTRACE();
int curRow = ui->contractTableView->currentIndex().row();
emit selectedContract(mModel->index(curRow, 0).data().toString());
this->close();
}
|
bd20e6df9160713e242a7bd1b1301db3f957efeb | f4e0f5e651bb44f3e095bd4ca22fe79a8a5b92e5 | /src/lib/solution.cc | 77829d2cd9b0f9b79876d2658876c261a27c7129 | [] | no_license | RudrenduMahindar/EE599-HW2-Q5_2 | 360b8a584b74d204f4cb22f567a5332427837532 | 88620e0e2eba7f52824667167c07bf97285f3fe8 | refs/heads/master | 2020-12-28T11:20:51.341675 | 2020-02-04T21:32:19 | 2020-02-04T21:32:19 | 238,311,191 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cc | solution.cc | #include "solution.h"
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
void Solution::StringReverse(string& s) {
reverse(s.begin(),s.end());
}
|
bd643dce3d943ccd7813f5de1ada590a1cd25117 | 349fe789ab1e4e46aae6812cf60ada9423c0b632 | /FIB_DataModule/SprProject/UDMSprProject.cpp | cfb8b9b6811b1c9d1463f19fe6623c7610f7f8b2 | [] | no_license | presscad/ERP | a6acdaeb97b3a53f776677c3a585ca860d4de980 | 18ecc6c8664ed7fc3f01397d587cce91fc3ac78b | refs/heads/master | 2020-08-22T05:24:15.449666 | 2019-07-12T12:59:13 | 2019-07-12T12:59:13 | 216,326,440 | 1 | 0 | null | 2019-10-20T07:52:26 | 2019-10-20T07:52:26 | null | WINDOWS-1251 | C++ | false | false | 9,492 | cpp | UDMSprProject.cpp | //---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UDMSprProject.h"
#include "UGlobalConstant.h"
#include "UGlobalFunction.h"
#include "IDMSetup.h"
#include "IDMQueryRead.h"
#include "IConnectionInterface.h"
#include "IMainInterface.h"
#include "IMainCOMInterface.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "FIBDatabase"
#pragma link "FIBDataSet"
#pragma link "pFIBDatabase"
#pragma link "pFIBDataSet"
#pragma link "FIBQuery"
#pragma link "pFIBQuery"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TDMSprProject::TDMSprProject(TComponent* Owner)
: TDataModule(Owner)
{
FunctionDeleteImpl=0;
flDeleteImpl=true;
InterfaceMainObject=0;
InterfaceOwnerObject=0;
DM_Connection=0;
InterfaceGlobalCom=0;
}
//---------------------------------------------------------------------------
bool TDMSprProject::Init(void)
{
bool result=false;
if (InterfaceMainObject>0)
{
//ะฟะพะปััะธะผ ัะพะตะดะธะฝะตะฝะธะต
IConnectionInterface * i_connection;
InterfaceMainObject->kanQueryInterface(IID_IConnectionInterface,(void**)&i_connection);
DM_Connection=i_connection->GetFibConnection();
i_connection->kanRelease();
//ะฟะพะปััะธะผ ะธะฝัะตััะตะนั COM ัะธััะตะผั ะดะปั ัะพะทะดะฐะฝะธั ะฝะพะฒัั
ะพะฑัะตะบัะพะฒ
IMainCOMInterface * i_com;
InterfaceMainObject->kanQueryInterface(IID_IMainCOMInterface,(void**)&i_com);
InterfaceGlobalCom=i_com->GetCOM();
i_com->kanRelease();
}
IBTr->DefaultDatabase=DM_Connection->pFIBData;
IBTrUpdate->DefaultDatabase=DM_Connection->pFIBData;
Table->Database=DM_Connection->pFIBData;
Element->Database=DM_Connection->pFIBData;
Code->Database=DM_Connection->pFIBData;
//ะะ ะะะะะะะะ
DM_Connection->GetPrivDM(GCPRIV_DM_NoModule);
ExecPriv=DM_Connection->ExecPriv;
InsertPriv=DM_Connection->InsertPriv;
EditPriv=DM_Connection->EditPriv;
DeletePriv=DM_Connection->DeletePriv;
result=true;
return result;
}
//---------------------------------------------------------------------------
int TDMSprProject::Done(void)
{
return -1;
}
//---------------------------------------------------------------------------
void __fastcall TDMSprProject::DataModuleDestroy(TObject *Sender)
{
Table->Active=false;
Element->Active=false;
Code->Active=false;
if (flDeleteImpl==true)
{
if (FunctionDeleteImpl) FunctionDeleteImpl();
}
}
//---------------------------------------------------------------------------
AnsiString TDMSprProject::GetTextQuery(__int64 id_grp, bool all)
{
AnsiString result="";
if(all==true)
{//ะฑะตะท ะณััะฟะฟ
result=result+" select *";
result=result+" from SPROJECT";
result=result+" ORDER BY NAME_SPROJECT";
} //ะฑะตะท ะณััะฟะฟ
else
{ //ะฟะพ ะณััะฟะฟะฐะผ
if (id_grp==0)
{ //ะบะพัะฝะตะฒะพะน ะบะฐัะฐะปะพะณ
result=result+" select *";
result=result+" from SPROJECT";
result=result+" where IDGRP_SPROJECT IS NULL";
result=result+" ORDER BY NAME_SPROJECT";
}
else //ะทะฐะดะฐะฝะฐ ะณััะฟะฟะฐ
{
result=result+" select *";
result=result+" from SPROJECT";
result=result+" where IDGRP_SPROJECT="+IntToStr(id_grp);
result=result+" ORDER BY NAME_SPROJECT";
}
}
return result;
}
//---------------------------------------------------------------------------
void TDMSprProject::OpenTable(__int64 id_grp,bool all)
{
IdGrp=id_grp;
AllElement=all;
Table->Active=false;
Table->SelectSQL->Clear();
Table->SelectSQL->Add(GetTextQuery(id_grp,all));
Table->Open();
}
//---------------------------------------------------------------------------
bool TDMSprProject::NewElement(__int64 id_grp)
{
bool result=false;
Element->Active=false;
Code->Active=false;
int code=GetCodeProject();
if (code!=0)
{
Element->Open();
Element->Insert();
if (id_grp!=0)
{
ElementIDGRP_SPROJECT->AsInt64=id_grp;
}
ElementCODE_SPROJECT->AsInteger=code+1;
result=true;
}
else
{
Error=true;
result=false;
TextError="ะะต ัะดะฐะปะพัั ััะพัะผะธัะพะฒะฐัั ะบะพะด ัะปะตะผะตะฝัะฐ!";
}
return result;
}
//---------------------------------------------------------------------------
int TDMSprProject::OpenElement(__int64 id)
{
Element->Active=false;
Element->ParamByName("PARAM_ID")->AsInt64=id;
Element->Active=true;
int result=0;
result=Element->RecordCount;
return result;
}
//---------------------------------------------------------------------------
__int64 TDMSprProject::FindPoCodu(int code)
{
__int64 result=0;
IDMQueryRead *q;
InterfaceGlobalCom->kanCreateObject("Oberon.DMQueryRead.1",IID_IDMQueryRead,
(void**)&q);
q->Init(InterfaceMainObject,0);
q->pFIBQ->Close();
q->pFIBQ->SQL->Clear();
q->pFIBQ->SQL->Add("select ID_SPROJECT from SPROJECT where CODE_SPROJECT=:PARAM_CODE");
q->pFIBQ->ParamByName("PARAM_CODE")->AsInteger=code;
q->pFIBQ->ExecQuery();
result=OpenElement(q->pFIBQ->FieldByName("ID_SPROJECT")->AsInt64);
q->pFIBQ->Close();
q->kanRelease();
return result;
}
//----------------------------------------------------------------------------
__int64 TDMSprProject::FindPoName(AnsiString name)
{
__int64 result=0;
IDMQueryRead *q;
InterfaceGlobalCom->kanCreateObject("Oberon.DMQueryRead.1",IID_IDMQueryRead,
(void**)&q);
q->Init(InterfaceMainObject,0);
q->pFIBQ->Close();
q->pFIBQ->SQL->Clear();
q->pFIBQ->SQL->Add("select ID_SPROJECT from SPROJECT where NAME_SPROJECT=:PARAM_NAME");
q->pFIBQ->ParamByName("PARAM_NAME")->AsString=name;
q->pFIBQ->ExecQuery();
result=q->pFIBQ->FieldByName("ID_SPROJECT")->AsInt64;
q->pFIBQ->Close();
q->kanRelease();
return result;
}
//---------------------------------------------------------------------------
bool TDMSprProject::SaveElement()
{
bool res=false;
IdElement=ElementID_SPROJECT->AsInt64;
//ะฟัะพะฒะตัะธัั ะบะพะด ะฝะฐ ัะฝะธะบะฐะปัะฝะพััั
if (CheckCode(glStrToInt64(ElementID_SPROJECT->AsString),
ElementCODE_SPROJECT->AsInteger)==true)
{
res=false;
TextError="ะะพะด ัะพะฒะฐัะฐ ะฝะต ัะฝะธะบะฐะปัะฝัะน !";
return res;
}
try
{
Element->ApplyUpdates();
IBTrUpdate->Commit();
OpenElement(IdElement);
res=true;
}
catch(Exception &exception)
{
Error=true;
TextError=exception.Message;
//ShowMessage(TextError);
}
return res;
}
//---------------------------------------------------------------------------
bool TDMSprProject::DeleteElement(__int64 id)
{
bool result=true;
Element->Active=false;
Element->ParamByName("PARAM_ID")->AsInt64=id;
Element->Active=true;
if (Element->RecordCount==1)
{
Element->Delete();
try
{
Element->ApplyUpdates();
IBTrUpdate->Commit();
result=true;
}
catch(Exception &exception)
{
IBTrUpdate->Rollback();
TextError=exception.Message;
result=false;
}
}
return result;
}
//----------------------------------------------------------------------------
void TDMSprProject::ChancheGrp(__int64 new_id_grp)
{
OpenElement(TableID_SPROJECT->AsInt64);
Element->Edit();
ElementIDGRP_SPROJECT->AsInt64=new_id_grp;
Element->Post();
SaveElement();
OpenTable(IdGrp,AllElement);
}
//----------------------------------------------------------------------------
__int64 TDMSprProject::GetIdGrpProject(__int64 id_project)
{
__int64 res;
res=0;
IDMQueryRead *q;
InterfaceGlobalCom->kanCreateObject("Oberon.DMQueryRead.1",IID_IDMQueryRead,
(void**)&q);
q->Init(InterfaceMainObject,0);
q->pFIBQ->Close();
q->pFIBQ->SQL->Clear();
q->pFIBQ->SQL->Add("select IDGRP_SPROJECT from SPROJECT where ID_SPROJECT='"+IntToStr(id_project)+"'");
q->pFIBQ->ExecQuery();
res=q->pFIBQ->FieldByName("IDGRP_SPROJECT")->AsInt64;
q->pFIBQ->Close();
q->kanRelease();
return res;
}
//------------------------------------------------------------------------------
int TDMSprProject::GetCodeProject(void)
{
int result=0;
IDMSetup * setup;
InterfaceGlobalCom->kanCreateObject("Oberon.DMSetup.1",IID_IDMSetup,
(void**)&setup);
setup->Init(InterfaceMainObject,0);
setup->OpenElement(2);
if (setup->ElementVALUE_SETUP->AsString=="1")
{
Code->Active=false;
Code->Active=true;
result=CodeMAXCODE->AsInteger;
if(result==0) result=1;
}
else
{
ShowMessage("ะญะปะตะผะตะฝัั ัะฟัะฐะฒะพัะฝะธะบะฐ ะัะพะตะบัั ะผะพะถะฝะพ ัะพะทะดะฐะฒะฐัั ัะพะปัะบะพ ะฒ ัะตะฝััะฐะปัะฝะพะน ะฑะฐะทะต!");
result=0;
}
setup->kanRelease();
return result;
}
//---------------------------------------------------------------------------
bool TDMSprProject::CheckCode(__int64 id_project, int code)
{
//ะฒะพะทะฒัะฐัะฐะตั true ะตัะปะธ ะบะพะด ะฝะต ัะฝะธะบะฐะปัะฝัะน
bool result=false;
IDMQueryRead *q;
InterfaceGlobalCom->kanCreateObject("Oberon.DMQueryRead.1",IID_IDMQueryRead,
(void**)&q);
q->Init(InterfaceMainObject,0);
q->pFIBQ->Close();
q->pFIBQ->SQL->Clear();
q->pFIBQ->SQL->Add("select ID_SPROJECT");
q->pFIBQ->SQL->Add(" from SPROJECT");
q->pFIBQ->SQL->Add(" where CODE_SPROJECT=:PARAM_CODE");
q->pFIBQ->ParamByName("PARAM_CODE")->AsString=code;
q->pFIBQ->ExecQuery();
while(!q->pFIBQ->Eof)
{
if (id_project==glStrToInt64(q->pFIBQ->FieldByName("ID_SPROJECT")->AsString))
{
result=true;
break;
}
q->pFIBQ->Next();
}
q->pFIBQ->Close();
q->kanRelease();
return result;
}
//----------------------------------------------------------------------------
|
644c1dae0deb2438b127da2a0e19bce4a89d83ef | 4a8f783118bd1bba8023f5dbd499b08e1822ce93 | /tests/Unit/Evolution/DiscontinuousGalerkin/Limiters/Test_LimiterActionsWithMinmod.cpp | 3e6b665f0a307f863426e7b300e11dc3d05fc8cd | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | denyzamelchor/spectre | 8db0757005dea9bb53cd7bd68ee8d11551705da4 | 1c1b72fbf464827788dbbdb8782a8251a2921c48 | refs/heads/develop | 2020-04-26T05:57:25.244454 | 2019-06-22T04:11:17 | 2019-06-22T04:11:17 | 155,779,028 | 0 | 0 | NOASSERTION | 2018-11-01T21:38:07 | 2018-11-01T21:38:06 | null | UTF-8 | C++ | false | false | 5,605 | cpp | Test_LimiterActionsWithMinmod.cpp | // Distributed under the MIT License.
// See LICENSE.txt for details.
#include "tests/Unit/TestingFramework.hpp"
#include <boost/functional/hash.hpp> // IWYU pragma: keep
#include <cstddef>
#include <memory>
#include <pup.h>
#include <string>
#include <utility>
#include "DataStructures/DataBox/DataBox.hpp"
#include "DataStructures/DataBox/DataBoxTag.hpp"
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/Tensor.hpp"
#include "DataStructures/Variables.hpp"
#include "Domain/CoordinateMaps/Affine.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/ProductMaps.hpp"
#include "Domain/Element.hpp"
#include "Domain/ElementId.hpp"
#include "Domain/ElementIndex.hpp"
#include "Domain/ElementMap.hpp"
#include "Domain/LogicalCoordinates.hpp"
#include "Domain/Mesh.hpp"
#include "Domain/SizeOfElement.hpp" // IWYU pragma: keep
#include "Domain/Tags.hpp"
#include "Evolution/DiscontinuousGalerkin/Limiters/LimiterActions.hpp" // IWYU pragma: keep
#include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.tpp"
#include "Evolution/DiscontinuousGalerkin/Limiters/MinmodType.hpp"
#include "NumericalAlgorithms/Spectral/Spectral.hpp"
#include "Parallel/AddOptionsToDataBox.hpp"
#include "Parallel/PhaseDependentActionList.hpp" // IWYU pragma: keep
#include "Utilities/Gsl.hpp"
#include "Utilities/TMPL.hpp"
#include "tests/Unit/ActionTesting.hpp"
// IWYU pragma: no_include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.hpp"
// IWYU pragma: no_forward_declare ActionTesting::InitializeDataBox
namespace {
struct TemporalId : db::SimpleTag {
static std::string name() noexcept { return "TemporalId"; }
using type = int;
};
struct Var : db::SimpleTag {
static std::string name() noexcept { return "Var"; }
using type = Scalar<DataVector>;
};
template <size_t Dim>
struct System {
static constexpr const size_t volume_dim = Dim;
using variables_tag = Tags::Variables<tmpl::list<Var>>;
};
struct LimiterTag {
using type = Limiters::Minmod<2, tmpl::list<Var>>;
};
template <size_t Dim, typename Metavariables>
struct component {
using metavariables = Metavariables;
using chare_type = ActionTesting::MockArrayChare;
using array_index = ElementIndex<Dim>;
using const_global_cache_tag_list = tmpl::list<LimiterTag>;
using add_options_to_databox = Parallel::AddNoOptionsToDataBox;
using simple_tags =
db::AddSimpleTags<TemporalId, Tags::Mesh<Dim>, Tags::Element<Dim>,
Tags::ElementMap<Dim>,
Tags::Coordinates<Dim, Frame::Logical>,
Tags::Coordinates<Dim, Frame::Inertial>, Var>;
using compute_tags = db::AddComputeTags<Tags::SizeOfElement<Dim>>;
using phase_dependent_action_list = tmpl::list<
Parallel::PhaseActions<
typename Metavariables::Phase, Metavariables::Phase::Initialization,
tmpl::list<
ActionTesting::InitializeDataBox<simple_tags, compute_tags>>>,
Parallel::PhaseActions<
typename Metavariables::Phase, Metavariables::Phase::Testing,
tmpl::list<Limiters::Actions::SendData<Metavariables>,
Limiters::Actions::Limit<Metavariables>>>>;
};
template <size_t Dim>
struct Metavariables {
using component_list = tmpl::list<component<Dim, Metavariables>>;
using const_global_cache_tag_list = tmpl::list<>;
using limiter = LimiterTag;
using system = System<Dim>;
using temporal_id = TemporalId;
static constexpr bool local_time_stepping = false;
enum class Phase { Initialization, Testing, Exit };
};
} // namespace
// This test checks that the Minmod limiter's interfaces and type aliases
// succesfully integrate with the limiter actions. It does this by compiling
// together the Minmod limiter and the actions, then making calls to the
// SendData and the Limit actions. No checks are performed here that the limiter
// and/or actions produce correct output: that is done in other tests.
SPECTRE_TEST_CASE("Unit.Evolution.DG.Limiters.LimiterActions.Minmod",
"[Unit][NumericalAlgorithms][Actions]") {
using metavariables = Metavariables<2>;
using my_component = component<2, metavariables>;
const Mesh<2> mesh{3, Spectral::Basis::Legendre,
Spectral::Quadrature::GaussLobatto};
const ElementId<2> self_id(1, {{{2, 0}, {1, 0}}});
const Element<2> element(self_id, {});
using Affine = domain::CoordinateMaps::Affine;
using Affine2D = domain::CoordinateMaps::ProductOf2Maps<Affine, Affine>;
PUPable_reg(SINGLE_ARG(
domain::CoordinateMap<Frame::Logical, Frame::Inertial, Affine2D>));
const Affine xi_map{-1., 1., 3., 7.};
const Affine eta_map{-1., 1., 7., 3.};
auto map = ElementMap<2, Frame::Inertial>(
self_id,
domain::make_coordinate_map_base<Frame::Logical, Frame::Inertial>(
Affine2D(xi_map, eta_map)));
auto logical_coords = logical_coordinates(mesh);
auto inertial_coords = map(logical_coords);
auto var = Scalar<DataVector>(mesh.number_of_grid_points(), 1234.);
ActionTesting::MockRuntimeSystem<metavariables> runner{
Limiters::Minmod<2, tmpl::list<Var>>(Limiters::MinmodType::LambdaPi1)};
ActionTesting::emplace_component_and_initialize<my_component>(
&runner, self_id,
{0, mesh, element, std::move(map), std::move(logical_coords),
std::move(inertial_coords), std::move(var)});
runner.set_phase(metavariables::Phase::Testing);
// SendData
runner.next_action<my_component>(self_id);
CHECK(runner.is_ready<my_component>(self_id));
// Limit
runner.next_action<my_component>(self_id);
}
|
8fe23290adb220d3c596bdc4d33a2653ffd175b9 | 0fdaa8fc6d9d8bd9085f7f45d51c3974a125d135 | /tugas 1/oprasi_hitung.cpp | 1eb09709eb0d7a6996e6f602945848f2f5fd4989 | [] | no_license | univmajalengka/20.14.1.0055-Andi_gunawan | c291d256697de80a72c2269deabd4a92b69a1d20 | 5e6da65e8d8768b37275d430a818f55468e3bcc0 | refs/heads/main | 2023-04-15T18:19:13.273997 | 2021-04-22T15:21:29 | 2021-04-22T15:21:29 | 350,022,594 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 627 | cpp | oprasi_hitung.cpp | #include<iostream>
using namespace std;
void batas(){
cout<<"----------------------------"<<endl;
}
int main(){
int i,j;
cout<<"Masukkan nilai i : ";
cin>>i;
cout<<"Masukkan nilai j : ";
cin>>j;
batas();
cout<<"| operasi | hasil operasi |"<<endl;
batas();
cout<<"| "<<i<<" + "<<j<<" | "<<i+j<<" |"<<endl;
cout<<"| "<<i<<" - "<<j<<" | "<<i-j<<" |"<<endl;
cout<<"| "<<i<<" * "<<j<<" | "<<i*j<<" |"<<endl;
cout<<"| "<<i<<" div "<<j<<" | "<<i/j<<" |"<<endl;
cout<<"| "<<i<<" mod "<<j<<" | "<<i%j<<" |"<<endl;
batas();
}
|
acc18d60d09e966337b6ef852d04185d7031de10 | a596d4c41d911af298debb7366d5bfa75e5ad9e1 | /tkrzw_lib_common.cc | d50e044339d623e2bae24c94842b9562454fbd46 | [
"Apache-2.0"
] | permissive | strogo/tkrzw | 863d520d7ef123e22b8d628f58ef503b0ace5bc7 | b2eca2c739628498155c5c7f9d18ff0658730f39 | refs/heads/master | 2023-05-01T14:08:44.939861 | 2021-05-17T04:41:19 | 2021-05-17T04:41:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,499 | cc | tkrzw_lib_common.cc | /*************************************************************************************************
* Common library features
*
* Copyright 2020 Google LLC
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
* https://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*************************************************************************************************/
#include "tkrzw_sys_config.h"
#include "tkrzw_lib_common.h"
namespace tkrzw {
#if defined(_SYS_WINDOWS_)
const int32_t PAGE_SIZE = 4096;
const char* const PACKAGE_VERSION = _TKRZW_PKG_VERSION;;
const char* const LIBRARY_VERSION = _TKRZW_LIB_VERSION;;
const char* const OS_NAME = _TKRZW_OSNAME;
const bool IS_POSIX = _IS_POSIX;
const bool IS_BIG_ENDIAN = _IS_BIG_ENDIAN;
constexpr int32_t EDQUOT = 10001;
#else
const int32_t PAGE_SIZE = sysconf(_SC_PAGESIZE);
const char* const PACKAGE_VERSION = _TKRZW_PKG_VERSION;;
const char* const LIBRARY_VERSION = _TKRZW_LIB_VERSION;;
const char* const OS_NAME = _TKRZW_OSNAME;
const bool IS_POSIX = _IS_POSIX;
const bool IS_BIG_ENDIAN = _IS_BIG_ENDIAN;
#endif
const Status& Status::OrDie() const {
if (code_ != SUCCESS) {
throw StatusException(*this);
}
return *this;
}
void* xmallocaligned(size_t alignment, size_t size) {
#if defined(_SYS_LINUX_)
assert(alignment > 0);
void* ptr = std::aligned_alloc(alignment, size);
if (ptr == nullptr) {
throw std::bad_alloc();
}
return ptr;
#elif defined(_SYS_WINDOWS_)
assert(alignment > 0);
void* ptr = _aligned_malloc(size, alignment);
if (ptr == nullptr) {
throw std::bad_alloc();
}
return ptr;
#else
assert(alignment > 0);
void* ptr = xmalloc(size + sizeof(void*) + alignment);
char* aligned = (char*)ptr + sizeof(void*);
aligned += alignment - (intptr_t)aligned % alignment;
std::memcpy(aligned - sizeof(void*), &ptr, sizeof(void*));
return aligned;
#endif
}
void xfreealigned(void* ptr) {
#if defined(_SYS_LINUX_)
assert(ptr != nullptr);
std::free(ptr);
#elif defined(_SYS_WINDOWS_)
assert(ptr != nullptr);
_aligned_free(ptr);
#else
assert(ptr != nullptr);
void* orig = nullptr;
std::memcpy(&orig, (char*)ptr - sizeof(void*), sizeof(void*));
std::free(orig);
#endif
}
uint64_t HashMurmur(const void* buf, size_t size, uint64_t seed) {
assert(buf != nullptr && size <= (1 << 30));
const uint64_t mul = 0xc6a4a7935bd1e995ULL;
const int32_t rtt = 47;
uint64_t hash = seed ^ (size * mul);
const unsigned char* rp = (const unsigned char*)buf;
while (size >= sizeof(uint64_t)) {
uint64_t num = ((uint64_t)rp[0] << 0) | ((uint64_t)rp[1] << 8) |
((uint64_t)rp[2] << 16) | ((uint64_t)rp[3] << 24) |
((uint64_t)rp[4] << 32) | ((uint64_t)rp[5] << 40) |
((uint64_t)rp[6] << 48) | ((uint64_t)rp[7] << 56);
num *= mul;
num ^= num >> rtt;
num *= mul;
hash *= mul;
hash ^= num;
rp += sizeof(uint64_t);
size -= sizeof(uint64_t);
}
switch (size) {
case 7: hash ^= (uint64_t)rp[6] << 48; // fall through
case 6: hash ^= (uint64_t)rp[5] << 40; // fall through
case 5: hash ^= (uint64_t)rp[4] << 32; // fall through
case 4: hash ^= (uint64_t)rp[3] << 24; // fall through
case 3: hash ^= (uint64_t)rp[2] << 16; // fall through
case 2: hash ^= (uint64_t)rp[1] << 8; // fall through
case 1: hash ^= (uint64_t)rp[0]; hash *= mul; // fall through
};
hash ^= hash >> rtt;
hash *= mul;
hash ^= hash >> rtt;
return hash;
}
uint64_t HashFNV(const void* buf, size_t size) {
assert(buf != nullptr && size <= (1 << 30));
uint64_t hash = 14695981039346656037ULL;
const unsigned char* rp = (unsigned char*)buf;
const unsigned char* ep = rp + size;
while (rp < ep) {
hash = (hash ^ *(rp++)) * 109951162811ULL;
}
return hash;
}
uint32_t HashCRC32Continuous(const void* buf, size_t size, bool finish, uint32_t seed) {
static uint32_t table[UINT8MAX];
static std::once_flag table_once_flag;
std::call_once(table_once_flag, [&]() {
for (uint32_t i = 0; i < UINT8MAX; i++) {
uint32_t c = i;
for (int32_t j = 0; j < 8; j++) {
c = (c & 1) ? (0xEDB88320 ^ (c >> 1)) : (c >> 1);
}
table[i] = c;
}
});
const uint8_t* rp = (uint8_t*)buf;
const uint8_t* ep = rp + size;
uint32_t crc = seed;
while (rp < ep) {
crc = table[(crc ^ *rp) & 0xFF] ^ (crc >> 8);
rp++;
}
if (finish) {
crc ^= 0xFFFFFFFF;
}
return crc;
}
std::mt19937 hidden_random_generator(19780211);
std::mutex hidden_random_generator_mutex;
uint64_t MakeRandomInt() {
std::uniform_int_distribution<uint64_t> dist(0, UINT64MAX);
std::lock_guard<std::mutex> lock(hidden_random_generator_mutex);
return dist(hidden_random_generator);
}
double MakeRandomDouble() {
std::uniform_real_distribution<double> dist(0.0, 1.0);
std::lock_guard<std::mutex> lock(hidden_random_generator_mutex);
return dist(hidden_random_generator);
}
Status GetErrnoStatus(const char* call_name, int32_t sys_err_num) {
auto msg = [&](const char* message) {
return std::string(call_name) + ": " + message;
};
switch (sys_err_num) {
case EAGAIN: return Status(Status::SYSTEM_ERROR, msg("temporarily unavailable"));
case EINTR: return Status(Status::SYSTEM_ERROR, msg("interrupted by a signal"));
case EACCES: return Status(Status::PERMISSION_ERROR, msg("permission denied"));
case ENOENT: return Status(Status::NOT_FOUND_ERROR, msg("no such file"));
case ENOTDIR: return Status(Status::NOT_FOUND_ERROR, msg("not a directory"));
case EISDIR: return Status(Status::INFEASIBLE_ERROR, msg("duplicated directory"));
case ELOOP: return Status(Status::INFEASIBLE_ERROR, msg("looped path"));
case EFBIG: return Status(Status::INFEASIBLE_ERROR, msg("too big file"));
case ENOSPC: return Status(Status::INFEASIBLE_ERROR, msg("no enough space"));
case ENOMEM: return Status(Status::INFEASIBLE_ERROR, msg("no enough memory"));
case EEXIST: return Status(Status::DUPLICATION_ERROR, msg("already exist"));
case ENOTEMPTY: return Status(Status::INFEASIBLE_ERROR, msg("not empty"));
case EBADF: return Status(Status::SYSTEM_ERROR, msg("bad file descriptor"));
case EINVAL: return Status(Status::SYSTEM_ERROR, msg("invalid file descriptor"));
case EIO: return Status(Status::SYSTEM_ERROR, msg("low-level I/O error"));
case EFAULT: return Status(Status::SYSTEM_ERROR, msg("fault buffer address"));
case EDQUOT: return Status(Status::INFEASIBLE_ERROR, msg("exhausted quota"));
case EMFILE: return Status(Status::INFEASIBLE_ERROR, msg("exceeding process limit"));
case ENFILE: return Status(Status::INFEASIBLE_ERROR, msg("exceeding system-wide limit"));
case ENAMETOOLONG: return Status(Status::INFEASIBLE_ERROR, msg("too long name"));
case ETXTBSY: return Status(Status::INFEASIBLE_ERROR, msg("busy file"));
case EOVERFLOW: return Status(Status::INFEASIBLE_ERROR, msg("size overflow"));
}
return Status(Status::SYSTEM_ERROR, msg("unknown error: ") + std::to_string(sys_err_num));
}
} // namespace tkrzw
// END OF FILE
|
f3a5e0428698ef15f63f1aae82873b822342b497 | ae33344a3ef74613c440bc5df0c585102d403b3b | /SDK/SOT_BP_BountyRewardSkullItemInfo_Legendary+_parameters.hpp | b1b97cd1d16ec80dd7c7d65ab4ae9a2f18bb3132 | [] | no_license | ThePotato97/SoT-SDK | bd2d253e811359a429bd8cf0f5dfff73b25cecd9 | d1ff6182a2d09ca20e9e02476e5cb618e57726d3 | refs/heads/master | 2020-03-08T00:48:37.178980 | 2018-03-30T12:23:36 | 2018-03-30T12:23:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,186 | hpp | SOT_BP_BountyRewardSkullItemInfo_Legendary+_parameters.hpp | #pragma once
// SOT: Sea of Thieves (1.0) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x4)
#endif
#include "../SDK.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function BP_BountyRewardSkullItemInfo_Legendary+.BP_BountyRewardSkullItemInfo_Legendary+_C.UserConstructionScript
struct ABP_BountyRewardSkullItemInfo_Legendary__C_UserConstructionScript_Params
{
};
// Function BP_BountyRewardSkullItemInfo_Legendary+.BP_BountyRewardSkullItemInfo_Legendary+_C.ReceiveBeginPlay
struct ABP_BountyRewardSkullItemInfo_Legendary__C_ReceiveBeginPlay_Params
{
};
// Function BP_BountyRewardSkullItemInfo_Legendary+.BP_BountyRewardSkullItemInfo_Legendary+_C.ExecuteUbergraph_BP_BountyRewardSkullItemInfo_Legendary+
struct ABP_BountyRewardSkullItemInfo_Legendary__C_ExecuteUbergraph_BP_BountyRewardSkullItemInfo_Legendary__Params
{
int EntryPoint; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) 0000
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
1840aa52abb58d42205012c8fa927df6bbfe00a8 | 15e9ba286ef373b7c1e9982e8f7217155b997c2d | /FileUtil.h | f3c58bbcdb5c6f48674558fc374b16d3d19ed01c | [] | no_license | tzl0031/i2cdevlib | a2af74506315dbe08f1bcfae309276333f418c52 | ef80e7b7626e637648526367a1482f41a63a77c6 | refs/heads/master | 2021-01-12T00:10:19.300419 | 2017-06-21T16:07:14 | 2017-06-21T16:07:14 | 78,680,148 | 0 | 0 | null | 2017-06-21T16:28:55 | 2017-01-11T21:10:57 | C++ | UTF-8 | C++ | false | false | 483 | h | FileUtil.h | // FileUtil//
// FileUtil.h
// adxl345_cpp
//
// Created by TianLiu on 1/11/2017.
// Copyright ยฉ 2016 TianLiu. All rights reserved.
//
#include <fstream>
#include <iostream>
#include <json/json.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
#ifndef FILEUTIL_H
#define FILEUTIL_H
class FileUtil {
public:
FileUtil();
int getPort();
string getHost();
string getRpiID();
private:
string host;
int port;
string rpi_id;
};
#endif
|
4a71b53349d9319470611f391d58beea71acec89 | f3001cd56567b121736343b480a1abf9cba1cd52 | /K-Scope/Host/graph.cpp | 0ed7bc151e5b1d30d49685ca80ed951fe06a49bc | [] | no_license | cjsatuforc/AvrProjects | 257f0594740b215ff2db2abaa79ec718cd14d647 | a9f70a87a28e426ee4a558ca5ddc198f97a1ebdb | refs/heads/master | 2020-04-13T19:00:06.609001 | 2011-03-18T16:01:42 | 2011-03-18T16:01:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,413 | cpp | graph.cpp | #include "graph.h"
#include <QtGui/QPainter>
#include <QtGui/QPen>
#include <QtGui/QKeyEvent>
#include <QtGui/QPainterPath>
#include <QtGui/QPrinter>
#include <QtGui/QPrintDialog>
#include "mytransform.h"
#include "exception.h"
//----------------------------------------------------------------------------
int greed_cnty=10;
int greed_cntx=10;
//----------------------------------------------------------------------------
MyGraph::MyGraph(QWidget *p)
:QWidget(p)
{
small_grid=0;
m_scale=1.0;
x_org=0.0;
y_org=0.0;
vert=new QScrollBar(Qt::Vertical, this);
hor=new QScrollBar(Qt::Horizontal, this);
updateScrollBars();
connect(vert, SIGNAL(valueChanged(int)),
this, SLOT(scrollY(int)));
connect(hor, SIGNAL(valueChanged(int)),
this, SLOT(scrollX(int)));
setFocusPolicy(Qt::StrongFocus);
small_grid_pen.setColor(Qt::lightGray);
small_grid_pen.setWidth(0);
grid_pen.setColor(Qt::black);
grid_pen.setWidth(2);
_dataRect = QRectF(0, 500, 1000, -1000);
_dataXOffset =0.0;
_dataXScale =1.0;
}
//----------------------------------------------------------------------------
void MyGraph::paintEvent ( QPaintEvent * event )
{
QPainter p(this);
this->autoFillBackground();
//p.setBrush(QBrush(QColor(80, 120, 90)));
//p.drawRect(rect());
p.scale(m_scale, m_scale);
p.translate(-x_org, -y_org);
Draw(p, rect());
}
//----------------------------------------------------------------------------
void MyGraph::Draw(QPainter &p, const QRectF &rect)
{
if(m_data.size()<=0) return;
QRectF dataRect = QRectF(_dataXOffset*_dataXScale,
_dataRect.top(),
_dataRect.width()*_dataXScale,
_dataRect.height());
MyTransform trans(rect, dataRect);
drawGrid(p, dataRect, rect);
//p.setRenderHint (QPainter::Antialiasing, true);
p.setFont(ax_font);
drawAxis(p, dataRect, rect);
draw_arg(p, dataRect, rect);
drawCurves(p, trans);
p.setPen(grid_pen);
p.setFont(header_font);
p.drawText(QRectF(rect.left(), rect.top(),
rect.width(), p.fontMetrics().height()+5),Qt::AlignCenter, m_name);
}
//----------------------------------------------------------------------------
void MyGraph::resizeEvent ( QResizeEvent * event )
{
updateScrollBars();
}
//----------------------------------------------------------------------------
void MyGraph::mouseMoveEvent ( QMouseEvent * event)
{
if(event->buttons()&Qt::LeftButton)
{
hor->setValue((int)(old_x_org+(click_x-event->x())/m_scale));
vert->setValue((int)(old_y_org+(click_y-event->y())/m_scale));
update();
}
}
//----------------------------------------------------------------------------
void MyGraph::mousePressEvent ( QMouseEvent * event)
{
if(event->buttons()&Qt::LeftButton)
{
click_x=event->x();
click_y=event->y();
old_x_org=x_org;
old_y_org=y_org;
}
}
//----------------------------------------------------------------------------
void MyGraph::keyPressEvent ( QKeyEvent * event )
{
switch (event->key()) {
case Qt::Key_Left:
hor->setValue(hor->value()-10);
//x_org-=10;
break;
case Qt::Key_Right:
hor->setValue(hor->value()+10);
//x_org+=10;
break;
case Qt::Key_Down:
vert->setValue(vert->value()+10);
//y_org+=10;
break;
case Qt::Key_Up:
vert->setValue(vert->value()-10);
//y_org-=10;
break;
case Qt::Key_Plus:
ZoomIn();
break;
case Qt::Key_Minus:
ZoomOut();
break;
/*case Qt::Key_P:
small_grid_pen.setColor(Qt::black);
Print(this);
small_grid_pen.setColor(Qt::lightGray);
break;*/
default:
QWidget::keyPressEvent(event);
}
}
//----------------------------------------------------------------------------
void MyGraph::ZoomIn()
{
if(m_scale<10.0)
m_scale*=1.25;
updateScrollBars();
}
//----------------------------------------------------------------------------
void MyGraph::ZoomOut()
{
if(m_scale>0.1)
m_scale*=0.8;
updateScrollBars();
}
//----------------------------------------------------------------------------
void MyGraph::wheelEvent ( QWheelEvent * event )
{
if(event->delta()>0)
ZoomIn();
else
ZoomOut();
}
//----------------------------------------------------------------------------
void MyGraph::updateScrollBars()
{
int w=15;
vert->setGeometry(rect().right()-w, rect().top(), w, rect().bottom()-w);
hor->setGeometry(0, rect().bottom()-w, rect().right()-w, w );
scroll_visible = m_scale>1.01;
vert->setVisible(scroll_visible);
hor->setVisible(scroll_visible);
vert->setMaximum((int)qMax(height()*(m_scale-1)/m_scale,1.0));
hor->setMaximum((int)qMax(width()*(m_scale-1)/m_scale,1.0));
vert->setMinimum(0);
hor->setMinimum(0);
update();
}
//----------------------------------------------------------------------------
void MyGraph::scrollX(int v)
{
x_org=v;
update();
}
//----------------------------------------------------------------------------
void MyGraph::scrollY(int v)
{
y_org=v;
update();
}
//----------------------------------------------------------------------------
void MyGraph::drawGrid(QPainter &p, const QRectF &dataRect, const QRectF &viewRect)
{
if(viewRect.width()<=0.0 || viewRect.height()<=0.0) return;
double x, y, dx, dy, endx, endy, sx, sy;
double greed_stepx=(viewRect.width())/greed_cntx;
double greed_stepy=(viewRect.height())/greed_cnty;
endx=viewRect.right();
endy=viewRect.bottom();
sx=viewRect.left();
sy=viewRect.top();
if(small_grid && viewRect.width()>2*greed_cntx*greed_cntx &&
viewRect.height()>2*greed_cnty*greed_cnty)
{
p.setPen(small_grid_pen);
dx=greed_stepx/greed_cntx;
dy=greed_stepy/greed_cnty;
for(x=sx; x<=endx;x+=dx)
{
p.drawLine(QLineF(x, sy, x, endy));
}
for(y=sy; y<=endy;y+=dy)
{
p.drawLine(QLineF(sx, y, endx, y));
}
}
p.setPen(grid_pen);
for(x=sx; x<=endx;x+=greed_stepx)
{
p.drawLine(QLineF(x, sy, x, endy));
}
for(y=sy; y<=endy+1;y+=greed_stepy)
{
p.drawLine(QLineF(sx, y, endx, y));
}
}
//----------------------------------------------------------------------------
int MyGraph::CurvesCount()
{
return m_data.size();
}
//----------------------------------------------------------------------------
void MyGraph::drawCurves(QPainter &p, const MyTransform &transform)
{
for(int i=0; i<CurvesCount(); i++)
{
CurveAt(i).draw(p, transform);
}
}
//----------------------------------------------------------------------------
void MyGraph::drawAxis(QPainter &p, const QRectF &dataRect, const QRectF &viewRect)
{
}
//----------------------------------------------------------------------------
void MyGraph::draw_arg(QPainter &p, const QRectF &dataRect, const QRectF &viewRect)
{
}
//----------------------------------------------------------------------------
void MyGraph::Clear()
{
for(int i=0; i<m_data.size(); i++)
{
delete m_data[i];
}
m_data.clear();
}
//----------------------------------------------------------------------------
Curve &MyGraph::CreateNewCurve(AX_POS attachPos)
{
Curve *ngr=new Curve();
switch(attachPos)
{
case LEFT:
//sc_left.Add(ngr);
break;
case RIGHT:
//sc_right.Add(ngr);
break;
}
m_data.push_back(ngr);
ngr->setPen(QPen(QBrush(Qt::green), 2, Qt::SolidLine, Qt::FlatCap));
return *ngr;
}
//----------------------------------------------------------------------------
QString MyGraph::ArgUnits()
{
return arg_units;
}
//----------------------------------------------------------------------------
QString MyGraph::ArgName()
{
return arg_name;
}
//----------------------------------------------------------------------------
void MyGraph::Remove(int n)
{
delete m_data.at(n);
m_data.remove(n);
}
//----------------------------------------------------------------------------
void MyGraph::setHeaderFont(const QFont &f)
{
header_font=f;
}
//----------------------------------------------------------------------------
void MyGraph::setAxisFont(const QFont &f)
{
ax_font=f;
}
void MyGraph::setGridPen(const QPen &pen)
{
grid_pen=pen;
}
void MyGraph::setArgUnits(const QString &str){arg_units=str;}
void MyGraph::setArgName(const QString &str){arg_name=str;}
void MyGraph::setName(const QString &name){m_name=name;}
Curve &MyGraph::CurveAt(int n)
{
return *m_data.at(n);
}
void MyGraph::SetDataScaleX(double value)
{
_dataXScale = value;
}
void MyGraph::SetDataOffsetX(double value)
{
_dataXOffset = value;
}
void MyGraph::SetDataRect(const QRectF &value)
{
_dataRect = value;
}
|
0c41b0f23a4d0c9ae55a231fe76a845d8feeea98 | 9503d7b9359625235c4311e397fe012ae136d4b1 | /source/Loader/Memory/MemoryMap.cpp | df3d35d0686eb392a97d786e045de1e47499359e | [] | no_license | zhiayang/mx | 43a45e5eef17f7bd5c08f7037b97c386a53406d7 | 4c181951913eb18c59d5542df43148259f0cba92 | refs/heads/develop | 2020-12-24T19:17:32.447631 | 2019-02-05T16:39:17 | 2019-02-05T16:39:17 | 23,584,386 | 18 | 8 | null | 2019-02-05T16:40:03 | 2014-09-02T15:34:31 | C++ | UTF-8 | C++ | false | false | 1,514 | cpp | MemoryMap.cpp | // MemoryMap.cpp
// Copyright (c) 2014 - 2016, zhiayang@gmail.com
// Licensed under the Apache License Version 2.0.
#include "../FxLoader.hpp"
namespace Memory
{
void Initialise(Multiboot::Info_type* MBTStruct, MemoryMap_type* memmap)
{
uint64_t TotalMapAddressess = (uint64_t) MBTStruct->mmap_addr;
uint64_t TotalMapLength = MBTStruct->mmap_length;
memmap->SizeOfThisStructure = sizeof(uint32_t) + sizeof(uint16_t);
memmap->NumberOfEntries = 0;
// Check if the fields are valid:
if(!(MBTStruct->flags & (1 << 6)))
{
Console::Print("FLAGS: %x", MBTStruct->flags);
assert("No Multiboot Memory Map!" && 0);
}
Multiboot::MemoryMap_type* mmap = (Multiboot::MemoryMap_type*) TotalMapAddressess;
while((uint64_t) mmap < (uint64_t)(TotalMapAddressess + TotalMapLength))
{
(memmap->Entries[memmap->NumberOfEntries]).BaseAddress = (uint64_t) mmap->BaseAddr_Low | (uint64_t)(mmap->BaseAddr_High) << 32;
(memmap->Entries[memmap->NumberOfEntries]).Length = (uint64_t)(mmap->Length_Low | (uint64_t)(mmap->Length_High) << 32);
(memmap->Entries[memmap->NumberOfEntries]).MemoryType = (uint8_t) mmap->Type;
memmap->SizeOfThisStructure += sizeof(MemoryMapEntry_type);
Console::Print("Found memory map entry: %x -> %x, %d\n", (memmap->Entries[memmap->NumberOfEntries]).BaseAddress, (memmap->Entries[memmap->NumberOfEntries]).Length, mmap->Type);
memmap->NumberOfEntries++;
mmap = (Multiboot::MemoryMap_type*)((uint64_t) mmap + mmap->Size + sizeof(uint32_t));
}
}
}
|
733c454121db5b44c933064b35b3d1d54971273d | e08f3f5904f70ed2d2b36d5d10bd517e4dec9ea2 | /benchmark/runner.cpp | 29b2d704407c29a5e598dc9618765ad94e9bfbfb | [
"BSL-1.0",
"Apache-2.0"
] | permissive | sdmg15/outcome | 9bc4f11f6d7ee6a561584a5547c8aa323783eb8e | 1157d7b2e43cdccd66402ca64fd0317383c81391 | refs/heads/develop | 2022-12-20T01:21:02.716082 | 2020-09-16T11:40:43 | 2020-09-16T11:40:43 | 298,104,544 | 1 | 0 | Apache-2.0 | 2020-09-23T22:04:10 | 2020-09-23T22:02:32 | null | UTF-8 | C++ | false | false | 1,641 | cpp | runner.cpp | /* Benchmark test runner
(C) 2017-2020 Niall Douglas <http://www.nedproductions.biz/> (7 commits)
File Created: Mar 2017
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 in the accompanying file
Licence.txt or 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.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file Licence.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include "timing.h"
#include <stdio.h>
#include "function.h"
#if defined(_CPPUNWIND) || defined(__EXCEPTIONS)
#include <exception>
#endif
#define ITERATIONS 100000
extern volatile int counter;
volatile int counter, forcereturn;
int main(void)
{
#ifdef _WIN32
SetThreadAffinityMask(GetCurrentThread(), 2ULL);
#endif
{
usCount start=GetUsCount();
while(GetUsCount()-start<1*1000000000000LL);
}
auto start = ticksclock();
for(int n=0; n<ITERATIONS; n++)
{
#if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
forcereturn += !FUNCTION(n);
#else
try
{
forcereturn += !FUNCTION(n);
}
catch(const std::exception &)
{
}
#endif
}
auto end = ticksclock();
double ticks=end-start;
ticks/=ITERATIONS;
printf("%f\n", ticks);
return 0;
}
|
95d649484455aeaffc558bc8788d8e722ff34719 | 86aef33f7aae96c0d0a2d5afb7ff0f70a1ce1e83 | /src/Sound/SDLSystem.hpp | e7fc73c489eac92158e94b2d02235a790789f1cc | [] | no_license | ughman/pistachio-doom | 6fb9c3696b7f6887f6a7e8bd05b337e0de728a7c | 8b676f1edc9e86ea4d1df3cae16044517bae7422 | refs/heads/master | 2020-08-27T04:38:06.975508 | 2012-11-02T22:57:02 | 2012-11-02T22:57:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 744 | hpp | SDLSystem.hpp | #ifndef Sound_SDLSystem_hpp
#define Sound_SDLSystem_hpp
#include <SDL.h>
#include "../List.hpp"
#include "System.hpp"
namespace Sound
{
class SDLSystem : public System
{
private:
SDLSystem(const SDLSystem &);
SDLSystem &operator=(const SDLSystem &);
PtrList <Stream> Sounds;
PtrList <Stream> Musics;
public:
void Callback(signed short *Stream,int OutLength);
SDLSystem(float SoundVolume,float MusicVolume);
virtual void PlaySound(Stream *S,void *UserData);
virtual void PlayMusic(Stream *S,void *UserData);
virtual void StopSound(void *UserData);
virtual void StopMusic(void *UserData);
virtual void StopAll();
virtual void Update();
virtual ~SDLSystem();
};
}
#endif
|
43d7e43c99996bc7d9497d7d7e932d6cc9140046 | 81d6038455f5a48ebb68dca111d410dc93805886 | /iterator.cc | e2ec26fb133800122dcacc8d2a24e54e645be048 | [] | no_license | jeetendrabhattad/design_patterns | ac7be12b100d171bff2f775a7a3dc21b7110546c | c0ee3da8ea40b2ec73648cb2c4bc1c52874516e1 | refs/heads/master | 2020-05-23T22:51:28.491276 | 2019-05-16T07:30:32 | 2019-05-16T07:30:32 | 186,982,714 | 6 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,386 | cc | iterator.cc | #include <iostream>
using namespace std;
template<typename T>
class IIterator
{
public:
virtual void First() = 0;
virtual void Last() = 0;
virtual bool Next() = 0;
virtual T Current() = 0;
};
class Container
{
int arr[5];
int size = 5;
public:
Container() : arr{1,2,3,4,5}
{
}
Container* begin()
{
return this;
}
class Iterator : public IIterator<int>
{
Container *container;
int size;
int nav = 0;
public:
Iterator(Container *cont) : container(cont), size(cont->size)
{
}
virtual void First()
{
nav = 0;
}
virtual void Last()
{
nav = size - 1;
}
virtual bool Next()
{
nav++;
return nav < size;
}
virtual int Current()
{
return container->arr[nav];
}
int operator*()
{
return Current();
}
//implement below methods, implement end as well
void operator++()
{
}
void operator++(int)
{
}
};
};
int main()
{
Container container;
Container::Iterator it = container.begin();
cout<<it.Current()<<endl;
while(it.Next())
{
cout<<it.Current()<<endl;
}
return 0;
}
|
78aa6f590c9d1760366cb9f50db7f2a5dd5b1413 | eda03521b87da8bdbef6339b5b252472a5be8d23 | /Userland/DevTools/HackStudio/Debugger/RegistersModel.h | 0d4505b2ea8b88c96803d389677a7270f1cd6bf3 | [
"BSD-2-Clause"
] | permissive | SerenityOS/serenity | 6ba3ffb242ed76c9f335bd2c3b9a928329cd7d98 | ef9b6c25fafcf4ef0b44a562ee07f6412aeb8561 | refs/heads/master | 2023-09-01T13:04:30.262106 | 2023-09-01T08:06:28 | 2023-09-01T10:45:38 | 160,083,795 | 27,256 | 3,929 | BSD-2-Clause | 2023-09-14T21:00:04 | 2018-12-02T19:28:41 | C++ | UTF-8 | C++ | false | false | 1,570 | h | RegistersModel.h | /*
* Copyright (c) 2020, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibGUI/Model.h>
#include <sys/arch/regs.h>
namespace HackStudio {
struct RegisterData {
DeprecatedString name;
FlatPtr value;
bool changed { false };
};
class RegistersModel final : public GUI::Model {
public:
static RefPtr<RegistersModel> create(PtraceRegisters const& regs)
{
return adopt_ref(*new RegistersModel(regs));
}
static RefPtr<RegistersModel> create(PtraceRegisters const& current_regs, PtraceRegisters const& previous_regs)
{
return adopt_ref(*new RegistersModel(current_regs, previous_regs));
}
enum Column {
Register,
Value,
__Count
};
virtual ~RegistersModel() override = default;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual ErrorOr<String> column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
PtraceRegisters const& raw_registers() const { return m_raw_registers; }
private:
explicit RegistersModel(PtraceRegisters const& regs);
RegistersModel(PtraceRegisters const& current_regs, PtraceRegisters const& previous_regs);
PtraceRegisters m_raw_registers;
Vector<RegisterData> m_registers;
};
}
|
7cba8a7f63dc2c98204dac73531ee2a06d9e1b1e | 2fcd8317ace48c6085ff9082325c796730b54796 | /src/overlaybd/fs/path.cpp | 085b9a10a674fec4a3dad61e0a62eb67bc4f6636 | [
"Apache-2.0"
] | permissive | zhuguoliang/overlaybd | 57692be2b2c4f30dcfc6d13f5c4f2554f4d67ce7 | f057b44a5e4cf684e454a1f420b8db0753277b81 | refs/heads/main | 2023-05-25T07:49:26.028290 | 2021-05-06T08:26:43 | 2021-05-06T08:26:43 | 363,534,802 | 0 | 1 | Apache-2.0 | 2021-05-02T00:25:43 | 2021-05-02T00:25:42 | null | UTF-8 | C++ | false | false | 9,646 | cpp | path.cpp | /*
Copyright The Overlaybd Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "path.h"
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include "../utility.h"
#include "string.h"
#include "assert.h"
#include "../alog.h"
#include "../alog-stdstring.h"
#include "../enumerable.h"
using namespace std;
#define ERROR_RETURN(no, ret) { errno = no; return ret; }
#define SEEK2NODE(node, fn, create_path) \
Node* node; \
std::string fn; \
{ \
Path p(path); \
auto dir_base = p.dir_base_name(); \
node = seek2node(dir_base.first, create_path); \
if (!node) return -1; \
fn = string(dir_base.second); \
}
#define SEEK2ENT(node, it) \
Node::iterator it; \
SEEK2NODE(node, __fn__, false) \
it = node->find(__fn__); \
if (it == node->end()) \
ERROR_RETURN(ENOENT, -1);
namespace FileSystem
{
void Path::iterator::set(const char* p)
{
if (!p || !*p)
return init_view(nullptr, 0);
// skip any number of slashes
while(p < end && *p != '\0' && *p == '/') ++p;
auto ptr = p;
// find the next slash
while(p < end && *p != '\0' && *p != '/') ++p;
init_view(ptr, p - ptr);
}
bool Path::level_valid()
{
int level = 0;
for (auto& name: *this)
{
auto size = name.size();
if (size > 0)
if (name[0] == '.')
{
if (size == 1)
{ // the case for '.'
continue;
}
else if (size == 2)
{ // the case for '..'
if (name[1] == '.')
if (--level < 0)
return false;
}
else ++level;
}
}
return true;
}
int mkdir_recursive(const string_view &pathname, IFileSystem* fs, mode_t mode) {
//no relative path. Use Tree::Node to transform relative path to absolute one.
auto len = pathname.length();
if (len == 0) return 0;
char path[PATH_MAX];
if (pathname[0] != '/') {
*path = '/';
memcpy(path + 1, pathname.begin(), len);
len++;
} else {
memcpy(path, pathname.begin(), len);
}
path[len] = '\0';
for (size_t i=1; i<len; i++) {
if (path[i] == '/') {
path[i] = 0;
auto ret = fs->mkdir(path, mode);
if (ret < 0) {
auto e = errno;
if (e != EEXIST) {
return -1;
}
}
path[i] = '/';
}
}
return 0;
}
namespace Tree
{
Node* Node::seek2node(string_view path, bool create_path)
{
auto node = this;
for (auto& p: Path(path))
{
if (is_dots(p))
ERROR_RETURN(EINVAL, nullptr);
string name(p);
auto it = node->find(name);
if (it == node->end())
{
if (!create_path)
ERROR_RETURN(ENOENT, nullptr);
auto ret = node->emplace(std::move(name), Value(new Node));
assert(ret.second);
it = ret.first;
}
else if (!it->second.is_node())
{
ERROR_RETURN(EEXIST, nullptr);
}
node = it->second.as_node_ptr();
}
return node;
}
int Node::creat(string_view path, void* v, bool create_path)
{
if (path.empty() || path.back() == '/')
ERROR_RETURN(EINVAL, -1);
SEEK2NODE(node, fn, create_path);
auto ret = node->emplace(std::move(fn), Value(v));
if (!ret.second)
ERROR_RETURN(EEXIST, -1);
return 0;
}
int Node::read(string_view path, void** v)
{
if (path.empty() || path.back() == '/')
ERROR_RETURN(EINVAL, -1);
SEEK2ENT(node, it);
if (it->second.is_node())
ERROR_RETURN(EISDIR, -1);
*v = it->second.value;
return 0;
}
int Node::write(string_view path, void* v)
{
if (path.empty() || path.back() == '/')
ERROR_RETURN(EINVAL, -1);
SEEK2ENT(node, it);
if (it->second.is_node())
ERROR_RETURN(EISDIR, -1);
it->second.value = v;
return 0;
}
int Node::unlink(string_view path)
{
if (path.empty() || path.back() == '/')
ERROR_RETURN(EINVAL, -1);
SEEK2ENT(node, it);
if (it->second.is_node())
ERROR_RETURN(EISDIR, -1);
node->erase(it);
return 0;
}
int Node::mkdir(string_view path, bool _p)
{
if (path.empty())
ERROR_RETURN(EINVAL, -1);
SEEK2NODE(node, fn, _p);
if (node->count(fn) > 0)
ERROR_RETURN(EEXIST, -1);
node->emplace(std::move(fn), Value(new Node));
return 0;
}
int Node::rmdir(string_view path)
{
if (path.empty())
ERROR_RETURN(EINVAL, -1);
SEEK2ENT(node, it);
if (!it->second.is_node())
ERROR_RETURN(ENOTDIR, -1);
if (!it->second.as_node_ptr()->empty())
ERROR_RETURN(ENOTEMPTY, -1);
node->erase(it);
return 0;
}
int Node::stat(string_view path)
{
if (path.empty())
ERROR_RETURN(EINVAL, -2);
SEEK2ENT(node, it);
return it->second.is_node() ? 2 : 1;
}
Node* Node::chdir(string_view path)
{
if (path.empty())
ERROR_RETURN(EINVAL, nullptr);
return seek2node(path);
}
}
Walker::Walker(IFileSystem* fs, string_view path)
{
if (!fs) return;
m_filesystem = fs;
path_push_back(path);
enter_dir();
if (path.empty() || path.back() != '/') {
path_push_back("/");
}
}
int Walker::enter_dir()
{
auto dir = m_filesystem->opendir(m_path_buffer);
if (!dir)
LOG_ERRNO_RETURN(0, -1, "failed to opendir(`)", m_path);
m_stack.emplace(dir);
return 0;
}
int Walker::is_dir(dirent* entry)
{
if (entry->d_type == DT_DIR)
return 1;
if (entry->d_type == DT_UNKNOWN)
{
struct stat st;
auto ret = m_filesystem->lstat(m_path_buffer, &st);
if (ret < 0)
LOG_ERRNO_RETURN(0, -1, "failed to lstat '`'", m_path);
return S_ISDIR(st.st_mode);
}
return 0;
}
void Walker::path_push_back(string_view s)
{
auto len0 = m_path.length();
auto len1 = s.length();
assert(len0 + len1 < sizeof(m_path_buffer) - 1);
memcpy(m_path_buffer + len0, s.data(), len1 + 1);
m_path = string_view(m_path_buffer, len0 + len1);
}
void Walker::path_pop_back(size_t len1)
{
auto len0 = m_path.length();
assert(len0 > len1);
len0 -= len1;
m_path_buffer[len0] = '\0';
m_path = string_view(m_path_buffer, len0);
}
int Walker::next()
{
again:
if (m_path.empty()) return -1;
if (m_path.back() != '/')
{
auto m = m_path.rfind('/');
if (m != m_path.npos) {
auto len0 = m_path.length();
path_pop_back(len0 - m - 1);
m_stack.top()->next();
}
}
dirent* entry;
string_view name;
while(true)
{
entry = m_stack.top()->get();
if (entry) {
name = entry->d_name;
if (!is_dots(name)) break;
if (m_stack.top()->next() == 1) continue;
}
m_stack.pop();
if (m_stack.empty())
{
return -1; // finished walking
}
assert(m_path.back() == '/');
path_pop_back(1);
goto again;
}
path_push_back(name);
int ret = is_dir(entry);
if (ret < 0) {
return -1; // fail
} else if (ret == 1) {
enter_dir();
path_push_back("/");
goto again;
} /* else if (ret == 0) */
return 0; // file
}
}
|
df6e4cbb8740934b2cfaa59737148461ab82c6c1 | 765bfddd9ad06a56db801cc825b8e35eea5ecfce | /src/modelwidget.cpp | 9022117829c4260a882007a3aa51ec72540644ae | [
"MIT"
] | permissive | Instalox/dust3d | d3e09fad2acfdbf78f0875d24f61b12c702cdcc0 | 30ae8b1acd7bd887d62188f7704fe194bd567f63 | refs/heads/master | 2020-03-11T23:15:15.007484 | 2018-04-19T23:05:58 | 2018-04-19T23:05:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,272 | cpp | modelwidget.cpp | #include <QMouseEvent>
#include <QOpenGLShaderProgram>
#include <QCoreApplication>
#include <QGuiApplication>
#include <math.h>
#include "modelwidget.h"
#include "ds3file.h"
#include "skeletongraphicswidget.h"
#include "modelwidget.h"
// Modifed from http://doc.qt.io/qt-5/qtopengl-hellogl2-glwidget-cpp.html
bool ModelWidget::m_transparent = true;
ModelWidget::ModelWidget(QWidget *parent) :
QOpenGLWidget(parent),
m_xRot(-30 * 16),
m_yRot(45 * 16),
m_zRot(0),
m_program(nullptr),
m_moveStarted(false),
m_graphicsFunctions(NULL)
{
// --transparent causes the clear color to be transparent. Therefore, on systems that
// support it, the widget will become transparent apart from the logo.
if (m_transparent) {
setAttribute(Qt::WA_AlwaysStackOnTop);
setAttribute(Qt::WA_TranslucentBackground);
QSurfaceFormat fmt = format();
fmt.setAlphaBufferSize(8);
fmt.setSamples(4);
setFormat(fmt);
} else {
QSurfaceFormat fmt = format();
fmt.setSamples(4);
setFormat(fmt);
}
setMouseTracking(true);
setContextMenuPolicy(Qt::CustomContextMenu);
}
int ModelWidget::xRot()
{
return m_xRot;
}
int ModelWidget::yRot()
{
return m_yRot;
}
int ModelWidget::zRot()
{
return m_zRot;
}
void ModelWidget::setGraphicsFunctions(SkeletonGraphicsFunctions *graphicsFunctions)
{
m_graphicsFunctions = graphicsFunctions;
}
ModelWidget::~ModelWidget()
{
cleanup();
}
void ModelWidget::setXRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != m_xRot) {
m_xRot = angle;
emit xRotationChanged(angle);
update();
}
}
void ModelWidget::setYRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != m_yRot) {
m_yRot = angle;
emit yRotationChanged(angle);
update();
}
}
void ModelWidget::setZRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != m_zRot) {
m_zRot = angle;
emit zRotationChanged(angle);
update();
}
}
void ModelWidget::cleanup()
{
if (m_program == nullptr)
return;
makeCurrent();
m_meshBinder.cleanup();
delete m_program;
m_program = nullptr;
doneCurrent();
}
void ModelWidget::initializeGL()
{
// In this example the widget's corresponding top-level window can change
// several times during the widget's lifetime. Whenever this happens, the
// QOpenGLWidget's associated context is destroyed and a new one is created.
// Therefore we have to be prepared to clean up the resources on the
// aboutToBeDestroyed() signal, instead of the destructor. The emission of
// the signal will be followed by an invocation of initializeGL() where we
// can recreate all resources.
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &ModelWidget::cleanup);
initializeOpenGLFunctions();
if (m_transparent) {
glClearColor(0, 0, 0, 0);
} else {
QColor bgcolor = QWidget::palette().color(QWidget::backgroundRole());
glClearColor(bgcolor.redF(), bgcolor.greenF(), bgcolor.blueF(), 1);
}
m_program = new ModelShaderProgram;
// Create a vertex array object. In OpenGL ES 2.0 and OpenGL 2.x
// implementations this is optional and support may not be present
// at all. Nonetheless the below code works in all cases and makes
// sure there is a VAO when one is needed.
m_meshBinder.initialize();
// Our camera never changes in this example.
m_camera.setToIdentity();
m_camera.translate(0, 0, -2.1);
// Light position is fixed.
m_program->setUniformValue(m_program->lightPosLoc(), QVector3D(0, 0, 70));
m_program->release();
}
void ModelWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_LINE_SMOOTH);
m_world.setToIdentity();
m_world.rotate(180.0f - (m_xRot / 16.0f), 1, 0, 0);
m_world.rotate(m_yRot / 16.0f, 0, 1, 0);
m_world.rotate(m_zRot / 16.0f, 0, 0, 1);
m_program->bind();
m_program->setUniformValue(m_program->projMatrixLoc(), m_proj);
m_program->setUniformValue(m_program->mvMatrixLoc(), m_camera * m_world);
QMatrix3x3 normalMatrix = m_world.normalMatrix();
m_program->setUniformValue(m_program->normalMatrixLoc(), normalMatrix);
m_meshBinder.paint();
m_program->release();
}
void ModelWidget::resizeGL(int w, int h)
{
m_proj.setToIdentity();
m_proj.perspective(45.0f, GLfloat(w) / h, 0.01f, 100.0f);
}
void ModelWidget::toggleWireframe()
{
if (m_meshBinder.isWireframesVisible())
m_meshBinder.hideWireframes();
else
m_meshBinder.showWireframes();
update();
}
void ModelWidget::mousePressEvent(QMouseEvent *event)
{
if (!m_moveStarted && m_graphicsFunctions && m_graphicsFunctions->mousePress(event))
return;
m_lastPos = event->pos();
if (event->button() == Qt::MidButton) {
if (!m_moveStarted) {
m_moveStartPos = mapToParent(event->pos());
m_moveStartGeometry = geometry();
m_moveStarted = true;
}
}
}
void ModelWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (m_graphicsFunctions)
m_graphicsFunctions->mouseRelease(event);
if (m_moveStarted) {
m_moveStarted = false;
}
}
void ModelWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if (m_graphicsFunctions)
m_graphicsFunctions->mouseDoubleClick(event);
}
void ModelWidget::keyPressEvent(QKeyEvent *event)
{
if (m_graphicsFunctions)
m_graphicsFunctions->keyPress(event);
}
void ModelWidget::mouseMoveEvent(QMouseEvent *event)
{
if (!m_moveStarted && m_graphicsFunctions && m_graphicsFunctions->mouseMove(event))
return;
int dx = event->x() - m_lastPos.x();
int dy = event->y() - m_lastPos.y();
if (event->buttons() & Qt::MidButton) {
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) {
if (m_moveStarted) {
QRect rect = m_moveStartGeometry;
QPoint pos = mapToParent(event->pos());
rect.translate(pos.x() - m_moveStartPos.x(), pos.y() - m_moveStartPos.y());
setGeometry(rect);
}
} else {
setXRotation(m_xRot - 8 * dy);
setYRotation(m_yRot - 8 * dx);
}
}
m_lastPos = event->pos();
}
void ModelWidget::wheelEvent(QWheelEvent *event)
{
if (!m_moveStarted && m_graphicsFunctions && m_graphicsFunctions->wheel(event))
return;
if (m_moveStarted)
return;
qreal delta = event->delta() / 10;
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) {
if (delta > 0)
delta = 1;
else
delta = -1;
} else {
if (fabs(delta) < 1)
delta = delta < 0 ? -1.0 : 1.0;
}
QMargins margins(delta, delta, delta, delta);
setGeometry(geometry().marginsAdded(margins));
}
void ModelWidget::updateMesh(Mesh *mesh)
{
m_meshBinder.updateMesh(mesh);
update();
}
void ModelWidget::exportMeshAsObj(const QString &filename)
{
m_meshBinder.exportMeshAsObj(filename);
}
|
c0d7adab5a282fcb8735ff818a832b601661900e | 646c5c30055f94274658c55904987b32625e914d | /phys/Sprite/SpriteDemo/Physics.cpp | 397906e59d97ac1899b17ce28bf78304042075c9 | [] | no_license | pgtruong/Puzzle-Engine | a2c0ed7e859e48cabba2f28f0f496c772b4ea53e | 7c3484cb8a5e729308ca68b659894e32b36821e3 | refs/heads/master | 2021-01-10T05:36:17.782986 | 2015-03-13T00:21:05 | 2015-03-13T00:21:05 | 44,230,007 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,311 | cpp | Physics.cpp | #include <Physics.h>
Physics::Physics()
{
}
Physics::~Physics()
{
}
Physics::Edges Physics::boundarycheck(Sprite* s, int topleftx, int toplefty, int width, int height) //returns an int if a moving sprite (typically player) from moves outside a rectangular space restriction
{//use enums
//if two walls/ "corner"
if ((s->getX() == topleftx) && (s->getY() == toplefty)) //if sprite encountered the top left corner
return TOPLEFT; //top left corner
else if (((s->getX() + s->getWidth()) == (topleftx + width)) && (s->getY() == toplefty)) //if sprite encountered the top right corner
return TOPRIGHT; //top right corner
else if (((s->getY() + s->getHeight()) == (toplefty + height)) && (s->getX() == topleftx)) //if sprite encountered the bottom left corner
return BOTTOMLEFT; // bottom left
else if (((s->getY() + s->getHeight()) == (toplefty + height)) && (s->getX() + s->getWidth()) == (topleftx + width)) //if sprite encountered the bottom right
return BOTTOMRIGHT; // bottom right
//if only one case/"wall"
else if (s->getX() <= topleftx) //if sprite encountered the "wall" on the left
return LEFT; //the sprite encountered the "wall" on the left
else if ((s->getX() + s->getWidth()) >= (topleftx + width)) //if sprite encountered the "wall" on the right, added "getWidth()" to sprite class
return RIGHT; //the sprite encountered the "wall" on the right
else if (s->getY() <= toplefty) //if sprite encountered the "wall" on the top
return TOP; //the sprite encountered the "wall" on the top
else if ((s->getY() + s->getHeight()) >= (toplefty + height)) //if sprite encountered the "wall" on the bottom, added "getHeight()" to sprite class
return BOTTOM; //the sprite encountered the "wall" on the bottom
else
return NONE; //no collision
}
/*
Physics::Edges Physics::collisiondetection(Sprite* a, Sprite* b) //if two sprites collide (if they weren't in contact before hand), returns an int
{//keep a vector of all the sprite objects being used in the game and call each one for sprite b to check for sprite a (typically player)
//broken, don't use. Use the boundary instead although it will be annoying.
if (a->getID() != b->getID()) //don't want to test with itself
{
if (a->getX() <= (b->getX() + b->getWidth())) //A's left side touching b's right
return LEFT;
else if ((a->getX() + a->getWidth()) >= b->getX()) //A's right side touching b's left
return RIGHT;
else if (a->getY() <= (b->getY() + b->getHeight())) //A's top side touching b's bottom
return TOP;
else if ((a->getY() + a->getHeight()) >= b->getY()) //A's bottom side touching b's top
return BOTTOM;
}
else
return NONE;
}
*/
bool Physics::clickcheck(int xclick, int yclick, Sprite* a) //pass through vector of sprites (vector should not have bg and should have the blank space), returns true if click is within sprite's area
{
if ((a->getX() <= xclick) && (xclick <= (a->getX() + a->getWidth())))
if ((a->getY() <= yclick) && (yclick <= (a->getY() + a->getHeight())))
return true;
else
return false;
}
void Physics::swappinganimation(Sprite* a, Sprite* blank, int movingrate) //assuming sprite a is the sprite that passed the clickcheck, swaps it with the blank sprite if it's next to it, rate should be divisible by height/width
{
int movingtimew = (a->getWidth() + 1) / movingrate; //assumes that this is a not a float/double
int movingtimeh = (a->getHeight() + 1) / movingrate;
if ((a->getX() + a->getWidth() + 1) == blank->getX()) //a is on the left blank
{
for (int i = 0; i != movingtimew; i++)
{
a->movex(movingtimew);
blank->movex(-(movingtimew));
}
}
else if (a->getX() == (blank->getX() + blank->getWidth() + 1)) //a is on the right of blank
{
for (int i = 0; i != movingtimew; i++)
{
a->movex(-(movingtimew));
blank->movex(movingtimew);
}
}
else if ((a->getY() + a->getHeight() + 1) == blank->getY()) //a is above blank
{
for (int i = 0; i != movingtimeh; i++)
{
a->movey(-(movingtimeh));
blank->movey(movingtimeh);
}
}
else if (a->getY() == (blank->getY() + blank->getHeight() + 1)) //a is below blank
{
for (int i = 0; i != movingtimeh; i++)
{
a->movey(movingtimeh);
blank->movey(-(movingtimeh));
}
}
}
void Physics::byeobject() //hopefully calls desconstructor and deletes object
{
delete this;
} |
d0c7fd081f18763dfa0e61fcebfa97b40a28b711 | fcb748331b9400f45be59105cf1cff7a291536ef | /lab4/JG.Sierpinski/JG.Sierpinski/SierpinskiPPM.h | 1acf1259cf15bd8955365f8b88d7a9a116a6a184 | [] | no_license | Jacob273/JG.TechLearning.OpenMP | 13b4b90256ccecf8c0f81db2a60323c34c3faaf8 | 6371abff483c68e14214b3c6acc25c1bdd559121 | refs/heads/master | 2023-02-13T03:19:38.701172 | 2021-01-17T22:34:45 | 2021-01-17T22:34:45 | 316,916,971 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,050 | h | SierpinskiPPM.h | ๏ปฟ#include <math.h>
#include <stdio.h>
#include <thread>
#include <iostream>
#include <chrono>
#pragma warning(disable:4996)
namespace SierpinskiPPM
{
class Sierpinski
{
private:
//unsigned char rgbImage[800][800][3];
unsigned char*** rgbImage;
const int maxLevel = 9;
int _iYmax;
int _iXmax;
int _colors;
const int MAIN_SIZE = 512;
const char* filename = "sierpinskiOutput.ppm";
const char* fileComment = "# ";
public:
Sierpinski(int iXmax, int iYmax, int colors)
{
_iXmax = iXmax;
_iYmax = iYmax;
_colors = colors;
rgbImage = new unsigned char**[_iXmax];
for (int i = 0; i < _iXmax;i++)
{
rgbImage[i] = new unsigned char*[_iYmax];
for (int j = 0; j < _iYmax; j++)
{
rgbImage[i][j] = new unsigned char[colors];
}
}
}
void DrawTriangleToArray(int x, int y, int size_a, int level, int r, int g, int b)
{
unsigned int myLength = MAIN_SIZE / pow(2, level);
for (int i = y; i < myLength + y; i++) //VERTICAL
{
rgbImage[i][x][0] = r;
rgbImage[i][x][1] = g;
rgbImage[i][x][2] = b;
}
for (int i = x; i < myLength + x; i++) //BIAS
{
if (x == 0)
{
rgbImage[i + y][i][0] = r;
rgbImage[i + y][i][1] = g;
rgbImage[i + y][i][2] = b;
}
else if (y > x)
{
int diffYandX = y - x;
rgbImage[i + diffYandX][i][0] = r;
rgbImage[i + diffYandX][i][1] = g;
rgbImage[i + diffYandX][i][2] = b;
}
else if (x > y)
{
int diffXandY = x - y;
rgbImage[i - diffXandY][i][0] = r;
rgbImage[i - diffXandY][i][1] = g;
rgbImage[i - diffXandY][i][2] = b;
}
else
{
rgbImage[i][i][0] = r;
rgbImage[i][i][1] = g;
rgbImage[i][i][2] = b;
}
}
for (int i = x; i < myLength + x; i++) // HORIZONTAL
{
rgbImage[myLength + y][i][0] = r;
rgbImage[myLength + y][i][1] = g;
rgbImage[myLength + y][i][2] = b;
}
level++;
if (level == maxLevel)
{
return;
}
else
{
DrawTriangleToArray(x, y, size_a / 2, level, r, g, b);
DrawTriangleToArray(x, (size_a / 4) + y, size_a / 2, level, r, g, b);
DrawTriangleToArray((size_a / 4) + x, (size_a / 4) + y, size_a / 2, level, r, g, b);
}
}
void MakePixelsBlack()
{
int blackColor = 255;
for (int iX = 0; iX < _iXmax; iX++)
{
for (int iY = 0; iY < _iYmax; iY++)
{
rgbImage[iY][iX][0] = blackColor;
rgbImage[iY][iX][1] = blackColor;
rgbImage[iY][iX][2] = blackColor;
}
}
}
public:
void Run()
{
MakePixelsBlack();
std::thread* t1 = new std::thread([this]
{
int x1 = 0, y1 = 256, size1 = 512, level_1 = 1;
int r1 = 140;
int g1 = 200;
int b1 = 251;
DrawTriangleToArray(x1, y1, size1, level_1, r1, g1, b1);
});
std::thread* t2 = new std::thread([this]
{
int x2 = 0, y2 = 0, size2 = 512, level_2 = 1;
int r2 = 160;
int g2 = 190;
int b2 = 230;
DrawTriangleToArray(x2, y2, size2, level_2, r2, g2, b2);
});
std::thread* t3 = new std::thread([this]
{
int x3 = 256, y3 = 256, size3 = 512, level_3 = 1;
int r3 = 150;
int g3 = 180;
int b3 = 270;
this->DrawTriangleToArray(x3, y3, size3, level_3, r3, g3, b3);
});
//join - Blokuje wฤ
tek wywoลujฤ
cy do momentu przerwania wฤ
tku reprezentowanego przez to wystฤ
pienie,
t1->join();
t2->join();
t3->join();
SaveRgbImageToFile();
std::cout << "Program has finished" << std::endl;
}
void SaveRgbImageToFile()
{
FILE* outputFile = fopen(filename, "wb");
int maxColorValue = 255;
fprintf(outputFile, "P6\n %s\n %d\n %d\n %d\n", fileComment, _iXmax, _iYmax, maxColorValue);
for (int i = 0; i < _iXmax; i++)
{
for (int j = 0; j < _iYmax; j++)
{
fwrite(rgbImage[i][j], _colors, 1, outputFile);
}
}
fclose(outputFile);
}
};
} |
58b2917b4410815b6d64fa612c738d24c80f8918 | e3f27e4c99605900529e2ab2df55f63223468ad7 | /src/qt/CellItem.cpp | 610feefee9cc3080538cbb31de0f3d82f6024b55 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | tudoroancea/game_of_life | ffb818c79d3465c79461b462ba6d1cfa4098b6ba | 69485760edc54f05ed433418df3997a4bd933b37 | refs/heads/develop | 2023-07-07T09:38:04.549702 | 2021-04-16T14:18:59 | 2021-04-16T14:18:59 | 303,137,746 | 5 | 0 | MIT | 2021-08-13T16:56:09 | 2020-10-11T14:22:22 | C++ | UTF-8 | C++ | false | false | 1,721 | cpp | CellItem.cpp | //
// Created by Tudor Oancea on 26/02/2021.
//
#include <QGraphicsRectItem>
#include <QGraphicsSceneMouseEvent>
#include <QtCore>
#include <QPainter>
#include <QBrush>
#include <iostream>
#include "CellItem.hpp"
CellItem::CellItem(qreal const& x, qreal const& y, qreal const& size) : QGraphicsRectItem(x, y, size, size), i_(x), j_(y) {}
CellItem::CellItem(const size_t& i, const size_t& j) : QGraphicsRectItem((qreal) i, (qreal) j, 1.0, 1.0), i_(i), j_(j) {}
[[maybe_unused]] void CellItem::setSize(const qreal& size) {
this->setRect(i_, j_, size, size);
}
void CellItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
Q_UNUSED(option)
Q_UNUSED(widget)
if (this->isSelected()) painter->fillRect(this->rect(), QBrush(Qt::blue));
else painter->fillRect(this->rect(), QBrush(Qt::black));
}
void CellItem::setColor(const QColor& color) {
color_ = color;
}
bool CellItem::equalsTo(CellItem const& other) const {
return this->rect() == other.rect();
}
void CellItem::moveBy(const int& dx, const int& dy) {
// QGraphicsItem::moveBy(dx, dy);
// if ((int)i_+dx < 0) {
// i_ = 0;
// } else {
i_ = size_t(i_+dx);
// }
// if ((int)j_+dy < 0) {
// j_ = 0;
// } else {
j_ = size_t(j_+dy);
// }
this->setRect(i_, j_, 1.0, 1.0);
}
size_t const& CellItem::i() const {
return i_;
}
size_t const& CellItem::j() const {
return j_;
}
void CellItem::moveByX(const int& dx) {
// if ((int)i_+dx < 0) {
// i_ = 0;
// } else {
i_ = size_t(i_+dx);
// }
this->setRect(i_, j_, 1.0, 1.0);
}
void CellItem::moveByY(const int& dy) {
// if ((int)j_+dy < 0) {
// j_ = 0;
// } else {
j_ = size_t(j_+dy);
// }
this->setRect(i_, j_, 1.0, 1.0);
}
CellItem::~CellItem() = default;
|
42fe1e1585bc7c9f552848a183cdd170ba0178c4 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-datapipeline/include/aws/datapipeline/model/ReportTaskProgressResult.h | 5e27d64357b6992681bce90bf0df1626d40c1b20 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 1,836 | h | ReportTaskProgressResult.h | ๏ปฟ/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/datapipeline/DataPipeline_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace DataPipeline
{
namespace Model
{
/**
* <p>Contains the output of ReportTaskProgress.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/datapipeline-2012-10-29/ReportTaskProgressOutput">AWS
* API Reference</a></p>
*/
class AWS_DATAPIPELINE_API ReportTaskProgressResult
{
public:
ReportTaskProgressResult();
ReportTaskProgressResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
ReportTaskProgressResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>If true, the calling task runner should cancel processing of the task. The
* task runner does not need to call <a>SetTaskStatus</a> for canceled tasks.</p>
*/
inline bool GetCanceled() const{ return m_canceled; }
/**
* <p>If true, the calling task runner should cancel processing of the task. The
* task runner does not need to call <a>SetTaskStatus</a> for canceled tasks.</p>
*/
inline void SetCanceled(bool value) { m_canceled = value; }
/**
* <p>If true, the calling task runner should cancel processing of the task. The
* task runner does not need to call <a>SetTaskStatus</a> for canceled tasks.</p>
*/
inline ReportTaskProgressResult& WithCanceled(bool value) { SetCanceled(value); return *this;}
private:
bool m_canceled;
};
} // namespace Model
} // namespace DataPipeline
} // namespace Aws
|
e3bc0419c954344add251ab0e7ddab7cad465929 | 28df9481d16cd7f31554329dc6a82013e61880ee | /Pac-Man/Player.h | 1e62dae798029273c1ad7c6df9df9a87d5a654fe | [] | no_license | Jonathan-Louis/Games2D | fbda09f9e0e64c9ee7f609a746dbd2a638cf5940 | 42146395be56226b489bbc52a84867e75eb986a8 | refs/heads/master | 2020-08-08T04:20:02.005979 | 2019-11-03T14:03:22 | 2019-11-03T14:03:22 | 213,710,905 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 982 | h | Player.h | #pragma once
#include <Bengine/InputManager.h>
#include <Bengine/ResourceManager.h>
#include <Bengine/Camera2D.h>
#include <SDL/SDL.h>
#include "Agents.h"
class Player : public Agents
{
public:
Player();
~Player();
//initialize the player
void init(float speed, Bengine::InputManager* inputManager, Bengine::Camera2D* camera, glm::vec2 pos, glm::vec2 leftTeleport, glm::vec2 rightTeleport);
void update(const std::vector<std::string>& levelData);
void draw(Bengine::SpriteBatch& spriteBatch);
//remove life when contact with ghosts
void removeLife() { _lives--; }
//getters
glm::vec2 getPosition() { return _position; }
int getLives() { return _lives; }
private:
Bengine::InputManager* _inputManager;
Bengine::Camera2D* _camera;
int _frameCounter;
int _textureID;
bool _playerDirection; //true if going right, false if going left
glm::vec2 _leftTeleport;
glm::vec2 _rightTeleport;
int _lives;
int _direction; //0 = right, 1 = left, 2 = up, 3 = down
};
|
18a9036c2b7e0cc2fdf09a7951551b11e9374c97 | 489bfd258b9a57a9314cf34f739105f1b4915d5c | /้่ฎญ/9-7-30/ๆฐๅญไธ่งๅฝข.cpp | 80da50c058a9db843db3be64d7947f9d1309dc9c | [] | no_license | CBYHD/xinao | 3ba7f524ea4a4fde47c0521ca921b08bf38eeb70 | 8b0a8fdeee6807b6446b8d376bb79c3e54d9ac3b | refs/heads/master | 2022-12-24T10:46:25.235252 | 2020-10-02T12:43:47 | 2020-10-02T12:43:47 | 281,280,448 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 660 | cpp | ๆฐๅญไธ่งๅฝข.cpp | #include <iostream>
using namespace std;
int dp[10000][10000], a[10000][10000];
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
cin >> a[i][j];
dp[i % 2][j] = max(dp[(i - 1) % 2][j - 1], dp[(i - 1) % 2][j]) + a[i][j];
}
}
int _max = -1;
for (int i = 1; i <= n; i++)
{
_max = max(_max, dp[n % 2][i]);
}
cout << _max << endl;
return 0;
}
// ----------------------------------------------
// |ๆดๅคไปฃ็ ๏ผgithub.com/cbyhd/xinao |
// ---------------------------------------------- |
b1f12afae1f8b43330c9daab94bbc2d3fdd1941d | dd110efb203da8cd1b50702b60302bc4d87310f1 | /mainwindow.h | 8b46e5d872f7e1b33b8a53225d0bb88a1dbc4424 | [] | no_license | MaximenkoDmitry/FileManager | 76b90b6e9e4eb20458f0108fbcceb6ee3c1d123c | 6e405779fb760e5d8905dfcc52b1df67b951347e | refs/heads/main | 2023-08-11T14:33:07.948858 | 2021-09-16T07:51:54 | 2021-09-16T07:51:54 | 406,696,806 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,201 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include<QDesktopServices>
#include<QListWidgetItem>
#include <dirent.h>
#include <string>
#include<QUrl>
#include <QMessageBox>
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include<functions.h>
#include<QInputDialog>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_pathButton_clicked();
void on_searchButton_clicked();
void on_actionExit_triggered();
void sort();
void showFiles(char* path, int flag);
void on_actionAbout_the_program_triggered();
void on_listWidget_itemDoubleClicked(QListWidgetItem *item);
void on_actionCreate_catalog_triggered();
void on_actionDelete_triggered();
void on_actionRename_triggered();
void on_actionFile_Information_triggered();
void on_actionPaste_triggered();
void show_dir_content(char *path, char* name);
void on_homeButton_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
|
5092bd85f9789bfa09eede2cfde455d4309b4d6b | fd06efb5c6c9981b9445011cfe40443f9b55d777 | /src/com/brickblock/util/logger/ConsoleLogger.h | 55e6fb5df537b78ce7baa10a81d6b488c6c7804b | [] | no_license | Andy608/Brickblock | 4055673dae22ff68ad1f37db1735448647efc047 | e365208e522708aa7a4b0c8447f3c5a8f3bc1ffc | refs/heads/master | 2021-09-18T14:39:17.876697 | 2018-01-11T13:26:14 | 2018-01-11T13:26:14 | 105,421,930 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 944 | h | ConsoleLogger.h | #ifndef BB_CONSOLELOGGER_H_
#define BB_CONSOLELOGGER_H_
#include "../libs/spdlog/spdlog.h"
#include "Logger.h"
namespace bb
{
class ConsoleLogger : public Logger
{
public:
ConsoleLogger(std::string consoleLoggerName, std::string consoleLoggerFormat = Logger::DEFAULT_FORMAT, spdlog::level::level_enum loggerLevel = spdlog::level::trace);
~ConsoleLogger();
void logTrace(const std::string& className, std::string message) override;
void logDebug(const std::string& className, std::string message) override;
void logInfo(const std::string& className, std::string message) override;
void logWarn(const std::string& className, std::string message) override;
void logError(const std::string& className, std::string message) override;
void logCritical(const std::string& className, std::string message) override;
private:
static const std::string CLASS_NAME;
std::shared_ptr<spdlog::logger> mConsoleLogger;
};
}
#endif |
8569b7102eddb1b722a5d08910c046e8eea12454 | 3ab3575de3f03ba959b7eac312d5a9e60590eb33 | /Assignment3/4 - Universal Health Care/UniversalHealthCoverage.cpp | d11716173a7a7b73d63dab7133e8f86a87ddcc41 | [] | no_license | lnadi17/programming-abstractions | f998f243580dae99dfc4ed426470b0011ca81b8f | 7899bc5383ab372e8ae4d35ed0ca364dfe5be6e2 | refs/heads/master | 2023-05-12T00:59:59.619977 | 2023-04-27T14:47:29 | 2023-04-27T14:47:29 | 204,444,729 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,387 | cpp | UniversalHealthCoverage.cpp | /*
* File: UniversalHealthCoverage.cpp
* ----------------------
* Name: [TODO: enter name here]
* Section: [TODO: enter section leader here]
* This file is the starter project for the UniversalHealthCoverage problem
* on Assignment #3.
* [TODO: extend the documentation]
*/
#include <iostream>
#include <string>
#include "set.h"
#include "vector.h"
#include "console.h"
using namespace std;
/* Function: canOfferUniversalCoverage(Set<string>& cities,
* Vector< Set<string> >& locations,
* int numHospitals,
* Vector< Set<string> >& result);
* Usage: if (canOfferUniversalCoverage(cities, locations, 4, result)
* ==================================================================
* Given a set of cities, a list of what cities various hospitals can
* cover, and a number of hospitals, returns whether or not it's
* possible to provide coverage to all cities with the given number of
* hospitals. If so, one specific way to do this is handed back in the
* result parameter.
*/
bool canOfferUniversalCoverage(Set<string>& cities,
Vector< Set<string> >& locations,
int numHospitals,
Vector< Set<string> >& result);
int main() {
// Built test case
Set<string> cities;
cities.add("A");
cities.add("B");
cities.add("C");
cities.add("D");
cities.add("E");
cities.add("F");
Set<string> loc1;
loc1.add("A");
loc1.add("B");
loc1.add("C");
Set<string> loc2;
loc2.add("A");
loc2.add("C");
loc2.add("D");
Set<string> loc3;
loc3.add("B");
loc3.add("F");
Set<string> loc4;
loc4.add("C");
loc4.add("E");
loc4.add("F");
Vector< Set<string> > locations;
locations.add(loc1);
locations.add(loc2);
locations.add(loc3);
locations.add(loc4);
Vector< Set<string> > result;
// Run the actual code
if(canOfferUniversalCoverage(cities, locations, 3, result)) {
cout << result << endl;
} else {
cout << "Cannot offer universal coverage" << endl;
}
return 0;
}
bool canOfferUniversalCoverage(Set<string>& cities,
Vector< Set<string> >& locations,
int numHospitals,
Vector< Set<string> >& result) {
// If the answer exists, there are two possible scenarios:
// 1. the first hospital in the set is in the resulting set
// 2. It isn't
// We'll follow both scenarios. If neither succeeds, then the answer doesn't exist
if (cities.size() > 0 && (numHospitals == 0 || locations.size() == 0)) {
return false;
}
if (cities.size() == 0 && numHospitals >= 0 && locations.size() >= 0) {
return true;
}
// For the first scenario, we emit first location and corresponding cities,
// also decrease numHospitals and add location in results
//
// For the second scenario, we don't change result, but remove first location and since
// we don't use it, numHospital and cities remain the same
Set<string> firstLoc;
firstLoc = locations.get(0);
Vector< Set<string> > newLocs;
newLocs = locations;
newLocs.remove(0);
if (canOfferUniversalCoverage(cities - firstLoc, newLocs, numHospitals - 1, result)) {
result.add(firstLoc);
return true;
}
if (canOfferUniversalCoverage(cities, newLocs, numHospitals, result)) {
return true;
}
return false;
} |
ffa27a77975d6fbd9bae7bc3a33e05c94e72fed3 | dd9be50b40b274f0cc61b504eb6156774ad26ff0 | /tests/PathTest.cpp | 94aaab6eb513a8ed16edb091fc42045aa92fb6b5 | [] | no_license | Claire-Dong/GlucoseGuardian | ecfe449cff4721ab1179ab75adc40821429521ac | 34041e78c5cd1b494de413796f0d2a4aaf365703 | refs/heads/master | 2020-08-09T06:15:30.585638 | 2019-10-09T20:34:35 | 2019-10-09T20:34:35 | 214,016,575 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 311 | cpp | PathTest.cpp | #include "ArtificialPancreas.h"
#include "GlucoseMonitor.h"
#include <thread>
int main()
{
ArtificialPancreas *artificialPancreas = new ArtificialPancreas();
GlucoseMonitor *glucoseMonitor = new GlucoseMonitor();
std::thread t1(&GlucoseMonitor::listen, glucoseMonitor, artificialPancreas);
t1.join();
} |
f720c3fea58cdecf124661556e5cfb420ad8e466 | ff0c041d88ba25c87e07274818e58ea461a1355a | /oop/method.h | f9b5d22498e7c9a36464ea23ec4ef2766e342ed9 | [] | no_license | xsandyguo/punkin | a91a02720df2ddc00f43ebddcfa52bb23dfab92d | acd5d59a03447193b80b531fca0672adc21fe781 | refs/heads/master | 2020-04-15T01:56:25.049041 | 2019-01-27T16:08:49 | 2019-01-27T16:08:49 | 164,297,172 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,443 | h | method.h | #ifndef CLASSFILE_METHOD_H
#define CLASSFILE_METHOD_H
#include <vector>
#include "oop/oop.h"
class Klass;
struct ExceptionHandler {
u2 start_pc;
u2 end_pc;
u2 handler_pc;
u2 catch_type;
};
struct CodeArea {
u2 max_stack;
u2 max_locals;
u4 code_length;
u1* code;
std::vector<ExceptionHandler> exception_table;
};
class Executable {
public:
Executable();
~Executable();
public:
const std::string& GetName();
void SetName(const std::string& name);
int GetModifier();
void SetModifier(int modifier);
Klass* GetDeclareClass();
void SetDeclareClass(Klass* klass);
const std::vector<Klass*>& GetParamerterTypes();
void SetParameterTypes(const std::vector<Klass*>& parameterTypes);
int GetParameterCount();
Klass* GetReturnType();
void SetReturnType(Klass* returnType);
Klass* GetType();
void SetType(Klass* klass);
CodeArea* GetCodeArea();
jobject Invoke(jobject obj, const std::vector<jobject>& parameters);
private:
int modifier_;
Klass* returnType_;
Klass* klass_;
std::string name_;
std::vector<Klass*> parameterTypes_;
CodeArea* codeArea_;
};
class Method : public Executable {
};
class Constructor : public Executable {
public:
jobject NewInstance();
};
#endif |
78435c1218fc71c4d1aa08cc78b265c713486ea5 | 0a27164b8baf9c57c6b8dc8c8ef6e61a34d6f3a3 | /๋ฐฑ์ค ์ ํ๋ณ ๋ฌธ์ ํ์ด/BFS/7576ํ ๋งํ .cpp | 2f9b66f34519e04539f1f5a6a46e429121c51370 | [] | no_license | GyosunShin/ProblemSolving | 56840196d3a49b57e50e49ff2fa2ddb4488d38db | 4ddedf4b26d9124e10f4f4490834078d9701f750 | refs/heads/master | 2021-01-04T10:00:12.712086 | 2020-06-29T12:29:45 | 2020-06-29T12:29:45 | 240,494,077 | 1 | 0 | null | null | null | null | UHC | C++ | false | false | 1,840 | cpp | 7576ํ ๋งํ .cpp | // 2 โค M(๊ฐ๋ก),N(์ธ๋ก) โค 1,000 ์ด๋ค
// 1 : ์ต์ ํ ๋งํ / 0 : ์ ์ต์ ํ ๋งํ / -1 : ๋น์นธ
//
// OUTPUT
// ํ ๋งํ ๊ฐ ๋ชจ๋ ์ต์ ๋๊น์ง์ ์ต์ ๋ ์ง๋ฅผ ์ถ๋ ฅํด์ผ ํ๋ค.
// ๋ง์ฝ, ์ ์ฅ๋ ๋๋ถํฐ ๋ชจ๋ ํ ๋งํ ๊ฐ ์ต์ด์๋ ์ํ์ด๋ฉด 0์ ์ถ๋ ฅํด์ผ ํ๊ณ ,
// ํ ๋งํ ๊ฐ ๋ชจ๋ ์ต์ง๋ ๋ชปํ๋ ์ํฉ์ด๋ฉด -1์ ์ถ๋ ฅํด์ผ ํ๋ค.
#include <stdio.h>
#include <queue>
using namespace std;
struct INFO{
int r, c, time;
};
int M, N;
int map[1000][1000];
int visited[1000][1000];
const int dr[] = {-1, 1, 0, 0};
const int dc[] = {0, 0, -1, 1};
queue<INFO> q;
int ans;
void bfs(){
while(!q.empty()){
INFO cur = q.front(); q.pop();
ans = cur.time;
for(int dir = 0 ; dir < 4 ; ++dir){
int next_r = cur.r + dr[dir]; int next_c = cur.c + dc[dir];
if(0 > next_r || next_r >= N || 0 > next_c || next_c >= M || map[next_r][next_c] == -1 || visited[next_r][next_c] != 0) continue;
visited[next_r][next_c] = 1;
map[next_r][next_c] = 1;
INFO next;
next.r = next_r; next.c = next_c; next.time = cur.time + 1;
q.push(next);
}
}
// ์ ์ผ ์๋ฃ!
}
int main(){
int tmp_ans = 0;
scanf("%d %d", &M, &N);
for(int i = 0 ; i < N ; ++i){
for(int j = 0 ; j < M ; ++j){
scanf("%d", &map[i][j]);
if(map[i][j] == 0) ++tmp_ans;
else if(map[i][j] == 1){ // ์ต์ ํ ๋งํ ์ธ ๊ฒฝ์ฐ
INFO tmp;
tmp.r = i; tmp.c = j; tmp.time = 0;
q.push(tmp);
visited[i][j] = 1;
}
}
}
//#####################################
if(tmp_ans == 0){ // ์ฒ์๋ถํฐ ๋ค ์ต์ ๊ฒฝ์ฐ
printf("0");
return 0;
}
bfs();
int tmp_cnt = 0;
for(int i = 0 ; i < N ; ++i){
for(int j = 0 ; j < M ; ++j){
if(map[i][j] == 0) ++tmp_cnt;
}
}
if(tmp_cnt != 0){
printf("-1");
return 0;
}
printf("%d", ans);
return 0;
}
|
8341ed8b50228ecf840c86c835d3311ecec70bfe | 9d6a173022d6cf7ba29fc5a75b4190a3ba52f7d8 | /cpp/CPP Module 00/ex01/main.cpp | a9d3517d823e7195d1a193f7ed28e1593d62114a | [] | no_license | blureddoor/42 | 2fa09025e3b889a8734862d0f74d42edd623a768 | b4fb3b1f86667589d826ca3c26485719b1c0d706 | refs/heads/master | 2023-07-06T21:20:20.147322 | 2023-06-25T09:42:52 | 2023-06-25T09:42:52 | 233,448,504 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 980 | cpp | main.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lvintila <lvintila@student.42madrid.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/26 21:55:06 by lvintila #+# #+# */
/* Updated: 2022/08/26 21:59:39 by lvintila ### ########.fr */
/* */
/* ************************************************************************** */
#include "dumf.hpp"
int main()
{
Agenda agenda;
agenda.dumf_loop();
return (0);
}
|
345f4208030ea5a4af72e9cdf82776d0cdb63c35 | 394615fa3a4b69b173f521b30bc87c139250e81b | /matrix.cpp | 6acc875c7c4a72301eabc0dcd22da56c823f91dc | [] | no_license | WesleyCh3n/cplus-tutorial | 94850469158db627291e2c4a87101debcea6aab2 | e96c90572201cd664a257305e06dc8d63074cac9 | refs/heads/main | 2023-08-14T21:10:51.554171 | 2021-09-26T00:50:15 | 2021-09-26T00:50:15 | 302,523,147 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,751 | cpp | matrix.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
#define INM 3
#define INL 4
#define INN 5
double answer1 = 0;
double** matrixMultiplication (double** A, double** B, int M, int L, int N);
void printMatrix(double** Matrix, int row, int col);
int main(){
double A[3][4] = {
{2.1, 3.1, 6.7, 7.1},
{5.0, 3.0, 4.2, 2.2},
{3.3, 4.4, 5.5, 0.5}
};
double B[4][5] = {
{1.0, 1.1, 7.7, 2.1, 4.4},
{2.2, 2.3, 2.3, 8.6, 3.3},
{7.5, 8.1, 2.4, 9.2, 0.7},
{9.1, 2.3, 9.9, 0.5, 0.9}
};
double **pA = new double*[INM];
for(int i=0; i<INM; i++)
pA[i] = A[i];
double **pB = new double*[INL];
for(int i=0; i<INL; i++)
pB[i] = B[i];
double **C = matrixMultiplication(pA, pB, INM, INL, INN);
printMatrix(C, INM, INN);
printf("Sum of matrix element is %.10f\n", answer1);
/* printf("%.10f\n", answer1-1045.889); */
/* printf(abs(answer1-1045.889) < 0.01 ? "true": "false"); */
delete [] pA;
delete [] pB;
}
void printMatrix(double** Matrix, int row, int col){
for(int i=0; i<row; i++){
for(int j=0; j<col; j++){
/* cout << setw(6) << Matrix[i][j] << " "; */
cout << setw(6) << *(*(Matrix+i)+j) << " ";
}
cout << '\n';
}
}
double** matrixMultiplication (double** A, double** B, int M, int L, int N){
double **pC = new double*[M];
for(int i=0; i<M; i++)
pC[i] = new double[N];
for(int i=0; i<M; i++){
for(int j=0; j<N; j++){
double sum = 0;
for(int k=0; k<L; k++)
sum += A[i][k] * B[k][j];
pC[i][j] = sum;
answer1 += sum;
}
}
return pC;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.