hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
25984db9a2f434f3b34a1f915af022d828ec05c9 | 15,997 | cc | C++ | masstree/libs/cicada-engine/src/mica/test/test_atomics.cc | YSL-1997/DBx1000 | 1e2ecfd21316a09967a5420e31bd9d2a5f98fe2b | [
"0BSD"
] | 52 | 2017-06-17T01:54:46.000Z | 2022-03-22T10:45:37.000Z | masstree/libs/cicada-engine/src/mica/test/test_atomics.cc | YSL-1997/DBx1000 | 1e2ecfd21316a09967a5420e31bd9d2a5f98fe2b | [
"0BSD"
] | null | null | null | masstree/libs/cicada-engine/src/mica/test/test_atomics.cc | YSL-1997/DBx1000 | 1e2ecfd21316a09967a5420e31bd9d2a5f98fe2b | [
"0BSD"
] | 20 | 2017-07-12T13:25:30.000Z | 2021-08-25T01:54:51.000Z | #include <cstdio>
#include <thread>
#include "mica/util/lcore.h"
#include "mica/util/zipf.h"
#include "mica/util/stopwatch.h"
#include "mica/util/barrier.h"
#include "mica/util/memcpy.h"
enum class OpsType {
kRAW = 0,
kRAWF,
kFAA,
kAAF,
kCAS,
kTAS,
kRFAA,
kRCAS,
kHFAA,
kCCAS,
kMax,
};
static const char* ops_names[] = {
"read, add, and write", "RAW and fence", "fetch and add", "add and fetch",
"compare and swap", "test and set", "remote FAA", "remote CAS",
"hybrid FAA", "conditional CAS"};
struct Task {
uint16_t lcore_id;
uint16_t num_threads;
uint16_t num_lock_threads;
OpsType ops_type;
uint64_t c;
struct timeval tv_start;
struct timeval tv_end;
} __attribute__((aligned(128)));
static ::mica::util::Stopwatch sw;
static volatile uint16_t running_threads;
static volatile uint8_t stop;
static const int kQueueDepth = 512;
struct faa_request {
uint64_t* p;
uint64_t incr;
};
struct cas_request {
uint64_t* p;
uint64_t old_v;
uint64_t new_v;
} __attribute__((packed));
// } __attribute__((aligned(32)));
struct response {
uint64_t result;
};
struct queue {
volatile faa_request faa_req[2][kQueueDepth] __attribute__((aligned(64)));
volatile cas_request cas_req[2][kQueueDepth] __attribute__((aligned(64)));
volatile int num_req;
volatile int req_q_idx;
volatile int num_res;
volatile response res[kQueueDepth] __attribute__((aligned(64)));
} __attribute__((aligned(64)));
static queue queues[64];
static uint64_t v = 0;
void handle_faa_request(uint16_t num_queues) {
while (!stop) {
for (uint16_t i = 0; i < num_queues; i++) {
int num_req = queues[i].num_req;
if (num_req == 0) continue;
::mica::util::memory_barrier();
volatile faa_request* req = queues[i].faa_req[queues[i].req_q_idx];
for (int j = 0; j < num_req; j++) {
__builtin_prefetch(const_cast<faa_request*>(&req[j + 4]), 0);
// __builtin_prefetch(const_cast<response*>(&queues[i].res[j + 4]), 1);
uint64_t* p = req[j].p;
uint64_t v = *p;
queues[i].res[j].result = v;
*p = v + req[j].incr;
}
// for (int j = 0; j < num_req; j++) clflush(&req[j]);
::mica::util::memory_barrier();
queues[i].num_res = num_req;
}
}
}
void handle_atomic_faa_request(uint16_t num_queues, uint16_t lock_thread_id,
uint16_t num_lock_threads) {
while (!stop) {
for (int i = lock_thread_id; i < num_queues; i += num_lock_threads) {
int num_req = queues[i].num_req;
if (num_req == 0) continue;
::mica::util::memory_barrier();
volatile faa_request* req = queues[i].faa_req[queues[i].req_q_idx];
for (int j = 0; j < num_req; j++) {
// __builtin_prefetch(const_cast<faa_request*>(&req[j + 4]), 0);
// __builtin_prefetch(const_cast<response*>(&queues[i].res[j + 4]), 1);
// TODO: Use atomics without LOCK prefix.
queues[i].res[j].result = __sync_fetch_and_add(req[j].p, req[j].incr);
}
// for (int j = 0; j < num_req; j++) clflush(&req[j]);
::mica::util::memory_barrier();
queues[i].num_res = num_req;
}
}
}
void handle_cas_request(uint16_t num_queues) {
while (!stop) {
for (uint16_t i = 0; i < num_queues; i++) {
int num_req = queues[i].num_req;
if (num_req == 0) continue;
::mica::util::memory_barrier();
volatile cas_request* req = queues[i].cas_req[queues[i].req_q_idx];
for (int j = 0; j < num_req; j++) {
__builtin_prefetch(const_cast<cas_request*>(&req[j + 4]), 0);
// __builtin_prefetch(const_cast<response*>(&queues[i].res[j + 4]), 1);
uint64_t* p = req[j].p;
uint64_t v = *p;
if (v == req[j].old_v) {
*p = req[j].new_v;
queues[i].res[j].result = 1;
} else {
queues[i].res[j].result = 0;
}
}
// for (int j = 0; j < num_req; j++) clflush(&req[j]);
::mica::util::memory_barrier();
queues[i].num_res = num_req;
}
}
}
int worker_proc(void* arg) {
auto task = reinterpret_cast<Task*>(arg);
::mica::util::lcore.pin_thread(task->lcore_id);
// printf("worker running on lcore %" PRIu16 "\n", task->lcore_id);
__sync_add_and_fetch(&running_threads, 1);
while (running_threads < task->num_threads) ::mica::util::pause();
uint64_t c = 0;
gettimeofday(&task->tv_start, nullptr);
uint64_t t = sw.now();
if (task->ops_type == OpsType::kRFAA &&
task->lcore_id >= task->num_threads - 1) {
assert(task->num_threads >= 2);
handle_faa_request(static_cast<uint16_t>(task->num_threads - 1));
task->c = 0;
task->tv_end = task->tv_start;
return 0;
} else if (task->ops_type == OpsType::kRCAS &&
task->lcore_id >= task->num_threads - 1) {
assert(task->num_threads >= 2);
handle_cas_request(static_cast<uint16_t>(task->num_threads - 1));
task->c = 0;
task->tv_end = task->tv_start;
return 0;
} else if (task->ops_type == OpsType::kHFAA &&
task->lcore_id >= task->num_threads - task->num_lock_threads) {
assert(task->num_threads >= 2);
handle_atomic_faa_request(
static_cast<uint16_t>(task->num_threads - task->num_lock_threads),
static_cast<uint16_t>(task->lcore_id -
(task->num_threads - task->num_lock_threads)),
task->num_lock_threads);
task->c = 0;
task->tv_end = task->tv_start;
return 0;
}
int req_q_idx = 0;
int q_i = 0;
const uint32_t n = 100000;
while (!stop) {
switch (task->ops_type) {
case OpsType::kRAW: {
for (uint32_t i = 0; i < n / 10; i++) {
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
++*reinterpret_cast<volatile uint64_t*>(&v);
}
} break;
case OpsType::kRAWF: {
// auto fence = [] {};
// auto fence = [] { ::mica::util::memory_barrier(); };
// auto fence = [] { ::mica::util::lfence(); };
auto fence = [] { ::mica::util::sfence(); };
// auto fence = [] { ::mica::util::mfence(); };
for (uint32_t i = 0; i < n / 10; i++) {
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
++*reinterpret_cast<volatile uint64_t*>(&v);
fence();
}
} break;
case OpsType::kFAA:
// for (uint32_t i = 0; i < n; i++) __sync_fetch_and_add(&v,
// uint64_t(1));
for (uint32_t i = 0; i < n / 10; i++) {
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
__sync_fetch_and_add(&v, uint64_t(1));
}
break;
case OpsType::kAAF:
// for (uint32_t i = 0; i < n; i++) __sync_add_and_fetch(&v,
// uint64_t(1));
for (uint32_t i = 0; i < n / 10; i++) {
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
__sync_add_and_fetch(&v, uint64_t(1));
}
break;
case OpsType::kCAS:
// Faster without unrolling.
for (uint32_t i = 0; i < n; i++)
__sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// for (uint32_t i = 0; i < n / 10; i++) {
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// __sync_val_compare_and_swap(&v, uint64_t(0), uint64_t(0));
// }
break;
case OpsType::kTAS:
// Faster without unrolling.
for (uint32_t i = 0; i < n; i++)
__sync_lock_test_and_set(&v, uint64_t(0));
// for (uint32_t i = 0; i < n / 10; i++) {
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// __sync_lock_test_and_set(&v, uint64_t(0));
// }
break;
case OpsType::kRFAA:
case OpsType::kHFAA: {
for (uint32_t i = 0; i < n; i++) {
queues[task->lcore_id].faa_req[req_q_idx][q_i].p = &v;
queues[task->lcore_id].faa_req[req_q_idx][q_i].incr = 1;
q_i++;
if (q_i == kQueueDepth) {
// Wait for previous responses.
while (queues[task->lcore_id].num_req != 0 &&
queues[task->lcore_id].num_res == 0 && !stop)
::mica::util::pause();
// Consume responses.
queues[task->lcore_id].num_res = 0;
// Supply new requests.
queues[task->lcore_id].req_q_idx = req_q_idx;
::mica::util::memory_barrier();
queues[task->lcore_id].num_req = q_i;
req_q_idx = 1 - req_q_idx;
q_i = 0;
}
}
} break;
case OpsType::kRCAS: {
for (uint32_t i = 0; i < n; i++) {
queues[task->lcore_id].cas_req[req_q_idx][q_i].p = &v;
queues[task->lcore_id].cas_req[req_q_idx][q_i].old_v = 0;
queues[task->lcore_id].cas_req[req_q_idx][q_i].new_v = 0;
q_i++;
if (q_i == kQueueDepth) {
// Wait for previous responses.
while (queues[task->lcore_id].num_req != 0 &&
queues[task->lcore_id].num_res == 0 && !stop)
::mica::util::pause();
// Consume responses.
queues[task->lcore_id].num_res = 0;
// Supply new requests.
queues[task->lcore_id].req_q_idx = req_q_idx;
::mica::util::memory_barrier();
queues[task->lcore_id].num_req = q_i;
req_q_idx = 1 - req_q_idx;
q_i = 0;
}
}
} break;
case OpsType::kCCAS: {
uint64_t new_v = sw.now();
for (uint32_t i = 0; i < n; i++) {
uint64_t v_local = *(volatile uint64_t*)&v;
while (v_local < new_v) {
uint64_t actual_v = __sync_val_compare_and_swap(&v, v_local, new_v);
if (actual_v == v_local) break;
::mica::util::pause();
v_local = actual_v;
}
if ((i & 0xff) == 0)
new_v = sw.now(); // Emulates occasional clock sync.
else
new_v += 1000UL;
}
} break;
default:
assert(false);
}
c += n;
// printf("a\n");
if (task->lcore_id == 0 &&
sw.diff_in_cycles(sw.now(), t) >= 3 * sw.c_1_sec())
stop = 1;
}
gettimeofday(&task->tv_end, nullptr);
task->c = c;
return 0;
}
int main(int argc, const char* argv[]) {
if (argc != 2) {
printf("%s THREAD-COUNT\n", argv[0]);
return EXIT_FAILURE;
}
::mica::util::lcore.pin_thread(0);
sw.init_start();
sw.init_end();
printf("1 seconds: %" PRIu64 " cycles\n", sw.c_1_sec());
uint16_t num_threads = static_cast<uint16_t>(atoi(argv[1]));
assert(num_threads <=
static_cast<uint16_t>(::mica::util::lcore.lcore_count()));
printf("num_threads: %hu\n", num_threads);
printf("\n");
for (int type = 0; type < static_cast<int>(OpsType::kMax); type++) {
// if (type != static_cast<int>(OpsType::kRFAA) &&
// type != static_cast<int>(OpsType::kRCAS) &&
// type != static_cast<int>(OpsType::kHFAA))
// continue;
// if (type != static_cast<int>(OpsType::kCAS) &&
// type != static_cast<int>(OpsType::kCCAS))
// continue;
std::vector<Task> tasks(num_threads);
for (uint16_t lcore_id = 0; lcore_id < num_threads; lcore_id++) {
tasks[lcore_id].lcore_id = lcore_id;
tasks[lcore_id].num_threads = num_threads;
if (type != static_cast<int>(OpsType::kHFAA))
tasks[lcore_id].num_lock_threads = 1;
else
tasks[lcore_id].num_lock_threads = 1;
tasks[lcore_id].ops_type = static_cast<OpsType>(type);
}
running_threads = 0;
*reinterpret_cast<volatile uint64_t*>(&v) = 0;
stop = 0;
for (size_t i = 0; i < sizeof(queues) / sizeof(queues[0]); i++) {
queues[i].num_req = 0;
queues[i].num_res = 0;
}
::mica::util::memory_barrier();
std::vector<std::thread> threads;
for (size_t thread_id = 1; thread_id < num_threads; thread_id++)
threads.emplace_back(worker_proc, &tasks[thread_id]);
worker_proc(&tasks[0]);
while (threads.size() > 0) {
threads.back().join();
threads.pop_back();
}
double diff;
{
double min_start = 0.;
double max_end = 0.;
for (size_t thread_id = 0; thread_id < num_threads; thread_id++) {
double start = (double)tasks[thread_id].tv_start.tv_sec * 1. +
(double)tasks[thread_id].tv_start.tv_usec * 0.000001;
double end = (double)tasks[thread_id].tv_end.tv_sec * 1. +
(double)tasks[thread_id].tv_end.tv_usec * 0.000001;
if (thread_id == 0 || min_start > start) min_start = start;
if (thread_id == 0 || max_end < end) max_end = end;
}
diff = max_end - min_start;
}
uint64_t c = 0;
{
for (size_t thread_id = 0; thread_id < num_threads; thread_id++)
c += tasks[thread_id].c;
}
printf("ops_type: %s\n", ops_names[type]);
printf("elapsed: %lf\n", diff);
printf("v: %lu\n", *reinterpret_cast<volatile uint64_t*>(&v));
printf("count: %lu (%.3lf M/sec)\n", c,
static_cast<double>(c) / diff / 1000000.);
printf("\n");
}
return EXIT_SUCCESS;
} | 32.713701 | 80 | 0.569732 | [
"vector"
] |
2598b702f64c8fe529d0a484bcadca60cabde535 | 1,079 | hpp | C++ | include/Nazara/Utility/SoftwareBuffer.hpp | jayrulez/NazaraEngine | e0310cd141f3cc11dbe8abfd5bfedf6b61de1a99 | [
"BSD-3-Clause-Clear",
"Apache-2.0",
"MIT"
] | 11 | 2019-11-27T00:40:43.000Z | 2020-01-29T14:31:52.000Z | include/Nazara/Utility/SoftwareBuffer.hpp | jayrulez/NazaraEngine | e0310cd141f3cc11dbe8abfd5bfedf6b61de1a99 | [
"BSD-3-Clause-Clear",
"Apache-2.0",
"MIT"
] | 7 | 2019-11-27T00:29:08.000Z | 2020-01-08T18:53:39.000Z | include/Nazara/Utility/SoftwareBuffer.hpp | jayrulez/NazaraEngine | e0310cd141f3cc11dbe8abfd5bfedf6b61de1a99 | [
"BSD-3-Clause-Clear",
"Apache-2.0",
"MIT"
] | 7 | 2019-11-27T10:27:40.000Z | 2020-01-15T17:43:33.000Z | // Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_UTILITY_SOFTWAREBUFFER_HPP
#define NAZARA_UTILITY_SOFTWAREBUFFER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <vector>
namespace Nz
{
class NAZARA_UTILITY_API SoftwareBuffer : public Buffer
{
public:
SoftwareBuffer(BufferType type, UInt64 size, BufferUsageFlags usage, const void* initialData);
~SoftwareBuffer() = default;
bool Fill(const void* data, UInt64 offset, UInt64 size) override;
const UInt8* GetData() const;
void* Map(UInt64 offset = 0, UInt64 size = 0) override;
bool Unmap() override;
private:
std::unique_ptr<UInt8[]> m_buffer;
bool m_mapped;
};
NAZARA_UTILITY_API std::shared_ptr<Buffer> SoftwareBufferFactory(BufferType type, UInt64 size, BufferUsageFlags usage, const void* initialData = nullptr);
}
#endif // NAZARA_UTILITY_SOFTWAREBUFFER_HPP
| 28.394737 | 155 | 0.761816 | [
"vector"
] |
2598df03732a47addaa161e1bb0144f7684d2ba4 | 4,978 | cpp | C++ | graph_theory_advanced/edmonds_karp.cpp | helthazar/drawtex | b262060916782dd912660dac417f509a6d7a8c61 | [
"MIT"
] | null | null | null | graph_theory_advanced/edmonds_karp.cpp | helthazar/drawtex | b262060916782dd912660dac417f509a6d7a8c61 | [
"MIT"
] | null | null | null | graph_theory_advanced/edmonds_karp.cpp | helthazar/drawtex | b262060916782dd912660dac417f509a6d7a8c61 | [
"MIT"
] | null | null | null | #include "graph_theory_advanced.h"
void draw_edge_residual(int from, int to, string color, string dirr[MAXN][MAXN], int add) {
if (f[from][to] == c[from][to]) {
drawQ.removeEdgeWeighted(add + from, add + to);
return;
}
if (c[from][to] > 0) {
drawQ.addEdgeWeighted(add + from, add + to, color, "\\footnotesize " + to_string(c[from][to] - f[from][to]), dirr[from][to], true);
}
else if (f[to][from] == c[to][from] && c[to][from] > 0) {
drawQ.addEdgeWeighted(add + from, add + to, color, "\\footnotesize " + to_string(c[from][to] - f[from][to]), dirr[from][to], true);
}
else {
drawQ.addEdgeWeighted(add + from, add + to, color, "\\footnotesize " + to_string(c[from][to] - f[from][to]), dirr[from][to], true, curve[from][to]);
}
}
void edmonds_karp(int s, int t, int n) {
while (true) {
vector<int> from(n, -1);
queue<int> q;
q.push(s);
from[s] = s;
while (!q.empty()) {
int cur = q.front();
q.pop();
for (int next = 0; next < n; next++) {
if (from[next] == -1 && c[cur][next] - f[cur][next] > 0) {
q.push(next);
from[next] = cur;
}
}
}
if (from[t] == -1)
break;
int cf = 100;
for (int cur = t; cur != s; ) {
int prev = from[cur];
cf = min(cf, c[prev][cur] - f[prev][cur]);
draw_edge_residual(prev, cur, "red", dirr, 10);
cur = prev;
}
for (int cur = t; cur != s; ) {
int prev = from[cur];
f[prev][cur] += cf;
f[cur][prev] -= cf;
if (c[prev][cur] > 0) {
drawQ.addEdgeWeighted(prev, cur, "red", "\\footnotesize " + to_string(f[prev][cur]) + "/" + to_string(c[prev][cur]), dirf[prev][cur], true);
}
if (c[cur][prev] > 0) {
drawQ.addEdgeWeighted(cur, prev, "red", "\\footnotesize " + to_string(f[cur][prev]) + "/" + to_string(c[cur][prev]), dirf[cur][prev], true);
}
cur = prev;
}
drawQ.increaseTimer();
for (int cur = t; cur != s; ) {
int prev = from[cur];
if (c[prev][cur] > 0) {
drawQ.addEdgeWeighted(prev, cur, "black", "\\footnotesize " + to_string(f[prev][cur]) + "/" + to_string(c[prev][cur]), dirf[prev][cur], true);
}
if (c[cur][prev] > 0) {
drawQ.addEdgeWeighted(cur, prev, "black", "\\footnotesize " + to_string(f[cur][prev]) + "/" + to_string(c[cur][prev]), dirf[cur][prev], true);
}
draw_edge_residual(prev, cur, "black", dirr, 10);
draw_edge_residual(cur, prev, "black", dirr, 10);
cur = prev;
}
}
}
void solve() {
c[0][1] = 3;
dirf[0][1] = "near start, above,";
dirr[0][1] = "midway, above,";
dirr[1][0] = "midway, above,";
curve[1][0] = ".. controls (6, 4.5) ..";
c[0][2] = 3;
dirf[0][2] = "near start, below,";
dirr[0][2] = "midway, below,";
dirr[2][0] = "midway, below,";
curve[2][0] = ".. controls (6, 2.5) ..";
c[1][2] = 2;
dirf[1][2] = "midway, right,";
dirr[1][2] = "midway, right,";
c[1][3] = 3;
dirf[1][3] = "midway, above,";
dirr[1][3] = "midway, above,";
dirr[3][1] = "midway, above,";
curve[3][1] = ".. controls (8.4, 5.25) ..";
c[2][4] = 2;
dirf[2][4] = "midway, below,";
dirr[2][4] = "midway, below,";
dirr[4][2] = "midway, below,";
c[3][4] = 4;
dirf[3][4] = "midway, left,";
dirr[3][4] = "midway, left,";
dirr[4][3] = "midway, left,";
curve[4][3] = ".. controls (8.75, 3.5) ..";
c[3][5] = 2;
dirf[3][5] = "near end, above,";
dirr[3][5] = "midway, above,";
dirr[5][3] = "midway, above,";
c[4][5] = 3;
dirf[4][5] = "near end, below,";
dirr[4][5] = "midway, below,";
dirr[5][4] = "midway, below,";
curve[5][4] = ".. controls (10.75, 2.5) ..";
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= 5; j++) {
if (c[i][j] > 0) {
drawQ.addEdgeWeighted(i, j, "black", "\\footnotesize 0/" + to_string(c[i][j]), dirf[i][j], true);
drawQ.addEdgeWeighted(10 + i, 10 + j, "black", "\\footnotesize " + to_string(c[i][j]), dirr[i][j], true);
}
}
}
drawQ.increaseTimer();
edmonds_karp(0, 5, 6);
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= 5; j++) {
if (c[i][j] > 0 && f[i][j] > 0) {
drawQ.addEdgeWeighted(i, j, "red", "\\footnotesize " + to_string(f[i][j]) + "/" + to_string(c[i][j]), dirf[i][j], true);
}
}
}
for (int j = 0; j <= 5; j++) {
if (c[0][j] > 0 && f[0][j] < c[0][j]) {
draw_edge_residual(0, j, "red", dirr, 10);
}
}
}
int main() {
solve();
drawQ.draw();
}
| 34.331034 | 158 | 0.449377 | [
"vector"
] |
259f4465d1b6feb34be9220a66fc64bab6f4a2db | 1,727 | cpp | C++ | codeforces/D - Rescue Nibel!/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | 1 | 2022-02-11T16:55:36.000Z | 2022-02-11T16:55:36.000Z | codeforces/D - Rescue Nibel!/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | codeforces/D - Rescue Nibel!/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | /****************************************************************************************
* @author: kzvd4729# created: Sep/25/2020 14:22
* solution_verdict: Accepted language: GNU C++17
* run_time: 483 ms memory_used: 16300 KB
* problem: https://codeforces.com/contest/1420/problem/D
****************************************************************************************/
#include<iostream>
#include<vector>
#include<cstring>
#include<map>
#include<bitset>
#include<assert.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<chrono>
#include<stack>
#include<deque>
#include<random>
#define long long long
using namespace std;
const int N=1e6;
const int mod=998244353;
int big(int b,int p)
{
int r=1;
while(p)
{
if(p&1)r=(1LL*r*b)%mod;b=(1LL*b*b)%mod;p/=2;
}
return r;
}
int fac[N+2];
void init()
{
fac[0]=1;
for(int i=1;i<=N;i++)fac[i]=(1LL*fac[i-1]*i)%mod;
}
int ncr(int n,int r)
{
int ret=(1LL*fac[n]*big(fac[r],mod-2))%mod;
return (1LL*ret*big(fac[n-r],mod-2))%mod;
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
init();int n,k;cin>>n>>k;
vector<pair<int,int> >v;
for(int i=1;i<=n;i++)
{
int l,r;cin>>l>>r;
v.push_back({l,0});v.push_back({r,1});
}
sort(v.begin(),v.end());
int cnt=0;long ans=0;
for(auto x:v)
{
if(x.second)cnt--;
else
{
cnt++;
if(cnt>=k)ans=(ans+ncr(cnt-1,k-1))%mod;
}
}
cout<<ans<<endl;
return 0;
} | 23.986111 | 111 | 0.489867 | [
"vector"
] |
25a881dd3d48c1db66c4e82e9da8e1654f2d8706 | 4,874 | cpp | C++ | RobWork/src/rw/geometry/PointCloud.cpp | ZLW07/RobWork | e713881f809d866b9a0749eeb15f6763e64044b3 | [
"Apache-2.0"
] | 1 | 2021-12-29T14:16:27.000Z | 2021-12-29T14:16:27.000Z | RobWork/src/rw/geometry/PointCloud.cpp | ZLW07/RobWork | e713881f809d866b9a0749eeb15f6763e64044b3 | [
"Apache-2.0"
] | null | null | null | RobWork/src/rw/geometry/PointCloud.cpp | ZLW07/RobWork | e713881f809d866b9a0749eeb15f6763e64044b3 | [
"Apache-2.0"
] | null | null | null | /********************************************************************************
* Copyright 2009 The Robotics Group, The Maersk Mc-Kinney Moller Institute,
* Faculty of Engineering, University of Southern Denmark
*
* 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 "PointCloud.hpp"
#include "PlainTriMesh.hpp"
#include <fstream>
using namespace rw::geometry;
using namespace rw::core;
rw::core::Ptr< TriMesh > PointCloud::getTriMesh (bool forceCopy)
{
// we create a trimesh with points of size 1mm
// std::cout << "Creating mesh... " << _data.size() << std::endl;
PlainTriMeshF::Ptr mesh = ownedPtr (new PlainTriMeshF ((int) _data.size ()));
for (size_t i = 0; i < _data.size (); i++) {
Triangle< float > tri = (*mesh)[i];
tri[0] = _data[i];
tri[1] = _data[i] + rw::math::Vector3D< float > (0.005f, 0, 0);
tri[2] = _data[i] + rw::math::Vector3D< float > (0, 0.005f, 0);
(*mesh)[i] = tri;
}
return mesh;
}
rw::core::Ptr< const TriMesh > PointCloud::getTriMesh (bool forceCopy) const
{
PlainTriMeshF::Ptr mesh = ownedPtr (new PlainTriMeshF ((int) _data.size ()));
// std::cout << "Creating mesh... " << _data.size() << std::endl;
for (size_t i = 0; i < _data.size (); i++) {
Triangle< float > tri = (*mesh)[i];
tri[0] = _data[i];
tri[1] = _data[i] + rw::math::Vector3D< float > (0.005f, 0, 0);
tri[2] = _data[i] + rw::math::Vector3D< float > (0, 0.005f, 0);
(*mesh)[i] = tri;
}
return mesh;
}
void PointCloud::savePCD (const PointCloud& img, const std::string& filename,
const rw::math::Transform3D< float >& t3d)
{
std::ofstream output (filename.c_str ());
output << "# .PCD v.5 - Point Cloud Data file format\n";
output << "FIELDS x y z\n";
output << "SIZE 4 4 4\n";
output << "TYPE F F F\n";
output << "WIDTH " << img.getWidth () << "\n";
output << "HEIGHT " << img.getHeight () << "\n";
output << "POINTS " << img.getData ().size () << "\n";
output << "DATA ascii\n";
for (const rw::math::Vector3D< float >& p_tmp : img.getData ()) {
rw::math::Vector3D< float > p = t3d * p_tmp;
output << p (0) << " " << p (1) << " " << p (2) << "\n";
}
output.close ();
}
PointCloud::Ptr PointCloud::loadPCD (const std::string& filename)
{
// Start by storing the current locale. This is retrieved by passing NULL to setlocale
std::string locale = setlocale (LC_ALL, NULL);
setlocale (LC_ALL, "C");
char line[500];
int width, height, nr_points;
float version;
std::ifstream input (filename.c_str ());
input.getline (line, 500); // output << "# .PCD v.5 - Point Cloud Data file format\n";
input.getline (line, 500); // output << "FIELDS x y z\n";
input.getline (line, 500); // output << "SIZE 4 4 4\n";
input.getline (line, 500); // output << "TYPE F F F\n";
std::string tmp;
input >> tmp;
while (tmp != "DATA") {
if (tmp == "WIDTH") {
input >> width;
}
else if (tmp == "HEIGHT") {
input >> height;
}
else if (tmp == "VERSION") {
input >> version;
}
else if (tmp == "FIELDS") {
}
else if (tmp == "HEIGHT") {
}
else if (tmp == "SIZE") {
}
else if (tmp == "TYPE") {
}
else if (tmp == "COUNT") {
}
else if (tmp == "VIEWPOINT") {
}
else if (tmp == "POINTS") {
input >> nr_points;
}
input.getline (line, 500);
input >> tmp;
}
input.getline (line, 500);
// std::cout << "w:" << width << " h:" << height << " p:" << nr_points << std::endl;
PointCloud::Ptr img = rw::core::ownedPtr (new PointCloud (width, height));
input.getline (line, 500); // output << "DATA ascii\n";
for (int i = 0; i < nr_points; i++) {
rw::math::Vector3D< float > p;
input.getline (line, 500);
sscanf (line, "%f %f %f", &p[0], &p[1], &p[2]);
img->getData ()[i] = p;
}
setlocale (LC_ALL, locale.c_str ());
return img;
}
| 36.373134 | 93 | 0.521543 | [
"mesh",
"geometry"
] |
25b28c27ab1d6f81647ade61ae90e27cd6d0ee69 | 2,388 | cpp | C++ | src/pattern_library/pattern_flicker.cpp | carlyrobison/Hell-Lighting | c7944e27d383bf5f5b5c1b6cd906ae7104314cd5 | [
"MIT"
] | 3 | 2017-09-25T00:21:28.000Z | 2019-02-25T16:36:13.000Z | src/pattern_library/pattern_flicker.cpp | carlyrobison/Hell-Lighting | c7944e27d383bf5f5b5c1b6cd906ae7104314cd5 | [
"MIT"
] | 26 | 2017-05-06T08:16:44.000Z | 2019-10-27T04:45:32.000Z | src/pattern_library/pattern_flicker.cpp | maxwells-daemons/Hell-Lighting | adae245d4858dfe36046625bba71ab4a685dabcc | [
"MIT"
] | 9 | 2017-05-06T08:09:21.000Z | 2019-10-25T03:50:47.000Z | #include "pattern_flicker.h"
void Pattern_Flicker::init() {
clearLEDs();
FastLED.setBrightness(BRIGHTNESS_MAX / 3);
for (int i = 0; i < lights_per_side; i++) {
countdowns_left[i] = random(0, map(analogRead(PIN_POT), 0, POT_MAX, 10, maxframes_wait));
countdowns_right[i] = random(0, map(analogRead(PIN_POT), 0, POT_MAX, 10, maxframes_wait));
durations_left[i] = 0;
durations_right[i] = 0;
}
}
void Pattern_Flicker::loop() {
for (int i = 0; i < lights_per_side; i++) {
// Left side
if (durations_left[i] > 0) { // We are mid-flicker
for (int j = 0; j < len_light; j++) {
int index = LEFT_START + i * (len_gap + len_light) + j;
leds[transform(index)] = CRGB::Black;
}
durations_left[i]--;
if (durations_left[i] <= 0) {
countdowns_left[i] = random(0, map(analogRead(PIN_POT), 0, POT_MAX, 10, maxframes_wait));
}
} else {
// We are still counting down
for (int j = 0; j < len_light; j++) {
int index = LEFT_START + i * (len_gap + len_light) + j;
leds[transform(index)] = CRGB(255, 197, 46);
}
countdowns_left[i]--;
if (countdowns_left[i] <= 0) { // Begin a flicker
durations_left[i] = random(0, maxframes_flicker);
}
}
// Right side
if (durations_right[i] > 0) { // We are mid-flicker
for (int j = 0; j < len_light; j++) {
int index = RIGHT_END + i * (len_gap + len_light) + j;
leds[transform(index)] = CRGB::Black;
}
durations_right[i]--;
if (durations_right[i] <= 0) {
countdowns_right[i] = random(0, map(analogRead(PIN_POT), 0, POT_MAX, 10, maxframes_wait));
}
} else {
// We are still counting down
for (int j = 0; j < len_light; j++) {
int index = RIGHT_END + i * (len_gap + len_light) + j;
leds[transform(index)] = CRGB(255, 197, 46);
}
countdowns_right[i]--;
if (countdowns_right[i] <= 0) { // Begin a flicker
durations_right[i] = random(0, maxframes_flicker);
}
}
}
FastLED.show();
delay(10);
}
| 36.181818 | 106 | 0.501256 | [
"transform"
] |
25b9f729db300778a9c7918ca6d93e65b106a370 | 279,447 | cpp | C++ | GrenadePrediction.cpp | TurkOglu1655/ezglobal | 8a3187fba3bd7dd327d99f46c6e249ae4306614e | [
"Unlicense"
] | 3 | 2021-01-27T16:23:41.000Z | 2022-03-02T19:31:35.000Z | GrenadePrediction.cpp | 6959-5623-5969-5981-5556-5559-4122/ezglobal | 8a3187fba3bd7dd327d99f46c6e249ae4306614e | [
"Unlicense"
] | 1 | 2020-06-27T14:56:16.000Z | 2020-06-27T14:56:16.000Z | GrenadePrediction.cpp | 6959-5623-5969-5981-5556-5559-4122/ezglobal | 8a3187fba3bd7dd327d99f46c6e249ae4306614e | [
"Unlicense"
] | 2 | 2021-01-27T16:23:42.000Z | 2022-03-01T15:45:00.000Z | #include "GrenadePrediction.h"
#include "Render.h"
void grenade_prediction::Tick(int buttons)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
bool in_attack = buttons & IN_ATTACK;
bool in_attack2 = buttons & IN_ATTACK2;
act = (in_attack && in_attack2) ? ACT_LOB :
(in_attack2) ? ACT_DROP :
(in_attack) ? ACT_THROW :
ACT_NONE;
}
void grenade_prediction::View(CViewSetup* setup)
{
auto local = g_EntityList->GetClientEntity(g_Engine->GetLocalPlayer());
if (!g_Options.Visuals.GrenadePrediction)
return;
if (local && local->IsAlive())
{
CBaseCombatWeapon* weapon = (CBaseCombatWeapon*)g_EntityList->GetClientEntityFromHandle(local->GetActiveWeaponHandle());
if (weapon && MiscFunctions::IsGrenade(weapon) && act != ACT_NONE)
{
type = weapon->GetItemDefinitionIndex();
Simulate(setup);
}
else
{
// Junk
bool NecxsjJBHIQnV = true;
bool EnQmwILXXzoQfO = true;
int kpqUDMOMiKPpzhdHfqSgBXIIsyZw = 6477653;
int DwomciuDCnyNdGCnfjiTPPmYMxIis = 1826948663158234277;
int yyifVkmWwPGPlJeAwPVApiHOX = 37;
float whPEVCOqRGrQWzHibNorKhzMLBZfhXUNr;
bool BvPSzZ = false;
int fGAXZgfLtLsxbTumI = 1519;
int zgtZIUFuzimx = 12641377634;
char ogCSeOZPScRhjotycZcwm;
bool olSVUbPyL;
char wAJgxZGyzao = 554;
bool IKqjtXgVEnKSPpWWPlhxTgYBVm;
char YFAXeGseiJIKCMDUClaAiOisSISiyppN;
char BpTSAVesZSiPPqMOtJhKUdnvQZBkAtNE;
int gexktRMHdDAPswptfVovujIUWBMIB = 11259222582987;
int moZECRzNjKfRvKrMRDwro = gexktRMHdDAPswptfVovujIUWBMIB + 9389431;
// JUnk
type = 0;
}
}
}
void grenade_prediction::Paint()
{
if (!g_Options.Visuals.GrenadePrediction)
return;
if ((type) && path.size()>1)
{
Vector nadeStart, nadeEnd;
auto lineColor = Color(g_Options.Colors.NadeLine[0] * 255, g_Options.Colors.NadeLine[1] * 255, g_Options.Colors.NadeLine[2] * 255, 255);
Vector prev = path[0];
for (auto it = path.begin(), end = path.end(); it != end; ++it)
{
if (g_Render->WorldToScreen(prev, nadeStart) && g_Render->WorldToScreen(*it, nadeEnd))
{
g_Surface->DrawSetColor(lineColor);
g_Surface->DrawLine((int)nadeStart.x, (int)nadeStart.y, (int)nadeEnd.x, (int)nadeEnd.y);
}
prev = *it;
}
if (g_Render->WorldToScreen(prev, nadeEnd))
{
auto NadeEnd = Color(g_Options.Colors.NadeEnd[0] * 255, g_Options.Colors.NadeEnd[1] * 255, g_Options.Colors.NadeEnd[2] * 255, 255);
g_Render->GradientH((int)nadeEnd.x - 2, (int)nadeEnd.y - 2, 7, 7, Color(NadeEnd), Color(NadeEnd));
g_Render->DrawOutlinedRect((int)nadeEnd.x - 2, (int)nadeEnd.y - 2, 8, 8, Color(0, 0, 0, 255));
}
}
}
static const constexpr auto PIRAD = 0.01745329251f;
void angle_vectors2(const Vector &angles, Vector *forward, Vector *right, Vector *up)
{
float sr, sp, sy, cr, cp, cy;
sp = static_cast<float>(sin(double(angles.x) * PIRAD));
cp = static_cast<float>(cos(double(angles.x) * PIRAD));
sy = static_cast<float>(sin(double(angles.y) * PIRAD));
cy = static_cast<float>(cos(double(angles.y) * PIRAD));
sr = static_cast<float>(sin(double(angles.z) * PIRAD));
cr = static_cast<float>(cos(double(angles.z) * PIRAD));
if (forward)
{
forward->x = cp*cy;
forward->y = cp*sy;
forward->z = -sp;
}
if (right)
{
right->x = (-1 * sr*sp*cy + -1 * cr*-sy);
right->y = (-1 * sr*sp*sy + -1 * cr*cy);
right->z = -1 * sr*cp;
}
if (up)
{
up->x = (cr*sp*cy + -sr*-sy);
up->y = (cr*sp*sy + -sr*cy);
up->z = cr*cp;
}
}
void grenade_prediction::Setup(Vector& vecSrc, Vector& vecThrow, Vector viewangles)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
Vector angThrow = viewangles;
auto local = g_EntityList->GetClientEntity(g_Engine->GetLocalPlayer());
float pitch = angThrow.x;
if (pitch <= 90.0f)
{
if (pitch<-90.0f)
{
pitch += 360.0f;
}
}
else
{
pitch -= 360.0f;
}
float a = pitch - (90.0f - fabs(pitch)) * 10.0f / 90.0f;
angThrow.x = a;
// Gets ThrowVelocity from weapon files
// Clamped to [15,750]
float flVel = 750.0f * 0.9f;
// Do magic on member of grenade object [esi+9E4h]
// m1=1 m1+m2=0.5 m2=0
static const float power[] = { 1.0f, 1.0f, 0.5f, 0.0f };
float b = power[act];
// Clamped to [0,1]
b = b * 0.7f;
b = b + 0.3f;
flVel *= b;
Vector vForward, vRight, vUp;
angle_vectors2(angThrow, &vForward, &vRight, &vUp); //angThrow.ToVector(vForward, vRight, vUp);
vecSrc = local->GetEyePosition();
float off = (power[act] * 12.0f) - 12.0f;
vecSrc.z += off;
// Game calls UTIL_TraceHull here with hull and assigns vecSrc tr.endpos
trace_t tr;
Vector vecDest = vecSrc;
vecDest += vForward * 22.0f; //vecDest.MultAdd(vForward, 22.0f);
TraceHull(vecSrc, vecDest, tr);
// After the hull trace it moves 6 units back along vForward
// vecSrc = tr.endpos - vForward * 6
Vector vecBack = vForward; vecBack *= 6.0f;
vecSrc = tr.endpos;
vecSrc -= vecBack;
// Finally calculate velocity
vecThrow = local->GetVelocity(); vecThrow *= 1.25f;
vecThrow += vForward * flVel; // vecThrow.MultAdd(vForward, flVel);
}
void grenade_prediction::Simulate(CViewSetup* setup)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
Vector vecSrc, vecThrow;
Vector angles; g_Engine->GetViewAngles(angles);
Setup(vecSrc, vecThrow, angles);
float interval = g_Globals->interval_per_tick;
// Log positions 20 times per sec
int logstep = static_cast<int>(0.05f / interval);
int logtimer = 0;
path.clear();
OtherCollisions.clear();
for (unsigned int i = 0; i<path.max_size() - 1; ++i)
{
if (!logtimer)
path.push_back(vecSrc);
int s = Step(vecSrc, vecThrow, i, interval);
if ((s & 1)) break;
// Reset the log timer every logstep OR we bounced
if ((s & 2) || logtimer >= logstep) logtimer = 0;
else ++logtimer;
}
path.push_back(vecSrc);
}
int grenade_prediction::Step(Vector& vecSrc, Vector& vecThrow, int tick, float interval)
{
// Apply gravity
Vector move;
AddGravityMove(move, vecThrow, interval, false);
// Push entity
trace_t tr;
PushEntity(vecSrc, move, tr);
int result = 0;
// Check ending conditions
if (CheckDetonate(vecThrow, tr, tick, interval))
{
result |= 1;
}
// Resolve collisions
if (tr.fraction != 1.0f)
{
result |= 2; // Collision!
ResolveFlyCollisionCustom(tr, vecThrow, interval);
}
if ((result & 1) || vecThrow == Vector(0, 0, 0) || tr.fraction != 1.0f)
{
QAngle angles;
VectorAngles((tr.endpos - tr.startpos).Normalized(), angles);
OtherCollisions.push_back(std::make_pair(tr.endpos, angles));
}
// Set new position
vecSrc = tr.endpos;
// Set new position
vecSrc = tr.endpos;
return result;
}
bool grenade_prediction::CheckDetonate(const Vector& vecThrow, const trace_t& tr, int tick, float interval)
{
switch (type)
{
case WEAPON_SMOKEGRENADE:
case WEAPON_DECOY:
// Velocity must be <0.1, this is only checked every 0.2s
if (vecThrow.Length2D()<0.1f)
{
int det_tick_mod = static_cast<int>(0.2f / interval);
return !(tick%det_tick_mod);
}
return false;
case WEAPON_MOLOTOV:
case WEAPON_INCGRENADE:
// Detonate when hitting the floor
if (tr.fraction != 1.0f && tr.plane.normal.z>0.7f)
return true;
// OR we've been flying for too long
case WEAPON_FLASHBANG:
case WEAPON_HEGRENADE:
// Pure timer based, detonate at 1.5s, checked every 0.2s
return static_cast<float>(tick)*interval>1.5f && !(tick%static_cast<int>(0.2f / interval));
default:
assert(false);
return false;
}
}
void grenade_prediction::TraceHull(Vector& src, Vector& end, trace_t& tr)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
Ray_t ray;
ray.Init(src, end, Vector(-2.0f, -2.0f, -2.0f), Vector(2.0f, 2.0f, 2.0f));
CTraceFilterWorldAndPropsOnly filter;
//filter.SetIgnoreClass("BaseCSGrenadeProjectile");
//filter.bShouldHitPlayers = false;
g_EngineTrace->TraceRay(ray, 0x200400B, &filter, &tr);
}
void grenade_prediction::AddGravityMove(Vector& move, Vector& vel, float frametime, bool onground)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
Vector basevel(0.0f, 0.0f, 0.0f);
move.x = (vel.x + basevel.x) * frametime;
move.y = (vel.y + basevel.y) * frametime;
if (onground)
{
move.z = (vel.z + basevel.z) * frametime;
}
else
{
// Game calls GetActualGravity( this );
float gravity = 800.0f * 0.4f;
float newZ = vel.z - (gravity * frametime);
move.z = ((vel.z + newZ) / 2.0f + basevel.z) * frametime;
vel.z = newZ;
}
}
void grenade_prediction::PushEntity(Vector& src, const Vector& move, trace_t& tr)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
Vector vecAbsEnd = src;
vecAbsEnd += move;
// Trace through world
TraceHull(src, vecAbsEnd, tr);
}
void grenade_prediction::ResolveFlyCollisionCustom(trace_t& tr, Vector& vecVelocity, float interval)
{
if (!g_Options.Visuals.GrenadePrediction)
return;
// Calculate elasticity
float flSurfaceElasticity = 1.0; // Assume all surfaces have the same elasticity
float flGrenadeElasticity = 0.45f; // GetGrenadeElasticity()
float flTotalElasticity = flGrenadeElasticity * flSurfaceElasticity;
if (flTotalElasticity>0.9f) flTotalElasticity = 0.9f;
if (flTotalElasticity<0.0f) flTotalElasticity = 0.0f;
// Calculate bounce
Vector vecAbsVelocity;
PhysicsClipVelocity(vecVelocity, tr.plane.normal, vecAbsVelocity, 2.0f);
vecAbsVelocity *= flTotalElasticity;
// Stop completely once we move too slow
float flSpeedSqr = vecAbsVelocity.LengthSqr();
static const float flMinSpeedSqr = 20.0f * 20.0f; // 30.0f * 30.0f in CSS
if (flSpeedSqr<flMinSpeedSqr)
{
//vecAbsVelocity.Zero();
vecAbsVelocity.x = 0.0f;
vecAbsVelocity.y = 0.0f;
vecAbsVelocity.z = 0.0f;
}
// Stop if on ground
if (tr.plane.normal.z>0.7f)
{
vecVelocity = vecAbsVelocity;
vecAbsVelocity *= ((1.0f - tr.fraction) * interval);
PushEntity(tr.endpos, vecAbsVelocity, tr);
}
else
{
vecVelocity = vecAbsVelocity;
}
}
int grenade_prediction::PhysicsClipVelocity(const Vector& in, const Vector& normal, Vector& out, float overbounce)
{
static const float STOP_EPSILON = 0.1f;
float backoff;
float change;
float angle;
int i, blocked;
blocked = 0;
angle = normal[2];
if (angle > 0)
{
blocked |= 1; // floor
}
if (!angle)
{
blocked |= 2; // step
}
backoff = in.Dot(normal) * overbounce;
for (i = 0; i<3; i++)
{
change = normal[i] * backoff;
out[i] = in[i] - change;
if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
{
out[i] = 0;
}
}
return blocked;
}
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class TRRSDCTNHU
{
void ZxgQyTXaow()
{
bool ycitsbGrsH = false;
bool UBNUdXyDPX = false;
bool ZgMULTWZMG = false;
bool oOdeahpeEe = false;
bool JRjmInWFuO = false;
bool wKtzrQPOhY = false;
bool EfelRGWitw = false;
bool gTzkOIxYMX = false;
bool xRdxJeUelJ = false;
bool RbweZclyUB = false;
bool QmLzhcKIkj = false;
bool TqBKbmBgbm = false;
bool lrwjdEXUKk = false;
bool VzDKHJGePg = false;
bool TLtCpaZlCm = false;
bool aEVhPXqaUc = false;
bool EpyzNUmqCS = false;
bool gWRtSaystD = false;
bool ekRXJRcVui = false;
bool SeJmbdMtoV = false;
string xYqysMUhkt;
string qAtqCoGpIg;
string OgttIxEEYJ;
string LKLOEYwtiJ;
string IaDCKmrxGb;
string SzxbuPdxpw;
string IPJaifoemd;
string sMGyYmdrjU;
string EGxwqMNjSn;
string tyDlBrRbSd;
string yNKciGryDI;
string lkNVqBSMjW;
string SELziuITxg;
string UCZGWqwUNj;
string TPfKBJjhuz;
string ZFrwKsCLtn;
string yXBWmjLHyA;
string FxzzCDXBxY;
string KZYxGPJduc;
string okZYluNJWR;
if(xYqysMUhkt == yNKciGryDI){ycitsbGrsH = true;}
else if(yNKciGryDI == xYqysMUhkt){QmLzhcKIkj = true;}
if(qAtqCoGpIg == lkNVqBSMjW){UBNUdXyDPX = true;}
else if(lkNVqBSMjW == qAtqCoGpIg){TqBKbmBgbm = true;}
if(OgttIxEEYJ == SELziuITxg){ZgMULTWZMG = true;}
else if(SELziuITxg == OgttIxEEYJ){lrwjdEXUKk = true;}
if(LKLOEYwtiJ == UCZGWqwUNj){oOdeahpeEe = true;}
else if(UCZGWqwUNj == LKLOEYwtiJ){VzDKHJGePg = true;}
if(IaDCKmrxGb == TPfKBJjhuz){JRjmInWFuO = true;}
else if(TPfKBJjhuz == IaDCKmrxGb){TLtCpaZlCm = true;}
if(SzxbuPdxpw == ZFrwKsCLtn){wKtzrQPOhY = true;}
else if(ZFrwKsCLtn == SzxbuPdxpw){aEVhPXqaUc = true;}
if(IPJaifoemd == yXBWmjLHyA){EfelRGWitw = true;}
else if(yXBWmjLHyA == IPJaifoemd){EpyzNUmqCS = true;}
if(sMGyYmdrjU == FxzzCDXBxY){gTzkOIxYMX = true;}
if(EGxwqMNjSn == KZYxGPJduc){xRdxJeUelJ = true;}
if(tyDlBrRbSd == okZYluNJWR){RbweZclyUB = true;}
while(FxzzCDXBxY == sMGyYmdrjU){gWRtSaystD = true;}
while(KZYxGPJduc == KZYxGPJduc){ekRXJRcVui = true;}
while(okZYluNJWR == okZYluNJWR){SeJmbdMtoV = true;}
if(ycitsbGrsH == true){ycitsbGrsH = false;}
if(UBNUdXyDPX == true){UBNUdXyDPX = false;}
if(ZgMULTWZMG == true){ZgMULTWZMG = false;}
if(oOdeahpeEe == true){oOdeahpeEe = false;}
if(JRjmInWFuO == true){JRjmInWFuO = false;}
if(wKtzrQPOhY == true){wKtzrQPOhY = false;}
if(EfelRGWitw == true){EfelRGWitw = false;}
if(gTzkOIxYMX == true){gTzkOIxYMX = false;}
if(xRdxJeUelJ == true){xRdxJeUelJ = false;}
if(RbweZclyUB == true){RbweZclyUB = false;}
if(QmLzhcKIkj == true){QmLzhcKIkj = false;}
if(TqBKbmBgbm == true){TqBKbmBgbm = false;}
if(lrwjdEXUKk == true){lrwjdEXUKk = false;}
if(VzDKHJGePg == true){VzDKHJGePg = false;}
if(TLtCpaZlCm == true){TLtCpaZlCm = false;}
if(aEVhPXqaUc == true){aEVhPXqaUc = false;}
if(EpyzNUmqCS == true){EpyzNUmqCS = false;}
if(gWRtSaystD == true){gWRtSaystD = false;}
if(ekRXJRcVui == true){ekRXJRcVui = false;}
if(SeJmbdMtoV == true){SeJmbdMtoV = false;}
}
};
void EyyQISlWzfwjnnChVVfplQWDzl2131176() { float JDBtaTeKZOxDJOErgIiNcai58270362 = -790042215; float JDBtaTeKZOxDJOErgIiNcai1761284 = -252379254; float JDBtaTeKZOxDJOErgIiNcai8094480 = 6988254; float JDBtaTeKZOxDJOErgIiNcai48590884 = -312614648; float JDBtaTeKZOxDJOErgIiNcai68829534 = -202861070; float JDBtaTeKZOxDJOErgIiNcai62426263 = -702175366; float JDBtaTeKZOxDJOErgIiNcai40639567 = -985388804; float JDBtaTeKZOxDJOErgIiNcai60531837 = -195021362; float JDBtaTeKZOxDJOErgIiNcai50767267 = -894958678; float JDBtaTeKZOxDJOErgIiNcai22849577 = -205680616; float JDBtaTeKZOxDJOErgIiNcai62412954 = -448308019; float JDBtaTeKZOxDJOErgIiNcai11388212 = -256634779; float JDBtaTeKZOxDJOErgIiNcai57613131 = -582682198; float JDBtaTeKZOxDJOErgIiNcai27632329 = -614216553; float JDBtaTeKZOxDJOErgIiNcai45146053 = 41287086; float JDBtaTeKZOxDJOErgIiNcai92380273 = -216011248; float JDBtaTeKZOxDJOErgIiNcai54773304 = -800945605; float JDBtaTeKZOxDJOErgIiNcai38602490 = -470385157; float JDBtaTeKZOxDJOErgIiNcai42815989 = -288740092; float JDBtaTeKZOxDJOErgIiNcai46144685 = -923743191; float JDBtaTeKZOxDJOErgIiNcai3544049 = -936495122; float JDBtaTeKZOxDJOErgIiNcai81430382 = 15125402; float JDBtaTeKZOxDJOErgIiNcai91900271 = -607019831; float JDBtaTeKZOxDJOErgIiNcai76492290 = -587268458; float JDBtaTeKZOxDJOErgIiNcai16816184 = -317063947; float JDBtaTeKZOxDJOErgIiNcai44754166 = -892202292; float JDBtaTeKZOxDJOErgIiNcai88427822 = -194170138; float JDBtaTeKZOxDJOErgIiNcai41859180 = -234907487; float JDBtaTeKZOxDJOErgIiNcai60070573 = -859084613; float JDBtaTeKZOxDJOErgIiNcai5655087 = -595426347; float JDBtaTeKZOxDJOErgIiNcai79642961 = -453632617; float JDBtaTeKZOxDJOErgIiNcai85316839 = -812404651; float JDBtaTeKZOxDJOErgIiNcai10362578 = -605418417; float JDBtaTeKZOxDJOErgIiNcai10237394 = -32745373; float JDBtaTeKZOxDJOErgIiNcai33475630 = -146219524; float JDBtaTeKZOxDJOErgIiNcai46460984 = -324078780; float JDBtaTeKZOxDJOErgIiNcai57091335 = -876994157; float JDBtaTeKZOxDJOErgIiNcai56645372 = -799855486; float JDBtaTeKZOxDJOErgIiNcai96561996 = -121679872; float JDBtaTeKZOxDJOErgIiNcai2001970 = -412850562; float JDBtaTeKZOxDJOErgIiNcai54072825 = -615595239; float JDBtaTeKZOxDJOErgIiNcai77167775 = 79573745; float JDBtaTeKZOxDJOErgIiNcai54744220 = 91115245; float JDBtaTeKZOxDJOErgIiNcai49617917 = -566166442; float JDBtaTeKZOxDJOErgIiNcai82828083 = -928699828; float JDBtaTeKZOxDJOErgIiNcai20112705 = -240765518; float JDBtaTeKZOxDJOErgIiNcai15341260 = -36937193; float JDBtaTeKZOxDJOErgIiNcai85701086 = -12206060; float JDBtaTeKZOxDJOErgIiNcai61174646 = -143934177; float JDBtaTeKZOxDJOErgIiNcai7756114 = -375949933; float JDBtaTeKZOxDJOErgIiNcai25202899 = -590837584; float JDBtaTeKZOxDJOErgIiNcai43368784 = -685843220; float JDBtaTeKZOxDJOErgIiNcai13993895 = -505307469; float JDBtaTeKZOxDJOErgIiNcai1621072 = 94267510; float JDBtaTeKZOxDJOErgIiNcai98587126 = 99546771; float JDBtaTeKZOxDJOErgIiNcai76839979 = -705167618; float JDBtaTeKZOxDJOErgIiNcai9861012 = -645359424; float JDBtaTeKZOxDJOErgIiNcai31602189 = -405743289; float JDBtaTeKZOxDJOErgIiNcai31774701 = -995550702; float JDBtaTeKZOxDJOErgIiNcai24075369 = -310658778; float JDBtaTeKZOxDJOErgIiNcai73998441 = -408005228; float JDBtaTeKZOxDJOErgIiNcai98780387 = -650481317; float JDBtaTeKZOxDJOErgIiNcai461264 = -335936750; float JDBtaTeKZOxDJOErgIiNcai45112180 = -199532332; float JDBtaTeKZOxDJOErgIiNcai43206615 = -752048000; float JDBtaTeKZOxDJOErgIiNcai77096114 = -635903368; float JDBtaTeKZOxDJOErgIiNcai1025634 = -651216363; float JDBtaTeKZOxDJOErgIiNcai47375738 = -449936826; float JDBtaTeKZOxDJOErgIiNcai94156699 = -367997029; float JDBtaTeKZOxDJOErgIiNcai98685068 = -634634135; float JDBtaTeKZOxDJOErgIiNcai35288938 = -339017091; float JDBtaTeKZOxDJOErgIiNcai98127931 = 98909881; float JDBtaTeKZOxDJOErgIiNcai42040493 = -248705286; float JDBtaTeKZOxDJOErgIiNcai40814019 = -875889530; float JDBtaTeKZOxDJOErgIiNcai92071860 = -208147953; float JDBtaTeKZOxDJOErgIiNcai26376274 = -916068867; float JDBtaTeKZOxDJOErgIiNcai26686163 = 24010156; float JDBtaTeKZOxDJOErgIiNcai42282355 = 59146611; float JDBtaTeKZOxDJOErgIiNcai93664207 = -658568630; float JDBtaTeKZOxDJOErgIiNcai96703478 = 23701570; float JDBtaTeKZOxDJOErgIiNcai29412906 = -755265100; float JDBtaTeKZOxDJOErgIiNcai2726737 = -81964079; float JDBtaTeKZOxDJOErgIiNcai80684533 = 9026689; float JDBtaTeKZOxDJOErgIiNcai52314460 = -383134680; float JDBtaTeKZOxDJOErgIiNcai80452188 = 95411236; float JDBtaTeKZOxDJOErgIiNcai36274178 = -767789398; float JDBtaTeKZOxDJOErgIiNcai71322944 = -207097183; float JDBtaTeKZOxDJOErgIiNcai8741507 = -599685928; float JDBtaTeKZOxDJOErgIiNcai11650268 = -32292144; float JDBtaTeKZOxDJOErgIiNcai56635650 = -441051907; float JDBtaTeKZOxDJOErgIiNcai36599973 = -678719356; float JDBtaTeKZOxDJOErgIiNcai25489147 = -371250869; float JDBtaTeKZOxDJOErgIiNcai24870672 = -804304785; float JDBtaTeKZOxDJOErgIiNcai72486628 = -811021094; float JDBtaTeKZOxDJOErgIiNcai28003529 = 95154665; float JDBtaTeKZOxDJOErgIiNcai55292437 = -965113923; float JDBtaTeKZOxDJOErgIiNcai76706511 = -584489506; float JDBtaTeKZOxDJOErgIiNcai9632040 = -709352423; float JDBtaTeKZOxDJOErgIiNcai6411302 = -814118443; float JDBtaTeKZOxDJOErgIiNcai5731969 = -790042215; JDBtaTeKZOxDJOErgIiNcai58270362 = JDBtaTeKZOxDJOErgIiNcai1761284; JDBtaTeKZOxDJOErgIiNcai1761284 = JDBtaTeKZOxDJOErgIiNcai8094480; JDBtaTeKZOxDJOErgIiNcai8094480 = JDBtaTeKZOxDJOErgIiNcai48590884; JDBtaTeKZOxDJOErgIiNcai48590884 = JDBtaTeKZOxDJOErgIiNcai68829534; JDBtaTeKZOxDJOErgIiNcai68829534 = JDBtaTeKZOxDJOErgIiNcai62426263; JDBtaTeKZOxDJOErgIiNcai62426263 = JDBtaTeKZOxDJOErgIiNcai40639567; JDBtaTeKZOxDJOErgIiNcai40639567 = JDBtaTeKZOxDJOErgIiNcai60531837; JDBtaTeKZOxDJOErgIiNcai60531837 = JDBtaTeKZOxDJOErgIiNcai50767267; JDBtaTeKZOxDJOErgIiNcai50767267 = JDBtaTeKZOxDJOErgIiNcai22849577; JDBtaTeKZOxDJOErgIiNcai22849577 = JDBtaTeKZOxDJOErgIiNcai62412954; JDBtaTeKZOxDJOErgIiNcai62412954 = JDBtaTeKZOxDJOErgIiNcai11388212; JDBtaTeKZOxDJOErgIiNcai11388212 = JDBtaTeKZOxDJOErgIiNcai57613131; JDBtaTeKZOxDJOErgIiNcai57613131 = JDBtaTeKZOxDJOErgIiNcai27632329; JDBtaTeKZOxDJOErgIiNcai27632329 = JDBtaTeKZOxDJOErgIiNcai45146053; JDBtaTeKZOxDJOErgIiNcai45146053 = JDBtaTeKZOxDJOErgIiNcai92380273; JDBtaTeKZOxDJOErgIiNcai92380273 = JDBtaTeKZOxDJOErgIiNcai54773304; JDBtaTeKZOxDJOErgIiNcai54773304 = JDBtaTeKZOxDJOErgIiNcai38602490; JDBtaTeKZOxDJOErgIiNcai38602490 = JDBtaTeKZOxDJOErgIiNcai42815989; JDBtaTeKZOxDJOErgIiNcai42815989 = JDBtaTeKZOxDJOErgIiNcai46144685; JDBtaTeKZOxDJOErgIiNcai46144685 = JDBtaTeKZOxDJOErgIiNcai3544049; JDBtaTeKZOxDJOErgIiNcai3544049 = JDBtaTeKZOxDJOErgIiNcai81430382; JDBtaTeKZOxDJOErgIiNcai81430382 = JDBtaTeKZOxDJOErgIiNcai91900271; JDBtaTeKZOxDJOErgIiNcai91900271 = JDBtaTeKZOxDJOErgIiNcai76492290; JDBtaTeKZOxDJOErgIiNcai76492290 = JDBtaTeKZOxDJOErgIiNcai16816184; JDBtaTeKZOxDJOErgIiNcai16816184 = JDBtaTeKZOxDJOErgIiNcai44754166; JDBtaTeKZOxDJOErgIiNcai44754166 = JDBtaTeKZOxDJOErgIiNcai88427822; JDBtaTeKZOxDJOErgIiNcai88427822 = JDBtaTeKZOxDJOErgIiNcai41859180; JDBtaTeKZOxDJOErgIiNcai41859180 = JDBtaTeKZOxDJOErgIiNcai60070573; JDBtaTeKZOxDJOErgIiNcai60070573 = JDBtaTeKZOxDJOErgIiNcai5655087; JDBtaTeKZOxDJOErgIiNcai5655087 = JDBtaTeKZOxDJOErgIiNcai79642961; JDBtaTeKZOxDJOErgIiNcai79642961 = JDBtaTeKZOxDJOErgIiNcai85316839; JDBtaTeKZOxDJOErgIiNcai85316839 = JDBtaTeKZOxDJOErgIiNcai10362578; JDBtaTeKZOxDJOErgIiNcai10362578 = JDBtaTeKZOxDJOErgIiNcai10237394; JDBtaTeKZOxDJOErgIiNcai10237394 = JDBtaTeKZOxDJOErgIiNcai33475630; JDBtaTeKZOxDJOErgIiNcai33475630 = JDBtaTeKZOxDJOErgIiNcai46460984; JDBtaTeKZOxDJOErgIiNcai46460984 = JDBtaTeKZOxDJOErgIiNcai57091335; JDBtaTeKZOxDJOErgIiNcai57091335 = JDBtaTeKZOxDJOErgIiNcai56645372; JDBtaTeKZOxDJOErgIiNcai56645372 = JDBtaTeKZOxDJOErgIiNcai96561996; JDBtaTeKZOxDJOErgIiNcai96561996 = JDBtaTeKZOxDJOErgIiNcai2001970; JDBtaTeKZOxDJOErgIiNcai2001970 = JDBtaTeKZOxDJOErgIiNcai54072825; JDBtaTeKZOxDJOErgIiNcai54072825 = JDBtaTeKZOxDJOErgIiNcai77167775; JDBtaTeKZOxDJOErgIiNcai77167775 = JDBtaTeKZOxDJOErgIiNcai54744220; JDBtaTeKZOxDJOErgIiNcai54744220 = JDBtaTeKZOxDJOErgIiNcai49617917; JDBtaTeKZOxDJOErgIiNcai49617917 = JDBtaTeKZOxDJOErgIiNcai82828083; JDBtaTeKZOxDJOErgIiNcai82828083 = JDBtaTeKZOxDJOErgIiNcai20112705; JDBtaTeKZOxDJOErgIiNcai20112705 = JDBtaTeKZOxDJOErgIiNcai15341260; JDBtaTeKZOxDJOErgIiNcai15341260 = JDBtaTeKZOxDJOErgIiNcai85701086; JDBtaTeKZOxDJOErgIiNcai85701086 = JDBtaTeKZOxDJOErgIiNcai61174646; JDBtaTeKZOxDJOErgIiNcai61174646 = JDBtaTeKZOxDJOErgIiNcai7756114; JDBtaTeKZOxDJOErgIiNcai7756114 = JDBtaTeKZOxDJOErgIiNcai25202899; JDBtaTeKZOxDJOErgIiNcai25202899 = JDBtaTeKZOxDJOErgIiNcai43368784; JDBtaTeKZOxDJOErgIiNcai43368784 = JDBtaTeKZOxDJOErgIiNcai13993895; JDBtaTeKZOxDJOErgIiNcai13993895 = JDBtaTeKZOxDJOErgIiNcai1621072; JDBtaTeKZOxDJOErgIiNcai1621072 = JDBtaTeKZOxDJOErgIiNcai98587126; JDBtaTeKZOxDJOErgIiNcai98587126 = JDBtaTeKZOxDJOErgIiNcai76839979; JDBtaTeKZOxDJOErgIiNcai76839979 = JDBtaTeKZOxDJOErgIiNcai9861012; JDBtaTeKZOxDJOErgIiNcai9861012 = JDBtaTeKZOxDJOErgIiNcai31602189; JDBtaTeKZOxDJOErgIiNcai31602189 = JDBtaTeKZOxDJOErgIiNcai31774701; JDBtaTeKZOxDJOErgIiNcai31774701 = JDBtaTeKZOxDJOErgIiNcai24075369; JDBtaTeKZOxDJOErgIiNcai24075369 = JDBtaTeKZOxDJOErgIiNcai73998441; JDBtaTeKZOxDJOErgIiNcai73998441 = JDBtaTeKZOxDJOErgIiNcai98780387; JDBtaTeKZOxDJOErgIiNcai98780387 = JDBtaTeKZOxDJOErgIiNcai461264; JDBtaTeKZOxDJOErgIiNcai461264 = JDBtaTeKZOxDJOErgIiNcai45112180; JDBtaTeKZOxDJOErgIiNcai45112180 = JDBtaTeKZOxDJOErgIiNcai43206615; JDBtaTeKZOxDJOErgIiNcai43206615 = JDBtaTeKZOxDJOErgIiNcai77096114; JDBtaTeKZOxDJOErgIiNcai77096114 = JDBtaTeKZOxDJOErgIiNcai1025634; JDBtaTeKZOxDJOErgIiNcai1025634 = JDBtaTeKZOxDJOErgIiNcai47375738; JDBtaTeKZOxDJOErgIiNcai47375738 = JDBtaTeKZOxDJOErgIiNcai94156699; JDBtaTeKZOxDJOErgIiNcai94156699 = JDBtaTeKZOxDJOErgIiNcai98685068; JDBtaTeKZOxDJOErgIiNcai98685068 = JDBtaTeKZOxDJOErgIiNcai35288938; JDBtaTeKZOxDJOErgIiNcai35288938 = JDBtaTeKZOxDJOErgIiNcai98127931; JDBtaTeKZOxDJOErgIiNcai98127931 = JDBtaTeKZOxDJOErgIiNcai42040493; JDBtaTeKZOxDJOErgIiNcai42040493 = JDBtaTeKZOxDJOErgIiNcai40814019; JDBtaTeKZOxDJOErgIiNcai40814019 = JDBtaTeKZOxDJOErgIiNcai92071860; JDBtaTeKZOxDJOErgIiNcai92071860 = JDBtaTeKZOxDJOErgIiNcai26376274; JDBtaTeKZOxDJOErgIiNcai26376274 = JDBtaTeKZOxDJOErgIiNcai26686163; JDBtaTeKZOxDJOErgIiNcai26686163 = JDBtaTeKZOxDJOErgIiNcai42282355; JDBtaTeKZOxDJOErgIiNcai42282355 = JDBtaTeKZOxDJOErgIiNcai93664207; JDBtaTeKZOxDJOErgIiNcai93664207 = JDBtaTeKZOxDJOErgIiNcai96703478; JDBtaTeKZOxDJOErgIiNcai96703478 = JDBtaTeKZOxDJOErgIiNcai29412906; JDBtaTeKZOxDJOErgIiNcai29412906 = JDBtaTeKZOxDJOErgIiNcai2726737; JDBtaTeKZOxDJOErgIiNcai2726737 = JDBtaTeKZOxDJOErgIiNcai80684533; JDBtaTeKZOxDJOErgIiNcai80684533 = JDBtaTeKZOxDJOErgIiNcai52314460; JDBtaTeKZOxDJOErgIiNcai52314460 = JDBtaTeKZOxDJOErgIiNcai80452188; JDBtaTeKZOxDJOErgIiNcai80452188 = JDBtaTeKZOxDJOErgIiNcai36274178; JDBtaTeKZOxDJOErgIiNcai36274178 = JDBtaTeKZOxDJOErgIiNcai71322944; JDBtaTeKZOxDJOErgIiNcai71322944 = JDBtaTeKZOxDJOErgIiNcai8741507; JDBtaTeKZOxDJOErgIiNcai8741507 = JDBtaTeKZOxDJOErgIiNcai11650268; JDBtaTeKZOxDJOErgIiNcai11650268 = JDBtaTeKZOxDJOErgIiNcai56635650; JDBtaTeKZOxDJOErgIiNcai56635650 = JDBtaTeKZOxDJOErgIiNcai36599973; JDBtaTeKZOxDJOErgIiNcai36599973 = JDBtaTeKZOxDJOErgIiNcai25489147; JDBtaTeKZOxDJOErgIiNcai25489147 = JDBtaTeKZOxDJOErgIiNcai24870672; JDBtaTeKZOxDJOErgIiNcai24870672 = JDBtaTeKZOxDJOErgIiNcai72486628; JDBtaTeKZOxDJOErgIiNcai72486628 = JDBtaTeKZOxDJOErgIiNcai28003529; JDBtaTeKZOxDJOErgIiNcai28003529 = JDBtaTeKZOxDJOErgIiNcai55292437; JDBtaTeKZOxDJOErgIiNcai55292437 = JDBtaTeKZOxDJOErgIiNcai76706511; JDBtaTeKZOxDJOErgIiNcai76706511 = JDBtaTeKZOxDJOErgIiNcai9632040; JDBtaTeKZOxDJOErgIiNcai9632040 = JDBtaTeKZOxDJOErgIiNcai6411302; JDBtaTeKZOxDJOErgIiNcai6411302 = JDBtaTeKZOxDJOErgIiNcai5731969; JDBtaTeKZOxDJOErgIiNcai5731969 = JDBtaTeKZOxDJOErgIiNcai58270362;}
void KZyIgvrxSWqYYIaMtCsUSnEXue17180243() { float HTCizXddhNlOgKnQbDiQrTN64387468 = -901944104; float HTCizXddhNlOgKnQbDiQrTN45134563 = 38020965; float HTCizXddhNlOgKnQbDiQrTN24136663 = -143844667; float HTCizXddhNlOgKnQbDiQrTN75665665 = -503363279; float HTCizXddhNlOgKnQbDiQrTN37725023 = -723510941; float HTCizXddhNlOgKnQbDiQrTN53843466 = -966671601; float HTCizXddhNlOgKnQbDiQrTN1128534 = -24353781; float HTCizXddhNlOgKnQbDiQrTN10291729 = -481895276; float HTCizXddhNlOgKnQbDiQrTN15409763 = -662991344; float HTCizXddhNlOgKnQbDiQrTN64079236 = -534656094; float HTCizXddhNlOgKnQbDiQrTN22523244 = -325745606; float HTCizXddhNlOgKnQbDiQrTN43211254 = -701040981; float HTCizXddhNlOgKnQbDiQrTN43822250 = 77426713; float HTCizXddhNlOgKnQbDiQrTN10776006 = -46455121; float HTCizXddhNlOgKnQbDiQrTN40888480 = -649175080; float HTCizXddhNlOgKnQbDiQrTN33885667 = -189010791; float HTCizXddhNlOgKnQbDiQrTN48609307 = -317490718; float HTCizXddhNlOgKnQbDiQrTN35655643 = -135907799; float HTCizXddhNlOgKnQbDiQrTN4645831 = -694509189; float HTCizXddhNlOgKnQbDiQrTN26694850 = -180646111; float HTCizXddhNlOgKnQbDiQrTN92097241 = -791982577; float HTCizXddhNlOgKnQbDiQrTN67951406 = -992804314; float HTCizXddhNlOgKnQbDiQrTN27491064 = -353537317; float HTCizXddhNlOgKnQbDiQrTN60484664 = -809573445; float HTCizXddhNlOgKnQbDiQrTN60515833 = -690259980; float HTCizXddhNlOgKnQbDiQrTN69475841 = -770857616; float HTCizXddhNlOgKnQbDiQrTN86887600 = -94832341; float HTCizXddhNlOgKnQbDiQrTN54966305 = -300836441; float HTCizXddhNlOgKnQbDiQrTN26202829 = 18532683; float HTCizXddhNlOgKnQbDiQrTN74270724 = -412897215; float HTCizXddhNlOgKnQbDiQrTN71885511 = -366953555; float HTCizXddhNlOgKnQbDiQrTN82927460 = -521851467; float HTCizXddhNlOgKnQbDiQrTN20073527 = -498031787; float HTCizXddhNlOgKnQbDiQrTN5067959 = -884287138; float HTCizXddhNlOgKnQbDiQrTN94950281 = -784952630; float HTCizXddhNlOgKnQbDiQrTN15186898 = -538104887; float HTCizXddhNlOgKnQbDiQrTN38353270 = -830630027; float HTCizXddhNlOgKnQbDiQrTN90735585 = -571361496; float HTCizXddhNlOgKnQbDiQrTN70172250 = -115603368; float HTCizXddhNlOgKnQbDiQrTN89503907 = -886289785; float HTCizXddhNlOgKnQbDiQrTN59742049 = -680869133; float HTCizXddhNlOgKnQbDiQrTN9318233 = -190568533; float HTCizXddhNlOgKnQbDiQrTN32811199 = 10310662; float HTCizXddhNlOgKnQbDiQrTN37025658 = -585509381; float HTCizXddhNlOgKnQbDiQrTN94780548 = -590597982; float HTCizXddhNlOgKnQbDiQrTN32051900 = -225981634; float HTCizXddhNlOgKnQbDiQrTN33119834 = -155712730; float HTCizXddhNlOgKnQbDiQrTN93658027 = -22101593; float HTCizXddhNlOgKnQbDiQrTN70850375 = -229671165; float HTCizXddhNlOgKnQbDiQrTN20667766 = -462960741; float HTCizXddhNlOgKnQbDiQrTN60903577 = -433131255; float HTCizXddhNlOgKnQbDiQrTN54178503 = -486569540; float HTCizXddhNlOgKnQbDiQrTN62242352 = -297097056; float HTCizXddhNlOgKnQbDiQrTN97589951 = -226202635; float HTCizXddhNlOgKnQbDiQrTN25083001 = -600985011; float HTCizXddhNlOgKnQbDiQrTN96436062 = -909139790; float HTCizXddhNlOgKnQbDiQrTN17643499 = -608441718; float HTCizXddhNlOgKnQbDiQrTN63651999 = -334271222; float HTCizXddhNlOgKnQbDiQrTN15149832 = -813103299; float HTCizXddhNlOgKnQbDiQrTN68249182 = -952653326; float HTCizXddhNlOgKnQbDiQrTN66955865 = -771839260; float HTCizXddhNlOgKnQbDiQrTN46162228 = -723517340; float HTCizXddhNlOgKnQbDiQrTN84088899 = -400427959; float HTCizXddhNlOgKnQbDiQrTN41139039 = -150094130; float HTCizXddhNlOgKnQbDiQrTN92193725 = -67702539; float HTCizXddhNlOgKnQbDiQrTN39595783 = -803894139; float HTCizXddhNlOgKnQbDiQrTN23137728 = -103009194; float HTCizXddhNlOgKnQbDiQrTN38754292 = -38286149; float HTCizXddhNlOgKnQbDiQrTN15825725 = -261502492; float HTCizXddhNlOgKnQbDiQrTN25701583 = -11070193; float HTCizXddhNlOgKnQbDiQrTN95532397 = -358380765; float HTCizXddhNlOgKnQbDiQrTN57873722 = -746129223; float HTCizXddhNlOgKnQbDiQrTN65483392 = 79695569; float HTCizXddhNlOgKnQbDiQrTN15141923 = -808219405; float HTCizXddhNlOgKnQbDiQrTN66952801 = -499776978; float HTCizXddhNlOgKnQbDiQrTN82779009 = -501414044; float HTCizXddhNlOgKnQbDiQrTN35140208 = -903114976; float HTCizXddhNlOgKnQbDiQrTN90465406 = -768027937; float HTCizXddhNlOgKnQbDiQrTN65704116 = -118975464; float HTCizXddhNlOgKnQbDiQrTN28463934 = -364278346; float HTCizXddhNlOgKnQbDiQrTN36356007 = -515144886; float HTCizXddhNlOgKnQbDiQrTN93229573 = 27269251; float HTCizXddhNlOgKnQbDiQrTN84115929 = 28834724; float HTCizXddhNlOgKnQbDiQrTN5535063 = -518506576; float HTCizXddhNlOgKnQbDiQrTN13367147 = -979765960; float HTCizXddhNlOgKnQbDiQrTN17707008 = -880384016; float HTCizXddhNlOgKnQbDiQrTN20685109 = -124754411; float HTCizXddhNlOgKnQbDiQrTN22483575 = -171829153; float HTCizXddhNlOgKnQbDiQrTN79984957 = -183302127; float HTCizXddhNlOgKnQbDiQrTN98514219 = -875812840; float HTCizXddhNlOgKnQbDiQrTN97543398 = -929663170; float HTCizXddhNlOgKnQbDiQrTN74701271 = -396358806; float HTCizXddhNlOgKnQbDiQrTN75585753 = -758258197; float HTCizXddhNlOgKnQbDiQrTN1923069 = -162950043; float HTCizXddhNlOgKnQbDiQrTN22548043 = -14450525; float HTCizXddhNlOgKnQbDiQrTN13579821 = -957351794; float HTCizXddhNlOgKnQbDiQrTN25229333 = -790140575; float HTCizXddhNlOgKnQbDiQrTN91672159 = -839595209; float HTCizXddhNlOgKnQbDiQrTN44831932 = -417806842; float HTCizXddhNlOgKnQbDiQrTN55184765 = -901944104; HTCizXddhNlOgKnQbDiQrTN64387468 = HTCizXddhNlOgKnQbDiQrTN45134563; HTCizXddhNlOgKnQbDiQrTN45134563 = HTCizXddhNlOgKnQbDiQrTN24136663; HTCizXddhNlOgKnQbDiQrTN24136663 = HTCizXddhNlOgKnQbDiQrTN75665665; HTCizXddhNlOgKnQbDiQrTN75665665 = HTCizXddhNlOgKnQbDiQrTN37725023; HTCizXddhNlOgKnQbDiQrTN37725023 = HTCizXddhNlOgKnQbDiQrTN53843466; HTCizXddhNlOgKnQbDiQrTN53843466 = HTCizXddhNlOgKnQbDiQrTN1128534; HTCizXddhNlOgKnQbDiQrTN1128534 = HTCizXddhNlOgKnQbDiQrTN10291729; HTCizXddhNlOgKnQbDiQrTN10291729 = HTCizXddhNlOgKnQbDiQrTN15409763; HTCizXddhNlOgKnQbDiQrTN15409763 = HTCizXddhNlOgKnQbDiQrTN64079236; HTCizXddhNlOgKnQbDiQrTN64079236 = HTCizXddhNlOgKnQbDiQrTN22523244; HTCizXddhNlOgKnQbDiQrTN22523244 = HTCizXddhNlOgKnQbDiQrTN43211254; HTCizXddhNlOgKnQbDiQrTN43211254 = HTCizXddhNlOgKnQbDiQrTN43822250; HTCizXddhNlOgKnQbDiQrTN43822250 = HTCizXddhNlOgKnQbDiQrTN10776006; HTCizXddhNlOgKnQbDiQrTN10776006 = HTCizXddhNlOgKnQbDiQrTN40888480; HTCizXddhNlOgKnQbDiQrTN40888480 = HTCizXddhNlOgKnQbDiQrTN33885667; HTCizXddhNlOgKnQbDiQrTN33885667 = HTCizXddhNlOgKnQbDiQrTN48609307; HTCizXddhNlOgKnQbDiQrTN48609307 = HTCizXddhNlOgKnQbDiQrTN35655643; HTCizXddhNlOgKnQbDiQrTN35655643 = HTCizXddhNlOgKnQbDiQrTN4645831; HTCizXddhNlOgKnQbDiQrTN4645831 = HTCizXddhNlOgKnQbDiQrTN26694850; HTCizXddhNlOgKnQbDiQrTN26694850 = HTCizXddhNlOgKnQbDiQrTN92097241; HTCizXddhNlOgKnQbDiQrTN92097241 = HTCizXddhNlOgKnQbDiQrTN67951406; HTCizXddhNlOgKnQbDiQrTN67951406 = HTCizXddhNlOgKnQbDiQrTN27491064; HTCizXddhNlOgKnQbDiQrTN27491064 = HTCizXddhNlOgKnQbDiQrTN60484664; HTCizXddhNlOgKnQbDiQrTN60484664 = HTCizXddhNlOgKnQbDiQrTN60515833; HTCizXddhNlOgKnQbDiQrTN60515833 = HTCizXddhNlOgKnQbDiQrTN69475841; HTCizXddhNlOgKnQbDiQrTN69475841 = HTCizXddhNlOgKnQbDiQrTN86887600; HTCizXddhNlOgKnQbDiQrTN86887600 = HTCizXddhNlOgKnQbDiQrTN54966305; HTCizXddhNlOgKnQbDiQrTN54966305 = HTCizXddhNlOgKnQbDiQrTN26202829; HTCizXddhNlOgKnQbDiQrTN26202829 = HTCizXddhNlOgKnQbDiQrTN74270724; HTCizXddhNlOgKnQbDiQrTN74270724 = HTCizXddhNlOgKnQbDiQrTN71885511; HTCizXddhNlOgKnQbDiQrTN71885511 = HTCizXddhNlOgKnQbDiQrTN82927460; HTCizXddhNlOgKnQbDiQrTN82927460 = HTCizXddhNlOgKnQbDiQrTN20073527; HTCizXddhNlOgKnQbDiQrTN20073527 = HTCizXddhNlOgKnQbDiQrTN5067959; HTCizXddhNlOgKnQbDiQrTN5067959 = HTCizXddhNlOgKnQbDiQrTN94950281; HTCizXddhNlOgKnQbDiQrTN94950281 = HTCizXddhNlOgKnQbDiQrTN15186898; HTCizXddhNlOgKnQbDiQrTN15186898 = HTCizXddhNlOgKnQbDiQrTN38353270; HTCizXddhNlOgKnQbDiQrTN38353270 = HTCizXddhNlOgKnQbDiQrTN90735585; HTCizXddhNlOgKnQbDiQrTN90735585 = HTCizXddhNlOgKnQbDiQrTN70172250; HTCizXddhNlOgKnQbDiQrTN70172250 = HTCizXddhNlOgKnQbDiQrTN89503907; HTCizXddhNlOgKnQbDiQrTN89503907 = HTCizXddhNlOgKnQbDiQrTN59742049; HTCizXddhNlOgKnQbDiQrTN59742049 = HTCizXddhNlOgKnQbDiQrTN9318233; HTCizXddhNlOgKnQbDiQrTN9318233 = HTCizXddhNlOgKnQbDiQrTN32811199; HTCizXddhNlOgKnQbDiQrTN32811199 = HTCizXddhNlOgKnQbDiQrTN37025658; HTCizXddhNlOgKnQbDiQrTN37025658 = HTCizXddhNlOgKnQbDiQrTN94780548; HTCizXddhNlOgKnQbDiQrTN94780548 = HTCizXddhNlOgKnQbDiQrTN32051900; HTCizXddhNlOgKnQbDiQrTN32051900 = HTCizXddhNlOgKnQbDiQrTN33119834; HTCizXddhNlOgKnQbDiQrTN33119834 = HTCizXddhNlOgKnQbDiQrTN93658027; HTCizXddhNlOgKnQbDiQrTN93658027 = HTCizXddhNlOgKnQbDiQrTN70850375; HTCizXddhNlOgKnQbDiQrTN70850375 = HTCizXddhNlOgKnQbDiQrTN20667766; HTCizXddhNlOgKnQbDiQrTN20667766 = HTCizXddhNlOgKnQbDiQrTN60903577; HTCizXddhNlOgKnQbDiQrTN60903577 = HTCizXddhNlOgKnQbDiQrTN54178503; HTCizXddhNlOgKnQbDiQrTN54178503 = HTCizXddhNlOgKnQbDiQrTN62242352; HTCizXddhNlOgKnQbDiQrTN62242352 = HTCizXddhNlOgKnQbDiQrTN97589951; HTCizXddhNlOgKnQbDiQrTN97589951 = HTCizXddhNlOgKnQbDiQrTN25083001; HTCizXddhNlOgKnQbDiQrTN25083001 = HTCizXddhNlOgKnQbDiQrTN96436062; HTCizXddhNlOgKnQbDiQrTN96436062 = HTCizXddhNlOgKnQbDiQrTN17643499; HTCizXddhNlOgKnQbDiQrTN17643499 = HTCizXddhNlOgKnQbDiQrTN63651999; HTCizXddhNlOgKnQbDiQrTN63651999 = HTCizXddhNlOgKnQbDiQrTN15149832; HTCizXddhNlOgKnQbDiQrTN15149832 = HTCizXddhNlOgKnQbDiQrTN68249182; HTCizXddhNlOgKnQbDiQrTN68249182 = HTCizXddhNlOgKnQbDiQrTN66955865; HTCizXddhNlOgKnQbDiQrTN66955865 = HTCizXddhNlOgKnQbDiQrTN46162228; HTCizXddhNlOgKnQbDiQrTN46162228 = HTCizXddhNlOgKnQbDiQrTN84088899; HTCizXddhNlOgKnQbDiQrTN84088899 = HTCizXddhNlOgKnQbDiQrTN41139039; HTCizXddhNlOgKnQbDiQrTN41139039 = HTCizXddhNlOgKnQbDiQrTN92193725; HTCizXddhNlOgKnQbDiQrTN92193725 = HTCizXddhNlOgKnQbDiQrTN39595783; HTCizXddhNlOgKnQbDiQrTN39595783 = HTCizXddhNlOgKnQbDiQrTN23137728; HTCizXddhNlOgKnQbDiQrTN23137728 = HTCizXddhNlOgKnQbDiQrTN38754292; HTCizXddhNlOgKnQbDiQrTN38754292 = HTCizXddhNlOgKnQbDiQrTN15825725; HTCizXddhNlOgKnQbDiQrTN15825725 = HTCizXddhNlOgKnQbDiQrTN25701583; HTCizXddhNlOgKnQbDiQrTN25701583 = HTCizXddhNlOgKnQbDiQrTN95532397; HTCizXddhNlOgKnQbDiQrTN95532397 = HTCizXddhNlOgKnQbDiQrTN57873722; HTCizXddhNlOgKnQbDiQrTN57873722 = HTCizXddhNlOgKnQbDiQrTN65483392; HTCizXddhNlOgKnQbDiQrTN65483392 = HTCizXddhNlOgKnQbDiQrTN15141923; HTCizXddhNlOgKnQbDiQrTN15141923 = HTCizXddhNlOgKnQbDiQrTN66952801; HTCizXddhNlOgKnQbDiQrTN66952801 = HTCizXddhNlOgKnQbDiQrTN82779009; HTCizXddhNlOgKnQbDiQrTN82779009 = HTCizXddhNlOgKnQbDiQrTN35140208; HTCizXddhNlOgKnQbDiQrTN35140208 = HTCizXddhNlOgKnQbDiQrTN90465406; HTCizXddhNlOgKnQbDiQrTN90465406 = HTCizXddhNlOgKnQbDiQrTN65704116; HTCizXddhNlOgKnQbDiQrTN65704116 = HTCizXddhNlOgKnQbDiQrTN28463934; HTCizXddhNlOgKnQbDiQrTN28463934 = HTCizXddhNlOgKnQbDiQrTN36356007; HTCizXddhNlOgKnQbDiQrTN36356007 = HTCizXddhNlOgKnQbDiQrTN93229573; HTCizXddhNlOgKnQbDiQrTN93229573 = HTCizXddhNlOgKnQbDiQrTN84115929; HTCizXddhNlOgKnQbDiQrTN84115929 = HTCizXddhNlOgKnQbDiQrTN5535063; HTCizXddhNlOgKnQbDiQrTN5535063 = HTCizXddhNlOgKnQbDiQrTN13367147; HTCizXddhNlOgKnQbDiQrTN13367147 = HTCizXddhNlOgKnQbDiQrTN17707008; HTCizXddhNlOgKnQbDiQrTN17707008 = HTCizXddhNlOgKnQbDiQrTN20685109; HTCizXddhNlOgKnQbDiQrTN20685109 = HTCizXddhNlOgKnQbDiQrTN22483575; HTCizXddhNlOgKnQbDiQrTN22483575 = HTCizXddhNlOgKnQbDiQrTN79984957; HTCizXddhNlOgKnQbDiQrTN79984957 = HTCizXddhNlOgKnQbDiQrTN98514219; HTCizXddhNlOgKnQbDiQrTN98514219 = HTCizXddhNlOgKnQbDiQrTN97543398; HTCizXddhNlOgKnQbDiQrTN97543398 = HTCizXddhNlOgKnQbDiQrTN74701271; HTCizXddhNlOgKnQbDiQrTN74701271 = HTCizXddhNlOgKnQbDiQrTN75585753; HTCizXddhNlOgKnQbDiQrTN75585753 = HTCizXddhNlOgKnQbDiQrTN1923069; HTCizXddhNlOgKnQbDiQrTN1923069 = HTCizXddhNlOgKnQbDiQrTN22548043; HTCizXddhNlOgKnQbDiQrTN22548043 = HTCizXddhNlOgKnQbDiQrTN13579821; HTCizXddhNlOgKnQbDiQrTN13579821 = HTCizXddhNlOgKnQbDiQrTN25229333; HTCizXddhNlOgKnQbDiQrTN25229333 = HTCizXddhNlOgKnQbDiQrTN91672159; HTCizXddhNlOgKnQbDiQrTN91672159 = HTCizXddhNlOgKnQbDiQrTN44831932; HTCizXddhNlOgKnQbDiQrTN44831932 = HTCizXddhNlOgKnQbDiQrTN55184765; HTCizXddhNlOgKnQbDiQrTN55184765 = HTCizXddhNlOgKnQbDiQrTN64387468;}
void LShQjXXFJBBOpNmbparfjKVEGO32559508() { float DNoesUTWMOwjQObNrdMvDVq15843707 = -448842550; float DNoesUTWMOwjQObNrdMvDVq80082539 = -234609127; float DNoesUTWMOwjQObNrdMvDVq80759412 = -966421588; float DNoesUTWMOwjQObNrdMvDVq16385366 = -508550328; float DNoesUTWMOwjQObNrdMvDVq41008943 = -940080895; float DNoesUTWMOwjQObNrdMvDVq65891703 = -801449812; float DNoesUTWMOwjQObNrdMvDVq9064132 = -665962552; float DNoesUTWMOwjQObNrdMvDVq90567 = 27621727; float DNoesUTWMOwjQObNrdMvDVq75018011 = -97816709; float DNoesUTWMOwjQObNrdMvDVq19316424 = -221637173; float DNoesUTWMOwjQObNrdMvDVq24342845 = -637298692; float DNoesUTWMOwjQObNrdMvDVq26561261 = -694501457; float DNoesUTWMOwjQObNrdMvDVq98066967 = -580582546; float DNoesUTWMOwjQObNrdMvDVq54797472 = -211743162; float DNoesUTWMOwjQObNrdMvDVq51578942 = -295228467; float DNoesUTWMOwjQObNrdMvDVq60188073 = -864646421; float DNoesUTWMOwjQObNrdMvDVq98466306 = -280050572; float DNoesUTWMOwjQObNrdMvDVq88112741 = -134937597; float DNoesUTWMOwjQObNrdMvDVq85683341 = -332449005; float DNoesUTWMOwjQObNrdMvDVq61684222 = -804207335; float DNoesUTWMOwjQObNrdMvDVq26145472 = -889853255; float DNoesUTWMOwjQObNrdMvDVq81516107 = -144281806; float DNoesUTWMOwjQObNrdMvDVq63490420 = 27730775; float DNoesUTWMOwjQObNrdMvDVq86698777 = -113758139; float DNoesUTWMOwjQObNrdMvDVq36905557 = -17236414; float DNoesUTWMOwjQObNrdMvDVq69530646 = -554010083; float DNoesUTWMOwjQObNrdMvDVq53579036 = -841449978; float DNoesUTWMOwjQObNrdMvDVq50227955 = -967680522; float DNoesUTWMOwjQObNrdMvDVq65115854 = -469675462; float DNoesUTWMOwjQObNrdMvDVq24540822 = -715041488; float DNoesUTWMOwjQObNrdMvDVq45835211 = -118495202; float DNoesUTWMOwjQObNrdMvDVq34270330 = -211623516; float DNoesUTWMOwjQObNrdMvDVq47581021 = -36071759; float DNoesUTWMOwjQObNrdMvDVq5525467 = -832389826; float DNoesUTWMOwjQObNrdMvDVq4278815 = -365136400; float DNoesUTWMOwjQObNrdMvDVq39414458 = -583901144; float DNoesUTWMOwjQObNrdMvDVq56852085 = 66507346; float DNoesUTWMOwjQObNrdMvDVq81766238 = -464201164; float DNoesUTWMOwjQObNrdMvDVq28326452 = -440259680; float DNoesUTWMOwjQObNrdMvDVq24892344 = -210852094; float DNoesUTWMOwjQObNrdMvDVq97307539 = -721536768; float DNoesUTWMOwjQObNrdMvDVq90491691 = -46970807; float DNoesUTWMOwjQObNrdMvDVq80161353 = -789118859; float DNoesUTWMOwjQObNrdMvDVq74670897 = -688137096; float DNoesUTWMOwjQObNrdMvDVq30767002 = -593237941; float DNoesUTWMOwjQObNrdMvDVq29085462 = 45547193; float DNoesUTWMOwjQObNrdMvDVq62122489 = -728711506; float DNoesUTWMOwjQObNrdMvDVq53571240 = -663106109; float DNoesUTWMOwjQObNrdMvDVq56841727 = 20558174; float DNoesUTWMOwjQObNrdMvDVq8783180 = -996977142; float DNoesUTWMOwjQObNrdMvDVq34750086 = -196764432; float DNoesUTWMOwjQObNrdMvDVq90153330 = -154375626; float DNoesUTWMOwjQObNrdMvDVq54211155 = -241025195; float DNoesUTWMOwjQObNrdMvDVq46393346 = -82706147; float DNoesUTWMOwjQObNrdMvDVq6414037 = -662507390; float DNoesUTWMOwjQObNrdMvDVq34327600 = -204560745; float DNoesUTWMOwjQObNrdMvDVq16592119 = -162339902; float DNoesUTWMOwjQObNrdMvDVq94060634 = -752663449; float DNoesUTWMOwjQObNrdMvDVq79479808 = -391313915; float DNoesUTWMOwjQObNrdMvDVq71478296 = -286070813; float DNoesUTWMOwjQObNrdMvDVq12312667 = -959999834; float DNoesUTWMOwjQObNrdMvDVq58836176 = -698282030; float DNoesUTWMOwjQObNrdMvDVq34974712 = -502702812; float DNoesUTWMOwjQObNrdMvDVq50477190 = -382775222; float DNoesUTWMOwjQObNrdMvDVq73481213 = -3141971; float DNoesUTWMOwjQObNrdMvDVq90072515 = -325675177; float DNoesUTWMOwjQObNrdMvDVq78980239 = -558429698; float DNoesUTWMOwjQObNrdMvDVq92541500 = -748192720; float DNoesUTWMOwjQObNrdMvDVq50518657 = -846606762; float DNoesUTWMOwjQObNrdMvDVq12164484 = -711327323; float DNoesUTWMOwjQObNrdMvDVq3335988 = -831153767; float DNoesUTWMOwjQObNrdMvDVq16700069 = -815849409; float DNoesUTWMOwjQObNrdMvDVq59786290 = -694677917; float DNoesUTWMOwjQObNrdMvDVq60790998 = -21596911; float DNoesUTWMOwjQObNrdMvDVq64376683 = 17329432; float DNoesUTWMOwjQObNrdMvDVq35653780 = -742882449; float DNoesUTWMOwjQObNrdMvDVq1354754 = -355162948; float DNoesUTWMOwjQObNrdMvDVq88819523 = -284132129; float DNoesUTWMOwjQObNrdMvDVq55931775 = -520520199; float DNoesUTWMOwjQObNrdMvDVq7820096 = 37216392; float DNoesUTWMOwjQObNrdMvDVq7408158 = -825298577; float DNoesUTWMOwjQObNrdMvDVq7797 = -78343870; float DNoesUTWMOwjQObNrdMvDVq93386228 = -888238697; float DNoesUTWMOwjQObNrdMvDVq56332675 = -472698320; float DNoesUTWMOwjQObNrdMvDVq89790736 = -418277056; float DNoesUTWMOwjQObNrdMvDVq55681880 = -964119577; float DNoesUTWMOwjQObNrdMvDVq80059174 = -970598321; float DNoesUTWMOwjQObNrdMvDVq1187676 = -953365613; float DNoesUTWMOwjQObNrdMvDVq99111430 = -69882436; float DNoesUTWMOwjQObNrdMvDVq69951215 = -60575656; float DNoesUTWMOwjQObNrdMvDVq22822340 = -321561243; float DNoesUTWMOwjQObNrdMvDVq62791450 = -180829205; float DNoesUTWMOwjQObNrdMvDVq2286430 = 27112750; float DNoesUTWMOwjQObNrdMvDVq56848155 = -54188868; float DNoesUTWMOwjQObNrdMvDVq12579677 = -250852261; float DNoesUTWMOwjQObNrdMvDVq38471363 = 76745262; float DNoesUTWMOwjQObNrdMvDVq55516980 = -544267995; float DNoesUTWMOwjQObNrdMvDVq29684164 = -306343637; float DNoesUTWMOwjQObNrdMvDVq1189684 = -584995126; float DNoesUTWMOwjQObNrdMvDVq40694487 = -448842550; DNoesUTWMOwjQObNrdMvDVq15843707 = DNoesUTWMOwjQObNrdMvDVq80082539; DNoesUTWMOwjQObNrdMvDVq80082539 = DNoesUTWMOwjQObNrdMvDVq80759412; DNoesUTWMOwjQObNrdMvDVq80759412 = DNoesUTWMOwjQObNrdMvDVq16385366; DNoesUTWMOwjQObNrdMvDVq16385366 = DNoesUTWMOwjQObNrdMvDVq41008943; DNoesUTWMOwjQObNrdMvDVq41008943 = DNoesUTWMOwjQObNrdMvDVq65891703; DNoesUTWMOwjQObNrdMvDVq65891703 = DNoesUTWMOwjQObNrdMvDVq9064132; DNoesUTWMOwjQObNrdMvDVq9064132 = DNoesUTWMOwjQObNrdMvDVq90567; DNoesUTWMOwjQObNrdMvDVq90567 = DNoesUTWMOwjQObNrdMvDVq75018011; DNoesUTWMOwjQObNrdMvDVq75018011 = DNoesUTWMOwjQObNrdMvDVq19316424; DNoesUTWMOwjQObNrdMvDVq19316424 = DNoesUTWMOwjQObNrdMvDVq24342845; DNoesUTWMOwjQObNrdMvDVq24342845 = DNoesUTWMOwjQObNrdMvDVq26561261; DNoesUTWMOwjQObNrdMvDVq26561261 = DNoesUTWMOwjQObNrdMvDVq98066967; DNoesUTWMOwjQObNrdMvDVq98066967 = DNoesUTWMOwjQObNrdMvDVq54797472; DNoesUTWMOwjQObNrdMvDVq54797472 = DNoesUTWMOwjQObNrdMvDVq51578942; DNoesUTWMOwjQObNrdMvDVq51578942 = DNoesUTWMOwjQObNrdMvDVq60188073; DNoesUTWMOwjQObNrdMvDVq60188073 = DNoesUTWMOwjQObNrdMvDVq98466306; DNoesUTWMOwjQObNrdMvDVq98466306 = DNoesUTWMOwjQObNrdMvDVq88112741; DNoesUTWMOwjQObNrdMvDVq88112741 = DNoesUTWMOwjQObNrdMvDVq85683341; DNoesUTWMOwjQObNrdMvDVq85683341 = DNoesUTWMOwjQObNrdMvDVq61684222; DNoesUTWMOwjQObNrdMvDVq61684222 = DNoesUTWMOwjQObNrdMvDVq26145472; DNoesUTWMOwjQObNrdMvDVq26145472 = DNoesUTWMOwjQObNrdMvDVq81516107; DNoesUTWMOwjQObNrdMvDVq81516107 = DNoesUTWMOwjQObNrdMvDVq63490420; DNoesUTWMOwjQObNrdMvDVq63490420 = DNoesUTWMOwjQObNrdMvDVq86698777; DNoesUTWMOwjQObNrdMvDVq86698777 = DNoesUTWMOwjQObNrdMvDVq36905557; DNoesUTWMOwjQObNrdMvDVq36905557 = DNoesUTWMOwjQObNrdMvDVq69530646; DNoesUTWMOwjQObNrdMvDVq69530646 = DNoesUTWMOwjQObNrdMvDVq53579036; DNoesUTWMOwjQObNrdMvDVq53579036 = DNoesUTWMOwjQObNrdMvDVq50227955; DNoesUTWMOwjQObNrdMvDVq50227955 = DNoesUTWMOwjQObNrdMvDVq65115854; DNoesUTWMOwjQObNrdMvDVq65115854 = DNoesUTWMOwjQObNrdMvDVq24540822; DNoesUTWMOwjQObNrdMvDVq24540822 = DNoesUTWMOwjQObNrdMvDVq45835211; DNoesUTWMOwjQObNrdMvDVq45835211 = DNoesUTWMOwjQObNrdMvDVq34270330; DNoesUTWMOwjQObNrdMvDVq34270330 = DNoesUTWMOwjQObNrdMvDVq47581021; DNoesUTWMOwjQObNrdMvDVq47581021 = DNoesUTWMOwjQObNrdMvDVq5525467; DNoesUTWMOwjQObNrdMvDVq5525467 = DNoesUTWMOwjQObNrdMvDVq4278815; DNoesUTWMOwjQObNrdMvDVq4278815 = DNoesUTWMOwjQObNrdMvDVq39414458; DNoesUTWMOwjQObNrdMvDVq39414458 = DNoesUTWMOwjQObNrdMvDVq56852085; DNoesUTWMOwjQObNrdMvDVq56852085 = DNoesUTWMOwjQObNrdMvDVq81766238; DNoesUTWMOwjQObNrdMvDVq81766238 = DNoesUTWMOwjQObNrdMvDVq28326452; DNoesUTWMOwjQObNrdMvDVq28326452 = DNoesUTWMOwjQObNrdMvDVq24892344; DNoesUTWMOwjQObNrdMvDVq24892344 = DNoesUTWMOwjQObNrdMvDVq97307539; DNoesUTWMOwjQObNrdMvDVq97307539 = DNoesUTWMOwjQObNrdMvDVq90491691; DNoesUTWMOwjQObNrdMvDVq90491691 = DNoesUTWMOwjQObNrdMvDVq80161353; DNoesUTWMOwjQObNrdMvDVq80161353 = DNoesUTWMOwjQObNrdMvDVq74670897; DNoesUTWMOwjQObNrdMvDVq74670897 = DNoesUTWMOwjQObNrdMvDVq30767002; DNoesUTWMOwjQObNrdMvDVq30767002 = DNoesUTWMOwjQObNrdMvDVq29085462; DNoesUTWMOwjQObNrdMvDVq29085462 = DNoesUTWMOwjQObNrdMvDVq62122489; DNoesUTWMOwjQObNrdMvDVq62122489 = DNoesUTWMOwjQObNrdMvDVq53571240; DNoesUTWMOwjQObNrdMvDVq53571240 = DNoesUTWMOwjQObNrdMvDVq56841727; DNoesUTWMOwjQObNrdMvDVq56841727 = DNoesUTWMOwjQObNrdMvDVq8783180; DNoesUTWMOwjQObNrdMvDVq8783180 = DNoesUTWMOwjQObNrdMvDVq34750086; DNoesUTWMOwjQObNrdMvDVq34750086 = DNoesUTWMOwjQObNrdMvDVq90153330; DNoesUTWMOwjQObNrdMvDVq90153330 = DNoesUTWMOwjQObNrdMvDVq54211155; DNoesUTWMOwjQObNrdMvDVq54211155 = DNoesUTWMOwjQObNrdMvDVq46393346; DNoesUTWMOwjQObNrdMvDVq46393346 = DNoesUTWMOwjQObNrdMvDVq6414037; DNoesUTWMOwjQObNrdMvDVq6414037 = DNoesUTWMOwjQObNrdMvDVq34327600; DNoesUTWMOwjQObNrdMvDVq34327600 = DNoesUTWMOwjQObNrdMvDVq16592119; DNoesUTWMOwjQObNrdMvDVq16592119 = DNoesUTWMOwjQObNrdMvDVq94060634; DNoesUTWMOwjQObNrdMvDVq94060634 = DNoesUTWMOwjQObNrdMvDVq79479808; DNoesUTWMOwjQObNrdMvDVq79479808 = DNoesUTWMOwjQObNrdMvDVq71478296; DNoesUTWMOwjQObNrdMvDVq71478296 = DNoesUTWMOwjQObNrdMvDVq12312667; DNoesUTWMOwjQObNrdMvDVq12312667 = DNoesUTWMOwjQObNrdMvDVq58836176; DNoesUTWMOwjQObNrdMvDVq58836176 = DNoesUTWMOwjQObNrdMvDVq34974712; DNoesUTWMOwjQObNrdMvDVq34974712 = DNoesUTWMOwjQObNrdMvDVq50477190; DNoesUTWMOwjQObNrdMvDVq50477190 = DNoesUTWMOwjQObNrdMvDVq73481213; DNoesUTWMOwjQObNrdMvDVq73481213 = DNoesUTWMOwjQObNrdMvDVq90072515; DNoesUTWMOwjQObNrdMvDVq90072515 = DNoesUTWMOwjQObNrdMvDVq78980239; DNoesUTWMOwjQObNrdMvDVq78980239 = DNoesUTWMOwjQObNrdMvDVq92541500; DNoesUTWMOwjQObNrdMvDVq92541500 = DNoesUTWMOwjQObNrdMvDVq50518657; DNoesUTWMOwjQObNrdMvDVq50518657 = DNoesUTWMOwjQObNrdMvDVq12164484; DNoesUTWMOwjQObNrdMvDVq12164484 = DNoesUTWMOwjQObNrdMvDVq3335988; DNoesUTWMOwjQObNrdMvDVq3335988 = DNoesUTWMOwjQObNrdMvDVq16700069; DNoesUTWMOwjQObNrdMvDVq16700069 = DNoesUTWMOwjQObNrdMvDVq59786290; DNoesUTWMOwjQObNrdMvDVq59786290 = DNoesUTWMOwjQObNrdMvDVq60790998; DNoesUTWMOwjQObNrdMvDVq60790998 = DNoesUTWMOwjQObNrdMvDVq64376683; DNoesUTWMOwjQObNrdMvDVq64376683 = DNoesUTWMOwjQObNrdMvDVq35653780; DNoesUTWMOwjQObNrdMvDVq35653780 = DNoesUTWMOwjQObNrdMvDVq1354754; DNoesUTWMOwjQObNrdMvDVq1354754 = DNoesUTWMOwjQObNrdMvDVq88819523; DNoesUTWMOwjQObNrdMvDVq88819523 = DNoesUTWMOwjQObNrdMvDVq55931775; DNoesUTWMOwjQObNrdMvDVq55931775 = DNoesUTWMOwjQObNrdMvDVq7820096; DNoesUTWMOwjQObNrdMvDVq7820096 = DNoesUTWMOwjQObNrdMvDVq7408158; DNoesUTWMOwjQObNrdMvDVq7408158 = DNoesUTWMOwjQObNrdMvDVq7797; DNoesUTWMOwjQObNrdMvDVq7797 = DNoesUTWMOwjQObNrdMvDVq93386228; DNoesUTWMOwjQObNrdMvDVq93386228 = DNoesUTWMOwjQObNrdMvDVq56332675; DNoesUTWMOwjQObNrdMvDVq56332675 = DNoesUTWMOwjQObNrdMvDVq89790736; DNoesUTWMOwjQObNrdMvDVq89790736 = DNoesUTWMOwjQObNrdMvDVq55681880; DNoesUTWMOwjQObNrdMvDVq55681880 = DNoesUTWMOwjQObNrdMvDVq80059174; DNoesUTWMOwjQObNrdMvDVq80059174 = DNoesUTWMOwjQObNrdMvDVq1187676; DNoesUTWMOwjQObNrdMvDVq1187676 = DNoesUTWMOwjQObNrdMvDVq99111430; DNoesUTWMOwjQObNrdMvDVq99111430 = DNoesUTWMOwjQObNrdMvDVq69951215; DNoesUTWMOwjQObNrdMvDVq69951215 = DNoesUTWMOwjQObNrdMvDVq22822340; DNoesUTWMOwjQObNrdMvDVq22822340 = DNoesUTWMOwjQObNrdMvDVq62791450; DNoesUTWMOwjQObNrdMvDVq62791450 = DNoesUTWMOwjQObNrdMvDVq2286430; DNoesUTWMOwjQObNrdMvDVq2286430 = DNoesUTWMOwjQObNrdMvDVq56848155; DNoesUTWMOwjQObNrdMvDVq56848155 = DNoesUTWMOwjQObNrdMvDVq12579677; DNoesUTWMOwjQObNrdMvDVq12579677 = DNoesUTWMOwjQObNrdMvDVq38471363; DNoesUTWMOwjQObNrdMvDVq38471363 = DNoesUTWMOwjQObNrdMvDVq55516980; DNoesUTWMOwjQObNrdMvDVq55516980 = DNoesUTWMOwjQObNrdMvDVq29684164; DNoesUTWMOwjQObNrdMvDVq29684164 = DNoesUTWMOwjQObNrdMvDVq1189684; DNoesUTWMOwjQObNrdMvDVq1189684 = DNoesUTWMOwjQObNrdMvDVq40694487; DNoesUTWMOwjQObNrdMvDVq40694487 = DNoesUTWMOwjQObNrdMvDVq15843707;}
void aDDrGkKCNrlDmolwEZyciwuNjv47938773() { float FflybfxdUfYQePDTZKBkglw67299944 = 4259004; float FflybfxdUfYQePDTZKBkglw15030516 = -507239219; float FflybfxdUfYQePDTZKBkglw37382162 = -688998510; float FflybfxdUfYQePDTZKBkglw57105065 = -513737378; float FflybfxdUfYQePDTZKBkglw44292863 = -56650848; float FflybfxdUfYQePDTZKBkglw77939941 = -636228022; float FflybfxdUfYQePDTZKBkglw16999730 = -207571324; float FflybfxdUfYQePDTZKBkglw89889404 = -562861271; float FflybfxdUfYQePDTZKBkglw34626261 = -632642074; float FflybfxdUfYQePDTZKBkglw74553611 = 91381748; float FflybfxdUfYQePDTZKBkglw26162446 = -948851779; float FflybfxdUfYQePDTZKBkglw9911267 = -687961932; float FflybfxdUfYQePDTZKBkglw52311685 = -138591805; float FflybfxdUfYQePDTZKBkglw98818938 = -377031204; float FflybfxdUfYQePDTZKBkglw62269405 = 58718147; float FflybfxdUfYQePDTZKBkglw86490478 = -440282050; float FflybfxdUfYQePDTZKBkglw48323305 = -242610426; float FflybfxdUfYQePDTZKBkglw40569841 = -133967394; float FflybfxdUfYQePDTZKBkglw66720852 = 29611180; float FflybfxdUfYQePDTZKBkglw96673594 = -327768560; float FflybfxdUfYQePDTZKBkglw60193701 = -987723934; float FflybfxdUfYQePDTZKBkglw95080807 = -395759298; float FflybfxdUfYQePDTZKBkglw99489777 = -691001133; float FflybfxdUfYQePDTZKBkglw12912891 = -517942833; float FflybfxdUfYQePDTZKBkglw13295281 = -444212848; float FflybfxdUfYQePDTZKBkglw69585451 = -337162550; float FflybfxdUfYQePDTZKBkglw20270472 = -488067615; float FflybfxdUfYQePDTZKBkglw45489605 = -534524604; float FflybfxdUfYQePDTZKBkglw4028880 = -957883606; float FflybfxdUfYQePDTZKBkglw74810919 = 82814240; float FflybfxdUfYQePDTZKBkglw19784910 = -970036849; float FflybfxdUfYQePDTZKBkglw85613198 = 98604435; float FflybfxdUfYQePDTZKBkglw75088516 = -674111731; float FflybfxdUfYQePDTZKBkglw5982976 = -780492515; float FflybfxdUfYQePDTZKBkglw13607348 = 54679829; float FflybfxdUfYQePDTZKBkglw63642019 = -629697401; float FflybfxdUfYQePDTZKBkglw75350899 = -136355282; float FflybfxdUfYQePDTZKBkglw72796891 = -357040831; float FflybfxdUfYQePDTZKBkglw86480653 = -764915991; float FflybfxdUfYQePDTZKBkglw60280779 = -635414404; float FflybfxdUfYQePDTZKBkglw34873030 = -762204402; float FflybfxdUfYQePDTZKBkglw71665151 = 96626919; float FflybfxdUfYQePDTZKBkglw27511509 = -488548379; float FflybfxdUfYQePDTZKBkglw12316137 = -790764812; float FflybfxdUfYQePDTZKBkglw66753456 = -595877899; float FflybfxdUfYQePDTZKBkglw26119023 = -782923979; float FflybfxdUfYQePDTZKBkglw91125144 = -201710283; float FflybfxdUfYQePDTZKBkglw13484453 = -204110625; float FflybfxdUfYQePDTZKBkglw42833079 = -829212486; float FflybfxdUfYQePDTZKBkglw96898592 = -430993542; float FflybfxdUfYQePDTZKBkglw8596595 = 39602391; float FflybfxdUfYQePDTZKBkglw26128158 = -922181711; float FflybfxdUfYQePDTZKBkglw46179958 = -184953334; float FflybfxdUfYQePDTZKBkglw95196739 = 60790342; float FflybfxdUfYQePDTZKBkglw87745072 = -724029769; float FflybfxdUfYQePDTZKBkglw72219136 = -599981699; float FflybfxdUfYQePDTZKBkglw15540739 = -816238086; float FflybfxdUfYQePDTZKBkglw24469271 = -71055677; float FflybfxdUfYQePDTZKBkglw43809785 = 30475470; float FflybfxdUfYQePDTZKBkglw74707411 = -719488299; float FflybfxdUfYQePDTZKBkglw57669469 = -48160407; float FflybfxdUfYQePDTZKBkglw71510124 = -673046721; float FflybfxdUfYQePDTZKBkglw85860524 = -604977666; float FflybfxdUfYQePDTZKBkglw59815341 = -615456314; float FflybfxdUfYQePDTZKBkglw54768701 = 61418597; float FflybfxdUfYQePDTZKBkglw40549247 = -947456214; float FflybfxdUfYQePDTZKBkglw34822750 = 86149799; float FflybfxdUfYQePDTZKBkglw46328710 = -358099291; float FflybfxdUfYQePDTZKBkglw85211590 = -331711033; float FflybfxdUfYQePDTZKBkglw98627385 = -311584453; float FflybfxdUfYQePDTZKBkglw11139579 = -203926769; float FflybfxdUfYQePDTZKBkglw75526414 = -885569595; float FflybfxdUfYQePDTZKBkglw54089187 = -369051403; float FflybfxdUfYQePDTZKBkglw6440074 = -334974417; float FflybfxdUfYQePDTZKBkglw61800564 = -565564158; float FflybfxdUfYQePDTZKBkglw88528549 = -984350854; float FflybfxdUfYQePDTZKBkglw67569298 = -907210919; float FflybfxdUfYQePDTZKBkglw87173641 = -900236321; float FflybfxdUfYQePDTZKBkglw46159435 = -922064935; float FflybfxdUfYQePDTZKBkglw87176257 = -661288870; float FflybfxdUfYQePDTZKBkglw78460307 = -35452267; float FflybfxdUfYQePDTZKBkglw6786019 = -183956991; float FflybfxdUfYQePDTZKBkglw2656527 = -705312118; float FflybfxdUfYQePDTZKBkglw7130288 = -426890064; float FflybfxdUfYQePDTZKBkglw66214325 = -956788152; float FflybfxdUfYQePDTZKBkglw93656752 = 52144862; float FflybfxdUfYQePDTZKBkglw39433241 = -716442232; float FflybfxdUfYQePDTZKBkglw79891777 = -634902073; float FflybfxdUfYQePDTZKBkglw18237904 = 43537254; float FflybfxdUfYQePDTZKBkglw41388211 = -345338472; float FflybfxdUfYQePDTZKBkglw48101281 = -813459316; float FflybfxdUfYQePDTZKBkglw50881629 = 34700395; float FflybfxdUfYQePDTZKBkglw28987107 = -287516302; float FflybfxdUfYQePDTZKBkglw11773242 = 54572307; float FflybfxdUfYQePDTZKBkglw2611310 = -487253997; float FflybfxdUfYQePDTZKBkglw63362906 = 10842318; float FflybfxdUfYQePDTZKBkglw85804627 = -298395415; float FflybfxdUfYQePDTZKBkglw67696168 = -873092065; float FflybfxdUfYQePDTZKBkglw57547435 = -752183409; float FflybfxdUfYQePDTZKBkglw26204209 = 4259004; FflybfxdUfYQePDTZKBkglw67299944 = FflybfxdUfYQePDTZKBkglw15030516; FflybfxdUfYQePDTZKBkglw15030516 = FflybfxdUfYQePDTZKBkglw37382162; FflybfxdUfYQePDTZKBkglw37382162 = FflybfxdUfYQePDTZKBkglw57105065; FflybfxdUfYQePDTZKBkglw57105065 = FflybfxdUfYQePDTZKBkglw44292863; FflybfxdUfYQePDTZKBkglw44292863 = FflybfxdUfYQePDTZKBkglw77939941; FflybfxdUfYQePDTZKBkglw77939941 = FflybfxdUfYQePDTZKBkglw16999730; FflybfxdUfYQePDTZKBkglw16999730 = FflybfxdUfYQePDTZKBkglw89889404; FflybfxdUfYQePDTZKBkglw89889404 = FflybfxdUfYQePDTZKBkglw34626261; FflybfxdUfYQePDTZKBkglw34626261 = FflybfxdUfYQePDTZKBkglw74553611; FflybfxdUfYQePDTZKBkglw74553611 = FflybfxdUfYQePDTZKBkglw26162446; FflybfxdUfYQePDTZKBkglw26162446 = FflybfxdUfYQePDTZKBkglw9911267; FflybfxdUfYQePDTZKBkglw9911267 = FflybfxdUfYQePDTZKBkglw52311685; FflybfxdUfYQePDTZKBkglw52311685 = FflybfxdUfYQePDTZKBkglw98818938; FflybfxdUfYQePDTZKBkglw98818938 = FflybfxdUfYQePDTZKBkglw62269405; FflybfxdUfYQePDTZKBkglw62269405 = FflybfxdUfYQePDTZKBkglw86490478; FflybfxdUfYQePDTZKBkglw86490478 = FflybfxdUfYQePDTZKBkglw48323305; FflybfxdUfYQePDTZKBkglw48323305 = FflybfxdUfYQePDTZKBkglw40569841; FflybfxdUfYQePDTZKBkglw40569841 = FflybfxdUfYQePDTZKBkglw66720852; FflybfxdUfYQePDTZKBkglw66720852 = FflybfxdUfYQePDTZKBkglw96673594; FflybfxdUfYQePDTZKBkglw96673594 = FflybfxdUfYQePDTZKBkglw60193701; FflybfxdUfYQePDTZKBkglw60193701 = FflybfxdUfYQePDTZKBkglw95080807; FflybfxdUfYQePDTZKBkglw95080807 = FflybfxdUfYQePDTZKBkglw99489777; FflybfxdUfYQePDTZKBkglw99489777 = FflybfxdUfYQePDTZKBkglw12912891; FflybfxdUfYQePDTZKBkglw12912891 = FflybfxdUfYQePDTZKBkglw13295281; FflybfxdUfYQePDTZKBkglw13295281 = FflybfxdUfYQePDTZKBkglw69585451; FflybfxdUfYQePDTZKBkglw69585451 = FflybfxdUfYQePDTZKBkglw20270472; FflybfxdUfYQePDTZKBkglw20270472 = FflybfxdUfYQePDTZKBkglw45489605; FflybfxdUfYQePDTZKBkglw45489605 = FflybfxdUfYQePDTZKBkglw4028880; FflybfxdUfYQePDTZKBkglw4028880 = FflybfxdUfYQePDTZKBkglw74810919; FflybfxdUfYQePDTZKBkglw74810919 = FflybfxdUfYQePDTZKBkglw19784910; FflybfxdUfYQePDTZKBkglw19784910 = FflybfxdUfYQePDTZKBkglw85613198; FflybfxdUfYQePDTZKBkglw85613198 = FflybfxdUfYQePDTZKBkglw75088516; FflybfxdUfYQePDTZKBkglw75088516 = FflybfxdUfYQePDTZKBkglw5982976; FflybfxdUfYQePDTZKBkglw5982976 = FflybfxdUfYQePDTZKBkglw13607348; FflybfxdUfYQePDTZKBkglw13607348 = FflybfxdUfYQePDTZKBkglw63642019; FflybfxdUfYQePDTZKBkglw63642019 = FflybfxdUfYQePDTZKBkglw75350899; FflybfxdUfYQePDTZKBkglw75350899 = FflybfxdUfYQePDTZKBkglw72796891; FflybfxdUfYQePDTZKBkglw72796891 = FflybfxdUfYQePDTZKBkglw86480653; FflybfxdUfYQePDTZKBkglw86480653 = FflybfxdUfYQePDTZKBkglw60280779; FflybfxdUfYQePDTZKBkglw60280779 = FflybfxdUfYQePDTZKBkglw34873030; FflybfxdUfYQePDTZKBkglw34873030 = FflybfxdUfYQePDTZKBkglw71665151; FflybfxdUfYQePDTZKBkglw71665151 = FflybfxdUfYQePDTZKBkglw27511509; FflybfxdUfYQePDTZKBkglw27511509 = FflybfxdUfYQePDTZKBkglw12316137; FflybfxdUfYQePDTZKBkglw12316137 = FflybfxdUfYQePDTZKBkglw66753456; FflybfxdUfYQePDTZKBkglw66753456 = FflybfxdUfYQePDTZKBkglw26119023; FflybfxdUfYQePDTZKBkglw26119023 = FflybfxdUfYQePDTZKBkglw91125144; FflybfxdUfYQePDTZKBkglw91125144 = FflybfxdUfYQePDTZKBkglw13484453; FflybfxdUfYQePDTZKBkglw13484453 = FflybfxdUfYQePDTZKBkglw42833079; FflybfxdUfYQePDTZKBkglw42833079 = FflybfxdUfYQePDTZKBkglw96898592; FflybfxdUfYQePDTZKBkglw96898592 = FflybfxdUfYQePDTZKBkglw8596595; FflybfxdUfYQePDTZKBkglw8596595 = FflybfxdUfYQePDTZKBkglw26128158; FflybfxdUfYQePDTZKBkglw26128158 = FflybfxdUfYQePDTZKBkglw46179958; FflybfxdUfYQePDTZKBkglw46179958 = FflybfxdUfYQePDTZKBkglw95196739; FflybfxdUfYQePDTZKBkglw95196739 = FflybfxdUfYQePDTZKBkglw87745072; FflybfxdUfYQePDTZKBkglw87745072 = FflybfxdUfYQePDTZKBkglw72219136; FflybfxdUfYQePDTZKBkglw72219136 = FflybfxdUfYQePDTZKBkglw15540739; FflybfxdUfYQePDTZKBkglw15540739 = FflybfxdUfYQePDTZKBkglw24469271; FflybfxdUfYQePDTZKBkglw24469271 = FflybfxdUfYQePDTZKBkglw43809785; FflybfxdUfYQePDTZKBkglw43809785 = FflybfxdUfYQePDTZKBkglw74707411; FflybfxdUfYQePDTZKBkglw74707411 = FflybfxdUfYQePDTZKBkglw57669469; FflybfxdUfYQePDTZKBkglw57669469 = FflybfxdUfYQePDTZKBkglw71510124; FflybfxdUfYQePDTZKBkglw71510124 = FflybfxdUfYQePDTZKBkglw85860524; FflybfxdUfYQePDTZKBkglw85860524 = FflybfxdUfYQePDTZKBkglw59815341; FflybfxdUfYQePDTZKBkglw59815341 = FflybfxdUfYQePDTZKBkglw54768701; FflybfxdUfYQePDTZKBkglw54768701 = FflybfxdUfYQePDTZKBkglw40549247; FflybfxdUfYQePDTZKBkglw40549247 = FflybfxdUfYQePDTZKBkglw34822750; FflybfxdUfYQePDTZKBkglw34822750 = FflybfxdUfYQePDTZKBkglw46328710; FflybfxdUfYQePDTZKBkglw46328710 = FflybfxdUfYQePDTZKBkglw85211590; FflybfxdUfYQePDTZKBkglw85211590 = FflybfxdUfYQePDTZKBkglw98627385; FflybfxdUfYQePDTZKBkglw98627385 = FflybfxdUfYQePDTZKBkglw11139579; FflybfxdUfYQePDTZKBkglw11139579 = FflybfxdUfYQePDTZKBkglw75526414; FflybfxdUfYQePDTZKBkglw75526414 = FflybfxdUfYQePDTZKBkglw54089187; FflybfxdUfYQePDTZKBkglw54089187 = FflybfxdUfYQePDTZKBkglw6440074; FflybfxdUfYQePDTZKBkglw6440074 = FflybfxdUfYQePDTZKBkglw61800564; FflybfxdUfYQePDTZKBkglw61800564 = FflybfxdUfYQePDTZKBkglw88528549; FflybfxdUfYQePDTZKBkglw88528549 = FflybfxdUfYQePDTZKBkglw67569298; FflybfxdUfYQePDTZKBkglw67569298 = FflybfxdUfYQePDTZKBkglw87173641; FflybfxdUfYQePDTZKBkglw87173641 = FflybfxdUfYQePDTZKBkglw46159435; FflybfxdUfYQePDTZKBkglw46159435 = FflybfxdUfYQePDTZKBkglw87176257; FflybfxdUfYQePDTZKBkglw87176257 = FflybfxdUfYQePDTZKBkglw78460307; FflybfxdUfYQePDTZKBkglw78460307 = FflybfxdUfYQePDTZKBkglw6786019; FflybfxdUfYQePDTZKBkglw6786019 = FflybfxdUfYQePDTZKBkglw2656527; FflybfxdUfYQePDTZKBkglw2656527 = FflybfxdUfYQePDTZKBkglw7130288; FflybfxdUfYQePDTZKBkglw7130288 = FflybfxdUfYQePDTZKBkglw66214325; FflybfxdUfYQePDTZKBkglw66214325 = FflybfxdUfYQePDTZKBkglw93656752; FflybfxdUfYQePDTZKBkglw93656752 = FflybfxdUfYQePDTZKBkglw39433241; FflybfxdUfYQePDTZKBkglw39433241 = FflybfxdUfYQePDTZKBkglw79891777; FflybfxdUfYQePDTZKBkglw79891777 = FflybfxdUfYQePDTZKBkglw18237904; FflybfxdUfYQePDTZKBkglw18237904 = FflybfxdUfYQePDTZKBkglw41388211; FflybfxdUfYQePDTZKBkglw41388211 = FflybfxdUfYQePDTZKBkglw48101281; FflybfxdUfYQePDTZKBkglw48101281 = FflybfxdUfYQePDTZKBkglw50881629; FflybfxdUfYQePDTZKBkglw50881629 = FflybfxdUfYQePDTZKBkglw28987107; FflybfxdUfYQePDTZKBkglw28987107 = FflybfxdUfYQePDTZKBkglw11773242; FflybfxdUfYQePDTZKBkglw11773242 = FflybfxdUfYQePDTZKBkglw2611310; FflybfxdUfYQePDTZKBkglw2611310 = FflybfxdUfYQePDTZKBkglw63362906; FflybfxdUfYQePDTZKBkglw63362906 = FflybfxdUfYQePDTZKBkglw85804627; FflybfxdUfYQePDTZKBkglw85804627 = FflybfxdUfYQePDTZKBkglw67696168; FflybfxdUfYQePDTZKBkglw67696168 = FflybfxdUfYQePDTZKBkglw57547435; FflybfxdUfYQePDTZKBkglw57547435 = FflybfxdUfYQePDTZKBkglw26204209; FflybfxdUfYQePDTZKBkglw26204209 = FflybfxdUfYQePDTZKBkglw67299944;}
void vWHouKaCZIgIZjvGTGSxyDjCXr33001611() { float qtKNonssEeEPhmAcdRbFUtc51023462 = -345763064; float qtKNonssEeEPhmAcdRbFUtc12628611 = -310891070; float qtKNonssEeEPhmAcdRbFUtc25968279 = -557306201; float qtKNonssEeEPhmAcdRbFUtc54253018 = -518619306; float qtKNonssEeEPhmAcdRbFUtc23854200 = -454599040; float qtKNonssEeEPhmAcdRbFUtc89279458 = -739548691; float qtKNonssEeEPhmAcdRbFUtc53880292 = -229085462; float qtKNonssEeEPhmAcdRbFUtc33229487 = -83315857; float qtKNonssEeEPhmAcdRbFUtc84845789 = -230124770; float qtKNonssEeEPhmAcdRbFUtc20659200 = -131659267; float qtKNonssEeEPhmAcdRbFUtc69051481 = -789137037; float qtKNonssEeEPhmAcdRbFUtc123038 = -617101203; float qtKNonssEeEPhmAcdRbFUtc3365538 = 18575952; float qtKNonssEeEPhmAcdRbFUtc93192082 = -726714066; float qtKNonssEeEPhmAcdRbFUtc66448663 = -966979159; float qtKNonssEeEPhmAcdRbFUtc58304507 = -364409702; float qtKNonssEeEPhmAcdRbFUtc48188716 = -401490289; float qtKNonssEeEPhmAcdRbFUtc54647110 = -844818968; float qtKNonssEeEPhmAcdRbFUtc7697333 = -859038059; float qtKNonssEeEPhmAcdRbFUtc70781239 = 55938523; float qtKNonssEeEPhmAcdRbFUtc27533211 = -562190454; float qtKNonssEeEPhmAcdRbFUtc96082878 = -308914584; float qtKNonssEeEPhmAcdRbFUtc68665642 = -720395870; float qtKNonssEeEPhmAcdRbFUtc14055586 = -57175486; float qtKNonssEeEPhmAcdRbFUtc49897374 = -522543610; float qtKNonssEeEPhmAcdRbFUtc22578210 = -780129577; float qtKNonssEeEPhmAcdRbFUtc41862411 = -931943039; float qtKNonssEeEPhmAcdRbFUtc88088805 = -320966092; float qtKNonssEeEPhmAcdRbFUtc75947021 = -382079506; float qtKNonssEeEPhmAcdRbFUtc10359247 = -589792135; float qtKNonssEeEPhmAcdRbFUtc1149333 = -89134870; float qtKNonssEeEPhmAcdRbFUtc10406487 = -450592788; float qtKNonssEeEPhmAcdRbFUtc89213217 = -239325823; float qtKNonssEeEPhmAcdRbFUtc41707690 = -84589162; float qtKNonssEeEPhmAcdRbFUtc81210673 = -779610779; float qtKNonssEeEPhmAcdRbFUtc33503253 = -608093879; float qtKNonssEeEPhmAcdRbFUtc75114489 = -456696578; float qtKNonssEeEPhmAcdRbFUtc23178683 = -256184048; float qtKNonssEeEPhmAcdRbFUtc47096373 = 29525127; float qtKNonssEeEPhmAcdRbFUtc99469894 = -582061283; float qtKNonssEeEPhmAcdRbFUtc99640550 = -412244529; float qtKNonssEeEPhmAcdRbFUtc1004878 = -609398750; float qtKNonssEeEPhmAcdRbFUtc60311655 = -140952633; float qtKNonssEeEPhmAcdRbFUtc59511656 = -369708545; float qtKNonssEeEPhmAcdRbFUtc94740706 = -921891977; float qtKNonssEeEPhmAcdRbFUtc70385904 = -397955671; float qtKNonssEeEPhmAcdRbFUtc24304114 = -223356190; float qtKNonssEeEPhmAcdRbFUtc52226300 = 33767477; float qtKNonssEeEPhmAcdRbFUtc76707292 = -528996637; float qtKNonssEeEPhmAcdRbFUtc32771923 = 36991023; float qtKNonssEeEPhmAcdRbFUtc48687426 = -126170010; float qtKNonssEeEPhmAcdRbFUtc77633877 = -674234498; float qtKNonssEeEPhmAcdRbFUtc91562360 = -196885700; float qtKNonssEeEPhmAcdRbFUtc41129345 = -515918846; float qtKNonssEeEPhmAcdRbFUtc5468400 = 59243286; float qtKNonssEeEPhmAcdRbFUtc54940584 = 63151520; float qtKNonssEeEPhmAcdRbFUtc43962969 = -590495200; float qtKNonssEeEPhmAcdRbFUtc11912693 = -400130715; float qtKNonssEeEPhmAcdRbFUtc4355645 = -996075697; float qtKNonssEeEPhmAcdRbFUtc1275991 = -674469463; float qtKNonssEeEPhmAcdRbFUtc47417047 = -807605653; float qtKNonssEeEPhmAcdRbFUtc65791487 = -908119370; float qtKNonssEeEPhmAcdRbFUtc57282466 = -701236352; float qtKNonssEeEPhmAcdRbFUtc74486542 = -640332636; float qtKNonssEeEPhmAcdRbFUtc19509867 = 57475602; float qtKNonssEeEPhmAcdRbFUtc58644994 = -238544249; float qtKNonssEeEPhmAcdRbFUtc10909820 = -277775381; float qtKNonssEeEPhmAcdRbFUtc61657847 = -896834886; float qtKNonssEeEPhmAcdRbFUtc11981410 = -947103288; float qtKNonssEeEPhmAcdRbFUtc32945411 = -258885280; float qtKNonssEeEPhmAcdRbFUtc83190017 = -907713124; float qtKNonssEeEPhmAcdRbFUtc25010034 = -45306241; float qtKNonssEeEPhmAcdRbFUtc7550738 = -774344096; float qtKNonssEeEPhmAcdRbFUtc8227438 = -176976776; float qtKNonssEeEPhmAcdRbFUtc71140688 = -531816948; float qtKNonssEeEPhmAcdRbFUtc26528334 = -952791705; float qtKNonssEeEPhmAcdRbFUtc35771223 = -67961951; float qtKNonssEeEPhmAcdRbFUtc9153987 = -250687326; float qtKNonssEeEPhmAcdRbFUtc19314879 = -135283510; float qtKNonssEeEPhmAcdRbFUtc79511469 = -24587939; float qtKNonssEeEPhmAcdRbFUtc98274095 = -456773388; float qtKNonssEeEPhmAcdRbFUtc89636111 = -865710516; float qtKNonssEeEPhmAcdRbFUtc11381514 = -791969455; float qtKNonssEeEPhmAcdRbFUtc43175099 = -319070529; float qtKNonssEeEPhmAcdRbFUtc61671820 = -363622125; float qtKNonssEeEPhmAcdRbFUtc23515456 = -414900373; float qtKNonssEeEPhmAcdRbFUtc18844127 = -153707089; float qtKNonssEeEPhmAcdRbFUtc48083873 = -723406977; float qtKNonssEeEPhmAcdRbFUtc36239290 = -43832448; float qtKNonssEeEPhmAcdRbFUtc26270090 = -742762299; float qtKNonssEeEPhmAcdRbFUtc89540284 = 82401321; float qtKNonssEeEPhmAcdRbFUtc63201797 = 43434136; float qtKNonssEeEPhmAcdRbFUtc18823038 = -260108351; float qtKNonssEeEPhmAcdRbFUtc45820382 = -296005410; float qtKNonssEeEPhmAcdRbFUtc52052847 = -774455631; float qtKNonssEeEPhmAcdRbFUtc33849064 = -504125159; float qtKNonssEeEPhmAcdRbFUtc43722412 = -908162399; float qtKNonssEeEPhmAcdRbFUtc85825113 = -500619998; float qtKNonssEeEPhmAcdRbFUtc40001789 = -327184147; float qtKNonssEeEPhmAcdRbFUtc36095712 = -345763064; qtKNonssEeEPhmAcdRbFUtc51023462 = qtKNonssEeEPhmAcdRbFUtc12628611; qtKNonssEeEPhmAcdRbFUtc12628611 = qtKNonssEeEPhmAcdRbFUtc25968279; qtKNonssEeEPhmAcdRbFUtc25968279 = qtKNonssEeEPhmAcdRbFUtc54253018; qtKNonssEeEPhmAcdRbFUtc54253018 = qtKNonssEeEPhmAcdRbFUtc23854200; qtKNonssEeEPhmAcdRbFUtc23854200 = qtKNonssEeEPhmAcdRbFUtc89279458; qtKNonssEeEPhmAcdRbFUtc89279458 = qtKNonssEeEPhmAcdRbFUtc53880292; qtKNonssEeEPhmAcdRbFUtc53880292 = qtKNonssEeEPhmAcdRbFUtc33229487; qtKNonssEeEPhmAcdRbFUtc33229487 = qtKNonssEeEPhmAcdRbFUtc84845789; qtKNonssEeEPhmAcdRbFUtc84845789 = qtKNonssEeEPhmAcdRbFUtc20659200; qtKNonssEeEPhmAcdRbFUtc20659200 = qtKNonssEeEPhmAcdRbFUtc69051481; qtKNonssEeEPhmAcdRbFUtc69051481 = qtKNonssEeEPhmAcdRbFUtc123038; qtKNonssEeEPhmAcdRbFUtc123038 = qtKNonssEeEPhmAcdRbFUtc3365538; qtKNonssEeEPhmAcdRbFUtc3365538 = qtKNonssEeEPhmAcdRbFUtc93192082; qtKNonssEeEPhmAcdRbFUtc93192082 = qtKNonssEeEPhmAcdRbFUtc66448663; qtKNonssEeEPhmAcdRbFUtc66448663 = qtKNonssEeEPhmAcdRbFUtc58304507; qtKNonssEeEPhmAcdRbFUtc58304507 = qtKNonssEeEPhmAcdRbFUtc48188716; qtKNonssEeEPhmAcdRbFUtc48188716 = qtKNonssEeEPhmAcdRbFUtc54647110; qtKNonssEeEPhmAcdRbFUtc54647110 = qtKNonssEeEPhmAcdRbFUtc7697333; qtKNonssEeEPhmAcdRbFUtc7697333 = qtKNonssEeEPhmAcdRbFUtc70781239; qtKNonssEeEPhmAcdRbFUtc70781239 = qtKNonssEeEPhmAcdRbFUtc27533211; qtKNonssEeEPhmAcdRbFUtc27533211 = qtKNonssEeEPhmAcdRbFUtc96082878; qtKNonssEeEPhmAcdRbFUtc96082878 = qtKNonssEeEPhmAcdRbFUtc68665642; qtKNonssEeEPhmAcdRbFUtc68665642 = qtKNonssEeEPhmAcdRbFUtc14055586; qtKNonssEeEPhmAcdRbFUtc14055586 = qtKNonssEeEPhmAcdRbFUtc49897374; qtKNonssEeEPhmAcdRbFUtc49897374 = qtKNonssEeEPhmAcdRbFUtc22578210; qtKNonssEeEPhmAcdRbFUtc22578210 = qtKNonssEeEPhmAcdRbFUtc41862411; qtKNonssEeEPhmAcdRbFUtc41862411 = qtKNonssEeEPhmAcdRbFUtc88088805; qtKNonssEeEPhmAcdRbFUtc88088805 = qtKNonssEeEPhmAcdRbFUtc75947021; qtKNonssEeEPhmAcdRbFUtc75947021 = qtKNonssEeEPhmAcdRbFUtc10359247; qtKNonssEeEPhmAcdRbFUtc10359247 = qtKNonssEeEPhmAcdRbFUtc1149333; qtKNonssEeEPhmAcdRbFUtc1149333 = qtKNonssEeEPhmAcdRbFUtc10406487; qtKNonssEeEPhmAcdRbFUtc10406487 = qtKNonssEeEPhmAcdRbFUtc89213217; qtKNonssEeEPhmAcdRbFUtc89213217 = qtKNonssEeEPhmAcdRbFUtc41707690; qtKNonssEeEPhmAcdRbFUtc41707690 = qtKNonssEeEPhmAcdRbFUtc81210673; qtKNonssEeEPhmAcdRbFUtc81210673 = qtKNonssEeEPhmAcdRbFUtc33503253; qtKNonssEeEPhmAcdRbFUtc33503253 = qtKNonssEeEPhmAcdRbFUtc75114489; qtKNonssEeEPhmAcdRbFUtc75114489 = qtKNonssEeEPhmAcdRbFUtc23178683; qtKNonssEeEPhmAcdRbFUtc23178683 = qtKNonssEeEPhmAcdRbFUtc47096373; qtKNonssEeEPhmAcdRbFUtc47096373 = qtKNonssEeEPhmAcdRbFUtc99469894; qtKNonssEeEPhmAcdRbFUtc99469894 = qtKNonssEeEPhmAcdRbFUtc99640550; qtKNonssEeEPhmAcdRbFUtc99640550 = qtKNonssEeEPhmAcdRbFUtc1004878; qtKNonssEeEPhmAcdRbFUtc1004878 = qtKNonssEeEPhmAcdRbFUtc60311655; qtKNonssEeEPhmAcdRbFUtc60311655 = qtKNonssEeEPhmAcdRbFUtc59511656; qtKNonssEeEPhmAcdRbFUtc59511656 = qtKNonssEeEPhmAcdRbFUtc94740706; qtKNonssEeEPhmAcdRbFUtc94740706 = qtKNonssEeEPhmAcdRbFUtc70385904; qtKNonssEeEPhmAcdRbFUtc70385904 = qtKNonssEeEPhmAcdRbFUtc24304114; qtKNonssEeEPhmAcdRbFUtc24304114 = qtKNonssEeEPhmAcdRbFUtc52226300; qtKNonssEeEPhmAcdRbFUtc52226300 = qtKNonssEeEPhmAcdRbFUtc76707292; qtKNonssEeEPhmAcdRbFUtc76707292 = qtKNonssEeEPhmAcdRbFUtc32771923; qtKNonssEeEPhmAcdRbFUtc32771923 = qtKNonssEeEPhmAcdRbFUtc48687426; qtKNonssEeEPhmAcdRbFUtc48687426 = qtKNonssEeEPhmAcdRbFUtc77633877; qtKNonssEeEPhmAcdRbFUtc77633877 = qtKNonssEeEPhmAcdRbFUtc91562360; qtKNonssEeEPhmAcdRbFUtc91562360 = qtKNonssEeEPhmAcdRbFUtc41129345; qtKNonssEeEPhmAcdRbFUtc41129345 = qtKNonssEeEPhmAcdRbFUtc5468400; qtKNonssEeEPhmAcdRbFUtc5468400 = qtKNonssEeEPhmAcdRbFUtc54940584; qtKNonssEeEPhmAcdRbFUtc54940584 = qtKNonssEeEPhmAcdRbFUtc43962969; qtKNonssEeEPhmAcdRbFUtc43962969 = qtKNonssEeEPhmAcdRbFUtc11912693; qtKNonssEeEPhmAcdRbFUtc11912693 = qtKNonssEeEPhmAcdRbFUtc4355645; qtKNonssEeEPhmAcdRbFUtc4355645 = qtKNonssEeEPhmAcdRbFUtc1275991; qtKNonssEeEPhmAcdRbFUtc1275991 = qtKNonssEeEPhmAcdRbFUtc47417047; qtKNonssEeEPhmAcdRbFUtc47417047 = qtKNonssEeEPhmAcdRbFUtc65791487; qtKNonssEeEPhmAcdRbFUtc65791487 = qtKNonssEeEPhmAcdRbFUtc57282466; qtKNonssEeEPhmAcdRbFUtc57282466 = qtKNonssEeEPhmAcdRbFUtc74486542; qtKNonssEeEPhmAcdRbFUtc74486542 = qtKNonssEeEPhmAcdRbFUtc19509867; qtKNonssEeEPhmAcdRbFUtc19509867 = qtKNonssEeEPhmAcdRbFUtc58644994; qtKNonssEeEPhmAcdRbFUtc58644994 = qtKNonssEeEPhmAcdRbFUtc10909820; qtKNonssEeEPhmAcdRbFUtc10909820 = qtKNonssEeEPhmAcdRbFUtc61657847; qtKNonssEeEPhmAcdRbFUtc61657847 = qtKNonssEeEPhmAcdRbFUtc11981410; qtKNonssEeEPhmAcdRbFUtc11981410 = qtKNonssEeEPhmAcdRbFUtc32945411; qtKNonssEeEPhmAcdRbFUtc32945411 = qtKNonssEeEPhmAcdRbFUtc83190017; qtKNonssEeEPhmAcdRbFUtc83190017 = qtKNonssEeEPhmAcdRbFUtc25010034; qtKNonssEeEPhmAcdRbFUtc25010034 = qtKNonssEeEPhmAcdRbFUtc7550738; qtKNonssEeEPhmAcdRbFUtc7550738 = qtKNonssEeEPhmAcdRbFUtc8227438; qtKNonssEeEPhmAcdRbFUtc8227438 = qtKNonssEeEPhmAcdRbFUtc71140688; qtKNonssEeEPhmAcdRbFUtc71140688 = qtKNonssEeEPhmAcdRbFUtc26528334; qtKNonssEeEPhmAcdRbFUtc26528334 = qtKNonssEeEPhmAcdRbFUtc35771223; qtKNonssEeEPhmAcdRbFUtc35771223 = qtKNonssEeEPhmAcdRbFUtc9153987; qtKNonssEeEPhmAcdRbFUtc9153987 = qtKNonssEeEPhmAcdRbFUtc19314879; qtKNonssEeEPhmAcdRbFUtc19314879 = qtKNonssEeEPhmAcdRbFUtc79511469; qtKNonssEeEPhmAcdRbFUtc79511469 = qtKNonssEeEPhmAcdRbFUtc98274095; qtKNonssEeEPhmAcdRbFUtc98274095 = qtKNonssEeEPhmAcdRbFUtc89636111; qtKNonssEeEPhmAcdRbFUtc89636111 = qtKNonssEeEPhmAcdRbFUtc11381514; qtKNonssEeEPhmAcdRbFUtc11381514 = qtKNonssEeEPhmAcdRbFUtc43175099; qtKNonssEeEPhmAcdRbFUtc43175099 = qtKNonssEeEPhmAcdRbFUtc61671820; qtKNonssEeEPhmAcdRbFUtc61671820 = qtKNonssEeEPhmAcdRbFUtc23515456; qtKNonssEeEPhmAcdRbFUtc23515456 = qtKNonssEeEPhmAcdRbFUtc18844127; qtKNonssEeEPhmAcdRbFUtc18844127 = qtKNonssEeEPhmAcdRbFUtc48083873; qtKNonssEeEPhmAcdRbFUtc48083873 = qtKNonssEeEPhmAcdRbFUtc36239290; qtKNonssEeEPhmAcdRbFUtc36239290 = qtKNonssEeEPhmAcdRbFUtc26270090; qtKNonssEeEPhmAcdRbFUtc26270090 = qtKNonssEeEPhmAcdRbFUtc89540284; qtKNonssEeEPhmAcdRbFUtc89540284 = qtKNonssEeEPhmAcdRbFUtc63201797; qtKNonssEeEPhmAcdRbFUtc63201797 = qtKNonssEeEPhmAcdRbFUtc18823038; qtKNonssEeEPhmAcdRbFUtc18823038 = qtKNonssEeEPhmAcdRbFUtc45820382; qtKNonssEeEPhmAcdRbFUtc45820382 = qtKNonssEeEPhmAcdRbFUtc52052847; qtKNonssEeEPhmAcdRbFUtc52052847 = qtKNonssEeEPhmAcdRbFUtc33849064; qtKNonssEeEPhmAcdRbFUtc33849064 = qtKNonssEeEPhmAcdRbFUtc43722412; qtKNonssEeEPhmAcdRbFUtc43722412 = qtKNonssEeEPhmAcdRbFUtc85825113; qtKNonssEeEPhmAcdRbFUtc85825113 = qtKNonssEeEPhmAcdRbFUtc40001789; qtKNonssEeEPhmAcdRbFUtc40001789 = qtKNonssEeEPhmAcdRbFUtc36095712; qtKNonssEeEPhmAcdRbFUtc36095712 = qtKNonssEeEPhmAcdRbFUtc51023462;}
void JrpvlFwRggFBLXIzSEaHxyMIIl18064449() { float CzJIiYFbXTMiKkOZPFkubRs34746981 = -695785131; float CzJIiYFbXTMiKkOZPFkubRs10226707 = -114542921; float CzJIiYFbXTMiKkOZPFkubRs14554396 = -425613891; float CzJIiYFbXTMiKkOZPFkubRs51400972 = -523501235; float CzJIiYFbXTMiKkOZPFkubRs3415537 = -852547231; float CzJIiYFbXTMiKkOZPFkubRs618977 = -842869360; float CzJIiYFbXTMiKkOZPFkubRs90760855 = -250599600; float CzJIiYFbXTMiKkOZPFkubRs76569570 = -703770443; float CzJIiYFbXTMiKkOZPFkubRs35065318 = -927607467; float CzJIiYFbXTMiKkOZPFkubRs66764788 = -354700283; float CzJIiYFbXTMiKkOZPFkubRs11940518 = -629422294; float CzJIiYFbXTMiKkOZPFkubRs90334807 = -546240474; float CzJIiYFbXTMiKkOZPFkubRs54419389 = -924256292; float CzJIiYFbXTMiKkOZPFkubRs87565227 = 23603072; float CzJIiYFbXTMiKkOZPFkubRs70627922 = -892676464; float CzJIiYFbXTMiKkOZPFkubRs30118535 = -288537353; float CzJIiYFbXTMiKkOZPFkubRs48054127 = -560370152; float CzJIiYFbXTMiKkOZPFkubRs68724380 = -455670542; float CzJIiYFbXTMiKkOZPFkubRs48673813 = -647687297; float CzJIiYFbXTMiKkOZPFkubRs44888883 = -660354394; float CzJIiYFbXTMiKkOZPFkubRs94872721 = -136656975; float CzJIiYFbXTMiKkOZPFkubRs97084949 = -222069870; float CzJIiYFbXTMiKkOZPFkubRs37841508 = -749790607; float CzJIiYFbXTMiKkOZPFkubRs15198281 = -696408140; float CzJIiYFbXTMiKkOZPFkubRs86499466 = -600874371; float CzJIiYFbXTMiKkOZPFkubRs75570967 = -123096605; float CzJIiYFbXTMiKkOZPFkubRs63454350 = -275818462; float CzJIiYFbXTMiKkOZPFkubRs30688006 = -107407581; float CzJIiYFbXTMiKkOZPFkubRs47865163 = -906275406; float CzJIiYFbXTMiKkOZPFkubRs45907574 = -162398510; float CzJIiYFbXTMiKkOZPFkubRs82513756 = -308232890; float CzJIiYFbXTMiKkOZPFkubRs35199775 = -999790010; float CzJIiYFbXTMiKkOZPFkubRs3337919 = -904539914; float CzJIiYFbXTMiKkOZPFkubRs77432404 = -488685810; float CzJIiYFbXTMiKkOZPFkubRs48813999 = -513901386; float CzJIiYFbXTMiKkOZPFkubRs3364487 = -586490356; float CzJIiYFbXTMiKkOZPFkubRs74878080 = -777037875; float CzJIiYFbXTMiKkOZPFkubRs73560473 = -155327265; float CzJIiYFbXTMiKkOZPFkubRs7712092 = -276033754; float CzJIiYFbXTMiKkOZPFkubRs38659011 = -528708163; float CzJIiYFbXTMiKkOZPFkubRs64408071 = -62284655; float CzJIiYFbXTMiKkOZPFkubRs30344605 = -215424419; float CzJIiYFbXTMiKkOZPFkubRs93111801 = -893356887; float CzJIiYFbXTMiKkOZPFkubRs6707176 = 51347723; float CzJIiYFbXTMiKkOZPFkubRs22727958 = -147906055; float CzJIiYFbXTMiKkOZPFkubRs14652786 = -12987363; float CzJIiYFbXTMiKkOZPFkubRs57483083 = -245002097; float CzJIiYFbXTMiKkOZPFkubRs90968147 = -828354421; float CzJIiYFbXTMiKkOZPFkubRs10581506 = -228780789; float CzJIiYFbXTMiKkOZPFkubRs68645252 = -595024413; float CzJIiYFbXTMiKkOZPFkubRs88778257 = -291942412; float CzJIiYFbXTMiKkOZPFkubRs29139597 = -426287284; float CzJIiYFbXTMiKkOZPFkubRs36944763 = -208818066; float CzJIiYFbXTMiKkOZPFkubRs87061951 = 7371966; float CzJIiYFbXTMiKkOZPFkubRs23191728 = -257483659; float CzJIiYFbXTMiKkOZPFkubRs37662031 = -373715261; float CzJIiYFbXTMiKkOZPFkubRs72385199 = -364752315; float CzJIiYFbXTMiKkOZPFkubRs99356115 = -729205752; float CzJIiYFbXTMiKkOZPFkubRs64901505 = -922626864; float CzJIiYFbXTMiKkOZPFkubRs27844569 = -629450627; float CzJIiYFbXTMiKkOZPFkubRs37164626 = -467050899; float CzJIiYFbXTMiKkOZPFkubRs60072850 = -43192020; float CzJIiYFbXTMiKkOZPFkubRs28704407 = -797495037; float CzJIiYFbXTMiKkOZPFkubRs89157743 = -665208958; float CzJIiYFbXTMiKkOZPFkubRs84251032 = 53532607; float CzJIiYFbXTMiKkOZPFkubRs76740742 = -629632284; float CzJIiYFbXTMiKkOZPFkubRs86996888 = -641700561; float CzJIiYFbXTMiKkOZPFkubRs76986985 = -335570482; float CzJIiYFbXTMiKkOZPFkubRs38751229 = -462495543; float CzJIiYFbXTMiKkOZPFkubRs67263436 = -206186108; float CzJIiYFbXTMiKkOZPFkubRs55240455 = -511499479; float CzJIiYFbXTMiKkOZPFkubRs74493653 = -305042887; float CzJIiYFbXTMiKkOZPFkubRs61012288 = -79636788; float CzJIiYFbXTMiKkOZPFkubRs10014803 = -18979135; float CzJIiYFbXTMiKkOZPFkubRs80480811 = -498069739; float CzJIiYFbXTMiKkOZPFkubRs64528117 = -921232556; float CzJIiYFbXTMiKkOZPFkubRs3973149 = -328712983; float CzJIiYFbXTMiKkOZPFkubRs31134333 = -701138330; float CzJIiYFbXTMiKkOZPFkubRs92470323 = -448502085; float CzJIiYFbXTMiKkOZPFkubRs71846680 = -487887009; float CzJIiYFbXTMiKkOZPFkubRs18087884 = -878094509; float CzJIiYFbXTMiKkOZPFkubRs72486203 = -447464041; float CzJIiYFbXTMiKkOZPFkubRs20106500 = -878626793; float CzJIiYFbXTMiKkOZPFkubRs79219910 = -211250994; float CzJIiYFbXTMiKkOZPFkubRs57129316 = -870456099; float CzJIiYFbXTMiKkOZPFkubRs53374159 = -881945607; float CzJIiYFbXTMiKkOZPFkubRs98255012 = -690971945; float CzJIiYFbXTMiKkOZPFkubRs16275968 = -811911881; float CzJIiYFbXTMiKkOZPFkubRs54240676 = -131202151; float CzJIiYFbXTMiKkOZPFkubRs11151969 = -40186126; float CzJIiYFbXTMiKkOZPFkubRs30979288 = -121738042; float CzJIiYFbXTMiKkOZPFkubRs75521965 = 52167877; float CzJIiYFbXTMiKkOZPFkubRs8658969 = -232700401; float CzJIiYFbXTMiKkOZPFkubRs79867522 = -646583128; float CzJIiYFbXTMiKkOZPFkubRs1494386 = 38342736; float CzJIiYFbXTMiKkOZPFkubRs4335222 = 80907364; float CzJIiYFbXTMiKkOZPFkubRs1640198 = -417929382; float CzJIiYFbXTMiKkOZPFkubRs3954059 = -128147930; float CzJIiYFbXTMiKkOZPFkubRs22456143 = 97815115; float CzJIiYFbXTMiKkOZPFkubRs45987215 = -695785131; CzJIiYFbXTMiKkOZPFkubRs34746981 = CzJIiYFbXTMiKkOZPFkubRs10226707; CzJIiYFbXTMiKkOZPFkubRs10226707 = CzJIiYFbXTMiKkOZPFkubRs14554396; CzJIiYFbXTMiKkOZPFkubRs14554396 = CzJIiYFbXTMiKkOZPFkubRs51400972; CzJIiYFbXTMiKkOZPFkubRs51400972 = CzJIiYFbXTMiKkOZPFkubRs3415537; CzJIiYFbXTMiKkOZPFkubRs3415537 = CzJIiYFbXTMiKkOZPFkubRs618977; CzJIiYFbXTMiKkOZPFkubRs618977 = CzJIiYFbXTMiKkOZPFkubRs90760855; CzJIiYFbXTMiKkOZPFkubRs90760855 = CzJIiYFbXTMiKkOZPFkubRs76569570; CzJIiYFbXTMiKkOZPFkubRs76569570 = CzJIiYFbXTMiKkOZPFkubRs35065318; CzJIiYFbXTMiKkOZPFkubRs35065318 = CzJIiYFbXTMiKkOZPFkubRs66764788; CzJIiYFbXTMiKkOZPFkubRs66764788 = CzJIiYFbXTMiKkOZPFkubRs11940518; CzJIiYFbXTMiKkOZPFkubRs11940518 = CzJIiYFbXTMiKkOZPFkubRs90334807; CzJIiYFbXTMiKkOZPFkubRs90334807 = CzJIiYFbXTMiKkOZPFkubRs54419389; CzJIiYFbXTMiKkOZPFkubRs54419389 = CzJIiYFbXTMiKkOZPFkubRs87565227; CzJIiYFbXTMiKkOZPFkubRs87565227 = CzJIiYFbXTMiKkOZPFkubRs70627922; CzJIiYFbXTMiKkOZPFkubRs70627922 = CzJIiYFbXTMiKkOZPFkubRs30118535; CzJIiYFbXTMiKkOZPFkubRs30118535 = CzJIiYFbXTMiKkOZPFkubRs48054127; CzJIiYFbXTMiKkOZPFkubRs48054127 = CzJIiYFbXTMiKkOZPFkubRs68724380; CzJIiYFbXTMiKkOZPFkubRs68724380 = CzJIiYFbXTMiKkOZPFkubRs48673813; CzJIiYFbXTMiKkOZPFkubRs48673813 = CzJIiYFbXTMiKkOZPFkubRs44888883; CzJIiYFbXTMiKkOZPFkubRs44888883 = CzJIiYFbXTMiKkOZPFkubRs94872721; CzJIiYFbXTMiKkOZPFkubRs94872721 = CzJIiYFbXTMiKkOZPFkubRs97084949; CzJIiYFbXTMiKkOZPFkubRs97084949 = CzJIiYFbXTMiKkOZPFkubRs37841508; CzJIiYFbXTMiKkOZPFkubRs37841508 = CzJIiYFbXTMiKkOZPFkubRs15198281; CzJIiYFbXTMiKkOZPFkubRs15198281 = CzJIiYFbXTMiKkOZPFkubRs86499466; CzJIiYFbXTMiKkOZPFkubRs86499466 = CzJIiYFbXTMiKkOZPFkubRs75570967; CzJIiYFbXTMiKkOZPFkubRs75570967 = CzJIiYFbXTMiKkOZPFkubRs63454350; CzJIiYFbXTMiKkOZPFkubRs63454350 = CzJIiYFbXTMiKkOZPFkubRs30688006; CzJIiYFbXTMiKkOZPFkubRs30688006 = CzJIiYFbXTMiKkOZPFkubRs47865163; CzJIiYFbXTMiKkOZPFkubRs47865163 = CzJIiYFbXTMiKkOZPFkubRs45907574; CzJIiYFbXTMiKkOZPFkubRs45907574 = CzJIiYFbXTMiKkOZPFkubRs82513756; CzJIiYFbXTMiKkOZPFkubRs82513756 = CzJIiYFbXTMiKkOZPFkubRs35199775; CzJIiYFbXTMiKkOZPFkubRs35199775 = CzJIiYFbXTMiKkOZPFkubRs3337919; CzJIiYFbXTMiKkOZPFkubRs3337919 = CzJIiYFbXTMiKkOZPFkubRs77432404; CzJIiYFbXTMiKkOZPFkubRs77432404 = CzJIiYFbXTMiKkOZPFkubRs48813999; CzJIiYFbXTMiKkOZPFkubRs48813999 = CzJIiYFbXTMiKkOZPFkubRs3364487; CzJIiYFbXTMiKkOZPFkubRs3364487 = CzJIiYFbXTMiKkOZPFkubRs74878080; CzJIiYFbXTMiKkOZPFkubRs74878080 = CzJIiYFbXTMiKkOZPFkubRs73560473; CzJIiYFbXTMiKkOZPFkubRs73560473 = CzJIiYFbXTMiKkOZPFkubRs7712092; CzJIiYFbXTMiKkOZPFkubRs7712092 = CzJIiYFbXTMiKkOZPFkubRs38659011; CzJIiYFbXTMiKkOZPFkubRs38659011 = CzJIiYFbXTMiKkOZPFkubRs64408071; CzJIiYFbXTMiKkOZPFkubRs64408071 = CzJIiYFbXTMiKkOZPFkubRs30344605; CzJIiYFbXTMiKkOZPFkubRs30344605 = CzJIiYFbXTMiKkOZPFkubRs93111801; CzJIiYFbXTMiKkOZPFkubRs93111801 = CzJIiYFbXTMiKkOZPFkubRs6707176; CzJIiYFbXTMiKkOZPFkubRs6707176 = CzJIiYFbXTMiKkOZPFkubRs22727958; CzJIiYFbXTMiKkOZPFkubRs22727958 = CzJIiYFbXTMiKkOZPFkubRs14652786; CzJIiYFbXTMiKkOZPFkubRs14652786 = CzJIiYFbXTMiKkOZPFkubRs57483083; CzJIiYFbXTMiKkOZPFkubRs57483083 = CzJIiYFbXTMiKkOZPFkubRs90968147; CzJIiYFbXTMiKkOZPFkubRs90968147 = CzJIiYFbXTMiKkOZPFkubRs10581506; CzJIiYFbXTMiKkOZPFkubRs10581506 = CzJIiYFbXTMiKkOZPFkubRs68645252; CzJIiYFbXTMiKkOZPFkubRs68645252 = CzJIiYFbXTMiKkOZPFkubRs88778257; CzJIiYFbXTMiKkOZPFkubRs88778257 = CzJIiYFbXTMiKkOZPFkubRs29139597; CzJIiYFbXTMiKkOZPFkubRs29139597 = CzJIiYFbXTMiKkOZPFkubRs36944763; CzJIiYFbXTMiKkOZPFkubRs36944763 = CzJIiYFbXTMiKkOZPFkubRs87061951; CzJIiYFbXTMiKkOZPFkubRs87061951 = CzJIiYFbXTMiKkOZPFkubRs23191728; CzJIiYFbXTMiKkOZPFkubRs23191728 = CzJIiYFbXTMiKkOZPFkubRs37662031; CzJIiYFbXTMiKkOZPFkubRs37662031 = CzJIiYFbXTMiKkOZPFkubRs72385199; CzJIiYFbXTMiKkOZPFkubRs72385199 = CzJIiYFbXTMiKkOZPFkubRs99356115; CzJIiYFbXTMiKkOZPFkubRs99356115 = CzJIiYFbXTMiKkOZPFkubRs64901505; CzJIiYFbXTMiKkOZPFkubRs64901505 = CzJIiYFbXTMiKkOZPFkubRs27844569; CzJIiYFbXTMiKkOZPFkubRs27844569 = CzJIiYFbXTMiKkOZPFkubRs37164626; CzJIiYFbXTMiKkOZPFkubRs37164626 = CzJIiYFbXTMiKkOZPFkubRs60072850; CzJIiYFbXTMiKkOZPFkubRs60072850 = CzJIiYFbXTMiKkOZPFkubRs28704407; CzJIiYFbXTMiKkOZPFkubRs28704407 = CzJIiYFbXTMiKkOZPFkubRs89157743; CzJIiYFbXTMiKkOZPFkubRs89157743 = CzJIiYFbXTMiKkOZPFkubRs84251032; CzJIiYFbXTMiKkOZPFkubRs84251032 = CzJIiYFbXTMiKkOZPFkubRs76740742; CzJIiYFbXTMiKkOZPFkubRs76740742 = CzJIiYFbXTMiKkOZPFkubRs86996888; CzJIiYFbXTMiKkOZPFkubRs86996888 = CzJIiYFbXTMiKkOZPFkubRs76986985; CzJIiYFbXTMiKkOZPFkubRs76986985 = CzJIiYFbXTMiKkOZPFkubRs38751229; CzJIiYFbXTMiKkOZPFkubRs38751229 = CzJIiYFbXTMiKkOZPFkubRs67263436; CzJIiYFbXTMiKkOZPFkubRs67263436 = CzJIiYFbXTMiKkOZPFkubRs55240455; CzJIiYFbXTMiKkOZPFkubRs55240455 = CzJIiYFbXTMiKkOZPFkubRs74493653; CzJIiYFbXTMiKkOZPFkubRs74493653 = CzJIiYFbXTMiKkOZPFkubRs61012288; CzJIiYFbXTMiKkOZPFkubRs61012288 = CzJIiYFbXTMiKkOZPFkubRs10014803; CzJIiYFbXTMiKkOZPFkubRs10014803 = CzJIiYFbXTMiKkOZPFkubRs80480811; CzJIiYFbXTMiKkOZPFkubRs80480811 = CzJIiYFbXTMiKkOZPFkubRs64528117; CzJIiYFbXTMiKkOZPFkubRs64528117 = CzJIiYFbXTMiKkOZPFkubRs3973149; CzJIiYFbXTMiKkOZPFkubRs3973149 = CzJIiYFbXTMiKkOZPFkubRs31134333; CzJIiYFbXTMiKkOZPFkubRs31134333 = CzJIiYFbXTMiKkOZPFkubRs92470323; CzJIiYFbXTMiKkOZPFkubRs92470323 = CzJIiYFbXTMiKkOZPFkubRs71846680; CzJIiYFbXTMiKkOZPFkubRs71846680 = CzJIiYFbXTMiKkOZPFkubRs18087884; CzJIiYFbXTMiKkOZPFkubRs18087884 = CzJIiYFbXTMiKkOZPFkubRs72486203; CzJIiYFbXTMiKkOZPFkubRs72486203 = CzJIiYFbXTMiKkOZPFkubRs20106500; CzJIiYFbXTMiKkOZPFkubRs20106500 = CzJIiYFbXTMiKkOZPFkubRs79219910; CzJIiYFbXTMiKkOZPFkubRs79219910 = CzJIiYFbXTMiKkOZPFkubRs57129316; CzJIiYFbXTMiKkOZPFkubRs57129316 = CzJIiYFbXTMiKkOZPFkubRs53374159; CzJIiYFbXTMiKkOZPFkubRs53374159 = CzJIiYFbXTMiKkOZPFkubRs98255012; CzJIiYFbXTMiKkOZPFkubRs98255012 = CzJIiYFbXTMiKkOZPFkubRs16275968; CzJIiYFbXTMiKkOZPFkubRs16275968 = CzJIiYFbXTMiKkOZPFkubRs54240676; CzJIiYFbXTMiKkOZPFkubRs54240676 = CzJIiYFbXTMiKkOZPFkubRs11151969; CzJIiYFbXTMiKkOZPFkubRs11151969 = CzJIiYFbXTMiKkOZPFkubRs30979288; CzJIiYFbXTMiKkOZPFkubRs30979288 = CzJIiYFbXTMiKkOZPFkubRs75521965; CzJIiYFbXTMiKkOZPFkubRs75521965 = CzJIiYFbXTMiKkOZPFkubRs8658969; CzJIiYFbXTMiKkOZPFkubRs8658969 = CzJIiYFbXTMiKkOZPFkubRs79867522; CzJIiYFbXTMiKkOZPFkubRs79867522 = CzJIiYFbXTMiKkOZPFkubRs1494386; CzJIiYFbXTMiKkOZPFkubRs1494386 = CzJIiYFbXTMiKkOZPFkubRs4335222; CzJIiYFbXTMiKkOZPFkubRs4335222 = CzJIiYFbXTMiKkOZPFkubRs1640198; CzJIiYFbXTMiKkOZPFkubRs1640198 = CzJIiYFbXTMiKkOZPFkubRs3954059; CzJIiYFbXTMiKkOZPFkubRs3954059 = CzJIiYFbXTMiKkOZPFkubRs22456143; CzJIiYFbXTMiKkOZPFkubRs22456143 = CzJIiYFbXTMiKkOZPFkubRs45987215; CzJIiYFbXTMiKkOZPFkubRs45987215 = CzJIiYFbXTMiKkOZPFkubRs34746981;}
void UTeaHUztSDmaiifiHxqkaZZTGZ3127287() { float AfYwvNsnkQEJzvLRzFlYvNA18470499 = 54192802; float AfYwvNsnkQEJzvLRzFlYvNA7824803 = 81805228; float AfYwvNsnkQEJzvLRzFlYvNA3140513 = -293921582; float AfYwvNsnkQEJzvLRzFlYvNA48548925 = -528383164; float AfYwvNsnkQEJzvLRzFlYvNA82976872 = -150495423; float AfYwvNsnkQEJzvLRzFlYvNA11958494 = -946190029; float AfYwvNsnkQEJzvLRzFlYvNA27641419 = -272113738; float AfYwvNsnkQEJzvLRzFlYvNA19909653 = -224225029; float AfYwvNsnkQEJzvLRzFlYvNA85284845 = -525090163; float AfYwvNsnkQEJzvLRzFlYvNA12870377 = -577741299; float AfYwvNsnkQEJzvLRzFlYvNA54829553 = -469707552; float AfYwvNsnkQEJzvLRzFlYvNA80546578 = -475379745; float AfYwvNsnkQEJzvLRzFlYvNA5473241 = -767088535; float AfYwvNsnkQEJzvLRzFlYvNA81938371 = -326079791; float AfYwvNsnkQEJzvLRzFlYvNA74807181 = -818373769; float AfYwvNsnkQEJzvLRzFlYvNA1932564 = -212665005; float AfYwvNsnkQEJzvLRzFlYvNA47919538 = -719250015; float AfYwvNsnkQEJzvLRzFlYvNA82801649 = -66522115; float AfYwvNsnkQEJzvLRzFlYvNA89650294 = -436336535; float AfYwvNsnkQEJzvLRzFlYvNA18996528 = -276647311; float AfYwvNsnkQEJzvLRzFlYvNA62212232 = -811123496; float AfYwvNsnkQEJzvLRzFlYvNA98087021 = -135225157; float AfYwvNsnkQEJzvLRzFlYvNA7017374 = -779185343; float AfYwvNsnkQEJzvLRzFlYvNA16340976 = -235640793; float AfYwvNsnkQEJzvLRzFlYvNA23101560 = -679205133; float AfYwvNsnkQEJzvLRzFlYvNA28563725 = -566063633; float AfYwvNsnkQEJzvLRzFlYvNA85046290 = -719693885; float AfYwvNsnkQEJzvLRzFlYvNA73287205 = -993849069; float AfYwvNsnkQEJzvLRzFlYvNA19783305 = -330471306; float AfYwvNsnkQEJzvLRzFlYvNA81455900 = -835004884; float AfYwvNsnkQEJzvLRzFlYvNA63878179 = -527330911; float AfYwvNsnkQEJzvLRzFlYvNA59993063 = -448987233; float AfYwvNsnkQEJzvLRzFlYvNA17462621 = -469754005; float AfYwvNsnkQEJzvLRzFlYvNA13157118 = -892782458; float AfYwvNsnkQEJzvLRzFlYvNA16417325 = -248191994; float AfYwvNsnkQEJzvLRzFlYvNA73225720 = -564886833; float AfYwvNsnkQEJzvLRzFlYvNA74641670 = 2620829; float AfYwvNsnkQEJzvLRzFlYvNA23942265 = -54470482; float AfYwvNsnkQEJzvLRzFlYvNA68327811 = -581592635; float AfYwvNsnkQEJzvLRzFlYvNA77848126 = -475355042; float AfYwvNsnkQEJzvLRzFlYvNA29175592 = -812324782; float AfYwvNsnkQEJzvLRzFlYvNA59684331 = -921450089; float AfYwvNsnkQEJzvLRzFlYvNA25911948 = -545761142; float AfYwvNsnkQEJzvLRzFlYvNA53902695 = -627596010; float AfYwvNsnkQEJzvLRzFlYvNA50715208 = -473920133; float AfYwvNsnkQEJzvLRzFlYvNA58919667 = -728019054; float AfYwvNsnkQEJzvLRzFlYvNA90662052 = -266648003; float AfYwvNsnkQEJzvLRzFlYvNA29709995 = -590476319; float AfYwvNsnkQEJzvLRzFlYvNA44455719 = 71435060; float AfYwvNsnkQEJzvLRzFlYvNA4518583 = -127039848; float AfYwvNsnkQEJzvLRzFlYvNA28869089 = -457714813; float AfYwvNsnkQEJzvLRzFlYvNA80645317 = -178340070; float AfYwvNsnkQEJzvLRzFlYvNA82327165 = -220750431; float AfYwvNsnkQEJzvLRzFlYvNA32994557 = -569337221; float AfYwvNsnkQEJzvLRzFlYvNA40915055 = -574210604; float AfYwvNsnkQEJzvLRzFlYvNA20383478 = -810582042; float AfYwvNsnkQEJzvLRzFlYvNA807430 = -139009429; float AfYwvNsnkQEJzvLRzFlYvNA86799537 = 41719210; float AfYwvNsnkQEJzvLRzFlYvNA25447366 = -849178032; float AfYwvNsnkQEJzvLRzFlYvNA54413148 = -584431790; float AfYwvNsnkQEJzvLRzFlYvNA26912204 = -126496145; float AfYwvNsnkQEJzvLRzFlYvNA54354213 = -278264669; float AfYwvNsnkQEJzvLRzFlYvNA126349 = -893753723; float AfYwvNsnkQEJzvLRzFlYvNA3828945 = -690085280; float AfYwvNsnkQEJzvLRzFlYvNA48992197 = 49589612; float AfYwvNsnkQEJzvLRzFlYvNA94836489 = 79279680; float AfYwvNsnkQEJzvLRzFlYvNA63083958 = 94374260; float AfYwvNsnkQEJzvLRzFlYvNA92316122 = -874306078; float AfYwvNsnkQEJzvLRzFlYvNA65521047 = 22112202; float AfYwvNsnkQEJzvLRzFlYvNA1581461 = -153486936; float AfYwvNsnkQEJzvLRzFlYvNA27290894 = -115285834; float AfYwvNsnkQEJzvLRzFlYvNA23977274 = -564779533; float AfYwvNsnkQEJzvLRzFlYvNA14473839 = -484929481; float AfYwvNsnkQEJzvLRzFlYvNA11802168 = -960981494; float AfYwvNsnkQEJzvLRzFlYvNA89820935 = -464322529; float AfYwvNsnkQEJzvLRzFlYvNA2527901 = -889673408; float AfYwvNsnkQEJzvLRzFlYvNA72175073 = -589464015; float AfYwvNsnkQEJzvLRzFlYvNA53114679 = -51589334; float AfYwvNsnkQEJzvLRzFlYvNA65625767 = -761720660; float AfYwvNsnkQEJzvLRzFlYvNA64181892 = -951186079; float AfYwvNsnkQEJzvLRzFlYvNA37901672 = -199415630; float AfYwvNsnkQEJzvLRzFlYvNA55336295 = -29217567; float AfYwvNsnkQEJzvLRzFlYvNA28831487 = -965284130; float AfYwvNsnkQEJzvLRzFlYvNA15264722 = -103431459; float AfYwvNsnkQEJzvLRzFlYvNA52586812 = -277290072; float AfYwvNsnkQEJzvLRzFlYvNA83232862 = -248990841; float AfYwvNsnkQEJzvLRzFlYvNA77665898 = -128236802; float AfYwvNsnkQEJzvLRzFlYvNA84468063 = -900416785; float AfYwvNsnkQEJzvLRzFlYvNA72242063 = -218571854; float AfYwvNsnkQEJzvLRzFlYvNA96033846 = -437609953; float AfYwvNsnkQEJzvLRzFlYvNA72418291 = -325877405; float AfYwvNsnkQEJzvLRzFlYvNA87842133 = 60901618; float AfYwvNsnkQEJzvLRzFlYvNA98494899 = -205292450; float AfYwvNsnkQEJzvLRzFlYvNA13914663 = -997160845; float AfYwvNsnkQEJzvLRzFlYvNA50935923 = -248858898; float AfYwvNsnkQEJzvLRzFlYvNA74821379 = -434060113; float AfYwvNsnkQEJzvLRzFlYvNA59557983 = 72303634; float AfYwvNsnkQEJzvLRzFlYvNA22083003 = -855675862; float AfYwvNsnkQEJzvLRzFlYvNA4910498 = -577185622; float AfYwvNsnkQEJzvLRzFlYvNA55878718 = 54192802; AfYwvNsnkQEJzvLRzFlYvNA18470499 = AfYwvNsnkQEJzvLRzFlYvNA7824803; AfYwvNsnkQEJzvLRzFlYvNA7824803 = AfYwvNsnkQEJzvLRzFlYvNA3140513; AfYwvNsnkQEJzvLRzFlYvNA3140513 = AfYwvNsnkQEJzvLRzFlYvNA48548925; AfYwvNsnkQEJzvLRzFlYvNA48548925 = AfYwvNsnkQEJzvLRzFlYvNA82976872; AfYwvNsnkQEJzvLRzFlYvNA82976872 = AfYwvNsnkQEJzvLRzFlYvNA11958494; AfYwvNsnkQEJzvLRzFlYvNA11958494 = AfYwvNsnkQEJzvLRzFlYvNA27641419; AfYwvNsnkQEJzvLRzFlYvNA27641419 = AfYwvNsnkQEJzvLRzFlYvNA19909653; AfYwvNsnkQEJzvLRzFlYvNA19909653 = AfYwvNsnkQEJzvLRzFlYvNA85284845; AfYwvNsnkQEJzvLRzFlYvNA85284845 = AfYwvNsnkQEJzvLRzFlYvNA12870377; AfYwvNsnkQEJzvLRzFlYvNA12870377 = AfYwvNsnkQEJzvLRzFlYvNA54829553; AfYwvNsnkQEJzvLRzFlYvNA54829553 = AfYwvNsnkQEJzvLRzFlYvNA80546578; AfYwvNsnkQEJzvLRzFlYvNA80546578 = AfYwvNsnkQEJzvLRzFlYvNA5473241; AfYwvNsnkQEJzvLRzFlYvNA5473241 = AfYwvNsnkQEJzvLRzFlYvNA81938371; AfYwvNsnkQEJzvLRzFlYvNA81938371 = AfYwvNsnkQEJzvLRzFlYvNA74807181; AfYwvNsnkQEJzvLRzFlYvNA74807181 = AfYwvNsnkQEJzvLRzFlYvNA1932564; AfYwvNsnkQEJzvLRzFlYvNA1932564 = AfYwvNsnkQEJzvLRzFlYvNA47919538; AfYwvNsnkQEJzvLRzFlYvNA47919538 = AfYwvNsnkQEJzvLRzFlYvNA82801649; AfYwvNsnkQEJzvLRzFlYvNA82801649 = AfYwvNsnkQEJzvLRzFlYvNA89650294; AfYwvNsnkQEJzvLRzFlYvNA89650294 = AfYwvNsnkQEJzvLRzFlYvNA18996528; AfYwvNsnkQEJzvLRzFlYvNA18996528 = AfYwvNsnkQEJzvLRzFlYvNA62212232; AfYwvNsnkQEJzvLRzFlYvNA62212232 = AfYwvNsnkQEJzvLRzFlYvNA98087021; AfYwvNsnkQEJzvLRzFlYvNA98087021 = AfYwvNsnkQEJzvLRzFlYvNA7017374; AfYwvNsnkQEJzvLRzFlYvNA7017374 = AfYwvNsnkQEJzvLRzFlYvNA16340976; AfYwvNsnkQEJzvLRzFlYvNA16340976 = AfYwvNsnkQEJzvLRzFlYvNA23101560; AfYwvNsnkQEJzvLRzFlYvNA23101560 = AfYwvNsnkQEJzvLRzFlYvNA28563725; AfYwvNsnkQEJzvLRzFlYvNA28563725 = AfYwvNsnkQEJzvLRzFlYvNA85046290; AfYwvNsnkQEJzvLRzFlYvNA85046290 = AfYwvNsnkQEJzvLRzFlYvNA73287205; AfYwvNsnkQEJzvLRzFlYvNA73287205 = AfYwvNsnkQEJzvLRzFlYvNA19783305; AfYwvNsnkQEJzvLRzFlYvNA19783305 = AfYwvNsnkQEJzvLRzFlYvNA81455900; AfYwvNsnkQEJzvLRzFlYvNA81455900 = AfYwvNsnkQEJzvLRzFlYvNA63878179; AfYwvNsnkQEJzvLRzFlYvNA63878179 = AfYwvNsnkQEJzvLRzFlYvNA59993063; AfYwvNsnkQEJzvLRzFlYvNA59993063 = AfYwvNsnkQEJzvLRzFlYvNA17462621; AfYwvNsnkQEJzvLRzFlYvNA17462621 = AfYwvNsnkQEJzvLRzFlYvNA13157118; AfYwvNsnkQEJzvLRzFlYvNA13157118 = AfYwvNsnkQEJzvLRzFlYvNA16417325; AfYwvNsnkQEJzvLRzFlYvNA16417325 = AfYwvNsnkQEJzvLRzFlYvNA73225720; AfYwvNsnkQEJzvLRzFlYvNA73225720 = AfYwvNsnkQEJzvLRzFlYvNA74641670; AfYwvNsnkQEJzvLRzFlYvNA74641670 = AfYwvNsnkQEJzvLRzFlYvNA23942265; AfYwvNsnkQEJzvLRzFlYvNA23942265 = AfYwvNsnkQEJzvLRzFlYvNA68327811; AfYwvNsnkQEJzvLRzFlYvNA68327811 = AfYwvNsnkQEJzvLRzFlYvNA77848126; AfYwvNsnkQEJzvLRzFlYvNA77848126 = AfYwvNsnkQEJzvLRzFlYvNA29175592; AfYwvNsnkQEJzvLRzFlYvNA29175592 = AfYwvNsnkQEJzvLRzFlYvNA59684331; AfYwvNsnkQEJzvLRzFlYvNA59684331 = AfYwvNsnkQEJzvLRzFlYvNA25911948; AfYwvNsnkQEJzvLRzFlYvNA25911948 = AfYwvNsnkQEJzvLRzFlYvNA53902695; AfYwvNsnkQEJzvLRzFlYvNA53902695 = AfYwvNsnkQEJzvLRzFlYvNA50715208; AfYwvNsnkQEJzvLRzFlYvNA50715208 = AfYwvNsnkQEJzvLRzFlYvNA58919667; AfYwvNsnkQEJzvLRzFlYvNA58919667 = AfYwvNsnkQEJzvLRzFlYvNA90662052; AfYwvNsnkQEJzvLRzFlYvNA90662052 = AfYwvNsnkQEJzvLRzFlYvNA29709995; AfYwvNsnkQEJzvLRzFlYvNA29709995 = AfYwvNsnkQEJzvLRzFlYvNA44455719; AfYwvNsnkQEJzvLRzFlYvNA44455719 = AfYwvNsnkQEJzvLRzFlYvNA4518583; AfYwvNsnkQEJzvLRzFlYvNA4518583 = AfYwvNsnkQEJzvLRzFlYvNA28869089; AfYwvNsnkQEJzvLRzFlYvNA28869089 = AfYwvNsnkQEJzvLRzFlYvNA80645317; AfYwvNsnkQEJzvLRzFlYvNA80645317 = AfYwvNsnkQEJzvLRzFlYvNA82327165; AfYwvNsnkQEJzvLRzFlYvNA82327165 = AfYwvNsnkQEJzvLRzFlYvNA32994557; AfYwvNsnkQEJzvLRzFlYvNA32994557 = AfYwvNsnkQEJzvLRzFlYvNA40915055; AfYwvNsnkQEJzvLRzFlYvNA40915055 = AfYwvNsnkQEJzvLRzFlYvNA20383478; AfYwvNsnkQEJzvLRzFlYvNA20383478 = AfYwvNsnkQEJzvLRzFlYvNA807430; AfYwvNsnkQEJzvLRzFlYvNA807430 = AfYwvNsnkQEJzvLRzFlYvNA86799537; AfYwvNsnkQEJzvLRzFlYvNA86799537 = AfYwvNsnkQEJzvLRzFlYvNA25447366; AfYwvNsnkQEJzvLRzFlYvNA25447366 = AfYwvNsnkQEJzvLRzFlYvNA54413148; AfYwvNsnkQEJzvLRzFlYvNA54413148 = AfYwvNsnkQEJzvLRzFlYvNA26912204; AfYwvNsnkQEJzvLRzFlYvNA26912204 = AfYwvNsnkQEJzvLRzFlYvNA54354213; AfYwvNsnkQEJzvLRzFlYvNA54354213 = AfYwvNsnkQEJzvLRzFlYvNA126349; AfYwvNsnkQEJzvLRzFlYvNA126349 = AfYwvNsnkQEJzvLRzFlYvNA3828945; AfYwvNsnkQEJzvLRzFlYvNA3828945 = AfYwvNsnkQEJzvLRzFlYvNA48992197; AfYwvNsnkQEJzvLRzFlYvNA48992197 = AfYwvNsnkQEJzvLRzFlYvNA94836489; AfYwvNsnkQEJzvLRzFlYvNA94836489 = AfYwvNsnkQEJzvLRzFlYvNA63083958; AfYwvNsnkQEJzvLRzFlYvNA63083958 = AfYwvNsnkQEJzvLRzFlYvNA92316122; AfYwvNsnkQEJzvLRzFlYvNA92316122 = AfYwvNsnkQEJzvLRzFlYvNA65521047; AfYwvNsnkQEJzvLRzFlYvNA65521047 = AfYwvNsnkQEJzvLRzFlYvNA1581461; AfYwvNsnkQEJzvLRzFlYvNA1581461 = AfYwvNsnkQEJzvLRzFlYvNA27290894; AfYwvNsnkQEJzvLRzFlYvNA27290894 = AfYwvNsnkQEJzvLRzFlYvNA23977274; AfYwvNsnkQEJzvLRzFlYvNA23977274 = AfYwvNsnkQEJzvLRzFlYvNA14473839; AfYwvNsnkQEJzvLRzFlYvNA14473839 = AfYwvNsnkQEJzvLRzFlYvNA11802168; AfYwvNsnkQEJzvLRzFlYvNA11802168 = AfYwvNsnkQEJzvLRzFlYvNA89820935; AfYwvNsnkQEJzvLRzFlYvNA89820935 = AfYwvNsnkQEJzvLRzFlYvNA2527901; AfYwvNsnkQEJzvLRzFlYvNA2527901 = AfYwvNsnkQEJzvLRzFlYvNA72175073; AfYwvNsnkQEJzvLRzFlYvNA72175073 = AfYwvNsnkQEJzvLRzFlYvNA53114679; AfYwvNsnkQEJzvLRzFlYvNA53114679 = AfYwvNsnkQEJzvLRzFlYvNA65625767; AfYwvNsnkQEJzvLRzFlYvNA65625767 = AfYwvNsnkQEJzvLRzFlYvNA64181892; AfYwvNsnkQEJzvLRzFlYvNA64181892 = AfYwvNsnkQEJzvLRzFlYvNA37901672; AfYwvNsnkQEJzvLRzFlYvNA37901672 = AfYwvNsnkQEJzvLRzFlYvNA55336295; AfYwvNsnkQEJzvLRzFlYvNA55336295 = AfYwvNsnkQEJzvLRzFlYvNA28831487; AfYwvNsnkQEJzvLRzFlYvNA28831487 = AfYwvNsnkQEJzvLRzFlYvNA15264722; AfYwvNsnkQEJzvLRzFlYvNA15264722 = AfYwvNsnkQEJzvLRzFlYvNA52586812; AfYwvNsnkQEJzvLRzFlYvNA52586812 = AfYwvNsnkQEJzvLRzFlYvNA83232862; AfYwvNsnkQEJzvLRzFlYvNA83232862 = AfYwvNsnkQEJzvLRzFlYvNA77665898; AfYwvNsnkQEJzvLRzFlYvNA77665898 = AfYwvNsnkQEJzvLRzFlYvNA84468063; AfYwvNsnkQEJzvLRzFlYvNA84468063 = AfYwvNsnkQEJzvLRzFlYvNA72242063; AfYwvNsnkQEJzvLRzFlYvNA72242063 = AfYwvNsnkQEJzvLRzFlYvNA96033846; AfYwvNsnkQEJzvLRzFlYvNA96033846 = AfYwvNsnkQEJzvLRzFlYvNA72418291; AfYwvNsnkQEJzvLRzFlYvNA72418291 = AfYwvNsnkQEJzvLRzFlYvNA87842133; AfYwvNsnkQEJzvLRzFlYvNA87842133 = AfYwvNsnkQEJzvLRzFlYvNA98494899; AfYwvNsnkQEJzvLRzFlYvNA98494899 = AfYwvNsnkQEJzvLRzFlYvNA13914663; AfYwvNsnkQEJzvLRzFlYvNA13914663 = AfYwvNsnkQEJzvLRzFlYvNA50935923; AfYwvNsnkQEJzvLRzFlYvNA50935923 = AfYwvNsnkQEJzvLRzFlYvNA74821379; AfYwvNsnkQEJzvLRzFlYvNA74821379 = AfYwvNsnkQEJzvLRzFlYvNA59557983; AfYwvNsnkQEJzvLRzFlYvNA59557983 = AfYwvNsnkQEJzvLRzFlYvNA22083003; AfYwvNsnkQEJzvLRzFlYvNA22083003 = AfYwvNsnkQEJzvLRzFlYvNA4910498; AfYwvNsnkQEJzvLRzFlYvNA4910498 = AfYwvNsnkQEJzvLRzFlYvNA55878718; AfYwvNsnkQEJzvLRzFlYvNA55878718 = AfYwvNsnkQEJzvLRzFlYvNA18470499;}
void aLpzWjdfKvTiohCzJRoJmBrvax88190124() { float yUViNJQUXWcxVzjinoBTpVF2194017 = -295829265; float yUViNJQUXWcxVzjinoBTpVF5422898 = -821846623; float yUViNJQUXWcxVzjinoBTpVF91726630 = -162229273; float yUViNJQUXWcxVzjinoBTpVF45696878 = -533265093; float yUViNJQUXWcxVzjinoBTpVF62538209 = -548443614; float yUViNJQUXWcxVzjinoBTpVF23298012 = 50489302; float yUViNJQUXWcxVzjinoBTpVF64521981 = -293627876; float yUViNJQUXWcxVzjinoBTpVF63249735 = -844679615; float yUViNJQUXWcxVzjinoBTpVF35504374 = -122572860; float yUViNJQUXWcxVzjinoBTpVF58975964 = -800782314; float yUViNJQUXWcxVzjinoBTpVF97718589 = -309992810; float yUViNJQUXWcxVzjinoBTpVF70758349 = -404519017; float yUViNJQUXWcxVzjinoBTpVF56527093 = -609920779; float yUViNJQUXWcxVzjinoBTpVF76311516 = -675762653; float yUViNJQUXWcxVzjinoBTpVF78986439 = -744071074; float yUViNJQUXWcxVzjinoBTpVF73746592 = -136792656; float yUViNJQUXWcxVzjinoBTpVF47784949 = -878129877; float yUViNJQUXWcxVzjinoBTpVF96878918 = -777373689; float yUViNJQUXWcxVzjinoBTpVF30626775 = -224985773; float yUViNJQUXWcxVzjinoBTpVF93104172 = -992940228; float yUViNJQUXWcxVzjinoBTpVF29551742 = -385590017; float yUViNJQUXWcxVzjinoBTpVF99089092 = -48380443; float yUViNJQUXWcxVzjinoBTpVF76193238 = -808580080; float yUViNJQUXWcxVzjinoBTpVF17483671 = -874873446; float yUViNJQUXWcxVzjinoBTpVF59703652 = -757535894; float yUViNJQUXWcxVzjinoBTpVF81556482 = 90969339; float yUViNJQUXWcxVzjinoBTpVF6638230 = -63569308; float yUViNJQUXWcxVzjinoBTpVF15886406 = -780290558; float yUViNJQUXWcxVzjinoBTpVF91701446 = -854667207; float yUViNJQUXWcxVzjinoBTpVF17004228 = -407611259; float yUViNJQUXWcxVzjinoBTpVF45242602 = -746428931; float yUViNJQUXWcxVzjinoBTpVF84786351 = -998184455; float yUViNJQUXWcxVzjinoBTpVF31587322 = -34968097; float yUViNJQUXWcxVzjinoBTpVF48881832 = -196879105; float yUViNJQUXWcxVzjinoBTpVF84020649 = 17517399; float yUViNJQUXWcxVzjinoBTpVF43086954 = -543283311; float yUViNJQUXWcxVzjinoBTpVF74405260 = -317720467; float yUViNJQUXWcxVzjinoBTpVF74324056 = 46386302; float yUViNJQUXWcxVzjinoBTpVF28943530 = -887151516; float yUViNJQUXWcxVzjinoBTpVF17037243 = -422001922; float yUViNJQUXWcxVzjinoBTpVF93943112 = -462364908; float yUViNJQUXWcxVzjinoBTpVF89024057 = -527475758; float yUViNJQUXWcxVzjinoBTpVF58712094 = -198165396; float yUViNJQUXWcxVzjinoBTpVF1098214 = -206539742; float yUViNJQUXWcxVzjinoBTpVF78702459 = -799934212; float yUViNJQUXWcxVzjinoBTpVF3186549 = -343050746; float yUViNJQUXWcxVzjinoBTpVF23841022 = -288293910; float yUViNJQUXWcxVzjinoBTpVF68451842 = -352598216; float yUViNJQUXWcxVzjinoBTpVF78329932 = -728349091; float yUViNJQUXWcxVzjinoBTpVF40391913 = -759055283; float yUViNJQUXWcxVzjinoBTpVF68959920 = -623487215; float yUViNJQUXWcxVzjinoBTpVF32151037 = 69607144; float yUViNJQUXWcxVzjinoBTpVF27709568 = -232682797; float yUViNJQUXWcxVzjinoBTpVF78927163 = -46046409; float yUViNJQUXWcxVzjinoBTpVF58638383 = -890937549; float yUViNJQUXWcxVzjinoBTpVF3104925 = -147448823; float yUViNJQUXWcxVzjinoBTpVF29229659 = 86733456; float yUViNJQUXWcxVzjinoBTpVF74242959 = -287355827; float yUViNJQUXWcxVzjinoBTpVF85993225 = -775729199; float yUViNJQUXWcxVzjinoBTpVF80981726 = -539412954; float yUViNJQUXWcxVzjinoBTpVF16659783 = -885941390; float yUViNJQUXWcxVzjinoBTpVF48635576 = -513337319; float yUViNJQUXWcxVzjinoBTpVF71548289 = -990012409; float yUViNJQUXWcxVzjinoBTpVF18500147 = -714961602; float yUViNJQUXWcxVzjinoBTpVF13733363 = 45646617; float yUViNJQUXWcxVzjinoBTpVF12932238 = -311808355; float yUViNJQUXWcxVzjinoBTpVF39171028 = -269550920; float yUViNJQUXWcxVzjinoBTpVF7645261 = -313041674; float yUViNJQUXWcxVzjinoBTpVF92290866 = -593280052; float yUViNJQUXWcxVzjinoBTpVF35899486 = -100787764; float yUViNJQUXWcxVzjinoBTpVF99341331 = -819072189; float yUViNJQUXWcxVzjinoBTpVF73460893 = -824516180; float yUViNJQUXWcxVzjinoBTpVF67935389 = -890222173; float yUViNJQUXWcxVzjinoBTpVF13589533 = -802983852; float yUViNJQUXWcxVzjinoBTpVF99161059 = -430575320; float yUViNJQUXWcxVzjinoBTpVF40527684 = -858114259; float yUViNJQUXWcxVzjinoBTpVF40376998 = -850215047; float yUViNJQUXWcxVzjinoBTpVF75095024 = -502040338; float yUViNJQUXWcxVzjinoBTpVF38781212 = 25060765; float yUViNJQUXWcxVzjinoBTpVF56517103 = -314485149; float yUViNJQUXWcxVzjinoBTpVF57715461 = -620736751; float yUViNJQUXWcxVzjinoBTpVF38186387 = -710971092; float yUViNJQUXWcxVzjinoBTpVF37556474 = 48058533; float yUViNJQUXWcxVzjinoBTpVF51309534 = 4388076; float yUViNJQUXWcxVzjinoBTpVF48044307 = -784124045; float yUViNJQUXWcxVzjinoBTpVF13091566 = -716036075; float yUViNJQUXWcxVzjinoBTpVF57076784 = -665501659; float yUViNJQUXWcxVzjinoBTpVF52660159 = -988921688; float yUViNJQUXWcxVzjinoBTpVF90243449 = -305941557; float yUViNJQUXWcxVzjinoBTpVF80915725 = -835033779; float yUViNJQUXWcxVzjinoBTpVF13857295 = -530016768; float yUViNJQUXWcxVzjinoBTpVF162302 = 69635360; float yUViNJQUXWcxVzjinoBTpVF88330830 = -177884500; float yUViNJQUXWcxVzjinoBTpVF47961803 = -247738563; float yUViNJQUXWcxVzjinoBTpVF377461 = -536060532; float yUViNJQUXWcxVzjinoBTpVF45307537 = -949027590; float yUViNJQUXWcxVzjinoBTpVF17475769 = -537463349; float yUViNJQUXWcxVzjinoBTpVF40211948 = -483203795; float yUViNJQUXWcxVzjinoBTpVF87364851 = -152186360; float yUViNJQUXWcxVzjinoBTpVF65770221 = -295829265; yUViNJQUXWcxVzjinoBTpVF2194017 = yUViNJQUXWcxVzjinoBTpVF5422898; yUViNJQUXWcxVzjinoBTpVF5422898 = yUViNJQUXWcxVzjinoBTpVF91726630; yUViNJQUXWcxVzjinoBTpVF91726630 = yUViNJQUXWcxVzjinoBTpVF45696878; yUViNJQUXWcxVzjinoBTpVF45696878 = yUViNJQUXWcxVzjinoBTpVF62538209; yUViNJQUXWcxVzjinoBTpVF62538209 = yUViNJQUXWcxVzjinoBTpVF23298012; yUViNJQUXWcxVzjinoBTpVF23298012 = yUViNJQUXWcxVzjinoBTpVF64521981; yUViNJQUXWcxVzjinoBTpVF64521981 = yUViNJQUXWcxVzjinoBTpVF63249735; yUViNJQUXWcxVzjinoBTpVF63249735 = yUViNJQUXWcxVzjinoBTpVF35504374; yUViNJQUXWcxVzjinoBTpVF35504374 = yUViNJQUXWcxVzjinoBTpVF58975964; yUViNJQUXWcxVzjinoBTpVF58975964 = yUViNJQUXWcxVzjinoBTpVF97718589; yUViNJQUXWcxVzjinoBTpVF97718589 = yUViNJQUXWcxVzjinoBTpVF70758349; yUViNJQUXWcxVzjinoBTpVF70758349 = yUViNJQUXWcxVzjinoBTpVF56527093; yUViNJQUXWcxVzjinoBTpVF56527093 = yUViNJQUXWcxVzjinoBTpVF76311516; yUViNJQUXWcxVzjinoBTpVF76311516 = yUViNJQUXWcxVzjinoBTpVF78986439; yUViNJQUXWcxVzjinoBTpVF78986439 = yUViNJQUXWcxVzjinoBTpVF73746592; yUViNJQUXWcxVzjinoBTpVF73746592 = yUViNJQUXWcxVzjinoBTpVF47784949; yUViNJQUXWcxVzjinoBTpVF47784949 = yUViNJQUXWcxVzjinoBTpVF96878918; yUViNJQUXWcxVzjinoBTpVF96878918 = yUViNJQUXWcxVzjinoBTpVF30626775; yUViNJQUXWcxVzjinoBTpVF30626775 = yUViNJQUXWcxVzjinoBTpVF93104172; yUViNJQUXWcxVzjinoBTpVF93104172 = yUViNJQUXWcxVzjinoBTpVF29551742; yUViNJQUXWcxVzjinoBTpVF29551742 = yUViNJQUXWcxVzjinoBTpVF99089092; yUViNJQUXWcxVzjinoBTpVF99089092 = yUViNJQUXWcxVzjinoBTpVF76193238; yUViNJQUXWcxVzjinoBTpVF76193238 = yUViNJQUXWcxVzjinoBTpVF17483671; yUViNJQUXWcxVzjinoBTpVF17483671 = yUViNJQUXWcxVzjinoBTpVF59703652; yUViNJQUXWcxVzjinoBTpVF59703652 = yUViNJQUXWcxVzjinoBTpVF81556482; yUViNJQUXWcxVzjinoBTpVF81556482 = yUViNJQUXWcxVzjinoBTpVF6638230; yUViNJQUXWcxVzjinoBTpVF6638230 = yUViNJQUXWcxVzjinoBTpVF15886406; yUViNJQUXWcxVzjinoBTpVF15886406 = yUViNJQUXWcxVzjinoBTpVF91701446; yUViNJQUXWcxVzjinoBTpVF91701446 = yUViNJQUXWcxVzjinoBTpVF17004228; yUViNJQUXWcxVzjinoBTpVF17004228 = yUViNJQUXWcxVzjinoBTpVF45242602; yUViNJQUXWcxVzjinoBTpVF45242602 = yUViNJQUXWcxVzjinoBTpVF84786351; yUViNJQUXWcxVzjinoBTpVF84786351 = yUViNJQUXWcxVzjinoBTpVF31587322; yUViNJQUXWcxVzjinoBTpVF31587322 = yUViNJQUXWcxVzjinoBTpVF48881832; yUViNJQUXWcxVzjinoBTpVF48881832 = yUViNJQUXWcxVzjinoBTpVF84020649; yUViNJQUXWcxVzjinoBTpVF84020649 = yUViNJQUXWcxVzjinoBTpVF43086954; yUViNJQUXWcxVzjinoBTpVF43086954 = yUViNJQUXWcxVzjinoBTpVF74405260; yUViNJQUXWcxVzjinoBTpVF74405260 = yUViNJQUXWcxVzjinoBTpVF74324056; yUViNJQUXWcxVzjinoBTpVF74324056 = yUViNJQUXWcxVzjinoBTpVF28943530; yUViNJQUXWcxVzjinoBTpVF28943530 = yUViNJQUXWcxVzjinoBTpVF17037243; yUViNJQUXWcxVzjinoBTpVF17037243 = yUViNJQUXWcxVzjinoBTpVF93943112; yUViNJQUXWcxVzjinoBTpVF93943112 = yUViNJQUXWcxVzjinoBTpVF89024057; yUViNJQUXWcxVzjinoBTpVF89024057 = yUViNJQUXWcxVzjinoBTpVF58712094; yUViNJQUXWcxVzjinoBTpVF58712094 = yUViNJQUXWcxVzjinoBTpVF1098214; yUViNJQUXWcxVzjinoBTpVF1098214 = yUViNJQUXWcxVzjinoBTpVF78702459; yUViNJQUXWcxVzjinoBTpVF78702459 = yUViNJQUXWcxVzjinoBTpVF3186549; yUViNJQUXWcxVzjinoBTpVF3186549 = yUViNJQUXWcxVzjinoBTpVF23841022; yUViNJQUXWcxVzjinoBTpVF23841022 = yUViNJQUXWcxVzjinoBTpVF68451842; yUViNJQUXWcxVzjinoBTpVF68451842 = yUViNJQUXWcxVzjinoBTpVF78329932; yUViNJQUXWcxVzjinoBTpVF78329932 = yUViNJQUXWcxVzjinoBTpVF40391913; yUViNJQUXWcxVzjinoBTpVF40391913 = yUViNJQUXWcxVzjinoBTpVF68959920; yUViNJQUXWcxVzjinoBTpVF68959920 = yUViNJQUXWcxVzjinoBTpVF32151037; yUViNJQUXWcxVzjinoBTpVF32151037 = yUViNJQUXWcxVzjinoBTpVF27709568; yUViNJQUXWcxVzjinoBTpVF27709568 = yUViNJQUXWcxVzjinoBTpVF78927163; yUViNJQUXWcxVzjinoBTpVF78927163 = yUViNJQUXWcxVzjinoBTpVF58638383; yUViNJQUXWcxVzjinoBTpVF58638383 = yUViNJQUXWcxVzjinoBTpVF3104925; yUViNJQUXWcxVzjinoBTpVF3104925 = yUViNJQUXWcxVzjinoBTpVF29229659; yUViNJQUXWcxVzjinoBTpVF29229659 = yUViNJQUXWcxVzjinoBTpVF74242959; yUViNJQUXWcxVzjinoBTpVF74242959 = yUViNJQUXWcxVzjinoBTpVF85993225; yUViNJQUXWcxVzjinoBTpVF85993225 = yUViNJQUXWcxVzjinoBTpVF80981726; yUViNJQUXWcxVzjinoBTpVF80981726 = yUViNJQUXWcxVzjinoBTpVF16659783; yUViNJQUXWcxVzjinoBTpVF16659783 = yUViNJQUXWcxVzjinoBTpVF48635576; yUViNJQUXWcxVzjinoBTpVF48635576 = yUViNJQUXWcxVzjinoBTpVF71548289; yUViNJQUXWcxVzjinoBTpVF71548289 = yUViNJQUXWcxVzjinoBTpVF18500147; yUViNJQUXWcxVzjinoBTpVF18500147 = yUViNJQUXWcxVzjinoBTpVF13733363; yUViNJQUXWcxVzjinoBTpVF13733363 = yUViNJQUXWcxVzjinoBTpVF12932238; yUViNJQUXWcxVzjinoBTpVF12932238 = yUViNJQUXWcxVzjinoBTpVF39171028; yUViNJQUXWcxVzjinoBTpVF39171028 = yUViNJQUXWcxVzjinoBTpVF7645261; yUViNJQUXWcxVzjinoBTpVF7645261 = yUViNJQUXWcxVzjinoBTpVF92290866; yUViNJQUXWcxVzjinoBTpVF92290866 = yUViNJQUXWcxVzjinoBTpVF35899486; yUViNJQUXWcxVzjinoBTpVF35899486 = yUViNJQUXWcxVzjinoBTpVF99341331; yUViNJQUXWcxVzjinoBTpVF99341331 = yUViNJQUXWcxVzjinoBTpVF73460893; yUViNJQUXWcxVzjinoBTpVF73460893 = yUViNJQUXWcxVzjinoBTpVF67935389; yUViNJQUXWcxVzjinoBTpVF67935389 = yUViNJQUXWcxVzjinoBTpVF13589533; yUViNJQUXWcxVzjinoBTpVF13589533 = yUViNJQUXWcxVzjinoBTpVF99161059; yUViNJQUXWcxVzjinoBTpVF99161059 = yUViNJQUXWcxVzjinoBTpVF40527684; yUViNJQUXWcxVzjinoBTpVF40527684 = yUViNJQUXWcxVzjinoBTpVF40376998; yUViNJQUXWcxVzjinoBTpVF40376998 = yUViNJQUXWcxVzjinoBTpVF75095024; yUViNJQUXWcxVzjinoBTpVF75095024 = yUViNJQUXWcxVzjinoBTpVF38781212; yUViNJQUXWcxVzjinoBTpVF38781212 = yUViNJQUXWcxVzjinoBTpVF56517103; yUViNJQUXWcxVzjinoBTpVF56517103 = yUViNJQUXWcxVzjinoBTpVF57715461; yUViNJQUXWcxVzjinoBTpVF57715461 = yUViNJQUXWcxVzjinoBTpVF38186387; yUViNJQUXWcxVzjinoBTpVF38186387 = yUViNJQUXWcxVzjinoBTpVF37556474; yUViNJQUXWcxVzjinoBTpVF37556474 = yUViNJQUXWcxVzjinoBTpVF51309534; yUViNJQUXWcxVzjinoBTpVF51309534 = yUViNJQUXWcxVzjinoBTpVF48044307; yUViNJQUXWcxVzjinoBTpVF48044307 = yUViNJQUXWcxVzjinoBTpVF13091566; yUViNJQUXWcxVzjinoBTpVF13091566 = yUViNJQUXWcxVzjinoBTpVF57076784; yUViNJQUXWcxVzjinoBTpVF57076784 = yUViNJQUXWcxVzjinoBTpVF52660159; yUViNJQUXWcxVzjinoBTpVF52660159 = yUViNJQUXWcxVzjinoBTpVF90243449; yUViNJQUXWcxVzjinoBTpVF90243449 = yUViNJQUXWcxVzjinoBTpVF80915725; yUViNJQUXWcxVzjinoBTpVF80915725 = yUViNJQUXWcxVzjinoBTpVF13857295; yUViNJQUXWcxVzjinoBTpVF13857295 = yUViNJQUXWcxVzjinoBTpVF162302; yUViNJQUXWcxVzjinoBTpVF162302 = yUViNJQUXWcxVzjinoBTpVF88330830; yUViNJQUXWcxVzjinoBTpVF88330830 = yUViNJQUXWcxVzjinoBTpVF47961803; yUViNJQUXWcxVzjinoBTpVF47961803 = yUViNJQUXWcxVzjinoBTpVF377461; yUViNJQUXWcxVzjinoBTpVF377461 = yUViNJQUXWcxVzjinoBTpVF45307537; yUViNJQUXWcxVzjinoBTpVF45307537 = yUViNJQUXWcxVzjinoBTpVF17475769; yUViNJQUXWcxVzjinoBTpVF17475769 = yUViNJQUXWcxVzjinoBTpVF40211948; yUViNJQUXWcxVzjinoBTpVF40211948 = yUViNJQUXWcxVzjinoBTpVF87364851; yUViNJQUXWcxVzjinoBTpVF87364851 = yUViNJQUXWcxVzjinoBTpVF65770221; yUViNJQUXWcxVzjinoBTpVF65770221 = yUViNJQUXWcxVzjinoBTpVF2194017;}
void FlTAvOKwJpLdJEuabuhAGEWJMh73252962() { float FFMiDrBmlULzLDfmmKgWmJn85917534 = -645851332; float FFMiDrBmlULzLDfmmKgWmJn3020994 = -625498475; float FFMiDrBmlULzLDfmmKgWmJn80312747 = -30536963; float FFMiDrBmlULzLDfmmKgWmJn42844831 = -538147022; float FFMiDrBmlULzLDfmmKgWmJn42099546 = -946391806; float FFMiDrBmlULzLDfmmKgWmJn34637530 = -52831367; float FFMiDrBmlULzLDfmmKgWmJn1402545 = -315142014; float FFMiDrBmlULzLDfmmKgWmJn6589819 = -365134201; float FFMiDrBmlULzLDfmmKgWmJn85723902 = -820055556; float FFMiDrBmlULzLDfmmKgWmJn5081553 = 76176670; float FFMiDrBmlULzLDfmmKgWmJn40607625 = -150278068; float FFMiDrBmlULzLDfmmKgWmJn60970120 = -333658288; float FFMiDrBmlULzLDfmmKgWmJn7580945 = -452753022; float FFMiDrBmlULzLDfmmKgWmJn70684661 = 74554484; float FFMiDrBmlULzLDfmmKgWmJn83165698 = -669768380; float FFMiDrBmlULzLDfmmKgWmJn45560621 = -60920307; float FFMiDrBmlULzLDfmmKgWmJn47650360 = 62990260; float FFMiDrBmlULzLDfmmKgWmJn10956189 = -388225263; float FFMiDrBmlULzLDfmmKgWmJn71603255 = -13635012; float FFMiDrBmlULzLDfmmKgWmJn67211816 = -609233145; float FFMiDrBmlULzLDfmmKgWmJn96891252 = 39943463; float FFMiDrBmlULzLDfmmKgWmJn91164 = 38464271; float FFMiDrBmlULzLDfmmKgWmJn45369104 = -837974817; float FFMiDrBmlULzLDfmmKgWmJn18626366 = -414106099; float FFMiDrBmlULzLDfmmKgWmJn96305744 = -835866656; float FFMiDrBmlULzLDfmmKgWmJn34549241 = -351997688; float FFMiDrBmlULzLDfmmKgWmJn28230169 = -507444731; float FFMiDrBmlULzLDfmmKgWmJn58485606 = -566732046; float FFMiDrBmlULzLDfmmKgWmJn63619588 = -278863107; float FFMiDrBmlULzLDfmmKgWmJn52552555 = 19782367; float FFMiDrBmlULzLDfmmKgWmJn26607025 = -965526952; float FFMiDrBmlULzLDfmmKgWmJn9579640 = -447381678; float FFMiDrBmlULzLDfmmKgWmJn45712023 = -700182188; float FFMiDrBmlULzLDfmmKgWmJn84606546 = -600975753; float FFMiDrBmlULzLDfmmKgWmJn51623975 = -816773209; float FFMiDrBmlULzLDfmmKgWmJn12948188 = -521679788; float FFMiDrBmlULzLDfmmKgWmJn74168850 = -638061764; float FFMiDrBmlULzLDfmmKgWmJn24705847 = -952756915; float FFMiDrBmlULzLDfmmKgWmJn89559249 = -92710398; float FFMiDrBmlULzLDfmmKgWmJn56226358 = -368648801; float FFMiDrBmlULzLDfmmKgWmJn58710633 = -112405035; float FFMiDrBmlULzLDfmmKgWmJn18363785 = -133501427; float FFMiDrBmlULzLDfmmKgWmJn91512240 = -950569650; float FFMiDrBmlULzLDfmmKgWmJn48293733 = -885483475; float FFMiDrBmlULzLDfmmKgWmJn6689710 = -25948290; float FFMiDrBmlULzLDfmmKgWmJn47453430 = 41917562; float FFMiDrBmlULzLDfmmKgWmJn57019991 = -309939817; float FFMiDrBmlULzLDfmmKgWmJn7193690 = -114720114; float FFMiDrBmlULzLDfmmKgWmJn12204146 = -428133242; float FFMiDrBmlULzLDfmmKgWmJn76265242 = -291070719; float FFMiDrBmlULzLDfmmKgWmJn9050753 = -789259616; float FFMiDrBmlULzLDfmmKgWmJn83656756 = -782445643; float FFMiDrBmlULzLDfmmKgWmJn73091970 = -244615163; float FFMiDrBmlULzLDfmmKgWmJn24859769 = -622755597; float FFMiDrBmlULzLDfmmKgWmJn76361710 = -107664494; float FFMiDrBmlULzLDfmmKgWmJn85826371 = -584315603; float FFMiDrBmlULzLDfmmKgWmJn57651889 = -787523658; float FFMiDrBmlULzLDfmmKgWmJn61686381 = -616430865; float FFMiDrBmlULzLDfmmKgWmJn46539086 = -702280366; float FFMiDrBmlULzLDfmmKgWmJn7550306 = -494394118; float FFMiDrBmlULzLDfmmKgWmJn6407361 = -545386636; float FFMiDrBmlULzLDfmmKgWmJn42916939 = -748409968; float FFMiDrBmlULzLDfmmKgWmJn42970231 = 13728905; float FFMiDrBmlULzLDfmmKgWmJn33171348 = -739837923; float FFMiDrBmlULzLDfmmKgWmJn78474528 = 41703622; float FFMiDrBmlULzLDfmmKgWmJn31027985 = -702896390; float FFMiDrBmlULzLDfmmKgWmJn15258097 = -633476100; float FFMiDrBmlULzLDfmmKgWmJn22974398 = -851777270; float FFMiDrBmlULzLDfmmKgWmJn19060686 = -108672307; float FFMiDrBmlULzLDfmmKgWmJn70217511 = -48088592; float FFMiDrBmlULzLDfmmKgWmJn71391770 = -422858544; float FFMiDrBmlULzLDfmmKgWmJn22944513 = 15747174; float FFMiDrBmlULzLDfmmKgWmJn21396940 = -195514866; float FFMiDrBmlULzLDfmmKgWmJn15376897 = -644986211; float FFMiDrBmlULzLDfmmKgWmJn8501183 = -396828110; float FFMiDrBmlULzLDfmmKgWmJn78527467 = -826555110; float FFMiDrBmlULzLDfmmKgWmJn8578923 = -10966079; float FFMiDrBmlULzLDfmmKgWmJn97075370 = -952491343; float FFMiDrBmlULzLDfmmKgWmJn11936656 = -288157810; float FFMiDrBmlULzLDfmmKgWmJn48852315 = -777784219; float FFMiDrBmlULzLDfmmKgWmJn77529249 = 57942129; float FFMiDrBmlULzLDfmmKgWmJn21036480 = -292724617; float FFMiDrBmlULzLDfmmKgWmJn46281460 = -38598805; float FFMiDrBmlULzLDfmmKgWmJn87354345 = -987792389; float FFMiDrBmlULzLDfmmKgWmJn43501803 = -190958018; float FFMiDrBmlULzLDfmmKgWmJn42950268 = -83081310; float FFMiDrBmlULzLDfmmKgWmJn36487670 = -102766516; float FFMiDrBmlULzLDfmmKgWmJn20852254 = 22573408; float FFMiDrBmlULzLDfmmKgWmJn8244836 = -393311259; float FFMiDrBmlULzLDfmmKgWmJn65797604 = -132457606; float FFMiDrBmlULzLDfmmKgWmJn55296298 = -734156130; float FFMiDrBmlULzLDfmmKgWmJn12482470 = 78369101; float FFMiDrBmlULzLDfmmKgWmJn78166761 = -150476549; float FFMiDrBmlULzLDfmmKgWmJn82008943 = -598316280; float FFMiDrBmlULzLDfmmKgWmJn49818998 = -823262165; float FFMiDrBmlULzLDfmmKgWmJn15793695 = -363995067; float FFMiDrBmlULzLDfmmKgWmJn75393554 = -47230333; float FFMiDrBmlULzLDfmmKgWmJn58340893 = -110731727; float FFMiDrBmlULzLDfmmKgWmJn69819205 = -827187097; float FFMiDrBmlULzLDfmmKgWmJn75661724 = -645851332; FFMiDrBmlULzLDfmmKgWmJn85917534 = FFMiDrBmlULzLDfmmKgWmJn3020994; FFMiDrBmlULzLDfmmKgWmJn3020994 = FFMiDrBmlULzLDfmmKgWmJn80312747; FFMiDrBmlULzLDfmmKgWmJn80312747 = FFMiDrBmlULzLDfmmKgWmJn42844831; FFMiDrBmlULzLDfmmKgWmJn42844831 = FFMiDrBmlULzLDfmmKgWmJn42099546; FFMiDrBmlULzLDfmmKgWmJn42099546 = FFMiDrBmlULzLDfmmKgWmJn34637530; FFMiDrBmlULzLDfmmKgWmJn34637530 = FFMiDrBmlULzLDfmmKgWmJn1402545; FFMiDrBmlULzLDfmmKgWmJn1402545 = FFMiDrBmlULzLDfmmKgWmJn6589819; FFMiDrBmlULzLDfmmKgWmJn6589819 = FFMiDrBmlULzLDfmmKgWmJn85723902; FFMiDrBmlULzLDfmmKgWmJn85723902 = FFMiDrBmlULzLDfmmKgWmJn5081553; FFMiDrBmlULzLDfmmKgWmJn5081553 = FFMiDrBmlULzLDfmmKgWmJn40607625; FFMiDrBmlULzLDfmmKgWmJn40607625 = FFMiDrBmlULzLDfmmKgWmJn60970120; FFMiDrBmlULzLDfmmKgWmJn60970120 = FFMiDrBmlULzLDfmmKgWmJn7580945; FFMiDrBmlULzLDfmmKgWmJn7580945 = FFMiDrBmlULzLDfmmKgWmJn70684661; FFMiDrBmlULzLDfmmKgWmJn70684661 = FFMiDrBmlULzLDfmmKgWmJn83165698; FFMiDrBmlULzLDfmmKgWmJn83165698 = FFMiDrBmlULzLDfmmKgWmJn45560621; FFMiDrBmlULzLDfmmKgWmJn45560621 = FFMiDrBmlULzLDfmmKgWmJn47650360; FFMiDrBmlULzLDfmmKgWmJn47650360 = FFMiDrBmlULzLDfmmKgWmJn10956189; FFMiDrBmlULzLDfmmKgWmJn10956189 = FFMiDrBmlULzLDfmmKgWmJn71603255; FFMiDrBmlULzLDfmmKgWmJn71603255 = FFMiDrBmlULzLDfmmKgWmJn67211816; FFMiDrBmlULzLDfmmKgWmJn67211816 = FFMiDrBmlULzLDfmmKgWmJn96891252; FFMiDrBmlULzLDfmmKgWmJn96891252 = FFMiDrBmlULzLDfmmKgWmJn91164; FFMiDrBmlULzLDfmmKgWmJn91164 = FFMiDrBmlULzLDfmmKgWmJn45369104; FFMiDrBmlULzLDfmmKgWmJn45369104 = FFMiDrBmlULzLDfmmKgWmJn18626366; FFMiDrBmlULzLDfmmKgWmJn18626366 = FFMiDrBmlULzLDfmmKgWmJn96305744; FFMiDrBmlULzLDfmmKgWmJn96305744 = FFMiDrBmlULzLDfmmKgWmJn34549241; FFMiDrBmlULzLDfmmKgWmJn34549241 = FFMiDrBmlULzLDfmmKgWmJn28230169; FFMiDrBmlULzLDfmmKgWmJn28230169 = FFMiDrBmlULzLDfmmKgWmJn58485606; FFMiDrBmlULzLDfmmKgWmJn58485606 = FFMiDrBmlULzLDfmmKgWmJn63619588; FFMiDrBmlULzLDfmmKgWmJn63619588 = FFMiDrBmlULzLDfmmKgWmJn52552555; FFMiDrBmlULzLDfmmKgWmJn52552555 = FFMiDrBmlULzLDfmmKgWmJn26607025; FFMiDrBmlULzLDfmmKgWmJn26607025 = FFMiDrBmlULzLDfmmKgWmJn9579640; FFMiDrBmlULzLDfmmKgWmJn9579640 = FFMiDrBmlULzLDfmmKgWmJn45712023; FFMiDrBmlULzLDfmmKgWmJn45712023 = FFMiDrBmlULzLDfmmKgWmJn84606546; FFMiDrBmlULzLDfmmKgWmJn84606546 = FFMiDrBmlULzLDfmmKgWmJn51623975; FFMiDrBmlULzLDfmmKgWmJn51623975 = FFMiDrBmlULzLDfmmKgWmJn12948188; FFMiDrBmlULzLDfmmKgWmJn12948188 = FFMiDrBmlULzLDfmmKgWmJn74168850; FFMiDrBmlULzLDfmmKgWmJn74168850 = FFMiDrBmlULzLDfmmKgWmJn24705847; FFMiDrBmlULzLDfmmKgWmJn24705847 = FFMiDrBmlULzLDfmmKgWmJn89559249; FFMiDrBmlULzLDfmmKgWmJn89559249 = FFMiDrBmlULzLDfmmKgWmJn56226358; FFMiDrBmlULzLDfmmKgWmJn56226358 = FFMiDrBmlULzLDfmmKgWmJn58710633; FFMiDrBmlULzLDfmmKgWmJn58710633 = FFMiDrBmlULzLDfmmKgWmJn18363785; FFMiDrBmlULzLDfmmKgWmJn18363785 = FFMiDrBmlULzLDfmmKgWmJn91512240; FFMiDrBmlULzLDfmmKgWmJn91512240 = FFMiDrBmlULzLDfmmKgWmJn48293733; FFMiDrBmlULzLDfmmKgWmJn48293733 = FFMiDrBmlULzLDfmmKgWmJn6689710; FFMiDrBmlULzLDfmmKgWmJn6689710 = FFMiDrBmlULzLDfmmKgWmJn47453430; FFMiDrBmlULzLDfmmKgWmJn47453430 = FFMiDrBmlULzLDfmmKgWmJn57019991; FFMiDrBmlULzLDfmmKgWmJn57019991 = FFMiDrBmlULzLDfmmKgWmJn7193690; FFMiDrBmlULzLDfmmKgWmJn7193690 = FFMiDrBmlULzLDfmmKgWmJn12204146; FFMiDrBmlULzLDfmmKgWmJn12204146 = FFMiDrBmlULzLDfmmKgWmJn76265242; FFMiDrBmlULzLDfmmKgWmJn76265242 = FFMiDrBmlULzLDfmmKgWmJn9050753; FFMiDrBmlULzLDfmmKgWmJn9050753 = FFMiDrBmlULzLDfmmKgWmJn83656756; FFMiDrBmlULzLDfmmKgWmJn83656756 = FFMiDrBmlULzLDfmmKgWmJn73091970; FFMiDrBmlULzLDfmmKgWmJn73091970 = FFMiDrBmlULzLDfmmKgWmJn24859769; FFMiDrBmlULzLDfmmKgWmJn24859769 = FFMiDrBmlULzLDfmmKgWmJn76361710; FFMiDrBmlULzLDfmmKgWmJn76361710 = FFMiDrBmlULzLDfmmKgWmJn85826371; FFMiDrBmlULzLDfmmKgWmJn85826371 = FFMiDrBmlULzLDfmmKgWmJn57651889; FFMiDrBmlULzLDfmmKgWmJn57651889 = FFMiDrBmlULzLDfmmKgWmJn61686381; FFMiDrBmlULzLDfmmKgWmJn61686381 = FFMiDrBmlULzLDfmmKgWmJn46539086; FFMiDrBmlULzLDfmmKgWmJn46539086 = FFMiDrBmlULzLDfmmKgWmJn7550306; FFMiDrBmlULzLDfmmKgWmJn7550306 = FFMiDrBmlULzLDfmmKgWmJn6407361; FFMiDrBmlULzLDfmmKgWmJn6407361 = FFMiDrBmlULzLDfmmKgWmJn42916939; FFMiDrBmlULzLDfmmKgWmJn42916939 = FFMiDrBmlULzLDfmmKgWmJn42970231; FFMiDrBmlULzLDfmmKgWmJn42970231 = FFMiDrBmlULzLDfmmKgWmJn33171348; FFMiDrBmlULzLDfmmKgWmJn33171348 = FFMiDrBmlULzLDfmmKgWmJn78474528; FFMiDrBmlULzLDfmmKgWmJn78474528 = FFMiDrBmlULzLDfmmKgWmJn31027985; FFMiDrBmlULzLDfmmKgWmJn31027985 = FFMiDrBmlULzLDfmmKgWmJn15258097; FFMiDrBmlULzLDfmmKgWmJn15258097 = FFMiDrBmlULzLDfmmKgWmJn22974398; FFMiDrBmlULzLDfmmKgWmJn22974398 = FFMiDrBmlULzLDfmmKgWmJn19060686; FFMiDrBmlULzLDfmmKgWmJn19060686 = FFMiDrBmlULzLDfmmKgWmJn70217511; FFMiDrBmlULzLDfmmKgWmJn70217511 = FFMiDrBmlULzLDfmmKgWmJn71391770; FFMiDrBmlULzLDfmmKgWmJn71391770 = FFMiDrBmlULzLDfmmKgWmJn22944513; FFMiDrBmlULzLDfmmKgWmJn22944513 = FFMiDrBmlULzLDfmmKgWmJn21396940; FFMiDrBmlULzLDfmmKgWmJn21396940 = FFMiDrBmlULzLDfmmKgWmJn15376897; FFMiDrBmlULzLDfmmKgWmJn15376897 = FFMiDrBmlULzLDfmmKgWmJn8501183; FFMiDrBmlULzLDfmmKgWmJn8501183 = FFMiDrBmlULzLDfmmKgWmJn78527467; FFMiDrBmlULzLDfmmKgWmJn78527467 = FFMiDrBmlULzLDfmmKgWmJn8578923; FFMiDrBmlULzLDfmmKgWmJn8578923 = FFMiDrBmlULzLDfmmKgWmJn97075370; FFMiDrBmlULzLDfmmKgWmJn97075370 = FFMiDrBmlULzLDfmmKgWmJn11936656; FFMiDrBmlULzLDfmmKgWmJn11936656 = FFMiDrBmlULzLDfmmKgWmJn48852315; FFMiDrBmlULzLDfmmKgWmJn48852315 = FFMiDrBmlULzLDfmmKgWmJn77529249; FFMiDrBmlULzLDfmmKgWmJn77529249 = FFMiDrBmlULzLDfmmKgWmJn21036480; FFMiDrBmlULzLDfmmKgWmJn21036480 = FFMiDrBmlULzLDfmmKgWmJn46281460; FFMiDrBmlULzLDfmmKgWmJn46281460 = FFMiDrBmlULzLDfmmKgWmJn87354345; FFMiDrBmlULzLDfmmKgWmJn87354345 = FFMiDrBmlULzLDfmmKgWmJn43501803; FFMiDrBmlULzLDfmmKgWmJn43501803 = FFMiDrBmlULzLDfmmKgWmJn42950268; FFMiDrBmlULzLDfmmKgWmJn42950268 = FFMiDrBmlULzLDfmmKgWmJn36487670; FFMiDrBmlULzLDfmmKgWmJn36487670 = FFMiDrBmlULzLDfmmKgWmJn20852254; FFMiDrBmlULzLDfmmKgWmJn20852254 = FFMiDrBmlULzLDfmmKgWmJn8244836; FFMiDrBmlULzLDfmmKgWmJn8244836 = FFMiDrBmlULzLDfmmKgWmJn65797604; FFMiDrBmlULzLDfmmKgWmJn65797604 = FFMiDrBmlULzLDfmmKgWmJn55296298; FFMiDrBmlULzLDfmmKgWmJn55296298 = FFMiDrBmlULzLDfmmKgWmJn12482470; FFMiDrBmlULzLDfmmKgWmJn12482470 = FFMiDrBmlULzLDfmmKgWmJn78166761; FFMiDrBmlULzLDfmmKgWmJn78166761 = FFMiDrBmlULzLDfmmKgWmJn82008943; FFMiDrBmlULzLDfmmKgWmJn82008943 = FFMiDrBmlULzLDfmmKgWmJn49818998; FFMiDrBmlULzLDfmmKgWmJn49818998 = FFMiDrBmlULzLDfmmKgWmJn15793695; FFMiDrBmlULzLDfmmKgWmJn15793695 = FFMiDrBmlULzLDfmmKgWmJn75393554; FFMiDrBmlULzLDfmmKgWmJn75393554 = FFMiDrBmlULzLDfmmKgWmJn58340893; FFMiDrBmlULzLDfmmKgWmJn58340893 = FFMiDrBmlULzLDfmmKgWmJn69819205; FFMiDrBmlULzLDfmmKgWmJn69819205 = FFMiDrBmlULzLDfmmKgWmJn75661724; FFMiDrBmlULzLDfmmKgWmJn75661724 = FFMiDrBmlULzLDfmmKgWmJn85917534;}
void NPwhaWlrWbsbdooUaIdxtnrTKl58315800() { float zDaMAbfGikbOSfqGmSbLNxR69641052 = -995873399; float zDaMAbfGikbOSfqGmSbLNxR619089 = -429150326; float zDaMAbfGikbOSfqGmSbLNxR68898864 = -998844654; float zDaMAbfGikbOSfqGmSbLNxR39992784 = -543028951; float zDaMAbfGikbOSfqGmSbLNxR21660883 = -244339997; float zDaMAbfGikbOSfqGmSbLNxR45977047 = -156152036; float zDaMAbfGikbOSfqGmSbLNxR38283107 = -336656152; float zDaMAbfGikbOSfqGmSbLNxR49929901 = -985588787; float zDaMAbfGikbOSfqGmSbLNxR35943431 = -417538253; float zDaMAbfGikbOSfqGmSbLNxR51187141 = -146864345; float zDaMAbfGikbOSfqGmSbLNxR83496661 = 9436675; float zDaMAbfGikbOSfqGmSbLNxR51181890 = -262797559; float zDaMAbfGikbOSfqGmSbLNxR58634796 = -295585266; float zDaMAbfGikbOSfqGmSbLNxR65057805 = -275128378; float zDaMAbfGikbOSfqGmSbLNxR87344957 = -595465685; float zDaMAbfGikbOSfqGmSbLNxR17374650 = 14952041; float zDaMAbfGikbOSfqGmSbLNxR47515771 = -95889603; float zDaMAbfGikbOSfqGmSbLNxR25033458 = 923163; float zDaMAbfGikbOSfqGmSbLNxR12579737 = -902284250; float zDaMAbfGikbOSfqGmSbLNxR41319461 = -225526062; float zDaMAbfGikbOSfqGmSbLNxR64230762 = -634523058; float zDaMAbfGikbOSfqGmSbLNxR1093235 = -974691015; float zDaMAbfGikbOSfqGmSbLNxR14544969 = -867369554; float zDaMAbfGikbOSfqGmSbLNxR19769061 = 46661248; float zDaMAbfGikbOSfqGmSbLNxR32907838 = -914197418; float zDaMAbfGikbOSfqGmSbLNxR87541998 = -794964716; float zDaMAbfGikbOSfqGmSbLNxR49822108 = -951320154; float zDaMAbfGikbOSfqGmSbLNxR1084806 = -353173534; float zDaMAbfGikbOSfqGmSbLNxR35537730 = -803059007; float zDaMAbfGikbOSfqGmSbLNxR88100882 = -652824008; float zDaMAbfGikbOSfqGmSbLNxR7971448 = -84624973; float zDaMAbfGikbOSfqGmSbLNxR34372928 = -996578901; float zDaMAbfGikbOSfqGmSbLNxR59836724 = -265396279; float zDaMAbfGikbOSfqGmSbLNxR20331261 = 94927599; float zDaMAbfGikbOSfqGmSbLNxR19227301 = -551063817; float zDaMAbfGikbOSfqGmSbLNxR82809421 = -500076265; float zDaMAbfGikbOSfqGmSbLNxR73932441 = -958403060; float zDaMAbfGikbOSfqGmSbLNxR75087638 = -851900132; float zDaMAbfGikbOSfqGmSbLNxR50174968 = -398269279; float zDaMAbfGikbOSfqGmSbLNxR95415474 = -315295681; float zDaMAbfGikbOSfqGmSbLNxR23478155 = -862445161; float zDaMAbfGikbOSfqGmSbLNxR47703511 = -839527097; float zDaMAbfGikbOSfqGmSbLNxR24312387 = -602973904; float zDaMAbfGikbOSfqGmSbLNxR95489252 = -464427208; float zDaMAbfGikbOSfqGmSbLNxR34676960 = -351962368; float zDaMAbfGikbOSfqGmSbLNxR91720311 = -673114130; float zDaMAbfGikbOSfqGmSbLNxR90198960 = -331585724; float zDaMAbfGikbOSfqGmSbLNxR45935537 = -976842012; float zDaMAbfGikbOSfqGmSbLNxR46078359 = -127917393; float zDaMAbfGikbOSfqGmSbLNxR12138573 = -923086154; float zDaMAbfGikbOSfqGmSbLNxR49141584 = -955032018; float zDaMAbfGikbOSfqGmSbLNxR35162476 = -534498429; float zDaMAbfGikbOSfqGmSbLNxR18474373 = -256547529; float zDaMAbfGikbOSfqGmSbLNxR70792374 = -99464784; float zDaMAbfGikbOSfqGmSbLNxR94085038 = -424391439; float zDaMAbfGikbOSfqGmSbLNxR68547818 = 78817616; float zDaMAbfGikbOSfqGmSbLNxR86074119 = -561780772; float zDaMAbfGikbOSfqGmSbLNxR49129804 = -945505903; float zDaMAbfGikbOSfqGmSbLNxR7084947 = -628831534; float zDaMAbfGikbOSfqGmSbLNxR34118884 = -449375282; float zDaMAbfGikbOSfqGmSbLNxR96154939 = -204831882; float zDaMAbfGikbOSfqGmSbLNxR37198302 = -983482618; float zDaMAbfGikbOSfqGmSbLNxR14392172 = -82529781; float zDaMAbfGikbOSfqGmSbLNxR47842549 = -764714245; float zDaMAbfGikbOSfqGmSbLNxR43215693 = 37760627; float zDaMAbfGikbOSfqGmSbLNxR49123733 = 6015575; float zDaMAbfGikbOSfqGmSbLNxR91345166 = -997401280; float zDaMAbfGikbOSfqGmSbLNxR38303536 = -290512866; float zDaMAbfGikbOSfqGmSbLNxR45830505 = -724064562; float zDaMAbfGikbOSfqGmSbLNxR4535536 = 4610580; float zDaMAbfGikbOSfqGmSbLNxR43442209 = -26644899; float zDaMAbfGikbOSfqGmSbLNxR72428132 = -243989472; float zDaMAbfGikbOSfqGmSbLNxR74858490 = -600807558; float zDaMAbfGikbOSfqGmSbLNxR17164262 = -486988570; float zDaMAbfGikbOSfqGmSbLNxR17841307 = -363080901; float zDaMAbfGikbOSfqGmSbLNxR16527251 = -794995962; float zDaMAbfGikbOSfqGmSbLNxR76780847 = -271717112; float zDaMAbfGikbOSfqGmSbLNxR19055716 = -302942347; float zDaMAbfGikbOSfqGmSbLNxR85092100 = -601376384; float zDaMAbfGikbOSfqGmSbLNxR41187526 = -141083288; float zDaMAbfGikbOSfqGmSbLNxR97343037 = -363378992; float zDaMAbfGikbOSfqGmSbLNxR3886572 = -974478142; float zDaMAbfGikbOSfqGmSbLNxR55006447 = -125256142; float zDaMAbfGikbOSfqGmSbLNxR23399157 = -879972854; float zDaMAbfGikbOSfqGmSbLNxR38959299 = -697791991; float zDaMAbfGikbOSfqGmSbLNxR72808971 = -550126544; float zDaMAbfGikbOSfqGmSbLNxR15898556 = -640031372; float zDaMAbfGikbOSfqGmSbLNxR89044349 = -65931496; float zDaMAbfGikbOSfqGmSbLNxR26246223 = -480680962; float zDaMAbfGikbOSfqGmSbLNxR50679482 = -529881433; float zDaMAbfGikbOSfqGmSbLNxR96735301 = -938295493; float zDaMAbfGikbOSfqGmSbLNxR24802638 = 87102842; float zDaMAbfGikbOSfqGmSbLNxR68002692 = -123068599; float zDaMAbfGikbOSfqGmSbLNxR16056084 = -948893998; float zDaMAbfGikbOSfqGmSbLNxR99260535 = -10463799; float zDaMAbfGikbOSfqGmSbLNxR86279852 = -878962544; float zDaMAbfGikbOSfqGmSbLNxR33311340 = -656997317; float zDaMAbfGikbOSfqGmSbLNxR76469838 = -838259660; float zDaMAbfGikbOSfqGmSbLNxR52273560 = -402187835; float zDaMAbfGikbOSfqGmSbLNxR85553227 = -995873399; zDaMAbfGikbOSfqGmSbLNxR69641052 = zDaMAbfGikbOSfqGmSbLNxR619089; zDaMAbfGikbOSfqGmSbLNxR619089 = zDaMAbfGikbOSfqGmSbLNxR68898864; zDaMAbfGikbOSfqGmSbLNxR68898864 = zDaMAbfGikbOSfqGmSbLNxR39992784; zDaMAbfGikbOSfqGmSbLNxR39992784 = zDaMAbfGikbOSfqGmSbLNxR21660883; zDaMAbfGikbOSfqGmSbLNxR21660883 = zDaMAbfGikbOSfqGmSbLNxR45977047; zDaMAbfGikbOSfqGmSbLNxR45977047 = zDaMAbfGikbOSfqGmSbLNxR38283107; zDaMAbfGikbOSfqGmSbLNxR38283107 = zDaMAbfGikbOSfqGmSbLNxR49929901; zDaMAbfGikbOSfqGmSbLNxR49929901 = zDaMAbfGikbOSfqGmSbLNxR35943431; zDaMAbfGikbOSfqGmSbLNxR35943431 = zDaMAbfGikbOSfqGmSbLNxR51187141; zDaMAbfGikbOSfqGmSbLNxR51187141 = zDaMAbfGikbOSfqGmSbLNxR83496661; zDaMAbfGikbOSfqGmSbLNxR83496661 = zDaMAbfGikbOSfqGmSbLNxR51181890; zDaMAbfGikbOSfqGmSbLNxR51181890 = zDaMAbfGikbOSfqGmSbLNxR58634796; zDaMAbfGikbOSfqGmSbLNxR58634796 = zDaMAbfGikbOSfqGmSbLNxR65057805; zDaMAbfGikbOSfqGmSbLNxR65057805 = zDaMAbfGikbOSfqGmSbLNxR87344957; zDaMAbfGikbOSfqGmSbLNxR87344957 = zDaMAbfGikbOSfqGmSbLNxR17374650; zDaMAbfGikbOSfqGmSbLNxR17374650 = zDaMAbfGikbOSfqGmSbLNxR47515771; zDaMAbfGikbOSfqGmSbLNxR47515771 = zDaMAbfGikbOSfqGmSbLNxR25033458; zDaMAbfGikbOSfqGmSbLNxR25033458 = zDaMAbfGikbOSfqGmSbLNxR12579737; zDaMAbfGikbOSfqGmSbLNxR12579737 = zDaMAbfGikbOSfqGmSbLNxR41319461; zDaMAbfGikbOSfqGmSbLNxR41319461 = zDaMAbfGikbOSfqGmSbLNxR64230762; zDaMAbfGikbOSfqGmSbLNxR64230762 = zDaMAbfGikbOSfqGmSbLNxR1093235; zDaMAbfGikbOSfqGmSbLNxR1093235 = zDaMAbfGikbOSfqGmSbLNxR14544969; zDaMAbfGikbOSfqGmSbLNxR14544969 = zDaMAbfGikbOSfqGmSbLNxR19769061; zDaMAbfGikbOSfqGmSbLNxR19769061 = zDaMAbfGikbOSfqGmSbLNxR32907838; zDaMAbfGikbOSfqGmSbLNxR32907838 = zDaMAbfGikbOSfqGmSbLNxR87541998; zDaMAbfGikbOSfqGmSbLNxR87541998 = zDaMAbfGikbOSfqGmSbLNxR49822108; zDaMAbfGikbOSfqGmSbLNxR49822108 = zDaMAbfGikbOSfqGmSbLNxR1084806; zDaMAbfGikbOSfqGmSbLNxR1084806 = zDaMAbfGikbOSfqGmSbLNxR35537730; zDaMAbfGikbOSfqGmSbLNxR35537730 = zDaMAbfGikbOSfqGmSbLNxR88100882; zDaMAbfGikbOSfqGmSbLNxR88100882 = zDaMAbfGikbOSfqGmSbLNxR7971448; zDaMAbfGikbOSfqGmSbLNxR7971448 = zDaMAbfGikbOSfqGmSbLNxR34372928; zDaMAbfGikbOSfqGmSbLNxR34372928 = zDaMAbfGikbOSfqGmSbLNxR59836724; zDaMAbfGikbOSfqGmSbLNxR59836724 = zDaMAbfGikbOSfqGmSbLNxR20331261; zDaMAbfGikbOSfqGmSbLNxR20331261 = zDaMAbfGikbOSfqGmSbLNxR19227301; zDaMAbfGikbOSfqGmSbLNxR19227301 = zDaMAbfGikbOSfqGmSbLNxR82809421; zDaMAbfGikbOSfqGmSbLNxR82809421 = zDaMAbfGikbOSfqGmSbLNxR73932441; zDaMAbfGikbOSfqGmSbLNxR73932441 = zDaMAbfGikbOSfqGmSbLNxR75087638; zDaMAbfGikbOSfqGmSbLNxR75087638 = zDaMAbfGikbOSfqGmSbLNxR50174968; zDaMAbfGikbOSfqGmSbLNxR50174968 = zDaMAbfGikbOSfqGmSbLNxR95415474; zDaMAbfGikbOSfqGmSbLNxR95415474 = zDaMAbfGikbOSfqGmSbLNxR23478155; zDaMAbfGikbOSfqGmSbLNxR23478155 = zDaMAbfGikbOSfqGmSbLNxR47703511; zDaMAbfGikbOSfqGmSbLNxR47703511 = zDaMAbfGikbOSfqGmSbLNxR24312387; zDaMAbfGikbOSfqGmSbLNxR24312387 = zDaMAbfGikbOSfqGmSbLNxR95489252; zDaMAbfGikbOSfqGmSbLNxR95489252 = zDaMAbfGikbOSfqGmSbLNxR34676960; zDaMAbfGikbOSfqGmSbLNxR34676960 = zDaMAbfGikbOSfqGmSbLNxR91720311; zDaMAbfGikbOSfqGmSbLNxR91720311 = zDaMAbfGikbOSfqGmSbLNxR90198960; zDaMAbfGikbOSfqGmSbLNxR90198960 = zDaMAbfGikbOSfqGmSbLNxR45935537; zDaMAbfGikbOSfqGmSbLNxR45935537 = zDaMAbfGikbOSfqGmSbLNxR46078359; zDaMAbfGikbOSfqGmSbLNxR46078359 = zDaMAbfGikbOSfqGmSbLNxR12138573; zDaMAbfGikbOSfqGmSbLNxR12138573 = zDaMAbfGikbOSfqGmSbLNxR49141584; zDaMAbfGikbOSfqGmSbLNxR49141584 = zDaMAbfGikbOSfqGmSbLNxR35162476; zDaMAbfGikbOSfqGmSbLNxR35162476 = zDaMAbfGikbOSfqGmSbLNxR18474373; zDaMAbfGikbOSfqGmSbLNxR18474373 = zDaMAbfGikbOSfqGmSbLNxR70792374; zDaMAbfGikbOSfqGmSbLNxR70792374 = zDaMAbfGikbOSfqGmSbLNxR94085038; zDaMAbfGikbOSfqGmSbLNxR94085038 = zDaMAbfGikbOSfqGmSbLNxR68547818; zDaMAbfGikbOSfqGmSbLNxR68547818 = zDaMAbfGikbOSfqGmSbLNxR86074119; zDaMAbfGikbOSfqGmSbLNxR86074119 = zDaMAbfGikbOSfqGmSbLNxR49129804; zDaMAbfGikbOSfqGmSbLNxR49129804 = zDaMAbfGikbOSfqGmSbLNxR7084947; zDaMAbfGikbOSfqGmSbLNxR7084947 = zDaMAbfGikbOSfqGmSbLNxR34118884; zDaMAbfGikbOSfqGmSbLNxR34118884 = zDaMAbfGikbOSfqGmSbLNxR96154939; zDaMAbfGikbOSfqGmSbLNxR96154939 = zDaMAbfGikbOSfqGmSbLNxR37198302; zDaMAbfGikbOSfqGmSbLNxR37198302 = zDaMAbfGikbOSfqGmSbLNxR14392172; zDaMAbfGikbOSfqGmSbLNxR14392172 = zDaMAbfGikbOSfqGmSbLNxR47842549; zDaMAbfGikbOSfqGmSbLNxR47842549 = zDaMAbfGikbOSfqGmSbLNxR43215693; zDaMAbfGikbOSfqGmSbLNxR43215693 = zDaMAbfGikbOSfqGmSbLNxR49123733; zDaMAbfGikbOSfqGmSbLNxR49123733 = zDaMAbfGikbOSfqGmSbLNxR91345166; zDaMAbfGikbOSfqGmSbLNxR91345166 = zDaMAbfGikbOSfqGmSbLNxR38303536; zDaMAbfGikbOSfqGmSbLNxR38303536 = zDaMAbfGikbOSfqGmSbLNxR45830505; zDaMAbfGikbOSfqGmSbLNxR45830505 = zDaMAbfGikbOSfqGmSbLNxR4535536; zDaMAbfGikbOSfqGmSbLNxR4535536 = zDaMAbfGikbOSfqGmSbLNxR43442209; zDaMAbfGikbOSfqGmSbLNxR43442209 = zDaMAbfGikbOSfqGmSbLNxR72428132; zDaMAbfGikbOSfqGmSbLNxR72428132 = zDaMAbfGikbOSfqGmSbLNxR74858490; zDaMAbfGikbOSfqGmSbLNxR74858490 = zDaMAbfGikbOSfqGmSbLNxR17164262; zDaMAbfGikbOSfqGmSbLNxR17164262 = zDaMAbfGikbOSfqGmSbLNxR17841307; zDaMAbfGikbOSfqGmSbLNxR17841307 = zDaMAbfGikbOSfqGmSbLNxR16527251; zDaMAbfGikbOSfqGmSbLNxR16527251 = zDaMAbfGikbOSfqGmSbLNxR76780847; zDaMAbfGikbOSfqGmSbLNxR76780847 = zDaMAbfGikbOSfqGmSbLNxR19055716; zDaMAbfGikbOSfqGmSbLNxR19055716 = zDaMAbfGikbOSfqGmSbLNxR85092100; zDaMAbfGikbOSfqGmSbLNxR85092100 = zDaMAbfGikbOSfqGmSbLNxR41187526; zDaMAbfGikbOSfqGmSbLNxR41187526 = zDaMAbfGikbOSfqGmSbLNxR97343037; zDaMAbfGikbOSfqGmSbLNxR97343037 = zDaMAbfGikbOSfqGmSbLNxR3886572; zDaMAbfGikbOSfqGmSbLNxR3886572 = zDaMAbfGikbOSfqGmSbLNxR55006447; zDaMAbfGikbOSfqGmSbLNxR55006447 = zDaMAbfGikbOSfqGmSbLNxR23399157; zDaMAbfGikbOSfqGmSbLNxR23399157 = zDaMAbfGikbOSfqGmSbLNxR38959299; zDaMAbfGikbOSfqGmSbLNxR38959299 = zDaMAbfGikbOSfqGmSbLNxR72808971; zDaMAbfGikbOSfqGmSbLNxR72808971 = zDaMAbfGikbOSfqGmSbLNxR15898556; zDaMAbfGikbOSfqGmSbLNxR15898556 = zDaMAbfGikbOSfqGmSbLNxR89044349; zDaMAbfGikbOSfqGmSbLNxR89044349 = zDaMAbfGikbOSfqGmSbLNxR26246223; zDaMAbfGikbOSfqGmSbLNxR26246223 = zDaMAbfGikbOSfqGmSbLNxR50679482; zDaMAbfGikbOSfqGmSbLNxR50679482 = zDaMAbfGikbOSfqGmSbLNxR96735301; zDaMAbfGikbOSfqGmSbLNxR96735301 = zDaMAbfGikbOSfqGmSbLNxR24802638; zDaMAbfGikbOSfqGmSbLNxR24802638 = zDaMAbfGikbOSfqGmSbLNxR68002692; zDaMAbfGikbOSfqGmSbLNxR68002692 = zDaMAbfGikbOSfqGmSbLNxR16056084; zDaMAbfGikbOSfqGmSbLNxR16056084 = zDaMAbfGikbOSfqGmSbLNxR99260535; zDaMAbfGikbOSfqGmSbLNxR99260535 = zDaMAbfGikbOSfqGmSbLNxR86279852; zDaMAbfGikbOSfqGmSbLNxR86279852 = zDaMAbfGikbOSfqGmSbLNxR33311340; zDaMAbfGikbOSfqGmSbLNxR33311340 = zDaMAbfGikbOSfqGmSbLNxR76469838; zDaMAbfGikbOSfqGmSbLNxR76469838 = zDaMAbfGikbOSfqGmSbLNxR52273560; zDaMAbfGikbOSfqGmSbLNxR52273560 = zDaMAbfGikbOSfqGmSbLNxR85553227; zDaMAbfGikbOSfqGmSbLNxR85553227 = zDaMAbfGikbOSfqGmSbLNxR69641052;}
void OpPchvylkDpLoezALiAuUopwCp43378638() { float BTEdYmubMZTcylFRPUdOugp53364570 = -245895466; float BTEdYmubMZTcylFRPUdOugp98217184 = -232802177; float BTEdYmubMZTcylFRPUdOugp57484981 = -867152345; float BTEdYmubMZTcylFRPUdOugp37140737 = -547910880; float BTEdYmubMZTcylFRPUdOugp1222219 = -642288188; float BTEdYmubMZTcylFRPUdOugp57316565 = -259472704; float BTEdYmubMZTcylFRPUdOugp75163670 = -358170290; float BTEdYmubMZTcylFRPUdOugp93269983 = -506043374; float BTEdYmubMZTcylFRPUdOugp86162959 = -15020949; float BTEdYmubMZTcylFRPUdOugp97292729 = -369905361; float BTEdYmubMZTcylFRPUdOugp26385697 = -930848583; float BTEdYmubMZTcylFRPUdOugp41393661 = -191936830; float BTEdYmubMZTcylFRPUdOugp9688649 = -138417509; float BTEdYmubMZTcylFRPUdOugp59430950 = -624811241; float BTEdYmubMZTcylFRPUdOugp91524215 = -521162990; float BTEdYmubMZTcylFRPUdOugp89188678 = 90824390; float BTEdYmubMZTcylFRPUdOugp47381181 = -254769466; float BTEdYmubMZTcylFRPUdOugp39110728 = -709928411; float BTEdYmubMZTcylFRPUdOugp53556217 = -690933488; float BTEdYmubMZTcylFRPUdOugp15427106 = -941818979; float BTEdYmubMZTcylFRPUdOugp31570273 = -208989579; float BTEdYmubMZTcylFRPUdOugp2095306 = -887846302; float BTEdYmubMZTcylFRPUdOugp83720834 = -896764291; float BTEdYmubMZTcylFRPUdOugp20911756 = -592571405; float BTEdYmubMZTcylFRPUdOugp69509930 = -992528179; float BTEdYmubMZTcylFRPUdOugp40534756 = -137931744; float BTEdYmubMZTcylFRPUdOugp71414047 = -295195577; float BTEdYmubMZTcylFRPUdOugp43684006 = -139615023; float BTEdYmubMZTcylFRPUdOugp7455871 = -227254908; float BTEdYmubMZTcylFRPUdOugp23649210 = -225430382; float BTEdYmubMZTcylFRPUdOugp89335870 = -303722993; float BTEdYmubMZTcylFRPUdOugp59166217 = -445776123; float BTEdYmubMZTcylFRPUdOugp73961425 = -930610371; float BTEdYmubMZTcylFRPUdOugp56055975 = -309169048; float BTEdYmubMZTcylFRPUdOugp86830625 = -285354424; float BTEdYmubMZTcylFRPUdOugp52670655 = -478472743; float BTEdYmubMZTcylFRPUdOugp73696031 = -178744356; float BTEdYmubMZTcylFRPUdOugp25469429 = -751043348; float BTEdYmubMZTcylFRPUdOugp10790688 = -703828160; float BTEdYmubMZTcylFRPUdOugp34604590 = -261942560; float BTEdYmubMZTcylFRPUdOugp88245675 = -512485288; float BTEdYmubMZTcylFRPUdOugp77043238 = -445552766; float BTEdYmubMZTcylFRPUdOugp57112533 = -255378159; float BTEdYmubMZTcylFRPUdOugp42684772 = -43370940; float BTEdYmubMZTcylFRPUdOugp62664211 = -677976446; float BTEdYmubMZTcylFRPUdOugp35987193 = -288145821; float BTEdYmubMZTcylFRPUdOugp23377931 = -353231631; float BTEdYmubMZTcylFRPUdOugp84677384 = -738963910; float BTEdYmubMZTcylFRPUdOugp79952572 = -927701544; float BTEdYmubMZTcylFRPUdOugp48011903 = -455101590; float BTEdYmubMZTcylFRPUdOugp89232415 = -20804419; float BTEdYmubMZTcylFRPUdOugp86668196 = -286551215; float BTEdYmubMZTcylFRPUdOugp63856775 = -268479895; float BTEdYmubMZTcylFRPUdOugp16724981 = -676173972; float BTEdYmubMZTcylFRPUdOugp11808366 = -741118384; float BTEdYmubMZTcylFRPUdOugp51269265 = -358049165; float BTEdYmubMZTcylFRPUdOugp14496350 = -336037887; float BTEdYmubMZTcylFRPUdOugp36573226 = -174580940; float BTEdYmubMZTcylFRPUdOugp67630806 = -555382701; float BTEdYmubMZTcylFRPUdOugp60687463 = -404356445; float BTEdYmubMZTcylFRPUdOugp85902517 = -964277128; float BTEdYmubMZTcylFRPUdOugp31479665 = -118555267; float BTEdYmubMZTcylFRPUdOugp85814113 = -178788466; float BTEdYmubMZTcylFRPUdOugp62513750 = -789590567; float BTEdYmubMZTcylFRPUdOugp7956859 = 33817632; float BTEdYmubMZTcylFRPUdOugp67219480 = -385072460; float BTEdYmubMZTcylFRPUdOugp67432235 = -261326460; float BTEdYmubMZTcylFRPUdOugp53632674 = -829248462; float BTEdYmubMZTcylFRPUdOugp72600324 = -239456817; float BTEdYmubMZTcylFRPUdOugp38853561 = 57309752; float BTEdYmubMZTcylFRPUdOugp15492647 = -730431254; float BTEdYmubMZTcylFRPUdOugp21911752 = -503726118; float BTEdYmubMZTcylFRPUdOugp28320041 = 93899749; float BTEdYmubMZTcylFRPUdOugp18951627 = -328990929; float BTEdYmubMZTcylFRPUdOugp27181431 = -329333691; float BTEdYmubMZTcylFRPUdOugp54527035 = -763436813; float BTEdYmubMZTcylFRPUdOugp44982772 = -532468144; float BTEdYmubMZTcylFRPUdOugp41036062 = -753393351; float BTEdYmubMZTcylFRPUdOugp58247545 = -914594959; float BTEdYmubMZTcylFRPUdOugp33522737 = -604382358; float BTEdYmubMZTcylFRPUdOugp17156826 = -784700113; float BTEdYmubMZTcylFRPUdOugp86736663 = -556231668; float BTEdYmubMZTcylFRPUdOugp63731434 = -211913479; float BTEdYmubMZTcylFRPUdOugp59443968 = -772153319; float BTEdYmubMZTcylFRPUdOugp34416794 = -104625964; float BTEdYmubMZTcylFRPUdOugp2667675 = 82828222; float BTEdYmubMZTcylFRPUdOugp95309442 = -77296229; float BTEdYmubMZTcylFRPUdOugp57236445 = -154436399; float BTEdYmubMZTcylFRPUdOugp44247609 = -568050665; float BTEdYmubMZTcylFRPUdOugp35561361 = -927305260; float BTEdYmubMZTcylFRPUdOugp38174305 = -42434856; float BTEdYmubMZTcylFRPUdOugp37122806 = 95836583; float BTEdYmubMZTcylFRPUdOugp57838623 = -95660648; float BTEdYmubMZTcylFRPUdOugp50103224 = -199471716; float BTEdYmubMZTcylFRPUdOugp48702073 = -297665433; float BTEdYmubMZTcylFRPUdOugp56766011 = -293930021; float BTEdYmubMZTcylFRPUdOugp91229125 = -166764300; float BTEdYmubMZTcylFRPUdOugp94598783 = -465787592; float BTEdYmubMZTcylFRPUdOugp34727914 = 22811428; float BTEdYmubMZTcylFRPUdOugp95444730 = -245895466; BTEdYmubMZTcylFRPUdOugp53364570 = BTEdYmubMZTcylFRPUdOugp98217184; BTEdYmubMZTcylFRPUdOugp98217184 = BTEdYmubMZTcylFRPUdOugp57484981; BTEdYmubMZTcylFRPUdOugp57484981 = BTEdYmubMZTcylFRPUdOugp37140737; BTEdYmubMZTcylFRPUdOugp37140737 = BTEdYmubMZTcylFRPUdOugp1222219; BTEdYmubMZTcylFRPUdOugp1222219 = BTEdYmubMZTcylFRPUdOugp57316565; BTEdYmubMZTcylFRPUdOugp57316565 = BTEdYmubMZTcylFRPUdOugp75163670; BTEdYmubMZTcylFRPUdOugp75163670 = BTEdYmubMZTcylFRPUdOugp93269983; BTEdYmubMZTcylFRPUdOugp93269983 = BTEdYmubMZTcylFRPUdOugp86162959; BTEdYmubMZTcylFRPUdOugp86162959 = BTEdYmubMZTcylFRPUdOugp97292729; BTEdYmubMZTcylFRPUdOugp97292729 = BTEdYmubMZTcylFRPUdOugp26385697; BTEdYmubMZTcylFRPUdOugp26385697 = BTEdYmubMZTcylFRPUdOugp41393661; BTEdYmubMZTcylFRPUdOugp41393661 = BTEdYmubMZTcylFRPUdOugp9688649; BTEdYmubMZTcylFRPUdOugp9688649 = BTEdYmubMZTcylFRPUdOugp59430950; BTEdYmubMZTcylFRPUdOugp59430950 = BTEdYmubMZTcylFRPUdOugp91524215; BTEdYmubMZTcylFRPUdOugp91524215 = BTEdYmubMZTcylFRPUdOugp89188678; BTEdYmubMZTcylFRPUdOugp89188678 = BTEdYmubMZTcylFRPUdOugp47381181; BTEdYmubMZTcylFRPUdOugp47381181 = BTEdYmubMZTcylFRPUdOugp39110728; BTEdYmubMZTcylFRPUdOugp39110728 = BTEdYmubMZTcylFRPUdOugp53556217; BTEdYmubMZTcylFRPUdOugp53556217 = BTEdYmubMZTcylFRPUdOugp15427106; BTEdYmubMZTcylFRPUdOugp15427106 = BTEdYmubMZTcylFRPUdOugp31570273; BTEdYmubMZTcylFRPUdOugp31570273 = BTEdYmubMZTcylFRPUdOugp2095306; BTEdYmubMZTcylFRPUdOugp2095306 = BTEdYmubMZTcylFRPUdOugp83720834; BTEdYmubMZTcylFRPUdOugp83720834 = BTEdYmubMZTcylFRPUdOugp20911756; BTEdYmubMZTcylFRPUdOugp20911756 = BTEdYmubMZTcylFRPUdOugp69509930; BTEdYmubMZTcylFRPUdOugp69509930 = BTEdYmubMZTcylFRPUdOugp40534756; BTEdYmubMZTcylFRPUdOugp40534756 = BTEdYmubMZTcylFRPUdOugp71414047; BTEdYmubMZTcylFRPUdOugp71414047 = BTEdYmubMZTcylFRPUdOugp43684006; BTEdYmubMZTcylFRPUdOugp43684006 = BTEdYmubMZTcylFRPUdOugp7455871; BTEdYmubMZTcylFRPUdOugp7455871 = BTEdYmubMZTcylFRPUdOugp23649210; BTEdYmubMZTcylFRPUdOugp23649210 = BTEdYmubMZTcylFRPUdOugp89335870; BTEdYmubMZTcylFRPUdOugp89335870 = BTEdYmubMZTcylFRPUdOugp59166217; BTEdYmubMZTcylFRPUdOugp59166217 = BTEdYmubMZTcylFRPUdOugp73961425; BTEdYmubMZTcylFRPUdOugp73961425 = BTEdYmubMZTcylFRPUdOugp56055975; BTEdYmubMZTcylFRPUdOugp56055975 = BTEdYmubMZTcylFRPUdOugp86830625; BTEdYmubMZTcylFRPUdOugp86830625 = BTEdYmubMZTcylFRPUdOugp52670655; BTEdYmubMZTcylFRPUdOugp52670655 = BTEdYmubMZTcylFRPUdOugp73696031; BTEdYmubMZTcylFRPUdOugp73696031 = BTEdYmubMZTcylFRPUdOugp25469429; BTEdYmubMZTcylFRPUdOugp25469429 = BTEdYmubMZTcylFRPUdOugp10790688; BTEdYmubMZTcylFRPUdOugp10790688 = BTEdYmubMZTcylFRPUdOugp34604590; BTEdYmubMZTcylFRPUdOugp34604590 = BTEdYmubMZTcylFRPUdOugp88245675; BTEdYmubMZTcylFRPUdOugp88245675 = BTEdYmubMZTcylFRPUdOugp77043238; BTEdYmubMZTcylFRPUdOugp77043238 = BTEdYmubMZTcylFRPUdOugp57112533; BTEdYmubMZTcylFRPUdOugp57112533 = BTEdYmubMZTcylFRPUdOugp42684772; BTEdYmubMZTcylFRPUdOugp42684772 = BTEdYmubMZTcylFRPUdOugp62664211; BTEdYmubMZTcylFRPUdOugp62664211 = BTEdYmubMZTcylFRPUdOugp35987193; BTEdYmubMZTcylFRPUdOugp35987193 = BTEdYmubMZTcylFRPUdOugp23377931; BTEdYmubMZTcylFRPUdOugp23377931 = BTEdYmubMZTcylFRPUdOugp84677384; BTEdYmubMZTcylFRPUdOugp84677384 = BTEdYmubMZTcylFRPUdOugp79952572; BTEdYmubMZTcylFRPUdOugp79952572 = BTEdYmubMZTcylFRPUdOugp48011903; BTEdYmubMZTcylFRPUdOugp48011903 = BTEdYmubMZTcylFRPUdOugp89232415; BTEdYmubMZTcylFRPUdOugp89232415 = BTEdYmubMZTcylFRPUdOugp86668196; BTEdYmubMZTcylFRPUdOugp86668196 = BTEdYmubMZTcylFRPUdOugp63856775; BTEdYmubMZTcylFRPUdOugp63856775 = BTEdYmubMZTcylFRPUdOugp16724981; BTEdYmubMZTcylFRPUdOugp16724981 = BTEdYmubMZTcylFRPUdOugp11808366; BTEdYmubMZTcylFRPUdOugp11808366 = BTEdYmubMZTcylFRPUdOugp51269265; BTEdYmubMZTcylFRPUdOugp51269265 = BTEdYmubMZTcylFRPUdOugp14496350; BTEdYmubMZTcylFRPUdOugp14496350 = BTEdYmubMZTcylFRPUdOugp36573226; BTEdYmubMZTcylFRPUdOugp36573226 = BTEdYmubMZTcylFRPUdOugp67630806; BTEdYmubMZTcylFRPUdOugp67630806 = BTEdYmubMZTcylFRPUdOugp60687463; BTEdYmubMZTcylFRPUdOugp60687463 = BTEdYmubMZTcylFRPUdOugp85902517; BTEdYmubMZTcylFRPUdOugp85902517 = BTEdYmubMZTcylFRPUdOugp31479665; BTEdYmubMZTcylFRPUdOugp31479665 = BTEdYmubMZTcylFRPUdOugp85814113; BTEdYmubMZTcylFRPUdOugp85814113 = BTEdYmubMZTcylFRPUdOugp62513750; BTEdYmubMZTcylFRPUdOugp62513750 = BTEdYmubMZTcylFRPUdOugp7956859; BTEdYmubMZTcylFRPUdOugp7956859 = BTEdYmubMZTcylFRPUdOugp67219480; BTEdYmubMZTcylFRPUdOugp67219480 = BTEdYmubMZTcylFRPUdOugp67432235; BTEdYmubMZTcylFRPUdOugp67432235 = BTEdYmubMZTcylFRPUdOugp53632674; BTEdYmubMZTcylFRPUdOugp53632674 = BTEdYmubMZTcylFRPUdOugp72600324; BTEdYmubMZTcylFRPUdOugp72600324 = BTEdYmubMZTcylFRPUdOugp38853561; BTEdYmubMZTcylFRPUdOugp38853561 = BTEdYmubMZTcylFRPUdOugp15492647; BTEdYmubMZTcylFRPUdOugp15492647 = BTEdYmubMZTcylFRPUdOugp21911752; BTEdYmubMZTcylFRPUdOugp21911752 = BTEdYmubMZTcylFRPUdOugp28320041; BTEdYmubMZTcylFRPUdOugp28320041 = BTEdYmubMZTcylFRPUdOugp18951627; BTEdYmubMZTcylFRPUdOugp18951627 = BTEdYmubMZTcylFRPUdOugp27181431; BTEdYmubMZTcylFRPUdOugp27181431 = BTEdYmubMZTcylFRPUdOugp54527035; BTEdYmubMZTcylFRPUdOugp54527035 = BTEdYmubMZTcylFRPUdOugp44982772; BTEdYmubMZTcylFRPUdOugp44982772 = BTEdYmubMZTcylFRPUdOugp41036062; BTEdYmubMZTcylFRPUdOugp41036062 = BTEdYmubMZTcylFRPUdOugp58247545; BTEdYmubMZTcylFRPUdOugp58247545 = BTEdYmubMZTcylFRPUdOugp33522737; BTEdYmubMZTcylFRPUdOugp33522737 = BTEdYmubMZTcylFRPUdOugp17156826; BTEdYmubMZTcylFRPUdOugp17156826 = BTEdYmubMZTcylFRPUdOugp86736663; BTEdYmubMZTcylFRPUdOugp86736663 = BTEdYmubMZTcylFRPUdOugp63731434; BTEdYmubMZTcylFRPUdOugp63731434 = BTEdYmubMZTcylFRPUdOugp59443968; BTEdYmubMZTcylFRPUdOugp59443968 = BTEdYmubMZTcylFRPUdOugp34416794; BTEdYmubMZTcylFRPUdOugp34416794 = BTEdYmubMZTcylFRPUdOugp2667675; BTEdYmubMZTcylFRPUdOugp2667675 = BTEdYmubMZTcylFRPUdOugp95309442; BTEdYmubMZTcylFRPUdOugp95309442 = BTEdYmubMZTcylFRPUdOugp57236445; BTEdYmubMZTcylFRPUdOugp57236445 = BTEdYmubMZTcylFRPUdOugp44247609; BTEdYmubMZTcylFRPUdOugp44247609 = BTEdYmubMZTcylFRPUdOugp35561361; BTEdYmubMZTcylFRPUdOugp35561361 = BTEdYmubMZTcylFRPUdOugp38174305; BTEdYmubMZTcylFRPUdOugp38174305 = BTEdYmubMZTcylFRPUdOugp37122806; BTEdYmubMZTcylFRPUdOugp37122806 = BTEdYmubMZTcylFRPUdOugp57838623; BTEdYmubMZTcylFRPUdOugp57838623 = BTEdYmubMZTcylFRPUdOugp50103224; BTEdYmubMZTcylFRPUdOugp50103224 = BTEdYmubMZTcylFRPUdOugp48702073; BTEdYmubMZTcylFRPUdOugp48702073 = BTEdYmubMZTcylFRPUdOugp56766011; BTEdYmubMZTcylFRPUdOugp56766011 = BTEdYmubMZTcylFRPUdOugp91229125; BTEdYmubMZTcylFRPUdOugp91229125 = BTEdYmubMZTcylFRPUdOugp94598783; BTEdYmubMZTcylFRPUdOugp94598783 = BTEdYmubMZTcylFRPUdOugp34727914; BTEdYmubMZTcylFRPUdOugp34727914 = BTEdYmubMZTcylFRPUdOugp95444730; BTEdYmubMZTcylFRPUdOugp95444730 = BTEdYmubMZTcylFRPUdOugp53364570;}
void dDjRYuBcPiLSBLDGamTZnSQzwi28441476() { float BSHXiBnZYbyVpxqfRGsiQaq37088089 = -595917533; float BSHXiBnZYbyVpxqfRGsiQaq95815279 = -36454028; float BSHXiBnZYbyVpxqfRGsiQaq46071098 = -735460036; float BSHXiBnZYbyVpxqfRGsiQaq34288690 = -552792809; float BSHXiBnZYbyVpxqfRGsiQaq80783555 = 59763620; float BSHXiBnZYbyVpxqfRGsiQaq68656082 = -362793373; float BSHXiBnZYbyVpxqfRGsiQaq12044234 = -379684428; float BSHXiBnZYbyVpxqfRGsiQaq36610067 = -26497960; float BSHXiBnZYbyVpxqfRGsiQaq36382488 = -712503646; float BSHXiBnZYbyVpxqfRGsiQaq43398318 = -592946377; float BSHXiBnZYbyVpxqfRGsiQaq69274733 = -771133841; float BSHXiBnZYbyVpxqfRGsiQaq31605432 = -121076101; float BSHXiBnZYbyVpxqfRGsiQaq60742500 = 18750247; float BSHXiBnZYbyVpxqfRGsiQaq53804095 = -974494103; float BSHXiBnZYbyVpxqfRGsiQaq95703474 = -446860295; float BSHXiBnZYbyVpxqfRGsiQaq61002707 = -933303262; float BSHXiBnZYbyVpxqfRGsiQaq47246592 = -413649328; float BSHXiBnZYbyVpxqfRGsiQaq53187997 = -320779985; float BSHXiBnZYbyVpxqfRGsiQaq94532697 = -479582727; float BSHXiBnZYbyVpxqfRGsiQaq89534749 = -558111896; float BSHXiBnZYbyVpxqfRGsiQaq98909782 = -883456099; float BSHXiBnZYbyVpxqfRGsiQaq3097377 = -801001588; float BSHXiBnZYbyVpxqfRGsiQaq52896699 = -926159027; float BSHXiBnZYbyVpxqfRGsiQaq22054451 = -131804058; float BSHXiBnZYbyVpxqfRGsiQaq6112024 = 29141059; float BSHXiBnZYbyVpxqfRGsiQaq93527513 = -580898771; float BSHXiBnZYbyVpxqfRGsiQaq93005986 = -739071000; float BSHXiBnZYbyVpxqfRGsiQaq86283206 = 73943489; float BSHXiBnZYbyVpxqfRGsiQaq79374012 = -751450808; float BSHXiBnZYbyVpxqfRGsiQaq59197537 = -898036757; float BSHXiBnZYbyVpxqfRGsiQaq70700294 = -522821014; float BSHXiBnZYbyVpxqfRGsiQaq83959505 = -994973346; float BSHXiBnZYbyVpxqfRGsiQaq88086126 = -495824462; float BSHXiBnZYbyVpxqfRGsiQaq91780688 = -713265696; float BSHXiBnZYbyVpxqfRGsiQaq54433951 = -19645032; float BSHXiBnZYbyVpxqfRGsiQaq22531889 = -456869220; float BSHXiBnZYbyVpxqfRGsiQaq73459621 = -499085653; float BSHXiBnZYbyVpxqfRGsiQaq75851220 = -650186565; float BSHXiBnZYbyVpxqfRGsiQaq71406406 = 90612958; float BSHXiBnZYbyVpxqfRGsiQaq73793706 = -208589439; float BSHXiBnZYbyVpxqfRGsiQaq53013196 = -162525414; float BSHXiBnZYbyVpxqfRGsiQaq6382965 = -51578435; float BSHXiBnZYbyVpxqfRGsiQaq89912679 = 92217587; float BSHXiBnZYbyVpxqfRGsiQaq89880291 = -722314673; float BSHXiBnZYbyVpxqfRGsiQaq90651461 = 96009475; float BSHXiBnZYbyVpxqfRGsiQaq80254074 = 96822487; float BSHXiBnZYbyVpxqfRGsiQaq56556900 = -374877538; float BSHXiBnZYbyVpxqfRGsiQaq23419231 = -501085808; float BSHXiBnZYbyVpxqfRGsiQaq13826786 = -627485695; float BSHXiBnZYbyVpxqfRGsiQaq83885232 = 12882975; float BSHXiBnZYbyVpxqfRGsiQaq29323247 = -186576821; float BSHXiBnZYbyVpxqfRGsiQaq38173916 = -38604002; float BSHXiBnZYbyVpxqfRGsiQaq9239177 = -280412261; float BSHXiBnZYbyVpxqfRGsiQaq62657586 = -152883159; float BSHXiBnZYbyVpxqfRGsiQaq29531693 = 42154671; float BSHXiBnZYbyVpxqfRGsiQaq33990712 = -794915946; float BSHXiBnZYbyVpxqfRGsiQaq42918580 = -110295001; float BSHXiBnZYbyVpxqfRGsiQaq24016648 = -503655978; float BSHXiBnZYbyVpxqfRGsiQaq28176667 = -481933868; float BSHXiBnZYbyVpxqfRGsiQaq87256041 = -359337609; float BSHXiBnZYbyVpxqfRGsiQaq75650095 = -623722374; float BSHXiBnZYbyVpxqfRGsiQaq25761027 = -353627917; float BSHXiBnZYbyVpxqfRGsiQaq57236054 = -275047152; float BSHXiBnZYbyVpxqfRGsiQaq77184951 = -814466889; float BSHXiBnZYbyVpxqfRGsiQaq72698024 = 29874637; float BSHXiBnZYbyVpxqfRGsiQaq85315228 = -776160496; float BSHXiBnZYbyVpxqfRGsiQaq43519305 = -625251639; float BSHXiBnZYbyVpxqfRGsiQaq68961811 = -267984058; float BSHXiBnZYbyVpxqfRGsiQaq99370143 = -854849072; float BSHXiBnZYbyVpxqfRGsiQaq73171586 = -989991076; float BSHXiBnZYbyVpxqfRGsiQaq87543085 = -334217609; float BSHXiBnZYbyVpxqfRGsiQaq71395372 = -763462764; float BSHXiBnZYbyVpxqfRGsiQaq81781591 = -311392944; float BSHXiBnZYbyVpxqfRGsiQaq20738992 = -170993288; float BSHXiBnZYbyVpxqfRGsiQaq36521554 = -295586482; float BSHXiBnZYbyVpxqfRGsiQaq92526818 = -731877665; float BSHXiBnZYbyVpxqfRGsiQaq13184698 = -793219176; float BSHXiBnZYbyVpxqfRGsiQaq63016408 = -103844355; float BSHXiBnZYbyVpxqfRGsiQaq31402989 = -127813534; float BSHXiBnZYbyVpxqfRGsiQaq25857949 = 32318572; float BSHXiBnZYbyVpxqfRGsiQaq36970614 = -106021234; float BSHXiBnZYbyVpxqfRGsiQaq69586755 = -137985193; float BSHXiBnZYbyVpxqfRGsiQaq72456420 = -298570817; float BSHXiBnZYbyVpxqfRGsiQaq95488779 = -664333783; float BSHXiBnZYbyVpxqfRGsiQaq29874290 = -611459937; float BSHXiBnZYbyVpxqfRGsiQaq32526378 = -384217012; float BSHXiBnZYbyVpxqfRGsiQaq74720328 = -614561086; float BSHXiBnZYbyVpxqfRGsiQaq25428540 = -242941303; float BSHXiBnZYbyVpxqfRGsiQaq62248995 = -655420368; float BSHXiBnZYbyVpxqfRGsiQaq20443240 = -224729087; float BSHXiBnZYbyVpxqfRGsiQaq79613308 = -246574219; float BSHXiBnZYbyVpxqfRGsiQaq49442974 = -995429675; float BSHXiBnZYbyVpxqfRGsiQaq47674554 = -68252697; float BSHXiBnZYbyVpxqfRGsiQaq84150364 = -550049433; float BSHXiBnZYbyVpxqfRGsiQaq98143610 = -584867066; float BSHXiBnZYbyVpxqfRGsiQaq27252169 = -808897498; float BSHXiBnZYbyVpxqfRGsiQaq49146910 = -776531284; float BSHXiBnZYbyVpxqfRGsiQaq12727729 = -93315524; float BSHXiBnZYbyVpxqfRGsiQaq17182268 = -652189310; float BSHXiBnZYbyVpxqfRGsiQaq5336234 = -595917533; BSHXiBnZYbyVpxqfRGsiQaq37088089 = BSHXiBnZYbyVpxqfRGsiQaq95815279; BSHXiBnZYbyVpxqfRGsiQaq95815279 = BSHXiBnZYbyVpxqfRGsiQaq46071098; BSHXiBnZYbyVpxqfRGsiQaq46071098 = BSHXiBnZYbyVpxqfRGsiQaq34288690; BSHXiBnZYbyVpxqfRGsiQaq34288690 = BSHXiBnZYbyVpxqfRGsiQaq80783555; BSHXiBnZYbyVpxqfRGsiQaq80783555 = BSHXiBnZYbyVpxqfRGsiQaq68656082; BSHXiBnZYbyVpxqfRGsiQaq68656082 = BSHXiBnZYbyVpxqfRGsiQaq12044234; BSHXiBnZYbyVpxqfRGsiQaq12044234 = BSHXiBnZYbyVpxqfRGsiQaq36610067; BSHXiBnZYbyVpxqfRGsiQaq36610067 = BSHXiBnZYbyVpxqfRGsiQaq36382488; BSHXiBnZYbyVpxqfRGsiQaq36382488 = BSHXiBnZYbyVpxqfRGsiQaq43398318; BSHXiBnZYbyVpxqfRGsiQaq43398318 = BSHXiBnZYbyVpxqfRGsiQaq69274733; BSHXiBnZYbyVpxqfRGsiQaq69274733 = BSHXiBnZYbyVpxqfRGsiQaq31605432; BSHXiBnZYbyVpxqfRGsiQaq31605432 = BSHXiBnZYbyVpxqfRGsiQaq60742500; BSHXiBnZYbyVpxqfRGsiQaq60742500 = BSHXiBnZYbyVpxqfRGsiQaq53804095; BSHXiBnZYbyVpxqfRGsiQaq53804095 = BSHXiBnZYbyVpxqfRGsiQaq95703474; BSHXiBnZYbyVpxqfRGsiQaq95703474 = BSHXiBnZYbyVpxqfRGsiQaq61002707; BSHXiBnZYbyVpxqfRGsiQaq61002707 = BSHXiBnZYbyVpxqfRGsiQaq47246592; BSHXiBnZYbyVpxqfRGsiQaq47246592 = BSHXiBnZYbyVpxqfRGsiQaq53187997; BSHXiBnZYbyVpxqfRGsiQaq53187997 = BSHXiBnZYbyVpxqfRGsiQaq94532697; BSHXiBnZYbyVpxqfRGsiQaq94532697 = BSHXiBnZYbyVpxqfRGsiQaq89534749; BSHXiBnZYbyVpxqfRGsiQaq89534749 = BSHXiBnZYbyVpxqfRGsiQaq98909782; BSHXiBnZYbyVpxqfRGsiQaq98909782 = BSHXiBnZYbyVpxqfRGsiQaq3097377; BSHXiBnZYbyVpxqfRGsiQaq3097377 = BSHXiBnZYbyVpxqfRGsiQaq52896699; BSHXiBnZYbyVpxqfRGsiQaq52896699 = BSHXiBnZYbyVpxqfRGsiQaq22054451; BSHXiBnZYbyVpxqfRGsiQaq22054451 = BSHXiBnZYbyVpxqfRGsiQaq6112024; BSHXiBnZYbyVpxqfRGsiQaq6112024 = BSHXiBnZYbyVpxqfRGsiQaq93527513; BSHXiBnZYbyVpxqfRGsiQaq93527513 = BSHXiBnZYbyVpxqfRGsiQaq93005986; BSHXiBnZYbyVpxqfRGsiQaq93005986 = BSHXiBnZYbyVpxqfRGsiQaq86283206; BSHXiBnZYbyVpxqfRGsiQaq86283206 = BSHXiBnZYbyVpxqfRGsiQaq79374012; BSHXiBnZYbyVpxqfRGsiQaq79374012 = BSHXiBnZYbyVpxqfRGsiQaq59197537; BSHXiBnZYbyVpxqfRGsiQaq59197537 = BSHXiBnZYbyVpxqfRGsiQaq70700294; BSHXiBnZYbyVpxqfRGsiQaq70700294 = BSHXiBnZYbyVpxqfRGsiQaq83959505; BSHXiBnZYbyVpxqfRGsiQaq83959505 = BSHXiBnZYbyVpxqfRGsiQaq88086126; BSHXiBnZYbyVpxqfRGsiQaq88086126 = BSHXiBnZYbyVpxqfRGsiQaq91780688; BSHXiBnZYbyVpxqfRGsiQaq91780688 = BSHXiBnZYbyVpxqfRGsiQaq54433951; BSHXiBnZYbyVpxqfRGsiQaq54433951 = BSHXiBnZYbyVpxqfRGsiQaq22531889; BSHXiBnZYbyVpxqfRGsiQaq22531889 = BSHXiBnZYbyVpxqfRGsiQaq73459621; BSHXiBnZYbyVpxqfRGsiQaq73459621 = BSHXiBnZYbyVpxqfRGsiQaq75851220; BSHXiBnZYbyVpxqfRGsiQaq75851220 = BSHXiBnZYbyVpxqfRGsiQaq71406406; BSHXiBnZYbyVpxqfRGsiQaq71406406 = BSHXiBnZYbyVpxqfRGsiQaq73793706; BSHXiBnZYbyVpxqfRGsiQaq73793706 = BSHXiBnZYbyVpxqfRGsiQaq53013196; BSHXiBnZYbyVpxqfRGsiQaq53013196 = BSHXiBnZYbyVpxqfRGsiQaq6382965; BSHXiBnZYbyVpxqfRGsiQaq6382965 = BSHXiBnZYbyVpxqfRGsiQaq89912679; BSHXiBnZYbyVpxqfRGsiQaq89912679 = BSHXiBnZYbyVpxqfRGsiQaq89880291; BSHXiBnZYbyVpxqfRGsiQaq89880291 = BSHXiBnZYbyVpxqfRGsiQaq90651461; BSHXiBnZYbyVpxqfRGsiQaq90651461 = BSHXiBnZYbyVpxqfRGsiQaq80254074; BSHXiBnZYbyVpxqfRGsiQaq80254074 = BSHXiBnZYbyVpxqfRGsiQaq56556900; BSHXiBnZYbyVpxqfRGsiQaq56556900 = BSHXiBnZYbyVpxqfRGsiQaq23419231; BSHXiBnZYbyVpxqfRGsiQaq23419231 = BSHXiBnZYbyVpxqfRGsiQaq13826786; BSHXiBnZYbyVpxqfRGsiQaq13826786 = BSHXiBnZYbyVpxqfRGsiQaq83885232; BSHXiBnZYbyVpxqfRGsiQaq83885232 = BSHXiBnZYbyVpxqfRGsiQaq29323247; BSHXiBnZYbyVpxqfRGsiQaq29323247 = BSHXiBnZYbyVpxqfRGsiQaq38173916; BSHXiBnZYbyVpxqfRGsiQaq38173916 = BSHXiBnZYbyVpxqfRGsiQaq9239177; BSHXiBnZYbyVpxqfRGsiQaq9239177 = BSHXiBnZYbyVpxqfRGsiQaq62657586; BSHXiBnZYbyVpxqfRGsiQaq62657586 = BSHXiBnZYbyVpxqfRGsiQaq29531693; BSHXiBnZYbyVpxqfRGsiQaq29531693 = BSHXiBnZYbyVpxqfRGsiQaq33990712; BSHXiBnZYbyVpxqfRGsiQaq33990712 = BSHXiBnZYbyVpxqfRGsiQaq42918580; BSHXiBnZYbyVpxqfRGsiQaq42918580 = BSHXiBnZYbyVpxqfRGsiQaq24016648; BSHXiBnZYbyVpxqfRGsiQaq24016648 = BSHXiBnZYbyVpxqfRGsiQaq28176667; BSHXiBnZYbyVpxqfRGsiQaq28176667 = BSHXiBnZYbyVpxqfRGsiQaq87256041; BSHXiBnZYbyVpxqfRGsiQaq87256041 = BSHXiBnZYbyVpxqfRGsiQaq75650095; BSHXiBnZYbyVpxqfRGsiQaq75650095 = BSHXiBnZYbyVpxqfRGsiQaq25761027; BSHXiBnZYbyVpxqfRGsiQaq25761027 = BSHXiBnZYbyVpxqfRGsiQaq57236054; BSHXiBnZYbyVpxqfRGsiQaq57236054 = BSHXiBnZYbyVpxqfRGsiQaq77184951; BSHXiBnZYbyVpxqfRGsiQaq77184951 = BSHXiBnZYbyVpxqfRGsiQaq72698024; BSHXiBnZYbyVpxqfRGsiQaq72698024 = BSHXiBnZYbyVpxqfRGsiQaq85315228; BSHXiBnZYbyVpxqfRGsiQaq85315228 = BSHXiBnZYbyVpxqfRGsiQaq43519305; BSHXiBnZYbyVpxqfRGsiQaq43519305 = BSHXiBnZYbyVpxqfRGsiQaq68961811; BSHXiBnZYbyVpxqfRGsiQaq68961811 = BSHXiBnZYbyVpxqfRGsiQaq99370143; BSHXiBnZYbyVpxqfRGsiQaq99370143 = BSHXiBnZYbyVpxqfRGsiQaq73171586; BSHXiBnZYbyVpxqfRGsiQaq73171586 = BSHXiBnZYbyVpxqfRGsiQaq87543085; BSHXiBnZYbyVpxqfRGsiQaq87543085 = BSHXiBnZYbyVpxqfRGsiQaq71395372; BSHXiBnZYbyVpxqfRGsiQaq71395372 = BSHXiBnZYbyVpxqfRGsiQaq81781591; BSHXiBnZYbyVpxqfRGsiQaq81781591 = BSHXiBnZYbyVpxqfRGsiQaq20738992; BSHXiBnZYbyVpxqfRGsiQaq20738992 = BSHXiBnZYbyVpxqfRGsiQaq36521554; BSHXiBnZYbyVpxqfRGsiQaq36521554 = BSHXiBnZYbyVpxqfRGsiQaq92526818; BSHXiBnZYbyVpxqfRGsiQaq92526818 = BSHXiBnZYbyVpxqfRGsiQaq13184698; BSHXiBnZYbyVpxqfRGsiQaq13184698 = BSHXiBnZYbyVpxqfRGsiQaq63016408; BSHXiBnZYbyVpxqfRGsiQaq63016408 = BSHXiBnZYbyVpxqfRGsiQaq31402989; BSHXiBnZYbyVpxqfRGsiQaq31402989 = BSHXiBnZYbyVpxqfRGsiQaq25857949; BSHXiBnZYbyVpxqfRGsiQaq25857949 = BSHXiBnZYbyVpxqfRGsiQaq36970614; BSHXiBnZYbyVpxqfRGsiQaq36970614 = BSHXiBnZYbyVpxqfRGsiQaq69586755; BSHXiBnZYbyVpxqfRGsiQaq69586755 = BSHXiBnZYbyVpxqfRGsiQaq72456420; BSHXiBnZYbyVpxqfRGsiQaq72456420 = BSHXiBnZYbyVpxqfRGsiQaq95488779; BSHXiBnZYbyVpxqfRGsiQaq95488779 = BSHXiBnZYbyVpxqfRGsiQaq29874290; BSHXiBnZYbyVpxqfRGsiQaq29874290 = BSHXiBnZYbyVpxqfRGsiQaq32526378; BSHXiBnZYbyVpxqfRGsiQaq32526378 = BSHXiBnZYbyVpxqfRGsiQaq74720328; BSHXiBnZYbyVpxqfRGsiQaq74720328 = BSHXiBnZYbyVpxqfRGsiQaq25428540; BSHXiBnZYbyVpxqfRGsiQaq25428540 = BSHXiBnZYbyVpxqfRGsiQaq62248995; BSHXiBnZYbyVpxqfRGsiQaq62248995 = BSHXiBnZYbyVpxqfRGsiQaq20443240; BSHXiBnZYbyVpxqfRGsiQaq20443240 = BSHXiBnZYbyVpxqfRGsiQaq79613308; BSHXiBnZYbyVpxqfRGsiQaq79613308 = BSHXiBnZYbyVpxqfRGsiQaq49442974; BSHXiBnZYbyVpxqfRGsiQaq49442974 = BSHXiBnZYbyVpxqfRGsiQaq47674554; BSHXiBnZYbyVpxqfRGsiQaq47674554 = BSHXiBnZYbyVpxqfRGsiQaq84150364; BSHXiBnZYbyVpxqfRGsiQaq84150364 = BSHXiBnZYbyVpxqfRGsiQaq98143610; BSHXiBnZYbyVpxqfRGsiQaq98143610 = BSHXiBnZYbyVpxqfRGsiQaq27252169; BSHXiBnZYbyVpxqfRGsiQaq27252169 = BSHXiBnZYbyVpxqfRGsiQaq49146910; BSHXiBnZYbyVpxqfRGsiQaq49146910 = BSHXiBnZYbyVpxqfRGsiQaq12727729; BSHXiBnZYbyVpxqfRGsiQaq12727729 = BSHXiBnZYbyVpxqfRGsiQaq17182268; BSHXiBnZYbyVpxqfRGsiQaq17182268 = BSHXiBnZYbyVpxqfRGsiQaq5336234; BSHXiBnZYbyVpxqfRGsiQaq5336234 = BSHXiBnZYbyVpxqfRGsiQaq37088089;}
void JKbZPCTcJSCdeGxDGXhDZFyglp13504314() { float eYMFoqeTJIAbWGbxrAhpNjK20811607 = -945939600; float eYMFoqeTJIAbWGbxrAhpNjK93413375 = -940105879; float eYMFoqeTJIAbWGbxrAhpNjK34657216 = -603767726; float eYMFoqeTJIAbWGbxrAhpNjK31436643 = -557674737; float eYMFoqeTJIAbWGbxrAhpNjK60344892 = -338184571; float eYMFoqeTJIAbWGbxrAhpNjK79995600 = -466114042; float eYMFoqeTJIAbWGbxrAhpNjK48924796 = -401198566; float eYMFoqeTJIAbWGbxrAhpNjK79950149 = -646952546; float eYMFoqeTJIAbWGbxrAhpNjK86602016 = -309986342; float eYMFoqeTJIAbWGbxrAhpNjK89503906 = -815987392; float eYMFoqeTJIAbWGbxrAhpNjK12163769 = -611419099; float eYMFoqeTJIAbWGbxrAhpNjK21817203 = -50215372; float eYMFoqeTJIAbWGbxrAhpNjK11796352 = -924081997; float eYMFoqeTJIAbWGbxrAhpNjK48177239 = -224176965; float eYMFoqeTJIAbWGbxrAhpNjK99882732 = -372557600; float eYMFoqeTJIAbWGbxrAhpNjK32816735 = -857430913; float eYMFoqeTJIAbWGbxrAhpNjK47112003 = -572529191; float eYMFoqeTJIAbWGbxrAhpNjK67265267 = 68368441; float eYMFoqeTJIAbWGbxrAhpNjK35509178 = -268231965; float eYMFoqeTJIAbWGbxrAhpNjK63642394 = -174404813; float eYMFoqeTJIAbWGbxrAhpNjK66249293 = -457922620; float eYMFoqeTJIAbWGbxrAhpNjK4099448 = -714156874; float eYMFoqeTJIAbWGbxrAhpNjK22072565 = -955553764; float eYMFoqeTJIAbWGbxrAhpNjK23197146 = -771036711; float eYMFoqeTJIAbWGbxrAhpNjK42714116 = -49189702; float eYMFoqeTJIAbWGbxrAhpNjK46520271 = 76134201; float eYMFoqeTJIAbWGbxrAhpNjK14597927 = -82946423; float eYMFoqeTJIAbWGbxrAhpNjK28882406 = -812498000; float eYMFoqeTJIAbWGbxrAhpNjK51292154 = -175646708; float eYMFoqeTJIAbWGbxrAhpNjK94745864 = -470643131; float eYMFoqeTJIAbWGbxrAhpNjK52064717 = -741919034; float eYMFoqeTJIAbWGbxrAhpNjK8752794 = -444170568; float eYMFoqeTJIAbWGbxrAhpNjK2210828 = -61038553; float eYMFoqeTJIAbWGbxrAhpNjK27505403 = -17362344; float eYMFoqeTJIAbWGbxrAhpNjK22037277 = -853935639; float eYMFoqeTJIAbWGbxrAhpNjK92393121 = -435265697; float eYMFoqeTJIAbWGbxrAhpNjK73223211 = -819426949; float eYMFoqeTJIAbWGbxrAhpNjK26233012 = -549329782; float eYMFoqeTJIAbWGbxrAhpNjK32022126 = -214945923; float eYMFoqeTJIAbWGbxrAhpNjK12982822 = -155236319; float eYMFoqeTJIAbWGbxrAhpNjK17780717 = -912565541; float eYMFoqeTJIAbWGbxrAhpNjK35722691 = -757604105; float eYMFoqeTJIAbWGbxrAhpNjK22712826 = -660186667; float eYMFoqeTJIAbWGbxrAhpNjK37075811 = -301258405; float eYMFoqeTJIAbWGbxrAhpNjK18638713 = -230004603; float eYMFoqeTJIAbWGbxrAhpNjK24520956 = -618209205; float eYMFoqeTJIAbWGbxrAhpNjK89735869 = -396523445; float eYMFoqeTJIAbWGbxrAhpNjK62161078 = -263207705; float eYMFoqeTJIAbWGbxrAhpNjK47700999 = -327269846; float eYMFoqeTJIAbWGbxrAhpNjK19758563 = -619132460; float eYMFoqeTJIAbWGbxrAhpNjK69414079 = -352349222; float eYMFoqeTJIAbWGbxrAhpNjK89679635 = -890656788; float eYMFoqeTJIAbWGbxrAhpNjK54621579 = -292344626; float eYMFoqeTJIAbWGbxrAhpNjK8590193 = -729592347; float eYMFoqeTJIAbWGbxrAhpNjK47255021 = -274572274; float eYMFoqeTJIAbWGbxrAhpNjK16712159 = -131782727; float eYMFoqeTJIAbWGbxrAhpNjK71340810 = -984552115; float eYMFoqeTJIAbWGbxrAhpNjK11460070 = -832731015; float eYMFoqeTJIAbWGbxrAhpNjK88722527 = -408485036; float eYMFoqeTJIAbWGbxrAhpNjK13824621 = -314318773; float eYMFoqeTJIAbWGbxrAhpNjK65397674 = -283167619; float eYMFoqeTJIAbWGbxrAhpNjK20042390 = -588700567; float eYMFoqeTJIAbWGbxrAhpNjK28657996 = -371305838; float eYMFoqeTJIAbWGbxrAhpNjK91856152 = -839343211; float eYMFoqeTJIAbWGbxrAhpNjK37439189 = 25931642; float eYMFoqeTJIAbWGbxrAhpNjK3410976 = -67248531; float eYMFoqeTJIAbWGbxrAhpNjK19606375 = -989176819; float eYMFoqeTJIAbWGbxrAhpNjK84290949 = -806719653; float eYMFoqeTJIAbWGbxrAhpNjK26139963 = -370241326; float eYMFoqeTJIAbWGbxrAhpNjK7489612 = -937291904; float eYMFoqeTJIAbWGbxrAhpNjK59593524 = 61996036; float eYMFoqeTJIAbWGbxrAhpNjK20878992 = 76800590; float eYMFoqeTJIAbWGbxrAhpNjK35243142 = -716685636; float eYMFoqeTJIAbWGbxrAhpNjK22526357 = -12995646; float eYMFoqeTJIAbWGbxrAhpNjK45861678 = -261839272; float eYMFoqeTJIAbWGbxrAhpNjK30526602 = -700318516; float eYMFoqeTJIAbWGbxrAhpNjK81386622 = 46029792; float eYMFoqeTJIAbWGbxrAhpNjK84996753 = -554295360; float eYMFoqeTJIAbWGbxrAhpNjK4558434 = -441032109; float eYMFoqeTJIAbWGbxrAhpNjK18193160 = -430980498; float eYMFoqeTJIAbWGbxrAhpNjK56784402 = -527342354; float eYMFoqeTJIAbWGbxrAhpNjK52436848 = -819738718; float eYMFoqeTJIAbWGbxrAhpNjK81181407 = -385228154; float eYMFoqeTJIAbWGbxrAhpNjK31533592 = -556514248; float eYMFoqeTJIAbWGbxrAhpNjK25331786 = -18293910; float eYMFoqeTJIAbWGbxrAhpNjK62385081 = -851262247; float eYMFoqeTJIAbWGbxrAhpNjK54131214 = -51825943; float eYMFoqeTJIAbWGbxrAhpNjK93620635 = -331446207; float eYMFoqeTJIAbWGbxrAhpNjK80250382 = -742790070; float eYMFoqeTJIAbWGbxrAhpNjK5325119 = -622152913; float eYMFoqeTJIAbWGbxrAhpNjK21052312 = -450713582; float eYMFoqeTJIAbWGbxrAhpNjK61763142 = -986695934; float eYMFoqeTJIAbWGbxrAhpNjK37510485 = -40844747; float eYMFoqeTJIAbWGbxrAhpNjK18197505 = -900627151; float eYMFoqeTJIAbWGbxrAhpNjK47585148 = -872068700; float eYMFoqeTJIAbWGbxrAhpNjK97738326 = -223864975; float eYMFoqeTJIAbWGbxrAhpNjK7064696 = -286298267; float eYMFoqeTJIAbWGbxrAhpNjK30856674 = -820843457; float eYMFoqeTJIAbWGbxrAhpNjK99636621 = -227190047; float eYMFoqeTJIAbWGbxrAhpNjK15227737 = -945939600; eYMFoqeTJIAbWGbxrAhpNjK20811607 = eYMFoqeTJIAbWGbxrAhpNjK93413375; eYMFoqeTJIAbWGbxrAhpNjK93413375 = eYMFoqeTJIAbWGbxrAhpNjK34657216; eYMFoqeTJIAbWGbxrAhpNjK34657216 = eYMFoqeTJIAbWGbxrAhpNjK31436643; eYMFoqeTJIAbWGbxrAhpNjK31436643 = eYMFoqeTJIAbWGbxrAhpNjK60344892; eYMFoqeTJIAbWGbxrAhpNjK60344892 = eYMFoqeTJIAbWGbxrAhpNjK79995600; eYMFoqeTJIAbWGbxrAhpNjK79995600 = eYMFoqeTJIAbWGbxrAhpNjK48924796; eYMFoqeTJIAbWGbxrAhpNjK48924796 = eYMFoqeTJIAbWGbxrAhpNjK79950149; eYMFoqeTJIAbWGbxrAhpNjK79950149 = eYMFoqeTJIAbWGbxrAhpNjK86602016; eYMFoqeTJIAbWGbxrAhpNjK86602016 = eYMFoqeTJIAbWGbxrAhpNjK89503906; eYMFoqeTJIAbWGbxrAhpNjK89503906 = eYMFoqeTJIAbWGbxrAhpNjK12163769; eYMFoqeTJIAbWGbxrAhpNjK12163769 = eYMFoqeTJIAbWGbxrAhpNjK21817203; eYMFoqeTJIAbWGbxrAhpNjK21817203 = eYMFoqeTJIAbWGbxrAhpNjK11796352; eYMFoqeTJIAbWGbxrAhpNjK11796352 = eYMFoqeTJIAbWGbxrAhpNjK48177239; eYMFoqeTJIAbWGbxrAhpNjK48177239 = eYMFoqeTJIAbWGbxrAhpNjK99882732; eYMFoqeTJIAbWGbxrAhpNjK99882732 = eYMFoqeTJIAbWGbxrAhpNjK32816735; eYMFoqeTJIAbWGbxrAhpNjK32816735 = eYMFoqeTJIAbWGbxrAhpNjK47112003; eYMFoqeTJIAbWGbxrAhpNjK47112003 = eYMFoqeTJIAbWGbxrAhpNjK67265267; eYMFoqeTJIAbWGbxrAhpNjK67265267 = eYMFoqeTJIAbWGbxrAhpNjK35509178; eYMFoqeTJIAbWGbxrAhpNjK35509178 = eYMFoqeTJIAbWGbxrAhpNjK63642394; eYMFoqeTJIAbWGbxrAhpNjK63642394 = eYMFoqeTJIAbWGbxrAhpNjK66249293; eYMFoqeTJIAbWGbxrAhpNjK66249293 = eYMFoqeTJIAbWGbxrAhpNjK4099448; eYMFoqeTJIAbWGbxrAhpNjK4099448 = eYMFoqeTJIAbWGbxrAhpNjK22072565; eYMFoqeTJIAbWGbxrAhpNjK22072565 = eYMFoqeTJIAbWGbxrAhpNjK23197146; eYMFoqeTJIAbWGbxrAhpNjK23197146 = eYMFoqeTJIAbWGbxrAhpNjK42714116; eYMFoqeTJIAbWGbxrAhpNjK42714116 = eYMFoqeTJIAbWGbxrAhpNjK46520271; eYMFoqeTJIAbWGbxrAhpNjK46520271 = eYMFoqeTJIAbWGbxrAhpNjK14597927; eYMFoqeTJIAbWGbxrAhpNjK14597927 = eYMFoqeTJIAbWGbxrAhpNjK28882406; eYMFoqeTJIAbWGbxrAhpNjK28882406 = eYMFoqeTJIAbWGbxrAhpNjK51292154; eYMFoqeTJIAbWGbxrAhpNjK51292154 = eYMFoqeTJIAbWGbxrAhpNjK94745864; eYMFoqeTJIAbWGbxrAhpNjK94745864 = eYMFoqeTJIAbWGbxrAhpNjK52064717; eYMFoqeTJIAbWGbxrAhpNjK52064717 = eYMFoqeTJIAbWGbxrAhpNjK8752794; eYMFoqeTJIAbWGbxrAhpNjK8752794 = eYMFoqeTJIAbWGbxrAhpNjK2210828; eYMFoqeTJIAbWGbxrAhpNjK2210828 = eYMFoqeTJIAbWGbxrAhpNjK27505403; eYMFoqeTJIAbWGbxrAhpNjK27505403 = eYMFoqeTJIAbWGbxrAhpNjK22037277; eYMFoqeTJIAbWGbxrAhpNjK22037277 = eYMFoqeTJIAbWGbxrAhpNjK92393121; eYMFoqeTJIAbWGbxrAhpNjK92393121 = eYMFoqeTJIAbWGbxrAhpNjK73223211; eYMFoqeTJIAbWGbxrAhpNjK73223211 = eYMFoqeTJIAbWGbxrAhpNjK26233012; eYMFoqeTJIAbWGbxrAhpNjK26233012 = eYMFoqeTJIAbWGbxrAhpNjK32022126; eYMFoqeTJIAbWGbxrAhpNjK32022126 = eYMFoqeTJIAbWGbxrAhpNjK12982822; eYMFoqeTJIAbWGbxrAhpNjK12982822 = eYMFoqeTJIAbWGbxrAhpNjK17780717; eYMFoqeTJIAbWGbxrAhpNjK17780717 = eYMFoqeTJIAbWGbxrAhpNjK35722691; eYMFoqeTJIAbWGbxrAhpNjK35722691 = eYMFoqeTJIAbWGbxrAhpNjK22712826; eYMFoqeTJIAbWGbxrAhpNjK22712826 = eYMFoqeTJIAbWGbxrAhpNjK37075811; eYMFoqeTJIAbWGbxrAhpNjK37075811 = eYMFoqeTJIAbWGbxrAhpNjK18638713; eYMFoqeTJIAbWGbxrAhpNjK18638713 = eYMFoqeTJIAbWGbxrAhpNjK24520956; eYMFoqeTJIAbWGbxrAhpNjK24520956 = eYMFoqeTJIAbWGbxrAhpNjK89735869; eYMFoqeTJIAbWGbxrAhpNjK89735869 = eYMFoqeTJIAbWGbxrAhpNjK62161078; eYMFoqeTJIAbWGbxrAhpNjK62161078 = eYMFoqeTJIAbWGbxrAhpNjK47700999; eYMFoqeTJIAbWGbxrAhpNjK47700999 = eYMFoqeTJIAbWGbxrAhpNjK19758563; eYMFoqeTJIAbWGbxrAhpNjK19758563 = eYMFoqeTJIAbWGbxrAhpNjK69414079; eYMFoqeTJIAbWGbxrAhpNjK69414079 = eYMFoqeTJIAbWGbxrAhpNjK89679635; eYMFoqeTJIAbWGbxrAhpNjK89679635 = eYMFoqeTJIAbWGbxrAhpNjK54621579; eYMFoqeTJIAbWGbxrAhpNjK54621579 = eYMFoqeTJIAbWGbxrAhpNjK8590193; eYMFoqeTJIAbWGbxrAhpNjK8590193 = eYMFoqeTJIAbWGbxrAhpNjK47255021; eYMFoqeTJIAbWGbxrAhpNjK47255021 = eYMFoqeTJIAbWGbxrAhpNjK16712159; eYMFoqeTJIAbWGbxrAhpNjK16712159 = eYMFoqeTJIAbWGbxrAhpNjK71340810; eYMFoqeTJIAbWGbxrAhpNjK71340810 = eYMFoqeTJIAbWGbxrAhpNjK11460070; eYMFoqeTJIAbWGbxrAhpNjK11460070 = eYMFoqeTJIAbWGbxrAhpNjK88722527; eYMFoqeTJIAbWGbxrAhpNjK88722527 = eYMFoqeTJIAbWGbxrAhpNjK13824621; eYMFoqeTJIAbWGbxrAhpNjK13824621 = eYMFoqeTJIAbWGbxrAhpNjK65397674; eYMFoqeTJIAbWGbxrAhpNjK65397674 = eYMFoqeTJIAbWGbxrAhpNjK20042390; eYMFoqeTJIAbWGbxrAhpNjK20042390 = eYMFoqeTJIAbWGbxrAhpNjK28657996; eYMFoqeTJIAbWGbxrAhpNjK28657996 = eYMFoqeTJIAbWGbxrAhpNjK91856152; eYMFoqeTJIAbWGbxrAhpNjK91856152 = eYMFoqeTJIAbWGbxrAhpNjK37439189; eYMFoqeTJIAbWGbxrAhpNjK37439189 = eYMFoqeTJIAbWGbxrAhpNjK3410976; eYMFoqeTJIAbWGbxrAhpNjK3410976 = eYMFoqeTJIAbWGbxrAhpNjK19606375; eYMFoqeTJIAbWGbxrAhpNjK19606375 = eYMFoqeTJIAbWGbxrAhpNjK84290949; eYMFoqeTJIAbWGbxrAhpNjK84290949 = eYMFoqeTJIAbWGbxrAhpNjK26139963; eYMFoqeTJIAbWGbxrAhpNjK26139963 = eYMFoqeTJIAbWGbxrAhpNjK7489612; eYMFoqeTJIAbWGbxrAhpNjK7489612 = eYMFoqeTJIAbWGbxrAhpNjK59593524; eYMFoqeTJIAbWGbxrAhpNjK59593524 = eYMFoqeTJIAbWGbxrAhpNjK20878992; eYMFoqeTJIAbWGbxrAhpNjK20878992 = eYMFoqeTJIAbWGbxrAhpNjK35243142; eYMFoqeTJIAbWGbxrAhpNjK35243142 = eYMFoqeTJIAbWGbxrAhpNjK22526357; eYMFoqeTJIAbWGbxrAhpNjK22526357 = eYMFoqeTJIAbWGbxrAhpNjK45861678; eYMFoqeTJIAbWGbxrAhpNjK45861678 = eYMFoqeTJIAbWGbxrAhpNjK30526602; eYMFoqeTJIAbWGbxrAhpNjK30526602 = eYMFoqeTJIAbWGbxrAhpNjK81386622; eYMFoqeTJIAbWGbxrAhpNjK81386622 = eYMFoqeTJIAbWGbxrAhpNjK84996753; eYMFoqeTJIAbWGbxrAhpNjK84996753 = eYMFoqeTJIAbWGbxrAhpNjK4558434; eYMFoqeTJIAbWGbxrAhpNjK4558434 = eYMFoqeTJIAbWGbxrAhpNjK18193160; eYMFoqeTJIAbWGbxrAhpNjK18193160 = eYMFoqeTJIAbWGbxrAhpNjK56784402; eYMFoqeTJIAbWGbxrAhpNjK56784402 = eYMFoqeTJIAbWGbxrAhpNjK52436848; eYMFoqeTJIAbWGbxrAhpNjK52436848 = eYMFoqeTJIAbWGbxrAhpNjK81181407; eYMFoqeTJIAbWGbxrAhpNjK81181407 = eYMFoqeTJIAbWGbxrAhpNjK31533592; eYMFoqeTJIAbWGbxrAhpNjK31533592 = eYMFoqeTJIAbWGbxrAhpNjK25331786; eYMFoqeTJIAbWGbxrAhpNjK25331786 = eYMFoqeTJIAbWGbxrAhpNjK62385081; eYMFoqeTJIAbWGbxrAhpNjK62385081 = eYMFoqeTJIAbWGbxrAhpNjK54131214; eYMFoqeTJIAbWGbxrAhpNjK54131214 = eYMFoqeTJIAbWGbxrAhpNjK93620635; eYMFoqeTJIAbWGbxrAhpNjK93620635 = eYMFoqeTJIAbWGbxrAhpNjK80250382; eYMFoqeTJIAbWGbxrAhpNjK80250382 = eYMFoqeTJIAbWGbxrAhpNjK5325119; eYMFoqeTJIAbWGbxrAhpNjK5325119 = eYMFoqeTJIAbWGbxrAhpNjK21052312; eYMFoqeTJIAbWGbxrAhpNjK21052312 = eYMFoqeTJIAbWGbxrAhpNjK61763142; eYMFoqeTJIAbWGbxrAhpNjK61763142 = eYMFoqeTJIAbWGbxrAhpNjK37510485; eYMFoqeTJIAbWGbxrAhpNjK37510485 = eYMFoqeTJIAbWGbxrAhpNjK18197505; eYMFoqeTJIAbWGbxrAhpNjK18197505 = eYMFoqeTJIAbWGbxrAhpNjK47585148; eYMFoqeTJIAbWGbxrAhpNjK47585148 = eYMFoqeTJIAbWGbxrAhpNjK97738326; eYMFoqeTJIAbWGbxrAhpNjK97738326 = eYMFoqeTJIAbWGbxrAhpNjK7064696; eYMFoqeTJIAbWGbxrAhpNjK7064696 = eYMFoqeTJIAbWGbxrAhpNjK30856674; eYMFoqeTJIAbWGbxrAhpNjK30856674 = eYMFoqeTJIAbWGbxrAhpNjK99636621; eYMFoqeTJIAbWGbxrAhpNjK99636621 = eYMFoqeTJIAbWGbxrAhpNjK15227737; eYMFoqeTJIAbWGbxrAhpNjK15227737 = eYMFoqeTJIAbWGbxrAhpNjK20811607;}
void HhkgfwFCuEQukUVSIAngguzKkP98567151() { float fIQUZZSskwgjLDHTfloSkur4535125 = -195961668; float fIQUZZSskwgjLDHTfloSkur91011470 = -743757730; float fIQUZZSskwgjLDHTfloSkur23243333 = -472075417; float fIQUZZSskwgjLDHTfloSkur28584597 = -562556666; float fIQUZZSskwgjLDHTfloSkur39906228 = -736132763; float fIQUZZSskwgjLDHTfloSkur91335117 = -569434711; float fIQUZZSskwgjLDHTfloSkur85805359 = -422712704; float fIQUZZSskwgjLDHTfloSkur23290233 = -167407132; float fIQUZZSskwgjLDHTfloSkur36821545 = 92530962; float fIQUZZSskwgjLDHTfloSkur35609494 = 60971592; float fIQUZZSskwgjLDHTfloSkur55052805 = -451704357; float fIQUZZSskwgjLDHTfloSkur12028973 = 20645357; float fIQUZZSskwgjLDHTfloSkur62850204 = -766914240; float fIQUZZSskwgjLDHTfloSkur42550384 = -573859828; float fIQUZZSskwgjLDHTfloSkur4061992 = -298254906; float fIQUZZSskwgjLDHTfloSkur4630764 = -781558564; float fIQUZZSskwgjLDHTfloSkur46977414 = -731409054; float fIQUZZSskwgjLDHTfloSkur81342536 = -642483132; float fIQUZZSskwgjLDHTfloSkur76485659 = -56881203; float fIQUZZSskwgjLDHTfloSkur37750039 = -890697730; float fIQUZZSskwgjLDHTfloSkur33588803 = -32389141; float fIQUZZSskwgjLDHTfloSkur5101520 = -627312161; float fIQUZZSskwgjLDHTfloSkur91248429 = -984948501; float fIQUZZSskwgjLDHTfloSkur24339841 = -310269365; float fIQUZZSskwgjLDHTfloSkur79316209 = -127520464; float fIQUZZSskwgjLDHTfloSkur99513029 = -366832827; float fIQUZZSskwgjLDHTfloSkur36189866 = -526821846; float fIQUZZSskwgjLDHTfloSkur71481606 = -598939488; float fIQUZZSskwgjLDHTfloSkur23210296 = -699842609; float fIQUZZSskwgjLDHTfloSkur30294192 = -43249506; float fIQUZZSskwgjLDHTfloSkur33429140 = -961017055; float fIQUZZSskwgjLDHTfloSkur33546082 = -993367791; float fIQUZZSskwgjLDHTfloSkur16335530 = -726252645; float fIQUZZSskwgjLDHTfloSkur63230117 = -421458991; float fIQUZZSskwgjLDHTfloSkur89640602 = -588226247; float fIQUZZSskwgjLDHTfloSkur62254355 = -413662174; float fIQUZZSskwgjLDHTfloSkur72986802 = -39768245; float fIQUZZSskwgjLDHTfloSkur76614802 = -448472999; float fIQUZZSskwgjLDHTfloSkur92637844 = -520504804; float fIQUZZSskwgjLDHTfloSkur52171938 = -101883198; float fIQUZZSskwgjLDHTfloSkur82548237 = -562605667; float fIQUZZSskwgjLDHTfloSkur65062418 = -363629774; float fIQUZZSskwgjLDHTfloSkur55512972 = -312590922; float fIQUZZSskwgjLDHTfloSkur84271330 = -980202138; float fIQUZZSskwgjLDHTfloSkur46625963 = -556018681; float fIQUZZSskwgjLDHTfloSkur68787837 = -233240897; float fIQUZZSskwgjLDHTfloSkur22914839 = -418169352; float fIQUZZSskwgjLDHTfloSkur902926 = -25329603; float fIQUZZSskwgjLDHTfloSkur81575212 = -27053997; float fIQUZZSskwgjLDHTfloSkur55631893 = -151147896; float fIQUZZSskwgjLDHTfloSkur9504911 = -518121624; float fIQUZZSskwgjLDHTfloSkur41185355 = -642709574; float fIQUZZSskwgjLDHTfloSkur3982 = -304276992; float fIQUZZSskwgjLDHTfloSkur54522798 = -206301535; float fIQUZZSskwgjLDHTfloSkur64978348 = -591299219; float fIQUZZSskwgjLDHTfloSkur99433605 = -568649507; float fIQUZZSskwgjLDHTfloSkur99763040 = -758809230; float fIQUZZSskwgjLDHTfloSkur98903491 = -61806053; float fIQUZZSskwgjLDHTfloSkur49268387 = -335036203; float fIQUZZSskwgjLDHTfloSkur40393199 = -269299936; float fIQUZZSskwgjLDHTfloSkur55145252 = 57387135; float fIQUZZSskwgjLDHTfloSkur14323753 = -823773216; float fIQUZZSskwgjLDHTfloSkur79937 = -467564524; float fIQUZZSskwgjLDHTfloSkur6527354 = -864219533; float fIQUZZSskwgjLDHTfloSkur2180355 = 21988647; float fIQUZZSskwgjLDHTfloSkur21506723 = -458336566; float fIQUZZSskwgjLDHTfloSkur95693443 = -253101999; float fIQUZZSskwgjLDHTfloSkur99620086 = -245455249; float fIQUZZSskwgjLDHTfloSkur52909782 = -985633581; float fIQUZZSskwgjLDHTfloSkur41807636 = -884592732; float fIQUZZSskwgjLDHTfloSkur31643962 = -641790319; float fIQUZZSskwgjLDHTfloSkur70362611 = -182936056; float fIQUZZSskwgjLDHTfloSkur88704691 = -21978329; float fIQUZZSskwgjLDHTfloSkur24313721 = -954998005; float fIQUZZSskwgjLDHTfloSkur55201802 = -228092063; float fIQUZZSskwgjLDHTfloSkur68526385 = -668759367; float fIQUZZSskwgjLDHTfloSkur49588547 = -214721240; float fIQUZZSskwgjLDHTfloSkur6977100 = 95253636; float fIQUZZSskwgjLDHTfloSkur77713877 = -754250684; float fIQUZZSskwgjLDHTfloSkur10528372 = -894279568; float fIQUZZSskwgjLDHTfloSkur76598190 = -948663475; float fIQUZZSskwgjLDHTfloSkur35286940 = -401492244; float fIQUZZSskwgjLDHTfloSkur89906394 = -471885491; float fIQUZZSskwgjLDHTfloSkur67578403 = -448694713; float fIQUZZSskwgjLDHTfloSkur20789281 = -525127883; float fIQUZZSskwgjLDHTfloSkur92243784 = -218307481; float fIQUZZSskwgjLDHTfloSkur33542100 = -589090799; float fIQUZZSskwgjLDHTfloSkur61812731 = -419951111; float fIQUZZSskwgjLDHTfloSkur98251768 = -830159773; float fIQUZZSskwgjLDHTfloSkur90206996 = 80423260; float fIQUZZSskwgjLDHTfloSkur62491315 = -654852945; float fIQUZZSskwgjLDHTfloSkur74083310 = -977962193; float fIQUZZSskwgjLDHTfloSkur27346416 = -13436796; float fIQUZZSskwgjLDHTfloSkur52244645 = -151204868; float fIQUZZSskwgjLDHTfloSkur97026685 = -59270334; float fIQUZZSskwgjLDHTfloSkur68224484 = -738832452; float fIQUZZSskwgjLDHTfloSkur64982481 = -896065251; float fIQUZZSskwgjLDHTfloSkur48985619 = -448371389; float fIQUZZSskwgjLDHTfloSkur82090976 = -902190785; float fIQUZZSskwgjLDHTfloSkur25119240 = -195961668; fIQUZZSskwgjLDHTfloSkur4535125 = fIQUZZSskwgjLDHTfloSkur91011470; fIQUZZSskwgjLDHTfloSkur91011470 = fIQUZZSskwgjLDHTfloSkur23243333; fIQUZZSskwgjLDHTfloSkur23243333 = fIQUZZSskwgjLDHTfloSkur28584597; fIQUZZSskwgjLDHTfloSkur28584597 = fIQUZZSskwgjLDHTfloSkur39906228; fIQUZZSskwgjLDHTfloSkur39906228 = fIQUZZSskwgjLDHTfloSkur91335117; fIQUZZSskwgjLDHTfloSkur91335117 = fIQUZZSskwgjLDHTfloSkur85805359; fIQUZZSskwgjLDHTfloSkur85805359 = fIQUZZSskwgjLDHTfloSkur23290233; fIQUZZSskwgjLDHTfloSkur23290233 = fIQUZZSskwgjLDHTfloSkur36821545; fIQUZZSskwgjLDHTfloSkur36821545 = fIQUZZSskwgjLDHTfloSkur35609494; fIQUZZSskwgjLDHTfloSkur35609494 = fIQUZZSskwgjLDHTfloSkur55052805; fIQUZZSskwgjLDHTfloSkur55052805 = fIQUZZSskwgjLDHTfloSkur12028973; fIQUZZSskwgjLDHTfloSkur12028973 = fIQUZZSskwgjLDHTfloSkur62850204; fIQUZZSskwgjLDHTfloSkur62850204 = fIQUZZSskwgjLDHTfloSkur42550384; fIQUZZSskwgjLDHTfloSkur42550384 = fIQUZZSskwgjLDHTfloSkur4061992; fIQUZZSskwgjLDHTfloSkur4061992 = fIQUZZSskwgjLDHTfloSkur4630764; fIQUZZSskwgjLDHTfloSkur4630764 = fIQUZZSskwgjLDHTfloSkur46977414; fIQUZZSskwgjLDHTfloSkur46977414 = fIQUZZSskwgjLDHTfloSkur81342536; fIQUZZSskwgjLDHTfloSkur81342536 = fIQUZZSskwgjLDHTfloSkur76485659; fIQUZZSskwgjLDHTfloSkur76485659 = fIQUZZSskwgjLDHTfloSkur37750039; fIQUZZSskwgjLDHTfloSkur37750039 = fIQUZZSskwgjLDHTfloSkur33588803; fIQUZZSskwgjLDHTfloSkur33588803 = fIQUZZSskwgjLDHTfloSkur5101520; fIQUZZSskwgjLDHTfloSkur5101520 = fIQUZZSskwgjLDHTfloSkur91248429; fIQUZZSskwgjLDHTfloSkur91248429 = fIQUZZSskwgjLDHTfloSkur24339841; fIQUZZSskwgjLDHTfloSkur24339841 = fIQUZZSskwgjLDHTfloSkur79316209; fIQUZZSskwgjLDHTfloSkur79316209 = fIQUZZSskwgjLDHTfloSkur99513029; fIQUZZSskwgjLDHTfloSkur99513029 = fIQUZZSskwgjLDHTfloSkur36189866; fIQUZZSskwgjLDHTfloSkur36189866 = fIQUZZSskwgjLDHTfloSkur71481606; fIQUZZSskwgjLDHTfloSkur71481606 = fIQUZZSskwgjLDHTfloSkur23210296; fIQUZZSskwgjLDHTfloSkur23210296 = fIQUZZSskwgjLDHTfloSkur30294192; fIQUZZSskwgjLDHTfloSkur30294192 = fIQUZZSskwgjLDHTfloSkur33429140; fIQUZZSskwgjLDHTfloSkur33429140 = fIQUZZSskwgjLDHTfloSkur33546082; fIQUZZSskwgjLDHTfloSkur33546082 = fIQUZZSskwgjLDHTfloSkur16335530; fIQUZZSskwgjLDHTfloSkur16335530 = fIQUZZSskwgjLDHTfloSkur63230117; fIQUZZSskwgjLDHTfloSkur63230117 = fIQUZZSskwgjLDHTfloSkur89640602; fIQUZZSskwgjLDHTfloSkur89640602 = fIQUZZSskwgjLDHTfloSkur62254355; fIQUZZSskwgjLDHTfloSkur62254355 = fIQUZZSskwgjLDHTfloSkur72986802; fIQUZZSskwgjLDHTfloSkur72986802 = fIQUZZSskwgjLDHTfloSkur76614802; fIQUZZSskwgjLDHTfloSkur76614802 = fIQUZZSskwgjLDHTfloSkur92637844; fIQUZZSskwgjLDHTfloSkur92637844 = fIQUZZSskwgjLDHTfloSkur52171938; fIQUZZSskwgjLDHTfloSkur52171938 = fIQUZZSskwgjLDHTfloSkur82548237; fIQUZZSskwgjLDHTfloSkur82548237 = fIQUZZSskwgjLDHTfloSkur65062418; fIQUZZSskwgjLDHTfloSkur65062418 = fIQUZZSskwgjLDHTfloSkur55512972; fIQUZZSskwgjLDHTfloSkur55512972 = fIQUZZSskwgjLDHTfloSkur84271330; fIQUZZSskwgjLDHTfloSkur84271330 = fIQUZZSskwgjLDHTfloSkur46625963; fIQUZZSskwgjLDHTfloSkur46625963 = fIQUZZSskwgjLDHTfloSkur68787837; fIQUZZSskwgjLDHTfloSkur68787837 = fIQUZZSskwgjLDHTfloSkur22914839; fIQUZZSskwgjLDHTfloSkur22914839 = fIQUZZSskwgjLDHTfloSkur902926; fIQUZZSskwgjLDHTfloSkur902926 = fIQUZZSskwgjLDHTfloSkur81575212; fIQUZZSskwgjLDHTfloSkur81575212 = fIQUZZSskwgjLDHTfloSkur55631893; fIQUZZSskwgjLDHTfloSkur55631893 = fIQUZZSskwgjLDHTfloSkur9504911; fIQUZZSskwgjLDHTfloSkur9504911 = fIQUZZSskwgjLDHTfloSkur41185355; fIQUZZSskwgjLDHTfloSkur41185355 = fIQUZZSskwgjLDHTfloSkur3982; fIQUZZSskwgjLDHTfloSkur3982 = fIQUZZSskwgjLDHTfloSkur54522798; fIQUZZSskwgjLDHTfloSkur54522798 = fIQUZZSskwgjLDHTfloSkur64978348; fIQUZZSskwgjLDHTfloSkur64978348 = fIQUZZSskwgjLDHTfloSkur99433605; fIQUZZSskwgjLDHTfloSkur99433605 = fIQUZZSskwgjLDHTfloSkur99763040; fIQUZZSskwgjLDHTfloSkur99763040 = fIQUZZSskwgjLDHTfloSkur98903491; fIQUZZSskwgjLDHTfloSkur98903491 = fIQUZZSskwgjLDHTfloSkur49268387; fIQUZZSskwgjLDHTfloSkur49268387 = fIQUZZSskwgjLDHTfloSkur40393199; fIQUZZSskwgjLDHTfloSkur40393199 = fIQUZZSskwgjLDHTfloSkur55145252; fIQUZZSskwgjLDHTfloSkur55145252 = fIQUZZSskwgjLDHTfloSkur14323753; fIQUZZSskwgjLDHTfloSkur14323753 = fIQUZZSskwgjLDHTfloSkur79937; fIQUZZSskwgjLDHTfloSkur79937 = fIQUZZSskwgjLDHTfloSkur6527354; fIQUZZSskwgjLDHTfloSkur6527354 = fIQUZZSskwgjLDHTfloSkur2180355; fIQUZZSskwgjLDHTfloSkur2180355 = fIQUZZSskwgjLDHTfloSkur21506723; fIQUZZSskwgjLDHTfloSkur21506723 = fIQUZZSskwgjLDHTfloSkur95693443; fIQUZZSskwgjLDHTfloSkur95693443 = fIQUZZSskwgjLDHTfloSkur99620086; fIQUZZSskwgjLDHTfloSkur99620086 = fIQUZZSskwgjLDHTfloSkur52909782; fIQUZZSskwgjLDHTfloSkur52909782 = fIQUZZSskwgjLDHTfloSkur41807636; fIQUZZSskwgjLDHTfloSkur41807636 = fIQUZZSskwgjLDHTfloSkur31643962; fIQUZZSskwgjLDHTfloSkur31643962 = fIQUZZSskwgjLDHTfloSkur70362611; fIQUZZSskwgjLDHTfloSkur70362611 = fIQUZZSskwgjLDHTfloSkur88704691; fIQUZZSskwgjLDHTfloSkur88704691 = fIQUZZSskwgjLDHTfloSkur24313721; fIQUZZSskwgjLDHTfloSkur24313721 = fIQUZZSskwgjLDHTfloSkur55201802; fIQUZZSskwgjLDHTfloSkur55201802 = fIQUZZSskwgjLDHTfloSkur68526385; fIQUZZSskwgjLDHTfloSkur68526385 = fIQUZZSskwgjLDHTfloSkur49588547; fIQUZZSskwgjLDHTfloSkur49588547 = fIQUZZSskwgjLDHTfloSkur6977100; fIQUZZSskwgjLDHTfloSkur6977100 = fIQUZZSskwgjLDHTfloSkur77713877; fIQUZZSskwgjLDHTfloSkur77713877 = fIQUZZSskwgjLDHTfloSkur10528372; fIQUZZSskwgjLDHTfloSkur10528372 = fIQUZZSskwgjLDHTfloSkur76598190; fIQUZZSskwgjLDHTfloSkur76598190 = fIQUZZSskwgjLDHTfloSkur35286940; fIQUZZSskwgjLDHTfloSkur35286940 = fIQUZZSskwgjLDHTfloSkur89906394; fIQUZZSskwgjLDHTfloSkur89906394 = fIQUZZSskwgjLDHTfloSkur67578403; fIQUZZSskwgjLDHTfloSkur67578403 = fIQUZZSskwgjLDHTfloSkur20789281; fIQUZZSskwgjLDHTfloSkur20789281 = fIQUZZSskwgjLDHTfloSkur92243784; fIQUZZSskwgjLDHTfloSkur92243784 = fIQUZZSskwgjLDHTfloSkur33542100; fIQUZZSskwgjLDHTfloSkur33542100 = fIQUZZSskwgjLDHTfloSkur61812731; fIQUZZSskwgjLDHTfloSkur61812731 = fIQUZZSskwgjLDHTfloSkur98251768; fIQUZZSskwgjLDHTfloSkur98251768 = fIQUZZSskwgjLDHTfloSkur90206996; fIQUZZSskwgjLDHTfloSkur90206996 = fIQUZZSskwgjLDHTfloSkur62491315; fIQUZZSskwgjLDHTfloSkur62491315 = fIQUZZSskwgjLDHTfloSkur74083310; fIQUZZSskwgjLDHTfloSkur74083310 = fIQUZZSskwgjLDHTfloSkur27346416; fIQUZZSskwgjLDHTfloSkur27346416 = fIQUZZSskwgjLDHTfloSkur52244645; fIQUZZSskwgjLDHTfloSkur52244645 = fIQUZZSskwgjLDHTfloSkur97026685; fIQUZZSskwgjLDHTfloSkur97026685 = fIQUZZSskwgjLDHTfloSkur68224484; fIQUZZSskwgjLDHTfloSkur68224484 = fIQUZZSskwgjLDHTfloSkur64982481; fIQUZZSskwgjLDHTfloSkur64982481 = fIQUZZSskwgjLDHTfloSkur48985619; fIQUZZSskwgjLDHTfloSkur48985619 = fIQUZZSskwgjLDHTfloSkur82090976; fIQUZZSskwgjLDHTfloSkur82090976 = fIQUZZSskwgjLDHTfloSkur25119240; fIQUZZSskwgjLDHTfloSkur25119240 = fIQUZZSskwgjLDHTfloSkur4535125;}
void cvtmAsuLshtvFENEdUkjNGodvE83629989() { float qGTAyqsMUOFhGeFReXaFaha88258642 = -545983735; float qGTAyqsMUOFhGeFReXaFaha88609566 = -547409582; float qGTAyqsMUOFhGeFReXaFaha11829450 = -340383108; float qGTAyqsMUOFhGeFReXaFaha25732550 = -567438595; float qGTAyqsMUOFhGeFReXaFaha19467565 = -34080954; float qGTAyqsMUOFhGeFReXaFaha2674636 = -672755380; float qGTAyqsMUOFhGeFReXaFaha22685922 = -444226842; float qGTAyqsMUOFhGeFReXaFaha66630315 = -787861718; float qGTAyqsMUOFhGeFReXaFaha87041073 = -604951735; float qGTAyqsMUOFhGeFReXaFaha81715082 = -162069423; float qGTAyqsMUOFhGeFReXaFaha97941840 = -291989614; float qGTAyqsMUOFhGeFReXaFaha2240744 = 91506086; float qGTAyqsMUOFhGeFReXaFaha13904056 = -609746484; float qGTAyqsMUOFhGeFReXaFaha36923529 = -923542690; float qGTAyqsMUOFhGeFReXaFaha8241251 = -223952211; float qGTAyqsMUOFhGeFReXaFaha76444792 = -705686216; float qGTAyqsMUOFhGeFReXaFaha46842825 = -890288917; float qGTAyqsMUOFhGeFReXaFaha95419805 = -253334706; float qGTAyqsMUOFhGeFReXaFaha17462140 = -945530441; float qGTAyqsMUOFhGeFReXaFaha11857683 = -506990647; float qGTAyqsMUOFhGeFReXaFaha928314 = -706855662; float qGTAyqsMUOFhGeFReXaFaha6103591 = -540467447; float qGTAyqsMUOFhGeFReXaFaha60424295 = 85656762; float qGTAyqsMUOFhGeFReXaFaha25482536 = -949502018; float qGTAyqsMUOFhGeFReXaFaha15918302 = -205851225; float qGTAyqsMUOFhGeFReXaFaha52505787 = -809799855; float qGTAyqsMUOFhGeFReXaFaha57781805 = -970697269; float qGTAyqsMUOFhGeFReXaFaha14080807 = -385380977; float qGTAyqsMUOFhGeFReXaFaha95128437 = -124038509; float qGTAyqsMUOFhGeFReXaFaha65842518 = -715855880; float qGTAyqsMUOFhGeFReXaFaha14793563 = -80115075; float qGTAyqsMUOFhGeFReXaFaha58339370 = -442565014; float qGTAyqsMUOFhGeFReXaFaha30460231 = -291466736; float qGTAyqsMUOFhGeFReXaFaha98954831 = -825555639; float qGTAyqsMUOFhGeFReXaFaha57243927 = -322516855; float qGTAyqsMUOFhGeFReXaFaha32115589 = -392058652; float qGTAyqsMUOFhGeFReXaFaha72750392 = -360109542; float qGTAyqsMUOFhGeFReXaFaha26996594 = -347616215; float qGTAyqsMUOFhGeFReXaFaha53253564 = -826063686; float qGTAyqsMUOFhGeFReXaFaha91361053 = -48530078; float qGTAyqsMUOFhGeFReXaFaha47315758 = -212645794; float qGTAyqsMUOFhGeFReXaFaha94402144 = 30344557; float qGTAyqsMUOFhGeFReXaFaha88313118 = 35004824; float qGTAyqsMUOFhGeFReXaFaha31466850 = -559145870; float qGTAyqsMUOFhGeFReXaFaha74613214 = -882032759; float qGTAyqsMUOFhGeFReXaFaha13054719 = -948272588; float qGTAyqsMUOFhGeFReXaFaha56093808 = -439815259; float qGTAyqsMUOFhGeFReXaFaha39644773 = -887451501; float qGTAyqsMUOFhGeFReXaFaha15449426 = -826838148; float qGTAyqsMUOFhGeFReXaFaha91505222 = -783163331; float qGTAyqsMUOFhGeFReXaFaha49595742 = -683894025; float qGTAyqsMUOFhGeFReXaFaha92691075 = -394762361; float qGTAyqsMUOFhGeFReXaFaha45386384 = -316209358; float qGTAyqsMUOFhGeFReXaFaha455405 = -783010722; float qGTAyqsMUOFhGeFReXaFaha82701676 = -908026164; float qGTAyqsMUOFhGeFReXaFaha82155052 = 94483712; float qGTAyqsMUOFhGeFReXaFaha28185271 = -533066344; float qGTAyqsMUOFhGeFReXaFaha86346914 = -390881091; float qGTAyqsMUOFhGeFReXaFaha9814248 = -261587370; float qGTAyqsMUOFhGeFReXaFaha66961778 = -224281100; float qGTAyqsMUOFhGeFReXaFaha44892831 = -702058111; float qGTAyqsMUOFhGeFReXaFaha8605116 = 41154134; float qGTAyqsMUOFhGeFReXaFaha71501878 = -563823209; float qGTAyqsMUOFhGeFReXaFaha21198555 = -889095855; float qGTAyqsMUOFhGeFReXaFaha66921520 = 18045652; float qGTAyqsMUOFhGeFReXaFaha39602471 = -849424601; float qGTAyqsMUOFhGeFReXaFaha71780513 = -617027179; float qGTAyqsMUOFhGeFReXaFaha14949225 = -784190845; float qGTAyqsMUOFhGeFReXaFaha79679601 = -501025836; float qGTAyqsMUOFhGeFReXaFaha76125661 = -831893559; float qGTAyqsMUOFhGeFReXaFaha3694401 = -245576674; float qGTAyqsMUOFhGeFReXaFaha19846231 = -442672702; float qGTAyqsMUOFhGeFReXaFaha42166242 = -427271021; float qGTAyqsMUOFhGeFReXaFaha26101086 = -797000364; float qGTAyqsMUOFhGeFReXaFaha64541925 = -194344853; float qGTAyqsMUOFhGeFReXaFaha6526169 = -637200219; float qGTAyqsMUOFhGeFReXaFaha17790472 = -475472272; float qGTAyqsMUOFhGeFReXaFaha28957445 = -355197368; float qGTAyqsMUOFhGeFReXaFaha50869322 = 32530741; float qGTAyqsMUOFhGeFReXaFaha2863583 = -257578638; float qGTAyqsMUOFhGeFReXaFaha96411978 = -269984596; float qGTAyqsMUOFhGeFReXaFaha18137032 = 16754231; float qGTAyqsMUOFhGeFReXaFaha98631380 = -558542829; float qGTAyqsMUOFhGeFReXaFaha3623215 = -340875178; float qGTAyqsMUOFhGeFReXaFaha16246777 = 68038144; float qGTAyqsMUOFhGeFReXaFaha22102488 = -685352715; float qGTAyqsMUOFhGeFReXaFaha12952986 = -26355656; float qGTAyqsMUOFhGeFReXaFaha30004827 = -508456014; float qGTAyqsMUOFhGeFReXaFaha16253156 = -917529476; float qGTAyqsMUOFhGeFReXaFaha75088875 = -317000567; float qGTAyqsMUOFhGeFReXaFaha3930318 = -858992308; float qGTAyqsMUOFhGeFReXaFaha86403478 = -969228452; float qGTAyqsMUOFhGeFReXaFaha17182347 = 13971154; float qGTAyqsMUOFhGeFReXaFaha86291785 = -501782586; float qGTAyqsMUOFhGeFReXaFaha46468223 = -346471967; float qGTAyqsMUOFhGeFReXaFaha38710642 = -153799929; float qGTAyqsMUOFhGeFReXaFaha22900267 = -405832234; float qGTAyqsMUOFhGeFReXaFaha67114564 = -75899321; float qGTAyqsMUOFhGeFReXaFaha64545330 = -477191522; float qGTAyqsMUOFhGeFReXaFaha35010743 = -545983735; qGTAyqsMUOFhGeFReXaFaha88258642 = qGTAyqsMUOFhGeFReXaFaha88609566; qGTAyqsMUOFhGeFReXaFaha88609566 = qGTAyqsMUOFhGeFReXaFaha11829450; qGTAyqsMUOFhGeFReXaFaha11829450 = qGTAyqsMUOFhGeFReXaFaha25732550; qGTAyqsMUOFhGeFReXaFaha25732550 = qGTAyqsMUOFhGeFReXaFaha19467565; qGTAyqsMUOFhGeFReXaFaha19467565 = qGTAyqsMUOFhGeFReXaFaha2674636; qGTAyqsMUOFhGeFReXaFaha2674636 = qGTAyqsMUOFhGeFReXaFaha22685922; qGTAyqsMUOFhGeFReXaFaha22685922 = qGTAyqsMUOFhGeFReXaFaha66630315; qGTAyqsMUOFhGeFReXaFaha66630315 = qGTAyqsMUOFhGeFReXaFaha87041073; qGTAyqsMUOFhGeFReXaFaha87041073 = qGTAyqsMUOFhGeFReXaFaha81715082; qGTAyqsMUOFhGeFReXaFaha81715082 = qGTAyqsMUOFhGeFReXaFaha97941840; qGTAyqsMUOFhGeFReXaFaha97941840 = qGTAyqsMUOFhGeFReXaFaha2240744; qGTAyqsMUOFhGeFReXaFaha2240744 = qGTAyqsMUOFhGeFReXaFaha13904056; qGTAyqsMUOFhGeFReXaFaha13904056 = qGTAyqsMUOFhGeFReXaFaha36923529; qGTAyqsMUOFhGeFReXaFaha36923529 = qGTAyqsMUOFhGeFReXaFaha8241251; qGTAyqsMUOFhGeFReXaFaha8241251 = qGTAyqsMUOFhGeFReXaFaha76444792; qGTAyqsMUOFhGeFReXaFaha76444792 = qGTAyqsMUOFhGeFReXaFaha46842825; qGTAyqsMUOFhGeFReXaFaha46842825 = qGTAyqsMUOFhGeFReXaFaha95419805; qGTAyqsMUOFhGeFReXaFaha95419805 = qGTAyqsMUOFhGeFReXaFaha17462140; qGTAyqsMUOFhGeFReXaFaha17462140 = qGTAyqsMUOFhGeFReXaFaha11857683; qGTAyqsMUOFhGeFReXaFaha11857683 = qGTAyqsMUOFhGeFReXaFaha928314; qGTAyqsMUOFhGeFReXaFaha928314 = qGTAyqsMUOFhGeFReXaFaha6103591; qGTAyqsMUOFhGeFReXaFaha6103591 = qGTAyqsMUOFhGeFReXaFaha60424295; qGTAyqsMUOFhGeFReXaFaha60424295 = qGTAyqsMUOFhGeFReXaFaha25482536; qGTAyqsMUOFhGeFReXaFaha25482536 = qGTAyqsMUOFhGeFReXaFaha15918302; qGTAyqsMUOFhGeFReXaFaha15918302 = qGTAyqsMUOFhGeFReXaFaha52505787; qGTAyqsMUOFhGeFReXaFaha52505787 = qGTAyqsMUOFhGeFReXaFaha57781805; qGTAyqsMUOFhGeFReXaFaha57781805 = qGTAyqsMUOFhGeFReXaFaha14080807; qGTAyqsMUOFhGeFReXaFaha14080807 = qGTAyqsMUOFhGeFReXaFaha95128437; qGTAyqsMUOFhGeFReXaFaha95128437 = qGTAyqsMUOFhGeFReXaFaha65842518; qGTAyqsMUOFhGeFReXaFaha65842518 = qGTAyqsMUOFhGeFReXaFaha14793563; qGTAyqsMUOFhGeFReXaFaha14793563 = qGTAyqsMUOFhGeFReXaFaha58339370; qGTAyqsMUOFhGeFReXaFaha58339370 = qGTAyqsMUOFhGeFReXaFaha30460231; qGTAyqsMUOFhGeFReXaFaha30460231 = qGTAyqsMUOFhGeFReXaFaha98954831; qGTAyqsMUOFhGeFReXaFaha98954831 = qGTAyqsMUOFhGeFReXaFaha57243927; qGTAyqsMUOFhGeFReXaFaha57243927 = qGTAyqsMUOFhGeFReXaFaha32115589; qGTAyqsMUOFhGeFReXaFaha32115589 = qGTAyqsMUOFhGeFReXaFaha72750392; qGTAyqsMUOFhGeFReXaFaha72750392 = qGTAyqsMUOFhGeFReXaFaha26996594; qGTAyqsMUOFhGeFReXaFaha26996594 = qGTAyqsMUOFhGeFReXaFaha53253564; qGTAyqsMUOFhGeFReXaFaha53253564 = qGTAyqsMUOFhGeFReXaFaha91361053; qGTAyqsMUOFhGeFReXaFaha91361053 = qGTAyqsMUOFhGeFReXaFaha47315758; qGTAyqsMUOFhGeFReXaFaha47315758 = qGTAyqsMUOFhGeFReXaFaha94402144; qGTAyqsMUOFhGeFReXaFaha94402144 = qGTAyqsMUOFhGeFReXaFaha88313118; qGTAyqsMUOFhGeFReXaFaha88313118 = qGTAyqsMUOFhGeFReXaFaha31466850; qGTAyqsMUOFhGeFReXaFaha31466850 = qGTAyqsMUOFhGeFReXaFaha74613214; qGTAyqsMUOFhGeFReXaFaha74613214 = qGTAyqsMUOFhGeFReXaFaha13054719; qGTAyqsMUOFhGeFReXaFaha13054719 = qGTAyqsMUOFhGeFReXaFaha56093808; qGTAyqsMUOFhGeFReXaFaha56093808 = qGTAyqsMUOFhGeFReXaFaha39644773; qGTAyqsMUOFhGeFReXaFaha39644773 = qGTAyqsMUOFhGeFReXaFaha15449426; qGTAyqsMUOFhGeFReXaFaha15449426 = qGTAyqsMUOFhGeFReXaFaha91505222; qGTAyqsMUOFhGeFReXaFaha91505222 = qGTAyqsMUOFhGeFReXaFaha49595742; qGTAyqsMUOFhGeFReXaFaha49595742 = qGTAyqsMUOFhGeFReXaFaha92691075; qGTAyqsMUOFhGeFReXaFaha92691075 = qGTAyqsMUOFhGeFReXaFaha45386384; qGTAyqsMUOFhGeFReXaFaha45386384 = qGTAyqsMUOFhGeFReXaFaha455405; qGTAyqsMUOFhGeFReXaFaha455405 = qGTAyqsMUOFhGeFReXaFaha82701676; qGTAyqsMUOFhGeFReXaFaha82701676 = qGTAyqsMUOFhGeFReXaFaha82155052; qGTAyqsMUOFhGeFReXaFaha82155052 = qGTAyqsMUOFhGeFReXaFaha28185271; qGTAyqsMUOFhGeFReXaFaha28185271 = qGTAyqsMUOFhGeFReXaFaha86346914; qGTAyqsMUOFhGeFReXaFaha86346914 = qGTAyqsMUOFhGeFReXaFaha9814248; qGTAyqsMUOFhGeFReXaFaha9814248 = qGTAyqsMUOFhGeFReXaFaha66961778; qGTAyqsMUOFhGeFReXaFaha66961778 = qGTAyqsMUOFhGeFReXaFaha44892831; qGTAyqsMUOFhGeFReXaFaha44892831 = qGTAyqsMUOFhGeFReXaFaha8605116; qGTAyqsMUOFhGeFReXaFaha8605116 = qGTAyqsMUOFhGeFReXaFaha71501878; qGTAyqsMUOFhGeFReXaFaha71501878 = qGTAyqsMUOFhGeFReXaFaha21198555; qGTAyqsMUOFhGeFReXaFaha21198555 = qGTAyqsMUOFhGeFReXaFaha66921520; qGTAyqsMUOFhGeFReXaFaha66921520 = qGTAyqsMUOFhGeFReXaFaha39602471; qGTAyqsMUOFhGeFReXaFaha39602471 = qGTAyqsMUOFhGeFReXaFaha71780513; qGTAyqsMUOFhGeFReXaFaha71780513 = qGTAyqsMUOFhGeFReXaFaha14949225; qGTAyqsMUOFhGeFReXaFaha14949225 = qGTAyqsMUOFhGeFReXaFaha79679601; qGTAyqsMUOFhGeFReXaFaha79679601 = qGTAyqsMUOFhGeFReXaFaha76125661; qGTAyqsMUOFhGeFReXaFaha76125661 = qGTAyqsMUOFhGeFReXaFaha3694401; qGTAyqsMUOFhGeFReXaFaha3694401 = qGTAyqsMUOFhGeFReXaFaha19846231; qGTAyqsMUOFhGeFReXaFaha19846231 = qGTAyqsMUOFhGeFReXaFaha42166242; qGTAyqsMUOFhGeFReXaFaha42166242 = qGTAyqsMUOFhGeFReXaFaha26101086; qGTAyqsMUOFhGeFReXaFaha26101086 = qGTAyqsMUOFhGeFReXaFaha64541925; qGTAyqsMUOFhGeFReXaFaha64541925 = qGTAyqsMUOFhGeFReXaFaha6526169; qGTAyqsMUOFhGeFReXaFaha6526169 = qGTAyqsMUOFhGeFReXaFaha17790472; qGTAyqsMUOFhGeFReXaFaha17790472 = qGTAyqsMUOFhGeFReXaFaha28957445; qGTAyqsMUOFhGeFReXaFaha28957445 = qGTAyqsMUOFhGeFReXaFaha50869322; qGTAyqsMUOFhGeFReXaFaha50869322 = qGTAyqsMUOFhGeFReXaFaha2863583; qGTAyqsMUOFhGeFReXaFaha2863583 = qGTAyqsMUOFhGeFReXaFaha96411978; qGTAyqsMUOFhGeFReXaFaha96411978 = qGTAyqsMUOFhGeFReXaFaha18137032; qGTAyqsMUOFhGeFReXaFaha18137032 = qGTAyqsMUOFhGeFReXaFaha98631380; qGTAyqsMUOFhGeFReXaFaha98631380 = qGTAyqsMUOFhGeFReXaFaha3623215; qGTAyqsMUOFhGeFReXaFaha3623215 = qGTAyqsMUOFhGeFReXaFaha16246777; qGTAyqsMUOFhGeFReXaFaha16246777 = qGTAyqsMUOFhGeFReXaFaha22102488; qGTAyqsMUOFhGeFReXaFaha22102488 = qGTAyqsMUOFhGeFReXaFaha12952986; qGTAyqsMUOFhGeFReXaFaha12952986 = qGTAyqsMUOFhGeFReXaFaha30004827; qGTAyqsMUOFhGeFReXaFaha30004827 = qGTAyqsMUOFhGeFReXaFaha16253156; qGTAyqsMUOFhGeFReXaFaha16253156 = qGTAyqsMUOFhGeFReXaFaha75088875; qGTAyqsMUOFhGeFReXaFaha75088875 = qGTAyqsMUOFhGeFReXaFaha3930318; qGTAyqsMUOFhGeFReXaFaha3930318 = qGTAyqsMUOFhGeFReXaFaha86403478; qGTAyqsMUOFhGeFReXaFaha86403478 = qGTAyqsMUOFhGeFReXaFaha17182347; qGTAyqsMUOFhGeFReXaFaha17182347 = qGTAyqsMUOFhGeFReXaFaha86291785; qGTAyqsMUOFhGeFReXaFaha86291785 = qGTAyqsMUOFhGeFReXaFaha46468223; qGTAyqsMUOFhGeFReXaFaha46468223 = qGTAyqsMUOFhGeFReXaFaha38710642; qGTAyqsMUOFhGeFReXaFaha38710642 = qGTAyqsMUOFhGeFReXaFaha22900267; qGTAyqsMUOFhGeFReXaFaha22900267 = qGTAyqsMUOFhGeFReXaFaha67114564; qGTAyqsMUOFhGeFReXaFaha67114564 = qGTAyqsMUOFhGeFReXaFaha64545330; qGTAyqsMUOFhGeFReXaFaha64545330 = qGTAyqsMUOFhGeFReXaFaha35010743; qGTAyqsMUOFhGeFReXaFaha35010743 = qGTAyqsMUOFhGeFReXaFaha88258642;}
void jGtUJvdMUazeyqkNXrnMtLagvb68692827() { float zlChnFdJslrFfoUnXaOPjgt71982160 = -896005802; float zlChnFdJslrFfoUnXaOPjgt86207661 = -351061433; float zlChnFdJslrFfoUnXaOPjgt415567 = -208690799; float zlChnFdJslrFfoUnXaOPjgt22880503 = -572320524; float zlChnFdJslrFfoUnXaOPjgt99028901 = -432029146; float zlChnFdJslrFfoUnXaOPjgt14014154 = -776076049; float zlChnFdJslrFfoUnXaOPjgt59566485 = -465740980; float zlChnFdJslrFfoUnXaOPjgt9970398 = -308316304; float zlChnFdJslrFfoUnXaOPjgt37260602 = -202434431; float zlChnFdJslrFfoUnXaOPjgt27820671 = -385110439; float zlChnFdJslrFfoUnXaOPjgt40830877 = -132274872; float zlChnFdJslrFfoUnXaOPjgt92452514 = -937633185; float zlChnFdJslrFfoUnXaOPjgt64957907 = -452578727; float zlChnFdJslrFfoUnXaOPjgt31296673 = -173225553; float zlChnFdJslrFfoUnXaOPjgt12420509 = -149649516; float zlChnFdJslrFfoUnXaOPjgt48258821 = -629813867; float zlChnFdJslrFfoUnXaOPjgt46708236 = 50831221; float zlChnFdJslrFfoUnXaOPjgt9497076 = -964186280; float zlChnFdJslrFfoUnXaOPjgt58438620 = -734179680; float zlChnFdJslrFfoUnXaOPjgt85965327 = -123283564; float zlChnFdJslrFfoUnXaOPjgt68267824 = -281322182; float zlChnFdJslrFfoUnXaOPjgt7105662 = -453622733; float zlChnFdJslrFfoUnXaOPjgt29600161 = 56262025; float zlChnFdJslrFfoUnXaOPjgt26625231 = -488734671; float zlChnFdJslrFfoUnXaOPjgt52520395 = -284181987; float zlChnFdJslrFfoUnXaOPjgt5498545 = -152766882; float zlChnFdJslrFfoUnXaOPjgt79373744 = -314572693; float zlChnFdJslrFfoUnXaOPjgt56680006 = -171822465; float zlChnFdJslrFfoUnXaOPjgt67046579 = -648234409; float zlChnFdJslrFfoUnXaOPjgt1390846 = -288462255; float zlChnFdJslrFfoUnXaOPjgt96157985 = -299213096; float zlChnFdJslrFfoUnXaOPjgt83132658 = -991762236; float zlChnFdJslrFfoUnXaOPjgt44584932 = -956680828; float zlChnFdJslrFfoUnXaOPjgt34679545 = -129652287; float zlChnFdJslrFfoUnXaOPjgt24847253 = -56807462; float zlChnFdJslrFfoUnXaOPjgt1976823 = -370455129; float zlChnFdJslrFfoUnXaOPjgt72513982 = -680450838; float zlChnFdJslrFfoUnXaOPjgt77378385 = -246759432; float zlChnFdJslrFfoUnXaOPjgt13869283 = -31622567; float zlChnFdJslrFfoUnXaOPjgt30550170 = 4823043; float zlChnFdJslrFfoUnXaOPjgt12083279 = -962685921; float zlChnFdJslrFfoUnXaOPjgt23741871 = -675681113; float zlChnFdJslrFfoUnXaOPjgt21113265 = -717399430; float zlChnFdJslrFfoUnXaOPjgt78662369 = -138089603; float zlChnFdJslrFfoUnXaOPjgt2600465 = -108046838; float zlChnFdJslrFfoUnXaOPjgt57321600 = -563304280; float zlChnFdJslrFfoUnXaOPjgt89272777 = -461461166; float zlChnFdJslrFfoUnXaOPjgt78386620 = -649573399; float zlChnFdJslrFfoUnXaOPjgt49323639 = -526622299; float zlChnFdJslrFfoUnXaOPjgt27378553 = -315178767; float zlChnFdJslrFfoUnXaOPjgt89686573 = -849666427; float zlChnFdJslrFfoUnXaOPjgt44196795 = -146815147; float zlChnFdJslrFfoUnXaOPjgt90768786 = -328141724; float zlChnFdJslrFfoUnXaOPjgt46388010 = -259719910; float zlChnFdJslrFfoUnXaOPjgt425004 = -124753109; float zlChnFdJslrFfoUnXaOPjgt64876499 = -342383069; float zlChnFdJslrFfoUnXaOPjgt56607501 = -307323459; float zlChnFdJslrFfoUnXaOPjgt73790336 = -719956128; float zlChnFdJslrFfoUnXaOPjgt70360108 = -188138538; float zlChnFdJslrFfoUnXaOPjgt93530356 = -179262264; float zlChnFdJslrFfoUnXaOPjgt34640409 = -361503357; float zlChnFdJslrFfoUnXaOPjgt2886479 = -193918515; float zlChnFdJslrFfoUnXaOPjgt42923819 = -660081895; float zlChnFdJslrFfoUnXaOPjgt35869756 = -913972177; float zlChnFdJslrFfoUnXaOPjgt31662685 = 14102657; float zlChnFdJslrFfoUnXaOPjgt57698218 = -140512636; float zlChnFdJslrFfoUnXaOPjgt47867582 = -980952358; float zlChnFdJslrFfoUnXaOPjgt30278362 = -222926441; float zlChnFdJslrFfoUnXaOPjgt6449421 = -16418091; float zlChnFdJslrFfoUnXaOPjgt10443687 = -779194387; float zlChnFdJslrFfoUnXaOPjgt75744838 = -949363029; float zlChnFdJslrFfoUnXaOPjgt69329850 = -702409348; float zlChnFdJslrFfoUnXaOPjgt95627792 = -832563714; float zlChnFdJslrFfoUnXaOPjgt27888451 = -639002723; float zlChnFdJslrFfoUnXaOPjgt73882049 = -160597644; float zlChnFdJslrFfoUnXaOPjgt44525953 = -605641070; float zlChnFdJslrFfoUnXaOPjgt85992396 = -736223304; float zlChnFdJslrFfoUnXaOPjgt50937791 = -805648372; float zlChnFdJslrFfoUnXaOPjgt24024766 = -280687834; float zlChnFdJslrFfoUnXaOPjgt95198794 = -720877707; float zlChnFdJslrFfoUnXaOPjgt16225768 = -691305717; float zlChnFdJslrFfoUnXaOPjgt987125 = -664999294; float zlChnFdJslrFfoUnXaOPjgt7356368 = -645200166; float zlChnFdJslrFfoUnXaOPjgt39668026 = -233055643; float zlChnFdJslrFfoUnXaOPjgt11704273 = -438795829; float zlChnFdJslrFfoUnXaOPjgt51961191 = -52397950; float zlChnFdJslrFfoUnXaOPjgt92363871 = -563620513; float zlChnFdJslrFfoUnXaOPjgt98196921 = -596960918; float zlChnFdJslrFfoUnXaOPjgt34254542 = 95100821; float zlChnFdJslrFfoUnXaOPjgt59970754 = -714424394; float zlChnFdJslrFfoUnXaOPjgt45369321 = 36868329; float zlChnFdJslrFfoUnXaOPjgt98723646 = -960494710; float zlChnFdJslrFfoUnXaOPjgt7018278 = 41379105; float zlChnFdJslrFfoUnXaOPjgt20338926 = -852360304; float zlChnFdJslrFfoUnXaOPjgt95909760 = -633673601; float zlChnFdJslrFfoUnXaOPjgt9196800 = -668767406; float zlChnFdJslrFfoUnXaOPjgt80818052 = 84400782; float zlChnFdJslrFfoUnXaOPjgt85243509 = -803427254; float zlChnFdJslrFfoUnXaOPjgt46999684 = -52192260; float zlChnFdJslrFfoUnXaOPjgt44902246 = -896005802; zlChnFdJslrFfoUnXaOPjgt71982160 = zlChnFdJslrFfoUnXaOPjgt86207661; zlChnFdJslrFfoUnXaOPjgt86207661 = zlChnFdJslrFfoUnXaOPjgt415567; zlChnFdJslrFfoUnXaOPjgt415567 = zlChnFdJslrFfoUnXaOPjgt22880503; zlChnFdJslrFfoUnXaOPjgt22880503 = zlChnFdJslrFfoUnXaOPjgt99028901; zlChnFdJslrFfoUnXaOPjgt99028901 = zlChnFdJslrFfoUnXaOPjgt14014154; zlChnFdJslrFfoUnXaOPjgt14014154 = zlChnFdJslrFfoUnXaOPjgt59566485; zlChnFdJslrFfoUnXaOPjgt59566485 = zlChnFdJslrFfoUnXaOPjgt9970398; zlChnFdJslrFfoUnXaOPjgt9970398 = zlChnFdJslrFfoUnXaOPjgt37260602; zlChnFdJslrFfoUnXaOPjgt37260602 = zlChnFdJslrFfoUnXaOPjgt27820671; zlChnFdJslrFfoUnXaOPjgt27820671 = zlChnFdJslrFfoUnXaOPjgt40830877; zlChnFdJslrFfoUnXaOPjgt40830877 = zlChnFdJslrFfoUnXaOPjgt92452514; zlChnFdJslrFfoUnXaOPjgt92452514 = zlChnFdJslrFfoUnXaOPjgt64957907; zlChnFdJslrFfoUnXaOPjgt64957907 = zlChnFdJslrFfoUnXaOPjgt31296673; zlChnFdJslrFfoUnXaOPjgt31296673 = zlChnFdJslrFfoUnXaOPjgt12420509; zlChnFdJslrFfoUnXaOPjgt12420509 = zlChnFdJslrFfoUnXaOPjgt48258821; zlChnFdJslrFfoUnXaOPjgt48258821 = zlChnFdJslrFfoUnXaOPjgt46708236; zlChnFdJslrFfoUnXaOPjgt46708236 = zlChnFdJslrFfoUnXaOPjgt9497076; zlChnFdJslrFfoUnXaOPjgt9497076 = zlChnFdJslrFfoUnXaOPjgt58438620; zlChnFdJslrFfoUnXaOPjgt58438620 = zlChnFdJslrFfoUnXaOPjgt85965327; zlChnFdJslrFfoUnXaOPjgt85965327 = zlChnFdJslrFfoUnXaOPjgt68267824; zlChnFdJslrFfoUnXaOPjgt68267824 = zlChnFdJslrFfoUnXaOPjgt7105662; zlChnFdJslrFfoUnXaOPjgt7105662 = zlChnFdJslrFfoUnXaOPjgt29600161; zlChnFdJslrFfoUnXaOPjgt29600161 = zlChnFdJslrFfoUnXaOPjgt26625231; zlChnFdJslrFfoUnXaOPjgt26625231 = zlChnFdJslrFfoUnXaOPjgt52520395; zlChnFdJslrFfoUnXaOPjgt52520395 = zlChnFdJslrFfoUnXaOPjgt5498545; zlChnFdJslrFfoUnXaOPjgt5498545 = zlChnFdJslrFfoUnXaOPjgt79373744; zlChnFdJslrFfoUnXaOPjgt79373744 = zlChnFdJslrFfoUnXaOPjgt56680006; zlChnFdJslrFfoUnXaOPjgt56680006 = zlChnFdJslrFfoUnXaOPjgt67046579; zlChnFdJslrFfoUnXaOPjgt67046579 = zlChnFdJslrFfoUnXaOPjgt1390846; zlChnFdJslrFfoUnXaOPjgt1390846 = zlChnFdJslrFfoUnXaOPjgt96157985; zlChnFdJslrFfoUnXaOPjgt96157985 = zlChnFdJslrFfoUnXaOPjgt83132658; zlChnFdJslrFfoUnXaOPjgt83132658 = zlChnFdJslrFfoUnXaOPjgt44584932; zlChnFdJslrFfoUnXaOPjgt44584932 = zlChnFdJslrFfoUnXaOPjgt34679545; zlChnFdJslrFfoUnXaOPjgt34679545 = zlChnFdJslrFfoUnXaOPjgt24847253; zlChnFdJslrFfoUnXaOPjgt24847253 = zlChnFdJslrFfoUnXaOPjgt1976823; zlChnFdJslrFfoUnXaOPjgt1976823 = zlChnFdJslrFfoUnXaOPjgt72513982; zlChnFdJslrFfoUnXaOPjgt72513982 = zlChnFdJslrFfoUnXaOPjgt77378385; zlChnFdJslrFfoUnXaOPjgt77378385 = zlChnFdJslrFfoUnXaOPjgt13869283; zlChnFdJslrFfoUnXaOPjgt13869283 = zlChnFdJslrFfoUnXaOPjgt30550170; zlChnFdJslrFfoUnXaOPjgt30550170 = zlChnFdJslrFfoUnXaOPjgt12083279; zlChnFdJslrFfoUnXaOPjgt12083279 = zlChnFdJslrFfoUnXaOPjgt23741871; zlChnFdJslrFfoUnXaOPjgt23741871 = zlChnFdJslrFfoUnXaOPjgt21113265; zlChnFdJslrFfoUnXaOPjgt21113265 = zlChnFdJslrFfoUnXaOPjgt78662369; zlChnFdJslrFfoUnXaOPjgt78662369 = zlChnFdJslrFfoUnXaOPjgt2600465; zlChnFdJslrFfoUnXaOPjgt2600465 = zlChnFdJslrFfoUnXaOPjgt57321600; zlChnFdJslrFfoUnXaOPjgt57321600 = zlChnFdJslrFfoUnXaOPjgt89272777; zlChnFdJslrFfoUnXaOPjgt89272777 = zlChnFdJslrFfoUnXaOPjgt78386620; zlChnFdJslrFfoUnXaOPjgt78386620 = zlChnFdJslrFfoUnXaOPjgt49323639; zlChnFdJslrFfoUnXaOPjgt49323639 = zlChnFdJslrFfoUnXaOPjgt27378553; zlChnFdJslrFfoUnXaOPjgt27378553 = zlChnFdJslrFfoUnXaOPjgt89686573; zlChnFdJslrFfoUnXaOPjgt89686573 = zlChnFdJslrFfoUnXaOPjgt44196795; zlChnFdJslrFfoUnXaOPjgt44196795 = zlChnFdJslrFfoUnXaOPjgt90768786; zlChnFdJslrFfoUnXaOPjgt90768786 = zlChnFdJslrFfoUnXaOPjgt46388010; zlChnFdJslrFfoUnXaOPjgt46388010 = zlChnFdJslrFfoUnXaOPjgt425004; zlChnFdJslrFfoUnXaOPjgt425004 = zlChnFdJslrFfoUnXaOPjgt64876499; zlChnFdJslrFfoUnXaOPjgt64876499 = zlChnFdJslrFfoUnXaOPjgt56607501; zlChnFdJslrFfoUnXaOPjgt56607501 = zlChnFdJslrFfoUnXaOPjgt73790336; zlChnFdJslrFfoUnXaOPjgt73790336 = zlChnFdJslrFfoUnXaOPjgt70360108; zlChnFdJslrFfoUnXaOPjgt70360108 = zlChnFdJslrFfoUnXaOPjgt93530356; zlChnFdJslrFfoUnXaOPjgt93530356 = zlChnFdJslrFfoUnXaOPjgt34640409; zlChnFdJslrFfoUnXaOPjgt34640409 = zlChnFdJslrFfoUnXaOPjgt2886479; zlChnFdJslrFfoUnXaOPjgt2886479 = zlChnFdJslrFfoUnXaOPjgt42923819; zlChnFdJslrFfoUnXaOPjgt42923819 = zlChnFdJslrFfoUnXaOPjgt35869756; zlChnFdJslrFfoUnXaOPjgt35869756 = zlChnFdJslrFfoUnXaOPjgt31662685; zlChnFdJslrFfoUnXaOPjgt31662685 = zlChnFdJslrFfoUnXaOPjgt57698218; zlChnFdJslrFfoUnXaOPjgt57698218 = zlChnFdJslrFfoUnXaOPjgt47867582; zlChnFdJslrFfoUnXaOPjgt47867582 = zlChnFdJslrFfoUnXaOPjgt30278362; zlChnFdJslrFfoUnXaOPjgt30278362 = zlChnFdJslrFfoUnXaOPjgt6449421; zlChnFdJslrFfoUnXaOPjgt6449421 = zlChnFdJslrFfoUnXaOPjgt10443687; zlChnFdJslrFfoUnXaOPjgt10443687 = zlChnFdJslrFfoUnXaOPjgt75744838; zlChnFdJslrFfoUnXaOPjgt75744838 = zlChnFdJslrFfoUnXaOPjgt69329850; zlChnFdJslrFfoUnXaOPjgt69329850 = zlChnFdJslrFfoUnXaOPjgt95627792; zlChnFdJslrFfoUnXaOPjgt95627792 = zlChnFdJslrFfoUnXaOPjgt27888451; zlChnFdJslrFfoUnXaOPjgt27888451 = zlChnFdJslrFfoUnXaOPjgt73882049; zlChnFdJslrFfoUnXaOPjgt73882049 = zlChnFdJslrFfoUnXaOPjgt44525953; zlChnFdJslrFfoUnXaOPjgt44525953 = zlChnFdJslrFfoUnXaOPjgt85992396; zlChnFdJslrFfoUnXaOPjgt85992396 = zlChnFdJslrFfoUnXaOPjgt50937791; zlChnFdJslrFfoUnXaOPjgt50937791 = zlChnFdJslrFfoUnXaOPjgt24024766; zlChnFdJslrFfoUnXaOPjgt24024766 = zlChnFdJslrFfoUnXaOPjgt95198794; zlChnFdJslrFfoUnXaOPjgt95198794 = zlChnFdJslrFfoUnXaOPjgt16225768; zlChnFdJslrFfoUnXaOPjgt16225768 = zlChnFdJslrFfoUnXaOPjgt987125; zlChnFdJslrFfoUnXaOPjgt987125 = zlChnFdJslrFfoUnXaOPjgt7356368; zlChnFdJslrFfoUnXaOPjgt7356368 = zlChnFdJslrFfoUnXaOPjgt39668026; zlChnFdJslrFfoUnXaOPjgt39668026 = zlChnFdJslrFfoUnXaOPjgt11704273; zlChnFdJslrFfoUnXaOPjgt11704273 = zlChnFdJslrFfoUnXaOPjgt51961191; zlChnFdJslrFfoUnXaOPjgt51961191 = zlChnFdJslrFfoUnXaOPjgt92363871; zlChnFdJslrFfoUnXaOPjgt92363871 = zlChnFdJslrFfoUnXaOPjgt98196921; zlChnFdJslrFfoUnXaOPjgt98196921 = zlChnFdJslrFfoUnXaOPjgt34254542; zlChnFdJslrFfoUnXaOPjgt34254542 = zlChnFdJslrFfoUnXaOPjgt59970754; zlChnFdJslrFfoUnXaOPjgt59970754 = zlChnFdJslrFfoUnXaOPjgt45369321; zlChnFdJslrFfoUnXaOPjgt45369321 = zlChnFdJslrFfoUnXaOPjgt98723646; zlChnFdJslrFfoUnXaOPjgt98723646 = zlChnFdJslrFfoUnXaOPjgt7018278; zlChnFdJslrFfoUnXaOPjgt7018278 = zlChnFdJslrFfoUnXaOPjgt20338926; zlChnFdJslrFfoUnXaOPjgt20338926 = zlChnFdJslrFfoUnXaOPjgt95909760; zlChnFdJslrFfoUnXaOPjgt95909760 = zlChnFdJslrFfoUnXaOPjgt9196800; zlChnFdJslrFfoUnXaOPjgt9196800 = zlChnFdJslrFfoUnXaOPjgt80818052; zlChnFdJslrFfoUnXaOPjgt80818052 = zlChnFdJslrFfoUnXaOPjgt85243509; zlChnFdJslrFfoUnXaOPjgt85243509 = zlChnFdJslrFfoUnXaOPjgt46999684; zlChnFdJslrFfoUnXaOPjgt46999684 = zlChnFdJslrFfoUnXaOPjgt44902246; zlChnFdJslrFfoUnXaOPjgt44902246 = zlChnFdJslrFfoUnXaOPjgt71982160;}
void JhbRELmEMLLXAHalhEPOuYYRXQ53755665() { float khEHMQgdYzWRSBBwUfCDXWZ55705678 = -146027869; float khEHMQgdYzWRSBBwUfCDXWZ83805757 = -154713284; float khEHMQgdYzWRSBBwUfCDXWZ89001683 = -76998489; float khEHMQgdYzWRSBBwUfCDXWZ20028456 = -577202453; float khEHMQgdYzWRSBBwUfCDXWZ78590238 = -829977337; float khEHMQgdYzWRSBBwUfCDXWZ25353671 = -879396718; float khEHMQgdYzWRSBBwUfCDXWZ96447048 = -487255118; float khEHMQgdYzWRSBBwUfCDXWZ53310481 = -928770890; float khEHMQgdYzWRSBBwUfCDXWZ87480130 = -899917128; float khEHMQgdYzWRSBBwUfCDXWZ73926259 = -608151455; float khEHMQgdYzWRSBBwUfCDXWZ83719912 = 27439870; float khEHMQgdYzWRSBBwUfCDXWZ82664284 = -866772457; float khEHMQgdYzWRSBBwUfCDXWZ16011760 = -295410971; float khEHMQgdYzWRSBBwUfCDXWZ25669818 = -522908415; float khEHMQgdYzWRSBBwUfCDXWZ16599768 = -75346821; float khEHMQgdYzWRSBBwUfCDXWZ20072850 = -553941518; float khEHMQgdYzWRSBBwUfCDXWZ46573647 = -108048642; float khEHMQgdYzWRSBBwUfCDXWZ23574345 = -575037854; float khEHMQgdYzWRSBBwUfCDXWZ99415101 = -522828918; float khEHMQgdYzWRSBBwUfCDXWZ60072972 = -839576481; float khEHMQgdYzWRSBBwUfCDXWZ35607334 = -955788703; float khEHMQgdYzWRSBBwUfCDXWZ8107733 = -366778020; float khEHMQgdYzWRSBBwUfCDXWZ98776025 = 26867288; float khEHMQgdYzWRSBBwUfCDXWZ27767926 = -27967324; float khEHMQgdYzWRSBBwUfCDXWZ89122487 = -362512748; float khEHMQgdYzWRSBBwUfCDXWZ58491302 = -595733910; float khEHMQgdYzWRSBBwUfCDXWZ965684 = -758448116; float khEHMQgdYzWRSBBwUfCDXWZ99279206 = 41736047; float khEHMQgdYzWRSBBwUfCDXWZ38964721 = -72430309; float khEHMQgdYzWRSBBwUfCDXWZ36939173 = -961068630; float khEHMQgdYzWRSBBwUfCDXWZ77522408 = -518311117; float khEHMQgdYzWRSBBwUfCDXWZ7925947 = -440959459; float khEHMQgdYzWRSBBwUfCDXWZ58709633 = -521894919; float khEHMQgdYzWRSBBwUfCDXWZ70404259 = -533748934; float khEHMQgdYzWRSBBwUfCDXWZ92450578 = -891098070; float khEHMQgdYzWRSBBwUfCDXWZ71838056 = -348851606; float khEHMQgdYzWRSBBwUfCDXWZ72277572 = 99207865; float khEHMQgdYzWRSBBwUfCDXWZ27760176 = -145902649; float khEHMQgdYzWRSBBwUfCDXWZ74485002 = -337181448; float khEHMQgdYzWRSBBwUfCDXWZ69739285 = 58176163; float khEHMQgdYzWRSBBwUfCDXWZ76850799 = -612726047; float khEHMQgdYzWRSBBwUfCDXWZ53081598 = -281706782; float khEHMQgdYzWRSBBwUfCDXWZ53913411 = -369803684; float khEHMQgdYzWRSBBwUfCDXWZ25857889 = -817033336; float khEHMQgdYzWRSBBwUfCDXWZ30587716 = -434060916; float khEHMQgdYzWRSBBwUfCDXWZ1588482 = -178335972; float khEHMQgdYzWRSBBwUfCDXWZ22451747 = -483107073; float khEHMQgdYzWRSBBwUfCDXWZ17128468 = -411695296; float khEHMQgdYzWRSBBwUfCDXWZ83197852 = -226406451; float khEHMQgdYzWRSBBwUfCDXWZ63251883 = -947194202; float khEHMQgdYzWRSBBwUfCDXWZ29777405 = 84561172; float khEHMQgdYzWRSBBwUfCDXWZ95702514 = -998867933; float khEHMQgdYzWRSBBwUfCDXWZ36151189 = -340074090; float khEHMQgdYzWRSBBwUfCDXWZ92320615 = -836429098; float khEHMQgdYzWRSBBwUfCDXWZ18148332 = -441480054; float khEHMQgdYzWRSBBwUfCDXWZ47597946 = -779249850; float khEHMQgdYzWRSBBwUfCDXWZ85029731 = -81580573; float khEHMQgdYzWRSBBwUfCDXWZ61233758 = 50968834; float khEHMQgdYzWRSBBwUfCDXWZ30905968 = -114689705; float khEHMQgdYzWRSBBwUfCDXWZ20098936 = -134243428; float khEHMQgdYzWRSBBwUfCDXWZ24387987 = -20948602; float khEHMQgdYzWRSBBwUfCDXWZ97167841 = -428991165; float khEHMQgdYzWRSBBwUfCDXWZ14345761 = -756340581; float khEHMQgdYzWRSBBwUfCDXWZ50540957 = -938848499; float khEHMQgdYzWRSBBwUfCDXWZ96403850 = 10159662; float khEHMQgdYzWRSBBwUfCDXWZ75793966 = -531600672; float khEHMQgdYzWRSBBwUfCDXWZ23954652 = -244877538; float khEHMQgdYzWRSBBwUfCDXWZ45607500 = -761662037; float khEHMQgdYzWRSBBwUfCDXWZ33219239 = -631810346; float khEHMQgdYzWRSBBwUfCDXWZ44761711 = -726495215; float khEHMQgdYzWRSBBwUfCDXWZ47795277 = -553149384; float khEHMQgdYzWRSBBwUfCDXWZ18813471 = -962145994; float khEHMQgdYzWRSBBwUfCDXWZ49089343 = -137856406; float khEHMQgdYzWRSBBwUfCDXWZ29675816 = -481005082; float khEHMQgdYzWRSBBwUfCDXWZ83222173 = -126850434; float khEHMQgdYzWRSBBwUfCDXWZ82525736 = -574081921; float khEHMQgdYzWRSBBwUfCDXWZ54194321 = -996974336; float khEHMQgdYzWRSBBwUfCDXWZ72918137 = -156099377; float khEHMQgdYzWRSBBwUfCDXWZ97180210 = -593906409; float khEHMQgdYzWRSBBwUfCDXWZ87534005 = -84176777; float khEHMQgdYzWRSBBwUfCDXWZ36039556 = -12626838; float khEHMQgdYzWRSBBwUfCDXWZ83837216 = -246752820; float khEHMQgdYzWRSBBwUfCDXWZ16081355 = -731857503; float khEHMQgdYzWRSBBwUfCDXWZ75712838 = -125236108; float khEHMQgdYzWRSBBwUfCDXWZ7161768 = -945629802; float khEHMQgdYzWRSBBwUfCDXWZ81819894 = -519443184; float khEHMQgdYzWRSBBwUfCDXWZ71774757 = -885370; float khEHMQgdYzWRSBBwUfCDXWZ66389017 = -685465822; float khEHMQgdYzWRSBBwUfCDXWZ52255928 = 7731119; float khEHMQgdYzWRSBBwUfCDXWZ44852632 = -11848221; float khEHMQgdYzWRSBBwUfCDXWZ86808324 = -167271034; float khEHMQgdYzWRSBBwUfCDXWZ11043815 = -951760969; float khEHMQgdYzWRSBBwUfCDXWZ96854208 = 68787056; float khEHMQgdYzWRSBBwUfCDXWZ54386066 = -102938021; float khEHMQgdYzWRSBBwUfCDXWZ45351298 = -920875235; float khEHMQgdYzWRSBBwUfCDXWZ79682957 = -83734883; float khEHMQgdYzWRSBBwUfCDXWZ38735838 = -525366202; float khEHMQgdYzWRSBBwUfCDXWZ3372454 = -430955186; float khEHMQgdYzWRSBBwUfCDXWZ29454039 = -727192998; float khEHMQgdYzWRSBBwUfCDXWZ54793749 = -146027869; khEHMQgdYzWRSBBwUfCDXWZ55705678 = khEHMQgdYzWRSBBwUfCDXWZ83805757; khEHMQgdYzWRSBBwUfCDXWZ83805757 = khEHMQgdYzWRSBBwUfCDXWZ89001683; khEHMQgdYzWRSBBwUfCDXWZ89001683 = khEHMQgdYzWRSBBwUfCDXWZ20028456; khEHMQgdYzWRSBBwUfCDXWZ20028456 = khEHMQgdYzWRSBBwUfCDXWZ78590238; khEHMQgdYzWRSBBwUfCDXWZ78590238 = khEHMQgdYzWRSBBwUfCDXWZ25353671; khEHMQgdYzWRSBBwUfCDXWZ25353671 = khEHMQgdYzWRSBBwUfCDXWZ96447048; khEHMQgdYzWRSBBwUfCDXWZ96447048 = khEHMQgdYzWRSBBwUfCDXWZ53310481; khEHMQgdYzWRSBBwUfCDXWZ53310481 = khEHMQgdYzWRSBBwUfCDXWZ87480130; khEHMQgdYzWRSBBwUfCDXWZ87480130 = khEHMQgdYzWRSBBwUfCDXWZ73926259; khEHMQgdYzWRSBBwUfCDXWZ73926259 = khEHMQgdYzWRSBBwUfCDXWZ83719912; khEHMQgdYzWRSBBwUfCDXWZ83719912 = khEHMQgdYzWRSBBwUfCDXWZ82664284; khEHMQgdYzWRSBBwUfCDXWZ82664284 = khEHMQgdYzWRSBBwUfCDXWZ16011760; khEHMQgdYzWRSBBwUfCDXWZ16011760 = khEHMQgdYzWRSBBwUfCDXWZ25669818; khEHMQgdYzWRSBBwUfCDXWZ25669818 = khEHMQgdYzWRSBBwUfCDXWZ16599768; khEHMQgdYzWRSBBwUfCDXWZ16599768 = khEHMQgdYzWRSBBwUfCDXWZ20072850; khEHMQgdYzWRSBBwUfCDXWZ20072850 = khEHMQgdYzWRSBBwUfCDXWZ46573647; khEHMQgdYzWRSBBwUfCDXWZ46573647 = khEHMQgdYzWRSBBwUfCDXWZ23574345; khEHMQgdYzWRSBBwUfCDXWZ23574345 = khEHMQgdYzWRSBBwUfCDXWZ99415101; khEHMQgdYzWRSBBwUfCDXWZ99415101 = khEHMQgdYzWRSBBwUfCDXWZ60072972; khEHMQgdYzWRSBBwUfCDXWZ60072972 = khEHMQgdYzWRSBBwUfCDXWZ35607334; khEHMQgdYzWRSBBwUfCDXWZ35607334 = khEHMQgdYzWRSBBwUfCDXWZ8107733; khEHMQgdYzWRSBBwUfCDXWZ8107733 = khEHMQgdYzWRSBBwUfCDXWZ98776025; khEHMQgdYzWRSBBwUfCDXWZ98776025 = khEHMQgdYzWRSBBwUfCDXWZ27767926; khEHMQgdYzWRSBBwUfCDXWZ27767926 = khEHMQgdYzWRSBBwUfCDXWZ89122487; khEHMQgdYzWRSBBwUfCDXWZ89122487 = khEHMQgdYzWRSBBwUfCDXWZ58491302; khEHMQgdYzWRSBBwUfCDXWZ58491302 = khEHMQgdYzWRSBBwUfCDXWZ965684; khEHMQgdYzWRSBBwUfCDXWZ965684 = khEHMQgdYzWRSBBwUfCDXWZ99279206; khEHMQgdYzWRSBBwUfCDXWZ99279206 = khEHMQgdYzWRSBBwUfCDXWZ38964721; khEHMQgdYzWRSBBwUfCDXWZ38964721 = khEHMQgdYzWRSBBwUfCDXWZ36939173; khEHMQgdYzWRSBBwUfCDXWZ36939173 = khEHMQgdYzWRSBBwUfCDXWZ77522408; khEHMQgdYzWRSBBwUfCDXWZ77522408 = khEHMQgdYzWRSBBwUfCDXWZ7925947; khEHMQgdYzWRSBBwUfCDXWZ7925947 = khEHMQgdYzWRSBBwUfCDXWZ58709633; khEHMQgdYzWRSBBwUfCDXWZ58709633 = khEHMQgdYzWRSBBwUfCDXWZ70404259; khEHMQgdYzWRSBBwUfCDXWZ70404259 = khEHMQgdYzWRSBBwUfCDXWZ92450578; khEHMQgdYzWRSBBwUfCDXWZ92450578 = khEHMQgdYzWRSBBwUfCDXWZ71838056; khEHMQgdYzWRSBBwUfCDXWZ71838056 = khEHMQgdYzWRSBBwUfCDXWZ72277572; khEHMQgdYzWRSBBwUfCDXWZ72277572 = khEHMQgdYzWRSBBwUfCDXWZ27760176; khEHMQgdYzWRSBBwUfCDXWZ27760176 = khEHMQgdYzWRSBBwUfCDXWZ74485002; khEHMQgdYzWRSBBwUfCDXWZ74485002 = khEHMQgdYzWRSBBwUfCDXWZ69739285; khEHMQgdYzWRSBBwUfCDXWZ69739285 = khEHMQgdYzWRSBBwUfCDXWZ76850799; khEHMQgdYzWRSBBwUfCDXWZ76850799 = khEHMQgdYzWRSBBwUfCDXWZ53081598; khEHMQgdYzWRSBBwUfCDXWZ53081598 = khEHMQgdYzWRSBBwUfCDXWZ53913411; khEHMQgdYzWRSBBwUfCDXWZ53913411 = khEHMQgdYzWRSBBwUfCDXWZ25857889; khEHMQgdYzWRSBBwUfCDXWZ25857889 = khEHMQgdYzWRSBBwUfCDXWZ30587716; khEHMQgdYzWRSBBwUfCDXWZ30587716 = khEHMQgdYzWRSBBwUfCDXWZ1588482; khEHMQgdYzWRSBBwUfCDXWZ1588482 = khEHMQgdYzWRSBBwUfCDXWZ22451747; khEHMQgdYzWRSBBwUfCDXWZ22451747 = khEHMQgdYzWRSBBwUfCDXWZ17128468; khEHMQgdYzWRSBBwUfCDXWZ17128468 = khEHMQgdYzWRSBBwUfCDXWZ83197852; khEHMQgdYzWRSBBwUfCDXWZ83197852 = khEHMQgdYzWRSBBwUfCDXWZ63251883; khEHMQgdYzWRSBBwUfCDXWZ63251883 = khEHMQgdYzWRSBBwUfCDXWZ29777405; khEHMQgdYzWRSBBwUfCDXWZ29777405 = khEHMQgdYzWRSBBwUfCDXWZ95702514; khEHMQgdYzWRSBBwUfCDXWZ95702514 = khEHMQgdYzWRSBBwUfCDXWZ36151189; khEHMQgdYzWRSBBwUfCDXWZ36151189 = khEHMQgdYzWRSBBwUfCDXWZ92320615; khEHMQgdYzWRSBBwUfCDXWZ92320615 = khEHMQgdYzWRSBBwUfCDXWZ18148332; khEHMQgdYzWRSBBwUfCDXWZ18148332 = khEHMQgdYzWRSBBwUfCDXWZ47597946; khEHMQgdYzWRSBBwUfCDXWZ47597946 = khEHMQgdYzWRSBBwUfCDXWZ85029731; khEHMQgdYzWRSBBwUfCDXWZ85029731 = khEHMQgdYzWRSBBwUfCDXWZ61233758; khEHMQgdYzWRSBBwUfCDXWZ61233758 = khEHMQgdYzWRSBBwUfCDXWZ30905968; khEHMQgdYzWRSBBwUfCDXWZ30905968 = khEHMQgdYzWRSBBwUfCDXWZ20098936; khEHMQgdYzWRSBBwUfCDXWZ20098936 = khEHMQgdYzWRSBBwUfCDXWZ24387987; khEHMQgdYzWRSBBwUfCDXWZ24387987 = khEHMQgdYzWRSBBwUfCDXWZ97167841; khEHMQgdYzWRSBBwUfCDXWZ97167841 = khEHMQgdYzWRSBBwUfCDXWZ14345761; khEHMQgdYzWRSBBwUfCDXWZ14345761 = khEHMQgdYzWRSBBwUfCDXWZ50540957; khEHMQgdYzWRSBBwUfCDXWZ50540957 = khEHMQgdYzWRSBBwUfCDXWZ96403850; khEHMQgdYzWRSBBwUfCDXWZ96403850 = khEHMQgdYzWRSBBwUfCDXWZ75793966; khEHMQgdYzWRSBBwUfCDXWZ75793966 = khEHMQgdYzWRSBBwUfCDXWZ23954652; khEHMQgdYzWRSBBwUfCDXWZ23954652 = khEHMQgdYzWRSBBwUfCDXWZ45607500; khEHMQgdYzWRSBBwUfCDXWZ45607500 = khEHMQgdYzWRSBBwUfCDXWZ33219239; khEHMQgdYzWRSBBwUfCDXWZ33219239 = khEHMQgdYzWRSBBwUfCDXWZ44761711; khEHMQgdYzWRSBBwUfCDXWZ44761711 = khEHMQgdYzWRSBBwUfCDXWZ47795277; khEHMQgdYzWRSBBwUfCDXWZ47795277 = khEHMQgdYzWRSBBwUfCDXWZ18813471; khEHMQgdYzWRSBBwUfCDXWZ18813471 = khEHMQgdYzWRSBBwUfCDXWZ49089343; khEHMQgdYzWRSBBwUfCDXWZ49089343 = khEHMQgdYzWRSBBwUfCDXWZ29675816; khEHMQgdYzWRSBBwUfCDXWZ29675816 = khEHMQgdYzWRSBBwUfCDXWZ83222173; khEHMQgdYzWRSBBwUfCDXWZ83222173 = khEHMQgdYzWRSBBwUfCDXWZ82525736; khEHMQgdYzWRSBBwUfCDXWZ82525736 = khEHMQgdYzWRSBBwUfCDXWZ54194321; khEHMQgdYzWRSBBwUfCDXWZ54194321 = khEHMQgdYzWRSBBwUfCDXWZ72918137; khEHMQgdYzWRSBBwUfCDXWZ72918137 = khEHMQgdYzWRSBBwUfCDXWZ97180210; khEHMQgdYzWRSBBwUfCDXWZ97180210 = khEHMQgdYzWRSBBwUfCDXWZ87534005; khEHMQgdYzWRSBBwUfCDXWZ87534005 = khEHMQgdYzWRSBBwUfCDXWZ36039556; khEHMQgdYzWRSBBwUfCDXWZ36039556 = khEHMQgdYzWRSBBwUfCDXWZ83837216; khEHMQgdYzWRSBBwUfCDXWZ83837216 = khEHMQgdYzWRSBBwUfCDXWZ16081355; khEHMQgdYzWRSBBwUfCDXWZ16081355 = khEHMQgdYzWRSBBwUfCDXWZ75712838; khEHMQgdYzWRSBBwUfCDXWZ75712838 = khEHMQgdYzWRSBBwUfCDXWZ7161768; khEHMQgdYzWRSBBwUfCDXWZ7161768 = khEHMQgdYzWRSBBwUfCDXWZ81819894; khEHMQgdYzWRSBBwUfCDXWZ81819894 = khEHMQgdYzWRSBBwUfCDXWZ71774757; khEHMQgdYzWRSBBwUfCDXWZ71774757 = khEHMQgdYzWRSBBwUfCDXWZ66389017; khEHMQgdYzWRSBBwUfCDXWZ66389017 = khEHMQgdYzWRSBBwUfCDXWZ52255928; khEHMQgdYzWRSBBwUfCDXWZ52255928 = khEHMQgdYzWRSBBwUfCDXWZ44852632; khEHMQgdYzWRSBBwUfCDXWZ44852632 = khEHMQgdYzWRSBBwUfCDXWZ86808324; khEHMQgdYzWRSBBwUfCDXWZ86808324 = khEHMQgdYzWRSBBwUfCDXWZ11043815; khEHMQgdYzWRSBBwUfCDXWZ11043815 = khEHMQgdYzWRSBBwUfCDXWZ96854208; khEHMQgdYzWRSBBwUfCDXWZ96854208 = khEHMQgdYzWRSBBwUfCDXWZ54386066; khEHMQgdYzWRSBBwUfCDXWZ54386066 = khEHMQgdYzWRSBBwUfCDXWZ45351298; khEHMQgdYzWRSBBwUfCDXWZ45351298 = khEHMQgdYzWRSBBwUfCDXWZ79682957; khEHMQgdYzWRSBBwUfCDXWZ79682957 = khEHMQgdYzWRSBBwUfCDXWZ38735838; khEHMQgdYzWRSBBwUfCDXWZ38735838 = khEHMQgdYzWRSBBwUfCDXWZ3372454; khEHMQgdYzWRSBBwUfCDXWZ3372454 = khEHMQgdYzWRSBBwUfCDXWZ29454039; khEHMQgdYzWRSBBwUfCDXWZ29454039 = khEHMQgdYzWRSBBwUfCDXWZ54793749; khEHMQgdYzWRSBBwUfCDXWZ54793749 = khEHMQgdYzWRSBBwUfCDXWZ55705678;}
void NVFSUeuYoygOrhKIrlPhdoLbtU38818503() { float VYnQNVOQRcunHtzSYGQNgzN39429197 = -496049936; float VYnQNVOQRcunHtzSYGQNgzN81403852 = 41634865; float VYnQNVOQRcunHtzSYGQNgzN77587801 = 54693820; float VYnQNVOQRcunHtzSYGQNgzN17176409 = -582084382; float VYnQNVOQRcunHtzSYGQNgzN58151574 = -127925529; float VYnQNVOQRcunHtzSYGQNgzN36693189 = -982717387; float VYnQNVOQRcunHtzSYGQNgzN33327611 = -508769256; float VYnQNVOQRcunHtzSYGQNgzN96650563 = -449225476; float VYnQNVOQRcunHtzSYGQNgzN37699659 = -497399824; float VYnQNVOQRcunHtzSYGQNgzN20031848 = -831192470; float VYnQNVOQRcunHtzSYGQNgzN26608949 = -912845388; float VYnQNVOQRcunHtzSYGQNgzN72876055 = -795911728; float VYnQNVOQRcunHtzSYGQNgzN67065611 = -138243214; float VYnQNVOQRcunHtzSYGQNgzN20042962 = -872591278; float VYnQNVOQRcunHtzSYGQNgzN20779027 = -1044126; float VYnQNVOQRcunHtzSYGQNgzN91886878 = -478069170; float VYnQNVOQRcunHtzSYGQNgzN46439057 = -266928505; float VYnQNVOQRcunHtzSYGQNgzN37651615 = -185889428; float VYnQNVOQRcunHtzSYGQNgzN40391582 = -311478156; float VYnQNVOQRcunHtzSYGQNgzN34180616 = -455869398; float VYnQNVOQRcunHtzSYGQNgzN2946845 = -530255224; float VYnQNVOQRcunHtzSYGQNgzN9109804 = -279933306; float VYnQNVOQRcunHtzSYGQNgzN67951891 = -2527448; float VYnQNVOQRcunHtzSYGQNgzN28910621 = -667199977; float VYnQNVOQRcunHtzSYGQNgzN25724581 = -440843510; float VYnQNVOQRcunHtzSYGQNgzN11484061 = 61299062; float VYnQNVOQRcunHtzSYGQNgzN22557623 = -102323539; float VYnQNVOQRcunHtzSYGQNgzN41878407 = -844705442; float VYnQNVOQRcunHtzSYGQNgzN10882863 = -596626210; float VYnQNVOQRcunHtzSYGQNgzN72487500 = -533675004; float VYnQNVOQRcunHtzSYGQNgzN58886832 = -737409137; float VYnQNVOQRcunHtzSYGQNgzN32719235 = -990156681; float VYnQNVOQRcunHtzSYGQNgzN72834334 = -87109010; float VYnQNVOQRcunHtzSYGQNgzN6128974 = -937845582; float VYnQNVOQRcunHtzSYGQNgzN60053904 = -625388678; float VYnQNVOQRcunHtzSYGQNgzN41699290 = -327248084; float VYnQNVOQRcunHtzSYGQNgzN72041163 = -221133431; float VYnQNVOQRcunHtzSYGQNgzN78141967 = -45045865; float VYnQNVOQRcunHtzSYGQNgzN35100721 = -642740330; float VYnQNVOQRcunHtzSYGQNgzN8928402 = -988470716; float VYnQNVOQRcunHtzSYGQNgzN41618320 = -262766174; float VYnQNVOQRcunHtzSYGQNgzN82421324 = -987732451; float VYnQNVOQRcunHtzSYGQNgzN86713557 = -22207939; float VYnQNVOQRcunHtzSYGQNgzN73053408 = -395977068; float VYnQNVOQRcunHtzSYGQNgzN58574966 = -760074994; float VYnQNVOQRcunHtzSYGQNgzN45855363 = -893367664; float VYnQNVOQRcunHtzSYGQNgzN55630716 = -504752980; float VYnQNVOQRcunHtzSYGQNgzN55870315 = -173817194; float VYnQNVOQRcunHtzSYGQNgzN17072066 = 73809398; float VYnQNVOQRcunHtzSYGQNgzN99125212 = -479209638; float VYnQNVOQRcunHtzSYGQNgzN69868237 = -81211230; float VYnQNVOQRcunHtzSYGQNgzN47208234 = -750920720; float VYnQNVOQRcunHtzSYGQNgzN81533591 = -352006456; float VYnQNVOQRcunHtzSYGQNgzN38253222 = -313138285; float VYnQNVOQRcunHtzSYGQNgzN35871659 = -758206998; float VYnQNVOQRcunHtzSYGQNgzN30319393 = -116116631; float VYnQNVOQRcunHtzSYGQNgzN13451962 = -955837687; float VYnQNVOQRcunHtzSYGQNgzN48677180 = -278106203; float VYnQNVOQRcunHtzSYGQNgzN91451828 = -41240872; float VYnQNVOQRcunHtzSYGQNgzN46667514 = -89224591; float VYnQNVOQRcunHtzSYGQNgzN14135566 = -780393848; float VYnQNVOQRcunHtzSYGQNgzN91449204 = -664063814; float VYnQNVOQRcunHtzSYGQNgzN85767701 = -852599267; float VYnQNVOQRcunHtzSYGQNgzN65212158 = -963724821; float VYnQNVOQRcunHtzSYGQNgzN61145016 = 6216667; float VYnQNVOQRcunHtzSYGQNgzN93889713 = -922688707; float VYnQNVOQRcunHtzSYGQNgzN41722 = -608802718; float VYnQNVOQRcunHtzSYGQNgzN60936638 = -200397633; float VYnQNVOQRcunHtzSYGQNgzN59989058 = -147202600; float VYnQNVOQRcunHtzSYGQNgzN79079736 = -673796043; float VYnQNVOQRcunHtzSYGQNgzN19845716 = -156935739; float VYnQNVOQRcunHtzSYGQNgzN68297090 = -121882640; float VYnQNVOQRcunHtzSYGQNgzN2550894 = -543149099; float VYnQNVOQRcunHtzSYGQNgzN31463181 = -323007441; float VYnQNVOQRcunHtzSYGQNgzN92562296 = -93103225; float VYnQNVOQRcunHtzSYGQNgzN20525520 = -542522773; float VYnQNVOQRcunHtzSYGQNgzN22396246 = -157725368; float VYnQNVOQRcunHtzSYGQNgzN94898482 = -606550381; float VYnQNVOQRcunHtzSYGQNgzN70335654 = -907124984; float VYnQNVOQRcunHtzSYGQNgzN79869217 = -547475847; float VYnQNVOQRcunHtzSYGQNgzN55853344 = -433947958; float VYnQNVOQRcunHtzSYGQNgzN66687308 = -928506345; float VYnQNVOQRcunHtzSYGQNgzN24806342 = -818514841; float VYnQNVOQRcunHtzSYGQNgzN11757650 = -17416573; float VYnQNVOQRcunHtzSYGQNgzN2619264 = -352463775; float VYnQNVOQRcunHtzSYGQNgzN11678598 = -986488418; float VYnQNVOQRcunHtzSYGQNgzN51185643 = -538150226; float VYnQNVOQRcunHtzSYGQNgzN34581113 = -773970725; float VYnQNVOQRcunHtzSYGQNgzN70257315 = -79638584; float VYnQNVOQRcunHtzSYGQNgzN29734511 = -409272047; float VYnQNVOQRcunHtzSYGQNgzN28247328 = -371410397; float VYnQNVOQRcunHtzSYGQNgzN23363983 = -943027228; float VYnQNVOQRcunHtzSYGQNgzN86690139 = 96195006; float VYnQNVOQRcunHtzSYGQNgzN88433206 = -453515739; float VYnQNVOQRcunHtzSYGQNgzN94792835 = -108076868; float VYnQNVOQRcunHtzSYGQNgzN50169115 = -598702360; float VYnQNVOQRcunHtzSYGQNgzN96653623 = -35133185; float VYnQNVOQRcunHtzSYGQNgzN21501399 = -58483119; float VYnQNVOQRcunHtzSYGQNgzN11908393 = -302193735; float VYnQNVOQRcunHtzSYGQNgzN64685252 = -496049936; VYnQNVOQRcunHtzSYGQNgzN39429197 = VYnQNVOQRcunHtzSYGQNgzN81403852; VYnQNVOQRcunHtzSYGQNgzN81403852 = VYnQNVOQRcunHtzSYGQNgzN77587801; VYnQNVOQRcunHtzSYGQNgzN77587801 = VYnQNVOQRcunHtzSYGQNgzN17176409; VYnQNVOQRcunHtzSYGQNgzN17176409 = VYnQNVOQRcunHtzSYGQNgzN58151574; VYnQNVOQRcunHtzSYGQNgzN58151574 = VYnQNVOQRcunHtzSYGQNgzN36693189; VYnQNVOQRcunHtzSYGQNgzN36693189 = VYnQNVOQRcunHtzSYGQNgzN33327611; VYnQNVOQRcunHtzSYGQNgzN33327611 = VYnQNVOQRcunHtzSYGQNgzN96650563; VYnQNVOQRcunHtzSYGQNgzN96650563 = VYnQNVOQRcunHtzSYGQNgzN37699659; VYnQNVOQRcunHtzSYGQNgzN37699659 = VYnQNVOQRcunHtzSYGQNgzN20031848; VYnQNVOQRcunHtzSYGQNgzN20031848 = VYnQNVOQRcunHtzSYGQNgzN26608949; VYnQNVOQRcunHtzSYGQNgzN26608949 = VYnQNVOQRcunHtzSYGQNgzN72876055; VYnQNVOQRcunHtzSYGQNgzN72876055 = VYnQNVOQRcunHtzSYGQNgzN67065611; VYnQNVOQRcunHtzSYGQNgzN67065611 = VYnQNVOQRcunHtzSYGQNgzN20042962; VYnQNVOQRcunHtzSYGQNgzN20042962 = VYnQNVOQRcunHtzSYGQNgzN20779027; VYnQNVOQRcunHtzSYGQNgzN20779027 = VYnQNVOQRcunHtzSYGQNgzN91886878; VYnQNVOQRcunHtzSYGQNgzN91886878 = VYnQNVOQRcunHtzSYGQNgzN46439057; VYnQNVOQRcunHtzSYGQNgzN46439057 = VYnQNVOQRcunHtzSYGQNgzN37651615; VYnQNVOQRcunHtzSYGQNgzN37651615 = VYnQNVOQRcunHtzSYGQNgzN40391582; VYnQNVOQRcunHtzSYGQNgzN40391582 = VYnQNVOQRcunHtzSYGQNgzN34180616; VYnQNVOQRcunHtzSYGQNgzN34180616 = VYnQNVOQRcunHtzSYGQNgzN2946845; VYnQNVOQRcunHtzSYGQNgzN2946845 = VYnQNVOQRcunHtzSYGQNgzN9109804; VYnQNVOQRcunHtzSYGQNgzN9109804 = VYnQNVOQRcunHtzSYGQNgzN67951891; VYnQNVOQRcunHtzSYGQNgzN67951891 = VYnQNVOQRcunHtzSYGQNgzN28910621; VYnQNVOQRcunHtzSYGQNgzN28910621 = VYnQNVOQRcunHtzSYGQNgzN25724581; VYnQNVOQRcunHtzSYGQNgzN25724581 = VYnQNVOQRcunHtzSYGQNgzN11484061; VYnQNVOQRcunHtzSYGQNgzN11484061 = VYnQNVOQRcunHtzSYGQNgzN22557623; VYnQNVOQRcunHtzSYGQNgzN22557623 = VYnQNVOQRcunHtzSYGQNgzN41878407; VYnQNVOQRcunHtzSYGQNgzN41878407 = VYnQNVOQRcunHtzSYGQNgzN10882863; VYnQNVOQRcunHtzSYGQNgzN10882863 = VYnQNVOQRcunHtzSYGQNgzN72487500; VYnQNVOQRcunHtzSYGQNgzN72487500 = VYnQNVOQRcunHtzSYGQNgzN58886832; VYnQNVOQRcunHtzSYGQNgzN58886832 = VYnQNVOQRcunHtzSYGQNgzN32719235; VYnQNVOQRcunHtzSYGQNgzN32719235 = VYnQNVOQRcunHtzSYGQNgzN72834334; VYnQNVOQRcunHtzSYGQNgzN72834334 = VYnQNVOQRcunHtzSYGQNgzN6128974; VYnQNVOQRcunHtzSYGQNgzN6128974 = VYnQNVOQRcunHtzSYGQNgzN60053904; VYnQNVOQRcunHtzSYGQNgzN60053904 = VYnQNVOQRcunHtzSYGQNgzN41699290; VYnQNVOQRcunHtzSYGQNgzN41699290 = VYnQNVOQRcunHtzSYGQNgzN72041163; VYnQNVOQRcunHtzSYGQNgzN72041163 = VYnQNVOQRcunHtzSYGQNgzN78141967; VYnQNVOQRcunHtzSYGQNgzN78141967 = VYnQNVOQRcunHtzSYGQNgzN35100721; VYnQNVOQRcunHtzSYGQNgzN35100721 = VYnQNVOQRcunHtzSYGQNgzN8928402; VYnQNVOQRcunHtzSYGQNgzN8928402 = VYnQNVOQRcunHtzSYGQNgzN41618320; VYnQNVOQRcunHtzSYGQNgzN41618320 = VYnQNVOQRcunHtzSYGQNgzN82421324; VYnQNVOQRcunHtzSYGQNgzN82421324 = VYnQNVOQRcunHtzSYGQNgzN86713557; VYnQNVOQRcunHtzSYGQNgzN86713557 = VYnQNVOQRcunHtzSYGQNgzN73053408; VYnQNVOQRcunHtzSYGQNgzN73053408 = VYnQNVOQRcunHtzSYGQNgzN58574966; VYnQNVOQRcunHtzSYGQNgzN58574966 = VYnQNVOQRcunHtzSYGQNgzN45855363; VYnQNVOQRcunHtzSYGQNgzN45855363 = VYnQNVOQRcunHtzSYGQNgzN55630716; VYnQNVOQRcunHtzSYGQNgzN55630716 = VYnQNVOQRcunHtzSYGQNgzN55870315; VYnQNVOQRcunHtzSYGQNgzN55870315 = VYnQNVOQRcunHtzSYGQNgzN17072066; VYnQNVOQRcunHtzSYGQNgzN17072066 = VYnQNVOQRcunHtzSYGQNgzN99125212; VYnQNVOQRcunHtzSYGQNgzN99125212 = VYnQNVOQRcunHtzSYGQNgzN69868237; VYnQNVOQRcunHtzSYGQNgzN69868237 = VYnQNVOQRcunHtzSYGQNgzN47208234; VYnQNVOQRcunHtzSYGQNgzN47208234 = VYnQNVOQRcunHtzSYGQNgzN81533591; VYnQNVOQRcunHtzSYGQNgzN81533591 = VYnQNVOQRcunHtzSYGQNgzN38253222; VYnQNVOQRcunHtzSYGQNgzN38253222 = VYnQNVOQRcunHtzSYGQNgzN35871659; VYnQNVOQRcunHtzSYGQNgzN35871659 = VYnQNVOQRcunHtzSYGQNgzN30319393; VYnQNVOQRcunHtzSYGQNgzN30319393 = VYnQNVOQRcunHtzSYGQNgzN13451962; VYnQNVOQRcunHtzSYGQNgzN13451962 = VYnQNVOQRcunHtzSYGQNgzN48677180; VYnQNVOQRcunHtzSYGQNgzN48677180 = VYnQNVOQRcunHtzSYGQNgzN91451828; VYnQNVOQRcunHtzSYGQNgzN91451828 = VYnQNVOQRcunHtzSYGQNgzN46667514; VYnQNVOQRcunHtzSYGQNgzN46667514 = VYnQNVOQRcunHtzSYGQNgzN14135566; VYnQNVOQRcunHtzSYGQNgzN14135566 = VYnQNVOQRcunHtzSYGQNgzN91449204; VYnQNVOQRcunHtzSYGQNgzN91449204 = VYnQNVOQRcunHtzSYGQNgzN85767701; VYnQNVOQRcunHtzSYGQNgzN85767701 = VYnQNVOQRcunHtzSYGQNgzN65212158; VYnQNVOQRcunHtzSYGQNgzN65212158 = VYnQNVOQRcunHtzSYGQNgzN61145016; VYnQNVOQRcunHtzSYGQNgzN61145016 = VYnQNVOQRcunHtzSYGQNgzN93889713; VYnQNVOQRcunHtzSYGQNgzN93889713 = VYnQNVOQRcunHtzSYGQNgzN41722; VYnQNVOQRcunHtzSYGQNgzN41722 = VYnQNVOQRcunHtzSYGQNgzN60936638; VYnQNVOQRcunHtzSYGQNgzN60936638 = VYnQNVOQRcunHtzSYGQNgzN59989058; VYnQNVOQRcunHtzSYGQNgzN59989058 = VYnQNVOQRcunHtzSYGQNgzN79079736; VYnQNVOQRcunHtzSYGQNgzN79079736 = VYnQNVOQRcunHtzSYGQNgzN19845716; VYnQNVOQRcunHtzSYGQNgzN19845716 = VYnQNVOQRcunHtzSYGQNgzN68297090; VYnQNVOQRcunHtzSYGQNgzN68297090 = VYnQNVOQRcunHtzSYGQNgzN2550894; VYnQNVOQRcunHtzSYGQNgzN2550894 = VYnQNVOQRcunHtzSYGQNgzN31463181; VYnQNVOQRcunHtzSYGQNgzN31463181 = VYnQNVOQRcunHtzSYGQNgzN92562296; VYnQNVOQRcunHtzSYGQNgzN92562296 = VYnQNVOQRcunHtzSYGQNgzN20525520; VYnQNVOQRcunHtzSYGQNgzN20525520 = VYnQNVOQRcunHtzSYGQNgzN22396246; VYnQNVOQRcunHtzSYGQNgzN22396246 = VYnQNVOQRcunHtzSYGQNgzN94898482; VYnQNVOQRcunHtzSYGQNgzN94898482 = VYnQNVOQRcunHtzSYGQNgzN70335654; VYnQNVOQRcunHtzSYGQNgzN70335654 = VYnQNVOQRcunHtzSYGQNgzN79869217; VYnQNVOQRcunHtzSYGQNgzN79869217 = VYnQNVOQRcunHtzSYGQNgzN55853344; VYnQNVOQRcunHtzSYGQNgzN55853344 = VYnQNVOQRcunHtzSYGQNgzN66687308; VYnQNVOQRcunHtzSYGQNgzN66687308 = VYnQNVOQRcunHtzSYGQNgzN24806342; VYnQNVOQRcunHtzSYGQNgzN24806342 = VYnQNVOQRcunHtzSYGQNgzN11757650; VYnQNVOQRcunHtzSYGQNgzN11757650 = VYnQNVOQRcunHtzSYGQNgzN2619264; VYnQNVOQRcunHtzSYGQNgzN2619264 = VYnQNVOQRcunHtzSYGQNgzN11678598; VYnQNVOQRcunHtzSYGQNgzN11678598 = VYnQNVOQRcunHtzSYGQNgzN51185643; VYnQNVOQRcunHtzSYGQNgzN51185643 = VYnQNVOQRcunHtzSYGQNgzN34581113; VYnQNVOQRcunHtzSYGQNgzN34581113 = VYnQNVOQRcunHtzSYGQNgzN70257315; VYnQNVOQRcunHtzSYGQNgzN70257315 = VYnQNVOQRcunHtzSYGQNgzN29734511; VYnQNVOQRcunHtzSYGQNgzN29734511 = VYnQNVOQRcunHtzSYGQNgzN28247328; VYnQNVOQRcunHtzSYGQNgzN28247328 = VYnQNVOQRcunHtzSYGQNgzN23363983; VYnQNVOQRcunHtzSYGQNgzN23363983 = VYnQNVOQRcunHtzSYGQNgzN86690139; VYnQNVOQRcunHtzSYGQNgzN86690139 = VYnQNVOQRcunHtzSYGQNgzN88433206; VYnQNVOQRcunHtzSYGQNgzN88433206 = VYnQNVOQRcunHtzSYGQNgzN94792835; VYnQNVOQRcunHtzSYGQNgzN94792835 = VYnQNVOQRcunHtzSYGQNgzN50169115; VYnQNVOQRcunHtzSYGQNgzN50169115 = VYnQNVOQRcunHtzSYGQNgzN96653623; VYnQNVOQRcunHtzSYGQNgzN96653623 = VYnQNVOQRcunHtzSYGQNgzN21501399; VYnQNVOQRcunHtzSYGQNgzN21501399 = VYnQNVOQRcunHtzSYGQNgzN11908393; VYnQNVOQRcunHtzSYGQNgzN11908393 = VYnQNVOQRcunHtzSYGQNgzN64685252; VYnQNVOQRcunHtzSYGQNgzN64685252 = VYnQNVOQRcunHtzSYGQNgzN39429197;}
void vtHUdOOSPRBPjPCtoRsHnDHfav23881341() { float WmdaqDJwYrIAoYcleUUqClL23152715 = -846072003; float WmdaqDJwYrIAoYcleUUqClL79001948 = -862016986; float WmdaqDJwYrIAoYcleUUqClL66173918 = -913613871; float WmdaqDJwYrIAoYcleUUqClL14324362 = -586966311; float WmdaqDJwYrIAoYcleUUqClL37712911 = -525873720; float WmdaqDJwYrIAoYcleUUqClL48032706 = 13961945; float WmdaqDJwYrIAoYcleUUqClL70208174 = -530283394; float WmdaqDJwYrIAoYcleUUqClL39990647 = 30319938; float WmdaqDJwYrIAoYcleUUqClL87919187 = -94882521; float WmdaqDJwYrIAoYcleUUqClL66137436 = 45766514; float WmdaqDJwYrIAoYcleUUqClL69497984 = -753130645; float WmdaqDJwYrIAoYcleUUqClL63087826 = -725050999; float WmdaqDJwYrIAoYcleUUqClL18119464 = 18924542; float WmdaqDJwYrIAoYcleUUqClL14416107 = -122274140; float WmdaqDJwYrIAoYcleUUqClL24958285 = 73258568; float WmdaqDJwYrIAoYcleUUqClL63700907 = -402196821; float WmdaqDJwYrIAoYcleUUqClL46304468 = -425808368; float WmdaqDJwYrIAoYcleUUqClL51728884 = -896741002; float WmdaqDJwYrIAoYcleUUqClL81368062 = -100127394; float WmdaqDJwYrIAoYcleUUqClL8288261 = -72162315; float WmdaqDJwYrIAoYcleUUqClL70286354 = -104721744; float WmdaqDJwYrIAoYcleUUqClL10111875 = -193088592; float WmdaqDJwYrIAoYcleUUqClL37127756 = -31922185; float WmdaqDJwYrIAoYcleUUqClL30053316 = -206432630; float WmdaqDJwYrIAoYcleUUqClL62326673 = -519174272; float WmdaqDJwYrIAoYcleUUqClL64476818 = -381667965; float WmdaqDJwYrIAoYcleUUqClL44149562 = -546198962; float WmdaqDJwYrIAoYcleUUqClL84477606 = -631146930; float WmdaqDJwYrIAoYcleUUqClL82801003 = -20822110; float WmdaqDJwYrIAoYcleUUqClL8035828 = -106281379; float WmdaqDJwYrIAoYcleUUqClL40251255 = -956507158; float WmdaqDJwYrIAoYcleUUqClL57512523 = -439353904; float WmdaqDJwYrIAoYcleUUqClL86959035 = -752323102; float WmdaqDJwYrIAoYcleUUqClL41853688 = -241942230; float WmdaqDJwYrIAoYcleUUqClL27657229 = -359679285; float WmdaqDJwYrIAoYcleUUqClL11560524 = -305644561; float WmdaqDJwYrIAoYcleUUqClL71804753 = -541474727; float WmdaqDJwYrIAoYcleUUqClL28523759 = 55810918; float WmdaqDJwYrIAoYcleUUqClL95716439 = -948299211; float WmdaqDJwYrIAoYcleUUqClL48117517 = -935117596; float WmdaqDJwYrIAoYcleUUqClL6385841 = 87193700; float WmdaqDJwYrIAoYcleUUqClL11761051 = -593758121; float WmdaqDJwYrIAoYcleUUqClL19513704 = -774612193; float WmdaqDJwYrIAoYcleUUqClL20248928 = 25079199; float WmdaqDJwYrIAoYcleUUqClL86562217 = 13910928; float WmdaqDJwYrIAoYcleUUqClL90122244 = -508399355; float WmdaqDJwYrIAoYcleUUqClL88809685 = -526398887; float WmdaqDJwYrIAoYcleUUqClL94612162 = 64060908; float WmdaqDJwYrIAoYcleUUqClL50946279 = -725974753; float WmdaqDJwYrIAoYcleUUqClL34998543 = -11225073; float WmdaqDJwYrIAoYcleUUqClL9959069 = -246983631; float WmdaqDJwYrIAoYcleUUqClL98713953 = -502973506; float WmdaqDJwYrIAoYcleUUqClL26915994 = -363938821; float WmdaqDJwYrIAoYcleUUqClL84185827 = -889847473; float WmdaqDJwYrIAoYcleUUqClL53594986 = 25066057; float WmdaqDJwYrIAoYcleUUqClL13040840 = -552983411; float WmdaqDJwYrIAoYcleUUqClL41874192 = -730094802; float WmdaqDJwYrIAoYcleUUqClL36120603 = -607181241; float WmdaqDJwYrIAoYcleUUqClL51997688 = 32207961; float WmdaqDJwYrIAoYcleUUqClL73236093 = -44205755; float WmdaqDJwYrIAoYcleUUqClL3883144 = -439839094; float WmdaqDJwYrIAoYcleUUqClL85730567 = -899136464; float WmdaqDJwYrIAoYcleUUqClL57189643 = -948857953; float WmdaqDJwYrIAoYcleUUqClL79883359 = -988601143; float WmdaqDJwYrIAoYcleUUqClL25886181 = 2273672; float WmdaqDJwYrIAoYcleUUqClL11985462 = -213776742; float WmdaqDJwYrIAoYcleUUqClL76128790 = -972727898; float WmdaqDJwYrIAoYcleUUqClL76265775 = -739133229; float WmdaqDJwYrIAoYcleUUqClL86758877 = -762594855; float WmdaqDJwYrIAoYcleUUqClL13397762 = -621096871; float WmdaqDJwYrIAoYcleUUqClL91896153 = -860722094; float WmdaqDJwYrIAoYcleUUqClL17780710 = -381619286; float WmdaqDJwYrIAoYcleUUqClL56012444 = -948441791; float WmdaqDJwYrIAoYcleUUqClL33250545 = -165009799; float WmdaqDJwYrIAoYcleUUqClL1902421 = -59356016; float WmdaqDJwYrIAoYcleUUqClL58525303 = -510963624; float WmdaqDJwYrIAoYcleUUqClL90598171 = -418476400; float WmdaqDJwYrIAoYcleUUqClL16878829 = 42998615; float WmdaqDJwYrIAoYcleUUqClL43491099 = -120343558; float WmdaqDJwYrIAoYcleUUqClL72204428 = 89225083; float WmdaqDJwYrIAoYcleUUqClL75667132 = -855269079; float WmdaqDJwYrIAoYcleUUqClL49537400 = -510259870; float WmdaqDJwYrIAoYcleUUqClL33531328 = -905172178; float WmdaqDJwYrIAoYcleUUqClL47802461 = 90402962; float WmdaqDJwYrIAoYcleUUqClL98076759 = -859297748; float WmdaqDJwYrIAoYcleUUqClL41537301 = -353533652; float WmdaqDJwYrIAoYcleUUqClL30596529 = 24584917; float WmdaqDJwYrIAoYcleUUqClL2773208 = -862475629; float WmdaqDJwYrIAoYcleUUqClL88258701 = -167008287; float WmdaqDJwYrIAoYcleUUqClL14616390 = -806695874; float WmdaqDJwYrIAoYcleUUqClL69686331 = -575549760; float WmdaqDJwYrIAoYcleUUqClL35684151 = -934293487; float WmdaqDJwYrIAoYcleUUqClL76526070 = -976397043; float WmdaqDJwYrIAoYcleUUqClL22480347 = -804093456; float WmdaqDJwYrIAoYcleUUqClL44234373 = -395278502; float WmdaqDJwYrIAoYcleUUqClL20655273 = -13669837; float WmdaqDJwYrIAoYcleUUqClL54571408 = -644900169; float WmdaqDJwYrIAoYcleUUqClL39630344 = -786011051; float WmdaqDJwYrIAoYcleUUqClL94362746 = -977194473; float WmdaqDJwYrIAoYcleUUqClL74576755 = -846072003; WmdaqDJwYrIAoYcleUUqClL23152715 = WmdaqDJwYrIAoYcleUUqClL79001948; WmdaqDJwYrIAoYcleUUqClL79001948 = WmdaqDJwYrIAoYcleUUqClL66173918; WmdaqDJwYrIAoYcleUUqClL66173918 = WmdaqDJwYrIAoYcleUUqClL14324362; WmdaqDJwYrIAoYcleUUqClL14324362 = WmdaqDJwYrIAoYcleUUqClL37712911; WmdaqDJwYrIAoYcleUUqClL37712911 = WmdaqDJwYrIAoYcleUUqClL48032706; WmdaqDJwYrIAoYcleUUqClL48032706 = WmdaqDJwYrIAoYcleUUqClL70208174; WmdaqDJwYrIAoYcleUUqClL70208174 = WmdaqDJwYrIAoYcleUUqClL39990647; WmdaqDJwYrIAoYcleUUqClL39990647 = WmdaqDJwYrIAoYcleUUqClL87919187; WmdaqDJwYrIAoYcleUUqClL87919187 = WmdaqDJwYrIAoYcleUUqClL66137436; WmdaqDJwYrIAoYcleUUqClL66137436 = WmdaqDJwYrIAoYcleUUqClL69497984; WmdaqDJwYrIAoYcleUUqClL69497984 = WmdaqDJwYrIAoYcleUUqClL63087826; WmdaqDJwYrIAoYcleUUqClL63087826 = WmdaqDJwYrIAoYcleUUqClL18119464; WmdaqDJwYrIAoYcleUUqClL18119464 = WmdaqDJwYrIAoYcleUUqClL14416107; WmdaqDJwYrIAoYcleUUqClL14416107 = WmdaqDJwYrIAoYcleUUqClL24958285; WmdaqDJwYrIAoYcleUUqClL24958285 = WmdaqDJwYrIAoYcleUUqClL63700907; WmdaqDJwYrIAoYcleUUqClL63700907 = WmdaqDJwYrIAoYcleUUqClL46304468; WmdaqDJwYrIAoYcleUUqClL46304468 = WmdaqDJwYrIAoYcleUUqClL51728884; WmdaqDJwYrIAoYcleUUqClL51728884 = WmdaqDJwYrIAoYcleUUqClL81368062; WmdaqDJwYrIAoYcleUUqClL81368062 = WmdaqDJwYrIAoYcleUUqClL8288261; WmdaqDJwYrIAoYcleUUqClL8288261 = WmdaqDJwYrIAoYcleUUqClL70286354; WmdaqDJwYrIAoYcleUUqClL70286354 = WmdaqDJwYrIAoYcleUUqClL10111875; WmdaqDJwYrIAoYcleUUqClL10111875 = WmdaqDJwYrIAoYcleUUqClL37127756; WmdaqDJwYrIAoYcleUUqClL37127756 = WmdaqDJwYrIAoYcleUUqClL30053316; WmdaqDJwYrIAoYcleUUqClL30053316 = WmdaqDJwYrIAoYcleUUqClL62326673; WmdaqDJwYrIAoYcleUUqClL62326673 = WmdaqDJwYrIAoYcleUUqClL64476818; WmdaqDJwYrIAoYcleUUqClL64476818 = WmdaqDJwYrIAoYcleUUqClL44149562; WmdaqDJwYrIAoYcleUUqClL44149562 = WmdaqDJwYrIAoYcleUUqClL84477606; WmdaqDJwYrIAoYcleUUqClL84477606 = WmdaqDJwYrIAoYcleUUqClL82801003; WmdaqDJwYrIAoYcleUUqClL82801003 = WmdaqDJwYrIAoYcleUUqClL8035828; WmdaqDJwYrIAoYcleUUqClL8035828 = WmdaqDJwYrIAoYcleUUqClL40251255; WmdaqDJwYrIAoYcleUUqClL40251255 = WmdaqDJwYrIAoYcleUUqClL57512523; WmdaqDJwYrIAoYcleUUqClL57512523 = WmdaqDJwYrIAoYcleUUqClL86959035; WmdaqDJwYrIAoYcleUUqClL86959035 = WmdaqDJwYrIAoYcleUUqClL41853688; WmdaqDJwYrIAoYcleUUqClL41853688 = WmdaqDJwYrIAoYcleUUqClL27657229; WmdaqDJwYrIAoYcleUUqClL27657229 = WmdaqDJwYrIAoYcleUUqClL11560524; WmdaqDJwYrIAoYcleUUqClL11560524 = WmdaqDJwYrIAoYcleUUqClL71804753; WmdaqDJwYrIAoYcleUUqClL71804753 = WmdaqDJwYrIAoYcleUUqClL28523759; WmdaqDJwYrIAoYcleUUqClL28523759 = WmdaqDJwYrIAoYcleUUqClL95716439; WmdaqDJwYrIAoYcleUUqClL95716439 = WmdaqDJwYrIAoYcleUUqClL48117517; WmdaqDJwYrIAoYcleUUqClL48117517 = WmdaqDJwYrIAoYcleUUqClL6385841; WmdaqDJwYrIAoYcleUUqClL6385841 = WmdaqDJwYrIAoYcleUUqClL11761051; WmdaqDJwYrIAoYcleUUqClL11761051 = WmdaqDJwYrIAoYcleUUqClL19513704; WmdaqDJwYrIAoYcleUUqClL19513704 = WmdaqDJwYrIAoYcleUUqClL20248928; WmdaqDJwYrIAoYcleUUqClL20248928 = WmdaqDJwYrIAoYcleUUqClL86562217; WmdaqDJwYrIAoYcleUUqClL86562217 = WmdaqDJwYrIAoYcleUUqClL90122244; WmdaqDJwYrIAoYcleUUqClL90122244 = WmdaqDJwYrIAoYcleUUqClL88809685; WmdaqDJwYrIAoYcleUUqClL88809685 = WmdaqDJwYrIAoYcleUUqClL94612162; WmdaqDJwYrIAoYcleUUqClL94612162 = WmdaqDJwYrIAoYcleUUqClL50946279; WmdaqDJwYrIAoYcleUUqClL50946279 = WmdaqDJwYrIAoYcleUUqClL34998543; WmdaqDJwYrIAoYcleUUqClL34998543 = WmdaqDJwYrIAoYcleUUqClL9959069; WmdaqDJwYrIAoYcleUUqClL9959069 = WmdaqDJwYrIAoYcleUUqClL98713953; WmdaqDJwYrIAoYcleUUqClL98713953 = WmdaqDJwYrIAoYcleUUqClL26915994; WmdaqDJwYrIAoYcleUUqClL26915994 = WmdaqDJwYrIAoYcleUUqClL84185827; WmdaqDJwYrIAoYcleUUqClL84185827 = WmdaqDJwYrIAoYcleUUqClL53594986; WmdaqDJwYrIAoYcleUUqClL53594986 = WmdaqDJwYrIAoYcleUUqClL13040840; WmdaqDJwYrIAoYcleUUqClL13040840 = WmdaqDJwYrIAoYcleUUqClL41874192; WmdaqDJwYrIAoYcleUUqClL41874192 = WmdaqDJwYrIAoYcleUUqClL36120603; WmdaqDJwYrIAoYcleUUqClL36120603 = WmdaqDJwYrIAoYcleUUqClL51997688; WmdaqDJwYrIAoYcleUUqClL51997688 = WmdaqDJwYrIAoYcleUUqClL73236093; WmdaqDJwYrIAoYcleUUqClL73236093 = WmdaqDJwYrIAoYcleUUqClL3883144; WmdaqDJwYrIAoYcleUUqClL3883144 = WmdaqDJwYrIAoYcleUUqClL85730567; WmdaqDJwYrIAoYcleUUqClL85730567 = WmdaqDJwYrIAoYcleUUqClL57189643; WmdaqDJwYrIAoYcleUUqClL57189643 = WmdaqDJwYrIAoYcleUUqClL79883359; WmdaqDJwYrIAoYcleUUqClL79883359 = WmdaqDJwYrIAoYcleUUqClL25886181; WmdaqDJwYrIAoYcleUUqClL25886181 = WmdaqDJwYrIAoYcleUUqClL11985462; WmdaqDJwYrIAoYcleUUqClL11985462 = WmdaqDJwYrIAoYcleUUqClL76128790; WmdaqDJwYrIAoYcleUUqClL76128790 = WmdaqDJwYrIAoYcleUUqClL76265775; WmdaqDJwYrIAoYcleUUqClL76265775 = WmdaqDJwYrIAoYcleUUqClL86758877; WmdaqDJwYrIAoYcleUUqClL86758877 = WmdaqDJwYrIAoYcleUUqClL13397762; WmdaqDJwYrIAoYcleUUqClL13397762 = WmdaqDJwYrIAoYcleUUqClL91896153; WmdaqDJwYrIAoYcleUUqClL91896153 = WmdaqDJwYrIAoYcleUUqClL17780710; WmdaqDJwYrIAoYcleUUqClL17780710 = WmdaqDJwYrIAoYcleUUqClL56012444; WmdaqDJwYrIAoYcleUUqClL56012444 = WmdaqDJwYrIAoYcleUUqClL33250545; WmdaqDJwYrIAoYcleUUqClL33250545 = WmdaqDJwYrIAoYcleUUqClL1902421; WmdaqDJwYrIAoYcleUUqClL1902421 = WmdaqDJwYrIAoYcleUUqClL58525303; WmdaqDJwYrIAoYcleUUqClL58525303 = WmdaqDJwYrIAoYcleUUqClL90598171; WmdaqDJwYrIAoYcleUUqClL90598171 = WmdaqDJwYrIAoYcleUUqClL16878829; WmdaqDJwYrIAoYcleUUqClL16878829 = WmdaqDJwYrIAoYcleUUqClL43491099; WmdaqDJwYrIAoYcleUUqClL43491099 = WmdaqDJwYrIAoYcleUUqClL72204428; WmdaqDJwYrIAoYcleUUqClL72204428 = WmdaqDJwYrIAoYcleUUqClL75667132; WmdaqDJwYrIAoYcleUUqClL75667132 = WmdaqDJwYrIAoYcleUUqClL49537400; WmdaqDJwYrIAoYcleUUqClL49537400 = WmdaqDJwYrIAoYcleUUqClL33531328; WmdaqDJwYrIAoYcleUUqClL33531328 = WmdaqDJwYrIAoYcleUUqClL47802461; WmdaqDJwYrIAoYcleUUqClL47802461 = WmdaqDJwYrIAoYcleUUqClL98076759; WmdaqDJwYrIAoYcleUUqClL98076759 = WmdaqDJwYrIAoYcleUUqClL41537301; WmdaqDJwYrIAoYcleUUqClL41537301 = WmdaqDJwYrIAoYcleUUqClL30596529; WmdaqDJwYrIAoYcleUUqClL30596529 = WmdaqDJwYrIAoYcleUUqClL2773208; WmdaqDJwYrIAoYcleUUqClL2773208 = WmdaqDJwYrIAoYcleUUqClL88258701; WmdaqDJwYrIAoYcleUUqClL88258701 = WmdaqDJwYrIAoYcleUUqClL14616390; WmdaqDJwYrIAoYcleUUqClL14616390 = WmdaqDJwYrIAoYcleUUqClL69686331; WmdaqDJwYrIAoYcleUUqClL69686331 = WmdaqDJwYrIAoYcleUUqClL35684151; WmdaqDJwYrIAoYcleUUqClL35684151 = WmdaqDJwYrIAoYcleUUqClL76526070; WmdaqDJwYrIAoYcleUUqClL76526070 = WmdaqDJwYrIAoYcleUUqClL22480347; WmdaqDJwYrIAoYcleUUqClL22480347 = WmdaqDJwYrIAoYcleUUqClL44234373; WmdaqDJwYrIAoYcleUUqClL44234373 = WmdaqDJwYrIAoYcleUUqClL20655273; WmdaqDJwYrIAoYcleUUqClL20655273 = WmdaqDJwYrIAoYcleUUqClL54571408; WmdaqDJwYrIAoYcleUUqClL54571408 = WmdaqDJwYrIAoYcleUUqClL39630344; WmdaqDJwYrIAoYcleUUqClL39630344 = WmdaqDJwYrIAoYcleUUqClL94362746; WmdaqDJwYrIAoYcleUUqClL94362746 = WmdaqDJwYrIAoYcleUUqClL74576755; WmdaqDJwYrIAoYcleUUqClL74576755 = WmdaqDJwYrIAoYcleUUqClL23152715;}
void GJnNOYyypjTKPUudGTdfwnUilo8944179() { float oWQwwbPzWCRwpxBtOjWvaLK6876233 = -96094070; float oWQwwbPzWCRwpxBtOjWvaLK76600044 = -665668838; float oWQwwbPzWCRwpxBtOjWvaLK54760035 = -781921561; float oWQwwbPzWCRwpxBtOjWvaLK11472315 = -591848239; float oWQwwbPzWCRwpxBtOjWvaLK17274248 = -923821912; float oWQwwbPzWCRwpxBtOjWvaLK59372224 = -89358724; float oWQwwbPzWCRwpxBtOjWvaLK7088738 = -551797532; float oWQwwbPzWCRwpxBtOjWvaLK83330729 = -590134648; float oWQwwbPzWCRwpxBtOjWvaLK38138716 = -792365217; float oWQwwbPzWCRwpxBtOjWvaLK12243024 = -177274501; float oWQwwbPzWCRwpxBtOjWvaLK12387021 = -593415903; float oWQwwbPzWCRwpxBtOjWvaLK53299597 = -654190270; float oWQwwbPzWCRwpxBtOjWvaLK69173315 = -923907701; float oWQwwbPzWCRwpxBtOjWvaLK8789252 = -471957002; float oWQwwbPzWCRwpxBtOjWvaLK29137544 = -952438737; float oWQwwbPzWCRwpxBtOjWvaLK35514935 = -326324473; float oWQwwbPzWCRwpxBtOjWvaLK46169879 = -584688230; float oWQwwbPzWCRwpxBtOjWvaLK65806154 = -507592576; float oWQwwbPzWCRwpxBtOjWvaLK22344543 = -988776633; float oWQwwbPzWCRwpxBtOjWvaLK82395905 = -788455232; float oWQwwbPzWCRwpxBtOjWvaLK37625865 = -779188265; float oWQwwbPzWCRwpxBtOjWvaLK11113946 = -106243878; float oWQwwbPzWCRwpxBtOjWvaLK6303622 = -61316922; float oWQwwbPzWCRwpxBtOjWvaLK31196011 = -845665283; float oWQwwbPzWCRwpxBtOjWvaLK98928766 = -597505033; float oWQwwbPzWCRwpxBtOjWvaLK17469576 = -824634993; float oWQwwbPzWCRwpxBtOjWvaLK65741502 = -990074385; float oWQwwbPzWCRwpxBtOjWvaLK27076807 = -417588419; float oWQwwbPzWCRwpxBtOjWvaLK54719145 = -545018010; float oWQwwbPzWCRwpxBtOjWvaLK43584155 = -778887753; float oWQwwbPzWCRwpxBtOjWvaLK21615678 = -75605178; float oWQwwbPzWCRwpxBtOjWvaLK82305811 = -988551127; float oWQwwbPzWCRwpxBtOjWvaLK1083737 = -317537193; float oWQwwbPzWCRwpxBtOjWvaLK77578402 = -646038877; float oWQwwbPzWCRwpxBtOjWvaLK95260554 = -93969893; float oWQwwbPzWCRwpxBtOjWvaLK81421757 = -284041038; float oWQwwbPzWCRwpxBtOjWvaLK71568343 = -861816024; float oWQwwbPzWCRwpxBtOjWvaLK78905549 = -943332299; float oWQwwbPzWCRwpxBtOjWvaLK56332159 = -153858092; float oWQwwbPzWCRwpxBtOjWvaLK87306633 = -881764475; float oWQwwbPzWCRwpxBtOjWvaLK71153361 = -662846427; float oWQwwbPzWCRwpxBtOjWvaLK41100778 = -199783790; float oWQwwbPzWCRwpxBtOjWvaLK52313850 = -427016447; float oWQwwbPzWCRwpxBtOjWvaLK67444447 = -653864533; float oWQwwbPzWCRwpxBtOjWvaLK14549468 = -312103150; float oWQwwbPzWCRwpxBtOjWvaLK34389126 = -123431047; float oWQwwbPzWCRwpxBtOjWvaLK21988656 = -548044794; float oWQwwbPzWCRwpxBtOjWvaLK33354010 = -798060990; float oWQwwbPzWCRwpxBtOjWvaLK84820492 = -425758904; float oWQwwbPzWCRwpxBtOjWvaLK70871873 = -643240508; float oWQwwbPzWCRwpxBtOjWvaLK50049900 = -412756033; float oWQwwbPzWCRwpxBtOjWvaLK50219674 = -255026292; float oWQwwbPzWCRwpxBtOjWvaLK72298396 = -375871187; float oWQwwbPzWCRwpxBtOjWvaLK30118434 = -366556660; float oWQwwbPzWCRwpxBtOjWvaLK71318314 = -291660888; float oWQwwbPzWCRwpxBtOjWvaLK95762286 = -989850192; float oWQwwbPzWCRwpxBtOjWvaLK70296422 = -504351916; float oWQwwbPzWCRwpxBtOjWvaLK23564025 = -936256279; float oWQwwbPzWCRwpxBtOjWvaLK12543549 = -994343207; float oWQwwbPzWCRwpxBtOjWvaLK99804671 = 813081; float oWQwwbPzWCRwpxBtOjWvaLK93630722 = -99284340; float oWQwwbPzWCRwpxBtOjWvaLK80011930 = -34209114; float oWQwwbPzWCRwpxBtOjWvaLK28611584 = 54883362; float oWQwwbPzWCRwpxBtOjWvaLK94554560 = 86522536; float oWQwwbPzWCRwpxBtOjWvaLK90627346 = -1669323; float oWQwwbPzWCRwpxBtOjWvaLK30081209 = -604864777; float oWQwwbPzWCRwpxBtOjWvaLK52215860 = -236653078; float oWQwwbPzWCRwpxBtOjWvaLK91594913 = -177868825; float oWQwwbPzWCRwpxBtOjWvaLK13528697 = -277987110; float oWQwwbPzWCRwpxBtOjWvaLK47715787 = -568397699; float oWQwwbPzWCRwpxBtOjWvaLK63946592 = -464508449; float oWQwwbPzWCRwpxBtOjWvaLK67264329 = -641355932; float oWQwwbPzWCRwpxBtOjWvaLK9473995 = -253734484; float oWQwwbPzWCRwpxBtOjWvaLK35037910 = -7012158; float oWQwwbPzWCRwpxBtOjWvaLK11242544 = -25608806; float oWQwwbPzWCRwpxBtOjWvaLK96525086 = -479404476; float oWQwwbPzWCRwpxBtOjWvaLK58800096 = -679227432; float oWQwwbPzWCRwpxBtOjWvaLK38859174 = -407452389; float oWQwwbPzWCRwpxBtOjWvaLK16646543 = -433562133; float oWQwwbPzWCRwpxBtOjWvaLK64539640 = -374073987; float oWQwwbPzWCRwpxBtOjWvaLK95480920 = -176590200; float oWQwwbPzWCRwpxBtOjWvaLK32387493 = -92013396; float oWQwwbPzWCRwpxBtOjWvaLK42256315 = -991829515; float oWQwwbPzWCRwpxBtOjWvaLK83847272 = -901777502; float oWQwwbPzWCRwpxBtOjWvaLK93534254 = -266131721; float oWQwwbPzWCRwpxBtOjWvaLK71396004 = -820578887; float oWQwwbPzWCRwpxBtOjWvaLK10007415 = -512679940; float oWQwwbPzWCRwpxBtOjWvaLK70965303 = -950980533; float oWQwwbPzWCRwpxBtOjWvaLK6260088 = -254377990; float oWQwwbPzWCRwpxBtOjWvaLK99498267 = -104119701; float oWQwwbPzWCRwpxBtOjWvaLK11125335 = -779689123; float oWQwwbPzWCRwpxBtOjWvaLK48004319 = -925559745; float oWQwwbPzWCRwpxBtOjWvaLK66362001 = -948989093; float oWQwwbPzWCRwpxBtOjWvaLK56527487 = -54671174; float oWQwwbPzWCRwpxBtOjWvaLK93675910 = -682480136; float oWQwwbPzWCRwpxBtOjWvaLK91141430 = -528637314; float oWQwwbPzWCRwpxBtOjWvaLK12489194 = -154667152; float oWQwwbPzWCRwpxBtOjWvaLK57759289 = -413538983; float oWQwwbPzWCRwpxBtOjWvaLK76817100 = -552195210; float oWQwwbPzWCRwpxBtOjWvaLK84468259 = -96094070; oWQwwbPzWCRwpxBtOjWvaLK6876233 = oWQwwbPzWCRwpxBtOjWvaLK76600044; oWQwwbPzWCRwpxBtOjWvaLK76600044 = oWQwwbPzWCRwpxBtOjWvaLK54760035; oWQwwbPzWCRwpxBtOjWvaLK54760035 = oWQwwbPzWCRwpxBtOjWvaLK11472315; oWQwwbPzWCRwpxBtOjWvaLK11472315 = oWQwwbPzWCRwpxBtOjWvaLK17274248; oWQwwbPzWCRwpxBtOjWvaLK17274248 = oWQwwbPzWCRwpxBtOjWvaLK59372224; oWQwwbPzWCRwpxBtOjWvaLK59372224 = oWQwwbPzWCRwpxBtOjWvaLK7088738; oWQwwbPzWCRwpxBtOjWvaLK7088738 = oWQwwbPzWCRwpxBtOjWvaLK83330729; oWQwwbPzWCRwpxBtOjWvaLK83330729 = oWQwwbPzWCRwpxBtOjWvaLK38138716; oWQwwbPzWCRwpxBtOjWvaLK38138716 = oWQwwbPzWCRwpxBtOjWvaLK12243024; oWQwwbPzWCRwpxBtOjWvaLK12243024 = oWQwwbPzWCRwpxBtOjWvaLK12387021; oWQwwbPzWCRwpxBtOjWvaLK12387021 = oWQwwbPzWCRwpxBtOjWvaLK53299597; oWQwwbPzWCRwpxBtOjWvaLK53299597 = oWQwwbPzWCRwpxBtOjWvaLK69173315; oWQwwbPzWCRwpxBtOjWvaLK69173315 = oWQwwbPzWCRwpxBtOjWvaLK8789252; oWQwwbPzWCRwpxBtOjWvaLK8789252 = oWQwwbPzWCRwpxBtOjWvaLK29137544; oWQwwbPzWCRwpxBtOjWvaLK29137544 = oWQwwbPzWCRwpxBtOjWvaLK35514935; oWQwwbPzWCRwpxBtOjWvaLK35514935 = oWQwwbPzWCRwpxBtOjWvaLK46169879; oWQwwbPzWCRwpxBtOjWvaLK46169879 = oWQwwbPzWCRwpxBtOjWvaLK65806154; oWQwwbPzWCRwpxBtOjWvaLK65806154 = oWQwwbPzWCRwpxBtOjWvaLK22344543; oWQwwbPzWCRwpxBtOjWvaLK22344543 = oWQwwbPzWCRwpxBtOjWvaLK82395905; oWQwwbPzWCRwpxBtOjWvaLK82395905 = oWQwwbPzWCRwpxBtOjWvaLK37625865; oWQwwbPzWCRwpxBtOjWvaLK37625865 = oWQwwbPzWCRwpxBtOjWvaLK11113946; oWQwwbPzWCRwpxBtOjWvaLK11113946 = oWQwwbPzWCRwpxBtOjWvaLK6303622; oWQwwbPzWCRwpxBtOjWvaLK6303622 = oWQwwbPzWCRwpxBtOjWvaLK31196011; oWQwwbPzWCRwpxBtOjWvaLK31196011 = oWQwwbPzWCRwpxBtOjWvaLK98928766; oWQwwbPzWCRwpxBtOjWvaLK98928766 = oWQwwbPzWCRwpxBtOjWvaLK17469576; oWQwwbPzWCRwpxBtOjWvaLK17469576 = oWQwwbPzWCRwpxBtOjWvaLK65741502; oWQwwbPzWCRwpxBtOjWvaLK65741502 = oWQwwbPzWCRwpxBtOjWvaLK27076807; oWQwwbPzWCRwpxBtOjWvaLK27076807 = oWQwwbPzWCRwpxBtOjWvaLK54719145; oWQwwbPzWCRwpxBtOjWvaLK54719145 = oWQwwbPzWCRwpxBtOjWvaLK43584155; oWQwwbPzWCRwpxBtOjWvaLK43584155 = oWQwwbPzWCRwpxBtOjWvaLK21615678; oWQwwbPzWCRwpxBtOjWvaLK21615678 = oWQwwbPzWCRwpxBtOjWvaLK82305811; oWQwwbPzWCRwpxBtOjWvaLK82305811 = oWQwwbPzWCRwpxBtOjWvaLK1083737; oWQwwbPzWCRwpxBtOjWvaLK1083737 = oWQwwbPzWCRwpxBtOjWvaLK77578402; oWQwwbPzWCRwpxBtOjWvaLK77578402 = oWQwwbPzWCRwpxBtOjWvaLK95260554; oWQwwbPzWCRwpxBtOjWvaLK95260554 = oWQwwbPzWCRwpxBtOjWvaLK81421757; oWQwwbPzWCRwpxBtOjWvaLK81421757 = oWQwwbPzWCRwpxBtOjWvaLK71568343; oWQwwbPzWCRwpxBtOjWvaLK71568343 = oWQwwbPzWCRwpxBtOjWvaLK78905549; oWQwwbPzWCRwpxBtOjWvaLK78905549 = oWQwwbPzWCRwpxBtOjWvaLK56332159; oWQwwbPzWCRwpxBtOjWvaLK56332159 = oWQwwbPzWCRwpxBtOjWvaLK87306633; oWQwwbPzWCRwpxBtOjWvaLK87306633 = oWQwwbPzWCRwpxBtOjWvaLK71153361; oWQwwbPzWCRwpxBtOjWvaLK71153361 = oWQwwbPzWCRwpxBtOjWvaLK41100778; oWQwwbPzWCRwpxBtOjWvaLK41100778 = oWQwwbPzWCRwpxBtOjWvaLK52313850; oWQwwbPzWCRwpxBtOjWvaLK52313850 = oWQwwbPzWCRwpxBtOjWvaLK67444447; oWQwwbPzWCRwpxBtOjWvaLK67444447 = oWQwwbPzWCRwpxBtOjWvaLK14549468; oWQwwbPzWCRwpxBtOjWvaLK14549468 = oWQwwbPzWCRwpxBtOjWvaLK34389126; oWQwwbPzWCRwpxBtOjWvaLK34389126 = oWQwwbPzWCRwpxBtOjWvaLK21988656; oWQwwbPzWCRwpxBtOjWvaLK21988656 = oWQwwbPzWCRwpxBtOjWvaLK33354010; oWQwwbPzWCRwpxBtOjWvaLK33354010 = oWQwwbPzWCRwpxBtOjWvaLK84820492; oWQwwbPzWCRwpxBtOjWvaLK84820492 = oWQwwbPzWCRwpxBtOjWvaLK70871873; oWQwwbPzWCRwpxBtOjWvaLK70871873 = oWQwwbPzWCRwpxBtOjWvaLK50049900; oWQwwbPzWCRwpxBtOjWvaLK50049900 = oWQwwbPzWCRwpxBtOjWvaLK50219674; oWQwwbPzWCRwpxBtOjWvaLK50219674 = oWQwwbPzWCRwpxBtOjWvaLK72298396; oWQwwbPzWCRwpxBtOjWvaLK72298396 = oWQwwbPzWCRwpxBtOjWvaLK30118434; oWQwwbPzWCRwpxBtOjWvaLK30118434 = oWQwwbPzWCRwpxBtOjWvaLK71318314; oWQwwbPzWCRwpxBtOjWvaLK71318314 = oWQwwbPzWCRwpxBtOjWvaLK95762286; oWQwwbPzWCRwpxBtOjWvaLK95762286 = oWQwwbPzWCRwpxBtOjWvaLK70296422; oWQwwbPzWCRwpxBtOjWvaLK70296422 = oWQwwbPzWCRwpxBtOjWvaLK23564025; oWQwwbPzWCRwpxBtOjWvaLK23564025 = oWQwwbPzWCRwpxBtOjWvaLK12543549; oWQwwbPzWCRwpxBtOjWvaLK12543549 = oWQwwbPzWCRwpxBtOjWvaLK99804671; oWQwwbPzWCRwpxBtOjWvaLK99804671 = oWQwwbPzWCRwpxBtOjWvaLK93630722; oWQwwbPzWCRwpxBtOjWvaLK93630722 = oWQwwbPzWCRwpxBtOjWvaLK80011930; oWQwwbPzWCRwpxBtOjWvaLK80011930 = oWQwwbPzWCRwpxBtOjWvaLK28611584; oWQwwbPzWCRwpxBtOjWvaLK28611584 = oWQwwbPzWCRwpxBtOjWvaLK94554560; oWQwwbPzWCRwpxBtOjWvaLK94554560 = oWQwwbPzWCRwpxBtOjWvaLK90627346; oWQwwbPzWCRwpxBtOjWvaLK90627346 = oWQwwbPzWCRwpxBtOjWvaLK30081209; oWQwwbPzWCRwpxBtOjWvaLK30081209 = oWQwwbPzWCRwpxBtOjWvaLK52215860; oWQwwbPzWCRwpxBtOjWvaLK52215860 = oWQwwbPzWCRwpxBtOjWvaLK91594913; oWQwwbPzWCRwpxBtOjWvaLK91594913 = oWQwwbPzWCRwpxBtOjWvaLK13528697; oWQwwbPzWCRwpxBtOjWvaLK13528697 = oWQwwbPzWCRwpxBtOjWvaLK47715787; oWQwwbPzWCRwpxBtOjWvaLK47715787 = oWQwwbPzWCRwpxBtOjWvaLK63946592; oWQwwbPzWCRwpxBtOjWvaLK63946592 = oWQwwbPzWCRwpxBtOjWvaLK67264329; oWQwwbPzWCRwpxBtOjWvaLK67264329 = oWQwwbPzWCRwpxBtOjWvaLK9473995; oWQwwbPzWCRwpxBtOjWvaLK9473995 = oWQwwbPzWCRwpxBtOjWvaLK35037910; oWQwwbPzWCRwpxBtOjWvaLK35037910 = oWQwwbPzWCRwpxBtOjWvaLK11242544; oWQwwbPzWCRwpxBtOjWvaLK11242544 = oWQwwbPzWCRwpxBtOjWvaLK96525086; oWQwwbPzWCRwpxBtOjWvaLK96525086 = oWQwwbPzWCRwpxBtOjWvaLK58800096; oWQwwbPzWCRwpxBtOjWvaLK58800096 = oWQwwbPzWCRwpxBtOjWvaLK38859174; oWQwwbPzWCRwpxBtOjWvaLK38859174 = oWQwwbPzWCRwpxBtOjWvaLK16646543; oWQwwbPzWCRwpxBtOjWvaLK16646543 = oWQwwbPzWCRwpxBtOjWvaLK64539640; oWQwwbPzWCRwpxBtOjWvaLK64539640 = oWQwwbPzWCRwpxBtOjWvaLK95480920; oWQwwbPzWCRwpxBtOjWvaLK95480920 = oWQwwbPzWCRwpxBtOjWvaLK32387493; oWQwwbPzWCRwpxBtOjWvaLK32387493 = oWQwwbPzWCRwpxBtOjWvaLK42256315; oWQwwbPzWCRwpxBtOjWvaLK42256315 = oWQwwbPzWCRwpxBtOjWvaLK83847272; oWQwwbPzWCRwpxBtOjWvaLK83847272 = oWQwwbPzWCRwpxBtOjWvaLK93534254; oWQwwbPzWCRwpxBtOjWvaLK93534254 = oWQwwbPzWCRwpxBtOjWvaLK71396004; oWQwwbPzWCRwpxBtOjWvaLK71396004 = oWQwwbPzWCRwpxBtOjWvaLK10007415; oWQwwbPzWCRwpxBtOjWvaLK10007415 = oWQwwbPzWCRwpxBtOjWvaLK70965303; oWQwwbPzWCRwpxBtOjWvaLK70965303 = oWQwwbPzWCRwpxBtOjWvaLK6260088; oWQwwbPzWCRwpxBtOjWvaLK6260088 = oWQwwbPzWCRwpxBtOjWvaLK99498267; oWQwwbPzWCRwpxBtOjWvaLK99498267 = oWQwwbPzWCRwpxBtOjWvaLK11125335; oWQwwbPzWCRwpxBtOjWvaLK11125335 = oWQwwbPzWCRwpxBtOjWvaLK48004319; oWQwwbPzWCRwpxBtOjWvaLK48004319 = oWQwwbPzWCRwpxBtOjWvaLK66362001; oWQwwbPzWCRwpxBtOjWvaLK66362001 = oWQwwbPzWCRwpxBtOjWvaLK56527487; oWQwwbPzWCRwpxBtOjWvaLK56527487 = oWQwwbPzWCRwpxBtOjWvaLK93675910; oWQwwbPzWCRwpxBtOjWvaLK93675910 = oWQwwbPzWCRwpxBtOjWvaLK91141430; oWQwwbPzWCRwpxBtOjWvaLK91141430 = oWQwwbPzWCRwpxBtOjWvaLK12489194; oWQwwbPzWCRwpxBtOjWvaLK12489194 = oWQwwbPzWCRwpxBtOjWvaLK57759289; oWQwwbPzWCRwpxBtOjWvaLK57759289 = oWQwwbPzWCRwpxBtOjWvaLK76817100; oWQwwbPzWCRwpxBtOjWvaLK76817100 = oWQwwbPzWCRwpxBtOjWvaLK84468259; oWQwwbPzWCRwpxBtOjWvaLK84468259 = oWQwwbPzWCRwpxBtOjWvaLK6876233;}
void fvJIxlmZlCFSBPEGhaUYVDmqyj94007016() { float PDWTdmtjEqnRPxqsDYkXdwX90599750 = -446116137; float PDWTdmtjEqnRPxqsDYkXdwX74198139 = -469320689; float PDWTdmtjEqnRPxqsDYkXdwX43346152 = -650229252; float PDWTdmtjEqnRPxqsDYkXdwX8620268 = -596730168; float PDWTdmtjEqnRPxqsDYkXdwX96835583 = -221770103; float PDWTdmtjEqnRPxqsDYkXdwX70711741 = -192679393; float PDWTdmtjEqnRPxqsDYkXdwX43969300 = -573311670; float PDWTdmtjEqnRPxqsDYkXdwX26670812 = -110589234; float PDWTdmtjEqnRPxqsDYkXdwX88358244 = -389847914; float PDWTdmtjEqnRPxqsDYkXdwX58348612 = -400315517; float PDWTdmtjEqnRPxqsDYkXdwX55276056 = -433701161; float PDWTdmtjEqnRPxqsDYkXdwX43511367 = -583329541; float PDWTdmtjEqnRPxqsDYkXdwX20227167 = -766739945; float PDWTdmtjEqnRPxqsDYkXdwX3162396 = -821639865; float PDWTdmtjEqnRPxqsDYkXdwX33316803 = -878136042; float PDWTdmtjEqnRPxqsDYkXdwX7328964 = -250452124; float PDWTdmtjEqnRPxqsDYkXdwX46035290 = -743568093; float PDWTdmtjEqnRPxqsDYkXdwX79883423 = -118444149; float PDWTdmtjEqnRPxqsDYkXdwX63321024 = -777425871; float PDWTdmtjEqnRPxqsDYkXdwX56503549 = -404748149; float PDWTdmtjEqnRPxqsDYkXdwX4965375 = -353654786; float PDWTdmtjEqnRPxqsDYkXdwX12116017 = -19399165; float PDWTdmtjEqnRPxqsDYkXdwX75479486 = -90711659; float PDWTdmtjEqnRPxqsDYkXdwX32338706 = -384897936; float PDWTdmtjEqnRPxqsDYkXdwX35530859 = -675835795; float PDWTdmtjEqnRPxqsDYkXdwX70462333 = -167602021; float PDWTdmtjEqnRPxqsDYkXdwX87333441 = -333949808; float PDWTdmtjEqnRPxqsDYkXdwX69676007 = -204029907; float PDWTdmtjEqnRPxqsDYkXdwX26637287 = 30786089; float PDWTdmtjEqnRPxqsDYkXdwX79132482 = -351494128; float PDWTdmtjEqnRPxqsDYkXdwX2980101 = -294703199; float PDWTdmtjEqnRPxqsDYkXdwX7099100 = -437748349; float PDWTdmtjEqnRPxqsDYkXdwX15208438 = -982751284; float PDWTdmtjEqnRPxqsDYkXdwX13303116 = 49864475; float PDWTdmtjEqnRPxqsDYkXdwX62863880 = -928260500; float PDWTdmtjEqnRPxqsDYkXdwX51282991 = -262437516; float PDWTdmtjEqnRPxqsDYkXdwX71331933 = -82157320; float PDWTdmtjEqnRPxqsDYkXdwX29287341 = -842475516; float PDWTdmtjEqnRPxqsDYkXdwX16947878 = -459416973; float PDWTdmtjEqnRPxqsDYkXdwX26495749 = -828411354; float PDWTdmtjEqnRPxqsDYkXdwX35920882 = -312886553; float PDWTdmtjEqnRPxqsDYkXdwX70440504 = -905809460; float PDWTdmtjEqnRPxqsDYkXdwX85113996 = -79420702; float PDWTdmtjEqnRPxqsDYkXdwX14639967 = -232808266; float PDWTdmtjEqnRPxqsDYkXdwX42536719 = -638117229; float PDWTdmtjEqnRPxqsDYkXdwX78656007 = -838462739; float PDWTdmtjEqnRPxqsDYkXdwX55167625 = -569690701; float PDWTdmtjEqnRPxqsDYkXdwX72095856 = -560182888; float PDWTdmtjEqnRPxqsDYkXdwX18694706 = -125543055; float PDWTdmtjEqnRPxqsDYkXdwX6745203 = -175255944; float PDWTdmtjEqnRPxqsDYkXdwX90140731 = -578528434; float PDWTdmtjEqnRPxqsDYkXdwX1725394 = -7079079; float PDWTdmtjEqnRPxqsDYkXdwX17680799 = -387803553; float PDWTdmtjEqnRPxqsDYkXdwX76051039 = -943265848; float PDWTdmtjEqnRPxqsDYkXdwX89041641 = -608387833; float PDWTdmtjEqnRPxqsDYkXdwX78483733 = -326716973; float PDWTdmtjEqnRPxqsDYkXdwX98718652 = -278609030; float PDWTdmtjEqnRPxqsDYkXdwX11007447 = -165331316; float PDWTdmtjEqnRPxqsDYkXdwX73089409 = -920894374; float PDWTdmtjEqnRPxqsDYkXdwX26373251 = 45831917; float PDWTdmtjEqnRPxqsDYkXdwX83378300 = -858729586; float PDWTdmtjEqnRPxqsDYkXdwX74293293 = -269281763; float PDWTdmtjEqnRPxqsDYkXdwX33526 = -41375324; float PDWTdmtjEqnRPxqsDYkXdwX9225762 = 61646214; float PDWTdmtjEqnRPxqsDYkXdwX55368512 = -5612318; float PDWTdmtjEqnRPxqsDYkXdwX48176957 = -995952812; float PDWTdmtjEqnRPxqsDYkXdwX28302929 = -600578257; float PDWTdmtjEqnRPxqsDYkXdwX6924051 = -716604420; float PDWTdmtjEqnRPxqsDYkXdwX40298516 = -893379365; float PDWTdmtjEqnRPxqsDYkXdwX82033811 = -515698527; float PDWTdmtjEqnRPxqsDYkXdwX35997031 = -68294804; float PDWTdmtjEqnRPxqsDYkXdwX16747950 = -901092578; float PDWTdmtjEqnRPxqsDYkXdwX62935545 = -659027177; float PDWTdmtjEqnRPxqsDYkXdwX36825275 = -949014517; float PDWTdmtjEqnRPxqsDYkXdwX20582668 = 8138403; float PDWTdmtjEqnRPxqsDYkXdwX34524871 = -447845327; float PDWTdmtjEqnRPxqsDYkXdwX27002021 = -939978464; float PDWTdmtjEqnRPxqsDYkXdwX60839520 = -857903394; float PDWTdmtjEqnRPxqsDYkXdwX89801987 = -746780708; float PDWTdmtjEqnRPxqsDYkXdwX56874851 = -837373056; float PDWTdmtjEqnRPxqsDYkXdwX15294709 = -597911321; float PDWTdmtjEqnRPxqsDYkXdwX15237585 = -773766921; float PDWTdmtjEqnRPxqsDYkXdwX50981302 = 21513147; float PDWTdmtjEqnRPxqsDYkXdwX19892084 = -793957967; float PDWTdmtjEqnRPxqsDYkXdwX88991750 = -772965694; float PDWTdmtjEqnRPxqsDYkXdwX1254708 = -187624121; float PDWTdmtjEqnRPxqsDYkXdwX89418300 = 50055203; float PDWTdmtjEqnRPxqsDYkXdwX39157399 = 60514563; float PDWTdmtjEqnRPxqsDYkXdwX24261475 = -341747692; float PDWTdmtjEqnRPxqsDYkXdwX84380146 = -501543528; float PDWTdmtjEqnRPxqsDYkXdwX52564338 = -983828486; float PDWTdmtjEqnRPxqsDYkXdwX60324487 = -916826004; float PDWTdmtjEqnRPxqsDYkXdwX56197932 = -921581142; float PDWTdmtjEqnRPxqsDYkXdwX90574627 = -405248891; float PDWTdmtjEqnRPxqsDYkXdwX43117449 = -969681769; float PDWTdmtjEqnRPxqsDYkXdwX61627588 = 56395210; float PDWTdmtjEqnRPxqsDYkXdwX70406979 = -764434136; float PDWTdmtjEqnRPxqsDYkXdwX75888234 = -41066916; float PDWTdmtjEqnRPxqsDYkXdwX59271455 = -127195948; float PDWTdmtjEqnRPxqsDYkXdwX94359762 = -446116137; PDWTdmtjEqnRPxqsDYkXdwX90599750 = PDWTdmtjEqnRPxqsDYkXdwX74198139; PDWTdmtjEqnRPxqsDYkXdwX74198139 = PDWTdmtjEqnRPxqsDYkXdwX43346152; PDWTdmtjEqnRPxqsDYkXdwX43346152 = PDWTdmtjEqnRPxqsDYkXdwX8620268; PDWTdmtjEqnRPxqsDYkXdwX8620268 = PDWTdmtjEqnRPxqsDYkXdwX96835583; PDWTdmtjEqnRPxqsDYkXdwX96835583 = PDWTdmtjEqnRPxqsDYkXdwX70711741; PDWTdmtjEqnRPxqsDYkXdwX70711741 = PDWTdmtjEqnRPxqsDYkXdwX43969300; PDWTdmtjEqnRPxqsDYkXdwX43969300 = PDWTdmtjEqnRPxqsDYkXdwX26670812; PDWTdmtjEqnRPxqsDYkXdwX26670812 = PDWTdmtjEqnRPxqsDYkXdwX88358244; PDWTdmtjEqnRPxqsDYkXdwX88358244 = PDWTdmtjEqnRPxqsDYkXdwX58348612; PDWTdmtjEqnRPxqsDYkXdwX58348612 = PDWTdmtjEqnRPxqsDYkXdwX55276056; PDWTdmtjEqnRPxqsDYkXdwX55276056 = PDWTdmtjEqnRPxqsDYkXdwX43511367; PDWTdmtjEqnRPxqsDYkXdwX43511367 = PDWTdmtjEqnRPxqsDYkXdwX20227167; PDWTdmtjEqnRPxqsDYkXdwX20227167 = PDWTdmtjEqnRPxqsDYkXdwX3162396; PDWTdmtjEqnRPxqsDYkXdwX3162396 = PDWTdmtjEqnRPxqsDYkXdwX33316803; PDWTdmtjEqnRPxqsDYkXdwX33316803 = PDWTdmtjEqnRPxqsDYkXdwX7328964; PDWTdmtjEqnRPxqsDYkXdwX7328964 = PDWTdmtjEqnRPxqsDYkXdwX46035290; PDWTdmtjEqnRPxqsDYkXdwX46035290 = PDWTdmtjEqnRPxqsDYkXdwX79883423; PDWTdmtjEqnRPxqsDYkXdwX79883423 = PDWTdmtjEqnRPxqsDYkXdwX63321024; PDWTdmtjEqnRPxqsDYkXdwX63321024 = PDWTdmtjEqnRPxqsDYkXdwX56503549; PDWTdmtjEqnRPxqsDYkXdwX56503549 = PDWTdmtjEqnRPxqsDYkXdwX4965375; PDWTdmtjEqnRPxqsDYkXdwX4965375 = PDWTdmtjEqnRPxqsDYkXdwX12116017; PDWTdmtjEqnRPxqsDYkXdwX12116017 = PDWTdmtjEqnRPxqsDYkXdwX75479486; PDWTdmtjEqnRPxqsDYkXdwX75479486 = PDWTdmtjEqnRPxqsDYkXdwX32338706; PDWTdmtjEqnRPxqsDYkXdwX32338706 = PDWTdmtjEqnRPxqsDYkXdwX35530859; PDWTdmtjEqnRPxqsDYkXdwX35530859 = PDWTdmtjEqnRPxqsDYkXdwX70462333; PDWTdmtjEqnRPxqsDYkXdwX70462333 = PDWTdmtjEqnRPxqsDYkXdwX87333441; PDWTdmtjEqnRPxqsDYkXdwX87333441 = PDWTdmtjEqnRPxqsDYkXdwX69676007; PDWTdmtjEqnRPxqsDYkXdwX69676007 = PDWTdmtjEqnRPxqsDYkXdwX26637287; PDWTdmtjEqnRPxqsDYkXdwX26637287 = PDWTdmtjEqnRPxqsDYkXdwX79132482; PDWTdmtjEqnRPxqsDYkXdwX79132482 = PDWTdmtjEqnRPxqsDYkXdwX2980101; PDWTdmtjEqnRPxqsDYkXdwX2980101 = PDWTdmtjEqnRPxqsDYkXdwX7099100; PDWTdmtjEqnRPxqsDYkXdwX7099100 = PDWTdmtjEqnRPxqsDYkXdwX15208438; PDWTdmtjEqnRPxqsDYkXdwX15208438 = PDWTdmtjEqnRPxqsDYkXdwX13303116; PDWTdmtjEqnRPxqsDYkXdwX13303116 = PDWTdmtjEqnRPxqsDYkXdwX62863880; PDWTdmtjEqnRPxqsDYkXdwX62863880 = PDWTdmtjEqnRPxqsDYkXdwX51282991; PDWTdmtjEqnRPxqsDYkXdwX51282991 = PDWTdmtjEqnRPxqsDYkXdwX71331933; PDWTdmtjEqnRPxqsDYkXdwX71331933 = PDWTdmtjEqnRPxqsDYkXdwX29287341; PDWTdmtjEqnRPxqsDYkXdwX29287341 = PDWTdmtjEqnRPxqsDYkXdwX16947878; PDWTdmtjEqnRPxqsDYkXdwX16947878 = PDWTdmtjEqnRPxqsDYkXdwX26495749; PDWTdmtjEqnRPxqsDYkXdwX26495749 = PDWTdmtjEqnRPxqsDYkXdwX35920882; PDWTdmtjEqnRPxqsDYkXdwX35920882 = PDWTdmtjEqnRPxqsDYkXdwX70440504; PDWTdmtjEqnRPxqsDYkXdwX70440504 = PDWTdmtjEqnRPxqsDYkXdwX85113996; PDWTdmtjEqnRPxqsDYkXdwX85113996 = PDWTdmtjEqnRPxqsDYkXdwX14639967; PDWTdmtjEqnRPxqsDYkXdwX14639967 = PDWTdmtjEqnRPxqsDYkXdwX42536719; PDWTdmtjEqnRPxqsDYkXdwX42536719 = PDWTdmtjEqnRPxqsDYkXdwX78656007; PDWTdmtjEqnRPxqsDYkXdwX78656007 = PDWTdmtjEqnRPxqsDYkXdwX55167625; PDWTdmtjEqnRPxqsDYkXdwX55167625 = PDWTdmtjEqnRPxqsDYkXdwX72095856; PDWTdmtjEqnRPxqsDYkXdwX72095856 = PDWTdmtjEqnRPxqsDYkXdwX18694706; PDWTdmtjEqnRPxqsDYkXdwX18694706 = PDWTdmtjEqnRPxqsDYkXdwX6745203; PDWTdmtjEqnRPxqsDYkXdwX6745203 = PDWTdmtjEqnRPxqsDYkXdwX90140731; PDWTdmtjEqnRPxqsDYkXdwX90140731 = PDWTdmtjEqnRPxqsDYkXdwX1725394; PDWTdmtjEqnRPxqsDYkXdwX1725394 = PDWTdmtjEqnRPxqsDYkXdwX17680799; PDWTdmtjEqnRPxqsDYkXdwX17680799 = PDWTdmtjEqnRPxqsDYkXdwX76051039; PDWTdmtjEqnRPxqsDYkXdwX76051039 = PDWTdmtjEqnRPxqsDYkXdwX89041641; PDWTdmtjEqnRPxqsDYkXdwX89041641 = PDWTdmtjEqnRPxqsDYkXdwX78483733; PDWTdmtjEqnRPxqsDYkXdwX78483733 = PDWTdmtjEqnRPxqsDYkXdwX98718652; PDWTdmtjEqnRPxqsDYkXdwX98718652 = PDWTdmtjEqnRPxqsDYkXdwX11007447; PDWTdmtjEqnRPxqsDYkXdwX11007447 = PDWTdmtjEqnRPxqsDYkXdwX73089409; PDWTdmtjEqnRPxqsDYkXdwX73089409 = PDWTdmtjEqnRPxqsDYkXdwX26373251; PDWTdmtjEqnRPxqsDYkXdwX26373251 = PDWTdmtjEqnRPxqsDYkXdwX83378300; PDWTdmtjEqnRPxqsDYkXdwX83378300 = PDWTdmtjEqnRPxqsDYkXdwX74293293; PDWTdmtjEqnRPxqsDYkXdwX74293293 = PDWTdmtjEqnRPxqsDYkXdwX33526; PDWTdmtjEqnRPxqsDYkXdwX33526 = PDWTdmtjEqnRPxqsDYkXdwX9225762; PDWTdmtjEqnRPxqsDYkXdwX9225762 = PDWTdmtjEqnRPxqsDYkXdwX55368512; PDWTdmtjEqnRPxqsDYkXdwX55368512 = PDWTdmtjEqnRPxqsDYkXdwX48176957; PDWTdmtjEqnRPxqsDYkXdwX48176957 = PDWTdmtjEqnRPxqsDYkXdwX28302929; PDWTdmtjEqnRPxqsDYkXdwX28302929 = PDWTdmtjEqnRPxqsDYkXdwX6924051; PDWTdmtjEqnRPxqsDYkXdwX6924051 = PDWTdmtjEqnRPxqsDYkXdwX40298516; PDWTdmtjEqnRPxqsDYkXdwX40298516 = PDWTdmtjEqnRPxqsDYkXdwX82033811; PDWTdmtjEqnRPxqsDYkXdwX82033811 = PDWTdmtjEqnRPxqsDYkXdwX35997031; PDWTdmtjEqnRPxqsDYkXdwX35997031 = PDWTdmtjEqnRPxqsDYkXdwX16747950; PDWTdmtjEqnRPxqsDYkXdwX16747950 = PDWTdmtjEqnRPxqsDYkXdwX62935545; PDWTdmtjEqnRPxqsDYkXdwX62935545 = PDWTdmtjEqnRPxqsDYkXdwX36825275; PDWTdmtjEqnRPxqsDYkXdwX36825275 = PDWTdmtjEqnRPxqsDYkXdwX20582668; PDWTdmtjEqnRPxqsDYkXdwX20582668 = PDWTdmtjEqnRPxqsDYkXdwX34524871; PDWTdmtjEqnRPxqsDYkXdwX34524871 = PDWTdmtjEqnRPxqsDYkXdwX27002021; PDWTdmtjEqnRPxqsDYkXdwX27002021 = PDWTdmtjEqnRPxqsDYkXdwX60839520; PDWTdmtjEqnRPxqsDYkXdwX60839520 = PDWTdmtjEqnRPxqsDYkXdwX89801987; PDWTdmtjEqnRPxqsDYkXdwX89801987 = PDWTdmtjEqnRPxqsDYkXdwX56874851; PDWTdmtjEqnRPxqsDYkXdwX56874851 = PDWTdmtjEqnRPxqsDYkXdwX15294709; PDWTdmtjEqnRPxqsDYkXdwX15294709 = PDWTdmtjEqnRPxqsDYkXdwX15237585; PDWTdmtjEqnRPxqsDYkXdwX15237585 = PDWTdmtjEqnRPxqsDYkXdwX50981302; PDWTdmtjEqnRPxqsDYkXdwX50981302 = PDWTdmtjEqnRPxqsDYkXdwX19892084; PDWTdmtjEqnRPxqsDYkXdwX19892084 = PDWTdmtjEqnRPxqsDYkXdwX88991750; PDWTdmtjEqnRPxqsDYkXdwX88991750 = PDWTdmtjEqnRPxqsDYkXdwX1254708; PDWTdmtjEqnRPxqsDYkXdwX1254708 = PDWTdmtjEqnRPxqsDYkXdwX89418300; PDWTdmtjEqnRPxqsDYkXdwX89418300 = PDWTdmtjEqnRPxqsDYkXdwX39157399; PDWTdmtjEqnRPxqsDYkXdwX39157399 = PDWTdmtjEqnRPxqsDYkXdwX24261475; PDWTdmtjEqnRPxqsDYkXdwX24261475 = PDWTdmtjEqnRPxqsDYkXdwX84380146; PDWTdmtjEqnRPxqsDYkXdwX84380146 = PDWTdmtjEqnRPxqsDYkXdwX52564338; PDWTdmtjEqnRPxqsDYkXdwX52564338 = PDWTdmtjEqnRPxqsDYkXdwX60324487; PDWTdmtjEqnRPxqsDYkXdwX60324487 = PDWTdmtjEqnRPxqsDYkXdwX56197932; PDWTdmtjEqnRPxqsDYkXdwX56197932 = PDWTdmtjEqnRPxqsDYkXdwX90574627; PDWTdmtjEqnRPxqsDYkXdwX90574627 = PDWTdmtjEqnRPxqsDYkXdwX43117449; PDWTdmtjEqnRPxqsDYkXdwX43117449 = PDWTdmtjEqnRPxqsDYkXdwX61627588; PDWTdmtjEqnRPxqsDYkXdwX61627588 = PDWTdmtjEqnRPxqsDYkXdwX70406979; PDWTdmtjEqnRPxqsDYkXdwX70406979 = PDWTdmtjEqnRPxqsDYkXdwX75888234; PDWTdmtjEqnRPxqsDYkXdwX75888234 = PDWTdmtjEqnRPxqsDYkXdwX59271455; PDWTdmtjEqnRPxqsDYkXdwX59271455 = PDWTdmtjEqnRPxqsDYkXdwX94359762; PDWTdmtjEqnRPxqsDYkXdwX94359762 = PDWTdmtjEqnRPxqsDYkXdwX90599750;}
| 215.622685 | 12,607 | 0.836023 | [
"render",
"object",
"vector"
] |
25c3b27f34cb879c49bfc579ab1ccbab36436af7 | 3,031 | cpp | C++ | src/LinkedList.cpp | peter2707/qwirkleM3-M4 | a1a6a0cd82faef18a93edbeff50e7283712e42d4 | [
"MIT"
] | null | null | null | src/LinkedList.cpp | peter2707/qwirkleM3-M4 | a1a6a0cd82faef18a93edbeff50e7283712e42d4 | [
"MIT"
] | null | null | null | src/LinkedList.cpp | peter2707/qwirkleM3-M4 | a1a6a0cd82faef18a93edbeff50e7283712e42d4 | [
"MIT"
] | null | null | null |
#include "LinkedList.h"
#include <stdexcept>
#include <iostream>
LinkedList::LinkedList() {
head = nullptr;
}
LinkedList::~LinkedList() {
clear();
}
LinkedList::LinkedList(LinkedList& other){
head = nullptr;
for(int i = 0; i < other.size(); ++i){
std::shared_ptr<Tile> tile = std::make_shared<Tile>(*other.get(i));
addBack(tile);
}
}
int LinkedList::size(){
int length = 0;
std::shared_ptr<Node> current = head;
while(current != nullptr){
++length;
current = current->next;
}
return length;
}
std::shared_ptr<Tile> LinkedList::get(int index){
std::shared_ptr<Tile> retTile = nullptr;
if(index >= 0 && index < size()){
int counter = 0;
std::shared_ptr<Node> current = head;
while(counter<index){
++counter;
current = current->next;
}
retTile = current->tile;
}
return retTile;
}
void LinkedList::addFront(std::shared_ptr<Tile> data){
std::shared_ptr<Node> node = std::make_shared<Node>();
node->tile = data;
node->next = head;
head = node;
}
void LinkedList::addBack(std::shared_ptr<Tile> data){
std::shared_ptr<Node> node = std::make_shared<Node>();
node->tile = data;
node->next = nullptr;
if(head == nullptr){
head = node;
}else{
std::shared_ptr<Node> current = head;
while(current->next != nullptr){
current = current->next;
}
current->next = node;
}
}
std::shared_ptr<Tile> LinkedList::removeFront(){
std::shared_ptr<Tile> removedTile;
if(head != nullptr){
removedTile = head->tile;
head = head->next;
}else{
throw std::runtime_error("Nothing to remove");
}
return removedTile;
}
void LinkedList::removeBack(){
if(head != nullptr){
std::shared_ptr<Node> current = head;
std::shared_ptr<Node> prev = nullptr;
while(current->next != nullptr){
prev = current;
current = current->next;
}
if(prev == nullptr){
head = nullptr;
}else{
prev->next = nullptr;
}
}
}
void LinkedList::removeIndex(int index){
if(index >= 0 && index < size()){
if(head != nullptr){
int counter = 0;
std::shared_ptr<Node> current = head;
std::shared_ptr<Node> prev = nullptr;
while(counter != index){
++counter;
prev = current;
current = current->next;
}
if(prev == nullptr){
head = current->next;
}else{
prev->next = current->next;
}
}
}
}
int LinkedList::checkTile(string inputTile){
int tileIndex = -1;
if(head != nullptr){
int index = 0;
std::shared_ptr<Node> current = head;
std::shared_ptr<Node> prev = nullptr;
while(index != size()){
if(current->tile->colour + std::to_string(current->tile->shape) == inputTile){
tileIndex = index;
}
++index;
prev = current;
current = current->next;
}
}
return tileIndex;
}
void LinkedList::clear(){
head = nullptr;
}
| 18.709877 | 84 | 0.576707 | [
"shape"
] |
25c4b076349dceaf525e5d0a44f0a8183964c5f3 | 6,552 | cc | C++ | test/low_example/low_example.cc | lightsighter/LegionOrigins | 0180bb3a8ee6efd0d2efdb743f75d3fba86f18f7 | [
"Apache-2.0"
] | 2 | 2021-11-10T06:29:39.000Z | 2021-11-14T20:56:13.000Z | test/low_example/low_example.cc | lightsighter/LegionOrigins | 0180bb3a8ee6efd0d2efdb743f75d3fba86f18f7 | [
"Apache-2.0"
] | null | null | null | test/low_example/low_example.cc | lightsighter/LegionOrigins | 0180bb3a8ee6efd0d2efdb743f75d3fba86f18f7 | [
"Apache-2.0"
] | null | null | null |
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <time.h>
#include "lowlevel.h"
#define NUM_ELEMENTS 128
using namespace RegionRuntime::LowLevel;
// Task IDs, some IDs are reserved so start at first available number
enum {
TOP_LEVEL_TASK = Processor::TASK_ID_FIRST_AVAILABLE+0,
SCALE_TASK = Processor::TASK_ID_FIRST_AVAILABLE+1,
};
// A little helper struct for packaging up task arguments
template<typename T>
struct ScaleArgs {
RegionInstance<T> instance;
ptr_t<T> first_element;
unsigned num_elements;
};
void scale_task(const void *args, size_t arglen, Processor p)
{
assert(arglen == sizeof(ScaleArgs<float>));
// Unpack the arguments
ScaleArgs<float> arguments = *((ScaleArgs<float>*)args);
// To actually access the physical instance we need a region accessor which allows
// us to read or write the physical instance. Normally these just inlined into
// array reads or writes, but in the case where you use GASNet memory they can
// be turned into RDMA operations (hence the level of indirection).
RegionInstanceAccessor<float,AccessorGeneric> accessor = arguments.instance.get_accessor();
printf("Fun in scale task...\n");
// Scale everything in the region by alpha
const float alpha = 2.0f;
ptr_t<float> ptr = arguments.first_element;
for (int i = 0; i < arguments.num_elements; i++)
{
float value = accessor.read(ptr);
accessor.write(ptr,value);
ptr++;
}
}
void top_level_task(const void *args, size_t arglen, Processor p)
{
// We always have a reference to our machine so we can name other processors and memories
Machine *machine = Machine::get_machine();
// Pick two random memories out of the list of all memories just to make this interesting
Memory m1, m2;
{
const std::set<Memory> &all_memories = machine->get_all_memories();
assert(all_memories.size() > 2);
std::set<Memory>::const_iterator it = all_memories.begin();
m1 = *it; it++; m2 = *it;
}
// Pick a random processor to run on
Processor target_proc;
{
const std::set<Processor> &all_processors = machine->get_all_processors();
assert(!all_processors.empty());
target_proc = *(all_processors.begin());
}
// Create our region meta data object that will remember information about our vector
// and allow us to create things like physical instances and allocators in specific memories.
// No memory is actually allocated by doing this.
// Note there are both typed and untyped versions of these that are functionally equivalent.
// You can use the untyped ones if you don't feel like writing out all the types
RegionMetaData<float> region_meta = RegionMetaData<float>::create_region(NUM_ELEMENTS);
// To actually put any data in them we have to create instances and allocators
// Instances and allocators must say what memory they will be associated in.
RegionInstance<float> instance = region_meta.create_instance(m1);
RegionAllocator<float> allocator = region_meta.create_allocator(m1);
// Allocate elements, note that an allocator is just a view onto the meta data
// which remembers the bit mask for which elements in the region are valid.
// The returned value is a pointer to the first element from the allocation.
ptr_t<float> first_element = allocator.alloc(NUM_ELEMENTS);
// I'm not going to bother initializing any data, we'll read and write junk
// Now we make a second instance of the region in the second memory
RegionInstance<float> instance2 = region_meta.create_instance(m2);
// Let's create lock so we can show how they work too
Lock lock = Lock::create_lock();
// Create a UserEvent that we'll control when our computation starts
UserEvent start_event = UserEvent::create_user_event();
// Finally, we get to do the cool thing, we're going to construct a thunk of operations
// 1. Take a lock that "protects" our data
// 2. Issue a copy from instance in m1 -> instance in m2
// 3. Run a task that scales the elements in the region by some alpha
// 4. Issue a copy from instance in m2 -> instance in m1
// 5. Release the lock
Event finish_event = Event::NO_EVENT;
{
Event lock_wait = lock.lock(0/*mode*/,true/*exclusive*/,start_event);
Event copy1_wait = instance.copy_to(instance2, lock_wait);
Event launch_wait;
{
// We need to serialize all the data we want to pass to leaf tasks
// I have utilities to make this easier, but I'll avoid using them here for concreteness
size_t buffer_size = sizeof(ScaleArgs<float>);
void * buffer = malloc(buffer_size);
*((ScaleArgs<float>*)buffer) = { instance2, first_element, NUM_ELEMENTS };
launch_wait = target_proc.spawn(SCALE_TASK,buffer,buffer_size,copy1_wait);
free(buffer);
}
Event copy2_wait = instance2.copy_to(instance, launch_wait);
lock.unlock(copy2_wait);
finish_event = copy2_wait;
}
assert(finish_event.exists());
// Note that nothing has actually run yet because everything is dependent on the
// start event which we haven't triggered yet. Let's do it!
printf("Beginning of the fun...\n");
start_event.trigger();
// Wait for the computation to finish
finish_event.wait();
printf("The fun is now over.\n");
// Clean up our mess
lock.destroy_lock();
region_meta.destroy_instance(instance);
region_meta.destroy_instance(instance2);
region_meta.destroy_allocator(allocator);
region_meta.destroy_region();
// shutdown the runtime
{
Machine *machine = Machine::get_machine();
const std::set<Processor> &all_procs = machine->get_all_processors();
for (std::set<Processor>::const_iterator it = all_procs.begin();
it != all_procs.end(); it++)
{
// Damn you C++ and your broken const qualifiers
Processor handle_copy = *it;
// Send the kill pill
handle_copy.spawn(0,NULL,0);
}
}
}
int main(int argc, char **argv)
{
// Build the task table that the processors will use when running
Processor::TaskIDTable task_table;
ReductionOpTable redop_table;
task_table[TOP_LEVEL_TASK] = top_level_task;
task_table[SCALE_TASK] = scale_task;
// Initialize the machine
Machine m(&argc,&argv,task_table,redop_table,false/*cps style*/);
// Start the machine running
// Control never returns from this call
// Note we only run the top level task on one processor
// You can also run the top level task on all processors or one processor per node
m.run(TOP_LEVEL_TASK, Machine::ONE_TASK_ONLY);
return -1;
}
| 37.227273 | 97 | 0.719933 | [
"object",
"vector"
] |
25c4cf137e29be833acb830d88243a0c193ebd8e | 14,148 | cpp | C++ | eosio.amend/src/eosio.amend.cpp | CALEOS/eosio.contracts | 07b7401f9518794deaff74d6f9547667575f3fcc | [
"MIT"
] | null | null | null | eosio.amend/src/eosio.amend.cpp | CALEOS/eosio.contracts | 07b7401f9518794deaff74d6f9547667575f3fcc | [
"MIT"
] | null | null | null | eosio.amend/src/eosio.amend.cpp | CALEOS/eosio.contracts | 07b7401f9518794deaff74d6f9547667575f3fcc | [
"MIT"
] | null | null | null | #include <eosio.amend.hpp>
#include <eosiolib/symbol.hpp>
#include <eosiolib/print.hpp>
ratifyamend::ratifyamend(name self, name code, datastream<const char*> ds) : contract(self, code, ds), configs(self, self.value) {
if (!configs.exists()) {
configs_struct = config{
_self, //publisher
uint32_t(2500000), // cycle duration in seconds (default 2,500,000 or 5,000,000 blocks or ~29 days)
uint64_t(1000000), // default fee amount 100 TLOS
uint32_t(864000000), // delay before voting starts on a submission in seconds (~1 day) // or building time ~30 years
double(5), // % of all registered voters to pass (minimum, including exactly this value)
double(66.67), // % yes over no, to consider it passed (minimum, including exactly this value)
double(4), // % of all registered voters to refund fee (minimum, including exactly this value)
double(25) // % of yes to give fee back
};
configs.set(configs_struct, _self);
} else {
configs_struct = configs.get();
}
}
ratifyamend::~ratifyamend() {}
void ratifyamend::setenv(config new_environment) {
eosio_assert(new_environment.expiration_length > 0, "expiration_length must be a non-zero number");
eosio_assert(new_environment.start_delay > 0, "start_delay must be a non-zero number");
eosio_assert(new_environment.fee > 0, "fee must be a non-zero number");
eosio_assert(new_environment.threshold_pass_voters >= 0 && new_environment.threshold_pass_voters <= 100, "threshold pass_voters must be between 0 and 100");
eosio_assert(new_environment.threshold_pass_votes >= 0 && new_environment.threshold_pass_votes <= 100, "threshold pass_votes must be between 0 and 100");
eosio_assert(new_environment.threshold_fee_voters >= 0 && new_environment.threshold_fee_voters <= 100, "threshold fee_voters must be between 0 and 100");
eosio_assert(new_environment.threshold_fee_votes >= 0 && new_environment.threshold_fee_votes <= 100, "threshold fee_votes must be between 0 and 100");
require_auth(_self);
configs.set(new_environment, _self);
}
void ratifyamend::getdeposit(name owner) {
require_auth(owner);
deposits_table deposits(_self, _self.value);
auto d_itr = deposits.find(owner.value);
eosio_assert(d_itr != deposits.end(), "Deposit not found");
auto d = *d_itr;
require_auth(d.owner);
action(permission_level{_self, "active"_n}, "eosio.token"_n, "transfer"_n, make_tuple(
_self,
d.owner,
d.escrow,
std::string("return unused deposit")
)).send();
deposits.erase(d_itr);
}
void ratifyamend::transfer_handler(name from, name to, asset quantity) {
require_auth(from);
if(to != _self) {
return;
}
if(quantity.symbol == symbol("TLOS", 4)) {
deposits_table deposits(_self, _self.value);
auto d = deposits.find(from.value);
if(d == deposits.end()) {
deposits.emplace(get_self(), [&](auto& depo) {
depo.owner = from;
depo.escrow = quantity;
});
} else {
deposits.modify(d, same_payer, [&](auto& depo) {
depo.escrow += quantity;
});
}
}
print("\nDeposit Complete");
}
void ratifyamend::insertdoc(string title, vector<string> clauses) {
require_auth(_self); //only contract owner can insert new document
documents_table documents(_self, _self.value);
uint64_t doc_id = documents.available_primary_key();
documents.emplace(_self, [&]( auto& a ){
a.document_id = doc_id;
a.document_title = title;
a.clauses = clauses;
});
print("\nDocument Insertion: SUCCESS");
print("\nAssigned Document ID: ", doc_id);
}
void ratifyamend::makeproposal(string sub_title, uint64_t doc_id, uint8_t new_clause_num, string new_ipfs_url, name proposer) {
require_auth(proposer);
documents_table documents(_self, _self.value);
auto d = documents.find(doc_id);
eosio_assert(d != documents.end(), "Document Not Found");
auto doc = *d;
eosio_assert(new_clause_num <= doc.clauses.size() && new_clause_num >= 0, "new clause num is not valid");
deposits_table deposits(_self, _self.value);
auto d_itr = deposits.find(proposer.value);
eosio_assert(d_itr != deposits.end(), "Deposit not found, please transfer your TLOS fee");
auto dep = *d_itr;
asset fee = asset(configs_struct.fee, symbol("TLOS", 4));
eosio_assert(dep.escrow >= fee, "Deposit amount is less than fee, please transfer more TLOS");
if(dep.escrow > fee) {
asset outstanding = dep.escrow - fee;
deposits.modify(dep, same_payer, [&](auto& depo) {
depo.escrow = outstanding;
});
} else {
deposits.erase(d_itr);
}
ballots_table ballots("eosio.trail"_n, "eosio.trail"_n.value);
uint32_t begin_time = now() + configs_struct.start_delay;
uint32_t end_time = now() + configs_struct.start_delay + configs_struct.expiration_length;
uint64_t next_ballot_id = ballots.available_primary_key();
action(permission_level{_self, "active"_n}, "eosio.trail"_n, "regballot"_n, make_tuple(
_self,
uint8_t(0),
symbol("VOTE",4),
begin_time,
end_time,
new_ipfs_url
)).send();
submissions_table submissions(_self, _self.value);
auto sub_id = submissions.available_primary_key();
vector<uint8_t> clause_nums;
clause_nums.push_back(new_clause_num);
vector<string> clause_urls;
clause_urls.push_back(new_ipfs_url);
submissions.emplace(proposer, [&]( auto& a ){
a.proposal_id = sub_id;
a.ballot_id = next_ballot_id;
a.proposer = proposer;
a.document_id = doc_id;
a.proposal_title = sub_title;
a.new_clause_nums = clause_nums;
a.new_ipfs_urls = clause_urls;
});
print("\nProposal: SUCCESS");
print("\nAssigned Submission ID: ", sub_id);
}
void ratifyamend::addclause(uint64_t sub_id, uint8_t new_clause_num, string new_ipfs_url) {
submissions_table submissions(_self, _self.value);
auto s = submissions.find(sub_id);
eosio_assert(s != submissions.end(), "proposal doesn't exist");
auto sub = *s;
require_auth(sub.proposer);
ballots_table ballots("eosio.trail"_n, "eosio.trail"_n.value);
auto& bal = ballots.get(sub.ballot_id, "Ballot ID doesn't exist");
proposals_table props_table("eosio.trail"_n, "eosio.trail"_n.value);
auto& prop = props_table.get(bal.reference_id, "Proposal Not Found");
eosio_assert(prop.cycle_count == uint16_t(0), "proposal is no longer in building stage");
documents_table documents(_self, _self.value);
auto d = documents.find(sub.document_id);
eosio_assert(d != documents.end(), "Document Not Found");
auto doc = *d;
eosio_assert(new_clause_num <= doc.clauses.size() && new_clause_num >= 0, "new clause num is not valid");
bool existing_clause = false;
for (int i = 0; i < sub.new_clause_nums.size(); i++) {
if (sub.new_clause_nums[i] == new_clause_num) {
existing_clause = true;
}
}
eosio_assert(existing_clause = false, "clause number to add already exists in proposal");
sub.new_clause_nums.push_back(new_clause_num);
sub.new_ipfs_urls.push_back(new_ipfs_url);
submissions.modify(s, same_payer, [&]( auto& a ) {
a.new_clause_nums = sub.new_clause_nums;
a.new_ipfs_urls = sub.new_ipfs_urls;
});
print("\nAdd Clause: SUCCESS");
}
void ratifyamend::cancelsub(uint64_t sub_id) {
submissions_table submissions(_self, _self.value);
auto s_itr = submissions.find(sub_id);
eosio_assert(s_itr != submissions.end(), "Submission not found");
auto s = *s_itr;
require_auth(s.proposer);
ballots_table ballots("eosio.trail"_n, "eosio.trail"_n.value);
auto b = ballots.get(s.ballot_id, "Ballot not found on eosio.trail ballots_table");
proposals_table proposals("eosio.trail"_n, "eosio.trail"_n.value);
auto p = proposals.get(b.reference_id, "Prosal not found on eosio.trail proposals_table");
eosio_assert(p.cycle_count == uint16_t(0), "proposal is no longer in building stage");
eosio_assert(p.status == uint8_t(0), "Proposal is already closed");
eosio_assert(now() < p.begin_time, "Proposal voting has already begun. Unable to cancel.");
action(permission_level{ _self, "active"_n }, "eosio.trail"_n, "unregballot"_n, make_tuple(
_self,
s.ballot_id
)).send();
submissions.erase(s_itr);
}
void ratifyamend::openvoting(uint64_t sub_id) {
submissions_table submissions(_self, _self.value);
auto& sub = submissions.get(sub_id, "Proposal Not Found");
require_auth(sub.proposer);
ballots_table ballots("eosio.trail"_n, "eosio.trail"_n.value);
auto& bal = ballots.get(sub.ballot_id, "Ballot ID doesn't exist");
proposals_table props_table("eosio.trail"_n, "eosio.trail"_n.value);
auto& prop = props_table.get(bal.reference_id, "Proposal Not Found");
eosio_assert(prop.cycle_count == uint16_t(0), "proposal is no longer in building stage");
eosio_assert(prop.status == uint8_t(0), "Proposal is already closed");
uint32_t begin_time = now();
uint32_t end_time = now() + configs_struct.expiration_length;
action(permission_level{ _self, "active"_n }, "eosio.trail"_n, "nextcycle"_n, make_tuple(
_self,
sub.ballot_id,
begin_time,
end_time
)).send();
print("\nReady Proposal: SUCCESS");
}
void ratifyamend::closeprop(uint64_t sub_id) {
submissions_table submissions(_self, _self.value);
auto& sub = submissions.get(sub_id, "Proposal Not Found");
require_auth(sub.proposer);
ballots_table ballots("eosio.trail"_n, "eosio.trail"_n.value);
auto& bal = ballots.get(sub.ballot_id, "Ballot ID doesn't exist");
proposals_table props_table("eosio.trail"_n, "eosio.trail"_n.value);
auto& prop = props_table.get(bal.reference_id, "Proposal Not Found");
eosio_assert(prop.end_time < now(), "Proposal is still open");
eosio_assert(prop.status == uint8_t(0), "Proposal is already closed");
registries_table registries("eosio.trail"_n, "eosio.trail"_n.value);
auto e = registries.find(symbol("VOTE", 4).code().raw());
asset total_votes = (prop.yes_count + prop.no_count + prop.abstain_count); //total votes cast on proposal
asset non_abstain_votes = (prop.yes_count + prop.no_count);
//pass thresholds
uint64_t voters_pass_thresh = (e->total_voters * configs_struct.threshold_pass_voters) / 100;
asset votes_pass_thresh = (non_abstain_votes * configs_struct.threshold_pass_votes) / 100;
//fee refund thresholds
uint64_t voters_fee_thresh = (e->total_voters * configs_struct.threshold_fee_voters) / 100;
asset votes_fee_thresh = (total_votes * configs_struct.threshold_fee_votes) / 100;
if( prop.yes_count >= votes_fee_thresh && prop.unique_voters >= voters_fee_thresh) {
action(permission_level{ _self, "active"_n }, "eosio.token"_n, "transfer"_n, make_tuple(
_self,
sub.proposer,
asset(int64_t(configs_struct.fee), symbol("TLOS", 4)),
std::string("Ratify/Amend Proposal Fee Refund")
)).send();
}
uint8_t new_status = 2;
if( prop.yes_count > votes_pass_thresh && prop.unique_voters >= voters_pass_thresh ) {
update_doc(sub.document_id, sub.new_clause_nums, sub.new_ipfs_urls);
new_status = uint8_t(1);
}
action(permission_level{ _self, "active"_n }, "eosio.trail"_n, "closeballot"_n, make_tuple(
_self,
sub.ballot_id,
new_status
)).send();
}
#pragma region Helper_Functions
void ratifyamend::update_doc(uint64_t document_id, vector<uint8_t> new_clause_nums, vector<string> new_ipfs_urls) {
documents_table documents(_self, _self.value);
auto d = documents.find(document_id);
auto doc = *d;
auto doc_size = doc.clauses.size();
for (int i = 0; i < new_clause_nums.size(); i++) {
if (new_clause_nums[i] < doc.clauses.size()) { //update existing clause
doc.clauses[new_clause_nums[i]] = new_ipfs_urls.at(i);
} else { //add new clause
doc.clauses.push_back(new_ipfs_urls.at(i));
}
}
documents.modify(d, same_payer, [&]( auto& a ) {
a.clauses = doc.clauses;
});
}
#pragma endregion Helper_Functions
extern "C" {
void apply(uint64_t self, uint64_t code, uint64_t action) {
size_t size = action_data_size();
constexpr size_t max_stack_buffer_size = 512;
void* buffer = nullptr;
if( size > 0 ) {
buffer = max_stack_buffer_size < size ? malloc(size) : alloca(size);
read_action_data(buffer, size);
}
datastream<const char*> ds((char*)buffer, size);
if(code == self && action == name("insertdoc").value) {
execute_action(name(self), name(code), &ratifyamend::insertdoc);
} else if (code == self && action == name("getdeposit").value) {
execute_action(name(self), name(code), &ratifyamend::getdeposit);
} else if (code == self && action == name("makeproposal").value) {
execute_action(name(self), name(code), &ratifyamend::makeproposal);
} else if (code == self && action == name("cancelsub").value) {
execute_action(name(self), name(code), &ratifyamend::cancelsub);
} else if (code == self && action == name("addclause").value) {
execute_action(name(self), name(code), &ratifyamend::addclause);
} else if (code == self && action == name("openvoting").value) {
execute_action(name(self), name(code), &ratifyamend::openvoting);
} else if (code == self && action == name("closeprop").value) {
execute_action(name(self), name(code), &ratifyamend::closeprop);
} else if (code == self && action == name("setenv").value) {
execute_action(name(self), name(code), &ratifyamend::setenv);
} else if (code == name("eosio.token").value && action == name("transfer").value) {
ratifyamend ramend(name(self), name(code), ds);
auto args = unpack_action_data<transfer_args>();
ramend.transfer_handler(args.from, args.to, args.quantity);
}
} //end apply
}; | 38.550409 | 157 | 0.676703 | [
"vector"
] |
5adc571748a3276b1b0d32dcd21e1ac8d17a8feb | 2,451 | cpp | C++ | patbasic/test1058.cpp | neild47/PATBasic | 6215232750aa62cf406eb2a9f9c9a6d7c3850339 | [
"MIT"
] | null | null | null | patbasic/test1058.cpp | neild47/PATBasic | 6215232750aa62cf406eb2a9f9c9a6d7c3850339 | [
"MIT"
] | null | null | null | patbasic/test1058.cpp | neild47/PATBasic | 6215232750aa62cf406eb2a9f9c9a6d7c3850339 | [
"MIT"
] | null | null | null | //
// Created by neild47 on 18-4-29.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Question {
public:
int id;
int count;
int mark;
vector<char> ans;
Question(int id, int mark) : id(id), count(0), mark(mark) {
}
bool operator<(Question &other) {
if (count != other.count) {
return count > other.count;
} else {
return id < other.id;
}
}
};
int test1058() {
int n_students, n_questions;
cin >> n_students >> n_questions;
vector<Question> questions;
questions.reserve(n_questions);
for (int i = 1; i <= n_questions; i++) {
int mark;
cin >> mark;
questions.emplace_back(i, mark);
cin >> mark;
cin >> mark;
for (int j = 0; j < mark; j++) {
char c;
cin >> c;
while (c == ' ') {
cin >> c;
}
questions.back().ans.push_back(c);
}
}
for (int i = 0; i < n_students; i++) {
int s_mark = 0;
for (int j = 0; j < n_questions; j++) {
char c;
cin >> c;
while (c != '(') {
cin >> c;
}
int co;
cin >> co;
if (co == questions[j].ans.size()) {
bool iserr = false;
while (c != ')') {
cin >> c;
while (c == ' ') {
cin >> c;
}
if (c == ')') break;
if (!binary_search(questions[j].ans.begin(), questions[j].ans.end(), c)) {
iserr = true;
}
}
if (iserr) {
questions[j].count++;
} else {
s_mark += questions[j].mark;
}
} else {
questions[j].count++;
}
}
cout << s_mark << endl;
}
sort(questions.begin(), questions.end());
if ((*questions.begin()).count == 0) {
cout << "Too simple" << endl;
} else {
auto iter = questions.begin();
cout << (*iter).count << " " << (*iter).id;
iter++;
while ((*iter).count == (*questions.begin()).count && iter != questions.end()) {
cout << " " << (*iter).id;
iter++;
}
}
return 0;
}
| 24.757576 | 94 | 0.394941 | [
"vector"
] |
5aeab387ce5185239985937780f73f509424d823 | 1,457 | hpp | C++ | dsrg/caffe/include/caffe/layers/sp_agg_layer.hpp | yaoqi-zd/SGAN | 43d8a859b03967e2423a73ef1ba332ee71714ba4 | [
"MIT"
] | 48 | 2020-02-19T02:31:30.000Z | 2021-12-24T23:58:13.000Z | dsrg/caffe/include/caffe/layers/sp_agg_layer.hpp | yaoqi-zd/SGAN | 43d8a859b03967e2423a73ef1ba332ee71714ba4 | [
"MIT"
] | 16 | 2020-02-28T14:56:58.000Z | 2021-07-05T09:35:10.000Z | dsrg/caffe/include/caffe/layers/sp_agg_layer.hpp | yaoqi-zd/SGAN | 43d8a859b03967e2423a73ef1ba332ee71714ba4 | [
"MIT"
] | 12 | 2020-01-14T15:46:11.000Z | 2021-12-17T08:57:07.000Z | #ifndef CAFFE_SP_AGG_LAYER
#define CAFFE_SP_AGG_LAYER
#include <vector>
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/proto/caffe.pb.h"
namespace caffe {
/* Superpixel aggregation layer, compute mean feature in a superpixel
bottom[0]: fc8 (N, 21, 41, 41)
bottom[1]: sp (N, 1, 41, 41)
bottom[2]: num_sp (N, 1, 1, 1)
top[0]: sp_agg_fc8 (1, 1, 21, N_sp_all)
*/
template <typename Dtype>
class SpAggLayer : public Layer<Dtype> {
public:
explicit SpAggLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual inline const char* type() const { return "SpAgg"; }
virtual inline int ExactNumBottomBlobs() const { return 3; }
virtual inline int ExactNumTopBlobs() const { return 1; }
protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
int height_, width_, channels_, num_;
vector<int> pixelcount_; // num of pixels in each superpixel
vector<int> sp_start_idx_; // start index of first superpixel for each image
int num_sp_all_;
}; // class SpAggLayer
}// namespace caffe
#endif
| 30.354167 | 78 | 0.701441 | [
"vector"
] |
5aeab5739c286e26369e42dd17db75397e8de4ed | 520 | cpp | C++ | graph/k_shortest_walk/gen/loop.cpp | tko919/library-checker-problems | 007a3ef79d1a1824e68545ab326d1523d9c05262 | [
"Apache-2.0"
] | 290 | 2019-06-06T22:20:36.000Z | 2022-03-27T12:45:04.000Z | graph/k_shortest_walk/gen/loop.cpp | tko919/library-checker-problems | 007a3ef79d1a1824e68545ab326d1523d9c05262 | [
"Apache-2.0"
] | 536 | 2019-06-06T18:25:36.000Z | 2022-03-29T11:46:36.000Z | graph/k_shortest_walk/gen/loop.cpp | tko919/library-checker-problems | 007a3ef79d1a1824e68545ab326d1523d9c05262 | [
"Apache-2.0"
] | 82 | 2019-06-06T18:17:55.000Z | 2022-03-21T07:40:31.000Z | #include <iostream>
#include <vector>
#include "random.h"
#include "../params.h"
using namespace std;
int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);
int n = N_AND_M_MAX;
int m = n;
int k = K_MAX;
vector<int> v(n);
for (int i = 0; i < n; i++)v[i]=i;
gen.shuffle(v.begin(),v.end());
int s=v[0];
int t=v.back();
printf("%d %d %d %d %d\n",n,m,s,t,k);
for (int i = 0; i < m; i++){
int c=C_MAX;
printf("%d %d %d\n",v[i],v[(i+1)%n],c);
}
return 0;
} | 21.666667 | 47 | 0.538462 | [
"vector"
] |
5aec994706c13e9d65a6ad4f2780a8cb5ebaef11 | 15,157 | cpp | C++ | Source/RuntimeEditor/CLightMap.cpp | shanefarris/CoreGameEngine | 5bef275d1cd4e84aa059f2f4f9e97bfa2414d000 | [
"MIT"
] | 3 | 2019-04-12T15:22:53.000Z | 2022-01-05T02:59:56.000Z | Source/RuntimeEditor/CLightMap.cpp | shanefarris/CoreGameEngine | 5bef275d1cd4e84aa059f2f4f9e97bfa2414d000 | [
"MIT"
] | null | null | null | Source/RuntimeEditor/CLightMap.cpp | shanefarris/CoreGameEngine | 5bef275d1cd4e84aa059f2f4f9e97bfa2414d000 | [
"MIT"
] | 2 | 2019-04-10T22:46:21.000Z | 2020-05-27T16:21:37.000Z | #if 0
#include "CLightMap.h"
#include "IPhysicsStrategy.h"
#include "CPhysicsManager.h"
#include "PhysicsStructures.h"
#include "OgrePass.h"
#include "OgreMaterial.h"
#include "OgreTechnique.h"
#include "OgreSubMesh.h"
#include "OgreSubEntity.h"
#include "OgreStringConverter.h"
#include "OgreTextureManager.h"
#include "OgreMaterialManager.h"
#include "OgreHardwarePixelBuffer.h"
Vector<std::pair<int, int> > CLightMap::m_SearchPattern;
int CLightMap::m_iLightMapCounter = 0;
CLightMap::CLightMap(SubEntity* pSubEntity, Real PixelsPerUnit, int iTexSize, bool bDebugLightmaps)
: m_pSubEntity(pSubEntity)
, m_iTexSize(iTexSize)
, m_iCoordSet(0)
, m_PixelsPerUnit(PixelsPerUnit)
, m_bDebugLightmaps(bDebugLightmaps)
{
if (m_SearchPattern.empty())
BuildSearchPattern();
m_LightMapName = "LightMap" + StringConverter::toString(m_iLightMapCounter++);
m_LightMap = new cimg_library::CImg<unsigned char>();
CalculateLightMap();
AssignMaterial();
}
CLightMap::~CLightMap(void)
{
// PROBLEM: THIS CAUSES CRASHES, FIND OUT WHY AND PUT IT BACK
/* if (!m_Material.isNull())
{
MaterialManager::getSingleton().remove((ResourcePtr)m_Material);
m_Material.setNull();
}*/
if (!m_Texture.isNull())
{
TextureManager::getSingleton().remove((ResourcePtr)m_Texture);
m_Texture.setNull();
}
}
void CLightMap::ResetCounter()
{
m_iLightMapCounter = 0;
}
void CLightMap::loadResource(Resource *resource)
{
Texture* texture = (Texture*)resource;
// Get the pixel buffer
HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
// Lock the pixel buffer and get a pixel box
pixelBuffer->lock(HardwareBuffer::HBL_DISCARD); // for best performance use HBL_DISCARD!
const PixelBox &pixelBox = pixelBuffer->getCurrentLock();
uint8* data = static_cast<uint8*>(pixelBox.data);
assert(pixelBox.getWidth() == pixelBox.getHeight());
const int iTexSize = (int)pixelBox.getWidth();
const int iRowPitch = (int)pixelBox.rowPitch;
int i, j;
for (j = 0; j < iTexSize; j++)
{
for(i = 0; i < iTexSize; i++)
{
data[iRowPitch*j + i] = (*m_LightMap)(i, j);
}
}
// Unlock the pixel buffer
pixelBuffer->unlock();
}
String CLightMap::GetName()
{
return m_LightMapName;
}
Vector3 CLightMap::GetBarycentricCoordinates(const Vector2 &P1, const Vector2 &P2, const Vector2 &P3, const Vector2 &P)
{
Vector3 Coordinates(0.0);
Real denom = (-P1.x * P3.y - P2.x * P1.y + P2.x * P3.y + P1.y * P3.x + P2.y * P1.x - P2.y * P3.x);
if (fabs(denom) >= 1e-6)
{
Coordinates.x = (P2.x * P3.y - P2.y * P3.x - P.x * P3.y + P3.x * P.y - P2.x * P.y + P2.y * P.x) / denom;
Coordinates.y = -(-P1.x * P.y + P1.x * P3.y + P1.y * P.x - P.x * P3.y + P3.x * P.y - P1.y * P3.x) / denom;
// Coordinates.z = (-P1.x * P.y + P2.y * P1.x + P2.x * P.y - P2.x * P1.y - P2.y * P.x + P1.y * P.x) / denom;
}
Coordinates.z = 1 - Coordinates.x - Coordinates.y;
return Coordinates;
}
Real CLightMap::GetTriangleArea(const Vector3 &P1, const Vector3 &P2, const Vector3 &P3)
{
return 0.5*(P2-P1).crossProduct(P3-P1).length();
}
bool CLightMap::CalculateLightMap()
{
// Reset the lightmap to all 0's
if (m_LightMap)
m_LightMap->fill(0);
// Get the submesh
SubMesh* submesh = m_pSubEntity->getSubMesh();
Matrix4 WorldTransform;
m_pSubEntity->getWorldTransforms(&WorldTransform);
// Get vertex positions
Vector<Vector3> MeshVertices;
{
VertexData* vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
const VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
float* pReal;
MeshVertices.resize(vertex_data->vertexCount);
for (size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
{
posElem->baseVertexPointerToElement(vertex, &pReal);
MeshVertices[j] = WorldTransform*Vector3(pReal[0],pReal[1],pReal[2]);
}
vbuf->unlock();
}
// Get vertex normals
Quaternion Rotation = WorldTransform.extractQuaternion();
Vector<Vector3> MeshNormals;
{
VertexData* vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
const VertexElement* normalElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_NORMAL);
HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(normalElem->getSource());
unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
float* pReal;
MeshNormals.resize(vertex_data->vertexCount);
for (size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
{
normalElem->baseVertexPointerToElement(vertex, &pReal);
MeshNormals[j] = Rotation*Vector3(pReal[0],pReal[1],pReal[2]);
}
vbuf->unlock();
}
// Get vertex UV coordinates
Vector<Vector2> MeshTextureCoords;
{
VertexData* vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
// Get last set of texture coordinates
int i = 0;
const VertexElement* texcoordElem;
const VertexElement* pCurrentElement = NULL;
do
{
texcoordElem = pCurrentElement;
pCurrentElement = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES, i++);
} while (pCurrentElement);
m_iCoordSet = i-2;
if (!texcoordElem)
return false;
HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(texcoordElem->getSource());
unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
float* pReal;
MeshTextureCoords.resize(vertex_data->vertexCount);
for (size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
{
texcoordElem->baseVertexPointerToElement(vertex, &pReal);
MeshTextureCoords[j] = Vector2(pReal[0], pReal[1]);
}
vbuf->unlock();
}
IndexData* index_data = submesh->indexData;
size_t numTris = index_data->indexCount / 3;
HardwareIndexBufferSharedPtr ibuf = index_data->indexBuffer;
bool use32bitindexes = (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT);
unsigned int Indices[3];
void* pBuffer = ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY);
// Calculate the lightmap texture size
if (m_PixelsPerUnit && m_Texture.isNull())
{
Real SurfaceArea = 0;
for ( size_t k = 0; k < numTris*3; k+=3)
{
for (int i=0; i<3; ++i)
{
if (use32bitindexes)
Indices[i] = ((unsigned int*)pBuffer)[k+i];
else
Indices[i] = ((unsigned short*)pBuffer)[k+i];
}
SurfaceArea += GetTriangleArea(MeshVertices[Indices[0]], MeshVertices[Indices[1]], MeshVertices[Indices[2]]);
}
Real TexSize = Math::Sqrt(SurfaceArea)*m_PixelsPerUnit;
int iTexSize = 1;
while (iTexSize < TexSize)
iTexSize *= 2;
m_iTexSize = iTexSize;
}
// Create the texture with the new size
CreateTexture();
// Fill in the lightmap
for ( size_t k = 0; k < numTris*3; k+=3)
{
for (int i=0; i<3; ++i)
{
if (use32bitindexes)
Indices[i] = ((unsigned int*)pBuffer)[k+i];
else
Indices[i] = ((unsigned short*)pBuffer)[k+i];
}
LightTriangle(MeshVertices[Indices[0]], MeshVertices[Indices[1]], MeshVertices[Indices[2]],
MeshNormals[Indices[0]], MeshNormals[Indices[1]], MeshNormals[Indices[2]],
MeshTextureCoords[Indices[0]], MeshTextureCoords[Indices[1]], MeshTextureCoords[Indices[2]]);
}
ibuf->unlock();
FillInvalidPixels();
m_LightMap->blur(1.0);
return true;
}
void CLightMap::CreateTexture()
{
if (!m_Texture.isNull())
return;
CORE_DELETE(m_LightMap);
m_LightMap = new cimg_library::CImg<unsigned char>(m_iTexSize, m_iTexSize, 1, 2, 0);
if (TextureManager::getSingleton().resourceExists(m_LightMapName))
TextureManager::getSingleton().remove(m_LightMapName);
// Create the texture
m_Texture = TextureManager::getSingleton().createManual(
m_LightMapName, // name
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D, // type
m_iTexSize, m_iTexSize, // width & height
-1, // number of mipmaps
PF_L8, // pixel format
TU_DEFAULT,
this);
}
void CLightMap::AssignMaterial()
{
if (!m_Material.isNull())
return;
if (MaterialManager::getSingleton().resourceExists(m_LightMapName))
MaterialManager::getSingleton().remove(m_LightMapName);
if (m_bDebugLightmaps)
{
m_Material = MaterialManager::getSingleton().create(m_LightMapName, StringUtil::BLANK, true);
}
else
{
MaterialPtr PrevMaterial = m_pSubEntity->getMaterial();
m_Material = PrevMaterial->clone(m_LightMapName);
}
Pass* pPass = m_Material->getTechnique(0)->getPass(0);
pPass->setLightingEnabled(false);
TextureUnitState* pTextureUnitState = pPass->createTextureUnitState(m_Texture->getName(), m_iCoordSet);
pTextureUnitState->setColourOperation(LBO_MODULATE);
pTextureUnitState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
m_pSubEntity->setMaterialName(m_LightMapName);
}
void CLightMap::FillInvalidPixels()
{
int i, j;
int x, y;
Vector<std::pair<int, int>>::iterator itSearchPattern;
for (i=0; i<m_iTexSize; ++i)
{
for (j=0; j<m_iTexSize; ++j)
{
// Invalid pixel found
if ((*m_LightMap)(i, j, 0, 1) == 0)
{
for (itSearchPattern = m_SearchPattern.begin(); itSearchPattern != m_SearchPattern.end(); ++itSearchPattern)
{
x = i+itSearchPattern->first;
y = j+itSearchPattern->second;
if (x < 0 || x >= m_iTexSize)
continue;
if (y < 0 || y >= m_iTexSize)
continue;
// If search pixel is valid assign it to the invalid pixel and stop searching
if ((*m_LightMap)(x, y, 0, 1) == 1)
{
(*m_LightMap)(i, j) = (*m_LightMap)(x, y);
break;
}
}
}
}
}
}
void CLightMap::BuildSearchPattern()
{
m_SearchPattern.clear();
const int iSize = 5;
int i, j;
for (i=-iSize; i<=iSize; ++i)
{
for (j=-iSize; j<=iSize; ++j)
{
if (i==0 && j==0)
continue;
m_SearchPattern.push_back(std::make_pair(i, j));
}
}
sort(m_SearchPattern.begin(), m_SearchPattern.end(), SortCoordsByDistance());
}
void CLightMap::LightTriangle(const Vector3 &P1, const Vector3 &P2, const Vector3 &P3,
const Vector3 &N1, const Vector3 &N2, const Vector3 &N3,
const Vector2 &T1, const Vector2 &T2, const Vector2 &T3)
{
Vector2 TMin = T1, TMax = T1;
TMin.makeFloor(T2);
TMin.makeFloor(T3);
TMax.makeCeil(T2);
TMax.makeCeil(T3);
int iMinX = GetPixelCoordinate(TMin.x);
int iMinY = GetPixelCoordinate(TMin.y);
int iMaxX = GetPixelCoordinate(TMax.x);
int iMaxY = GetPixelCoordinate(TMax.y);
int i, j;
Vector2 TextureCoord;
Vector3 BarycentricCoords;
Vector3 Pos;
Vector3 Normal;
for (i=iMinX; i<=iMaxX; ++i)
{
for (j=iMinY; j<=iMaxY; ++j)
{
TextureCoord.x = GetTextureCoordinate(i);
TextureCoord.y = GetTextureCoordinate(j);
BarycentricCoords = GetBarycentricCoordinates(T1, T2, T3, TextureCoord);
Pos = BarycentricCoords.x * P1 + BarycentricCoords.y * P2 + BarycentricCoords.z * P3;
Normal = BarycentricCoords.x * N1 + BarycentricCoords.y * N2 + BarycentricCoords.z * N3;
Normal.normalise();
if ((*m_LightMap)(i, j, 0, 1) == 1 || BarycentricCoords.x < 0 || BarycentricCoords.y < 0 || BarycentricCoords.z < 0)
continue;
(*m_LightMap)(i, j) = GetLightIntensity(Pos, Normal);
(*m_LightMap)(i, j, 0, 1) = 1;
}
}
}
/*
This is the only function which you should need to modify. Basically given the position coordinate
and the surface normal at that point, you should return the light intensity value as a number between
0 and 255. In this example I use the PhysX library to cast a ray in a fixed direction to see if it
intersects with any other objects in the scene, if it does then this point is in the shade.
*/
uint8 CLightMap::GetLightIntensity(const Vector3 &Position, const Vector3 &Normal)
{
const Real Tolerance = 1e-3;
const Real Distance = 100;
const uint8 AmbientValue = 1;
const uint8 MaxValue = 255;
Vector3 LightDirection(0, 100, 0);
LightDirection.normalise();
Real Intensity = -LightDirection.dotProduct(Normal);
if (Intensity < 0)
return AmbientValue;
uint8 LightValue = AmbientValue+Intensity*(MaxValue-AmbientValue);
Vector3 Origin = Position-Distance*LightDirection;
auto strat = Core::Physics::CPhysicsManager::Instance()->GetStrategy();
Core::Physics::SPhysicsRayCastReport report;
strat->RaycastClosestShape(Origin, LightDirection, report);
if(report.Data)
{
return AmbientValue;
}
else
{
strat->RaycastClosestShape(Position, -LightDirection, report);
if(report.Data)
{
return AmbientValue;
}
return LightValue;
}
//NxRay Ray;
//NxRaycastHit RayHit;
//Ray.orig = Convert(Origin);
//Ray.dir = Convert(LightDirection);
//bool bHit = PHYSICS->GetNxScene()->raycastAnyShape(Ray, NX_ALL_SHAPES, (1<<GROUP_WORLD), Distance-Tolerance);
//if (bHit)
//{
// return AmbientValue;
//}
//else
//{
// // Cast the ray back the other way also to be sure that we can see the light
// Ray.orig = Convert(Position);
// Ray.dir = Convert(-LightDirection);
// bHit = PHYSICS->GetNxScene()->raycastAnyShape(Ray, NX_ALL_SHAPES, (1<<GROUP_WORLD));
// if (bHit)
// return AmbientValue;
// else
// return LightValue;
//}
}
#endif | 33.166302 | 128 | 0.619978 | [
"vector"
] |
5aeeb1231917bcffb7a5e742ab24cabddcb11ae4 | 1,788 | hpp | C++ | libs/scenic/include/sge/scenic/render_context/light/object.hpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 2 | 2016-01-27T13:18:14.000Z | 2018-05-11T01:11:32.000Z | libs/scenic/include/sge/scenic/render_context/light/object.hpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | null | null | null | libs/scenic/include/sge/scenic/render_context/light/object.hpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 3 | 2018-05-11T01:11:34.000Z | 2021-04-24T19:47:45.000Z | // Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SGE_SCENIC_RENDER_CONTEXT_LIGHT_OBJECT_HPP_INCLUDED
#define SGE_SCENIC_RENDER_CONTEXT_LIGHT_OBJECT_HPP_INCLUDED
#include <sge/image/color/any/object.hpp>
#include <sge/scenic/detail/symbol.hpp>
#include <sge/scenic/render_context/ambient_color.hpp>
#include <sge/scenic/render_context/diffuse_color.hpp>
#include <sge/scenic/render_context/specular_color.hpp>
#include <sge/scenic/render_context/light/object_fwd.hpp>
#include <sge/scenic/render_context/light/variant.hpp>
#include <fcppt/variant/object_impl.hpp>
namespace sge::scenic::render_context::light
{
class object
{
public:
SGE_SCENIC_DETAIL_SYMBOL
object(
sge::scenic::render_context::diffuse_color,
sge::scenic::render_context::specular_color,
sge::scenic::render_context::ambient_color,
sge::scenic::render_context::light::variant);
[[nodiscard]] SGE_SCENIC_DETAIL_SYMBOL sge::scenic::render_context::diffuse_color const &
diffuse_color() const;
[[nodiscard]] SGE_SCENIC_DETAIL_SYMBOL sge::scenic::render_context::specular_color const &
specular_color() const;
[[nodiscard]] SGE_SCENIC_DETAIL_SYMBOL sge::scenic::render_context::ambient_color const &
ambient_color() const;
[[nodiscard]] SGE_SCENIC_DETAIL_SYMBOL sge::scenic::render_context::light::variant const &
variant() const;
private:
sge::scenic::render_context::diffuse_color diffuse_color_;
sge::scenic::render_context::specular_color specular_color_;
sge::scenic::render_context::ambient_color ambient_color_;
sge::scenic::render_context::light::variant variant_;
};
}
#endif
| 35.058824 | 92 | 0.776846 | [
"object"
] |
5afcea06117dfec96a57ca86e2b6f2c3c615677a | 4,953 | cpp | C++ | Libraries/RobsJuceModules/rapt/Generators/VariousOscillators.cpp | RobinSchmidt/RS-MET-Preliminary | 6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe | [
"FTL"
] | 34 | 2017-04-19T18:26:02.000Z | 2022-02-15T17:47:26.000Z | Libraries/RobsJuceModules/rapt/Generators/VariousOscillators.cpp | RobinSchmidt/RS-MET-Preliminary | 6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe | [
"FTL"
] | 307 | 2017-05-04T21:45:01.000Z | 2022-02-03T00:59:01.000Z | Libraries/RobsJuceModules/rapt/Generators/VariousOscillators.cpp | RobinSchmidt/RS-MET-Preliminary | 6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe | [
"FTL"
] | 4 | 2017-09-05T17:04:31.000Z | 2021-12-15T21:24:28.000Z |
template<class T>
void rsTriSawOscillator<T>::updateTriSawCoeffs()
{
//// range variables - make settable members later:
//T min = -1;
//T max = +1;
//// hmm...but actually we need them to be -1 and 1 because the waveshaping expects its input in
//// this range - if the range should really be different we may scale/shift as last step...
//// coeffs:
//a0 = min;
//a1 = (max-a0) / h;
//b0 = (max-h*min) / (1-h);
//b1 = min-b0;
// simpler:
a0 = -1;
a1 = 2 / h;
b0 = (1+h)/(1-h);
b1 = -1-b0;
// todo: we need to catch cases when h = 0 or 1-h = 0
// if(h < eps)
// a1 = 0;
// if(1-h < eps)
// b1 = 0;
// or something
}
// for shapes, see:
// rational: https://www.desmos.com/calculator/ql1hh1byy5 (a*x+x)/(2*a*x-a+1)
// exponential: https://www.desmos.com/calculator/vtymebgkrr (1-exp(a*x))/(1-exp(a))
// sinh(a*x)/sinh(a), tanh(a*x)/tanh(a)
// maybe try something based on:
// (a*exp(x) + b*exp(-x) + p) / (c*exp(x) + d*exp(-x) + q)
// tanh: a=1,b=-1,p=0,c=1,d=0,q=0
// sinh:
// exp:
// logistic: 1/(1+exp(-x))
// weirdo: tanh(a*x)/(1+exp(-x))
// maybe have a look at these:
// https://en.wikipedia.org/wiki/Gompertz_function
// https://en.wikipedia.org/wiki/Generalised_logistic_function
// or try: f(x) = (a*x + b) / (c*x + d) and to keep equations simple, consider the range -1..+1 and
// require f(-1) = -1, f(+1) = +1, f(0) = p, f'(0) = s where p and s are adjustable parameters, p
// corresponds roughly to "a" in the rational formula (can we make it, such that when s=0, it
// reduces to the old formula?)
// ...but playing with the parameters, it doesn't seem to be capabable of a sigmoid shape
// anyway: f(1)=1 -> a+b = c+d, f(-1) = -1 -> c-d = b-a, f(0) = p -> d*p = b
// f'(x) = (a*d-b*c) / (c*x+d)^2, f'(0) = (a*d-b*c)/d^2
// f'(0) = s ->
// maybe try f(x) = (a*x + b*x^3) / (c*x + d) this seems to be able to do sigmoids
// http://www.wolframalpha.com/input/?i=(a*x+%2B+b*x%5E3)+%2F+(c*x+%2B+d)
// f'(x) = (a*d+b*x^2*(2*c*x+3*d)) / (c*x+d)^2
// f'(0) = a*d/d^2 = s
// f(0) = 0 ...damn - we loose the ability to adjust the y-value at the midpoint - we need both
// how about f(x) = (a0 + a1*x + a3*x^3) / (b0 + b1*x)
// should allow to adjust both...maybe also try an a2*x^2 term insead of a3*x^3 ...or maybe both?
// or maybe try a 2nd order denominator, too - maybe a general biquadratic formula?
// looks like it's flexible enough: https://www.desmos.com/calculator/4dxeptvth3
// question would be, how convenient it is to control
// http://www.wolframalpha.com/input/?i=(a+%2B+b+x+%2B+c+x%5E2)+%2F+(p+%2B+q+x+%2B+r+x%5E2)
/*
for the biquadratic formula, giving this to sage:
var("x a b c p q r s t")
f(x) = (a + b*x + c*x^2) / (p + q*x + r*x^2)
fp(x) = diff(f(x), x)
e1 = f(-1) == -1
e2 = f( 1) == 1
e3 = f( 0) == t
e4 = fp(0) == s
solve([e1,e2,e3,e4],[a,b,c,p,q,r])
simplified:
var("a b c p q r s t")
e1 = a+b+c == p+q+r
e2 = a-b+c == q-p-r
e3 = t == a/p
e4 = s == (b*p-a*q)/p^2
solve([e1,e2,e3,e4],[a,b,c,p,q,r])
..yep, gives the same result
// first solution has 2 params and looks like this:
https://www.desmos.com/calculator/tv3w6uquxr
// not useful
// write rational map as ((T+1)x)/(2*T*x-T+1): https://www.desmos.com/calculator/lybdjuzzln
// where T is the "tension" in -1..+1 - we see that when the sigmodity S is zero, we need to have
// a=0, b=(T+1), c=0, p=1-T, q=2*T, r=0
//...ahh...but we need to re-derive it so the function is the range -1..+1, not 0..1
produces a solution that contains new variables r1,r2,r3,r4 - what are they? roots?
but of which equation? probably a quartic because there are 4 roots? here is a simpler example in
which just r1 occurs
var("x a b c d s")
f(x) = a + b*x + c*x^3 + d*x^5
fp(x) = diff(f(x), x)
e1 = f(-1) == -1
e2 = f( 1) == 1
e3 = f( 0) == 0
e4 = fp(0) == s
solve([e1,e2,e3,e4],[a,b,c,d])
oh - no - here (just below the center)
http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/relation.html
it says:
If there is a parameter in the answer, that will show up as a new variable. In the following
example, r1 is a real free variable (because of the r):
sage: forget()
sage: x, y = var('x,y')
sage: solve([x+y == 3, 2*x+2*y == 6],x,y)
[[x == -r1 + 3, y == r1]]
Especially with trigonometric functions, the dummy variable may be implicitly an integer
(hence the z):
or maybe compose y = g(x) = (1-t)*x + t*x^3 with h(y) = (a*y + b)/(c*y + d)
the first function gives the s-shape, the 2nd the tension
use h(y) = (y+p)/(p*y+1) where -1 < p < +1 is the parameter
var("a b c d x p")
f(x) = (a*x + b) / (c*x + d)
e1 = f(1) == 1
e2 = f(-1) == -1
e3 = f(0) == p
solve([e1,e2,e3],[a,b,c])
maybe use clip(x / (1-s), -1, +1) where s is a "squarishness" parameter. when 1, the denominator is
0, so the output just alternates between -1 and +1 according to the numerator, so that would give a
square wave (or general pulse-wave, if h is != 0.5) - adds another degree of flexibility
*/ | 33.241611 | 100 | 0.59782 | [
"shape"
] |
5afeb30bd545e715484904a8d4ca55af6ee6188c | 4,357 | cpp | C++ | VkCommandBufferBeginInfo.cpp | blockchainhelppro/Segwit-Development- | e4dfe990a69a2a1fcdd902b82121c2ecb1aa332d | [
"MIT"
] | null | null | null | VkCommandBufferBeginInfo.cpp | blockchainhelppro/Segwit-Development- | e4dfe990a69a2a1fcdd902b82121c2ecb1aa332d | [
"MIT"
] | null | null | null | VkCommandBufferBeginInfo.cpp | blockchainhelppro/Segwit-Development- | e4dfe990a69a2a1fcdd902b82121c2ecb1aa332d | [
"MIT"
] | null | null | null | /*
* MACHINE GENERATED, DO NOT EDIT
* GENERATED BY node-vulkan v0.0.1
*/
#include "utils.h"
#include "index.h"
#include "VkCommandBufferBeginInfo.h"
Nan::Persistent<v8::FunctionTemplate> _VkCommandBufferBeginInfo::constructor;
_VkCommandBufferBeginInfo::_VkCommandBufferBeginInfo() {
instance.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
}
_VkCommandBufferBeginInfo::~_VkCommandBufferBeginInfo() {
//printf("VkCommandBufferBeginInfo deconstructed!!\n");
}
void _VkCommandBufferBeginInfo::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) {
Nan::HandleScope scope;
// constructor
v8::Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(_VkCommandBufferBeginInfo::New);
constructor.Reset(ctor);
ctor->InstanceTemplate()->SetInternalFieldCount(1);
ctor->SetClassName(Nan::New("VkCommandBufferBeginInfo").ToLocalChecked());
// prototype
v8::Local<v8::ObjectTemplate> proto = ctor->PrototypeTemplate();
SetPrototypeAccessor(proto, Nan::New("sType").ToLocalChecked(), GetsType, SetsType, ctor);
SetPrototypeAccessor(proto, Nan::New("flags").ToLocalChecked(), Getflags, Setflags, ctor);
SetPrototypeAccessor(proto, Nan::New("pInheritanceInfo").ToLocalChecked(), GetpInheritanceInfo, SetpInheritanceInfo, ctor);
Nan::Set(target, Nan::New("VkCommandBufferBeginInfo").ToLocalChecked(), ctor->GetFunction());
}
NAN_METHOD(_VkCommandBufferBeginInfo::New) {
if (info.IsConstructCall()) {
_VkCommandBufferBeginInfo* self = new _VkCommandBufferBeginInfo();
self->Wrap(info.Holder());
if (info[0]->IsObject()) {
v8::Local<v8::Object> obj = info[0]->ToObject();
v8::Local<v8::String> sAccess0 = Nan::New("sType").ToLocalChecked();
v8::Local<v8::String> sAccess2 = Nan::New("flags").ToLocalChecked();
v8::Local<v8::String> sAccess3 = Nan::New("pInheritanceInfo").ToLocalChecked();
if (obj->Has(sAccess0)) info.This()->Set(sAccess0, obj->Get(sAccess0));
if (obj->Has(sAccess2)) info.This()->Set(sAccess2, obj->Get(sAccess2));
if (obj->Has(sAccess3)) info.This()->Set(sAccess3, obj->Get(sAccess3));
}
info.GetReturnValue().Set(info.Holder());
} else {
Nan::ThrowError("VkCommandBufferBeginInfo constructor cannot be invoked without 'new'");
}
};
// sType
NAN_GETTER(_VkCommandBufferBeginInfo::GetsType) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
info.GetReturnValue().Set(Nan::New<v8::Number>(self->instance.sType));
}NAN_SETTER(_VkCommandBufferBeginInfo::SetsType) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
self->instance.sType = static_cast<VkStructureType>((int32_t)value->NumberValue());
}// flags
NAN_GETTER(_VkCommandBufferBeginInfo::Getflags) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
info.GetReturnValue().Set(Nan::New<v8::Number>(self->instance.flags));
}NAN_SETTER(_VkCommandBufferBeginInfo::Setflags) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
self->instance.flags = static_cast<VkCommandBufferUsageFlags>((int32_t)value->NumberValue());
}// pInheritanceInfo
NAN_GETTER(_VkCommandBufferBeginInfo::GetpInheritanceInfo) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
if (self->pInheritanceInfo.IsEmpty()) {
info.GetReturnValue().SetNull();
} else {
v8::Local<v8::Object> obj = Nan::New(self->pInheritanceInfo);
info.GetReturnValue().Set(obj);
}
}NAN_SETTER(_VkCommandBufferBeginInfo::SetpInheritanceInfo) {
_VkCommandBufferBeginInfo *self = Nan::ObjectWrap::Unwrap<_VkCommandBufferBeginInfo>(info.This());
// js
if (!(value->IsNull())) {
Nan::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object>> obj(value->ToObject());
self->pInheritanceInfo = obj;
} else {
//self->pInheritanceInfo = Nan::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object>>(Nan::Null());
}
// vulkan
if (!(value->IsNull())) {
_VkCommandBufferInheritanceInfo* obj = Nan::ObjectWrap::Unwrap<_VkCommandBufferInheritanceInfo>(value->ToObject());
self->instance.pInheritanceInfo = &obj->instance;
} else {
self->instance.pInheritanceInfo = nullptr;
}
} | 44.459184 | 125 | 0.735368 | [
"object"
] |
5aff2a1dd1f5bdd0e2206cac11d51c3476367076 | 956 | cpp | C++ | LeetCode/1476_Subrectangle_Queries/main.cpp | sungmen/Acmicpc_Solve | 0298a6aec84993a4d8767bd2c00490b7201e06a4 | [
"MIT"
] | 1 | 2020-07-08T23:16:19.000Z | 2020-07-08T23:16:19.000Z | LeetCode/1476_Subrectangle_Queries/main.cpp | sungmen/Acmicpc_Solve | 0298a6aec84993a4d8767bd2c00490b7201e06a4 | [
"MIT"
] | 1 | 2020-05-16T03:12:24.000Z | 2020-05-16T03:14:42.000Z | LeetCode/1476_Subrectangle_Queries/main.cpp | sungmen/Acmicpc_Solve | 0298a6aec84993a4d8767bd2c00490b7201e06a4 | [
"MIT"
] | 2 | 2020-05-16T03:25:16.000Z | 2021-02-10T16:51:25.000Z | /**
* Runtime: 44 ms, faster than 77.36% of C++ online submissions for Subrectangle Queries.
* Memory Usage: 18.6 MB, less than 60.12% of C++ online submissions for Subrectangle Queries.
*/
class SubrectangleQueries {
public:
vector<vector<int>> rectangle;
SubrectangleQueries(vector<vector<int>>& rectangle) {
this->rectangle = rectangle;
}
void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) {
for (int i = row1; i <= row2; i++) {
for (int j = col1; j <= col2; j++) {
rectangle[i][j] = newValue;
}
}
}
int getValue(int row, int col) {
return rectangle[row][col];
}
};
/**
* Your SubrectangleQueries object will be instantiated and called as such:
* SubrectangleQueries* obj = new SubrectangleQueries(rectangle);
* obj->updateSubrectangle(row1,col1,row2,col2,newValue);
* int param_2 = obj->getValue(row,col);
*/ | 30.83871 | 93 | 0.628661 | [
"object",
"vector"
] |
5affcef8a053543b0f0eb273ddfc8c388797e40c | 76,350 | cpp | C++ | HoloLens/MyBuild/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs8.cpp | gianluca-m/SeeingTemperature | 743e10e75ce0aeaea580c022f24cbe3605c029c2 | [
"Apache-2.0"
] | 1 | 2022-01-17T10:26:15.000Z | 2022-01-17T10:26:15.000Z | HoloLens/MyBuild/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs8.cpp | gianluca-m/SeeingTemperature | 743e10e75ce0aeaea580c022f24cbe3605c029c2 | [
"Apache-2.0"
] | null | null | null | HoloLens/MyBuild/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs8.cpp | gianluca-m/SeeingTemperature | 743e10e75ce0aeaea580c022f24cbe3605c029c2 | [
"Apache-2.0"
] | null | null | null | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <limits>
#include "vm/CachedCCWBase.h"
#include "utils/New.h"
// System.Collections.Generic.IEqualityComparer`1<System.Xml.IDtdEntityInfo>
struct IEqualityComparer_1_t7F8A06A807BFE349DA2C13A6A162AB2F70D89A0F;
// System.Collections.Generic.IEqualityComparer`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController>
struct IEqualityComparer_1_t8F8FE4B8B32C4F9D0137948EF7ADB40453C220E5;
// System.Collections.Generic.IEqualityComparer`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource>
struct IEqualityComparer_1_t147C0C4232C76410CDFAF69263876AFD737E1B70;
// System.Collections.Generic.IEqualityComparer`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>
struct IEqualityComparer_1_t7C98795A85A0B5FE42CAACDDE6038FA65747C573;
// System.Collections.Generic.IEqualityComparer`1<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar>
struct IEqualityComparer_1_tE46035AAC76BA720D1A89BA347D4784F56AA3742;
// System.Collections.Generic.IEqualityComparer`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider>
struct IEqualityComparer_1_tC0D888571FD88F7560B64E7D94B23DE0A4909406;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.IDtdEntityInfo,System.Xml.IDtdEntityInfo>
struct KeyCollection_t8CC149C3284302B1A86AB9522AF8DB78230B968F;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController,UnityEngine.Vector3>
struct KeyCollection_t7B882A0C51B5BB5C389A898375DC1D69F43A99E4;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,System.Collections.Generic.HashSet`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>>
struct KeyCollection_t982C96C45B0A85CA039BF1DBA996E5D8C77C05FD;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,System.UInt32>
struct KeyCollection_t08FB15848C72158E7EFAE7FDBFA24151D81ED65A;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.DefaultPrimaryPointerSelector/PointerInfo>
struct KeyCollection_tA8EFB0CCC0233DB1258543EDAD415CD45EA204BF;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.IMixedRealityService>>
struct KeyCollection_tD2C2B76D510C8C369521DADDA1DC6DD3091FAAE1;
// System.Collections.Generic.Dictionary`2/KeyCollection<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.ProximityEffect/ObjectProximityInfo>>
struct KeyCollection_tA98DA0EED72BF3C97C33FCD0D0916BDB5858288D;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.IDtdEntityInfo,System.Xml.IDtdEntityInfo>
struct ValueCollection_t9474AF8AEE4B46B1D7C906AB5B4F5B33CCD68AF7;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController,UnityEngine.Vector3>
struct ValueCollection_t6D4C22E70A1DD2B4CEEBD4FB1F2AB69F9ED23435;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,System.Collections.Generic.HashSet`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>>
struct ValueCollection_tC13782C62C4BDFEF1A693D682CE9D344EF1B3A43;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,System.UInt32>
struct ValueCollection_tB84AC58E4E3E46A5F2DAF2F327D76C855B36CF2D;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.DefaultPrimaryPointerSelector/PointerInfo>
struct ValueCollection_t8646999BF5C2C7B0C090BE920E0ABB86AAE9F3FA;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.IMixedRealityService>>
struct ValueCollection_tD02DE40DFCFF75C511DE5162288DA96BB1759FAA;
// System.Collections.Generic.Dictionary`2/ValueCollection<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.ProximityEffect/ObjectProximityInfo>>
struct ValueCollection_t4D2EBB23C71878C1CFE5B282B0097CAF000842D9;
// System.Collections.Generic.Dictionary`2/Entry<System.Xml.IDtdEntityInfo,System.Xml.IDtdEntityInfo>[]
struct EntryU5BU5D_t9914BA2B2EA1CF41CADF1A98271338ED58A193B3;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController,UnityEngine.Vector3>[]
struct EntryU5BU5D_t292D09E575CB25881C7EACB2B98838427F0F67C8;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,System.Collections.Generic.HashSet`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>>[]
struct EntryU5BU5D_tB7416522633FB1700F79F5337D48F0CDA7606B02;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,System.UInt32>[]
struct EntryU5BU5D_tADE8E51F38545ED5CFB7116DAA23F682A9DAFCE7;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.DefaultPrimaryPointerSelector/PointerInfo>[]
struct EntryU5BU5D_t596555795C77D9D5B9BC8FF3D46EDB432BB3E228;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.IMixedRealityService>>[]
struct EntryU5BU5D_tA9FC3CDE50FF260BE41BF24D64F7921D3EC8D4D4;
// System.Collections.Generic.Dictionary`2/Entry<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.ProximityEffect/ObjectProximityInfo>>[]
struct EntryU5BU5D_tD84099E3C7300EBB3B46F2D39BD60068446100D1;
// System.Int32[]
struct Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32;
// System.String
struct String_t;
struct IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Windows.UI.Xaml.Interop.IBindableIterable
struct NOVTABLE IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) = 0;
};
// System.Object
// System.Collections.Generic.Dictionary`2<System.Xml.IDtdEntityInfo,System.Xml.IDtdEntityInfo>
struct Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t9914BA2B2EA1CF41CADF1A98271338ED58A193B3* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t8CC149C3284302B1A86AB9522AF8DB78230B968F * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t9474AF8AEE4B46B1D7C906AB5B4F5B33CCD68AF7 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___entries_1)); }
inline EntryU5BU5D_t9914BA2B2EA1CF41CADF1A98271338ED58A193B3* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t9914BA2B2EA1CF41CADF1A98271338ED58A193B3** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t9914BA2B2EA1CF41CADF1A98271338ED58A193B3* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___keys_7)); }
inline KeyCollection_t8CC149C3284302B1A86AB9522AF8DB78230B968F * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t8CC149C3284302B1A86AB9522AF8DB78230B968F ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t8CC149C3284302B1A86AB9522AF8DB78230B968F * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ___values_8)); }
inline ValueCollection_t9474AF8AEE4B46B1D7C906AB5B4F5B33CCD68AF7 * get_values_8() const { return ___values_8; }
inline ValueCollection_t9474AF8AEE4B46B1D7C906AB5B4F5B33CCD68AF7 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t9474AF8AEE4B46B1D7C906AB5B4F5B33CCD68AF7 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController,UnityEngine.Vector3>
struct Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t292D09E575CB25881C7EACB2B98838427F0F67C8* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t7B882A0C51B5BB5C389A898375DC1D69F43A99E4 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t6D4C22E70A1DD2B4CEEBD4FB1F2AB69F9ED23435 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___entries_1)); }
inline EntryU5BU5D_t292D09E575CB25881C7EACB2B98838427F0F67C8* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t292D09E575CB25881C7EACB2B98838427F0F67C8** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t292D09E575CB25881C7EACB2B98838427F0F67C8* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___keys_7)); }
inline KeyCollection_t7B882A0C51B5BB5C389A898375DC1D69F43A99E4 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t7B882A0C51B5BB5C389A898375DC1D69F43A99E4 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t7B882A0C51B5BB5C389A898375DC1D69F43A99E4 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ___values_8)); }
inline ValueCollection_t6D4C22E70A1DD2B4CEEBD4FB1F2AB69F9ED23435 * get_values_8() const { return ___values_8; }
inline ValueCollection_t6D4C22E70A1DD2B4CEEBD4FB1F2AB69F9ED23435 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t6D4C22E70A1DD2B4CEEBD4FB1F2AB69F9ED23435 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,System.Collections.Generic.HashSet`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>>
struct Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tB7416522633FB1700F79F5337D48F0CDA7606B02* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t982C96C45B0A85CA039BF1DBA996E5D8C77C05FD * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tC13782C62C4BDFEF1A693D682CE9D344EF1B3A43 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___entries_1)); }
inline EntryU5BU5D_tB7416522633FB1700F79F5337D48F0CDA7606B02* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tB7416522633FB1700F79F5337D48F0CDA7606B02** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tB7416522633FB1700F79F5337D48F0CDA7606B02* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___keys_7)); }
inline KeyCollection_t982C96C45B0A85CA039BF1DBA996E5D8C77C05FD * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t982C96C45B0A85CA039BF1DBA996E5D8C77C05FD ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t982C96C45B0A85CA039BF1DBA996E5D8C77C05FD * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ___values_8)); }
inline ValueCollection_tC13782C62C4BDFEF1A693D682CE9D344EF1B3A43 * get_values_8() const { return ___values_8; }
inline ValueCollection_tC13782C62C4BDFEF1A693D682CE9D344EF1B3A43 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tC13782C62C4BDFEF1A693D682CE9D344EF1B3A43 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,System.UInt32>
struct Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tADE8E51F38545ED5CFB7116DAA23F682A9DAFCE7* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t08FB15848C72158E7EFAE7FDBFA24151D81ED65A * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tB84AC58E4E3E46A5F2DAF2F327D76C855B36CF2D * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___entries_1)); }
inline EntryU5BU5D_tADE8E51F38545ED5CFB7116DAA23F682A9DAFCE7* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tADE8E51F38545ED5CFB7116DAA23F682A9DAFCE7** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tADE8E51F38545ED5CFB7116DAA23F682A9DAFCE7* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___keys_7)); }
inline KeyCollection_t08FB15848C72158E7EFAE7FDBFA24151D81ED65A * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t08FB15848C72158E7EFAE7FDBFA24151D81ED65A ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t08FB15848C72158E7EFAE7FDBFA24151D81ED65A * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ___values_8)); }
inline ValueCollection_tB84AC58E4E3E46A5F2DAF2F327D76C855B36CF2D * get_values_8() const { return ___values_8; }
inline ValueCollection_tB84AC58E4E3E46A5F2DAF2F327D76C855B36CF2D ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tB84AC58E4E3E46A5F2DAF2F327D76C855B36CF2D * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.DefaultPrimaryPointerSelector/PointerInfo>
struct Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t596555795C77D9D5B9BC8FF3D46EDB432BB3E228* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tA8EFB0CCC0233DB1258543EDAD415CD45EA204BF * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t8646999BF5C2C7B0C090BE920E0ABB86AAE9F3FA * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___entries_1)); }
inline EntryU5BU5D_t596555795C77D9D5B9BC8FF3D46EDB432BB3E228* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t596555795C77D9D5B9BC8FF3D46EDB432BB3E228** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t596555795C77D9D5B9BC8FF3D46EDB432BB3E228* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___keys_7)); }
inline KeyCollection_tA8EFB0CCC0233DB1258543EDAD415CD45EA204BF * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tA8EFB0CCC0233DB1258543EDAD415CD45EA204BF ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tA8EFB0CCC0233DB1258543EDAD415CD45EA204BF * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ___values_8)); }
inline ValueCollection_t8646999BF5C2C7B0C090BE920E0ABB86AAE9F3FA * get_values_8() const { return ___values_8; }
inline ValueCollection_t8646999BF5C2C7B0C090BE920E0ABB86AAE9F3FA ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t8646999BF5C2C7B0C090BE920E0ABB86AAE9F3FA * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.IMixedRealityService>>
struct Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tA9FC3CDE50FF260BE41BF24D64F7921D3EC8D4D4* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tD2C2B76D510C8C369521DADDA1DC6DD3091FAAE1 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tD02DE40DFCFF75C511DE5162288DA96BB1759FAA * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___entries_1)); }
inline EntryU5BU5D_tA9FC3CDE50FF260BE41BF24D64F7921D3EC8D4D4* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tA9FC3CDE50FF260BE41BF24D64F7921D3EC8D4D4** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tA9FC3CDE50FF260BE41BF24D64F7921D3EC8D4D4* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___keys_7)); }
inline KeyCollection_tD2C2B76D510C8C369521DADDA1DC6DD3091FAAE1 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tD2C2B76D510C8C369521DADDA1DC6DD3091FAAE1 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tD2C2B76D510C8C369521DADDA1DC6DD3091FAAE1 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ___values_8)); }
inline ValueCollection_tD02DE40DFCFF75C511DE5162288DA96BB1759FAA * get_values_8() const { return ___values_8; }
inline ValueCollection_tD02DE40DFCFF75C511DE5162288DA96BB1759FAA ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tD02DE40DFCFF75C511DE5162288DA96BB1759FAA * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.ProximityEffect/ObjectProximityInfo>>
struct Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tD84099E3C7300EBB3B46F2D39BD60068446100D1* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tA98DA0EED72BF3C97C33FCD0D0916BDB5858288D * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t4D2EBB23C71878C1CFE5B282B0097CAF000842D9 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___entries_1)); }
inline EntryU5BU5D_tD84099E3C7300EBB3B46F2D39BD60068446100D1* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tD84099E3C7300EBB3B46F2D39BD60068446100D1** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tD84099E3C7300EBB3B46F2D39BD60068446100D1* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___keys_7)); }
inline KeyCollection_tA98DA0EED72BF3C97C33FCD0D0916BDB5858288D * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tA98DA0EED72BF3C97C33FCD0D0916BDB5858288D ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tA98DA0EED72BF3C97C33FCD0D0916BDB5858288D * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ___values_8)); }
inline ValueCollection_t4D2EBB23C71878C1CFE5B282B0097CAF000842D9 * get_values_8() const { return ___values_8; }
inline ValueCollection_t4D2EBB23C71878C1CFE5B282B0097CAF000842D9 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t4D2EBB23C71878C1CFE5B282B0097CAF000842D9 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
il2cpp_hresult_t IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue);
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.IDtdEntityInfo,System.Xml.IDtdEntityInfo>
struct Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t7E4F75E23B8A710084DDD8B7D9D901F39C24B184_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityController,UnityEngine.Vector3>
struct Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tFB19AD637A1859A4B53CC7833DFF3EBCA3EDB5C3_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,System.Collections.Generic.HashSet`1<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer>>
struct Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t4DE8F3B2E63DD9146D26CA1EDDD498450E155F9C_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,System.UInt32>
struct Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tE4AA04B31C201432D691DD81E64F3624906B15D4_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.DefaultPrimaryPointerSelector/PointerInfo>
struct Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t3B899A4E44AAC2BABAB6DE844F85CD8EEB6E7812_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.IMixedRealityService>>
struct Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t5B61BD519916DA62BF0C6E111B6735A50C9AF36E_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<Microsoft.MixedReality.Toolkit.UI.BoundsControl.IProximityEffectObjectProvider,System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.UI.BoundsControl.ProximityEffect/ObjectProximityInfo>>
struct Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tC17C3E1C329D497F7BB1859B02C36552EC1758FD_ComCallableWrapper(obj));
}
| 48.754789 | 266 | 0.823484 | [
"object"
] |
850568c3344ccedae76ce76486aabb229898c088 | 1,068 | cpp | C++ | src/process.cpp | ibrahimsalem87/CppND-System-Monitor-Project-Updated | 90c120f746d7d9f4159273168b37f3b1f88faefc | [
"MIT"
] | null | null | null | src/process.cpp | ibrahimsalem87/CppND-System-Monitor-Project-Updated | 90c120f746d7d9f4159273168b37f3b1f88faefc | [
"MIT"
] | null | null | null | src/process.cpp | ibrahimsalem87/CppND-System-Monitor-Project-Updated | 90c120f746d7d9f4159273168b37f3b1f88faefc | [
"MIT"
] | null | null | null | #include "process.h"
#include <unistd.h>
#include <cctype>
#include <sstream>
#include <string>
#include <vector>
using std::string;
using std::to_string;
using std::vector;
Process::Process(int pid_) : pid(pid_) {}
// DONE: Return this process's ID
int Process::Pid() { return this->pid; }
// DONE: Return this process's CPU utilization
float Process::CpuUtilization() { return cpu_utilization=LinuxParser::CpuUtilization(Pid()); }
//DONE: Return the command that generated this process
string Process::Command() { return LinuxParser::Command(Pid()); }
// DONE: Return this process's memory utilization
string Process::Ram() { return LinuxParser::Ram(Pid()); }
// DONE: Return the user (name) that generated this process
string Process::User() { return LinuxParser::User(Pid()); }
// DONE: Return the age of this process (in seconds)
long int Process::UpTime() { return LinuxParser::UpTime(Pid()); }
// Done?
bool Process::operator<(Process const& a) const {
return a.cpu_utilization < this->cpu_utilization ? a.cpu_utilization : this->cpu_utilization;
} | 28.864865 | 95 | 0.722846 | [
"vector"
] |
85097a22969728d97a86b0a7f6efc714a5734757 | 9,904 | cpp | C++ | Samples/Win7Samples/multimedia/mediafoundation/MFPlayer2/AudioSessionVolume.cpp | windows-development/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | 8 | 2017-04-30T17:38:27.000Z | 2021-11-29T00:59:03.000Z | Samples/Win7Samples/multimedia/mediafoundation/MFPlayer2/AudioSessionVolume.cpp | TomeSq/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | null | null | null | Samples/Win7Samples/multimedia/mediafoundation/MFPlayer2/AudioSessionVolume.cpp | TomeSq/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | 2 | 2020-08-11T13:21:49.000Z | 2021-09-01T10:41:51.000Z | //------------------------------------------------------------------------------
//
// Manages the audio session.
//
// The CAudioSessionVolume class performs two functions:
//
// - Enables the application to set the volume on the audio session that
// MFPlay uses for audio playback.
//
// - Notifies the application when the session volume is changed externally
// (eg through SndVol application)
//
// This class uses two WASAPI interfaces:
//
// - IAudioSessionControl
// - ISimpleAudioVolume
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
#include "MFPlayer.h"
#include "AudioSessionVolume.h"
// {2715279F-4139-4ba0-9CB1-B351F1B58A4A}
static const GUID AudioSessionVolumeCtx =
{ 0x2715279f, 0x4139, 0x4ba0, { 0x9c, 0xb1, 0xb3, 0x51, 0xf1, 0xb5, 0x8a, 0x4a } };
//-------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------
CAudioSessionVolume::CAudioSessionVolume(
UINT uNotificationMessage,
HWND hwndNotification
)
: m_cRef(1),
m_uNotificationMessage(uNotificationMessage),
m_hwndNotification(hwndNotification),
m_bNotificationsEnabled(FALSE),
m_pAudioSession(NULL),
m_pSimpleAudioVolume(NULL)
{
}
//-------------------------------------------------------------------
// Destructor
//-------------------------------------------------------------------
CAudioSessionVolume::~CAudioSessionVolume()
{
EnableNotifications(FALSE);
SafeRelease(&m_pAudioSession);
SafeRelease(&m_pSimpleAudioVolume);
};
//-------------------------------------------------------------------
// CreateInstance
//
// Creates an instance of the CAudioSessionVolume object.
//-------------------------------------------------------------------
/* static */
HRESULT CAudioSessionVolume::CreateInstance(
UINT uNotificationMessage,
HWND hwndNotification,
CAudioSessionVolume **ppAudioSessionVolume
)
{
HRESULT hr = S_OK;
CAudioSessionVolume *pAudioSessionVolume = NULL;
pAudioSessionVolume = new (std::nothrow) CAudioSessionVolume(
uNotificationMessage, hwndNotification);
if (pAudioSessionVolume == NULL)
{
hr = E_OUTOFMEMORY;
goto done;
}
hr = pAudioSessionVolume->Initialize();
if (FAILED(hr)) { goto done; }
*ppAudioSessionVolume = pAudioSessionVolume;
(*ppAudioSessionVolume)->AddRef();
done:
SafeRelease(&pAudioSessionVolume);
return hr;
}
//-------------------------------------------------------------------
// Initialize
//
// Initializes the CAudioSessionVolume object.
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::Initialize()
{
HRESULT hr = S_OK;
IMMDeviceEnumerator *pDeviceEnumerator = NULL;
IMMDevice *pDevice = NULL;
IAudioSessionManager *pAudioSessionManager = NULL;
// Get the enumerator for the audio endpoint devices.
hr = CoCreateInstance(
__uuidof(MMDeviceEnumerator),
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pDeviceEnumerator)
);
if (FAILED(hr)) { goto done; }
// Get the default audio endpoint that the SAR will use.
hr = pDeviceEnumerator->GetDefaultAudioEndpoint(
eRender,
eConsole, // The SAR uses 'eConsole' by default.
&pDevice
);
if (FAILED(hr)) { goto done; }
// Get the session manager for this device.
hr = pDevice->Activate(
__uuidof(IAudioSessionManager),
CLSCTX_INPROC_SERVER,
NULL,
(void**) &pAudioSessionManager
);
if (FAILED(hr)) { goto done; }
// Get the audio session.
hr = pAudioSessionManager->GetAudioSessionControl(
&GUID_NULL, // Get the default audio session.
FALSE, // The session is not cross-process.
&m_pAudioSession
);
if (FAILED(hr)) { goto done; }
hr = pAudioSessionManager->GetSimpleAudioVolume(
&GUID_NULL, 0, &m_pSimpleAudioVolume
);
done:
SafeRelease(&pDeviceEnumerator);
SafeRelease(&pDevice);
SafeRelease(&pAudioSessionManager);
return hr;
}
/* IUnknown methods */
STDMETHODIMP CAudioSessionVolume::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CAudioSessionVolume, IAudioSessionEvents),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}
STDMETHODIMP_(ULONG) CAudioSessionVolume::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG) CAudioSessionVolume::Release()
{
LONG c = InterlockedDecrement( &m_cRef );
if (c == 0)
{
delete this;
}
return c;
}
//-------------------------------------------------------------------
// EnableNotifications
//
// Enables or disables notifications from the audio session. For
// example, if the user mutes the audio through the system volume-
// control program (Sndvol), the application will be notified.
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::EnableNotifications(BOOL bEnable)
{
HRESULT hr = S_OK;
if (m_hwndNotification == NULL || m_pAudioSession == NULL)
{
return E_FAIL;
}
if (m_bNotificationsEnabled == bEnable)
{
// No change.
return S_OK;
}
if (bEnable)
{
hr = m_pAudioSession->RegisterAudioSessionNotification(this);
}
else
{
hr = m_pAudioSession->UnregisterAudioSessionNotification(this);
}
if (SUCCEEDED(hr))
{
m_bNotificationsEnabled = bEnable;
}
return hr;
}
//-------------------------------------------------------------------
// GetVolume
//
// Gets the session volume level.
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::GetVolume(float *pflVolume)
{
HRESULT hr = S_OK;
if ( m_pSimpleAudioVolume == NULL)
{
hr = E_FAIL;
}
else
{
hr = m_pSimpleAudioVolume->GetMasterVolume(pflVolume);
}
return hr;
}
//-------------------------------------------------------------------
// SetVolume
//
// Sets the session volume level.
//
// flVolume: Ranges from 0 (silent) to 1 (full volume)
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::SetVolume(float flVolume)
{
HRESULT hr = S_OK;
if (m_pSimpleAudioVolume == NULL)
{
hr = E_FAIL;
}
else
{
hr = m_pSimpleAudioVolume->SetMasterVolume(
flVolume,
&AudioSessionVolumeCtx // Event context.
);
}
return hr;
}
//-------------------------------------------------------------------
// GetMute
//
// Gets the muting state of the session.
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::GetMute(BOOL *pbMute)
{
HRESULT hr = S_OK;
if (m_pSimpleAudioVolume == NULL)
{
hr = E_FAIL;
}
else
{
hr = m_pSimpleAudioVolume->GetMute(pbMute);
}
return hr;
}
//-------------------------------------------------------------------
// SetMute
//
// Mutes or unmutes the session audio.
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::SetMute(BOOL bMute)
{
HRESULT hr = S_OK;
if (m_pSimpleAudioVolume == NULL)
{
hr = E_FAIL;
}
else
{
hr = m_pSimpleAudioVolume->SetMute(
bMute,
&AudioSessionVolumeCtx // Event context.
);
}
return hr;
}
//-------------------------------------------------------------------
// SetDisplayName
//
// Sets the display name for the session audio.
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::SetDisplayName(const WCHAR *wszName)
{
HRESULT hr = S_OK;
if (m_pAudioSession == NULL)
{
hr = E_FAIL;
}
else
{
hr = m_pAudioSession->SetDisplayName(wszName, NULL);
}
return hr;
}
//-------------------------------------------------------------------
// OnSimpleVolumeChanged
//
// Callback when the session volume level or muting state changes.
// (Implements IAudioSessionEvents::OnSimpleVolumeChanged.)
//
//-------------------------------------------------------------------
HRESULT CAudioSessionVolume::OnSimpleVolumeChanged(
float NewVolume,
BOOL NewMute,
LPCGUID EventContext
)
{
// Check if we should post a message to the application.
if ( m_bNotificationsEnabled &&
(*EventContext != AudioSessionVolumeCtx) &&
(m_hwndNotification != NULL)
)
{
// Notifications are enabled, AND
// We did not trigger the event ourselves, AND
// We have a valid window handle.
// Post the message.
::PostMessage(
m_hwndNotification,
m_uNotificationMessage,
*((WPARAM*)(&NewVolume)), // Coerce the float.
(LPARAM)NewMute
);
}
return S_OK;
}
| 25.525773 | 84 | 0.505856 | [
"object"
] |
851dde7b0b64d4aaa889a0dcfe67a1f1cc4d5fdf | 8,128 | hpp | C++ | src/simple_graph/graph.hpp | sfod/simple-graph | b07ac266296f44238ee02f7cc1042f079f4eac9d | [
"MIT"
] | 1 | 2016-01-25T09:54:38.000Z | 2016-01-25T09:54:38.000Z | src/simple_graph/graph.hpp | sfod/simple-graph | b07ac266296f44238ee02f7cc1042f079f4eac9d | [
"MIT"
] | 1 | 2019-04-08T10:40:00.000Z | 2019-04-08T10:40:00.000Z | src/simple_graph/graph.hpp | sfod/simple-graph | b07ac266296f44238ee02f7cc1042f079f4eac9d | [
"MIT"
] | null | null | null | #pragma once
#include <memory>
#include <set>
#include <vector>
#include <gsl/gsl>
// TODO use move semantics
namespace simple_graph {
typedef gsl::index vertex_index_t;
/**
* Graph vertex.
*
* @tparam T Typename for vertex data.
*/
template<typename T>
class Vertex {
public:
Vertex() : idx_(-1), data_() {
++default_creations;
}
explicit Vertex(vertex_index_t idx) : idx_(idx), data_()
{
++creations;
}
Vertex(vertex_index_t idx, const T &data) : idx_(idx), data_(data)
{
++creations;
}
Vertex(const Vertex<T> &v)
{
++copies;
idx_ = v.idx_;
data_ = v.data_;
}
Vertex &operator=(const Vertex<T> &v)
{
++assigns;
if (this != &v) {
idx_ = v.idx_;
data_ = v.data_;
}
return *this;
}
Vertex(Vertex<T> &&v)
noexcept(noexcept(std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_assignable<T>::value))
{
++moves;
idx_ = v.idx_;
std::swap(data_, v.data_);
}
Vertex &operator=(Vertex<T> &&v)
noexcept(noexcept(std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_assignable<T>::value))
{
++moves;
if (this != &v) {
idx_ = v.idx_;
std::swap(data_, v.data_);
}
return *this;
}
virtual ~Vertex() = default;
vertex_index_t idx() const { return idx_; }
T data() const { return data_; }
bool operator<(const Vertex<T> &vertex) const
{
return idx_ < vertex.idx_;
}
/// Counters to track down objects manipulations.
public:
static int default_creations;
static int creations;
static int copies;
static int moves;
static int assigns;
static std::string stat()
{
return "creations: " + std::to_string(default_creations) + " + " + std::to_string(creations)
+ "; copies: " + std::to_string(copies)
+ "; moves: " + std::to_string(moves)
+ "; assigns: " + std::to_string(assigns);
}
private:
vertex_index_t idx_;
T data_;
};
template<typename T> int Vertex<T>::default_creations = 0;
template<typename T> int Vertex<T>::creations = 0;
template<typename T> int Vertex<T>::copies = 0;
template<typename T> int Vertex<T>::moves = 0;
template<typename T> int Vertex<T>::assigns = 0;
/**
* Graph edge.
*
* @tparam P Typename for edge additional parameters.
* @tparam W Typename for edge weight, must be numeric.
*/
template<typename P, typename W = float>
class Edge {
static_assert(std::is_integral<W>::value || std::is_floating_point<W>::value,
"Integer or floating-point number required for weight typename.");
public:
Edge() : idx1_(-1), idx2_(-1), params_(), weight_(1)
{
++default_creations;
}
Edge(vertex_index_t idx1, vertex_index_t idx2, P params)
: idx1_(idx1), idx2_(idx2), params_(std::move(params)), weight_(1)
{
++creations;
}
Edge(vertex_index_t idx1, vertex_index_t idx2, P params, W weight)
: idx1_(idx1), idx2_(idx2), params_(std::move(params)), weight_(weight)
{
++creations;
}
Edge(const Edge<P, W> &edge)
: idx1_(edge.idx1_), idx2_(edge.idx2_), params_(std::move(edge.params_)), weight_(edge.weight_)
{
++copies;
}
Edge &operator=(const Edge<P, W> &edge)
{
++assigns;
if (this != &edge) {
idx1_ = edge.idx1_;
idx2_ = edge.idx2_;
params_ = edge.params_;
weight_ = edge.weight_;
}
return *this;
}
Edge(Edge<P, W> &&edge) noexcept(noexcept(std::is_nothrow_move_constructible<W>::value && std::is_nothrow_move_assignable<W>::value))
: idx1_(edge.idx1_), idx2_(edge.idx2_), params_(std::move(edge.params_)), weight_(edge.weight_)
{
++moves;
}
Edge &operator=(Edge<P, W> &&edge) noexcept(noexcept(std::is_nothrow_move_constructible<P>::value && std::is_nothrow_move_assignable<P>::value))
{
++moves;
if (this != &edge) {
idx1_ = edge.idx1_;
idx2_ = edge.idx2_;
std::swap(params_, edge.params_);
std::swap(weight_, edge.weight_);
}
return *this;
}
virtual ~Edge() = default;
vertex_index_t idx1() const { return idx1_; }
vertex_index_t idx2() const { return idx2_; }
P parameters() const { return params_; }
const W &weight() const { return weight_; }
void swap_vertices() { std::swap(idx1_, idx2_); }
/// counters to track down objects manipulations
public:
static int default_creations;
static int creations;
static int copies;
static int moves;
static int assigns;
static std::string stat()
{
return "creations: " + std::to_string(default_creations) + " + " + std::to_string(creations)
+ "; copies: " + std::to_string(copies)
+ "; moves: " + std::to_string(moves)
+ "; assigns: " + std::to_string(assigns);
}
private:
vertex_index_t idx1_;
vertex_index_t idx2_;
P params_;
W weight_;
};
template<typename P, typename W> int Edge<P, W>::default_creations = 0;
template<typename P, typename W> int Edge<P, W>::creations = 0;
template<typename P, typename W> int Edge<P, W>::copies = 0;
template<typename P, typename W> int Edge<P, W>::moves = 0;
template<typename P, typename W> int Edge<P, W>::assigns = 0;
/**
* Interface for Graph children iterators.
*
* @tparam T Typename of traversed data.
*/
template<typename T>
class IIterator {
public:
virtual ~IIterator() = default;
virtual bool operator==(const IIterator<T> &it) const = 0;
virtual bool operator!=(const IIterator<T> &it) const = 0;
virtual IIterator<T> &operator++() = 0;
virtual T &operator*() = 0;
};
/**
* Utility class to provide iterator functionality to Graph children.
*
* @tparam T Typename of traversed data.
*/
template<typename T>
class IteratorWrapper {
public:
explicit IteratorWrapper(std::shared_ptr<IIterator<T>> b) : base_impl(b) {}
bool operator==(const IteratorWrapper<T> &it) const
{
return base_impl->operator==(*it.base_impl);
}
bool operator!=(const IteratorWrapper<T> &it) const
{
return !operator==(it);
}
IteratorWrapper &operator++()
{
base_impl->operator++();
return *this;
}
T &operator*()
{
return base_impl->operator*();
}
private:
std::shared_ptr<IIterator<T>> base_impl;
};
/**
* Graph interface.
*
* @tparam Dir
* @tparam V
* @tparam E
*/
template<bool Dir, typename V, typename E, typename W>
class Graph {
protected:
class EdgesWrapper {
public:
virtual IteratorWrapper<Edge<E, W>> begin() = 0;
virtual IteratorWrapper<Edge<E, W>> end() = 0;
};
public:
// TODO Add constructor from std::initializer_list.
virtual ~Graph() = default;
virtual void add_vertex(Vertex<V> vertex) = 0;
virtual void rm_vertex(vertex_index_t idx) = 0;
// TODO Measure performance.
virtual std::set<vertex_index_t> inbounds(vertex_index_t idx) const = 0;
virtual std::set<vertex_index_t> outbounds(vertex_index_t idx, int mode) const = 0;
virtual const Vertex<V> &vertex(vertex_index_t idx) const = 0;
virtual size_t vertex_num() const = 0;
virtual void add_edge(Edge<E, W> edge) = 0;
virtual const Edge<E, W> &edge(vertex_index_t idx1, vertex_index_t idx2) const = 0;
virtual bool edge_exists(Edge<E, W> edge) const = 0;
virtual void rm_edge(Edge<E, W> edge) = 0;
virtual size_t edge_num() const = 0;
virtual bool filter_edge(Edge<E, W> edge) = 0;
virtual bool filter_edges(const std::vector<Edge<E, W>> &edges) = 0;
virtual bool restore_edge(Edge<E, W> edge) = 0;
virtual bool restore_edges(const std::vector<Edge<E, W>> &edges) = 0;
virtual void restore_edges() = 0;
// FIXME
virtual EdgesWrapper &edges() = 0;
};
} // namespace simple_graph
| 26.135048 | 148 | 0.606791 | [
"vector"
] |
851e9f0c5bff0c8edcbee6e09103ca647b26869f | 13,450 | cpp | C++ | src/Loaders/ObjMesh.cpp | flashpoint493/AyaRay | 96a7c90ad908468084cb339d4adf3638b750ee82 | [
"MIT"
] | 1 | 2020-08-03T05:58:27.000Z | 2020-08-03T05:58:27.000Z | src/Loaders/ObjMesh.cpp | flashpoint493/AyaRay | 96a7c90ad908468084cb339d4adf3638b750ee82 | [
"MIT"
] | null | null | null | src/Loaders/ObjMesh.cpp | flashpoint493/AyaRay | 96a7c90ad908468084cb339d4adf3638b750ee82 | [
"MIT"
] | null | null | null | #include "ObjMesh.h"
namespace Aya {
void ObjMesh::parserFramework(const char *filename, std::function<void(char*, char*)> callback) {
int cmd_len, header_len;
char command[AYA_MAX_PATH], cmd_header[AYA_MAX_PATH];
FILE *fp;
fopen_s(&fp, filename, "rt");
assert(fp);
#define FREAD_BUF_SIZE 131072
char buf[FREAD_BUF_SIZE], *p1 = buf, *p2 = buf;
auto getChar = [&]() -> char {
if (p1 == p2) {
p2 = (p1 = buf) + fread(buf, 1, FREAD_BUF_SIZE, fp);
if (p1 == p2)
return EOF;
}
return *p1++;
};
auto fEOF = [&fp, &p1, &p2]() -> bool {
return feof(fp) && (p1 == p2);
};
while (!fEOF()) {
cmd_len = 0;
char c;
do {
c = getChar();
} while (c == '\t' || c == '\n' || c == '\r');
do {
command[cmd_len++] = c;
c = getChar();
} while (c != '\n' && c != '\r' && c != EOF);
//while (command[cmd_len] = getChar(),
// command[cmd_len] != '\n' && command[cmd_len] != EOF)
// ++cmd_len;
command[cmd_len] = 0;
// Header Part
header_len = 0;
while (command[header_len] != ' ' && header_len < cmd_len) {
cmd_header[header_len] = command[header_len];
header_len++;
}
cmd_header[header_len] = 0;
// Parameter Part
char *cmd_para = command + header_len + 1;
callback(cmd_header, cmd_para);
}
fclose(fp);
}
bool ObjMesh::loadObj(const char *path, const bool force_compute_normal, const bool left_handed) {
std::vector<Point3> position_buff;
std::vector<Normal3> normal_buff;
std::vector<Vector2f> uv_buff;
int smoothing_group = force_compute_normal ? 1 : 0;
bool has_smooth_group = false;
int current_mtl = 0;
char mtl_filename[AYA_MAX_PATH] = { 0 };
parserFramework(path, [&] (char *cmd_header, char *cmd_para) {
if (0 == std::strcmp(cmd_header, "#")) {
// Comment
}
else if (0 == std::strcmp(cmd_header, "v")) {
// Vertex Position
float x, y, z;
sscanf_s(cmd_para, "%f %f %f", &x, &y, &z);
position_buff.emplace_back(x, y, z);
}
else if (0 == std::strcmp(cmd_header, "vt")) {
// Vertex TexCoord
float u, v;
sscanf_s(cmd_para, "%f %f", &u, &v);
uv_buff.emplace_back(u, 1.f - v);
m_textured = true;
}
else if (0 == std::strcmp(cmd_header, "vn")) {
// Vertex Normal
float x, y, z;
sscanf_s(cmd_para, "%f %f %f", &x, &y, &z);
normal_buff.emplace_back(x, y, z);
}
else if (0 == std::strcmp(cmd_header, "s")) {
// smoothing group for normal computation
if (cmd_para[0] >= '1' && cmd_para[0] <= '9') {
has_smooth_group = true;
sscanf_s(cmd_para, "%d", &smoothing_group);
}
else
smoothing_group = 0;
}
else if (0 == std::strcmp(cmd_header, "mtllib")) {
// Material library
sscanf_s(cmd_para, "%s", mtl_filename, AYA_MAX_PATH);
}
else if (0 == std::strcmp(cmd_header, "usemtl")) {
char name[AYA_MAX_PATH];
sscanf_s(cmd_para, "%s", name, AYA_MAX_PATH);
ObjMaterial mtl(name);
auto idx_iter = std::find(m_materials.begin(), m_materials.end(), mtl);
if (idx_iter == m_materials.end()) {
current_mtl = int(m_materials.size());
m_materials.push_back(mtl);
}
else {
current_mtl = int(idx_iter - m_materials.begin());
}
m_subset_start_idx.push_back(int(m_indices.size()));
m_subset_mtl_idx.push_back(current_mtl);
m_subset_count++;
}
else if (0 == std::strcmp(cmd_header, "f")) {
// Face
int len = int(std::strlen(cmd_para));
int pos_idx, uv_idx, normal_idx;
MeshVertex vertex;
MeshFace face, quad_face;
uint32_t face_idx[4] = { 0, 0, 0, 0 };
int vertex_count = 0;
int slash_count = -1;
bool double_slash = false;
auto start_idx = 0;
for (auto i = 0; i <= len; i++) {
char c = cmd_para[i];
if (c != ' ' && c != '\t' && c != '\n' && c != '\0')
continue;
// Move to data header
if (start_idx == i) {
start_idx++;
continue;
}
if (slash_count == -1) {
slash_count = 0;
for (auto cur = start_idx; cur < i; cur++) {
if (cmd_para[cur] == '/') {
if (cur - 1 >= 0 && cmd_para[cur - 1] == '/')
double_slash = true;
slash_count++;
}
}
}
if (double_slash) {
sscanf_s(cmd_para + start_idx, "%d//%d", &pos_idx, &normal_idx);
if (pos_idx < 0) pos_idx = int(position_buff.size()) + pos_idx + 1;
if (normal_idx < 0) normal_idx = int(normal_buff.size()) + normal_idx + 1;
vertex.p = position_buff[pos_idx - 1];
vertex.n = normal_buff[normal_idx - 1];
}
else {
if (slash_count == 0) {
sscanf_s(cmd_para + start_idx, "%d", &pos_idx);
if (pos_idx < 0) pos_idx = int(position_buff.size()) + pos_idx + 1;
vertex.p = position_buff[pos_idx - 1];
}
else if (slash_count == 1) {
sscanf_s(cmd_para + start_idx, "%d/%d", &pos_idx, &uv_idx);
if (pos_idx < 0) pos_idx = int(position_buff.size()) + pos_idx + 1;
if (uv_idx < 0) uv_idx = int(uv_buff.size()) / 2 + uv_idx + 1;
vertex.p = position_buff[pos_idx - 1];
vertex.uv = uv_buff[uv_idx - 1];
}
else if (slash_count == 2) {
sscanf_s(cmd_para + start_idx, "%d/%d/%d", &pos_idx, &uv_idx, &normal_idx);
if (pos_idx < 0) pos_idx = int(position_buff.size()) + pos_idx + 1;
if (uv_idx < 0) uv_idx = int(uv_buff.size()) / 2 + uv_idx + 1;
if (normal_idx < 0) normal_idx = int(normal_buff.size()) + normal_idx + 1;
vertex.p = position_buff[pos_idx - 1];
vertex.uv = uv_buff[uv_idx - 1];
vertex.n = normal_buff[normal_idx - 1];
}
}
if (vertex_count >= 4)
break;
face_idx[vertex_count] = addVertex(pos_idx - 1, &vertex);
++vertex_count;
start_idx = i + 1;
}
if (left_handed) {
face.idx[0] = face_idx[0];
face.idx[1] = face_idx[2];
face.idx[2] = face_idx[1];
}
else {
face.idx[0] = face_idx[0];
face.idx[1] = face_idx[1];
face.idx[2] = face_idx[2];
}
m_indices.push_back(face.idx[0]);
m_indices.push_back(face.idx[1]);
m_indices.push_back(face.idx[2]);
face.smoothing_group = smoothing_group;
m_faces.push_back(face);
m_material_idx.push_back(current_mtl);
if (vertex_count == 4) {
// Trianglarize quad
if (left_handed) {
quad_face.idx[0] = face_idx[3];
quad_face.idx[1] = face.idx[1];
quad_face.idx[2] = face.idx[0];
}
else {
quad_face.idx[0] = face_idx[3];
quad_face.idx[1] = face.idx[0];
quad_face.idx[2] = face.idx[2];
}
m_indices.push_back(quad_face.idx[0]);
m_indices.push_back(quad_face.idx[1]);
m_indices.push_back(quad_face.idx[2]);
quad_face.smoothing_group = smoothing_group;
m_faces.push_back(quad_face);
m_material_idx.push_back(current_mtl);
}
}
else {
// Ignore
}
});
if (m_subset_count == 0) {
m_subset_start_idx.push_back(0);
m_subset_mtl_idx.push_back(0);
m_subset_count = 1;
}
m_subset_start_idx.push_back(uint32_t(m_indices.size()));
m_vertex_count = uint32_t(m_vertices.size());
m_triangle_count = uint32_t(m_indices.size()) / 3;
// Recomputed pre-vertex normals
if (force_compute_normal || has_smooth_group || !m_normaled)
computeVertexNormals();
for (auto list : m_caches) {
while (list != NULL) {
auto next = list->next;
SafeDelete(list);
list = next;
}
}
m_caches.clear();
if (mtl_filename[0]) {
const char *path1 = strrchr(path, '/');
const char *path2 = strrchr(path, '\\');
if (path1 || path2) {
int idx = int((path1 ? path1 : path2) - path + 1);
char mtl_path[AYA_MAX_PATH] = { 0 };
strncpy_s(mtl_path, AYA_MAX_PATH, path, idx);
strcat(mtl_path, mtl_filename);
loadMtl(mtl_path);
}
else {
loadMtl(mtl_filename);
}
}
if (!m_materials.size())
m_materials.push_back(ObjMaterial());
return true;
}
void ObjMesh::loadMtl(const char *path) {
int current_material = -1;
parserFramework(path, [this, ¤t_material, path](char *cmd_header, char *cmd_para) {
if (0 == std::strcmp(cmd_header, "#")) {
// Comment
}
else if (0 == std::strcmp(cmd_header, "newmtl")) {
// Switching active materials
char name[AYA_MAX_PATH];
sscanf_s(cmd_para, "%s", name, AYA_MAX_PATH);
ObjMaterial mtl(name);
current_material = int(std::find(m_materials.begin(), m_materials.end(), mtl) - m_materials.begin());
}
if (!~current_material)
return;
else if (0 == std::strcmp(cmd_header, "Ni")) {
// Refractive Index
float ni;
sscanf_s(cmd_para, "%f", &ni);
m_materials[current_material].refractive_index = ni;
}
else if (0 == std::strcmp(cmd_header, "Kd")) {
// Diffuse color
float r, g, b;
sscanf_s(cmd_para, "%f %f %f", &r, &g, &b);
m_materials[current_material].diffuse_color = Spectrum::fromRGB(r, g, b);
}
else if (0 == std::strcmp(cmd_header, "Ks")) {
// Specular color
float r, g, b;
sscanf_s(cmd_para, "%f %f %f", &r, &g, &b);
m_materials[current_material].specular_color = Spectrum::fromRGB(r, g, b);
}
else if (0 == std::strcmp(cmd_header, "Tf")) {
// Transmission color
float r, g, b;
sscanf_s(cmd_para, "%f %f %f", &r, &g, &b);
m_materials[current_material].trans_color = Spectrum::fromRGB(r, g, b);
}
else if (0 == std::strcmp(cmd_header, "d") ||
0 == std::strcmp(cmd_header, "Tr")) {
// Alpha
sscanf_s(cmd_para, "%f", &m_materials[current_material].diffuse_color[3]);
}
else if (0 == std::strcmp(cmd_header, "map_Kd")) {
// Texture Map
const char *path1 = std::strrchr(path, '/');
const char *path2 = std::strrchr(path, '\\');
if (path1 || path2) {
int idx = int((path1 ? path1 : path2) - path + 1);
strncpy_s(m_materials[current_material].texture_path, AYA_MAX_PATH, path, idx);
}
strcat_s(m_materials[current_material].texture_path, AYA_MAX_PATH, cmd_para);
}
else if (0 == std::strcmp(cmd_header, "bump")) {
// Bump Map
if (!m_materials[current_material].bump_path[0]) {
const char *path1 = std::strrchr(path, '/');
const char *path2 = std::strrchr(path, '\\');
if (path1 || path2) {
int idx = int((path1 ? path1 : path2) - path + 1);
strncpy_s(m_materials[current_material].bump_path, AYA_MAX_PATH, path, idx);
}
strcat_s(m_materials[current_material].bump_path, AYA_MAX_PATH, cmd_para);
}
}
else {
// Ignore
}
});
}
uint32_t ObjMesh::addVertex(uint32_t hash, const MeshVertex *vertex) {
bool is_found = false;
uint32_t idx = 0;
if (m_caches.size() > hash) {
Cache *list = m_caches[hash];
while (list != NULL) {
MeshVertex *cache_vertex = m_vertices.data() + list->idx;
if (*cache_vertex == *vertex) {
is_found = true;
idx = list->idx;
break;
}
list = list->next;
}
}
if (!is_found) {
idx = uint32_t(m_vertices.size());
m_vertices.push_back(*vertex);
Cache *cache = new Cache();
if (cache == NULL)
return uint32_t(-1);
cache->idx = idx;
cache->next = NULL;
while (m_caches.size() <= hash)
m_caches.push_back(NULL);
Cache *list = m_caches[hash];
if (list == NULL)
m_caches[hash] = cache;
else {
while (list->next != NULL)
list = list->next;
list->next = cache;
}
}
return idx;
}
void ObjMesh::computeVertexNormals() {
// Compute per face Normals
const Normal3 ZERO_NORMAL(0.f, 0.f, 0.f);
std::vector<Normal3> face_normal;
face_normal.resize(m_faces.size());
for (auto i = 0; i < m_faces.size(); ++i) {
const Point3 &p1 = getVertexAt(m_faces[i].idx[0]).p;
const Point3 &p2 = getVertexAt(m_faces[i].idx[1]).p;
const Point3 &p3 = getVertexAt(m_faces[i].idx[2]).p;
Vector3 v1 = p2 - p1;
Vector3 v2 = p3 - p1;
Vector3 crossed = v1.cross(v2);
if (crossed.length() > 0.f)
face_normal[i] = crossed.normalize();
else
face_normal[i] = ZERO_NORMAL;
}
struct VertexFace {
std::vector<int> list;
};
std::vector<VertexFace> vertex_face_list;
vertex_face_list.resize(m_vertices.size());
for (auto i = 0; i < m_faces.size(); ++i) {
vertex_face_list[m_faces[i].idx[0]].list.push_back(i);
vertex_face_list[m_faces[i].idx[1]].list.push_back(i);
vertex_face_list[m_faces[i].idx[2]].list.push_back(i);
}
// Compute per vertex normals with smoothing group
for (int i = 0; i < m_faces.size(); i++) {
const MeshFace &face = m_faces[i];
for (auto j = 0; j < 3; j++) {
int face_count = 0;
Normal3 normal = ZERO_NORMAL;
for (auto k = 0; k < vertex_face_list[face.idx[j]].list.size(); k++) {
int face_idx = vertex_face_list[face.idx[j]].list[k];
if (face.smoothing_group & m_faces[face_idx].smoothing_group) {
normal += face_normal[face_idx];
face_count++;
}
}
if (face_count > 0)
normal /= float(face_count);
else
normal = face_normal[i];
if (normal.length() > 0.f)
normal = normal.normalize();
else
normal = ZERO_NORMAL;
MeshVertex &vert = m_vertices[face.idx[j]];
if (vert.n == ZERO_NORMAL)
vert.n = normal;
else if (vert.n != normal) {
MeshVertex new_vert = vert;
new_vert.n = normal;
auto idx = addVertex(face.idx[j], &new_vert);
m_indices[3 * i + j] = idx;
}
}
}
m_vertex_count = uint32_t(m_vertices.size());
m_normaled = true;
}
} | 28.435518 | 105 | 0.593457 | [
"vector"
] |
851fd53fad047c632040cd4ce87639deaf5e485b | 6,209 | hpp | C++ | src/locking_concurrent_streambuf.hpp | liquidum-network/chiapos | 899be669838fbe59307e37be52fdb94ecb1f121f | [
"Apache-2.0"
] | 2 | 2021-07-15T02:32:07.000Z | 2021-07-19T19:43:40.000Z | src/locking_concurrent_streambuf.hpp | liquidum-network/chiapos | 899be669838fbe59307e37be52fdb94ecb1f121f | [
"Apache-2.0"
] | null | null | null | src/locking_concurrent_streambuf.hpp | liquidum-network/chiapos | 899be669838fbe59307e37be52fdb94ecb1f121f | [
"Apache-2.0"
] | 1 | 2021-07-14T20:29:32.000Z | 2021-07-14T20:29:32.000Z | #pragma once
#include <cassert>
#include <chrono>
#include <condition_variable>
#include <ios>
#include <mutex>
#include <streambuf>
#include <utility>
#include <vector>
#include "aws_async.hpp"
#include "logging.hpp"
#ifndef LogBufState
#define LogBufState(where) SPDLOG_TRACE(StateString(std::move(where)))
#endif // LogBufState
class LockingConcurrentStreamBuf : public std::streambuf {
public:
explicit LockingConcurrentStreamBuf(
size_t bufferLength = 4 * 1024,
std::string id = "",
uint64_t timeout_millis = 1000 * 30);
void SetReadDone()
{
{
std::scoped_lock lock(mutex_);
read_done_ = true;
}
cv_.notify_one();
}
void SetWriteDone();
void SetWriteDoneWithPadding(size_t padding);
bool read_done() const { return read_done_; }
bool write_done() const { return write_done_; }
// Tell the buffer that we're done with bytes_read so that it advances the
// read position, then waits up to timeout_millis before returning at least min_num_bytes.
// Returns (error, buffer pointer, buffer size)
std::tuple<bool, uint8_t*, size_t> BorrowGetBytes(size_t min_num_bytes)
{
LogBufState("BorrowGetBytes");
if (egptr() - gptr() < static_cast<ssize_t>(min_num_bytes)) {
if (!WaitForGetBytes(min_num_bytes)) {
return {false, nullptr, 0};
}
}
return {true, reinterpret_cast<uint8_t*>(gptr()), static_cast<size_t>(egptr() - gptr())};
}
void FinishGetBytes(size_t bytes_read) { gbump(bytes_read); }
std::tuple<bool, uint8_t*, size_t> BorrowPutBytes(size_t min_num_bytes)
{
LogBufState("BorrowPutBytes");
if (epptr() - pptr() < static_cast<ssize_t>(min_num_bytes)) {
if (!WaitToPutBytes(min_num_bytes)) {
return {false, nullptr, 0};
}
}
return {true, reinterpret_cast<uint8_t*>(pptr()), static_cast<size_t>(epptr() - pptr())};
}
void FinishPutBytes(size_t bytes_written) { pbump(bytes_written); }
std::string StateString(const std::string& where);
const size_t buffer_size() const { return buffer_.size(); }
std::streamsize xsputn(const char* s, std::streamsize count) final override;
const std::string& id() const { return id_; }
int sync() final override { return WaitToPutBytes(0) ? 0 : -1; }
protected:
std::streampos seekoff(
std::streamoff off,
std::ios_base::seekdir dir,
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
std::streampos seekpos(
std::streampos pos,
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
int uflow() override;
int pbackfail(int) override;
int underflow() override;
int overflow(int ch) override;
std::streamsize showmanyc() override;
std::streamsize xsgetn(char* s, std::streamsize count) override;
std::streambuf* setbuf(char* s, std::streamsize n) override { CHECK(false); }
private:
auto deadline() -> decltype(auto)
{
return std::chrono::system_clock::now() + std::chrono::milliseconds(timeout_millis_);
}
const char* buffer_begin() const { return reinterpret_cast<const char*>(buffer_.data()); }
char* buffer_begin() { return reinterpret_cast<char*>(buffer_.data()); }
char* put_start_ptr(size_t put_start) { return buffer_begin() + put_start % buffer_size(); }
size_t put_size(size_t put_start) const { return get_start_ + buffer_size() - put_start; }
char* put_end_ptr(size_t put_start)
{
return put_start_ptr(put_start) + std::min(
buffer_size() - put_start % buffer_size(),
get_start_ + buffer_size() - put_start);
}
char* get_start_ptr(size_t get_start) { return buffer_begin() + get_start % buffer_size(); }
size_t get_size(size_t get_start) const { return put_start_ - get_start; }
char* get_end_ptr(size_t get_start)
{
return get_start_ptr(get_start) +
std::min(buffer_size() - get_start % buffer_size(), put_start_ - get_start);
}
bool WaitToPutBytes(size_t num_bytes);
bool WaitForGetBytes(size_t num_bytes);
// Tries to get at least hwm + num_bytes bytes, but after hwm_millis it will
// just wait for num_bytes (instead of hwam + num_bytes).
template <typename Container>
bool WaitForGetBytesMulti(const Container& sizes, size_t* get_start)
{
DCHECK_NE(sizes.size(), 0);
std::unique_lock<std::mutex> lock(mutex_);
LogBufState("WaitForGetBytes");
if (gptr() > eback()) {
*get_start += gptr() - eback();
get_start_ = *get_start;
cv_.notify_all();
}
size_t num_bytes;
auto check_ready = [&]() -> bool {
// Enough space in buffer?
if (write_done()) {
return true;
}
return num_bytes <= get_size(*get_start);
};
const auto now = std::chrono::system_clock::now();
bool no_timeout = false;
for (auto [this_num_bytes, this_timeout_millis] : sizes) {
num_bytes = this_num_bytes;
if (cv_.wait_until(
lock, now + std::chrono::milliseconds(this_timeout_millis), check_ready)) {
no_timeout = true;
break;
}
}
if (!no_timeout) {
SPDLOG_ERROR(StateString(fmt::format("timeout_get")));
return false;
}
auto* get_buf_end = get_end_ptr(*get_start);
lock.unlock();
// Now update pointers to match counters.
auto* get_buf_start = get_start_ptr(*get_start);
setg(get_buf_start, get_buf_start, get_buf_end);
LogBufState("WaitForGetBytes end");
return true;
}
const std::string id_;
const uint64_t timeout_millis_;
ManagedMemory buffer_;
size_t put_start_;
size_t get_start_;
std::mutex mutex_;
std::condition_variable cv_;
bool read_done_;
bool write_done_;
};
| 32.170984 | 97 | 0.62039 | [
"vector"
] |
8522a45b041a07a622ea08a39db20b281310edea | 7,909 | hpp | C++ | include/seqan3/alignment/matrix/alignment_trace_matrix.hpp | Clemapfel/seqan3 | 7114024ccaa883364d47f9335d6b19525a1fa7a9 | [
"BSD-3-Clause"
] | null | null | null | include/seqan3/alignment/matrix/alignment_trace_matrix.hpp | Clemapfel/seqan3 | 7114024ccaa883364d47f9335d6b19525a1fa7a9 | [
"BSD-3-Clause"
] | null | null | null | include/seqan3/alignment/matrix/alignment_trace_matrix.hpp | Clemapfel/seqan3 | 7114024ccaa883364d47f9335d6b19525a1fa7a9 | [
"BSD-3-Clause"
] | null | null | null | // -----------------------------------------------------------------------------------------------------
// Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
// Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE
// -----------------------------------------------------------------------------------------------------
/*!\file
* \author Marcel Ehrhardt <marcel.ehrhardt AT fu-berlin.de>
* \brief Contains the declaration of seqan3::detail::alignment_trace_matrix.
*/
#pragma once
#include <seqan3/alignment/matrix/alignment_score_matrix.hpp>
#include <seqan3/alignment/matrix/matrix_concept.hpp>
#include <seqan3/alignment/matrix/trace_directions.hpp>
namespace seqan3::detail
{
//!\brief The declaration of alignment_trace_matrix. Each definition of this
//! declaration must satisfy seqan3::detail::matrix_concept.
//!\ingroup alignment_matrix
//!\implements seqan3::detail::matrix_concept
template <typename ...>
class alignment_trace_matrix;
/*!\brief A trace matrix represented in a one-dimensional std::vector
* \ingroup alignment_matrix
*
* \details
*
* This data structure stores the matrix in a flat way using the
* std::vector<#entry_type> data structure where each row is stored
* continuously.
*
* # Example
*
* \snippet test/snippet/alignment/matrix/alignment_trace_matrix_vector.cpp code
*
* ### Output
* \include test/snippet/alignment/matrix/alignment_trace_matrix_vector.out
*/
template <>
class alignment_trace_matrix<std::vector<trace_directions>>
: public row_wise_matrix<trace_directions>
{
public:
using row_wise_matrix<trace_directions>::row_wise_matrix;
};
/*!\brief A trace matrix that uses an underlying seqan3::detail::alignment_score_matrix
* \ingroup alignment_matrix
* \tparam database_type The type of the database sequence.
* \tparam query_type The type of the query sequence.
* \tparam align_config_type The type of the alignment config.
* \tparam ...score_matrix_params_t The template parameters of seqan3::detail::alignment_score_matrix
*
* \details
*
* This data structure uses directly the score matrix to infer the trace matrix
* and works for any seqan3::detail::alignment_score_matrix.
*
* \todo TODO: Is currently only able to handle the edit distance.
*
* # Example
*
* \snippet test/snippet/alignment/matrix/alignment_trace_matrix.cpp code
*
* ### Output
* \include test/snippet/alignment/matrix/alignment_trace_matrix.out
*/
template <typename database_type, typename query_type, typename align_config_type, typename ...score_matrix_params_t>
//!\cond
requires matrix_concept<alignment_score_matrix<score_matrix_params_t...>> &&
std::Integral<typename alignment_score_matrix<score_matrix_params_t...>::entry_type>
//!\endcond
class alignment_trace_matrix<database_type, query_type, align_config_type, alignment_score_matrix<score_matrix_params_t...>>
: public alignment_score_matrix<score_matrix_params_t...>
{
public:
//!\brief The type of the score matrix.
using score_matrix_type = alignment_score_matrix<score_matrix_params_t...>;
//!\brief The type of an entry in the score matrix.
using score_type = typename score_matrix_type::entry_type;
//!\copydoc seqan3::detail::matrix_concept::entry_type
using entry_type = trace_directions;
/*!\name Constructors, destructor and assignment
* \{
*/
alignment_trace_matrix() = default; //!< Defaulted
alignment_trace_matrix(alignment_trace_matrix const &) = default; //!< Defaulted
alignment_trace_matrix(alignment_trace_matrix &&) = default; //!< Defaulted
alignment_trace_matrix & operator=(alignment_trace_matrix const &) = default; //!< Defaulted
alignment_trace_matrix & operator=(alignment_trace_matrix &&) = default; //!< Defaulted
~alignment_trace_matrix() = default; //!< Defaulted
/*!\brief Construct the trace matrix by using a score_matrix.
* \param database The database sequence.
* \param query The query sequence.
* \param config The alignment config.
* \param score_matrix The score matrix.
*/
alignment_trace_matrix(database_type database, query_type query, align_config_type config, score_matrix_type score_matrix)
: score_matrix_type(std::move(score_matrix)),
_database{std::forward<database_type>(database)},
_query{std::forward<query_type>(query)},
_config{std::forward<align_config_type>(config)}
{}
//!\}
//!\copydoc seqan3::detail::matrix_concept::rows
using score_matrix_type::rows;
//!\copydoc seqan3::detail::matrix_concept::cols
using score_matrix_type::cols;
//!\brief The trace directions of the matrix at position (*row*, *col*).
entry_type at(size_t const row, size_t const col) const noexcept
{
entry_type direction{};
if (is_trace_diagonal(row, col))
direction |= entry_type::diagonal;
if (is_trace_up(row, col))
direction |= entry_type::up;
if (is_trace_left(row, col))
direction |= entry_type::left;
return direction;
}
//!\brief Access to the score_matrix.
score_matrix_type const & score_matrix() const noexcept
{
return *this;
}
private:
//!\brief Does the trace come from the above entry?
bool is_trace_up(size_t const row, size_t const col) const noexcept
{
// TODO: use the alignment_config to calculate the score
score_type gap = 1;
score_type curr = score_matrix().at(row, col);
score_type up = row == 0 ? col : score_matrix().at(row - 1, col);
return curr == up + gap;
}
//!\brief Does the trace come from the left entry?
bool is_trace_left(size_t const row, size_t const col) const noexcept
{
// TODO: use the alignment_config to calculate the score
score_type gap = 1;
score_type curr = score_matrix().at(row, col);
score_type left = col == 0 ? row : score_matrix().at(row, col - 1);
return curr == left + gap;
}
//!\brief Does the trace come from the diagonal entry?
bool is_trace_diagonal(size_t const row, size_t const col) const noexcept
{
// TODO: use the alignment_config to calculate the score
score_type match = 0;
score_type mismatch = 1;
score_type curr = score_matrix().at(row, col);
if (col == 0 || row == 0)
return false;
score_type diag = score_matrix().at(row - 1, col - 1);
bool is_match = _query[row - 1] == _database[col - 1];
return (is_match && curr == diag + match) ||
(!is_match && curr == diag + mismatch);
}
//!\brief The database sequence.
database_type _database;
//!\brief The query sequence.
query_type _query;
//!\brief The alignment config.
align_config_type _config;
};
/*!\name Type deduction guides
* \relates seqan3::detail::alignment_trace_matrix
* \{
*/
alignment_trace_matrix(std::vector<trace_directions>, size_t rows, size_t cols)
-> alignment_trace_matrix<std::vector<trace_directions>>;
template <typename database_t, typename query_t, typename align_config_t, typename alignment_t, typename ...options_t>
alignment_trace_matrix(database_t && database, query_t && query, align_config_t && config, alignment_score_matrix<alignment_t, options_t...>)
-> alignment_trace_matrix<database_t, query_t, align_config_t, alignment_score_matrix<alignment_t, options_t...>>;
//!\}
} // namespace seqan3::detail
| 38.207729 | 141 | 0.673663 | [
"vector"
] |
85446090e652d60ed6e1fd21390011b3ca1b0dc6 | 40,894 | cc | C++ | src/sglib/processors/LinkageUntangler.cc | BenJWard/sg | 397924c8346981a6d4726c9cac7bc9c1b623c6fb | [
"MIT"
] | null | null | null | src/sglib/processors/LinkageUntangler.cc | BenJWard/sg | 397924c8346981a6d4726c9cac7bc9c1b623c6fb | [
"MIT"
] | null | null | null | src/sglib/processors/LinkageUntangler.cc | BenJWard/sg | 397924c8346981a6d4726c9cac7bc9c1b623c6fb | [
"MIT"
] | null | null | null | //
// Created by Bernardo Clavijo (EI) on 28/05/2018.
//
#include "LinkageUntangler.hpp"
#include "GraphEditor.hpp"
class KmerMapCreator : public KMerFactory {
public:
explicit KmerMapCreator(uint8_t k) : KMerFactory(k){}
inline void create_all_kmers(const char * seq, std::unordered_map<uint64_t,uint32_t> &mers){
// TODO: Adjust for when K is larger than what fits in uint64_t!
last_unknown=0;
fkmer=0;
rkmer=0;
auto s=seq;
while (*s!='\0' and *s!='\n') {
//fkmer: grows from the right (LSB)
//rkmer: grows from the left (MSB)
fillKBuf(*s, fkmer, rkmer, last_unknown);
if (last_unknown >= K) {
if (fkmer <= rkmer) {
// Is fwd
mers[fkmer]=0;
} else {
// Is bwd
mers[rkmer]=0;
}
}
++s;
}
}
};
class KmerMapCounter : public KMerFactory {
public:
explicit KmerMapCounter(uint8_t k) : KMerFactory(k){}
inline void count_all_kmers(const char * seq, std::unordered_map<uint64_t,uint32_t> &mers){
// TODO: Adjust for when K is larger than what fits in uint64_t!
last_unknown=0;
fkmer=0;
rkmer=0;
auto s=seq;
while (*s!='\0' and *s!='\n') {
//fkmer: grows from the right (LSB)
//rkmer: grows from the left (MSB)
fillKBuf(*s, fkmer, rkmer, last_unknown);
if (last_unknown >= K) {
if (fkmer <= rkmer) {
// Is fwd
auto m=mers.find(fkmer);
if (m!=mers.end()) ++m->second;
} else {
// Is bwd
auto m=mers.find(rkmer);
if (m!=mers.end()) ++m->second;
}
}
++s;
}
}
};
class KmerVectorCreator : public KMerFactory {
public:
explicit KmerVectorCreator(uint8_t k) : KMerFactory(k){}
inline std::vector<uint64_t> count_all_kmers(const char * seq){
// TODO: Adjust for when K is larger than what fits in uint64_t!
std::vector<uint64_t> v;
last_unknown=0;
fkmer=0;
rkmer=0;
auto s=seq;
while (*s!='\0' and *s!='\n') {
//fkmer: grows from the right (LSB)
//rkmer: grows from the left (MSB)
fillKBuf(*s, fkmer, rkmer, last_unknown);
if (last_unknown >= K) {
if (fkmer <= rkmer) {
// Is fwd
v.emplace_back(fkmer);
} else {
// Is bwd
v.emplace_back(rkmer);
}
}
++s;
}
return v;
}
};
class UncoveredKmerCounter : public KMerFactory {
public:
explicit UncoveredKmerCounter(uint8_t k, const std::unordered_set<uint64_t> & _kset) : KMerFactory(k),kset(_kset){}
inline uint64_t count_uncovered(const char * seq){
// TODO: Adjust for when K is larger than what fits in uint64_t!
last_unknown=0;
fkmer=0;
rkmer=0;
auto s=seq;
uint64_t uncovered=0;
while (*s!='\0' and *s!='\n') {
//fkmer: grows from the right (LSB)
//rkmer: grows from the left (MSB)
fillKBuf(*s, fkmer, rkmer, last_unknown);
if (last_unknown >= K) {
if (fkmer <= rkmer) {
if (kset.count(fkmer)==0) ++uncovered;
} else {
// Is bwd
if (kset.count(rkmer)==0) ++uncovered;
}
}
++s;
}
return uncovered;
}
const std::unordered_set<uint64_t> & kset;
};
struct Counter
{
struct value_type { template<typename T> value_type(const T&) { } };
void push_back(const value_type&) { ++count; }
size_t count = 0;
};
template<typename T1, typename T2>
size_t intersection_size(const T1& s1, const T2& s2)
{
Counter c;
set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::back_inserter(c));
return c.count;
}
size_t intersection_size_fast(const std::vector<bsg10xTag>& v1, const std::vector<bsg10xTag>& v2)
{
size_t s=0;
auto e1=v1.data()+v1.size();
auto e2=v2.data()+v2.size();
for (auto p1=v1.data(),p2=v2.data();p1<e1 and p2<e2;){
if (*p1==*p2) {
++s;
++p1;
++p2;
}
else if (*p1<*p2) ++p1;
else ++p2;
}
return s;
}
void LinkageUntangler::clear_node_selection() {
selected_nodes.clear();
selected_nodes.resize(ws.getGraph().nodes.size());
frontier_nodes.clear();
frontier_nodes.resize(ws.getGraph().nodes.size());
}
void LinkageUntangler::report_node_selection() {
SequenceGraph& sg(ws.getGraph());
uint64_t total_bp=0,total_count=0,selected_bp=0,selected_count=0;
for (auto n=1;n<sg.nodes.size();++n) {
if (sg.nodes[n].status == sgNodeDeleted) continue;
total_bp+=sg.nodes[n].sequence.size();
++total_count;
if (selected_nodes[n]) {
selected_bp += sg.nodes[n].sequence.size();
++selected_count;
}
}
sglib::OutputLog()<< "Current selection: "<<selected_count<<" / "<<total_count<<" nodes with "<<selected_bp<<" / "<<total_bp<<" bp"<<std::endl;
}
void LinkageUntangler::select_nodes_by_size_and_ci( uint64_t min_size, float min_ci, float max_ci) {
std::vector<sgNodeID_t> nodes;
sglib::OutputLog()<<"LU selecting nodes by size and ci: size >= " << min_size << " bp | " << min_ci << "<= CI <=" << max_ci <<std::endl;
#pragma omp parallel
{
SequenceGraph &sg(ws.getGraph());
#pragma omp for schedule(static, 100)
for (auto n = 1; n < sg.nodes.size(); ++n) {
if (sg.nodes[n].status == sgNodeDeleted) continue;
if (sg.nodes[n].sequence.size() < min_size) continue;
auto ci = ws.getKCI().compute_compression_for_node(n, 1);
if (std::isnan(ci) or ci < min_ci or ci > max_ci) continue;
#pragma omp critical(collect_selected_nodes)
selected_nodes[n] = true;
}
}
}
std::set<std::pair<sgNodeID_t, sgNodeID_t >> LinkageUntangler::get_HSPNPs(uint64_t min_size, float min_ci,
float max_ci) {
std::set<std::pair<sgNodeID_t, sgNodeID_t >> hspnps;
SequenceGraph& sg(ws.getGraph());
#pragma omp parallel for schedule(static, 100)
for (sgNodeID_t n = 1; n < sg.nodes.size(); ++n) {
if (sg.nodes[n].status == sgNodeDeleted) continue;
if (sg.nodes[n].sequence.size() < min_size) continue;
//FW check
auto fwl = sg.get_fw_links(n);
if (fwl.size() != 1) continue;
auto post = fwl[0].dest;
auto post_bwl = sg.get_bw_links(post);
if (post_bwl.size() != 2) continue;
if (llabs(post_bwl[0].dest)==llabs(post_bwl[1].dest))continue;
//BW check
auto bwl = sg.get_bw_links(n);
if (bwl.size() != 1) continue;
auto prev = bwl[0].dest;
auto prev_fwl = sg.get_bw_links(prev);
if (prev_fwl.size() != 2) continue;
if ((prev_fwl[0].dest == -post_bwl[0].dest and prev_fwl[1].dest == -post_bwl[1].dest)
or (prev_fwl[1].dest == -post_bwl[0].dest and prev_fwl[0].dest == -post_bwl[1].dest)) {
sgNodeID_t m;
if (llabs(prev_fwl[0].dest) != n and llabs(prev_fwl[1].dest) != n) std::cout<<"Error! cant find N in prev!"<<std::endl;
if (llabs(prev_fwl[0].dest) == n) m = llabs(prev_fwl[1].dest);
else m = prev_fwl[0].dest;
//Now evaluate coverage of the branches
auto c1 = ws.getKCI().compute_compression_for_node(n, 1);
if (std::isnan(c1) or c1<min_ci or c1>max_ci) continue;
auto c2 = ws.getKCI().compute_compression_for_node(m, 1);
if (std::isnan(c2) or c2<min_ci or c2>max_ci) continue;
#pragma omp critical(inserting_hspnps)
{
//hl<<(n<m ? n:m)<<" "<<(n<m ? m:n)<<std::endl;
if (n < llabs(m)) hspnps.insert(std::make_pair(n, m));
else hspnps.insert(std::make_pair(llabs(m), (m>0 ? n:-n)));
}
}
}
return hspnps;
}
void LinkageUntangler::select_nodes_by_HSPNPs(uint64_t min_size, float min_ci, float max_ci) {
auto hspnps=get_HSPNPs(min_size,min_ci,max_ci);
sglib::OutputLog() << "Selecting HSPNPs: " << hspnps.size() << " passed topology and CI" << std::endl;
for (auto p:hspnps) {
selected_nodes[llabs(p.first)] = true;
selected_nodes[llabs(p.second)] = true;
}
}
LinkageDiGraph LinkageUntangler::make_topology_linkage(int radius) {
LinkageDiGraph ldg(ws.getGraph());
for (auto m=1;m<ws.getGraph().nodes.size();++m) {
if (!selected_nodes[m]) continue;
for (auto n:{m,-m}) {
std::set<sgNodeID_t> reached, last = {n};
for (auto i = 0; i < radius; ++i) {
std::set<sgNodeID_t> new_last;
for (auto l:last) {
for (auto fwl:ws.getGraph().get_fw_links(l)) {
if (selected_nodes[llabs(fwl.dest)]) {
ldg.add_link(-n, fwl.dest, 0);
} else {
new_last.insert(fwl.dest);
}
}
}
std::swap(last, new_last);
}
}
}
return ldg;
}
LinkageDiGraph LinkageUntangler::make_paired_linkage(int min_reads) {
LinkageDiGraph ldg(ws.getGraph());
/*sglib::OutputLog()<<"filling orientation indexes"<<std::endl;
uint64_t revc=0,dirc=0,false_rev=0,false_dir=0,true_rev=0,true_dir=0;
std::vector<std::vector<bool>> orientation;
for (auto &pm:ws.paired_read_mappers){
orientation.emplace_back();
orientation.back().resize(pm.read_to_node.size());
for (auto n=1;n<ws.sg.nodes.size();++n)
for (auto &rm:pm.reads_in_node[n]) {
orientation.back()[rm.read_id]=rm.rev;
if (rm.first_pos<rm.last_pos){if (rm.rev) ++false_rev; else ++true_rev;};
if (rm.first_pos>rm.last_pos ){if (!rm.rev) ++false_dir; else ++true_dir;};
if (rm.rev) revc++;
else dirc++;
}
}
std::ofstream lof("paired_links.txt");
sglib::OutputLog()<<"FW: "<<dirc<<" ( "<<true_dir<<" - "<< false_dir<<" )"<<std::endl;
sglib::OutputLog()<<"BW: "<<revc<<" ( "<<true_rev<<" - "<< false_rev<<" )"<<std::endl;*/
std::map<std::pair<sgNodeID_t, sgNodeID_t>, uint64_t> lv;
sglib::OutputLog()<<"collecting link votes across all paired libraries"<<std::endl;
//use all libraries collect votes on each link
auto rmi=0;
for (auto &pm:ws.getPairedReadMappers()) {
for (auto i = 1; i < pm.read_to_node.size(); i += 2) {
sgNodeID_t n1 = pm.read_to_node[i];
sgNodeID_t n2 = pm.read_to_node[i + 1];
if (n1 == 0 or n2 == 0 or n1 == n2 or !selected_nodes[n1] or !selected_nodes[n2] ) continue;
if (pm.read_direction_in_node[i]) n1=-n1;
if (pm.read_direction_in_node[i+1]) n2=-n2;
if (llabs(n1) > llabs(n2)) std::swap(n1,n2);
++lv[std::make_pair(n1, n2)];
}
++rmi;
}
sglib::OutputLog()<<"adding links with "<<min_reads<<" votes"<<std::endl;
//std::vector<std::vector<std::pair<sgNodeID_t ,uint64_t>>> nodelinks(ws.sg.nodes.size());
for (auto l:lv) {
if (l.second>=min_reads){
//todo: size, appropriate linkage handling, etc
//todo: check alternative signs for same linkage
auto s=l.first.first;
auto d=l.first.second;
auto v1=std::make_pair(-s,d);
auto v2=std::make_pair(-s,-d);
auto v3=std::make_pair(s,-d);
if (lv.count(v1) and lv[v1]>5*l.second) continue;
if (lv.count(v2) and lv[v2]>5*l.second) continue;
if (lv.count(v3) and lv[v3]>5*l.second) continue;
ldg.add_link(l.first.first,l.first.second,0);
//lof<<l.first.first<<" "<<l.first.second<<" "<<l.second<<std::endl;
}
}
return ldg;
}
LinkageDiGraph LinkageUntangler::make_tag_linkage(int min_reads, float end_perc) {
SequenceGraph& sg(ws.getGraph());
std::vector<LinkedReadMapper>& linked_read_mappers(ws.getLinkedReadMappers());
//STEP 1 - identify candidates by simple tag-sharing.
LinkageDiGraph ldg(sg);
//Step 1 - tag neighbours.
sglib::OutputLog()<<"Getting tag neighbours"<<std::endl;
auto pass_sharing=linked_read_mappers[0].get_tag_neighbour_nodes(min_reads,selected_nodes);
sglib::OutputLog()<<"Node pairs with more than "<<min_reads<<" shared tags: "<<pass_sharing.size()<<std::endl;
//STEP 2 - confirm directionality
//2.a create link direction counts:
std::map<std::pair<sgNodeID_t, sgNodeID_t>, uint64_t> lv;
sglib::OutputLog()<<"collecting link votes across all paired libraries"<<std::endl;
//use all libraries collect votes on each link
auto rmi=0;
for (auto &pm:ws.getPairedReadMappers()) {
for (auto i = 1; i < pm.read_to_node.size(); i += 2) {
sgNodeID_t n1 = pm.read_to_node[i];
sgNodeID_t n2 = pm.read_to_node[i + 1];
if (n1 == 0 or n2 == 0 or n1 == n2 or !selected_nodes[n1] or !selected_nodes[n2] ) continue;
if (pm.read_direction_in_node[i]) n1=-n1;
if (pm.read_direction_in_node[i+1]) n2=-n2;
if (llabs(n1) > llabs(n2)) std::swap(n1,n2);
++lv[std::make_pair(n1, n2)];
}
++rmi;
}
std::set<std::pair<sgNodeID_t ,sgNodeID_t >> used;
for (auto p:pass_sharing) {
auto bf=lv[std::make_pair(-p.first,p.second)];
auto bb=lv[std::make_pair(-p.first,-p.second)];
auto ff=lv[std::make_pair(p.first,p.second)];
auto fb=lv[std::make_pair(p.first,-p.second)];
auto total=bf+bb+ff+fb;
float bfp=((float) bf)/total;
float bbp=((float) bb)/total;
float ffp=((float) ff)/total;
float fbp=((float) fb)/total;
if (bf>=3 and bfp>=.75) {
ldg.add_link(-p.first,p.second,0);
used.insert(p);
}
else if (bb>=3 and bbp>=.75) {
ldg.add_link(-p.first,-p.second,0);
used.insert(p);
}
else if (ff>=3 and ffp>=.75) {
ldg.add_link(p.first,p.second,0);
used.insert(p);
}
else if (fb>=3 and fbp>=.75) {
ldg.add_link(p.first,-p.second,0);
used.insert(p);
}
/*std::cout<<"Evaluating connection between "<<p.first<<" and "<<p.second<<": "
<<lv[std::make_pair(-p.first,p.second)]<<" "
<<lv[std::make_pair(-p.first,-p.second)]<<" "
<<lv[std::make_pair(p.first,p.second)]<<" "
<<lv[std::make_pair(p.first,-p.second)]<<std::endl;*/
}
//STEP 3 - Looking at disconnected ends on 1-0 and N-0 nodes
std::vector<sgNodeID_t> one_end_only;
uint64_t disc=0,ldisc=0,single=0,lsingle=0,both=0,lboth=0;
for (sgNodeID_t n=1;n<sg.nodes.size();++n) {
if (!selected_nodes[n]) continue;
auto blc=ldg.get_bw_links(n).size();
auto flc=ldg.get_fw_links(n).size();
if (blc==0 and flc==0){
++disc;
if (sg.nodes[n].sequence.size()>2000) ++ldisc;
}
else if (blc==0 or flc==0){
if (blc==0) one_end_only.push_back(-n);
else one_end_only.push_back(n);
++single;
if (sg.nodes[n].sequence.size()>2000) ++lsingle;
} else {
++both;
if (sg.nodes[n].sequence.size()>2000) ++lboth;
}
}
/*sglib::OutputLog()<<both<<" nodes with both-sides linkage ( "<<lboth<<" >2kbp )"<<std::endl;
sglib::OutputLog()<<single<<" nodes with one-side linkage ( "<<lsingle<<" >2kbp )"<<std::endl;
sglib::OutputLog()<<disc<<" nodes without linkage ( "<<ldisc<<" >2kbp )"<<std::endl;*/
ldg.report_connectivity();
sglib::OutputLog()<<"Attempting single-side reconnection through topology"<<std::endl;
auto tldg=make_topology_linkage(30);
#pragma omp parallel for
for (auto i=0; i<one_end_only.size();++i){
auto n=one_end_only[i];
//first look for the topology connection.
for (auto tfnl:tldg.get_fw_links(n)){
std::pair<sgNodeID_t, sgNodeID_t> pair;
pair.first=llabs(n);
pair.second=llabs(tfnl.dest);
if (pair.first>pair.second) std::swap(pair.first,pair.second);
for (auto ps:pass_sharing) if (ps==pair) {
#pragma omp critical (add_topo_link)
ldg.add_link(tfnl.source,tfnl.dest,0);
}
}
}
ldg.report_connectivity();
/*sglib::OutputLog()<<"Evaluating tag imbalance"<<std::endl;
for (auto p:pass_sharing) {
auto n1 = p.first;
auto n2 = p.second;
std::set<bsg10xTag> shared_tags;
std::set_intersection(node_tags[n1].begin(), node_tags[n1].end(), node_tags[n2].begin(), node_tags[n2].end(),
std::inserter(shared_tags, shared_tags.end()));
uint64_t n1_front_in = 0, n1_front_total = 0, n1_back_in = 0, n1_back_total = 0;
uint64_t n2_front_in = 0, n2_front_total = 0, n2_back_in = 0, n2_back_total = 0;
uint64_t n1first30point = ws.sg.nodes[n1].sequence.size() * end_perc;
uint64_t n1last30point = ws.sg.nodes[n1].sequence.size() * (1 - end_perc);
std::set<bsg10xTag> t1f,t1b,t2f,t2b,t1ft,t1bt,t2ft,t2bt;
for (auto rm:ws.linked_read_mappers[0].reads_in_node[n1]) {
if (rm.first_pos < n1first30point) {
++n1_front_total;
t1ft.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
if (shared_tags.count(ws.linked_read_datastores[0].get_read_tag(rm.read_id)) > 0) {
++n1_front_in;
t1f.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
}
}
if (rm.last_pos > n1last30point) {
++n1_back_total;
t1bt.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
if (shared_tags.count(ws.linked_read_datastores[0].get_read_tag(rm.read_id)) > 0) {
++n1_back_in;
t1b.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
}
}
}
auto n1f = (100.0 * n1_front_in / n1_front_total);
auto n1b = (100.0 * n1_back_in / n1_back_total);
uint64_t n2first30point = ws.sg.nodes[n2].sequence.size() * end_perc;
uint64_t n2last30point = ws.sg.nodes[n2].sequence.size() * (1 - end_perc);
for (auto rm:ws.linked_read_mappers[0].reads_in_node[n2]) {
if (rm.first_pos < n2first30point) {
++n2_front_total;
t2ft.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
if (shared_tags.count(ws.linked_read_datastores[0].get_read_tag(rm.read_id)) > 0) {
++n2_front_in;
t2f.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
}
}
if (rm.last_pos > n2last30point) {
++n2_back_total;
t2bt.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
if (shared_tags.count(ws.linked_read_datastores[0].get_read_tag(rm.read_id)) > 0) {
++n2_back_in;
t2b.insert(ws.linked_read_datastores[0].get_read_tag(rm.read_id));
}
}
}
auto n2f = (100.0 * n2_front_in / n2_front_total);
auto n2b = (100.0 * n2_back_in / n2_back_total);
if ( (ws.sg.nodes[llabs(n1)].sequence.size()>10000 and ws.sg.nodes[llabs(n2)].sequence.size()>10000) ){
std::cout<<"connection between "<<n1<<" and "<<n2<<" with "<<shared_tags.size()<<" tags: "<<n1f<<"("<<t1f.size()<<"):"<< n1b <<"("<<t1b.size()<<") <-> "<<n2f<<"("<<t2f.size()<<"):"<< n2b <<"("<<t2b.size()<<")"<<std::endl;
std::cout<<"F<->F: "<<intersection_size(t1f,t2f)<<" / "<<t1ft.size()<<":"<<t2ft.size();
std::cout<<" F<->B: "<<intersection_size(t1f,t2b)<<" / "<<t1ft.size()<<":"<<t2bt.size();
std::cout<<" B<->F: "<<intersection_size(t1b,t2f)<<" / "<<t1bt.size()<<":"<<t2ft.size();
std::cout<<" B<->B: "<<intersection_size(t1b,t2b)<<" / "<<t1bt.size()<<":"<<t2bt.size()<<std::endl;
}
if (fabs(2 * (n1f - n1b) / (n1f + n1b)) > .1 and fabs(2 * (n2f - n2b) / (n2f + n2b)) > .1) {
#pragma omp critical
++linked;
ldg.add_link((n1f > n1b ? n1 : -n1), (n2f > n2b ? n2 : -n2), 0);
}
}
sglib::OutputLog()<<"Links created (passing tag imbalance): "<<linked<<std::endl;*/
return ldg;
}
LinkageDiGraph LinkageUntangler::make_longRead_linkage() {
SequenceGraph& sg(ws.getGraph());
LinkageDiGraph ldg(sg);
// For each read link every node with every other coming forward in the correct direction,
// only using the canonical link direction (1,2) instead of (2,1)
std::map<std::pair<sgNodeID_t, sgNodeID_t>, uint64_t> lv;
sglib::OutputLog()<<"collecting link votes across all long read libraries"<<std::endl;
//use all libraries collect votes on each link
auto rmi=0;
for (LongReadMapper &lm:ws.getLongReadMappers()) {
for (auto r = 0UL; r < lm.read_to_mappings.size(); r++) { // For all reads
for (auto i = 0UL; !lm.read_to_mappings[r].empty() && i < lm.read_to_mappings[r].size() - 1; i++) { // All "forward" mappings
for (auto j = i + 1; j < lm.read_to_mappings[r].size(); j++) {
sgNodeID_t n1=lm.mappings[lm.read_to_mappings[r][i]].node;
sgNodeID_t n2=lm.mappings[lm.read_to_mappings[r][j]].node;
if (n1 == 0 or n2 == 0 or n1 == n2 or !selected_nodes[std::abs(n1)] or !selected_nodes[std::abs(n2)]) continue;
n1=-n1;//get the output end
if (llabs(n1) > llabs(n2)) std::swap(n1, n2);
++lv[std::make_pair(n1, n2)];
}
}
}
++rmi;
}
sglib::OutputLog()<<"adding links"<<std::endl;
for (auto l:lv) {
if (l.second >= 5) {
//todo: size, appropriate linkage handling, etc
//todo: check alternative signs for same linkage
auto s = l.first.first;
auto d = l.first.second;
auto v1 = std::make_pair(-s, d);
auto v2 = std::make_pair(-s, -d);
auto v3 = std::make_pair(s, -d);
if (lv.count(v1) and lv[v1] > 5 * l.second) continue;
if (lv.count(v2) and lv[v2] > 5 * l.second) continue;
if (lv.count(v3) and lv[v3] > 5 * l.second) continue;
ldg.add_link(l.first.first, l.first.second, 0);
}
}
return ldg;
}
LinkageDiGraph LinkageUntangler::filter_linkage_to_hspnp_duos(uint64_t min_size, float min_ci, float max_ci,
const LinkageDiGraph &ldg_old) {
SequenceGraph& sg(ws.getGraph());
std::unordered_map<sgNodeID_t,sgNodeID_t> node_to_parallel;
//1- get all hspnps -> create a map of parallels
LinkageDiGraph ldg_new(sg);
auto hspnps=get_HSPNPs(min_size,min_ci,max_ci);
for (auto h:hspnps) {
node_to_parallel[h.first]=h.second;
node_to_parallel[-h.first]=-h.second;
node_to_parallel[h.second]=h.first;
node_to_parallel[-h.second]=-h.first;
}
//2- hspnp -> look for links in one direction from one of the nodes, and same direction for the other
for (auto h:hspnps){
auto hr=h;
hr.first=-hr.first;
hr.second=-hr.second;
for (auto hspnp:{h,hr}) {
auto n1fs = ldg_old.get_fw_links(hspnp.first);
auto n2fs = ldg_old.get_fw_links(hspnp.second);
for (auto n1f:n1fs) {
for (auto n2f:n2fs) {
if (node_to_parallel.count(n1f.dest) and node_to_parallel[n1f.dest] == n2f.dest) {
// if links are to parts of the same node -> introduce linkage on newldg.
ldg_new.add_link(-hspnp.first, n1f.dest, 0);
ldg_new.add_link(-hspnp.second, n2f.dest, 0);
}
}
}
}
}
return ldg_new;
}
void LinkageUntangler::expand_trivial_repeats(const LinkageDiGraph & ldg) {
SequenceGraph& sg(ws.getGraph());
uint64_t aa=0,ab=0;
for (auto n=1;n<sg.nodes.size();++n) {
if (sg.nodes[n].status == sgNodeDeleted) continue;
//check node is 2-2
auto bwl=sg.get_bw_links(n);
if (bwl.size()!=2) continue;
auto fwl=sg.get_fw_links(n);
if (fwl.size()!=2) continue;
auto p1=-bwl[0].dest;
auto p2=-bwl[1].dest;
auto n1=fwl[0].dest;
auto n2=fwl[1].dest;
//check bw nodes have only one fw, is one of the fws and not the same
auto p1ll=ldg.get_fw_links(p1);
if (p1ll.size()!=1) continue;
auto p2ll=ldg.get_fw_links(p2);
if (p2ll.size()!=1) continue;
if (p1ll[0].dest==n1 and p2ll[0].dest==n2){
sg.expand_node(n,{{p1},{p2}},{{n1},{n2}});
++aa;
}
else if (p2ll[0].dest==n1 and p1ll[0].dest==n2) {
sg.expand_node(n,{{p1},{p2}},{{n2},{n1}});
++ab;
}
else continue;
}
sglib::OutputLog()<<"Repeat expansion: AA:"<<aa<<" AB:"<<ab<<std::endl;
}
void LinkageUntangler::expand_linear_regions(const LinkageDiGraph & ldg) {
std::vector<LinkedReadsDatastore>& linked_read_datastores(ws.getLinkedReadDatastores());
std::vector<LinkedReadMapper>& linked_read_mappers(ws.getLinkedReadMappers());
sglib::OutputLog()<<"Starting linear region expansion..."<<std::endl;
//sglib::OutputLog()<<"Looking for \"lines\"..."<<std::endl;
auto lines=ldg.get_all_lines(2);
sglib::OutputLog()<<"Creating tag sets for "<<lines.size()<<" linear regions"<<std::endl;
//sglib::OutputLog()<<"TODO: now use tags and LMPs to find paths between elements in the line"<<std::endl;
//sglib::OutputLog()<<"USING ONLY 10 lines as a test"<<std::endl;
//lines.resize(10);
//---------------------------------Step 1: get tagsets for lines.
std::vector<std::set<bsg10xTag>> linetagsets;
linetagsets.reserve(lines.size());
BufferedTagKmerizer btk(linked_read_datastores[0],31,100000,1000);
for (auto l:lines){
//sglib::OutputLog()<<"Analising line: ";
//for (auto &ln:l) std::cout<<"seq"<<llabs(ln)<<", ";
//for (auto &ln:l) std::cout<<ln<<" ";
//std::cout<<std::endl;
std::map<bsg10xTag ,std::pair<uint32_t , uint32_t >> tagcounts; //tag -> nodes, reads
for (auto &ln:l) {
std::map<bsg10xTag ,uint32_t> ntagcounts;
for (auto rm:linked_read_mappers[0].reads_in_node[llabs(ln)]){
auto tag=linked_read_datastores[0].get_read_tag(rm.read_id);
++ntagcounts[tag];
}
for (auto ntc:ntagcounts) {
++tagcounts[ntc.first].first;
tagcounts[ntc.first].second+=ntc.second;
}
}
std::map<bsg10xTag ,std::pair<uint32_t , uint32_t >> tagtotals;
std::set<bsg10xTag> lineTagSet;
for (auto tc:tagcounts) {
auto tag=tc.first;
auto reads=linked_read_datastores[0].get_tag_reads(tc.first);
std::set<sgNodeID_t> nodes;
for (auto r:reads) nodes.insert(linked_read_mappers[0].read_to_node[r]);
tagtotals[tag].first=nodes.size()-nodes.count(0);
tagtotals[tag].second=reads.size();
if (tc.second.first>1 and reads.size()<3000) lineTagSet.insert(tc.first);
}
linetagsets.push_back(lineTagSet);
if (linetagsets.size()%100==0) std::cout<<"."<<std::flush;
}
std::cout<<std::endl;
sglib::OutputLog()<<"Creating path collections to be evaluated for "<<lines.size()<<" linear regions"<<std::endl;
std::vector<std::vector<std::vector<SequenceGraphPath>>> alternatives;
uint64_t total_paths=0,found=0,evaluated=0;
alternatives.reserve(lines.size());
for (auto l:lines) {
alternatives.emplace_back();
for (auto i = 0; i < l.size() - 1; ++i) {
evaluated++;
auto from = l[i];
auto to = l[i + 1];
auto paths = ws.getGraph().find_all_paths_between(from, to, 400000, 20);
if (paths.size()>0) found++;
alternatives.back().emplace_back(paths);
total_paths+=paths.size();
//sglib::OutputLog() << paths.size() << " paths to go from " << from << " to " << to << std::endl;
}
if (alternatives.size()%100==0) std::cout<<"."<<std::flush;
}
std::cout<<std::endl;
sglib::OutputLog()<<"Junctions with possible paths: "<<found<<" / "<<evaluated<<std::endl;
sglib::OutputLog()<<"Total paths to evaluate: "<<total_paths<<std::endl;
//Now use a function that only counts coverage on the set of kmers from all paths collections for each line
//kmer_coverage_in_tagreads(&std::map<kmer, coverage> (init at 0), std::set<tag> linetagset);
std::cout << "creating and populating the maps as of now" << std::endl;
std::vector<std::unordered_map<uint64_t, uint32_t>> linekmercoverages;
linekmercoverages.resize(lines.size());
#pragma omp parallel
{
KmerMapCounter km_count(31);
KmerMapCreator km_create(31);
BufferedLRSequenceGetter blrsg(linked_read_datastores[0], 200000, 1000);
std::unordered_map<uint64_t, uint32_t> kmercoverages;
uint64_t done=0;
#pragma omp for schedule(static, 100)
for (auto i = 0; i < lines.size(); ++i) {
//map with all kmers of paths to be evaluated
kmercoverages.clear();
// size_t t=0;
// for (auto &alts:alternatives[i]) {
// for (auto &a:alts) {
// for (auto n:a.nodes) t += ws.sg.nodes[llabs(n)].sequence.size();
// }
// }
// kmercoverages.reserve(t);
for (auto &alts:alternatives[i]) {
for (auto &a:alts) {
for (auto n:a.getNodes()) {
km_create.create_all_kmers(ws.getGraph().nodes[llabs(n)].sequence.c_str(), kmercoverages);
}
}
}
for (auto &t:linetagsets[i]) {
for (auto rid:linked_read_datastores[0].get_tag_reads(t)) {
km_count.count_all_kmers(blrsg.get_read_sequence(rid), kmercoverages);
}
}
#pragma omp critical
linekmercoverages[i]=kmercoverages;
++done;
if (done % 100 == 0) std::cout << "." << std::flush;
//count from the tag's reads
//btk.get_tag_kmers()
}
}
std::cout<<"DONE"<<std::endl;
sglib::OutputLog()<<"evaluating alternative paths between each pair of adjacent nodes"<<std::endl;
KmerVectorCreator kvc(31);
uint64_t solved=0,none_covered=0,too_many_covered=0,no_paths=0;
GraphEditor ged(ws);
std::vector<SequenceGraphPath> sols;
for (auto i=0;i<lines.size();++i){
for (auto ia=0;ia<alternatives[i].size();++ia){
int best=-1;
bool too_many=false;
for (auto j=0;j<alternatives[i][ia].size();++j){
uint64_t missed=0;
for (auto n:alternatives[i][ia][j].getNodes()) {
for (auto x:kvc.count_all_kmers(ws.getGraph().nodes[llabs(n)].sequence.c_str())) {
if (linekmercoverages[i][x] < 8) ++missed;//TODO: maybe ask for more than 1 read coverage?
}
}
if (missed==0){
if (best==-1) {
best = j;
}
else {
too_many=true;
best = -1;
break;
}
}
}
//std::cout<<"Solution for line "<<i<<" jump #"<<ia<<": "<<best<<" / "<<alternatives[i][ia].size() <<std::endl;
if (best!=-1){
for (auto n:alternatives[i][ia][best].getNodes()) {
if (selected_nodes[llabs(n)]){
best=-1;
break;
}
}
}
if (best==-1) {
if (alternatives[i][ia].empty()) ++no_paths;
else if (too_many) ++too_many_covered;
else ++none_covered;
}
else {
++solved;
sols.emplace_back(ws.getGraph());
sols.back().getNodes().emplace_back(lines[i][ia]);
for (auto n:alternatives[i][ia][best].getNodes()) sols.back().getNodes().emplace_back(n);
sols.back().getNodes().emplace_back(lines[i][ia+1]);
}
}
}
std::cout<<"Solved: "<<solved<<" Too many covered paths: "<<too_many_covered<<" No covered paths: "<<none_covered<<" No paths found: "<<no_paths<<std::endl;
sglib::OutputLog()<<"Applying solutions in the graph"<<std::endl;
uint64_t applied=0;
for (auto s:sols) {
if (ged.detach_path(s)) ++applied;
}
sglib::OutputLog()<<applied<<" solutions applied"<<std::endl;
}
void LinkageUntangler::expand_linear_regions_skating(const LinkageDiGraph & ldg, int max_lines) {
std::vector<LinkedReadsDatastore>& linked_read_datastores(ws.getLinkedReadDatastores());
std::vector<LinkedReadMapper>& linked_read_mappers(ws.getLinkedReadMappers());
sglib::OutputLog()<<"Starting linear region consolidation via skating with line tag collection..."<<std::endl;
auto lines=ldg.get_all_lines(2);
if (max_lines>0) {
sglib::OutputLog()<<"USING ONLY "<<max_lines<< " lines as a test"<<std::endl;
lines.resize(max_lines);
}
sglib::OutputLog()<<"Creating tag sets for "<<lines.size()<<" linear regions"<<std::endl;
//---------------------------------Step 1: get tagsets for lines.
std::vector<std::set<bsg10xTag>> linetagsets;
linetagsets.reserve(lines.size());
BufferedTagKmerizer btk(linked_read_datastores[0],31,100000,1000);
for (auto l:lines){
//sglib::OutputLog()<<"Analising line: ";
//for (auto &ln:l) std::cout<<"seq"<<llabs(ln)<<", ";
//for (auto &ln:l) std::cout<<ln<<" ";
//std::cout<<std::endl;
std::map<bsg10xTag ,std::pair<uint32_t , uint32_t >> tagcounts; //tag -> nodes, reads
for (auto &ln:l) {
std::map<bsg10xTag ,uint32_t> ntagcounts;
for (auto rm:linked_read_mappers[0].reads_in_node[llabs(ln)]){
auto tag=linked_read_datastores[0].get_read_tag(rm.read_id);
++ntagcounts[tag];
}
for (auto ntc:ntagcounts) {
++tagcounts[ntc.first].first;
tagcounts[ntc.first].second+=ntc.second;
}
}
std::map<bsg10xTag ,std::pair<uint32_t , uint32_t >> tagtotals;
std::set<bsg10xTag> lineTagSet;
for (auto tc:tagcounts) {
auto tag=tc.first;
auto reads=linked_read_datastores[0].get_tag_reads(tc.first);
std::set<sgNodeID_t> nodes;
for (auto r:reads) nodes.insert(linked_read_mappers[0].read_to_node[r]);
tagtotals[tag].first=nodes.size()-nodes.count(0);
tagtotals[tag].second=reads.size();
if (tc.second.first>1 and reads.size()<3000) lineTagSet.insert(tc.first);
}
linetagsets.push_back(lineTagSet);
if (linetagsets.size()%100==0) std::cout<<"."<<std::flush;
}
std::cout<<std::endl;
uint64_t jc=0;
for (auto &l:lines) jc+=l.size()-1;
sglib::OutputLog()<<"Skating across "<<jc<<" junctions in "<<lines.size()<<" linear regions"<<std::endl;
std::vector<SequenceGraphPath> sols;
#pragma omp parallel
{
BufferedLRSequenceGetter blrsg(linked_read_datastores[0], 200000, 1000);
std::vector<SequenceGraphPath> tsols;
uint64_t donelines=0;
#pragma omp for schedule(dynamic,1)
for (auto i=0; i<lines.size(); ++i){
//std::cout<<"Creating kmer set for line"<<i<<" from tags"<<std::endl;
auto ltkmers=linked_read_datastores[0].get_tags_kmers(31,3,linetagsets[i],blrsg);
//std::cout<<"Line kmer set has "<<ltkmers.size()<<" kmers"<<std::endl;
UncoveredKmerCounter ukc(31,ltkmers);
//std::cout<<"Evaluating paths for "<<lines[i].size()-1<<" junctions"<<std::endl;
for (auto j=0;j<lines[i].size()-1;++j){
auto from=lines[i][j];
auto to=lines[i][j+1];
//std::cout<<std::endl<<std::endl<<"Junction #"<<j+1<<" from "<<from<<" to "<<to<<std::endl;
std::vector<std::vector<sgNodeID_t>> skated_paths;
skated_paths.push_back({from});
int max_nodes=50;
while (--max_nodes and not skated_paths.empty()){
//std::cout<<std::endl<<"expansion round starting with "<<skated_paths.size()<<" paths "<<std::endl;
auto old_skated=skated_paths;
skated_paths.clear();
bool loop=false,crosstalk=false;
for (auto p:old_skated) {
if (p.back()==to) {
skated_paths.push_back(p);
continue;
}
//std::cout<<" expanding fw from node "<<p.back()<<std::endl;
for (auto fwl:ws.getGraph().get_fw_links(p.back())) {
//std::cout<<" considering fwl to "<<fwl.dest<<std::endl;
if (std::count(p.begin(),p.end(),fwl.dest)>0 or std::count(p.begin(),p.end(),-fwl.dest)>0){
loop=true;
//std::cout<<"loop detected, aborting junction analysis"<<std::endl;
break;
}
auto u=ukc.count_uncovered(ws.getGraph().nodes[llabs(fwl.dest)].sequence.c_str());
//std::cout<<" Uncovered kmers in "<<fwl.dest<<" ("<<ws.sg.nodes[llabs(fwl.dest)].sequence.size()<<" bp): "
// <<u<<std::endl;
if ( u == 0) {
//check for a path that reaches a selected node that is not connected here
if (selected_nodes[llabs(fwl.dest)] and fwl.dest!=to) {
crosstalk=true;
break;
}
//std::cout<<" path can continue in node"<<fwl.dest<<std::endl;
skated_paths.push_back(p);
skated_paths.back().push_back(fwl.dest);
}
}
}
if (loop or crosstalk) {
skated_paths.clear();
break;
}
}
uint64_t complete=0,incomplete=0;
for (auto p:skated_paths) {
if (p.back()==to) ++complete;
else ++incomplete;
}
if (complete==1 and incomplete==0) tsols.emplace_back(SequenceGraphPath(ws.getGraph(),skated_paths[0]));
//std::cout<<"Skating line #"<<i+1<<" junction #"<<j+1<<" produced "<<complete<<" complete paths and "<<incomplete<<" possibly incomplete paths"<<std::endl;
}
if (++donelines%100==0) std::cout<<"."<<std::flush;
}
#pragma omp critical
sols.insert(sols.end(),tsols.begin(),tsols.end());
}
sglib::OutputLog()<<"Applying "<<sols.size()<<" solutions in the graph"<<std::endl;
GraphEditor ged(ws);
uint64_t applied=0;
for (auto s:sols) {
if (ged.detach_path(s)) ++applied;
}
sglib::OutputLog()<<applied<<" solutions applied"<<std::endl;
} | 43.877682 | 233 | 0.541351 | [
"vector"
] |
855385c98cbae7f9d772a3ac9068e350b7e4e35c | 3,636 | hpp | C++ | src/cmd/kits/util/RandomBase.hpp | lslersch/zero | ab779235f3c3bf58d6a3aa9d2a0a5296578ee498 | [
"Spencer-94"
] | 27 | 2015-04-21T08:52:37.000Z | 2022-03-18T03:38:58.000Z | src/cmd/kits/util/RandomBase.hpp | lslersch/zero | ab779235f3c3bf58d6a3aa9d2a0a5296578ee498 | [
"Spencer-94"
] | 24 | 2015-07-04T10:45:41.000Z | 2018-05-03T08:52:36.000Z | include/Lintel/RandomBase.hpp | sbu-fsl/Lintel | b9e603aaec630c8d3fae2f21fc156582d11d84c9 | [
"BSD-3-Clause"
] | 15 | 2015-03-31T09:57:10.000Z | 2021-06-09T13:44:58.000Z | #ifndef LINTEL_RANDOM_BASE_HPP
#define LINTEL_RANDOM_BASE_HPP
#include <stdint.h>
#include <vector>
#ifndef UINT32_MAX
#define UINT32_MAX (0xFFFFFFF)
#endif
namespace lintel {
template <class R>
class RandomTempl : public R{
public:
RandomTempl(uint32_t seed = 0) : R(seed), boolShift(0), boolState(0) {
}
RandomTempl(std::vector<uint32_t> seed_array) : R(seed_array), boolShift(0), boolState(0) {
}
~RandomTempl() { }
inline void init(uint32_t seed) {
R::init(seed);
}
inline void initArray(std::vector<uint32_t> seed_array) {
R::initArray(seed_array);
}
inline uint32_t randInt() {
return R::randInt();
}
inline unsigned long long randLongLong() {
unsigned long long ret;
ret = randInt();
ret = ret << 32;
ret = ret | randInt();
return ret;
}
// Slightly biased
inline uint32_t randInt(uint32_t max) {
return randInt() % max;
}
inline uint32_t randIntUnbiased(uint32_t max) {
do {
uint32_t res = randInt();
if (UINT32_MAX-max > res) {
//Quick test to handle most cases
return res % max;
} else if ((UINT32_MAX / max) * max > res) {
//Slow test to handle the biased corner
return res % max;
}
} while (1);
}
// randDouble() gives you doubles with 32 bits of randomness.
// randLongDouble() gives you doubles with ~53 bits of randomness
// *Open() gives values in [0,1)
// *Closed() gives values in [0,1]
// HP-UX aCC won't let me define these as const double;
// const double foo = 5.0 reports error 481.
#define MTR_int_to_open (1.0/4294967296.0)
#define MTR_int_to_closed (1.0/4294967295.0)
#define MTR_AMult (67108864.0) // 2^(32-6)
// 9007199254740992 = 2^53, 9007199254740991 = 2^53 -1
#define MTR_53bits_to_open(a,b) ((a * MTR_AMult + b)/9007199254740992.0)
#define MTR_53bits_to_closed(a,b) ((a * MTR_AMult + b)/9007199254740991.0)
inline double randDoubleOpen() { // in [0,1), 32 bits of randomness
return (double)randInt() * MTR_int_to_open;
}
inline double randDoubleClosed() { // in [0,1], 32 bits of randomness
return (double)randInt() * MTR_int_to_closed;
}
inline double randDouble() { // in [0,1), 32 bits of randomness
return randDoubleOpen();
}
// casting a long long to double is unbelievably slow on pa2.0 aCC C.03.30
inline double randDoubleOpen53() { // in [0,1), 53 bits of randomness
uint32_t a=randInt()>>5, b=randInt()>>6;
return MTR_53bits_to_open(a,b);
}
inline double randDoubleClosed53() { // in [0,1]
uint32_t a=randInt()>>5, b=randInt()>>6;
return MTR_53bits_to_closed(a,b);
}
inline bool randBool() {
return (randInt() & 0x1) ? true : false;
}
inline bool randBoolFast() {
if (boolShift==0) {
boolState = randLongLong();
boolShift = 64;
}
bool ret = boolState & 0x1;
boolState >>= 1;
--boolShift;
return ret;
}
protected:
uint8_t boolShift;
uint64_t boolState;
};
};
#endif
| 30.813559 | 99 | 0.531903 | [
"vector"
] |
8558e36c22143799f009fbf0406f354632ee5f85 | 2,471 | cpp | C++ | Source/Core/RenderAPI/VulkanAPI/Interface/ShaderVk.cpp | Cube219/CubeEngine_old2 | d251d540a4fdbc993ec5c9183eb30ac4dc81d5be | [
"MIT"
] | null | null | null | Source/Core/RenderAPI/VulkanAPI/Interface/ShaderVk.cpp | Cube219/CubeEngine_old2 | d251d540a4fdbc993ec5c9183eb30ac4dc81d5be | [
"MIT"
] | null | null | null | Source/Core/RenderAPI/VulkanAPI/Interface/ShaderVk.cpp | Cube219/CubeEngine_old2 | d251d540a4fdbc993ec5c9183eb30ac4dc81d5be | [
"MIT"
] | null | null | null | #include "ShaderVk.h"
#include "DeviceVk.h"
#include "../VulkanTypeConversion.h"
#include "../Tools/GLSLTool.h"
#include "EngineCore/Assertion.h"
namespace cube
{
namespace render
{
ShaderVk::ShaderVk(DeviceVk& device, const ShaderAttribute& attr) :
Shader(attr),
mEntryPoint(attr.entryPoint)
{
switch(attr.language) {
case ShaderLanguage::GLSL: LoadFromGLSL(attr); break;
case ShaderLanguage::HLSL: LoadFromHLSL(attr); break;
case ShaderLanguage::SPIRV: LoadFromSPIRV(attr); break;
default: ASSERTION_FAILED("Unknown ShaderLanguage ({0}).", (Uint32)attr.type);
}
VkShaderModuleCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
info.pNext = nullptr;
info.flags = 0;
info.codeSize = mSPIRV.size() * sizeof(Uint32);
info.pCode = mSPIRV.data();
mShaderModule = device.GetLogicalDevice()->CreateVkShaderModuleWrapper(info, attr.debugName);
// Create pipeline shader stage info
mShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
mShaderStageInfo.pNext = nullptr;
mShaderStageInfo.flags = 0;
mShaderStageInfo.pSpecializationInfo = nullptr; // TODO: 차후 구현?
switch(attr.type) {
case ShaderType::Vertex: mShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT; break;
case ShaderType::Pixel: mShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT; break;
case ShaderType::Geometry: mShaderStageInfo.stage = VK_SHADER_STAGE_GEOMETRY_BIT; break;
case ShaderType::Hull: mShaderStageInfo.stage = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; break;
case ShaderType::Domain: mShaderStageInfo.stage = VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; break;
case ShaderType::Compute: mShaderStageInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT; break;
default: ASSERTION_FAILED("Unknown ShaderType ({0}).", (Uint32)attr.type);
}
mShaderStageInfo.pName = mEntryPoint.data();
mShaderStageInfo.module = mShaderModule.mObject;
}
ShaderVk::~ShaderVk()
{
mShaderModule.Release();
}
void ShaderVk::LoadFromGLSL(const ShaderAttribute& attr)
{
mSPIRV = GLSLTool::ToSPIRV(attr.type, attr.code);
}
void ShaderVk::LoadFromHLSL(const ShaderAttribute& attr)
{
ASSERTION_FAILED("Loading HLSL shader is not supported yet.");
}
void ShaderVk::LoadFromSPIRV(const ShaderAttribute& attr)
{
ASSERTION_FAILED("Loading SPIR-V shader is not supported yet.");
}
} // namespace render
} // namespace cube
| 33.849315 | 107 | 0.74221 | [
"geometry",
"render"
] |
856377248592cb23351bbbb6801ee947d6031d4f | 1,505 | cpp | C++ | acmicpc.net/BurritoKing.cpp | facug91/OJ-Solutions | 9aa55be066ce5596e4e64737c28cd3ff84e092fe | [
"Apache-2.0"
] | 6 | 2016-09-10T03:16:34.000Z | 2020-04-07T14:45:32.000Z | acmicpc.net/BurritoKing.cpp | facug91/OJ-Solutions | 9aa55be066ce5596e4e64737c28cd3ff84e092fe | [
"Apache-2.0"
] | null | null | null | acmicpc.net/BurritoKing.cpp | facug91/OJ-Solutions | 9aa55be066ce5596e4e64737c28cd3ff84e092fe | [
"Apache-2.0"
] | 2 | 2018-08-11T20:55:35.000Z | 2020-01-15T23:23:11.000Z | /*
By: facug91
From: https://www.acmicpc.net/problem/10590
Name: Burrito King
Date: 27/05/2015
*/
#include <bits/stdc++.h>
#define EPS 1e-9
#define DEBUG(x) cerr << "#" << (#x) << ": " << (x) << endl
const double PI = 2.0*acos(0.0);
#define INF 1000000000
//#define MOD 1000000007ll
//#define MAXN 10000100
using namespace std;
typedef long long ll;
typedef pair<int, int> ii; typedef pair<int, ii> iii;
typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii;
ll n, g[100005], a[100005], b[100005];
double ma, mb, acta, actb, mg, ans[100005];
vector<pair<double, int> > ratio;
int main () {
//ios_base::sync_with_stdio(0); cin.tie(0);
cout<<fixed<<setprecision(9); //cerr<<fixed<<setprecision(10); //cin.ignore(INT_MAX, ' '); //cout << setfill('0') << setw(5) << 25
int i, j;
cin>>n>>ma>>mb;
for (i=0; i<n; i++) {
cin>>g[i]>>a[i]>>b[i];
if (a[i] == 0) continue;
ratio.push_back(make_pair((double)b[i]/(double)a[i], i));
}
sort(ratio.begin(), ratio.end());
acta = actb = 0.0;
memset(ans, 0, sizeof ans);
for (i=0; i<ratio.size(); i++) {
j = ratio[i].second;
mg = (double)g[j];
if ((b[j] != 0) && (b[j]*mg > mb-actb)) mg = (mb-actb)/(double)b[j];
acta += a[j]*mg;
actb += b[j]*mg;
ans[j] = mg;
}
if (ma > acta) cout<<"-1 -1\n";
else {
cout<<acta<<" "<<actb<<"\n";
cout<<ans[0];
for (i=1; i<n; i++) cout<<" "<<ans[i];
cout<<"\n";
}
return 0;
}
| 25.948276 | 132 | 0.542193 | [
"vector"
] |
8564786515fc39337b58e9ebdefed7b4bc1a8932 | 8,421 | cpp | C++ | src/meta/test/copy_replica_operation_test.cpp | acelyc111/rdsn | 298769147750167949af800b96d5b9dcdfab0aeb | [
"MIT"
] | 149 | 2017-10-16T03:24:58.000Z | 2022-03-25T02:29:13.000Z | src/meta/test/copy_replica_operation_test.cpp | acelyc111/rdsn | 298769147750167949af800b96d5b9dcdfab0aeb | [
"MIT"
] | 297 | 2017-10-19T03:23:34.000Z | 2022-03-17T08:00:12.000Z | src/meta/test/copy_replica_operation_test.cpp | acelyc111/rdsn | 298769147750167949af800b96d5b9dcdfab0aeb | [
"MIT"
] | 63 | 2017-10-19T01:55:27.000Z | 2022-03-09T11:09:00.000Z | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include <gtest/gtest.h>
#include <dsn/utility/fail_point.h>
#include "meta/app_balance_policy.h"
namespace dsn {
namespace replication {
TEST(copy_primary_operation, misc)
{
int32_t app_id = 1;
dsn::app_info info;
info.app_id = app_id;
info.partition_count = 4;
std::shared_ptr<app_state> app = app_state::create(info);
app_mapper apps;
apps[app_id] = app;
auto addr1 = rpc_address(1, 1);
auto addr2 = rpc_address(1, 2);
auto addr3 = rpc_address(1, 3);
node_mapper nodes;
node_state ns1;
ns1.put_partition(gpid(app_id, 2), true);
ns1.put_partition(gpid(app_id, 0), false);
nodes[addr1] = ns1;
node_state ns2;
ns2.put_partition(gpid(app_id, 0), true);
ns2.put_partition(gpid(app_id, 1), true);
nodes[addr2] = ns2;
node_state ns3;
ns3.put_partition(gpid(app_id, 2), false);
nodes[addr3] = ns3;
std::vector<dsn::rpc_address> address_vec{addr1, addr2, addr3};
std::unordered_map<dsn::rpc_address, int> address_id;
address_id[addr1] = 0;
address_id[addr2] = 1;
address_id[addr3] = 2;
copy_primary_operation op(app, apps, nodes, address_vec, address_id, false, 0);
/**
* Test init_ordered_address_ids
*/
op.init_ordered_address_ids();
ASSERT_EQ(op._ordered_address_ids.size(), 3);
ASSERT_EQ(*op._ordered_address_ids.begin(), 2);
ASSERT_EQ(*(++op._ordered_address_ids.begin()), 0);
ASSERT_EQ(*op._ordered_address_ids.rbegin(), 1);
ASSERT_EQ(op._partition_counts[0], 1);
ASSERT_EQ(op._partition_counts[1], 2);
ASSERT_EQ(op._partition_counts[2], 0);
/**
* Test get_all_partitions
*/
auto partitions = op.get_all_partitions();
ASSERT_EQ(partitions->size(), 2);
ASSERT_EQ(*partitions->begin(), gpid(app_id, 0));
ASSERT_EQ(*partitions->rbegin(), gpid(app_id, 1));
/**
* Test select_partition
*/
std::string disk1 = "disk1", disk2 = "disk2";
disk_load load;
load[disk1] = 2;
load[disk2] = 6;
op._node_loads[addr2] = load;
serving_replica serving_partition0;
serving_partition0.node = addr2;
serving_partition0.disk_tag = disk1;
app->helpers->contexts[0].serving.push_back(serving_partition0);
serving_replica serving_partition1;
serving_partition1.node = addr2;
serving_partition1.disk_tag = disk2;
app->helpers->contexts[1].serving.push_back(serving_partition1);
migration_list list;
auto res_gpid = op.select_partition(&list);
ASSERT_EQ(res_gpid.get_partition_index(), 1);
/**
* Test can_continue
**/
op._have_lower_than_average = true;
ASSERT_FALSE(op.can_continue());
op._have_lower_than_average = false;
ASSERT_TRUE(op.can_continue());
op._have_lower_than_average = true;
op._replicas_low = 1;
ASSERT_TRUE(op.can_continue());
op._replicas_low = 0;
nodes[addr2].remove_partition(gpid(app_id, 1), false);
op.init_ordered_address_ids();
ASSERT_FALSE(op.can_continue());
nodes[addr2].put_partition(gpid(app_id, 1), true);
/**
* Test update_ordered_address_ids
*/
nodes[addr1].put_partition(gpid(app_id, 3), true);
nodes[addr2].put_partition(gpid(app_id, 4), true);
nodes[addr2].put_partition(gpid(app_id, 5), true);
op.init_ordered_address_ids();
op.update_ordered_address_ids();
ASSERT_EQ(op._ordered_address_ids.size(), 3);
ASSERT_EQ(*op._ordered_address_ids.begin(), 2);
ASSERT_EQ(*(++op._ordered_address_ids.begin()), 0);
ASSERT_EQ(*op._ordered_address_ids.rbegin(), 1);
ASSERT_EQ(op._partition_counts[0], 2);
ASSERT_EQ(op._partition_counts[1], 3);
ASSERT_EQ(op._partition_counts[2], 1);
/**
* Test copy_once
*/
fail::setup();
fail::cfg("generate_balancer_request", "return()");
gpid gpid1(1, 0);
gpid gpid2(1, 1);
list.clear();
op.copy_once(gpid1, &list);
ASSERT_EQ(list.size(), 1);
ASSERT_EQ(list.count(gpid1), 1);
ASSERT_EQ(list.count(gpid2), 0);
fail::teardown();
}
TEST(copy_primary_operation, can_select)
{
app_mapper apps;
node_mapper nodes;
std::vector<dsn::rpc_address> address_vec;
std::unordered_map<dsn::rpc_address, int> address_id;
copy_primary_operation op(nullptr, apps, nodes, address_vec, address_id, false, false);
gpid cannot_select_gpid(1, 1);
gpid can_select_gpid(1, 2);
migration_list list;
list[cannot_select_gpid] = nullptr;
ASSERT_FALSE(op.can_select(cannot_select_gpid, &list));
ASSERT_TRUE(op.can_select(can_select_gpid, &list));
}
TEST(copy_primary_operation, only_copy_primary)
{
app_mapper apps;
node_mapper nodes;
std::vector<dsn::rpc_address> address_vec;
std::unordered_map<dsn::rpc_address, int> address_id;
copy_primary_operation op(nullptr, apps, nodes, address_vec, address_id, false, false);
ASSERT_TRUE(op.only_copy_primary());
}
TEST(copy_secondary_operation, misc)
{
int32_t app_id = 1;
dsn::app_info info;
info.app_id = app_id;
info.partition_count = 4;
std::shared_ptr<app_state> app = app_state::create(info);
app_mapper apps;
apps[app_id] = app;
auto addr1 = rpc_address(1, 1);
auto addr2 = rpc_address(1, 2);
auto addr3 = rpc_address(1, 3);
node_mapper nodes;
node_state ns1;
ns1.put_partition(gpid(app_id, 2), true);
ns1.put_partition(gpid(app_id, 0), false);
nodes[addr1] = ns1;
node_state ns2;
ns2.put_partition(gpid(app_id, 0), true);
ns2.put_partition(gpid(app_id, 1), true);
nodes[addr2] = ns2;
node_state ns3;
nodes[addr3] = ns3;
std::vector<dsn::rpc_address> address_vec{addr1, addr2, addr3};
std::unordered_map<dsn::rpc_address, int> address_id;
address_id[addr1] = 0;
address_id[addr2] = 1;
address_id[addr3] = 2;
copy_secondary_operation op(app, apps, nodes, address_vec, address_id, 0);
op.init_ordered_address_ids();
/**
* Test copy_secondary_operation::get_partition_count
*/
ASSERT_EQ(op.get_partition_count(ns1), 2);
ASSERT_EQ(op.get_partition_count(ns2), 2);
ASSERT_EQ(op.get_partition_count(ns3), 0);
/**
* Test copy_secondary_operation::can_continue
*/
auto res = op.can_continue();
ASSERT_TRUE(res);
op._replicas_low = 100;
res = op.can_continue();
ASSERT_FALSE(res);
op._replicas_low = 0;
nodes[addr3].put_partition(gpid(app_id, 2), false);
op.init_ordered_address_ids();
res = op.can_continue();
ASSERT_FALSE(res);
nodes[addr3].remove_partition(gpid(app_id, 2), false);
/**
* Test copy_secondary_operation::can_select
*/
nodes[addr1].put_partition(gpid(app_id, 3), true);
op.init_ordered_address_ids();
migration_list list;
res = op.can_select(gpid(app_id, 3), &list);
ASSERT_FALSE(res);
auto secondary_gpid = gpid(app_id, 0);
list[secondary_gpid] = nullptr;
res = op.can_select(secondary_gpid, &list);
ASSERT_FALSE(res);
list.clear();
nodes[addr3].put_partition(secondary_gpid, true);
op.init_ordered_address_ids();
res = op.can_select(secondary_gpid, &list);
ASSERT_FALSE(res);
nodes[addr3].remove_partition(secondary_gpid, false);
op.init_ordered_address_ids();
res = op.can_select(secondary_gpid, &list);
ASSERT_TRUE(res);
/**
* Test copy_secondary_operation::get_balance_type
*/
ASSERT_EQ(op.get_balance_type(), balance_type::COPY_SECONDARY);
/**
* Test copy_secondary_operation::only_copy_primary
*/
ASSERT_FALSE(op.only_copy_primary());
}
} // namespace replication
} // namespace dsn
| 30.733577 | 91 | 0.684479 | [
"vector"
] |
8573892c9ef23e590a887097e229850d4c384d95 | 8,261 | cpp | C++ | Samples/Win7Samples/winui/WindowsRibbon/Gallery/CPP/ShapeHandler.cpp | windows-development/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | 8 | 2017-04-30T17:38:27.000Z | 2021-11-29T00:59:03.000Z | Samples/Win7Samples/winui/WindowsRibbon/Gallery/CPP/ShapeHandler.cpp | TomeSq/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | null | null | null | Samples/Win7Samples/winui/WindowsRibbon/Gallery/CPP/ShapeHandler.cpp | TomeSq/Windows-classic-samples | 96f883e4c900948e39660ec14a200a5164a3c7b7 | [
"MIT"
] | 2 | 2020-08-11T13:21:49.000Z | 2021-09-01T10:41:51.000Z | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
#include "ShapeHandler.h"
#include "PropertySet.h"
#include "Renderer.h"
#include "Resource.h"
#include "RibbonFramework.h"
#include <uiribbonpropertyhelpers.h>
extern CRenderer g_renderer;
//
// FUNCTION: Execute()
//
// PURPOSE: Called by the Ribbon framework when the user selects or hovers over a new shape.
//
// COMMENTS:
// This will update the type of shape being displayed.
//
//
STDMETHODIMP CShapeHandler::Execute(UINT nCmdID,
UI_EXECUTIONVERB verb,
__in_opt const PROPERTYKEY* key,
__in_opt const PROPVARIANT* ppropvarValue,
__in_opt IUISimplePropertySet* pCommandExecutionProperties)
{
UNREFERENCED_PARAMETER(nCmdID);
UNREFERENCED_PARAMETER(pCommandExecutionProperties);
HRESULT hr = E_FAIL;
RenderParam param;
g_renderer.GetRenderParam(¶m);
UINT selected;
hr = UIPropertyToUInt32(*key, *ppropvarValue, &selected);
switch (verb)
{
case UI_EXECUTIONVERB_PREVIEW:
// Show a preview of a new shape.
param.eShapeType = (SHAPE_TYPE)selected;
g_renderer.UpdateRenderParam(param);
hr = S_OK;
break;
case UI_EXECUTIONVERB_CANCELPREVIEW:
// Show the shape that was selected before the preview- ppropvarValue contains the previous selected item.
// Note that the renderer did not have to store the value from before preview was called.
param.eShapeType = (SHAPE_TYPE)selected;
g_renderer.UpdateRenderParam(param);
hr = S_OK;
break;
case UI_EXECUTIONVERB_EXECUTE:
if ( key && *key == UI_PKEY_SelectedItem)
{
// Update the renderer with the newly-selected shape.
param.eShapeType = (SHAPE_TYPE)selected;
g_renderer.UpdateRenderParam(param);
hr = S_OK;
}
}
return hr;
}
//
// FUNCTION: UpdateProperty()
//
// PURPOSE: Called by the Ribbon framework when a command property (PKEY) needs to be updated.
//
// COMMENTS:
//
// This function is used to initialize the contents and selection of the gallery.
//
//
STDMETHODIMP CShapeHandler::UpdateProperty(UINT nCmdID,
__in REFPROPERTYKEY key,
__in_opt const PROPVARIANT* ppropvarCurrentValue,
__out PROPVARIANT* ppropvarNewValue)
{
UNREFERENCED_PARAMETER(nCmdID);
HRESULT hr = E_FAIL;
if(key == UI_PKEY_Categories)
{
// A return value of S_FALSE or E_NOTIMPL will result in a gallery with no categories.
// If you return any error other than E_NOTIMPL, the contents of the gallery will not display.
hr = S_FALSE;
}
else if (key == UI_PKEY_ItemsSource)
{
IUICollection* pCollection;
hr = ppropvarCurrentValue->punkVal->QueryInterface(IID_PPV_ARGS(&pCollection));
if (FAILED(hr))
{
return hr;
}
int imageIds[4];
int labelIds[] = {IDS_RECTANGLE, IDS_ELLIPSE, IDS_ROUNDED_RECTANGLE, IDS_DIAMOND};
int dpi = GetDeviceCaps(GetDC(NULL), LOGPIXELSX);
if (dpi > 144)
{
imageIds[0] = IDB_RECTANGLE_192;
imageIds[1] = IDB_ELLIPSE_192;
imageIds[2] = IDB_ROUNDED_RECTANGLE_192;
imageIds[3] = IDB_DIAMOND_192;
}
else if (dpi > 120)
{
imageIds[0] = IDB_RECTANGLE_144;
imageIds[1] = IDB_ELLIPSE_144;
imageIds[2] = IDB_ROUNDED_RECTANGLE_144;
imageIds[3] = IDB_DIAMOND_144;
}
else if (dpi > 96)
{
imageIds[0] = IDB_RECTANGLE_120;
imageIds[1] = IDB_ELLIPSE_120;
imageIds[2] = IDB_ROUNDED_RECTANGLE_120;
imageIds[3] = IDB_DIAMOND_120;
}
else
{
imageIds[0] = IDB_RECTANGLE_96;
imageIds[1] = IDB_ELLIPSE_96;
imageIds[2] = IDB_ROUNDED_RECTANGLE_96;
imageIds[3] = IDB_DIAMOND_96;
}
// Populate the gallery with the four available shape types.
for (int i=0; i<_countof(labelIds); i++)
{
// Create a new property set for each item.
CPropertySet* pItem;
hr = CPropertySet::CreateInstance(&pItem);
if (FAILED(hr))
{
pCollection->Release();
return hr;
}
// Create an IUIImage from a resource id.
IUIImage* pImg;
hr = CreateUIImageFromBitmapResource(MAKEINTRESOURCE(imageIds[i]), &pImg);
if (FAILED(hr))
{
pCollection->Release();
pItem->Release();
return hr;
}
// Load the label from the resource file.
WCHAR wszLabel[MAX_RESOURCE_LENGTH];
LoadString(GetModuleHandle(NULL), labelIds[i], wszLabel, MAX_RESOURCE_LENGTH);
// Initialize the property set with the image and label that were just loaded and no category.
pItem->InitializeItemProperties(pImg, wszLabel, UI_COLLECTION_INVALIDINDEX);
// Add the newly-created property set to the collection supplied by the framework.
pCollection->Add(pItem);
pImg->Release();
pItem->Release();
}
pCollection->Release();
hr = S_OK;
}
else if (key == UI_PKEY_SelectedItem)
{
// Use the current shape as the selection.
RenderParam param;
g_renderer.GetRenderParam(¶m);
hr = UIInitPropertyFromUInt32(UI_PKEY_SelectedItem, param.eShapeType, ppropvarNewValue);
}
return hr;
}
// Factory method to create IUIImages from resource identifiers.
HRESULT CShapeHandler::CreateUIImageFromBitmapResource(LPCTSTR pszResource, __out IUIImage **ppimg)
{
HRESULT hr = E_FAIL;
*ppimg = NULL;
if (NULL == m_pifbFactory)
{
hr = CoCreateInstance(CLSID_UIRibbonImageFromBitmapFactory, NULL, CLSCTX_ALL, IID_PPV_ARGS(&m_pifbFactory));
if (FAILED(hr))
{
return hr;
}
}
// Load the bitmap from the resource file.
HBITMAP hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), pszResource, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
if (hbm)
{
// Use the factory implemented by the framework to produce an IUIImage.
hr = m_pifbFactory->CreateImage(hbm, UI_OWNERSHIP_TRANSFER, ppimg);
if (FAILED(hr))
{
DeleteObject(hbm);
}
}
return hr;
}
HRESULT CShapeHandler::CreateInstance(__deref_out CShapeHandler **ppHandler)
{
if (!ppHandler)
{
return E_POINTER;
}
*ppHandler = NULL;
HRESULT hr = S_OK;
CShapeHandler* pHandler = new CShapeHandler();
if (pHandler != NULL)
{
*ppHandler = pHandler;
}
else
{
hr = E_OUTOFMEMORY;
}
return hr;
}
// IUnknown methods.
STDMETHODIMP_(ULONG) CShapeHandler::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG) CShapeHandler::Release()
{
LONG cRef = InterlockedDecrement(&m_cRef);
if (cRef == 0)
{
delete this;
}
return cRef;
}
STDMETHODIMP CShapeHandler::QueryInterface(REFIID iid, void** ppv)
{
if (!ppv)
{
return E_POINTER;
}
if (iid == __uuidof(IUnknown))
{
*ppv = static_cast<IUnknown*>(this);
}
else if (iid == __uuidof(IUICommandHandler))
{
*ppv = static_cast<IUICommandHandler*>(this);
}
else
{
*ppv = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
} | 29.503571 | 117 | 0.587096 | [
"shape"
] |
8578ad6c2bdfc1fcfaf43afcae4f5af28d209cc9 | 7,459 | hxx | C++ | planners/lapkt-public/include/aptk/gbfs_f_local/src/brfs.hxx | miquelramirez/aamas18-planning-for-transparency | dff3e635102bf351906807c5181113fbf4b67083 | [
"MIT"
] | null | null | null | planners/lapkt-public/include/aptk/gbfs_f_local/src/brfs.hxx | miquelramirez/aamas18-planning-for-transparency | dff3e635102bf351906807c5181113fbf4b67083 | [
"MIT"
] | null | null | null | planners/lapkt-public/include/aptk/gbfs_f_local/src/brfs.hxx | miquelramirez/aamas18-planning-for-transparency | dff3e635102bf351906807c5181113fbf4b67083 | [
"MIT"
] | null | null | null | /*
Lightweight Automated Planning Toolkit
Copyright (C) 2012
Miquel Ramirez <miquel.ramirez@rmit.edu.au>
Nir Lipovetzky <nirlipo@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BREADTH_FIRST_SEARCH__
#define __BREADTH_FIRST_SEARCH__
#include <aptk/search_prob.hxx>
#include <aptk/resources_control.hxx>
#include <aptk/closed_list.hxx>
#include <aptk/hash_table.hxx>
#include "2h_exp_node.hxx"
#include <queue>
#include <vector>
#include <algorithm>
#include <iostream>
namespace aptk {
namespace search {
namespace brfs {
template <typename Search_Model>
class BRFS {
public:
typedef typename Search_Model::State_Type State;
typedef aptk::search::gbfs_2h_exp::Node< Search_Model, State > Search_Node;
typedef Closed_List< Search_Node > Closed_List_Type;
BRFS( const Search_Model& search_problem )
: m_problem( search_problem ), m_global_closed(NULL), m_exp_count(0), m_gen_count(0), m_cl_count(0), m_max_depth(0), m_verbose(true), m_max_expanded( no_such_index ) {
}
virtual ~BRFS() {
for ( typename Closed_List_Type::iterator i = m_closed.begin();
i != m_closed.end(); i++ ) {
delete i->second;
}
while (!m_open.empty() )
{
Search_Node* n = m_open.front();
m_open.pop();
delete n;
}
m_closed.clear();
m_open_hash.clear();
}
void set_verbose( bool v ) { m_verbose = v; }
bool verbose() const { return m_verbose; }
void reset() {
for ( typename Closed_List_Type::iterator i = m_closed.begin();
i != m_closed.end(); i++ ) {
delete i->second;
}
while (!m_open.empty() )
{
Search_Node* n = m_open.front();
m_open.pop();
delete n;
}
m_closed.clear();
m_open_hash.clear();
m_max_depth=0;
}
virtual bool is_goal( Search_Node* n ){
if( n->has_state() )
return m_problem.goal( *(n->state()) );
else{
n->parent()->state()->progress_lazy_state( m_problem.task().actions()[ n->action() ] );
const bool is_goal = m_problem.goal( *( n->state() ) );
n->parent()->state()->regress_lazy_state( m_problem.task().actions()[ n->action() ] );
return is_goal;
}
}
void start( State *s = NULL ) {
reset();
if(!s)
m_root = new Search_Node( m_problem.init(), 0.0f, no_op, NULL );
else
m_root = new Search_Node( s, 0.0f, no_op, NULL );
#ifdef DEBUG
std::cout << "Initial search node: ";
m_root->print(std::cout);
std::cout << std::endl;
#endif
m_open.push( m_root );
m_open_hash.put( m_root );
inc_gen();
}
virtual bool find_solution( float& cost, std::vector<Action_Idx>& plan ) {
Search_Node* end = do_search();
if ( end == NULL ) return false;
extract_plan( m_root, end, plan, cost );
return true;
}
void inc_gen() { m_gen_count++; }
unsigned generated() const { return m_gen_count; }
void inc_exp() { m_exp_count++; }
unsigned expanded() const { return m_exp_count; }
void inc_closed() { m_cl_count++; }
unsigned pruned_closed() const { return m_cl_count; }
void set_max_expanded( unsigned v ) { m_max_expanded = v; }
void close( Search_Node* n ) { m_closed.put(n); }
Closed_List_Type& closed() { return m_closed; }
void set_global_closed( Closed_List_Type *c ) { m_global_closed = c; }
Closed_List_Type& open_hash() { return m_open_hash; }
const Search_Model& problem() const { return m_problem; }
bool is_closed( Search_Node* n ) {
Search_Node* n2 = this->closed().retrieve(n);
if ( n2 != NULL )
return true;
if(m_global_closed){
Search_Node* n2 = this->m_global_closed->retrieve(n);
if ( n2 != NULL )
return true;
}
return false;
}
bool search_exhausted(){ return m_open.empty(); }
Search_Node* get_node() {
Search_Node *next = NULL;
if(! m_open.empty() ) {
next = m_open.front();
m_open.pop();
m_open_hash.erase( m_open_hash.retrieve_iterator( next) );
}
return next;
}
void open_node( Search_Node *n ) {
m_open.push(n);
m_open_hash.put(n);
inc_gen();
if(n->gn() + 1 > m_max_depth){
//if( m_max_depth == 0 ) std::cout << std::endl;
m_max_depth = n->gn() + 1 ;
if ( verbose() )
std::cout << "[" << m_max_depth <<"]" << std::flush;
}
}
virtual Search_Node* process( Search_Node *head ) {
typedef typename Search_Model::Action_Iterator Iterator;
Iterator it( this->problem() );
int a = it.start( *(head->state()) );
while ( a != no_op ) {
State *succ = m_problem.next( *(head->state()), a ) ;
Search_Node* n = new Search_Node( succ, 1.0f, a, head );
if ( is_closed( n ) ) {
delete n;
a = it.next();
inc_closed();
continue;
}
if( previously_hashed(n) ) {
inc_closed();
delete n;
}
else{
open_node(n);
if( is_goal( n ) )
return n;
}
a = it.next();
}
return NULL;
}
virtual Search_Node* do_search() {
Search_Node *head = get_node();
if( is_goal( head ) )
return head;
int counter = 0;
while(head) {
if( ! head->has_state() )
head->set_state( m_problem.next(*(head->parent()->state()), head->action()) );
Search_Node* goal = process(head);
inc_exp();
close(head);
if( goal ) {
if( ! goal->has_state() )
goal->set_state( m_problem.next(*(goal->parent()->state()), goal->action()) );
return goal;
}
if( m_exp_count > m_max_expanded ) return NULL;
counter++;
head = get_node();
}
return NULL;
}
virtual bool previously_hashed( Search_Node *n ) {
Search_Node *previous_copy = m_open_hash.retrieve(n);
if( previous_copy != NULL )
return true;
return false;
}
Search_Node* root() { return m_root; }
void extract_plan( Search_Node* s, Search_Node* t, std::vector<Action_Idx>& plan, float& cost, bool reverse = true ) {
Search_Node *tmp = t;
cost = 0.0f;
while( tmp != s) {
cost += m_problem.cost( *(tmp->state()), tmp->action() );
plan.push_back(tmp->action());
tmp = tmp->parent();
}
if(reverse)
std::reverse(plan.begin(), plan.end());
}
protected:
void extract_path( Search_Node* s, Search_Node* t, std::vector<Search_Node*>& plan ) {
Search_Node* tmp = t;
while( tmp != s) {
plan.push_back(tmp);
tmp = tmp->parent();
}
std::reverse(plan.begin(), plan.end());
}
protected:
const Search_Model& m_problem;
std::queue<Search_Node*> m_open;
Closed_List_Type m_closed, m_open_hash;
Closed_List_Type* m_global_closed;
unsigned m_exp_count;
unsigned m_gen_count;
unsigned m_cl_count;
unsigned m_max_depth;
Search_Node* m_root;
std::vector<Action_Idx> m_app_set;
bool m_verbose;
unsigned m_max_expanded;
};
}
}
}
#endif // brfs.hxx
| 24.139159 | 172 | 0.626357 | [
"vector"
] |
857ab2e82e544014348c48c2f4341df42d841b49 | 726 | hpp | C++ | include/RED4ext/Types/generated/quest/SetTier_NodeType.hpp | Cyberpunk-Extended-Development-Team/RED4ext.SDK | 2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae | [
"MIT"
] | 1 | 2021-02-01T23:07:50.000Z | 2021-02-01T23:07:50.000Z | include/RED4ext/Types/generated/quest/SetTier_NodeType.hpp | Cyberpunk-Extended-Development-Team/RED4ext.SDK | 2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae | [
"MIT"
] | null | null | null | include/RED4ext/Types/generated/quest/SetTier_NodeType.hpp | Cyberpunk-Extended-Development-Team/RED4ext.SDK | 2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae | [
"MIT"
] | null | null | null | #pragma once
// This file is generated from the Game's Reflection data
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/REDhash.hpp>
#include <RED4ext/Types/generated/GameplayTier.hpp>
#include <RED4ext/Types/generated/quest/ISceneManagerNodeType.hpp>
namespace RED4ext
{
namespace quest {
struct SetTier_NodeType : quest::ISceneManagerNodeType
{
static constexpr const char* NAME = "questSetTier_NodeType";
static constexpr const char* ALIAS = NAME;
GameplayTier tier; // 38
bool usePlayerWorkspot; // 3C
bool useEnterAnim; // 3D
bool useExitAnim; // 3E
bool forceEmptyHands; // 3F
};
RED4EXT_ASSERT_SIZE(SetTier_NodeType, 0x40);
} // namespace quest
} // namespace RED4ext
| 25.928571 | 66 | 0.746556 | [
"3d"
] |
857cd438f11343f5b16c6041abbed6337f1c9c50 | 3,492 | cc | C++ | aegis/src/model/DescribeVulLevelStatisticsResult.cc | sdk-team/aliyun-openapi-cpp-sdk | d0e92f6f33126dcdc7e40f60582304faf2c229b7 | [
"Apache-2.0"
] | 3 | 2020-01-06T08:23:14.000Z | 2022-01-22T04:41:35.000Z | aegis/src/model/DescribeVulLevelStatisticsResult.cc | sdk-team/aliyun-openapi-cpp-sdk | d0e92f6f33126dcdc7e40f60582304faf2c229b7 | [
"Apache-2.0"
] | null | null | null | aegis/src/model/DescribeVulLevelStatisticsResult.cc | sdk-team/aliyun-openapi-cpp-sdk | d0e92f6f33126dcdc7e40f60582304faf2c229b7 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/aegis/model/DescribeVulLevelStatisticsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Aegis;
using namespace AlibabaCloud::Aegis::Model;
DescribeVulLevelStatisticsResult::DescribeVulLevelStatisticsResult() :
ServiceResult()
{}
DescribeVulLevelStatisticsResult::DescribeVulLevelStatisticsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DescribeVulLevelStatisticsResult::~DescribeVulLevelStatisticsResult()
{}
void DescribeVulLevelStatisticsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allLevelStatistics = value["LevelStatistics"]["LevelStatistic"];
for (auto value : allLevelStatistics)
{
LevelStatistic levelStatisticsObject;
if(!value["Level"].isNull())
levelStatisticsObject.level = value["Level"].asString();
if(!value["CveNum"].isNull())
levelStatisticsObject.cveNum = std::stoi(value["CveNum"].asString());
if(!value["EmgNum"].isNull())
levelStatisticsObject.emgNum = std::stoi(value["EmgNum"].asString());
if(!value["SysNum"].isNull())
levelStatisticsObject.sysNum = std::stoi(value["SysNum"].asString());
if(!value["CmsNum"].isNull())
levelStatisticsObject.cmsNum = std::stoi(value["CmsNum"].asString());
if(!value["CmsDealedTotalNum"].isNull())
levelStatisticsObject.cmsDealedTotalNum = std::stoi(value["CmsDealedTotalNum"].asString());
if(!value["VulDealedTotalNum"].isNull())
levelStatisticsObject.vulDealedTotalNum = std::stoi(value["VulDealedTotalNum"].asString());
if(!value["VulAsapSum"].isNull())
levelStatisticsObject.vulAsapSum = std::stoi(value["VulAsapSum"].asString());
if(!value["VulLaterSum"].isNull())
levelStatisticsObject.vulLaterSum = std::stoi(value["VulLaterSum"].asString());
if(!value["VulNntfSum"].isNull())
levelStatisticsObject.vulNntfSum = std::stoi(value["VulNntfSum"].asString());
if(!value["VulSeriousTotal"].isNull())
levelStatisticsObject.vulSeriousTotal = std::stoi(value["VulSeriousTotal"].asString());
if(!value["VulHighTotal"].isNull())
levelStatisticsObject.vulHighTotal = std::stoi(value["VulHighTotal"].asString());
if(!value["VulMediumTotal"].isNull())
levelStatisticsObject.vulMediumTotal = std::stoi(value["VulMediumTotal"].asString());
if(!value["VulLowTotal"].isNull())
levelStatisticsObject.vulLowTotal = std::stoi(value["VulLowTotal"].asString());
levelStatistics_.push_back(levelStatisticsObject);
}
if(!value["TotalCount"].isNull())
totalCount_ = std::stoi(value["TotalCount"].asString());
}
int DescribeVulLevelStatisticsResult::getTotalCount()const
{
return totalCount_;
}
std::vector<DescribeVulLevelStatisticsResult::LevelStatistic> DescribeVulLevelStatisticsResult::getLevelStatistics()const
{
return levelStatistics_;
}
| 37.956522 | 121 | 0.752291 | [
"vector",
"model"
] |
857e8f82f8599963b9776259cb1fef168bc0e771 | 2,279 | hpp | C++ | lib/RayTracer/Rendering/Primitives/Shape.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | lib/RayTracer/Rendering/Primitives/Shape.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | lib/RayTracer/Rendering/Primitives/Shape.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | #pragma once
#include "RayTracerPCH.hpp"
#include "RayTracer/Math/Matrix.hpp"
#include "RayTracer/Math/Tuple.hpp"
#include "RayTracer/Rendering/Lighting/Intersection.hpp"
#include "RayTracer/Rendering/Materials/Material.hpp"
namespace RayTracer {
namespace Rendering {
namespace Primitives {
using namespace Materials;
using namespace Lighting;
using namespace Math;
/**
* @brief Base class for all shapes
* @implements Composite design pattern
*/
class Shape
{
public:
/// @section Member functions
/// @subsection Special member functions
virtual ~Shape();
/// @subsection Observers
mat4 GetTransform() const;
Material GetMaterial() const;
Tuple GetOrigin() const;
std::weak_ptr<Shape> GetParent() const;
Tuple WorldToObject(Tuple point) const;
Tuple NormalToWorld(Tuple normal) const;
// TODO: Should not be virtual
virtual Tuple GetNormalAt(Tuple point, const Intersection* i = nullptr) const;
virtual Intersections Intersect(const Ray& r) const;
/// @subsubsection Virtual member functions
virtual bool Contains(const Shape& shape) const;
/// @subsection Modifiers
mat4& SetTransform();
void SetTransform(mat4 t);
Material& SetMaterial();
void SetMaterial(Material m);
Tuple& SetOrigin();
void SetOrigin(Tuple t);
void SetParent(std::shared_ptr<Shape> parent);
/// @section Friend functions
bool operator==(const Shape& rhs) const;
protected:
Shape();
virtual Tuple GetLocalNormalAt(Tuple point,
const Intersection* i = nullptr) const = 0;
virtual Intersections GetLocalIntersect(const Ray& r) const = 0;
private:
mat4 m_Transform;
Material m_Material;
Tuple m_Origin;
std::weak_ptr<Shape> m_Parent;
};
using SharedShape = std::shared_ptr<Shape>;
template<typename T, typename... Args>
requires(std::is_base_of_v<Shape, T>) SharedShape CreateShape(Args&&... args)
{
return std::make_shared<T>(args...);
}
template<typename T, typename... Args>
requires(std::is_base_of_v<Shape, T>) SharedPtr<T> CreateShapeAs(Args&&... args)
{
return std::make_shared<T>(args...);
}
/// @section Non-member functions
Tuple world_to_object(const std::shared_ptr<Shape>& shape, Tuple worldPoint);
} // namespace Primitives
} // namespace Rendering
} // namespace RayTracer
| 25.897727 | 80 | 0.727951 | [
"shape"
] |
3fedd277cfc6939c5c3e279bb8546dc71bdb3675 | 1,994 | cpp | C++ | problemsets/Codejam/2009/ROUND 1B 2009/PB/PB.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | problemsets/Codejam/2009/ROUND 1B 2009/PB/PB.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | problemsets/Codejam/2009/ROUND 1B 2009/PB/PB.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | /**
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
using namespace std;
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define ALL(M) (M).begin(), (M).end()
#define CLR(M, v) memset(M, v, sizeof(M))
#define SI(V) (int)(V.size())
#define PB push_back
#define MP make_pair
typedef long long i64;
typedef vector<int> VI;
typedef vector<string> VS;
const int INF = 0x3F3F3F3F;
const i64 LINF = 0x3F3F3F3F3F3F3F3FLL;
const double EPS = 1E-14;
template<class T> T SQR(T x) { return x*x; }
////////////////////////////////////////////////////////////////////////////////
int main() {
// freopen("B.in","r",stdin);
// freopen("B-small-practice.in","r",stdin);freopen("B-small-practice.out","w",stdout);
freopen("B-large-practice.in","r",stdin);freopen("B-large-practice.out","w",stdout);
// freopen("B-small-attempt0.in","r",stdin);freopen("B-small-attempt0.out","w",stdout);
// freopen("B-small-attempt1.in","r",stdin);freopen("B-small-attempt1.out","w",stdout);
// freopen("B-small-attempt2.in","r",stdin);freopen("B-small-attempt2.out","w",stdout);
// freopen("B-large.in","r",stdin);freopen("B-large.ans","w",stdout);
string S;
int TC;
scanf("%d ", &TC);
for (int tc = 1; tc <= TC; tc++) {
// Read input.
cin >> S;
S = "0" + S;
next_permutation(ALL(S));
if (S[0]=='0') S = S.substr(1);
// Prints result.
printf("Case #%d: %s\n", tc, S.c_str());
}
return 0;
}
| 23.738095 | 87 | 0.592277 | [
"vector"
] |
3fee38cd884646e9d41cc05e4f5c8904caca6c52 | 5,849 | hh | C++ | src/libws_diff/stringCompare.hh | isabella232/mod_dup | 531382c8baeaa6781ddd1cfe4748b2dd0dbf328c | [
"Apache-2.0"
] | 16 | 2015-07-17T15:50:38.000Z | 2022-02-14T23:01:07.000Z | src/libws_diff/stringCompare.hh | Orange-OpenSource/mod_dup | 531382c8baeaa6781ddd1cfe4748b2dd0dbf328c | [
"Apache-2.0"
] | 4 | 2016-04-19T20:27:04.000Z | 2018-02-21T11:48:05.000Z | src/libws_diff/stringCompare.hh | isabella232/mod_dup | 531382c8baeaa6781ddd1cfe4748b2dd0dbf328c | [
"Apache-2.0"
] | 5 | 2015-01-26T14:49:47.000Z | 2021-06-22T09:59:11.000Z | /*
* StringCompare.h
*
* Created on: 23 janv. 2014
* Author: cvallee
*/
#pragma once
#include <vector>
#include <boost/regex.hpp>
#include "DiffPrinter/diffPrinter.hh"
typedef std::vector<boost::regex> tRegexes;
typedef std::vector<std::string> tStrings;
namespace LibWsDiff {
/**
* BasicCompare class
* Interface providing tools for string comparaison
*/
class StringCompare {
//Vector of regex to match in order to reject any comparaison
tRegexes mStopRegex;
//Vector of regex to remove from any comparaison
tRegexes mIgnoreRegex;
protected:
/**Check the str against the initials stop regex provided
* @param str : the string to validate
* @return True if any regex is match in the string else false
*/
bool checkStopRegex(const std::string & str) const;
/**
* Remove the ignore regex content in the input string
* @param str : the input string
*/
void ignoreCases(std::string & str) const;
/**
* function factoring the diff between vector of string
* @param src : source of the diff
* @param dst : destination of the diff
* @param output : resulting diff in string format
*/
bool vectDiff(const tStrings& src,const tStrings& dst, std::string& output) const;
public:
/**
* Initializes the regexs through vector of string
*/
StringCompare(const tStrings& stopRegex,const tStrings& ignoreRegex);
/**
* Default Constructor.
*/
StringCompare();
virtual ~StringCompare();
virtual void merge(const StringCompare & sc);
/**
* add a new regex string to ignore in the diff
* @param re : the string to regex ignore in the diff
*/
void addIgnoreRegex(const std::string& re);
/**
* add a new regex string to the stop list
* @param re : the string which will stop the diff if match
*/
void addStopRegex(const std::string& re);
/**
* Return the shortest execution sequence(SES) to obtain the destination string dst from the source src i.e. the diff
* @param src : source string
* @param dst : destination string
* @param output : the resulting SES diff in string representation
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const std::string & src,const std::string& dst, std::string& output) const;
/**
* Return the shortest execution sequence(SES) to obtain the destination string dst from the source src i.e. the diff
* @param src : source string
* @param dst : destination string
* @param printer : Pointer on the dedicated printer class
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const std::string & src,
const std::string& dst,
LibWsDiff::diffPrinter* printer) const;
};
/**
* BasicCompare implementation dedicated to the HTTP header comparaison
* Handle Map comparaison and the regex stop and ignore its own way
*/
class StringCompareHeader : public StringCompare {
typedef std::map<std::string,std::string> mapStrings;
/**
* Concatenate the map in one string
*/
std::string mapToHeaderString(const mapStrings& map);
public:
/**
* Call the super constructor.
*/
StringCompareHeader(const tStrings& stopRegex,const tStrings& ignoreRegex):StringCompare(stopRegex,ignoreRegex){}
/**
* Call the super constructor.
*/
StringCompareHeader():StringCompare(){}
/**
* Split both string on their newline caractere and return line by line diff
* @param src : source string
* @param dst : destination string
* @param output : the resulting SES diff in string representation
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const std::string& src,const std::string& dst,std::string& output) const;
bool retrieveDiff(const mapStrings& mapOrig,
const mapStrings& mapRes,
std::string& output) const;
bool retrieveDiff(const std::string& src,
const std::string& dst,
LibWsDiff::diffPrinter& printer) const;
bool retrieveDiff(const mapStrings& mapOrig,
const mapStrings& mapRes,
LibWsDiff::diffPrinter& printer) const;
};
/**
* BasicCompare implementation dedicated to the HTTP body comparaison
* Handle vector of string comparaison and the regex stop and ignore its own way
*/
class StringCompareBody : public StringCompare {
public:
/**
* Call the super constructor.
*/
StringCompareBody(tStrings stopRegex,tStrings ignoreRegex):StringCompare(stopRegex,ignoreRegex){}
/**
* Call the super constructor.
*/
StringCompareBody():StringCompare(){}
/**
* Split both string on their '><' junction and return the line by line diff
* Stop and Ignore regex are also process on the input strings
* @param src : the source string
* @param dst : the destination string
* @param output : the resulting SES diff in string representation
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const std::string& src,const std::string& dst,std::string& output) const;
/**
* Process the Ignore and Stop regex and every input strings
* @param src : source vector
* @param dst : destination vector
* @param output : the resulting SES diff in string representation
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const tStrings& src,const tStrings& dst,std::string& output) const;
/**
* Return the shortest execution sequence(SES) to obtain the destination string dst from the source src i.e. the diff
* @param src : source string
* @param dst : destination string
* @param printer : Pointer on the dedicated printer class
* @return : false if any stop flag has been matched, else true
*/
bool retrieveDiff(const std::string & src,
const std::string& dst,
LibWsDiff::diffPrinter& printer) const;
bool retrieveDiff(const tStrings & src,
const tStrings& dst,
LibWsDiff::diffPrinter& printer) const;
};
} /* namespace LibWsDiff */
| 29.841837 | 119 | 0.71773 | [
"vector"
] |
3ff1e545d35397d5a999b80847ffec02f4c4cf48 | 20,308 | cpp | C++ | apps/loader_utils/scene_mgr.cpp | Ray-Tracing-Systems/kernel_slicer | 3a7a5350fcacc98c1d797f55a0d13e34d06e7e96 | [
"MIT"
] | 5 | 2020-10-29T18:00:14.000Z | 2021-07-08T14:20:41.000Z | apps/loader_utils/scene_mgr.cpp | Ray-Tracing-Systems/kernel_slicer | 3a7a5350fcacc98c1d797f55a0d13e34d06e7e96 | [
"MIT"
] | 1 | 2021-08-11T16:14:43.000Z | 2021-08-25T16:45:36.000Z | apps/loader_utils/scene_mgr.cpp | Ray-Tracing-Systems/kernel_slicer | 3a7a5350fcacc98c1d797f55a0d13e34d06e7e96 | [
"MIT"
] | 1 | 2021-11-17T19:10:34.000Z | 2021-11-17T19:10:34.000Z | #include <map>
#include <array>
#include "scene_mgr.h"
#include "vk_utils.h"
#include "vk_buffers.h"
#include "../loader_utils/hydraxml.h"
#include <ray_tracing/vk_rt_funcs.h>
VkTransformMatrixKHR transformMatrixFromFloat4x4(const LiteMath::float4x4 &m)
{
VkTransformMatrixKHR transformMatrix;
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 4; ++j)
{
transformMatrix.matrix[i][j] = m(i, j);
}
}
return transformMatrix;
}
SceneManager::SceneManager(VkDevice a_device, VkPhysicalDevice a_physDevice,
uint32_t a_transferQId, uint32_t a_graphicsQId, bool useRTX, bool debug) : m_device(
a_device), m_physDevice(a_physDevice),
m_transferQId(
a_transferQId),
m_graphicsQId(
a_graphicsQId),
m_useRTX(useRTX),
m_debug(debug)
{
vkGetDeviceQueue(m_device, m_transferQId, 0, &m_transferQ);
vkGetDeviceQueue(m_device, m_graphicsQId, 0, &m_graphicsQ);
VkDeviceSize scratchMemSize = 64 * 1024 * 1024;
m_pCopyHelper = std::make_unique<vk_utils::PingPongCopyHelper>(m_physDevice, m_device, m_transferQ, m_transferQId,
scratchMemSize);
m_pMeshData = std::make_shared<Mesh8F>();
}
bool SceneManager::LoadSingleMesh(const std::string &meshPath)
{
auto meshId = AddMeshFromFile(meshPath);
InstanceMesh(meshId, LiteMath::float4x4());
LoadGeoDataOnGPU();
if(m_useRTX)
AddBLAS(meshId);
return true;
}
bool SceneManager::LoadSceneXML(const std::string &scenePath, bool transpose)
{
auto hscene_main = std::make_shared<hydra_xml::HydraScene>();
auto res = hscene_main->LoadState(scenePath);
if (res < 0)
{
RUN_TIME_ERROR("LoadSceneXML error");
return false;
}
for(auto meshloc : hscene_main->MeshFiles())
{
auto meshId = AddMeshFromFile(meshloc);
auto instances = hscene_main->GetAllInstancesOfMeshLoc(meshloc);
for (size_t j = 0; j < instances.size(); ++j)
{
if (transpose)
InstanceMesh(meshId, LiteMath::transpose(instances[j]));
else
InstanceMesh(meshId, instances[j]);
}
}
LoadGeoDataOnGPU();
hscene_main = nullptr;
if (m_useRTX)
{
for (size_t i = 0; i < m_meshInfos.size(); ++i)
{
AddBLAS(i);
}
}
return true;
}
void SceneManager::LoadSingleTriangle()
{
std::vector<Vertex> vertices =
{
{{1.0f, 1.0f, 0.0f}},
{{-1.0f, 1.0f, 0.0f}},
{{0.0f, -1.0f, 0.0f}}
};
std::vector<uint32_t> indices = {0, 1, 2};
m_totalIndices = static_cast<uint32_t>(indices.size());
VkDeviceSize vertexBufSize = sizeof(Vertex) * vertices.size();
VkDeviceSize indexBufSize = sizeof(uint32_t) * indices.size();
VkBufferUsageFlags flags = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
if (m_useRTX)
{
flags |= VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR |
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
const VkBufferUsageFlags vertFlags = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | flags;
m_geoVertBuf = vk_utils::createBuffer(m_device, vertexBufSize, vertFlags);
const VkBufferUsageFlags idxFlags = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | flags;
m_geoIdxBuf = vk_utils::createBuffer(m_device, indexBufSize, idxFlags);
VkMemoryAllocateFlags allocFlags{};
if (m_useRTX)
{
allocFlags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
}
m_geoMemAlloc = vk_utils::allocateAndBindWithPadding(m_device, m_physDevice, {m_geoVertBuf, m_geoIdxBuf}, allocFlags);
m_pCopyHelper->UpdateBuffer(m_geoVertBuf, 0, vertices.data(), vertexBufSize);
m_pCopyHelper->UpdateBuffer(m_geoIdxBuf, 0, indices.data(), indexBufSize);
if (m_useRTX)
{
AddBLAS(0);
}
}
uint32_t SceneManager::AddMeshFromFile(const std::string &meshPath)
{
//@TODO: other file formats
auto data = cmesh::LoadMeshFromVSGF(meshPath.c_str());
if (data.VerticesNum() == 0)
RUN_TIME_ERROR(("can't load mesh at " + meshPath).c_str());
return AddMeshFromData(data);
}
uint32_t SceneManager::AddMeshFromData(cmesh::SimpleMesh &meshData)
{
assert(meshData.VerticesNum() > 0);
assert(meshData.IndicesNum() > 0);
m_pMeshData->Append(meshData);
MeshInfo info;
info.m_vertNum = meshData.VerticesNum();
info.m_indNum = meshData.IndicesNum();
info.m_vertexOffset = m_totalVertices;
info.m_indexOffset = m_totalIndices;
info.m_vertexBufOffset = info.m_vertexOffset * m_pMeshData->SingleVertexSize();
info.m_indexBufOffset = info.m_indexOffset * m_pMeshData->SingleIndexSize();
m_totalVertices += meshData.VerticesNum();
m_totalIndices += meshData.IndicesNum();
m_meshInfos.push_back(info);
return m_meshInfos.size() - 1;
}
uint32_t SceneManager::InstanceMesh(const uint32_t meshId, const LiteMath::float4x4 &matrix, bool markForRender)
{
assert(meshId < m_meshInfos.size());
//@TODO: maybe move
m_instanceMatrices.push_back(matrix);
InstanceInfo info;
info.inst_id = m_instanceMatrices.size() - 1;
info.mesh_id = meshId;
info.renderMark = markForRender;
info.instBufOffset = (m_instanceMatrices.size() - 1) * sizeof(matrix);
m_instanceInfos.push_back(info);
return info.inst_id;
}
void SceneManager::MarkInstance(const uint32_t instId)
{
assert(instId < m_instanceInfos.size());
m_instanceInfos[instId].renderMark = true;
}
void SceneManager::UnmarkInstance(const uint32_t instId)
{
assert(instId < m_instanceInfos.size());
m_instanceInfos[instId].renderMark = false;
}
void SceneManager::LoadGeoDataOnGPU()
{
VkDeviceSize vertexBufSize = m_pMeshData->VertexDataSize();
VkDeviceSize indexBufSize = m_pMeshData->IndexDataSize();
VkBufferUsageFlags flags = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
if (m_useRTX)
{
flags |= VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR |
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
const VkBufferUsageFlags vertFlags = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | flags;
m_geoVertBuf = vk_utils::createBuffer(m_device, vertexBufSize, vertFlags);
const VkBufferUsageFlags idxFlags = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | flags;
m_geoIdxBuf = vk_utils::createBuffer(m_device, indexBufSize, idxFlags);
VkDeviceSize infoBufSize = m_meshInfos.size() * sizeof(uint32_t) * 2;
m_meshInfoBuf = vk_utils::createBuffer(m_device, infoBufSize, flags);
VkMemoryAllocateFlags allocFlags{};
if (m_useRTX)
{
allocFlags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
}
m_geoMemAlloc = vk_utils::allocateAndBindWithPadding(m_device, m_physDevice, {m_geoVertBuf, m_geoIdxBuf, m_meshInfoBuf}, allocFlags);
std::vector<LiteMath::uint2> mesh_info_tmp;
for (const auto &m : m_meshInfos)
{
mesh_info_tmp.emplace_back(m.m_indexOffset, m.m_vertexOffset);
}
m_pCopyHelper->UpdateBuffer(m_geoVertBuf, 0, m_pMeshData->VertexData(), vertexBufSize);
m_pCopyHelper->UpdateBuffer(m_geoIdxBuf, 0, m_pMeshData->IndexData(), indexBufSize);
if (!mesh_info_tmp.empty())
m_pCopyHelper->UpdateBuffer(m_meshInfoBuf, 0, mesh_info_tmp.data(),
mesh_info_tmp.size() * sizeof(mesh_info_tmp[0]));
}
void SceneManager::DrawMarkedInstances()
{
}
void SceneManager::DestroyScene()
{
if (m_geoVertBuf != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, m_geoVertBuf, nullptr);
m_geoVertBuf = VK_NULL_HANDLE;
}
if (m_geoIdxBuf != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, m_geoIdxBuf, nullptr);
m_geoIdxBuf = VK_NULL_HANDLE;
}
if (m_instanceMatricesBuffer != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, m_instanceMatricesBuffer, nullptr);
m_instanceMatricesBuffer = VK_NULL_HANDLE;
}
if (m_geoMemAlloc != VK_NULL_HANDLE)
{
vkFreeMemory(m_device, m_geoMemAlloc, nullptr);
m_geoMemAlloc = VK_NULL_HANDLE;
}
m_pCopyHelper = nullptr;
m_meshInfos.clear();
m_pMeshData = nullptr;
m_instanceInfos.clear();
m_instanceMatrices.clear();
}
void SceneManager::AddBLAS(uint32_t meshIdx)
{
VkDeviceOrHostAddressConstKHR vertexBufferDeviceAddress{};
VkDeviceOrHostAddressConstKHR indexBufferDeviceAddress{};
vertexBufferDeviceAddress.deviceAddress = vk_rt_utils::getBufferDeviceAddress(m_device, m_geoVertBuf);
indexBufferDeviceAddress.deviceAddress = vk_rt_utils::getBufferDeviceAddress(m_device, m_geoIdxBuf);
VkAccelerationStructureGeometryKHR accelerationStructureGeometry{};
accelerationStructureGeometry.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR;
accelerationStructureGeometry.flags = VK_GEOMETRY_OPAQUE_BIT_KHR;
accelerationStructureGeometry.geometryType = VK_GEOMETRY_TYPE_TRIANGLES_KHR;
accelerationStructureGeometry.geometry.triangles.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR;
accelerationStructureGeometry.geometry.triangles.vertexFormat = VK_FORMAT_R32G32B32_SFLOAT;
accelerationStructureGeometry.geometry.triangles.vertexData = vertexBufferDeviceAddress;
if (m_debug)
{
accelerationStructureGeometry.geometry.triangles.maxVertex = 3;
accelerationStructureGeometry.geometry.triangles.vertexStride = sizeof(Vertex);
}
else
{
accelerationStructureGeometry.geometry.triangles.maxVertex = m_meshInfos[meshIdx].m_vertNum;
accelerationStructureGeometry.geometry.triangles.vertexStride = m_pMeshData->SingleVertexSize();
}
accelerationStructureGeometry.geometry.triangles.indexType = VK_INDEX_TYPE_UINT32;
accelerationStructureGeometry.geometry.triangles.indexData = indexBufferDeviceAddress;
accelerationStructureGeometry.geometry.triangles.transformData.deviceAddress = 0;
accelerationStructureGeometry.geometry.triangles.transformData.hostAddress = nullptr;
VkAccelerationStructureBuildRangeInfoKHR accelerationStructureBuildRangeInfo{};
accelerationStructureBuildRangeInfo.primitiveCount = m_meshInfos[meshIdx].m_indNum / 3;
accelerationStructureBuildRangeInfo.primitiveOffset = m_meshInfos[meshIdx].m_indexBufOffset;
accelerationStructureBuildRangeInfo.firstVertex = m_meshInfos[meshIdx].m_vertexOffset;
accelerationStructureBuildRangeInfo.transformOffset = 0;
m_blasGeom.emplace_back(accelerationStructureGeometry);
m_blasOffsetInfo.emplace_back(accelerationStructureBuildRangeInfo);
}
void SceneManager::BuildAllBLAS()
{
auto nBlas = m_blasGeom.size();
m_blas.resize(nBlas);
std::vector<VkAccelerationStructureBuildGeometryInfoKHR> buildInfos(nBlas);
for (uint32_t idx = 0; idx < nBlas; idx++)
{
buildInfos[idx].sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR;
buildInfos[idx].flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR;
buildInfos[idx].geometryCount = 1;
buildInfos[idx].pGeometries = &m_blasGeom[idx];
buildInfos[idx].mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR;
buildInfos[idx].type = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR;
buildInfos[idx].srcAccelerationStructure = VK_NULL_HANDLE;
}
VkDeviceSize maxScratch = 0;
// Determine scratch buffer size depending on the largest geometry
for (size_t idx = 0; idx < nBlas; idx++)
{
VkAccelerationStructureBuildSizesInfoKHR sizeInfo{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR};
vkGetAccelerationStructureBuildSizesKHR(m_device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR,
&buildInfos[idx], &m_blasOffsetInfo[idx].primitiveCount, &sizeInfo);
vk_rt_utils::createAccelerationStructure(m_blas[idx], VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR,
sizeInfo, m_device, m_physDevice);
maxScratch = std::max(maxScratch, sizeInfo.buildScratchSize);
}
vk_rt_utils::RTScratchBuffer scratchBuffer = vk_rt_utils::allocScratchBuffer(m_device, m_physDevice, maxScratch);
VkCommandPool commandPool = vk_utils::createCommandPool(m_device, m_graphicsQId, VkCommandPoolCreateFlagBits(0));
std::vector<VkCommandBuffer> allCmdBufs = vk_utils::createCommandBuffers(m_device, commandPool, nBlas);
for (uint32_t idx = 0; idx < nBlas; idx++)
{
VkCommandBufferBeginInfo cmdBufInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
VK_CHECK_RESULT(vkBeginCommandBuffer(allCmdBufs[idx], &cmdBufInfo));
auto &blas = m_blas[idx];
buildInfos[idx].dstAccelerationStructure = blas.handle;
buildInfos[idx].scratchData.deviceAddress = scratchBuffer.deviceAddress;
std::vector<const VkAccelerationStructureBuildRangeInfoKHR *> pBuildOffset(m_blasOffsetInfo.size());
// for(size_t infoIdx = 0; infoIdx < m_blasOffsetInfo.size(); infoIdx++)
pBuildOffset[0] = &m_blasOffsetInfo[idx];
vkCmdBuildAccelerationStructuresKHR(allCmdBufs[idx], 1, &buildInfos[idx], pBuildOffset.data());
// barrier for scratch buffer
VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
barrier.srcAccessMask = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR;
barrier.dstAccessMask = VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR;
vkCmdPipelineBarrier(allCmdBufs[idx],
VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
0, 1, &barrier, 0, nullptr, 0, nullptr);
vkEndCommandBuffer(allCmdBufs[idx]);
}
vk_utils::executeCommandBufferNow(allCmdBufs, m_graphicsQ, m_device);
allCmdBufs.clear();
if (scratchBuffer.memory != VK_NULL_HANDLE)
{
vkFreeMemory(m_device, scratchBuffer.memory, nullptr);
}
if (scratchBuffer.buffer != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, scratchBuffer.buffer, nullptr);
}
}
void SceneManager::BuildTLAS()
{
std::vector<VkAccelerationStructureInstanceKHR> geometryInstances;
geometryInstances.reserve(m_instanceInfos.size());
#ifdef USE_MANY_HIT_SHADERS
std::map<uint32_t, uint32_t> materialMap = { {0, LAMBERT_MTL}, {1, GGX_MTL}, {2, MIRROR_MTL}, {3, BLEND_MTL}, {4, MIRROR_MTL}, {5, EMISSION_MTL} };
#endif
for (const auto &inst : m_instanceInfos)
{
auto transform = transformMatrixFromFloat4x4(m_instanceMatrices[inst.inst_id]);
VkAccelerationStructureInstanceKHR instance{};
instance.transform = transform;
instance.instanceCustomIndex = inst.mesh_id;
instance.mask = 0xFF;
#ifdef USE_MANY_HIT_SHADERS
instance.instanceShaderBindingTableRecordOffset = materialMap[inst.mesh_id];
#else
instance.instanceShaderBindingTableRecordOffset = 0;
#endif
instance.flags = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR;
instance.accelerationStructureReference = m_blas[inst.mesh_id].deviceAddress;
geometryInstances.push_back(instance);
}
VkBuffer instancesBuffer = VK_NULL_HANDLE;
VkMemoryRequirements memReqs{};
instancesBuffer = vk_utils::createBuffer(m_device,
sizeof(VkAccelerationStructureInstanceKHR) * geometryInstances.size(),
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT |
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR |
VK_BUFFER_USAGE_TRANSFER_DST_BIT,
&memReqs);
VkMemoryAllocateFlagsInfo memoryAllocateFlagsInfo{};
memoryAllocateFlagsInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO;
memoryAllocateFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
VkDeviceMemory instancesAlloc;
VkMemoryAllocateInfo allocateInfo = {};
allocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
allocateInfo.pNext = &memoryAllocateFlagsInfo;
allocateInfo.allocationSize = memReqs.size;
allocateInfo.memoryTypeIndex = vk_utils::findMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
m_physDevice);
VK_CHECK_RESULT(vkAllocateMemory(m_device, &allocateInfo, nullptr, &instancesAlloc));
VK_CHECK_RESULT(vkBindBufferMemory(m_device, instancesBuffer, instancesAlloc, 0));
m_pCopyHelper->UpdateBuffer(instancesBuffer, 0, geometryInstances.data(),
sizeof(VkAccelerationStructureInstanceKHR) * geometryInstances.size());
VkAccelerationStructureGeometryInstancesDataKHR instancesVk{
VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR};
instancesVk.arrayOfPointers = VK_FALSE;
instancesVk.data.deviceAddress = vk_rt_utils::getBufferDeviceAddress(m_device, instancesBuffer);
VkAccelerationStructureGeometryKHR topASGeometry{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR};
topASGeometry.geometryType = VK_GEOMETRY_TYPE_INSTANCES_KHR;
topASGeometry.geometry.instances = instancesVk;
VkAccelerationStructureBuildGeometryInfoKHR buildInfo{
VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR};
buildInfo.flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR;
buildInfo.geometryCount = 1;
buildInfo.pGeometries = &topASGeometry;
buildInfo.mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR; // VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR
buildInfo.type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR;
buildInfo.srcAccelerationStructure = VK_NULL_HANDLE;
uint32_t count = geometryInstances.size();
VkAccelerationStructureBuildSizesInfoKHR sizeInfo{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR};
vkGetAccelerationStructureBuildSizesKHR(m_device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &count,
&sizeInfo);
vk_rt_utils::createAccelerationStructure(m_tlas, VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR,
sizeInfo, m_device, m_physDevice);
vk_rt_utils::RTScratchBuffer scratchBuffer = vk_rt_utils::allocScratchBuffer(m_device, m_physDevice,
sizeInfo.buildScratchSize);
buildInfo.srcAccelerationStructure = VK_NULL_HANDLE; //update ...
buildInfo.dstAccelerationStructure = m_tlas.handle;
buildInfo.scratchData.deviceAddress = scratchBuffer.deviceAddress;
VkAccelerationStructureBuildRangeInfoKHR accelerationStructureBuildRangeInfo{};
accelerationStructureBuildRangeInfo.primitiveCount = geometryInstances.size();
accelerationStructureBuildRangeInfo.primitiveOffset = 0;
accelerationStructureBuildRangeInfo.firstVertex = 0;
accelerationStructureBuildRangeInfo.transformOffset = 0;
std::vector<VkAccelerationStructureBuildRangeInfoKHR *> accelerationBuildStructureRangeInfos = {
&accelerationStructureBuildRangeInfo};
VkCommandPool commandPool = vk_utils::createCommandPool(m_device, m_graphicsQId, VkCommandPoolCreateFlagBits(0));
VkCommandBuffer commandBuffer = vk_utils::createCommandBuffer(m_device, commandPool);
VkCommandBufferBeginInfo cmdBufInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
VK_CHECK_RESULT(vkBeginCommandBuffer(commandBuffer, &cmdBufInfo));
vkCmdBuildAccelerationStructuresKHR(
commandBuffer,
1,
&buildInfo,
accelerationBuildStructureRangeInfos.data());
vkEndCommandBuffer(commandBuffer);
vk_utils::executeCommandBufferNow(commandBuffer, m_graphicsQ, m_device);
if (scratchBuffer.memory != VK_NULL_HANDLE)
{
vkFreeMemory(m_device, scratchBuffer.memory, nullptr);
}
if (scratchBuffer.buffer != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, scratchBuffer.buffer, nullptr);
}
if (instancesAlloc != VK_NULL_HANDLE)
{
vkFreeMemory(m_device, instancesAlloc, nullptr);
}
if (instancesBuffer != VK_NULL_HANDLE)
{
vkDestroyBuffer(m_device, instancesBuffer, nullptr);
}
} | 38.681905 | 149 | 0.734243 | [
"mesh",
"geometry",
"vector",
"transform"
] |
3ff50d9151c79aa32cc989e331f0d8cafb6da59b | 638 | cpp | C++ | character-state-manager/utils.cpp | neetjn/character-state-manager | b14df0d1ff9b84ad25289072a0f8f8604d100287 | [
"MIT"
] | 1 | 2017-09-01T02:18:08.000Z | 2017-09-01T02:18:08.000Z | character-state-manager/utils.cpp | neetVeritas/character-state-manager | b14df0d1ff9b84ad25289072a0f8f8604d100287 | [
"MIT"
] | null | null | null | character-state-manager/utils.cpp | neetVeritas/character-state-manager | b14df0d1ff9b84ad25289072a0f8f8604d100287 | [
"MIT"
] | 2 | 2018-02-03T22:34:14.000Z | 2019-01-10T21:44:31.000Z | #include "utils.h"
void utils::replace_string(std::string &subject, const std::string &search, const std::string &replace)
{
size_t pos = 0;
while ((pos = subject.find(search, pos)) != std::string::npos)
{
subject.replace(pos, search.length(), replace);
pos += replace.length();
}
}
std::vector<unsigned char> utils::hex_to_bytes(const std::string &hex)
{
std::vector<unsigned char> bytes;
for (unsigned int i = 0; i < hex.length(); i += 2)
{
std::string byteString = hex.substr(i, 2);
unsigned char byte = (char)strtol(byteString.c_str(), NULL, 16);
bytes.push_back(byte);
}
return bytes;
}
| 21.266667 | 103 | 0.644201 | [
"vector"
] |
3ff54a9b01684aa5c6adf0b680f9a6d1d9dbd7af | 1,016 | hpp | C++ | csv_lib/include/cl/read_csv_file.hpp | CppPhil/fix_mogasens_csv | eedfe3037c1bd626f81a40073bd616b58d6ba677 | [
"Unlicense"
] | null | null | null | csv_lib/include/cl/read_csv_file.hpp | CppPhil/fix_mogasens_csv | eedfe3037c1bd626f81a40073bd616b58d6ba677 | [
"Unlicense"
] | null | null | null | csv_lib/include/cl/read_csv_file.hpp | CppPhil/fix_mogasens_csv | eedfe3037c1bd626f81a40073bd616b58d6ba677 | [
"Unlicense"
] | null | null | null | #ifndef INCG_CL_READ_CSV_FILE_HPP
#define INCG_CL_READ_CSV_FILE_HPP
#include <string>
#include <vector>
#include <pl/string_view.hpp>
#include "cl/error.hpp"
namespace cl {
/*!
* \brief Scoped enum for the CSV file kinds.
**/
enum class CsvFileKind {
Raw, /*!< A raw CSV file */
Fixed /*!< A CSV file that's been fixed by the fix_csv application */
};
/*!
* \brief Reads a CSV file.
* \param csvFilePath The path to the CSV file.
* \param columnNames An output pointer to write the column names (headers)
* into. Can be nullptr if the column names should not be
* extracted.
* \param csvFileKind The kind of CSV file.
* \return The resulting matrix or an error.
**/
[[nodiscard]] Expected<std::vector<std::vector<std::string>>> readCsvFile(
pl::string_view csvFilePath,
std::vector<std::string>* columnNames = nullptr,
CsvFileKind csvFileKind = CsvFileKind::Fixed) noexcept;
} // namespace cl
#endif // INCG_CL_READ_CSV_FILE_HPP
| 29.882353 | 76 | 0.676181 | [
"vector"
] |
b2075e0afda3cfc73e6bc8f407e54a6727b18851 | 1,530 | cpp | C++ | Study Material/ArabicCompetitiveProgramming-master/04 Math/Combinatorial_Game_Theory_02_Game_of_Nim.cpp | mohamedGamalAbuGalala/Practice | 2a5fa3bdaf995d0c304f04231e1a69e6960f72c8 | [
"MIT"
] | 1 | 2019-12-19T06:51:20.000Z | 2019-12-19T06:51:20.000Z | Study Material/ArabicCompetitiveProgramming-master/04 Math/Combinatorial_Game_Theory_02_Game_of_Nim.cpp | mohamedGamalAbuGalala/Practice | 2a5fa3bdaf995d0c304f04231e1a69e6960f72c8 | [
"MIT"
] | null | null | null | Study Material/ArabicCompetitiveProgramming-master/04 Math/Combinatorial_Game_Theory_02_Game_of_Nim.cpp | mohamedGamalAbuGalala/Practice | 2a5fa3bdaf995d0c304f04231e1a69e6960f72c8 | [
"MIT"
] | null | null | null | /*
*
* Created on: Oct 29, 2016
* Author: mostafa saad
*
*/
#include <iostream>
#include <cmath>
#include <complex>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define repi(i, j, n) for(int i=(j);i<(int)(n);++i)
#define repd(i, j, n) for(int i=(j);i>=(int)(n);--i)
#define repa(v) repi(i, 0, sz(v)) repi(j, 0, sz(v[i]))
#define rep(i, v) repi(i, 0, sz(v))
#define lp(i, cnt) repi(i, 0, cnt)
#define lpi(i, s, cnt) repi(i, s, cnt)
#define P(x) cout<<#x<<" = { "<<x<<" }\n"
#define pb push_back
#define MP make_pair
void solve_nim(vector<int> heap) {
int xorsum = 0;
for (int i = 0; i < (int) heap.size(); ++i)
xorsum ^= heap[i];
if (xorsum != 0) {
cout << "First win: ";
for (int i = 0; i < (int) heap.size(); ++i) {
if (heap[i] > (heap[i] ^ xorsum)) {
cout << "First Move " << (heap[i] - (heap[i] ^ xorsum)) << " stones from " << i << " heap\n";
break;
}
}
} else
cout << "Second win\n";
}
bool misereNim(vector<int> &piles) {
int isSpecial = 1, xorVal = 0;
for (int i = 0; i < piles.size(); ++i) {
xorVal ^= piles[i];
isSpecial &= (piles[i] <= 1);
}
if (isSpecial)
return xorVal == 0;
return xorVal != 0; // normal nim handling
}
int main() {
#ifndef ONLINE_JUDGE
freopen("test.txt", "rt", stdin);
#endif
return 0;
}
| 22.835821 | 101 | 0.513072 | [
"vector"
] |
b209644e74b5336f37fd167a470b01d2af6e2148 | 11,657 | cxx | C++ | EVE/EveDet/AliEveITSScaledModule.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | EVE/EveDet/AliEveITSScaledModule.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | EVE/EveDet/AliEveITSScaledModule.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | // $Id$
// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
/**************************************************************************
* Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
* See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
* full copyright notice. *
**************************************************************************/
#include "AliEveITSScaledModule.h"
#include <AliITSsegmentationSPD.h>
#include <AliITSsegmentationSDD.h>
#include <AliITSsegmentationSSD.h>
#include <AliITSdigitSPD.h>
#include <AliITSdigitSDD.h>
#include <AliITSdigitSSD.h>
#include <TMath.h>
#include <TClonesArray.h>
//==============================================================================
//==============================================================================
// AliEveDigitScaleInfo
//==============================================================================
//______________________________________________________________________________
//
// Encapsulates current state of scaling and agglomeration.
ClassImp(AliEveDigitScaleInfo)
AliEveDigitScaleInfo::AliEveDigitScaleInfo():
fScale(1),
fStatType (kSTAverage),
fSyncPalette(kFALSE)
{
}
void AliEveDigitScaleInfo::ScaleChanged(Int_t s)
{
fScale = s;
AliEveITSScaledModule* sm;
RefMap_i i = fBackRefs.begin();
// #endif
while (i != fBackRefs.end())
{
sm = dynamic_cast<AliEveITSScaledModule*>(i->first);
// #endif
if(sm) sm->LoadQuads();
++i;
}
}
void AliEveDigitScaleInfo::StatTypeChanged(Int_t t)
{
fStatType = t;
fSyncPalette = kTRUE;
AliEveITSScaledModule* sm;
RefMap_i i = fBackRefs.begin();
// #endif
while (i != fBackRefs.end())
{
sm = dynamic_cast<AliEveITSScaledModule*>(i->first);
// #endif
if (sm) sm->SetQuadValues();
++i;
}
}
//______________________________________________________________________________
// ScaledDigit_t
//
AliEveITSScaledModule::ScaledDigit_t::ScaledDigit_t() :
TObject(),
fN(0),
fSum(0), fSqrSum(0),
fMinI(-1), fMinJ(-1), fMaxI(-1), fMaxJ(-1)
{
}
AliEveITSScaledModule::ScaledDigit_t::ScaledDigit_t(Int_t di, Int_t dj) :
TObject(),
fN(0),
fSum(0), fSqrSum(0),
fMinI(di), fMinJ(dj), fMaxI(di), fMaxJ(dj)
{
}
void AliEveITSScaledModule::ScaledDigit_t::Dump() const
{
printf("N %d, sum %f, sqr_sum %f", fN, fSum, fSqrSum);
}
//==============================================================================
//==============================================================================
// AliEveITSScaledModule
//==============================================================================
//______________________________________________________________________________
//
// Visualization of an ITS module with digits aggregated
// on a grid of pre-defined size.
ClassImp(AliEveITSScaledModule)
AliEveITSScaledModule::AliEveITSScaledModule(Int_t gid, AliEveITSDigitsInfo* info, AliEveDigitScaleInfo* si):
AliEveITSModule("AliEveITSScaledModule", "AliEveITSScaledModule"),
fNx(-1),
fNz(-1),
fNCx(-1),
fNCz(-1),
fScaleInfo(si),
fDigitsMap()
{
SetOwnIds(kTRUE);
SetDigitsInfo(info);
SetID(gid);
fScaleInfo->IncRefCount(this);
}
AliEveITSScaledModule::~AliEveITSScaledModule()
{
fScaleInfo->DecRefCount(this);
}
/******************************************************************************/
void AliEveITSScaledModule::LoadQuads()
{
// Here we still use 'z' for the name of axial coordinates.
// The transforamtion matrix aplied rotates y -> z.
// We need this as TEveQuadSet offers optimized treatment for
// quads in the x-y plane.
TClonesArray *digits = fInfo->GetDigits(fID, fDetID);
if (!digits) return;
Int_t ndigits = digits->GetEntriesFast();
Float_t x, z, zo, dpx, dpz; // orig cells size, pos
Int_t i, j; // orig cells idx
Int_t c1, c2; // original coordinates
Int_t id;
std::map<Int_t, Int_t> dmap;
std::map<Int_t, Int_t>::iterator miter;
Int_t scale = fScaleInfo->GetScale() -1;
switch(fDetID)
{
case 0:
{
// SPD
Reset(kQT_RectangleXZFixedY, kFALSE, 32);
fNCz = fInfo->fSPDScaleZ[scale];
fNCx = fInfo->fSPDScaleX[scale];
fNz = Int_t(fInfo->fSegSPD->Npz()/fNCz);
fNx = Int_t(fInfo->fSegSPD->Npx()/fNCx);
dpz = 2*fDz/fNz;
dpx = 2*fDx/fNx;
//printf("SPD orig cells (%d, %d) (%d, %d)\n", fInfo->fSegSPD->Npx(), fInfo->fSegSPD->Npz(), Nx, Nz);
AliITSdigitSPD *od ;
for (Int_t k=0; k<ndigits; ++k)
{
od = (AliITSdigitSPD*) digits->UncheckedAt(k);
fInfo->GetSPDLocalZ(od->GetCoord1(),zo);
c1 = od->GetCoord1(); c2 = od->GetCoord2();
i = Int_t((zo+fDz)/dpz);
j = Int_t((od->GetCoord2()*fNx)/fInfo->fSegSPD->Npx());
id = j*fNx + i;
ScaledDigit_t* sd = 0;
miter = dmap.find(id);
if(miter == dmap.end())
{
dmap[id] = fPlex.Size();
z = dpz*(i) - fDz;
x = dpx*(j) - fDx;
AddQuad(x, z, dpx, dpz);
sd = new ScaledDigit_t(c1, c2);
QuadId(sd);
}
else
{
sd = static_cast<ScaledDigit_t*>(GetId(miter->second));
if(c1 < sd->fMinI)
sd->fMinI = c1;
else if( c1 > sd->fMaxI)
sd->fMaxI = c1;
if(c2 < sd->fMinJ)
sd->fMinJ = c2;
else if( c2 > sd->fMaxJ)
sd->fMaxJ = c2;
}
sd->fN++;
sd->fSum += od->GetSignal();
sd->fSqrSum += od->GetSignal()*od->GetSignal();
}
break;
}
case 1:
{
// SDD
Reset(kQT_RectangleXZFixedY, kFALSE, 32);
fNCz = fInfo->fSDDScaleZ[scale];
fNCx = fInfo->fSDDScaleX[scale];
fNz = Int_t(fInfo->fSegSDD->Npz()/fNCz);
fNx = Int_t(fInfo->fSegSDD->Npx()/fNCx);
dpz = 2*fDz/fNz;
dpx = 2*fDx/fNx;
AliITSdigitSDD *od = 0;
for (Int_t k = 0; k < ndigits; ++k)
{
od = (AliITSdigitSDD*)digits->UncheckedAt(k);
fInfo->fSegSDD->DetToLocal(od->GetCoord2(), od->GetCoord1(),x,z);
z += fDz;
x += fDx;
i = Int_t(z/dpz);
j = Int_t(x/dpx);
//printf("Mod %d coord %d,%d out of %d,%d :: ORIG coord %d,%d out of %d,%d \n",fID,
// i,j,Nz,Nx,od->GetCoord1(),od->GetCoord2(),fInfo->fSegSDD->Npz(),fInfo->fSegSDD->Npx());
id = j*fNx + i;
c1 = od->GetCoord1(); c2 = od->GetCoord2();
ScaledDigit_t* sd = 0;
miter = dmap.find(id);
if(miter == dmap.end())
{
dmap[id] = fPlex.Size();
z = dpz*(i) - fDz;
x = dpx*(j) - fDx;
AddQuad(x, z, dpx, dpz);
sd = new ScaledDigit_t(od->GetCoord1(),od->GetCoord2());
QuadId(sd);
}
else
{
sd = static_cast<ScaledDigit_t*>(GetId(miter->second));
if(c1 < sd->fMinI)
sd->fMinI = c1;
else if( c1 > sd->fMaxI)
sd->fMaxI = c1;
if(c2 < sd->fMinJ)
sd->fMinJ = c2;
else if( c2 > sd->fMaxJ)
sd->fMaxJ = c2;
}
sd->fN++;
sd->fSum += od->GetSignal();
sd->fSqrSum += od->GetSignal()*od->GetSignal();
}
break;
}
case 2:
{
// SSD
Reset(kQT_LineXZFixedY, kFALSE, 32);
AliITSsegmentationSSD* seg = fInfo->fSegSSD;
Float_t ap, an; // positive/negative angles -> offsets
seg->Angles(ap, an);
ap = TMath::Tan(ap) * fDz;
an = - TMath::Tan(an) * fDz;
fNCx = fInfo->fSSDScale[scale];
fNz = 1;
fNx = Int_t(fInfo->fSegSSD->Npx()/fNCx);
dpz = 2*fDz/fNz;
dpx = 2*fDx/fNx;
AliITSdigitSSD *od = 0;
for (Int_t k=0; k<ndigits; k++) {
od=(AliITSdigitSSD*)digits->UncheckedAt(k);
if(od->GetCoord1() == 1)
i = 1; // p side
else
i= -1; // n side
j = Int_t(od->GetCoord2()/fNCx);
c1 = od->GetCoord1(); c2 = od->GetCoord2();
id = j*i;
ScaledDigit_t* sd = 0;
miter = dmap.find(id);
if(miter == dmap.end())
{
// printf("orig digit %d,%d scaled %d,%d \n",od->GetCoord1(),od->GetCoord2(),i,j);
dmap[id] = fPlex.Size();
z = dpz*(i) - fDz;
x = dpx*(j) - fDx;
Float_t a = ( od->GetCoord1() == 1) ? ap : an;
AddLine(x-a, -fDz, 2*a, 2*fDz);
sd = new ScaledDigit_t(c1, c2);
QuadId(sd);
}
else
{
sd = static_cast<ScaledDigit_t*>(GetId(miter->second));
if(c1 < sd->fMinI)
sd->fMinI = c1;
else if( c1 > sd->fMaxI)
sd->fMaxI = c1;
if(c2 < sd->fMinJ)
sd->fMinJ = c2;
else if( c2 > sd->fMaxJ)
sd->fMaxJ = c2;
}
sd->fN++;
sd->fSum += od->GetSignal();
sd->fSqrSum += od->GetSignal()*od->GetSignal();
} // for digits
break;
} // end case 2
} // end switch
SetQuadValues();
RefitPlex();
}
/******************************************************************************/
void AliEveITSScaledModule::SetQuadValues()
{
if(fScaleInfo->GetSyncPalette()) SyncPalette();
Int_t num = fPlex.Size();
for (Int_t i = 0 ; i < num; i++)
{
ScaledDigit_t* sd = static_cast<ScaledDigit_t*>(GetId(i));
Int_t v = 0;
switch(fScaleInfo->GetStatType())
{
using namespace TMath;
case AliEveDigitScaleInfo::kSTOccup:
v = Nint((100.0*sd->fN) / (fNCx*fNCz));
break;
case AliEveDigitScaleInfo::kSTAverage:
v = Nint((Double_t) sd->fSum / sd->fN);
break;
case AliEveDigitScaleInfo::kSTRms:
v = Nint(Sqrt(sd->fSqrSum) / sd->fN);
break;
}
DigitBase_t* qb = GetDigit(i);
qb->fValue = v;
}
}
/******************************************************************************/
void AliEveITSScaledModule::SyncPalette()
{
// printf("AliEveITSScaledModule::SyncPalette()\n");
if(fScaleInfo->GetStatType() == AliEveDigitScaleInfo::kSTOccup)
{
// SPD
AliEveITSModule::fgSPDPalette->SetLimits(0, 100);
AliEveITSModule::fgSPDPalette->SetMinMax(0, 100);
// SDD
AliEveITSModule::fgSDDPalette->SetLimits(0, 100);
AliEveITSModule::fgSDDPalette->SetMinMax(0, 100);
// SSD
AliEveITSModule::fgSSDPalette->SetLimits(0, 100);
AliEveITSModule::fgSDDPalette->SetMinMax(0, 100);
}
else
{
AliEveITSDigitsInfo& di = *fInfo;
// SPD
AliEveITSModule::fgSPDPalette->SetLimits(0, di.fSPDHighLim);
AliEveITSModule::fgSPDPalette->SetMinMax(di.fSPDMinVal, di.fSPDMaxVal);
// SDD
AliEveITSModule::fgSDDPalette->SetLimits(0, di.fSDDHighLim);
AliEveITSModule::fgSDDPalette->SetMinMax(di.fSDDMinVal, di.fSDDMaxVal);
// SSD
AliEveITSModule::fgSSDPalette->SetLimits(0, di.fSSDHighLim);
AliEveITSModule::fgSSDPalette->SetMinMax(di.fSSDMinVal, di.fSSDMaxVal);
}
fScaleInfo->SetSyncPalette(kFALSE);
}
/******************************************************************************/
void AliEveITSScaledModule::GetScaleData(Int_t& cnx, Int_t& cnz, Int_t& total) const
{
cnx = fNx;
cnz = fNz;
total = cnx*cnz;
}
/******************************************************************************/
void AliEveITSScaledModule::DigitSelected(Int_t idx)
{
// Override control-click from TEveQuadSet
printf("AliEveITSScaledModule::DigitSelected "); Print();
// DigitBase_t *qb = GetDigit(idx);
TObject *obj = GetId(idx);
ScaledDigit_t *sd = static_cast<ScaledDigit_t*>(obj);
TClonesArray *digits = fInfo->GetDigits(fID, fDetID);
Int_t ndigits = digits->GetEntriesFast();
printf("%d digits in cell scaleX = %d, scaleZ = %d \n", sd->fN, fNCx, fNCz);
Int_t il = 0;
for(Int_t k=0; k<ndigits; k++)
{
AliITSdigit *d = (AliITSdigit*) digits->UncheckedAt(k);
if(d->GetCoord1()>=sd->fMinI && d->GetCoord1()<=sd->fMaxI &&
d->GetCoord2()>=sd->fMinJ && d->GetCoord2()<=sd->fMaxJ)
{
printf("%3d, %3d: %3d", d->GetCoord1(), d->GetCoord2(), d->GetSignal());
printf(" | ");
il++;
if(il>5) {
printf("\n");
il = 0;
}
}
}
if(il) printf("\n");
}
| 26.020089 | 109 | 0.557948 | [
"3d"
] |
b209d92685f465d042b4c289d29ee006e8dde0af | 4,224 | cpp | C++ | Framework/PVRApi/Vulkan/BufferVk.cpp | kusharami/PowerVR_Native_SDK | 41557a911316126417ce4c92f1b89396f24f39d6 | [
"MIT"
] | 13 | 2017-07-24T05:12:53.000Z | 2021-06-12T15:35:40.000Z | Framework/PVRApi/Vulkan/BufferVk.cpp | kusharami/PowerVR_Native_SDK | 41557a911316126417ce4c92f1b89396f24f39d6 | [
"MIT"
] | null | null | null | Framework/PVRApi/Vulkan/BufferVk.cpp | kusharami/PowerVR_Native_SDK | 41557a911316126417ce4c92f1b89396f24f39d6 | [
"MIT"
] | 5 | 2017-11-03T19:23:02.000Z | 2021-12-24T04:12:34.000Z | /*!
\brief OpenGL ES Implementation of the Buffer class. See BufferVulkan.h.
\file PVRApi/Vulkan/BufferVk.cpp
\author PowerVR by Imagination, Developer Technology Team
\copyright Copyright (c) Imagination Technologies Limited.
*/
#include "PVRApi/Vulkan/BufferVk.h"
#include <PVRApi/ApiIncludes.h>
#include "PVRApi/ApiObjects/Texture.h"
#include "PVRNativeApi/Vulkan/VkErrors.h"
#include "PVRNativeApi/Vulkan/NativeObjectsVk.h"
#include "PVRNativeApi/Vulkan/ConvertToVkTypes.h"
#include "PVRApi/Vulkan/ContextVk.h"
#include "PVRNativeApi/Vulkan/BufferUtilsVk.h"
namespace pvr {
namespace api {
// AT THIS POINT, IT IS ASSUMED THAT OUR Buffer_ is, in fact, a BufferVulkanImpl. In this sense, to avoid
// virtual function calls, we are de-virtualising Buffer_ into BufferVulkan. So, for each call, our "this"
// pointer (declared type Buffer_*), gets cast into a BufferVulkanImpl* and the calls are done direct (in fact,
// inline) through this pointer.
namespace vulkan {
BufferVk_::BufferVk_(const GraphicsContext& context) : Buffer_(context)
{
buffer = VK_NULL_HANDLE; memory = VK_NULL_HANDLE;
}
void BufferVk_::destroy()
{
if (_context.isValid())
{
VkDevice deviceVk = native_cast(*_context).getDevice();
if (buffer != VK_NULL_HANDLE)
{
vk::DestroyBuffer(deviceVk, buffer, NULL);
}
else
{
Log(Log.Warning, "Buffer Double deletion?");
}
if (memory != VK_NULL_HANDLE)
{
vk::FreeMemory(deviceVk, memory, NULL);
}
else
{
Log(Log.Warning, "Buffer Double deletion?");
}
memory = VK_NULL_HANDLE;
buffer = VK_NULL_HANDLE;
_context.reset();
}
}
BufferVk_::~BufferVk_()
{
if (_context.isValid())
{
destroy();
}
else
{
Log(Log.Warning, "Buffer object was not released before context destruction");
}
}
void* BufferVk_::map_(types::MapBufferFlags flags, uint32 offset, uint32 length)
{
if (_mappedRange)
{
assertion(false, "BufferVk_::map trying to map memory twice");
return NULL;
}
debug_assertion(length + offset <= _size, "BufferVk_::map Trying to map a buffer range greater than its size");
void* mapped;
platform::ContextVk& contextVk = native_cast(*_context);
VkResult rslt = vk::MapMemory(contextVk.getDevice(), memory, offset, length, 0, &mapped);
if (rslt != VK_SUCCESS)
{
Log("BufferVk_::map Failed to to map buffer");
return NULL;
}
_mappedRange = length;
_mappedOffset = offset;
_mappedFlags = flags;
return mapped;
}
void BufferVk_::unmap_()
{
if (!_mappedRange)
{
assertion(false, "Buffer_::unmap trying to un-map un-mapped memory");
return;
}
_mappedRange = 0;
_mappedOffset = 0;
_mappedFlags = types::MapBufferFlags(0);
platform::ContextVk& contextVk = native_cast(*_context);
VkMappedMemoryRange range = {};
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
range.memory = memory;
range.offset = _mappedOffset;
range.size = _mappedRange;
if ((_mappedFlags & types::MapBufferFlags::Write) != types::MapBufferFlags(0))
{
vk::FlushMappedMemoryRanges(contextVk.getDevice(), 1, &range);
}
if ((_mappedFlags & types::MapBufferFlags::Read) != types::MapBufferFlags(0))
{
vk::InvalidateMappedMemoryRanges(contextVk.getDevice(), 1, &range);
}
vk::UnmapMemory(contextVk.getDevice(), memory);
}
bool BufferVk_::allocate_(uint32 size, types::BufferBindingUse usage, bool isMappable)
{
if(size == 0)
{
assertion(size != 0, "Failed to allocate buffer. Allocation size should not be 0");
return false;
}
platform::ContextVk& contextVk = native_cast(*_context);
if (isAllocated())// re-allocate if neccessary
{
Log(Log.Debug, "BufferVulkanImpl::allocate: Vulkan buffer %d was already allocated, deleting it. "
"This should normally NOT happen - allocate is private.", buffer);
destroy();
}
_size = size;
_usage = usage;
_isMappable = isMappable;
return pvr::utils::vulkan::createBufferAndMemory(contextVk.getDevice(),
contextVk.getPlatformContext().getNativePlatformHandles().deviceMemProperties,
(isMappable ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT),
usage, size, *this, NULL);
}
BufferViewVk_::BufferViewVk_(const Buffer& buffer, uint32 offset, uint32 range) :
impl::BufferView_(buffer, offset, range) {}
}// namespace vulkan
}
}
| 28.348993 | 112 | 0.73035 | [
"object"
] |
b213b0ce288097de0f9acf3073571221e1b1dc3b | 43,845 | cpp | C++ | evorole/src/evorole.cpp | marmgroup/evosexrole | 27d4a2f250bfa9ee7621061abfac298200184954 | [
"MIT"
] | null | null | null | evorole/src/evorole.cpp | marmgroup/evosexrole | 27d4a2f250bfa9ee7621061abfac298200184954 | [
"MIT"
] | null | null | null | evorole/src/evorole.cpp | marmgroup/evosexrole | 27d4a2f250bfa9ee7621061abfac298200184954 | [
"MIT"
] | null | null | null | /*========================================================================================================
Individual variation in parental care drives divergence of female roles.cpp
==========================================================================================================
Written by:
Xiaoyan Long
Groningen Institute for Evolutionary Life Sciences (Gelifes)
University of Groningen
the Netherlands
Program version
20/07/2020
=========================================================================================================*/
//#include <array>
//
//#include <iostream>
//#include <fstream>
//#include <vector>
//#include <ctime>
//#include <random>
//#include <cassert>
//#include <chrono>
//#include <iomanip>
//#include <utility>
//#include <algorithm>
//#include <string>
//#include <cstdlib>
//#include "evorole.h"
//
//
//
///*============================= Model parameters ===================================*/
///* Model parameters: alleles at four gene loci */
//double varp; // initial value of female preferences
//double vart; // initial value of male ornaments
//int malepc; // initail value of male care
//int femalepc; // initial value of female care
//
//
///* Model parameters: mortality costs */
//double mateMaleU; // male mortality rate in the mating state
//double mateFemaleU; // female...
//double careMaleU; // male mortality rate in the caring state
//double careFemaleU; // female...
//double recMaleU; // male mortality rate in the pre-mating state
//double recFemaleU; // female
//double juvMaleU; // male mortality rate in the juveniel state
//double juvFemaleU; // female...
//double bmate; // the intensity of stabilizing selection on ornamentation in the mating state
//double bcare; // ... in the caring state
//double brec; // ... in the pre-mating state
//
///* Model parameters: population */
//int matePop; // initialization for population size
//double alphaFemale; // degree of female density dependence
//double alphaMale; // degree of male density dependence
//int recoMaleT; // the fixed days when males stay in the pre-mating state
//int recoFemaleT; // the fixed days when females stay in the pre-mating state
//int juvT; // the fixed days when juveniles stay in the juvenile and pre-mating state
//
///* Model parameters: sexual selection */
//double kappa; // scaling factor that affects the intensity of sexual selection
//double alpha; // scaling factor that affects the intensity of sexual selection
//
///* Model parameters: offspring survival */
//double demandOff; // the care demand of offspring
//double syn; // synergy parameter
//
///* Model parameters: mutation*/
//double mp; // mutational rate for gene p (preferences)
//double signmap; // sd step mutation size for p
//double pMaxmutstep; // maximum mutation stepsize for p
//double mt; // mutational rate for tau genes (ornaments)
//double signmaTau; // sd step mutation size for tau
//double tauMaxmutstep; // maximum mutation stepsize for tau
//double mpc; // mutational rate for gene pc (parental care)
//
///* Model parameters: mate choice*/
//bool ifRandom; // if mating is random or not
// // ifRandom = 0, mating is random and there is no sexual selection
// // ifRandom = 1, female preference and male ornamemt coevolve with parental roles
//
///* Model parameters: simulation time*/
//int tEnd;
//
///* set seed */
//unsigned seed = static_cast <unsigned> (std::chrono::high_resolution_clock::now().time_since_epoch().count());
//std::mt19937_64 rng(seed);
//
///* globally distribution*/
//std::uniform_real_distribution <double> uniDis(0.0, 1.0);
//std::bernoulli_distribution female(0.5); // 50% is female and 50% is male
//
///*============================= Model initialization ===================================*/
//
///*remove elements from the vector*/
//namespace detail {
//
// // erases the element at position idx from container
// // relative order behind idx is not preserved
// // runtime complexity: O(1)
// template <typename C, typename I>
// void unstable_erase(C& container, I idx)
// {
// container[idx] = container.back(); // assuming self-assignment is fine
// container.pop_back();
// }
//
//
// // erases the element at position idx from container
// // relative order behind idx is preserved
// // runtime complexity: O(conmtainer.size())
// template <typename C, typename I>
// void stable_erase(C& container, I idx)
// {
// container.erase(container.begin() + idx);
// }
//
//}
//
///*Definition of the class: Individual*/
//class Individual {
//public:
// Individual();
// ~Individual() { };
// double getp() const { return (p); }
// double gettau() const { return (tau); }
// int getpc1() const { return (pc1); }
// int getpc2() const { return (pc2); }
// int getFemCare() const { return (femaleCareDay); }
// int getMaleCare() const { return (maleCareDay); }
// std::pair <int, int> getpc1pc2()
// const {
// return std::pair <int, int>(pc1, pc2);
// }
// int getFemaleRec() const { return(femaleRec); }
// int getMaleRec() const { return(maleRec); }
// int getjuvdays() const { return (juvdays); }
// int getmatingtimes() const { return (matetimes); }
// int getNumOff() const { return (numOff); }
// int getNumSurOff() const { return (numSurOff); }
// void writeFemaleRec(int&);
// void writeMaleRec(int&);
// void writejuvdays(int&);
// void writeFemaleCareDay(int&);
// void writeMaleCareDay(int&);
// void writeMateTimes(int&);
// void writeNumOff(int&);
// void writeNumSurOff(int&);
// void writegenome(double&, double&, std::vector <int>&);
//
//private:
// double p; // individual preference, only expressed in females
// double tau; // individual ornaments, only expressed in males
// int pc1; // parental care only expressed in females
// int pc2; // parental care only expressed in males
// int femaleRec; // pre-mating period of the female
// int maleRec; // pre-mating period of the male
// int juvdays; // juvenile period of individuals
// int femaleCareDay; // days left to provide parental care in female parents
// int maleCareDay; // ... in male parents
// int matetimes; // mating times of an individual (start from 0)
// int numOff; // number of produced offspring of an individual
// int numSurOff; // number of survival offspring of an individual
//};
//
///*Implementation of the class Individual*/
//Individual::Individual()
//{
// p = varp;
// tau = vart;
// pc1 = femalepc;
// pc2 = malepc;
// femaleRec = recoFemaleT;
// maleRec = recoMaleT;
// juvdays = juvT;
// femaleCareDay = pc1;
// maleCareDay = pc2;
// matetimes = 0;
// numSurOff = 0;
// numOff = 0;
//}
//
//void Individual::writegenome(double& P, double& T, std::vector <int>& vecPC)
//{
// p = P;
// tau = T;
// pc1 = vecPC[0];
// pc2 = vecPC[1];
//}
//
//
//void Individual::writeFemaleRec(int& newFemaleRec)
//{
// femaleRec = newFemaleRec;
//}
//
//void Individual::writeMaleRec(int& newMaleRec)
//{
// maleRec = newMaleRec;
//}
//void Individual::writejuvdays(int& newJuvdays)
//{
// juvdays = newJuvdays;
//}
//
//void Individual::writeFemaleCareDay(int& newFemaleCareDay)
//{
// femaleCareDay = newFemaleCareDay;
//}
//
//void Individual::writeMaleCareDay(int& newMaleCareDay)
//{
// maleCareDay = newMaleCareDay;
//}
//
//void Individual::writeMateTimes(int& newwriteMateTimes)
//{
// matetimes = newwriteMateTimes;
//}
//
//void Individual::writeNumOff(int& newNumOff)
//{
// numOff = newNumOff;
//}
//
//void Individual::writeNumSurOff(int& newNumSurOff)
//{
// numSurOff = newNumSurOff;
//}
//
//
///*mating, caing, pre-mating, juvenile state for males and females*/
//std::vector <Individual> mateMale;
//std::vector <Individual> mateFemale;
//std::vector <Individual> careMale;
//std::vector <Individual> careFemale;
//std::vector <Individual> recoMale;
//std::vector <Individual> recoFemale;
//std::vector <Individual> juvMale;
//std::vector <Individual> juvFemale;
//
//// output files
//std::ofstream allTrait; // to record the population average value for all traits.
//std::ofstream offspringTrait; // to record offspring trait
//std::ofstream para; // to record the parameters
//std::ofstream deadIndividual; // to record all dead individuals
//
//
//
///*=============================== Start to simulate ===================================*/
//
//// average value for all traits (male care, female care, preferences, ornaments)
//void averageTrait()
//{
// double sumFemalePC = 0.0;
// double sumMalePC = 0.0;
// double sumPreference = 0.0;
// double sumOrnaments = 0.0;
// for (int i = 0; i < mateMale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (mateMale[i].getpc1());
// sumMalePC += static_cast <double> (mateMale[i].getpc2());
// sumPreference += mateMale[i].getp();
// sumOrnaments += mateMale[i].gettau();
// }
//
// for (int i = 0; i < careMale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (careMale[i].getpc1());
// sumMalePC += static_cast <double> (careMale[i].getpc2());
// sumPreference += careMale[i].getp();
// sumOrnaments += careMale[i].gettau();
// }
//
// for (int i = 0; i < recoMale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (recoMale[i].getpc1());
// sumMalePC += static_cast <double> (recoMale[i].getpc2());
// sumPreference += recoMale[i].getp();
// sumOrnaments += recoMale[i].gettau();
// }
//
// for (int i = 0; i < juvMale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (juvMale[i].getpc1());
// sumMalePC += static_cast <double> (juvMale[i].getpc2());
// sumPreference += juvMale[i].getp();
// sumOrnaments += juvMale[i].gettau();
// }
//
// for (int i = 0; i < mateFemale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (mateFemale[i].getpc1());
// sumMalePC += static_cast <double> (mateFemale[i].getpc2());
// sumPreference += mateFemale[i].getp();
// sumOrnaments += mateFemale[i].gettau();
// }
//
// for (int i = 0; i < careFemale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (careFemale[i].getpc1());
// sumMalePC += static_cast <double> (careFemale[i].getpc2());
// sumPreference += careFemale[i].getp();
// sumOrnaments += careFemale[i].gettau();
// }
//
// for (int i = 0; i < recoFemale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (recoFemale[i].getpc1());
// sumMalePC += static_cast <double> (recoFemale[i].getpc2());
// sumPreference += recoFemale[i].getp();
// sumOrnaments += recoFemale[i].gettau();
// }
//
// for (int i = 0; i < juvFemale.size(); ++i)
// {
// sumFemalePC += static_cast <double> (juvFemale[i].getpc1());
// sumMalePC += static_cast <double> (juvFemale[i].getpc2());
// sumPreference += juvFemale[i].getp();
// sumOrnaments += juvFemale[i].gettau();
// }
//
//
// double popSize = static_cast <double> (mateMale.size()
// + careMale.size() + recoMale.size()
// + juvMale.size() + mateFemale.size()
// + careFemale.size() + recoFemale.size()
// + juvFemale.size());
//
// sumFemalePC /= popSize;
// sumMalePC /= popSize;
// sumPreference /= popSize;
// sumOrnaments /= popSize;
// allTrait << ',' << sumFemalePC << ',' << sumMalePC << ',' << sumPreference << ',' << sumOrnaments;
//}
//
//double asrValue()
//{ // asr: male/(male+female), for all adults
// double ASR = static_cast <double> (mateMale.size() + careMale.size() + recoMale.size())
// / (static_cast <double> (mateFemale.size() + careFemale.size() + recoFemale.size() + mateMale.size()
// + careMale.size() + recoMale.size()));
// return ASR;
//}
//
//double osrValue()
//{ // osr: male/(male+female), for adults in the mating state
// double OSR;
// double mateSize = static_cast <double> (mateFemale.size() + mateMale.size());
// if (mateSize != 0.0)
// OSR = static_cast <double> (mateMale.size())
// / static_cast <double> (mateFemale.size() + mateMale.size());
// else
// OSR = 0.5;
// return OSR;
//}
//
//double psrValue()
//{ // psr: male/(male+female), for juveniles
// double psr;
// double juvSize = static_cast <double> (juvFemale.size() + juvMale.size());
// if (juvSize != 0.0)
// psr = static_cast <double> (juvMale.size()) / juvSize;
// else psr = 0.5;
// return psr;
//}
//
//// traits mutation
//void addmutationp(double& val) { // to add mutation for alleles p
// std::bernoulli_distribution ismutation(mp);
// if (ismutation(rng)) {
//
// std::cauchy_distribution <double> dis(0.0, signmap);
//
// double mut = dis(rng);
//
// if (abs(mut) > pMaxmutstep) {
//
// if (mut < 0.0)
// mut = 0.0 - pMaxmutstep;
// else
// mut = pMaxmutstep;
// }
// val += mut;
// if (val < 0.0) {
// val = 0.0;
// }
// }
//}
//
//void addmutationTau(double& val) { // to add mutation for alleles t
// std::bernoulli_distribution ismutation(mt);
// if (ismutation(rng)) {
// std::cauchy_distribution <double> dis(0.0, signmaTau);
// double mut = dis(rng);
//
// if (abs(mut) > tauMaxmutstep) {
//
// if (mut < 0.0)
// mut = 0.0 - tauMaxmutstep;
// else
// mut = tauMaxmutstep;
// }
// val += mut;
//
// if (val < 0.0) {
// val = 0.0;
// }
// }
//}
//
//void addmutationPC(int& val) { // to add mutation for alleles pc
// std::bernoulli_distribution ismutation(mpc);
// if (ismutation(rng)) {
// std::bernoulli_distribution isPlus(0.5);
// if (isPlus(rng))
// val++;
// else val--;
// if (val < 0) {
// val = 0;
// }
// }
//}
//
//Individual madeOff(const Individual& fem, const Individual& male) {
// // function to create an offspring by its female and male
//
// double newp; // offspring preferences
// double newt; // offspring ornaments
// std::vector <int> newpc(2, 0); // offspring parental care
// int newFemaleCareDays; // maternal care
// int newMaleCareDays; // paternal care
//
// std::bernoulli_distribution Nallele(0.5); // 50% pro to get gene from mom, 50% from dad
//
// // select new alleles p
// double pfem = fem.getp();
// double pmale = male.getp();
// int x1 = Nallele(rng);
// switch (x1) {
// case 0:
// newp = pfem;
// break;
// case 1:
// newp = pmale;
// break;
// default:
// std::cout << " something wronk in chosing allele pc for offspring";
// break;
// }
// addmutationp(newp);
//
// // select new alleles t (the same as p)
// double tfem = fem.gettau();
// double tmale = male.gettau();
// int x2 = Nallele(rng);
// switch (x2) {
// case 0:
// newt = tfem;
// break;
// case 1:
// newt = tmale;
// break;
// default:
// std::cout << " something wronk in chosing allele t for offspring";
// break;
// }
// addmutationTau(newt);
//
// // select new alleles pc1 (the same as p)
// std::pair <int, int> pcfem = fem.getpc1pc2();
// std::pair <int, int> pcmal = male.getpc1pc2();
// int x3 = Nallele(rng);
// switch (x3) {
// case 0:
// newpc[0] = pcfem.first;
// break;
// case 1:
// newpc[0] = pcmal.first;
// break;
// default:
// std::cout << " something wronk in chosing allele pc for offspring"; // in case doesn't work.
// break;
// }
// addmutationPC(newpc[0]);
//
// // select new alleles pc2 (the same as p)
// int x4 = Nallele(rng);
// switch (x4) {
// case 0:
// newpc[1] = pcfem.second;
// break;
// case 1:
// newpc[1] = pcmal.second;
// break;
// default:
// std::cout << " something wronk in chosing allele pc for offspring"; // in case doesn't work.
// break;
// }
// addmutationPC(newpc[1]);
//
// Individual newOff;
// newOff.writegenome(newp, newt, newpc);
// newOff.writeFemaleCareDay(newpc[0]);
// newOff.writeMaleCareDay(newpc[1]);
// return newOff;
//}
//
//int lotteryMale(const std::vector <Individual>& male)
//{
// std::vector <double> mortalityRates(male.size());
// for (int i = 0; i < mortalityRates.size(); ++i)
// mortalityRates[i] = mateMaleU + bmate * male[i].gettau() * male[i].gettau();
// std::discrete_distribution <int> lottM(mortalityRates.begin(), mortalityRates.end());
// return lottM(rng);
//}
//
//int selectIndividual(std::vector<Individual>& vec) {
// std::uniform_int_distribution <int> fDis(0, static_cast<int>(vec.size()) - 1);
// int j = fDis(rng);
// return j;
//}
//
//// mating state: check how many individual would die in the mating state every time step
//void checkMatingDeath(const int& t)
//{
// // check the death of males (if there is sexual selection, males with larger ornaments have higher probability of dying)
// if (mateMale.size() > 0) {
// double sumMaleDeath = 0.0;
// for (int i = 0; i < mateMale.size(); ++i)
// sumMaleDeath += mateMaleU + bmate * mateMale[i].gettau() * mateMale[i].gettau();
// std::poisson_distribution <int> maleDeath(sumMaleDeath);
// int numMaleDeath = maleDeath(rng);
//
// if (numMaleDeath > 0)
// {
// int m;
// for (int i = 0; i < numMaleDeath; ++i)
// {
// m = lotteryMale(mateMale);
// if (t % 40000 == 0)
// {
// deadIndividual << t << ',' << "matemale" << ',' << ',' << mateMale[m].getp() << ',' << mateMale[m].gettau() << ',' << mateMale[m].getpc1() << ','
// << mateMale[m].getpc2() << ',' << mateMale[m].getmatingtimes() << ',' << mateMale[m].getNumOff() << ',' << mateMale[m].getNumSurOff() << std::endl;
// }
// detail::unstable_erase(mateMale, m);
// }
// }
// }
// // check the death of females
// if (mateFemale.size() > 0) {
// double sumFemaleDeath = mateFemaleU * static_cast <double> (mateFemale.size());
// std::poisson_distribution <int> femaleDeath(sumFemaleDeath);
// int numFemaleDeath = femaleDeath(rng);
// if (numFemaleDeath > 0)
// {
// int f;
// for (int i = 0; i < numFemaleDeath; ++i)
// {
// f = selectIndividual(mateFemale);
// if (t % 40000 == 0)
// {
// deadIndividual << t << ',' << "matefemale" << ',' << ',' << mateFemale[f].getp() << ',' << mateFemale[f].gettau() << ',' << mateFemale[f].getpc1() << ','
// << mateFemale[f].getpc2() << ',' << mateFemale[f].getmatingtimes() << ',' << mateFemale[f].getNumOff() << ',' << mateFemale[f].getNumSurOff() << std::endl;
// }
// detail::unstable_erase(mateFemale, f);
// }
// }
// }
//}
//
//void ifmate(const int& femID, const int& maleID, int& t)
//{ // the mated pairs switch to the caring state and produce offspring
// int newmatingFT = mateFemale[femID].getmatingtimes() + 1;
// int newmatingMT = mateMale[maleID].getmatingtimes() + 1;
// mateFemale[femID].writeMateTimes(newmatingFT);
// mateMale[maleID].writeMateTimes(newmatingMT);
// double maleCareT;
// double femaleCareT;
// double surProMale = pow((1.0 - (careMaleU + bcare * mateMale[maleID].gettau() * mateMale[maleID].gettau())),
// static_cast <double> (mateMale[maleID].getpc2()));
// std::bernoulli_distribution surMale(surProMale);
// if (surMale(rng))
// {
// maleCareT = static_cast <double> (mateMale[maleID].getpc2());
// careMale.push_back(mateMale[maleID]);
// }
// else
// { // if the male would die during providing care, expected care duration would be calculated
// double malePCtau = (1.0 / careMaleU) -
// (mateMale[maleID].getpc2() / (exp(careMaleU * mateMale[maleID].getpc2()) - 1.0));
// maleCareT = malePCtau;
// if (t % 40000 == 0)
// {
// deadIndividual << t << ',' << "caremale" << ',' << ',' << mateMale[maleID].getp() << ',' << mateMale[maleID].gettau() << ',' << mateMale[maleID].getpc1() << ','
// << mateMale[maleID].getpc2() << ',' << mateMale[maleID].getmatingtimes() << ',' << mateMale[maleID].getNumOff() << ',' << mateMale[maleID].getNumSurOff() << std::endl;
// }
// }
//
// // the same step for the female
// double surProFemale = pow((1.0 - careFemaleU), static_cast <double> (mateFemale[femID].getpc1()));
// std::bernoulli_distribution surFemale(surProFemale);
// if (surFemale(rng))
// {
// femaleCareT = static_cast <double> (mateFemale[femID].getpc1());
// careFemale.push_back(mateFemale[femID]);
// }
// else
// {
// double femalePCtau = (1.0 / careFemaleU) - (mateFemale[femID].getpc1() /
// (exp(careFemaleU * mateFemale[femID].getpc1()) - 1.0));
// femaleCareT = femalePCtau;
// if (t % 40000 == 0)
// {
// deadIndividual << t << ',' << "carefemale" << ',' << mateFemale[femID].getp() << ',' << mateFemale[femID].gettau() << ',' << mateFemale[femID].getpc1() << ','
// << mateFemale[femID].getpc2() << ',' << mateFemale[femID].getmatingtimes() << ',' << mateFemale[femID].getNumOff() << ',' << mateFemale[femID].getNumSurOff() << std::endl;
// }
// }
//
// // the male and the female produce offspring after mating, the offspring survival probability depends on the total care duration
// double totalCare = maleCareT + femaleCareT + maleCareT * femaleCareT * syn;
// double surPro = (totalCare * totalCare) / (totalCare * totalCare + demandOff * demandOff);
// if (surPro > uniDis(rng)) {
// int newNumMaleOff = mateMale[maleID].getNumOff() + 1;
// int newNumFemeOff = mateFemale[femID].getNumOff() + 1;
// mateMale[maleID].writeNumOff(newNumMaleOff);
// mateFemale[femID].writeNumOff(newNumFemeOff);
// }
// double popSize = static_cast <double> (mateMale.size() + mateFemale.size() + careMale.size()
// + careFemale.size() + recoMale.size() + recoFemale.size() + juvMale.size() + juvFemale.size());
// double breedSucFem = surPro / (1.0 + alphaFemale * popSize);
// double breedSucMale = surPro / (1.0 + alphaMale * popSize);
//
// // write the days that offspring should stay with their parents
// int realmalecareDays = static_cast <int> (ceil(maleCareT)) + juvT; // we use ceil value, e.g.: 5.2-->6
// int realfemalecareDays = static_cast <int> (ceil(femaleCareT)) + juvT;
// int x = female(rng);
// switch (x)
// {
// case 0:
// // if the offspring is a female
// if (uniDis(rng) < breedSucFem && uniDis(rng) < pow((1.0 - juvFemaleU), static_cast <double> (juvT)))
// {
// // if the offspring still survives after juvenile and pre-mating state
// int newNumSurMaleOff = mateMale[maleID].getNumSurOff() + 1;
// int newNumSurFemeOff = mateFemale[femID].getNumSurOff() + 1;
// mateMale[maleID].writeNumSurOff(newNumSurMaleOff);
// mateFemale[femID].writeNumSurOff(newNumSurFemeOff);
// Individual newFelOffspring = madeOff(mateFemale[femID], mateMale[maleID]);
// if (realfemalecareDays > realmalecareDays) {
// newFelOffspring.writejuvdays(realfemalecareDays);
// }
// else {
// newFelOffspring.writejuvdays(realmalecareDays);
// }
// juvFemale.push_back(newFelOffspring);
// if (t % 40000 == 0) {
// offspringTrait << t << ',' << "female" << ',' << mateMale[maleID].getp() << ',' << mateMale[maleID].gettau() << ','
// << mateMale[maleID].getpc1() << ',' << mateMale[maleID].getpc2() << ','
// << mateFemale[femID].getp() << ',' << mateFemale[femID].gettau() << ',' << mateFemale[femID].getpc1() << ','
// << mateFemale[femID].getpc2() << ','
// << juvFemale.back().getp() << ',' << juvFemale.back().gettau() << ',' << juvFemale.back().getpc1() << ','
// << juvFemale.back().getpc2() << ',' << juvFemale.back().getjuvdays() << std::endl;
//
// }
// }
// break;
// case 1:
// // if the offspring is a male
// if (uniDis(rng) < breedSucMale && uniDis(rng) < pow((1.0 - juvMaleU), static_cast <double> (juvT)))
// {
// int newNumSurMaleOff = mateMale[maleID].getNumSurOff() + 1;
// int newNumSurFemeOff = mateFemale[femID].getNumSurOff() + 1;
// mateMale[maleID].writeNumSurOff(newNumSurMaleOff);
// mateFemale[femID].writeNumSurOff(newNumSurFemeOff);
// Individual newMaleOffspring = madeOff(mateFemale[femID], mateMale[maleID]);
// if (realfemalecareDays > realmalecareDays) {
// newMaleOffspring.writejuvdays(realfemalecareDays);
// }
// else {
// newMaleOffspring.writejuvdays(realmalecareDays);
// }
// juvMale.push_back(newMaleOffspring);
// if (t % 40000 == 0) {
// offspringTrait << t << ',' << "male" << ',' << mateMale[maleID].getp() << ',' << mateMale[maleID].gettau() << ','
// << mateMale[maleID].getpc1() << ',' << mateMale[maleID].getpc2() << ','
// << mateFemale[femID].getp() << ',' << mateFemale[femID].gettau() << ',' << mateFemale[femID].getpc1() << ','
// << mateFemale[femID].getpc2() << ','
// << juvMale.back().getp() << ',' << juvMale.back().gettau() << ',' << juvMale.back().getpc1() << ','
// << juvMale.back().getpc2() << ',' << juvMale.back().getjuvdays() << std::endl;
// }
// }
// break;
// default:
// std::cout << "Something wrong with producing offspring" << std::endl;
// break;
// }
// detail::unstable_erase(mateMale, maleID);
// detail::unstable_erase(mateFemale, femID);
//}
//
//
//void getCaringDays(int& t)
//{ // individuals seek mating chances, produce offspring and provide parental care
// checkMatingDeath(t);
//
// if (mateMale.size() > 0 && mateFemale.size() > 0)
// {
// std::shuffle(mateFemale.begin(), mateFemale.end(), rng);
// if (ifRandom == 0) { // in the mating state, mating is random
// for (int i = 0; i < mateFemale.size(); ++i)
// {
// if (mateMale.size() > 0)
// {
//
// int m = selectIndividual(mateMale);
// ifmate(i, m, t);
// --i;
// }
// else break;
// }
// }
// else
// { // if sexual selection is considered
// for (int i = 0; i < mateFemale.size(); ++i)
// {
// if (mateMale.size() > 0) {
// double p = mateFemale[i].getp();
// int m = selectIndividual(mateMale);
// double s = mateMale[m].gettau();
// double attrac = 1.0 / (1.0 + kappa * exp(alpha * (p - s)));
// if (uniDis(rng) < attrac)
// { // if the male is attractive to the female, the female would mate with the male
// ifmate(i, m, t);
// --i;
// }
// }
// else break;
// }
// }
// }
//}
//
//
//void gotoRecover(const int& t)
//{ // individuals enter the pre-mating state after caring
// // (no pre-mating in the baseline model)
// for (int i = 0; i < careMale.size();)
// {
// int malePC = careMale[i].getMaleCare();
// if (malePC > 0)
// {
// --malePC;
// careMale[i].writeMaleCareDay(malePC);
// ++i;
// }
// else
// {
// double surProMale = pow((1.0 - (recMaleU + brec * careMale[i].gettau() * careMale[i].gettau())),
// static_cast <double> (recoMaleT));
//
// std::bernoulli_distribution surMale(surProMale);
// if (surMale(rng))
// { // if the male still survives after caring, he enter the pre-mating state
// int maleCareDays = careMale[i].getpc2();
// careMale[i].writeMaleCareDay(maleCareDays);
// recoMale.push_back(careMale[i]);
// }
// detail::unstable_erase(careMale, i);
// }
// }
//
// for (int i = 0; i < careFemale.size();)
// {
// int femalePC = careFemale[i].getFemCare();
// if (femalePC > 0)
// {
// --femalePC;
// careFemale[i].writeFemaleCareDay(femalePC);
// ++i;
// }
// else
// {
// double surProFemale = pow((1.0 - recFemaleU), static_cast <double> (recoFemaleT));
// std::bernoulli_distribution surFemale(surProFemale);
// if (surFemale(rng))
// {
// int femaleCareDays = careFemale[i].getpc1();
// careFemale[i].writeFemaleCareDay(femaleCareDays);
// recoFemale.push_back(careFemale[i]);
// }
// detail::unstable_erase(careFemale, i);
// }
// }
//}
//
//void backtoMating(const int& t)
//{ // Individuals come back to the mating state after pre-mating
// for (int i = 0; i < recoMale.size();)
// {
// int maleRec = recoMale[i].getMaleRec();
// if (maleRec > 0)
// {
// --maleRec;
// recoMale[i].writeMaleRec(maleRec);
// ++i;
// }
// else
// {
// recoMale[i].writeMaleRec(recoMaleT);
// mateMale.push_back(recoMale[i]);
// detail::unstable_erase(recoMale, i);
// }
// }
//
// for (int i = 0; i < recoFemale.size();)
// {
// int femaleRec = recoFemale[i].getFemaleRec();
// if (femaleRec > 0)
// {
// --femaleRec;
// recoFemale[i].writeFemaleRec(femaleRec);
// ++i;
// }
// else
// {
// recoFemale[i].writeFemaleRec(recoFemaleT);
// mateFemale.push_back(recoFemale[i]);
// detail::unstable_erase(recoFemale, i);
// }
// }
//}
//
//void juvToMating()
//{ // juveniles enter the mating state after getting mature
// for (int i = 0; i < juvMale.size();)
// {
// int juvpoolT = juvMale[i].getjuvdays();
// if (juvpoolT > 0)
// {
// --juvpoolT;
// juvMale[i].writejuvdays(juvpoolT);
// ++i;
// }
// else
// {
// juvMale[i].writejuvdays(juvT);
// mateMale.push_back(juvMale[i]);
// detail::unstable_erase(juvMale, i);
// }
// }
//
// for (int i = 0; i < juvFemale.size();)
// {
// int juvpoolT = juvFemale[i].getjuvdays();
// if (juvpoolT > 0)
// {
// --juvpoolT;
// juvFemale[i].writejuvdays(juvpoolT);
// ++i;
// }
// else
// {
// juvFemale[i].writejuvdays(juvT);
// mateFemale.push_back(juvFemale[i]);
// detail::unstable_erase(juvFemale, i);
// }
// }
//}
//
//void refreshVectors() {
// mateMale = std::vector <Individual>(matePop / 2);
// mateFemale = std::vector <Individual>(matePop / 2);
// careMale = std::vector <Individual>(0);
// careFemale = std::vector <Individual>(0);
// recoMale = std::vector <Individual>(0);
// recoFemale = std::vector <Individual>(0);
// juvMale = std::vector <Individual>(0);
// juvFemale = std::vector <Individual>(0);
//
//}
//
//void readParamaters(const std::string& parFileName)
//{
// std::ifstream ifs(parFileName.c_str(), std::ios::in);
// if (!ifs.is_open()) {
// std::cerr << "error: unable to open parameter file " << parFileName << '\n';
// exit(EXIT_FAILURE);
// }
// std::clog << "reading parameters from file " << parFileName << '\n';
// for (;;) {
// // read a parameter name
// std::string parID;
// ifs >> parID;
// if (ifs.good()) {
// // read in parameter value in the appropriate way
// if (parID == "varp") {
// ifs >> varp;
// std::clog << "parameter " << parID << " set to " << varp << '\n';
// }
// else if (parID == "vart") {
// ifs >> vart;
// std::clog << "parameter " << parID << " set to " << vart << '\n';
// }
// else if (parID == "malepc") {
// ifs >> malepc;
// std::clog << "parameter " << parID << " set to " << malepc << '\n';
// }
// else if (parID == "femalepc") {
// ifs >> femalepc;
// std::clog << "parameter " << parID << " set to " << femalepc << '\n';
// }
// else if (parID == "mateMaleU") {
// ifs >> mateMaleU;
// std::clog << "parameter " << parID << " set to " << mateMaleU << '\n';
// }
// else if (parID == "mateFemaleU") {
// ifs >> mateFemaleU;
// std::clog << "parameter " << parID << " set to " << mateFemaleU << '\n';
// }
// else if (parID == "careMaleU") {
// ifs >> careMaleU;
// std::clog << "parameter " << parID << " set to " << careMaleU << '\n';
// }
// else if (parID == "careFemaleU") {
// ifs >> careFemaleU;
// std::clog << "parameter " << parID << " set to " << careFemaleU << '\n';
// }
// else if (parID == "recMaleU") {
// ifs >> recMaleU;
// std::clog << "parameter " << parID << " set to " << recMaleU << '\n';
// }
// else if (parID == "recFemaleU") {
// ifs >> recFemaleU;
// std::clog << "parameter " << parID << " set to " << recFemaleU << '\n';
// }
// else if (parID == "juvMaleU") {
// ifs >> juvMaleU;
// std::clog << "parameter " << parID << " set to " << juvMaleU << '\n';
// }
// else if (parID == "juvFemaleU") {
// ifs >> juvFemaleU;
// std::clog << "parameter " << parID << " set to " << juvFemaleU << '\n';
// }
// else if (parID == "bmate") {
// ifs >> bmate;
// std::clog << "parameter " << parID << " set to " << bmate << '\n';
// }
// else if (parID == "bcare") {
// ifs >> bcare;
// std::clog << "parameter " << parID << " set to " << bcare << '\n';
// }
// else if (parID == "brec") {
// ifs >> brec;
// std::clog << "parameter " << parID << " set to " << brec << '\n';
// }
// else if (parID == "matePop") {
// ifs >> matePop;
// std::clog << "parameter " << parID << " set to " << matePop << '\n';
// }
// else if (parID == "alphaFemale") {
// ifs >> alphaFemale;
// std::clog << "parameter " << parID << " set to " << alphaFemale << '\n';
// }
// else if (parID == "alphaMale") {
// ifs >> alphaMale;
// std::clog << "parameter " << parID << " set to " << alphaMale << '\n';
// }
// else if (parID == "recoMaleT") {
// ifs >> recoMaleT;
// std::clog << "parameter " << parID << " set to " << recoMaleT << '\n';
// }
// else if (parID == "recoFemaleT") {
// ifs >> recoFemaleT;
// std::clog << "parameter " << parID << " set to " << recoFemaleT << '\n';
// }
// else if (parID == "juvT") {
// ifs >> juvT;
// std::clog << "parameter " << parID << " set to " << juvT << '\n';
// }
// else if (parID == "kappa") {
// ifs >> kappa;
// std::clog << "parameter " << parID << " set to " << kappa << '\n';
// }
// else if (parID == "alpha") {
// ifs >> alpha;
// std::clog << "parameter " << parID << " set to " << alpha << '\n';
// }
// else if (parID == "demandOff") {
// ifs >> demandOff;
// std::clog << "parameter " << parID << " set to " << demandOff << '\n';
// }
// else if (parID == "syn") {
// ifs >> syn;
// std::clog << "parameter " << parID << " set to " << syn << '\n';
// }
// else if (parID == "mp") {
// ifs >> mp;
// std::clog << "parameter " << parID << " set to " << mp << '\n';
// }
// else if (parID == "signmap") {
// ifs >> signmap;
// std::clog << "parameter " << parID << " set to " << signmap << '\n';
// }
// else if (parID == "pMaxmutstep") {
// ifs >> pMaxmutstep;
// std::clog << "parameter " << parID << " set to " << pMaxmutstep << '\n';
// }
// else if (parID == "mt") {
// ifs >> mt;
// std::clog << "parameter " << parID << " set to " << mt << '\n';
// }
// else if (parID == "signmaTau") {
// ifs >> signmaTau;
// std::clog << "parameter " << parID << " set to " << signmaTau << '\n';
// }
// else if (parID == "tauMaxmutstep") {
// ifs >> tauMaxmutstep;
// std::clog << "parameter " << parID << " set to " << tauMaxmutstep << '\n';
// }
// else if (parID == "mpc") {
// ifs >> mpc;
// std::clog << "parameter " << parID << " set to " << mpc << '\n';
// }
//
// else if (parID == "ifRandom") {
// ifs >> ifRandom;
// std::clog << "parameter " << parID << " set to " << ifRandom << '\n';
// }
// else if (parID == "tEnd") {
// ifs >> tEnd;
// std::clog << "parameter " << parID << " set to " << tEnd << '\n';
// }
// else {
// std::cerr << "error: unknown parameter name in file " << parFileName << '\n';
// exit(EXIT_FAILURE);
// }
// }
// else break; // to exit when EOF is reached
// }
//}
//
//void recordParameter() { // write parameter on the output file
// para << " Seed = " << seed << "\n";
// para << " varp" << ',' << varp << "\n";
// para << " vart" << ',' << vart << "\n";
// para << " malepcmin " << ',' << malepc << "\n";
// para << " femalepcmin " << ',' << femalepc << "\n";
// para << " mateMaleU " << ',' << mateMaleU << "\n";
// para << " mateFemaleU " << ',' << mateFemaleU << "\n";
// para << " careMaleU " << ',' << careMaleU << "\n";
// para << " careFemaleU " << ',' << careFemaleU << "\n";
// para << " recMaleU " << ',' << recMaleU << "\n";
// para << " recFemaleU " << ',' << recFemaleU << "\n";
// para << " juvMaleU " << ',' << juvMaleU << "\n";
// para << " juvFemaleU " << ',' << juvFemaleU << "\n";
// para << " bmate " << ',' << bmate << "\n";
// para << " bcare " << ',' << bcare << "\n";
// para << " brec " << ',' << brec << "\n";
// para << " matePop " << ',' << matePop << "\n";
// para << " alphaFemale " << ',' << alphaFemale << "\n";
// para << " alphaMale " << ',' << alphaMale << "\n";
// para << " recoMaleT " << ',' << recoMaleT << "\n";
// para << " recoFemaleT " << ',' << recoFemaleT << "\n";
// para << " juvT " << ',' << juvT << "\n";
// para << " kappa " << ',' << kappa << "\n";
// para << " alpha " << ',' << alpha << "\n";
// para << " demandOff " << ',' << demandOff << "\n";
// para << " syn " << ',' << syn << "\n";
// para << " mp " << ',' << mp << "\n";
// para << " signmap " << ',' << signmap << "\n";
// para << " pMaxmutstep " << ',' << pMaxmutstep << "\n";
// para << " mt " << ',' << mt << "\n";
// para << " signmaTau " << ',' << signmaTau << "\n";
// para << " tauMaxmutstep " << ',' << tauMaxmutstep << "\n";
// para << " mpc " << ',' << mpc << "\n";
// para << " ifRandom " << ',' << ifRandom << "\n";
// para << " tEnd " << ',' << tEnd << "\n";
//}
//
//
//
//int main(int argc, const char* argv[])
//{
// for (int file_number = 1; file_number <= 2; ++file_number) {
// std::clog << "starting program" << argv[0] << '\n';
//
// // extract parameterfilename from program arguments or use default
// std::string fileName = "parameter_" + std::to_string(file_number) + ".txt";
// std::string parameterFileName(fileName);
// if (argc > 1)
// parameterFileName = argv[1];
// readParamaters(parameterFileName);
// for (int simulation_number = 1; simulation_number <= 100; ++simulation_number)
// {
//
// refreshVectors();
//
// std::string fileName1 = "1parameter_" + std::to_string(file_number) + "_Parental_Care_" + std::to_string(simulation_number) + ".csv";
// std::string fileName2 = "1parameter_" + std::to_string(file_number) + "_individual_" + std::to_string(simulation_number) + ".csv";
// std::string fileName3 = "1parameter_" + std::to_string(file_number) + "_parameter_" + std::to_string(simulation_number) + ".csv";
// std::string fileName4 = "1parameter_" + std::to_string(file_number) + "_deadIndividual_" + std::to_string(simulation_number) + ".csv";
//
// allTrait.open(fileName1, std::ios_base::ate);
// offspringTrait.open(fileName2, std::ios_base::ate);
// para.open(fileName3, std::ios_base::ate);
// deadIndividual.open(fileName4, std::ios_base::ate);
// recordParameter();
//
// allTrait << "day" << ',' << "osr" << ',' << "asr" << ',' << "psr"
// << ',' << "femalePC" << ',' << "malePC" << ',' << "preference"
// << ',' << "ornaments" << ',' << "popSize" << ',' << "mateMale"
// << ',' << "mateFemale" << ',' << "careMale" << ',' << "careFemale"
// << ',' << "recoMale" << ',' << "recoFemale" << ',' << "juvMale" << ',' << "juvFemale" << std::endl;
//
// offspringTrait << "day" << ',' << "female" << ',' << "malep1" << ',' << "malet" << ',' << "malepc1" << ',' << "malepc2" << ','
// << "femalep1" << ',' << "femalet" << ',' << "femalepc1" << ',' << "femalepc2" << ','
// << "offp1" << ',' << "offt" << ',' << "offpc1" << ',' << "offpc2" << ',' << "offjuvdays" << std::endl;
// deadIndividual << "day" << ',' << "individual" << ',' << ',' << "preference" << ',' << "ornaments" << ',' << "pc1" << ',' << "pc2" << ',' << "matingT"
// << ',' << "numOff" << ',' << "numSurOff" << std::endl;
//
//
// for (int day = 0; day < tEnd; ++day)
// {
// if (day % 1000 == 0)
// {
// double osr = osrValue();
// double asr = asrValue();
// double psr = psrValue();
// allTrait << day << ',' << osr << ',' << asr << ',' << psr;
// }
//
// // males and females seek mating opportunities and produce offspring
// getCaringDays(day);
//
// // Individuals switch to pre-mating state after caring
// gotoRecover(day);
//
// // Individuals re-enter the mating state after pre-mating
// backtoMating(day);
//
// // offspring would enter the mating state after getting mature
// juvToMating();
//
// if (day % 1000 == 0) {
// std::cout << day << ':' << "mating pool" << "\t" << mateMale.size() << '\t' << mateFemale.size() << std::endl;
// std::cout << day << ':' << "caringing pool" << '\t' << careMale.size() << '\t' << careFemale.size() << std::endl;
// std::cout << day << ':' << "recoveringing pool" << '\t' << recoMale.size() << '\t' << recoFemale.size() << std::endl;
// std::cout << day << ':' << "juving pool" << '\t' << juvMale.size() << '\t' << juvFemale.size() << std::endl;
//
// int mateMalePop = static_cast <int> (mateMale.size());
// int mateFemalePop = static_cast <int> (mateFemale.size());
// int careMalePop = static_cast <int> (careMale.size());
// int careFemalePop = static_cast <int> (careFemale.size());
// int recoMalePop = static_cast <int> (recoMale.size());
// int recoFemalePop = static_cast <int> (recoFemale.size());
// int juvMalePop = static_cast <int> (juvMale.size());
// int juvFemalePop = static_cast <int> (juvFemale.size());
// int popSize = static_cast <int> (mateMale.size()) + static_cast <int> (mateFemale.size())
// + static_cast <int> (careMale.size()) + static_cast <int> (careFemale.size())
// + static_cast <int> (recoMale.size()) + static_cast <int> (recoFemale.size())
// + static_cast <int> (juvMale.size()) + static_cast <int> (juvFemale.size());
//
// averageTrait();
// allTrait << ',' << popSize << ',' << mateMalePop << ',' << mateFemalePop << ',' <<
// careMalePop << ',' << careFemalePop << ',' << recoMalePop << ',' << recoFemalePop << ',' <<
// juvMalePop << ',' << juvFemalePop << std::endl;
//
// }
//
// }
// allTrait.close();
// offspringTrait.close();
// para.close();
// deadIndividual.close();
// }
// }
//}
//
#include <filesystem>
#include "evorole.h"
#include "simulation.h"
#include "recorder.h"
namespace evorole {
void Parameter::sanity_check(const Parameter& param)
{
// ToDo: test test test, throw if something seems fishy
}
void run_simulation(const Parameter& param, const std::filesystem::path& out, bool verbose)
{
auto recorder = std::make_unique<Recorder>(param, out, verbose);
Simulation(param, std::move(recorder)).run();
}
}
| 36.446384 | 181 | 0.545946 | [
"vector",
"model"
] |
b21543fda327a2a4b3deecc0aab5f37f1a5a8142 | 2,476 | cpp | C++ | MMVII/src/Geom3D/cCloudClip.cpp | rumenmitrev/micmac | 065de918bb963a1c0f472504862c3060e180d48b | [
"CECILL-B"
] | null | null | null | MMVII/src/Geom3D/cCloudClip.cpp | rumenmitrev/micmac | 065de918bb963a1c0f472504862c3060e180d48b | [
"CECILL-B"
] | null | null | null | MMVII/src/Geom3D/cCloudClip.cpp | rumenmitrev/micmac | 065de918bb963a1c0f472504862c3060e180d48b | [
"CECILL-B"
] | null | null | null | #include "include/MMVII_all.h"
namespace MMVII
{
/** A basic application for clipping 3d data , almost all the job is done in
* libraries so it essentially interface to command line */
class cAppliCloudClip : public cMMVII_Appli
{
public :
cAppliCloudClip(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec);
private :
int Exe() override;
cCollecSpecArg2007 & ArgObl(cCollecSpecArg2007 & anArgObl) override ;
cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override ;
// --- Mandatory ----
std::string mNameCloudIn;
std::string mNameMasq;
// --- Optionnal ----
std::string mNameCloudOut;
bool mBinOut;
// --- Internal ----
};
cAppliCloudClip::cAppliCloudClip(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec)
{
}
cCollecSpecArg2007 & cAppliCloudClip::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mNameCloudIn,"Name of input cloud/mesh", {eTA2007::FileDirProj,eTA2007::FileCloud})
<< Arg2007(mNameMasq,"Name of 3D masq", {eTA2007::File3DRegion})
;
}
cCollecSpecArg2007 & cAppliCloudClip::ArgOpt(cCollecSpecArg2007 & anArgOpt)
{
return anArgOpt
<< AOpt2007(mNameCloudOut,CurOP_Out,"Name of output file")
<< AOpt2007(mBinOut,CurOP_OutBin,"Generate out in binary format",{eTA2007::HDV})
;
}
int cAppliCloudClip::Exe()
{
InitOutFromIn(mNameCloudOut,"Clip_"+mNameCloudIn);
cTriangulation3D<tREAL8> aTri(mNameCloudIn);
cDataBoundedSet<tREAL8,3> * aMasq= MMV1_Masq(aTri.BoxEngl(),DirProject()+mNameMasq);
aTri.Filter(*aMasq);
aTri.WriteFile(DirProject()+mNameCloudOut,mBinOut);
delete aMasq;
return EXIT_SUCCESS;
}
/* =============================================== */
/* */
/* :: */
/* */
/* =============================================== */
tMMVII_UnikPApli Alloc_CloudClip(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec)
{
return tMMVII_UnikPApli(new cAppliCloudClip(aVArgs,aSpec));
}
cSpecMMVII_Appli TheSpecCloudClip
(
"CloudClip",
Alloc_CloudClip,
"Clip a point cloud/mesh using a region",
{eApF::Cloud},
{eApDT::Ply},
{eApDT::Ply},
__FILE__
);
};
| 26.063158 | 106 | 0.6042 | [
"mesh",
"vector",
"3d"
] |
b218216d185f6f5b6dde8306bcf44bd1a3cffa39 | 1,261 | cpp | C++ | src/entities/Enemy.cpp | CEDV-2016/spaceinvaders | eaa7f971526dc401ef14d87660c0b9a2c44153fa | [
"MIT"
] | null | null | null | src/entities/Enemy.cpp | CEDV-2016/spaceinvaders | eaa7f971526dc401ef14d87660c0b9a2c44153fa | [
"MIT"
] | null | null | null | src/entities/Enemy.cpp | CEDV-2016/spaceinvaders | eaa7f971526dc401ef14d87660c0b9a2c44153fa | [
"MIT"
] | null | null | null | #include "Enemy.h"
#include "SoundFXManager.h"
Enemy::Enemy(Ogre::SceneManager* sceneMgr)
{
_sceneMgr = sceneMgr;
_position = Ogre::Vector3 ( getRandomXPosition(), 0.5, -20 );
Ogre::Entity * entity = _sceneMgr->createEntity("Enemy.mesh");
entity->setCastShadows(true);
_node = _sceneMgr->createSceneNode();
_node->attachObject(entity);
_node->setPosition(_position);
_sceneMgr->getRootSceneNode()->addChild(_node);
}
Enemy::~Enemy() { }
void Enemy::updatePosition(Ogre::Real deltaT)
{
if (_position.z > 15)
{
_position = Ogre::Vector3 ( getRandomXPosition(), 0.5, -20 );
}
else
{
_position += Ogre::Vector3(0, 0, 0.25 * deltaT);
}
_node->setPosition(_position);
}
bool Enemy::shoot()
{
int min = 0, max = 10000, probability = 30;
int randNum = rand()%(max-min + 1) + min;
return randNum <= probability;
}
Ogre::Vector3 Enemy::getPosition()
{
return _position;
}
Ogre::SceneNode * Enemy::getSceneNode()
{
return _node;
}
double Enemy::getRandomXPosition()
{
int min_x = -100, max_x = 100;
int rand_x = rand() % (max_x - min_x + 1) + min_x;
return rand_x / 10;
}
void Enemy::destroy()
{
SoundFXManager::getSingletonPtr()->load("explosion.wav")->play();
_sceneMgr->destroySceneNode( _node );
}
| 19.703125 | 67 | 0.662173 | [
"mesh"
] |
b219ce36201d0c86e744138902fb9f44b728827c | 2,793 | cpp | C++ | helpers/FontRenderer/RenderFont.cpp | 42Bastian/Felix | 3c0b31a245a7c73bae97ad39a378edcdde1e386d | [
"MIT"
] | 19 | 2021-10-31T20:57:14.000Z | 2022-03-22T11:48:56.000Z | helpers/FontRenderer/RenderFont.cpp | 42Bastian/Felix | 3c0b31a245a7c73bae97ad39a378edcdde1e386d | [
"MIT"
] | 99 | 2021-10-29T20:31:09.000Z | 2022-02-09T12:24:03.000Z | helpers/FontRenderer/RenderFont.cpp | 42Bastian/Felix | 3c0b31a245a7c73bae97ad39a378edcdde1e386d | [
"MIT"
] | 3 | 2021-11-05T15:14:41.000Z | 2021-12-11T14:16:11.000Z | #include <cstdint>
#include <fstream>
#include <vector>
#include <filesystem>
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
std::vector<uint8_t> readFont( std::filesystem::path fontPath )
{
size_t size = std::filesystem::file_size( fontPath );
std::vector<uint8_t> fontBuffer;
fontBuffer.resize( size );
std::ifstream fin{ fontPath, std::ios::binary };
fin.read( (char*)fontBuffer.data(), size );
return fontBuffer;
}
std::vector<uint8_t> renderFont( std::filesystem::path fontPath, int boxWidth, int boxHeight, float fontHeight )
{
std::vector<uint8_t> fontBuffer = readFont( fontPath );
if ( fontBuffer.empty() )
return {};
int imageWidth = boxWidth;
int imageHeight = 256 * boxHeight;
std::vector<uint8_t> result;
result.resize( imageWidth * imageHeight );
stbtt_fontinfo font;
stbtt_InitFont( &font, fontBuffer.data(), 0 );
float scale = stbtt_ScaleForPixelHeight( &font, fontHeight );
int ascent;
stbtt_GetFontVMetrics( &font, &ascent, nullptr, nullptr );
int baseline = (int)( ascent * scale );
for ( int i = 0; i < 256; ++i )
{
if ( stbtt_FindGlyphIndex( &font, i ) )
{
int x0, y0, x1, y1;
stbtt_GetCodepointBitmapBox( &font, i, scale, scale, &x0, &y0, &x1, &y1 );
stbtt_MakeCodepointBitmap( &font, result.data() + ( baseline + y0 + i * boxHeight ) * imageWidth, x1 - x0, y1 - y0, imageWidth, scale, scale, i );
}
}
return result;
}
std::vector<uint8_t> renderFont( std::vector<uint8_t> bitmap, int boxHeight )
{
static constexpr int imageWidth = 8;
int imageHeight = 256 * boxHeight;
std::vector<uint8_t> result;
result.reserve( imageWidth * imageHeight );
for ( int i = 0; i < imageHeight; ++i )
{
for ( int k = 0; k < imageWidth; ++k )
{
result.push_back( bitmap[i] & ( 1 << ( 7 - k ) ) ? 0xff : 00 );
}
}
return result;
}
int main( int argc, char** argv )
{
auto data = readFont( "..\\..\\libextern\\vga-text-mode-fonts\\FONTS\\BIGPILE\\SWISSBX2.F16" );
data = renderFont( std::move( data ), 16 );
std::ofstream fout{ "..\\..\\WinFelix\\fonts.hpp" };
fout << "//Automatically generated from \"..\\libextern\\vga-text-mode-fonts\\FONTS\\BIGPILE\\SWISSBX2.F16\"\n\n";
fout << "uint8_t font_SWISSBX2[] = {\n";
for ( size_t i = 0; i < data.size(); i += 8 )
{
auto limit = std::min( i + 8, data.size() );
fout << "\t";
for ( size_t j = i; j < limit; ++j )
{
fout << "0x" << std::hex << std::setfill( '0' ) << std::setw( 2 ) << (int)data[j];
if ( j + 1 != data.size() )
fout << ',';
}
fout << "\n";
}
fout << "};\n";
}
| 29.09375 | 153 | 0.597565 | [
"vector"
] |
b223c26882fd8bef3353649b1eb61f12b89aff37 | 12,609 | cpp | C++ | lib/analysis.cpp | caixiuhong/Stable-MCCE | 186bdafdf1d631994b2cdd6ec6a548383f559929 | [
"MIT"
] | 4 | 2020-03-03T03:02:51.000Z | 2022-02-13T09:54:14.000Z | lib/analysis.cpp | caixiuhong/Stable-MCCE | 186bdafdf1d631994b2cdd6ec6a548383f559929 | [
"MIT"
] | 89 | 2019-07-28T13:22:30.000Z | 2022-02-15T18:06:25.000Z | lib/analysis.cpp | caixiuhong/Stable-MCCE | 186bdafdf1d631994b2cdd6ec6a548383f559929 | [
"MIT"
] | 11 | 2019-07-28T14:01:54.000Z | 2021-11-02T00:16:48.000Z | //#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
//#include "mcce.h"
extern "C" {
#include "mcce.h"
}
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <map>
#include <iomanip>
using namespace std;
/* public variable */
const string PDBF = "step2_out.pdb";
const string HBOUT = "hb.dat";
float DFAR; // the distance used to determine a hydrogen bond
float DNEAR; // default: 1.2 < d < 3.2
float ANGCUT;
static RES conflist;
FILE *h_fp;
//const float PI = 3.1415926;
/* function */
int hbond_matrix();
int hbond_network();
int is_hb(CONF *conf1, CONF *conf2);
int load_head3lst();
int analysis()
{
/* Load step2_out.pdb and get residue list for the microstate output */
/*
if (env.get_ms_gold){
printf(" Load step2_out.pdb and get ms_gold ...\n"); fflush(stdout);
if (ms_gold()) {db_close(); return USERERR;}
else printf("File ms_gold is obtained.\n\n");
}
*/
/*Load step3_out.pdb and get hydrogen bond matrix */
if (env.get_hbond_matrix){
printf(" Load step2_out.pdb and get hydrogen bond matrix ...\n"); fflush(stdout);
if (hbond_matrix()) {
printf(" Fatal error detected in hbond_matrix().\n");
return USERERR;
}
else printf(" Files hb.dat and hah.txt are obtained.\n\n");
}
/*Load hb.dat and ms.dat and combine them to get hydrogen bond network */
if (env.get_hbond_network){
printf(" Load hb.dat and ms.dat and combine them to get hydrogen bond network ...\n"); fflush(stdout);
if (hbond_network()) {
printf(" Fatal error detected in hbond_network().\n");
return USERERR;
}
else printf(" Files hb.txt are obtained.\n\n");
}
return 0;
}
int hbond_matrix()
{
/* db_open();
if (init()) {
db_close();
printf("Help message: double check file \"run.prm\" in current directory.\n");
return USERERR;
}
*/
DNEAR=env.hbond_lower_limit;
DFAR=env.hbond_upper_limit;
ANGCUT=env.hbond_ang_cutoff;
printf(" Hydrogen Bond are created when distance is between %.3f and %.3f, angle is equal or larger than %f.\n", DNEAR, DFAR, ANGCUT);
FILE *fp;
PROT prot;
if (!(fp=fopen(STEP2_OUT, "r"))) {
printf(" \"No step 2 output \"%s\".\n", STEP2_OUT);
return USERERR;
}
prot = load_pdb(fp);
if (prot.n_res == 0) {
printf(" There are errors in pdb file, quiting ...\n");
return USERERR;
}
id_conf(prot);
get_connect12(prot);
load_head3lst();
int n_conf = conflist.n_conf;
int i, j, k;
// for (k=0; k<n_conf; k++) printf("%s\t%d\n", conflist.conf[k].uniqID, conflist.conf[k].iConf);
for (i=0; i<prot.n_res; i++) {
for (j=1; j<prot.res[i].n_conf; j++) {
strncpy(prot.res[i].conf[j].confName, prot.res[i].conf[j].uniqID, 5);
prot.res[i].conf[j].confName[5] = '\0';
// adjust the conf id to avoid id diff between step2 and head3.lst
for (k=0; k<n_conf; k++) {
if (!strcmp(conflist.conf[k].uniqID, prot.res[i].conf[j].uniqID)) {
prot.res[i].conf[j].iConf = conflist.conf[k].iConf;
break;
}
}
}
}
h_fp = fopen("hah.txt", "w");
// hb_fp is a binary file to store the hbpw matrix, the first 4 bytes give the conformer number n_conf
FILE *hb_fp = fopen(HBOUT.c_str(), "wb");
fwrite(&n_conf, sizeof(int), 1, hb_fp);
int i_res, j_res, i_conf, j_conf;
// hbpw is a matrix to store the hb connection between each two conf, the elem is 0 or 1
FILE *fp_res = fopen("reshbond.txt", "w");
char *resHb = (char *) calloc(prot.n_res * prot.n_res, sizeof(char));
char *hbpw = (char *) calloc(n_conf * n_conf, sizeof(char));
for (i_res=0; i_res<prot.n_res; i_res++) {
for (i_conf=1; i_conf<prot.res[i_res].n_conf; i_conf++) {
for (j_res=0; j_res<prot.n_res; j_res++) {
if (j_res == i_res) continue;
for (j_conf=1; j_conf<prot.res[j_res].n_conf; j_conf++) {
/* there is hbond from donor i_conf to accepter j_conf */
if (is_hb(&prot.res[i_res].conf[i_conf], &prot.res[j_res].conf[j_conf])) {
hbpw[prot.res[i_res].conf[i_conf].iConf * n_conf + prot.res[j_res].conf[j_conf].iConf] = 1;
resHb[i_res * prot.n_res + j_res] = 1;
}
}
}
}
}
/*
for (i=0; i<n_conf; i++) {
for (j=0; j<i; j++) {
hbpw[i * n_conf + j] = hbpw[j * n_conf + i];
}
}
*/
fwrite(hbpw, sizeof(char), n_conf * n_conf, hb_fp);
fclose(hb_fp);
set <int> resInHbNet;
for (i_res=0; i_res<prot.n_res; i_res++) {
for (j_res=0; j_res<prot.n_res; j_res++) {
if (j_res == i_res) continue;
if (resHb[i_res * prot.n_res + j_res] == 1) {
fprintf(fp_res, "%s%c%04d\t%s%c%04d\n", prot.res[i_res].resName, prot.res[i_res].chainID, prot.res[i_res].resSeq,
prot.res[j_res].resName, prot.res[j_res].chainID, prot.res[j_res].resSeq);
resInHbNet.insert(i_res);
resInHbNet.insert(j_res);
}
}
}
fclose(fp_res);
FILE *fp_resInHbNet = fopen("resInHbNet.txt", "w");
for (i_res=0; i_res<prot.n_res; i_res++) {
if (resInHbNet.find(i_res) != resInHbNet.end()) {
fprintf(fp_resInHbNet, "%s%c%04d\n", prot.res[i_res].resName, prot.res[i_res].chainID, prot.res[i_res].resSeq);
}
}
fclose(fp_resInHbNet);
printf(" n_res: %d\n", prot.n_res);
// db_close();
return 0;
}
int is_hb( CONF *conf1, CONF *conf2)
{
STRINGS Datoms,Aatoms;
int iD, iA, Dseq, Aseq;
float d=0.0;
float ang = 0.0;
int isHb = 0;
/** To establish hydrogen bond between two conformers, the following criteria must be met:
* 1. one conformer is h donor, the other is acceptor.
* 2. the distance between one donor atom and one acceptor atom is between DNEAR and DFAR.
* 3. the angle of h bond should be no less than 90.
*/
if (!param_get((char *) "HDONOR", conf1->confName,(char *) "", &Datoms)) {
// printf("conf1->confName: %s, conf2->confName: %s, Datoms.n: %d\n", conf1->confName,
// conf2->confName, Datoms.n); //test--Cai
if (!param_get((char *)"HACCEPT", conf2->confName,(char *) "", &Aatoms)) {
for (iD=0; iD<Datoms.n; iD++) {
if (param_get((char *)"IATOM", conf1->confName, Datoms.strings[iD], &Dseq)) {
printf(" ERROR: can not determin iatom of %s %s\n", conf1->confName, Datoms.strings[iD]);
}
// if (!strcmp(conf1->confName, "HOH-1")) {
// printf("Donor: %s, Datoms.n: %d, Dseq: %d, atom name %s\n", conf1->confName,
// Datoms.n, Dseq, Datoms.strings[iD]);
// }
for (iA=0; iA<Aatoms.n; iA++) {
if (param_get((char *) "IATOM", conf2->confName, Aatoms.strings[iA], &Aseq)) {
printf(" ERROR: can not determin iatom of \"%s\" \"%s\"\n", conf2->confName, Aatoms
.strings[iA]);
}
d = ddvv(conf1->atom[Dseq].xyz, conf2->atom[Aseq].xyz);
// d = ddvv(conf1->atom[Dseq].connect12[0]->xyz, conf2->atom[Aseq].xyz); //*****
if (d > DNEAR * DNEAR && d < DFAR * DFAR) {
ang = avv(vector_vminusv((conf1->atom[Dseq].connect12[0])->xyz, conf1->atom[Dseq].xyz),
vector_vminusv(conf2->atom[Aseq].xyz, conf1->atom[Dseq].xyz)) * 180.0 / env.PI;
if (abs(ang) < ANGCUT) continue;
fprintf(h_fp, "%s\t%s\t%s~%s--%s\t%.2f\t%.0f\n", conf1->uniqID, conf2->uniqID,
(conf1->atom[Dseq].connect12[0])->name, conf1->atom[Dseq].name, conf2->atom[Aseq].name, sqrt(d), ang);
isHb = 1;
}
}
}
}
}
return isHb;
}
int load_head3lst()
{
FILE *fp;
char sbuff[MAXCHAR_LINE];
char stemp[MAXCHAR_LINE];
CONF conf_temp;
char notfound;
int iconf, ires;
int kr;
int counter;
conflist.n_conf = 0;
conflist.conf = NULL;
if (!(fp=fopen(FN_CONFLIST3, "r"))) {
printf(" FATAL: Can't open file %s\n", FN_CONFLIST3);
return USERERR;
}
fgets(sbuff, sizeof(sbuff), fp); /* skip the first line */
counter = 0;
while(fgets(sbuff, sizeof(sbuff), fp)) {
/* load this line to a conf template */
if (strlen(sbuff) < 20) continue;
sscanf(sbuff, "%d %s %c %f %f %f %f %d %d %f %f %f %f %f %f %s", &conf_temp.iConf,
conf_temp.uniqID,
&conf_temp.on,
&conf_temp.occ,
&conf_temp.netcrg,
&conf_temp.Em,
&conf_temp.pKa,
&conf_temp.e,
&conf_temp.H,
&conf_temp.E_vdw0,
&conf_temp.E_vdw1,
&conf_temp.E_tors,
&conf_temp.E_epol,
&conf_temp.E_dsolv,
&conf_temp.E_extra,
conf_temp.history);
conf_temp.E_TS = 0.0; /* initialize entropy effect at the time of loading conflist */
/* rescale */
conf_temp.E_vdw0 *= env.scale_vdw0;
conf_temp.E_vdw1 *= env.scale_vdw1;
conf_temp.E_epol *= env.scale_ele;
conf_temp.E_tors *= env.scale_tor;
conf_temp.E_dsolv*= env.scale_dsolv;
strncpy(conf_temp.resName, conf_temp.uniqID, 3); conf_temp.resName[3] = '\0';
strncpy(conf_temp.confName, conf_temp.uniqID, 5); conf_temp.confName[5] = '\0';
conf_temp.chainID = conf_temp.uniqID[5];
strncpy(stemp, conf_temp.uniqID+6, 4); stemp[4] = '\0';
conf_temp.resSeq = atoi(stemp);
conf_temp.iCode = conf_temp.uniqID[10];
conf_temp.n_atom = 0;
if (conf_temp.on == 't' || conf_temp.on == 'T') conf_temp.on = 't';
else conf_temp.on = 'f';
conf_temp.iConf = counter;
/* creating conflist */
iconf = ins_conf(&conflist, conflist.n_conf, 0);
cpy_conf(&conflist.conf[iconf], &conf_temp);
counter++;
}
return 0;
}
int hbond_network()
{
time_t time_start = time(NULL);
ifstream iHbfile("hb.dat", ios::in | ios::binary);
if (!iHbfile.is_open()) {
cerr << " Can't open file hb.dat." << endl;
return -1;
}
int n_conf;
vector<vector<char> > hinter;
iHbfile.read((char *) &n_conf, sizeof(int));
hinter.resize(n_conf);
for (int i=0; i<n_conf; i++) hinter[i].resize(n_conf);
for (int i=0; i<n_conf; i++) {
for (int j=0; j<n_conf; j++) {
iHbfile.read((char *) &hinter[i][j], 1);
}
}
iHbfile.close();
int n_spe, count;
unsigned short conf;
char buffer[9];
char method[9];
//double H_state, Hsq_state;
double H_state, Hav_state;
vector <string> resName;
vector <unsigned short> iconf;
ifstream iMsfile("ms.dat", ios::in | ios::binary);
// n_spe gives the number of special residues
iMsfile.read((char *) &n_spe, 4);
cout << " There are " << n_spe << " key residues." << endl;
// resName are the names of the special residues
for (int i_spe=0; i_spe<n_spe; i_spe++) {
iMsfile.read(buffer, 8);
buffer[8] = '\0';
resName.push_back(string(buffer));
}
iMsfile.read(method, 9);
cout << " The microstates are obtained from: " << method << "." << endl;
vector<vector<int> > resinter;
resinter.resize(n_spe);
for (size_t i=0; i<n_spe; i++) resinter[i].resize(n_spe);
int totalState = 0;
int totalRecords = 0;
const int PRINT_INTERVAL = 10000;
while (iMsfile.read((char *) &conf, 2)) {
iconf.push_back(conf);
for (int i_spe=1; i_spe<n_spe; i_spe++) {
iMsfile.read((char *) &conf, 2);
iconf.push_back(conf);
}
iMsfile.read((char *) &H_state, 8);
//iMsfile.read((char *) &Hsq_state, 8);
iMsfile.read((char *) &Hav_state, 8);
iMsfile.read((char *) &count, 4);
totalRecords++;
totalState += count;
// if (totalRecords % PRINT_INTERVAL == 0) cout << totalRecords << " records have been loaded." << endl;
for (int i_res=0; i_res<n_spe; i_res++) {
for (int j_res=0; j_res<n_spe; j_res++) {
if (j_res == i_res) continue;
resinter[i_res][j_res] += hinter[iconf[i_res]][iconf[j_res]] * count;
}
}
iconf.clear();
}
iMsfile.close();
cout << " " << totalRecords << " records and " << totalState << " states has been loaded." << endl;
cout << " Total time to load ms.dat: " << time(NULL) - time_start << "." << endl;
const float THRESHOLD_TO_WRITE = 0.001;
ofstream ofile("hb.txt", ios::out);
for (int i=0; i<n_spe; i++) {
for (int j=0; j<n_spe; j++) {
if ((float) resinter[i][j]/totalState >= THRESHOLD_TO_WRITE) {
ofile << resName[i] << '\t' << resName[j] << '\t' << fixed << setprecision(3) << ((float) resinter[i][j]/totalState) << endl;;
}
}
}
ofile.close();
cout << " Total time: " << time(NULL) - time_start << "." << endl;
return 0;
}
| 29.808511 | 138 | 0.597034 | [
"vector"
] |
b22651caa74caf0079ce0a2268f58770d7a04dc2 | 9,875 | cpp | C++ | src/brew/math/Quaternion.cpp | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | 1 | 2018-02-09T16:20:50.000Z | 2018-02-09T16:20:50.000Z | src/brew/math/Quaternion.cpp | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | null | null | null | src/brew/math/Quaternion.cpp | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | null | null | null | /**
*
* |_ _ _
* |_)| (/_VV
*
* Copyright 2015-2018 Marcus v. Keil
*
* Created on: Feb 11, 2016
*
*/
#include <brew/math/Quaternion.h>
#include <brew/math/Math.h>
#include <brew/math/Matrix4.h>
namespace brew {
#define QUATERNION_EQUAL_EPSILON 0.1f
Quaternion::Quaternion(Real x, Real y, Real z, Real w) :
x(x), y(y), z(z), w(w) {}
Quaternion::Quaternion(const Vec3& xaxis, const Vec3& yaxis, const Vec3& zaxis) {
setFromAxes(xaxis, yaxis, zaxis);
}
void Quaternion::set(Real x, Real y, Real z, Real w) {
this->x = x;
this->y = y;
this->z = z;
this->w = w;
}
Quaternion& Quaternion::operator*=(const Quaternion& other) {
// NOTE: Multiplication is not generally commutative, so in most
// cases p*q != q*p.
float newX = w * other.x + x * other.w + y * other.z - z * other.y;
float newY = w * other.y + y * other.w + z * other.x - x * other.z;
float newZ = w * other.z + z * other.w + x * other.y - y * other.x;
float newW = w * other.w - x * other.x - y * other.y - z * other.z;
x = newX;
y = newY;
z = newZ;
w = newW;
return *this;
}
Quaternion& Quaternion::operator/=(Real scalar) {
x /= scalar;
y /= scalar;
z /= scalar;
w /= scalar;
return *this;
}
Quaternion Quaternion::operator/(Real scalar) const {
Quaternion q(*this);
q /= scalar;
return q;
}
Quaternion Quaternion::operator*(const Quaternion& other) const {
Quaternion q(*this);
q *= other;
return q;
}
void Quaternion::setToLookAt(const Vec3& dir, const Vec3& aup) {
Vec3 forward = dir.normalized();
Vec3 right = aup.cross(forward).normalize();
Vec3 up = forward.cross(right);
float& m00 = right.x;
float& m01 = right.y;
float& m02 = right.z;
float& m10 = up.x;
float& m11 = up.y;
float& m12 = up.z;
float& m20 = forward.x;
float& m21 = forward.y;
float& m22 = forward.z;
float num8 = (m00 + m11) + m22;
Quaternion& quaternion = *this;
if (num8 > 0.0f) {
float num = (float) std::sqrt(num8 + 1.0f);
quaternion.w = num * 0.5f;
num = 0.5f / num;
quaternion.x = (m12 - m21) * num;
quaternion.y = (m20 - m02) * num;
quaternion.z = (m01 - m10) * num;
return;
}
if ((m00 >= m11) && (m00 >= m22)) {
float num7 = (float) std::sqrt(((1.0f + m00) - m11) - m22);
float num4 = 0.5f / num7;
quaternion.x = 0.5f * num7;
quaternion.y = (m01 + m10) * num4;
quaternion.z = (m02 + m20) * num4;
quaternion.w = (m12 - m21) * num4;
return;
}
if (m11 > m22) {
float num6 = (float) std::sqrt(((1.0f + m11) - m00) - m22);
float num3 = 0.5f / num6;
quaternion.x = (m10 + m01) * num3;
quaternion.y = 0.5f * num6;
quaternion.z = (m21 + m12) * num3;
quaternion.w = (m20 - m02) * num3;
return;
}
float num5 = (float) std::sqrt(((1.0f + m22) - m00) - m11);
float num2 = 0.5f / num5;
quaternion.x = (m20 + m02) * num2;
quaternion.y = (m21 + m12) * num2;
quaternion.z = 0.5f * num5;
quaternion.w = (m01 - m10) * num2;
}
void Quaternion::setFromAxisAngle(const Vec3& axis, Real angle) {
// Works!
Real halfAngle = angle * 0.5f;
float s = std::sin(halfAngle);
x = axis.x * s;
y = axis.y * s;
z = axis.z * s;
w = std::cos(halfAngle);
}
void Quaternion::setFromRotationMatrix(const Matrix4& a) {
// Works!
float trace = a[0][0] + a[1][1] + a[2][2]; // I removed + 1.0f; see discussion with Ethan
if (trace > 0) { // I changed M_EPSILON to 0
float s = 0.5f / sqrtf(trace + 1.0f);
w = 0.25f / s;
x = (a[1][2] - a[2][1]) * s;
y = (a[2][0] - a[0][2]) * s;
z = (a[0][1] - a[1][0]) * s;
} else {
if (a[0][0] > a[1][1] && a[0][0] > a[2][2]) {
float s = 2.0f * sqrtf(1.0f + a[0][0] - a[1][1] - a[2][2]);
w = (a[1][2] - a[2][1]) / s;
x = 0.25f * s;
y = (a[1][0] + a[0][1]) / s;
z = (a[2][0] + a[0][2]) / s;
} else if (a[1][1] > a[2][2]) {
float s = 2.0f * sqrtf(1.0f + a[1][1] - a[0][0] - a[2][2]);
w = (a[2][0] - a[0][2]) / s;
x = (a[1][0] + a[0][1]) / s;
y = 0.25f * s;
z = (a[2][1] + a[1][2]) / s;
} else {
float s = 2.0f * sqrtf(1.0f + a[2][2] - a[0][0] - a[1][1]);
w = (a[0][1] - a[1][0]) / s;
x = (a[2][0] + a[0][2]) / s;
y = (a[2][1] + a[1][2]) / s;
z = 0.25f * s;
}
}
}
void Quaternion::setFromAxes(const Vec3& a0, const Vec3& a1, const Vec3& a2) {
Matrix4 mat;
mat[0][0] = a0.x;
mat[1][0] = a0.y;
mat[2][0] = a0.z;
mat[0][1] = a1.x;
mat[1][1] = a1.y;
mat[2][1] = a1.z;
mat[0][2] = a2.x;
mat[1][2] = a2.y;
mat[2][2] = a2.z;
setFromRotationMatrix(mat);
}
void Quaternion::toRotationMatrix(Matrix4& mat) const {
// Works!
// source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
// (first equation shown on page. Uses different signs!)
// also: https://www.fd.cvut.cz/personal/voracsar/GeometriePG/PGR020/matrix2quaternions.pdf chp. 3
const Real _2xx = 2 * x * x;
const Real _2yy = 2 * y * y;
const Real _2zz = 2 * z * z;
const Real _2xy = 2 * x * y;
const Real _2xz = 2 * x * z;
const Real _2xw = 2 * x * w;
const Real _2yw = 2 * y * w;
const Real _2yz = 2 * y * z;
const Real _2zw = 2 * z * w;
Real* m = mat.getRawPointer();
m[0] = 1.0f - _2yy - _2zz;
m[4] = _2xy + _2zw;
m[8] = _2xz - _2yw;
m[1] = _2xy - _2zw;
m[5] = 1.0f - _2xx - _2zz;
m[9] = _2yz + _2xw;
m[2] = _2xz + _2yw;
m[6] = _2yz - _2xw;
m[10] = 1.0f - _2xx - _2yy;
}
Vec3 Quaternion::operator*(const Vec3& other) const {
// See https://blog.molecular-matters.com/2013/05/24/a-faster-quaternion-vector-multiplication/
Quaternion tmp2 = conjugated();
Quaternion tmp(other.x, other.y, other.z, 0);
tmp2 = tmp * tmp2;
tmp2 = *this * tmp2;
return Vec3(tmp2.x, tmp2.y, tmp2.z);
}
void Quaternion::setFromEulerAngles(Real yaw, Real pitch, Real roll) {
// Expects radians.
Real hr = roll * 0.5f;
Real shr = std::sin(hr);
Real chr = std::cos(hr);
Real hp = pitch * 0.5f;
Real shp = std::sin(hp);
Real chp = std::cos(hp);
Real hy = yaw * 0.5f;
Real shy = std::sin(hy);
Real chy = std::cos(hy);
Real chy_shp = chy * shp;
Real shy_chp = shy * chp;
Real chy_chp = chy * chp;
Real shy_shp = shy * shp;
x = (chy_shp * chr) +
(shy_chp * shr); // cos(yaw/2) * sin(pitch/2) * cos(roll/2) + sin(yaw/2) * cos(pitch/2) * sin(roll/2)
y = (shy_chp * chr) -
(chy_shp * shr); // sin(yaw/2) * cos(pitch/2) * cos(roll/2) - cos(yaw/2) * sin(pitch/2) * sin(roll/2)
z = (chy_chp * shr) -
(shy_shp * chr); // cos(yaw/2) * cos(pitch/2) * sin(roll/2) - sin(yaw/2) * sin(pitch/2) * cos(roll/2)
w = (chy_chp * chr) +
(shy_shp * shr); // cos(yaw/2) * cos(pitch/2) * cos(roll/2) + sin(yaw/2) * sin(pitch/2) * sin(roll/2)
}
void Quaternion::toAxes(Vec3& a0, Vec3& a1, Vec3& a2) const {
Matrix4 rot;
toRotationMatrix(rot);
a0.x = rot[0][0];
a0.y = rot[0][1];
a0.z = rot[0][2];
a0.x = rot[1][0];
a0.y = rot[1][1];
a0.z = rot[1][2];
a0.x = rot[2][0];
a0.y = rot[2][1];
a0.z = rot[2][2];
}
Quaternion Quaternion::getRotationTo(const Vec3& origin, const Vec3& dest, const Vec3& fallbackAxis) {
// Based on Stan Melax's article in Game Programming Gems
Quaternion q;
// Copy, since cannot modify local
Vec3 v0 = origin;
Vec3 v1 = dest;
v0.normalize();
v1.normalize();
Real d = v0.dot(v1);
// If dot == 1, vectors are the same
if (d >= 1.0f) {
return Quaternion::IDENTITY;
}
if (d < (1e-6f - 1.0f)) {
if (fallbackAxis != Vec3::ZERO) {
// rotate 180 degrees about the fallback axis
q.setFromAxisAngle(fallbackAxis, math::PI);
} else {
// Generate an axis
Vec3 axis = Vec3::UNIT_X.cross(origin);
if (axis.length() < math::EPSILON) // pick another if colinear
axis = Vec3::UNIT_Y.cross(origin);
axis.normalize();
q.setFromAxisAngle(axis, math::PI);
}
} else {
Real s = static_cast<Real>(sqrt((1 + d) * 2));
Real invs = static_cast<Real>(1.0 / s);
Vec3 c = v0.cross(v1);
q.x = c.x * invs;
q.y = c.y * invs;
q.z = c.z * invs;
q.w = s * 0.5f;
q.normalize();
}
return q;
}
void Quaternion::normalize() {
Real factor = static_cast<Real>(1.0 / getLength());
*this *= factor;
}
Quaternion Quaternion::normalized() const {
Quaternion q(*this);
q.normalize();
return q;
}
void Quaternion::conjugate() {
x = -x;
y = -y;
z = -z;
}
Quaternion Quaternion::conjugated() const {
Quaternion q(*this);
q.conjugate();
return q;
}
void Quaternion::invert() {
Real d = x * x + y * y + z * z + w * w;
set(-x / d, -y / d, -z / d, w / d);
}
Quaternion Quaternion::inverted() const {
Quaternion q(*this);
q.invert();
return q;
}
Real Quaternion::getLength() const {
return std::sqrt(x * x + y * y + z * z + w * w);
}
bool Quaternion::operator==(const Quaternion& other) const {
return math::equals(std::abs(x), std::abs(other.x), QUATERNION_EQUAL_EPSILON) &&
math::equals(std::abs(y), std::abs(other.y), QUATERNION_EQUAL_EPSILON) &&
math::equals(std::abs(z), std::abs(other.z), QUATERNION_EQUAL_EPSILON) &&
math::equals(std::abs(w), std::abs(other.w), QUATERNION_EQUAL_EPSILON);
}
s8 Quaternion::getGimbalPole() const {
Real t = y * x + z * w;
return static_cast<s8>(t > 0.499 ? 1 : (t < -0.499 ? -1 : 0));
}
Real Quaternion::getYaw() const {
return getGimbalPole() == 0 ? std::atan2(2.0f * (y * w + x * z), 1.0f - 2.0f * (y * y + x * x)) : 0.0f;
}
Real Quaternion::getPitch() const {
s8 pole = getGimbalPole();
return pole == 0 ? (float) std::asin(math::clamp(2.0f * (w * x - z * y), -1.0f, 1.0f)) : static_cast<Real>(pole) *
math::PI * 0.5f;
}
Real Quaternion::getRoll() const {
s8 pole = getGimbalPole();
return pole == 0 ? std::atan2(2.0f * (w * z + y * x), 1.0f - 2.0f * (x * x + z * z)) : static_cast<Real>(pole) *
2.0f * std::atan2(y, w);
}
const Quaternion Quaternion::IDENTITY(0, 0, 0, 1);
} /* namespace brew */
#include <ostream>
namespace brew {
std::ostream& operator << (std::ostream& s, const brew::Quaternion& v) {
s << "Quaternion("<<v.x<<","<<v.y<<","<<v.z<<","<<v.w<<")";
return s;
}
} /* namespace brew */ | 25.063452 | 115 | 0.576 | [
"geometry",
"vector"
] |
b230c09904315faac327571f5bb290be28caeb28 | 5,823 | cpp | C++ | Source/Spatializer/ProjectAcoustics/TritonWrapper.cpp | keveleigh/spatialaudio-unity | 06d2f3855c22b16c3b7dc22de59c1cf57d2d1ce3 | [
"MIT"
] | 70 | 2019-12-13T09:36:19.000Z | 2022-03-18T02:33:17.000Z | Source/Spatializer/ProjectAcoustics/TritonWrapper.cpp | keveleigh/spatialaudio-unity | 06d2f3855c22b16c3b7dc22de59c1cf57d2d1ce3 | [
"MIT"
] | 15 | 2020-02-18T16:48:56.000Z | 2022-03-30T23:03:04.000Z | Source/Spatializer/ProjectAcoustics/TritonWrapper.cpp | keveleigh/spatialaudio-unity | 06d2f3855c22b16c3b7dc22de59c1cf57d2d1ce3 | [
"MIT"
] | 16 | 2019-12-12T19:35:38.000Z | 2022-01-31T22:31:36.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "TritonWrapper.h"
#include <vector>
#include <cstring>
// Static init
OBJECT_HANDLE TritonWrapper::s_TritonHandle = nullptr;
bool TritonWrapper::s_IsTritonAceLoaded = false;
ATKMatrix4x4 TritonWrapper::s_worldToLocal = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
ATKMatrix4x4 TritonWrapper::s_localToWorld = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
std::vector<TritonAcousticParametersDebug> TritonWrapper::s_debugInfo;
float s_lastOutdoorness = 0.0f;
#if defined(WINDOWS) || defined(DURANGO)
HMODULE TritonWrapper::s_TritonDllHandle = nullptr;
#elif defined(LINUX) || defined(ANDROID) || defined(APPLE)
#include <dlfcn.h>
void* TritonWrapper::s_TritonDllHandle = nullptr;
#endif
TritonWrapper::Triton_QueryAcoustics_ptr TritonWrapper::s_QueryAcoustics = nullptr;
TritonWrapper::Triton_GetOutdoornessAtListener_ptr TritonWrapper::s_GetOutdoornessAtListener = nullptr;
// Put any exported functions here
#ifdef __cplusplus
extern "C"
#endif
{
bool EXPORT_API Spatializer_SetTritonHandle(OBJECT_HANDLE handle)
{
return TritonWrapper::SetTritonHandle(handle);
}
void EXPORT_API Spatializer_SetAceFileLoaded(bool loaded)
{
TritonWrapper::SetAceFileLoaded(loaded);
}
void EXPORT_API Spatializer_SetTransforms(ATKMatrix4x4 worldToLocal, ATKMatrix4x4 localToWorld)
{
TritonWrapper::SetTransforms(worldToLocal, localToWorld);
}
bool EXPORT_API Spatializer_GetDebugInfo(TritonAcousticParametersDebug** debugArray, int* size)
{
// Take a snapshot of the debug info
auto debugCopy = TritonWrapper::GetDebugInfo();
// If the vector is empty, don't allocate any memory
if (debugCopy.size() == 0)
{
*size = 0;
*debugArray = nullptr;
return true;
}
// If the vector is not empty, allocate and copy memory
*debugArray = new (std::nothrow) TritonAcousticParametersDebug[debugCopy.size()];
// If out of memory, just return 0
if (*debugArray == nullptr)
{
*size = 0;
return false;
}
memcpy(*debugArray, debugCopy.data(), debugCopy.size() * sizeof(TritonAcousticParametersDebug));
*size = static_cast<int>(debugCopy.size());
return true;
}
void EXPORT_API Spatializer_FreeDebugInfo(TritonAcousticParametersDebug* debugArray)
{
if (debugArray != nullptr)
{
delete[] debugArray;
}
}
}
bool TritonWrapper::SetTritonHandle(OBJECT_HANDLE handle)
{
if (s_TritonDllHandle == nullptr)
{
auto succeeded = LoadTritonDll();
if (!succeeded)
{
return false;
}
}
s_TritonHandle = handle;
if (handle == nullptr)
{
s_IsTritonAceLoaded = false;
}
return true;
}
// Helper macro for getting function addresses
#if defined(WINDOWS) || defined(DURANGO)
#define IMPORT_FUNCTION(a, b) reinterpret_cast<a>(GetProcAddress(s_TritonDllHandle, b))
#else
#define IMPORT_FUNCTION(a, b) reinterpret_cast<a>(dlsym(s_TritonDllHandle, b))
#endif
bool TritonWrapper::LoadTritonDll()
{
#if defined(WINDOWS) || defined(DURANGO)
#if defined(WINDOWSSTORE)
s_TritonDllHandle = LoadPackagedLibrary(L"Triton.dll", 0);
#else
s_TritonDllHandle = LoadLibraryW(L"Triton.dll");
#endif
#elif defined(LINUX) || defined(ANDROID)
s_TritonDllHandle = dlopen("libTriton.so", RTLD_LAZY);
#elif defined(APPLE)
#define STRINGIFY(v) #v
#define MAKE_STR(m) STRINGIFY(m)
const auto c_TritonLibName = "@rpath/libTriton." MAKE_STR(PRODUCT_VERSION) ".dylib";
s_TritonDllHandle = dlopen(c_TritonLibName, RTLD_LAZY);
#endif
if (!s_TritonDllHandle)
{
return false;
}
s_QueryAcoustics = IMPORT_FUNCTION(Triton_QueryAcoustics_ptr, "Triton_QueryAcoustics");
s_GetOutdoornessAtListener =
IMPORT_FUNCTION(Triton_GetOutdoornessAtListener_ptr, "Triton_GetOutdoornessAtListener");
if (s_QueryAcoustics == nullptr || s_GetOutdoornessAtListener == nullptr)
{
return false;
}
return true;
}
bool TritonWrapper::QueryAcoustics(
ATKVectorF source, ATKVectorF listener, const int sourceIndex, TritonAcousticParameters* params)
{
if (!IsAceFileLoaded())
{
return false;
}
auto result = s_QueryAcoustics(s_TritonHandle, source, listener, params);
// Cache params in the debugInfo vector before returning so that Unity can query it later
TritonAcousticParametersDebug debugParams = {};
debugParams.SourceId = sourceIndex;
debugParams.SourcePosition = source;
debugParams.ListenerPosition = listener;
debugParams.AcousticParameters = *params;
debugParams.Outdoorness = s_lastOutdoorness;
bool foundIt = false;
for (auto&& info : s_debugInfo)
{
if (info.SourceId == sourceIndex)
{
info = debugParams;
foundIt = true;
}
}
if (!foundIt)
{
s_debugInfo.push_back(debugParams);
}
return result;
}
bool TritonWrapper::GetOutdoornessAtListener(ATKVectorF listener, float* value)
{
if (!IsAceFileLoaded())
{
return false;
}
auto result = s_GetOutdoornessAtListener(s_TritonHandle, listener, value);
if (result)
{
s_lastOutdoorness = *value;
}
return result;
}
std::vector<TritonAcousticParametersDebug> TritonWrapper::GetDebugInfo()
{
// Take a snapshot of the debug data, clearing out the old info
return std::move(s_debugInfo);
} | 30.015464 | 105 | 0.662373 | [
"vector"
] |
b23c82d6ad3270396dd9712025ca42d8e85bb2c6 | 1,114 | hpp | C++ | src/Compass.hpp | palainp/esp8266_maze | 74eb2253cc6405a8feb8716de0593fd221c90631 | [
"MIT"
] | null | null | null | src/Compass.hpp | palainp/esp8266_maze | 74eb2253cc6405a8feb8716de0593fd221c90631 | [
"MIT"
] | null | null | null | src/Compass.hpp | palainp/esp8266_maze | 74eb2253cc6405a8feb8716de0593fd221c90631 | [
"MIT"
] | null | null | null | #ifndef COMPASS_H
#define COMPASS_H
#include "Item.hpp"
class Compass:public Item
{
public:
Compass(int32_t x, int32_t y):Item(x,y){
cell_text = {
"You just found the compass !",
"You can see something shinning in the direction ",
"A small noise came from the direction ",
"You can hear a metallic object fall to the ground near here."
};
cell_distance = {0, 3, 8, 18};
cell_show_direction = {false, true, true, false};
};
void update_status(Player &p) {
if (distance(p)==0) {
p.status |= got_compass;
}
if(p.status & got_compass) {
p.led_color = 0xFFFF00;
}
};
std::string display_cell(Player &p) {
#ifdef DEBUG
std::string str = " Compass: ";
str += SSTR(x << ","<< y);
return str;
#else
return Item::display_cell(p);
#endif
};
std::string display_text(Player &p) {
if (!(p.status & got_compass) || distance(p)==0)
return Item::display_text(p);
else return "";
};
};
#endif
| 23.702128 | 74 | 0.539497 | [
"object"
] |
b24904a5b713219940817abbc91f00f332d4ab22 | 18,529 | cc | C++ | dcf/fss_gates/multiple_interval_containment_test.cc | RahulRachuri/distributed_point_functions | 9cfbfdc0928377bec506242fe51a76fb18c53c8b | [
"Apache-2.0"
] | 29 | 2021-03-19T14:19:41.000Z | 2022-03-30T17:34:03.000Z | dcf/fss_gates/multiple_interval_containment_test.cc | RahulRachuri/distributed_point_functions | 9cfbfdc0928377bec506242fe51a76fb18c53c8b | [
"Apache-2.0"
] | 3 | 2021-03-24T15:37:17.000Z | 2021-04-24T17:57:39.000Z | dcf/fss_gates/multiple_interval_containment_test.cc | RahulRachuri/distributed_point_functions | 9cfbfdc0928377bec506242fe51a76fb18c53c8b | [
"Apache-2.0"
] | 4 | 2021-04-01T23:28:25.000Z | 2021-12-07T08:14:12.000Z | // Copyright 2021 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
//
// 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 "dcf/fss_gates/multiple_interval_containment.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <cstdint>
#include <vector>
#include "absl/numeric/int128.h"
#include "dcf/fss_gates/multiple_interval_containment.pb.h"
#include "dcf/fss_gates/prng/basic_rng.h"
#include "dpf/distributed_point_function.pb.h"
#include "dpf/internal/status_matchers.h"
#include "dpf/internal/value_type_helpers.h"
#include "dpf/status_macros.h"
namespace distributed_point_functions {
namespace fss_gates {
namespace {
using ::testing::Test;
TEST(MICTest, GenAndEvalSucceedsForSmallGroup) {
MicParameters mic_parameters;
const int group_size = 64;
const uint64_t interval_count = 5;
// Setting input and output group to be Z_{2^64}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10, 23, 45, 66, 15};
std::vector<absl::uint128> qs{45, 30, 100, 250, 15};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
// Initializing the input and output masks uniformly at random;
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_in, rng->Rand64());
r_in = r_in % N;
std::vector<absl::uint128> r_outs;
for (int i = 0; i < interval_count; ++i) {
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_out, rng->Rand64());
r_out = r_out % N;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
DPF_ASSERT_OK_AND_ASSIGN(std::tie(key_0, key_1), MicGate->Gen(r_in, r_outs));
// Inside this loop we will test the Evaluation of the MIC gate on
// input values ranging between [0, 400)
for (uint64_t i = 0; i < 400; i++) {
std::vector<absl::uint128> res_0, res_1;
// Evaluating MIC gate key_0 on masked input i + r_in
DPF_ASSERT_OK_AND_ASSIGN(res_0, MicGate->Eval(key_0, (i + r_in) % N));
// Evaluating MIC gate key_1 on masked input i + r_in
DPF_ASSERT_OK_AND_ASSIGN(res_1, MicGate->Eval(key_1, (i + r_in) % N));
// Reconstructing the actual output of the MIC gate by adding together
// the secret shared output res_0 and res_1, and then subtracting out
// the output mask r_out
for (int j = 0; j < interval_count; j++) {
absl::uint128 result = (res_0[j] + res_1[j] - r_outs[j]) % N;
// If the input i lies inside the j^th interval, then the expected
// output of MIC gate is 1, and 0 otherwise
if (i >= ps[j] && i <= qs[j]) {
EXPECT_EQ(result, 1);
} else {
EXPECT_EQ(result, 0);
}
}
}
}
TEST(MICTest, GenAndEvalSucceedsForLargeGroup) {
MicParameters mic_parameters;
const int group_size = 127;
const uint64_t interval_count = 3;
const absl::uint128 two_power_127 = absl::uint128(1) << 127;
const absl::uint128 two_power_126 = absl::uint128(1) << 126;
// Setting input and output group to be Z_{2^127}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{two_power_126, two_power_127 - 1,
two_power_127 - 3};
std::vector<absl::uint128> qs{two_power_126 + 3, two_power_127 - 1,
two_power_127 - 2};
std::vector<absl::uint128> x{two_power_126 - 1, two_power_126,
two_power_126 + 1, two_power_126 + 2,
two_power_126 + 3, two_power_126 + 4,
two_power_127 - 4, two_power_127 - 3,
two_power_127 - 2, two_power_127 - 1};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_high(
absl::Uint128High64(ps[i]));
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_high(
absl::Uint128High64(qs[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
// Initializing the input and output masks uniformly at random;
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_in, rng->Rand128());
r_in = r_in % N;
std::vector<absl::uint128> r_outs;
for (int i = 0; i < interval_count; ++i) {
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_out, rng->Rand128());
r_out = r_out % N;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
DPF_ASSERT_OK_AND_ASSIGN(std::tie(key_0, key_1), MicGate->Gen(r_in, r_outs));
// Inside this loop we will test the Evaluation of the MIC gate on
// input values in the vicinity of interval boundaries which are hardcoded
// in the vector x.
for (uint64_t i = 0; i < x.size(); i++) {
std::vector<absl::uint128> res_0, res_1;
// Evaluating MIC gate key_0 on masked input
DPF_ASSERT_OK_AND_ASSIGN(res_0, MicGate->Eval(key_0, (x[i] + r_in) % N));
// Evaluating MIC gate key_1 on masked input
DPF_ASSERT_OK_AND_ASSIGN(res_1, MicGate->Eval(key_1, (x[i] + r_in) % N));
// Reconstructing the actual output of the MIC gate by adding together
// the secret shared output res_0 and res_1, and then subtracting out
// the output mask r_out
for (int j = 0; j < interval_count; j++) {
absl::uint128 result = (res_0[j] + res_1[j] - r_outs[j]) % N;
// If the input lies inside the j^th interval, then the expected
// output of MIC gate is 1, and 0 otherwise
if (x[i] >= ps[j] && x[i] <= qs[j]) {
EXPECT_EQ(result, 1);
} else {
EXPECT_EQ(result, 0);
}
}
}
}
TEST(MICTest, CreateFailsWith128bitGroup) {
MicParameters mic_parameters;
const int group_size = 128;
const uint64_t interval_count = 5;
// Setting input and output group to be Z_{2^128}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10, 23, 45, 66, 15};
std::vector<absl::uint128> qs{45, 30, 100, 250, 15};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
EXPECT_THAT(
MultipleIntervalContainmentGate::Create(mic_parameters),
dpf_internal::StatusIs(absl::StatusCode::kInvalidArgument,
"log_group_size should be in > 0 and < 128"));
}
TEST(MICTest, CreateFailsForIntervalBoundariesOutsideGroup) {
MicParameters mic_parameters;
const int group_size = 20;
const uint64_t interval_count = 1;
const absl::uint128 two_power_20 = absl::uint128(1) << 20;
// Setting input and output group to be Z_{2^20}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{4};
std::vector<absl::uint128> qs{two_power_20};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
EXPECT_THAT(MultipleIntervalContainmentGate::Create(mic_parameters),
dpf_internal::StatusIs(
absl::StatusCode::kInvalidArgument,
"Interval bounds should be between 0 and 2^log_group_size"));
}
TEST(MICTest, CreateFailsForInvalidIntervalBoundaries) {
MicParameters mic_parameters;
const int group_size = 20;
const uint64_t interval_count = 1;
// Setting input and output group to be Z_{2^20}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{4};
std::vector<absl::uint128> qs{3};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
EXPECT_THAT(
MultipleIntervalContainmentGate::Create(mic_parameters),
dpf_internal::StatusIs(absl::StatusCode::kInvalidArgument,
"Interval upper bounds should be >= lower bound"));
}
TEST(MICTest, CreateFailsForEmptyInterval) {
MicParameters mic_parameters;
const int group_size = 20;
const uint64_t interval_count = 1;
// Setting input and output group to be Z_{2^20}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{};
std::vector<absl::uint128> qs{3};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
// Only setting upper bound (and skipping lower bound)
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
EXPECT_THAT(MultipleIntervalContainmentGate::Create(mic_parameters),
dpf_internal::StatusIs(absl::StatusCode::kInvalidArgument,
"Intervals should be non-empty"));
}
TEST(MICTest, GenFailsForIncorrectNumberOfOutputMasks) {
MicParameters mic_parameters;
const int group_size = 64;
const uint64_t interval_count = 5;
// Setting input and output group to be Z_{2^64}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10, 23, 45, 66, 15};
std::vector<absl::uint128> qs{45, 30, 100, 250, 15};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
// Initializing the input and output masks uniformly at random;
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_in, rng->Rand64());
r_in = r_in % N;
std::vector<absl::uint128> r_outs;
// Setting only (interval_count - 1) many output masks
for (int i = 0; i < interval_count - 1; ++i) {
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_out, rng->Rand64());
r_out = r_out % N;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
EXPECT_THAT(
MicGate->Gen(r_in, r_outs),
dpf_internal::StatusIs(
absl::StatusCode::kInvalidArgument,
"Count of output masks should be equal to the number of intervals"));
}
TEST(MICTest, GenFailsForInputMaskOutsideGroup) {
MicParameters mic_parameters;
const int group_size = 10;
const uint64_t interval_count = 1;
// Setting input and output group to be Z_{2^10}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10};
std::vector<absl::uint128> qs{45};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
// Fixing r_in to be an element outside group
absl::uint128 r_in = 2048;
std::vector<absl::uint128> r_outs;
// Initializing the output masks uniformly at random;
for (int i = 0; i < interval_count; ++i) {
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_out, rng->Rand64());
r_out = r_out % N;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
EXPECT_THAT(MicGate->Gen(r_in, r_outs),
dpf_internal::StatusIs(
absl::StatusCode::kInvalidArgument,
"Input mask should be between 0 and 2^log_group_size"));
}
TEST(MICTest, GenFailsForOutputMaskOutsideGroup) {
MicParameters mic_parameters;
const int group_size = 10;
const uint64_t interval_count = 1;
// Setting input and output group to be Z_{2^10}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10};
std::vector<absl::uint128> qs{45};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
// Initializing the input masks uniformly at random;
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_in, rng->Rand64());
r_in = r_in % N;
std::vector<absl::uint128> r_outs;
// Fixing the output masks to be elements outside group;
for (int i = 0; i < interval_count; ++i) {
absl::uint128 r_out = 2048;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
EXPECT_THAT(MicGate->Gen(r_in, r_outs),
dpf_internal::StatusIs(
absl::StatusCode::kInvalidArgument,
"Output mask should be between 0 and 2^log_group_size"));
}
TEST(MICTest, EvalFailsForMaskedInputOutsideGroup) {
MicParameters mic_parameters;
const int group_size = 64;
const uint64_t interval_count = 1;
// Setting input and output group to be Z_{2^64}
mic_parameters.set_log_group_size(group_size);
// Setting up the lower bound and upper bounds for intervals
std::vector<absl::uint128> ps{10};
std::vector<absl::uint128> qs{45};
for (int i = 0; i < interval_count; ++i) {
Interval* interval = mic_parameters.add_intervals();
interval->mutable_lower_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(ps[i]));
interval->mutable_upper_bound()->mutable_value_uint128()->set_low(
absl::Uint128Low64(qs[i]));
}
// Creating a MIC gate
DPF_ASSERT_OK_AND_ASSIGN(
std::unique_ptr<MultipleIntervalContainmentGate> MicGate,
MultipleIntervalContainmentGate::Create(mic_parameters));
MicKey key_0, key_1;
// Initializing the input and output masks uniformly at random;
const absl::string_view kSampleSeed = absl::string_view();
DPF_ASSERT_OK_AND_ASSIGN(
auto rng, distributed_point_functions::BasicRng::Create(kSampleSeed));
absl::uint128 N = absl::uint128(1) << mic_parameters.log_group_size();
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_in, rng->Rand64());
r_in = r_in % N;
std::vector<absl::uint128> r_outs;
for (int i = 0; i < interval_count; ++i) {
DPF_ASSERT_OK_AND_ASSIGN(absl::uint128 r_out, rng->Rand64());
r_out = r_out % N;
r_outs.push_back(r_out);
}
// Generating MIC gate keys
DPF_ASSERT_OK_AND_ASSIGN(std::tie(key_0, key_1), MicGate->Gen(r_in, r_outs));
// Calling Eval on a masked input which is not a group element
EXPECT_THAT(MicGate->Eval(key_0, absl::uint128(1) << 72),
dpf_internal::StatusIs(
absl::StatusCode::kInvalidArgument,
"Masked input should be between 0 and 2^log_group_size"));
}
} // namespace
} // namespace fss_gates
} // namespace distributed_point_functions
| 34.060662 | 80 | 0.691349 | [
"vector"
] |
b249c285b1435e2345d7b9c94b40a5ef61a1780c | 8,992 | cpp | C++ | record.cpp | maxime-tournier/cpp | 303def38a523f0e5699ef389182974f4f50d10fb | [
"MIT"
] | null | null | null | record.cpp | maxime-tournier/cpp | 303def38a523f0e5699ef389182974f4f50d10fb | [
"MIT"
] | null | null | null | record.cpp | maxime-tournier/cpp | 303def38a523f0e5699ef389182974f4f50d10fb | [
"MIT"
] | null | null | null |
#include <cassert>
#include <chrono>
#include <deque>
#include <map>
#include <vector>
#include <stdexcept>
#include <thread>
#include <cmath>
#include <iomanip>
#include <ostream>
// basic event
struct event {
using clock_type = std::chrono::high_resolution_clock;
using time_type = clock_type::time_point;
using id_type = const char*;
id_type id;
time_type time;
enum { BEGIN, END } kind;
// named constructors
static inline event begin(id_type id) {
return {id, clock_type::now(), BEGIN};
}
static inline event end(id_type id) {
return {id, clock_type::now(), END};
}
std::size_t timestamp() const {
return (time - origin).count();
}
static const time_type origin;
};
const event::time_type event::origin = event::clock_type::now();
// thread-local event sequence
class timeline {
public:
const std::thread::id thread;
private:
using storage_type = std::deque<event>;
storage_type storage;
using instances_type = std::deque<timeline*>;
static instances_type instances;
timeline(): thread(std::this_thread::get_id()) {
instances.emplace_back(this);
}
static timeline& current() {
// note: magic statics protect writing to `instances`
static thread_local timeline instance;
return instance;
}
public:
static void push(event ev) { current().storage.push_back(ev); }
void clear() { current().storage.clear(); }
auto begin() const { return storage.begin(); }
auto end() const { return storage.end(); }
static const auto& all() { return instances; }
};
timeline::instances_type timeline::instances;
// scope-guard for recording events
class timer {
event::id_type id;
timer(const timer&) = delete;
public:
timer(event::id_type id): id(id) { timeline::push(event::begin(id)); }
~timer() { timeline::push(event::end(id)); }
};
// general tree structure
template<class Derived>
struct tree {
std::vector<Derived> children;
};
// call tree
struct call: tree<call> {
event::id_type id;
// total duration is the sum of these (used to produce stats)
using duration_type = std::chrono::microseconds;
std::vector<duration_type> duration;
call() = default;
call(const timeline& events) {
auto it = events.begin();
auto end = events.end();
if(!parse(*this, it, end)) {
throw std::runtime_error("parse error");
}
}
// TODO optimize when lhs is moved-from?
// TODO check this is associative
friend call merge(const call& lhs, const call& rhs) {
if(lhs.id != rhs.id) {
throw std::logic_error("cannot merge unrelated call trees");
}
call result;
result.id = lhs.id;
// concatenate durations
std::copy(lhs.duration.begin(),
lhs.duration.end(),
std::back_inserter(result.duration));
std::copy(rhs.duration.begin(),
rhs.duration.end(),
std::back_inserter(result.duration));
// note: callees may differ due to different runtime conditions
std::map<event::id_type, std::vector<const call*>> sources;
for(auto& callee: lhs.children) {
sources[callee.id].emplace_back(&callee);
}
for(auto& callee: rhs.children) {
sources[callee.id].emplace_back(&callee);
}
// TODO preserve ordering as much as possible?
for(auto& source: sources) {
switch(source.second.size()) {
case 2:
result.children.emplace_back(
merge(*source.second.front(), *source.second.back()));
break;
case 1:
result.children.emplace_back(*source.second.front());
break;
default:
assert(false);
}
}
return result;
}
// merge all callees with same id into a single one
call simplify() const {
std::map<event::id_type, std::vector<call>> simplified;
for(auto& it: children) {
simplified[it.id].emplace_back(it.simplify());
}
call result;
result.id = id;
result.duration = duration;
for(auto& it: simplified) {
call merged;
merged.id = it.first;
for(auto& callee: it.second) {
merged = merge(merged, callee);
}
result.children.emplace_back(std::move(merged));
}
return result;
}
private:
template<class Iterator>
static bool parse(call& result, Iterator& first, Iterator last) {
switch(first->kind) {
case event::END:
return false;
case event::BEGIN: {
result.id = first->id;
const event::time_type begin = first->time;
++first;
// try to parse callees
for(call child; parse(child, first, last);
result.children.emplace_back(std::move(child))) {
}
// try to finish this parse
assert(first->kind == event::END);
if(first->id == result.id) {
result.duration.clear();
result.duration.emplace_back(
std::chrono::duration_cast<duration_type>(first->time - begin));
++first;
return true;
}
return false;
}
default:
throw std::logic_error("invalid event kind");
};
}
};
// call tree reporing
struct report: tree<report> {
double total = 0;
double mean = 0;
double dev = 0;
double percent = 0;
std::size_t count = 0;
const char* id;
report(const call& self, double caller_total=0) {
call::duration_type sum(0);
assert(!self.duration.empty());
for(auto& duration: self.duration) {
sum += duration;
++count;
}
// note: milliseconds
const double ms = 1000;
total = sum.count() / ms;
percent = caller_total ? (total / caller_total) * 100 : 100;
mean = count ? total / count : 0;
id = self.id;
for(auto& duration: self.duration) {
const double delta = (duration.count() / ms - mean);
dev += delta * delta;
}
dev = count > 1 ? std::sqrt(dev / (count - 1)) : 0;
for(auto& callee: self.children) {
children.emplace_back(callee, total);
}
}
template<class Count, class Total, class Mean, class Dev, class Percent, class Id>
static void write_row(std::ostream& out,
Count count,
Total total,
Mean mean,
Dev dev,
Percent percent,
Id id,
std::size_t depth = 0) {
const std::size_t width = 14;
out << std::left << std::fixed << std::setprecision(2)
<< std::right << std::setw(width / 2) << count
<< std::right << std::setw(width) << total
<< std::right << std::setw(width) << mean
<< std::right << std::setw(width) << dev
<< std::right << std::setw(width) << percent
<< std::left << std::setw(width) << " " + std::string(depth, '.') + id
<< '\n';
}
static void write_header(std::ostream& out) {
return write_row(out, "count", "total", "mean", "dev", "%", "id");
}
void write(std::ostream& out, std::size_t depth = 0) const {
write_row(out, count, total, mean, dev, percent, id, depth);
for(auto& it: children) {
it.write(out, depth + 1);
}
}
};
void trace_timeline(std::ostream& out, const timeline& self) {
const auto quote = [&](std::string what) {
return std::string("\"" + what + "\"");
};
const auto attr = [&](auto name, auto value) -> std::ostream& {
return out << quote(name) << ": " << value;
};
out << "{\n";
out << quote("traceEvents") << ": [\n";
bool first = true;
for(event ev: self) {
if(first) { first = false; }
else {
out << ",";
}
out << "{";
attr("pid", 1) << ", ";
attr("tid", self.thread) << ", ";
attr("ph", ev.kind == event::BEGIN ? quote("B") : quote("E")) << ", ";
attr("name", quote(ev.id)) << ", ";
attr("ts", ev.timestamp());
out << "}\n";
}
out << "]\n";
out << "}\n";
}
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
void work() {
const timer foo("foo");
for(std::size_t i = 0; i < 2; ++i) {
const timer bar("bar");
for(std::size_t j = 0; j < 10; ++j) {
{
const timer bar("baz");
std::clog << i << " " << j << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
{
const timer quxx("quxx");
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
}
}
}
int main(int argc, char** argv) {
work();
// for(auto& events: timeline::all()) {
// report::write_header(std::cout);
// report(call(*events).simplify()).write(std::cout);
// events->clear();
// }
// for(auto& events: timeline::all()) {
// flame_graph(std::cout, call(*events).simplify());
// events->clear();
// }
if(argc > 1) {
std::ofstream out(argv[1]);
for(auto* events: timeline::all()) {
trace_timeline(out, *events);
events->clear();
}
}
return 0;
}
| 23.477807 | 84 | 0.571953 | [
"vector"
] |
b255fcb6d8002f2ed9d2981455af9f2cbc4e69c1 | 2,531 | cpp | C++ | interface/src/SearchResultElement.cpp | aschuman/CoBaB | 59700463859b267f6e37d5694667e3e4110aa70b | [
"MIT"
] | null | null | null | interface/src/SearchResultElement.cpp | aschuman/CoBaB | 59700463859b267f6e37d5694667e3e4110aa70b | [
"MIT"
] | 3 | 2015-11-15T13:24:23.000Z | 2016-03-11T12:27:15.000Z | interface/src/SearchResultElement.cpp | aschuman/CoBaB | 59700463859b267f6e37d5694667e3e4110aa70b | [
"MIT"
] | 3 | 2015-11-10T07:54:45.000Z | 2021-05-11T12:33:12.000Z | /**
* Project \
*/
#include "SearchResultElement.h"
/**
* @brief SearchResultElement::SearchResultElement Constructs a default SearchResultElement.
*/
SearchResultElement::SearchResultElement() {
mScore = 0;
}
/**
* @brief SearchResultElement::getScore Gets the score of the element.
* @return the score
*/
double SearchResultElement::getScore() const {
return mScore;
}
/**
* @brief SearchResultElement::setScore Sets the score of the element.
* @param score to be set
*/
void SearchResultElement::setScore(const double score) {
mScore = score;
}
/**
* @brief SearchResultElement::getSearchObject Gets the searchobject.
* @return the searchobject
*/
SearchObject SearchResultElement::getSearchObject() const {
return mSearchObject;
}
/**
* @brief SearchResultElement::setSearchObject Sets the searchobject.
* @param searchObject to be set
*/
void SearchResultElement::setSearchObject(const SearchObject& searchObject) {
mSearchObject = searchObject;
}
/**
* @brief operator << Overrides the operator <<.
* @param out the datastream
* @param searchResultElement whose data will be sent
* @return out the datastream
*/
QDataStream& operator<<(QDataStream& out, const SearchResultElement& searchResultElement) {
searchResultElement.toStream(out);
return out;
}
/**
* @brief operator >> Overrides the operator >>.
* @param in the datastream
* @param searchResultElement to be changed
* @return in the datastream
*/
QDataStream& operator>>(QDataStream& in, SearchResultElement& searchResultElement) {
searchResultElement.fromStream(in);
return in;
}
/**
* @brief SearchResultElement::toStream Calls the << operator and writes the SearchResultElement to stream.
* @param out the datastream
*/
void SearchResultElement::toStream(QDataStream& out) const {
//write object to stream
out << mScore
<< mSearchObject;
}
/**
* @brief SearchResultElement::fromStream Calls the >> operator and reads the SearchResultElement from stream.
* @param in the datastream
*/
void SearchResultElement::fromStream(QDataStream& in) {
//read object from stream
in >> mScore;
in >> mSearchObject;
}
/**
* @brief SearchResultElement::compareByScore Compares 2 search result elements by score.
* @param A first element
* @param B second element
* @return true if A's score is smaller than B's
*/
bool SearchResultElement::compareByScore(const SearchResultElement& A, const SearchResultElement& B) {
return (A.getScore() < B.getScore());
}
| 24.572816 | 110 | 0.72659 | [
"object"
] |
b25b70d6950c329b67bc0250a687cd6504c1d483 | 157 | cpp | C++ | programmers/stringtoint.cpp | rjs1197/iceamericano | d2830473ad911fe6beded2ef7d7b627b71a8a2b1 | [
"MIT"
] | null | null | null | programmers/stringtoint.cpp | rjs1197/iceamericano | d2830473ad911fe6beded2ef7d7b627b71a8a2b1 | [
"MIT"
] | null | null | null | programmers/stringtoint.cpp | rjs1197/iceamericano | d2830473ad911fe6beded2ef7d7b627b71a8a2b1 | [
"MIT"
] | null | null | null | #include <string>
#include <vector>
using namespace std;
int solution(string s) {
int answer = 0;
answer = stoi(s);
return answer;
}
| 12.076923 | 24 | 0.598726 | [
"vector"
] |
b25dac1220ccc619fbdaf90191014ccdd24a57ba | 1,956 | cpp | C++ | src/sound/al_Dbap.cpp | AlloSphere-Research-Group/al_lib | 94d23fe71b79d3464a658f16ca34c2040e6d7334 | [
"BSD-3-Clause"
] | 26 | 2018-11-05T23:29:43.000Z | 2022-03-17T18:16:49.000Z | src/sound/al_Dbap.cpp | yangevelyn/allolib | 1654be795b6515c058eb8243751b903a2aa6efdc | [
"BSD-3-Clause"
] | 41 | 2018-01-19T18:34:41.000Z | 2022-01-27T23:52:01.000Z | src/sound/al_Dbap.cpp | yangevelyn/allolib | 1654be795b6515c058eb8243751b903a2aa6efdc | [
"BSD-3-Clause"
] | 11 | 2018-01-05T16:42:19.000Z | 2022-01-27T22:08:01.000Z | #include "al/sound/al_Dbap.hpp"
namespace al {
Dbap::Dbap(const Speakers &sl, float focus)
: Spatializer(sl), mNumSpeakers(0), mFocus(focus) {
mNumSpeakers = mSpeakers.size();
std::cout << "DBAP Compiled with " << mNumSpeakers << " speakers"
<< std::endl;
for (unsigned int i = 0; i < mNumSpeakers; i++) {
mSpeakerVecs[i] = mSpeakers[i].vec();
mDeviceChannels[i] = mSpeakers[i].deviceChannel;
}
}
void Dbap::renderSample(AudioIOData &io, const Pose &listeningPose,
const float &sample, const unsigned int &frameIndex) {
Vec3d relpos = listeningPose.vec();
// Rotate vector according to listener-rotation
Quatd srcRot = listeningPose.quat();
relpos = srcRot.rotate(relpos);
relpos = Vec4d(relpos.x, relpos.z, relpos.y);
for (unsigned int i = 0; i < mNumSpeakers; ++i) {
float gain = 1.f;
Vec3d vec = relpos - mSpeakerVecs[i];
double dist = vec.mag();
gain = 1.f / (1.f + float(dist));
gain = powf(gain, mFocus);
io.out(mDeviceChannels[i], frameIndex) += gain * sample;
}
}
void Dbap::renderBuffer(AudioIOData &io, const Pose &listeningPose,
const float *samples, const unsigned int &numFrames) {
Vec3d relpos = listeningPose.vec();
// Rotate vector according to listener-rotation
Quatd srcRot = listeningPose.quat();
relpos = srcRot.rotate(relpos);
relpos = Vec4d(relpos.x, relpos.z, relpos.y);
for (unsigned int k = 0; k < mNumSpeakers; ++k) {
float gain = 1.f;
Vec3d vec = relpos - mSpeakerVecs[k];
double dist = vec.mag();
gain = 1.0f / (1.0f + float(dist));
gain = powf(gain, mFocus);
float *out = io.outBuffer(mDeviceChannels[k]);
for (size_t i = 0; i < numFrames; ++i) {
out[i] += gain * samples[i];
}
}
}
void Dbap::print(std::ostream &stream) {
stream << "Using DBAP Panning- need to add panner info for print function"
<< std::endl;
}
} // namespace al
| 29.636364 | 78 | 0.627301 | [
"vector"
] |
b260a4358ad02cc29ee2ebf11928153482a8ef43 | 6,004 | cpp | C++ | apps/web/postprocess/postprocess_ssd.cpp | YJessicaGao/CNStream | 6d9a07bc608f41a868a085d52b6a4588a12bb059 | [
"Apache-2.0"
] | 1 | 2019-12-13T07:46:58.000Z | 2019-12-13T07:46:58.000Z | apps/web/postprocess/postprocess_ssd.cpp | cbw1985/CNStream | 287b78cd1beba8228f7f54e342f2ec0daf2bc60c | [
"Apache-2.0"
] | null | null | null | apps/web/postprocess/postprocess_ssd.cpp | cbw1985/CNStream | 287b78cd1beba8228f7f54e342f2ec0daf2bc60c | [
"Apache-2.0"
] | null | null | null | /*************************************************************************
* Copyright (C) [2019] by Cambricon, Inc. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*************************************************************************/
#include <rapidjson/document.h>
#include <rapidjson/filewritestream.h>
#include <rapidjson/writer.h>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "postproc.hpp"
using std::cerr;
using std::endl;
using std::pair;
using std::to_string;
using std::vector;
/**
* @brief Post process for ssd
*/
class PostprocSsd : public cnstream::Postproc {
public:
/**
* @brief Execute postproc on neural ssd network outputs
*
* @param net_outputs: neural network outputs
* @param model: model information(you can get input shape and output shape from model)
* @param package: smart pointer of struct to store processed result
*
* @return return 0 if succeed
*/
int Execute(const std::vector<float*>& net_outputs, const std::shared_ptr<edk::ModelLoader>& model,
const cnstream::CNFrameInfoPtr& package) override;
DECLARE_REFLEX_OBJECT_EX(PostprocSsd, cnstream::Postproc)
}; // class PostprocSsd
#define CLIP(x) ((x) < 0 ? 0 : ((x) > 1 ? 1 : (x)))
IMPLEMENT_REFLEX_OBJECT_EX(PostprocSsd, cnstream::Postproc)
int PostprocSsd::Execute(const std::vector<float*>& net_outputs, const std::shared_ptr<edk::ModelLoader>& model,
const cnstream::CNFrameInfoPtr& package) {
#ifdef CNS_MLU100
if (net_outputs.size() != 1) {
cerr << "[Warnning] Ssd neuron network only has one output,"
" but get " +
to_string(net_outputs.size()) + "\n";
return -1;
}
auto data = net_outputs[0];
auto len = model->OutputShapes()[0].DataCount();
auto box_num = len / 6;
if (len % 6 != 0) {
cerr << "[Warnning] The output of the ssd is a multiple of 6, but "
" the number is " +
to_string(len) + "\n";
return -1;
}
auto pxmin = data;
auto pymin = pxmin + box_num;
auto pxmax = pymin + box_num;
auto pymax = pxmax + box_num;
auto pscore = pymax + box_num;
auto plabel = pscore + box_num;
int label;
float score, x, y, w, h;
rapidjson::Document doc;
doc.SetObject();
rapidjson::Document::AllocatorType& allocator = doc.GetAllocator();
rapidjson::Value array_json(rapidjson::kArrayType);
for (decltype(box_num) bi = 0; bi < box_num; ++bi) {
label = *(plabel + bi);
if (0 == label) continue;
label--;
score = *(pscore + bi);
if (threshold_ > 0 && score < threshold_) continue;
x = CLIP(*(pxmin + bi));
y = CLIP(*(pymin + bi));
w = CLIP(*(pxmax + bi)) - CLIP(*(pxmin + bi));
h = CLIP(*(pymax + bi)) - CLIP(*(pymin + bi));
if (w <= 0) continue;
if (h <= 0) continue;
std::shared_ptr<cnstream::CNInferObject> obj = std::make_shared<cnstream::CNInferObject>();
obj->id = std::to_string(label);
obj->score = score;
obj->bbox.x = x;
obj->bbox.y = y;
obj->bbox.w = w;
obj->bbox.h = h;
package->objs.push_back(obj);
rapidjson::Value objson(rapidjson::kObjectType);
rapidjson::Value id_json(rapidjson::kStringType);
id_json.SetString((obj->id).c_str(), (obj->id).size(), allocator);
objson.AddMember("id", id_json, allocator);
rapidjson::Value score_json;
score_json.SetFloat(score);
objson.AddMember("score", score_json, allocator);
rapidjson::Value bbx(rapidjson::kObjectType);
rapidjson::Value x_json;
x_json.SetFloat(x);
bbx.AddMember("x", x_json, allocator);
rapidjson::Value y_json;
y_json.SetFloat(y);
bbx.AddMember("y", y_json, allocator);
rapidjson::Value w_json;
w_json.SetFloat(w);
bbx.AddMember("w", w_json, allocator);
rapidjson::Value h_json;
h_json.SetFloat(h);
bbx.AddMember("h", h_json, allocator);
objson.AddMember("bbx", bbx, allocator);
array_json.PushBack(objson, allocator);
}
doc.AddMember("objs", array_json, allocator);
std::string sfilename = "/tmp/" + std::to_string(package->channel_idx) + ".json";
const char* filename = sfilename.c_str();
FILE* fp = fopen(filename, "wb");
char buf[0XFFFF];
rapidjson::FileWriteStream output(fp, buf, sizeof(buf));
rapidjson::Writer<rapidjson::FileWriteStream> writer(output);
doc.Accept(writer);
fclose(fp);
#elif CNS_MLU270
auto data = net_outputs[0];
// auto len = net_outputs[0].second;
auto box_num = data[0];
data += 64;
for (decltype(box_num) bi = 0; bi < box_num; ++bi) {
// if (data[0] != batch_index) continue;
if (data[1] == 0) continue;
if (threshold_ > 0 && data[2] < threshold_) continue;
std::shared_ptr<cnstream::CNInferObject> object = std::make_shared<cnstream::CNInferObject>();
object->id = std::to_string(data[1] - 1);
object->score = data[2];
object->bbox.x = data[3];
object->bbox.y = data[4];
object->bbox.w = data[5] - object->bbox.x;
object->bbox.h = data[6] - object->bbox.y;
package->objs.push_back(object);
data += 7;
}
#endif
return 0;
}
| 32.989011 | 112 | 0.642072 | [
"object",
"shape",
"vector",
"model"
] |
b26aeeca847df30a525f8e70fbe77cd4bdd87a12 | 3,258 | cpp | C++ | framework/operators/output.cpp | baajur/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | [
"Apache-2.0"
] | 533 | 2018-05-18T06:14:04.000Z | 2022-03-23T11:46:30.000Z | framework/operators/output.cpp | baajur/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | [
"Apache-2.0"
] | 100 | 2018-05-26T08:32:48.000Z | 2022-03-17T03:26:25.000Z | framework/operators/output.cpp | baajur/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | [
"Apache-2.0"
] | 167 | 2018-05-18T06:14:35.000Z | 2022-02-14T01:44:20.000Z | /* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "framework/operators/output.h"
namespace anakin {
namespace ops {
#define INSTANCE_OUTPUT(Ttype, Ptype) \
template<> \
void Output<Ttype, Ptype>::operator()( \
OpContext<Ttype>& ctx, \
const std::vector<Tensor4dPtr<Ttype>>& ins, \
std::vector<Tensor4dPtr<Ttype>>& outs) {}
template<typename Ttype, Precision Ptype>
Status OutputHelper<Ttype, Ptype>::InitParam() {
return Status::OK();
}
template<typename Ttype, Precision Ptype>
Status OutputHelper<Ttype, Ptype>::Init(OpContext<Ttype> &ctx,
const std::vector<Tensor4dPtr<Ttype>> &ins,
std::vector<Tensor4dPtr<Ttype>> &outs) {
return Status::OK();
}
template<typename Ttype, Precision Ptype>
Status OutputHelper<Ttype, Ptype>::InferShape(const std::vector<Tensor4dPtr<Ttype>> &ins,
std::vector<Tensor4dPtr<Ttype>> &outs) {
return Status::OK();
}
#ifdef USE_CUDA
INSTANCE_OUTPUT(NV, Precision::FP32);
template class OutputHelper<NV, Precision::FP32>;
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, NV, Precision::FP32);
#endif
#ifdef USE_MLU
INSTANCE_OUTPUT(MLU, Precision::FP32);
INSTANCE_OUTPUT(MLU, Precision::FP16);
template class OutputHelper<MLU, Precision::FP32>;
template class OutputHelper<MLU, Precision::FP16>;
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, MLU, Precision::FP32);
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, MLU, Precision::FP16);
#endif // USE_MLU
#if defined USE_X86_PLACE || defined BUILD_LITE
INSTANCE_OUTPUT(X86, Precision::FP32);
template class OutputHelper<X86, Precision::FP32>;
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, X86, Precision::FP32);
#endif
#ifdef USE_ARM_PLACE
INSTANCE_OUTPUT(ARM, Precision::FP32);
template class OutputHelper<ARM, Precision::FP32>;
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, ARM, Precision::FP32);
#endif //arm
#ifdef AMD_GPU
INSTANCE_OUTPUT(AMD, Precision::FP32);
template class OutputHelper<AMD, Precision::FP32>;
ANAKIN_REGISTER_OP_HELPER(Output, OutputHelper, AMD, Precision::FP32);
#endif
//! register op
ANAKIN_REGISTER_OP(Output)
#ifdef USE_CUDA
.__alias__<NV, Precision::FP32>("output")
#endif
#ifdef USE_ARM_PLACE
.__alias__<ARM, Precision::FP32>("output")
#endif
#if defined USE_X86_PLACE || defined BUILD_LITE
.__alias__<X86, Precision::FP32>("output")
#endif
#ifdef AMD_GPU
.__alias__<AMD, Precision::FP32>("output")
#endif
#ifdef USE_MLU
.__alias__<MLU, Precision::FP32>("output")
#endif // USE_MLU
.Doc("Output operator [ only a input data holder and reshape ] ");
} /* namespace ops */
} /* namespace anakin */
| 31.631068 | 90 | 0.725292 | [
"vector"
] |
b26ba4c9281e21e150cce8129f5bc4943b109d06 | 3,606 | cpp | C++ | glengine/gl_material_pbr.cpp | dbacchet/visualizer | a0531a0c92350bf494290505317784e134e63c9c | [
"MIT"
] | 5 | 2020-12-18T19:41:02.000Z | 2021-05-04T02:27:20.000Z | glengine/gl_material_pbr.cpp | dbacchet/visualizer | a0531a0c92350bf494290505317784e134e63c9c | [
"MIT"
] | 2 | 2021-01-20T21:40:16.000Z | 2021-01-26T20:54:13.000Z | glengine/gl_material_pbr.cpp | dbacchet/visualizer | a0531a0c92350bf494290505317784e134e63c9c | [
"MIT"
] | 3 | 2021-02-23T11:40:03.000Z | 2021-08-05T07:39:48.000Z | #include "gl_material_pbr.h"
#include "gl_engine.h"
#include "generated/shaders/pbr.glsl.h"
#include "sokol_gfx.h"
namespace glengine {
bool MaterialPBR::init(GLEngine &eng, sg_primitive_type primitive, sg_index_type idx_type) {
ResourceManager &rm = eng.resource_manager();
sg_shader offscreen_vertexcolor = rm.get_or_create_shader(*offscreen_pbr_shader_desc(sg_query_backend()));
const int offscreen_sample_count = sg_query_features().msaa_render_targets ? eng._config.msaa_samples : 1;
sg_pipeline_desc pip_desc = {0};
pip_desc.layout.buffers[0].stride = sizeof(Vertex);
pip_desc.layout.attrs[ATTR_vs_pbr_a_Position].format = SG_VERTEXFORMAT_FLOAT3;
pip_desc.layout.attrs[ATTR_vs_pbr_a_Color].format = SG_VERTEXFORMAT_UBYTE4N;
pip_desc.layout.attrs[ATTR_vs_pbr_a_Normal].format = SG_VERTEXFORMAT_FLOAT3;
pip_desc.layout.attrs[ATTR_vs_pbr_a_UV1].format = SG_VERTEXFORMAT_FLOAT2;
pip_desc.layout.attrs[ATTR_vs_pbr_a_Tangent].format = SG_VERTEXFORMAT_FLOAT3;
pip_desc.shader = offscreen_vertexcolor, pip_desc.primitive_type = primitive, pip_desc.index_type = idx_type;
pip_desc.depth = {.pixel_format = SG_PIXELFORMAT_DEPTH_STENCIL, .compare = SG_COMPAREFUNC_LESS_EQUAL, .write_enabled = true};
if (eng._config.use_mrt) {
pip_desc.color_count = 3;
} else { // only 1 color attachment
pip_desc.color_count = 1;
}
pip_desc.cull_mode = SG_CULLMODE_NONE;
pip_desc.face_winding = SG_FACEWINDING_CCW;
pip_desc.sample_count = offscreen_sample_count;
pip_desc.label = "PBR pipeline";
pip = rm.get_or_create_pipeline(pip_desc);
// placeholder textures
tex_diffuse = rm.default_image(ResourceManager::White);
tex_metallic_roughness = rm.default_image(ResourceManager::White);
tex_normal = rm.default_image(ResourceManager::Normal);
tex_occlusion = rm.default_image(ResourceManager::White);
tex_emissive = rm.default_image(ResourceManager::Black);
color = {255, 255, 255, 255};
return true;
}
void MaterialPBR::update_bindings(sg_bindings &bind) {
bind.fs_images[SLOT_u_BaseColorSampler] = tex_diffuse;
bind.fs_images[SLOT_u_MetallicRoughnessSampler] = tex_metallic_roughness;
bind.fs_images[SLOT_u_NormalSampler] = tex_normal;
bind.fs_images[SLOT_u_OcclusionSampler] = tex_occlusion;
bind.fs_images[SLOT_u_EmissiveSampler] = tex_emissive;
}
void MaterialPBR::apply_uniforms(const common_uniform_params_t ¶ms) {
vs_params_t vs_params{.model = params.model, .view = params.view, .projection = params.projection};
sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, SG_RANGE(vs_params));
Light_t lparams{
.light_position = {15.0f, 10.0f, 10.0f},
.light_intensity = 1.0f,
.light_range = 200.0f,
.light_color = {1.0f, 1.0f, 1.0f},
.light_direction = {-0.7398999929428101, 0.19830000400543213, -0.642799973487854},
};
sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_Light, SG_RANGE(lparams));
fs_params_t mparams{
.u_MetallicFactor = metallic_factor,
.u_RoughnessFactor = roughness_factor,
.u_BaseColorFactor = {color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f},
.u_Exposure = 1.0f,
};
sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_fs_params, SG_RANGE(mparams));
TextureParams_t tparams{
.u_NormalScale = 1.0f,
.u_EmissiveFactor = emissive_factor,
.u_OcclusionStrength = 1.0f,
.u_MipCount = 1,
};
sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_TextureParams, SG_RANGE(tparams));
}
} // namespace glengine
| 44.518519 | 129 | 0.738769 | [
"model"
] |
05cdac513b1e087433e0ae6d7c563ba94b2ab3b1 | 2,229 | cpp | C++ | 81.SearchInRotatedSortedArrayII.cpp | mrdrivingduck/leet-code | fee008f3a62849a21ca703e05f755378996a1ff5 | [
"MIT"
] | null | null | null | 81.SearchInRotatedSortedArrayII.cpp | mrdrivingduck/leet-code | fee008f3a62849a21ca703e05f755378996a1ff5 | [
"MIT"
] | null | null | null | 81.SearchInRotatedSortedArrayII.cpp | mrdrivingduck/leet-code | fee008f3a62849a21ca703e05f755378996a1ff5 | [
"MIT"
] | null | null | null | /**
* @author Mr Dk.
* @version 2021/04/07
*/
/*
There is an integer array nums sorted in non-decreasing order (not
necessarily with distinct values).
Before being passed to your function, nums is rotated at an unknown
pivot index k (0 <= k < nums.length) such that the resulting array
is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ...,
nums[k-1]] (0-indexed). For example, [0,1,2,4,4,4,5,6,6,7] might be
rotated at pivot index 5 and become [4,5,6,6,7,0,1,2,4,4].
Given the array nums after the rotation and an integer target, return
true if target is in nums, or false if it is not in nums.
Example 1:
Input: nums = [2,5,6,0,0,1,2], target = 0
Output: true
Example 2:
Input: nums = [2,5,6,0,0,1,2], target = 3
Output: false
Constraints:
1 <= nums.length <= 5000
-104 <= nums[i] <= 104
nums is guaranteed to be rotated at some pivot.
-104 <= target <= 104
Follow up: This problem is the same as Search in Rotated Sorted Array,
where nums may contain duplicates. Would this affect the runtime
complexity? How and why?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
/*
遍历找到分界点,然后以分界点为边界进行二分搜索。(我知道这不是最优解)
*/
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
using std::cout;
using std::endl;
using std::vector;
class Solution {
public:
bool search(vector<int>& nums, int target) {
size_t i = 0;
for (; i < nums.size() - 1; i++) {
if (nums[i] > nums[i + 1]) {
break;
}
}
if (nums[i] == target) {
return true;
}
return std::binary_search(nums.begin(), nums.begin() + i, target) ||
std::binary_search(nums.begin() + i + 1, nums.end(), target);
}
};
int main()
{
Solution s;
vector<int> nums;
nums = { 1,0,1,1,1 };
assert(true == s.search(nums, 0));
nums = { 2,5,6,0,0,1,2 };
assert(true == s.search(nums, 0));
nums = { 2,5,6,0,0,1,2 };
assert(false == s.search(nums, 3));
return 0;
}
| 24.766667 | 77 | 0.5738 | [
"vector"
] |
05d3f2fd92095d3804b36dc1eb0069cb83d3b9f6 | 140,047 | cpp | C++ | com/netfx/src/clr/vm/comclass.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | com/netfx/src/clr/vm/comclass.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | com/netfx/src/clr/vm/comclass.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | // ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
////////////////////////////////////////////////////////////////////////////////
// Author: Simon Hall (t-shall)
// Author: Daryl Olander (darylo)
// Date: March 27, 1998
////////////////////////////////////////////////////////////////////////////////
#include "common.h"
#include "COMClass.h"
#include "CorRegPriv.h"
#include "ReflectUtil.h"
#include "COMVariant.h"
#include "COMString.h"
#include "COMMember.h"
#include "COMModule.h"
#include "COMArrayInfo.h"
#include "compluswrapper.h"
#include "CorError.h"
#include "gcscan.h"
#include "method.hpp"
#include "field.h"
#include "AssemblyNative.hpp"
#include "AppDomain.hpp"
#include "COMReflectionCache.hpp"
#include "eeconfig.h"
#include "COMCodeAccessSecurityEngine.h"
#include "Security.h"
#include "CustomAttribute.h"
// this file handles string conversion errors for itself
#undef MAKE_TRANSLATIONFAILED
// This is defined in COMSystem...
extern LPVOID GetArrayElementPtr(OBJECTREF a);
/*======================================================================================
** COMClass data
**/
bool COMClass::m_fAreReflectionStructsInitialized = false;
MethodTable* COMClass::m_pMTRC_Class = NULL;
FieldDesc* COMClass::m_pDescrTypes = NULL;
FieldDesc* COMClass::m_pDescrRetType = NULL;
FieldDesc* COMClass::m_pDescrRetModType = NULL;
FieldDesc* COMClass::m_pDescrMatchFlag = NULL;
//FieldDesc* COMClass::m_pDescrCallConv = NULL;
FieldDesc* COMClass::m_pDescrAttributes = NULL;
long COMClass::m_ReflectCrstInitialized = 0;
CRITICAL_SECTION COMClass::m_ReflectCrst;
CRITICAL_SECTION *COMClass::m_pReflectCrst = NULL;
//The serialization bit work is temporary until 3/15/2000. After that point, we will
//always check the serialization bit.
#define SERIALIZATION_BIT_UNKNOWN 0xFFFFFFFF
#define SERIALIZATION_BIT_ZERO 0x0
#define SERIALIZATION_BIT_KEY L"IgnoreSerializationBit"
#define SERIALIZATION_LOG_KEY L"LogNonSerializable"
DWORD COMClass::m_checkSerializationBit = SERIALIZATION_BIT_UNKNOWN;
Assembly *GetCallersAssembly(StackCrawlMark *stackMark, void *returnIP)
{
Assembly *pCallersAssembly = NULL;
if (stackMark)
pCallersAssembly = SystemDomain::GetCallersAssembly(stackMark);
else {
MethodDesc *pCallingMD = IP2MethodDesc((const BYTE *)returnIP);
if (pCallingMD)
pCallersAssembly = pCallingMD->GetAssembly();
else
// If we failed to determine the caller's method desc, this might
// indicate a late bound call through reflection. Attempt to
// determine the real caller through the slower stackwalk method.
pCallersAssembly = SystemDomain::GetCallersAssembly((StackCrawlMark*)NULL);
}
return pCallersAssembly;
}
EEClass *GetCallersClass(StackCrawlMark *stackMark, void *returnIP)
{
EEClass *pCallersClass = NULL;
if (stackMark)
pCallersClass = SystemDomain::GetCallersClass(stackMark);
else {
MethodDesc *pCallingMD = IP2MethodDesc((const BYTE *)returnIP);
if (pCallingMD)
pCallersClass = pCallingMD->GetClass();
else
// If we failed to determine the caller's method desc, this might
// indicate a late bound call through reflection. Attempt to
// determine the real caller through the slower stackwalk method.
pCallersClass = SystemDomain::GetCallersClass((StackCrawlMark*)NULL);
}
return pCallersClass;
}
FCIMPL5(Object*, COMClass::GetMethodFromCache, ReflectClassBaseObject* _refThis, StringObject* _name, INT32 invokeAttr, INT32 argCnt, PtrArray* _args)
{
MemberMethodsCache *pMemberMethodsCache = GetAppDomain()->GetRefMemberMethodsCache();
REFLECTCLASSBASEREF refThis = REFLECTCLASSBASEREF(_refThis);
STRINGREF name = STRINGREF(_name);
PTRARRAYREF args = PTRARRAYREF(_args);
_ASSERTE (argCnt < 6);
MemberMethods vMemberMethods;
vMemberMethods.pRC = (ReflectClass*) refThis->GetData();
vMemberMethods.name = &name;
vMemberMethods.argCnt = argCnt;
vMemberMethods.invokeAttr = invokeAttr;
OBJECTREF* argArray = args->m_Array;
for (int i = 0; i < argCnt; i ++)
vMemberMethods.vArgType[i] = (argArray[i] != 0)?argArray[i]->GetMethodTable():0;
OBJECTREF method;
if (!pMemberMethodsCache->GetFromCache (&vMemberMethods, method))
method = NULL;
FC_GC_POLL_AND_RETURN_OBJREF(OBJECTREFToObject(method));
}
FCIMPLEND
FCIMPL6(void,COMClass::AddMethodToCache, ReflectClassBaseObject* refThis, StringObject* name, INT32 invokeAttr, INT32 argCnt, PtrArray* args, Object* invokeMethod)
{
MemberMethodsCache *pMemberMethodsCache = GetAppDomain()->GetRefMemberMethodsCache();
_ASSERTE (pMemberMethodsCache);
_ASSERTE (argCnt < 6);
MemberMethods vMemberMethods;
vMemberMethods.pRC = (ReflectClass*) REFLECTCLASSBASEREF(refThis)->GetData();
vMemberMethods.name = (STRINGREF*) &name;
vMemberMethods.argCnt = argCnt;
vMemberMethods.invokeAttr = invokeAttr;
OBJECTREF *argArray = (OBJECTREF*)((BYTE*)args + args->GetDataOffset());
for (int i = 0; i < argCnt; i ++)
vMemberMethods.vArgType[i] = !argArray[i] ? 0 : argArray[i]->GetMethodTable();
pMemberMethodsCache->AddToCache (&vMemberMethods, ObjectToOBJECTREF((Object *)invokeMethod));
FC_GC_POLL();
}
FCIMPLEND
void COMClass::InitializeReflectCrst()
{
// There are 3 cases when we come here
// 1. m_ReflectCrst has not been initialized (m_pReflectCrst == 0)
// 2. m_ReflectCrst is being initialized (m_pReflectCrst == 1)
// 3. m_ReflectCrst has been initialized (m_pReflectCrst != 0 and m_pReflectCrst != 1)
if (m_pReflectCrst == NULL)
{
if (InterlockedCompareExchange(&m_ReflectCrstInitialized, 1, 0) == 0)
{
// first one to get in does the initialization
InitializeCriticalSection(&m_ReflectCrst);
m_pReflectCrst = &m_ReflectCrst;
}
else
{
while (m_pReflectCrst == NULL)
::SwitchToThread();
}
}
}
// MinimalReflectionInit
// This method will intialize reflection. It is executed once.
// This method is synchronized so multiple threads don't attempt to
// initalize reflection.
void COMClass::MinimalReflectionInit()
{
Thread *thread = GetThread();
_ASSERTE(thread->PreemptiveGCDisabled());
thread->EnablePreemptiveGC();
LOCKCOUNTINCL("MinimalReflectionInit in COMClass.cpp");
InitializeReflectCrst();
EnterCriticalSection(&m_ReflectCrst);
thread->DisablePreemptiveGC();
if (m_fAreReflectionStructsInitialized) {
LeaveCriticalSection(&m_ReflectCrst);
LOCKCOUNTDECL("MinimalReflectionInit in COMClass.cpp");
return;
}
COMMember::CreateReflectionArgs();
ReflectUtil::Create();
// At various places we just assume Void has been loaded and m_NormType initialized
MethodTable* pVoidMT = g_Mscorlib.FetchClass(CLASS__VOID);
pVoidMT->m_NormType = ELEMENT_TYPE_VOID;
// Prevent recursive entry...
m_fAreReflectionStructsInitialized = true;
LeaveCriticalSection(&m_ReflectCrst);
LOCKCOUNTDECL("MinimalReflectionInit in COMClass.cpp");
}
MethodTable *COMClass::GetRuntimeType()
{
if (m_pMTRC_Class)
return m_pMTRC_Class;
MinimalReflectionInit();
_ASSERTE(g_pRefUtil);
m_pMTRC_Class = g_pRefUtil->GetClass(RC_Class);
_ASSERTE(m_pMTRC_Class);
return m_pMTRC_Class;
}
// This is called during termination...
#ifdef SHOULD_WE_CLEANUP
void COMClass::Destroy()
{
if (m_pReflectCrst)
{
DeleteCriticalSection(m_pReflectCrst);
m_pReflectCrst = NULL;
}
}
#endif /* SHOULD_WE_CLEANUP */
// See if a Type object for the given Array already exists. May very
// return NULL.
OBJECTREF COMClass::QuickLookupExistingArrayClassObj(ArrayTypeDesc* arrayType)
{
// This is designed to be called from FCALL, and we don't want any GC allocations.
// So make sure Type class has been loaded
if (!m_pMTRC_Class)
return NULL;
// Lookup the array to see if we have already built it.
ReflectArrayClass* newArray = (ReflectArrayClass*)
arrayType->GetReflectClassIfExists();
if (!newArray) {
return NULL;
}
return newArray->GetClassObject();
}
// This will return the Type handle for an object. It doesn't create
// the Type Object when called.
FCIMPL1(void*, COMClass::GetTHFromObject, Object* obj)
if (obj==NULL)
FCThrowArgumentNull(L"obj");
VALIDATEOBJECTREF(obj);
return obj->GetMethodTable();
FCIMPLEND
// This will determine if a class represents a ByRef.
FCIMPL1(INT32, COMClass::IsByRefImpl, ReflectClassBaseObject* refThis)
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
return pRC->IsByRef();
FCIMPLEND
// This will determine if a class represents a ByRef.
FCIMPL1(INT32, COMClass::IsPointerImpl, ReflectClassBaseObject* refThis) {
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
TypeHandle th = pRC->GetTypeHandle();
return (th.GetSigCorElementType() == ELEMENT_TYPE_PTR) ? 1 : 0;
}
FCIMPLEND
// IsPointerImpl
// This method will return a boolean indicating if the Type
// object is a ByRef
FCIMPL1(INT32, COMClass::IsNestedTypeImpl, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
EEClass* pEEC = pRC->GetClass();
return (pEEC && pEEC->IsNested()) ? 1 : 0;
}
FCIMPLEND
// GetNestedDeclaringType
// Return the declaring class for a nested type.
FCIMPL1(Object*, COMClass::GetNestedDeclaringType, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
EEClass* pEEC = pRC->GetClass();
OBJECTREF o;
HELPER_METHOD_FRAME_BEGIN_RET_0();
pEEC = pEEC->GetEnclosingClass();
o = pEEC->GetExposedClassObject();
HELPER_METHOD_FRAME_END();
return OBJECTREFToObject(o);
}
FCIMPLEND
void COMClass::CreateClassObjFromEEClass(EEClass* pVMCClass, REFLECTCLASSBASEREF* pRefClass)
{
LPVOID rv = NULL;
// This only throws the possible exception raised by the <cinit> on the class
THROWSCOMPLUSEXCEPTION();
// call the <cinit> Class
OBJECTREF Throwable;
if (!g_pRefUtil->GetClass(RC_Class)->CheckRunClassInit(&Throwable)) {
COMPlusThrow(Throwable);
}
// There was an expectation that we would never come here for e.g. Arrays. But there
// are far too many clients who were unaware of that expectation. The most expedient
// thing to do for V1 is to simply handle that case here:
if (pVMCClass->IsArrayClass())
{
ArrayClass *pArrayClass = (ArrayClass *) pVMCClass;
TypeHandle th = pArrayClass->GetClassLoader()->FindArrayForElem(
pArrayClass->GetElementTypeHandle(),
pArrayClass->GetMethodTable()->GetNormCorElementType(),
pArrayClass->GetRank());
*pRefClass = (REFLECTCLASSBASEREF) th.CreateClassObj();
_ASSERTE(*pRefClass != NULL);
}
else
{
// Check to make sure this has a member. If not it must be
// special
_ASSERTE(pVMCClass->GetCl() != mdTypeDefNil);
// Create a COM+ Class object
*pRefClass = (REFLECTCLASSBASEREF) AllocateObject(g_pRefUtil->GetClass(RC_Class));
// Set the data in the COM+ object
ReflectClass* p = new (pVMCClass->GetDomain()) ReflectBaseClass();
if (!p)
COMPlusThrowOM();
REFLECTCLASSBASEREF tmp = *pRefClass;
GCPROTECT_BEGIN(tmp);
p->Init(pVMCClass);
*pRefClass = tmp;
GCPROTECT_END();
(*pRefClass)->SetData(p);
}
}
// GetMemberMethods
// This method will return all of the members methods which match the specified attributes flag
LPVOID __stdcall COMClass::GetMemberMethods(_GetMemberMethodsArgs* args)
{
THROWSCOMPLUSEXCEPTION();
if (args->name == NULL)
COMPlusThrow(kNullReferenceException);
bool checkCall;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// Check the calling convention.
checkCall = (args->callConv == Any_CC) ? false : true;
CQuickBytes bytes;
LPSTR szName;
DWORD cName;
szName = GetClassStringVars((STRINGREF) args->name, &bytes, &cName);
ReflectMethodList* pMeths = pRC->GetMethods();
// Find methods....
return COMMember::g_pInvokeUtil->FindMatchingMethods(args->invokeAttr,
szName,
cName,
(args->argTypes != NULL) ? &args->argTypes : NULL,
args->argCnt,
checkCall,
args->callConv,
pRC,
pMeths,
g_pRefUtil->GetTrueType(RC_Method),
args->verifyAccess != 0);
}
// GetMemberCons
// This method returns all of the constructors that have a set number of methods.
LPVOID __stdcall COMClass::GetMemberCons(_GetMemberConsArgs* args)
{
LPVOID rv;
bool checkCall;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// properly get rid of any non sense from the binding flags
args->invokeAttr &= ~BINDER_FlattenHierarchy;
args->invokeAttr &= ~BINDER_IgnoreCase;
args->invokeAttr |= BINDER_DeclaredOnly;
// Check the calling convention.
checkCall = (args->callConv == Any_CC) ? false : true;
ReflectMethodList* pCons = pRC->GetConstructors();
// Find methods....
rv = COMMember::g_pInvokeUtil->FindMatchingMethods(args->invokeAttr,
NULL,
0,
(args->argTypes != NULL) ? &args->argTypes : NULL,
args->argCnt,
checkCall,
args->callConv,
pRC,
pCons,
g_pRefUtil->GetTrueType(RC_Ctor),
args->verifyAccess != 0);
// Also return whether the type is a delegate (some extra security checks
// need to be made in this case).
*args->isDelegate = (pRC->IsClass()) ? pRC->GetClass()->IsAnyDelegateClass() : 0;
return rv;
}
// GetMemberField
// This method returns all of the fields which match the specified
// name.
LPVOID __stdcall COMClass::GetMemberField(_GetMemberFieldArgs* args)
{
DWORD i;
PTRARRAYREF refArr;
LPVOID rv;
RefSecContext sCtx;
THROWSCOMPLUSEXCEPTION();
if (args->name == NULL)
COMPlusThrow(kNullReferenceException);
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
ReflectFieldList* pFields = pRC->GetFields();
CQuickBytes bytes;
LPSTR szFieldName;
DWORD cFieldName;
//@TODO: Assumes args->criteria is of type STRINGREF
szFieldName = GetClassStringVars((STRINGREF) args->name, &bytes, &cFieldName);
int fldCnt = 0;
int* matchFlds = (int*) _alloca(sizeof(int) * pFields->dwTotal);
memset(matchFlds,0,sizeof(int) * pFields->dwTotal);
MethodTable *pParentMT = pRC->GetClass()->GetMethodTable();
DWORD propToLookup = (args->invokeAttr & BINDER_FlattenHierarchy) ? pFields->dwTotal : pFields->dwFields;
for(i=0; i<propToLookup; i++) {
// Get the FieldDesc
if (MatchField(pFields->fields[i].pField, cFieldName, szFieldName, pRC, args->invokeAttr) &&
(!args->verifyAccess || InvokeUtil::CheckAccess(&sCtx, pFields->fields[i].pField->GetFieldProtection(), pParentMT, 0)))
matchFlds[fldCnt++] = i;
}
// If we didn't find any methods then return
if (fldCnt == 0)
return 0;
// Allocate the MethodInfo Array and return it....
refArr = (PTRARRAYREF) AllocateObjectArray(fldCnt, g_pRefUtil->GetTrueType(RC_Field));
GCPROTECT_BEGIN(refArr);
for (int i=0;i<fldCnt;i++) {
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pFields->fields[matchFlds[i]].GetFieldInfo(pRC);
refArr->SetAt(i, o);
}
*((PTRARRAYREF*) &rv) = refArr;
GCPROTECT_END();
return rv;
}
// GetMemberProperties
// This method returns all of the properties that have a set number
// of arguments. The methods will be either get or set methods depending
// upon the invokeAttr flag.
LPVOID __stdcall COMClass::GetMemberProperties(_GetMemberPropertiesArgs* args)
{
THROWSCOMPLUSEXCEPTION();
if (args->name == NULL)
COMPlusThrow(kNullReferenceException);
PTRARRAYREF refArr;
LPVOID rv;
bool loose;
RefSecContext sCtx;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
loose = (args->invokeAttr & BINDER_OptionalParamBinding) ? true : false;
// The Search modifiers
bool ignoreCase = ((args->invokeAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->invokeAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->invokeAttr & BINDER_Static) != 0);
bool addInst = ((args->invokeAttr & BINDER_Instance) != 0);
bool addPriv = ((args->invokeAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->invokeAttr & BINDER_Public) != 0);
int bSetter = (args->invokeAttr & BINDER_SetProperty) ? 1 : 0;
// Get the Properties from the Class
ReflectPropertyList* pProps = pRC->GetProperties();
if (pProps->dwTotal == 0)
return 0;
CQuickBytes bytes;
LPSTR szName;
DWORD cName;
szName = GetClassStringVars((STRINGREF) args->name, &bytes, &cName);
DWORD searchSpace = ((args->invokeAttr & BINDER_FlattenHierarchy) != 0) ? pProps->dwTotal : pProps->dwProps;
MethodTable *pParentMT = pEEC->GetMethodTable();
int propCnt = 0;
int* matchProps = (int*) _alloca(sizeof(int) * searchSpace);
memset(matchProps,0,sizeof(int) * searchSpace);
for (DWORD i = 0; i < searchSpace; i++) {
// Check on the name
if (ignoreCase) {
if (_stricmp(pProps->props[i].szName, szName) != 0)
continue;
}
else {
if (strcmp(pProps->props[i].szName, szName) != 0)
continue;
}
// Test the publics/nonpublics
if (COMMember::PublicProperty(&pProps->props[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (args->verifyAccess && !InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
// Check for static instance
if (COMMember::StaticProperty(&pProps->props[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Checked the declared methods.
if (declaredOnly) {
if (pProps->props[i].pDeclCls != pEEC)
continue;
}
// Check the specific accessor
ReflectMethod* pMeth;
if (bSetter) {
pMeth = pProps->props[i].pSetter;
}
else {
pMeth = pProps->props[i].pGetter;
}
if (pMeth == 0)
continue;
ExpandSig* pSig = pMeth->GetSig();
int argCnt = pSig->NumFixedArgs();
if (argCnt != args->argCnt) {
IMDInternalImport *pInternalImport = pMeth->pMethod->GetMDImport();
HENUMInternal hEnumParam;
mdParamDef paramDef = mdParamDefNil;
mdToken methodTk = pMeth->GetToken();
if (!IsNilToken(methodTk)) {
HRESULT hr = pInternalImport->EnumInit(mdtParamDef, methodTk, &hEnumParam);
if (SUCCEEDED(hr)) {
if (argCnt < args->argCnt || argCnt == args->argCnt + 1) {
// we must have a param array under the first condition, could be a param array under the second
int propArgCount = argCnt - bSetter;
// get the sig of the last param
LPVOID pEnum;
pSig->Reset(&pEnum);
TypeHandle lastArgType;
for (INT32 i = 0; i < propArgCount; i++)
lastArgType = pSig->NextArgExpanded(&pEnum);
pInternalImport->EnumReset(&hEnumParam);
// get metadata info and token for the last param
ULONG paramCount = pInternalImport->EnumGetCount(&hEnumParam);
for (ULONG ul = 0; ul < paramCount; ul++) {
pInternalImport->EnumNext(&hEnumParam, ¶mDef);
if (paramDef != mdParamDefNil) {
LPCSTR name;
SHORT seq;
DWORD revWord;
name = pInternalImport->GetParamDefProps(paramDef,(USHORT*) &seq, &revWord);
if (seq == propArgCount) {
// looks good! check that it is in fact a param array
if (lastArgType.IsArray()) {
if (COMCustomAttribute::IsDefined(pMeth->GetModule(), paramDef, TypeHandle(InvokeUtil::GetParamArrayAttributeTypeHandle()))) {
pInternalImport->EnumClose(&hEnumParam);
goto matchFound;
}
}
}
}
}
}
if (loose && argCnt > args->argCnt) {
pInternalImport->EnumReset(&hEnumParam);
ULONG cArg = (ULONG)(args->argCnt + 1 - bSetter);
while (pInternalImport->EnumNext(&hEnumParam, ¶mDef)) {
LPCSTR name;
SHORT seq;
DWORD revWord;
name = pInternalImport->GetParamDefProps(paramDef,(USHORT*) &seq, &revWord);
if ((ULONG)seq < cArg)
continue;
else if ((ULONG)seq == cArg && (revWord & pdOptional)) {
cArg++;
continue;
}
else {
if (!bSetter || (int)seq != argCnt)
break; // not an optional param, no match
}
}
if (cArg == (ULONG)argCnt + 1 - bSetter) {
pInternalImport->EnumClose(&hEnumParam);
goto matchFound;
}
}
pInternalImport->EnumClose(&hEnumParam);
}
}
continue; // no good
}
matchFound:
if (args->verifyAccess && !InvokeUtil::CheckAccess(&sCtx, pMeth->attrs, pParentMT, 0)) continue;
// If the method has a linktime security demand attached, check it now.
if (args->verifyAccess && !InvokeUtil::CheckLinktimeDemand(&sCtx, pMeth->pMethod, false))
continue;
matchProps[propCnt++] = i;
}
// If we didn't find any methods then return
if (propCnt == 0)
return 0;
// Allocate the MethodInfo Array and return it....
refArr = (PTRARRAYREF) AllocateObjectArray( propCnt,
g_pRefUtil->GetTrueType(RC_Method));
GCPROTECT_BEGIN(refArr);
for (int i=0;i<propCnt;i++) {
ReflectMethod* pMeth;
if (args->invokeAttr & BINDER_SetProperty)
pMeth = pProps->props[matchProps[i]].pSetter;
else
pMeth = pProps->props[matchProps[i]].pGetter;
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pMeth->GetMethodInfo(pProps->props[matchProps[i]].pRC);
refArr->SetAt(i, o);
}
*((PTRARRAYREF*) &rv) = refArr;
GCPROTECT_END();
return rv;
}
// GetMatchingProperties
// This basically does a matching based upon the properties abstract
// signature.
LPVOID __stdcall COMClass::GetMatchingProperties(_GetMatchingPropertiesArgs* args)
{
THROWSCOMPLUSEXCEPTION();
PTRARRAYREF refArr;
LPVOID rv;
RefSecContext sCtx;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
// The Search modifiers
bool ignoreCase = ((args->invokeAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->invokeAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->invokeAttr & BINDER_Static) != 0);
bool addInst = ((args->invokeAttr & BINDER_Instance) != 0);
bool addPriv = ((args->invokeAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->invokeAttr & BINDER_Public) != 0);
// Get the Properties from the Class
ReflectPropertyList* pProps = pRC->GetProperties();
if (pProps->dwTotal == 0)
return 0;
CQuickBytes bytes;
LPSTR szName;
DWORD cName;
if (args->name == NULL)
COMPlusThrow(kNullReferenceException);
//@TODO: Assumes args->criteria is of type STRINGREF
szName = GetClassStringVars((STRINGREF) args->name, &bytes, &cName);
DWORD searchSpace = ((args->invokeAttr & BINDER_FlattenHierarchy) != 0) ? pProps->dwTotal : pProps->dwProps;
MethodTable *pParentMT = pEEC->GetMethodTable();
int propCnt = 0;
int* matchProps = (int*) _alloca(sizeof(int) * searchSpace);
memset(matchProps,0,sizeof(int) * searchSpace);
for (DWORD i = 0; i < searchSpace; i++) {
// Check on the name
if (ignoreCase) {
if (_stricmp(pProps->props[i].szName, szName) != 0)
continue;
}
else {
if (strcmp(pProps->props[i].szName, szName) != 0)
continue;
}
int argCnt = pProps->props[i].pSignature->NumFixedArgs();
if (args->argCnt != -1 && argCnt != args->argCnt)
continue;
// Test the publics/nonpublics
if (COMMember::PublicProperty(&pProps->props[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (args->verifyAccess && !InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
// Check for static instance
if (COMMember::StaticProperty(&pProps->props[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Checked the declared methods.
if (declaredOnly) {
if (pProps->props[i].pDeclCls != pEEC)
continue;
}
matchProps[propCnt++] = i;
}
// If we didn't find any methods then return
if (propCnt == 0)
return 0;
// Allocate the MethodInfo Array and return it....
refArr = (PTRARRAYREF) AllocateObjectArray(propCnt, g_pRefUtil->GetTrueType(RC_Prop));
GCPROTECT_BEGIN(refArr);
for (int i=0;i<propCnt;i++) {
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pProps->props[matchProps[i]].GetPropertyInfo(pProps->props[matchProps[i]].pRC);
refArr->SetAt(i, o);
}
*((PTRARRAYREF*) &rv) = refArr;
GCPROTECT_END();
return rv;
}
// GetMethod
// This method returns an array of MethodInfo object representing all of the methods
// defined for this class.
LPVOID __stdcall COMClass::GetMethods(_GetMethodsArgs* args)
{
LPVOID rv = 0;
PTRARRAYREF refArrMethods;
THROWSCOMPLUSEXCEPTION();
// Get the EEClass and Vtable associated with args->refThis
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
ReflectMethodList* pMeths = pRC->GetMethods();
refArrMethods = g_pRefUtil->CreateClassArray(RC_Method,pRC,pMeths,args->bindingAttr, true);
*((PTRARRAYREF*) &rv) = refArrMethods;
return rv;
}
// GetConstructor
// This method returns a single constructor which matchs the passed
// in criteria.
LPVOID __stdcall COMClass::GetConstructors(_GetConstructorsArgs* args)
{
LPVOID rv;
PTRARRAYREF refArrCtors;
THROWSCOMPLUSEXCEPTION();
// Get the EEClass and Vtable associated with args->refThis
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
ReflectMethodList* pCons = pRC->GetConstructors();
refArrCtors = g_pRefUtil->CreateClassArray(RC_Ctor,pRC,pCons,args->bindingAttr, args->verifyAccess != 0);
*((PTRARRAYREF*) &rv) = refArrCtors;
return rv;
}
// GetField
// This method will return the specified field
LPVOID __stdcall COMClass::GetField(_GetFieldArgs* args)
{
HRESULT hr = E_FAIL;
DWORD i;
LPVOID rv = 0;
REFLECTBASEREF refField;
RefSecContext sCtx;
THROWSCOMPLUSEXCEPTION();
if (args->fieldName == 0)
COMPlusThrowArgumentNull(L"name",L"ArgumentNull_String");
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
ReflectFieldList* pFields = pRC->GetFields();
DWORD maxCnt;
if (args->fBindAttr & BINDER_FlattenHierarchy)
maxCnt = pFields->dwTotal;
else
maxCnt = pFields->dwFields;
CQuickBytes bytes;
LPSTR szFieldName;
DWORD cFieldName;
//@TODO: Assumes args->criteria is of type STRINGREF
szFieldName = GetClassStringVars((STRINGREF) args->fieldName,
&bytes, &cFieldName);
rv = 0;
for (i=0; i < maxCnt; i++) {
if (MatchField(pFields->fields[i].pField,cFieldName,szFieldName, pRC,args->fBindAttr) &&
InvokeUtil::CheckAccess(&sCtx, pFields->fields[i].pField->GetFieldProtection(), pRC->GetClass()->GetMethodTable(), 0)) {
// Found the first field that matches, so return it
refField = pFields->fields[i].GetFieldInfo(pRC);
// Assign the return value
*((REFLECTBASEREF*) &rv) = refField;
break;
}
}
return rv;
}
LPVOID __stdcall COMClass::MatchField(FieldDesc* pCurField,DWORD cFieldName,
LPUTF8 szFieldName,ReflectClass* pRC,int bindingAttr)
{
_ASSERTE(pCurField);
// Public/Private members
bool addPub = ((bindingAttr & BINDER_Public) != 0);
bool addPriv = ((bindingAttr & BINDER_NonPublic) != 0);
if (pCurField->IsPublic()) {
if (!addPub) return 0;
}
else {
if (!addPriv) return 0;
}
// Check for static instance
bool addStatic = ((bindingAttr & BINDER_Static) != 0);
bool addInst = ((bindingAttr & BINDER_Instance) != 0);
if (pCurField->IsStatic()) {
if (!addStatic) return 0;
}
else {
if (!addInst) return 0;
}
// Get the name of the field
LPCUTF8 pwzCurFieldName = pCurField->GetName();
// If the names do not match, reject field
if(strlen(pwzCurFieldName) != cFieldName)
return 0;
// Case sensitive compare
bool ignoreCase = ((bindingAttr & BINDER_IgnoreCase) != 0);
if (ignoreCase) {
if (_stricmp(pwzCurFieldName, szFieldName) != 0)
return 0;
}
else {
if (memcmp(pwzCurFieldName, szFieldName, cFieldName))
return 0;
}
bool declaredOnly = ((bindingAttr & BINDER_DeclaredOnly) != 0);
if (declaredOnly) {
EEClass* pEEC = pRC->GetClass();
if (pCurField->GetEnclosingClass() != pEEC)
return 0;
}
return pCurField;
}
// GetFields
// This method will return a FieldInfo array of all of the
// fields defined for this Class
LPVOID __stdcall COMClass::GetFields(_GetFieldsArgs* args)
{
LPVOID rv;
THROWSCOMPLUSEXCEPTION();
// Get the class for this object
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
ReflectFieldList* pFields = pRC->GetFields();
PTRARRAYREF refArrFields = g_pRefUtil->CreateClassArray(RC_Field,pRC,pFields,args->bindingAttr, args->bRequiresAccessCheck != 0);
*((PTRARRAYREF*) &rv) = refArrFields;
return rv;
}
// GetEvent
// This method will return the specified event based upon
// the name
LPVOID __stdcall COMClass::GetEvent(_GetEventArgs* args)
{
LPVOID rv;
RefSecContext sCtx;
THROWSCOMPLUSEXCEPTION();
if (args->eventName == NULL)
COMPlusThrowArgumentNull(L"name",L"ArgumentNull_String");
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
// Get the events from the Class
ReflectEventList* pEvents = pRC->GetEvents();
if (pEvents->dwTotal == 0)
return 0;
CQuickBytes bytes;
LPSTR szName;
DWORD cName;
szName = GetClassStringVars(args->eventName, &bytes, &cName);
// The Search modifiers
bool ignoreCase = ((args->bindingAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->bindingAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->bindingAttr & BINDER_Static) != 0);
bool addInst = ((args->bindingAttr & BINDER_Instance) != 0);
bool addPriv = ((args->bindingAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->bindingAttr & BINDER_Public) != 0);
MethodTable *pParentMT = pEEC->GetMethodTable();
// check the events to see if we find one that matches...
ReflectEvent* ev = 0;
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pEvents->dwTotal : pEvents->dwEvents;
for (DWORD i = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicEvent(&pEvents->events[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pEvents->events[i].pDeclCls != pEEC)
continue;
}
// Check fo static instance
if (COMMember::StaticEvent(&pEvents->events[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Check on the name
if (ignoreCase) {
if (_stricmp(pEvents->events[i].szName, szName) != 0)
continue;
}
else {
if (strcmp(pEvents->events[i].szName, szName) != 0)
continue;
}
// Ignore case can cause Ambiguous situations, we need to check for
// these.
if (ev)
COMPlusThrow(kAmbiguousMatchException);
ev = &pEvents->events[i];
if (!ignoreCase)
break;
}
// if we didn't find an event return null
if (!ev)
return 0;
// Found the first method that matches, so return it
REFLECTTOKENBASEREF refMethod = (REFLECTTOKENBASEREF) ev->GetEventInfo(pRC);
// Assign the return value
*((REFLECTTOKENBASEREF*) &rv) = refMethod;
return rv;
}
// GetEvents
// This method will return an array of EventInfo for each of the events
// defined in the class
LPVOID __stdcall COMClass::GetEvents(_GetEventsArgs* args)
{
REFLECTTOKENBASEREF refMethod;
PTRARRAYREF pRet;
LPVOID rv;
HENUMInternal hEnum;
RefSecContext sCtx;
THROWSCOMPLUSEXCEPTION();
// Find the properties
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
// Get the events from the class
ReflectEventList* pEvents = pRC->GetEvents();
if (pEvents->dwTotal == 0) {
pRet = (PTRARRAYREF) AllocateObjectArray(0,g_pRefUtil->GetTrueType(RC_Event));
*((PTRARRAYREF *)&rv) = pRet;
return rv;
}
// The Search modifiers
bool ignoreCase = ((args->bindingAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->bindingAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->bindingAttr & BINDER_Static) != 0);
bool addInst = ((args->bindingAttr & BINDER_Instance) != 0);
bool addPriv = ((args->bindingAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->bindingAttr & BINDER_Public) != 0);
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pEvents->dwTotal : pEvents->dwEvents;
pRet = (PTRARRAYREF) AllocateObjectArray(searchSpace, g_pRefUtil->GetTrueType(RC_Event));
GCPROTECT_BEGIN(pRet);
MethodTable *pParentMT = pEEC->GetMethodTable();
// Loop through all of the Events and see how many match
// the binding flags.
for (ULONG i = 0, pos = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicEvent(&pEvents->events[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pEvents->events[i].pDeclCls != pEEC)
continue;
}
// Check fo static instance
if (COMMember::StaticEvent(&pEvents->events[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
refMethod = (REFLECTTOKENBASEREF) pEvents->events[i].GetEventInfo(pRC);
pRet->SetAt(pos++, (OBJECTREF) refMethod);
}
// Copy to a new array if we didn't fill up the first array
if (i != pos) {
PTRARRAYREF retArray = (PTRARRAYREF) AllocateObjectArray(pos,
g_pRefUtil->GetTrueType(RC_Event));
for(i = 0; i < pos; i++)
retArray->SetAt(i, pRet->GetAt(i));
pRet = retArray;
}
*((PTRARRAYREF *)&rv) = pRet;
GCPROTECT_END();
return rv;
}
// GetProperties
// This method will return an array of Properties for each of the
// properties defined in this class. An empty array is return if
// no properties exist.
LPVOID __stdcall COMClass::GetProperties(_GetPropertiesArgs* args)
{
PTRARRAYREF pRet;
LPVOID rv;
HENUMInternal hEnum;
RefSecContext sCtx;
//@TODO:FILTER
THROWSCOMPLUSEXCEPTION();
// Find the properties
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
// Get the Properties from the Class
ReflectPropertyList* pProps = pRC->GetProperties();
if (pProps->dwTotal == 0) {
pRet = (PTRARRAYREF) AllocateObjectArray(0, g_pRefUtil->GetTrueType(RC_Prop));
*((PTRARRAYREF *)&rv) = pRet;
return rv;
}
// The Search modifiers
bool ignoreCase = ((args->bindingAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->bindingAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->bindingAttr & BINDER_Static) != 0);
bool addInst = ((args->bindingAttr & BINDER_Instance) != 0);
bool addPriv = ((args->bindingAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->bindingAttr & BINDER_Public) != 0);
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pProps->dwTotal : pProps->dwProps;
pRet = (PTRARRAYREF) AllocateObjectArray(searchSpace, g_pRefUtil->GetTrueType(RC_Prop));
GCPROTECT_BEGIN(pRet);
MethodTable *pParentMT = pEEC->GetMethodTable();
for (ULONG i = 0, pos = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicProperty(&pProps->props[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pProps->props[i].pDeclCls != pEEC)
continue;
}
// Check for static instance
if (COMMember::StaticProperty(&pProps->props[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
OBJECTREF o = (OBJECTREF) pProps->props[i].GetPropertyInfo(pRC);
pRet->SetAt(pos++, o);
}
// Copy to a new array if we didn't fill up the first array
if (i != pos) {
PTRARRAYREF retArray = (PTRARRAYREF) AllocateObjectArray(pos,
g_pRefUtil->GetTrueType(RC_Prop));
for(i = 0; i < pos; i++)
retArray->SetAt(i, pRet->GetAt(i));
pRet = retArray;
}
*((PTRARRAYREF *)&rv) = pRet;
GCPROTECT_END();
return rv;
}
void COMClass::GetNameInternal(ReflectClass *pRC, int nameType, CQuickBytes *qb)
{
LPCUTF8 szcName = NULL;
LPCUTF8 szToName;
bool fNameSpace = (nameType & TYPE_NAMESPACE) ? true : false;
bool fAssembly = (nameType & TYPE_ASSEMBLY) ? true : false;
mdTypeDef mdEncl;
IMDInternalImport *pImport;
bool fSetName = false;
THROWSCOMPLUSEXCEPTION();
szToName = _GetName(pRC, fNameSpace && !pRC->IsNested(), qb);
pImport = pRC->GetModule()->GetMDImport();
// Get original element for parameterized type
EEClass *pTypeClass = pRC->GetTypeHandle().GetClassOrTypeParam();
_ASSERTE(pTypeClass);
mdEncl = pTypeClass->GetCl();
// Only look for nesting chain if this is a nested type.
DWORD dwAttr;
pTypeClass->GetMDImport()->GetTypeDefProps(mdEncl, &dwAttr, NULL);
if (fNameSpace && (IsTdNested(dwAttr)))
{ // Build the nesting chain.
while (SUCCEEDED(pImport->GetNestedClassProps(mdEncl, &mdEncl))) {
CQuickBytes qb2;
CQuickBytes qb3;
LPCUTF8 szEnclName;
LPCUTF8 szEnclNameSpace;
pImport->GetNameOfTypeDef(mdEncl,
&szEnclName,
&szEnclNameSpace);
ns::MakePath(qb2, szEnclNameSpace, szEnclName);
ns::MakeNestedTypeName(qb3, (LPCUTF8) qb2.Ptr(), szToName);
// @todo: this should be a SIZE_T
int iLen = (int)strlen((LPCUTF8) qb3.Ptr()) + 1;
if (qb->Alloc(iLen) == NULL)
COMPlusThrowOM();
strncpy((LPUTF8) qb->Ptr(), (LPCUTF8) qb3.Ptr(), iLen);
szToName = (LPCUTF8) qb->Ptr();
fSetName = true;
}
}
if(fAssembly) {
CQuickBytes qb2;
Assembly* pAssembly = pRC->GetTypeHandle().GetAssembly();
LPCWSTR pAssemblyName;
if(SUCCEEDED(pAssembly->GetFullName(&pAssemblyName))) {
#define MAKE_TRANSLATIONFAILED COMPlusThrow(kArgumentException, L"Argument_InvalidAssemblyName");
MAKE_WIDEPTR_FROMUTF8(wName, szToName);
ns::MakeAssemblyQualifiedName(qb2, wName, pAssemblyName);
MAKE_UTF8PTR_FROMWIDE(szQualName, (LPWSTR)qb2.Ptr());
#undef MAKE_TRANSLATIONFAILED
// @todo: this should be a SIZE_T
int iLen = (int)strlen(szQualName) + 1;
if (qb->Alloc(iLen) == NULL)
COMPlusThrowOM();
strncpy((LPUTF8) qb->Ptr(), szQualName, iLen);
fSetName = true;
}
}
// In some cases above, we have written the Type name into the QuickBytes pointer already.
// Make sure we don't call qb.Alloc then, which will free that memory, allocate new memory
// then try using the freed memory.
if (!fSetName && qb->Ptr() != (void*)szToName) {
int iLen = (int)strlen(szToName) + 1;
if (qb->Alloc(iLen) == NULL)
COMPlusThrowOM();
strncpy((LPUTF8) qb->Ptr(), szToName, iLen);
}
}
LPCUTF8 COMClass::_GetName(ReflectClass* pRC, BOOL fNameSpace, CQuickBytes *qb)
{
THROWSCOMPLUSEXCEPTION();
LPCUTF8 szcNameSpace;
LPCUTF8 szToName;
LPCUTF8 szcName;
// Convert the name to a string
pRC->GetName(&szcName, (fNameSpace) ? &szcNameSpace : NULL);
if(!szcName) {
_ASSERTE(!"Unable to get Name of Class");
FATAL_EE_ERROR();
}
// Construct the fully qualified name
if (fNameSpace && szcNameSpace && *szcNameSpace)
{
ns::MakePath(*qb, szcNameSpace, szcName);
szToName = (LPCUTF8) qb->Ptr();
}
//this else part should be removed
else
{
// This is a bit of a hack. For Arrays we really only have a single
// name which is fully qualified. We need to remove the full qualification
if (pRC->IsArray() && !fNameSpace) {
szToName = ns::FindSep(szcName);
if (szToName)
++szToName;
else
szToName = szcName;
}
else
szToName = szcName;
}
return szToName;
}
/*
// helper function to get the full name of a nested class
void GetNestedClassMangledName(IMDInternalImport *pImport,
mdTypeDef mdClsToken,
CQuickBytes *qbName,
LPCUTF8* szcNamespace)
{
mdTypeDef mdEncl;
LPCUTF8 pClassName;
if (SUCCEEDED(pImport->GetNestedClassProps(mdClsToken, &mdEncl))) {
LPCUTF8 pNamespace;
GetNestedClassMangledName(pImport, mdEncl, qbName, szcNamespace);
pImport->GetNameOfTypeDef(mdClsToken, &pClassName, &pNamespace);
size_t size = qbName->Size();
qbName->Resize(size + 2 + strlen((LPCSTR)pClassName));
((LPCSTR)qbName->Ptr())[size] = NESTED_SEPARATOR_CHAR;
strcpy((LPCSTR)qbName->Ptr() + size + 1, (LPCSTR)pClassName);
}
else {
pImport->GetNameOfTypeDef(mdEncl, &pClassName, szNamespace);
qbName->Resize(strlen((LPCSTR)pClassName) + 1);
strcpy((LPCSTR)qbName->Ptr(), (LPCSTR)pClassName);
}
}
*/
// _GetName
// If the bFullName is true, the fully qualified class name is returned
// otherwise just the class name is returned.
LPVOID COMClass::_GetName(_GETNAMEARGS* args, int nameType)
{
LPVOID rv = NULL; // Return value
STRINGREF refName;
CQuickBytes qb;
THROWSCOMPLUSEXCEPTION();
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
GetNameInternal(pRC, nameType, &qb);
refName = COMString::NewString((LPUTF8)qb.Ptr());
*((STRINGREF *)&rv) = refName;
return rv;
}
// GetClassHandle
// This method with return a unique ID meaningful to the EE and equivalent to
// the result of the ldtoken instruction.
void* __stdcall COMClass::GetClassHandle(_GETCLASSHANDLEARGS* args)
{
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
if (pRC->IsArray()) {
ReflectArrayClass* pRAC = (ReflectArrayClass*) pRC;
TypeHandle ret = pRAC->GetTypeHandle();
return ret.AsPtr();
}
if (pRC->IsTypeDesc()) {
ReflectTypeDescClass* pRTD = (ReflectTypeDescClass*) pRC;
TypeHandle ret = pRTD->GetTypeHandle();
return ret.AsPtr();
}
return pRC->GetClass()->GetMethodTable();
}
// GetClassFromHandle
// This method with return a unique ID meaningful to the EE and equivalent to
// the result of the ldtoken instruction.
FCIMPL1(Object*, COMClass::GetClassFromHandle, LPVOID handle) {
Object* retVal;
if (handle == 0)
FCThrowArgumentEx(kArgumentException, NULL, L"InvalidOperation_HandleIsNotInitialized");
//
// Get the TypeHandle from our handle and convert that to an EEClass.
//
TypeHandle typeHnd(handle);
if (!typeHnd.IsTypeDesc()) {
EEClass *pClass = typeHnd.GetClass();
//
// If we got an EEClass, check to see if we've already allocated
// a type object for it. If we have, then simply return that one
// and don't build a method frame.
//
if (pClass) {
OBJECTREF o = pClass->GetExistingExposedClassObject();
if (o != NULL) {
return (OBJECTREFToObject(o));
}
}
}
//
// We haven't already created the type object. Create the helper
// method frame (we're going to be allocating an object) and call
// the helper to create the object
//
HELPER_METHOD_FRAME_BEGIN_RET_0();
retVal = OBJECTREFToObject(typeHnd.CreateClassObj());
HELPER_METHOD_FRAME_END();
return retVal;
}
FCIMPLEND
// This method triggers the class constructor for a give type
FCIMPL1(void, COMClass::RunClassConstructor, LPVOID handle)
{
if (handle == NULL)
FCThrowArgumentVoidEx(kArgumentException, NULL, L"InvalidOperation_HandleIsNotInitialized");
TypeHandle typeHnd(handle);
Assembly *pAssem = typeHnd.GetAssembly();
if (!pAssem->IsDynamic() || pAssem->HasRunAccess())
{
if (typeHnd.IsUnsharedMT())
{
MethodTable *pMT = typeHnd.AsMethodTable();
if (pMT->IsClassInited())
return;
if (pMT->IsShared())
{
DomainLocalBlock *pLocalBlock = GetAppDomain()->GetDomainLocalBlock();
if (pLocalBlock->IsClassInitialized(pMT->GetSharedClassIndex()))
return;
}
OBJECTREF pThrowable = NULL;
HELPER_METHOD_FRAME_BEGIN_1(pThrowable);
if (!pMT->CheckRunClassInit(&pThrowable))
{
THROWSCOMPLUSEXCEPTION();
COMPlusThrow(pThrowable);
}
HELPER_METHOD_FRAME_END();
}
}
else
{
HELPER_METHOD_FRAME_BEGIN_0();
THROWSCOMPLUSEXCEPTION();
COMPlusThrow(kNotSupportedException, L"NotSupported_DynamicAssemblyNoRunAccess");
HELPER_METHOD_FRAME_END();
}
}
FCIMPLEND
INT32 __stdcall COMClass::InternalIsPrimitive(REFLECTCLASSBASEREF args)
{
ReflectClass* pRC = (ReflectClass*) args->GetData();
_ASSERTE(pRC);
CorElementType type = pRC->GetCorElementType();
return (InvokeUtil::IsPrimitiveType(type)) ? 1 : 0;
}
// GetProperName
// This method returns the fully qualified name of any type. In other
// words, it now does the same thing as GetFullName() below.
LPVOID __stdcall COMClass::GetProperName(_GETNAMEARGS* args)
{
return _GetName(args, TYPE_NAME | TYPE_NAMESPACE);
}
// GetName
// This method returns the unqualified name of a primitive as a String
LPVOID __stdcall COMClass::GetName(_GETNAMEARGS* args)
{
return _GetName(args, TYPE_NAME);
}
// GetFullyName
// This will return the fully qualified name of the class as a String.
LPVOID __stdcall COMClass::GetFullName(_GETNAMEARGS* args)
{
return _GetName(args, TYPE_NAME | TYPE_NAMESPACE);
}
// GetAssemblyQualifiedyName
// This will return the assembly qualified name of the class as a String.
LPVOID __stdcall COMClass::GetAssemblyQualifiedName(_GETNAMEARGS* args)
{
return _GetName(args, TYPE_NAME | TYPE_NAMESPACE | TYPE_ASSEMBLY);
}
// GetNameSpace
// This will return the name space of a class as a String.
LPVOID __stdcall COMClass::GetNameSpace(_GETNAMEARGS* args)
{
LPVOID rv = NULL; // Return value
LPCUTF8 szcName;
LPCUTF8 szcNameSpace;
STRINGREF refName = NULL;
THROWSCOMPLUSEXCEPTION();
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// Convert the name to a string
pRC->GetName(&szcName, &szcNameSpace);
if(!szcName) {
_ASSERTE(!"Unable to get Name of Class");
FATAL_EE_ERROR();
}
if(szcNameSpace && *szcNameSpace) {
// Create the string object
refName = COMString::NewString(szcNameSpace);
}
else {
if (pRC->IsNested()) {
if (pRC->IsArray() || pRC->IsTypeDesc()) {
EEClass *pTypeClass = pRC->GetTypeHandle().GetClassOrTypeParam();
_ASSERTE(pTypeClass);
mdTypeDef mdEncl = pTypeClass->GetCl();
IMDInternalImport *pImport = pTypeClass->GetMDImport();
// Only look for nesting chain if this is a nested type.
DWORD dwAttr = 0;
pImport->GetTypeDefProps(mdEncl, &dwAttr, NULL);
if (IsTdNested(dwAttr))
{ // Get to the outermost class
while (SUCCEEDED(pImport->GetNestedClassProps(mdEncl, &mdEncl)));
pImport->GetNameOfTypeDef(mdEncl, &szcName, &szcNameSpace);
}
}
}
else {
if (pRC->IsArray()) {
int len = (int)strlen(szcName);
const char* p = (len == 0) ? szcName : (szcName + len - 1);
while (p != szcName && *p != '.') p--;
if (p != szcName) {
len = (int)(p - szcName); // @TODO LBS - pointer math
char *copy = (char*) _alloca(len + 1);
strncpy(copy,szcName,len);
copy[len] = 0;
szcNameSpace = copy;
}
}
}
}
if(szcNameSpace && *szcNameSpace) {
// Create the string object
refName = COMString::NewString(szcNameSpace);
}
*((STRINGREF *)&rv) = refName;
return rv;
}
// GetGUID
// This method will return the version-independent GUID for the Class. This is
// a CLSID for a class and an IID for an Interface.
void __stdcall COMClass::GetGUID(_GetGUIDArgs* args)
{
EEClass* pVMC;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
pVMC = pRC->GetClass();
THROWSCOMPLUSEXCEPTION();
if (args->retRef == NULL)
COMPlusThrow(kNullReferenceException);
if (args->refThis->IsComObjectClass()) {
ComClassFactory* pComClsFac = (ComClassFactory*) pRC->GetCOMObject();
if (pComClsFac)
memcpy(args->retRef,&pComClsFac->m_rclsid,sizeof(GUID));
else
memset(args->retRef,0,sizeof(GUID));
return;
}
if (pRC->IsArray() || pRC->IsTypeDesc()) {
memset(args->retRef,0,sizeof(GUID));
return;
}
//@TODO: How do we want to abstract this?
_ASSERTE(pVMC);
GUID guid;
pVMC->GetGuid(&guid, TRUE);
memcpyNoGCRefs(args->retRef, &guid, sizeof(GUID));
}
// GetAttributeFlags
// Return the attributes that are associated with this Class.
FCIMPL1(INT32, COMClass::GetAttributeFlags, ReflectClassBaseObject* refThis) {
VALIDATEOBJECTREF(refThis);
THROWSCOMPLUSEXCEPTION();
DWORD dwAttributes = 0;
BOOL fComClass = FALSE;
ReflectClassBaseObject* reflectThis = NULL;
HELPER_METHOD_FRAME_BEGIN_RET_1(reflectThis);
reflectThis = refThis;
if (reflectThis == NULL)
COMPlusThrow(kNullReferenceException, L"NullReference_This");
fComClass = reflectThis->IsComObjectClass();
if (!fComClass)
{
ReflectClass* pRC = (ReflectClass*) (reflectThis->GetData());
_ASSERTE(pRC);
if (pRC == NULL)
COMPlusThrow(kNullReferenceException);
dwAttributes = pRC->GetAttributes();
}
HELPER_METHOD_FRAME_END();
if (fComClass)
return tdPublic;
return dwAttributes;
}
FCIMPLEND
// IsArray
// This method return true if the Class represents an array.
INT32 __stdcall COMClass::IsArray(_IsArrayArgs* args)
{
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
INT32 ret = pRC->IsArray();
return ret;
}
// Invalidate the cached nested type information
INT32 __stdcall COMClass::InvalidateCachedNestedType(_IsArrayArgs* args)
{
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
pRC->InvalidateCachedNestedTypes();
return 0;
} //InvalidateCachedNestedType
// GetArrayElementType
// This routine will return the base type of a composite type.
// It returns null if it is a plain type
LPVOID __stdcall COMClass::GetArrayElementType(_GetArrayElementTypeArgs* args)
{
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// If this is not an array class then throw an exception
if (pRC->IsArray()) {
// Get the Element type handle and return the Type representing it.
ReflectArrayClass* pRAC = (ReflectArrayClass*) pRC;
ArrayTypeDesc* pArrRef= pRAC->GetTypeHandle().AsArray();
TypeHandle elemType = pRAC->GetElementTypeHandle();
// We can ignore the possible null return because this will not fail
return(OBJECTREFToObject(elemType.CreateClassObj()));
}
if (pRC->IsTypeDesc()) {
ReflectTypeDescClass* pRTD = (ReflectTypeDescClass*) pRC;
TypeDesc* td = pRC->GetTypeHandle().AsTypeDesc();
TypeHandle th = td->GetTypeParam();
// We can ignore the possible null return because this will not fail
return(OBJECTREFToObject(th.CreateClassObj()));
}
return 0;
}
// InternalGetArrayRank
// This routine will return the rank of an array assuming the Class represents an array.
INT32 __stdcall COMClass::InternalGetArrayRank(_InternalGetArrayRankArgs* args)
{
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
_ASSERTE( pRC->IsArray() );
ReflectArrayClass* pRAC = (ReflectArrayClass*) pRC;
return pRAC->GetTypeHandle().AsArray()->GetRank();
}
//CanCastTo
//Check to see if we can cast from one runtime type to another.
FCIMPL2(INT32, COMClass::CanCastTo, ReflectClassBaseObject* refFrom, ReflectClassBaseObject *refTo)
{
VALIDATEOBJECTREF(refFrom);
VALIDATEOBJECTREF(refTo);
if (refFrom->GetMethodTable() != g_pRefUtil->GetClass(RC_Class) ||
refTo->GetMethodTable() != g_pRefUtil->GetClass(RC_Class))
FCThrow(kArgumentException);
// Find the properties
ReflectClass* pRC = (ReflectClass*) refTo->GetData();
TypeHandle toTH = pRC->GetTypeHandle();
pRC = (ReflectClass*) refFrom->GetData();
TypeHandle fromTH = pRC->GetTypeHandle();
return fromTH.CanCastTo(toTH) ? 1 : 0;
}
FCIMPLEND
// InvokeDispMethod
// This method will be called on a COM Classic object and simply calls
// the interop IDispatch method
LPVOID __stdcall COMClass::InvokeDispMethod(_InvokeDispMethodArgs* args)
{
_ASSERTE(args->target != NULL);
_ASSERTE(args->target->GetMethodTable()->IsComObjectType());
// Unless security is turned off, we need to validate that the calling code
// has unmanaged code access privilege.
if (!Security::IsSecurityOff())
COMCodeAccessSecurityEngine::SpecialDemand(SECURITY_UNMANAGED_CODE);
int flags = 0;
if (args->invokeAttr & BINDER_InvokeMethod)
flags |= DISPATCH_METHOD;
if (args->invokeAttr & BINDER_GetProperty)
flags |= DISPATCH_PROPERTYGET;
if (args->invokeAttr & BINDER_SetProperty)
flags = DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF;
if (args->invokeAttr & BINDER_PutDispProperty)
flags = DISPATCH_PROPERTYPUT;
if (args->invokeAttr & BINDER_PutRefDispProperty)
flags = DISPATCH_PROPERTYPUTREF;
if (args->invokeAttr & BINDER_CreateInstance)
flags = DISPATCH_CONSTRUCT;
LPVOID RetVal = NULL;
OBJECTREF RetObj = NULL;
GCPROTECT_BEGIN(RetObj)
{
IUInvokeDispMethod((OBJECTREF *)&args->refThis,
&args->target,
(OBJECTREF*)&args->name,
NULL,
(OBJECTREF*)&args->args,
(OBJECTREF*)&args->byrefModifiers,
(OBJECTREF*)&args->namedParameters,
&RetObj,
args->lcid,
flags,
args->invokeAttr & BINDER_IgnoreReturn,
args->invokeAttr & BINDER_IgnoreCase);
*((OBJECTREF *)&RetVal) = RetObj;
}
GCPROTECT_END();
return RetVal;
}
// IsPrimitive
// This method return true if the Class represents primitive type
FCIMPL1(INT32, COMClass::IsPrimitive, ReflectClassBaseObject* refThis) {
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
CorElementType type = pRC->GetCorElementType();
if (type == ELEMENT_TYPE_I && !pRC->GetClass()->IsTruePrimitive())
return 0;
return (InvokeUtil::IsPrimitiveType(type)) ? 1 : 0;
}
FCIMPLEND
// IsCOMObject
// This method return true if the Class represents COM Classic Object
FCIMPL1(INT32, COMClass::IsCOMObject, ReflectClassBaseObject* refThis) {
VALIDATEOBJECTREF(refThis);
return (refThis->IsComWrapperClass()) ? 1 : 0;
}
FCIMPLEND
// IsGenericCOMObject
FCIMPL1(INT32, COMClass::IsGenericCOMObject, ReflectClassBaseObject* refThis) {
VALIDATEOBJECTREF(refThis);
BOOL isComObject;
HELPER_METHOD_FRAME_BEGIN_RET_NOPOLL(); // NOPOLL so that we dont need to protect refThis
isComObject = refThis->IsComObjectClass();
HELPER_METHOD_FRAME_END_POLL();
return isComObject;
}
FCIMPLEND
// GetClass
// This is a static method defined on Class that will get a named class.
// The name of the class is passed in by string. The class name may be
// either case sensitive or not. This currently causes the class to be loaded
// because it goes through the class loader.
// You get here from Type.GetType(typename)
// ECALL frame is used to find the caller
LPVOID __stdcall COMClass::GetClass1Arg(_GetClass1Args* args)
{
THROWSCOMPLUSEXCEPTION();
return GetClassInner(&args->className, false, false, NULL, NULL, true, false);
}
// You get here from Type.GetType(typename, bThowOnError)
// ECALL frame is used to find the caller
LPVOID __stdcall COMClass::GetClass2Args(_GetClass2Args* args)
{
THROWSCOMPLUSEXCEPTION();
return GetClassInner(&args->className, args->bThrowOnError,
false, NULL, NULL, true, false);
}
// You get here from Type.GetType(typename, bThowOnError, bIgnoreCase)
// ECALL frame is used to find the caller
LPVOID __stdcall COMClass::GetClass3Args(_GetClass3Args* args)
{
THROWSCOMPLUSEXCEPTION();
return GetClassInner(&args->className, args->bThrowOnError,
args->bIgnoreCase, NULL, NULL, true, false);
}
// Called internally by mscorlib. No security checking performed.
LPVOID __stdcall COMClass::GetClassInternal(_GetClassInternalArgs* args)
{
THROWSCOMPLUSEXCEPTION();
return GetClassInner(&args->className, args->bThrowOnError,
args->bIgnoreCase, NULL, NULL, false, args->bPublicOnly);
}
// You get here if some BCL method calls RuntimeType.GetTypeImpl. In this case we cannot
// use the ECALL frame to find the caller, as it'll point to mscorlib ! In this case we use stackwalk/stackmark
// to find the caller
LPVOID __stdcall COMClass::GetClass(_GetClassArgs* args)
{
THROWSCOMPLUSEXCEPTION();
BOOL *fResult = NULL;
if (*args->pbAssemblyIsLoading) {
*args->pbAssemblyIsLoading = FALSE;
fResult = args->pbAssemblyIsLoading;
}
return GetClassInner(&args->className, args->bThrowOnError,
args->bIgnoreCase, args->stackMark,
fResult, true, false);
}
LPVOID COMClass::GetClassInner(STRINGREF *refClassName,
BOOL bThrowOnError,
BOOL bIgnoreCase,
StackCrawlMark *stackMark,
BOOL *pbAssemblyIsLoading,
BOOL bVerifyAccess,
BOOL bPublicOnly)
{
THROWSCOMPLUSEXCEPTION();
STRINGREF sRef = *refClassName;
if (!sRef)
COMPlusThrowArgumentNull(L"className",L"ArgumentNull_String");
DWORD strLen = sRef->GetStringLength() + 1;
LPUTF8 szFullClassName = (LPUTF8)_alloca(strLen);
CQuickBytes bytes;
DWORD cClassName;
// Get the class name in UTF8
if (!COMString::TryConvertStringDataToUTF8(sRef, szFullClassName, strLen))
szFullClassName = GetClassStringVars(sRef, &bytes, &cClassName);
HRESULT hr;
LPUTF8 assembly;
LPUTF8 szNameSpaceSep;
if (FAILED(hr = AssemblyNative::FindAssemblyName(szFullClassName,
&assembly,
&szNameSpaceSep)))
COMPlusThrowHR(hr);
EEClass *pCallersClass = NULL;
Assembly *pCallersAssembly = NULL;
void *returnIP = NULL;
BOOL fCheckedPerm = FALSE;
if (bVerifyAccess || (assembly && *assembly)) {
// Find the return address. This can be used to find caller's assembly.
// If we're not checking security, the caller is always mscorlib.
Frame *pFrame = GetThread()->GetFrame();
_ASSERTE(pFrame->IsFramedMethodFrame());
returnIP = pFrame->GetReturnAddress();
if (!bVerifyAccess)
fCheckedPerm = TRUE;
} else {
pCallersAssembly = SystemDomain::SystemAssembly();
fCheckedPerm = TRUE;
}
LOG((LF_CLASSLOADER,
LL_INFO100,
"Get class %s through reflection\n",
szFullClassName));
Assembly* pAssembly = NULL;
TypeHandle typeHnd;
NameHandle typeName;
char noNameSpace = '\0';
if (szNameSpaceSep) {
*szNameSpaceSep = '\0';
typeName.SetName(szFullClassName, szNameSpaceSep+1);
}
else
typeName.SetName(&noNameSpace, szFullClassName);
if(bIgnoreCase)
typeName.SetCaseInsensitive();
OBJECTREF Throwable = NULL;
GCPROTECT_BEGIN(Throwable);
if(assembly && *assembly) {
AssemblySpec spec;
hr = spec.Init(assembly);
if (SUCCEEDED(hr)) {
pCallersClass = GetCallersClass(stackMark, returnIP);
pCallersAssembly = (pCallersClass) ? pCallersClass->GetAssembly() : NULL;
if (pCallersAssembly && (!pCallersAssembly->IsShared()))
spec.GetCodeBase()->SetParentAssembly(pCallersAssembly->GetFusionAssembly());
hr = spec.LoadAssembly(&pAssembly, &Throwable, false, (pbAssemblyIsLoading != NULL));
if(SUCCEEDED(hr)) {
typeHnd = pAssembly->FindNestedTypeHandle(&typeName, &Throwable);
if (typeHnd.IsNull() && (Throwable == NULL))
// If it wasn't in the available table, maybe it's an internal type
typeHnd = pAssembly->GetInternalType(&typeName, bThrowOnError, &Throwable);
}
else if (pbAssemblyIsLoading &&
(hr == MSEE_E_ASSEMBLYLOADINPROGRESS))
*pbAssemblyIsLoading = TRUE;
}
}
else {
// Look for type in caller's assembly
if (pCallersAssembly == NULL) {
pCallersClass = GetCallersClass(stackMark, returnIP);
pCallersAssembly = (pCallersClass) ? pCallersClass->GetAssembly() : NULL;
}
if (pCallersAssembly) {
typeHnd = pCallersAssembly->FindNestedTypeHandle(&typeName, &Throwable);
if (typeHnd.IsNull() && (Throwable == NULL))
// If it wasn't in the available table, maybe it's an internal type
typeHnd = pCallersAssembly->GetInternalType(&typeName, bThrowOnError, &Throwable);
}
// Look for type in system assembly
if (typeHnd.IsNull() && (Throwable == NULL) && (pCallersAssembly != SystemDomain::SystemAssembly()))
typeHnd = SystemDomain::SystemAssembly()->FindNestedTypeHandle(&typeName, &Throwable);
BaseDomain *pDomain = SystemDomain::GetCurrentDomain();
if (typeHnd.IsNull() &&
(pDomain != SystemDomain::System())) {
if (szNameSpaceSep)
*szNameSpaceSep = NAMESPACE_SEPARATOR_CHAR;
if ((pAssembly = ((AppDomain*) pDomain)->RaiseTypeResolveEvent(szFullClassName, &Throwable)) != NULL) {
if (szNameSpaceSep)
*szNameSpaceSep = '\0';
typeHnd = pAssembly->FindNestedTypeHandle(&typeName, &Throwable);
if (typeHnd.IsNull() && (Throwable == NULL)) {
// If it wasn't in the available table, maybe it's an internal type
typeHnd = pAssembly->GetInternalType(&typeName, bThrowOnError, &Throwable);
}
else
Throwable = NULL;
}
}
if (!typeHnd.IsNull())
pAssembly = typeHnd.GetAssembly();
}
if (Throwable != NULL && bThrowOnError)
COMPlusThrow(Throwable);
GCPROTECT_END();
BOOL fVisible = TRUE;
if (!typeHnd.IsNull() && !fCheckedPerm && bVerifyAccess) {
// verify visibility
EEClass *pClass = typeHnd.GetClassOrTypeParam();
if (bPublicOnly && !(IsTdPublic(pClass->GetProtection()) || IsTdNestedPublic(pClass->GetProtection())))
// the user is asking for a public class but the class we have is not public, discard
fVisible = FALSE;
else {
// if the class is a top level public there is no check to perform
if (!IsTdPublic(pClass->GetProtection())) {
if (!pCallersAssembly) {
pCallersClass = GetCallersClass(stackMark, returnIP);
pCallersAssembly = (pCallersClass) ? pCallersClass->GetAssembly() : NULL;
}
if (pCallersAssembly && // full trust for interop
!ClassLoader::CanAccess(pCallersClass,
pCallersAssembly,
pClass,
pClass->GetAssembly(),
pClass->GetAttrClass())) {
// This is not legal if the user doesn't have reflection permission
if (!AssemblyNative::HaveReflectionPermission(bThrowOnError))
fVisible = FALSE;
}
}
}
}
if ((!typeHnd.IsNull()) && fVisible)
return(OBJECTREFToObject(typeHnd.CreateClassObj()));
if (bThrowOnError) {
Throwable = NULL;
GCPROTECT_BEGIN(Throwable);
if (szNameSpaceSep)
*szNameSpaceSep = NAMESPACE_SEPARATOR_CHAR;
if (assembly && *assembly) {
#define MAKE_TRANSLATIONFAILED pwzAssemblyName=L""
MAKE_WIDEPTR_FROMUTF8_FORPRINT(pwzAssemblyName, assembly);
#undef MAKE_TRANSLATIONFAILED
PostTypeLoadException(NULL, szFullClassName, pwzAssemblyName,
NULL, IDS_CLASSLOAD_GENERIC, &Throwable);
}
else if (pCallersAssembly ||
(pCallersAssembly = GetCallersAssembly(stackMark, returnIP)) != NULL)
pCallersAssembly->PostTypeLoadException(szFullClassName,
IDS_CLASSLOAD_GENERIC,
&Throwable);
else {
WCHAR wszTemplate[30];
if (FAILED(LoadStringRC(IDS_EE_NAME_UNKNOWN,
wszTemplate,
sizeof(wszTemplate)/sizeof(wszTemplate[0]),
FALSE)))
wszTemplate[0] = L'\0';
PostTypeLoadException(NULL, szFullClassName, wszTemplate,
NULL, IDS_CLASSLOAD_GENERIC, &Throwable);
}
COMPlusThrow(Throwable);
GCPROTECT_END();
}
return NULL;
}
// GetClassFromProgID
// This method will return a Class object for a COM Classic object based
// upon its ProgID. The COM Classic object is found and a wrapper object created
LPVOID __stdcall COMClass::GetClassFromProgID(_GetClassFromProgIDArgs* args)
{
THROWSCOMPLUSEXCEPTION();
LPVOID rv = NULL;
REFLECTCLASSBASEREF refClass = NULL;
GCPROTECT_BEGIN(refClass)
{
// Make sure a prog id was provided
if (args->className == NULL)
COMPlusThrowArgumentNull(L"progID",L"ArgumentNull_String");
GetRuntimeType();
COMPLUS_TRY
{
// NOTE: this call enables GC
ComClassFactory::GetComClassFromProgID(args->className, args->server, (OBJECTREF*) &refClass);
}
COMPLUS_CATCH
{
if (args->bThrowOnError)
COMPlusRareRethrow();
}
COMPLUS_END_CATCH
// Set the return value
*((REFLECTCLASSBASEREF *)&rv) = refClass;
}
GCPROTECT_END();
return rv;
}
// GetClassFromCLSID
// This method will return a Class object for a COM Classic object based
// upon its ProgID. The COM Classic object is found and a wrapper object created
LPVOID __stdcall COMClass::GetClassFromCLSID(_GetClassFromCLSIDArgs* args)
{
THROWSCOMPLUSEXCEPTION();
LPVOID rv = NULL;
REFLECTCLASSBASEREF refClass = NULL;
GCPROTECT_BEGIN(refClass)
{
GetRuntimeType();
COMPLUS_TRY
{
// NOTE: this call enables GC
ComClassFactory::GetComClassFromCLSID(args->clsid, args->server, (OBJECTREF*) &refClass);
}
COMPLUS_CATCH
{
if (args->bThrowOnError)
COMPlusRareRethrow();
}
COMPLUS_END_CATCH
// Set the return value
*((REFLECTCLASSBASEREF *)&rv) = refClass;
}
GCPROTECT_END();
return rv;
}
// GetSuperclass
// This method returns the Class Object representing the super class of this
// Class. If there is not super class then we return null.
LPVOID __stdcall COMClass::GetSuperclass(_GETSUPERCLASSARGS* args)
{
THROWSCOMPLUSEXCEPTION();
// The the EEClass for this class (This must exist)
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
EEClass* pEEC = pRC->GetClass();
if (pEEC) {
if (pEEC->IsInterface())
return 0;
}
TypeHandle typeHnd = pRC->GetTypeHandle();
if (typeHnd.IsNull())
return 0;
TypeHandle parentType = typeHnd.GetParent();
REFLECTCLASSBASEREF refClass = 0;
// We can ignore the Null return because Transparent proxy if final...
if (!parentType.IsNull())
refClass = (REFLECTCLASSBASEREF) parentType.CreateClassObj();
return OBJECTREFToObject(refClass);
}
// GetInterfaces
// This routine returns a Class[] containing all of the interfaces implemented
// by this Class. If the class implements no interfaces an array of length
// zero is returned.
LPVOID __stdcall COMClass::GetInterfaces(_GetInterfacesArgs* args)
{
PTRARRAYREF refArrIFace;
LPVOID rv;
DWORD i;
THROWSCOMPLUSEXCEPTION();
//@TODO: Abstract this away.
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
EEClass* pVMC = pRC->GetClass();
if (pVMC == 0) {
_ASSERTE(pRC->IsTypeDesc());
refArrIFace = (PTRARRAYREF) AllocateObjectArray(0,
g_pRefUtil->GetTrueType(RC_Class));
*((PTRARRAYREF *)&rv) = refArrIFace;
_ASSERTE(rv);
return rv;
}
_ASSERTE(pVMC);
// Allocate the COM+ array
refArrIFace = (PTRARRAYREF) AllocateObjectArray(
pVMC->GetNumInterfaces(), g_pRefUtil->GetTrueType(RC_Class));
GCPROTECT_BEGIN(refArrIFace);
// Create interface array
for(i = 0; i < pVMC->GetNumInterfaces(); i++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = pVMC->GetInterfaceMap()[i].m_pMethodTable->GetClass()->GetExposedClassObject();
refArrIFace->SetAt(i, o);
_ASSERTE(refArrIFace->m_Array[i]);
}
// Set the return value
*((PTRARRAYREF *)&rv) = refArrIFace;
GCPROTECT_END();
_ASSERTE(rv);
return rv;
}
// GetInterface
// This method returns the interface based upon the name of the method.
//@TODO: Fully qualified namespaces and ambiguous use of partial qualification
LPVOID __stdcall COMClass::GetInterface(_GetInterfaceArgs* args)
{
REFLECTCLASSBASEREF refIFace;
LPUTF8 pszIFaceName;
LPUTF8 pszIFaceNameSpace;
LPCUTF8 pszcCurIFaceName;
LPCUTF8 pszcCurIFaceNameSpace;
DWORD cIFaceName;
DWORD dwNumIFaces;
LPVOID rv = NULL;
EEClass** rgpVMCIFaces;
EEClass* pVMCCurIFace = NULL;
DWORD i;
THROWSCOMPLUSEXCEPTION();
if (args->interfaceName == NULL)
COMPlusThrow(kNullReferenceException);
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
if (pRC->IsTypeDesc())
return NULL;
EEClass* pVMC = pRC->GetClass();
_ASSERTE(pVMC);
CQuickBytes bytes;
// Get the class name in UTF8
pszIFaceNameSpace = GetClassStringVars((STRINGREF) args->interfaceName,
&bytes, &cIFaceName);
ns::SplitInline(pszIFaceNameSpace, pszIFaceNameSpace, pszIFaceName);
// Get the array of interfaces
dwNumIFaces = ReflectInterfaces::GetMaxCount(pVMC, false);
if(dwNumIFaces)
{
rgpVMCIFaces = (EEClass**) _alloca(dwNumIFaces * sizeof(EEClass*));
dwNumIFaces = ReflectInterfaces::GetInterfaces(pVMC, rgpVMCIFaces, false);
}
else
rgpVMCIFaces = NULL;
// Look for a matching interface
for(i = 0; i < dwNumIFaces; i++)
{
// Get an interface's EEClass
pVMCCurIFace = rgpVMCIFaces[i];
_ASSERTE(pVMCCurIFace);
//@TODO: we need to verify this still works.
// Convert the name to a string
pVMCCurIFace->GetMDImport()->GetNameOfTypeDef(pVMCCurIFace->GetCl(),
&pszcCurIFaceName, &pszcCurIFaceNameSpace);
_ASSERTE(pszcCurIFaceName);
if(pszIFaceNameSpace &&
strcmp(pszIFaceNameSpace, pszcCurIFaceNameSpace))
continue;
// If the names are a match, break
if(!args->bIgnoreCase)
{
if(!strcmp(pszIFaceName, pszcCurIFaceName))
break;
}
else
if(!_stricmp(pszIFaceName, pszcCurIFaceName))
break;
}
// If we found an interface then lets save it
if (i != dwNumIFaces)
{
refIFace = (REFLECTCLASSBASEREF) pVMCCurIFace->GetExposedClassObject();
_ASSERTE(refIFace);
*((REFLECTCLASSBASEREF *)&rv) = refIFace;
}
return rv;
}
// GetMembers
// This method returns an array of Members containing all of the members
// defined for the class. Members include constructors, events, properties,
// methods and fields.
LPVOID __stdcall COMClass::GetMembers(_GetMembersArgs* args)
{
DWORD dwMembers;
DWORD dwCur;
PTRARRAYREF pMembers;
LPVOID rv;
RefSecContext sCtx;
THROWSCOMPLUSEXCEPTION();
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
COMMember::GetMemberInfo();
_ASSERTE(COMMember::m_pMTIMember);
EEClass* pEEC = pRC->GetClass();
if (pEEC == NULL){
*((OBJECTREF*) &rv) = AllocateObjectArray(0, COMMember::m_pMTIMember->m_pEEClass->GetMethodTable());
return rv;
}
// The Search modifiers
bool ignoreCase = ((args->bindingAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->bindingAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->bindingAttr & BINDER_Static) != 0);
bool addInst = ((args->bindingAttr & BINDER_Instance) != 0);
bool addPriv = ((args->bindingAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->bindingAttr & BINDER_Public) != 0);
// The member list...
ReflectMethodList* pMeths = pRC->GetMethods();
ReflectMethodList* pCons = pRC->GetConstructors();
ReflectFieldList* pFlds = pRC->GetFields();
ReflectPropertyList *pProps = pRC->GetProperties();
ReflectEventList *pEvents = pRC->GetEvents();
ReflectTypeList* pNests = pRC->GetNestedTypes();
// We adjust the total number of members.
dwMembers = pFlds->dwTotal + pMeths->dwTotal + pCons->dwTotal +
pProps->dwTotal + pEvents->dwTotal + pNests->dwTypes;
// Now create an array of IMembers
pMembers = (PTRARRAYREF) AllocateObjectArray(
dwMembers, COMMember::m_pMTIMember->m_pEEClass->GetMethodTable());
GCPROTECT_BEGIN(pMembers);
MethodTable *pParentMT = pEEC->GetMethodTable();
dwCur = 0;
// Fields
if (pFlds->dwTotal) {
// Load all those fields into the Allocated object array
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pFlds->dwTotal : pFlds->dwFields;
for (DWORD i=0;i<searchSpace;i++) {
// Check for access to publics, non-publics
if (pFlds->fields[i].pField->IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pFlds->fields[i].pField->GetFieldProtection(), pParentMT, 0)) continue;
}
// Check for static instance
if (pFlds->fields[i].pField->IsStatic()) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
if (declaredOnly) {
if (pFlds->fields[i].pField->GetEnclosingClass() != pEEC)
continue;
}
// Check for access to non-publics
if (!addPriv && !pFlds->fields[i].pField->IsPublic())
continue;
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pFlds->fields[i].GetFieldInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
// Methods
if (pMeths->dwTotal) {
// Load all those fields into the Allocated object array
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pMeths->dwTotal : pMeths->dwMethods;
for (DWORD i=0;i<searchSpace;i++) {
// Check for access to publics, non-publics
if (pMeths->methods[i].IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pMeths->methods[i].attrs, pParentMT, 0)) continue;
}
// Check for static instance
if (pMeths->methods[i].IsStatic()) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
if (declaredOnly) {
if (pMeths->methods[i].pMethod->GetClass() != pEEC)
continue;
}
// If the method has a linktime security demand attached, check it now.
if (!InvokeUtil::CheckLinktimeDemand(&sCtx, pMeths->methods[i].pMethod, false))
continue;
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pMeths->methods[i].GetMethodInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
// Constructors
if (pCons->dwTotal) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pCons->dwTotal : pCons->dwMethods;
for (DWORD i=0;i<pCons->dwMethods;i++) {
// Check for static .cctors vs. instance .ctors
if (pCons->methods[i].IsStatic()) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Check for access to publics, non-publics
if (pCons->methods[i].IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pCons->methods[i].attrs, pParentMT, 0)) continue;
}
// If the method has a linktime security demand attached, check it now.
if (!InvokeUtil::CheckLinktimeDemand(&sCtx, pCons->methods[i].pMethod, false))
continue;
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pCons->methods[i].GetConstructorInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
//Properties
if (pProps->dwTotal) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pProps->dwTotal : pProps->dwProps;
for (DWORD i = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicProperty(&pProps->props[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pProps->props[i].pDeclCls != pEEC)
continue;
}
// Check for static instance
if (COMMember::StaticProperty(&pProps->props[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pProps->props[i].GetPropertyInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
//Events
if (pEvents->dwTotal) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pEvents->dwTotal : pEvents->dwEvents;
for (DWORD i = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicEvent(&pEvents->events[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pEvents->events[i].pDeclCls != pEEC)
continue;
}
// Check for static instance
if (COMMember::StaticEvent(&pEvents->events[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pEvents->events[i].GetEventInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
//Nested Types
if (pNests->dwTypes) {
for (DWORD i=0;i<pNests->dwTypes;i++) {
// Check for access to publics, non-publics
if (IsTdNestedPublic(pNests->types[i]->GetAttrClass())) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
}
if (!InvokeUtil::CheckAccessType(&sCtx, pNests->types[i], 0)) continue;
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pNests->types[i]->GetExposedClassObject();
pMembers->SetAt(dwCur++, o);
}
}
_ASSERTE(dwCur <= dwMembers);
if (dwCur != dwMembers) {
PTRARRAYREF retArray = (PTRARRAYREF) AllocateObjectArray(
dwCur, COMMember::m_pMTIMember->m_pEEClass->GetMethodTable());
//@TODO: Use an array copy
for(DWORD i = 0; i < (int) dwCur; i++)
retArray->SetAt(i, pMembers->GetAt(i));
pMembers = retArray;
}
// Assign the return value
*((PTRARRAYREF*) &rv) = pMembers;
GCPROTECT_END();
return rv;
}
/*========================GetSerializationRegistryValues========================
**Action:
**Returns:
**Arguments:
**Exceptions:
==============================================================================*/
FCIMPL2(void, COMClass::GetSerializationRegistryValues, BOOL *ignoreBit, BOOL *logNonSerializable) {
*ignoreBit = (g_pConfig->GetConfigDWORD(SERIALIZATION_BIT_KEY, SERIALIZATION_BIT_ZERO));
*logNonSerializable = (g_pConfig->GetConfigDWORD(SERIALIZATION_LOG_KEY, SERIALIZATION_BIT_ZERO));
}
FCIMPLEND
/*============================GetSerializableMembers============================
**Action: Creates an array of all non-static fields and properties
** on a class. Properties are also excluded if they don't have get and set
** methods. Transient fields and properties are excluded based on the value
** of args->bFilterTransient. Essentially, transients are exluded for
** serialization but not for cloning.
**Returns: An array of all of the members that should be serialized.
**Arguments: args->refClass: The class being serialized
** args->bFilterTransient: True if transient members should be excluded.
**Exceptions:
==============================================================================*/
LPVOID __stdcall COMClass::GetSerializableMembers(_GetSerializableMembersArgs* args)
{
DWORD dwMembers;
DWORD dwCur;
PTRARRAYREF pMembers;
LPVOID rv;
mdFieldDef fieldDef;
DWORD dwFlags;
//All security checks should be handled in managed code.
THROWSCOMPLUSEXCEPTION();
if (args->refClass == NULL)
COMPlusThrow(kNullReferenceException);
ReflectClass* pRC = (ReflectClass*) args->refClass->GetData();
_ASSERTE(pRC);
COMMember::GetMemberInfo();
_ASSERTE(COMMember::m_pMTIMember);
ReflectFieldList* pFlds = pRC->GetFields();
dwMembers = pFlds->dwFields;
// Now create an array of IMembers
pMembers = (PTRARRAYREF) AllocateObjectArray(dwMembers, COMMember::m_pMTIMember->m_pEEClass->GetMethodTable());
GCPROTECT_BEGIN(pMembers);
dwCur = 0;
// Fields
if (pFlds->dwFields) {
// Load all those fields into the Allocated object array
for (DWORD i=0;i<pFlds->dwFields;i++) {
//We don't serialize static fields.
if (pFlds->fields[i].pField->IsStatic()) {
continue;
}
//Check for the transient (e.g. don't serialize) bit.
fieldDef = (pFlds->fields[i].pField->GetMemberDef());
dwFlags = (pFlds->fields[i].pField->GetMDImport()->GetFieldDefProps(fieldDef));
if (IsFdNotSerialized(dwFlags)) {
continue;
}
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) pFlds->fields[i].GetFieldInfo(pRC);
pMembers->SetAt(dwCur++, o);
}
}
//We we have extra space in the array, copy before returning.
if (dwCur != dwMembers) {
PTRARRAYREF retArray = (PTRARRAYREF) AllocateObjectArray(
dwCur, COMMember::m_pMTIMember->m_pEEClass->GetMethodTable());
//@TODO: Use an array copy
for(DWORD i = 0; i < (int) dwCur; i++)
retArray->SetAt(i, pMembers->GetAt(i));
pMembers = retArray;
}
// Assign the return value
*((PTRARRAYREF*) &rv) = pMembers;
GCPROTECT_END();
return rv;
}
// GetMember
// This method will return an array of Members which match the name
// passed in. There may be 0 or more matching members.
LPVOID __stdcall COMClass::GetMember(_GetMemberArgs* args)
{
THROWSCOMPLUSEXCEPTION();
ReflectField** rgpFields = NULL;
ReflectMethod** rgpMethods = NULL;
ReflectMethod** rgpCons = NULL;
ReflectProperty** rgpProps = NULL;
ReflectEvent** rgpEvents = NULL;
EEClass** rgpNests = NULL;
DWORD dwNumFields = 0;
DWORD dwNumMethods = 0;
DWORD dwNumCtors = 0;
DWORD dwNumProps = 0;
DWORD dwNumEvents = 0;
DWORD dwNumNests = 0;
DWORD dwNumMembers = 0;
DWORD i;
DWORD dwCurIndex;
bool bIsPrefix = false;
PTRARRAYREF refArrIMembers;
LPVOID rv;
RefSecContext sCtx;
if (args->memberName == 0)
COMPlusThrow(kArgumentNullException, L"ArgumentNull_String");
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
MethodTable *pParentMT = NULL;
if (pEEC)
pParentMT = pEEC->GetMethodTable();
// The Search modifiers
bool bIgnoreCase = ((args->bindingAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((args->bindingAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addStatic = ((args->bindingAttr & BINDER_Static) != 0);
bool addInst = ((args->bindingAttr & BINDER_Instance) != 0);
bool addPriv = ((args->bindingAttr & BINDER_NonPublic) != 0);
bool addPub = ((args->bindingAttr & BINDER_Public) != 0);
CQuickBytes bytes;
LPSTR szMemberName;
DWORD cMemberName;
// Convert the STRINGREF to UTF8
szMemberName = GetClassStringVars((STRINGREF) args->memberName,
&bytes, &cMemberName);
// Check to see if wzPrefix requires an exact match of method names or is just a prefix
if(szMemberName[cMemberName-1] == '*') {
bIsPrefix = true;
szMemberName[--cMemberName] = '\0';
}
// Get the maximums for each member type
// Fields
ReflectFieldList* pFlds = NULL;
if ((args->memberType & MEMTYPE_Field) != 0) {
pFlds = pRC->GetFields();
rgpFields = (ReflectField**) _alloca(pFlds->dwTotal * sizeof(ReflectField*));
}
// Methods
ReflectMethodList* pMeths = NULL;
if ((args->memberType & MEMTYPE_Method) != 0) {
pMeths = pRC->GetMethods();
rgpMethods = (ReflectMethod**) _alloca(pMeths->dwTotal * sizeof(ReflectMethod*));
}
// Properties
ReflectPropertyList *pProps = NULL;
if ((args->memberType & MEMTYPE_Property) != 0) {
pProps = pRC->GetProperties();
rgpProps = (ReflectProperty**) _alloca(pProps->dwTotal * sizeof (ReflectProperty*));
}
// Events
ReflectEventList *pEvents = NULL;
if ((args->memberType & MEMTYPE_Event) != 0) {
pEvents = pRC->GetEvents();
rgpEvents = (ReflectEvent**) _alloca(pEvents->dwTotal * sizeof (ReflectEvent*));
}
// Nested Types
ReflectTypeList* pNests = NULL;
if ((args->memberType & MEMTYPE_NestedType) != 0) {
pNests = pRC->GetNestedTypes();
rgpNests = (EEClass**) _alloca(pNests->dwTypes * sizeof (EEClass*));
}
// Filter the constructors
ReflectMethodList* pCons = 0;
// Check to see if they are looking for the constructors
// @TODO - Fix this to use TOUPPER and compare!
if ((args->memberType & MEMTYPE_Constructor) != 0) {
if((!bIsPrefix && strlen(COR_CTOR_METHOD_NAME) != cMemberName)
|| (!bIgnoreCase && strncmp(COR_CTOR_METHOD_NAME, szMemberName, cMemberName))
|| (bIgnoreCase && _strnicmp(COR_CTOR_METHOD_NAME, szMemberName, cMemberName)))
{
pCons = 0;
}
else {
pCons = pRC->GetConstructors();
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pCons->dwTotal : pCons->dwMethods;
rgpCons = (ReflectMethod**) _alloca(searchSpace * sizeof(ReflectMethod*));
dwNumCtors = 0;
for (i = 0; i < searchSpace; i++) {
// Ignore the class constructor (if one was present)
if (pCons->methods[i].IsStatic())
continue;
// Check for access to non-publics
if (pCons->methods[i].IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pCons->methods[i].attrs, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pCons->methods[i].pMethod->GetClass() != pEEC)
continue;
}
// If the method has a linktime security demand attached, check it now.
if (!InvokeUtil::CheckLinktimeDemand(&sCtx, pCons->methods[i].pMethod, false))
continue;
rgpCons[dwNumCtors++] = &pCons->methods[i];
}
}
// check for the class initializer (We can only be doing either
// the class initializer or a constructor so we are using the
// same set of variables.
// @TODO - Fix this to use TOUPPER and compare!
if((!bIsPrefix && strlen(COR_CCTOR_METHOD_NAME) != cMemberName)
|| (!bIgnoreCase && strncmp(COR_CCTOR_METHOD_NAME, szMemberName, cMemberName))
|| (bIgnoreCase && _strnicmp(COR_CCTOR_METHOD_NAME, szMemberName, cMemberName)))
{
pCons = 0;
}
else {
pCons = pRC->GetConstructors();
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pCons->dwTotal : pCons->dwMethods;
rgpCons = (ReflectMethod**) _alloca(searchSpace * sizeof(ReflectMethod*));
dwNumCtors = 0;
for (i = 0; i < searchSpace; i++) {
// Ignore the normal constructors constructor (if one was present)
if (!pCons->methods[i].IsStatic())
continue;
// Check for access to non-publics
if (pCons->methods[i].IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pCons->methods[i].attrs, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pCons->methods[i].pMethod->GetClass() != pEEC)
continue;
}
// If the method has a linktime security demand attached, check it now.
if (!InvokeUtil::CheckLinktimeDemand(&sCtx, pCons->methods[i].pMethod, false))
continue;
rgpCons[dwNumCtors++] = &pCons->methods[i];
}
}
}
else
dwNumCtors = 0;
// Filter the fields
if ((args->memberType & MEMTYPE_Field) != 0) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pFlds->dwTotal : pFlds->dwFields;
for(i = 0, dwCurIndex = 0; i < searchSpace; i++)
{
// Check for access to publics, non-publics
if (pFlds->fields[i].pField->IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pFlds->fields[i].pField->GetFieldProtection(), pParentMT, 0)) continue;
}
// Check for static instance
if (pFlds->fields[i].pField->IsStatic()) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
if (declaredOnly) {
if (pFlds->fields[i].pField->GetEnclosingClass() != pEEC)
continue;
}
// Get the name of the current field
LPCUTF8 pszCurFieldName = pFlds->fields[i].pField->GetName();
// Check to see that the current field matches the name requirements
if(!bIsPrefix && strlen(pszCurFieldName) != cMemberName)
continue;
// Determine if it passes criteria
if(!bIgnoreCase)
{
if(strncmp(pszCurFieldName, szMemberName, cMemberName))
continue;
}
// @TODO - Fix this to use TOUPPER and compare!
else {
if(_strnicmp(pszCurFieldName, szMemberName, cMemberName))
continue;
}
// Field passed, so save it
rgpFields[dwCurIndex++] = &pFlds->fields[i];
}
dwNumFields = dwCurIndex;
}
else
dwNumFields = 0;
// Filter the methods
if ((args->memberType & MEMTYPE_Method) != 0) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pMeths->dwTotal : pMeths->dwMethods;
for (i = 0, dwCurIndex = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (pMeths->methods[i].IsPublic()) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, pMeths->methods[i].attrs, pParentMT, 0)) continue;
}
// Check for static instance
if (pMeths->methods[i].IsStatic()) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
if (declaredOnly) {
if (pMeths->methods[i].pMethod->GetClass() != pEEC)
continue;
}
// Check to see that the current method matches the name requirements
if(!bIsPrefix && pMeths->methods[i].dwNameCnt != cMemberName)
continue;
// Determine if it passes criteria
if(!bIgnoreCase)
{
if(strncmp(pMeths->methods[i].szName, szMemberName, cMemberName))
continue;
}
// @TODO - Fix this to use TOUPPER and compare!
else {
if(_strnicmp(pMeths->methods[i].szName, szMemberName, cMemberName))
continue;
}
// If the method has a linktime security demand attached, check it now.
if (!InvokeUtil::CheckLinktimeDemand(&sCtx, pMeths->methods[i].pMethod, false))
continue;
// Field passed, so save it
rgpMethods[dwCurIndex++] = &pMeths->methods[i];
}
dwNumMethods = dwCurIndex;
}
else
dwNumMethods = 0;
//Filter the properties
if ((args->memberType & MEMTYPE_Property) != 0) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pProps->dwTotal : pProps->dwProps;
for (i = 0, dwCurIndex = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicProperty(&pProps->props[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pProps->props[i].pDeclCls != pEEC)
continue;
}
// Check fo static instance
if (COMMember::StaticProperty(&pProps->props[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Check to see that the current property matches the name requirements
DWORD dwNameCnt = (DWORD)strlen(pProps->props[i].szName);
if(!bIsPrefix && dwNameCnt != cMemberName)
continue;
// Determine if it passes criteria
if(!bIgnoreCase)
{
if(strncmp(pProps->props[i].szName, szMemberName, cMemberName))
continue;
}
// @TODO - Fix this to use TOUPPER and compare!
else {
if(_strnicmp(pProps->props[i].szName, szMemberName, cMemberName))
continue;
}
// Property passed, so save it
rgpProps[dwCurIndex++] = &pProps->props[i];
}
dwNumProps = dwCurIndex;
}
else
dwNumProps = 0;
//Filter the events
if ((args->memberType & MEMTYPE_Event) != 0) {
DWORD searchSpace = ((args->bindingAttr & BINDER_FlattenHierarchy) != 0) ? pEvents->dwTotal : pEvents->dwEvents;
for (i = 0, dwCurIndex = 0; i < searchSpace; i++) {
// Check for access to publics, non-publics
if (COMMember::PublicEvent(&pEvents->events[i])) {
if (!addPub) continue;
}
else {
if (!addPriv) continue;
if (!InvokeUtil::CheckAccess(&sCtx, mdAssem, pParentMT, 0)) continue;
}
if (declaredOnly) {
if (pEvents->events[i].pDeclCls != pEEC)
continue;
}
// Check fo static instance
if (COMMember::StaticEvent(&pEvents->events[i])) {
if (!addStatic) continue;
}
else {
if (!addInst) continue;
}
// Check to see that the current event matches the name requirements
DWORD dwNameCnt = (DWORD)strlen(pEvents->events[i].szName);
if(!bIsPrefix && dwNameCnt != cMemberName)
continue;
// Determine if it passes criteria
if(!bIgnoreCase)
{
if(strncmp(pEvents->events[i].szName, szMemberName, cMemberName))
continue;
}
// @TODO - Fix this to use TOUPPER and compare!
else {
if(_strnicmp(pEvents->events[i].szName, szMemberName, cMemberName))
continue;
}
// Property passed, so save it
rgpEvents[dwCurIndex++] = &pEvents->events[i];
}
dwNumEvents = dwCurIndex;
}
else
dwNumEvents = 0;
// Filter the Nested Classes
if ((args->memberType & MEMTYPE_NestedType) != 0) {
LPUTF8 pszNestName;
LPUTF8 pszNestNameSpace;
ns::SplitInline(szMemberName, pszNestNameSpace, pszNestName);
DWORD cNameSpace;
if (pszNestNameSpace)
cNameSpace = (DWORD)strlen(pszNestNameSpace);
else
cNameSpace = 0;
DWORD cName = (DWORD)strlen(pszNestName);
for (i = 0, dwCurIndex = 0; i < pNests->dwTypes; i++) {
// Check for access to non-publics
if (!addPriv && !IsTdNestedPublic(pNests->types[i]->GetAttrClass()))
continue;
if (!InvokeUtil::CheckAccessType(&sCtx, pNests->types[i], 0)) continue;
LPCUTF8 szcName;
LPCUTF8 szcNameSpace;
REFLECTCLASSBASEREF o = (REFLECTCLASSBASEREF) pNests->types[i]->GetExposedClassObject();
ReflectClass* thisRC = (ReflectClass*) o->GetData();
_ASSERTE(thisRC);
//******************************************************************
//@todo: This is wrong, but I'm not sure what is right. The question
// is whether we want to do prefix matching on namespaces for
// nested classes, and if so, how to do that. This code will
// simply take any nested class whose namespace has the given
// namespace as a prefix AND has a name with the given name as
// a prefix.
// Note that this code also assumes that nested classes are not
// decorated as Containing$Nested.
thisRC->GetName(&szcName,&szcNameSpace);
if(pszNestNameSpace) {
// Check to see that the nested type matches the namespace requirements
if(strlen(szcNameSpace) != cNameSpace)
continue;
if (!bIgnoreCase) {
if (strncmp(pszNestNameSpace, szcNameSpace, cNameSpace))
continue;
}
else {
if (_strnicmp(pszNestNameSpace, szcNameSpace, cNameSpace))
continue;
}
}
// Check to see that the nested type matches the name requirements
if(!bIsPrefix && strlen(szcName) != cName)
continue;
// If the names are a match, break
if (!bIgnoreCase) {
if (strncmp(pszNestName, szcName, cName))
continue;
}
else {
if (_strnicmp(pszNestName, szcName, cName))
continue;
}
// Nested Type passed, so save it
rgpNests[dwCurIndex++] = pNests->types[i];
}
dwNumNests = dwCurIndex;
}
else
dwNumNests = 0;
// Get a grand total
dwNumMembers = dwNumFields + dwNumMethods + dwNumCtors + dwNumProps + dwNumEvents + dwNumNests;
// Now create an array of proper MemberInfo
MethodTable *pArrayType = NULL;
if (args->memberType == MEMTYPE_Method) {
_ASSERTE(dwNumFields + dwNumCtors + dwNumProps + dwNumEvents + dwNumNests == 0);
if (!COMMember::m_pMTMethodInfo) {
COMMember::m_pMTMethodInfo = g_Mscorlib.GetClass(CLASS__METHOD_INFO);
}
pArrayType = COMMember::m_pMTMethodInfo;
}
else if (args->memberType == MEMTYPE_Field) {
_ASSERTE(dwNumMethods + dwNumCtors + dwNumProps + dwNumEvents + dwNumNests == 0);
if (!COMMember::m_pMTFieldInfo) {
COMMember::m_pMTFieldInfo = g_Mscorlib.GetClass(CLASS__FIELD_INFO);
}
pArrayType = COMMember::m_pMTFieldInfo;
}
else if (args->memberType == MEMTYPE_Property) {
_ASSERTE(dwNumFields + dwNumMethods + dwNumCtors + dwNumEvents + dwNumNests == 0);
if (!COMMember::m_pMTPropertyInfo) {
COMMember::m_pMTPropertyInfo = g_Mscorlib.GetClass(CLASS__PROPERTY_INFO);
}
pArrayType = COMMember::m_pMTPropertyInfo;
}
else if (args->memberType == MEMTYPE_Constructor) {
_ASSERTE(dwNumFields + dwNumMethods + dwNumProps + dwNumEvents + dwNumNests == 0);
if (!COMMember::m_pMTConstructorInfo) {
COMMember::m_pMTConstructorInfo = g_Mscorlib.GetClass(CLASS__CONSTRUCTOR_INFO);
}
pArrayType = COMMember::m_pMTConstructorInfo;
}
else if (args->memberType == MEMTYPE_Event) {
_ASSERTE(dwNumFields + dwNumMethods + dwNumCtors + dwNumProps + dwNumNests == 0);
if (!COMMember::m_pMTEventInfo) {
COMMember::m_pMTEventInfo = g_Mscorlib.GetClass(CLASS__EVENT_INFO);
}
pArrayType = COMMember::m_pMTEventInfo;
}
else if (args->memberType == MEMTYPE_NestedType) {
_ASSERTE(dwNumFields + dwNumMethods + dwNumCtors + dwNumProps + dwNumEvents == 0);
if (!COMMember::m_pMTType) {
COMMember::m_pMTType = g_Mscorlib.GetClass(CLASS__TYPE);
}
pArrayType = COMMember::m_pMTType;
}
else if (args->memberType == (MEMTYPE_Constructor | MEMTYPE_Method)) {
_ASSERTE(dwNumFields + dwNumProps + dwNumEvents + dwNumNests == 0);
if (!COMMember::m_pMTMethodBase) {
COMMember::m_pMTMethodBase = g_Mscorlib.GetClass(CLASS__METHOD_BASE);
}
pArrayType = COMMember::m_pMTMethodBase;
}
COMMember::GetMemberInfo();
_ASSERTE(COMMember::m_pMTIMember);
if (pArrayType == NULL)
pArrayType = COMMember::m_pMTIMember;
refArrIMembers = (PTRARRAYREF) AllocateObjectArray(dwNumMembers, pArrayType->m_pEEClass->GetMethodTable());
GCPROTECT_BEGIN(refArrIMembers);
// NO GC Below here
// Now create and assign the reflection objects into the array
for (i = 0, dwCurIndex = 0; i < dwNumFields; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpFields[i]->GetFieldInfo(pRC);
refArrIMembers->SetAt(dwCurIndex, o);
}
for (i = 0; i < dwNumMethods; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpMethods[i]->GetMethodInfo(pRC);
refArrIMembers->SetAt(dwCurIndex, o);
}
for (i = 0; i < dwNumCtors; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpCons[i]->GetConstructorInfo(pRC);
refArrIMembers->SetAt(dwCurIndex, o);
}
for (i = 0; i < dwNumProps; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpProps[i]->GetPropertyInfo(pRC);
refArrIMembers->SetAt(dwCurIndex, o);
}
for (i = 0; i < dwNumEvents; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpEvents[i]->GetEventInfo(pRC);
refArrIMembers->SetAt(dwCurIndex, o);
}
for (i = 0; i < dwNumNests; i++, dwCurIndex++)
{
// Do not change this code. This is done this way to
// prevent a GC hole in the SetObjectReference() call. The compiler
// is free to pick the order of evaluation.
OBJECTREF o = (OBJECTREF) rgpNests[i]->GetExposedClassObject();
refArrIMembers->SetAt(dwCurIndex, o);
}
// Assign the return value
*((PTRARRAYREF*) &rv) = refArrIMembers;
GCPROTECT_END();
return rv;
}
// GetModule
// This will return the module that the class is defined in.
LPVOID __stdcall COMClass::GetModule(_GETMODULEARGS* args)
{
OBJECTREF refModule;
LPVOID rv;
Module* mod;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// Get the module, This may fail because
// there are classes which don't have modules (Like arrays)
mod = pRC->GetModule();
if (!mod)
return 0;
// Get the exposed Module Object -- We create only one per Module instance.
refModule = (OBJECTREF) mod->GetExposedModuleObject();
_ASSERTE(refModule);
// Assign the return value
*((OBJECTREF*) &rv) = refModule;
// Return the object
return rv;
}
// GetAssembly
// This will return the assembly that the class is defined in.
LPVOID __stdcall COMClass::GetAssembly(_GETASSEMBLYARGS* args)
{
OBJECTREF refAssembly;
LPVOID rv;
Module* mod;
Assembly* assem;
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
_ASSERTE(pRC);
// Get the module, This may fail because
// there are classes which don't have modules (Like arrays)
mod = pRC->GetModule();
if (!mod)
return 0;
// Grab the module's assembly.
assem = mod->GetAssembly();
_ASSERTE(assem);
// Get the exposed Assembly Object.
refAssembly = assem->GetExposedObject();
_ASSERTE(refAssembly);
// Assign the return value
*((OBJECTREF*) &rv) = refAssembly;
// Return the object
return rv;
}
// CreateClassObjFromModule
// This method will create a new Module class given a Module.
HRESULT COMClass::CreateClassObjFromModule(
Module* pModule,
REFLECTMODULEBASEREF* prefModule)
{
HRESULT hr = E_FAIL;
LPVOID rv = NULL;
// This only throws the possible exception raised by the <cinit> on the class
THROWSCOMPLUSEXCEPTION();
//if(!m_fIsReflectionInitialized)
//{
// hr = InitializeReflection();
// if(FAILED(hr))
// {
// _ASSERTE(!"InitializeReflection failed in COMClass::SetStandardFilterCriteria.");
// return hr;
// }
//}
// Create the module object
*prefModule = (REFLECTMODULEBASEREF) g_pRefUtil->CreateReflectClass(RC_Module,0,pModule);
return S_OK;
}
// CreateClassObjFromDynModule
// This method will create a new ModuleBuilder class given a Module.
HRESULT COMClass::CreateClassObjFromDynamicModule(
Module* pModule,
REFLECTMODULEBASEREF* prefModule)
{
// This only throws the possible exception raised by the <cinit> on the class
THROWSCOMPLUSEXCEPTION();
// Create the module object
*prefModule = (REFLECTMODULEBASEREF) g_pRefUtil->CreateReflectClass(RC_DynamicModule,0,pModule);
return S_OK;
}
// CheckComWrapperClass
// This method is called to check and see if the passed in ReflectClass*
// is a ComWrapperClass or not.
BOOL CheckComWrapperClass(void* src)
{
EEClass* p = ((ReflectClass*) src)->GetClass();
if (p == 0)
return 0;
return p->GetMethodTable()->IsComObjectType();
}
// CheckComObjectClass
// This method is called to check and see if the passed in ReflectClass*
// is a ComWrapperClass or not.
BOOL CheckComObjectClass(void* src)
{
_ASSERTE(src != NULL);
if (((ReflectClass*) src)->IsTypeDesc())
return 0;
EEClass* c = NULL;
EEClass* p = ((ReflectClass*) src)->GetClass();
_ASSERTE(p != NULL);
MethodTable *pComMT = SystemDomain::GetDefaultComObjectNoInit();
if (pComMT)
c = pComMT->GetClass();
return p == c;
}
/*=============================GetUnitializedObject=============================
**Action:
**Returns:
**Arguments:
**Exceptions:
==============================================================================*/
LPVOID __stdcall COMClass::GetUninitializedObject(_GetUnitializedObjectArgs* args)
{
THROWSCOMPLUSEXCEPTION();
_ASSERTE(args->objType);
if (args->objType==NULL) {
COMPlusThrowArgumentNull(L"type", L"ArgumentNull_Type");
}
ReflectClass* pRC = (ReflectClass*) args->objType->GetData();
_ASSERTE(pRC);
EEClass *pEEC = pRC->GetClass();
_ASSERTE(pEEC);
//We don't allow unitialized strings.
if (pEEC == g_pStringClass->GetClass()) {
COMPlusThrow(kArgumentException, L"Argument_NoUninitializedStrings");
}
// if this is an abstract class or an interface type then we will
// fail this
if (pEEC->IsAbstract())
{
COMPlusThrow(kMemberAccessException,L"Acc_CreateAbst");
}
OBJECTREF retVal = pEEC->GetMethodTable()->Allocate();
RETURN(retVal, OBJECTREF);
}
/*=============================GetSafeUnitializedObject=============================
**Action:
**Returns:
**Arguments:
**Exceptions:
==============================================================================*/
LPVOID __stdcall COMClass::GetSafeUninitializedObject(_GetUnitializedObjectArgs* args)
{
THROWSCOMPLUSEXCEPTION();
_ASSERTE(args->objType);
if (args->objType==NULL) {
COMPlusThrowArgumentNull(L"type", L"ArgumentNull_Type");
}
ReflectClass* pRC = (ReflectClass*) args->objType->GetData();
_ASSERTE(pRC);
EEClass *pEEC = pRC->GetClass();
_ASSERTE(pEEC);
//We don't allow unitialized strings.
if (pEEC == g_pStringClass->GetClass()) {
COMPlusThrow(kArgumentException, L"Argument_NoUninitializedStrings");
}
// if this is an abstract class or an interface type then we will
// fail this
if (pEEC->IsAbstract())
{
COMPlusThrow(kMemberAccessException,L"Acc_CreateAbst");
}
if (!pEEC->GetAssembly()->AllowUntrustedCaller()) {
OBJECTREF permSet = NULL;
Security::GetPermissionInstance(&permSet, SECURITY_FULL_TRUST);
COMCodeAccessSecurityEngine::DemandSet(permSet);
}
if (pEEC->RequiresLinktimeCheck())
{
OBJECTREF refClassNonCasDemands = NULL;
OBJECTREF refClassCasDemands = NULL;
refClassCasDemands = pEEC->GetModule()->GetLinktimePermissions(pEEC->GetCl(), &refClassNonCasDemands);
if (refClassCasDemands != NULL)
COMCodeAccessSecurityEngine::DemandSet(refClassCasDemands);
}
OBJECTREF retVal = pEEC->GetMethodTable()->Allocate();
RETURN(retVal, OBJECTREF);
}
INT32 __stdcall COMClass::SupportsInterface(_SupportsInterfaceArgs* args)
{
THROWSCOMPLUSEXCEPTION();
if (args->obj == NULL)
COMPlusThrow(kNullReferenceException);
ReflectClass* pRC = (ReflectClass*) args->refThis->GetData();
EEClass* pEEC = pRC->GetClass();
_ASSERTE(pEEC);
MethodTable* pMT = pEEC->GetMethodTable();
return args->obj->GetClass()->SupportsInterface(args->obj, pMT);
}
// GetTypeDefToken
// This method returns the typedef token of this EEClass
FCIMPL1(INT32, COMClass::GetTypeDefToken, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
_ASSERTE(pEEC);
return pEEC->GetCl();
}
FCIMPLEND
FCIMPL1(INT32, COMClass::IsContextful, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
BOOL isContextful = FALSE;
// Some classes do not have an underlying EEClass such as
// COM classic or pointer classes
// We will return false for such classes
// BUGBUG: Do we support remoting for such classes ?
if(NULL != pEEC)
{
isContextful = pEEC->IsContextful();
}
return isContextful;
}
FCIMPLEND
// This will return TRUE is a type has a non-default proxy attribute
// associated with it.
FCIMPL1(INT32, COMClass::HasProxyAttribute, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
BOOL hasProxyAttribute = FALSE;
// Some classes do not have an underlying EEClass such as
// COM classic or pointer classes
// We will return false for such classes
if(NULL != pEEC)
{
hasProxyAttribute = pEEC->HasRemotingProxyAttribute();
}
return hasProxyAttribute;
}
FCIMPLEND
FCIMPL1(INT32, COMClass::IsMarshalByRef, ReflectClassBaseObject* refThis)
{
VALIDATEOBJECTREF(refThis);
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
EEClass* pEEC = pRC->GetClass();
BOOL isMarshalByRef = FALSE;
// Some classes do not have an underlying EEClass such as
// COM classic or pointer classes
// We will return false for such classes
// BUGBUG: Do we support remoting for such classes ?
if(NULL != pEEC)
{
isMarshalByRef = pEEC->IsMarshaledByRef();
}
return isMarshalByRef;
}
FCIMPLEND
FCIMPL3(void, COMClass::GetInterfaceMap, ReflectClassBaseObject* refThis, InterfaceMapData* data, ReflectClassBaseObject* type)
{
THROWSCOMPLUSEXCEPTION();
VALIDATEOBJECTREF(refThis);
VALIDATEOBJECTREF(type);
HELPER_METHOD_FRAME_BEGIN_NOPOLL();
// Cast to the Type object
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
if (pRC->IsTypeDesc())
COMPlusThrow(kArgumentException, L"Arg_NotFoundIFace");
EEClass* pTarget = pRC->GetClass();
// Cast to the Type object
ReflectClass* pIRC = (ReflectClass*) type->GetData();
EEClass* pIface = pIRC->GetClass();
SetObjectReference((OBJECTREF*) &data->m_targetType, REFLECTCLASSBASEREF(refThis), GetAppDomain());
SetObjectReference((OBJECTREF*) &data->m_interfaceType, REFLECTCLASSBASEREF(type), GetAppDomain());
GCPROTECT_BEGININTERIOR (data);
ReflectMethodList* pRM = pRC->GetMethods();
ReflectMethodList* pIRM = pIRC->GetMethods(); // this causes a GC !!!
_ASSERTE(pIface->IsInterface());
if (pTarget->IsInterface())
COMPlusThrow(kArgumentException, L"Argument_InterfaceMap");
MethodTable *pInterfaceMT = pIface->GetMethodTable();
MethodDesc *pCCtor = NULL;
unsigned slotCnt = pInterfaceMT->GetInterfaceMethodSlots();
unsigned staticSlotCnt = 0;
for (unsigned i=0;i<slotCnt;i++) {
// Build the interface array...
MethodDesc* pCurMethod = pIface->GetUnknownMethodDescForSlot(i);
if (pCurMethod->IsStatic()) {
staticSlotCnt++;
}
}
InterfaceInfo_t* pII = pTarget->FindInterface(pIface->GetMethodTable());
if (!pII)
COMPlusThrow(kArgumentException, L"Arg_NotFoundIFace");
SetObjectReference((OBJECTREF*) &data->m_targetMethods,
AllocateObjectArray(slotCnt-staticSlotCnt, g_pRefUtil->GetTrueType(RC_Class)), GetAppDomain());
SetObjectReference((OBJECTREF*) &data->m_interfaceMethods,
AllocateObjectArray(slotCnt-staticSlotCnt, g_pRefUtil->GetTrueType(RC_Class)), GetAppDomain());
for (unsigned i=0;i<slotCnt;i++) {
// Build the interface array...
MethodDesc* pCurMethod = pIface->GetUnknownMethodDescForSlot(i);
if (pCurMethod->IsStatic())
continue;
ReflectMethod* pRMeth = pIRM->FindMethod(pCurMethod);
_ASSERTE(pRMeth);
OBJECTREF o = (OBJECTREF) pRMeth->GetMethodInfo(pIRC);
data->m_interfaceMethods->SetAt(i, o);
// Build the type array...
pCurMethod = pTarget->GetUnknownMethodDescForSlot(i+pII->m_wStartSlot);
pRMeth = pRM->FindMethod(pCurMethod);
if (pRMeth)
o = (OBJECTREF) pRMeth->GetMethodInfo(pRC);
else
o = NULL;
data->m_targetMethods->SetAt(i, o);
}
GCPROTECT_END ();
HELPER_METHOD_FRAME_END_POLL();
}
FCIMPLEND
// GetNestedType
// This method will search for a nested type based upon the name
FCIMPL3(Object*, COMClass::GetNestedType, ReflectClassBaseObject* pRefThis, StringObject* vStr, INT32 invokeAttr)
{
THROWSCOMPLUSEXCEPTION();
Object* rv = 0;
STRINGREF str(vStr);
REFLECTCLASSBASEREF refThis(pRefThis);
HELPER_METHOD_FRAME_BEGIN_RET_2(refThis, str);
RefSecContext sCtx;
LPUTF8 pszNestName;
LPUTF8 pszNestNameSpace;
if (str == 0)
COMPlusThrow(kArgumentNullException, L"ArgumentNull_String");
// Get the underlying type
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
ReflectTypeList* pTypes = pRC->GetNestedTypes();
if (pTypes->dwTypes != 0)
{
CQuickBytes bytes;
LPSTR szNestName;
DWORD cNestName;
//Get the name and split it apart into namespace, name
szNestName = GetClassStringVars(str, &bytes, &cNestName);
ns::SplitInline(szNestName, pszNestNameSpace, pszNestName);
// The Search modifiers
bool ignoreCase = ((invokeAttr & BINDER_IgnoreCase) != 0);
bool declaredOnly = ((invokeAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addPriv = ((invokeAttr & BINDER_NonPublic) != 0);
bool addPub = ((invokeAttr & BINDER_Public) != 0);
EEClass* pThisEEC = pRC->GetClass();
EEClass* retEEC = 0;
for (DWORD i=0;i<pTypes->dwTypes;i++) {
LPCUTF8 szcName;
LPCUTF8 szcNameSpace;
REFLECTCLASSBASEREF o;
o = (REFLECTCLASSBASEREF) pTypes->types[i]->GetExposedClassObject();
ReflectClass* thisRC = (ReflectClass*) o->GetData();
_ASSERTE(thisRC);
// Check for access to non-publics
if (IsTdNestedPublic(pTypes->types[i]->GetAttrClass())) {
if (!addPub)
continue;
}
else {
if (!addPriv)
continue;
}
if (!InvokeUtil::CheckAccessType(&sCtx, pTypes->types[i], 0)) continue;
// Are we only looking at the declared nested classes?
if (declaredOnly) {
EEClass* pEEC = pTypes->types[i]->GetEnclosingClass();
if (pEEC != pThisEEC)
continue;
}
thisRC->GetName(&szcName,&szcNameSpace);
if(pszNestNameSpace) {
if (!ignoreCase) {
if (strcmp(pszNestNameSpace, szcNameSpace))
continue;
}
else {
if (_stricmp(pszNestNameSpace, szcNameSpace))
continue;
}
}
// If the names are a match, break
if (!ignoreCase) {
if(strcmp(pszNestName, szcName))
continue;
}
else {
if(_stricmp(pszNestName, szcName))
continue;
}
if (retEEC)
COMPlusThrow(kAmbiguousMatchException);
retEEC = pTypes->types[i];
if (!ignoreCase)
break;
}
if (retEEC)
rv = OBJECTREFToObject(retEEC->GetExposedClassObject());
}
HELPER_METHOD_FRAME_END();
return rv;
}
FCIMPLEND
// GetNestedTypes
// This method will return an array of types which are the nested types
// defined by the type. If no nested types are defined, a zero length
// array is returned.
FCIMPL2(Object*, COMClass::GetNestedTypes, ReflectClassBaseObject* vRefThis, INT32 invokeAttr)
{
Object* rv = 0;
REFLECTCLASSBASEREF refThis(vRefThis);
PTRARRAYREF nests((PTRARRAYREF)(size_t)NULL);
HELPER_METHOD_FRAME_BEGIN_RET_2(refThis, nests); // Set up a frame
RefSecContext sCtx;
// Get the underlying type
ReflectClass* pRC = (ReflectClass*) refThis->GetData();
_ASSERTE(pRC);
// Allow GC Protection so we can
ReflectTypeList* pTypes = pRC->GetNestedTypes();
nests = (PTRARRAYREF) AllocateObjectArray(pTypes->dwTypes, g_pRefUtil->GetTrueType(RC_Class));
// The Search modifiers
bool declaredOnly = ((invokeAttr & BINDER_DeclaredOnly) != 0);
// The search filters
bool addPriv = ((invokeAttr & BINDER_NonPublic) != 0);
bool addPub = ((invokeAttr & BINDER_Public) != 0);
EEClass* pThisEEC = pRC->GetClass();
unsigned int pos = 0;
for (unsigned int i=0;i<pTypes->dwTypes;i++) {
if (IsTdNestedPublic(pTypes->types[i]->GetAttrClass())) {
if (!addPub)
continue;
}
else {
if (!addPriv)
continue;
}
if (!InvokeUtil::CheckAccessType(&sCtx, pTypes->types[i], 0)) continue;
if (declaredOnly) {
EEClass* pEEC = pTypes->types[i]->GetEnclosingClass();
if (pEEC != pThisEEC)
continue;
}
OBJECTREF o = pTypes->types[i]->GetExposedClassObject();
nests->SetAt(pos++, o);
}
if (pos != pTypes->dwTypes) {
PTRARRAYREF p = (PTRARRAYREF) AllocateObjectArray(
pos, g_pRefUtil->GetTrueType(RC_Class));
for (unsigned int i=0;i<pos;i++)
p->SetAt(i, nests->GetAt(i));
nests = p;
}
rv = OBJECTREFToObject(nests);
HELPER_METHOD_FRAME_END();
_ASSERTE(rv);
return rv;
}
FCIMPLEND
FCIMPL2(INT32, COMClass::IsSubClassOf, ReflectClassBaseObject* refThis, ReflectClassBaseObject* refOther);
{
if (refThis == NULL)
FCThrow(kNullReferenceException);
if (refOther == NULL)
FCThrowArgumentNull(L"c");
VALIDATEOBJECTREF(refThis);
VALIDATEOBJECTREF(refOther);
MethodTable *pType = refThis->GetMethodTable();
MethodTable *pBaseType = refOther->GetMethodTable();
if (pType != pBaseType || pType != g_Mscorlib.FetchClass(CLASS__CLASS))
return false;
ReflectClass *pRCThis = (ReflectClass *)refThis->GetData();
ReflectClass *pRCOther = (ReflectClass *)refOther->GetData();
EEClass *pEEThis = pRCThis->GetClass();
EEClass *pEEOther = pRCOther->GetClass();
// If these types aren't actually classes, they're not subclasses.
if ((!pEEThis) || (!pEEOther))
return false;
if (pEEThis == pEEOther)
// this api explicitly tests for proper subclassness
return false;
if (pEEThis == pEEOther)
return false;
do
{
if (pEEThis == pEEOther)
return true;
pEEThis = pEEThis->GetParentClass();
}
while (pEEThis != NULL);
return false;
}
FCIMPLEND
| 34.93315 | 167 | 0.576442 | [
"object"
] |
05daceb5936b8df91405aebef402e33834d6b69e | 791 | cc | C++ | lib/utility/libgclgrid/flatten.cc | jreyes1108/antelope_contrib | be2354605d8463d6067029eb16464a0bf432a41b | [
"BSD-2-Clause",
"MIT"
] | 30 | 2015-02-20T21:44:29.000Z | 2021-09-27T02:53:14.000Z | lib/utility/libgclgrid/flatten.cc | jreyes1108/antelope_contrib | be2354605d8463d6067029eb16464a0bf432a41b | [
"BSD-2-Clause",
"MIT"
] | 14 | 2015-07-07T19:17:24.000Z | 2020-12-19T19:18:53.000Z | lib/utility/libgclgrid/flatten.cc | jreyes1108/antelope_contrib | be2354605d8463d6067029eb16464a0bf432a41b | [
"BSD-2-Clause",
"MIT"
] | 46 | 2015-02-06T16:22:41.000Z | 2022-03-30T11:46:37.000Z | #include "gclgrid.h"
/* forward and backward flattening transformation routines
are in this file.
It is common practice in regional scale studies to use the
flattening transform as an approximation for converting from
spherical to cartesian coordinates. flatz converts from
depth to an equivalent flattened depth. uflatz does
the inverse. flatvel converts velocity and uflatvel
does the reciprocal.
This is a C translation of routines by the same name in
FORTRAN from Steve Roecker.
*/
const double REARTH=6371.0;
double flatz(double z)
{
return(REARTH*log(REARTH/(REARTH-z)));
}
double uflatz(double z)
{
return(REARTH*(1.0-exp(-z/REARTH)));
}
double flatvel(double v, double z)
{
return(v*exp(z/REARTH));
}
double uflatvel(double v, double z)
{
return(v*exp(-z/REARTH));
}
| 24.71875 | 60 | 0.756005 | [
"transform"
] |
05e0b1d88cbca185b2130c439f15d82b721e2496 | 1,578 | cc | C++ | shell/browser/font/electron_font_access_delegate.cc | TarunavBA/electron | a41898bb9b889486fb93c11b7107b9412818133a | [
"MIT"
] | 88,283 | 2016-04-04T19:29:13.000Z | 2022-03-31T23:33:33.000Z | shell/browser/font/electron_font_access_delegate.cc | TarunavBA/electron | a41898bb9b889486fb93c11b7107b9412818133a | [
"MIT"
] | 27,327 | 2016-04-04T19:38:58.000Z | 2022-03-31T22:34:10.000Z | shell/browser/font/electron_font_access_delegate.cc | TarunavBA/electron | a41898bb9b889486fb93c11b7107b9412818133a | [
"MIT"
] | 15,972 | 2016-04-04T19:32:06.000Z | 2022-03-31T08:54:00.000Z | // Copyright (c) 2021 Microsoft, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <utility>
#include "shell/browser/font/electron_font_access_delegate.h"
#include "base/task/post_task.h"
#include "chrome/browser/browser_process.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/font_access_chooser.h"
#include "content/public/browser/render_frame_host.h"
class ElectronFontAccessChooser : public content::FontAccessChooser {
public:
explicit ElectronFontAccessChooser(base::OnceClosure close_callback) {
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(
[](base::OnceClosure closure) { std::move(closure).Run(); },
std::move(close_callback)));
}
~ElectronFontAccessChooser() override = default;
};
ElectronFontAccessDelegate::ElectronFontAccessDelegate() = default;
ElectronFontAccessDelegate::~ElectronFontAccessDelegate() = default;
std::unique_ptr<content::FontAccessChooser>
ElectronFontAccessDelegate::RunChooser(
content::RenderFrameHost* frame,
const std::vector<std::string>& selection,
content::FontAccessChooser::Callback callback) {
// TODO(codebytere) : implement with proper permissions model.
return std::make_unique<ElectronFontAccessChooser>(base::BindOnce(
[](content::FontAccessChooser::Callback callback) {
std::move(callback).Run(
blink::mojom::FontEnumerationStatus::kUnimplemented, {});
},
std::move(callback)));
}
| 36.697674 | 72 | 0.737643 | [
"vector",
"model"
] |
05e6ec8641b9f68822df4991b3ab8c4784bacf5b | 5,331 | cpp | C++ | src/analysis/formant/deepformants/features.cpp | alargepileofash/in-formant | 3fc77925b68e349b96d7cf20c00223a4b343d04d | [
"Apache-2.0"
] | 55 | 2020-10-07T20:22:22.000Z | 2021-08-28T10:58:36.000Z | src/analysis/formant/deepformants/features.cpp | alargepileofash/in-formant | 3fc77925b68e349b96d7cf20c00223a4b343d04d | [
"Apache-2.0"
] | 16 | 2020-12-06T22:02:38.000Z | 2021-08-19T09:37:56.000Z | src/analysis/formant/deepformants/features.cpp | alargepileofash/in-formant | 3fc77925b68e349b96d7cf20c00223a4b343d04d | [
"Apache-2.0"
] | 11 | 2019-12-16T16:06:19.000Z | 2020-04-15T15:28:31.000Z | #include "df.h"
#include "../../fft/fft.h"
#include "../../linpred/linpred.h"
#include <memory>
using namespace Eigen;
template<typename Derived>
static ArrayXd dct(const ArrayBase<Derived>& x, int trunc)
{
const int N = x.size();
auto dct = DFModelHolder::instance()->dct(N);
for (int i = 0; i < N; ++i) {
dct->data(i) = x(i);
}
dct->compute();
ArrayXd out(trunc);
out(0) = dct->data(0) / sqrt(4 * N);
for (int i = 1; i < trunc; ++i) {
out(i) = dct->data(i);
}
return out;
}
template<typename Derived>
static ArrayXd feature_periodogram(const ArrayBase<Derived>& x, int nfft)
{
const int N = x.size();
auto fft = DFModelHolder::instance()->fft1(nfft);
if (N < nfft) {
for (int i = 0; i < nfft; ++i)
fft->input(i) = 0.0;
for (int i = 0; i < N; ++i)
fft->input(nfft / 2 - N / 2 + i) = x(i);
}
else if (N > nfft) {
for (int i = 0; i < nfft; ++i) {
fft->input(i) = x(N / 2 - nfft / 2 + i);
}
}
else {
for (int i = 0; i < nfft; ++i) {
fft->input(i) = x(i);
}
}
fft->computeForward();
int outLength = fft->getOutputLength();
ArrayXd out(outLength);
for (int i = 0; i < outLength; ++i) {
double px = std::abs(fft->output(i));
out(i) = (px * px) / N;
}
return out;
}
template<typename Derived>
static ArrayXd feature_arspec(const ArrayBase<Derived>& x, int order, int nfft)
{
Analysis::LP::Autocorr lpc;
double e;
rpm::vector<double> xv(x.size());
for (int i = 0; i < x.size(); ++i)
xv[i] = x(i);
auto a = lpc.solve(xv.data(), xv.size(), order, &e);
auto fft = DFModelHolder::instance()->fft2(nfft);
fft->input(0) = 1.0;
for (int i = 1; i <= a.size(); ++i)
fft->input(i) = a[i - 1];
for (int i = a.size() + 1; i < nfft; ++i)
fft->input(i) = 0.0;
fft->computeForward();
int outLength = fft->getOutputLength();
ArrayXd out(outLength);
for (int i = 0; i < outLength; ++i) {
auto px = std::abs(1.0 / fft->output(i));
out(i) = px * px * e;
}
return out;
}
template<typename Derived>
static ArrayXd atal(const ArrayBase<Derived>& x, int order, int numCoefs)
{
Analysis::LP::Autocorr lpc;
double e;
rpm::vector<double> xv(x.size());
for (int i = 0; i < x.size(); ++i)
xv[i] = x(i);
auto a = lpc.solve(xv.data(), xv.size(), order, &e);
int m, k, p = a.size();
ArrayXd c(numCoefs);
c.setZero();
c(0) = 1.0;
for (m = 1; m < p + 1; ++m) {
c(m) = -a[m - 1];
for (k = 1; k < m; ++k)
c(m) += (double(k) / double(m) - 1) * a[k - 1] * c(m - k);
}
for (m = p + 1; m < numCoefs; ++m) {
c(m) = 0.0;
for (k = 1; k < p + 1; ++k)
c(m) += (double(k) / double(m) - 1) * a[k - 1] * c(m - k);
}
return c;
}
constexpr int ncep_ar = 30;
constexpr int ncep_ps = 50;
constexpr int nfft_ar = 4096;
constexpr int nfft_ps = 4096;
constexpr double epsilon = 1e-10;
template<typename Derived>
static ArrayXd arSpecs(const ArrayBase<Derived>& x, int order)
{
//return atal(x, order, ncep_ar);
constexpr int nfft = nfft_ar;
constexpr int pn = nfft / 2 + 1;
ArrayXd freqs = ArrayXd::LinSpaced(pn, 0, 0.5);
ArrayXd ars = feature_arspec(x, order, nfft);
ArrayXd ar(pn);
for (int i = 0; i < pn; ++i) {
ar(i) = log(sqrt(ars(i) * ars(i) + freqs(i) * freqs(i)));
if (ar(i) < 0.0)
ar(i) = NAN;
else if (ar(i) == 0.0)
ar(i) = epsilon;
}
return dct(log10(ar), ncep_ar);
}
template<typename Derived>
static ArrayXd specPS(const ArrayBase<Derived>& x, int pitch)
{
constexpr int nfft = nfft_ps;
constexpr int pn = nfft / 2 + 1;
ArrayXd freqs = ArrayXd::LinSpaced(pn, 0, 0.5);
int samps = x.size() / pitch;
if (samps == 0)
samps = 1;
int frames = x.size() / samps;
ArrayXd specs = feature_periodogram(x.head(frames), nfft);
for (int i = 1; i < samps; ++i) {
specs += feature_periodogram(x.segment(i * frames, frames), nfft);
}
specs /= (double) samps;
ArrayXd peri(pn);
for (int i = 0; i < pn; ++i) {
peri(i) = sqrt(specs(i) * specs(i) + freqs(i) * freqs(i));
if (peri(i) > 0.0)
peri(i) = log(peri(i));
else if (peri(i) == 0.0)
peri(i) = epsilon;
else
peri(i) = NAN;
}
return dct(log10(peri), ncep_ps);
}
template<typename Derived>
ArrayXd build_feature_row(const ArrayBase<Derived>& x)
{
const rpm::vector<int> lpcs{8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
// The feature things expect data in 16bit signed int format.
ArrayXd input = x * MAX_AMPLITUDE_16BIT;
ArrayXd arr(ncep_ps + lpcs.size() * ncep_ar);
arr.head(ncep_ps) = specPS(input, 50);
int start = ncep_ps;
for (int order : lpcs) {
arr.segment(start, ncep_ar) = arSpecs(input, order);
start += ncep_ar;
}
for (int i = 0; i < arr.size(); ++i) {
if (std::isnan(arr(i)))
arr(i) = 0.0;
}
return arr;
}
using ImplT = Map<const ArrayXd>;
template ArrayXd build_feature_row<ImplT>(const ArrayBase<ImplT>& x);
| 24.795349 | 79 | 0.522228 | [
"vector"
] |
05ebb59edcc4c98bc60a399d904d1cc2c7358b87 | 9,107 | cpp | C++ | src/CLSmith/StatementEMI.cpp | jiezzhang/CLSmith | a39a31c43c88352fc65e61dce270d8e1660cbcf0 | [
"BSD-2-Clause"
] | null | null | null | src/CLSmith/StatementEMI.cpp | jiezzhang/CLSmith | a39a31c43c88352fc65e61dce270d8e1660cbcf0 | [
"BSD-2-Clause"
] | null | null | null | src/CLSmith/StatementEMI.cpp | jiezzhang/CLSmith | a39a31c43c88352fc65e61dce270d8e1660cbcf0 | [
"BSD-2-Clause"
] | null | null | null | #include "CLSmith/StatementEMI.h"
#include <algorithm>
#include <memory>
#include <vector>
#include "Block.h"
#include "CGContext.h"
#include "CLSmith/CLOptions.h"
#include "CLSmith/MemoryBuffer.h"
#include "CLSmith/Walker.h"
#include "ExpressionFuncall.h"
#include "ExpressionVariable.h"
#include "FunctionInvocationBinary.h"
#include "SafeOpFlags.h"
#include "Statement.h"
#include "StatementFor.h"
#include "StatementIf.h"
namespace CLSmith {
namespace {
EMIController *emi_controller_inst = NULL; // Singleton instance.
} // namespace
StatementEMI *StatementEMI::make_random(CGContext& cg_context) {
// TODO, better exprs, for now, just do 0>1, 2>3, etc.
static int item_count = 0;
assert(item_count < 1024);
MemoryBuffer *emi_input = EMIController::GetEMIController()->GetEMIInput();
// MemoryBuffer *item1 = emi_input->itemize({item_count++});
MemoryBuffer* item1 = emi_input->itemize(std::vector<int> (1, item_count++));
// MemoryBuffer *item2 = emi_input->itemize({item_count++});
MemoryBuffer* item2 = emi_input->itemize(std::vector<int> (1, item_count++));
SafeOpFlags *flags = SafeOpFlags::make_dummy_flags();
Expression *test = new ExpressionFuncall(*new FunctionInvocationBinary(eCmpLt,
new ExpressionVariable(*item1), new ExpressionVariable(*item2), flags));
// True block is a standard random block (that will never run), no false block.
// TODO make separate context, and discard effects (it is never executed).
bool prev_emi_context = cg_context.get_emi_context();
cg_context.set_emi_context(true);
Block *true_block = Block::make_random(cg_context);
Block *false_block = Block::make_dummy_block(cg_context);
cg_context.set_emi_context(prev_emi_context);
StatementEMI *emi = new StatementEMI(
cg_context.get_current_block(), new StatementIf(
cg_context.get_current_block(), *test, *true_block, *false_block));
// Record information in the controller.
EMIController *emi_controller = EMIController::GetEMIController();
emi_controller->AddStatementEMI(emi);
emi_controller->AddItemisedEMIInput(item1);
emi_controller->AddItemisedEMIInput(item2);
return emi;
}
void StatementEMI::Prune() {
// 'const' pfffft
PruneBlock(const_cast<Block *>(if_block_->get_true_branch()));
}
void StatementEMI::PruneBlock(Block *block) {
std::vector<Statement *> del_stms;
// Statements to be lifted involve modifying vectors we are iterating over.
// To retain iterator validity, statements are lifted after iteration.
std::vector<Statement *> lift_stms;
// Adjust the p_lift probability to give p_lift_adj.
// As lifting is checked if compound fails, p = (1 - p_compound) * p_lift.
// So, p_adj = p_lift / (1 - p_compound).
const int p_lift_adj =
CLOptions::emi_p_compound() == 100 ? CLOptions::emi_p_lift() : 100 * (
((float)CLOptions::emi_p_lift() / 100) /
(1.0f - ((float)CLOptions::emi_p_compound() / 100)));
for (Statement *st : block->stms) {
eStatementType st_type = st->eType;
// If it is a leaf.
if (st_type != eIfElse && st_type != eFor) {
if (rnd_flipcoin(CLOptions::emi_p_leaf())) del_stms.push_back(st);
continue;
}
// Nested blocks will be pruned regardless of pruning to ensure the random
// number generator is called the same number of times, otherwise later code
// that depends on it will produce a different output.
// Pruning should still be done when lifting.
if (st_type == eIfElse) {
StatementIf *st_if = dynamic_cast<StatementIf *>(st);
assert(st_if != NULL);
// 'const' haha yeah right.
PruneBlock(const_cast<Block *>(st_if->get_true_branch()));
PruneBlock(const_cast<Block *>(st_if->get_false_branch()));
} else {
StatementFor *st_for = dynamic_cast<StatementFor *>(st);
assert(st_for != NULL);
PruneBlock(const_cast<Block *>(st_for->get_body()));
}
// Call BOTH flip_coins, the prevent the RNG from going out of sync.
bool do_compound = rnd_flipcoin(CLOptions::emi_p_compound());
bool do_lift = rnd_flipcoin(p_lift_adj);
// Is a compound statement.
if (do_compound) {
del_stms.push_back(st);
continue;
}
// Lift case.
if (!do_lift) continue;
lift_stms.push_back(st);
/*if (st_type != eFor) continue;
// Go through the block deleting cont/break, unless there is a for loop.
std::vector<Statement *> jmp_stms;
std::unique_ptr<Walker::FunctionWalker> begin(
Walker::FunctionWalker::CreateFunctionWalkerAtStatement(func, st));
begin->Advance();
std::unique_ptr<Walker::FunctionWalker> end(
Walker::FunctionWalker::CreateFunctionWalkerAtStatement(func, st));
end->Next();
while (*begin != *end) {
eStatementType st_type = begin->GetCurrentStatementType();
if (st_type == eFor) {
begin->Next();
continue;
}
if (st_type == eContinue || st_type == eBreak)
jmp_stms.push_back(begin->GetCurrentStatement());
begin->Advance();
}
for (Statement *st : jmp_stms) st->parent->remove_stmt(st);*/
}
// Remove all the selected statements from the block.
for (Statement *st : del_stms) block->remove_stmt(st);
// First check if we are in a for loop before any lifting.
bool in_loop = false;
for (Block *nest = block; nest != NULL && !in_loop; nest = nest->parent)
if (nest->looping) in_loop = true;
// Lift marked statements.
std::vector<Statement *>::iterator position = block->stms.begin();
for (Statement *st : lift_stms) {
eStatementType st_type = st->eType;
assert(st_type == eIfElse || st_type == eFor);
for (; *position != st; ++position) assert(position != block->stms.end());
if (st_type == eIfElse) {
StatementIf *st_if = dynamic_cast<StatementIf *>(st);
assert(st_if != NULL);
position = MergeBlock(position, block,
const_cast<Block *>(st_if->get_true_branch()));
position = MergeBlock(position, block,
const_cast<Block *>(st_if->get_false_branch()));
} else {
StatementFor *st_for = dynamic_cast<StatementFor *>(st);
assert(st_for != NULL);
if (!in_loop) RemoveBreakContinue(const_cast<Block *>(st_for->get_body()));
position = MergeBlock(position, block,
const_cast<Block *>(st_for->get_body()));
}
}
// Now remove all lifted statements.
for (Statement *st : lift_stms) block->remove_stmt(st);
}
std::vector<Statement *>::iterator StatementEMI::MergeBlock(
std::vector<Statement *>::iterator position, Block *former, Block *merger) {
former->local_vars.insert(former->local_vars.end(),
merger->local_vars.begin(), merger->local_vars.end());
for (Statement *st : merger->deleted_stms) st->parent = former;
former->deleted_stms.insert(former->deleted_stms.end(),
merger->deleted_stms.begin(), merger->deleted_stms.end());
int stmt_count = merger->stms.size();
for (Statement *st : merger->stms) st->parent = former;
// GCC Bug 55817
//position = former->stms.insert(position,
// merger->stms.begin(), merger->stms.end());
{
stmt_count += std::distance(former->stms.begin(), position);
former->stms.insert(position, merger->stms.begin(), merger->stms.end());
position = former->stms.begin();
}
position += stmt_count;
merger->local_vars.clear();
merger->deleted_stms.clear();
merger->stms.clear();
return position;
}
void StatementEMI::RemoveBreakContinue(Block *block) {
std::vector<Statement *> del_stms;
for (Statement *st : block->stms) {
eStatementType st_type = st->eType;
if (st_type == eContinue || st_type == eBreak) del_stms.push_back(st);
if (st_type == eIfElse) {
// This is why we need the walker >:(
StatementIf *st_if = dynamic_cast<StatementIf *>(st);
assert(st_if != NULL);
RemoveBreakContinue(const_cast<Block *>(st_if->get_true_branch()));
RemoveBreakContinue(const_cast<Block *>(st_if->get_false_branch()));
}
}
for (Statement *st : del_stms) block->remove_stmt(st);
}
EMIController *EMIController::GetEMIController() {
if (emi_controller_inst == NULL) emi_controller_inst = CreateEMIController();
return emi_controller_inst;
}
void EMIController::ReleaseEMIController() {
delete emi_controller_inst;
emi_controller_inst = NULL;
}
EMIController *EMIController::CreateEMIController() {
// TODO this may need to be __const
return new EMIController(MemoryBuffer::CreateMemoryBuffer(
MemoryBuffer::kGlobal, "emi_input", &Type::get_simple_type(eInt), NULL,
{1024}));
}
bool EMIController::RemoveStatementEMI(StatementEMI *emi) {
std::vector<StatementEMI *>::iterator pos =
std::find(emi_sections_.begin(), emi_sections_.end(), emi);
if (pos != emi_sections_.end()) {
emi_sections_.erase(pos);
return true;
}
return false;
}
void EMIController::AddItemisedEMIInput(MemoryBuffer *item) {
assert(item->collective == emi_input_.get());
itemised_emi_input_.push_back(item);
}
void EMIController::PruneEMISections() {
for (StatementEMI *emi : emi_sections_) emi->Prune();
}
} // namespace CLSmith
| 38.588983 | 81 | 0.690128 | [
"vector"
] |
05ec369ae258dbb6d3ae772ed4fbe79697e8c5ff | 68,597 | cpp | C++ | Source/ToolCore/NETTools/NETProjectGen.cpp | elix22/AtomicGameEngine | 83bc2c12f1451aea0b5de691b512810f00d5ee06 | [
"Apache-2.0",
"MIT"
] | 3,170 | 2015-02-13T12:35:00.000Z | 2022-03-31T15:32:42.000Z | Source/ToolCore/NETTools/NETProjectGen.cpp | elix22/AtomicGameEngine | 83bc2c12f1451aea0b5de691b512810f00d5ee06 | [
"Apache-2.0",
"MIT"
] | 1,314 | 2015-02-13T12:30:08.000Z | 2021-11-22T14:10:02.000Z | Source/ToolCore/NETTools/NETProjectGen.cpp | elix22/AtomicGameEngine | 83bc2c12f1451aea0b5de691b512810f00d5ee06 | [
"Apache-2.0",
"MIT"
] | 683 | 2015-02-13T12:35:06.000Z | 2022-03-31T16:13:54.000Z | //
// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
//
// 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.
//
#include <Poco/UUID.h>
#include <Poco/UUIDGenerator.h>
#include <Atomic/IO/Log.h>
#include <Atomic/IO/File.h>
#include <Atomic/IO/FileSystem.h>
#include "../ToolEnvironment.h"
#include "../ToolSystem.h"
#include "../Project/ProjectSettings.h"
#include "../Project/Project.h"
#include "NETProjectGen.h"
#include "NETProjectSystem.h"
namespace ToolCore
{
NETProjectBase::NETProjectBase(Context* context, NETProjectGen* projectGen) :
Object(context), xmlFile_(new XMLFile(context)), projectGen_(projectGen)
{
}
NETProjectBase::~NETProjectBase()
{
}
void NETProjectBase::ReplacePathStrings(String& path) const
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
String atomicRoot = tenv->GetRootSourceDir();
atomicRoot = RemoveTrailingSlash(atomicRoot);
path.Replace("$ATOMIC_ROOT$", atomicRoot, false);
String atomicProjectPath = projectGen_->GetAtomicProjectPath();
// TODO: This is the cause of a bunch of "GetSanitizedPath" calls,
// It should be removed, and the few places in csproj/sln that need backslash
// adjusted there
atomicProjectPath.Replace("/", "\\");
if (atomicProjectPath.Length())
{
path.Replace("$ATOMIC_PROJECT_ROOT$", atomicProjectPath, false);
}
}
NETCSProject::NETCSProject(Context* context, NETProjectGen* projectGen) : NETProjectBase(context, projectGen),
atomicNETProject_(false),
genAssemblyDocFile_(false),
playerApplication_(false),
androidApplication_(false)
{
}
NETCSProject::~NETCSProject()
{
}
bool NETCSProject::SupportsDesktop() const
{
if (!platforms_.Size())
return true;
if (platforms_.Contains("desktop") || platforms_.Contains("windows") || platforms_.Contains("macosx") || platforms_.Contains("linux"))
return true;
return false;
}
bool NETCSProject::SupportsPlatform(const String& platform, bool explicitCheck) const
{
if (!explicitCheck && !platforms_.Size())
return true;
if (platforms_.Contains(platform.ToLower()))
return true;
return false;
}
bool NETCSProject::CreateProjectFolder(const String& path)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
if (fileSystem->DirExists(path))
return true;
fileSystem->CreateDirsRecursive(path);
if (!fileSystem->DirExists(path))
{
ATOMIC_LOGERRORF("Unable to create dir: %s", path.CString());
return false;
}
return true;
}
void NETCSProject::CreateCompileItemGroup(XMLElement &projectRoot)
{
FileSystem* fs = GetSubsystem<FileSystem>();
XMLElement igroup = projectRoot.CreateChild("ItemGroup");
// Compile AssemblyInfo.cs
if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
igroup.CreateChild("Compile").SetAttribute("Include", "Properties\\AssemblyInfo.cs");
for (unsigned i = 0; i < sourceFolders_.Size(); i++)
{
const String& sourceFolder = sourceFolders_[i];
Vector<String> result;
fs->ScanDir(result, sourceFolder, "*.cs", SCAN_FILES, true);
for (unsigned j = 0; j < result.Size(); j++)
{
XMLElement compile = igroup.CreateChild("Compile");
String path = sourceFolder + result[j];
String relativePath;
if (GetRelativePath(projectPath_, GetPath(path), relativePath))
{
path = relativePath + GetFileName(path) + GetExtension(path);
}
// IMPORTANT: / Slash direction breaks intellisense :/
path.Replace('/', '\\');
compile.SetAttribute("Include", path.CString());
String link = result[j];
// put generated files into generated folder
if (sourceFolder.Contains("Generated") && sourceFolder.Contains("CSharp") && sourceFolder.Contains("Packages"))
{
link = "Generated\\" + result[j];
}
link.Replace('/', '\\');
compile.CreateChild("Link").SetValue(link);
// For shared projects, ensure that the folder for the link exists, otherwise VS complains
// with little red x's and Resharper (potentially other tools) have issues
if (outputType_ == "Shared")
{
String pathName, fileName, extension;
SplitPath(link, pathName, fileName, extension);
if (extension == ".cs")
{
if (!fs->Exists(projectPath_ + pathName))
{
fs->CreateDirs(projectPath_, pathName);
}
}
}
}
}
}
void NETProjectBase::CopyXMLElementRecursive(XMLElement source, XMLElement dest)
{
Vector<String> attrNames = source.GetAttributeNames();
for (unsigned i = 0; i < attrNames.Size(); i++)
{
String value = source.GetAttribute(attrNames[i]);
dest.SetAttribute(attrNames[i], value);
}
dest.SetValue(source.GetValue());
XMLElement child = source.GetChild();
while (child.NotNull() && child.GetName().Length())
{
XMLElement childDest = dest.CreateChild(child.GetName());
CopyXMLElementRecursive(child, childDest);
child = child.GetNext();
}
}
void NETCSProject::CreateReferencesItemGroup(XMLElement &projectRoot)
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
const String atomicProjectPath = projectGen_->GetAtomicProjectPath();
XMLElement xref;
XMLElement igroup = projectRoot.CreateChild("ItemGroup");
for (unsigned i = 0; i < references_.Size(); i++)
{
String ref = references_[i];
String platform;
if (ref.StartsWith("AtomicNET"))
{
if (GetIsPCL())
{
ref = "AtomicNET";
platform = "Portable";
}
else if (SupportsDesktop())
{
ref = "AtomicNET";
platform = "Desktop";
}
else if (SupportsPlatform("android"))
{
if (ref != "AtomicNET.Android.SDL")
ref = "AtomicNET";
platform = "Android";
}
else if (SupportsPlatform("ios"))
{
ref = "AtomicNET";
platform = "iOS";
}
// When building Atomic Projects, assemblies will be in the Lib folder
String config = "Lib";
// If we're not building a project, assemblies will be either Debug or Release
if (!atomicProjectPath.Length())
{
#ifdef ATOMIC_DEBUG
config = "Debug";
#else
config = "Release";
#endif
}
if (platform.Length())
{
String relativeAssemblyPath;
if (GetRelativePath(projectPath_, GetParentPath(projectGen_->GetSolution()->GetOutputPath()), relativeAssemblyPath))
{
xref = igroup.CreateChild("Reference");
xref.SetAttribute("Include", ref);
// Specify the assembly path, which is the same based on native build
String assemblyPath = relativeAssemblyPath + ToString("%s/%s/%s.dll", config.CString(), platform.CString(), ref.CString());
// Setup hint paths with both release/debug config, although they point to same assembly, they don't need to
XMLElement hintPath = xref.CreateChild("HintPath");
hintPath.SetAttribute("Condition", "'$(Configuration)' == 'Release'");
hintPath.SetValue(assemblyPath);
hintPath = xref.CreateChild("HintPath");
hintPath.SetAttribute("Condition", "'$(Configuration)' == 'Debug'");
hintPath.SetValue(assemblyPath);
}
else
{
ATOMIC_LOGERRORF("NETCSProject::CreateReferencesItemGroup - Unable to get relative path from %s to solution", projectPath_.CString());
}
}
continue;
}
// NuGet project
if (ref.StartsWith("<"))
{
XMLFile xmlFile(context_);
if (!xmlFile.FromString(ref))
{
ATOMIC_LOGERROR("NETCSProject::CreateReferencesItemGroup - Unable to parse reference XML");
}
xref = igroup.CreateChild("Reference");
CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
continue;
}
xref = igroup.CreateChild("Reference");
xref.SetAttribute("Include", ref);
}
if (atomicProjectPath.Length())
{
String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
Vector<String> result;
GetSubsystem<FileSystem>()->ScanDir(result, resourceDir , "*.dll", SCAN_FILES, true);
for (unsigned j = 0; j < result.Size(); j++)
{
String path = resourceDir + result[j];
String relativePath;
if (GetRelativePath(projectPath_, GetPath(path), relativePath))
{
if (projectGen_->GetCSProjectByName(GetFileName(path)))
continue;
path = relativePath + GetFileName(path) + GetExtension(path);
}
xref = igroup.CreateChild("Reference");
xref.SetAttribute("Include", path);
}
}
}
void NETCSProject::CreatePackagesItemGroup(XMLElement &projectRoot)
{
if (!packages_.Size())
return;
XMLElement xref;
XMLElement igroup = projectRoot.CreateChild("ItemGroup");
xref = igroup.CreateChild("None");
xref.SetAttribute("Include", "packages.config");
XMLFile packageConfig(context_);
XMLElement packageRoot = packageConfig.CreateRoot("packages");
for (unsigned i = 0; i < packages_.Size(); i++)
{
XMLFile xmlFile(context_);
if (!xmlFile.FromString(packages_[i]))
{
ATOMIC_LOGERROR("NETCSProject::CreatePackagesItemGroup - Unable to parse package xml");
}
xref = packageRoot.CreateChild("package");
CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
}
SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + "packages.config"), FILE_WRITE));
String source = packageConfig.ToString();
output->Write(source.CString(), source.Length());
}
void NETCSProject::GetAssemblySearchPaths(String& paths)
{
paths.Clear();
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
Vector<String> searchPaths;
if (assemblySearchPaths_.Length())
searchPaths.Push(assemblySearchPaths_);
paths.Join(searchPaths, ";");
}
void NETCSProject::ProcessDefineConstants(StringVector& constants)
{
const Vector<String>& globalConstants = projectGen_->GetGlobalDefineConstants();
constants += globalConstants;
if (constants.Contains("ATOMIC_IOS") || constants.Contains("ATOMIC_ANDROID"))
constants.Push("ATOMIC_MOBILE");
}
String NETCSProject::GetRelativeOutputPath(const String& config) const
{
String outputPath = assemblyOutputPath_;
outputPath.Replace("$ATOMIC_CONFIG$", config);
if (IsAbsolutePath(outputPath))
{
String atomicProjectPath = projectGen_->GetAtomicProjectPath();
if (atomicProjectPath.Length())
{
if (!GetRelativeProjectPath(outputPath, projectPath_, outputPath))
{
ATOMIC_LOGERRORF("NETCSProject::CreateReleasePropertyGroup - unable to get relative output path");
}
}
}
return outputPath;
}
void NETCSProject::CreateReleasePropertyGroup(XMLElement &projectRoot)
{
XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
if (playerApplication_ && SupportsPlatform("ios"))
pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Release|iPhone' ");
else
pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ");
pgroup.CreateChild("Optimize").SetValue("true");
String config = "Release";
#ifdef ATOMIC_DEV_BUILD
// If we're a core AtomicNET assembly and a project is included in solution
// output to Lib so that development changes will be picked up by project reference
if (atomicNETProject_ && projectGen_->GetAtomicProjectPath().Length())
config = "Lib";
#endif
String outputPath = GetRelativeOutputPath(config);
pgroup.CreateChild("OutputPath").SetValue(outputPath);
Vector<String> constants;
constants.Push("TRACE");
constants += defineConstants_;
ProcessDefineConstants(constants);
pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
pgroup.CreateChild("ErrorReport").SetValue("prompt");
pgroup.CreateChild("WarningLevel").SetValue("4");
pgroup.CreateChild("ConsolePause").SetValue("false");
pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
// 1591 - Don't warn on missing documentation
// 1570 - malformed xml, remove once (https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1161) resolved
pgroup.CreateChild("NoWarn").SetValue("1591;1570");
if (genAssemblyDocFile_)
{
pgroup.CreateChild("DocumentationFile").SetValue(outputPath + assemblyName_ + ".xml");
}
if (SupportsDesktop())
{
pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
if (!GetIsPCL())
pgroup.CreateChild("PlatformTarget").SetValue("x64");
#ifndef ATOMIC_PLATFORM_WINDOWS
String startArguments;
#ifndef ATOMIC_DEV_BUILD
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_OSX
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "../Resources/").CString());
#else
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "Resources/").CString());
#endif
#endif
startArguments += ToString("--project \"%s\"", projectGen_->GetAtomicProjectPath().CString());
pgroup.CreateChild("Commandlineparameters").SetValue(startArguments);
#endif
}
else
{
if (SupportsPlatform("android"))
{
pgroup.CreateChild("DebugType").SetValue("pdbonly");
if (outputType_.ToLower() != "library")
{
pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
pgroup.CreateChild("AndroidLinkMode").SetValue("SdkOnly");
}
}
else if (playerApplication_ && SupportsPlatform("ios"))
{
pgroup.CreateChild("DebugType").SetValue("none");
pgroup.CreateChild("MtouchArch").SetValue("ARMv7, ARM64");
pgroup.CreateChild("CodesignEntitlements").SetValue(GetSanitizedPath(codesignEntitlements_));
pgroup.CreateChild("CodesignKey").SetValue("iPhone Developer");
pgroup.CreateChild("MtouchDebug").SetValue("true");
pgroup.CreateChild("MtouchOptimizePNGs").SetValue("False");
}
}
}
void NETCSProject::CreateDebugPropertyGroup(XMLElement &projectRoot)
{
XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
if (playerApplication_ && SupportsPlatform("ios"))
pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Debug|iPhone' ");
else
pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ");
pgroup.CreateChild("Optimize").SetValue("false");
String config = "Debug";
#ifdef ATOMIC_DEV_BUILD
// If we're a core AtomicNET assembly and a project is included in solution
// output to Lib so that development changes will be picked up by project reference
if (atomicNETProject_ && projectGen_->GetAtomicProjectPath().Length())
config = "Lib";
#endif
String outputPath = GetRelativeOutputPath(config);
pgroup.CreateChild("OutputPath").SetValue(outputPath);
Vector<String> constants;
constants.Push("DEBUG");
constants.Push("TRACE");
constants += defineConstants_;
ProcessDefineConstants(constants);
pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
pgroup.CreateChild("ErrorReport").SetValue("prompt");
pgroup.CreateChild("WarningLevel").SetValue("4");
pgroup.CreateChild("ConsolePause").SetValue("false");
pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
// 1591 - Don't warn on missing documentation
// 1570 - malformed xml, remove once (https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1161) resolved
pgroup.CreateChild("NoWarn").SetValue("1591;1570");
pgroup.CreateChild("DebugSymbols").SetValue("true");
if (genAssemblyDocFile_)
{
pgroup.CreateChild("DocumentationFile").SetValue(outputPath + assemblyName_ + ".xml");
}
if (SupportsDesktop())
{
pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
if (!GetIsPCL())
pgroup.CreateChild("PlatformTarget").SetValue("x64");
#ifndef ATOMIC_PLATFORM_WINDOWS
String startArguments;
#ifndef ATOMIC_DEV_BUILD
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_OSX
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "../Resources/").CString());
#else
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "Resources/").CString());
#endif
#endif
startArguments += ToString("--project \"%s\"", projectGen_->GetAtomicProjectPath().CString());
pgroup.CreateChild("Commandlineparameters").SetValue(startArguments);
#endif
}
else
{
pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
if (androidApplication_)
{
pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
pgroup.CreateChild("AndroidLinkMode").SetValue("None");
pgroup.CreateChild("EmbedAssembliesIntoApk").SetValue("True");
pgroup.CreateChild("BundleAssemblies").SetValue("False");
pgroup.CreateChild("AndroidCreatePackagePerAbi").SetValue("False");
pgroup.CreateChild("Debugger").SetValue("Xamarin");
pgroup.CreateChild("AndroidEnableMultiDex").SetValue("False");
pgroup.CreateChild("AndroidSupportedAbis").SetValue("armeabi-v7a");
}
else if (playerApplication_ && SupportsPlatform("ios"))
{
pgroup.CreateChild("MtouchArch").SetValue("ARMv7, ARM64");
pgroup.CreateChild("CodesignEntitlements").SetValue(GetSanitizedPath(codesignEntitlements_));
pgroup.CreateChild("CodesignKey").SetValue("iPhone Developer");
pgroup.CreateChild("MtouchDebug").SetValue("true");
pgroup.CreateChild("MtouchFastDev").SetValue("true");
pgroup.CreateChild("IpaPackageName").SetValue("");
pgroup.CreateChild("OptimizePNGs").SetValue("false");
pgroup.CreateChild("MtouchOptimizePNGs").SetValue("False");
}
}
}
void NETCSProject::CreateApplicationItems(XMLElement &projectRoot)
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
XMLElement itemGroup = projectRoot.CreateChild("ItemGroup");
if (SupportsDesktop())
{
// AtomicNETNative
XMLElement atomicNETNativeDLL = itemGroup.CreateChild("None");
#ifdef ATOMIC_DEBUG
String config = "Debug";
#else
String config = "Release";
#endif
#ifdef ATOMIC_PLATFORM_WINDOWS
String platform = "Windows";
String filename = "AtomicNETNative.dll";
#elif defined(ATOMIC_PLATFORM_OSX)
String platform = "Mac";
String filename = "libAtomicNETNative.dylib";
#elif defined(ATOMIC_PLATFORM_LINUX)
String platform = "Linux";
String filename = "libAtomicNETNative.so";
#endif
String relativeNativePath;
String configPath = config;
if (projectGen_->GetAtomicProjectPath().Length())
configPath = "Lib";
if (GetRelativePath(projectPath_, GetParentPath(projectGen_->GetSolution()->GetOutputPath()), relativeNativePath))
{
String nativePath = relativeNativePath + configPath + "/Native/" + platform + "/" + filename;
atomicNETNativeDLL.SetAttribute("Include", nativePath);
atomicNETNativeDLL.CreateChild("Link").SetValue(filename);
atomicNETNativeDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
#ifdef ATOMIC_PLATFORM_WINDOWS
XMLElement d3dCompilerDLL = itemGroup.CreateChild("None");
String d3dCompilerPath = relativeNativePath + configPath + "/Native/" + platform + "/D3DCompiler_47.dll";
d3dCompilerDLL.SetAttribute("Include", d3dCompilerPath);
d3dCompilerDLL.CreateChild("Link").SetValue("D3DCompiler_47.dll");
d3dCompilerDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
#endif
}
}
else
{
const String& projectPath = projectGen_->GetAtomicProjectPath();
if (!playerApplication_ || !projectPath.Length())
return;
if (androidApplication_)
{
XMLElement androidAsset = itemGroup.CreateChild("AndroidAsset");
androidAsset.SetAttribute("Include", projectPath + "AtomicNET/Resources/AtomicResources.pak");
androidAsset.CreateChild("Link").SetValue("Assets\\AtomicResources.pak");
}
else
{
XMLElement bundleResource = itemGroup.CreateChild("BundleResource");
bundleResource.SetAttribute("Include", projectPath + "AtomicNET/Resources/AtomicResources.pak");
bundleResource.CreateChild("Link").SetValue("Resources\\AtomicResources.pak");
bundleResource.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
}
}
}
void NETCSProject::CreateIOSItems(XMLElement &projectRoot)
{
XMLElement iosGroup = projectRoot.CreateChild("ItemGroup");
if (objcBindingApiDefinition_.Length())
{
iosGroup.CreateChild("ObjcBindingApiDefinition").SetAttribute("Include", GetSanitizedPath(objcBindingApiDefinition_));
}
if (name_ == "AtomicNET.iOS")
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
#ifdef ATOMIC_DEBUG
String config = "Debug";
#else
String config = "Release";
#endif
String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/iOS/AtomicNETNative.framework";
iosGroup.CreateChild("ObjcBindingNativeFramework").SetAttribute("Include", GetSanitizedPath(nativePath));
// framework copy
XMLElement none = iosGroup.CreateChild("None");
none.SetAttribute("Include", nativePath + ".zip");
none.CreateChild("Link").SetValue("AtomicNETNative.framework.zip");
none.CreateChild("CopyToOutputDirectory").SetValue("Always");
}
else if (playerApplication_)
{
XMLElement plist = iosGroup.CreateChild("None");
plist.SetAttribute("Include", GetSanitizedPath(infoPList_));
plist.CreateChild("Link").SetValue("Info.plist");
XMLElement entitlements = iosGroup.CreateChild("Content");
entitlements.SetAttribute("Include", GetSanitizedPath(codesignEntitlements_));
entitlements.CreateChild("Link").SetValue("Entitlements.plist");
}
}
void NETCSProject::CreateAndroidItems(XMLElement &projectRoot)
{
if (!libraryProjectZips_.Size())
{
}
if (libraryProjectZips_.Size())
{
XMLElement libraryGroup = projectRoot.CreateChild("ItemGroup");
for (unsigned i = 0; i < libraryProjectZips_.Size(); i++)
{
libraryGroup.CreateChild("LibraryProjectZip").SetAttribute("Include", libraryProjectZips_[i].CString());
}
}
if (transformFiles_.Size())
{
XMLElement transformGroup = projectRoot.CreateChild("ItemGroup");
for (unsigned i = 0; i < transformFiles_.Size(); i++)
{
transformGroup.CreateChild("TransformFile").SetAttribute("Include", transformFiles_[i].CString());
}
}
if (!importProjects_.Size())
{
projectRoot.CreateChild("Import").SetAttribute("Project", "$(MSBuildExtensionsPath)\\Xamarin\\Android\\Xamarin.Android.CSharp.targets");
}
if (androidApplication_)
{
// TODO: other abi
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
#ifdef ATOMIC_DEBUG
String config = "Debug";
#else
String config = "Release";
#endif
// TODO: more than armeabi-v7a (which this is)
String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/Android/libAtomicNETNative.so";
XMLElement nativeLibrary = projectRoot.CreateChild("ItemGroup").CreateChild("AndroidNativeLibrary");
nativeLibrary.SetAttribute("Include", nativePath);
nativeLibrary.CreateChild("Link").SetValue("Libs\\armeabi-v7a\\libAtomicNETNative.so");
XMLElement resourceGroup = projectRoot.CreateChild("ItemGroup");
String relativePath;
if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/values/Strings.xml", projectPath_, relativePath))
{
relativePath.Replace("/", "\\");
XMLElement strings = resourceGroup.CreateChild("AndroidResource");
strings.SetAttribute("Include", relativePath);
// Link has to exist for manifest to find resource!
strings.CreateChild("Link").SetValue("Resources\\values\\Strings.xml");
}
else
{
ATOMIC_LOGERROR("Unabled to get relative path for Strings.xml");
}
if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/drawable/icon.png", projectPath_, relativePath))
{
relativePath.Replace("/", "\\");
XMLElement icon = resourceGroup.CreateChild("AndroidResource");
icon.SetAttribute("Include", relativePath);
// Link has to exist for manifest to find resource!
icon.CreateChild("Link").SetValue("Resources\\drawable\\icon.png");
}
else
{
ATOMIC_LOGERROR("Unabled to get relative path for Icon.png");
}
}
}
void NETCSProject::CreateAssemblyInfo()
{
String info = "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n\n";
info += ToString("[assembly:AssemblyTitle(\"%s\")]\n", name_.CString());
info += "[assembly:AssemblyDescription(\"\")]\n";
info += "[assembly:AssemblyConfiguration(\"\")]\n";
info += "[assembly:AssemblyCompany(\"\")]\n";
info += ToString("[assembly:AssemblyProduct(\"%s\")]\n", name_.CString());
info += "\n\n\n";
info += "[assembly:ComVisible(false)]\n";
info += "\n\n";
info += ToString("[assembly:Guid(\"%s\")]\n", projectGuid_.CString());
info += "\n\n";
info += "[assembly:AssemblyVersion(\"1.0.0.0\")]\n";
info += "[assembly:AssemblyFileVersion(\"1.0.0.0\")]\n";
SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + "Properties/AssemblyInfo.cs"), FILE_WRITE));
output->Write(info.CString(), info.Length());
}
bool NETCSProject::GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output) const
{
String path = fromPath;
ReplacePathStrings(path);
path = GetSanitizedPath(path);
String relativePath;
if (GetRelativePath(projectPath_, GetPath(path), relativePath))
{
path = relativePath + GetFileName(path) + GetExtension(path);
output = path;
return true;
}
output = fromPath;
return false;
}
void NETCSProject::CreateMainPropertyGroup(XMLElement& projectRoot)
{
XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
// Configuration
XMLElement config = pgroup.CreateChild("Configuration");
config.SetAttribute("Condition", " '$(Configuration)' == '' ");
config.SetValue("Debug");
// Platform
XMLElement platform = pgroup.CreateChild("Platform");
platform.SetAttribute("Condition", " '$(Platform)' == '' ");
if (playerApplication_ && SupportsPlatform("ios"))
platform.SetValue("iPhone");
else
platform.SetValue("AnyCPU");
// ProjectGuid
XMLElement guid = pgroup.CreateChild("ProjectGuid");
guid.SetValue("{" + projectGuid_ + "}");
// OutputType
XMLElement outputType = pgroup.CreateChild("OutputType");
String oType = outputType_;
#ifdef ATOMIC_PLATFORM_WINDOWS
#ifndef ATOMIC_DEBUG
if (oType.ToLower() == "exe")
{
// use windows subsystem for release builds
// TODO: make this an option in the json?
oType = "WinExe";
}
#endif
#endif
outputType.SetValue(oType);
pgroup.CreateChild("AppDesignerFolder").SetValue("Properties");
// RootNamespace
XMLElement rootNamespace = pgroup.CreateChild("RootNamespace");
rootNamespace.SetValue(rootNamespace_);
// AssemblyName
XMLElement assemblyName = pgroup.CreateChild("AssemblyName");
assemblyName.SetValue(assemblyName_);
pgroup.CreateChild("FileAlignment").SetValue("512");
if (projectTypeGuids_.Size())
{
pgroup.CreateChild("ProjectTypeGuids").SetValue(String::Joined(projectTypeGuids_, ";"));
}
if (SupportsDesktop())
{
pgroup.CreateChild("TargetFrameworkVersion").SetValue("v4.5");
}
else
{
pgroup.CreateChild("ProductVersion").SetValue("8.0.30703");
pgroup.CreateChild("SchemaVersion").SetValue("2.0");
if (SupportsPlatform("ios"))
{
pgroup.CreateChild("IPhoneResourcePrefix").SetValue("Resources");
}
else
{
pgroup.CreateChild("TargetFrameworkVersion").SetValue("v6.0");
}
if (SupportsPlatform("android"))
{
if (!projectTypeGuids_.Size())
{
pgroup.CreateChild("ProjectTypeGuids").SetValue("{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
}
pgroup.CreateChild("AndroidUseLatestPlatformSdk").SetValue("True");
if (!androidApplication_)
{
// 10368E6C-D01B-4462-8E8B-01FC667A7035 is a binding library
if (!projectTypeGuids_.Contains("{10368E6C-D01B-4462-8E8B-01FC667A7035}"))
pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
}
else
{
// Android Application
pgroup.CreateChild("AndroidApplication").SetValue("true");
// AndroidManifest.xml must reside in Properties/AndroidManifest.xml, which introduces sync issues :/
pgroup.CreateChild("AndroidManifest").SetValue("Properties\\AndroidManifest.xml");
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String manifestSourceFile = "$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Properties/AndroidManifest.xml";
ReplacePathStrings(manifestSourceFile);
manifestSourceFile = GetSanitizedPath(manifestSourceFile);
if (fileSystem->FileExists(manifestSourceFile))
{
String manifestDest = GetSanitizedPath(projectPath_ + "Properties/");
if (!fileSystem->DirExists(manifestDest))
{
fileSystem->CreateDirs(GetSanitizedPath(projectGen_->GetAtomicProjectPath()), ToString("/AtomicNET/Solution/%s/Properties/", name_.CString()));
}
if (fileSystem->DirExists(manifestDest))
{
if (!fileSystem->Copy(manifestSourceFile, manifestDest + "AndroidManifest.xml"))
{
ATOMIC_LOGERRORF("Unable to copy AndroidManifest from %s to %s", manifestSourceFile.CString(), manifestDest.CString());
}
}
else
{
ATOMIC_LOGERRORF("Unable to create folder %s for AndroidManifest.xml", manifestDest.CString());
}
}
else
{
ATOMIC_LOGERRORF("No AndroidManifest.xml, project will not deploy (%s)", manifestSourceFile.CString());
}
String relativePath;
if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/Resource.Designer.cs", projectPath_, relativePath))
{
relativePath.Replace("/", "\\");
pgroup.CreateChild("AndroidResgenFile").SetValue(relativePath);
}
else
{
ATOMIC_LOGERROR("Unabled to get relative path for AndroidResgenFile");
}
pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
}
}
}
if (targetFrameworkProfile_.Length())
{
pgroup.CreateChild("TargetFrameworkProfile").SetValue(targetFrameworkProfile_);
}
}
bool NETCSProject::GenerateShared()
{
// .shproj
XMLElement project = xmlFile_->CreateRoot("Project");
project.SetAttribute("DefaultTargets", "Build");
project.SetAttribute("ToolsVersion", "14.0");
project.SetAttribute("DefaultTargets", "Build");
project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
// Project Group
XMLElement projectGroup = project.CreateChild("PropertyGroup");
projectGroup.SetAttribute("Label", "Globals");
projectGroup.CreateChild("ProjectGuid").SetValue(projectGuid_);
projectGroup.CreateChild("MinimumVisualStudioVersion").SetValue("14.0");
XMLElement import = project.CreateChild("Import");
import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
import = project.CreateChild("Import");
import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.Default.props");
import = project.CreateChild("Import");
import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.props");
import = project.CreateChild("Import");
import.SetAttribute("Project", ToString("%s.projitems", name_.CString()));
import.SetAttribute("Label", "Shared");
import = project.CreateChild("Import");
import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.CSharp.targets");
String projectSource = xmlFile_->ToString();
SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".shproj"), FILE_WRITE));
output->Write(projectSource.CString(), projectSource.Length());
// projitems
SharedPtr<XMLFile> itemsXMLFile(new XMLFile(context_));
XMLElement itemsProject = itemsXMLFile->CreateRoot("Project");
itemsProject.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
XMLElement propertyGroup = itemsProject.CreateChild("PropertyGroup");
propertyGroup.CreateChild("MSBuildAllProjects").SetValue("$(MSBuildAllProjects);$(MSBuildThisFileFullPath)");
propertyGroup.CreateChild("HasSharedItems").SetValue("true");
propertyGroup.CreateChild("SharedGUID").SetValue(projectGuid_);
propertyGroup = itemsProject.CreateChild("PropertyGroup");
propertyGroup.SetAttribute("Label", "Configuration");
propertyGroup.CreateChild("Import_RootNamespace").SetValue("AtomicEngine");
CreateCompileItemGroup(itemsProject);
String itemSource = itemsXMLFile->ToString();
SharedPtr<File> itemsOutput(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".projitems"), FILE_WRITE));
itemsOutput->Write(itemSource.CString(), itemSource.Length());
return true;
}
bool NETCSProject::GenerateStandard()
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
NETSolution* solution = projectGen_->GetSolution();
XMLElement project = xmlFile_->CreateRoot("Project");
project.SetAttribute("DefaultTargets", "Build");
project.SetAttribute("ToolsVersion", "14.0");
project.SetAttribute("DefaultTargets", "Build");
project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
XMLElement import = project.CreateChild("Import");
import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
CreateMainPropertyGroup(project);
CreateDebugPropertyGroup(project);
CreateReleasePropertyGroup(project);
CreateReferencesItemGroup(project);
CreateCompileItemGroup(project);
CreatePackagesItemGroup(project);
if (SupportsPlatform("android"))
{
CreateAndroidItems(project);
}
if (SupportsPlatform("ios"))
{
CreateIOSItems(project);
}
if (SupportsDesktop() && !GetIsPCL())
project.CreateChild("Import").SetAttribute("Project", "$(MSBuildToolsPath)\\Microsoft.CSharp.targets");
if (outputType_.ToLower() == "exe" || androidApplication_)
{
CreateApplicationItems(project);
}
if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
CreateAssemblyInfo();
const String& atomicProjectPath = projectGen_->GetAtomicProjectPath();
if (atomicProjectPath.Length())
{
// Create the AtomicProject.csproj.user file if it doesn't exist
String userSettingsFilename = projectPath_ + name_ + ".csproj.user";
if (!fileSystem->FileExists(userSettingsFilename))
{
SharedPtr<XMLFile> userSettings(new XMLFile(context_));
XMLElement project = userSettings->CreateRoot("Project");
project.SetAttribute("ToolsVersion", "14.0");
project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
StringVector configs;
configs.Push("Debug");
configs.Push("Release");
for (unsigned i = 0; i < configs.Size(); i++)
{
String cfg = configs[i];
XMLElement propertyGroup = project.CreateChild("PropertyGroup");
propertyGroup.SetAttribute("Condition", ToString("'$(Configuration)|$(Platform)' == '%s|AnyCPU'", cfg.CString()));
String startArguments;
#ifndef ATOMIC_DEV_BUILD
#ifdef ATOMIC_PLATFORM_OSX
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "../Resources/").CString());
#else
startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "Resources/").CString());
#endif
#endif
propertyGroup.CreateChild("StartAction").SetValue("Project");
startArguments += ToString("--project \"%s\"", atomicProjectPath.CString());
propertyGroup.CreateChild("StartArguments").SetValue(startArguments);
// Always enabled unmanaged debugging, solve issues with release building hanging when run from IDE
propertyGroup.CreateChild("EnableUnmanagedDebugging").SetValue("true");
}
String userSettingsSource = userSettings->ToString();
SharedPtr<File> output(new File(context_, GetSanitizedPath(userSettingsFilename), FILE_WRITE));
output->Write(userSettingsSource.CString(), userSettingsSource.Length());
output->Close();
}
}
for (unsigned i = 0; i < sharedReferences_.Size(); i++)
{
NETCSProject* sharedProject = projectGen_->GetCSProjectByName(sharedReferences_[i]);
if (!sharedProject)
{
ATOMIC_LOGERRORF("Unable to get shared project %s", sharedReferences_[i].CString());
continue;
}
String path = sharedProject->projectPath_ + sharedReferences_[i] + ".projitems";
String relativePath;
if (GetRelativePath(projectPath_, GetPath(path), relativePath))
{
path = relativePath + GetFileName(path) + GetExtension(path);
}
XMLElement shared = project.CreateChild("Import");
shared.SetAttribute("Project", path);
shared.SetAttribute("Label", "Shared");
}
for (unsigned i = 0; i < importProjects_.Size(); i++)
{
project.CreateChild("Import").SetAttribute("Project", importProjects_[i].CString());
}
// Have to come after the imports, so AfterBuild exists
String projectName = "AtomicProject";
if (projectGen_->GetProjectSettings())
projectName = projectGen_->GetProjectSettings()->GetName();
XMLElement afterBuild;
if (name_ == projectName)
{
if (afterBuild.IsNull())
{
afterBuild = project.CreateChild("Target");
afterBuild.SetAttribute("Name", "AfterBuild");
}
XMLElement copy = afterBuild.CreateChild("Copy");
copy.SetAttribute("SourceFiles", "$(TargetPath)");
String destPath = projectPath_ + "../../../Resources/";
String relativePath;
String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
if (GetRelativePath(projectPath_, resourceDir, relativePath))
{
destPath = AddTrailingSlash(relativePath);
}
copy.SetAttribute("DestinationFolder", destPath);
}
#ifdef ATOMIC_DEV_BUILD
#ifndef ATOMIC_PLATFORM_WINDOWS
// On xbuild, mdb files for references aren't being copied to output folders for desktop
if (platforms_.Size() == 1 && SupportsDesktop() && outputType_.ToLower() == "exe")
{
if (afterBuild.IsNull())
{
afterBuild = project.CreateChild("Target");
afterBuild.SetAttribute("Name", "AfterBuild");
}
// mdb file item group
XMLElement mdbItemGroup = project.CreateChild("ItemGroup");
mdbItemGroup.CreateChild("AtomicNETMDBFiles").SetAttribute("Include", "..\\..\\Lib\\Desktop\\**\\*.mdb");
// Debug
XMLElement copyOp = afterBuild.CreateChild("Copy");
copyOp.SetAttribute("Condition", "'$(Configuration)' == 'Debug'");
copyOp.SetAttribute("SourceFiles", "@(AtomicNETMDBFiles)");
copyOp.SetAttribute("DestinationFiles", "@(AtomicNETMDBFiles->'..\\..\\Debug\\Bin\\Desktop\\%(Filename)%(Extension)')");
// Release
copyOp = afterBuild.CreateChild("Copy");
copyOp.SetAttribute("Condition", "'$(Configuration)' == 'Release'");
copyOp.SetAttribute("SourceFiles", "@(AtomicNETMDBFiles)");
copyOp.SetAttribute("DestinationFiles", "@(AtomicNETMDBFiles->'..\\..\\Release\\Bin\\Desktop\\%(Filename)%(Extension)')");
}
#endif
#endif
String projectSource = xmlFile_->ToString();
SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".csproj"), FILE_WRITE));
output->Write(projectSource.CString(), projectSource.Length());
return true;
}
bool NETCSProject::Generate()
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
NETSolution* solution = projectGen_->GetSolution();
projectPath_ = solution->GetOutputPath() + name_ + "/";
if (!CreateProjectFolder(projectPath_))
return false;
if (!CreateProjectFolder(projectPath_ + "Properties"))
return false;
if (outputType_ == "Shared")
{
return GenerateShared();
}
return GenerateStandard();
}
bool NETCSProject::Load(const JSONValue& root)
{
name_ = root["name"].GetString();
projectGuid_ = root["projectGuid"].GetString();
if (!projectGuid_.Length())
{
ATOMIC_LOGINFOF("GUID not provided for project %s, generating one", name_.CString());
projectGuid_ = projectGen_->GenerateUUID();
}
outputType_ = root["outputType"].GetString();
atomicNETProject_ = root["atomicNET"].GetBool();
androidApplication_ = root["androidApplication"].GetBool();
playerApplication_ = root["playerApplication"].GetBool();
genAssemblyDocFile_ = root["assemblyDocFile"].GetBool();
rootNamespace_ = root["rootNamespace"].GetString();
assemblyName_ = root["assemblyName"].GetString();
assemblyOutputPath_ = root["assemblyOutputPath"].GetString();
ReplacePathStrings(assemblyOutputPath_);
assemblyOutputPath_ = GetSanitizedPath(assemblyOutputPath_);
assemblySearchPaths_ = root["assemblySearchPaths"].GetString();
ReplacePathStrings(assemblySearchPaths_);
assemblySearchPaths_ = GetSanitizedPath(assemblySearchPaths_);
const JSONArray& platforms = root["platforms"].GetArray();
for (unsigned i = 0; i < platforms.Size(); i++)
{
String platform = platforms[i].GetString();
platforms_.Push(platform.ToLower());
}
const JSONArray& references = root["references"].GetArray();
for (unsigned i = 0; i < references.Size(); i++)
{
String reference = references[i].GetString();
ReplacePathStrings(reference);
references_.Push(reference);
}
const JSONArray& packages = root["packages"].GetArray();
for (unsigned i = 0; i < packages.Size(); i++)
{
String package = packages[i].GetString();
if (packages_.Find(package) != packages_.End())
{
ATOMIC_LOGERRORF("Duplicate package found %s", package.CString());
continue;
}
projectGen_->GetSolution()->RegisterPackage(package);
packages_.Push(package);
}
const JSONArray& sources = root["sources"].GetArray();
for (unsigned i = 0; i < sources.Size(); i++)
{
String source = sources[i].GetString();
ReplacePathStrings(source);
sourceFolders_.Push(AddTrailingSlash(source));
}
const JSONArray& defineConstants = root["defineConstants"].GetArray();
for (unsigned i = 0; i < defineConstants.Size(); i++)
{
defineConstants_.Push(defineConstants[i].GetString());
}
const JSONArray& projectTypeGuids = root["projectTypeGuids"].GetArray();
for (unsigned i = 0; i < projectTypeGuids.Size(); i++)
{
String guid = projectTypeGuids[i].GetString();
projectTypeGuids_.Push(ToString("{%s}", guid.CString()));
}
const JSONArray& importProjects = root["importProjects"].GetArray();
for (unsigned i = 0; i < importProjects.Size(); i++)
{
importProjects_.Push(importProjects[i].GetString());
}
const JSONArray& libraryProjectZips = root["libraryProjectZips"].GetArray();
for (unsigned i = 0; i < libraryProjectZips.Size(); i++)
{
String zipPath = libraryProjectZips[i].GetString();
ReplacePathStrings(zipPath);
libraryProjectZips_.Push(zipPath);
}
const JSONArray& transformFiles = root["transformFiles"].GetArray();
for (unsigned i = 0; i < transformFiles.Size(); i++)
{
String transformFile = transformFiles[i].GetString();
ReplacePathStrings(transformFile);
transformFiles_.Push(transformFile);
}
const JSONArray& sharedReferences = root["sharedReferences"].GetArray();
for (unsigned i = 0; i < sharedReferences.Size(); i++)
{
sharedReferences_.Push(sharedReferences[i].GetString());
}
targetFrameworkProfile_ = root["targetFrameworkProfile"].GetString();
// iOS
objcBindingApiDefinition_ = root["objcBindingApiDefinition"].GetString();
ReplacePathStrings(objcBindingApiDefinition_);
codesignEntitlements_ = root["codesignEntitlements"].GetString();
ReplacePathStrings(codesignEntitlements_);
infoPList_ = root["infoPList"].GetString();
ReplacePathStrings(infoPList_);
return true;
}
NETSolution::NETSolution(Context* context, NETProjectGen* projectGen, bool rewrite) : NETProjectBase(context, projectGen),
rewriteSolution_(rewrite)
{
}
NETSolution::~NETSolution()
{
}
bool NETSolution::Generate()
{
String slnPath = outputPath_ + name_ + ".sln";
GenerateSolution(slnPath);
return true;
}
void NETSolution::GenerateSolution(const String &slnPath)
{
String source = "Microsoft Visual Studio Solution File, Format Version 12.00\n";
source += "# Visual Studio 14\n";
source += "VisualStudioVersion = 14.0.25420.1\n";
source += "MinimumVisualStudioVersion = 10.0.40219.1\n";
solutionGUID_ = projectGen_->GenerateUUID();
PODVector<NETCSProject*> depends;
const Vector<SharedPtr<NETCSProject>>& projects = projectGen_->GetCSProjects();
for (unsigned i = 0; i < projects.Size(); i++)
{
NETCSProject* p = projects.At(i);
const String& projectName = p->GetName();
const String& projectGUID = p->GetProjectGUID();
String CSharpProjectGUID = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
String ext = "csproj";
if (p->outputType_ == "Shared")
{
CSharpProjectGUID = "D954291E-2A0B-460D-934E-DC6B0785DB48";
ext = "shproj";
}
source += ToString("Project(\"{%s}\") = \"%s\", \"%s\\%s.%s\", \"{%s}\"\n",
CSharpProjectGUID.CString(), projectName.CString(), projectName.CString(),
projectName.CString(), ext.CString(), projectGUID.CString());
projectGen_->GetCSProjectDependencies(p, depends);
if (depends.Size())
{
source += "\tProjectSection(ProjectDependencies) = postProject\n";
for (unsigned j = 0; j < depends.Size(); j++)
{
source += ToString("\t{%s} = {%s}\n",
depends[j]->GetProjectGUID().CString(), depends[j]->GetProjectGUID().CString());
}
source += "\tEndProjectSection\n";
}
source += "EndProject\n";
}
source += "Global\n";
// SharedMSBuildProjectFiles
source += " GlobalSection(SharedMSBuildProjectFiles) = preSolution\n";
for (unsigned i = 0; i < projects.Size(); i++)
{
NETCSProject* p = projects.At(i);
if (p->outputType_ == "Shared")
{
for (unsigned j = 0; j < projects.Size(); j++)
{
NETCSProject* p2 = projects.At(j);
if (p == p2)
{
source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 13\n", p->name_.CString(), p->name_.CString(), p->projectGuid_.CString());
}
else
{
if (p2->sharedReferences_.Contains(p->name_))
{
source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 4\n", p->name_.CString(), p->name_.CString(), p2->projectGuid_.CString());
}
}
}
}
}
source += " EndGlobalSection\n";
source += " GlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
source += " Debug|Any CPU = Debug|Any CPU\n";
source += " Release|Any CPU = Release|Any CPU\n";
source += " Debug|iPhone = Debug|iPhone\n";
source += " Release|iPhone = Release|iPhone\n";
source += " EndGlobalSection\n";
source += " GlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
for (unsigned i = 0; i < projects.Size(); i++)
{
NETCSProject* p = projects.At(i);
if (p->outputType_ == "Shared")
continue;
String cpu = "Any CPU";
if (p->GetIsPlayerApp() && p->SupportsPlatform("ios"))
cpu = "iPhone";
source += ToString(" {%s}.Debug|%s.ActiveCfg = Debug|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
source += ToString(" {%s}.Debug|%s.Build.0 = Debug|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
source += ToString(" {%s}.Release|%s.ActiveCfg = Release|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
source += ToString(" {%s}.Release|%s.Build.0 = Release|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
if (cpu != "iPhone" && (p->SupportsPlatform("ios", false)))
{
source += ToString(" {%s}.Debug|iPhone.ActiveCfg = Debug|Any CPU\n", p->GetProjectGUID().CString());
source += ToString(" {%s}.Debug|iPhone.Build.0 = Debug|Any CPU\n", p->GetProjectGUID().CString());
source += ToString(" {%s}.Release|iPhone.ActiveCfg = Release|Any CPU\n", p->GetProjectGUID().CString());
source += ToString(" {%s}.Release|iPhone.Build.0 = Release|Any CPU\n", p->GetProjectGUID().CString());
}
}
source += " EndGlobalSection\n";
source += "EndGlobal\n";
if (!rewriteSolution_)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
if (fileSystem->Exists(slnPath))
return;
}
SharedPtr<File> output(new File(context_, GetSanitizedPath(slnPath), FILE_WRITE));
output->Write(source.CString(), source.Length());
output->Close();
}
bool NETSolution::Load(const JSONValue& root)
{
FileSystem* fs = GetSubsystem<FileSystem>();
name_ = root["name"].GetString();
outputPath_ = AddTrailingSlash(root["outputPath"].GetString());
ReplacePathStrings(outputPath_);
// TODO: use poco mkdirs
if (!fs->DirExists(outputPath_))
fs->CreateDirsRecursive(outputPath_);
return true;
}
bool NETSolution::RegisterPackage(const String& package)
{
if (packages_.Find(package) != packages_.End())
return false;
packages_.Push(package);
return true;
}
NETProjectGen::NETProjectGen(Context* context) : Object(context),
rewriteSolution_(false)
{
}
NETProjectGen::~NETProjectGen()
{
}
NETCSProject* NETProjectGen::GetCSProjectByName(const String & name)
{
for (unsigned i = 0; i < projects_.Size(); i++)
{
if (projects_[i]->GetName() == name)
return projects_[i];
}
return nullptr;
}
bool NETProjectGen::GetCSProjectDependencies(NETCSProject* source, PODVector<NETCSProject*>& depends) const
{
depends.Clear();
const Vector<String>& references = source->GetReferences();
for (unsigned i = 0; i < projects_.Size(); i++)
{
NETCSProject* pdepend = projects_.At(i);
if (source == pdepend)
continue;
for (unsigned j = 0; j < references.Size(); j++)
{
if (pdepend->GetName() == references[j])
{
depends.Push(pdepend);
}
}
}
return depends.Size() != 0;
}
bool NETProjectGen::Generate()
{
solution_->Generate();
for (unsigned i = 0; i < projects_.Size(); i++)
{
if (!projects_[i]->Generate())
return false;
}
return true;
}
void NETProjectGen::SetRewriteSolution(bool rewrite)
{
rewriteSolution_ = rewrite;
if (solution_.NotNull())
solution_->SetRewriteSolution(rewrite);
}
bool NETProjectGen::IncludeProjectOnPlatform(const JSONValue& projectRoot, const String& platform)
{
const JSONArray& platforms = projectRoot["platforms"].GetArray();
if (!platforms.Size())
return true; // all platforms
String scriptPlatform = platform.ToLower();
for (unsigned i = 0; i < platforms.Size(); i++)
{
String platform = platforms[i].GetString().ToLower();
if (platform == "desktop")
{
if (scriptPlatform == "windows" || scriptPlatform == "macosx" || scriptPlatform == "linux")
return true;
return false;
}
if (platform == "android" && scriptPlatform != "android")
return false;
}
return true;
}
bool NETProjectGen::LoadProject(const JSONValue &root)
{
solution_ = new NETSolution(context_, this, rewriteSolution_);
solution_->Load(root["solution"]);
const JSONValue& jprojects = root["projects"];
if (!jprojects.IsArray() || !jprojects.Size())
return false;
for (unsigned i = 0; i < jprojects.Size(); i++)
{
const JSONValue& jproject = jprojects[i];
if (!jproject.IsObject())
return false;
JSONArray platforms = jproject["platforms"].GetArray();
if (platforms.Size())
{
bool found = false;
for (unsigned j = 0; j < platforms.Size(); j++)
{
if (GetSupportsPlatform(platforms[j].GetString()))
{
found = true;
break;
}
}
if (!found)
{
continue;
}
}
// HACK! Do not generate AtomicNETService in the AtomicProject solution
if (jproject["name"].GetString() == "AtomicNETService" && atomicProjectPath_.Length())
{
continue;
}
SharedPtr<NETCSProject> csProject(new NETCSProject(context_, this));
if (!csProject->Load(jproject))
return false;
projects_.Push(csProject);
}
return true;
}
bool NETProjectGen::LoadJSONProject(const String& jsonProjectPath)
{
SharedPtr<File> file(new File(context_));
if (!file->Open(GetSanitizedPath(jsonProjectPath)))
return false;
String json;
file->ReadText(json);
JSONValue jvalue;
if (!JSONFile::ParseJSON(json, jvalue))
return false;
return LoadProject(jvalue);
}
\
bool NETProjectGen::LoadAtomicProject(const String& atomicProjectPath)
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolSystem* tsystem = GetSubsystem<ToolSystem>();
String pathname, filename, ext;
SplitPath(atomicProjectPath, pathname, filename, ext);
if (ext == ".atomic")
{
atomicProjectPath_ = AddTrailingSlash(pathname);
}
else
{
atomicProjectPath_ = AddTrailingSlash(atomicProjectPath);
}
// Do we have a loaded project?
if (Project* project = tsystem->GetProject())
{
// If so, use loaded project settings
projectSettings_ = project->GetProjectSettings();
}
else
{
// Nope, load them up
projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
projectSettings_->Load(atomicProjectPath_ + "Settings/Project.json");
}
#ifdef ATOMIC_DEV_BUILD
JSONValue netJSON;
SharedPtr<File> netJSONFile(new File(context_));
String atomicNETProject = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicNETProject.json";
if (!netJSONFile->Open(GetSanitizedPath(atomicNETProject)))
return false;
String netJSONString;
netJSONFile->ReadText(netJSONString);
if (!JSONFile::ParseJSON(netJSONString, netJSON))
return false;
#endif
AtomicNETCopyAssemblies(context_, atomicProjectPath_ + "AtomicNET/Lib/");
#ifdef ATOMIC_DEV_BUILD
String projectPath = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicProject.json";
#else
String projectPath = tenv->GetAtomicNETRootDir() + "Build/Projects/AtomicProject.json";
#endif
SharedPtr<File> file(new File(context_));
if (!file->Open(GetSanitizedPath(projectPath)))
return false;
String json;
file->ReadText(json);
json.Replace("$ATOMIC_PROJECT_NAME$", projectSettings_->GetName());
JSONValue jvalue;
if (!JSONFile::ParseJSON(json, jvalue))
return false;
#ifdef ATOMIC_DEV_BUILD
// patch projects
JSONArray netProjects = netJSON["projects"].GetArray();
JSONArray projects = jvalue["projects"].GetArray();
for (unsigned i = 0; i < projects.Size(); i++)
{
netProjects.Push(JSONValue(projects[i].GetObject()));
}
jvalue["projects"] = netProjects;
return LoadProject(jvalue);
#else
return LoadProject(jvalue);
#endif
}
void NETProjectGen::SetSupportedPlatforms(const StringVector& platforms)
{
projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
for (unsigned i = 0; i < platforms.Size(); i++)
{
projectSettings_->AddSupportedPlatform(platforms[i]);
}
}
bool NETProjectGen::GetSupportsPlatform(const String& platform) const
{
// If no project platform settings are loaded, always supports
if (projectSettings_.Null())
{
return true;
}
return projectSettings_->GetSupportsPlatform(platform);
}
bool NETProjectGen::GetRequiresNuGet()
{
if (solution_.Null())
{
ATOMIC_LOGERROR("NETProjectGen::GetRequiresNuGet() - called without a solution loaded");
return false;
}
return solution_->GetPackages().Size() != 0;
}
String NETProjectGen::GenerateUUID()
{
Poco::UUIDGenerator& generator = Poco::UUIDGenerator::defaultGenerator();
Poco::UUID uuid(generator.create()); // time based
return String(uuid.toString().c_str()).ToUpper();
}
}
| 34.401705 | 176 | 0.583218 | [
"object",
"vector"
] |
05f021873bcbc0d1174b169a5638c2ce5686b96f | 18,577 | cpp | C++ | telegram/TMessagesProj/jni/voip/tg_voip_jni.cpp | SAFE-anwang/SafeWallet-android | ac1ddfc262b34e398b4504c65ac74911b7ca4381 | [
"MIT"
] | 25 | 2021-06-09T15:27:39.000Z | 2022-03-30T04:04:23.000Z | telegram/TMessagesProj/jni/voip/tg_voip_jni.cpp | SAFE-anwang/SafeWallet-android | ac1ddfc262b34e398b4504c65ac74911b7ca4381 | [
"MIT"
] | 4 | 2021-09-19T08:59:07.000Z | 2022-03-27T19:33:50.000Z | TMessagesProj/jni/voip/tg_voip_jni.cpp | CharlotteFallices/Nekogram | feade65dcc152474b87c0f2307bffd23c4208959 | [
"Artistic-2.0"
] | 2 | 2022-03-26T11:06:16.000Z | 2022-03-26T11:13:21.000Z | //
// libtgvoip is free and unencumbered public domain software.
// For more information, see http://unlicense.org or the UNLICENSE file
// you should have received with this source code distribution.
//
#include <jni.h>
#include <string.h>
#include <map>
#include <string>
#include <vector>
#include "libtgvoip/VoIPServerConfig.h"
#include "libtgvoip/VoIPController.h"
#include "libtgvoip/os/android/AudioOutputOpenSLES.h"
#include "libtgvoip/os/android/AudioInputOpenSLES.h"
#include "libtgvoip/os/android/AudioInputAndroid.h"
#include "libtgvoip/os/android/AudioOutputAndroid.h"
#include "libtgvoip/audio/Resampler.h"
#include "libtgvoip/os/android/JNIUtilities.h"
#include "libtgvoip/PrivateDefines.h"
#include "libtgvoip/logging.h"
#include "../c_utils.h"
#ifdef TGVOIP_HAS_CONFIG
#include <tgvoip_config.h>
#endif
JavaVM* sharedJVM;
jfieldID audioRecordInstanceFld=NULL;
jfieldID audioTrackInstanceFld=NULL;
jmethodID setStateMethod=NULL;
jmethodID setSignalBarsMethod=NULL;
jmethodID setSelfStreamsMethod=NULL;
jmethodID setParticipantAudioEnabledMethod=NULL;
jclass jniUtilitiesClass=NULL;
struct ImplDataAndroid{
jobject javaObject;
std::string persistentStateFile="";
};
#ifndef TGVOIP_PACKAGE_PATH
#define TGVOIP_PACKAGE_PATH "org/telegram/messenger/voip"
#endif
using namespace tgvoip;
using namespace tgvoip::audio;
namespace tgvoip {
#pragma mark - Callbacks
void updateConnectionState(VoIPController *cntrlr, int state) {
ImplDataAndroid *impl = (ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(setStateMethod, impl->javaObject, state);
}
void updateSignalBarCount(VoIPController *cntrlr, int count) {
ImplDataAndroid *impl = (ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(setSignalBarsMethod, impl->javaObject, count);
}
#pragma mark - VoIPController
jlong VoIPController_nativeInit(JNIEnv *env, jobject thiz, jstring persistentStateFile) {
ImplDataAndroid *impl = new ImplDataAndroid();
impl->javaObject = env->NewGlobalRef(thiz);
if (persistentStateFile) {
impl->persistentStateFile = jni::JavaStringToStdString(env, persistentStateFile);
}
VoIPController *cntrlr = new VoIPController();
cntrlr->implData = impl;
VoIPController::Callbacks callbacks;
callbacks.connectionStateChanged = updateConnectionState;
callbacks.signalBarCountChanged = updateSignalBarCount;
cntrlr->SetCallbacks(callbacks);
if (!impl->persistentStateFile.empty()) {
FILE *f = fopen(impl->persistentStateFile.c_str(), "r");
if (f) {
fseek(f, 0, SEEK_END);
size_t len = static_cast<size_t>(ftell(f));
fseek(f, 0, SEEK_SET);
if (len < 1024 * 512 && len > 0) {
char *fbuf = static_cast<char *>(malloc(len));
fread(fbuf, 1, len, f);
std::vector<uint8_t> state(fbuf, fbuf + len);
free(fbuf);
cntrlr->SetPersistentState(state);
}
fclose(f);
}
}
return (jlong) (intptr_t) cntrlr;
}
void VoIPController_nativeStart(JNIEnv *env, jobject thiz, jlong inst) {
((VoIPController *) (intptr_t) inst)->Start();
}
void VoIPController_nativeConnect(JNIEnv *env, jobject thiz, jlong inst) {
((VoIPController *) (intptr_t) inst)->Connect();
}
void VoIPController_nativeSetProxy(JNIEnv *env, jobject thiz, jlong inst, jstring _address, jint port, jstring _username, jstring _password) {
((VoIPController *) (intptr_t) inst)->SetProxy(PROXY_SOCKS5, jni::JavaStringToStdString(env, _address), (uint16_t) port, jni::JavaStringToStdString(env, _username), jni::JavaStringToStdString(env, _password));
}
void VoIPController_nativeSetEncryptionKey(JNIEnv *env, jobject thiz, jlong inst, jbyteArray key, jboolean isOutgoing) {
jbyte *akey = env->GetByteArrayElements(key, NULL);
((VoIPController *) (intptr_t) inst)->SetEncryptionKey((char *) akey, isOutgoing);
env->ReleaseByteArrayElements(key, akey, JNI_ABORT);
}
void VoIPController_nativeSetNativeBufferSize(JNIEnv *env, jclass thiz, jint size) {
AudioOutputOpenSLES::nativeBufferSize = (unsigned int) size;
AudioInputOpenSLES::nativeBufferSize = (unsigned int) size;
}
void VoIPController_nativeRelease(JNIEnv *env, jobject thiz, jlong inst) {
//env->DeleteGlobalRef(AudioInputAndroid::jniClass);
VoIPController *ctlr = ((VoIPController *) (intptr_t) inst);
ImplDataAndroid *impl = (ImplDataAndroid *) ctlr->implData;
ctlr->Stop();
std::vector<uint8_t> state = ctlr->GetPersistentState();
delete ctlr;
env->DeleteGlobalRef(impl->javaObject);
if (!impl->persistentStateFile.empty()) {
FILE *f = fopen(impl->persistentStateFile.c_str(), "w");
if (f) {
fwrite(state.data(), 1, state.size(), f);
fclose(f);
}
}
delete impl;
}
jstring VoIPController_nativeGetDebugString(JNIEnv *env, jobject thiz, jlong inst) {
std::string str = ((VoIPController *) (intptr_t) inst)->GetDebugString();
return env->NewStringUTF(str.c_str());
}
void VoIPController_nativeSetNetworkType(JNIEnv *env, jobject thiz, jlong inst, jint type) {
((VoIPController *) (intptr_t) inst)->SetNetworkType(type);
}
void VoIPController_nativeSetMicMute(JNIEnv *env, jobject thiz, jlong inst, jboolean mute) {
((VoIPController *) (intptr_t) inst)->SetMicMute(mute);
}
void VoIPController_nativeSetConfig(JNIEnv *env, jobject thiz, jlong inst, jdouble recvTimeout, jdouble initTimeout, jint dataSavingMode, jboolean enableAEC, jboolean enableNS, jboolean enableAGC, jstring logFilePath, jstring statsDumpPath, jboolean logPacketStats) {
VoIPController::Config cfg;
cfg.initTimeout = initTimeout;
cfg.recvTimeout = recvTimeout;
cfg.dataSaving = dataSavingMode;
cfg.enableAEC = enableAEC;
cfg.enableNS = enableNS;
cfg.enableAGC = enableAGC;
cfg.enableCallUpgrade = false;
cfg.logPacketStats = logPacketStats;
if (logFilePath) {
cfg.logFilePath = jni::JavaStringToStdString(env, logFilePath);
}
if (statsDumpPath) {
cfg.statsDumpFilePath = jni::JavaStringToStdString(env, statsDumpPath);
}
((VoIPController *) (intptr_t) inst)->SetConfig(cfg);
}
void VoIPController_nativeDebugCtl(JNIEnv *env, jobject thiz, jlong inst, jint request, jint param) {
((VoIPController *) (intptr_t) inst)->DebugCtl(request, param);
}
jstring VoIPController_nativeGetVersion(JNIEnv *env, jclass clasz) {
return env->NewStringUTF(VoIPController::GetVersion());
}
jlong VoIPController_nativeGetPreferredRelayID(JNIEnv *env, jclass clasz, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetPreferredRelayID();
}
jint VoIPController_nativeGetLastError(JNIEnv *env, jclass clasz, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetLastError();
}
void VoIPController_nativeGetStats(JNIEnv *env, jclass clasz, jlong inst, jobject stats) {
VoIPController::TrafficStats _stats;
((VoIPController *) (intptr_t) inst)->GetStats(&_stats);
jclass cls = env->GetObjectClass(stats);
env->SetLongField(stats, env->GetFieldID(cls, "bytesSentWifi", "J"), _stats.bytesSentWifi);
env->SetLongField(stats, env->GetFieldID(cls, "bytesSentMobile", "J"), _stats.bytesSentMobile);
env->SetLongField(stats, env->GetFieldID(cls, "bytesRecvdWifi", "J"), _stats.bytesRecvdWifi);
env->SetLongField(stats, env->GetFieldID(cls, "bytesRecvdMobile", "J"), _stats.bytesRecvdMobile);
}
jstring VoIPController_nativeGetDebugLog(JNIEnv *env, jobject thiz, jlong inst) {
VoIPController *ctlr = ((VoIPController *) (intptr_t) inst);
std::string log = ctlr->GetDebugLog();
return env->NewStringUTF(log.c_str());
}
void VoIPController_nativeSetAudioOutputGainControlEnabled(JNIEnv *env, jclass clasz, jlong inst, jboolean enabled) {
((VoIPController *) (intptr_t) inst)->SetAudioOutputGainControlEnabled(enabled);
}
void VoIPController_nativeSetEchoCancellationStrength(JNIEnv *env, jclass cls, jlong inst, jint strength) {
((VoIPController *) (intptr_t) inst)->SetEchoCancellationStrength(strength);
}
jint VoIPController_nativeGetPeerCapabilities(JNIEnv *env, jclass cls, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetPeerCapabilities();
}
jboolean VoIPController_nativeNeedRate(JNIEnv *env, jclass cls, jlong inst) {
return static_cast<jboolean>(((VoIPController *) (intptr_t) inst)->NeedRate());
}
jint VoIPController_getConnectionMaxLayer(JNIEnv *env, jclass cls) {
return VoIPController::GetConnectionMaxLayer();
}
void AudioRecordJNI_nativeCallback(JNIEnv *env, jobject thiz, jobject buffer) {
jlong inst = env->GetLongField(thiz, audioRecordInstanceFld);
AudioInputAndroid *in = (AudioInputAndroid *) (intptr_t) inst;
in->HandleCallback(env, buffer);
}
void AudioTrackJNI_nativeCallback(JNIEnv *env, jobject thiz, jbyteArray buffer) {
jlong inst = env->GetLongField(thiz, audioTrackInstanceFld);
AudioOutputAndroid *in = (AudioOutputAndroid *) (intptr_t) inst;
in->HandleCallback(env, buffer);
}
void VoIPServerConfig_nativeSetConfig(JNIEnv *env, jclass clasz, jstring jsonString) {
ServerConfig::GetSharedInstance()->Update(jni::JavaStringToStdString(env, jsonString));
}
jint Resampler_convert44to48(JNIEnv *env, jclass cls, jobject from, jobject to) {
return (jint) tgvoip::audio::Resampler::Convert44To48((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from) / 2), (size_t) (env->GetDirectBufferCapacity(to) / 2));
}
jint Resampler_convert48to44(JNIEnv *env, jclass cls, jobject from, jobject to) {
return (jint) tgvoip::audio::Resampler::Convert48To44((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from) / 2), (size_t) (env->GetDirectBufferCapacity(to) / 2));
}
template<int level>
void VLog_log(JNIEnv *env, jclass cls, jstring jmsg) {
const char *format = "[java] %s";
std::string msg = jni::JavaStringToStdString(env, jmsg);
switch (level) {
case 0:
LOGV(format, msg.c_str());
break;
case 1:
LOGD(format, msg.c_str());
break;
case 2:
LOGI(format, msg.c_str());
break;
case 3:
LOGW(format, msg.c_str());
break;
case 4:
LOGE(format, msg.c_str());
break;
default:
break;
}
}
}
extern "C" {
int tgvoipOnJNILoad(JavaVM *vm, JNIEnv *env) {
jclass controller = env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPController");
if (env->ExceptionCheck()) {
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass audioRecordJNI = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
jclass audioTrackJNI = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
jclass serverConfig = env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPServerConfig");
jclass resampler = env->FindClass(TGVOIP_PACKAGE_PATH "/Resampler");
if (env->ExceptionCheck()) {
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass vlog = env->FindClass(TGVOIP_PACKAGE_PATH "/VLog");
if (env->ExceptionCheck()) {
env->ExceptionClear();
}
assert(controller && audioRecordJNI && audioTrackJNI && serverConfig && resampler);
audioRecordInstanceFld = env->GetFieldID(audioRecordJNI, "nativeInst", "J");
audioTrackInstanceFld = env->GetFieldID(audioTrackJNI, "nativeInst", "J");
env->GetJavaVM(&sharedJVM);
if (!AudioInputAndroid::jniClass) {
jclass cls = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
AudioInputAndroid::jniClass = (jclass) env->NewGlobalRef(cls);
AudioInputAndroid::initMethod = env->GetMethodID(cls, "init", "(IIII)V");
AudioInputAndroid::releaseMethod = env->GetMethodID(cls, "release", "()V");
AudioInputAndroid::startMethod = env->GetMethodID(cls, "start", "()Z");
AudioInputAndroid::stopMethod = env->GetMethodID(cls, "stop", "()V");
AudioInputAndroid::getEnabledEffectsMaskMethod = env->GetMethodID(cls, "getEnabledEffectsMask", "()I");
cls = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
AudioOutputAndroid::jniClass = (jclass) env->NewGlobalRef(cls);
AudioOutputAndroid::initMethod = env->GetMethodID(cls, "init", "(IIII)V");
AudioOutputAndroid::releaseMethod = env->GetMethodID(cls, "release", "()V");
AudioOutputAndroid::startMethod = env->GetMethodID(cls, "start", "()V");
AudioOutputAndroid::stopMethod = env->GetMethodID(cls, "stop", "()V");
}
setStateMethod = env->GetMethodID(controller, "handleStateChange", "(I)V");
setSignalBarsMethod = env->GetMethodID(controller, "handleSignalBarsChange", "(I)V");
if (!jniUtilitiesClass) {
jniUtilitiesClass = (jclass) env->NewGlobalRef(env->FindClass(TGVOIP_PACKAGE_PATH "/JNIUtilities"));
}
// VoIPController
JNINativeMethod controllerMethods[] = {
{"nativeInit", "(Ljava/lang/String;)J", (void *) &tgvoip::VoIPController_nativeInit},
{"nativeStart", "(J)V", (void *) &tgvoip::VoIPController_nativeStart},
{"nativeConnect", "(J)V", (void *) &tgvoip::VoIPController_nativeConnect},
{"nativeSetProxy", "(JLjava/lang/String;ILjava/lang/String;Ljava/lang/String;)V", (void *) &tgvoip::VoIPController_nativeSetProxy},
{"nativeSetEncryptionKey", "(J[BZ)V", (void *) &tgvoip::VoIPController_nativeSetEncryptionKey},
{"nativeSetNativeBufferSize", "(I)V", (void *) &tgvoip::VoIPController_nativeSetNativeBufferSize},
{"nativeRelease", "(J)V", (void *) &tgvoip::VoIPController_nativeRelease},
{"nativeGetDebugString", "(J)Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetDebugString},
{"nativeSetNetworkType", "(JI)V", (void *) &tgvoip::VoIPController_nativeSetNetworkType},
{"nativeSetMicMute", "(JZ)V", (void *) &tgvoip::VoIPController_nativeSetMicMute},
{"nativeSetConfig", "(JDDIZZZLjava/lang/String;Ljava/lang/String;Z)V", (void *) &tgvoip::VoIPController_nativeSetConfig},
{"nativeDebugCtl", "(JII)V", (void *) &tgvoip::VoIPController_nativeDebugCtl},
{"nativeGetVersion", "()Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetVersion},
{"nativeGetPreferredRelayID", "(J)J", (void *) &tgvoip::VoIPController_nativeGetPreferredRelayID},
{"nativeGetLastError", "(J)I", (void *) &tgvoip::VoIPController_nativeGetLastError},
{"nativeGetStats", "(JL" TGVOIP_PACKAGE_PATH "/VoIPController$Stats;)V", (void *) &tgvoip::VoIPController_nativeGetStats},
{"nativeGetDebugLog", "(J)Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetDebugLog},
{"nativeSetAudioOutputGainControlEnabled", "(JZ)V", (void *) &tgvoip::VoIPController_nativeSetAudioOutputGainControlEnabled},
{"nativeSetEchoCancellationStrength", "(JI)V", (void *) &tgvoip::VoIPController_nativeSetEchoCancellationStrength},
{"nativeGetPeerCapabilities", "(J)I", (void *) &tgvoip::VoIPController_nativeGetPeerCapabilities},
{"nativeNeedRate", "(J)Z", (void *) &tgvoip::VoIPController_nativeNeedRate},
{"getConnectionMaxLayer", "()I", (void *) &tgvoip::VoIPController_getConnectionMaxLayer}
};
env->RegisterNatives(controller, controllerMethods, sizeof(controllerMethods) / sizeof(JNINativeMethod));
// AudioRecordJNI
JNINativeMethod audioRecordMethods[] = {
{"nativeCallback", "(Ljava/nio/ByteBuffer;)V", (void *) &tgvoip::AudioRecordJNI_nativeCallback}
};
env->RegisterNatives(audioRecordJNI, audioRecordMethods, sizeof(audioRecordMethods) / sizeof(JNINativeMethod));
// AudioTrackJNI
JNINativeMethod audioTrackMethods[] = {
{"nativeCallback", "([B)V", (void *) &tgvoip::AudioTrackJNI_nativeCallback}
};
env->RegisterNatives(audioTrackJNI, audioTrackMethods, sizeof(audioTrackMethods) / sizeof(JNINativeMethod));
// VoIPServerConfig
JNINativeMethod serverConfigMethods[] = {
{"nativeSetConfig", "(Ljava/lang/String;)V", (void *) &tgvoip::VoIPServerConfig_nativeSetConfig}
};
env->RegisterNatives(serverConfig, serverConfigMethods, sizeof(serverConfigMethods) / sizeof(JNINativeMethod));
// Resampler
JNINativeMethod resamplerMethods[] = {
{"convert44to48", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void *) &tgvoip::Resampler_convert44to48},
{"convert48to44", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void *) &tgvoip::Resampler_convert48to44}
};
env->RegisterNatives(resampler, resamplerMethods, sizeof(resamplerMethods) / sizeof(JNINativeMethod));
if (vlog) {
// VLog
JNINativeMethod vlogMethods[] = {
{"v", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<0>},
{"d", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<1>},
{"i", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<2>},
{"w", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<3>},
{"e", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<4>}
};
env->RegisterNatives(vlog, vlogMethods, sizeof(vlogMethods) / sizeof(JNINativeMethod));
}
return JNI_TRUE;
}
} | 48.251948 | 268 | 0.660171 | [
"vector"
] |
af054455fbf7337ccbaa6ae8e9844b37f643aed7 | 2,693 | cxx | C++ | smtk/session/polygon/json/jsonModel.cxx | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | 40 | 2015-02-21T19:55:54.000Z | 2022-01-06T13:13:05.000Z | smtk/session/polygon/json/jsonModel.cxx | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | 127 | 2015-01-15T20:55:45.000Z | 2021-08-19T17:34:15.000Z | smtk/session/polygon/json/jsonModel.cxx | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | 27 | 2015-03-04T14:17:51.000Z | 2021-12-23T01:05:42.000Z | //=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#include "smtk/session/polygon/json/jsonModel.h"
#include "smtk/session/polygon/internal/Model.h"
namespace smtk
{
namespace session
{
namespace polygon
{
namespace internal
{
using json = nlohmann::json;
// Define how polygon resources are serialized.
void to_json(json& j, const smtk::session::polygon::internal::pmodel::Ptr& pmodel)
{
j["type"] = "model";
j["origin"] = std::vector<double>(pmodel->origin(), pmodel->origin() + 3);
j["x axis"] = std::vector<double>(pmodel->xAxis(), pmodel->xAxis() + 3);
j["y axis"] = std::vector<double>(pmodel->yAxis(), pmodel->yAxis() + 3);
j["z axis"] = std::vector<double>(pmodel->zAxis(), pmodel->zAxis() + 3);
j["i axis"] = std::vector<double>(pmodel->iAxis(), pmodel->iAxis() + 3);
j["j axis"] = std::vector<double>(pmodel->jAxis(), pmodel->jAxis() + 3);
j["feature size"] = pmodel->featureSize();
// Encode model scale carefully since some JSON implementations store numbers
// in doubles which loses precision with large integers.
std::vector<int> modelScaleBytes(8);
long long mscale = static_cast<long long>(pmodel->modelScale());
for (int i = 0; i < 8; ++i)
{
modelScaleBytes[7 - i] = mscale & 0xff;
mscale >>= 8;
}
j["model scale"] = modelScaleBytes;
}
void from_json(const json& j, smtk::session::polygon::internal::pmodel::Ptr& pmodel)
{
try
{
std::vector<double> origin = j.at("origin");
std::vector<double> xAxis = j.at("x axis");
std::vector<double> yAxis = j.at("y axis");
std::vector<double> zAxis = j.at("z axis");
std::vector<double> iAxis = j.at("i axis");
std::vector<double> jAxis = j.at("j axis");
double featureSize = j["feature size"];
std::vector<unsigned long long> modelScaleBytes = j["model scale"];
long long modelScale = 0;
for (int i = 0; i < 8; ++i)
{
modelScale += (modelScaleBytes[7 - i] << (8 * i));
}
pmodel = smtk::session::polygon::internal::pmodel::create();
pmodel->restoreModel(origin, xAxis, yAxis, zAxis, iAxis, jAxis, featureSize, modelScale);
}
catch (std::exception&)
{
std::cerr << "Failed to deserialize polygon model" << std::endl;
}
}
} // namespace internal
} // namespace polygon
} // namespace session
} // namespace smtk
| 34.088608 | 93 | 0.617156 | [
"vector",
"model"
] |
af07a5850871d0483f6b2be47543631253d8168c | 1,899 | cpp | C++ | tests/tokenizer_unittest.cpp | tongzhipeng/KBase | c6a4ce7592dfcf8e000045f3ef03a9badf023ccf | [
"MIT"
] | 20 | 2016-05-16T07:02:09.000Z | 2021-06-07T10:21:24.000Z | tests/tokenizer_unittest.cpp | tongzhipeng/KBase | c6a4ce7592dfcf8e000045f3ef03a9badf023ccf | [
"MIT"
] | 1 | 2020-07-09T02:00:36.000Z | 2020-07-11T03:46:52.000Z | tests/tokenizer_unittest.cpp | tongzhipeng/KBase | c6a4ce7592dfcf8e000045f3ef03a9badf023ccf | [
"MIT"
] | 13 | 2016-03-09T09:52:17.000Z | 2021-09-09T14:50:13.000Z | /*
@ 0xCCCCCCCC
*/
#include "catch2/catch.hpp"
#include "kbase/basic_macros.h"
#include "kbase/tokenizer.h"
namespace kbase {
TEST_CASE("Constructing tokenizer or token-iterator", "[Tokenizer]")
{
SECTION("constructing an empty TokenIterator")
{
std::string str = "hello, world";
TokenIterator<char> it(str, str.length(), ", ");
REQUIRE(it->empty());
}
SECTION("constructing tokenizer")
{
std::string str = "hello, world";
Tokenizer tokenizer(str, ", ");
auto begin = tokenizer.begin();
auto end = tokenizer.end();
auto begin_copy = begin;
auto end_move = std::move(end);
UNUSED_VAR(begin_copy);
UNUSED_VAR(end_move);
}
}
TEST_CASE("Iteration", "[Tokenizer]")
{
std::string str = "anything that cannot kill you makes you stronger.\n\tsaid by Bruce Wayne\n";
std::vector<std::string> exp { "anything", "that", "cannot", "kill", "you", "makes", "you",
"stronger", "said", "by", "Bruce", "Wayne" };
Tokenizer tokenizer(str, " .\n\t");
size_t i = 0;
for (auto&& token : tokenizer) {
REQUIRE(!token.empty());
REQUIRE(exp[i] == token.ToString());
++i;
}
}
TEST_CASE("None token", "[Tokenizer]")
{
const char str[] = "\r\n\r\n";
Tokenizer tokenizer(str, "\r\n");
REQUIRE(tokenizer.begin() == tokenizer.end());
}
TEST_CASE("String ends with double-delimiter", "[Tokenizer]")
{
std::string str =
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html; charset=utf-8\r\n"
"Content-Length: 30\r\n"
"Server: Werkzeug/0.12.2 Python/3.6.3\r\n"
"Date: Thu, 14 Dec 2017 13:10:12 GMT\r\n\r\n";
Tokenizer tokenizer(str, "\r\n");
auto count = std::distance(std::next(tokenizer.begin()), tokenizer.end());
REQUIRE(4 == count);
}
} // namespace kbase
| 26.746479 | 99 | 0.577146 | [
"vector"
] |
af0cdab0a2a5ff82d13dce31261af438ae6766e1 | 2,629 | cpp | C++ | Zephyr_App/src/App.cpp | Naimin/Zephyr | ab33eeef9bbf73e61aca50894f77cef0c2a7a4af | [
"MIT"
] | 2 | 2019-11-29T08:01:00.000Z | 2021-05-07T03:33:16.000Z | Zephyr_App/src/App.cpp | Naimin/Zephyr | ab33eeef9bbf73e61aca50894f77cef0c2a7a4af | [
"MIT"
] | null | null | null | Zephyr_App/src/App.cpp | Naimin/Zephyr | ab33eeef9bbf73e61aca50894f77cef0c2a7a4af | [
"MIT"
] | 2 | 2019-11-29T08:01:13.000Z | 2021-11-21T04:54:23.000Z | #include "App.h"
#include "UI.h"
#include "AppEvents.h"
#include <windows.h>
#include <Zephyr_Graphics.h>
#include <BasicRenderPass.h>
#include <nana/gui/timer.hpp>
using namespace Zephyr;
Zephyr::App::App(const std::string& windowTitle, unsigned int width, unsigned int height, bool bFullScreen) : mWidth(width), mHeight(height), mbFullScreen(bFullScreen), mHwnd(NULL)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
// setup UI
mpUI.reset(new UI(windowTitle, this));
}
Zephyr::App::~App()
{
}
bool Zephyr::App::initialize()
{
mpEngine.reset(new Graphics::GraphicsEngine());
// initialize direct3d
if (!mpEngine->initialize(mWidth, mHeight, mHwnd, mbFullScreen))
{
MessageBox(0, L"Failed to initialize direct3d 12",
L"Error", MB_OK);
mpEngine->cleanup();
return false;
}
auto pRenderPass = new Graphics::BasicRenderPass(3, mpEngine.get());
pRenderPass->initialize();
pRenderPass->setClearColor(0.2f, 0.2f, 0.2f, 1.0f);
// Initalize the renderpass camera, and get reference to it
mpCamera = pRenderPass->initalizeCamera(
Common::Vector3f(0.0f, 2.0f, -200.0f),
Common::Vector3f(0, 0, 0),
Common::Vector3f(0, 1.0f, 0),
45.0f*(3.14f / 180.0f),
0.1f,
1000.0f,
(int)mWidth,
(int)mHeight);
mpEngine->setupRenderPass(pRenderPass, DEFAULT_RENDERPASS_NAME);
if (!mpUI->initialize())
{
MessageBox(0, L"Failed to initialize UI framework",
L"Error", MB_OK);
mpEngine->cleanup();
return false;
}
// setup buttons event
mpAppEvents.reset(new AppEvents(this, mpUI.get()));
if (!mpAppEvents->initialize())
{
MessageBox(0, L"Failed to initialize App Events",
L"Error", MB_OK);
mpEngine->cleanup();
return false;
}
return true;
}
bool Zephyr::App::start()
{
// Draw Through / Render Events
//Define a directX rendering function
mpUI->getForm()->draw_through([&]() mutable
{
if (mpEngine->isRunning())
{
mpEngine->render();
}
});
nana::timer tmr;
tmr.elapse([&] {
RECT r;
::GetClientRect(mHwnd, &r);
::InvalidateRect(mHwnd, &r, FALSE);
});
tmr.interval(1); // this is the UI refresh rate
tmr.start();
mpUI->show();
// let nana take over control flow
nana::exec();
return true;
}
std::shared_ptr<Graphics::GraphicsEngine> Zephyr::App::getGraphicsEngine()
{
return mpEngine;
}
std::shared_ptr<UI> Zephyr::App::getUI()
{
return mpUI;
}
std::shared_ptr<Common::Camera> Zephyr::App::getCamera()
{
return mpCamera;
}
HWND & Zephyr::App::getHwnd()
{
return mHwnd;
}
unsigned int Zephyr::App::getWidth() const
{
return mWidth;
}
unsigned int Zephyr::App::getHeight() const
{
return mHeight;
}
| 19.619403 | 180 | 0.680867 | [
"render"
] |
af0fa9e98abe6a8bc0b4d2eb5ed6d1dac39b2828 | 4,795 | cpp | C++ | src/shared/StrUtils.cpp | SageAxcess/pcap-ndis6 | 77c9f02f5a774a5976e7fb96f667b5abb335d299 | [
"MIT"
] | 15 | 2017-12-22T09:46:29.000Z | 2020-04-28T02:21:08.000Z | src/shared/StrUtils.cpp | SageAxcess/pcap-ndis6 | 77c9f02f5a774a5976e7fb96f667b5abb335d299 | [
"MIT"
] | null | null | null | src/shared/StrUtils.cpp | SageAxcess/pcap-ndis6 | 77c9f02f5a774a5976e7fb96f667b5abb335d299 | [
"MIT"
] | 6 | 2017-06-26T02:25:38.000Z | 2021-08-12T07:30:43.000Z | //////////////////////////////////////////////////////////////////////
// Project: pcap-ndis6
// Description: WinPCAP fork with NDIS6.x support
// License: MIT License, read LICENSE file in project root for details
//
// Copyright (c) 2019 Change Dynamix, Inc.
// All Rights Reserved.
//
// https://changedynamix.io/
//
// Author: Andrey Fedorinin
//////////////////////////////////////////////////////////////////////
#include "StrUtils.h"
#include "CommonDefs.h"
#include <vector>
BOOL UTILS::STR::SameTextA(
__in const std::string &String1,
__in const std::string &String2)
{
RETURN_VALUE_IF_FALSE(
String1.length() == String2.length(),
FALSE);
RETURN_VALUE_IF_TRUE(
String1.length() == 0,
TRUE);
return _strnicmp(
String1.c_str(),
String2.c_str(),
String1.length()) == 0;
};
BOOL UTILS::STR::SameTextW(
__in const std::wstring &String1,
__in const std::wstring &String2)
{
RETURN_VALUE_IF_FALSE(
String1.length() == String2.length(),
FALSE);
RETURN_VALUE_IF_TRUE(
String1.length() == 0,
TRUE);
return _wcsnicmp(
String1.c_str(),
String2.c_str(),
String1.length()) == 0;
};
std::string UTILS::STR::FormatA(
__in LPCSTR FormatStr,
__in ...)
{
RETURN_VALUE_IF_FALSE(
Assigned(FormatStr),
"");
va_list ArgList;
std::string Result;
va_start(ArgList, FormatStr);
try
{
int NumberOfChars = _vscprintf(FormatStr, ArgList);
std::vector<char> Buffer;
Buffer.resize(NumberOfChars + 3, 0);
if (_vsnprintf_s(
&Buffer[0],
NumberOfChars + 2,
NumberOfChars + 1,
FormatStr,
ArgList) > 0)
{
Result = std::string(&Buffer[0]);
}
}
catch (...)
{
}
va_end(ArgList);
return Result;
};
std::wstring UTILS::STR::FormatW(
__in LPCWSTR FormatStr,
__in ...)
{
RETURN_VALUE_IF_FALSE(
Assigned(FormatStr),
L"");
va_list ArgList;
std::wstring Result;
va_start(ArgList, FormatStr);
try
{
int NumberOfChars = _vscwprintf(FormatStr, ArgList);
std::vector<wchar_t> Buffer;
Buffer.resize(NumberOfChars + 3, 0);
if (_vsnwprintf_s(
&Buffer[0],
NumberOfChars + 2,
NumberOfChars + 1,
FormatStr,
ArgList) > 0)
{
Result = std::wstring(&Buffer[0]);
}
}
catch (...)
{
}
va_end(ArgList);
return Result;
};
std::wstring UTILS::STR::TimeToStringW(
__in const SYSTEMTIME &Time)
{
return FormatW(
L"%02d:%02d:%02d:%03d",
Time.wHour,
Time.wMinute,
Time.wSecond,
Time.wMilliseconds);
};
std::wstring UTILS::STR::GetTimeStr(
__in_opt BOOL LocalOrSystem)
{
SYSTEMTIME Time;
if (LocalOrSystem)
{
GetLocalTime(&Time);
}
else
{
GetSystemTime(&Time);
}
return TimeToStringW(Time);
};
BOOL UTILS::STR::EndsOnA(
__in const std::string &Str,
__in const std::string &SubStr)
{
RETURN_VALUE_IF_FALSE(
Str.length() >= SubStr.length(),
FALSE);
return Str.substr(Str.length() - SubStr.length()) == SubStr;
};
BOOL UTILS::STR::EndsOnW(
__in const std::wstring &Str,
__in const std::wstring &SubStr)
{
RETURN_VALUE_IF_FALSE(
Str.length() >= SubStr.length(),
FALSE);
return Str.substr(Str.length() - SubStr.length()) == SubStr;
};
std::string UTILS::STR::GuidToStringA(
__in const GUID &Guid)
{
return FormatA(
"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
Guid.Data1,
Guid.Data2,
Guid.Data3,
Guid.Data4[0],
Guid.Data4[1],
Guid.Data4[2],
Guid.Data4[3],
Guid.Data4[4],
Guid.Data4[5],
Guid.Data4[6],
Guid.Data4[7]);
};
std::wstring UTILS::STR::GuidToStringW(
__in const GUID &Guid)
{
return FormatW(
L"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
Guid.Data1,
Guid.Data2,
Guid.Data3,
Guid.Data4[0],
Guid.Data4[1],
Guid.Data4[2],
Guid.Data4[3],
Guid.Data4[4],
Guid.Data4[5],
Guid.Data4[6],
Guid.Data4[7]);
}; | 22.833333 | 82 | 0.499896 | [
"vector"
] |
af135e6963257a3fa9b3ce480c8f3772e83bdf48 | 4,682 | cpp | C++ | Tutorials/t64heapProblems.cpp | Aaryan-R-S/DSA-Tutorials | 5e5b52b7d206a207a6d8032940037b050969cae5 | [
"MIT"
] | null | null | null | Tutorials/t64heapProblems.cpp | Aaryan-R-S/DSA-Tutorials | 5e5b52b7d206a207a6d8032940037b050969cae5 | [
"MIT"
] | null | null | null | Tutorials/t64heapProblems.cpp | Aaryan-R-S/DSA-Tutorials | 5e5b52b7d206a207a6d8032940037b050969cae5 | [
"MIT"
] | null | null | null | #include<bits/stdc++.h>
#define pii pair<int, int>
using namespace std;
// --REFER ADITYA VERMA PLAYLIST ALSO--
// Identification: Find kth smallest/closest or largest/frequent
// Make heaap of size k (smallest=maxheap and largest=minheap) pop elems if size of heaps get larger than k then at the last you have desired k elems left in heap
// Time complexity = O(n*logk) not (O(n*logn)) as heap max size is k
// Use STL for constructing maxHeap and minHeap
void STLHeap(){
priority_queue<int, vector<int>> maxHeap;
maxHeap.push(5);
maxHeap.push(6);
maxHeap.push(4);
maxHeap.push(2);
while(!maxHeap.empty())
{
cout<<maxHeap.top()<<" ";
maxHeap.pop();
}
cout<<endl;
priority_queue<int, vector<int>, greater<int>> minHeap;
minHeap.push(5);
minHeap.push(6);
minHeap.push(4);
minHeap.push(2);
while(!minHeap.empty())
{
cout<<minHeap.top()<<" ";
minHeap.pop();
}
cout<<endl;
}
// After every input tell the median of the sorted array inputed so far
double medianOfRunningStream(priority_queue<int, vector<int>> &maxHeap, priority_queue<int, vector<int>, greater<int>> &minHeap, int k){
if(maxHeap.size()==minHeap.size()){
if(maxHeap.size()==0){
maxHeap.push(k);
// since sizes are unequal
return maxHeap.top();
}
if(k<maxHeap.top()){
maxHeap.push(k);
// since sizes are unequal
return maxHeap.top();
}
else{
minHeap.push(k);
// since sizes are unequal
return minHeap.top();
}
}
else{
if(maxHeap.size()>minHeap.size()){
if(k>=maxHeap.top()){
minHeap.push(k);
}
else{
int temp = maxHeap.top();
maxHeap.pop();
minHeap.push(temp);
maxHeap.push(k);
}
}
else{
if(k<=minHeap.top()){
maxHeap.push(k);
}
else{
int temp = minHeap.top();
minHeap.pop();
maxHeap.push(temp);
minHeap.push(k);
}
}
// since sizes are equal
return ((minHeap.top()+maxHeap.top())/2.0);
}
}
// merge k sorted arrays
void mergeArrays(){
int n; cin>>n;
vector<vector<int>> vec(n);
for (int i = 0; i < n; i++)
{
int size;cin>>size;
// Take input of elems of n arrays each of size 'size
vec[i] = vector<int> (size);
for (int j = 0; j < size; j++)
{
cin>>vec[i][j];
}
}
// Declare minHeap which will store n elems at a time which are respectively minimum elems in their repective arrays
priority_queue<pii, vector<pii>, greater<pii>> minHeap;
for (int i = 0; i < n; i++)
{
minHeap.push({vec[i][0], i});
}
vector<int> indices(n, 0); // store indices of each array upto which elems are inserted
vector<int> ans; // store ans array
// main algo
while(!minHeap.empty()){
pii myTop = minHeap.top();
minHeap.pop();
ans.push_back(myTop.first);
if(indices[myTop.second]+1<vec[myTop.second].size()){
minHeap.push({
vec[myTop.second][indices[myTop.second]+1], myTop.second
});
}
indices[myTop.second]++;
}
// cout ans
for (int i = 0; i < ans.size(); i++)
{
cout<<ans[i]<<" ";
}
cout<<endl;
}
// given an array of size n find smallest subsequence with sum k
void sumK(){
int n;cin>>n;
int k;cin>>k;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin>>v[i];
}
priority_queue<int, vector<int>> maxHeap;
for (int i = 0; i < n; i++)
{
maxHeap.push(v[i]);
}
int sum = 0;
int count = 0;
while(!maxHeap.empty()){
sum += maxHeap.top();
count++;
maxHeap.pop();
if(sum>=k){
break;
}
}
if(sum<k){
cout<<"Not possible!"<<endl;
}
else{
cout<<count<<endl;
}
}
int main()
{
// STLHeap();
// priority_queue<int, vector<int>> maxHeap;
// priority_queue<int, vector<int>, greater<int>> minHeap;
// int n; cin>>n;
// for (int i = 0; i < n; i++)
// {
// int num;
// cin>>num;
// cout<<"Median: "<<medianOfRunningStream(maxHeap, minHeap, num)<<endl;
// cout<<"Size: "<<maxHeap.size()<<" "<<minHeap.size()<<endl;
// }
// mergeArrays();
sumK();
return 0;
} | 24.642105 | 162 | 0.507689 | [
"vector"
] |
af1375510603d29a6681bbd0342beaf63d9d8eda | 3,897 | hpp | C++ | include/UnityEngine/AnimatorControllerParameter.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/UnityEngine/AnimatorControllerParameter.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/UnityEngine/AnimatorControllerParameter.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: UnityEngine.AnimatorControllerParameterType
#include "UnityEngine/AnimatorControllerParameterType.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Type namespace: UnityEngine
namespace UnityEngine {
// Size: 0x25
#pragma pack(push, 1)
// WARNING Layout: Sequential may not be correctly taken into account!
// Autogenerated type: UnityEngine.AnimatorControllerParameter
// [NativeHeaderAttribute] Offset: DA8E1C
// [NativeAsStructAttribute] Offset: DA8E1C
// [NativeTypeAttribute] Offset: DA8E1C
// [UsedByNativeCodeAttribute] Offset: DA8E1C
// [NativeHeaderAttribute] Offset: DA8E1C
class AnimatorControllerParameter : public ::Il2CppObject {
public:
// System.String m_Name
// Size: 0x8
// Offset: 0x10
::Il2CppString* m_Name;
// Field size check
static_assert(sizeof(::Il2CppString*) == 0x8);
// UnityEngine.AnimatorControllerParameterType m_Type
// Size: 0x4
// Offset: 0x18
UnityEngine::AnimatorControllerParameterType m_Type;
// Field size check
static_assert(sizeof(UnityEngine::AnimatorControllerParameterType) == 0x4);
// System.Single m_DefaultFloat
// Size: 0x4
// Offset: 0x1C
float m_DefaultFloat;
// Field size check
static_assert(sizeof(float) == 0x4);
// System.Int32 m_DefaultInt
// Size: 0x4
// Offset: 0x20
int m_DefaultInt;
// Field size check
static_assert(sizeof(int) == 0x4);
// System.Boolean m_DefaultBool
// Size: 0x1
// Offset: 0x24
bool m_DefaultBool;
// Field size check
static_assert(sizeof(bool) == 0x1);
// Creating value type constructor for type: AnimatorControllerParameter
AnimatorControllerParameter(::Il2CppString* m_Name_ = {}, UnityEngine::AnimatorControllerParameterType m_Type_ = {}, float m_DefaultFloat_ = {}, int m_DefaultInt_ = {}, bool m_DefaultBool_ = {}) noexcept : m_Name{m_Name_}, m_Type{m_Type_}, m_DefaultFloat{m_DefaultFloat_}, m_DefaultInt{m_DefaultInt_}, m_DefaultBool{m_DefaultBool_} {}
// public System.String get_name()
// Offset: 0x2341F84
::Il2CppString* get_name();
// public override System.Boolean Equals(System.Object o)
// Offset: 0x2341F8C
// Implemented from: System.Object
// Base method: System.Boolean Object::Equals(System.Object o)
bool Equals(::Il2CppObject* o);
// public override System.Int32 GetHashCode()
// Offset: 0x2342084
// Implemented from: System.Object
// Base method: System.Int32 Object::GetHashCode()
int GetHashCode();
// public System.Void .ctor()
// Offset: 0x23420A4
// Implemented from: System.Object
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static AnimatorControllerParameter* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("UnityEngine::AnimatorControllerParameter::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<AnimatorControllerParameter*, creationType>()));
}
}; // UnityEngine.AnimatorControllerParameter
#pragma pack(pop)
static check_size<sizeof(AnimatorControllerParameter), 36 + sizeof(bool)> __UnityEngine_AnimatorControllerParameterSizeCheck;
static_assert(sizeof(AnimatorControllerParameter) == 0x25);
}
DEFINE_IL2CPP_ARG_TYPE(UnityEngine::AnimatorControllerParameter*, "UnityEngine", "AnimatorControllerParameter");
| 44.793103 | 338 | 0.721067 | [
"object"
] |
af24fecec24273057bb3feb5f33ece68b600356d | 17,195 | cpp | C++ | alica_capnzero_proxy/src/ContainerUtils.cpp | dasys-lab/alica-capnzero-proxy | 440016e93fa4f5b872895d3653f3c7e75ce21d2d | [
"MIT"
] | null | null | null | alica_capnzero_proxy/src/ContainerUtils.cpp | dasys-lab/alica-capnzero-proxy | 440016e93fa4f5b872895d3653f3c7e75ce21d2d | [
"MIT"
] | null | null | null | alica_capnzero_proxy/src/ContainerUtils.cpp | dasys-lab/alica-capnzero-proxy | 440016e93fa4f5b872895d3653f3c7e75ce21d2d | [
"MIT"
] | null | null | null | #include "alica_capnzero_proxy/ContainerUtils.h"
// Generated CapnProto Messages:
#include "alica_msg/AgentAnnouncement.capnp.h"
#include "alica_msg/AgentQuery.capnp.h"
#include "alica_msg/AlicaEngineInfo.capnp.h"
#include "alica_msg/AllocationAuthorityInfo.capnp.h"
#include "alica_msg/PlanTreeInfo.capnp.h"
#include "alica_msg/RoleSwitch.capnp.h"
#include "alica_msg/SolverResult.capnp.h"
#include "alica_msg/SyncReady.capnp.h"
#include "alica_msg/SyncTalk.capnp.h"
#include <essentials/WildcardID.h>
namespace alica_capnzero_proxy
{
alica::AllocationAuthorityInfo ContainerUtils::toAllocationAuthorityInfo(::capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::AllocationAuthorityInfo::Reader reader = msg.getRoot<alica_msgs::AllocationAuthorityInfo>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::AllocationAuthorityInfo aai;
aai.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), static_cast<uint8_t>(reader.getSenderId().getType()));
aai.planId = reader.getPlanId();
aai.planType = reader.getPlanType();
aai.parentState = reader.getParentState();
aai.authority = idManager.getIDFromBytes(
reader.getAuthority().getValue().asBytes().begin(), reader.getAuthority().getValue().size(), static_cast<uint8_t>(reader.getAuthority().getType()));
::capnp::List<alica_msgs::EntrypointRobots>::Reader entryPointRobots = reader.getEntrypointRobots();
for (unsigned int i = 0; i < entryPointRobots.size(); ++i) {
aai.entryPointRobots.emplace_back();
alica_msgs::EntrypointRobots::Reader tmpEntrypointRobot = entryPointRobots[i];
aai.entryPointRobots[i].entrypoint = tmpEntrypointRobot.getEntrypoint();
::capnp::List<capnzero::ID>::Reader robots = tmpEntrypointRobot.getRobots();
for (unsigned int j = 0; j < robots.size(); ++j) {
// CapnProto uses uint16_t for enums, but we use uint8_t hopefully it works for us - otherwise we need a matching/translation via switch case
aai.entryPointRobots[i].robots.push_back(
idManager.getIDFromBytes(robots[j].getValue().asBytes().begin(), robots[j].getValue().size(), (uint8_t) robots[j].getType()));
}
}
return aai;
}
alica::AlicaEngineInfo ContainerUtils::toAlicaEngineInfo(::capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::AlicaEngineInfo::Reader reader = msg.getRoot<alica_msgs::AlicaEngineInfo>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::AlicaEngineInfo aei;
aei.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), static_cast<uint8_t>(reader.getSenderId().getType()));
aei.currentState = reader.getCurrentState();
aei.masterPlan = reader.getMasterPlan();
aei.currentTask = reader.getCurrentTask();
aei.currentRole = reader.getCurrentRole();
aei.currentPlan = reader.getCurrentPlan();
::capnp::List<capnzero::ID>::Reader agentIdsWithMe = reader.getAgentIdsWithMe();
for (unsigned int i = 0; i < agentIdsWithMe.size(); ++i) {
aei.robotIDsWithMe.push_back(
idManager.getIDFromBytes(agentIdsWithMe[i].getValue().asBytes().begin(), agentIdsWithMe[i].getValue().size(), (uint8_t) agentIdsWithMe[i].getType()));
}
return aei;
}
alica::PlanTreeInfo ContainerUtils::toPlanTreeInfo(::capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::PlanTreeInfo::Reader reader = msg.getRoot<alica_msgs::PlanTreeInfo>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::PlanTreeInfo pti;
pti.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
::capnp::List<int64_t>::Reader states = reader.getStateIds();
for (unsigned int i = 0; i < states.size(); ++i) {
pti.stateIDs.push_back(states[i]);
}
::capnp::List<int64_t>::Reader succeded = reader.getSucceededEps();
for (unsigned int j = 0; j < succeded.size(); ++j) {
pti.succeededEPs.push_back(succeded[j]);
}
return pti;
}
alica::SyncReady ContainerUtils::toSyncReady(capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::SyncReady::Reader reader = msg.getRoot<alica_msgs::SyncReady>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::SyncReady sr;
sr.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
sr.synchronisationID = reader.getSynchronisationId();
return sr;
}
alica::SyncTalk ContainerUtils::toSyncTalk(capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::SyncTalk::Reader reader = msg.getRoot<alica_msgs::SyncTalk>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::SyncTalk st;
st.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
capnp::List<alica_msgs::SyncData>::Reader msgSyncData = reader.getSyncData();
for (unsigned int i = 0; i < msgSyncData.size(); ++i) {
st.syncData.emplace_back();
alica_msgs::SyncData::Reader tmpSyncData = msgSyncData[i];
st.syncData[i].ack = tmpSyncData.getAck();
st.syncData[i].conditionHolds = tmpSyncData.getTransitionHolds();
st.syncData[i].transitionID = tmpSyncData.getTransitionId();
st.syncData[i].agentID = idManager.getIDFromBytes(tmpSyncData.getRobotId().getValue().asBytes().begin(), tmpSyncData.getRobotId().getValue().size(),
(uint8_t) tmpSyncData.getRobotId().getType());
}
return st;
}
alica::SolverResult ContainerUtils::toSolverResult(capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::SolverResult::Reader reader = msg.getRoot<alica_msgs::SolverResult>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::SolverResult solverResult;
solverResult.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
capnp::List<alica_msgs::SolverVar>::Reader msgSolverVars = reader.getVars();
for (unsigned int i = 0; i < msgSolverVars.size(); ++i) {
alica_msgs::SolverVar::Reader tmpVar = msgSolverVars[i];
solverResult.vars.emplace_back();
solverResult.vars[i].id = tmpVar.getId();
std::vector<uint8_t> tmp;
capnp::List<uint8_t>::Reader val = tmpVar.getValue();
for (unsigned int j = 0; j < val.size(); ++j) {
solverResult.vars[i].value[j] = val[i];
}
}
return solverResult;
}
alica::AgentQuery ContainerUtils::toAgentQuery(capnp::FlatArrayMessageReader& msg, essentials::IDManager& idManager)
{
alica_msgs::AgentQuery::Reader reader = msg.getRoot<alica_msgs::AgentQuery>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::AgentQuery agentQuery;
agentQuery.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
agentQuery.senderSdk = reader.getSenderSDK();
agentQuery.planHash = reader.getPlanHash();
return agentQuery;
}
alica::AgentAnnouncement ContainerUtils::toAgentAnnouncement(capnp::FlatArrayMessageReader &msg, essentials::IDManager& idManager)
{
alica_msgs::AgentAnnouncement::Reader reader = msg.getRoot<alica_msgs::AgentAnnouncement>();
#ifdef CAPNZERO_PROXY_DEBUG
std::cout << "alica_capnzero_proxy::ContainerUtils: Received '" << reader.toString().flatten().cStr() << "'" << std::endl;
#endif
alica::AgentAnnouncement agentAnnouncement;
agentAnnouncement.senderID = idManager.getIDFromBytes(
reader.getSenderId().getValue().asBytes().begin(), reader.getSenderId().getValue().size(), (uint8_t) reader.getSenderId().getType());
agentAnnouncement.senderSdk = reader.getSenderSDK();
agentAnnouncement.planHash = reader.getPlanHash();
agentAnnouncement.senderName = reader.getSenderName();
agentAnnouncement.token = reader.getToken();
agentAnnouncement.roleId = reader.getRoleId();
capnp::List<alica_msgs::StringTuple>::Reader capabilities = reader.getCapabilities();
for (unsigned int i = 0; i < capabilities.size(); ++i) {
alica_msgs::StringTuple::Reader tmpCapability = capabilities[i];
agentAnnouncement.capabilities.emplace_back();
agentAnnouncement.capabilities[i].first = tmpCapability.getKey();
agentAnnouncement.capabilities[i].second = tmpCapability.getValue();
}
return agentAnnouncement;
}
void ContainerUtils::toMsg(alica::AllocationAuthorityInfo aai, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::AllocationAuthorityInfo::Builder msg = msgBuilder.initRoot<alica_msgs::AllocationAuthorityInfo>();
msg.setParentState(aai.parentState);
msg.setPlanId(aai.planId);
msg.setParentState(aai.parentState);
msg.setPlanType(aai.planType);
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(aai.senderID->getRaw(), (unsigned int) aai.senderID->getSize()));
sender.setType(aai.senderID->getType());
capnzero::ID::Builder authority = msg.initAuthority();
authority.setValue(kj::arrayPtr(aai.authority->getRaw(), (unsigned int) aai.authority->getSize()));
::capnp::List<alica_msgs::EntrypointRobots>::Builder entrypoints = msg.initEntrypointRobots((unsigned int) aai.entryPointRobots.size());
for (unsigned int i = 0; i < aai.entryPointRobots.size(); ++i) {
auto ep = aai.entryPointRobots[i];
alica_msgs::EntrypointRobots::Builder tmp = entrypoints[i];
tmp.setEntrypoint(ep.entrypoint);
::capnp::List<capnzero::ID>::Builder tmpRobots = tmp.initRobots((unsigned int) ep.robots.size());
for (unsigned int j = 0; j < ep.robots.size(); ++i) {
capnzero::ID::Builder tmpUUID = tmpRobots[j];
tmpUUID.setValue(kj::arrayPtr(ep.robots[j]->getRaw(), (unsigned int) ep.robots[j]->getSize()));
tmpUUID.setType(ep.robots[j]->getType());
}
}
}
void ContainerUtils::toMsg(alica::AlicaEngineInfo aei, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::AlicaEngineInfo::Builder msg = msgBuilder.initRoot<alica_msgs::AlicaEngineInfo>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(aei.senderID->getRaw(), (unsigned int) aei.senderID->getSize()));
sender.setType(aei.senderID->getType());
msg.setMasterPlan(aei.masterPlan);
msg.setCurrentPlan(aei.currentPlan);
msg.setCurrentRole(aei.currentRole);
msg.setCurrentState(aei.currentState);
msg.setCurrentTask(aei.currentTask);
::capnp::List<capnzero::ID>::Builder agents = msg.initAgentIdsWithMe((unsigned int) aei.robotIDsWithMe.size());
for (unsigned int i = 0; i < aei.robotIDsWithMe.size(); ++i) {
auto& robo = aei.robotIDsWithMe[i];
capnzero::ID::Builder tmp = agents[0];
tmp.setValue(kj::arrayPtr(robo->getRaw(), (unsigned int) robo->getSize()));
tmp.setType(robo->getType());
}
}
void ContainerUtils::toMsg(alica::PlanTreeInfo pti, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::PlanTreeInfo::Builder msg = msgBuilder.initRoot<alica_msgs::PlanTreeInfo>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(pti.senderID->getRaw(), (unsigned int) pti.senderID->getSize()));
sender.setType(pti.senderID->getType());
::capnp::List<int64_t>::Builder stateIds = msg.initStateIds((unsigned int) pti.stateIDs.size());
for (unsigned int i = 0; i < pti.stateIDs.size(); ++i) {
stateIds.set(i, pti.stateIDs[i]);
}
::capnp::List<int64_t>::Builder succededEps = msg.initSucceededEps((unsigned int) pti.succeededEPs.size());
for (unsigned int i = 0; i < pti.succeededEPs.size(); ++i) {
succededEps.set(i, pti.succeededEPs[i]);
}
}
void ContainerUtils::toMsg(alica::RoleSwitch rs, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::RoleSwitch::Builder msg = msgBuilder.initRoot<alica_msgs::RoleSwitch>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(rs.senderID->getRaw(), (unsigned int) rs.senderID->getSize()));
sender.setType(rs.senderID->getType());
msg.setRoleId(rs.roleID);
}
void ContainerUtils::toMsg(alica::SyncReady sr, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::SyncReady::Builder msg = msgBuilder.initRoot<alica_msgs::SyncReady>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(sr.senderID->getRaw(), (unsigned int) sr.senderID->getSize()));
sender.setType(sr.senderID->getType());
msg.setSynchronisationId(sr.synchronisationID);
}
void ContainerUtils::toMsg(alica::SyncTalk st, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::SyncTalk::Builder msg = msgBuilder.initRoot<alica_msgs::SyncTalk>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(st.senderID->getRaw(), (unsigned int) st.senderID->getSize()));
sender.setType(st.senderID->getType());
::capnp::List<alica_msgs::SyncData>::Builder syncData = msg.initSyncData((unsigned int) st.syncData.size());
for (unsigned int i = 0; i < st.syncData.size(); ++i) {
auto& ds = st.syncData[i];
alica_msgs::SyncData::Builder tmpData = syncData[i];
capnzero::ID::Builder tmpId = tmpData.initRobotId();
tmpId.setValue(kj::arrayPtr(ds.agentID->getRaw(), (unsigned int) ds.agentID->getSize()));
tmpId.setType(ds.agentID->getType());
tmpData.setAck(ds.ack);
tmpData.setTransitionHolds(ds.conditionHolds);
tmpData.setTransitionId(ds.transitionID);
}
}
void ContainerUtils::toMsg(alica::SolverResult sr, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::SolverResult::Builder msg = msgBuilder.initRoot<alica_msgs::SolverResult>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(sr.senderID->getRaw(), (unsigned int) sr.senderID->getSize()));
sender.setType(sr.senderID->getType());
::capnp::List<alica_msgs::SolverVar>::Builder vars = msg.initVars((unsigned int) sr.vars.size());
for (unsigned int i = 0; i < sr.vars.size(); ++i) {
auto& var = sr.vars[i];
alica_msgs::SolverVar::Builder tmpVar = vars[i];
tmpVar.setId(var.id);
tmpVar.setValue(kj::arrayPtr(var.value, sizeof(var.value)));
}
}
void ContainerUtils::toMsg(alica::AgentQuery aq, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::AgentQuery::Builder msg = msgBuilder.initRoot<alica_msgs::AgentQuery>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(aq.senderID->getRaw(), (unsigned int) aq.senderID->getSize()));
sender.setType(aq.senderID->getType());
msg.setSenderSDK(aq.senderSdk);
msg.setPlanHash(aq.planHash);
}
void ContainerUtils::toMsg(alica::AgentAnnouncement aa, ::capnp::MallocMessageBuilder& msgBuilder)
{
alica_msgs::AgentAnnouncement::Builder msg = msgBuilder.initRoot<alica_msgs::AgentAnnouncement>();
capnzero::ID::Builder sender = msg.initSenderId();
sender.setValue(kj::arrayPtr(aa.senderID->getRaw(), (unsigned int) aa.senderID->getSize()));
sender.setType(aa.senderID->getType());
msg.setSenderSDK(aa.senderSdk);
msg.setSenderName(aa.senderName);
msg.setPlanHash(aa.planHash);
msg.setRoleId(aa.roleId);
msg.setToken(aa.token);
::capnp::List<::alica_msgs::StringTuple>::Builder capabilities = msg.initCapabilities((unsigned int)aa.capabilities.size());
for (unsigned int i = 0; i < aa.capabilities.size(); i++) {
::alica_msgs::StringTuple::Builder stringTuple = capabilities[i];
stringTuple.setKey(aa.capabilities[i].first);
stringTuple.setValue(aa.capabilities[i].second);
}
}
} // namespace alica_capnzero_proxy | 49.84058 | 166 | 0.702879 | [
"vector"
] |
af26b4ad2a4897647737d88b635fc506664b3102 | 25,778 | cpp | C++ | src/ofxPixelUtils.cpp | Spacechild1/ofxPixelUtils | cff2d52f1b20d8d43f2d0f0e2b244a9898eccd6c | [
"MIT"
] | null | null | null | src/ofxPixelUtils.cpp | Spacechild1/ofxPixelUtils | cff2d52f1b20d8d43f2d0f0e2b244a9898eccd6c | [
"MIT"
] | null | null | null | src/ofxPixelUtils.cpp | Spacechild1/ofxPixelUtils | cff2d52f1b20d8d43f2d0f0e2b244a9898eccd6c | [
"MIT"
] | null | null | null | #include "ofxPixelUtils.h"
// begin namespace
namespace ofxPixelUtils {
/// color functions:
//-------------------------------------------------------------
vector<float> getMeanColor(const ofPixels& pixels){
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
}
const int numChannels = pixels.getNumChannels();
const uint32_t length = pixels.getWidth()*pixels.getHeight();
vector<float> result(numChannels);
const unsigned char * pix = pixels.getData();
for (int k = 0; k < numChannels; ++k){
float sum = 0;
for (uint32_t i = 0; i < length; ++i){
sum += pix[i*numChannels+k];
}
result[k] = sum / (length*255.f);
}
return result;
}
//----------------------------------------------------------
float getMeanColor(const ofPixels& pixels, int channel){
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
}
const int numChannels = pixels.getNumChannels();
channel = min(channel, numChannels-1);
const uint32_t length = pixels.getWidth()*pixels.getHeight();
float sum = 0.f;
const unsigned char * pix = pixels.getData();
for (uint32_t i = 0; i < length; ++i){
sum += pix[i*numChannels+channel];
}
sum = sum / (length*255.f);
return sum;
}
//----------------------------------------------------------
float getBrightness(const ofPixels& pixels){
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
}
const uint32_t length = pixels.getWidth()*pixels.getHeight()*pixels.getNumChannels();
float sum = 0.f;
const unsigned char* pix = pixels.getData();
for (uint32_t i = 0; i < length; ++i){
sum += pix[i];
}
sum = sum / (length*255.f);
return sum;
}
//---------------------------------------------------------------
void adjustGain(ofPixels &pixels, float gain){
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
return;
}
if (gain == 1.f){
return;
}
gain = std::max(0.f, gain);
const int32_t length = pixels.getWidth()*pixels.getHeight()*pixels.getNumChannels();
unsigned char * pix = pixels.getData();
for (uint32_t i = 0; i < length; ++i){
float temp = (pix[i] / 255.f) * gain;
temp = std::min(1.f, temp);
pix[i] = static_cast<int>(temp * 255.f + 0.5f);
}
}
void adjustGain(ofPixels &pixels, float gain, int channel){
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
return;
}
if (gain == 1.f){
return;
}
gain = std::max(0.f, gain);
const int numChannels = pixels.getNumChannels();
channel = std::max(0, std::min(numChannels-1, channel));
const int32_t length = pixels.getWidth()*pixels.getHeight();
unsigned char * pix = pixels.getData();
for (int i = 0; i < length; ++i){
int index = i * numChannels + channel;
float temp = (pix[index] / 255.f) * gain;
temp = std::min(1.f, temp);
pix[index] = static_cast<int>(temp * 255.f + 0.5f);
}
}
//------------------------------------------------------------------------------------
void adjustBrightnessAndContrast(ofPixels& pixels, float brightness, float contrast){
if (pixels.isAllocated()){
const uint32_t length = pixels.getWidth()*pixels.getHeight()*pixels.getNumChannels();
contrast = max(0.f, contrast);
unsigned char * pix = pixels.getData();
// only contrast:
if ((brightness == 0)&&(contrast != 1)){
for (uint32_t i = 0; i < length; ++i){
// simple formula for contrast adjustment
int temp = static_cast<int>((pix[i] - 128)*contrast + 128.5f);
temp = max(0, min(255, temp));
pix[i] = static_cast<unsigned char>(temp);
}
}
// only brightness:
else if ((brightness != 0)&&(contrast == 1)){
for (uint32_t i = 0; i < length; ++i){
int temp = static_cast<int>(pix[i] + brightness);
temp = max(0, min(255, temp));
pix[i] = static_cast<unsigned char>(temp);
}
}
// brightness + contrast:
else if ((brightness != 0)&&(contrast != 1)){
for (uint32_t i = 0; i < length; ++i){
int temp = static_cast<int>((pix[i] - 128)*contrast + 128.5 + brightness);
temp = max(0, min(255, temp));
pix[i] = static_cast<unsigned char>(temp);
}
// neither brightness nor contrast - do nothing.
}
} else {
cout << "pixels not allocated!\n";
}
}
void adjustBrightnessAndContrast(ofPixels& pixels, float brightness, float contrast, int channel){
if (pixels.isAllocated()){
const int numChannels = pixels.getNumChannels();
const uint32_t length = pixels.getWidth()*pixels.getHeight();
channel = max(0, min(numChannels-1, channel));
contrast = max(0.f, contrast);
unsigned char * pix = pixels.getData();
// only contrast:
if ((brightness == 0)&&(contrast != 1)){
for (uint32_t i = 0; i < length; ++i){
int index = i * numChannels + channel;
// only contrast adjustment
int temp = static_cast<int>((pix[index] - 128)*contrast + 128.5f);
temp = max(0, min(255, temp));
pix[index] = static_cast<unsigned char>(temp);
}
}
// only brightness:
else if ((brightness != 0)&&(contrast == 1)){
for (uint32_t i = 0; i < length; ++i){
int index = i * numChannels + channel;
// only brightness adjustment
int temp = static_cast<int>(pix[index] + brightness);
temp = max(0, min(255, temp));
pix[index] = static_cast<unsigned char>(temp);
}
}
// brightness + contrast:
else if ((brightness != 0)&&(contrast != 1)){
for (uint32_t i = 0; i < length; ++i){
int index = i * numChannels + channel;
// simple formula for contrast and brightness adjustment
int temp = static_cast<int>((pix[i] - 128)*contrast + 128.5f + brightness);
temp = max(0, min(255, temp));
pix[index] = static_cast<unsigned char>(temp);
}
// neither brightness nor contrast - do nothing
}
} else {
cout << "pixels not allocated!\n";
}
}
//---------------------------------------------------------------------------
void adjustHSB(ofPixels& pixels, float hue, float saturation, float brightness){
if (hue == 0 && saturation == 1 && brightness == 1){
// no adjustment
return;
}
if (!pixels.isAllocated()){
return;
}
const int channels = pixels.getNumChannels();
if (channels == 3 || channels == 4){
const uint32_t length = pixels.getWidth()*pixels.getHeight()*channels;
unsigned char * pix = pixels.getData();
for (uint32_t i = 0; i < length; i += channels){
int r = pix[i];
int g = pix[i+1];
int b = pix[i+2];
float newHue, newSaturation, newBrightness;
// first calculate orginal HSB values:
// get strongest channels
float maxVal = r;
if(g > maxVal) {
maxVal = g;
}
if(b > maxVal) {
maxVal = b;
}
// get weakest channel
float minVal = r;
if(g < minVal) {
minVal = g;
}
if(b < minVal) {
minVal = b;
}
// check for grays
if(maxVal == minVal) {
newHue = 0.f;
newSaturation = 0.f;
newBrightness = maxVal;
} else {
float hueSixth;
if(r == maxVal) {
hueSixth = (g - b) / (maxVal - minVal);
if(hueSixth < 0.f)
hueSixth += 6.f;
} else if (g == maxVal) {
hueSixth = 2.f + (b - r) / (maxVal - minVal);
} else {
hueSixth = 4.f + (r - g) / (maxVal - minVal);
}
newHue = 255.f * hueSixth / 6.f;
newSaturation = 255.f * (maxVal - minVal) / maxVal;
newBrightness = maxVal;
}
//
// adjust HSB:
//
newHue += hue*255.f;
newSaturation *= saturation;
newBrightness *= brightness;
// wrap/clip new values
newHue = fmodf(newHue, 255.f);
if (newHue < 0) {
newHue += 255.f;
}
newSaturation = max(0.f, min(255.f, newSaturation));
newBrightness = max(0.f, min(255.f, newBrightness));
//
// convert back to RGB
//
if(newBrightness == 0) { // black
pix[i] = 0;
pix[i+1] = 0;
pix[i+2] = 0;
} else if(newSaturation == 0) { // grays
pix[i] = newBrightness;
pix[i+1] = newBrightness;
pix[i+2] = newBrightness;
} else {
float hueSix = newHue * 6.f / 255.f;
float saturationNorm = newSaturation / 255.f;
int hueSixCategory = (int) floorf(hueSix);
float hueSixRemainder = hueSix - hueSixCategory;
unsigned char pv = (unsigned char) ((1.f - saturationNorm) * newBrightness);
unsigned char qv = (unsigned char) ((1.f - saturationNorm * hueSixRemainder) * newBrightness);
unsigned char tv = (unsigned char) ((1.f - saturationNorm * (1.f - hueSixRemainder)) * newBrightness);
switch(hueSixCategory) {
case 0: case 6: // r
pix[i] = newBrightness;
pix[i+1] = tv;
pix[i+2] = pv;
break;
case 1: // g
pix[i] = qv;
pix[i+1] = newBrightness;
pix[i+2] = pv;
break;
case 2:
pix[i] = pv;
pix[i+1] = newBrightness;
pix[i+2] = tv;
break;
case 3: // b
pix[i] = pv;
pix[i+1] = qv;
pix[i+2] = newBrightness;
break;
case 4:
pix[i] = tv;
pix[i+1] = pv;
pix[i+2] = newBrightness;
break;
case 5: // back to r
pix[i] = newBrightness;
pix[i+1] = pv;
pix[i+2] = qv;
break;
}
}
}
} else {
cout << "Error: pixels must be RGB or RGBA\n";
return;
}
}
//-----------------------------------------------------------------------------
void applyColorCurve(ofPixels& pixels, vector<unsigned char>& table, int channel){
if (table.size() < 256){
cout << "look up table size must not be smaller than 256!\n";
return;
}
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
return;
}
int numChannels = pixels.getNumChannels();
const uint32_t length = pixels.getWidth()*pixels.getHeight();
channel = max(0, min(numChannels-1, channel));
unsigned char * pix = pixels.getData();
for (uint32_t i = 0; i < length; ++i){
int index = i * numChannels + channel;
// get color
int color = pix[index];
// look up color in table and assign new value
pix[index] = table[color];
}
}
void applyColorCurve(ofPixels& pixels, vector<unsigned char>& table){
if (table.size() < 256){
cout << "look up table size must not be smaller than 256!\n";
return;
}
if (!pixels.isAllocated()){
cout << "pixels not allocated!\n";
return;
}
uint32_t length = pixels.getWidth()*pixels.getHeight()*pixels.getNumChannels();
unsigned char * pix = pixels.getData();
for (uint32_t i = 0; i < length; ++i){
// get color
int color = pix[i];
// look up color in table and assign new value
pix[i] = table[i];
}
}
//------------------------------------------------------------------------
void convertToGrayscale(const ofPixels& src, ofPixels& dest, GrayscaleMode mode){
if (!src.isAllocated()){
cout << "source pixels not allocated!\n";
return;
}
const int w = src.getWidth();
const int h = src.getHeight();
const int channels = src.getNumChannels();
const uint32_t length = w*h*channels;
if (channels != 3 && channels != 4){
cout << "source pixels must have 3 or 4 channels!\n";
return;
}
if (w != dest.getWidth() || h != dest.getHeight() || dest.getNumChannels() != 1){
dest.allocate(w, h, 1);
}
const unsigned char * pix = src.getData();
unsigned char * out = dest.getData();
switch (mode){
case GrayscaleMode::LIGHTNESS:
for (int i = 0, k = 0; i < length; i+=channels, k++){
float sum = 0;
// The formula for luminosity is 0.21 R + 0.72 G + 0.07 B.
int r = pix[i];
int g = pix[i+1];
int b = pix[i+2];
unsigned int min = r;
if (min > g) min = g;
if (min > b) min = b;
unsigned int max = r;
if (max > g) max = g;
if (max > b) max = b;
out[k] = (float)(min+max)/2.f;
}
break;
case GrayscaleMode::AVERAGE:
for (int i = 0, k = 0; i < length; i+=channels, k++){
float sum = 0;
sum += pix[i];
sum += pix[i+1];
sum += pix[i+2];
out[k] = sum/3.f;
}
break;
case GrayscaleMode::LUMINANCE:
for (int i = 0, k = 0; i < length; i+=channels, k++){
float sum = 0;
// The formula for luminosity is 0.21 R + 0.72 G + 0.07 B.
sum += pix[i]*0.21f;
sum += pix[i+1]*0.72f;
sum += pix[i+2]*0.07f;
out[k] = sum;
}
break;
}
}
//-------------------------------------------------------
void applyAlphaMask(const ofPixels& src, const ofPixels& mask, ofPixels& dest, bool invertMask){
const int channels = src.getNumChannels();
if (channels != 1 && channels != 3){
cout << "source image must be RGB or greyscale!\n";
return;
}
if (mask.getNumChannels() != 1){
cout << "mask must be greyscale!\n";
return;
}
const int w = src.getWidth();
const int h = src.getHeight();
if (w != mask.getWidth() || h != mask.getHeight()){
"image and mask dimensions don't match!\n";
return;
}
if (dest.getWidth() != w || dest.getHeight() != h || dest.getNumChannels() != (channels+1)){
dest.allocate(w, h, channels+1);
}
const unsigned char* in = src.getData();
const unsigned char* m = mask.getData();
unsigned char* out = dest.getData();
const uint32_t size = w*h;
// source image and mask are both 1 channel (G), result is 2 channel (GA)
if (channels == 1){
for (uint32_t i = 0; i < size; ++i){
const int k = 2*i;
out[k] = in[i];
out[k+1] = invertMask ? 255 - m[i] : m[i];
}
}
// source image is 3 channel (RGB) and mask is 1 channel (G), result is 4 channel (RGBA)
else {
for (uint32_t i = 0; i < size; ++i){
const int j = 3*i;
const int k = 4*i;
out[k] = in[j];
out[k+1] = in[j+1];
out[k+2] = in[j+2];
out[k+3] = invertMask ? 255 - m[i] : m[i];
}
}
}
//-------------------------------------------------------
/// Movement Detection
MovementDetection::MovementDetection() {
/// default constructor
myFeedback = 0.f;
myGain = 1.f;
myThreshold = 0;
bBinary = false;
bInvert = false;
width = 0;
height = 0;
numChannels = 0;
bAllocated = false;
buf_1 = nullptr;
buf_w = nullptr;
}
MovementDetection::MovementDetection(int w, int h, int channels) {
myFeedback = 0.f;
myGain = 1.f;
myThreshold = 0;
bBinary = false;
bInvert = false;
width = 0;
height = 0;
numChannels = 0;
bAllocated = false;
buf_1 = nullptr;
buf_w = nullptr;
allocate(w, h, channels);
}
MovementDetection::~MovementDetection() {
/// destructor which deletes the buffers
if (bAllocated) {
delete[] buf_1;
delete[] buf_w;
}
}
void MovementDetection::allocate(int w, int h, int channels){
w = std::max(0, w);
h = std::max(0, h);
channels = std::max(0, channels);
uint32_t size = w * h * channels;
// check for bad dimensions
if (size == 0 || channels > 4){
cout << "bad dimensions, not allocating!\n";
return;
}
if (bAllocated){
delete[] buf_1;
delete[] buf_w;
}
buf_1 = new float[size];
buf_w = new float[size];
outPixels.allocate(w, h, channels);
width = w;
height = h;
numChannels = channels;
bAllocated = true;
clearFilter();
}
bool MovementDetection::isAllocated(){
return bAllocated;
}
void MovementDetection::in(const ofPixels& inPixels) {
if (!inPixels.isAllocated()){
cout << "incoming pixels not allocated!\n";
return;
}
const int w = inPixels.getWidth();
const int h = inPixels.getHeight();
const int channels = inPixels.getNumChannels();
/// check if the dimensions have changed and reallocate if necessary.
if ((w != width)||(h != height)||(channels != numChannels)){
allocate(w, h, channels);
}
if (!bAllocated){
cout << "error: allocation failed!\n"; // shouldn't happen!
return;
}
/// calculate the following difference equation:
///
/// norm = (1-fb)*gain
/// w[n] = x[n]*norm + w[n-1]*fb
/// y[n] = abs(w[n] - w[n-1])
const unsigned char* inPix = inPixels.getData();
unsigned char* outPix = outPixels.getData();
const uint32_t size = w*h*channels;
const float norm = (1.f - myFeedback);
const float gain = myGain * 255.f;
// generate tiny random offset to protect against denormals
const float noise = ofRandom(-1e-006, 1e-006);
// special case 1: everything is low
if (myThreshold > 255){
const int low = (bBinary && bInvert) ? 255 : 0;
for (uint32_t i = 0; i < size; ++i){
buf_w[i] = inPix[i] / 255.f; // update the buffer nevertheless
outPix[i] = low;
}
}
// special case 2: everything is high
else if (bBinary && myThreshold == 0){
const int high = bInvert ? 0 : 255;
for (uint32_t i = 0; i < size; ++i){
buf_w[i] = inPix[i] / 255.f; // update the buffer nevertheless
outPix[i] = high;
}
}
/*
// special case 3: no need for threshold checking
else if (!bBinary && myThreshold == 0){
for (uint32_t i = 0; i < size; ++i){
// averaging
buf_w[i] = inPix[i] * norm / 255.f + buf_1[i] * myFeedback + noise;
// take difference, amplify and round to int
int32_t temp = static_cast<int32_t>((buf_w[i] - buf_1[i])*gain + 0.5f);
// take absolute value
temp = abs(temp);
// clip high output
temp = std::min(255, temp);
outPix[i] = static_cast<unsigned char>(temp);
}
}
*/
// binary thresholding
else if (bBinary){
const int low = bInvert ? 255 : 0;
const int high = bInvert ? 0 : 255;
for (uint32_t i = 0; i < size; ++i){
// averaging
buf_w[i] = inPix[i] * norm / 255.f + buf_1[i] * myFeedback + noise;
// take difference, amplify and round to int
int32_t temp = static_cast<int32_t>((buf_w[i] - buf_1[i])*gain + 0.5f);
// take absolute value
temp = abs(temp);
// apply threshold function
temp = (temp >= myThreshold) ? high : low;
outPix[i] = static_cast<unsigned char>(temp);
}
}
// non-binary thresholding
else {
for (uint32_t i = 0; i < size; ++i){
// averaging
buf_w[i] = inPix[i] * norm / 255.f + buf_1[i] * myFeedback + noise;
// take difference, amplify and round to int
int32_t temp = static_cast<int32_t>((buf_w[i] - buf_1[i])*gain + 0.5f);
// take absolute value
temp = abs(temp);
// apply threshold function and clip high output
if (temp >= myThreshold){
temp = std::min(255, temp);
} else {
temp = 0;
}
outPix[i] = static_cast<unsigned char>(temp);
}
}
/// move buffers by swapping the pointers.
float * temp = buf_1;
buf_1 = buf_w;
buf_w = temp;
// buf_w points now to old buf_1 which will be overwritten the next time.
}
const ofPixels& MovementDetection::out() const {
/// returns ofPixels (don't need to check. in the worst case, outPixels is simply not allocated.
return outPixels;
}
void MovementDetection::clearFilter() {
/// clear the buffers (but only if the filter is not empty)
const uint32_t size = width*height*numChannels;
if (bAllocated){
for (uint32_t i = 0; i < size; ++i){
buf_1[i] = 0;
}
}
}
void MovementDetection::setAveraging(float coeff) {
myFeedback = max(0.f, min(0.999999f, coeff));
}
void MovementDetection::setGain(float gain) {
myGain = gain;
}
void MovementDetection::setBinary(bool mode) {
bBinary = mode;
}
void MovementDetection::setThreshold(float threshold) {
// 0.f = everything passes, 1.f = nothing passes
myThreshold = max(0, static_cast<int>(threshold*256.f + 0.5f));
}
void MovementDetection::setInvert(bool mode) {
bInvert = mode;
}
float MovementDetection::getAveraging() const {
return myFeedback;
}
float MovementDetection::getGain() const {
return myGain;
}
bool MovementDetection::isBinary() const {
return bBinary;
}
float MovementDetection::getThreshold() const {
return (float) myThreshold / 256.f;
}
bool MovementDetection::isInvert() const {
return bInvert;
}
//---------------------------------------------------
BackgroundSubstraction::BackgroundSubstraction(){
myThreshold = 0;
bBinary = false;
bInvert = false;
}
BackgroundSubstraction::~BackgroundSubstraction(){
}
void BackgroundSubstraction::setBackground(const ofPixels &pix){
if (pix.isAllocated()){
myBackground = pix;
width = pix.getWidth();
height = pix.getHeight();
numChannels = pix.getNumChannels();
outPixels.allocate(width, height, numChannels);
}
}
void BackgroundSubstraction::setBackground(int w, int h, int channels, ofColor color){
myBackground.allocate(w, h, channels);
myBackground.setColor(color);
width = w;
height = h;
numChannels = channels;
outPixels.allocate(width, height, numChannels);
}
const ofPixels& BackgroundSubstraction::getBackground() const {
return myBackground;
}
bool BackgroundSubstraction::isBackgroundSet() const {
return myBackground.isAllocated();
}
void BackgroundSubstraction::in(const ofPixels &pix){
if (pix.getWidth() != width || pix.getHeight() != height || pix.getNumChannels() != numChannels){
cout << "input doesn't match background dimensions!\n";
return;
}
if (!isBackgroundSet()){
cout << "background is not set!\n";
return;
}
const unsigned char* in = pix.getData();
const unsigned char* back = myBackground.getData();
unsigned char* out = outPixels.getData();
const uint32_t size = width * height * numChannels;
if (!bBinary){
for (uint32_t i = 0; i < size; ++i){
int temp = (int) in[i] - (int) back[i];
temp = abs(temp);
out[i] = (temp >= myThreshold) ? temp : 0;
}
} else {
const int low = bInvert ? 255 : 0;
const int high = bInvert ? 0 : 255;
for (uint32_t i = 0; i < size; ++i){
int temp = (int) in[i] - (int) back[i];
temp = abs(temp);
temp = (temp >= myThreshold) ? high : low;
out[i] = temp;
}
}
}
const ofPixels& BackgroundSubstraction::out() const{
return outPixels;
}
void BackgroundSubstraction::setThreshold(float threshold){
// 0.f = everything passes, 1.f = nothing passes
myThreshold = std::max(0, static_cast<int>(threshold * 256.f + 0.5f));
}
float BackgroundSubstraction::getThreshold() const {
return myThreshold / 256.f;
}
void BackgroundSubstraction::setBinary(bool mode){
bBinary = mode;
}
bool BackgroundSubstraction::isBinary() const {
return bBinary;
}
void BackgroundSubstraction::setInvert(bool mode){
bInvert = mode;
}
bool BackgroundSubstraction::isInvert() const {
return bInvert;
}
} // end namespace
| 29.629885 | 118 | 0.508884 | [
"vector"
] |
af2f4920722d3e2025caa6d626f4dd26fddae8d2 | 1,930 | cpp | C++ | 3rdparty/glsl-optimizer/src/node/compiler.cpp | christiancoder/bgfx | b96deb1cecbd92b2ca46d7266499839069d6ba6a | [
"BSD-2-Clause"
] | 11,557 | 2015-01-03T22:48:11.000Z | 2022-03-31T18:20:41.000Z | 3rdparty/glsl-optimizer/src/node/compiler.cpp | christiancoder/bgfx | b96deb1cecbd92b2ca46d7266499839069d6ba6a | [
"BSD-2-Clause"
] | 1,731 | 2015-01-02T08:06:00.000Z | 2022-03-31T18:44:01.000Z | 3rdparty/glsl-optimizer/src/node/compiler.cpp | christiancoder/bgfx | b96deb1cecbd92b2ca46d7266499839069d6ba6a | [
"BSD-2-Clause"
] | 2,112 | 2015-01-05T13:03:36.000Z | 2022-03-31T19:18:02.000Z | #include "compiler.h"
using namespace v8;
using namespace node;
Persistent<Function> Compiler::constructor;
//----------------------------------------------------------------------
Compiler::Compiler(glslopt_target target)
{
_binding = glslopt_initialize(target);
}
//----------------------------------------------------------------------
Compiler::~Compiler()
{
release();
}
//----------------------------------------------------------------------
void Compiler::release()
{
if (_binding)
{
glslopt_cleanup(_binding);
_binding = 0;
}
}
//----------------------------------------------------------------------
void Compiler::Init(Handle<Object> exports)
{
NanScope();
// Prepare constructor template
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew<String>("Compiler"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
NanSetPrototypeTemplate(tpl, "dispose", NanNew<FunctionTemplate>(Dispose));
// Export the class
NanAssignPersistent<Function>(constructor, tpl->GetFunction());
exports->Set(NanNew<String>("Compiler"), tpl->GetFunction());
}
//----------------------------------------------------------------------
NAN_METHOD(Compiler::New)
{
NanScope();
if (args.IsConstructCall()) {
glslopt_target target = kGlslTargetOpenGL;
if (args[0]->IsInt32())
target = (glslopt_target)args[0]->Int32Value();
else if (args[0]->IsBoolean())
target = (glslopt_target)( (int)args[0]->BooleanValue() );
Compiler* obj = new Compiler(target);
obj->Wrap(args.This());
NanReturnValue(args.This());
} else {
Local<Function> cons = NanNew<Function>(constructor);
NanReturnValue(cons->NewInstance());
}
}
//----------------------------------------------------------------------
NAN_METHOD(Compiler::Dispose)
{
NanScope();
Compiler* obj = ObjectWrap::Unwrap<Compiler>(args.This());
obj->release();
NanReturnUndefined();
}
| 21.931818 | 76 | 0.546114 | [
"object"
] |
af32db4163db42cc3d122df5eebb1ee1b866aaf0 | 44,477 | cpp | C++ | hphp/runtime/vm/hackc-translator.cpp | leikahing/hhvm | 26617c88ca35c5e078c3aef12c061d7996925375 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/runtime/vm/hackc-translator.cpp | leikahing/hhvm | 26617c88ca35c5e078c3aef12c061d7996925375 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/runtime/vm/hackc-translator.cpp | leikahing/hhvm | 26617c88ca35c5e078c3aef12c061d7996925375 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | /*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "hphp/runtime/vm/hackc-translator.h"
#include "hphp/runtime/base/array-init.h"
#include "hphp/runtime/base/coeffects-config.h"
#include "hphp/runtime/base/memory-manager-defs.h"
#include "hphp/runtime/vm/as.h"
#include "hphp/runtime/vm/as-shared.h"
#include "hphp/runtime/vm/disas.h"
#include "hphp/runtime/vm/opcodes.h"
#include "hphp/runtime/vm/preclass.h"
#include "hphp/runtime/vm/preclass-emitter.h"
#include "hphp/runtime/vm/type-alias-emitter.h"
#include "hphp/runtime/vm/unit-gen-helpers.h"
#include "hphp/zend/zend-string.h"
#include <folly/Range.h>
namespace HPHP {
TRACE_SET_MOD(hackc_translate);
namespace {
using namespace HPHP::hackc;
using namespace HPHP::hackc::hhbc;
struct TranslationException : Exception {
template<class... A>
explicit TranslationException(A&&... args)
: Exception(folly::sformat(std::forward<A>(args)...))
{}
};
[[noreturn]] void error(const char* what) {
throw TranslationException("{}: {}", what, folly::errnoStr(errno));
}
struct TranslationState {
void enterCatch() {
handler.push(fe->bcPos());
}
void enterTry() {
start.push(fe->bcPos());
}
void finishTryCatch() {
assertx(!start.empty());
assertx(!handler.empty());
auto& eh = fe->addEHEnt();
eh.m_base = start.top();
eh.m_past = handler.top();
eh.m_iterId = -1;
eh.m_handler = handler.top();
eh.m_end = fe->bcPos();
start.pop();
handler.pop();
}
Id mergeLitstr(const StringData* sd) {
auto const id = ue->mergeLitstr(sd);
litstrMap.emplace(id, sd);
return id;
}
///////////////////////////////////////////////////////////////////////////////
// Opcode helpers
void addLabelJump(const Dummy&);
void addLabelJump(const Label& label);
void addLabelJump(const Label label[2]);
HPHP::RepoAuthType translateRepoAuthType(folly::StringPiece str);
HPHP::MemberKey translateMemberKey(const hhbc::MemberKey& mkey);
ArrayData* getArrayfromAdataId(const AdataId& id);
///////////////////////////////////////////////////////////////////////////////
// Locals are 0-indexed u32. In order to differentiate seeing no
// locals vs seeing a local with id 0, maxUnnamed is max local
// id + 1.
void trackMaxUnnamed(uint32_t loc) {
if (loc + 1 > maxUnnamed) maxUnnamed = loc + 1;
}
UnitEmitter* ue;
FuncEmitter* fe{nullptr};
PreClassEmitter* pce{nullptr};
// Map of adata identifiers to their associated static arrays.
std::map<std::string, ArrayData*> adataMap;
// Used for Execption Handler entry.
jit::stack<Offset> handler;
jit::stack<Offset> start;
struct LabelInfo {
// Target is the offset of the Label opcode
Offset target;
std::vector<Label> dvInits;
// First offset is the immediate offset of a Label, like a jump target.
// Second offset is the opcode containing the label immediate.(ie
// a jmp instruction itself). This is used for computing jmp delta to
// patch Label immediate.
std::vector<std::pair<Offset,Offset>> sources;
};
std::map<Label, LabelInfo> labelMap;
// In whole program mode it isn't possible to lookup a litstr in the global
// table while emitting, so keep a lookaside of litstrs seen by the assembler.
std::unordered_map<Id, const StringData*> litstrMap;
// Max local id encountered. Must be unsigned to match u32 representation
// in HackC.
uint32_t maxUnnamed{0};
Location::Range srcLoc{-1,-1,-1,-1};
std::vector<std::pair<hhbc::Label, Offset>> labelJumps;
};
///////////////////////////////////////////////////////////////////////////////
// hhbc::Slice helpers
template <class T>
folly::Range<const T*> range(Slice<T> const& s) {
return folly::range(s.data, s.data + s.len);
}
template <class T>
folly::Range<const T*> range(BumpSliceMut<T> const& s) {
return folly::range(s.data, s.data + s.len);
}
///////////////////////////////////////////////////////////////////////////////
// hhbc::Maybe helpers
template<typename T>
Optional<T> maybe(hackc::Maybe<T> m) {
if (m.tag == hackc::Maybe<T>::Tag::Nothing) return std::nullopt;
return m.Just._0;
}
template<typename T, typename Fn, typename ElseFn>
auto maybeOrElse(hackc::Maybe<T> m, Fn fn, ElseFn efn) {
auto opt = maybe(m);
return opt ? fn(opt.value()) : efn();
}
template<typename T, typename Fn>
auto maybeThen(hackc::Maybe<T> m, Fn fn) {
auto opt = maybe(m);
if (opt) fn(opt.value());
}
///////////////////////////////////////////////////////////////////////////////
namespace {
struct FatalUnitError : std::runtime_error {
FatalUnitError(
const std::string& msg,
const StringData* filePath,
Location::Range pos,
FatalOp op)
: std::runtime_error(msg)
, filePath(filePath)
, pos(pos)
, op(op)
{}
const StringData* filePath;
Location::Range pos;
FatalOp op;
};
}
///////////////////////////////////////////////////////////////////////////////
// hhbc::Str Helpers
std::string toString(const Str& str) {
assertx(str.data != nullptr);
return std::string{(const char*)str.data, str.len};
}
folly::StringPiece toStringPiece(const Str& str) {
assertx(str.data != nullptr);
return folly::StringPiece{(const char*)str.data, str.len};
}
StringData* toStaticString(const Str& str, uint32_t start = 0) {
assertx(start <= str.len);
return makeStaticString((char*)str.data + start, str.len - start);
}
// TODO(@voork): NamedLocals are still prefixed with '$'.
StringData* toNamedLocalStaticString(const Str& str) {
return toStaticString(str, 1);
}
StringData* makeDocComment(const Str& str) {
if (RuntimeOption::EvalGenerateDocComments) return toStaticString(str);
return staticEmptyString();
}
///////////////////////////////////////////////////////////////////////////////
using kind = hhbc::TypedValue::Tag;
HPHP::TypedValue toTypedValue(const hackc::hhbc::TypedValue& tv) {
auto hphp_tv = [&]() {
switch(tv.tag) {
case kind::Uninit:
return make_tv<KindOfUninit>();
case kind::Int:
return make_tv<KindOfInt64>(tv.Int._0);
case kind::Bool:
return make_tv<KindOfBoolean>(tv.Bool._0);
case kind::Float: {
return make_tv<KindOfDouble>(tv.Float._0);
}
case kind::String: {
auto const s = toStaticString(tv.String._0);
return make_tv<KindOfPersistentString>(s);
}
case kind::Null:
return make_tv<KindOfNull>();
case kind::Vec: {
VecInit v(tv.Vec._0.len);
auto set = range(tv.Vec._0);
for (auto const& elt : set) {
v.append(toTypedValue(elt));
}
auto tv = v.create();
ArrayData::GetScalarArray(&tv);
return make_tv<KindOfVec>(tv);
}
case kind::Dict: {
DictInit d(tv.Dict._0.len);
auto set = range(tv.Dict._0);
for (auto const& elt : set) {
switch (elt._0.tag) {
case kind::Int:
d.set(elt._0.Int._0, toTypedValue(elt._1));
break;
case kind::String: {
auto const s = toStaticString(elt._0.String._0);
d.set(s, toTypedValue(elt._1));
break;
}
case kind::LazyClass:{
if (RuntimeOption::EvalRaiseClassConversionWarning) {
raise_class_to_string_conversion_warning();
}
auto const s = toStaticString(elt._0.LazyClass._0);
d.set(s, toTypedValue(elt._1));
break;
}
default:
always_assert(false);
}
}
auto tv = d.create();
ArrayData::GetScalarArray(&tv);
return make_tv<KindOfDict>(tv);
}
case kind::Keyset: {
KeysetInit k(tv.Keyset._0.len);
auto set = range(tv.Keyset._0);
for (auto const& elt : set) {
k.add(toTypedValue(elt));
}
auto tv = k.create();
ArrayData::GetScalarArray(&tv);
return make_tv<KindOfKeyset>(tv);
}
case kind::LazyClass: {
auto const lc = LazyClassData::create(toStaticString(tv.LazyClass._0));
return make_tv<KindOfLazyClass>(lc);
}
}
not_reached();
}();
checkSize(hphp_tv, RuntimeOption::EvalAssemblerMaxScalarSize);
return hphp_tv;
}
///////////////////////////////////////////////////////////////////////////////
// Field translaters
void translateUserAttributes(Slice<HhasAttribute> attributes, UserAttributeMap& userAttrs) {
Trace::Indent indent;
auto attrs = range(attributes);
for (auto const& attr : attrs) {
auto const name = toStaticString(attr.name);
VecInit v(attr.arguments.len);
auto args = range(attr.arguments);
for (auto const& arg : args) {
v.append(toTypedValue(arg));
}
auto tv = v.create();
ArrayData::GetScalarArray(&tv);
userAttrs[name] = make_tv<KindOfVec>(tv);
};
}
template<bool isEnum=false>
std::pair<const StringData*, TypeConstraint> translateTypeInfo(const HhasTypeInfo& t) {
auto const user_type = maybeOrElse(t.user_type,
[&](Str& s) {return toStaticString(s);},
[&]() {return staticEmptyString();});
auto const type_name = isEnum
? user_type
: maybeOrElse(t.type_constraint.name,
[&](Str& s) {return toStaticString(s);},
[&]() {return nullptr;});
auto flags = t.type_constraint.flags;
return std::make_pair(user_type, TypeConstraint{type_name, flags});
}
void translateTypedef(TranslationState& ts, const HhasTypedef& t) {
UserAttributeMap userAttrs;
translateUserAttributes(t.attributes, userAttrs);
auto attrs = t.attrs;
if (!SystemLib::s_inited) attrs |= AttrPersistent;
auto const name = toStaticString(t.name._0);
auto const ty = translateTypeInfo(t.type_info).second;
auto tname = ty.typeName();
if (!tname) tname = staticEmptyString();
auto tys = toTypedValue(t.type_structure);
assertx(isArrayLikeType(tys.m_type));
tvAsVariant(&tys).setEvalScalar();
auto te = ts.ue->newTypeAliasEmitter(name->toCppString());
te->init(
t.span.line_begin,
t.span.line_end,
attrs,
tname,
tname->empty() ? AnnotType::Mixed : ty.type(),
(ty.flags() & TypeConstraintFlags::Nullable) != 0,
ArrNR{tys.m_data.parr},
Array{}
);
te->setUserAttributes(userAttrs);
}
template<bool isType>
void addConstant(TranslationState& ts,
const StringData* name,
Optional<hhbc::TypedValue> tv,
bool isAbstract) {
auto const kind = isType
? ConstModifiers::Kind::Type
: ConstModifiers::Kind::Value;
if (!tv) {
assertx(isAbstract);
ts.pce->addAbstractConstant(name, kind, false);
return;
}
auto tvInit = toTypedValue(tv.value());
ts.pce->addConstant(name,
nullptr,
&tvInit,
Array{},
kind,
PreClassEmitter::Const::Invariance::None,
false,
isAbstract);
}
void translateClassConstant(TranslationState& ts, const HhasConstant& c) {
auto const name = toStaticString(c.name._0);
auto const tv = maybe(c.value);
addConstant<false>(ts, name, tv, c.is_abstract);
}
void translateTypeConstant(TranslationState& ts, const HhasTypeConstant& c) {
auto const name = toStaticString(c.name);
auto const tv = maybe(c.initializer);
addConstant<true>(ts, name, tv, c.is_abstract);
}
void translateCtxConstant(TranslationState& ts, const HhasCtxConstant& c) {
auto const name = toStaticString(c.name);
bool isAbstract = c.is_abstract;
auto coeffects = PreClassEmitter::Const::CoeffectsVec{};
auto recognized = range(c.recognized);
for (auto const& r : recognized) {
coeffects.push_back(toStaticString(r));
}
auto unrecognized = range(c.unrecognized);
for (auto const& u : unrecognized) {
coeffects.push_back(toStaticString(u));
}
// T112974443: temporarily drop the abstract ones until runtime is fixed
if (isAbstract && !RuntimeOption::EvalEnableAbstractContextConstants) return;
DEBUG_ONLY auto added =
ts.pce->addContextConstant(name, std::move(coeffects), isAbstract);
assertx(added);
}
void translateProperty(TranslationState& ts, const HhasProperty& p, const UpperBoundMap& classUbs) {
UserAttributeMap userAttributes;
translateUserAttributes(p.attributes, userAttributes);
auto const heredoc = maybeOrElse(p.doc_comment,
[&](Str& s) {return makeDocComment(s);},
[&]() {return staticEmptyString();});
auto [userTy, typeConstraint] = translateTypeInfo(p.type_info);
auto const hasReifiedGenerics =
userAttributes.find(s___Reified.get()) != userAttributes.end();
// T112889109: Passing in {} as the third argument here exposes a gcc compiler bug.
auto ub = getRelevantUpperBounds(typeConstraint, classUbs, classUbs, {});
auto needsMultiUBs = false;
if (ub.size() == 1 && !hasReifiedGenerics) {
applyFlagsToUB(ub[0], typeConstraint);
typeConstraint = ub[0];
} else if (!ub.empty()) {
needsMultiUBs = true;
}
auto const tv = maybeOrElse(p.initial_value,
[&](hhbc::TypedValue& s) {return toTypedValue(s);},
[&]() {return make_tv<KindOfNull>();});
auto const name = toStaticString(p.name._0);
ITRACE(2, "Translating property {} {}\n", name, tv.pretty());
ts.pce->addProperty(name,
p.flags,
userTy,
typeConstraint,
needsMultiUBs ? std::move(ub) : UpperBoundVec{},
heredoc,
&tv,
HPHP::RepoAuthType{},
userAttributes);
}
void translateClassBody(TranslationState& ts,
const HhasClass& c,
const UpperBoundMap& classUbs) {
auto props = range(c.properties);
for (auto const& p : props) {
translateProperty(ts, p, classUbs);
}
auto constants = range(c.constants);
for (auto const& cns : constants) {
translateClassConstant(ts, cns);
}
auto tconstants = range(c.type_constants);
for (auto const& t : tconstants) {
translateTypeConstant(ts, t);
}
auto cconstants = range(c.ctx_constants);
for (auto const& ctx : cconstants) {
translateCtxConstant(ts, ctx);
}
}
using TypeInfoPair = Pair<Str, Slice<HhasTypeInfo>>;
void translateUbs(const TypeInfoPair& ub, UpperBoundMap& ubs) {
auto const& name = toStaticString(ub._0);
CompactVector<TypeConstraint> ret;
auto infos = range(ub._1);
for (auto const& i : infos) {
ubs[name].emplace_back(translateTypeInfo(i).second);
}
}
void translateEnumType(TranslationState& ts, const Maybe<HhasTypeInfo>& t) {
auto const tOpt = maybe(t);
if (tOpt) {
ts.pce->setEnumBaseTy(translateTypeInfo<true>(tOpt.value()).second);
}
}
void translateRequirements(TranslationState& ts, Pair<ClassName, TraitReqKind> requirement) {
auto const name = toStaticString(requirement._0._0);
auto const requirementKind = [&] {
switch (requirement._1) {
case TraitReqKind::MustExtend: return PreClass::RequirementExtends;
case TraitReqKind::MustImplement: return PreClass::RequirementImplements;
case TraitReqKind::MustBeClass: return PreClass::RequirementClass;
}
not_reached();
}();
ts.pce->addClassRequirement(PreClass::ClassRequirement(name, requirementKind));
}
HPHP::RepoAuthType TranslationState::translateRepoAuthType(folly::StringPiece str) {
using T = HPHP::RepoAuthType::Tag;
auto const [tag, what] = [&] {
#define TAG(x, name) \
if (str.startsWith(name)) return std::make_pair(T::x, name);
REPO_AUTH_TYPE_TAGS(TAG)
#undef TAG
not_reached();
}();
if (HPHP::RepoAuthType::tagHasName(tag)) {
str.removePrefix(what);
auto const name = makeStaticString(str.data());
mergeLitstr(name);
return HPHP::RepoAuthType{tag, name};
}
return HPHP::RepoAuthType{tag};
}
////////////////////////////////////////////////////////////////////
// Do nothing for dummy values. Used for MemoGetEager where both labels
// are passed through first BA.
void TranslationState::addLabelJump(const Dummy&) {}
void TranslationState::addLabelJump(const Label& label) {
labelJumps.emplace_back(label, fe->bcPos());
fe->emitInt32(0);
}
// MemoGetEager passes both labels in first BA opcode
void TranslationState::addLabelJump(const Label label[2]) {
addLabelJump(label[0]);
addLabelJump(label[1]);
}
// labelOpcodeOff is the offset of the label opcode.
// immOff is the offset where the label appears as an immediate, ie as a Jump target.
void updateLabelSourceforJump(TranslationState& ts,
const Label& label,
Offset immOff,
Offset labelOpcodeOff) {
auto& labelInfo = ts.labelMap[label];
labelInfo.sources.emplace_back(immOff, labelOpcodeOff);
}
HPHP::MemberKey TranslationState::translateMemberKey(const hhbc::MemberKey& mkey) {
switch (mkey.tag) {
case hhbc::MemberKey::Tag::EC: {
auto const iva = static_cast<int32_t>(mkey.EC._0);
return HPHP::MemberKey(MemberCode::MEC, iva, mkey.EC._1);
}
case hhbc::MemberKey::Tag::PC: {
auto const iva = static_cast<int32_t>(mkey.PC._0);
return HPHP::MemberKey(MemberCode::MPC, iva, mkey.PC._1);
}
case hhbc::MemberKey::Tag::EL: {
auto const id = static_cast<int32_t>(mkey.EL._0.idx);
NamedLocal local{ id, id };
trackMaxUnnamed(id);
return HPHP::MemberKey(MemberCode::MEL, local, mkey.EL._1);
}
case hhbc::MemberKey::Tag::PL: {
auto const id = static_cast<int32_t>(mkey.PL._0.idx);
NamedLocal local{ id, id };
trackMaxUnnamed(id);
return HPHP::MemberKey(MemberCode::MPL, local, mkey.PL._1);
}
case hhbc::MemberKey::Tag::ET:
return HPHP::MemberKey(
MemberCode::MET,
toStaticString(mkey.ET._0),
mkey.ET._1
);
case hhbc::MemberKey::Tag::PT: {
auto const name = toStaticString(mkey.PT._0._0);
return HPHP::MemberKey(MemberCode::MPT, name, mkey.PT._1);
}
case hhbc::MemberKey::Tag::QT: {
auto const name = toStaticString(mkey.QT._0._0);
return HPHP::MemberKey(MemberCode::MQT, name, mkey.QT._1);
}
case hhbc::MemberKey::Tag::EI:
return HPHP::MemberKey(MemberCode::MEI, mkey.EI._0, mkey.EI._1);
case hhbc::MemberKey::Tag::W:
return HPHP::MemberKey();
}
not_reached();
}
ArrayData* TranslationState::getArrayfromAdataId(const AdataId& id) {
auto const it = adataMap.find(toString(id));
assertx(it != adataMap.end());
assertx(it->second->isStatic());
return it->second;
}
void handleIVA(TranslationState& ts, const uint32_t& iva) {
ts.fe->emitIVA(iva);
}
void handleIVA(TranslationState& ts, const Local& loc) {
ts.trackMaxUnnamed(loc.idx);
ts.fe->emitIVA(loc.idx);
}
void handleLA(TranslationState& ts, const Local& loc) {
ts.trackMaxUnnamed(loc.idx);
ts.fe->emitIVA(loc.idx);
}
void handleILA(TranslationState& ts, const Local& loc) {
ts.trackMaxUnnamed(loc.idx);
ts.fe->emitIVA(loc.idx);
}
void handleNLA(TranslationState& ts, const Local& local) {
auto const id = static_cast<int32_t>(local.idx);
NamedLocal loc{ id, id };
ts.trackMaxUnnamed(id);
ts.fe->emitNamedLocal(loc);
}
void handleBLA(TranslationState& ts, const BumpSliceMut<Label>& labels) {
ts.fe->emitIVA(labels.len);
auto targets = range(labels);
for (auto const& t : targets) {
ts.addLabelJump(t);
}
}
template <typename T>
void handleBA(TranslationState& ts, const T& labels) {
ts.addLabelJump(labels);
}
void handleITA(TranslationState& ts, const hhbc::IterArgs& ita) {
HPHP::IterArgs ia(
HPHP::IterArgs::Flags::None,
ita.iter_id.idx,
ita.key_id.idx,
ita.val_id.idx
);
ts.trackMaxUnnamed(ita.key_id.idx);
ts.trackMaxUnnamed(ita.val_id.idx);
encodeIterArgs(*ts.fe, ia);
}
void handleVSA(TranslationState& ts, const Slice<Str>& arr) {
ts.fe->emitIVA(arr.len);
auto strings = range(arr);
for (auto const& s : strings) {
auto const str = toStaticString(s);
ts.fe->emitInt32(ts.mergeLitstr(str));
}
}
void handleRATA(TranslationState& ts, const hhbc::RepoAuthType& rat) {
auto str = toStringPiece(rat);
auto const rat_ = ts.translateRepoAuthType(str);
encodeRAT(*ts.fe, rat_);
}
void handleKA(TranslationState& ts, const hhbc::MemberKey& mkey) {
auto const mkey_ = ts.translateMemberKey(mkey);
encode_member_key(mkey_, *ts.fe);
}
void handleLAR(TranslationState& ts, const hhbc::LocalRange& lar) {
auto const firstLoc = lar.start.idx;
auto const len = lar.len;
auto const lar_ = HPHP::LocalRange{firstLoc, len};
ts.trackMaxUnnamed(firstLoc + len - 1);
encodeLocalRange(*ts.fe, lar_);
}
void handleAA(TranslationState& ts, const AdataId& id) {
auto const arr = ts.getArrayfromAdataId(id);
ts.fe->emitInt32(ts.ue->mergeArray(arr));
}
void handleFCA(TranslationState& ts, const hhbc::FCallArgs& fca) {
auto const internalFlags =
static_cast<FCallArgsFlags>(fca.flags & HPHP::FCallArgs::kInternalFlags);
auto const fcaBase = FCallArgsBase(internalFlags, fca.num_args, fca.num_rets);
auto const async_eager_target = fca.async_eager_target;
auto const io = fca.inouts;
auto const readonly = fca.readonly;
auto const ctx = toStaticString(fca.context);
auto const numBytes = (fca.num_args + 7) / 8;
encodeFCallArgs(
*ts.fe, fcaBase,
io.len,
[&] {
auto inouts = range(io);
auto result = std::make_unique<uint8_t[]>(numBytes);
for (int i = 0; i < fca.num_args; i++) {
result[i / 8] |= inouts[i] << (i % 8);
}
for (int i = 0; i < numBytes; i++) {
ts.fe->emitByte(result[i]);
}
},
readonly.len,
[&] {
auto refs = range(readonly);
auto result = std::make_unique<uint8_t[]>(numBytes);
for (int i = 0; i < fca.num_args; i++) {
result[i / 8] |= refs[i] << (i % 8);
}
for (int i = 0; i < numBytes; i++) {
ts.fe->emitByte(result[i]);
}
},
fca.flags & FCallArgsFlags::HasAsyncEagerOffset,
[&] { ts.addLabelJump(async_eager_target); },
fca.flags & FCallArgsFlags::ExplicitContext,
[&] {
auto const id = ts.mergeLitstr(ctx);
ts.litstrMap.emplace(id, ctx);
ts.fe->emitInt32(id);
}
);
if (!fcaBase.hasUnpack()) {
ts.fe->containsCalls = true;
}
}
Str getStrfromSA(const ClassName& c) {
return c._0;
}
Str getStrfromSA(const FunctionName& f) {
return f._0;
}
Str getStrfromSA(const MethodName& m) {
return m._0;
}
Str getStrfromSA(const ConstName& c) {
return c._0;
}
Str getStrfromSA(const PropName& p) {
return p._0;
}
Str getStrfromSA(const Str& s) {
return s;
}
template <typename T>
void handleSA(TranslationState& ts, const T& str) {
auto const sd = toStaticString(getStrfromSA(str));
auto const id = ts.mergeLitstr(sd);
ts.fe->emitInt32(id);
}
void handleIA(TranslationState& ts, const IterId& id) {
ts.fe->emitIVA(id.idx);
}
void handleDA(TranslationState& ts, const FloatBits& fb) {
ts.fe->emitDouble(fb);
}
void handleI64A(TranslationState& ts, const int64_t& i) {
ts.fe->emitInt64(i);
}
template<typename T>
void handleOA(TranslationState& ts, T subop) {
ts.fe->emitByte(static_cast<uint8_t>(subop));
}
//////////////////////////////////////////////////////////////////////
#define IMM_NA
#define IMM_ONE(t) handle##t(ts, body._0);
#define IMM_TWO(t1, t2) IMM_ONE(t1); ++immIdx; handle##t2(ts, body._1)
#define IMM_THREE(t1, t2, t3) IMM_TWO(t1, t2); ++immIdx; handle##t3(ts, body._2)
#define IMM_FOUR(t1, t2, t3, t4) IMM_THREE(t1, t2, t3); ++immIdx; handle##t4(ts, body._3)
#define IMM_FIVE(t1, t2, t3, t4, t5) IMM_FOUR(t1, t2, t3, t4); ++immIdx; handle##t5(ts, body._4)
#define IMM_SIX(t1, t2, t3, t4, t5, t6) IMM_FIVE(t1, t2, t3, t4, t5); ++immIdx; handle##t6(ts, body._5)
#define handleOA(imm) handleOA<imm>
#define handleSLA(ts, imm) do { \
auto const targets = body.targets; \
auto const cases = body.cases; \
ts.fe->emitIVA(cases.len); \
for (int i = 0; i < cases.len-1; i++) { \
auto const caseName = toStaticString(cases.data[i]); \
auto const caseId = ts.mergeLitstr(caseName); \
ts.fe->emitInt32(caseId); \
ts.addLabelJump(targets.data[i]); \
} \
ts.fe->emitInt32(-1); \
ts.addLabelJump(targets.data[cases.len-1]); \
} while (0)
#define MAYBE_IMM_ONE(...)
#define MAYBE_IMM_TWO(...)
#define MAYBE_IMM_THREE(...)
#define MAYBE_IMM_FOUR(...)
#define MAYBE_IMM_FIVE(...)
#define MAYBE_IMM_SIX(...)
#define MAYBE_IMM_NA NO_
#define BODY(name) UNUSED auto const body = o.name;
#define NO_BODY(...)
#define GEN_BODY2(id, name) id##BODY(name)
#define GEN_BODY(...) GEN_BODY2(__VA_ARGS__)
#define O(name, imm, pop, push, flags) \
void translateOpcode##name(TranslationState& ts, const Opcode& o) { \
ITRACE(5, "translate Opcode {} \n", #name); \
UNUSED const Offset curOpcodeOff = ts.fe->bcPos(); \
ts.fe->emitOp(Op##name); \
\
UNUSED size_t immIdx = 0; \
GEN_BODY(MAYBE_IMM_##imm, name) \
IMM_##imm; \
\
for (auto& kv : ts.labelJumps) { \
updateLabelSourceforJump(ts, kv.first, kv.second, curOpcodeOff); \
} \
\
/* Record source location. */ \
ts.fe->recordSourceLocation(ts.srcLoc, curOpcodeOff); \
ts.labelJumps.clear(); \
}
OPCODES
#undef O
#undef handleSLA
#undef handleOA
typedef void (*translatorFunc)(TranslationState& ts, const Opcode& o);
hphp_hash_map<Opcode::Tag, translatorFunc> opcodeTranslators;
void initializeMap() {
#define O(name, imm, pop, push, flags) \
opcodeTranslators[Opcode::Tag::name] = translateOpcode##name;
OPCODES
#undef O
}
struct Initializer {
Initializer() { initializeMap(); }
} initializer;
//////////////////////////////////////////////////////////////////////
void translateOpcodeInstruction(TranslationState& ts, const Opcode& o) {
return opcodeTranslators[o.tag](ts, o);
}
void translateSrcLoc(TranslationState& ts, const SrcLoc& srcloc) {
auto const loc = Location::Range(
srcloc.line_begin,
srcloc.col_begin,
srcloc.line_end,
srcloc.col_end
);
ts.srcLoc = loc;
}
void translatePseudoInstruction(TranslationState& ts, const Pseudo& p) {
switch (p.tag) {
case Pseudo::Tag::Break:
case Pseudo::Tag::Continue:
case Pseudo::Tag::TypedValue:
case Pseudo::Tag::Comment:
return;
case Pseudo::Tag::Label:
ts.labelMap[p.Label._0].target = ts.fe->bcPos();
return;
case Pseudo::Tag::SrcLoc:
return translateSrcLoc(ts, p.SrcLoc._0);
// .try {
case Pseudo::Tag::TryCatchBegin:
return ts.enterTry();
// } .catch {
case Pseudo::Tag::TryCatchMiddle:
return ts.enterCatch();
// }
case Pseudo::Tag::TryCatchEnd:
return ts.finishTryCatch();
}
}
void translateInstruction(TranslationState& ts, const Instruct& i) {
switch (i.tag) {
case Instruct::Tag::Opcode:
return translateOpcodeInstruction(ts, i.Opcode._0);
case Instruct::Tag::Pseudo:
return translatePseudoInstruction(ts, i.Pseudo._0);
}
}
void translateDefaultParameterValue(TranslationState& ts,
const Pair<Label,Str>& dv,
FuncEmitter::ParamInfo& param) {
auto const str = toStaticString(dv._1);
ts.labelMap[dv._0].dvInits.push_back(ts.fe->params.size());
parse_default_value(param, str);
}
void upperBoundsHelper(TranslationState& ts,
const UpperBoundMap& ubs,
const UpperBoundMap& classUbs,
const TParamNameVec& shadowedTParams,
CompactVector<TypeConstraint>& upperBounds,
TypeConstraint& tc,
bool hasReifiedGenerics) {
auto currUBs = getRelevantUpperBounds(tc, ubs, classUbs, shadowedTParams);
if (currUBs.size() == 1 && !hasReifiedGenerics) {
applyFlagsToUB(currUBs[0], tc);
tc = currUBs[0];
} else if (!currUBs.empty()) {
upperBounds = std::move(currUBs);
ts.fe->hasReturnWithMultiUBs = true;
}
}
template <bool checkPce=false>
bool upperBoundsHelper(TranslationState& ts,
const UpperBoundMap& ubs,
const UpperBoundMap& classUbs,
const TParamNameVec& shadowedTParams,
CompactVector<TypeConstraint>& upperBounds,
TypeConstraint& tc,
const UserAttributeMap& userAttrs) {
auto const hasReifiedGenerics = [&]() {
if (userAttrs.find(s___Reified.get()) != userAttrs.end()) return true;
if (checkPce) {
return ts.pce->userAttributes().find(s___Reified.get()) !=
ts.pce->userAttributes().end();
}
return false;
}();
upperBoundsHelper(ts, ubs, classUbs, shadowedTParams,
upperBounds, tc, hasReifiedGenerics);
return hasReifiedGenerics;
}
void translateParameter(TranslationState& ts,
const UpperBoundMap& ubs,
const UpperBoundMap& classUbs,
const TParamNameVec& shadowedTParams,
bool hasReifiedGenerics,
const HhasParam& p) {
FuncEmitter::ParamInfo param;
translateUserAttributes(p.user_attributes, param.userAttributes);
if (p.is_variadic) {
ts.fe->attrs |= AttrVariadicParam;
param.setFlag(Func::ParamInfo::Flags::Variadic);
}
if (p.is_inout) param.setFlag(Func::ParamInfo::Flags::InOut);
if (p.is_readonly) param.setFlag(Func::ParamInfo::Flags::Readonly);
std::tie(param.userType, param.typeConstraint) = maybeOrElse(p.type_info,
[&](HhasTypeInfo& ti) {return translateTypeInfo(ti);},
[&]() {return std::make_pair(nullptr, TypeConstraint{});});
upperBoundsHelper(ts, ubs, classUbs, shadowedTParams, param.upperBounds,
param.typeConstraint, hasReifiedGenerics);
auto const dv = maybe(p.default_value);
// TODO default value strings are currently escaped
if (dv) translateDefaultParameterValue(ts, dv.value(), param);
auto const name = toNamedLocalStaticString(p.name);
ts.fe->appendParam(name, param);
}
void translateFunctionBody(TranslationState& ts,
const HhasBody& b,
const UpperBoundMap& ubs,
const UpperBoundMap& classUbs,
const TParamNameVec& shadowedTParams,
bool hasReifiedGenerics) {
ts.fe->isMemoizeWrapper = b.is_memoize_wrapper | b.is_memoize_wrapper_lsb;
ts.fe->isMemoizeWrapperLSB = b.is_memoize_wrapper_lsb;
ts.fe->setNumIterators(b.num_iters);
auto params = range(b.params);
for (auto const& p : params) {
translateParameter(ts, ubs, classUbs, shadowedTParams, hasReifiedGenerics, p);
}
auto instrs = range(b.body_instrs);
for (auto const& instr : instrs) {
translateInstruction(ts, instr);
}
auto const dc = maybe(b.doc_comment);
if (dc) ts.fe->docComment = makeDocComment(dc.value());
// Parsing parameters must come before decl_vars
auto decl_vars = range(b.decl_vars);
for (auto const& dv : decl_vars) {
auto const dvName = toNamedLocalStaticString(dv);
ts.fe->allocVarId(dvName);
}
for (auto const& label : ts.labelMap) {
for (auto const& dvinit : label.second.dvInits) {
ts.fe->params[dvinit].funcletOff = label.second.target;
}
for (auto const& source : label.second.sources) {
// source.second is the label opcode offset
// source.first is the offset of where the label is used as an immediate
ts.fe->emitInt32(label.second.target - source.second, source.first);
}
}
// finish function
while (ts.fe->numLocals() < ts.maxUnnamed) {
ts.fe->allocUnnamedLocal();
}
ts.fe->finish();
ts.labelMap.clear();
assertx(ts.start.empty());
assertx(ts.handler.empty());
ts.maxUnnamed = 0;
}
void translateCoeffects(TranslationState& ts, const HhasCoeffects& coeffects) {
auto static_coeffects = range(coeffects.static_coeffects);
for (auto const& c : static_coeffects) {
auto const coeffectStr = CoeffectsConfig::fromHackCCtx(c);
ts.fe->staticCoeffects.push_back(makeStaticString(coeffectStr));
}
auto unenforced_coeffects = range(coeffects.unenforced_static_coeffects);
for (auto const& c : unenforced_coeffects) {
ts.fe->staticCoeffects.push_back(toStaticString(c));
}
auto fun_param = range(coeffects.fun_param);
for (auto const& f : fun_param) {
ts.fe->coeffectRules.emplace_back(
CoeffectRule(CoeffectRule::FunParam{}, f));
}
auto cc_param = range(coeffects.cc_param);
for (auto const& c : cc_param) {
ts.fe->coeffectRules.emplace_back(
CoeffectRule(CoeffectRule::CCParam{}, c._0, toStaticString(c._1)));
}
auto cc_this_vec = range(coeffects.cc_this);
for (auto const& cc_this : cc_this_vec) {
std::vector<LowStringPtr> names;
for (int i = 0; i < cc_this.len - 1; i++) {
names.push_back(toStaticString(cc_this.data[i]));
}
auto const ctx_name = toStaticString(cc_this.data[cc_this.len - 1]);
ts.fe->coeffectRules.emplace_back(
CoeffectRule(CoeffectRule::CCThis{}, names, ctx_name));
}
auto cc_reified_vec = range(coeffects.cc_reified);
for (auto const& cc_reified : cc_reified_vec) {
auto const isClass = cc_reified._0;
auto const pos = cc_reified._1;
auto types = cc_reified._2;
std::vector<LowStringPtr> names;
for (int i = 0; i < types.len - 1; i++) {
names.push_back(toStaticString(types.data[i]));
}
auto const ctx_name = toStaticString(types.data[types.len - 1]);
ts.fe->coeffectRules.emplace_back(
CoeffectRule(CoeffectRule::CCReified{}, isClass, pos, names, ctx_name));
}
if (coeffects.closure_parent_scope) {
ts.fe->coeffectRules.emplace_back(CoeffectRule(CoeffectRule::ClosureParentScope{}));
}
if (coeffects.generator_this) {
ts.fe->coeffectRules.emplace_back(CoeffectRule(CoeffectRule::GeneratorThis{}));
}
if (coeffects.caller) {
ts.fe->coeffectRules.emplace_back(CoeffectRule(CoeffectRule::Caller{}));
}
}
void translateFunction(TranslationState& ts, const HhasFunction& f) {
UpperBoundMap ubs;
auto upper_bounds = range(f.body.upper_bounds);
for (auto const& u : upper_bounds) {
translateUbs(u, ubs);
}
UserAttributeMap userAttrs;
translateUserAttributes(f.attributes, userAttrs);
Attr attrs = f.attrs;
if (!SystemLib::s_inited) {
attrs |= AttrUnique | AttrPersistent | AttrBuiltin;
}
ts.fe = ts.ue->newFuncEmitter(toStaticString(f.name._0));
ts.fe->init(f.span.line_begin, f.span.line_end, attrs, nullptr);
ts.fe->isGenerator = (bool)(f.flags & HhasFunctionFlags_GENERATOR);
ts.fe->isAsync = (bool)(f.flags & HhasFunctionFlags_ASYNC);
ts.fe->isPairGenerator = (bool)(f.flags & HhasFunctionFlags_PAIR_GENERATOR);
ts.fe->userAttributes = userAttrs;
translateCoeffects(ts, f.coeffects);
auto retTypeInfo = maybeOrElse(f.body.return_type_info,
[&](HhasTypeInfo& ti) {return translateTypeInfo(ti);},
[&]() {return std::make_pair(nullptr, TypeConstraint{});});
auto const hasReifiedGenerics =
upperBoundsHelper(ts, ubs, {}, {},ts.fe->retUpperBounds, retTypeInfo.second, userAttrs);
std::tie(ts.fe->retUserType, ts.fe->retTypeConstraint) = retTypeInfo;
ts.srcLoc = Location::Range{static_cast<int>(f.span.line_begin), -1, static_cast<int>(f.span.line_end), -1};
translateFunctionBody(ts, f.body, ubs, {}, {}, hasReifiedGenerics);
}
void translateShadowedTParams(TParamNameVec& vec, const Slice<Str>& tpms) {
auto tparams = range(tpms);
for (auto const& t : tparams) {
vec.push_back(toStaticString(t));
}
}
void translateMethod(TranslationState& ts, const HhasMethod& m, const UpperBoundMap& classUbs) {
UpperBoundMap ubs;
auto upper_bounds = range(m.body.upper_bounds);
for (auto const& u : upper_bounds) {
translateUbs(u, ubs);
}
TParamNameVec shadowedTParams;
translateShadowedTParams(shadowedTParams, m.body.shadowed_tparams);
Attr attrs = m.attrs;
if (!SystemLib::s_inited) attrs |= AttrBuiltin;
ts.fe = ts.ue->newMethodEmitter(toStaticString(m.name._0), ts.pce);
ts.pce->addMethod(ts.fe);
ts.fe->init(m.span.line_begin, m.span.line_end, attrs, nullptr);
ts.fe->isGenerator = (bool)(m.flags & HhasMethodFlags_IS_GENERATOR);
ts.fe->isAsync = (bool)(m.flags & HhasMethodFlags_IS_ASYNC);
ts.fe->isPairGenerator = (bool)(m.flags & HhasMethodFlags_IS_PAIR_GENERATOR);
ts.fe->isClosureBody = (bool)(m.flags & HhasMethodFlags_IS_CLOSURE_BODY);
UserAttributeMap userAttrs;
translateUserAttributes(m.attributes, userAttrs);
ts.fe->userAttributes = userAttrs;
translateCoeffects(ts, m.coeffects);
auto retTypeInfo = maybeOrElse(m.body.return_type_info,
[&](HhasTypeInfo& ti) {return translateTypeInfo(ti);},
[&]() {return std::make_pair(nullptr, TypeConstraint{});});
auto const hasReifiedGenerics =
upperBoundsHelper<true>(ts, ubs, classUbs, shadowedTParams,
ts.fe->retUpperBounds, retTypeInfo.second, userAttrs);
// TODO(@voork) checkNative
ts.srcLoc = Location::Range{static_cast<int>(m.span.line_begin), -1,
static_cast<int>(m.span.line_end), -1};
std::tie(ts.fe->retUserType, ts.fe->retTypeConstraint) = retTypeInfo;
translateFunctionBody(ts, m.body, ubs, classUbs, shadowedTParams, hasReifiedGenerics);
}
void translateClass(TranslationState& ts, const HhasClass& c) {
UpperBoundMap classUbs;
auto upper_bounds = range(c.upper_bounds);
for (auto const& u : upper_bounds) {
translateUbs(u, classUbs);
}
std::string name = toString(c.name._0);
ITRACE(1, "Translating class {}\n", name);
ts.pce = ts.ue->newPreClassEmitter(name);
UserAttributeMap userAttrs;
ITRACE(2, "Translating attribute list {}\n", c.attributes.len);
translateUserAttributes(c.attributes, userAttrs);
auto attrs = c.flags;
if (!SystemLib::s_inited) attrs |= AttrUnique | AttrPersistent | AttrBuiltin;
auto const parentName = maybeOrElse(c.base,
[&](ClassName& s) { return toStaticString(s._0); },
[&]() { return staticEmptyString(); });
ts.pce->init(c.span.line_begin,
c.span.line_end,
attrs,
parentName,
staticEmptyString());
auto const dc = maybe(c.doc_comment);
if (dc) ts.pce->setDocComment(makeDocComment(dc.value()));
ts.pce->setUserAttributes(userAttrs);
auto impls = range(c.implements);
for (auto const& i : impls) {
ts.pce->addInterface(toStaticString(i._0));
}
auto incl = range(c.enum_includes);
for (auto const& in : incl) {
ts.pce->addEnumInclude(toStaticString(in._0));
}
auto requirements = range(c.requirements);
for (auto const& r : requirements) {
translateRequirements(ts, r);
}
auto methods = range(c.methods);
for (auto const& m : methods) {
translateMethod(ts, m, classUbs);
}
auto uses = range(c.uses);
for (auto const& u : uses) {
ts.pce->addUsedTrait(toStaticString(u._0));
}
translateEnumType(ts, c.enum_type);
translateClassBody(ts, c, classUbs);
}
void translateAdata(TranslationState& ts, const HhasAdata& ad) {
auto const name = toString(ad.id);
auto tv = toTypedValue(ad.value);
auto arr = tv.m_data.parr;
ArrayData::GetScalarArray(&arr);
ts.adataMap[name] = arr;
ts.ue->mergeArray(arr);
}
void translateConstant(TranslationState& ts, const HhasConstant& c) {
Constant constant;
constant.name = toStaticString(c.name._0);
constant.attrs = SystemLib::s_inited ? AttrNone : AttrPersistent;
constant.val = maybeOrElse(c.value,
[&](hhbc::TypedValue& tv) {return toTypedValue(tv);},
[&]() {return make_tv<KindOfNull>();});
// An uninit constant means its actually a "dynamic" constant whose value
// is evaluated at runtime. We store the callback in m_data.pcnt and invoke
// on lookup. (see constant.cpp) It's used for things like STDERR.
if (type(constant.val) == KindOfUninit) {
constant.val.m_data.pcnt = reinterpret_cast<MaybeCountable*>(Constant::get);
}
ts.ue->addConstant(constant);
}
void translateModuleUse(TranslationState& ts, const Optional<Str>& name) {
if (!name) return;
ts.ue->m_moduleName = toStaticString(name.value());
}
void translateModule(TranslationState& ts, const HhasModule& m) {
UserAttributeMap userAttrs;
translateUserAttributes(m.attributes, userAttrs);
ts.ue->addModule(Module{
toStaticString(m.name._0),
static_cast<int>(m.span.line_begin),
static_cast<int>(m.span.line_end),
Attr(AttrNone),
userAttrs
});
}
void translate(TranslationState& ts, const HackCUnit& unit) {
translateModuleUse(ts, maybe(unit.module_use));
auto adata = range(unit.adata);
for (auto const& d : adata) {
translateAdata(ts, d);
}
auto funcs = range(unit.functions);
for (auto const& f : funcs) {
translateFunction(ts, f);
}
auto classes = range(unit.classes);
for (auto const& c : classes) {
translateClass(ts, c);
}
auto constants = range(unit.constants);
for (auto const& c : constants) {
translateConstant(ts, c);
}
auto typedefs = range(unit.typedefs);
for (auto const& t : typedefs) {
translateTypedef(ts, t);
}
auto modules = range(unit.modules);
for (auto const& m : modules) {
translateModule(ts, m);
}
translateUserAttributes(unit.file_attributes, ts.ue->m_fileAttributes);
maybeThen(unit.fatal, [&](Triple<FatalOp, HhasPos, Str> fatal) {
auto const pos = fatal._1;
auto const msg = toString(fatal._2);
throw FatalUnitError(
msg, ts.ue->m_filepath,
Location::Range(pos.line_begin, pos.col_begin, pos.line_end, pos.col_end),
fatal._0
);
});
for (auto& fe : ts.ue->fevec()) fixup_default_values(ts, fe.get());
for (size_t n = 0; n < ts.ue->numPreClasses(); ++n) {
for (auto fe : ts.ue->pce(n)->methods()) fixup_default_values(ts, fe);
}
}
}
std::unique_ptr<UnitEmitter> unitEmitterFromHackCUnit(
const HackCUnit& unit,
const char* filename,
const SHA1& sha1,
const Native::FuncTable& nativeFuncs,
const std::string& hhasString
) {
auto const bcSha1 = SHA1{string_sha1(hhasString)};
auto ue = std::make_unique<UnitEmitter>(sha1, bcSha1, nativeFuncs, false);
StringData* sd = makeStaticString(filename);
ue->m_filepath = sd;
try {
TranslationState ts{};
ts.ue = ue.get();
translate(ts, unit);
ue->finish();
} catch (const FatalUnitError& e) {
ue = createFatalUnit(e.filePath, sha1, e.op, e.what(), e.pos);
}
return ue;
}
}
| 32.323401 | 110 | 0.629561 | [
"vector"
] |
af344e8ef7589d9c1555f6b6edfdcb55b8f20d0c | 1,663 | cc | C++ | src/array/cpu/array_repeat.cc | ketyi/dgl | a1b859c29b63a673c148d13231a49504740e0e01 | [
"Apache-2.0"
] | 9,516 | 2018-12-08T22:11:31.000Z | 2022-03-31T13:04:33.000Z | src/array/cpu/array_repeat.cc | ketyi/dgl | a1b859c29b63a673c148d13231a49504740e0e01 | [
"Apache-2.0"
] | 2,494 | 2018-12-08T22:43:00.000Z | 2022-03-31T21:16:27.000Z | src/array/cpu/array_repeat.cc | ketyi/dgl | a1b859c29b63a673c148d13231a49504740e0e01 | [
"Apache-2.0"
] | 2,529 | 2018-12-08T22:56:14.000Z | 2022-03-31T13:07:41.000Z | /*!
* Copyright (c) 2020 by Contributors
* \file array/cpu/array_repeat.cc
* \brief Array repeat CPU implementation
*/
#include <dgl/array.h>
#include <algorithm>
namespace dgl {
using runtime::NDArray;
namespace aten {
namespace impl {
template <DLDeviceType XPU, typename DType, typename IdType>
NDArray Repeat(NDArray array, IdArray repeats) {
CHECK(array->shape[0] == repeats->shape[0]) << "shape of array and repeats mismatch";
const int64_t len = array->shape[0];
const DType *array_data = static_cast<DType *>(array->data);
const IdType *repeats_data = static_cast<IdType *>(repeats->data);
IdType num_elements = 0;
for (int64_t i = 0; i < len; ++i)
num_elements += repeats_data[i];
NDArray result = NDArray::Empty({num_elements}, array->dtype, array->ctx);
DType *result_data = static_cast<DType *>(result->data);
IdType curr = 0;
for (int64_t i = 0; i < len; ++i) {
std::fill(result_data + curr, result_data + curr + repeats_data[i], array_data[i]);
curr += repeats_data[i];
}
return result;
}
template NDArray Repeat<kDLCPU, int32_t, int32_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, int64_t, int32_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, float, int32_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, double, int32_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, int32_t, int64_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, int64_t, int64_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, float, int64_t>(NDArray, IdArray);
template NDArray Repeat<kDLCPU, double, int64_t>(NDArray, IdArray);
}; // namespace impl
}; // namespace aten
}; // namespace dgl
| 33.938776 | 87 | 0.71798 | [
"shape"
] |
af491ccd86267555aaa6335ed0fe09cba6217160 | 9,891 | cpp | C++ | src/game_web.cpp | Niki4tap/asciicker | 1fd314f940d166217deb2dfcedc5a6ccead40243 | [
"MIT"
] | 78 | 2021-06-10T12:02:07.000Z | 2021-09-07T16:22:28.000Z | src/game_web.cpp | Niki4tap/asciicker | 1fd314f940d166217deb2dfcedc5a6ccead40243 | [
"MIT"
] | 3 | 2021-06-10T14:19:40.000Z | 2021-09-09T20:00:02.000Z | src/game_web.cpp | Niki4tap/asciicker | 1fd314f940d166217deb2dfcedc5a6ccead40243 | [
"MIT"
] | 15 | 2021-06-10T13:29:00.000Z | 2021-09-07T16:22:21.000Z |
#include <emscripten.h>
#include <stdint.h>
#include "terrain.h"
#include "game.h"
#include "enemygen.h"
#include "sprite.h"
#include "world.h"
#include "render.h"
#include <time.h>
char base_path[1024] = "./"; // (const)
void Buzz()
{
EM_ASM(
{
if (gamepad>=0 && "getGamePads" in navigator)
{
let gm = navigator.getGamepads()[gamepad];
let va = gm.vibrationActuator;
if (va)
{
va.playEffect(va.type, {startDelay: 0, duration: 50, weakMagnitude: 1, strongMagnitude: 1});
}
}
else
if ("vibrate" in navigator)
{
navigator.vibrate(50);
}
});
}
uint64_t GetTime()
{
static timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
}
void SyncConf()
{
EM_ASM( FS.syncfs( function(e) {} ); );
}
const char* GetConfPath()
{
return "/data/asciicker.cfg";
}
Server* server = 0; // this is to fullfil game.cpp externs!
struct GameServer : Server
{
uint8_t send_buf[1+256];
};
bool Server::Send(const uint8_t* data, int size)
{
GameServer* gs = (GameServer*)server;
if (size > 256)
return false;
gs->send_buf[0] = size;
memcpy(gs->send_buf+1, data, size);
int s = EM_ASM_INT( return Send(); );
return s > 0;
}
void Server::Proc()
{
}
void Server::Log(const char* str)
{
GameServer* gs = (GameServer*)server;
int len = strlen(str);
if (len>255)
len=255;
gs->send_buf[0] = len;
memcpy(gs->send_buf+1,str,len);
gs->send_buf[len+1] = 0;
EM_ASM( ConsoleLog(); );
}
Game* game = 0;
Terrain* terrain = 0;
World* world = 0;
AnsiCell* render_buf = 0;
Material mat[256];
void* GetMaterialArr()
{
return mat;
}
int user_zoom = 0;
bool PrevGLFont()
{
user_zoom--;
if (user_zoom<-8)
user_zoom=-8;
EM_ASM({user_zoom=$0;Resize(null);},user_zoom);
return true;
}
bool NextGLFont()
{
user_zoom++;
if (user_zoom>8)
user_zoom=8;
EM_ASM({user_zoom=$0;Resize(null);},user_zoom);
return true;
}
void exit_handler(int signum)
{
EM_ASM(
{
try
{
if (window.history.length<=1)
window.close();
else
if (history.state && history.state.inline == 1)
{
// we can't close, we cant go back
// should we really go forward?
// history.forward();
}
else
history.back();
}
catch(e) {}
});
}
void ToggleFullscreen(Game* g)
{
EM_ASM(
{
let elem = document.body;
if (!document.fullscreenElement)
{
if ("requestFullscreen" in elem)
elem.requestFullscreen().catch(err => { });
}
else
{
if ("exitFullscreen" in document)
document.exitFullscreen();
}
});
}
bool IsFullscreen(Game* g)
{
int fs =
EM_ASM_INT(
{
let elem = document.body;
if (!document.fullscreenElement)
{
return 0;
}
else
{
return 1;
}
});
return fs!=0;
}
int main(int argc, char* argv[])
{
return 0;
}
int Main()
{
// here we must already know if serer on not server
float water = 55.0f;
float yaw = 45;
float dir = 0;
float pos[3] = {0,15,0};
uint64_t stamp;
LoadSprites();
{
FILE* f = fopen("a3d/game_map_y8.a3d","rb");
if (f)
{
terrain = LoadTerrain(f);
if (terrain)
{
for (int i=0; i<256; i++)
{
if ( fread(mat[i].shade,1,sizeof(MatCell)*4*16,f) != sizeof(MatCell)*4*16 )
break;
}
world = LoadWorld(f,false);
if (world)
{
// reload meshes too
Mesh* m = GetFirstMesh(world);
while (m)
{
char mesh_name[256];
GetMeshName(m,mesh_name,256);
char obj_path[4096];
sprintf(obj_path,"%smeshes/%s",base_path,mesh_name);
if (!UpdateMesh(m,obj_path))
{
// what now?
// missing mesh file!
printf("failed to load mesh %s\n", mesh_name);
return -5;
}
m = GetNextMesh(m);
}
LoadEnemyGens(f);
}
else
{
printf("failed to load world\n");
return -4;
}
}
else
{
printf("failed to load terrain\n");
return -3;
}
fclose(f);
}
else
{
printf("failed to open game_map_y7.a3d\n");
return -2;
}
// if (!terrain || !world)
// return -1;
// add meshes from library that aren't present in scene file
char mesh_dirname[4096];
sprintf(mesh_dirname,"%smeshes",base_path);
//a3dListDir(mesh_dirname, MeshScan, mesh_dirname);
// this is the only case when instances has no valid bboxes yet
// as meshes weren't present during their creation
// now meshes are loaded ...
// so we need to update instance boxes with (,true)
if (world)
{
RebuildWorld(world, true);
#ifdef DARK_TERRAIN
float lt[4] = { 1,0,1,0.5 };
UpdateTerrainDark(terrain, world, lt, false);
#endif
}
}
render_buf = (AnsiCell*)malloc(sizeof(AnsiCell) * 160 * 160);
if (!render_buf)
{
printf("failed to allocate render buffer\n");
return -7;
}
stamp = GetTime();
game = CreateGame(water,pos,yaw,dir,stamp);
printf("all ok\n");
return 0;
}
extern "C"
{
void Load(const char* name)
{
if (name)
{
strcpy(player_name,name);
ConvertToCP437(player_name_cp437,player_name);
}
Main();
}
void* Render(int width, int height)
{
if (game && render_buf)
{
game->Render(GetTime(),render_buf,width,height);
return render_buf;
}
return 0;
}
void Size(int w, int h, int fw, int fh)
{
if (game)
game->OnSize(w,h,fw,fh);
}
void Keyb(int type, int val)
{
if (game)
game->OnKeyb((Game::GAME_KEYB)type,val);
}
void Mouse(int type, int x, int y)
{
if (game)
game->OnMouse((Game::GAME_MOUSE)type, x, y);
}
void Touch(int type, int id, int x, int y)
{
if (game)
game->OnTouch((Game::GAME_TOUCH)type, id, x, y);
}
void GamePad(int ev, int idx, float val)
{
static int gamepad_axes = 0;
static int gamepad_buttons = 0;
static uint8_t gamepad_mapping[256];
switch (ev)
{
case 0:
{
if (!idx)
GamePadUnmount();
else
GamePadMount("fixme",gamepad_axes,gamepad_buttons,gamepad_mapping);
break;
}
case 1:
{
int16_t v = (int16_t)(val*32767);
GamePadButton(idx,v);
break;
}
case 2:
{
// works on chrome
// int16_t v = val>1.0 ? (int16_t)-32768 : (int16_t)(val*32767);
// maybe firefox too:
int16_t v = val>1.0 || val<-1.0 ? (int16_t)-32768 : (int16_t)(val*32767);
GamePadAxis(idx,v);
break;
}
case 3:
{
// mapping size loword buttons, hiword axes
gamepad_buttons = idx & 0xFFFF;
gamepad_axes = (idx>>16) & 0xFFFF;
break;
}
case 4:
{
// map button, byte0 val, byte1 button idx
int map_idx = ((idx>>8) & 0xFF) + 2 * gamepad_axes;
gamepad_mapping[map_idx] = idx&0xFF;
break;
}
case 5:
{
// map axis, byte0 neg, byte1 pos, byte2 axis idx
int map_neg = 2*((idx>>16) & 0xFF);
int map_pos = map_neg+1;
gamepad_mapping[map_neg] = idx&0xFF;
gamepad_mapping[map_pos] = (idx>>8)&0xFF;
break;
}
}
}
void Focus(int set)
{
if (game)
game->OnFocus(set!=0);
}
void* Join(const char* name, int id, int max_cli)
{
if (id<0)
{
if (server)
{
free(server->others);
free(server);
server = 0;
}
return 0;
}
if (name)
{
strcpy(player_name,name);
ConvertToCP437(player_name_cp437,player_name);
}
// alloc server, prepare for Packet()s
GameServer* gs = (GameServer*)malloc(sizeof(GameServer));
memset(gs,0,sizeof(GameServer));
server = gs;
server->others = (Human*)malloc(sizeof(Human)*max_cli);
return gs->send_buf;
}
void Packet(const uint8_t* ptr, int size)
{
if (server)
{
bool ok = server->Proc(ptr, size);
}
}
}
| 22.226966 | 111 | 0.459711 | [
"mesh",
"render"
] |
af49ca2778566f6f5b4331739a02e34618d8e92d | 6,170 | cpp | C++ | Win32EnumWbemClassObject.cpp | smalltong02/Bruce-Ma | 2ee9455635af9f0300f53781382de88d3ef99003 | [
"MIT"
] | 1 | 2021-06-22T04:41:41.000Z | 2021-06-22T04:41:41.000Z | Win32EnumWbemClassObject.cpp | smalltong02/Bruce-Ma | 2ee9455635af9f0300f53781382de88d3ef99003 | [
"MIT"
] | 1 | 2021-02-23T17:45:30.000Z | 2021-02-23T17:45:30.000Z | Win32EnumWbemClassObject.cpp | smalltong02/Bruce-Ma | 2ee9455635af9f0300f53781382de88d3ef99003 | [
"MIT"
] | null | null | null | #include "stdafx.h"
#include "utils.h"
#include "Win32EnumWbemClassObject.h"
#include "HookImplementObject.h"
using namespace cchips;
extern bool process_duplicate_for_wmiobject(CHookImplementObject::detour_node* node, const std::shared_ptr<CWmiObject>& wmi_object, IWbemClassObject **apObjects, ULONG *puReturned, std::shared_ptr<CLogHandle>& log_handle);
GUID IID_idIEnumWbemClassObject = {
0x027947e1,
0xd731,
0x11ce,
0xa3,0x57,0x00,0x00,0x00,0x00,0x00,0x01
};
extern GUID IID_idIUnknown;
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectQueryInterface(
idIEnumWbemClassObject * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject)
{
HRESULT hr = S_OK;
ASSERT(This->lpVtbl->pItf);
if (ppvObject == nullptr) return S_FALSE;
if (IID_idIUnknown == riid ||
IID_idIEnumWbemClassObject == riid) {
*ppvObject = This;
EnumWbemClassObjectAddRef(This);
error_log("EnumWbemClassObjectQueryInterface: *ppvObject == This->lpVtbl->pItf");
return S_OK;
}
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->QueryInterface(riid, ppvObject);
return hr;
}
ULONG STDMETHODCALLTYPE EnumWbemClassObjectAddRef(
idIEnumWbemClassObject * This)
{
error_log("EnumWbemClassObjectQueryInterface: EnumWbemClassObjectAddRef");
return ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->AddRef();
}
ULONG STDMETHODCALLTYPE EnumWbemClassObjectRelease(
idIEnumWbemClassObject * This)
{
error_log("EnumWbemClassObjectQueryInterface: EnumWbemClassObjectRelease");
ULONG Ref = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->Release();
if (Ref <= 1)
{
free(This->lpVtbl);
free(This);
}
return Ref;
}
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectReset(
idIEnumWbemClassObject * This)
{
HRESULT hr = S_OK;
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->Reset();
error_log("EnumWbemClassObjectQueryInterface: EnumWbemClassObjectReset hr = {}", hr);
return hr;
}
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectNext(
idIEnumWbemClassObject * This,
/* [in] */ long lTimeout,
/* [in] */ ULONG uCount,
/* [length_is][size_is][out] */ idIWbemClassObject **apObjects,
/* [out] */ ULONG *puReturned)
{
HRESULT hr = S_OK;
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->Next(lTimeout, uCount, (IWbemClassObject**)apObjects, puReturned);
error_log("Duplicate_IEnumWbemClassObject_Next: hr= {}, m_nItem = {}", hr, This->lpVtbl->m_nItem);
if (hr != S_OK && This->lpVtbl->m_nItem == 0)
{
This->lpVtbl->m_nItem++;
// the class object not instance, so clone a new object instance.
if (This->lpVtbl->m_wmi_object == nullptr) return hr;
std::string ObjectName = This->lpVtbl->m_wmi_object->GetName();
std::unique_ptr<cchips::CLogHandle> log_handle = std::make_unique<cchips::CLogHandle>("W1", CLogObject::logtype::log_event);
if (!log_handle) return hr;
BEGIN_LOG("Duplicate_IEnumWbemClassObject_Next");
LOGGING("Class", ObjectName);
cchips::CHookImplementObject::detour_node node = { nullptr, nullptr, nullptr, 0, nullptr, nullptr, log_handle->GetHandle() };
if (process_duplicate_for_wmiobject(&node, This->lpVtbl->m_wmi_object, (IWbemClassObject**)apObjects, puReturned, LOGGER))
{
LOGGING("Duplicate", "Success");
hr = S_OK;
}
else {
LOGGING("Duplicate", "Failed");
}
END_LOG(log_handle->GetHandle());
}
return hr;
}
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectNextAsync(
idIEnumWbemClassObject * This,
/* [in] */ ULONG uCount,
/* [in] */ IWbemObjectSink *pSink)
{
HRESULT hr = S_OK;
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->NextAsync(uCount, (IWbemObjectSink*)pSink);
return hr;
}
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectClone(
idIEnumWbemClassObject * This,
/* [out] */ idIEnumWbemClassObject **ppEnum)
{
HRESULT hr = S_OK;
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->Clone((IEnumWbemClassObject **)ppEnum);
error_log("EnumWbemClassObjectQueryInterface: EnumWbemClassObjectClone hr = {}", hr);
if (hr == S_OK) {
idIEnumWbemClassObject* p_IEnumWbemClassObject = (idIEnumWbemClassObject *)malloc(sizeof(idIEnumWbemClassObject));
if (p_IEnumWbemClassObject)
{
p_IEnumWbemClassObject->lpVtbl = (idIEnumWbemClassObjectVtbl *)malloc(sizeof(idIEnumWbemClassObjectVtbl));
if (p_IEnumWbemClassObject->lpVtbl)
{
memset(p_IEnumWbemClassObject->lpVtbl, 0, sizeof(idIEnumWbemClassObjectVtbl));
InitializeWin32EnumWbemClassObject(p_IEnumWbemClassObject, *(IEnumWbemClassObject **)ppEnum, This->lpVtbl->m_wmi_object);
*ppEnum = p_IEnumWbemClassObject;
}
}
}
return hr;
}
HRESULT STDMETHODCALLTYPE EnumWbemClassObjectSkip(
idIEnumWbemClassObject * This,
/* [in] */ long lTimeout,
/* [in] */ ULONG nCount)
{
HRESULT hr = S_OK;
hr = ((IEnumWbemClassObject*)(This->lpVtbl->pItf))->Skip(lTimeout, nCount);
return hr;
}
void InitializeWin32EnumWbemClassObject(idIEnumWbemClassObject* p_IEnumWbemClassObject, IEnumWbemClassObject* pItf, const std::shared_ptr<cchips::CWmiObject>& wmi_object)
{
p_IEnumWbemClassObject->lpVtbl->AddRef = EnumWbemClassObjectAddRef;
p_IEnumWbemClassObject->lpVtbl->Release = EnumWbemClassObjectRelease;
p_IEnumWbemClassObject->lpVtbl->Reset = EnumWbemClassObjectReset;
p_IEnumWbemClassObject->lpVtbl->Next = EnumWbemClassObjectNext;
p_IEnumWbemClassObject->lpVtbl->NextAsync = EnumWbemClassObjectNextAsync;
p_IEnumWbemClassObject->lpVtbl->Clone = EnumWbemClassObjectClone;
p_IEnumWbemClassObject->lpVtbl->Skip = EnumWbemClassObjectSkip;
p_IEnumWbemClassObject->lpVtbl->QueryInterface = EnumWbemClassObjectQueryInterface;
p_IEnumWbemClassObject->lpVtbl->pItf = pItf;
p_IEnumWbemClassObject->lpVtbl->m_wmi_object = wmi_object;
p_IEnumWbemClassObject->lpVtbl->AddRef(p_IEnumWbemClassObject);
return;
}
| 38.805031 | 222 | 0.701135 | [
"object"
] |
af4b8cb6ba282626a17781ff084ba488f352c682 | 2,288 | cpp | C++ | learning/MakeHash/main.cpp | HAL90000/tirt | 60eea9bde89b579eabfd11e5ee0ba3910d24f4a0 | [
"BSD-2-Clause"
] | null | null | null | learning/MakeHash/main.cpp | HAL90000/tirt | 60eea9bde89b579eabfd11e5ee0ba3910d24f4a0 | [
"BSD-2-Clause"
] | null | null | null | learning/MakeHash/main.cpp | HAL90000/tirt | 60eea9bde89b579eabfd11e5ee0ba3910d24f4a0 | [
"BSD-2-Clause"
] | null | null | null | #include <iostream>
#include <vector>
#include <fstream>
#include <Eigen\Dense>
#include <Image.h>
double mult(const Image &img, const Hasher &hasher)
{
size_t size = std::min(img.v.size(), hasher.v.size());
double result = hasher.bias;
for (int i = 0; i < size; ++i)
result += img.v[i] / 255.0 * hasher.v[i];
return result;
}
std::string hash(const Image &img, const std::vector<Hasher> &hashers)
{
std::string h;
for (int i = 0; i < hashers.size(); ++i)
{
double p = mult(img, hashers[i]);
if (p > 0)
h.push_back('1');
else
h.push_back('0');
}
return h;
}
std::string hashTab(const Image &img, const std::vector<Hasher> &hashers)
{
std::string h;
for (int i = 0; i < hashers.size(); ++i)
{
double p = mult(img, hashers[i]);
if (p > 0)
h.push_back('1');
else
h.push_back('0');
h.push_back('\t');
}
return h;
}
int main(int argc, char **argv)
{
Eigen::setNbThreads(4);
std::clog << "Eigen::nbThreads() = " << Eigen::nbThreads() << std::endl;
std::clog << "Eigen::nbThreads() = " << Eigen::nbThreads() << std::endl;
std::vector<Image> images;
std::clog << "Loading data... " << std::endl;
for (int i = 2; i < argc; ++i)
{
std::clog << "\t" << argv[i] << std::endl;
std::ifstream input(argv[i], std::ios::binary);
auto imgs = LoadBatch(input);
images.insert(images.end(), imgs.begin(), imgs.end());
}
//while (images.size() > 2)
// images.pop_back();
std::clog << "DONE" << std::endl;
int N = (int)images.size();
int M = 32 * 32 * 3;
//int M = 1024;
std::clog << "Loading hashers... " << std::endl;
std::vector<Hasher> hashers;
{
std::clog << "\t" << argv[1] << std::endl;
std::ifstream input(argv[1]);
hashers = LoadHashers(input, 64);
}
std::clog << "DONE" << std::endl;
/*
for (const auto &hash : hashers)
{
double bias = 0;
for (const auto& img : images)
{
for (int i = 0; i < img.v.size(); ++i)
bias += img.v[i] / 255.0 * hash.v[i];
}
bias /= images.size();
bias = -bias;
std::clog << hash.bias << " _ " << bias << "(" << (abs(bias - hash.bias) < 0.001) << ")" << std::endl;
}
*/
for (const auto& img : images)
{
//if (img.label == 255)
// continue;
std::string h = hash(img, hashers);
std::cout << img.label << "\t" << h << std::endl;
}
return 0;
} | 20.070175 | 104 | 0.562063 | [
"vector"
] |
af56263e34d5911942c6bcebcaa3386794f6f8a4 | 19,201 | hpp | C++ | test/performance-regression/full-apps/qmcpack/src/spline/einspline_impl.hpp | FeiyangJin/hclib | d23c850dce914e2d80cae733670820812a1edeee | [
"BSD-3-Clause"
] | 55 | 2015-07-28T01:32:58.000Z | 2022-02-27T16:27:46.000Z | test/performance-regression/full-apps/qmcpack/src/spline/einspline_impl.hpp | FeiyangJin/hclib | d23c850dce914e2d80cae733670820812a1edeee | [
"BSD-3-Clause"
] | 66 | 2015-06-15T20:38:19.000Z | 2020-08-26T00:11:43.000Z | test/performance-regression/full-apps/qmcpack/src/spline/einspline_impl.hpp | FeiyangJin/hclib | d23c850dce914e2d80cae733670820812a1edeee | [
"BSD-3-Clause"
] | 26 | 2015-10-26T22:11:51.000Z | 2021-03-02T22:09:15.000Z | //////////////////////////////////////////////////////////////////
// (c) Copyright 2006- by Jeongnim Kim and Ken Esler //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// National Center for Supercomputing Applications & //
// Materials Computation Center //
// University of Illinois, Urbana-Champaign //
// Urbana, IL 61801 //
// e-mail: jnkim@ncsa.uiuc.edu //
// //
// Supported by //
// National Center for Supercomputing Applications, UIUC //
// Materials Computation Center, UIUC //
//////////////////////////////////////////////////////////////////
/** @file einspline_impl.hpp
* @brief interface to hide types in einspline library
*
*/
#ifndef QMCPLUSPLUS_EINSPLINE_IMPL_H
#define QMCPLUSPLUS_EINSPLINE_IMPL_H
#ifndef QMCPLUSPLUS_EINSPLINE_ENGINE_HPP
#error "einspline_impl.hpp is used only by einspline_engine.hpp"
#endif
#include "einspline/multi_bspline_copy.h"
namespace qmcplusplus
{
/** einspline name space to define functions to handle functions
*
* functions to handle einspline calls transparently
* For datatype (double,complex<double>,float,complex<float>)
* - create(spline,start,end,bc,num_splines)
* - set(spline,i,data)
* - evaluate(spline,r,psi)
* - evaluate(spline,r,psi,grad)
* - evaluate(spline,r,psi,grad,lap)
* - evaluate(spline,r,psi,grad,hess)
* are defined to wrap einspline calls. A similar pattern is used for BLAS/LAPACK.
* The template parameters of the functions are
* \tparam PT position type, e.g. TinyVector<T,D>
* \tparam VT array of values, e.g. Vector<T>
* \tparam GT array of gradients, e.g. Vector<TinyVector<T,D> >
* \tparam HT array of hessian tensors, e.g. Vector<Tensor<T,D> >
*/
namespace einspline
{
/** create spline for double */
template<typename GT, typename BCT>
multi_UBspline_3d_d* create(multi_UBspline_3d_d* s, GT& grid , BCT& bc, int num_splines)
{
return create_multi_UBspline_3d_d(grid[0],grid[1],grid[2], bc[0], bc[1], bc[2], num_splines);
}
/** create spline for complex<double> */
template<typename GT, typename BCT>
multi_UBspline_3d_z* create(multi_UBspline_3d_z* s, GT& grid , BCT& bc, int num_splines)
{
return create_multi_UBspline_3d_z(grid[0],grid[1],grid[2], bc[0], bc[1], bc[2], num_splines);
}
/** create spline for float */
template<typename GT, typename BCT>
multi_UBspline_3d_s* create(multi_UBspline_3d_s* s, GT& grid , BCT& bc, int num_splines)
{
return create_multi_UBspline_3d_s(grid[0],grid[1],grid[2], bc[0], bc[1], bc[2], num_splines);
}
/** create spline for complex<float> */
template<typename GT, typename BCT>
multi_UBspline_3d_c* create(multi_UBspline_3d_c* s, GT& grid , BCT& bc, int num_splines)
{
return create_multi_UBspline_3d_c(grid[0],grid[1],grid[2], bc[0], bc[1], bc[2], num_splines);
}
/** set bspline for the i-th orbital for double-to-double
* @param spline multi_UBspline_3d_d
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_d* spline, int i, double* restrict indata)
{ set_multi_UBspline_3d_d(spline, i, indata); }
/** evaluate values only using multi_UBspline_3d_d
*/
template<typename PT, typename VT>
inline void evaluate(multi_UBspline_3d_d *restrict spline, const PT& r, VT &psi)
{ eval_multi_UBspline_3d_d (spline, r[0], r[1], r[2], psi.data()); }
/** evaluate values and gradients using multi_UBspline_3d_d
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vg(multi_UBspline_3d_d *restrict spline, const PT& r, VT &psi, GT &grad)
{ eval_multi_UBspline_3d_d_vg (spline, r[0], r[1], r[2], psi.data(), grad[0].data()); }
/** evaluate values, gradients and laplacians using multi_UBspline_3d_d
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vgl(multi_UBspline_3d_d *restrict spline, const PT& r, VT &psi, GT &grad, VT& lap)
{ eval_multi_UBspline_3d_d_vgl (spline, r[0], r[1], r[2], psi.data(), grad[0].data(), lap.data()); }
/** evaluate values, gradients and hessians using multi_UBspline_3d_d
*/
template<typename PT, typename VT, typename GT, typename HT>
inline void evaluate_vgh(multi_UBspline_3d_d *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess)
{ eval_multi_UBspline_3d_d_vgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data());}
/** evaluate values, gradients hessians and gradient of the hessians using multi_UBspline_3d_d
*/
template<typename PT, typename VT, typename GT, typename HT, typename GG>
inline void evaluate_vghgh(multi_UBspline_3d_d *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess, GG& gradhess)
{ eval_multi_UBspline_3d_d_vghgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data(),gradhess[0].data()); }
/** set bspline for the i-th orbital for complex<double>-to-complex<double>
* @param spline multi_UBspline_3d_z
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_z* spline, int i, complex<double>* restrict indata)
{ set_multi_UBspline_3d_z(spline, i, indata); }
/** evaluate values only using multi_UBspline_3d_z
*/
template<typename PT, typename VT>
inline void evaluate(multi_UBspline_3d_z *restrict spline, const PT& r, VT &psi)
{ eval_multi_UBspline_3d_z (spline, r[0], r[1], r[2], psi.data()); }
/** evaluate values and gradients using multi_UBspline_3d_z
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vg(multi_UBspline_3d_z *restrict spline, const PT& r, VT &psi, GT &grad)
{ eval_multi_UBspline_3d_z_vg (spline, r[0], r[1], r[2], psi.data(), grad[0].data()); }
/** evaluate values, gradients and laplacians using multi_UBspline_3d_z
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vgl(multi_UBspline_3d_z *restrict spline, const PT& r, VT &psi, GT &grad, VT& lap)
{ eval_multi_UBspline_3d_z_vgl (spline, r[0], r[1], r[2], psi.data(), grad[0].data(), lap.data()); }
/** evaluate values, gradients and hessians using multi_UBspline_3d_z
*/
template<typename PT, typename VT, typename GT, typename HT>
inline void evaluate_vgh(multi_UBspline_3d_z *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess)
{ eval_multi_UBspline_3d_z_vgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data());}
/** evaluate values, gradients hessians and gradient of the hessians using multi_UBspline_3d_d
*/
template<typename PT, typename VT, typename GT, typename HT, typename GG>
inline void evaluate_vghgh(multi_UBspline_3d_z *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess, GG& gradhess)
{ eval_multi_UBspline_3d_d_vghgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data(),gradhess[0].data()); }
/** set bspline for the i-th orbital for float-to-float
* @param spline multi_UBspline_3d_s
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_s* spline, int i, float* restrict indata)
{
set_multi_UBspline_3d_s(spline, i, indata);
}
/** set bspline for the i-th orbital for double-to-float
* @param spline multi_UBspline_3d_s
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_s* spline, int i, double* restrict indata)
{
set_multi_UBspline_3d_s_d(spline, i, indata);
}
/** evaluate values only using multi_UBspline_3d_s
*/
template<typename PT, typename VT>
inline void evaluate(multi_UBspline_3d_s *restrict spline, const PT& r, VT &psi)
{ eval_multi_UBspline_3d_s (spline, r[0], r[1], r[2], psi.data()); }
/** evaluate values and gradients using multi_UBspline_3d_s
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vg(multi_UBspline_3d_s *restrict spline, const PT& r, VT &psi, GT &grad)
{ eval_multi_UBspline_3d_s_vg(spline, r[0], r[1], r[2], psi.data(), grad[0].data()); }
/** evaluate values, gradients and laplacians using multi_UBspline_3d_s
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vgl(multi_UBspline_3d_s *restrict spline, const PT& r, VT &psi, GT &grad, VT& lap)
{ eval_multi_UBspline_3d_s_vgl (spline, r[0], r[1], r[2], psi.data(), grad[0].data(), lap.data()); }
/** evaluate values, gradients and hessians using multi_UBspline_3d_s
*/
template<typename PT, typename VT, typename GT, typename HT>
inline void evaluate_vgh(multi_UBspline_3d_s *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess)
{ eval_multi_UBspline_3d_s_vgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data()); }
/** set bspline for the i-th orbital for complex<float>-to-complex<float>
* @param spline multi_UBspline_3d_c
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_c* spline, int i, complex<float>* restrict indata)
{ set_multi_UBspline_3d_c(spline, i, indata); }
/** set bspline for the i-th orbital for complex<double>-to-complex<float>
* @param spline multi_UBspline_3d_c
* @param i the orbital index
* @param indata starting address of the input data
*/
inline void set(multi_UBspline_3d_c* spline, int i, complex<double>* restrict indata)
{
set_multi_UBspline_3d_c_z(spline, i, indata);
}
/** evaluate values only using multi_UBspline_3d_c
*/
template<typename PT, typename VT>
inline void evaluate(multi_UBspline_3d_c *restrict spline, const PT& r, VT &psi)
{ eval_multi_UBspline_3d_c (spline, r[0], r[1], r[2], psi.data()); }
/** evaluate values and gradients using multi_UBspline_3d_c
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vg(multi_UBspline_3d_c *restrict spline, const PT& r, VT &psi, GT &grad)
{ eval_multi_UBspline_3d_c_vg (spline, r[0], r[1], r[2], psi.data(), grad[0].data()); }
/** evaluate values, gradients and laplacians using multi_UBspline_3d_c
*/
template<typename PT, typename VT, typename GT>
inline void evaluate_vgl(multi_UBspline_3d_c *restrict spline, const PT& r, VT &psi, GT &grad, VT& lap)
{ eval_multi_UBspline_3d_c_vgl (spline, r[0], r[1], r[2], psi.data(), grad[0].data(), lap.data()); }
/** evaluate values, gradients and hessians using multi_UBspline_3d_c
*/
template<typename PT, typename VT, typename GT, typename HT>
inline void evaluate_vgh(multi_UBspline_3d_c *restrict spline, const PT& r, VT &psi, GT &grad, HT& hess)
{ eval_multi_UBspline_3d_c_vgh (spline, r[0], r[1], r[2], psi.data(), grad[0].data(),hess[0].data());}
/////another creation functions
/** create spline and initialized it */
template<typename VT, typename IT>
multi_UBspline_3d_s* create(multi_UBspline_3d_s* s
, VT& start , VT& end, IT& ng , bc_code bc, int num_splines)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_s xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=bc;
yBC.lCode=yBC.rCode=bc;
zBC.lCode=zBC.rCode=bc;
return create_multi_UBspline_3d_s(x_grid,y_grid,z_grid, xBC, yBC, zBC, num_splines);
}
/** create spline for complex<double> */
template<typename VT, typename IT>
multi_UBspline_3d_c* create(multi_UBspline_3d_c* s
, VT& start , VT& end, IT& ng , bc_code bc, int num_splines)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_c xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=bc;
yBC.lCode=yBC.rCode=bc;
zBC.lCode=zBC.rCode=bc;
return create_multi_UBspline_3d_c(x_grid,y_grid,z_grid, xBC, yBC, zBC, num_splines);
}
/** convert double to single precision */
inline void convert(multi_UBspline_3d_d* in, multi_UBspline_3d_s* out)
{
BCtype_s xbc, ybc, zbc;
xbc.lCode =in->xBC.lCode; xbc.rCode =in->xBC.rCode;
ybc.lCode =in->yBC.lCode; ybc.rCode =in->yBC.rCode;
zbc.lCode =in->zBC.lCode; zbc.rCode =in->zBC.rCode;
xbc.lVal=(float)(in->xBC.lVal); xbc.rVal=(float)(in->xBC.rVal);
ybc.lVal=(float)(in->yBC.lVal); ybc.rVal=(float)(in->yBC.rVal);
zbc.lVal=(float)(in->zBC.lVal); zbc.rVal=(float)(in->zBC.rVal);
out = create_multi_UBspline_3d_s(in->x_grid,in->y_grid,in->z_grid, xbc, ybc, zbc, in->num_splines);
simd::copy(out->coefs,in->coefs,in->coefs_size);
}
/** convert complex<double> to complex<float> */
inline void convert(multi_UBspline_3d_z* in, multi_UBspline_3d_c* out)
{
BCtype_c xbc, ybc, zbc;
xbc.lCode =in->xBC.lCode; xbc.rCode =in->xBC.rCode;
ybc.lCode =in->yBC.lCode; ybc.rCode =in->yBC.rCode;
zbc.lCode =in->zBC.lCode; zbc.rCode =in->zBC.rCode;
xbc.lVal_r=(float)(in->xBC.lVal_r); xbc.lVal_i=(float)(in->xBC.lVal_i);
xbc.rVal_r=(float)(in->xBC.rVal_r); xbc.rVal_i=(float)(in->xBC.rVal_i);
ybc.lVal_r=(float)(in->yBC.lVal_r); ybc.lVal_i=(float)(in->yBC.lVal_i);
ybc.rVal_r=(float)(in->yBC.rVal_r); ybc.rVal_i=(float)(in->yBC.rVal_i);
zbc.lVal_r=(float)(in->zBC.lVal_r); zbc.lVal_i=(float)(in->zBC.lVal_i);
zbc.rVal_r=(float)(in->zBC.rVal_r); zbc.rVal_i=(float)(in->zBC.rVal_i);
out = create_multi_UBspline_3d_c(in->x_grid,in->y_grid,in->z_grid, xbc, ybc, zbc, in->num_splines);
simd::copy(out->coefs,in->coefs,in->coefs_size);
}
/** create multi_UBspline_3d_d*
* @param s dummy multi_UBspline_3d_d*
* @param start starting grid values
* @param end ending grid values
* @param ng number of grids for [start,end)
* @param bc boundary condition
* @param num_splines number of splines to do
*/
template<typename VT, typename IT>
multi_UBspline_3d_d* create(multi_UBspline_3d_d* s
, VT& start , VT& end, IT& ng , bc_code bc, int num_splines)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_d xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=bc;
yBC.lCode=yBC.rCode=bc;
zBC.lCode=zBC.rCode=bc;
return create_multi_UBspline_3d_d(x_grid,y_grid,z_grid, xBC, yBC, zBC, num_splines);
}
template<typename VT, typename IT>
multi_UBspline_3d_d* create(multi_UBspline_3d_d* s
, VT& start , VT& end, IT& ng , bc_code xbc, bc_code ybc, bc_code zbc, int num_splines)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_d xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=xbc;
yBC.lCode=yBC.rCode=ybc;
zBC.lCode=zBC.rCode=zbc;
return create_multi_UBspline_3d_d(x_grid,y_grid,z_grid, xBC, yBC, zBC, num_splines);
}
/** create spline for complex<double> */
template<typename VT, typename IT>
multi_UBspline_3d_z* create(multi_UBspline_3d_z* s
, VT& start , VT& end, IT& ng , bc_code bc, int num_splines)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_z xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=bc;
yBC.lCode=yBC.rCode=bc;
zBC.lCode=zBC.rCode=bc;
return create_multi_UBspline_3d_z(x_grid,y_grid,z_grid, xBC, yBC, zBC, num_splines);
}
/** interfaces to use UBspline_3d_X
*
* - create
* - set
* - evaluate
*/
template<typename VT, typename IT>
UBspline_3d_d* create(UBspline_3d_d* s
, VT& start , VT& end, IT& ng , bc_code bc, int n=1)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_d xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=bc;
yBC.lCode=yBC.rCode=bc;
zBC.lCode=zBC.rCode=bc;
return create_UBspline_3d_d(x_grid,y_grid,z_grid, xBC, yBC, zBC,NULL);
}
template<typename VT, typename IT>
UBspline_3d_d* create(UBspline_3d_d* s
, VT& start , VT& end, IT& ng , IT& halfg, int n=1)
{
Ugrid x_grid, y_grid, z_grid;
BCtype_d xBC,yBC,zBC;
x_grid.start=start[0]; x_grid.end=end[0]; x_grid.num=ng[0];
y_grid.start=start[1]; y_grid.end=end[1]; y_grid.num=ng[1];
z_grid.start=start[2]; z_grid.end=end[2]; z_grid.num=ng[2];
xBC.lCode=xBC.rCode=(halfg[0])?ANTIPERIODIC:PERIODIC;
yBC.lCode=yBC.rCode=(halfg[1])?ANTIPERIODIC:PERIODIC;
zBC.lCode=zBC.rCode=(halfg[2])?ANTIPERIODIC:PERIODIC;;
return create_UBspline_3d_d(x_grid,y_grid,z_grid, xBC, yBC, zBC,NULL);
}
inline void set(UBspline_3d_d* s, double* restrict data)
{
recompute_UBspline_3d_d(s,data);
}
inline void set(multi_UBspline_3d_d* spline, int i, UBspline_3d_d* spline_in
, const int* offset, const int *N)
{
copy_UBspline_3d_d(spline, i, spline_in,offset,N);
}
inline void set(multi_UBspline_3d_s* spline, int i, UBspline_3d_d* spline_in
, const int* offset, const int *N)
{
copy_UBspline_3d_d_s(spline, i, spline_in,offset,N);
}
template<typename PT>
inline double evaluate(UBspline_3d_d *restrict spline, const PT& r)
{
double res;
eval_UBspline_3d_d(spline,r[0],r[1],r[2],&res);
return res;
}
}
}
#endif
| 45.178824 | 130 | 0.635175 | [
"vector"
] |
af577f1e45600bd18d8f64fea3cae4819e9dcec8 | 3,852 | hpp | C++ | FeatureGenerator/src/extractor/ContourHistogramExtractor.hpp | langenhagen/Master-Thesis | 72885bcfa2f7b76b85dabf70f060f60d53e20e51 | [
"BSD-3-Clause"
] | 1 | 2019-02-22T01:17:49.000Z | 2019-02-22T01:17:49.000Z | FeatureGenerator/src/extractor/ContourHistogramExtractor.hpp | langenhagen/Master-Thesis | 72885bcfa2f7b76b85dabf70f060f60d53e20e51 | [
"BSD-3-Clause"
] | null | null | null | FeatureGenerator/src/extractor/ContourHistogramExtractor.hpp | langenhagen/Master-Thesis | 72885bcfa2f7b76b85dabf70f060f60d53e20e51 | [
"BSD-3-Clause"
] | null | null | null | /******************************************************************************
/* @file Contour & histogram salient region feature extractor.
/*
/* @author langenhagen
/* @version 150611
/******************************************************************************/
#pragma once
///////////////////////////////////////////////////////////////////////////////
// INCLUDES project headers
#include "FeatureExtractor.hpp"
#include "ContourExtractor.hpp"
#include "HistogramExtractor.hpp"
///////////////////////////////////////////////////////////////////////////////
// NAMESPACE, CONSTANTS and TYPE DECLARATIONS/IMPLEMENTATIONS
namespace app {
/** @brief Combined shape and color histogram descriptor.
* Feature extractor uses a ContourExtractor and
* a HistogramExtractor and aggregates them.
*/
class ContourHistogramExtractor : public FeatureExtractor {
private: // vars
feature_extractor_description _contour_description;
feature_extractor_description _histogram_description;
ContourExtractor* _contour_extractor;
HistogramExtractor* _histogram_extractor;
public: // constructor & destructor
/** Main constructor.
* @param d The object's description.
*/
ContourHistogramExtractor( feature_extractor_description& d)
: FeatureExtractor(d),
_contour_description(),
_histogram_description() {
check_and_resolve_input_errors();
_contour_description.tweak_vector.clear();
_contour_description.tweak_vector.push_back( description.tweak_vector[0]);
_histogram_description.tweak_vector.clear();
_histogram_description.tweak_vector.insert(
_histogram_description.tweak_vector.end(),
d.tweak_vector.begin()+1,
d.tweak_vector.end());
_contour_extractor = new ContourExtractor( _contour_description);
_histogram_extractor = new HistogramExtractor( _histogram_description);
}
/** Desctructor.
*/
~ContourHistogramExtractor() {
delete _histogram_extractor;
delete _contour_extractor;
}
private: // methods
/// @see FeatureExtractor::do_extract()
// TODO scale the contour parts / histogram parts maybe
virtual return_error_code::return_error_code do_extract( const Mat3r& original_image, const Mat1b& saliency_map, const Mat1b& saliency_mask, const vector<Contour>& contours, Vec1r& o_features) const {
using namespace cv;
assert( original_image.size() == saliency_map.size() && "original_image and saliency map must have same dimensions");
return_error_code::return_error_code ret_contour, ret_histogram;
o_features.clear();
Vec1r contour_features, histogram_features;
ret_contour = _contour_extractor->extract( original_image, saliency_map, saliency_mask, contours, contour_features);
ret_histogram = _histogram_extractor->extract( original_image, saliency_map, saliency_mask, contours, histogram_features);
o_features.reserve( contour_features.size() + histogram_features.size());
o_features.insert(o_features.end(), contour_features.begin(), contour_features.end());
o_features.insert(o_features.end(), histogram_features.begin(), histogram_features.end());
return ret_contour;
}
protected: // helpers
void check_and_resolve_input_errors() const {
Vec1r& tweak = this->description.tweak_vector;
if( tweak.size() < 2) {
tweak.resize(2, -1); // if too few parameters where given
}
}
};
} | 38.909091 | 208 | 0.602285 | [
"object",
"shape",
"vector"
] |
af59b75b6df3f44337d7bb7983fb0058ec31ab66 | 1,381 | hpp | C++ | src/plugins/UCD_OSI_Data/MainWidget.hpp | bradosia/ucdavis-3D-analyzer | 6fefc5b86771b671a0ccac8ad2c6c523c23085f8 | [
"SGI-B-2.0",
"CECILL-B"
] | 1 | 2020-02-10T05:46:23.000Z | 2020-02-10T05:46:23.000Z | src/plugins/UCD_OSI_Data/MainWidget.hpp | bradosia/ucdavis-3D-electricity-map | 6fefc5b86771b671a0ccac8ad2c6c523c23085f8 | [
"SGI-B-2.0",
"CECILL-B"
] | null | null | null | src/plugins/UCD_OSI_Data/MainWidget.hpp | bradosia/ucdavis-3D-electricity-map | 6fefc5b86771b671a0ccac8ad2c6c523c23085f8 | [
"SGI-B-2.0",
"CECILL-B"
] | null | null | null | /*
* @name UC Davis 3D Analyzer
* @author Brad Lee & SiYi Meng
* @version 1.01
* @license GNU LGPL v3
* @brief 3D map of UC Davis electricity usage
*
* QT and OCC integration:
* Copyright (c) 2018 Shing Liu (eryar@163.com)
* License: MIT
* Source: https://github.com/eryar/occQt
*
* Data from OSIsoft and UC Davis
* Icons and images owned by their respective owners
*/
#ifndef UCD_OSI_DATA_MAIN_WIDGET_H
#define UCD_OSI_DATA_MAIN_WIDGET_H
// Universal Include
#include "universalInclude.hpp"
/*
* UCD3DEM = UC Davis 3D Electricity Map
*/
namespace UCD3DEM {
class UCD_OSI_Data : public QWidget {
Q_OBJECT
public:
UCD_OSI_Data(QWidget *parent) {}
~UCD_OSI_Data(){};
};
/* Writes data from HTTP request into a string buffer
* @param ptr data address
*/
size_t writefunc(void *ptr, size_t size, size_t nmemb, std::string *s);
/* Makes an HTTPS GET request to the URI
* @param URI The address
*/
rapidjson::Document HTTPS_GET_JSON(std::string URI);
void printJSON_value(const rapidjson::Value &a, unsigned int depth);
void printJSON_iterator(rapidjson::Value::ConstMemberIterator &itr,
unsigned int depth);
void getSettingsFile(std::string settingsFileString,
std::string &inputURIString,
std::string &outputFileString);
} // namespace UCD3DEM
#endif
// end UCD_OSI_DATA_MAIN_WIDGET_H
| 25.109091 | 71 | 0.704562 | [
"3d"
] |
af5f86e2a5c94d4478e54420b25674c0dac83f05 | 2,353 | cpp | C++ | test/old_tests/UnitTests/VariadicDelegate.cpp | sylveon/cppwinrt | 4d5c5ae3de386ce1f18c3410a27b9ceb40aa524d | [
"MIT"
] | 859 | 2016-10-13T00:11:52.000Z | 2019-05-06T15:45:46.000Z | test/old_tests/UnitTests/VariadicDelegate.cpp | shinsetsu/cppwinrt | ae0378373d2318d91448b8697a91d5b65a1fb2e5 | [
"MIT"
] | 655 | 2019-10-08T12:15:16.000Z | 2022-03-31T18:26:40.000Z | test/old_tests/UnitTests/VariadicDelegate.cpp | shinsetsu/cppwinrt | ae0378373d2318d91448b8697a91d5b65a1fb2e5 | [
"MIT"
] | 137 | 2016-10-13T04:19:59.000Z | 2018-11-09T05:08:03.000Z | #include "pch.h"
#include "catch.hpp"
using namespace winrt;
namespace
{
Windows::Foundation::IAsyncAction Object()
{
co_return;
}
int callback_state{};
void callback(int state)
{
callback_state = state;
}
struct callback_object
{
int m_state{};
void member(int state)
{
m_state = state;
}
};
}
TEST_CASE("Variadic delegate - zero arguments")
{
int count{};
delegate<> up = [&] { ++count; };
delegate<> down = [&] { --count; };
REQUIRE(count == 0);
up();
REQUIRE(count == 1);
up();
REQUIRE(count == 2);
down();
REQUIRE(count == 1);
down();
REQUIRE(count == 0);
}
TEST_CASE("Variadic delegate - mixed arguments")
{
int count{};
delegate<int, std::shared_ptr<int>, ::IUnknown*, Windows::Foundation::IInspectable> d =
[&](int const a, std::shared_ptr<int> const& b, ::IUnknown* c, Windows::Foundation::IInspectable const& d)
{
count = a;
if (b)
{
count += *b;
}
if (c)
{
++count;
}
if (d)
{
++count;
}
};
d(5, nullptr, nullptr, Object());
REQUIRE(count == 6);
d(6, std::make_shared<int>(7), get_unknown(Object()), nullptr);
REQUIRE(count == 6 + 7 + 1);
}
TEST_CASE("Variadic delegate - event")
{
int a{};
int b{};
int c{};
event<delegate<int>> e;
REQUIRE(!e);
e.add([&](int value) { a = value + 1; });
auto b_token = e.add([&](int value) { b = value + 2; });
e.add([&](int value) { c = value + 3; });
REQUIRE(e);
e.remove(b_token);
e(10);
REQUIRE(a == 11);
REQUIRE(b == 0);
REQUIRE(c == 13);
}
TEST_CASE("Variadic delegate - exception")
{
delegate<> d = [] { throw std::exception("what"); };
REQUIRE_THROWS_AS(d(), std::exception);
}
TEST_CASE("Variadic delegate - function")
{
delegate<int> d = callback;
REQUIRE(callback_state == 0);
d(123);
REQUIRE(callback_state == 123);
}
TEST_CASE("Variadic delegate - object")
{
callback_object object;
delegate<int> d{ &object, &callback_object::member };
REQUIRE(object.m_state == 0);
d(123);
REQUIRE(object.m_state == 123);
} | 19.130081 | 114 | 0.512962 | [
"object"
] |
af7020de3d51255cbb9a17b562953adba0a7a53a | 213 | cpp | C++ | Class/class2.cpp | miguelsrrobo/C-C- | 9126c613309e83d13000e665440fd46e72b109a9 | [
"MIT"
] | null | null | null | Class/class2.cpp | miguelsrrobo/C-C- | 9126c613309e83d13000e665440fd46e72b109a9 | [
"MIT"
] | null | null | null | Class/class2.cpp | miguelsrrobo/C-C- | 9126c613309e83d13000e665440fd46e72b109a9 | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
using namespace std;
class Carro
{
private:
int velMax;
const char nome;
public:
int potencia;
int getVelMax()
{
return this->velMax;
}
}
int main()
{
return 0;
}
| 9.26087 | 22 | 0.671362 | [
"vector"
] |
af76d68f49606efcd9b91c1fed29e1e67ada1de9 | 8,040 | cpp | C++ | TeapotGL/TeapotGL/main.cpp | kirbasin/TeapotGL | f8c4c8f5f6bdcda23a2dac48d625dccdc6858de5 | [
"MIT"
] | null | null | null | TeapotGL/TeapotGL/main.cpp | kirbasin/TeapotGL | f8c4c8f5f6bdcda23a2dac48d625dccdc6858de5 | [
"MIT"
] | null | null | null | TeapotGL/TeapotGL/main.cpp | kirbasin/TeapotGL | f8c4c8f5f6bdcda23a2dac48d625dccdc6858de5 | [
"MIT"
] | null | null | null | #include <iostream>
#include <GL/glew.h>
#include <GL/glut.h>
#include "shaders.h"
#include "transform.h"
#include <string>
#include <sstream>
#include <FreeImage.h>
#include "grader.h"
int amount; // The amount of rotation for each arrow press
vec3 eye; // The (regularly updated) vector coordinates of the eye location
vec3 up; // The (regularly updated) vector coordinates of the up location
const vec3 eyeinit(0.0, 0.0, 5.0); // Initial eye position, also for resets
const vec3 upinit(0.0, 1.0, 0.0); // Initial up position, also for resets
const int amountinit = 5; //Initial step amount for camera movement, also for resets
bool useGlu; // Toggle use of "official" opengl/glm transform vs user code
int w = 500, h = 500; // width and height
Grader grader;
bool allowGrader = false;
GLuint vertexshader, fragmentshader, shaderprogram; // shaders
// Constants to set up lighting on the teapot
const GLfloat light_position[] = { 0,5,10,1 }; // Position of light 0
const GLfloat light_position1[] = { 0,5,-10,1 }; // Position of light 1
const GLfloat light_specular[] = { 0.6,0.3,0,1 }; // Specular of light 0
const GLfloat light_specular1[] = { 0,0.3,0.6,1 }; // Specular of light 1
const GLfloat one[] = { 1,1,1,1 }; // Specular on teapot
const GLfloat medium[] = { 0.5,0.5,0.5,1 }; // Diffuse on teapot
const GLfloat small[] = { 0.2,0.2,0.2,1 }; // Ambient on teapot
const GLfloat high[] = { 100 }; // Shininess of teapot
GLfloat light0[4], light1[4];
// Variables to set uniform params for lighting fragment shader
GLuint islight;
GLuint light0posn;
GLuint light0color;
GLuint light1posn;
GLuint light1color;
GLuint ambient;
GLuint diffuse;
GLuint specular;
GLuint shininess;
// New helper transformation function to transform vector by modelview
// May be better done using newer glm functionality.
void transformvec(const GLfloat input[4], GLfloat output[4])
{
GLfloat modelview[16]; // in column major order
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
for (int i = 0; i < 4; i++)
{
output[i] = 0;
for (int j = 0; j < 4; j++)
output[i] += modelview[4 * j + i] * input[j];
}
}
std::string imgNumber(int num)
{
std::stringstream ss;
//Return 3-digit number (or more if num > 999, but this case shouldn't be encountered)
if (num < 10)
{
ss << "00" << num;
}
else if (num < 100)
{
ss << "0" << num;
}
else
{
ss << num;
}
return ss.str();
}
void saveScreenshot(string fname)
{
int pix = w * h;
BYTE *pixels = new BYTE[3 * pix];
glReadBuffer(GL_FRONT);
glReadPixels(0, 0, w, h, GL_BGR, GL_UNSIGNED_BYTE, pixels);
FIBITMAP *img = FreeImage_ConvertFromRawBits(pixels, w, h, w * 3, 24, 0xFF0000, 0x00FF00, 0x0000FF, false);
std::cout << "Saving screenshot: " << fname << "\n";
FreeImage_Save(FIF_PNG, img, fname.c_str(), 0);
delete pixels;
}
void printHelp()
{
std::cout << "\npress 'h' to print this message again.\n"
<< "press '+' or '-' to change the amount of rotation that\n"
<< "occurs with each arrow press.\n"
<< "press 'i' to run image grader test cases\n"
<< "press 'g' to switch between using glm::lookAt or our own implementation.\n"
<< "press 'r' to reset the transformation (eye and up).\n"
<< "press ESC to quit.\n";
}
void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case '+':
amount++;
std::cout << "amount set to " << amount << "\n";
break;
case '-':
amount--;
std::cout << "amount set to " << amount << "\n";
break;
case 'i':
if (useGlu)
{
std::cout << "Please disable glm::LookAt by pressing 'g'"
<< " before running tests\n";
}
else if (!allowGrader)
{
std::cout << "Error: no input file specified for grader\n";
}
else
{
std::cout << "Running tests...\n";
grader.runTests();
std::cout << "Done! [ESC to quit]\n";
}
break;
case 'g':
useGlu = !useGlu;
std::cout << "Using glm::LookAt set to: "
<< (useGlu ? " true " : " false ") << "\n";
break;
case 'h':
printHelp();
break;
case 27: // Escape to quit
exit(0);
break;
case 'r': // reset eye and up vectors
eye = eyeinit;
up = upinit;
amount = amountinit;
std::cout << "eye and up vectors reset, amount set to " << amountinit << "\n";
break;
}
glutPostRedisplay();
}
// When an arrow key is pressed, it will call transform functions
void specialKey(int key, int x, int y)
{
switch (key)
{
case 100: //left
Transform::left(amount, eye, up);
break;
case 101: //up
Transform::up(amount, eye, up);
break;
case 102: //right
Transform::left(-amount, eye, up);
break;
case 103: //down
Transform::up(-amount, eye, up);
break;
}
glutPostRedisplay();
}
// Uses the Projection matrices (technically deprecated) to set perspective
// We could also do this in a more modern fashion with glm.
void reshape(int width, int height)
{
w = width;
h = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, w / (float)h, 0.1, 99);
glViewport(0, 0, w, h);
}
void init()
{
// Set up initial position for eye, up and amount
// As well as booleans
eye = eyeinit;
up = upinit;
amount = amountinit;
useGlu = true;
glEnable(GL_DEPTH_TEST);
// The lighting is enabled using the same framework as in mytest 3
// Except that we use two point lights
// For now, lights and materials are set in display. Will move to init
// later, per update lights
vertexshader = initshaders(GL_VERTEX_SHADER, "shaders/light.vert.glsl");
fragmentshader = initshaders(GL_FRAGMENT_SHADER, "shaders/light.frag.glsl");
shaderprogram = initprogram(vertexshader, fragmentshader);
islight = glGetUniformLocation(shaderprogram, "islight");
light0posn = glGetUniformLocation(shaderprogram, "light0posn");
light0color = glGetUniformLocation(shaderprogram, "light0color");
light1posn = glGetUniformLocation(shaderprogram, "light1posn");
light1color = glGetUniformLocation(shaderprogram, "light1color");
ambient = glGetUniformLocation(shaderprogram, "ambient");
diffuse = glGetUniformLocation(shaderprogram, "diffuse");
specular = glGetUniformLocation(shaderprogram, "specular");
shininess = glGetUniformLocation(shaderprogram, "shininess");
}
void display()
{
glClearColor(0, 0, 1, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
mat4 mv;
const vec3 center(0.0, 0.0, 0.0);
if (useGlu) mv = glm::lookAt(eye, center, up);
else
{
mv = Transform::lookAt(eye, up);
}
glLoadMatrixf(&mv[0][0]);
// Set Light and Material properties for the teapot
// Lights are transformed by current modelview matrix.
// The shader can't do this globally.
// So we need to do so manually.
transformvec(light_position, light0);
transformvec(light_position1, light1);
glUniform4fv(light0posn, 1, light0);
glUniform4fv(light0color, 1, light_specular);
glUniform4fv(light1posn, 1, light1);
glUniform4fv(light1color, 1, light_specular1);
//glUniform4fv(ambient,1,small);
//glUniform4fv(diffuse,1,medium);
glUniform4fv(ambient, 1, small);
glUniform4fv(diffuse, 1, small);
glUniform4fv(specular, 1, one);
glUniform1fv(shininess, 1, high);
glUniform1i(islight, true);
glutSolidTeapot(2);
glutSwapBuffers();
}
int main(int argc, char* argv[])
{
//Initialize GLUT
FreeImage_Initialise();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutCreateWindow("Teapot");
GLenum err = glewInit();
if (GLEW_OK != err)
{
std::cerr << "Error: " << glewGetString(err) << std::endl;
}
init();
glutDisplayFunc(display);
glutSpecialFunc(specialKey);
glutKeyboardFunc(keyboard);
glutReshapeFunc(reshape);
glutReshapeWindow(w, h);
if (argc > 1)
{
allowGrader = true;
grader.init(argv[1]);
grader.loadCommands(argv[1]);
grader.bindDisplayFunc(display);
grader.bindSpecialFunc(specialKey);
grader.bindKeyboardFunc(keyboard);
grader.bindScreenshotFunc(saveScreenshot);
}
printHelp();
glutMainLoop();
FreeImage_DeInitialise();
return 0;
}
| 26.27451 | 108 | 0.676119 | [
"vector",
"transform"
] |
50309fb76ece7d44017ab7316eadcab21d0e897f | 5,011 | hpp | C++ | example/simple_chat_screen.hpp | Abhisheknishant/chops-net-ip | 0bd09e06cbef586391b2fca1f6f62daba16a4298 | [
"BSL-1.0"
] | 5 | 2019-04-30T02:42:18.000Z | 2021-04-16T08:32:47.000Z | example/simple_chat_screen.hpp | Abhisheknishant/chops-net-ip | 0bd09e06cbef586391b2fca1f6f62daba16a4298 | [
"BSL-1.0"
] | 28 | 2019-03-12T07:34:16.000Z | 2020-06-04T01:46:47.000Z | example/simple_chat_screen.hpp | Abhisheknishant/chops-net-ip | 0bd09e06cbef586391b2fca1f6f62daba16a4298 | [
"BSL-1.0"
] | 3 | 2019-04-01T02:25:31.000Z | 2020-06-02T11:11:53.000Z | /** @file
*
* @brief class to handle printing output to stdout for simple_chat_demo.cpp program.
*
* @author Thurman Gillespy
*
* Copyright (c) 2019 Thurman Gillespy
* 4/15/19
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef SIMPLE_CHAT_SCREEN_HPP_INCLUDED
#define SIMPLE_CHAT_SCREEN_HPP_INCLUDED
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib> // std::system
const int NUN_SCROLL_LINES = 10;
// shared globals
const std::string PARAM_CONNECT = "-connect";
const std::string PARAM_ACCEPT = "-accept";
const std::string REMOTE = "[remote] ";
// handle all methods to print output to stdout
class simple_chat_screen {
private:
const std::string m_ip_addr; // IP address or host name
const std::string m_port; // connection port
const std::string m_connect_type; // @c '-connect' or @c '-accept'
std::string m_upper_screen; // fixed upper region of screen output
std::string m_scroll_text; // history scroll text region
const int m_num_scroll_lines; // number of 'scroll lines'
public:
simple_chat_screen(const std::string& ip, const std::string& port, const std::string& type,
bool print_errors, int num_lines = NUN_SCROLL_LINES) :
m_ip_addr(ip), m_port(port), m_connect_type(type), m_num_scroll_lines(num_lines) {
create_upper_screen(print_errors);
create_scroll_text();
};
// print the output to stdout
// called after @c insert_scroll_line
void draw_screen() {
clear_screen();
std::cout << (m_upper_screen + m_scroll_text + BOTTOM + PROMPT);
}
// the scroll region has a fixed numbmer of 'scroll lines'.
// calculate complete new scroll line; delete old line at top
// of text scroll region; add new scroll line (append)
void insert_scroll_line(const std::string& text, const std::string& prefix) {
// create the new scroll line
// remove DELIM at end of text
std::string new_scroll_line = "| " + prefix +
text.substr(0, text.size() - 1);
new_scroll_line +=
BLANK_LINE.substr(new_scroll_line.length(), std::string::npos);
// remove old scroll line in scroll text (using substr), add new scroll line
m_scroll_text =
m_scroll_text.substr(m_scroll_text.find_first_of("\n") + 1, std::string::npos) +
new_scroll_line;
}
private:
using S = const std::string;
// string constants for output
S TOP =
"\n_____________________________________________________________________________\n";
S BLANK_LINE =
"| |\n";
S DIVIDOR =
"|___________________________________________________________________________|\n";
S HDR_1 =
"| chops-net-ip chat network demo |\n";
S HDR_IP =
"| IP address: ";
S HDR_PORT =
" port: ";
S HDR_TYPE =
"| connection type: ";
S CONNECT_T =
"connector |\n";
S ACCEPT_T =
"acceptor |\n";
S ERR_LOG_ON =
"| errors printed to console: ON |\n";
S ERR_LOG_OFF =
"| errors printed to console: OFF |\n";
S HDR_INSTR =
"| Enter text to send at prompt. Enter 'quit' to exit. |\n";
S SCROLL_LINE =
"| ";
S BOTTOM =
"|---------------------------------------------------------------------------|\n";
S HDR_START =
"| ";
S PROMPT = "| > ";
// create the string that represent the (unchanging) upper screen so only calculate once
void create_upper_screen(bool print_err) {
std::string hdr_info = HDR_IP + (m_ip_addr == "" ? "\"\"" : m_ip_addr) + HDR_PORT +
m_port ;
hdr_info += BLANK_LINE.substr(hdr_info.size(), std::string::npos);
m_upper_screen =
TOP + BLANK_LINE + HDR_1 + DIVIDOR + BLANK_LINE + hdr_info + HDR_TYPE +
(m_connect_type == PARAM_ACCEPT ? ACCEPT_T : CONNECT_T) +
(print_err ? ERR_LOG_ON : ERR_LOG_OFF) +
DIVIDOR + BLANK_LINE + HDR_INSTR + DIVIDOR;
}
// seed the scroll text region with m_scoll_lines number of blank lines
void create_scroll_text() {
int count = m_num_scroll_lines;
while (count-- > 0) {
m_scroll_text += BLANK_LINE;
}
}
// not recommended, but adequate for this demo
// for problems with system("clear") see
// http://www.cplusplus.com/articles/4z18T05o/
void clear_screen() {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
}
};
#endif | 36.05036 | 95 | 0.577529 | [
"vector"
] |
50316156745ad7ca08dd04ae32dec805f7dc1c22 | 2,078 | cpp | C++ | VehFuncs/Shake.cpp | JuniorDjjr/VehFuncs | 123c9228f99efe2a14030473542e2c0fff54c82f | [
"MIT"
] | 32 | 2018-01-23T21:38:06.000Z | 2022-02-06T21:02:42.000Z | VehFuncs/Shake.cpp | JuniorDjjr/VehFuncs | 123c9228f99efe2a14030473542e2c0fff54c82f | [
"MIT"
] | 41 | 2018-03-20T00:21:50.000Z | 2021-12-05T10:01:49.000Z | VehFuncs/Shake.cpp | JuniorDjjr/VehFuncs | 123c9228f99efe2a14030473542e2c0fff54c82f | [
"MIT"
] | 3 | 2019-06-17T16:46:48.000Z | 2020-05-12T01:40:33.000Z | #include "VehFuncsCommon.h"
#include "NodeName.h"
#include "CTimer.h"
#include "PerlinNoise\SimplexNoise.h"
#include "MatrixBackup.h"
void ProcessShake(CVehicle *vehicle, list<RwFrame*> frames)
{
ExtendedData &xdata = xData.Get(vehicle);
// Process dot
xdata.dotLife += CTimer::ms_fTimeStep * (0.2f * ((xdata.smoothGasPedal * 2.0f) + 1.0f));
if (xdata.dotLife >= 100.0f) xdata.dotLife = 1.0f;
for (list<RwFrame*>::iterator it = frames.begin(); it != frames.end(); ++it)
{
RwFrame * frame = *it;
if (frame->object.parent && FRAME_EXTENSION(frame)->owner == vehicle)
{
RestoreMatrixBackup(&frame->modelling, FRAME_EXTENSION(frame)->origMatrix);
if (vehicle->m_nVehicleFlags.bEngineOn && vehicle->m_fHealth > 0 && !vehicle->m_nVehicleFlags.bEngineBroken && !vehicle->m_nVehicleFlags.bIsDrowning)
{
// Get noise
float noise = SimplexNoise::noise(xdata.dotLife);
const string name = GetFrameNodeName(frame);
size_t found;
// Mult noise
found = name.find("_mu=");
if (found != string::npos)
{
float mult = stof(&name[found + 4]);
noise *= mult;
}
// Div noise by gas pedal
//noise /= ((xdata.smoothGasPedal * 1.0f) + 1.0f);
// Convert noise to shake (angle)
float angle = 0.0f;
angle += noise * 0.7f;
// Apply tilt
found = name.find("_tl=");
if (found != string::npos)
{
float angMult = stof(&name[found + 6]);
angle += xdata.smoothGasPedal * angMult;
}
// Find axis
RwV3d * axis;
found = name.find("_x");
if (found != string::npos)
{
axis = (RwV3d*)0x008D2E00;
}
else
{
found = name.find("_z");
if (found != string::npos)
{
axis = (RwV3d*)0x008D2E18;
}
else axis = (RwV3d*)0x008D2E0C;
}
// Rotate
RwFrameRotate(frame, axis, angle, rwCOMBINEPRECONCAT);
}
RwFrameUpdateObjects(frame);
}
else
{
ExtendedData &xdata = xData.Get(vehicle);
xdata.shakeFrame.remove(*it);
}
}
}
| 25.036145 | 153 | 0.589509 | [
"object"
] |
503234f5cf60b9483d70801d0d2e1a9af9dc7312 | 78,320 | cpp | C++ | src/app/qgsrasterlayerproperties.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsrasterlayerproperties.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsrasterlayerproperties.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | 1 | 2021-12-25T08:40:30.000Z | 2021-12-25T08:40:30.000Z | /***************************************************************************
qgsrasterlayerproperties.cpp - description
-------------------
begin : 1/1/2004
copyright : (C) 2004 Tim Sutton
email : tim@linfiniti.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <limits>
#include <typeinfo>
#include "qgisapp.h"
#include "qgsgui.h"
#include "qgsapplication.h"
#include "qgsbilinearrasterresampler.h"
#include "qgsbrightnesscontrastfilter.h"
#include "qgscontrastenhancement.h"
#include "qgscoordinatetransform.h"
#include "qgscubicrasterresampler.h"
#include "qgsprojectionselectiondialog.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayerstyleguiutils.h"
#include "qgsmaptoolemitpoint.h"
#include "qgsmaptopixel.h"
#include "qgsmetadatawidget.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgsmultibandcolorrendererwidget.h"
#include "qgsnative.h"
#include "qgspalettedrendererwidget.h"
#include "qgsproject.h"
#include "qgsrasterbandstats.h"
#include "qgsrasterdataprovider.h"
#include "qgsrasterhistogramwidget.h"
#include "qgsrasteridentifyresult.h"
#include "qgsrasterlayer.h"
#include "qgsrasterlayerproperties.h"
#include "qgsrasterpyramid.h"
#include "qgsrasterrange.h"
#include "qgsrasterrenderer.h"
#include "qgsrasterrendererregistry.h"
#include "qgsrasterresamplefilter.h"
#include "qgsrastertransparency.h"
#include "qgssinglebandgrayrendererwidget.h"
#include "qgssinglebandpseudocolorrendererwidget.h"
#include "qgshuesaturationfilter.h"
#include "qgshillshaderendererwidget.h"
#include "qgssettings.h"
#include "qgsmaplayerlegend.h"
#include "qgsfileutils.h"
#include <QDesktopServices>
#include <QTableWidgetItem>
#include <QHeaderView>
#include <QTextStream>
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
#include <QPainter>
#include <QLinearGradient>
#include <QPainterPath>
#include <QPolygonF>
#include <QColorDialog>
#include <QList>
#include <QMouseEvent>
#include <QVector>
#include <QUrl>
QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent, Qt::WindowFlags fl )
: QgsOptionsDialogBase( QStringLiteral( "RasterLayerProperties" ), parent, fl )
// Constant that signals property not used.
, TRSTRING_NOT_SET( tr( "Not Set" ) )
, mDefaultStandardDeviation( 0 )
, mDefaultRedBand( 0 )
, mDefaultGreenBand( 0 )
, mDefaultBlueBand( 0 )
, mRasterLayer( qobject_cast<QgsRasterLayer *>( lyr ) )
, mGradientHeight( 0.0 )
, mGradientWidth( 0.0 )
, mMapCanvas( canvas )
, mMetadataFilled( false )
{
mGrayMinimumMaximumEstimated = true;
mRGBMinimumMaximumEstimated = true;
setupUi( this );
connect( mLayerOrigNameLineEd, &QLineEdit::textEdited, this, &QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited );
connect( buttonBuildPyramids, &QPushButton::clicked, this, &QgsRasterLayerProperties::buttonBuildPyramids_clicked );
connect( pbnAddValuesFromDisplay, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked );
connect( pbnAddValuesManually, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnAddValuesManually_clicked );
connect( mCrsSelector, &QgsProjectionSelectionWidget::crsChanged, this, &QgsRasterLayerProperties::mCrsSelector_crsChanged );
connect( pbnDefaultValues, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnDefaultValues_clicked );
connect( pbnExportTransparentPixelValues, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked );
connect( pbnImportTransparentPixelValues, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked );
connect( pbnRemoveSelectedRow, &QToolButton::clicked, this, &QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked );
connect( mRenderTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged );
connect( mResetColorRenderingBtn, &QToolButton::clicked, this, &QgsRasterLayerProperties::mResetColorRenderingBtn_clicked );
// QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,
// switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left),
// and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
initOptionsBase( false );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsRasterLayerProperties::showHelp );
mBtnStyle = new QPushButton( tr( "Style" ) );
QMenu *menuStyle = new QMenu( this );
menuStyle->addAction( tr( "Load Style…" ), this, &QgsRasterLayerProperties::loadStyle_clicked );
menuStyle->addAction( tr( "Save Style…" ), this, &QgsRasterLayerProperties::saveStyleAs_clicked );
menuStyle->addSeparator();
menuStyle->addAction( tr( "Save as Default" ), this, &QgsRasterLayerProperties::saveDefaultStyle_clicked );
menuStyle->addAction( tr( "Restore Default" ), this, &QgsRasterLayerProperties::loadDefaultStyle_clicked );
mBtnStyle->setMenu( menuStyle );
connect( menuStyle, &QMenu::aboutToShow, this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
buttonBox->addButton( mBtnStyle, QDialogButtonBox::ResetRole );
mBtnMetadata = new QPushButton( tr( "Metadata" ), this );
QMenu *menuMetadata = new QMenu( this );
mActionLoadMetadata = menuMetadata->addAction( tr( "Load Metadata…" ), this, &QgsRasterLayerProperties::loadMetadata );
mActionSaveMetadataAs = menuMetadata->addAction( tr( "Save Metadata…" ), this, &QgsRasterLayerProperties::saveMetadataAs );
menuMetadata->addSeparator();
menuMetadata->addAction( tr( "Save as Default" ), this, &QgsRasterLayerProperties::saveDefaultMetadata );
menuMetadata->addAction( tr( "Restore Default" ), this, &QgsRasterLayerProperties::loadDefaultMetadata );
mBtnMetadata->setMenu( menuMetadata );
buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
connect( lyr->styleManager(), &QgsMapLayerStyleManager::currentStyleChanged, this, &QgsRasterLayerProperties::syncToLayer );
connect( this, &QDialog::accepted, this, &QgsRasterLayerProperties::apply );
connect( this, &QDialog::rejected, this, &QgsRasterLayerProperties::onCancel );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsRasterLayerProperties::apply );
// brightness/contrast controls
connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
connect( mContrastSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
// Connect saturation slider and spin box
connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
connect( spinBoxSaturation, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
// Connect colorize strength slider and spin box
connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
connect( spinColorizeStrength, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
// enable or disable saturation slider and spin box depending on grayscale combo choice
connect( comboGrayscale, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRasterLayerProperties::toggleSaturationControls );
// enable or disable colorize colorbutton with colorize checkbox
connect( mColorizeCheck, &QAbstractButton::toggled, this, &QgsRasterLayerProperties::toggleColorizeControls );
// enable or disable Build Pyramids button depending on selection in pyramid list
connect( lbxPyramidResolutions, &QListWidget::itemSelectionChanged, this, &QgsRasterLayerProperties::toggleBuildPyramidsButton );
connect( mRefreshLayerCheckBox, &QCheckBox::toggled, mRefreshLayerIntervalSpinBox, &QDoubleSpinBox::setEnabled );
// set up the scale based layer visibility stuff....
mScaleRangeWidget->setMapCanvas( mMapCanvas );
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
mScaleRangeWidget->setScaleRange( lyr->minimumScale(), lyr->maximumScale() );
leNoDataValue->setValidator( new QDoubleValidator( -std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 1000, this ) );
// build GUI components
QIcon myPyramidPixmap( QgsApplication::getThemeIcon( "/mIconPyramid.svg" ) );
QIcon myNoPyramidPixmap( QgsApplication::getThemeIcon( "/mIconNoPyramid.svg" ) );
pbnAddValuesManually->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/symbologyAdd.svg" ) ) );
pbnAddValuesFromDisplay->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionContextHelp.png" ) ) );
pbnRemoveSelectedRow->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/symbologyRemove.svg" ) ) );
pbnDefaultValues->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOpenTable.svg" ) ) );
pbnImportTransparentPixelValues->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileOpen.svg" ) ) );
pbnExportTransparentPixelValues->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileSave.svg" ) ) );
if ( mMapCanvas )
{
mPixelSelectorTool = qgis::make_unique<QgsMapToolEmitPoint>( canvas );
connect( mPixelSelectorTool.get(), &QgsMapToolEmitPoint::canvasClicked, this, &QgsRasterLayerProperties::pixelSelected );
connect( mPixelSelectorTool.get(), &QgsMapToolEmitPoint::deactivated, this, &QgsRasterLayerProperties::restoreWindowModality );
}
else
{
pbnAddValuesFromDisplay->setEnabled( false );
}
if ( !mRasterLayer )
{
return;
}
QgsRasterDataProvider *provider = mRasterLayer->dataProvider();
// Only do pyramids if dealing directly with GDAL.
if ( provider && provider->capabilities() & QgsRasterDataProvider::BuildPyramids )
{
// initialize resampling methods
cboResamplingMethod->clear();
const auto constProviderType = QgsRasterDataProvider::pyramidResamplingMethods( mRasterLayer->providerType() );
for ( QPair<QString, QString> method : constProviderType )
{
cboResamplingMethod->addItem( method.second, method.first );
}
// keep it in sync with qgsrasterpyramidsoptionwidget.cpp
QString prefix = provider->name() + "/driverOptions/_pyramids/";
QgsSettings mySettings;
QString defaultMethod = mySettings.value( prefix + "resampling", "AVERAGE" ).toString();
int idx = cboResamplingMethod->findData( defaultMethod );
if ( idx >= 0 )
cboResamplingMethod->setCurrentIndex( idx );
// build pyramid list
QList< QgsRasterPyramid > myPyramidList = provider->buildPyramidList();
QList< QgsRasterPyramid >::iterator myRasterPyramidIterator;
for ( myRasterPyramidIterator = myPyramidList.begin();
myRasterPyramidIterator != myPyramidList.end();
++myRasterPyramidIterator )
{
if ( myRasterPyramidIterator->exists )
{
lbxPyramidResolutions->addItem( new QListWidgetItem( myPyramidPixmap,
QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral( " x " ) +
QString::number( myRasterPyramidIterator->yDim ) ) );
}
else
{
lbxPyramidResolutions->addItem( new QListWidgetItem( myNoPyramidPixmap,
QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral( " x " ) +
QString::number( myRasterPyramidIterator->yDim ) ) );
}
}
}
else
{
// disable Pyramids tab completely
mOptsPage_Pyramids->setEnabled( false );
}
// We can calculate histogram for all data sources but estimated only if
// size is unknown - could also be enabled if well supported (estimated histogram
// and and let user know that it is estimated)
if ( !provider || !( provider->capabilities() & QgsRasterDataProvider::Size ) )
{
// disable Histogram tab completely
mOptsPage_Histogram->setEnabled( false );
}
QVBoxLayout *layout = new QVBoxLayout( metadataFrame );
layout->setMargin( 0 );
mMetadataWidget = new QgsMetadataWidget( this, mRasterLayer );
mMetadataWidget->layout()->setContentsMargins( -1, 0, -1, 0 );
mMetadataWidget->setMapCanvas( mMapCanvas );
layout->addWidget( mMetadataWidget );
metadataFrame->setLayout( layout );
QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().toWkt() );
QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().authid() + " - " + mRasterLayer->crs().description() );
mCrsSelector->setCrs( mRasterLayer->crs() );
// Set text for pyramid info box
QString pyramidFormat( QStringLiteral( "<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
QString pyramidHeader = tr( "Description" );
QString pyramidSentence1 = tr( "Large resolution raster layers can slow navigation in QGIS." );
QString pyramidSentence2 = tr( "By creating lower resolution copies of the data (pyramids) performance can be considerably improved as QGIS selects the most suitable resolution to use depending on the level of zoom." );
QString pyramidSentence3 = tr( "You must have write access in the directory where the original data is stored to build pyramids." );
QString pyramidSentence4 = tr( "Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
QString pyramidSentence5 = tr( "Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader,
pyramidSentence1,
pyramidSentence2,
pyramidSentence3,
pyramidSentence4,
pyramidSentence5 ) );
//resampling
mResamplingGroupBox->setSaveCheckedState( true );
const QgsRasterRenderer *renderer = mRasterLayer->renderer();
mZoomedInResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ) );
mZoomedInResamplingComboBox->insertItem( 1, tr( "Bilinear" ) );
mZoomedInResamplingComboBox->insertItem( 2, tr( "Cubic" ) );
mZoomedOutResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ) );
mZoomedOutResamplingComboBox->insertItem( 1, tr( "Average" ) );
const QgsRasterResampleFilter *resampleFilter = mRasterLayer->resampleFilter();
//set combo boxes to current resampling types
if ( resampleFilter )
{
const QgsRasterResampler *zoomedInResampler = resampleFilter->zoomedInResampler();
if ( zoomedInResampler )
{
if ( zoomedInResampler->type() == QLatin1String( "bilinear" ) )
{
mZoomedInResamplingComboBox->setCurrentIndex( 1 );
}
else if ( zoomedInResampler->type() == QLatin1String( "cubic" ) )
{
mZoomedInResamplingComboBox->setCurrentIndex( 2 );
}
}
else
{
mZoomedInResamplingComboBox->setCurrentIndex( 0 );
}
const QgsRasterResampler *zoomedOutResampler = resampleFilter->zoomedOutResampler();
if ( zoomedOutResampler )
{
if ( zoomedOutResampler->type() == QLatin1String( "bilinear" ) ) //bilinear resampler does averaging when zooming out
{
mZoomedOutResamplingComboBox->setCurrentIndex( 1 );
}
}
else
{
mZoomedOutResamplingComboBox->setCurrentIndex( 0 );
}
mMaximumOversamplingSpinBox->setValue( resampleFilter->maxOversampling() );
}
btnColorizeColor->setColorDialogTitle( tr( "Select Color" ) );
btnColorizeColor->setContext( QStringLiteral( "symbology" ) );
// Hue and saturation color control
const QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
//set hue and saturation controls to current values
if ( hueSaturationFilter )
{
sliderSaturation->setValue( hueSaturationFilter->saturation() );
comboGrayscale->setCurrentIndex( ( int ) hueSaturationFilter->grayscaleMode() );
// Set initial state of saturation controls based on grayscale mode choice
toggleSaturationControls( static_cast<int>( hueSaturationFilter->grayscaleMode() ) );
// Set initial state of colorize controls
mColorizeCheck->setChecked( hueSaturationFilter->colorizeOn() );
btnColorizeColor->setColor( hueSaturationFilter->colorizeColor() );
toggleColorizeControls( hueSaturationFilter->colorizeOn() );
sliderColorizeStrength->setValue( hueSaturationFilter->colorizeStrength() );
}
//blend mode
mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
//transparency band
if ( provider )
{
cboxTransparencyBand->setShowNotSetOption( true, tr( "None" ) );
cboxTransparencyBand->setLayer( mRasterLayer );
// Alpha band is set in sync()
#if 0
if ( renderer )
{
QgsDebugMsg( QStringLiteral( "alphaBand = %1" ).arg( renderer->alphaBand() ) );
if ( renderer->alphaBand() > 0 )
{
cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->alphaBand() ) );
}
}
#endif
}
// create histogram widget
mHistogramWidget = nullptr;
if ( mOptsPage_Histogram->isEnabled() )
{
mHistogramWidget = new QgsRasterHistogramWidget( mRasterLayer, mOptsPage_Histogram );
mHistogramStackedWidget->addWidget( mHistogramWidget );
}
//insert renderer widgets into registry
QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "paletted" ), QgsPalettedRendererWidget::create );
QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "multibandcolor" ), QgsMultiBandColorRendererWidget::create );
QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "singlebandpseudocolor" ), QgsSingleBandPseudoColorRendererWidget::create );
QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "singlebandgray" ), QgsSingleBandGrayRendererWidget::create );
QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "hillshade" ), QgsHillshadeRendererWidget::create );
//fill available renderers into combo box
QgsRasterRendererRegistryEntry entry;
mDisableRenderTypeComboBoxCurrentIndexChanged = true;
const auto constRenderersList = QgsApplication::rasterRendererRegistry()->renderersList();
for ( const QString &name : constRenderersList )
{
if ( QgsApplication::rasterRendererRegistry()->rendererData( name, entry ) )
{
if ( ( mRasterLayer->rasterType() != QgsRasterLayer::ColorLayer && entry.name != QLatin1String( "singlebandcolordata" ) ) ||
( mRasterLayer->rasterType() == QgsRasterLayer::ColorLayer && entry.name == QLatin1String( "singlebandcolordata" ) ) )
{
mRenderTypeComboBox->addItem( entry.visibleName, entry.name );
}
}
}
mDisableRenderTypeComboBoxCurrentIndexChanged = false;
int widgetIndex = 0;
if ( renderer )
{
QString rendererType = renderer->type();
widgetIndex = mRenderTypeComboBox->findData( rendererType );
if ( widgetIndex != -1 )
{
mDisableRenderTypeComboBoxCurrentIndexChanged = true;
mRenderTypeComboBox->setCurrentIndex( widgetIndex );
mDisableRenderTypeComboBoxCurrentIndexChanged = false;
}
if ( rendererType == QLatin1String( "singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
{
// no band rendering options for singlebandcolordata, so minimize group box
QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
sizep.setVerticalStretch( 0 );
sizep.setVerticalPolicy( QSizePolicy::Maximum );
mBandRenderingGrpBx->setSizePolicy( sizep );
mBandRenderingGrpBx->updateGeometry();
}
if ( mRasterLayer->providerType() != QStringLiteral( "wms" ) )
{
mWMSPrintGroupBox->hide();
mPublishDataSourceUrlCheckBox->hide();
mBackgroundLayerCheckBox->hide();
}
}
mRenderTypeComboBox_currentIndexChanged( widgetIndex );
// update based on lyr's current state
sync();
QgsSettings settings;
// if dialog hasn't been opened/closed yet, default to Styles tab, which is used most often
// this will be read by restoreOptionsBaseUi()
if ( !settings.contains( QStringLiteral( "/Windows/RasterLayerProperties/tab" ) ) )
{
settings.setValue( QStringLiteral( "Windows/RasterLayerProperties/tab" ),
mOptStackedWidget->indexOf( mOptsPage_Style ) );
}
mResetColorRenderingBtn->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionUndo.svg" ) ) );
QString title = QString( tr( "Layer Properties - %1" ) ).arg( lyr->name() );
if ( !mRasterLayer->styleManager()->isDefault( mRasterLayer->styleManager()->currentStyle() ) )
title += QStringLiteral( " (%1)" ).arg( mRasterLayer->styleManager()->currentStyle() );
restoreOptionsBaseUi( title );
optionsStackedWidget_CurrentChanged( mOptionsStackedWidget->currentIndex() );
}
void QgsRasterLayerProperties::setupTransparencyTable( int nBands )
{
tableTransparency->clear();
tableTransparency->setColumnCount( 0 );
tableTransparency->setRowCount( 0 );
mTransparencyToEdited.clear();
if ( nBands == 3 )
{
tableTransparency->setColumnCount( 4 );
tableTransparency->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Red" ) ) );
tableTransparency->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "Green" ) ) );
tableTransparency->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Blue" ) ) );
tableTransparency->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "Percent Transparent" ) ) );
}
else //1 band
{
tableTransparency->setColumnCount( 3 );
// Is it important to distinguish the header? It becomes difficult with range.
#if 0
if ( QgsRasterLayer::PalettedColor != mRasterLayer->drawingStyle() &&
QgsRasterLayer::PalettedSingleBandGray != mRasterLayer->drawingStyle() &&
QgsRasterLayer::PalettedSingleBandPseudoColor != mRasterLayer->drawingStyle() &&
QgsRasterLayer::PalettedMultiBandColor != mRasterLayer->drawingStyle() )
{
tableTransparency->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Gray" ) ) );
}
else
{
tableTransparency->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Indexed Value" ) ) );
}
#endif
tableTransparency->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "From" ) ) );
tableTransparency->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "To" ) ) );
tableTransparency->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Percent Transparent" ) ) );
}
tableTransparency->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
}
void QgsRasterLayerProperties::populateTransparencyTable( QgsRasterRenderer *renderer )
{
if ( !mRasterLayer )
{
return;
}
if ( !renderer )
{
return;
}
int nBands = renderer->usesBands().size();
setupTransparencyTable( nBands );
const QgsRasterTransparency *rasterTransparency = renderer->rasterTransparency();
if ( !rasterTransparency )
{
return;
}
if ( nBands == 1 )
{
QList<QgsRasterTransparency::TransparentSingleValuePixel> pixelList = rasterTransparency->transparentSingleValuePixelList();
for ( int i = 0; i < pixelList.size(); ++i )
{
tableTransparency->insertRow( i );
setTransparencyCell( i, 0, pixelList[i].min );
setTransparencyCell( i, 1, pixelList[i].max );
setTransparencyCell( i, 2, pixelList[i].percentTransparent );
// break synchronization only if values differ
if ( pixelList[i].min != pixelList[i].max )
{
setTransparencyToEdited( i );
}
}
}
else if ( nBands == 3 )
{
QList<QgsRasterTransparency::TransparentThreeValuePixel> pixelList = rasterTransparency->transparentThreeValuePixelList();
for ( int i = 0; i < pixelList.size(); ++i )
{
tableTransparency->insertRow( i );
setTransparencyCell( i, 0, pixelList[i].red );
setTransparencyCell( i, 1, pixelList[i].green );
setTransparencyCell( i, 2, pixelList[i].blue );
setTransparencyCell( i, 3, pixelList[i].percentTransparent );
}
}
tableTransparency->resizeColumnsToContents();
tableTransparency->resizeRowsToContents();
}
void QgsRasterLayerProperties::setRendererWidget( const QString &rendererName )
{
QgsDebugMsg( "rendererName = " + rendererName );
QgsRasterRendererWidget *oldWidget = mRendererWidget;
QgsRasterRenderer *oldRenderer = mRasterLayer->renderer();
int alphaBand = -1;
double opacity = 1;
if ( oldRenderer )
{
// Retain alpha band and opacity when switching renderer
alphaBand = oldRenderer->alphaBand();
opacity = oldRenderer->opacity();
}
QgsRasterRendererRegistryEntry rendererEntry;
if ( QgsApplication::rasterRendererRegistry()->rendererData( rendererName, rendererEntry ) )
{
if ( rendererEntry.widgetCreateFunction ) //single band color data renderer e.g. has no widget
{
QgsDebugMsg( QStringLiteral( "renderer has widgetCreateFunction" ) );
// Current canvas extent (used to calc min/max) in layer CRS
QgsRectangle myExtent = mMapCanvas->mapSettings().outputExtentToLayerExtent( mRasterLayer, mMapCanvas->extent() );
if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->type() ) )
{
if ( rendererName == QLatin1String( "singlebandgray" ) )
{
whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::SingleBandGray, mRasterLayer->dataProvider() ) );
whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
}
else if ( rendererName == QLatin1String( "multibandcolor" ) )
{
whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::MultiBandColor, mRasterLayer->dataProvider() ) );
whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
}
}
mRasterLayer->renderer()->setAlphaBand( alphaBand );
mRasterLayer->renderer()->setOpacity( opacity );
mRendererWidget = rendererEntry.widgetCreateFunction( mRasterLayer, myExtent );
mRendererWidget->setMapCanvas( mMapCanvas );
mRendererStackedWidget->addWidget( mRendererWidget );
if ( oldWidget )
{
//compare used bands in new and old renderer and reset transparency dialog if different
QgsRasterRenderer *oldRenderer = oldWidget->renderer();
QgsRasterRenderer *newRenderer = mRendererWidget->renderer();
QList<int> oldBands = oldRenderer->usesBands();
QList<int> newBands = newRenderer->usesBands();
if ( oldBands != newBands )
{
populateTransparencyTable( newRenderer );
}
delete oldRenderer;
delete newRenderer;
}
}
}
if ( mRendererWidget != oldWidget )
delete oldWidget;
if ( mHistogramWidget )
{
mHistogramWidget->setRendererWidget( rendererName, mRendererWidget );
}
}
/**
\note moved from ctor
Previously this dialog was created anew with each right-click pop-up menu
invocation. Changed so that the dialog always exists after first
invocation, and is just re-synchronized with its layer's state when
re-shown.
*/
void QgsRasterLayerProperties::sync()
{
QgsSettings myQSettings;
if ( mRasterLayer->dataProvider()->dataType( 1 ) == Qgis::ARGB32
|| mRasterLayer->dataProvider()->dataType( 1 ) == Qgis::ARGB32_Premultiplied )
{
gboxNoDataValue->setEnabled( false );
gboxCustomTransparency->setEnabled( false );
mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
}
// TODO: Wouldn't it be better to just removeWidget() the tabs than delete them? [LS]
if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::BuildPyramids ) )
{
if ( mOptsPage_Pyramids )
{
delete mOptsPage_Pyramids;
mOptsPage_Pyramids = nullptr;
}
}
if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::Size ) )
{
if ( mOptsPage_Histogram )
{
delete mOptsPage_Histogram;
mOptsPage_Histogram = nullptr;
delete mHistogramWidget;
mHistogramWidget = nullptr;
}
}
QgsDebugMsg( QStringLiteral( "populate transparency tab" ) );
/*
* Style tab (brightness and contrast)
*/
QgsBrightnessContrastFilter *brightnessFilter = mRasterLayer->brightnessFilter();
if ( brightnessFilter )
{
mSliderBrightness->setValue( brightnessFilter->brightness() );
mSliderContrast->setValue( brightnessFilter->contrast() );
}
//set the transparency slider
/*
* Transparent Pixel Tab
*/
//set the transparency slider
QgsRasterRenderer *renderer = mRasterLayer->renderer();
if ( renderer )
{
mOpacityWidget->setOpacity( renderer->opacity() );
cboxTransparencyBand->setBand( renderer->alphaBand() );
}
//add current NoDataValue to NoDataValue line edit
// TODO: should be per band
// TODO: no data ranges
if ( mRasterLayer->dataProvider()->sourceHasNoDataValue( 1 ) )
{
lblSrcNoDataValue->setText( QgsRasterBlock::printValue( mRasterLayer->dataProvider()->sourceNoDataValue( 1 ) ) );
}
else
{
lblSrcNoDataValue->setText( tr( "not defined" ) );
}
mSrcNoDataValueCheckBox->setChecked( mRasterLayer->dataProvider()->useSourceNoDataValue( 1 ) );
bool enableSrcNoData = mRasterLayer->dataProvider()->sourceHasNoDataValue( 1 ) && !std::isnan( mRasterLayer->dataProvider()->sourceNoDataValue( 1 ) );
mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData );
lblSrcNoDataValue->setEnabled( enableSrcNoData );
QgsRasterRangeList noDataRangeList = mRasterLayer->dataProvider()->userNoDataValues( 1 );
QgsDebugMsg( QStringLiteral( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
if ( !noDataRangeList.isEmpty() )
{
leNoDataValue->insert( QgsRasterBlock::printValue( noDataRangeList.value( 0 ).min() ) );
}
else
{
leNoDataValue->insert( QString() );
}
mRefreshLayerCheckBox->setChecked( mRasterLayer->hasAutoRefreshEnabled() );
mRefreshLayerIntervalSpinBox->setEnabled( mRasterLayer->hasAutoRefreshEnabled() );
mRefreshLayerIntervalSpinBox->setValue( mRasterLayer->autoRefreshInterval() / 1000.0 );
populateTransparencyTable( mRasterLayer->renderer() );
QgsDebugMsg( QStringLiteral( "populate colormap tab" ) );
/*
* Transparent Pixel Tab
*/
QgsDebugMsg( QStringLiteral( "populate general tab" ) );
/*
* General Tab
*/
//these properties (layer name and label) are provided by the qgsmaplayer superclass
mLayerOrigNameLineEd->setText( mRasterLayer->name() );
leDisplayName->setText( mRasterLayer->name() );
//get the thumbnail for the layer
QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->previewAsImage( pixmapThumbnail->size() ) );
pixmapThumbnail->setPixmap( thumbnail );
// TODO fix legend + palette pixmap
//update the legend pixmap on this dialog
#if 0
pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
pixmapLegend->setScaledContents( true );
pixmapLegend->repaint();
//set the palette pixmap
pixmapPalette->setPixmap( mRasterLayer->paletteAsPixmap( mRasterLayer->bandNumber( mRasterLayer->grayBandName() ) ) );
pixmapPalette->setScaledContents( true );
pixmapPalette->repaint();
#endif
QgsDebugMsg( QStringLiteral( "populate metadata tab" ) );
/*
* Metadata Tab
*/
//populate the metadata tab's text browser widget with gdal metadata info
QString myStyle = QgsApplication::reportStyleSheet();
myStyle.append( QStringLiteral( "body { margin: 10px; }\n " ) );
teMetadataViewer->document()->setDefaultStyleSheet( myStyle );
teMetadataViewer->setHtml( mRasterLayer->htmlMetadata() );
teMetadataViewer->setOpenLinks( false );
connect( teMetadataViewer, &QTextBrowser::anchorClicked, this, &QgsRasterLayerProperties::urlClicked );
mMetadataFilled = true;
// WMS Name as layer short name
mLayerShortNameLineEdit->setText( mRasterLayer->shortName() );
// WMS Name validator
QValidator *shortNameValidator = new QRegExpValidator( QgsApplication::shortNameRegExp(), this );
mLayerShortNameLineEdit->setValidator( shortNameValidator );
//layer title and abstract
mLayerTitleLineEdit->setText( mRasterLayer->title() );
mLayerAbstractTextEdit->setPlainText( mRasterLayer->abstract() );
mLayerKeywordListLineEdit->setText( mRasterLayer->keywordList() );
mLayerDataUrlLineEdit->setText( mRasterLayer->dataUrl() );
mLayerDataUrlFormatComboBox->setCurrentIndex(
mLayerDataUrlFormatComboBox->findText(
mRasterLayer->dataUrlFormat()
)
);
//layer attribution and metadataUrl
mLayerAttributionLineEdit->setText( mRasterLayer->attribution() );
mLayerAttributionUrlLineEdit->setText( mRasterLayer->attributionUrl() );
mLayerMetadataUrlLineEdit->setText( mRasterLayer->metadataUrl() );
mLayerMetadataUrlTypeComboBox->setCurrentIndex(
mLayerMetadataUrlTypeComboBox->findText(
mRasterLayer->metadataUrlType()
)
);
mLayerMetadataUrlFormatComboBox->setCurrentIndex(
mLayerMetadataUrlFormatComboBox->findText(
mRasterLayer->metadataUrlFormat()
)
);
mLayerLegendUrlLineEdit->setText( mRasterLayer->legendUrl() );
mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->legendUrlFormat() ) );
//WMS print layer
QVariant wmsPrintLayer = mRasterLayer->customProperty( QStringLiteral( "WMSPrintLayer" ) );
if ( wmsPrintLayer.isValid() )
{
mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
}
QVariant wmsPublishDataSourceUrl = mRasterLayer->customProperty( QStringLiteral( "WMSPublishDataSourceUrl" ), false );
mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
QVariant wmsBackgroundLayer = mRasterLayer->customProperty( QStringLiteral( "WMSBackgroundLayer" ), false );
mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
/*
* Legend Tab
*/
mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
} // QgsRasterLayerProperties::sync()
/*
*
* PUBLIC AND PRIVATE SLOTS
*
*/
void QgsRasterLayerProperties::apply()
{
// Do nothing on "bad" layers
if ( !mRasterLayer->isValid() )
return;
/*
* Legend Tab
*/
mLegendConfigEmbeddedWidget->applyToLayer();
QgsDebugMsg( QStringLiteral( "apply processing symbology tab" ) );
/*
* Symbology Tab
*/
//set whether the layer histogram should be inverted
//mRasterLayer->setInvertHistogram( cboxInvertColorMap->isChecked() );
mRasterLayer->brightnessFilter()->setBrightness( mSliderBrightness->value() );
mRasterLayer->brightnessFilter()->setContrast( mSliderContrast->value() );
QgsDebugMsg( QStringLiteral( "processing transparency tab" ) );
/*
* Transparent Pixel Tab
*/
//set NoDataValue
QgsRasterRangeList myNoDataRangeList;
if ( "" != leNoDataValue->text() )
{
bool myDoubleOk = false;
double myNoDataValue = leNoDataValue->text().toDouble( &myDoubleOk );
if ( myDoubleOk )
{
QgsRasterRange myNoDataRange( myNoDataValue, myNoDataValue );
myNoDataRangeList << myNoDataRange;
}
}
for ( int bandNo = 1; bandNo <= mRasterLayer->dataProvider()->bandCount(); bandNo++ )
{
mRasterLayer->dataProvider()->setUserNoDataValue( bandNo, myNoDataRangeList );
mRasterLayer->dataProvider()->setUseSourceNoDataValue( bandNo, mSrcNoDataValueCheckBox->isChecked() );
}
//set renderer from widget
QgsRasterRendererWidget *rendererWidget = dynamic_cast<QgsRasterRendererWidget *>( mRendererStackedWidget->currentWidget() );
if ( rendererWidget )
{
rendererWidget->doComputations();
mRasterLayer->setRenderer( rendererWidget->renderer() );
}
mMetadataWidget->acceptMetadata();
mMetadataFilled = false;
//transparency settings
QgsRasterRenderer *rasterRenderer = mRasterLayer->renderer();
if ( rasterRenderer )
{
rasterRenderer->setAlphaBand( cboxTransparencyBand->currentBand() );
//Walk through each row in table and test value. If not valid set to 0.0 and continue building transparency list
QgsRasterTransparency *rasterTransparency = new QgsRasterTransparency();
if ( tableTransparency->columnCount() == 4 )
{
QgsRasterTransparency::TransparentThreeValuePixel myTransparentPixel;
QList<QgsRasterTransparency::TransparentThreeValuePixel> myTransparentThreeValuePixelList;
for ( int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
{
myTransparentPixel.red = transparencyCellValue( myListRunner, 0 );
myTransparentPixel.green = transparencyCellValue( myListRunner, 1 );
myTransparentPixel.blue = transparencyCellValue( myListRunner, 2 );
myTransparentPixel.percentTransparent = transparencyCellValue( myListRunner, 3 );
myTransparentThreeValuePixelList.append( myTransparentPixel );
}
rasterTransparency->setTransparentThreeValuePixelList( myTransparentThreeValuePixelList );
}
else if ( tableTransparency->columnCount() == 3 )
{
QgsRasterTransparency::TransparentSingleValuePixel myTransparentPixel;
QList<QgsRasterTransparency::TransparentSingleValuePixel> myTransparentSingleValuePixelList;
for ( int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
{
myTransparentPixel.min = transparencyCellValue( myListRunner, 0 );
myTransparentPixel.max = transparencyCellValue( myListRunner, 1 );
myTransparentPixel.percentTransparent = transparencyCellValue( myListRunner, 2 );
myTransparentSingleValuePixelList.append( myTransparentPixel );
}
rasterTransparency->setTransparentSingleValuePixelList( myTransparentSingleValuePixelList );
}
rasterRenderer->setRasterTransparency( rasterTransparency );
//set global transparency
rasterRenderer->setOpacity( mOpacityWidget->opacity() );
}
QgsDebugMsg( QStringLiteral( "processing general tab" ) );
/*
* General Tab
*/
mRasterLayer->setName( mLayerOrigNameLineEd->text() );
// set up the scale based layer visibility stuff....
mRasterLayer->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
mRasterLayer->setMinimumScale( mScaleRangeWidget->minimumScale() );
mRasterLayer->setMaximumScale( mScaleRangeWidget->maximumScale() );
mRasterLayer->setAutoRefreshInterval( mRefreshLayerIntervalSpinBox->value() * 1000.0 );
mRasterLayer->setAutoRefreshEnabled( mRefreshLayerCheckBox->isChecked() );
//update the legend pixmap
// pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
// pixmapLegend->setScaledContents( true );
// pixmapLegend->repaint();
QgsRasterResampleFilter *resampleFilter = mRasterLayer->resampleFilter();
if ( resampleFilter )
{
QgsRasterResampler *zoomedInResampler = nullptr;
QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText();
if ( zoomedInResamplingMethod == tr( "Bilinear" ) )
{
zoomedInResampler = new QgsBilinearRasterResampler();
}
else if ( zoomedInResamplingMethod == tr( "Cubic" ) )
{
zoomedInResampler = new QgsCubicRasterResampler();
}
resampleFilter->setZoomedInResampler( zoomedInResampler );
//raster resampling
QgsRasterResampler *zoomedOutResampler = nullptr;
QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText();
if ( zoomedOutResamplingMethod == tr( "Average" ) )
{
zoomedOutResampler = new QgsBilinearRasterResampler();
}
resampleFilter->setZoomedOutResampler( zoomedOutResampler );
resampleFilter->setMaxOversampling( mMaximumOversamplingSpinBox->value() );
}
// Hue and saturation controls
QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
if ( hueSaturationFilter )
{
hueSaturationFilter->setSaturation( sliderSaturation->value() );
hueSaturationFilter->setGrayscaleMode( ( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
}
//set the blend mode for the layer
mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
//get the thumbnail for the layer
QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->previewAsImage( pixmapThumbnail->size() ) );
pixmapThumbnail->setPixmap( thumbnail );
if ( mRasterLayer->shortName() != mLayerShortNameLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setShortName( mLayerShortNameLineEdit->text() );
if ( mRasterLayer->title() != mLayerTitleLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setTitle( mLayerTitleLineEdit->text() );
if ( mRasterLayer->abstract() != mLayerAbstractTextEdit->toPlainText() )
mMetadataFilled = false;
mRasterLayer->setAbstract( mLayerAbstractTextEdit->toPlainText() );
if ( mRasterLayer->keywordList() != mLayerKeywordListLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setKeywordList( mLayerKeywordListLineEdit->text() );
if ( mRasterLayer->dataUrl() != mLayerDataUrlLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setDataUrl( mLayerDataUrlLineEdit->text() );
if ( mRasterLayer->dataUrlFormat() != mLayerDataUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mRasterLayer->setDataUrlFormat( mLayerDataUrlFormatComboBox->currentText() );
//layer attribution and metadataUrl
if ( mRasterLayer->attribution() != mLayerAttributionLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setAttribution( mLayerAttributionLineEdit->text() );
if ( mRasterLayer->attributionUrl() != mLayerAttributionUrlLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setAttributionUrl( mLayerAttributionUrlLineEdit->text() );
if ( mRasterLayer->metadataUrl() != mLayerMetadataUrlLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setMetadataUrl( mLayerMetadataUrlLineEdit->text() );
if ( mRasterLayer->metadataUrlType() != mLayerMetadataUrlTypeComboBox->currentText() )
mMetadataFilled = false;
mRasterLayer->setMetadataUrlType( mLayerMetadataUrlTypeComboBox->currentText() );
if ( mRasterLayer->metadataUrlFormat() != mLayerMetadataUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mRasterLayer->setMetadataUrlFormat( mLayerMetadataUrlFormatComboBox->currentText() );
if ( mRasterLayer->legendUrl() != mLayerLegendUrlLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setLegendUrl( mLayerLegendUrlLineEdit->text() );
if ( mRasterLayer->legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mRasterLayer->setLegendUrlFormat( mLayerLegendUrlFormatComboBox->currentText() );
if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
{
mRasterLayer->setCustomProperty( QStringLiteral( "WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
}
mRasterLayer->setCustomProperty( "WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
mRasterLayer->setCustomProperty( "WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
// Force a redraw of the legend
mRasterLayer->setLegend( QgsMapLayerLegend::defaultRasterLegend( mRasterLayer ) );
//make sure the layer is redrawn
mRasterLayer->triggerRepaint();
// notify the project we've made a change
QgsProject::instance()->setDirty( true );
}//apply
void QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited( const QString &text )
{
leDisplayName->setText( mRasterLayer->formatLayerName( text ) );
}
void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
{
QgsRasterDataProvider *provider = mRasterLayer->dataProvider();
std::unique_ptr< QgsRasterBlockFeedback > feedback( new QgsRasterBlockFeedback() );
connect( feedback.get(), &QgsRasterBlockFeedback::progressChanged, mPyramidProgress, &QProgressBar::setValue );
//
// Go through the list marking any files that are selected in the listview
// as true so that we can generate pyramids for them.
//
QList< QgsRasterPyramid> myPyramidList = provider->buildPyramidList();
for ( int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
{
QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
//mark to be pyramided
myPyramidList[myCounterInt].build = myItem->isSelected() || myPyramidList[myCounterInt].exists;
}
// keep it in sync with qgsrasterpyramidsoptionwidget.cpp
QString prefix = provider->name() + "/driverOptions/_pyramids/";
QgsSettings mySettings;
QString resamplingMethod( cboResamplingMethod->currentData().toString() );
mySettings.setValue( prefix + "resampling", resamplingMethod );
//
// Ask raster layer to build the pyramids
//
// let the user know we're going to possibly be taking a while
QApplication::setOverrideCursor( Qt::WaitCursor );
QString res = provider->buildPyramids(
myPyramidList,
resamplingMethod,
( QgsRaster::RasterPyramidsFormat ) cbxPyramidsFormat->currentIndex(),
QStringList(),
feedback.get() );
QApplication::restoreOverrideCursor();
mPyramidProgress->setValue( 0 );
buttonBuildPyramids->setEnabled( false );
if ( !res.isNull() )
{
if ( res == QLatin1String( "CANCELED" ) )
{
// user canceled
}
else if ( res == QLatin1String( "ERROR_WRITE_ACCESS" ) )
{
QMessageBox::warning( this, tr( "Building Pyramids" ),
tr( "Write access denied. Adjust the file permissions and try again." ) );
}
else if ( res == QLatin1String( "ERROR_WRITE_FORMAT" ) )
{
QMessageBox::warning( this, tr( "Building Pyramids" ),
tr( "The file was not writable. Some formats do not "
"support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
}
else if ( res == QLatin1String( "FAILED_NOT_SUPPORTED" ) )
{
QMessageBox::warning( this, tr( "Building Pyramids" ),
tr( "Building pyramid overviews is not supported on this type of raster." ) );
}
else if ( res == QLatin1String( "ERROR_JPEG_COMPRESSION" ) )
{
QMessageBox::warning( this, tr( "Building Pyramids" ),
tr( "Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
}
else if ( res == QLatin1String( "ERROR_VIRTUAL" ) )
{
QMessageBox::warning( this, tr( "Building Pyramids" ),
tr( "Building pyramid overviews is not supported on this type of raster." ) );
}
}
//
// repopulate the pyramids list
//
lbxPyramidResolutions->clear();
// Need to rebuild list as some or all pyramids may have failed to build
myPyramidList = provider->buildPyramidList();
QIcon myPyramidPixmap( QgsApplication::getThemeIcon( "/mIconPyramid.svg" ) );
QIcon myNoPyramidPixmap( QgsApplication::getThemeIcon( "/mIconNoPyramid.svg" ) );
QList< QgsRasterPyramid >::iterator myRasterPyramidIterator;
for ( myRasterPyramidIterator = myPyramidList.begin();
myRasterPyramidIterator != myPyramidList.end();
++myRasterPyramidIterator )
{
if ( myRasterPyramidIterator->exists )
{
lbxPyramidResolutions->addItem( new QListWidgetItem( myPyramidPixmap,
QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral( " x " ) +
QString::number( myRasterPyramidIterator->yDim ) ) );
}
else
{
lbxPyramidResolutions->addItem( new QListWidgetItem( myNoPyramidPixmap,
QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral( " x " ) +
QString::number( myRasterPyramidIterator->yDim ) ) );
}
}
//update the legend pixmap
// pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
// pixmapLegend->setScaledContents( true );
// pixmapLegend->repaint();
//populate the metadata tab's text browser widget with gdal metadata info
QString myStyle = QgsApplication::reportStyleSheet();
teMetadataViewer->setHtml( mRasterLayer->htmlMetadata() );
teMetadataViewer->document()->setDefaultStyleSheet( myStyle );
}
void QgsRasterLayerProperties::urlClicked( const QUrl &url )
{
QFileInfo file( url.toLocalFile() );
if ( file.exists() && !file.isDir() )
QgsGui::instance()->nativePlatformInterface()->openFileExplorerAndSelectFile( url.toLocalFile() );
else
QDesktopServices::openUrl( url );
}
void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged( int index )
{
if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || ! mRasterLayer->renderer() )
{
return;
}
QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
setRendererWidget( rendererName );
}
void QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked()
{
if ( mMapCanvas && mPixelSelectorTool )
{
//Need to work around the modality of the dialog but can not just hide() it.
// According to Qt5 docs, to change modality the dialog needs to be hidden
// and shown again.
hide();
setModal( false );
// Transfer focus to the canvas to use the selector tool
mMapCanvas->window()->raise();
mMapCanvas->window()->activateWindow();
mMapCanvas->window()->setFocus();
mMapCanvas->setMapTool( mPixelSelectorTool.get() );
}
}
void QgsRasterLayerProperties::pbnAddValuesManually_clicked()
{
QgsRasterRenderer *renderer = mRendererWidget->renderer();
if ( !renderer )
{
return;
}
tableTransparency->insertRow( tableTransparency->rowCount() );
int n = renderer->usesBands().size();
if ( n == 1 ) n++;
for ( int i = 0; i < n; i++ )
{
setTransparencyCell( tableTransparency->rowCount() - 1, i, std::numeric_limits<double>::quiet_NaN() );
}
setTransparencyCell( tableTransparency->rowCount() - 1, n, 100 );
tableTransparency->resizeColumnsToContents();
tableTransparency->resizeRowsToContents();
}
void QgsRasterLayerProperties::mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs )
{
QgisApp::instance()->askUserForDatumTransform( crs, QgsProject::instance()->crs() );
mRasterLayer->setCrs( crs );
mMetadataWidget->crsChanged();
}
void QgsRasterLayerProperties::pbnDefaultValues_clicked()
{
if ( !mRendererWidget )
{
return;
}
QgsRasterRenderer *r = mRendererWidget->renderer();
if ( !r )
{
return;
}
int nBands = r->usesBands().size();
delete r; // really delete?
setupTransparencyTable( nBands );
tableTransparency->resizeColumnsToContents(); // works only with values
tableTransparency->resizeRowsToContents();
}
void QgsRasterLayerProperties::setTransparencyCell( int row, int column, double value )
{
QgsDebugMsg( QStringLiteral( "value = %1" ).arg( value, 0, 'g', 17 ) );
QgsRasterDataProvider *provider = mRasterLayer->dataProvider();
if ( !provider ) return;
QgsRasterRenderer *renderer = mRendererWidget->renderer();
if ( !renderer ) return;
int nBands = renderer->usesBands().size();
QLineEdit *lineEdit = new QLineEdit();
lineEdit->setFrame( false ); // frame looks bad in table
// Without margins row selection is not displayed (important for delete row)
lineEdit->setContentsMargins( 1, 1, 1, 1 );
if ( column == tableTransparency->columnCount() - 1 )
{
// transparency
// Who needs transparency as floating point?
lineEdit->setValidator( new QIntValidator( nullptr ) );
lineEdit->setText( QString::number( static_cast<int>( value ) ) );
}
else
{
// value
QString valueString;
switch ( provider->sourceDataType( 1 ) )
{
case Qgis::Float32:
case Qgis::Float64:
lineEdit->setValidator( new QDoubleValidator( nullptr ) );
if ( !std::isnan( value ) )
{
valueString = QgsRasterBlock::printValue( value );
}
break;
default:
lineEdit->setValidator( new QIntValidator( nullptr ) );
if ( !std::isnan( value ) )
{
valueString = QString::number( static_cast<int>( value ) );
}
break;
}
lineEdit->setText( valueString );
}
tableTransparency->setCellWidget( row, column, lineEdit );
adjustTransparencyCellWidth( row, column );
if ( nBands == 1 && ( column == 0 || column == 1 ) )
{
connect( lineEdit, &QLineEdit::textEdited, this, &QgsRasterLayerProperties::transparencyCellTextEdited );
}
tableTransparency->resizeColumnsToContents();
}
void QgsRasterLayerProperties::setTransparencyCellValue( int row, int column, double value )
{
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( tableTransparency->cellWidget( row, column ) );
if ( !lineEdit ) return;
lineEdit->setText( QgsRasterBlock::printValue( value ) );
lineEdit->adjustSize();
adjustTransparencyCellWidth( row, column );
tableTransparency->resizeColumnsToContents();
}
double QgsRasterLayerProperties::transparencyCellValue( int row, int column )
{
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( tableTransparency->cellWidget( row, column ) );
if ( !lineEdit || lineEdit->text().isEmpty() )
{
std::numeric_limits<double>::quiet_NaN();
}
return lineEdit->text().toDouble();
}
void QgsRasterLayerProperties::adjustTransparencyCellWidth( int row, int column )
{
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( tableTransparency->cellWidget( row, column ) );
if ( !lineEdit ) return;
int width = std::max( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
width = std::max( width, tableTransparency->columnWidth( column ) );
lineEdit->setFixedWidth( width );
}
void QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked()
{
QgsSettings myQSettings;
QString myLastDir = myQSettings.value( QStringLiteral( "lastRasterFileFilterDir" ), QDir::homePath() ).toString();
QString myFileName = QFileDialog::getSaveFileName( this, tr( "Save File" ), myLastDir, tr( "Textfile" ) + " (*.txt)" );
if ( !myFileName.isEmpty() )
{
if ( !myFileName.endsWith( QLatin1String( ".txt" ), Qt::CaseInsensitive ) )
{
myFileName = myFileName + ".txt";
}
QFile myOutputFile( myFileName );
if ( myOutputFile.open( QFile::WriteOnly | QIODevice::Truncate ) )
{
QTextStream myOutputStream( &myOutputFile );
myOutputStream << "# " << tr( "QGIS Generated Transparent Pixel Value Export File" ) << '\n';
if ( rasterIsMultiBandColor() )
{
myOutputStream << "#\n#\n# " << tr( "Red" ) << "\t" << tr( "Green" ) << "\t" << tr( "Blue" ) << "\t" << tr( "Percent Transparent" );
for ( int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
{
myOutputStream << '\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 1 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 2 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 3 ) );
}
}
else
{
myOutputStream << "#\n#\n# " << tr( "Value" ) << "\t" << tr( "Percent Transparent" );
for ( int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
{
myOutputStream << '\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 1 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 2 ) );
}
}
}
else
{
QMessageBox::warning( this, tr( "Export Transparent Pixels" ), tr( "Write access denied. Adjust the file permissions and try again.\n\n" ) );
}
}
}
void QgsRasterLayerProperties::transparencyCellTextEdited( const QString &text )
{
Q_UNUSED( text );
QgsDebugMsg( QStringLiteral( "text = %1" ).arg( text ) );
QgsRasterRenderer *renderer = mRendererWidget->renderer();
if ( !renderer )
{
return;
}
int nBands = renderer->usesBands().size();
if ( nBands == 1 )
{
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( sender() );
if ( !lineEdit ) return;
int row = -1;
int column = -1;
for ( int r = 0; r < tableTransparency->rowCount(); r++ )
{
for ( int c = 0; c < tableTransparency->columnCount(); c++ )
{
if ( tableTransparency->cellWidget( r, c ) == sender() )
{
row = r;
column = c;
break;
}
}
if ( row != -1 ) break;
}
QgsDebugMsg( QStringLiteral( "row = %1 column =%2" ).arg( row ).arg( column ) );
if ( column == 0 )
{
QLineEdit *toLineEdit = dynamic_cast<QLineEdit *>( tableTransparency->cellWidget( row, 1 ) );
if ( !toLineEdit ) return;
bool toChanged = mTransparencyToEdited.value( row );
QgsDebugMsg( QStringLiteral( "toChanged = %1" ).arg( toChanged ) );
if ( !toChanged )
{
toLineEdit->setText( lineEdit->text() );
}
}
else if ( column == 1 )
{
setTransparencyToEdited( row );
}
}
}
void QgsRasterLayerProperties::aboutToShowStyleMenu()
{
// this should be unified with QgsVectorLayerProperties::aboutToShowStyleMenu()
QMenu *m = qobject_cast<QMenu *>( sender() );
if ( !m )
return;
// first get rid of previously added style manager actions (they are dynamic)
bool gotFirstSeparator = false;
QList<QAction *> actions = m->actions();
for ( int i = 0; i < actions.count(); ++i )
{
if ( actions[i]->isSeparator() )
{
if ( gotFirstSeparator )
{
// remove all actions after second separator (including it)
while ( actions.count() != i )
delete actions.takeAt( i );
break;
}
else
gotFirstSeparator = true;
}
}
// re-add style manager actions!
m->addSeparator();
QgsMapLayerStyleGuiUtils::instance()->addStyleManagerActions( m, mRasterLayer );
}
void QgsRasterLayerProperties::syncToLayer()
{
QgsRasterRenderer *renderer = mRasterLayer->renderer();
if ( renderer )
{
setRendererWidget( renderer->type() );
}
sync();
mRasterLayer->triggerRepaint();
}
void QgsRasterLayerProperties::setTransparencyToEdited( int row )
{
if ( row >= mTransparencyToEdited.size() )
{
mTransparencyToEdited.resize( row + 1 );
}
mTransparencyToEdited[row] = true;
}
void QgsRasterLayerProperties::optionsStackedWidget_CurrentChanged( int index )
{
QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( index );
bool isMetadataPanel = ( index == mOptStackedWidget->indexOf( mOptsPage_Metadata ) );
mBtnStyle->setVisible( ! isMetadataPanel );
mBtnMetadata->setVisible( isMetadataPanel );
if ( !mHistogramWidget )
return;
if ( index == mOptStackedWidget->indexOf( mOptsPage_Histogram ) )
{
mHistogramWidget->setActive( true );
}
else
{
mHistogramWidget->setActive( false );
}
if ( index == mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
//set the metadata contents (which can be expensive)
teMetadataViewer->clear();
teMetadataViewer->setHtml( mRasterLayer->htmlMetadata() );
mMetadataFilled = true;
}
void QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked()
{
int myLineCounter = 0;
bool myImportError = false;
QString myBadLines;
QgsSettings myQSettings;
QString myLastDir = myQSettings.value( QStringLiteral( "lastRasterFileFilterDir" ), QDir::homePath() ).toString();
QString myFileName = QFileDialog::getOpenFileName( this, tr( "Open file" ), myLastDir, tr( "Textfile" ) + " (*.txt)" );
QFile myInputFile( myFileName );
if ( myInputFile.open( QFile::ReadOnly ) )
{
QTextStream myInputStream( &myInputFile );
QString myInputLine;
if ( rasterIsMultiBandColor() )
{
for ( int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
{
tableTransparency->removeRow( myTableRunner );
}
while ( !myInputStream.atEnd() )
{
myLineCounter++;
myInputLine = myInputStream.readLine();
if ( !myInputLine.isEmpty() )
{
if ( !myInputLine.simplified().startsWith( '#' ) )
{
QStringList myTokens = myInputLine.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
if ( myTokens.count() != 4 )
{
myImportError = true;
myBadLines = myBadLines + QString::number( myLineCounter ) + ":\t[" + myInputLine + "]\n";
}
else
{
tableTransparency->insertRow( tableTransparency->rowCount() );
for ( int col = 0; col < 4; col++ )
{
setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
}
}
}
}
}
}
else
{
for ( int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
{
tableTransparency->removeRow( myTableRunner );
}
while ( !myInputStream.atEnd() )
{
myLineCounter++;
myInputLine = myInputStream.readLine();
if ( !myInputLine.isEmpty() )
{
if ( !myInputLine.simplified().startsWith( '#' ) )
{
QStringList myTokens = myInputLine.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
if ( myTokens.count() != 3 && myTokens.count() != 2 ) // 2 for QGIS < 1.9 compatibility
{
myImportError = true;
myBadLines = myBadLines + QString::number( myLineCounter ) + ":\t[" + myInputLine + "]\n";
}
else
{
if ( myTokens.count() == 2 )
{
myTokens.insert( 1, myTokens[0] ); // add 'to' value, QGIS < 1.9 compatibility
}
tableTransparency->insertRow( tableTransparency->rowCount() );
for ( int col = 0; col < 3; col++ )
{
setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
}
}
}
}
}
}
if ( myImportError )
{
QMessageBox::warning( this, tr( "Import Transparent Pixels" ), tr( "The following lines contained errors\n\n%1" ).arg( myBadLines ) );
}
}
else if ( !myFileName.isEmpty() )
{
QMessageBox::warning( this, tr( "Import Transparent Pixels" ), tr( "Read access denied. Adjust the file permissions and try again.\n\n" ) );
}
tableTransparency->resizeColumnsToContents();
tableTransparency->resizeRowsToContents();
}
void QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked()
{
if ( 0 < tableTransparency->rowCount() )
{
tableTransparency->removeRow( tableTransparency->currentRow() );
}
}
void QgsRasterLayerProperties::pixelSelected( const QgsPointXY &canvasPoint, const Qt::MouseButton &btn )
{
Q_UNUSED( btn );
QgsRasterRenderer *renderer = mRendererWidget->renderer();
if ( !renderer )
{
return;
}
//Get the pixel values and add a new entry to the transparency table
if ( mMapCanvas && mPixelSelectorTool )
{
mMapCanvas->unsetMapTool( mPixelSelectorTool.get() );
const QgsMapSettings &ms = mMapCanvas->mapSettings();
QgsPointXY myPoint = ms.mapToLayerCoordinates( mRasterLayer, canvasPoint );
QgsRectangle myExtent = ms.mapToLayerCoordinates( mRasterLayer, mMapCanvas->extent() );
double mapUnitsPerPixel = mMapCanvas->mapUnitsPerPixel();
int myWidth = mMapCanvas->extent().width() / mapUnitsPerPixel;
int myHeight = mMapCanvas->extent().height() / mapUnitsPerPixel;
QMap<int, QVariant> myPixelMap = mRasterLayer->dataProvider()->identify( myPoint, QgsRaster::IdentifyFormatValue, myExtent, myWidth, myHeight ).results();
QList<int> bands = renderer->usesBands();
QList<double> values;
for ( int i = 0; i < bands.size(); ++i )
{
int bandNo = bands.value( i );
if ( myPixelMap.count( bandNo ) == 1 )
{
if ( myPixelMap.value( bandNo ).isNull() )
{
return; // Don't add nodata, transparent anyway
}
double value = myPixelMap.value( bandNo ).toDouble();
QgsDebugMsg( QStringLiteral( "value = %1" ).arg( value, 0, 'g', 17 ) );
values.append( value );
}
}
if ( bands.size() == 1 )
{
// Set 'to'
values.insert( 1, values.value( 0 ) );
}
tableTransparency->insertRow( tableTransparency->rowCount() );
for ( int i = 0; i < values.size(); i++ )
{
setTransparencyCell( tableTransparency->rowCount() - 1, i, values.value( i ) );
}
setTransparencyCell( tableTransparency->rowCount() - 1, tableTransparency->columnCount() - 1, 100 );
}
delete renderer;
tableTransparency->resizeColumnsToContents();
tableTransparency->resizeRowsToContents();
}
void QgsRasterLayerProperties::toggleSaturationControls( int grayscaleMode )
{
// Enable or disable saturation controls based on choice of grayscale mode
if ( grayscaleMode == 0 )
{
sliderSaturation->setEnabled( true );
spinBoxSaturation->setEnabled( true );
}
else
{
sliderSaturation->setEnabled( false );
spinBoxSaturation->setEnabled( false );
}
}
void QgsRasterLayerProperties::toggleColorizeControls( bool colorizeEnabled )
{
// Enable or disable colorize controls based on checkbox
btnColorizeColor->setEnabled( colorizeEnabled );
sliderColorizeStrength->setEnabled( colorizeEnabled );
spinColorizeStrength->setEnabled( colorizeEnabled );
}
QLinearGradient QgsRasterLayerProperties::redGradient()
{
//define a gradient
///@TODO change this to actual polygon dims
QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
return myGradient;
}
QLinearGradient QgsRasterLayerProperties::greenGradient()
{
//define a gradient
///@TODO change this to actual polygon dims
QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
return myGradient;
}
QLinearGradient QgsRasterLayerProperties::blueGradient()
{
//define a gradient
///@TODO change this to actual polygon dims
QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
return myGradient;
}
QLinearGradient QgsRasterLayerProperties::grayGradient()
{
//define a gradient
///@TODO change this to actual polygon dims
QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
return myGradient;
}
QLinearGradient QgsRasterLayerProperties::highlightGradient()
{
//define another gradient for the highlight
///@TODO change this to actual polygon dims
QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
return myGradient;
}
//
//
// Next four methods for saving and restoring qml style state
//
//
void QgsRasterLayerProperties::loadDefaultStyle_clicked()
{
bool defaultLoadedFlag = false;
QString myMessage = mRasterLayer->loadDefaultStyle( defaultLoadedFlag );
//reset if the default style was loaded OK only
if ( defaultLoadedFlag )
{
syncToLayer();
}
else
{
//otherwise let the user know what went wrong
QMessageBox::information( this,
tr( "Default Style" ),
myMessage
);
}
}
void QgsRasterLayerProperties::saveDefaultStyle_clicked()
{
apply(); // make sure the style to save is uptodate
// a flag passed by reference
bool defaultSavedFlag = false;
// after calling this the above flag will be set true for success
// or false if the save operation failed
QString myMessage = mRasterLayer->saveDefaultStyle( defaultSavedFlag );
if ( !defaultSavedFlag )
{
//let the user know what went wrong
QMessageBox::information( this,
tr( "Default Style" ),
myMessage
);
}
}
void QgsRasterLayerProperties::loadStyle_clicked()
{
QgsSettings settings;
QString lastUsedDir = settings.value( QStringLiteral( "style/lastStyleDir" ), QDir::homePath() ).toString();
QString fileName = QFileDialog::getOpenFileName(
this,
tr( "Load layer properties from style file" ),
lastUsedDir,
tr( "QGIS Layer Style File" ) + " (*.qml)" );
if ( fileName.isEmpty() )
return;
// ensure the user never omits the extension from the file name
if ( !fileName.endsWith( QLatin1String( ".qml" ), Qt::CaseInsensitive ) )
fileName += QLatin1String( ".qml" );
mOldStyle = mRasterLayer->styleManager()->style( mRasterLayer->styleManager()->currentStyle() );
bool defaultLoadedFlag = false;
QString message = mRasterLayer->loadNamedStyle( fileName, defaultLoadedFlag );
if ( defaultLoadedFlag )
{
settings.setValue( QStringLiteral( "style/lastStyleDir" ), QFileInfo( fileName ).absolutePath() );
syncToLayer();
}
else
{
QMessageBox::information( this, tr( "Save Style" ), message );
}
}
void QgsRasterLayerProperties::saveStyleAs_clicked()
{
QgsSettings settings;
QString lastUsedDir = settings.value( QStringLiteral( "style/lastStyleDir" ), QDir::homePath() ).toString();
QString outputFileName = QFileDialog::getSaveFileName(
this,
tr( "Save layer properties as style file" ),
lastUsedDir,
tr( "QGIS Layer Style File" ) + " (*.qml)" + ";;" + tr( "Styled Layer Descriptor" ) + " (*.sld)" );
if ( outputFileName.isEmpty() )
return;
// set style type depending on extension
StyleType type = StyleType::QML;
if ( outputFileName.endsWith( QLatin1String( ".sld" ), Qt::CaseInsensitive ) )
type = StyleType::SLD;
else
// ensure the user never omits the extension from the file name
outputFileName = QgsFileUtils::ensureFileNameHasExtension( outputFileName, QStringList() << QStringLiteral( "qml" ) );
apply(); // make sure the style to save is uptodate
// then export style
bool defaultLoadedFlag = false;
QString message;
switch ( type )
{
case QML:
{
message = mRasterLayer->saveNamedStyle( outputFileName, defaultLoadedFlag );
break;
}
case SLD:
{
message = mRasterLayer->saveSldStyle( outputFileName, defaultLoadedFlag );
break;
}
}
if ( defaultLoadedFlag )
{
settings.setValue( QStringLiteral( "style/lastStyleDir" ), QFileInfo( outputFileName ).absolutePath() );
sync();
}
else
QMessageBox::information( this, tr( "Save Style" ), message );
}
void QgsRasterLayerProperties::restoreWindowModality()
{
hide();
setModal( true );
show();
raise();
activateWindow();
}
//
//
// Next four methods for saving and restoring QMD metadata
//
//
void QgsRasterLayerProperties::loadMetadata()
{
QgsSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( QStringLiteral( "style/lastStyleDir" ), QDir::homePath() ).toString();
QString myFileName = QFileDialog::getOpenFileName( this, tr( "Load layer metadata from metadata file" ), myLastUsedDir,
tr( "QGIS Layer Metadata File" ) + " (*.qmd)" );
if ( myFileName.isNull() )
{
return;
}
QString myMessage;
bool defaultLoadedFlag = false;
myMessage = mRasterLayer->loadNamedMetadata( myFileName, defaultLoadedFlag );
//reset if the default style was loaded OK only
if ( defaultLoadedFlag )
{
mMetadataWidget->setMetadata( &mRasterLayer->metadata() );
}
else
{
//let the user know what went wrong
QMessageBox::warning( this, tr( "Load Metadata" ), myMessage );
}
QFileInfo myFI( myFileName );
QString myPath = myFI.path();
myQSettings.setValue( QStringLiteral( "style/lastStyleDir" ), myPath );
activateWindow(); // set focus back to properties dialog
}
void QgsRasterLayerProperties::saveMetadataAs()
{
QgsSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( QStringLiteral( "style/lastStyleDir" ), QDir::homePath() ).toString();
QString myOutputFileName = QFileDialog::getSaveFileName( this, tr( "Save Layer Metadata as QMD" ),
myLastUsedDir, tr( "QMD File" ) + " (*.qmd)" );
if ( myOutputFileName.isNull() ) //dialog canceled
{
return;
}
mMetadataWidget->acceptMetadata();
//ensure the user never omitted the extension from the file name
if ( !myOutputFileName.endsWith( QgsMapLayer::extensionPropertyType( QgsMapLayer::Metadata ), Qt::CaseInsensitive ) )
{
myOutputFileName += QgsMapLayer::extensionPropertyType( QgsMapLayer::Metadata );
}
bool defaultLoadedFlag = false;
QString message = mRasterLayer->saveNamedMetadata( myOutputFileName, defaultLoadedFlag );
if ( defaultLoadedFlag )
myQSettings.setValue( QStringLiteral( "style/lastStyleDir" ), QFileInfo( myOutputFileName ).absolutePath() );
else
QMessageBox::information( this, tr( "Save Metadata" ), message );
}
void QgsRasterLayerProperties::saveDefaultMetadata()
{
mMetadataWidget->acceptMetadata();
bool defaultSavedFlag = false;
QString errorMsg = mRasterLayer->saveDefaultMetadata( defaultSavedFlag );
if ( !defaultSavedFlag )
{
QMessageBox::warning( this, tr( "Default Metadata" ), errorMsg );
}
}
void QgsRasterLayerProperties::loadDefaultMetadata()
{
bool defaultLoadedFlag = false;
QString myMessage = mRasterLayer->loadNamedMetadata( mRasterLayer->metadataUri(), defaultLoadedFlag );
//reset if the default metadata was loaded OK only
if ( defaultLoadedFlag )
{
mMetadataWidget->setMetadata( &mRasterLayer->metadata() );
}
else
{
QMessageBox::information( this, tr( "Default Metadata" ), myMessage );
}
}
void QgsRasterLayerProperties::toggleBuildPyramidsButton()
{
if ( lbxPyramidResolutions->selectedItems().empty() )
{
buttonBuildPyramids->setEnabled( false );
}
else
{
buttonBuildPyramids->setEnabled( true );
}
}
void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
{
mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
mSliderBrightness->setValue( 0 );
mSliderContrast->setValue( 0 );
sliderSaturation->setValue( 0 );
comboGrayscale->setCurrentIndex( ( int ) QgsHueSaturationFilter::GrayscaleOff );
mColorizeCheck->setChecked( false );
sliderColorizeStrength->setValue( 100 );
}
bool QgsRasterLayerProperties::rasterIsMultiBandColor()
{
return mRasterLayer && nullptr != dynamic_cast<QgsMultiBandColorRenderer *>( mRasterLayer->renderer() );
}
void QgsRasterLayerProperties::onCancel()
{
if ( mOldStyle.xmlData() != mRasterLayer->styleManager()->style( mRasterLayer->styleManager()->currentStyle() ).xmlData() )
{
// need to reset style to previous - style applied directly to the layer (not in apply())
QString myMessage;
QDomDocument doc( QStringLiteral( "qgis" ) );
int errorLine, errorColumn;
doc.setContent( mOldStyle.xmlData(), false, &myMessage, &errorLine, &errorColumn );
mRasterLayer->importNamedStyle( doc, myMessage );
syncToLayer();
}
}
void QgsRasterLayerProperties::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "working_with_raster/raster_properties.html" ) );
}
| 37.945736 | 221 | 0.694165 | [
"geometry"
] |
50325e2f210547ac3301dea5c53faba9a6fea368 | 14,773 | cpp | C++ | Utility/Streams/WinAPI/FileSystemMonitor_WinAPI.cpp | pocketgems/XLE2 | 82771e9ab1fc3b12927f1687bbe05d4f7dce8765 | [
"MIT"
] | 3 | 2018-05-17T08:39:39.000Z | 2020-12-09T13:20:26.000Z | Utility/Streams/WinAPI/FileSystemMonitor_WinAPI.cpp | pocketgems/XLE2 | 82771e9ab1fc3b12927f1687bbe05d4f7dce8765 | [
"MIT"
] | null | null | null | Utility/Streams/WinAPI/FileSystemMonitor_WinAPI.cpp | pocketgems/XLE2 | 82771e9ab1fc3b12927f1687bbe05d4f7dce8765 | [
"MIT"
] | 1 | 2021-11-14T08:50:15.000Z | 2021-11-14T08:50:15.000Z | // Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
#include "../PathUtils.h"
#include "../../../Core/Prefix.h"
#include "../FileSystemMonitor.h"
#include "../../../Core/Types.h"
#include "../../../Core/WinAPI/IncludeWindows.h"
#include "../../Threading/Mutex.h"
#include "../../Threading/ThreadObject.h"
#include "../../Threading/LockFree.h"
#include "../../MemoryUtils.h"
#include "../../UTFUtils.h"
#include "../../IteratorUtils.h"
#include "../../Conversion.h"
#include <vector>
#include <memory>
#include <cctype>
// Character set note -- we're using utf16 characters in this file. We're going to
// assume that Windows is working with utf16 as well (as opposed to ucs2). This windows documentation
// suggest that it is expecting utf16 behaviour... But maybe there seems to be a lack of clarity as
// to how complete that support is.
namespace Utility
{
class MonitoredDirectory
{
public:
MonitoredDirectory(const std::basic_string<utf16>& directoryName);
~MonitoredDirectory();
static uint64 HashFilename(StringSection<utf16> filename);
static uint64 HashFilename(StringSection<utf8> filename);
void AttachCallback(uint64 filenameHash, std::shared_ptr<OnChangeCallback> callback);
void OnTriggered();
void BeginMonitoring();
XlHandle GetEventHandle() { return _overlapped.hEvent; }
const OVERLAPPED* GetOverlappedPtr() const { return &_overlapped; }
unsigned GetCreationOrderId() const { return _monitoringUpdateId; }
void OnChange(StringSection<utf16> filename);
private:
std::vector<std::pair<uint64, std::weak_ptr<OnChangeCallback>>> _callbacks;
Threading::Mutex _callbacksLock;
XlHandle _directoryHandle;
uint8 _resultBuffer[1024];
DWORD _bytesReturned;
OVERLAPPED _overlapped;
std::basic_string<utf16> _directoryName;
unsigned _monitoringUpdateId;
static void CALLBACK CompletionRoutine(
DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped);
};
static Utility::Threading::Mutex MonitoredDirectoriesLock;
static std::vector<std::pair<uint64, std::unique_ptr<MonitoredDirectory>>> MonitoredDirectories;
static unsigned CreationOrderId_Foreground = 0;
static unsigned CreationOrderId_Background = 0;
static XlHandle RestartMonitoringEvent = INVALID_HANDLE_VALUE;
static std::unique_ptr<Utility::Threading::Thread> MonitoringThread;
static Utility::Threading::Mutex MonitoringThreadLock;
static bool MonitoringQuit = false;
MonitoredDirectory::MonitoredDirectory(const std::basic_string<utf16>& directoryName)
: _directoryName(directoryName)
{
_overlapped.Internal = _overlapped.InternalHigh = 0;
_overlapped.Offset = _overlapped.OffsetHigh = 0;
_overlapped.hEvent = INVALID_HANDLE_VALUE; // XlCreateEvent(false);
_directoryHandle = INVALID_HANDLE_VALUE;
_bytesReturned = 0;
_monitoringUpdateId = CreationOrderId_Foreground;
XlSetMemory(_resultBuffer, dimof(_resultBuffer), 0);
}
MonitoredDirectory::~MonitoredDirectory()
{
if (_directoryHandle != INVALID_HANDLE_VALUE) {
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
CancelIoEx(_directoryHandle, &_overlapped);
#endif
CloseHandle(_directoryHandle);
}
CloseHandle(_overlapped.hEvent);
}
uint64 MonitoredDirectory::HashFilename(StringSection<utf16> filename)
{
return Utility::HashFilename(filename);
}
uint64 MonitoredDirectory::HashFilename(StringSection<utf8> filename)
{
return Utility::HashFilename(filename);
}
void MonitoredDirectory::AttachCallback(
uint64 filenameHash,
std::shared_ptr<OnChangeCallback> callback)
{
ScopedLock(_callbacksLock);
_callbacks.insert(
LowerBound(_callbacks, filenameHash),
std::make_pair(filenameHash, std::move(callback)));
}
void MonitoredDirectory::OnTriggered()
{
FILE_NOTIFY_INFORMATION* notifyInformation =
(FILE_NOTIFY_INFORMATION*)_resultBuffer;
for (;;) {
// Most editors just change the last write date when a file changes
// But some (like Visual Studio) will actually rename and replace the
// file (for error safety). To catch these cases, we need to look for
// file renames (also creation/deletion events would be useful)
if ( notifyInformation->Action == FILE_ACTION_MODIFIED
|| notifyInformation->Action == FILE_ACTION_ADDED
|| notifyInformation->Action == FILE_ACTION_REMOVED
|| notifyInformation->Action == FILE_ACTION_RENAMED_OLD_NAME
|| notifyInformation->Action == FILE_ACTION_RENAMED_NEW_NAME) {
OnChange(StringSection<utf16>((const utf16*)notifyInformation->FileName, (const utf16*)PtrAdd(notifyInformation->FileName, notifyInformation->FileNameLength)));
}
if (!notifyInformation->NextEntryOffset) {
break;
}
notifyInformation = PtrAdd(notifyInformation, notifyInformation->NextEntryOffset);
}
// Restart searching
_bytesReturned = 0;
XlSetMemory(_resultBuffer, dimof(_resultBuffer), 0);
BeginMonitoring();
}
void MonitoredDirectory::OnChange(StringSection<utf16> filename)
{
auto hash = MonitoredDirectory::HashFilename(filename);
ScopedLock(_callbacksLock);
#if 0 //(STL_ACTIVE == STL_MSVC) && (_ITERATOR_DEBUG_LEVEL >= 2)
auto range = std::_Equal_range(
_callbacks.begin(), _callbacks.end(), hash,
CompareFirst<uint64, std::weak_ptr<OnChangeCallback>>(),
_Dist_type(_callbacks.begin()));
#else
auto range = std::equal_range(
_callbacks.begin(), _callbacks.end(),
hash, CompareFirst<uint64, std::weak_ptr<OnChangeCallback>>());
#endif
bool foundExpired = false;
for (auto i2=range.first; i2!=range.second; ++i2) {
// todo -- what happens if OnChange() results in a change to _callbacks?
auto l = i2->second.lock();
if (l) l->OnChange();
else foundExpired = true;
}
if (foundExpired) {
// Remove any pointers that have expired
// (note that we only check matching pointers. Non-matching pointers
// that have expired are untouched)
_callbacks.erase(
std::remove_if(range.first, range.second,
[](std::pair<uint64, std::weak_ptr<OnChangeCallback>>& i)
{ return i.second.expired(); }),
range.second);
}
}
void CALLBACK MonitoredDirectory::CompletionRoutine(
DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped )
{
// when a completion routine triggers, we need to look for the directory
// monitor that matches the overlapped ptr
if (dwErrorCode == ERROR_SUCCESS) {
ScopedLock(MonitoredDirectoriesLock);
for (auto i=MonitoredDirectories.begin(); i!=MonitoredDirectories.end(); ++i) {
if (i->second->GetOverlappedPtr() == lpOverlapped) {
i->second->OnTriggered();
}
}
}
}
void MonitoredDirectory::BeginMonitoring()
{
if (_directoryHandle == INVALID_HANDLE_VALUE) {
_directoryHandle = CreateFileW(
(LPCWSTR)_directoryName.c_str(), FILE_LIST_DIRECTORY,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_OVERLAPPED, nullptr);
}
auto hresult = ReadDirectoryChangesW(
_directoryHandle, _resultBuffer, sizeof(_resultBuffer),
FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_FILE_NAME,
/*&_bytesReturned*/nullptr, &_overlapped, &CompletionRoutine);
/*assert(hresult);*/ (void)hresult;
}
unsigned int xl_thread_call MonitoringEntryPoint(void*)
{
while (!MonitoringQuit) {
{
ScopedLock(MonitoredDirectoriesLock);
auto newId = CreationOrderId_Background;
for (auto i=MonitoredDirectories.begin(); i!=MonitoredDirectories.end(); ++i) {
auto updateId = i->second->GetCreationOrderId();
if (updateId > CreationOrderId_Background) {
i->second->BeginMonitoring();
newId = std::max(newId, updateId);
}
}
CreationOrderId_Background = newId;
}
XlWaitForMultipleSyncObjects(
1, &RestartMonitoringEvent,
false, XL_INFINITE, true);
}
return 0;
}
static void RestartMonitoring()
{
ScopedLock(MonitoringThreadLock);
if (!MonitoringThread) {
RestartMonitoringEvent = XlCreateEvent(false);
MonitoringThread = std::make_unique<Utility::Threading::Thread>(MonitoringEntryPoint, nullptr);
}
XlSetEvent(RestartMonitoringEvent);
}
void TerminateFileSystemMonitoring()
{
{
ScopedLock(MonitoringThreadLock);
if (MonitoringThread) {
MonitoringQuit = true;
XlSetEvent(RestartMonitoringEvent);
MonitoringThread->join();
MonitoringThread.reset();
}
}
{
ScopedLock(MonitoredDirectoriesLock);
MonitoredDirectories.clear();
}
}
/*static void CheckExists(const utf16* dirName)
{
#if defined(_DEBUG)
{
// verify that it exists
auto handle = CreateFileW(
(LPCWSTR)dirName, FILE_LIST_DIRECTORY,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_OVERLAPPED, nullptr);
assert(handle != INVALID_HANDLE_VALUE);
CloseHandle(handle);
}
#endif
}*/
void AttachFileSystemMonitor(
StringSection<utf16> directoryName,
StringSection<utf16> filename,
std::shared_ptr<OnChangeCallback> callback)
{
ScopedLock(MonitoredDirectoriesLock);
if (directoryName.IsEmpty())
directoryName = StringSection<utf16>(u"./");
auto hash = MonitoredDirectory::HashFilename(directoryName);
auto i = std::lower_bound(
MonitoredDirectories.cbegin(), MonitoredDirectories.cend(),
hash, CompareFirst<uint64, std::unique_ptr<MonitoredDirectory>>());
if (i != MonitoredDirectories.cend() && i->first == hash) {
i->second->AttachCallback(MonitoredDirectory::HashFilename(filename), std::move(callback));
return;
}
// we must have a null terminated string -- so use a temp buffer
auto dirNameCopy = directoryName.AsString();
// CheckExists(dirNameCopy.c_str());
++CreationOrderId_Foreground;
auto i2 = MonitoredDirectories.insert(
i, std::make_pair(hash, std::make_unique<MonitoredDirectory>(dirNameCopy)));
i2->second->AttachCallback(MonitoredDirectory::HashFilename(filename), std::move(callback));
// we need to trigger the background thread so that it begins the the ReadDirectoryChangesW operation
// (that operation must begin and be handled in the same thread when using completion routines)
RestartMonitoring();
}
void AttachFileSystemMonitor(
StringSection<utf8> directoryName,
StringSection<utf8> filename,
std::shared_ptr<OnChangeCallback> callback)
{
ScopedLock(MonitoredDirectoriesLock);
if (directoryName.IsEmpty())
directoryName = StringSection<utf8>(u("./"));
auto hash = MonitoredDirectory::HashFilename(directoryName);
auto i = std::lower_bound(
MonitoredDirectories.cbegin(), MonitoredDirectories.cend(),
hash, CompareFirst<uint64, std::unique_ptr<MonitoredDirectory>>());
if (i != MonitoredDirectories.cend() && i->first == hash) {
i->second->AttachCallback(MonitoredDirectory::HashFilename(filename), std::move(callback));
return;
}
// we must have a null terminated string -- so use a temp buffer
auto dirNameCopy = Conversion::Convert<std::basic_string<utf16>>(directoryName.AsString());
// CheckExists(dirNameCopy.c_str());
++CreationOrderId_Foreground;
auto i2 = MonitoredDirectories.insert(
i, std::make_pair(hash, std::make_unique<MonitoredDirectory>(dirNameCopy)));
i2->second->AttachCallback(MonitoredDirectory::HashFilename(filename), std::move(callback));
// we need to trigger the background thread so that it begins the the ReadDirectoryChangesW operation
// (that operation must begin and be handled in the same thread when using completion routines)
RestartMonitoring();
}
void FakeFileChange(StringSection<utf16> directoryName, StringSection<utf16> filename)
{
ScopedLock(MonitoredDirectoriesLock);
auto hash = MonitoredDirectory::HashFilename(directoryName);
auto i = std::lower_bound(
MonitoredDirectories.cbegin(), MonitoredDirectories.cend(),
hash, CompareFirst<uint64, std::unique_ptr<MonitoredDirectory>>());
if (i != MonitoredDirectories.cend() && i->first == hash) {
i->second->OnChange(filename);
}
}
void FakeFileChange(StringSection<utf8> directoryName, StringSection<utf8> filename)
{
ScopedLock(MonitoredDirectoriesLock);
auto hash = MonitoredDirectory::HashFilename(directoryName);
auto i = std::lower_bound(
MonitoredDirectories.cbegin(), MonitoredDirectories.cend(),
hash, CompareFirst<uint64, std::unique_ptr<MonitoredDirectory>>());
if (i != MonitoredDirectories.cend() && i->first == hash) {
auto u16name = Conversion::Convert<std::basic_string<utf16>>(filename);
i->second->OnChange(MakeStringSection(u16name));
}
}
OnChangeCallback::~OnChangeCallback() {}
}
| 39.5 | 176 | 0.637514 | [
"vector"
] |
50398c77b4987a0213e48b9a5212827f59763998 | 1,459 | cpp | C++ | src/LightBulb/Learning/Supervised/GradientCalculation/AbstractGradientCalculation.cpp | domin1101/ANNHelper | 50acb5746d6dad6777532e4c7da4983a7683efe0 | [
"Zlib"
] | 5 | 2016-02-04T06:14:42.000Z | 2017-02-06T02:21:43.000Z | src/LightBulb/Learning/Supervised/GradientCalculation/AbstractGradientCalculation.cpp | domin1101/ANNHelper | 50acb5746d6dad6777532e4c7da4983a7683efe0 | [
"Zlib"
] | 41 | 2015-04-15T21:05:45.000Z | 2015-07-09T12:59:02.000Z | src/LightBulb/Learning/Supervised/GradientCalculation/AbstractGradientCalculation.cpp | domin1101/LightBulb | 50acb5746d6dad6777532e4c7da4983a7683efe0 | [
"Zlib"
] | null | null | null | // Includes
#include "LightBulb/Learning/Supervised/GradientCalculation/AbstractGradientCalculation.hpp"
#include "LightBulb/NetworkTopology/AbstractNetworkTopology.hpp"
namespace LightBulb
{
void AbstractGradientCalculation::calcGradient(const AbstractNetworkTopology& networkTopology, const Vector<>& errorVector, const Vector<>* alternativeActivation)
{
gradientToUse = &gradient;
calcGradient(networkTopology, networkTopology.getAllNetInputs(), networkTopology.getAllActivations(), errorVector, alternativeActivation);
}
void AbstractGradientCalculation::calcGradient(const AbstractNetworkTopology& networkTopology, const Vector<>& errorVector, std::vector<Matrix<>>& gradient, const Vector<>* alternativeActivation)
{
gradientToUse = &gradient;
calcGradient(networkTopology, networkTopology.getAllNetInputs(), networkTopology.getAllActivations(), errorVector, alternativeActivation);
}
void AbstractGradientCalculation::initGradient(const AbstractNetworkTopology& networkTopology)
{
if (gradient.empty()) {
gradient = networkTopology.getAllWeights();
}
// Adjust all hidden/output layers except
for (int l = 0; l < gradient.size(); l++)
{
if (isCalculatorType(CT_GPU))
gradient[l].getViennaclValueForEditing().clear();
else
gradient[l].getEigenValueForEditing().setZero();
}
gradientToUse = &gradient;
}
std::vector<Matrix<>>& AbstractGradientCalculation::getGradient()
{
return gradient;
}
}
| 33.930233 | 196 | 0.781357 | [
"vector"
] |
503bc139ec265b7f3988bd59048096727b659326 | 2,758 | hpp | C++ | include/train.hpp | kamakshijain/HUMAN-DETECTION | ac129520df2a4df6490b771dca3a76e0489b8ade | [
"MIT"
] | null | null | null | include/train.hpp | kamakshijain/HUMAN-DETECTION | ac129520df2a4df6490b771dca3a76e0489b8ade | [
"MIT"
] | 1 | 2019-10-21T08:06:00.000Z | 2019-10-21T08:06:17.000Z | include/train.hpp | sbrahma0/HUMAN-DETECTION | ac129520df2a4df6490b771dca3a76e0489b8ade | [
"MIT"
] | 2 | 2019-10-21T17:58:36.000Z | 2019-12-09T18:09:10.000Z | /**
* MIT License
*
* Copyright (c) 2019 Sayan Brahma, Kamakshi Jain
*
* 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.
*/
/**
* @author kamakshi jain, Sayan Brahma
* @file train.hpp
* @copyright [2019] kamakshi jain, Sayan Brahma
* @brief This is the stub for the Train class
*/
#ifndef INCLUDE_TRAIN_HPP_
#define INCLUDE_TRAIN_HPP_
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
/*
* @brief Train is a class
*/
class Train {
/**
* @brief Public methods and constructors declaration
*/
public:
cv::Ptr<cv::ml::SVM> classifier;
std::vector<int> labels;
/**
* @brief Constructor for the class Train
*/
Train();
/**
* @brief This function gives the support vectors of the classifier
* @return a float type vector
*/
std::vector<float> getClassifier();
/**
* @brief This function is for extracting the HOG features from an image
* @param The window size for HOG feature extractor
* @param The image whose HOG features are to be extracted
*/
void getHOGfeatures(const cv::Size, const std::vector<cv::Mat> &);
/**
* @brief This function trains the SVM classifier from the HOG features
* @param If we want to save the classifier after training
* @param name of the classifier ,if to be saved
*/
void trainSVM(const bool, const cv::String);
/**
* @brief Destructor of the Train class
*/
~Train();
const std::vector<cv::Mat>& getGradientList() const {
return gradientList;
}
void setGradientList(const std::vector<cv::Mat> &gradientLis) {
gradientList = gradientLis;
}
private:
std::vector<cv::Mat> gradientList;
};
#endif // INCLUDE_TRAIN_HPP_
| 31.701149 | 81 | 0.696882 | [
"vector"
] |
50448a720a2b90259d6867a8249c2efbe86c0cfa | 74,338 | cpp | C++ | mu/llvmc/parser.cpp | clemahieu/mu | c02eec77d1c72c86b8acbea0f3b6e85fe32d4687 | [
"BSD-2-Clause"
] | 9 | 2017-07-31T03:10:54.000Z | 2022-01-31T18:03:10.000Z | mu/llvmc/parser.cpp | clemahieu/mu | c02eec77d1c72c86b8acbea0f3b6e85fe32d4687 | [
"BSD-2-Clause"
] | null | null | null | mu/llvmc/parser.cpp | clemahieu/mu | c02eec77d1c72c86b8acbea0f3b6e85fe32d4687 | [
"BSD-2-Clause"
] | 3 | 2016-07-08T15:24:22.000Z | 2021-05-15T09:12:17.000Z | #include <mu/llvmc/parser.hpp>
#include <mu/core/error_string.hpp>
#include <mu/core/stream.hpp>
#include <mu/core/tokens.hpp>
#include <mu/llvmc/ast.hpp>
#include <mu/core/stream_token.hpp>
#include <mu/llvmc/skeleton.hpp>
#include <mu/llvmc/parser_t.hpp>
#include <llvm/IR/Type.h>
#include <sstream>
mu::llvmc::global::global (mu::llvmc::keywords * keywords_a) :
keywords (keywords_a)
{
}
mu::llvmc::parser::parser (mu::io::stream_token & stream_a):
current_template (nullptr),
builtins (&keywords),
current_mapping (&builtins),
stream (stream_a),
function_overload_hook (function)
{
bool error (false);
error = builtins.insert (U"~", new mu::llvmc::ast::value (new mu::llvmc::skeleton::identity, current_template));
assert (!error);
auto constant_int (new mu::llvmc::ast::constant_int);
error = builtins.insert (U"int-c", constant_int);
assert (!error);
error = keywords.insert (U"`", &namespace_hook);
assert (!error);
error = keywords.insert (U"#", &number);
assert (!error);
error = keywords.insert (U"!", &sequence_hook);
assert (!error);
error = keywords.insert (U"farray", &array_type);
assert (!error);
error = keywords.insert (U"ascii", &ascii_hook);
assert (!error);
error = keywords.insert (U"asm", &asm_hook);
assert (!error);
error = keywords.insert (U"carray", &constant_array);
assert (!error);
error = keywords.insert (U"entrypoint", &entry_hook);
assert (!error);
error = keywords.insert (U"global", &global_variable);
assert (!error);
error = keywords.insert (U"function", &function);
assert (!error);
error = keywords.insert (U"ofunction", &function_overload_hook);
assert (!error);
error = keywords.insert (U"int-t", &int_type);
assert (!error);
error = keywords.insert (U"join", &join_hook);
assert (!error);
error = keywords.insert (U"loop", &loop_hook);
assert (!error);
error = keywords.insert (U"let", &let_hook);
assert (!error);
error = keywords.insert (U"module", &module_hook);
assert (!error);
error = keywords.insert (U"null", &constant_pointer_null);
assert (!error);
error = keywords.insert (U"ptr", &ptr_type);
assert (!error);
error = keywords.insert (U"set", &set_hook);
assert (!error);
error = keywords.insert (U"utf32", &string_hook);
assert (!error);
error = keywords.insert (U"struct", &struct_hook);
assert (!error);
error = keywords.insert (U"template", &template_hook);
assert (!error);
error = keywords.insert (U"undefined", &undefined_hook);
assert (!error);
auto bit_size (new mu::llvmc::ast::number (U"1"));
auto bit_type (new mu::llvmc::ast::integer_type);
bit_type->bits = bit_size;
error = builtins.insert (U"false", new mu::llvmc::ast::expression ({constant_int, bit_type, new mu::llvmc::ast::number (U"0")}, {}));
assert (!error);
error = builtins.insert (U"true", new mu::llvmc::ast::expression ({constant_int, bit_type, new mu::llvmc::ast::number (U"1")}, {}));
assert (!error);
error = builtins.insert (U"unit_v", new mu::llvmc::ast::unit (current_template));
assert (!error);
error = builtins.insert (U"add", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::add), current_template));
assert (!error);
error = builtins.insert (U"alloca", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::alloca), current_template));
assert (!error);
error = builtins.insert (U"and", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::and_i), current_template));
assert (!error);
error = builtins.insert (U"ashr", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::ashr), current_template));
assert (!error);
error = builtins.insert (U"atomicrmw", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::atomicrmw), current_template));
assert (!error);
error = builtins.insert (U"bitcast", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::bitcast), current_template));
assert (!error);
error = builtins.insert (U"call", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::call), current_template));
assert (!error);
error = builtins.insert (U"cmpxchg", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::cmpxchg), current_template));
assert (!error);
error = builtins.insert (U"extractelement", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::extractelement), current_template));
assert (!error);
error = builtins.insert (U"extractvalue", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::extractvalue), current_template));
assert (!error);
error = builtins.insert (U"fadd", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fadd), current_template));
assert (!error);
error = builtins.insert (U"fcmp", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fcmp), current_template));
assert (!error);
error = builtins.insert (U"fdiv", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fdiv), current_template));
assert (!error);
error = builtins.insert (U"fence", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fence), current_template));
assert (!error);
error = builtins.insert (U"fmul", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fmul), current_template));
assert (!error);
error = builtins.insert (U"fpext", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fpext), current_template));
assert (!error);
error = builtins.insert (U"fptoi", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fptoi), current_template));
assert (!error);
error = builtins.insert (U"fptosi", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fptosi), current_template));
assert (!error);
error = builtins.insert (U"fptoui", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fptoui), current_template));
assert (!error);
error = builtins.insert (U"fptrunc", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fptrunc), current_template));
assert (!error);
error = builtins.insert (U"frem", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::frem), current_template));
assert (!error);
error = builtins.insert (U"fsub", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::fsub), current_template));
assert (!error);
error = builtins.insert (U"getelementptr", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::getelementptr), current_template));
assert (!error);
error = builtins.insert (U"icmp", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::icmp), current_template));
assert (!error);
error = builtins.insert (U"ieq", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_eq), current_template));
assert (!error);
error = builtins.insert (U"ine", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_ne), current_template));
assert (!error);
error = builtins.insert (U"iugt", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_ugt), current_template));
assert (!error);
error = builtins.insert (U"iuge", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_uge), current_template));
assert (!error);
error = builtins.insert (U"iult", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_ult), current_template));
assert (!error);
error = builtins.insert (U"iule", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_ule), current_template));
assert (!error);
error = builtins.insert (U"isgt", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_sgt), current_template));
assert (!error);
error = builtins.insert (U"isge", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_sge), current_template));
assert (!error);
error = builtins.insert (U"islt", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_slt), current_template));
assert (!error);
error = builtins.insert (U"isle", new mu::llvmc::ast::value (new mu::llvmc::skeleton::predicate (mu::llvmc::predicates::icmp_sle), current_template));
assert (!error);
error = builtins.insert (U"if", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::if_i), current_template));
assert (!error);
error = builtins.insert (U"insertelement", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::insertelement), current_template));
assert (!error);
error = builtins.insert (U"insertvalue", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::insertvalue), current_template));
assert (!error);
error = builtins.insert (U"load", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::load), current_template));
assert (!error);
error = builtins.insert (U"lshr", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::lshr), current_template));
assert (!error);
error = builtins.insert (U"mul", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::mul), current_template));
assert (!error);
error = builtins.insert (U"or", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::or_i), current_template));
assert (!error);
error = builtins.insert (U"ptrfromint", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::inttoptr), current_template));
assert (!error);
error = builtins.insert (U"ptrtoint", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::ptrtoint), current_template));
assert (!error);
error = builtins.insert (U"sdiv", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::sdiv), current_template));
assert (!error);
error = builtins.insert (U"select", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::select), current_template));
assert (!error);
error = builtins.insert (U"sext", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::sext), current_template));
assert (!error);
error = builtins.insert (U"shl", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::shl), current_template));
assert (!error);
error = builtins.insert (U"shufflevector", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::shufflevector), current_template));
assert (!error);
error = builtins.insert (U"sitofp", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::sitofp), current_template));
assert (!error);
error = builtins.insert (U"srem", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::srem), current_template));
assert (!error);
error = builtins.insert (U"store", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::store), current_template));
assert (!error);
error = builtins.insert (U"sub", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::sub), current_template));
assert (!error);
error = builtins.insert (U"switch", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::switch_i), current_template));
assert (!error);
error = builtins.insert (U"trunc", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::trunc), current_template));
assert (!error);
error = builtins.insert (U"typeof", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::typeof_i), current_template));
assert (!error);
error = builtins.insert (U"udiv", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::udiv), current_template));
assert (!error);
error = builtins.insert (U"uitofp", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::uitofp), current_template));
assert (!error);
error = builtins.insert (U"urem", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::urem), current_template));
assert (!error);
error = builtins.insert (U"unit", new mu::llvmc::ast::value (new mu::llvmc::skeleton::unit_type, current_template));
assert (!error);
error = builtins.insert (U"xor", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::xor_i), current_template));
assert (!error);
error = builtins.insert (U"zext", new mu::llvmc::ast::value (new mu::llvmc::skeleton::marker (mu::llvmc::instruction_type::zext), current_template));
assert (!error);
}
mu::llvmc::node_result mu::llvmc::module_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::module module (region_a, parser_a);
module.parse ();
return module.result;
}
void mu::llvmc::module::parse ()
{
result.error = parser.parse_left_square_required (U"Module expecting left square", mu::core::error_type::expecting_left_square);
if (result.error == nullptr)
{
parse_internal ();
if (result.error == nullptr)
{/*
auto next (parser_a.peek ());
assert (next.ast == nullptr);
assert (next.error == nullptr);
auto token (next.token);
switch (token->id ())
{
case mu::io::token_id::right_square:
break;
default:
result.error = new mu::core::error_string (U"Expecting right square after module", mu::core::error_type::expecting_right_square, token->region);
break;
}*/
}
}
}
void mu::llvmc::module::parse_internal ()
{
auto module (new mu::llvmc::ast::module (parser.current_template));
module->region.first = mu::core::position (0, 1, 1);
while ((result.node == nullptr) and (result.error == nullptr))
{
auto item (parser.peek ());
if (item.ast != nullptr)
{
module->globals.push_back (item.ast);
}
else if (item.token != nullptr)
{
auto id (item.token->id ());
switch (id)
{
case mu::io::token_id::end:
case mu::io::token_id::right_square:
module->region.last = item.token->region.last;
result.node = module;
break;
default:
result.error = new mu::core::error_string (U"Expecting function or end of stream", mu::core::error_type::expecting_function_or_end_of_stream, item.token->region);
break;
}
}
else
{
result.error = item.error;
}
}
if (result.error == nullptr)
{
for (auto i: block.mappings)
{
if (i.second != nullptr)
{
module->names [i.first] = i.second;
}
else
{
// Name reserved by sub-blocks
}
}
if (!block.unresolved.empty ())
{
std::stringstream error;
error << "Unresoled symbols:";
for (auto i: block.unresolved)
{
error << " " << std::string (i.first.begin (), i.first.end ());
}
std::string err (error.str ());
result.error = new mu::core::error_string (mu::string (err.begin (), err.end ()).c_str (), mu::core::error_type::unresolved_symbols, std::get <0> (block.unresolved.begin ()->second));
result.node = nullptr;
}
}
}
mu::llvmc::node_result mu::llvmc::function_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::function parser_l (region_a, parser_a);
parser_l.parse ();
return parser_l.result;
}
mu::llvmc::function::function (mu::core::region const & region_a, mu::llvmc::parser & parser_a):
block (parser_a.current_mapping),
result ({nullptr, nullptr}),
function_m (new mu::llvmc::ast::function (parser_a.current_template)),
parser (parser_a),
first (region_a)
{
parser_a.current_mapping = █
}
mu::llvmc::function::~function ()
{
assert (parser.current_mapping == &block);
parser.current_mapping = block.parent;
}
void mu::llvmc::function::parse ()
{
function_m->region.first = first.first;
parse_parameters ();
if (result.error == nullptr)
{
parse_body ();
if (result.error == nullptr)
{
parse_results ();
if (result.error == nullptr)
{
result.node = function_m;
}
}
}
}
void mu::llvmc::function::parse_parameters ()
{
auto next (parser.stream [0]);
switch (next->id ())
{
case mu::io::token_id::left_square:
{
parser.stream.consume (1);
auto done (false);
while (result.error == nullptr && !done)
{
parse_parameter (done);
}
break;
}
default:
result.error = new mu::core::error_string (U"While parsing parameters, expecting left square", mu::core::error_type::parsing_parameters_expecting_left_square);
break;
}
}
void mu::llvmc::function::parse_parameter (bool & done_a)
{
auto argument (new mu::llvmc::ast::parameter (parser.current_template));
result.error = parser.parse_ast_or_refer_or_right_square (
[argument]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
argument->type = node_a;
argument->region.first = region_a.first;
},
[&]
(mu::io::right_square * right_square_a)
{
done_a = true;
},
U"Expecting type or right square", mu::core::error_type::expecting_type_or_right_square);
if (result.error == nullptr && !done_a)
{
function_m->parameters.push_back (argument);
result.error = parser.parse_identifier (
[&]
(mu::io::identifier * identifier_a)
{
mu::core::error * result (nullptr);
argument->name = identifier_a->string;
argument->region.last = identifier_a->region.last;
if (block.insert (identifier_a->string, argument))
{
result = new mu::core::error_string (U"Unable to use identifier", mu::core::error_type::unable_to_use_identifier, identifier_a->region);
}
return result;
}, U"While parsing parameters, expecting an identifier", mu::core::error_type::parsing_parameters_expecting_identifier);
}
}
void mu::llvmc::function::parse_body ()
{
result.error = parser.parse_left_square_required (U"Expecting left square", mu::core::error_type::expecting_left_square);
if (result.error == nullptr)
{
auto done (false);
while (!done && result.error == nullptr)
{
switch (parser.stream [0]->id ())
{
case mu::io::token_id::right_square:
parser.stream.consume (1);
done = true;
break;
default:
{
auto next (parser.peek ());
if (next.ast != nullptr)
{
function_m->roots.push_back (next.ast);
}
else if (next.token != nullptr)
{
result.error = new mu::core::error_string (U"Expecting expression", mu::core::error_type::expecting_expression, next.token->region);
}
else
{
result.error = next.error;
}
break;
}
}
}
}
}
void mu::llvmc::function::parse_results ()
{
result.error = parser.parse_left_square_required (U"Expecting left square", mu::core::error_type::expecting_left_square);
if (result.error == nullptr)
{
auto next (parser.stream [0]);
auto done (false);
while (result.error == nullptr && !done)
{
switch (next->id ())
{
case mu::io::token_id::left_square:
parser.stream.consume (1);
parse_result_set ();
next = parser.stream [0];
break;
case mu::io::token_id::right_square:
parser.stream.consume (1);
function_m->region = mu::core::region (first.first, next->region.last);
done = true;
break;
default:
result.error = new mu::core::error_string (U"Expecting left square or right square", mu::core::error_type::expecting_left_square_or_right_square, next->region);
break;
}
}
}
}
void mu::llvmc::function::parse_result_set ()
{
auto done (false);
auto predicates (false);
auto function_l (function_m);
auto branch_position (function_m->results.branches.size ());
assert (function_m->returns.size () == branch_position);
auto & value_branch (function_m->results.add_branch ());
function_m->returns.push_back (decltype (function_m->returns)::value_type ());
auto & type_branch (function_m->returns.back ());
while (result.error == nullptr && !done && !predicates)
{
assert (value_branch.nodes.size () == type_branch.types.size ());
auto value_position (value_branch.nodes.size ());
value_branch.nodes.push_back (nullptr);
type_branch.types.push_back (nullptr);
result.error = parser.parse_ast_or_refer_or_right_square_or_terminator (
[function_l, branch_position, value_position]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
function_l->returns [branch_position].types [value_position] = node_a;
},
[&]
(mu::core::region const & region_a)
{
done = true;
value_branch.nodes.pop_back ();
type_branch.types.pop_back ();
},
[&]
(mu::core::region const & region_a)
{
predicates = true;
value_branch.nodes.pop_back ();
type_branch.types.pop_back ();
}, U"Expecting a type or right square or terminator", mu::core::error_type::expecting_type_or_right_square_or_terminator);
if (!result.error && !done && !predicates)
{
result.error = parser.parse_ast_or_refer (
[function_l, branch_position, value_position]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
function_l->results.branches [branch_position].nodes [value_position] = node_a;
});
}
}
while (result.error == nullptr && !done)
{
auto sequence (new mu::llvmc::ast::sequence (nullptr));
value_branch.nodes.push_back (sequence);
parser.parse_ast_or_refer_or_right_square (
[sequence]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
sequence->node_m = node_a;
},
[&]
(mu::io::right_square *)
{
value_branch.nodes.pop_back ();
done = true;
} , U"Parsing predicates, expecting ast or reference", mu::core::error_type::expecting_ast_or_reference);
}
}
mu::llvmc::node_result mu::llvmc::parser::parse ()
{
mu::llvmc::module module (mu::empty_region, *this);
module.parse_internal ();
auto result (module.result);
if (result.error == nullptr)
{
auto next (peek ());
assert (next.ast == nullptr);
assert (next.error == nullptr);
auto token (next.token);
switch (token->id ())
{
case mu::io::token_id::end:
consume ();
break;
default:
result.error = new mu::core::error_string (U"Expecting right square after module", mu::core::error_type::expecting_right_square, token->region);
break;
}
}
return result;
}
bool mu::llvmc::keywords::insert (mu::string const & identifier_a, mu::llvmc::hook * hook_a)
{
auto existing (mappings.find (identifier_a));
auto result (existing != mappings.end ());
if (!result)
{
mappings.insert (existing, decltype (mappings)::value_type (identifier_a, hook_a));
}
return result;
}
mu::llvmc::hook_result mu::llvmc::keywords::get_hook (mu::string const & identifier_a)
{
hook_result result ({nullptr});
auto existing (mappings.find (identifier_a));
if (existing != mappings.end ())
{
result.hook = existing->second;
}
return result;
}
bool mu::llvmc::global::reserve (mu::string const & name_a)
{
auto existing (mappings.find (name_a));
auto result (existing != mappings.end ());
if (result)
{
auto hook (keywords->get_hook (name_a));
result = hook.hook != nullptr;
}
return result;
}
bool mu::llvmc::global::get (mu::string const & name_a, mu::core::region const & region_a, action_type action_a)
{
auto existing (mappings.find (name_a));
auto result (existing == mappings.end ());
if (!result)
{
action_a (existing->second, region_a);
}
return result;
}
void mu::llvmc::global::refer (mu::string const & name_a, mu::core::region const & region_a, action_type action_a)
{
auto error (get (name_a, region_a, action_a));
if (error)
{
unresolved.insert (decltype (unresolved)::value_type (name_a, unresolved_type (region_a, action_a)));
}
}
mu::llvmc::block::block (mu::llvmc::mapping * parent_a):
parent (parent_a)
{
}
bool mu::llvmc::block::insert (mu::string const & name_a, mu::llvmc::ast::node * node_a)
{
assert (node_a != nullptr);
auto result (parent->reserve (name_a));
if (!result)
{
auto existing (mappings.find (name_a));
result = existing != mappings.end ();
if (!result)
{
mappings.insert (decltype (mappings)::value_type (name_a, node_a));
for (auto i (unresolved.find (name_a)), j (unresolved.end ()); i != j && i->first == name_a; ++i)
{
std::get <1> (i->second) (node_a, std::get <0> (i->second));
}
unresolved.erase (name_a);
}
}
return result;
}
bool mu::llvmc::block::reserve (mu::string const & name_a)
{
auto result (parent->reserve (name_a));
if (!result)
{
auto existing (mappings.find (name_a));
result = existing != mappings.end () && existing->second != nullptr;
mappings [name_a] = nullptr;
}
return result;
}
bool mu::llvmc::block::get (mu::string const & name_a, mu::core::region const & region_a, action_type action_a)
{
auto existing (mappings.find (name_a));
auto result (existing == mappings.end ());
if (result)
{
result = parent->get (name_a, region_a, action_a);
}
else
{
if (existing->second != nullptr)
{
action_a (existing->second, region_a);
}
else
{
result = true;
}
}
return result;
}
void mu::llvmc::block::refer (mu::string const & name_a, mu::core::region const & region_a, action_type action_a)
{
auto existing (mappings.find (name_a));
auto result (existing == mappings.end ());
if (result)
{
result = parent->get (name_a, region_a, action_a);
if (result)
{
unresolved.insert (decltype (unresolved)::value_type (name_a, unresolved_type (region_a, action_a)));
}
}
else
{
if (existing->second != nullptr)
{
action_a (existing->second, region_a);
}
else
{
unresolved.insert (decltype (unresolved)::value_type (name_a, unresolved_type (region_a, action_a)));
}
}
}
void mu::llvmc::block::accept (mu::unordered_multimap <mu::string, unresolved_type> const & unresolved_a)
{
unresolved.insert (unresolved_a.begin (), unresolved_a.end ());
}
void mu::llvmc::global::accept (mu::unordered_multimap <mu::string, unresolved_type> const & unresolved_a)
{
unresolved.insert (unresolved_a.begin (), unresolved_a.end ());
}
mu::llvmc::node_result mu::llvmc::int_type::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto type (new mu::llvmc::ast::integer_type (parser_a.current_template));
result.node = type;
type->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[type] (mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
type->bits = node_a;
type->region.last = region_a.last;
});
return result;
}
mu::llvmc::expression::expression (mu::core::region const & region_a, mu::llvmc::parser & parser_a):
result ({nullptr, nullptr}),
parser (parser_a),
region (region_a)
{
}
void mu::llvmc::expression::parse ()
{
auto expression_l (new mu::llvmc::ast::expression (parser.current_template));
auto done (false);
auto predicates (false);
while (!done && result.error == nullptr)
{
auto next (parser.peek ());
if (next.ast != nullptr)
{
expression_l->arguments.push_back (next.ast);
}
else if (next.token != nullptr)
{
switch (next.token->id ())
{
case mu::io::token_id::identifier:
{
auto position (expression_l->arguments.size ());
expression_l->arguments.push_back (nullptr);
auto identifier (static_cast <mu::io::identifier *> (next.token));
parser.current_mapping->refer (identifier->string, identifier->region,
[expression_l, position]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
expression_l->arguments [position] = node_a;
});
break;
}
case mu::io::token_id::right_square:
expression_l->region = mu::core::region (region.first, next.token->region.last);
done = true;
break;
default:
result.error = new mu::core::error_string (U"Expecting argument or right_square", mu::core::error_type::expecting_argument_or_right_square, next.token->region);
break;
}
}
else
{
result.error = next.error;
}
}
if (result.error == nullptr)
{
result.node = expression_l;
}
}
mu::llvmc::node_result mu::llvmc::set_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto name (parser_a.peek ());
if (name.token != nullptr)
{
auto name_id (name.token->id ());
switch (name_id)
{
case mu::io::token_id::identifier:
{
auto next (parser_a.peek ());
if (next.ast != nullptr)
{
auto error (parser_a.current_mapping->insert(static_cast <mu::io::identifier *> (name.token)->string, next.ast));
if (error)
{
result.error = new mu::core::error_string (U"Unable to use name", mu::core::error_type::unable_to_use_identifier);
}
else
{
result.node = next.ast;
}
}
else if (next.ast != nullptr)
{
result.error = new mu::core::error_string (U"Expecting an expression", mu::core::error_type::expecting_expression);
}
else
{
result.error = next.error;
}
break;
}
default:
result.error = new mu::core::error_string (U"Expecting identifier", mu::core::error_type::expecting_identifier);
break;
}
}
else if (name.ast != nullptr)
{
result.error = new mu::core::error_string (U"Expecting a name", mu::core::error_type::expecting_name);
}
else
{
result.error = name.error;
}
return result;
}
mu::llvmc::node_result mu::llvmc::let_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto done (false);
auto next (parser_a.stream [0]);
mu::vector <mu::io::identifier *> identifiers;
while (!done && result.error == nullptr)
{
switch (next->id ())
{
case mu::io::token_id::identifier:
{
auto identifier (static_cast <mu::io::identifier *> (next));
auto hook (parser_a.keywords.get_hook (identifier->string));
if (hook.hook != nullptr)
{
done = true;
}
else
{
identifiers.push_back (identifier);
parser_a.stream.consume (1);
next = parser_a.stream [0];
}
break;
}
case mu::io::token_id::left_square:
done = true;
break;
default:
result.error = new mu::core::error_string (U"Expecting identifier or left square", mu::core::error_type::expecting_identifier_or_left_square);
break;
}
}
if (result.error == nullptr)
{
auto expression (parser_a.peek ());
if (expression.ast != nullptr)
{
size_t index (0);
size_t total (identifiers.size ());
auto set (new mu::llvmc::ast::set (parser_a.current_template));
set->region.first = identifiers.empty () ? expression.ast->region.first : identifiers [0]->region.first;
set->region.last = expression.ast->region.last;
for (auto i (identifiers.begin ()), j (identifiers.end ()); i != j && result.error == nullptr; ++i, ++index)
{
auto element (new mu::llvmc::ast::element (expression.ast, index, total, (*i)->string, (*i)->region, parser_a.current_template));
set->nodes.push_back (element);
auto error (parser_a.current_mapping->insert ((*i)->string, element));
if (error)
{
result.error = new mu::core::error_string (U"Unable to use identifier", mu::core::error_type::unable_to_use_identifier, (*i)->region);
}
}
if (result.error == nullptr)
{
result.node = set;
}
}
else
{
assert (expression.token == nullptr);
result.error = expression.error;
}
}
return result;
}
bool mu::llvmc::global::insert (mu::string const & identifier_a, mu::llvmc::ast::node * node_a)
{
auto hook (keywords->get_hook (identifier_a));
auto result (hook.hook != nullptr);
if (!result)
{
auto existing (mappings.find (identifier_a));
result = existing != mappings.end ();
if (!result)
{
mappings.insert (decltype (mappings)::value_type (identifier_a, node_a));
for (auto i (unresolved.find (identifier_a)), j (unresolved.end ()); i != j && i->first == identifier_a; ++i)
{
std::get <1> (i->second) (node_a, std::get <0> (i->second));
}
unresolved.erase (identifier_a);
}
}
return result;
}
mu::llvmc::loop::loop (mu::llvmc::parser & parser_a):
loop_m (new mu::llvmc::ast::loop (parser_a.current_template)),
result ({nullptr, nullptr}),
parser (parser_a)
{
}
void mu::llvmc::loop::parse ()
{
parse_arguments ();
if (result.error == nullptr)
{
parse_binds ();
if (result.error == nullptr)
{
parse_body ();
if (result.error == nullptr)
{
parse_results ();
if (result.error == nullptr)
{
result.node = loop_m;
}
}
}
}
}
void mu::llvmc::loop::parse_arguments ()
{
switch (parser.stream [0]->id ())
{
case mu::io::token_id::left_square:
{
parser.stream.consume (1);
auto predicates (false);
auto done (false);
while (!done)
{
auto next (parser.peek ());
if (next.ast != nullptr)
{
loop_m->arguments.push_back (next.ast);
}
else if (next.token != nullptr)
{
switch (next.token->id ())
{
case mu::io::token_id::right_square:
{
done = true;
break;
}
case mu::io::token_id::identifier:
{
auto & arguments_l (loop_m->arguments);
auto position (arguments_l.size ());
arguments_l.push_back (nullptr);
auto identifier (mu::cast <mu::io::identifier> (next.token));
parser.current_mapping->refer (identifier->string, identifier->region,
[&arguments_l, position]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
arguments_l [position] = node_a;
});
break;
}
default:
done = true;
result.error = new mu::core::error_string (U"Expecting argument or right square", mu::core::error_type::expecting_argument_or_right_square);
break;
}
}
else
{
result.error = next.error;
done = true;
}
}
}
break;
default:
result.error = new mu::core::error_string (U"Expecting left square", mu::core::error_type::expecting_left_square);
break;
}
}
void mu::llvmc::loop::parse_binds ()
{
switch (parser.stream [0]->id ())
{
case mu::io::token_id::left_square:
{
parser.stream.consume (1);
auto done (false);
while (!done)
{
auto next (parser.peek ());
if (next.ast != nullptr)
{
done = true;
result.error = new mu::core::error_string (U"Expecting identifier", mu::core::error_type::expecting_identifier);
}
else if (next.token != nullptr)
{
switch (next.token->id ())
{
case mu::io::token_id::identifier:
{
auto identifier (mu::cast <mu::io::identifier> (next.token));
auto parameter (new mu::llvmc::ast::loop_parameter (identifier->string, parser.current_template));
loop_m->parameters.push_back (parameter);
auto error (parser.current_mapping->insert (identifier->string, parameter));
if (error)
{
done = true;
result.error = new mu::core::error_string (U"Unable to use identifier", mu::core::error_type::unable_to_use_identifier);
}
break;
}
case mu::io::token_id::right_square:
done = true;
break;
default:
done = true;
result.error = new mu::core::error_string (U"Expecting identifier", mu::core::error_type::expecting_identifier);
break;
}
}
else
{
done = true;
result.error = next.error;
}
}
break;
}
default:
result.error = new mu::core::error_string (U"Expecting left square", mu::core::error_type::expecting_left_square);
break;
}
}
void mu::llvmc::loop::parse_body ()
{
switch (parser.stream [0]->id ())
{
case mu::io::token_id::left_square:
{
parser.stream.consume (1);
auto done (false);
while (!done)
{
auto next (parser.peek ());
if (next.ast != nullptr)
{
loop_m->roots.push_back (next.ast);
}
else if (next.token != nullptr)
{
switch (next.token->id ())
{
case mu::io::token_id::right_square:
done = true;
break;
default:
done = true;
result.error = new mu::core::error_string (U"Expecting expression or right square", mu::core::error_type::expecting_expression_or_right_square);
break;
}
}
else
{
result.error = next.error;
done = true;
}
}
break;
}
default:
result.error = new mu::core::error_string (U"Expecting loop body", mu::core::error_type::expecting_loop_body);
break;
}
}
void mu::llvmc::loop::parse_results ()
{
result.error = parser.parse_left_square_required (U"Expecting loop results", mu::core::error_type::expecting_loop_results);
if (result.error == nullptr)
{
auto done (false);
while (!done && result.error == nullptr)
{
switch (parser.stream [0]->id ())
{
case mu::io::token_id::left_square:
{
auto branch_index (loop_m->results.size ());
auto & branch (loop_m->add_branch ());
parser.stream.consume (1);
auto set_done (false);
while (!set_done && result.error == nullptr)
{
auto position (branch.nodes.size ());
branch.nodes.push_back (nullptr);
result.error = parser.parse_ast_or_refer_or_right_square (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
loop_m->results [branch_index].nodes [position] = node_a;
},
[&]
(mu::io::right_square * token_a)
{
branch.nodes.pop_back ();
set_done = true;
},
U"Expecting result", mu::core::error_type::expecting_an_expression);
}
break;
}
case mu::io::token_id::right_square:
parser.consume ();
done = true;
break;
default:
result.error = new mu::core::error_string (U"Expecting result set or right square", mu::core::error_type::expecting_result_set_or_right_square);
break;
}
}
}
}
mu::llvmc::node_result mu::llvmc::loop_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::loop loop (parser_a);
loop.parse ();
return loop.result;
}
mu::llvmc::block::~block ()
{
parent->accept (unresolved);
}
mu::llvmc::node_result mu::llvmc::ptr_type::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto type (new mu::llvmc::ast::pointer_type (parser_a.current_template));
result.node = type;
auto first (region_a.first);
result.error = parser_a.parse_ast_or_refer (
[type, first]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
type->pointed_type = node_a;
type->region = mu::core::region (first, region_a.last);
});
return result;
}
mu::llvmc::node_result mu::llvmc::number::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_identifier (
[&] (mu::io::identifier * identifier_a)
{
result.node = new mu::llvmc::ast::number (identifier_a->string, parser_a.current_template);
result.node->region.first = region_a.first;
result.node->region.last = identifier_a->region.last;
return nullptr;
}, U"Expecting an identifier", mu::core::error_type::expecting_identifier);
return result;
}
mu::llvmc::ast::number::number (mu::string const & number_a, mu::llvmc::template_context * context_a) :
node (context_a),
number_m (number_a)
{
}
mu::llvmc::node_result mu::llvmc::asm_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto asm_l (new mu::llvmc::ast::asm_c (parser_a.current_template));
asm_l->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[asm_l]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
asm_l->type = node_a;
}
);
if (result.error == nullptr)
{
result.error = parser_a.parse_identifier (
[&]
(mu::io::identifier * identifier_a)
{
asm_l->text = identifier_a->string;
return nullptr;
},
U"Expecting asm text", mu::core::error_type::asm_hook_expecting_identifier);
if (result.error == nullptr)
{
result.error = parser_a.parse_identifier (
[&]
(mu::io::identifier * identifier_a)
{
asm_l->constraints = identifier_a->string;
asm_l->region.last = identifier_a->region.last;
return nullptr;
},
U"Expecting asm constraints", mu::core::error_type::asm_hook_expecting_constraints);
if (result.error == nullptr)
{
result.node = asm_l;
}
}
}
return result;
}
mu::llvmc::partial_ast_result::partial_ast_result (mu::io::token * token_a, mu::llvmc::ast::node * ast_a, mu::core::error * error_a):
token (token_a),
ast (ast_a),
error (error_a)
{
assert (valid ());
}
mu::llvmc::partial_ast_result::partial_ast_result (mu::llvmc::partial_ast_result const & other_a):
token (other_a.token),
ast (other_a.ast),
error (other_a.error)
{
assert (valid ());
}
mu::llvmc::partial_ast_result & mu::llvmc::partial_ast_result::operator = (mu::llvmc::partial_ast_result const & other_a)
{
token = other_a.token;
ast = other_a.ast;
error = other_a.error;
assert (valid ());
return *this;
}
bool mu::llvmc::partial_ast_result::valid ()
{
auto result (not ((token != nullptr and ast != nullptr) or (token != nullptr and error != nullptr) or (ast != nullptr and error != nullptr)));
return result;
}
void mu::llvmc::parser::consume ()
{
stream.consume (1);
}
mu::llvmc::partial_ast_result mu::llvmc::parser::peek ()
{
mu::llvmc::partial_ast_result result ({nullptr, nullptr, nullptr});
auto token (stream [0]);
consume ();
auto id (token->id ());
switch (id)
{
case mu::io::token_id::identifier:
{
auto identifier (static_cast <mu::io::identifier *> (token));
auto hook (keywords.get_hook (identifier->string));
if (hook.hook != nullptr)
{
mu::llvmc::parser_context context (*this, &hook.hook->name ());
auto ast (hook.hook->parse (token->region, *this));
if (ast.node != nullptr)
{
result = {nullptr, ast.node, nullptr};
}
else
{
result = {nullptr, nullptr, ast.error};
}
}
else
{
result = {token, nullptr, nullptr};
}
break;
}
case mu::io::token_id::left_square:
{
mu::llvmc::expression expression_l (token->region, *this);
expression_l.parse ();
if (expression_l.result.node != nullptr)
{
result.ast = expression_l.result.node;
}
else
{
result.error = expression_l.result.error;
}
break;
}
default:
result = {token, nullptr, nullptr};
break;
}
return result;
}
mu::core::error * mu::llvmc::parser::parse_left_square_required (char32_t const * error_message_a, mu::core::error_type error_type_a)
{
mu::core::error * result (nullptr);
auto next (stream [0]);
auto id (next->id ());
switch (id)
{
case mu::io::token_id::left_square:
consume ();
break;
default:
result = new mu::core::error_string (error_message_a, error_type_a, next->region);
break;
}
return result;
}
mu::llvmc::node_result mu::llvmc::array_type::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
auto node (new mu::llvmc::ast::fixed_array_type (parser_a.current_template));
node->region.first = region_a.first;
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
node->element_type = node_a;
}
);
if (result.error == nullptr)
{
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
node->size = node_a;
node->region.last = region_a.last;
}
);
if (result.error == nullptr)
{
result.node = node;
}
}
return result;
}
mu::llvmc::node_result mu::llvmc::constant_array::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto node (new mu::llvmc::ast::constant_array (parser_a.current_template));
node->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
node->type = node_a;
}
);
if (result.error == nullptr)
{
result.error = parser_a.parse_left_square_required (U"Expecting array initializer list", mu::core::error_type::expecting_array_initializers);
if (result.error == nullptr)
{
auto done (false);
while (!done && result.error == nullptr)
{
result.error = parser_a.parse_ast_or_refer_or_right_square (
[&, node]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
node->initializer.push_back (node_a);
},
[&]
(mu::io::right_square * token_a)
{
node->region.last = token_a->region.last;
done = true;
}, U"Expecting array initializer list", mu::core::error_type::expecting_array_initializers);
}
if (result.error == nullptr)
{
result.node = node;
}
}
}
return result;
}
mu::llvmc::node_result mu::llvmc::string_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_identifier (
[&]
(mu::io::identifier * identifier_a)
{
auto int_type (new mu::llvmc::skeleton::integer_type (32));
mu::vector <mu::llvmc::skeleton::constant *> initializer;
for (auto i: identifier_a->string)
{
initializer.push_back (new mu::llvmc::skeleton::constant_integer (identifier_a->region, new mu::llvmc::skeleton::integer_type (32), i));
}
auto value (new mu::llvmc::skeleton::constant_array (mu::core::region (region_a.first, identifier_a->region.last), new mu::llvmc::skeleton::fixed_array_type (int_type, initializer.size ()), initializer));
result.node = new mu::llvmc::ast::value (value, parser_a.current_template);
return nullptr;
}, U"String hook is expecting an identifier", mu::core::error_type::expecting_identifier);
return result;
}
mu::llvmc::node_result mu::llvmc::ascii_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_identifier (
[&]
(mu::io::identifier * identifier_a)
{
mu::core::error * result_l (nullptr);
auto int_type (new mu::llvmc::skeleton::integer_type (8));
mu::vector <mu::llvmc::skeleton::constant *> initializer;
for (auto i (identifier_a->string.begin ()), j (identifier_a->string.end ()); i != j && result_l == nullptr; ++i)
{
uint32_t value (*i);
if (value < 0x100)
{
initializer.push_back (new mu::llvmc::skeleton::constant_integer (identifier_a->region, new mu::llvmc::skeleton::integer_type (8), value));
}
else
{
result_l = new mu::core::error_string (U"Character doesn't fit in to an ASCII character", mu::core::error_type::character_does_not_fit_in_to_an_ascii_character, identifier_a->region);
}
}
auto value (new mu::llvmc::skeleton::constant_array (mu::core::region (region_a.first, identifier_a->region.last), new mu::llvmc::skeleton::fixed_array_type (int_type, initializer.size ()), initializer));
result.node = new mu::llvmc::ast::value (value, parser_a.current_template);
return result_l;
}, U"String hook is expecting an identifier", mu::core::error_type::expecting_identifier);
return result;
}
mu::llvmc::node_result mu::llvmc::global_variable::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto global (new mu::llvmc::ast::global_variable (parser_a.current_template));
global->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
global->initializer = node_a;
global->region.last = region_a.last;
}
);
if (result.error == nullptr)
{
result.node = global;
}
return result;
}
mu::llvmc::node_result mu::llvmc::constant_pointer_null::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto constant (new mu::llvmc::ast::constant_pointer_null (parser_a.current_template));
constant->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
constant->type = node_a;
constant->region.last = region_a.last;
}
);
if (result.error == nullptr)
{
result.node = constant;
}
return result;
}
mu::llvmc::node_result mu::llvmc::join_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto join (new mu::llvmc::ast::join (parser_a.current_template));
result.error = parser_a.parse_left_square_required (U"Join must start with a left square", mu::core::error_type::expecting_left_square);
if (result.error == nullptr)
{
auto done (false);
while (!done && result.error == nullptr)
{
result.error = parser_a.parse_left_or_right_square (
[&]
(mu::core::region const & region_a)
{
mu::core::error * error (nullptr);
auto & branch (join->add_branch ());
auto predicates (false);
auto done (false);
while (!done && error == nullptr)
{
error = parser_a.parse_ast_or_refer_or_right_square_or_terminator (
[&]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
if (predicates)
{
branch.predicates.push_back (node_a);
}
else
{
branch.arguments.push_back (node_a);
}
},
[&]
(mu::core::region const & region_a)
{
done = true;
},
[&]
(mu::core::region const & region_a)
{
if (!predicates)
{
predicates = true;
}
else
{
error = new mu::core::error_string (U"Already parsing predicates", mu::core::error_type::already_parsing_predicates);
}
}, U"Expecting ast or reference or right square or terminator", mu::core::error_type::expecting_branch_or_right_square);
}
return error;
},
[&]
(mu::core::region const & region_a)
{
mu::core::error * error (nullptr);
done = true;
return error;
}, U"Expecting branch or right square", mu::core::error_type::expecting_branch_or_right_square);
}
}
if (result.error == nullptr)
{
result.node = join;
}
return result;
}
mu::llvmc::node_result mu::llvmc::undefined_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto undefined (new mu::llvmc::ast::undefined (parser_a.current_template));
result.error = parser_a.parse_ast_or_refer (
[=]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
undefined->type = node_a;
}
);
if (result.error == nullptr)
{
result.node = undefined;
}
return result;
}
mu::llvmc::node_result mu::llvmc::struct_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_left_square_required (U"Struct definition must beging with a left square", mu::core::error_type::expecting_left_square);
auto struct_l (new mu::llvmc::ast::struct_type (parser_a.current_template));
if (result.error == nullptr)
{
auto done (false);
size_t index (0);
while (!done && result.error == nullptr)
{
result.error = parser_a.parse_identifier_or_right_square (
[&]
(mu::io::identifier * identifier_a)
{
mu::core::error * result (nullptr);
auto existing (struct_l->names.find (identifier_a->string));
if (existing == struct_l->names.end ())
{
struct_l->names [identifier_a->string] = index;
++index;
}
else
{
result = new mu::core::error_string (U"Element name has already been used", mu::core::error_type::unable_to_use_identifier, identifier_a->region);
}
return result;
},
[&]
(mu::io::right_square * right_square_a)
{
done = true;
return nullptr;
},U"Expecting identifier or right square", mu::core::error_type::expecting_identifier_or_right_square);
if (result.error == nullptr && !done)
{
result.error = parser_a.parse_ast_or_refer (
[struct_l]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
struct_l->elements.push_back (node_a);
});
}
}
}
if (result.error == nullptr)
{
result.node = struct_l;
}
return result;
}
mu::string const & mu::llvmc::array_type::name ()
{
static mu::string const result (U"array_type");
return result;
}
mu::string const & mu::llvmc::ascii_hook::name ()
{
static mu::string const result (U"ascii_hook");
return result;
}
mu::string const & mu::llvmc::string_hook::name ()
{
static mu::string const result (U"string_hook");
return result;
}
mu::string const & mu::llvmc::struct_hook::name ()
{
static mu::string const result (U"struct_hook");
return result;
}
mu::string const & mu::llvmc::constant_int::name ()
{
static mu::string const result (U"constant_int");
return result;
}
mu::string const & mu::llvmc::function_hook::name ()
{
static mu::string const result (U"function_hook");
return result;
}
mu::string const & mu::llvmc::constant_array::name ()
{
static mu::string const result (U"constant_array");
return result;
}
mu::string const & mu::llvmc::undefined_hook::name ()
{
static mu::string const result (U"undefined_hook");
return result;
}
mu::string const & mu::llvmc::global_variable::name ()
{
static mu::string const result (U"global_variable");
return result;
}
mu::string const & mu::llvmc::constant_pointer_null::name ()
{
static mu::string const result (U"constant_pointer_null");
return result;
}
mu::string const & mu::llvmc::module_hook::name ()
{
static mu::string const result (U"module");
return result;
}
mu::string const & mu::llvmc::number::name ()
{
static mu::string const result (U"number");
return result;
}
mu::string const & mu::llvmc::asm_hook::name ()
{
static mu::string const result (U"asm_hook");
return result;
}
mu::string const & mu::llvmc::int_type::name ()
{
static mu::string const result (U"int_type");
return result;
}
mu::string const & mu::llvmc::let_hook::name ()
{
static mu::string const result (U"let_hook");
return result;
}
mu::string const & mu::llvmc::ptr_type::name ()
{
static mu::string const result (U"ptr_type");
return result;
}
mu::string const & mu::llvmc::set_hook::name ()
{
static mu::string const result (U"set_hook");
return result;
}
mu::string const & mu::llvmc::join_hook::name ()
{
static mu::string const result (U"join_hook");
return result;
}
mu::string const & mu::llvmc::loop_hook::name ()
{
static mu::string const result (U"loop_hook");
return result;
}
mu::llvmc::parser_context::parser_context (mu::llvmc::parser & parser_a, mu::string const * name_a) :
parser (parser_a)
{
parser_a.parse_stack.push_back (mu::llvmc::parser_frame ({parser_a.stream [0]->region.first, name_a}));
}
mu::llvmc::parser_context::~parser_context ()
{
parser.parse_stack.pop_back ();
}
mu::llvmc::parser_error::parser_error (char32_t const * message_a, mu::core::error_type type_a, mu::core::region const & region_a, mu::llvmc::parser & parser_a) :
type_m (type_a),
message (message_a),
region_m (region_a),
parse_stack (parser_a.parse_stack)
{
}
void mu::llvmc::parser_error::output (std::ostream & out)
{
std::string string (message.begin (), message.end ());
mu::string const & region_mu (region_m.string ());
std::string region (region_mu.begin (), region_mu.end ());
out << string << "(" << region << ")" << std::endl;
for (auto & i: parse_stack)
{
std::string message (i.name->begin (), i.name->end ());
mu::string const & region_mu (region_m.string ());
std::string region (region_mu.begin (), region_mu.end ());
out << message << "(" << region << ")" << std::endl;
}
}
mu::core::error_type mu::llvmc::parser_error::type ()
{
return type_m;
}
mu::core::region mu::llvmc::parser_error::region ()
{
return region_m;
}
mu::llvmc::node_result mu::llvmc::template_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::block block (parser_a.current_mapping);
parser_a.current_mapping = █
parser_a.current_template = new mu::llvmc::template_context ({parser_a.current_template});
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_left_square_required (U"template parser expecting parameter list", mu::core::error_type::expecting_left_square);
auto template_l (new mu::llvmc::ast::template_c (parser_a.current_template, parser_a.current_template->parent));
if (result.error == nullptr)
{
auto done (false);
while (!done && result.error == nullptr)
{
result.error = parser_a.parse_identifier_or_right_square (
[&]
(mu::io::identifier * identifier_a)
{
mu::core::error * result (nullptr);
auto node (new mu::llvmc::ast::template_parameter (identifier_a->string, parser_a.current_template));
template_l->parameters.push_back (node);
auto error (parser_a.current_mapping->insert (identifier_a->string, node));
if (error)
{
result = new mu::core::error_string (U"Unable to use name", mu::core::error_type::unable_to_use_identifier);
}
return result;
},
[&]
(mu::io::right_square * right_square_a)
{
done = true;
return nullptr;
}, U"Template parser expecting parameter name or right square", mu::core::error_type::expecting_identifier_or_right_square
);
}
if (result.error == nullptr)
{
result.error = parser_a.parse_left_square_required (U"template parser expecting template body", mu::core::error_type::expecting_left_square);
auto done (false);
while (!done && result.error == nullptr)
{
auto position (template_l->body.size ());
template_l->body.push_back (nullptr);
result.error = parser_a.parse_ast_or_refer_or_right_square (
[template_l, position]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
template_l->body [position] = node_a;
},
[&]
(mu::io::right_square * right_square_a)
{
done = true;
},
U"Template body expecting references or right square", mu::core::error_type::expecting_argument_or_right_square
);
}
template_l->body.pop_back ();
}
}
if (result.error == nullptr)
{
result.node = template_l;
}
parser_a.current_template = parser_a.current_template->parent;
parser_a.current_mapping = block.parent;
return result;
}
mu::string const & mu::llvmc::template_hook::name ()
{
static mu::string const result (U"template_hook");
return result;
}
mu::llvmc::node_result mu::llvmc::entry_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
auto entry (new mu::llvmc::ast::entry (parser_a.current_template));
entry->region = region_a;
mu::llvmc::node_result result ({nullptr, nullptr});
result.error = parser_a.parse_ast_or_refer (
[entry]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
entry->function = node_a;
}
);
if (result.error == nullptr)
{
result.node = entry;
}
return result;
}
mu::string const & mu::llvmc::entry_hook::name ()
{
static mu::string const result (U"entry_hook");
return result;
}
bool mu::llvmc::template_context::should_clone (mu::llvmc::template_context * node_a)
{
bool result (false);
auto current (node_a);
while (!result && current != nullptr)
{
result = (current == this);
current = current->parent;
}
return result;
}
mu::llvmc::node_result mu::llvmc::namespace_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
auto namespace_l (new mu::llvmc::ast::namespace_c (parser_a.current_template));
mu::llvmc::node_result result ({nullptr, nullptr});
namespace_l->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[namespace_l]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
namespace_l->node_m = node_a;
});
if (result.error == nullptr)
{
result.error = parser_a.parse_identifier (
[namespace_l]
(mu::io::identifier * identifier_a)
{
namespace_l->member = identifier_a->string;
namespace_l->region.last = identifier_a->region.last;
return nullptr;
}, U"Expecting a namespace member name", mu::core::error_type::expecting_identifier);
if (result.error == nullptr)
{
result.node = namespace_l;
}
}
return result;
}
mu::string const & mu::llvmc::namespace_hook::name ()
{
static mu::string const result (U"namespace_hook");
return result;
}
mu::llvmc::module::module (mu::core::region const & region_a, mu::llvmc::parser & parser_a) :
block (parser_a.current_mapping),
result ({nullptr, nullptr}),
parser (parser_a),
first (region_a)
{
parser_a.current_mapping = █
}
mu::llvmc::module::~module ()
{
assert (parser.current_mapping == &block);
parser.current_mapping = block.parent;
}
mu::llvmc::node_result mu::llvmc::sequence_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
auto sequence_l (new mu::llvmc::ast::sequence (nullptr, parser_a.current_template));
mu::llvmc::node_result result ({nullptr, nullptr});
sequence_l->region.first = region_a.first;
result.error = parser_a.parse_ast_or_refer (
[sequence_l]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
sequence_l->node_m = node_a;
});
if (result.error == nullptr)
{
result.node = sequence_l;
}
return result;
}
mu::string const & mu::llvmc::sequence_hook::name ()
{
static mu::string const result (U"sequence_hook");
return result;
}
mu::llvmc::node_result mu::llvmc::function_overload_hook::parse (mu::core::region const & region_a, mu::llvmc::parser & parser_a)
{
mu::llvmc::node_result result ({nullptr, nullptr});
auto overload (new mu::llvmc::ast::function_overload (parser_a.current_template));
result.error = parser_a.parse_identifier (
[&parser_a, overload]
(mu::io::identifier * identifier_a)
{
auto empty (parser_a.current_mapping->get (identifier_a->string, identifier_a->region,
[overload]
(mu::llvmc::ast::node * node_a, mu::core::region const & region_a)
{
overload->family = node_a;
}));
if (empty)
{
auto family (new mu::llvmc::ast::function_family);
parser_a.current_mapping->insert (identifier_a->string, family);
overload->family = family;
}
return nullptr;
}, U"Expecting function name", mu::core::error_type::expecting_function_name);
if (result.error == nullptr)
{
auto result2 (function_hook.parse (region_a, parser_a));
if (result2.error == nullptr)
{
overload->function = result2.node;
result.node = overload;
}
else
{
result.error = result2.error;
}
}
return result;
}
mu::string const & mu::llvmc::function_overload_hook::name ()
{
static mu::string const name (U"function_overload_hook");
return name;
}
mu::llvmc::function_overload_hook::function_overload_hook (mu::llvmc::function_hook & function_hook_a) :
function_hook (function_hook_a)
{
} | 36.583661 | 207 | 0.577659 | [
"vector"
] |
5049ce78895332a0703d8881a74ad080ec864139 | 25,371 | cpp | C++ | applications/mne_scan/libs/scDisp/release/moc_quickcontrolwidget.cpp | ChunmingGu/mne-cpp-master | 36f21b3ab0c65a133027da83fa8e2a652acd1485 | [
"BSD-3-Clause"
] | null | null | null | applications/mne_scan/libs/scDisp/release/moc_quickcontrolwidget.cpp | ChunmingGu/mne-cpp-master | 36f21b3ab0c65a133027da83fa8e2a652acd1485 | [
"BSD-3-Clause"
] | null | null | null | applications/mne_scan/libs/scDisp/release/moc_quickcontrolwidget.cpp | ChunmingGu/mne-cpp-master | 36f21b3ab0c65a133027da83fa8e2a652acd1485 | [
"BSD-3-Clause"
] | null | null | null | /****************************************************************************
** Meta object code from reading C++ file 'quickcontrolwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.10.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../helpers/quickcontrolwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#include <QtCore/QList>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'quickcontrolwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.10.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_SCDISPLIB__QuickControlWidget_t {
QByteArrayData data[66];
char stringdata0[1219];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_SCDISPLIB__QuickControlWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_SCDISPLIB__QuickControlWidget_t qt_meta_stringdata_SCDISPLIB__QuickControlWidget = {
{
QT_MOC_LITERAL(0, 0, 29), // "SCDISPLIB::QuickControlWidget"
QT_MOC_LITERAL(1, 30, 14), // "scalingChanged"
QT_MOC_LITERAL(2, 45, 0), // ""
QT_MOC_LITERAL(3, 46, 18), // "QMap<qint32,float>"
QT_MOC_LITERAL(4, 65, 10), // "scalingMap"
QT_MOC_LITERAL(5, 76, 20), // "projSelectionChanged"
QT_MOC_LITERAL(6, 97, 20), // "compSelectionChanged"
QT_MOC_LITERAL(7, 118, 2), // "to"
QT_MOC_LITERAL(8, 121, 23), // "spharaActivationChanged"
QT_MOC_LITERAL(9, 145, 5), // "state"
QT_MOC_LITERAL(10, 151, 20), // "spharaOptionsChanged"
QT_MOC_LITERAL(11, 172, 10), // "sSytemType"
QT_MOC_LITERAL(12, 183, 14), // "nBaseFctsFirst"
QT_MOC_LITERAL(13, 198, 15), // "nBaseFctsSecond"
QT_MOC_LITERAL(14, 214, 17), // "timeWindowChanged"
QT_MOC_LITERAL(15, 232, 5), // "value"
QT_MOC_LITERAL(16, 238, 11), // "zoomChanged"
QT_MOC_LITERAL(17, 250, 18), // "triggerInfoChanged"
QT_MOC_LITERAL(18, 269, 19), // "QMap<double,QColor>"
QT_MOC_LITERAL(19, 289, 6), // "active"
QT_MOC_LITERAL(20, 296, 9), // "triggerCh"
QT_MOC_LITERAL(21, 306, 9), // "threshold"
QT_MOC_LITERAL(22, 316, 17), // "showFilterOptions"
QT_MOC_LITERAL(23, 334, 15), // "settingsChanged"
QT_MOC_LITERAL(24, 350, 15), // "QList<Modality>"
QT_MOC_LITERAL(25, 366, 12), // "modalityList"
QT_MOC_LITERAL(26, 379, 25), // "distanceTimeSpacerChanged"
QT_MOC_LITERAL(27, 405, 19), // "resetTriggerCounter"
QT_MOC_LITERAL(28, 425, 19), // "updateConnectedView"
QT_MOC_LITERAL(29, 445, 11), // "compClicked"
QT_MOC_LITERAL(30, 457, 4), // "text"
QT_MOC_LITERAL(31, 462, 18), // "signalColorChanged"
QT_MOC_LITERAL(32, 481, 11), // "signalColor"
QT_MOC_LITERAL(33, 493, 22), // "backgroundColorChanged"
QT_MOC_LITERAL(34, 516, 15), // "backgroundColor"
QT_MOC_LITERAL(35, 532, 14), // "makeScreenshot"
QT_MOC_LITERAL(36, 547, 9), // "imageType"
QT_MOC_LITERAL(37, 557, 25), // "averageInformationChanged"
QT_MOC_LITERAL(38, 583, 48), // "QMap<double,QPair<QColor,QPai..."
QT_MOC_LITERAL(39, 632, 3), // "map"
QT_MOC_LITERAL(40, 636, 19), // "onTimeWindowChanged"
QT_MOC_LITERAL(41, 656, 13), // "onZoomChanged"
QT_MOC_LITERAL(42, 670, 24), // "onCheckProjStatusChanged"
QT_MOC_LITERAL(43, 695, 22), // "onEnableDisableAllProj"
QT_MOC_LITERAL(44, 718, 6), // "status"
QT_MOC_LITERAL(45, 725, 24), // "onCheckCompStatusChanged"
QT_MOC_LITERAL(46, 750, 8), // "compName"
QT_MOC_LITERAL(47, 759, 22), // "onUpdateSpinBoxScaling"
QT_MOC_LITERAL(48, 782, 21), // "onUpdateSliderScaling"
QT_MOC_LITERAL(49, 804, 30), // "onRealTimeTriggerActiveChanged"
QT_MOC_LITERAL(50, 835, 29), // "onRealTimeTriggerColorChanged"
QT_MOC_LITERAL(51, 865, 33), // "onRealTimeTriggerThresholdCha..."
QT_MOC_LITERAL(52, 899, 33), // "onRealTimeTriggerColorTypeCha..."
QT_MOC_LITERAL(53, 933, 33), // "onRealTimeTriggerCurrentChCha..."
QT_MOC_LITERAL(54, 967, 15), // "onToggleHideAll"
QT_MOC_LITERAL(55, 983, 19), // "onShowFilterOptions"
QT_MOC_LITERAL(56, 1003, 24), // "onUpdateModalityCheckbox"
QT_MOC_LITERAL(57, 1028, 15), // "onOpacityChange"
QT_MOC_LITERAL(58, 1044, 27), // "onDistanceTimeSpacerChanged"
QT_MOC_LITERAL(59, 1072, 21), // "onResetTriggerNumbers"
QT_MOC_LITERAL(60, 1094, 19), // "onUserFilterToggled"
QT_MOC_LITERAL(61, 1114, 21), // "onSpharaButtonClicked"
QT_MOC_LITERAL(62, 1136, 22), // "onSpharaOptionsChanged"
QT_MOC_LITERAL(63, 1159, 24), // "onViewColorButtonClicked"
QT_MOC_LITERAL(64, 1184, 16), // "onMakeScreenshot"
QT_MOC_LITERAL(65, 1201, 17) // "onAveragesChanged"
},
"SCDISPLIB::QuickControlWidget\0"
"scalingChanged\0\0QMap<qint32,float>\0"
"scalingMap\0projSelectionChanged\0"
"compSelectionChanged\0to\0spharaActivationChanged\0"
"state\0spharaOptionsChanged\0sSytemType\0"
"nBaseFctsFirst\0nBaseFctsSecond\0"
"timeWindowChanged\0value\0zoomChanged\0"
"triggerInfoChanged\0QMap<double,QColor>\0"
"active\0triggerCh\0threshold\0showFilterOptions\0"
"settingsChanged\0QList<Modality>\0"
"modalityList\0distanceTimeSpacerChanged\0"
"resetTriggerCounter\0updateConnectedView\0"
"compClicked\0text\0signalColorChanged\0"
"signalColor\0backgroundColorChanged\0"
"backgroundColor\0makeScreenshot\0imageType\0"
"averageInformationChanged\0"
"QMap<double,QPair<QColor,QPair<QString,bool> > >\0"
"map\0onTimeWindowChanged\0onZoomChanged\0"
"onCheckProjStatusChanged\0"
"onEnableDisableAllProj\0status\0"
"onCheckCompStatusChanged\0compName\0"
"onUpdateSpinBoxScaling\0onUpdateSliderScaling\0"
"onRealTimeTriggerActiveChanged\0"
"onRealTimeTriggerColorChanged\0"
"onRealTimeTriggerThresholdChanged\0"
"onRealTimeTriggerColorTypeChanged\0"
"onRealTimeTriggerCurrentChChanged\0"
"onToggleHideAll\0onShowFilterOptions\0"
"onUpdateModalityCheckbox\0onOpacityChange\0"
"onDistanceTimeSpacerChanged\0"
"onResetTriggerNumbers\0onUserFilterToggled\0"
"onSpharaButtonClicked\0onSpharaOptionsChanged\0"
"onViewColorButtonClicked\0onMakeScreenshot\0"
"onAveragesChanged"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_SCDISPLIB__QuickControlWidget[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
42, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
18, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 224, 2, 0x06 /* Public */,
5, 0, 227, 2, 0x06 /* Public */,
6, 1, 228, 2, 0x06 /* Public */,
8, 1, 231, 2, 0x06 /* Public */,
10, 3, 234, 2, 0x06 /* Public */,
14, 1, 241, 2, 0x06 /* Public */,
16, 1, 244, 2, 0x06 /* Public */,
17, 4, 247, 2, 0x06 /* Public */,
22, 1, 256, 2, 0x06 /* Public */,
23, 1, 259, 2, 0x06 /* Public */,
26, 1, 262, 2, 0x06 /* Public */,
27, 0, 265, 2, 0x06 /* Public */,
28, 0, 266, 2, 0x06 /* Public */,
29, 1, 267, 2, 0x06 /* Public */,
31, 1, 270, 2, 0x06 /* Public */,
33, 1, 273, 2, 0x06 /* Public */,
35, 1, 276, 2, 0x06 /* Public */,
37, 1, 279, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
40, 1, 282, 2, 0x09 /* Protected */,
41, 1, 285, 2, 0x09 /* Protected */,
42, 1, 288, 2, 0x09 /* Protected */,
43, 1, 291, 2, 0x09 /* Protected */,
45, 1, 294, 2, 0x09 /* Protected */,
47, 1, 297, 2, 0x09 /* Protected */,
48, 1, 300, 2, 0x09 /* Protected */,
49, 1, 303, 2, 0x09 /* Protected */,
50, 1, 306, 2, 0x09 /* Protected */,
51, 1, 309, 2, 0x09 /* Protected */,
52, 1, 312, 2, 0x09 /* Protected */,
53, 1, 315, 2, 0x09 /* Protected */,
54, 1, 318, 2, 0x09 /* Protected */,
55, 1, 321, 2, 0x09 /* Protected */,
56, 1, 324, 2, 0x09 /* Protected */,
57, 1, 327, 2, 0x09 /* Protected */,
58, 1, 330, 2, 0x09 /* Protected */,
59, 0, 333, 2, 0x09 /* Protected */,
60, 1, 334, 2, 0x09 /* Protected */,
61, 1, 337, 2, 0x09 /* Protected */,
62, 0, 340, 2, 0x09 /* Protected */,
63, 0, 341, 2, 0x09 /* Protected */,
64, 0, 342, 2, 0x09 /* Protected */,
65, 0, 343, 2, 0x09 /* Protected */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 7,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::QString, QMetaType::Int, QMetaType::Int, 11, 12, 13,
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void, QMetaType::Double, 15,
QMetaType::Void, 0x80000000 | 18, QMetaType::Bool, QMetaType::QString, QMetaType::Double, 15, 19, 20, 21,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, 0x80000000 | 24, 25,
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::QString, 30,
QMetaType::Void, QMetaType::QColor, 32,
QMetaType::Void, QMetaType::QColor, 34,
QMetaType::Void, QMetaType::QString, 36,
QMetaType::Void, 0x80000000 | 38, 39,
// slots: parameters
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void, QMetaType::Double, 15,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::Bool, 44,
QMetaType::Void, QMetaType::QString, 46,
QMetaType::Void, QMetaType::Double, 15,
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void, QMetaType::Int, 9,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::Double, 15,
QMetaType::Void, QMetaType::QString, 15,
QMetaType::Void, QMetaType::QString, 15,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::Int, 9,
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void, QMetaType::Int, 15,
QMetaType::Void,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void, QMetaType::Bool, 9,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void SCDISPLIB::QuickControlWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QuickControlWidget *_t = static_cast<QuickControlWidget *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->scalingChanged((*reinterpret_cast< const QMap<qint32,float>(*)>(_a[1]))); break;
case 1: _t->projSelectionChanged(); break;
case 2: _t->compSelectionChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 3: _t->spharaActivationChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 4: _t->spharaOptionsChanged((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
case 5: _t->timeWindowChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 6: _t->zoomChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
case 7: _t->triggerInfoChanged((*reinterpret_cast< const QMap<double,QColor>(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])),(*reinterpret_cast< double(*)>(_a[4]))); break;
case 8: _t->showFilterOptions((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 9: _t->settingsChanged((*reinterpret_cast< const QList<Modality>(*)>(_a[1]))); break;
case 10: _t->distanceTimeSpacerChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 11: _t->resetTriggerCounter(); break;
case 12: _t->updateConnectedView(); break;
case 13: _t->compClicked((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 14: _t->signalColorChanged((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
case 15: _t->backgroundColorChanged((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
case 16: _t->makeScreenshot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 17: _t->averageInformationChanged((*reinterpret_cast< const QMap<double,QPair<QColor,QPair<QString,bool> > >(*)>(_a[1]))); break;
case 18: _t->onTimeWindowChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 19: _t->onZoomChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
case 20: _t->onCheckProjStatusChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 21: _t->onEnableDisableAllProj((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 22: _t->onCheckCompStatusChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 23: _t->onUpdateSpinBoxScaling((*reinterpret_cast< double(*)>(_a[1]))); break;
case 24: _t->onUpdateSliderScaling((*reinterpret_cast< int(*)>(_a[1]))); break;
case 25: _t->onRealTimeTriggerActiveChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 26: _t->onRealTimeTriggerColorChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 27: _t->onRealTimeTriggerThresholdChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
case 28: _t->onRealTimeTriggerColorTypeChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 29: _t->onRealTimeTriggerCurrentChChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 30: _t->onToggleHideAll((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 31: _t->onShowFilterOptions((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 32: _t->onUpdateModalityCheckbox((*reinterpret_cast< qint32(*)>(_a[1]))); break;
case 33: _t->onOpacityChange((*reinterpret_cast< qint32(*)>(_a[1]))); break;
case 34: _t->onDistanceTimeSpacerChanged((*reinterpret_cast< qint32(*)>(_a[1]))); break;
case 35: _t->onResetTriggerNumbers(); break;
case 36: _t->onUserFilterToggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 37: _t->onSpharaButtonClicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 38: _t->onSpharaOptionsChanged(); break;
case 39: _t->onViewColorButtonClicked(); break;
case 40: _t->onMakeScreenshot(); break;
case 41: _t->onAveragesChanged(); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
typedef void (QuickControlWidget::*_t)(const QMap<qint32,float> & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::scalingChanged)) {
*result = 0;
return;
}
}
{
typedef void (QuickControlWidget::*_t)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::projSelectionChanged)) {
*result = 1;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(int );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::compSelectionChanged)) {
*result = 2;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::spharaActivationChanged)) {
*result = 3;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QString & , int , int );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::spharaOptionsChanged)) {
*result = 4;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(int );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::timeWindowChanged)) {
*result = 5;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(double );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::zoomChanged)) {
*result = 6;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QMap<double,QColor> & , bool , const QString & , double );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::triggerInfoChanged)) {
*result = 7;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::showFilterOptions)) {
*result = 8;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QList<Modality> & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::settingsChanged)) {
*result = 9;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(int );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::distanceTimeSpacerChanged)) {
*result = 10;
return;
}
}
{
typedef void (QuickControlWidget::*_t)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::resetTriggerCounter)) {
*result = 11;
return;
}
}
{
typedef void (QuickControlWidget::*_t)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::updateConnectedView)) {
*result = 12;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QString & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::compClicked)) {
*result = 13;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QColor & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::signalColorChanged)) {
*result = 14;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QColor & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::backgroundColorChanged)) {
*result = 15;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QString & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::makeScreenshot)) {
*result = 16;
return;
}
}
{
typedef void (QuickControlWidget::*_t)(const QMap<double,QPair<QColor,QPair<QString,bool> > > & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QuickControlWidget::averageInformationChanged)) {
*result = 17;
return;
}
}
}
}
const QMetaObject SCDISPLIB::QuickControlWidget::staticMetaObject = {
{ &RoundedEdgesWidget::staticMetaObject, qt_meta_stringdata_SCDISPLIB__QuickControlWidget.data,
qt_meta_data_SCDISPLIB__QuickControlWidget, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *SCDISPLIB::QuickControlWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *SCDISPLIB::QuickControlWidget::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_SCDISPLIB__QuickControlWidget.stringdata0))
return static_cast<void*>(this);
return RoundedEdgesWidget::qt_metacast(_clname);
}
int SCDISPLIB::QuickControlWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = RoundedEdgesWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 42)
qt_static_metacall(this, _c, _id, _a);
_id -= 42;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 42)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 42;
}
return _id;
}
// SIGNAL 0
void SCDISPLIB::QuickControlWidget::scalingChanged(const QMap<qint32,float> & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void SCDISPLIB::QuickControlWidget::projSelectionChanged()
{
QMetaObject::activate(this, &staticMetaObject, 1, nullptr);
}
// SIGNAL 2
void SCDISPLIB::QuickControlWidget::compSelectionChanged(int _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
// SIGNAL 3
void SCDISPLIB::QuickControlWidget::spharaActivationChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 3, _a);
}
// SIGNAL 4
void SCDISPLIB::QuickControlWidget::spharaOptionsChanged(const QString & _t1, int _t2, int _t3)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) };
QMetaObject::activate(this, &staticMetaObject, 4, _a);
}
// SIGNAL 5
void SCDISPLIB::QuickControlWidget::timeWindowChanged(int _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 5, _a);
}
// SIGNAL 6
void SCDISPLIB::QuickControlWidget::zoomChanged(double _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 6, _a);
}
// SIGNAL 7
void SCDISPLIB::QuickControlWidget::triggerInfoChanged(const QMap<double,QColor> & _t1, bool _t2, const QString & _t3, double _t4)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
QMetaObject::activate(this, &staticMetaObject, 7, _a);
}
// SIGNAL 8
void SCDISPLIB::QuickControlWidget::showFilterOptions(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 8, _a);
}
// SIGNAL 9
void SCDISPLIB::QuickControlWidget::settingsChanged(const QList<Modality> & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 9, _a);
}
// SIGNAL 10
void SCDISPLIB::QuickControlWidget::distanceTimeSpacerChanged(int _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 10, _a);
}
// SIGNAL 11
void SCDISPLIB::QuickControlWidget::resetTriggerCounter()
{
QMetaObject::activate(this, &staticMetaObject, 11, nullptr);
}
// SIGNAL 12
void SCDISPLIB::QuickControlWidget::updateConnectedView()
{
QMetaObject::activate(this, &staticMetaObject, 12, nullptr);
}
// SIGNAL 13
void SCDISPLIB::QuickControlWidget::compClicked(const QString & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 13, _a);
}
// SIGNAL 14
void SCDISPLIB::QuickControlWidget::signalColorChanged(const QColor & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 14, _a);
}
// SIGNAL 15
void SCDISPLIB::QuickControlWidget::backgroundColorChanged(const QColor & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 15, _a);
}
// SIGNAL 16
void SCDISPLIB::QuickControlWidget::makeScreenshot(const QString & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 16, _a);
}
// SIGNAL 17
void SCDISPLIB::QuickControlWidget::averageInformationChanged(const QMap<double,QPair<QColor,QPair<QString,bool> > > & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 17, _a);
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| 43.074703 | 253 | 0.624611 | [
"object"
] |
504df86257f3a1b75449a0724ab4446c0f912c7e | 573 | cpp | C++ | code/exploration_13-COMPOUND_STATEMENTS/02-local_variable_definitions_in_a_nested_block/main.cpp | ordinary-developer/exploring_cpp_11_2_ed_r_lischner | 468de9c64ae54db45c4de748436947d5849c4582 | [
"MIT"
] | 1 | 2017-05-04T08:23:46.000Z | 2017-05-04T08:23:46.000Z | code/exploration_13-COMPOUND_STATEMENTS/02-local_variable_definitions_in_a_nested_block/main.cpp | ordinary-developer/exploring_cpp_11_2_ed_r_lischner | 468de9c64ae54db45c4de748436947d5849c4582 | [
"MIT"
] | null | null | null | code/exploration_13-COMPOUND_STATEMENTS/02-local_variable_definitions_in_a_nested_block/main.cpp | ordinary-developer/exploring_cpp_11_2_ed_r_lischner | 468de9c64ae54db45c4de748436947d5849c4582 | [
"MIT"
] | null | null | null | #include <algorithm>
#include <cassert>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
int main() {
std::vector<int> data{};
data.insert(data.begin(), std::istream_iterator<int>(std::cin),
std::istream_iterator<int>());
std::sort(data.begin(), data.end());
{
std::cout << '{';
std::string separator{" "};
for (int element : data) {
std::cout << separator << element;
separator = ", ";
}
std::cout << " }\n";
}
return 0;
}
| 21.222222 | 67 | 0.506108 | [
"vector"
] |
504ee22f72e457812d09f09928d1168d6e08e30c | 24,873 | cpp | C++ | cmds/statsd/tests/LogEvent_test.cpp | rio-31/android_frameworks_base-1 | 091a068a3288d27d77636708679dde58b7b7fd25 | [
"Apache-2.0"
] | 164 | 2015-01-05T16:49:11.000Z | 2022-03-29T20:40:27.000Z | cmds/statsd/tests/LogEvent_test.cpp | rio-31/android_frameworks_base-1 | 091a068a3288d27d77636708679dde58b7b7fd25 | [
"Apache-2.0"
] | 127 | 2015-01-12T12:02:32.000Z | 2021-11-28T08:46:25.000Z | cmds/statsd/tests/LogEvent_test.cpp | rio-31/android_frameworks_base-1 | 091a068a3288d27d77636708679dde58b7b7fd25 | [
"Apache-2.0"
] | 1,141 | 2015-01-01T22:54:40.000Z | 2022-02-09T22:08:26.000Z | // Copyright (C) 2017 The Android Open Source Project
//
// 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 "src/logd/LogEvent.h"
#include <gtest/gtest.h>
#include <log/log_event_list.h>
#include "frameworks/base/cmds/statsd/src/atoms.pb.h"
#include "frameworks/base/core/proto/android/stats/launcher/launcher.pb.h"
#ifdef __ANDROID__
namespace android {
namespace os {
namespace statsd {
using std::string;
using util::ProtoOutputStream;
using util::ProtoReader;
TEST(LogEventTest, TestLogParsing) {
LogEvent event1(1, 2000);
std::vector<AttributionNodeInternal> nodes;
AttributionNodeInternal node1;
node1.set_uid(1000);
node1.set_tag("tag1");
nodes.push_back(node1);
AttributionNodeInternal node2;
node2.set_uid(2000);
node2.set_tag("tag2");
nodes.push_back(node2);
event1.write(nodes);
event1.write("hello");
event1.write((int32_t)10);
event1.write((int64_t)20);
event1.write((float)1.1);
event1.init();
const auto& items = event1.getValues();
EXPECT_EQ((size_t)8, items.size());
EXPECT_EQ(1, event1.GetTagId());
const FieldValue& item0 = event1.getValues()[0];
EXPECT_EQ(0x2010101, item0.mField.getField());
EXPECT_EQ(Type::INT, item0.mValue.getType());
EXPECT_EQ(1000, item0.mValue.int_value);
const FieldValue& item1 = event1.getValues()[1];
EXPECT_EQ(0x2010182, item1.mField.getField());
EXPECT_EQ(Type::STRING, item1.mValue.getType());
EXPECT_EQ("tag1", item1.mValue.str_value);
const FieldValue& item2 = event1.getValues()[2];
EXPECT_EQ(0x2018201, item2.mField.getField());
EXPECT_EQ(Type::INT, item2.mValue.getType());
EXPECT_EQ(2000, item2.mValue.int_value);
const FieldValue& item3 = event1.getValues()[3];
EXPECT_EQ(0x2018282, item3.mField.getField());
EXPECT_EQ(Type::STRING, item3.mValue.getType());
EXPECT_EQ("tag2", item3.mValue.str_value);
const FieldValue& item4 = event1.getValues()[4];
EXPECT_EQ(0x20000, item4.mField.getField());
EXPECT_EQ(Type::STRING, item4.mValue.getType());
EXPECT_EQ("hello", item4.mValue.str_value);
const FieldValue& item5 = event1.getValues()[5];
EXPECT_EQ(0x30000, item5.mField.getField());
EXPECT_EQ(Type::INT, item5.mValue.getType());
EXPECT_EQ(10, item5.mValue.int_value);
const FieldValue& item6 = event1.getValues()[6];
EXPECT_EQ(0x40000, item6.mField.getField());
EXPECT_EQ(Type::LONG, item6.mValue.getType());
EXPECT_EQ((int64_t)20, item6.mValue.long_value);
const FieldValue& item7 = event1.getValues()[7];
EXPECT_EQ(0x50000, item7.mField.getField());
EXPECT_EQ(Type::FLOAT, item7.mValue.getType());
EXPECT_EQ((float)1.1, item7.mValue.float_value);
}
TEST(LogEventTest, TestKeyValuePairsAtomParsing) {
LogEvent event1(83, 2000, 1000);
std::map<int32_t, int32_t> int_map;
std::map<int32_t, int64_t> long_map;
std::map<int32_t, std::string> string_map;
std::map<int32_t, float> float_map;
int_map[11] = 123;
int_map[22] = 345;
long_map[33] = 678L;
long_map[44] = 890L;
string_map[1] = "test2";
string_map[2] = "test1";
float_map[111] = 2.2f;
float_map[222] = 1.1f;
EXPECT_TRUE(event1.writeKeyValuePairs(0, // Logging side logs 0 uid.
int_map,
long_map,
string_map,
float_map));
event1.init();
EXPECT_EQ(83, event1.GetTagId());
const auto& items = event1.getValues();
EXPECT_EQ((size_t)17, items.size());
const FieldValue& item0 = event1.getValues()[0];
EXPECT_EQ(0x10000, item0.mField.getField());
EXPECT_EQ(Type::INT, item0.mValue.getType());
EXPECT_EQ(1000, item0.mValue.int_value);
const FieldValue& item1 = event1.getValues()[1];
EXPECT_EQ(0x2010201, item1.mField.getField());
EXPECT_EQ(Type::INT, item1.mValue.getType());
EXPECT_EQ(11, item1.mValue.int_value);
const FieldValue& item2 = event1.getValues()[2];
EXPECT_EQ(0x2010282, item2.mField.getField());
EXPECT_EQ(Type::INT, item2.mValue.getType());
EXPECT_EQ(123, item2.mValue.int_value);
const FieldValue& item3 = event1.getValues()[3];
EXPECT_EQ(0x2010301, item3.mField.getField());
EXPECT_EQ(Type::INT, item3.mValue.getType());
EXPECT_EQ(22, item3.mValue.int_value);
const FieldValue& item4 = event1.getValues()[4];
EXPECT_EQ(0x2010382, item4.mField.getField());
EXPECT_EQ(Type::INT, item4.mValue.getType());
EXPECT_EQ(345, item4.mValue.int_value);
const FieldValue& item5 = event1.getValues()[5];
EXPECT_EQ(0x2010401, item5.mField.getField());
EXPECT_EQ(Type::INT, item5.mValue.getType());
EXPECT_EQ(33, item5.mValue.int_value);
const FieldValue& item6 = event1.getValues()[6];
EXPECT_EQ(0x2010483, item6.mField.getField());
EXPECT_EQ(Type::LONG, item6.mValue.getType());
EXPECT_EQ(678L, item6.mValue.int_value);
const FieldValue& item7 = event1.getValues()[7];
EXPECT_EQ(0x2010501, item7.mField.getField());
EXPECT_EQ(Type::INT, item7.mValue.getType());
EXPECT_EQ(44, item7.mValue.int_value);
const FieldValue& item8 = event1.getValues()[8];
EXPECT_EQ(0x2010583, item8.mField.getField());
EXPECT_EQ(Type::LONG, item8.mValue.getType());
EXPECT_EQ(890L, item8.mValue.int_value);
const FieldValue& item9 = event1.getValues()[9];
EXPECT_EQ(0x2010601, item9.mField.getField());
EXPECT_EQ(Type::INT, item9.mValue.getType());
EXPECT_EQ(1, item9.mValue.int_value);
const FieldValue& item10 = event1.getValues()[10];
EXPECT_EQ(0x2010684, item10.mField.getField());
EXPECT_EQ(Type::STRING, item10.mValue.getType());
EXPECT_EQ("test2", item10.mValue.str_value);
const FieldValue& item11 = event1.getValues()[11];
EXPECT_EQ(0x2010701, item11.mField.getField());
EXPECT_EQ(Type::INT, item11.mValue.getType());
EXPECT_EQ(2, item11.mValue.int_value);
const FieldValue& item12 = event1.getValues()[12];
EXPECT_EQ(0x2010784, item12.mField.getField());
EXPECT_EQ(Type::STRING, item12.mValue.getType());
EXPECT_EQ("test1", item12.mValue.str_value);
const FieldValue& item13 = event1.getValues()[13];
EXPECT_EQ(0x2010801, item13.mField.getField());
EXPECT_EQ(Type::INT, item13.mValue.getType());
EXPECT_EQ(111, item13.mValue.int_value);
const FieldValue& item14 = event1.getValues()[14];
EXPECT_EQ(0x2010885, item14.mField.getField());
EXPECT_EQ(Type::FLOAT, item14.mValue.getType());
EXPECT_EQ(2.2f, item14.mValue.float_value);
const FieldValue& item15 = event1.getValues()[15];
EXPECT_EQ(0x2018901, item15.mField.getField());
EXPECT_EQ(Type::INT, item15.mValue.getType());
EXPECT_EQ(222, item15.mValue.int_value);
const FieldValue& item16 = event1.getValues()[16];
EXPECT_EQ(0x2018985, item16.mField.getField());
EXPECT_EQ(Type::FLOAT, item16.mValue.getType());
EXPECT_EQ(1.1f, item16.mValue.float_value);
}
TEST(LogEventTest, TestLogParsing2) {
LogEvent event1(1, 2000);
std::vector<AttributionNodeInternal> nodes;
event1.write("hello");
// repeated msg can be in the middle
AttributionNodeInternal node1;
node1.set_uid(1000);
node1.set_tag("tag1");
nodes.push_back(node1);
AttributionNodeInternal node2;
node2.set_uid(2000);
node2.set_tag("tag2");
nodes.push_back(node2);
event1.write(nodes);
event1.write((int32_t)10);
event1.write((int64_t)20);
event1.write((float)1.1);
event1.init();
const auto& items = event1.getValues();
EXPECT_EQ((size_t)8, items.size());
EXPECT_EQ(1, event1.GetTagId());
const FieldValue& item = event1.getValues()[0];
EXPECT_EQ(0x00010000, item.mField.getField());
EXPECT_EQ(Type::STRING, item.mValue.getType());
EXPECT_EQ("hello", item.mValue.str_value);
const FieldValue& item0 = event1.getValues()[1];
EXPECT_EQ(0x2020101, item0.mField.getField());
EXPECT_EQ(Type::INT, item0.mValue.getType());
EXPECT_EQ(1000, item0.mValue.int_value);
const FieldValue& item1 = event1.getValues()[2];
EXPECT_EQ(0x2020182, item1.mField.getField());
EXPECT_EQ(Type::STRING, item1.mValue.getType());
EXPECT_EQ("tag1", item1.mValue.str_value);
const FieldValue& item2 = event1.getValues()[3];
EXPECT_EQ(0x2028201, item2.mField.getField());
EXPECT_EQ(Type::INT, item2.mValue.getType());
EXPECT_EQ(2000, item2.mValue.int_value);
const FieldValue& item3 = event1.getValues()[4];
EXPECT_EQ(0x2028282, item3.mField.getField());
EXPECT_EQ(Type::STRING, item3.mValue.getType());
EXPECT_EQ("tag2", item3.mValue.str_value);
const FieldValue& item5 = event1.getValues()[5];
EXPECT_EQ(0x30000, item5.mField.getField());
EXPECT_EQ(Type::INT, item5.mValue.getType());
EXPECT_EQ(10, item5.mValue.int_value);
const FieldValue& item6 = event1.getValues()[6];
EXPECT_EQ(0x40000, item6.mField.getField());
EXPECT_EQ(Type::LONG, item6.mValue.getType());
EXPECT_EQ((int64_t)20, item6.mValue.long_value);
const FieldValue& item7 = event1.getValues()[7];
EXPECT_EQ(0x50000, item7.mField.getField());
EXPECT_EQ(Type::FLOAT, item7.mValue.getType());
EXPECT_EQ((float)1.1, item7.mValue.float_value);
}
TEST(LogEventTest, TestKeyValuePairsEvent) {
std::map<int32_t, int32_t> int_map;
std::map<int32_t, int64_t> long_map;
std::map<int32_t, std::string> string_map;
std::map<int32_t, float> float_map;
int_map[11] = 123;
int_map[22] = 345;
long_map[33] = 678L;
long_map[44] = 890L;
string_map[1] = "test2";
string_map[2] = "test1";
float_map[111] = 2.2f;
float_map[222] = 1.1f;
LogEvent event1(83, 2000, 2001, 10001, int_map, long_map, string_map, float_map);
event1.init();
EXPECT_EQ(83, event1.GetTagId());
EXPECT_EQ((int64_t)2000, event1.GetLogdTimestampNs());
EXPECT_EQ((int64_t)2001, event1.GetElapsedTimestampNs());
EXPECT_EQ((int64_t)10001, event1.GetUid());
const auto& items = event1.getValues();
EXPECT_EQ((size_t)17, items.size());
const FieldValue& item0 = event1.getValues()[0];
EXPECT_EQ(0x00010000, item0.mField.getField());
EXPECT_EQ(Type::INT, item0.mValue.getType());
EXPECT_EQ(10001, item0.mValue.int_value);
const FieldValue& item1 = event1.getValues()[1];
EXPECT_EQ(0x2020101, item1.mField.getField());
EXPECT_EQ(Type::INT, item1.mValue.getType());
EXPECT_EQ(11, item1.mValue.int_value);
const FieldValue& item2 = event1.getValues()[2];
EXPECT_EQ(0x2020182, item2.mField.getField());
EXPECT_EQ(Type::INT, item2.mValue.getType());
EXPECT_EQ(123, item2.mValue.int_value);
const FieldValue& item3 = event1.getValues()[3];
EXPECT_EQ(0x2020201, item3.mField.getField());
EXPECT_EQ(Type::INT, item3.mValue.getType());
EXPECT_EQ(22, item3.mValue.int_value);
const FieldValue& item4 = event1.getValues()[4];
EXPECT_EQ(0x2020282, item4.mField.getField());
EXPECT_EQ(Type::INT, item4.mValue.getType());
EXPECT_EQ(345, item4.mValue.int_value);
const FieldValue& item5 = event1.getValues()[5];
EXPECT_EQ(0x2020301, item5.mField.getField());
EXPECT_EQ(Type::INT, item5.mValue.getType());
EXPECT_EQ(33, item5.mValue.int_value);
const FieldValue& item6 = event1.getValues()[6];
EXPECT_EQ(0x2020383, item6.mField.getField());
EXPECT_EQ(Type::LONG, item6.mValue.getType());
EXPECT_EQ(678L, item6.mValue.long_value);
const FieldValue& item7 = event1.getValues()[7];
EXPECT_EQ(0x2020401, item7.mField.getField());
EXPECT_EQ(Type::INT, item7.mValue.getType());
EXPECT_EQ(44, item7.mValue.int_value);
const FieldValue& item8 = event1.getValues()[8];
EXPECT_EQ(0x2020483, item8.mField.getField());
EXPECT_EQ(Type::LONG, item8.mValue.getType());
EXPECT_EQ(890L, item8.mValue.long_value);
const FieldValue& item9 = event1.getValues()[9];
EXPECT_EQ(0x2020501, item9.mField.getField());
EXPECT_EQ(Type::INT, item9.mValue.getType());
EXPECT_EQ(1, item9.mValue.int_value);
const FieldValue& item10 = event1.getValues()[10];
EXPECT_EQ(0x2020584, item10.mField.getField());
EXPECT_EQ(Type::STRING, item10.mValue.getType());
EXPECT_EQ("test2", item10.mValue.str_value);
const FieldValue& item11 = event1.getValues()[11];
EXPECT_EQ(0x2020601, item11.mField.getField());
EXPECT_EQ(Type::INT, item11.mValue.getType());
EXPECT_EQ(2, item11.mValue.int_value);
const FieldValue& item12 = event1.getValues()[12];
EXPECT_EQ(0x2020684, item12.mField.getField());
EXPECT_EQ(Type::STRING, item12.mValue.getType());
EXPECT_EQ("test1", item12.mValue.str_value);
const FieldValue& item13 = event1.getValues()[13];
EXPECT_EQ(0x2020701, item13.mField.getField());
EXPECT_EQ(Type::INT, item13.mValue.getType());
EXPECT_EQ(111, item13.mValue.int_value);
const FieldValue& item14 = event1.getValues()[14];
EXPECT_EQ(0x2020785, item14.mField.getField());
EXPECT_EQ(Type::FLOAT, item14.mValue.getType());
EXPECT_EQ(2.2f, item14.mValue.float_value);
const FieldValue& item15 = event1.getValues()[15];
EXPECT_EQ(0x2028801, item15.mField.getField());
EXPECT_EQ(Type::INT, item15.mValue.getType());
EXPECT_EQ(222, item15.mValue.int_value);
const FieldValue& item16 = event1.getValues()[16];
EXPECT_EQ(0x2028885, item16.mField.getField());
EXPECT_EQ(Type::FLOAT, item16.mValue.getType());
EXPECT_EQ(1.1f, item16.mValue.float_value);
}
TEST(LogEventTest, TestStatsLogEventWrapperNoChain) {
Parcel parcel;
// tag id
parcel.writeInt32(1);
// elapsed realtime
parcel.writeInt64(1111L);
// wallclock time
parcel.writeInt64(2222L);
// no chain
parcel.writeInt32(0);
// 2 data
parcel.writeInt32(2);
// int 6
parcel.writeInt32(1);
parcel.writeInt32(6);
// long 10
parcel.writeInt32(2);
parcel.writeInt64(10);
parcel.setDataPosition(0);
StatsLogEventWrapper statsLogEventWrapper;
EXPECT_EQ(NO_ERROR, statsLogEventWrapper.readFromParcel(&parcel));
EXPECT_EQ(1, statsLogEventWrapper.getTagId());
EXPECT_EQ(1111L, statsLogEventWrapper.getElapsedRealTimeNs());
EXPECT_EQ(2222L, statsLogEventWrapper.getWallClockTimeNs());
EXPECT_EQ(0, statsLogEventWrapper.getWorkChains().size());
EXPECT_EQ(2, statsLogEventWrapper.getElements().size());
EXPECT_EQ(6, statsLogEventWrapper.getElements()[0].int_value);
EXPECT_EQ(10L, statsLogEventWrapper.getElements()[1].long_value);
LogEvent event(statsLogEventWrapper, -1);
EXPECT_EQ(1, event.GetTagId());
EXPECT_EQ(1111L, event.GetElapsedTimestampNs());
EXPECT_EQ(2222L, event.GetLogdTimestampNs());
EXPECT_EQ(2, event.size());
EXPECT_EQ(6, event.getValues()[0].mValue.int_value);
EXPECT_EQ(10, event.getValues()[1].mValue.long_value);
}
TEST(LogEventTest, TestStatsLogEventWrapperWithChain) {
Parcel parcel;
// tag id
parcel.writeInt32(1);
// elapsed realtime
parcel.writeInt64(1111L);
// wallclock time
parcel.writeInt64(2222L);
// 3 chains
parcel.writeInt32(3);
// chain1, 2 nodes (1, "tag1") (2, "tag2")
parcel.writeInt32(2);
parcel.writeInt32(1);
parcel.writeString16(String16("tag1"));
parcel.writeInt32(2);
parcel.writeString16(String16("tag2"));
// chain2, 1 node (3, "tag3")
parcel.writeInt32(1);
parcel.writeInt32(3);
parcel.writeString16(String16("tag3"));
// chain3, 2 nodes (4, "") (5, "")
parcel.writeInt32(2);
parcel.writeInt32(4);
parcel.writeString16(String16(""));
parcel.writeInt32(5);
parcel.writeString16(String16(""));
// 2 data
parcel.writeInt32(2);
// int 6
parcel.writeInt32(1);
parcel.writeInt32(6);
// long 10
parcel.writeInt32(2);
parcel.writeInt64(10);
parcel.setDataPosition(0);
StatsLogEventWrapper statsLogEventWrapper;
EXPECT_EQ(NO_ERROR, statsLogEventWrapper.readFromParcel(&parcel));
EXPECT_EQ(1, statsLogEventWrapper.getTagId());
EXPECT_EQ(1111L, statsLogEventWrapper.getElapsedRealTimeNs());
EXPECT_EQ(2222L, statsLogEventWrapper.getWallClockTimeNs());
EXPECT_EQ(3, statsLogEventWrapper.getWorkChains().size());
EXPECT_EQ(2, statsLogEventWrapper.getWorkChains()[0].uids.size());
EXPECT_EQ(1, statsLogEventWrapper.getWorkChains()[0].uids[0]);
EXPECT_EQ(2, statsLogEventWrapper.getWorkChains()[0].uids[1]);
EXPECT_EQ(2, statsLogEventWrapper.getWorkChains()[0].tags.size());
EXPECT_EQ("tag1", statsLogEventWrapper.getWorkChains()[0].tags[0]);
EXPECT_EQ("tag2", statsLogEventWrapper.getWorkChains()[0].tags[1]);
EXPECT_EQ(1, statsLogEventWrapper.getWorkChains()[1].uids.size());
EXPECT_EQ(3, statsLogEventWrapper.getWorkChains()[1].uids[0]);
EXPECT_EQ(1, statsLogEventWrapper.getWorkChains()[1].tags.size());
EXPECT_EQ("tag3", statsLogEventWrapper.getWorkChains()[1].tags[0]);
EXPECT_EQ(2, statsLogEventWrapper.getElements().size());
EXPECT_EQ(6, statsLogEventWrapper.getElements()[0].int_value);
EXPECT_EQ(10L, statsLogEventWrapper.getElements()[1].long_value);
EXPECT_EQ(2, statsLogEventWrapper.getWorkChains()[2].uids.size());
EXPECT_EQ(4, statsLogEventWrapper.getWorkChains()[2].uids[0]);
EXPECT_EQ(5, statsLogEventWrapper.getWorkChains()[2].uids[1]);
EXPECT_EQ(2, statsLogEventWrapper.getWorkChains()[2].tags.size());
EXPECT_EQ("", statsLogEventWrapper.getWorkChains()[2].tags[0]);
EXPECT_EQ("", statsLogEventWrapper.getWorkChains()[2].tags[1]);
LogEvent event(statsLogEventWrapper, -1);
EXPECT_EQ(1, event.GetTagId());
EXPECT_EQ(1111L, event.GetElapsedTimestampNs());
EXPECT_EQ(2222L, event.GetLogdTimestampNs());
EXPECT_EQ(2, event.size());
EXPECT_EQ(6, event.getValues()[0].mValue.int_value);
EXPECT_EQ(10, event.getValues()[1].mValue.long_value);
LogEvent event1(statsLogEventWrapper, 0);
EXPECT_EQ(1, event1.GetTagId());
EXPECT_EQ(1111L, event1.GetElapsedTimestampNs());
EXPECT_EQ(2222L, event1.GetLogdTimestampNs());
EXPECT_EQ(6, event1.size());
EXPECT_EQ(1, event1.getValues()[0].mValue.int_value);
EXPECT_EQ(0x2010101, event1.getValues()[0].mField.getField());
EXPECT_EQ("tag1", event1.getValues()[1].mValue.str_value);
EXPECT_EQ(0x2010182, event1.getValues()[1].mField.getField());
EXPECT_EQ(2, event1.getValues()[2].mValue.int_value);
EXPECT_EQ(0x2010201, event1.getValues()[2].mField.getField());
EXPECT_EQ("tag2", event1.getValues()[3].mValue.str_value);
EXPECT_EQ(0x2018282, event1.getValues()[3].mField.getField());
EXPECT_EQ(6, event1.getValues()[4].mValue.int_value);
EXPECT_EQ(0x20000, event1.getValues()[4].mField.getField());
EXPECT_EQ(10, event1.getValues()[5].mValue.long_value);
EXPECT_EQ(0x30000, event1.getValues()[5].mField.getField());
LogEvent event2(statsLogEventWrapper, 1);
EXPECT_EQ(1, event2.GetTagId());
EXPECT_EQ(1111L, event2.GetElapsedTimestampNs());
EXPECT_EQ(2222L, event2.GetLogdTimestampNs());
EXPECT_EQ(4, event2.size());
EXPECT_EQ(3, event2.getValues()[0].mValue.int_value);
EXPECT_EQ(0x2010101, event2.getValues()[0].mField.getField());
EXPECT_EQ("tag3", event2.getValues()[1].mValue.str_value);
EXPECT_EQ(0x2018182, event2.getValues()[1].mField.getField());
EXPECT_EQ(6, event2.getValues()[2].mValue.int_value);
EXPECT_EQ(0x20000, event2.getValues()[2].mField.getField());
EXPECT_EQ(10, event2.getValues()[3].mValue.long_value);
EXPECT_EQ(0x30000, event2.getValues()[3].mField.getField());
LogEvent event3(statsLogEventWrapper, 2);
EXPECT_EQ(1, event3.GetTagId());
EXPECT_EQ(1111L, event3.GetElapsedTimestampNs());
EXPECT_EQ(2222L, event3.GetLogdTimestampNs());
EXPECT_EQ(6, event3.size());
EXPECT_EQ(4, event3.getValues()[0].mValue.int_value);
EXPECT_EQ(0x2010101, event3.getValues()[0].mField.getField());
EXPECT_EQ("", event3.getValues()[1].mValue.str_value);
EXPECT_EQ(0x2010182, event3.getValues()[1].mField.getField());
EXPECT_EQ(5, event3.getValues()[2].mValue.int_value);
EXPECT_EQ(0x2010201, event3.getValues()[2].mField.getField());
EXPECT_EQ("", event3.getValues()[3].mValue.str_value);
EXPECT_EQ(0x2018282, event3.getValues()[3].mField.getField());
EXPECT_EQ(6, event3.getValues()[4].mValue.int_value);
EXPECT_EQ(0x20000, event3.getValues()[4].mField.getField());
EXPECT_EQ(10, event3.getValues()[5].mValue.long_value);
EXPECT_EQ(0x30000, event3.getValues()[5].mField.getField());
}
TEST(LogEventTest, TestBinaryFieldAtom) {
Atom launcherAtom;
auto launcher_event = launcherAtom.mutable_launcher_event();
launcher_event->set_action(stats::launcher::LauncherAction::LONGPRESS);
launcher_event->set_src_state(stats::launcher::LauncherState::OVERVIEW);
launcher_event->set_dst_state(stats::launcher::LauncherState::ALLAPPS);
auto extension = launcher_event->mutable_extension();
auto src_target = extension->add_src_target();
src_target->set_type(stats::launcher::LauncherTarget_Type_ITEM_TYPE);
src_target->set_item(stats::launcher::LauncherTarget_Item_FOLDER_ICON);
auto dst_target = extension->add_dst_target();
dst_target->set_type(stats::launcher::LauncherTarget_Type_ITEM_TYPE);
dst_target->set_item(stats::launcher::LauncherTarget_Item_WIDGET);
string extension_str;
extension->SerializeToString(&extension_str);
LogEvent event1(Atom::kLauncherEventFieldNumber, 1000);
event1.write((int32_t)stats::launcher::LauncherAction::LONGPRESS);
event1.write((int32_t)stats::launcher::LauncherState::OVERVIEW);
event1.write((int64_t)stats::launcher::LauncherState::ALLAPPS);
event1.write(extension_str);
event1.init();
ProtoOutputStream proto;
event1.ToProto(proto);
std::vector<uint8_t> outData;
outData.resize(proto.size());
size_t pos = 0;
sp<ProtoReader> reader = proto.data();
while (reader->readBuffer() != NULL) {
size_t toRead = reader->currentToRead();
std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
pos += toRead;
reader->move(toRead);
}
std::string result_str(outData.begin(), outData.end());
std::string orig_str;
launcherAtom.SerializeToString(&orig_str);
EXPECT_EQ(orig_str, result_str);
}
TEST(LogEventTest, TestBinaryFieldAtom_empty) {
Atom launcherAtom;
auto launcher_event = launcherAtom.mutable_launcher_event();
launcher_event->set_action(stats::launcher::LauncherAction::LONGPRESS);
launcher_event->set_src_state(stats::launcher::LauncherState::OVERVIEW);
launcher_event->set_dst_state(stats::launcher::LauncherState::ALLAPPS);
// empty string.
string extension_str;
LogEvent event1(Atom::kLauncherEventFieldNumber, 1000);
event1.write((int32_t)stats::launcher::LauncherAction::LONGPRESS);
event1.write((int32_t)stats::launcher::LauncherState::OVERVIEW);
event1.write((int64_t)stats::launcher::LauncherState::ALLAPPS);
event1.write(extension_str);
event1.init();
ProtoOutputStream proto;
event1.ToProto(proto);
std::vector<uint8_t> outData;
outData.resize(proto.size());
size_t pos = 0;
sp<ProtoReader> reader = proto.data();
while (reader->readBuffer() != NULL) {
size_t toRead = reader->currentToRead();
std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
pos += toRead;
reader->move(toRead);
}
std::string result_str(outData.begin(), outData.end());
std::string orig_str;
launcherAtom.SerializeToString(&orig_str);
EXPECT_EQ(orig_str, result_str);
}
TEST(LogEventTest, TestWriteExperimentIdsToProto) {
std::vector<int64_t> expIds;
expIds.push_back(5038);
std::vector<uint8_t> proto;
writeExperimentIdsToProto(expIds, &proto);
EXPECT_EQ(proto.size(), 3);
// Proto wire format for field ID 1, varint
EXPECT_EQ(proto[0], 0x08);
// varint of 5038, 2 bytes long
EXPECT_EQ(proto[1], 0xae);
EXPECT_EQ(proto[2], 0x27);
}
} // namespace statsd
} // namespace os
} // namespace android
#else
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif
| 37.123881 | 85 | 0.695654 | [
"vector"
] |
5068027d40751c18aec93d039e028ea5d2b6a5c4 | 4,730 | cpp | C++ | test_results/scripts/plot_cov_along_path.cpp | ethz-asl/crowdbot_active_slam | 007f1a730e06cea0aaf653dc2f024da1169b9c9e | [
"MIT"
] | 21 | 2019-10-03T10:05:53.000Z | 2022-01-30T06:27:05.000Z | test_results/scripts/plot_cov_along_path.cpp | ethz-asl/crowdbot_active_slam | 007f1a730e06cea0aaf653dc2f024da1169b9c9e | [
"MIT"
] | 1 | 2020-06-07T08:12:40.000Z | 2020-06-08T14:40:13.000Z | test_results/scripts/plot_cov_along_path.cpp | ethz-asl/crowdbot_active_slam | 007f1a730e06cea0aaf653dc2f024da1169b9c9e | [
"MIT"
] | 5 | 2019-11-24T15:15:32.000Z | 2022-01-20T07:53:01.000Z | #include <iostream>
#include <fstream>
#include <plotty/matplotlibcpp.hpp>
#include <ros/ros.h>
#include <ros/package.h>
void getUncertainty(std::string file_path, std::vector<double>& uncertainty_vec,
std::vector<double>& path_length_vec){
std::ifstream cov_file(file_path.c_str());
int i = 0;
double path_length, xx, xy, xtheta, yy, ytheta, thetatheta;
std::string line;
if (cov_file.is_open()){
while (std::getline(cov_file, line)){
if (i == 0){
// Get new values
std::stringstream ss;
ss << line;
ss >> path_length >> xx >> xy >> xtheta;
path_length_vec.push_back(path_length);
}
else if (i % 3 == 0){
// Calculate and save sigma (D-optimality)
Eigen::MatrixXd covariance_temp(3, 3);
covariance_temp << xx, xy, xtheta,
xy, yy, ytheta,
xtheta, ytheta, thetatheta;
Eigen::VectorXcd eivals = covariance_temp.eigenvalues();
double sum_of_logs = log(eivals[0].real()) +
log(eivals[1].real()) +
log(eivals[2].real());
double sigma_temp = exp(1.0 / 3.0 * sum_of_logs);
uncertainty_vec.push_back(sigma_temp);
// Get new values
std::stringstream ss;
ss << line;
ss >> path_length >> xx >> xy >> xtheta;
path_length_vec.push_back(path_length);
}
else if (i % 3 == 1){
// Get new values
std::stringstream ss;
ss << line;
ss >> xy >> yy >> ytheta;
}
else if (i % 3 == 2){
// Get new values
std::stringstream ss;
ss << line;
ss >> xtheta >> ytheta >> thetatheta;
}
i += 1;
}
// Calculate and save last sigma (D-optimality)
Eigen::MatrixXd covariance_temp(3, 3);
covariance_temp << xx, xy, xtheta,
xy, yy, ytheta,
xtheta, ytheta, thetatheta;
Eigen::VectorXcd eivals = covariance_temp.eigenvalues();
double sum_of_logs = log(eivals[0].real()) +
log(eivals[1].real()) +
log(eivals[2].real());
double sigma_temp = exp(1.0 / 3.0 * sum_of_logs);
uncertainty_vec.push_back(sigma_temp);
}
else {
ROS_INFO("Failed to open file!");
}
}
int main(int argc, char **argv)
{
// Get path and file name
std::string package_path = ros::package::getPath("crowdbot_active_slam");
std::string general_results_path;
if (argc == 2){
general_results_path = package_path + "/" + argv[1] + "/general_results.txt";
}
int nr_of_tests = argc;
std::vector<std::vector<double>> uncertainty_vecs;
std::vector<std::vector<double>> path_length_vecs;
std::vector<std::string> paths;
for (int i = 1; i < nr_of_tests; i++){
paths.push_back(package_path + "/" + argv[i] + "uncertainty_matrices.txt");
std::vector<double> uncertainty_vec;
std::vector<double> path_length_vec;
getUncertainty(paths[i - 1], uncertainty_vec, path_length_vec);
uncertainty_vecs.push_back(uncertainty_vec);
path_length_vecs.push_back(path_length_vec);
}
if (argc == 2){
std::ifstream result_file_in(general_results_path.c_str());
std::string result_file_string = "";
std::string line;
std::string node_number = "Node number";
if (result_file_in.is_open()){
while (std::getline(result_file_in, line)){
if (line.find(node_number) != std::string::npos){
result_file_string += "Node number: " + std::to_string(uncertainty_vecs[0].size()) + '\n';
}
else {
result_file_string += line + '\n';
}
}
result_file_in.close();
}
else {
ROS_INFO("Could not open general_results(input file).txt!");
}
std::ofstream result_file_out(general_results_path.c_str());
if (result_file_out.is_open()){
result_file_out << result_file_string;
}
else {
ROS_INFO("Could not open general_results(output file).txt!");
}
}
// Print node number
std::cout << "Node number: " << uncertainty_vecs[0].size() << std::endl;
// Plot results
for (int i = 1; i < nr_of_tests; i++){
if (i < 6){
plotty::plot(path_length_vecs[i - 1], uncertainty_vecs[i - 1], "b");
}
else if (i < 11){
plotty::plot(path_length_vecs[i - 1], uncertainty_vecs[i - 1], "r");
}
else {
plotty::plot(path_length_vecs[i - 1], uncertainty_vecs[i - 1], "g");
}
}
plotty::xlabel("path length [m]");
plotty::ylabel("sigma [1]");
// plotty::save(package_path + + "/" + argv[1] + "/uncertainy_along_path.png");
plotty::show();
return 0;
}
| 31.118421 | 100 | 0.578858 | [
"vector"
] |
506b531156a16942195379bcf7261ed6b612c46b | 997 | cpp | C++ | main.cpp | dubzzz/gtest-using-cmake-example | 8c49876c7251d36f296c30a095aed4ed19e93160 | [
"MIT"
] | 3 | 2018-12-13T22:42:20.000Z | 2019-09-19T05:42:51.000Z | main.cpp | dubzzz/gtest-using-cmake-example | 8c49876c7251d36f296c30a095aed4ed19e93160 | [
"MIT"
] | null | null | null | main.cpp | dubzzz/gtest-using-cmake-example | 8c49876c7251d36f296c30a095aed4ed19e93160 | [
"MIT"
] | null | null | null | #include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
#include "gtest/gtest.h" // gtest must be build using /MTd or /MT -DCMAKE_CXX_FLAGS_DEBUG="/MTd"
std::vector<unsigned long long> build_factorials(unsigned num)
{
if (num == 0)
{
return {};
}
std::vector<unsigned long long> vs(num);
vs[0] = 1;
std::iota(std::next(std::begin(vs)), std::end(vs), 1);
std::transform(std::begin(vs), std::prev(std::end(vs))
, std::next(std::begin(vs))
, std::next(std::begin(vs))
, std::multiplies<unsigned long long>());
return vs;
}
TEST(TEST_NAME, NoValue)
{
std::vector<unsigned long long> expected = { };
ASSERT_EQ(expected, build_factorials(0));
}
TEST(TEST_NAME, SpecificNumberOfValues)
{
std::vector<unsigned long long> expected = { 1, 1, 2, 6, 24, 120, 720 };
ASSERT_EQ(expected, build_factorials(7));
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
int ret { RUN_ALL_TESTS() };
return ret;
}
| 23.738095 | 96 | 0.651956 | [
"vector",
"transform"
] |
50704b69528fdad45ead1c8534446959d45ccec2 | 6,077 | cpp | C++ | OpenSees/SRC/reliability/analysis/stepSize/ArmijoStepSizeRule.cpp | kuanshi/ductile-fracture | ccb350564df54f5c5ec3a079100effe261b46650 | [
"MIT"
] | 8 | 2019-03-05T16:25:10.000Z | 2020-04-17T14:12:03.000Z | SRC/reliability/analysis/stepSize/ArmijoStepSizeRule.cpp | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | null | null | null | SRC/reliability/analysis/stepSize/ArmijoStepSizeRule.cpp | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | 3 | 2019-09-21T03:11:11.000Z | 2020-01-19T07:29:37.000Z | /* ****************************************************************** **
** OpenSees - Open System for Earthquake Engineering Simulation **
** Pacific Earthquake Engineering Research Center **
** **
** **
** (C) Copyright 2001, The Regents of the University of California **
** All Rights Reserved. **
** **
** Commercial use of this program without express permission of the **
** University of California, Berkeley, is strictly prohibited. See **
** file 'COPYRIGHT' in main directory for information on usage and **
** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
** **
** Developed by: **
** Frank McKenna (fmckenna@ce.berkeley.edu) **
** Gregory L. Fenves (fenves@ce.berkeley.edu) **
** Filip C. Filippou (filippou@ce.berkeley.edu) **
** **
** Reliability module developed by: **
** Terje Haukaas (haukaas@ce.berkeley.edu) **
** Armen Der Kiureghian (adk@ce.berkeley.edu) **
** **
** ****************************************************************** */
// $Revision: 1.8 $
// $Date: 2010-09-13 21:35:07 $
// $Source: /usr/local/cvs/OpenSees/SRC/reliability/analysis/stepSize/ArmijoStepSizeRule.cpp,v $
//
// Written by:
// Kevin Mackie (kmackie@mail.ucf.edu)
// Michael Scott (mhscott@engr.orst.edu)
//
#include <ArmijoStepSizeRule.h>
#include <FunctionEvaluator.h>
#include <StepSizeRule.h>
#include <MeritFunctionCheck.h>
#include <RootFinding.h>
#include <math.h>
#include <Vector.h>
ArmijoStepSizeRule::ArmijoStepSizeRule(ReliabilityDomain *passedRelDomain,
FunctionEvaluator *passedGFunEvaluator,
ProbabilityTransformation *passedProbabilityTransformation,
MeritFunctionCheck *passedMeritFunctionCheck,
RootFinding *passedRootFindingAlgorithm,
double Pbase,
int PmaxNumReductions,
double Pb0,
int PnumberOfShortSteps,
double Pradius,
double PsurfaceDistance,
double Pevolution,
int pprintFlag)
:StepSizeRule()
{
theReliabilityDomain = passedRelDomain;
theGFunEvaluator = passedGFunEvaluator;
theProbabilityTransformation = passedProbabilityTransformation;
theMeritFunctionCheck = passedMeritFunctionCheck;
theRootFindingAlgorithm = passedRootFindingAlgorithm;
base = Pbase;
maxNumReductions = PmaxNumReductions;
b0 = Pb0;
numberOfShortSteps = PnumberOfShortSteps;
radius = Pradius;
surfaceDistance = PsurfaceDistance;
evolution = Pevolution;
printFlag = pprintFlag;
isCloseToSphere = false;
isOutsideSphere = false;
isSecondTime = false;
FEconvergence = false;
}
ArmijoStepSizeRule::~ArmijoStepSizeRule()
{
}
int
ArmijoStepSizeRule::initialize()
{
isCloseToSphere = false;
numReduction = 0;
FEconvergence = false;
return 0;
}
double
ArmijoStepSizeRule::getStepSize()
{
return stepSize;
}
double
ArmijoStepSizeRule::getInitialStepSize()
{
return b0;
}
int
ArmijoStepSizeRule::computeStepSize(const Vector &u_old,
const Vector &grad_G_old,
double g_old,
const Vector &dir_old,
int stepNumber,
int reschk)
{
// Check if this potentially could be the second time close to the surface
if (isCloseToSphere)
isSecondTime = true;
else
isSecondTime = false;
// Set the first trial step size
if (stepNumber <= numberOfShortSteps) {
stepSize = b0;
return 0;
}
// begin step size reduction
numReduction++;
stepSize = pow(base,numReduction);
// Inform the user
if (printFlag != 0) {
opserr << "Armijo starting gFun evaluation at distance " << u_old.Norm() << "..." << endln
<< " .......: ";
}
if (u_old.Norm() > radius) {
isOutsideSphere = true;
// Set some dummy values to 'g' and 'gradG'; it doesn't matter
// that the merit functions then will be 'wrong'; the step will
// fail in any case because it is outside the sphere.
//g_new = g_old;
//grad_G_new = grad_G_old;
// Inform the user
if (printFlag != 0) {
opserr << "Armijo skipping gFun evaluation because of hyper sphere requirement..." << endln
<< " .......: ";
}
}
else {
isOutsideSphere = false;
// Register where this u was close to the sphere surface
if (u_old.Norm() > radius-surfaceDistance &&
u_old.Norm() < radius+surfaceDistance) {
isCloseToSphere = true;
if (isSecondTime) {
radius = radius + evolution;
}
}
else {
isCloseToSphere = false;
}
}
// KRM 4/9/2012
// things that are missing here include previous call to theRootFindingAlgorithm and
// use of the meritFunctionCheck. Also need (potentially) to retain the ability to not
// evaluate the next g function if deemed out of the hypersphere here in the stepSize.
// Already possible, but designPointAlgorith needs some logic based on return value here.
// check exit status
if (numReduction > maxNumReductions) {
return 0;
}
return 1;
}
/////S added by K Fujimura /////
int
ArmijoStepSizeRule::getNumReductions()
{
return numReduction;
}
/////E added by K Fujimura /////
| 30.233831 | 103 | 0.549778 | [
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.