hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 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 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 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 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
55a1403817ca4bce43b4cc7f9a766496af14f577 | 12,986 | cpp | C++ | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 32 | 2015-09-02T22:56:22.000Z | 2021-02-24T17:15:50.000Z | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 30 | 2015-04-26T18:35:07.000Z | 2021-06-06T09:57:02.000Z | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 11 | 2015-09-03T20:47:41.000Z | 2021-06-25T17:00:01.000Z | /*
Copyright (c) 2016 Alexandru-Mihai Maftei. All rights reserved.
Developed by: Alexandru-Mihai Maftei
aka Vercas
http://vercas.com | https://github.com/vercas/Beelzebub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal with 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:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of Alexandru-Mihai Maftei, Vercas, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
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
CONTRIBUTORS 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
WITH THE SOFTWARE.
---
You may also find the text of this license in "LICENSE.md", along with a more
thorough explanation regarding other files.
*/
#ifdef __BEELZEBUB__TEST_BIGINT
#include <beel/utils/bigint.hpp>
#include <math.h>
#include <debug.hpp>
using namespace Beelzebub;
using namespace Beelzebub::Utils;
typedef BigUInt<15> BIT;
void TestBigInt()
{
BIT a = 5ULL, b = 55ULL, c;
c = a + b;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 60U, c.Data[0]);
ASSERT_EQ("%u4", 0U, c.Data[1]);
c += b;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 115U, c.Data[0]);
ASSERT_EQ("%u4", 0U, c.Data[1]);
BIT d = 0xFFFFFFFAULL;
c += d;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 0x6DU, c.Data[0]);
ASSERT_EQ("%u4", 1U, c.Data[1]);
BIT e = 0xFFFFFFFFFFFFFFFFULL;
c += e;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0x6CU, c.Data[0]);
ASSERT_EQ("%u4", 1U, c.Data[1]);
ASSERT_EQ("%u4", 1U, c.Data[2]);
c += c;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD8U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 2U, c.Data[2]);
c -= a;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD3U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 2U, c.Data[2]);
b -= a;
ASSERT_EQ("%u4", 2U, b.CurrentSize);
ASSERT_EQ("%u4", 50U, b.Data[0]);
ASSERT_EQ("%u4", 0U, b.Data[1]);
c -= e;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD4U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 1U, c.Data[2]);
d = a * b;
ASSERT_EQ("%u4", 4U, d.CurrentSize);
ASSERT_EQ("%u4", 250U, d.Data[0]);
ASSERT_EQ("%u4", 0U, d.Data[1]);
ASSERT_EQ("%u4", 0U, d.Data[2]);
ASSERT_EQ("%u4", 0U, d.Data[3]);
d.Data[2] = 3;
BIT f = c, g = c * d;
ASSERT_EQ("%u4", 7U, g.CurrentSize);
ASSERT_EQ("%u4", 53000U, g.Data[0]);
ASSERT_EQ("%u4", 500U, g.Data[1]);
ASSERT_EQ("%u4", 886U, g.Data[2]);
ASSERT_EQ("%u4", 6U, g.Data[3]);
ASSERT_EQ("%u4", 3U, g.Data[4]);
ASSERT_EQ("%u4", 0U, g.Data[5]);
ASSERT_EQ("%u4", 0U, g.Data[6]);
c *= d;
ASSERT_EQ("%u4", 53000U, f.Data[0] * d.Data[0]);
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%u4", 53000U, c.Data[0]);
ASSERT_EQ("%u4", 500U, c.Data[1]);
ASSERT_EQ("%u4", 886U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 3U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
// Now overflow propagation.
ASSERT_EQ("%u4", 2U, e.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[1]);
f = e * e;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
e *= e;
ASSERT_EQ("%u4", 4U, e.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, e.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, e.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, e.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[3]);
e += b;
ASSERT_EQ("%u4", 4U, e.CurrentSize);
ASSERT_EQ("%X4", 0x00000033U, e.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, e.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, e.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[3]);
f = e - b;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
c += f;
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%u4", 53001U, c.Data[0]);
ASSERT_EQ("%u4", 500U, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
BIT h = 0xFFFFFFFFFFFFFFFFULL;
f = f + h;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
f += h;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
f += h;
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[3]);
ASSERT_EQ("%X4", 0x00000001U, f.Data[4]);
f = f - h;
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f = f | h; // Should basically remain unchanged.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f |= h; // And again.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f &= h; // Mostly changed.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f = f & h; // And a size reduction.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
f ^= h; // Nulling out.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
f = f ^ h; // And restoring.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
c = c ^ f; // Funky.
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%X4", 0xFFFF30F6U, c.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFE0BU, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
c |= f; // Less funky.
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, c.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
BIT i = ~c;
ASSERT_EQ("%u4", 7U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFF9U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFFFBU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
i <<= 36;
ASSERT_EQ("%u4", 9U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFFC8B0U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFF9FU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFBFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[7]);
ASSERT_EQ("%X4", 0x0000000FU, i.Data[8]);
i = i << 4;
ASSERT_EQ("%u4", 9U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFC8B00U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFF9FFU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFBFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[7]);
ASSERT_EQ("%X4", 0x000000FFU, i.Data[8]);
i = i >> 36;
ASSERT_EQ("%u4", 8U, i.CurrentSize);
ASSERT_EQ("%X4", 0x0000000FU, i.Data[7]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFBFU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFF9FU, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFC8B0U, i.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
i >>= 4;
ASSERT_EQ("%u4", 7U, i.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFBU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFF9U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, i.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
BIT j = i[4];
ASSERT_EQ("%u4", 4U, j.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFF9U, j.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, j.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, j.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, j.Data[0]);
BIT k = 0xFFFFFFF9FFFFFC8BU, l = j >> 999, m = 0U;
ASSERTX( k == (j >> 64) , "Expected equality." )XEND;
ASSERTX(!(k == (j >> 63)), "Expected inequality.")XEND;
ASSERTX( k != (j >> 63) , "Expected inequality.")XEND;
ASSERT_EQ("%u4", 0U, l.CurrentSize);
ASSERT_EQ("%u4", 2U, m.CurrentSize);
ASSERTX(m == 0U)XEND;
// , "Expected equality [%X4:%X4:%X4:%X4]."
// , m.Data[3], m.Data[2], m.Data[1], m.Data[0]);
ASSERTX(l == m)XEND;
// , "Expected equality [%u4 %X4:%X4:%X4:%X4] vs [%u4 %X4:%X4:%X4:%X4].%n%i4%n"
// , l.CurrentSize, l.Data[3], l.Data[2], l.Data[1], l.Data[0]
// , m.CurrentSize, m.Data[3], m.Data[2], m.Data[1], m.Data[0]
// , BigIntCmp(&(l.Data[0]), l.CurrentSize, &(m.Data[0]), m.CurrentSize));
ASSERTX(l == 0U)XEND;
// , "Expected equality [%X4:%X4:%X4:%X4]."
// , l.Data[3], l.Data[2], l.Data[1], l.Data[0]);
ASSERTX(i > j)XEND; ASSERTX(i >= j)XEND;
ASSERTX(j < i)XEND; ASSERTX(j <= i)XEND;
ASSERTX(i > k)XEND; ASSERTX(i >= k)XEND;
ASSERTX(j > k)XEND; ASSERTX(j >= k)XEND;
}
#endif
| 32.710327 | 87 | 0.569844 | vercas |
55a1b52862820322526616c3d1d946a6fd97b712 | 7,104 | cpp | C++ | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | 3 | 2015-12-21T09:04:49.000Z | 2015-12-21T19:22:47.000Z | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | #include <iostream>
#include <unistd.h>
#include "../../../dist/cppframework.hh"
static void tcpServer(fwk::System* system, uint16_t port) {
int i = 0;
try {
fwk::TcpServer& server = fwk::NetworkManager::get().getTCP().createServer(port);
server.events.onAccept.subscribe([] (fwk::TcpSocketStream*) {
INFO("New client connected");
}, &i);
server.events.onReceivedData.subscribe([] (fwk::TcpSocketStream*) {
INFO("Received data");
}, &i);
server.events.onClientClosed.subscribe([] (fwk::TcpSocketStream*) {
INFO("Client closed");
}, &i);
server.events.onClosed.subscribe([] (fwk::TcpSocket*) {
INFO("Server closed");
}, &i);
fwk::NetworkManager::get().getTCP().run(server);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void tcpClient(fwk::System* system, const std::string& hostname, uint16_t port) {
try {
int i = 0;
fwk::TcpClient& client = fwk::NetworkManager::get().getTCP().createClient(hostname, port);
client.events.onReceivedData.subscribe([] (fwk::TcpSocketStream*) {
INFO("Received data");
}, &i);
client.events.onClosed.subscribe([] (fwk::TcpSocketStream*) {
INFO("Connection closed");
}, &i);
fwk::NetworkManager::get().getTCP().run(client);
fwk::NetworkManager::get().getTCP().push(client.socket, (void*)"Hello\n", 6);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void udpServer(fwk::System* system, uint16_t port) {
int i = 0;
try {
fwk::UdpServer& server = fwk::NetworkManager::get().getUDP().createServer(port);
// on accept new socket callback
server.events.onNewClient.subscribe([] (fwk::UdpSocketClient*) {
INFO("New client connected");
}, &i);
// on received data callback
server.events.onReceivedData.subscribe([] (fwk::UdpSocketClient*) {
INFO("Received data");
}, &i);
// on client closed callback
server.events.onClientClosed.subscribe([] (fwk::UdpSocketClient*) {
INFO("Client closed");
}, &i);
// on server closed callback
server.events.onClosed.subscribe([] (fwk::UdpSocketServer*) {
INFO("Server closed");
}, &i);
fwk::NetworkManager::get().getUDP().run(server);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void udpClient(fwk::System* system, const std::string& hostname, uint16_t port) {
try {
int i = 0;
fwk::UdpClient& client = fwk::NetworkManager::get().getUDP().createClient(hostname, port);
client.events.onReceivedData.subscribe([] (fwk::UdpSocketStream*) {
INFO("Received data");
}, &i);
client.events.onClosed.subscribe([] (fwk::UdpSocketStream*) {
INFO("Connection closed");
}, &i);
fwk::NetworkManager::get().getUDP().run(client);
fwk::NetworkManager::get().getUDP().push(client.socket, (void*)"Hello", 5);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void http(fwk::System* system) {
fwk::HttpRequest* request;
fwk::HttpConnection* connection = fwk::HttpClient::get().initConnection(
"jsonplaceholder.typicode.com",
80,
fwk::HttpProtocol::HTTP,
true);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} {} / Size: {}", response->status, response->reason, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
connection->run();
system->run();
}
int main(int ac, char ** av) {
if ((ac != 2 && ac != 3 && ac != 4) || (std::string(av[1]) != "http" && std::string(av[1]) != "tcp" && std::string(av[1]) != "udp" && std::string(av[1]) != "delayed" && std::string(av[1]) != "periodic" && std::string(av[1]) != "simple")) {
std::cerr << "usage: " << av[0] << " \"http\"|\"tcp\"|\"udp\" HOSTNAME PORT || " << av[0] << " PORT" << std::endl;
return -1;
}
fwk::LoggerManager::get().init("cppframework", fwk::Logger::Level::DEBUG);
fwk::System* system = new fwk::System();
fwk::Signal::get().setCallback(fwk::Signal::Type::INT, [&] (void) -> bool {
INFO("Caught SIGINT, exiting.");
system->end();
return false;
});
std::string protocol = av[1];
if (protocol == "udp") {
system->initUDP();
if (ac == 3) {
// udp server
udpServer(system, StringToUInt16(av[2]));
} else if (ac == 4) {
// udp client
udpClient(system, av[2], StringToUInt16(av[3]));
} else {
std::cerr << "invalid nb of arguments" << std::endl;
}
} else if (protocol == "tcp") {
system->initTCP();
if (ac == 3) {
// tcp server
tcpServer(system, StringToUInt16(av[2]));
} else if (ac == 4) {
// tcp client
tcpClient(system, av[2], StringToUInt16(av[3]));
} else {
std::cerr << "invalid nb of arguments" << std::endl;
}
} else if (protocol == "http") {
system->initHTTP("test useragent");
http(system);
} else if (protocol == "delayed") {
system->initWorkerThreads(1, true);
fwk::WorkerManager::get().addDelayedTask(fwk::SimpleTask::getFromPool([] (void) {
INFO("SimpleTask working");
}), std::chrono::seconds(2));
system->run();
} else if (protocol == "periodic") {
system->initWorkerThreads(1, true);
fwk::WorkerManager::get().addPeriodicTask([] (void) {
INFO("Hello");
}, nullptr, std::chrono::seconds(5), true);
system->run();
} else if (protocol == "simple") {
fwk::WorkerManager::get().addSimpleTask([] (void) {
INFO("SimpleTask :)");
});
system->run();
} else {
std::cerr << "unknown protocol" << std::endl;
}
delete system;
return 0;
}
| 29.974684 | 241 | 0.603322 | gautier-lefebvre |
55a2bb439617f4cb6979e752cd110e3ca6a748ed | 291 | hpp | C++ | include/aw/util/log/message.hpp | AlexAUT/rocketWar | edea1c703755e198b1ad8909c82e5d8d56c443ef | [
"MIT"
] | null | null | null | include/aw/util/log/message.hpp | AlexAUT/rocketWar | edea1c703755e198b1ad8909c82e5d8d56c443ef | [
"MIT"
] | null | null | null | include/aw/util/log/message.hpp | AlexAUT/rocketWar | edea1c703755e198b1ad8909c82e5d8d56c443ef | [
"MIT"
] | null | null | null | #pragma once
#include <aw/util/log/level.hpp>
#include <string>
#include <fmt/format.h>
namespace aw::log
{
struct Message
{
const char* module;
const char* fileName;
int lineNumber;
const char* functionName;
Level level;
fmt::memory_buffer message;
};
} // namespace aw::log
| 14.55 | 32 | 0.701031 | AlexAUT |
55a86c5cf49b250d2aec738c971545b6158131cf | 2,454 | cpp | C++ | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | /*
Name: Daniel Pinedo
Class: CS 2
Assignment #: 3
All Compilers Used: VS17
Operating Systems on Which Compiled: Win10
Date and Time of Last successful run: 10/4/2017 @0345
Email: d.p@ieee.org
*/
#include "FractionList.h"
FractionList::FractionList() : num_elements(0), isSorted(false)
{
}
void FractionList::addFraction(const Fraction & F)
{
if (num_elements == MAX) {
cout << "List is full." << endl;
return;
}
List[num_elements] = F;
num_elements++;
}
const string FractionList::toString() const
{
string temp = "";
for (size_t i = 0; i < num_elements; i++) {
temp += List[i].toString();
}
return temp;
}
void FractionList::sort()
{
for (size_t i = 0; i < num_elements; i++) {
for (size_t j = 0; j < num_elements - 1 - i; j++) {
if (List[j].toDouble() > List[j + 1].toDouble()) {
Fraction temp = List[j];
List[j] = List[j + 1];
List[j + 1] = temp;
}
}
}
isSorted = true;
}
bool FractionList::isEmpty() const
{
return (num_elements == 0);
}
bool FractionList::isFull() const
{
return (num_elements == MAX);
}
size_t FractionList::getNumberOfElements() const
{
return num_elements;
}
istream & operator >> (istream & in, FractionList & FL)
{
FractionList::getInstance(FL, in);
return in;
}
ostream & operator << (ostream & out, FractionList & FL)
{
for (size_t i = 0; i < FL.num_elements; i++) {
out << FL.List[i];
}
return out;
}
void FractionList::getInstance(FractionList & FL, istream & in = cin)
{
if (&in == &cin) {
bool done = false;
while (!done && (FL.num_elements < FractionList::MAX)) {
Fraction temp(0);
cin.ignore(20, '\n');
cin >> temp;
FL.addFraction(temp);
cout << "More fractions? Enter 0 to continue or 1 to stop: ";
cin >> done;
}
}
else {
while ((in.peek() != EOF) && (FL.num_elements < FractionList::MAX)) {
Fraction temp(0);
in >> temp;
FL.addFraction(temp);
}
}
}
const Fraction FractionList::getLargest()
{
if (isSorted) {
return List[num_elements - 1];
}
else {
sort();
return List[num_elements - 1];
}
}
const Fraction FractionList::getSumOfFractions()
{
Fraction temp(0);
for (size_t i = 0; i < num_elements; i++) {
temp = temp + List[i];
}
return temp;
}
bool FractionList::getSortState() const
{
return isSorted;
}
Fraction FractionList::operator [] (size_t index) const
{
if (index < num_elements) {
return List[index];
}
throw "Out of bounds array at index";
}
FractionList::~FractionList()
{
}
| 18.313433 | 71 | 0.635697 | odenipinedo |
55ad6c4ef114d36b75863024a6778d960a834f74 | 1,045 | cpp | C++ | mystery/src/graphics/vertex_array.cpp | joaovsq/mystery | 302df8b0ab36b5d4cac163dfa8f3177599461fcd | [
"Apache-2.0"
] | null | null | null | mystery/src/graphics/vertex_array.cpp | joaovsq/mystery | 302df8b0ab36b5d4cac163dfa8f3177599461fcd | [
"Apache-2.0"
] | null | null | null | mystery/src/graphics/vertex_array.cpp | joaovsq/mystery | 302df8b0ab36b5d4cac163dfa8f3177599461fcd | [
"Apache-2.0"
] | null | null | null | #include "vertex_array.hpp"
#include "vertex_buffer_layout.hpp"
#include "index_buffer.hpp"
namespace mystery {
namespace graphics {
VertexArray::VertexArray()
{
glGenVertexArrays(1, &m_VertexArrayID);
}
VertexArray::~VertexArray()
{
glDeleteVertexArrays(1, &m_VertexArrayID);
}
void VertexArray::AddBuffer(const VertexBuffer &vertex_buffer, const VertexBufferLayout &layout)
{
Bind();
vertex_buffer.Bind();
const std::vector<VertexBufferElement> elements = layout.GetElements();
for (unsigned int i = 0; i < elements.size(); i++) {
const auto& element = elements[i];
unsigned int offset = 0;
glEnableVertexAttribArray(i);
glVertexAttribPointer(i, element.count, element.type, element.normalized, layout.GetStride(), (const void*)offset);
offset += element.count * VertexBufferElement::GetSizeOfType(element.type);
}
}
void VertexArray::Bind() const
{
glBindVertexArray(m_VertexArrayID);
}
void VertexArray::Unbind() const
{
glBindVertexArray(0);
}
}
} | 20.9 | 119 | 0.702392 | joaovsq |
55b3cd6b93a7279163db4755860b4a680cb50e44 | 2,568 | cpp | C++ | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 327 | 2015-01-02T19:25:13.000Z | 2022-03-07T21:25:48.000Z | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 13 | 2015-01-14T23:35:43.000Z | 2016-02-07T16:13:18.000Z | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 72 | 2015-01-01T11:11:23.000Z | 2021-12-28T06:52:10.000Z | #include <mintomic/mintomic.h>
#include <mintpack/random.h>
#include <mintpack/timewaster.h>
#include <mintpack/threadsynchronizer.h>
#include <assert.h>
#include <string.h>
#define ELEMENT(index) ((index) >> ${TEST_INT_BITSHIFT})
#define BIT(index) ((uint${TEST_INT_BITSIZE}_t) 1 << ((index) & (${TEST_INT_BITSIZE} - 1)))
static int g_success;
static const int kDataBitSize = ${TEST_DATA_SIZE};
static mint_atomic${TEST_INT_BITSIZE}_t* g_data;
static int* g_indices;
static int g_numThreads;
static void threadFunc(int threadNum)
{
// Decide upon index range and number of times to iterate
int lo = kDataBitSize * threadNum / g_numThreads;
int hi = kDataBitSize * (threadNum + 1) / g_numThreads;
int times = 10000000 / kDataBitSize;
TimeWaster tw(threadNum);
for (int i = 0; i < times; i++)
{
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
mint_fetch_or_${TEST_INT_BITSIZE}_relaxed(&g_data[ELEMENT(index)], BIT(index));
tw.wasteRandomCycles();
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
if ((g_data[ELEMENT(index)]._nonatomic & BIT(index)) == 0)
g_success = 0;
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
mint_fetch_and_${TEST_INT_BITSIZE}_relaxed(&g_data[ELEMENT(index)], ~BIT(index));
tw.wasteRandomCycles();
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
if ((g_data[ELEMENT(index)]._nonatomic & BIT(index)) != 0)
g_success = 0;
}
}
}
bool ${TEST_FUNC}(int numThreads)
{
g_success = 1;
g_numThreads = numThreads;
// Create bit array and clear it
assert((kDataBitSize & 63) == 0);
g_data = new mint_atomic${TEST_INT_BITSIZE}_t[kDataBitSize / ${TEST_INT_BITSIZE}];
memset(g_data, 0, kDataBitSize / 8);
// Create index array
g_indices = new int[kDataBitSize];
for (int i = 0; i < kDataBitSize; i++)
g_indices[i] = i;
// Shuffle the index array
Random random;
for (int i = 0; i < kDataBitSize; i++)
{
int swap = random.generate32() % (kDataBitSize - i);
int temp = g_indices[i];
g_indices[i] = g_indices[swap];
g_indices[swap] = temp;
}
// Launch threads
ThreadSynchronizer threads(numThreads);
threads.run(threadFunc);
// Clean up
delete[] g_data;
delete[] g_indices;
return g_success != 0;
}
| 28.21978 | 93 | 0.589564 | ehei1 |
55b966e8f247353ca6746bcadbe3bae3102f5136 | 892 | cpp | C++ | libs/libzkutil/src/tests/zkutil_zookeeper_holder.cpp | 189569400/ClickHouse | 0b8683c8c9f0e17446bef5498403c39e9cb483b8 | [
"Apache-2.0"
] | null | null | null | libs/libzkutil/src/tests/zkutil_zookeeper_holder.cpp | 189569400/ClickHouse | 0b8683c8c9f0e17446bef5498403c39e9cb483b8 | [
"Apache-2.0"
] | null | null | null | libs/libzkutil/src/tests/zkutil_zookeeper_holder.cpp | 189569400/ClickHouse | 0b8683c8c9f0e17446bef5498403c39e9cb483b8 | [
"Apache-2.0"
] | 2 | 2018-11-29T11:15:02.000Z | 2019-04-12T16:56:31.000Z | #include <zkutil/ZooKeeperHolder.h>
#include <iostream>
#include <Poco/Util/Application.h>
int main()
{
// Test::initLogger();
zkutil::ZooKeeperHolder zk_holder;
zk_holder.init("localhost:2181");
{
auto zk_handler = zk_holder.getZooKeeper();
if (zk_handler)
{
bool started_new_session = zk_holder.replaceZooKeeperSessionToNewOne();
std::cerr << "Started new session: " << started_new_session << "\n";
std::cerr << "get / " << zk_handler->get("/") << "\n";
}
}
{
bool started_new_session = zk_holder.replaceZooKeeperSessionToNewOne();
std::cerr << "Started new session: " << started_new_session << "\n";
auto zk_handler = zk_holder.getZooKeeper();
if (zk_handler != nullptr)
std::cerr << "get / " << zk_handler->get("/") << "\n";
}
return 0;
}
| 27.030303 | 83 | 0.580717 | 189569400 |
55ba31f466600245ba2761bb123ea27c471afd00 | 646 | cpp | C++ | EVENTS/UI/RecordSelection.cpp | claudioperez/R2DTool | 7afa6bac42fe40a378878bda2efff423ac242e68 | [
"BSD-2-Clause"
] | 7 | 2019-02-09T13:09:10.000Z | 2020-10-31T18:01:41.000Z | EVENTS/UI/RecordSelection.cpp | claudioperez/R2DTool | 7afa6bac42fe40a378878bda2efff423ac242e68 | [
"BSD-2-Clause"
] | 1 | 2021-06-04T01:07:52.000Z | 2021-06-06T20:43:44.000Z | EVENTS/UI/RecordSelection.cpp | claudioperez/R2DTool | 7afa6bac42fe40a378878bda2efff423ac242e68 | [
"BSD-2-Clause"
] | 12 | 2018-09-06T22:29:58.000Z | 2020-09-21T18:42:54.000Z | #include "RecordSelection.h"
RecordSelection::RecordSelection(QObject *parent) : QObject(parent)
{
m_recordId = -1;
m_scaleFactor = 0.0;
}
int RecordSelection::recordId() const
{
return m_recordId;
}
void RecordSelection::setRecordId(int recordId)
{
if(m_recordId != recordId)
{
m_recordId = recordId;
emit recordChanged(m_recordId);
}
}
double RecordSelection::scaleFactor() const
{
return m_scaleFactor;
}
void RecordSelection::setScaleFactor(double scaleFactor)
{
if(m_scaleFactor != scaleFactor)
{
m_scaleFactor = scaleFactor;
emit scaleChanged(m_scaleFactor);
}
}
| 17.944444 | 67 | 0.685759 | claudioperez |
55bbc358cefbdfda93859d14d6f84cacb949dc08 | 4,865 | cpp | C++ | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | null | null | null | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | null | null | null | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | 1 | 2018-10-06T05:02:45.000Z | 2018-10-06T05:02:45.000Z | /*
* Copyright (c) 2014, peelo.net
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <peelo/number/ratio.hpp>
namespace peelo
{
static inline int64_t gcd(int64_t a, int64_t b)
{
return b == 0 ? a : gcd(b, a % b);
}
ratio::ratio()
: m_numerator(0)
, m_denominator(0) {}
ratio::ratio(const ratio& that)
: m_numerator(that.m_numerator)
, m_denominator(that.m_denominator) {}
ratio::ratio(int64_t numerator, int64_t denominator)
throw(std::domain_error)
: m_numerator(0)
, m_denominator(0)
{
if (denominator == 0)
{
throw std::domain_error("division by zero");
}
const int64_t g = gcd(numerator, denominator);
m_numerator = numerator / g;
m_denominator = denominator / g;
}
ratio& ratio::assign(const ratio& that)
{
m_numerator = that.m_numerator;
m_denominator = that.m_denominator;
return *this;
}
bool ratio::equals(const ratio& that) const
{
return m_numerator == that.m_numerator
&& m_denominator == that.m_denominator;
}
int ratio::compare(const ratio& that) const
{
const int64_t a = m_numerator * that.m_numerator;
const int64_t b = m_denominator * that.m_denominator;
return a < b ? -1 : a > b ? 1 : 0;
}
ratio ratio::operator-() const
{
return ratio(-m_numerator, m_denominator);
}
ratio ratio::operator+(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator + m_denominator * that.m_denominator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator+(int64_t n) const
{
return operator+(ratio(n));
}
ratio ratio::operator-(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator - m_denominator * that.m_denominator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator-(int64_t n) const
{
return operator-(ratio(n));
}
ratio ratio::operator*(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator*(int64_t n) const
{
return operator*(ratio(n));
}
ratio ratio::operator/(const ratio& that) const
{
return ratio(
m_numerator * that.m_denominator,
m_denominator * that.m_numerator
);
}
ratio ratio::operator/(int64_t n) const
{
return operator/(ratio(n));
}
ratio& ratio::operator+=(const ratio& that)
{
return *this;
}
ratio& ratio::operator+=(int64_t n)
{
return operator+=(ratio(n));
}
ratio& ratio::operator-=(const ratio& that)
{
return *this;
}
ratio& ratio::operator-=(int64_t n)
{
return operator-=(ratio(n));
}
ratio& ratio::operator*=(const ratio& that)
{
return *this;
}
ratio& ratio::operator*=(int64_t n)
{
return operator*=(ratio(n));
}
ratio& ratio::operator/=(const ratio& that)
{
return *this;
}
ratio& ratio::operator/=(int64_t n)
{
return operator/=(ratio(n));
}
std::ostream& operator<<(std::ostream& os, const class ratio& ratio)
{
os << ratio.numerator() << '/' << ratio.denominator();
return os;
}
}
| 26.297297 | 84 | 0.612333 | peelonet |
55c16bef9d6e1bcfb465455be82e6c3eecf84335 | 3,787 | cpp | C++ | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Sliver -- Zero-copy management of bytes.
*
* See sliver.hpp for design details.
*/
#include "sliver.hpp"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <ios>
#include <memory>
#include "consensus/hex_tools.h"
namespace concord {
namespace consensus {
/**
* Create an empty sliver.
*/
Sliver::Sliver() : m_data(nullptr), m_offset(0), m_length(0) {}
/**
* Create a new sliver that will own the memory pointed to by `data`, which is
* `length` bytes in size.
*
* Important: the `data` buffer should have been allocated with `new`, and not
* `malloc`, because the shared pointer will use `delete` and not `free`.
*/
Sliver::Sliver(uint8_t* data, const size_t length)
: m_data(data, std::default_delete<uint8_t[]>()),
m_offset(0),
m_length(length) {
// Data must be non-null.
assert(data);
}
Sliver::Sliver(char* data, const size_t length)
: m_data(reinterpret_cast<uint8_t*>(data),
std::default_delete<uint8_t[]>()),
m_offset(0),
m_length(length) {
// Data must be non-null.
assert(data);
}
/**
* Create a sub-sliver that references a region of a base sliver.
*/
Sliver::Sliver(const Sliver& base, const size_t offset, const size_t length)
: m_data(base.m_data),
// This sliver starts offset bytes from the offset of its base.
m_offset(base.m_offset + offset),
m_length(length) {
// This sliver must start no later than the end of the base sliver.
assert(offset <= base.m_length);
// This sliver must end no later than the end of the base sliver.
assert(length <= base.m_length - offset);
}
/**
* Get the byte at `offset` in this sliver.
*/
uint8_t Sliver::operator[](const size_t offset) const {
// This offset must be within this sliver.
assert(offset < m_length);
// The data for the requested offset is that many bytes after the offset from
// the base sliver.
return m_data.get()[m_offset + offset];
}
/**
* Get a direct pointer to the data for this sliver. Remember that the Sliver
* (or its base) still owns the data, so ensure that the lifetime of this Sliver
* (or its base) is at least as long as the lifetime of the returned pointer.
*/
uint8_t* Sliver::data() const { return m_data.get() + m_offset; }
/**
* Create a subsliver. Syntactic sugar for cases where a function call is more
* natural than using the sub-sliver constructor directly.
*/
Sliver Sliver::subsliver(const size_t offset, const size_t length) const {
return Sliver(*this, offset, length);
}
size_t Sliver::length() const { return m_length; }
std::ostream& Sliver::operator<<(std::ostream& s) const {
return hexPrint(s, data(), length());
}
std::ostream& operator<<(std::ostream& s, const Sliver& sliver) {
return sliver.operator<<(s);
}
/**
* Slivers are == if their lengths are the same, and each byte of their data is
* the same.
*/
bool Sliver::operator==(const Sliver& other) const {
// This could be just "compare(other) == 0", but the short-circuit of checking
// lengths first can save us many cycles in some cases.
return length() == other.length() &&
memcmp(data(), other.data(), length()) == 0;
}
/**
* a.compare(b) is:
* - 0 if lengths are the same, and bytes are the same
* - -1 if bytes are the same, but a is shorter
* - 1 if bytes are the same, but a is longer
*/
int Sliver::compare(const Sliver& other) const {
int comp = memcmp(data(), other.data(), std::min(length(), other.length()));
if (comp == 0) {
if (length() < other.length()) {
comp = -1;
} else if (length() > other.length()) {
comp = 1;
}
}
return comp;
}
} // namespace consensus
} // namespace concord
| 28.473684 | 80 | 0.667019 | beerriot |
55c198449268a5b7ebfd22023399226b5bf3369f | 228 | cpp | C++ | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | /*
* main.cpp
*
* Created on: 20 Dec 2013
* Author: bert
*/
#include "Application.h"
int main() {
Tetris3D::Application* app = new Tetris3D::Application();
app->Init();
app->Run();
delete app;
return 0;
}
| 10.363636 | 58 | 0.587719 | robbor78 |
55c3c51ea93de32d97b92712a0ef8b75bd475e90 | 426 | cpp | C++ | src/cpp/ax/name.cpp | bryanedds/ax | 3a84ea729341a31754078f68adc091dce59edc97 | [
"MIT"
] | 12 | 2016-02-04T12:29:05.000Z | 2019-01-16T05:49:32.000Z | src/cpp/ax/name.cpp | bryanedds/ax | 3a84ea729341a31754078f68adc091dce59edc97 | [
"MIT"
] | 12 | 2016-02-08T19:52:14.000Z | 2019-08-26T06:58:16.000Z | src/cpp/ax/name.cpp | bryanedds/ax | 3a84ea729341a31754078f68adc091dce59edc97 | [
"MIT"
] | 2 | 2016-02-08T15:55:29.000Z | 2020-01-06T08:23:45.000Z | #include "ax/name.hpp"
#include "ax/hash.hpp"
namespace ax
{
name::name(const char* name_str) : name(std::string(name_str)) { }
name::name(const std::string& name_str) : hash_code(get_hash(name_str)), name_str(name_str) { }
name::name(std::string&& name_str) : hash_code(get_hash(name_str)), name_str(name_str) { }
bool name::operator==(const ax::name& that) const { return name_str == that.name_str; }
}
| 28.4 | 99 | 0.676056 | bryanedds |
55c3f45c2955619e2b1d1c5d5a9e28969c810ee3 | 6,576 | hpp | C++ | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 1,570 | 2016-06-30T10:40:04.000Z | 2022-03-31T01:47:33.000Z | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 9 | 2017-01-16T07:09:08.000Z | 2020-08-25T18:28:59.000Z | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 253 | 2016-06-30T18:57:10.000Z | 2022-03-25T03:57:40.000Z | // Copyright 2021 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef VK_TIMELINE_SEMAPHORE_HPP_
#define VK_TIMELINE_SEMAPHORE_HPP_
#include "VkConfig.hpp"
#include "VkObject.hpp"
#include "VkSemaphore.hpp"
#include "marl/conditionvariable.h"
#include "marl/mutex.h"
#include "System/Synchronization.hpp"
#include <chrono>
namespace vk {
struct Shared;
// Timeline Semaphores track a 64-bit payload instead of a binary payload.
//
// A timeline does not have a "signaled" and "unsignalled" state. Threads instead wait
// for the payload to become a certain value. When a thread signals the timeline, it provides
// a new payload that is greater than the current payload.
//
// There is no way to reset a timeline or to decrease the payload's value. A user must instead
// create a new timeline with a new initial payload if they desire this behavior.
class TimelineSemaphore : public Semaphore, public Object<TimelineSemaphore, VkSemaphore>
{
public:
TimelineSemaphore(const VkSemaphoreCreateInfo *pCreateInfo, void *mem, const VkAllocationCallbacks *pAllocator);
TimelineSemaphore();
static size_t ComputeRequiredAllocationSize(const VkSemaphoreCreateInfo *pCreateInfo);
// Block until this semaphore is signaled with the specified value;
void wait(uint64_t value);
// Wait until a certain amount of time has passed or until the specified value is signaled.
template<class CLOCK, class DURATION>
VkResult wait(uint64_t value, const std::chrono::time_point<CLOCK, DURATION> end_ns);
// Set the payload to the specified value and signal all waiting threads.
void signal(uint64_t value);
// Retrieve the current payload. This should not be used to make thread execution decisions
// as there's no guarantee that the value returned here matches the actual payload's value.
uint64_t getCounterValue();
// Dependent timeline semaphores allow an 'any' semaphore to be created that can wait on the
// state of multiple other timeline semaphores and be signaled like a binary semaphore
// if any of its parent semaphores are signaled with a certain value.
//
// Since a timeline semaphore can be signalled with nearly any value, but threads waiting
// on a timeline semaphore only unblock when a specific value is signaled, dependents can't
// naively become signaled whenever their parent semaphores are signaled with a new value.
// Instead, the dependent semaphore needs to wait for its parent semaphore to be signaled
// with a specific value as well. This specific value may differ for each parent semaphore.
//
// So this function adds other as a dependent semaphore, and tells it to only become unsignaled
// by this semaphore when this semaphore is signaled with waitValue.
void addDependent(TimelineSemaphore &other, uint64_t waitValue);
void addDependency(int id, uint64_t waitValue);
// Tells this semaphore to become signaled as part of a dependency chain when the parent semaphore
// with the specified id is signaled with the specified waitValue.
void addToWaitMap(int parentId, uint64_t waitValue);
// Clean up any allocated resources
void destroy(const VkAllocationCallbacks *pAllocator);
private:
// Track the 64-bit payload. Timeline Semaphores have a shared_ptr<Shared>
// that they can pass to other Timeline Semaphores to create dependency chains.
struct Shared
{
private:
// Guards access to all the resources that may be accessed by other threads.
// No clang Thread Safety Analysis is used on variables guarded by mutex
// as there is an issue with TSA. Despite instrumenting everything properly,
// compilation will fail when a lambda function uses a guarded resource.
marl::mutex mutex;
static std::atomic<int> nextId;
public:
Shared(marl::Allocator *allocator, uint64_t initialState);
// Block until this semaphore is signaled with the specified value;
void wait(uint64_t value);
// Wait until a certain amount of time has passed or until the specified value is signaled.
template<class CLOCK, class DURATION>
VkResult wait(uint64_t value, const std::chrono::time_point<CLOCK, DURATION> end_ns);
// Pass a signal down to a dependent.
void signal(int parentId, uint64_t value);
// Set the payload to the specified value and signal all waiting threads.
void signal(uint64_t value);
// Retrieve the current payload. This should not be used to make thread execution decisions
// as there's no guarantee that the value returned here matches the actual payload's value.
uint64_t getCounterValue();
// Add the other semaphore's Shared to deps.
void addDependent(TimelineSemaphore &other);
// Add {id, waitValue} as a key-value pair to waitMap.
void addDependency(int id, uint64_t waitValue);
// Entry point to the marl threading library that handles blocking and unblocking.
marl::ConditionVariable cv;
// TODO(b/181683382) -- Add Thread Safety Analysis instrumentation when it can properly
// analyze lambdas.
// The 64-bit payload.
uint64_t counter;
// A list of this semaphore's dependents.
marl::containers::vector<std::shared_ptr<Shared>, 1> deps;
// A map of {parentId: waitValue} pairs that tracks when this semaphore should unblock if it's
// signaled as a dependent by another semaphore.
std::map<int, uint64_t> waitMap;
// An ID that's unique for each instance of Shared
const int id;
};
std::shared_ptr<Shared> shared;
};
template<typename Clock, typename Duration>
VkResult TimelineSemaphore::wait(uint64_t value,
const std::chrono::time_point<Clock, Duration> timeout)
{
return shared->wait(value, timeout);
}
template<typename Clock, typename Duration>
VkResult TimelineSemaphore::Shared::wait(uint64_t value,
const std::chrono::time_point<Clock, Duration> timeout)
{
marl::lock lock(mutex);
if(!cv.wait_until(lock, timeout, [&]() { return counter == value; }))
{
return VK_TIMEOUT;
}
return VK_SUCCESS;
}
} // namespace vk
#endif // VK_TIMELINE_SEMAPHORE_HPP_
| 39.377246 | 113 | 0.756083 | sunnycase |
55c42a09001231832430ab515221e62db87f5a28 | 1,537 | hpp | C++ | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | #ifndef FUNCTOOLS_TEST_TUPLE_HASH_HPP_INCUDED
#define FUNCTOOLS_TEST_TUPLE_HASH_HPP_INCUDED
#include <boost/functional/hash.hpp>
#include <tuple>
// =====================================================================================================================
namespace std
{
template<typename T>
struct hash<std::tuple<T>>
{
size_t operator() (const std::tuple<T>& tup) const
{
return std::hash<T>()(std::get<0>(tup));
}
};
template<typename T1, typename T2>
struct hash<std::pair<T1, T2>>
{
size_t operator() (const std::pair<T1, T2>& p) const
{
size_t h = 0;
boost::hash_combine(h, p.first);
boost::hash_combine(h, p.second);
return h;
}
};
template<typename T1, typename T2>
struct hash<std::tuple<T1, T2>>
{
size_t operator() (const std::tuple<T1, T2>& tup) const
{
size_t h = 0;
boost::hash_combine(h, std::get<0>(tup));
boost::hash_combine(h, std::get<1>(tup));
return h;
}
};
template<typename T1, typename T2, typename T3>
struct hash<std::tuple<T1, T2, T3>>
{
size_t operator() (const std::tuple<T1, T2, T3>& tup) const
{
size_t h = 0;
boost::hash_combine(h, std::get<0>(tup));
boost::hash_combine(h, std::get<1>(tup));
boost::hash_combine(h, std::get<2>(tup));
return h;
}
};
}
#endif
| 26.5 | 120 | 0.488614 | gkoszegi |
55c48e32ed7d56897cd90e2126cffd8b2f874b31 | 4,045 | cc | C++ | src/ParticleShifter.cc | touuki/sovol | b2e4d7bcf335b9cb97b5e1ad799cb405a93f2ddb | [
"MIT"
] | null | null | null | src/ParticleShifter.cc | touuki/sovol | b2e4d7bcf335b9cb97b5e1ad799cb405a93f2ddb | [
"MIT"
] | null | null | null | src/ParticleShifter.cc | touuki/sovol | b2e4d7bcf335b9cb97b5e1ad799cb405a93f2ddb | [
"MIT"
] | 1 | 2022-01-22T15:14:02.000Z | 2022-01-22T15:14:02.000Z | #include "ParticleShifter.hh"
#include "Rotator.hh"
class CustomParticleShifter : public ParticleShifter {
#ifdef __EMSCRIPTEN__
private:
emscripten::val func;
public:
CustomParticleShifter(emscripten::val v) : func(v["func"]){};
void operator()(Particle &p) const override {
emscripten::val result = func(p.toEmscriptenVal());
if (!result["position"].isUndefined()) {
p.position = Vector3<double>(result["position"]);
}
if (!result["momentum"].isUndefined()) {
p.momentum = Vector3<double>(result["momentum"]);
}
if (!result["polarization"].isUndefined()) {
p.polarization = Vector3<double>(result["polarization"]);
}
};
~CustomParticleShifter(){};
#else
private:
std::string global_function_name;
public:
CustomParticleShifter(Lua &lua)
: global_function_name(
lua.getField<std::string>("global_function_name")){};
void operator()(Particle &p) const override {
Lua &lua = Lua::getInstance();
lua.visitGlobal(global_function_name.c_str());
lua.call(1, p);
p.position = lua.getField("position", p.position);
p.momentum = lua.getField("momentum", p.momentum);
p.polarization = lua.getField("polarization", p.polarization);
lua.leaveTable();
};
#endif
};
REGISTER_MULTITON(ParticleShifter, CustomParticleShifter)
class ParticleTranslator : public ParticleShifter {
private:
Vector3<double> displacement;
public:
ParticleTranslator(const Vector3<double> &_displacement)
: displacement(_displacement){};
#ifdef __EMSCRIPTEN__
ParticleTranslator(emscripten::val v) : displacement(v["displacement"]){};
#else
ParticleTranslator(Lua &lua)
: displacement(lua.getField<Vector3<double> >("displacement")){};
#endif
void operator()(Particle &p) const override { p.position += displacement; };
};
REGISTER_MULTITON(ParticleShifter, ParticleTranslator)
class ParticleRotator : public ParticleShifter {
private:
Vector3<double> center;
std::shared_ptr<Rotator> rotator;
bool affect_position;
bool affect_momentum;
bool affect_polarization;
public:
ParticleRotator(const Vector3<double> &_center,
const std::shared_ptr<Rotator> &_rotator,
bool _affect_position = true, bool _affect_momentum = true,
bool _affect_polarization = true)
: center(_center),
rotator(_rotator),
affect_position(_affect_position),
affect_momentum(_affect_momentum),
affect_polarization(_affect_polarization){};
#ifdef __EMSCRIPTEN__
ParticleRotator(emscripten::val v)
: center(v["center"].isUndefined() ? Vector3<double>::zero
: Vector3<double>(v["center"])),
rotator(Rotator::createObject(v["rotator"])),
affect_position(v["affect_position"].isUndefined()
? true
: v["affect_position"].as<bool>()),
affect_momentum(v["affect_momentum"].isUndefined()
? true
: v["affect_momentum"].as<bool>()),
affect_polarization(v["affect_polarization"].isUndefined()
? true
: v["affect_polarization"].as<bool>()){};
#else
ParticleRotator(Lua &lua)
: center(lua.getField("center", Vector3<double>::zero)),
rotator(lua.getField<std::shared_ptr<Rotator> >("rotator")),
affect_position(lua.getField("affect_position", true)),
affect_momentum(lua.getField("affect_momentum", true)),
affect_polarization(lua.getField("affect_polarization", true)){};
#endif
void operator()(Particle &p) const override {
if (affect_position) {
p.position = center + rotator->operator()(p.position - center);
}
if (affect_momentum) {
p.momentum = rotator->operator()(p.momentum);
}
if (affect_polarization) {
p.polarization = rotator->operator()(p.polarization);
}
};
};
REGISTER_MULTITON(ParticleShifter, ParticleRotator)
| 33.155738 | 78 | 0.650927 | touuki |
55c515700b7ba80f217aaafba2ca2fa875d9ac94 | 1,596 | cpp | C++ | UVa 10140 - Prime Distance/sample/10140 - Prime Distance.cpp | tadvi/uva | 0ac0cbdf593879b4fb02a3efc09adbb031cb47d5 | [
"MIT"
] | 1 | 2020-11-24T03:17:21.000Z | 2020-11-24T03:17:21.000Z | UVa 10140 - Prime Distance/sample/10140 - Prime Distance.cpp | tadvi/uva | 0ac0cbdf593879b4fb02a3efc09adbb031cb47d5 | [
"MIT"
] | null | null | null | UVa 10140 - Prime Distance/sample/10140 - Prime Distance.cpp | tadvi/uva | 0ac0cbdf593879b4fb02a3efc09adbb031cb47d5 | [
"MIT"
] | 1 | 2021-04-11T16:22:31.000Z | 2021-04-11T16:22:31.000Z | #include <stdio.h>
#include <math.h>
#define maxL (1000000>>5)+1
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
int mark[maxL];
int p[700000], pt = 0;
void sieve() {
register int i, j, k;
SET(1);
int n = 1000000;
for(i = 2; i <= n; i++) {
if(!GET(i)) {
p[pt++] = i;
for(k = n/i, j = i*k; k >= i; k--, j -= i)
SET(j);
}
}
}
int isprime(int n) {
if(n < 1000000)
return !GET(n);
static int sq, i;
sq = (int)sqrt(n);
for(i = 0; i < pt && p[i] <= sq; i++)
if(n%p[i] == 0)
return 0;
return 1;
}
int main() {
sieve();
int L, U;
while(scanf("%d %d", &L, &U) == 2) {
long long i;
int last = -1, p1, p2, p3, p4;
int flag = 0;
int close = 2147483647, dist = -close;
for(i = L; i <= U; i++) {
if(isprime(i)) {
if(last == -1)
last = i;
else {
if(i-last < close) {
close = i-last;
p1 = last, p2 = i;
}
if(i-last > dist) {
dist = i-last;
p3 = last, p4 = i;
}
last = i;
flag = 1;
}
}
}
if(flag == 0)
puts("There are no adjacent primes.");
else {
printf("%d,%d are closest, %d,%d are most distant.\n", p1, p2, p3, p4);
}
}
return 0;
}
| 24.9375 | 83 | 0.348371 | tadvi |
55cb43bf19d21f4259faf77ca80ce38b7da59800 | 8,290 | cpp | C++ | src/software/ai/hl/stp/tactic/receiver/receiver_fsm.cpp | jonl112/Software | 61a028a98d5c0dd5e79bf055b231633290ddbf9f | [
"MIT"
] | null | null | null | src/software/ai/hl/stp/tactic/receiver/receiver_fsm.cpp | jonl112/Software | 61a028a98d5c0dd5e79bf055b231633290ddbf9f | [
"MIT"
] | null | null | null | src/software/ai/hl/stp/tactic/receiver/receiver_fsm.cpp | jonl112/Software | 61a028a98d5c0dd5e79bf055b231633290ddbf9f | [
"MIT"
] | null | null | null | #include "software/ai/hl/stp/tactic/receiver/receiver_fsm.h"
Angle ReceiverFSM::getOneTouchShotDirection(const Ray& shot, const Ball& ball)
{
Vector shot_vector = shot.toUnitVector();
Angle shot_dir = shot.getDirection();
Vector ball_vel = ball.velocity();
Vector lateral_vel = ball_vel.project(shot_vector.perpendicular());
// The lateral speed is roughly a measure of the lateral velocity we need to
// "cancel out" in order for our shot to go in the expected direction.
// The scaling factor of 0.3 is a magic number that was carried over from the old
// code. It seems to work well on the field.
// TODO (#2570): tune this
double lateral_speed = 0.3 * lateral_vel.length();
// This kick speed is based off of the value used in the firmware `MovePrimitive`
// when autokick is enabled
double kick_speed = BALL_MAX_SPEED_METERS_PER_SECOND - 1;
Angle shot_offset = Angle::asin(lateral_speed / kick_speed);
// check which direction the ball is going in so we can decide which direction to
// apply the offset in
if (lateral_vel.dot(shot_vector.rotate(Angle::quarter())) > 0)
{
// need to go clockwise
shot_offset = -shot_offset;
}
return shot_dir + shot_offset;
}
Shot ReceiverFSM::getOneTouchShotPositionAndOrientation(const Robot& robot,
const Ball& ball,
const Point& best_shot_target)
{
double dist_to_ball_in_dribbler =
DIST_TO_FRONT_OF_ROBOT_METERS + BALL_MAX_RADIUS_METERS;
Point ball_contact_point =
robot.position() +
Vector::createFromAngle(robot.orientation()).normalize(dist_to_ball_in_dribbler);
// Find the closest point to the ball contact point on the ball's trajectory
Point closest_ball_pos = ball.position();
if (ball.velocity().length() >= BALL_MIN_MOVEMENT_SPEED)
{
closest_ball_pos = closestPoint(
ball_contact_point, Line(ball.position(), ball.position() + ball.velocity()));
}
Ray shot(closest_ball_pos, best_shot_target - closest_ball_pos);
Angle ideal_orientation = getOneTouchShotDirection(shot, ball);
Vector ideal_orientation_vec = Vector::createFromAngle(ideal_orientation);
// The best position is determined such that the robot stays in the ideal
// orientation, but moves the shortest distance possible to put its contact
// point in the ball's path.
Point ideal_position =
closest_ball_pos - ideal_orientation_vec.normalize(dist_to_ball_in_dribbler);
return Shot(ideal_position, ideal_orientation);
}
std::optional<Shot> ReceiverFSM::findFeasibleShot(const World& world,
const Robot& assigned_robot)
{
// Check if we can shoot on the enemy goal from the receiver position
std::optional<Shot> best_shot_opt =
calcBestShotOnGoal(world.field(), world.friendlyTeam(), world.enemyTeam(),
assigned_robot.position(), TeamType::ENEMY, {assigned_robot});
// The percentage of open net the robot would shoot on
if (best_shot_opt)
{
// Vector from the ball to the robot
Vector robot_to_ball = world.ball().position() - assigned_robot.position();
// The angle the robot will have to deflect the ball to shoot
Angle abs_angle_between_pass_and_shot_vectors;
Vector robot_to_shot_target =
best_shot_opt.value().getPointToShootAt() - assigned_robot.position();
abs_angle_between_pass_and_shot_vectors =
acuteAngle(robot_to_ball, robot_to_shot_target);
Angle goal_angle =
acuteAngle(world.field().friendlyGoalpostPos(), assigned_robot.position(),
world.field().friendlyGoalpostNeg());
double net_percent_open =
best_shot_opt.value().getOpenAngle().toDegrees() / goal_angle.toDegrees();
// If we have a shot with a sufficiently large enough opening, and the
// deflection angle that is reasonable, we should one-touch kick the ball
// towards the enemy net
if (net_percent_open > MIN_SHOT_NET_PERCENT_OPEN &&
abs_angle_between_pass_and_shot_vectors < MAX_DEFLECTION_FOR_ONE_TOUCH_SHOT)
{
return best_shot_opt;
}
}
return std::nullopt;
}
bool ReceiverFSM::onetouchPossible(const Update& event)
{
return !event.control_params.disable_one_touch_shot &&
(findFeasibleShot(event.common.world, event.common.robot) != std::nullopt);
}
void ReceiverFSM::updateOnetouch(const Update& event)
{
auto best_shot = findFeasibleShot(event.common.world, event.common.robot);
auto one_touch = getOneTouchShotPositionAndOrientation(
event.common.robot, event.common.world.ball(), best_shot->getPointToShootAt());
if (best_shot && event.control_params.pass)
{
event.common.set_intent(std::make_unique<MoveIntent>(
event.common.robot.id(), one_touch.getPointToShootAt(),
one_touch.getOpenAngle(), 0, TbotsProto::DribblerMode::OFF,
TbotsProto::BallCollisionType::ALLOW,
AutoChipOrKick{AutoChipOrKickMode::AUTOKICK,
BALL_MAX_SPEED_METERS_PER_SECOND},
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT, 0.0,
event.common.robot.robotConstants()));
}
}
void ReceiverFSM::updateReceive(const Update& event)
{
if (event.control_params.pass)
{
event.common.set_intent(std::make_unique<MoveIntent>(
event.common.robot.id(), event.control_params.pass->receiverPoint(),
event.control_params.pass->receiverOrientation(), 0,
TbotsProto::DribblerMode::MAX_FORCE, TbotsProto::BallCollisionType::ALLOW,
AutoChipOrKick{AutoChipOrKickMode::OFF, 0},
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT, 0.0,
event.common.robot.robotConstants()));
}
}
void ReceiverFSM::adjustReceive(const Update& event)
{
auto ball = event.common.world.ball();
auto robot_pos = event.common.robot.position();
if ((ball.position() - robot_pos).length() >
BALL_TO_FRONT_OF_ROBOT_DISTANCE_WHEN_DRIBBLING)
{
Point ball_receive_pos = ball.position();
if (ball.velocity().length() > MIN_PASS_START_SPEED)
{
ball_receive_pos = closestPoint(
robot_pos, Line(ball.position(), ball.position() + ball.velocity()));
}
Angle ball_receive_orientation = (ball.position() - robot_pos).orientation();
event.common.set_intent(std::make_unique<MoveIntent>(
event.common.robot.id(), ball_receive_pos, ball_receive_orientation, 0,
TbotsProto::DribblerMode::MAX_FORCE, TbotsProto::BallCollisionType::ALLOW,
AutoChipOrKick{AutoChipOrKickMode::OFF, 0},
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT, 0.0,
event.common.robot.robotConstants()));
}
}
bool ReceiverFSM::passStarted(const Update& event)
{
return event.common.world.ball().hasBallBeenKicked(
event.control_params.pass->passerOrientation());
}
bool ReceiverFSM::passFinished(const Update& event)
{
// We tolerate imperfect passes that hit the edges of the robot,
// so that we can quickly transition out and grab the ball.
return event.common.robot.isNearDribbler(event.common.world.ball().position());
}
bool ReceiverFSM::strayPass(const Update& event)
{
auto ball_position = event.common.world.ball().position();
Vector ball_receiver_point_vector(
event.control_params.pass->receiverPoint().x() - ball_position.x(),
event.control_params.pass->receiverPoint().y() - ball_position.y());
auto orientation_difference = event.common.world.ball().velocity().orientation() -
ball_receiver_point_vector.orientation();
// if pass has strayed far from its intended destination (ex it was deflected)
// we consider the pass finished
bool stray_pass =
event.common.world.ball().velocity().length() > MIN_STRAY_PASS_SPEED &&
orientation_difference > MIN_STRAY_PASS_ANGLE;
return stray_pass;
}
| 40.637255 | 90 | 0.677443 | jonl112 |
55cd8f3d6d6f33947692c7a8d22baf0e3875337b | 324 | cpp | C++ | src/pte/Application.cpp | carbonacat/pokitto-tasui-examples | 7b7122fc5e3e6b51f40fa9b927e76c20b120fa4b | [
"Apache-2.0"
] | null | null | null | src/pte/Application.cpp | carbonacat/pokitto-tasui-examples | 7b7122fc5e3e6b51f40fa9b927e76c20b120fa4b | [
"Apache-2.0"
] | null | null | null | src/pte/Application.cpp | carbonacat/pokitto-tasui-examples | 7b7122fc5e3e6b51f40fa9b927e76c20b120fa4b | [
"Apache-2.0"
] | null | null | null | #include "pte/Application.hpp"
#include <Pokitto.h>
#include <miloslav.h>
namespace pte
{
// Application - Lifecycle.
void Application::init() noexcept
{
using PD = Pokitto::Display;
PD::loadRGBPalette(miloslav);
}
Application::Activities Application::activities;
} | 16.2 | 52 | 0.62037 | carbonacat |
55ce80f5ca9b57284e7d4a293c999251052d5195 | 13,186 | cpp | C++ | private/inet/controls/framewrk/ipserver.cpp | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | shell/iecontrols/framewrk/ipserver.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | shell/iecontrols/framewrk/ipserver.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | //=--------------------------------------------------------------------------=
// IPServer.Cpp
//=--------------------------------------------------------------------------=
// Copyright 1995-1996 Microsoft Corporation. All Rights Reserved.
//
// 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.
//=--------------------------------------------------------------------------=
//
// implements all exported DLL functions for the program, as well as a few
// others that will be used by same
//
#include "IPServer.H"
#include "LocalSrv.H"
#include "AutoObj.H"
#include "ClassF.H"
#include "CtrlObj.H"
#include "Globals.H"
#include "Unknown.H"
#include "Util.H"
//=--------------------------------------------------------------------------=
// Private module level data
//
// for ASSERT and FAIL
//
SZTHISFILE
//=--------------------------------------------------------------------------=
// These are used for reflection in OLE Controls. Not that big of a hit that
// we mind defining them for all servers, including automation or generic
// COM.
//
char g_szReflectClassName [] = "CtlFrameWork_ReflectWindow";
BYTE g_fRegisteredReflect = FALSE;
//=--------------------------------------------------------------------------=
// allow controls to register for DLL_THREAD_ATTACH and DLL_THREAD_DETACH
//
THRDNFYPROC g_pfnThreadProc = NULL;
extern "C" void SetLibraryThreadProc(THRDNFYPROC pfnThreadNotify)
{
if ((g_pfnThreadProc = pfnThreadNotify) == NULL)
DisableThreadLibraryCalls((HMODULE)g_hInstance);
}
// ref count for LockServer
//
LONG g_cLocks;
// private routines for this file.
//
int IndexOfOleObject(REFCLSID);
HRESULT RegisterAllObjects(void);
HRESULT UnregisterAllObjects(void);
//=--------------------------------------------------------------------------=
// DllMain
//=--------------------------------------------------------------------------=
// yon standard LibMain.
//
// Parameters and Output:
// - see SDK Docs on DllMain
//
// Notes:
//
BOOL WINAPI DllMain
(
HANDLE hInstance,
DWORD dwReason,
void *pvReserved
)
{
int i;
switch (dwReason) {
// set up some global variables, and get some OS/Version information
// set up.
//
case DLL_PROCESS_ATTACH:
{
DWORD dwVer = GetVersion();
DWORD dwWinVer;
// swap the two lowest bytes of dwVer so that the major and minor version
// numbers are in a usable order.
// for dwWinVer: high byte = major version, low byte = minor version
// OS Sys_WinVersion (as of 5/2/95)
// =-------------= =-------------=
// Win95 0x035F (3.95)
// WinNT ProgMan 0x0333 (3.51)
// WinNT Win95 UI 0x0400 (4.00)
//
dwWinVer = (UINT)(((dwVer & 0xFF) << 8) | ((dwVer >> 8) & 0xFF));
g_fSysWinNT = FALSE;
g_fSysWin95 = FALSE;
g_fSysWin95Shell = FALSE;
if (dwVer < 0x80000000) {
g_fSysWinNT = TRUE;
g_fSysWin95Shell = (dwWinVer >= 0x0334);
} else {
g_fSysWin95 = TRUE;
g_fSysWin95Shell = TRUE;
}
// initialize a critical seciton for our apartment threading support
//
InitializeCriticalSection(&g_CriticalSection);
// create an initial heap for everybody to use.
// currently, we're going to let the system make things thread-safe,
// which will make them a little slower, but hopefully not enough
// to notice
//
g_hHeap = GetProcessHeap();
if (!g_hHeap) {
FAIL("Couldn't get Process Heap. Not good!");
return FALSE;
}
g_hInstance = (HINSTANCE)hInstance;
// give the user a chance to initialize whatever
//
InitializeLibrary();
// if they didn't ask for thread notifications then optimize by turning
// them off for our DLL.
//
if (!g_pfnThreadProc)
DisableThreadLibraryCalls((HMODULE)hInstance);
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
if (g_pfnThreadProc)
g_pfnThreadProc(hInstance, dwReason, pvReserved);
break;
// do a little cleaning up!
//
case DLL_PROCESS_DETACH:
// clean up our critical seciton
//
DeleteCriticalSection(&g_CriticalSection);
// unregister all the registered window classes.
//
i = 0;
while (!ISEMPTYOBJECT(i)) {
if (g_ObjectInfo[i].usType == OI_CONTROL) {
if (CTLWNDCLASSREGISTERED(i))
UnregisterClass(WNDCLASSNAMEOFCONTROL(i), g_hInstance);
}
i++;
}
// clean up our parking window.
//
if (g_hwndParking) {
DestroyWindow(g_hwndParking);
UnregisterClass("CtlFrameWork_Parking", g_hInstance);
--g_cLocks;
}
// clean up after reflection, if appropriate.
//
if (g_fRegisteredReflect)
UnregisterClass(g_szReflectClassName, g_hInstance);
// give the user a chance to do some cleaning up
//
UninitializeLibrary();
break;
}
return TRUE;
}
//=--------------------------------------------------------------------------=
// DllRegisterServer
//=--------------------------------------------------------------------------=
// registers the Automation server
//
// Output:
// HRESULT
//
// Notes:
//
STDAPI DllRegisterServer
(
void
)
{
HRESULT hr;
hr = RegisterAllObjects();
RETURN_ON_FAILURE(hr);
// call user registration function.
//
return (RegisterData())? S_OK : E_FAIL;
}
//=--------------------------------------------------------------------------=
// DllUnregisterServer
//=--------------------------------------------------------------------------=
// unregister's the Automation server
//
// Output:
// HRESULT
//
// Notes:
//
STDAPI DllUnregisterServer
(
void
)
{
HRESULT hr;
hr = UnregisterAllObjects();
RETURN_ON_FAILURE(hr);
// call user unregistration function
//
return (UnregisterData()) ? S_OK : E_FAIL;
}
//=--------------------------------------------------------------------------=
// DllCanUnloadNow
//=--------------------------------------------------------------------------=
// we are being asked whether or not it's okay to unload the DLL. just check
// the lock counts on remaining objects ...
//
// Output:
// HRESULT - S_OK, can unload now, S_FALSE, can't.
//
// Notes:
//
STDAPI DllCanUnloadNow
(
void
)
{
// if there are any objects lying around, then we can't unload. The
// controlling CUnknownObject class that people should be inheriting from
// takes care of this
//
return (g_cLocks) ? S_FALSE : S_OK;
}
//=--------------------------------------------------------------------------=
// DllGetClassObject
//=--------------------------------------------------------------------------=
// creates a ClassFactory object, and returns it.
//
// Parameters:
// REFCLSID - CLSID for the class object
// REFIID - interface we want class object to be.
// void ** - pointer to where we should ptr to new object.
//
// Output:
// HRESULT - S_OK, CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY,
// E_INVALIDARG, E_UNEXPECTED
//
// Notes:
//
STDAPI DllGetClassObject
(
REFCLSID rclsid,
REFIID riid,
void **ppvObjOut
)
{
HRESULT hr;
void *pv;
int iIndex;
// arg checking
//
if (!ppvObjOut)
return E_INVALIDARG;
// first of all, make sure they're asking for something we work with.
//
iIndex = IndexOfOleObject(rclsid);
if (iIndex == -1)
return CLASS_E_CLASSNOTAVAILABLE;
// create the blank object.
//
pv = (void *)new CClassFactory(iIndex);
if (!pv)
return E_OUTOFMEMORY;
// QI for whatever the user has asked for.
//
hr = ((IUnknown *)pv)->QueryInterface(riid, ppvObjOut);
((IUnknown *)pv)->Release();
return hr;
}
//=--------------------------------------------------------------------------=
// IndexOfOleObject
//=--------------------------------------------------------------------------=
// returns the index in our global table of objects of the given CLSID. if
// it's not a supported object, then we return -1
//
// Parameters:
// REFCLSID - [in] duh.
//
// Output:
// int - >= 0 is index into global table, -1 means not supported
//
// Notes:
//
int IndexOfOleObject
(
REFCLSID rclsid
)
{
int x = 0;
// an object is creatable if it's CLSID is in the table of all allowable object
// types.
//
while (!ISEMPTYOBJECT(x)) {
if (OBJECTISCREATABLE(x)) {
if (rclsid == CLSIDOFOBJECT(x))
return x;
}
x++;
}
return -1;
}
//=--------------------------------------------------------------------------=
// RegisterAllObjects
//=--------------------------------------------------------------------------=
// registers all the objects for the given automation server.
//
// Parameters:
// none
//
// Output:
// HERSULT - S_OK, E_FAIL
//
// Notes:
//
HRESULT RegisterAllObjects
(
void
)
{
ITypeLib *pTypeLib;
HRESULT hr;
DWORD dwPathLen;
char szTmp[MAX_PATH];
int x = 0;
// loop through all of our creatable objects [those that have a clsid in
// our global table] and register them.
//
while (!ISEMPTYOBJECT(x)) {
if (!OBJECTISCREATABLE(x)) {
x++;
continue;
}
// depending on the object type, register different pieces of information
//
switch (g_ObjectInfo[x].usType) {
// for both simple co-creatable objects and proeprty pages, do the same
// thing
//
case OI_UNKNOWN:
case OI_PROPERTYPAGE:
RegisterUnknownObject(NAMEOFOBJECT(x), CLSIDOFOBJECT(x));
break;
case OI_AUTOMATION:
RegisterAutomationObject(g_szLibName, NAMEOFOBJECT(x), VERSIONOFOBJECT(x),
*g_pLibid, CLSIDOFOBJECT(x));
break;
case OI_CONTROL:
RegisterControlObject(g_szLibName, NAMEOFOBJECT(x), VERSIONOFOBJECT(x),
*g_pLibid, CLSIDOFOBJECT(x), OLEMISCFLAGSOFCONTROL(x),
BITMAPIDOFCONTROL(x));
break;
}
x++;
}
// Load and register our type library.
//
if (g_fServerHasTypeLibrary) {
dwPathLen = GetModuleFileName(g_hInstance, szTmp, MAX_PATH);
MAKE_WIDEPTR_FROMANSI(pwsz, szTmp);
hr = LoadTypeLib(pwsz, &pTypeLib);
RETURN_ON_FAILURE(hr);
hr = RegisterTypeLib(pTypeLib, pwsz, NULL);
pTypeLib->Release();
RETURN_ON_FAILURE(hr);
}
return S_OK;
}
//=--------------------------------------------------------------------------=
// UnregisterAllObjects
//=--------------------------------------------------------------------------=
// un-registers all the objects for the given automation server.
//
// Parameters:
// none
//
// Output:
// HRESULT - S_OK
//
// Notes:
//
HRESULT UnregisterAllObjects
(
void
)
{
int x = 0;
// loop through all of our creatable objects [those that have a clsid in
// our global table] and register them.
//
while (!ISEMPTYOBJECT(x)) {
if (!OBJECTISCREATABLE(x)) {
x++;
continue;
}
switch (g_ObjectInfo[x].usType) {
case OI_UNKNOWN:
case OI_PROPERTYPAGE:
UnregisterUnknownObject(CLSIDOFOBJECT(x));
break;
case OI_CONTROL:
UnregisterControlObject(g_szLibName, NAMEOFOBJECT(x), VERSIONOFOBJECT(x),
CLSIDOFOBJECT(x));
case OI_AUTOMATION:
UnregisterAutomationObject(g_szLibName, NAMEOFOBJECT(x), VERSIONOFOBJECT(x),
CLSIDOFOBJECT(x));
break;
}
x++;
}
// if we've got one, unregister our type library [this isn't an API function
// -- we've implemented this ourselves]
//
if (g_pLibid)
UnregisterTypeLibrary(*g_pLibid);
return S_OK;
}
| 26.965235 | 90 | 0.489686 | King0987654 |
55d0439f046914458c65f31edb2f53ced9d40a73 | 1,951 | cpp | C++ | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsp.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tderwedu <tderwedu@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/31 12:15:32 by tderwedu #+# #+# */
/* Updated: 2021/10/14 13:09:37 by tderwedu ### ########.fr */
/* */
/* ************************************************************************** */
#include "Fixed.hpp"
#include "Point.hpp"
/*
** This algorithm is based on the:
** *INSIDE-OUTSIDE test*
** From 'A Parallel Algorithm for Polygon Rasterization'
**
** The edge function (which is the magnitude of the cross product) can be
** positive (clockwise) or negative (counter-wise) depending of the ordering
** of the given vertex points.
*/
Fixed edge_fct(Point const v0, Point const v1, Point const p)
{
Fixed res;
res = (p.getX() - v0.getX()) * (v1.getY() - v0.getY());
res = res - ((p.getY() - v0.getY()) * (v1.getX() - v0.getX()));
return (res);
}
bool bsp(Point const a, Point const b, Point const c, Point const point)
{
Fixed sign_ab = edge_fct(a, b, point);
Fixed sign_bc = edge_fct(b, c, point);
Fixed sign_ca = edge_fct(c, a, point);
if (sign_ab == Fixed(0) || sign_bc == Fixed(0) || sign_ca == Fixed(0))
return false;
bool test_cw = (sign_ab > Fixed(0) && sign_bc > Fixed(0) && sign_ca > Fixed(0));
bool test_ccw = (sign_ab < Fixed(0) && sign_bc < Fixed(0) && sign_ca < Fixed(0));
return (test_cw || test_ccw);
}
| 39.816327 | 82 | 0.401845 | tderwedu |
55d4badb294537850bad54832a1c64277200745d | 4,569 | cxx | C++ | main/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.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.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_i18npool.hxx"
#include <indexentrysupplier_ja_phonetic.hxx>
#include <data/indexdata_alphanumeric.h>
#include <data/indexdata_ja_phonetic.h>
#include <string.h>
using namespace ::rtl;
namespace com { namespace sun { namespace star { namespace i18n {
OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexCharacter( const OUString& rIndexEntry,
const lang::Locale& /*rLocale*/, const OUString& /*rSortAlgorithm*/ )
throw (com::sun::star::uno::RuntimeException)
{
sal_Unicode ch=rIndexEntry.toChar();
sal_uInt16 first = idx[ ch >> 8 ];
if (first == 0xFFFF) {
// using alphanumeric index for non-define stirng
return OUString(&idxStr[(ch & 0xFF00) ? 0 : ch], 1);
} else {
sal_Unicode *idx2 = strstr(implementationName, "syllable") ? syllable : consonant;
return OUString(&idx2[ first + (ch & 0xff) ], 1);
}
}
OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexKey( const OUString& IndexEntry,
const OUString& PhoneticEntry, const lang::Locale& rLocale )
throw (com::sun::star::uno::RuntimeException)
{
return getIndexCharacter( PhoneticEntry.getLength() > 0 ? PhoneticEntry : IndexEntry, rLocale, OUString());
}
sal_Int16 SAL_CALL IndexEntrySupplier_ja_phonetic::compareIndexEntry(
const OUString& IndexEntry1, const OUString& PhoneticEntry1, const lang::Locale& rLocale1,
const OUString& IndexEntry2, const OUString& PhoneticEntry2, const lang::Locale& rLocale2 )
throw (com::sun::star::uno::RuntimeException)
{
sal_Int16 result = sal::static_int_cast<sal_Int16>( collator->compareString(
IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry1, PhoneticEntry1, rLocale1),
IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry2, PhoneticEntry2, rLocale2)) );
if (result == 0)
return IndexEntrySupplier_Common::compareIndexEntry(
IndexEntry1, PhoneticEntry1, rLocale1,
IndexEntry2, PhoneticEntry2, rLocale2);
return result;
}
static sal_Char first[] = "ja_phonetic (alphanumeric first)";
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(first), rLocale, collatorOptions) == 0;
}
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(first), rLocale, collatorOptions) == 0;
}
static sal_Char last[] = "ja_phonetic (alphanumeric last)";
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(last), rLocale, collatorOptions) == 0;
}
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(last), rLocale, collatorOptions) == 0;
}
} } } }
| 44.359223 | 108 | 0.739987 | Grosskopf |
55d544cba0d062d05eac5b65bd04cb2badee4341 | 73,663 | cpp | C++ | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | 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<UnityEngine.XR.InputDevice>
struct IEqualityComparer_1_tC19DB848F703F8CA24DB77C30EBE9F5B58ABFDD4;
// System.Collections.Generic.IEqualityComparer`1<System.Int16>
struct IEqualityComparer_1_t6908210243A58C7DF5D08E9156020D5CA84621F3;
// System.Collections.Generic.IEqualityComparer`1<System.Int32>
struct IEqualityComparer_1_t62010156673DE1460AB1D1CEBE5DCD48665E1A38;
// System.Collections.Generic.Dictionary`2/KeyCollection<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,=a0B=>
struct KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549;
// System.Collections.Generic.Dictionary`2/ValueCollection<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,=a0B=>
struct ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B;
// System.Collections.Generic.Dictionary`2/Entry<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>[]
struct EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96;
// System.Collections.Generic.Dictionary`2/Entry<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>[]
struct EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4;
// System.Collections.Generic.Dictionary`2/Entry<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>[]
struct EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,=aaBf=`2<System.Int32,=ae8=>>[]
struct EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>[]
struct EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>[]
struct EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,=a0B=>[]
struct EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72;
// 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<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97 : 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_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* ___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_tA878E0C7F1FAF030CD94D532B83181F352AD648F * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___entries_1)); }
inline EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* 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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___keys_7)); }
inline KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F * 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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___values_8)); }
inline ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * get_values_8() const { return ___values_8; }
inline ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * 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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ____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<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3 : 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_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* ___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_tD780D5FD154A82B59C271F92768D7230E1A9846C * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___entries_1)); }
inline EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* 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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___keys_7)); }
inline KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C * 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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___values_8)); }
inline ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * get_values_8() const { return ___values_8; }
inline ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * 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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ____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<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C : 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_t37ABCBBB3ABB9B82EBE61986D43657582829A003* ___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_t173F12F37A9494FD22DEA048E368C00C2165DE57 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___entries_1)); }
inline EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003* 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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___keys_7)); }
inline KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 * 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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___values_8)); }
inline ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * get_values_8() const { return ___values_8; }
inline ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * 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_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ____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<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867 : 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_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* ___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_t742EAABC06F80131310BE3260BA08050201E13D4 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___entries_1)); }
inline EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* 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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___keys_7)); }
inline KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 * 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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___values_8)); }
inline ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * get_values_8() const { return ___values_8; }
inline ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * 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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ____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<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139 : 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_tFE0E128DF3C0A340037F84F082D249D963E9E390* ___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_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___entries_1)); }
inline EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390* 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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___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_t6431821EA0C996A318CFB028504B2F54E0732139, ___keys_7)); }
inline KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * 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_t6431821EA0C996A318CFB028504B2F54E0732139, ___values_8)); }
inline ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * get_values_8() const { return ___values_8; }
inline ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * 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_t6431821EA0C996A318CFB028504B2F54E0732139, ____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<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A : 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_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* ___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_tFB3B983744FE3A5FD539DE747C39618143C717AC * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___entries_1)); }
inline EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* 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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___keys_7)); }
inline KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC * 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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___values_8)); }
inline ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * get_values_8() const { return ___values_8; }
inline ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * 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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ____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<System.Int32,=a0B=>
struct Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9 : 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_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* ___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_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___entries_1)); }
inline EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* 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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___keys_7)); }
inline KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * 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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___values_8)); }
inline ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * get_values_8() const { return ___values_8; }
inline ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * 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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ____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<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_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_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_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_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_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_tE8371663EC9914BEC5F635B74C54849B326ADE0C(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_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_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_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_t6431821EA0C996A318CFB028504B2F54E0732139(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_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_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,=a0B=>
struct Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_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_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper(obj));
}
| 47.219872 | 257 | 0.819109 | frenchmajorcsminor |
55d565e806961ae8396df58a3c18aad947ef4f4a | 3,827 | cpp | C++ | dev/Gems/LmbrCentral/Code/Tests/EditorCapsuleShapeComponentTests.cpp | kostenickj/lumberyard | e881f3023cc1840650eb7b133e605881d1d4330d | [
"AML"
] | null | null | null | dev/Gems/LmbrCentral/Code/Tests/EditorCapsuleShapeComponentTests.cpp | kostenickj/lumberyard | e881f3023cc1840650eb7b133e605881d1d4330d | [
"AML"
] | null | null | null | dev/Gems/LmbrCentral/Code/Tests/EditorCapsuleShapeComponentTests.cpp | kostenickj/lumberyard | e881f3023cc1840650eb7b133e605881d1d4330d | [
"AML"
] | null | null | null | /*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "LmbrCentral_precompiled.h"
#include "LmbrCentralEditor.h"
#include "LmbrCentralReflectionTest.h"
#include "Shape/EditorCapsuleShapeComponent.h"
#include <AzToolsFramework/Application/ToolsApplication.h>
namespace LmbrCentral
{
// Serialized legacy EditorCapsuleShapeComponent v1.
const char kEditorCapsuleComponentVersion1[] =
R"DELIMITER(<ObjectStream version="1">
<Class name="EditorCapsuleShapeComponent" field="element" version="1" type="{06B6C9BE-3648-4DA2-9892-755636EF6E19}">
<Class name="EditorComponentBase" field="BaseClass1" version="1" type="{D5346BD4-7F20-444E-B370-327ACD03D4A0}">
<Class name="AZ::Component" field="BaseClass1" type="{EDFCB2CF-F75D-43BE-B26B-F35821B29247}">
<Class name="AZ::u64" field="Id" value="10467239283436660413" type="{D6597933-47CD-4FC8-B911-63F3E2B0993A}"/>
</Class>
</Class>
<Class name="CapsuleShapeConfig" field="Configuration" version="1" type="{00931AEB-2AD8-42CE-B1DC-FA4332F51501}">
<Class name="float" field="Height" value="0.5700000" type="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}"/>
<Class name="float" field="Radius" value="1.5700000" type="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}"/>
</Class>
</Class>
</ObjectStream>)DELIMITER";
class LoadEditorCapsuleShapeComponentFromVersion1
: public LoadReflectedObjectTest<AZ::ComponentApplication, LmbrCentralEditorModule, EditorCapsuleShapeComponent>
{
protected:
const char* GetSourceDataBuffer() const override { return kEditorCapsuleComponentVersion1; }
void SetUp() override
{
LoadReflectedObjectTest::SetUp();
if (m_object)
{
m_editorCapsuleShapeComponent = m_object.get();
m_entity.Init();
m_entity.AddComponent(m_editorCapsuleShapeComponent);
m_entity.Activate();
}
}
void TearDown() override
{
m_entity.Deactivate();
LoadReflectedObjectTest::TearDown();
}
AZ::Entity m_entity;
EditorCapsuleShapeComponent* m_editorCapsuleShapeComponent = nullptr;
};
TEST_F(LoadEditorCapsuleShapeComponentFromVersion1, Application_IsRunning)
{
ASSERT_NE(GetApplication(), nullptr);
}
TEST_F(LoadEditorCapsuleShapeComponentFromVersion1, Components_Load)
{
EXPECT_NE(m_object.get(), nullptr);
}
TEST_F(LoadEditorCapsuleShapeComponentFromVersion1, EditorComponent_Found)
{
EXPECT_NE(m_editorCapsuleShapeComponent, nullptr);
}
TEST_F(LoadEditorCapsuleShapeComponentFromVersion1, Height_MatchesSourceData)
{
float height = 0.0f;
CapsuleShapeComponentRequestsBus::EventResult(
height, m_entity.GetId(), &CapsuleShapeComponentRequests::GetHeight);
EXPECT_FLOAT_EQ(height, 0.57f);
}
TEST_F(LoadEditorCapsuleShapeComponentFromVersion1, Radius_MatchesSourceData)
{
float radius = 0.0f;
CapsuleShapeComponentRequestsBus::EventResult(
radius, m_entity.GetId(), &CapsuleShapeComponentRequests::GetRadius);
EXPECT_FLOAT_EQ(radius, 1.57f);
}
}
| 38.656566 | 129 | 0.681735 | kostenickj |
55d7ba03bdda2056f37782b518d1ef175d618f3b | 1,697 | cpp | C++ | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 19 | 2016-08-16T10:19:07.000Z | 2018-12-04T01:00:00.000Z | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 1 | 2016-08-18T04:23:19.000Z | 2017-01-26T22:46:44.000Z | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 1 | 2019-09-23T10:49:36.000Z | 2019-09-23T10:49:36.000Z | #include "gfx.h"
#include <cfc/core/io.h>
namespace cfc {
void gfx_gpu_timer_query::Begin(gfx_command_list* const cmdList, const char* const description)
{
m_cmdList = cmdList;
m_startIndex = cmdList->InsertTimerQuery();
usize descriptionLength = strlen(description);
stl_assert(descriptionLength < GFX_MAX_TIMER_QUERY_DESCRIPTION_STRING_SIZE);
memcpy(m_description, description, descriptionLength);
}
void gfx_gpu_timer_query::Begin(gfx_command_list* const cmdList)
{
m_cmdList = cmdList;
m_startIndex = cmdList->InsertTimerQuery();
}
void gfx_gpu_timer_query::End()
{
m_endIndex = m_cmdList->InsertTimerQuery();
}
usize gfx::AddShaderFromFile(context& ctx, const char* filename, const char* funcName /*= "main"*/, const char* shaderType /*= "vs_5_0"*/, const char* defineData /*=null*/)
{
iobuffer ioData = ctx.IO->ReadFileToMemory(filename);
stl_assert(ioData); // read shader
return AddShaderFromMemory(ioData.data, ioData.size, funcName, shaderType, filename, defineData);
}
gfx_barrier_list::gfx_barrier_list(usize reserve /* = 4*/)
{
Barriers.reserve(reserve);
}
void gfx_barrier_list::Reset()
{
Barriers.resize(0);
}
void gfx_barrier_list::BarrierResource(usize resourceIdx, u32 stateBefore, u32 stateAfter)
{
Barriers.push_back(gpu_resourcebarrier_desc::Transition(resourceIdx, stateBefore, stateAfter));
}
void gfx_barrier_list::BarrierUAV(usize resourceIdx)
{
Barriers.push_back(gpu_resourcebarrier_desc::UAV(resourceIdx));
}
void gfx_barrier_list::BarrierAliasing(usize resourceBeforeIdx, usize resourceAfterIdx)
{
Barriers.push_back(gpu_resourcebarrier_desc::Aliasing(resourceBeforeIdx, resourceAfterIdx));
}
}; | 27.819672 | 173 | 0.763701 | JJoosten |
55d836281060d5085df1f2fefceed3c1c210be72 | 5,906 | cpp | C++ | src/particle_filter.cpp | lilipads/CarND-Kidnapped-Vehicle-Project | bd586726bcc16503f21c1c39b55199216b562d34 | [
"MIT"
] | null | null | null | src/particle_filter.cpp | lilipads/CarND-Kidnapped-Vehicle-Project | bd586726bcc16503f21c1c39b55199216b562d34 | [
"MIT"
] | null | null | null | src/particle_filter.cpp | lilipads/CarND-Kidnapped-Vehicle-Project | bd586726bcc16503f21c1c39b55199216b562d34 | [
"MIT"
] | null | null | null | /*
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: Tiffany Huang
*/
#include <random>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <math.h>
#include <iostream>
#include <sstream>
#include <string>
#include <iterator>
#include <limits>
#include "particle_filter.h"
using namespace std;
const int NUM_PARTICLES = 100;
const double EPSILON = 0.0001;
std::random_device rd;
std::mt19937 gen(rd());
void ParticleFilter::init(double x, double y, double theta, double std[]) {
num_particles = NUM_PARTICLES;
double std_x = std[0];
double std_y = std[1];
double std_theta = std[2];
// Create normal distributions for x, y and theta.
normal_distribution<double> dist_x(x, std_x);
normal_distribution<double> dist_y(y, std_y);
normal_distribution<double> dist_theta(theta, std_theta);
// initialize particles at random positions and theta drawn from normal distributions
for (int i = 0; i < num_particles; i++) {
Particle p;
p.id = i;
p.x = dist_x(gen);
p.y = dist_y(gen);
p.theta = dist_theta(gen);
p.weight = 1;
particles.push_back(p);
}
is_initialized = true;
}
void ParticleFilter::prediction(double delta_t, double std_pos[], double velocity, double yaw_rate) {
double std_x = std_pos[0];
double std_y = std_pos[1];
double std_theta = std_pos[2];
normal_distribution<double> dist_x(0, std_x);
normal_distribution<double> dist_y(0, std_y);
normal_distribution<double> dist_theta(0, std_theta);
for (int i = 0; i < num_particles; i++) {
// when yaw_rate is close to zero, use a different set of formula to prevent division by 0
if (fabs(yaw_rate) < EPSILON){
particles[i].x += velocity * cos(particles[i].theta) * delta_t;
particles[i].y += velocity * sin(particles[i].theta) * delta_t;
}
else{
particles[i].x += velocity / yaw_rate * (sin(particles[i].theta + yaw_rate * delta_t)
- sin(particles[i].theta));
particles[i].y += velocity / yaw_rate * (-cos(particles[i].theta + yaw_rate * delta_t)
+ cos(particles[i].theta));
particles[i].theta += yaw_rate * delta_t;
}
// add noise to prediction
particles[i].x += dist_x(gen);
particles[i].y += dist_y(gen);
particles[i].theta += dist_theta(gen);
}
}
void ParticleFilter::updateWeights(double sensor_range, double std_landmark[],
const std::vector<LandmarkObs> &observations, const Map &map_landmarks) {
// sense the location of all the map landmarks for each particle within its sensor_range
sense(sensor_range, map_landmarks);
// update the weight as the product of gaussians
weights = {};
for (auto &p : particles){
// a list of observations as the nearest neighbors to each sensed landmark of the particle
vector<LandmarkObs> ordered_obs = dataAssociation(observations, p);
p.weight = 1.;
for (int i = 0; i < p.sense_x.size(); i++){
p.weight *= multi_norm_pdf(
ordered_obs[i].x, ordered_obs[i].y, p.sense_x[i], p.sense_y[i],
std_landmark[0], std_landmark[1]);
}
weights.push_back(p.weight);
}
}
void ParticleFilter::sense(double sensor_range, const Map &map_landmarks){
for (auto &p : particles){
p.associations = {};
p.sense_x = {};
p.sense_y = {};
// sense all landmarks within sensor_range
for (int j = 0; j < map_landmarks.landmark_list.size(); j++){
if (dist(map_landmarks.landmark_list[j].x_f, map_landmarks.landmark_list[j].y_f,
p.x, p.y) < sensor_range){
p.associations.push_back(map_landmarks.landmark_list[j].id_i);
p.sense_x.push_back(map_landmarks.landmark_list[j].x_f);
p.sense_y.push_back(map_landmarks.landmark_list[j].y_f);
}
}
}
}
vector<LandmarkObs> ParticleFilter::dataAssociation(const std::vector<LandmarkObs>& observations,
Particle p) {
std::vector<LandmarkObs> ordered_obs;
std::vector<double> observations_x_map = {};
std::vector<double> observations_y_map = {};
for (auto &o : observations){
// transform from vehicle coordinates to map coordinates
observations_x_map.push_back(p.x + o.x * cos(p.theta) - o.y * sin(p.theta));
observations_y_map.push_back(p.y + o.x * sin(p.theta) + o.y * cos(p.theta));
}
// for each landmark that is wihtin the sensor range of the particle,
// associate it with an observation sensed by the vehicle
for (int i = 0; i < p.sense_x.size(); i++){
double min_dist = std::numeric_limits<double>::infinity();
LandmarkObs best_obs;
for (int j = 0; j < observations_x_map.size(); j++){
double distance = dist(observations_x_map[j], observations_y_map[j],
p.sense_x[i], p.sense_y[i]);
if (distance < min_dist){
min_dist = distance;
best_obs.x = observations_x_map[j];
best_obs.y = observations_y_map[j];
}
}
ordered_obs.push_back(best_obs);
}
return ordered_obs;
}
void ParticleFilter::resample() {
// draw particle with probability proportional to its weight
std::discrete_distribution<int> d(weights.begin(), weights.end());
std::vector<Particle> resampled_particles;
for (int i = 0; i < num_particles; i++){
resampled_particles.push_back(particles[d(gen)]);
}
particles = resampled_particles;
}
string ParticleFilter::getAssociations(Particle best)
{
vector<int> v = best.associations;
stringstream ss;
copy( v.begin(), v.end(), ostream_iterator<int>(ss, " "));
string s = ss.str();
s = s.substr(0, s.length()-1); // get rid of the trailing space
return s;
}
string ParticleFilter::getSenseX(Particle best)
{
vector<double> v = best.sense_x;
stringstream ss;
copy( v.begin(), v.end(), ostream_iterator<float>(ss, " "));
string s = ss.str();
s = s.substr(0, s.length()-1); // get rid of the trailing space
return s;
}
string ParticleFilter::getSenseY(Particle best)
{
vector<double> v = best.sense_y;
stringstream ss;
copy( v.begin(), v.end(), ostream_iterator<float>(ss, " "));
string s = ss.str();
s = s.substr(0, s.length()-1); // get rid of the trailing space
return s;
}
| 31.752688 | 101 | 0.692347 | lilipads |
55da40767ee4d3fd7a8c7597049c46a761b9fc8a | 12,400 | cpp | C++ | PyDK/DCAffineTransform3.cpp | hhg128/DKGL | c61bc6546ac5655da97462cc532a9034ba08516d | [
"PSF-2.0",
"BSD-3-Clause"
] | 14 | 2015-09-12T01:32:05.000Z | 2021-10-13T02:52:53.000Z | PyDK/DCAffineTransform3.cpp | hhg128/DKGL | c61bc6546ac5655da97462cc532a9034ba08516d | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | PyDK/DCAffineTransform3.cpp | hhg128/DKGL | c61bc6546ac5655da97462cc532a9034ba08516d | [
"PSF-2.0",
"BSD-3-Clause"
] | 3 | 2015-11-10T03:12:49.000Z | 2018-10-15T15:38:31.000Z | #include <Python.h>
#include <structmember.h>
#include <DK/DK.h>
#include "DCObject.h"
struct DCAffineTransform3
{
PyObject_HEAD
DKAffineTransform3 affineTransform3;
};
static PyObject* DCAffineTransform3New(PyTypeObject* type, PyObject* args, PyObject* kwds)
{
DCAffineTransform3* self = (DCAffineTransform3*)type->tp_alloc(type, 0);
if (self)
{
new (&self->affineTransform3) DKAffineTransform3();
return (PyObject*)self;
}
return NULL;
}
static int DCAffineTransform3Init(DCAffineTransform3 *self, PyObject *args, PyObject *kwds)
{
Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
if (numArgs > 1 && DCAffineTransform3Converter(args, &self->affineTransform3))
{
return 0;
}
else if (numArgs == 1 && PyArg_ParseTuple(args, "O&", &DCAffineTransform3Converter, &self->affineTransform3))
{
return 0;
}
else if (numArgs == 0)
{
self->affineTransform3.Identity();
return 0;
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "argument must be Matrix4 or LinearTransform3 with Vector3 or four Vector3s or empty.");
return -1;
}
static void DCAffineTransform3Dealloc(DCAffineTransform3* self)
{
self->affineTransform3.~DKAffineTransform3();
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject* DCAffineTransform3Repr(DCAffineTransform3* self)
{
const DKMatrix3& mat = self->affineTransform3.matrix3;
const DKVector3& pos = self->affineTransform3.translation;
DKString str = DKString::Format(
"<%s object\n"
"Matrix3: (%.3f, %.3f, %.3f)\n"
" (%.3f, %.3f, %.3f)\n"
" (%.3f, %.3f, %.3f)\n"
" origin: (%.3f, %.3f, %.3f)>",
Py_TYPE(self)->tp_name,
mat.m[0][0], mat.m[0][1], mat.m[0][2],
mat.m[1][0], mat.m[1][1], mat.m[1][2],
mat.m[2][0], mat.m[2][1], mat.m[2][2],
pos.x, pos.y, pos.z);
return PyUnicode_FromWideChar((const wchar_t*)str, -1);
}
static PyObject* DCAffineTransform3RichCompare(PyObject *obj1, PyObject *obj2, int op)
{
DKAffineTransform3* t1 = DCAffineTransform3ToObject(obj1);
DKAffineTransform3* t2 = DCAffineTransform3ToObject(obj2);
if (t1 && t2)
{
if (op == Py_EQ)
{
if (*t1 == *t2) { Py_RETURN_TRUE; }
else { Py_RETURN_FALSE; }
}
else if (op == Py_NE)
{
if (*t1 != *t2) { Py_RETURN_TRUE; }
else { Py_RETURN_FALSE; }
}
}
Py_RETURN_NOTIMPLEMENTED;
}
static PyObject* DCAffineTransform3IsIdentity(DCAffineTransform3* self, PyObject*)
{
if (self->affineTransform3.IsIdentity()) { Py_RETURN_TRUE; }
Py_RETURN_FALSE;
}
static PyObject* DCAffineTransform3IsDiagonal(DCAffineTransform3* self, PyObject*)
{
if (self->affineTransform3.IsDiagonal()) { Py_RETURN_TRUE; }
Py_RETURN_FALSE;
}
static PyObject* DCAffineTransform3Inverse(DCAffineTransform3* self, PyObject*)
{
self->affineTransform3.Inverse();
Py_RETURN_NONE;
}
static PyObject* DCAffineTransform3Matrix3(DCAffineTransform3* self, PyObject*)
{
return DCMatrix3FromObject(&self->affineTransform3.matrix3);
}
static PyObject* DCAffineTransform3Matrix4(DCAffineTransform3* self, PyObject*)
{
DKMatrix4 mat = self->affineTransform3.Matrix4();
return DCMatrix4FromObject(&mat);
}
static PyObject* DCAffineTransform3Identity(DCAffineTransform3* self, PyObject*)
{
self->affineTransform3.Identity();
Py_RETURN_NONE;
}
static PyObject* DCAffineTransform3Translate(DCAffineTransform3* self, PyObject* args)
{
Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
DKVector3 pos;
if (numArgs > 1 && DCVector3Converter(args, &pos))
{
self->affineTransform3.Translate(pos);
Py_RETURN_NONE;
}
else if (numArgs == 1 && PyArg_ParseTuple(args, "O&", &DCVector3Converter, &pos))
{
self->affineTransform3.Translate(pos);
Py_RETURN_NONE;
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "argument must be Vector3 or three floats.");
return NULL;
}
static PyObject* DCAffineTransform3Multiply(DCAffineTransform3* self, PyObject* args)
{
PyObject* obj;
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
DKLinearTransform3* linear = DCLinearTransform3ToObject(obj);
if (linear)
{
self->affineTransform3.Multiply(*linear);
Py_RETURN_NONE;
}
DKAffineTransform3 trans;
if (DCAffineTransform3Converter(obj, &trans))
{
self->affineTransform3.Multiply(trans);
Py_RETURN_NONE;
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "argument must be AffineTransform3 or LinearTransform3 object.");
return NULL;
}
static PyMethodDef methods[] = {
{ "isIdentity", (PyCFunction)&DCAffineTransform3IsIdentity, METH_NOARGS },
{ "isDiagonal", (PyCFunction)&DCAffineTransform3IsDiagonal, METH_NOARGS },
{ "inverse", (PyCFunction)&DCAffineTransform3Inverse, METH_NOARGS },
{ "matrix3", (PyCFunction)&DCAffineTransform3Matrix3, METH_NOARGS },
{ "matrix4", (PyCFunction)&DCAffineTransform3Matrix4, METH_NOARGS },
{ "identity", (PyCFunction)&DCAffineTransform3Identity, METH_NOARGS },
{ "translate", (PyCFunction)&DCAffineTransform3Translate, METH_VARARGS },
{ "multiply", (PyCFunction)&DCAffineTransform3Multiply, METH_VARARGS },
{ NULL, NULL, NULL, NULL } /* Sentinel */
};
static PyObject* DCAffineTransform3Translation(DCAffineTransform3* self, void*)
{
const DKVector3& vec = self->affineTransform3.translation;
return Py_BuildValue("fff", vec.x, vec.y, vec.z);
}
static int DCAffineTransform3SetTranslation(DCAffineTransform3* self, PyObject* value, void*)
{
DCOBJECT_ATTRIBUTE_NOT_DELETABLE(value);
DKVector3& vec = self->affineTransform3.translation;
if (PyTuple_Check(value) && PyArg_ParseTuple(value, "fff", &vec.x, &vec.y, &vec.z))
return 0;
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "attribute must be tuple of three floats.");
return -1;
}
static PyObject* DCAffineTransform3Tuple(DCAffineTransform3* self, void*)
{
const DKMatrix3& mat = self->affineTransform3.matrix3;
const DKVector3& vec = self->affineTransform3.translation;
return Py_BuildValue("ffffffffffff",
mat.m[0][0], mat.m[0][1], mat.m[0][2],
mat.m[1][0], mat.m[1][1], mat.m[1][2],
mat.m[2][0], mat.m[2][1], mat.m[2][2],
vec.x, vec.y, vec.z);
}
static int DCAffineTransform3SetTuple(DCAffineTransform3* self, PyObject* value, void*)
{
DCOBJECT_ATTRIBUTE_NOT_DELETABLE(value);
DKMatrix3& mat = self->affineTransform3.matrix3;
DKVector3& vec = self->affineTransform3.translation;
if (PyTuple_Check(value) && PyArg_ParseTuple(value, "ffffffffffff",
&mat.m[0][0], &mat.m[0][1], &mat.m[0][2],
&mat.m[1][0], &mat.m[1][1], &mat.m[1][2],
&mat.m[2][0], &mat.m[2][1], &mat.m[2][2],
&vec.x, &vec.y, &vec.z))
return 0;
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "attribute must be tuple of twelve floats.");
return -1;
}
static PyGetSetDef getsets[] = {
{ "translation", (getter)&DCAffineTransform3Translation, (setter)&DCAffineTransform3SetTranslation, 0, 0 },
{ "tuple", (getter)&DCAffineTransform3Tuple, (setter)&DCAffineTransform3SetTuple, 0, 0 },
{ NULL } /* Sentinel */
};
static PyObject* DCAffineTransform3Mul(PyObject* lhs, PyObject* rhs)
{
DKAffineTransform3* p = DCAffineTransform3ToObject(lhs);
DKAffineTransform3 t;
if (p && DCAffineTransform3Converter(rhs, &t))
{
DKAffineTransform3 res = (*p) * t;
return DCAffineTransform3FromObject(&res);
}
PyErr_Clear();
Py_RETURN_NOTIMPLEMENTED;
}
static PyNumberMethods numberMethods = {
0, /* nb_add */
0, /* nb_subtract */
(binaryfunc)&DCAffineTransform3Mul, /* nb_multiply */
0, /* nb_remainder */
0, /* nb_divmod */
0, /* nb_power */
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
0, /* nb_bool */
0, /* nb_invert */
0, /* nb_lshift */
0, /* nb_rshift */
0, /* nb_and */
0, /* nb_xor */
0, /* nb_or */
0, /* nb_int */
0, /* nb_reserved */
0, /* nb_float */
0, /* nb_inplace_add */
0, /* nb_inplace_subtract */
0, /* nb_inplace_multiply */
0, /* nb_inplace_remainder */
0, /* nb_inplace_power */
0, /* nb_inplace_lshift */
0, /* nb_inplace_rshift */
0, /* nb_inplace_and */
0, /* nb_inplace_xor */
0, /* nb_inplace_or */
0, /* nb_floor_divide */
0, /* nb_true_divide */
0, /* nb_inplace_floor_divide */
0, /* nb_inplace_true_divide */
0 /* nb_index */
};
static PyTypeObject objectType = {
PyVarObject_HEAD_INIT(NULL, 0)
PYDK_MODULE_NAME ".AffineTransform3", /* tp_name */
sizeof(DCAffineTransform3), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)&DCAffineTransform3Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)&DCAffineTransform3Repr, /* tp_repr */
&numberMethods, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
(richcmpfunc)&DCAffineTransform3RichCompare, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
methods, /* tp_methods */
0, /* tp_members */
getsets, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)&DCAffineTransform3Init, /* tp_init */
0, /* tp_alloc */
&DCAffineTransform3New, /* tp_new */
};
PyTypeObject* DCAffineTransform3TypeObject(void)
{
return &objectType;
}
PyObject* DCAffineTransform3FromObject(DKAffineTransform3* affineTransform3)
{
if (affineTransform3)
{
PyObject* args = PyTuple_New(0);
PyObject* kwds = PyDict_New();
PyObject* tp = (PyObject*)DCObjectDefaultClass(&objectType);
DCAffineTransform3* self = (DCAffineTransform3*)PyObject_Call(tp, args, kwds);
if (self)
{
self->affineTransform3 = *affineTransform3;
}
Py_XDECREF(tp);
Py_XDECREF(args);
Py_XDECREF(kwds);
return (PyObject*)self;
}
Py_RETURN_NONE;
}
DKAffineTransform3* DCAffineTransform3ToObject(PyObject* obj)
{
if (obj && PyObject_TypeCheck(obj, &objectType))
{
return &((DCAffineTransform3*)obj)->affineTransform3;
}
return NULL;
}
int DCAffineTransform3Converter(PyObject* obj, DKAffineTransform3* p)
{
DKAffineTransform3* trans = DCAffineTransform3ToObject(obj);
if (trans)
{
*p = *trans;
return true;
}
DKLinearTransform3* lt = DCLinearTransform3ToObject(obj);
if (lt)
{
*p = *lt;
return true;
}
DKMatrix3* mat3 = DCMatrix3ToObject(obj);
if (mat3)
{
*p = DKLinearTransform3(*mat3);
return true;
}
DKMatrix4* mat4 = DCMatrix4ToObject(obj);
if (mat4)
{
*p = *mat4;
return true;
}
DKVector3* vec = DCVector3ToObject(obj);
if (vec)
{
*p = *vec;
return true;
}
if (obj && PyTuple_Check(obj))
{
Py_ssize_t numArgs = PyTuple_GET_SIZE(obj);
if (numArgs == 12)
{
DKMatrix3& mat = p->matrix3;
DKVector3& vec = p->translation;
if (PyArg_ParseTuple(obj, "ffffffffffff",
&mat.m[0][0], &mat.m[0][1], &mat.m[0][2],
&mat.m[1][0], &mat.m[1][1], &mat.m[1][2],
&mat.m[2][0], &mat.m[2][1], &mat.m[2][2],
&vec.x, &vec.y, &vec.z))
return true;
}
else if (numArgs > 2)
{
DKVector3 left;
DKVector3 up;
DKVector3 forward;
DKVector3 origin(0, 0, 0);
if (PyArg_ParseTuple(obj, "O&O&O&|O&",
&DCVector3Converter, &left,
&DCVector3Converter, &up,
&DCVector3Converter, &forward,
&DCVector3Converter, &origin))
{
*p = DKAffineTransform3(left, up, forward, origin);
return true;
}
}
else
{
DKLinearTransform3 linear3;
DKVector3 translate(0, 0, 0);
if (PyArg_ParseTuple(obj, "O&|O&",
&DCLinearTransform3Converter, &linear3,
&DCVector3Converter, &translate))
{
*p = DKAffineTransform3(linear3, translate);
return true;
}
}
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "Object must be one of following: AffineTransform3, Matrix4, LinearTransform3 with Vector3, four Vector3s.");
return false;
}
| 27.990971 | 143 | 0.655887 | hhg128 |
55dc54a2eced19c10cf783d11aeed761de3f342d | 2,157 | hpp | C++ | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | #ifndef MEMHLP_H
#define MEMHLP_H
#include <tuple>
#include <map>
#include <unordered_map>
#include <elf.h>
#include <cstddef>
#include <string>
enum symbl{
SYM_INVALID, SYM_ON, SYM_SEL_ON, SYM_M_LOOP, SYM_ENTRYP,
SYM_ALU_EQ, SYM_ALU_ADD, SYM_BIT_SET, SYM_BIT_CLR,
SYM_ALU_AND, SYM_ALU_OR, SYM_ALU_XOR, SYM_ALU_SHL,
SYM_ALU_SHR, SYM_ALU_SARI, SYM_ALU_MULL, SYM_ALU_MULH,
SYM_BOOL_OR, SYM_BOOL_XOR, SYM_BOOL_XNOR, SYM_BOOL_AND,
SYM_IMP_BAND, SYM_TARGET, SYM_SEL_TARGET, SYM_SP, SYM_END,
SYM_ALU_TRUE, SYM_ALU_FALSE, SYM_ALU_B0, SYM_ALU_B1,
SYM_ALU_B2, SYM_ALU_B3, SYM_ALU_B4, SYM_ALU_B5, SYM_ALU_B6,
SYM_ALU_B7, SYM_ALU_ADD8L, SYM_ALU_ADD8H, SYM_ALU_INV8,
SYM_ALU_INV16, SYM_ALU_CLAMP32, SYM_ALU_MUL_SUM8L,
SYM_ALU_MUL_SUM8H, SYM_ALU_MUL_SHL2, SYM_ALU_MUL_SUMS,
SYM_ALU_DIV_SHL1_8_C_D, SYM_ALU_DIV_SHL1_8_D, SYM_ALU_DIV_SHL2_8_D,
SYM_ALU_DIV_SHL3_8_D, SYM_ALU_SEX8, SYM_SEL_DATA, SYM_DATA,
SYM_STP_ADD4, SYM_STP_SUB4, SYM_DISCARD, SYM_FAULT, SYM_DISPATCH
};
class memhlp{
public:
void set_segments(std::map<uint64_t,
std::tuple<uint8_t *, uint64_t, int>>*);
std::pair<const uint64_t, std::tuple<uint8_t *, uint64_t, int>>*
get_segment(uint64_t addr);
uint8_t* get_ptr(uint64_t addr);
size_t space(uint64_t addr);
int is_X(uint64_t addr);
symbl analyse_table(uint64_t addr, int dim);
symbl get_sym(uint64_t addr);
int add_sym(uint64_t addr, symbl sym);
bool has_sym(symbl sym);
uint64_t get_sym_addr(symbl sym);
bool has_sym_to(uint64_t addr);
int rem_sym(uint64_t addr);
std::string dump_syms();
std::string dump_syms_idc();
std::string get_sym_name(enum symbl sym);
template <typename T>
int get_data(uint64_t addr, T** data) {
size_t off;
auto *seg = get_segment(addr);
if (!seg) return -1;
off = addr - seg->first;
if ((std::get<1>(seg->second)) - off < sizeof(T)) return -2;
if ((std::get<0>(seg->second)) == NULL)
*data = NULL;
else
*data = ((T*) ((std::get<0>(seg->second)) + off));
return 0;
}
private:
std::map<uint64_t, std::tuple<uint8_t *, uint64_t, int>> segs;
std::unordered_map<uint64_t, symbl> symbol;
};
#endif
| 32.681818 | 69 | 0.724618 | yqw1212 |
55e1cec71fcea52c28148e45891cab7c6eaaad90 | 15,001 | hpp | C++ | include/pstore/mcrepo/compilation.hpp | paulhuggett/pstore2 | a0c663d10a2e2713fdf39ecdae1f9c1e96041f5c | [
"Apache-2.0"
] | 11 | 2018-02-02T21:24:49.000Z | 2020-12-11T04:06:03.000Z | include/pstore/mcrepo/compilation.hpp | SNSystems/pstore | 74e9dd960245d6bfc125af03ed964d8ad660a62d | [
"Apache-2.0"
] | 63 | 2018-02-05T17:24:59.000Z | 2022-03-22T17:26:28.000Z | include/pstore/mcrepo/compilation.hpp | paulhuggett/pstore2 | a0c663d10a2e2713fdf39ecdae1f9c1e96041f5c | [
"Apache-2.0"
] | 5 | 2020-01-13T22:47:11.000Z | 2021-05-14T09:31:15.000Z | //===- include/pstore/mcrepo/compilation.hpp --------------*- mode: C++ -*-===//
//* _ _ _ _ *
//* ___ ___ _ __ ___ _ __ (_) | __ _| |_(_) ___ _ __ *
//* / __/ _ \| '_ ` _ \| '_ \| | |/ _` | __| |/ _ \| '_ \ *
//* | (_| (_) | | | | | | |_) | | | (_| | |_| | (_) | | | | *
//* \___\___/|_| |_| |_| .__/|_|_|\__,_|\__|_|\___/|_| |_| *
//* |_| *
//===----------------------------------------------------------------------===//
//
// Part of the pstore project, under the Apache License v2.0 with LLVM Exceptions.
// See https://github.com/SNSystems/pstore/blob/master/LICENSE.txt for license
// information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef PSTORE_MCREPO_COMPILATION_HPP
#define PSTORE_MCREPO_COMPILATION_HPP
#include <new>
#include "pstore/core/index_types.hpp"
#include "pstore/core/transaction.hpp"
#include "pstore/mcrepo/repo_error.hpp"
#include "pstore/support/bit_field.hpp"
#include "pstore/support/unsigned_cast.hpp"
namespace pstore {
namespace repo {
#define PSTORE_REPO_LINKAGES \
X (append) \
X (common) \
X (external) \
X (internal_no_symbol) \
X (internal) \
X (link_once_any) \
X (link_once_odr) \
X (weak_any) \
X (weak_odr)
#define X(a) a,
enum class linkage : std::uint8_t { PSTORE_REPO_LINKAGES };
#undef X
std::ostream & operator<< (std::ostream & os, linkage l);
#define PSTORE_REPO_VISIBILITIES \
X (default_vis) \
X (hidden_vis) \
X (protected_vis)
#define X(a) a,
enum class visibility : std::uint8_t { PSTORE_REPO_VISIBILITIES };
#undef X
//* _ __ _ _ _ _ *
//* __| |___ / _(_)_ _ (_) |_(_)___ _ _ *
//* / _` / -_) _| | ' \| | _| / _ \ ' \ *
//* \__,_\___|_| |_|_||_|_|\__|_\___/_||_| *
//* *
/// \brief Represents an individual symbol in a compilation.
///
/// A definition provides the connection between a symbol name, its linkage, and the
/// fragment which holds the associated data.
struct definition {
/// \param d The fragment digest for this compilation symbol.
/// \param x The fragment extent for this compilation symbol.
/// \param n Symbol name address.
/// \param l The symbol linkage.
/// \param v The symbol visibility.
definition (index::digest d, extent<fragment> x, typed_address<indirect_string> n,
linkage l, visibility v = repo::visibility::default_vis) noexcept;
/// The digest of the fragment referenced by this compilation symbol.
index::digest digest;
/// The extent of the fragment referenced by this compilation symbol.
extent<fragment> fext;
// TODO: it looks tempting to use some of the bits of this address for the
// linkage/visibility fields. We know that they're not all used and it would eliminate
// all of the padding bits from the structure. Unfortunately, repo-object-writer is
// currently stashing host pointers in this field and although the same may be true for
// those, it's difficult to be certain.
typed_address<indirect_string> name;
union {
std::uint8_t bf = UINT8_C (0);
bit_field<std::uint8_t, 0, 4> linkage_;
bit_field<std::uint8_t, 4, 2> visibility_;
};
std::uint8_t padding1 = 0;
std::uint16_t padding2 = 0;
std::uint32_t padding3 = 0;
auto linkage () const noexcept -> enum linkage {
return static_cast<enum linkage> (linkage_.value ());
}
auto visibility () const noexcept -> enum visibility {
return static_cast<enum visibility> (visibility_.value ());
}
/// \brief Returns a pointer to an in-store definition instance.
///
/// \param db The database from which the definition should be loaded.
/// \param addr Address of the definition.
/// \result A pointer to the in-store definition.
static auto load (database const & db, typed_address<definition> addr)
-> std::shared_ptr<definition const>;
private:
friend class compilation;
// TODO: using "=default" here causes clang-8 to issue an error:
// "default member initializer for 'padding1' needed within definition of enclosing
// class 'definition' outside of member functions"
definition () noexcept {}
};
// load
// ~~~~
inline auto definition::load (database const & db, typed_address<definition> const addr)
-> std::shared_ptr<definition const> {
return db.getro (addr);
}
//* _ _ _ _ *
//* __ ___ _ __ _ __(_) |__ _| |_(_)___ _ _ *
//* / _/ _ \ ' \| '_ \ | / _` | _| / _ \ ' \ *
//* \__\___/_|_|_| .__/_|_\__,_|\__|_\___/_||_| *
//* |_| *
/// A compilation is a holder for zero or more definitions. It is the top-level object
/// representing the result of processing of a transaction unit by the compiler.
class compilation {
public:
using iterator = definition *;
using const_iterator = definition const *;
using size_type = std::uint32_t;
void operator delete (void * p);
/// \name Construction
///@{
/// Allocates a new compilation in-store and copy the ticket file path and the contents
/// of a vector of definitions into it.
///
/// \param transaction The transaction to which the compilation will be appended.
/// \param triple The target-triple associated with this compilation.
/// \param first_member The first of a sequence of definition instances. The
/// range defined by \p first_member and \p last_member will be copied into the newly
/// allocated compilation.
/// \param last_member The end of the range of definition instances.
/// \result A pair of a pointer and an extent which describes
/// the in-store location of the allocated compilation.
template <typename TransactionType, typename Iterator>
static extent<compilation> alloc (TransactionType & transaction,
typed_address<indirect_string> triple,
Iterator first_member, Iterator last_member);
/// \brief Returns a pointer to an in-pstore compilation instance.
///
/// \param db The database from which the compilation should be loaded.
/// \param location An extent describing the compilation location in the store.
/// \result A pointer to the compilation in-store memory.
static std::shared_ptr<compilation const> load (database const & db,
extent<compilation> const & location);
///@}
/// \name Element access
///@{
definition const & operator[] (std::size_t const i) const {
PSTORE_ASSERT (i < size_);
return members_[i];
}
///@}
/// \name Iterators
///@{
iterator begin () { return members_; }
const_iterator begin () const { return members_; }
const_iterator cbegin () const { return this->begin (); }
iterator end () { return members_ + size_; }
const_iterator end () const { return members_ + size_; }
const_iterator cend () const { return this->end (); }
///@}
/// \name Capacity
///@{
/// Checks whether the container is empty.
bool empty () const noexcept { return size_ == 0; }
/// Returns the number of elements.
size_type size () const noexcept { return size_; }
///@}
/// \name Storage
///@{
/// Returns the number of bytes of storage required for a compilation with 'size'
/// members.
static std::size_t size_bytes (size_type size) noexcept {
size = std::max (size, size_type{1}); // Always at least enough for one member.
return sizeof (compilation) - sizeof (compilation::members_) +
sizeof (compilation::members_[0]) * size;
}
/// \returns The number of bytes needed to accommodate this compilation.
std::size_t size_bytes () const noexcept {
return compilation::size_bytes (this->size ());
}
///@}
/// Returns the target triple.
typed_address<indirect_string> triple () const noexcept { return triple_; }
/// Compute the address of the definition given by \p index within compilation \p c.
///
/// \param c The address of a compilation.
/// \param index The index of a definition within compilation \p c.
/// \result The address of the definition \p index within compilation \p c.
static constexpr typed_address<definition>
index_address (typed_address<compilation> const c, size_type const index) noexcept {
return typed_address<definition>::make (c.to_address () +
offsetof (compilation, members_) +
sizeof (definition) * index);
}
private:
template <typename Iterator>
compilation (typed_address<indirect_string> triple, size_type size,
Iterator first_member, Iterator last_member) noexcept;
struct nmembers {
size_type n;
};
/// A placement-new implementation which allocates sufficient storage for a
/// compilation with the number of members given by the size parameter.
void * operator new (std::size_t s, nmembers size);
/// A copy of the standard placement-new function.
void * operator new (std::size_t s, void * ptr);
void operator delete (void * p, nmembers size);
void operator delete (void * p, void * ptr);
static constexpr std::array<char, 8> compilation_signature_ = {
{'C', 'm', 'p', 'l', '8', 'i', 'o', 'n'}};
std::array<char, 8> signature_ = compilation_signature_;
/// The target triple for this compilation.
typed_address<indirect_string> triple_;
/// The number of entries in the members_ array.
size_type size_ = 0;
std::uint32_t padding1_ = 0;
definition members_[1];
};
PSTORE_STATIC_ASSERT (std::is_standard_layout<compilation>::value);
PSTORE_STATIC_ASSERT (sizeof (compilation) == 32 + sizeof (definition));
PSTORE_STATIC_ASSERT (alignof (compilation) == 16);
template <typename Iterator>
compilation::compilation (typed_address<indirect_string> const triple, size_type const size,
Iterator const first_member, Iterator const last_member) noexcept
: triple_{triple}
, size_{size} {
// Assignment to suppress a warning from clang that the field is not used.
padding1_ = 0;
PSTORE_STATIC_ASSERT (offsetof (compilation, signature_) == 0);
PSTORE_STATIC_ASSERT (offsetof (compilation, triple_) == 8);
PSTORE_STATIC_ASSERT (offsetof (compilation, size_) == 16);
PSTORE_STATIC_ASSERT (offsetof (compilation, padding1_) == 20);
PSTORE_STATIC_ASSERT (offsetof (compilation, members_) == 32);
// This check can safely be an assertion because the method is private and alloc(),
// the sole caller, performs a full run-time check of the size.
PSTORE_ASSERT (unsigned_cast (std::distance (first_member, last_member)) == size);
std::copy (first_member, last_member, this->begin ());
}
// alloc
// ~~~~~
template <typename TransactionType, typename Iterator>
auto compilation::alloc (TransactionType & transaction,
typed_address<indirect_string> triple, Iterator first_member,
Iterator last_member) -> extent<compilation> {
// First work out its size.
auto const dist = std::distance (first_member, last_member);
PSTORE_ASSERT (dist >= 0);
if (dist > std::numeric_limits<size_type>::max ()) {
raise (error_code::too_many_members_in_compilation);
}
auto const num_members = static_cast<size_type> (dist);
auto const size = size_bytes (num_members);
// Allocate the storage.
auto const addr = transaction.allocate (size, alignof (compilation));
auto ptr = std::static_pointer_cast<compilation> (transaction.getrw (addr, size));
// Write the data to the store.
new (ptr.get ()) compilation{triple, num_members, first_member, last_member};
return extent<compilation> (typed_address<compilation> (addr), size);
}
} // end namespace repo
} // end namespace pstore
#endif // PSTORE_MCREPO_COMPILATION_HPP
| 49.022876 | 100 | 0.515632 | paulhuggett |
55e3efd6f6edf5de07f1b2d25fee72a9852bfbdb | 3,752 | hpp | C++ | src/libraries/core/fields/DimensionedFields/DimensionedSymmTensorField/DimensionedSymmTensorField.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | src/libraries/core/fields/DimensionedFields/DimensionedSymmTensorField/DimensionedSymmTensorField.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | src/libraries/core/fields/DimensionedFields/DimensionedSymmTensorField/DimensionedSymmTensorField.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | /*---------------------------------------------------------------------------*\
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of CAELUS.
CAELUS 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.
CAELUS 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 CAELUS. If not, see <http://www.gnu.org/licenses/>.
InClass
CML::DimensionedSymmTensorField
Description
SymmTensor specific part of the implementation of DimensionedField.
\*---------------------------------------------------------------------------*/
#ifndef DimensionedSymmTensorField_H
#define DimensionedSymmTensorField_H
#include "DimensionedField.hpp"
#include "symmTensor.hpp"
#define TEMPLATE template<class GeoMesh>
#include "DimensionedFieldFunctionsM.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace CML
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
UNARY_FUNCTION(symmTensor, vector, sqr, transform)
UNARY_FUNCTION(scalar, symmTensor, tr, transform)
UNARY_FUNCTION(sphericalTensor, symmTensor, sph, transform)
UNARY_FUNCTION(symmTensor, symmTensor, symm, transform)
UNARY_FUNCTION(symmTensor, symmTensor, twoSymm, transform)
UNARY_FUNCTION(symmTensor, symmTensor, dev, transform)
UNARY_FUNCTION(symmTensor, symmTensor, dev2, transform)
UNARY_FUNCTION(scalar, symmTensor, det, transform)
UNARY_FUNCTION(symmTensor, symmTensor, cof, cof)
UNARY_FUNCTION(symmTensor, symmTensor, inv, inv)
// * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
UNARY_OPERATOR(vector, symmTensor, *, hdual, transform)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace CML
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "undefFieldFunctionsM.hpp"
#include "symmTensorField.hpp"
#define TEMPLATE template<class GeoMesh>
#include "DimensionedFieldFunctionsM.hxx"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace CML
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
UNARY_FUNCTION(symmTensor, vector, sqr, transform)
UNARY_FUNCTION(scalar, symmTensor, tr, transform)
UNARY_FUNCTION(sphericalTensor, symmTensor, sph, transform)
UNARY_FUNCTION(symmTensor, symmTensor, symm, transform)
UNARY_FUNCTION(symmTensor, symmTensor, twoSymm, transform)
UNARY_FUNCTION(symmTensor, symmTensor, dev, transform)
UNARY_FUNCTION(symmTensor, symmTensor, dev2, transform)
UNARY_FUNCTION(scalar, symmTensor, det, transform)
UNARY_FUNCTION(symmTensor, symmTensor, cof, cof)
UNARY_FUNCTION(symmTensor, symmTensor, inv, inv)
// * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
UNARY_OPERATOR(vector, symmTensor, *, hdual, transform)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace CML
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "undefFieldFunctionsM.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| 32.626087 | 79 | 0.545309 | MrAwesomeRocks |
55e537fd69426fb6d3cb722d59fa00f56456eac7 | 893 | cc | C++ | src/command/rm_command.cc | archilleu/lsm-db | e3a6f0de370722a69419f56646ab42f89e6abdbf | [
"Unlicense"
] | null | null | null | src/command/rm_command.cc | archilleu/lsm-db | e3a6f0de370722a69419f56646ab42f89e6abdbf | [
"Unlicense"
] | null | null | null | src/command/rm_command.cc | archilleu/lsm-db | e3a6f0de370722a69419f56646ab42f89e6abdbf | [
"Unlicense"
] | null | null | null | //---------------------------------------------------------------------------
#include "rm_command.h"
//---------------------------------------------------------------------------
namespace lsm
{
//---------------------------------------------------------------------------
using namespace base::json;
//---------------------------------------------------------------------------
RmCommand::RmCommand(const std::string& key)
: Command(CommandType::RM)
{
key_ = key;
}
//---------------------------------------------------------------------------
std::string RmCommand::ToString() const
{
Value value(Value::Object);
value["key"] = key_;
value["type"] = 1;
return JsonWriter(value).ToString();
}
//---------------------------------------------------------------------------
}//namespace lsm
//---------------------------------------------------------------------------
| 31.892857 | 77 | 0.256439 | archilleu |
55e6582fa1a3884c2a5e27b5936a50fdd0af71b0 | 828 | cpp | C++ | src_test/blockchain/trx/DummyAddress.cpp | alinous-core/codable-cash | 32a86a152a146c592bcfd8cc712f4e8cb38ee1a0 | [
"MIT"
] | 1 | 2020-10-15T08:24:35.000Z | 2020-10-15T08:24:35.000Z | src_test/blockchain/trx/DummyAddress.cpp | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | src_test/blockchain/trx/DummyAddress.cpp | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | /*
* DummyAddress.cpp
*
* Created on: 2019/01/04
* Author: iizuka
*/
#include "blockchain/trx/DummyAddress.h"
namespace codablecash {
DummyAddress::DummyAddress() : AbstractAddress(100){
}
DummyAddress::~DummyAddress() {
}
AbstractAddress* DummyAddress::clone() const noexcept {
return nullptr;
}
bool DummyAddress::equals(const AbstractAddress* other) const noexcept{
return false;
}
int DummyAddress::binarySize() const {
return 0;
}
void DummyAddress::toBinary(ByteBuffer* out) const {
}
IBlockObject* DummyAddress::copyData() const noexcept {
return nullptr;
}
AbstractTransactionInput* DummyAddress::toTransactionInput(const BalanceUnit* amount) const noexcept {
return nullptr;
}
const ScPublicKey* DummyAddress::getPubkey() const noexcept {
return nullptr;
}
} /* namespace codablecash */
| 16.897959 | 102 | 0.741546 | alinous-core |
55e884e7214c235746421f6dec1be3bd99daddc6 | 7,951 | cpp | C++ | projects/video/src/Stream.cpp | jsvenus/MosaicUI | 5e01079eb29f82a5916dcbd8c8fd7936e322b873 | [
"MIT"
] | 1 | 2019-02-01T01:41:42.000Z | 2019-02-01T01:41:42.000Z | projects/video/src/Stream.cpp | jsvenus/MosaicUI | 5e01079eb29f82a5916dcbd8c8fd7936e322b873 | [
"MIT"
] | null | null | null | projects/video/src/Stream.cpp | jsvenus/MosaicUI | 5e01079eb29f82a5916dcbd8c8fd7936e322b873 | [
"MIT"
] | null | null | null | #include <video/Stream.h>
/*
libav signals a SIGPIPE when the remote connections disconnects
when it's not yet initialized, therefore we need to handle the
SIGPIPE.
See: https://git.libav.org/?p=libav.git;a=commitdiff;h=6ee1cb5740e7490151db7dcec7e20ceaf8a2fe1f
*/
#include <signal.h>
extern "C" {
static void sigpipe_handler(int s); /* we attach this to the SIGPIPE */
}
namespace vid {
int Stream::sighandler_installed = 0;
/* --------------------------------------------------------------------- */
static int interrupt_cb(void* user); /* is called by libav and used to make sure a socket read will not last forever */
/* --------------------------------------------------------------------- */
Stream::Stream()
:fmt_ctx(NULL)
,codec_ctx(NULL)
,input_codec(NULL)
,video_stream_dx(-1)
,video_stream_timebase(-1)
,timestamp(0)
,is_stream_open(-1)
,is_eof(-1)
,on_frame(NULL)
,on_event(NULL)
,user(NULL)
{
/* init libav */
av_register_all();
avformat_network_init();
avcodec_register_all();
#if !defined(NDEBUG)
av_log_set_level(AV_LOG_DEBUG);
#endif
/* install our sigpipe handler, which libav fires when writing to a invald socket. */
if (0 == sighandler_installed) {
signal(SIGPIPE, sigpipe_handler);
sighandler_installed = 1;
}
}
Stream::~Stream() {
}
int Stream::init(std::string url) {
AVDictionary *options = NULL;
int r, i;
/* validate */
if (0 == url.size()) {
RX_ERROR("Invalid url");
return -1;
}
if (NULL != fmt_ctx) {
RX_ERROR("Trying to initialize the stream but we're already initialized.");
return -2;
}
av_dict_set(&options, "analyzeduration", "1500000", 0);
fmt_ctx = avformat_alloc_context();
if (NULL == fmt_ctx) {
RX_ERROR("Cannot allocate the AVFormatContext");
return -3;
}
/* set the interrupt so we can stop when we cannot connect to the stream. */
fmt_ctx->interrupt_callback.callback = interrupt_cb;
fmt_ctx->interrupt_callback.opaque = this;
timestamp = rx_hrtime();
/* open the stream */
r = avformat_open_input(&fmt_ctx, url.c_str(), NULL, &options);
if (r < 0) {
RX_ERROR("Trying to open the rtmp stream failed, server not running?");
return -4;
}
is_stream_open = 1;
av_dict_free(&options);
options = NULL;
r = avformat_find_stream_info(fmt_ctx, NULL);
if (r < 0) {
RX_ERROR("Cannot find stream info.");
return -5;
}
/* check if there are streams */
if (0 == fmt_ctx->nb_streams) {
printf("No streams found.");
return -6;
}
/* find the video stream */
for (i = 0; i < fmt_ctx->nb_streams; ++i) {
if (AVMEDIA_TYPE_VIDEO == fmt_ctx->streams[i]->codec->codec_type) {
video_stream_dx = i;
}
}
if (-1 == video_stream_dx) {
RX_ERROR("Warning: cannot find a video stream.");
return -7;
}
/* find decoder */
input_codec = avcodec_find_decoder(fmt_ctx->streams[video_stream_dx]->codec->codec_id);
if (NULL == input_codec) {
RX_ERROR("Cannot find input codec.");
return -8;
}
/* open codec. */
codec_ctx = avcodec_alloc_context3(NULL);
if (NULL == codec_ctx) {
RX_ERROR("Cannot allocate the codec context.");
::exit(1);
}
r = avcodec_copy_context(codec_ctx, fmt_ctx->streams[video_stream_dx]->codec);
if (r != 0) {
RX_ERROR("Cannot copy the codec context!");
::exit(1);
}
r = avcodec_open2(codec_ctx, input_codec, NULL);
if (r < 0) {
RX_ERROR("Cannot open the coded for the rtmp stream.");
return -9;
}
/* we are keeping track of frames in our jitter buffer, so this must be set.
See: https://libav.org/doxygen/master/group__lavc__decoding.html#ga3e4048fd6893d4a001bdaa3d251f3c03
refcounted_frames: https://libav.org/doxygen/master/structAVCodecContext.html
*/
codec_ctx->refcounted_frames = 1;
/* get the timebase in nanosec */
video_stream_timebase = (double)(av_q2d(fmt_ctx->streams[video_stream_dx]->time_base));
if (video_stream_timebase <= 0) {
RX_ERROR("The video stream timebase is invalid.");
return -11;
}
/* we're successfully initialized! */
if (on_event) {
on_event(VID_EVENT_INIT_SUCCESS, user);
}
return 0;
}
int Stream::update() {
static char serr[1024] = { 0 };
AVFrame* frame;
AVPacket pkt;
int len;
int got_picture;
int r;
/* We're very safe :) */
if (NULL == fmt_ctx) { return -1; }
if (NULL == codec_ctx) { return -2; }
if (NULL == frame) { return -3; }
if (NULL == input_codec) { return -4; }
if (-1 == video_stream_dx) { return -5; }
if (-1 == is_stream_open) { return -6; }
if (1 == is_eof) { return -7; }
/* make sure we update our running time so the interrupt will return success */
timestamp = rx_hrtime();
/* initialize the packet that will hold the encoded data */
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
/* read a new frame. */
r = av_read_frame(fmt_ctx, &pkt);
if (AVERROR_EOF == r) {
RX_VERBOSE("End of stream")
av_free_packet(&pkt);
is_eof = 1;
if (on_event) {
on_event(VID_EVENT_EOF, user);
}
return 0;
}
else if (0 != r) {
/* try to get a descriptive error. */
r = av_strerror(r, serr, sizeof(serr));
if (0 != r) {
RX_ERROR("Cannot get a string representation of the error :$. %d", r);
}
RX_ERROR("Error: something went wrong with reading a packet: %d, %s", r, serr);
av_free_packet(&pkt);
return -7;
}
/* skip non-video packets */
if (pkt.stream_index != video_stream_dx) {
av_free_packet(&pkt);
return 0;
}
/* allocate the frame that we used when decoding packets. */
frame = av_frame_alloc();
if (NULL == frame) {
RX_ERROR("Cannot allocate the avframe.");
av_free_packet(&pkt);
return -9;
}
/* decode the video frame. */
len = avcodec_decode_video2(codec_ctx, frame, &got_picture, &pkt);
if (len < 0) {
RX_ERROR("Error: cannot decode the packet: %d", len);
av_free_packet(&pkt);
return -8;
}
/* free the packet again. */
av_free_packet(&pkt);
/* pass the decoded frame to the user. */
if (0 != got_picture && NULL != on_frame) {
on_frame(frame, user);
}
return 0;
}
int Stream::shutdown() {
/* close and free the codec context */
if (NULL != codec_ctx) {
avcodec_close(codec_ctx);
av_free(codec_ctx);
}
/* close input stream, which will free all internal members. */
if (1 == is_stream_open) {
avformat_close_input(&fmt_ctx);
}
fmt_ctx = NULL;
codec_ctx = NULL;
input_codec = NULL;
video_stream_dx = -1;
video_stream_timebase = -1;
is_stream_open = -1;
is_eof = -1;
timestamp = 0;
return 0;
}
/* --------------------------------------------------------------------- */
static int interrupt_cb(void* user) {
Stream* s = static_cast<Stream*>(user);
if (NULL == s) {
RX_ERROR("The user pointer to interrupt_cb is invalid.");
return 1; /* stop */
}
/* timeout after X seconds */
/* @todo make video timeout configurable */
uint64_t dt = rx_hrtime() - s->timestamp;
if (dt > (6e9)) {
if (NULL != s->on_event) {
s->on_event(VID_EVENT_TIMEOUT, s->user);
}
RX_ERROR("We timed out the video stream.");
return 1;
}
return 0;
}
/* --------------------------------------------------------------------- */
} /* namespace vid */
extern "C" {
void sigpipe_handler(int n) {
RX_VERBOSE("Received a SIGPIPE from libav");
}
}
| 25.731392 | 161 | 0.574267 | jsvenus |
55e8a46085f327361786e5db44c171b77f43827f | 13,139 | hpp | C++ | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
#include "extern/beatsaber-hook/shared/utils/byref.hpp"
// Including type: SongController
#include "GlobalNamespace/SongController.hpp"
// Including type: IStartSeekSongController
#include "GlobalNamespace/IStartSeekSongController.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
// Begin forward declares
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: AudioTimeSyncController
class AudioTimeSyncController;
// Forward declaring type: AudioPitchGainEffect
class AudioPitchGainEffect;
// Forward declaring type: IBeatmapObjectCallbackController
class IBeatmapObjectCallbackController;
}
// Forward declaring namespace: UnityEngine
namespace UnityEngine {
// Forward declaring type: WaitUntil
class WaitUntil;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Size: 0x39
#pragma pack(push, 1)
// Autogenerated type: GameSongController
// [TokenAttribute] Offset: FFFFFFFF
class GameSongController : public GlobalNamespace::SongController/*, public GlobalNamespace::IStartSeekSongController*/ {
public:
// private AudioTimeSyncController _audioTimeSyncController
// Size: 0x8
// Offset: 0x20
GlobalNamespace::AudioTimeSyncController* audioTimeSyncController;
// Field size check
static_assert(sizeof(GlobalNamespace::AudioTimeSyncController*) == 0x8);
// private AudioPitchGainEffect _failAudioPitchGainEffect
// Size: 0x8
// Offset: 0x28
GlobalNamespace::AudioPitchGainEffect* failAudioPitchGainEffect;
// Field size check
static_assert(sizeof(GlobalNamespace::AudioPitchGainEffect*) == 0x8);
// [InjectAttribute] Offset: 0xEB6928
// private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
// Size: 0x8
// Offset: 0x30
GlobalNamespace::IBeatmapObjectCallbackController* beatmapObjectCallbackController;
// Field size check
static_assert(sizeof(GlobalNamespace::IBeatmapObjectCallbackController*) == 0x8);
// private System.Boolean _songDidFinish
// Size: 0x1
// Offset: 0x38
bool songDidFinish;
// Field size check
static_assert(sizeof(bool) == 0x1);
// Creating value type constructor for type: GameSongController
GameSongController(GlobalNamespace::AudioTimeSyncController* audioTimeSyncController_ = {}, GlobalNamespace::AudioPitchGainEffect* failAudioPitchGainEffect_ = {}, GlobalNamespace::IBeatmapObjectCallbackController* beatmapObjectCallbackController_ = {}, bool songDidFinish_ = {}) noexcept : audioTimeSyncController{audioTimeSyncController_}, failAudioPitchGainEffect{failAudioPitchGainEffect_}, beatmapObjectCallbackController{beatmapObjectCallbackController_}, songDidFinish{songDidFinish_} {}
// Creating interface conversion operator: operator GlobalNamespace::IStartSeekSongController
operator GlobalNamespace::IStartSeekSongController() noexcept {
return *reinterpret_cast<GlobalNamespace::IStartSeekSongController*>(this);
}
// Get instance field: private AudioTimeSyncController _audioTimeSyncController
GlobalNamespace::AudioTimeSyncController* _get__audioTimeSyncController();
// Set instance field: private AudioTimeSyncController _audioTimeSyncController
void _set__audioTimeSyncController(GlobalNamespace::AudioTimeSyncController* value);
// Get instance field: private AudioPitchGainEffect _failAudioPitchGainEffect
GlobalNamespace::AudioPitchGainEffect* _get__failAudioPitchGainEffect();
// Set instance field: private AudioPitchGainEffect _failAudioPitchGainEffect
void _set__failAudioPitchGainEffect(GlobalNamespace::AudioPitchGainEffect* value);
// Get instance field: private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
GlobalNamespace::IBeatmapObjectCallbackController* _get__beatmapObjectCallbackController();
// Set instance field: private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
void _set__beatmapObjectCallbackController(GlobalNamespace::IBeatmapObjectCallbackController* value);
// Get instance field: private System.Boolean _songDidFinish
bool _get__songDidFinish();
// Set instance field: private System.Boolean _songDidFinish
void _set__songDidFinish(bool value);
// public System.Single get_songLength()
// Offset: 0x1F1BF2C
float get_songLength();
// public UnityEngine.WaitUntil get_waitUntilIsReadyToStartTheSong()
// Offset: 0x1F1BF48
UnityEngine::WaitUntil* get_waitUntilIsReadyToStartTheSong();
// protected System.Void LateUpdate()
// Offset: 0x1F1BF64
void LateUpdate();
// public System.Void StartSong(System.Single songTimeOffset)
// Offset: 0x1F1BFDC
void StartSong(float songTimeOffset);
// public System.Void FailStopSong()
// Offset: 0x1F1C1A4
void FailStopSong();
// public System.Void SeekTo(System.Single songTime)
// Offset: 0x1F1C368
void SeekTo(float songTime);
// private System.Void <FailStopSong>b__13_0()
// Offset: 0x1F1C38C
void $FailStopSong$b__13_0();
// public System.Void .ctor()
// Offset: 0x1F1C384
// Implemented from: SongController
// Base method: System.Void SongController::.ctor()
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static GameSongController* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::GameSongController::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<GameSongController*, creationType>()));
}
// public override System.Void StopSong()
// Offset: 0x1F1C000
// Implemented from: SongController
// Base method: System.Void SongController::StopSong()
void StopSong();
// public override System.Void PauseSong()
// Offset: 0x1F1C01C
// Implemented from: SongController
// Base method: System.Void SongController::PauseSong()
void PauseSong();
// public override System.Void ResumeSong()
// Offset: 0x1F1C0E0
// Implemented from: SongController
// Base method: System.Void SongController::ResumeSong()
void ResumeSong();
}; // GameSongController
#pragma pack(pop)
static check_size<sizeof(GameSongController), 56 + sizeof(bool)> __GlobalNamespace_GameSongControllerSizeCheck;
static_assert(sizeof(GameSongController) == 0x39);
}
DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::GameSongController*, "", "GameSongController");
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::get_songLength
// Il2CppName: get_songLength
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::get_songLength)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "get_songLength", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::get_waitUntilIsReadyToStartTheSong
// Il2CppName: get_waitUntilIsReadyToStartTheSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<UnityEngine::WaitUntil* (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::get_waitUntilIsReadyToStartTheSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "get_waitUntilIsReadyToStartTheSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::LateUpdate
// Il2CppName: LateUpdate
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::LateUpdate)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "LateUpdate", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::StartSong
// Il2CppName: StartSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)(float)>(&GlobalNamespace::GameSongController::StartSong)> {
static const MethodInfo* get() {
static auto* songTimeOffset = &::il2cpp_utils::GetClassFromName("System", "Single")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "StartSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{songTimeOffset});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::FailStopSong
// Il2CppName: FailStopSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::FailStopSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "FailStopSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::SeekTo
// Il2CppName: SeekTo
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)(float)>(&GlobalNamespace::GameSongController::SeekTo)> {
static const MethodInfo* get() {
static auto* songTime = &::il2cpp_utils::GetClassFromName("System", "Single")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "SeekTo", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{songTime});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::$FailStopSong$b__13_0
// Il2CppName: <FailStopSong>b__13_0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::$FailStopSong$b__13_0)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "<FailStopSong>b__13_0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::StopSong
// Il2CppName: StopSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::StopSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "StopSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::PauseSong
// Il2CppName: PauseSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::PauseSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "PauseSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::ResumeSong
// Il2CppName: ResumeSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::ResumeSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "ResumeSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
| 56.878788 | 498 | 0.755841 | marksteward |
55e9af34cd76704e307c1b2ae8d340cdb645311b | 1,855 | hpp | C++ | src/gamescene.hpp | zhs007/natasha | 80b1a20b68ee1c162973b300933673dc15cf3228 | [
"Apache-2.0"
] | null | null | null | src/gamescene.hpp | zhs007/natasha | 80b1a20b68ee1c162973b300933673dc15cf3228 | [
"Apache-2.0"
] | null | null | null | src/gamescene.hpp | zhs007/natasha | 80b1a20b68ee1c162973b300933673dc15cf3228 | [
"Apache-2.0"
] | null | null | null | #ifndef __NATASHA_GAMESCENE_H__
#define __NATASHA_GAMESCENE_H__
#include "basedef.hpp"
#include "symbol.hpp"
#include <vector>
BEGIN_NATASHA()
// -----------------------------------------------------------------------------------
// GameSceneNode
struct GameSceneNode {
int x, y;
SymbolCode code;
};
// -----------------------------------------------------------------------------------
// LineData
class LineData {
public:
LineData() { clear(); }
virtual ~LineData() {}
public:
// get symbol with (index)
virtual SymbolCode getSymbol(int index);
// get node with (index)
virtual GameSceneNode* getNode(int index);
// reset to empty
virtual void clear();
protected:
std::vector<GameSceneNode> m_lst;
};
// -----------------------------------------------------------------------------------
// WayData
class WayData {
public:
WayData() { clear(); }
virtual ~WayData() {}
public:
// get symbol with (index)
virtual SymbolCode getSymbol(int index);
// reset to empty
virtual void clear();
protected:
std::vector<GameSceneNode> m_lst;
};
// -----------------------------------------------------------------------------------
// BlockData
class BlockData {
public:
BlockData() {}
virtual ~BlockData() {}
public:
// get symbol with (x, y)
virtual SymbolCode getSymbol(int x, int y) = 0;
// reset to empty
virtual void clear() = 0;
private:
};
// -----------------------------------------------------------------------------------
// GameScene
class GameScene {
public:
GameScene() {}
virtual ~GameScene() {}
public:
// get symbol with (x, y)
virtual SymbolCode getSymbol(int x, int y) = 0;
// reset to INVALID_SYMBOL
virtual void clear() = 0;
private:
};
END_NATASHA()
#endif //__NATASHA_GAMESCENE_H__
| 21.823529 | 86 | 0.490027 | zhs007 |
55ec9afa2f616b458c9948c60c14610c41382a65 | 36,597 | cpp | C++ | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 523 | 2018-02-02T08:07:24.000Z | 2022-03-21T15:44:39.000Z | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 28 | 2018-02-02T20:58:13.000Z | 2022-02-06T15:03:41.000Z | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 28 | 2018-02-02T12:05:55.000Z | 2021-09-16T21:05:05.000Z | // Copyright 2018 Adrien Guinet <adrien@guinet.me>
//
// 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 <string>
#include <cinttypes>
#include <clang/Basic/FileManager.h>
#include <clang/Basic/LangStandard.h>
#include <clang/CodeGen/CodeGenAction.h>
#include <clang/Driver/Compilation.h>
#include <clang/Driver/Driver.h>
#include <clang/Driver/DriverDiagnostic.h>
#include <clang/Driver/Options.h>
#include <clang/Driver/Tool.h>
#include <clang/Driver/ToolChain.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/CompilerInvocation.h>
#include <clang/Frontend/FrontendActions.h>
#include <clang/Frontend/FrontendDiagnostic.h>
#include <clang/Frontend/TextDiagnosticBuffer.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/Utils.h>
#include <clang/FrontendTool/Utils.h>
#include <llvm/BinaryFormat/Dwarf.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/IR/DebugInfo.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/Object/ObjectFile.h>
#include <llvm/Option/Arg.h>
#include <llvm/Option/ArgList.h>
#include <llvm/Support/Compiler.h>
#include <llvm/Support/ErrorHandling.h>
#include <llvm/Support/Host.h>
#include <llvm/Support/Path.h>
#include <llvm/Support/Process.h>
#include <llvm/Support/Program.h>
#include <llvm/Support/Signals.h>
#include <llvm/Support/TargetRegistry.h>
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/VirtualFileSystem.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Target/TargetMachine.h>
#include <dffi/config.h>
#include <dffi/ctypes.h>
#include <dffi/dffi.h>
#include <dffi/types.h>
#include <dffi/composite_type.h>
#include <dffi/casting.h>
#include "dffi_impl.h"
#include "types_printer.h"
using namespace llvm;
using namespace clang;
namespace dffi {
static CallingConv dwarfCCToDFFI(uint8_t DwCC)
{
// This is the inverse of the getDwarfCC function in clang/lib/CodeGen/CGDebugInfo.cpp!
switch (DwCC) {
case 0:
return CC_C;
case dwarf::DW_CC_BORLAND_stdcall:
return CC_X86StdCall;
case dwarf::DW_CC_BORLAND_msfastcall:
return CC_X86FastCall;
case dwarf::DW_CC_BORLAND_thiscall:
return CC_X86ThisCall;
case dwarf::DW_CC_LLVM_vectorcall:
return CC_X86VectorCall;
case dwarf::DW_CC_BORLAND_pascal:
return CC_X86Pascal;
case dwarf::DW_CC_LLVM_Win64:
return CC_Win64;
case dwarf::DW_CC_LLVM_X86_64SysV:
return CC_X86_64SysV;
case dwarf::DW_CC_LLVM_AAPCS:
return CC_AAPCS;
case dwarf::DW_CC_LLVM_AAPCS_VFP:
return CC_AAPCS_VFP;
case dwarf::DW_CC_LLVM_IntelOclBicc:
return CC_IntelOclBicc;
case dwarf::DW_CC_LLVM_SpirFunction:
return CC_SpirFunction;
case dwarf::DW_CC_LLVM_OpenCLKernel:
return CC_OpenCLKernel;
case dwarf::DW_CC_LLVM_Swift:
return CC_Swift;
case dwarf::DW_CC_LLVM_PreserveMost:
return CC_PreserveMost;
case dwarf::DW_CC_LLVM_PreserveAll:
return CC_PreserveAll;
case dwarf::DW_CC_LLVM_X86RegCall:
return CC_X86RegCall;
}
assert(false && "unknown calling convention!");
return CC_C;
}
std::string CCOpts::getSysroot() const
{
// If this->Sysroot is defined, returns it. Otherwise, check the DFFI_SYSROOT
// environment variable.
if (!Sysroot.empty()) {
return Sysroot;
}
auto OEnv = sys::Process::GetEnv("DFFI_SYSROOT");
if (OEnv.hasValue()) {
return std::move(OEnv.getValue());
}
return {};
}
namespace details {
namespace {
const char* WrapperPrefix = "__dffi_wrapper_";
llvm::DIType const* getCanonicalDIType(llvm::DIType const* Ty)
{
// Go throught every typedef and returns the "original" type!
if (auto* DTy = llvm::dyn_cast_or_null<DIDerivedType>(Ty)) {
switch (DTy->getTag()) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_const_type:
case dwarf::DW_TAG_volatile_type:
case dwarf::DW_TAG_restrict_type:
return getCanonicalDIType(DTy->getBaseType());
default:
break;
};
}
return Ty;
}
llvm::DIType const* stripDITypePtr(llvm::DIType const* Ty)
{
auto* PtrATy = llvm::cast<DIDerivedType>(Ty);
assert(PtrATy->getTag() == llvm::dwarf::DW_TAG_pointer_type && "must be a pointer type!");
return PtrATy->getBaseType();
}
std::string getWrapperName(size_t Idx)
{
return std::string{WrapperPrefix} + std::to_string(Idx);
}
} // anonymous
DFFIImpl::DFFIImpl(CCOpts const& Opts):
Clang_(new CompilerInstance{}),
DiagOpts_(new DiagnosticOptions{}),
DiagID_(new DiagnosticIDs{}),
ErrorMsgStream_(ErrorMsg_),
VFS_(new llvm::vfs::InMemoryFileSystem{}),
Opts_(Opts)
{
TextDiagnosticPrinter *DiagClient =
new TextDiagnosticPrinter{ErrorMsgStream_, &*DiagOpts_};
Diags_ = new DiagnosticsEngine{DiagID_, &*DiagOpts_, DiagClient, true};
// Add an overleay with our virtual file system on top of the system!
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> Overlay(new llvm::vfs::OverlayFileSystem{vfs::getRealFileSystem()});
Overlay->pushOverlay(VFS_);
// Finally add clang's ressources
Overlay->pushOverlay(getClangResFileSystem());
const auto TripleStr = llvm::sys::getProcessTriple();
Driver_.reset(new driver::Driver{"dummy", TripleStr, *Diags_, Overlay});
Driver_->setTitle("clang interpreter");
Driver_->setCheckInputsExist(false);
const char* ResDir = getClangResRootDirectory();
SmallVector<const char*, 17> Args = {"dffi",
Opts.hasCXX() ? "dummy.cpp" : "dummy.c",
"-fsyntax-only", "-resource-dir", ResDir};
const auto Sysroot = Opts.getSysroot();
if (!Sysroot.empty()) {
Args.push_back("--sysroot");
Args.push_back(Sysroot.c_str());
}
for (auto const& D: Opts.IncludeDirs) {
Args.push_back("-I");
Args.push_back(D.c_str());
}
std::unique_ptr<driver::Compilation> C(Driver_->BuildCompilation(Args));
if (!C) {
unreachable("unable to instantiate clang");
}
const driver::JobList &Jobs = C->getJobs();
if (Jobs.size() != 1 || !isa<driver::Command>(*Jobs.begin())) {
SmallString<256> Msg;
llvm::raw_svector_ostream OS(Msg);
Jobs.Print(OS, "; ", true);
unreachable(OS.str().str().c_str());
}
const driver::Command &Cmd = cast<driver::Command>(*Jobs.begin());
if (llvm::StringRef(Cmd.getCreator().getName()) != "clang") {
Diags_->Report(diag::err_fe_expected_clang_command);
unreachable("bad command");
}
// Initialize a compiler invocation object from the clang (-cc1) arguments.
const llvm::opt::ArgStringList &CCArgs = Cmd.getArguments();
std::unique_ptr<CompilerInvocation> pCI(new CompilerInvocation{});
CompilerInvocation::CreateFromArgs(*pCI, CCArgs, *Diags_);
auto& CI = *pCI;
auto& TO = CI.getTargetOpts();
TO.Triple = TripleStr;
// We create it by hand to have a minimal user-friendly API!
auto& CGO = CI.getCodeGenOpts();
CGO.OptimizeSize = false;
CGO.OptimizationLevel = Opts.OptLevel;
CGO.CodeModel = "default";
CGO.RelocationModel = llvm::Reloc::PIC_;
CGO.ThreadModel = "posix";
// We use debug info for type recognition!
CGO.setDebugInfo(codegenoptions::FullDebugInfo);
CI.getDiagnosticOpts().ShowCarets = false;
CI.getLangOpts()->LineComment = true;
CI.getLangOpts()->Optimize = true;
CI.getLangOpts()->C99 = !Opts.hasCXX();
CI.getLangOpts()->C11 = !Opts.hasCXX();
CI.getLangOpts()->CPlusPlus = Opts.hasCXX();
CI.getLangOpts()->CPlusPlus11 = Opts.CXX >= CXXMode::Std11;
CI.getLangOpts()->CPlusPlus14 = Opts.CXX >= CXXMode::Std14;
CI.getLangOpts()->CPlusPlus17 = Opts.CXX >= CXXMode::Std17;
CI.getLangOpts()->CPlusPlus20 = Opts.CXX >= CXXMode::Std20;
CI.getLangOpts()->CXXExceptions = false;
CI.getLangOpts()->CXXOperatorNames = Opts.hasCXX();
CI.getLangOpts()->Bool = Opts.hasCXX();
CI.getLangOpts()->WChar = Opts.hasCXX(); // builtin in C++, typedef in C (stddef.h)
CI.getLangOpts()->EmitAllDecls = true;
const bool IsWinMSVC = Triple{TO.Triple}.isWindowsMSVCEnvironment();
CI.getLangOpts()->MSVCCompat = IsWinMSVC;
CI.getLangOpts()->MicrosoftExt = IsWinMSVC;
CI.getLangOpts()->AsmBlocks = IsWinMSVC;
CI.getLangOpts()->DeclSpecKeyword = IsWinMSVC;
CI.getLangOpts()->MSBitfields = IsWinMSVC;
// gnu compatibility
CI.getLangOpts()->GNUMode = Opts.GNUExtensions;
CI.getLangOpts()->GNUKeywords = Opts.GNUExtensions;
CI.getLangOpts()->GNUAsm = Opts.GNUExtensions;
CI.getFrontendOpts().ProgramAction = frontend::EmitLLVMOnly;
Clang_->setInvocation(std::move(pCI));
Clang_->setDiagnostics(&*Diags_);
assert(Clang_->hasDiagnostics());
FileMgr_ = new FileManager(Clang_->getFileSystemOpts(), std::move(Overlay));
Clang_->createSourceManager(*FileMgr_);
Clang_->setFileManager(FileMgr_.get());
// Intialize execution engine!
std::string Error;
const llvm::Target *Tgt = TargetRegistry::lookupTarget(TO.Triple, Error);
if (!Tgt) {
std::stringstream ss;
ss << "unable to find native target: " << Error << "!";
unreachable(ss.str().c_str());
}
std::unique_ptr<llvm::Module> DummyM(new llvm::Module{"DummyM",Ctx_});
DummyM->setTargetTriple(TO.Triple);
EngineBuilder EB(std::move(DummyM));
EB.setEngineKind(EngineKind::JIT)
.setErrorStr(&Error)
.setOptLevel(CodeGenOpt::Default)
.setRelocationModel(Reloc::Static);
SmallVector<std::string, 1> Attrs;
// TODO: get the target machine from clang?
EE_.reset(EB.create());
if (!EE_) {
std::stringstream ss;
ss << "error creating jit: " << Error;
unreachable(ss.str().c_str());
}
}
void DFFIImpl::resetDiagnostics()
{
auto& Diag = Clang_->getDiagnostics();
Diag.Reset();
Diag.getClient()->clear();
}
void DFFIImpl::getCompileError(std::string& Err)
{
ErrorMsgStream_.flush();
Err = std::move(ErrorMsg_);
ErrorMsg_ = std::string{};
}
std::unique_ptr<llvm::Module> DFFIImpl::compile_llvm_with_decls(StringRef const Code, StringRef const CUName, FuncAliasesMap& FuncAliases, std::string& Err)
{
// Two pass compilation!
// First pass parse the AST of clang and generate wrappers for every
// defined-only functions. Second pass generates the LLVM IR of the original
// code with these definitions!
const bool hasCXX = Opts_.hasCXX();
auto& CI = Clang_->getInvocation();
CI.getFrontendOpts().Inputs.clear();
CI.getFrontendOpts().Inputs.push_back(
FrontendInputFile(CUName, hasCXX ? Language::CXX : Language::C));
auto Buf = MemoryBuffer::getMemBufferCopy(Code);
VFS_->addFile(CUName, time(NULL), std::move(Buf));
auto Action = std::make_unique<ASTGenWrappersAction>(FuncAliases);
if(!Clang_->ExecuteAction(*Action)) {
getCompileError(Err);
resetDiagnostics();
return nullptr;
}
resetDiagnostics();
auto BufForceDecl = Code.str() + "\n";
if (hasCXX) BufForceDecl += "extern \"C\" {\n";
BufForceDecl += Action->forceDecls();
if (hasCXX) BufForceDecl += "\n}\n";
SmallString<128> PrivateCU;
("/__dffi_private/force_decls/" + CUName).toStringRef(PrivateCU);
return compile_llvm(BufForceDecl, PrivateCU, Err);
}
std::unique_ptr<llvm::Module> DFFIImpl::compile_llvm(StringRef const Code, StringRef const CUName, std::string& Err)
{
// DiagnosticsEngine->Reset() does not seem to reset everything, as errors
// are added up from other compilation units!
auto Buf = MemoryBuffer::getMemBufferCopy(Code);
auto& CI = Clang_->getInvocation();
CI.getFrontendOpts().Inputs.clear();
CI.getFrontendOpts().Inputs.push_back(
FrontendInputFile(CUName, Opts_.hasCXX() ? Language::CXX : Language::C));
VFS_->addFile(CUName, time(NULL), std::move(Buf));
auto LLVMAction = std::make_unique<clang::EmitLLVMOnlyAction>(&Ctx_);
if(!Clang_->ExecuteAction(*LLVMAction)) {
getCompileError(Err);
resetDiagnostics();
return nullptr;
}
resetDiagnostics();
return LLVMAction->takeModule();
}
void getFuncWrapperName(SmallVectorImpl<char>& Ret, StringRef const Name)
{
(WrapperPrefix + Name).toVector(Ret);
}
StringRef getFuncNameFromWrapper(StringRef const Name)
{
assert(isWrapperFunction(Name));
return Name.substr(strlen(WrapperPrefix));
}
bool isWrapperFunction(StringRef const Name)
{
return Name.startswith(WrapperPrefix);
}
DFFIImpl::~DFFIImpl()
{ }
std::pair<size_t, bool> DFFIImpl::getFuncTypeWrapperId(FunctionType const* FTy)
{
size_t TyIdx = WrapperIdx_;
auto Ins = FuncTyWrappers_.try_emplace(FTy, TyIdx);
if (!Ins.second) {
return {Ins.first->second, true};
}
++WrapperIdx_;
return {TyIdx, false};
}
std::pair<size_t, bool> DFFIImpl::getFuncTypeWrapperId(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
size_t TyIdx = WrapperIdx_;
auto Ins = VarArgsFuncTyWrappers_.try_emplace(std::make_pair(FTy, VarArgs), TyIdx);
if (!Ins.second) {
return {Ins.first->second, true};
}
++WrapperIdx_;
return {TyIdx, false};
}
void DFFIImpl::genFuncTypeWrapper(TypePrinter& P, size_t WrapperIdx, llvm::raw_string_ostream& ss, FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
ss << "void " << getWrapperName(WrapperIdx) << "(";
auto RetTy = FTy->getReturnType();
P.print_def(ss, getPointerType(FTy), TypePrinter::Full, "__FPtr") << ",";
P.print_def(ss, getPointerType(RetTy), TypePrinter::Full, "__Ret") << ",";
ss << "void** __Args) {\n ";
if (RetTy) {
ss << "*__Ret = ";
}
ss << "(__FPtr)(";
size_t Idx = 0;
auto& Params = FTy->getParams();
for (QualType ATy: Params) {
ss << "*((";
P.print_def(ss, getPointerType(ATy), TypePrinter::Full) << ')' << "__Args[" << Idx << ']' << ')';
if (Idx < Params.size()-1) {
ss << ',';
}
++Idx;
}
if (VarArgs.size() > 0) {
assert(FTy->hasVarArgs() && "function type must be variadic if VarArgsCount > 0");
assert(Params.size() >= 1 && "variadic arguments must have at least one defined argument");
for (Type const* Ty: VarArgs) {
ss << ", *((";
P.print_def(ss, getPointerType(Ty), TypePrinter::Full) << ')' << "__Args[" << Idx << ']' << ')';
++Idx;
}
}
ss << ");\n}\n";
}
CUImpl* DFFIImpl::compile(StringRef const Code, StringRef CUName, bool IncludeDefs, std::string& Err, bool UseLastError)
{
std::string AnonCUName;
if (CUName.empty()) {
AnonCUName = "/__dffi_private/anon_cu_" + std::to_string(CUIdx_++) + (Opts_.hasCXX() ? ".cpp":".c");
CUName = AnonCUName;
}
#ifdef _WIN32
else {
// TODO: figure out why!
Err = "named compilation unit does not work on Windows!";
return nullptr;
}
#endif
std::unique_ptr<llvm::Module> M;
std::unique_ptr<CUImpl> CU(new CUImpl{*this});
if (IncludeDefs) {
M = compile_llvm_with_decls(Code, CUName, CU->FuncAliases_, Err);
}
else {
M = compile_llvm(Code, CUName, Err);
}
if (!M) {
return nullptr;
}
auto* pM = M.get();
// Pre-parse metadata in two passes to find and declare structures
// First pass will declare every structure as opaque ones. Next pass defines the ones which are.
DebugInfoFinder DIF;
DIF.processModule(*pM);
SmallVector<DICompositeType const*, 16> Composites;
SmallVector<DIDerivedType const*, 16> Typedefs;
for (DIType const* Ty: DIF.types()) {
if (Ty == nullptr) {
continue;
}
if (auto const* DTy = llvm::dyn_cast<DIDerivedType>(Ty)) {
if (DTy->getTag() == dwarf::DW_TAG_typedef) {
Typedefs.push_back(DTy);
}
}
else {
Ty = getCanonicalDIType(Ty);
if (auto const* CTy = llvm::dyn_cast<DICompositeType>(Ty)) {
auto Tag = Ty->getTag();
if (Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type || Tag == dwarf::DW_TAG_enumeration_type) {
Composites.push_back(CTy);
CU->declareDIComposite(CTy);
}
}
}
}
// Parse structures and unions
for (DICompositeType const* Ty: Composites) {
CU->parseDIComposite(Ty, *M);
}
CU->inlineCompositesAnonymousMembers();
for (auto const* DTy: Typedefs) {
// TODO: optimize this! We could add the visited typedefs in the alias list
// as long as we traverse it, and remove them from the list of typedefs to
// visit.
CU->setAlias(DTy->getName(), CU->getTypeFromDIType(DTy));
}
// Generate function types
std::string Buf;
llvm::raw_string_ostream Wrappers(Buf);
TypePrinter Printer;
SmallVector<Function*, 16> ToRemove;
const bool hasCXX = Opts_.hasCXX();
for (Function& F: *M) {
if (F.isIntrinsic())
continue;
if (hasCXX && !F.getSubprogram()->getLinkageName().empty())
continue;
StringRef FName = F.getName();
const bool ForceDecl = FName.startswith("__dffi_force_decl_");
const bool ForceTypedef = FName.startswith("__dffi_force_typedef");
if (!ForceDecl && !ForceTypedef && F.doesNotReturn())
continue;
if (ForceTypedef) {
ToRemove.push_back(&F);
continue;
}
auto* DFTy = CU->getFunctionType(F, UseLastError);
if (!DFTy)
continue;
if (ForceDecl) {
FName = FName.substr(strlen("__dffi_force_decl_"));
ToRemove.push_back(&F);
}
else {
if (FName.size() > 0 && FName[0] == 1) {
// Clang emits the "\01" prefix in some cases, when ASM function
// redirects are used!
F.setName(FName.substr(1));
FName = F.getName();
}
CU->parseFunctionAlias(F);
}
CU->FuncTys_[FName] = DFTy;
if (!Opts_.LazyJITWrappers) {
auto Id = getFuncTypeWrapperId(DFTy);
if (!Id.second) {
// TODO: if varag, do we always generate the wrapper for the version w/o varargs?
genFuncTypeWrapper(Printer, Id.first, Wrappers, DFTy, {});
}
}
}
for (Function* F: ToRemove) {
F->eraseFromParent();
}
// Strip debug info (we don't need them anymore)!
llvm::StripDebugInfo(*pM);
// Add the module to the EE
EE_->addModule(std::move(M));
EE_->generateCodeForModule(pM);
// Compile wrappers
compileWrappers(Printer, Wrappers.str());
// We don't need these anymore
CU->AnonTys_.clear();
auto* Ret = CU.get();
CUs_.emplace_back(std::move(CU));
return Ret;
}
void DFFIImpl::compileWrappers(TypePrinter& Printer, std::string const& Wrappers)
{
auto& CI = Clang_->getInvocation();
CI.getLangOpts()->CPlusPlus = false;
CI.getLangOpts()->C99 = true;
CI.getLangOpts()->C11 = true;
auto& CGO = CI.getCodeGenOpts();
std::string WCode = Printer.getDecls() + "\n" + Wrappers;
std::stringstream ss;
ss << "/__dffi_private/wrappers_" << CUIdx_++ << ".c";
CGO.setDebugInfo(codegenoptions::NoDebugInfo);
std::string Err;
auto M = compile_llvm(WCode, ss.str(), Err);
CGO.setDebugInfo(codegenoptions::FullDebugInfo);
if (!M) {
errs() << WCode;
errs() << Err;
llvm::report_fatal_error("unable to compile wrappers!");
}
auto* pM = M.get();
EE_->addModule(std::move(M));
EE_->generateCodeForModule(pM);
CI.getLangOpts()->CPlusPlus = Opts_.hasCXX();
CI.getLangOpts()->C99 = !Opts_.hasCXX();
CI.getLangOpts()->C11 = !Opts_.hasCXX();
}
void* DFFIImpl::getWrapperAddress(FunctionType const* FTy)
{
// TODO: merge with getWrapperAddress for varargs
auto Id = getFuncTypeWrapperId(FTy);
size_t WIdx = Id.first;
if (!Id.second) {
std::string Buf;
llvm::raw_string_ostream ss(Buf);
TypePrinter P;
genFuncTypeWrapper(P, WIdx, ss, FTy, None);
compileWrappers(P, ss.str());
}
std::string TName = getWrapperName(WIdx);
void* Ret = (void*)EE_->getFunctionAddress(TName.c_str());
assert(Ret && "function wrapper does not exist!");
return Ret;
}
Function* DFFIImpl::getWrapperLLVMFunc(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
// TODO: suboptimal. Lookup of the wrapper ID is done twice, and the full
// compilation of the wrapper is done, whereas it might not be necessary!
getWrapperAddress(FTy);
std::pair<size_t, bool> Id;
if (FTy->hasVarArgs()) {
Id = getFuncTypeWrapperId(FTy, VarArgs);
}
else {
assert(VarArgs.size() == 0 && "VarArgs specified when function type doesn't support variadic arguments");
Id = getFuncTypeWrapperId(FTy);
}
assert(Id.second && "wrapper should already exist!");
std::string TName = getWrapperName(Id.first);
return EE_->FindFunctionNamed(TName);
}
void* DFFIImpl::getWrapperAddress(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
auto Id = getFuncTypeWrapperId(FTy, VarArgs);
size_t WIdx = Id.first;
if (!Id.second) {
std::string Buf;
llvm::raw_string_ostream ss(Buf);
TypePrinter P;
genFuncTypeWrapper(P, WIdx, ss, FTy, VarArgs);
compileWrappers(P, ss.str());
}
std::string TName = getWrapperName(WIdx);
void* Ret = (void*)EE_->getFunctionAddress(TName.c_str());
assert(Ret && "function wrapper does not exist!");
return Ret;
}
void* DFFIImpl::getFunctionAddress(StringRef Name)
{
// TODO: chances that this is clearly sub optimal
// TODO: use getAddressToGlobalIfAvailable?
Function* F = EE_->FindFunctionNamed(Name);
const std::string NameStr = Name.str();
if (!F || F->isDeclaration()) {
return sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr);
}
return (void*)EE_->getFunctionAddress(NameStr);
#if 0
// TODO: we would like to be able to do this! Unfortunatly, MCJIT API is
// private...
auto Sym = EE_->findSymbol(Name.str(), true);
if (!Sym) {
return nullptr;
}
auto AddrOrErr = Sym.getAddress();
if (!AddrOrErr) {
return nullptr;
}
return (void*)(*AddrOrErr);
#endif
}
NativeFunc DFFIImpl::getFunction(FunctionType const* FTy, void* FPtr)
{
auto TFPtr = (NativeFunc::TrampPtrTy)getWrapperAddress(FTy);
assert(TFPtr && "function type trampoline doesn't exist!");
return {TFPtr, FPtr, FTy};
}
// TODO: QualType here!
NativeFunc DFFIImpl::getFunction(FunctionType const* FTy, ArrayRef<Type const*> VarArgs, void* FPtr)
{
if (!FTy->hasVarArgs()) {
return NativeFunc{};
}
auto TFPtr = (NativeFunc::TrampPtrTy)getWrapperAddress(FTy, VarArgs);
// Generates new function type for this list of variadic arguments
SmallVector<QualType, 8> Types;
auto const& Params = FTy->getParams();
Types.reserve(Params.size() + VarArgs.size());
for (auto const& P: Params) {
Types.emplace_back(P.getType());
}
for (auto T: VarArgs) {
Types.emplace_back(T);
}
FTy = getContext().getFunctionType(*this, FTy->getReturnType(), Types, FTy->getCC(), false, FTy->useLastError());
return {TFPtr, FPtr, FTy};
}
BasicType const* DFFIImpl::getBasicType(BasicType::BasicKind K)
{
return getContext().getBasicType(*this, K);
}
PointerType const* DFFIImpl::getPointerType(QualType Ty)
{
return getContext().getPtrType(*this, Ty);
}
ArrayType const* DFFIImpl::getArrayType(QualType Ty, uint64_t NElements)
{
return getContext().getArrayType(*this, Ty, NElements);
}
// Compilation unit
//
CUImpl::CUImpl(DFFIImpl& DFFI):
DFFI_(DFFI)
{ }
std::tuple<void*, FunctionType const*> CUImpl::getFunctionAddressAndTy(llvm::StringRef Name)
{
auto ItAlias = FuncAliases_.find(Name);
if (ItAlias != FuncAliases_.end()) {
Name = ItAlias->second;
}
auto ItFTy = FuncTys_.find(Name);
if (ItFTy == FuncTys_.end()) {
return std::tuple<void*, FunctionType const*>{nullptr,nullptr};
}
return std::tuple<void*, FunctionType const*>{DFFI_.getFunctionAddress(Name), ItFTy->second};
}
NativeFunc CUImpl::getFunction(llvm::StringRef Name)
{
void* FPtr;
FunctionType const* FTy;
std::tie(FPtr, FTy) = getFunctionAddressAndTy(Name);
return getFunction(FPtr, FTy);
}
NativeFunc CUImpl::getFunction(llvm::StringRef Name, llvm::ArrayRef<Type const*> VarArgs)
{
void* FPtr;
FunctionType const* FTy;
std::tie(FPtr, FTy) = getFunctionAddressAndTy(Name);
return getFunction(FPtr, FTy, VarArgs);
}
NativeFunc CUImpl::getFunction(void* FPtr, FunctionType const* FTy, llvm::ArrayRef<Type const*> VarArgs)
{
if (!FPtr || !FTy) {
return {};
}
return DFFI_.getFunction(FTy, VarArgs, FPtr);
}
NativeFunc CUImpl::getFunction(void* FPtr, FunctionType const* FTy)
{
if (!FPtr || !FTy) {
return {};
}
return DFFI_.getFunction(FTy, FPtr);
}
template <class T>
static T const* getCompositeType(CompositeTysMap const& Tys, StringRef Name)
{
auto It = Tys.find(Name);
if (It == Tys.end()) {
return nullptr;
}
return dffi::dyn_cast<T>(It->second.get());
}
StructType const* CUImpl::getStructType(StringRef Name) const
{
return getCompositeType<StructType>(CompositeTys_, Name);
}
UnionType const* CUImpl::getUnionType(StringRef Name) const
{
return getCompositeType<UnionType>(CompositeTys_, Name);
}
EnumType const* CUImpl::getEnumType(StringRef Name) const
{
return getCompositeType<EnumType>(CompositeTys_, Name);
}
std::vector<std::string> CUImpl::getTypes() const
{
std::vector<std::string> Ret;
Ret.reserve(CompositeTys_.size() + AliasTys_.size());
for (auto const& C: CompositeTys_) {
Ret.emplace_back(C.getKey().str());
}
for (auto const& C: AliasTys_) {
Ret.emplace_back(C.getKey().str());
}
return Ret;
}
std::vector<std::string> CUImpl::getFunctions() const
{
std::vector<std::string> Ret;
Ret.reserve(FuncTys_.size() + FuncAliases_.size());
for (auto const& C: FuncTys_) {
Ret.emplace_back(C.getKey().str());
}
for (auto const& C: FuncAliases_) {
Ret.emplace_back(C.getKey().str());
}
return Ret;
}
void CUImpl::declareDIComposite(DICompositeType const* DCTy)
{
const auto Tag = DCTy->getTag();
assert((Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type ||
Tag == dwarf::DW_TAG_enumeration_type) && "declareDIComposite called without a valid type!");
StringRef Name = DCTy->getName();
auto AddTy = [&](StringRef Name_) {
CanOpaqueType* Ptr;
switch (Tag) {
case dwarf::DW_TAG_structure_type:
Ptr = new StructType{DFFI_};
break;
case dwarf::DW_TAG_union_type:
Ptr = new UnionType{DFFI_};
break;
case dwarf::DW_TAG_enumeration_type:
Ptr = new EnumType{DFFI_};
break;
};
return CompositeTys_.try_emplace(Name_, std::unique_ptr<CanOpaqueType>{Ptr});
};
if (Name.size() > 0) {
// Sets the struct as an opaque one.
if (Name.startswith("__dffi")) {
llvm::report_fatal_error("__dffi is a compiler reserved prefix and can't be used in a structure name!");
}
auto It = AddTy(Name);
It.first->getValue()->addName(It.first->getKeyData());
}
else {
// Add to the map of anonymous types, and generate a name
if (AnonTys_.count(DCTy) == 1) {
return;
}
auto ID = AnonTys_.size() + 1;
std::stringstream ss;
ss << "__dffi_anon_struct_" << ID;
auto It = AddTy(ss.str());
assert(It.second && "anonymous structure ID already existed!!");
AnonTys_[DCTy] = It.first->second.get();
}
}
void CUImpl::parseDIComposite(DICompositeType const* DCTy, llvm::Module& M)
{
// C++ type, we don't support this!
if (!DCTy->getIdentifier().empty()) {
return;
}
const auto Tag = DCTy->getTag();
assert((Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type ||
Tag == dwarf::DW_TAG_enumeration_type) && "parseDIComposite called without a valid type!");
StringRef Name = DCTy->getName();
dffi::CanOpaqueType* CATy;
if (Name.size() > 0) {
auto It = CompositeTys_.find(Name);
assert(It != CompositeTys_.end() && "structure/union/enum hasn't been previously declared!");
CATy = It->second.get();
}
else {
auto It = AnonTys_.find(DCTy);
assert(It != AnonTys_.end() && "anonymous structure/union/enum hasn't been previously declared!");
CATy = dffi::cast<dffi::CanOpaqueType>(It->second);
}
// If the structure/union isn't know yet, this sets the composite type as an
// opaque one. This can be useful if the type is self-referencing
// itself throught a pointer (classical case in linked list for instance).
if (DCTy->isForwardDecl()) {
// Nothing new here!
return;
}
if (!CATy->isOpaque()) {
return;
}
if (auto* CTy = dffi::dyn_cast<CompositeType>(CATy)) {
// Parse the structure/union and create the associated StructType/UnionType
std::vector<CompositeField> Fields;
unsigned Align = 1;
size_t AnonIdx = 0;
for (auto const* Op: DCTy->getElements()) {
auto const* DOp = llvm::cast<DIDerivedType>(Op);
assert(DOp->getTag() == llvm::dwarf::DW_TAG_member && "element of a struct/union must be a DW_TAG_member!");
std::string FName;
{
StringRef S = DOp->getName();
if (!S.empty()) {
FName = S.str();
}
else {
FName = std::string{"__dffi_anon_"} + std::to_string(AnonIdx++);
}
}
unsigned FOffset = DOp->getOffsetInBits()/8;
#ifndef NDEBUG
if (DCTy->getTag() == dwarf::DW_TAG_union_type) {
assert(FOffset == 0 && "union field member must have an offset of 0!");
}
#endif
DIType const* FDITy = getCanonicalDIType(DOp->getBaseType());
dffi::Type const* FTy = getTypeFromDIType(FDITy);
Fields.emplace_back(CompositeField{FName.c_str(), FTy, FOffset});
Align = std::max(Align, FTy->getAlign());
}
auto Size = DCTy->getSizeInBits()/8;
CTy->setBody(std::move(Fields), Size, Align);
}
else {
auto* ETy = dffi::cast<EnumType>(CATy);
EnumType::Fields Fields;
for (auto const* Op: DCTy->getElements()) {
auto const* EOp = llvm::cast<DIEnumerator>(Op);
const APInt Val = EOp->getValue();
assert(Val.isSignedIntN(sizeof(int)*8) && "enum whose value isn't an int");
Fields[EOp->getName().str()] = Val.getSExtValue();
}
ETy->setBody(std::move(Fields));
}
}
dffi::QualType CUImpl::getQualTypeFromDIType(llvm::DIType const* Ty)
{
// Go throught every typedef and returns the qualified type
if (auto* DTy = llvm::dyn_cast_or_null<DIDerivedType>(Ty)) {
switch (DTy->getTag()) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_volatile_type:
case dwarf::DW_TAG_restrict_type:
return getQualTypeFromDIType(DTy->getBaseType());
case dwarf::DW_TAG_const_type:
return getQualTypeFromDIType(DTy->getBaseType()).withConst();
default:
break;
};
}
return getTypeFromDIType(Ty);
}
dffi::Type const* CUImpl::getTypeFromDIType(llvm::DIType const* Ty)
{
Ty = getCanonicalDIType(Ty);
if (!Ty) {
return nullptr;
}
if (auto* BTy = llvm::dyn_cast<llvm::DIBasicType>(Ty)) {
#define HANDLE_BASICTY(TySize, KTy)\
if (Size == TySize)\
return DFFI_.getBasicType(BasicType::getKind<KTy>());
const auto Size = BTy->getSizeInBits();
switch (BTy->getEncoding()) {
case llvm::dwarf::DW_ATE_boolean:
return DFFI_.getBasicType(BasicType::Bool);
case llvm::dwarf::DW_ATE_unsigned:
case llvm::dwarf::DW_ATE_unsigned_char:
{
if (BTy->getName() == "char") {
return DFFI_.getBasicType(BasicType::Char);
}
HANDLE_BASICTY(8, uint8_t);
HANDLE_BASICTY(16, uint16_t);
HANDLE_BASICTY(32, uint32_t);
HANDLE_BASICTY(64, uint64_t);
#ifdef DFFI_SUPPORT_I128
HANDLE_BASICTY(128, __uint128_t);
#endif
break;
}
case llvm::dwarf::DW_ATE_signed:
case llvm::dwarf::DW_ATE_signed_char:
{
if (BTy->getName() == "char") {
return DFFI_.getBasicType(BasicType::Char);
}
HANDLE_BASICTY(8, int8_t);
HANDLE_BASICTY(16, int16_t);
HANDLE_BASICTY(32, int32_t);
HANDLE_BASICTY(64, int64_t);
#ifdef DFFI_SUPPORT_I128
HANDLE_BASICTY(128, __int128_t);
#endif
break;
}
case llvm::dwarf::DW_ATE_float:
HANDLE_BASICTY(sizeof(float)*8, c_float);
HANDLE_BASICTY(sizeof(double)*8, c_double);
HANDLE_BASICTY(sizeof(long double)*8, c_long_double);
break;
#ifdef DFFI_SUPPORT_COMPLEX
case llvm::dwarf::DW_ATE_complex_float:
HANDLE_BASICTY(sizeof(_Complex float)*8, c_complex_float);
HANDLE_BASICTY(sizeof(_Complex double)*8, c_complex_double);
HANDLE_BASICTY(sizeof(_Complex long double)*8, c_complex_long_double);
break;
#endif
default:
return nullptr;
};
}
if (auto* PtrTy = llvm::dyn_cast<llvm::DIDerivedType>(Ty)) {
// C++ type, not supported
const auto Tag = PtrTy->getTag();
if (Tag == llvm::dwarf::DW_TAG_pointer_type) {
auto Pointee = getQualTypeFromDIType(PtrTy->getBaseType());
return getPointerType(Pointee);
}
if (Tag == llvm::dwarf::DW_TAG_reference_type) {
// C++ type, not supported
return nullptr;
}
#ifdef LLVM_BUILD_DEBUG
Ty->dump();
#endif
llvm::report_fatal_error("unsupported type");
}
if (auto* DTy = llvm::dyn_cast<DICompositeType>(Ty)) {
// C++ type, not supported
if (!DTy->getIdentifier().empty()) {
return nullptr;
}
const auto Tag = DTy->getTag();
switch (Tag) {
case llvm::dwarf::DW_TAG_structure_type:
case llvm::dwarf::DW_TAG_union_type:
case llvm::dwarf::DW_TAG_enumeration_type:
{
StringRef Name = DTy->getName();
if (Name.size() == 0) {
auto It = AnonTys_.find(DTy);
if (It == AnonTys_.end()) {
llvm::report_fatal_error("unknown literal struct/union/enum!");
}
return It->second;
}
auto It = CompositeTys_.find(Name);
if (It == CompositeTys_.end()) {
llvm::report_fatal_error("unknown struct/union/enum!");
}
return It->second.get();
}
case llvm::dwarf::DW_TAG_array_type:
{
auto EltTy = getQualTypeFromDIType(DTy->getBaseType());
auto Count = llvm::cast<DISubrange>(*DTy->getElements().begin())->getCount();
if (auto* CCount = Count.dyn_cast<ConstantInt*>()) {
return DFFI_.getArrayType(EltTy, CCount->getZExtValue());
}
else {
return getPointerType(EltTy);
}
}
};
}
if (auto* FTy = llvm::dyn_cast<DISubroutineType>(Ty)) {
return getFunctionType(FTy, false /* UseLastError */);
}
#ifdef LLVM_BUILD_DEBUG
Ty->dump();
#endif
llvm::report_fatal_error("unsupported type");
}
dffi::FunctionType const* CUImpl::getFunctionType(DISubroutineType const* Ty, bool UseLastError)
{
auto ArrayTys = Ty->getTypeArray();
auto ItTy = ArrayTys.begin();
auto RetTy = getQualTypeFromDIType((*(ItTy++)));
llvm::SmallVector<QualType, 8> ParamsTy;
ParamsTy.reserve(ArrayTys.size()-1);
for (auto ItEnd = ArrayTys.end(); ItTy != ItEnd; ++ItTy) {
auto ATy = getQualTypeFromDIType((*ItTy));
ParamsTy.push_back(ATy);
}
bool IsVarArgs = false;
if (ParamsTy.size() > 1 && ParamsTy.back().getType() == nullptr) {
IsVarArgs = true;
ParamsTy.pop_back();
}
auto CC = dwarfCCToDFFI(Ty->getCC());
return getContext().getFunctionType(DFFI_, RetTy, ParamsTy, CC, IsVarArgs, UseLastError);
}
void CUImpl::parseFunctionAlias(Function& F)
{
MDNode* MD = F.getMetadata("dbg");
if (!MD) {
return;
}
// See tests/asm_redirect.cpp. The name of the DISubprogram object can be
// different from the LLVM function name! Let's register the debug info name
// as an alias to the llvm one.
auto* SP = llvm::cast<DISubprogram>(MD);
auto AliasName = SP->getName();
if (AliasName != F.getName()) {
assert(FuncTys_.count(AliasName) == 0 && "function alias already defined!");
assert(FuncAliases_.count(AliasName) == 0 && "function alias already in alias list!");
FuncAliases_[AliasName] = F.getName().str();
}
}
dffi::FunctionType const* CUImpl::getFunctionType(Function& F, bool UseLastError)
{
MDNode* MD = F.getMetadata("dbg");
if (!MD) {
return nullptr;
}
auto* SP = llvm::cast<DISubprogram>(MD);
auto* Ty = llvm::cast<DISubroutineType>(SP->getType());
return getFunctionType(Ty, UseLastError);
}
dffi::Type const* CUImpl::getType(StringRef Name) const
{
{
auto It = AliasTys_.find(Name);
if (It != AliasTys_.end())
return It->second;
}
{
auto It = CompositeTys_.find(Name);
if (It != CompositeTys_.end())
return It->second.get();
}
return nullptr;
}
} // details
} // dffi
| 30.909628 | 156 | 0.672268 | kamino |
55ef13ffe7397e3cd0f9122590867242ec7e6615 | 1,165 | cpp | C++ | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | #include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <utility>
#include <queue>
using namespace std;
int MAX = 100000;
struct UFDS {
vector<int> p;
int numSets;
UFDS(int n) : p(n, 0), numSets(n) {
for (int i = 0; i < n; ++i) p[i] = i;
}
int find(int x) {
return (p[x] == x) ? x : p[x] = find(p[x]);
}
void merge(int x, int y) {
int i = find(x), j = find(y);
if (i == j) return;
p[i] = j;
--numSets;
}
};
bool resolverCaso() {
int a, b;
cin >> a;
if (!cin) return false;
int c = 0;
UFDS uf(MAX);
while (a != -1) {
cin >> b;
if (uf.find(a) != uf.find(b))
uf.merge(a, b);
else c++;
cin >> a;
}
cout << c << '\n';
cin.ignore();
return true;
}
int main() {
#ifndef DOMJUDGE
std::ifstream in("datos.txt");
std::ofstream out("salida.txt");
auto cinbuf = std::cin.rdbuf(in.rdbuf());
auto coutbuf = std::cout.rdbuf(out.rdbuf());
#endif
while (resolverCaso());
#ifndef DOMJUDGE
std::cin.rdbuf(cinbuf);
std::cout.rdbuf(coutbuf);
system("PAUSE");
#endif
return 0;
} | 17.651515 | 46 | 0.549356 | enricava |
55f2d742a669d0004515682a655c2057b9b5ff95 | 181 | cpp | C++ | sample_class.cpp | yoggy/google_test_study | 297912dfeb24906d52c70cc88f1e78b6d02f12b5 | [
"MIT"
] | null | null | null | sample_class.cpp | yoggy/google_test_study | 297912dfeb24906d52c70cc88f1e78b6d02f12b5 | [
"MIT"
] | null | null | null | sample_class.cpp | yoggy/google_test_study | 297912dfeb24906d52c70cc88f1e78b6d02f12b5 | [
"MIT"
] | null | null | null | #include "sample_class.h"
SampleClass::SampleClass() : value_(0)
{
}
void SampleClass::add(const int &val)
{
value_ += val;
}
int SampleClass::value() const
{
return value_;
}
| 11.3125 | 38 | 0.679558 | yoggy |
55f7ed82ee5480f392388da618c41db1f63054d7 | 460 | hpp | C++ | src/HttpRoleList.hpp | dantin/srt-server | d355f78b0f8e44e0fdfd164d515e2df978d30dcd | [
"BSD-3-Clause"
] | null | null | null | src/HttpRoleList.hpp | dantin/srt-server | d355f78b0f8e44e0fdfd164d515e2df978d30dcd | [
"BSD-3-Clause"
] | null | null | null | src/HttpRoleList.hpp | dantin/srt-server | d355f78b0f8e44e0fdfd164d515e2df978d30dcd | [
"BSD-3-Clause"
] | null | null | null | #ifndef _HttpRoleList_INCLUDE_
#define _HttpRoleList_INCLUDE_
#include <list>
#include "HttpClient.hpp"
#include "SLSLock.hpp"
/**
* CHttpRoleList
*/
class CHttpRoleList
{
public :
CHttpRoleList();
~CHttpRoleList();
int push(CHttpClient *role);
CHttpClient *pop();
void erase();
int size();
protected:
private:
std::list<CHttpClient * > m_list_role;
CSLSMutex m_mutex;
};
#endif
| 14.375 | 42 | 0.619565 | dantin |
55f8c49ba682152823f34a8e664ed909846c13d9 | 298 | hpp | C++ | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | null | null | null | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | 1 | 2017-04-21T16:18:44.000Z | 2017-04-21T16:18:44.000Z | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | null | null | null | #ifndef LILYPAD_HPP
#define LILYPAD_HPP
#include "lilypad/info.hpp"
#include "lilypad/global.hpp"
#include "lilypad/communicator.hpp"
#include "lilypad/multivector.hpp"
#include "lilypad/localmatrix.hpp"
#include "lilypad/mkl_wrapper.hpp"
#include "lilypad/cholesky_qr.hpp"
#endif // LILYPAD_HPP
| 22.923077 | 35 | 0.788591 | yt-siden |
55f92026527a5d536ca73a29c5aaee8d5095dda9 | 4,723 | cpp | C++ | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/university | 5561969b1b11678228aaf7e6660e8b1a93d10294 | [
"WTFPL"
] | 1 | 2018-06-03T17:48:50.000Z | 2018-06-03T17:48:50.000Z | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | null | null | null | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | 14 | 2019-04-07T21:27:09.000Z | 2021-12-05T13:37:25.000Z | #include <fstream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_set>
using namespace std;
struct vertex {
int index;
bool accept, reach, reachable;
int transitions[26];
vector<int> back[26];
vertex() {
for (int i = 0; i < 26; ++i)
transitions[i] = -1;
}
};
vector<pair<int, int>>* tr;
vector<int>* b;
vertex* dka;
int main() {
ifstream fin("fastminimization.in");
int n, m, k, from, to;
char c;
fin >> n >> m >> k;
dka = new vertex[n];
tr = new vector<pair<int, int>>[n];
b = new vector<int>[n];
queue<int> reach;
for (int i = 0; i < k; ++i) {
fin >> from;
dka[from - 1].accept = true;
reach.push(from - 1);
}
for (int i = 0; i < m; ++i) {
fin >> from >> to >> c;
tr[from - 1].push_back({c - 97, to - 1});
b[to - 1].push_back(from - 1);
}
while (!reach.empty()) {
int pop = reach.front();
reach.pop();
if (!dka[pop].reach) {
dka[pop].reach = true;
for (int i : b[pop])
reach.push(i);
}
}
reach.push(0);
while (!reach.empty()) {
int pop = reach.front();
reach.pop();
if (dka[pop].reach && !dka[pop].reachable) {
dka[pop].reachable = true;
for (pair<int, int> i : tr[pop])
reach.push(i.second);
}
}
unordered_set<int> terms, other;
for (int i = 0; i < n; ++i)
if (dka[i].reachable) {
(dka[i].accept ? terms.insert(i) : other.insert(i));
dka[i].index = !dka[i].accept;
for (pair<int, int> j : tr[i])
if (dka[j.second].reachable) {
dka[i].transitions[j.first] = j.second;
dka[j.second].back[j.first].push_back(i);
}
}
vector<unordered_set<int>> new_dka({terms});
if (!other.empty())
new_dka.push_back(other);
queue<pair<int, int>> q;
for (int i = 0; i < 26; ++i) {
q.push({0, i});
if (!other.empty())
q.push({1, i});
}
while (!q.empty()) {
pair<int, int> pop = q.front();
q.pop();
map<int, vector<int>> involved;
for (int i : new_dka[pop.first])
for (int r : dka[i].back[pop.second])
involved[dka[r].index].push_back(r);
for (pair<int, vector<int>> i : involved)
if (i.second.size() < new_dka[i.first].size()) {
new_dka.push_back(unordered_set<int>());
int j = new_dka.size() - 1;
for (int r : i.second) {
new_dka[i.first].erase(r);
new_dka[j].insert(r);
dka[r].index = j;
}
for (int k = 0; k < 26; ++k)
q.push({j, k});
}
}
vector<int> new_terms;
map<pair<int, int>, int> new_trans;
for (int j : new_dka[0])
dka[j].index = dka[0].index;
for (int j : new_dka[dka[0].index])
dka[j].index = 0;
for (int i = 0; i < new_dka.size(); ++i)
for (int j : new_dka[i]) {
if (dka[j].accept)
new_terms.push_back(i);
for (int k = 0; k < 26; ++k)
if (dka[j].transitions[k] != -1)
new_trans[{dka[j].index, k}] = dka[dka[j].transitions[k]].index;
break;
}
ofstream fout("fastminimization.out");
fout << new_dka.size() << ' ' << new_trans.size() << ' ' << new_terms.size() << '\n';
for (int i : new_terms)
fout << i + 1 << ' ';
for (pair<pair<int, int>, int> i : new_trans)
fout << '\n' << i.first.first + 1 << ' ' << i.second + 1 << ' ' << char(i.first.second + 97);
}
| 38.398374 | 109 | 0.367986 | nothingelsematters |
55ffab4f797918d281220e300a7cf53711bc6a75 | 1,433 | cpp | C++ | polish-spoj/AL_31_01/solution.cpp | kpagacz/spoj | 8bff809c6c5227a6e85e9b12f808dd921f24e587 | [
"MIT"
] | 1 | 2021-12-06T16:01:55.000Z | 2021-12-06T16:01:55.000Z | polish-spoj/AL_31_01/solution.cpp | kpagacz/comp-programming | 15482d762ede4d3b7f8ff45a193f6e6bcd85672a | [
"MIT"
] | null | null | null | polish-spoj/AL_31_01/solution.cpp | kpagacz/comp-programming | 15482d762ede4d3b7f8ff45a193f6e6bcd85672a | [
"MIT"
] | null | null | null | // link to the problem https://pl.spoj.com/problems/AL_31_01/
#include<string>
#include<unordered_map>
#include<vector>
#include<iostream>
struct Match {
std::string team1, team2, result;
Match(std::string team1_, std::string team2_, std::string result_) : team1(team1_), team2(team2_), result(result_) {}
Match() = default;
};
void test_case() {
size_t n_matches;
std::cin >> n_matches;
std::vector<Match> matches;
std::unordered_map<std::string, int> goals;
std::string team1, team2, dummy, result;
for (size_t i = 0; i < n_matches; ++i) {
std::cin >> team1 >> dummy >> team2 >> result;
matches.push_back(Match(team1, team2, result));
goals.insert({ {team1, 0}, {team2, 0} });
}
int n_goals;
std::cin >> n_goals;
while (n_goals) {
std::cin >> team1;
++goals[team1];
--n_goals;
}
int good_bets = 0;
for (Match match : matches) {
for (char c : match.result) {
if (c == '0' && goals[match.team1] == goals[match.team2]) {
++good_bets;
break;
}
else if (c == '1' && goals[match.team1] > goals[match.team2]) {
++good_bets;
break;
}
else if (c == '2' && goals[match.team1] < goals[match.team2]){
++good_bets;
break;
}
}
}
if (good_bets == n_matches) {
std::cout << "TAK";
}
else {
std::cout << "NIE " << good_bets << "/" << n_matches;
}
std::cout << "\n";
}
int main() {
int test;
std::cin >> test;
while (test) {
test_case();
--test;
}
} | 21.073529 | 118 | 0.60014 | kpagacz |
3601aab5419b377ba0309c7636afd817d126d9ff | 3,044 | cpp | C++ | code/steps/source/model/pvu_models/pv_converter_model/pv_converter_model.cpp | cuihantao/steps | 60327bf42299cb7117ed5907a931583d7cdf590d | [
"MIT"
] | 1 | 2021-01-21T13:10:40.000Z | 2021-01-21T13:10:40.000Z | code/steps/source/model/pvu_models/pv_converter_model/pv_converter_model.cpp | cuihantao/steps | 60327bf42299cb7117ed5907a931583d7cdf590d | [
"MIT"
] | null | null | null | code/steps/source/model/pvu_models/pv_converter_model/pv_converter_model.cpp | cuihantao/steps | 60327bf42299cb7117ed5907a931583d7cdf590d | [
"MIT"
] | 1 | 2020-10-01T03:48:38.000Z | 2020-10-01T03:48:38.000Z | #include "header/model/pvu_models/pv_converter_model/pv_converter_model.h"
#include "header/basic/utility.h"
#include "header/basic/constants.h"
#include "header/steps_namespace.h"
#include <cstdio>
#include <istream>
#include <iostream>
using namespace std;
PV_CONVERTER_MODEL::PV_CONVERTER_MODEL(STEPS& toolkit) : PVU_MODEL(toolkit)
{
set_allowed_device_type_CAN_ONLY_BE_CALLED_BY_SPECIFIC_MODEL_CONSTRUCTOR("PV UNIT");
set_current_source_flag(true);
set_initial_active_current_command_in_pu_based_on_mbase(0.0);
set_initial_reactive_current_command_in_pu_based_on_mbase(0.0);
}
PV_CONVERTER_MODEL::~PV_CONVERTER_MODEL()
{
;
}
string PV_CONVERTER_MODEL::get_model_type() const
{
return "PV CONVERTER";
}
void PV_CONVERTER_MODEL::set_current_source_flag(bool flag)
{
current_source_flag = flag;
}
bool PV_CONVERTER_MODEL::get_current_source_flag() const
{
return current_source_flag;
}
bool PV_CONVERTER_MODEL::is_current_source() const
{
return current_source_flag;
}
bool PV_CONVERTER_MODEL::is_voltage_source() const
{
return not is_current_source();
}
void PV_CONVERTER_MODEL::set_initial_active_current_command_in_pu_based_on_mbase(double ip_command)
{
IP_command0 = ip_command;
}
double PV_CONVERTER_MODEL::get_initial_active_current_command_in_pu_based_on_mbase() const
{
return IP_command0;
}
void PV_CONVERTER_MODEL::set_initial_reactive_current_command_in_pu_based_on_mbase(double iq_command)
{
IQ_command0 = iq_command;
}
double PV_CONVERTER_MODEL::get_initial_reactive_current_command_in_pu_based_on_mbase() const
{
return IQ_command0;
}
void PV_CONVERTER_MODEL::set_initial_reactive_voltage_command_in_pu(double eq_command)
{
EQ_command0 = eq_command;
}
double PV_CONVERTER_MODEL::get_initial_reactive_voltage_command_in_pu() const
{
return EQ_command0;
}
double PV_CONVERTER_MODEL::get_active_current_command_in_pu_based_on_mbase()
{
PV_UNIT* pv_unit = get_pv_unit_pointer();
PV_ELECTRICAL_MODEL* model = pv_unit->get_pv_electrical_model();
if(model!=NULL and model->is_model_initialized())
return model->get_active_current_command_in_pu_based_on_mbase();
else
return get_initial_active_current_command_in_pu_based_on_mbase();
}
double PV_CONVERTER_MODEL::get_reactive_current_command_in_pu_based_on_mbase()
{
PV_UNIT* pv_unit = get_pv_unit_pointer();
PV_ELECTRICAL_MODEL* model = pv_unit->get_pv_electrical_model();
if(model!=NULL and model->is_model_initialized())
return model->get_reactive_current_command_in_pu_based_on_mbase();
else
return get_initial_reactive_current_command_in_pu_based_on_mbase();
}
double PV_CONVERTER_MODEL::get_reactive_voltage_command_in_pu() const
{
PV_UNIT* pv_unit = get_pv_unit_pointer();
PV_ELECTRICAL_MODEL* model = pv_unit->get_pv_electrical_model();
if(model!=NULL and model->is_model_initialized())
return model->get_reactive_voltage_command_in_pu();
else
return get_initial_reactive_voltage_command_in_pu();
}
| 27.672727 | 101 | 0.799277 | cuihantao |
36022e8cf7a40d4c93a98ebf926ed6c0c64a1a45 | 3,435 | cpp | C++ | liboh/plugins/monoscript/MonoArray.cpp | danielrh/sirikata | 063740f96f24f6f60b047453f7254297d1a33f29 | [
"BSD-3-Clause"
] | 3 | 2015-12-23T14:26:05.000Z | 2016-05-09T04:05:51.000Z | liboh/plugins/monoscript/MonoArray.cpp | danielrh/sirikata | 063740f96f24f6f60b047453f7254297d1a33f29 | [
"BSD-3-Clause"
] | null | null | null | liboh/plugins/monoscript/MonoArray.cpp | danielrh/sirikata | 063740f96f24f6f60b047453f7254297d1a33f29 | [
"BSD-3-Clause"
] | null | null | null | /* Sirikata - Mono Embedding
* MonoArray.cpp
*
* Copyright (c) 2009, Stanford University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Sirikata nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <oh/Platform.hpp>
#include "MonoArray.hpp"
#include "MonoDomain.hpp"
#include "MonoClass.hpp"
#include "MonoAssembly.hpp"
#include "MonoException.hpp"
namespace Mono {
//#####################################################################
// Function Array
//#####################################################################
Array::Array(MonoObject* obj)
: Object(obj)
{
assert( instanceOf( Domain::root().getAssembly("mscorlib").getClass("System", "Array") ) );
}
//#####################################################################
// Function Array
//#####################################################################
Array::Array(Object obj)
: Object(obj)
{
assert( instanceOf( Domain::root().getAssembly("mscorlib").getClass("System", "Array") ) );
}
//#####################################################################
// Function ~Array
//#####################################################################
Array::~Array() {
}
//#####################################################################
// Function operator[]
//#####################################################################
Object Array::operator[](const Sirikata::int32 idx) const {
return send("GetValue", Domain::root().Int32(idx));
}
//#####################################################################
// Function set
//#####################################################################
void Array::set(const Sirikata::int32 idx, const Object& obj) {
send("SetValue", obj, Domain::root().Int32(idx));
}
//#####################################################################
// Function length
//#####################################################################
int Array::length() const {
return getProperty("Length").unboxInt32();
}
} // namespace Mono
| 39.482759 | 95 | 0.546725 | danielrh |
3602aeb157c769208642c454418c8692085b651e | 439 | hpp | C++ | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | 2 | 2020-05-05T13:31:55.000Z | 2022-01-16T15:38:00.000Z | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | null | null | null | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | 1 | 2021-11-27T02:32:24.000Z | 2021-11-27T02:32:24.000Z | #ifndef MAGEMA_HPP
#define MAGEMA_HPP
#include "Animation.hpp"
#include "Sprite.hpp"
#include "ColliSystem.hpp"
#include "WorldModel.hpp"
class Magema : public ColliableSprite{
public:
static Magema* Create();
void Init() override;
void Collied(Object* oth, BasicProp* prop, const Manifold* m) override;
~Magema();
private:
Magema();
void update() override;
void draw() override;
Animation ani;
};
#endif
| 19.954545 | 75 | 0.694761 | VisualGMQ |
3604de1cd1b5720a81401a9316a4387b0af2c56f | 333 | cpp | C++ | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | 9 | 2017-10-08T16:22:03.000Z | 2021-08-20T09:32:17.000Z | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | null | null | null | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | 2 | 2018-01-15T16:35:44.000Z | 2019-03-21T18:30:04.000Z | class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
vector<bool>ans;
int now = 0;
for(int i = 0; i < A.size(); ++i) {
now = (now * 2 + A[i]) % 5;
if(now % 5 == 0) ans.push_back(true);
else ans.push_back(false);
}
return ans;
}
};
| 23.785714 | 49 | 0.453453 | w181496 |
360831d1f77f6b94ffda27eda355bd34ba9f2c54 | 2,949 | cpp | C++ | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 2 | 2018-10-31T08:09:03.000Z | 2021-01-18T19:23:54.000Z | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 1 | 2020-02-02T11:58:22.000Z | 2020-02-02T11:58:22.000Z | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 1 | 2019-04-13T09:54:49.000Z | 2019-04-13T09:54:49.000Z | /*
* check.cpp
*
* Created on: 26/03/2016
*
* Checks if the architecture is supported.
*
* =========================================================================
* Copyright (C) 2015-, Daniele De Sensi (d.desensi.software@gmail.com)
*
* This file is part of nornir.
*
* nornir is free software: you can redistribute it and/or
* modify it under the terms of the Lesser GNU General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
* nornir 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
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public
* License along with nornir.
* If not, see <http://www.gnu.org/licenses/>.
*
* =========================================================================
*/
#include <iostream>
#include <mammut/mammut.hpp>
using namespace std;
using namespace mammut;
using namespace mammut::topology;
using namespace mammut::energy;
#ifndef __linux__
#error "For the moment, Nornir only supports linux machines."
#endif
int main(int argc, char** argv){
Mammut m;
Topology* t = m.getInstanceTopology();
vector<VirtualCore*> virtualCores = t->getVirtualCores();
for(size_t i = 0; i < virtualCores.size(); i++){
if(!virtualCores.at(i)->hasFlag("constant_tsc")){
cerr << "=======================ATTENTION=======================\n"
"| Processor must have the constant_tsc flag. This is |\n"
"| needed since nornir gets timestamps considering |\n "
"| cores clock ticks. This constraint is not imposed |\n"
"| by the algorithm but it is needed since for the |\n"
"| moment no other timestamping mechanisms are |\n"
"| supported. |\n"
"=======================================================\n";
return -1;
}
}
Energy* energy = m.getInstanceEnergy();
Counter* counter = energy->getCounter();
if(!counter){
cerr << "========================WARNING========================\n"
"| Power counters not available on this machine (or if |\n"
"| available, they are still not supported by Nornir). |\n"
"| Accordingly, no guarantees on power consumption can |\n"
"| be provided. |\n"
"| If you are on an Intel machine, you can try to load |\n"
"| the 'msr' module and run the command again. |\n"
"=======================================================\n";
}
}
| 39.851351 | 80 | 0.515768 | DanieleDeSensi |
360a05a649e2644fc36fa323b48ea109c29ddb3f | 4,425 | hpp | C++ | src/cpu-sparse-matrix.hpp | inducer/iterative-cuda | e6413cff0466457957d99402f624cae0be06c3cc | [
"MIT"
] | null | null | null | src/cpu-sparse-matrix.hpp | inducer/iterative-cuda | e6413cff0466457957d99402f624cae0be06c3cc | [
"MIT"
] | null | null | null | src/cpu-sparse-matrix.hpp | inducer/iterative-cuda | e6413cff0466457957d99402f624cae0be06c3cc | [
"MIT"
] | 1 | 2020-11-23T09:55:57.000Z | 2020-11-23T09:55:57.000Z | /*
Iterative CUDA is licensed to you under the MIT/X Consortium license:
Copyright (c) 2009 Andreas Kloeckner.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the Software), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef AAFADFJ_ITERATIVE_CUDA_CPU_SPARSE_MATRIX_HPP_SEEN
#define AAFADFJ_ITERATIVE_CUDA_CPU_SPARSE_MATRIX_HPP_SEEN
#include <iterative-cuda.hpp>
#include "sparse_io.h"
namespace iterative_cuda
{
template <typename ValueType, typename IndexType>
struct cpu_sparse_csr_matrix_pimpl
{
csr_matrix<IndexType, ValueType> matrix;
bool own_matrix;
};
template <typename VT, typename IT>
cpu_sparse_csr_matrix<VT, IT>::cpu_sparse_csr_matrix(
index_type row_count,
index_type column_count,
index_type nonzero_count,
const index_type *csr_row_pointers,
const index_type *csr_column_indices,
const value_type *csr_nonzeros,
bool take_ownership)
: pimpl(new cpu_sparse_csr_matrix_pimpl<VT, IT>)
{
pimpl->matrix.num_rows = row_count;
pimpl->matrix.num_cols = column_count;
pimpl->matrix.num_nonzeros = nonzero_count;
pimpl->matrix.Ap = const_cast<index_type *>(csr_row_pointers);
pimpl->matrix.Aj = const_cast<index_type *>(csr_column_indices);
pimpl->matrix.Ax = const_cast<value_type *>(csr_nonzeros);
pimpl->own_matrix = take_ownership;
}
template <typename VT, typename IT>
cpu_sparse_csr_matrix<VT, IT>::~cpu_sparse_csr_matrix()
{
if (pimpl->own_matrix)
delete_csr_matrix(pimpl->matrix, HOST_MEMORY);
}
template <typename VT, typename IT>
IT cpu_sparse_csr_matrix<VT, IT>::row_count() const
{
return pimpl->matrix.num_rows;
}
template <typename VT, typename IT>
IT cpu_sparse_csr_matrix<VT, IT>::column_count() const
{
return pimpl->matrix.num_cols;
}
template <typename VT, typename IT>
void cpu_sparse_csr_matrix<VT, IT>::operator()(
value_type *y, value_type const *x) const
{
csr_matrix<index_type, value_type> const &mat(pimpl->matrix);
for (index_type i = 0; i < mat.num_rows; ++i)
{
const index_type row_start = mat.Ap[i];
const index_type row_end = mat.Ap[i+1];
value_type sum = y[i];
for (index_type jj = row_start; jj < row_end; jj++)
{
const index_type j = mat.Aj[jj];
sum += x[j] * mat.Ax[jj];
}
y[i] = sum;
}
}
template <typename VT, typename IT>
void cpu_sparse_csr_matrix<VT, IT>::extract_diagonal(value_type *d) const
{
csr_matrix<index_type, value_type> const &mat(pimpl->matrix);
for (index_type i = 0; i < mat.num_rows; ++i)
{
d[i] = 0;
const index_type row_start = mat.Ap[i];
const index_type row_end = mat.Ap[i+1];
for (index_type jj = row_start; jj < row_end; jj++)
{
const index_type j = mat.Aj[jj];
if (i == j)
{
d[i] += mat.Ax[jj];
}
}
}
}
template <class ValueType, class IndexType>
cpu_sparse_csr_matrix<ValueType, IndexType> *
cpu_sparse_csr_matrix<ValueType, IndexType>::read_matrix_market_file(
const char *fn)
{
csr_matrix<IndexType, ValueType> csr_mat =
read_csr_matrix<IndexType, ValueType>(fn);
typedef cpu_sparse_csr_matrix<ValueType, IndexType> mat_tp;
std::auto_ptr<mat_tp> result(new mat_tp(
csr_mat.num_rows, csr_mat.num_cols, csr_mat.num_nonzeros,
csr_mat.Ap, csr_mat.Aj, csr_mat.Ax));
return result.release();
}
}
#endif
| 25.877193 | 79 | 0.702599 | inducer |
3610adb7cb01067df9c3119fc13902553ffd12e1 | 696 | cpp | C++ | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | 1 | 2021-08-12T21:59:50.000Z | 2021-08-12T21:59:50.000Z | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | null | null | null | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | null | null | null | //
// SceneSettings.cpp
// cookie-engine
//
// Created by Antiufieiev Michael on 06.08.2021.
//
#include "SceneSettings.hpp"
namespace cookie {
SceneSettings::SceneSettings(
uint32_t width,
uint32_t height,
float x,
float y,
float z,
float fov,
float nearZ,
float farZ
) : width(width),
height(height),
cameraPos(glm::vec3(x, y, z)),
FOV(fov),
nearZ(nearZ),
farZ(farZ) {
onWindowResized(width, height);
}
void SceneSettings::onWindowResized(uint32_t newWidth, uint32_t newHeight) {
width = newWidth;
height = newHeight;
aspectRatio = (float) newWidth / (float) newHeight;
perspectiveMx = glm::perspective(FOV, aspectRatio, nearZ, farZ);
}
}
| 19.333333 | 77 | 0.679598 | an22 |
361112eed960dce6539ef49df634412c8f8ac440 | 746 | cc | C++ | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | 5 | 2020-04-11T21:30:19.000Z | 2021-12-04T16:16:09.000Z | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | null | null | null | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | null | null | null | #include <TaskGraph>
#include "TaskIterative.h"
using namespace tg;
typedef TaskGraph<void,int> iterative_TaskGraph;
void taskTest (coreTaskGraph *&t, unsigned param)
{
iterative_TaskGraph* const tg = new iterative_TaskGraph();
taskgraph(iterative_TaskGraph, *tg, tuple1(b))
{
tPrintf("param + b = %d\n", param + b);
}
t = tg;
}
int main(int argc, char* argv[])
{
OneVariableIterative iter(taskTest, 8, 128*2, 4, 4);
int a = (argc > 1) ? atoi(argv[1]) : 0;
unsigned int param;
for (int i = 0; i < 150; ++i)
{
iterative_TaskGraph* const iterative = static_cast<iterative_TaskGraph *>(iter.getNext(¶m));
tg::Timer timer;
iterative->execute(a);
timer.stop();
iter.setResult(param, timer.getTime());
}
}
| 23.3125 | 99 | 0.668901 | paulhjkelly |
36111b6879f52c481bbfa4d06a1d99159447eea0 | 15,875 | cpp | C++ | src/CQChartsStripPlot.cpp | SammyEnigma/CQCharts | 56433e32c943272b6faaf6771d0652c0507f943e | [
"MIT"
] | 14 | 2018-05-22T15:06:08.000Z | 2022-01-20T12:18:28.000Z | src/CQChartsStripPlot.cpp | SammyEnigma/CQCharts | 56433e32c943272b6faaf6771d0652c0507f943e | [
"MIT"
] | 6 | 2020-09-04T15:49:24.000Z | 2022-01-12T19:06:45.000Z | src/CQChartsStripPlot.cpp | SammyEnigma/CQCharts | 56433e32c943272b6faaf6771d0652c0507f943e | [
"MIT"
] | 9 | 2019-04-01T13:10:11.000Z | 2022-01-22T01:46:27.000Z | #include <CQChartsStripPlot.h>
#include <CQChartsView.h>
#include <CQChartsAxis.h>
#include <CQChartsTip.h>
#include <CQChartsModelDetails.h>
#include <CQChartsModelData.h>
#include <CQChartsAnalyzeModelData.h>
#include <CQChartsUtil.h>
#include <CQChartsVariant.h>
#include <CQCharts.h>
#include <CQChartsDrawUtil.h>
#include <CQChartsViewPlotPaintDevice.h>
#include <CQChartsScriptPaintDevice.h>
#include <CQChartsHtml.h>
#include <CQPropertyViewModel.h>
#include <CQPropertyViewItem.h>
#include <CQPerfMonitor.h>
#include <QMenu>
CQChartsStripPlotType::
CQChartsStripPlotType()
{
}
void
CQChartsStripPlotType::
addParameters()
{
startParameterGroup("Strip");
// value, name columns
addColumnParameter("value", "Value", "valueColumn").
setNumeric().setRequired().setPropPath("columns.value").setTip("Value column");
addColumnParameter("name", "Name", "nameColumn").
setBasic().setPropPath("columns.name").setTip("Name column");
addColumnParameter("position", "Position", "positionColumn").
setNumeric().setPropPath("columns.position").setTip("Position column");
endParameterGroup();
//---
// group data
CQChartsGroupPlotType::addParameters();
}
QString
CQChartsStripPlotType::
description() const
{
return CQChartsHtml().
h2("Strip Plot").
h3("Summary").
p("A strip plot is a scatter plot of value in the value column and position column "
"grouped by unique values in the name column.");
}
void
CQChartsStripPlotType::
analyzeModel(ModelData *modelData, AnalyzeModelData &analyzeModelData)
{
auto *details = modelData->details();
if (! details) return;
CQChartsColumn valueColumn;
int nc = details->numColumns();
for (int i = 0; i < nc; ++i) {
auto *columnDetails = details->columnDetails(Column(i));
if (columnDetails && columnDetails->isNumeric()) {
valueColumn = columnDetails->column();
break;
}
}
if (valueColumn.isValid())
analyzeModelData.parameterNameColumn["value"] = valueColumn;
}
CQChartsPlot *
CQChartsStripPlotType::
create(View *view, const ModelP &model) const
{
return new CQChartsStripPlot(view, model);
}
//------
CQChartsStripPlot::
CQChartsStripPlot(View *view, const ModelP &model) :
CQChartsGroupPlot(view, view->charts()->plotType("strip"), model),
CQChartsObjPointData<CQChartsStripPlot>(this)
{
}
CQChartsStripPlot::
~CQChartsStripPlot()
{
term();
}
//---
void
CQChartsStripPlot::
init()
{
CQChartsGroupPlot::init();
//---
NoUpdate noUpdate(this);
//---
setSymbol(Symbol::circle());
setSymbolSize(Length("4px"));
setSymbolFilled(true);
setSymbolFillColor(Color(Color::Type::PALETTE));
//---
addAxes();
addKey();
addTitle();
//---
addColorMapKey();
}
void
CQChartsStripPlot::
term()
{
}
//------
void
CQChartsStripPlot::
setValueColumn(const Column &c)
{
CQChartsUtil::testAndSet(valueColumn_, c, [&]() { updateRangeAndObjs(); } );
}
void
CQChartsStripPlot::
setNameColumn(const Column &c)
{
CQChartsUtil::testAndSet(nameColumn_, c, [&]() { updateRangeAndObjs(); } );
}
void
CQChartsStripPlot::
setPositionColumn(const Column &c)
{
CQChartsUtil::testAndSet(positionColumn_, c, [&]() { updateRangeAndObjs(); } );
}
//---
void
CQChartsStripPlot::
addProperties()
{
addBaseProperties();
// columns
addProp("columns", "valueColumn" , "value" , "Value column");
addProp("columns", "nameColumn" , "name" , "Name column");
addProp("columns", "positionColumn", "position", "Position column");
addGroupingProperties();
//---
// options
addProp("options", "margin", "margin", "Margin");
//---
// symbol
addSymbolProperties("symbol", "", "");
//---
// color map
addColorMapProperties();
// color map key
addColorMapKeyProperties();
}
//---
CQChartsGeom::Range
CQChartsStripPlot::
calcRange() const
{
CQPerfTrace trace("CQChartsStripPlot::calcRange");
NoUpdate noUpdate(this);
auto *th = const_cast<CQChartsStripPlot *>(this);
th->clearErrors();
//---
th->namePos_ .clear();
th->posValues_ .clear();
th->posYValues_.clear();
th->posRange_ = IMinMax();
th->xAxis()->clearTickLabels();
th->xAxis()->setValueType(CQChartsAxisValueType(CQChartsAxisValueType::Type::INTEGER));
//---
// check columns
bool columnsValid = true;
// value column required
// name, position columns optional
if (! checkNumericColumn(valueColumn(), "Value", /*required*/true))
columnsValid = false;
if (! checkColumn(nameColumn(), "Name")) columnsValid = false;
if (! checkColumn(positionColumn(), "Position")) columnsValid = false;
if (! columnsValid)
return Range();
//---
Range dataRange;
//---
// init grouping
initGroupData(Columns(), nameColumn());
//---
// process model data
class StripVisitor : public ModelVisitor {
public:
StripVisitor(const CQChartsStripPlot *plot, Range &dataRange) :
plot_(plot), dataRange_(dataRange) {
}
State visit(const QAbstractItemModel *, const VisitData &data) override {
plot_->calcRowRange(data, dataRange_);
return State::OK;
}
private:
const CQChartsStripPlot* plot_ { nullptr };
Range& dataRange_;
};
StripVisitor stripVisitor(this, dataRange);
visitModel(stripVisitor);
//---
for (auto &pgv : th->posValues_) {
auto &groupValuesData = pgv.second;
auto &values = groupValuesData.values;
std::sort(values.begin(), values.end(), [](double lhs, double rhs) { return (lhs < rhs); });
}
//---
// bucket values by y
for (auto &pgv : th->posValues_) {
int pos = pgv.first;
auto &groupValuesData = pgv.second;
const auto &values = groupValuesData.values;
auto min = *values.begin ();
auto max = *values.rbegin();
auto pgyv = th->posYValues_.find(pos);
if (pgyv == th->posYValues_.end())
pgyv = th->posYValues_.insert(pgyv, PosYValues::value_type(pos, YValues()));
auto &yvalues = (*pgyv).second;
for (const auto &value : values) {
int iy = (int) CMathUtil::map(value, min, max, 0, 100);
auto pyv = yvalues.find(iy);
if (pyv == yvalues.end())
pyv = yvalues.insert(pyv, YValues::value_type(iy, ValuesData()));
auto &valuesData = (*pyv).second;
++valuesData.n;
groupValuesData.maxN = std::max(groupValuesData.maxN, valuesData.n);
}
}
return dataRange;
}
void
CQChartsStripPlot::
calcRowRange(const ModelVisitor::VisitData &data, Range &range) const
{
auto *th = const_cast<CQChartsStripPlot *>(this);
//---
// get value (required)
ModelIndex valueInd(th, data.row, valueColumn(), data.parent);
bool ok;
auto value = modelReal(valueInd, ok);
if (! ok) {
if (! isSkipBad())
th->addDataError(valueInd, "Invalid value");
return;
}
//---
// get optional name
QString name;
if (nameColumn().isValid()) {
ModelIndex nameInd(th, data.row, nameColumn(), data.parent);
name = modelString(nameInd, ok);
if (! ok) {
if (! isSkipBad())
th->addDataError(nameInd, "Invalid name");
}
}
//---
// get optional position
using OptInt = CQChartsOptInt;
OptInt position;
if (positionColumn().isValid()) {
ModelIndex positionInd(th, data.row, positionColumn(), data.parent);
position = OptInt(modelInteger(positionInd, ok));
if (! ok) { th->addDataError(positionInd, "Invalid position"); position = OptInt(); }
}
//---
if (! position.isSet()) {
auto pn = th->namePos_.find(name);
if (pn == th->namePos_.end()) {
int n = th->namePos_.size();
pn = th->namePos_.insert(pn, NamePos::value_type(name, n));
}
position = OptInt((*pn).second);
}
int pos = position.integer();
th->posRange_.add(pos);
//--
auto pgv = th->posValues_.find(pos);
if (pgv == th->posValues_.end())
pgv = th->posValues_.insert(pgv, PosValues::value_type(pos, PosValuesData()));
auto &groupValuesData = (*pgv).second;
auto &values = groupValuesData.values;
values.push_back(value);
//---
if (name != "")
th->xAxis()->setTickLabel(pos, name);
//---
range.updateRange(Point(pos - 0.5, 0.0 ));
range.updateRange(Point(pos + 0.5, value));
}
//---
bool
CQChartsStripPlot::
createObjs(PlotObjs &objs) const
{
CQPerfTrace trace("CQChartsStripPlot::createObjs");
NoUpdate noUpdate(this);
//---
auto *th = const_cast<CQChartsStripPlot *>(this);
for (auto &pgyv : th->posYValues_) {
auto &yvalues = pgyv.second;
for (auto &pyv : yvalues) {
auto &valuesData = pyv.second;
valuesData.values.clear();
}
}
//---
// process model data
class StripVisitor : public ModelVisitor {
public:
StripVisitor(const CQChartsStripPlot *plot, PlotObjs &objs) :
plot_(plot), objs_(objs) {
}
State visit(const QAbstractItemModel *, const VisitData &data) override {
plot_->addRowObj(data, objs_);
return State::OK;
}
private:
const CQChartsStripPlot *plot_ { nullptr };
PlotObjs& objs_;
};
StripVisitor stripVisitor(this, objs);
visitModel(stripVisitor);
return true;
}
void
CQChartsStripPlot::
addRowObj(const ModelVisitor::VisitData &data, PlotObjs &objs) const
{
auto *th = const_cast<CQChartsStripPlot *>(this);
//---
// get value required
ModelIndex valueInd(th, data.row, valueColumn(), data.parent);
bool ok;
auto value = modelReal(valueInd, ok);
if (! ok) return;
//---
// get optional name
QString name;
if (nameColumn().isValid()) {
ModelIndex nameInd(th, data.row, nameColumn(), data.parent);
name = modelString(nameInd, ok);
if (! ok) name.clear();
}
//--
// get optional position
using OptInt = CQChartsOptInt;
OptInt position;
if (positionColumn().isValid()) {
ModelIndex positionInd(th, data.row, positionColumn(), data.parent);
position = OptInt(modelInteger(positionInd, ok));
if (! ok) { th->addDataError(positionInd, "Invalid position"); position = OptInt(); }
}
//---
if (! position.isSet()) {
auto pn = namePos_.find(name);
assert(pn != namePos_.end());
position = OptInt((*pn).second);
}
int pos = position.integer();
int ig = pos - posRange_.min();
int ng = posRange_.max() - posRange_.min() + 1;
//---
// get group
//int ns = numGroups();
int is = rowGroupInd(valueInd);
if (is < 0)
is = 0;
//---
auto pgv = posValues_.find(pos);
assert(pgv != posValues_.end());
auto &groupValuesData = (*pgv).second;
auto &values = groupValuesData.values;
auto min = *values.begin ();
auto max = *values.rbegin();
int iy = (int) CMathUtil::map(value, min, max, 0, 100);
auto pgyv = th->posYValues_.find(pos);
assert(pgyv != posYValues_.end());
auto &yvalues = (*pgyv).second;
auto pyv = yvalues.find(iy);
assert(pyv != yvalues.end());
auto &valuesData = (*pyv).second;
int iv = valuesData.values.size();
int nv = valuesData.n;
#if 0
double delta = (groupValuesData.maxN > 0 ? 1.0/groupValuesData.maxN : 0.0);
double dv = 0.0;
if (iv > 0) {
int iv1 = iv - 1;
int lr1 = iv1 & 1; // 0 left, 1 right
int nv1 = (iv1 >> 1) + 1; // index
dv = nv1*delta*(lr1 ? -1 : 1);
}
#else
double m = std::min(std::max(this->margin(), 0.0), 0.5);
double w = 0.5 - m;
double dv = CMathUtil::map(iv, 0, nv - 1, -w, w);
#endif
valuesData.values.push_back(value);
double dpos = pos + dv;
//---
double osx, osy;
plotSymbolSize(symbolSize(), osx, osy);
BBox bbox(dpos - osx, value - osy, dpos + osx, value + osy);
Point p(dpos, value);
auto ind = modelIndex(normalizeIndex(valueInd));
auto *obj = createPointObj(bbox, is, p, ind, ColorInd(ig, ng), ColorInd(iv, nv));
objs.push_back(obj);
}
void
CQChartsStripPlot::
addKeyItems(PlotKey *)
{
}
//------
bool
CQChartsStripPlot::
addMenuItems(QMenu *menu)
{
bool added = false;
if (canDrawColorMapKey()) {
addColorMapKeyItems(menu);
added = true;
}
return added;
}
//----
CQChartsStripPointObj *
CQChartsStripPlot::
createPointObj(const BBox &rect, int groupInd, const Point &p, const QModelIndex &ind,
const ColorInd &ig, const ColorInd &iv) const
{
return new CQChartsStripPointObj(this, rect, groupInd, p, ind, ig, iv);
}
//---
bool
CQChartsStripPlot::
hasForeground() const
{
if (! isLayerActive(CQChartsLayer::Type::FOREGROUND))
return false;
return true;
}
void
CQChartsStripPlot::
execDrawForeground(PaintDevice *device) const
{
if (isColorMapKey())
drawColorMapKey(device);
}
//---
CQChartsPlotCustomControls *
CQChartsStripPlot::
createCustomControls()
{
auto *controls = new CQChartsStripPlotCustomControls(charts());
controls->init();
controls->setPlot(this);
controls->updateWidgets();
return controls;
}
//------
CQChartsStripPointObj::
CQChartsStripPointObj(const Plot *plot, const BBox &rect, int groupInd, const Point &p,
const QModelIndex &ind, const ColorInd &ig, const ColorInd &iv) :
CQChartsPlotObj(const_cast<Plot *>(plot), rect, ColorInd(), ig, iv), plot_(plot),
groupInd_(groupInd), p_(p)
{
setModelInd(ind);
}
QString
CQChartsStripPointObj::
calcId() const
{
return QString("%1:%2:%3").arg(typeName()).arg(ig_.i).arg(iv_.i);
}
QString
CQChartsStripPointObj::
calcTipId() const
{
CQChartsTableTip tableTip;
auto groupName = plot_->groupIndName(groupInd_);
tableTip.addTableRow("Group", groupName);
tableTip.addTableRow("Ind" , iv_.i);
//---
plot()->addTipColumns(tableTip, modelInd());
//---
return tableTip.str();
}
bool
CQChartsStripPointObj::
inside(const Point &p) const
{
auto p1 = plot_->windowToPixel(Point(p_.x, p_.y));
BBox pbbox(p1.x - 4, p1.y - 4, p1.x + 4, p1.y + 4);
auto pp = plot_->windowToPixel(p);
return pbbox.inside(pp);
}
void
CQChartsStripPointObj::
getObjSelectIndices(Indices &inds) const
{
addColumnSelectIndex(inds, CQChartsColumn(modelInd().column()));
}
void
CQChartsStripPointObj::
draw(PaintDevice *device) const
{
auto symbol = plot_->symbol();
auto symbolSize = plot_->symbolSize();
//---
// get color index
auto colorInd = this->calcColorInd();
//---
// calc stroke and brush
PenBrush penBrush;
plot_->setSymbolPenBrush(penBrush, colorInd);
if (plot_->colorColumn().isValid()) {
auto ind1 = modelInd();
Color indColor;
auto symbolColor = penBrush.brush.color();
if (plot_->colorColumnColor(ind1.row(), ind1.parent(), indColor)) {
symbolColor = plot_->interpColor(indColor, colorInd);
CQChartsDrawUtil::updateBrushColor(penBrush.brush, symbolColor);
}
}
plot_->updateObjPenBrushState(this, penBrush, CQChartsPlot::DrawType::SYMBOL);
//---
// draw symbol
if (symbol.isValid())
CQChartsDrawUtil::drawSymbol(device, penBrush, symbol, p_, symbolSize);
}
//------
CQChartsStripPlotCustomControls::
CQChartsStripPlotCustomControls(CQCharts *charts) :
CQChartsGroupPlotCustomControls(charts, "strip")
{
}
void
CQChartsStripPlotCustomControls::
init()
{
addWidgets();
addLayoutStretch();
connectSlots(true);
}
void
CQChartsStripPlotCustomControls::
addWidgets()
{
addGroupColumnWidgets();
addColorColumnWidgets();
//---
addKeyList();
}
void
CQChartsStripPlotCustomControls::
setPlot(CQChartsPlot *plot)
{
if (plot_)
disconnect(plot_, SIGNAL(customDataChanged()), this, SLOT(updateWidgets()));
plot_ = dynamic_cast<CQChartsStripPlot *>(plot);
CQChartsGroupPlotCustomControls::setPlot(plot);
if (plot_)
connect(plot_, SIGNAL(customDataChanged()), this, SLOT(updateWidgets()));
}
CQChartsColor
CQChartsStripPlotCustomControls::
getColorValue()
{
return plot_->symbolFillColor();
}
void
CQChartsStripPlotCustomControls::
setColorValue(const CQChartsColor &c)
{
plot_->setSymbolFillColor(c);
}
| 19.080529 | 96 | 0.657134 | SammyEnigma |
3611e3b2c3034551d1faeb5071c7a712d84cba7e | 2,459 | cpp | C++ | BlackBirdBox/src/Platform/OpenGL/Buffers/OpenGLVertexArray.cpp | RokKos/black-bird-box | 27205fcc6db18d042e712fd8640af41922c3c186 | [
"MIT"
] | 1 | 2020-06-22T16:57:16.000Z | 2020-06-22T16:57:16.000Z | BlackBirdBox/src/Platform/OpenGL/Buffers/OpenGLVertexArray.cpp | RokKos/black-bird-box | 27205fcc6db18d042e712fd8640af41922c3c186 | [
"MIT"
] | null | null | null | BlackBirdBox/src/Platform/OpenGL/Buffers/OpenGLVertexArray.cpp | RokKos/black-bird-box | 27205fcc6db18d042e712fd8640af41922c3c186 | [
"MIT"
] | null | null | null | #include "bbbpch.h"
#include "OpenGLVertexArray.h"
#include <GL/glew.h>
namespace Platform {
static GLenum ShaderDataTypeToOpenGLBaseType(BlackBirdBox::ShaderDataType type)
{
switch (type) {
case BlackBirdBox::ShaderDataType::Float:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Float2:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Float3:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Float4:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Mat3:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Mat4:
return GL_FLOAT;
case BlackBirdBox::ShaderDataType::Int:
return GL_INT;
case BlackBirdBox::ShaderDataType::Int2:
return GL_INT;
case BlackBirdBox::ShaderDataType::Int3:
return GL_INT;
case BlackBirdBox::ShaderDataType::Int4:
return GL_INT;
case BlackBirdBox::ShaderDataType::Bool:
return GL_BOOL;
}
CORE_ASSERT(false, "Unknown ShaderDataType!");
return 0;
}
OpenGLVertexArray::OpenGLVertexArray()
{
PROFILE_FUNCTION();
glCreateVertexArrays(1, &m_RendererID);
}
OpenGLVertexArray::~OpenGLVertexArray()
{
PROFILE_FUNCTION();
glDeleteVertexArrays(1, &m_RendererID);
}
void OpenGLVertexArray::Bind() const
{
PROFILE_FUNCTION();
glBindVertexArray(m_RendererID);
}
void OpenGLVertexArray::Unbind() const
{
PROFILE_FUNCTION();
glBindVertexArray(0);
}
void OpenGLVertexArray::AddVertexBuffer(const BlackBirdBox::Ref<BlackBirdBox::VertexBuffer>& vertexBuffer)
{
PROFILE_FUNCTION();
CORE_ASSERT(vertexBuffer->GetLayout().GetElements().size(), "Vertex Buffer has no layout!");
glBindVertexArray(m_RendererID);
vertexBuffer->Bind();
const auto& layout = vertexBuffer->GetLayout();
for (const auto& element : layout) {
glEnableVertexAttribArray(m_VertexBufferIndex);
glVertexAttribPointer(m_VertexBufferIndex, element.GetComponentCount(), ShaderDataTypeToOpenGLBaseType(element.Type),
element.Normalized ? GL_TRUE : GL_FALSE, layout.GetStride(), (const void*)element.Offset);
m_VertexBufferIndex++;
}
m_VertexBuffers.push_back(vertexBuffer);
}
void OpenGLVertexArray::SetIndexBuffer(const BlackBirdBox::Ref<BlackBirdBox::IndexBuffer>& indexBuffer)
{
PROFILE_FUNCTION();
glBindVertexArray(m_RendererID);
indexBuffer->Bind();
m_IndexBuffer = indexBuffer;
}
}
| 25.091837 | 125 | 0.714925 | RokKos |
3611f37d1e05d236303f0139c73aeebd5058d05c | 5,832 | cpp | C++ | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | #include "model.hpp"
#include "../utils.hpp"
#include <tiny_obj_loader.h>
#include <iostream>
static_assert(sizeof(Vertex) == sizeof(float) * 7);
void Model::initializeVao() {
glCreateVertexArrays(1, &vao);
for (GLuint i = 0; i < 4; i++) {
glEnableVertexArrayAttrib(vao, i);
glVertexArrayAttribBinding(vao, i, 0);
}
glVertexArrayAttribFormat(vao, 0, 3, GL_FLOAT, GL_FALSE, offsetof(Vertex, pos));
glVertexArrayAttribFormat(vao, 1, 3, GL_BYTE, GL_TRUE, offsetof(Vertex, normal));
glVertexArrayAttribFormat(vao, 2, 3, GL_BYTE, GL_TRUE, offsetof(Vertex, tangent));
glVertexArrayAttribFormat(vao, 3, 2, GL_FLOAT, GL_FALSE, offsetof(Vertex, texcoord));
}
void Model::initialize(std::span<Vertex> vertices, std::span<uint32_t> indices) {
glCreateBuffers(1, &vertexBuffer);
glNamedBufferStorage(vertexBuffer, vertices.size_bytes(), vertices.data(), 0);
glCreateBuffers(1, &indexBuffer);
glNamedBufferStorage(indexBuffer, indices.size_bytes(), indices.data(), 0);
sphereRadius = 0;
minPos = maxPos = vertices[0].pos;
for (const Vertex& vertex : vertices) {
sphereRadius = std::max(glm::length(vertex.pos), sphereRadius);
minPos = glm::min(minPos, vertex.pos);
maxPos = glm::max(maxPos, vertex.pos);
}
}
void Model::destroy() {
glDeleteBuffers(1, &vertexBuffer);
glDeleteBuffers(1, &indexBuffer);
}
void generateTangents(std::span<Vertex> vertices, std::span<const glm::vec3> normals, std::span<const uint32_t> indices) {
glm::vec3* tangents1 = (glm::vec3*)std::calloc(1, vertices.size() * sizeof(glm::vec3));
glm::vec3* tangents2 = (glm::vec3*)std::calloc(1, vertices.size() * sizeof(glm::vec3));
for (size_t i = 0; i < indices.size(); i += 3) {
const glm::vec3 dp0 = vertices[indices[i + 1]].pos - vertices[indices[i]].pos;
const glm::vec3 dp1 = vertices[indices[i + 2]].pos - vertices[indices[i]].pos;
const glm::vec2 dtc0 = vertices[indices[i + 1]].texcoord - vertices[indices[i]].texcoord;
const glm::vec2 dtc1 = vertices[indices[i + 2]].texcoord - vertices[indices[i]].texcoord;
const float div = dtc0.x * dtc1.y - dtc1.x * dtc0.y;
if (std::abs(div) < 1E-6f)
continue;
const float r = 1.0f / div;
glm::vec3 d1((dtc1.y * dp0.x - dtc0.y * dp1.x) * r, (dtc1.y * dp0.y - dtc0.y * dp1.y) * r, (dtc1.y * dp0.z - dtc0.y * dp1.z) * r);
glm::vec3 d2((dtc0.x * dp1.x - dtc1.x * dp0.x) * r, (dtc0.x * dp1.y - dtc1.x * dp0.y) * r, (dtc0.x * dp1.z - dtc1.x * dp0.z) * r);
for (size_t j = i; j < i + 3; j++) {
tangents1[indices[j]] += d1;
tangents2[indices[j]] += d2;
}
}
for (size_t v = 0; v < vertices.size(); v++) {
if (glm::length2(tangents1[v]) > 1E-6f) {
tangents1[v] -= normals[v] * glm::dot(normals[v], tangents1[v]);
tangents1[v] = glm::normalize(tangents1[v]);
if (glm::dot(glm::cross(normals[v], tangents1[v]), tangents2[v]) < 0.0f) {
tangents1[v] = -tangents1[v];
}
}
vertices[v].tangent = packVectorS(tangents1[v]);
}
std::free(tangents1);
std::free(tangents2);
}
void Model::loadObj(const std::string& path) {
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string errorString;
if (!tinyobj::LoadObj(shapes, materials, errorString, path.c_str(), nullptr, tinyobj::triangulation)) {
std::cerr << "error loading obj: " << errorString << std::endl;
std::abort();
}
assert(shapes.size() < MAX_MESHES);
std::vector<Vertex> vertices;
std::vector<glm::vec3> normals;
std::vector<uint32_t> indices;
for (const tinyobj::shape_t& shape : shapes) {
Mesh& mesh = meshes[numMeshes++];
mesh.name = std::move(shape.name);
mesh.firstIndex = indices.size();
mesh.firstVertex = vertices.size();
mesh.numIndices = shape.mesh.indices.size();
size_t underscorePos = mesh.name.rfind('_');
if (underscorePos != std::string::npos) {
mesh.name = mesh.name.substr(underscorePos + 1);
}
indices.insert(indices.end(), shape.mesh.indices.begin(), shape.mesh.indices.end());
normals.clear();
assert(shape.mesh.positions.size() % 3 == 0);
assert(shape.mesh.positions.size() == shape.mesh.normals.size());
assert(shape.mesh.positions.size() / 3 == shape.mesh.texcoords.size() / 2);
for (size_t i = 0; i * 3 < shape.mesh.positions.size(); i++) {
const glm::vec3 normal = glm::normalize(glm::vec3(
shape.mesh.normals[i * 3 + 0],
shape.mesh.normals[i * 3 + 1],
shape.mesh.normals[i * 3 + 2]
));
Vertex& vertex = vertices.emplace_back();
vertex.pos.x = shape.mesh.positions[i * 3 + 0];
vertex.pos.y = shape.mesh.positions[i * 3 + 1];
vertex.pos.z = shape.mesh.positions[i * 3 + 2];
vertex.normal = packVectorS(normal);
vertex.texcoord.x = shape.mesh.texcoords[i * 2 + 0];
vertex.texcoord.y = shape.mesh.texcoords[i * 2 + 1];
normals.push_back(normal);
}
generateTangents(
std::span<Vertex>(&vertices[mesh.firstVertex], vertices.size() - mesh.firstVertex),
normals, shape.mesh.indices);
}
#ifdef DEBUG
std::cout << path << " mesh names: ";
for (uint32_t i = 0; i < numMeshes; i++) {
if (i) std::cout << ", ";
std::cout << "'" << meshes[i].name << "'";
}
std::cout << std::endl;
#endif
initialize(vertices, indices);
}
uint32_t Model::findMesh(std::string_view name) const {
for (uint32_t i = 0; i < numMeshes; i++) {
if (meshes[i].name == name) {
return i;
}
}
std::abort();
}
void Model::bind() const {
glBindVertexBuffer(0, vertexBuffer, 0, sizeof(Vertex));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
}
void Model::drawMesh(uint32_t meshIndex) const {
glDrawElementsBaseVertex(
GL_TRIANGLES,
meshes[meshIndex].numIndices,
GL_UNSIGNED_INT,
(void*)(meshes[meshIndex].firstIndex * sizeof(uint32_t)),
meshes[meshIndex].firstVertex
);
}
void Model::drawAllMeshes() const {
for (uint32_t i = 0; i < numMeshes; i++) {
drawMesh(i);
}
}
| 32.043956 | 132 | 0.655178 | Eae02 |
36155ea412d8e4bbc9a16427c163379f9760e753 | 9,590 | cpp | C++ | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | #include "mbed.h"
#include "NetTask.h"
#include "http_request.h"
NtpTask::NtpTask(NetTask *owner) :
Task(osWaitForever),
_owner(owner),
_state(State::Unsynced),
_retry(0)
{
}
NtpTask::~NtpTask()
{
}
void NtpTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::WifiConnected) != 0) {
_state = State::Unsynced;
_timer = 0;
}
}
void NtpTask::Process()
{
if (_timer != 0)
return;
switch (_state) {
case State::Unsynced:
if (!_owner->IsConnected()) {
_state = State::Unsynced;
_timer = osWaitForever;
}
else if (_owner->InvokeNtp()) {
_retry = 0;
_state = State::Synced;
_timer = 3 * 60 * 1000;
}
else {
_retry++;
if (_retry >= 3) {
_retry = 0;
_state = State::Unsynced;
_timer = 1 * 60 * 1000;
}
else {
_state = State::Unsynced;
_timer = 10 * 1000;
}
}
break;
case State::Synced:
_state = State::Unsynced;
_timer = 0;
break;
default:
_state = State::Unsynced;
_timer = 10 * 1000;
break;
}
}
UploadTask::UploadTask(NetTask *owner) :
Task(osWaitForever),
_owner(owner),
_state(),
_retry(0),
_server(),
_serverAddr(),
_storage(),
_storageAddr(),
_update_req(false),
_uploads()
{
}
UploadTask::~UploadTask()
{
}
void UploadTask::Init(std::string server, std::string storage)
{
_server = server;
_serverAddr.set_ip_address(server.c_str());
_storage = storage;
_storageAddr.set_ip_address(storage.c_str());
}
void UploadTask::UploadRequest(std::string filename)
{
_mutex.lock();
_uploads.push_back(filename);
_mutex.unlock();
_owner->Signal(InterTaskSignals::UploadRequest);
}
void UploadTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::UpdateRequest) != 0) {
_update_req = true;
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Update;
_timer = 0;
}
}
if ((signals & InterTaskSignals::UploadRequest) != 0) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Upload;
_timer = 0;
}
}
}
bool UploadTask::Upload()
{
bool result;
std::string filename;
_mutex.lock();
result = !_uploads.empty();
if (result) {
filename = _uploads.front();
_uploads.pop_front();
}
_mutex.unlock();
if (result) {
result = _owner->Upload(_serverAddr, filename);
}
if (!result) {
_mutex.lock();
_uploads.push_back(filename);
_mutex.unlock();
}
return result;
}
void UploadTask::Process()
{
SocketAddress addr;
if (_timer != 0)
return;
switch (_state) {
case State::Undetected:
if (!_owner->IsConnected()) {
_state = State::Undetected;
_timer = osWaitForever;
}
else if (_owner->QuerySever(_server.c_str(), addr)) {
_serverAddr.set_addr(addr.get_addr());
_retry = 0;
if (_update_req) {
_state = State::Update;
_timer = 0;
}
else {
_state = State::Detected;
_timer = 1 * 60 * 1000;
}
}
else {
_retry++;
if (_retry >= 3) {
_retry = 0;
_state = State::Undetected;
_timer = 1 * 60 * 1000;
}
else {
_state = State::Undetected;
_timer = 10 * 1000;
}
}
break;
case State::Detected:
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Detected;
_timer = osWaitForever;
}
break;
case State::Update:
if (_owner->Update(_serverAddr, _storageAddr)) {
_owner->WifiSleep(true);
_update_req = false;
_retry = 0;
_state = State::Detected;
_timer = osWaitForever;
}
else {
_retry++;
if (_retry >= 3) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_serverAddr.set_addr(nsapi_addr_t());
_retry = 0;
_state = State::Undetected;
_timer = 0;
}
else {
_retry = 0;
_state = State::Update;
_timer = 3 * 60 * 1000;
}
}
else {
_state = State::Update;
_timer = 10 * 1000;
}
}
break;
case State::Upload:
if (Upload()) {
_retry = 0;
_state = State::Detected;
_timer = osWaitForever;
}
else {
_retry++;
if (_retry >= 3) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_serverAddr.set_addr(nsapi_addr_t());
_retry = 0;
_state = State::Undetected;
_timer = 0;
}
else {
_retry = 0;
_state = State::Upload;
_timer = 3 * 60 * 1000;
}
}
else {
_state = State::Upload;
_timer = 10 * 1000;
}
}
break;
default:
_state = State::Undetected;
_timer = 0;
break;
}
}
WifiTask::WifiTask(NetTask *owner, ESP32Interface *wifi) :
Task(osWaitForever),
_owner(owner),
_wifi(wifi),
_ssid(),
_password(),
_state(State::Disconnected)
{
}
WifiTask::~WifiTask()
{
}
void WifiTask::Init(std::string ssid, std::string password, std::string host_name)
{
_ssid = ssid;
_password = password;
_host_name = host_name;
}
void WifiTask::wifi_status(nsapi_event_t evt, intptr_t obj)
{
_owner->WifiStatus(evt);
}
void WifiTask::OnStart()
{
_wifi->attach(callback(this, &WifiTask::wifi_status));
_state = State::Disconnected;
if (!_ssid.empty() && !_password.empty()) {
_timer = 1000;
}
else {
_timer = 30 * 1000;
}
}
void WifiTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::WifiStatusChanged) != 0) {
State new_state;
switch (_wifi->get_connection_status()) {
case NSAPI_STATUS_LOCAL_UP:
case NSAPI_STATUS_GLOBAL_UP:
_owner->WifiConnected();
_state = State::Connected;
_timer = osWaitForever;
break;
case NSAPI_STATUS_DISCONNECTED:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
case NSAPI_STATUS_CONNECTING:
_state = State::Connecting;
_timer = osWaitForever;
break;
case NSAPI_STATUS_ERROR_UNSUPPORTED:
default:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
}
}
}
void WifiTask::Process()
{
nsapi_connection_status_t ret;
if (_timer != 0)
return;
switch (_state) {
case State::Disconnected:
if (!_ssid.empty() && !_password.empty()) {
if (_wifi->connect(_ssid.c_str(), _password.c_str(), NSAPI_SECURITY_WPA_WPA2) == NSAPI_ERROR_OK) {
_wifi->ntp(true, 0);
_wifi->mdns(true, _host_name.c_str(), "_iot", 3601);
_state = State::Connecting;
_timer = 1000;
}
else {
_state = State::Disconnected;
_timer = 30 * 1000;
}
}
else {
_state = State::Disconnected;
_timer = 30 * 1000;
}
break;
default:
switch (_wifi->get_connection_status()) {
case NSAPI_STATUS_LOCAL_UP:
case NSAPI_STATUS_GLOBAL_UP:
if (_state == State::Connecting) {
_owner->WifiConnected();
}
_state = State::Connected;
_timer = osWaitForever;
break;
case NSAPI_STATUS_CONNECTING:
_state = State::Connecting;
_timer = 1000;
break;
case NSAPI_STATUS_DISCONNECTED:
case NSAPI_STATUS_ERROR_UNSUPPORTED:
default:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
}
break;
}
}
NetTask::NetTask(GlobalState *globalState, ESP32Interface *wifi) :
TaskThread(&_task, osPriorityNormal, (1024 * 8), NULL, "NetTask"),
_tasks{ &_wifiTask, &_ntpTask, &_uploadTask, &_googleDriveTask },
_task(_tasks, sizeof(_tasks) / sizeof(_tasks[0])),
_globalState(globalState),
_wifi(wifi),
_ntpTask(this),
_uploadTask(this),
_wifiTask(this, wifi),
_googleDriveTask(this),
upload_file(NULL)
{
}
NetTask::~NetTask()
{
}
void NetTask::Init(std::string ssid, std::string password, std::string host_name,
std::string server, std::string storage)
{
_wifiTask.Init(ssid, password, host_name);
_uploadTask.Init(server, storage);
}
#define CHAR3_TO_INT(a, b, c) (((int)a) + (((int)b) << 8) + (((int)c) << 16))
bool NetTask::InvokeNtp()
{
char temp[32];
char mon[4], week[4];
struct tm tm;
if (!_wifi->ntp_time(&tm)) {
return false;
}
set_time(mktime(&tm) + (9 * 60 * 60));
return true;
}
bool NetTask::IsActive()
{
return _uploadTask.GetState() == UploadTask::State::Update;
}
bool NetTask::QuerySever(const std::string hostname, SocketAddress &addr)
{
return _wifi->mdns_query(hostname.c_str(), addr);
}
bool NetTask::Update(SocketAddress server, SocketAddress storage)
{
auto url = std::string("http://") + std::string(server.get_ip_address())
+ ":3000/update?ip=" + std::string(storage.get_ip_address());
auto get_req = new HttpRequest(_wifi, HTTP_GET, url.c_str());
auto get_res = get_req->send();
return (get_res != NULL) && (get_res->get_status_code() == 200);
}
void NetTask::UploadRequest(std::string filename)
{
_uploadTask.UploadRequest(filename);
}
bool NetTask::Upload(SocketAddress server, std::string filename)
{
if (upload_file != NULL)
return false;
upload_file = fopen(filename.c_str(), "rb");
auto url = std::string("http://") + std::string(server.get_ip_address())
+ ":3000/upload?name=" + filename;
auto post_req = new HttpRequest(_wifi, HTTP_POST, url.c_str());
auto post_res = post_req->send(mbed::callback(this, &NetTask::UploadBody));
fclose(upload_file);
upload_file = NULL;
if ((post_res == NULL) || (post_res->get_status_code() == 200))
return false;
return true;
}
size_t NetTask::UploadBody(char *buf, size_t length)
{
return fread(buf, sizeof(char), length, upload_file);
}
void NetTask::WifiStatus(nsapi_event_t evt)
{
printf("NetTask::WifiStatus(%d)\r\n", (int)evt);
Signal(InterTaskSignals::WifiStatusChanged);
}
void NetTask::WifiConnected()
{
printf("NetTask::WifiConnected\r\n");
Signal(InterTaskSignals::WifiConnected);
}
bool NetTask::WifiSleep(bool enable)
{
return _wifi->sleep(enable);
}
| 19.571429 | 101 | 0.652868 | h7ga40 |
3615f66a0ceaaf69df8a9b53166c3e17636f3cd0 | 5,913 | cpp | C++ | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 74 | 2021-05-31T15:23:49.000Z | 2022-03-12T04:46:39.000Z | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 16 | 2021-05-31T15:26:38.000Z | 2022-03-30T06:02:43.000Z | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 64 | 2021-05-31T15:25:36.000Z | 2022-02-23T08:43:58.000Z | /**
* Copyright (c) 2021 OceanBase
* OceanBase Database Proxy(ODP) is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#define private public
#define protected public
#include <gtest/gtest.h>
#include <pthread.h>
#include "test_eventsystem_api.h"
#include "ob_mysql_stats.h"
#include "stat/ob_net_stats.h"
namespace oceanbase
{
namespace obproxy
{
using namespace proxy;
using namespace common;
using namespace event;
using namespace net;
#define UNUSED_PARAMER 1000
#define TEST_EVENT_START_THREADS_NUM 2
#define TEST_MAX_STRING_LENGTH 70
#define TEST_STRING_GROUP_COUNT 5
char g_output[TEST_STRING_GROUP_COUNT][TEST_MAX_STRING_LENGTH] = {};
TestWaitCond g_wait_cond;
struct TestNetSMCont : public ObContinuation
{
ObVIO *read_vio_;
ObIOBufferReader *reader_;
ObNetVConnection *vc_;
ObMIOBuffer *buf_;
TestNetSMCont(ObProxyMutex * mutex, ObNetVConnection * vc)
: ObContinuation(mutex)
{
MUTEX_TRY_LOCK(lock, mutex_, vc->thread_);
ob_release_assert(lock.is_locked());
vc_ = vc;
SET_HANDLER(&TestNetSMCont::handle_read);
buf_ = new_miobuffer(32 * 1024);
reader_ = buf_->alloc_reader();
read_vio_ = vc->do_io_read(this, INT64_MAX, buf_);
memset(g_output, 0 , TEST_STRING_GROUP_COUNT * TEST_MAX_STRING_LENGTH);
INFO_NET("TEST", "TestNetSMCont : create test sm");
}
int handle_read(int event, void *data)
{
UNUSED(data);
int size;
static int i = 0;
switch (event) {
case VC_EVENT_READ_READY: {
size = (int)reader_->read_avail();
ob_assert(size <= TEST_MAX_STRING_LENGTH);
reader_->read(g_output[i++], size);
printf("output:%s\n", g_output[i - 1]);
fflush(stdout);
break;
}
case VC_EVENT_READ_COMPLETE:
case VC_EVENT_EOS: {
size = (int)reader_->read_avail();
reader_->read(g_output[i++], size);
printf("output:%s\n", g_output[i - 1]);
fflush(stdout);
vc_->do_io_close();
break;
}
case VC_EVENT_ERROR: {
vc_->do_io_close();
break;
}
default:
ob_release_assert(!"unknown event");
}
return EVENT_CONT;
}
};
struct TestNetAcceptCont : public event::ObContinuation
{
TestNetAcceptCont(ObProxyMutex * mutex)
: ObContinuation(mutex)
{
SET_HANDLER(&TestNetAcceptCont::handle_accept);
}
int handle_accept(int event, void *data)
{
UNUSED(event);
INFO_NET("TEST", "TestNetAcceptCont : Accepted a connection");
ObNetVConnection *vc = static_cast<ObNetVConnection *>(data);
new TestNetSMCont(new_proxy_mutex(), vc);
signal_condition(&g_wait_cond);
return EVENT_CONT;
}
};
void *thread_net_processor_start(void *data);
void init_net_processor();
class TestNetSystem : public ::testing::Test
{
public:
virtual void SetUp();
virtual void TearDown();
public:
FILE *test_fp_;
};
void TestNetSystem::SetUp()
{
test_fp_ = NULL;
}
void TestNetSystem::TearDown()
{
if (NULL != test_fp_) {
pclose(test_fp_);
} else {}
}
void *thread_net_processor_start(void *data)
{
UNUSED(data);
init_event_system(EVENT_SYSTEM_MODULE_VERSION);
ObNetProcessor::ObAcceptOptions options;
options.local_port_ = 9876;
options.accept_threads_ = 1;
options.frequent_accept_ = true;
init_mysql_stats();
ObNetOptions net_options;
if (OB_SUCCESS != init_net(NET_SYSTEM_MODULE_VERSION, net_options)) {
ERROR_NET("failed to init net");
} else if (OB_SUCCESS != init_net_stats()) {
ERROR_NET("failed to init net stats");
} else if (OB_SUCCESS != g_event_processor.start(TEST_EVENT_START_THREADS_NUM, DEFAULT_STACKSIZE, false, false)) {
DEBUG_NET("TEST", "failed to START g_event_processor");
} else if (OB_SUCCESS != g_net_processor.start(UNUSED_PARAMER, UNUSED_PARAMER)){
DEBUG_NET("TEST", "failed to START g_net_processor");
} else {
INFO_NET("TEST", "g_net_processor START success");
g_net_processor.accept(new TestNetAcceptCont(new_proxy_mutex()), options);
this_ethread()->execute();
}
return NULL;
}
void init_net_processor()
{
ObThreadId tid;
tid = thread_create(thread_net_processor_start, NULL, true, 0);
if (tid <= 0) {
LOG_ERROR("failed to create thread_net_processor_start");
} else {}
}
TEST_F(TestNetSystem, test_start)
{
INFO_NET("TEST", "test_start");
char buffer[TEST_STRING_GROUP_COUNT][TEST_MAX_STRING_LENGTH] ={
"OceanBase was originally designed to solve the problem of ",
"large-scale data of Taobao in ALIBABA GROUP. ",
"OceanBase experiences these versions such as 0.3, 0.4, 0.5. ",
"You can refer to \"OceanBase 0.5 System Overview\" for system ",
"overview of version 0.5."
};
if (NULL == (test_fp_ = popen("telnet 127.0.0.1 9876", "w"))) {
DEBUG_NET("TEST", "failed to popen test_fp_");
} else {
wait_condition(&g_wait_cond);
for (int64_t i = 0; i < TEST_STRING_GROUP_COUNT; ++i) {
fputs(buffer[i], test_fp_);
fflush(test_fp_);
printf("input :%s\n", buffer[i]);
fflush(stdout);
sleep(1);
}
for (int64_t i = 0; i < TEST_STRING_GROUP_COUNT; ++i) {
EXPECT_EQ(0, memcmp(buffer[i], g_output[i], TEST_MAX_STRING_LENGTH));
}
}
}
} // end of namespace obproxy
} // end of namespace oceanbase
int main(int argc, char **argv)
{
oceanbase::common::ObLogger::get_logger().set_log_level("INFO");
oceanbase::obproxy::init_net_processor();
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 27.502326 | 116 | 0.687976 | stutiredboy |
361d752504f38029807a5b133d5daba5e9da38c7 | 24,838 | cpp | C++ | Shared/CommonUtils/CommonMeshUtilities.cpp | jonntd/ExocortexCrateVS2010MAYA | 2e54951b1cf79434df4d6410d47197a4794352be | [
"BSD-3-Clause"
] | 105 | 2015-01-01T03:42:42.000Z | 2021-11-15T10:07:06.000Z | Shared/CommonUtils/CommonMeshUtilities.cpp | jonntd/ExocortexCrateVS2010MAYA | 2e54951b1cf79434df4d6410d47197a4794352be | [
"BSD-3-Clause"
] | 55 | 2015-01-16T15:24:43.000Z | 2021-06-28T06:57:48.000Z | Shared/CommonUtils/CommonMeshUtilities.cpp | jonntd/ExocortexCrateVS2010MAYA | 2e54951b1cf79434df4d6410d47197a4794352be | [
"BSD-3-Clause"
] | 69 | 2015-01-16T12:44:36.000Z | 2022-03-08T10:32:26.000Z | #include "CommonMeshUtilities.h"
#include "CommonAlembic.h"
#include "CommonLog.h"
#include "CommonProfiler.h"
#include "CommonUtilities.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
void extractMeshInfo(T& schema, bool& isPointCache, bool& isTopoDyn)
{
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(schema, ".faceCounts");
if (!faceCountProp.valid()) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(schema, "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0)
isPointCache = true;
}
else if (faceCountProp.isConstant()) {
Alembic::Abc::Int32ArraySamplePtr faceCounts = faceCountProp.getValue();
// the first is our preferred method, the second check here is Helge's
// method that is now considered obsolete
if (faceCounts->size() == 0 ||
(faceCounts->size() == 1 && (faceCounts->get()[0] == 0))) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(schema, "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0)
isPointCache = true;
}
}
else
isTopoDyn = true;
}
typedef Alembic::AbcGeom::IPolyMesh::schema_type poly_mesh_schema;
typedef Alembic::AbcGeom::ISubD::schema_type sub_div_schema;
void extractMeshInfo(Alembic::AbcGeom::IObject* pIObj, bool isMesh,
bool& isPointCache, bool& isTopoDyn)
{
if (isMesh)
extractMeshInfo<poly_mesh_schema>(
Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting)
.getSchema(),
isPointCache, isTopoDyn);
else
extractMeshInfo<sub_div_schema>(
Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting)
.getSchema(),
isPointCache, isTopoDyn);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool isAlembicMeshValid(Alembic::AbcGeom::IObject* pIObj)
{
// ESS_PROFILE_FUNC();
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
}
else {
objSubD = Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting);
}
if (!objMesh.valid() && !objSubD.valid()) {
return false;
}
return true;
}
bool isAlembicMeshNormals(Alembic::AbcGeom::IObject* pIObj, bool& isConstant)
{
// ESS_PROFILE_FUNC();
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
if (objMesh.valid()) {
if (objMesh.getSchema().getNormalsParam().valid()) {
isConstant = objMesh.getSchema().getNormalsParam().isConstant();
return true;
}
}
}
isConstant = true;
return false;
}
bool isAlembicMeshPositions(Alembic::AbcGeom::IObject* pIObj, bool& isConstant)
{
ESS_PROFILE_SCOPE("isAlembicMeshPositions");
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
if (objMesh.valid()) {
isConstant = objMesh.getSchema().getPositionsProperty().isConstant();
return true;
}
}
else {
objSubD = Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting);
if (objSubD.valid()) {
isConstant = objSubD.getSchema().getPositionsProperty().isConstant();
return true;
}
}
isConstant = true;
return false;
}
// bool isAlembicMeshUVWs( Alembic::AbcGeom::IObject *pIObj, bool& isConstant )
// {
// ESS_PROFILE_SCOPE("isAlembicMeshUVWs");
// Alembic::AbcGeom::IPolyMesh objMesh;
// Alembic::AbcGeom::ISubD objSubD;
//
// if(Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
// objMesh =
//Alembic::AbcGeom::IPolyMesh(*pIObj,Alembic::Abc::kWrapExisting);
// if( objMesh.valid() ) {
// if( objMesh.getSchema().getUVsParam().valid() ) {
// isConstant =
//objMesh.getSchema().getUVsParam().isConstant();
// return true;
// }
// }
// }
// else {
// objSubD =
//Alembic::AbcGeom::ISubD(*pIObj,Alembic::Abc::kWrapExisting);
// if( objSubD.valid() ) {
// if( objSubD.getSchema().getUVsParam().valid() ) {
// isConstant =
//objSubD.getSchema().getUVsParam().isConstant();
// return true;
// }
// }
// }
// isConstant = true;
//
// return false;
//}
bool isAlembicMeshTopoDynamic(Alembic::AbcGeom::IObject* pIObj)
{
ESS_PROFILE_SCOPE("isAlembicMeshTopoDynamic");
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (!pIObj->valid()) {
return false;
}
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
}
else {
objSubD = Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting);
}
Alembic::AbcGeom::IPolyMeshSchema::Sample polyMeshSample;
Alembic::AbcGeom::ISubDSchema::Sample subDSample;
bool hasDynamicTopo = false;
if (objMesh.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objMesh.getSchema(), ".faceCounts");
if (faceCountProp.valid() && !faceCountProp.isConstant()) {
hasDynamicTopo = true;
}
}
else if (subDSample.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objSubD.getSchema(), ".faceCounts");
if (faceCountProp.valid() && !faceCountProp.isConstant()) {
hasDynamicTopo = true;
}
}
return hasDynamicTopo;
}
bool isAlembicMeshTopology(Alembic::AbcGeom::IObject* pIObj)
{
ESS_PROFILE_SCOPE("isAlembicMeshTopology");
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (!pIObj->valid()) {
return false;
}
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
}
else {
objSubD = Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting);
}
bool isTopology = true;
if (objMesh.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objMesh.getSchema(), ".faceCounts");
if (!faceCountProp.valid()) {
isTopology = false;
}
else if (faceCountProp.isConstant()) {
Alembic::Abc::Int32ArraySamplePtr faceCounts = faceCountProp.getValue();
if (faceCounts->size() == 0 ||
(faceCounts->size() == 1 && (faceCounts->get()[0] == 0))) {
isTopology = false;
}
}
}
else if (objSubD.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objSubD.getSchema(), ".faceCounts");
if (!faceCountProp.valid()) {
isTopology = false;
}
else if (faceCountProp.isConstant()) {
Alembic::Abc::Int32ArraySamplePtr faceCounts = faceCountProp.getValue();
if (faceCounts->size() == 0 ||
(faceCounts->size() == 1 && (faceCounts->get()[0] == 0))) {
isTopology = false;
}
}
}
else {
isTopology = false;
}
return isTopology;
}
bool isAlembicMeshPointCache(Alembic::AbcGeom::IObject* pIObj)
{
ESS_PROFILE_SCOPE("isAlembicMeshPointCache");
Alembic::AbcGeom::IPolyMesh objMesh;
Alembic::AbcGeom::ISubD objSubD;
if (Alembic::AbcGeom::IPolyMesh::matches((*pIObj).getMetaData())) {
objMesh = Alembic::AbcGeom::IPolyMesh(*pIObj, Alembic::Abc::kWrapExisting);
}
else {
objSubD = Alembic::AbcGeom::ISubD(*pIObj, Alembic::Abc::kWrapExisting);
}
bool isPointCache = false;
if (objMesh.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objMesh.getSchema(), ".faceCounts");
if (!faceCountProp.valid()) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(objMesh.getSchema(), "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0) {
isPointCache = true;
}
}
else if (faceCountProp.isConstant()) {
Alembic::Abc::Int32ArraySamplePtr faceCounts = faceCountProp.getValue();
// the first is our preferred method, the second check here is Helge's
// method that is now considered obsolete
if (faceCounts->size() == 0 ||
(faceCounts->size() == 1 && (faceCounts->get()[0] == 0))) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(objMesh.getSchema(), "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0) {
isPointCache = true;
}
}
}
}
else if (objSubD.valid()) {
Alembic::Abc::IInt32ArrayProperty faceCountProp =
Alembic::Abc::IInt32ArrayProperty(objSubD.getSchema(), ".faceCounts");
if (!faceCountProp.valid()) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(objSubD.getSchema(), "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0) {
isPointCache = true;
}
}
else if (faceCountProp.isConstant()) {
Alembic::Abc::Int32ArraySamplePtr faceCounts = faceCountProp.getValue();
// the first is our preferred method, the second check here is Helge's
// method that is now considered obsolete
if (faceCounts->size() == 0 ||
(faceCounts->size() == 1 && (faceCounts->get()[0] == 0))) {
Alembic::Abc::IP3fArrayProperty positionsProp =
Alembic::Abc::IP3fArrayProperty(objSubD.getSchema(), "P");
if (positionsProp.valid() && positionsProp.getValue()->size() > 0) {
isPointCache = true;
}
}
}
}
return isPointCache;
}
struct edge {
int a;
int b;
bool operator<(const edge& rEdge) const
{
if (a < rEdge.a) return true;
if (a > rEdge.a) return false;
if (b < rEdge.b) return true;
return false;
}
};
struct edgeData {
bool bReversed;
int count;
int face;
edgeData() : bReversed(false), count(1), face(-1) {}
};
int validateAlembicMeshTopo(
std::vector<Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::int32_t>
faceCounts,
std::vector<Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::int32_t>
faceIndices,
const std::string& meshName)
{
std::map<edge, edgeData> edgeToCountMap;
typedef std::map<edge, edgeData>::iterator iterator;
int meshErrors = 0;
int faceOffset = 0;
for (int i = 0; i < faceCounts.size(); i++) {
int count = faceCounts[i];
std::vector<int> occurences;
occurences.reserve(count);
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::int32_t* v =
&faceIndices[faceOffset];
for (int j = 0; j < count; j++) {
occurences.push_back(v[j]);
}
std::sort(occurences.begin(), occurences.end());
for (int j = 0; j < occurences.size() - 1; j++) {
if (occurences[j] == occurences[j + 1]) {
ESS_LOG_WARNING("Error in mesh \"" << meshName << "\". Vertex "
<< occurences[j] << " of face " << i
<< " is duplicated.");
meshErrors++;
}
}
for (int j = 0; j < count - 1; j++) {
edge e;
e.a = v[j];
e.b = v[j + 1];
if (e.a == e.b) {
// the duplicate vertices check already covers this case.
// ESS_LOG_WARNING("edge ("<<e.a<<", "<<e.b<<") is degenerate.");
continue;
}
edgeData eData;
eData.face = i;
if (e.b < e.a) {
std::swap(e.a, e.b);
eData.bReversed = true;
}
if (edgeToCountMap.find(e) == edgeToCountMap.end()) {
edgeToCountMap[e] = eData;
}
else {
edgeData eData2 = edgeToCountMap[e];
eData2.count++;
if ((eData.bReversed && eData2.bReversed) ||
(!eData.bReversed && !eData2.bReversed)) {
ESS_LOG_WARNING("Error in mesh \""
<< meshName << "\". Edge (" << e.a << ", " << e.b
<< ") is shared between polygons " << eData.face
<< " and " << eData2.face
<< ", and these polygons have reversed orderings.");
meshErrors++;
}
}
}
faceOffset += count;
}
return meshErrors;
}
bool getIndexAndValues(Alembic::Abc::Int32ArraySamplePtr faceIndices,
Alembic::AbcGeom::IV2fGeomParam& param,
AbcA::index_t sampleIndex,
std::vector<Imath::V2f>& outputValues,
std::vector<AbcA::uint32_t>& outputIndices)
{
ESS_PROFILE_FUNC();
if (param.getIndexProperty().valid() && param.getValueProperty().valid()) {
bool bOutOfBoundsIndices = false;
Alembic::Abc::V2fArraySamplePtr valueSampler =
param.getValueProperty().getValue(sampleIndex);
for (int i = 0; i < valueSampler->size(); i++) {
outputValues.push_back((*valueSampler)[i]);
}
Alembic::Abc::UInt32ArraySamplePtr indexSampler =
param.getIndexProperty().getValue(sampleIndex);
for (int i = 0; i < indexSampler->size(); i++) {
if ((*indexSampler)[i] >= outputValues.size()) {
outputIndices.push_back(outputValues.size() - 1);
bOutOfBoundsIndices = true;
}
else if ((*indexSampler)[i] < 0) {
outputIndices.push_back(0);
bOutOfBoundsIndices = true;
}
else {
outputIndices.push_back((*indexSampler)[i]);
}
}
if (bOutOfBoundsIndices) {
ESS_LOG_WARNING("Out of bounds indices detected.");
}
return true;
}
else if (param.getValueProperty().valid()) {
Alembic::Abc::V2fArraySamplePtr valueSampler =
param.getValueProperty().getValue(sampleIndex);
std::vector<Imath::V2f> tempValues;
for (int i = 0; i < valueSampler->size(); i++) {
tempValues.push_back((*valueSampler)[i]);
}
std::vector<Alembic::Abc::int32_t> tempIndices;
for (int i = 0; i < faceIndices->size(); i++) {
tempIndices.push_back((*faceIndices)[i]);
}
// ESS_LOG_WARNING("sampleIndex: "<<sampleIndex);
// ESS_LOG_WARNING("valueSampler->size(): "<<valueSampler->size());
// ESS_LOG_WARNING("tempIndices.size(): "<<tempIndices.size());
// if( valueSampler->size() != tempIndices.size() ){
// ESS_LOG_WARNING("valueSampler->size() != tempIndices.size()");
//}
createIndexedArray<Imath::V2f, SortableV2f>(tempIndices, tempValues,
outputValues, outputIndices);
return true;
}
return false;
}
bool getIndexAndValues(Alembic::Abc::Int32ArraySamplePtr faceIndices,
Alembic::AbcGeom::IN3fGeomParam& param,
AbcA::index_t sampleIndex,
std::vector<Imath::V3f>& outputValues,
std::vector<AbcA::uint32_t>& outputIndices)
{
ESS_PROFILE_FUNC();
if (param.getIndexProperty().valid() && param.getValueProperty().valid()) {
bool bOutOfBoundsIndices = false;
Alembic::Abc::N3fArraySamplePtr valueSampler =
param.getValueProperty().getValue(sampleIndex);
for (int i = 0; i < valueSampler->size(); i++) {
outputValues.push_back((*valueSampler)[i]);
}
Alembic::Abc::UInt32ArraySamplePtr indexSampler =
param.getIndexProperty().getValue(sampleIndex);
for (int i = 0; i < indexSampler->size(); i++) {
if ((*indexSampler)[i] >= outputValues.size()) {
outputIndices.push_back(outputValues.size() - 1);
bOutOfBoundsIndices = true;
}
else if ((*indexSampler)[i] < 0) {
outputIndices.push_back(0);
bOutOfBoundsIndices = true;
}
else {
outputIndices.push_back((*indexSampler)[i]);
}
}
if (bOutOfBoundsIndices) {
ESS_LOG_WARNING("Out of bounds indices detected.");
}
return true;
}
else if (param.getValueProperty().valid()) {
Alembic::Abc::N3fArraySamplePtr valueSampler =
param.getValueProperty().getValue(sampleIndex);
std::vector<Imath::V3f> tempValues;
for (int i = 0; i < valueSampler->size(); i++) {
tempValues.push_back((*valueSampler)[i]);
}
std::vector<Alembic::Abc::int32_t> tempIndices;
for (int i = 0; i < faceIndices->size(); i++) {
tempIndices.push_back((*faceIndices)[i]);
}
createIndexedArray<Imath::V3f, SortableV3f>(tempIndices, tempValues,
outputValues, outputIndices);
return true;
}
return false;
}
bool correctInvalidUVs(std::vector<IndexedUVs>& indexUVSet)
{
ESS_PROFILE_FUNC();
bool bInvalidUVs = false;
for (int i = 0; i < indexUVSet.size(); i++) {
for (int j = 0; j < indexUVSet[i].indices.size(); j++) {
if (indexUVSet[i].indices[j] < 0) {
indexUVSet[i].indices[j] = 0;
bInvalidUVs = true;
}
if (indexUVSet[i].indices[j] > indexUVSet[i].values.size()) {
indexUVSet[i].indices[j] = (int)indexUVSet[i].values.size() - 1;
bInvalidUVs = true;
}
}
}
return bInvalidUVs;
}
void saveIndexedUVs(AbcG::OPolyMeshSchema& meshSchema,
AbcG::OPolyMeshSchema::Sample& meshSample,
AbcG::OV2fGeomParam::Sample& uvSample,
std::vector<AbcG::OV2fGeomParam>& uvParams,
unsigned int animatedTs, int numSamples,
std::vector<IndexedUVs>& indexUVSet)
{
if (numSamples == 0 && indexUVSet.size() > 0) {
std::vector<std::string> names;
for (int i = 0; i < indexUVSet.size(); i++) {
names.push_back(indexUVSet[i].name);
}
Abc::OStringArrayProperty uvSetNamesProperty = Abc::OStringArrayProperty(
meshSchema, ".uvSetNames", meshSchema.getMetaData(), animatedTs);
uvSetNamesProperty.set(Abc::StringArraySample(names));
}
for (int i = 0; i < indexUVSet.size(); i++) {
// EC_LOG_WARNING( "indexUVSet[i].values: " << indexUVSet[i].values.size()
// << " indexUVSet[i].indices: " << indexUVSet[i].indices.size() );
Abc::V2fArraySample valuesSample(indexUVSet[i].values);
Abc::UInt32ArraySample indicesSample(indexUVSet[i].indices);
uvSample =
AbcG::OV2fGeomParam::Sample(valuesSample, AbcG::kFacevaryingScope);
uvSample.setIndices(indicesSample);
if (i == 0) {
meshSample.setUVs(uvSample);
}
else {
// create the uv param if required
if (numSamples == 0) {
std::stringstream alembicName;
alembicName << "uv" << i;
uvParams.push_back(
AbcG::OV2fGeomParam(meshSchema, alembicName.str().c_str(),
indexUVSet[i].indices.size() > 0,
AbcG::kFacevaryingScope, 1, animatedTs));
}
uvParams[i - 1].set(uvSample);
}
}
}
AbcG::IV2fGeomParam getMeshUvParam(int uvI, AbcG::IPolyMesh objMesh,
AbcG::ISubD objSubD)
{
if (objMesh.valid()) {
ESS_PROFILE_SCOPE("ALEMBIC_DATAFILL_UVS -getUVsParam mesh");
if (uvI == 0) {
return objMesh.getSchema().getUVsParam();
}
else {
std::stringstream storedUVNameStream;
storedUVNameStream << "uv" << uvI;
if (objMesh.getSchema().getPropertyHeader(storedUVNameStream.str()) !=
NULL) {
return AbcG::IV2fGeomParam(objMesh.getSchema(),
storedUVNameStream.str());
}
}
}
else {
ESS_PROFILE_SCOPE("ALEMBIC_DATAFILL_UVS -getUVsParam SubD");
if (uvI == 0) {
return objSubD.getSchema().getUVsParam();
}
else {
std::stringstream storedUVNameStream;
storedUVNameStream << "uv" << uvI;
if (objSubD.getSchema().getPropertyHeader(storedUVNameStream.str()) !=
NULL) {
return AbcG::IV2fGeomParam(objSubD.getSchema(),
storedUVNameStream.str());
}
}
}
return AbcG::IV2fGeomParam();
}
bool frameHasDynamicTopology(
AbcG::IPolyMeshSchema::Sample* const polyMeshSample,
SampleInfo* const sampleInfo,
Abc::IInt32ArrayProperty* const faceIndicesProperty)
{
ESS_PROFILE_FUNC();
bool hasDynamicTopo = false;
if (sampleInfo->alpha != 0.0f || sampleInfo->alpha != 1.0f) {
// hasDynamicTopo =
// options.pObjectCache->isMeshTopoDynamic;//isAlembicMeshTopoDynamic(
// options.pIObj );
// Abc::IInt32ArrayProperty faceIndicesProperty =
// objMesh.getSchema().getFaceIndicesProperty();
Abc::Int32ArraySamplePtr arraySampleFloor =
polyMeshSample->getFaceIndices();
Abc::int32_t const* pMeshFaceIndicesFloor = arraySampleFloor->get();
// read from just ceil indices sample, not entire mesh sample (which would
// be much slower)
Abc::Int32ArraySamplePtr arraySampleCeil;
faceIndicesProperty->get(arraySampleCeil, sampleInfo->ceilIndex);
Abc::int32_t const* pMeshFaceIndicesCeil = arraySampleCeil->get();
if (arraySampleFloor->size() == arraySampleCeil->size()) {
const size_t memSize = sizeof(Abc::int32_t) * arraySampleFloor->size();
if (memcmp(pMeshFaceIndicesFloor, pMeshFaceIndicesCeil, memSize) == 0) {
hasDynamicTopo = false;
}
else {
hasDynamicTopo = true;
}
}
else {
hasDynamicTopo = true;
}
}
return hasDynamicTopo;
}
bool frameHasDynamicTopology(const AbcG::IPolyMeshSchema::Sample& sample1,
const AbcG::IPolyMeshSchema::Sample& sample2)
{
ESS_PROFILE_FUNC();
bool hasDynamicTopo = true;
const Alembic::Abc::Int32ArraySamplePtr fIndices1 = sample1.getFaceIndices();
const Alembic::Abc::Int32ArraySamplePtr fIndices2 = sample2.getFaceIndices();
if ((fIndices1->size() == fIndices2->size()) &&
(fIndices1->getKey() == fIndices2->getKey())) {
const Alembic::Abc::Int32ArraySamplePtr fCount1 = sample1.getFaceCounts();
const Alembic::Abc::Int32ArraySamplePtr fCount2 = sample2.getFaceCounts();
hasDynamicTopo = (fCount1->size() != fCount2->size()) ||
(fCount1->getKey() != fCount2->getKey());
}
return hasDynamicTopo;
}
void dynamicTopoVelocityCalc::calcVelocities(
const std::vector<Abc::V3f>& nextPosVec,
const std::vector<AbcA::int32_t>& nextFaceIndicesVec,
std::vector<Abc::V3f>& velocities, double time)
{
if (bInitialized) {
bool bTopoDataIsEqual = false;
// if topology data is equal, calculate the velocitiy (replace the default
// one or create one of all zeros if it is not initialized
if (faceIndicesVec.size() == nextFaceIndicesVec.size()) {
if (faceIndicesVec.size() > 0) {
size_t memSize = sizeof(Abc::int32_t) * nextFaceIndicesVec.size();
if (memcmp(&faceIndicesVec[0], &nextFaceIndicesVec[0], memSize) == 0) {
bTopoDataIsEqual = true;
}
}
else {
bTopoDataIsEqual = true;
}
}
if (bTopoDataIsEqual) {
if (posVec.size() != nextPosVec.size()) {
ESS_LOG_WARNING("calcVelocities - posVec.size() != nextPosVec.size()");
}
// TODO: remove this warning?
if (nextPosVec.size() != velocities.size()) {
ESS_LOG_WARNING(
"calcVelocities - nextPosVec.size() != velocities.size()");
}
}
if (bTopoDataIsEqual && posVec.size() == nextPosVec.size() &&
nextPosVec.size() == velocities.size()) {
for (int i = 0; i < nextPosVec.size(); i++) {
velocities[i] = nextPosVec[i] - posVec[i] / (float)(time - prevTime);
}
}
}
// update the previous values
posVec = nextPosVec;
faceIndicesVec = nextFaceIndicesVec;
prevTime = time;
bInitialized = true;
} | 33.839237 | 108 | 0.596062 | jonntd |
361e602b5f1bebb307006c619eb113462b79fcb8 | 768 | cc | C++ | src/analyzer/protocol/gtpv1/GTPv1.cc | eniware-org/zeek | dc0313ac487521aec3c01013927be0518331ad44 | [
"Apache-2.0",
"CC0-1.0",
"MIT"
] | 1 | 2021-03-06T19:51:07.000Z | 2021-03-06T19:51:07.000Z | src/analyzer/protocol/gtpv1/GTPv1.cc | eniware-org/zeek | dc0313ac487521aec3c01013927be0518331ad44 | [
"Apache-2.0",
"CC0-1.0",
"MIT"
] | null | null | null | src/analyzer/protocol/gtpv1/GTPv1.cc | eniware-org/zeek | dc0313ac487521aec3c01013927be0518331ad44 | [
"Apache-2.0",
"CC0-1.0",
"MIT"
] | null | null | null | // See the file "COPYING" in the main distribution directory for copyright.
#include "GTPv1.h"
#include "events.bif.h"
using namespace analyzer::gtpv1;
GTPv1_Analyzer::GTPv1_Analyzer(Connection* conn)
: Analyzer("GTPV1", conn)
{
interp = new binpac::GTPv1::GTPv1_Conn(this);
}
GTPv1_Analyzer::~GTPv1_Analyzer()
{
delete interp;
}
void GTPv1_Analyzer::Done()
{
Analyzer::Done();
Event(udp_session_done);
}
void GTPv1_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, uint64 seq, const IP_Hdr* ip, int caplen)
{
Analyzer::DeliverPacket(len, data, orig, seq, ip, caplen);
try
{
interp->NewData(orig, data, data + len);
}
catch ( const binpac::Exception& e )
{
ProtocolViolation(fmt("Binpac exception: %s", e.c_msg()));
}
}
| 20.210526 | 116 | 0.699219 | eniware-org |
361f2d444e5e38f108416f322e0e6ad62dc84bf7 | 561 | hpp | C++ | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | #ifndef DATATREE_JSON_HPP
# define DATATREE_JSON_HPP
# include "datatree.hpp"
namespace Json
{
class Parser
{
public:
Parser(const std::string&, bool filename = true);
DataTree* Run(void);
private:
void ParseValue(DataBranch*);
void ParseString(DataBranch*);
void ParseOther(DataBranch*);
void ParseObject(DataBranch*);
void ParseArray(DataBranch*);
std::string _source;
std::string _str;
unsigned int _it;
bool _fileLoaded;
};
}
#endif
| 18.7 | 53 | 0.600713 | Plaristote |
361fac8704e7985f5d946500a9743b622e77df96 | 7,205 | cpp | C++ | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 4 | 2017-12-18T20:10:16.000Z | 2021-02-07T21:21:24.000Z | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | null | null | null | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 3 | 2019-03-11T21:36:15.000Z | 2021-02-07T21:21:26.000Z | /*************************************************************************
"BeatGames" Source File.
Copyright (C), BeatGames, 2014.
-------------------------------------------------------------------------
History:
- 03.12.2014 13:49 : Created by AfroStalin(chernecoff)
- 10.12.2014 21:08 : Edited by AfroStalin(chernecoff)
-------------------------------------------------------------------------
*************************************************************************/
#include "StdAfx.h"
#include "NetworkBuilding.h"
#include "ScriptBind_NetworkBuilding.h"
#include "WorldState/WorldState.h"
CNetworkBuilding::CNetworkBuilding()
: m_state(eState_NotUsed)
{
}
CNetworkBuilding::~CNetworkBuilding()
{
g_pGame->GetNetworkBuildingScriptBind()->Detach(GetEntityId());
}
bool CNetworkBuilding::Init( IGameObject * pGameObject )
{
SetGameObject(pGameObject);
defMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial("Materials/special/not_built_building.mtl");
if (!pGameObject->BindToNetwork())
return false;
if (!Reset())
return false;
g_pGame->GetNetworkBuildingScriptBind()->AttachTo(this);
if(gEnv->bServer)
{
ws=CWorldState::GetInstance();
ReadWorldState();
}
GetEntity()->Activate(true);
return true;
}
void CNetworkBuilding::PostInit( IGameObject * pGameObject )
{
pGameObject->EnableUpdateSlot(this, 0);
}
bool CNetworkBuilding::GetSettings()
{
SmartScriptTable entityProperties;
IScriptTable* pScriptTable = GetEntity()->GetScriptTable();
if(!pScriptTable || !pScriptTable->GetValue("Properties", entityProperties))
{
CryLog("[Network Building] : Error read lua properties !");
return false;
}
//Physics properties
SmartScriptTable physicProperties;
if (entityProperties->GetValue("Physics", physicProperties))
{
physicProperties->GetValue("iPhysType", phys_type);
physicProperties->GetValue("fPhysMass", phys_mass);
physicProperties->GetValue("fPhysDensity", phys_density);
}
//Building properties
SmartScriptTable buildingProperties;
if (entityProperties->GetValue("Building", buildingProperties))
{
// Geometry
buildingProperties->GetValue("sDefaultModel",default_model);
buildingProperties->GetValue("sModel_1",model_1);
buildingProperties->GetValue("sModel_2",model_2);
buildingProperties->GetValue("sModel_3",model_3);
buildingProperties->GetValue("sFinishModel",finish_model);
// Materials
buildingProperties->GetValue("sModel_1_material",Model_1_mat);
buildingProperties->GetValue("sModel_2_material",Model_2_mat);
buildingProperties->GetValue("sModel_3_material",Model_3_mat);
buildingProperties->GetValue("sFinishMaterial",finishMat);
//
buildingProperties->GetValue("fBuildTime",build_time);
}
return true;
}
bool CNetworkBuilding::Reset()
{
if(!GetSettings())
return false;
entity_name = GetEntity()->GetName();
fStartTime = 0.f;
build_status = -1;
m_state = eState_NotUsed;
GetEntity()->LoadGeometry(0,default_model);
GetEntity()->SetMaterial(defMat);
Physicalize(PE_NONE);
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
return true;
}
bool CNetworkBuilding::ReloadExtension( IGameObject * pGameObject, const SEntitySpawnParams ¶ms )
{
ResetGameObject();
CRY_ASSERT_MESSAGE(false, "CCTFFlag::ReloadExtension not implemented");
return false;
}
bool CNetworkBuilding::GetEntityPoolSignature( TSerialize signature )
{
CRY_ASSERT_MESSAGE(false, "CCTFFlag::GetEntityPoolSignature not implemented");
return true;
}
void CNetworkBuilding::Release()
{
delete this;
}
bool CNetworkBuilding::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags )
{
if (aspect == POSITION_ASPECT)
{
if(gEnv->bServer && !gEnv->IsEditor())
{
int cur_state = (int)m_state;
ws->SetInt(entity_name,"BuildStatus",build_status);
ws->SetInt(entity_name,"EntityState",cur_state);
}
EState newState = m_state;
ser.EnumValue("cur_state", newState, eState_NotUsed, eState_Done);
ser.Value( "build_status", build_status);
if (ser.IsWriting())
{
//CryLog("CNetworkBuilding::NetSerialize writing !!!");
}
if (ser.IsReading())
{
//CryLog("CNetworkBuilding::NetSerialize reading !!!");
m_state = newState;
Building(build_status);
}
}
return true;
}
void CNetworkBuilding::Update( SEntityUpdateContext& ctx, int updateSlot )
{
if (g_pGame->GetIGameFramework()->IsEditing())
{
Reset();
return;
}
float curTime = gEnv->pTimer->GetAsyncTime().GetSeconds();
float newTime = fStartTime+(build_time/4);
if(build_status!=-1 && gEnv->bServer)
{
if(curTime >= newTime && m_state!=eState_Done)
{
build_status++;
Building(build_status);
fStartTime = curTime;
}
}
// Test
//Vec3 test = GetEntity()->GetWorldPos();
//test.z = test.z+5.f;
//gEnv->pRenderer->DrawLabel(test, 1.f,GetEntity()->GetName());
}
int CNetworkBuilding::CanUse(EntityId entityId) const
{
const bool canUse = (m_state == eState_NotUsed);
if(canUse)
return 1;
else
return 0;
}
void CNetworkBuilding::StartBuild()
{
if(m_state==eState_NotUsed && gEnv->bServer)
{
CryLog("CNetworkBuilding::Building started...");
m_state = eState_InUse;
build_status = 0;
fStartTime = gEnv->pTimer->GetAsyncTime().GetSeconds();
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
}
}
bool CNetworkBuilding::Building(int part)
{
if(part>0)
{
if(part==1)
{
CryLog("CNetworkBuilding::Building part 1...");
// Geometry
GetEntity()->LoadGeometry(0, model_1);
// Material
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_1_mat);
GetEntity()->SetMaterial(pMat);
// Physics
Physicalize((pe_type)phys_type);
}
if(part==2)
{
CryLog("CNetworkBuilding::Building part 2...");
GetEntity()->LoadGeometry(0, model_2);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_2_mat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
}
if(part==3)
{
CryLog("CNetworkBuilding::Building part 3...");
GetEntity()->LoadGeometry(0, model_3);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_3_mat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
}
if(part==4)
{
CryLog("CNetworkBuilding::Building finish part...");
GetEntity()->LoadGeometry(0, finish_model);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(finishMat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
m_state = eState_Done;
CryLog("CNetworkBuilding::Building finished !");
}
if (gEnv->bServer)
{
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
}
}
return true;
}
void CNetworkBuilding::Physicalize(pe_type phys_type)
{
SEntityPhysicalizeParams params;
params.type = phys_type;
params.density = phys_density;
params.mass = phys_mass;
GetEntity()->Physicalize(params);
if (gEnv->bServer)
{
GetGameObject()->SetAspectProfile(eEA_Physics, phys_type);
}
}
void CNetworkBuilding::ReadWorldState()
{
if(gEnv->bServer && ws->CheckEntityTag(entity_name) && !gEnv->IsEditor())
{
build_status = ws->GetInt(entity_name,"BuildStatus");
m_state = (EState)ws->GetInt(entity_name,"EntityState");
}
} | 23.700658 | 106 | 0.694656 | amrhead |
36249ccc7f686680819704dc0fe8e1adcce533ab | 357 | hpp | C++ | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | 4 | 2020-12-28T15:29:15.000Z | 2021-06-27T12:37:15.000Z | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | null | null | null | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | 2 | 2021-01-13T05:28:39.000Z | 2021-05-04T03:37:11.000Z | #ifndef _FTL_CUDA_ANTIALIASING_HPP_
#define _FTL_CUDA_ANTIALIASING_HPP_
#include <ftl/cuda_common.hpp>
namespace ftl {
namespace cuda {
void fxaa(ftl::cuda::TextureObject<uchar4> &colour, cudaStream_t stream);
void fxaa(ftl::cuda::TextureObject<uchar4> &colour, ftl::cuda::TextureObject<float> &depth, float threshold, cudaStream_t stream);
}
}
#endif
| 22.3125 | 130 | 0.784314 | knicos |
3626b3c4db07a233b0bb15b2fbd725302b6636da | 5,842 | hxx | C++ | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | #ifndef __cmSNRUnitsReconstructorB1Weighted_hxx
#define __cmSNRUnitsReconstructorB1Weighted_hxx
#include "cmSNRUnitsReconstructorB1Weighted.h"
#include "itkImageAlgorithm.h"
#include "vnl/vnl_inverse.h"
#include "vnl/vnl_vector.h"
#include "vnl/vnl_matrix.h"
#include "vnl/algo/vnl_matrix_inverse.h"
#include "itkVector.h"
namespace cm
{
template< class VectorImageType,class ScalarImageType>
void SNRUnitsReconstructorB1Weighted< VectorImageType,ScalarImageType>
::ThreadedGenerateData(const VectorImageRegionType& outputRegionForThread, itk::ThreadIdType threadId)
{
VectorImageTypePointer SENSITIVITYMAP=this->GetSensitivityMap();
VectorImageTypePointer KSPACEDATAIFFT=this->GetInputIFFT();
ScalarImageTypePointer OUT=this->GetOutput();
ChannelArrayType iCM=this->GetInverseNoiseCovariance();
const int Kdimension =KSPACEDATAIFFT->GetNumberOfComponentsPerPixel();
const int Sdimension =SENSITIVITYMAP->GetNumberOfComponentsPerPixel();
itk::ImageRegionIterator<VectorImageType> is(SENSITIVITYMAP,outputRegionForThread);
itk::ImageRegionIterator<VectorImageType> iif(KSPACEDATAIFFT,outputRegionForThread);
itk::ImageRegionIterator<ScalarImageType> io(OUT,outputRegionForThread);
// /* prepare */
is.GoToBegin();
iif.GoToBegin();
io.GoToBegin();
VectorImagePixelType S;
ChannelArrayType SV(Sdimension,1);
ChannelArrayType D(1,1);
VectorImagePixelType I;
ChannelArrayType IV(Kdimension,1);
ChannelArrayType OV(1,1);
ChannelArrayType REG(1,1);
REG(0,0)= (ScalarImagePixelType) std::sqrt(2.0);
/* BANG!!*/
while( !iif.IsAtEnd() )
{
S=is.Get();
I=iif.Get();
/* reset counter and calculate the sos*/
for(auto y=0;y<Sdimension;y++)
{
SV(y,0)=S.GetElement(y);
IV(y,0)=I.GetElement(y);
}
D=SV.conjugate_transpose()*iCM*SV;
D=D.apply(sqrt);
OV= SV.conjugate_transpose()*iCM*IV;
io.Set((ScalarImagePixelType) REG(0,0) * std::abs(OV(0,0)) / std::abs(D(0,0)));
++is;
++iif;
++io;
}
}
}// end namespace
#endif
//
//
///* Allocate the output */
//
//typedef typename ScalarImageType::PixelType ScalarImagePixelType;
//typedef typename VectorImageType::PixelType VectorImagePixelType;
//
///* The first step is to take the signal and the noise data*/
//typename VectorImageType::ConstPointer s = this->GetInput();
//typename VectorImageType::Pointer noise = this->GetNoise();
//
//
///* allocate the Output file (scalar)*/
//typename ScalarImageType::Pointer output = this->GetOutput();
//output->SetBufferedRegion(output->GetRequestedRegion());
//output->Allocate();
//
//
//
//typename VectorImageType::Pointer signal=ConstPointerToPointer<VectorImageType>(s);
//
//vnl_matrix<typename VectorImageType::InternalPixelType>C;
///* Then we calculate the covariance matrix (yes is more a correlation one but the mean of the noise is supposed to be zero)*/
//C=this->calculateCovarianceMatrix();
//int nChan=noise->GetNumberOfComponentsPerPixel();
//
///* then we build the tensor image of the*/
//std::vector<typename ScalarImageType::Pointer> tmp;
//typename VectorImageType::Pointer CIFFT;
//typename ScalarImageType::Pointer tmpIm;
//
//int NP= PixelCount<VectorImageType>(signal);
//
//// typename VectorImageType::IndexType TTT;
//// TTT[0]==128;
//// TTT[1]==64;
//
//for (int t=0;t<nChan; t++){
// tmpIm=VectorImageElementAsImage<VectorImageType, ScalarImageType>(t,signal);
// tmpIm=InverseFFT<ScalarImageType>(tmpIm);
// tmpIm=multiplyImageTimesScalar<ScalarImageType>(tmpIm,sqrt((ScalarImagePixelType)NP) );
// tmp.push_back(tmpIm);
//};
//
///* compose the */
//CIFFT=composeVectorImage<ScalarImageType,VectorImageType>(tmp);
//
//
//
//
//
//itk::ImageRegionIterator<ScalarImageType> snr(output,output->GetLargestPossibleRegion());
//itk::ImageRegionIterator<VectorImageType> it(CIFFT,CIFFT->GetLargestPossibleRegion());
//
//it.GoToBegin();
//snr.GoToBegin();
//
//
//VectorImagePixelType v;
//VectorImagePixelType v2;
//// ScalarImagePixelType sMag;
//// ScalarImagePixelType nPow;
//
//
//
//
//
//vnl_vector<ScalarImagePixelType>S(nChan);
//vnl_matrix<ScalarImagePixelType> X(nChan,1);
//vnl_matrix<ScalarImagePixelType> sMag;
//vnl_matrix<ScalarImagePixelType> nPow;
//
//
//
//
//
//
//ScalarImagePixelType N= sqrt(2);
//
//
//
//
//typename vnl_matrix<ScalarImagePixelType>::iterator II;
//
//
//
//if (this->GetUseCovarianceMatrix())
//{
// while( !snr.IsAtEnd() )
// {
// v=it.Get();
//
// for (int t=0;t<v.GetSize();t++)
// {
//
// X(t,0)=v.GetElement(t);
//
// }
//
//
//// std::cout<<"X is";
//// vcl_cout<<X;
//// std::cout<<std::endl;
//
//
// sMag=(X.conjugate_transpose()*X);
//
//// sMag=(X.transpose()*X);
//
//
//
// for (II= sMag.begin(); II != sMag.end(); II++){
// *II=abs(*II)*N;
// };
//
//
//
// nPow= X.transpose()*C*X;
//
//
//// vcl_cout<<nPow;
//// std::cout<<std::endl;
// for (II= nPow.begin(); II != nPow.end(); II++){
// *II=sqrt(abs(*II));
// };
//
//// std::cout<<"after sqrt abs";
//// vcl_cout<<nPow;
//// std::cout<<std::endl;
//
// //std::cout<<"SNR"<<sMag(0,0)/nPow(0,0)<<std::endl;
// snr.Set((ScalarImagePixelType)(sMag(0,0)/nPow(0,0)));
// ++it;
// ++snr;
// }
//
//}else{
//
// try
// {
// sMag=vnl_matrix_inverse<ScalarImagePixelType>(C);
// }catch (const std::exception& e) { std::cout<<"NO"; }
//
//
//
// while( !snr.IsAtEnd() )
// {
//
// v=it.Get();
//
// for (int t=0;t<v.GetSize();t++)
// {
//
// X(t,0)=v.GetElement(t);
//
// }
//
//
// //nPow=X.transpose()*sMag*X;
//
// nPow=X.conjugate_transpose()*sMag*X;
//
// snr.Set(N*(ScalarImagePixelType)sqrt(nPow(0,0)));
//
// ++it;
// ++snr;
// }
//
//
//}
//
//
//
//
//
//}
| 20.790036 | 127 | 0.649264 | cloudmrhub-com |
36285eb7da9fe516b891787505e706fad97ac9aa | 608 | cpp | C++ | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | 120 | 2021-02-19T07:39:50.000Z | 2022-02-19T14:55:28.000Z | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | null | null | null | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | 22 | 2021-06-21T17:21:27.000Z | 2021-12-24T01:56:29.000Z | /**
@author Farheen Bano
Date 11-08-2021
Reference-
https://leetcode.com/problems/string-compression
*/
class Solution {
public:
int compress(vector<char>& chars) {
int i=0;
int index=0;
while(i<chars.size()){
int j=i;
while(j<chars.size() && chars[i]==chars[j])
j++;
chars[index++]=chars[i];
if(j-i>1){
string count=to_string(j-i);
for(char ch:count)
chars[index++]=ch;
}
i=j;
}
return index;
}
}; | 20.266667 | 55 | 0.440789 | ansumandas441 |
36294680fdab099fe86f218abc64bff6440dfe7a | 622 | cpp | C++ | ZOJ/2734-0.cpp | claviering/code | 7019d50ff2e390696bc60358d1e39d9112f332e0 | [
"WTFPL"
] | 1 | 2017-12-16T13:55:04.000Z | 2017-12-16T13:55:04.000Z | ZOJ/2734-0.cpp | claviering/code | 7019d50ff2e390696bc60358d1e39d9112f332e0 | [
"WTFPL"
] | 1 | 2021-09-03T03:00:17.000Z | 2021-09-03T03:00:17.000Z | ZOJ/2734-0.cpp | claviering/code | 7019d50ff2e390696bc60358d1e39d9112f332e0 | [
"WTFPL"
] | 1 | 2016-12-19T16:35:13.000Z | 2016-12-19T16:35:13.000Z | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
using namespace std;
int sum,ways;
int num[1010];
int value,n;
void DFS(int x)
{
if( sum == value )
{
ways++;
return ;
}
for(int i=x; i<=value; i++)
{
if( num[i] && sum + i <= value )
{
num[i]--;
sum += i;
DFS(i);
num[i]++;
sum -= i;
}
}
}
int main(void)
{
int x,y;
int pe = 0;
while( cin >> value >> n )
{
if( pe )
cout << endl;
pe = 1;
memset(num,0,sizeof(num));
sum = ways = 0;
for(int i=0; i<n; i++)
{
cin >> x >> y;
num[x] = y;
}
DFS(1);
cout << ways << endl;
}
return 0;
}
| 12.44 | 34 | 0.490354 | claviering |
362c1fc71e35832af041c75fab189a17a61b25b2 | 3,181 | hpp | C++ | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | 4 | 2019-09-17T13:11:02.000Z | 2021-02-22T15:39:15.000Z | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | null | null | null | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | 1 | 2021-02-24T00:40:03.000Z | 2021-02-24T00:40:03.000Z | /*********************************************************************
* Copyright (c) 2020 Intel Corporation
* SPDX-License-Identifier: Apache-2.0
**********************************************************************/
#ifndef YOKLM_LANGUAGE_MODEL_HPP
#define YOKLM_LANGUAGE_MODEL_HPP
#include <vector>
#include <string>
#include <utility>
#include "word_index.hpp"
#include "memory_section.hpp"
namespace yoklm {
struct UnigramNodeFormat {
float prob; // log10-prob for this node
float backoff; // log10-backoff for this node
uint64_t start_index; // starting index of the subtrie in the next trie layer
};
struct MediumLayer {
int bhiksha_total_bits;
int bhiksha_low_bits; // TODO: get rid of data duplication here
int backoff_bits; // TODO: get rid of data duplication here
size_t bhiksha_highs_count; // number of elements in bhiksha_highs
MemorySectionArray<uint64_t> bhiksha_highs;
MemorySectionBitArray bit_array; // contains bit fields: word_index, backoff, prob, bhiksha_low_bits
BitField word_field;
BitField backoff_field;
BitField prob_field;
BitField bhiksha_low_field;
};
struct LmConfig {
size_t order; // the value of n in n-gram
std::vector<uint64_t> ngram_counts; // ngram_count[k-1] = number of k-grams, vector length = order
int prob_bits; // size of quantized representation of log-probability values; guaranteed to be in [0,24]
int backoff_bits; // size of quantized representation of log-backoff values; guaranteed to be in [0,24]
std::vector<MemorySectionArray<float> > prob_quant_tables; // [k-2] for k-grams, k=2...n
std::vector<MemorySectionArray<float> > backoff_quant_tables; // [k-2] for k-grams, k=2...(n-1)
MemorySectionArray<UnigramNodeFormat> unigram_layer;
std::vector<MediumLayer> medium_layers;
//MediumLayer leaves_layer;
};
struct LmState {
LmState() {}
explicit LmState(int order) {
backoffs.reserve(order - 1);
context_words.reserve(order);
}
// Backoffs in reverse order: backoffs[0] for 1-gram, backoffs[1] for 2-gram, etc
std::vector<float> backoffs;
// Up to (order-1) last words in reverse order
std::vector<WordIndex> context_words;
};
class LanguageModel {
public:
LanguageModel() : config_() {}
void load(LmConfig config) { config_ = config; }
//float log10_p_cond(const std::vector<WordIndex>& words) const;
float log10_p_cond(WordIndex new_word, LmState& state) const;
size_t order() const { return config_.order; };
uint64_t num_words() const { return config_.ngram_counts[0]; };
private:
LmConfig config_;
// Accepts n-gram in state.words (as const, reverse order: the last word in state.words[0])
// Returns:
// * Return value (float) = raw p-value for the longest n-gram present in the LM
// * state.backoff.size(): the length of the longest n-gram present in the LM
// * state.backoff[]: state.backoff[k] if backoff for (k+1)-gram postfix
float find_ngram(LmState& state) const;
//std::pair<uint64_t, uint64_t> bhiksha_lookup(const MemorySectionArray<uint64_t>& bhiksha_highs, uint64_t index) const;
};
} // namespace yoklm
#endif // YOKLM_LANGUAGE_MODEL_HPP
| 34.576087 | 124 | 0.69255 | ivanvikhrev |
362d28d4b1b9c75eb1a13c5b8c5b409f9e5fa0d9 | 27 | cpp | C++ | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | #include "AnimismCues.hpp"
| 13.5 | 26 | 0.777778 | HfMT-ZM4 |
362dba564948c3777123e5181dc6cec927daffd1 | 1,684 | hpp | C++ | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 1 | 2015-10-21T14:22:12.000Z | 2015-10-21T14:22:12.000Z | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 2 | 2019-05-26T20:52:31.000Z | 2019-05-28T16:19:49.000Z | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 2 | 2016-11-06T14:58:37.000Z | 2019-05-26T14:03:13.000Z | #ifndef __WALD_LM_METHOD_H__
#define __WALD_LM_METHOD_H__
#include <string>
#include <vector>
#include <armadillo>
#include <besiq/method/method.hpp>
#include <besiq/stats/log_scale.hpp>
/**
* This class is responsible for executing the closed form
* wald test for a logistic regression model.
*/
class wald_lm_method
: public method_type
{
public:
/**
* Constructor.
*
* @param data Additional data required by all methods, such as
* covariates.
* @param unequal_var If true, estimates a separate variance for each cell.
*/
wald_lm_method(method_data_ptr data, bool unequal_var = false);
/**
* @see method_type::init.
*/
virtual std::vector<std::string> init();
/**
* Returns the last computed covariance matrix.
*
* @return the last computed covariance matrix.
*/
arma::mat get_last_C();
/**
* Returns the last computed beta.
*
* @return the last computed beta.
*/
arma::vec get_last_beta();
/**
* @see method_type::run.
*/
virtual double run(const snp_row &row1, const snp_row &row2, float *output);
private:
/**
* Weight for each sample.
*/
arma::vec m_weight;
/**
* Phenotype.
*/
arma::vec m_pheno;
/**
* Missing samples.
*/
arma::uvec m_missing;
/**
* Determines whether variances should be estimated separately.
*/
bool m_unequal_var;
/**
* Current covariance matrix for the betas.
*/
arma::mat m_C;
/**
* Current betas.
*/
arma::vec m_beta;
};
#endif /* End of __WALD_LM_METHOD_H__ */
| 19.811765 | 80 | 0.597387 | hoehleatsu |
1568838949b90afe711d171aa63f41971ef83329 | 4,934 | cc | C++ | chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 76 | 2020-09-02T03:05:41.000Z | 2022-03-30T04:40:55.000Z | chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 45 | 2020-09-02T03:21:37.000Z | 2022-03-31T22:19:45.000Z | chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 8 | 2020-07-22T18:49:18.000Z | 2022-02-08T10:27:16.000Z | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include <array>
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/devtools/device/devtools_android_bridge.h"
#include "chrome/browser/devtools/device/tcp_device_provider.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/prefs/pref_service.h"
#include "content/public/test/browser_test.h"
class DevToolsAndroidBridgeTest : public InProcessBrowserTest {
};
static void assign_from_callback(scoped_refptr<TCPDeviceProvider>* store,
int* invocation_counter,
scoped_refptr<TCPDeviceProvider> value) {
(*invocation_counter)++;
*store = value;
}
static std::string SetToString(const std::set<std::string>& values) {
std::ostringstream result;
std::copy(values.begin(), values.end(),
std::ostream_iterator<std::string>(result, ", "));
std::string result_string = result.str();
return result_string.substr(0, result_string.length() - 2);
}
static std::string AllTargetsString(
scoped_refptr<TCPDeviceProvider> provider) {
std::set<std::string> actual;
for (const net::HostPortPair& hostport : provider->get_targets_for_test())
actual.insert(hostport.ToString());
return SetToString(actual);
}
IN_PROC_BROWSER_TEST_F(DevToolsAndroidBridgeTest, DiscoveryListChanges) {
Profile* profile = browser()->profile();
PrefService* service = profile->GetPrefs();
service->ClearPref(prefs::kDevToolsTCPDiscoveryConfig);
service->SetBoolean(prefs::kDevToolsDiscoverTCPTargetsEnabled, true);
DevToolsAndroidBridge* bridge =
DevToolsAndroidBridge::Factory::GetForProfile(profile);
scoped_refptr<TCPDeviceProvider> provider;
int called = 0;
bridge->set_tcp_provider_callback_for_test(
base::BindRepeating(assign_from_callback, &provider, &called));
EXPECT_LT(0, called);
EXPECT_NE(nullptr, provider);
EXPECT_STREQ("localhost:9222, localhost:9229",
AllTargetsString(provider).c_str());
int invocations = called;
base::ListValue list;
list.Append("somehost:2000");
service->Set(prefs::kDevToolsTCPDiscoveryConfig, list);
EXPECT_LT(invocations, called);
EXPECT_NE(nullptr, provider);
EXPECT_STREQ("somehost:2000", AllTargetsString(provider).c_str());
invocations = called;
list.ClearList();
service->Set(prefs::kDevToolsTCPDiscoveryConfig, list);
EXPECT_LT(invocations, called);
EXPECT_EQ(nullptr, provider);
invocations = called;
list.Append("b:1");
list.Append("c:2");
list.Append("<not really a good address.");
list.Append("d:3");
list.Append("c:2");
service->Set(prefs::kDevToolsTCPDiscoveryConfig, list);
EXPECT_LT(invocations, called);
EXPECT_NE(nullptr, provider);
EXPECT_STREQ("b:1, c:2, d:3", AllTargetsString(provider).c_str());
}
IN_PROC_BROWSER_TEST_F(DevToolsAndroidBridgeTest, DefaultValues) {
Profile* profile = browser()->profile();
PrefService* service = profile->GetPrefs();
DevToolsAndroidBridge::Factory::GetForProfile(profile);
service->ClearPref(prefs::kDevToolsDiscoverTCPTargetsEnabled);
service->ClearPref(prefs::kDevToolsTCPDiscoveryConfig);
const base::ListValue* targets =
service->GetList(prefs::kDevToolsTCPDiscoveryConfig);
EXPECT_NE(nullptr, targets);
EXPECT_EQ(2ul, targets->GetList().size());
std::set<std::string> actual;
for (size_t i = 0; i < targets->GetList().size(); i++) {
std::string value;
targets->GetString(i, &value);
actual.insert(value);
}
EXPECT_STREQ("localhost:9222, localhost:9229", SetToString(actual).c_str());
EXPECT_TRUE(service->GetBoolean(prefs::kDevToolsDiscoverTCPTargetsEnabled));
}
IN_PROC_BROWSER_TEST_F(DevToolsAndroidBridgeTest, TCPEnableChange) {
Profile* profile = browser()->profile();
PrefService* service = profile->GetPrefs();
service->ClearPref(prefs::kDevToolsTCPDiscoveryConfig);
service->ClearPref(prefs::kDevToolsDiscoverTCPTargetsEnabled);
DevToolsAndroidBridge* bridge =
DevToolsAndroidBridge::Factory::GetForProfile(profile);
scoped_refptr<TCPDeviceProvider> provider;
int called = 0;
bridge->set_tcp_provider_callback_for_test(
base::BindRepeating(assign_from_callback, &provider, &called));
EXPECT_NE(nullptr, provider);
service->SetBoolean(prefs::kDevToolsDiscoverTCPTargetsEnabled, true);
EXPECT_NE(nullptr, provider);
EXPECT_STREQ("localhost:9222, localhost:9229",
AllTargetsString(provider).c_str());
service->SetBoolean(prefs::kDevToolsDiscoverTCPTargetsEnabled, false);
EXPECT_EQ(nullptr, provider);
}
| 33.564626 | 78 | 0.741184 | zealoussnow |
156a027c2be706ad495539c53f1f7e14bdb27d95 | 5,914 | cpp | C++ | IDA/FUN_0001d6e0.cpp | Mochongli/evil-mhyprot-cli | 628470626532d663a1f557b5048b319266f70f75 | [
"MIT"
] | 91 | 2020-10-18T07:59:47.000Z | 2022-03-08T18:34:04.000Z | IDA/FUN_0001d6e0.cpp | Game-Academy-of-Sciences/evil-mhyprot-cli | ff4e1413f7e878fa0dbc4ebe724830ac6a5db3e1 | [
"MIT"
] | 2 | 2021-08-29T22:38:30.000Z | 2021-12-16T20:32:38.000Z | IDA/FUN_0001d6e0.cpp | Game-Academy-of-Sciences/evil-mhyprot-cli | ff4e1413f7e878fa0dbc4ebe724830ac6a5db3e1 | [
"MIT"
] | 36 | 2020-10-18T17:13:54.000Z | 2022-03-30T10:16:00.000Z |
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
//
// Pseudocode
//
undefined8 IOCTL_FUN_0001d6e0(undefined8 param_1,longlong param_2)
{
uint uVar1;
uint uVar2;
uint uVar3;
ulonglong *puVar4;
int iVar5;
undefined8 uVar6;
longlong lVar7;
ulonglong uVar8;
ulonglong *puVar9;
ulonglong uVar10;
uint local_res10 [2];
ulonglong *local_res18;
undefined8 local_198 [48];
lVar7 = *(longlong *)(param_2 + 0xb8);
puVar4 = *(ulonglong **)(param_2 + 0x18);
uVar1 = *(uint *)(lVar7 + 0x18);
uVar2 = *(uint *)(lVar7 + 0x10);
uVar3 = *(uint *)(lVar7 + 8);
uVar10 = (ulonglong)uVar3;
*(undefined8 *)(param_2 + 0x38) = 0;
if (uVar1 == 0x80104000) {
uVar6 = FUN_000121ec((longlong)puVar4,uVar2);
_DAT_0001a110 = (int)uVar6;
*(uint *)puVar4 = -(uint)(_DAT_0001a110 != 0) & 1;
LAB_0001d75c:
uVar10 = 4;
goto LAB_0001da4f;
}
if (((uVar1 + 0x7feec000 & 0xfffcffff) == 0) && (uVar1 != 0x80134000)) goto LAB_0001da4f;
if (uVar1 == 0x80134000) {
lVar7 = FUN_00012314();
*(int *)puVar4 = (int)lVar7;
goto LAB_0001d75c;
}
if (uVar1 == 0x82054000) {
uVar8 = FUN_000126d0(*(uint *)puVar4,(longlong)(uint *)((longlong)puVar4 + 4),
*(uint *)((longlong)puVar4 + 4));
iVar5 = (int)uVar8;
}
else {
if (uVar1 == 0x83024000) {
uVar8 = FUN_000162ec((longlong)puVar4 + 4,(int *)puVar4);
iVar5 = (int)uVar8;
}
else {
if (uVar1 == 0x83074000) {
uVar6 = FUN_00015f18();
iVar5 = (int)uVar6;
}
else {
/* MHYPROT_IOCTL_READ_KERNEL_MEMORY */
if (uVar1 != 0x83064000) {
if (uVar1 == 0x82074000) {
if (((uVar2 < 4) || (uVar3 < 0x38)) || (puVar4 == (ulonglong *)0x0)) goto LAB_0001da4f;
puVar9 = (ulonglong *)ExAllocatePoolWithTag(1,uVar10,0x4746544d);
*puVar9 = SUB168(ZEXT816(0xaaaaaaaaaaaaaaab) * ZEXT816(uVar10 - 8) >> 0x45,0) &
0xffffffff;
uVar8 = FUN_000132b0((uint *)puVar4,puVar9);
*(int *)(param_2 + 0x30) = (int)uVar8;
if ((int)uVar8 < 0) {
uVar10 = 8;
*puVar4 = *puVar9;
}
else {
uVar8 = *puVar9 * 0x30 + 8;
LAB_0001d842:
*(ulonglong *)(param_2 + 0x38) = uVar8;
FUN_000175c0(puVar4,puVar9,uVar8);
}
LAB_0001d85b:
uVar6 = 0x4746544d;
}
else {
if (uVar1 == 0x82104000) {
if (((uVar2 < 0x28) || (uVar3 < 0x20)) || (puVar4 == (ulonglong *)0x0))
goto LAB_0001da4f;
puVar9 = (ulonglong *)ExAllocatePoolWithTag(1,uVar10,0x4746544d);
*(int *)puVar9 =
(int)SUB168(ZEXT816(0xaaaaaaaaaaaaaaab) * ZEXT816(uVar10 - 4) >> 0x44,0);
uVar6 = FUN_0001377c((longlong)puVar4,(uint *)puVar9);
*(int *)(param_2 + 0x30) = (int)uVar6;
if (-1 < (int)uVar6) {
uVar8 = (ulonglong)*(uint *)puVar9 * 0x18 + 4;
goto LAB_0001d842;
}
uVar10 = 4;
*(uint *)puVar4 = *(uint *)puVar9;
goto LAB_0001d85b;
}
if (uVar1 == 0x82094000) {
*(undefined4 *)puVar4 = 0;
goto LAB_0001da4f;
}
/* MHYPROT_IOCTL_INITIALIZE */
if (uVar1 == 0x80034000) {
if (uVar2 == 0x10) {
puVar4[1] = puVar4[1] ^ 0xebbaaef4fff89042;
*puVar4 = *puVar4 ^ puVar4[1];
if (*(int *)((longlong)puVar4 + 4) == -0x45145114) {
FUN_000151a8(*(undefined4 *)puVar4);
if ((int)DAT_0001a108 == 0) {
FUN_0001301c((longlong *)&DAT_0001a0e8,puVar4[1]);
lVar7 = 7;
do {
uVar10 = FUN_00012eb0((uint **)&DAT_0001a0e8);
*puVar4 = uVar10;
DAT_0001a108._0_4_ = 1;
lVar7 = lVar7 + -1;
} while (lVar7 != 0);
uVar10 = 8;
}
else {
uVar10 = 0;
}
}
}
goto LAB_0001da4f;
}
if (uVar1 == 0x81134000) goto LAB_0001da4f;
if (uVar1 == 0x81144000) {
uVar10 = FUN_00016654(*(uint *)puVar4,(longlong)local_198);
iVar5 = (int)uVar10;
if (-1 < iVar5) {
uVar10 = (ulonglong)(uint)(iVar5 * 0x18);
if (0 < iVar5) {
FUN_000175c0(puVar4,local_198,(longlong)iVar5 * 0x18);
}
goto LAB_0001da4f;
}
uVar10 = 4;
goto LAB_0001d7c1;
}
local_res18 = (ulonglong *)0x0;
local_res10[0] = 0;
uVar8 = IOCTL_FUN_0001d000(uVar1,puVar4,uVar2,&local_res18,(int *)local_res10);
puVar9 = local_res18;
if ((char)uVar8 == '\0') goto LAB_0001da4f;
if (uVar3 < local_res10[0]) {
local_res10[0] = uVar3;
}
if ((local_res18 == (ulonglong *)0x0) || (local_res10[0] == 0)) goto LAB_0001da4f;
uVar10 = (ulonglong)local_res10[0];
FUN_000175c0(puVar4,local_res18,(ulonglong)local_res10[0]);
uVar6 = 0;
}
ExFreePoolWithTag(puVar9,uVar6);
goto LAB_0001da4f;
}
uVar6 = FUN_000163a8((undefined4 *)((longlong)puVar4 + 4),*puVar4,*(uint *)(puVar4 + 1));
iVar5 = (int)uVar6;
}
}
}
LAB_0001d7c1:
*(int *)puVar4 = iVar5;
LAB_0001da4f:
*(ulonglong *)(param_2 + 0x38) = uVar10;
*(undefined4 *)(param_2 + 0x30) = 0;
IofCompleteRequest(param_2,0);
return 0;
}
| 34.383721 | 99 | 0.49442 | Mochongli |
156a0e6602ed4e0182c7a7a546ca88d2ef20fe82 | 5,671 | cpp | C++ | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 32 | 2021-07-21T14:55:10.000Z | 2022-03-09T22:07:20.000Z | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 1 | 2021-07-21T18:42:39.000Z | 2021-07-21T18:45:53.000Z | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 29 | 2021-07-21T14:56:45.000Z | 2022-03-29T20:57:25.000Z | #include "../hooks.hpp"
#include <cstdio>
#include "../../../source engine/sdk.hpp"
#include "../../features/bt.hpp"
#include "../../../engine/utilities/config.hpp"
#include "../../../source engine/classes/key_values.hpp"
void __fastcall hooks::draw_model_execute( void* ecx, void* edx, void* ctx, void* state, model_render_info_t* info, matrix_t* matrix )
{
auto original = [ & ]( matrix_t* _matrix )
{
dme_holy_hook.call_original<void>( ecx, edx, ctx, state, info, _matrix );
};
if ( interfaces::model_render->is_forced_material_override( ) )
{
original( matrix );
return;
}
static auto flat = interfaces::material_system->find_material( xor ( "debug/debugdrawflat" ) );
static auto textured = interfaces::material_system->find_material( xor ( "debug/debugambientcube" ) );
static i_material* mat = nullptr;
switch ( *config::get<int>( crc( "esp:chams:material" ) ) )
{
case 0: mat = textured; break;
case 1: mat = flat; break;
}
if ( mat == textured )
{
static key_values* kv = nullptr;
if ( !kv )
{
kv = static_cast< key_values* >( malloc( 36 ) );
kv->init( xor ( "VertexLitGeneric" ) );
}
else
{
static bool something_changed = true;
color clr( *config::get<color>( crc( "esp:chams:reflectivity_clr" ) ) );
static color old_clr = clr;
float reflectivity = *config::get<float>( crc( "esp:chams:reflectivity" ) );
static float old_reflectivity = reflectivity;
float pearlescent = *config::get<float>( crc( "esp:chams:pearlescent" ) );
static float old_pearlescent = pearlescent;
float shine = *config::get<float>( crc( "esp:chams:shine" ) );
static float old_shine = shine;
float rim = *config::get<float>( crc( "esp:chams:rim" ) );
static float old_rim = rim;
if ( old_clr != clr ||
old_reflectivity != reflectivity ||
old_pearlescent != pearlescent ||
old_shine != shine )
{
something_changed = true;
}
if ( something_changed )
{
kv->set_string( "$basetexture", "" );
// reflectivity
{
char $envmaptint[ 64 ];
sprintf( $envmaptint, "[%f %f %f]", float( clr.r / 255.f ) * reflectivity / 100.f, float( clr.g / 255.f ) * reflectivity / 100.f, float( clr.b / 255.f ) * reflectivity / 100.f );
kv->set_string( "$envmaptint", $envmaptint );
kv->set_string( "$envmap", "env_cubemap" );
}
// pearlescence
{
char $pearlescent[ 64 ];
sprintf( $pearlescent, "%f", pearlescent );
kv->set_string( "$pearlescent", $pearlescent );
}
// shine
{
kv->set_int( "$phong", 1 );
kv->set_int( "$phongexponent", 15 );
kv->set_int( "$normalmapalphaenvmask", 1 );
char $phongboost[ 64 ];
sprintf( $phongboost, "[%f %f %f]", shine / 100.f, shine / 100.f, shine / 100.f );
kv->set_string( "$phongboost", $phongboost );
kv->set_string( "$phongfresnelranges", "[.5 .5 1]" );
kv->set_int( "$BasemapAlphaPhongMask", 1 );
}
// rim
{
kv->set_int( "$rimlight", 1 );
kv->set_int( "$rimlightexponent", 2 );
char $rimlightboost[ 64 ];
sprintf( $rimlightboost, "%f", rim / 100.f );
kv->set_string( "$rimlightboost", $rimlightboost );
}
mat->set_shader_and_params( kv );
old_clr = clr;
old_reflectivity = reflectivity;
old_pearlescent = pearlescent;
old_shine = shine; // alpha ty kurwa idioto
something_changed = false;
}
}
}
if ( strstr( info->model->name, xor ( "shadow" ) ) != nullptr )
{ // fucking shadows are ugly anyways smfh
return;
}
auto local = interfaces::entity_list->get<player_t>( interfaces::engine->get_local_player( ) );
if ( local && info && info->entity_index && info->entity_index < 65 )
{
if ( strstr( info->model->name, xor ( "models/player" ) ) != nullptr )
{
[ & ]( )
{
auto ent = interfaces::entity_list->get<player_t>( info->entity_index );
if ( !ent )
return;
if ( !ent->health( ) )
return;
if ( ent->team( ) == local->team( ) )
return;
auto record = backtrack::find_last_record( info->entity_index );
if ( record.has_value( ) && *config::get<bool>( crc( "ass:backtrack" ) ) && *config::get<bool>( crc( "esp:chams:backtrack" ) ) )
{
if ( std::fabs( ( ent->abs_origin( ) - record.value( ).m_abs_origin ).length( ) ) > 2.5f )
{
color clr( *config::get<color>( crc( "ass:backtrack:color" ) ) );
flat->set_color( clr.r, clr.g, clr.b );
flat->set_alpha( clr.a );
flat->set_flag( ( 1 << 15 ), false );
interfaces::model_render->force_override_material( flat );
original( record.value( ).m_matrix );
interfaces::model_render->force_override_material( nullptr );
}
}
if ( *config::get<bool>( crc( "esp:chams:invisible" ) ) )
{
color clr( *config::get<color>( crc( "esp:chams:invisible_color" ) ) );
mat->set_color( clr.r, clr.g, clr.b );
mat->set_alpha( clr.a );
mat->set_flag( ( 1 << 15 ), true );
interfaces::model_render->force_override_material( mat );
original( matrix );
if ( !*config::get<bool>( crc( "esp:chams:visible" ) ) )
{
interfaces::model_render->force_override_material( nullptr );
original( matrix );
}
}
if ( *config::get<bool>( crc( "esp:chams:visible" ) ) )
{
color clr( *config::get<color>( crc( "esp:chams:color" ) ) );
mat->set_color( clr.r, clr.g, clr.b );
mat->set_alpha( clr.a );
mat->set_flag( ( 1 << 15 ), false );
interfaces::model_render->force_override_material( mat );
original( matrix );
}
}( );
}
}
original( matrix );
interfaces::model_render->force_override_material( nullptr );
} | 28.786802 | 183 | 0.603245 | excludes |
156c3c7e30f0ba52484e4ff5663aaa3c5bc6c8ad | 1,436 | cpp | C++ | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | null | null | null | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | 2 | 2020-06-13T11:48:59.000Z | 2020-06-13T11:56:24.000Z | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | null | null | null | #include "scenes/menu.hpp"
#include "core/scene_manager.hpp"
#include <iostream>
const char* Menu::type = "Menu";
const bool Menu::good = GameScene::register_class<Menu>(Menu::type);
Menu::Menu(salmon::MapRef map, SceneManager* scene_manager) :
GameScene(map,scene_manager) {}
void Menu::init() {
m_scene_manager->set_linear_filtering(false);
m_scene_manager->next_scene("stage1.tmx");
m_scene_manager->set_game_resolution(960,720);
m_scene_manager->set_fullscreen(false);
m_scene_manager->set_window_size(960,720);
// Preload whole data folder
m_scene_manager->add_preload_directory("");
m_scene_manager->preload(50);
// Initializes all characters in scene
GameScene::init();
// Setup member vars here | example: put(m_speed, "m_speed");
// Clear data accessed via put
get_data().clear();
}
void Menu::update() {
// Add scene logic here
salmon::InputCacheRef input = get_input_cache();
if(input.just_pressed("Escape")) {
m_scene_manager->shutdown();
}
// Calls update on all characters in scene
GameScene::update();
}
void Menu::button_pressed(std::string id) {
if(id == "Quit") {
m_scene_manager->shutdown();
}
else if(id == "Start") {
// Load next scene file
// m_scene_manager->next_scene("stage1.tmx");
}
else {
std::cerr << "Button type: " << id << " is unrecognized!\n";
}
}
| 26.592593 | 68 | 0.655292 | AgoutiGames |
156ed93956ad72fe0ab6b04e54915020ac764ab4 | 5,412 | cpp | C++ | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | 8 | 2020-04-26T11:48:29.000Z | 2022-02-23T15:13:50.000Z | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | null | null | null | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | 1 | 2021-05-13T16:37:24.000Z | 2021-05-13T16:37:24.000Z | #include <map>
#include <Engine/GameSettings.hpp>
#include <Engine/Logger.hpp>
#include <Engine/OGLGame.hpp>
#include <Engine/Sprite.hpp>
class ASGENetGame : public ASGE::OGLGame
{
public:
explicit ASGENetGame(const ASGE::GameSettings& settings) :
OGLGame(settings)
{
inputs->use_threads = false;
inputs->addCallbackFnc(ASGE::EventType::E_KEY, &ASGENetGame::keyHandler, this);
bg = renderer->createUniqueSprite();
bg->loadTexture("/data/FHD.png");
bg->xPos(-512*0.25F);
robot = renderer->createUniqueSprite();
robot->loadTexture("/data/character_zombie_idle.png");
robot->xPos((robot->width() * 0.5F));
robot->yPos(768/2.0F - (robot->height() * 0.5F));
zombie = renderer->createUniqueSprite();
zombie->loadTexture("/data/character_zombie_idle.png");
zombie->xPos(1024/2.0F - (zombie->width() * 0.5F));
zombie->yPos(768/2.0F - (zombie->height() * 0.5F));
lh_camera.resize(1024 / 2.0F, 768);
rh_camera.resize(1024 / 2.0F, 768);
lh_camera.lookAt({1024 * 0.25F, 768 / 2.0F});
rh_camera.lookAt({1024 * 0.50F, 768 / 2.0F});
toggleFPS();
}
~ASGENetGame() override = default;
ASGENetGame(const ASGENetGame&) = delete;
ASGENetGame& operator=(const ASGENetGame&) = delete;
private:
std::map<int, bool> keys;
std::map<int, bool> buttons;
void keyHandler(ASGE::SharedEventData data)
{
const auto* key_event = dynamic_cast<const ASGE::KeyEvent*>(data.get());
auto key = key_event->key;
auto action = key_event->action;
if (action == ASGE::KEYS::KEY_PRESSED)
{
if (key == ASGE::KEYS::KEY_8)
{
renderer->setWindowedMode(ASGE::GameSettings::WindowMode::BORDERLESS_FULLSCREEN);
}
if (key == ASGE::KEYS::KEY_9)
{
renderer->setWindowedMode(ASGE::GameSettings::WindowMode::WINDOWED);
}
keys[key] = true;
}
if (action == ASGE::KEYS::KEY_RELEASED)
{
keys[key] = false;
}
}
void update(const ASGE::GameTime& us) override
{
if (auto gamepad_data = inputs->getGamePad(0); gamepad_data.is_connected)
{
for( int i=0; i<gamepad_data.no_of_buttons; ++i)
{
if(gamepad_data.buttons[i] == true)
{
Logging::ERRORS("button event" + std::to_string(i));
}
}
}
if(keys[ASGE::KEYS::KEY_A])
{
robot->xPos(robot->xPos() -5);
// rh_camera.translateX(-5);
}
if(keys[ASGE::KEYS::KEY_D])
{
robot->xPos(robot->xPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_W])
{
robot->yPos(robot->yPos() -5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_S])
{
robot->yPos(robot->yPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_LEFT])
{
zombie->xPos(zombie->xPos() -5);
// rh_camera.translateX(-5);
}
if(keys[ASGE::KEYS::KEY_RIGHT])
{
zombie->xPos(zombie->xPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_UP])
{
zombie->yPos(zombie->yPos() -5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_DOWN])
{
zombie->yPos(zombie->yPos() +5);
// rh_camera.translateX(+5);
}
lh_camera.lookAt(
{
robot->xPos() + robot->width() * 0.5F,
robot->yPos() + robot->height() * 0.5F });
rh_camera.lookAt(
{
zombie->xPos() + zombie->width() * 0.5F,
zombie->yPos() + zombie->height() * 0.5F });
lh_camera.update(us);
rh_camera.update(us);
};
void render(const ASGE::GameTime& us) override
{
renderer->setViewport({0, 0, 1024/2, 768});
renderer->setProjectionMatrix(lh_camera.getView());
renderer->render(*bg);
renderer->render(*robot);
renderer->render(*zombie);
auto view = rh_camera.getView();
renderer->setViewport({1024/2, 0, 1024/2, 768});
renderer->setProjectionMatrix(view);
renderer->render(*bg);
renderer->render(*robot);
renderer->render(*zombie);
ASGE::Text camera1 = ASGE::Text{ renderer->getDefaultFont(), "CAMERA1" };
camera1.setPositionX(1024 * 0.25F - (camera1.getWidth() * 0.5F));
camera1.setPositionY(30);
ASGE::Text camera2 = ASGE::Text{ renderer->getDefaultFont(), "CAMERA2" };
camera2.setPositionX(1024 * 0.75F - (camera2.getWidth() * 0.5F));
camera2.setPositionY(30);
renderer->setViewport({0, 0, 1024, 768});
renderer->setProjectionMatrix(0, 1024, 0, 768);
renderer->render(camera1);
renderer->render(camera2);
};
private:
int key_callback_id = -1; /**< Key Input Callback ID. */
std::unique_ptr<ASGE::Sprite> bg = nullptr;
std::unique_ptr<ASGE::Sprite> zombie = nullptr;
std::unique_ptr<ASGE::Sprite> robot = nullptr;
ASGE::Camera lh_camera{};
ASGE::Camera rh_camera{};
};
int main(int /*argc*/, char* /*argv*/[])
{
ASGE::GameSettings game_settings;
game_settings.window_title = "ASGEGame";
game_settings.window_width = 1024;
game_settings.window_height = 768;
game_settings.mode = ASGE::GameSettings::WindowMode::WINDOWED;
game_settings.fixed_ts = 60;
game_settings.fps_limit = 60;
game_settings.msaa_level = 1;
game_settings.vsync = ASGE::GameSettings::Vsync::DISABLED;
Logging::INFO("Launching Game!");
ASGENetGame game(game_settings);
game.run();
return 0;
}
| 27.612245 | 89 | 0.610495 | Alexthehuman3 |
1572a406156d05b5be659568d497858d6da053fc | 951 | cpp | C++ | source/Main.cpp | CookiePLMonster/YAMP | 4f49d0702d7d93e3cf679d5cbe9012131f8e9a4d | [
"MIT"
] | 15 | 2021-06-01T19:14:06.000Z | 2022-03-31T18:42:28.000Z | source/Main.cpp | CookiePLMonster/YAMP | 4f49d0702d7d93e3cf679d5cbe9012131f8e9a4d | [
"MIT"
] | 1 | 2021-06-02T12:48:12.000Z | 2021-06-07T21:49:11.000Z | source/Main.cpp | CookiePLMonster/YAMP | 4f49d0702d7d93e3cf679d5cbe9012131f8e9a4d | [
"MIT"
] | 2 | 2021-12-11T21:46:50.000Z | 2022-01-18T21:20:03.000Z | #define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "RenderWindow.h"
#include "Y6-VF5FS.h"
#include "imgui/imgui.h"
#include "wil/com.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
// TODO: This is a hack, currently shutdown crashes because of mismatched allocators
// Once this is handled, remove this
auto shutdownHack = wil::scope_exit([] { TerminateProcess(GetCurrentProcess(), 0); });
auto coinit = wil::CoInitializeEx(COINIT_MULTITHREADED);
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = nullptr;
io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
HMODULE dll = Y6::VF5FS::LoadDLL();
if (dll == nullptr)
{
// TODO: Show a native error message about game DLL not found
return -1;
}
Y6::VF5FS::PreInitialize();
RenderWindow window(hInstance, dll, nShowCmd);
Y6::VF5FS::Run(window);
return 0;
} | 25.026316 | 95 | 0.723449 | CookiePLMonster |
15743c4d3608a7c308708ba8361f4a10efa99cec | 692 | cpp | C++ | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | #include <stdio.h>
#include <ctype.h>
#include <string.h>
struct Product {
char ime[100];
float cena;
float kolicina;
};
typedef struct Product Product;
int main() {
// Product p;
// readProduct(&p);
// printProduct(p);
Product p[100];
int n, i;
float vkupno, total = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %f %f", &p[i].ime, &p[i].cena, &p[i].kolicina);
}
for (i = 0; i < n; i++) {
vkupno = (p[i].cena) * (p[i].kolicina);
total += vkupno;
printf("%d. %s\t%.2f x %.1f = %.2f \n", i+1, p[i].ime, p[i].cena, p[i].kolicina, vkupno);
}
printf("Total: %.2f", total);
return 0;
}
| 18.702703 | 97 | 0.492775 | LjupcheD14 |
1574697262692c84ffdfca80b6206837b0b7ebcd | 452 | hpp | C++ | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | 1 | 2022-02-02T21:41:59.000Z | 2022-02-02T21:41:59.000Z | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | null | null | null | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | 2 | 2022-02-01T12:59:57.000Z | 2022-03-05T12:50:27.000Z | #ifndef LAND_HPP
#define LAND_HPP
#include "cards/Card.hpp"
#include <string>
/**
* @brief A class that represent a land.
*/
class Land : public Card
{
public:
Land();
Land(const Land& other) = default;
virtual ~Land();
Land& operator=(const Land& other) = default;
virtual Type get_type() const override;
virtual std::string get_full_type() const override;
virtual Cost get_cost() const override;
virtual void print() const;
};
#endif
| 16.740741 | 52 | 0.705752 | angeluriot |
157d4409d04beef2c70f721cd2e0e9ed106de6f5 | 3,551 | hpp | C++ | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | 19 | 2020-12-04T01:50:52.000Z | 2022-03-27T18:18:50.000Z | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | 5 | 2021-02-09T21:21:35.000Z | 2022-01-28T09:50:20.000Z | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | null | null | null | #pragma once
#include "nanovg/nanovg.h"
#include "nanovg/deko3d/dk_renderer.hpp"
#include <switch.h>
#include <cstdint>
#include <vector>
#include <string>
#include <future>
#include <mutex>
#include <optional>
#include <functional>
namespace tj {
using AppID = std::uint64_t;
enum class MenuMode { LIST, CONFIRM, PROGRESS };
struct Controller final {
// these are tap only
bool A;
bool B;
bool X;
bool Y;
bool L;
bool R;
bool L2;
bool R2;
bool START;
bool SELECT;
// these can be held
bool LEFT;
bool RIGHT;
bool UP;
bool DOWN;
static constexpr int MAX = 1000;
static constexpr int MAX_STEP = 250;
int step = 50;
int counter = 0;
void UpdateButtonHeld(bool& down, bool held);
};
struct AppEntry final {
std::string name;
std::string author;
std::string display_version;
std::size_t size_nand;
std::size_t size_sd;
std::size_t size_total;
AppID id;
int image;
bool selected{false};
};
struct NsDeleteData final {
std::vector<AppID> entries;
std::function<void(bool)> del_cb; // called when deleted an entry
std::function<void(void)> done_cb; // called when finished
};
void NsDeleteAppsAsync(const NsDeleteData& data);
class App final {
public:
App();
~App();
void Loop();
private:
NVGcontext* vg{nullptr};
std::vector<AppEntry> entries;
std::vector<AppID> delete_entries;
PadState pad{};
Controller controller{};
std::size_t nand_storage_size_total{};
std::size_t nand_storage_size_used{};
std::size_t nand_storage_size_free{};
std::size_t sdcard_storage_size_total{};
std::size_t sdcard_storage_size_used{};
std::size_t sdcard_storage_size_free{};
std::future<void> async_thread;
std::mutex mutex{};
std::size_t delete_index{}; // mutex locked
bool finished_deleting{false}; // mutex locked
// this is just bad code, ignore it
static constexpr float BOX_HEIGHT{120.f};
float yoff{130.f};
float ypos{130.f};
std::size_t start{0};
std::size_t delete_count{0};
std::size_t index{}; // where i am in the array
MenuMode menu_mode{MenuMode::LIST};
bool quit{false};
enum class SortType {
Alpha_AZ,
Alpha_ZA,
Size_BigSmall,
Size_SmallBig,
MAX,
};
uint8_t sort_type{static_cast<uint8_t>(SortType::Size_BigSmall)};
void Draw();
void Update();
void Poll();
bool Scan(); // called on init
void Sort();
const char* GetSortStr();
void UpdateList();
void UpdateConfirm();
void UpdateProgress();
void DrawBackground();
void DrawList();
void DrawConfirm();
void DrawProgress();
private: // from nanovg decko3d example by adubbz
static constexpr unsigned NumFramebuffers = 2;
static constexpr unsigned StaticCmdSize = 0x1000;
dk::UniqueDevice device;
dk::UniqueQueue queue;
std::optional<CMemPool> pool_images;
std::optional<CMemPool> pool_code;
std::optional<CMemPool> pool_data;
dk::UniqueCmdBuf cmdbuf;
CMemPool::Handle depthBuffer_mem;
CMemPool::Handle framebuffers_mem[NumFramebuffers];
dk::Image depthBuffer;
dk::Image framebuffers[NumFramebuffers];
DkCmdList framebuffer_cmdlists[NumFramebuffers];
dk::UniqueSwapchain swapchain;
DkCmdList render_cmdlist;
std::optional<nvg::DkRenderer> renderer;
void createFramebufferResources();
void destroyFramebufferResources();
void recordStaticCommands();
};
} // namespace tj
| 23.673333 | 69 | 0.669952 | ITotalJustice |
157f4ffda5abfd9ec17ec1b3af5f4cbcb1f9a4ad | 237 | hpp | C++ | server/api/include/irods/rsRegColl.hpp | aghsmith/irods | 31d48a47a4942df688da94b30aa8a5b5210261bb | [
"BSD-3-Clause"
] | 1 | 2022-03-08T13:00:56.000Z | 2022-03-08T13:00:56.000Z | server/api/include/irods/rsRegColl.hpp | selroc/irods | d232c7f3e0154cacc3a115aa50e366a98617b126 | [
"BSD-3-Clause"
] | null | null | null | server/api/include/irods/rsRegColl.hpp | selroc/irods | d232c7f3e0154cacc3a115aa50e366a98617b126 | [
"BSD-3-Clause"
] | null | null | null | #ifndef RS_REG_COLL_HPP
#define RS_REG_COLL_HPP
#include "irods/rcConnect.h"
#include "irods/dataObjInpOut.h"
int rsRegColl( rsComm_t *rsComm, collInp_t *regCollInp );
int _rsRegColl( rsComm_t *rsComm, collInp_t *regCollInp );
#endif
| 21.545455 | 58 | 0.78481 | aghsmith |
158048dd9132dc81d9f1e3399c80205f0f0a0aed | 16,785 | cpp | C++ | gdal/frmts/pcidsk/sdk/blockdir/blockdir.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | 18 | 2021-01-27T00:07:35.000Z | 2022-03-25T22:20:13.000Z | gdal/frmts/pcidsk/sdk/blockdir/blockdir.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | null | null | null | gdal/frmts/pcidsk/sdk/blockdir/blockdir.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | null | null | null | /******************************************************************************
*
* Purpose: Block directory API.
*
******************************************************************************
* Copyright (c) 2011
* PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada.
*
* 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 "blockdir/blockdir.h"
#include "blockdir/blocklayer.h"
#include "blockdir/blockfile.h"
#include "core/pcidsk_utils.h"
#include "pcidsk_exception.h"
#include <sstream>
#include <cstring>
#include <cassert>
#include <algorithm>
using namespace PCIDSK;
/************************************************************************/
/* BlockDir() */
/************************************************************************/
/**
* Constructor.
*
* @param poFile The associated file object.
* @param nSegment The segment of the block directory.
*/
BlockDir::BlockDir(BlockFile * poFile, uint16 nSegment)
: mpoFile(poFile),
mnSegment(nSegment),
mnVersion(0),
mchEndianness(BigEndianSystem() ? 'B' : 'L'),
mbNeedsSwap(false),
mnValidInfo(0),
mbModified(false),
mbOnDisk(true)
{
assert(poFile && nSegment != INVALID_SEGMENT);
mpoFreeBlockLayer = nullptr;
}
/************************************************************************/
/* BlockDir() */
/************************************************************************/
/**
* Constructor.
*
* @param poFile The associated file object.
* @param nSegment The segment of the block directory.
* @param nVersion The version of the block directory.
*/
BlockDir::BlockDir(BlockFile * poFile, uint16 nSegment, uint16 nVersion)
: mpoFile(poFile),
mnSegment(nSegment),
mnVersion(nVersion),
mchEndianness(BigEndianSystem() ? 'B' : 'L'),
mbNeedsSwap(false),
mnValidInfo(0),
mbModified(true),
mbOnDisk(false)
{
assert(poFile && nSegment != INVALID_SEGMENT);
mpoFreeBlockLayer = nullptr;
}
/************************************************************************/
/* ~BlockDir() */
/************************************************************************/
/**
* Destructor.
*/
BlockDir::~BlockDir(void)
{
for (size_t iLayer = 0; iLayer < moLayerList.size(); iLayer++)
delete moLayerList[iLayer];
delete mpoFreeBlockLayer;
delete mpoFile;
}
/************************************************************************/
/* Sync() */
/************************************************************************/
/**
* Syncronizes the block directory to disk.
*/
void BlockDir::Sync(void)
{
if (!mbModified)
return;
if (!mpoFile->GetUpdatable())
return;
if (!IsValid())
{
ThrowPCIDSKException("Failed to save: %s",
mpoFile->GetFilename().c_str());
}
WriteDir();
mbModified = false;
}
/************************************************************************/
/* GetFile() */
/************************************************************************/
/**
* Gets the associated file of the block directory.
*
* @return The associated file of the block directory.
*/
BlockFile * BlockDir::GetFile(void) const
{
return mpoFile;
}
/************************************************************************/
/* GetSegmentIndex() */
/************************************************************************/
/**
* Gets the index of the block directory segment.
*
* @return The index of the block directory segment.
*/
uint16 BlockDir::GetSegmentIndex(void) const
{
return mnSegment;
}
/************************************************************************/
/* GetVersion() */
/************************************************************************/
/**
* Gets the version of the block directory.
*
* @return The version of the block directory.
*/
uint16 BlockDir::GetVersion(void) const
{
return mnVersion;
}
/************************************************************************/
/* NeedsSwap() */
/************************************************************************/
/**
* Checks if the block directory on disk needs swapping.
*
* @return If the block directory on disk needs swapping.
*/
bool BlockDir::NeedsSwap(void) const
{
return mbNeedsSwap;
}
/************************************************************************/
/* IsValid() */
/************************************************************************/
/**
* Checks if the block directory is valid.
*
* @note The block directory is considered valid if the last
* two bytes of the header are the same as when the header was read.
*
* @return If the block directory is valid.
*/
bool BlockDir::IsValid(void) const
{
if (!mbOnDisk)
return true;
// Read the block directory header from disk.
uint8 abyHeader[512];
mpoFile->ReadFromSegment(mnSegment, abyHeader, 0, 512);
// The last 2 bytes of the header are for the valid info.
uint16 nValidInfo;
memcpy(&nValidInfo, abyHeader + 512 - 2, 2);
SwapValue(&nValidInfo);
// Check if the valid info has changed since the last read.
return nValidInfo == mnValidInfo;
}
/************************************************************************/
/* IsModified() */
/************************************************************************/
/**
* Checks if the block directory is modified.
*
* @return If the block directory is modified.
*/
bool BlockDir::IsModified(void) const
{
return mbModified;
}
/************************************************************************/
/* GetLayerCount() */
/************************************************************************/
/**
* Gets the number of block layers.
*
* @return The number of block layers.
*/
uint32 BlockDir::GetLayerCount(void) const
{
return (uint32) moLayerList.size();
}
/************************************************************************/
/* GetLayerType() */
/************************************************************************/
/**
* Gets the type of the block layer specified index.
*
* @param iLayer The index of the block layer.
*
* @return The type of the specified block layer.
*/
uint16 BlockDir::GetLayerType(uint32 iLayer) const
{
if (iLayer >= moLayerList.size())
return BLTDead;
return moLayerList[iLayer]->GetLayerType();
}
/************************************************************************/
/* GetLayerSize() */
/************************************************************************/
/**
* Gets the size in bytes of the block layer specified index.
*
* @param iLayer The index of the block layer.
*
* @return The size in bytes of the block layer specified index.
*/
uint64 BlockDir::GetLayerSize(uint32 iLayer) const
{
if (iLayer >= moLayerList.size())
return 0;
return moLayerList[iLayer]->GetLayerSize();
}
/************************************************************************/
/* IsValid() */
/************************************************************************/
/**
* Checks if the block layer at the specified index is valid.
*
* @param iLayer The index of the block layer.
*
* @return If the the specified block layer is valid.
*/
bool BlockDir::IsLayerValid(uint32 iLayer) const
{
return GetLayerType(iLayer) != BLTDead;
}
/************************************************************************/
/* GetLayer() */
/************************************************************************/
/**
* Gets the block layer at the specified index.
*
* @param iLayer The index of the block layer.
*
* @return The block layer at the specified index.
*/
BlockLayer * BlockDir::GetLayer(uint32 iLayer)
{
if (iLayer >= moLayerList.size())
return nullptr;
return moLayerList[iLayer];
}
/************************************************************************/
/* CreateLayer() */
/************************************************************************/
/**
* Creates a block layer of the specified type.
*
* @param nLayerType The type of the block layer to create.
*
* @return The index of the new block layer.
*/
uint32 BlockDir::CreateLayer(int16 nLayerType)
{
// Try to find an invalid layer.
uint32 nNewLayerIndex = INVALID_LAYER;
for (size_t iLayer = 0; iLayer < moLayerList.size(); iLayer++)
{
if (!moLayerList[iLayer]->IsValid())
{
nNewLayerIndex = (uint32) iLayer;
break;
}
}
if (nNewLayerIndex == INVALID_LAYER)
{
nNewLayerIndex = (uint32) moLayerList.size();
try
{
moLayerList.resize(moLayerList.size() + 1);
}
catch (const std::exception & ex)
{
return ThrowPCIDSKException(0, "Out of memory in BlockDir::CreateLayer(): %s", ex.what());
}
}
else
{
delete moLayerList[nNewLayerIndex];
}
// Call the virtual method _CreateLayer() to create the layer.
moLayerList[nNewLayerIndex] = _CreateLayer(nLayerType, nNewLayerIndex);
mbModified = true;
return nNewLayerIndex;
}
/************************************************************************/
/* DeleteLayer() */
/************************************************************************/
/**
* Deletes the block layer with the specified index.
*
* @param iLayer The index of the block layer to delete.
*/
void BlockDir::DeleteLayer(uint32 iLayer)
{
BlockLayer * poLayer = GetLayer(iLayer);
assert(poLayer && poLayer->IsValid());
if (!poLayer || !poLayer->IsValid())
return;
poLayer->Resize(0);
// Call the virtual method _DeleteLayer() to delete the layer.
_DeleteLayer(iLayer);
mbModified = true;
}
/************************************************************************/
/* CreateNewBlocks() */
/************************************************************************/
/**
* Creates the specified number of new blocks.
*
* @param nBlockCount The number of blocks to create.
*
* @return The specified number of new blocks.
*/
BlockInfoList BlockDir::CreateNewBlocks(uint32 nBlockCount)
{
ValidateNewBlocks(nBlockCount, false);
BlockInfoList oNewBlocks(nBlockCount);
BlockInfoList::iterator oIter = oNewBlocks.begin();
BlockInfoList::iterator oEnd = oNewBlocks.end();
for (; oIter != oEnd; ++oIter)
{
oIter->nSegment = INVALID_SEGMENT;
oIter->nStartBlock = INVALID_BLOCK;
}
mbModified = true;
return oNewBlocks;
}
/************************************************************************/
/* CreateFreeBlocks() */
/************************************************************************/
/**
* Creates the specified number of free blocks.
*
* @note The new blocks are going to be added to the free block layer.
*
* @param nBlockCount The number of blocks to create.
*/
void BlockDir::CreateFreeBlocks(uint32 nBlockCount)
{
if (!mpoFreeBlockLayer)
ReadFreeBlockLayer();
ValidateNewBlocks(nBlockCount, true);
uint32 nBlockSize = GetBlockSize();
uint16 nDataSegment =
mpoFile->ExtendSegment(GetDataSegmentName(), GetDataSegmentDesc(),
(uint64) nBlockCount * nBlockSize);
uint64 nBlockOffset = mpoFile->GetSegmentSize(nDataSegment);
assert(nBlockOffset % nBlockSize == 0);
// Reverse the block list because GetFreeBlock() is LIFO.
BlockInfoList oFreeBlockList;
oFreeBlockList.reserve(nBlockCount);
for (uint32 iBlock = 0; iBlock < nBlockCount; iBlock++)
{
BlockInfo sFreeBlock;
nBlockOffset -= nBlockSize;
sFreeBlock.nSegment = nDataSegment;
sFreeBlock.nStartBlock = (uint32) (nBlockOffset / nBlockSize);
oFreeBlockList.push_back(sFreeBlock);
}
mpoFreeBlockLayer->PushBlocks(oFreeBlockList);
mbModified = true;
}
/************************************************************************/
/* AddFreeBlocks() */
/************************************************************************/
/**
* Adds the the specified block list to the free block layer.
*
* @note Only the blocks which are allocated will be added to the
* free block layer.
*
* @param oBlockList The block list to add.
*/
void BlockDir::AddFreeBlocks(const BlockInfoList & oBlockList)
{
if (!mpoFreeBlockLayer)
ReadFreeBlockLayer();
BlockInfoList oValidBlockList;
oValidBlockList.reserve(oBlockList.size());
// Reverse the block list because GetFreeBlock() is LIFO.
BlockInfoList::const_reverse_iterator oIter = oBlockList.rbegin();
BlockInfoList::const_reverse_iterator oEnd = oBlockList.rend();
for (; oIter != oEnd; ++oIter)
{
if (oIter->nSegment != INVALID_SEGMENT &&
oIter->nStartBlock != INVALID_BLOCK)
{
oValidBlockList.push_back(*oIter);
}
}
mpoFreeBlockLayer->PushBlocks(oValidBlockList);
mbModified = true;
}
/************************************************************************/
/* GetFreeBlock() */
/************************************************************************/
/**
* Gets a free block from the free block layer.
*
* @note The block will be removed from the free block layer.
*
* @return A free block from the free block layer.
*/
BlockInfo BlockDir::GetFreeBlock(void)
{
if (!mpoFreeBlockLayer)
ReadFreeBlockLayer();
// If we need more free blocks, create a minimum of 16 blocks.
if (mpoFreeBlockLayer->GetBlockCount() == 0)
CreateFreeBlocks(std::max((uint32) 16, GetNewBlockCount()));
if (mpoFreeBlockLayer->GetBlockCount() <= 0)
ThrowPCIDSKException("Cannot create new blocks.");
BlockInfo sFreeBlock;
sFreeBlock.nSegment = INVALID_SEGMENT;
sFreeBlock.nStartBlock = INVALID_BLOCK;
const BlockInfoList & oFreeBlockList = mpoFreeBlockLayer->PopBlocks(1);
assert(oFreeBlockList.size() == 1);
if (!oFreeBlockList.empty())
sFreeBlock = oFreeBlockList[0];
mbModified = true;
return sFreeBlock;
}
/************************************************************************/
/* SwapValue() */
/************************************************************************/
/**
* Swaps the specified value.
*
* @param pnValue The value to swap.
*/
void BlockDir::SwapValue(uint16 * pnValue) const
{
if (!mbNeedsSwap)
return;
SwapData(pnValue, 2, 1);
}
| 29.090121 | 102 | 0.476854 | jpapadakis |
15813d024190ed209c448087869968168e95854e | 2,599 | cpp | C++ | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | 2 | 2016-04-01T21:10:33.000Z | 2018-02-26T19:36:56.000Z | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | 1 | 2017-04-05T01:33:08.000Z | 2017-04-05T01:33:08.000Z | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | null | null | null | #include "Window.h"
#include "Input.h"
#include <algorithm>
static LRESULT CALLBACK MyWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
{
if (uMsg == WM_QUIT || uMsg == WM_CLOSE)
{
PostQuitMessage(0);
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
FWindow::FWindow(HINSTANCE hInstance, int nCmdShow, int Width, int Height) : WindowWidth(Width), WindowHeight(Height)
{
RegisterWindow(hInstance);
WindowHandle = CreateWindow ("WindowClass",
"Engine Window",
WS_OVERLAPPED | WS_THICKFRAME | WS_MAXIMIZEBOX,
0,
0,
Width,
Height,
NULL,
NULL,
hInstance,
NULL);
SetWindowLong(WindowHandle, GWL_USERDATA, (LONG)this);
ShowWindow(WindowHandle, nCmdShow);
UpdateWindow(WindowHandle);
}
FWindow::~FWindow()
{
DestroyWindow(WindowHandle);
}
bool FWindow::HandleEvents()
{
bool IsWindowBeingDestroyed = false;
MSG Message;
while (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Message);
if (Message.message == WM_QUIT || Message.message == WM_CLOSE || Message.message == WM_DESTROY)
{
IsWindowBeingDestroyed = true;
}
for (auto EventHandler : EventHandlers)
{
EventHandler->HandleMessage(Message);
}
DispatchMessage(&Message);
}
return IsWindowBeingDestroyed == false;
}
// Defines the window
void FWindow::RegisterWindow(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof (wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = MyWindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor (NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "WindowClass";
wcex.hIconSm = 0;
RegisterClassEx (&wcex);
}
int FWindow::GetWidth() const
{
RECT wRect;
GetWindowRect(WindowHandle, &wRect);
return wRect.right - wRect.left;
}
int FWindow::GetHeight() const
{
RECT wRect;
GetWindowRect(WindowHandle, &wRect);
return wRect.bottom - wRect.top;
}
void FWindow::SetTitle(const std::string& Title)
{
SetWindowText(WindowHandle, Title.c_str());
}
void FWindow::RegisterEventHandler(IWindowsEventHandler* EventHandler)
{
EventHandlers.Add(EventHandler);
EventHandler->WindowHandle = WindowHandle;
}
void FWindow::UnregisterEventHandler(IWindowsEventHandler* EventHandler)
{
EventHandler->WindowHandle = nullptr;
EventHandlers.Remove(EventHandler);
}
void FMessageBox::ShowSimpleMessage(LPSTR MessageText)
{
MessageBox(NULL, MessageText, "MessageBox", MB_OK);
}
| 21.130081 | 117 | 0.722201 | subr3v |
158226c04206e99f39e4a181a1e8308f0b5768de | 476 | hpp | C++ | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | 2 | 2021-01-14T11:19:02.000Z | 2021-03-07T03:08:08.000Z | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | null | null | null | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | null | null | null | #ifndef __MODULUS_OPERATIONS_SYSTEM_HPP
#define __MODULUS_OPERATIONS_SYSTEM_HPP
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
#include <string>
#include "expressions.hpp"
namespace op {
void initialize_system();
extern expr::Operator* get_dir;
extern expr::Operator* set_dir;
extern expr::Operator* mk_dir;
extern expr::Operator* mk_file;
extern expr::Operator* fs_remove;
extern expr::Operator* fs_remove_all;
}
#endif
| 19.04 | 42 | 0.768908 | rationalis-petra |
158236ab77f8d4bef12585ad3aca710f036b08de | 3,693 | cc | C++ | src/sdk/dslink/subscribe_merger.cc | iot-dsa-v2/sdk-dslink-cpp | d7734fba02237bd11bc887058f4d9573aac598d8 | [
"Apache-2.0"
] | 1 | 2018-02-09T21:20:31.000Z | 2018-02-09T21:20:31.000Z | src/sdk/dslink/subscribe_merger.cc | iot-dsa-v2/sdk-dslink-cpp | d7734fba02237bd11bc887058f4d9573aac598d8 | [
"Apache-2.0"
] | 7 | 2017-11-20T22:22:12.000Z | 2018-03-21T13:00:06.000Z | src/sdk/dslink/subscribe_merger.cc | iot-dsa-v2/sdk-dslink-cpp | d7734fba02237bd11bc887058f4d9573aac598d8 | [
"Apache-2.0"
] | null | null | null | #include "dsa_common.h"
#include "subscribe_merger.h"
#include "core/client.h"
#include "link.h"
#include "module/logger.h"
#include "stream/requester/incoming_subscribe_stream.h"
#include "message/response/subscribe_response_message.h"
namespace dsa {
IncomingSubscribeCache::IncomingSubscribeCache(){};
IncomingSubscribeCache::IncomingSubscribeCache(
ref_<SubscribeMerger>&& merger, IncomingSubscribeCache::Callback&& callback,
const SubscribeOptions& options)
: _merger(std::move(merger)),
_callback(std::move(callback)),
_options(options) {}
void IncomingSubscribeCache::destroy_impl() {
_merger->remove(get_ref());
_merger.reset();
if (!_callback_running) {
_callback = nullptr;
}
}
void IncomingSubscribeCache::_receive_update(
ref_<const SubscribeResponseMessage>& message) {
if (_callback != nullptr) {
BEFORE_CALLBACK_RUN();
_callback(*this, message);
AFTER_CALLBACK_RUN();
}
}
SubscribeMerger::SubscribeMerger(ref_<DsLink>&& link, const string_& path)
: _link(std::move(link)),
_path(path),
_merged_subscribe_options(QosLevel::_0, -1) {}
SubscribeMerger::~SubscribeMerger() {}
void SubscribeMerger::destroy_impl() {
_link->_subscribe_mergers.erase(_path);
_link.reset();
_cached_value.reset();
for (auto it : _caches) {
it->destroy();
}
_caches.clear();
if (_stream != nullptr) {
_stream->close();
// stream can't be destroyed here to make sure the request is canceled
_stream.reset();
}
}
ref_<IncomingSubscribeCache> SubscribeMerger::subscribe(
IncomingSubscribeCache::Callback&& callback,
const SubscribeOptions& options) {
auto cache = make_ref_<IncomingSubscribeCache>(get_ref(), std::move(callback),
options);
_caches.emplace(cache);
if (_stream == nullptr) {
_merged_subscribe_options = options;
_stream = _link->_client->get_session().subscribe(
_path, [ this, copy_ref = get_ref() ](
IncomingSubscribeStream & stream,
ref_<const SubscribeResponseMessage> && msg) {
new_subscribe_response(std::move(msg));
},
_merged_subscribe_options);
} else if (_merged_subscribe_options.mergeFrom(cache->_options)) {
_stream->subscribe(options);
}
if (_cached_value != nullptr) {
cache->_receive_update(_cached_value);
}
return std::move(cache);
}
void SubscribeMerger::new_subscribe_response(
SubscribeResponseMessageCRef&& message) {
_cached_value = std::move(message);
_iterating_caches = true;
bool removed_some = false;
for (auto it = _caches.begin(); it != _caches.end();) {
(*it)->_receive_update(_cached_value);
if ((*it)->is_destroyed()) {
// remove() is blocked, need to handle it here
it = _caches.erase(it);
removed_some = true;
} else {
++it;
}
}
if (removed_some) {
if (_caches.empty()) {
destroy();
} else {
check_subscribe_options();
}
}
_iterating_caches = false;
}
void SubscribeMerger::check_subscribe_options() {
SubscribeOptions new_options(QosLevel::_0, -1);
for (auto& cache : _caches) {
new_options.mergeFrom(cache->_options);
}
if (new_options != _merged_subscribe_options) {
_merged_subscribe_options = new_options;
_stream->subscribe(_merged_subscribe_options);
}
}
void SubscribeMerger::remove(const ref_<IncomingSubscribeCache>& cache) {
if (is_destroyed() || _iterating_caches) return;
_caches.erase(cache);
if (_caches.empty()) {
destroy();
} else if (_merged_subscribe_options.needUpdateOnRemoval(cache->_options)) {
check_subscribe_options();
}
}
}
| 27.559701 | 80 | 0.679393 | iot-dsa-v2 |
1584d88255951973aa8a81c2c6d1f541f1668eef | 11,591 | cpp | C++ | qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 5 | 2018-12-22T14:49:13.000Z | 2022-01-13T07:21:46.000Z | qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | null | null | null | qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 8 | 2018-07-17T03:55:48.000Z | 2021-12-22T06:37:53.000Z | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "propertyeditorcontextobject.h"
#include <abstractview.h>
#include <nodemetainfo.h>
#include <qmldesignerplugin.h>
#include <qmlobjectnode.h>
#include <rewritingexception.h>
#include <coreplugin/messagebox.h>
#include <utils/algorithm.h>
#include <QQmlContext>
static uchar fromHex(const uchar c, const uchar c2)
{
uchar rv = 0;
if (c >= '0' && c <= '9')
rv += (c - '0') * 16;
else if (c >= 'A' && c <= 'F')
rv += (c - 'A' + 10) * 16;
else if (c >= 'a' && c <= 'f')
rv += (c - 'a' + 10) * 16;
if (c2 >= '0' && c2 <= '9')
rv += (c2 - '0');
else if (c2 >= 'A' && c2 <= 'F')
rv += (c2 - 'A' + 10);
else if (c2 >= 'a' && c2 <= 'f')
rv += (c2 - 'a' + 10);
return rv;
}
static uchar fromHex(const QString &s, int idx)
{
uchar c = s.at(idx).toLatin1();
uchar c2 = s.at(idx + 1).toLatin1();
return fromHex(c, c2);
}
QColor convertColorFromString(const QString &s)
{
if (s.length() == 9 && s.startsWith(QLatin1Char('#'))) {
uchar a = fromHex(s, 1);
uchar r = fromHex(s, 3);
uchar g = fromHex(s, 5);
uchar b = fromHex(s, 7);
return QColor(r, g, b, a);
} else {
QColor rv(s);
return rv;
}
}
namespace QmlDesigner {
PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
QObject(parent),
m_isBaseState(false),
m_selectionChanged(false),
m_backendValues(0),
m_qmlComponent(0),
m_qmlContext(0)
{
}
QString PropertyEditorContextObject::convertColorToString(const QColor &color)
{
QString colorString = color.name();
if (color.alpha() != 255) {
const QString hexAlpha = QString::number(color.alpha(), 16);
colorString.remove(0,1);
colorString.prepend(hexAlpha);
colorString.prepend(QStringLiteral("#"));
}
return colorString;
}
QColor PropertyEditorContextObject::colorFromString(const QString &colorString)
{
return convertColorFromString(colorString);
}
QString PropertyEditorContextObject::translateFunction()
{
if (QmlDesignerPlugin::instance()->settings().value(
DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION).toInt())
switch (QmlDesignerPlugin::instance()->settings().value(
DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION).toInt()) {
case 0: return QLatin1String("qsTr");
case 1: return QLatin1String("qsTrId");
case 2: return QLatin1String("qsTranslate");
default:
break;
}
return QLatin1String("qsTr");
}
QStringList PropertyEditorContextObject::autoComplete(const QString &text, int pos, bool explicitComplete, bool filter)
{
if (m_model && m_model->rewriterView())
return Utils::filtered(m_model->rewriterView()->autoComplete(text, pos, explicitComplete), [filter](const QString &string) {
return !filter || (!string.isEmpty() && string.at(0).isUpper()); });
return QStringList();
}
void PropertyEditorContextObject::toogleExportAlias()
{
if (!m_model || !m_model->rewriterView())
return;
/* Ideally we should not missuse the rewriterView
* If we add more code here we have to forward the property editor view */
RewriterView *rewriterView = m_model->rewriterView();
if (rewriterView->selectedModelNodes().isEmpty())
return;
const ModelNode selectedNode = rewriterView->selectedModelNodes().constFirst();
if (QmlObjectNode::isValidQmlObjectNode(selectedNode)) {
QmlObjectNode objectNode(selectedNode);
PropertyName modelNodeId = selectedNode.id().toUtf8();
ModelNode rootModelNode = rewriterView->rootModelNode();
try {
RewriterTransaction transaction =
rewriterView->beginRewriterTransaction(QByteArrayLiteral("PropertyEditorContextObject:toogleExportAlias"));
if (!objectNode.isAliasExported())
objectNode.ensureAliasExport();
else
if (rootModelNode.hasProperty(modelNodeId))
rootModelNode.removeProperty(modelNodeId);
transaction.commit();
} catch (RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
exception.showException();
}
}
}
void PropertyEditorContextObject::changeTypeName(const QString &typeName)
{
if (!m_model || !m_model->rewriterView())
return;
/* Ideally we should not missuse the rewriterView
* If we add more code here we have to forward the property editor view */
RewriterView *rewriterView = m_model->rewriterView();
if (rewriterView->selectedModelNodes().isEmpty())
return;
ModelNode selectedNode = rewriterView->selectedModelNodes().constFirst();
try {
RewriterTransaction transaction =
rewriterView->beginRewriterTransaction(QByteArrayLiteral("PropertyEditorContextObject:changeTypeName"));
NodeMetaInfo metaInfo = m_model->metaInfo(typeName.toLatin1());
if (!metaInfo.isValid()) {
Core::AsynchronousMessageBox::warning(tr("Invalid Type"), tr("%1 is an invalid type.").arg(typeName));
return;
}
if (selectedNode.isRootNode())
rewriterView->changeRootNodeType(metaInfo.typeName(), metaInfo.majorVersion(), metaInfo.minorVersion());
else
selectedNode.changeType(metaInfo.typeName(), metaInfo.majorVersion(), metaInfo.minorVersion());
transaction.commit();
} catch (RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
exception.showException();
}
}
void PropertyEditorContextObject::insertKeyframe(const QString &propertyName)
{
if (!m_model || !m_model->rewriterView())
return;
/* Ideally we should not missuse the rewriterView
* If we add more code here we have to forward the property editor view */
RewriterView *rewriterView = m_model->rewriterView();
if (rewriterView->selectedModelNodes().isEmpty())
return;
ModelNode selectedNode = rewriterView->selectedModelNodes().constFirst();
rewriterView->emitCustomNotification("INSERT_KEYFRAME",
{ selectedNode },
{ propertyName });
}
int PropertyEditorContextObject::majorVersion() const
{
return m_majorVersion;
}
int PropertyEditorContextObject::majorQtQuickVersion() const
{
return m_majorQtQuickVersion;
}
int PropertyEditorContextObject::minorQtQuickVersion() const
{
return m_minorQtQuickVersion;
}
void PropertyEditorContextObject::setMajorVersion(int majorVersion)
{
if (m_majorVersion == majorVersion)
return;
m_majorVersion = majorVersion;
emit majorVersionChanged();
}
void PropertyEditorContextObject::setMajorQtQuickVersion(int majorVersion)
{
if (m_majorQtQuickVersion == majorVersion)
return;
m_majorQtQuickVersion = majorVersion;
emit majorQtQuickVersionChanged();
}
void PropertyEditorContextObject::setMinorQtQuickVersion(int minorVersion)
{
if (m_minorQtQuickVersion == minorVersion)
return;
m_minorQtQuickVersion = minorVersion;
emit minorQtQuickVersionChanged();
}
int PropertyEditorContextObject::minorVersion() const
{
return m_minorVersion;
}
void PropertyEditorContextObject::setMinorVersion(int minorVersion)
{
if (m_minorVersion == minorVersion)
return;
m_minorVersion = minorVersion;
emit minorVersionChanged();
}
bool PropertyEditorContextObject::hasActiveTimeline() const
{
return m_setHasActiveTimeline;
}
void PropertyEditorContextObject::setHasActiveTimeline(bool b)
{
if (b == m_setHasActiveTimeline)
return;
m_setHasActiveTimeline = b;
emit hasActiveTimelineChanged();
}
void PropertyEditorContextObject::insertInQmlContext(QQmlContext *context)
{
m_qmlContext = context;
m_qmlContext->setContextObject(this);
}
QQmlComponent *PropertyEditorContextObject::specificQmlComponent()
{
if (m_qmlComponent)
return m_qmlComponent;
m_qmlComponent = new QQmlComponent(m_qmlContext->engine(), this);
m_qmlComponent->setData(m_specificQmlData.toUtf8(), QUrl::fromLocalFile(QStringLiteral("specfics.qml")));
return m_qmlComponent;
}
void PropertyEditorContextObject::setGlobalBaseUrl(const QUrl &newBaseUrl)
{
if (newBaseUrl == m_globalBaseUrl)
return;
m_globalBaseUrl = newBaseUrl;
emit globalBaseUrlChanged();
}
void PropertyEditorContextObject::setSpecificsUrl(const QUrl &newSpecificsUrl)
{
if (newSpecificsUrl == m_specificsUrl)
return;
m_specificsUrl = newSpecificsUrl;
emit specificsUrlChanged();
}
void PropertyEditorContextObject::setSpecificQmlData(const QString &newSpecificQmlData)
{
if (m_specificQmlData == newSpecificQmlData)
return;
m_specificQmlData = newSpecificQmlData;
delete m_qmlComponent;
m_qmlComponent = 0;
emit specificQmlComponentChanged();
emit specificQmlDataChanged();
}
void PropertyEditorContextObject::setStateName(const QString &newStateName)
{
if (newStateName == m_stateName)
return;
m_stateName = newStateName;
emit stateNameChanged();
}
void PropertyEditorContextObject::setIsBaseState(bool newIsBaseState)
{
if (newIsBaseState == m_isBaseState)
return;
m_isBaseState = newIsBaseState;
emit isBaseStateChanged();
}
void PropertyEditorContextObject::setSelectionChanged(bool newSelectionChanged)
{
if (newSelectionChanged == m_selectionChanged)
return;
m_selectionChanged = newSelectionChanged;
emit selectionChangedChanged();
}
void PropertyEditorContextObject::setBackendValues(QQmlPropertyMap *newBackendValues)
{
if (newBackendValues == m_backendValues)
return;
m_backendValues = newBackendValues;
emit backendValuesChanged();
}
void PropertyEditorContextObject::setModel(Model *model)
{
m_model = model;
}
void PropertyEditorContextObject::triggerSelectionChanged()
{
setSelectionChanged(!m_selectionChanged);
}
void PropertyEditorContextObject::setHasAliasExport(bool hasAliasExport)
{
if (m_aliasExport == hasAliasExport)
return;
m_aliasExport = hasAliasExport;
emit hasAliasExportChanged();
}
} //QmlDesigner
| 28.133495 | 133 | 0.680442 | kevinlq |
15865ad7436e927b97a9785032a5aced22cb68fb | 1,254 | cpp | C++ | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 3 | 2017-08-13T14:47:57.000Z | 2020-03-02T06:48:29.000Z | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 1 | 2018-09-19T14:14:54.000Z | 2018-09-26T22:35:03.000Z | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 1 | 2018-09-19T14:13:55.000Z | 2018-09-19T14:13:55.000Z | /*
* Copyright (C) 2001-2010 Terence M. Welsh
*
* This file is part of Implicit.
*
* Implicit is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Implicit 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 Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <Implicit/impSphere.h>
float impSphere::value(float* position){
const float tx(invmat[12] + position[0]);
const float ty(invmat[13] + position[1]);
const float tz(invmat[14] + position[2]);
// Use thickness instead of relying on scale to be in the matrix
// because the value computation for a sphere is simplified by
// using an incomplete matrix.
return thicknessSquared / (tx*tx + ty*ty + tz*tz + IMP_MIN_DIVISOR);
}
| 35.828571 | 76 | 0.730463 | NickPepper |
158774882ee46c4b3893765ae1921c01dab98682 | 3,523 | cpp | C++ | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
// Copyright 2018 NAVER Corp.
//
// 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 "trace_data_sender.h"
#include "pinpoint_agent_context.h"
#include "serializer.h"
using namespace Pinpoint::log;
using namespace Pinpoint::utils;
using namespace Pinpoint::Trace;
namespace Pinpoint
{
namespace Agent
{
TraceDataSender::TraceDataSender(const boost::shared_ptr<DataSender> &dataSender)
: dataSender(dataSender)
{
}
TraceDataSender::~TraceDataSender()
{
}
int32_t TraceDataSender::init()
{
LOGI("TraceDataSender::init() start. ");
TMemoryBuffer *tb = new(std::nothrow) TMemoryBuffer();
if (tb == NULL)
{
LOGE("new TMemoryBuffer fail.");
return FAILED;
}
this->transportOut.reset(tb);
TCompactProtocol *tp = new(std::nothrow) TCompactProtocol(this->transportOut);
if (tp == NULL)
{
LOGE("new TCompactProtocol fail.");
return FAILED;
}
this->protocolOut.reset(tp);
return SUCCESS;
}
int32_t TraceDataSender::start()
{
return SUCCESS;
}
int32_t TraceDataSender::send(const TracePtr &tracePtr)
{
if (protocolOut == NULL || transportOut == NULL)
{
return FAILED;
}
try
{
std::string data;
int32_t err;
PINPOINT_ASSERT_RETURN ((tracePtr != NULL), FAILED);
DefaultTracePtr defaultTracePtr = boost::dynamic_pointer_cast<DefaultTrace>(tracePtr);
SpanPtr& spanPtr = defaultTracePtr->getSpanPtr();
PINPOINT_ASSERT_RETURN ((spanPtr != NULL), FAILED);
LOGI("Span: [%s]", utils::TBaseToString(spanPtr->getTSpan()).c_str());
err = serializer.serializer(spanPtr->getTSpan(), data);
if (err != SUCCESS)
{
LOGE("serializer trace failed");
return err;
}
PacketPtr packetPtr(new Packet(PacketType::HEADLESS, 1));
PacketData& packetData = packetPtr->getPacketData();
packetData = data;
return this->dataSender->sendPacket(packetPtr, 100);
}
catch (std::bad_alloc& e)
{
LOGE("TraceDataSender::send throw: e=%s", e.what());
return FAILED;
}
catch (std::exception& e)
{
LOGE("TraceDataSender::send throw: e=%s", e.what());
assert (false);
return FAILED;
}
}
}
}
| 29.855932 | 102 | 0.516321 | wy1238 |
158f472dae3250b461b6e559d505a9218120ba83 | 1,065 | cc | C++ | uva/chapter_3/574.cc | metaflow/contests | 5e9ffcb72c3e7da54b5e0818b1afa59f5778ffa2 | [
"MIT"
] | 1 | 2019-05-12T23:41:00.000Z | 2019-05-12T23:41:00.000Z | uva/chapter_3/574.cc | metaflow/contests | 5e9ffcb72c3e7da54b5e0818b1afa59f5778ffa2 | [
"MIT"
] | null | null | null | uva/chapter_3/574.cc | metaflow/contests | 5e9ffcb72c3e7da54b5e0818b1afa59f5778ffa2 | [
"MIT"
] | null | null | null | #include <iostream>
#include <utility>
using namespace std;
const int MAX = 1100;
int c[MAX], s[MAX];
bool backtrack(int up, int left) {
if (left == 0) {
bool f = true;
for (int i = MAX - 1; i > 0; i--) {
for (int j = 0; j < s[i]; j++) {
if (!f) printf("+");
f = false;
printf("%d", i);
}
}
printf("\n");
return true;
}
if (left < 0) return false;
while (up > 0 && c[up] == 0) up--;
if (up == 0) return false;
bool f = false;
for (int i = c[up]; i >= 0; i--) {
s[up] = i;
f = f | backtrack(up - 1, left - i * up);
}
return f;
}
int main() {
int t, n;
while (scanf("%d%d", &t, &n), t != 0) {
fill(c, c + MAX, 0);
fill(s, s + MAX, 0);
for (int i = 0; i < n; i++) {
int v;
scanf("%d", &v);
c[v]++;
}
printf("Sums of %d:\n", t);
if (!backtrack(MAX - 1, t)) {
printf("NONE\n");
}
}
}
| 20.882353 | 49 | 0.371831 | metaflow |
1592a0ee02eeca8c71a3027a1dac478fcbc7f092 | 536 | hpp | C++ | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | 1 | 2020-07-11T14:53:38.000Z | 2020-07-11T14:53:38.000Z | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | 1 | 2020-07-04T16:45:49.000Z | 2020-07-04T16:45:49.000Z | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | null | null | null | #ifndef RHIZOME_CORE_I_TOKEN
#define RHIZOME_CORE_I_TOKEN
#include <string>
using std::string;
namespace rhizome {
namespace core {
class IToken {
public:
virtual void set( string const &tvalue, string const &tname, size_t line_no, size_t col) = 0;
virtual size_t line() const = 0;
virtual size_t column() const = 0;
virtual string token_value() const = 0;
virtual string token_class() const = 0;
};
}
}
#endif
| 19.851852 | 105 | 0.574627 | nathanmullenax83 |
1592c20bc5e43827ebc67ceab4b66bf191a85f2c | 3,752 | hpp | C++ | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 1 | 2021-11-12T09:29:31.000Z | 2021-11-12T09:29:31.000Z | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | null | null | null | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 2 | 2021-10-03T02:14:20.000Z | 2021-11-12T09:29:36.000Z | // Autogenerated from CppHeaderCreator on 7/27/2020 3:09:54 PM
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
// Including type: System.Enum
#include "System/Enum.hpp"
#include "utils/il2cpp-utils.hpp"
// Completed includes
// Begin forward declares
// Completed forward declares
// Type namespace: System.Diagnostics.Tracing
namespace System::Diagnostics::Tracing {
// Autogenerated type: System.Diagnostics.Tracing.EventManifestOptions
struct EventManifestOptions : public System::Enum {
public:
// public System.Int32 value__
// Offset: 0x0
int value;
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions None
static constexpr const int None = 0;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions None
static System::Diagnostics::Tracing::EventManifestOptions _get_None();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions None
static void _set_None(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static constexpr const int Strict = 1;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static System::Diagnostics::Tracing::EventManifestOptions _get_Strict();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static void _set_Strict(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static constexpr const int AllCultures = 2;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static System::Diagnostics::Tracing::EventManifestOptions _get_AllCultures();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static void _set_AllCultures(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static constexpr const int OnlyIfNeededForRegistration = 4;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static System::Diagnostics::Tracing::EventManifestOptions _get_OnlyIfNeededForRegistration();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static void _set_OnlyIfNeededForRegistration(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static constexpr const int AllowEventSourceOverride = 8;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static System::Diagnostics::Tracing::EventManifestOptions _get_AllowEventSourceOverride();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static void _set_AllowEventSourceOverride(System::Diagnostics::Tracing::EventManifestOptions value);
// Creating value type constructor for type: EventManifestOptions
EventManifestOptions(int value_ = {}) : value{value_} {}
}; // System.Diagnostics.Tracing.EventManifestOptions
}
DEFINE_IL2CPP_ARG_TYPE(System::Diagnostics::Tracing::EventManifestOptions, "System.Diagnostics.Tracing", "EventManifestOptions");
#pragma pack(pop)
| 65.824561 | 129 | 0.784915 | Futuremappermydud |
15953631a5d2d4b574af1f3a6153bdadf255b2f5 | 15,158 | hpp | C++ | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | 1 | 2020-06-22T04:15:16.000Z | 2020-06-22T04:15:16.000Z | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | null | null | null | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | null | null | null | /*
* Software License Agreement (New BSD License)
*
* Copyright (c) 2013, Keith Leung, Felipe Inostroza
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Advanced Mining Technology Center (AMTC), the
* Universidad de Chile, nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AMTC, UNIVERSIDAD DE CHILE, OR THE COPYRIGHT
* HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GAUSSIAN_MIXTURE_HPP
#define GAUSSIAN_MIXTURE_HPP
#include <algorithm>
#include <iostream>
#include "Landmark.hpp"
#include "RandomVecMathTools.hpp"
#include <vector>
/**
* \class GaussianMixture
* \brief A class for mixture of Gaussians
*
* This class represents a mixture of weighted Gaussians
* It is designed to work with the RBPHDFilter
*
* \author Keith Leung
*/
template< class Landmark >
class GaussianMixture
{
public:
typedef Landmark TLandmark;
typedef Landmark* pLandmark;
/** \brief A data structure representing a weighted Gaussian distribution in GaussianMixture */
struct Gaussian{
pLandmark landmark; /**< pointer to a Landmark, which holds the mean and covariance */
double weight; /**< weight of Gaussian */
double weight_prev; /**< previous weight of Gaussian (used in computations by the RBPHDFilter) */
};
/** Default constructor */
GaussianMixture();
/** Destructor */
~GaussianMixture();
/**
* Copy data from this GaussianMixture to another GaussianMixture.
* Memory is allocated for creating copies of Gaussians for the other GaussianMixture.
* \param[in,out] other the other Gaussian mixture to which data is copied to
*/
void copyTo( GaussianMixture *other);
/**
* Add a Gaussian to this GaussianMixture
* \param[in] p pointer to the Landmark which holds the mean and covariance
* \param[in] w weight of the new Gaussian
* \param[in] allocateMem if false, the function assumes memory for Landmark has already been allocated
* and will not go out of scope or get deleted, other than by the current instantiation of GaussianMixture.
* If true, memory is allocated for a new Landmark and data from p is copied to it.
* \return number of Gaussians in the mixture
*/
unsigned int addGaussian( pLandmark p, double w = 1, bool allocateMem = false);
/**
* Remove a Gaussian from the mixture
* \param[in] idx index number of the Gaussian to remove
* \return number of Gaussians in the mixture
*/
unsigned int removeGaussian( unsigned int idx );
/**
* Get the number of Gaussians in the mixture
* \return count
*/
unsigned int getGaussianCount();
/**
* Set the weight of a Gaussian indicated by the given index
* \param[in] idx index
* \param[in] w weight
*/
void setWeight( unsigned int idx, double w );
/**
* Get the weight of a Gaussian indicated by the given index
* \param[in] idx index
* \return weight
*/
double getWeight( unsigned int idx );
/**
* Get the parameters of a Gaussian (stored as a Landmark)
* \param[in] idx index
* \return pointer to a Landmark, or NULL if the Gaussian does not exist.
*/
pLandmark getGaussian( unsigned int idx );
/**
* Get the parameters of a Gaussian (stored as a Landmark)
* \param[in] idx index
* \param[out] p pointer to a Landmark that holds the Gaussian parameters
*/
void getGaussian( unsigned int idx, pLandmark &p);
/**
* Get the state and weight of a Gaussian
* \param[in] idx index
* \param[out] p pointer to a Landmark which holds the mean and covariance
* \param[out] w the weight
*/
void getGaussian( unsigned int idx, pLandmark &p, double &w);
/**
* Get the parameters and weight of a Gaussian
* \param[in] idx index
* \param[out] p pointer to a Landmark which holds the mean and covariance
* \param[out] w overwritten by the weight
* \param[out] w_prev overwritten by the previous weight (used in parts of the RBPHDFilter)
*/
void getGaussian( unsigned int idx, pLandmark &p, double &w, double &w_prev);
/**
* Update an Gaussian in the mixture.
* \param[in] idx index of the Gaussian to update
* \param[in] lm Landmark object with the updated mean and covariance
* \param[in] w weight of the updated Gaussian. No change are made to the existing weight if this is negative.
* \return true if idx is valid and Gaussian is updated
*/
bool updateGaussian( unsigned int idx, Landmark &lm, double w = -1);
/**
* Check all Gaussians in the mixture and merge those that are within a certain Mahalanobis distance of each other
* \param[in] t distance threshold (the default value squares to 0.1)
* \param[in] f_inflation merged Gaussian covariance inflation factor (default value causes no inflation)
* \return number of merging operations
*/
unsigned int merge(const double t = 0.31622776601, const double f_inflation = 1.0);
/**
* Prune the Gaussian mixture to remove Gaussians with weights that are
* less than a given threshold.
* \note Gaussians may have difference indices after using this function due to sorting performed on gList_
* \param[in] t weight threshold, below which Gaussians are removed.
* \return number of Gaussians removed
*/
unsigned int prune( const double t );
/**
* Sort the Gaussian mixture container gList_ from highest to lowest Gaussian weight.
*/
void sortByWeight();
protected:
int n_; /**< number of Gaussians in this GaussianMixture */
std::vector<Gaussian> gList_; /**< container for Gaussians */
bool isSorted_; /**< a flag to prevent unecessary sorting */
/**
* Comparison function used by sortByWeight() for sorting the Gaussian container gList_.
*/
static bool weightCompare(Gaussian a, Gaussian b);
/**
* Add a Gaussian to this GaussianMixture, by overwrite an existing spot in the Gaussian container.
* \param[in] idx element in the container gList_ to overwrite.
* \param[in] p pointer to the Landmark to add, which holds the mean and covariance.
* \param[in] w weight of the new Gaussian.
* \param[in] allocateMem if false, this assumes memory for Landmark has already been allocated
* and will not go out of scope or get deleted, other than by the current instantiation of GaussianMixture.
* If true, memory is allocated for a new Landmark and data from p is copied to it.
* \return number of Gaussians in the mixture
*/
unsigned int addGaussian( unsigned int idx, pLandmark p, double w = 1, bool allocateMem = false);
/**
* Merge two Guassians if the second is within a Mahalanobis distance of the first.
* If merging occurs, the resulting Gaussian will overwrite the first Gaussian,
* and second one will be removed from the Gaussian mixture.
* \param[in] idx1 index of the first Gaussian
* \param[in] idx2 index of the second Gaussian
* \param[in] t distance threshold (the default value squares to 0.1)
* \param[in] f_inflation merged Gaussian covariance inflation factor
* \return true if merging is successful
*/
bool merge(unsigned int idx1, unsigned int idx2,
const double t = 0.3162277660, const double f_inflation = 1.0);
};
////////// Implementation //////////
template< class Landmark >
GaussianMixture<Landmark>::GaussianMixture(){
n_ = 0;
isSorted_ = false;
}
template< class Landmark >
GaussianMixture<Landmark>::~GaussianMixture(){
for( int i = 0; i < gList_.size(); i++){
removeGaussian(i);
}
}
template< class Landmark >
void GaussianMixture<Landmark>::copyTo( GaussianMixture *other){
other->n_ = n_;
other->gList_ = gList_;
for(int i = 0; i < gList_.size(); i++){
Landmark* lmkCopy = new Landmark;
*lmkCopy = *(gList_[i].landmark);
other->gList_[i].landmark = lmkCopy;
}
other->isSorted_ = isSorted_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::addGaussian( pLandmark p, double w,
bool allocateMem){
isSorted_ = false;
Landmark* pNew = NULL;
if(allocateMem){
pNew = new Landmark;
*pNew = *p;
}else{
pNew = p;
}
Gaussian g = {pNew, w, 0};
gList_.push_back(g);
n_++;
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::addGaussian( unsigned int idx, pLandmark p, double w,
bool allocateMem){
isSorted_ = false;
Landmark* pNew = NULL;
if(allocateMem){
pNew = new Landmark;
*pNew = *p;
}else{
pNew = p;
}
if (gList_[idx].landmark != NULL){
removeGaussian( idx );
}
gList_[idx].landmark = pNew;
gList_[idx].weight = w;
gList_[idx].weight_prev = 0;
n_++;
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::removeGaussian( unsigned int idx ){
isSorted_ = false;
if(gList_[idx].landmark != NULL){
delete gList_[idx].landmark;
gList_[idx].landmark = NULL;
gList_[idx].weight = 0;
gList_[idx].weight_prev = 0;
n_--;
}
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::getGaussianCount(){
return n_;
}
template< class Landmark >
void GaussianMixture<Landmark>::setWeight( unsigned int idx, double w ){
isSorted_ = false;
gList_[idx].weight_prev = gList_[idx].weight;
gList_[idx].weight = w;
}
template< class Landmark >
double GaussianMixture<Landmark>::getWeight( unsigned int idx){
return gList_[idx].weight;
}
template< class Landmark >
typename GaussianMixture<Landmark>::pLandmark GaussianMixture<Landmark>::getGaussian( unsigned int idx ){
return (gList_[idx].landmark);
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p){
p = gList_[idx].landmark;
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p, double &w){
p = gList_[idx].landmark;
w = gList_[idx].weight;
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p, double &w, double &w_prev){
p = gList_[idx].landmark;
w = gList_[idx].weight;
w_prev = gList_[idx].weight_prev;
}
template< class Landmark >
bool GaussianMixture<Landmark>::updateGaussian( unsigned int idx, Landmark &lm, double w){
isSorted_ = false;
if( idx > gList_.size() || gList_[idx].landmark == NULL)
return false;
if ( w < 0 )
w = getWeight( idx );
*(gList_[idx].landmark) = lm;
gList_[idx].weight_prev = gList_[idx].weight;
gList_[idx].weight = w;
return true;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::merge(const double t,
const double f_inflation){
isSorted_ = false;
unsigned int nMerged = 0;
int nGaussians = gList_.size();
for(unsigned int i = 0; i < nGaussians; i++){
for(unsigned int j = i+1; j < nGaussians; j++){
if( merge(i, j, t, f_inflation) ){
nMerged++;
}
}
}
return nMerged;
}
template< class Landmark >
bool GaussianMixture<Landmark>::merge(unsigned int idx1, unsigned int idx2,
const double t, const double f_inflation){
isSorted_ = false;
if (gList_[idx1].landmark == NULL ||
gList_[idx2].landmark == NULL ){
return false;
}
double w_m, w_1, w_2;
double d_mahalanobis_1, d_mahalanobis_2;
w_1 = gList_[idx1].weight;
w_2 = gList_[idx2].weight;
double t2 = t * t;
d_mahalanobis_1 = gList_[idx1].landmark->mahalanobisDist2( *(gList_[idx2].landmark) );
if( d_mahalanobis_1 > t2 ){
d_mahalanobis_2 = gList_[idx2].landmark->mahalanobisDist2( *(gList_[idx1].landmark) );
if( d_mahalanobis_2 > t2 ){
return false;
}
}
w_m = w_1 + w_2;
if( w_m == 0 )
return false;
typename Landmark::Vec x_1, x_2, x_m, d_1, d_2;
typename Landmark::Mat S_1, S_2, S_m;
gList_[idx1].landmark->get(x_1, S_1);
gList_[idx2].landmark->get(x_2, S_2);
x_m = (x_1 * w_1 + x_2 * w_2) / w_m;
d_1 = x_m - x_1;
d_2 = x_m - x_2;
S_m = ( w_1 * ( S_1 + f_inflation * d_1 * d_1.transpose() ) +
w_2 * ( S_2 + f_inflation * d_2 * d_2.transpose() ) ) / w_m;
//std::cout << "\n" << x_1 << "\n" << S_1 << "\n\n";
//std::cout << "\n" << x_2 << "\n" << S_2 << "\n\n";
//std::cout << "\n" << x_m << "\n" << S_m << "\n\n";
gList_[idx1].landmark->set(x_m, S_m);
gList_[idx1].weight = w_m;
gList_[idx1].weight_prev = 0;
removeGaussian( idx2 ); // this also takes care of updating Gaussian count
return true;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::prune( const double t ){
isSorted_ = false;
unsigned int nPruned = 0;
if( gList_.size() < 1 ){
return nPruned;
}
sortByWeight(); // Sort from greatest to smallest weight
// Binary search for the Gaussian with weight closest to and greater than t
unsigned int min_idx = 0;
unsigned int max_idx = gList_.size() - 1;
unsigned int idx = (unsigned int)( (max_idx + min_idx) / 2 );
unsigned int idx_old = idx + 1;
double w = gList_[idx].weight;
while(idx != idx_old){
if( w <= t ){
max_idx = idx;
}else if ( w > t ){
min_idx = idx;
}
idx_old = idx;
idx = (unsigned int)( (max_idx + min_idx) / 2 );
w = gList_[idx].weight;
}
while( w >= t && idx < gList_.size() - 1 ){
idx++;
w = gList_[idx].weight;
}
idx_old = idx;
while( idx < gList_.size() ){
removeGaussian(idx); // this already takes care updating the Gaussian count
idx++;
nPruned++;
}
gList_.resize(idx_old);
return nPruned;
}
template< class Landmark >
void GaussianMixture<Landmark>::sortByWeight(){
if( !isSorted_ ){
std::sort( gList_.begin(), gList_.end(), weightCompare );
isSorted_ = true;
}
}
template< class Landmark >
bool GaussianMixture<Landmark>::weightCompare(Gaussian a, Gaussian b){
return a.weight > b.weight;
}
#endif
| 30.255489 | 116 | 0.68162 | szma |
1598549d05d06faa7337a37ea28978e5f03f4c8b | 13,161 | cpp | C++ | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | 1 | 2020-04-19T20:34:15.000Z | 2020-04-19T20:34:15.000Z | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | null | null | null | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | null | null | null | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Alessandro Tasora
// =============================================================================
#include "chrono_fea/ChBeamSection.h"
namespace chrono {
namespace fea {
/// Shortcut: set Area, Ixx, Iyy, Ksy, Ksz and J torsion constant
/// at once, given the y and z widths of the beam assumed
/// with rectangular shape.
void ChElasticityTimoshenkoSimple::SetAsRectangularSection(double width_y, double width_z) {
this->Izz = (1.0 / 12.0) * width_z * pow(width_y, 3);
this->Iyy = (1.0 / 12.0) * width_y * pow(width_z, 3);
// use Roark's formulas for torsion of rectangular sect:
double t = ChMin(width_y, width_z);
double b = ChMax(width_y, width_z);
this->J = b * pow(t, 3) * ((1.0 / 3.0) - 0.210 * (t / b) * (1.0 - (1.0 / 12.0) * pow((t / b), 4)));
// set Ks using Timoshenko-Gere formula for solid rect.shapes
double poisson = this->E / (2.0 * this->G) - 1.0;
this->Ks_y = 10.0 * (1.0 + poisson) / (12.0 + 11.0 * poisson);
this->Ks_z = this->Ks_y;
}
/// Shortcut: set Area, Ixx, Iyy, Ksy, Ksz and J torsion constant
/// at once, given the diameter of the beam assumed
/// with circular shape.
void ChElasticityTimoshenkoSimple::SetAsCircularSection(double diameter) {
this->Izz = (CH_C_PI / 4.0) * pow((0.5 * diameter), 4);
this->Iyy = Izz;
// exact expression for circular beam J = Ixx ,
// where for polar theorem Ixx = Izz+Iyy
this->J = Izz + Iyy;
// set Ks using Timoshenko-Gere formula for solid circular shape
double poisson = this->E / (2.0 * this->G) - 1.0;
this->Ks_y = 6.0 * (1.0 + poisson) / (7.0 + 6.0 * poisson);
this->Ks_z = this->Ks_y;
}
void ChElasticityTimoshenkoSimple::ComputeStress(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
stress_n.x() = E * section->Area * strain_n.x();
stress_n.y() = Ks_y * G * section->Area * strain_n.y();
stress_n.z() = Ks_z * G * section->Area * strain_n.z();
stress_m.x() = G * J * strain_m.x();
stress_m.y() = E * Iyy * strain_m.y();
stress_m.z() = E * Izz * strain_m.z();
}
/// Compute the 6x6 tangent material stiffness matrix [Km] =d\sigma/d\epsilon
void ChElasticityTimoshenkoSimple::ComputeStiffnessMatrix(
ChMatrixDynamic<>& K, ///< return the 6x6 stiffness matrix
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
K.Reset(6, 6);
K(0, 0) = E * section->Area;
K(1, 1) = Ks_y * G * section->Area;
K(2, 2) = Ks_z * G * section->Area;
K(3, 3) = G * J;
K(4, 4) = E * Iyy;
K(5, 5) = E * Izz;
}
////////////////////////////////////////////////////////////////////////////////////
void ChElasticityTimoshenkoAdvanced::ComputeStress(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
double Area = section->Area;
double cos_alpha = cos(alpha);
double sin_alpha = sin(alpha);
double a11 = E * section->Area;
double a22 = E * (Iyy * pow(cos_alpha, 2.) + Izz * pow(sin_alpha, 2.) + Cz * Cz * Area);
double a33 = E * (Izz * pow(cos_alpha, 2.) + Iyy * pow(sin_alpha, 2.) + Cy * Cy * Area);
double a12 = Cz * E * Area;
double a13 = -Cy * E * Area;
double a23 = (E* Iyy - E * Izz)*cos_alpha*sin_alpha - E * Cy * Cz * Area;
stress_n.x() = a11 * strain_n.x() + a12 * strain_m.y() + a13 * strain_m.z();
stress_m.y() = a12 * strain_n.x() + a22 * strain_m.y() + a23 * strain_m.z();
stress_m.z() = a13 * strain_n.x() + a23 * strain_m.y() + a33 * strain_m.z();
double cos_beta = cos(beta);
double sin_beta = sin(beta);
double KsyGA = Ks_y * G * Area;
double KszGA = Ks_z * G * Area;
double s11 = KsyGA * pow(cos_beta, 2.) + KszGA * pow(sin_beta, 2.);
double s22 = KsyGA * pow(sin_beta, 2.) + KszGA * pow(cos_beta, 2.); // ..+s_loc_12*sin(beta)*cos(beta);
double s33 = G * J + Sz * Sz * KsyGA + Sy * Sy * KszGA;
double s12 = (KszGA - KsyGA) * sin_beta * cos_beta;
double s13 = Sy * KszGA * sin_beta - Sz * KsyGA * cos_beta;
double s23 = Sy * KszGA * cos_beta + Sz * KsyGA * sin_beta;
stress_n.y() = s11 * strain_n.y() + s12 * strain_n.z() + s13 * strain_m.x();
stress_n.z() = s12 * strain_n.y() + s22 * strain_n.z() + s23 * strain_m.x();
stress_m.x() = s13 * strain_n.y() + s23 * strain_n.z() + s33 * strain_m.x();
}
/// Compute the 6x6 tangent material stiffness matrix [Km] =d\sigma/d\epsilon
void ChElasticityTimoshenkoAdvanced::ComputeStiffnessMatrix(
ChMatrixDynamic<>& K, ///< return the 6x6 stiffness matrix
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
K.Reset(6, 6);
double Area = section->Area;
double cos_alpha = cos(alpha);
double sin_alpha = sin(alpha);
double a11 = E * section->Area;
double a22 = E * (Iyy * pow(cos_alpha, 2.) + Izz * pow(sin_alpha, 2.) + Cz * Cz * Area);
double a33 = E * (Izz * pow(cos_alpha, 2.) + Iyy * pow(sin_alpha, 2.) + Cy * Cy * Area);
double a12 = Cz * E * Area;
double a13 = -Cy * E * Area;
double a23 = (E* Iyy - E * Izz)*cos_alpha*sin_alpha - E * Cy * Cz * Area;
double cos_beta = cos(beta);
double sin_beta = sin(beta);
double KsyGA = Ks_y * G * Area;
double KszGA = Ks_z * G * Area;
double s11 = KsyGA * pow(cos_beta, 2.) + KszGA * pow(sin_beta, 2.);
double s22 = KsyGA * pow(sin_beta, 2.) + KszGA * pow(cos_beta, 2.); // ..+s_loc_12*sin(beta)*cos(beta);
double s33 = G * J + Sz * Sz * KsyGA + Sy * Sy * KszGA;
double s12 = (KszGA - KsyGA) * sin_beta * cos_beta;
double s13 = Sy * KszGA * sin_beta - Sz * KsyGA * cos_beta;
double s23 = Sy * KszGA * cos_beta + Sz * KsyGA * sin_beta;
K(0, 0) = a11;
K(0, 4) = a12;
K(0, 5) = a13;
K(1, 1) = s11;
K(1, 2) = s12;
K(1, 3) = s13;
K(2, 1) = s12;
K(2, 2) = s22;
K(2, 3) = s23;
K(3, 1) = s13;
K(3, 2) = s23;
K(3, 3) = s33;
K(4, 0) = a12;
K(4, 4) = a22;
K(4, 5) = a23;
K(5, 0) = a13;
K(5, 4) = a23;
K(5, 5) = a33;
}
////////////////////////////////////////////////////////////////////////////////////
bool ChPlasticityTimoshenkoLumped::ComputeStressWithReturnMapping(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
ChVector<>& e_strain_e_new, ///< return updated elastic strain (deformation part)
ChVector<>& e_strain_k_new, ///< return updated elastic strain (curvature part)
ChBeamMaterialInternalData& data_new,///< return updated material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
const ChVector<>& tot_strain_e, ///< trial tot strain (deformation part): x= elongation, y and z are shear
const ChVector<>& tot_strain_k, ///< trial tot strain (curvature part), x= torsion, y and z are line curvatures
const ChBeamMaterialInternalData& data ///< current material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
) {
auto mydata = dynamic_cast<const ChInternalDataLumpedTimoshenko*>(&data);
auto mydata_new = dynamic_cast<ChInternalDataLumpedTimoshenko*>(&data_new);
if (!mydata)
throw ChException("ComputeStressWithReturnMapping cannot cast data to ChInternalDataLumpedTimoshenko*.");
// Implement return mapping for a simple 1D plasticity model.
// Compute the elastic trial stress:
e_strain_e_new = tot_strain_e - mydata->p_strain_e;
e_strain_k_new = tot_strain_k - mydata->p_strain_k;
double p_strain_acc = mydata->p_strain_acc;
this->section->GetElasticity()->ComputeStress(stress_n, stress_m, e_strain_e_new, e_strain_k_new); //<<<< elastic sigma(epsilon)
// compute yeld:
double strain_yeld_x = this->n_yeld_x->Get_y(mydata->p_strain_acc); ///<<<< sigma_y(p_strain_acc)
double eta_x = stress_n.x() - this->n_beta_x->Get_y(mydata->p_strain_e.x()); ///<<<< beta(p_strain_e)
double Fyeld_x = fabs(eta_x) - strain_yeld_x; //<<<< Phi(sigma,p_strain_acc)
if (Fyeld_x < 0)
return false;
// NR loop to compute plastic multiplier:
double Dgamma = 0;
double Dgamma_old = 0;
mydata_new->p_strain_acc = mydata->p_strain_acc;
mydata_new->p_strain_e.x() = mydata->p_strain_e.x();
int iters = 0;
while ((Fyeld_x > this->nr_yeld_tolerance) && (iters < this->nr_yeld_maxiters)) {
double E_x = stress_n.x() / e_strain_e_new.x(); //instead of costly evaluation of Km, =dstress/dstrain
double H = this->n_beta_x->Get_y_dx(mydata->p_strain_e.x())
+ this->n_yeld_x->Get_y_dx(mydata->p_strain_acc); //<<<< H = dyeld/dplasticflow
Dgamma -= Fyeld_x / (-E_x - H);
double dDgamma = Dgamma - Dgamma_old;
Dgamma_old = Dgamma;
mydata_new->p_strain_acc += dDgamma;
e_strain_e_new.x() -= dDgamma * chrono::ChSignum(stress_n.x());
mydata_new->p_strain_e.x() += dDgamma * chrono::ChSignum(stress_n.x());
this->section->GetElasticity()->ComputeStress(stress_n, stress_m, e_strain_e_new, e_strain_k_new); //<<<< elastic sigma(epsilon)
// compute yeld
strain_yeld_x = this->n_yeld_x->Get_y(mydata_new->p_strain_acc); ///<<<< sigma_y(p_strain_acc)
eta_x = stress_n.x() - this->n_beta_x->Get_y(mydata_new->p_strain_e.x()); ///<<<< beta(p_strain_acc)
Fyeld_x = fabs(eta_x) - strain_yeld_x; //<<<< Phi(sigma,p_strain_acc)
++iters;
}
//mydata_new->p_strain_e.x() += Dgamma * chrono::ChSignum(stress_n.x());
return true;
};
////////////////////////////////////////////////////////////////////////////////////
void ChPlasticityTimoshenko::ComputeStiffnessMatrixElastoplastic(
ChMatrixDynamic<>& K, ///< return the 6x6 material stiffness matrix values here
const ChVector<>& strain_n, ///< tot strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m, ///< tot strain (curvature part), x= torsion, y and z are line curvatures
const ChBeamMaterialInternalData& data ///< get & return updated material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
) {
ChVector<> astress_n;
ChVector<> astress_m;
ChVector<> me_strain_n_new; // needed only as placeholder
ChVector<> me_strain_m_new; // needed only as placeholder
std::vector< std::unique_ptr<ChBeamMaterialInternalData> > a_plastic_data;
this->CreatePlasticityData(1, a_plastic_data);
std::vector< std::unique_ptr<ChBeamMaterialInternalData> > b_plastic_data;
this->CreatePlasticityData(1, b_plastic_data);
bool in_plastic = ComputeStressWithReturnMapping(astress_n, astress_m, me_strain_n_new, me_strain_m_new, *a_plastic_data[0], strain_n, strain_m, data);
if (!in_plastic) {
// if no return mapping is needed at this strain state, just use elastic matrix:
return this->section->GetElasticity()->ComputeStiffnessMatrix(K, strain_n, strain_m);
}
else {
// if return mapping is needed at this strain state, compute the elastoplastic stiffness by brute force BDF
double epsi = 1e-6;
double invepsi = 1.0 / epsi;
ChVector<> bstress_n;
ChVector<> bstress_m;
ChVector<> strain_n_inc = strain_n;
ChVector<> strain_m_inc = strain_m;
for (int i = 0;i < 2; ++i) {
strain_n_inc[i] += epsi;
this->ComputeStressWithReturnMapping(bstress_n, bstress_m, me_strain_n_new, me_strain_m_new, *b_plastic_data[0], strain_n_inc, strain_m_inc, data);
K.PasteVector((bstress_n - astress_n)*invepsi, 0, i);
K.PasteVector((bstress_m - astress_m)*invepsi, 3, i);
strain_n_inc[i] -= epsi;
}
for (int i = 0;i < 2; ++i) {
strain_m_inc[i] += epsi;
this->ComputeStressWithReturnMapping(bstress_n, bstress_m, me_strain_n_new, me_strain_m_new, *b_plastic_data[0], strain_n_inc, strain_m_inc, data);
K.PasteVector((bstress_n - astress_n)*invepsi, 0, i + 3);
K.PasteVector((bstress_m - astress_m)*invepsi, 3, i + 3);
strain_m_inc[i] -= epsi;
}
}
}
} // end namespace fea
} // end namespace chrono
| 43.57947 | 158 | 0.649723 | LongJohnCoder |
159875b6b5c85376f5b923d32e423bfc9c594dc3 | 140,498 | cpp | C++ | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 496 | 2016-06-10T04:16:47.000Z | 2022-01-24T19:37:03.000Z | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 91 | 2016-07-26T13:18:48.000Z | 2021-08-10T08:54:18.000Z | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 63 | 2016-07-22T17:15:46.000Z | 2021-08-20T03:18:42.000Z | extern "C" {
unsigned char simit_gpu_intrinsics[] = {
59, 32, 73, 110, 116, 101, 110, 116, 105, 111, 110, 97, 108, 108, 121, 32, 98, 108, 97, 110, 107, 46, 32, 87, 101, 32, 99, 97, 110, 32, 105, 110, 99, 108, 117, 100, 101, 32, 76, 76, 32, 65, 83, 77, 32, 71, 80, 85, 32, 105, 110, 116, 114, 105, 110, 115, 105, 99, 32, 105, 109, 112, 108, 101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 115, 44, 32, 97, 115, 32, 119, 101, 108, 108, 46, 10, 59, 32, 78, 86, 86, 77, 32, 55, 46, 48, 32, 100, 101, 109, 97, 110, 100, 115, 32, 97, 32, 116, 97, 114, 103, 101, 116, 32, 116, 114, 105, 112, 108, 101, 10, 116, 97, 114, 103, 101, 116, 32, 116, 114, 105, 112, 108, 101, 32, 61, 32, 34, 110, 118, 112, 116, 120, 54, 52, 45, 110, 118, 105, 100, 105, 97, 45, 99, 117, 100, 97, 34, 10, 59, 32, 77, 111, 100, 117, 108, 101, 73, 68, 32, 61, 32, 39, 108, 105, 110, 97, 108, 103, 46, 99, 39, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 105, 51, 50, 32, 64, 108, 111, 99, 40, 105, 51, 50, 32, 37, 118, 48, 44, 32, 105, 51, 50, 32, 37, 118, 49, 44, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 44, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 118, 48, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 118, 49, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 108, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 118, 48, 44, 32, 105, 51, 50, 42, 32, 37, 118, 48, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 118, 49, 44, 32, 105, 51, 50, 42, 32, 37, 118, 49, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 118, 48, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 100, 120, 112, 114, 111, 109, 32, 61, 32, 115, 101, 120, 116, 32, 105, 51, 50, 32, 37, 48, 32, 116, 111, 32, 105, 54, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 42, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 49, 44, 32, 105, 54, 52, 32, 37, 105, 100, 120, 112, 114, 111, 109, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 98, 114, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 44, 32, 37, 101, 110, 116, 114, 121, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 100, 120, 112, 114, 111, 109, 49, 32, 61, 32, 115, 101, 120, 116, 32, 105, 51, 50, 32, 37, 51, 32, 116, 111, 32, 105, 54, 52, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 42, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 37, 105, 100, 120, 112, 114, 111, 109, 49, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 118, 49, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 109, 112, 32, 61, 32, 105, 99, 109, 112, 32, 110, 101, 32, 105, 51, 50, 32, 37, 53, 44, 32, 37, 54, 10, 32, 32, 98, 114, 32, 105, 49, 32, 37, 99, 109, 112, 44, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 44, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 101, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 110, 99, 32, 61, 32, 97, 100, 100, 32, 110, 115, 119, 32, 105, 51, 50, 32, 37, 55, 44, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 105, 110, 99, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 98, 114, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 101, 110, 100, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 114, 101, 116, 32, 105, 51, 50, 32, 37, 56, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 100, 111, 117, 98, 108, 101, 32, 64, 100, 101, 116, 51, 95, 102, 54, 52, 40, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 44, 32, 37, 53, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 44, 32, 37, 57, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 53, 10, 32, 32, 37, 109, 117, 108, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 44, 32, 37, 115, 117, 98, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 51, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 115, 117, 98, 49, 52, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 49, 48, 44, 32, 37, 109, 117, 108, 49, 51, 10, 32, 32, 37, 109, 117, 108, 49, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 49, 44, 32, 37, 115, 117, 98, 49, 52, 10, 32, 32, 37, 115, 117, 98, 49, 54, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 54, 44, 32, 37, 109, 117, 108, 49, 53, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 51, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 51, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 55, 44, 32, 37, 50, 57, 10, 32, 32, 37, 115, 117, 98, 50, 52, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 48, 44, 32, 37, 109, 117, 108, 50, 51, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 49, 44, 32, 37, 115, 117, 98, 50, 52, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 49, 54, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 114, 101, 116, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 102, 108, 111, 97, 116, 32, 64, 100, 101, 116, 51, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 42, 32, 37, 97, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 44, 32, 37, 53, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 44, 32, 37, 57, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 53, 10, 32, 32, 37, 109, 117, 108, 54, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 44, 32, 37, 115, 117, 98, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 115, 117, 98, 49, 52, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 49, 48, 44, 32, 37, 109, 117, 108, 49, 51, 10, 32, 32, 37, 109, 117, 108, 49, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 49, 44, 32, 37, 115, 117, 98, 49, 52, 10, 32, 32, 37, 115, 117, 98, 49, 54, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 54, 44, 32, 37, 109, 117, 108, 49, 53, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 51, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 55, 44, 32, 37, 50, 57, 10, 32, 32, 37, 115, 117, 98, 50, 52, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 48, 44, 32, 37, 109, 117, 108, 50, 51, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 49, 44, 32, 37, 115, 117, 98, 50, 52, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 49, 54, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 114, 101, 116, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 118, 111, 105, 100, 32, 64, 105, 110, 118, 51, 95, 102, 54, 52, 40, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 105, 110, 118, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 100, 101, 116, 101, 114, 109, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 105, 110, 118, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 44, 32, 37, 51, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 53, 44, 32, 37, 55, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 54, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 57, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 54, 44, 32, 37, 49, 49, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 49, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 44, 32, 37, 109, 117, 108, 49, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 49, 44, 32, 37, 50, 51, 10, 32, 32, 37, 115, 117, 98, 49, 56, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 49, 52, 44, 32, 37, 109, 117, 108, 49, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 49, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 50, 48, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 50, 48, 44, 32, 37, 50, 55, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 48, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 51, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 57, 44, 32, 37, 51, 49, 10, 32, 32, 37, 97, 100, 100, 50, 54, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 50, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 50, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 51, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 57, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 51, 44, 32, 37, 51, 53, 10, 32, 32, 37, 51, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 54, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 51, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 51, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 51, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 55, 44, 32, 37, 51, 57, 10, 32, 32, 37, 115, 117, 98, 51, 51, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 57, 44, 32, 37, 109, 117, 108, 51, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 51, 51, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 52, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 51, 53, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 52, 49, 10, 32, 32, 37, 52, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 50, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 52, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 51, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 51, 53, 44, 32, 37, 52, 51, 10, 32, 32, 37, 52, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 54, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 52, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 52, 53, 44, 32, 37, 52, 55, 10, 32, 32, 37, 97, 100, 100, 52, 49, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 51, 55, 44, 32, 37, 109, 117, 108, 52, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 52, 49, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 48, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 52, 57, 44, 32, 37, 53, 49, 10, 32, 32, 37, 53, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 50, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 53, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 52, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 53, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 53, 51, 44, 32, 37, 53, 53, 10, 32, 32, 37, 115, 117, 98, 52, 56, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 52, 52, 44, 32, 37, 109, 117, 108, 52, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 52, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 54, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 53, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 53, 48, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 53, 55, 10, 32, 32, 37, 53, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 56, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 53, 48, 44, 32, 37, 53, 57, 10, 32, 32, 37, 54, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 54, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 54, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 49, 44, 32, 37, 54, 51, 10, 32, 32, 37, 97, 100, 100, 53, 54, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 53, 50, 44, 32, 37, 109, 117, 108, 53, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 53, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 54, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 54, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 57, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 53, 44, 32, 37, 54, 55, 10, 32, 32, 37, 54, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 54, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 48, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 55, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 57, 44, 32, 37, 55, 49, 10, 32, 32, 37, 115, 117, 98, 54, 51, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 53, 57, 44, 32, 37, 109, 117, 108, 54, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 54, 51, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 55, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 51, 44, 32, 37, 55, 52, 10, 32, 32, 37, 55, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 53, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 55, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 54, 44, 32, 37, 55, 55, 10, 32, 32, 37, 97, 100, 100, 54, 56, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 54, 53, 44, 32, 37, 109, 117, 108, 54, 55, 10, 32, 32, 37, 55, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 55, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 57, 44, 32, 37, 56, 48, 10, 32, 32, 37, 97, 100, 100, 55, 49, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 54, 56, 44, 32, 37, 109, 117, 108, 55, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 55, 49, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 100, 105, 118, 32, 61, 32, 102, 100, 105, 118, 32, 100, 111, 117, 98, 108, 101, 32, 49, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 56, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 100, 105, 118, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 50, 44, 32, 37, 56, 51, 10, 32, 32, 37, 56, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 50, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 53, 44, 32, 37, 56, 54, 10, 32, 32, 37, 56, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 55, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 52, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 56, 44, 32, 37, 56, 57, 10, 32, 32, 37, 57, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 49, 44, 32, 37, 57, 50, 10, 32, 32, 37, 57, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 51, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 52, 44, 32, 37, 57, 53, 10, 32, 32, 37, 57, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 48, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 55, 44, 32, 37, 57, 56, 10, 32, 32, 37, 57, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 57, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 50, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 48, 44, 32, 37, 49, 48, 49, 10, 32, 32, 37, 49, 48, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 52, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 51, 44, 32, 37, 49, 48, 52, 10, 32, 32, 37, 49, 48, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 53, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 54, 44, 32, 37, 49, 48, 55, 10, 32, 32, 37, 49, 48, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 56, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 114, 101, 116, 32, 118, 111, 105, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 118, 111, 105, 100, 32, 64, 105, 110, 118, 51, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 110, 118, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 48, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 48, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 100, 101, 116, 101, 114, 109, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 110, 118, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 44, 32, 37, 51, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 53, 44, 32, 37, 55, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 54, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 57, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 54, 44, 32, 37, 49, 49, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 44, 32, 37, 109, 117, 108, 49, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 49, 44, 32, 37, 50, 51, 10, 32, 32, 37, 115, 117, 98, 49, 56, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 49, 52, 44, 32, 37, 109, 117, 108, 49, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 49, 56, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 50, 48, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 50, 48, 44, 32, 37, 50, 55, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 48, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 51, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 57, 44, 32, 37, 51, 49, 10, 32, 32, 37, 97, 100, 100, 50, 54, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 50, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 50, 54, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 51, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 51, 44, 32, 37, 51, 53, 10, 32, 32, 37, 51, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 54, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 51, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 51, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 51, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 55, 44, 32, 37, 51, 57, 10, 32, 32, 37, 115, 117, 98, 51, 51, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 57, 44, 32, 37, 109, 117, 108, 51, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 51, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 52, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 51, 53, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 52, 49, 10, 32, 32, 37, 52, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 50, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 52, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 51, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 51, 53, 44, 32, 37, 52, 51, 10, 32, 32, 37, 52, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 54, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 52, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 52, 53, 44, 32, 37, 52, 55, 10, 32, 32, 37, 97, 100, 100, 52, 49, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 51, 55, 44, 32, 37, 109, 117, 108, 52, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 52, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 48, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 52, 57, 44, 32, 37, 53, 49, 10, 32, 32, 37, 53, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 50, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 53, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 52, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 53, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 53, 51, 44, 32, 37, 53, 53, 10, 32, 32, 37, 115, 117, 98, 52, 56, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 52, 52, 44, 32, 37, 109, 117, 108, 52, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 52, 56, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 54, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 53, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 53, 48, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 53, 55, 10, 32, 32, 37, 53, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 56, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 53, 48, 44, 32, 37, 53, 57, 10, 32, 32, 37, 54, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 54, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 54, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 49, 44, 32, 37, 54, 51, 10, 32, 32, 37, 97, 100, 100, 53, 54, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 53, 50, 44, 32, 37, 109, 117, 108, 53, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 53, 54, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 54, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 54, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 53, 44, 32, 37, 54, 55, 10, 32, 32, 37, 54, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 54, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 48, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 55, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 57, 44, 32, 37, 55, 49, 10, 32, 32, 37, 115, 117, 98, 54, 51, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 53, 57, 44, 32, 37, 109, 117, 108, 54, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 54, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 55, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 51, 44, 32, 37, 55, 52, 10, 32, 32, 37, 55, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 53, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 55, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 54, 44, 32, 37, 55, 55, 10, 32, 32, 37, 97, 100, 100, 54, 56, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 54, 53, 44, 32, 37, 109, 117, 108, 54, 55, 10, 32, 32, 37, 55, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 55, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 57, 44, 32, 37, 56, 48, 10, 32, 32, 37, 97, 100, 100, 55, 49, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 54, 56, 44, 32, 37, 109, 117, 108, 55, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 55, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 110, 118, 32, 61, 32, 102, 112, 101, 120, 116, 32, 102, 108, 111, 97, 116, 32, 37, 56, 49, 32, 116, 111, 32, 100, 111, 117, 98, 108, 101, 10, 32, 32, 37, 100, 105, 118, 32, 61, 32, 102, 100, 105, 118, 32, 100, 111, 117, 98, 108, 101, 32, 49, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 99, 111, 110, 118, 10, 32, 32, 37, 99, 111, 110, 118, 55, 50, 32, 61, 32, 102, 112, 116, 114, 117, 110, 99, 32, 100, 111, 117, 98, 108, 101, 32, 37, 100, 105, 118, 32, 116, 111, 32, 102, 108, 111, 97, 116, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 99, 111, 110, 118, 55, 50, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 50, 44, 32, 37, 56, 51, 10, 32, 32, 37, 56, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 53, 44, 32, 37, 56, 54, 10, 32, 32, 37, 56, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 55, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 53, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 56, 44, 32, 37, 56, 57, 10, 32, 32, 37, 57, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 55, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 49, 44, 32, 37, 57, 50, 10, 32, 32, 37, 57, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 51, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 57, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 52, 44, 32, 37, 57, 53, 10, 32, 32, 37, 57, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 55, 44, 32, 37, 57, 56, 10, 32, 32, 37, 57, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 57, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 48, 44, 32, 37, 49, 48, 49, 10, 32, 32, 37, 49, 48, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 53, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 51, 44, 32, 37, 49, 48, 52, 10, 32, 32, 37, 49, 48, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 53, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 55, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 54, 44, 32, 37, 49, 48, 55, 10, 32, 32, 37, 49, 48, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 56, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 57, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 114, 101, 116, 32, 118, 111, 105, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 102, 108, 111, 97, 116, 32, 64, 99, 111, 109, 112, 108, 101, 120, 78, 111, 114, 109, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 32, 37, 114, 44, 32, 102, 108, 111, 97, 116, 32, 37, 105, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 114, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 114, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 105, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 48, 44, 32, 37, 49, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 44, 32, 37, 51, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 49, 10, 32, 32, 37, 99, 97, 108, 108, 32, 61, 32, 99, 97, 108, 108, 32, 102, 108, 111, 97, 116, 32, 64, 95, 95, 110, 118, 95, 115, 113, 114, 116, 102, 40, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 41, 10, 32, 32, 114, 101, 116, 32, 102, 108, 111, 97, 116, 32, 37, 99, 97, 108, 108, 10, 125, 10, 10, 100, 101, 99, 108, 97, 114, 101, 32, 102, 108, 111, 97, 116, 32, 64, 95, 95, 110, 118, 95, 115, 113, 114, 116, 102, 40, 102, 108, 111, 97, 116, 41, 10, 10, 10, 33, 108, 108, 118, 109, 46, 105, 100, 101, 110, 116, 32, 61, 32, 33, 123, 33, 48, 125, 10, 10, 33, 48, 32, 61, 32, 33, 123, 33, 34, 99, 108, 97, 110, 103, 32, 118, 101, 114, 115, 105, 111, 110, 32, 51, 46, 55, 46, 49, 32, 40, 98, 114, 97, 110, 99, 104, 101, 115, 47, 114, 101, 108, 101, 97, 115, 101, 95, 51, 55, 32, 50, 54, 56, 57, 54, 55, 41, 32, 40, 108, 108, 118, 109, 47, 98, 114, 97, 110, 99, 104, 101, 115, 47, 114, 101, 108, 101, 97, 115, 101, 95, 51, 55, 32, 50, 54, 56, 57, 54, 54, 41, 34, 125, 10, 0};
int simit_gpu_intrinsics_length = 31428;
}
| 23,416.333333 | 140,400 | 0.552435 | huangjd |
159bd0a283a65730be8195d921ba0766b618c20e | 441 | hpp | C++ | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | 5 | 2016-04-07T19:49:39.000Z | 2021-08-03T05:24:11.000Z | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | null | null | null | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | 1 | 2020-12-27T11:47:31.000Z | 2020-12-27T11:47:31.000Z | /*
* buffers_fwd.hpp
*
* Created on: Feb 3, 2016
* Author: zmij
*/
#ifndef WIRE_ENCODING_BUFFERS_FWD_HPP_
#define WIRE_ENCODING_BUFFERS_FWD_HPP_
#include <memory>
namespace wire {
namespace encoding {
class outgoing;
typedef std::shared_ptr< outgoing > outgoing_ptr;
class incoming;
typedef std::shared_ptr< incoming > incoming_ptr;
} // namespace encoding
} // namespace wire
#endif /* WIRE_ENCODING_BUFFERS_FWD_HPP_ */
| 16.961538 | 49 | 0.741497 | zmij |
159dec75e8ed94395b369b35892c254e2e5d6fdc | 2,385 | cpp | C++ | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | 3 | 2019-05-20T10:06:37.000Z | 2021-08-08T02:30:23.000Z | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | null | null | null | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | null | null | null | #include "ofApp.h"
using namespace ofxNNG;
//--------------------------------------------------------------
void ofApp::setup(){
// 4 buses making all-to-all mesh connection
bus_.resize(4);
for(int i = 0; i < bus_.size(); ++i) {
auto &b = bus_[i];
b = std::make_shared<Bus>();
b->setup();
b->setCallback<std::string, int>([i](const std::string& str, int index) {
ofLogNotice("node "+ofToString(i)+" receive from "+ofToString(index)) << str;
});
std::string recv_url = "inproc://bus"+ofToString(i);
b->createListener(recv_url)->start();
for(int j = i+1; j < bus_.size(); ++j) {
std::string send_url = "inproc://bus"+ofToString(j);
b->createDialer(send_url)->start();
}
}
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofDrawBitmapString("press 1,2,3,4 and see console to know what happens", 10, 14);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
int index = key-'1';
if(index >= 0 && index < bus_.size()) {
bus_[key-'1']->send({"message from node "+ofToString(index), index});
ofLogNotice("from node "+ofToString(index)+" send");
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
| 25.923913 | 82 | 0.398323 | nariakiiwatani |
159e96bdaf5be73811866b2fe6e53659e6dec646 | 1,057 | hh | C++ | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | #include "xtcdata/xtc/VarDef.hh"
#include "xtcdata/xtc/NamesLookup.hh"
#include <stdint.h>
namespace XtcData {
class Xtc;
class NamesId;
};
namespace Drp {
class TimingDef : public XtcData::VarDef
{
public:
enum index {
pulseId,
timeStamp,
fixedRates,
acRates,
timeSlot,
timeSlotPhase,
ebeamPresent,
ebeamDestn,
ebeamCharge,
ebeamEnergy,
xWavelength,
dmod5,
mpsLimits,
mpsPowerClass,
sequenceValues,
};
TimingDef();
static void describeData (XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*);
static void createDataNoBSA(XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*);
static void createDataETM (XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*, const uint8_t*);
};
};
| 27.102564 | 144 | 0.579943 | slac-lcls |
15ad04e847d7d35124bbd4a2f748de637d1ff1c4 | 3,921 | cpp | C++ | YorozuyaGSLib/source/std__bad_allocDetail.cpp | lemkova/Yorozuya | f445d800078d9aba5de28f122cedfa03f26a38e4 | [
"MIT"
] | 29 | 2017-07-01T23:08:31.000Z | 2022-02-19T10:22:45.000Z | YorozuyaGSLib/source/std__bad_allocDetail.cpp | kotopes/Yorozuya | 605c97d3a627a8f6545cc09f2a1b0a8afdedd33a | [
"MIT"
] | 90 | 2017-10-18T21:24:51.000Z | 2019-06-06T02:30:33.000Z | YorozuyaGSLib/source/std__bad_allocDetail.cpp | kotopes/Yorozuya | 605c97d3a627a8f6545cc09f2a1b0a8afdedd33a | [
"MIT"
] | 44 | 2017-12-19T08:02:59.000Z | 2022-02-24T23:15:01.000Z | #include <common/ATFCore.hpp>
#include <std__bad_allocDetail.hpp>
START_ATF_NAMESPACE
namespace std
{
namespace Detail
{
Info::std__bad_allocctor_bad_alloc5_ptr std__bad_allocctor_bad_alloc5_next(nullptr);
Info::std__bad_allocctor_bad_alloc5_clbk std__bad_allocctor_bad_alloc5_user(nullptr);
Info::std__bad_allocctor_bad_alloc7_ptr std__bad_allocctor_bad_alloc7_next(nullptr);
Info::std__bad_allocctor_bad_alloc7_clbk std__bad_allocctor_bad_alloc7_user(nullptr);
Info::std__bad_allocctor_bad_alloc8_ptr std__bad_allocctor_bad_alloc8_next(nullptr);
Info::std__bad_allocctor_bad_alloc8_clbk std__bad_allocctor_bad_alloc8_user(nullptr);
Info::std__bad_allocdtor_bad_alloc10_ptr std__bad_allocdtor_bad_alloc10_next(nullptr);
Info::std__bad_allocdtor_bad_alloc10_clbk std__bad_allocdtor_bad_alloc10_user(nullptr);
void std__bad_allocctor_bad_alloc5_wrapper(struct std::bad_alloc* _this, char* _Message)
{
std__bad_allocctor_bad_alloc5_user(_this, _Message, std__bad_allocctor_bad_alloc5_next);
};
void std__bad_allocctor_bad_alloc7_wrapper(struct std::bad_alloc* _this, struct std::bad_alloc* __that)
{
std__bad_allocctor_bad_alloc7_user(_this, __that, std__bad_allocctor_bad_alloc7_next);
};
int64_t std__bad_allocctor_bad_alloc8_wrapper(struct std::bad_alloc* _this)
{
return std__bad_allocctor_bad_alloc8_user(_this, std__bad_allocctor_bad_alloc8_next);
};
void std__bad_allocdtor_bad_alloc10_wrapper(struct std::bad_alloc* _this)
{
std__bad_allocdtor_bad_alloc10_user(_this, std__bad_allocdtor_bad_alloc10_next);
};
::std::array<hook_record, 4> bad_alloc_functions =
{
_hook_record {
(LPVOID)0x14007efb0L,
(LPVOID *)&std__bad_allocctor_bad_alloc5_user,
(LPVOID *)&std__bad_allocctor_bad_alloc5_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc5_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)(char*))&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14007f0f0L,
(LPVOID *)&std__bad_allocctor_bad_alloc7_user,
(LPVOID *)&std__bad_allocctor_bad_alloc7_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc7_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)(struct std::bad_alloc*))&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14061f760L,
(LPVOID *)&std__bad_allocctor_bad_alloc8_user,
(LPVOID *)&std__bad_allocctor_bad_alloc8_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc8_wrapper),
(LPVOID)cast_pointer_function((int64_t(std::bad_alloc::*)())&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14007f020L,
(LPVOID *)&std__bad_allocdtor_bad_alloc10_user,
(LPVOID *)&std__bad_allocdtor_bad_alloc10_next,
(LPVOID)cast_pointer_function(std__bad_allocdtor_bad_alloc10_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)())&std::bad_alloc::dtor_bad_alloc)
},
};
}; // end namespace Detail
}; // end namespace std
END_ATF_NAMESPACE
| 48.407407 | 131 | 0.61974 | lemkova |
15ae7e40fa3cf309f1ddce6eb06d7b2ee6d40d03 | 7,860 | hpp | C++ | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 10 | 2018-06-28T00:21:46.000Z | 2022-03-30T03:31:32.000Z | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 35 | 2019-03-19T21:54:46.000Z | 2022-03-17T02:20:42.000Z | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 8 | 2018-10-27T19:35:13.000Z | 2022-01-06T01:10:39.000Z | // CHAP - The Channel Annotation Package
//
// Copyright (c) 2016 - 2018 Gianni Klesse, Shanlin Rao, Mark S. P. Sansom, and
// Stephen J. Tucker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef MOLECULAR_PATH_HPP
#define MOLECULAR_PATH_HPP
#include <map>
#include <string>
#include <vector>
#include <gromacs/math/vec.h>
#include <gromacs/pbcutil/pbc.h>
#include <gromacs/utility/real.h>
#include <gromacs/selection/selection.h>
#include "external/rapidjson/document.h"
#include "geometry/spline_curve_1D.hpp"
#include "geometry/spline_curve_3D.hpp"
/*!
* Enum for different methods for aligning molecular pathways between frames.
*/
enum ePathAlignmentMethod {ePathAlignmentMethodNone,
ePathAlignmentMethodIpp};
/*!
* \brief Parameter container for MolecularPath path mapping functionality.
*
* Note that this is not currently used, but is retained in case parameters
* need to be reintroduced at a later time.
*/
class PathMappingParameters
{
public:
};
/*!
* \brief Representation of a molecular pathway.
*
* This class is used to describe a molecular pathway (e.g. an ion channel
* pore). It is typically created by a class derived from AbstractPathFinder
* and permits access the pathways properties, such as its length(), volume(),
* or minRadius(). A MolecularPathObjExporter can be used to generate a
* mesh representing the pathways surface in the Wavefront Object format.
*
* Internally, the pathway is represented by a SplineCurve3D object, which
* describes a \f$ C^2 \f$ -continuous curve corresponding to the centre line
* of the pathway. A further SplineCurve1D object is used to describe the
* pathway's radius along the centre line. Together, these splines provide a
* means of determining where in the pathway a particle is located using
* mapSelection() and to decide whether a given particle lies inside the
* pathway or not using checkIfInside().
*
* The class also exposes several auxiliary functions such as samplePoints() or
* sampleRadii() to provide access to the properties of the centre line curve
* and radius spline directly.
*/
class MolecularPath
{
public:
// costructors and destructor:
MolecularPath(
std::vector<gmx::RVec> &pathPoints,
std::vector<real> &poreRadii);
MolecularPath(
const rapidjson::Document &doc);
/*
MolecularPath(
std::vector<real> poreRadiusKnots,
std::vector<real> poreRadiusCtrlPoints,
std::vector<real> centreLineKnots,
std::vector<gmx::RVec> centreLineCtrlPoints);*/
~MolecularPath();
// interface for mapping particles onto pathway:
std::vector<gmx::RVec> mapPositions(
const std::vector<gmx::RVec> &positions);
std::map<int, gmx::RVec> mapSelection(
const gmx::Selection &mapSel);
// check if points lie inside pore:
std::map<int, bool> checkIfInside(
const std::map<int, gmx::RVec> &mappedCoords,
real margin);
std::map<int, bool> checkIfInside(
const std::map<int, gmx::RVec> &mappedCoords,
real margin,
real sLo,
real sHi);
// centreline-mapped properties:
void addScalarProperty(
std::string name,
SplineCurve1D property,
bool divergent);
std::map<std::string, std::pair<SplineCurve1D, bool>> scalarProperties() const;
// access original points:
std::vector<gmx::RVec> pathPoints();
std::vector<real> pathRadii();
// access internal spline curves:
SplineCurve1D pathRadius();
SplineCurve3D centreLine();
// access aggregate properties of path:
real length() const;
std::pair<real, real> minRadius();
real volume();
real radius(real);
real sLo();
real sHi();
// access properties of splines
std::vector<real> poreRadiusKnots() const;
std::vector<real> poreRadiusUniqueKnots() const;
std::vector<real> poreRadiusCtrlPoints() const;
std::vector<real> centreLineKnots() const;
std::vector<real> centreLineUniqueKnots() const;
std::vector<gmx::RVec> centreLineCtrlPoints() const;
// sample points from centreline:
std::vector<real> sampleArcLength(
size_t nPoints,
real extrapDist) const;
std::vector<gmx::RVec> samplePoints(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> samplePoints(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleTangents(
size_t nPoints, real extrapDist);
std::vector<gmx::RVec> sampleTangents(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleNormTangents(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> sampleNormTangents(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleNormals(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> sampleNormals(
std::vector<real> arcLengthSample);
std::vector<real> sampleRadii(
size_t nPoints,
real extrapDist);
std::vector<real> sampleRadii(
std::vector<real> arcLengthSample);
// change internal coordinate representation of path:
void shift(const gmx::RVec &shift);
private:
// mathematical constants:
const real PI_ = std::acos(-1.0);
// utilities for sampling functions:
inline real sampleArcLenStep(
size_t nPoints,
real extrapDist) const;
// utilities for path mapping:
inline gmx::RVec mapPosition(
const gmx::RVec &cartCoord,
const std::vector<real> &arcLenSample,
const std::vector<gmx::RVec> &pathPointSample,
const real mapTol);
inline int numSamplePoints(const PathMappingParameters ¶ms);
// original path points and corresponding radii:
std::vector<gmx::RVec> pathPoints_;
std::vector<real> pathRadii_;
// pore centre line and corresponding radius:
SplineCurve3D centreLine_;
SplineCurve1D poreRadius_;
// properties mapped onto path:
std::map<std::string, std::pair<SplineCurve1D, bool>> properties_;
// properties of path:
real openingLo_;
real openingHi_;
real length_;
};
#endif
| 35.890411 | 87 | 0.640712 | bigginlab |
15aef5da8ac2751f9c8b2c5fbe1d14faf1e8002c | 2,249 | cpp | C++ | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 108 | 2018-10-08T17:03:32.000Z | 2022-03-21T00:52:26.000Z | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 287 | 2018-09-18T14:59:12.000Z | 2022-01-13T12:28:23.000Z | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 32 | 2018-10-19T14:35:03.000Z | 2021-11-12T09:36:46.000Z | /*
Copyright 2015 Kai Huebl (kai@huebl-sgh.de)
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Eine Kopie der Lizenz erhalten Sie auf http://www.apache.org/licenses/LICENSE-2.0.
Sofern nicht gemäß geltendem Recht vorgeschrieben oder schriftlich vereinbart,
erfolgt die Bereitstellung der im Rahmen der Lizenz verbreiteten Software OHNE
GEWÄHR ODER VORBEHALTE – ganz gleich, ob ausdrücklich oder stillschweigend.
Informationen über die jeweiligen Bedingungen für Genehmigungen und Einschränkungen
im Rahmen der Lizenz finden Sie in der Lizenz.
Autor: Kai Huebl (kai@huebl-sgh.de)
*/
#include "OpcUaStackCore/Base/Log.h"
#include "OpcUaStackCore/Base/Config.h"
#include "OpcUaStackServer/ServiceSet/SessionConfig.h"
#include "OpcUaStackServer/ServiceSet/EndpointDescriptionConfig.h"
using namespace OpcUaStackCore;
namespace OpcUaStackServer
{
#if 0
bool
SessionConfig::initial(SessionOld::SPtr sessionSPtr, const std::string& configPrefix, Config* config)
{
if (config == nullptr) config = Config::instance();
boost::optional<Config> childConfig = config->getChild(configPrefix);
if (!childConfig) {
Log(Error, "session server configuration not found")
.parameter("ConfigurationFileName", config->configFileName())
.parameter("ParameterPath", configPrefix);
return false;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
//
// create session
//
// --------------------------------------------------------------------------
//
// EndpointDescription - mandatory
//
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
EndpointDescriptionArray::SPtr endpointDescriptionArray = constructSPtr<EndpointDescriptionArray>();
if (!EndpointDescriptionConfig::endpointDescriptions(endpointDescriptionArray, configPrefix, config, config->configFileName())) {
return false;
}
sessionSPtr->endpointDescriptionArray(endpointDescriptionArray);
return true;
}
#endif
}
| 34.075758 | 131 | 0.629169 | gianricardo |
15af21755f70c2a97ce04b14c03e0425f34d82f3 | 1,571 | cpp | C++ | C++/199. BinaryTreeRightSideView.cpp | nizD/LeetCode-Solutions | 7f4ca37bab795e0d6f9bfd9148a8fe3b62aa5349 | [
"MIT"
] | 263 | 2020-10-05T18:47:29.000Z | 2022-03-31T19:44:46.000Z | C++/199. BinaryTreeRightSideView.cpp | nizD/LeetCode-Solutions | 7f4ca37bab795e0d6f9bfd9148a8fe3b62aa5349 | [
"MIT"
] | 1,264 | 2020-10-05T18:13:05.000Z | 2022-03-31T23:16:35.000Z | C++/199. BinaryTreeRightSideView.cpp | nizD/LeetCode-Solutions | 7f4ca37bab795e0d6f9bfd9148a8fe3b62aa5349 | [
"MIT"
] | 760 | 2020-10-05T18:22:51.000Z | 2022-03-29T06:06:20.000Z | // Problem - 199. Binary Tree Right Side View
/*
First we need to know what is the depth of the tree.
Once we know the depth of the tree, we can initialize a vector of that size.
Then we recursively add the rightmost element in every tree to that vector.
Note that it will always change the value in every iteration, but it does not matter
since the last one (rightmost one) will be assigned on top of it all.
Finally return the vector which contains the right side view of the binary tree.
*/
class Solution {
public:
void checkRight(vector<int> &right, TreeNode *currNode, int curr) {
if (currNode == NULL) {
return;
}
right[curr] = currNode->val;
checkRight(right, currNode->left, curr + 1);
checkRight(right, currNode->right, curr + 1);
}
int treeSize(TreeNode *node) {
if (node == NULL) {
return 0;
} else {
/* compute the depth of each subtree */
int lDepth = treeSize(node->left);
int rDepth = treeSize(node->right);
if (lDepth > rDepth) {
return (lDepth + 1);
} else {
return (rDepth + 1);
}
}
}
vector<int> rightSideView(TreeNode *root) {
int n = treeSize(root);
vector<int> right(n, 0);
if (root == NULL) {
return right;
}
right[0] = root->val;
checkRight(right, root->left, 1);
checkRight(right, root->right, 1);
return right;
}
}; | 31.42 | 89 | 0.562062 | nizD |
15b3463de06815d624443b011b41b3d274d4b536 | 2,076 | cpp | C++ | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | /**
* \file test/fiber/test_fiber_unexpected_event_callback_add.cpp
*
* \brief Unit tests for fiber_unexpected_event_callback_add.
*/
#include <minunit/minunit.h>
#include <rcpr/allocator.h>
#include <rcpr/fiber.h>
#include "../../src/fiber/common/fiber_internal.h"
RCPR_IMPORT_allocator;
RCPR_IMPORT_fiber;
RCPR_IMPORT_fiber_internal;
RCPR_IMPORT_resource;
RCPR_IMPORT_uuid;
TEST_SUITE(fiber_unexpected_event_callback_add);
static status dummy_event(
void*, fiber*, const rcpr_uuid*, int, void*, const rcpr_uuid*, int)
{
return STATUS_SUCCESS;
}
/**
* Verify that we can add an unexpected event callback function to a fiber.
*/
TEST(add)
{
allocator* alloc = nullptr;
fiber* f = nullptr;
fiber_scheduler* sched = nullptr;
int dummyval = 73;
/* we should be able to create a malloc allocator. */
TEST_ASSERT(
STATUS_SUCCESS == malloc_allocator_create(&alloc));
/* we should be able to create a disciplined fiber scheduler. */
TEST_ASSERT(
STATUS_SUCCESS ==
fiber_scheduler_create_with_disciplines(&sched, alloc));
/* we should be able to create a fiber for a thread. */
TEST_ASSERT(STATUS_SUCCESS == fiber_create_for_thread(&f, sched, alloc));
/* PRECONDITION: fiber unexpected event callback not set. */
TEST_ASSERT(nullptr == f->unexpected_fn);
TEST_ASSERT(nullptr == f->unexpected_context);
/* add a custom event callback to this fiber. */
TEST_ASSERT(
STATUS_SUCCESS ==
fiber_unexpected_event_callback_add(f, &dummy_event, &dummyval));
/* POSTCONDITION: fiber unexpected event callback is set. */
TEST_EXPECT(&dummy_event == f->unexpected_fn);
TEST_EXPECT(&dummyval == f->unexpected_context);
/* clean up. */
TEST_ASSERT(
STATUS_SUCCESS ==
resource_release(fiber_scheduler_resource_handle(sched)));
TEST_ASSERT(
STATUS_SUCCESS ==
resource_release(fiber_resource_handle(f)));
TEST_ASSERT(
STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
| 28.833333 | 78 | 0.701349 | nanolith |
15b47767428693545d768f5df21c9075bca008eb | 2,214 | cpp | C++ | poincare/src/hyperbolic_sine.cpp | VersiraSec/epsilon-cfw | d12b44c6c6668ecc14b60d8dd098ba5c230b1291 | [
"FSFAP"
] | 1,442 | 2017-08-28T19:39:45.000Z | 2022-03-30T00:56:14.000Z | poincare/src/hyperbolic_sine.cpp | VersiraSec/epsilon-cfw | d12b44c6c6668ecc14b60d8dd098ba5c230b1291 | [
"FSFAP"
] | 1,321 | 2017-08-28T23:03:10.000Z | 2022-03-31T19:32:17.000Z | poincare/src/hyperbolic_sine.cpp | VersiraSec/epsilon-cfw | d12b44c6c6668ecc14b60d8dd098ba5c230b1291 | [
"FSFAP"
] | 421 | 2017-08-28T22:02:39.000Z | 2022-03-28T20:52:21.000Z | #include <poincare/hyperbolic_sine.h>
#include <poincare/derivative.h>
#include <poincare/hyperbolic_cosine.h>
#include <poincare/layout_helper.h>
#include <poincare/serialization_helper.h>
namespace Poincare {
constexpr Expression::FunctionHelper HyperbolicSine::s_functionHelper;
Layout HyperbolicSineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return LayoutHelper::Prefix(HyperbolicSine(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicSine::s_functionHelper.name());
}
int HyperbolicSineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicSine::s_functionHelper.name());
}
template<typename T>
Complex<T> HyperbolicSineNode::computeOnComplex(const std::complex<T> c, Preferences::ComplexFormat, Preferences::AngleUnit angleUnit) {
return Complex<T>::Builder(ApproximationHelper::NeglectRealOrImaginaryPartIfNeglectable(std::sinh(c), c));
}
bool HyperbolicSineNode::derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) {
return HyperbolicSine(this).derivate(reductionContext, symbol, symbolValue);
}
Expression HyperbolicSineNode::unaryFunctionDifferential(ReductionContext reductionContext) {
return HyperbolicSine(this).unaryFunctionDifferential(reductionContext);
}
bool HyperbolicSine::derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue) {
Derivative::DerivateUnaryFunction(*this, symbol, symbolValue, reductionContext);
return true;
}
Expression HyperbolicSine::unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext) {
return HyperbolicCosine::Builder(childAtIndex(0).clone());
}
template Complex<float> Poincare::HyperbolicSineNode::computeOnComplex<float>(std::complex<float>, Preferences::ComplexFormat, Preferences::AngleUnit);
template Complex<double> Poincare::HyperbolicSineNode::computeOnComplex<double>(std::complex<double>, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit);
}
| 49.2 | 168 | 0.83243 | VersiraSec |
15b548f34a49c6f82e6d20932bb477202172ff4d | 3,001 | cpp | C++ | Source/shader.cpp | Hopson97/3D-Alien-Cubes | cd5141793df326586f6104a6aee454b91775f179 | [
"MIT"
] | 3 | 2016-12-11T01:38:21.000Z | 2021-03-06T10:41:35.000Z | Source/shader.cpp | Hopson97/3D-Alien-Cubes | cd5141793df326586f6104a6aee454b91775f179 | [
"MIT"
] | null | null | null | Source/shader.cpp | Hopson97/3D-Alien-Cubes | cd5141793df326586f6104a6aee454b91775f179 | [
"MIT"
] | null | null | null | #include "shader.h"
#include <fstream>
#include <sstream>
#include <iostream>
Shader::Shader(const std::string& vertexFilePath, const std::string& fragmentFilePath)
: programId (0)
, vertexShaderId (0)
, fragmentShaderId(0)
{
setUpShader(vertexFilePath, fragmentFilePath);
}
Shader::Shader()
: programId (0)
, vertexShaderId (0)
, fragmentShaderId(0)
{
}
void Shader::setUpShader(const std::string& vertexFilePath, const std::string& fragmentFilePath)
{
std::string vertexSource = getShaderSource(vertexFilePath);
std::string fragmentSource = getShaderSource(fragmentFilePath);
compileShader(vertexSource, vertexShaderId, GL_VERTEX_SHADER, "Vertex Shader" );
compileShader(fragmentSource, fragmentShaderId, GL_FRAGMENT_SHADER, "Fragment Shader" );
linkShaders();
}
void Shader::useProgram()
{
glUseProgram(programId);
}
std::string Shader::getShaderSource(const std::string& filePath)
{
std::ifstream file;
file.exceptions(std::ifstream::badbit);
file.open(filePath);
if(!file.is_open()) std::cerr << filePath << " does not exist! \n";
std::stringstream fileBuff;
fileBuff << file.rdbuf();
file.close();
std::string source = fileBuff.str();
return source.c_str();
}
void Shader::compileShader(const std::string& sourceCode, GLuint& shaderId, const GLenum shaderType, const std::string& type )
{
const char* sourceCodeChar = sourceCode.c_str();
shaderId = glCreateShader(shaderType);
glShaderSource (shaderId, 1, &sourceCodeChar, NULL);
glCompileShader (shaderId);
getErrorLog(shaderId, GL_COMPILE_STATUS, type);
}
void Shader::linkShaders()
{
programId = glCreateProgram();
glAttachShader( programId, vertexShaderId);
glAttachShader( programId, fragmentShaderId);
glLinkProgram ( programId);
getErrorLog(programId, GL_LINK_STATUS, "Linking error");
glDetachShader(programId, vertexShaderId);
glDetachShader(programId, fragmentShaderId);
}
void Shader::getErrorLog(const GLuint id, const GLenum errorType, const std::string& errorTypeString)
{
GLint success;
GLchar infoLog[512];
glGetShaderiv(id, errorType, &success);
if (!success) {
glGetShaderInfoLog(id, 512, NULL, infoLog); // Generate error as infoLog
std::cout << "Error of type \" " << errorTypeString << "\" " << infoLog << std::endl; // Display
}
}
GLuint Shader::getProgramId() const
{
return programId;
}
Shader::~Shader()
{
glDeleteShader(vertexShaderId);
glDeleteShader(fragmentShaderId);
glDeleteProgram(programId);
}
void Shader::unuseProgram()
{
glUseProgram(0);
}
/*
void Shader::loadUniformFloat(const GLuint location, const float aFloat)
{
glUniform1f(location, aFloat);
}
void Shader::loadUniformMatrix(const GLuint location, const glm::mat4& matrix)
{
glUniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(matrix));
}
void Shader::getUniformLocations() {}
*/
| 24.201613 | 126 | 0.697434 | Hopson97 |
15b826106c1e596c31cab7b3fc8dbfbe6479e838 | 1,712 | cpp | C++ | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | /*
* File: LevelSwitch.cpp
* Author: radek
*
* Created on 7 kwiecień 2014, 17:35
*/
#include "LevelSwitch.hpp"
LevelSwitch::LevelSwitch() : Obstacle(){
jumpable = false;
}
LevelSwitch::~LevelSwitch() {
}
GameObject* LevelSwitch::create(GameWorld& world, ResourceManager* rm, std::stringstream& in){
LevelSwitch* obj = new LevelSwitch();
float x,y;
std::string texture;
in>>texture>>x>>y>>obj->nextLevel;
sf::Texture* tex = nullptr;
if(texture!="None"){
tex = rm->loadTexture(texture);
obj->image.setTexture(*tex);
obj->image.setPosition(x,y);
}
if(!in.eof()){
obj->aabb.start = sf::Vector2f(0,0);
//obj->aabb.end = sf::Vector2f(0.1,0.1);
in>>obj->aabb.end.x>>obj->aabb.end.y;
if(tex)
obj->image.setScale(obj->aabb.end.x/tex->getSize().x,obj->aabb.end.y/tex->getSize().y);
}
else{
obj->aabb.start = sf::Vector2f(0,0);
if(tex)
obj->aabb.end = sf::Vector2f(tex->getSize().x,tex->getSize().y);
}
obj->aabb=obj->aabb+sf::Vector2f(x,y);
obj->textureName = texture;
return obj;
}
std::string LevelSwitch::dumpToString(){
std::stringstream s;
s<<getType()<<" "<<textureName<<" "<<aabb.start.x<<" "<<aabb.start.y<<" "<<nextLevel;
if(textureName == "None"){
sf::Vector2f size = aabb.end-aabb.start;
s<<" "<<size.x<<" "<<size.y;
}else if(image.getScale()!=sf::Vector2f(1.f,1.f)){
s<<" "<<image.getTexture()->getSize().x*image.getScale().x<<" "<<image.getTexture()->getSize().y*image.getScale().y;
}
return s.str();
}
const std::string LevelSwitch::getType(){
return "LevelSwitch";
} | 28.065574 | 124 | 0.574182 | programistagd |
15b9a534bf79f5db22d4f878c7eba87a7113e24b | 350 | hpp | C++ | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | 2 | 2019-09-09T06:08:26.000Z | 2020-10-14T12:01:26.000Z | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | null | null | null | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | 1 | 2021-08-16T07:28:19.000Z | 2021-08-16T07:28:19.000Z | #ifndef GODOTMATION_CONVERTER_H
#define GODOTMATION_CONVERTER_H
#include "godotmation_pool.hpp"
class GodotMation_Resource;
class GodotMation_State;
class GodotMation_Converter : public GodotMation_Pool{
public:
GodotMation_Converter();
~GodotMation_Converter();
virtual bool trigger();
virtual int can_push(int) const;
};
#endif | 19.444444 | 54 | 0.788571 | kakoeimon |