blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
208d47d3ad6202e37935d90d377fa6e7294fa534 | 216f5252a8df73f8547d6a6c831409c916bae3e5 | /windows_embedded_compact_2013_2015M09/WINCE800/private/test/BaseOS/pqoal/cetk/kitl/Server/kitlstressdesk.h | 0241321cc336fd4055d678c664d246fff0fb37d3 | [] | no_license | fanzcsoft/windows_embedded_compact_2013_2015M09 | 845fe834d84d3f0021047bc73d6cf9a75fabb74d | d04b71c517428ed2c73e94caf21a1582b34b18e3 | refs/heads/master | 2022-12-19T02:52:16.222712 | 2020-09-28T20:13:09 | 2020-09-28T20:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,831 | h | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
#pragma once
#include <Kitlclnt_priv.h>
#define MAX_SVC_NAMELEN 19
#define KITL_MAX_DATA_SIZE 1446
#define REG_KEY_KITL L"Software\\Microsoft\\KITL"
/******************************************************************************
// Class Name: CKITLStressDesk
//
// Description:
// CKITLStressDesk implements the actual KITL tests and abstracts it from the client
// class. Once an object instance is created, starting a test is a matter of call RunTest.
//
******************************************************************************/
class CKITLStressDesk
{
public:
CKITLStressDesk(WCHAR wszServiceName[MAX_SVC_NAMELEN],
WCHAR wszDeviceName[MAX_PATH],
DWORD dwMinPayLoadSize,
DWORD dwMaxPayLoadSize,
UCHAR ucFlags,
UCHAR ucWindowSize,
DWORD dwRcvIterationsCount,
DWORD dwRcvTimeout,
BOOL fVerifyRcv,
DWORD dwSendIterationsCount,
CHAR cData,
DWORD dwDelay,
HANDLE hStopTest);
~CKITLStressDesk();
public:
HRESULT RunTest();
private:
HRESULT Init();
HRESULT Uninit();
HRESULT BulkSend();
HRESULT BulkRcv();
private:
// Control
HANDLE m_hStopTest; // Event used to instruct the tests
// to stop execution prematurely
// KITL priv
WCHAR m_wszServiceName[MAX_SVC_NAMELEN]; // KITL Stream Name
WCHAR m_wszDeviceName[MAX_PATH];
KITLID m_uKITLStrmID; //
BYTE *m_pbKitlPayLoad;
BOOL m_fKitlInitialized;
// RCV
DWORD m_dwDataRcvSize;
// Send
DWORD m_dwDataSentSize;
// Stress test settings
DWORD m_dwMinPayLoadSize;
DWORD m_dwMaxPayLoadSize;
UCHAR m_ucFlags; // KITL Stream settings
UCHAR m_ucWindowSize; // number of KITL packets outstanding on the wire ans waiting for ack
DWORD m_dwRcvIterationsCount;
DWORD m_dwRcvTimeout;
BOOL m_fVerifyRcv;
DWORD m_dwSendIterationsCount;
CHAR m_cData; // Actual character to use to fill the pay load
DWORD m_dwDelay;
};
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
a802fb82e023d42fb6161ea401686d8d625b531b | fdb54ad118ebdc572ed223dc0f3686d4940c803b | /login_manager/mock_init_daemon_controller.h | 225fb1827db70815a42b71ed0564214aa89e09ba | [
"BSD-3-Clause"
] | permissive | ComputerStudyBoard/chromiumos-platform2 | 6589b7097ef226f811f55f8a4dd6a890bf7a29bb | ba71ad06f7ba52e922c647a8915ff852b2d4ebbd | refs/heads/master | 2022-03-27T22:35:41.013481 | 2018-12-06T09:08:40 | 2018-12-06T09:08:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,317 | h | // Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LOGIN_MANAGER_MOCK_INIT_DAEMON_CONTROLLER_H_
#define LOGIN_MANAGER_MOCK_INIT_DAEMON_CONTROLLER_H_
#include <memory>
#include <string>
#include <vector>
#include <dbus/message.h>
#include <gmock/gmock.h>
#include "login_manager/init_daemon_controller.h"
namespace login_manager {
class MockInitDaemonController : public InitDaemonController {
public:
MockInitDaemonController();
~MockInitDaemonController() override;
// Work around. gmock 1.7 does not support returning move-only-type value.
// TODO(crbug.com/733104): Remove this when gmock is upgraded to 1.8.
std::unique_ptr<dbus::Response> TriggerImpulse(
const std::string& name,
const std::vector<std::string>& arg_keyvals,
TriggerMode mode) override {
return std::unique_ptr<dbus::Response>(
TriggerImpulseInternal(name, arg_keyvals, mode));
}
MOCK_METHOD3(TriggerImpulseInternal,
dbus::Response*(const std::string&,
const std::vector<std::string>&,
TriggerMode));
};
} // namespace login_manager
#endif // LOGIN_MANAGER_MOCK_INIT_DAEMON_CONTROLLER_H_
| [
"chrome-bot@chromium.org"
] | chrome-bot@chromium.org |
6f816970b06f216c815a0a087f03539439a89fea | 5093fa1935954ad0fbad0bbb6001da6460f96a15 | /src/deposit.h | 26e39237d0e1e04313bfb825e94135449831ab76 | [] | no_license | 0GEORGII0/depositcalkk | 70c9b9cd79963d8cffff8da2dab594de9c7eefde | 2a38f1041cf5b16d92b4370ecbeb43d0eb483724 | refs/heads/master | 2023-01-30T03:27:04.340234 | 2020-12-11T07:22:46 | 2020-12-11T07:22:46 | 320,492,589 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | h | #ifndef DEPOSIT_H
#define DEPOSIT_H
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <cmath>
using namespace std;
int verifyDeposit(int x);
int verifyDays(int d);
int calculateDohod(int d, int x, int s);
#endif | [
"zherdev.georgii@gmail.com"
] | zherdev.georgii@gmail.com |
d0635a7b25c8e1d2201d0964dc0ed93871aad1f3 | ab08dcb1f06ab70edd174d6b72e38f90180e22ac | /021_Real-time indirect illumination by virtual planar area lights/CalculateWeightPass.cpp | f92915efb6a18c1afc4e3fccb0a3b9901cfdb073 | [
"MIT"
] | permissive | AngelMonica126/GraphicAlgorithm | f208bbbe0212151a2659b425816380d9f9dbdd8a | 58877e6a8dba75ab171b0d89260defaffa22d047 | refs/heads/master | 2022-06-02T18:46:36.061487 | 2022-03-06T14:30:44 | 2022-03-06T14:30:44 | 271,798,397 | 1,240 | 203 | MIT | 2021-08-19T07:32:05 | 2020-06-12T12:55:47 | C++ | UTF-8 | C++ | false | false | 2,858 | cpp | #include "CalculateWeightPass.h"
#include "Utils.h"
#include "Interface.h"
#include "Shader.h"
#include <random>
#include <GLM/gtc/type_ptr.hpp>
#include "vector"
#include <GLFW/glfw3.h>
using namespace std;
CCalculateWeight::CCalculateWeight(const std::string& vPassName, int vExcutionOrder) : IRenderPass(vPassName, vExcutionOrder)
{
}
CCalculateWeight::~CCalculateWeight()
{
}
void CCalculateWeight::initV()
{
int block = ElayGraphics::ResourceManager::getSharedDataByName<int>("Block");
int resolution = ElayGraphics::ResourceManager::getSharedDataByName<int>("RSMResolution");
m_TextureConfig4AlbedoAndMetallic = std::make_shared<ElayGraphics::STexture>();
m_TextureConfig4AlbedoAndMetallic->InternalFormat = GL_RGBA32F;
m_TextureConfig4AlbedoAndMetallic->ExternalFormat = GL_RGBA;
m_TextureConfig4AlbedoAndMetallic->DataType = GL_FLOAT;
m_TextureConfig4AlbedoAndMetallic->Type4MinFilter = GL_LINEAR;
m_TextureConfig4AlbedoAndMetallic->Type4MagFilter = GL_LINEAR;
m_TextureConfig4AlbedoAndMetallic->ImageBindUnit = 0;
m_TextureConfig4AlbedoAndMetallic->isMipmap = true;
m_TextureConfig4AlbedoAndMetallic->Height = m_TextureConfig4AlbedoAndMetallic->Width = resolution;
genTexture(m_TextureConfig4AlbedoAndMetallic);
m_pShader = std::make_shared<CShader>("CalculateWeight_CS.glsl");
m_pShader->activeShader();
m_pShader->setIntUniformValue("u_VALCount", block * block);
m_pShader->setIntUniformValue("u_Block", block);
m_pShader->setIntUniformValue("u_RSMResolution", ElayGraphics::ResourceManager::getSharedDataByName<int>("RSMResolution"));
m_pShader->setTextureUniformValue("u_RSMAlbedoAndMetallicTexture", ElayGraphics::ResourceManager::getSharedDataByName<std::shared_ptr<ElayGraphics::STexture>>("RSMAlbedoAndMetallicTexture"));
m_pShader->setTextureUniformValue("u_RSMPositionTexture", ElayGraphics::ResourceManager::getSharedDataByName<std::shared_ptr<ElayGraphics::STexture>>("RSMPositionTexture"));
m_pShader->setTextureUniformValue("u_RSMNormalTexture", ElayGraphics::ResourceManager::getSharedDataByName<std::shared_ptr<ElayGraphics::STexture>>("RSMNormalAndDoubleRoughnessTexture"));
m_pShader->setImageUniformValue(m_TextureConfig4AlbedoAndMetallic);
std::vector<int> LocalGroupSize;
m_pShader->InquireLocalGroupSize(LocalGroupSize);
m_GlobalGroupSize.push_back((resolution + LocalGroupSize[0] - 1) / LocalGroupSize[0]);
m_GlobalGroupSize.push_back((resolution + LocalGroupSize[1] - 1) / LocalGroupSize[1]);
m_GlobalGroupSize.push_back(1);
ElayGraphics::ResourceManager::registerSharedData("WeightAlbedoImage", m_TextureConfig4AlbedoAndMetallic);
}
void CCalculateWeight::updateV()
{
m_pShader->activeShader();
glDispatchCompute(m_GlobalGroupSize[0], m_GlobalGroupSize[1], m_GlobalGroupSize[2]);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
genGenerateMipmap(m_TextureConfig4AlbedoAndMetallic);
}
| [
"1071209504@qq.com"
] | 1071209504@qq.com |
ae8496ac8eeb4fe43ae4d7f2543ca7bc24361a1e | e33a4aae43829d77248fbbd0e695c686a8e1a23b | /t265_test/include/DroneState.h | 8027bac9e15943b17922b67f99277727444364c2 | [] | no_license | TellarKnight/indoor_flight | 935c5e159a4bd00992db9f4236cf64b72dfaa94f | 0610e3e4738cb0c5bc87b400a89b7b3e16e6ec8d | refs/heads/master | 2023-04-28T23:02:03.065330 | 2021-04-30T13:14:28 | 2021-04-30T13:14:28 | 363,139,491 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,949 | h | // Generated by gencpp from file px4_command/DroneState.msg
// DO NOT EDIT!
#ifndef PX4_COMMAND_MESSAGE_DRONESTATE_H
#define PX4_COMMAND_MESSAGE_DRONESTATE_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <std_msgs/Header.h>
#include <geometry_msgs/Quaternion.h>
namespace px4_command
{
template <class ContainerAllocator>
struct DroneState_
{
typedef DroneState_<ContainerAllocator> Type;
DroneState_()
: header()
, connected(false)
, armed(false)
, mode()
, time_from_start(0.0)
, position()
, velocity()
, attitude()
, attitude_q()
, attitude_rate() {
position.assign(0.0);
velocity.assign(0.0);
attitude.assign(0.0);
attitude_rate.assign(0.0);
}
DroneState_(const ContainerAllocator& _alloc)
: header(_alloc)
, connected(false)
, armed(false)
, mode(_alloc)
, time_from_start(0.0)
, position()
, velocity()
, attitude()
, attitude_q(_alloc)
, attitude_rate() {
(void)_alloc;
position.assign(0.0);
velocity.assign(0.0);
attitude.assign(0.0);
attitude_rate.assign(0.0);
}
typedef ::std_msgs::Header_<ContainerAllocator> _header_type;
_header_type header;
typedef uint8_t _connected_type;
_connected_type connected;
typedef uint8_t _armed_type;
_armed_type armed;
typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _mode_type;
_mode_type mode;
typedef float _time_from_start_type;
_time_from_start_type time_from_start;
typedef boost::array<float, 3> _position_type;
_position_type position;
typedef boost::array<float, 3> _velocity_type;
_velocity_type velocity;
typedef boost::array<float, 3> _attitude_type;
_attitude_type attitude;
typedef ::geometry_msgs::Quaternion_<ContainerAllocator> _attitude_q_type;
_attitude_q_type attitude_q;
typedef boost::array<float, 3> _attitude_rate_type;
_attitude_rate_type attitude_rate;
typedef boost::shared_ptr< ::px4_command::DroneState_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::px4_command::DroneState_<ContainerAllocator> const> ConstPtr;
}; // struct DroneState_
typedef ::px4_command::DroneState_<std::allocator<void> > DroneState;
typedef boost::shared_ptr< ::px4_command::DroneState > DroneStatePtr;
typedef boost::shared_ptr< ::px4_command::DroneState const> DroneStateConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::px4_command::DroneState_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::px4_command::DroneState_<ContainerAllocator> >::stream(s, "", v);
return s;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator==(const ::px4_command::DroneState_<ContainerAllocator1> & lhs, const ::px4_command::DroneState_<ContainerAllocator2> & rhs)
{
return lhs.header == rhs.header &&
lhs.connected == rhs.connected &&
lhs.armed == rhs.armed &&
lhs.mode == rhs.mode &&
lhs.time_from_start == rhs.time_from_start &&
lhs.position == rhs.position &&
lhs.velocity == rhs.velocity &&
lhs.attitude == rhs.attitude &&
lhs.attitude_q == rhs.attitude_q &&
lhs.attitude_rate == rhs.attitude_rate;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator!=(const ::px4_command::DroneState_<ContainerAllocator1> & lhs, const ::px4_command::DroneState_<ContainerAllocator2> & rhs)
{
return !(lhs == rhs);
}
} // namespace px4_command
namespace ros
{
namespace message_traits
{
template <class ContainerAllocator>
struct IsFixedSize< ::px4_command::DroneState_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::px4_command::DroneState_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::px4_command::DroneState_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::px4_command::DroneState_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::px4_command::DroneState_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::px4_command::DroneState_<ContainerAllocator> const>
: TrueType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::px4_command::DroneState_<ContainerAllocator> >
{
static const char* value()
{
return "aef04f956ed2d9034fe86b14ca95f171";
}
static const char* value(const ::px4_command::DroneState_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0xaef04f956ed2d903ULL;
static const uint64_t static_value2 = 0x4fe86b14ca95f171ULL;
};
template<class ContainerAllocator>
struct DataType< ::px4_command::DroneState_<ContainerAllocator> >
{
static const char* value()
{
return "px4_command/DroneState";
}
static const char* value(const ::px4_command::DroneState_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::px4_command::DroneState_<ContainerAllocator> >
{
static const char* value()
{
return "std_msgs/Header header\n"
"\n"
"## 机载电脑是否连接上飞控,true已连接,false则不是\n"
"bool connected\n"
"## 是否解锁,true为已解锁,false则不是\n"
"bool armed\n"
"## PX4飞控当前飞行模式\n"
"string mode\n"
"\n"
"## 系统启动时间\n"
"float32 time_from_start ## [s]\n"
"\n"
"## 无人机状态量:位置、速度、姿态\n"
"float32[3] position ## [m]\n"
"float32[3] velocity ## [m/s]\n"
"float32[3] attitude ## [rad]\n"
"geometry_msgs/Quaternion attitude_q ## 四元数\n"
"float32[3] attitude_rate ## [rad/s]\n"
"================================================================================\n"
"MSG: std_msgs/Header\n"
"# Standard metadata for higher-level stamped data types.\n"
"# This is generally used to communicate timestamped data \n"
"# in a particular coordinate frame.\n"
"# \n"
"# sequence ID: consecutively increasing ID \n"
"uint32 seq\n"
"#Two-integer timestamp that is expressed as:\n"
"# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n"
"# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n"
"# time-handling sugar is provided by the client library\n"
"time stamp\n"
"#Frame this data is associated with\n"
"string frame_id\n"
"\n"
"================================================================================\n"
"MSG: geometry_msgs/Quaternion\n"
"# This represents an orientation in free space in quaternion form.\n"
"\n"
"float64 x\n"
"float64 y\n"
"float64 z\n"
"float64 w\n"
;
}
static const char* value(const ::px4_command::DroneState_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::px4_command::DroneState_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.header);
stream.next(m.connected);
stream.next(m.armed);
stream.next(m.mode);
stream.next(m.time_from_start);
stream.next(m.position);
stream.next(m.velocity);
stream.next(m.attitude);
stream.next(m.attitude_q);
stream.next(m.attitude_rate);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct DroneState_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::px4_command::DroneState_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::px4_command::DroneState_<ContainerAllocator>& v)
{
s << indent << "header: ";
s << std::endl;
Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header);
s << indent << "connected: ";
Printer<uint8_t>::stream(s, indent + " ", v.connected);
s << indent << "armed: ";
Printer<uint8_t>::stream(s, indent + " ", v.armed);
s << indent << "mode: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.mode);
s << indent << "time_from_start: ";
Printer<float>::stream(s, indent + " ", v.time_from_start);
s << indent << "position[]" << std::endl;
for (size_t i = 0; i < v.position.size(); ++i)
{
s << indent << " position[" << i << "]: ";
Printer<float>::stream(s, indent + " ", v.position[i]);
}
s << indent << "velocity[]" << std::endl;
for (size_t i = 0; i < v.velocity.size(); ++i)
{
s << indent << " velocity[" << i << "]: ";
Printer<float>::stream(s, indent + " ", v.velocity[i]);
}
s << indent << "attitude[]" << std::endl;
for (size_t i = 0; i < v.attitude.size(); ++i)
{
s << indent << " attitude[" << i << "]: ";
Printer<float>::stream(s, indent + " ", v.attitude[i]);
}
s << indent << "attitude_q: ";
s << std::endl;
Printer< ::geometry_msgs::Quaternion_<ContainerAllocator> >::stream(s, indent + " ", v.attitude_q);
s << indent << "attitude_rate[]" << std::endl;
for (size_t i = 0; i < v.attitude_rate.size(); ++i)
{
s << indent << " attitude_rate[" << i << "]: ";
Printer<float>::stream(s, indent + " ", v.attitude_rate[i]);
}
}
};
} // namespace message_operations
} // namespace ros
#endif // PX4_COMMAND_MESSAGE_DRONESTATE_H
| [
"2315767041@qq.com"
] | 2315767041@qq.com |
534a02f099f06c7f47ff5e89d8140b721968dfca | e08ed7a15b0ee15e3b1ec8c2f5827d6dccc159ce | /export/windows/obj/src/resources/__res_7.cpp | 5d6df7e2efd5064f8bd8730b4edcc3e154888b03 | [] | no_license | jaspior/TurnBaseRPG | 8c960b23de6270cba65695951a218c267e894403 | f182f2742d15a8285c65739fa4eff58b0d06865e | refs/heads/main | 2023-07-11T16:14:03.386978 | 2021-08-21T01:18:56 | 2021-08-21T01:18:56 | 395,911,259 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 168,676 | cpp | namespace hx {
unsigned char __res_7[] = {
0x80, 0x00, 0x00, 0x80,
137,80,78,71,13,10,26,10,0,0,
0,13,73,72,68,82,0,0,0,11,
0,0,0,11,8,6,0,0,0,169,
172,119,38,0,0,0,4,115,66,73,
84,8,8,8,8,124,8,100,136,0,
0,0,9,112,72,89,115,0,0,11,
18,0,0,11,18,1,210,221,126,252,
0,0,0,28,116,69,88,116,83,111,
102,116,119,97,114,101,0,65,100,111,
98,101,32,70,105,114,101,119,111,114,
107,115,32,67,83,53,113,181,227,54,
0,0,2,111,112,114,86,87,120,156,
237,154,203,142,211,48,20,134,35,177,
179,250,16,86,88,176,33,113,156,166,
183,168,201,8,181,26,205,166,104,196,
84,12,98,151,38,110,39,106,19,71,
73,70,73,251,54,188,3,11,36,36,
216,35,30,128,183,152,21,91,192,233,
141,78,53,98,193,162,169,228,243,245,
106,215,199,95,254,19,47,251,237,215,
151,7,37,81,146,223,21,223,39,141,
28,79,216,44,140,29,245,225,243,87,
21,135,129,163,222,182,70,198,40,25,
176,187,240,106,149,178,155,213,235,177,
191,154,251,189,64,189,112,81,191,180,
203,40,137,88,238,225,50,90,196,153,
93,58,170,23,240,9,179,197,247,106,
154,168,120,189,36,159,59,234,171,234,
7,252,110,116,141,7,60,101,184,165,
27,154,111,180,13,220,166,58,109,90,
157,78,231,37,54,13,106,16,195,36,
212,212,104,199,110,154,182,97,224,45,
170,139,196,123,63,13,166,246,155,225,
229,86,39,70,142,122,151,231,137,77,
72,81,20,122,209,212,121,58,35,180,
215,235,85,219,152,166,38,86,104,217,
50,206,189,82,139,179,231,155,77,118,
251,12,89,230,167,97,146,135,60,198,
213,216,155,240,251,220,81,85,132,15,
216,230,138,146,189,40,206,244,117,70,
221,231,17,41,189,132,80,221,32,251,
157,171,205,197,106,123,144,50,47,231,
233,152,243,133,187,73,126,25,166,172,
224,233,60,195,131,155,22,166,162,74,
60,172,174,133,111,195,56,224,69,214,
39,199,117,79,109,201,134,226,229,138,
70,89,154,209,213,12,107,76,187,182,
213,181,105,243,253,65,253,102,209,81,
249,136,7,225,116,249,68,121,171,105,
91,237,109,249,193,162,93,171,200,81,
175,254,183,135,129,191,111,97,114,159,
46,214,119,42,240,9,91,176,136,197,
121,38,218,72,31,183,49,240,237,41,
79,35,47,119,195,200,155,49,146,196,
179,62,249,59,249,207,235,219,204,138,
147,34,14,41,217,159,82,247,209,101,
29,162,156,24,240,239,65,146,231,151,
214,143,36,207,15,126,240,131,31,252,
245,250,145,228,249,165,245,35,201,243,
131,31,252,224,7,127,189,126,36,121,
126,105,253,72,242,252,224,7,255,217,
248,81,205,126,12,254,122,252,72,242,
252,210,250,145,228,249,193,15,254,179,
241,163,154,253,117,231,151,214,143,36,
207,47,173,255,248,143,24,167,246,215,
157,31,252,224,63,27,63,146,60,191,
180,126,36,121,126,240,131,31,252,224,
175,215,143,36,207,47,173,31,213,158,
31,245,47,202,196,243,231,236,212,126,
0,0,0,0,0,0,0,0,0,160,
30,62,136,231,179,159,75,229,211,219,
143,141,31,47,252,70,221,215,3,0,
167,228,90,241,148,153,194,20,172,80,
49,218,125,2,178,240,7,149,163,171,
243,16,152,60,113,0,0,0,72,109,
107,66,70,250,222,202,254,0,0,0,
4,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,41,164,51,161,0,
0,57,40,109,107,84,83,120,156,237,
125,219,115,219,198,146,62,54,39,142,
35,249,158,108,101,31,246,69,85,187,
191,250,61,197,135,184,144,4,31,69,
82,148,20,83,18,15,65,217,114,94,
92,32,72,196,218,216,86,142,36,43,
199,203,194,255,190,211,221,131,219,96,
112,37,41,81,14,194,88,67,98,112,
25,124,221,243,77,119,79,15,112,244,
170,123,179,120,61,182,206,23,182,247,
122,124,116,190,80,189,193,184,23,41,
198,255,56,62,95,52,27,122,71,107,
155,13,239,108,216,115,23,13,239,45,
21,111,14,251,238,66,85,189,131,195,
9,150,227,61,203,93,180,53,111,108,
157,158,179,234,238,62,59,131,139,255,
121,163,225,240,102,209,29,177,63,189,
221,201,213,66,249,94,153,42,142,242,
78,233,42,182,114,165,156,43,142,119,
120,124,196,182,63,102,219,63,177,237,
7,108,251,165,50,83,118,148,33,171,
253,164,204,189,113,255,100,10,39,221,
61,198,115,239,178,38,235,115,211,235,
246,15,207,23,134,215,61,98,109,159,
179,2,239,164,107,237,225,78,214,0,
110,161,107,29,224,175,238,144,138,87,
88,244,142,249,9,246,6,248,123,60,
193,125,7,93,252,53,24,99,113,76,
27,173,17,219,215,241,186,19,170,156,
208,217,39,22,93,228,136,206,71,197,
225,46,180,242,24,90,213,240,250,39,
42,52,167,127,162,193,105,250,39,58,
22,3,182,81,99,133,70,133,14,133,
87,0,155,103,9,108,198,202,133,242,
153,109,155,41,115,101,182,44,66,234,
253,71,200,215,30,139,225,226,42,215,
203,104,143,234,26,149,245,71,93,18,
29,117,189,250,19,162,179,164,254,136,
24,149,209,160,59,198,232,49,199,104,
151,225,115,201,144,232,178,191,159,25,
90,239,57,86,223,115,172,66,12,179,
208,129,118,71,224,105,25,132,15,214,
231,226,99,26,49,124,26,49,124,116,
45,142,208,108,201,62,166,17,66,26,
33,100,16,66,6,33,100,120,214,232,
87,146,170,101,177,47,206,148,109,56,
161,219,176,172,19,220,80,6,195,71,
28,195,9,211,174,127,49,125,251,204,
234,243,244,76,215,100,138,150,13,164,
218,225,80,106,83,167,4,148,142,73,
80,226,246,181,129,169,117,138,129,249,
148,131,217,99,10,247,129,125,206,149,
223,24,92,182,242,135,242,94,249,194,
1,221,138,40,229,71,246,253,66,185,
200,4,83,229,189,86,213,11,211,190,
218,48,228,221,182,145,209,109,155,13,
66,18,249,0,144,116,237,194,61,87,
51,11,99,169,155,26,97,169,171,179,
210,216,101,119,232,246,140,160,51,29,
66,110,190,34,131,162,145,53,92,106,
21,201,174,24,100,85,1,250,7,235,
167,231,176,87,12,32,163,73,0,169,
83,65,183,92,14,81,131,48,114,178,
58,42,168,69,190,110,33,33,70,112,
2,54,5,156,80,169,214,0,84,82,
183,130,142,90,181,131,142,89,237,20,
59,232,167,76,53,83,59,171,213,179,
213,14,170,235,209,179,239,56,70,111,
216,88,112,45,69,167,45,168,152,96,
116,100,217,101,112,104,12,31,237,206,
241,177,70,93,98,127,171,155,32,253,
71,1,94,239,209,166,119,152,198,48,
228,4,109,234,225,184,9,148,255,165,
16,221,115,188,84,205,145,34,38,16,
126,219,41,175,82,70,139,32,179,57,
102,250,204,40,60,118,86,239,148,236,
130,90,211,38,32,97,168,41,143,228,
8,201,255,154,161,249,161,20,146,174,
81,96,228,116,253,145,19,236,137,130,
64,6,220,198,129,68,155,100,245,56,
2,124,150,111,141,0,185,145,89,226,
127,1,100,201,46,241,191,140,75,67,
252,48,238,92,148,129,23,199,140,92,
119,2,213,185,52,190,115,110,153,192,
193,0,112,167,181,106,128,199,12,87,
109,62,39,204,196,65,35,27,179,42,
6,178,156,20,181,102,166,129,236,104,
229,251,120,96,30,55,53,130,142,48,
44,134,157,58,47,76,141,129,226,105,
110,12,186,173,0,58,24,65,190,224,
88,90,197,55,139,187,102,232,34,84,
140,125,20,233,200,154,201,173,20,116,
74,10,162,165,107,50,180,90,132,86,
139,208,106,81,87,38,2,132,47,83,
87,232,202,48,198,140,15,74,224,248,
48,176,86,108,229,247,156,24,137,73,
40,118,8,69,52,209,34,40,54,150,
69,209,32,20,73,197,164,48,54,109,
194,81,203,192,177,217,224,97,128,14,
143,3,116,56,146,92,241,90,92,243,
90,70,26,152,180,37,2,38,51,58,
203,41,229,132,245,116,166,146,202,239,
101,122,113,33,173,44,102,61,203,213,
18,59,51,12,212,211,149,243,31,14,
48,216,135,125,32,199,209,145,134,198,
158,124,245,236,99,103,126,143,252,23,
15,87,69,106,10,119,122,105,20,97,
3,194,85,106,197,112,85,58,74,207,
165,40,245,49,176,55,101,38,120,118,
183,222,84,156,180,91,194,105,194,250,
241,57,115,79,238,43,78,250,202,113,
218,10,112,186,96,22,201,245,45,6,
134,179,120,172,227,24,21,157,52,62,
36,52,8,154,6,65,211,32,104,26,
4,77,163,32,52,79,165,42,196,103,
99,202,171,79,156,235,27,183,63,251,
146,69,70,77,66,168,73,8,53,151,
162,236,3,244,94,111,114,188,215,77,
157,97,224,40,177,17,27,97,106,18,
76,77,130,201,38,152,108,130,201,150,
218,254,3,112,55,113,186,101,2,92,
35,81,166,75,102,126,237,40,71,252,
219,92,185,44,98,138,149,49,29,212,
230,188,200,100,67,67,234,228,151,238,
114,114,195,129,155,179,38,65,101,146,
241,79,115,13,233,129,145,108,236,14,
48,192,244,158,7,154,222,35,91,197,
177,3,171,17,195,150,224,1,161,52,
27,49,67,150,252,166,132,33,43,237,
140,168,139,69,35,226,246,90,177,43,
14,149,223,35,135,1,68,233,138,38,
198,223,28,89,143,132,168,117,42,109,
133,62,122,133,96,210,218,244,44,106,
215,135,145,36,176,84,49,146,100,206,
75,224,249,48,102,230,127,90,237,156,
123,193,137,44,97,104,188,133,110,26,
128,5,56,70,193,250,142,131,117,2,
83,6,28,162,237,192,61,7,219,10,
194,109,121,214,149,93,53,57,1,188,
153,60,152,116,193,181,244,93,33,63,
212,134,10,157,112,44,213,2,225,12,
216,138,22,22,7,75,51,201,247,65,
79,103,23,29,54,84,190,86,139,60,
31,3,74,12,39,230,98,248,34,130,
33,68,140,32,217,195,66,59,213,230,
86,89,246,24,97,75,3,108,5,32,
133,72,86,198,212,140,99,19,168,26,
7,213,209,132,248,218,140,199,136,104,
224,206,241,48,153,234,18,172,38,199,
213,36,96,29,147,128,117,56,176,142,
41,250,235,240,101,236,127,137,117,112,
170,10,190,248,1,166,209,152,251,164,
227,177,31,226,180,146,225,58,153,40,
252,32,221,173,192,175,207,10,193,47,
132,232,2,244,51,231,93,83,98,37,
6,183,251,12,194,158,25,72,136,61,
150,58,150,136,52,161,40,69,26,7,
113,0,24,21,125,76,138,95,20,222,
237,0,222,107,140,169,64,50,202,85,
17,251,199,159,212,246,147,45,84,123,
94,0,223,34,246,79,83,96,140,56,
179,2,223,90,152,40,151,14,110,203,
40,7,174,15,156,234,6,49,18,4,
80,203,103,138,31,229,49,100,158,142,
81,140,127,219,21,249,183,208,48,197,
67,123,174,45,228,8,112,56,141,105,
140,126,13,25,253,250,112,138,60,209,
228,126,92,147,59,114,172,140,39,93,
80,20,106,76,128,90,99,78,205,252,
55,0,173,186,82,74,246,61,156,17,
131,242,19,251,150,84,87,85,249,153,
213,158,51,200,115,231,146,226,243,228,
149,163,207,89,190,95,9,27,32,174,
168,102,213,192,65,18,153,255,144,33,
195,212,112,151,109,189,102,191,127,102,
223,192,80,7,207,48,119,146,99,181,
152,173,214,110,90,33,102,254,48,223,
99,131,252,7,246,207,239,186,209,61,
101,238,12,186,45,169,38,166,93,62,
176,80,194,192,44,62,196,20,2,10,
251,41,240,95,114,108,1,203,19,106,
44,42,139,65,234,15,215,251,65,226,
193,57,12,216,235,73,31,118,138,155,
233,165,178,205,4,235,147,211,159,77,
64,218,4,164,153,48,212,185,233,25,
205,54,139,1,26,5,240,9,7,240,
13,90,52,115,62,53,137,58,40,76,
104,20,139,222,8,121,123,129,95,93,
44,128,3,83,140,37,181,49,176,121,
208,100,90,106,90,82,138,100,48,103,
30,78,180,97,172,194,255,50,62,137,
12,219,13,26,77,4,37,45,142,113,
177,73,35,205,148,233,41,5,128,86,
136,176,63,103,164,251,243,190,205,226,
0,203,125,74,93,54,103,132,61,59,
173,239,151,131,177,140,83,238,114,235,
209,141,91,143,174,93,0,196,34,238,
230,178,1,32,185,138,106,50,4,201,
43,143,122,65,193,100,155,152,33,233,
243,229,152,91,216,23,202,71,129,47,
97,8,250,164,184,144,148,5,195,181,
12,67,181,105,16,134,173,56,134,118,
9,8,91,82,61,148,26,53,52,245,
91,197,170,241,181,48,78,152,26,87,
67,44,117,44,169,247,182,120,247,45,
14,154,175,112,52,73,146,237,174,232,
178,78,43,164,73,202,71,151,70,113,
235,26,249,54,137,213,212,200,159,52,
15,124,21,97,210,28,8,22,241,162,
47,58,125,33,251,218,156,115,251,26,
190,140,124,12,45,223,245,27,251,28,
73,65,143,98,152,250,121,129,3,112,
97,100,136,78,141,152,115,237,107,95,
25,239,58,115,188,70,12,101,201,8,
114,255,143,99,170,203,48,117,76,185,
195,210,225,209,181,14,79,234,232,180,
40,82,132,110,137,63,71,222,13,221,
20,127,206,92,136,142,167,131,24,122,
211,255,100,48,218,104,80,102,171,103,
179,170,237,83,98,68,33,159,47,18,
123,43,145,133,197,252,67,169,122,194,
246,1,223,62,160,237,1,148,56,90,
183,249,96,221,38,13,245,33,69,5,
61,32,215,176,92,103,127,139,120,102,
143,46,241,17,186,80,222,96,25,91,
146,107,230,84,58,25,42,120,210,210,
209,37,45,48,145,150,33,19,207,192,
228,170,136,30,115,202,90,144,83,6,
213,39,28,168,63,163,1,238,155,229,
15,56,136,186,210,175,144,222,214,46,
178,142,166,136,75,163,199,77,156,56,
128,76,85,36,161,136,98,97,51,205,
148,196,130,15,104,140,46,131,211,118,
136,19,243,3,247,209,204,249,51,27,
49,233,0,83,108,233,145,15,153,154,
175,115,142,116,128,81,231,50,50,84,
111,21,178,199,129,5,243,30,147,164,
33,236,48,79,164,222,139,176,181,170,
206,57,168,197,103,1,3,95,69,111,
149,79,10,244,13,193,60,175,239,192,
55,157,15,146,166,115,30,116,47,130,
49,247,3,174,250,40,59,205,32,159,
33,92,94,245,48,159,60,50,207,96,
75,173,105,95,249,138,68,98,197,145,
88,170,124,190,69,51,14,38,11,146,
6,76,209,14,124,194,182,95,99,192,
43,111,249,233,42,58,112,179,120,0,
86,192,176,147,63,104,248,233,169,130,
57,189,162,238,235,235,32,228,230,159,
99,172,112,237,58,152,200,164,212,165,
74,216,49,227,147,93,174,116,212,144,
207,31,10,9,190,142,156,2,101,246,
160,24,198,9,167,185,184,21,19,141,
99,147,186,178,27,108,55,105,88,110,
149,211,214,39,129,231,124,129,174,204,
123,6,60,95,34,145,173,179,171,75,
136,203,26,167,77,233,18,57,136,131,
68,16,215,202,204,192,164,105,45,217,
55,86,210,9,204,67,240,105,4,193,
127,97,16,103,7,35,21,165,49,196,
192,96,137,197,174,1,142,70,190,43,
93,121,126,0,124,229,2,131,16,6,
33,156,182,36,33,29,147,124,112,131,
255,197,159,126,25,113,99,18,110,145,
38,100,35,214,165,56,115,152,39,133,
159,184,20,94,227,140,151,131,217,175,
87,56,249,0,12,12,49,226,157,144,
96,202,211,9,45,165,42,170,216,82,
54,137,43,182,96,77,97,168,45,201,
37,165,44,80,157,199,136,116,30,90,
103,37,114,9,23,79,116,124,27,113,
225,196,130,153,40,173,200,84,153,25,
159,41,3,123,223,27,12,251,55,139,
65,244,73,3,46,138,197,194,128,220,
121,36,137,212,69,113,28,227,156,198,
71,20,212,105,106,13,23,199,128,0,
25,16,55,12,8,135,193,30,106,241,
96,220,199,93,198,99,170,59,160,226,
12,10,111,16,245,226,168,65,252,177,
15,224,177,9,77,138,214,156,166,214,
84,107,146,70,77,98,197,126,208,162,
23,172,61,78,48,31,49,227,218,120,
29,153,242,185,10,184,216,225,57,31,
48,244,57,202,239,140,71,252,217,139,
193,254,107,6,252,113,143,78,126,200,
190,239,143,224,9,44,3,122,196,74,
3,255,243,34,85,170,95,197,159,191,
2,117,111,161,174,177,252,121,212,138,
167,240,171,216,111,132,206,139,137,238,
17,23,93,15,159,38,224,176,14,252,
65,34,190,49,7,49,169,81,209,154,
106,226,211,73,124,122,45,190,10,226,
123,202,197,55,102,0,57,236,166,33,
138,242,155,32,196,167,129,168,100,251,
156,22,216,167,154,96,109,18,172,93,
11,182,130,96,183,131,126,9,19,4,
96,224,68,157,29,55,50,121,224,215,
157,102,212,85,19,160,65,2,52,106,
1,46,209,51,73,16,215,104,27,93,
250,176,9,61,83,190,207,105,129,125,
150,162,92,85,173,37,91,65,178,161,
249,101,99,138,77,184,22,209,229,179,
0,254,246,211,148,237,213,164,214,36,
169,53,107,161,45,33,180,17,154,155,
78,228,137,83,46,143,131,248,219,79,
83,182,87,19,90,155,132,214,174,133,
182,132,208,6,8,204,44,128,197,23,
78,184,253,52,101,123,53,161,153,36,
52,179,22,90,5,161,61,225,66,219,
227,207,162,249,3,73,47,106,191,60,
225,98,146,237,113,154,187,71,53,145,
118,72,164,157,90,164,21,68,250,144,
139,180,139,115,177,87,193,12,173,27,
60,16,226,50,232,131,226,214,106,226,
114,72,92,78,45,174,10,226,218,10,
156,66,232,57,180,204,90,244,231,195,
26,209,159,15,107,170,137,110,70,162,
155,213,162,91,98,196,123,131,201,159,
243,196,136,23,110,63,77,217,94,77,
104,115,18,218,188,22,218,18,190,250,
40,156,59,11,156,130,237,192,142,140,
214,157,102,212,85,19,160,75,2,116,
99,13,123,28,104,211,92,153,42,125,
148,200,123,156,218,243,231,240,125,237,
17,235,79,115,234,171,53,82,229,209,
99,40,251,106,4,216,65,95,139,253,
210,99,191,140,216,175,9,9,96,31,
131,226,85,180,245,41,215,86,168,153,
130,73,129,147,159,93,156,140,143,234,
107,75,174,36,186,9,202,20,169,122,
169,153,97,173,214,177,219,241,90,163,
25,214,78,91,226,177,173,172,67,219,
25,135,170,98,139,196,110,114,255,154,
191,186,222,89,179,216,26,113,122,198,
113,26,227,178,153,125,204,118,132,125,
147,61,72,151,53,144,218,17,215,148,
136,162,192,191,212,214,203,128,92,215,
69,54,4,101,152,91,189,192,220,170,
107,229,132,175,213,252,45,95,35,181,
78,195,110,118,82,52,169,237,240,6,
230,107,100,177,243,108,72,207,13,250,
107,216,135,243,112,242,187,85,118,227,
242,113,42,118,158,59,198,233,121,132,
225,88,79,229,61,248,45,230,238,81,
202,99,78,223,109,116,24,147,107,41,
221,42,217,231,162,228,37,85,185,117,
93,228,142,113,126,33,224,28,65,56,
143,37,95,134,109,153,54,52,219,78,
131,97,230,178,234,120,101,71,60,50,
19,237,21,95,104,67,52,123,15,51,
81,49,71,5,211,42,131,209,201,203,
177,235,180,134,238,136,3,70,104,24,
169,211,78,91,157,166,25,70,234,220,
112,217,175,88,109,96,24,181,236,185,
211,80,211,12,163,228,137,85,177,69,
162,20,239,95,243,239,88,55,30,113,
221,128,244,70,154,221,134,23,38,124,
204,211,8,153,9,161,69,43,69,91,
216,8,219,173,217,25,134,178,104,124,
52,94,154,225,105,83,45,19,191,57,
133,212,97,115,219,126,199,186,176,205,
117,33,242,72,106,86,151,171,9,173,
22,100,120,202,59,151,217,48,147,112,
6,61,164,213,18,237,130,8,158,112,
96,219,77,235,92,116,225,52,211,139,
253,95,88,25,54,184,249,119,172,15,
91,145,88,192,31,200,15,151,17,109,
48,100,141,234,180,141,150,42,12,151,
122,112,103,211,153,233,8,92,106,6,
181,45,71,155,171,114,72,230,238,108,
234,204,146,18,189,155,38,108,136,84,
44,124,37,198,141,32,21,169,146,119,
244,14,179,27,211,148,220,208,224,147,
166,228,211,230,84,159,170,41,74,222,
106,37,123,79,168,228,179,57,124,164,
88,64,199,50,139,18,246,70,55,127,
67,56,155,188,149,164,253,156,226,143,
165,55,139,251,23,162,96,150,56,207,
10,227,202,123,131,254,205,98,111,16,
153,78,157,35,78,135,152,131,13,182,
109,151,253,189,193,7,224,248,243,112,
243,96,57,145,173,92,123,123,35,235,
102,209,239,237,193,159,87,136,159,197,
252,98,240,61,78,148,169,242,63,100,
3,121,253,222,107,92,32,232,162,173,
124,197,16,245,34,199,108,249,139,224,
152,79,13,11,148,174,149,247,252,136,
127,83,26,177,61,183,195,246,36,246,
253,70,81,133,189,183,88,91,62,32,
215,206,149,137,242,5,202,148,243,62,
194,86,219,184,38,244,207,80,43,248,
222,15,149,255,82,26,225,71,56,114,
143,221,149,203,109,189,35,124,146,219,
161,210,231,71,254,63,101,161,180,177,
182,197,90,199,218,167,104,202,207,236,
187,195,182,192,55,216,54,195,199,233,
152,108,91,155,213,208,53,154,184,103,
155,253,85,89,13,252,242,4,28,194,
135,61,238,98,140,230,67,112,111,127,
99,199,232,74,83,104,229,1,178,27,
197,43,100,247,231,134,31,225,200,46,
174,114,186,198,140,48,11,179,53,175,
83,113,220,138,200,39,27,241,39,145,
61,253,108,179,75,178,147,2,121,182,
133,187,120,194,176,158,65,60,10,159,
2,129,235,158,81,215,152,247,149,122,
149,16,167,62,127,82,150,141,41,54,
81,180,68,153,62,139,232,205,17,230,
165,94,243,39,72,159,227,232,224,95,
75,21,174,21,72,34,120,253,222,39,
108,227,85,112,132,30,59,226,49,62,
166,243,74,249,61,117,127,177,93,180,
226,44,214,47,165,210,156,177,179,201,
180,245,41,62,206,224,79,30,63,133,
158,60,75,28,191,21,215,118,166,75,
174,208,138,168,198,31,178,246,210,138,
140,115,254,44,114,58,203,183,220,243,
153,11,24,29,160,14,102,95,61,162,
139,210,171,211,123,209,24,78,140,133,
108,236,75,121,247,32,226,240,34,96,
28,210,232,203,84,253,16,101,240,255,
217,213,127,103,215,31,96,127,154,99,
28,240,146,247,171,19,118,228,7,166,
245,244,164,182,143,76,99,46,80,167,
47,217,182,40,102,167,108,255,99,90,
199,202,175,242,40,194,184,59,17,206,
69,138,174,192,206,99,76,36,251,237,
222,178,179,200,94,53,59,215,236,92,
179,115,205,206,247,155,157,127,224,236,
108,177,115,251,107,113,105,127,244,58,
21,122,19,195,125,229,108,173,230,236,
154,179,107,206,174,57,251,171,226,236,
173,36,103,223,91,134,86,107,134,174,
25,186,102,232,154,161,191,42,134,222,
230,12,253,43,106,253,175,236,26,191,
49,91,244,190,114,180,81,115,116,205,
209,53,71,215,28,253,85,113,180,111,
69,71,56,250,222,50,180,94,51,116,
205,208,53,67,215,12,253,85,50,244,
152,33,15,215,3,121,220,87,134,110,
213,12,93,51,116,205,208,53,67,223,
67,134,150,104,65,157,121,87,179,243,
82,236,44,114,89,205,206,53,59,215,
236,236,179,115,40,217,85,176,115,157,
121,87,179,115,205,206,53,59,215,236,
188,73,236,92,103,222,213,156,93,115,
118,205,217,53,103,223,31,206,174,51,
239,106,134,174,25,186,102,232,154,161,
55,149,161,235,204,187,154,163,107,142,
174,57,186,230,232,205,229,232,58,243,
174,102,232,154,161,107,134,174,25,122,
211,25,186,206,188,171,25,186,102,232,
154,161,107,134,190,27,134,238,179,189,
64,59,35,156,37,228,118,112,125,74,
176,115,54,207,137,168,181,18,44,153,
199,117,54,235,179,29,197,96,159,25,
195,200,92,9,215,45,163,111,79,99,
247,43,151,48,140,27,154,192,174,209,
163,178,179,2,227,251,210,83,24,67,
134,48,51,70,153,36,111,235,172,37,
205,91,209,54,95,131,118,98,58,84,
86,219,158,113,109,11,223,12,242,46,
182,215,114,218,103,39,102,139,191,70,
237,251,55,165,189,38,221,203,138,18,
110,186,238,61,229,186,23,229,122,209,
26,253,158,107,31,228,70,48,139,114,
163,242,140,197,76,135,58,203,120,147,
44,81,93,176,73,106,75,52,223,18,
213,132,118,213,150,104,53,75,84,21,
218,177,105,150,232,227,144,79,25,67,
71,238,112,9,134,30,179,43,156,35,
211,214,12,93,51,116,17,134,214,106,
134,174,25,186,142,21,72,25,250,73,
200,167,202,44,147,163,159,197,152,106,
7,91,75,111,127,250,16,241,226,30,
199,86,253,173,210,127,19,121,37,143,
253,154,156,211,92,100,51,224,188,54,
251,24,108,127,159,253,116,246,13,222,
77,10,109,240,175,99,34,95,186,232,
245,1,7,214,254,219,250,237,3,153,
182,84,209,189,103,200,102,31,112,108,
142,157,77,121,9,31,137,6,230,233,
208,84,233,48,45,112,216,95,24,9,
231,56,130,26,200,113,190,14,65,92,
0,52,200,101,26,230,107,42,236,109,
178,223,160,121,51,182,127,92,135,254,
147,93,169,203,176,114,17,73,226,212,
119,12,179,75,228,85,224,249,63,217,
239,235,0,103,208,174,255,13,16,123,
128,87,222,129,191,177,179,126,175,204,
10,198,163,214,35,201,60,236,163,45,
120,160,216,130,198,125,195,80,106,10,
251,56,57,252,140,204,90,65,75,182,
99,58,231,215,137,186,145,101,23,138,
125,41,79,139,52,100,25,147,105,3,
147,5,178,14,104,7,232,75,117,38,
42,98,197,180,4,76,243,71,125,163,
226,168,159,54,218,45,195,151,155,54,
82,202,245,38,174,129,143,25,151,206,
152,231,241,25,91,185,19,193,202,127,
75,222,46,34,122,193,234,134,1,162,
87,21,152,9,116,194,96,245,46,218,
239,42,142,110,42,187,103,35,97,219,
155,156,153,108,28,5,97,252,155,177,
127,96,93,117,110,133,153,158,178,253,
46,96,44,66,123,233,29,151,233,59,
246,251,55,101,154,34,193,103,194,49,
239,185,45,29,63,234,111,236,126,154,
130,142,111,179,122,144,218,71,246,247,
29,106,217,231,212,89,195,173,216,190,
112,151,179,148,61,31,197,246,252,77,
241,223,119,89,236,188,209,251,140,239,
249,60,245,62,227,45,151,221,233,139,
212,99,197,246,201,142,22,175,236,75,
37,121,111,183,51,99,37,239,23,113,
198,155,33,91,93,11,250,16,74,77,
118,159,207,164,71,21,65,40,75,7,
243,174,41,199,86,212,70,209,67,74,
235,39,243,12,47,83,142,73,118,31,
121,28,57,170,72,111,124,34,217,63,
239,94,146,71,228,105,150,188,85,233,
247,254,84,122,239,41,253,166,20,75,
111,177,45,32,135,27,60,127,85,219,
81,103,92,11,28,59,197,177,124,142,
236,216,225,227,127,56,234,67,61,220,
71,3,237,75,96,232,14,198,5,102,
104,67,138,209,151,245,48,244,227,80,
54,120,182,11,229,28,237,137,43,111,
127,196,64,219,31,77,110,22,103,195,
30,188,109,237,45,21,94,184,77,107,
54,105,43,124,241,4,214,228,210,88,
233,89,183,73,87,87,126,78,240,127,
87,121,206,245,48,165,76,55,203,106,
119,132,97,43,107,119,220,254,208,2,
251,163,89,219,31,181,253,113,239,236,
15,89,159,168,109,143,218,246,184,125,
219,227,187,232,211,25,42,241,50,92,
213,192,72,67,135,251,133,96,77,180,
36,188,220,184,83,94,94,79,79,142,
227,87,14,251,23,202,1,90,43,127,
87,44,156,107,250,140,215,132,251,130,
248,202,106,236,192,89,96,7,106,27,
104,7,190,71,254,123,23,198,222,132,
227,228,115,168,219,236,56,178,242,108,
92,179,254,25,236,167,148,158,3,163,
70,18,219,34,71,62,199,232,34,205,
168,241,184,85,161,227,214,163,103,69,
116,165,156,246,253,196,36,122,153,184,
195,191,139,209,189,21,233,161,19,232,
161,186,113,122,248,12,245,47,122,207,
197,52,107,42,193,239,238,52,164,156,
60,203,233,202,118,184,133,213,82,187,
63,72,98,216,225,108,39,96,48,203,
200,66,200,31,87,102,56,174,216,124,
148,128,89,15,13,51,36,227,49,108,
208,40,59,150,75,128,51,169,152,67,
57,95,225,108,218,67,38,153,63,112,
14,22,228,244,37,24,115,147,115,234,
15,82,179,14,100,17,235,117,197,142,
101,242,138,203,252,1,59,63,60,159,
105,30,145,242,0,125,81,154,151,165,
252,131,42,177,98,23,51,60,26,76,
54,32,9,232,239,46,206,81,133,51,
161,13,180,9,64,66,119,235,171,173,
11,125,25,142,121,232,63,231,61,213,
127,82,214,14,143,79,238,178,86,252,
1,243,76,21,36,161,161,12,52,236,
75,54,90,0,14,43,13,156,69,140,
90,103,77,156,251,41,150,145,115,159,
36,145,143,105,92,42,223,6,243,216,
36,147,240,119,149,94,160,178,58,23,
61,28,35,152,49,241,35,115,155,20,
177,88,15,246,33,118,217,24,111,249,
191,89,203,142,240,236,201,76,187,178,
104,107,127,57,180,101,40,102,227,254,
20,51,113,96,22,31,108,236,157,224,
248,234,17,58,144,128,142,185,28,36,
1,13,207,15,92,99,160,221,215,196,
81,28,112,6,57,53,89,93,7,173,
68,144,137,139,50,112,110,69,2,63,
32,166,254,157,251,126,244,165,212,118,
251,134,181,48,62,98,255,152,122,244,
63,89,105,43,31,98,22,194,55,160,
109,183,32,255,108,105,102,107,194,115,
101,159,29,245,25,237,197,115,156,235,
206,211,134,127,199,136,95,244,136,40,
14,62,62,159,131,153,254,31,152,148,
95,162,69,144,254,41,187,90,43,30,
17,110,4,17,97,253,47,210,227,243,
165,150,45,245,199,202,175,10,60,239,
237,227,10,250,126,135,175,90,130,184,
79,43,240,235,52,100,95,88,209,52,
197,12,38,240,231,90,104,211,79,89,
57,71,43,125,134,214,137,142,22,199,
109,200,226,57,219,135,238,186,108,191,
127,33,61,242,46,251,124,186,4,243,
152,31,100,232,199,14,242,251,250,199,
200,222,209,123,79,207,0,43,235,237,
53,25,218,38,90,156,45,212,141,159,
113,127,138,34,26,56,142,187,56,118,
168,56,70,52,49,75,110,142,58,52,
103,117,176,135,157,240,246,214,163,63,
47,82,209,72,230,152,117,110,137,249,
179,164,25,215,132,135,60,99,237,18,
51,190,63,5,235,110,227,91,203,247,
127,7,25,22,124,60,200,61,35,143,
143,178,252,147,30,95,251,43,228,98,
17,193,34,168,63,99,231,249,132,121,
253,84,179,19,100,203,201,251,225,79,
200,79,225,254,239,112,190,237,10,215,
173,94,23,92,37,80,214,142,54,54,
216,142,254,49,3,143,85,88,32,89,
231,151,141,23,205,91,233,237,121,90,
83,68,243,30,199,183,46,229,119,65,
198,168,134,255,154,124,254,167,131,150,
64,59,161,47,126,174,233,215,213,243,
211,177,20,227,61,199,152,233,1,115,
25,190,20,118,209,254,217,9,107,42,
219,95,115,196,179,129,217,187,83,140,
179,57,136,180,142,227,167,195,173,98,
248,219,196,53,83,126,62,48,88,93,
115,180,221,192,39,187,29,251,203,198,
187,126,199,176,242,239,186,88,127,250,
81,122,228,103,94,138,217,219,105,115,
71,235,210,130,52,89,138,253,145,214,
29,198,51,196,253,231,94,28,96,139,
47,214,190,206,48,158,117,93,191,113,
202,199,225,254,173,52,140,75,178,88,
142,190,152,239,144,191,210,80,92,253,
183,73,43,13,193,215,42,187,234,64,
204,96,169,215,26,222,254,90,67,243,
22,88,249,219,148,85,19,114,22,246,
159,15,119,140,231,7,91,47,57,195,
185,106,38,22,115,249,106,38,254,43,
49,113,249,53,223,95,23,19,39,215,
10,214,92,252,181,174,251,78,227,226,
239,216,157,125,64,219,127,198,244,194,
207,73,140,110,171,50,23,232,98,84,
144,252,77,135,199,160,59,145,181,106,
180,138,182,193,56,232,110,87,209,174,
43,39,49,138,95,156,193,160,55,126,
145,248,75,208,167,58,232,5,66,174,
70,71,96,73,39,56,95,250,145,29,
156,205,211,11,200,247,5,106,34,221,
193,37,246,18,208,240,157,37,165,62,
195,249,134,54,142,51,29,148,122,11,
103,23,59,49,169,79,49,114,220,137,
73,29,254,185,184,239,237,196,144,215,
149,33,152,143,234,221,234,194,15,152,
15,243,133,183,138,86,75,127,97,223,
13,46,13,88,139,183,199,117,36,58,
130,66,76,155,216,176,250,220,180,137,
35,225,28,123,56,197,167,77,156,107,
136,198,167,91,152,7,163,227,124,2,
252,165,223,6,234,211,253,214,141,44,
52,171,203,232,153,48,243,48,193,214,
64,187,239,74,78,148,51,120,127,229,
148,135,104,117,89,109,161,45,118,73,
22,204,29,202,7,182,221,95,249,200,
80,140,203,228,71,204,45,59,87,40,
22,108,177,54,156,243,111,96,97,131,
119,17,149,202,247,97,126,224,154,101,
210,102,146,104,99,102,78,27,51,116,
224,111,11,199,202,38,90,71,247,87,
38,73,12,227,18,121,132,216,207,49,
115,23,252,115,63,27,214,207,130,31,
161,151,117,141,156,248,94,161,103,123,
130,95,117,131,253,42,122,237,42,86,
9,204,156,205,209,247,118,209,211,133,
249,145,57,30,225,75,199,70,91,180,
141,253,163,193,87,201,104,220,114,237,
176,26,200,168,168,146,199,156,22,143,
248,22,237,4,39,226,137,138,145,133,
117,229,167,151,65,26,254,59,178,152,
16,189,95,241,239,104,119,114,179,232,
246,134,231,11,215,117,13,248,120,3,
250,213,192,255,188,238,40,144,248,247,
56,7,2,79,246,181,17,21,39,152,
113,153,6,113,246,75,140,214,15,177,
119,206,189,113,255,100,186,96,231,216,
61,62,199,194,58,95,232,115,211,235,
246,15,207,23,170,215,61,58,58,95,
204,89,193,54,219,94,215,218,195,157,
172,1,214,89,7,248,171,59,164,226,
21,22,189,99,126,130,189,1,254,30,
79,112,223,65,23,127,13,198,88,28,
211,70,107,196,246,117,188,238,132,42,
39,116,246,137,69,23,57,162,243,81,
113,184,11,173,60,134,86,53,188,254,
137,10,205,233,159,104,112,154,254,137,
142,197,128,109,212,88,161,81,161,67,
225,13,162,216,184,136,77,240,244,156,
96,124,112,19,209,175,211,212,26,142,
215,128,218,60,160,187,28,64,99,53,
246,11,239,107,48,238,227,46,227,49,
213,29,80,113,6,133,55,57,235,222,
44,232,194,15,152,99,72,131,220,39,
38,240,87,55,139,55,35,182,143,217,
240,14,120,57,177,126,101,231,99,18,
158,28,178,187,152,28,246,207,23,109,
119,102,184,248,52,158,201,217,96,53,
39,242,246,206,70,55,139,193,209,4,
110,161,55,28,67,49,26,226,157,140,
118,81,1,135,168,27,35,168,130,147,
140,38,252,55,67,66,245,118,71,67,
42,44,184,233,221,221,30,254,218,237,
99,97,77,64,125,70,195,62,28,176,
15,39,109,120,191,140,254,113,190,104,
66,105,209,207,19,42,70,112,252,254,
224,16,138,95,44,216,199,102,229,30,
253,156,192,233,126,177,186,8,236,112,
132,136,30,67,227,246,173,33,108,27,
90,167,80,244,169,24,90,40,129,158,
117,4,135,237,245,44,184,153,227,183,
22,252,26,90,248,235,96,130,138,117,
48,33,162,236,35,193,67,167,253,19,
75,76,155,246,206,6,184,239,217,17,
182,127,50,198,211,177,35,161,56,235,
239,226,201,7,103,236,4,138,119,124,
100,220,44,216,159,243,69,203,195,194,
165,66,165,162,33,20,172,28,192,254,
76,125,154,30,22,108,192,56,182,26,
116,46,75,229,165,198,75,29,203,189,
227,30,236,55,217,197,30,55,25,189,
129,226,12,110,68,245,122,221,83,220,
167,215,69,173,235,117,119,113,107,127,
23,127,245,143,110,22,195,193,196,93,
52,94,54,189,201,201,136,190,140,15,
249,150,238,9,255,226,245,206,16,98,
239,232,152,53,239,232,184,143,231,244,
70,251,199,232,208,142,20,27,135,155,
29,54,188,29,30,161,192,70,135,67,
42,96,215,255,230,83,221,29,52,119,
136,234,91,152,254,106,243,233,88,216,
74,169,176,26,159,40,135,96,4,76,
135,171,56,117,110,227,178,150,25,147,
18,107,177,119,56,36,225,190,101,146,
30,238,190,101,52,248,106,31,54,156,
142,81,231,134,188,151,190,97,23,154,
34,167,217,104,19,94,122,195,33,66,
116,100,225,126,71,61,60,77,255,16,
21,160,55,4,74,216,131,83,246,94,
193,246,189,33,92,203,243,94,31,178,
123,126,77,59,121,94,226,122,13,126,
189,109,100,87,120,106,58,172,117,165,
185,219,89,236,138,141,66,87,60,60,
218,15,54,156,157,12,240,169,7,84,
196,159,129,128,157,121,74,125,121,74,
93,217,140,247,228,169,106,67,16,118,
178,139,183,81,248,70,30,134,128,161,
68,37,183,160,150,4,205,219,31,247,
111,22,251,39,103,208,240,253,147,183,
88,88,236,151,222,98,229,91,42,253,
193,139,13,103,46,59,162,207,12,139,
253,62,94,115,191,255,42,82,181,223,
63,128,14,222,127,13,23,58,177,144,
112,79,44,84,104,111,212,239,177,203,
142,113,88,122,61,62,34,218,237,69,
138,241,63,142,129,101,244,142,214,54,
19,136,30,246,221,133,202,122,50,232,
63,43,199,123,150,187,104,107,222,216,
58,197,193,102,191,135,99,45,180,97,
4,247,189,182,1,214,184,255,3,108,
1,108,158,37,176,25,251,221,70,129,
133,223,75,34,164,222,127,132,124,237,
241,39,11,150,208,30,149,153,135,85,
245,71,93,18,29,117,189,250,19,162,
179,164,254,136,24,149,209,160,59,198,
232,49,199,104,151,225,67,175,156,185,
196,68,160,247,129,91,77,88,133,24,
102,161,3,237,142,192,211,50,8,31,
172,207,197,199,52,98,248,52,98,248,
232,90,28,161,217,146,125,76,35,132,
52,66,200,32,132,12,66,200,240,172,
209,175,36,85,11,70,71,103,202,54,
156,208,109,88,214,9,110,40,131,225,
35,142,33,184,121,255,82,104,193,121,
158,158,233,154,76,209,178,129,84,59,
28,74,109,234,148,128,210,49,9,74,
220,190,54,48,181,78,49,48,159,114,
48,123,232,113,211,115,3,192,23,129,
53,134,95,2,15,43,84,74,154,223,
187,200,246,59,121,175,85,245,194,180,
175,54,12,121,183,109,100,116,219,102,
131,144,68,62,0,36,93,187,112,207,
213,204,194,88,234,166,70,88,234,234,
172,52,118,217,29,186,61,35,232,76,
135,144,155,175,200,160,104,100,13,151,
90,69,178,43,6,89,85,128,254,193,
250,41,133,183,162,0,25,77,2,72,
157,10,186,229,114,136,26,132,145,147,
213,81,65,45,242,117,11,9,49,130,
19,176,41,224,132,74,181,6,160,146,
186,21,116,212,170,29,116,140,129,52,
232,160,159,50,213,76,237,172,86,207,
86,59,168,174,71,207,190,227,24,129,
179,121,45,69,167,45,168,152,96,116,
100,217,101,112,104,12,31,237,206,241,
177,70,93,98,127,171,155,32,253,71,
1,94,148,0,238,96,248,247,131,160,
77,189,32,166,242,165,16,221,115,188,
84,205,145,34,38,16,126,219,41,175,
82,70,139,32,179,57,102,250,204,40,
60,118,86,239,148,236,130,90,211,38,
32,97,168,41,143,228,136,18,168,96,
18,179,20,146,174,81,96,228,116,253,
145,19,236,137,130,64,6,220,198,129,
68,155,100,245,56,2,124,150,111,141,
0,185,145,89,226,127,1,100,201,46,
241,191,140,75,67,252,48,238,92,148,
129,23,199,140,92,119,2,213,185,52,
190,115,110,153,192,193,0,112,167,181,
106,128,199,12,87,109,62,39,204,196,
65,35,27,179,42,6,178,156,20,181,
102,166,129,236,104,229,251,120,96,30,
55,53,130,142,48,44,134,157,58,47,
76,141,129,226,105,110,12,186,173,0,
186,75,140,174,93,4,139,143,202,249,
102,113,215,12,93,132,138,177,143,34,
29,89,51,185,149,130,78,73,65,180,
116,77,134,86,139,208,106,17,90,45,
234,202,68,128,240,101,234,10,93,25,
198,152,241,65,9,28,31,6,214,138,
173,252,158,19,35,49,9,197,14,161,
136,38,90,4,197,198,178,40,26,132,
34,169,152,20,198,166,77,56,106,25,
56,54,27,60,12,208,225,113,128,14,
71,146,43,94,139,107,94,203,72,3,
147,182,68,192,100,70,103,57,165,156,
224,211,21,29,229,247,50,189,184,144,
86,22,179,158,229,106,137,157,25,6,
234,233,202,249,15,7,24,236,195,62,
144,227,232,72,67,99,79,190,122,246,
177,51,191,71,254,139,135,171,34,53,
133,59,189,52,138,176,1,225,42,181,
98,184,42,29,165,231,82,148,250,24,
216,163,185,252,251,136,147,118,75,56,
77,48,43,225,143,123,139,147,190,114,
156,182,2,156,46,112,85,195,237,5,
134,179,120,172,227,24,21,157,52,62,
36,52,8,154,6,65,211,32,104,26,
4,77,163,32,52,79,165,42,196,103,
99,202,171,79,156,235,27,183,63,251,
146,69,70,77,66,168,73,8,53,151,
162,236,3,158,9,144,237,189,110,234,
12,3,71,137,141,216,8,83,147,96,
106,18,76,54,193,100,19,76,182,212,
246,31,96,206,236,53,230,98,50,174,
145,40,211,37,51,191,118,120,94,224,
239,56,239,94,192,20,43,99,58,168,
205,121,145,201,134,134,212,201,47,221,
229,228,134,3,55,103,77,130,202,36,
227,159,230,26,210,3,35,217,216,29,
240,181,75,225,83,118,69,236,192,106,
196,176,37,120,64,40,205,70,204,144,
37,191,41,97,200,74,59,35,234,98,
209,136,184,189,86,236,138,67,229,247,
200,112,153,87,186,162,137,241,55,71,
214,35,33,106,157,74,91,161,143,94,
33,152,180,54,61,139,218,245,97,36,
9,44,85,140,36,153,243,18,120,62,
140,153,249,159,86,59,231,94,112,34,
75,24,26,111,161,155,6,96,1,142,
81,176,190,227,96,157,192,148,65,240,
12,88,223,61,191,228,171,197,242,172,
43,187,106,114,2,120,51,121,48,233,
130,107,233,187,66,126,168,13,21,58,
225,88,170,5,194,25,176,21,45,44,
14,150,102,146,239,131,158,206,46,58,
108,168,124,173,22,121,62,6,148,24,
78,204,197,240,69,4,195,11,76,6,
139,230,127,39,121,46,27,81,199,44,
12,41,68,178,50,166,102,28,155,64,
213,56,168,142,38,196,215,102,60,70,
68,3,119,142,135,201,84,151,96,53,
57,174,38,1,235,152,4,172,195,129,
117,76,209,95,135,47,99,255,75,172,
131,83,85,240,197,15,48,141,198,220,
39,133,100,82,10,113,90,201,112,157,
76,20,126,144,238,86,224,215,103,133,
224,23,66,116,1,250,153,243,174,41,
177,18,131,219,125,6,97,207,12,36,
196,30,75,29,75,68,154,80,148,34,
141,131,56,0,140,138,62,38,197,47,
10,239,118,0,47,173,111,254,132,171,
204,10,216,63,254,164,182,159,108,161,
218,243,2,248,22,177,127,154,2,99,
196,153,21,248,214,194,68,185,116,112,
91,70,57,112,125,224,84,55,136,145,
32,128,90,62,83,252,40,143,33,243,
116,140,98,252,219,174,200,191,133,134,
41,30,218,115,109,33,71,128,195,105,
76,99,244,107,200,232,215,135,83,228,
137,38,247,227,154,220,145,99,101,60,
233,130,162,80,99,2,212,26,115,106,
230,191,1,104,213,149,82,178,239,225,
140,248,34,200,164,186,194,34,153,17,
219,254,175,252,185,164,248,60,121,229,
232,115,150,239,87,194,6,136,43,170,
89,53,112,144,68,230,63,100,200,224,
131,178,63,225,50,159,159,249,178,38,
27,31,109,148,51,201,177,90,204,86,
107,55,173,16,51,127,152,15,31,181,
79,93,55,186,167,204,157,65,183,37,
213,196,180,203,7,22,74,24,152,197,
135,152,66,64,97,63,5,254,75,142,
45,96,121,66,141,69,101,49,72,253,
225,122,63,72,60,192,85,71,235,73,
31,118,138,155,233,165,178,205,4,235,
147,211,159,77,64,218,4,164,153,48,
212,185,233,25,205,54,139,1,26,5,
240,9,7,240,13,61,174,132,79,77,
70,95,216,241,125,224,100,23,137,222,
8,121,123,129,95,93,44,128,3,83,
140,37,181,49,176,121,208,100,90,106,
90,82,138,100,48,103,30,78,180,97,
172,194,255,50,62,137,12,219,13,26,
77,4,37,45,142,113,177,73,35,205,
148,233,41,5,128,86,136,176,63,103,
164,251,243,190,205,226,0,203,125,74,
93,54,103,132,61,59,173,239,151,131,
177,140,83,238,114,235,209,141,91,143,
174,93,0,196,34,238,230,178,1,32,
185,138,106,50,4,201,43,143,122,65,
193,100,155,152,33,233,243,229,152,91,
216,23,202,71,129,47,233,25,67,176,
212,8,28,156,115,25,134,106,211,32,
12,91,113,12,237,18,16,182,164,122,
40,53,106,104,234,183,138,85,227,107,
97,156,48,53,174,134,88,234,88,82,
239,109,241,238,91,28,52,95,225,104,
146,36,219,93,209,101,157,86,72,147,
148,143,46,141,226,214,53,242,109,18,
171,169,145,63,105,30,248,42,194,164,
57,16,44,226,69,95,116,250,66,246,
181,57,231,246,53,124,25,249,24,90,
190,235,55,246,57,146,130,30,197,48,
245,243,2,7,248,152,113,9,162,83,
35,230,92,251,218,87,198,187,206,28,
175,17,67,89,50,130,220,255,227,152,
234,50,76,29,83,238,176,116,120,116,
173,195,147,58,58,45,138,20,161,91,
226,207,145,119,67,55,197,159,51,23,
162,227,233,32,134,222,52,61,85,30,
159,1,150,169,158,205,170,182,79,137,
17,133,124,190,72,236,173,68,22,22,
243,15,165,234,9,219,7,124,251,128,
182,7,80,226,104,221,230,131,117,155,
52,212,135,20,21,244,128,92,195,114,
157,253,45,226,153,61,186,196,71,232,
66,121,131,101,108,73,174,153,83,233,
100,168,224,73,75,71,151,180,192,68,
90,134,76,60,3,147,171,34,122,204,
41,107,65,224,209,210,159,148,240,245,
130,190,89,254,128,131,168,43,253,10,
233,109,237,34,235,104,138,184,52,122,
220,196,137,3,200,84,69,18,138,40,
22,54,211,76,73,44,248,128,198,232,
50,56,109,135,56,49,63,208,127,224,
89,38,98,210,1,166,216,210,35,31,
50,53,95,231,28,233,0,163,206,101,
100,168,222,42,100,143,3,11,230,61,
61,45,2,159,56,33,166,222,139,176,
181,170,206,57,168,197,103,1,3,95,
69,111,149,79,10,244,13,193,60,175,
239,192,55,157,15,146,166,115,30,116,
47,130,49,247,3,174,250,40,59,205,
32,159,33,92,94,245,48,159,60,50,
207,96,75,173,105,95,249,138,68,98,
197,145,88,170,124,190,69,51,14,38,
11,146,6,76,209,14,76,79,161,252,
80,228,233,32,43,232,192,205,226,1,
88,1,195,78,254,160,225,167,167,10,
230,244,138,186,175,175,131,35,122,240,
6,206,184,174,89,7,19,153,148,186,
84,9,59,102,124,178,203,149,142,26,
242,249,67,33,193,215,145,83,160,204,
30,20,195,56,225,52,23,183,98,162,
113,108,82,87,118,131,237,38,13,203,
173,114,218,250,36,240,156,47,208,149,
121,143,111,40,189,202,141,152,169,171,
75,136,203,26,167,77,233,18,57,136,
131,68,16,215,202,204,192,164,105,45,
217,55,86,210,9,204,67,240,105,4,
193,127,97,16,103,7,35,21,165,49,
196,192,96,137,197,174,1,142,70,190,
43,93,121,126,0,124,229,2,131,16,
6,33,156,182,36,33,29,147,124,112,
131,255,197,159,126,25,113,99,18,110,
145,38,100,35,214,165,56,115,152,39,
133,159,184,20,232,41,86,14,102,191,
94,241,183,116,250,79,82,11,8,166,
60,157,208,82,170,162,138,45,101,147,
184,98,11,214,20,134,218,146,92,82,
202,2,213,121,140,72,231,161,117,86,
34,151,112,241,68,199,183,17,23,78,
44,152,137,210,138,76,149,153,241,153,
50,176,247,189,193,176,127,179,216,184,
71,65,13,162,94,28,53,136,63,246,
1,60,54,161,73,209,154,211,212,154,
106,77,210,168,73,172,216,15,90,244,
130,181,199,9,230,35,102,92,27,175,
35,83,62,87,1,23,59,60,231,227,
3,127,46,206,155,96,246,98,176,255,
154,1,15,143,45,130,147,31,178,239,
251,240,236,33,246,189,23,121,128,89,
164,74,245,171,248,243,87,160,238,45,
212,53,150,63,143,90,241,20,126,21,
251,141,208,121,49,209,61,226,162,235,
225,211,4,28,124,172,120,82,124,145,
87,84,10,226,139,214,84,19,159,78,
226,211,107,241,85,16,223,83,46,190,
49,127,254,30,189,203,46,46,196,167,
129,168,100,251,156,22,216,167,154,96,
109,18,172,93,11,182,130,96,183,131,
126,9,19,4,96,224,68,157,29,55,
50,121,224,215,157,102,212,85,19,160,
65,2,52,106,1,46,209,51,253,183,
72,92,160,237,196,97,19,122,166,124,
159,211,2,251,44,69,185,170,90,75,
182,130,100,67,243,203,198,20,155,112,
45,162,203,103,1,252,237,167,41,219,
171,73,173,73,82,107,214,66,91,66,
104,35,52,55,157,200,19,167,92,30,
7,241,183,159,166,108,175,38,180,54,
9,173,93,11,109,9,161,13,232,109,
58,1,44,190,112,194,237,167,41,219,
171,9,205,36,161,153,181,208,42,8,
237,9,23,218,30,127,22,205,31,72,
122,81,251,229,9,23,147,108,143,211,
220,61,170,137,180,67,34,237,212,34,
173,32,210,135,92,164,93,156,139,189,
10,102,104,221,224,129,16,151,65,31,
20,183,86,19,151,67,226,114,106,113,
85,16,215,86,224,20,66,207,161,101,
214,162,63,31,214,136,254,124,88,83,
77,116,51,18,221,172,22,221,18,35,
222,27,133,30,226,45,142,120,225,246,
211,148,237,213,132,54,39,161,205,107,
161,45,225,171,143,194,185,179,192,41,
216,14,236,200,104,221,105,70,93,53,
1,186,36,64,55,214,176,199,129,54,
193,19,198,251,40,145,247,56,181,231,
207,225,251,218,35,214,159,230,212,87,
107,164,202,163,199,80,246,213,8,176,
131,190,22,251,165,199,126,25,177,95,
19,18,192,62,6,197,171,104,235,83,
174,173,80,51,5,147,2,39,63,187,
56,25,31,213,215,150,92,73,116,19,
148,41,82,245,82,51,195,90,173,99,
183,227,181,70,51,172,157,182,196,99,
91,89,135,182,51,14,85,197,22,137,
221,228,254,53,127,117,189,179,102,177,
53,226,244,140,227,52,198,101,51,251,
152,237,8,251,38,123,144,46,107,32,
181,35,174,41,17,69,129,127,169,173,
151,1,185,174,139,108,8,202,48,183,
122,129,185,85,215,202,9,95,171,249,
91,190,70,106,157,134,221,236,164,104,
82,219,225,13,204,215,200,98,231,217,
144,158,27,244,215,176,15,231,225,228,
119,171,236,198,229,227,84,236,60,119,
140,211,243,8,195,177,158,202,123,240,
91,204,221,163,148,199,156,190,219,232,
48,38,215,82,186,85,178,207,69,201,
75,170,114,235,186,200,29,227,252,66,
192,57,130,112,30,75,190,12,219,50,
109,104,182,157,6,195,204,101,213,241,
202,142,120,100,38,218,43,190,208,134,
104,246,30,102,162,98,142,10,166,85,
6,163,147,151,99,215,105,13,221,17,
7,140,208,48,82,167,157,182,58,77,
51,140,212,185,225,178,95,177,218,192,
48,106,217,115,167,161,166,25,70,201,
19,171,98,139,68,41,222,191,230,223,
177,110,60,226,186,225,191,77,144,222,
254,253,49,79,35,100,38,132,22,173,
20,109,97,35,108,183,102,103,24,202,
162,241,209,120,105,134,167,77,181,76,
252,230,20,82,135,205,109,251,29,235,
194,54,215,133,200,35,169,89,93,174,
38,180,90,144,225,41,239,92,102,195,
76,194,25,244,144,86,75,180,11,34,
120,194,129,109,55,173,115,209,133,211,
76,47,246,127,97,101,216,224,230,223,
177,62,108,69,98,1,127,32,63,92,
70,180,193,144,53,170,211,54,90,170,
48,92,234,193,157,77,103,166,35,112,
169,25,212,182,28,109,174,202,33,153,
187,179,169,51,75,74,244,110,154,176,
33,82,177,240,149,24,55,130,84,164,
74,222,209,59,204,110,76,83,114,67,
131,79,154,146,79,155,83,125,170,166,
40,121,171,149,236,61,161,146,207,230,
240,145,98,1,29,203,44,74,216,27,
221,252,13,225,108,242,86,146,246,115,
138,63,150,222,44,238,95,136,130,89,
226,60,43,140,43,239,13,250,55,139,
200,91,144,159,160,205,242,78,57,196,
28,108,176,109,131,55,194,7,243,112,
243,96,57,145,173,92,39,222,117,188,
205,250,209,123,244,61,78,148,169,242,
63,100,3,229,188,107,120,203,95,4,
199,124,106,88,160,116,173,188,231,71,
252,155,240,206,225,237,200,27,234,197,
125,147,111,40,222,98,109,249,128,92,
59,87,38,202,23,40,83,206,251,8,
91,109,227,154,208,63,67,173,224,123,
63,84,254,139,191,43,29,63,194,145,
121,239,118,110,99,109,11,223,227,12,
239,108,134,215,124,58,108,139,22,188,
219,25,30,167,99,178,109,109,124,183,
51,124,154,184,103,155,253,85,89,13,
252,242,4,28,194,135,61,238,98,140,
38,124,163,243,223,240,125,234,77,161,
149,7,200,110,20,175,144,221,159,27,
126,132,35,187,184,202,233,26,51,194,
44,204,214,188,78,197,113,43,34,159,
108,196,159,68,246,244,179,205,46,201,
78,10,228,217,22,238,226,73,240,14,
111,120,10,4,174,123,70,93,99,222,
87,234,85,66,156,250,252,73,89,54,
166,216,68,209,18,101,250,44,162,55,
71,152,151,122,205,159,32,125,142,163,
131,127,45,85,184,86,32,137,224,245,
123,159,176,141,87,193,17,122,236,136,
199,248,152,206,43,229,247,212,253,197,
118,209,138,179,88,191,148,74,19,222,
35,46,211,214,167,248,56,131,63,121,
252,20,122,242,44,113,252,86,92,219,
153,46,185,21,222,43,254,45,247,124,
230,2,70,7,168,131,217,87,143,232,
162,244,234,244,94,52,134,19,99,33,
27,251,82,222,61,136,56,188,8,24,
135,52,250,50,85,63,68,25,172,231,
173,231,143,34,140,187,19,225,92,47,
246,142,250,124,118,222,226,236,252,43,
106,253,175,236,26,191,221,91,134,214,
107,134,174,25,186,102,232,154,161,191,
42,134,222,78,50,180,162,221,91,142,
54,106,142,174,57,186,230,232,154,163,
191,42,142,246,99,28,99,92,142,113,
127,45,104,145,189,106,118,174,217,185,
102,231,154,157,239,55,59,251,49,142,
49,67,30,174,7,242,184,175,12,221,
170,25,186,102,232,154,161,107,134,254,
170,24,250,7,206,208,22,59,183,255,
204,49,218,31,103,215,21,122,227,228,
125,229,108,173,230,236,154,179,107,206,
174,57,251,171,226,108,223,170,142,112,
246,189,101,104,181,102,232,154,161,107,
134,174,25,250,30,50,180,68,11,234,
204,187,154,157,151,98,103,145,203,106,
118,174,217,185,102,103,159,157,67,201,
46,195,206,117,230,93,205,208,53,67,
215,12,93,51,244,166,50,116,157,121,
87,115,116,205,209,53,71,215,28,189,
185,28,93,103,222,213,236,92,179,115,
205,206,53,59,111,34,59,215,153,119,
53,67,215,12,93,51,116,205,208,155,
202,208,117,230,93,205,217,53,103,215,
156,93,115,246,253,225,236,58,243,174,
102,232,154,161,107,134,174,25,250,110,
25,186,207,246,2,237,140,112,86,240,
116,124,98,232,240,93,13,239,98,123,
137,108,157,205,123,34,138,118,194,174,
205,227,62,155,245,225,142,98,176,207,
140,97,102,174,132,251,150,209,191,167,
177,251,77,147,120,91,224,218,232,49,
217,57,130,241,125,233,153,140,33,95,
100,205,132,38,89,92,103,247,223,188,
21,221,243,245,105,39,166,43,101,117,
207,159,17,225,92,182,164,174,181,18,
113,175,175,81,215,192,102,209,214,164,
109,230,61,214,182,167,92,219,162,92,
47,90,163,223,115,125,131,152,1,179,
40,55,42,207,88,140,0,212,89,198,
155,100,137,234,130,77,82,91,162,249,
150,168,38,180,171,182,68,171,89,162,
170,208,142,77,179,68,31,135,124,202,
24,58,114,135,75,48,244,152,93,225,
28,153,182,102,232,154,161,139,48,180,
86,51,116,205,208,117,172,64,202,208,
79,66,62,85,102,153,28,253,44,198,
84,59,216,90,122,251,211,135,136,223,
182,29,91,245,231,215,137,76,157,197,
186,162,95,155,199,114,26,190,95,212,
100,125,150,121,63,76,106,192,104,26,
251,52,2,150,131,109,176,15,180,221,
151,138,137,188,232,162,127,7,92,231,
149,230,136,150,192,17,249,125,202,168,
216,167,210,116,105,153,254,176,105,122,
40,215,155,42,26,248,56,118,166,85,
198,171,196,145,45,79,51,155,124,84,
117,113,60,133,81,183,205,62,6,219,
191,186,102,214,241,170,117,88,168,50,
109,169,162,123,207,176,239,127,64,78,
139,157,77,121,9,31,137,6,230,233,
208,84,233,48,45,112,216,95,176,197,
230,104,195,25,56,202,250,58,4,177,
41,208,32,23,57,143,52,21,246,6,
22,4,205,155,177,253,227,58,244,159,
236,74,93,134,149,139,72,18,3,189,
99,152,93,34,11,129,165,241,39,251,
125,29,224,12,218,245,191,1,98,15,
240,202,59,240,55,118,214,239,149,89,
193,168,212,122,36,153,135,125,180,5,
15,20,91,208,184,111,24,74,77,97,
31,39,199,66,64,62,142,105,201,99,
166,201,51,230,121,124,70,28,118,34,
156,226,191,37,111,23,57,255,130,213,
13,3,206,191,170,160,23,192,13,6,
171,119,209,126,87,145,91,84,134,169,
145,176,237,77,174,23,54,114,16,176,
207,140,253,3,235,170,115,43,122,241,
148,237,119,1,76,128,246,210,59,62,
234,188,99,191,127,83,166,41,76,242,
76,56,230,61,183,165,227,71,253,141,
221,79,83,144,218,54,171,7,173,248,
200,254,190,67,78,252,156,58,107,184,
21,219,23,238,114,150,178,231,163,216,
158,191,41,254,251,46,139,157,55,122,
159,241,61,159,167,222,103,188,229,178,
59,125,145,122,172,216,62,217,209,226,
149,125,169,36,239,237,118,102,172,228,
253,34,110,147,205,208,158,186,22,244,
33,148,154,236,62,159,73,143,42,130,
80,150,14,230,93,83,142,173,168,141,
162,135,148,214,79,230,25,94,166,28,
147,236,62,242,56,114,84,145,222,248,
68,178,127,222,189,36,143,200,211,44,
121,171,210,239,253,169,244,222,83,250,
77,41,150,254,137,177,224,101,224,189,
115,43,94,249,187,232,9,84,30,211,
117,198,194,192,190,83,180,246,200,26,
236,176,150,170,49,187,16,234,225,14,
27,56,238,3,119,119,48,98,48,195,
177,93,140,203,172,135,187,159,225,24,
24,189,231,119,216,111,65,79,63,5,
190,144,40,153,23,172,229,73,252,138,
28,185,30,118,41,39,207,114,186,178,
29,121,151,222,14,111,247,7,137,191,
27,198,29,0,131,89,70,60,48,127,
228,7,13,48,208,186,113,208,203,181,
49,98,215,17,188,10,208,40,59,22,
213,195,152,6,206,103,206,87,232,85,
60,100,146,249,3,163,33,32,167,47,
25,209,173,7,169,241,63,153,119,187,
46,63,83,38,175,114,50,223,98,91,
128,167,111,80,147,86,195,2,243,128,
5,244,141,99,129,199,33,119,227,217,
46,148,115,236,55,87,222,254,136,129,
182,63,154,220,44,206,134,61,120,27,
227,91,42,188,112,155,214,108,210,86,
248,226,9,186,206,217,122,165,103,221,
166,177,108,229,231,132,248,216,42,207,
185,30,253,150,233,102,57,237,126,161,
28,160,76,254,206,124,40,136,184,127,
198,43,131,206,0,91,174,70,219,103,
129,182,107,27,168,237,239,113,158,232,
93,232,255,9,199,201,103,146,182,217,
113,164,203,69,70,200,43,9,182,69,
142,124,142,30,238,166,140,172,69,116,
165,156,246,125,23,93,181,81,201,47,
214,112,116,84,185,238,252,140,177,183,
153,210,146,248,197,126,180,228,110,252,
226,245,72,36,142,95,217,113,45,226,
123,85,238,233,241,200,132,22,68,38,
154,117,100,162,142,76,220,187,200,132,
172,79,212,81,137,58,42,177,250,168,
196,3,166,165,176,110,113,30,240,241,
115,238,161,250,107,24,119,120,132,108,
151,157,237,15,136,111,87,96,103,24,
21,117,246,23,44,42,27,217,217,97,
165,129,179,8,81,118,110,226,44,84,
177,156,144,251,52,62,230,99,154,39,
149,109,108,209,39,62,91,78,89,33,
85,34,248,46,230,221,52,80,30,46,
162,238,226,188,77,56,59,216,64,73,
128,183,126,183,227,228,186,60,113,25,
142,113,244,191,13,102,17,9,251,240,
119,21,188,85,86,231,34,143,25,193,
140,137,239,121,111,146,93,178,30,188,
67,236,178,49,222,242,127,179,150,29,
225,217,147,153,118,101,209,214,254,114,
104,203,80,204,198,253,185,178,207,206,
240,25,61,186,115,156,159,220,9,206,
33,183,197,255,29,173,185,232,17,254,
72,115,137,163,148,141,51,178,159,131,
12,148,31,24,186,47,145,113,210,63,
101,215,73,196,173,253,70,96,237,235,
127,17,57,231,75,45,91,234,79,17,
85,223,99,206,151,248,199,200,222,81,
105,167,207,189,151,141,47,55,153,68,
76,28,235,91,236,252,45,28,151,92,
238,65,27,216,135,93,140,57,171,152,
151,208,196,252,4,200,50,5,43,202,
196,61,108,69,140,47,175,71,162,47,
82,209,72,206,238,119,110,197,91,200,
150,102,158,38,140,121,143,133,232,82,
158,38,20,233,153,192,192,58,102,210,
16,3,107,120,126,19,229,8,179,77,
77,148,35,244,63,23,37,57,67,91,
196,192,190,234,98,223,116,110,69,142,
63,4,92,5,119,30,151,163,24,215,
250,134,181,48,46,201,31,83,143,254,
39,43,109,229,67,108,94,226,27,96,
161,91,209,132,44,105,102,107,194,99,
229,87,5,86,196,127,92,129,22,116,
248,10,54,232,191,173,32,198,170,225,
56,12,171,219,166,216,155,161,191,183,
112,78,105,138,61,217,197,89,38,13,
163,178,96,249,223,134,22,60,103,251,
208,93,151,213,128,23,210,35,239,82,
250,233,18,140,75,254,33,207,83,186,
196,140,239,79,193,218,199,248,214,242,
82,119,112,172,5,111,2,178,99,201,
183,160,44,255,164,111,209,254,10,71,
101,17,193,34,168,63,142,111,93,202,
250,85,49,27,207,69,63,159,162,208,
29,236,133,237,132,85,228,103,126,126,
93,248,167,99,89,68,18,207,216,25,
63,225,10,11,170,217,9,50,171,229,
44,248,19,242,67,184,255,59,140,111,
94,225,122,245,235,130,235,53,202,122,
52,198,6,123,52,63,102,224,177,10,
175,32,235,252,50,190,110,222,10,231,
230,105,141,24,215,57,198,153,92,152,
197,243,251,255,46,142,122,59,97,77,
229,81,119,142,82,135,204,111,24,97,
29,140,178,53,208,214,250,25,107,166,
60,71,67,103,216,168,104,111,211,138,
5,24,107,231,56,98,131,77,118,59,
163,174,141,119,253,142,97,231,223,117,
49,41,254,40,61,242,51,47,197,220,
217,180,89,211,117,241,79,154,44,227,
90,240,157,210,195,86,126,102,251,94,
5,51,144,209,109,85,34,31,46,250,
65,196,235,14,183,179,58,145,204,92,
202,216,110,48,89,223,109,198,246,186,
102,32,163,248,197,103,159,160,55,126,
145,104,7,228,1,117,80,231,33,6,
218,17,152,217,9,206,151,126,100,7,
125,23,189,128,124,95,224,202,7,186,
131,75,28,157,128,209,119,150,148,250,
12,109,234,54,218,88,29,148,122,11,
125,169,78,76,234,83,244,149,59,49,
169,195,63,23,247,189,29,175,121,93,
153,0,249,168,222,173,46,252,128,113,
230,47,188,85,180,126,227,11,251,110,
112,105,64,230,241,30,215,145,232,250,
47,176,224,105,205,95,117,79,220,196,
104,201,28,123,56,89,227,38,70,87,
162,214,120,11,231,92,116,140,160,192,
95,250,109,160,62,221,111,221,200,66,
179,186,140,182,112,124,191,164,12,197,
59,147,205,12,183,221,95,217,200,80,
172,46,147,103,66,252,107,130,173,128,
246,222,157,124,154,247,122,52,205,67,
52,46,171,31,113,30,243,156,251,92,
22,107,207,57,255,6,107,200,109,156,
239,12,165,245,125,56,239,182,102,249,
180,153,84,218,24,135,108,99,60,18,
254,182,112,172,108,162,117,116,127,229,
147,196,48,46,145,71,136,253,28,179,
163,193,254,245,51,142,253,149,6,35,
244,75,175,145,19,225,219,31,40,161,
115,100,203,157,216,181,171,88,37,224,
157,206,209,78,119,113,222,30,226,16,
115,60,194,151,142,141,182,104,27,251,
74,131,231,196,105,220,114,237,176,26,
136,26,86,201,21,79,179,247,191,69,
59,193,137,248,21,226,12,197,186,214,
0,148,65,90,140,82,208,211,73,226,
107,61,253,231,151,30,99,27,192,3,
78,230,253,175,250,137,36,98,70,89,
253,110,90,194,225,254,61,147,36,190,
26,186,202,243,6,138,60,147,68,124,
78,200,38,61,147,4,98,241,229,158,
160,144,92,73,92,63,151,228,107,125,
46,201,183,41,207,128,144,115,177,255,
180,200,3,100,212,139,181,243,176,81,
243,240,95,152,135,197,60,212,191,26,
15,139,118,72,205,194,119,193,194,230,
109,179,176,55,218,157,220,44,186,189,
225,249,194,117,93,3,62,222,128,126,
53,240,63,175,59,10,120,250,123,156,
247,128,103,71,219,40,3,39,152,101,
153,6,76,125,137,17,250,33,250,168,
115,111,220,63,153,46,216,57,118,143,
207,177,176,206,23,250,220,244,186,253,
195,243,133,234,117,143,142,206,23,115,
86,176,205,182,215,181,246,112,39,107,
128,117,214,1,254,234,14,169,120,133,
69,239,152,159,96,111,128,191,199,19,
220,119,208,197,95,131,49,22,199,180,
209,26,177,125,29,175,59,161,202,9,
157,125,98,209,69,142,232,124,84,28,
238,66,43,143,161,85,13,175,127,162,
66,115,250,39,26,156,166,127,162,99,
49,96,27,53,86,104,84,232,80,120,
131,40,54,46,98,19,60,175,36,240,
40,220,132,71,113,154,90,195,241,26,
80,155,7,116,151,3,104,172,198,126,
225,125,13,198,125,220,101,60,166,186,
3,42,206,160,240,38,103,221,155,5,
93,248,1,19,51,133,21,62,121,71,
214,171,155,197,155,17,219,199,108,120,
7,188,156,88,191,178,243,49,9,79,
14,217,93,76,14,251,231,139,182,59,
51,92,124,254,201,228,108,176,154,19,
121,123,103,163,155,197,224,104,2,183,
208,27,142,161,24,13,241,78,70,187,
108,119,246,3,117,99,4,85,112,146,
209,132,255,102,72,168,222,238,104,72,
133,5,55,189,187,219,195,95,187,125,
44,172,9,168,207,104,216,135,3,246,
225,164,13,239,151,209,63,206,23,77,
40,45,250,121,66,197,8,142,223,31,
28,66,241,139,5,251,216,172,220,163,
159,19,56,221,47,86,23,129,29,142,
16,209,99,104,220,190,53,132,109,67,
235,20,138,62,21,67,11,37,208,179,
142,224,176,189,158,5,55,115,252,214,
130,95,67,11,127,29,76,80,177,14,
38,20,46,232,227,16,2,157,240,79,
44,49,81,221,59,27,224,190,103,71,
216,254,201,24,79,199,142,132,226,172,
191,139,39,31,156,177,19,40,222,241,
145,113,179,96,127,206,23,45,15,11,
151,10,149,138,134,80,176,114,0,251,
51,245,105,122,88,176,1,228,216,106,
208,185,44,149,151,26,47,117,44,247,
142,123,176,223,100,23,123,220,100,244,
6,138,51,184,17,213,235,117,79,113,
159,94,23,181,174,215,221,197,173,253,
93,252,213,63,186,89,12,7,19,119,
209,120,217,244,38,39,35,250,50,62,
228,91,186,39,252,139,215,59,67,136,
189,163,99,214,188,163,227,62,158,211,
27,237,31,95,193,180,206,72,177,113,
200,221,97,195,221,225,17,10,108,116,
56,164,2,118,253,111,70,208,54,134,
4,27,24,112,130,48,71,19,141,158,
6,78,200,205,49,8,5,161,15,48,
254,52,172,117,216,118,23,141,29,10,
134,64,232,16,164,196,90,236,13,223,
50,17,15,119,223,50,254,123,181,15,
151,57,29,147,180,249,146,128,174,66,
15,200,135,229,36,52,113,58,243,134,
67,68,231,136,244,226,168,135,69,255,
16,101,223,27,2,27,236,193,73,123,
175,96,251,222,144,93,230,240,104,63,
216,112,118,50,192,37,197,84,196,23,
24,99,175,154,82,167,154,82,159,50,
227,93,106,170,218,96,217,76,118,89,
219,225,191,215,135,12,197,215,116,109,
207,75,189,145,135,140,141,109,140,245,
94,34,180,146,91,80,179,111,33,255,
90,42,191,214,22,27,161,230,108,52,
216,9,175,25,187,158,90,8,178,196,
245,188,253,62,179,253,247,251,7,208,
37,251,175,97,143,19,11,41,242,196,
66,21,244,254,15,159,155,129,53,90,
63,109,62,0,0,0,190,109,107,66,
83,120,156,93,78,203,14,130,48,16,
236,205,223,240,19,0,131,224,17,202,
195,134,173,26,168,17,188,129,177,9,
87,77,154,152,205,254,187,45,32,7,
231,50,147,153,157,205,200,42,53,88,
212,124,68,159,90,224,26,61,234,102,
186,137,76,99,16,238,233,40,148,70,
63,10,168,206,27,141,142,155,235,104,
15,210,210,182,244,2,130,14,12,66,
210,25,76,171,114,176,241,181,6,71,
112,146,111,100,27,6,172,103,31,246,
100,47,182,101,62,201,102,10,57,216,
18,207,93,147,87,206,200,65,26,20,
178,92,141,246,92,76,155,102,250,91,
120,105,237,108,207,163,163,19,253,131,
84,115,31,49,246,72,9,251,81,137,
108,196,72,31,130,216,167,69,135,209,
208,255,116,31,236,246,171,14,227,144,
40,83,137,65,90,240,5,167,166,95,
89,32,237,4,88,0,0,10,181,109,
107,66,84,250,206,202,254,0,127,87,
186,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,120,
156,237,157,141,145,219,56,12,70,83,
72,26,73,33,41,36,141,164,144,20,
146,70,82,72,110,144,155,119,243,238,
11,72,201,89,175,29,219,120,51,158,
213,234,135,164,8,18,162,0,144,250,
249,115,24,134,97,24,134,97,24,134,
97,24,134,97,120,73,190,127,255,254,
219,239,199,143,31,255,29,187,39,85,
142,123,151,225,217,249,240,225,195,111,
191,175,95,191,254,170,247,218,190,103,
253,87,57,170,12,195,251,129,188,207,
226,246,240,150,254,185,187,182,142,213,
111,39,127,174,71,87,13,123,62,126,
252,216,214,213,74,254,238,255,108,127,
250,244,233,215,223,111,223,190,253,252,
242,229,203,127,250,162,246,23,181,175,
242,41,42,47,206,229,24,231,145,78,
253,92,174,218,207,177,218,111,249,147,
118,157,91,105,90,95,213,177,97,207,
74,206,157,254,47,58,249,127,254,252,
249,215,54,245,79,255,45,185,148,12,
144,57,50,98,63,231,84,254,200,20,
153,215,254,108,23,244,107,206,37,63,
183,19,218,2,229,27,246,236,228,95,
50,242,248,175,232,228,207,49,228,66,
127,181,12,145,115,181,21,247,89,228,
199,53,224,62,190,58,134,62,0,202,
99,61,49,236,217,201,255,172,254,79,
249,119,239,12,232,121,228,94,127,171,
45,32,215,218,182,44,253,204,88,201,
223,122,0,232,251,149,158,117,195,208,
115,77,249,35,215,146,85,93,235,62,
72,95,247,152,192,121,248,89,146,199,
118,186,33,219,137,245,140,229,95,109,
196,105,12,255,82,117,226,254,115,180,
31,93,205,88,156,109,31,167,95,103,
251,41,89,89,222,41,15,250,109,230,
93,215,121,44,151,178,172,109,218,32,
122,134,49,201,234,154,97,24,134,97,
24,134,97,120,69,24,199,223,147,71,
176,215,167,255,243,111,47,239,89,242,
221,250,30,92,234,107,186,54,245,174,
120,132,203,232,237,106,7,207,230,103,
72,157,240,150,246,190,187,150,247,243,
157,252,207,216,241,143,124,134,121,158,
247,117,190,196,46,189,149,252,255,134,
254,243,22,92,254,244,179,97,207,195,
166,142,77,38,253,119,233,219,195,23,
228,107,233,35,157,207,144,250,36,63,
206,93,249,3,77,231,111,164,140,92,
143,253,200,190,44,219,47,237,223,218,
165,151,242,183,31,226,81,219,64,202,
223,126,54,31,115,63,41,125,137,206,
44,185,32,27,108,190,236,231,156,244,
11,216,103,88,32,35,236,118,5,231,
81,231,180,15,147,246,103,183,29,218,
12,247,66,158,153,22,242,238,236,217,
153,94,202,223,117,244,168,227,129,174,
255,3,117,104,189,224,190,109,63,142,
125,123,93,140,208,46,126,200,125,208,
118,95,247,255,74,59,235,120,231,111,
204,103,74,246,235,244,89,93,146,222,
179,235,127,64,182,233,3,46,236,171,
41,153,225,111,113,127,67,150,252,191,
147,63,125,223,62,64,199,251,88,159,
192,206,223,152,242,39,45,252,0,228,
211,201,255,40,189,87,145,63,207,246,
250,155,178,177,188,139,244,197,219,23,
231,250,222,233,6,244,137,219,9,186,
197,186,24,118,254,198,148,191,207,235,
228,79,156,202,153,244,82,254,156,215,
249,195,254,118,236,91,75,63,91,65,
125,165,63,45,253,119,246,237,229,181,
212,109,209,213,145,253,125,60,71,200,
99,229,75,132,149,191,49,125,136,188,
167,117,229,241,120,230,76,122,222,166,
30,30,85,254,195,48,12,195,48,12,
195,80,99,91,236,155,252,60,62,191,
103,92,61,246,128,25,99,191,31,182,
125,241,179,77,190,139,11,189,21,127,
195,252,195,103,103,103,211,234,252,224,
214,9,232,14,199,132,231,220,192,244,
45,66,94,235,243,107,95,103,63,204,
242,160,175,70,63,156,163,179,171,32,
255,149,221,215,118,48,124,124,216,142,
208,27,216,127,61,199,167,72,191,80,
198,238,219,103,231,115,236,183,227,47,
199,104,31,216,145,241,73,13,199,116,
253,220,126,23,215,123,145,242,231,250,
110,94,167,125,129,182,239,90,230,248,
15,186,121,68,158,235,151,243,207,236,
183,243,53,232,136,233,255,231,88,201,
127,165,255,87,118,240,244,165,167,79,
29,27,41,237,34,251,177,99,48,206,
28,203,118,89,224,147,216,197,11,12,
255,231,90,242,239,124,126,224,185,95,
37,47,207,5,44,206,244,127,112,92,
128,203,201,185,121,206,176,231,90,242,
47,208,201,233,59,47,120,134,23,214,
225,206,115,245,252,95,233,6,183,57,
63,255,29,171,80,204,220,175,53,221,
187,92,237,91,189,227,121,124,222,217,
2,24,195,231,245,196,141,56,157,212,
207,221,248,159,103,0,228,251,191,203,
202,177,76,123,228,63,12,195,48,12,
195,48,12,231,24,95,224,107,51,190,
192,231,134,62,180,146,227,248,2,159,
27,219,220,198,23,248,122,228,26,171,
201,248,2,95,131,157,252,199,23,248,
252,92,83,254,227,11,124,60,174,41,
255,98,124,129,143,197,202,231,55,190,
192,97,24,134,97,24,134,97,120,110,
46,181,149,116,235,134,28,97,127,18,
63,108,196,247,94,67,227,149,223,17,
118,107,173,172,216,189,35,174,224,253,
220,126,101,251,144,238,41,255,180,51,
60,51,94,215,7,219,27,182,185,194,
107,240,172,100,108,249,99,127,193,38,
183,106,75,43,155,156,229,111,127,34,
101,242,250,60,46,227,202,158,96,155,
193,234,94,40,51,122,204,242,207,246,
232,117,10,159,193,166,108,219,43,54,
187,250,223,118,180,238,155,60,153,134,
215,16,195,175,135,13,190,107,55,93,
255,47,108,211,99,27,91,96,253,79,
218,246,249,208,110,125,189,215,231,242,
154,132,171,239,11,145,71,202,223,235,
142,177,6,154,215,196,122,116,144,17,
184,94,118,223,228,50,41,127,63,59,
87,109,198,114,245,53,157,252,29,111,
228,99,246,31,179,159,254,73,122,236,
63,250,190,152,143,145,79,238,247,122,
120,247,140,123,185,38,216,199,33,251,
133,101,185,122,46,254,169,252,187,253,
157,252,211,23,212,197,34,209,175,209,
237,164,127,244,13,185,221,49,252,20,
214,243,228,193,241,71,103,215,255,237,
123,43,210,143,3,183,146,127,215,30,
108,251,119,60,1,253,61,125,71,221,
189,236,218,70,198,168,144,94,250,41,
31,245,157,129,182,236,122,73,29,112,
228,71,191,149,252,11,175,227,75,236,
0,172,214,156,206,123,205,123,217,201,
223,101,200,239,11,251,154,71,149,127,
145,49,50,233,199,219,173,175,207,113,
175,167,153,105,117,109,102,23,151,147,
62,191,46,191,213,254,221,125,172,174,
205,235,242,156,174,126,158,97,236,63,
12,195,48,12,195,48,12,176,154,91,
117,180,191,155,43,240,55,248,83,118,
113,172,195,239,236,230,214,173,246,121,
206,133,231,10,29,189,63,222,130,145,
127,143,125,24,182,161,229,156,26,88,
249,231,119,237,197,182,145,218,118,204,
63,223,229,176,223,169,240,247,68,240,
255,129,143,249,90,219,147,240,45,113,
47,150,63,223,179,241,61,191,234,60,
17,203,204,126,182,140,155,135,35,253,
223,217,230,173,255,217,230,187,62,182,
211,217,70,107,255,140,219,34,113,254,
248,122,176,1,114,173,191,81,232,111,
9,57,198,196,114,166,44,248,136,238,
173,167,110,205,89,91,59,28,237,167,
111,230,58,1,41,127,64,15,184,45,
96,215,167,45,216,55,139,252,40,123,
206,27,177,223,175,155,83,210,237,167,
221,250,187,64,175,194,181,229,223,245,
159,75,228,239,57,31,232,238,252,214,
160,191,201,184,147,127,62,15,58,159,
110,193,51,233,21,231,10,95,91,255,
95,42,127,235,109,116,176,99,109,236,
195,67,62,228,113,164,255,83,254,180,
141,76,147,248,16,199,8,60,178,63,
231,18,60,110,162,143,209,175,110,33,
255,194,62,61,247,231,221,60,242,188,
54,199,127,59,249,227,199,171,244,115,
252,247,232,254,220,97,24,134,97,24,
134,97,24,134,123,224,120,203,140,153,
92,197,127,222,138,221,251,234,112,29,
120,231,182,63,48,215,139,188,23,35,
255,53,158,223,224,248,122,230,199,209,
143,153,131,99,191,93,166,179,178,161,
120,14,94,250,234,108,135,242,188,160,
149,15,208,199,40,19,215,102,249,177,
255,58,126,31,159,166,203,211,217,163,
94,1,108,160,105,15,197,110,231,53,
26,57,175,179,169,23,158,87,199,207,
126,183,92,59,20,219,63,118,254,110,
142,151,237,187,246,231,146,54,101,204,
114,165,223,209,253,191,243,85,98,83,
126,118,249,167,254,163,94,185,247,85,
12,79,55,79,40,233,124,59,43,249,
83,207,233,71,244,252,52,124,63,216,
102,237,31,180,255,208,247,182,42,63,
199,114,142,151,247,87,126,207,50,207,
111,197,78,254,150,217,159,202,127,165,
255,83,254,57,255,215,126,100,142,97,
171,231,152,231,242,238,214,135,220,201,
223,109,20,72,139,54,246,236,109,192,
88,255,91,255,221,74,254,133,253,144,
126,206,115,46,227,18,218,3,121,156,
209,255,144,109,131,52,217,182,79,220,
237,239,21,124,66,30,255,173,100,252,
158,242,247,248,47,231,248,217,7,152,
254,193,98,53,254,219,201,191,200,121,
254,221,248,239,85,228,63,12,195,48,
12,195,48,12,195,48,12,195,48,12,
195,48,12,195,48,12,195,48,188,46,
196,80,22,151,126,15,4,31,254,42,
214,206,49,64,71,92,226,159,191,228,
220,75,202,240,222,16,223,114,75,88,
255,152,181,115,50,127,226,177,40,223,
165,242,231,186,142,74,235,236,183,22,
186,56,148,142,140,39,62,226,146,88,
64,226,150,188,14,206,81,172,251,81,
253,26,98,163,224,218,113,244,142,157,
242,119,120,137,11,236,98,247,41,147,
191,235,238,184,95,202,75,124,149,143,
145,118,206,23,32,222,220,49,231,142,
213,77,188,54,16,107,8,101,159,101,
45,50,199,155,239,250,53,249,159,57,
151,243,29,63,75,94,142,69,186,164,
126,137,57,242,207,177,81,239,177,174,
89,174,215,70,185,56,150,235,127,17,
15,78,63,229,126,59,58,61,74,60,
151,239,219,223,254,161,45,236,116,0,
241,186,196,146,121,78,65,222,27,199,
233,103,187,254,67,254,142,9,92,225,
251,78,253,226,88,202,75,234,151,115,
41,39,233,94,75,255,103,92,126,226,
231,50,125,155,54,237,125,212,179,191,
183,225,239,41,185,30,220,110,93,79,
187,251,114,222,29,94,27,204,247,179,
106,135,126,134,34,183,238,123,31,112,
230,185,226,249,50,57,119,128,54,148,
28,213,47,208,46,28,159,122,45,118,
237,58,251,43,253,199,255,163,243,178,
77,123,222,87,151,30,253,143,251,74,
89,185,175,90,247,173,202,234,181,162,
96,37,183,140,13,237,210,164,108,57,
143,133,188,18,231,149,237,158,182,153,
28,213,175,207,35,79,207,85,122,43,
232,193,85,255,63,59,238,253,19,249,
115,142,231,220,100,154,126,30,118,241,
224,78,183,155,135,68,157,231,55,42,
46,89,231,171,27,43,118,58,211,121,
101,59,244,248,56,203,125,166,126,233,
255,221,124,133,183,178,43,195,145,222,
133,78,254,57,127,163,224,221,192,125,
149,123,66,198,158,35,116,6,175,233,
152,215,120,238,144,227,213,173,115,143,
88,201,191,107,175,140,83,172,31,86,
237,155,252,47,213,231,187,117,74,61,
111,234,12,71,253,191,240,60,139,213,
187,76,39,255,163,178,243,76,172,242,
58,15,228,68,93,178,54,220,106,172,
102,157,153,242,103,76,152,235,4,122,
157,47,175,43,216,189,91,123,142,153,
223,29,186,114,240,221,67,244,77,174,
89,215,113,166,126,225,232,91,187,28,
123,143,121,139,188,163,174,242,205,121,
26,9,99,5,200,122,65,191,167,222,
244,187,244,145,222,59,211,238,119,239,
132,171,177,128,199,57,151,172,19,122,
201,115,122,87,191,148,251,72,174,156,
243,236,243,86,135,97,120,51,255,0,
160,130,250,32,224,191,37,163,0,0,
14,215,109,107,66,84,250,206,202,254,
0,127,146,129,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,120,156,237,157,141,145,28,41,
12,133,29,136,19,113,32,14,196,137,
56,16,7,226,68,28,200,94,233,234,
62,215,187,103,73,64,207,207,254,88,
175,106,106,103,187,105,16,18,8,208,
131,158,151,151,193,96,48,24,12,6,
131,193,96,48,24,12,6,131,193,224,
63,252,250,245,235,229,231,207,159,127,
124,226,58,247,170,231,226,115,165,172,
0,101,248,247,193,255,81,233,249,138,
254,51,124,255,254,253,229,211,167,79,
127,124,226,58,247,50,124,249,242,229,
223,207,46,190,125,251,246,59,239,176,
55,101,4,244,251,71,70,212,251,180,
158,149,158,79,245,191,2,54,209,254,
174,246,95,245,81,250,118,149,166,147,
215,237,223,249,157,93,84,242,172,228,
4,93,26,189,94,165,203,174,103,237,
188,123,62,112,106,231,171,122,235,236,
31,229,107,223,117,185,180,111,123,30,
154,15,121,5,170,254,175,121,101,245,
142,251,159,63,127,254,247,123,232,45,
210,253,248,241,227,247,189,120,134,186,
168,47,11,68,58,189,30,233,51,68,
254,158,38,242,136,188,185,23,101,171,
94,72,23,215,245,121,234,160,105,35,
47,79,71,29,244,122,252,141,207,170,
255,199,223,175,95,191,254,126,238,10,
58,251,115,77,101,209,242,35,77,148,
207,51,89,159,35,61,247,50,251,187,
12,81,158,219,8,155,199,223,208,153,
166,137,239,140,91,92,115,61,69,26,
157,243,56,180,125,69,62,164,71,23,
200,169,233,84,238,248,160,11,218,178,
202,29,215,84,31,170,103,45,159,241,
125,215,254,250,204,21,172,252,127,86,
102,214,255,233,127,157,188,129,204,254,
234,111,168,83,86,119,236,28,122,86,
125,209,46,226,131,47,208,62,168,126,
129,60,86,114,118,186,64,62,202,33,
63,247,21,85,157,253,249,144,207,203,
223,25,255,239,49,23,184,197,254,232,
60,250,35,245,238,228,165,254,149,253,
125,29,226,192,182,216,61,254,70,91,
32,127,254,247,126,134,172,244,81,218,
139,66,243,161,78,153,46,240,183,46,
43,237,145,185,94,101,127,100,212,231,
189,252,76,111,43,91,92,197,45,246,
167,29,107,187,239,228,13,100,246,87,
127,135,239,205,250,40,125,221,253,143,
234,54,238,113,221,253,36,190,35,179,
63,122,208,54,150,233,66,211,169,205,
105,23,200,239,246,199,63,242,76,252,
229,25,205,55,174,33,227,51,236,79,
95,81,125,208,159,1,117,245,239,234,
111,25,223,28,154,30,153,233,91,250,
61,158,165,15,116,107,165,200,139,251,
248,77,192,255,145,198,239,33,39,125,
47,3,245,198,135,100,186,208,114,50,
249,201,95,199,67,250,135,255,239,178,
168,252,58,151,169,244,233,186,29,12,
6,131,193,96,48,24,12,58,56,247,
151,221,127,205,242,111,193,61,184,132,
43,56,45,243,52,125,197,219,158,194,
99,229,196,165,88,207,100,113,129,123,
98,85,254,234,217,21,159,214,113,152,
143,194,169,206,174,232,184,226,109,239,
33,171,198,182,171,103,42,206,170,242,
31,85,92,122,183,252,91,249,180,71,
65,229,214,61,19,94,167,43,114,117,
241,252,123,181,235,76,86,229,213,252,
254,9,231,85,165,63,41,255,86,62,
173,210,147,243,134,206,41,250,30,5,
231,120,144,133,124,156,3,89,233,172,
210,129,198,21,187,103,30,105,127,244,
227,156,92,197,121,105,220,94,99,230,
85,250,211,242,111,225,211,42,61,17,
163,11,192,179,194,243,33,243,202,254,
196,237,84,22,149,179,211,89,165,3,
181,63,114,102,242,103,254,255,202,30,
154,19,251,87,156,151,115,214,202,189,
86,28,217,110,249,212,245,42,159,86,
217,31,238,88,249,35,229,20,61,255,
204,70,200,220,253,127,170,3,207,171,
146,127,151,43,91,161,26,171,224,70,
244,126,197,121,5,72,171,92,76,151,
126,183,252,91,249,180,206,79,210,135,
163,140,104,15,244,53,158,221,181,191,
142,25,158,246,84,7,167,246,191,21,
234,111,224,26,148,119,175,124,83,102,
23,174,251,220,193,211,159,148,127,43,
159,214,233,41,179,183,206,59,25,23,
180,236,204,70,1,229,22,179,180,59,
58,120,13,251,235,216,201,199,247,226,
41,47,136,79,83,206,11,121,178,235,
85,250,147,242,111,225,211,50,222,206,
101,3,202,41,86,101,51,39,119,174,
148,231,145,103,71,103,153,142,61,239,
74,254,174,94,131,193,96,48,24,12,
6,131,193,10,196,190,136,249,156,130,
117,32,107,152,85,44,170,75,19,115,
219,29,254,231,30,216,145,53,128,110,
30,89,230,174,44,247,6,231,98,88,
119,123,12,127,5,226,31,172,191,119,
214,38,221,250,245,153,251,25,51,174,
81,215,148,129,248,78,172,240,81,101,
118,215,31,9,143,93,7,168,175,198,
183,186,246,175,103,99,72,175,250,203,
158,231,25,238,105,189,157,247,138,123,
238,151,244,204,65,166,51,158,233,244,
73,127,243,56,134,199,104,179,242,119,
242,202,100,204,210,117,215,119,203,200,
244,184,131,85,28,73,247,228,87,231,
113,148,131,240,56,173,238,213,215,231,
73,163,62,7,157,43,151,163,241,64,
229,236,148,15,112,153,244,28,81,197,
159,225,243,200,71,99,254,90,151,170,
252,157,242,92,198,170,204,234,250,142,
188,196,27,85,198,19,172,236,223,157,
183,4,93,204,210,249,47,248,58,237,
255,232,202,207,51,100,231,59,201,171,
58,103,66,57,200,82,157,141,200,244,
239,124,71,87,126,149,151,238,215,119,
25,171,50,171,235,59,242,102,122,60,
65,199,143,145,223,138,103,236,236,95,
233,127,231,108,17,249,250,167,203,23,
121,208,253,142,207,210,254,158,197,226,
179,242,61,175,157,179,132,85,153,213,
245,29,121,51,61,158,32,27,255,149,
91,244,54,95,237,251,185,218,255,51,
93,85,253,95,203,238,236,239,28,244,
170,255,107,222,93,255,175,230,127,93,
255,215,178,171,50,171,235,59,242,222,
106,255,128,142,45,62,134,225,159,116,
124,233,248,43,151,105,53,254,171,220,
110,255,128,158,225,171,206,159,103,186,
90,205,89,124,60,245,49,78,121,197,
172,124,69,55,254,107,250,170,204,234,
250,142,188,247,176,63,245,174,214,255,
122,47,107,155,220,215,62,228,60,154,
207,255,61,141,206,145,125,78,159,205,
229,187,24,129,206,133,249,158,1,25,
252,62,229,117,229,87,121,173,100,172,
202,172,174,175,210,100,122,28,12,6,
131,193,96,48,24,12,42,232,220,92,
63,87,56,192,71,163,146,203,215,31,
31,1,207,226,2,89,187,251,30,204,
213,58,130,253,210,207,68,21,103,171,
246,99,190,103,60,139,11,204,246,50,
43,178,184,128,238,217,213,253,255,39,
235,87,181,21,177,54,189,158,113,110,
216,159,123,158,7,114,232,117,231,34,
119,184,60,210,84,107,244,206,46,153,
30,244,92,160,114,164,149,190,110,229,
27,79,224,251,239,213,62,85,236,143,
152,19,126,99,135,35,84,63,163,241,
43,174,235,158,121,246,239,123,188,81,
249,194,44,143,44,94,157,113,70,29,
47,88,197,251,118,56,186,46,214,169,
103,19,225,215,51,125,237,200,184,226,
2,79,80,249,127,236,143,12,126,110,
37,227,104,85,7,222,71,52,14,167,
231,248,40,95,251,133,115,110,124,87,
125,84,103,38,120,94,99,235,244,147,
44,70,237,253,133,182,199,249,21,176,
195,209,173,184,14,242,171,244,181,43,
227,138,11,60,193,202,255,35,43,125,
47,227,85,119,56,66,206,82,104,95,
207,202,239,228,209,124,187,51,51,33,
15,109,150,114,92,55,85,57,140,109,
234,223,40,123,197,209,157,112,157,153,
190,118,101,220,229,2,119,208,233,91,
251,172,250,120,175,235,14,71,168,239,
181,204,250,191,142,223,93,255,223,177,
63,103,59,245,44,231,110,223,210,189,
3,218,111,119,56,186,93,174,179,210,
215,149,254,175,207,223,98,127,247,255,
200,238,227,63,250,199,79,86,233,188,
61,249,184,90,217,95,243,206,198,255,
29,251,163,35,191,118,101,252,63,225,
232,118,185,206,78,95,87,198,255,157,
179,142,21,170,245,191,114,222,89,76,
128,235,218,111,59,142,16,249,176,159,
206,49,179,103,178,57,112,86,94,149,
71,181,126,62,153,91,95,225,232,118,
184,78,79,183,83,247,29,25,159,21,
51,24,12,6,131,193,96,48,24,188,
127,192,231,232,218,239,81,184,146,183,
190,91,227,30,239,190,215,216,192,9,
118,101,127,79,92,20,107,94,56,0,
214,148,143,168,3,118,60,1,235,90,
98,122,186,175,178,219,7,92,1,142,
225,20,26,79,236,112,165,142,175,5,
98,22,190,110,36,126,22,240,125,172,
190,14,199,111,232,122,149,51,24,241,
209,152,13,109,75,227,11,232,171,227,
118,85,198,206,254,93,94,187,105,180,
78,186,15,222,229,184,87,29,65,246,
187,35,180,247,120,142,235,148,171,233,
2,145,230,106,223,202,116,196,245,236,
28,11,113,11,141,179,58,7,163,191,
207,69,61,208,13,122,37,214,133,223,
113,249,41,67,99,241,213,89,1,181,
69,197,209,237,164,113,153,180,174,202,
121,82,71,253,45,161,43,117,12,40,
15,75,92,15,251,104,172,80,211,17,
39,165,220,42,94,216,161,178,191,94,
175,236,175,241,113,218,61,109,18,61,
121,124,75,243,242,248,118,197,171,101,
252,137,219,92,253,152,114,200,138,157,
52,1,181,159,199,31,61,142,155,241,
123,87,234,184,250,221,49,210,251,251,
4,157,59,61,221,183,229,242,120,28,
218,235,19,112,251,59,111,64,62,250,
155,148,200,152,233,6,84,92,212,142,
253,43,30,67,177,147,6,61,42,239,
153,201,171,124,152,191,71,240,74,29,
79,184,67,202,229,3,87,93,249,150,
21,120,142,49,46,179,153,239,181,160,
15,57,95,69,159,208,177,169,226,13,
189,253,86,253,113,199,254,1,245,127,
202,227,41,118,210,40,231,168,227,160,
202,145,125,207,236,191,91,71,229,4,
241,249,29,119,168,156,159,238,199,186,
2,29,219,244,227,123,45,226,131,111,
244,189,28,220,83,29,100,215,149,95,
203,158,239,206,215,131,202,254,248,50,
229,212,29,59,105,84,38,159,119,42,
223,206,119,250,135,183,153,147,58,6,
212,6,186,167,199,199,103,215,173,182,
147,83,254,79,161,227,7,115,204,236,
222,106,143,221,234,186,239,37,90,141,
91,126,95,203,175,100,233,214,174,183,
164,241,178,43,157,156,214,241,244,185,
204,119,93,217,255,55,24,12,6,131,
193,96,48,248,187,160,235,24,93,207,
220,107,30,217,237,73,140,117,144,190,
43,101,167,76,93,171,18,239,206,214,
130,239,1,111,65,94,143,231,176,238,
59,61,71,82,161,179,63,156,0,233,
118,236,175,177,22,214,59,60,247,22,
244,121,130,183,32,111,22,143,36,78,
238,49,27,231,180,136,61,58,223,165,
80,238,86,227,21,1,158,117,159,163,
60,180,199,32,60,38,171,252,191,234,
51,75,171,121,19,67,169,184,24,47,
23,249,52,150,163,28,114,199,41,105,
61,181,254,42,47,124,206,142,94,144,
93,203,81,185,78,208,157,49,113,142,
71,185,8,141,165,119,62,195,185,123,
229,149,225,11,60,70,170,245,243,243,
141,206,193,86,254,159,114,178,50,189,
110,217,222,108,111,255,216,141,216,167,
199,124,177,109,182,111,155,182,2,39,
226,113,98,236,173,237,162,211,139,203,
238,114,157,96,101,127,236,234,101,102,
177,255,21,143,232,54,10,48,7,168,
108,122,146,159,115,65,222,95,178,188,
171,24,176,238,15,210,120,55,177,214,
236,183,163,42,238,85,125,141,238,173,
82,174,37,243,25,43,189,184,191,67,
174,19,172,252,191,219,95,231,9,183,
218,159,126,73,92,253,81,246,215,126,
177,107,127,252,6,121,169,207,35,95,
183,255,106,111,7,126,68,121,85,229,
15,192,174,94,170,250,158,96,53,255,
163,158,112,140,186,7,229,22,251,107,
185,238,135,111,181,63,58,164,28,213,
203,174,253,201,67,199,14,181,185,238,
119,217,201,7,127,174,252,159,203,235,
62,63,211,75,118,207,229,58,65,182,
254,243,125,69,58,183,200,206,95,171,
110,28,43,123,209,254,117,255,195,61,
236,175,243,191,234,220,114,160,179,155,
247,113,205,147,190,204,179,93,62,62,
255,203,100,209,125,24,43,189,248,252,
207,229,26,124,76,188,133,245,226,224,
245,48,246,255,187,49,252,254,96,48,
24,12,238,133,108,253,183,138,101,128,
183,244,174,249,142,103,58,133,174,215,
186,241,182,138,157,158,96,87,215,247,
44,51,203,79,227,63,171,189,145,1,
93,151,190,5,92,57,251,80,129,248,
215,238,126,205,91,176,163,107,79,255,
8,251,87,249,105,236,71,99,21,126,
198,41,227,8,29,196,45,60,158,14,
119,166,188,46,253,143,51,113,204,125,
149,15,227,158,127,39,118,170,117,240,
119,36,86,177,146,172,110,26,147,209,
118,225,242,40,178,114,178,186,194,255,
184,174,53,142,239,50,169,189,136,83,
59,87,184,139,202,255,107,140,95,207,
75,209,207,148,243,173,56,66,47,7,
221,193,157,104,249,232,69,207,213,160,
31,151,39,139,57,234,119,63,127,75,
59,210,120,58,242,120,27,240,186,5,
60,150,236,124,64,182,15,219,99,179,
196,207,189,174,21,135,167,249,86,250,
224,121,226,198,21,7,187,99,127,247,
255,64,219,150,142,83,30,119,205,56,
66,7,28,149,242,113,174,195,238,255,
93,251,163,23,61,143,233,50,7,244,
108,143,66,211,101,54,86,125,101,246,
247,185,136,158,173,171,242,82,253,40,
183,216,233,195,203,225,222,9,86,254,
223,101,202,246,90,84,28,161,235,132,
52,221,251,31,239,97,127,100,162,173,
101,50,7,222,146,253,43,110,241,89,
246,207,230,127,248,66,245,151,186,143,
2,159,84,113,132,174,83,252,127,215,
255,3,187,254,14,223,148,233,60,155,
195,239,248,127,173,91,38,207,61,252,
127,102,255,142,91,124,134,255,247,15,
245,247,115,176,122,238,80,231,41,25,
71,232,229,232,217,193,170,125,123,90,
215,133,206,51,171,179,153,110,55,197,
106,254,23,112,251,87,243,191,206,119,
102,229,116,246,239,184,69,191,119,207,
249,223,91,199,189,215,59,131,247,133,
177,255,96,108,63,24,12,6,131,193,
96,48,24,12,6,131,193,96,48,24,
12,6,131,193,96,240,247,225,17,123,
209,217,251,244,145,193,126,19,255,172,
246,189,179,199,210,223,105,17,96,111,
76,246,121,132,62,117,111,169,195,223,
105,92,113,137,236,75,243,124,125,255,
8,239,0,210,15,251,55,158,201,83,
118,117,57,205,71,247,237,241,169,236,
175,191,99,194,190,35,246,217,233,62,
183,44,207,106,111,240,173,242,119,123,
245,213,134,250,30,16,135,214,27,221,
178,135,76,251,4,249,61,171,109,87,
232,234,242,200,50,117,95,164,246,141,
172,255,56,216,175,150,229,233,159,106,
111,158,63,187,218,27,178,107,127,222,
203,68,250,248,223,223,177,161,246,127,
109,188,134,253,253,119,7,212,62,244,
195,14,236,35,174,160,125,169,219,203,
22,215,245,183,69,58,172,236,79,219,
161,79,59,60,255,172,255,115,157,252,
121,151,155,238,161,212,125,155,1,218,
155,190,107,137,125,126,250,140,238,177,
213,124,181,77,146,134,239,39,56,25,
67,84,23,254,174,161,172,111,43,168,
91,87,158,250,130,204,246,140,189,248,
134,85,153,228,169,239,239,81,153,245,
253,114,39,246,247,189,238,92,231,127,
173,39,231,146,116,156,84,89,184,207,
119,244,138,204,122,46,68,243,165,61,
168,220,87,124,211,201,126,113,61,95,
161,190,0,121,170,190,77,187,220,241,
231,217,217,1,205,199,247,150,175,228,
199,143,107,254,1,116,167,239,98,83,
61,50,230,251,124,165,210,177,207,121,
180,78,218,95,125,79,175,238,101,215,
249,148,230,145,189,219,143,246,224,253,
240,116,76,224,156,83,54,159,113,96,
67,255,237,204,106,28,102,253,180,51,
150,35,203,233,220,176,179,63,122,213,
49,11,255,233,237,72,237,175,254,93,
247,154,147,231,137,253,245,92,34,237,
87,203,204,222,93,229,243,172,202,254,
252,79,59,190,50,39,64,190,236,227,
64,126,116,71,27,206,252,58,186,171,
252,170,231,123,229,221,117,129,202,254,
234,55,1,109,49,139,21,232,153,81,
93,223,80,87,157,31,86,231,27,50,
251,83,174,142,229,122,93,207,165,122,
159,210,115,31,157,253,145,201,219,215,
51,208,197,93,118,231,22,145,238,170,
220,221,120,119,210,158,244,221,58,218,
151,62,218,121,138,193,96,240,161,241,
15,136,36,106,162,235,119,189,22,0,
0,4,121,109,107,66,84,250,206,202,
254,0,127,162,54,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,120,156,237,154,137,109,235,
48,16,5,93,72,26,73,33,41,36,
141,164,144,20,146,70,82,136,63,54,
248,99,60,108,72,217,177,100,248,154,
7,12,116,144,226,177,203,67,34,181,
223,43,165,148,82,74,41,165,148,82,
74,253,215,247,247,247,254,235,235,107,
74,133,223,131,178,30,151,76,251,18,
233,95,83,85,159,221,110,55,229,243,
243,115,255,250,250,250,115,126,203,117,
167,30,85,214,45,85,190,127,121,121,
57,216,99,235,244,175,173,244,255,251,
251,251,47,74,117,172,122,63,163,255,
105,251,207,224,255,153,62,62,62,126,
218,0,115,1,109,163,174,43,140,118,
193,117,133,213,145,248,21,206,189,89,
154,117,204,56,179,180,250,179,117,78,
25,210,63,164,87,80,62,202,49,74,
115,164,138,87,105,86,255,231,252,145,
253,95,117,75,240,69,31,255,137,207,
184,136,47,114,156,204,249,163,194,136,
95,226,154,103,75,149,87,93,215,177,
158,153,205,69,89,30,242,99,108,202,
243,44,91,166,159,84,156,89,27,72,
187,84,190,207,224,255,14,182,155,249,
255,237,237,237,240,142,136,125,120,166,
247,199,76,35,125,65,155,32,188,210,
226,156,246,71,252,158,86,29,203,55,
188,151,145,94,247,125,62,147,105,210,
158,186,178,45,231,28,248,232,254,159,
105,230,255,236,59,125,158,76,74,248,
176,236,88,237,38,199,84,202,80,247,
51,253,84,222,35,175,244,223,168,29,
103,255,174,240,74,31,31,214,249,108,
14,32,30,101,228,253,39,239,61,138,
214,248,63,133,205,152,111,233,231,249,
110,128,237,177,97,246,235,236,155,244,
189,124,55,24,141,21,249,62,154,253,
63,199,144,244,85,150,37,203,59,171,
239,18,143,162,173,252,143,47,241,109,
246,181,158,78,127,47,232,227,73,142,
181,217,247,102,243,81,214,131,252,122,
123,200,241,60,211,100,204,233,54,233,
100,153,110,249,59,232,175,218,202,255,
165,178,81,190,3,150,109,251,123,123,
247,53,237,36,253,192,251,4,105,209,
166,120,230,20,255,103,60,198,36,242,
34,205,94,190,37,61,234,252,175,148,
82,74,41,165,158,83,151,218,231,205,
116,239,101,47,249,214,148,235,32,151,
176,97,125,27,205,190,107,250,247,212,
95,181,246,121,181,63,172,57,212,154,
201,108,205,122,141,210,255,125,109,35,
191,243,71,223,252,75,107,33,172,155,
244,243,107,40,203,57,234,71,252,227,
49,187,191,148,222,232,122,150,215,44,
173,81,191,38,238,108,205,105,86,230,
191,138,253,178,220,251,35,95,214,60,
242,156,246,194,51,185,206,158,109,36,
247,94,57,103,13,151,123,57,38,176,
119,179,38,188,219,58,203,153,235,137,
117,143,245,102,214,154,250,186,82,133,
247,58,214,189,76,43,109,87,199,244,
25,144,87,94,163,30,167,196,122,37,
247,73,151,189,238,165,50,159,163,238,
151,108,111,163,254,207,90,27,182,102,
63,190,107,52,246,87,188,220,199,45,
232,35,172,243,173,9,63,86,47,236,
151,99,94,255,183,33,247,33,16,123,
25,117,204,181,202,180,85,166,217,243,
26,217,183,255,19,65,156,209,253,145,
255,71,101,62,71,125,254,63,197,255,
25,127,246,254,144,118,226,156,189,25,
142,248,51,255,201,88,19,126,106,189,
250,156,151,123,2,248,122,84,167,244,
65,183,79,94,207,242,202,176,209,62,
19,247,179,63,115,157,121,143,202,124,
174,182,240,127,223,71,41,159,80,166,
60,47,49,214,49,126,50,150,209,158,
215,134,159,82,47,194,24,55,248,143,
0,27,211,190,16,115,109,247,127,31,
115,114,143,242,152,255,249,127,34,243,
40,245,251,221,255,179,50,159,171,99,
254,207,185,29,59,244,126,146,117,45,
245,241,41,125,131,191,136,203,60,182,
85,248,49,187,103,24,182,228,253,58,
231,97,198,112,226,98,231,180,53,123,
157,248,51,247,40,143,149,131,127,107,
241,33,109,39,109,202,158,217,200,255,
163,50,159,243,46,200,126,91,214,41,
125,71,223,206,186,98,143,209,88,69,
220,76,175,231,215,253,217,251,193,154,
112,194,150,234,149,97,212,131,185,164,
251,55,231,242,209,55,24,207,247,231,
70,121,245,48,218,64,223,139,76,27,
19,63,243,158,149,185,247,181,75,104,
105,189,64,61,190,244,191,82,74,41,
165,148,82,74,41,165,148,82,74,93,
77,59,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,17,17,
17,17,17,17,145,59,228,31,135,151,
142,106,217,59,142,156,0,0,1,83,
109,107,66,84,250,206,202,254,0,127,
165,133,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
120,156,237,214,225,105,131,96,20,134,
81,7,113,17,7,113,16,23,113,16,
7,113,17,7,177,188,129,11,183,166,
33,255,138,9,231,129,67,155,79,251,
235,77,108,206,83,146,36,73,146,36,
73,146,36,73,146,36,73,146,36,73,
146,36,73,31,209,113,28,231,190,239,
79,231,57,203,181,119,247,191,186,79,
247,111,93,215,115,28,199,115,154,166,
199,207,236,24,253,44,247,212,189,117,
22,203,178,60,94,199,48,12,127,190,
135,116,239,178,99,149,125,179,97,118,
173,205,251,61,181,127,213,55,191,254,
141,238,95,182,235,123,86,57,235,159,
229,122,157,125,251,198,217,191,186,94,
211,253,203,115,190,239,95,255,215,231,
121,126,218,63,215,236,255,125,101,219,
122,238,215,239,219,182,253,250,204,247,
231,191,253,191,175,250,30,215,247,171,
247,64,174,213,119,251,156,69,213,159,
29,215,107,146,36,73,146,36,73,146,
36,73,250,247,6,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,248,64,63,10,
249,172,184,82,218,42,102,0,0,1,
5,109,107,66,84,250,206,202,254,0,
127,177,164,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,120,156,237,215,209,10,130,64,16,
5,80,203,146,254,255,111,35,98,106,
65,73,6,95,130,108,150,58,23,14,
56,235,203,133,157,7,29,34,98,72,
98,227,140,255,176,78,117,23,234,118,
160,186,3,223,115,72,115,204,103,99,
7,221,216,223,45,205,45,235,157,184,
118,208,145,125,188,147,234,174,124,222,
152,238,246,60,207,211,211,37,94,59,
114,234,160,43,251,56,166,231,229,190,
167,141,247,252,190,232,160,3,53,218,
183,96,203,189,131,46,212,104,201,255,
132,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,208,
60,0,157,104,104,54,236,25,80,26,
0,0,42,23,109,107,66,84,250,206,
202,254,0,127,212,240,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,120,156,237,125,43,184,
236,40,214,246,146,72,44,18,137,196,
34,145,72,36,22,25,137,196,34,35,
145,88,36,18,25,137,141,140,140,140,
141,44,153,127,81,251,156,238,158,158,
233,249,212,255,212,136,90,115,233,62,
85,123,215,9,176,46,239,187,46,84,
230,231,125,54,158,0,218,179,145,45,
198,215,70,96,135,163,195,2,112,93,
197,5,107,0,223,133,126,195,243,98,
29,224,129,10,16,1,182,10,27,208,
158,36,193,119,221,147,217,177,132,193,
241,205,124,115,252,241,67,111,0,149,
155,221,65,43,213,113,51,182,190,108,
79,21,20,224,120,157,64,225,40,233,
48,240,97,185,175,43,63,247,9,18,
160,220,84,44,164,95,141,3,175,55,
129,184,115,92,157,219,222,207,152,94,
66,108,49,41,252,67,17,243,149,210,
15,15,43,212,107,219,40,238,70,121,
78,34,56,245,150,100,80,67,204,95,
57,22,200,210,62,79,6,48,38,108,
171,52,184,143,73,109,43,254,238,235,
110,144,119,238,219,71,23,143,114,197,
176,248,141,153,224,1,60,81,170,131,
113,9,15,209,20,9,43,175,151,178,
133,72,147,125,12,250,161,174,193,101,
161,183,29,127,113,143,185,174,126,126,
130,91,41,46,163,53,99,131,137,54,
44,214,250,184,197,192,193,130,109,14,
158,29,4,117,79,160,248,239,168,57,
112,92,248,211,253,60,47,27,15,47,
63,188,252,183,184,78,196,58,18,158,
147,77,194,155,5,112,41,182,21,32,
21,246,196,156,45,28,213,30,50,112,
192,39,15,135,117,75,113,96,2,190,
180,205,95,183,224,218,230,192,31,213,
47,184,153,251,54,252,52,29,60,126,
0,133,11,180,30,55,55,83,234,27,
129,199,225,78,221,213,66,81,215,225,
214,237,243,235,167,168,148,117,77,224,
247,123,143,142,251,53,200,37,46,66,
166,78,201,138,11,24,107,58,24,9,
107,155,78,192,188,109,129,57,216,15,
252,231,2,42,167,117,129,85,197,124,
50,168,134,217,37,59,209,239,17,129,
155,171,29,184,93,70,225,97,215,146,
41,207,11,170,82,69,37,72,87,99,
48,77,103,3,198,62,187,248,41,47,
116,105,104,147,102,152,245,213,9,209,
184,88,134,62,202,202,28,168,18,203,
69,203,197,242,227,41,21,150,212,60,
15,44,233,54,246,115,52,197,225,192,
127,214,53,155,122,224,98,240,63,164,
162,74,31,240,224,246,92,27,60,25,
79,28,77,37,79,35,40,55,228,54,
224,58,167,22,61,9,157,170,234,253,
211,139,7,89,65,163,247,194,131,72,
13,182,171,8,144,76,160,115,54,155,
206,3,77,131,88,234,200,249,66,99,
88,157,38,199,152,74,189,19,116,4,
101,187,46,202,246,18,252,168,207,9,
51,46,24,106,101,40,148,207,63,212,
60,63,157,45,49,233,36,112,157,79,
1,61,0,253,127,120,20,26,18,140,
11,255,218,253,9,31,93,60,74,116,
194,161,183,86,103,155,154,96,124,73,
44,60,228,184,149,125,224,70,243,14,
81,106,93,208,111,37,91,80,97,209,
253,1,136,54,253,24,88,18,89,191,
205,60,225,23,170,63,16,168,89,111,
104,0,128,70,158,23,252,48,54,55,
225,129,173,31,54,74,70,241,151,71,
91,240,133,5,119,118,41,154,207,55,
63,44,28,228,64,119,142,10,141,6,
110,77,224,199,166,221,19,109,204,5,
202,107,62,63,245,232,201,76,218,106,
239,15,179,21,61,128,221,15,218,37,
119,131,90,136,105,122,70,84,120,6,
129,16,244,132,36,17,129,175,107,80,
246,56,155,69,183,144,109,242,248,9,
106,65,79,153,241,212,215,250,222,128,
171,158,28,62,126,254,146,134,229,220,
224,216,134,145,186,6,233,66,57,250,
181,226,9,134,11,214,164,2,56,85,
173,171,75,28,14,67,195,118,180,106,
98,235,15,76,11,232,229,231,67,188,
2,239,128,121,175,5,161,11,231,30,
141,59,164,109,23,106,11,80,46,212,
5,32,151,248,227,239,68,107,241,21,
194,234,119,254,161,85,255,69,194,194,
128,51,244,220,168,193,148,145,149,146,
56,120,235,85,192,133,74,202,252,185,
115,18,143,163,18,137,158,92,132,179,
8,14,232,201,159,142,43,59,6,125,
7,4,115,173,24,70,16,227,29,81,
40,30,75,73,173,238,247,166,88,221,
155,132,198,168,10,185,49,11,203,250,
254,43,75,143,250,168,232,100,88,140,
31,93,59,74,196,163,142,239,99,8,
136,120,36,157,167,68,209,215,183,222,
15,16,158,162,19,88,96,105,215,30,
32,236,168,235,209,16,64,108,204,143,
251,114,110,176,109,36,129,168,198,94,
215,57,206,132,239,122,66,71,207,158,
160,81,61,21,198,110,102,16,228,107,
132,68,234,246,172,101,59,10,60,168,
253,248,22,97,211,252,62,44,181,226,
162,158,155,106,198,239,107,135,48,66,
159,91,112,40,245,226,36,191,29,0,
186,135,199,160,145,219,246,204,112,253,
52,12,110,203,25,203,113,96,148,88,
198,147,249,9,250,118,207,181,246,232,
24,217,46,120,245,72,110,140,251,141,
111,114,159,74,190,128,207,53,172,241,
193,224,255,72,224,28,117,169,137,241,
234,235,135,151,143,11,102,224,167,22,
12,237,215,215,97,236,24,149,134,137,
91,90,23,25,58,62,60,199,77,64,
74,163,57,243,2,253,2,172,226,36,
211,113,93,21,1,161,0,125,61,72,
133,22,12,107,4,208,254,51,198,202,
24,186,227,175,249,233,178,186,116,191,
81,147,61,127,130,1,44,9,55,198,
199,6,181,223,187,253,236,234,231,115,
13,196,62,144,227,162,51,248,182,239,
222,220,54,91,166,209,103,149,168,151,
12,82,76,141,216,141,170,168,249,17,
173,63,23,183,40,12,141,38,119,221,
46,55,67,35,126,66,123,8,130,93,
175,211,10,215,226,151,85,212,87,2,
178,12,55,153,210,49,127,106,107,126,
130,101,148,99,71,187,191,114,22,203,
199,249,31,208,227,68,216,46,27,18,
61,244,203,75,180,220,238,235,8,197,
64,221,87,221,199,177,77,18,3,251,
48,229,128,144,3,227,251,237,232,228,
188,48,206,92,6,218,242,120,127,144,
243,174,118,207,113,223,78,90,162,11,
62,35,4,198,13,131,132,140,224,66,
69,151,9,153,165,41,149,130,186,38,
121,216,65,125,116,229,63,66,251,234,
11,89,236,109,40,194,87,73,112,225,
129,201,177,242,128,241,11,184,124,189,
50,151,43,232,253,224,92,50,183,246,
32,237,222,41,144,108,220,56,183,214,
116,108,24,5,28,193,64,90,46,66,
189,128,163,239,24,4,149,101,241,133,
139,141,131,82,83,223,244,129,198,131,
109,62,100,152,73,129,233,254,108,254,
244,242,39,78,13,97,134,100,196,162,
71,51,185,37,141,134,188,35,171,41,
63,232,188,207,36,5,1,115,31,28,
223,9,3,95,53,61,19,178,237,89,
28,199,66,82,35,45,107,34,113,71,
80,45,208,101,18,254,34,231,102,173,
193,8,194,225,37,214,169,45,207,147,
51,30,55,234,208,228,204,200,56,212,
77,57,153,25,129,207,138,25,138,44,
27,172,232,228,95,42,110,59,72,130,
193,250,198,69,22,66,198,177,134,29,
214,99,108,191,126,248,206,238,177,231,
13,203,157,91,131,142,47,115,97,159,
103,184,73,21,23,69,8,50,229,44,
122,3,210,49,218,23,116,129,27,58,
146,107,76,198,211,231,206,193,6,161,
205,237,28,200,153,8,15,229,163,139,
71,41,230,28,212,123,18,55,202,111,
240,203,197,110,100,168,248,164,232,183,
240,225,149,123,64,114,245,80,152,62,
16,198,107,194,119,140,107,215,189,190,
161,11,35,184,15,107,88,23,102,121,
145,18,214,69,199,247,154,200,65,169,
205,66,194,57,194,117,77,16,176,219,
222,52,80,61,185,95,4,211,108,146,
144,198,103,87,143,174,216,135,221,78,
149,20,213,35,150,95,110,153,135,71,
239,164,112,3,112,11,44,90,133,30,
18,255,85,117,155,54,200,147,247,195,
86,166,155,211,176,184,229,48,69,75,
145,55,42,124,183,253,24,93,175,123,
157,252,55,53,70,92,233,212,182,187,
250,122,81,216,21,160,122,33,225,130,
199,7,9,117,21,72,128,62,238,255,
243,166,117,112,154,178,218,246,245,84,
217,163,187,111,51,80,41,136,248,180,
91,224,94,213,54,227,214,218,243,227,
96,32,45,154,100,38,18,225,42,61,
182,37,196,192,202,102,89,146,60,191,
94,146,131,216,183,96,95,54,157,168,
223,200,124,104,29,184,204,235,5,51,
216,161,62,128,132,50,32,25,80,186,
16,250,113,255,215,55,7,21,207,142,
179,11,253,213,14,252,44,78,115,190,
106,187,70,153,61,66,181,138,252,96,
11,168,237,129,179,149,67,167,242,246,
4,105,142,85,146,41,1,82,233,144,
143,64,76,197,223,6,210,174,132,139,
255,137,29,2,183,199,167,109,98,60,
50,19,70,72,147,82,113,176,178,28,
195,185,70,189,30,229,227,248,247,88,
28,186,105,141,228,142,178,245,79,109,
172,71,65,253,221,16,183,244,210,125,
58,182,42,26,190,203,19,117,12,196,
102,5,216,58,29,64,202,171,82,72,
153,46,3,242,217,239,138,176,54,194,
241,188,177,195,54,142,106,144,229,1,
167,99,230,71,79,112,79,45,13,16,
250,173,54,29,72,23,210,253,250,220,
202,127,75,157,201,74,230,219,85,192,
206,236,22,58,186,74,199,131,190,157,
138,253,201,118,60,103,122,142,227,140,
232,4,241,32,241,255,8,49,70,42,
113,109,153,45,59,147,13,73,242,141,
20,0,55,13,63,3,222,30,226,79,
236,40,89,114,13,217,100,101,199,10,
207,201,70,6,202,23,13,229,153,9,
210,250,209,165,255,150,114,197,216,72,
150,16,31,203,193,97,236,199,199,219,
161,232,165,62,24,198,16,0,44,161,
149,184,175,51,255,139,27,68,236,90,
8,139,185,69,241,202,198,174,1,210,
113,113,240,236,216,55,112,27,129,63,
184,131,200,140,222,75,172,6,144,247,
197,37,14,200,167,36,129,59,15,226,
188,63,30,253,81,172,114,24,141,54,
179,112,80,3,55,96,188,97,153,134,
184,233,94,61,132,7,132,253,201,82,
231,182,95,23,134,245,153,179,41,109,
163,132,199,62,192,68,51,35,30,194,
163,12,188,95,39,13,231,73,254,194,
29,201,173,117,15,205,139,67,193,202,
45,82,141,110,16,101,227,175,132,179,
178,207,243,31,115,115,149,192,238,76,
207,204,60,200,173,47,19,181,224,27,
82,41,124,76,116,95,49,187,233,242,
193,60,117,245,125,69,10,68,200,122,
108,194,241,36,20,72,211,17,14,43,
239,78,8,29,95,21,50,236,191,115,
7,99,1,219,175,45,242,114,72,145,
86,46,160,25,179,165,136,244,26,255,
206,212,214,143,39,128,145,239,140,153,
133,40,125,11,224,111,9,178,237,58,
93,232,172,167,219,54,167,70,104,108,
119,177,134,188,64,140,210,122,198,123,
54,186,80,95,153,63,12,1,182,13,
69,235,27,210,221,24,208,104,179,162,
246,223,185,163,131,195,118,162,230,75,
171,12,47,251,66,233,34,77,210,254,
178,104,59,192,215,241,241,250,23,231,
4,208,177,161,111,191,235,41,103,82,
2,109,32,195,36,172,53,191,44,32,
148,69,131,120,252,40,63,170,58,19,
182,103,192,85,235,181,133,23,70,188,
52,158,153,234,192,32,9,232,224,22,
8,243,181,223,185,195,69,52,140,129,
6,33,150,179,113,63,16,108,228,152,
7,144,245,65,174,245,14,136,159,22,
89,118,180,238,115,58,109,82,30,170,
40,71,7,255,176,90,223,121,218,71,
113,132,43,119,48,17,41,78,122,251,
246,231,225,117,136,89,244,45,197,38,
149,167,143,232,192,34,162,89,16,9,
61,39,73,134,253,206,29,131,56,240,
183,232,24,123,187,153,109,136,27,76,
47,126,132,185,143,25,131,194,33,254,
143,199,251,255,46,227,66,239,174,224,
216,209,204,65,61,168,158,248,231,188,
177,89,153,203,12,124,122,4,244,240,
58,102,137,27,35,194,172,127,111,104,
185,50,88,106,129,248,199,188,73,124,
49,214,216,105,51,19,65,40,124,249,
167,118,16,102,49,197,3,19,165,214,
13,78,75,128,136,154,76,192,205,171,
26,218,46,159,235,211,235,63,210,114,
217,93,195,113,66,83,160,94,35,111,
22,242,254,46,108,128,37,4,122,2,
226,226,129,139,13,175,196,247,89,210,
227,126,105,136,228,148,131,80,174,0,
136,113,16,30,235,117,38,55,40,132,
5,28,249,85,59,66,2,161,146,108,
32,122,70,235,120,215,142,6,179,129,
162,139,77,155,247,203,242,11,44,124,
80,102,12,86,245,214,160,246,107,130,
145,39,155,78,186,244,98,204,148,47,
161,36,69,78,149,185,170,10,72,3,
65,215,105,222,251,81,11,61,130,117,
45,31,47,84,230,81,65,68,57,147,
163,168,210,103,213,236,87,237,240,224,
37,89,90,239,174,92,128,159,218,97,
212,165,164,227,53,144,79,173,106,114,
168,15,203,209,241,169,248,117,34,57,
227,214,66,216,122,112,131,204,172,214,
118,108,165,173,108,61,11,131,16,143,
30,21,201,184,89,236,232,199,121,159,
21,220,190,53,116,3,253,133,166,210,
17,11,215,109,69,131,129,122,158,43,
252,170,29,239,77,27,177,190,139,62,
168,76,191,107,199,61,139,114,114,12,
52,141,3,249,236,234,167,252,20,47,
103,253,15,154,69,192,114,18,254,192,
126,80,134,24,166,110,66,223,91,160,
174,92,103,91,21,123,161,171,135,146,
103,26,163,227,89,219,3,118,82,159,
87,39,27,134,135,10,123,70,101,176,
109,49,239,222,1,140,123,11,2,221,
119,190,7,3,76,255,213,59,144,29,
55,168,38,36,145,231,254,120,250,99,
218,248,195,208,48,159,11,129,142,158,
110,221,246,137,243,237,38,17,250,218,
117,197,64,53,115,67,232,20,67,213,
177,109,156,241,31,56,72,24,131,227,
101,102,241,239,185,198,116,12,146,206,
60,80,74,90,255,244,142,176,64,131,
143,239,144,249,200,220,255,232,29,161,
187,22,52,157,75,124,174,143,35,96,
14,23,125,23,97,159,107,17,82,78,
226,255,160,39,151,126,73,85,33,194,
107,242,87,1,128,129,76,140,155,90,
215,245,68,152,4,78,75,149,193,165,
5,247,204,161,85,227,6,12,163,156,
207,196,247,253,221,59,180,154,103,204,
18,239,76,126,97,40,93,229,175,222,
33,66,106,118,232,40,209,102,242,199,
245,31,163,191,185,244,92,183,243,66,
229,5,125,146,65,117,72,247,82,161,
164,160,17,6,206,2,0,213,103,235,
247,152,238,26,77,31,238,11,168,60,
55,135,12,79,139,183,58,200,237,202,
91,247,109,54,117,237,118,246,142,221,
199,59,51,142,230,181,61,200,252,238,
119,29,233,167,119,140,110,30,232,251,
175,255,248,250,143,151,4,164,164,51,
112,75,254,206,77,162,164,182,165,131,
168,171,123,243,46,0,116,11,174,34,
161,3,243,110,116,154,26,63,19,224,
235,141,100,105,241,176,98,204,67,54,
179,243,61,176,202,69,9,179,25,160,
30,173,30,213,14,133,44,128,165,27,
209,174,79,200,10,178,156,245,48,185,
104,254,118,135,203,71,23,143,146,59,
30,61,186,239,245,77,86,37,165,19,
246,247,155,202,170,136,114,252,167,0,
192,228,194,52,157,72,24,13,29,56,
114,228,217,212,6,75,236,141,128,201,
120,186,237,65,28,244,58,202,50,13,
218,17,101,192,46,169,172,1,215,221,
159,48,78,60,103,157,235,228,131,248,
153,39,136,166,202,238,205,54,163,233,
135,37,193,195,71,204,49,214,214,183,
109,125,238,161,94,106,174,110,237,210,
189,211,83,253,48,12,67,122,1,139,
199,237,76,88,134,51,253,156,200,85,
131,246,132,77,59,94,5,226,254,94,
21,126,88,99,176,189,142,128,1,97,
1,26,232,118,3,71,72,5,117,34,
225,231,13,49,138,243,107,78,215,75,
253,84,130,63,44,136,217,231,114,131,
61,238,220,142,134,88,125,54,67,66,
16,87,54,219,187,0,144,70,223,23,
168,92,238,51,150,109,123,52,33,93,
57,255,225,187,173,215,220,74,52,110,
233,20,216,19,53,74,211,115,132,119,
130,220,94,12,170,68,159,247,104,168,
15,130,141,244,140,122,246,130,187,182,
163,223,253,56,255,149,224,28,80,235,
148,93,151,122,157,23,240,243,186,49,
182,27,120,165,226,126,23,0,252,181,
74,56,35,99,190,37,129,207,190,19,
174,183,99,70,123,100,243,151,27,221,
223,3,29,186,189,111,29,247,136,64,
119,197,48,137,81,115,80,175,227,185,
18,154,95,21,204,129,206,32,63,8,
51,121,66,50,196,144,123,124,190,255,
5,53,179,167,184,135,125,203,62,120,
123,113,40,97,191,178,219,209,130,97,
161,63,5,128,142,208,254,81,147,37,
242,167,204,108,193,172,246,52,244,130,
164,207,130,120,109,87,73,215,134,128,
71,237,175,166,67,232,26,210,244,236,
49,18,234,18,146,8,219,18,107,215,
81,214,253,140,51,105,74,104,27,220,
44,199,255,128,250,227,250,137,26,75,
186,154,82,136,247,197,196,240,162,21,
196,194,200,246,200,79,1,96,250,200,
231,133,202,178,187,134,143,60,33,243,
141,91,16,158,184,78,119,217,244,182,
97,196,220,248,182,162,90,128,142,192,
120,137,92,82,116,118,154,1,210,94,
90,74,237,221,97,92,40,1,202,30,
200,90,153,80,69,150,143,235,255,238,
32,49,138,154,222,163,5,161,104,142,
224,247,157,236,121,6,48,247,83,0,
144,76,33,200,121,14,205,81,3,80,
15,204,158,16,237,35,82,64,211,177,
38,52,175,97,159,57,16,2,39,50,
201,1,158,196,139,224,182,73,21,172,
69,199,56,88,201,248,73,114,213,196,
10,52,168,19,150,42,121,158,253,98,
31,207,127,139,203,188,211,26,47,35,
137,13,120,176,221,209,220,59,198,50,
82,126,23,0,170,139,1,245,226,25,
214,225,79,55,207,237,162,104,239,147,
213,152,85,142,243,94,8,167,107,4,
244,13,187,154,165,227,167,40,228,190,
160,44,165,136,159,50,24,135,252,215,
41,207,67,7,247,58,40,217,144,59,
151,28,81,51,62,189,254,52,225,41,
250,37,136,249,212,98,54,238,23,66,
56,1,253,92,160,20,31,179,0,112,
181,245,154,201,236,171,101,60,234,186,
237,83,233,185,16,144,130,216,236,218,
43,211,106,115,240,196,112,140,132,184,
8,223,37,60,38,25,116,123,51,63,
140,163,8,172,124,78,6,41,112,55,
17,98,153,212,2,127,238,227,233,63,
212,97,164,105,228,68,19,181,87,108,
8,127,146,22,1,161,189,240,136,88,
151,159,2,192,90,218,62,59,117,248,
157,41,164,107,111,3,41,35,87,225,
200,205,83,154,110,174,99,82,189,120,
244,148,123,91,192,115,88,118,49,164,
172,57,53,137,17,95,172,26,172,48,
75,233,24,245,193,24,138,17,182,213,
153,55,218,62,158,0,84,112,161,53,
135,139,184,217,180,164,108,26,51,165,
83,252,34,216,157,234,76,238,189,136,
88,144,234,133,231,157,171,91,225,53,
109,246,161,248,14,12,186,191,81,0,
61,34,117,125,246,145,198,112,207,152,
42,120,141,98,246,213,137,186,238,227,
151,227,35,105,77,43,179,249,64,187,
90,33,144,9,254,183,207,174,126,106,
224,210,89,148,221,172,21,24,145,161,
180,210,36,30,63,53,138,149,160,109,
6,116,234,117,136,93,32,135,37,142,
64,142,247,221,133,58,14,52,104,56,
219,131,184,152,161,187,116,117,236,23,
51,192,59,250,10,206,145,79,164,49,
65,47,114,139,191,4,190,153,5,10,
27,198,17,207,82,42,53,192,199,251,
255,203,236,105,220,38,106,35,4,89,
30,50,58,186,36,90,8,40,97,173,
100,230,64,223,62,39,122,10,158,20,
6,132,215,76,16,172,175,179,172,219,
2,23,235,135,182,169,189,54,90,144,
209,192,56,124,96,27,198,54,221,34,
2,229,140,88,1,49,223,95,128,15,
122,5,39,16,13,238,70,45,169,247,
187,209,143,251,63,176,250,88,94,2,
242,11,65,58,63,49,8,162,7,59,
216,204,104,47,75,24,158,86,66,39,
245,7,12,252,118,79,110,18,31,25,
207,4,70,83,242,130,188,201,12,245,
6,198,164,234,176,239,204,222,81,123,
61,107,104,55,153,192,23,77,229,175,
192,119,88,81,249,112,252,92,118,239,
205,147,206,79,47,255,182,46,197,246,
218,241,185,10,244,141,78,51,183,205,
72,75,82,240,201,108,138,75,150,34,
155,113,29,15,242,148,30,137,94,87,
220,4,179,104,129,188,49,119,116,249,
30,227,160,11,104,64,7,2,167,172,
209,51,240,101,18,31,54,254,78,124,
150,146,23,182,193,169,139,73,59,121,
238,143,243,63,31,3,56,116,91,6,
131,91,233,33,145,11,250,165,181,36,
44,31,206,174,76,173,183,101,150,34,
143,5,122,166,229,37,73,222,134,65,
234,107,220,204,23,17,82,228,108,33,
51,117,250,56,224,218,129,121,19,223,
235,63,19,95,158,87,197,233,189,41,
131,65,98,67,210,245,233,245,79,249,
33,114,122,191,132,97,162,164,53,83,
177,205,110,214,151,163,179,136,17,35,
194,20,60,253,52,51,121,143,220,54,
34,170,21,160,210,82,253,234,209,244,
223,131,67,129,130,81,4,229,191,38,
62,184,91,143,188,35,10,66,0,72,
205,199,189,223,123,118,161,101,224,5,
215,107,79,195,215,84,201,108,113,40,
143,85,72,3,240,205,181,104,143,15,
12,187,221,148,56,16,186,44,64,116,
176,181,246,200,195,213,130,76,219,123,
112,8,180,25,149,252,31,137,47,216,
42,203,76,34,141,20,100,95,121,12,
31,239,127,159,107,44,52,238,11,71,
204,150,253,209,98,68,62,44,193,207,
46,111,107,18,34,253,68,59,134,124,
55,150,91,46,21,28,181,68,214,67,
237,23,65,156,159,17,228,35,137,105,
199,230,233,108,255,252,175,137,207,159,
161,73,214,172,208,22,242,8,226,243,
222,31,68,191,113,189,93,43,222,24,
101,69,9,149,242,150,95,171,45,45,
160,153,131,166,11,218,176,99,169,28,
155,179,232,231,128,94,248,191,165,76,
244,18,152,113,177,49,126,17,235,16,
67,144,223,67,147,255,148,248,158,67,
147,57,161,142,8,103,78,141,17,228,
243,253,255,251,26,147,245,72,200,4,
56,66,22,107,104,234,231,171,74,193,
142,35,90,164,45,96,250,86,129,111,
167,153,77,203,97,32,57,114,24,17,
23,36,0,19,238,213,186,20,3,90,
45,188,104,243,107,104,242,31,10,31,
63,67,147,36,183,9,251,94,150,241,
116,196,143,247,191,57,100,40,145,56,
22,80,221,133,93,218,182,154,163,215,
119,91,18,162,1,119,108,24,233,207,
59,181,140,100,149,212,110,151,215,134,
244,111,206,75,171,232,141,100,249,12,
72,26,166,222,132,40,68,250,175,133,
175,159,161,73,110,252,73,204,32,77,
239,227,252,95,40,0,249,129,188,14,
25,240,26,156,146,24,238,240,53,41,
54,18,72,47,246,245,204,89,205,49,
135,184,32,177,81,82,230,140,107,31,
44,110,203,214,251,88,72,189,173,6,
202,137,240,14,145,131,202,203,63,20,
62,255,24,154,100,102,147,4,1,231,
38,54,179,127,252,252,189,94,69,127,
21,74,150,109,139,18,20,170,233,116,
222,200,123,165,67,151,181,155,189,204,
67,172,2,99,96,189,238,217,48,202,
133,118,30,53,29,195,194,120,60,228,
131,243,92,57,89,2,183,221,255,99,
225,251,215,208,228,125,49,218,48,54,
34,215,180,33,214,143,243,159,235,57,
234,100,108,58,39,150,12,251,49,72,
34,193,60,72,78,182,2,38,93,11,
196,53,207,246,143,54,182,57,199,33,
22,73,237,49,59,34,144,201,30,248,
238,89,120,65,207,215,75,45,151,121,
245,127,109,124,104,127,31,154,12,100,
28,13,162,34,93,240,207,215,255,219,
235,185,8,85,185,46,97,107,171,103,
98,98,119,50,52,172,141,166,253,152,
131,192,106,45,185,32,81,14,170,204,
194,0,79,100,150,45,214,4,214,193,
58,78,138,20,9,100,71,167,151,203,
165,77,217,254,165,241,229,248,247,161,
73,9,86,248,71,61,179,87,248,127,
33,1,114,54,233,155,119,209,72,51,
243,177,24,187,22,251,210,112,34,241,
29,215,219,139,23,12,1,185,161,130,
163,35,103,54,42,120,165,57,31,240,
174,132,239,107,123,72,144,174,60,87,
144,168,246,8,237,220,66,22,81,223,
141,79,231,191,15,77,86,4,17,249,
133,123,75,104,245,159,94,60,204,70,
127,21,137,87,13,29,60,228,181,76,
192,134,199,253,58,119,36,124,176,111,
89,128,156,45,81,93,60,19,202,171,
205,218,33,225,33,229,158,185,251,240,
70,207,30,113,64,16,125,51,102,161,
82,248,37,29,187,152,141,111,21,196,
191,15,77,142,163,208,6,114,175,68,
245,242,241,254,15,43,203,78,124,236,
89,205,89,252,153,142,54,253,106,27,
151,114,3,49,209,49,21,107,52,248,
250,105,39,88,201,25,252,102,131,92,
58,220,101,174,222,188,247,32,220,126,
185,80,57,154,229,210,49,237,223,141,
143,179,10,246,31,134,38,55,142,56,
81,161,97,112,101,245,199,241,239,134,
232,246,136,53,32,57,111,115,166,77,
218,121,151,9,245,75,4,45,209,219,
117,138,164,117,22,57,230,220,7,66,
100,120,55,72,135,86,153,190,214,216,
38,166,95,15,168,175,157,33,67,242,
163,108,1,24,103,76,14,32,255,48,
52,137,177,127,183,121,83,247,2,165,
125,124,254,113,217,179,222,107,208,240,
236,1,217,250,204,98,174,115,58,1,
102,186,39,47,208,252,130,192,14,29,
227,188,179,64,33,254,93,37,185,131,
220,122,35,215,61,196,74,164,115,199,
96,51,151,127,87,32,101,122,60,141,
80,73,71,242,15,67,147,130,174,251,
48,168,64,232,52,237,199,251,191,11,
3,213,222,30,251,53,184,2,53,103,
181,149,120,255,99,142,237,84,191,71,
244,220,251,85,25,244,35,175,82,212,
27,67,67,198,63,116,100,120,199,28,
244,134,248,76,96,140,198,129,56,167,
245,235,233,100,103,115,84,226,63,15,
77,54,125,44,12,2,95,157,154,147,
32,31,150,92,130,107,217,172,4,222,
248,158,108,116,206,132,108,175,115,160,
139,58,109,34,50,215,227,53,183,98,
1,101,92,93,8,92,242,12,203,155,
220,228,123,120,97,223,76,111,185,139,
81,211,127,108,80,119,75,55,141,236,
233,63,15,77,238,165,137,0,94,97,
44,213,31,95,254,108,98,40,212,192,
49,135,63,241,191,235,131,6,237,243,
14,207,51,147,29,132,221,140,94,55,
162,219,246,58,240,16,133,203,222,131,
195,195,94,186,117,115,172,207,154,113,
66,185,56,42,193,141,232,104,128,71,
120,140,31,176,89,254,15,67,147,109,
53,2,131,77,126,237,123,83,31,103,
192,57,110,232,145,82,88,150,29,67,
125,91,249,171,139,23,159,104,7,79,
206,116,67,155,151,49,35,87,51,232,
7,42,154,251,58,59,189,38,95,24,
135,71,20,219,219,130,180,38,156,72,
124,137,221,208,224,193,232,53,130,76,
145,137,255,60,52,201,131,239,242,92,
98,5,166,251,199,251,191,134,17,151,
68,63,93,102,77,123,86,54,42,130,
83,228,60,135,155,217,219,101,153,141,
48,44,160,33,171,216,13,65,180,203,
216,190,188,231,246,133,228,161,246,140,
75,184,8,159,109,164,156,109,157,193,
198,223,141,195,114,139,157,189,79,247,
111,67,147,173,164,154,252,188,50,137,
10,8,31,247,127,214,225,35,131,195,
112,39,36,180,70,144,203,191,64,33,
210,123,48,158,23,86,132,17,166,89,
87,169,216,194,111,101,173,44,169,138,
39,170,139,72,39,186,191,247,96,231,
114,253,49,206,226,218,232,21,131,35,
154,205,191,15,77,82,83,150,26,221,
16,19,89,186,143,223,127,146,90,66,
29,208,104,196,124,150,120,178,183,72,
243,64,13,54,219,89,122,105,87,31,
108,132,119,81,19,193,12,17,28,225,
125,130,121,113,15,23,115,224,173,236,
179,33,96,171,179,31,126,121,35,162,
45,79,24,221,11,213,145,170,246,183,
161,73,162,88,149,247,144,109,214,203,
17,20,127,188,254,7,241,168,204,121,
207,241,129,209,245,159,124,239,252,42,
48,111,64,162,129,27,93,219,147,137,
94,40,96,80,15,17,202,113,237,171,
194,131,118,182,173,101,102,183,1,233,
207,118,238,39,154,79,65,61,66,128,
251,30,140,131,221,130,112,228,239,67,
147,74,35,10,188,168,16,12,214,158,
158,143,167,255,113,149,230,53,177,13,
82,209,195,238,23,186,128,235,129,119,
86,38,237,133,41,12,212,169,131,217,
110,64,112,111,239,141,231,178,93,221,
204,123,51,172,118,182,58,11,250,14,
24,199,250,181,134,222,195,89,145,232,
205,102,42,97,87,239,210,95,135,38,
39,10,74,107,48,110,165,137,162,175,
68,184,120,232,143,251,127,11,148,92,
47,72,147,220,204,201,68,12,225,117,
3,206,113,15,90,150,92,218,140,71,
43,229,149,181,88,11,127,236,90,165,
84,62,122,39,17,55,249,81,135,129,
113,17,155,132,185,142,190,185,201,140,
237,2,35,75,226,82,46,242,47,67,
147,187,7,86,214,220,103,199,81,215,
200,172,168,229,233,227,243,31,92,11,
226,16,236,96,184,183,63,100,220,219,
23,49,121,179,148,229,117,77,219,54,
198,181,56,90,88,93,56,195,248,94,
112,133,170,119,81,235,22,69,190,231,
13,38,8,239,140,135,173,49,22,102,
114,19,82,154,3,193,75,105,251,241,
231,208,36,16,71,164,22,206,19,211,
240,212,221,156,157,143,219,199,1,208,
149,24,30,140,175,240,104,51,39,129,
192,174,194,248,148,183,147,6,199,123,
188,28,20,1,177,154,30,30,59,59,
214,126,70,160,246,75,238,51,55,208,
107,154,20,150,204,117,60,8,112,246,
181,100,202,142,229,232,136,43,67,168,
127,25,154,164,8,153,12,141,82,225,
15,145,247,77,122,185,198,143,231,191,
55,27,41,110,0,210,128,8,169,230,
4,246,212,32,108,69,3,14,71,29,
27,121,205,108,189,135,58,18,204,145,
255,73,141,222,237,146,111,31,177,66,
236,60,65,92,142,140,154,92,54,143,
100,240,232,253,70,166,224,113,31,224,
207,161,201,133,81,137,91,226,181,49,
60,107,168,238,221,78,195,62,222,255,
151,83,37,124,235,130,206,208,149,239,
115,1,84,117,198,108,101,193,245,146,
98,154,65,125,65,184,235,230,237,22,
158,205,180,254,49,227,253,27,48,192,
65,123,31,201,75,249,147,202,152,27,
20,211,186,188,116,106,209,7,242,199,
208,100,22,76,73,61,114,158,9,17,
15,162,80,82,103,243,251,199,243,95,
76,98,184,82,179,163,233,13,197,158,
235,16,108,63,171,226,144,148,158,41,
33,176,214,91,171,137,70,194,230,8,
111,214,231,11,119,105,38,2,107,94,
148,67,86,40,116,64,112,252,87,50,
211,247,178,14,243,123,104,210,120,129,
72,151,71,82,110,178,4,205,137,140,
101,17,4,67,98,250,120,5,212,137,
176,129,170,233,54,71,193,179,169,247,
29,145,172,141,81,133,214,100,50,55,
92,204,216,171,100,156,83,145,27,201,
61,92,187,70,2,167,102,42,188,48,
233,145,29,3,219,163,0,220,14,79,
80,3,144,250,199,53,40,114,132,90,
223,153,19,120,81,145,16,90,22,62,
8,165,126,71,160,65,101,30,78,45,
245,227,249,255,106,89,244,220,55,151,
210,190,110,59,250,110,63,211,185,34,
80,183,175,120,210,125,22,135,183,149,
26,22,16,29,47,224,78,228,246,24,
0,222,87,58,221,138,38,180,151,215,
190,134,217,58,120,34,12,234,173,165,
209,131,16,59,134,196,82,231,20,237,
142,148,185,23,12,129,174,99,228,155,
133,209,153,245,177,241,220,21,253,252,
253,23,69,108,109,71,194,167,97,61,
143,11,23,104,8,242,22,194,168,66,
71,95,230,117,133,179,215,89,110,90,
236,171,173,70,89,115,32,244,85,233,
181,34,21,122,77,27,38,203,58,203,
221,71,110,184,1,207,117,237,46,245,
68,88,137,26,131,201,53,88,110,20,
28,154,193,161,246,2,155,59,222,125,
182,212,171,37,88,79,63,189,126,50,
38,249,221,216,28,238,184,7,70,114,
106,106,162,17,24,162,29,133,56,136,
155,11,121,65,202,198,228,23,42,177,
87,16,9,17,161,179,19,137,128,169,
210,16,73,144,210,17,152,247,4,147,
57,47,185,167,117,130,98,41,245,129,
90,179,108,24,58,235,12,115,225,188,
14,185,32,56,178,8,53,192,192,74,
245,154,62,126,255,105,180,129,156,129,
144,208,243,152,73,60,144,107,157,237,
14,194,182,13,136,217,164,227,94,162,
83,215,120,154,91,139,232,7,178,214,
115,14,128,173,71,68,23,184,225,22,
192,227,40,134,0,43,137,151,34,69,
163,185,179,72,110,214,134,65,95,155,
225,92,70,176,11,90,249,189,217,25,
37,210,204,27,139,146,196,210,63,222,
255,52,96,181,4,172,172,119,157,215,
30,95,123,217,55,161,28,28,18,185,
16,34,244,221,48,171,89,237,6,241,
174,64,147,102,125,152,165,182,201,255,
231,197,80,69,106,175,109,200,218,118,
58,239,81,200,30,29,136,191,4,239,
210,222,114,78,190,175,91,119,204,244,
157,122,224,42,246,177,138,53,28,8,
139,99,63,162,106,31,159,255,229,24,
148,172,148,102,157,55,181,181,151,63,
75,95,209,26,80,157,209,39,44,32,
115,90,40,111,84,13,124,145,234,195,
147,92,45,37,234,232,148,146,251,104,
132,146,236,121,131,193,248,197,243,202,
92,9,99,75,47,23,9,203,167,89,
71,212,187,218,144,254,134,141,18,209,
122,38,99,34,12,42,199,40,44,223,
209,127,220,255,183,121,237,69,159,113,
40,154,121,7,152,91,245,188,178,28,
113,96,229,97,160,55,88,196,188,221,
224,126,16,255,193,254,164,190,82,174,
165,208,47,230,201,123,104,146,104,133,
241,204,34,166,103,248,195,26,17,61,
119,8,152,142,247,221,160,251,213,151,
136,138,132,63,250,211,233,255,204,182,
145,117,18,78,29,104,123,220,103,23,
15,243,250,63,116,113,170,158,136,109,
237,44,229,162,117,162,91,247,89,194,
243,218,111,116,255,6,161,43,244,128,
20,33,171,104,102,218,231,46,50,93,
236,221,185,63,135,38,149,156,119,65,
225,82,136,180,190,70,195,196,190,235,
182,190,17,85,101,173,130,171,7,37,
253,157,100,207,203,108,2,27,179,105,
248,129,139,218,254,113,254,151,77,115,
38,231,54,153,88,155,119,22,45,38,
206,30,22,89,237,190,133,51,40,165,
173,153,71,57,145,172,123,99,215,129,
204,214,172,199,191,15,77,230,221,59,
163,162,173,233,28,118,222,240,250,128,
110,129,34,151,206,8,1,237,98,181,
29,185,41,4,189,60,131,215,190,205,
220,241,135,101,95,240,49,182,21,29,
252,156,112,232,232,247,231,125,247,171,
49,49,244,221,70,35,145,223,89,88,
131,129,112,21,164,113,20,26,93,151,
220,115,142,127,31,154,44,91,194,37,
42,38,28,161,6,177,64,131,29,68,
188,102,243,195,210,185,65,135,217,153,
102,115,148,12,189,203,44,168,131,222,
62,191,254,51,89,207,28,212,149,23,
8,59,231,58,35,104,69,76,172,215,
157,91,1,82,79,100,139,202,17,94,
71,233,154,65,141,203,169,102,223,126,
89,33,253,203,208,228,69,229,234,24,
241,8,110,23,183,14,244,252,48,175,
126,197,224,47,171,65,14,221,242,129,
10,150,75,229,109,247,130,1,177,16,
62,94,255,221,87,89,162,113,134,34,
181,1,18,19,165,226,60,24,8,209,
134,70,138,178,206,235,42,99,7,185,
189,58,26,120,219,119,132,124,164,205,
158,119,173,151,37,253,101,104,82,103,
176,229,216,250,1,230,220,230,100,191,
57,231,180,252,204,149,170,203,195,118,
158,51,192,118,13,68,103,153,141,104,
231,62,62,63,255,242,51,233,137,104,
159,89,68,107,144,103,67,227,40,3,
202,185,16,194,131,170,212,149,141,244,
215,83,201,1,183,134,172,212,156,124,
232,13,17,50,81,193,252,57,52,169,
40,241,189,63,79,71,20,149,81,51,
52,133,13,102,235,99,99,179,182,80,
111,112,3,84,128,89,97,131,150,87,
40,163,62,31,199,255,64,173,116,227,
88,52,136,96,240,76,71,166,217,158,
112,149,8,139,201,132,227,97,239,227,
154,197,176,108,30,92,164,91,57,130,
99,251,50,54,243,226,85,14,127,12,
77,54,102,44,186,138,242,188,203,0,
39,155,23,164,17,133,6,158,67,208,
214,241,52,248,105,60,68,247,110,4,
178,239,161,35,248,120,252,151,208,179,
13,72,122,53,231,190,15,91,170,10,
178,95,169,207,193,183,232,27,180,81,
116,156,193,109,137,118,78,203,67,95,
204,241,96,160,135,120,232,209,252,226,
126,13,77,98,8,13,115,0,22,215,
20,80,69,120,187,134,199,216,135,59,
226,192,247,99,87,193,23,140,42,110,
92,2,152,214,63,153,255,143,215,191,
118,131,58,79,8,245,177,51,64,102,
190,31,131,194,210,82,207,38,198,101,
219,242,245,243,29,21,239,199,109,5,
150,91,109,217,156,67,7,132,135,234,
53,102,23,40,252,12,77,214,228,214,
217,78,105,3,191,142,89,88,208,120,
208,168,19,165,230,213,61,167,52,10,
121,196,72,24,79,145,60,228,158,48,
124,154,143,231,127,28,19,51,244,165,
204,16,8,204,91,255,246,66,9,58,
127,100,49,145,34,90,217,79,36,43,
75,120,247,105,204,146,61,239,115,152,
229,74,184,254,128,212,103,166,136,200,
12,5,126,223,105,91,82,122,39,134,
24,188,154,7,198,71,21,158,35,175,
118,145,151,125,218,62,165,63,87,126,
112,31,175,115,207,160,63,158,255,107,
179,222,65,247,215,75,195,114,197,181,
196,197,206,107,64,150,73,240,124,62,
94,120,240,115,184,63,253,92,213,240,
96,44,68,27,232,228,245,204,146,1,
169,140,176,142,251,53,175,7,233,157,
87,3,23,143,219,252,201,94,163,19,
232,248,231,119,11,128,68,211,25,181,
77,7,136,225,22,248,88,102,95,56,
60,37,124,30,0,19,56,95,236,153,
137,112,18,80,243,49,134,133,227,238,
132,87,254,192,108,109,223,131,152,147,
138,102,63,52,158,253,188,187,58,189,
242,204,129,15,147,95,163,212,148,118,
32,251,143,29,251,77,224,59,107,158,
58,112,205,214,127,178,31,14,226,28,
141,95,214,249,225,115,106,216,142,113,
119,93,36,70,135,163,125,28,255,162,
21,187,121,171,13,215,215,251,44,98,
24,39,213,232,176,78,135,206,254,61,
212,111,185,246,214,244,212,48,44,10,
245,168,199,255,186,187,226,126,150,198,
77,139,30,131,196,251,10,89,149,82,
180,137,165,52,226,54,43,33,143,148,
125,64,126,117,135,106,176,99,116,157,
67,212,250,224,245,80,46,197,89,40,
253,120,255,215,142,143,160,189,215,122,
181,63,55,18,48,198,87,88,70,220,
163,190,111,27,3,140,27,189,183,175,
139,51,122,14,139,129,138,128,48,8,
127,176,22,174,16,193,99,56,168,82,
163,234,71,177,162,103,31,155,48,224,
246,19,12,2,166,84,151,85,235,26,
248,242,132,189,187,4,139,157,119,173,
34,47,52,179,222,214,143,143,247,191,
190,238,67,190,81,96,91,5,123,79,
179,147,4,186,99,200,110,175,93,149,
3,182,43,149,123,219,123,173,231,188,
222,213,206,11,78,17,33,129,51,149,
129,60,174,222,199,86,237,130,236,121,
120,233,44,33,67,10,230,153,98,178,
46,160,234,8,108,102,214,215,229,193,
248,39,14,132,210,193,92,32,215,159,
206,207,237,227,235,103,117,44,16,206,
188,183,184,154,119,45,47,22,244,223,
51,219,165,249,186,241,237,78,176,237,
226,88,40,155,99,13,131,142,211,226,
111,245,77,17,68,240,145,115,202,25,
162,97,183,35,252,35,48,123,99,13,
193,200,192,240,37,181,117,68,87,67,
66,1,19,165,90,128,65,233,205,90,
54,187,44,216,143,231,251,120,253,11,
40,90,37,135,177,181,216,231,119,128,
209,192,225,138,72,98,6,104,84,98,
50,249,254,60,36,247,198,42,99,192,
188,230,8,110,107,247,179,148,95,247,
215,144,149,240,171,208,247,191,35,123,
68,43,66,16,60,153,33,226,199,252,
83,47,188,103,255,3,195,143,96,248,
57,148,173,46,94,7,93,159,143,195,
159,153,198,67,237,204,43,62,153,236,
51,239,131,43,149,5,253,53,198,235,
93,164,6,113,157,135,132,196,112,166,
106,39,10,114,175,57,181,188,70,68,
200,172,41,126,58,12,227,232,19,186,
159,151,57,71,109,220,236,147,120,50,
146,165,249,45,63,115,6,150,114,97,
71,34,121,118,85,179,129,112,97,59,
82,15,15,2,171,231,227,248,247,196,
131,156,23,32,204,65,159,92,38,23,
250,185,147,10,255,63,141,35,196,7,
236,110,9,219,237,48,218,101,101,141,
189,180,147,100,126,111,146,113,229,182,
173,175,33,0,33,199,178,80,94,72,
41,62,190,111,181,235,200,145,46,174,
196,188,8,145,212,182,61,72,121,187,
25,55,180,83,180,45,77,2,189,10,
225,63,222,255,244,56,121,163,99,182,
206,17,153,223,167,113,19,132,124,220,
35,8,222,53,34,249,50,208,145,11,
135,108,181,109,35,151,253,85,137,209,
202,14,187,236,253,101,252,206,164,206,
86,134,206,200,98,23,77,144,20,131,
164,205,152,5,247,106,65,204,99,55,
6,190,90,31,10,228,93,62,11,52,
189,103,98,246,10,196,21,253,241,245,
115,9,50,87,82,115,21,75,103,3,
237,54,222,8,230,231,13,39,115,56,
113,31,27,122,241,84,84,91,148,82,
155,91,119,196,0,205,41,73,139,151,
57,248,53,120,165,142,220,87,106,253,
218,13,35,148,33,110,78,43,122,80,
146,196,218,148,19,226,9,193,75,16,
103,226,178,193,222,84,69,140,44,7,
194,1,193,249,199,235,63,179,165,123,
233,94,82,127,168,68,221,165,61,180,
4,82,165,117,94,122,195,174,99,175,
146,167,179,204,7,165,38,68,14,188,
4,137,39,105,55,52,248,83,21,203,
74,189,28,223,148,143,237,38,72,165,
230,85,169,27,71,224,187,28,91,17,
251,130,225,99,114,8,195,205,166,129,
138,60,250,146,139,161,30,215,191,126,
30,254,137,52,125,218,133,24,158,237,
104,162,176,206,59,175,252,242,108,112,
65,90,240,180,37,146,88,212,90,22,
59,116,174,81,63,132,19,177,247,247,
29,14,158,243,121,153,239,107,49,43,
198,179,117,54,194,29,91,171,169,204,
214,232,134,12,225,68,245,153,99,52,
191,198,156,218,243,208,221,42,100,132,
149,66,35,33,125,222,255,101,62,199,
115,97,109,104,161,185,255,234,71,51,
99,94,231,30,230,151,56,117,57,243,
188,181,149,27,226,184,136,223,130,207,
85,233,121,135,135,66,59,102,11,34,
89,144,105,61,214,68,167,11,61,202,
226,28,130,193,52,145,237,138,38,161,
142,146,222,215,124,190,67,253,147,210,
51,187,196,247,154,103,93,216,126,252,
254,155,87,103,106,6,104,83,73,88,
85,14,147,145,34,49,65,53,70,30,
127,114,52,6,215,18,123,252,225,220,
235,65,228,151,233,108,106,159,119,184,
84,240,206,225,150,221,116,54,60,29,
239,47,78,193,160,32,141,92,251,164,
245,243,171,82,165,116,199,251,14,152,
97,124,12,198,105,168,204,205,62,137,
84,46,154,87,111,62,62,255,120,140,
149,207,175,188,89,188,230,200,123,231,
183,183,0,109,44,7,74,178,123,103,
103,125,201,118,126,41,234,93,15,23,
209,230,115,33,63,119,248,232,247,88,
155,137,129,230,232,152,30,71,151,70,
176,165,108,33,55,142,134,85,156,214,
124,67,110,225,22,102,239,179,133,58,
46,64,109,113,37,174,193,232,135,148,
177,127,220,255,211,82,6,23,117,63,
7,46,150,143,58,175,232,97,66,235,
188,214,186,204,204,15,69,35,71,28,
131,103,39,121,88,171,68,229,255,117,
135,83,87,186,228,153,199,138,68,41,
140,152,50,49,215,209,181,25,137,86,
181,136,97,103,87,172,224,80,142,179,
178,113,141,189,231,171,207,200,146,207,
11,3,205,22,115,148,31,63,127,194,
182,149,64,229,103,34,41,170,237,170,
231,169,115,92,214,84,242,226,244,123,
222,1,234,171,102,51,103,247,137,111,
2,209,254,207,29,94,16,119,58,94,
235,188,34,0,149,221,123,185,24,170,
100,35,179,21,24,33,207,134,116,224,
125,169,44,110,198,121,87,70,75,118,
8,143,194,132,88,148,18,52,150,131,
124,60,251,141,66,43,4,160,232,174,
194,56,136,105,61,143,45,59,180,8,
179,88,9,53,28,108,61,47,120,108,
234,243,142,119,149,150,229,247,29,110,
179,93,236,32,10,25,224,43,83,219,
211,188,44,123,213,158,0,175,47,208,
148,226,86,0,161,251,187,43,60,60,
13,216,204,8,164,174,192,111,32,30,
159,226,222,231,232,212,135,101,78,112,
249,94,79,255,254,22,188,217,249,142,
79,118,11,113,82,182,32,163,19,119,
72,1,70,51,251,221,129,223,61,111,
253,143,59,252,96,126,107,146,82,207,
3,119,67,223,207,237,178,148,117,194,
166,227,25,107,161,106,69,152,19,124,
251,137,113,207,169,142,212,20,4,130,
75,86,44,207,11,224,207,42,63,222,
255,254,120,107,225,220,125,81,144,120,
193,85,185,233,19,6,156,47,77,219,
252,222,3,196,194,225,129,61,157,11,
164,213,176,112,253,190,202,230,61,231,
138,144,8,30,206,94,120,250,66,22,
203,143,247,23,222,218,75,120,171,167,
211,64,240,91,144,242,206,73,153,190,
212,89,66,93,22,84,170,166,226,158,
144,7,153,143,231,255,250,209,75,113,
5,201,46,2,225,189,128,80,214,219,
119,27,255,188,195,211,65,71,92,244,
154,87,194,207,139,129,216,226,57,249,
227,14,207,50,83,30,179,151,229,65,
92,232,147,89,92,156,223,121,61,199,
168,240,71,106,247,190,204,233,199,245,
213,162,194,77,238,64,26,226,140,116,
212,130,182,132,118,3,68,127,190,252,
131,14,122,206,43,178,217,204,66,14,
196,186,92,183,159,172,252,188,195,213,
172,133,247,217,235,54,203,219,107,153,
54,76,254,184,202,166,218,82,223,95,
114,253,110,157,108,124,85,65,207,175,
16,60,17,10,162,185,203,124,166,178,
33,130,184,59,186,18,193,56,153,95,
49,220,103,233,115,222,141,249,198,67,
159,135,255,191,228,32,11,62,234,86,
66,137,126,230,44,182,185,174,25,160,
203,152,95,255,38,102,153,228,213,106,
112,241,47,87,217,212,141,202,119,97,
0,249,79,32,188,154,176,72,12,18,
51,201,219,251,254,190,1,73,96,152,
200,242,117,216,249,21,187,245,184,49,
234,205,164,201,251,183,8,200,207,247,
255,127,229,43,95,249,202,87,190,242,
149,175,124,229,43,95,249,202,87,190,
242,149,175,124,229,43,95,249,202,87,
190,242,149,175,124,229,43,95,249,202,
87,190,242,149,175,124,229,43,95,249,
202,87,190,242,149,175,124,229,43,95,
249,202,87,190,242,149,175,124,229,43,
95,249,202,87,190,242,149,175,124,229,
43,95,249,202,87,190,242,149,175,124,
229,43,95,249,202,87,190,242,149,175,
124,229,43,95,249,202,87,190,242,149,
175,124,229,43,95,249,202,87,190,242,
149,175,124,229,43,95,249,202,87,190,
242,149,175,124,229,43,95,249,202,87,
190,242,149,175,124,229,43,95,249,202,
87,190,242,149,175,124,229,43,95,249,
202,87,190,242,149,175,124,229,43,95,
249,202,87,190,242,21,128,255,7,221,
154,25,153,119,41,166,247,0,0,50,
33,105,84,88,116,88,77,76,58,99,
111,109,46,97,100,111,98,101,46,120,
109,112,0,0,0,0,0,60,63,120,
112,97,99,107,101,116,32,98,101,103,
105,110,61,34,239,187,191,34,32,105,
100,61,34,87,53,77,48,77,112,67,
101,104,105,72,122,114,101,83,122,78,
84,99,122,107,99,57,100,34,63,62,
10,60,120,58,120,109,112,109,101,116,
97,32,120,109,108,110,115,58,120,61,
34,97,100,111,98,101,58,110,115,58,
109,101,116,97,47,34,32,120,58,120,
109,112,116,107,61,34,65,100,111,98,
101,32,88,77,80,32,67,111,114,101,
32,53,46,48,45,99,48,54,48,32,
54,49,46,49,51,52,55,55,55,44,
32,50,48,49,48,47,48,50,47,49,
50,45,49,55,58,51,50,58,48,48,
32,32,32,32,32,32,32,32,34,62,
10,32,32,32,60,114,100,102,58,82,
68,70,32,120,109,108,110,115,58,114,
100,102,61,34,104,116,116,112,58,47,
47,119,119,119,46,119,51,46,111,114,
103,47,49,57,57,57,47,48,50,47,
50,50,45,114,100,102,45,115,121,110,
116,97,120,45,110,115,35,34,62,10,
32,32,32,32,32,32,60,114,100,102,
58,68,101,115,99,114,105,112,116,105,
111,110,32,114,100,102,58,97,98,111,
117,116,61,34,34,10,32,32,32,32,
32,32,32,32,32,32,32,32,120,109,
108,110,115,58,120,109,112,61,34,104,
116,116,112,58,47,47,110,115,46,97,
100,111,98,101,46,99,111,109,47,120,
97,112,47,49,46,48,47,34,62,10,
32,32,32,32,32,32,32,32,32,60,
120,109,112,58,67,114,101,97,116,111,
114,84,111,111,108,62,65,100,111,98,
101,32,70,105,114,101,119,111,114,107,
115,32,67,83,53,32,49,49,46,48,
46,48,46,52,56,52,32,87,105,110,
100,111,119,115,60,47,120,109,112,58,
67,114,101,97,116,111,114,84,111,111,
108,62,10,32,32,32,32,32,32,32,
32,32,60,120,109,112,58,67,114,101,
97,116,101,68,97,116,101,62,50,48,
49,52,45,48,56,45,48,52,84,49,
56,58,52,56,58,49,51,90,60,47,
120,109,112,58,67,114,101,97,116,101,
68,97,116,101,62,10,32,32,32,32,
32,32,32,32,32,60,120,109,112,58,
77,111,100,105,102,121,68,97,116,101,
62,50,48,49,52,45,48,56,45,48,
52,84,49,56,58,53,51,58,53,51,
90,60,47,120,109,112,58,77,111,100,
105,102,121,68,97,116,101,62,10,32,
32,32,32,32,32,60,47,114,100,102,
58,68,101,115,99,114,105,112,116,105,
111,110,62,10,32,32,32,32,32,32,
60,114,100,102,58,68,101,115,99,114,
105,112,116,105,111,110,32,114,100,102,
58,97,98,111,117,116,61,34,34,10,
32,32,32,32,32,32,32,32,32,32,
32,32,120,109,108,110,115,58,100,99,
61,34,104,116,116,112,58,47,47,112,
117,114,108,46,111,114,103,47,100,99,
47,101,108,101,109,101,110,116,115,47,
49,46,49,47,34,62,10,32,32,32,
32,32,32,32,32,32,60,100,99,58,
102,111,114,109,97,116,62,105,109,97,
103,101,47,112,110,103,60,47,100,99,
58,102,111,114,109,97,116,62,10,32,
32,32,32,32,32,60,47,114,100,102,
58,68,101,115,99,114,105,112,116,105,
111,110,62,10,32,32,32,60,47,114,
100,102,58,82,68,70,62,10,60,47,
120,58,120,109,112,109,101,116,97,62,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,
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,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
10,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,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,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,10,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,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,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,10,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,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,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,10,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,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,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,10,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,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,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,10,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,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,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,10,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,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,32,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,10,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,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,32,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,10,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,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,32,
32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,10,
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,10,60,
63,120,112,97,99,107,101,116,32,101,
110,100,61,34,119,34,63,62,122,154,
41,131,0,0,0,99,73,68,65,84,
24,149,165,145,65,14,128,32,12,4,
167,128,26,255,255,90,53,82,47,104,
154,82,184,184,151,13,203,132,45,32,
170,74,32,5,196,135,105,0,90,159,
194,226,188,131,187,141,150,229,8,62,
3,24,224,110,126,0,136,14,110,24,
41,1,197,212,10,176,182,245,6,236,
102,196,165,180,42,59,219,91,93,77,
150,129,42,127,223,249,114,13,159,102,
39,39,220,199,60,44,17,28,19,251,
246,33,243,0,0,0,0,73,69,78,
68,174,66,96,130,0x00 };
}
| [
"38392025+jaspior@users.noreply.github.com"
] | 38392025+jaspior@users.noreply.github.com |
75b64cf3c182822200e63618a33d4d23b2c4a823 | ea401c3e792a50364fe11f7cea0f35f99e8f4bde | /released_plugins/v3d_plugins/bigneuron_AmosSironi_PrzemyslawGlowacki_SQBTree_plugin/libs/boost_1_58_0/boost/polygon/detail/property_merge.hpp | b0c843b5deac24f817a95e609ebfd6f3d82ea0a0 | [
"MIT"
] | permissive | Vaa3D/vaa3d_tools | edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9 | e6974d5223ae70474efaa85e1253f5df1814fae8 | refs/heads/master | 2023-08-03T06:12:01.013752 | 2023-08-02T07:26:01 | 2023-08-02T07:26:01 | 50,527,925 | 107 | 86 | MIT | 2023-05-22T23:43:48 | 2016-01-27T18:19:17 | C++ | UTF-8 | C++ | false | false | 23,182 | hpp | /*
Copyright 2008 Intel Corporation
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
*/
#ifndef BOOST_POLYGON_PROPERTY_MERGE_HPP
#define BOOST_POLYGON_PROPERTY_MERGE_HPP
namespace boost { namespace polygon{
template <typename coordinate_type>
class property_merge_point {
private:
coordinate_type x_, y_;
public:
inline property_merge_point() : x_(), y_() {}
inline property_merge_point(coordinate_type x, coordinate_type y) : x_(x), y_(y) {}
//use builtin assign and copy
inline bool operator==(const property_merge_point& that) const { return x_ == that.x_ && y_ == that.y_; }
inline bool operator!=(const property_merge_point& that) const { return !((*this) == that); }
inline bool operator<(const property_merge_point& that) const {
if(x_ < that.x_) return true;
if(x_ > that.x_) return false;
return y_ < that.y_;
}
inline coordinate_type x() const { return x_; }
inline coordinate_type y() const { return y_; }
inline void x(coordinate_type value) { x_ = value; }
inline void y(coordinate_type value) { y_ = value; }
};
template <typename coordinate_type>
class property_merge_interval {
private:
coordinate_type low_, high_;
public:
inline property_merge_interval() : low_(), high_() {}
inline property_merge_interval(coordinate_type low, coordinate_type high) : low_(low), high_(high) {}
//use builtin assign and copy
inline bool operator==(const property_merge_interval& that) const { return low_ == that.low_ && high_ == that.high_; }
inline bool operator!=(const property_merge_interval& that) const { return !((*this) == that); }
inline bool operator<(const property_merge_interval& that) const {
if(low_ < that.low_) return true;
if(low_ > that.low_) return false;
return high_ < that.high_;
}
inline coordinate_type low() const { return low_; }
inline coordinate_type high() const { return high_; }
inline void low(coordinate_type value) { low_ = value; }
inline void high(coordinate_type value) { high_ = value; }
};
template <typename coordinate_type, typename property_type, typename polygon_set_type, typename keytype = std::set<property_type> >
class merge_scanline {
public:
//definitions
typedef keytype property_set;
typedef std::vector<std::pair<property_type, int> > property_map;
typedef std::pair<property_merge_point<coordinate_type>, std::pair<property_type, int> > vertex_property;
typedef std::pair<property_merge_point<coordinate_type>, property_map> vertex_data;
typedef std::vector<vertex_property> property_merge_data;
//typedef std::map<property_set, polygon_set_type> Result;
typedef std::map<coordinate_type, property_map> scanline_type;
typedef typename scanline_type::iterator scanline_iterator;
typedef std::pair<property_merge_interval<coordinate_type>, std::pair<property_set, property_set> > edge_property;
typedef std::vector<edge_property> edge_property_vector;
//static public member functions
template <typename iT, typename orientation_2d_type>
static inline void
populate_property_merge_data(property_merge_data& pmd, iT input_begin, iT input_end,
const property_type& property, orientation_2d_type orient) {
for( ; input_begin != input_end; ++input_begin) {
std::pair<property_merge_point<coordinate_type>, std::pair<property_type, int> > element;
if(orient == HORIZONTAL)
element.first = property_merge_point<coordinate_type>((*input_begin).second.first, (*input_begin).first);
else
element.first = property_merge_point<coordinate_type>((*input_begin).first, (*input_begin).second.first);
element.second.first = property;
element.second.second = (*input_begin).second.second;
pmd.push_back(element);
}
}
//public member functions
merge_scanline() : output(), scanline(), currentVertex(), tmpVector(), previousY(), countFromBelow(), scanlinePosition() {}
merge_scanline(const merge_scanline& that) :
output(that.output),
scanline(that.scanline),
currentVertex(that.currentVertex),
tmpVector(that.tmpVector),
previousY(that.previousY),
countFromBelow(that.countFromBelow),
scanlinePosition(that.scanlinePosition)
{}
merge_scanline& operator=(const merge_scanline& that) {
output = that.output;
scanline = that.scanline;
currentVertex = that.currentVertex;
tmpVector = that.tmpVector;
previousY = that.previousY;
countFromBelow = that.countFromBelow;
scanlinePosition = that.scanlinePosition;
return *this;
}
template <typename result_type>
inline void perform_merge(result_type& result, property_merge_data& data) {
if(data.empty()) return;
//sort
polygon_sort(data.begin(), data.end(), less_vertex_data<vertex_property>());
//scanline
bool firstIteration = true;
scanlinePosition = scanline.end();
for(std::size_t i = 0; i < data.size(); ++i) {
if(firstIteration) {
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
firstIteration = false;
} else {
if(data[i].first != currentVertex.first) {
if(data[i].first.x() != currentVertex.first.x()) {
processVertex(output);
//std::cout << scanline.size() << " ";
countFromBelow.clear(); //should already be clear
writeOutput(currentVertex.first.x(), result, output);
currentVertex.second.clear();
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
//std::cout << assertRedundant(scanline) << "/" << scanline.size() << " ";
} else {
processVertex(output);
currentVertex.second.clear();
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
}
} else {
mergeProperty(currentVertex.second, data[i].second);
}
}
}
processVertex(output);
writeOutput(currentVertex.first.x(), result, output);
//std::cout << assertRedundant(scanline) << "/" << scanline.size() << "\n";
//std::cout << scanline.size() << "\n";
}
private:
//private supporting types
template <class T>
class less_vertex_data {
public:
less_vertex_data() {}
bool operator()(const T& lvalue, const T& rvalue) const {
if(lvalue.first.x() < rvalue.first.x()) return true;
if(lvalue.first.x() > rvalue.first.x()) return false;
if(lvalue.first.y() < rvalue.first.y()) return true;
return false;
}
};
template <typename T>
struct lessPropertyCount {
lessPropertyCount() {}
bool operator()(const T& a, const T& b) {
return a.first < b.first;
}
};
//private static member functions
static inline void mergeProperty(property_map& lvalue, std::pair<property_type, int>& rvalue) {
typename property_map::iterator itr = std::lower_bound(lvalue.begin(), lvalue.end(), rvalue,
lessPropertyCount<std::pair<property_type, int> >());
if(itr == lvalue.end() ||
(*itr).first != rvalue.first) {
lvalue.insert(itr, rvalue);
} else {
(*itr).second += rvalue.second;
if((*itr).second == 0)
lvalue.erase(itr);
}
// if(assertSorted(lvalue)) {
// std::cout << "in mergeProperty\n";
// exit(0);
// }
}
// static inline bool assertSorted(property_map& pset) {
// bool result = false;
// for(std::size_t i = 1; i < pset.size(); ++i) {
// if(pset[i] < pset[i-1]) {
// std::cout << "Out of Order Error ";
// result = true;
// }
// if(pset[i].first == pset[i-1].first) {
// std::cout << "Duplicate Property Error ";
// result = true;
// }
// if(pset[0].second == 0 || pset[1].second == 0) {
// std::cout << "Empty Property Error ";
// result = true;
// }
// }
// return result;
// }
static inline void setProperty(property_set& pset, property_map& pmap) {
for(typename property_map::iterator itr = pmap.begin(); itr != pmap.end(); ++itr) {
if((*itr).second > 0) {
pset.insert(pset.end(), (*itr).first);
}
}
}
//private data members
edge_property_vector output;
scanline_type scanline;
vertex_data currentVertex;
property_map tmpVector;
coordinate_type previousY;
property_map countFromBelow;
scanline_iterator scanlinePosition;
//private member functions
inline void mergeCount(property_map& lvalue, property_map& rvalue) {
typename property_map::iterator litr = lvalue.begin();
typename property_map::iterator ritr = rvalue.begin();
tmpVector.clear();
while(litr != lvalue.end() && ritr != rvalue.end()) {
if((*litr).first <= (*ritr).first) {
if(!tmpVector.empty() &&
(*litr).first == tmpVector.back().first) {
tmpVector.back().second += (*litr).second;
} else {
tmpVector.push_back(*litr);
}
++litr;
} else if((*ritr).first <= (*litr).first) {
if(!tmpVector.empty() &&
(*ritr).first == tmpVector.back().first) {
tmpVector.back().second += (*ritr).second;
} else {
tmpVector.push_back(*ritr);
}
++ritr;
}
}
while(litr != lvalue.end()) {
if(!tmpVector.empty() &&
(*litr).first == tmpVector.back().first) {
tmpVector.back().second += (*litr).second;
} else {
tmpVector.push_back(*litr);
}
++litr;
}
while(ritr != rvalue.end()) {
if(!tmpVector.empty() &&
(*ritr).first == tmpVector.back().first) {
tmpVector.back().second += (*ritr).second;
} else {
tmpVector.push_back(*ritr);
}
++ritr;
}
lvalue.clear();
for(std::size_t i = 0; i < tmpVector.size(); ++i) {
if(tmpVector[i].second != 0) {
lvalue.push_back(tmpVector[i]);
}
}
// if(assertSorted(lvalue)) {
// std::cout << "in mergeCount\n";
// exit(0);
// }
}
inline void processVertex(edge_property_vector& output) {
if(!countFromBelow.empty()) {
//we are processing an interval of change in scanline state between
//previous vertex position and current vertex position where
//count from below represents the change on the interval
//foreach scanline element from previous to current we
//write the interval on the scanline that is changing
//the old value and the new value to output
property_merge_interval<coordinate_type> currentInterval(previousY, currentVertex.first.y());
coordinate_type currentY = currentInterval.low();
if(scanlinePosition == scanline.end() ||
(*scanlinePosition).first != previousY) {
scanlinePosition = scanline.lower_bound(previousY);
}
scanline_iterator previousScanlinePosition = scanlinePosition;
++scanlinePosition;
while(scanlinePosition != scanline.end()) {
coordinate_type elementY = (*scanlinePosition).first;
if(elementY <= currentInterval.high()) {
property_map& countOnLeft = (*previousScanlinePosition).second;
edge_property element;
output.push_back(element);
output.back().first = property_merge_interval<coordinate_type>((*previousScanlinePosition).first, elementY);
setProperty(output.back().second.first, countOnLeft);
mergeCount(countOnLeft, countFromBelow);
setProperty(output.back().second.second, countOnLeft);
if(output.back().second.first == output.back().second.second) {
output.pop_back(); //it was an internal vertical edge, not to be output
}
else if(output.size() > 1) {
edge_property& secondToLast = output[output.size()-2];
if(secondToLast.first.high() == output.back().first.low() &&
secondToLast.second.first == output.back().second.first &&
secondToLast.second.second == output.back().second.second) {
//merge output onto previous output because properties are
//identical on both sides implying an internal horizontal edge
secondToLast.first.high(output.back().first.high());
output.pop_back();
}
}
if(previousScanlinePosition == scanline.begin()) {
if(countOnLeft.empty()) {
scanline.erase(previousScanlinePosition);
}
} else {
scanline_iterator tmpitr = previousScanlinePosition;
--tmpitr;
if((*tmpitr).second == (*previousScanlinePosition).second)
scanline.erase(previousScanlinePosition);
}
} else if(currentY < currentInterval.high()){
//elementY > currentInterval.high()
//split the interval between previous and current scanline elements
std::pair<coordinate_type, property_map> elementScan;
elementScan.first = currentInterval.high();
elementScan.second = (*previousScanlinePosition).second;
scanlinePosition = scanline.insert(scanlinePosition, elementScan);
continue;
} else {
break;
}
previousScanlinePosition = scanlinePosition;
currentY = previousY = elementY;
++scanlinePosition;
if(scanlinePosition == scanline.end() &&
currentY < currentInterval.high()) {
//insert a new element for top of range
std::pair<coordinate_type, property_map> elementScan;
elementScan.first = currentInterval.high();
scanlinePosition = scanline.insert(scanline.end(), elementScan);
}
}
if(scanlinePosition == scanline.end() &&
currentY < currentInterval.high()) {
//handle case where we iterated to end of the scanline
//we need to insert an element into the scanline at currentY
//with property value coming from below
//and another one at currentInterval.high() with empty property value
mergeCount(scanline[currentY], countFromBelow);
std::pair<coordinate_type, property_map> elementScan;
elementScan.first = currentInterval.high();
scanline.insert(scanline.end(), elementScan);
edge_property element;
output.push_back(element);
output.back().first = property_merge_interval<coordinate_type>(currentY, currentInterval.high());
setProperty(output.back().second.second, countFromBelow);
mergeCount(countFromBelow, currentVertex.second);
} else {
mergeCount(countFromBelow, currentVertex.second);
if(countFromBelow.empty()) {
if(previousScanlinePosition == scanline.begin()) {
if((*previousScanlinePosition).second.empty()) {
scanline.erase(previousScanlinePosition);
//previousScanlinePosition = scanline.end();
//std::cout << "ERASE_A ";
}
} else {
scanline_iterator tmpitr = previousScanlinePosition;
--tmpitr;
if((*tmpitr).second == (*previousScanlinePosition).second) {
scanline.erase(previousScanlinePosition);
//previousScanlinePosition = scanline.end();
//std::cout << "ERASE_B ";
}
}
}
}
} else {
//count from below is empty, we are starting a new interval of change
countFromBelow = currentVertex.second;
scanlinePosition = scanline.lower_bound(currentVertex.first.y());
if(scanlinePosition != scanline.end()) {
if((*scanlinePosition).first != currentVertex.first.y()) {
if(scanlinePosition != scanline.begin()) {
//decrement to get the lower position of the first interval this vertex intersects
--scanlinePosition;
//insert a new element into the scanline for the incoming vertex
property_map& countOnLeft = (*scanlinePosition).second;
std::pair<coordinate_type, property_map> element(currentVertex.first.y(), countOnLeft);
scanlinePosition = scanline.insert(scanlinePosition, element);
} else {
property_map countOnLeft;
std::pair<coordinate_type, property_map> element(currentVertex.first.y(), countOnLeft);
scanlinePosition = scanline.insert(scanlinePosition, element);
}
}
} else {
property_map countOnLeft;
std::pair<coordinate_type, property_map> element(currentVertex.first.y(), countOnLeft);
scanlinePosition = scanline.insert(scanlinePosition, element);
}
}
previousY = currentVertex.first.y();
}
template <typename T>
inline int assertRedundant(T& t) {
if(t.empty()) return 0;
int count = 0;
typename T::iterator itr = t.begin();
if((*itr).second.empty())
++count;
typename T::iterator itr2 = itr;
++itr2;
while(itr2 != t.end()) {
if((*itr).second == (*itr2).second)
++count;
itr = itr2;
++itr2;
}
return count;
}
template <typename T>
inline void performExtract(T& result, property_merge_data& data) {
if(data.empty()) return;
//sort
polygon_sort(data.begin(), data.end(), less_vertex_data<vertex_property>());
//scanline
bool firstIteration = true;
scanlinePosition = scanline.end();
for(std::size_t i = 0; i < data.size(); ++i) {
if(firstIteration) {
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
firstIteration = false;
} else {
if(data[i].first != currentVertex.first) {
if(data[i].first.x() != currentVertex.first.x()) {
processVertex(output);
//std::cout << scanline.size() << " ";
countFromBelow.clear(); //should already be clear
writeGraph(currentVertex.first.x(), result, output, scanline);
currentVertex.second.clear();
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
} else {
processVertex(output);
currentVertex.second.clear();
mergeProperty(currentVertex.second, data[i].second);
currentVertex.first = data[i].first;
}
} else {
mergeProperty(currentVertex.second, data[i].second);
}
}
}
processVertex(output);
writeGraph(currentVertex.first.x(), result, output, scanline);
//std::cout << scanline.size() << "\n";
}
template <typename T>
inline void insertEdges(T& graph, property_set& p1, property_set& p2) {
for(typename property_set::iterator itr = p1.begin(); itr != p1.end(); ++itr) {
for(typename property_set::iterator itr2 = p2.begin(); itr2 != p2.end(); ++itr2) {
if(*itr != *itr2) {
graph[*itr].insert(*itr2);
graph[*itr2].insert(*itr);
}
}
}
}
template <typename T>
inline void propertySetAbove(coordinate_type y, property_set& ps, T& scanline) {
ps.clear();
typename T::iterator itr = scanline.find(y);
if(itr != scanline.end())
setProperty(ps, (*itr).second);
}
template <typename T>
inline void propertySetBelow(coordinate_type y, property_set& ps, T& scanline) {
ps.clear();
typename T::iterator itr = scanline.find(y);
if(itr != scanline.begin()) {
--itr;
setProperty(ps, (*itr).second);
}
}
template <typename T, typename T2>
inline void writeGraph(coordinate_type x, T& graph, edge_property_vector& output, T2& scanline) {
if(output.empty()) return;
edge_property* previousEdgeP = &(output[0]);
bool firstIteration = true;
property_set ps;
for(std::size_t i = 0; i < output.size(); ++i) {
edge_property& previousEdge = *previousEdgeP;
edge_property& edge = output[i];
if(previousEdge.first.high() == edge.first.low()) {
//horizontal edge
insertEdges(graph, edge.second.first, previousEdge.second.first);
//corner 1
insertEdges(graph, edge.second.first, previousEdge.second.second);
//other horizontal edge
insertEdges(graph, edge.second.second, previousEdge.second.second);
//corner 2
insertEdges(graph, edge.second.second, previousEdge.second.first);
} else {
if(!firstIteration){
//look up regions above previous edge
propertySetAbove(previousEdge.first.high(), ps, scanline);
insertEdges(graph, ps, previousEdge.second.first);
insertEdges(graph, ps, previousEdge.second.second);
}
//look up regions below current edge in the scanline
propertySetBelow(edge.first.high(), ps, scanline);
insertEdges(graph, ps, edge.second.first);
insertEdges(graph, ps, edge.second.second);
}
firstIteration = false;
//vertical edge
insertEdges(graph, edge.second.second, edge.second.first);
//shared region to left
insertEdges(graph, edge.second.second, edge.second.second);
//shared region to right
insertEdges(graph, edge.second.first, edge.second.first);
previousEdgeP = &(output[i]);
}
edge_property& previousEdge = *previousEdgeP;
propertySetAbove(previousEdge.first.high(), ps, scanline);
insertEdges(graph, ps, previousEdge.second.first);
insertEdges(graph, ps, previousEdge.second.second);
output.clear();
}
template <typename Result>
inline void writeOutput(coordinate_type x, Result& result, edge_property_vector& output) {
for(std::size_t i = 0; i < output.size(); ++i) {
edge_property& edge = output[i];
//edge.second.first is the property set on the left of the edge
if(!edge.second.first.empty()) {
typename Result::iterator itr = result.find(edge.second.first);
if(itr == result.end()) {
std::pair<property_set, polygon_set_type> element(edge.second.first, polygon_set_type(VERTICAL));
itr = result.insert(result.end(), element);
}
std::pair<interval_data<coordinate_type>, int> element2(interval_data<coordinate_type>(edge.first.low(), edge.first.high()), -1); //right edge of figure
(*itr).second.insert(x, element2);
}
if(!edge.second.second.empty()) {
//edge.second.second is the property set on the right of the edge
typename Result::iterator itr = result.find(edge.second.second);
if(itr == result.end()) {
std::pair<property_set, polygon_set_type> element(edge.second.second, polygon_set_type(VERTICAL));
itr = result.insert(result.end(), element);
}
std::pair<interval_data<coordinate_type>, int> element3(interval_data<coordinate_type>(edge.first.low(), edge.first.high()), 1); //left edge of figure
(*itr).second.insert(x, element3);
}
}
output.clear();
}
};
}
}
#endif
| [
"amos.sironi@gmail.com"
] | amos.sironi@gmail.com |
1d6fc6f2017e15f3b6cff642444c1343ee143cb3 | a6cee0a2e956fcf63f19f359675f5cb0552cdb5a | /garminfitsdk/fit_segment_file_mesg_listener.hpp | 1ff7c137c321b67f3349c1426b43eb48f7476c6d | [] | no_license | KatzSanya/MRC_creator | fc45d0a81d11fb5082b5ef8b84e6bb4c236052b9 | 42128c78fba177cd20b3a948918c0451b0154367 | refs/heads/master | 2023-05-31T23:00:03.848531 | 2021-06-22T01:45:30 | 2021-06-22T01:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,301 | hpp | ////////////////////////////////////////////////////////////////////////////////
// The following FIT Protocol software provided may be used with FIT protocol
// devices only and remains the copyrighted property of Garmin Canada Inc.
// The software is being provided on an "as-is" basis and as an accommodation,
// and therefore all warranties, representations, or guarantees of any kind
// (whether express, implied or statutory) including, without limitation,
// warranties of merchantability, non-infringement, or fitness for a particular
// purpose, are specifically disclaimed.
//
// Copyright 2021 Garmin Canada Inc.
////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.54Release
// Tag = production/akw/21.54.01-0-g081c465c
////////////////////////////////////////////////////////////////////////////////
#if !defined(FIT_SEGMENT_FILE_MESG_LISTENER_HPP)
#define FIT_SEGMENT_FILE_MESG_LISTENER_HPP
#include "fit_segment_file_mesg.hpp"
namespace fit
{
class SegmentFileMesgListener
{
public:
virtual ~SegmentFileMesgListener() {}
virtual void OnMesg(SegmentFileMesg& mesg) = 0;
};
} // namespace fit
#endif // !defined(FIT_SEGMENT_FILE_MESG_LISTENER_HPP)
| [
"helder.giro.lopes@gmail.com"
] | helder.giro.lopes@gmail.com |
a253b2c727cc0db4a273b510b0997c1108d9f4cd | 2937bc82baf39013855f17039954bf2f73d6def1 | /src/bdd.h | fe0d64a0acccd242f18b59d2e1c87a97760a194c | [] | no_license | magic3007/VLSI-CAD | f6d0a3faa056439869040d30ef022cbb08bf968c | bbc5ee5fdd4c5786f3c5411600853bf6a5349d41 | refs/heads/main | 2023-06-11T07:26:20.332375 | 2021-07-02T17:27:55 | 2021-07-02T17:27:55 | 348,388,994 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 770 | h | #pragma once
#include "utils/arg.hpp"
#include <cstdint>
#include <memory>
#include <vector>
class BDDNodeImpl;
class BDDNode {
private:
SHARED_CLASS_ARG(BDDNode, impl);
public:
BDDNode() : impl_(nullptr) {}
bool & is_leaf();
bool & leaf_value();
int32_t &var_id();
BDDNode &true_son();
BDDNode &false_son();
bool defined();
bool & is_visited();
};
class BDDNodeImpl {
CLASS_ARG(bool, is_leaf){};
CLASS_ARG(bool, leaf_value){};
CLASS_ARG(int32_t, var_id){};
CLASS_ARG(bool, is_visited){};
CLASS_ARG(BDDNode, true_son);
CLASS_ARG(BDDNode, false_son);
};
MAKE_SHARED_CLASS(BDDNode)
struct BDDOperator {
static BDDNode OR(std::vector<BDDNode> &bdds, const std::vector<int32_t> &vars_rank);
}; | [
"jingmai@pku.edu.cn"
] | jingmai@pku.edu.cn |
c131fa2023f298d9ac196bb22ae5e9e870a9a10a | d6135170e6156a12d4f64cff0373ee0b00ca644b | /tensorflow/compiler/tf2tensorrt/kernels/get_calibration_data_op.cc | 4c4ae6f88daf90bf905e0e6a66c763477d427e53 | [
"Apache-2.0"
] | permissive | eladeban/tensorflow | 12499b0972b8aafde277b61da7bbdb1c59aa1d2a | 0d4485677356a761f21ad7223759cd89bcc9034c | refs/heads/master | 2020-06-04T03:28:24.373618 | 2019-06-13T22:37:52 | 2019-06-13T22:49:52 | 191,843,388 | 4 | 1 | Apache-2.0 | 2019-06-13T22:54:36 | 2019-06-13T22:54:36 | null | UTF-8 | C++ | false | false | 2,442 | cc | /* Copyright 2018 The TensorFlow 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.
==============================================================================*/
#include <memory>
#include <vector>
#include "tensorflow/compiler/tf2tensorrt/utils/calibration_resource.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/resource_mgr.h"
#include "tensorflow/core/lib/core/refcount.h"
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
namespace tensorflow {
namespace tensorrt {
class GetCalibrationDataOp : public OpKernel {
public:
explicit GetCalibrationDataOp(OpKernelConstruction* context)
: OpKernel(context) {}
~GetCalibrationDataOp() override {}
void Compute(OpKernelContext* context) override {
// TODO(laigd): it will allocate the tensor on the device and copy the
// serialized string to that tensor, and later sess.run() will copy it back
// to host. We need to optimize this.
const string& resource_name = context->input(0).scalar<string>()();
// Get the resource.
TRTCalibrationResource* resource = nullptr;
OP_REQUIRES_OK(context, context->resource_manager()->Lookup(
std::string(kCalibrationContainerName),
resource_name, &resource));
core::ScopedUnref sc(resource);
// Serialize the resource as output.
string serialized_resource;
OP_REQUIRES_OK(context, resource->SerializeToString(&serialized_resource));
Tensor* output = nullptr;
OP_REQUIRES_OK(context,
context->allocate_output(0, TensorShape({}), &output));
output->scalar<string>()() = serialized_resource;
}
};
REGISTER_KERNEL_BUILDER(Name("GetCalibrationDataOp").Device(DEVICE_GPU),
GetCalibrationDataOp);
} // namespace tensorrt
} // namespace tensorflow
#endif // GOOGLE_TENSORRT
#endif // GOOGLE_CUDA
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
668f8adb3cae64573cc64639e80bc3cb9a11f8c8 | 37c207febf14487cabb744587fc146755a7d04ef | /Coursera_CS_2_test/two.cpp | fed29b49d672930dd85bb6d64f0267d4c9ec03fc | [
"MIT"
] | permissive | pandezhao/MYC- | cf8accbb54819a6d15e0a1e6b4e919e1e576e73b | c4ee632abf31ff7356fdd63d85e0d9f22a952ed3 | refs/heads/master | 2021-07-13T05:56:56.493958 | 2018-12-27T04:02:19 | 2018-12-27T04:02:19 | 136,557,621 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,465 | cpp | #include <iostream>
using namespace std;
class character{
public:
int word;
int time=0;
character *next=NULL;
character(int a,int b){
word = a;
time = b;
}
};
bool zifu(char tmp){
if (((int)tmp>64&&(int)tmp<91)||((int)tmp>96&&(int)tmp<123)){
cout<<tmp<<' '<<"True"<<endl;
return true;}
else{
cout<<"false"<<endl;
return false;
}
}
int fanyi(char tmp){
if ((int)tmp<91)
return (int)tmp-65;
else
return (int)tmp-97;
}
int main(){
char ku[501]={'\0'};
cin.getline(ku, 501);
character head(-1,0);
character *tmp = &head;
cout<<"all data get"<<endl;
for (int i=0;i<501;i++){
cout<<i<<endl;
if (zifu(ku[i])){
while((tmp->next!=NULL)&&(tmp->word!=fanyi(ku[i]))){
tmp=tmp->next;
}
if (tmp->next==NULL){
character xin(fanyi(ku[i]), 1);
tmp->next = &xin;
tmp=&head;
cout<<"er"<<endl;
}
else if (tmp->word==fanyi(ku[i])){
tmp->time+=1;
tmp=&head;
cout<<"san"<<endl;
}
}
}
cout<<"chain built"<<endl;
int max=0;
while(tmp->next!=NULL){
if (tmp->time>max){
max=tmp->time;
tmp=tmp->next;
}
}
tmp=&head;
int xiaomax=0;
cout<<"max get"<<endl;
while(tmp->next!=NULL){
if (tmp->time>xiaomax&&tmp->time!=max){
xiaomax=tmp->time;
tmp=tmp->next;
}
}
cout<<"second max get"<<endl;
tmp=&head;
while(tmp->time!=xiaomax){
tmp=tmp->next;
}
char a=(char)tmp->word+65;
char b=(char)tmp->word+97;
cout<<a<<'+'<<b<<':'<<tmp->time<<endl;
return 0;
}
| [
"981317572@qq.com"
] | 981317572@qq.com |
adc7958721dd20761ee165ba1b138186ec79cc9c | 1744f05976574ce660b64936702c1f3d9ff1f549 | /TaskManager/Observer.h | dc27144a918bffb79c4709f7e5a2e204b4ef4b13 | [] | no_license | tudor-alexa99/OOP | c4b85ed8ca39de79e5b70082d89abc3c7b4fd316 | c0947ae0075aeef3bce798bbd4ac7f4eba320501 | refs/heads/master | 2021-05-24T08:20:50.223410 | 2020-04-06T10:53:00 | 2020-04-06T10:53:00 | 253,468,003 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 352 | h | #pragma once
#include <vector>
using namespace std;
class Observer
{
public:
virtual void update() = 0;
Observer();
virtual ~Observer();
};
class Subject {
private:
vector<Observer*> observers;
public:
void notify();
void addObserver(Observer *obs) { this->observers.push_back(obs); }
Subject();
virtual ~Subject();
};
| [
"noreply@github.com"
] | noreply@github.com |
361d048cae9168921a9e2776cdb1058535303875 | 38616fa53a78f61d866ad4f2d3251ef471366229 | /3rdparty/RobustGNSS/gtsam/gtsam/3rdparty/GeographicLib/include/GeographicLib/GeodesicLine.hpp | c901b30078624659a92999ba22a49399f84d953a | [
"MIT",
"BSD-3-Clause",
"LGPL-2.1-only",
"MPL-2.0",
"LGPL-2.0-or-later",
"BSD-2-Clause"
] | permissive | wuyou33/Enabling-Robust-State-Estimation-through-Measurement-Error-Covariance-Adaptation | 3b467fa6d3f34cabbd5ee59596ac1950aabf2522 | 2f1ff054b7c5059da80bb3b2f80c05861a02cc36 | refs/heads/master | 2020-06-08T12:42:31.977541 | 2019-06-10T15:04:33 | 2019-06-10T15:04:33 | 193,229,646 | 1 | 0 | MIT | 2019-06-22T12:07:29 | 2019-06-22T12:07:29 | null | UTF-8 | C++ | false | false | 26,029 | hpp | /**
* \file GeodesicLine.hpp
* \brief Header for GeographicLib::GeodesicLine class
*
* Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP)
#define GEOGRAPHICLIB_GEODESICLINE_HPP 1
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/Geodesic.hpp>
namespace GeographicLib {
/**
* \brief A geodesic line
*
* GeodesicLine facilitates the determination of a series of points on a
* single geodesic. The starting point (\e lat1, \e lon1) and the azimuth \e
* azi1 are specified in the constructor. GeodesicLine.Position returns the
* location of point 2 a distance \e s12 along the geodesic. Alternatively
* GeodesicLine.ArcPosition gives the position of point 2 an arc length \e
* a12 along the geodesic.
*
* The default copy constructor and assignment operators work with this
* class. Similarly, a vector can be used to hold GeodesicLine objects.
*
* The calculations are accurate to better than 15 nm (15 nanometers). See
* Sec. 9 of
* <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
* details. The algorithms used by this class are based on series expansions
* using the flattening \e f as a small parameter. These are only accurate
* for |<i>f</i>| < 0.02; however reasonably accurate results will be
* obtained for |<i>f</i>| < 0.2. For very eccentric ellipsoids, use
* GeodesicLineExact instead.
*
* The algorithms are described in
* - C. F. F. Karney,
* <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
* Algorithms for geodesics</a>,
* J. Geodesy <b>87</b>, 43--55 (2013);
* DOI: <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
* 10.1007/s00190-012-0578-z</a>;
* addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
* geod-addenda.html</a>.
* .
* For more information on geodesics see \ref geodesic.
*
* Example of use:
* \include example-GeodesicLine.cpp
*
* <a href="GeodSolve.1.html">GeodSolve</a> is a command-line utility
* providing access to the functionality of Geodesic and GeodesicLine.
**********************************************************************/
class GEOGRAPHICLIB_EXPORT GeodesicLine {
private:
typedef Math::real real;
friend class Geodesic;
static const int nC1_ = Geodesic::nC1_;
static const int nC1p_ = Geodesic::nC1p_;
static const int nC2_ = Geodesic::nC2_;
static const int nC3_ = Geodesic::nC3_;
static const int nC4_ = Geodesic::nC4_;
real _lat1, _lon1, _azi1;
real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2,
_salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1,
_A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41;
// index zero elements of _C1a, _C1pa, _C2a, _C3a are unused
real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_],
_C4a[nC4_]; // all the elements of _C4a are used
unsigned _caps;
enum captype {
CAP_NONE = Geodesic::CAP_NONE,
CAP_C1 = Geodesic::CAP_C1,
CAP_C1p = Geodesic::CAP_C1p,
CAP_C2 = Geodesic::CAP_C2,
CAP_C3 = Geodesic::CAP_C3,
CAP_C4 = Geodesic::CAP_C4,
CAP_ALL = Geodesic::CAP_ALL,
OUT_ALL = Geodesic::OUT_ALL,
};
public:
/**
* Bit masks for what calculations to do. They signify to the
* GeodesicLine::GeodesicLine constructor and to Geodesic::Line what
* capabilities should be included in the GeodesicLine object. This is
* merely a duplication of Geodesic::mask.
**********************************************************************/
enum mask {
/**
* No capabilities, no output.
* @hideinitializer
**********************************************************************/
NONE = Geodesic::NONE,
/**
* Calculate latitude \e lat2. (It's not necessary to include this as a
* capability to GeodesicLine because this is included by default.)
* @hideinitializer
**********************************************************************/
LATITUDE = Geodesic::LATITUDE,
/**
* Calculate longitude \e lon2.
* @hideinitializer
**********************************************************************/
LONGITUDE = Geodesic::LONGITUDE,
/**
* Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
* include this as a capability to GeodesicLine because this is included
* by default.)
* @hideinitializer
**********************************************************************/
AZIMUTH = Geodesic::AZIMUTH,
/**
* Calculate distance \e s12.
* @hideinitializer
**********************************************************************/
DISTANCE = Geodesic::DISTANCE,
/**
* Allow distance \e s12 to be used as input in the direct geodesic
* problem.
* @hideinitializer
**********************************************************************/
DISTANCE_IN = Geodesic::DISTANCE_IN,
/**
* Calculate reduced length \e m12.
* @hideinitializer
**********************************************************************/
REDUCEDLENGTH = Geodesic::REDUCEDLENGTH,
/**
* Calculate geodesic scales \e M12 and \e M21.
* @hideinitializer
**********************************************************************/
GEODESICSCALE = Geodesic::GEODESICSCALE,
/**
* Calculate area \e S12.
* @hideinitializer
**********************************************************************/
AREA = Geodesic::AREA,
/**
* All capabilities, calculate everything.
* @hideinitializer
**********************************************************************/
ALL = Geodesic::ALL,
};
/** \name Constructors
**********************************************************************/
///@{
/**
* Constructor for a geodesic line staring at latitude \e lat1, longitude
* \e lon1, and azimuth \e azi1 (all in degrees).
*
* @param[in] g A Geodesic object used to compute the necessary information
* about the GeodesicLine.
* @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees).
* @param[in] azi1 azimuth at point 1 (degrees).
* @param[in] caps bitor'ed combination of GeodesicLine::mask values
* specifying the capabilities the GeodesicLine object should possess,
* i.e., which quantities can be returned in calls to
* GeodesicLine::Position.
*
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
* azi1 should be in the range [−540°, 540°).
*
* The GeodesicLine::mask values are
* - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this is
* added automatically;
* - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2;
* - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is
* added automatically;
* - \e caps |= GeodesicLine::DISTANCE for the distance \e s12;
* - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m12;
* - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12
* and \e M21;
* - \e caps |= GeodesicLine::AREA for the area \e S12;
* - \e caps |= GeodesicLine::DISTANCE_IN permits the length of the
* geodesic to be given in terms of \e s12; without this capability the
* length can only be specified in terms of arc length;
* - \e caps |= GeodesicLine::ALL for all of the above.
* .
* The default value of \e caps is GeodesicLine::ALL.
*
* If the point is at a pole, the azimuth is defined by keeping \e lon1
* fixed, writing \e lat1 = ±(90° − ε), and taking
* the limit ε → 0+.
**********************************************************************/
GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1,
unsigned caps = ALL)
throw();
/**
* A default constructor. If GeodesicLine::Position is called on the
* resulting object, it returns immediately (without doing any
* calculations). The object can be set with a call to Geodesic::Line.
* Use Init() to test whether object is still in this uninitialized state.
**********************************************************************/
GeodesicLine() throw() : _caps(0U) {}
///@}
/** \name Position in terms of distance
**********************************************************************/
///@{
/**
* Compute the position of point 2 which is a distance \e s12 (meters) from
* point 1.
*
* @param[in] s12 distance between point 1 and point 2 (meters); it can be
* negative.
* @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::LONGITUDE.
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] m12 reduced length of geodesic (meters); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::REDUCEDLENGTH.
* @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
* that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::AREA.
* @return \e a12 arc length of between point 1 and point 2 (degrees).
*
* The values of \e lon2 and \e azi2 returned are in the range
* [−180°, 180°).
*
* The GeodesicLine object \e must have been constructed with \e caps |=
* GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no
* parameters are set. Requesting a value which the GeodesicLine object is
* not capable of computing is not an error; the corresponding argument
* will not be altered.
*
* The following functions are overloaded versions of
* GeodesicLine::Position which omit some of the output parameters. Note,
* however, that the arc length is always computed and returned as the
* function value.
**********************************************************************/
Math::real Position(real s12,
real& lat2, real& lon2, real& azi2,
real& m12, real& M12, real& M21,
real& S12) const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE | AZIMUTH |
REDUCEDLENGTH | GEODESICSCALE | AREA,
lat2, lon2, azi2, t, m12, M12, M21, S12);
}
/**
* See the documentation for GeodesicLine::Position.
**********************************************************************/
Math::real Position(real s12, real& lat2, real& lon2) const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE,
lat2, lon2, t, t, t, t, t, t);
}
/**
* See the documentation for GeodesicLine::Position.
**********************************************************************/
Math::real Position(real s12, real& lat2, real& lon2,
real& azi2) const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE | AZIMUTH,
lat2, lon2, azi2, t, t, t, t, t);
}
/**
* See the documentation for GeodesicLine::Position.
**********************************************************************/
Math::real Position(real s12, real& lat2, real& lon2,
real& azi2, real& m12) const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE |
AZIMUTH | REDUCEDLENGTH,
lat2, lon2, azi2, t, m12, t, t, t);
}
/**
* See the documentation for GeodesicLine::Position.
**********************************************************************/
Math::real Position(real s12, real& lat2, real& lon2,
real& azi2, real& M12, real& M21)
const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE |
AZIMUTH | GEODESICSCALE,
lat2, lon2, azi2, t, t, M12, M21, t);
}
/**
* See the documentation for GeodesicLine::Position.
**********************************************************************/
Math::real Position(real s12,
real& lat2, real& lon2, real& azi2,
real& m12, real& M12, real& M21)
const throw() {
real t;
return GenPosition(false, s12,
LATITUDE | LONGITUDE | AZIMUTH |
REDUCEDLENGTH | GEODESICSCALE,
lat2, lon2, azi2, t, m12, M12, M21, t);
}
///@}
/** \name Position in terms of arc length
**********************************************************************/
///@{
/**
* Compute the position of point 2 which is an arc length \e a12 (degrees)
* from point 1.
*
* @param[in] a12 arc length between point 1 and point 2 (degrees); it can
* be negative.
* @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::LONGITUDE.
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] s12 distance between point 1 and point 2 (meters); requires
* that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::DISTANCE.
* @param[out] m12 reduced length of geodesic (meters); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::REDUCEDLENGTH.
* @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
* that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::AREA.
*
* The values of \e lon2 and \e azi2 returned are in the range
* [−180°, 180°).
*
* Requesting a value which the GeodesicLine object is not capable of
* computing is not an error; the corresponding argument will not be
* altered.
*
* The following functions are overloaded versions of
* GeodesicLine::ArcPosition which omit some of the output parameters.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21,
real& S12) const throw() {
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
REDUCEDLENGTH | GEODESICSCALE | AREA,
lat2, lon2, azi2, s12, m12, M12, M21, S12);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2)
const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE,
lat2, lon2, t, t, t, t, t, t);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12,
real& lat2, real& lon2, real& azi2)
const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH,
lat2, lon2, azi2, t, t, t, t, t);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
real& s12) const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
lat2, lon2, azi2, s12, t, t, t, t);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
real& s12, real& m12) const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH |
DISTANCE | REDUCEDLENGTH,
lat2, lon2, azi2, s12, m12, t, t, t);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
real& s12, real& M12, real& M21)
const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH |
DISTANCE | GEODESICSCALE,
lat2, lon2, azi2, s12, t, M12, M21, t);
}
/**
* See the documentation for GeodesicLine::ArcPosition.
**********************************************************************/
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21)
const throw() {
real t;
GenPosition(true, a12,
LATITUDE | LONGITUDE | AZIMUTH |
DISTANCE | REDUCEDLENGTH | GEODESICSCALE,
lat2, lon2, azi2, s12, m12, M12, M21, t);
}
///@}
/** \name The general position function.
**********************************************************************/
///@{
/**
* The general position function. GeodesicLine::Position and
* GeodesicLine::ArcPosition are defined in terms of this function.
*
* @param[in] arcmode boolean flag determining the meaning of the second
* parameter; if arcmode is false, then the GeodesicLine object must have
* been constructed with \e caps |= GeodesicLine::DISTANCE_IN.
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
* point 1 and point 2 (meters); otherwise it is the arc length between
* point 1 and point 2 (degrees); it can be negative.
* @param[in] outmask a bitor'ed combination of GeodesicLine::mask values
* specifying which of the following parameters should be set.
* @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::LONGITUDE.
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] s12 distance between point 1 and point 2 (meters); requires
* that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::DISTANCE.
* @param[out] m12 reduced length of geodesic (meters); requires that the
* GeodesicLine object was constructed with \e caps |=
* GeodesicLine::REDUCEDLENGTH.
* @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless); requires that the GeodesicLine object was constructed
* with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
* that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::AREA.
* @return \e a12 arc length of between point 1 and point 2 (degrees).
*
* The GeodesicLine::mask values possible for \e outmask are
* - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2;
* - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2;
* - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2;
* - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12;
* - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \e
* m12;
* - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e
* M12 and \e M21;
* - \e outmask |= GeodesicLine::AREA for the area \e S12;
* - \e outmask |= GeodesicLine::ALL for all of the above.
* .
* Requesting a value which the GeodesicLine object is not capable of
* computing is not an error; the corresponding argument will not be
* altered. Note, however, that the arc length is always computed and
* returned as the function value.
**********************************************************************/
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask,
real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21,
real& S12) const throw();
///@}
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return true if the object has been initialized.
**********************************************************************/
bool Init() const throw() { return _caps != 0U; }
/**
* @return \e lat1 the latitude of point 1 (degrees).
**********************************************************************/
Math::real Latitude() const throw()
{ return Init() ? _lat1 : Math::NaN<real>(); }
/**
* @return \e lon1 the longitude of point 1 (degrees).
**********************************************************************/
Math::real Longitude() const throw()
{ return Init() ? _lon1 : Math::NaN<real>(); }
/**
* @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
**********************************************************************/
Math::real Azimuth() const throw()
{ return Init() ? _azi1 : Math::NaN<real>(); }
/**
* @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
* the equator in a northward direction.
**********************************************************************/
Math::real EquatorialAzimuth() const throw() {
return Init() ?
atan2(_salp0, _calp0) / Math::degree<real>() : Math::NaN<real>();
}
/**
* @return \e a1 the arc length (degrees) between the northward equatorial
* crossing and point 1.
**********************************************************************/
Math::real EquatorialArc() const throw() {
return Init() ?
atan2(_ssig1, _csig1) / Math::degree<real>() : Math::NaN<real>();
}
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value inherited from the Geodesic object used in the constructor.
**********************************************************************/
Math::real MajorRadius() const throw()
{ return Init() ? _a : Math::NaN<real>(); }
/**
* @return \e f the flattening of the ellipsoid. This is the value
* inherited from the Geodesic object used in the constructor.
**********************************************************************/
Math::real Flattening() const throw()
{ return Init() ? _f : Math::NaN<real>(); }
/// \cond SKIP
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
**********************************************************************/
Math::real InverseFlattening() const throw()
{ return Init() ? 1/_f : Math::NaN<real>(); }
/// \endcond
/**
* @return \e caps the computational capabilities that this object was
* constructed with. LATITUDE and AZIMUTH are always included.
**********************************************************************/
unsigned Capabilities() const throw() { return _caps; }
/**
* @param[in] testcaps a set of bitor'ed GeodesicLine::mask values.
* @return true if the GeodesicLine object has all these capabilities.
**********************************************************************/
bool Capabilities(unsigned testcaps) const throw() {
testcaps &= OUT_ALL;
return (_caps & testcaps) == testcaps;
}
///@}
};
} // namespace GeographicLib
#endif // GEOGRAPHICLIB_GEODESICLINE_HPP
| [
"rwatso12@gmail.com"
] | rwatso12@gmail.com |
60e26c5e1959f4f0a80dd6a7515a8fe8d67ff345 | 51c1fc08f8ef93666a918cb7f4e1fdf2be6ab171 | /test/cctest/test-unwinder.cc | f0383adc7e77360251086fd8a79aba9f85fb766b | [
"BSD-3-Clause",
"SunPro",
"bzip2-1.0.6"
] | permissive | howletking/v8 | 07bb5581bd29f9fb58bb826533f7459b6dd60f51 | b6815b28e3f447c4aeb9cd57b0fca6d15dedd460 | refs/heads/master | 2020-04-08T03:46:07.132774 | 2018-11-24T22:13:54 | 2018-11-24T23:08:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,827 | cc | // Copyright 2018 the V8 project 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 "include/v8.h"
#include "src/api-inl.h"
#include "src/builtins/builtins.h"
#include "src/isolate.h"
#include "src/objects/code-inl.h"
#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
namespace test_unwinder {
static void* unlimited_stack_base = std::numeric_limits<void*>::max();
TEST(Unwind_BadState_Fail) {
UnwindState unwind_state; // Fields are intialized to nullptr.
RegisterState register_state;
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
unlimited_stack_base);
CHECK(!unwound);
// The register state should not change when unwinding fails.
CHECK_NULL(register_state.fp);
CHECK_NULL(register_state.sp);
CHECK_NULL(register_state.pc);
}
TEST(Unwind_BuiltinPCInMiddle_Success) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
uintptr_t stack[3];
void* stack_base = stack + arraysize(stack);
stack[0] = reinterpret_cast<uintptr_t>(stack + 2); // saved FP (rbp).
stack[1] = 202; // Return address into C++ code.
stack[2] = 303; // The SP points here in the caller's frame.
register_state.sp = stack;
register_state.fp = stack;
// Put the current PC inside of a valid builtin.
Code builtin = i_isolate->builtins()->builtin(Builtins::kStringEqual);
const uintptr_t offset = 40;
CHECK_LT(offset, builtin->InstructionSize());
register_state.pc =
reinterpret_cast<void*>(builtin->InstructionStart() + offset);
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(unwound);
CHECK_EQ(reinterpret_cast<void*>(stack + 2), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 2), register_state.sp);
CHECK_EQ(reinterpret_cast<void*>(202), register_state.pc);
}
// The unwinder should be able to unwind even if we haven't properly set up the
// current frame, as long as there is another JS frame underneath us (i.e. as
// long as the PC isn't in the JSEntryStub). This test puts the PC at the start
// of a JS builtin and creates a fake JSEntry frame before it on the stack. The
// unwinder should be able to unwind to the C++ frame before the JSEntry frame.
TEST(Unwind_BuiltinPCAtStart_Success) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
const size_t code_length = 40;
uintptr_t code[code_length] = {0};
unwind_state.code_range.start = code;
unwind_state.code_range.length_in_bytes = code_length * sizeof(uintptr_t);
uintptr_t stack[6];
void* stack_base = stack + arraysize(stack);
stack[0] = 101;
// Return address into JS code. It doesn't matter that this is not actually in
// the JSEntryStub, because we only check that for the top frame.
stack[1] = reinterpret_cast<uintptr_t>(code + 10);
stack[2] = reinterpret_cast<uintptr_t>(stack + 5); // saved FP (rbp).
stack[3] = 303; // Return address into C++ code.
stack[4] = 404;
stack[5] = 505;
register_state.sp = stack;
register_state.fp = stack + 2; // FP to the JSEntry frame.
// Put the current PC at the start of a valid builtin, so that we are setting
// up the frame.
Code builtin = i_isolate->builtins()->builtin(Builtins::kStringEqual);
register_state.pc = reinterpret_cast<void*>(builtin->InstructionStart());
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(unwound);
CHECK_EQ(reinterpret_cast<void*>(stack + 5), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 4), register_state.sp);
CHECK_EQ(reinterpret_cast<void*>(303), register_state.pc);
}
const char* foo_source = R"(
function foo(a, b) {
let x = a * b;
let y = x ^ b;
let z = y / a;
return x + y - z;
}
foo(1, 2);
foo(1, 2);
%OptimizeFunctionOnNextCall(foo);
foo(1, 2);
)";
// Check that we can unwind when the pc is within an optimized code object on
// the V8 heap.
TEST(Unwind_CodeObjectPCInMiddle_Success) {
FLAG_allow_natives_syntax = true;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
HandleScope scope(i_isolate);
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
uintptr_t stack[3];
void* stack_base = stack + arraysize(stack);
stack[0] = reinterpret_cast<uintptr_t>(stack + 2); // saved FP (rbp).
stack[1] = 202; // Return address into C++ code.
stack[2] = 303; // The SP points here in the caller's frame.
register_state.sp = stack;
register_state.fp = stack;
// Create an on-heap code object. Make sure we run the function so that it is
// compiled and not just marked for lazy compilation.
CompileRun(foo_source);
v8::Local<v8::Function> local_foo = v8::Local<v8::Function>::Cast(
env.local()->Global()->Get(env.local(), v8_str("foo")).ToLocalChecked());
Handle<JSFunction> foo =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*local_foo));
// Put the current PC inside of the created code object.
AbstractCode* abstract_code = foo->abstract_code();
// We don't produce optimized code when run with --no-opt.
if (!abstract_code->IsCode() && FLAG_opt == false) return;
CHECK(abstract_code->IsCode());
Code code = abstract_code->GetCode();
// We don't want the offset too early or it could be the `push rbp`
// instruction (which is not at the start of generated code, because the lazy
// deopt check happens before frame setup).
const uintptr_t offset = code->InstructionSize() - 20;
CHECK_LT(offset, code->InstructionSize());
Address pc = code->InstructionStart() + offset;
register_state.pc = reinterpret_cast<void*>(pc);
// Check that the created code is within the code range that we get from the
// API.
Address start = reinterpret_cast<Address>(unwind_state.code_range.start);
CHECK(pc >= start && pc < start + unwind_state.code_range.length_in_bytes);
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(unwound);
CHECK_EQ(reinterpret_cast<void*>(stack + 2), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 2), register_state.sp);
CHECK_EQ(reinterpret_cast<void*>(202), register_state.pc);
}
// If the PC is within the JSEntryStub but we haven't set up the frame yet,
// then we cannot unwind.
TEST(Unwind_JSEntryBeforeFrame_Fail) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
const size_t code_length = 40;
uintptr_t code[code_length] = {0};
unwind_state.code_range.start = code;
unwind_state.code_range.length_in_bytes = code_length * sizeof(uintptr_t);
// Pretend that it takes 5 instructions to set up the frame in JSEntryStub.
unwind_state.js_entry_stub.code.start = code + 10;
unwind_state.js_entry_stub.code.length_in_bytes = 10 * sizeof(uintptr_t);
uintptr_t stack[10];
void* stack_base = stack + arraysize(stack);
stack[0] = 101;
stack[1] = 111;
stack[2] = 121;
stack[3] = 131;
stack[4] = 141;
stack[5] = 151;
stack[6] = 100; // Return address into C++ code.
stack[7] = 303; // The SP points here in the caller's frame.
stack[8] = 404;
stack[9] = 505;
register_state.sp = stack + 5;
register_state.fp = stack + 9;
// Put the current PC inside of the JSEntryStub, before the frame is set up.
register_state.pc = code + 12;
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(!unwound);
// The register state should not change when unwinding fails.
CHECK_EQ(reinterpret_cast<void*>(stack + 9), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 5), register_state.sp);
CHECK_EQ(code + 12, register_state.pc);
// Change the PC to a few instructions later, after the frame is set up.
register_state.pc = code + 16;
unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
// TODO(petermarshall): More precisely check position within the JSEntryStub
// rather than just assuming the frame is unreadable.
CHECK(!unwound);
// The register state should not change when unwinding fails.
CHECK_EQ(reinterpret_cast<void*>(stack + 9), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 5), register_state.sp);
CHECK_EQ(code + 16, register_state.pc);
}
TEST(Unwind_OneJSFrame_Success) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
// Use a fake code range so that we can initialize it to 0s.
const size_t code_length = 40;
uintptr_t code[code_length] = {0};
unwind_state.code_range.start = code;
unwind_state.code_range.length_in_bytes = code_length * sizeof(uintptr_t);
// Our fake stack has two frames - one C++ frame and one JS frame (on top).
// The stack grows from high addresses to low addresses.
uintptr_t stack[10];
void* stack_base = stack + arraysize(stack);
stack[0] = 101;
stack[1] = 111;
stack[2] = 121;
stack[3] = 131;
stack[4] = 141;
stack[5] = reinterpret_cast<uintptr_t>(stack + 9); // saved FP (rbp).
stack[6] = 100; // Return address into C++ code.
stack[7] = 303; // The SP points here in the caller's frame.
stack[8] = 404;
stack[9] = 505;
register_state.sp = stack;
register_state.fp = stack + 5;
// Put the current PC inside of the code range so it looks valid.
register_state.pc = code + 30;
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(unwound);
CHECK_EQ(reinterpret_cast<void*>(stack + 9), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 7), register_state.sp);
CHECK_EQ(reinterpret_cast<void*>(100), register_state.pc);
}
// Creates a fake stack with two JS frames on top of a C++ frame and checks that
// the unwinder correctly unwinds past the JS frames and returns the C++ frame's
// details.
TEST(Unwind_TwoJSFrames_Success) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
// Use a fake code range so that we can initialize it to 0s.
const size_t code_length = 40;
uintptr_t code[code_length] = {0};
unwind_state.code_range.start = code;
unwind_state.code_range.length_in_bytes = code_length * sizeof(uintptr_t);
// Our fake stack has three frames - one C++ frame and two JS frames (on top).
// The stack grows from high addresses to low addresses.
uintptr_t stack[10];
void* stack_base = stack + arraysize(stack);
stack[0] = 101;
stack[1] = 111;
stack[2] = reinterpret_cast<uintptr_t>(stack + 5); // saved FP (rbp).
// The fake return address is in the JS code range.
stack[3] = reinterpret_cast<uintptr_t>(code + 10);
stack[4] = 141;
stack[5] = reinterpret_cast<uintptr_t>(stack + 9); // saved FP (rbp).
stack[6] = 100; // Return address into C++ code.
stack[7] = 303; // The SP points here in the caller's frame.
stack[8] = 404;
stack[9] = 505;
register_state.sp = stack;
register_state.fp = stack + 2;
// Put the current PC inside of the code range so it looks valid.
register_state.pc = code + 30;
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
stack_base);
CHECK(unwound);
CHECK_EQ(reinterpret_cast<void*>(stack + 9), register_state.fp);
CHECK_EQ(reinterpret_cast<void*>(stack + 7), register_state.sp);
CHECK_EQ(reinterpret_cast<void*>(100), register_state.pc);
}
// If the PC is in the JSEntryStub then the frame might not be set up correctly,
// meaning we can't unwind the stack properly.
TEST(Unwind_JSEntryStub_Fail) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
UnwindState unwind_state = isolate->GetUnwindState();
RegisterState register_state;
Code js_entry = i_isolate->heap()->js_entry_code();
byte* start = reinterpret_cast<byte*>(js_entry->InstructionStart());
register_state.pc = start + 10;
bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state,
unlimited_stack_base);
CHECK(!unwound);
// The register state should not change when unwinding fails.
CHECK_NULL(register_state.fp);
CHECK_NULL(register_state.sp);
CHECK_EQ(start + 10, register_state.pc);
}
TEST(PCIsInV8_BadState_Fail) {
UnwindState unwind_state;
void* pc = nullptr;
CHECK(!v8::Unwinder::PCIsInV8(unwind_state, pc));
}
TEST(PCIsInV8_ValidStateNullPC_Fail) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
UnwindState unwind_state = isolate->GetUnwindState();
void* pc = nullptr;
CHECK(!v8::Unwinder::PCIsInV8(unwind_state, pc));
}
void TestRangeBoundaries(const UnwindState& unwind_state, byte* range_start,
size_t range_length) {
void* pc = range_start - 1;
CHECK(!v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = range_start;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = range_start + 1;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = range_start + range_length - 1;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = range_start + range_length;
CHECK(!v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = range_start + range_length + 1;
CHECK(!v8::Unwinder::PCIsInV8(unwind_state, pc));
}
TEST(PCIsInV8_InCodeOrEmbeddedRange) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
UnwindState unwind_state = isolate->GetUnwindState();
byte* code_range_start = const_cast<byte*>(
reinterpret_cast<const byte*>(unwind_state.code_range.start));
size_t code_range_length = unwind_state.code_range.length_in_bytes;
TestRangeBoundaries(unwind_state, code_range_start, code_range_length);
byte* embedded_range_start = const_cast<byte*>(
reinterpret_cast<const byte*>(unwind_state.embedded_code_range.start));
size_t embedded_range_length =
unwind_state.embedded_code_range.length_in_bytes;
TestRangeBoundaries(unwind_state, embedded_range_start,
embedded_range_length);
}
// PCIsInV8 doesn't check if the PC is in the JSEntryStub directly. It's assumed
// that the CodeRange or EmbeddedCodeRange contain the JSEntryStub.
TEST(PCIsInV8_InJSEntryStubRange) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
UnwindState unwind_state = isolate->GetUnwindState();
Code js_entry = i_isolate->heap()->js_entry_code();
byte* start = reinterpret_cast<byte*>(js_entry->InstructionStart());
size_t length = js_entry->InstructionSize();
void* pc = start;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = start + 1;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
pc = start + length - 1;
CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc));
}
} // namespace test_unwinder
} // namespace internal
} // namespace v8
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
20a009d8866ec595d48f7cc0b9731752bf7e3045 | 87587cc326aa2640516c6987e7d7b93c992a4bb4 | /src/qt/obfuscationconfig.h | 334f71e3344f640abbc5bf17aaef5d9cd0cce538 | [
"MIT"
] | permissive | SMRT2/smrt-test | f26164f6b71546d5be3ce29846de02c3b82e3e22 | 017d06ee44e00d627a14626c7fc674a2a2e7041a | refs/heads/master | 2020-03-20T21:29:56.083870 | 2018-06-18T12:09:00 | 2018-06-18T12:09:00 | 137,744,088 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 904 | h | // Copyright (c) 2014-2016 The Dash Developers
// Copyright (c) 2016-2017 The SMRT developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef OBFUSCATIONCONFIG_H
#define OBFUSCATIONCONFIG_H
#include <QDialog>
namespace Ui
{
class ObfuscationConfig;
}
class WalletModel;
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
*/
class ObfuscationConfig : public QDialog
{
Q_OBJECT
public:
ObfuscationConfig(QWidget* parent = 0);
~ObfuscationConfig();
void setModel(WalletModel* model);
private:
Ui::ObfuscationConfig* ui;
WalletModel* model;
void configure(bool enabled, int coins, int rounds);
private slots:
void clickBasic();
void clickHigh();
void clickMax();
};
#endif // OBFUSCATIONCONFIG_H
| [
"james_nirvana@gmx.com"
] | james_nirvana@gmx.com |
4a3e8a30deb4cd1df4a3bff3457a87f437109f3c | d2daef1081ce1ac5601be8d1957da8df70fed1db | /tests/parse_uri.cpp | ca295fa4784df5b98168542b3291177653e83cf9 | [
"BSL-1.0"
] | permissive | bradenmcd/uri-grammar | d2c75f471bac8187cbbfe69e79b89c984a6d6f65 | acbe70491750a636ff34b5fce3579880d7635d3a | refs/heads/master | 2016-09-10T11:47:48.451978 | 2015-03-02T06:10:18 | 2015-03-02T06:13:16 | 31,246,489 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 3,101 | cpp | // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
//
// Copyright 2009, 2010 Braden McDaniel
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file COPYING or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
# include <uri/grammar.hpp>
# include <boost/program_options.hpp>
# include <iostream>
int main(int argc, char * argv[])
{
using namespace boost::spirit;
using namespace boost::program_options;
using namespace std;
try {
options_description visible_opts("Allowed options");
visible_opts.add_options()
("help", "Print help message")
("scheme", "Print the scheme")
("userinfo", "Print the user information")
("host", "Print the host")
("port", "Print the port")
("path", "Print the path")
("query", "Print the query")
("fragment", "Print the fragment");
options_description hidden_opts("Hidden options");
hidden_opts.add_options()
("uri", value<string>(), "URI");
options_description all_opts;
all_opts.add(visible_opts).add(hidden_opts);
positional_options_description pos_desc;
pos_desc.add("uri", 1);
variables_map option_map;
store(
command_line_parser(argc, argv)
.options(all_opts)
.positional(pos_desc).run(),
option_map);
notify(option_map);
if (option_map.count("help")) {
cout << "Usage: parse-uri [options] URI\n"
<< visible_opts;
return EXIT_SUCCESS;
}
if (!option_map.count("uri")) {
cerr << argv[0] << ": required URI argument not given" << endl;
return EXIT_FAILURE;
}
uri::components<string::const_iterator> c;
uri::grammar<string::const_iterator> g(c);
const string & uri = option_map["uri"].as<string>();
string::const_iterator pos = uri.begin();
if (!parse(pos, uri.end(), g)) { return EXIT_FAILURE; }
if (option_map.count("scheme")) {
cout << string(c.scheme.begin(), c.scheme.end()) << endl;
}
if (option_map.count("userinfo")) {
cout << string(c.userinfo.begin(), c.userinfo.end()) << endl;
}
if (option_map.count("host")) {
cout << string(c.host.begin(), c.host.end()) << endl;
}
if (option_map.count("port")) {
cout << string(c.port.begin(), c.port.end()) << endl;
}
if (option_map.count("path")) {
cout << string(c.path.begin(), c.path.end()) << endl;
}
if (option_map.count("query")) {
cout << string(c.query.begin(), c.query.end()) << endl;
}
if (option_map.count("fragment")) {
cout << string(c.fragment.begin(), c.fragment.end()) << endl;
}
} catch (const exception & ex) {
cerr << "error: " << ex.what() << endl;
return EXIT_FAILURE;
}
}
| [
"braden@endoframe.com"
] | braden@endoframe.com |
9313bce8b1537187d683c16542832fe406dc51f4 | 1a138231a06f9e12f5d91002f908a568718465bb | /stsl_gazebo_plugins/src/RosLightControlPlugin.cpp | 72be210e7d7b368195d36358a9fba742941557de | [] | no_license | RoboJackets/stsl | 492c66cf4f904e265f1ca44109819133d21bce7f | c240cb62fc1ac3acf69580caf9e16c3d5ebc960d | refs/heads/main | 2022-09-15T11:19:45.431451 | 2022-09-01T06:12:33 | 2022-09-01T06:12:33 | 97,505,389 | 5 | 11 | null | 2022-08-29T04:19:30 | 2017-07-17T17:47:13 | C++ | UTF-8 | C++ | false | false | 7,447 | cpp | // Copyright 2021 RoboJackets
//
// 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 <functional>
#include <string>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo_ros/node.hpp>
#include <gazebo/transport/transport.hh>
#include <ignition/math/Vector3.hh>
#include <rclcpp/rclcpp.hpp>
#include <std_msgs/msg/bool.hpp>
namespace stsl_gazebo_plugins
{
gazebo::physics::LinkPtr findLinkForLight(
const gazebo::physics::ModelPtr & model,
const std::string & light_name,
const std::string & link_name)
{
auto child_link = model->GetChildLink(link_name);
if (child_link && child_link->GetSDF()->HasElement("light")) {
auto sdf_light = child_link->GetSDF()->GetElement("light");
while (sdf_light) {
if (sdf_light->Get<std::string>("name") == light_name) {
return child_link;
}
sdf_light = sdf_light->GetNextElement("light");
}
}
for (auto nested_model : model->NestedModels()) {
auto found_link = findLinkForLight(nested_model, light_name, link_name);
if (found_link) {
return found_link;
}
}
return nullptr;
}
double getLightRange(const gazebo::physics::LinkPtr & link, const std::string & light_name)
{
if (!link->GetSDF()->HasElement("light")) {
gzerr << "Link has no <light> element!" << std::endl;
return 0.0;
}
auto sdf_light = link->GetSDF()->GetElement("light");
while (sdf_light) {
if (sdf_light->Get<std::string>("name") == light_name) {
return sdf_light->GetElement("attenuation")->Get<double>("range");
}
sdf_light = sdf_light->GetNextElement("light");
}
gzerr << "Link has no <light> element with name " << light_name << std::endl;
return 0.0;
}
gazebo::msgs::Visual getVisualProperties(
const gazebo::physics::LinkPtr & link,
const std::string & name)
{
gazebo::msgs::Link link_msg;
link->FillMsg(link_msg);
const auto & visuals = link_msg.visual();
const auto expected_visual_name = link->GetScopedName() + "::" + name;
auto found_iter =
std::find_if(
visuals.begin(), visuals.end(), [&expected_visual_name](const auto & visual) {
return visual.name() == expected_visual_name;
});
if (found_iter == visuals.end()) {
gzerr << "Could not find visual named " << name << std::endl;
return {};
}
return *found_iter;
}
class RosLightControlPlugin : public gazebo::ModelPlugin
{
public:
void Load(gazebo::physics::ModelPtr parent, sdf::ElementPtr sdf) override
{
if (!sdf->HasElement("light_id")) {
gzerr << "Parameter <light_id> is missing." << std::endl;
}
if (!sdf->HasElement("visual_name")) {
gzerr << "Parameter <visual_name> is missing." << std::endl;
}
const auto light_id = sdf->Get<std::string>("light_id");
const auto visual_name = sdf->Get<std::string>("visual_name");
const int sep_pos = light_id.rfind("/");
const auto light_name = light_id.substr(sep_pos + 1);
const auto link_name = light_id.substr(0, sep_pos);
const auto link = findLinkForLight(parent, light_name, link_name);
const auto visual_props = getVisualProperties(link, visual_name);
light_on_range_ = getLightRange(link, light_name);
light_off_transparency_ = visual_props.transparency();
light_on_emissive_color_ = gazebo::msgs::Convert(visual_props.material().emissive());
gazebo_node_ = boost::make_shared<gazebo::transport::Node>();
gazebo_node_->Init();
light_publisher_ = gazebo_node_->Advertise<gazebo::msgs::Light>("~/light/modify");
light_publisher_->WaitForConnection();
light_msg_.set_name(link->GetScopedName() + "::" + light_name);
visual_publisher_ = gazebo_node_->Advertise<gazebo::msgs::Visual>("~/visual");
visual_msg_.set_name(link->GetScopedName() + "::" + visual_name);
visual_msg_.set_parent_name(link->GetScopedName());
uint32_t visual_id;
link->VisualId(visual_name, visual_id);
visual_msg_.set_id(visual_id);
ros_node_ = gazebo_ros::Node::Get(sdf);
light_command_sub_ = ros_node_->create_subscription<std_msgs::msg::Bool>(
"/light_control/" + light_name, 1,
std::bind(&RosLightControlPlugin::onCommandMsg, this, std::placeholders::_1));
update_connection_ = gazebo::event::Events::ConnectWorldUpdateBegin(
std::bind(&RosLightControlPlugin::OnUpdate, this));
}
void OnUpdate()
{
std::lock_guard<std::mutex> lock(state_mutex_);
if (!commanded_state_changed_) {
return;
}
if (commanded_light_state_) {
turnLightOn();
} else {
turnLightOff();
}
commanded_state_changed_ = false;
}
private:
gazebo::event::ConnectionPtr update_connection_;
gazebo::transport::NodePtr gazebo_node_;
gazebo::transport::PublisherPtr light_publisher_;
gazebo::transport::PublisherPtr visual_publisher_;
gazebo::msgs::Light light_msg_;
gazebo::msgs::Visual visual_msg_;
gazebo_ros::Node::SharedPtr ros_node_;
rclcpp::Subscription<std_msgs::msg::Bool>::SharedPtr light_command_sub_;
std::mutex state_mutex_;
bool commanded_light_state_{false};
bool commanded_state_changed_{true};
double light_on_range_{0.0};
ignition::math::Color light_on_emissive_color_;
double light_off_transparency_{0.2};
void onCommandMsg(const std_msgs::msg::Bool::SharedPtr msg)
{
std::lock_guard<std::mutex> lock(state_mutex_);
commanded_state_changed_ = commanded_light_state_ != msg->data;
commanded_light_state_ = msg->data;
}
void turnLightOn()
{
light_msg_.set_range(light_on_range_);
light_publisher_->Publish(light_msg_);
visual_msg_.set_transparency(0.0);
gazebo::msgs::Set(
visual_msg_.mutable_material()->mutable_emissive(),
light_on_emissive_color_);
gazebo::msgs::Set(
visual_msg_.mutable_material()->mutable_diffuse(),
light_on_emissive_color_);
visual_publisher_->Publish(visual_msg_);
}
void turnLightOff()
{
light_msg_.set_range(0.0);
light_publisher_->Publish(light_msg_);
visual_msg_.set_transparency(light_off_transparency_);
gazebo::msgs::Set(
visual_msg_.mutable_material()->mutable_emissive(),
ignition::math::Color(0, 0, 0));
gazebo::msgs::Set(
visual_msg_.mutable_material()->mutable_diffuse(),
ignition::math::Color(0, 0, 0));
visual_publisher_->Publish(visual_msg_);
}
};
GZ_REGISTER_MODEL_PLUGIN(RosLightControlPlugin)
} // namespace stsl_gazebo_plugins
| [
"matthew.barulic@gmail.com"
] | matthew.barulic@gmail.com |
c6ae6498ff730871c069c82b3b83c43b6eff3d92 | b7de71b9f743721fb8b53a63fc421a7e19343ca5 | /itt-1500send.cpp | 9adcf0d5af78db427c19f29a22392462820c13be | [] | no_license | marcol123/itt-1500-remote | e0073d04cb594f08f65421863addad66f3783006 | 57b2b3df9f4a9696ffdea7138bd1607ca60fd271 | refs/heads/master | 2021-01-19T05:19:03.226461 | 2017-08-17T08:29:10 | 2017-08-17T08:29:10 | 100,577,153 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,281 | cpp | /*
Usage: ./codesend address unit state [pin] [repeats] [periodusec]
* @param address Address of this transmitter [0..2^26-1] Duplicate the address of your hardware, or choose a random number.
* @param unit [0..2] Number of transmitter button
* @param state 1=On | 2=Off
* @param pin Output pin on RaspberryPi to which the transmitter is connected
* @param repeats [0..8] The 2log-Number of times the signal is repeated. The actual number of repeats will be 2^repeats. 2 would be bare minimum, 4 seems robust, 8 is maximum (and overkill).
* @param periodusec Duration of one period, in microseconds. One bit takes 8 periods (but only 4 for 'dim' signal).
*/
#include "itt-1500lib.h"
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
// Getting default values
int address = 0;
int unit = 0;
int state = 0;
int pin = 0;
int repeats = 3;
int periodusec = 260;
// If no command line argument is given, print the help text
if (argc <= 4) {
printf("Usage: %s address state [pin] [repeats] [periodusec]\n", argv[0]);
printf("address\t- Address of the transmitter [0..2^26-1]\n");
printf("state\t- 1=On | 2=Off\n");
printf("pin\t- Output pin on RaspberryPi to which the transmitter is connected\n");
printf("repeats\t- [0..8] The 2log-Number of times the signal is repeated. The actual number of repeats will be 2^repeats. 2 would be bare minimum, 4 seems robust, 8 is maximum (and overkill).\n");
printf("periodusec\t- Duration of one period, in microseconds. One bit takes 8 periods\n");
return -1;
}
// Change protocol and pulse length accroding to parameters
int address = atoi(argv[1]);
int unit = atoi(argv[2]);
int state = atoi(argv[3]);
if (argc >= 5) pin = atoi(argv[4]);
if (argc >= 6) repeats = atoi(argv[5]);
if (argc >= 7) periodusec = atoi(argv[6]);
if (state == 0) bool switchstate = false;
if (state == 1) bool switchstate = true;
if (wiringPiSetup () == -1) return 1;
printf("sending code[%i]\n", code);
NewRemoteTransmitter transmitter(address, pin, peridusec, repeats);
transmitter.sendUnit(unit, switchstate);
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
5f1a44814198d970841b8398f5973fc1c53d4575 | 9f65b341f176aead0aa6f3de881db793ced46a9d | /cpp/QBGAME.cpp | bb8ee5cbbf03cd0bc1cabc73a12bd981dd309c68 | [] | no_license | itsjustwinds/study-path | 2e66c0d85a431983e60ffde126131cb3dd8e865b | 5bfd3cc1c4d3f0b20c2bbc852f43dfbf3d726507 | refs/heads/master | 2020-05-30T07:51:30.320218 | 2020-04-05T11:29:02 | 2020-04-05T11:29:02 | 189,585,900 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,997 | cpp | #include<bits/stdc++.h>
#define maxn 10005
#define ll long long
using namespace std;
int n,a[10][maxn],M;
vector<int > e;
ll f[maxn][300];
int getbit(int n,int i)
{
return (n>>(i-1))&1;
}
ll getval(int i,int sk)
{
ll res=0;
for (int j=1; j<=8; ++j)
{
int k=getbit(sk,j);
if (k) res+=a[j][i];
}
return res;
}
int main()
{
freopen("QBGAME.inp","r",stdin);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
int maxx=-1e9;
for (int i=1; i<=8; ++i)
for (int j=1; j<=n; ++j)
{
cin>>a[i][j];
maxx=max(maxx,a[i][j]);
}
if (maxx<0)
{
cout<<maxx;
return 0;
}
M=(1<<8)-1;
for (int i=0; i<=M; ++i)
{
if ((i&(i>>1))==0) e.push_back(i);
}
for(int i=0; i<=n; ++i)
for (int j=0; j<e.size(); ++j)
{
int x=e[j];
f[i][x]=-1e18;
}
f[0][0]=0;
for (int i=1; i<=n; ++i)
{
for (int j=0; j<e.size(); ++j)
{
int s1=e[j];
int ll sum=getval(i,s1);
for (int k=0; k<e.size(); ++k)
{
int s2=e[k];
if ((s1&s2)!=0) continue;
f[i][s1]=max(f[i][s1],f[i-1][s2]+sum);
}
}
}
ll res=-1e18;
for (int j=1; j<=n; ++j)
for (int i=0; i<e.size(); ++i)
{
int s=e[i];
res=max(res,f[j][s]);
}
cout<<res;
}
| [
"hminhhuy2000@gmail.com"
] | hminhhuy2000@gmail.com |
a86f426b4774c4223287367e19c7289f9a5c7b5b | 0611b1cc08b15d329057595365359947c20fcd59 | /tt/L3-002 特殊堆栈.cpp | f42124416b289c29a83725598747349543ab5540 | [] | no_license | Lan-ce-lot/overflow | c9a7167edaeeaa1f9f1e92624726b1d964289798 | ae76120e328a5a2991eb6ef7f1ae5e279374e15c | refs/heads/master | 2023-04-08T04:24:49.614146 | 2021-04-25T05:33:06 | 2021-04-25T05:33:06 | 279,082,035 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,863 | cpp | /*************************************************************************
> FileName:
> Author: Lance
> Mail: lancelot_hcs@qq.com
> Date: 9102.1.8
> Description:
************************************************************************/
//#include <bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000,102400000")//add_stack
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <vector>
#include <cstdio>
#include <bitset>
#include <string>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9 + 7;
#define debug(a) cout << "*" << a << "*" << endl
const int INF = 0x3f3f3f3f;//int2147483647//ll9e18//unsigned ll 1e19
const int maxn = 1000005;
//sacnf("%lf") printf("%f")
ll read()
{
ll x = 0,f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
int t, n, a;
map<string, int> M{{"Pop", 1}, {"PeekMedian", 2}, {"Push", 3}};
int l = 0, r = 0, h[maxn];
set<int> S;
void solve()
{
cin >> n;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
if (s == "Pop") {
if (r == 0) {
puts("Invalid");
} else {
r--;
S.erase(h[r]);
cout << h[r] << endl;
}
} else if (s == "Push"){
cin >> a;
h[r++] = a;
S.insert(a);
// cout << a << endl;
} else {
if (r == 0) {
puts("Invalid");
} else {
cout << h[(r + !(r & 1)) / 2] << endl;
}
}
}
}
int main()
{
// freopen("F:/Overflow/in.txt","r",stdin);
// ios::sync_with_stdio(false);
solve();
return 0;
}
| [
"1984737645@qq.com"
] | 1984737645@qq.com |
f7f3bce25915bcab1a7e9a4259a8deb6e38b0e18 | 9da899bf6541c6a0514219377fea97df9907f0ae | /Runtime/Engine/Private/Animation/AnimationUtils.cpp | de3dd3607a6b3862686935148389cacae88a5457 | [] | no_license | peichangliang123/UE4 | 1aa4df3418c077dd8f82439ecc808cd2e6de4551 | 20e38f42edc251ee96905ed8e96e1be667bc14a5 | refs/heads/master | 2023-08-17T11:31:53.304431 | 2021-09-15T00:31:03 | 2021-09-15T00:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 41,010 | cpp | // Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
AnimationUtils.cpp: Skeletal mesh animation utilities.
=============================================================================*/
#include "AnimationUtils.h"
#include "Misc/ConfigCacheIni.h"
#include "UObject/Package.h"
#include "AnimationRuntime.h"
#include "Animation/AnimSet.h"
#include "Animation/AnimationSettings.h"
#include "Animation/AnimBoneCompressionCodec.h"
#include "Animation/AnimBoneCompressionSettings.h"
#include "Animation/AnimCurveCompressionSettings.h"
#include "AnimationCompression.h"
#include "Engine/SkeletalMeshSocket.h"
#include "AnimEncoding.h"
#include "UObject/LinkerLoad.h"
/** Array to keep track of SkeletalMeshes we have built metadata for, and log out the results just once. */
//static TArray<USkeleton*> UniqueSkeletonsMetadataArray;
void FAnimationUtils::BuildSkeletonMetaData(USkeleton* Skeleton, TArray<FBoneData>& OutBoneData)
{
// Disable logging by default. Except if we deal with a new Skeleton. Then we log out its details. (just once).
bool bEnableLogging = false;
// Uncomment to enable.
// if( UniqueSkeletonsMetadataArray.FindItemIndex(Skeleton) == INDEX_NONE )
// {
// bEnableLogging = true;
// UniqueSkeletonsMetadataArray.AddItem(Skeleton);
// }
const FReferenceSkeleton& RefSkeleton = Skeleton->GetReferenceSkeleton();
const TArray<FTransform> & SkeletonRefPose = Skeleton->GetRefLocalPoses();
const int32 NumBones = RefSkeleton.GetNum();
// Assemble bone data.
OutBoneData.Empty();
OutBoneData.AddZeroed( NumBones );
const TArray<FString>& KeyEndEffectorsMatchNameArray = UAnimationSettings::Get()->KeyEndEffectorsMatchNameArray;
for (int32 BoneIndex = 0 ; BoneIndex<NumBones; ++BoneIndex )
{
FBoneData& BoneData = OutBoneData[BoneIndex];
// Copy over data from the skeleton.
const FTransform& SrcTransform = SkeletonRefPose[BoneIndex];
ensure(!SrcTransform.ContainsNaN());
ensure(SrcTransform.IsRotationNormalized());
BoneData.Orientation = SrcTransform.GetRotation();
BoneData.Position = SrcTransform.GetTranslation();
BoneData.Name = RefSkeleton.GetBoneName(BoneIndex);
if ( BoneIndex > 0 )
{
// Compute ancestry.
int32 ParentIndex = RefSkeleton.GetParentIndex(BoneIndex);
BoneData.BonesToRoot.Add( ParentIndex );
while ( ParentIndex > 0 )
{
ParentIndex = RefSkeleton.GetParentIndex(ParentIndex);
BoneData.BonesToRoot.Add( ParentIndex );
}
}
// See if a Socket is attached to that bone
BoneData.bHasSocket = false;
// @todo anim: socket isn't moved to Skeleton yet, but this code needs better testing
for(int32 SocketIndex=0; SocketIndex<Skeleton->Sockets.Num(); SocketIndex++)
{
USkeletalMeshSocket* Socket = Skeleton->Sockets[SocketIndex];
if( Socket && Socket->BoneName == RefSkeleton.GetBoneName(BoneIndex) )
{
BoneData.bHasSocket = true;
break;
}
}
}
// Enumerate children (bones that refer to this bone as parent).
for ( int32 BoneIndex = 0 ; BoneIndex < OutBoneData.Num() ; ++BoneIndex )
{
FBoneData& BoneData = OutBoneData[BoneIndex];
// Exclude the root bone as it is the child of nothing.
for ( int32 BoneIndex2 = 1 ; BoneIndex2 < OutBoneData.Num() ; ++BoneIndex2 )
{
if ( OutBoneData[BoneIndex2].GetParent() == BoneIndex )
{
BoneData.Children.Add(BoneIndex2);
}
}
}
// Enumerate end effectors. For each end effector, propagate its index up to all ancestors.
if( bEnableLogging )
{
UE_LOG(LogAnimationCompression, Log, TEXT("Enumerate End Effectors for %s"), *Skeleton->GetFName().ToString());
}
for ( int32 BoneIndex = 0 ; BoneIndex < OutBoneData.Num() ; ++BoneIndex )
{
FBoneData& BoneData = OutBoneData[BoneIndex];
if ( BoneData.IsEndEffector() )
{
// End effectors have themselves as an ancestor.
BoneData.EndEffectors.Add( BoneIndex );
// Add the end effector to the list of end effectors of all ancestors.
for ( int32 i = 0 ; i < BoneData.BonesToRoot.Num() ; ++i )
{
const int32 AncestorIndex = BoneData.BonesToRoot[i];
OutBoneData[AncestorIndex].EndEffectors.Add( BoneIndex );
}
for(int32 MatchIndex=0; MatchIndex<KeyEndEffectorsMatchNameArray.Num(); MatchIndex++)
{
// See if this bone has been defined as a 'key' end effector
FString BoneString(BoneData.Name.ToString());
if( BoneString.Contains(KeyEndEffectorsMatchNameArray[MatchIndex]) )
{
BoneData.bKeyEndEffector = true;
break;
}
}
if( bEnableLogging )
{
UE_LOG(LogAnimationCompression, Log, TEXT("\t %s bKeyEndEffector: %d"), *BoneData.Name.ToString(), BoneData.bKeyEndEffector);
}
}
}
#if 0
UE_LOG(LogAnimationCompression, Log, TEXT("====END EFFECTORS:") );
int32 NumEndEffectors = 0;
for ( int32 BoneIndex = 0 ; BoneIndex < OutBoneData.Num() ; ++BoneIndex )
{
const FBoneData& BoneData = OutBoneData(BoneIndex);
if ( BoneData.IsEndEffector() )
{
FString Message( FString::Printf(TEXT("%s(%i): "), *BoneData.Name, BoneData.GetDepth()) );
for ( int32 i = 0 ; i < BoneData.BonesToRoot.Num() ; ++i )
{
const int32 AncestorIndex = BoneData.BonesToRoot(i);
Message += FString::Printf( TEXT("%s "), *OutBoneData(AncestorIndex).Name );
}
UE_LOG(LogAnimation, Log, *Message );
++NumEndEffectors;
}
}
UE_LOG(LogAnimationCompression, Log, TEXT("====NUM EFFECTORS %i(%i)"), NumEndEffectors, OutBoneData(0).Children.Num() );
UE_LOG(LogAnimationCompression, Log, TEXT("====NON END EFFECTORS:") );
for ( int32 BoneIndex = 0 ; BoneIndex < OutBoneData.Num() ; ++BoneIndex )
{
const FBoneData& BoneData = OutBoneData(BoneIndex);
if ( !BoneData.IsEndEffector() )
{
FString Message( FString::Printf(TEXT("%s(%i): "), *BoneData.Name, BoneData.GetDepth()) );
Message += TEXT("Children: ");
for ( int32 i = 0 ; i < BoneData.Children.Num() ; ++i )
{
const int32 ChildIndex = BoneData.Children(i);
Message += FString::Printf( TEXT("%s "), *OutBoneData(ChildIndex).Name );
}
Message += TEXT(" EndEffectors: ");
for ( int32 i = 0 ; i < BoneData.EndEffectors.Num() ; ++i )
{
const int32 EndEffectorIndex = BoneData.EndEffectors(i);
Message += FString::Printf( TEXT("%s "), *OutBoneData(EndEffectorIndex).Name );
check( OutBoneData(EndEffectorIndex).IsEndEffector() );
}
UE_LOG(LogAnimationCompression, Log, *Message );
}
}
UE_LOG(LogAnimationCompression, Log, TEXT("===================") );
#endif
}
/**
* Builds the local-to-component matrix for the specified bone.
*/
void FAnimationUtils::BuildComponentSpaceTransform(FTransform& OutTransform,
int32 BoneIndex,
const TArray<FTransform>& BoneSpaceTransforms,
const TArray<FBoneData>& BoneData)
{
// Put root-to-component in OutTransform.
OutTransform = BoneSpaceTransforms[0];
if (BoneIndex > 0)
{
const FBoneData& Bone = BoneData[BoneIndex];
checkSlow((Bone.BonesToRoot.Num() - 1) == 0);
// Compose BoneData.BonesToRoot down.
for (int32 i = Bone.BonesToRoot.Num()-2; i >=0; --i)
{
const int32 AncestorIndex = Bone.BonesToRoot[i];
ensure(AncestorIndex != INDEX_NONE);
OutTransform = BoneSpaceTransforms[AncestorIndex] * OutTransform;
OutTransform.NormalizeRotation();
}
// Finally, include the bone's local-to-parent.
OutTransform = BoneSpaceTransforms[BoneIndex] * OutTransform;
OutTransform.NormalizeRotation();
}
}
int32 FAnimationUtils::GetAnimTrackIndexForSkeletonBone(const int32 InSkeletonBoneIndex, const TArray<FTrackToSkeletonMap>& TrackToSkelMap)
{
return TrackToSkelMap.IndexOfByPredicate([&](const FTrackToSkeletonMap& TrackToSkel)
{
return TrackToSkel.BoneTreeIndex == InSkeletonBoneIndex;
});
}
#if WITH_EDITOR
/**
* Utility function to measure the accuracy of a compressed animation. Each end-effector is checked for
* world-space movement as a result of compression.
*
* @param AnimSet The animset to calculate compression error for.
* @param BoneData BoneData array describing the hierarchy of the animated skeleton
* @param ErrorStats Output structure containing the final compression error values
* @return None.
*/
void FAnimationUtils::ComputeCompressionError(const FCompressibleAnimData& CompressibleAnimData, FCompressibleAnimDataResult& CompressedData, AnimationErrorStats& ErrorStats)
{
ErrorStats.AverageError = 0.0f;
ErrorStats.MaxError = 0.0f;
ErrorStats.MaxErrorBone = 0;
ErrorStats.MaxErrorTime = 0.0f;
int32 MaxErrorTrack = -1;
if (CompressedData.AnimData != nullptr && CompressedData.AnimData->CompressedNumberOfKeys > 0)
{
const bool bCanUseCompressedData = CompressedData.AnimData->IsValid();
if (!bCanUseCompressedData)
{
// If we can't use CompressedData, there's not much point in being here.
return;
}
const int32 NumBones = CompressibleAnimData.BoneData.Num();
float ErrorCount = 0.0f;
float ErrorTotal = 0.0f;
const TArray<FTransform>& RefPose = CompressibleAnimData.RefLocalPoses;
TArray<FTransform> RawTransforms;
TArray<FTransform> NewTransforms;
RawTransforms.AddZeroed(NumBones);
NewTransforms.AddZeroed(NumBones);
// Cache these to speed up animations with a lot of frames.
// We do this only once, instead of every frame.
struct FCachedBoneIndexData
{
int32 TrackIndex;
int32 ParentIndex;
};
TArray<FCachedBoneIndexData> CachedBoneIndexData;
CachedBoneIndexData.AddZeroed(NumBones);
for (int32 BoneIndex = 0; BoneIndex < NumBones; ++BoneIndex)
{
FCachedBoneIndexData& BoneIndexData = CachedBoneIndexData[BoneIndex];
BoneIndexData.TrackIndex = GetAnimTrackIndexForSkeletonBone(BoneIndex, CompressibleAnimData.TrackToSkeletonMapTable);
BoneIndexData.ParentIndex = CompressibleAnimData.RefSkeleton.GetParentIndex(BoneIndex);
}
// Check the precondition that parents occur before children in the RequiredBones array.
for (int32 BoneIndex = 1; BoneIndex < NumBones; ++BoneIndex)
{
const FCachedBoneIndexData& BoneIndexData = CachedBoneIndexData[BoneIndex];
check(BoneIndexData.ParentIndex != INDEX_NONE);
check(BoneIndexData.ParentIndex < BoneIndex);
}
const FTransform EndEffectorDummyBoneSocket(FQuat::Identity, FVector(END_EFFECTOR_DUMMY_BONE_LENGTH_SOCKET));
const FTransform EndEffectorDummyBone(FQuat::Identity, FVector(END_EFFECTOR_DUMMY_BONE_LENGTH));
const FAnimKeyHelper Helper(CompressibleAnimData.SequenceLength, CompressedData.AnimData->CompressedNumberOfKeys);
const float KeyLength = Helper.TimePerKey() + SMALL_NUMBER;
FAnimSequenceDecompressionContext DecompContext(CompressibleAnimData.SequenceLength, CompressibleAnimData.Interpolation, CompressibleAnimData.AnimFName, *CompressedData.AnimData);
const TArray<FBoneData>& BoneData = CompressibleAnimData.BoneData;
for (int32 KeyIndex = 0; KeyIndex< CompressedData.AnimData->CompressedNumberOfKeys; KeyIndex++)
{
const float Time = (float)KeyIndex * KeyLength;
DecompContext.Seek(Time);
// get the raw and compressed atom for each bone
for (int32 BoneIndex = 0; BoneIndex < NumBones; ++BoneIndex)
{
const FCachedBoneIndexData& BoneIndexData = CachedBoneIndexData[BoneIndex];
if (BoneIndexData.TrackIndex == INDEX_NONE)
{
// No track for the bone was found, use default transform
const FTransform& RefPoseTransform = RefPose[BoneIndex];
RawTransforms[BoneIndex] = RefPoseTransform;
NewTransforms[BoneIndex] = RefPoseTransform;
}
else
{
// If we have transforms, but they're additive, apply them to the ref pose.
// This is because additive animations are mostly rotation.
// And for the error metric we measure distance between end effectors.
// So that means additive animations by default will all be balled up at the origin and not show any error.
if (CompressibleAnimData.bIsValidAdditive)
{
const FTransform& RefPoseTransform = RefPose[BoneIndex];
RawTransforms[BoneIndex] = RefPoseTransform;
NewTransforms[BoneIndex] = RefPoseTransform;
FTransform AdditiveRawTransform;
FTransform AdditiveNewTransform;
FAnimationUtils::ExtractTransformFromTrack(Time, CompressibleAnimData.NumberOfKeys, CompressibleAnimData.SequenceLength, CompressibleAnimData.RawAnimationData[BoneIndexData.TrackIndex], CompressibleAnimData.Interpolation, AdditiveRawTransform);
CompressedData.Codec->DecompressBone(DecompContext, BoneIndexData.TrackIndex, AdditiveNewTransform);
const ScalarRegister VBlendWeight(1.f);
RawTransforms[BoneIndex].AccumulateWithAdditiveScale(AdditiveRawTransform, VBlendWeight);
NewTransforms[BoneIndex].AccumulateWithAdditiveScale(AdditiveNewTransform, VBlendWeight);
}
else
{
FAnimationUtils::ExtractTransformFromTrack(Time, CompressibleAnimData.NumberOfKeys, CompressibleAnimData.SequenceLength, CompressibleAnimData.RawAnimationData[BoneIndexData.TrackIndex], CompressibleAnimData.Interpolation, RawTransforms[BoneIndex]);
CompressedData.Codec->DecompressBone(DecompContext, BoneIndexData.TrackIndex, NewTransforms[BoneIndex]);
}
}
ensure(!RawTransforms[BoneIndex].ContainsNaN());
ensure(!NewTransforms[BoneIndex].ContainsNaN());
// For all bones below the root, final component-space transform is relative transform * component-space transform of parent.
if (BoneIndex > 0)
{
RawTransforms[BoneIndex] *= RawTransforms[BoneIndexData.ParentIndex];
NewTransforms[BoneIndex] *= NewTransforms[BoneIndexData.ParentIndex];
}
// If this is an EndEffector, add a dummy bone to measure the effect of compressing the rotation.
if (BoneData[BoneIndex].IsEndEffector())
{
// Sockets and Key EndEffectors have a longer dummy bone to maintain higher precision.
if (BoneData[BoneIndex].bHasSocket || BoneData[BoneIndex].bKeyEndEffector)
{
RawTransforms[BoneIndex] = EndEffectorDummyBoneSocket * RawTransforms[BoneIndex];
NewTransforms[BoneIndex] = EndEffectorDummyBoneSocket * NewTransforms[BoneIndex];
}
else
{
RawTransforms[BoneIndex] = EndEffectorDummyBone * RawTransforms[BoneIndex];
NewTransforms[BoneIndex] = EndEffectorDummyBone * NewTransforms[BoneIndex];
}
}
// Normalize rotations
RawTransforms[BoneIndex].NormalizeRotation();
NewTransforms[BoneIndex].NormalizeRotation();
if (BoneData[BoneIndex].IsEndEffector())
{
float Error = (RawTransforms[BoneIndex].GetLocation() - NewTransforms[BoneIndex].GetLocation()).Size();
ErrorTotal += Error;
ErrorCount += 1.0f;
if (Error > ErrorStats.MaxError)
{
ErrorStats.MaxError = Error;
ErrorStats.MaxErrorBone = BoneIndex;
MaxErrorTrack = BoneIndexData.TrackIndex;
ErrorStats.MaxErrorTime = Time;
}
}
}
}
if (ErrorCount > 0.0f)
{
ErrorStats.AverageError = ErrorTotal / ErrorCount;
}
}
}
#endif
/**
* Determines the current setting for recompressing all animations upon load. The default value
* is False, but may be overridden by an optional field in the base engine INI file.
*
* @return true if the engine settings request that all animations be recompiled
*/
bool FAnimationUtils::GetForcedRecompressionSetting()
{
// Allow the Engine INI file to provide a new override
bool ForcedRecompressionSetting = false;
GConfig->GetBool( TEXT("AnimationCompression"), TEXT("ForceRecompression"), (bool&)ForcedRecompressionSetting, GEngineIni );
return ForcedRecompressionSetting;
}
static void GetBindPoseAtom(FTransform &OutBoneAtom, int32 BoneIndex, USkeleton *Skeleton)
{
OutBoneAtom = Skeleton->GetRefLocalPoses()[BoneIndex];
// #if DEBUG_ADDITIVE_CREATION
// UE_LOG(LogAnimation, Log, TEXT("GetBindPoseAtom BoneIndex: %d, OutBoneAtom: %s"), BoneIndex, *OutBoneAtom.ToString());
// #endif
}
/** Get default Outer for AnimSequences contained in this AnimSet.
* The intent is to use that when Constructing new AnimSequences to put into that set.
* The Outer will be Package.<AnimSetName>_Group.
* @param bCreateIfNotFound if true, Group will be created. This is only in the editor.
*/
UObject* FAnimationUtils::GetDefaultAnimSequenceOuter(UAnimSet* InAnimSet, bool bCreateIfNotFound)
{
check( InAnimSet );
#if WITH_EDITORONLY_DATA
for(int32 i=0; i<InAnimSet->Sequences.Num(); i++)
{
UAnimSequence* TestAnimSeq = InAnimSet->Sequences[i];
// Make sure outer is not current AnimSet, but they should be in the same package.
if( TestAnimSeq && TestAnimSeq->GetOuter() != InAnimSet && TestAnimSeq->GetOutermost() == InAnimSet->GetOutermost() )
{
return TestAnimSeq->GetOuter();
}
}
#endif //#if WITH_EDITORONLY_DATA
// Otherwise go ahead and create a new one if we should.
if( bCreateIfNotFound )
{
// We can only create Group if we are within the editor.
check(GIsEditor);
UPackage* AnimSetPackage = InAnimSet->GetOutermost();
// Make sure package is fully loaded.
AnimSetPackage->FullyLoad();
// Try to create a new package with Group named <AnimSetName>_Group.
FString NewPackageString = FString::Printf(TEXT("%s.%s_Group"), *AnimSetPackage->GetFName().ToString(), *InAnimSet->GetFName().ToString());
UPackage* NewPackage = CreatePackage( *NewPackageString );
// New Outer to use
return NewPackage;
}
return NULL;
}
/**
* Converts an animation compression type into a human readable string
*
* @param InFormat The compression format to convert into a string
* @return The format as a string
*/
FString FAnimationUtils::GetAnimationCompressionFormatString(AnimationCompressionFormat InFormat)
{
switch(InFormat)
{
case ACF_None:
return FString(TEXT("ACF_None"));
case ACF_Float96NoW:
return FString(TEXT("ACF_Float96NoW"));
case ACF_Fixed48NoW:
return FString(TEXT("ACF_Fixed48NoW"));
case ACF_IntervalFixed32NoW:
return FString(TEXT("ACF_IntervalFixed32NoW"));
case ACF_Fixed32NoW:
return FString(TEXT("ACF_Fixed32NoW"));
case ACF_Float32NoW:
return FString(TEXT("ACF_Float32NoW"));
case ACF_Identity:
return FString(TEXT("ACF_Identity"));
default:
UE_LOG(LogAnimationCompression, Warning, TEXT("AnimationCompressionFormat was not found: %i"), static_cast<int32>(InFormat) );
}
return FString(TEXT("Unknown"));
}
/**
* Converts an animation codec format into a human readable string
*
* @param InFormat The format to convert into a string
* @return The format as a string
*/
FString FAnimationUtils::GetAnimationKeyFormatString(AnimationKeyFormat InFormat)
{
switch(InFormat)
{
case AKF_ConstantKeyLerp:
return FString(TEXT("AKF_ConstantKeyLerp"));
case AKF_VariableKeyLerp:
return FString(TEXT("AKF_VariableKeyLerp"));
case AKF_PerTrackCompression:
return FString(TEXT("AKF_PerTrackCompression"));
default:
UE_LOG(LogAnimationCompression, Warning, TEXT("AnimationKeyFormat was not found: %i"), static_cast<int32>(InFormat) );
}
return FString(TEXT("Unknown"));
}
/**
* Computes the 'height' of each track, relative to a given animation linkup.
*
* The track height is defined as the minimal number of bones away from an end effector (end effectors are 0, their parents are 1, etc...)
*
* @param BoneData The bone data to check
* @param NumTracks The number of tracks
* @param TrackHeights [OUT] The computed track heights
*
*/
void FAnimationUtils::CalculateTrackHeights(const FCompressibleAnimData& CompressibleAnimData, int32 NumTracks, TArray<int32>& TrackHeights)
{
TrackHeights.Empty();
TrackHeights.AddUninitialized(NumTracks);
for (int32 TrackIndex = 0; TrackIndex < NumTracks; ++TrackIndex)
{
TrackHeights[TrackIndex] = 0;
}
const TArray<FBoneData>& BoneData = CompressibleAnimData.BoneData;
// Populate the bone 'height' table (distance from closest end effector, with 0 indicating an end effector)
// setup the raw bone transformation and find all end effectors
for (int32 BoneIndex = 0; BoneIndex < BoneData.Num(); ++BoneIndex)
{
// also record all end-effectors we find
const FBoneData& Bone = BoneData[BoneIndex];
if (Bone.IsEndEffector())
{
const FBoneData& EffectorBoneData = BoneData[BoneIndex];
for (int32 FamilyIndex = 0; FamilyIndex < EffectorBoneData.BonesToRoot.Num(); ++FamilyIndex)
{
const int32 NextParentBoneIndex = EffectorBoneData.BonesToRoot[FamilyIndex];
const int32 NextParentTrackIndex = GetAnimTrackIndexForSkeletonBone(NextParentBoneIndex, CompressibleAnimData.TrackToSkeletonMapTable);
if (NextParentTrackIndex != INDEX_NONE)
{
const int32 CurHeight = TrackHeights[NextParentTrackIndex];
TrackHeights[NextParentTrackIndex] = (CurHeight > 0) ? FMath::Min<int32>(CurHeight, (FamilyIndex+1)) : (FamilyIndex+1);
}
}
}
}
}
/**
* Checks a set of key times to see if the spacing is uniform or non-uniform.
* Note: If there are as many times as frames, they are automatically assumed to be uniformly spaced.
* Note: If there are two or fewer times, they are automatically assumed to be uniformly spaced.
*
* @param AnimSeq The animation sequence the Times array is associated with
* @param Times The array of key times
*
* @return true if the keys are uniformly spaced (or one of the trivial conditions is detected). false if any key spacing is greater than 1e-4 off.
*/
bool FAnimationUtils::HasUniformKeySpacing(int32 NumFrames, const TArray<float>& Times)
{
if ((Times.Num() <= 2) || (Times.Num() == NumFrames))
{
return true;
}
float FirstDelta = Times[1] - Times[0];
for (int32 i = 2; i < Times.Num(); ++i)
{
float DeltaTime = Times[i] - Times[i-1];
if (fabs(DeltaTime - FirstDelta) > KINDA_SMALL_NUMBER)
{
return false;
}
}
return false;
}
namespace EPerturbationErrorMode
{
enum Type
{
Transform,
Rotation,
Scale,
};
}
template<int32>
FORCEINLINE void CalcErrorValues(FAnimPerturbationError& TrackError, const FTransform& RawTransform, const FTransform& NewTransform);
template<>
FORCEINLINE void CalcErrorValues<EPerturbationErrorMode::Transform>(FAnimPerturbationError& TrackError, const FTransform& RawTransform, const FTransform& NewTransform)
{
TrackError.MaxErrorInTransDueToTrans = FMath::Max(TrackError.MaxErrorInTransDueToTrans, (RawTransform.GetLocation() - NewTransform.GetLocation()).SizeSquared());
TrackError.MaxErrorInRotDueToTrans = FMath::Max(TrackError.MaxErrorInRotDueToTrans, FQuat::ErrorAutoNormalize(RawTransform.GetRotation(), NewTransform.GetRotation()));
//TrackError.MaxErrorInScaleDueToTrans = FMath::Max(TrackError.MaxErrorInScaleDueToTrans, (RawTransform.GetScale3D() - NewTransform.GetScale3D()).SizeSquared());
}
template<>
FORCEINLINE void CalcErrorValues<EPerturbationErrorMode::Rotation>(FAnimPerturbationError& TrackError, const FTransform& RawTransform, const FTransform& NewTransform)
{
TrackError.MaxErrorInTransDueToRot = FMath::Max(TrackError.MaxErrorInTransDueToRot, (RawTransform.GetLocation() - NewTransform.GetLocation()).SizeSquared());
TrackError.MaxErrorInRotDueToRot = FMath::Max(TrackError.MaxErrorInRotDueToRot, FQuat::ErrorAutoNormalize(RawTransform.GetRotation(), NewTransform.GetRotation()));
//TrackError.MaxErrorInScaleDueToRot = FMath::Max(TrackError.MaxErrorInScaleDueToRot, (RawTransform.GetScale3D() - NewTransform.GetScale3D()).SizeSquared());
}
template<>
FORCEINLINE void CalcErrorValues<EPerturbationErrorMode::Scale>(FAnimPerturbationError& TrackError, const FTransform& RawTransform, const FTransform& NewTransform)
{
/*TrackError.MaxErrorInTransDueToScale = FMath::Max(TrackError.MaxErrorInTransDueToScale, (RawTransform.GetLocation() - NewTransform.GetLocation()).SizeSquared());
TrackError.MaxErrorInRotDueToScale = FMath::Max(TrackError.MaxErrorInRotDueToScale, FQuat::ErrorAutoNormalize(RawTransform.GetRotation(), NewTransform.GetRotation()));
TrackError.MaxErrorInScaleDueToScale = FMath::Max(TrackError.MaxErrorInScaleDueToScale, (RawTransform.GetScale3D() - NewTransform.GetScale3D()).SizeSquared());*/
TrackError.MaxErrorInTransDueToScale = TrackError.MaxErrorInTransDueToRot; //Original tally code was calculating scale errors then using rot regardless.
TrackError.MaxErrorInRotDueToScale = TrackError.MaxErrorInRotDueToRot;
//TrackError.MaxErrorInScaleDueToScale = TrackError.MaxErrorInScaleDueToRot;
}
struct FBoneTestItem
{
int32 BoneIndex;
bool bIsEndEffector;
FBoneTestItem(int32 InBoneIndex, const TArray<FBoneData>& BoneData)
: BoneIndex(InBoneIndex)
, bIsEndEffector(BoneData[BoneIndex].IsEndEffector())
{}
};
template<int32 PERTURBATION_ERROR_MODE>
void CalcErrorsLoop(const TArray<FBoneTestItem>& BonesToTest, const FCompressibleAnimData& CompressibleAnimData, const TArray<FTransform>& RawAtoms, const TArray<FTransform>& RawTransforms, TArray<FTransform>& NewTransforms, FAnimPerturbationError& ThisBoneError)
{
for (const FBoneTestItem& BoneTest : BonesToTest)
{
const int32 ParentIndex = CompressibleAnimData.RefSkeleton.GetParentIndex(BoneTest.BoneIndex);
NewTransforms[BoneTest.BoneIndex] = RawAtoms[BoneTest.BoneIndex] * NewTransforms[ParentIndex];
if (BoneTest.bIsEndEffector)
{
CalcErrorValues<PERTURBATION_ERROR_MODE>(ThisBoneError, RawTransforms[BoneTest.BoneIndex], NewTransforms[BoneTest.BoneIndex]);
}
}
}
/**
* Perturbs the bone(s) associated with each track in turn, measuring the maximum error introduced in end effectors as a result
*/
void FAnimationUtils::TallyErrorsFromPerturbation(
const FCompressibleAnimData& CompressibleAnimData,
int32 NumTracks,
const FVector& PositionNudge,
const FQuat& RotationNudge,
const FVector& ScaleNudge,
TArray<FAnimPerturbationError>& InducedErrors)
{
const int32 NumBones = CompressibleAnimData.BoneData.Num();
const TArray<FTransform>& RefPose = CompressibleAnimData.RefLocalPoses;
TArray<FTransform> RawAtoms;
TArray<FTransform> RawTransforms;
TArray<FTransform> NewTransforms;
RawAtoms.AddZeroed(NumBones);
RawTransforms.AddZeroed(NumBones);
NewTransforms.AddZeroed(NumBones);
InducedErrors.AddZeroed(NumTracks);
FTransform Perturbation(RotationNudge, PositionNudge, ScaleNudge);
// Build Track bone mapping for processingh
struct FTrackBoneMapping
{
int32 TrackIndex;
int32 BoneIndex;
bool bIsEndEffector;
FTrackBoneMapping(int32 InTrackIndex, int32 InBoneIndex, const TArray<FBoneData>& BoneData)
: TrackIndex(InTrackIndex)
, BoneIndex(InBoneIndex)
, bIsEndEffector(BoneData[BoneIndex].IsEndEffector())
{}
};
TArray<FTrackBoneMapping> TracksAndBonesToTest;
TracksAndBonesToTest.Reserve(NumTracks);
for (int32 TrackToTest = 0; TrackToTest < NumTracks; TrackToTest++)
{
const int32 BoneIndex = CompressibleAnimData.TrackToSkeletonMapTable[TrackToTest].BoneTreeIndex;
if (BoneIndex != INDEX_NONE)
{
TracksAndBonesToTest.Emplace(TrackToTest, BoneIndex, CompressibleAnimData.BoneData);
}
}
Algo::SortBy(TracksAndBonesToTest, &FTrackBoneMapping::BoneIndex);
// Prebuild bone test paths
TArray<TArray<FBoneTestItem>> BonesToTestMap;
BonesToTestMap.AddDefaulted(NumTracks);
TArray<int32> TempBonesToTest;
TempBonesToTest.Reserve(NumBones);
for (FTrackBoneMapping& TrackBonePair : TracksAndBonesToTest)
{
TempBonesToTest.Reset();
TempBonesToTest.Append(CompressibleAnimData.BoneData[TrackBonePair.BoneIndex].Children);
int32 BoneToTestIndex = 0;
while (BoneToTestIndex < TempBonesToTest.Num())
{
const int32 ThisBoneIndex = TempBonesToTest[BoneToTestIndex++];
TempBonesToTest.Append(CompressibleAnimData.BoneData[ThisBoneIndex].Children);
}
TArray<FBoneTestItem>& BonesToTest = BonesToTestMap[TrackBonePair.TrackIndex];
BonesToTest.Reserve(TempBonesToTest.Num());
for (const int32 BoneToTest : TempBonesToTest)
{
BonesToTest.Emplace(BoneToTest, CompressibleAnimData.BoneData);
}
}
for (int32 KeyIndex = 0; KeyIndex < CompressibleAnimData.NumberOfKeys; ++KeyIndex)
{
//Build Locals For Frame
if (CompressibleAnimData.IsCancelled())
{
return;
}
RawAtoms = RefPose;
for (const FTrackBoneMapping& TrackAndBone : TracksAndBonesToTest)
{
const FRawAnimSequenceTrack& RawTrack = CompressibleAnimData.RawAnimationData[TrackAndBone.TrackIndex];
ExtractTransformForFrameFromTrackSafe(RawTrack, KeyIndex, RawAtoms[TrackAndBone.BoneIndex]);
}
//Build Reference Component Space for Frame
RawTransforms[0] = RawAtoms[0];
for (int32 BoneIndex = 1; BoneIndex < NumBones; ++BoneIndex)
{
const int32 ParentIndex = CompressibleAnimData.RefSkeleton.GetParentIndex(BoneIndex);
RawTransforms[BoneIndex] = RawAtoms[BoneIndex] * RawTransforms[ParentIndex];
}
//For each track
int32 PreviousCopyPoint = 0;
for (const FTrackBoneMapping& TrackBonePair : TracksAndBonesToTest)
{
const int32 BoneToModify = TrackBonePair.BoneIndex;
TArray<FBoneTestItem>& BonesToTest = BonesToTestMap[TrackBonePair.TrackIndex];
FAnimPerturbationError& ThisBoneError = InducedErrors[TrackBonePair.TrackIndex];
// Init unchanged cache
for (int32 BoneIndex = PreviousCopyPoint; BoneIndex < BoneToModify; ++BoneIndex)
{
NewTransforms[BoneIndex] = RawTransforms[BoneIndex];
}
// Modify test bone
PreviousCopyPoint = BoneToModify;
// Calc Transform Error
NewTransforms[BoneToModify] = RawAtoms[BoneToModify];
NewTransforms[BoneToModify].AddToTranslation(PositionNudge);
const int32 ModifiedParentIndex = CompressibleAnimData.RefSkeleton.GetParentIndex(BoneToModify);
if (ModifiedParentIndex != INDEX_NONE) // Put Modified Bone in Component space
{
NewTransforms[BoneToModify] = NewTransforms[BoneToModify] * NewTransforms[ModifiedParentIndex];
}
if (TrackBonePair.bIsEndEffector)
{
CalcErrorValues<EPerturbationErrorMode::Transform>(ThisBoneError, RawTransforms[BoneToModify], NewTransforms[BoneToModify]);
}
CalcErrorsLoop<EPerturbationErrorMode::Transform>(BonesToTest, CompressibleAnimData, RawAtoms, RawTransforms, NewTransforms, ThisBoneError);
// Calc Rotatin Error
NewTransforms[BoneToModify] = RawAtoms[BoneToModify];
FQuat NewR = RawAtoms[BoneToModify].GetRotation();
NewR += RotationNudge;
NewR.Normalize();
NewTransforms[BoneToModify].SetRotation(NewR);
if (ModifiedParentIndex != INDEX_NONE) // Put Modified Bone in Component space
{
NewTransforms[BoneToModify] = NewTransforms[BoneToModify] * NewTransforms[ModifiedParentIndex];
}
if (TrackBonePair.bIsEndEffector)
{
CalcErrorValues<EPerturbationErrorMode::Rotation>(ThisBoneError, RawTransforms[BoneToModify], NewTransforms[BoneToModify]);
}
CalcErrorsLoop<EPerturbationErrorMode::Rotation>(BonesToTest, CompressibleAnimData, RawAtoms, RawTransforms, NewTransforms, ThisBoneError);
//Calc Scale Error
NewTransforms[BoneToModify] = RawAtoms[BoneToModify];
NewTransforms[BoneToModify].SetScale3D(RawAtoms[BoneToModify].GetScale3D() + ScaleNudge);
if (ModifiedParentIndex != INDEX_NONE) // Put Modified Bone in Component space
{
NewTransforms[BoneToModify] = NewTransforms[BoneToModify] * NewTransforms[ModifiedParentIndex];
}
if (TrackBonePair.bIsEndEffector)
{
CalcErrorValues<EPerturbationErrorMode::Scale>(ThisBoneError, RawTransforms[BoneToModify], NewTransforms[BoneToModify]);
}
CalcErrorsLoop<EPerturbationErrorMode::Scale>(BonesToTest, CompressibleAnimData, RawAtoms, RawTransforms, NewTransforms, ThisBoneError);
}
}
for (FAnimPerturbationError& Error : InducedErrors)
{
Error.MaxErrorInTransDueToTrans = FMath::Sqrt(Error.MaxErrorInTransDueToTrans);
Error.MaxErrorInTransDueToRot = FMath::Sqrt(Error.MaxErrorInTransDueToRot);
Error.MaxErrorInTransDueToScale = FMath::Sqrt(Error.MaxErrorInTransDueToScale);
/*Error.MaxErrorInScaleDueToTrans = FMath::Sqrt(Error.MaxErrorInScaleDueToTrans); //Not used by compression code TODO: Investigate and either use or remove
Error.MaxErrorInScaleDueToRot = FMath::Sqrt(Error.MaxErrorInScaleDueToRot);
Error.MaxErrorInScaleDueToScale = FMath::Sqrt(Error.MaxErrorInScaleDueToScale);*/
}
}
static UAnimBoneCompressionSettings* DefaultBoneCompressionSettings = nullptr;
static UAnimBoneCompressionSettings* DefaultRecorderBoneCompressionSettings = nullptr;
static UAnimCurveCompressionSettings* DefaultCurveCompressionSettings = nullptr;
static void EnsureDependenciesAreLoaded(UObject* Object)
{
if (Object == nullptr)
{
return; // Nothing to do
}
if (Object->HasAnyFlags(RF_NeedLoad))
{
Object->GetLinker()->Preload(Object);
}
if (Object->HasAnyFlags(RF_NeedPostLoad))
{
Object->ConditionalPostLoad();
}
TArray<UObject*> ObjectReferences;
FReferenceFinder(ObjectReferences, Object, false, true, true, true).FindReferences(Object);
for (UObject* Dependency : ObjectReferences)
{
if (Dependency->HasAnyFlags(RF_NeedLoad))
{
Dependency->GetLinker()->Preload(Dependency);
}
if (Dependency->HasAnyFlags(RF_NeedPostLoad))
{
Dependency->ConditionalPostLoad();
}
}
}
UObject* GetDefaultAnimationCompressionSettings(const TCHAR* IniValueName)
{
FConfigSection* AnimDefaultObjectSettingsSection = GConfig->GetSectionPrivate(TEXT("Animation.DefaultObjectSettings"), false, true, GEngineIni);
const FConfigValue* Value = AnimDefaultObjectSettingsSection != nullptr ? AnimDefaultObjectSettingsSection->Find(IniValueName) : nullptr;
if (Value == nullptr)
{
UE_LOG(LogAnimationCompression, Fatal, TEXT("Couldn't find default compression setting for '%s' under '[Animation.DefaultObjectSettings]'"), IniValueName);
return nullptr;
}
const FString& CompressionSettingsName = Value->GetValue();
UObject* DefaultCompressionSettings = LoadObject<UObject>(nullptr, *CompressionSettingsName);
if (DefaultCompressionSettings == nullptr)
{
UE_LOG(LogAnimationCompression, Fatal, TEXT("Couldn't load default compression settings asset with path '%s'"), *CompressionSettingsName);
}
// Force load the default settings and all its dependencies just in case it hasn't happened yet
EnsureDependenciesAreLoaded(DefaultCompressionSettings);
DefaultCompressionSettings->AddToRoot();
return DefaultCompressionSettings;
}
UAnimBoneCompressionSettings* FAnimationUtils::GetDefaultAnimationBoneCompressionSettings()
{
if (DefaultBoneCompressionSettings == nullptr)
{
DefaultBoneCompressionSettings = Cast<UAnimBoneCompressionSettings>(GetDefaultAnimationCompressionSettings(TEXT("BoneCompressionSettings")));
}
return DefaultBoneCompressionSettings;
}
UAnimBoneCompressionSettings* FAnimationUtils::GetDefaultAnimationRecorderBoneCompressionSettings()
{
if (DefaultRecorderBoneCompressionSettings == nullptr)
{
DefaultRecorderBoneCompressionSettings = Cast<UAnimBoneCompressionSettings>(GetDefaultAnimationCompressionSettings(TEXT("AnimationRecorderBoneCompressionSettings")));
}
return DefaultRecorderBoneCompressionSettings;
}
UAnimCurveCompressionSettings* FAnimationUtils::GetDefaultAnimationCurveCompressionSettings()
{
if (DefaultCurveCompressionSettings == nullptr)
{
DefaultCurveCompressionSettings = Cast<UAnimCurveCompressionSettings>(GetDefaultAnimationCompressionSettings(TEXT("CurveCompressionSettings")));
}
return DefaultCurveCompressionSettings;
}
void FAnimationUtils::EnsureAnimSequenceLoaded(UAnimSequence& AnimSeq)
{
EnsureDependenciesAreLoaded(&AnimSeq);
EnsureDependenciesAreLoaded(AnimSeq.GetSkeleton());
EnsureDependenciesAreLoaded(AnimSeq.BoneCompressionSettings);
EnsureDependenciesAreLoaded(AnimSeq.CurveCompressionSettings);
}
void FAnimationUtils::ExtractTransformForFrameFromTrackSafe(const FRawAnimSequenceTrack& RawTrack, int32 Frame, FTransform& OutAtom)
{
// Bail out (with rather wacky data) if data is empty for some reason.
if (RawTrack.PosKeys.Num() == 0 || RawTrack.RotKeys.Num() == 0)
{
OutAtom.SetIdentity();
return;
}
ExtractTransformForFrameFromTrack(RawTrack, Frame, OutAtom);
}
void FAnimationUtils::ExtractTransformForFrameFromTrack(const FRawAnimSequenceTrack& RawTrack, int32 Frame, FTransform& OutAtom)
{
static const FVector DefaultScale3D = FVector(1.f);
const int32 PosKeyIndex1 = FMath::Min(Frame, RawTrack.PosKeys.Num() - 1);
const int32 RotKeyIndex1 = FMath::Min(Frame, RawTrack.RotKeys.Num() - 1);
if (RawTrack.ScaleKeys.Num() > 0)
{
const int32 ScaleKeyIndex1 = FMath::Min(Frame, RawTrack.ScaleKeys.Num() - 1);
OutAtom = FTransform(RawTrack.RotKeys[RotKeyIndex1], RawTrack.PosKeys[PosKeyIndex1], RawTrack.ScaleKeys[ScaleKeyIndex1]);
}
else
{
OutAtom = FTransform(RawTrack.RotKeys[RotKeyIndex1], RawTrack.PosKeys[PosKeyIndex1], DefaultScale3D);
}
}
void FAnimationUtils::ExtractTransformFromTrack(float Time, int32 NumFrames, float SequenceLength, const FRawAnimSequenceTrack& RawTrack, EAnimInterpolationType Interpolation, FTransform &OutAtom)
{
// Bail out (with rather wacky data) if data is empty for some reason.
if (RawTrack.PosKeys.Num() == 0 || RawTrack.RotKeys.Num() == 0)
{
OutAtom.SetIdentity();
return;
}
int32 KeyIndex1, KeyIndex2;
float Alpha;
FAnimationRuntime::GetKeyIndicesFromTime(KeyIndex1, KeyIndex2, Alpha, Time, NumFrames, SequenceLength);
// @Todo fix me: this change is not good, it has lots of branches. But we'd like to save memory for not saving scale if no scale change exists
static const FVector DefaultScale3D = FVector(1.f);
if (Interpolation == EAnimInterpolationType::Step)
{
Alpha = 0.f;
}
if (Alpha <= 0.f)
{
ExtractTransformForFrameFromTrack(RawTrack, KeyIndex1, OutAtom);
return;
}
else if (Alpha >= 1.f)
{
ExtractTransformForFrameFromTrack(RawTrack, KeyIndex2, OutAtom);
return;
}
const int32 PosKeyIndex1 = FMath::Min(KeyIndex1, RawTrack.PosKeys.Num() - 1);
const int32 RotKeyIndex1 = FMath::Min(KeyIndex1, RawTrack.RotKeys.Num() - 1);
const int32 PosKeyIndex2 = FMath::Min(KeyIndex2, RawTrack.PosKeys.Num() - 1);
const int32 RotKeyIndex2 = FMath::Min(KeyIndex2, RawTrack.RotKeys.Num() - 1);
FTransform KeyAtom1, KeyAtom2;
const bool bHasScaleKey = (RawTrack.ScaleKeys.Num() > 0);
if (bHasScaleKey)
{
const int32 ScaleKeyIndex1 = FMath::Min(KeyIndex1, RawTrack.ScaleKeys.Num() - 1);
const int32 ScaleKeyIndex2 = FMath::Min(KeyIndex2, RawTrack.ScaleKeys.Num() - 1);
KeyAtom1 = FTransform(RawTrack.RotKeys[RotKeyIndex1], RawTrack.PosKeys[PosKeyIndex1], RawTrack.ScaleKeys[ScaleKeyIndex1]);
KeyAtom2 = FTransform(RawTrack.RotKeys[RotKeyIndex2], RawTrack.PosKeys[PosKeyIndex2], RawTrack.ScaleKeys[ScaleKeyIndex2]);
}
else
{
KeyAtom1 = FTransform(RawTrack.RotKeys[RotKeyIndex1], RawTrack.PosKeys[PosKeyIndex1], DefaultScale3D);
KeyAtom2 = FTransform(RawTrack.RotKeys[RotKeyIndex2], RawTrack.PosKeys[PosKeyIndex2], DefaultScale3D);
}
// UE_LOG(LogAnimation, Log, TEXT(" * * * Position. PosKeyIndex1: %3d, PosKeyIndex2: %3d, Alpha: %f"), PosKeyIndex1, PosKeyIndex2, Alpha);
// UE_LOG(LogAnimation, Log, TEXT(" * * * Rotation. RotKeyIndex1: %3d, RotKeyIndex2: %3d, Alpha: %f"), RotKeyIndex1, RotKeyIndex2, Alpha);
// Ensure rotations are normalized (Added for Jira UE-53971)
KeyAtom1.NormalizeRotation();
KeyAtom2.NormalizeRotation();
OutAtom.Blend(KeyAtom1, KeyAtom2, Alpha);
OutAtom.NormalizeRotation();
}
#if WITH_EDITOR
void FAnimationUtils::ExtractTransformFromCompressionData(const FCompressibleAnimData& CompressibleAnimData, FCompressibleAnimDataResult& CompressedAnimData, float Time, int32 TrackIndex, bool bUseRawData, FTransform& OutBoneTransform)
{
FUECompressedAnimDataMutable& AnimDataMutable = static_cast<FUECompressedAnimDataMutable&>(*CompressedAnimData.AnimData);
// If the caller didn't request that raw animation data be used . . .
if (!bUseRawData && AnimDataMutable.IsValid())
{
// Build our read-only version from the mutable source
FUECompressedAnimData AnimData(AnimDataMutable);
FAnimSequenceDecompressionContext DecompContext(CompressibleAnimData.SequenceLength, CompressibleAnimData.Interpolation, CompressibleAnimData.AnimFName, AnimData);
DecompContext.Seek(Time);
CompressedAnimData.Codec->DecompressBone(DecompContext, TrackIndex, OutBoneTransform);
return;
}
FAnimationUtils::ExtractTransformFromTrack(Time, CompressibleAnimData.NumberOfKeys, CompressibleAnimData.SequenceLength, CompressibleAnimData.RawAnimationData[TrackIndex], CompressibleAnimData.Interpolation, OutBoneTransform);
}
bool FAnimationUtils::CompressAnimBones(FCompressibleAnimData& AnimSeq, FCompressibleAnimDataResult& Target)
{
// Clear any previous data we might have even if we end up failing to compress
Target = FCompressibleAnimDataResult();
if (AnimSeq.BoneCompressionSettings == nullptr || !AnimSeq.BoneCompressionSettings->AreSettingsValid())
{
return false;
}
return AnimSeq.BoneCompressionSettings->Compress(AnimSeq, Target);
}
bool FAnimationUtils::CompressAnimCurves(FCompressibleAnimData& AnimSeq, FCompressedAnimSequence& Target)
{
// Clear any previous data we might have even if we end up failing to compress
Target.ClearCompressedCurveData();
if (AnimSeq.CurveCompressionSettings == nullptr || !AnimSeq.CurveCompressionSettings->AreSettingsValid())
{
return false;
}
return AnimSeq.CurveCompressionSettings->Compress(AnimSeq, Target);
}
#endif
| [
"ouczbs@qq.com"
] | ouczbs@qq.com |
d72097484f6e0dfdd6c6db3ffb436b7be32765a4 | bad6974317e6fbd2653ab57ff293f56991695cc2 | /geometry.hpp | 8b1665591aa38d2f98716646782c23a8fcdf27b4 | [] | no_license | noahritz/CS490 | 454eea17134f8d58618cdf1b3622d99181313652 | ad579f3b695214d36de1e3b407a2a5a3efa424b6 | refs/heads/master | 2020-04-25T18:48:46.048724 | 2019-05-02T11:13:01 | 2019-05-02T11:13:01 | 172,997,283 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,759 | hpp | #ifndef __GEOMETRY_HPP__
#define __GEOMETRY_HPP__
#include <vector>
#include <glm/vec3.hpp>
#include "raytrace.hpp"
#include "CImg.h"
class Shape {
public:
glm::vec3 color;
float lambert;
float specular;
bool refractive;
float IoR;
bool model;
Intersection intersected_tri[4];
Shape();
Shape(glm::vec3 color);
Shape(glm::vec3 color, float lam, float spec, bool refr, float ior);
virtual ~Shape();
virtual bool intersect(const Ray& ray, float &t) = 0;
virtual glm::vec3 surface(const Ray& ray, const glm::vec3& point, const std::vector<Shape*>& objects, const std::vector<Light*> &lights, Grid &grid) const;
virtual glm::vec3 normal(const glm::vec3& point, const Ray& ray) const = 0;
virtual glm::vec3 min() const = 0;
virtual glm::vec3 max() const = 0;
};
class Sphere : public Shape {
public:
glm::vec3 center;
float radius;
// glm::vec3 color;
Sphere(glm::vec3 ctr, float r);
Sphere(glm::vec3 ctr, float r, glm::vec3 col);
Sphere(glm::vec3 ctr, float r, glm::vec3 col, float lam, float spec, bool refr, float ior);
bool intersect(const Ray& ray, float &t);
glm::vec3 normal(const glm::vec3& point, const Ray& ray) const;
glm::vec3 min() const;
glm::vec3 max() const;
private:
bool solveQuadratic (const float &a, const float &b, const float &c, float &x0, float &x1) const;
};
class Triangle : public Shape {
public:
glm::vec3 v0;
glm::vec3 v1;
glm::vec3 v2;
Triangle(glm::vec3 p1, glm::vec3 p2, glm::vec3 p3);
Triangle(glm::vec3 p1, glm::vec3 p2, glm::vec3 p3, glm::vec3 col);
Triangle(glm::vec3 p1, glm::vec3 p2, glm::vec3 p3, glm::vec3 col, float lam, float spec, bool refr, float ior);
bool intersect(const Ray& ray, float &t);
glm::vec3 normal(const glm::vec3& point, const Ray& ray) const;
glm::vec3 min() const;
glm::vec3 max() const;
};
class TexturedTriangle : public Triangle {
public:
bool bottom;
glm::vec3 UV[4];
cimg_library::CImg<float>& texture;
TexturedTriangle(glm::vec3 p1, glm::vec3 p2, glm::vec3 p3, float lam, float spec, bool refr, float ior, cimg_library::CImg<float>& tex, bool bot);
bool intersect(const Ray& ray, float &t) override;
glm::vec3 surface(const Ray& ray, const glm::vec3& point, const std::vector<Shape*>& objects, const std::vector<Light*> &lights, Grid &grid) const override;
};
class Model : public Shape {
public:
glm::vec3 minimum;
glm::vec3 maximum;
std::vector<Triangle*> triangles;
Model();
bool intersect(const Ray& ray, float &t);
glm::vec3 normal(const glm::vec3& point, const Ray& ray) const;
glm::vec3 min() const;
glm::vec3 max() const;
};
#include "geometry.cpp"
#endif | [
"nritz97@gmail.com"
] | nritz97@gmail.com |
3ae42fc50eb1714b23313d597931cdd50854aff1 | 486c7e8a16a1d5419bc7a385dd4d043558ee04ef | /VmpcPlugin/Source/ThirdParty/include/mpc/src/controls/sequencer/UserControls.hpp | 16ea44837cc8b3f5954a8b4f04ed6cc8a457af04 | [] | no_license | izzyreal/vmpc-unreal-plugin | 73751fcd825ffe777fd08c7b651ef374aeb7c2fa | 338ae3373956b88473d804ca75f081a756382f11 | refs/heads/master | 2023-04-11T02:24:46.902201 | 2021-04-28T20:39:10 | 2021-04-28T20:39:10 | 113,060,206 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 491 | hpp | #pragma once
#include "AbstractSequencerControls.hpp"
namespace mpc {
namespace ui {
class UserDefaults;
}
namespace controls {
namespace sequencer {
class UserControls
: public AbstractSequencerControls
{
private:
std::weak_ptr<mpc::ui::UserDefaults> ud{};
public:
typedef mpc::controls::sequencer::AbstractSequencerControls super;
void function(int i) override;
void turnWheel(int i) override;
UserControls(mpc::Mpc* mpc);
};
}
}
}
| [
"izmaelverhage@gmail.com"
] | izmaelverhage@gmail.com |
5073851e6d0dbca8319fd0b2243296247db3be15 | 9f7bc8df3f30f2ec31581d6d2eca06e332aa15b4 | /c++/Win32/MFC/ObjectStream/DBAssociations.h | 084ef541a1a98c34a763ea1af79e21db8a7e61fc | [
"MIT"
] | permissive | moodboom/Reusable | 58f518b5b81facb862bbb36015aaa00adc710e0e | 5e0a4a85834533cf3ec5bec52cd6c5b0d60df8e8 | refs/heads/master | 2023-08-22T20:06:18.210680 | 2023-08-05T20:08:36 | 2023-08-05T20:08:36 | 50,254,274 | 3 | 3 | MIT | 2023-07-12T17:29:42 | 2016-01-23T19:23:01 | C++ | UTF-8 | C++ | false | false | 2,225 | h | #ifndef DB_ASSOCIATIONS_H
#define DB_ASSOCIATIONS_H
#include "ObjectStream.h" // Base class
#include "..\BaseProgressDlg.h" // Extract() uses one.
class EMComponent;
typedef struct {
DatabaseID DBID; // 16
wchar_t UserName[nUserNameLength]; // 64
wchar_t Company[nCompanyLength]; // 64
wchar_t Contact[nContactLength]; // 128
unsigned int nPercentage;
wchar_t DBName[43]; // 86
} DBAssociation;
typedef CTypedPtrArray< CPtrArray, DBAssociation* > ASSOCIATIONS;
// These are the return codes for Extract().
#define DBA_SUCCESS 0x0000
#define DBA_ASSOC_NOT_FOUND 0x0001
#define DBA_COMPLETENESS_FAILED 0x0002
class DBAssociations : public Persistent
{
public:
// Constructor.
DBAssociations(
ObjectStream* pNewDB,
bool bNewTemp = false
);
~DBAssociations();
bool Extract(
BaseProgressDlg* pProgressDlg,
int nStartProgress = 0,
int nEndProgress = 100
);
// These functions break the process of compiling associations
// into functions that can be called by an external loop through
// all db objects. This allows callers to loop through all
// objects, compiling associations, while also able to perform
// other operations on each object ( see EMDatabase::Publish() for
// the best example ).
void Start();
bool AddAssociations(
EMComponent* pObject
);
bool Finish();
// Our array of association data.
// Once this is loaded, we want to have access to it.
ASSOCIATIONS Associations;
protected:
// These read/write AND fill/cache the tree data.
void Read();
void Write();
void Clear();
// This var indicates if this is a temp object. If so, it is
// just being used for class registration, and nothing is done.
// If not, we set up for either a stand-alone associations update
// with Extract(), or an object-loop associations update with
// AddAssociations(), by calling Start() and Finish() in the
// con/destructor.
bool bTemp;
// These var's are required for us to keep temporary results
// during scans for associations across objects.
unsigned int nRefCount;
CString strAssocNotFound;
int nCurrentAssocCount;
int nBadObjectCount;
bool bSuccess;
};
#endif // DB_ASSOCIATIONS_H
| [
"m@thedigitalmachine.com"
] | m@thedigitalmachine.com |
afaacbb423e15213a268a7d2836c72192beebfe5 | fbf298f967a8e3e9dd20bbbd9f7689d8d028750b | /Open-GL/functions.h | f7809d3d735a67d120923f0296e07005efbc796f | [] | no_license | Ibnathism/computer-graphics | 5522446161aa14a4dc36c22f32219063f75da032 | 2d2ffe5484c8d7f505ae1cc6417dffbe37f941b9 | refs/heads/main | 2023-06-18T00:42:24.535336 | 2021-07-04T04:38:50 | 2021-07-04T04:38:50 | 347,920,791 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,183 | h | #ifndef OPEN_GL_FUNCTIONS_H
#define OPEN_GL_FUNCTIONS_H
#endif //OPEN_GL_FUNCTIONS_H
#include <GL/glut.h>
#include <iostream>
#include <cmath>
#include "point.h"
#include <random>
#define pi (2*acos(0.0))
double initOffset = 5.0;
double planeDistance = 200;
double maxAngle = 45;
Point axisQW(1, 0, 0);
double angleQW = 0;
Point axisER(0, 1, 0);
double angleER = 0;
Point axisAS(0, 1, 0);
double angleAS = 0;
double angleDF = 0;
double angleToChange = 1.0;
Point headCenter(0, 0, 80);
Point updatedCenter(0, 0, 80);
Point totalBullets[1000];
int bulletCount = 0;
void clear() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0,0,0,0); //color black
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void drawAxes() {
glBegin(GL_LINES);{
glVertex3f(100, 0, 0);
glVertex3f(-100, 0, 0);
glVertex3f(0, -100, 0);
glVertex3f(0, 100, 0);
glVertex3f(0, 0, 100);
glVertex3f(0, 0, -100);
}glEnd();
}
void drawGrid() {
int i;
glBegin(GL_LINES);{
for (i = -8; i <= 8; i++) {
if (i == 0)
continue; //SKIP the MAIN axes
//lines parallel to Y-axis
glVertex3f(i * 10, -90, 0);
glVertex3f(i * 10, 90, 0);
//lines parallel to X-axis
glVertex3f(-90, i * 10, 0);
glVertex3f(90, i * 10, 0);
}
}glEnd();
}
void draw2DRectangle(Point topLeft, Point bottomLeft, Point topRight, Point bottomRight) {
glBegin(GL_LINES);{
glVertex3f(topLeft.x, topLeft.y, topLeft.z);
glVertex3f(bottomLeft.x, bottomRight.y, bottomLeft.z);
glVertex3f(topRight.x, topRight.y, topRight.z);
glVertex3f(bottomRight.x, bottomRight.y, bottomRight.z);
glVertex3f(topLeft.x, topLeft.y, topLeft.z);
glVertex3f(topRight.x, topRight.y, topRight.z);
glVertex3f(bottomLeft.x, bottomLeft.y, bottomLeft.z);
glVertex3f(bottomRight.x, bottomRight.y, bottomRight.z);
}glEnd();
}
void drawSolidRectangle(Point topLeft, Point bottomLeft, Point topRight, Point bottomRight) {
glBegin(GL_QUADS);{
glVertex3f(topLeft.x, topLeft.y, topLeft.z);
glVertex3f(bottomLeft.x, bottomRight.y, bottomLeft.z);
glVertex3f(topRight.x, topRight.y, topRight.z);
glVertex3f(bottomRight.x, bottomRight.y, bottomRight.z);
glVertex3f(topLeft.x, topLeft.y, topLeft.z);
glVertex3f(topRight.x, topRight.y, topRight.z);
glVertex3f(bottomLeft.x, bottomLeft.y, bottomLeft.z);
glVertex3f(bottomRight.x, bottomRight.y, bottomRight.z);
}glEnd();
}
void draw2DCircle(double centerX, double centerY, double radius,int segments) {
int i;
Point points[100];
for(i=0;i<=segments;i++)
{
points[i].x=radius*cos(((double)i/(double)segments)*2*pi);
points[i].x = points[i].x + centerX;
points[i].y=radius*sin(((double)i/(double)segments)*2*pi);
points[i].y = points[i].y + centerY;
}
for(i=0;i<segments;i++)
{
glBegin(GL_LINES);{
glVertex3f(points[i].x,points[i].y,0);
glVertex3f(points[i+1].x,points[i+1].y,0);
}glEnd();
}
}
double getRandom(double a, double b) {
std::random_device randomDevice;
std::mt19937 mt19937(randomDevice());
std:: uniform_real_distribution<double> distribution(a, b);
return distribution(mt19937);
}
Point getNormalizedPoint(Point p) {
double temp = sqrt(p.x*p.x + p.y*p.y + p.z*p.z);
return {p.x/temp, p.y/temp, p.z/temp};
}
double getMinimum(double v1, double v2, double v3, double v4) {
double min = std::min(v1, v2);
min = std::min(min, v3);
return std::min(min, v4);
}
double getMaximum(double v1, double v2, double v3, double v4) {
double max = std::max(v1, v2);
max = std::max(max, v3);
return std::max(max, v4);
}
double centerToCenterDistance(Point & p1, Point & p2) {
double x = p1.x - p2.x;
double y = p1.y - p2.y;
double z = p1.z - p2.z;
double temp = sqrt(x*x + y*y + z*z);
return temp;
}
bool isBubblesColliding(Point & p1, Point & p2, double bubbleRadius) {
double d = centerToCenterDistance(p1, p2);
bool minCondition = d >= 2 * bubbleRadius - bubbleRadius/initOffset;
bool maxCondition = d <= 2 * bubbleRadius + bubbleRadius/initOffset;
return minCondition && maxCondition;
}
Point rotateOneAlongAnother(Point &toBeRotated, Point &respective, double angleOfRotation) {
Point temp = respective.crossMultiplication(toBeRotated);
double angleInRadian = angleOfRotation*pi / 180.0;
Point component1 = toBeRotated.constantScale(cos(angleInRadian));
Point component2 = temp.constantScale(sin(angleInRadian));
Point answer = component1.summation(component2);
return answer;
}
void setHeadCenter(){
updatedCenter = rotateOneAlongAnother(headCenter, axisQW, angleQW);
updatedCenter = rotateOneAlongAnother(updatedCenter, axisER, angleER);
updatedCenter = rotateOneAlongAnother(updatedCenter, axisAS, angleAS);
}
void applyQRotation() {
if (std::abs(angleQW + angleToChange) > maxAngle) return;
angleQW = angleQW + angleToChange;
setHeadCenter();
}
void applyWRotation() {
if (std::abs(angleQW - angleToChange) > maxAngle) return;
angleQW = angleQW - angleToChange;
setHeadCenter();
}
void applyERotation() {
if (std::abs(angleER + angleToChange) > maxAngle) return;
angleER = angleER + angleToChange;
setHeadCenter();
}
void applyRRotation() {
if (std::abs(angleER - angleToChange) > maxAngle) return;
angleER = angleER - angleToChange;
setHeadCenter();
}
void applyARotation() {
if (std::abs(angleAS + angleToChange) > maxAngle) return;
angleAS = angleAS + angleToChange;
setHeadCenter();
}
void applySRotation() {
if (std::abs(angleAS - angleToChange) > maxAngle) return;
angleAS = angleAS - angleToChange;
setHeadCenter();
}
void applyDRotation() {
if (std::abs(angleDF + angleToChange) > maxAngle) return;
angleDF = angleDF + angleToChange;
}
void applyFRotation() {
if (std::abs(angleDF - angleToChange) > maxAngle) return;
angleDF = angleDF - angleToChange;
}
void drawGun(double handleRadius, double bodyHeight, double bodyRadius, double headRadius, double headOffset) {
int slices = 50;
int stacks = 200;
Point handlePoints[stacks+1][slices+1];
double handleH, handleR;
for(int i=0;i<=stacks;i++) {
handleH = handleRadius*sin(((double)i/(double)stacks)*(pi/2));
handleR = handleRadius*cos(((double)i/(double)stacks)*(pi/2));
for(int j=0;j<=slices;j++) {
handlePoints[i][j].x = handleR * cos(((double)j/(double)slices)*2*pi);
handlePoints[i][j].y = handleR * sin(((double)j/(double)slices)*2*pi);
handlePoints[i][j].z = handleH;
handlePoints[i][j] = rotateOneAlongAnother(handlePoints[i][j], axisQW, angleQW);
handlePoints[i][j] = rotateOneAlongAnother(handlePoints[i][j], axisER, angleER);
}
}
bool isWhite = false;
for(int i=0;i<stacks;i++) {
for(int j=0;j<slices;j++) {
glBegin(GL_QUADS);{
if (isWhite) {
glColor3f(1, 1, 1);
isWhite = false;
}
else {
glColor3f(0, 0, 0);
isWhite = true;
}
glVertex3f(handlePoints[i][j].x,handlePoints[i][j].y,handlePoints[i][j].z);
glVertex3f(handlePoints[i][j+1].x,handlePoints[i][j+1].y,handlePoints[i][j+1].z);
glVertex3f(handlePoints[i+1][j+1].x,handlePoints[i+1][j+1].y,handlePoints[i+1][j+1].z);
glVertex3f(handlePoints[i+1][j].x,handlePoints[i+1][j].y,handlePoints[i+1][j].z);
glVertex3f(handlePoints[i][j].x,handlePoints[i][j].y,-handlePoints[i][j].z);
glVertex3f(handlePoints[i][j+1].x,handlePoints[i][j+1].y,-handlePoints[i][j+1].z);
glVertex3f(handlePoints[i+1][j+1].x,handlePoints[i+1][j+1].y,-handlePoints[i+1][j+1].z);
glVertex3f(handlePoints[i+1][j].x,handlePoints[i+1][j].y,-handlePoints[i+1][j].z);
}glEnd();
}
}
Point bodyPoints[stacks+1][slices+1];
double bodyH, bodyR;
for(int i=0;i<=stacks;i++) {
bodyH = bodyHeight*sin(((double)i/(double)stacks)*(pi/2));
bodyR = bodyRadius;
for(int j=0;j<=slices;j++) {
int joint = (int) (0.2 * stacks);
if (i > joint) {
bodyPoints[i][j].x = bodyR*cos(angleDF + ((double)j/(double)slices)*2*pi);
bodyPoints[i][j].y = bodyR*sin(angleDF + ((double)j/(double)slices)*2*pi);
bodyPoints[i][j].z = bodyH;
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisQW, angleQW);
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisAS, angleAS);
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisER, angleER);
} else {
double angleOnJoint = (double)i/(double)joint;
bodyR = bodyRadius * cos(angleOnJoint * (pi/2));
bodyH = (bodyHeight*0.2) * sin( angleOnJoint * (pi/2));
bodyPoints[i][j].x = bodyR*cos(angleDF + ((double)j/(double)slices)*2*pi);
bodyPoints[i][j].y = bodyR*sin(angleDF + ((double)j/(double)slices)*2*pi);
bodyPoints[i][j].z = bodyH;
Point temp(0, 0, 1);
Point addMore(0, 0, bodyHeight*0.2*2);
bodyPoints[i][j] = (rotateOneAlongAnother(bodyPoints[i][j], temp, 180)).summation(addMore);
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisQW, angleQW);
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisAS, angleAS);
bodyPoints[i][j] = rotateOneAlongAnother(bodyPoints[i][j], axisER, angleER);
}
}
}
isWhite = false;
for(int i=0;i<stacks;i++) {
for(int j=0;j<slices;j++) {
glBegin(GL_QUADS);{
if (isWhite) {
glColor3f(1, 1, 1);
isWhite = false;
}
else {
glColor3f(0, 0, 0);
isWhite = true;
}
glVertex3f(bodyPoints[i][j].x,bodyPoints[i][j].y,bodyPoints[i][j].z);
glVertex3f(bodyPoints[i][j+1].x,bodyPoints[i][j+1].y,bodyPoints[i][j+1].z);
glVertex3f(bodyPoints[i+1][j+1].x,bodyPoints[i+1][j+1].y,bodyPoints[i+1][j+1].z);
glVertex3f(bodyPoints[i+1][j].x,bodyPoints[i+1][j].y,bodyPoints[i+1][j].z);
}glEnd();
}
}
Point headPoints[stacks+1][slices+1];
double headH, headR;
for(int i=0;i<=stacks;i++) {
headH = bodyHeight*sin(((double)i/(double)stacks)*(pi/2));
headR = headRadius - headRadius*cos(((double)i/(double)stacks)*(pi/2)) + headOffset;
for(int j=0;j<=slices;j++) {
headPoints[i][j].x = headR*cos(angleDF + ((double)j/(double)slices)*2*pi);
headPoints[i][j].y = headR*sin(angleDF + ((double)j/(double)slices)*2*pi);
headPoints[i][j].z = headH;
headPoints[i][j] = rotateOneAlongAnother(headPoints[i][j], axisQW, angleQW);
headPoints[i][j] = rotateOneAlongAnother(headPoints[i][j], axisAS, angleAS);
headPoints[i][j] = rotateOneAlongAnother(headPoints[i][j], axisER, angleER);
}
}
isWhite = false;
for(int i=0;i<stacks;i++) {
for(int j=0;j<slices;j++) {
glBegin(GL_QUADS);{
if (isWhite) {
glColor3f(1, 1, 1);
isWhite = false;
}
else {
glColor3f(0, 0, 0);
isWhite = true;
}
if (headPoints[i][j].z >= bodyHeight*0.2 && headPoints[i][j+1].z >= bodyHeight*0.2) {
if (headPoints[i+1][j+1].z >= bodyHeight*0.2 && headPoints[i+1][j].z >= bodyHeight*0.2) {
glVertex3f(headPoints[i][j].x,headPoints[i][j].y,headPoints[i][j].z);
glVertex3f(headPoints[i][j+1].x,headPoints[i][j+1].y,headPoints[i][j+1].z);
glVertex3f(headPoints[i+1][j+1].x,headPoints[i+1][j+1].y,headPoints[i+1][j+1].z);
glVertex3f(headPoints[i+1][j].x,headPoints[i+1][j].y,headPoints[i+1][j].z);
}
}
}glEnd();
}
}
}
void drawBulletsOnPlane() {
for (int i = 0; i < bulletCount; ++i) {
Point temp = totalBullets[i];
drawSolidRectangle(Point(temp.x-2, temp.y+2, temp.z-20), Point(temp.x-2, temp.y-2, temp.z-20), Point(temp.x+2, temp.y+2, temp.z-20), Point(temp.x+2, temp.y-2, temp.z-20));
}
}
void fireBullets() {
double temp = std::abs(planeDistance/updatedCenter.z);
Point bulletPosition = updatedCenter.constantScale(temp);
totalBullets[bulletCount] = bulletPosition;
bulletCount = bulletCount + 1;
} | [
"1605106@ugrad.cse.buet.ac.bd"
] | 1605106@ugrad.cse.buet.ac.bd |
89d9860c59e73174ad6126d2c9b74f5eed803ed6 | 2008b223bcaeffc72abadf605f0ce8ea8704e136 | /assignments/assignment-04-albertotezza/Library.h | 993e324eddbc2c8a8829b6c7eaddd38c1a4ed362 | [] | no_license | albertotezza/embedded-systems-programming-aa-2019-20 | 0f74e17725f0b457db4510c8a2ec82da86ddc296 | 60f61e656313b9ee2b5416bc6e302092415f1ad6 | refs/heads/master | 2023-07-13T08:02:57.178879 | 2023-07-02T08:07:45 | 2023-07-02T08:07:45 | 211,164,650 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,149 | h | // Library.h
#ifndef PATRON_H
#define PATRON_H
#include <string>
#include <vector>
using namespace std;
#include "Date.h"
#include "Book.h"
#include "Patron.h"
class Library {
public:
Library(); // default Constructor
/*
Library(vector<Book> books, vector<Patron> patrons, vector<Transaction> transactions); // Constructor
// _function members_
vector<Book> books() const { return v_book_; }
vector<Patron> patrons() const { return v_patron_; }
vector<Transaction> transactions() const { return v_transaction_; }
*/
void add_book(const Book new_book);
void add_patron(const Patron new_patron);
void check_out_book(const Book b, const Patron p, const Date d);
vector<Patron> patrons_owe_fees();
private:
// struct Transaction
struct Transaction {
Book trans_book;
Patron trans_patron;
Date trans_date;
};
// _data members_
vector<Book> v_book_;
vector<Patron> v_patron_;
vector<Transaction> v_transaction_;
};
// operators
//std::ostream& operator<<(std::ostream& os, Patron& p);
#endif
| [
"alberto.tezza@studenti.unipd.it"
] | alberto.tezza@studenti.unipd.it |
2f67d5982ce21164523ebe7fd35bb69c1070f470 | abb5997a04888e15215391e55ceba81d3f3f5fc0 | /WindowsUI/ColorChangingButton/ColorChangingButton.cpp | b22791ae1843be4a42a3944bb8987de738c5cc64 | [] | no_license | winwingy/Study | c8f298792f94e230fed894521c611b15a9c524d0 | 5c368ad1b58d4567897a331cef247328c110fa5a | refs/heads/master | 2020-05-21T04:48:50.965832 | 2017-01-19T09:25:53 | 2017-01-19T09:25:53 | 55,683,173 | 1 | 1 | null | null | null | null | GB18030 | C++ | false | false | 5,231 | cpp | #include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <WindowsX.h>
#include <sstream>
using std::wstringstream;
using std::stringstream;
using std::endl;
wchar_t* g_ClassName = L"ColorChangingButton";
HINSTANCE g_instance = nullptr;
const int ID_BUTTON = 1001;
COLORREF g_clrButton = RGB(255, 255, 0);
WNDPROC g_loldBtnProc = 0;
bool g_bMouseTrack = true;
#define WM_REFRESHCHILD WM_USER+100
LRESULT onCtlColorBtn(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if ( (HWND)lParam == GetDlgItem(hWnd, ID_BUTTON) )
{
wstringstream ss;
ss<<__FUNCTION__<<__LINE__;
OutputDebugString(ss.str().c_str());
HWND hbn = (HWND)lParam;
HDC hdc = (HDC)(wParam);
RECT rc;
TCHAR text[64];
GetWindowText(hbn, text, 63);
GetClientRect(hbn, &rc);
SetTextColor(hdc, RGB(0, 0, 255));//设置按钮上文本的颜色
SetBkMode(hdc, TRANSPARENT);
DrawText(hdc, text, _tcslen(text), &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
return (INT_PTR)CreateSolidBrush(g_clrButton);
}
return 0;
}
void onMouseMove(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
HWND hBtn = GetDlgItem(hWnd, ID_BUTTON);
RECT rect;
GetWindowRect(hBtn, &rect);
POINT point = {x, y};
stringstream ssA;
ssA<<point.x<<" "<<point.y;
OutputDebugStringA(ssA.str().c_str());
BOOL bRet = ClientToScreen(hWnd, &point);
stringstream ss;
ss<<"Point: "<<point.x<<" "<<point.y<< " rect: "<<rect.left<<" "<<rect.top<<" "<<rect.right<<" "<<rect.bottom<<endl;
OutputDebugStringA(ss.str().c_str());
// if ( PtInRect( &rect, point) ) //当在 button里面时, 消息是在button的处理函数里边的, 不会到主界面
// {
// if ( MK_LBUTTON == wParam )
// {
// g_clrButton = RGB( 0, 255, 255 );
// }
// else
// {
// g_clrButton = RGB(200, 0, 0);
// }
// }
// else
{
g_clrButton = RGB(255, 255, 0);
}
}
LRESULT CALLBACK ChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if ( message == WM_MOUSEMOVE )
{
if ( MK_LBUTTON == wParam )
{
g_clrButton = RGB( 0, 255, 255 );
}
else
{
g_clrButton = RGB(200, 0, 0);
}
}
else
{
return g_loldBtnProc(hWnd, message, wParam, lParam);
}
return g_loldBtnProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message )
{
case WM_REFRESHCHILD:
{
HWND hChild = (HWND)GetDlgItem(hWnd, ID_BUTTON);
if ( hChild )
{
InvalidateRect(hChild, NULL, TRUE);
}
break;
}
case WM_CREATE:
{
HWND hChild = CreateWindow( L"BUTTON", L"K", WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON, 20, 20, 50, 30, hWnd, (HMENU)ID_BUTTON, g_instance, NULL );
LONG lOld = SetWindowLong( hChild, GWL_STYLE, GetWindowLong(hChild, GWL_STYLE)|BS_OWNERDRAW );
//WNDPROC lOldProc = (WNDPROC)SetWindowLong( hChild, GWL_WNDPROC, (LONG)ChildProc);
break;
}
case WM_COMMAND:
{
if ( (HANDLE)lParam == GetDlgItem(hWnd, ID_BUTTON) )
{
OutputDebugStringA("ss");
}
break;
}
case WM_CTLCOLORBTN:
{
LRESULT ret = onCtlColorBtn(hWnd, message, wParam, lParam);
if ( ret )
{
return ret;
}
break;
}
case WM_MOUSELEAVE:
{
stringstream ss;
ss<<" "<<__FUNCTION__<<" "<<__LINE__<<" ";
OutputDebugStringA(ss.str().c_str());
break;
}
case WM_MOUSEMOVE:
{
onMouseMove(hWnd, message, wParam, lParam);
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSW WndClass = {0};
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
WndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
WndClass.hIcon = NULL;
WndClass.hInstance = hInstance;
WndClass.lpfnWndProc = wndproc;
WndClass.lpszClassName = g_ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_HREDRAW | CS_VREDRAW;
ATOM aret = RegisterClass( &WndClass );
DWORD dwErr = GetLastError();
HWND hWin = CreateWindow( g_ClassName, L"Hi", WS_OVERLAPPEDWINDOW,/* CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,*/ 100, 500, 500, 300, NULL, NULL, hInstance, 0 );
dwErr = GetLastError();
ShowWindow(hWin, SW_SHOW);
UpdateWindow(hWin);
MSG msg;
while(GetMessage(&msg, NULL, 0, 0))
{
if ( msg.message == WM_MOUSEMOVE )
{
if ( g_bMouseTrack )
{
TRACKMOUSEEVENT csTME;
csTME.cbSize = sizeof(csTME);
csTME.dwFlags = TME_LEAVE|TME_HOVER;
csTME.hwndTrack = hWin;
csTME.dwHoverTime = 10;
TrackMouseEvent(&csTME);//开启windows的 WM_MOUSELEAVE WM_MOUSEHOVER 事件支持
g_bMouseTrack = false;
}
}
else if ( msg.message == WM_MOUSELEAVE )
{
g_bMouseTrack = true;
g_clrButton = RGB(0, 255, 0);
SendMessage(hWin, WM_REFRESHCHILD,0, 0);
}
else if ( msg.message == WM_MOUSEHOVER )
{
stringstream ss;
ss<<__FUNCTION__<<" "<<__LINE__<<endl;
OutputDebugStringA(ss.str().c_str());
g_clrButton = RGB(255, 255, 0);
SendMessage(hWin, WM_REFRESHCHILD,0, 0);
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} | [
"winwingy@163.com"
] | winwingy@163.com |
0188098337dc120a99c15ce6b6f91839b73c5dad | 40b115714899193e2a3eeb15c030402181880192 | /utility/manager_impl.hh | 9efd85156a296e4281068909313477aba2866455 | [] | no_license | inducer/wam | ec937b2b66edb09271f2197609549e574f2c68f1 | 03bd98e8ae000e7cc3fde8e3bff2878ed0c30802 | refs/heads/master | 2023-01-02T03:42:13.877423 | 2008-02-10T08:52:04 | 2008-02-10T08:52:04 | 305,217,156 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,551 | hh | // ----------------------------------------------------------------------------
// Description : WAM manager base
// ----------------------------------------------------------------------------
// (c) Copyright 1999 by Team WAM
// ----------------------------------------------------------------------------
#ifndef WAM_MANAGER_IMPL_BASE
#define WAM_MANAGER_IMPL_BASE
#include <algorithm>
#include <string.h>
#include "utility/exgame.hh"
#include "utility/manager.hh"
// wRegisteringManager --------------------------------------------------------
template <class Object>
void wRegisteringManager<Object>::registerObject( Object *o )
{
typename vector<Object *>::iterator inspos = getLowerBound( o->id() );
if ( inspos != ObjectList.end() && ( *inspos ) ->id() == o->id() )
EXGAME_THROWINFO( ECGAME_DOUBLEID, "wRegisteringManager::registerObject" );
ObjectList.insert( inspos, o );
}
template <class Object>
void wRegisteringManager<Object>::unregisterObject( Object *o )
{
ObjectList.erase( getIterator( o->id() ) );
}
template <class Object>
Object *
wRegisteringManager<Object>::getObject( wObject::TId id )
{
return * getIterator( id );
}
template <class Object>
typename vector<Object *>::iterator
wRegisteringManager<Object>::getLowerBound( wObject::TId id )
{
if ( ObjectList.size() == 0 )
return ObjectList.begin();
TIndex first = 0, last = ObjectList.size();
// binary search between first and last
while ( last - first > 1 )
{
int mid = ( last + first ) / 2;
if ( ObjectList[ mid ] ->id() < id )
first = mid;
else
last = mid;
}
if ( ObjectList[ first ] ->id() >= id )
return ObjectList.begin() + first;
else
return ObjectList.begin() + last;
}
template <class Object>
typename vector<Object *>::iterator
wRegisteringManager<Object>::getIterator( wObject::TId id )
{
typename vector<Object *>::iterator pos = getLowerBound( id );
if ( ( pos == ObjectList.end() ) || ( ( *pos ) ->id() != id ) )
EXGAME_THROWINFO( ECGAME_NOSUCHID, "wRegisteringManager::getIterator" );
return pos;
}
template <class Object>
bool wRegisteringManager<Object>::existID( wObject::TId id )
{
typename vector<Object *>::iterator pos = getLowerBound( id );
if ( ( pos == ObjectList.end() ) || ( ( *pos ) ->id() != id ) )
return false;
else
return true;
}
// wPriorityManager -----------------------------------------------------------
template <class Object>
void wPriorityManager<Object>::registerObject( Object *o )
{
#ifdef WAM_DEBUG
bool exists = true;
try
{
getIterator( o->id() );
}
catch ( ... )
{
exists = false;
}
if ( exists )
EXGAME_THROWINFO( ECGAME_DOUBLEID, "wPriorityManager::registerObject" );
#endif
typename vector<Object *>::iterator inspos = getLowerBound( getPriority( o ) );
ObjectList.insert( inspos, o );
}
template <class Object>
void wPriorityManager<Object>::unregisterObject( Object *o )
{
ObjectList.erase( getIterator( o->id() ) );
}
template <class Object>
Object *
wPriorityManager<Object>::getObject( wObject::TId id )
{
return * getIterator( id );
}
template <class Object>
typename vector<Object *>::iterator
wPriorityManager<Object>::getLowerBound( signed int prio )
{
if ( ObjectList.size() == 0 )
return ObjectList.begin();
TIndex first = 0, last = ObjectList.size();
// binary search between first and last
while ( last - first > 1 )
{
int mid = ( last + first ) / 2;
if ( getPriority( ObjectList[ mid ] ) < prio )
first = mid;
else
last = mid;
}
if ( getPriority( ObjectList[ first ] ) >= prio )
return ObjectList.begin() + first;
else
return ObjectList.begin() + last;
}
template <class Object>
typename vector<Object *>::iterator
wPriorityManager<Object>::getIterator( wObject::TId id )
{
typename vector<Object *>::iterator
first = ObjectList.begin(),
last = ObjectList.end();
while ( first != last )
{
if ( id == ( *first ) ->id() )
return first;
first++;
}
EXGAME_THROWINFO( ECGAME_NOSUCHID, "wPriorityManager::getIterator" )
}
template <class Object>
bool wPriorityManager<Object>::existID( wObject::TId id )
{
typename vector<Object *>::iterator pos = getLowerBound( id );
if ( ( pos == ObjectList.end() ) || ( ( *pos ) ->id() != id ) )
return false;
else
return true;
}
template <class Object>
void wPriorityManager<Object>::changeObject( Object *o )
{
unregisterObject( o );
registerObject( o );
}
#endif
| [
"inform@tiker.net"
] | inform@tiker.net |
2ce1555829264d4becd21a251dd414b24bf41e0e | 8d19ab53401030209dd7e5e655bdb0e2952bfa7e | /toonz/sources/colorfx/strokestyles.h | b79dba1a484fe9cb19b9bfaa6aaea13fc0cd4ef1 | [
"BSD-3-Clause"
] | permissive | deruji/opentoonz | 825a74af1dbc89c62991458a352650c4ef766fde | ad5f6141388f796c5146876916c812bf1b1f0ff9 | refs/heads/master | 2021-05-03T09:41:12.454051 | 2016-04-22T21:08:08 | 2016-04-22T21:08:08 | 54,891,799 | 0 | 0 | null | 2016-04-22T21:08:08 | 2016-03-28T12:49:04 | C++ | UTF-8 | C++ | false | false | 39,006 | h |
#ifndef STROKESTYLES_H
#define STROKESTYLES_H
// TnzCore includes
#include "tsimplecolorstyles.h"
#include "tvectorimage.h"
#include "tstrokeprop.h"
#include "tgl.h"
class TVectorRendeData;
class TRandom;
#undef DVAPI
#undef DVVAR
#ifdef COLORFX_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//=============================================================================
typedef struct {
TPointD point;
double dbl1;
double dbl2;
} PointAnd2Double;
typedef vector<TPointD> Points;
typedef struct {
float blend;
Points points;
} BlendAndPoint;
typedef vector<pair<TPointD, TPixel32>> PointsAndColors;
typedef vector<Points> PointMatrix;
typedef vector<pair<TPointD, double>> PointsAndDoubles;
typedef vector<pair<GLenum, Points>> DrawmodePointsMatrix;
typedef vector<TRectD> RectVector;
typedef vector<PointAnd2Double> PointsAnd2Doubles;
typedef vector<double> Doubles;
typedef vector<BlendAndPoint> BlendAndPoints;
//=============================================================================
template <class T>
class TOptimizedStrokeStyleT : public TColorStyle
{
public:
TOptimizedStrokeStyleT() {}
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
TStrokeProp *makeStrokeProp(const TStroke *stroke);
TRegionProp *makeRegionProp(const TRegion *region)
{
assert(false);
return 0;
};
virtual void computeData(T &data, const TStroke *stroke, const TColorFunction *cf) const = 0;
virtual void drawStroke(const TColorFunction *cf, T &data, const TStroke *stroke) const = 0;
};
//-------------------------------------------------------------------
class TFurStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
double m_cs, m_sn, m_angle, m_length;
TPixel32 m_color;
public:
TFurStrokeStyle();
TColorStyle *clone() const;
void invalidate() {}
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
void drawStroke(TFlash &rd, const TStroke *stroke) const;
QString getDescription() const { return QCoreApplication::translate("TFurStrokeStyle", "Herringbone"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void saveData(TOutputStreamInterface &os) const
{
os << m_color << m_angle << m_length;
}
void loadData(TInputStreamInterface &is)
{
is >> m_color >> m_angle >> m_length;
m_cs = cos(m_angle);
m_sn = sin(m_angle);
}
int getTagId() const { return 103; };
};
//-------------------------------------------------------------------
class TChainStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
public:
TChainStrokeStyle(const TPixel32 &color);
TChainStrokeStyle();
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TChainStrokeStyle", "Chain"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void loadData(TInputStreamInterface &is) { is >> m_color; }
void saveData(TOutputStreamInterface &os) const { os << m_color; }
int getTagId() const { return 104; };
};
//-------------------------------------------------------------------
class TSprayStrokeStyle : public TSimpleStrokeStyle
{
TPixel32 m_color;
double m_blend, m_intensity, m_radius;
public:
TSprayStrokeStyle();
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TSprayStrokeStyle", "Circlets"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void loadData(TInputStreamInterface &is) { is >> m_color >> m_blend >> m_intensity >> m_radius; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_blend << m_intensity << m_radius; }
int getTagId() const { return 106; };
};
//-------------------------------------------------------------------
class TGraphicPenStrokeStyle : public TOptimizedStrokeStyleT<DrawmodePointsMatrix>
{
TPixel32 m_color;
double m_intensity;
public:
TGraphicPenStrokeStyle();
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TGraphicPenStrokeStyle", "Dashes"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void computeData(DrawmodePointsMatrix &data, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, DrawmodePointsMatrix &data, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *s) const;
void loadData(TInputStreamInterface &is) { is >> m_color >> m_intensity; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_intensity; }
int getTagId() const { return 107; };
};
//-------------------------------------------------------------------
class TDottedLineStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_in, m_line, m_out, m_blank;
public:
TDottedLineStrokeStyle();
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TDottedLineStrokeStyle", "Vanishing"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_in >> m_line >> m_out >> m_blank; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_in << m_line << m_out << m_blank; }
bool isSaveSupported() { return true; }
int getTagId() const { return 111; }
};
//-------------------------------------------------------------------
class TRopeStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_bend;
public:
TRopeStrokeStyle();
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TRopeStrokeStyle", "Rope"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_bend; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_bend; }
bool isSaveSupported() { return true; }
int getTagId() const { return 108; }
};
//-------------------------------------------------------------------
class TCrystallizeStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_period, m_opacity;
public:
TCrystallizeStrokeStyle();
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
TColorStyle *clone() const;
QString getDescription() const { return QCoreApplication::translate("TCrystallizeStrokeStyle", "Tulle"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_period >> m_opacity; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_period << m_opacity; }
bool isSaveSupported() { return true; }
int getTagId() const { return 109; }
};
//-------------------------------------------------------------------
class TBraidStrokeStyle : public TSimpleStrokeStyle
{
TPixel32 m_colors[3];
double m_period;
public:
TBraidStrokeStyle();
TColorStyle *clone() const;
void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TBraidStrokeStyle", "Plait"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_colors[0]; }
void setMainColor(const TPixel32 &color) { m_colors[0] = color; }
int getColorParamCount() const { return 3; }
TPixel32 getColorParamValue(int index) const;
void setColorParamValue(int index, const TPixel32 &color);
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_colors[0] >> m_colors[1] >> m_colors[2] >> m_period; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_colors[0] << m_colors[1] << m_colors[2] << m_period; }
bool isSaveSupported() { return true; }
int getTagId() const { return 136; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(112); }
};
//-------------------------------------------------------------------
class TSketchStrokeStyle : public TSimpleStrokeStyle
{
TPixel32 m_color;
double m_density;
public:
TSketchStrokeStyle();
TColorStyle *clone() const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TSketchStrokeStyle", "Fuzz"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &fl, const TStroke *s) const;
void loadData(TInputStreamInterface &is) { is >> m_color >> m_density; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_density; }
bool isSaveSupported() { return true; }
int getTagId() const { return 113; }
};
//-------------------------------------------------------------------
class TBubbleStrokeStyle : public TSimpleStrokeStyle
{
TPixel32 m_color0, m_color1;
public:
TBubbleStrokeStyle();
TColorStyle *clone() const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TBubbleStrokeStyle", "Bubbles"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color0; }
void setMainColor(const TPixel32 &color) { m_color0 = color; }
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const { return index == 0 ? m_color0 : m_color1; }
void setColorParamValue(int index, const TPixel32 &color)
{
if (index == 0)
m_color0 = color;
else
m_color1 = color;
}
void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void loadData(TInputStreamInterface &is) { is >> m_color0 >> m_color1; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color0 << m_color1; }
bool isSaveSupported() { return true; }
int getTagId() const { return 114; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(137); }
};
//-------------------------------------------------------------------
class TTissueStrokeStyle : public TOptimizedStrokeStyleT<PointMatrix>
{
TPixel32 m_color;
double m_density, m_border;
public:
TTissueStrokeStyle();
TColorStyle *clone() const;
void computeData(PointMatrix &data, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, PointMatrix &data, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TTissueStrokeStyle", "Gauze"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_density >> m_border; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_density << m_border; }
int getTagId() const { return 117; }
};
//-------------------------------------------------------------------
class TBiColorStrokeStyle : public TOutlineStyle
{
TPixel32 m_color0, m_color1;
double m_parameter;
public:
TBiColorStrokeStyle();
TColorStyle *clone() const;
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
void drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TBiColorStrokeStyle", "Shade"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color0; }
void setMainColor(const TPixel32 &color) { m_color0 = color; }
void loadData(TInputStreamInterface &is);
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const;
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const { return index == 0 ? m_color0 : m_color1; }
void setColorParamValue(int index, const TPixel32 &color)
{
if (index == 0)
m_color0 = color;
else
m_color1 = color;
}
int getTagId() const { return 135; };
void getObsoleteTagIds(vector<int> &ids) const
{
ids.push_back(115);
ids.push_back(119);
}
};
//-------------------------------------------------------------------
class TNormal2StrokeStyle : public TOutlineStyle
{
TPixel32 m_color;
double m_lightx, m_lighty, m_shininess, m_metal, m_bend;
public:
TNormal2StrokeStyle();
TColorStyle *clone() const;
void drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const;
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TNormal2StrokeStyle", "Bump"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_lightx >> m_lighty >> m_shininess >> m_metal >> m_bend; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color << m_lightx << m_lighty
<< m_shininess << m_metal << m_bend; }
int getTagId() const { return 120; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(121); }
};
//-------------------------------------------------------------------
class TChalkStrokeStyle2 : public TOptimizedStrokeStyleT<Doubles>
{
TPixel32 m_color;
double m_blend, m_intensity, m_in, m_out, m_noise;
public:
TChalkStrokeStyle2();
TColorStyle *clone() const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TChalkStrokeStyle2", "Chalk"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void computeData(Doubles &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Doubles &positions, const TStroke *stroke) const;
void loadData(TInputStreamInterface &is) { is >> m_color >> m_blend >> m_intensity >> m_in >> m_out >> m_noise; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color << m_blend << m_intensity << m_in
<< m_out << m_noise; }
int getTagId() const { return 123; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(105); }
};
//-------------------------------------------------------------------
class TBlendStrokeStyle2 : public TOptimizedStrokeStyleT<PointsAndDoubles>
{
TPixel32 m_color;
double m_blend, m_in, m_out;
public:
TBlendStrokeStyle2();
TColorStyle *clone() const;
void computeData(PointsAndDoubles &data, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, PointsAndDoubles &data, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TBlendStrokeStyle2", "Fade"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_blend >> m_in >> m_out; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color << m_blend << m_in << m_out; }
bool isSaveSupported() { return true; }
int getTagId() const { return 125; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(110); }
};
//-------------------------------------------------------------------
class TTwirlStrokeStyle : public TOptimizedStrokeStyleT<Doubles>
{
TPixel32 m_color;
double m_period, m_blend;
public:
TTwirlStrokeStyle();
TColorStyle *clone() const;
void computeData(Doubles &data, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Doubles &data, const TStroke *stroke) const;
//void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TTwirlStrokeStyle", "Ribbon"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_period >> m_blend; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_period << m_blend; }
bool isSaveSupported() { return true; }
int getTagId() const { return 126; }
};
//-------------------------------------------------------------------
class TSawToothStrokeStyle : public TOutlineStyle
{
TPixel32 m_color;
double m_parameter;
public:
TSawToothStrokeStyle(TPixel32 color = TPixel32::Blue,
double parameter = 20.0);
TColorStyle *clone() const;
void drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void invalidate() {}
void computeOutline(const TStroke *stroke,
TStrokeOutline &outline,
TOutlineUtil::OutlineParameter param) const;
QString getDescription() const { return QCoreApplication::translate("TSawToothStrokeStyle", "Jagged"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
int getTagId() const { return 127; };
void loadData(TInputStreamInterface &is) { is >> m_color >> m_parameter; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_parameter; }
};
//-------------------------------------------------------------------
class TMultiLineStrokeStyle2 : public TOptimizedStrokeStyleT<BlendAndPoints>
{
TPixel32 m_color0, m_color1;
double m_intensity, m_length, m_thick, m_noise;
public:
TMultiLineStrokeStyle2();
TColorStyle *clone() const;
void computeData(BlendAndPoints &data, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, BlendAndPoints &data, const TStroke *stroke) const;
//void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TMultiLineStrokeStyle2", "Gouache"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color0; }
void setMainColor(const TPixel32 &color) { m_color0 = color; }
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const { return index == 0 ? m_color0 : m_color1; }
void setColorParamValue(int index, const TPixel32 &color)
{
if (index == 0)
m_color0 = color;
else
m_color1 = color;
}
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color0 >> m_color1 >> m_intensity >> m_length >> m_thick >> m_noise; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color0 << m_color1 << m_intensity << m_length << m_thick << m_noise; }
bool isSaveSupported() { return true; }
int getTagId() const { return 138; };
void getObsoleteTagIds(vector<int> &ids) const
{
ids.push_back(118);
ids.push_back(128);
}
};
//-------------------------------------------------------------------
class TZigzagStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_minDist, m_maxDist;
double m_minAngle, m_maxAngle;
double m_thickness;
//void drawBLines(RectVector& rects) const;
void setRealMinMax() const;
bool getZigZagPosition(const TStroke *stroke, TRandom &rnd,
const double s, const int first,
const double minTranslLength,
TThickPoint &pos, TThickPoint &pos1) const;
public:
TZigzagStrokeStyle();
TColorStyle *clone() const;
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
//void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TZigzagStrokeStyle", "Zigzag"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_minDist >> m_maxDist >> m_minAngle >> m_maxAngle >> m_thickness; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_minDist << m_maxDist << m_minAngle << m_maxAngle << m_thickness; }
bool isSaveSupported() { return true; }
int getTagId() const { return 129; }
};
//-------------------------------------------------------------------
class TSinStrokeStyle : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_frequency, m_thick;
public:
TSinStrokeStyle();
TColorStyle *clone() const;
void computeData(Points &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, Points &positions, const TStroke *stroke) const;
//void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TSinStrokeStyle", "Wave"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void loadData(TInputStreamInterface &is) { is >> m_color >> m_frequency >> m_thick; }
void saveData(TOutputStreamInterface &os) const { os << m_color << m_frequency << m_thick; }
int getTagId() const { return 130; }
};
//-------------------------------------------------------------------
class TFriezeStrokeStyle2 : public TOptimizedStrokeStyleT<Points>
{
TPixel32 m_color;
double m_parameter, m_thick;
public:
TFriezeStrokeStyle2();
TColorStyle *clone() const;
void invalidate() {}
QString getDescription() const { return QCoreApplication::translate("TFriezeStrokeStyle2", "Curl"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color; }
void setMainColor(const TPixel32 &color) { m_color = color; }
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
void computeData(vector<TPointD> &positions, const TStroke *stroke, const TColorFunction *cf) const;
void drawStroke(const TColorFunction *cf, vector<TPointD> &positions, const TStroke *stroke) const;
//void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
void loadData(TInputStreamInterface &is) { is >> m_color >> m_parameter >> m_thick; }
void loadData(int oldId, TInputStreamInterface &);
void saveData(TOutputStreamInterface &os) const { os << m_color << m_parameter << m_thick; }
int getTagId() const { return 133; };
void getObsoleteTagIds(vector<int> &ids) const { ids.push_back(102); }
};
//-------------------------------------------------------------------
class TDualColorStrokeStyle2 : public TOutlineStyle
{
TPixel32 m_color0, m_color1;
double m_parameter;
public:
TDualColorStrokeStyle2(
TPixel32 color0 = TPixel32::Blue,
TPixel32 color1 = TPixel32::Yellow,
double parameter = 20.0);
TColorStyle *clone() const;
void drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void invalidate() {}
void computeOutline(const TStroke *stroke,
TStrokeOutline &outline,
TOutlineUtil::OutlineParameter param) const;
QString getDescription() const { return QCoreApplication::translate("TDualColorStrokeStyle2", "Striped"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color0; }
void setMainColor(const TPixel32 &color) { m_color0 = color; }
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const { return (index == 0) ? m_color0 : m_color1; }
void setColorParamValue(int index, const TPixel32 &color)
{
if (index == 0)
m_color0 = color;
else
m_color1 = color;
}
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
int getTagId() const { return 132; };
void loadData(TInputStreamInterface &is) { is >> m_color0 >> m_color1 >> m_parameter; }
void saveData(TOutputStreamInterface &os) const { os << m_color0 << m_color1 << m_parameter; }
};
//-------------------------------------------------------------------
class TLongBlendStrokeStyle2 : public TOutlineStyle
{
TPixel32 m_color0, m_color1;
double m_parameter;
public:
TLongBlendStrokeStyle2(TPixel32 color0 = TPixel32::Blue,
TPixel32 color1 = TPixel32::Transparent,
double parameter = 20.0);
TColorStyle *clone() const;
void drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
void drawStroke(TFlash &flash, const TStroke *stroke) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void invalidate() {}
void computeOutline(const TStroke *stroke,
TStrokeOutline &outline,
TOutlineUtil::OutlineParameter param) const;
QString getDescription() const { return QCoreApplication::translate("TLongBlendStrokeStyle2", "Watercolor"); }
bool hasMainColor() const { return true; }
TPixel32 getMainColor() const { return m_color0; }
void setMainColor(const TPixel32 &color0) { m_color0 = color0; }
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const { return index == 0 ? m_color0 : m_color1; }
void setColorParamValue(int index, const TPixel32 &color)
{
if (index == 0)
m_color0 = color;
else
m_color1 = color;
}
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
int getTagId() const { return 134; };
void loadData(TInputStreamInterface &is) { is >> m_color0 >> m_color1 >> m_parameter; }
void saveData(TOutputStreamInterface &os) const { os << m_color0 << m_color1 << m_parameter; }
};
//-------------------------------------------------------------------
#ifdef _DEBUG
class OutlineViewerStyle : public TSolidColorStyle
{
double m_parameter[4];
bool m_boolPar;
int m_intPar;
int m_enumPar;
TFilePath m_pathPar;
protected:
void loadData(TInputStreamInterface &is);
void saveData(TOutputStreamInterface &os) const;
public:
OutlineViewerStyle(TPixel32 color = TPixel32::Black,
double parameter0 = 0.0, double parameter1 = 0.0,
double parameter2 = 2.0, double parameter3 = 3.0);
TColorStyle *clone() const;
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
bool getParamValue(TColorStyle::bool_tag, int index) const;
void setParamValue(int index, bool value);
void getParamRange(int index, int &min, int &max) const;
int getParamValue(TColorStyle::int_tag, int index) const;
void setParamValue(int index, int value);
void getParamRange(int index, QStringList &enumItems) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
TFilePath getParamValue(TColorStyle::TFilePath_tag, int index) const;
void setParamValue(int index, const TFilePath &path);
void computeOutline(const TStroke *stroke,
TStrokeOutline &outline,
TOutlineUtil::OutlineParameter param) const;
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline, const TStroke *stroke) const;
QString getDescription() const { return QCoreApplication::translate("OutlineViewerStyle", "OutlineViewer(OnlyDebug)"); }
int getTagId() const { return 99; };
};
#endif
//-------------------------------------------------------------------
class TMatrioskaStrokeStyle;
class TMatrioskaStrokeProp : public TStrokeProp
{
protected:
double m_outlinePixelSize;
TMatrioskaStrokeStyle *m_colorStyle;
vector<TStrokeOutline> m_outline;
vector<TStroke *> m_appStrokes;
public:
TMatrioskaStrokeProp(const TStroke *stroke, TMatrioskaStrokeStyle *style);
~TMatrioskaStrokeProp();
const TColorStyle *getColorStyle() const;
TStrokeProp *clone(const TStroke *stroke) const;
void draw(const TVectorRenderData &rd);
void draw(TFlash &flash);
};
class TMatrioskaStrokeStyle : public TSolidColorStyle
{
double m_parameter;
TPixel32 m_color2;
protected:
void loadData(TInputStreamInterface &is);
void saveData(TOutputStreamInterface &os) const;
public:
TMatrioskaStrokeStyle(
TPixel32 color1 = TPixel32::Magenta,
TPixel32 color2 = TPixel32::Blue,
double parameter = 6.0,
bool alternate = true);
TColorStyle *clone() const;
int getColorParamCount() const { return 2; }
TPixel32 getColorParamValue(int index) const;
void setColorParamValue(int index, const TPixel32 &color);
int getParamCount() const;
TColorStyle::ParamType getParamType(int index) const;
QString getParamNames(int index) const;
void getParamRange(int index, double &min, double &max) const;
double getParamValue(TColorStyle::double_tag, int index) const;
void setParamValue(int index, double value);
TStrokeProp *makeStrokeProp(const TStroke *stroke);
bool isRegionStyle() const { return false; }
bool isStrokeStyle() const { return true; }
QString getDescription() const { return QCoreApplication::translate("TMatrioskaStrokeStyle", "Toothpaste"); }
int getTagId() const { return 141; };
};
#endif // STROKESTYLES_H
| [
"shimizu.toshihiro@gmail.com"
] | shimizu.toshihiro@gmail.com |
df94721dac1826059a1c6d3fe06e1d038ddfd63e | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /net/third_party/http2/decoder/payload_decoders/unknown_payload_decoder.cc | 3f7cbf40c13747985d456d09efe4f409e3c74103 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | C++ | false | false | 1,969 | cc | // 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 "net/third_party/http2/decoder/payload_decoders/unknown_payload_decoder.h"
#include <stddef.h>
#include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/http2_frame_decoder_listener.h"
#include "net/third_party/http2/http2_constants.h"
#include "net/third_party/http2/http2_structures.h"
namespace http2 {
DecodeStatus UnknownPayloadDecoder::StartDecodingPayload(
FrameDecoderState* state,
DecodeBuffer* db) {
const Http2FrameHeader& frame_header = state->frame_header();
DVLOG(2) << "UnknownPayloadDecoder::StartDecodingPayload: " << frame_header;
DCHECK(!IsSupportedHttp2FrameType(frame_header.type)) << frame_header;
DCHECK_LE(db->Remaining(), frame_header.payload_length);
state->InitializeRemainders();
state->listener()->OnUnknownStart(frame_header);
return ResumeDecodingPayload(state, db);
}
DecodeStatus UnknownPayloadDecoder::ResumeDecodingPayload(
FrameDecoderState* state,
DecodeBuffer* db) {
DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload "
<< "remaining_payload=" << state->remaining_payload()
<< "; db->Remaining=" << db->Remaining();
DCHECK(!IsSupportedHttp2FrameType(state->frame_header().type))
<< state->frame_header();
DCHECK_LE(state->remaining_payload(), state->frame_header().payload_length);
DCHECK_LE(db->Remaining(), state->remaining_payload());
size_t avail = db->Remaining();
if (avail > 0) {
state->listener()->OnUnknownPayload(db->cursor(), avail);
db->AdvanceCursor(avail);
state->ConsumePayload(avail);
}
if (state->remaining_payload() == 0) {
state->listener()->OnUnknownEnd();
return DecodeStatus::kDecodeDone;
}
return DecodeStatus::kDecodeInProgress;
}
} // namespace http2
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
03fb4b54509c14c682cc27e9d0873e4d3e15689e | f44210cbddfc38f62105aac4224533ad1324c02e | /and/ariel/lucky_division.cpp | 0dc3c2a5a0e11677c2ff2ac0e409a9f0b4704e81 | [
"MIT"
] | permissive | aLagoG/kygerand | 8067b95fde1a213e278406626f109f21818ad984 | 0991cf5d5c3d49f4602b6992d4e3bdec8e27898e | refs/heads/master | 2021-01-11T16:15:41.330307 | 2019-09-18T20:09:00 | 2019-09-18T20:09:00 | 80,049,161 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 464 | cpp | #include <iostream>
using namespace std;
int n;
const int valid[2]{4, 7};
bool search(int current) {
if (n % current == 0) {
return true;
}
if (current > n) {
return false;
}
for (auto v : valid) {
if (search(current * 10 + v)) {
return true;
}
}
return false;
}
int main() {
ios_base::sync_with_stdio(0);
cin >> n;
cout << (search(4) || search(7) ? "YES" : "NO") << endl;
}
| [
"delagoandres@gmail.com"
] | delagoandres@gmail.com |
28cec36886fcb21783dbc29bbd0546189deb77ab | 1351f48d45c2c05e322c29c5f68da0d4590888c1 | /C++ C141018/Exercise_Herbert_Schildt/1.5.3.cpp | b6fa2d965625cbfca880479e9c45ca91da265044 | [] | no_license | laziestcoder/Problem-Solvings | cd2db049c3f6d1c79dfc9fba9250f4e1d8c7b588 | df487904876c748ad87a72a25d2bcee892a4d443 | refs/heads/master | 2023-08-19T09:55:32.144858 | 2021-10-21T20:32:21 | 2021-10-21T20:32:21 | 114,477,726 | 9 | 2 | null | 2021-06-22T15:46:43 | 2017-12-16T17:18:43 | Python | UTF-8 | C++ | false | false | 1,118 | cpp | #include<iostream>
using namespace std;
#define SIZE 100
class q_type
{
int queue[SIZE]; // holds the queue
int head, tail; // indices of head and tail
public:
void init(); // initialize
void q(int num); // store
int deq(); // retrieve
};
// Initialize
void q_type::init()
{
head = tail = 0;
}
// Put value on a queue
void q_type::q(int num)
{
if(tail+1==head || (tail+1==SIZE && !head))
{
cout << "Queue is full";
return;
}
tail++;
if(tail==SIZE)tail = 0; //cycle around
queue[tail] = num;
}
// Remove a value from a queue
int q_type::deq()
{
if(head == tail)
{
cout << "Queue is empty\n";
return 0; // or some other error indicator
}
head++;
if(head==SIZE) head = 0; //cycle around
return queue[head];
}
int main()
{
q_type q1, q2;
int i;
q1.init();
q2.init();
for(i=1; i<=10; i++)
{
q1.q(i);
q2.q(i*i);
}
for(i=1; i<=10; i++)
{
cout << "Dequeue 1: " << q1.deq() << "\n";
cout << "Dequeue 2: " << q2.deq() << "\n";
}
return 0;
}
| [
"towfiq.106@gmail.com"
] | towfiq.106@gmail.com |
7f1645d6fc2ea4da512ab78c274866158f49f832 | 9c5f636f5a8eba635d747dc0e6aa9f26213acf34 | /extensions/heuristics/differential/distances_to_pivots.h | c0e9a16083e560ebd4bbfc80f691ae1ae875c8b8 | [
"LicenseRef-scancode-other-permissive",
"MIT"
] | permissive | mgoldenbe/search-framework | 2da0a1370f9d6935391b1f2bf387feddf70c59ce | 81af82ceb11ccee82c18a70fa31dfd380e4dd931 | refs/heads/master | 2020-06-12T00:12:25.215595 | 2018-07-04T12:06:52 | 2018-07-04T12:06:52 | 75,616,850 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,955 | h | #ifndef SLB_EXTENSIONS_HEURISTICS_DIFFERENTIAL_DISTANCES_TO_PIVOTS_H
#define SLB_EXTENSIONS_HEURISTICS_DIFFERENTIAL_DISTANCES_TO_PIVOTS_H
/// \file
/// \brief The differential heuristic's distances to pivots.
/// \author Meir Goldenberg
namespace slb {
namespace ext {
namespace heuristic {
namespace differential {
/// The type for working with distances to pivots.
/// The general definition is for the situation with an index.
/// The situation without an index is handled by a specialization.
/// \tparam State The state type representing the search domain.
/// \tparam Index Mapping of states to indices.
/// \tparam IndexKind The type denoting the kind of index.
template <class State, class Index = NoIndex, IndexKind k = Index::kind>
struct DistancesToPivots {
/// The action cost type.
using CostType = typename State::CostType;
/// The type for storing distances to pivots.
using Distances = std::vector<CostType>;
/// The iterator for the distances to pivots.
using It = typename std::vector<CostType>::const_iterator;
/// Updates the expected number of pivots.
void updateExpectedNPivots(int expectedNPivots) {
expectedNPivots_ = expectedNPivots;
}
/// Appends the given distances to the existing ones.
/// \tparam MyDistanceMap The type for storing the distances to be appended.
/// \param myMap The distances to be appended.
/// \note MyDistanceMap must provide begin() and end() associated with
/// iterator over states, so it cannot be the DistanceMap with index without
/// an inverse.
template <class MyDistanceMap>
void append(const MyDistanceMap &myMap) {
if (nPivots_ == 0)
distances_.resize(expectedNPivots_ * Index::size());
for (auto it = myMap.begin(); it != myMap.end(); ++it) {
auto s = myMap.itToState(it);
distances_[expectedNPivots_ * Index::to(s) + nPivots_] =
myMap.distance(s);
}
++nPivots_;
}
/// Returns the iterator to the first distance to pivot from the given state.
/// \param s The given state.
/// \return The iterator to the first distance to pivot from \c s.
It pivotIt(const State &s) const {
return distances_.begin() + expectedNPivots_ * Index::to(s);
}
/// Returns the number of pivots.
/// \return The number of pivots.
int nPivots() const { return nPivots_; }
/// Clears all the distances.
void clear() {
nPivots_ = 0;
distances_.clear();
}
private:
int expectedNPivots_; ///< The expected number of pivots.
int nPivots_ = 0; ///< The number of pivots
///< to which distances have been added.
Distances distances_; ///< Distances to pivots.
};
/// The type for working with distances to pivots.
/// This specialization is for the situation without an index.
/// \tparam State The state type representing the search domain.
/// \tparam Index Mapping of states to indices.
/// \tparam IndexKind The type denoting the kind of index.
template <class State, class Index>
struct DistancesToPivots<State, Index, IndexKind::none> {
/// The action cost type.
using CostType = typename State::CostType;
/// The type for storing distances to pivots.
using Distances = std::unordered_map<State, std::vector<CostType>,
core::util::StateHash<State>>;
/// The iterator for the distances to pivots.
using It = typename std::vector<CostType>::const_iterator;
/// Appends the given distances to the existing ones.
/// \tparam MyDistanceMap The type for storing the distances to be appended.
/// \param myMap The distances to be appended.
/// \note MyDistanceMap must provide begin() and end() associated with
/// iterator over states, so it cannot be the DistanceMap with index without
/// an inverse.
template <class MyDistanceMap>
void append(const MyDistanceMap &myMap) {
for (const auto &state : myMap)
distances_[state].push_back(myMap.distance(state));
++nPivots_;
}
/// Returns the iterator to the first distance to pivot from the given
/// state.
/// \param s The given state.
/// \return The iterator to the first distance to pivot from \c s.
It pivotIt(const State &s) const {
auto it = distances_.find(s);
assert(it != distances_.end());
return (it->second).begin();
}
/// Returns the number of pivots.
/// \return The number of pivots.
int nPivots() const { return nPivots_; }
/// Clears all the distances.
void clear() {
nPivots_ = 0;
distances_.clear();
}
private:
int nPivots_ = 0; ///< The number of pivots
///< to which distances have been added.
Distances distances_; ///< Distances to pivots.
};
} // namespace
} // namespace
} // namespace
} // namespace
#endif
| [
"mgoldenbe@gmail.com"
] | mgoldenbe@gmail.com |
b7c1447fdc0c6b33a2c43fa2c19f3eee2c9cfb6c | 93d9185f7a0d007f03018753c4dc14def72ded75 | /Movement.cpp | b0ccea586bb39b5b37fc1daba8586cbfbc252e09 | [] | no_license | hwornik/Schachprogramm | 5d3fed505869573e97cb05bf7be1141e528270f5 | 6bb4749e544a36fbd6d19c10988f8b07d97f5cf5 | refs/heads/master | 2021-05-01T02:55:26.687686 | 2016-07-12T14:15:24 | 2016-07-12T14:15:24 | 62,807,073 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 27,405 | cpp | #include "stdafx.h"
#include "Movement.h"
Movement::Movement()
{
hit = false;
this->myboard = new Board();
this->mynot = new Notation();
//this->attacks = new Board();
this->mypieces = new Pieces();
aktuell = new Zuege();
}
Movement::~Movement()
{
delete myboard;
delete mynot;
delete aktuell;
//delete attacks;
delete mypieces;
//delete mynot;
}
bool Movement::movePiece(std::string command)
{
char *pch, *mystring;
int lang = command.size();
//command=command+" ";
// lang =command.size();
pch = strdup(command.c_str());
bool enpassante = false;
bool correct = false;
int vx, vy, nx, ny;
int z = 0, index = 0;
bool istrade = false;
char lsttrd;
z = lang - 1;
lsttrd = pch[z];
if (pch[z] == 'Q' || pch[z] == 'q' || pch[z] == 'B' || pch[z] == 'b' || pch[z] == 'R' || pch[z] == 'r' || pch[z] == 'N' || pch[z] == 'n')
{
istrade = true;
//printf("lasttrade");
}
z = 0;
//while (lang>z)
{
while (z <= lang && pch[z] == ' ')
z++;
// if(pch[z]==' ')
// z++;
//lang=sizeof(pch)/sizeof(char);
// printf ("%d %c\n",lang,pch[z]);
if (z>lang)
return correct;
vx = 0;
vy = 0;
nx = 0;
ny = 0;
//printf("Z: %d Char: %c\n",z,command[z]);
if (pch[z] == 'a')
{
vx = 1;
}
else if (pch[z] == 'b')
{
vx = 2;
}
else if (pch[z] == 'c')
{
vx = 3;
}
else if (pch[z] == 'd')
{
vx = 4;
}
else if (pch[z] == 'e')
{
vx = 5;
}
else if (pch[z] == 'f')
{
vx = 6;
}
else if (pch[z] == 'g')
{
vx = 7;
}
else if (pch[z] == 'h')
{
vx = 8;
}
else
{
return correct;
}
z++;
if (pch[z] == '1')
{
vy = 1;
}
else if (pch[z] == '2')
{
vy = 2;
}
else if (pch[z] == '3')
{
vy = 3;
}
else if (pch[z] == '4')
{
vy = 4;
}
else if (pch[z] == '5')
{
vy = 5;
}
else if (pch[z] == '6')
{
vy = 6;
}
else if (pch[z] == '7')
{
vy = 7;
}
else if (pch[z] == '8')
{
vy = 8;
}
else
{
return correct;
}
z++;
// to Move
if (pch[z] == 'a')
{
nx = 1;
}
else if (pch[z] == 'b')
{
nx = 2;
}
else if (pch[z] == 'c')
{
nx = 3;
}
else if (pch[z] == 'd')
{
nx = 4;
}
else if (pch[z] == 'e')
{
nx = 5;
}
else if (pch[z] == 'f')
{
nx = 6;
}
else if (pch[z] == 'g')
{
nx = 7;
}
else if (pch[z] == 'h')
{
nx = 8;
}
else
{
return correct;
}
z++;
if (pch[z] == '1')
{
ny = 1;
}
else if (pch[z] == '2')
{
ny = 2;
}
else if (pch[z] == '3')
{
ny = 3;
}
else if (pch[z] == '4')
{
ny = 4;
}
else if (pch[z] == '5')
{
ny = 5;
}
else if (pch[z] == '6')
{
ny = 6;
}
else if (pch[z] == '7')
{
ny = 7;
}
else if (pch[z] == '8')
{
ny = 8;
}
else
{
return correct;
}
z++;
if (vx > 0 && vy > 0 && nx > 0 && ny > 0 && vx < 9 && vy < 9 && nx < 9 && ny < 9)
{
//int lang=sizeof(command)/sizeof(char);
enpassante = this->myboard->getEnPassant();
char pawn;
pawn = 'p';
if (this->myboard->getwhitetoMove())
pawn = 'P';
if (enpassante)
{
this->myboard->setPiece(pawn, this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false));
}
//printf("%c |",pch[z]);
if (z<lang)
{
//printf("trade z<lang \n");
if (pch[z] == 'Q' || pch[z] == 'q' || pch[z] == 'B' || pch[z] == 'b' || pch[z] == 'R' || pch[z] == 'r' || pch[z] == 'N' || pch[z] == 'n')
{
//printf("trade\n");
correct = this->proofNextMove(false, vx, vy, nx, ny, pch[z]);
if (correct)
{
this->myboard->setEnPassantFalse();
this->makenextMove(vx, vy, nx, ny, pch[z]);
}
z++;
}
else
{
correct = this->proofNextMove(false, vx, vy, nx, ny, ' ');
if (correct)
{
this->myboard->setEnPassantFalse();
this->makenextMove(vx, vy, nx, ny, ' ');
//printf("makeit\n");
}
}
}
else
{
//printf("proof it %d\n",lang);
if (istrade)
{
correct = this->proofNextMove(false, vx, vy, nx, ny, lsttrd);
}
else {
correct = this->proofNextMove(false, vx, vy, nx, ny, ' ');
}
if (correct)
{
//printf("makeit\n");
this->myboard->setEnPassantFalse();
this->makenextMove(vx, vy, nx, ny, ' ');
//printf("makeit\n");
}
}
}
if (enpassante)
{
this->myboard->setPiece('e', this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false));
if (nx == this->myboard->getEnPassantField(true) && ny == this->myboard->getEnPassantField(false))
{
this->myboard->setPiece('e', this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false) + 1);
}
}
vx = 0;
vy = 0;
nx = 0;
ny = 0;
}
return correct;
}
bool Movement::movePieces(std::string command)
{
char *pch, *mystring;
char delimiter[] = " ";
bool enpassante = false;
bool correct = true;
int vx, vy, nx, ny;
int z = 0, index = 0;
bool istrade = false;
char lsttrd;
mystring = strdup(command.c_str());
pch = strtok(mystring, delimiter);
while (pch != NULL)
{
char pawn;
pawn = 'p';
if (this->myboard->getwhitetoMove())
pawn = 'P';
if (enpassante)
{
this->myboard->setPiece(pawn, this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false));
}
aktuell->init();
aktuell->setWhitePiece(pch);
if (aktuell->isWhiteTrade())
{
this->myboard->setEnPassantFalse();
this->makenextMove(aktuell->getWhitePiece(true, true), aktuell->getWhitePiece(true, false), aktuell->getWhitePiece(false, true), aktuell->getWhitePiece(false, false), aktuell->getWhiteTrade());
}
else
{
this->myboard->setEnPassantFalse();
this->makenextMove(aktuell->getWhitePiece(true, true), aktuell->getWhitePiece(true, false), aktuell->getWhitePiece(false, true), aktuell->getWhitePiece(false, false), ' ');
}
if (enpassante)
{
this->myboard->setPiece('e', this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false));
if (nx == this->myboard->getEnPassantField(true) && ny == this->myboard->getEnPassantField(false))
{
this->myboard->setPiece('e', this->myboard->getEnPassantField(true), this->myboard->getEnPassantField(false) + 1);
}
}
vx = 0;
vy = 0;
nx = 0;
ny = 0;
pch = strtok(NULL, delimiter);
}
//delete pch;
//delete aktuell;
return correct;
}
bool Movement::moveisHit()
{
return this->hit;
}
bool Movement::proofNextMove(bool searchhits, int vx, int vy, int nx, int ny, char p)
{
//Pieces *mypieces;
this->hit = false;
char pie = myboard->getPieceonPos(vx, vy);
if (!myboard->getwhitetoMove())
{
if (isupper(pie))
return false;
}
else
{
if (!isupper(pie))
return false;
}
Board *piecmove;
char zielpiece, myzielpiece;
int divx = 0, divy = 0, posx, posy;
this->hit = false;
if (pie == 'e')
return false;
if (vx == nx && vy == ny)
return false;
//mypieces = new Pieces();
mypieces->init();
mypieces->setName(pie);
mypieces->setPos(vx, vy);
piecmove = mypieces->getActMoves();
if (pie == 'k' || 'K')
{
if (vx == 5 && (nx == 7 || nx == 3) && ((ny == 1 && vy == 1) || (ny == 8 && vy == 8)))
{
bool tr= this->proofRochade(vx, vy, nx, ny);
//delete piecmove;
//delete mypieces;
return tr;
}
}
int x = 0, y = 0;
if (pie != 'n' && pie != 'N')
{
if ((nx - vx) > 0)
{
x = 1;
}
else
{
x = -1;
}
if ((nx - vx) == 0)
x = 0;
if ((ny - vy) > 0)
{
y = 1;
}
else
{
y = -1;
}
if ((ny - vy) == 0)
y = 0;
posx = vx;
posy = vy;
while (posx != nx || posy != ny)
{
posx = posx + x;
posy = posy + y;
zielpiece = piecmove->getPieceonPos(posx, posy);
myzielpiece = myboard->getPieceonPos(posx, posy);
if (zielpiece == 'm' || zielpiece == 'h' || zielpiece == 'x')
{
if (myzielpiece != 'e')
{
if (posx == nx && posy == ny)
{
if (zielpiece == 'm')
{
//delete piecmove;
//delete mypieces;
return false;
}
if (myboard->getwhitetoMove() && isupper(myzielpiece))
{
//delete piecmove;
//delete mypieces;
return false;
}
if (!myboard->getwhitetoMove() && !isupper(myzielpiece))
{
//delete piecmove;
//delete mypieces;
return false;
}
this->hit = true;
}
else
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (posx == nx && posy == ny)
{
if (zielpiece == 'h' && !searchhits)
{
//delete piecmove;
//delete mypieces;
return false;
}
if (searchhits && zielpiece == 'm')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
}
else
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
else
{
myzielpiece = myboard->getPieceonPos(nx, ny);
if (myzielpiece != 'e')
{
if (piecmove->getPieceonPos(nx, ny) == 'x')
{
if (myboard->getwhitetoMove() && isupper(myzielpiece))
{
//delete piecmove;
//delete mypieces;
return false;
}
if (!myboard->getwhitetoMove() && !isupper(myzielpiece))
{
//delete piecmove;
//delete mypieces;
return false;
}
this->hit = true;
}
else
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
int posWhiteKing[2];
int posBlackKing[2];
// Führe Zug testweise aus
// teste wenn der König die figur ist ob der andere könig zu nahe wäre
if (pie == 'k' || pie == 'K') // für schwarzen künig
{
//Test auf König
if ((ny + 1) < 9)
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx, ny + 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx, ny + 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if ((ny - 1)>0)
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx, ny - 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx, ny - 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if ((nx - 1)>0)
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx - 1, ny) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx - 1, ny) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if ((nx + 1)<9)
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx + 1, ny) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx + 1, ny) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if (((nx + 1)<9) && ((ny + 1)<9))
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx + 1, ny + 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx + 1, ny + 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if (((nx - 1)>0) && ((ny - 1)>0))
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx - 1, ny - 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx - 1, ny - 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if (((nx - 1)>0) && ((ny + 1)<9))
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx - 1, ny + 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx - 1, ny + 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
if (((nx + 1)<9) && ((ny - 1)>0))
{
if (myboard->getwhitetoMove())
{
if (myboard->getPieceonPos(nx + 1, ny - 1) == 'k')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (myboard->getPieceonPos(nx + 1, ny - 1) == 'K')
{
//delete piecmove;
//delete mypieces;
return false;
}
}
}
}
// teste ob König nach diesen Zug attackiert würde
char oldpie = myboard->maketestmove(vx, vy, nx, ny);
int attacks;
if (myboard->getwhitetoMove())
{
if (pie == 'K')
{
posWhiteKing[0] = nx;
posWhiteKing[1] = ny;
}
else
{
posWhiteKing[0] = myboard->getWhiteKingPos(true);
posWhiteKing[1] = myboard->getWhiteKingPos(false);;
}
attacks = this->figureisunderAttack(posWhiteKing[0], posWhiteKing[1], true);
myboard->takebacktestmove(vx, vy, nx, ny, oldpie);
if (attacks > 0)
{
//delete piecmove;
//delete mypieces;
return false;
}
}
else
{
if (pie == 'k')
{
posBlackKing[0] = nx;
posBlackKing[1] = ny;
}
else
{
posBlackKing[0] = myboard->getBlackKingPos(true);
posBlackKing[1] = myboard->getBlackKingPos(false);;
}
attacks = this->figureisunderAttack(posBlackKing[0], posBlackKing[1], false);
myboard->takebacktestmove(vx, vy, nx, ny, oldpie);
if (attacks > 0)
{
//delete piecmove;
//delete mypieces;
return false;
}
}
//delete piecmove;
//delete mypieces;
return true;
}
bool Movement::proofRochade(int vx, int vy, int nx, int ny)
{
if (vy == 1)
{
if (nx == 3 && myboard->getcastleQs(0))
{
if (myboard->getPieceonPos(2, 1) == 'e' && myboard->getPieceonPos(3, 1) == 'e' && myboard->getPieceonPos(4, 1) == 'e')
{
if ((this->figureisunderAttack(5, 1, true)>0) && (this->figureisunderAttack(4, 1, true)>0) && (this->figureisunderAttack(3, 1, true)>0))
return false;
else
return true;
}
else
return false;
}
if (nx == 7 && myboard->getcastleKs(0))
{
if ((myboard->getPieceonPos(6, 1) == 'e') && (myboard->getPieceonPos(7, 1) == 'e'))
{
if ((this->figureisunderAttack(5, 1, true)>0) && (this->figureisunderAttack(6, 1, true)>0) && (this->figureisunderAttack(7, 1, true)>0))
return false;
else
return true;
}
else
return false;
}
}
if (vy == 8)
{
if (nx == 3 && myboard->getcastleQs(1))
{
if (myboard->getPieceonPos(2, 8) == 'e' && myboard->getPieceonPos(3, 8) == 'e' && myboard->getPieceonPos(4, 8) == 'e')
{
if ((this->figureisunderAttack(5, 8, false)>0) && (this->figureisunderAttack(4, 8, false)>0) && (this->figureisunderAttack(3, 8, false)>0))
return false;
else
return true;
}
else
return false;
}
if (nx == 7 && myboard->getcastleKs(1))
{
if (myboard->getPieceonPos(6, 8) == 'e' && myboard->getPieceonPos(7, 8) == 'e')
{
if ((this->figureisunderAttack(5, 8, false)>0) && (this->figureisunderAttack(6, 8, false)>0) && (this->figureisunderAttack(7, 8, false)>0))
return false;
else
return true;
}
else
return false;
}
}
return false;
}
int Movement::figureisunderAttack(int vx, int vy, bool whitetomove)
{
//Pieces *mypiecx = new Pieces();
Board *test;
//attacks = new Board();
int attackcount = 0;
register int i, j;
mypieces->init();
// Test for night
if (whitetomove)
mypieces->setName('n');
else
mypieces->setName('N');
mypieces->setPos(vx, vy);
test = mypieces->getActMoves();
for (i = 1; i < 9; i++)
{
for (j = 1; j < 9; j++)
{
if (test->getPieceonPos(i, j) == 'x')
{
if (myboard->getPieceonPos(i, j) == mypieces->getName())
{
//attacks->setPiece(mypieces->getName(), i, j);
attackcount++;
}
}
}
}
//delete mypieces;
// Test for Pawn
//white
if (whitetomove)
{
if ((myboard->getPieceonPos(vx - 1, vy + 1) == 'p') && ((vx - 1)>0) && ((vy + 1)<9))
{
//attacks->setPiece('p', vx - 1, vy + 1);
attackcount++;
}
if ((myboard->getPieceonPos(vx + 1, vy + 1) == 'p') && ((vx + 1)<9) && ((vy + 1)<9))
{
//attacks->setPiece('p', vx + 1, vy + 1);
attackcount++;
}
}
else
{
if ((myboard->getPieceonPos(vx - 1, vy - 1) == 'P') && ((vx - 1)>0) && ((vy - 1)>0))
{
//attacks->setPiece('P', vx - 1, vy - 1);
attackcount++;
}
if ((myboard->getPieceonPos(vx + 1, vy - 1) == 'P') && ((vx + 1)<9) && ((vy - 1)>0))
{
//attacks->setPiece('P', vx + 1, vy - 1);
attackcount++;
}
}
char piece;
// Test für Turm und Dame
//gerade Linie nach oben
for (j = vy + 1; j < 9; j++)
{
piece = myboard->getPieceonPos(vx, j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'r')
{
//attacks->setPiece(piece, vx, j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'R')
{
//attacks->setPiece(piece, vx, j);
attackcount++;
}
}
}
}
}
//gerade Linie nach unten
for (j = 1; j < vy; j++)
{
piece = myboard->getPieceonPos(vx, vy - j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'r')
{
//attacks->setPiece(piece, vx, vy - j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'R')
{
//attacks->setPiece(piece, vx, vy - j);
attackcount++;
}
}
}
}
}
//gerade Linie nach rechte
for (j = vx + 1; j < 9; j++)
{
piece = myboard->getPieceonPos(j, vy);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'r')
{
//attacks->setPiece(piece, j, vy);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'R')
{
//attacks->setPiece(piece, j, vy);
attackcount++;
}
}
}
}
}
//gerade Linie nach links
for (j = vx - 1; j>0; j--)
{
piece = myboard->getPieceonPos(j, vy);
//printf("teste %d dame rook pie %c \n",j,piece);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if ((piece == 'q') || (piece == 'r'))
{
//attacks->setPiece(piece, j, vy);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if ((piece == 'Q') || (piece == 'R'))
{
//attacks->setPiece(piece, j, vy);
attackcount++;
}
}
}
}
}
// Test für Läufer und Dame
//Linie nach rechts oben
for (j = 1; j < 9; j++)
{
if (((vx + j) > 8) || ((vy + j) > 8))
break;
piece = myboard->getPieceonPos(vx + j, vy + j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'b')
{
//attacks->setPiece(piece, vx + j, vy + j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'B')
{
//attacks->setPiece(piece, vx + j, vy + j);
attackcount++;
}
}
}
}
}
//Linie rechts unten
for (j = 1; j < 9; j++)
{
if (((vx + j) > 8) || ((vy - j) < 1))
break;
piece = myboard->getPieceonPos(vx + j, vy - j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'b')
{
//attacks->setPiece(piece, vx + j, vy - j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'B')
{
//attacks->setPiece(piece, vx + j, vy - j);
attackcount++;
}
}
}
}
}
//Linie nach links unten
for (j = 1; j < 9; j++)
{
if (((vx - j) < 1) || ((vy - j) < 1))
break;
piece = myboard->getPieceonPos(vx - j, vy - j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'b')
{
//attacks->setPiece(piece, vx - j, vy - j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'B')
{
//attacks->setPiece(piece, vx - j, vy - j);
attackcount++;
}
}
}
}
}
//Linie nach links oben
for (j = 1; j < 9; j++)
{
if (((vx - j) < 1) || ((vy + j) > 8))
break;
piece = myboard->getPieceonPos(vx - j, vy + j);
if (piece != 'e')
{
if (whitetomove)
{
if (isupper(piece))
{
break;
}
else
{
if (piece == 'q' || piece == 'b')
{
//attacks->setPiece(piece, vx - j, vy + j);
attackcount++;
}
}
}
else
{
if (!isupper(piece))
{
break;
}
else
{
if (piece == 'Q' || piece == 'B')
{
//attacks->setPiece(piece, vx - j, vy + j);
attackcount++;
}
}
}
}
}
//Test auf König
if ((vy + 1) < 9)
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx, vy + 1) == 'k')
{
//attacks->setPiece('k', vx, vy + 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx, vy + 1) == 'K')
{
//attacks->setPiece('K', vx, vy + 1);
attackcount++;
}
}
}
if ((vy - 1)>0)
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx, vy - 1) == 'k')
{
//attacks->setPiece('k', vx, vy - 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx, vy - 1) == 'K')
{
//attacks->setPiece('K', vx, vy - 1);
attackcount++;
}
}
}
if ((vx - 1)>0)
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx - 1, vy) == 'k')
{
//attacks->setPiece('k', vx - 1, vy);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx - 1, vy) == 'K')
{
//attacks->setPiece('K', vx - 1, vy);
attackcount++;
}
}
}
if ((vx + 1)<9)
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx + 1, vy) == 'k')
{
//attacks->setPiece('k', vx + 1, vy);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx + 1, vy) == 'K')
{
//attacks->setPiece('K', vx + 1, vy);
attackcount++;
}
}
}
if (((vx + 1)<9) && ((vy + 1)<9))
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx + 1, vy + 1) == 'k')
{
//attacks->setPiece('k', vx + 1, vy + 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx + 1, vy + 1) == 'K')
{
//attacks->setPiece('K', vx + 1, vy + 1);
attackcount++;
}
}
}
if (((vx - 1)>0) && ((vy - 1)>0))
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx - 1, vy - 1) == 'k')
{
//attacks->setPiece('k', vx - 1, vy - 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx - 1, vy - 1) == 'K')
{
//attacks->setPiece('K', vx - 1, vy - 1);
attackcount++;
}
}
}
if (((vx - 1)>0) && ((vy + 1)<9))
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx - 1, vy + 1) == 'k')
{
//attacks->setPiece('k', vx - 1, vy + 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx - 1, vy + 1) == 'K')
{
//attacks->setPiece('K', vx - 1, vy + 1);
attackcount++;
}
}
}
if (((vx + 1)<9) && ((vy - 1)>0))
{
if (whitetomove)
{
if (myboard->getPieceonPos(vx + 1, vy - 1) == 'k')
{
//attacks->setPiece('k', vx + 1, vy - 1);
attackcount++;
}
}
else
{
if (myboard->getPieceonPos(vx + 1, vy - 1) == 'K')
{
////attacks->setPiece('K', vx + 1, vy - 1);
attackcount++;
}
}
}
//delete test;
return attackcount;
}
bool Movement::loadFromFen(std::string pos)
{
this->myboard->loadFromFen(const_cast<char*>(pos.c_str()));
return false;
}
char Movement::getPieceonPos(int abc, int zahl)
{
return myboard->getPieceonPos(abc, zahl);
}
bool Movement::getWhitehasMove()
{
return this->myboard->getwhitetoMove();
}
bool Movement::setBoard(Board *mynewBoard)
{
delete myboard;
myboard = mynewBoard->copyBoard();
return false;
}
Board *Movement::copyBoard()
{
Board *newboard = new Board();
for (int i = 1; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
newboard->setPiece(myboard->getPieceonPos(i, j), i, j);
}
}
newboard->setBewertung(myboard->getBewertung());
newboard->setFigurenwert(myboard->getFigurenwert());
newboard->setcastleQs(0, myboard->getcastleQs(0));
newboard->setcastleQs(1, myboard->getcastleQs(1));
newboard->setcastleKs(0, myboard->getcastleKs(0));
newboard->setcastleKs(1, myboard->getcastleKs(1));
newboard->setwhitetoMove(myboard->getwhitetoMove());
newboard->setEnPassant(myboard->getEnPassantField(true), true);
newboard->setEnPassant(myboard->getEnPassantField(false), false);
newboard->setZugNr(myboard->getZugNr());
newboard->setHalbzug(myboard->getHalbzug());
for (int i = 0; i < 6; i++)
{
newboard->setWiederHol(myboard->getWiederHol(i, 0, 0), i, 0, 0);
newboard->setWiederHol(myboard->getWiederHol(i, 0, 1), i, 0, 1);
newboard->setWiederHol(myboard->getWiederHol(i, 1, 0), i, 1, 0);
newboard->setWiederHol(myboard->getWiederHol(i, 1, 1), i, 1, 1);
}
newboard->setWiederCount(myboard->getWiederCount());
newboard->setWhiteKingPos(myboard->getWhiteKingPos(true), true);
newboard->setWhiteKingPos(myboard->getWhiteKingPos(false), false);
newboard->setBlackKingPos(myboard->getBlackKingPos(true), true);
newboard->setBlackKingPos(myboard->getBlackKingPos(false), false);
newboard->setRemie(myboard->getRemie(true), true);
newboard->setRemie(myboard->getRemie(true), true);
return newboard;
}
char Movement::setPiece(char pie, int vx, int vy)
{
char f = myboard->getPieceonPos(vx, vy);
myboard->setPiece(pie, vx, vy);
return f;
}
bool Movement::makenextMove(int vx, int vy, int nx, int ny, char p)
{
Zuege *akt;
char pie = myboard->getPieceonPos(vx, vy);
if ((pie == 'k') || (pie == 'K'))
{
if (vx == 5 && (nx == 7 || nx == 3) && ((ny == 1 && vy == 1) || (ny == 8 && vy == 8)))
{
return myboard->makeRochade(myboard, vx, vy, nx, ny);
}
}
if (pie == 'p' || pie == 'P')
{
if ((ny - vy) == 2 || (vy - ny) == 2)
{
myboard->setEnPassant(nx, true);
myboard->setEnPassant(ny - 1, false);
}
}
if (this->myboard->getwhitetoMove())
{
akt = new Zuege();
akt->setZugNr(myboard->getZugNr() + 1);
akt->setWhitePiece(vx, vy, nx, ny);
if (p != ' ')
akt->setWhiteTrade(p);
this->mynot->addZug(akt);
}
else
{
akt = this->mynot->getAktZug();
akt->setBlackPiece(vx, vy, nx, ny);
if (p != ' ')
akt->setBlackTrade(p);
}
bool correct = myboard->makeMove(vx, vy, nx, ny);
if (correct && p != ' ')
correct = myboard->setPieceTrade(p, nx, ny);
//delete akt;
return correct;
}
int Movement::getZugNr()
{
return this->myboard->getZugNr();
}
void Movement::printZuege()
{
printf(this->mynot->getZuegeStr());
}
void Movement::init()
{
hit = false;
this->myboard->init();
while(this->mynot->getAktZugNr()>0)
this->mynot->deleteLastZug();
//this->attacks = new Board();
this->mypieces->init();
}
| [
"hans@wornik.eu"
] | hans@wornik.eu |
951f0893079e409436ab8739ca49474f513c8049 | 2d25a9da13a82193b87e21757ea9e278e3a81cdf | /WordPattern.cpp | ee29689819d6687d830507066e97956db8f82020 | [] | no_license | gurvinder123/LeetCode-Programs | 5b7ce119dad6f20c22375a8463b80793e12bafda | 0bb85a254ce15c7e492a906decd995b07972d023 | refs/heads/master | 2020-04-07T13:30:12.037019 | 2018-11-20T15:29:21 | 2018-11-20T15:29:21 | 158,409,910 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,174 | cpp | class Solution {
public:
string extractWord(int &i, string A){
string ans = "";
while(A[i] == ' ' && i < A.size()){
i++;
}
while(A[i] != ' ' && i < A.size()){
ans = ans + A[i];
i++;
}
return ans;
}
bool wordPattern(string pattern, string str) {
int i = 0, j = 0;
map<string, char> myMap;
map<char, string> myMap1;
while(i < str.size() && j < pattern.size()){
string temp = extractWord(i, str);
char t = pattern[j];
if(myMap.find(temp) != myMap.end()){
if(myMap[temp] != t){
return false;
}
}
else{
myMap[temp] = t;
}
if(myMap1.find(t) != myMap1.end()){
if(myMap1[t] != temp){
return false;
}
}
else{
myMap1[t] = temp;
}
j++;
}
if(i < str.size() || j < pattern.size()){
return false;
}
return true;
}
};
| [
"gurvinder1114@gmail.com"
] | gurvinder1114@gmail.com |
46e1819c214b35ef0c8fe6f56ba3c348b291e0d9 | d1eedc7a76307891e24af0fec1c1fb51f4a63dcf | /topView of Binary Tree with Dictionary.cpp | 5ad68ef7ea31bc47e7724ebe62a60ab28fe423dc | [] | no_license | Tr-Harsh/Hackerrank | 6e09fbb106e0707c2d13ed97adb4004de837df3b | a999761d7cc4c5aa86713c828309e81c71da3ef3 | refs/heads/master | 2021-09-15T23:07:09.540723 | 2018-06-12T12:24:47 | 2018-06-12T12:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 883 | cpp | void topView(node * root) {
if(root==NULL){
return;
}
map<int ,int > m;
queue<pair<node*,int>> q;
vector<int> v;
int inital_h_distance=0;
q.push(make_pair(root,inital_h_distance));
while(!q.empty()){
pair<node* , int> p = q.front();
node *Node = p.first;
int h_distance = p.second;
q.pop();
if(m.find(h_distance)==m.end()){
m[h_distance] = Node->data;
v.push_back(Node->data);
cout<<Node->data<<" ";
}
if(Node->left!=NULL){
q.push(make_pair(Node->left, h_distance-1));
}
if(Node->right!=NULL){
q.push(make_pair(Node->right , h_distance+1));
}
}
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e211c12d83fdda2fd366e240d53931790070fdce | 17633d1f00948a49ebf058df74863a4992ead4f5 | /3/P3/P3/main.cpp | 9067fb407dd7ed274a7c56524a2b46808b209b3e | [
"MIT"
] | permissive | swy20190/Leetcode-Cracker | 965ae2ce9c548dc39cbe3a082258c2373301248c | 3b80eacfa63983d5fcc50442f0813296d5c1af94 | refs/heads/main | 2023-07-01T15:06:57.827192 | 2021-08-12T07:30:23 | 2021-08-12T07:30:23 | 311,195,588 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 965 | cpp | #include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
vector<char> q;
int answer = 0;
// int head = 0;
int tail = 0;
int len = s.length();
if (len == 0) {
return 0;
}
while (tail < len) {
char tmp = s[tail];
if (find(q.begin(), q.end(), tmp) == q.end()) {
q.push_back(tmp);
tail++;
if (q.size() > answer) {
answer = q.size();
}
}
else {
vector<char>::iterator iter = q.begin();
while (iter != q.end()) {
if (*iter == tmp) {
break;
}
else {
iter = q.erase(iter);
// head++;
}
}
iter = q.erase(iter);
q.push_back(tmp);
tail++;
if (q.size() > answer) {
answer = q.size();
}
}
}
return answer;
}
};
int main() {
string target = string("pwwkew");
Solution solution;
cout << solution.lengthOfLongestSubstring(target);
} | [
"midnightsun114514@gmail.com"
] | midnightsun114514@gmail.com |
0bf9ee962020bae040c8a396cc1f800fd28061bf | a15950e54e6775e6f7f7004bb90a5585405eade7 | /chrome/browser/ui/input_method/input_method_engine.h | 27648ee7798519b3fcb1bc3a4dda65db93957d87 | [
"BSD-3-Clause"
] | permissive | whycoding126/chromium | 19f6b44d0ec3e4f1b5ef61cc083cae587de3df73 | 9191e417b00328d59a7060fa6bbef061a3fe4ce4 | refs/heads/master | 2023-02-26T22:57:28.582142 | 2018-04-09T11:12:57 | 2018-04-09T11:12:57 | 128,760,157 | 1 | 0 | null | 2018-04-09T11:17:03 | 2018-04-09T11:17:03 | null | UTF-8 | C++ | false | false | 3,047 | h | // 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.
#ifndef CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
#define CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
#include <string>
#include <vector>
#include "chrome/browser/ui/ime/ime_window.h"
#include "chrome/browser/ui/ime/ime_window_observer.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
namespace content {
class RenderFrameHost;
} // namespace content
namespace input_method {
class InputMethodEngine : public InputMethodEngineBase,
public ui::ImeWindowObserver {
public:
InputMethodEngine();
~InputMethodEngine() override;
// ui::IMEEngineHandlerInterface:
bool IsActive() const override;
std::string GetExtensionId() const override;
// Creates and shows the IME window.
// Returns 0 for errors and |error| will contains the error message.
int CreateImeWindow(const extensions::Extension* extension,
content::RenderFrameHost* render_frame_host,
const std::string& url,
ui::ImeWindow::Mode mode,
const gfx::Rect& bounds,
std::string* error);
void ShowImeWindow(int window_id);
void HideImeWindow(int window_id);
void CloseImeWindows();
// input_method::InputMethodEngineBase:
void FocusOut() override;
void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override;
void UpdateComposition(const ui::CompositionText& composition_text,
uint32_t cursor_pos,
bool is_visible) override;
void CommitTextToInputContext(int context_id,
const std::string& text) override;
bool SendKeyEvent(ui::KeyEvent* ui_event, const std::string& code) override;
void ProcessKeyEvent(const ui::KeyEvent& key_event,
KeyEventDoneCallback callback) override;
private:
// ui::ImeWindowObserver:
void OnWindowDestroyed(ui::ImeWindow* ime_window) override;
ui::ImeWindow* FindWindowById(int window_id) const;
// Checks if the page is special page that we want to disable some key events.
bool IsSpecialPage(ui::InputMethod* method);
// Checks if the key event are whitelisted key for all pages.
bool IsValidKeyForAllPages(ui::KeyEvent* ui_event);
// Holds the IME window instances for properly closing in the destructor.
// The follow-cursor window is singleton.
// The normal windows cannot exceed the max count.
ui::ImeWindow* follow_cursor_window_; // Weak.
std::vector<ui::ImeWindow*> normal_windows_; // Weak.
// Tracks the current cursor bounds so that the new follow cursor window can
// be aligned with cursor once it being created.
gfx::Rect current_cursor_bounds_;
DISALLOW_COPY_AND_ASSIGN(InputMethodEngine);
};
} // namespace input_method
#endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
a49bce51979f569a07028b29387369e288e27851 | 5610d502f019f23c7c12acac44b36a1ab068c054 | /GUI_Funkcije.cpp | 5f3a159fd8a22cac03c07f2bb5b00bd7840d57f7 | [] | no_license | elvircrn/ccppcodes | 7f301760a1cbe486f3991d394d5355483fbf27dd | b5d72b875b5082042826c86643d6f5e47ab2d768 | refs/heads/master | 2021-01-01T05:46:37.476763 | 2015-10-14T17:47:57 | 2015-10-14T17:47:57 | 44,265,359 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 746 | cpp | #include "GUI_Funkcije.h"
GlavnoStanje* extStanje;
///POSTAVLJANJE SVJETLA - GUMB FUNKCIJA
void PosSvjetGUI()
{
extStanje->PostaviSvjetlo();
}
void PosTrigGUI()
{
extStanje->PostaviMobTrigger();
}
void GlavnoStanje::PostaviSvjetlo()
{
if(postavljaSvjetlo==false)
{
postavljaSvjetlo=true;
postavljenoSvjetlo=DodajSvjetlo(true);
postavljenoSvjetlo->Init(mis, 128, this);
postavljenoSvjetlo->Postavke(Vec3(1.0, 1.0, 1.0), 8);
}
}
void GlavnoStanje::PostaviMobTrigger()
{
if(postavljaMobTrigger==0)
{
postavljaMobTrigger=1;
triggeri.push_back(new Trigger());
}
}
///GENERIRANJE PRAzNOG LEVELA FUNKCIJA
void GenPrazniLevelGUI()
{
extStanje->GenerirajPrazanLevel();
}
void SpremiLevelGUI()
{
extStanje->SpremiBlokove();
} | [
"elvircrn@gmail.com"
] | elvircrn@gmail.com |
2875efc9db76dd246dc7a52d3f6d0c6f585c19bb | 6438fb6f77af34bf8ddf8f000c793b97f1b6f23e | /ESP8266-MQTT-basic.ino | 5d612b6bd0d23f2bd8a9190a2fa0ca22014bd9aa | [] | no_license | oldGreg5/ESP8266-MQTT-basic | 7a5057d11fbae9cad24b892317ed806c3ce6968f | ea9d032467fedec0b6ed706728cb523e62a0d3ed | refs/heads/master | 2021-01-16T21:27:06.104121 | 2016-09-19T11:18:57 | 2016-09-19T11:18:57 | 68,598,099 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,668 | ino | /*
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two seconds
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
- If the first character of the topic "inTopic" is an 1, switch ON the ESP Led,
else switch it off
It will reconnect to the server if the connection is lost using a blocking
reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to
achieve the same result without blocking the main loop.
To install the ESP8266 board, (using Arduino 1.6.4+):
- Add the following 3rd party board manager under "File -> Preferences -> Additional Boards Manager URLs":
http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Open the "Tools -> Board -> Board Manager" and click install for the ESP8266"
- Select your ESP8266 in "Tools -> Board"
*/
#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Update these with values suitable for your network.
const char* ssid = "";
const char* password = "";
const char* mqtt_server = "iot.eclipse.org";
const char* deviceName = "ESP8266Client_1";
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
char msg[50];
int value = 0;
void setup() {
pinMode(2, OUTPUT); // Initialize the BUILTIN_LED pin as an output
Serial.begin(115200);
WiFi.mode(WIFI_STA);
setup_wifi();
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
ArduinoOTA.begin();
}
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
// Switch on the LED if an 1 was received as first character
if ((char)payload[0] == '1') {
digitalWrite(2, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
} else {
digitalWrite(2, HIGH); // Turn the LED off by making the voltage HIGH
}
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect(deviceName)) {
Serial.println("connected");
// Once connected, publish an announcement...
client.publish("outTopic", "hello world");
// ... and resubscribe
client.subscribe("inTopic");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
long now = millis();
if (now - lastMsg > 2000) {
lastMsg = now;
++value;
snprintf (msg, 75, "hello world 2 #%ld", value);
Serial.print("Publish message: ");
Serial.println(msg);
client.publish("outTopic", msg);
}
ArduinoOTA.handle();
}
| [
"janusz.janus@ericsson.com"
] | janusz.janus@ericsson.com |
475471c1aa5f7bdc4496fb730c450c395f61fbf9 | d4042c55c865ab21ed8de27cbe4b6f0c76b20aa8 | /Seraph/MetaDataUploadDetail.h | 45505a898a85cd3adea5bb27e2b7a5fd4494dc00 | [] | no_license | LeonColt/skripsi | a1f207622a3c4aabab0f951e4f08767f3d085ba2 | 141af593ec65cd7adaedf7a90fc4cd7cde5cc602 | refs/heads/master | 2020-08-02T11:40:06.134151 | 2019-09-27T14:33:27 | 2019-09-27T14:33:27 | 211,331,309 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 779 | h | #pragma once
#include "Local.h"
class MetaDataUploadDetail {
private:
QWORD id;
tstring name;
tstring path;
QWORD parent;
QWORD size;
bool as_directory;
public:
MetaDataUploadDetail();
void setId( QWORD id ) noexcept;
void setName( LPCTSTR name ) noexcept;
void setName( tstring& name ) noexcept;
void setName( tstring* name ) noexcept;
void setPath( LPCTSTR path ) noexcept;
void setPath( tstring& path ) noexcept;
void setPath( tstring* path ) noexcept;
void asDirectory( bool as_directory = true ) noexcept;
QWORD getId() const noexcept;
std::unique_ptr<tstring> getPath() const noexcept;
std::unique_ptr<tstring> getName() const noexcept;
QWORD getSize() const;
bool isDirectory() const noexcept;
~MetaDataUploadDetail();
};
| [
"lionmanbloodsucker@yahoo.com"
] | lionmanbloodsucker@yahoo.com |
5b29f4ad50009dfd556eed7b75d7e564f13f9065 | aa0168a62f7629c08f4d30d8719fe4239e978cfb | /libsrc/MapFunction.cpp | 9e70c37ab95aea2499d9fbc48ac7b3d3f2647534 | [] | no_license | Shicheng-Guo/rvtests | e41416785f42e4ff7da87f633ffff86dd64eaf60 | be1bd88b2bd663804bb8c2aff8a4d990a29850d2 | refs/heads/master | 2020-04-07T10:51:02.496565 | 2018-10-05T05:59:27 | 2018-10-05T05:59:27 | 158,302,712 | 1 | 0 | null | 2018-11-19T23:20:09 | 2018-11-19T23:20:08 | null | UTF-8 | C++ | false | false | 1,274 | cpp | //////////////////////////////////////////////////////////////////////
// libsrc/MapFunction.cpp
// (c) 2000-2010 Goncalo Abecasis
//
// This file is distributed as part of the Goncalo source code package
// and may not be redistributed in any form, without prior written
// permission from the author. Permission is granted for you to
// modify this file for your own personal use, but modified versions
// must retain this copyright notice and must not be distributed.
//
// Permission is granted for you to use this file to compile Goncalo.
//
// All computer programs have bugs. Use this file at your own risk.
//
// Sunday May 02, 2010
//
#include "MapFunction.h"
#include "MathConstant.h"
#include <math.h>
double DistanceToRecombination(double distance)
{
return (1.0 - exp(-2.0 * distance)) * 0.5;
}
double RecombinationToDistance(double recombination)
{
return (log(max(1.0 - 2 * recombination, 1e-7)) * -0.5);
}
double KosambiDistanceToRecombination(double distance)
{
double e_to_4x = exp(4.0 * distance);
return (0.5 * (e_to_4x - 1.0) / (e_to_4x + 1.0));
}
double RecombinationToKosambiDistance(double theta)
{
return 0.25 * log((1.0 + 2*theta) / max(1.0 - 2.0*theta, 1e-7));
}
| [
"zhanxw@gmail.com"
] | zhanxw@gmail.com |
bce8b693220297ff95853f4873f2d2c8cd650bb8 | 36ed183a80fca0fb4981de35fee30d027bf67d1a | /Assessment/Project3/Project3/Source.cpp | ad5bda4e560ce30860293c8fea87638cb7e2e9d9 | [] | no_license | SnailForce/The-Design-And-Analysis-Of-Algorithms | accbab323fd510e05ed5877a9d8153da4a2d83f4 | a2f5b79cef7fbab1ff22a01d3e94e9426e575746 | refs/heads/master | 2022-11-14T15:22:09.524966 | 2020-07-09T02:24:37 | 2020-07-09T02:24:37 | 276,332,821 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,082 | cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
using namespace std;
constexpr auto N = 10;
constexpr auto INF = 10000;
class TSP
{
private:
size_t numOfCity;
size_t r;
vector<vector<int>> distance;
vector<vector<int>> dp;
public:
TSP();
void getShortestDistance();
void printDP();
};
TSP::TSP()
{
cout << "input citys' num " << endl;
cin >> numOfCity;
r = 1 << (numOfCity - 1); // dp矩阵每一行的维度
cout << "input citys' distance " << endl;
/*
10000 8 5 36
6 10000 9 5
8 8 10000 5
7 7 8 10000
*/
for (size_t i = 0; i < numOfCity; i++)
{
vector<int> tmp;
for (size_t j = 0; j < numOfCity; j++)
{
int u;
cin >> u;
tmp.push_back(u);
}
distance.push_back(tmp);
}
for (size_t i = 0; i < numOfCity; i++)
{
vector<int> tmp;
tmp.assign(r, INF); // 初始化为最大值
dp.push_back(tmp);
}
}
void TSP::getShortestDistance()
{
for (size_t i = 0; i < numOfCity; i++)
{
dp.at(i).at(0) = distance.at(i).at(0); // 第一列相当于从源点直接到达目的点
}
for (size_t j = 1; j < r; j++)
{
for (size_t i = 0; i < numOfCity; i++)
{
// 判断该组合是否包含源点
if (i > 0 && ((j >> (i - 1)) & 1) == 1)
{
continue;
}
for (size_t k = 1; k < numOfCity; k++)
{
// 判断k城市是否在当前组合j中
if ((j >> (k - 1) & 1) == 1)
{
// dp方程
if (dp.at(i).at(j) > distance.at(i).at(k) + dp.at(k).at(j ^ (1 << (k - 1))))
{
dp.at(i).at(j) = distance.at(i).at(k) + dp.at(k).at(j ^ (1 << (k - 1)));
}
}
}
}
}
}
// 打印dp数组
void TSP::printDP()
{
for (size_t i = 0; i < numOfCity; i++)
{
for (size_t j = 0; j < r; j++)
{
cout << dp.at(i).at(j) << "\t";
}
cout << endl;
}
// 第一行最后一个刚好是结果
cout << "The length of the shortest path is " << dp.at(0).back() << endl;
}
int main()
{
auto task = new TSP();
task->getShortestDistance();
task->printDP();
return 0;
} | [
"1078374406@qq.com"
] | 1078374406@qq.com |
cf4d544237461877a2c54697299ca8ecaa02e58b | a45067a48af5e720dc6144b39685d3b1fba0432f | /c++Primer/7单元/5.cpp | 065e49c76e1b57f602deac992d5827feb2909785 | [] | no_license | lihao779/linuxsys | b8cb1d5a42a2a32fb648a094c4332e68ca501f71 | c445ff7d11ae546f3ca71aa430c7f788cf7e2e39 | refs/heads/master | 2023-05-29T17:28:54.924952 | 2021-06-15T14:26:03 | 2021-06-15T14:26:03 | 305,936,508 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,203 | cpp | #include <iostream>
#include <vector>
#include <string>
class Screen
{
public:
typedef std::string::size_type pos;
friend class Window_mgr;
public:
void some_member()const
{
++access_ctr;
}
public:
Screen() = default;
Screen(pos ht,pos wd,char ch = ' ')
:height(ht)
,width(wd)
,contents(ht * wd,ch)
{}
char get()
{
return contents[cursor];
}
inline char get(pos r,pos c);
Screen& move(pos r,pos c);
Screen& set(char ch);
Screen& set(pos r,pos c,char ch);
const Screen& display(std::ostream& os)const;
Screen& display(std::ostream& os);
private:
void do_display(std::ostream& os)const
{
os << contents;
}
private:
pos height,width;
pos cursor = 0; //光标
std::string contents;
mutable size_t access_ctr = 0;
};
inline char Screen::get(pos r,pos c)
{
pos row = r * width;
return contents[row + c];
}
Screen& Screen::move(pos r,pos c)
{
pos row = r * width;
cursor = row + c;
return *this;
}
inline Screen& Screen::set(char ch)
{
contents[cursor] = ch;
return *this;
}
inline Screen& Screen::set(pos r,pos c,char ch)
{
pos row = r * width;
contents[row + c] = ch;
return *this;
}
const Screen& Screen::display(std::ostream& os)const
{
do_display(os);
return *this;
}
Screen& Screen::display(std::ostream& os)
{
do_display(os);
return *this;
}
class Window_mgr
{
public:
typedef std::vector<Screen>::size_type ScreenIndex;
public:
Window_mgr()
:screen{Screen(24,80,' ')}
{}
void clear(ScreenIndex);
private:
std::vector<Screen> screen;
};
void Window_mgr::clear(ScreenIndex i)
{
Screen& s = screen[i];
s.contents = std::string(s.height*s.width,' ');
}
void Test()
{
Screen myScreen(5,5,'X');
myScreen.move(4,0).set('#').display(std::cout);
std::cout << "\n";
myScreen.display(std::cout);
std::cout << "\n";
}
int main()
{
Test();
return 0;
}
| [
"3024978915@qq.com"
] | 3024978915@qq.com |
f8c5fe1a9164e614295458c110b59a83421cfa81 | ced0e9a69b30a7c4492291af41ed70d380410c76 | /FIT2049 - Week 3 Solution/Balloon.h | 033eb1b525c2ae2a222a532cea83a4fe9c7e497f | [] | no_license | mattskel/FIT2049Assignment2 | 38d89b481fb6a9b107504fd168322e6392336f66 | 714ff6db2fef3ef465c31f0379a15b87bed3a005 | refs/heads/master | 2020-04-23T21:12:57.255309 | 2016-09-23T08:24:01 | 2016-09-23T08:24:01 | 67,715,082 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | h | /*
* Balloon Class
* Balloon follows each Kart
* When a Kart is hit the Balloon is lost and floats into the air
*/
#ifndef BALLOON_H
#define BALLOON_H
#include "GameObject.h"
class Kart;
class Balloon : public GameObject {
private:
Vector3 m_displacement;
Vector3 m_currentPosition;
Kart* m_parentKart;
boolean m_lifeLost;
int m_timeStart;
public:
Balloon(Mesh* mesh,
Shader* shader,
Texture* texture,
Vector3 displacement,
Kart* parentKart);
void Update(float timestep);
void SetLifeLost() { m_lifeLost = true; }
};
#endif | [
"mattskelley@hotmail.com"
] | mattskelley@hotmail.com |
ed2ebcdf63a7612aba1233ff99a9231aa1d1ce90 | 39e6cf4ef62e2de96221a6a28af834c98ab6e5a9 | /drm/1.0/vts/functional/include/android/hardware/drm/1.0/vts/drm_hal_clearkey_test.h | ca707b81fbe3ddcc3ca66767c08376c4cbded4f5 | [
"Apache-2.0"
] | permissive | syberia-project/platform_hardware_interfaces | 8f0593eb158b8524e2cb46eb272c79a3ec8ae283 | 1d11684d99d98bd85d3cd3d0ce39274fed282f3f | refs/heads/11.0 | 2023-08-07T18:44:42.866199 | 2021-09-08T15:36:15 | 2021-09-08T15:39:05 | 145,104,702 | 0 | 10 | NOASSERTION | 2021-11-17T15:18:13 | 2018-08-17T10:02:40 | C++ | UTF-8 | C++ | false | false | 7,325 | h | /*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DRM_HAL_CLEARKEY_TEST_H
#define DRM_HAL_CLEARKEY_TEST_H
#include <android/hardware/drm/1.0/ICryptoFactory.h>
#include <android/hardware/drm/1.0/ICryptoPlugin.h>
#include <android/hardware/drm/1.0/IDrmFactory.h>
#include <android/hardware/drm/1.0/IDrmPlugin.h>
#include <android/hardware/drm/1.0/types.h>
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <gtest/gtest.h>
#include <hidl/HidlSupport.h>
#include <hidl/ServiceManagement.h>
#include <hidlmemory/mapping.h>
#include <log/log.h>
#include "drm_vts_helper.h"
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::drm_vts::DrmHalTestParam;
using ::drm_vts::PrintParamInstanceToString;
using std::string;
using std::map;
using std::vector;
/**
* These clearkey tests use white box knowledge of the legacy clearkey
* plugin to verify that the HIDL HAL services and interfaces are working.
* It is not intended to verify any vendor's HAL implementation. If you
* are looking for vendor HAL tests, see drm_hal_vendor_test.cpp
*/
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
namespace android {
namespace hardware {
namespace drm {
namespace V1_0 {
namespace vts {
class DrmHalClearkeyFactoryTest : public ::testing::TestWithParam<DrmHalTestParam> {
public:
void SetUp() override {
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("Running test %s.%s", test_info->test_case_name(),
test_info->name());
const std::string instanceName = GetParam().instance_;
drmFactory = IDrmFactory::getService(instanceName);
ASSERT_NE(nullptr, drmFactory.get());
cryptoFactory = ICryptoFactory::getService(instanceName);
ASSERT_NE(nullptr, cryptoFactory.get());
const bool drmClearKey = drmFactory->isCryptoSchemeSupported(kClearKeyUUID);
const bool cryptoClearKey = cryptoFactory->isCryptoSchemeSupported(kClearKeyUUID);
EXPECT_EQ(drmClearKey, cryptoClearKey);
const bool supportsClearKey = drmClearKey && cryptoClearKey;
const bool drmCommonPsshBox = drmFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID);
const bool cryptoCommonPsshBox = cryptoFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID);
EXPECT_EQ(drmCommonPsshBox, cryptoCommonPsshBox);
const bool supportsCommonPsshBox = drmCommonPsshBox && cryptoCommonPsshBox;
EXPECT_EQ(supportsClearKey, supportsCommonPsshBox);
correspondsToThisTest = supportsClearKey && supportsCommonPsshBox;
if (instanceName == "clearkey") {
EXPECT_TRUE(correspondsToThisTest);
// TODO(b/147449315)
// Only the clearkey plugged into the "default" instance supports
// this test. Currently the "clearkey" instance fails some tests
// here.
GTEST_SKIP() << "Clearkey tests don't work with 'clearkey' instance yet.";
}
if (!correspondsToThisTest) {
GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
}
}
protected:
static constexpr uint8_t kCommonPsshBoxUUID[16] = {
0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02,
0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B};
// To be used in mpd to specify drm scheme for players
static constexpr uint8_t kClearKeyUUID[16] = {
0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E};
sp<IDrmFactory> drmFactory;
sp<ICryptoFactory> cryptoFactory;
bool correspondsToThisTest;
};
class DrmHalClearkeyPluginTest : public DrmHalClearkeyFactoryTest {
public:
virtual void SetUp() override {
// Create factories
DrmHalClearkeyFactoryTest::SetUp();
if (!correspondsToThisTest) {
GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
}
ASSERT_NE(nullptr, drmFactory.get());
hidl_string packageName("android.hardware.drm.test");
auto res = drmFactory->createPlugin(
getUUID(), packageName,
[this](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
ASSERT_NE(nullptr, plugin.get());
drmPlugin = plugin;
});
ASSERT_OK(res);
hidl_vec<uint8_t> initVec;
res = cryptoFactory->createPlugin(
getUUID(), initVec,
[this](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
ASSERT_NE(nullptr, plugin.get());
cryptoPlugin = plugin;
});
ASSERT_OK(res);
}
SessionId openSession();
void closeSession(const SessionId& sessionId);
hidl_vec<uint8_t> loadKeys(const SessionId& sessionId, const KeyType& type);
sp<IMemory> getDecryptMemory(size_t size, size_t index);
protected:
hidl_array<uint8_t, 16> getUUID() {
if (GetParamUUID() == hidl_array<uint8_t, 16>()) {
return kClearKeyUUID;
}
return GetParamUUID();
}
hidl_array<uint8_t, 16> GetParamUUID() {
return GetParam().scheme_;
}
sp<IDrmPlugin> drmPlugin;
sp<ICryptoPlugin> cryptoPlugin;
};
class DrmHalClearkeyDecryptTest : public DrmHalClearkeyPluginTest {
public:
void SetUp() override {
DrmHalClearkeyPluginTest::SetUp();
if (!correspondsToThisTest) {
GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
}
}
void fillRandom(const sp<IMemory>& memory);
hidl_array<uint8_t, 16> toHidlArray(const vector<uint8_t>& vec) {
EXPECT_EQ(16u, vec.size());
return hidl_array<uint8_t, 16>(&vec[0]);
}
uint32_t decrypt(Mode mode, uint8_t* iv, const hidl_vec<SubSample>& subSamples,
const Pattern& pattern, Status status);
void aes_ctr_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv,
const hidl_vec<SubSample>& subSamples, const vector<uint8_t>& key);
void aes_cbc_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv,
const hidl_vec<SubSample>& subSamples, const vector<uint8_t>& key);
void decryptWithInvalidKeys(hidl_vec<uint8_t>& invalidResponse,
vector<uint8_t>& iv, const Pattern& noPattern, const vector<SubSample>& subSamples);
};
} // namespace vts
} // namespace V1_0
} // namespace drm
} // namespace hardware
} // namespace android
#endif // DRM_HAL_CLEARKEY_TEST_H
| [
"robertshih@google.com"
] | robertshih@google.com |
7d7566450413459b3aff6f5f50f711629b21cd61 | 372f94c42433fac552b105428bd66a0f491fb054 | /C/new/new_delete.cpp | 5157b1d3cc5e9cf8b872639c34d9ab8e95267d41 | [] | no_license | yuanyiyixi/C-- | 17298e3d9c8a2feca177115de3912b76791cc2a0 | 9923eb64bea9b501bacbcf0852f3f67287de809c | refs/heads/master | 2020-05-17T12:33:28.831631 | 2013-11-27T07:36:46 | 2013-11-27T07:36:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 574 | cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int *p = (int *)malloc(sizeof(int));
free(p);
int *p2 = new int;
cout << "*p2 = " << *p2 << endl;
delete p2;
int *p3 = new int(10);
cout << "*p3 = " << *p3 << endl;
delete p3;
cout << "p3 = 0x" << hex << p3 << endl << dec;
p3 = NULL;
delete p3; //对NULL指针delete不会出现double free的错误
int *p4 = new int[10];
for (int i = 0; i < 10; i++)
p4[i] = i + 1;
for (int i = 0; i < 10; i++)
cout << "p4[" << i << "] = " << p4[i] << endl;
delete[] p4;
return 0;
}
| [
"yuanyiyixi@gmail.com"
] | yuanyiyixi@gmail.com |
9a28e9ad5d2cc692432071b3e55b2fa6838d078a | a06515f4697a3dbcbae4e3c05de2f8632f8d5f46 | /corpus/taken_from_cppcheck_tests/stolen_8864.cpp | 7d0bfa87b3c4ec64f8b89c45ca91307905044ed0 | [] | no_license | pauldreik/fuzzcppcheck | 12d9c11bcc182cc1f1bb4893e0925dc05fcaf711 | 794ba352af45971ff1f76d665b52adeb42dcab5f | refs/heads/master | 2020-05-01T01:55:04.280076 | 2019-03-22T21:05:28 | 2019-03-22T21:05:28 | 177,206,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 37 | cpp | void f(void * x){printf("%I64u", x);} | [
"github@pauldreik.se"
] | github@pauldreik.se |
670eb66b75624a8fdc9fed26d8816a6fdee3a331 | f88e75cb125ee208b07c9fe85a4e0bab4fdee36c | /control/CoreThermicInfoRequest.h | 79966d0715cebd9c791066b4357a5a6e3486527e | [] | no_license | Clariones/fdti_driver_reading | 5e998b90b2c8563b1180f51ff1be0b86218de8a5 | 914e581ed43144b41545039f5054a015092bc887 | refs/heads/master | 2020-04-22T10:02:17.458735 | 2016-09-02T05:06:14 | 2016-09-02T05:06:14 | 67,191,366 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,809 | h | /*
** Copyright (C) 2010 Eff'Innov Technologies. All rights reserved.
** May not be redistributed without prior written permission.
**
** Based on Java version by DeltaDore, subject to DeltaDore copyrights
**
** Note: Eff'Innov Technologies disclaims responsibility for any malfunction
** or error that may arise from any change to the current file, provided that such
** change have not been submitted to and formerly approved by Eff'Innov Technologies,
** prior to the occurence of such malfunction or error
**
** Author: Mickael Leforestier (mickael.leforestier@effinnov.com)
**
** History log:
** ------------------------------------------------------------------------------
** Author | Date | Changes
** ------------------------------------------------------------------------------
** mleforestier | 042611 | First version
** ylebret | 280212 | refactoring
*/
#ifndef CORETHERMICINFOREQUEST_H
#define CORETHERMICINFOREQUEST_H
#include "control/CoreRmRequest.h"
#include "hvac/ThermicInfoRequest.h"
namespace deltadoreX2d
{
class CoreThermicInfoRequest : public CoreRmRequest , public virtual ThermicInfoRequest
{
public :
CoreThermicInfoRequest();
~CoreThermicInfoRequest();
const DataWay& getDataWay() const;
Family getFamily() const;
void addNode(const Node& node, const NodeArg& arg);
void serialize(std::vector<byte>& frame, const std::vector< std::vector<byte> >* receivedFrames) const;
Response* createData(const std::vector< std::vector<byte> >& frames, int indice) const;
bool instanceOf(RequestClass type) const;
Request* clone() const;
void* derived();
CoreRequest* core();
};
}
#endif // CORETHERMICINFOREQUEST_H
| [
"clariones@163.com"
] | clariones@163.com |
57cede452eea30c9cd3a0d550d9adac88e3f87b6 | 4526658d5e19cc1d858e9300ced0c93ef3db39a1 | /dialogaddeditclient.cpp | b2abe517d4cfda15dda9e10e8b042383daa30e74 | [] | no_license | freeearth/CRM_Burning_manager_qt_project | 5e789219e057b3d12345c1171896226247801417 | a10eeb33a655b0e71cc13c39785a0a2dc3d8413b | refs/heads/master | 2021-01-20T17:02:40.130506 | 2016-07-04T17:53:26 | 2016-07-04T17:53:26 | 62,578,541 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 4,161 | cpp | #include "dialogaddeditclient.h"
#include "ui_dialogaddeditclient.h"
DialogAddEditClient::DialogAddEditClient(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogAddEditClient)
{
setWindowIcon(QIcon("stranger.png"));
ui->setupUi(this);
this->Process();
//устанавливаем правила для ввода данных о номере телефона, ОГРН, Р/С счёте
QRegExp rxPhone("^[0-9\-\+]{5,40}$");
QValidator *PhoneValidator = new QRegExpValidator(rxPhone,this);
ui->lineEditAgentPhone->setValidator(PhoneValidator);
QRegExp rxOGRN("[0-9]{10,40}");
QValidator *OGRNValidator = new QRegExpValidator(rxOGRN,this);
ui->lineEditUrOGRN->setValidator(OGRNValidator);
QRegExp rxCheckingAccount("[0-9]{10,40}");
QValidator *CheckingAccountValidator = new QRegExpValidator(rxCheckingAccount,this);
ui->lineEditUrCheckingAccount->setValidator(CheckingAccountValidator );
}
void DialogAddEditClient::Process() {
connect(ui->pushButtonConfirmation,SIGNAL(clicked()),SLOT(ConfirmationBtnClick()));
connect(ui->pushButtonExit,SIGNAL(clicked()),SLOT(Exit()));
}
void DialogAddEditClient::ConfirmationBtnClick() {
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Useless Info", this->ConfirmationText,
QMessageBox::Yes|QMessageBox::Cancel);
if (reply == QMessageBox::Yes) {
try {
QString ErrMsg ="";
this->Ur_Adress = ui->textEditUrAdress->toPlainText();
this->Ur_Checking_account = ui->lineEditUrCheckingAccount->text();
this->Ur_Name = ui->textEditUrName->toPlainText();
this->OGRN = ui->lineEditUrOGRN->text();
this->Agent_FIO = ui->textEditAgentFIO->toPlainText();
this->Agent_Email = ui->textEditAgentEmail->toPlainText();
this->Agent_Phone = ui->lineEditAgentPhone->text();
if (this->Ur_Adress.isEmpty()) {
ErrMsg = ErrMsg + "Адрес юридического лица\n";
}
if (this->OGRN.isEmpty()) {
ErrMsg = ErrMsg + "ОГРН\n";
}
if (this->Ur_Name.isEmpty()) {
ErrMsg = ErrMsg + "Полное наименование юр.лица\n";
}
if (this->Ur_Checking_account.isEmpty()) {
ErrMsg = ErrMsg + "Расчётный счёт\n";
}
if (this->Agent_FIO.isEmpty()) {
ErrMsg = ErrMsg + "ФИО агента\n";
}
if (this->Agent_Email.isEmpty()) {
ErrMsg = ErrMsg + "Email агента\n";
}
if (this->Agent_Phone.isEmpty()) {
ErrMsg = ErrMsg + "Телефон агента\n";
}
if (!ErrMsg.trimmed().isEmpty()) {
Additional::ShowMessage("Не заполнены следующие поля:\n"+ErrMsg+"\Пожалуйста заполните указанные поля и повторите попытку");
return;
}
this->Modalresult = 1;
this->close();
}
catch (...) {
this->Modalresult = 2;
}
}
else {
return;
}
}
bool DialogAddEditClient::SetOldClientInformation() {
try {
ui->lineEditAgentPhone->setText(this->Agent_Phone);
ui->lineEditUrOGRN->setText(this->OGRN);
ui->lineEditUrCheckingAccount->setText(this->Ur_Checking_account);
ui->textEditAgentEmail->setText(this->Agent_Email);
ui->textEditAgentFIO->setText(this->Agent_FIO);
ui->textEditUrAdress->setText(this->Ur_Adress);
ui->textEditUrName->setText(this->Ur_Name);
return true;
}
catch (...) {
Additional::ShowMessage("Ошибка");
return false;
}
}
void DialogAddEditClient::Exit() {
this->close();
return;
}
DialogAddEditClient::~DialogAddEditClient()
{
delete ui;
}
| [
"creature@localhost.localdomain"
] | creature@localhost.localdomain |
c188f886b3cd2480d27c2be103992771b5b2e242 | 6692df512cd91d2fa602250ba35b0a52f0bd85b9 | /remocon_app_savefile_1012/remocon_app.ino | b8bba25663b7adec6efd945a122e7fdd8c7be4a1 | [] | no_license | donghee0901/Embedded | 4e735faca10dc5a14eace812ab2ea8c89edc6b87 | c4ba5d4fdcbd88fa2b3d4689b09bc6e3437a46be | refs/heads/master | 2023-01-07T19:36:40.671944 | 2020-11-02T13:55:09 | 2020-11-02T13:55:09 | 278,648,465 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,071 | ino | #include "gpio.h"
#include "fnd.h"
// FND A,B,C,D,E,F,G,DP
char fnd_pin[8] = {4, 5, 6, 7, 8, 9, 10, 11};
// FND A,B,C,D,E,F,G,DP,Common1,Common2,Common3,Common4
char fnd_pin2[12] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
void setup()
{
Serial.begin(9600);
// pinMode(13, OUTPUT);
// pin_mode(13, OUTPUT);
// fnd_init_1(fnd_pin, C_CATHODE);
fnd_init(4, fnd_pin2, C_ANODE);
}
int fndNumber = 0;
unsigned long c_millis = 0;
unsigned long p_millis = 0;
void loop()
{
c_millis = millis();
if (c_millis - p_millis > 50)
{
p_millis = c_millis;
if (fndNumber == 10000)fndNumber = 0;
fndNumber++;
}
fnd_num_millis(c_millis, fndNumber);
// for (int i = 0; i < 10; i++)
// {
// fnd_num_2(20 + i);
// delay(1000);
// }
// int in_value = digital_read(2);
// Serial.printf("in_value = %d\n", in_value);
// delay(100);
// // digitalWrite(13,HIGH);
// // PORTB |= 0x20;
// digital_write(13, HIGH);
// delay(1000);
// // digitalWrite(13,LOW);
// digital_write(13, LOW);
// delay(1000);
}
| [
"donghee0901@naver.com"
] | donghee0901@naver.com |
9a52a7de11a8828f13c7c70a59618bb1920b12b5 | 772d932a0e5f6849227a38cf4b154fdc21741c6b | /CPP_Joc_Windows_Android/SH_Client_Win_Cpp_Cmake/App/src/rpg3D/gw/entity/module/projectile/ProjectileModule.h | 5fb1f54d66e822ab90aafa7e907358cb23a9d4be | [] | no_license | AdrianNostromo/CodeSamples | 1a7b30fb6874f2059b7d03951dfe529f2464a3c0 | a0307a4b896ba722dd520f49d74c0f08c0e0042c | refs/heads/main | 2023-02-16T04:18:32.176006 | 2021-01-11T17:47:45 | 2021-01-11T17:47:45 | 328,739,437 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 302 | h | #pragma once
#include <base/gh.h>
#include "PMBase.h"
namespace rpg3D {
class ProjectileModule : public PMBase {priv typedef PMBase super;pub dCtor(ProjectileModule);
pub explicit ProjectileModule(
IWorldEntity* entity,
ProjectileTemplate* t);
pub ~ProjectileModule() override;
};
};
| [
"adriannostromo@gmail.com"
] | adriannostromo@gmail.com |
ec3f7904b4170bb661d8d2f0b866bb92b100ce25 | e79d10de5b8c8ccaeed912bf9f12dda70bfe5fe1 | /firebasebasic.ino | 18a797b85fa10da72c6684e6041b013786732953 | [] | no_license | aiityamamura/pbl | 6688cd2c836d60fa51c5259a4bc8ad89ac5f5293 | ce59c5e01480dd5b5d6d700ecb07d59cbcbe660b | refs/heads/main | 2023-08-11T01:16:03.095755 | 2021-09-19T15:04:26 | 2021-09-19T15:04:26 | 402,181,357 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,031 | ino | #define M5STACK_MPU6886
#include <Arduino.h>
#include <M5Stack.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <IOXhop_FirebaseESP32.h>
#include "ArduinoJson.h"
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define FIREBASE_DB_URL "https://.firebaseio.com/"
WiFiMulti WiFiMulti;
int count = 1;
#define SAMPLE_PERIOD 20 // サンプリング間隔(ミリ秒)
#define SAMPLE_SIZE 150 // 20ms x 150 = 3秒
float interval, preInterval;
int stepcount,state,laststate=0;
float total,threshold,hysteresis=0;
float acc_x = 0.0F;
float acc_y = 0.0F;
float acc_z = 0.0F;
void setup() {
M5.begin();
m5.Power.begin();
M5.IMU.Init();
M5.Lcd.setRotation(3);
M5.Lcd.setCursor(0, 0, 2);
WiFiMulti.addAP(WIFI_SSID,WIFI_PASSWORD);
M5.Lcd.print("Connecting");
while(WiFiMulti.run() != WL_CONNECTED) {
M5.Lcd.print(".");
delay(1000);
}
M5.Lcd.println("");
M5.Lcd.println("Connected to");
M5.Lcd.println(WiFi.localIP());
delay(500);
Firebase.begin(FIREBASE_DB_URL); // ④
}
void loop() {
for (int i = 0; i < SAMPLE_SIZE; i++) {
M5.IMU.getAccelData(&acc_x,&acc_y,&acc_z);
float accel;
accel = sqrt( sq(acc_x) + sq(acc_y) + sq(acc_z));
// 歩数カウントしきい値設定
if (i != 100) {
total += accel;} else {
threshold = total/i;
hysteresis = threshold / 10;
total = 0;
}
// 歩数カウントしきい値判定
if ( accel > (threshold + hysteresis) ) {
state = true;
} else if ( accel < (threshold - hysteresis) ) {
state = false;
}
// 歩数カウント
if (laststate == false && state == true) {
stepcount++;
laststate = state;
} else if (laststate == true && state == false) {
laststate = state;
}
Serial.print(i);
Serial.print("\t");
Serial.print(accel);
Serial.print("\t");
Serial.print("steps:");
Serial.print(stepcount);
Serial.print("\n");
}
// 歩数の出力
Serial.print("Steps:");
Serial.print(stepcount);
Serial.print("\t");
Firebase.setInt("/button", stepcount);
}
| [
"noreply@github.com"
] | noreply@github.com |
875d501da4bb981f351f5cf2798e132d2ea0b104 | 4e5488ca16bbbbae430a87486d51ab4c9c7cc959 | /strongtalk/src/cpp/main/vm/runtime/VMOperation.hpp | 343901873500c4874d716059e6548bc594b5a35b | [] | no_license | RalfBarkow/strongtalk-2020 | 3cbf0286b18e3ac48b315509e77215e8ed4c6bcd | b51c02d5e30c0c728fece29037fdcd81f7f5803a | refs/heads/master | 2023-03-19T06:22:52.079759 | 2021-03-14T20:27:14 | 2021-03-14T20:27:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,134 | hpp |
//
// (C) 1994 - 2021, The Strongtalk authors and contributors
// Refer to the "COPYRIGHTS" file at the root of this source tree for complete licence and copyright terms
//
#pragma once
#include "vm/memory/allocation.hpp"
#include "vm/runtime/Process.hpp"
#include "vm/lookup/LookupKey.hpp"
#include "vm/code/ScopeDescriptor.hpp"
// -----------------------------------------------------------------------------
std::int32_t vm_main( std::int32_t argc, char *argv[] );
std::int32_t createVMProcess();
std::int32_t vmProcessMain( void *ignored );
void load_image();
// The following classes are used for operations initiated by a delta process but must take place in the vmProcess.
class VM_Operation : public PrintableStackAllocatedObject {
private:
DeltaProcess *_calling_process;
public:
VM_Operation() :
_calling_process{ nullptr } {
}
virtual ~VM_Operation() = default;
VM_Operation( const VM_Operation & ) = default;
VM_Operation &operator=( const VM_Operation & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
void set_calling_process( DeltaProcess *p ) {
_calling_process = p;
}
DeltaProcess *calling_process() const {
return _calling_process;
}
virtual bool is_scavenge() const {
return false;
}
virtual bool is_garbage_collect() const {
return false;
}
virtual bool is_single_step() const {
return false;
}
void evaluate();
// Evaluate is called in the vmProcess
virtual void doit() = 0;
void print() {
SPDLOG_INFO( "{}", name() );
}
virtual const char *name() {
return "vanilla";
}
};
class VM_Scavenge : public VM_Operation {
private:
Oop *_addr;
public:
bool is_scavenge() const {
return true;
}
VM_Scavenge( Oop *addr ) :
VM_Operation(), _addr{ addr } {
}
VM_Scavenge() = default;
virtual ~VM_Scavenge() = default;
VM_Scavenge( const VM_Scavenge & ) = default;
VM_Scavenge &operator=( const VM_Scavenge & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
void doit();
const char *name() {
return "scavenge";
}
};
class VM_Genesis : public VM_Operation {
public:
VM_Genesis();
void doit();
const char *name() {
return "genesis";
}
};
class VM_GarbageCollect : public VM_Operation {
private:
VM_GarbageCollect();
Oop *_addr;
public:
bool is_garbage_collect() const {
return true;
}
VM_GarbageCollect( Oop *addr ) : _addr{ addr } {
}
virtual ~VM_GarbageCollect() = default;
VM_GarbageCollect( const VM_GarbageCollect & ) = default;
VM_GarbageCollect &operator=( const VM_GarbageCollect & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
void doit();
const char *name() {
return "garbage collect";
}
};
class VM_TerminateProcess : public VM_Operation {
private:
DeltaProcess *_target;
public:
VM_TerminateProcess( DeltaProcess *target ) : _target{ target } {
}
VM_TerminateProcess() = default;
virtual ~VM_TerminateProcess() = default;
VM_TerminateProcess( const VM_TerminateProcess & ) = default;
VM_TerminateProcess &operator=( const VM_TerminateProcess & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
void doit();
const char *name() {
return "terminate process";
}
};
class VM_DeoptimizeStacks : public VM_Operation {
public:
void doit();
const char *name() {
return "deoptimize stacks";
}
};
class VM_OptimizeMethod : public VM_Operation {
private:
LookupKey _key;
MethodOop _method;
NativeMethod *_nativeMethod;
public:
VM_OptimizeMethod( LookupKey *key, MethodOop method ) :
_key{ key },
_method{ method },
_nativeMethod{ nullptr } {
}
VM_OptimizeMethod() = default;
virtual ~VM_OptimizeMethod() = default;
VM_OptimizeMethod( const VM_OptimizeMethod & ) = default;
VM_OptimizeMethod &operator=( const VM_OptimizeMethod & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
NativeMethod *result() const {
return _nativeMethod;
}
void doit();
const char *name() {
return "optimize method";
}
};
// -----------------------------------------------------------------------------
class RecompilationScope;
class VM_OptimizeRScope : public VM_Operation {
private:
RecompilationScope *_scope;
NativeMethod *_nativeMethod;
public:
VM_OptimizeRScope( RecompilationScope *scope ) :
_scope{ scope },
_nativeMethod{ nullptr } {
}
VM_OptimizeRScope() = default;
virtual ~VM_OptimizeRScope() = default;
VM_OptimizeRScope( const VM_OptimizeRScope & ) = default;
VM_OptimizeRScope &operator=( const VM_OptimizeRScope & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
NativeMethod *result() const {
return _nativeMethod;
}
void doit();
const char *name() {
return "optimize rscope";
}
};
// -----------------------------------------------------------------------------
class VM_OptimizeBlockMethod : public VM_Operation {
private:
BlockClosureOop _closure;
NonInlinedBlockScopeDescriptor *_scope;
NativeMethod *_nativeMethod;
public:
VM_OptimizeBlockMethod( BlockClosureOop closure, NonInlinedBlockScopeDescriptor *scope ) :
_closure{ closure },
_scope{ scope },
_nativeMethod{ nullptr } {
}
VM_OptimizeBlockMethod() = default;
virtual ~VM_OptimizeBlockMethod() = default;
VM_OptimizeBlockMethod( const VM_OptimizeBlockMethod & ) = default;
VM_OptimizeBlockMethod &operator=( const VM_OptimizeBlockMethod & ) = default;
void operator delete( void *ptr ) { (void)(ptr); }
void doit();
NativeMethod *method() const {
return _nativeMethod;
}
const char *name() {
return "optimize block method";
}
};
| [
"hello@georgecox.com"
] | hello@georgecox.com |
e236a3ab3cf9e1fc5352f2a7ea73ef2fb5248d28 | 2321f3bc78e934249dbcb7644719d45006690be9 | /MotionTracking/utils/PlaybackDataPoints.cpp | f5b2e675ffe1562ec31c9fbaacdeb2dd3d50ecc3 | [] | no_license | cmruderman/Helping-Hand | 59425461235b14c117e160117430855168817eaa | cad2dd5207068b1dfb914e360f7a5b054bfc576b | refs/heads/master | 2021-07-08T06:30:38.384425 | 2020-07-13T14:08:36 | 2020-07-13T14:08:36 | 144,162,932 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,534 | cpp | #include <iostream>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
#include <sstream>
#include <vector>
#include "../arduino-serial-lib.h"
#include "../ms_sleep.c"
#include <iterator>
#include <fstream>
/*
This program reads from the CSV file "savedata.csv", and sends that data to the pi. Notice on line 49,
that we do not multiply the coordinate's by .1 because we have already done so when saving to our .csv file.
*/
#define STATIC_IP "192.168.1.6"
#define PORT_NUMBER "9876"
int sockfd;
unsigned int delay=50000; // .01 second delay
using namespace std;
vector<vector<float> > rectangular_prism;
ifstream infile("savedata.csv");
float x_coordinate, y_coordinate, z_coordinate, hand_pinched;
std::vector<std::string> lines_in_file;
void error(char *msg)
{
perror(msg);
exit(0);
}
void sendPlaybackData(std::string buf) {
int n = write(sockfd,buf.c_str(),buf.size()); //write to the socket
if (n < 0)
error("ERROR writing to socket");
}
void connect_to_server() {
int portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
portno = atoi(PORT_NUMBER);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
server = gethostbyname(STATIC_IP);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno);
if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
}
int main(int argc, char** argv) {
std::cout << "Begin" << std::endl;
connect_to_server();
std::cout << "Connected to Raspberry Pi" << std::endl;
std::string line;
while(std::getline(infile,line) && infile.is_open())
{
lines_in_file.push_back(line); //make file into vector
}
infile.close();
for(;;){
//loop through vector
for(vector<string>::const_iterator i = lines_in_file.begin(); i != lines_in_file.end(); ++i) {
sendPlaybackData(*i);
usleep(delay);
}
}
close(sockfd);
return 0;
} | [
"coreymruderman@gmail.com"
] | coreymruderman@gmail.com |
019c52beebc159eb88725589e615d706b642cef1 | a850af873621d1b0978a3302cbce8b7388ad32ae | /src/views.cpp | 7f763322b44d8016fe43b2d3b023e10c89ddef44 | [] | no_license | ukberry/ships | 5a1f748dc7b5be0f35fac2750b804f0df3de554e | 7ac60b5ecbb1de05c496f8dafd7ba0c1318e839d | refs/heads/master | 2020-12-24T16:14:46.160750 | 2014-08-12T06:06:49 | 2014-08-12T06:06:49 | 19,345,926 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,712 | cpp | //============================================================================
// Name : views.cpp
// Author : Sam Berry <berry.sam@gmail.com>
// Version :
// Copyright : © Sam Berry 2014. All Rights Reserved.
// Description : ShipsView class source file.
//============================================================================
#include "shipsviews.h"
#include "shaders.h"
#include <math.h>
/**
* The constructor function for the program's main view class.
*
* @author Sam Berry
*/
ShipsView::ShipsView() :
m_surface(0), m_screenflags(0), m_fullscreen(0), m_program(0), m_uniisSprite(
false), m_uniV(0), m_uniP(0), m_uniM(0), m_uniVSprite(0) {
this->m_fullscreen ? this->m_width = 1920 : this->m_width = 1024;
this->m_fullscreen ? this->m_height = 1080 : this->m_height = 768;
this->m_uniM = this->m_uniV_inv = this->m_uniM_inv = -1;
}
/**
* The destructor function for ShipsView class.
*
* @author Sam Berry
*/
ShipsView::~ShipsView() {
this->m_surface = SDL_SetVideoMode(0, 0, 0, this->m_screenflags);
if (this->m_surface)
SDL_FreeSurface(this->m_surface);
if (m_program) {
glDeleteProgram(m_program);
std::cout << "OpenGL program freed from graphics card.\n";
}
}
/**
* Creates the window and compiles the GLSL shaders on the graphics card.
*
* @returns int Returns 0 if successful.
*/
int ShipsView::CreateView() {
// Initialise SDL
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
return 1;
// If it hasn't already been created (it shouldn't have), create a new window.
if (!this->m_surface)
this->m_surface = SDL_SetVideoMode(m_width, m_height, 32,
SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL);
// If this function fails, then we can't continue; return a fail code.
if (!this->m_surface)
return 1;
this->m_screenflags = this->m_surface->flags;
if (this->m_fullscreen)
this->m_surface = SDL_SetVideoMode(0, 0, 0,
this->m_screenflags | SDL_FULLSCREEN);
SDL_ShowCursor(1);
/* Extension wrangler initialising */
GLenum glew_status = glewInit();
if (glew_status != GLEW_OK) {
std::cerr << "Error: " << glewGetErrorString(glew_status) << "\n";
return EXIT_FAILURE;
}
m_program = create_program();
if (!m_program) {
std::cerr << "Error: Failed to compile shaders on the graphics card\n";
return EXIT_FAILURE;
}
// Obtain references to the shaders' uniform variables
this->m_uniM = glGetUniformLocation(m_program, "M");
this->m_uniV = glGetUniformLocation(m_program, "V");
this->m_uniP = glGetUniformLocation(m_program, "P");
this->m_uniM_inv = glGetUniformLocation(m_program, "Minv");
this->m_uniV_inv = glGetUniformLocation(m_program, "Vinv");
this->m_uniisSprite = glGetUniformLocation(m_program, "isSprite");
this->m_uniVSprite = glGetUniformLocation(m_program, "VSprite");
if (m_uniM_inv < 0) {
std::cerr
<< "Error: Failed to obtain location of transformation matrix\n";
return EXIT_FAILURE;
}
float gWidth, gHeight;
gWidth = m_width;
gHeight = m_height;
//glClearColor(192.0f/255.0f, 0, 0, 1.0f);
glClearColor(0., 0., 0., 1.);
glClearDepth(1.0f);
glUseProgram(m_program);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
//glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
glLineWidth(1.5f);
// Set the window's title.
SDL_WM_SetCaption("Ships <alpha> - Sam Berry", 0);
glm::mat4 VSprite = glm::ortho(-gWidth / 2, gWidth / 2, -gHeight / 2,
gHeight / 2, -10.0f, 10.0f);
glUniformMatrix4fv(ShipsController::GetInstance()->GetView()->GetVSprite(),
1, GL_FALSE, glm::value_ptr(VSprite));
// Return OK
return 0;
}
int ShipsView::GetWidth() {
return this->m_width;
}
int ShipsView::GetHeight() {
return this->m_height;
}
GLuint ShipsView::GetGraphicsProg() {
return this->m_program;
}
GLint ShipsView::GetM() {
if (this->m_uniM < 0)
throw "OpenGL program not compiled yet!";
return this->m_uniM;
}
GLint ShipsView::GetV() {
if (this->m_uniV < 0)
throw "OpenGL program not compiled yet!";
return this->m_uniV;
}
GLint ShipsView::GetP() {
if (this->m_uniP < 0)
throw "OpenGL program not compiled yet!";
return this->m_uniP;
}
GLint ShipsView::GetV_inv() {
if (this->m_uniV_inv < 0)
//throw "OpenGL program not compiled yet!";
return this->m_uniV_inv;
}
GLint ShipsView::GetM_inv() {
if (this->m_uniM_inv < 0)
throw "OpenGL program not compiled yet!";
return this->m_uniM_inv;
}
GLint ShipsView::GetisSprite() {
return this->m_uniisSprite;
}
GLint ShipsView::GetVSprite() {
if (this->m_uniVSprite < 0)
throw "OpenGL program not compiled yet!";
return this->m_uniVSprite;
}
| [
"berry.sam@gmail.com"
] | berry.sam@gmail.com |
458003a7943d5b4aa46681741edfcaa8214c5409 | 28a09828c0e74950fddc31312a0f0d564cd5fcf8 | /src/test/coins_tests.cpp | 562e056cb4955d472b2e4577d28b87e3e354359c | [
"MIT"
] | permissive | jestevez/community-source | ba58c0a26ed5f8cebe6e6b5f454b42f9d7b46a8c | d9664b55222acf99f4d9afd28205f14bcc8e238e | refs/heads/master | 2020-05-06T20:20:39.739051 | 2019-03-05T19:05:06 | 2019-03-05T19:05:06 | 180,233,996 | 2 | 0 | MIT | 2019-04-08T21:14:38 | 2019-04-08T21:14:38 | null | UTF-8 | C++ | false | false | 37,574 | cpp | // Copyright (c) 2014-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "coins.h"
#include "script/standard.h"
#include "uint256.h"
#include "undo.h"
#include "utilstrencodings.h"
#include "test/test_community.h"
#include "test/test_random.h"
#include "validation.h"
#include "consensus/validation.h"
#include <vector>
#include <map>
#include <boost/test/unit_test.hpp>
int ApplyTxInUndo(Coin&& undo, CCoinsViewCache& view, const COutPoint& out);
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txundo, int nHeight);
namespace
{
//! equality test
bool operator==(const Coin &a, const Coin &b) {
// Empty Coin objects are always equal.
if (a.IsSpent() && b.IsSpent()) return true;
return a.fCoinBase == b.fCoinBase &&
a.nHeight == b.nHeight &&
a.out == b.out;
}
class CCoinsViewTest : public CCoinsView
{
uint256 hashBestBlock_;
std::map<COutPoint, Coin> map_;
public:
bool GetCoin(const COutPoint& outpoint, Coin& coin) const override
{
std::map<COutPoint, Coin>::const_iterator it = map_.find(outpoint);
if (it == map_.end()) {
return false;
}
coin = it->second;
if (coin.IsSpent() && insecure_rand() % 2 == 0) {
// Randomly return false in case of an empty entry.
return false;
}
return true;
}
uint256 GetBestBlock() const override { return hashBestBlock_; }
bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) override
{
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) {
if (it->second.flags & CCoinsCacheEntry::DIRTY) {
// Same optimization used in CCoinsViewDB is to only write dirty entries.
map_[it->first] = it->second.coin;
if (it->second.coin.IsSpent() && insecure_rand() % 3 == 0) {
// Randomly delete empty entries on write.
map_.erase(it->first);
}
}
mapCoins.erase(it++);
}
if (!hashBlock.IsNull())
hashBestBlock_ = hashBlock;
return true;
}
};
class CCoinsViewCacheTest : public CCoinsViewCache
{
public:
CCoinsViewCacheTest(CCoinsView* base) : CCoinsViewCache(base) {}
void SelfTest() const
{
// Manually recompute the dynamic usage of the whole data, and compare it.
size_t ret = memusage::DynamicUsage(cacheCoins);
size_t count = 0;
for (CCoinsMap::iterator it = cacheCoins.begin(); it != cacheCoins.end(); it++) {
ret += it->second.coin.DynamicMemoryUsage();
++count;
}
BOOST_CHECK_EQUAL(GetCacheSize(), count);
BOOST_CHECK_EQUAL(DynamicMemoryUsage(), ret);
}
CCoinsMap& map() { return cacheCoins; }
size_t& usage() { return cachedCoinsUsage; }
};
}
BOOST_FIXTURE_TEST_SUITE(coins_tests, BasicTestingSetup)
static const unsigned int NUM_SIMULATION_ITERATIONS = 40000;
// This is a large randomized insert/remove simulation test on a variable-size
// stack of caches on top of CCoinsViewTest.
//
// It will randomly create/update/delete Coin entries to a tip of caches, with
// txids picked from a limited list of random 256-bit hashes. Occasionally, a
// new tip is added to the stack of caches, or the tip is flushed and removed.
//
// During the process, booleans are kept to make sure that the randomized
// operation hits all branches.
BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
{
// Various coverage trackers.
bool removed_all_caches = false;
bool reached_4_caches = false;
bool added_an_entry = false;
bool added_an_unspendable_entry = false;
bool removed_an_entry = false;
bool updated_an_entry = false;
bool found_an_entry = false;
bool missed_an_entry = false;
bool uncached_an_entry = false;
// A simple map to track what we expect the cache stack to represent.
std::map<COutPoint, Coin> result;
// The cache stack.
CCoinsViewTest base; // A CCoinsViewTest at the bottom.
std::vector<CCoinsViewCacheTest*> stack; // A stack of CCoinsViewCaches on top.
stack.push_back(new CCoinsViewCacheTest(&base)); // Start with one cache.
// Use a limited set of random transaction ids, so we do test overwriting entries.
std::vector<uint256> txids;
txids.resize(NUM_SIMULATION_ITERATIONS / 8);
for (unsigned int i = 0; i < txids.size(); i++) {
txids[i] = GetRandHash();
}
for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) {
// Do a random modification.
{
uint256 txid = txids[insecure_rand() % txids.size()]; // txid we're going to modify in this iteration.
Coin& coin = result[COutPoint(txid, 0)];
// Determine whether to test HaveCoin before or after Access* (or both). As these functions
// can influence each other's behaviour by pulling things into the cache, all combinations
// are tested.
bool test_havecoin_before = (insecure_rand() & 0x3) == 0; // TODO change to InsecureRandBits(2) when backporting Bitcoin #10321
bool test_havecoin_after = (insecure_rand() & 0x3) == 0; // TODO change to InsecureRandBits(2) when backporting Bitcoin #10321
bool result_havecoin = test_havecoin_before ? stack.back()->HaveCoin(COutPoint(txid, 0)) : false;
const Coin& entry = (insecure_rand() % 500 == 0) ? AccessByTxid(*stack.back(), txid) : stack.back()->AccessCoin(COutPoint(txid, 0));
BOOST_CHECK(coin == entry);
BOOST_CHECK(!test_havecoin_before || result_havecoin == !entry.IsSpent());
if (test_havecoin_after) {
bool ret = stack.back()->HaveCoin(COutPoint(txid, 0));
BOOST_CHECK(ret == !entry.IsSpent());
}
if (insecure_rand() % 5 == 0 || coin.IsSpent()) {
Coin newcoin;
newcoin.out.nValue = insecure_rand();
newcoin.nHeight = 1;
if (insecure_rand() % 16 == 0 && coin.IsSpent()) {
newcoin.out.scriptPubKey.assign(1 + (insecure_rand() & 0x3F), OP_RETURN);
BOOST_CHECK(newcoin.out.scriptPubKey.IsUnspendable());
added_an_unspendable_entry = true;
} else {
newcoin.out.scriptPubKey.assign(insecure_rand() & 0x3F, 0); // Random sizes so we can test memory usage accounting
(coin.IsSpent() ? added_an_entry : updated_an_entry) = true;
coin = newcoin;
}
stack.back()->AddCoin(COutPoint(txid, 0), std::move(newcoin), !coin.IsSpent() || insecure_rand() & 1);
} else {
removed_an_entry = true;
coin.Clear();
stack.back()->SpendCoin(COutPoint(txid, 0));
}
}
// One every 10 iterations, remove a random entry from the cache
if (insecure_rand() % 10) {
COutPoint out(txids[insecure_rand() % txids.size()], 0);
int cacheid = insecure_rand() % stack.size();
stack[cacheid]->Uncache(out);
uncached_an_entry |= !stack[cacheid]->HaveCoinInCache(out);
}
// Once every 1000 iterations and at the end, verify the full cache.
if (insecure_rand() % 1000 == 1 || i == NUM_SIMULATION_ITERATIONS - 1) {
for (auto it = result.begin(); it != result.end(); it++) {
bool have = stack.back()->HaveCoin(it->first);
const Coin& coin = stack.back()->AccessCoin(it->first);
BOOST_CHECK(have == !coin.IsSpent());
BOOST_CHECK(coin == it->second);
if (coin.IsSpent()) {
missed_an_entry = true;
} else {
BOOST_CHECK(stack.back()->HaveCoinInCache(it->first));
found_an_entry = true;
}
}
BOOST_FOREACH(const CCoinsViewCacheTest *test, stack) {
test->SelfTest();
}
}
if (insecure_rand() % 100 == 0) {
// Every 100 iterations, flush an intermediate cache
if (stack.size() > 1 && insecure_rand() % 2 == 0) {
unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
stack[flushIndex]->Flush();
}
}
if (insecure_rand() % 100 == 0) {
// Every 100 iterations, change the cache stack.
if (stack.size() > 0 && insecure_rand() % 2 == 0) {
//Remove the top cache
stack.back()->Flush();
delete stack.back();
stack.pop_back();
}
if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) {
//Add a new cache
CCoinsView* tip = &base;
if (stack.size() > 0) {
tip = stack.back();
} else {
removed_all_caches = true;
}
stack.push_back(new CCoinsViewCacheTest(tip));
if (stack.size() == 4) {
reached_4_caches = true;
}
}
}
}
// Clean up the stack.
while (stack.size() > 0) {
delete stack.back();
stack.pop_back();
}
// Verify coverage.
BOOST_CHECK(removed_all_caches);
BOOST_CHECK(reached_4_caches);
BOOST_CHECK(added_an_entry);
BOOST_CHECK(added_an_unspendable_entry);
BOOST_CHECK(removed_an_entry);
BOOST_CHECK(updated_an_entry);
BOOST_CHECK(found_an_entry);
BOOST_CHECK(missed_an_entry);
BOOST_CHECK(uncached_an_entry);
}
// Store of all necessary tx and undo data for next test
typedef std::map<COutPoint, std::tuple<CTransaction,CTxUndo,Coin>> UtxoData;
UtxoData utxoData;
UtxoData::iterator FindRandomFrom(const std::set<COutPoint> &utxoSet) {
assert(utxoSet.size());
auto utxoSetIt = utxoSet.lower_bound(COutPoint(GetRandHash(), 0));
if (utxoSetIt == utxoSet.end()) {
utxoSetIt = utxoSet.begin();
}
auto utxoDataIt = utxoData.find(*utxoSetIt);
assert(utxoDataIt != utxoData.end());
return utxoDataIt;
}
// This test is similar to the previous test
// except the emphasis is on testing the functionality of UpdateCoins
// random txs are created and UpdateCoins is used to update the cache stack
// In particular it is tested that spending a duplicate coinbase tx
// has the expected effect (the other duplicate is overwitten at all cache levels)
BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
{
bool spent_a_duplicate_coinbase = false;
// A simple map to track what we expect the cache stack to represent.
std::map<COutPoint, Coin> result;
// The cache stack.
CCoinsViewTest base; // A CCoinsViewTest at the bottom.
std::vector<CCoinsViewCacheTest*> stack; // A stack of CCoinsViewCaches on top.
stack.push_back(new CCoinsViewCacheTest(&base)); // Start with one cache.
// Track the txids we've used in various sets
std::set<COutPoint> coinbase_coins;
std::set<COutPoint> disconnected_coins;
std::set<COutPoint> duplicate_coins;
std::set<COutPoint> utxoset;
for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) {
uint32_t randiter = insecure_rand();
// 19/20 txs add a new transaction
if (randiter % 20 < 19) {
CMutableTransaction tx;
tx.vin.resize(1);
tx.vout.resize(1);
tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate
tx.vout[0].scriptPubKey.assign(insecure_rand() & 0x3F, 0); // Random sizes so we can test memory usage accounting
unsigned int height = insecure_rand();
Coin old_coin;
// 2/20 times create a new coinbase
if (randiter % 20 < 2 || coinbase_coins.size() < 10) {
// 1/10 of those times create a duplicate coinbase
if (insecure_rand() % 10 == 0 && coinbase_coins.size()) {
auto utxod = FindRandomFrom(coinbase_coins);
// Reuse the exact same coinbase
tx = std::get<0>(utxod->second);
// shouldn't be available for reconnection if its been duplicated
disconnected_coins.erase(utxod->first);
duplicate_coins.insert(utxod->first);
}
else {
coinbase_coins.insert(COutPoint(tx.GetHash(), 0));
}
assert(CTransaction(tx).IsCoinBase());
}
// 17/20 times reconnect previous or add a regular tx
else {
COutPoint prevout;
// 1/20 times reconnect a previously disconnected tx
if (randiter % 20 == 2 && disconnected_coins.size()) {
auto utxod = FindRandomFrom(disconnected_coins);
tx = std::get<0>(utxod->second);
prevout = tx.vin[0].prevout;
if (!CTransaction(tx).IsCoinBase() && !utxoset.count(prevout)) {
disconnected_coins.erase(utxod->first);
continue;
}
// If this tx is already IN the UTXO, then it must be a coinbase, and it must be a duplicate
if (utxoset.count(utxod->first)) {
assert(CTransaction(tx).IsCoinBase());
assert(duplicate_coins.count(utxod->first));
}
disconnected_coins.erase(utxod->first);
}
// 16/20 times create a regular tx
else {
auto utxod = FindRandomFrom(utxoset);
prevout = utxod->first;
// Construct the tx to spend the coins of prevouthash
tx.vin[0].prevout = prevout;
assert(!CTransaction(tx).IsCoinBase());
}
// In this simple test coins only have two states, spent or unspent, save the unspent state to restore
old_coin = result[prevout];
// Update the expected result of prevouthash to know these coins are spent
result[prevout].Clear();
utxoset.erase(prevout);
// The test is designed to ensure spending a duplicate coinbase will work properly
// if that ever happens and not resurrect the previously overwritten coinbase
if (duplicate_coins.count(prevout)) {
spent_a_duplicate_coinbase = true;
}
}
// Update the expected result to know about the new output coins
assert(tx.vout.size() == 1);
const COutPoint outpoint(tx.GetHash(), 0);
result[outpoint] = Coin(tx.vout[0], height, CTransaction(tx).IsCoinBase());
// Call UpdateCoins on the top cache
CTxUndo undo;
UpdateCoins(tx, *(stack.back()), undo, height);
// Update the utxo set for future spends
utxoset.insert(outpoint);
// Track this tx and undo info to use later
utxoData.emplace(outpoint, std::make_tuple(tx,undo,old_coin));
} else if (utxoset.size()) {
//1/20 times undo a previous transaction
auto utxod = FindRandomFrom(utxoset);
CTransaction &tx = std::get<0>(utxod->second);
CTxUndo &undo = std::get<1>(utxod->second);
Coin &orig_coin = std::get<2>(utxod->second);
// Update the expected result
// Remove new outputs
result[utxod->first].Clear();
// If not coinbase restore prevout
if (!tx.IsCoinBase()) {
result[tx.vin[0].prevout] = orig_coin;
}
// Disconnect the tx from the current UTXO
// See code in DisconnectBlock
// remove outputs
stack.back()->SpendCoin(utxod->first);
// restore inputs
if (!tx.IsCoinBase()) {
const COutPoint &out = tx.vin[0].prevout;
Coin coin = undo.vprevout[0];
ApplyTxInUndo(std::move(coin), *(stack.back()), out);
}
// Store as a candidate for reconnection
disconnected_coins.insert(utxod->first);
// Update the utxoset
utxoset.erase(utxod->first);
if (!tx.IsCoinBase())
utxoset.insert(tx.vin[0].prevout);
}
// Once every 1000 iterations and at the end, verify the full cache.
if (insecure_rand() % 1000 == 1 || i == NUM_SIMULATION_ITERATIONS - 1) {
for (auto it = result.begin(); it != result.end(); it++) {
bool have = stack.back()->HaveCoin(it->first);
const Coin& coin = stack.back()->AccessCoin(it->first);
BOOST_CHECK(have == !coin.IsSpent());
BOOST_CHECK(coin == it->second);
}
}
// One every 10 iterations, remove a random entry from the cache
if (utxoset.size() > 1 && insecure_rand() % 30) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(utxoset)->first);
}
if (disconnected_coins.size() > 1 && insecure_rand() % 30) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(disconnected_coins)->first);
}
if (duplicate_coins.size() > 1 && insecure_rand() % 30) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(duplicate_coins)->first);
}
if (insecure_rand() % 100 == 0) {
// Every 100 iterations, flush an intermediate cache
if (stack.size() > 1 && insecure_rand() % 2 == 0) {
unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
stack[flushIndex]->Flush();
}
}
if (insecure_rand() % 100 == 0) {
// Every 100 iterations, change the cache stack.
if (stack.size() > 0 && insecure_rand() % 2 == 0) {
stack.back()->Flush();
delete stack.back();
stack.pop_back();
}
if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) {
CCoinsView* tip = &base;
if (stack.size() > 0) {
tip = stack.back();
}
stack.push_back(new CCoinsViewCacheTest(tip));
}
}
}
// Clean up the stack.
while (stack.size() > 0) {
delete stack.back();
stack.pop_back();
}
// Verify coverage.
BOOST_CHECK(spent_a_duplicate_coinbase);
}
BOOST_AUTO_TEST_CASE(ccoins_serialization)
{
// Good example
CDataStream ss1(ParseHex("97f23c835800816115944e077fe7c803cfa57f29b36bf87c1d35"), SER_DISK, CLIENT_VERSION);
Coin cc1;
ss1 >> cc1;
BOOST_CHECK_EQUAL(cc1.fCoinBase, false);
BOOST_CHECK_EQUAL(cc1.nHeight, 203998);
BOOST_CHECK_EQUAL(cc1.out.nValue, 60000000000ULL);
BOOST_CHECK_EQUAL(HexStr(cc1.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("816115944e077fe7c803cfa57f29b36bf87c1d35"))))));
// Good example
CDataStream ss2(ParseHex("8ddf77bbd123008c988f1a4a4de2161e0f50aac7f17e7f9555caa4"), SER_DISK, CLIENT_VERSION);
Coin cc2;
ss2 >> cc2;
BOOST_CHECK_EQUAL(cc2.fCoinBase, true);
BOOST_CHECK_EQUAL(cc2.nHeight, 120891);
BOOST_CHECK_EQUAL(cc2.out.nValue, 110397);
BOOST_CHECK_EQUAL(HexStr(cc2.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("8c988f1a4a4de2161e0f50aac7f17e7f9555caa4"))))));
// Smallest possible example
CDataStream ss3(ParseHex("000006"), SER_DISK, CLIENT_VERSION);
Coin cc3;
ss3 >> cc3;
BOOST_CHECK_EQUAL(cc3.fCoinBase, false);
BOOST_CHECK_EQUAL(cc3.nHeight, 0);
BOOST_CHECK_EQUAL(cc3.out.nValue, 0);
BOOST_CHECK_EQUAL(cc3.out.scriptPubKey.size(), 0);
// scriptPubKey that ends beyond the end of the stream
CDataStream ss4(ParseHex("000007"), SER_DISK, CLIENT_VERSION);
try {
Coin cc4;
ss4 >> cc4;
BOOST_CHECK_MESSAGE(false, "We should have thrown");
} catch (const std::ios_base::failure& e) {
}
// Very large scriptPubKey (3*10^9 bytes) past the end of the stream
CDataStream tmp(SER_DISK, CLIENT_VERSION);
uint64_t x = 3000000000ULL;
tmp << VARINT(x);
BOOST_CHECK_EQUAL(HexStr(tmp.begin(), tmp.end()), "8a95c0bb00");
CDataStream ss5(ParseHex("00008a95c0bb00"), SER_DISK, CLIENT_VERSION);
try {
Coin cc5;
ss5 >> cc5;
BOOST_CHECK_MESSAGE(false, "We should have thrown");
} catch (const std::ios_base::failure& e) {
}
}
const static COutPoint OUTPOINT;
const static CAmount PRUNED = -1;
const static CAmount ABSENT = -2;
const static CAmount FAIL = -3;
const static CAmount VALUE1 = 100;
const static CAmount VALUE2 = 200;
const static CAmount VALUE3 = 300;
const static char DIRTY = CCoinsCacheEntry::DIRTY;
const static char FRESH = CCoinsCacheEntry::FRESH;
const static char NO_ENTRY = -1;
const static auto FLAGS = {char(0), FRESH, DIRTY, char(DIRTY | FRESH)};
const static auto CLEAN_FLAGS = {char(0), FRESH};
const static auto ABSENT_FLAGS = {NO_ENTRY};
void SetCoinsValue(CAmount value, Coin& coin)
{
assert(value != ABSENT);
coin.Clear();
assert(coin.IsSpent());
if (value != PRUNED) {
coin.out.nValue = value;
coin.nHeight = 1;
assert(!coin.IsSpent());
}
}
size_t InsertCoinsMapEntry(CCoinsMap& map, CAmount value, char flags)
{
if (value == ABSENT) {
assert(flags == NO_ENTRY);
return 0;
}
assert(flags != NO_ENTRY);
CCoinsCacheEntry entry;
entry.flags = flags;
SetCoinsValue(value, entry.coin);
auto inserted = map.emplace(OUTPOINT, std::move(entry));
assert(inserted.second);
return inserted.first->second.coin.DynamicMemoryUsage();
}
void GetCoinsMapEntry(const CCoinsMap& map, CAmount& value, char& flags)
{
auto it = map.find(OUTPOINT);
if (it == map.end()) {
value = ABSENT;
flags = NO_ENTRY;
} else {
if (it->second.coin.IsSpent()) {
value = PRUNED;
} else {
value = it->second.coin.out.nValue;
}
flags = it->second.flags;
assert(flags != NO_ENTRY);
}
}
void WriteCoinsViewEntry(CCoinsView& view, CAmount value, char flags)
{
CCoinsMap map;
InsertCoinsMapEntry(map, value, flags);
view.BatchWrite(map, {});
}
class SingleEntryCacheTest
{
public:
SingleEntryCacheTest(CAmount base_value, CAmount cache_value, char cache_flags)
{
WriteCoinsViewEntry(base, base_value, base_value == ABSENT ? NO_ENTRY : DIRTY);
cache.usage() += InsertCoinsMapEntry(cache.map(), cache_value, cache_flags);
}
CCoinsView root;
CCoinsViewCacheTest base{&root};
CCoinsViewCacheTest cache{&base};
};
void CheckAccessCoin(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
{
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.AccessCoin(OUTPOINT);
test.cache.SelfTest();
CAmount result_value;
char result_flags;
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
BOOST_CHECK_EQUAL(result_value, expected_value);
BOOST_CHECK_EQUAL(result_flags, expected_flags);
}
BOOST_AUTO_TEST_CASE(ccoins_access)
{
/* Check AccessCoin behavior, requesting a coin from a cache view layered on
* top of a base view, and checking the resulting entry in the cache after
* the access.
*
* Base Cache Result Cache Result
* Value Value Value Flags Flags
*/
CheckAccessCoin(ABSENT, ABSENT, ABSENT, NO_ENTRY , NO_ENTRY );
CheckAccessCoin(ABSENT, PRUNED, PRUNED, 0 , 0 );
CheckAccessCoin(ABSENT, PRUNED, PRUNED, FRESH , FRESH );
CheckAccessCoin(ABSENT, PRUNED, PRUNED, DIRTY , DIRTY );
CheckAccessCoin(ABSENT, PRUNED, PRUNED, DIRTY|FRESH, DIRTY|FRESH);
CheckAccessCoin(ABSENT, VALUE2, VALUE2, 0 , 0 );
CheckAccessCoin(ABSENT, VALUE2, VALUE2, FRESH , FRESH );
CheckAccessCoin(ABSENT, VALUE2, VALUE2, DIRTY , DIRTY );
CheckAccessCoin(ABSENT, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH);
CheckAccessCoin(PRUNED, ABSENT, ABSENT, NO_ENTRY , NO_ENTRY );
CheckAccessCoin(PRUNED, PRUNED, PRUNED, 0 , 0 );
CheckAccessCoin(PRUNED, PRUNED, PRUNED, FRESH , FRESH );
CheckAccessCoin(PRUNED, PRUNED, PRUNED, DIRTY , DIRTY );
CheckAccessCoin(PRUNED, PRUNED, PRUNED, DIRTY|FRESH, DIRTY|FRESH);
CheckAccessCoin(PRUNED, VALUE2, VALUE2, 0 , 0 );
CheckAccessCoin(PRUNED, VALUE2, VALUE2, FRESH , FRESH );
CheckAccessCoin(PRUNED, VALUE2, VALUE2, DIRTY , DIRTY );
CheckAccessCoin(PRUNED, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH);
CheckAccessCoin(VALUE1, ABSENT, VALUE1, NO_ENTRY , 0 );
CheckAccessCoin(VALUE1, PRUNED, PRUNED, 0 , 0 );
CheckAccessCoin(VALUE1, PRUNED, PRUNED, FRESH , FRESH );
CheckAccessCoin(VALUE1, PRUNED, PRUNED, DIRTY , DIRTY );
CheckAccessCoin(VALUE1, PRUNED, PRUNED, DIRTY|FRESH, DIRTY|FRESH);
CheckAccessCoin(VALUE1, VALUE2, VALUE2, 0 , 0 );
CheckAccessCoin(VALUE1, VALUE2, VALUE2, FRESH , FRESH );
CheckAccessCoin(VALUE1, VALUE2, VALUE2, DIRTY , DIRTY );
CheckAccessCoin(VALUE1, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH);
}
void CheckSpendCoins(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
{
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.SpendCoin(OUTPOINT);
test.cache.SelfTest();
CAmount result_value;
char result_flags;
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
BOOST_CHECK_EQUAL(result_value, expected_value);
BOOST_CHECK_EQUAL(result_flags, expected_flags);
};
BOOST_AUTO_TEST_CASE(ccoins_spend)
{
/* Check SpendCoin behavior, requesting a coin from a cache view layered on
* top of a base view, spending, and then checking
* the resulting entry in the cache after the modification.
*
* Base Cache Result Cache Result
* Value Value Value Flags Flags
*/
CheckSpendCoins(ABSENT, ABSENT, ABSENT, NO_ENTRY , NO_ENTRY );
CheckSpendCoins(ABSENT, PRUNED, PRUNED, 0 , DIRTY );
CheckSpendCoins(ABSENT, PRUNED, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(ABSENT, PRUNED, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(ABSENT, PRUNED, ABSENT, DIRTY|FRESH, NO_ENTRY );
CheckSpendCoins(ABSENT, VALUE2, PRUNED, 0 , DIRTY );
CheckSpendCoins(ABSENT, VALUE2, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(ABSENT, VALUE2, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(ABSENT, VALUE2, ABSENT, DIRTY|FRESH, NO_ENTRY );
CheckSpendCoins(PRUNED, ABSENT, ABSENT, NO_ENTRY , NO_ENTRY );
CheckSpendCoins(PRUNED, PRUNED, PRUNED, 0 , DIRTY );
CheckSpendCoins(PRUNED, PRUNED, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(PRUNED, PRUNED, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(PRUNED, PRUNED, ABSENT, DIRTY|FRESH, NO_ENTRY );
CheckSpendCoins(PRUNED, VALUE2, PRUNED, 0 , DIRTY );
CheckSpendCoins(PRUNED, VALUE2, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(PRUNED, VALUE2, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(PRUNED, VALUE2, ABSENT, DIRTY|FRESH, NO_ENTRY );
CheckSpendCoins(VALUE1, ABSENT, PRUNED, NO_ENTRY , DIRTY );
CheckSpendCoins(VALUE1, PRUNED, PRUNED, 0 , DIRTY );
CheckSpendCoins(VALUE1, PRUNED, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(VALUE1, PRUNED, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(VALUE1, PRUNED, ABSENT, DIRTY|FRESH, NO_ENTRY );
CheckSpendCoins(VALUE1, VALUE2, PRUNED, 0 , DIRTY );
CheckSpendCoins(VALUE1, VALUE2, ABSENT, FRESH , NO_ENTRY );
CheckSpendCoins(VALUE1, VALUE2, PRUNED, DIRTY , DIRTY );
CheckSpendCoins(VALUE1, VALUE2, ABSENT, DIRTY|FRESH, NO_ENTRY );
}
void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags, bool coinbase)
{
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
CAmount result_value;
char result_flags;
try {
CTxOut output;
output.nValue = modify_value;
test.cache.AddCoin(OUTPOINT, Coin(std::move(output), 1, coinbase), coinbase);
test.cache.SelfTest();
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
} catch (std::logic_error& e) {
result_value = FAIL;
result_flags = NO_ENTRY;
}
BOOST_CHECK_EQUAL(result_value, expected_value);
BOOST_CHECK_EQUAL(result_flags, expected_flags);
}
// Simple wrapper for CheckAddCoinBase function above that loops through
// different possible base_values, making sure each one gives the same results.
// This wrapper lets the coins_add test below be shorter and less repetitive,
// while still verifying that the CoinsViewCache::AddCoin implementation
// ignores base values.
template <typename... Args>
void CheckAddCoin(Args&&... args)
{
for (CAmount base_value : {ABSENT, PRUNED, VALUE1})
CheckAddCoinBase(base_value, std::forward<Args>(args)...);
}
BOOST_AUTO_TEST_CASE(ccoins_add)
{
/* Check AddCoin behavior, requesting a new coin from a cache view,
* writing a modification to the coin, and then checking the resulting
* entry in the cache after the modification. Verify behavior with the
* with the AddCoin potential_overwrite argument set to false, and to true.
*
* Cache Write Result Cache Result potential_overwrite
* Value Value Value Flags Flags
*/
CheckAddCoin(ABSENT, VALUE3, VALUE3, NO_ENTRY , DIRTY|FRESH, false);
CheckAddCoin(ABSENT, VALUE3, VALUE3, NO_ENTRY , DIRTY , true );
CheckAddCoin(PRUNED, VALUE3, VALUE3, 0 , DIRTY|FRESH, false);
CheckAddCoin(PRUNED, VALUE3, VALUE3, 0 , DIRTY , true );
CheckAddCoin(PRUNED, VALUE3, VALUE3, FRESH , DIRTY|FRESH, false);
CheckAddCoin(PRUNED, VALUE3, VALUE3, FRESH , DIRTY|FRESH, true );
CheckAddCoin(PRUNED, VALUE3, VALUE3, DIRTY , DIRTY , false);
CheckAddCoin(PRUNED, VALUE3, VALUE3, DIRTY , DIRTY , true );
CheckAddCoin(PRUNED, VALUE3, VALUE3, DIRTY|FRESH, DIRTY|FRESH, false);
CheckAddCoin(PRUNED, VALUE3, VALUE3, DIRTY|FRESH, DIRTY|FRESH, true );
CheckAddCoin(VALUE2, VALUE3, FAIL , 0 , NO_ENTRY , false);
CheckAddCoin(VALUE2, VALUE3, VALUE3, 0 , DIRTY , true );
CheckAddCoin(VALUE2, VALUE3, FAIL , FRESH , NO_ENTRY , false);
CheckAddCoin(VALUE2, VALUE3, VALUE3, FRESH , DIRTY|FRESH, true );
CheckAddCoin(VALUE2, VALUE3, FAIL , DIRTY , NO_ENTRY , false);
CheckAddCoin(VALUE2, VALUE3, VALUE3, DIRTY , DIRTY , true );
CheckAddCoin(VALUE2, VALUE3, FAIL , DIRTY|FRESH, NO_ENTRY , false);
CheckAddCoin(VALUE2, VALUE3, VALUE3, DIRTY|FRESH, DIRTY|FRESH, true );
}
void CheckWriteCoins(CAmount parent_value, CAmount child_value, CAmount expected_value, char parent_flags, char child_flags, char expected_flags)
{
SingleEntryCacheTest test(ABSENT, parent_value, parent_flags);
CAmount result_value;
char result_flags;
try {
WriteCoinsViewEntry(test.cache, child_value, child_flags);
test.cache.SelfTest();
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
} catch (std::logic_error& e) {
result_value = FAIL;
result_flags = NO_ENTRY;
}
BOOST_CHECK_EQUAL(result_value, expected_value);
BOOST_CHECK_EQUAL(result_flags, expected_flags);
}
BOOST_AUTO_TEST_CASE(ccoins_write)
{
/* Check BatchWrite behavior, flushing one entry from a child cache to a
* parent cache, and checking the resulting entry in the parent cache
* after the write.
*
* Parent Child Result Parent Child Result
* Value Value Value Flags Flags Flags
*/
CheckWriteCoins(ABSENT, ABSENT, ABSENT, NO_ENTRY , NO_ENTRY , NO_ENTRY );
CheckWriteCoins(ABSENT, PRUNED, PRUNED, NO_ENTRY , DIRTY , DIRTY );
CheckWriteCoins(ABSENT, PRUNED, ABSENT, NO_ENTRY , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(ABSENT, VALUE2, VALUE2, NO_ENTRY , DIRTY , DIRTY );
CheckWriteCoins(ABSENT, VALUE2, VALUE2, NO_ENTRY , DIRTY|FRESH, DIRTY|FRESH);
CheckWriteCoins(PRUNED, ABSENT, PRUNED, 0 , NO_ENTRY , 0 );
CheckWriteCoins(PRUNED, ABSENT, PRUNED, FRESH , NO_ENTRY , FRESH );
CheckWriteCoins(PRUNED, ABSENT, PRUNED, DIRTY , NO_ENTRY , DIRTY );
CheckWriteCoins(PRUNED, ABSENT, PRUNED, DIRTY|FRESH, NO_ENTRY , DIRTY|FRESH);
CheckWriteCoins(PRUNED, PRUNED, PRUNED, 0 , DIRTY , DIRTY );
CheckWriteCoins(PRUNED, PRUNED, PRUNED, 0 , DIRTY|FRESH, DIRTY );
CheckWriteCoins(PRUNED, PRUNED, ABSENT, FRESH , DIRTY , NO_ENTRY );
CheckWriteCoins(PRUNED, PRUNED, ABSENT, FRESH , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(PRUNED, PRUNED, PRUNED, DIRTY , DIRTY , DIRTY );
CheckWriteCoins(PRUNED, PRUNED, PRUNED, DIRTY , DIRTY|FRESH, DIRTY );
CheckWriteCoins(PRUNED, PRUNED, ABSENT, DIRTY|FRESH, DIRTY , NO_ENTRY );
CheckWriteCoins(PRUNED, PRUNED, ABSENT, DIRTY|FRESH, DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(PRUNED, VALUE2, VALUE2, 0 , DIRTY , DIRTY );
CheckWriteCoins(PRUNED, VALUE2, VALUE2, 0 , DIRTY|FRESH, DIRTY );
CheckWriteCoins(PRUNED, VALUE2, VALUE2, FRESH , DIRTY , DIRTY|FRESH);
CheckWriteCoins(PRUNED, VALUE2, VALUE2, FRESH , DIRTY|FRESH, DIRTY|FRESH);
CheckWriteCoins(PRUNED, VALUE2, VALUE2, DIRTY , DIRTY , DIRTY );
CheckWriteCoins(PRUNED, VALUE2, VALUE2, DIRTY , DIRTY|FRESH, DIRTY );
CheckWriteCoins(PRUNED, VALUE2, VALUE2, DIRTY|FRESH, DIRTY , DIRTY|FRESH);
CheckWriteCoins(PRUNED, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH, DIRTY|FRESH);
CheckWriteCoins(VALUE1, ABSENT, VALUE1, 0 , NO_ENTRY , 0 );
CheckWriteCoins(VALUE1, ABSENT, VALUE1, FRESH , NO_ENTRY , FRESH );
CheckWriteCoins(VALUE1, ABSENT, VALUE1, DIRTY , NO_ENTRY , DIRTY );
CheckWriteCoins(VALUE1, ABSENT, VALUE1, DIRTY|FRESH, NO_ENTRY , DIRTY|FRESH);
CheckWriteCoins(VALUE1, PRUNED, PRUNED, 0 , DIRTY , DIRTY );
CheckWriteCoins(VALUE1, PRUNED, FAIL , 0 , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, PRUNED, ABSENT, FRESH , DIRTY , NO_ENTRY );
CheckWriteCoins(VALUE1, PRUNED, FAIL , FRESH , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, PRUNED, PRUNED, DIRTY , DIRTY , DIRTY );
CheckWriteCoins(VALUE1, PRUNED, FAIL , DIRTY , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, PRUNED, ABSENT, DIRTY|FRESH, DIRTY , NO_ENTRY );
CheckWriteCoins(VALUE1, PRUNED, FAIL , DIRTY|FRESH, DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, VALUE2, VALUE2, 0 , DIRTY , DIRTY );
CheckWriteCoins(VALUE1, VALUE2, FAIL , 0 , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, VALUE2, VALUE2, FRESH , DIRTY , DIRTY|FRESH);
CheckWriteCoins(VALUE1, VALUE2, FAIL , FRESH , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, VALUE2, VALUE2, DIRTY , DIRTY , DIRTY );
CheckWriteCoins(VALUE1, VALUE2, FAIL , DIRTY , DIRTY|FRESH, NO_ENTRY );
CheckWriteCoins(VALUE1, VALUE2, VALUE2, DIRTY|FRESH, DIRTY , DIRTY|FRESH);
CheckWriteCoins(VALUE1, VALUE2, FAIL , DIRTY|FRESH, DIRTY|FRESH, NO_ENTRY );
// The checks above omit cases where the child flags are not DIRTY, since
// they would be too repetitive (the parent cache is never updated in these
// cases). The loop below covers these cases and makes sure the parent cache
// is always left unchanged.
for (CAmount parent_value : {ABSENT, PRUNED, VALUE1})
for (CAmount child_value : {ABSENT, PRUNED, VALUE2})
for (char parent_flags : parent_value == ABSENT ? ABSENT_FLAGS : FLAGS)
for (char child_flags : child_value == ABSENT ? ABSENT_FLAGS : CLEAN_FLAGS)
CheckWriteCoins(parent_value, child_value, parent_value, parent_flags, child_flags, parent_flags);
}
BOOST_AUTO_TEST_SUITE_END()
| [
"48128427+thecripcommunity@users.noreply.github.com"
] | 48128427+thecripcommunity@users.noreply.github.com |
b0e1775a3104a58d4952dc2e1e776e42160016a8 | ed7f9ef37debb783b4dbf879b91d71d6901398c2 | /T16StaticLib/t16staticlib.cpp | 584d4a6242db4835a49ef9d645ccb71caabfc53d | [] | no_license | WoShiYiDuiXiaoXiaoNiao/QT | 38a421c7f525d0f54077b130600792d539b437d1 | 999825f06f04d40f909844e46830174fffd5f722 | refs/heads/master | 2020-05-19T07:04:19.407006 | 2019-05-04T12:10:10 | 2019-05-04T12:10:10 | 184,889,677 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 61 | cpp | #include "t16staticlib.h"
T16StaticLib::T16StaticLib()
{
}
| [
"1254816055@qq.com"
] | 1254816055@qq.com |
08fbe7da67d57bd47ac7c8bb7b1b944f44340d07 | 777e7b35ab6d4083dc031e84b9761428c3461a00 | /matrix_class_simple.cpp | 58713da1cdf18a263c5466e56a29aee001b848bd | [] | no_license | vedenev/cpp_learning_matix_class | 32fc280b773b8d980b0a313243b2b7271f4104ce | 85dcfdb224b81557dce119a310a7efc8fa181657 | refs/heads/master | 2020-08-28T08:48:10.244004 | 2019-10-26T04:17:43 | 2019-10-26T04:17:43 | 217,653,461 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,627 | cpp | #include <iostream>
#include <string>
class Matrix {
private:
float* data;
public:
int height;
int width;
Matrix(int height_inp, int width_inp) {
height = height_inp;
width = width_inp;
int data_size = height * width;
data = new float[data_size];
}
void set_value (int x, int y, float value) {
data[y * width + x] = value;
}
Matrix operator + (const Matrix &matrix_right) {
Matrix matrix_result(height, width);
int offset = 0;
for(int row_count = 0; row_count < height; row_count++){
for(int column_count = 0; column_count < width; column_count++){
matrix_result.data[offset] = data[offset] + matrix_right.data[offset];
offset++;
}
}
return matrix_result;
}
void print() {
int offset = 0;
for(int row_count = 0; row_count < height; row_count++){
std::cout << '|';
for(int column_count = 0; column_count < width; column_count++){
std::cout << data[offset];
if(column_count < (width - 1)){
std::cout << "\t";
}
offset++;
}
std::cout << "|\n";
}
}
};
int main()
{
Matrix A_matrix(3, 4);
Matrix B_matrix(3, 4);
Matrix C_matrix(3, 4);
A_matrix.set_value(1, 2, 1.2f);
B_matrix.set_value(2, 2, 2.2f);
C_matrix = A_matrix + B_matrix;
C_matrix.print();
} | [
"vedenev@azoft.com"
] | vedenev@azoft.com |
f629afebec5bbc0d5148578d61dbc8d8b435d54e | 38c10c01007624cd2056884f25e0d6ab85442194 | /chrome/utility/safe_browsing/mac/udif_unittest.cc | 6afb9d25f2b4553eabc217fd12ba3a510ee5b951 | [
"BSD-3-Clause"
] | permissive | zenoalbisser/chromium | 6ecf37b6c030c84f1b26282bc4ef95769c62a9b2 | e71f21b9b4b9b839f5093301974a45545dad2691 | refs/heads/master | 2022-12-25T14:23:18.568575 | 2016-07-14T21:49:52 | 2016-07-23T08:02:51 | 63,980,627 | 0 | 2 | BSD-3-Clause | 2022-12-12T12:43:41 | 2016-07-22T20:14:04 | null | UTF-8 | C++ | false | false | 8,253 | cc | // Copyright 2015 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 "chrome/utility/safe_browsing/mac/udif.h"
#include <hfs/hfs_format.h>
#include <libkern/OSByteOrder.h>
#include "base/files/file.h"
#include "base/strings/stringprintf.h"
#include "chrome/utility/safe_browsing/mac/dmg_test_utils.h"
#include "chrome/utility/safe_browsing/mac/read_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace safe_browsing {
namespace dmg {
namespace {
const char* kGPTExpectedPartitions[] = {
"MBR",
"Primary GPT Header",
"Primary GPT Tabler",
"Apple_Free",
"Apple_HFS",
"Apple_Free",
"Backup GPT Table",
"Backup GPT Header",
nullptr,
};
const char* kNoPartitionMap[] = {
"Apple_HFS",
nullptr,
};
const char* kAPMExpectedPartitions[] = {
"DDM",
"Apple_partition_map",
"Apple_HFS",
"Apple_Free",
nullptr,
};
struct UDIFTestCase {
enum ExpectedResults : uint16_t {
ALL_FAIL = 0,
UDIF_PARSE = 1 << 1,
GET_HFS_STREAM = 1 << 2,
READ_UDIF_DATA = 1 << 3,
ALL_PASS = ~static_cast<uint16_t>(0),
};
// The disk image file to open.
const char* file_name;
// The NULL-terminated C array of expected partition types.
const char** expected_partitions;
// A bitmask of ExpectedResults. As the parser currently only supports
// certain UDIF features, this is used to properly test expectations.
int expected_results;
// Generates a human-friendly name for the parameterized test.
static std::string GetTestName(
const testing::TestParamInfo<UDIFTestCase>& test) {
std::string file = test.param.file_name;
return file.substr(0, file.find('.'));
}
};
class UDIFParserTest : public testing::TestWithParam<UDIFTestCase> {
protected:
void RunReadAllTest(size_t buffer_size) {
const UDIFTestCase& test_case = GetParam();
if (!(test_case.expected_results & UDIFTestCase::READ_UDIF_DATA)) {
return;
}
base::File file;
ASSERT_NO_FATAL_FAILURE(test::GetTestFile(test_case.file_name, &file));
safe_browsing::dmg::FileReadStream file_stream(file.GetPlatformFile());
safe_browsing::dmg::UDIFParser udif(&file_stream);
ASSERT_TRUE(udif.Parse());
std::vector<uint8_t> buffer(buffer_size, 0);
for (size_t i = 0; i < udif.GetNumberOfPartitions(); ++i) {
SCOPED_TRACE(base::StringPrintf("partition %zu", i));
size_t total_size = udif.GetPartitionSize(i);
size_t total_bytes_read = 0;
scoped_ptr<ReadStream> stream = udif.GetPartitionReadStream(i);
bool success = false;
do {
size_t bytes_read = 0;
success = stream->Read(&buffer[0], buffer.size(), &bytes_read);
total_bytes_read += bytes_read;
EXPECT_TRUE(success);
EXPECT_TRUE(bytes_read == buffer_size ||
total_bytes_read == total_size)
<< "bytes_read = " << bytes_read;
} while (total_bytes_read < total_size && success);
}
}
};
TEST_P(UDIFParserTest, ParseUDIF) {
const UDIFTestCase& test_case = GetParam();
base::File file;
ASSERT_NO_FATAL_FAILURE(test::GetTestFile(test_case.file_name, &file));
safe_browsing::dmg::FileReadStream file_stream(file.GetPlatformFile());
safe_browsing::dmg::UDIFParser udif(&file_stream);
bool expected_parse_success =
UDIFTestCase::UDIF_PARSE & test_case.expected_results;
ASSERT_EQ(expected_parse_success, udif.Parse());
if (!expected_parse_success)
return;
size_t expected_partition_count = 0;
for (; test_case.expected_partitions[expected_partition_count];
++expected_partition_count) {
}
EXPECT_EQ(expected_partition_count, udif.GetNumberOfPartitions());
for (size_t i = 0; i < udif.GetNumberOfPartitions(); ++i) {
SCOPED_TRACE(base::StringPrintf("partition %zu", i));
scoped_ptr<ReadStream> stream = udif.GetPartitionReadStream(i);
// Apple_HFS will match both HFS and HFSX.
if (udif.GetPartitionType(i).find("Apple_HFS") != std::string::npos) {
ASSERT_EQ(
(UDIFTestCase::GET_HFS_STREAM & test_case.expected_results) != 0,
stream.get() != nullptr);
if (!stream)
continue;
EXPECT_EQ(1024, stream->Seek(1024, SEEK_SET));
HFSPlusVolumeHeader header = {0};
bool expect_read_success =
test_case.expected_results & UDIFTestCase::READ_UDIF_DATA;
EXPECT_EQ(expect_read_success, stream->ReadType(&header));
if (!expect_read_success)
continue;
size_t size = udif.GetPartitionSize(i);
off_t offset = stream->Seek(-1024, SEEK_END);
ASSERT_GE(offset, 0);
EXPECT_EQ(size - 1024, static_cast<size_t>(offset));
HFSPlusVolumeHeader alternate_header = {0};
EXPECT_TRUE(stream->ReadType(&alternate_header));
EXPECT_EQ(0, memcmp(&header, &alternate_header, sizeof(header)));
EXPECT_EQ(kHFSPlusSigWord, OSSwapBigToHostInt16(header.signature));
}
if (test_case.expected_results & UDIFTestCase::READ_UDIF_DATA) {
EXPECT_EQ(0, stream->Seek(0, SEEK_SET));
size_t partition_size = udif.GetPartitionSize(i);
std::vector<uint8_t> data(partition_size, 0);
EXPECT_TRUE(stream->ReadExact(&data[0], partition_size));
}
}
}
// These tests ensure that reading the entire partition stream with different
// buffer sizes (and thus unaligned UDIF chunks) all succeed.
TEST_P(UDIFParserTest, ReadAll_8) {
RunReadAllTest(8);
}
TEST_P(UDIFParserTest, ReadAll_512) {
RunReadAllTest(512);
}
TEST_P(UDIFParserTest, ReadAll_1000) {
RunReadAllTest(1000);
}
TEST_P(UDIFParserTest, ReadAll_4444) {
RunReadAllTest(4444);
}
TEST_P(UDIFParserTest, ReadAll_8181) {
RunReadAllTest(8181);
}
TEST_P(UDIFParserTest, ReadAll_100000) {
RunReadAllTest(100000);
}
const UDIFTestCase cases[] = {
{"dmg_UDBZ_GPTSPUD.dmg", kGPTExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UDBZ_NONE.dmg", kNoPartitionMap, UDIFTestCase::ALL_PASS},
{"dmg_UDBZ_SPUD.dmg", kAPMExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UDCO_GPTSPUD.dmg", kGPTExpectedPartitions,
// ADC compression not supported.
UDIFTestCase::UDIF_PARSE | UDIFTestCase::GET_HFS_STREAM},
{"dmg_UDCO_NONE.dmg", kNoPartitionMap,
// ADC compression not supported.
UDIFTestCase::UDIF_PARSE | UDIFTestCase::GET_HFS_STREAM},
{"dmg_UDCO_SPUD.dmg", kAPMExpectedPartitions,
// ADC compression not supported.
UDIFTestCase::UDIF_PARSE | UDIFTestCase::GET_HFS_STREAM},
{"dmg_UDRO_GPTSPUD.dmg", kGPTExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UDRO_NONE.dmg", kNoPartitionMap, UDIFTestCase::ALL_PASS},
{"dmg_UDRO_SPUD.dmg", kAPMExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UDRW_GPTSPUD.dmg", kGPTExpectedPartitions,
// UDRW not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDRW_NONE.dmg", kNoPartitionMap,
// UDRW not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDRW_SPUD.dmg", kAPMExpectedPartitions,
// UDRW not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDSP_GPTSPUD.sparseimage", kGPTExpectedPartitions,
// Sparse images not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDSP_NONE.sparseimage", kNoPartitionMap,
// UDRW not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDSP_SPUD.sparseimage", kAPMExpectedPartitions,
// Sparse images not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDTO_GPTSPUD.cdr", kGPTExpectedPartitions,
// CD/DVD format not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDTO_NONE.cdr", kNoPartitionMap,
// CD/DVD format not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDTO_SPUD.cdr", kAPMExpectedPartitions,
// CD/DVD format not supported.
UDIFTestCase::ALL_FAIL},
{"dmg_UDZO_GPTSPUD.dmg", kGPTExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UDZO_SPUD.dmg", kAPMExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UFBI_GPTSPUD.dmg", kGPTExpectedPartitions, UDIFTestCase::ALL_PASS},
{"dmg_UFBI_SPUD.dmg", kAPMExpectedPartitions, UDIFTestCase::ALL_PASS},
};
INSTANTIATE_TEST_CASE_P(UDIFParserTest, UDIFParserTest,
testing::ValuesIn(cases),
UDIFTestCase::GetTestName);
} // namespace
} // namespace dmg
} // namespace safe_browsing
| [
"zeno.albisser@hemispherian.com"
] | zeno.albisser@hemispherian.com |
2152a979de7a337318b0c4effd28427555ae5939 | 45874c847c5a2fc4e89e05a7fc8ad9b63d8c4860 | /sycl/include/sycl/ext/intel/fpga_loop_fuse.hpp | 9d631f01ea08c84e329710b19f9f7dfb24795359 | [
"NCSA",
"LLVM-exception",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | intel/llvm | 2f023cefec793a248d8a237267410f5e288116c5 | a3d10cf63ddbdcc23712c45afd1b6b0a2ff5b190 | refs/heads/sycl | 2023-08-24T18:53:49.800759 | 2023-08-24T17:38:35 | 2023-08-24T17:38:35 | 166,008,577 | 1,050 | 735 | NOASSERTION | 2023-09-14T20:35:07 | 2019-01-16T09:05:33 | null | UTF-8 | C++ | false | false | 759 | hpp | //==--------- fpga_loop_fuse.hpp --- SYCL FPGA Loop Fuse Extension ---------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#pragma once
namespace sycl {
inline namespace _V1 {
namespace ext {
namespace intel {
template <int _N = 1, typename _F>
void fpga_loop_fuse [[intel::loop_fuse(_N)]] (_F f) {
f();
}
template <int _N = 1, typename _F>
void fpga_loop_fuse_independent [[intel::loop_fuse_independent(_N)]] (_F f) {
f();
}
} // namespace intel
} // namespace ext
} // namespace _V1
} // namespace sycl
| [
"noreply@github.com"
] | noreply@github.com |
b8c8ae04db1a275195194bc6f1d7f77c4d0ddb65 | 0bf07b0166bc33743af4ac000456220fab3476b3 | /src/module/configuration_store.cpp | 101175b229995af4253d6ffd475cea47d70a4185 | [] | no_license | rpacadi/Marlin | bc9ed6405292a1cfeee84007caa8626f84d15ebc | 9f9abcd6b9b2b4993ff2cdd2e060cb85e2d74009 | refs/heads/master | 2021-05-25T12:28:37.385265 | 2020-04-13T10:42:21 | 2020-04-13T10:42:21 | 253,754,676 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 92,873 | cpp | /**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* configuration_store.cpp
*
* Settings and EEPROM storage
*
* IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
* in the functions below, also increment the version number. This makes sure that
* the default values are used whenever there is a change to the data, to prevent
* wrong data being written to the variables.
*
* ALSO: Variables in the Store and Retrieve sections must be in the same order.
* If a feature is disabled, some data must still be written that, when read,
* either sets a Sane Default, or results in No Change to the existing value.
*
*/
// Change EEPROM version if the structure changes
#define EEPROM_VERSION "V58"
#define EEPROM_OFFSET 100
// Check the integrity of data offsets.
// Can be disabled for production build.
//#define DEBUG_EEPROM_READWRITE
#include "configuration_store.h"
#if ADD_PORT_ARG
#define PORTARG_SOLO const int8_t port
#define PORTARG_AFTER ,const int8_t port
#define PORTVAR_SOLO port
#else
#define PORTARG_SOLO
#define PORTARG_AFTER
#define PORTVAR_SOLO
#endif
#include "endstops.h"
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
#include "../lcd/ultralcd.h"
#include "../core/language.h"
#include "../libs/vector_3.h"
#include "../gcode/gcode.h"
#include "../Marlin.h"
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
#endif
#if HAS_SERVOS
#include "servo.h"
#endif
#if HAS_BED_PROBE
#include "../module/probe.h"
#endif
#if HAS_TRINAMIC
#include "stepper_indirection.h"
#include "../feature/tmc_util.h"
#define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[_AXIS(A)])
#endif
#if ENABLED(FWRETRACT)
#include "../feature/fwretract.h"
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#include "../feature/pause.h"
#endif
#if ENABLED(PID_EXTRUSION_SCALING)
#define LPQ_LEN thermalManager.lpq_len
#endif
#pragma pack(push, 1) // No padding between variables
typedef struct PID { float Kp, Ki, Kd; } PID;
typedef struct PIDC { float Kp, Ki, Kd, Kc; } PIDC;
/**
* Current EEPROM Layout
*
* Keep this data structure up to date so
* EEPROM size is known at compile time!
*/
typedef struct SettingsDataStruct {
char version[4]; // Vnn\0
uint16_t crc; // Data Checksum
//
// DISTINCT_E_FACTORS
//
uint8_t esteppers; // XYZE_N - XYZ
uint32_t planner_max_acceleration_mm_per_s2[XYZE_N], // M201 XYZE planner.max_acceleration_mm_per_s2[XYZE_N]
planner_min_segment_time_us; // M205 B planner.min_segment_time_us
float planner_axis_steps_per_mm[XYZE_N], // M92 XYZE planner.axis_steps_per_mm[XYZE_N]
planner_max_feedrate_mm_s[XYZE_N], // M203 XYZE planner.max_feedrate_mm_s[XYZE_N]
planner_acceleration, // M204 P planner.acceleration
planner_retract_acceleration, // M204 R planner.retract_acceleration
planner_travel_acceleration, // M204 T planner.travel_acceleration
planner_min_feedrate_mm_s, // M205 S planner.min_feedrate_mm_s
planner_min_travel_feedrate_mm_s, // M205 T planner.min_travel_feedrate_mm_s
planner_max_jerk[XYZE], // M205 XYZE planner.max_jerk[XYZE]
planner_junction_deviation_mm; // M205 J planner.junction_deviation_mm
float home_offset[XYZ]; // M206 XYZ
#if HAS_HOTEND_OFFSET
float hotend_offset[XYZ][HOTENDS - 1]; // M218 XYZ
#endif
//
// ENABLE_LEVELING_FADE_HEIGHT
//
float planner_z_fade_height; // M420 Zn planner.z_fade_height
//
// MESH_BED_LEVELING
//
float mbl_z_offset; // mbl.z_offset
uint8_t mesh_num_x, mesh_num_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y
#if ENABLED(MESH_BED_LEVELING)
float mbl_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; // mbl.z_values
#else
float mbl_z_values[3][3];
#endif
//
// HAS_BED_PROBE
//
float zprobe_zoffset; // M851 Z
//
// ABL_PLANAR
//
matrix_3x3 planner_bed_level_matrix; // planner.bed_level_matrix
//
// AUTO_BED_LEVELING_BILINEAR
//
uint8_t grid_max_x, grid_max_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y
int bilinear_grid_spacing[2],
bilinear_start[2]; // G29 L F
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; // G29
#else
float z_values[3][3];
#endif
//
// AUTO_BED_LEVELING_UBL
//
bool planner_leveling_active; // M420 S planner.leveling_active
int8_t ubl_storage_slot; // ubl.storage_slot
//
// SERVO_ANGLES
//
uint16_t servo_angles[NUM_SERVO_PLUGS][2]; // M281 P L U
//
// DELTA / [XYZ]_DUAL_ENDSTOPS
//
#if ENABLED(DELTA)
float delta_height, // M666 H
delta_endstop_adj[ABC], // M666 XYZ
delta_radius, // M665 R
delta_diagonal_rod, // M665 L
delta_segments_per_second, // M665 S
delta_calibration_radius, // M665 B
delta_tower_angle_trim[ABC]; // M665 XYZ
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
float x2_endstop_adj, // M666 X
y2_endstop_adj, // M666 Y
z2_endstop_adj; // M666 Z
#if ENABLED(Z_TRIPLE_ENDSTOPS)
float z3_endstop_adj; // M666 Z
#endif
#endif
//
// ULTIPANEL
//
int16_t lcd_preheat_hotend_temp[2], // M145 S0 H
lcd_preheat_bed_temp[2], // M145 S0 B
lcd_preheat_fan_speed[2]; // M145 S0 F
//
// PIDTEMP
//
PIDC hotendPID[HOTENDS]; // M301 En PIDC / M303 En U
int16_t lpq_len; // M301 L
//
// PIDTEMPBED
//
PID bedPID; // M304 PID / M303 E-1 U
//
// HAS_LCD_CONTRAST
//
int16_t lcd_contrast; // M250 C
//
// FWRETRACT
//
bool autoretract_enabled; // M209 S
float retract_length, // M207 S
retract_feedrate_mm_s, // M207 F
retract_zlift, // M207 Z
retract_recover_length, // M208 S
retract_recover_feedrate_mm_s, // M208 F
swap_retract_length, // M207 W
swap_retract_recover_length, // M208 W
swap_retract_recover_feedrate_mm_s; // M208 R
//
// !NO_VOLUMETRIC
//
bool parser_volumetric_enabled; // M200 D parser.volumetric_enabled
float planner_filament_size[EXTRUDERS]; // M200 T D planner.filament_size[]
//
// HAS_TRINAMIC
//
#define TMC_AXES (MAX_EXTRUDERS + 7)
uint16_t tmc_stepper_current[TMC_AXES]; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5
uint32_t tmc_hybrid_threshold[TMC_AXES]; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5
int16_t tmc_sgt[XYZ]; // M914 X Y Z
//
// LIN_ADVANCE
//
float planner_extruder_advance_K[EXTRUDERS]; // M900 K planner.extruder_advance_K
//
// HAS_MOTOR_CURRENT_PWM
//
uint32_t motor_current_setting[XYZ]; // M907 X Z E
//
// CNC_COORDINATE_SYSTEMS
//
float coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ]; // G54-G59.3
//
// SKEW_CORRECTION
//
float planner_xy_skew_factor, // M852 I planner.xy_skew_factor
planner_xz_skew_factor, // M852 J planner.xz_skew_factor
planner_yz_skew_factor; // M852 K planner.yz_skew_factor
//
// ADVANCED_PAUSE_FEATURE
//
float filament_change_unload_length[EXTRUDERS], // M603 T U
filament_change_load_length[EXTRUDERS]; // M603 T L
} SettingsData;
#pragma pack(pop)
MarlinSettings settings;
uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); }
/**
* Post-process after Retrieve or Reset
*/
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
float new_z_fade_height;
#endif
void MarlinSettings::postprocess() {
const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
// steps per s2 needs to be updated to agree with units per s2
planner.reset_acceleration_rates();
// Make sure delta kinematics are updated before refreshing the
// planner position so the stepper counts will be set correctly.
#if ENABLED(DELTA)
recalc_delta_settings();
#endif
#if ENABLED(PIDTEMP)
thermalManager.updatePID();
#endif
#if DISABLED(NO_VOLUMETRICS)
planner.calculate_volumetric_multipliers();
#else
for (uint8_t i = COUNT(planner.e_factor); i--;)
planner.refresh_e_factor(i);
#endif
#if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE)
// Software endstops depend on home_offset
LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
set_z_fade_height(new_z_fade_height, false); // false = no report
#endif
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
refresh_bed_level();
#endif
#if HAS_MOTOR_CURRENT_PWM
stepper.refresh_motor_power();
#endif
#if ENABLED(FWRETRACT)
fwretract.refresh_autoretract();
#endif
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
planner.recalculate_max_e_jerk();
#endif
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
// and init stepper.count[], planner.position[] with current_position
planner.refresh_positioning();
// Various factors can change the current position
if (memcmp(oldpos, current_position, sizeof(oldpos)))
report_current_position();
}
#if ENABLED(EEPROM_SETTINGS)
#include "../HAL/shared/persistent_store_api.h"
#define DUMMY_PID_VALUE 3000.0f
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
#define EEPROM_FINISH() persistentStore.access_finish()
#define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
#define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
#define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_ASSERT(TST,ERR) if (!(TST)) do{ SERIAL_ERROR_START_P(port); SERIAL_ERRORLNPGM_P(port, ERR); eeprom_error = true; }while(0)
#if ENABLED(DEBUG_EEPROM_READWRITE)
#define _FIELD_TEST(FIELD) \
EEPROM_ASSERT( \
eeprom_error || eeprom_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \
"Field " STRINGIFY(FIELD) " mismatch." \
)
#else
#define _FIELD_TEST(FIELD) NOOP
#endif
const char version[4] = EEPROM_VERSION;
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
if (size != datasize()) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, "EEPROM datasize error.");
#endif
return true;
}
return false;
}
/**
* M500 - Store Configuration
*/
bool MarlinSettings::save(PORTARG_SOLO) {
float dummy = 0;
char ver[4] = "ERR";
uint16_t working_crc = 0;
EEPROM_START();
eeprom_error = false;
#if ENABLED(FLASH_EEPROM_EMULATION)
EEPROM_SKIP(ver); // Flash doesn't allow rewriting without erase
#else
EEPROM_WRITE(ver); // invalidate data first
#endif
EEPROM_SKIP(working_crc); // Skip the checksum slot
working_crc = 0; // clear before first "real data"
_FIELD_TEST(esteppers);
const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
EEPROM_WRITE(esteppers);
EEPROM_WRITE(planner.max_acceleration_mm_per_s2);
EEPROM_WRITE(planner.min_segment_time_us);
EEPROM_WRITE(planner.axis_steps_per_mm);
EEPROM_WRITE(planner.max_feedrate_mm_s);
EEPROM_WRITE(planner.acceleration);
EEPROM_WRITE(planner.retract_acceleration);
EEPROM_WRITE(planner.travel_acceleration);
EEPROM_WRITE(planner.min_feedrate_mm_s);
EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
#if HAS_CLASSIC_JERK
EEPROM_WRITE(planner.max_jerk);
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
dummy = float(DEFAULT_EJERK);
EEPROM_WRITE(dummy);
#endif
#else
const float planner_max_jerk[] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) };
EEPROM_WRITE(planner_max_jerk);
#endif
#if ENABLED(JUNCTION_DEVIATION)
EEPROM_WRITE(planner.junction_deviation_mm);
#else
dummy = 0.02f;
EEPROM_WRITE(dummy);
#endif
_FIELD_TEST(home_offset);
#if !HAS_HOME_OFFSET
const float home_offset[XYZ] = { 0 };
#endif
EEPROM_WRITE(home_offset);
#if HAS_HOTEND_OFFSET
// Skip hotend 0 which must be 0
for (uint8_t e = 1; e < HOTENDS; e++)
LOOP_XYZ(i) EEPROM_WRITE(hotend_offset[i][e]);
#endif
//
// Global Leveling
//
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float zfh = planner.z_fade_height;
#else
const float zfh = 10.0;
#endif
EEPROM_WRITE(zfh);
//
// Mesh Bed Leveling
//
#if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected
static_assert(
sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]),
"MBL Z array is the wrong size."
);
const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y;
EEPROM_WRITE(mbl.z_offset);
EEPROM_WRITE(mesh_num_x);
EEPROM_WRITE(mesh_num_y);
EEPROM_WRITE(mbl.z_values);
#else // For disabled MBL write a default mesh
dummy = 0;
const uint8_t mesh_num_x = 3, mesh_num_y = 3;
EEPROM_WRITE(dummy); // z_offset
EEPROM_WRITE(mesh_num_x);
EEPROM_WRITE(mesh_num_y);
for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummy);
#endif // MESH_BED_LEVELING
_FIELD_TEST(zprobe_zoffset);
#if !HAS_BED_PROBE
const float zprobe_zoffset = 0;
#endif
EEPROM_WRITE(zprobe_zoffset);
//
// Planar Bed Leveling matrix
//
#if ABL_PLANAR
EEPROM_WRITE(planner.bed_level_matrix);
#else
dummy = 0;
for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
#endif
//
// Bilinear Auto Bed Leveling
//
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Compile time test that sizeof(z_values) is as expected
static_assert(
sizeof(z_values) == GRID_MAX_POINTS * sizeof(z_values[0][0]),
"Bilinear Z array is the wrong size."
);
const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
EEPROM_WRITE(grid_max_x); // 1 byte
EEPROM_WRITE(grid_max_y); // 1 byte
EEPROM_WRITE(bilinear_grid_spacing); // 2 ints
EEPROM_WRITE(bilinear_start); // 2 ints
EEPROM_WRITE(z_values); // 9-256 floats
#else
// For disabled Bilinear Grid write an empty 3x3 grid
const uint8_t grid_max_x = 3, grid_max_y = 3;
const int bilinear_start[2] = { 0 }, bilinear_grid_spacing[2] = { 0 };
dummy = 0;
EEPROM_WRITE(grid_max_x);
EEPROM_WRITE(grid_max_y);
EEPROM_WRITE(bilinear_grid_spacing);
EEPROM_WRITE(bilinear_start);
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummy);
#endif // AUTO_BED_LEVELING_BILINEAR
_FIELD_TEST(planner_leveling_active);
#if ENABLED(AUTO_BED_LEVELING_UBL)
EEPROM_WRITE(planner.leveling_active);
EEPROM_WRITE(ubl.storage_slot);
#else
const bool ubl_active = false;
const int8_t storage_slot = -1;
EEPROM_WRITE(ubl_active);
EEPROM_WRITE(storage_slot);
#endif // AUTO_BED_LEVELING_UBL
#if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES)
#if ENABLED(SWITCHING_EXTRUDER)
constexpr uint16_t sesa[][2] = SWITCHING_EXTRUDER_SERVO_ANGLES;
#endif
constexpr uint16_t servo_angles[NUM_SERVO_PLUGS][2] = {
#if ENABLED(SWITCHING_EXTRUDER)
[SWITCHING_EXTRUDER_SERVO_NR] = { sesa[0], sesa[1] }
#if EXTRUDERS > 3
, [SWITCHING_EXTRUDER_E23_SERVO_NR] = { sesa[2], sesa[3] }
#endif
#elif ENABLED(SWITCHING_NOZZLE)
[SWITCHING_NOZZLE_SERVO_NR] = SWITCHING_NOZZLE_SERVO_ANGLES
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
[Z_PROBE_SERVO_NR] = Z_SERVO_ANGLES
#endif
};
#endif
EEPROM_WRITE(servo_angles);
// 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS
#if ENABLED(DELTA)
_FIELD_TEST(delta_height);
EEPROM_WRITE(delta_height); // 1 float
EEPROM_WRITE(delta_endstop_adj); // 3 floats
EEPROM_WRITE(delta_radius); // 1 float
EEPROM_WRITE(delta_diagonal_rod); // 1 float
EEPROM_WRITE(delta_segments_per_second); // 1 float
EEPROM_WRITE(delta_calibration_radius); // 1 float
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
_FIELD_TEST(x2_endstop_adj);
// Write dual endstops in X, Y, Z order. Unused = 0.0
dummy = 0;
#if ENABLED(X_DUAL_ENDSTOPS)
EEPROM_WRITE(endstops.x2_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummy);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
EEPROM_WRITE(endstops.y2_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummy);
#endif
#if Z_MULTI_ENDSTOPS
EEPROM_WRITE(endstops.z2_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummy);
#endif
#if ENABLED(Z_TRIPLE_ENDSTOPS)
EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummy);
#endif
#endif
_FIELD_TEST(lcd_preheat_hotend_temp);
#if DISABLED(ULTIPANEL)
constexpr int16_t lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
#endif
EEPROM_WRITE(lcd_preheat_hotend_temp);
EEPROM_WRITE(lcd_preheat_bed_temp);
EEPROM_WRITE(lcd_preheat_fan_speed);
for (uint8_t e = 0; e < HOTENDS; e++) {
#if ENABLED(PIDTEMP)
EEPROM_WRITE(PID_PARAM(Kp, e));
EEPROM_WRITE(PID_PARAM(Ki, e));
EEPROM_WRITE(PID_PARAM(Kd, e));
#if ENABLED(PID_EXTRUSION_SCALING)
EEPROM_WRITE(PID_PARAM(Kc, e));
#else
dummy = 1.0f; // 1.0 = default kc
EEPROM_WRITE(dummy);
#endif
#else
dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
EEPROM_WRITE(dummy); // Kp
dummy = 0;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
#endif
} // Hotends Loop
_FIELD_TEST(lpq_len);
#if DISABLED(PID_EXTRUSION_SCALING)
const int16_t LPQ_LEN = 20;
#endif
EEPROM_WRITE(LPQ_LEN);
#if DISABLED(PIDTEMPBED)
dummy = DUMMY_PID_VALUE;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
#else
EEPROM_WRITE(thermalManager.bedKp);
EEPROM_WRITE(thermalManager.bedKi);
EEPROM_WRITE(thermalManager.bedKd);
#endif
_FIELD_TEST(lcd_contrast);
#if !HAS_LCD_CONTRAST
const int16_t lcd_contrast = 32;
#endif
EEPROM_WRITE(lcd_contrast);
#if DISABLED(FWRETRACT)
const bool autoretract_enabled = false;
const float autoretract_defaults[] = { 3, 45, 0, 0, 0, 13, 0, 8 };
EEPROM_WRITE(autoretract_enabled);
EEPROM_WRITE(autoretract_defaults);
#else
EEPROM_WRITE(fwretract.autoretract_enabled);
EEPROM_WRITE(fwretract.retract_length);
EEPROM_WRITE(fwretract.retract_feedrate_mm_s);
EEPROM_WRITE(fwretract.retract_zlift);
EEPROM_WRITE(fwretract.retract_recover_length);
EEPROM_WRITE(fwretract.retract_recover_feedrate_mm_s);
EEPROM_WRITE(fwretract.swap_retract_length);
EEPROM_WRITE(fwretract.swap_retract_recover_length);
EEPROM_WRITE(fwretract.swap_retract_recover_feedrate_mm_s);
#endif
//
// Volumetric & Filament Size
//
_FIELD_TEST(parser_volumetric_enabled);
#if DISABLED(NO_VOLUMETRICS)
EEPROM_WRITE(parser.volumetric_enabled);
// Save filament sizes
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++)
EEPROM_WRITE(planner.filament_size[q]);
#else
const bool volumetric_enabled = false;
dummy = DEFAULT_NOMINAL_FILAMENT_DIA;
EEPROM_WRITE(volumetric_enabled);
for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummy);
#endif
//
// Save TMC2130 or TMC2208 Configuration, and placeholder values
//
_FIELD_TEST(tmc_stepper_current);
uint16_t tmc_stepper_current[TMC_AXES] = {
#if HAS_TRINAMIC
#if AXIS_IS_TMC(X)
stepperX.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(Y)
stepperY.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(Z)
stepperZ.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(X2)
stepperX2.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(Y2)
stepperY2.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(Z2)
stepperZ2.getCurrent(),
#else
0,
#endif
#if AXIS_IS_TMC(Z3)
stepperZ3.getCurrent(),
#else
0,
#endif
#if MAX_EXTRUDERS
#if AXIS_IS_TMC(E0)
stepperE0.getCurrent(),
#else
0,
#endif
#if MAX_EXTRUDERS > 1
#if AXIS_IS_TMC(E1)
stepperE1.getCurrent(),
#else
0,
#endif
#if MAX_EXTRUDERS > 2
#if AXIS_IS_TMC(E2)
stepperE2.getCurrent(),
#else
0,
#endif
#if MAX_EXTRUDERS > 3
#if AXIS_IS_TMC(E3)
stepperE3.getCurrent(),
#else
0,
#endif
#if MAX_EXTRUDERS > 4
#if AXIS_IS_TMC(E4)
stepperE4.getCurrent()
#else
0
#endif
#if MAX_EXTRUDERS > 5
#if AXIS_IS_TMC(E5)
stepperE5.getCurrent()
#else
0
#endif
#endif // MAX_EXTRUDERS > 5
#endif // MAX_EXTRUDERS > 4
#endif // MAX_EXTRUDERS > 3
#endif // MAX_EXTRUDERS > 2
#endif // MAX_EXTRUDERS > 1
#endif // MAX_EXTRUDERS
#else
0
#endif
};
EEPROM_WRITE(tmc_stepper_current);
//
// Save TMC2130 or TMC2208 Hybrid Threshold, and placeholder values
//
_FIELD_TEST(tmc_hybrid_threshold);
uint32_t tmc_hybrid_threshold[TMC_AXES] = {
#if ENABLED(HYBRID_THRESHOLD)
#if AXIS_HAS_STEALTHCHOP(X)
TMC_GET_PWMTHRS(X, X),
#else
X_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_GET_PWMTHRS(Y, Y),
#else
Y_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_GET_PWMTHRS(Z, Z),
#else
Z_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_GET_PWMTHRS(X, X2),
#else
X2_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_GET_PWMTHRS(Y, Y2),
#else
Y2_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_GET_PWMTHRS(Z, Z2),
#else
Z2_HYBRID_THRESHOLD,
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_GET_PWMTHRS(Z, Z3),
#else
Z3_HYBRID_THRESHOLD,
#endif
#if MAX_EXTRUDERS
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_GET_PWMTHRS(E, E0),
#else
E0_HYBRID_THRESHOLD,
#endif
#if MAX_EXTRUDERS > 1
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_GET_PWMTHRS(E, E1),
#else
E1_HYBRID_THRESHOLD,
#endif
#if MAX_EXTRUDERS > 2
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_GET_PWMTHRS(E, E2),
#else
E2_HYBRID_THRESHOLD,
#endif
#if MAX_EXTRUDERS > 3
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_GET_PWMTHRS(E, E3),
#else
E3_HYBRID_THRESHOLD,
#endif
#if MAX_EXTRUDERS > 4
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_GET_PWMTHRS(E, E4)
#else
E4_HYBRID_THRESHOLD
#endif
#if MAX_EXTRUDERS > 5
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_GET_PWMTHRS(E, E5)
#else
E5_HYBRID_THRESHOLD
#endif
#endif // MAX_EXTRUDERS > 5
#endif // MAX_EXTRUDERS > 4
#endif // MAX_EXTRUDERS > 3
#endif // MAX_EXTRUDERS > 2
#endif // MAX_EXTRUDERS > 1
#endif // MAX_EXTRUDERS
#else
100, 100, 3, // X, Y, Z
100, 100, 3, 3 // X2, Y2, Z2, Z3
#if MAX_EXTRUDERS
, 30 // E0
#if MAX_EXTRUDERS > 1
, 30 // E1
#if MAX_EXTRUDERS > 2
, 30 // E2
#if MAX_EXTRUDERS > 3
, 30 // E3
#if MAX_EXTRUDERS > 4
, 30 // E4
#if MAX_EXTRUDERS > 5
, 30 // E5
#endif
#endif
#endif
#endif
#endif
#endif
#endif
};
EEPROM_WRITE(tmc_hybrid_threshold);
//
// TMC2130 Sensorless homing threshold
//
int16_t tmc_sgt[XYZ] = {
#if ENABLED(SENSORLESS_HOMING)
#if X_SENSORLESS
stepperX.sgt(),
#else
0,
#endif
#if Y_SENSORLESS
stepperY.sgt(),
#else
0,
#endif
#if Z_SENSORLESS
stepperZ.sgt()
#else
0
#endif
#else
0
#endif
};
EEPROM_WRITE(tmc_sgt);
//
// Linear Advance
//
_FIELD_TEST(planner_extruder_advance_K);
#if ENABLED(LIN_ADVANCE)
LOOP_L_N(i, EXTRUDERS) EEPROM_WRITE(planner.extruder_advance_K[i]);
#else
dummy = 0;
LOOP_L_N(i, EXTRUDERS) EEPROM_WRITE(dummy);
#endif
_FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = XYZ; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]);
#else
const uint32_t dummyui32[XYZ] = { 0 };
EEPROM_WRITE(dummyui32);
#endif
//
// CNC Coordinate Systems
//
_FIELD_TEST(coordinate_system);
#if ENABLED(CNC_COORDINATE_SYSTEMS)
EEPROM_WRITE(gcode.coordinate_system); // 27 floats
#else
dummy = 0;
for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_WRITE(dummy);
#endif
//
// Skew correction factors
//
_FIELD_TEST(planner_xy_skew_factor);
#if ENABLED(SKEW_CORRECTION)
EEPROM_WRITE(planner.xy_skew_factor);
EEPROM_WRITE(planner.xz_skew_factor);
EEPROM_WRITE(planner.yz_skew_factor);
#else
dummy = 0;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
#endif
//
// Advanced Pause filament load & unload lengths
//
_FIELD_TEST(filament_change_unload_length);
#if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t q = 0; q < COUNT(filament_change_unload_length); q++) {
EEPROM_WRITE(filament_change_unload_length[q]);
EEPROM_WRITE(filament_change_load_length[q]);
}
#else
dummy = 0;
for (uint8_t q = EXTRUDERS * 2; q--;) EEPROM_WRITE(dummy);
#endif
//
// Validate CRC and Data Size
//
if (!eeprom_error) {
const uint16_t eeprom_size = eeprom_index - (EEPROM_OFFSET),
final_crc = working_crc;
// Write the EEPROM header
eeprom_index = EEPROM_OFFSET;
EEPROM_WRITE(version);
EEPROM_WRITE(final_crc);
// Report storage size
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, "Settings Stored (", eeprom_size);
SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc);
SERIAL_ECHOLNPGM_P(port, ")");
#endif
eeprom_error |= size_error(eeprom_size);
}
EEPROM_FINISH();
//
// UBL Mesh
//
#if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
if (ubl.storage_slot >= 0)
store_mesh(ubl.storage_slot);
#endif
return !eeprom_error;
}
/**
* M501 - Retrieve Configuration
*/
bool MarlinSettings::_load(PORTARG_SOLO) {
uint16_t working_crc = 0;
EEPROM_START();
char stored_ver[4];
EEPROM_READ_ALWAYS(stored_ver);
uint16_t stored_crc;
EEPROM_READ_ALWAYS(stored_crc);
// Version has to match or defaults are used
if (strncmp(version, stored_ver, 3) != 0) {
if (stored_ver[3] != '\0') {
stored_ver[0] = '?';
stored_ver[1] = '\0';
}
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPGM_P(port, "EEPROM version mismatch ");
SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
#endif
eeprom_error = true;
}
else {
float dummy = 0;
#if DISABLED(AUTO_BED_LEVELING_UBL) || DISABLED(FWRETRACT) || ENABLED(NO_VOLUMETRICS)
bool dummyb;
#endif
working_crc = 0; // Init to 0. Accumulated by EEPROM_READ
_FIELD_TEST(esteppers);
// Number of esteppers may change
uint8_t esteppers;
EEPROM_READ_ALWAYS(esteppers);
//
// Planner Motion
//
// Get only the number of E stepper parameters previously stored
// Any steppers added later are set to their defaults
const uint32_t def1[] = DEFAULT_MAX_ACCELERATION;
const float def2[] = DEFAULT_AXIS_STEPS_PER_UNIT, def3[] = DEFAULT_MAX_FEEDRATE;
uint32_t tmp1[XYZ + esteppers];
EEPROM_READ(tmp1); // max_acceleration_mm_per_s2
EEPROM_READ(planner.min_segment_time_us);
float tmp2[XYZ + esteppers], tmp3[XYZ + esteppers];
EEPROM_READ(tmp2); // axis_steps_per_mm
EEPROM_READ(tmp3); // max_feedrate_mm_s
if (!validating) LOOP_XYZE_N(i) {
planner.max_acceleration_mm_per_s2[i] = i < XYZ + esteppers ? tmp1[i] : def1[i < COUNT(def1) ? i : COUNT(def1) - 1];
planner.axis_steps_per_mm[i] = i < XYZ + esteppers ? tmp2[i] : def2[i < COUNT(def2) ? i : COUNT(def2) - 1];
planner.max_feedrate_mm_s[i] = i < XYZ + esteppers ? tmp3[i] : def3[i < COUNT(def3) ? i : COUNT(def3) - 1];
}
EEPROM_READ(planner.acceleration);
EEPROM_READ(planner.retract_acceleration);
EEPROM_READ(planner.travel_acceleration);
EEPROM_READ(planner.min_feedrate_mm_s);
EEPROM_READ(planner.min_travel_feedrate_mm_s);
#if HAS_CLASSIC_JERK
EEPROM_READ(planner.max_jerk);
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
EEPROM_READ(dummy);
#endif
#else
for (uint8_t q = 4; q--;) EEPROM_READ(dummy);
#endif
#if ENABLED(JUNCTION_DEVIATION)
EEPROM_READ(planner.junction_deviation_mm);
#else
EEPROM_READ(dummy);
#endif
//
// Home Offset (M206)
//
_FIELD_TEST(home_offset);
#if !HAS_HOME_OFFSET
float home_offset[XYZ];
#endif
EEPROM_READ(home_offset);
//
// Hotend Offsets, if any
//
#if HAS_HOTEND_OFFSET
// Skip hotend 0 which must be 0
for (uint8_t e = 1; e < HOTENDS; e++)
LOOP_XYZ(i) EEPROM_READ(hotend_offset[i][e]);
#endif
//
// Global Leveling
//
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
EEPROM_READ(new_z_fade_height);
#else
EEPROM_READ(dummy);
#endif
//
// Mesh (Manual) Bed Leveling
//
uint8_t mesh_num_x, mesh_num_y;
EEPROM_READ(dummy);
EEPROM_READ_ALWAYS(mesh_num_x);
EEPROM_READ_ALWAYS(mesh_num_y);
#if ENABLED(MESH_BED_LEVELING)
if (!validating) mbl.z_offset = dummy;
if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) {
// EEPROM data fits the current mesh
EEPROM_READ(mbl.z_values);
}
else {
// EEPROM data is stale
if (!validating) mbl.reset();
for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
}
#else
// MBL is disabled - skip the stored data
for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
#endif // MESH_BED_LEVELING
_FIELD_TEST(zprobe_zoffset);
#if !HAS_BED_PROBE
float zprobe_zoffset;
#endif
EEPROM_READ(zprobe_zoffset);
//
// Planar Bed Leveling matrix
//
#if ABL_PLANAR
EEPROM_READ(planner.bed_level_matrix);
#else
for (uint8_t q = 9; q--;) EEPROM_READ(dummy);
#endif
//
// Bilinear Auto Bed Leveling
//
uint8_t grid_max_x, grid_max_y;
EEPROM_READ_ALWAYS(grid_max_x); // 1 byte
EEPROM_READ_ALWAYS(grid_max_y); // 1 byte
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
if (grid_max_x == GRID_MAX_POINTS_X && grid_max_y == GRID_MAX_POINTS_Y) {
if (!validating) set_bed_leveling_enabled(false);
EEPROM_READ(bilinear_grid_spacing); // 2 ints
EEPROM_READ(bilinear_start); // 2 ints
EEPROM_READ(z_values); // 9 to 256 floats
}
else // EEPROM data is stale
#endif // AUTO_BED_LEVELING_BILINEAR
{
// Skip past disabled (or stale) Bilinear Grid data
int bgs[2], bs[2];
EEPROM_READ(bgs);
EEPROM_READ(bs);
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);
}
//
// Unified Bed Leveling active state
//
_FIELD_TEST(planner_leveling_active);
#if ENABLED(AUTO_BED_LEVELING_UBL)
EEPROM_READ(planner.leveling_active);
EEPROM_READ(ubl.storage_slot);
#else
uint8_t dummyui8;
EEPROM_READ(dummyb);
EEPROM_READ(dummyui8);
#endif // AUTO_BED_LEVELING_UBL
//
// SERVO_ANGLES
//
#if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES)
uint16_t servo_angles[NUM_SERVO_PLUGS][2];
#endif
EEPROM_READ(servo_angles);
//
// DELTA Geometry or Dual Endstops offsets
//
#if ENABLED(DELTA)
_FIELD_TEST(delta_height);
EEPROM_READ(delta_height); // 1 float
EEPROM_READ(delta_endstop_adj); // 3 floats
EEPROM_READ(delta_radius); // 1 float
EEPROM_READ(delta_diagonal_rod); // 1 float
EEPROM_READ(delta_segments_per_second); // 1 float
EEPROM_READ(delta_calibration_radius); // 1 float
EEPROM_READ(delta_tower_angle_trim); // 3 floats
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
_FIELD_TEST(x2_endstop_adj);
#if ENABLED(X_DUAL_ENDSTOPS)
EEPROM_READ(endstops.x2_endstop_adj); // 1 float
#else
EEPROM_READ(dummy);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
EEPROM_READ(endstops.y2_endstop_adj); // 1 float
#else
EEPROM_READ(dummy);
#endif
#if Z_MULTI_ENDSTOPS
EEPROM_READ(endstops.z2_endstop_adj); // 1 float
#else
EEPROM_READ(dummy);
#endif
#if ENABLED(Z_TRIPLE_ENDSTOPS)
EEPROM_READ(endstops.z3_endstop_adj); // 1 float
#else
EEPROM_READ(dummy);
#endif
#endif
//
// LCD Preheat settings
//
_FIELD_TEST(lcd_preheat_hotend_temp);
#if DISABLED(ULTIPANEL)
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#endif
EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
EEPROM_READ(lcd_preheat_bed_temp); // 2 floats
EEPROM_READ(lcd_preheat_fan_speed); // 2 floats
//EEPROM_ASSERT(
// WITHIN(lcd_preheat_fan_speed, 0, 255),
// "lcd_preheat_fan_speed out of range"
//);
//
// Hotend PID
//
#if ENABLED(PIDTEMP)
for (uint8_t e = 0; e < HOTENDS; e++) {
EEPROM_READ(dummy); // Kp
if (dummy != DUMMY_PID_VALUE) {
// do not need to scale PID values as the values in EEPROM are already scaled
if (!validating) PID_PARAM(Kp, e) = dummy;
EEPROM_READ(PID_PARAM(Ki, e));
EEPROM_READ(PID_PARAM(Kd, e));
#if ENABLED(PID_EXTRUSION_SCALING)
EEPROM_READ(PID_PARAM(Kc, e));
#else
EEPROM_READ(dummy);
#endif
}
else
for (uint8_t q=3; q--;) EEPROM_READ(dummy); // Ki, Kd, Kc
}
#else // !PIDTEMP
// 4 x 4 = 16 slots for PID parameters
for (uint8_t q = HOTENDS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
#endif // !PIDTEMP
//
// PID Extrusion Scaling
//
_FIELD_TEST(lpq_len);
#if DISABLED(PID_EXTRUSION_SCALING)
int16_t LPQ_LEN;
#endif
EEPROM_READ(LPQ_LEN);
//
// Heated Bed PID
//
#if ENABLED(PIDTEMPBED)
EEPROM_READ(dummy); // bedKp
if (dummy != DUMMY_PID_VALUE) {
if (!validating) thermalManager.bedKp = dummy;
EEPROM_READ(thermalManager.bedKi);
EEPROM_READ(thermalManager.bedKd);
}
#else
for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
#endif
//
// LCD Contrast
//
_FIELD_TEST(lcd_contrast);
#if !HAS_LCD_CONTRAST
int16_t lcd_contrast;
#endif
EEPROM_READ(lcd_contrast);
//
// Firmware Retraction
//
#if ENABLED(FWRETRACT)
EEPROM_READ(fwretract.autoretract_enabled);
EEPROM_READ(fwretract.retract_length);
EEPROM_READ(fwretract.retract_feedrate_mm_s);
EEPROM_READ(fwretract.retract_zlift);
EEPROM_READ(fwretract.retract_recover_length);
EEPROM_READ(fwretract.retract_recover_feedrate_mm_s);
EEPROM_READ(fwretract.swap_retract_length);
EEPROM_READ(fwretract.swap_retract_recover_length);
EEPROM_READ(fwretract.swap_retract_recover_feedrate_mm_s);
#else
EEPROM_READ(dummyb);
for (uint8_t q=8; q--;) EEPROM_READ(dummy);
#endif
//
// Volumetric & Filament Size
//
_FIELD_TEST(parser_volumetric_enabled);
#if DISABLED(NO_VOLUMETRICS)
EEPROM_READ(parser.volumetric_enabled);
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++) {
EEPROM_READ(dummy);
if (!validating) planner.filament_size[q] = dummy;
}
#else
EEPROM_READ(dummyb);
for (uint8_t q=EXTRUDERS; q--;) EEPROM_READ(dummy);
#endif
if (!validating) reset_stepper_drivers();
//
// TMC2130 Stepper Settings
//
_FIELD_TEST(tmc_stepper_current);
#if HAS_TRINAMIC
#define SET_CURR(Q) stepper##Q.setCurrent(currents[TMC_##Q] ? currents[TMC_##Q] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER)
uint16_t currents[TMC_AXES];
EEPROM_READ(currents);
if (!validating) {
#if AXIS_IS_TMC(X)
SET_CURR(X);
#endif
#if AXIS_IS_TMC(Y)
SET_CURR(Y);
#endif
#if AXIS_IS_TMC(Z)
SET_CURR(Z);
#endif
#if AXIS_IS_TMC(X2)
SET_CURR(X2);
#endif
#if AXIS_IS_TMC(Y2)
SET_CURR(Y2);
#endif
#if AXIS_IS_TMC(Z2)
SET_CURR(Z2);
#endif
#if AXIS_IS_TMC(Z3)
SET_CURR(Z3);
#endif
#if AXIS_IS_TMC(E0)
SET_CURR(E0);
#endif
#if AXIS_IS_TMC(E1)
SET_CURR(E1);
#endif
#if AXIS_IS_TMC(E2)
SET_CURR(E2);
#endif
#if AXIS_IS_TMC(E3)
SET_CURR(E3);
#endif
#if AXIS_IS_TMC(E4)
SET_CURR(E4);
#endif
#if AXIS_IS_TMC(E5)
SET_CURR(E5);
#endif
}
#else
uint16_t val;
for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(val);
#endif
#if ENABLED(HYBRID_THRESHOLD)
#define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[_AXIS(A)])
uint32_t tmc_hybrid_threshold[TMC_AXES];
EEPROM_READ(tmc_hybrid_threshold);
if (!validating) {
#if AXIS_HAS_STEALTHCHOP(X)
TMC_SET_PWMTHRS(X, X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_SET_PWMTHRS(Y, Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_SET_PWMTHRS(Z, Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_SET_PWMTHRS(X, X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_SET_PWMTHRS(Y, Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_SET_PWMTHRS(Z, Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_SET_PWMTHRS(Z, Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_SET_PWMTHRS(E, E0);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_SET_PWMTHRS(E, E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_SET_PWMTHRS(E, E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_SET_PWMTHRS(E, E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_SET_PWMTHRS(E, E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_SET_PWMTHRS(E, E5);
#endif
}
#else
uint32_t thrs_val;
for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(thrs_val);
#endif
/*
* TMC2130 Sensorless homing threshold.
* X and X2 use the same value
* Y and Y2 use the same value
* Z, Z2 and Z3 use the same value
*/
int16_t tmc_sgt[XYZ];
EEPROM_READ(tmc_sgt);
#if ENABLED(SENSORLESS_HOMING)
if (!validating) {
#ifdef X_HOMING_SENSITIVITY
#if AXIS_HAS_STALLGUARD(X)
stepperX.sgt(tmc_sgt[0]);
#endif
#if AXIS_HAS_STALLGUARD(X2)
stepperX2.sgt(tmc_sgt[0]);
#endif
#endif
#ifdef Y_HOMING_SENSITIVITY
#if AXIS_HAS_STALLGUARD(Y)
stepperY.sgt(tmc_sgt[1]);
#endif
#if AXIS_HAS_STALLGUARD(Y2)
stepperY2.sgt(tmc_sgt[1]);
#endif
#endif
#ifdef Z_HOMING_SENSITIVITY
#if AXIS_HAS_STALLGUARD(Z)
stepperZ.sgt(tmc_sgt[2]);
#endif
#if AXIS_HAS_STALLGUARD(Z2)
stepperZ2.sgt(tmc_sgt[2]);
#endif
#if AXIS_HAS_STALLGUARD(Z3)
stepperZ3.sgt(tmc_sgt[2]);
#endif
#endif
}
#endif
//
// Linear Advance
//
_FIELD_TEST(planner_extruder_advance_K);
LOOP_L_N(i, EXTRUDERS) {
#if ENABLED(LIN_ADVANCE)
EEPROM_READ(planner.extruder_advance_K[i]);
#else
EEPROM_READ(dummy);
#endif
}
//
// Motor Current PWM
//
_FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = XYZ; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
#else
uint32_t dummyui32[XYZ];
EEPROM_READ(dummyui32);
#endif
//
// CNC Coordinate System
//
_FIELD_TEST(coordinate_system);
#if ENABLED(CNC_COORDINATE_SYSTEMS)
if (!validating) (void)gcode.select_coordinate_system(-1); // Go back to machine space
EEPROM_READ(gcode.coordinate_system); // 27 floats
#else
for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_READ(dummy);
#endif
//
// Skew correction factors
//
_FIELD_TEST(planner_xy_skew_factor);
#if ENABLED(SKEW_CORRECTION_GCODE)
EEPROM_READ(planner.xy_skew_factor);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
EEPROM_READ(planner.xz_skew_factor);
EEPROM_READ(planner.yz_skew_factor);
#else
EEPROM_READ(dummy);
EEPROM_READ(dummy);
#endif
#else
for (uint8_t q = 3; q--;) EEPROM_READ(dummy);
#endif
//
// Advanced Pause filament load & unload lengths
//
_FIELD_TEST(filament_change_unload_length);
#if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t q = 0; q < COUNT(filament_change_unload_length); q++) {
EEPROM_READ(dummy);
if (!validating && q < COUNT(filament_change_unload_length)) filament_change_unload_length[q] = dummy;
EEPROM_READ(dummy);
if (!validating && q < COUNT(filament_change_load_length)) filament_change_load_length[q] = dummy;
}
#else
for (uint8_t q = EXTRUDERS * 2; q--;) EEPROM_READ(dummy);
#endif
eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
if (eeprom_error) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET)));
SERIAL_ECHOLNPAIR_P(port, " Size: ", datasize());
#endif
}
else if (working_crc != stored_crc) {
eeprom_error = true;
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORPGM_P(port, "EEPROM CRC mismatch - (stored) ");
SERIAL_ERROR_P(port, stored_crc);
SERIAL_ERRORPGM_P(port, " != ");
SERIAL_ERROR_P(port, working_crc);
SERIAL_ERRORLNPGM_P(port, " (calculated)!");
#endif
}
else if (!validating) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHO_P(port, version);
SERIAL_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc);
SERIAL_ECHOLNPGM_P(port, ")");
#endif
}
if (!validating && !eeprom_error) postprocess();
#if ENABLED(AUTO_BED_LEVELING_UBL)
if (!validating) {
ubl.report_state();
if (!ubl.sanity_check()) {
SERIAL_EOL_P(port);
#if ENABLED(EEPROM_CHITCHAT)
ubl.echo_name();
SERIAL_ECHOLNPGM_P(port, " initialized.\n");
#endif
}
else {
eeprom_error = true;
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLPGM_P(port, "?Can't enable ");
ubl.echo_name();
SERIAL_PROTOCOLLNPGM_P(port, ".");
#endif
ubl.reset();
}
if (ubl.storage_slot >= 0) {
load_mesh(ubl.storage_slot);
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot);
SERIAL_ECHOLNPGM_P(port, " loaded from storage.");
#endif
}
else {
ubl.reset();
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM_P(port, "UBL System reset()");
#endif
}
}
#endif
}
#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
if (!validating) report(PORTVAR_SOLO);
#endif
EEPROM_FINISH();
return !eeprom_error;
}
bool MarlinSettings::validate(PORTARG_SOLO) {
validating = true;
const bool success = _load(PORTVAR_SOLO);
validating = false;
return success;
}
bool MarlinSettings::load(PORTARG_SOLO) {
if (validate(PORTVAR_SOLO)) return _load(PORTVAR_SOLO);
reset();
return true;
}
#if ENABLED(AUTO_BED_LEVELING_UBL)
#if ENABLED(EEPROM_CHITCHAT)
void ubl_invalid_slot(const int s) {
SERIAL_PROTOCOLLNPGM("?Invalid slot.");
SERIAL_PROTOCOL(s);
SERIAL_PROTOCOLLNPGM(" mesh slots available.");
}
#endif
const uint16_t MarlinSettings::meshes_end = persistentStore.capacity() - 129; // 128 (+1 because of the change to capacity rather than last valid address)
// is a placeholder for the size of the MAT; the MAT will always
// live at the very end of the eeprom
uint16_t MarlinSettings::meshes_start_index() {
return (datasize() + EEPROM_OFFSET + 32) & 0xFFF8; // Pad the end of configuration data so it can float up
// or down a little bit without disrupting the mesh data
}
uint16_t MarlinSettings::calc_num_meshes() {
return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
}
int MarlinSettings::mesh_slot_offset(const int8_t slot) {
return meshes_end - (slot + 1) * sizeof(ubl.z_values);
}
void MarlinSettings::store_mesh(const int8_t slot) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
const int16_t a = calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) {
#if ENABLED(EEPROM_CHITCHAT)
ubl_invalid_slot(a);
SERIAL_PROTOCOLPAIR("E2END=", persistentStore.capacity() - 1);
SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
SERIAL_PROTOCOLLNPAIR(" slot=", slot);
SERIAL_EOL();
#endif
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
persistentStore.access_start();
const bool status = persistentStore.write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
persistentStore.access_finish();
if (status)
SERIAL_PROTOCOLPGM("?Unable to save mesh data.\n");
// Write crc to MAT along with other data, or just tack on to the beginning or end
#if ENABLED(EEPROM_CHITCHAT)
if (!status)
SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
#endif
#else
// Other mesh types
#endif
}
void MarlinSettings::load_mesh(const int8_t slot, void * const into/*=NULL*/) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
const int16_t a = settings.calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) {
#if ENABLED(EEPROM_CHITCHAT)
ubl_invalid_slot(a);
#endif
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values;
persistentStore.access_start();
const uint16_t status = persistentStore.read_data(pos, dest, sizeof(ubl.z_values), &crc);
persistentStore.access_finish();
if (status)
SERIAL_PROTOCOLPGM("?Unable to load mesh data.\n");
#if ENABLED(EEPROM_CHITCHAT)
else
SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
#endif
EEPROM_FINISH();
#else
// Other mesh types
#endif
}
//void MarlinSettings::delete_mesh() { return; }
//void MarlinSettings::defrag_meshes() { return; }
#endif // AUTO_BED_LEVELING_UBL
#else // !EEPROM_SETTINGS
bool MarlinSettings::save(PORTARG_SOLO) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
#endif
return false;
}
#endif // !EEPROM_SETTINGS
/**
* M502 - Reset Configuration
*/
void MarlinSettings::reset(PORTARG_SOLO) {
static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
LOOP_XYZE_N(i) {
planner.axis_steps_per_mm[i] = pgm_read_float(&tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1]);
planner.max_feedrate_mm_s[i] = pgm_read_float(&tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1]);
planner.max_acceleration_mm_per_s2[i] = pgm_read_dword_near(&tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1]);
}
planner.min_segment_time_us = DEFAULT_MINSEGMENTTIME;
planner.acceleration = DEFAULT_ACCELERATION;
planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE;
planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE;
#if ENABLED(JUNCTION_DEVIATION)
planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM);
#endif
#if HAS_CLASSIC_JERK
planner.max_jerk[X_AXIS] = DEFAULT_XJERK;
planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
#if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE)
planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
#endif
#endif
#if HAS_HOME_OFFSET
ZERO(home_offset);
#endif
#if HAS_HOTEND_OFFSET
constexpr float tmp4[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z };
static_assert(
tmp4[X_AXIS][0] == 0 && tmp4[Y_AXIS][0] == 0 && tmp4[Z_AXIS][0] == 0,
"Offsets for the first hotend must be 0.0."
);
LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e];
#if ENABLED(DUAL_X_CARRIAGE)
hotend_offset[X_AXIS][1] = MAX(X2_HOME_POS, X2_MAX_POS);
#endif
#endif
//
// Global Leveling
//
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
new_z_fade_height = 0.0;
#endif
#if HAS_LEVELING
reset_bed_level();
#endif
#if HAS_BED_PROBE
zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#endif
//
// Servo Angles
//
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)
#if ENABLED(SWITCHING_EXTRUDER)
#if EXTRUDERS > 3
#define REQ_ANGLES 4
#else
#define REQ_ANGLES 2
#endif
constexpr uint16_t extruder_angles[] = SWITCHING_EXTRUDER_SERVO_ANGLES;
static_assert(COUNT(extruder_angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles.");
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = extruder_angles[0];
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = extruder_angles[1];
#if EXTRUDERS > 3
servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = extruder_angles[2];
servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = extruder_angles[3];
#endif
#elif ENABLED(SWITCHING_NOZZLE)
constexpr uint16_t nozzle_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES;
servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzle_angles[0];
servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzle_angles[1];
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
constexpr uint16_t z_probe_angles[2] = Z_SERVO_ANGLES;
servo_angles[Z_PROBE_SERVO_NR][0] = z_probe_angles[0];
servo_angles[Z_PROBE_SERVO_NR][1] = z_probe_angles[1];
#endif
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
#if ENABLED(DELTA)
const float adj[ABC] = DELTA_ENDSTOP_ADJ,
dta[ABC] = DELTA_TOWER_ANGLE_TRIM;
delta_height = DELTA_HEIGHT;
COPY(delta_endstop_adj, adj);
delta_radius = DELTA_RADIUS;
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
COPY(delta_tower_angle_trim, dta);
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
#if ENABLED(X_DUAL_ENDSTOPS)
endstops.x2_endstop_adj = (
#ifdef X_DUAL_ENDSTOPS_ADJUSTMENT
X_DUAL_ENDSTOPS_ADJUSTMENT
#else
0
#endif
);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
endstops.y2_endstop_adj = (
#ifdef Y_DUAL_ENDSTOPS_ADJUSTMENT
Y_DUAL_ENDSTOPS_ADJUSTMENT
#else
0
#endif
);
#endif
#if ENABLED(Z_DUAL_ENDSTOPS)
endstops.z2_endstop_adj = (
#ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
Z_DUAL_ENDSTOPS_ADJUSTMENT
#else
0
#endif
);
#elif ENABLED(Z_TRIPLE_ENDSTOPS)
endstops.z2_endstop_adj = (
#ifdef Z_TRIPLE_ENDSTOPS_ADJUSTMENT2
Z_TRIPLE_ENDSTOPS_ADJUSTMENT2
#else
0
#endif
);
endstops.z3_endstop_adj = (
#ifdef Z_TRIPLE_ENDSTOPS_ADJUSTMENT3
Z_TRIPLE_ENDSTOPS_ADJUSTMENT3
#else
0
#endif
);
#endif
#endif
#if ENABLED(ULTIPANEL)
lcd_preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
lcd_preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
lcd_preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
lcd_preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
lcd_preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
lcd_preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
#endif
#if ENABLED(PIDTEMP)
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
HOTEND_LOOP()
#endif
{
PID_PARAM(Kp, e) = float(DEFAULT_Kp);
PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
#if ENABLED(PID_EXTRUSION_SCALING)
PID_PARAM(Kc, e) = DEFAULT_Kc;
#endif
}
#if ENABLED(PID_EXTRUSION_SCALING)
thermalManager.lpq_len = 20; // default last-position-queue size
#endif
#endif // PIDTEMP
#if ENABLED(PIDTEMPBED)
thermalManager.bedKp = DEFAULT_bedKp;
thermalManager.bedKi = scalePID_i(DEFAULT_bedKi);
thermalManager.bedKd = scalePID_d(DEFAULT_bedKd);
#endif
#if HAS_LCD_CONTRAST
lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif
#if ENABLED(FWRETRACT)
fwretract.reset();
#endif
#if DISABLED(NO_VOLUMETRICS)
parser.volumetric_enabled =
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
true
#else
false
#endif
;
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++)
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
#endif
endstops.enable_globally(
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
true
#else
false
#endif
);
reset_stepper_drivers();
#if ENABLED(LIN_ADVANCE)
LOOP_L_N(i, EXTRUDERS) planner.extruder_advance_K[i] = LIN_ADVANCE_K;
#endif
#if HAS_MOTOR_CURRENT_PWM
uint32_t tmp_motor_current_setting[XYZ] = PWM_MOTOR_CURRENT;
for (uint8_t q = XYZ; q--;)
stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
#endif
#if ENABLED(SKEW_CORRECTION_GCODE)
planner.xy_skew_factor = XY_SKEW_FACTOR;
#if ENABLED(SKEW_CORRECTION_FOR_Z)
planner.xz_skew_factor = XZ_SKEW_FACTOR;
planner.yz_skew_factor = YZ_SKEW_FACTOR;
#endif
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t e = 0; e < EXTRUDERS; e++) {
filament_change_unload_length[e] = FILAMENT_CHANGE_UNLOAD_LENGTH;
filament_change_load_length[e] = FILAMENT_CHANGE_FAST_LOAD_LENGTH;
}
#endif
postprocess();
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded");
#endif
}
#if DISABLED(DISABLE_M503)
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
#if HAS_TRINAMIC
void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M906"); }
#if ENABLED(HYBRID_THRESHOLD)
void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); }
#endif
#if ENABLED(SENSORLESS_HOMING)
void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M914"); }
#endif
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
void say_M603(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M603 "); }
#endif
inline void say_units(
#if NUM_SERIAL > 1
const int8_t port,
#endif
const bool colon
) {
serialprintPGM_P(port,
#if ENABLED(INCH_MODE_SUPPORT)
parser.linear_unit_factor != 1.0 ? PSTR(" (in)") :
#endif
PSTR(" (mm)")
);
if (colon) SERIAL_ECHOLNPGM_P(port, ":");
}
#if NUM_SERIAL > 1
#define SAY_UNITS_P(PORT, COLON) say_units(PORT, COLON)
#else
#define SAY_UNITS_P(PORT, COLON) say_units(COLON)
#endif
/**
* M503 - Report current settings in RAM
*
* Unless specifically disabled, M503 is available even without EEPROM
*/
void MarlinSettings::report(const bool forReplay
#if NUM_SERIAL > 1
, const int8_t port/*=-1*/
#endif
) {
/**
* Announce current units, in case inches are being displayed
*/
CONFIG_ECHO_START;
#if ENABLED(INCH_MODE_SUPPORT)
#define LINEAR_UNIT(N) (float(N) / parser.linear_unit_factor)
#define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor))
SERIAL_ECHOPGM_P(port, " G2");
SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_ECHOPGM_P(port, " ;");
SAY_UNITS_P(port, false);
#else
#define LINEAR_UNIT(N) (N)
#define VOLUMETRIC_UNIT(N) (N)
SERIAL_ECHOPGM_P(port, " G21 ; Units in mm");
SAY_UNITS_P(port, false);
#endif
SERIAL_EOL_P(port);
#if ENABLED(ULTIPANEL)
// Temperature units - for Ultipanel temperature options
CONFIG_ECHO_START;
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
#define TEMP_UNIT(N) parser.to_temp_units(N)
SERIAL_ECHOPGM_P(port, " M149 ");
SERIAL_CHAR_P(port, parser.temp_units_code());
SERIAL_ECHOPGM_P(port, " ; Units in ");
serialprintPGM_P(port, parser.temp_units_name());
#else
#define TEMP_UNIT(N) (N)
SERIAL_ECHOLNPGM_P(port, " M149 C ; Units in Celsius");
#endif
#endif
SERIAL_EOL_P(port);
#if DISABLED(NO_VOLUMETRICS)
/**
* Volumetric extrusion M200
*/
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, "Filament settings:");
if (parser.volumetric_enabled)
SERIAL_EOL_P(port);
else
SERIAL_ECHOLNPGM_P(port, " Disabled");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 D", LINEAR_UNIT(planner.filament_size[0]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 1
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 2
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 3
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 4
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 5
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M200 T5 D", LINEAR_UNIT(planner.filament_size[5]));
SERIAL_EOL_P(port);
#endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
if (!parser.volumetric_enabled) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, " M200 D0");
}
#endif // !NO_VOLUMETRICS
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Steps per unit:");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.axis_steps_per_mm[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.axis_steps_per_mm[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.axis_steps_per_mm[Z_AXIS]));
#if DISABLED(DISTINCT_E_FACTORS)
SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.axis_steps_per_mm[E_AXIS]));
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M92 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.axis_steps_per_mm[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Maximum feedrates (units/s):");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M203 X", LINEAR_UNIT(planner.max_feedrate_mm_s[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_feedrate_mm_s[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_feedrate_mm_s[Z_AXIS]));
#if DISABLED(DISTINCT_E_FACTORS)
SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_feedrate_mm_s[E_AXIS]));
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M203 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_feedrate_mm_s[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Maximum Acceleration (units/s2):");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M201 X", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[Z_AXIS]));
#if DISABLED(DISTINCT_E_FACTORS)
SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS]));
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M201 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M204 P", LINEAR_UNIT(planner.acceleration));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.retract_acceleration));
SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.travel_acceleration));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>");
#if ENABLED(JUNCTION_DEVIATION)
SERIAL_ECHOPGM_P(port, " J<junc_dev>");
#endif
#if HAS_CLASSIC_JERK
SERIAL_ECHOPGM_P(port, " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>");
#if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE)
SERIAL_ECHOPGM_P(port, " E<max_e_jerk>");
#endif
#endif
SERIAL_EOL_P(port);
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M205 B", LINEAR_UNIT(planner.min_segment_time_us));
SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.min_feedrate_mm_s));
SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.min_travel_feedrate_mm_s));
#if ENABLED(JUNCTION_DEVIATION)
SERIAL_ECHOPAIR_P(port, " J", LINEAR_UNIT(planner.junction_deviation_mm));
#endif
#if HAS_CLASSIC_JERK
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(planner.max_jerk[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_jerk[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_jerk[Z_AXIS]));
#if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE)
SERIAL_ECHOPAIR_P(port, " E", LINEAR_UNIT(planner.max_jerk[E_AXIS]));
#endif
#endif
SERIAL_EOL_P(port);
#if HAS_M206_COMMAND
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Home offset:");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M206 X", LINEAR_UNIT(home_offset[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(home_offset[Y_AXIS]));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(home_offset[Z_AXIS]));
#endif
#if HAS_HOTEND_OFFSET
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Hotend offsets:");
}
CONFIG_ECHO_START;
for (uint8_t e = 1; e < HOTENDS; e++) {
SERIAL_ECHOPAIR_P(port, " M218 T", (int)e);
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(hotend_offset[X_AXIS][e]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e]));
SERIAL_ECHO_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3);
SERIAL_EOL_P(port);
}
#endif
/**
* Bed Leveling
*/
#if HAS_LEVELING
#if ENABLED(MESH_BED_LEVELING)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Mesh Bed Leveling:");
}
#elif ENABLED(AUTO_BED_LEVELING_UBL)
if (!forReplay) {
CONFIG_ECHO_START;
ubl.echo_name();
SERIAL_ECHOLNPGM_P(port, ":");
}
#elif HAS_ABL
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Auto Bed Leveling:");
}
#endif
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M420 S", planner.leveling_active ? 1 : 0);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.z_fade_height));
#endif
SERIAL_EOL_P(port);
#if ENABLED(MESH_BED_LEVELING)
if (leveling_is_valid()) {
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " G29 S3 X", (int)px + 1);
SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
SERIAL_ECHOPGM_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5);
SERIAL_EOL_P(port);
}
}
}
#elif ENABLED(AUTO_BED_LEVELING_UBL)
if (!forReplay) {
SERIAL_EOL_P(port);
ubl.report_state();
SERIAL_ECHOLNPAIR_P(port, "\nActive Mesh Slot: ", ubl.storage_slot);
SERIAL_ECHOPAIR_P(port, "EEPROM can hold ", calc_num_meshes());
SERIAL_ECHOLNPGM_P(port, " meshes.\n");
}
// ubl.report_current_mesh(PORTVAR_SOLO); // This is too verbose for large mesh's. A better (more terse)
// solution needs to be found.
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
if (leveling_is_valid()) {
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " G29 W I", (int)px);
SERIAL_ECHOPAIR_P(port, " J", (int)py);
SERIAL_ECHOPGM_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(z_values[px][py]), 5);
SERIAL_EOL_P(port);
}
}
}
#endif
#endif // HAS_LEVELING
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Servo Angles:");
}
for (uint8_t i = 0; i < NUM_SERVOS; i++) {
switch (i) {
#if ENABLED(SWITCHING_EXTRUDER)
case SWITCHING_EXTRUDER_SERVO_NR:
#if EXTRUDERS > 3
case SWITCHING_EXTRUDER_E23_SERVO_NR:
#endif
#elif ENABLED(SWITCHING_NOZZLE)
case SWITCHING_NOZZLE_SERVO_NR:
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
case Z_PROBE_SERVO_NR:
#endif
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M281 P", int(i));
SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]);
SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]);
SERIAL_EOL_P(port);
default: break;
}
}
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
#if ENABLED(DELTA)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS]));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS]));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M665 L", LINEAR_UNIT(delta_diagonal_rod));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(delta_radius));
SERIAL_ECHOPAIR_P(port, " H", LINEAR_UNIT(delta_height));
SERIAL_ECHOPAIR_P(port, " S", delta_segments_per_second);
SERIAL_ECHOPAIR_P(port, " B", LINEAR_UNIT(delta_calibration_radius));
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS]));
SERIAL_EOL_P(port);
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
}
CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, " M666");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(endstops.x2_endstop_adj));
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(endstops.y2_endstop_adj));
#endif
#if ENABLED(Z_TRIPLE_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(port, "S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj));
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
#elif ENABLED(Z_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(endstops.z2_endstop_adj));
#endif
SERIAL_EOL_P(port);
#endif // [XYZ]_DUAL_ENDSTOPS
#if ENABLED(ULTIPANEL)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Material heatup parameters:");
}
for (uint8_t i = 0; i < COUNT(lcd_preheat_hotend_temp); i++) {
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M145 S", (int)i);
SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(lcd_preheat_hotend_temp[i]));
SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(lcd_preheat_bed_temp[i]));
SERIAL_ECHOLNPAIR_P(port, " F", lcd_preheat_fan_speed[i]);
}
#endif // ULTIPANEL
#if HAS_PID_HEATING
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "PID settings:");
}
#if ENABLED(PIDTEMP)
#if HOTENDS > 1
if (forReplay) {
HOTEND_LOOP() {
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M301 E", e);
SERIAL_ECHOPAIR_P(port, " P", PID_PARAM(Kp, e));
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, e)));
SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, e)));
#if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR_P(port, " C", PID_PARAM(Kc, e));
if (e == 0) SERIAL_ECHOPAIR_P(port, " L", thermalManager.lpq_len);
#endif
SERIAL_EOL_P(port);
}
}
else
#endif // HOTENDS > 1
// !forReplay || HOTENDS == 1
{
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, 0)));
SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, 0)));
#if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR_P(port, " C", PID_PARAM(Kc, 0));
SERIAL_ECHOPAIR_P(port, " L", thermalManager.lpq_len);
#endif
SERIAL_EOL_P(port);
}
#endif // PIDTEMP
#if ENABLED(PIDTEMPBED)
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M304 P", thermalManager.bedKp);
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bedKi));
SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bedKd));
SERIAL_EOL_P(port);
#endif
#endif // PIDTEMP || PIDTEMPBED
#if HAS_LCD_CONTRAST
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "LCD Contrast:");
}
CONFIG_ECHO_START;
SERIAL_ECHOLNPAIR_P(port, " M250 C", lcd_contrast);
#endif
#if ENABLED(FWRETRACT)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Retract: S<length> F<units/m> Z<lift>");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M207 S", LINEAR_UNIT(fwretract.retract_length));
SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.swap_retract_length));
SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.retract_feedrate_mm_s)));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.retract_zlift));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Recover: S<length> F<units/m>");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR_P(port, " M208 S", LINEAR_UNIT(fwretract.retract_recover_length));
SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.swap_retract_recover_length));
SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.retract_recover_feedrate_mm_s)));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
}
CONFIG_ECHO_START;
SERIAL_ECHOLNPAIR_P(port, " M209 S", fwretract.autoretract_enabled ? 1 : 0);
#endif // FWRETRACT
/**
* Probe Offset
*/
#if HAS_BED_PROBE
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, "Z-Probe Offset (mm):");
SAY_UNITS_P(port, true);
}
CONFIG_ECHO_START;
SERIAL_ECHOLNPAIR_P(port, " M851 Z", LINEAR_UNIT(zprobe_zoffset));
#endif
/**
* Bed Skew Correction
*/
#if ENABLED(SKEW_CORRECTION_GCODE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Skew Factor: ");
}
CONFIG_ECHO_START;
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPGM_P(port, " M852 I");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6);
SERIAL_ECHOPGM_P(port, " J");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xz_skew_factor), 6);
SERIAL_ECHOPGM_P(port, " K");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6);
SERIAL_EOL_P(port);
#else
SERIAL_ECHOPGM_P(port, " M852 S");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6);
SERIAL_EOL_P(port);
#endif
#endif
#if HAS_TRINAMIC
/**
* TMC2130 / TMC2208 stepper driver current
*/
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
}
CONFIG_ECHO_START;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M906(PORTVAR_SOLO);
#endif
#if AXIS_IS_TMC(X)
SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent());
#endif
#if AXIS_IS_TMC(Y)
SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent());
#endif
#if AXIS_IS_TMC(Z)
SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent());
#endif
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
SERIAL_EOL_P(port);
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1");
#endif
#if AXIS_IS_TMC(X2)
SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent());
#endif
#if AXIS_IS_TMC(Y2)
SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent());
#endif
#if AXIS_IS_TMC(Z2)
SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent());
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
SERIAL_EOL_P(port);
#endif
#if AXIS_IS_TMC(Z3)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " I2 Z", stepperZ3.getCurrent());
#endif
#if AXIS_IS_TMC(E0)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getCurrent());
#endif
#if E_STEPPERS > 1 && AXIS_IS_TMC(E1)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getCurrent());
#endif
#if E_STEPPERS > 2 && AXIS_IS_TMC(E2)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getCurrent());
#endif
#if E_STEPPERS > 3 && AXIS_IS_TMC(E3)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getCurrent());
#endif
#if E_STEPPERS > 4 && AXIS_IS_TMC(E4)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getCurrent());
#endif
#if E_STEPPERS > 5 && AXIS_IS_TMC(E5)
say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T5 E", stepperE5.getCurrent());
#endif
SERIAL_EOL_P(port);
/**
* TMC2130 / TMC2208 / TRAMS Hybrid Threshold
*/
#if ENABLED(HYBRID_THRESHOLD)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
}
CONFIG_ECHO_START;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M913(PORTVAR_SOLO);
#endif
#if AXIS_IS_TMC(X)
SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X));
#endif
#if AXIS_IS_TMC(Y)
SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y));
#endif
#if AXIS_IS_TMC(Z)
SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z));
#endif
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
SERIAL_EOL_P(port);
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1");
#endif
#if AXIS_IS_TMC(X2)
SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2));
#endif
#if AXIS_IS_TMC(Y2)
SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2));
#endif
#if AXIS_IS_TMC(Z2)
SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2));
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
SERIAL_EOL_P(port);
#endif
#if AXIS_IS_TMC(Z3)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I2");
SERIAL_ECHOLNPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z3));
#endif
#if AXIS_IS_TMC(E0)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0));
#endif
#if E_STEPPERS > 1 && AXIS_IS_TMC(E1)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1));
#endif
#if E_STEPPERS > 2 && AXIS_IS_TMC(E2)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2));
#endif
#if E_STEPPERS > 3 && AXIS_IS_TMC(E3)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3));
#endif
#if E_STEPPERS > 4 && AXIS_IS_TMC(E4)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4));
#endif
#if E_STEPPERS > 5 && AXIS_IS_TMC(E5)
say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T5 E", TMC_GET_PWMTHRS(E, E5));
#endif
SERIAL_EOL_P(port);
#endif // HYBRID_THRESHOLD
/**
* TMC2130 Sensorless homing thresholds
*/
#if ENABLED(SENSORLESS_HOMING)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:");
}
CONFIG_ECHO_START;
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
say_M914(PORTVAR_SOLO);
#if X_SENSORLESS
SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt());
#endif
#if Y_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt());
#endif
#if Z_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt());
#endif
SERIAL_EOL_P(port);
#endif
#define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2))
#define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2))
#define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2))
#define HAS_Z3_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3))
#if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS
say_M914(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1");
#if HAS_X2_SENSORLESS
SERIAL_ECHOPAIR_P(port, " X", stepperX2.sgt());
#endif
#if HAS_Y2_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Y", stepperY2.sgt());
#endif
#if HAS_Z2_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.sgt());
#endif
SERIAL_EOL_P(port);
#endif
#if HAS_Z3_SENSORLESS
say_M914(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I2");
SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt());
#endif
#endif // SENSORLESS_HOMING
#endif // HAS_TRINAMIC
/**
* Linear Advance
*/
#if ENABLED(LIN_ADVANCE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Linear Advance:");
}
CONFIG_ECHO_START;
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR_P(port, " M900 K", planner.extruder_advance_K[0]);
#else
LOOP_L_N(i, EXTRUDERS) {
SERIAL_ECHOPAIR_P(port, " M900 T", int(i));
SERIAL_ECHOLNPAIR_P(port, " K", planner.extruder_advance_K[i]);
}
#endif
#endif
#if HAS_MOTOR_CURRENT_PWM
CONFIG_ECHO_START;
if (!forReplay) {
SERIAL_ECHOLNPGM_P(port, "Stepper motor currents:");
CONFIG_ECHO_START;
}
SERIAL_ECHOPAIR_P(port, " M907 X", stepper.motor_current_setting[0]);
SERIAL_ECHOPAIR_P(port, " Z", stepper.motor_current_setting[1]);
SERIAL_ECHOPAIR_P(port, " E", stepper.motor_current_setting[2]);
SERIAL_EOL_P(port);
#endif
/**
* Advanced Pause filament load & unload lengths
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Filament load/unload lengths:");
}
CONFIG_ECHO_START;
#if EXTRUDERS == 1
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(filament_change_load_length[0]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0]));
#else
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(filament_change_load_length[0]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0]));
CONFIG_ECHO_START;
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(filament_change_load_length[1]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[1]));
#if EXTRUDERS > 2
CONFIG_ECHO_START;
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(filament_change_load_length[2]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[2]));
#if EXTRUDERS > 3
CONFIG_ECHO_START;
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(filament_change_load_length[3]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[3]));
#if EXTRUDERS > 4
CONFIG_ECHO_START;
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(filament_change_load_length[4]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[4]));
#if EXTRUDERS > 5
CONFIG_ECHO_START;
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(filament_change_load_length[5]));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[5]));
#endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS == 1
#endif // ADVANCED_PAUSE_FEATURE
}
#endif // !DISABLE_M503
| [
"63288620+rpacadi@users.noreply.github.com"
] | 63288620+rpacadi@users.noreply.github.com |
baafe0814a37e6f4b736042120ff6bbe94ed268c | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/squid/gumtree/squid_repos_function_3236_last_repos.cpp | 0bd05f718f178c8daaa26b7f4e123fc345dbb3a1 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 161 | cpp | bool
Ip::Address::operator >=(const Ip::Address &rhs) const
{
if (isNoAddr() && !rhs.isNoAddr())
return true;
return ( matchIPAddr(rhs) >= 0);
} | [
"993273596@qq.com"
] | 993273596@qq.com |
a0b296a1b8e02350a5cd4c73370f74f8cfc871ff | 9be246df43e02fba30ee2595c8cec14ac2b355d1 | /dlls/tf2_dll/tf_obj_rallyflag.cpp | 4d20b5b863c7e20ce3677ba3857875bcf8bcddd8 | [] | no_license | Clepoy3/LeakNet | 6bf4c5d5535b3824a350f32352f457d8be87d609 | 8866efcb9b0bf9290b80f7263e2ce2074302640a | refs/heads/master | 2020-05-30T04:53:22.193725 | 2019-04-12T16:06:26 | 2019-04-12T16:06:26 | 189,544,338 | 18 | 5 | null | 2019-05-31T06:59:39 | 2019-05-31T06:59:39 | null | WINDOWS-1252 | C++ | false | false | 3,227 | cpp | //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "cbase.h"
#include "tf_player.h"
#include "tf_team.h"
#include "tf_gamerules.h"
#include "tf_obj.h"
#include "tf_obj_rallyflag.h"
#include "ndebugoverlay.h"
BEGIN_DATADESC( CObjectRallyFlag )
DEFINE_THINKFUNC( CObjectRallyFlag, RallyThink ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST(CObjectRallyFlag, DT_ObjectRallyFlag)
END_SEND_TABLE();
LINK_ENTITY_TO_CLASS(obj_rallyflag, CObjectRallyFlag);
PRECACHE_REGISTER(obj_rallyflag);
ConVar obj_rallyflag_health( "obj_rallyflag_health","100", FCVAR_NONE, "Rally Flag health" );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CObjectRallyFlag::CObjectRallyFlag()
{
UseClientSideAnimation();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CObjectRallyFlag::Spawn()
{
Precache();
SetModel( RALLYFLAG_MODEL );
SetSolid( SOLID_BBOX );
SetCollisionGroup( TFCOLLISION_GROUP_COMBATOBJECT );
UTIL_SetSize(this, RALLYFLAG_MINS, RALLYFLAG_MAXS);
m_takedamage = DAMAGE_YES;
m_iHealth = obj_rallyflag_health.GetInt();
SetThink( RallyThink );
SetNextThink( gpGlobals->curtime + 0.1f );
m_flExpiresAt = gpGlobals->curtime + RALLYFLAG_LIFETIME;
SetType( OBJ_RALLYFLAG );
m_fObjectFlags |= OF_SUPPRESS_NOTIFY_UNDER_ATTACK | OF_SUPPRESS_TECH_ANALYZER |
OF_DONT_AUTO_REPAIR | OF_DONT_PREVENT_BUILD_NEAR_OBJ | OF_DOESNT_NEED_POWER;
BaseClass::Spawn();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CObjectRallyFlag::Precache()
{
engine->PrecacheModel( RALLYFLAG_MODEL );
}
//-----------------------------------------------------------------------------
// Purpose: Look for friendlies to rally
//-----------------------------------------------------------------------------
void CObjectRallyFlag::RallyThink( void )
{
if ( !GetTeam() )
return;
// Time to die?
if ( gpGlobals->curtime > m_flExpiresAt )
{
UTIL_Remove( this );
return;
}
// Look for nearby players to rally
for ( int i = 0; i < GetTFTeam()->GetNumPlayers(); i++ )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)GetTFTeam()->GetPlayer(i);
assert(pPlayer);
// Is it within range?
if ( ((pPlayer->GetAbsOrigin() - GetAbsOrigin()).Length() < RALLYFLAG_RADIUS ) && pPlayer->IsAlive() )
{
// Can I see it?
trace_t tr;
UTIL_TraceLine( EyePosition(), pPlayer->EyePosition(), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr);
CBaseEntity *pEntity = tr.m_pEnt;
if ( (tr.fraction == 1.0) || ( pEntity == pPlayer ) )
{
pPlayer->AttemptToPowerup( POWERUP_RUSH, RALLYFLAG_ADRENALIN_TIME );
}
}
}
SetNextThink( gpGlobals->curtime + RALLYFLAG_RATE );
}
| [
"uavxp29@gmail.com"
] | uavxp29@gmail.com |
f3a249deb90af976b6795ef3c8a1de801dac3d89 | d4722d631ed1e137073bec767ea2af208e60f09b | /tests/blinky.cpp | 5f7e0b908ba23367ad49a4ca43907387f1cf9c5b | [
"Apache-2.0"
] | permissive | RoboJackets/mjackets-api | 6c701f0955099bd5867cf76dc9a6d452ab1e5e9a | 587600e6496461dca042dfee3b19192ef609dab6 | refs/heads/master | 2023-06-30T23:25:16.073509 | 2020-10-22T23:16:15 | 2020-10-22T23:16:15 | 274,287,907 | 1 | 0 | Apache-2.0 | 2021-07-05T21:17:51 | 2020-06-23T02:17:43 | CMake | UTF-8 | C++ | false | false | 918 | cpp | /**
******************************************************************************
* @file : blinky.cpp
* @brief : Test to blink an LED
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 RoboJackets.
* All rights reserved.</center></h2>
*
* This software component is licensed by RoboJackets under Apache License
* 2.0; You may not use this file except in compliance with the License. You
* may obtain a copy of the License at:
* https://www.apache.org/licenses/LICENSE-2.0
******************************************************************************
*/
#include "mJackets.hpp"
int main(void)
{
/* GPIO Configuration */
DigitalOut my_led(TEST_LED1, PullNone, PushPull);
/* Infinite loop */
while (1)
{
my_led.Toggle();
HAL_Delay(500);
}
} | [
"noreply@github.com"
] | noreply@github.com |
ad747e9024f583ddbff755d8ec9e802bd638ba0b | cfe299b7173e8f3a86079aeba289c05441a7cc44 | /logic/src/obj3d/math/point2d.cpp | fa5a9d4cb6e6c134253ec829bbf6bffe22703977 | [] | no_license | usual-one/3DObjectVisualizer | bf93f6f5bd2b6e9ed273699faf6b59fb8e4081ad | 19350b75460db88e000b93e4f176d26fba01ba21 | refs/heads/master | 2022-11-05T22:37:45.437723 | 2020-06-21T21:11:42 | 2020-06-21T21:11:42 | 266,381,714 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,823 | cpp | #include "config.h"
#include "logic/include/obj3d/math/exception/pointexception.h"
#include "logic/include/obj3d/math/point2d.h"
obj3d::Point2D::Point2D() :
Point(),
y_(0) {}
obj3d::Point2D::Point2D(double x, double y) :
Point(x),
y_(y) {}
double obj3d::Point2D::getY() const {
return y_;
}
void obj3d::Point2D::setY(double y) {
y_ = y;
}
void obj3d::Point2D::changeOrigin(const obj3d::Point2D &origin) {
x_ -= origin.getX();
y_ -= origin.getY();
}
double obj3d::Point2D::getMaxX(const std::vector<obj3d::Point2D> &points) {
if (!points.size()) {
throw PointException(EMPTY_VECTOR_MESSAGE);
}
double max_x = points[0].getX();
for (auto point : points) {
if (point.getX() > max_x) {
max_x = point.getX();
}
}
return max_x;
}
double obj3d::Point2D::getMaxY(const std::vector<obj3d::Point2D> &points) {
if (!points.size()) {
throw PointException(EMPTY_VECTOR_MESSAGE);
}
double max_y = points[0].getY();
for (auto point : points) {
if (point.getY() > max_y) {
max_y = point.getY();
}
}
return max_y;
}
double obj3d::Point2D::getMinY(const std::vector<obj3d::Point2D> &points) {
if (!points.size()) {
throw PointException(EMPTY_VECTOR_MESSAGE);
}
double min_y = points[0].getY();
for (auto point : points) {
if (point.getY() < min_y) {
min_y = point.getY();
}
}
return min_y;
}
double obj3d::Point2D::getMinX(const std::vector<obj3d::Point2D> &points) {
if (!points.size()) {
throw PointException(EMPTY_VECTOR_MESSAGE);
}
double min_x = points[0].getX();
for (auto point : points) {
if (point.getX() < min_x) {
min_x = point.getX();
}
}
return min_x;
}
| [
"kostarev.a.p@yandex.ru"
] | kostarev.a.p@yandex.ru |
c6eca5b144c9646a1650298a361c3b5e46d024d9 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/gumtree/c/if.cpp | 0ef6b48dfc02676c4e0a6ae332c292418157641d | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 703 | cpp | #include "stdio.h"
void test()
{
printf("begin");
int i = 10;
int j = 11;
if (i == 1)
{
printf("1");
printf("\t 2");
i = 1;
}
else if(i == 3)
{
printf("3");
}
else
{
printf("others");
}
switch(i)
{
case 1:
printf("1");
break;
case 3:
printf("1");
break;
default:
printf("others");
break;
}
for(i;i != 10; i++)
{
printf("%d", i);
}
while(i != 10)
{
i+= 1;
printf("%d", i);
}
do
{
i+= 1;
printf("%d", i);
} while(i != 10);
return;
} | [
"993273596@qq.com"
] | 993273596@qq.com |
51eedd0822671e055aef135a41c7bd96af14fd56 | 42681b18ca3e4b08733b1e6ef6095eeed59b5675 | /src/qt/bitcoingui.cpp | 085ebc271ee349b8cd8135ca54c9aa449a3f6de5 | [
"MIT"
] | permissive | bellflower2015/diverse | 67848f52a4365c157fa2204003140c56d1995fd9 | 9e6110216254829fddf4b773f322595cca17b4ba | refs/heads/master | 2020-03-19T04:34:53.885327 | 2019-05-03T09:57:13 | 2019-05-05T10:02:16 | 135,843,886 | 0 | 0 | null | 2018-06-02T18:51:11 | 2018-06-02T18:51:11 | null | UTF-8 | C++ | false | false | 35,555 | cpp | /*
* Qt4 bitcoin GUI.
*
* W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "transactiondescdialog.h"
#include "addresstablemodel.h"
#include "transactionview.h"
#include "overviewpage.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "askpassphrasedialog.h"
#include "notificator.h"
#include "guiutil.h"
#include "rpcconsole.h"
#include "wallet.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QIcon>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QLocale>
#include <QMessageBox>
#include <QMimeData>
#include <QProgressBar>
#include <QStackedWidget>
#include <QDateTime>
#include <QMovie>
#include <QFileDialog>
#include <QDesktopServices>
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
#include <QStyle>
#include <iostream>
extern CWallet* pwalletMain;
extern int64_t nLastCoinStakeSearchInterval;
double GetPoSKernelPS();
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
unlockWalletAction(0),
lockWalletAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0),
nWeight(0)
{
resize(850, 550);
setWindowTitle(tr("Diverse") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
qApp->setWindowIcon(QIcon(":icons/bitcoin"));
setWindowIcon(QIcon(":icons/bitcoin"));
#else
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
// Accept D&D of URIs
setAcceptDrops(true);
// Create actions for the toolbar, menu bar and tray/dock icon
createActions();
// Create application menu bar
createMenuBar();
// Create the toolbars
createToolBars();
// Create the tray icon (or setup the dock icon)
createTrayIcon();
// Create tabs
overviewPage = new OverviewPage();
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
sendCoinsPage = new SendCoinsDialog(this);
signVerifyMessageDialog = new SignVerifyMessageDialog(this);
centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(transactionsPage);
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
setCentralWidget(centralWidget);
// Create status bar
statusBar();
// Status bar notification icons
QFrame *frameBlocks = new QFrame();
frameBlocks->setContentsMargins(0,0,0,0);
frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3);
labelEncryptionIcon = new QLabel();
labelStakingIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelStakingIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelBlocksIcon);
frameBlocksLayout->addStretch();
if (GetBoolArg("-staking", true))
{
QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
timerStakingIcon->start(30 * 1000);
updateStakingIcon();
}
// Progress bar and label for blocks download
progressBarLabel = new QLabel();
progressBarLabel->setVisible(false);
progressBar = new QProgressBar();
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
// Override style sheet for progress bar for styles that have a segmented progress bar,
// as they make the text unreadable (workaround for issue #1071)
// See https://qt-project.org/doc/qt-4.8/gallery.html
QString curStyle = qApp->style()->metaObject()->className();
if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
{
progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
}
statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);
syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
rpcConsole = new RPCConsole(this);
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
// Clicking on "Verify Message" in the address book sends you to the verify message tab
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
gotoOverviewPage();
}
BitcoinGUI::~BitcoinGUI()
{
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
delete appMenuBar;
#endif
}
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a Diverse address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Diverse"), this);
aboutAction->setToolTip(tr("Show information about Diverse"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for Diverse"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this);
unlockWalletAction->setToolTip(tr("Unlock wallet"));
lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this);
lockWalletAction->setToolTip(tr("Lock wallet"));
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet()));
connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
}
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
// Get the main window's menu bar on other platforms
appMenuBar = menuBar();
#endif
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
file->addAction(backupWalletAction);
file->addAction(exportAction);
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
file->addSeparator();
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
settings->addAction(encryptWalletAction);
settings->addAction(changePassphraseAction);
settings->addAction(unlockWalletAction);
settings->addAction(lockWalletAction);
settings->addSeparator();
settings->addAction(optionsAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(openRPCConsoleAction);
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
void BitcoinGUI::createToolBars()
{
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar2->addAction(exportAction);
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
if(clientModel)
{
// Replace some strings and icons, when using the testnet
if(clientModel->isTestNet())
{
setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
#ifndef Q_OS_MAC
qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
if(trayIcon)
{
trayIcon->setToolTip(tr("Diverse client") + QString(" ") + tr("[testnet]"));
trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
// Keep up to date with client
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Report errors from network/worker thread
connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
rpcConsole->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
}
}
void BitcoinGUI::setWalletModel(WalletModel *walletModel)
{
this->walletModel = walletModel;
if(walletModel)
{
// Report errors from wallet thread
connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
// Put transaction list in tabs
transactionView->setModel(walletModel);
overviewPage->setModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel);
signVerifyMessageDialog->setModel(walletModel);
setEncryptionStatus(walletModel->getEncryptionStatus());
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
// Balloon pop-up for new transaction
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(incomingTransaction(QModelIndex,int,int)));
// Ask for passphrase if needed
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
}
}
void BitcoinGUI::createTrayIcon()
{
QMenu *trayIconMenu;
#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
trayIconMenu = new QMenu(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setToolTip(tr("Diverse client"));
trayIcon->setIcon(QIcon(":/icons/toolbar"));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon->show();
#else
// Note: On Mac, the dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
dockIconHandler->setMainWindow((QMainWindow *)this);
trayIconMenu = dockIconHandler->dockMenu();
#endif
// Configuration of the tray icon (or dock icon) icon menu
trayIconMenu->addAction(toggleHideAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(sendCoinsAction);
trayIconMenu->addAction(receiveCoinsAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(signMessageAction);
trayIconMenu->addAction(verifyMessageAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(optionsAction);
trayIconMenu->addAction(openRPCConsoleAction);
#ifndef Q_OS_MAC // This is built-in on Mac
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
#endif
notificator = new Notificator(qApp->applicationName(), trayIcon);
}
#ifndef Q_OS_MAC
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if(reason == QSystemTrayIcon::Trigger)
{
// Click on system tray icon triggers show/hide of the main window
toggleHideAction->trigger();
}
}
#endif
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
return;
OptionsDialog dlg;
dlg.setModel(clientModel->getOptionsModel());
dlg.exec();
}
void BitcoinGUI::aboutClicked()
{
AboutDialog dlg;
dlg.setModel(clientModel);
dlg.exec();
}
void BitcoinGUI::setNumConnections(int count)
{
QString icon;
switch(count)
{
case 0: icon = ":/icons/connect_0"; break;
case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
default: icon = ":/icons/connect_4"; break;
}
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Diverse network", "", count));
}
void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
// don't show / hide progress bar and its label if we have no connection to the network
if (!clientModel || clientModel->getNumConnections() == 0)
{
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
return;
}
QString strStatusBarWarnings = clientModel->getStatusBarWarnings();
QString tooltip;
if(count < nTotalBlocks)
{
int nRemainingBlocks = nTotalBlocks - count;
float nPercentageDone = count / (nTotalBlocks * 0.01f);
if (strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(tr("Synchronizing with network..."));
progressBarLabel->setVisible(true);
progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks));
progressBar->setMaximum(nTotalBlocks);
progressBar->setValue(count);
progressBar->setVisible(true);
}
tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
}
else
{
if (strStatusBarWarnings.isEmpty())
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
// Override progressBarLabel text and hide progress bar, when we have warnings to display
if (!strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(strStatusBarWarnings);
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
}
QDateTime lastBlockDate = clientModel->getLastBlockDate();
int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
QString text;
// Represent time from last generated block in human readable text
if(secs <= 0)
{
// Fully up to date. Leave text empty.
}
else if(secs < 60)
{
text = tr("%n second(s) ago","",secs);
}
else if(secs < 60*60)
{
text = tr("%n minute(s) ago","",secs/60);
}
else if(secs < 24*60*60)
{
text = tr("%n hour(s) ago","",secs/(60*60));
}
else
{
text = tr("%n day(s) ago","",secs/(60*60*24));
}
// Set icon state: spinning if catching up, tick otherwise
if(secs < 90*60 && count >= nTotalBlocks)
{
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
overviewPage->showOutOfSyncWarning(false);
}
else
{
tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie);
syncIconMovie->start();
overviewPage->showOutOfSyncWarning(true);
}
if(!text.isEmpty())
{
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1.").arg(text);
}
// Don't word-wrap this (fixed-width) tooltip
tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip);
}
void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
{
// Report errors from network/worker thread
if(modal)
{
QMessageBox::critical(this, title, message, QMessageBox::Ok, QMessageBox::Ok);
} else {
notificator->notify(Notificator::Critical, title, message);
}
}
void BitcoinGUI::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
#ifndef Q_OS_MAC // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
{
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
{
QTimer::singleShot(0, this, SLOT(hide()));
e->ignore();
}
}
}
#endif
}
void BitcoinGUI::closeEvent(QCloseEvent *event)
{
if(clientModel)
{
#ifndef Q_OS_MAC // Ignored on Mac
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
!clientModel->getOptionsModel()->getMinimizeOnClose())
{
qApp->quit();
}
#endif
}
QMainWindow::closeEvent(event);
}
void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
{
QString strMessage =
tr("This transaction is over the size limit. You can still send it for a fee of %1, "
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?").arg(
BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
QMessageBox::StandardButton retval = QMessageBox::question(
this, tr("Confirm transaction fee"), strMessage,
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
{
if(!walletModel || !clientModel)
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
.data(Qt::EditRole).toULongLong();
if(!clientModel->inInitialBlockDownload())
{
// On new transaction, make an info balloon
// Unless the initial block download is in progress, to prevent balloon-spam
QString date = ttm->index(start, TransactionTableModel::Date, parent)
.data().toString();
QString type = ttm->index(start, TransactionTableModel::Type, parent)
.data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
.data().toString();
QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
TransactionTableModel::ToAddress, parent)
.data(Qt::DecorationRole));
notificator->notify(Notificator::Information,
(amount)<0 ? tr("Sent transaction") :
tr("Incoming transaction"),
tr("Date: %1\n"
"Amount: %2\n"
"Type: %3\n"
"Address: %4\n")
.arg(date)
.arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
.arg(type)
.arg(address), icon);
}
}
void BitcoinGUI::gotoOverviewPage()
{
overviewAction->setChecked(true);
centralWidget->setCurrentWidget(overviewPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoHistoryPage()
{
historyAction->setChecked(true);
centralWidget->setCurrentWidget(transactionsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
}
void BitcoinGUI::gotoAddressBookPage()
{
addressBookAction->setChecked(true);
centralWidget->setCurrentWidget(addressBookPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(receiveCoinsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoSendCoinsPage()
{
sendCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(sendCoinsPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoSignMessageTab(QString addr)
{
// call show() in showTab_SM()
signVerifyMessageDialog->showTab_SM(true);
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_SM(addr);
}
void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
// call show() in showTab_VM()
signVerifyMessageDialog->showTab_VM(true);
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_VM(addr);
}
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
if(event->mimeData()->hasUrls())
event->acceptProposedAction();
}
void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
int nValidUrisFound = 0;
QList<QUrl> uris = event->mimeData()->urls();
foreach(const QUrl &uri, uris)
{
if (sendCoinsPage->handleURI(uri.toString()))
nValidUrisFound++;
}
// if valid URIs were found
if (nValidUrisFound)
gotoSendCoinsPage();
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Diverse address or malformed URI parameters."));
}
event->acceptProposedAction();
}
void BitcoinGUI::handleURI(QString strURI)
{
// URI has to be valid
if (sendCoinsPage->handleURI(strURI))
{
showNormalIfMinimized();
gotoSendCoinsPage();
}
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Diverse address or malformed URI parameters."));
}
void BitcoinGUI::setEncryptionStatus(int status)
{
switch(status)
{
case WalletModel::Unencrypted:
labelEncryptionIcon->hide();
encryptWalletAction->setChecked(false);
changePassphraseAction->setEnabled(false);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(true);
break;
case WalletModel::Unlocked:
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
case WalletModel::Locked:
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
unlockWalletAction->setVisible(true);
lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
}
}
void BitcoinGUI::encryptWallet(bool status)
{
if(!walletModel)
return;
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt:
AskPassphraseDialog::Decrypt, this);
dlg.setModel(walletModel);
dlg.exec();
setEncryptionStatus(walletModel->getEncryptionStatus());
}
void BitcoinGUI::backupWallet()
{
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
if(!filename.isEmpty()) {
if(!walletModel->backupWallet(filename)) {
QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."));
}
}
}
void BitcoinGUI::changePassphrase()
{
AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
dlg.setModel(walletModel);
dlg.exec();
}
void BitcoinGUI::unlockWallet()
{
if(!walletModel)
return;
// Unlock wallet when requested by wallet model
if(walletModel->getEncryptionStatus() == WalletModel::Locked)
{
AskPassphraseDialog::Mode mode = sender() == unlockWalletAction ?
AskPassphraseDialog::UnlockStaking : AskPassphraseDialog::Unlock;
AskPassphraseDialog dlg(mode, this);
dlg.setModel(walletModel);
dlg.exec();
}
}
void BitcoinGUI::lockWallet()
{
if(!walletModel)
return;
walletModel->setWalletLocked(true);
}
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
// activateWindow() (sometimes) helps with keyboard focus on Windows
if (isHidden())
{
show();
activateWindow();
}
else if (isMinimized())
{
showNormal();
activateWindow();
}
else if (GUIUtil::isObscured(this))
{
raise();
activateWindow();
}
else if(fToggleHidden)
hide();
}
void BitcoinGUI::toggleHidden()
{
showNormalIfMinimized(true);
}
void BitcoinGUI::updateWeight()
{
if (!pwalletMain)
return;
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return;
TRY_LOCK(pwalletMain->cs_wallet, lockWallet);
if (!lockWallet)
return;
uint64_t nMinWeight = 0, nMaxWeight = 0;
pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight);
}
void BitcoinGUI::updateStakingIcon()
{
updateWeight();
if (nLastCoinStakeSearchInterval && nWeight)
{
uint64_t nNetworkWeight = GetPoSKernelPS();
unsigned nEstimateTime = nTargetSpacing * nNetworkWeight / nWeight;
QString text;
if (nEstimateTime < 60)
{
text = tr("%n second(s)", "", nEstimateTime);
}
else if (nEstimateTime < 60*60)
{
text = tr("%n minute(s)", "", nEstimateTime/60);
}
else if (nEstimateTime < 24*60*60)
{
text = tr("%n hour(s)", "", nEstimateTime/(60*60));
}
else
{
text = tr("%n day(s)", "", nEstimateTime/(60*60*24));
}
labelStakingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelStakingIcon->setToolTip(tr("Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3").arg(nWeight).arg(nNetworkWeight).arg(text));
}
else
{
labelStakingIcon->setPixmap(QIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
if (pwalletMain && pwalletMain->IsLocked())
labelStakingIcon->setToolTip(tr("Not staking because wallet is locked"));
else if (vNodes.empty())
labelStakingIcon->setToolTip(tr("Not staking because wallet is offline"));
else if (IsInitialBlockDownload())
labelStakingIcon->setToolTip(tr("Not staking because wallet is syncing"));
else if (!nWeight)
labelStakingIcon->setToolTip(tr("Not staking because you don't have mature coins"));
else
labelStakingIcon->setToolTip(tr("Not staking"));
}
}
| [
"bellflower@web4u.jp"
] | bellflower@web4u.jp |
f9ab956a74ff07a97fd1cbb07a96b41617809e13 | ecab21462fc75df52132b11349d8e7a0dcd3218c | /gen/blink/bindings/modules/v8/V8GamepadEvent.h | 2ce23481286c7c87dbbe5cab81e35341e0c1f506 | [
"Apache-2.0"
] | permissive | mensong/MiniBlink | 4688506a0e9e8f0ed5e6d6daaf470255be2a68b8 | 7a11c52f141d54d5f8e1a9af31867cd120a2c3c4 | refs/heads/master | 2023-03-29T04:40:53.198842 | 2021-04-07T01:56:02 | 2021-04-07T01:56:02 | 161,746,209 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,129 | h | // Copyright 2014 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.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#ifndef V8GamepadEvent_h
#define V8GamepadEvent_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMWrapper.h"
#include "bindings/core/v8/V8Event.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
#include "modules/ModulesExport.h"
#include "modules/gamepad/GamepadEvent.h"
#include "platform/heap/Handle.h"
namespace blink {
class V8GamepadEvent {
public:
MODULES_EXPORT static bool hasInstance(v8::Local<v8::Value>, v8::Isolate*);
static v8::Local<v8::Object> findInstanceInPrototypeChain(v8::Local<v8::Value>, v8::Isolate*);
MODULES_EXPORT static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*);
static GamepadEvent* toImpl(v8::Local<v8::Object> object)
{
return toScriptWrappable(object)->toImpl<GamepadEvent>();
}
MODULES_EXPORT static GamepadEvent* toImplWithTypeCheck(v8::Isolate*, v8::Local<v8::Value>);
MODULES_EXPORT static const WrapperTypeInfo wrapperTypeInfo;
static void refObject(ScriptWrappable*);
static void derefObject(ScriptWrappable*);
template<typename VisitorDispatcher>
static void trace(VisitorDispatcher visitor, ScriptWrappable* scriptWrappable)
{
#if ENABLE(OILPAN)
visitor->trace(scriptWrappable->toImpl<GamepadEvent>());
#endif
}
static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
static void installConditionallyEnabledProperties(v8::Local<v8::Object>, v8::Isolate*) { }
static void preparePrototypeObject(v8::Isolate*, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) { }
};
template <>
struct V8TypeOf<GamepadEvent> {
typedef V8GamepadEvent Type;
};
} // namespace blink
#endif // V8GamepadEvent_h
| [
"mail0668@gmail.com"
] | mail0668@gmail.com |
47f54972fc339d76a2d8ea7bec2624098f113484 | 0f1ecb7f55872201aa12ae370482f2f37a8b1c32 | /518_Coin_Change_2.cpp | a571488a15feffd7ad8dfbf9550cd4e1c8f89dde | [] | no_license | ketkimnaik/Algorithms | ed0c38d3f966be31e9f77f46a9c79adc2d635e73 | 178421c5bab10f18ddd11f865e3eba7b9645ddff | refs/heads/master | 2020-08-22T19:26:30.216871 | 2020-07-29T06:53:47 | 2020-07-29T06:53:47 | 216,464,387 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 324 | cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
vector<int> dp(amount + 1, 0);
dp[0] = 1;
for(auto &c : coins) {
for(int i = c; i <= amount; ++i) {
dp[i] += dp[i - c];
}
}
return dp[amount];
}
}; | [
"ketkimnaik@gmail.com"
] | ketkimnaik@gmail.com |
d682d7960fa81a7bd7f3807a436cf8546170d52f | a5ec4bf92b937ee041cf01644c7b332c3d57d8d2 | /Shrine/Packages/Mfa/Mfa.HC | 8ad6981459ae52890070b91b00d26844e0b8282a | [] | no_license | cryptowest/Shrine | b40bee8e86603fbdceb97e29c42583e02936f963 | 68a403821e3d37acffde2a7066c73008e99e71db | refs/heads/master | 2020-05-25T07:58:26.577231 | 2017-01-29T19:16:43 | 2017-01-29T19:18:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,841 | hc | // vim: set ft=cpp:
#include "::/Doc/Comm"
#define MFA_COM 1
U8 in_buf[255];
U8 out_buf[255];
U8* ReadStr() {
I64 len = 0;
while (1) {
if (FifoU8Rem(comm_fifos[MFA_COM], in_buf + len)) {
if (in_buf[len] == '\n')
break;
len++;
}
else Yield;
}
in_buf[len] = 0;
"%s\n", in_buf;
return in_buf;
}
U0 ReadBlk(U8* buf, I64 count) {
while (count) {
if (FifoU8Rem(comm_fifos[MFA_COM], buf)) {
buf++;
count--;
}
else Yield;
}
}
U0 Mfa() {
U8 command;
CommInit8n1(MFA_COM, 115200);
while (FifoU8Rem(comm_fifos[MFA_COM], &command)) {}
"$FG,5$minimalist file access\n"
"\n"
"$FG,8$- configure your VM's COM1 as follows:\n"
"$FG,0$ TCP, server, port 7770\n"
"$FG,8$- use $FG,5$mfa.py$FG,8$ to send commands & files\n"
"\n"
"awaiting commands. press Esc to quit\n";
while (1) {
next:
I64 key;
if (ScanKey(&key) && (key == CH_ESC || key == CH_SHIFT_ESC || key == 'q'))
break;
if (!FifoU8Rem(comm_fifos[MFA_COM], &command)) {
Sleep(50);
goto next;
}
'' command;
U8* line = ReadStr();
I64 size;
if (command == 'L') {
U8* file = FileRead(line, &size);
StrPrint(out_buf, "S%d\n", size);
CommBusyPutS(MFA_COM, out_buf);
CommBusyWriteBlk(MFA_COM, file, size);
Free(file);
"Sent %d\n", size;
}
else if (command == 'P') {
U8 filename[255];
StrCpy(filename, line);
U8* next = ReadStr();
StrScan(next, "S%d", &size);
U8* file_buf = MAlloc(size);
ReadBlk(file_buf, size);
FileWrite(filename, file_buf, size);
Free(file_buf);
"Wrote %d\n", size;
}
else if (command == '\'') {
ExePutS(line);
}
else if (command == '?') {
CommBusyPutS(MFA_COM, "!\n");
}
}
"$FG$";
}
Mfa;
| [
"minexew@gmail.com"
] | minexew@gmail.com |
cda57e7e3d65729183bb21b7d408d5cc2ba3bee0 | acf636f5bd4c970e74e29e6f745b8fee82f51e08 | /Invoice.h | 47142d80cd64328ab119576c656d4e69eff93c54 | [] | no_license | Jsronce/CNHR-Invoicing | 93e0e4beedd91c46058435c3a37843e50f992e87 | 1c16f7d9495e127d8d898d9650730032bb87eadd | refs/heads/master | 2021-01-19T13:49:48.546564 | 2015-07-17T20:38:17 | 2015-07-17T20:38:17 | 35,904,927 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,871 | h | /* Header for invoicing.cpp*/
#include <string>
#include <iostream>
#include <exception>
#include <fstream>
#include <vector>
#include <sstream>
#include <set>
#include "hpdf.h"
#include <unordered_map>
#include "DateParse.h"
using namespace std;
vector<vector<string>> create_table(string fname, char delimeter, bool invoice);
vector<HPDF_REAL> setText(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, vector<HPDF_REAL> pos);
string dollarFormat(string number, bool dollarSign);
string totalDollars(string exchangeExt, string coreExt);
vector<HPDF_REAL> addiPageHeaders(HPDF_Doc pdf, HPDF_Page page, int pageCount);
vector<string> HEADER_LIST{ "Invoice#", "OT" "Man", "Date", "Terms",
"Sales Person", "Ship Via", "SoldTO", "Sold-Name", "Sold-Ad1", "Sold-City", "Sold-St",
"Sold-Zip", "ShipTO", "Ship-Name", "Ship-Ad1", "Ship-Ad2", "Ship-City", "Ship-ST",
"Ship-Zip", "Message1", "Message2", "Message3", "Credit", "BOL" };
class record{
private:
string invoice_number;
unordered_map<string, string> headers;
vector<vector<string>> transactions;
public:
record(vector<string> invoice, vector<vector<string>> customers){
invoice_number = invoice[0];
headers["Invoice#"] = invoice[0];
headers["OT"] = invoice[1];
if (invoice[1] == "05")
headers["PO"] = invoice[24].erase(0, 4);
else
headers["PO"] = invoice[3];
headers["Date"] = invoice[21];
headers["Terms"] = invoice[30];
headers["Sales Person"] = invoice[38];
headers["Ship Via"] = invoice[29];
headers["SoldTO"] = invoice[31];
headers["Ship-Name"] = invoice[7];
headers["ShipTO"] = invoice[6];
headers["Ship-Ad1"] = invoice[33];
headers["Ship-Ad2"] = invoice[34];
headers["Ship-City"] = invoice[35];
headers["Ship-ST"] = invoice[36];
headers["Ship-Zip"] = invoice[37];
headers["Message1"] = invoice[23];
headers["Message2"] = invoice[24];
headers["Message3"] = invoice[25];
headers["Credit"] = invoice[9];
headers["Sold-Name"] = invoice[42];
headers["Sold-Ad1"] = invoice[43];
headers["Sold-City"] = invoice[44];
headers["Sold-ST"] = invoice[45];
headers["Sold-Zip"] = invoice[46];
headers["BOL"] = invoice[39];
headers["Batch"] = invoice[22];
if (headers["Ship-Ad1"] =="")
headers["Ship-Ad1"] = invoice[43];
if (headers["Ship-City"] == "")
headers["Ship-City"] = invoice[44];
if (headers["Ship-St"] == "")
headers["Ship-St"] = invoice[45];
if (headers["Ship-Zip"] == "")
headers["Ship-Zip"] = invoice[46];
}
void print_lines(){
for (auto i = transactions.begin(); i != transactions.end(); i++){
for (auto j = i->begin(); j != i->end(); j++)
cout << *j << " ";
cout << endl;
}
}
string get_header(string key){
return headers[key];
}
void print(){
cout << this->name() << endl;
this->print_lines();
}
void add_line(vector<string> line){
transactions.push_back(line);
}
//returns list of headers
vector<string> get_headers(){
vector<string> header_out;
for (int i = 0; i < 13; i++){
header_out.push_back(headers[HEADER_LIST[i]]);
}
return header_out;
}
int setHeader(string header, string value){
headers[header] = value;
return 0;
}
string name() { return headers["SoldTO"] + " " + invoice_number; }
string invoice_total(){
string ar = "0";
for (auto i : transactions)
ar = totalDollars(totalDollars(totalDollars(i[7], i[8]) , i[6]), ar);
return ar;
}
string productTotal(){
string pr = "0";
for (auto i : transactions){
pr = totalDollars(totalDollars(i[6], i[7]), pr);
}
return pr;
}
string freight(){
string fr = "0";
for (auto i : transactions){
fr = totalDollars(i[8], fr);
}
return fr;
}
vector<vector<string>> get_transactions(){
return transactions;
}
string dueDate(){
if (this->get_header("Terms") == "")
return "";
return dateAdd(this->get_header("Date"), this->get_header("Terms"));
}
}; | [
"js82@live.missouristate.edu"
] | js82@live.missouristate.edu |
8f29cfd271ba6eb33eab7b82e96c45deb245f7f8 | 83bacfbdb7ad17cbc2fc897b3460de1a6726a3b1 | /third_party/WebKit/Source/platform/exported/WebCursorInfo.cpp | c2f962bb210bf054931007de2e8249705d03f96f | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"Apache-2.0"
] | permissive | cool2528/miniblink49 | d909e39012f2c5d8ab658dc2a8b314ad0050d8ea | 7f646289d8074f098cf1244adc87b95e34ab87a8 | refs/heads/master | 2020-06-05T03:18:43.211372 | 2019-06-01T08:57:37 | 2019-06-01T08:59:56 | 192,294,645 | 2 | 0 | Apache-2.0 | 2019-06-17T07:16:28 | 2019-06-17T07:16:27 | null | UTF-8 | C++ | false | false | 1,959 | cpp | /*
* Copyright (C) 2009 Google Inc. 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 Google Inc. 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 "config.h"
#include "public/platform/WebCursorInfo.h"
#include "platform/Cursor.h"
namespace blink {
WebCursorInfo::WebCursorInfo(const Cursor& cursor)
: type(static_cast<Type>(cursor.type()))
, hotSpot(cursor.hotSpot())
, imageScaleFactor(cursor.imageScaleFactor())
, customImage(cursor.image())
#ifdef WIN32
, externalHandle(0)
#endif
{
}
} // namespace blink
| [
"22249030@qq.com"
] | 22249030@qq.com |
3f5b2dcc254ca243e4d223834a399a2039f87648 | 68f704d3f12f0622335a8b7d5066f3bca6999167 | /02_Yellow_belt_begin_2020-07-07/Week_2/Prog_5_Unit_test_Function_IsPalindrome/Original.txt | f1671a6e8824321774cda6680859d620388c4057 | [] | no_license | AVKouzbar/Coursera_Belts | 910f33ae0da815f6a1235575119f958e2678dd3c | 1df0439d3c6cb48ec44a983dd830cd9109edb7c8 | refs/heads/master | 2023-01-02T12:41:01.940936 | 2020-11-02T17:45:41 | 2020-11-02T17:45:41 | 309,447,093 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,879 | txt | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
template <class T>
ostream& operator << (ostream& os, const vector<T>& s) {
os << "{";
bool first = true;
for (const auto& x : s) {
if (!first) {
os << ", ";
}
first = false;
os << x;
}
return os << "}";
}
template <class T>
ostream& operator << (ostream& os, const set<T>& s) {
os << "{";
bool first = true;
for (const auto& x : s) {
if (!first) {
os << ", ";
}
first = false;
os << x;
}
return os << "}";
}
template <class K, class V>
ostream& operator << (ostream& os, const map<K, V>& m) {
os << "{";
bool first = true;
for (const auto& kv : m) {
if (!first) {
os << ", ";
}
first = false;
os << kv.first << ": " << kv.second;
}
return os << "}";
}
template<class T, class U>
void AssertEqual(const T& t, const U& u, const string& hint = {}) {
if (t != u) {
ostringstream os;
os << "Assertion failed: " << t << " != " << u;
if (!hint.empty()) {
os << " hint: " << hint;
}
throw runtime_error(os.str());
}
}
void Assert(bool b, const string& hint) {
AssertEqual(b, true, hint);
}
class TestRunner {
public:
template <class TestFunc>
void RunTest(TestFunc func, const string& test_name) {
try {
func();
cerr << test_name << " OK" << endl;
} catch (exception& e) {
++fail_count;
cerr << test_name << " fail: " << e.what() << endl;
} catch (...) {
++fail_count;
cerr << "Unknown exception caught" << endl;
}
}
~TestRunner() {
if (fail_count > 0) {
cerr << fail_count << " unit tests failed. Terminate" << endl;
exit(1);
}
}
private:
int fail_count = 0;
};
void TestIsPalindrom() {
Assert(IsPalindrom(""), "empty string is a palindrome");
Assert(IsPalindrom("a"), "one letter string is a palindrome");
Assert(IsPalindrom("abba"), "abba is a palindrome");
Assert(IsPalindrom("abXba"), "abXba is a palindrome");
Assert(IsPalindrom("a b X b a"), "`a b X b a` is a palindrome");
Assert(IsPalindrom(" ABBA "), "` ABBA ` is a palindrome");
Assert(!IsPalindrom("XabbaY"), "XabbaY is not a palindrome");
Assert(!IsPalindrom("abXYba"), "abXYba is not a palindrome");
Assert(!IsPalindrom("Xabba"), "Xabba is not a palindrome");
Assert(!IsPalindrom("abbaX"), "abbaX is not a palindrome");
Assert(
!IsPalindrom("was it a car or a cat i saw"),
"`was it a car or a cat i saw` is not a palindrome because spaces do not match"
);
Assert(!IsPalindrom("ABBA "), "`ABBA ` is not a palindrome");
Assert(!IsPalindrom(" ABBA"), "` ABBA` is not a palindrome");
}
int main() {
TestRunner runner;
runner.RunTest(TestIsPalindrom, "TestIsPalindrom");
return 0;
} | [
"avkouzbar.dev@gmail.com"
] | avkouzbar.dev@gmail.com |
b98be17fe13b075a05af1bc32a0e7ca9def3268d | 5ef46accfd4d488486f6b737ebb918bffa6d3415 | /devel/include/ric_robot/relaysRequest.h | e2f37d58cfd6324f7e8a673fe8041939692f65c0 | [] | no_license | nirlevi5/bgumodo_ws | 085b987a64f30f437e847009be3b905dddfbc7c5 | 51b20662416474951e98f762c36270ca3cb685f1 | refs/heads/master | 2020-12-13T23:30:39.379508 | 2015-10-18T09:34:30 | 2015-10-18T09:34:30 | 44,468,825 | 0 | 0 | null | 2015-10-18T07:04:23 | 2015-10-18T07:04:23 | null | UTF-8 | C++ | false | false | 4,963 | h | // Generated by gencpp from file ric_robot/relaysRequest.msg
// DO NOT EDIT!
#ifndef RIC_ROBOT_MESSAGE_RELAYSREQUEST_H
#define RIC_ROBOT_MESSAGE_RELAYSREQUEST_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
namespace ric_robot
{
template <class ContainerAllocator>
struct relaysRequest_
{
typedef relaysRequest_<ContainerAllocator> Type;
relaysRequest_()
: ch1(false)
, ch2(false) {
}
relaysRequest_(const ContainerAllocator& _alloc)
: ch1(false)
, ch2(false) {
}
typedef uint8_t _ch1_type;
_ch1_type ch1;
typedef uint8_t _ch2_type;
_ch2_type ch2;
typedef boost::shared_ptr< ::ric_robot::relaysRequest_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::ric_robot::relaysRequest_<ContainerAllocator> const> ConstPtr;
}; // struct relaysRequest_
typedef ::ric_robot::relaysRequest_<std::allocator<void> > relaysRequest;
typedef boost::shared_ptr< ::ric_robot::relaysRequest > relaysRequestPtr;
typedef boost::shared_ptr< ::ric_robot::relaysRequest const> relaysRequestConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::ric_robot::relaysRequest_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::ric_robot::relaysRequest_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace ric_robot
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False}
// {'ric_robot': ['/home/nir/bgumodo_ws/src/ric/ric_robot/msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::ric_robot::relaysRequest_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::ric_robot::relaysRequest_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::ric_robot::relaysRequest_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::ric_robot::relaysRequest_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::ric_robot::relaysRequest_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::ric_robot::relaysRequest_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::ric_robot::relaysRequest_<ContainerAllocator> >
{
static const char* value()
{
return "1f11a3ed137a90a6662107bc18da38b6";
}
static const char* value(const ::ric_robot::relaysRequest_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0x1f11a3ed137a90a6ULL;
static const uint64_t static_value2 = 0x662107bc18da38b6ULL;
};
template<class ContainerAllocator>
struct DataType< ::ric_robot::relaysRequest_<ContainerAllocator> >
{
static const char* value()
{
return "ric_robot/relaysRequest";
}
static const char* value(const ::ric_robot::relaysRequest_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::ric_robot::relaysRequest_<ContainerAllocator> >
{
static const char* value()
{
return "bool ch1\n\
bool ch2\n\
";
}
static const char* value(const ::ric_robot::relaysRequest_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::ric_robot::relaysRequest_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.ch1);
stream.next(m.ch2);
}
ROS_DECLARE_ALLINONE_SERIALIZER;
}; // struct relaysRequest_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::ric_robot::relaysRequest_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::ric_robot::relaysRequest_<ContainerAllocator>& v)
{
s << indent << "ch1: ";
Printer<uint8_t>::stream(s, indent + " ", v.ch1);
s << indent << "ch2: ";
Printer<uint8_t>::stream(s, indent + " ", v.ch2);
}
};
} // namespace message_operations
} // namespace ros
#endif // RIC_ROBOT_MESSAGE_RELAYSREQUEST_H
| [
"nirlevi5@gmail.com"
] | nirlevi5@gmail.com |
008fd389830399f34a351784c1d7d4dbbe060ff8 | 4d2ba9354d5865ec7199b50a7c33753daa3a7d95 | /ogn/src/Shared/core/aes/AES.h | e7df219b12c8fe37d15e5932a9e4b90c2a4f7260 | [] | no_license | Power-cn/ogn | 68a03e937fb2a558fa7d96495c9c0fe12d08e8f7 | 5e1f37e38d8259345a9c6260fdcf3388456a6ee5 | refs/heads/master | 2020-04-07T07:21:12.630385 | 2018-11-19T07:38:54 | 2018-11-19T07:38:54 | 158,173,419 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 965 | h | ///////////////////////////////
// http://mingcn.cnblogs.com //
// xelz CopyRight (c) 2010 //
///////////////////////////////
#pragma once
class AES
{
public:
AES(const char* keystr);
virtual ~AES();
unsigned char* Cipher(unsigned char* input);
unsigned char* InvCipher(unsigned char* input);
void* Cipher(void* input, int length=0);
void* InvCipher(void* input, int length);
private:
unsigned char Sbox[256];
unsigned char InvSbox[256];
unsigned char w[11][4][4];
unsigned char key[16];
void KeyExpansion(unsigned char* key, unsigned char w[][4][4]);
unsigned char FFmul(unsigned char a, unsigned char b);
void SubBytes(unsigned char state[][4]);
void ShiftRows(unsigned char state[][4]);
void MixColumns(unsigned char state[][4]);
void AddRoundKey(unsigned char state[][4], unsigned char k[][4]);
void InvSubBytes(unsigned char state[][4]);
void InvShiftRows(unsigned char state[][4]);
void InvMixColumns(unsigned char state[][4]);
}; | [
"254127675@qq.com"
] | 254127675@qq.com |
b814716591fae57fc2500653e85377e9fff6acc1 | 1a76cdf3b8776c238f0fecaca9c9491145106ec6 | /SDK/FN_QuestTrackerTrackedQuestsList_functions.cpp | 5d2d81d5e03b814cff0a3460b6104ada0ab398d4 | [] | no_license | JimmyJones97/aasd | 9af6e9c83eec4d1b4c76c601c2ccba814ce8a1c0 | 1961458db5ef577e6f013ca9ea744dcd48f2b4ad | refs/heads/master | 2022-02-19T11:47:42.191429 | 2017-10-27T11:59:07 | 2017-10-27T11:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,031 | cpp | // Fortnite SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function QuestTrackerTrackedQuestsList.QuestTrackerTrackedQuestsList_C.GetQuestsToDisplay
// (FUNC_Event, FUNC_Protected, FUNC_HasOutParms, FUNC_BlueprintCallable, FUNC_BlueprintEvent)
// Parameters:
// TArray<class UFortQuestItem*> ReturnValue (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm)
TArray<class UFortQuestItem*> UQuestTrackerTrackedQuestsList_C::GetQuestsToDisplay()
{
static UFunction* fn = nullptr;
if (!fn) fn = UObject::FindObject<UFunction>(0x61135f83);
UQuestTrackerTrackedQuestsList_C_GetQuestsToDisplay_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"joker@slaughter-gaming.de"
] | joker@slaughter-gaming.de |
d01c1892172a0463a6d78ba60bd5c0cd11c1cf91 | 81f6419ea475836b1f1b24bcd2de77a316bc46a1 | /GFG must do questions/sort 0's 1's and 2's.cpp | 386bf3c077ebad433269bb4d6d9d7e507d027941 | [] | no_license | Pramodjais517/competitive-coding | f4e0f6f238d98c0a39f8a9c940265f886ce70cb3 | 2a8ad013246f2db72a4dd53771090d931ab406cb | refs/heads/master | 2023-02-25T12:09:47.382076 | 2021-01-28T06:57:26 | 2021-01-28T06:57:26 | 208,445,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define rs reserve
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define fi(i,s,e,inc) for(auto i=s;i<e;i+=inc)
#define fie(i,s,e,inc) for(auto i=s;i<=e;i+=inc)
#define fd(i,s,e,dec) for(auto i=s;i>e;i-=dec)
#define fde(i,s,e,dec) for(auto i=s;i>=e;i-=dec)
#define itr(i,ar) for(auto i=ar.begin();i!=ar.end();i++)
#define mod 1000000007
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll a[n];
ll cnt[3];
ll x = 0;
fi(i,0,n,1)
{
cin>>x;
cnt[x]++;
}
fi(i,0,n,1)
{
if(cnt[0] > 0)
a[i] = 0,cnt[0]--;
else if(cnt[1]>0)
a[i] = 1,cnt[1]--;
else
a[i] = 2,cnt[2]--;
}
fi(i,0,n,1)
cout<<a[i]<<" ";
cout<<"\n";
}
return 0;
}
| [
"pramodjaiswal517@gmail.com"
] | pramodjaiswal517@gmail.com |
d4f635fd260d99dccc6fa296a72befb4c6e917b9 | 78eb551267dafbdf8d87880d69176c9a803c53d5 | /group.h | f42a8a6638c09bcd9e91dc4fb7792d290d9aa588 | [] | no_license | Soulstorm50/2_tasks_ITStep_OOP_Cpp | abbd033bf510fa38ef1bcd230848330ca56d20c2 | 8ab73819762cc7d5cecb79f583672ad9d76fac9a | refs/heads/master | 2021-09-15T00:09:11.731630 | 2018-05-22T14:48:35 | 2018-05-22T14:48:35 | 113,300,462 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,301 | h | #ifndef GROUP_H
#define GROUP_H
#include "student.h"
#include <iostream>
#include <string.h>
#include <string>
//TODO: replace all char* to string!
//5.4 В класс Group добавить перегрузку += Student,
//что добавляет студента в группу.
//А также перегрузить операции «>», «<», «==», «!=»
//для сравнения двух групп по количеству студентов.
//5.6 В класс Student и Group добавить перегрузку >>, <<, ( ) и =.
//5.7 В класc Group добавить перегрузку [ ] (возврат студента по индексу),
//предусмотреть конструктор преобразования из типа Student*,
//перегрузить операцию преобразования типа из Group в Student*.
//6.3 * Добавить в класс Group пользовательский вектор
//для хранения информации о студентах (вместо массива типа Student).
class Group
{
public:
Group();
Group(unsigned int total);
Group(const Group& group);
~Group();
void show();
void add(const Student& student);
void add(Student *student);
void merge(const Group& group);
void moveStudent( const char* lastName
, const char* firstName
, Group& group
);
void dismissAllNotPassedStudents();
void dismissMostUnsuccesfulStudent();
Student** getStudentArray() const;
int getTotalStudents() const;
const std::string getGroupName() const;
const std::string getGroupType() const;
int getCourseNumber() const;
void setStudentArray(Student** studentArray);
void setTotalStudents(int totalStudents);
void setGroupName(const std::string& groupName);
void setGroupType(const std::string& groupType);
void setCourseNumber(int courseNumber);
private:
void sort();
void init();
bool isSessionPass(Student *student);
int getAverageScore(Student *student);
Student** _studentArray;
int _totalStudents;
std::string _groupName;
std::string _groupType;
int _courseNumber;
};
#endif // GROUP_H
| [
"figelunion@gmail.com"
] | figelunion@gmail.com |
521c3b77f752ed17afd732c8a076b72a336a46df | 25a5d8f63452366c47c3eeaec6917aed8702f7af | /simulationGUI/dialogs/importdialog.h | f3be07a774dbf47091474e4baeea3d3d2b57d49c | [] | no_license | Kevinaw/simGUI | 47a57737f6c1679e1b8c5ee8623fc00b6a2a2bb2 | 5241bc700ee2d09b557f0f01b097cf69f243bdd5 | refs/heads/master | 2021-01-22T11:41:34.303058 | 2015-01-07T23:11:49 | 2015-01-07T23:11:49 | 28,056,757 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 790 | h |
#ifndef IMPORTDIALOG_H
#define IMPORTDIALOG_H
#include <QDialog>
#include <QProcess>
#include <QGridLayout>
#include <QLabel>
class QTextEdit;
class QLineEdit;
class QGridLayout;
class QPushButton;
class QComboBox;
class QLabel;
class ImportDialog : public QDialog {
Q_OBJECT
public:
ImportDialog(QWidget*);
~ImportDialog();
private slots:
void slotDisplayMsg();
void slotDisplayErr();
void slotProcessEnded(int status);
void slotImport();
void slotAbort();
void slotBrowse();
void slotType(int);
private:
void startSimulator();
public:
QGridLayout *all;
QLabel *OutputLabel;
QProcess Process;
QTextEdit *MsgText;
QLineEdit *ImportEdit, *OutputEdit, *OutputData;
QPushButton *ImportButt, *CancelButt, *AbortButt;
QComboBox *OutType;
};
#endif
| [
"kevinaw613@gmail.com"
] | kevinaw613@gmail.com |
3ba5f06ee6114e2c8228954f048af2d762c6ec9a | dd6ffac87c25069939dddccd0e5d0d41c23f832f | /Project1/Source/Managers/EntityManager.h | a67eec68defd2019f32cc4cda926294ed2a65767 | [] | no_license | vidhisoni/3D-Game-Project | 901e8fb3ecbeeffe0188b72f865e38ad55f8c6fe | f53c8c9eb95662455a4e1ce9105d2393664af1a6 | refs/heads/master | 2022-10-26T06:16:51.875969 | 2020-06-16T04:39:53 | 2020-06-16T04:39:53 | 272,602,412 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,740 | h | #pragma once
#define ENTITY_MANAGER EntityManager::GetInstance()
class Entity;
/*!
* Creates, updates, and deletes
* Entities at start up, or during
* runtime
*
*/
class EntityManager
{
public:
/*!
* Get the EntityManager Singleton reference
*
* \return The EntityManager reference
*/
GEAR_API static EntityManager* GetInstance();
/*!
* Get the Entity whose ID matches the input
* ID
*
* \param a_entityID The ID of the Entity to be returned
* \param a_ignoreEnabled A flag indicating whether the requested Entity must be enabled or not
* \return The Entity whose ID matches the input ID. A null pointer will be returned if that entity doesn't exist
*/
GEAR_API Entity* GetEntity(int a_entityID, bool a_ignoreEnabled = false);
/*!
* Get the specified Entity from the list of
* Entities that have not yet been added to
* the list of valid Entities
*
* \param a_entityID The ID of the Entity to be returned
* \return The Entity whose ID matches the input ID. A null pointer will be returned if that entity doesn't exist
*/
GEAR_API Entity* GetRuntimeEntity(int a_entityID);
/*!
* Gets a vector of Entities of the specified
* type
*
* \param a_type The type of the Entities that should be in the returned vector
* \param a_ignoreEnabled A flag indicating whether the requested Entities must be enabled or not
* \return A vector of Entities of the specified type
*/
GEAR_API std::vector<Entity*> GetEntities(std::string a_type, bool a_ignoreEnabled = false);
/*!
* Creates the Entity from the given file and
* adds it to a list of valid Entities
*
* \param a_fileName The name of the file that the Entity will be created from
* \return The Entity that was created from the given file
*/
GEAR_API Entity* CreateEntity(std::string a_fileName, std::string a_scene = "");
/*!
* Creates the Entity from the given file and
* adds it to a list of runtime Entities
*
* \param a_fileName The name of the file that the Entity will be created
* \return The Entity that was created from the given file
*/
GEAR_API Entity* CreateRuntimeEntity(std::string a_fileName, std::string a_scene = "");
/*!
* Adds the Entity corresponding to the given
* ID to a list of Entities that should be deleted
*
* \param a_entityID The ID of the Entity that will be deleted
*/
GEAR_API void DeleteEntity(int a_entityID);
/*!
* Toggles the flag on the specified Entity
* that indicates whether the Entity is enabled
* or not
*
* \param a_entityID The ID of the Entity whose Enabled flag will be toggled
* \param a_enable A flag indicating whether the Entity is being enabled or not
*/
GEAR_API void EntityEnable(int a_entityID, bool a_enable);
/*!
* Adds the runtime Entities to the list of
* valid Entities, and deletes the delete
* Entities from the list of valid Entities
*
*/
GEAR_API void ClearRuntimeLists();
/*!
* Deletes the EntityManager Singleton
*
*/
GEAR_API void Cleanup();
/*!
* Gets the size of the list of valid
* Entities
*
* \return The size of the list of valid Entities
*/
GEAR_API int ReturnID();
private:
GEAR_API EntityManager();
GEAR_API ~EntityManager();
GEAR_API Entity* InitializeNewEntity(std::string a_fileName);
GEAR_API void InitializeNewComponents(Entity* a_pNewEntity, bool a_isRuntime);
public:
std::unordered_map<int, Entity*> mEntityMap; /*!< List of valid Entities mapped to their ID */
private:
std::unordered_map<std::string, std::vector<Entity*>> mEntityTypeMap;
std::vector<Entity*> mEntityDeleteList;
std::vector<Entity*> mEntityCreateList;
std::vector<std::pair<Entity*, bool>> mEntityEnableList;
int mMasterID;
static EntityManager* mInstance;
}; | [
"vidhi.soni@digipen.edu"
] | vidhi.soni@digipen.edu |
ec651e5b7bb2d7fe393944348d03f8fce3175cca | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14480/function14480_schedule_18/function14480_schedule_18.cpp | d8ea105cd266f01bdd479674a15e6b01cef20407 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 730 | cpp | #include <tiramisu/tiramisu.h>
using namespace tiramisu;
int main(int argc, char **argv){
tiramisu::init("function14480_schedule_18");
constant c0("c0", 128), c1("c1", 512), c2("c2", 1024);
var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i01("i01"), i02("i02"), i03("i03"), i04("i04"), i05("i05"), i06("i06");
computation comp0("comp0", {i0, i1, i2}, 2 - 0 - 9);
comp0.tile(i0, i1, i2, 32, 32, 32, i01, i02, i03, i04, i05, i06);
comp0.parallelize(i01);
buffer buf0("buf0", {128, 512, 1024}, p_int32, a_output);
comp0.store_in(&buf0);
tiramisu::codegen({&buf0}, "../data/programs/function14480/function14480_schedule_18/function14480_schedule_18.o");
return 0;
} | [
"ei_mekki@esi.dz"
] | ei_mekki@esi.dz |
49ee913f62503dcc8ded0a9babf2a08ea8475d6f | 67b170ffb345a63403ff5dc66130eaa24bfaf161 | /include/ANurbs/Algorithm/RTree.h | 0aeb83cdafc347121b407770fddb8719ab24c9ca | [
"MIT"
] | permissive | deepblueparticle/ANurbs | eecc9cb51ed6325a1af29bfa993196b7bc2c308d | 3fd34f5c74f96cc50d1d6db53d39ac08b88bd1ba | refs/heads/master | 2020-08-20T21:47:44.435441 | 2019-10-18T14:47:17 | 2019-10-18T14:47:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,029 | h | #pragma once
#include "../Define.h"
#include "HilbertCurve.h"
#include <algorithm>
#include <functional>
#include <limits>
#include <stdexcept>
#include <vector>
namespace ANurbs {
template <Index TDimension>
class RTree
{
// Sources:
//
// - 'Flatbush'
// by Vladimir Agafonkin
// https://github.com/mourner/flatbush
private: // types
using Callback = std::function<bool(Index)>;
using Vector = linear_algebra::Vector<TDimension>;
using VectorU = Eigen::Matrix<size_t, 1, TDimension>;
using Type = RTree<TDimension>;
struct WithinBox
{
Vector m_box_min;
Vector m_box_max;
WithinBox(const Vector box_a, const Vector box_b) noexcept
{
for (Index i = 0; i < TDimension; i++) {
if (box_a[i] < box_b[i]) {
m_box_min[i] = box_a[i];
m_box_max[i] = box_b[i];
} else {
m_box_min[i] = box_b[i];
m_box_max[i] = box_a[i];
}
}
}
bool operator()(const Vector box_min, const Vector box_max) const noexcept
{
for (Index i = 0; i < TDimension; i++) {
if (m_box_max[i] < box_min[i]) {
return false;
}
if (m_box_min[i] > box_max[i]) {
return false;
}
}
return true;
}
};
struct HitByRay
{
Vector m_origin;
Vector m_direction;
HitByRay(const Vector origin, const Vector direction) noexcept
: m_origin(origin), m_direction(direction)
{
}
bool operator()(const Vector box_min, const Vector box_max) const noexcept
{
// based on Fast Ray-Box Intersection
// by Andrew Woo
// from "Graphics Gems", Academic Press, 1990
bool inside = true;
VectorU quadrant = VectorU::Zero(); // FIXME: choose other type...
int which_plane = 0;
Vector max_t = Vector::Zero();
Vector candidate_plane = Vector::Zero();
Vector coordinate = Vector::Zero();
for (Index i = 0; i < TDimension; i++) {
if (m_origin[i] < box_min[i]) {
quadrant[i] = -1;
candidate_plane[i] = box_min[i];
inside = false;
} else if (m_origin[i] > box_max[i]) {
quadrant[i] = 1;
candidate_plane[i] = box_max[i];
inside = false;
} else {
quadrant[i] = 0;
}
}
if (inside) {
coordinate = m_origin;
return true;
}
for (Index i = 0; i < TDimension; i++) {
if (quadrant[i] != 0 && m_direction[i] != 0) {
max_t[i] = (candidate_plane[i] - m_origin[i]) / m_direction[i];
} else {
max_t[i] = -1;
}
}
which_plane = 0;
for (Index i = 1; i < TDimension; i++) {
if (max_t[which_plane] < max_t[i]) {
which_plane = i;
}
}
if (max_t[which_plane] < 0) {
return false;
}
for (Index i = 0; i < TDimension; i++) {
if (which_plane != i) {
coordinate[i] = m_origin[i] + max_t[which_plane] * m_direction[i];
if (coordinate[i] < box_min[i] || coordinate[i] > box_max[i]) {
return false;
}
} else {
coordinate[i] = candidate_plane[i];
}
}
return true;
}
};
private: // variables
Index m_nb_items;
Index m_node_size;
std::vector<Index> m_level_bounds;
Vector m_min;
Vector m_max;
Index m_position;
std::vector<Index> m_indices;
std::vector<Vector> m_boxes_min;
std::vector<Vector> m_boxes_max;
public: // static methods
static constexpr Index dimension()
{
return TDimension;
}
public: // constructor
RTree(const Index nb_items, const Index node_size)
{
if (nb_items < 0) {
throw std::invalid_argument("nb_items");
}
m_nb_items = nb_items;
m_node_size = std::min<Index>(std::max<Index>(node_size, 2), ((size_t)1 << (4 * sizeof(size_t))) - 1);
Index n = nb_items;
Index nb_nodes = n;
m_level_bounds.emplace_back(n);
do {
n = (Index)(std::ceil((double)n / m_node_size));
nb_nodes += n;
m_level_bounds.emplace_back(nb_nodes);
} while (n > 1);
for (Index i = 0; i < TDimension; i++) {
m_min[i] = std::numeric_limits<double>::infinity();
m_max[i] = -std::numeric_limits<double>::infinity();
}
m_position = 0;
m_indices.resize(nb_nodes);
m_boxes_min.resize(nb_nodes);
m_boxes_max.resize(nb_nodes);
}
private: // methods
void sort(std::vector<size_t>& values, const Index left, const Index right)
{
if (left >= right) {
return;
}
const size_t pivot = values[(left + right) >> 1];
Index i = left - 1;
Index j = right + 1;
while (true) {
do {
i += 1;
} while(values[i] < pivot);
do {
j -= 1;
} while(values[j] > pivot);
if (i >= j) {
break;
}
swap(values, i, j);
}
sort(values, left, j);
sort(values, j + 1, right);
}
void swap(std::vector<size_t>& values, const Index i, const Index j)
{
std::swap(values[i], values[j]);
std::swap(m_indices[i], m_indices[j]);
std::swap(m_boxes_min[i], m_boxes_min[j]);
std::swap(m_boxes_max[i], m_boxes_max[j]);
}
const std::vector<Index>& level_bounds() const
{
return m_level_bounds;
}
Index position() const
{
return m_position;
}
const std::vector<Vector>& boxes_min() const
{
return m_boxes_min;
}
const std::vector<Vector>& boxes_max() const
{
return m_boxes_max;
}
public: // methods
void add(const Vector box_a, const Vector box_b)
{
// FIXME: check m_position
Index index = m_position++;
m_indices[index] = index;
Vector box_min;
Vector box_max;
for (Index i = 0; i < dimension(); i++) {
if (box_a[i] < box_b[i]) {
box_min[i] = box_a[i];
box_max[i] = box_b[i];
} else {
box_min[i] = box_b[i];
box_max[i] = box_a[i];
}
}
m_boxes_min[index] = box_min;
m_boxes_max[index] = box_max;
for (Index i = 0; i < dimension(); i++) {
if (box_min[i] < m_min[i]) {
m_min[i] = box_min[i];
}
if (box_max[i] > m_max[i]) {
m_max[i] = box_max[i];
}
}
}
void finish()
{
if (m_position != m_nb_items) {
throw std::runtime_error("More items then expected");
}
const Vector size = m_max - m_min;
std::vector<size_t> hilbert_values(m_nb_items);
for (Index i = 0; i < m_nb_items; i++) {
Vector box_min = m_boxes_min[i];
Vector box_max = m_boxes_max[i];
VectorU center;
for (Index j = 0; j < dimension(); j++) {
center[j] = ((box_min[j] + box_max[j]) / 2 - m_min[j]) / size[j] * HilbertCurve<TDimension>::max_axis_size();
}
hilbert_values[i] = HilbertCurve<TDimension>::index_at(center);
}
sort(hilbert_values, 0, m_nb_items - 1);
Index pos = 0;
for (Index i = 0; i < length(m_level_bounds) - 1; i++) {
Index end = m_level_bounds[i];
while (pos < end) {
Vector node_min;
Vector node_max;
for (Index j = 0; j < TDimension; j++) {
node_min[j] = std::numeric_limits<double>::infinity();
node_max[j] = -std::numeric_limits<double>::infinity();
}
Index node_index = pos;
for (Index j = 0; j < m_node_size && pos < end; j++) {
Vector box_min = m_boxes_min[pos];
Vector box_max = m_boxes_max[pos];
pos += 1;
for (Index k = 0; k < dimension(); k++) {
if (box_min[k] < node_min[k]) {
node_min[k] = box_min[k];
}
if (box_max[k] > node_max[k]) {
node_max[k] = box_max[k];
}
}
}
m_indices[m_position] = node_index;
m_boxes_min[m_position] = node_min;
m_boxes_max[m_position] = node_max;
m_position += 1;
}
}
}
const std::vector<Index>& indices() const
{
return m_indices;
}
Vector min() const
{
return m_min;
}
Vector max() const
{
return m_max;
}
Index nb_items() const
{
return m_nb_items;
}
Index node_size() const
{
return m_node_size;
}
template <typename TCheck>
std::vector<Index> search(const TCheck& check, Callback callback)
{
if (m_position != length(m_indices)) {
throw std::runtime_error("Data not yet indexed - call RTree::finish().");
}
Index node_index = length(m_indices) - 1;
Index level = length(m_level_bounds) - 1;
std::vector<Index> queue;
std::vector<Index> results;
while (node_index > -1) {
const Index end = std::min<Index>(node_index + m_node_size, m_level_bounds[level]);
for (Index pos = node_index; pos < end; pos++) {
const Index index = m_indices[pos];
const Vector node_min = m_boxes_min[pos];
const Vector node_max = m_boxes_max[pos];
if (!check(node_min, node_max)) {
continue;
}
if (node_index < m_nb_items) {
if (callback == nullptr || callback(index)) {
results.push_back(index);
}
} else {
queue.push_back(index);
queue.push_back(level - 1);
}
}
if (queue.empty()) {
node_index = -1;
level = -1;
} else {
level = queue.back();
queue.pop_back();
node_index = queue.back();
queue.pop_back();
}
}
return results;
}
std::vector<Index> within_box(const Vector box_a, const Vector box_b, Callback callback)
{
WithinBox check(box_a, box_b);
return search(check, callback);
}
std::vector<Index> hit_by_ray(const Vector origin, const Vector direction, Callback callback)
{
HitByRay check(origin, direction);
return search(check, callback);
}
public: // serialization
static std::string type_name()
{
return "RTree" + std::to_string(dimension()) + "D";
}
public: // python
static void register_python(pybind11::module& m)
{
using namespace pybind11::literals;
namespace py = pybind11;
std::string name = Type::type_name();
py::class_<Type>(m, name.c_str())
// constructors
.def(py::init<Index, Index>(), "nb_items"_a, "node_size"_a=16)
// private read-only properties
.def_property_readonly("_boxes_min", &Type::boxes_min)
.def_property_readonly("_boxes_max", &Type::boxes_max)
// read-only properties
.def_property_readonly("indices", &Type::indices)
.def_property_readonly("min", &Type::min)
.def_property_readonly("max", &Type::min)
.def_property_readonly("nb_items", &Type::nb_items)
.def_property_readonly("node_size", &Type::node_size)
// methods
.def("add", &Type::add, "box_a"_a, "box_b"_a)
.def("finish", &Type::finish)
.def("within_box", &Type::within_box, "box_a"_a, "box_b"_a, "callback"_a=py::none())
.def("hit_by_ray", &Type::hit_by_ray, "origin"_a, "direction"_a, "callback"_a=py::none())
;
}
};
} // namespace ANurbs | [
"thomas.oberbichler@gmail.com"
] | thomas.oberbichler@gmail.com |
84485c2bb9be482c996927baf4170114b44ac773 | 9f32dca665db865ff5007305c530ccfa922551c6 | /Classes/Native/mscorlib_System_Collections_Generic_Dictionary_2_g2711062372.h | 8dd06f55aeeecf3401cfad8d9394195767d2c868 | [] | no_license | Sid-ah/BS_V5 | 81586670b6d774e7ebea8b248011f937772fe923 | f1443bf85e2dab42c0db842c1865e4df1c57d055 | refs/heads/master | 2021-01-21T10:46:45.341844 | 2017-02-28T23:04:27 | 2017-02-28T23:04:27 | 83,488,305 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 7,721 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.Int32[]
struct Int32U5BU5D_t3030399641;
// System.Collections.Generic.Link[]
struct LinkU5BU5D_t62501539;
// Vuforia.VirtualButton[]
struct VirtualButtonU5BU5D_t1157662812;
// System.Collections.Generic.IEqualityComparer`1<System.Int32>
struct IEqualityComparer_1_t1284510226;
// System.Runtime.Serialization.SerializationInfo
struct SerializationInfo_t228987430;
// System.Collections.Generic.Dictionary`2/Transform`1<System.Int32,Vuforia.VirtualButton,System.Collections.DictionaryEntry>
struct Transform_1_t1842060127;
#include "mscorlib_System_Object2689449295.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.Dictionary`2<System.Int32,Vuforia.VirtualButton>
struct Dictionary_2_t2711062372 : public Il2CppObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::table
Int32U5BU5D_t3030399641* ___table_4;
// System.Collections.Generic.Link[] System.Collections.Generic.Dictionary`2::linkSlots
LinkU5BU5D_t62501539* ___linkSlots_5;
// TKey[] System.Collections.Generic.Dictionary`2::keySlots
Int32U5BU5D_t3030399641* ___keySlots_6;
// TValue[] System.Collections.Generic.Dictionary`2::valueSlots
VirtualButtonU5BU5D_t1157662812* ___valueSlots_7;
// System.Int32 System.Collections.Generic.Dictionary`2::touchedSlots
int32_t ___touchedSlots_8;
// System.Int32 System.Collections.Generic.Dictionary`2::emptySlot
int32_t ___emptySlot_9;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_10;
// System.Int32 System.Collections.Generic.Dictionary`2::threshold
int32_t ___threshold_11;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::hcp
Il2CppObject* ___hcp_12;
// System.Runtime.Serialization.SerializationInfo System.Collections.Generic.Dictionary`2::serialization_info
SerializationInfo_t228987430 * ___serialization_info_13;
// System.Int32 System.Collections.Generic.Dictionary`2::generation
int32_t ___generation_14;
public:
inline static int32_t get_offset_of_table_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___table_4)); }
inline Int32U5BU5D_t3030399641* get_table_4() const { return ___table_4; }
inline Int32U5BU5D_t3030399641** get_address_of_table_4() { return &___table_4; }
inline void set_table_4(Int32U5BU5D_t3030399641* value)
{
___table_4 = value;
Il2CppCodeGenWriteBarrier(&___table_4, value);
}
inline static int32_t get_offset_of_linkSlots_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___linkSlots_5)); }
inline LinkU5BU5D_t62501539* get_linkSlots_5() const { return ___linkSlots_5; }
inline LinkU5BU5D_t62501539** get_address_of_linkSlots_5() { return &___linkSlots_5; }
inline void set_linkSlots_5(LinkU5BU5D_t62501539* value)
{
___linkSlots_5 = value;
Il2CppCodeGenWriteBarrier(&___linkSlots_5, value);
}
inline static int32_t get_offset_of_keySlots_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___keySlots_6)); }
inline Int32U5BU5D_t3030399641* get_keySlots_6() const { return ___keySlots_6; }
inline Int32U5BU5D_t3030399641** get_address_of_keySlots_6() { return &___keySlots_6; }
inline void set_keySlots_6(Int32U5BU5D_t3030399641* value)
{
___keySlots_6 = value;
Il2CppCodeGenWriteBarrier(&___keySlots_6, value);
}
inline static int32_t get_offset_of_valueSlots_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___valueSlots_7)); }
inline VirtualButtonU5BU5D_t1157662812* get_valueSlots_7() const { return ___valueSlots_7; }
inline VirtualButtonU5BU5D_t1157662812** get_address_of_valueSlots_7() { return &___valueSlots_7; }
inline void set_valueSlots_7(VirtualButtonU5BU5D_t1157662812* value)
{
___valueSlots_7 = value;
Il2CppCodeGenWriteBarrier(&___valueSlots_7, value);
}
inline static int32_t get_offset_of_touchedSlots_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___touchedSlots_8)); }
inline int32_t get_touchedSlots_8() const { return ___touchedSlots_8; }
inline int32_t* get_address_of_touchedSlots_8() { return &___touchedSlots_8; }
inline void set_touchedSlots_8(int32_t value)
{
___touchedSlots_8 = value;
}
inline static int32_t get_offset_of_emptySlot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___emptySlot_9)); }
inline int32_t get_emptySlot_9() const { return ___emptySlot_9; }
inline int32_t* get_address_of_emptySlot_9() { return &___emptySlot_9; }
inline void set_emptySlot_9(int32_t value)
{
___emptySlot_9 = value;
}
inline static int32_t get_offset_of_count_10() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___count_10)); }
inline int32_t get_count_10() const { return ___count_10; }
inline int32_t* get_address_of_count_10() { return &___count_10; }
inline void set_count_10(int32_t value)
{
___count_10 = value;
}
inline static int32_t get_offset_of_threshold_11() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___threshold_11)); }
inline int32_t get_threshold_11() const { return ___threshold_11; }
inline int32_t* get_address_of_threshold_11() { return &___threshold_11; }
inline void set_threshold_11(int32_t value)
{
___threshold_11 = value;
}
inline static int32_t get_offset_of_hcp_12() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___hcp_12)); }
inline Il2CppObject* get_hcp_12() const { return ___hcp_12; }
inline Il2CppObject** get_address_of_hcp_12() { return &___hcp_12; }
inline void set_hcp_12(Il2CppObject* value)
{
___hcp_12 = value;
Il2CppCodeGenWriteBarrier(&___hcp_12, value);
}
inline static int32_t get_offset_of_serialization_info_13() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___serialization_info_13)); }
inline SerializationInfo_t228987430 * get_serialization_info_13() const { return ___serialization_info_13; }
inline SerializationInfo_t228987430 ** get_address_of_serialization_info_13() { return &___serialization_info_13; }
inline void set_serialization_info_13(SerializationInfo_t228987430 * value)
{
___serialization_info_13 = value;
Il2CppCodeGenWriteBarrier(&___serialization_info_13, value);
}
inline static int32_t get_offset_of_generation_14() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372, ___generation_14)); }
inline int32_t get_generation_14() const { return ___generation_14; }
inline int32_t* get_address_of_generation_14() { return &___generation_14; }
inline void set_generation_14(int32_t value)
{
___generation_14 = value;
}
};
struct Dictionary_2_t2711062372_StaticFields
{
public:
// System.Collections.Generic.Dictionary`2/Transform`1<TKey,TValue,System.Collections.DictionaryEntry> System.Collections.Generic.Dictionary`2::<>f__am$cacheB
Transform_1_t1842060127 * ___U3CU3Ef__amU24cacheB_15;
public:
inline static int32_t get_offset_of_U3CU3Ef__amU24cacheB_15() { return static_cast<int32_t>(offsetof(Dictionary_2_t2711062372_StaticFields, ___U3CU3Ef__amU24cacheB_15)); }
inline Transform_1_t1842060127 * get_U3CU3Ef__amU24cacheB_15() const { return ___U3CU3Ef__amU24cacheB_15; }
inline Transform_1_t1842060127 ** get_address_of_U3CU3Ef__amU24cacheB_15() { return &___U3CU3Ef__amU24cacheB_15; }
inline void set_U3CU3Ef__amU24cacheB_15(Transform_1_t1842060127 * value)
{
___U3CU3Ef__amU24cacheB_15 = value;
Il2CppCodeGenWriteBarrier(&___U3CU3Ef__amU24cacheB_15, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"kenobi82403@gmail.com"
] | kenobi82403@gmail.com |
9ee610b9df83d241fdaf5ae3251d710ebbff8fad | d9b1b746c3f734d5ecdf76392b6f9ec67b3064d9 | /veapp/prj_win32/GeneratedFiles/ui_vsctoolbar.h | 25c357f114f009525737752db3c0b6ac6a5fe2c6 | [
"MIT"
] | permissive | xwyangjshb/opencvr | 603359aed25bf81fb9728cddd90eeb7ab2c12c51 | 98f7e6c472dd44a8e4668203c2d8bc2826857cf7 | refs/heads/master | 2021-01-18T15:02:36.298839 | 2015-02-24T09:14:52 | 2015-02-24T09:14:52 | 31,262,809 | 3 | 0 | null | 2015-02-24T14:08:01 | 2015-02-24T14:08:01 | null | UTF-8 | C++ | false | false | 7,342 | h | /********************************************************************************
** Form generated from reading UI file 'vsctoolbar.ui'
**
** Created by: Qt User Interface Compiler version 5.4.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_VSCTOOLBAR_H
#define UI_VSCTOOLBAR_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_VSCToolBar
{
public:
QGridLayout *gridLayout;
QHBoxLayout *horizontalLayout;
QPushButton *pbSetting;
QPushButton *pbAlarm;
QComboBox *comboBox;
QPushButton *pushButton;
QSpacerItem *horizontalSpacer;
QLabel *time;
QLabel *cpu;
QPushButton *pbUser;
QPushButton *pbFullScreen;
QPushButton *pbAbout;
void setupUi(QWidget *VSCToolBar)
{
if (VSCToolBar->objectName().isEmpty())
VSCToolBar->setObjectName(QStringLiteral("VSCToolBar"));
VSCToolBar->resize(869, 37);
VSCToolBar->setMaximumSize(QSize(100000, 60));
QIcon icon;
icon.addFile(QStringLiteral(":/logo/resources/vscsmall.png"), QSize(), QIcon::Normal, QIcon::Off);
VSCToolBar->setWindowIcon(icon);
VSCToolBar->setStyleSheet(QStringLiteral(""));
gridLayout = new QGridLayout(VSCToolBar);
gridLayout->setSpacing(0);
gridLayout->setObjectName(QStringLiteral("gridLayout"));
gridLayout->setContentsMargins(0, 0, 0, 0);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setSpacing(9);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
horizontalLayout->setContentsMargins(0, -1, -1, -1);
pbSetting = new QPushButton(VSCToolBar);
pbSetting->setObjectName(QStringLiteral("pbSetting"));
pbSetting->setMinimumSize(QSize(30, 30));
pbSetting->setMaximumSize(QSize(30, 30));
QIcon icon1;
icon1.addFile(QStringLiteral(":/action/resources/setting.png"), QSize(), QIcon::Normal, QIcon::Off);
pbSetting->setIcon(icon1);
pbSetting->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pbSetting);
pbAlarm = new QPushButton(VSCToolBar);
pbAlarm->setObjectName(QStringLiteral("pbAlarm"));
pbAlarm->setEnabled(true);
pbAlarm->setMinimumSize(QSize(30, 30));
pbAlarm->setMaximumSize(QSize(30, 30));
QIcon icon2;
icon2.addFile(QStringLiteral(":/action/resources/alarm.png"), QSize(), QIcon::Normal, QIcon::Off);
pbAlarm->setIcon(icon2);
pbAlarm->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pbAlarm);
comboBox = new QComboBox(VSCToolBar);
comboBox->setObjectName(QStringLiteral("comboBox"));
comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
horizontalLayout->addWidget(comboBox);
pushButton = new QPushButton(VSCToolBar);
pushButton->setObjectName(QStringLiteral("pushButton"));
pushButton->setMinimumSize(QSize(30, 30));
pushButton->setMaximumSize(QSize(30, 30));
QIcon icon3;
icon3.addFile(QStringLiteral(":/action/resources/playview.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButton->setIcon(icon3);
pushButton->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pushButton);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer);
time = new QLabel(VSCToolBar);
time->setObjectName(QStringLiteral("time"));
horizontalLayout->addWidget(time);
cpu = new QLabel(VSCToolBar);
cpu->setObjectName(QStringLiteral("cpu"));
cpu->setMinimumSize(QSize(180, 30));
cpu->setMaximumSize(QSize(180, 30));
horizontalLayout->addWidget(cpu);
pbUser = new QPushButton(VSCToolBar);
pbUser->setObjectName(QStringLiteral("pbUser"));
pbUser->setMinimumSize(QSize(30, 30));
pbUser->setMaximumSize(QSize(30, 30));
QIcon icon4;
icon4.addFile(QStringLiteral(":/action/resources/user.png"), QSize(), QIcon::Normal, QIcon::Off);
pbUser->setIcon(icon4);
pbUser->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pbUser);
pbFullScreen = new QPushButton(VSCToolBar);
pbFullScreen->setObjectName(QStringLiteral("pbFullScreen"));
pbFullScreen->setMinimumSize(QSize(30, 30));
pbFullScreen->setMaximumSize(QSize(30, 30));
QIcon icon5;
icon5.addFile(QStringLiteral(":/action/resources/view-fullscreen.png"), QSize(), QIcon::Normal, QIcon::Off);
pbFullScreen->setIcon(icon5);
pbFullScreen->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pbFullScreen);
pbAbout = new QPushButton(VSCToolBar);
pbAbout->setObjectName(QStringLiteral("pbAbout"));
pbAbout->setMinimumSize(QSize(30, 30));
pbAbout->setMaximumSize(QSize(30, 30));
pbAbout->setIcon(icon);
pbAbout->setIconSize(QSize(30, 30));
horizontalLayout->addWidget(pbAbout);
gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);
retranslateUi(VSCToolBar);
QMetaObject::connectSlotsByName(VSCToolBar);
} // setupUi
void retranslateUi(QWidget *VSCToolBar)
{
VSCToolBar->setWindowTitle(QApplication::translate("VSCToolBar", "VSC", 0));
#ifndef QT_NO_TOOLTIP
pbSetting->setToolTip(QApplication::translate("VSCToolBar", "<html><head/><body><p>TODO next version</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
pbSetting->setText(QString());
#ifndef QT_NO_TOOLTIP
pbAlarm->setToolTip(QApplication::translate("VSCToolBar", "<html><head/><body><p>TODO next version </p></body></html>", 0));
#endif // QT_NO_TOOLTIP
pbAlarm->setText(QString());
comboBox->clear();
comboBox->insertItems(0, QStringList()
<< QApplication::translate("VSCToolBar", "Select a Tour ", 0)
<< QApplication::translate("VSCToolBar", "View 1", 0)
<< QApplication::translate("VSCToolBar", "View 2", 0)
);
pushButton->setText(QString());
time->setText(QApplication::translate("VSCToolBar", "2014-03-08 14:11:00", 0));
cpu->setText(QString());
pbUser->setText(QString());
#ifndef QT_NO_TOOLTIP
pbFullScreen->setToolTip(QApplication::translate("VSCToolBar", "<html><head/><body><p>FullScreen</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
pbFullScreen->setText(QString());
#ifndef QT_NO_TOOLTIP
pbAbout->setToolTip(QApplication::translate("VSCToolBar", "<html><head/><body><p>About</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
pbAbout->setText(QString());
} // retranslateUi
};
namespace Ui {
class VSCToolBar: public Ui_VSCToolBar {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_VSCTOOLBAR_H
| [
"xsmart@163.com"
] | xsmart@163.com |
81c87f2ba06fe90caafcca359eeaf28340c53dda | 99bb7246a5577376694968cc320e34b4b8db1693 | /CommonLibF4/include/RE/NetImmerse/NiTCollection.h | f478a70f6b6b9b364cc662a0a18a755b3b6fc822 | [
"MIT"
] | permissive | Ryan-rsm-McKenzie/CommonLibF4 | 0d8f3baa4e3c18708e6427959f1d4f88bcf3d691 | cdd932ad1f4e37f33c28ea7d7e429428f5be43dd | refs/heads/master | 2023-07-26T23:24:09.615310 | 2023-07-16T22:53:24 | 2023-07-16T22:53:24 | 194,604,556 | 50 | 21 | MIT | 2023-07-20T22:20:02 | 2019-07-01T05:20:18 | C++ | UTF-8 | C++ | false | false | 744 | h | #pragma once
namespace RE
{
inline void* NiMalloc(std::size_t a_num)
{
using func_t = decltype(&NiMalloc);
REL::Relocation<func_t> func{ REL::ID(974443) };
return func(a_num);
}
inline void NiFree(void* a_ptr)
{
using func_t = decltype(&NiFree);
REL::Relocation<func_t> func{ REL::ID(242362) };
return func(a_ptr);
}
template <class T>
class NiTMallocInterface
{
public:
[[nodiscard]] static T* allocate(std::size_t a_num) { return NiMalloc(sizeof(T) * a_num); }
static void deallocate(T* a_ptr) { NiFree(a_ptr); }
};
template <class T>
class NiTNewInterface
{
public:
[[nodiscard]] static T* allocate(std::size_t a_num) { return new T[a_num]; }
static void deallocate(T* a_ptr) { delete[] a_ptr; }
};
}
| [
"ryan__mckenzie@hotmail.com"
] | ryan__mckenzie@hotmail.com |
5bc79e11d768a673c588d2dc2ad8e9ed70663f93 | 93d1fb0f9b13abc322935befb9c3fe43c6ff245e | /widget.h | 7da015a4800984778a1ba9065290f9353e2d0599 | [] | no_license | ZizhenWei/TowerGame | 780042decfb28b681cefd64de22168265be3f17b | 74db224fb1674a697756e59af6b48bffebdef17c | refs/heads/master | 2022-11-09T14:39:24.721731 | 2020-06-28T13:37:39 | 2020-06-28T13:37:39 | 269,600,113 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 349 | h | #ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include<QPainter>
#include<QPixmap>
#include<QPushButton>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = nullptr);
~Widget();
void paintEvent(QPaintEvent*);
private:
Ui::Widget *ui;
};
#endif // WIDGET_H
| [
"weizizhen072@yeah.net"
] | weizizhen072@yeah.net |
0f3aea3fd78fd88123d478386b0c1a90834aa627 | 55d2c86e34787533528ac999789bb56861457036 | /klever/plugins/autorization/widgets/settings/addpromissiondialog.cpp | 3581023ca3f316238152e3e1d45a62b8d200896c | [] | no_license | gen1izh/cpp | 91f635afc3820e7c6d447141d6067cf89a18f401 | ed6a05b16995158c0c060d0be51c103bc75da9b2 | refs/heads/master | 2020-04-16T02:09:57.406956 | 2017-03-26T07:59:00 | 2017-03-26T07:59:00 | 64,819,682 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,972 | cpp | #include "addpromissiondialog.h"
#include "ui_addpromissiondialog.h"
#include <QRegExp>
#include <QRegExpValidator>
#include <frameWork/base.h>
#include <library/orm/db/QDjango.h>
#include <library/orm/db/QDjangoQuerySet.h>
#include <QMessageBox>
#include <library/message/messagelibrary.h>
#include <QtSql/QSqlDatabase>
PromissionModel *AddPromissionDialog::modelPromissions() const
{
return m_modelPromissions;
}
void AddPromissionDialog::setModelPromissions(PromissionModel *modelPromissions)
{
m_modelPromissions = modelPromissions;
}
AddPromissionDialog::AddPromissionDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddPromissionDialog)
{
ui->setupUi(this);
QRegExp rx0("^(\\w+\\s+)$");
QValidator *validator0 = new QRegExpValidator(rx0, this);
ui->promissionEdit->setValidator(validator0);
QRegExp rx1("^([A-Z0-9]+)$");
QValidator *validator1 = new QRegExpValidator(rx1, this);
ui->signatureEdit->setValidator(validator1);
}
AddPromissionDialog::~AddPromissionDialog()
{
delete ui;
}
QString AddPromissionDialog::name() const
{
return ui->promissionEdit->text();
}
QString AddPromissionDialog::signature() const
{
return ui->signatureEdit->text();
}
void AddPromissionDialog::on_buttonBox_accepted()
{
QDjango::setDatabase(*Core::Base::instance().sessionDatabase());
QDjango::registerModel<Promission>();
QDjango::createTables();
QDjangoQuerySet<Promission> proms;
bool isFind = false;
QList<QVariantMap> propertyMaps = proms.values(QStringList() << "name" << "signature" << "constant");
foreach (const QVariantMap &propertyMap, propertyMaps) {
if (propertyMap["signature"].toString() == ui->signatureEdit->text()) {
isFind = true;
}
}
if (!isFind) {
QDjangoQuerySet<Role> roles;
Role role;
for (int i = 0; i < roles.size(); ++i) {
if (roles.at(i, &role)) {
if (role.name() == ui->rolesBox->currentText()) {
m_modelPromissions->addPromission(ui->promissionEdit->text(),
ui->signatureEdit->text(), "",
&role);
m_modelPromissions->updateModel();
break;
}
}
}
}
else {
QMessageBox msgBox;
msgBox.setText(tr("Разрешение с таким названием уже существует!"));
msgBox.exec();
}
}
void AddPromissionDialog::showEvent(QShowEvent *)
{
QDjango::setDatabase(*Core::Base::instance().sessionDatabase());
QDjango::registerModel<Promission>();
QDjango::createTables();
QDjangoQuerySet<Role> roles;
QList<QVariantMap> propertyMaps = roles.values(QStringList() << "name" );
foreach (const QVariantMap &propertyMap, propertyMaps) {
ui->rolesBox->addItem(propertyMap["name"].toString());
}
}
| [
"gen.izh@yandex.ru"
] | gen.izh@yandex.ru |
b16b61fe32ee88ba3618c4893f7c0c14695d2486 | bae95f030721e209ca02e678f236ac6074f2fee0 | /cvsd.cpp | 72ea2903cd0c1122d744766f986f50495e294e34 | [] | no_license | Digreem/CVSD-codec | d386c9f9558f0170ce945b4555a5abf29f3c96bb | fd7a54b19a9b885c8a5b7acfbd93c7be3abac245 | refs/heads/master | 2020-07-04T03:06:04.415392 | 2019-08-13T13:49:47 | 2019-08-13T13:49:47 | 202,133,930 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,191 | cpp | #include <string.h>
#include <stdint.h>
#include "cvsd.h"
#include "math.h"
T_CVSD_MAIN_STRUCT EncodeParams;
#define DELTA_MIN (int32_t)(0.0001 * 32768)//(0.0002 * 32768)
#define DELTA_MAX (int32_t)(0.0078 * 32768)//(0.0078 * 32768)
#define SYLLABIC_CONST (int32_t)(0.9845 * 32768)//(0.9845 * 32768)
#define PRM_INTEG_CONST (int32_t)(0.9394 * 32768)//(0.9394 * 32768)
#define INTEG_B1 (int32_t)(1.2708 * 32768)//(1.2708 * 32768)
#define INTEG_B2 (int32_t)(0.3202 * 32768)//(0.3202 * 32768)
#define INTEG_G2D (int32_t)(1.5092 * 32768)//(1.5092 * 32768)
void cvsd_encode(register int16_t *voice_frame, register uint8_t *cvsd_out_pack, register size_t len)
{
memset(&EncodeParams, 0, sizeof(EncodeParams));
register int16_t current_bit;
register int32_t tmp1, tmp2;
register size_t i;
for (i = 0; i<len; i++)
{
EncodeParams.In_current = voice_frame[i];
if (EncodeParams.In_current >(EncodeParams.product))
current_bit = 1;
else
current_bit = -1;
EncodeParams.bit_accum = current_bit + EncodeParams.prev1 + EncodeParams.prev2;
tmp1 = (SYLLABIC_CONST * EncodeParams.step) >> 15;
if (abs(EncodeParams.bit_accum) == 3)
EncodeParams.step = tmp1 + DELTA_MAX;
else
EncodeParams.step = tmp1 + DELTA_MIN;
// Primary reconstruction integration
tmp1 = (PRM_INTEG_CONST * EncodeParams.product) >> 15;
tmp2 = EncodeParams.step*current_bit;
EncodeParams.product = tmp1 + tmp2;
// Shift
EncodeParams.prev2 = EncodeParams.prev1;
EncodeParams.prev1 = current_bit;
EncodeParams.Out_current = (current_bit + 1) >> 1; // -1 --> 0; 1 --> 1
cvsd_out_pack[i >> 3] <<= 1;
cvsd_out_pack[i >> 3] |= EncodeParams.Out_current; // write bit to the beginning of the file
}
}
void cvsd_decode(int16_t *voice_frame, uint8_t *cvsd_out_pack, size_t len)
{
int32_t tmp1, tmp2, tmp3;
size_t i;
for (i = 0; i<len; i++)
{
EncodeParams.In_current = (cvsd_out_pack[i / 8] >> (7 - i % 8)) & 1; //extract current bit from byte
EncodeParams.In_current = 2 * EncodeParams.In_current - 1; // 0 --> -1; 1 --> 1
EncodeParams.bit_accum = EncodeParams.In_current + EncodeParams.prev1 + EncodeParams.prev2;
tmp1 = (SYLLABIC_CONST * EncodeParams.dec_step) >> 15;
if (abs(EncodeParams.bit_accum) == 3)
EncodeParams.dec_step = tmp1 + DELTA_MAX;
else
EncodeParams.dec_step = tmp1 + DELTA_MIN;
// Primary reconstruction integration
tmp1 = (INTEG_B1 * EncodeParams.dec_prev1) >> 15;
tmp2 = (INTEG_B2 * EncodeParams.dec_prev2) >> 15;
tmp3 = (INTEG_G2D * EncodeParams.dec_step) >> 15;
tmp3 = tmp3 * EncodeParams.In_current;
tmp1 = tmp1 - tmp2 + tmp3;
// Saturation process
if (tmp1 >= 32767) // up overflow
EncodeParams.Out_current = 32767;
else if (tmp1 <= -32768) // down overflow
EncodeParams.Out_current = -32768;
else // no overflow
EncodeParams.Out_current = tmp1;
// Shift
EncodeParams.prev2 = EncodeParams.prev1;
EncodeParams.prev1 = EncodeParams.In_current;
EncodeParams.dec_prev2 = EncodeParams.dec_prev1;
EncodeParams.dec_prev1 = EncodeParams.Out_current;
voice_frame[i] = EncodeParams.Out_current;
}
}
| [
"dimasike911@gmail.com"
] | dimasike911@gmail.com |
9f521c4e7bd12006dd202305114683b661fedc4f | 8819b89440f7b64278f38f4cd344d8bbe4bffd51 | /tAREA 21 mi nombre CON PUNTEROS.cpp | b783708559a585ef1834cf513910625db3bc587d | [] | no_license | cajero/Computadoras-Y-Programacion | 6d0ceabf345d6adbbdcb2b53e2e414f005504e2e | e8f0b7b3ba0c0ccbb8b9a8e003c55105b43892a5 | refs/heads/master | 2021-01-23T12:00:21.196248 | 2017-11-22T18:45:12 | 2017-11-22T18:45:12 | 102,643,307 | 0 | 0 | null | 2017-09-06T18:22:09 | 2017-09-06T18:22:09 | null | UTF-8 | C++ | false | false | 983 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void Menu1();
void letra1();
void letra2();
void letra3();
void letra4();
void letra5();
int main()
{
letra1(); letra2(); letra3(); letra4(); letra5();
system("PAUSE");
return 0;
}
void Menu1(){}
void letra1() {
printf("\teeeeee\n");
printf("\tee\n");
printf("\teeeee\n");
printf("\tee\n");
printf("\teeeeee\n\n");
}
void letra2() {
printf("\tll\n");
printf("\tll\n");
printf("\tll\n");
printf("\tll\n");
printf("\tlllllll\n\n");
}
void letra3() {
printf("\tiiiiii\n");
printf("\t ii\n");
printf("\t ii\n");
printf("\t ii\n");
printf("\tiiiiii\n\n");
}
void letra4() {
printf("\t a\n");
printf("\t a a\n");
printf("\t aaaaa\n");
printf("\t a a\n");
printf("\ta a\n\n");
}
void letra5() {
printf("\tsssssss\n");
printf("\tss\n");
printf("\tsssssss\n");
printf("\t ss\n");
printf("\tsssssss\n\t\t\t");
}
| [
"noreply@github.com"
] | noreply@github.com |
8f9e5adf3dd9075704d49f9b8a369c07d2dd86ac | a37df7013d33a9a7910d648b65b7e4be66761774 | /Chapter11/atomic_references.cpp | e32159be0f4647f73f81663a541e1b11169bef6a | [
"MIT"
] | permissive | yajunjiao/Cpp-High-Performance-Second-Edition | 43cad0dde3be3e45b48a23ad730c729a5b77a922 | b641a8759b633b5ee4495379e4ea4b3b70376d4a | refs/heads/master | 2022-12-31T12:08:47.773117 | 2020-10-23T15:19:37 | 2020-10-23T15:19:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,349 | cpp | // Requires C++20
// Compile using gcc 10: g++ -std=c++2a -O3 -lpthread -Wall
#include <version>
#if defined(__cpp_lib_atomic_ref) && defined(__cpp_lib_jthread)
#include <gtest/gtest.h>
#include <atomic>
#include <iostream>
#include <random>
#include <thread>
namespace {
auto random_int(int min, int max) {
// One engine instance per thread
thread_local static auto engine =
std::default_random_engine{std::random_device{}()};
auto dist = std::uniform_int_distribution<>{min, max};
return dist(engine);
}
struct Stats {
int heads{};
int tails{};
};
std::ostream& operator<<(std::ostream& os, const Stats& s) {
os << "heads: " << s.heads << ", tails: " << s.tails;
return os;
}
void filp_coin(std::size_t n, Stats& outcomes) {
auto flip = [&outcomes](auto n) {
auto heads = std::atomic_ref<int>{outcomes.heads};
auto tails = std::atomic_ref<int>{outcomes.tails};
for (auto i = 0u; i < n; ++i) {
random_int(0, 1) == 0 ? ++heads : ++tails;
}
};
auto t1 = std::jthread{flip, n / 2}; // First half
auto t2 = std::jthread{flip, n - (n / 2)}; // The rest
}
TEST(Atomics, AtomicReferences) {
auto stats = Stats{};
filp_coin(5000, stats); // Flip 5000 times
std::cout << stats << '\n';
ASSERT_EQ(5000, (stats.tails + stats.heads));
}
} // namespace
#endif // atomic ref && jthread | [
"bjorn.andrist@gmail.com"
] | bjorn.andrist@gmail.com |
b0acea551f11c96838652a8ce70f00b8478ebd05 | e0c83d000a60fbd867a2ea6d5e3d20967a69a48a | /thrift/compiler/ast/t_sink.h | 2b5d623a1572b45a05fa8ef2070b0d357dbbb7c5 | [
"Apache-2.0"
] | permissive | hstreamdb/fbthrift | 88d602d0fd1a446196631b466941a66c035f9db0 | ae94d87b23b18c5c6f97c5248563c7c49276b192 | refs/heads/master | 2023-09-02T12:52:26.363350 | 2021-07-15T02:47:46 | 2021-07-15T03:03:18 | 325,493,425 | 0 | 0 | Apache-2.0 | 2020-12-30T08:11:59 | 2020-12-30T08:11:59 | null | UTF-8 | C++ | false | false | 4,015 | h | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <string>
#include <utility>
#include <thrift/compiler/ast/t_throws.h>
#include <thrift/compiler/ast/t_type.h>
namespace apache {
namespace thrift {
namespace compiler {
/**
* A sink is a lightweight object type that just wraps another data type.
*
*/
class t_sink : public t_type {
public:
explicit t_sink(
t_type_ref sink_type,
std::unique_ptr<t_throws> sink_exceptions,
t_type_ref final_response_type,
std::unique_ptr<t_throws> final_response_exceptions)
: sink_type_(std::move(sink_type)),
sink_exceptions_(std::move(sink_exceptions)),
final_response_type_(std::move(final_response_type)),
final_response_exceptions_(std::move(final_response_exceptions)) {}
const t_type_ref* sink_type() const { return &sink_type_; }
const t_throws* sink_exceptions() const {
return t_throws::get_or_empty(sink_exceptions_);
}
const t_type_ref* final_response_type() const {
return &final_response_type_;
}
const t_throws* final_response_exceptions() const {
return t_throws::get_or_empty(final_response_exceptions_);
}
void set_first_response_type(std::unique_ptr<t_type_ref> first_response) {
first_response_type_ = std::move(first_response);
}
bool has_first_response() const { return first_response_type_ != nullptr; }
const t_type_ref* first_response_type() const {
return first_response_type_.get();
}
std::string get_full_name() const override {
return "sink<" + sink_type_.type()->get_full_name() + ", " +
final_response_type_.type()->get_full_name() + ">" +
(sink_has_first_response()
? (", " + first_response_type_->type()->get_full_name())
: "");
}
private:
t_type_ref sink_type_;
std::unique_ptr<t_throws> sink_exceptions_;
t_type_ref final_response_type_;
std::unique_ptr<t_throws> final_response_exceptions_;
std::unique_ptr<t_type_ref> first_response_type_;
public:
// TODO(afuller): Delete everything below here. It is only provided for
// backwards compatibility.
explicit t_sink(
const t_type* sink_type,
std::unique_ptr<t_throws> sink_exceptions,
const t_type* final_response_type,
std::unique_ptr<t_throws> final_response_exceptions)
: t_sink(
t_type_ref(sink_type),
std::move(sink_exceptions),
t_type_ref(final_response_type),
std::move(final_response_exceptions)) {}
void set_first_response(const t_type* first_response) {
set_first_response_type(std::make_unique<t_type_ref>(first_response));
}
bool sink_has_first_response() const { return has_first_response(); }
t_throws* get_final_response_xceptions() const {
return final_response_exceptions_.get();
}
t_throws* get_sink_xceptions() const { return sink_exceptions_.get(); }
const t_type* get_sink_type() const { return sink_type()->type(); }
const t_type* get_first_response_type() const {
return first_response_type_ == nullptr ? nullptr
: first_response_type_->type();
}
const t_type* get_final_response_type() const {
return final_response_type()->type();
}
bool is_sink() const override { return true; }
type get_type_value() const override { return type::t_sink; }
};
} // namespace compiler
} // namespace thrift
} // namespace apache
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
5f7c2812714e87e60d3e049d469d4558e380f01c | 6f9be894dccaa9aeaf26941eded3e383dee3743c | /utility.h | 659549735d269c2d2f715f2743f6e1786302ae6a | [] | no_license | palkim/graph2 | 4531445994feb20650163f539f119df6526175ac | 3d20d5627656c439711670386726ec8ebca32f1e | refs/heads/main | 2023-01-31T19:28:14.823416 | 2020-12-12T20:26:53 | 2020-12-12T20:26:53 | 319,670,709 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 513 | h | #pragma once
#include <string>
namespace fst
{
namespace math
{
static float min(float a, float b)
{
return a < b ? a : b;
}
static float max(float a, float b)
{
return a > b ? a : b;
}
static int string2Index(std::string s, int i){
int nextSpaceIndex = s.find(' ', i);
int index = std::stoi(s.substr(i+1, nextSpaceIndex-i-1))-1;
return index;
}
}
} | [
"petekalkim@hotmail.com"
] | petekalkim@hotmail.com |
503f3667e4e2f65b27e61a3d3ec1648f26d71187 | 40d9006c2f2a9403da9701a154e744011df26c2d | /以表格的形式把a的值拷贝给b.cpp | 5f820e580088056d52eed84204bbb8d2c2009b86 | [
"MIT"
] | permissive | Jerromylynn/The-first-stage | 4b2c4550a560e1535cb2cc65ad58c2eacb49bcf4 | 9cd59247a067f8502effd8e6569c9494349f4247 | refs/heads/master | 2021-09-05T13:55:58.254052 | 2018-01-28T13:00:38 | 2018-01-28T13:00:38 | 107,367,186 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cpp | #include <stdio.h>
int main(void)
{
int i;
int a[5]={17,23,36};
int b[5];
puts(" a b");
puts("----------");
for(i=0;i<5;i++){
b[i]=a[i];
printf("%4d%4d\n",a[i],b[i]);
}
return 0;
}
| [
"1044685413@qq.com"
] | 1044685413@qq.com |
9518240cb95f1d518c2bfc2fa1cf4663c05c4582 | 05346710ff0cc734ef7799d77c96d0463cae59f7 | /src/database/online_database.cpp | 262c0270582e4382357adf441c143436605d8b2c | [
"MIT"
] | permissive | PRBonn/online_place_recognition | 250788edf0274026b6fd0cdfae7873bb9391c172 | 9d03aae0127e8158b575590048fb74138b19d441 | refs/heads/master | 2022-10-13T11:10:39.609530 | 2022-10-02T11:39:19 | 2022-10-02T11:39:19 | 94,753,441 | 113 | 27 | null | null | null | null | UTF-8 | C++ | false | false | 5,077 | cpp | /** online_place_recognition: a library for online matching of image sequences
** Copyright (c) 2017 O. Vysotska, C. Stachniss, University of Bonn
**
** 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 "database/online_database.h"
#include <fstream>
#include <limits>
#include <string>
#include <vector>
#include "database/list_dir.h"
#include "features/feature.h"
#include "tools/timer/timer.h"
using std::vector;
using std::string;
/**
* @brief Gets the match cost.
*
* @param[in] quId The qu identifier
* @param[in] refId The reference identifier
*
* @return The match cost. return -1 if cost is not found
*/
double MatchMap::getMatchCost(int quId, int refId) {
auto row_iter = _matches.find(quId);
if (row_iter != _matches.end()) {
// found
auto el_iter = row_iter->second.find(refId);
if (el_iter != row_iter->second.end()) {
return el_iter->second;
}
}
return -1.0;
}
bool OnlineDatabase::isSet() const {
if (_quFeaturesNames.empty()) {
printf("[ERROR][OnlineDatabase] Query features are not set\n");
return false;
}
if (_refFeaturesNames.empty()) {
printf("[ERROR][OnlineDatabase] Reference features are not set\n");
return false;
}
return true;
}
double OnlineDatabase::getCost(int quId, int refId) {
double cost = _matchMap.getMatchCost(quId, refId);
if (cost > -1.0) {
// cost was found
return cost;
}
// printf(
// "[DEBUG][OnlineDatabase] Matching costs for features %d - %d will be "
// "computed.\n",
// quId, refId);
cost = computeMatchCost(quId, refId);
_matchMap.addMatchCost(quId, refId, cost);
return cost;
}
void OnlineDatabase::setQuFeaturesFolder(const std::string &path2folder) {
_quFeaturesFolder = path2folder;
_quFeaturesNames = listDir(path2folder);
}
void OnlineDatabase::setRefFeaturesFolder(const std::string &path2folder) {
_refFeaturesFolder = path2folder;
_refFeaturesNames = listDir(path2folder);
}
void OnlineDatabase::setBufferSize(int size) {
_refBuff.setBufferSize(size);
_quBuff.setBufferSize(size);
}
void OnlineDatabase::setFeatureType(FeatureFactory::FeatureType type) {
_featureFactory.setFeatureType(type);
}
// use for tests / visualization only
const MatchMap &OnlineDatabase::getMatchMap() const { return _matchMap; }
double OnlineDatabase::computeMatchCost(int quId, int refId) {
// The next 2 lines are the same. Just wanted to get rid of the int-size_t
// comparison warning
// if (quId < 0 || quId >= _quFeaturesNames.size()) {
if (quId < 0 || quId >= (int)_quFeaturesNames.size()) {
printf("[ERROR][OnlineDatabase] Feature %d is out of range\n", quId);
exit(EXIT_FAILURE);
}
if (refId < 0 || refId >= (int)_refFeaturesNames.size()) {
printf("[ERROR][OnlineDatabase] Feature %d is out of range\n", refId);
exit(EXIT_FAILURE);
}
iFeature::Ptr quFeaturePtr = nullptr, refFeaturePtr = nullptr;
if (_quBuff.inBuffer(quId)) {
quFeaturePtr = _quBuff.getFeature(quId);
} else {
quFeaturePtr = _featureFactory.createFeature();
quFeaturePtr->loadFromFile(_quFeaturesFolder + _quFeaturesNames[quId]);
_quBuff.addFeature(quId, quFeaturePtr);
}
if (_refBuff.inBuffer(refId)) {
refFeaturePtr = _refBuff.getFeature(refId);
} else {
refFeaturePtr = _featureFactory.createFeature();
refFeaturePtr->loadFromFile(_refFeaturesFolder + _refFeaturesNames[refId]);
_refBuff.addFeature(refId, refFeaturePtr);
}
double score = quFeaturePtr->computeSimilarityScore(refFeaturePtr);
return quFeaturePtr->score2cost(score);
}
std::string OnlineDatabase::getQuFeatureName(int id) const {
if (id < 0 || id >= (int)_quFeaturesNames.size()) {
printf("[WARNING][OnlineDatabase] No such feature exists\n");
return "";
}
return _quFeaturesNames[id];
}
std::string OnlineDatabase::getRefFeatureName(int id) const {
if (id < 0 || id >= (int)_refFeaturesNames.size()) {
printf("[WARNING][OnlineDatabase] No such feature exists\n");
return "";
}
return _refFeaturesNames[id];
}
| [
"olga.vysotska@uni-bonn.de"
] | olga.vysotska@uni-bonn.de |
fa6928185bae0dadb58144a7d86150d09a968c1f | 390549e8876a05cded4eacb501f3171b5bbf3679 | /Template class LL/Deque - Copy.hpp | 264e66fe0d8a33ecf3238b5d1383f67fdaba5832 | [] | no_license | swilliams511/Linked-List | cd5fbffb7f9cea2ea334ba7b97585624632b47d7 | 713e1dbd38fae5f3cf8ba263eb8c3600fec1664d | refs/heads/master | 2021-01-17T08:38:42.980636 | 2017-04-19T06:41:23 | 2017-04-19T06:41:23 | 60,288,945 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,142 | hpp | #ifndef _deque
#define _deque
#include <iostream>
template <class T>
class Deque{
public:
Deque();
~Deque();
T& operator[](const int index) const; //access the kth element of a vector. RANGE: [0,size()-1]
T& at(const int index) const; //if using a pointer, use this RANGE: [0,size()-1]
int size() const;
bool empty() const;
void push_back(const T& data); //copy-based function to put new data at the back
void push_back(T&& data); //move-based function to put new data at the back
void push_front(const T& data); //copy-based function to put new data at the front
void push_front(T&& data); //move-based function to put new data at the front
void print() const;
void print_index() const;
private:
T** dynamicArray;
int arrayCapacity;
int numElements;
int first_map_index;
int last_map_index;
int empty_left;
int empty_right;
void first_insert(const T& data); //copy insert based
void first_insert(T&& data); //move insert based
void resize_back();
void resize_front();
};
#endif // _deque
| [
"williasc@seawolf.sonoma.edu"
] | williasc@seawolf.sonoma.edu |
7c32761aaaaed3bafc0a8fc0e41134d204bbd539 | e1327ef13ae0a2efc3dd8b6ad911c288842a017f | /TablasHash/tablahash.h | b90431f83fd1b2b0f384ffe966082f87c4f325f8 | [] | no_license | AlexBono97/Estructura-de-Datos-I | d9da858a91190ac5ae3550980daf52fef6e11a86 | 04711902403103d64a22313c5418c384f352ff29 | refs/heads/master | 2021-01-21T21:10:05.502829 | 2017-06-19T14:05:45 | 2017-06-19T14:05:45 | 94,782,251 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | h | #ifndef TABLAHASH_H
#define TABLAHASH_H
#include "nodo.h"
#include "lista.h"
#include <iostream>
using namespace std;
class tablahash
{
public:
tablahash();
void insersion(string c,int num);
nodo * busqueda(string c);
bool eliminacion(string c);
int claveN(string cadenaux);
int hashh (int c);
virtual ~tablahash();
protected:
private:
int tamano;
lista tabla[10];
};
#endif // TABLAHASH_H
| [
"noreply@github.com"
] | noreply@github.com |
26bfd08852bef11e2ab9fc191501b47e910cb8f6 | d36e6921e69c8cd42a9ac01907f777c34aad84fc | /shared/src/native-lib/coreclr/src/inc/shim/versioninfo.inl | d714ba5e60971497da6df5dc49b4c1b8031d17d3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | permissive | DataDog/dd-trace-dotnet | 2ae44a2b21f89718308d599e97a9384a0897d48e | 78fdfe553af317e23cbfe07adaf1b69f37ff2d3b | refs/heads/master | 2023-08-29T19:14:19.595916 | 2023-08-29T18:55:59 | 2023-08-29T18:55:59 | 101,895,131 | 354 | 146 | Apache-2.0 | 2023-09-14T14:53:29 | 2017-08-30T14:59:41 | C# | UTF-8 | C++ | false | false | 3,959 | inl | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// versioninfo.inl
//
// representation of version#
//
// Note: must be platform independent
//
// ======================================================================================
// default cctor
inline VersionInfo::VersionInfo()
{
m_wMajor=0;
m_wMinor=0;
m_wBuild=0;
m_wRevision=0;
}
// constructor
inline VersionInfo::VersionInfo( unsigned short major,
unsigned short minor,
unsigned short build,
unsigned short revision
)
{
m_wMajor=major;
m_wMinor=minor;
m_wBuild=build;
m_wRevision=revision;
}
// field accessor
inline unsigned short VersionInfo::Major() const
{
return m_wMajor;
};
// field accessor
inline unsigned short VersionInfo::Minor() const
{
return m_wMinor;
};
// field accessor
inline unsigned short VersionInfo::Build() const
{
return m_wBuild;
};
// field accessor
inline unsigned short VersionInfo::Revision() const
{
return m_wRevision;
};
// Compares against the given version
//
// Input:
// version - the version info
//
// Output:
// return value:
// -1 given version is newer
// 1 given version is older
// 0 given version is the same
inline int VersionInfo::Compare(const VersionInfo& version) const
{
if (Major() > version.Major())
return 1;
if (Major() < version.Major())
return -1;
if (Minor() > version.Minor())
return 1;
if (Minor() < version.Minor())
return -1;
if (Build() > version.Build())
return 1;
if (Build() < version.Build())
return -1;
if (Revision() > version.Revision())
return 1;
if (Revision() < version.Revision())
return -1;
return 0;
}
// Parses the given string into VersionInfo
//
// Input:
// szString - the string to parse, "x.x.x.x"
//
// Output:
// return value: count of fields parsed (<=4) or -1 if an error
inline int VersionInfo::Parse(LPCTSTR szString, VersionInfo* result)
{
// sscanf is nice but we need an exact format match and no 0s
size_t iLen = _tcslen(szString);
unsigned short wVersion[4] = {0};
int iVerIdx = 0;
unsigned int dwCurrentValue = 0;
bool bFirstChar = true;
for (size_t i=0; i<= iLen; i++)
{
if(szString[i] == _T('\0'))
{
if(!bFirstChar)
wVersion[iVerIdx++] = (unsigned short)(dwCurrentValue & 0xffff);
break;
}
else
if (szString[i] == _T('.') )
{
if(bFirstChar)
return -1;
// fill in
wVersion[iVerIdx++] = (unsigned short)(dwCurrentValue & 0xffff);
//check for extra characters
if (iVerIdx > sizeof(wVersion)/sizeof(wVersion[0]))
{
if (szString[i+1] == _T('\0'))
break;
else
return -1;
}
//reset
dwCurrentValue=0;
bFirstChar=true;
continue;
}
else
if (szString[i] < _T('0'))
{
return -1;
}
else
if (szString[i] > _T('9'))
{
return -1;
}
else
if (szString[i] == _T('0') && bFirstChar && szString[i+1]!= _T('.') && szString[i+1]!= _T('\0') )
{
return -1;
}
// the character is a digit
dwCurrentValue=dwCurrentValue*10+szString[i]-_T('0');
if(dwCurrentValue > 0xffff)
return -1;
bFirstChar=false;
}
//successfully parsed
*result = VersionInfo(wVersion[0], wVersion[1], wVersion[2], wVersion[3]);
return iVerIdx;
}
| [
"noreply@github.com"
] | noreply@github.com |
734df25c2b5c3a125d120cbb36dcd0c3d02a1207 | 604397d0c3592874fd40a82a7f06bdcc9b28ad37 | /chapter02/2.13.cc | cecec7fbc4822179f2442d82648e8c3ec73bf4b2 | [] | no_license | derekhubbard/cpp_primer_exercises | 73c3d14f0cf21aa5dddb257c6de98f9bff46b595 | e9d183bf2c602e88927f98441d42aa828ec96f25 | refs/heads/master | 2022-11-28T00:11:40.184620 | 2020-08-09T16:26:56 | 2020-08-09T16:26:56 | 278,727,434 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 158 | cc | #include <iostream>
int i = 42;
int main() {
int i = 100;
int j = i; // j will have the value 100
std:: cout << j << std::endl;
return 0;
}
| [
"derek.e.hubbard@disney.com"
] | derek.e.hubbard@disney.com |
33a3596aa5645f6899e4c3ae10ccfe412e88ec0b | 3097046ae1f53fedd9a9be2695971bcdd207e9bd | /examples/nano_ble33_sense_microphone/nano_ble33_sense_microphone.ino | 6595709a1c5405806d00dca929ed3b0963900075 | [
"MIT"
] | permissive | TinyML-Team/HornDetection | 7c8d8c56699877c3b337736e631060fa75d5be8f | aed8b8383acf51525202b84f86742201aa5221f8 | refs/heads/master | 2023-07-05T02:31:20.450258 | 2021-08-24T14:01:21 | 2021-08-24T14:01:21 | 393,947,578 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,587 | ino | /* Edge Impulse Arduino examples
* Copyright (c) 2021 EdgeImpulse Inc.
*
* 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.
*/
// If your target is limited in memory remove this macro to save 10K RAM
#define EIDSP_QUANTIZE_FILTERBANK 0
/* Includes ---------------------------------------------------------------- */
#include <PDM.h>
#include <mjkiim0217-project-1_inferencing.h>
/** Audio buffers, pointers and selectors */
typedef struct {
int16_t *buffer;
uint8_t buf_ready;
uint32_t buf_count;
uint32_t n_samples;
} inference_t;
static inference_t inference;
static signed short sampleBuffer[2048];
static bool debug_nn = false; // Set this to true to see e.g. features generated from the raw signal
/**
* @brief Arduino setup function
*/
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Edge Impulse Inferencing Demo");
// summary of inferencing settings (from model_metadata.h)
ei_printf("Inferencing settings:\n");
ei_printf("\tInterval: %.2f ms.\n", (float)EI_CLASSIFIER_INTERVAL_MS);
ei_printf("\tFrame size: %d\n", EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE);
ei_printf("\tSample length: %d ms.\n", EI_CLASSIFIER_RAW_SAMPLE_COUNT / 16);
ei_printf("\tNo. of classes: %d\n", sizeof(ei_classifier_inferencing_categories) / sizeof(ei_classifier_inferencing_categories[0]));
if (microphone_inference_start(EI_CLASSIFIER_RAW_SAMPLE_COUNT) == false) {
ei_printf("ERR: Failed to setup audio sampling\r\n");
return;
}
}
/**
* @brief Arduino main function. Runs the inferencing loop.
*/
void loop()
{
ei_printf("Starting inferencing in 2 seconds...\n");
delay(2000);
ei_printf("Recording...\n");
bool m = microphone_inference_record();
if (!m) {
ei_printf("ERR: Failed to record audio...\n");
return;
}
ei_printf("Recording done\n");
signal_t signal;
signal.total_length = EI_CLASSIFIER_RAW_SAMPLE_COUNT;
signal.get_data = µphone_audio_signal_get_data;
ei_impulse_result_t result = { 0 };
EI_IMPULSE_ERROR r = run_classifier(&signal, &result, debug_nn);
if (r != EI_IMPULSE_OK) {
ei_printf("ERR: Failed to run classifier (%d)\n", r);
return;
}
// print the predictions
ei_printf("Predictions ");
ei_printf("(DSP: %d ms., Classification: %d ms., Anomaly: %d ms.)",
result.timing.dsp, result.timing.classification, result.timing.anomaly);
ei_printf(": \n");
for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
ei_printf(" %s: %.5f\n", result.classification[ix].label, result.classification[ix].value);
}
#if EI_CLASSIFIER_HAS_ANOMALY == 1
ei_printf(" anomaly score: %.3f\n", result.anomaly);
#endif
}
/**
* @brief Printf function uses vsnprintf and output using Arduino Serial
*
* @param[in] format Variable argument list
*/
void ei_printf(const char *format, ...) {
static char print_buf[1024] = { 0 };
va_list args;
va_start(args, format);
int r = vsnprintf(print_buf, sizeof(print_buf), format, args);
va_end(args);
if (r > 0) {
Serial.write(print_buf);
}
}
/**
* @brief PDM buffer full callback
* Get data and call audio thread callback
*/
static void pdm_data_ready_inference_callback(void)
{
int bytesAvailable = PDM.available();
// read into the sample buffer
int bytesRead = PDM.read((char *)&sampleBuffer[0], bytesAvailable);
if (inference.buf_ready == 0) {
for(int i = 0; i < bytesRead>>1; i++) {
inference.buffer[inference.buf_count++] = sampleBuffer[i];
if(inference.buf_count >= inference.n_samples) {
inference.buf_count = 0;
inference.buf_ready = 1;
break;
}
}
}
}
/**
* @brief Init inferencing struct and setup/start PDM
*
* @param[in] n_samples The n samples
*
* @return { description_of_the_return_value }
*/
static bool microphone_inference_start(uint32_t n_samples)
{
inference.buffer = (int16_t *)malloc(n_samples * sizeof(int16_t));
if(inference.buffer == NULL) {
return false;
}
inference.buf_count = 0;
inference.n_samples = n_samples;
inference.buf_ready = 0;
// configure the data receive callback
PDM.onReceive(&pdm_data_ready_inference_callback);
PDM.setBufferSize(4096);
// initialize PDM with:
// - one channel (mono mode)
// - a 16 kHz sample rate
if (!PDM.begin(1, EI_CLASSIFIER_FREQUENCY)) {
ei_printf("Failed to start PDM!");
microphone_inference_end();
return false;
}
// set the gain, defaults to 20
PDM.setGain(127);
return true;
}
/**
* @brief Wait on new data
*
* @return True when finished
*/
static bool microphone_inference_record(void)
{
inference.buf_ready = 0;
inference.buf_count = 0;
while(inference.buf_ready == 0) {
delay(10);
}
return true;
}
/**
* Get raw audio signal data
*/
static int microphone_audio_signal_get_data(size_t offset, size_t length, float *out_ptr)
{
numpy::int16_to_float(&inference.buffer[offset], out_ptr, length);
return 0;
}
/**
* @brief Stop PDM and release buffers
*/
static void microphone_inference_end(void)
{
PDM.end();
free(inference.buffer);
}
#if !defined(EI_CLASSIFIER_SENSOR) || EI_CLASSIFIER_SENSOR != EI_CLASSIFIER_SENSOR_MICROPHONE
#error "Invalid model for current sensor."
#endif
| [
"seonghun912@gmail.com"
] | seonghun912@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.