hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
108
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2554a0d5f1baacbb8c6c594da4b0029ce60d8e26
| 2,542
|
cpp
|
C++
|
ThirdParty/Struck/src/Sampler.cpp
|
abhineet123/MTF
|
6cb45c88d924fb2659696c3375bd25c683802621
|
[
"BSD-3-Clause"
] | 100
|
2016-12-11T00:34:06.000Z
|
2022-01-27T23:03:40.000Z
|
ThirdParty/Struck/src/Sampler.cpp
|
siqiyan/MTF
|
9a76388c907755448bb7223420fe74349130f636
|
[
"BSD-3-Clause"
] | 21
|
2017-09-04T06:27:13.000Z
|
2021-07-14T19:07:23.000Z
|
ThirdParty/Struck/src/Sampler.cpp
|
siqiyan/MTF
|
9a76388c907755448bb7223420fe74349130f636
|
[
"BSD-3-Clause"
] | 21
|
2017-02-19T02:12:11.000Z
|
2020-09-23T03:47:55.000Z
|
/*
* Struck: Structured Output Tracking with Kernels
*
* Code to accompany the paper:
* Struck: Structured Output Tracking with Kernels
* Sam Hare, Amir Saffari, Philip H. S. Torr
* International Conference on Computer Vision (ICCV), 2011
*
* Copyright (C) 2011 Sam Hare, Oxford Brookes University, Oxford, UK
*
* This file is part of Struck.
*
* Struck 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.
*
* Struck 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 Struck. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "mtf/ThirdParty/Struck/Sampler.h"
#include "mtf/ThirdParty/Struck/Config.h"
#define _USE_MATH_DEFINES
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace std;
namespace struck{
vector<FloatRect> Sampler::RadialSamples(FloatRect centre, int radius, int nr, int nt)
{
vector<FloatRect> samples;
FloatRect s(centre);
float rstep = (float)radius / nr;
float tstep = 2 * (float)M_PI / nt;
samples.push_back(centre);
for(int ir = 1; ir <= nr; ++ir)
{
float phase = (ir % 2)*tstep / 2;
for(int it = 0; it < nt; ++it)
{
float dx = ir*rstep*cosf(it*tstep + phase);
float dy = ir*rstep*sinf(it*tstep + phase);
s.SetXMin(centre.XMin() + dx);
s.SetYMin(centre.YMin() + dy);
samples.push_back(s);
}
}
return samples;
}
vector<FloatRect> Sampler::PixelSamples(FloatRect centre, int radius, bool halfSample)
{
vector<FloatRect> samples;
IntRect s(centre);
samples.push_back(s);
int r2 = radius*radius;
for(int iy = -radius; iy <= radius; ++iy)
{
for(int ix = -radius; ix <= radius; ++ix)
{
if(ix*ix + iy*iy > r2) continue;
if(iy == 0 && ix == 0) continue; // already put this one at the start
int x = (int)centre.XMin() + ix;
int y = (int)centre.YMin() + iy;
if(halfSample && (ix % 2 != 0 || iy % 2 != 0)) continue;
s.SetXMin(x);
s.SetYMin(y);
samples.push_back(s);
}
}
return samples;
}
}
| 27.630435
| 88
| 0.640047
|
abhineet123
|
2557b707320b1ac078aeb7a547c716231914c7a8
| 1,693
|
hpp
|
C++
|
include/PauseState.hpp
|
AgostonSzepessy/oxshans-battle
|
15d4cd5eb6375cca5e8e426fc9b8f70e74ca28b0
|
[
"MIT"
] | null | null | null |
include/PauseState.hpp
|
AgostonSzepessy/oxshans-battle
|
15d4cd5eb6375cca5e8e426fc9b8f70e74ca28b0
|
[
"MIT"
] | null | null | null |
include/PauseState.hpp
|
AgostonSzepessy/oxshans-battle
|
15d4cd5eb6375cca5e8e426fc9b8f70e74ca28b0
|
[
"MIT"
] | null | null | null |
#pragma once
#include <memory>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include "GameState.hpp"
#include "PlayState.hpp"
#include "Background.hpp"
/**
* @brief The PauseState class This the pause menu.
* The user can decide to resume, restart or quit.
*/
class PauseState : public GameState
{
public:
/**
* @brief build Creates a new std::unique_ptr<PauseState>
* @param window The window to draw everything on
* @param gsm The GameStateManager that handles switching states
* @return an std::unique_ptr<PauseState>
*/
static std::unique_ptr<PauseState> build(sf::RenderWindow *window, GameStateManager *gsm);
~PauseState();
/**
* @brief update Calls handleInput(), and changes the text color if
* the user has an option selected.
*/
void update();
/**
* @brief draw Draws the background, text, and everything else that needs to
* be drawn on the screen.
*/
void draw();
/**
* @brief handleInput Handles all input from the user.
*/
void handleInput();
protected:
private:
PauseState(sf::RenderWindow *window, GameStateManager *gsm);
void setText();
void changeTextColor();
void select();
/**
* Used for checking whether the mouse coordinates are on the text
* when clicking.
*/
bool inBounds(int x, int y, int width, int height, int x2, int y2);
const int textSize = 20;
const int menuOptions = 3;
int currentChoice = 0;
const sf::Color textColor = sf::Color::Black;
const sf::Color selectedText = sf::Color::Blue;
sf::Font *font;
sf::Text *text; // text to store menu options
int x; // mouse coordinates
int y;
std::unique_ptr<Background> background;
};
| 25.651515
| 92
| 0.680449
|
AgostonSzepessy
|
255bea5fc8a3cb03a0e5a4d77e498ae23a4a307b
| 991
|
hpp
|
C++
|
scenes/inf585/06_skinning/src/animation.hpp
|
Lieunoir/inf585
|
41e8e52436f34d4a46425482ff953888bb8345bc
|
[
"MIT"
] | null | null | null |
scenes/inf585/06_skinning/src/animation.hpp
|
Lieunoir/inf585
|
41e8e52436f34d4a46425482ff953888bb8345bc
|
[
"MIT"
] | null | null | null |
scenes/inf585/06_skinning/src/animation.hpp
|
Lieunoir/inf585
|
41e8e52436f34d4a46425482ff953888bb8345bc
|
[
"MIT"
] | null | null | null |
#pragma once
#include "vcl/vcl.hpp"
#include "skeleton.hpp"
namespace vcl
{
enum Marine_Animations {
IDLE,
WALK,
RUN,
};
struct marine_animation_structure {
bool transition = false;
float transitionStart;
Marine_Animations current_animation = IDLE;
Marine_Animations next_animation = IDLE;
skeleton_animation_structure idle_animation;
skeleton_animation_structure walk_animation;
skeleton_animation_structure run_animation;
};
buffer<affine_rt> mix(buffer<affine_rt> const &source, skeleton_animation_structure const &target, float alpha);
buffer<affine_rt> to_global(buffer<affine_rt> const& local, buffer<int> const& parent_index);
buffer<affine_rt> transition(marine_animation_structure &marine_animation, skeleton_animation_structure &skeleton_data, timer_interval &timer);
void change_animation(marine_animation_structure &marine_animation, timer_interval &timer);
}
| 30.96875
| 147
| 0.739657
|
Lieunoir
|
255bf262ed7427659800ab1396debc802f912f41
| 1,018
|
cpp
|
C++
|
src/game_object.cpp
|
SYNTAXDZ/simpleOpenGLGame
|
14f50824e9f43b6c421676856aa33b0cce053554
|
[
"MIT"
] | null | null | null |
src/game_object.cpp
|
SYNTAXDZ/simpleOpenGLGame
|
14f50824e9f43b6c421676856aa33b0cce053554
|
[
"MIT"
] | null | null | null |
src/game_object.cpp
|
SYNTAXDZ/simpleOpenGLGame
|
14f50824e9f43b6c421676856aa33b0cce053554
|
[
"MIT"
] | null | null | null |
/*******************************************************************
** This code is part of Breakout.
**
** Breakout is free software: you can redistribute it and/or modify
** it under the terms of the CC BY 4.0 license as published by
** Creative Commons, either version 4 of the License, or (at your
** option) any later version.
******************************************************************/
#include "game_object.h"
GameObject::GameObject()
: Position( 0, 0 ), Size( 1, 1 ), Velocity( 0.0f ), Color( 1.0f ), Rotation( 0.0f ), Sprite(), IsSolid( false ), Destroyed( false ) { }
GameObject::GameObject( glm::vec2 pos, glm::vec2 size, Texture2D sprite, glm::vec3 color, glm::vec2 velocity )
: Position( pos ), Size( size ), Velocity( velocity ), Color( color ), Rotation( 0.0f ), Sprite( sprite ), IsSolid( false ), Destroyed( false ) { }
void GameObject::Draw( SpriteRenderer &renderer ) {
renderer.DrawSprite( this->Sprite, this->Position, this->Size, this->Rotation, this->Color );
}
| 44.26087
| 151
| 0.585462
|
SYNTAXDZ
|
2560385ae097cd937e78ffb7e9ff23b9d0e28a0c
| 4,638
|
cpp
|
C++
|
Source/managementD3D.cpp
|
L0mion/Makes-a-Click
|
c7f53a53ea3a58da027ea5f00176352edb914718
|
[
"MIT"
] | 1
|
2016-04-28T06:24:15.000Z
|
2016-04-28T06:24:15.000Z
|
Source/managementD3D.cpp
|
L0mion/Makes-a-Click
|
c7f53a53ea3a58da027ea5f00176352edb914718
|
[
"MIT"
] | null | null | null |
Source/managementD3D.cpp
|
L0mion/Makes-a-Click
|
c7f53a53ea3a58da027ea5f00176352edb914718
|
[
"MIT"
] | null | null | null |
#include "managementD3D.h"
#include "utility.h"
ManagementD3D::ManagementD3D()
{
swapChain_ = NULL;
device_ = NULL;
devcon_ = NULL;
uavBackBuffer_ = NULL;
rtvBackBuffer_ = NULL;
dsvDepthBuffer_ = NULL;
}
ManagementD3D::~ManagementD3D()
{
SAFE_RELEASE(swapChain_);
SAFE_RELEASE(device_);
SAFE_RELEASE(devcon_);
SAFE_RELEASE(uavBackBuffer_);
SAFE_RELEASE(rtvBackBuffer_);
SAFE_RELEASE(dsvDepthBuffer_);
}
void ManagementD3D::present()
{
if(swapChain_)
swapChain_->Present(0, 0);
}
void ManagementD3D::setFullscreen(bool fullscreen)
{
swapChain_->SetFullscreenState(fullscreen, NULL);
}
void ManagementD3D::setBackBuffer()
{
devcon_->OMSetRenderTargets(1, &rtvBackBuffer_, dsvDepthBuffer_);
}
void ManagementD3D::setBackBufferNoDepth()
{
devcon_->OMSetRenderTargets(1, &rtvBackBuffer_, NULL);
}
void ManagementD3D::clearBackBuffer()
{
FLOAT clearColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
devcon_->ClearRenderTargetView(rtvBackBuffer_, clearColor);
}
ID3D11Device* ManagementD3D::getDevice() const
{
return device_;
}
ID3D11DeviceContext* ManagementD3D::getDeviceContext() const
{
return devcon_;
}
ID3D11RenderTargetView* ManagementD3D::getRTVBackBuffer()
{
return rtvBackBuffer_;
}
ID3D11DepthStencilView* ManagementD3D::getDSVDepthBuffer()
{
return dsvDepthBuffer_;
}
HRESULT ManagementD3D::init(HWND windowHandle)
{
HRESULT hr = S_OK;
hr = initDeviceAndSwapChain(windowHandle);
if(SUCCEEDED(hr))
hr = initBackBuffer();
if(SUCCEEDED(hr))
hr = initDepthBuffer();
if(SUCCEEDED(hr))
initViewport();
return hr;
}
HRESULT ManagementD3D::initDeviceAndSwapChain(HWND windowHandle)
{
HRESULT hr = S_OK;
DXGI_SWAP_CHAIN_DESC scd;
ZeroMemory(&scd, sizeof(scd));
scd.BufferCount = 1;
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
scd.BufferDesc.Width = SCREEN_WIDTH;
scd.BufferDesc.Height = SCREEN_HEIGHT;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.OutputWindow = windowHandle;
scd.BufferDesc.RefreshRate.Numerator = 60;
scd.BufferDesc.RefreshRate.Denominator = 1;
scd.SampleDesc.Count = 1;
scd.SampleDesc.Quality = 0;
scd.Windowed = true;
scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
UINT numFeatureLevels = 3;
D3D_FEATURE_LEVEL initiatedFeatureLevel;
D3D_FEATURE_LEVEL featureLevels[] = {D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0};
UINT numDriverTypes = 2;
D3D_DRIVER_TYPE driverTypes[] = {D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_REFERENCE};
UINT createDeviceFlags = 0;
#if defined( DEBUG ) || defined( _DEBUG )
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
unsigned int index = 0;
bool deviceCreated = false;
while(index < numDriverTypes && !deviceCreated)
{
hr = D3D11CreateDeviceAndSwapChain(NULL,
driverTypes[index],
NULL,
createDeviceFlags,
featureLevels,
numFeatureLevels,
D3D11_SDK_VERSION,
&scd,
&swapChain_,
&device_,
&initiatedFeatureLevel,
&devcon_);
if(SUCCEEDED(hr))
{
deviceCreated = true;
}
index++;
}
return hr;
}
HRESULT ManagementD3D::initBackBuffer()
{
HRESULT hr = S_OK;
ID3D11Texture2D* texBackBuffer;
swapChain_->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&texBackBuffer);
//hr = device_->CreateUnorderedAccessView(texBackBuffer, NULL, &uavBackBuffer_);
hr = device_->CreateRenderTargetView(texBackBuffer, NULL, &rtvBackBuffer_);
SAFE_RELEASE(texBackBuffer);
return hr;
}
HRESULT ManagementD3D::initDepthBuffer()
{
HRESULT hr = S_OK;
D3D11_TEXTURE2D_DESC texDesc;
ZeroMemory(&texDesc, sizeof(texDesc));
texDesc.Width = SCREEN_WIDTH;
texDesc.Height = SCREEN_HEIGHT;
texDesc.ArraySize = 1;
texDesc.MipLevels = 1;
texDesc.SampleDesc.Count = 1;
texDesc.Format = DXGI_FORMAT_D32_FLOAT;
texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
ID3D11Texture2D *depthBuffer;
device_->CreateTexture2D(&texDesc, NULL, &depthBuffer);
D3D11_DEPTH_STENCIL_VIEW_DESC dsvd;
ZeroMemory(&dsvd, sizeof(dsvd));
dsvd.Format = DXGI_FORMAT_D32_FLOAT;
dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
hr = device_->CreateDepthStencilView(depthBuffer, &dsvd, &dsvDepthBuffer_);
SAFE_RELEASE(depthBuffer);
return hr;
}
void ManagementD3D::initViewport()
{
D3D11_VIEWPORT viewport;
ZeroMemory(&viewport, sizeof(viewport));
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = SCREEN_WIDTH;
viewport.Height = SCREEN_HEIGHT;
viewport.MinDepth = 0;
viewport.MaxDepth = 1;
devcon_->RSSetViewports(1, &viewport);
}
| 24.15625
| 81
| 0.734368
|
L0mion
|
2562d879338199db4916c1ec79fa50f3fd9fdc37
| 1,755
|
cpp
|
C++
|
aidu_elevator/src/actions/moveoutelevator.cpp
|
MartienLagerweij/aidu
|
a9b6e5a61f20bd60a7773495ba254e1bded1d7a1
|
[
"MIT"
] | null | null | null |
aidu_elevator/src/actions/moveoutelevator.cpp
|
MartienLagerweij/aidu
|
a9b6e5a61f20bd60a7773495ba254e1bded1d7a1
|
[
"MIT"
] | null | null | null |
aidu_elevator/src/actions/moveoutelevator.cpp
|
MartienLagerweij/aidu
|
a9b6e5a61f20bd60a7773495ba254e1bded1d7a1
|
[
"MIT"
] | null | null | null |
#include <ros/ros.h>
#include <aidu_elevator/actions/moveoutelevator.h>
#include <aidu_robotarm/robot_arm_positions.h>
#include <aidu_vision/DistanceSensors.h>
#include <sensor_msgs/JointState.h>
#include <geometry_msgs/Twist.h>
#include <math.h>
using namespace aidu::elevator;
MoveOutElevator::MoveOutElevator(ros::NodeHandle* nh) : Action::Action(nh) {
// Publishers
positionPublisher = nh->advertise<geometry_msgs::Twist>("/pos",1,true);
armPublisher = nh->advertise<aidu_robotarm::robot_arm_positions>("/robot_arm_positions",1);
// Subscribers
distanceSubscriber = nh->subscribe("/sensors", 1, &MoveOutElevator::distanceCallback, this);
done = false;
}
MoveOutElevator::~MoveOutElevator() {
}
void MoveOutElevator::execute() {
ROS_INFO("Executing move out elevator action");
// Wait for doors
ros::Rate loop(5);
while(distance < 0.6 && ros::ok()) {
ros::spinOnce();
loop.sleep();
}
// Move outside
sleep(1);
this->moveBase(1.5, 0.0);
sleep(5);
aidu_robotarm::robot_arm_positions arm_position;
arm_position.translation = 0.0;
arm_position.rotation = 1.57;
arm_position.extention = 0.0;
armPublisher.publish(arm_position);
ros::spinOnce();
sleep(3);
ROS_INFO("MoveOutElevator complete");
this->done = true;
}
void MoveOutElevator::distanceCallback(const aidu_vision::DistanceSensors::ConstPtr& dist_msg){
distance = (dist_msg->Frontleft+dist_msg->Frontright)/2000.0;
}
void MoveOutElevator::moveBase(double linear, double angular) {
geometry_msgs::Twist position;
position.angular.z = angular;
position.linear.x = linear;
positionPublisher.publish(position);
ros::spinOnce();
}
bool MoveOutElevator::finished() {
return this->done;
}
| 26.590909
| 96
| 0.71396
|
MartienLagerweij
|
25632e571c62600c9572c258fa50ce252f18e186
| 3,034
|
cpp
|
C++
|
devmand/gateway/src/devmand/channels/cli/IoConfigurationBuilder.cpp
|
fannycchen/magma
|
b8ccc1c7437c555656988638482d3a8f458224e8
|
[
"BSD-3-Clause"
] | 1
|
2020-06-05T09:01:40.000Z
|
2020-06-05T09:01:40.000Z
|
devmand/gateway/src/devmand/channels/cli/IoConfigurationBuilder.cpp
|
phirmware/magma
|
1b3e4533235293f754d7375eb421c968cc0b1856
|
[
"BSD-3-Clause"
] | null | null | null |
devmand/gateway/src/devmand/channels/cli/IoConfigurationBuilder.cpp
|
phirmware/magma
|
1b3e4533235293f754d7375eb421c968cc0b1856
|
[
"BSD-3-Clause"
] | 1
|
2020-01-14T14:28:23.000Z
|
2020-01-14T14:28:23.000Z
|
// Copyright (c) 2019-present, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#define LOG_WITH_GLOG
#include <magma_logging.h>
#include <devmand/channels/cli/IoConfigurationBuilder.h>
#include <devmand/channels/cli/PromptAwareCli.h>
#include <devmand/channels/cli/QueuedCli.h>
#include <devmand/channels/cli/ReadCachingCli.h>
#include <devmand/channels/cli/SshSession.h>
#include <devmand/channels/cli/SshSessionAsync.h>
#include <devmand/channels/cli/SshSocketReader.h>
#include <folly/Singleton.h>
#include <folly/executors/IOThreadPoolExecutor.h>
namespace devmand {
namespace channels {
namespace cli {
using devmand::channels::cli::IoConfigurationBuilder;
using devmand::channels::cli::SshSocketReader;
using devmand::channels::cli::sshsession::readCallback;
using devmand::channels::cli::sshsession::SshSession;
using devmand::channels::cli::sshsession::SshSessionAsync;
using folly::EvictingCacheMap;
using folly::IOThreadPoolExecutor;
using std::make_shared;
using std::string;
// TODO executor?
shared_ptr<IOThreadPoolExecutor> executor =
std::make_shared<IOThreadPoolExecutor>(10);
IoConfigurationBuilder::IoConfigurationBuilder(
const DeviceConfig& _deviceConfig)
: deviceConfig(_deviceConfig) {}
shared_ptr<Cli> IoConfigurationBuilder::getIo(
shared_ptr<CliCache> commandCache) {
MLOG(MDEBUG) << "Creating CLI ssh device for " << deviceConfig.id
<< " (host: " << deviceConfig.ip << ")";
const auto& plaintextCliKv = deviceConfig.channelConfigs.at("cli").kvPairs;
// crate session
const std::shared_ptr<SshSessionAsync>& session =
std::make_shared<SshSessionAsync>(deviceConfig.id, executor);
// opening SSH connection
session
->openShell(
deviceConfig.ip,
std::stoi(plaintextCliKv.at("port")),
plaintextCliKv.at("username"),
plaintextCliKv.at("password"))
.get();
shared_ptr<CliFlavour> cl =
plaintextCliKv.find("flavour") != plaintextCliKv.end()
? CliFlavour::create(plaintextCliKv.at("flavour"))
: CliFlavour::create("");
// create CLI - how to create a CLI stack?
const shared_ptr<PromptAwareCli>& cli =
std::make_shared<PromptAwareCli>(session, cl);
// initialize CLI
cli->initializeCli();
// resolve prompt needs to happen
cli->resolvePrompt();
// create async data reader
event* sessionEvent = SshSocketReader::getInstance().addSshReader(
readCallback, session->getSshFd(), session.get());
session->setEvent(sessionEvent);
// create caching cli
const shared_ptr<ReadCachingCli>& ccli =
std::make_shared<ReadCachingCli>(deviceConfig.id, cli, commandCache);
// create Queued cli
return std::make_shared<QueuedCli>(deviceConfig.id, ccli, executor);
}
} // namespace cli
} // namespace channels
} // namespace devmand
| 33.711111
| 78
| 0.733355
|
fannycchen
|
256561aced4a948f2f5dc45c31d60250b094472a
| 499
|
hpp
|
C++
|
server/include/tds/protocol/receiver.hpp
|
JMazurkiewicz/TinDox
|
7f6c8e826683c875692fc97a3e89a4c5833dabf9
|
[
"MIT"
] | null | null | null |
server/include/tds/protocol/receiver.hpp
|
JMazurkiewicz/TinDox
|
7f6c8e826683c875692fc97a3e89a4c5833dabf9
|
[
"MIT"
] | null | null | null |
server/include/tds/protocol/receiver.hpp
|
JMazurkiewicz/TinDox
|
7f6c8e826683c875692fc97a3e89a4c5833dabf9
|
[
"MIT"
] | null | null | null |
#pragma once
#include "tds/ip/tcp_socket.hpp"
#include <span>
#include <vector>
namespace tds::protocol {
class Receiver {
public:
explicit Receiver(ip::TcpSocket& socket);
Receiver(const Receiver&) = delete;
Receiver& operator=(const Receiver&) = delete;
std::span<const char> receive();
private:
void read();
void check_error();
ip::TcpSocket& m_socket;
std::vector<char> m_data;
std::errc m_errc;
};
}
| 19.192308
| 54
| 0.59519
|
JMazurkiewicz
|
2567794d604519aeeae1c19ebadc8bd1e57daf9e
| 2,842
|
hpp
|
C++
|
src/interface/stream.hpp
|
wuxun-zhang/mkl-dnn
|
00a239ad2c932b967234ffb528069800ffcc0334
|
[
"Apache-2.0"
] | null | null | null |
src/interface/stream.hpp
|
wuxun-zhang/mkl-dnn
|
00a239ad2c932b967234ffb528069800ffcc0334
|
[
"Apache-2.0"
] | null | null | null |
src/interface/stream.hpp
|
wuxun-zhang/mkl-dnn
|
00a239ad2c932b967234ffb528069800ffcc0334
|
[
"Apache-2.0"
] | null | null | null |
/*******************************************************************************
* Copyright 2020-2022 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#ifndef INTERFACE_STREAM_HPP
#define INTERFACE_STREAM_HPP
#include "c_types_map.hpp"
#ifdef DNNL_GRAPH_WITH_SYCL
#include <CL/sycl.hpp>
#endif
#if DNNL_GRAPH_CPU_RUNTIME == DNNL_GRAPH_RUNTIME_THREADPOOL
#include "oneapi/dnnl/dnnl_graph_threadpool_iface.hpp"
#endif
struct dnnl_graph_stream {
public:
dnnl_graph_stream() = delete;
dnnl_graph_stream(const dnnl::graph::impl::engine_t *engine)
: engine_ {engine} {}
#ifdef DNNL_GRAPH_WITH_SYCL
// Create an stream from SYCL queue.
dnnl_graph_stream(const dnnl::graph::impl::engine_t *engine,
const cl::sycl::queue &queue)
: engine_ {engine}, queue_ {queue} {}
#endif // DNNL_GRAPH_WITH_SYCL
#if DNNL_GRAPH_CPU_RUNTIME == DNNL_GRAPH_RUNTIME_THREADPOOL
dnnl_graph_stream(const dnnl::graph::impl::engine_t *engine,
dnnl::graph::threadpool_interop::threadpool_iface *threadpool)
: dnnl_graph_stream(engine) {
assert(engine->kind() == dnnl::graph::impl::engine_kind::cpu);
threadpool_ = threadpool;
}
dnnl::graph::impl::status_t get_threadpool(
dnnl::graph::threadpool_interop::threadpool_iface **threadpool)
const {
if (engine_->kind() != dnnl::graph::impl::engine_kind::cpu)
return dnnl::graph::impl::status::invalid_arguments;
*threadpool = threadpool_;
return dnnl::graph::impl::status::success;
}
#endif
~dnnl_graph_stream() = default;
const dnnl::graph::impl::engine_t *get_engine() const noexcept {
return engine_;
}
#ifdef DNNL_GRAPH_WITH_SYCL
const cl::sycl::queue &get_queue() const noexcept { return queue_; }
#endif
dnnl::graph::impl::status_t wait() {
#ifdef DNNL_GRAPH_WITH_SYCL
queue_.wait();
#endif
return dnnl::graph::impl::status::success;
}
private:
const dnnl::graph::impl::engine_t *engine_;
#ifdef DNNL_GRAPH_WITH_SYCL
cl::sycl::queue queue_;
#endif
#if DNNL_GRAPH_CPU_RUNTIME == DNNL_GRAPH_RUNTIME_THREADPOOL
dnnl::graph::threadpool_interop::threadpool_iface *threadpool_ = nullptr;
#endif
};
#endif
| 32.295455
| 80
| 0.671006
|
wuxun-zhang
|
256a9728d866c93330b0cb16e2912deb5aff872d
| 770
|
cpp
|
C++
|
examples/Example4/EventListener.cpp
|
hasaranga/RFC-Framework
|
9c1881d412db6f9f7670b910a0918a631208cfd1
|
[
"MIT"
] | 9
|
2017-10-02T08:15:50.000Z
|
2021-08-09T21:29:46.000Z
|
examples/Example4/EventListener.cpp
|
hasaranga/RFC-Framework
|
9c1881d412db6f9f7670b910a0918a631208cfd1
|
[
"MIT"
] | 1
|
2021-09-18T07:38:53.000Z
|
2021-09-26T12:11:48.000Z
|
examples/Example4/EventListener.cpp
|
hasaranga/RFC-Framework
|
9c1881d412db6f9f7670b910a0918a631208cfd1
|
[
"MIT"
] | 8
|
2017-10-02T13:21:29.000Z
|
2021-07-30T09:35:31.000Z
|
#include "../../amalgamated/rfc_amalgamated.h"
class MyWindow : public KFrame, public KButtonListener
{
protected:
KButton btn1;
public:
MyWindow()
{
this->SetText(L"My Window");
this->Create();
btn1.SetPosition(10, 10);
btn1.SetText(L"My Button");
btn1.SetListener(this); // set MyWindow class as button listener
this->AddComponent(&btn1);
}
void OnButtonPress(KButton *button)
{
if (button == &btn1)
{
::MessageBoxW(this->GetHWND(), L"Button pressed!", L"Info", MB_ICONINFORMATION);
}
}
};
class MyApplication : public KApplication
{
public:
int Main(KString **argv, int argc)
{
MyWindow window;
window.CenterScreen();
window.SetVisible(true);
::DoMessagePump();
return 0;
}
};
START_RFC_APPLICATION(MyApplication);
| 16.041667
| 83
| 0.685714
|
hasaranga
|
256b27c22efe1506adcc2def5f60ca936113eb87
| 3,494
|
cpp
|
C++
|
sources/core/ecs/private/system_manager.cpp
|
suVrik/hooker.galore
|
616e2692d7afab24b70bfb6aa14ad780eb7c451d
|
[
"MIT"
] | 4
|
2019-09-14T09:18:47.000Z
|
2022-01-29T02:47:00.000Z
|
sources/core/ecs/private/system_manager.cpp
|
suVrik/hooker.galore
|
616e2692d7afab24b70bfb6aa14ad780eb7c451d
|
[
"MIT"
] | null | null | null |
sources/core/ecs/private/system_manager.cpp
|
suVrik/hooker.galore
|
616e2692d7afab24b70bfb6aa14ad780eb7c451d
|
[
"MIT"
] | 1
|
2020-03-25T14:41:17.000Z
|
2020-03-25T14:41:17.000Z
|
#include "core/ecs/system_manager.h"
#include "core/ecs/tags.h"
#include <entt/core/hashed_string.hpp>
#include <entt/meta/factory.hpp>
#include <algorithm>
namespace hg {
std::vector<SystemManager::SystemDescriptor> SystemManager::m_systems[2];
void SystemManager::commit() {
size_t current_tag_index = 0;
for (std::vector<SystemDescriptor>& systems : m_systems) {
std::unordered_map<std::string, size_t> system_mapping;
std::sort(systems.begin(), systems.end(), [](const SystemDescriptor& lhs, const SystemDescriptor& rhs) {
return lhs.name < rhs.name;
});
for (size_t i = 0; i < systems.size(); i++) {
SystemDescriptor& system_descriptor = systems[i];
entt::meta_prop tags_property = system_descriptor.system_type.prop("tags"_hs);
if (tags_property) {
entt::meta_any tags_property_value = tags_property.value();
assert(tags_property_value);
assert(tags_property_value.type() == entt::resolve<std::shared_ptr<TagWrapper>>());
const auto& tags_expression = tags_property_value.fast_cast<std::shared_ptr<TagWrapper>>();
system_descriptor.tag_expression = tags_expression.get();
}
assert(!system_descriptor.name.empty());
assert(system_mapping.count(system_descriptor.name) == 0);
system_mapping.emplace(system_descriptor.name, i);
}
for (size_t i = 0; i < systems.size(); i++) {
SystemDescriptor& system_descriptor = systems[i];
entt::meta_prop before_property = system_descriptor.system_type.prop("before"_hs);
if (before_property) {
entt::meta_any before_property_value = before_property.value();
assert(before_property_value);
assert(before_property_value.type() == entt::resolve<std::vector<const char*>>());
const auto& systems_before = before_property_value.fast_cast<std::vector<const char*>>();
for (const char* system_name : systems_before) {
assert(system_mapping.count(system_name) == 1);
systems[system_mapping[system_name]].after.push_back(i);
}
}
entt::meta_prop after_property = system_descriptor.system_type.prop("after"_hs);
if (after_property) {
entt::meta_any after_property_value = after_property.value();
assert(after_property_value);
assert(after_property_value.type() == entt::resolve<std::vector<const char*>>());
const auto& systems_after = after_property_value.fast_cast<std::vector<const char*>>();
for (const char* system_name : systems_after) {
assert(system_mapping.count(system_name) == 1);
system_descriptor.after.push_back(system_mapping[system_name]);
}
}
}
for (size_t i = 0; i < systems.size(); i++) {
SystemDescriptor& system_descriptor = systems[i];
std::vector<size_t>& after = system_descriptor.after;
std::sort(after.begin(), after.end());
after.erase(std::unique(after.begin(), after.end()), after.end());
#ifndef NDEBUG
for (size_t preceding_system : after) {
assert(i != preceding_system);
}
#endif
}
}
}
} // namespace hg
| 38.395604
| 112
| 0.604179
|
suVrik
|
257000e1ece5778c65cb48266b94130794cd584c
| 4,910
|
cpp
|
C++
|
test/coco/combix/error_test.cpp
|
agatan/coco
|
e19e74cf97d788b435351379296ea3ead901c576
|
[
"BSL-1.0"
] | 1
|
2016-08-31T04:44:17.000Z
|
2016-08-31T04:44:17.000Z
|
test/coco/combix/error_test.cpp
|
agatan/coco
|
e19e74cf97d788b435351379296ea3ead901c576
|
[
"BSL-1.0"
] | null | null | null |
test/coco/combix/error_test.cpp
|
agatan/coco
|
e19e74cf97d788b435351379296ea3ead901c576
|
[
"BSL-1.0"
] | null | null | null |
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE expected
#include <coco/combix/combinators.hpp>
#include <coco/combix/iterator_stream.hpp>
#include <coco/combix/primitives.hpp>
#include <coco/combix/chars.hpp>
#include <coco/combix/parser.hpp>
#include <coco/combix/lazy_fun.hpp>
#include <boost/test/unit_test.hpp>
#include <string>
namespace cbx = coco::combix;
using stream_type = cbx::iterator_stream<std::string::const_iterator>;
cbx::parser<std::string, stream_type> reserved() {
return cbx::choice(cbx::string("val"), cbx::string("true"),
cbx::string("false"), cbx::string("def"),
cbx::string("return"));
}
cbx::parser<std::string, stream_type> varname() {
auto lead = cbx::choice(cbx::alpha(), cbx::token('_'));
auto tail = cbx::map(
cbx::many(cbx::choice(cbx::alpha(), cbx::digit(), cbx::token('_'))),
[](auto&& cs) { return std::string(cs.begin(), cs.end()); });
auto const var = cbx::map(cbx::seq(lead, tail), [](auto&& s) {
return std::get<0>(std::forward<decltype(s)>(s)) +
std::get<1>(std::forward<decltype(s)>(s));
});
return cbx::expected(
cbx::map(cbx::seq(cbx::not_followed_by(reserved()), var),
[](auto&& t) { return std::get<1>(std::move(t)); }),
"identifier");
}
BOOST_AUTO_TEST_SUITE(combix)
BOOST_AUTO_TEST_SUITE(combinators)
BOOST_AUTO_TEST_CASE(parens) {
auto const src = std::string("()");
auto s = coco::combix::range_stream(src);
auto const p = cbx::choice(
cbx::alpha(), cbx::map(cbx::digit(), [](auto) { return '!'; }));
auto res = parse(p, s);
BOOST_TEST(res.is_error());
std::stringstream ss;
ss << res.unwrap_error();
BOOST_TEST(ss.str() == "Unexpected \"(\"\nExpected alphabet, digit\n");
}
BOOST_AUTO_TEST_CASE(seq) {
auto const src = std::string{"a1c"};
auto s = cbx::range_stream(src);
auto const p = cbx::seq(cbx::alpha(), cbx::digit(), cbx::digit());
auto res = parse(p, s);
BOOST_TEST(res.is_error());
std::stringstream ss;
ss << res.unwrap_error();
BOOST_TEST(ss.str() == "Unexpected \"c\"\nExpected digit\n");
}
BOOST_AUTO_TEST_CASE(expected) {
auto const src = std::string{"1"};
auto s = cbx::range_stream(src);
auto const p = cbx::expected(cbx::alpha(), "letter");
auto res = parse(p, s);
BOOST_TEST(res.is_error());
std::stringstream ss;
ss << res.unwrap_error();
BOOST_TEST(ss.str() == "Unexpected \"1\"\nExpected letter\n");
}
BOOST_AUTO_TEST_CASE(consumed) {
auto const src = std::string{"1b2"};
auto s = cbx::range_stream(src);
auto const p = cbx::seq(cbx::digit(), cbx::digit(), cbx::digit());
auto res = cbx::parse(p, s);
BOOST_TEST(res.is_error());
BOOST_TEST(res.unwrap_error().consumed());
BOOST_TEST(std::string(s.begin(), s.end()) == "b2");
auto const manyp = cbx::many(p);
s = cbx::range_stream(src);
auto res2 = cbx::parse(manyp, s);
BOOST_TEST(res2.is_error());
BOOST_TEST(res2.unwrap_error().consumed());
BOOST_TEST(std::string(s.begin(), s.end()) == "b2");
}
BOOST_AUTO_TEST_CASE(between_consumed) {
auto const p = cbx::between(cbx::token('('), cbx::token(')'), cbx::digit());
auto const src = std::string{"(1"};
auto s = cbx::range_stream(src);
auto res = cbx::parse(p, s);
BOOST_TEST(res.is_error());
BOOST_TEST(res.unwrap_error().consumed());
BOOST_TEST(std::string(s.begin(), s.end()) == "");
}
BOOST_AUTO_TEST_CASE(not_followed_by) {
auto const inner = cbx::skip_seq(cbx::spaces())(varname(), cbx::token(':'));
auto const p = cbx::sep_by(inner, cbx::skip(cbx::token(','), cbx::spaces()));
{
auto const src = std::string{"hoge:"};
auto s = cbx::range_stream(src);
auto res = cbx::parse(p, s);
BOOST_TEST(res.is_ok());
}
{
auto const src = std::string{"hoge"};
auto s = cbx::range_stream(src);
auto res = cbx::parse(p, s);
BOOST_TEST(res.is_error());
BOOST_TEST(res.unwrap_error().consumed());
}
{
auto const src = std::string{""};
auto s = cbx::range_stream(src);
auto res = cbx::parse(p, s);
BOOST_TEST(res.is_ok());
}
}
BOOST_AUTO_TEST_CASE(sep_by) {
auto const inner = cbx::skip_seq(cbx::spaces())(
cbx::digit(), cbx::token(':'), cbx::alpha());
auto const sep = cbx::sep_by(inner, cbx::token(','));
{
auto const src = std::string{"1:a,2:b"};
auto s = cbx::range_stream(src);
BOOST_TEST(parse(sep, s).is_ok());
}
{
auto const src = std::string{"1:a"};
auto s = cbx::range_stream(src);
BOOST_TEST(parse(sep, s).is_ok());
}
{
auto const src = std::string{""};
auto s = cbx::range_stream(src);
BOOST_TEST(parse(sep, s).is_ok());
}
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
| 30.496894
| 81
| 0.599593
|
agatan
|
25777280a133b64c960a2a9dd33c507a8b372261
| 6,727
|
cc
|
C++
|
src/frameset.cc
|
alexeden/realsense-node
|
a4060c8fdcc091d933fb4c895f04e72f44328e63
|
[
"MIT"
] | null | null | null |
src/frameset.cc
|
alexeden/realsense-node
|
a4060c8fdcc091d933fb4c895f04e72f44328e63
|
[
"MIT"
] | 6
|
2021-01-28T20:31:27.000Z
|
2022-03-25T18:59:04.000Z
|
src/frameset.cc
|
alexeden/realsense-node
|
a4060c8fdcc091d933fb4c895f04e72f44328e63
|
[
"MIT"
] | null | null | null |
#ifndef FRAMESET_H
#define FRAMESET_H
#include "frame.cc"
#include "stream_profile_extractor.cc"
#include "utils.cc"
#include <iostream>
#include <librealsense2/hpp/rs_types.hpp>
#include <napi.h>
using namespace Napi;
class RSFrameSet : public ObjectWrap<RSFrameSet> {
public:
static Object Init(Napi::Env env, Object exports) {
Napi::Function func = DefineClass(
env,
"RSFrameSet",
{
InstanceMethod("destroy", &RSFrameSet::Destroy),
InstanceMethod("getFrame", &RSFrameSet::GetFrame),
InstanceMethod("getSize", &RSFrameSet::GetSize),
InstanceMethod("indexToStream", &RSFrameSet::IndexToStream),
InstanceMethod("indexToStreamIndex", &RSFrameSet::IndexToStreamIndex),
InstanceMethod("replaceFrame", &RSFrameSet::ReplaceFrame),
});
constructor = Napi::Persistent(func);
constructor.SuppressDestruct();
exports.Set("RSFrameSet", func);
return exports;
}
static Object NewInstance(Napi::Env env, rs2_frame* frame) {
EscapableHandleScope scope(env);
Object instance = constructor.New({});
auto unwrapped = ObjectWrap<RSFrameSet>::Unwrap(instance);
unwrapped->SetFrame(frame);
return scope.Escape(napi_value(instance)).ToObject();
}
rs2_frame* GetFrames() {
return frames_;
}
void Replace(rs2_frame* frame) {
DestroyMe();
SetFrame(frame);
}
RSFrameSet(const CallbackInfo& info)
: ObjectWrap<RSFrameSet>(info) {
error_ = nullptr;
frames_ = nullptr;
}
~RSFrameSet() {
DestroyMe();
}
private:
static FunctionReference constructor;
rs2_frame* frames_;
uint32_t frame_count_;
rs2_error* error_;
void SetFrame(rs2_frame* frame) {
if (
!frame
|| (!GetNativeResult<
int>(rs2_is_frame_extendable_to, &error_, frame, RS2_EXTENSION_COMPOSITE_FRAME, &error_)))
return;
frames_ = frame;
frame_count_ = GetNativeResult<int>(rs2_embedded_frames_count, &error_, frame, &error_);
}
void DestroyMe() {
if (error_) rs2_free_error(error_);
error_ = nullptr;
if (frames_) rs2_release_frame(frames_);
frames_ = nullptr;
}
Napi::Value Destroy(const CallbackInfo& info) {
// auto unwrapped = ObjectWrap<RSFrameSet>::Unwrap(info[0].As<Object>());
// if (unwrapped) { unwrapped->DestroyMe(); }
this->DestroyMe();
return info.This();
}
Napi::Value GetFrame(const CallbackInfo& info) {
if (!this->frames_) return info.Env().Undefined();
rs2_stream stream = static_cast<rs2_stream>(info[0].ToNumber().Int32Value());
auto stream_index = info[1].ToNumber().Int32Value();
// if RS2_STREAM_ANY is used, we return the first frame.
if (stream == RS2_STREAM_ANY && this->frame_count_) {
rs2_frame* frame
= GetNativeResult<rs2_frame*>(rs2_extract_frame, &this->error_, this->frames_, 0, &this->error_);
if (!frame) return info.Env().Undefined();
return RSFrame::NewInstance(info.Env(), frame);
}
for (uint32_t i = 0; i < this->frame_count_; i++) {
rs2_frame* frame
= GetNativeResult<rs2_frame*>(rs2_extract_frame, &this->error_, this->frames_, i, &this->error_);
if (!frame) continue;
const rs2_stream_profile* profile = GetNativeResult<
const rs2_stream_profile*>(rs2_get_frame_stream_profile, &this->error_, frame, &this->error_);
if (profile) {
StreamProfileExtractor extrator(profile);
if (
extrator.stream_ == stream && (!stream_index || (stream_index && stream_index == extrator.index_))) {
return RSFrame::NewInstance(info.Env(), frame);
}
}
rs2_release_frame(frame);
}
return info.Env().Undefined();
}
Napi::Value GetSize(const CallbackInfo& info) {
if (this->frames_) { return Number::New(info.Env(), this->frame_count_); }
return Number::New(info.Env(), 0);
}
Napi::Value IndexToStream(const CallbackInfo& info) {
if (!this->frames_) return info.Env().Undefined();
int32_t index = info[0].ToNumber().Int32Value();
rs2_frame* frame
= GetNativeResult<rs2_frame*>(rs2_extract_frame, &this->error_, this->frames_, index, &this->error_);
if (!frame) return info.Env().Undefined();
const rs2_stream_profile* profile = GetNativeResult<
const rs2_stream_profile*>(rs2_get_frame_stream_profile, &this->error_, frame, &this->error_);
if (!profile) {
rs2_release_frame(frame);
return info.Env().Undefined();
}
rs2_stream stream = RS2_STREAM_ANY;
rs2_format format = RS2_FORMAT_ANY;
int32_t fps = 0;
int32_t idx = 0;
int32_t unique_id = 0;
CallNativeFunc(
rs2_get_stream_profile_data, &this->error_, profile, &stream, &format, &idx, &unique_id, &fps, &this->error_);
rs2_release_frame(frame);
if (this->error_) return info.Env().Undefined();
return Number::New(info.Env(), stream);
}
Napi::Value IndexToStreamIndex(const CallbackInfo& info) {
if (!this->frames_) return info.Env().Undefined();
int32_t index = info[0].ToNumber().Int32Value();
rs2_frame* frame
= GetNativeResult<rs2_frame*>(rs2_extract_frame, &this->error_, this->frames_, index, &this->error_);
if (!frame) return info.Env().Undefined();
const rs2_stream_profile* profile = GetNativeResult<
const rs2_stream_profile*>(rs2_get_frame_stream_profile, &this->error_, frame, &this->error_);
if (!profile) {
rs2_release_frame(frame);
return info.Env().Undefined();
}
rs2_stream stream = RS2_STREAM_ANY;
rs2_format format = RS2_FORMAT_ANY;
int32_t fps = 0;
int32_t idx = 0;
int32_t unique_id = 0;
CallNativeFunc(
rs2_get_stream_profile_data, &this->error_, profile, &stream, &format, &idx, &unique_id, &fps, &this->error_);
rs2_release_frame(frame);
if (this->error_) return info.Env().Undefined();
return Number::New(info.Env(), idx);
}
Napi::Value ReplaceFrame(const CallbackInfo& info) {
rs2_stream stream = static_cast<rs2_stream>(info[0].ToNumber().Int32Value());
auto stream_index = info[1].ToNumber().Int32Value();
auto target_frame = ObjectWrap<RSFrame>::Unwrap(info[2].ToObject());
if (!this->frames_) return Boolean::New(info.Env(), false);
for (uint32_t i = 0; i < this->frame_count_; i++) {
rs2_frame* frame
= GetNativeResult<rs2_frame*>(rs2_extract_frame, &this->error_, this->frames_, i, &this->error_);
if (!frame) continue;
const rs2_stream_profile* profile = GetNativeResult<
const rs2_stream_profile*>(rs2_get_frame_stream_profile, &this->error_, frame, &this->error_);
if (profile) {
StreamProfileExtractor extrator(profile);
if (
extrator.stream_ == stream && (!stream_index || (stream_index && stream_index == extrator.index_))) {
target_frame->Replace(frame);
return Boolean::New(info.Env(), true);
}
}
rs2_release_frame(frame);
}
return Boolean::New(info.Env(), false);
}
};
Napi::FunctionReference RSFrameSet::constructor;
#endif
| 30.716895
| 114
| 0.699569
|
alexeden
|
257a2fd0791223044d153300389d80c6b355cb21
| 927
|
cpp
|
C++
|
tests/test_message_builder.cpp
|
pmakaruk/-Network-File-System
|
8fddd7d9c5d850f1e3b621481f21fe378b1e8a21
|
[
"MIT"
] | null | null | null |
tests/test_message_builder.cpp
|
pmakaruk/-Network-File-System
|
8fddd7d9c5d850f1e3b621481f21fe378b1e8a21
|
[
"MIT"
] | null | null | null |
tests/test_message_builder.cpp
|
pmakaruk/-Network-File-System
|
8fddd7d9c5d850f1e3b621481f21fe378b1e8a21
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <sstream>
#include <cassert>
#include "./utils.hpp"
#include "../libraries/core/serializers.hpp"
int main() {
MessageBuilder builder;
builder.writeMessageType(MessageType::CLOSE_REQUEST);
builder.write((u_int8_t)2);
builder.write((int32_t)0x12345678);
builder.write((u_int32_t)0x99999999);
builder.write((u_int64_t)0x1234567890ABCDEF);
char buffer[] = {1, 2, 3, 4, 5};
builder.write(buffer, sizeof(buffer));
std::string str = "abcde";
builder.write(str);
std::vector<u_int8_t> result = builder.build();
std::vector<u_int8_t> expected = std::vector<u_int8_t>{
(u_int8_t) MessageType::CLOSE_REQUEST,
0x00, 0x00, 0x00, 35,
2,
0x12, 0x34, 0x56, 0x78,
0x99, 0x99, 0x99, 0x99,
0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF,
0x00, 0x00, 0x00, 5, 1, 2, 3, 4, 5,
0x00, 0x00, 0x00, 5, 'a', 'b', 'c', 'd', 'e'
};
assert(result == expected);
}
| 26.485714
| 57
| 0.655879
|
pmakaruk
|
257ab07332ad18085d7c029ff8e302892107b215
| 7,730
|
cpp
|
C++
|
liblineside/test/boparraymashdatatests.cpp
|
freesurfer-rge/linesidecabinet
|
8944c67fa7d340aa792e3a6e681113a4676bfbad
|
[
"MIT"
] | null | null | null |
liblineside/test/boparraymashdatatests.cpp
|
freesurfer-rge/linesidecabinet
|
8944c67fa7d340aa792e3a6e681113a4676bfbad
|
[
"MIT"
] | 14
|
2019-11-17T14:46:25.000Z
|
2021-03-10T02:48:40.000Z
|
liblineside/test/boparraymashdatatests.cpp
|
freesurfer-rge/linesidecabinet
|
8944c67fa7d340aa792e3a6e681113a4676bfbad
|
[
"MIT"
] | null | null | null |
#include <boost/test/unit_test.hpp>
#include "lineside/boparraymashdata.hpp"
#include "lineside/boparraymash.hpp"
#include "lineside/linesideexceptions.hpp"
#include "exceptionmessagecheck.hpp"
#include "mockmanagerfixture.hpp"
BOOST_AUTO_TEST_SUITE(BOPArrayMASHData)
// ---------------
BOOST_AUTO_TEST_SUITE(ExtractAspects)
BOOST_AUTO_TEST_CASE(TwoAspect)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 16;
mashd.settings["Green"] = "0";
mashd.settings["Red"] = "1";
mashd.settings["Feather1"] = "2";
auto result = mashd.ExtractAspects();
BOOST_REQUIRE_EQUAL( result.size(), 2 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Red), 1 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Green), 0 );
}
BOOST_AUTO_TEST_CASE(ThreeAspect)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 19;
mashd.settings["Green"] = "0";
mashd.settings["Yellow1"] = "3";
mashd.settings["Red"] = "1";
mashd.settings["Feather1"] = "2";
auto result = mashd.ExtractAspects();
BOOST_REQUIRE_EQUAL( result.size(), 3 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Red), 1 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Green), 0 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Yellow1), 3 );
}
BOOST_AUTO_TEST_CASE(FourAspect)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 19;
mashd.settings["Green"] = "4";
mashd.settings["Yellow1"] = "3";
mashd.settings["Yellow2"] = "2";
mashd.settings["Red"] = "1";
mashd.settings["Feather1"] = "0";
auto result = mashd.ExtractAspects();
BOOST_REQUIRE_EQUAL( result.size(), 4 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Red), 1);
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Green), 4 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Yellow1), 3 );
BOOST_CHECK_EQUAL( result.at(Lineside::SignalAspect::Yellow2), 2 );
}
BOOST_AUTO_TEST_CASE(NoRedAspect)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 16;
mashd.settings["Green"] = "0";
std::string msg = "Configuration problem for 00:00:00:10 - Red aspect missing";
BOOST_CHECK_EXCEPTION( mashd.ExtractAspects(),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_CASE(NoGreenAspect)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 17;
mashd.settings["Red"] = "0";
std::string msg = "Configuration problem for 00:00:00:11 - Green aspect missing";
BOOST_CHECK_EXCEPTION( mashd.ExtractAspects(),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_CASE(Yellow2AspectButNoYellow1)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 35;
mashd.settings["Red"] = "0";
mashd.settings["Green"] = "2";
mashd.settings["Yellow2"] = "1";
std::string msg = "Configuration problem for 00:00:00:23 - Have Yellow2 aspect but no Yellow1";
BOOST_CHECK_EXCEPTION( mashd.ExtractAspects(),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_SUITE_END()
// ---------------
BOOST_AUTO_TEST_SUITE(ExtractFeathers)
BOOST_AUTO_TEST_CASE(NoFeathers)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "0";
mashd.settings["Green"] = "2";
auto result = mashd.ExtractFeathers();
BOOST_CHECK_EQUAL( result.size(), 1 );
}
BOOST_AUTO_TEST_CASE(OneFeather)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "0";
mashd.settings["Green"] = "1";
mashd.settings["Feather1"] = "2";
auto result = mashd.ExtractFeathers();
BOOST_REQUIRE_EQUAL( result.size(), 2 );
BOOST_CHECK_EQUAL( result.at(1), 2 );
}
BOOST_AUTO_TEST_CASE(TwoFeathers)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "1";
mashd.settings["Feather1"] = "0";
mashd.settings["Feather2"] = "3";
auto result = mashd.ExtractFeathers();
BOOST_REQUIRE_EQUAL( result.size(), 3 );
BOOST_CHECK_EQUAL( result.at(1), 0 );
BOOST_CHECK_EQUAL( result.at(2), 3 );
}
BOOST_AUTO_TEST_CASE(FeathersZeroDefined)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "0";
mashd.settings["Green"] = "2";
mashd.settings["Feather0"] = "1";
std::string msg = "Configuration problem for 00:00:00:ff - Feather '0' defined";
BOOST_CHECK_EXCEPTION( mashd.ExtractFeathers(),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>( msg ) );
}
BOOST_AUTO_TEST_CASE(FeathersNonSequential)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "1";
mashd.settings["Feather2"] = "0";
std::string msg = "Configuration problem for 00:00:00:ff - Feathers are not sequential from one";
BOOST_CHECK_EXCEPTION( mashd.ExtractFeathers(),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>( msg ) );
}
BOOST_AUTO_TEST_SUITE_END()
// ---------------
BOOST_FIXTURE_TEST_SUITE(Construct, MockManagerFixture)
BOOST_AUTO_TEST_CASE(Smoke)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "1";
mashd.settings["Feather1"] = "0";
mashd.bopArrayRequest.providerName = "MockBOPArray";
mashd.bopArrayRequest.settings["0"] = "18";
mashd.bopArrayRequest.settings["1"] = "19";
mashd.bopArrayRequest.settings["2"] = "26";
auto result = mashd.Construct(*(this->hwManager), *(this->swManager));
BOOST_REQUIRE(result);
auto bopArrayMash = std::dynamic_pointer_cast<Lineside::BOPArrayMASH>(result);
BOOST_CHECK( bopArrayMash );
}
BOOST_AUTO_TEST_CASE(AspectFeatherBOPArraySizeMismatch)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "1";
mashd.settings["Feather1"] = "0";
mashd.bopArrayRequest.settings["0"] = "18";
mashd.bopArrayRequest.settings["1"] = "19";
std::string msg = "Configuration problem for 00:00:00:ff - Number of feathers and aspects does not match BOPArray size";
BOOST_CHECK_EXCEPTION( mashd.Construct(*(this->hwManager), *(this->swManager)),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_CASE(DuplicatePinRequest)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "1";
mashd.settings["Feather1"] = "1";
mashd.bopArrayRequest.settings["0"] = "18";
mashd.bopArrayRequest.settings["1"] = "19";
mashd.bopArrayRequest.settings["2"] = "26";
std::string msg = "Configuration problem for 00:00:00:ff - At least one pin in BOPArray requested twice";
BOOST_CHECK_EXCEPTION( mashd.Construct(*(this->hwManager), *(this->swManager)),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_CASE(PinsNotSequential)
{
Lineside::BOPArrayMASHData mashd;
mashd.id = 255;
mashd.settings["Red"] = "2";
mashd.settings["Green"] = "3";
mashd.settings["Feather1"] = "0";
mashd.bopArrayRequest.settings["0"] = "18";
mashd.bopArrayRequest.settings["1"] = "19";
mashd.bopArrayRequest.settings["2"] = "26";
std::string msg = "Configuration problem for 00:00:00:ff - BOPArray pin requests not sequential from zero";
BOOST_CHECK_EXCEPTION( mashd.Construct(*(this->hwManager), *(this->swManager)),
Lineside::BadPWItemDataException,
GetExceptionMessageChecker<Lineside::BadPWItemDataException>(msg) );
}
BOOST_AUTO_TEST_SUITE_END()
// ---------------
BOOST_AUTO_TEST_SUITE_END()
| 28.419118
| 122
| 0.713454
|
freesurfer-rge
|
257ea34d17379a52fafdae8621743f031af0493d
| 148
|
cpp
|
C++
|
src/Window.cpp
|
HadesD/vim-power-mode
|
b3d701545fec08c329d54441d22e8f9b92ebb4cf
|
[
"MIT"
] | 8
|
2018-07-01T12:18:42.000Z
|
2022-01-30T01:59:31.000Z
|
src/Window.cpp
|
HadesD/vim-power-mode
|
b3d701545fec08c329d54441d22e8f9b92ebb4cf
|
[
"MIT"
] | 1
|
2018-07-01T16:50:47.000Z
|
2018-07-02T13:15:39.000Z
|
src/Window.cpp
|
HadesD/vim-power-mode
|
b3d701545fec08c329d54441d22e8f9b92ebb4cf
|
[
"MIT"
] | null | null | null |
#include "vpm/Window.hpp"
namespace VPM
{
bool Window::m_isClosed = false;
bool Window::getIsClosed() const
{
return m_isClosed;
}
}
| 11.384615
| 34
| 0.662162
|
HadesD
|
25844dd5c6a48e2c123a7deb672348f2eff8bb93
| 1,543
|
hpp
|
C++
|
src/WebVizConstants.hpp
|
UTNuclearRobotics/robofleet_client
|
36f0cd0d38f174ac29254e13ac058dcfcafd15ce
|
[
"MIT"
] | null | null | null |
src/WebVizConstants.hpp
|
UTNuclearRobotics/robofleet_client
|
36f0cd0d38f174ac29254e13ac058dcfcafd15ce
|
[
"MIT"
] | 1
|
2022-01-26T17:59:54.000Z
|
2022-01-26T17:59:54.000Z
|
src/WebVizConstants.hpp
|
UTNuclearRobotics/robofleet_client
|
36f0cd0d38f174ac29254e13ac058dcfcafd15ce
|
[
"MIT"
] | null | null | null |
#include <string>
/**
* These constants are topic names with special significance to the web
* visualizer.
*
*/
namespace webviz_constants {
/**
* @brief (amrl_msgs/RobofleetStatus) Robofleet status information for listing
* robot in webviz overview.
*/
static const std::string status_topic = "status";
/**
* @brief (amrl_msgs/RobofleetSubscription) Robofleet subscriptions topic; for
* managing your own subscriptions.
*
* Note that this is a single, global topic, which is not namespaced for each
* robot.
*/
static const std::string subscriptions_topic = "/subscriptions";
/**
* @brief (amrl_msgs/Localization2DMsg) Current robot localization
*/
static const std::string localization_topic = "localization";
/**
* @brief (nav_msgs/Odometry) Current robot odometry
*/
static const std::string odometry_topic = "odometry/raw";
/**
* @brief (sensor_msgs/LaserScan) LIDAR scan data
*/
static const std::string lidar_2d_topic = "velodyne_2dscan";
/**
* @brief (sensor_msgs/CompressedImage) prefix for a Compressed Image from a
* stereo camera.
*/
static const std::string compressed_image_prefix = "image_compressed/";
/**
* @brief (sensor_msgs/PointCloud2) 3D point cloud
*/
static const std::string point_cloud_topic = "pointcloud";
/**
* @brief (amrl_msgs/VisualizationMsg) Visualization data
*/
static const std::string visualization_topic = "visualization";
/**
* @brief (sensor_msgs/PointCloud2) 3D point cloud
*/
static const std::string detected_topic = "detected";
} // namespace webviz_constants
| 25.716667
| 78
| 0.73882
|
UTNuclearRobotics
|
258579fc67f3a1ba684e9e943e1a4d05970da572
| 1,480
|
cpp
|
C++
|
dlls/ulkata.cpp
|
Laluka256/halflife-planckepoch
|
3ccfd783213c3ee88b9ed8204acdce01d40d5420
|
[
"Unlicense"
] | 1
|
2021-12-16T19:29:18.000Z
|
2021-12-16T19:29:18.000Z
|
dlls/ulkata.cpp
|
Laluka256/halflife-planckepoch
|
3ccfd783213c3ee88b9ed8204acdce01d40d5420
|
[
"Unlicense"
] | 1
|
2021-11-29T18:04:51.000Z
|
2021-11-29T18:04:51.000Z
|
dlls/ulkata.cpp
|
Laluka256/halflife-planckepoch
|
3ccfd783213c3ee88b9ed8204acdce01d40d5420
|
[
"Unlicense"
] | null | null | null |
#include "CBarney.h"
class CUlkata : public CBarney
{
void Spawn();
void Precache();
int Classify();
};
LINK_ENTITY_TO_CLASS(monster_ulkata, CUlkata);
void CUlkata::Spawn()
{
Precache();
SET_MODEL(ENT(pev), "models/ulkata.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
pev->health = gSkillData.barneyHealth;
pev->view_ofs = Vector(0, 0, 50);// position of the eyes relative to monster's origin.
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
m_MonsterState = MONSTERSTATE_NONE;
pev->body = 0; // gun in holster
m_fGunDrawn = FALSE;
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP;
PainSound();
MonsterInit();
SetUse(&CUlkata::FollowerUse);
}
void CUlkata::Precache()
{
PRECACHE_MODEL("models/ulkata.mdl");
PRECACHE_SOUND("barney/ba_attack1.wav");
PRECACHE_SOUND("barney/ba_attack2.wav");
PRECACHE_SOUND("barney/ba_pain1.wav");
PRECACHE_SOUND("barney/ba_pain2.wav");
PRECACHE_SOUND("barney/ba_pain3.wav");
PRECACHE_SOUND("barney/ba_die1.wav");
PRECACHE_SOUND("barney/ba_die2.wav");
PRECACHE_SOUND("barney/ba_die3.wav");
// every new barney must call this, otherwise
// when a level is loaded, nobody will talk (time is reset to 0)
TalkInit();
CTalkMonster::Precache();
}
int CUlkata::Classify()
{
return CLASS_HUMAN_MILITARY;
}
| 23.125
| 113
| 0.741892
|
Laluka256
|
2586974c2338a596603666d4ad6c31a6479d3cfd
| 3,190
|
cc
|
C++
|
P2/src/bbseq.cc
|
romanarranz/PPR
|
6e5073cabbc084d07972afe45c2983e20082f1fa
|
[
"MIT"
] | 3
|
2018-03-09T09:54:57.000Z
|
2021-08-22T02:46:35.000Z
|
P2/src/bbseq.cc
|
romanarranz/PPR
|
6e5073cabbc084d07972afe45c2983e20082f1fa
|
[
"MIT"
] | 7
|
2016-04-23T19:43:40.000Z
|
2016-06-03T08:13:29.000Z
|
P2/src/bbseq.cc
|
romanarranz/PPR
|
6e5073cabbc084d07972afe45c2983e20082f1fa
|
[
"MIT"
] | 1
|
2021-08-08T03:13:32.000Z
|
2021-08-08T03:13:32.000Z
|
/* ******************************************************************** */
/* Algoritmo Branch-And-Bound Secuencial */
/* ******************************************************************** */
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <string.h>
#include <mpi.h>
#include "libbb.h"
using namespace std;
unsigned int NCIUDADES;
void guardarArchivo(string outputFile, int n, double t)
{
ofstream archivo (outputFile, ios_base::app | ios_base::out);
if (archivo.is_open()){
archivo << to_string(n) + "\t" + to_string(t) + "\n";
archivo.close();
}
else
cout << "No se puede abrir el archivo";
}
int main (int argc, char **argv) {
MPI::Init(argc,argv);
switch (argc) {
case 3:
NCIUDADES = atoi(argv[1]);
break;
default:
cerr << "La sintaxis es: bbseq <tamano> <archivo>" << endl;
exit(1);
break;
}
int ** tsp0 = reservarMatrizCuadrada(NCIUDADES);
tNodo nodo, // nodo a explorar
lnodo, // hijo izquierdo
rnodo, // hijo derecho
solucion; // mejor solucion
bool activo, // condicion de fin
nueva_U; // hay nuevo valor de c.s.
int U; // valor de c.s.
int iteraciones = 0;
tPila pila; // pila de nodos a explorar
U = INFINITO; // inicializa cota superior
InicNodo (&nodo); // inicializa estructura nodo
LeerMatriz (argv[2], tsp0); // lee matriz de fichero
activo = !Inconsistente(tsp0);
double t=MPI::Wtime();
// ciclo del Branch&Bound
while (activo) {
Ramifica (&nodo, &lnodo, &rnodo, tsp0);
nueva_U = false;
if (Solucion(&rnodo)) {
// se ha encontrado una solucion mejor
if (rnodo.ci() < U) {
U = rnodo.ci();
nueva_U = true;
CopiaNodo (&rnodo, &solucion);
}
}
// no es un nodo solucion
else {
// cota inferior menor que cota superior
if (rnodo.ci() < U) {
if (!pila.push(rnodo)) {
printf ("Error: pila agotada\n");
liberarMatriz(tsp0);
exit (1);
}
}
}
if (Solucion(&lnodo)) {
// se ha encontrado una solucion mejor
if (lnodo.ci() < U) {
U = lnodo.ci();
nueva_U = true;
CopiaNodo (&lnodo,&solucion);
}
}
// no es nodo solucion
else {
// cota inferior menor que cota superior
if (lnodo.ci() < U) {
if (!pila.push(lnodo)) {
printf ("Error: pila agotada\n");
liberarMatriz(tsp0);
exit (1);
}
}
}
if (nueva_U) pila.acotar(U);
activo = pila.pop(nodo);
iteraciones++;
}
t = MPI::Wtime()-t;
MPI::Finalize();
printf ("Solucion: \n");
EscribeNodo(&solucion);
cout<< "Tiempo gastado = " << t << endl;
cout << "Numero de iteraciones = " << iteraciones << endl << endl;
double tNodoExplorado = t/iteraciones;
cout << "Tiempo medio por nodo explorado = " << tNodoExplorado << endl;
guardarArchivo("output/tspS.dat", atoi(argv[1]), t);
guardarArchivo("output/tspSNodos.dat", atoi(argv[1]), tNodoExplorado);
liberarMatriz(tsp0);
}
| 23.80597
| 76
| 0.532602
|
romanarranz
|
2586f4a0c4c6794bbcf64c3236ec408605e6c6a0
| 15,878
|
cxx
|
C++
|
PWMTest/PWMTest.cxx
|
RobertPHeller/RPi-RRCircuits
|
19aff23e20eebdbd028c0407d68eef77cc6ee0ec
|
[
"CC-BY-4.0"
] | 10
|
2018-09-04T02:12:39.000Z
|
2022-03-17T20:29:32.000Z
|
PWMTest/PWMTest.cxx
|
RobertPHeller/RPi-RRCircuits
|
19aff23e20eebdbd028c0407d68eef77cc6ee0ec
|
[
"CC-BY-4.0"
] | null | null | null |
PWMTest/PWMTest.cxx
|
RobertPHeller/RPi-RRCircuits
|
19aff23e20eebdbd028c0407d68eef77cc6ee0ec
|
[
"CC-BY-4.0"
] | 1
|
2018-12-26T00:32:27.000Z
|
2018-12-26T00:32:27.000Z
|
// -!- C++ -!- //////////////////////////////////////////////////////////////
//
// System :
// Module :
// Object Name : $RCSfile$
// Revision : $Revision$
// Date : $Date$
// Author : $Author$
// Created By : Robert Heller
// Created : Sun Feb 17 15:35:50 2019
// Last Modified : <190219.1354>
//
// Description
//
// Notes
//
// History
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019 Robert Heller D/B/A Deepwoods Software
// 51 Locke Hill Road
// Wendell, MA 01379-9728
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
//
//////////////////////////////////////////////////////////////////////////////
static const char rcsid[] = "@(#) : $Id$";
#include "PWMTest.hxx"
#include "utils/ConfigUpdateListener.hxx"
#include "utils/ConfigUpdateService.hxx"
#include "openlcb/EventService.hxx"
ConfigUpdateListener::UpdateAction ConfiguredPWMConsumer::apply_configuration(int fd,
bool initial_load,
BarrierNotifiable *done)
{
AutoNotify n(done);
openlcb::EventId cfg_pwm_zero_event = config.event_pwm_zero().read(fd);
openlcb::EventId cfg_pwm_one_event = config.event_pwm_one().read(fd);
openlcb::EventId cfg_pwm_two_event = config.event_pwm_two().read(fd);
openlcb::EventId cfg_pwm_three_event = config.event_pwm_three().read(fd);
openlcb::EventId cfg_pwm_four_event = config.event_pwm_four().read(fd);
openlcb::EventId cfg_pwm_five_event = config.event_pwm_five().read(fd);
openlcb::EventId cfg_pwm_six_event = config.event_pwm_six().read(fd);
openlcb::EventId cfg_pwm_seven_event = config.event_pwm_seven().read(fd);
openlcb::EventId cfg_pwm_eight_event = config.event_pwm_eight().read(fd);
openlcb::EventId cfg_pwm_nine_event = config.event_pwm_nine().read(fd);
openlcb::EventId cfg_pwm_ten_event = config.event_pwm_ten().read(fd);
period = config.pwm_period().read(fd);
pwm_->set_period(period);
zero_duty = config.pwm_zero().read(fd);
one_duty = config.pwm_one().read(fd);
two_duty = config.pwm_two().read(fd);
three_duty = config.pwm_three().read(fd);
four_duty = config.pwm_four().read(fd);
five_duty = config.pwm_five().read(fd);
six_duty = config.pwm_six().read(fd);
seven_duty = config.pwm_seven().read(fd);
eight_duty = config.pwm_eight().read(fd);
nine_duty = config.pwm_nine().read(fd);
ten_duty = config.pwm_ten().read(fd);
if (cfg_pwm_zero_event != pwm_zero_event ||
cfg_pwm_one_event != pwm_one_event ||
cfg_pwm_two_event != pwm_two_event ||
cfg_pwm_three_event != pwm_three_event ||
cfg_pwm_four_event != pwm_four_event ||
cfg_pwm_five_event != pwm_five_event ||
cfg_pwm_six_event != pwm_six_event ||
cfg_pwm_seven_event != pwm_seven_event ||
cfg_pwm_eight_event != pwm_eight_event ||
cfg_pwm_nine_event != pwm_nine_event ||
cfg_pwm_ten_event != pwm_ten_event) {
if (!initial_load) unregister_handler();
pwm_zero_event = cfg_pwm_zero_event;
pwm_one_event = cfg_pwm_one_event;
pwm_two_event = cfg_pwm_two_event;
pwm_three_event = cfg_pwm_three_event;
pwm_four_event = cfg_pwm_four_event;
pwm_five_event = cfg_pwm_five_event;
pwm_six_event = cfg_pwm_six_event;
pwm_seven_event = cfg_pwm_seven_event;
pwm_eight_event = cfg_pwm_eight_event;
pwm_nine_event = cfg_pwm_nine_event;
pwm_ten_event = cfg_pwm_ten_event;
register_handler();
return REINIT_NEEDED; // Causes events identify.
}
return UPDATED;
}
void ConfiguredPWMConsumer::factory_reset(int fd)
{
config.description().write(fd,"");
CDI_FACTORY_RESET(config.pwm_period);
CDI_FACTORY_RESET(config.pwm_zero);
CDI_FACTORY_RESET(config.pwm_one);
CDI_FACTORY_RESET(config.pwm_two);
CDI_FACTORY_RESET(config.pwm_three);
CDI_FACTORY_RESET(config.pwm_four);
CDI_FACTORY_RESET(config.pwm_five);
CDI_FACTORY_RESET(config.pwm_six);
CDI_FACTORY_RESET(config.pwm_seven);
CDI_FACTORY_RESET(config.pwm_eight);
CDI_FACTORY_RESET(config.pwm_nine);
CDI_FACTORY_RESET(config.pwm_ten);
}
void ConfiguredPWMConsumer::handle_event_report(const EventRegistryEntry &entry,
EventReport *event,
BarrierNotifiable *done)
{
if (event->event == pwm_zero_event) {
pwm_->set_duty(zero_duty);
} else if (event->event == pwm_one_event) {
pwm_->set_duty(one_duty);
} else if (event->event == pwm_two_event) {
pwm_->set_duty(two_duty);
} else if (event->event == pwm_three_event) {
pwm_->set_duty(three_duty);
} else if (event->event == pwm_four_event) {
pwm_->set_duty(four_duty);
} else if (event->event == pwm_five_event) {
pwm_->set_duty(five_duty);
} else if (event->event == pwm_six_event) {
pwm_->set_duty(six_duty);
} else if (event->event == pwm_seven_event) {
pwm_->set_duty(seven_duty);
} else if (event->event == pwm_eight_event) {
pwm_->set_duty(eight_duty);
} else if (event->event == pwm_nine_event) {
pwm_->set_duty(nine_duty);
} else if (event->event == pwm_ten_event) {
pwm_->set_duty(ten_duty);
}
done->notify();
}
void ConfiguredPWMConsumer::handle_identify_global(const EventRegistryEntry
®istry_entry,
EventReport *event,
BarrierNotifiable *done)
{
if (event->dst_node && event->dst_node != node_)
{
done->notify();
}
SendAllConsumersIdentified(event,done);
done->maybe_done();
}
void ConfiguredPWMConsumer::SendAllConsumersIdentified(openlcb::EventReport* event, BarrierNotifiable* done)
{
openlcb::Defs::MTI mti_zero = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_one = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_two = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_three = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_four = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_five = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_six = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_seven = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_eight = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_nine = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID,
mti_ten = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID;
uint32_t current_duty_cycle = /* pwm_->get_duty() */ 0;
if (current_duty_cycle == zero_duty) {
mti_zero = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == one_duty) {
mti_one = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == two_duty) {
mti_two = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == three_duty) {
mti_three = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == four_duty) {
mti_four = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == five_duty) {
mti_five = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == six_duty) {
mti_six = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == seven_duty) {
mti_seven = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == eight_duty) {
mti_eight = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == nine_duty) {
mti_nine = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (current_duty_cycle == ten_duty) {
mti_ten = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
}
write_helpers[0].WriteAsync(node_,mti_zero,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_zero_event),
done->new_child());
write_helpers[1].WriteAsync(node_,mti_one,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_one_event),
done->new_child());
write_helpers[2].WriteAsync(node_,mti_two,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_two_event),
done->new_child());
write_helpers[3].WriteAsync(node_,mti_three,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_three_event),
done->new_child());
write_helpers[4].WriteAsync(node_,mti_four,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_four_event),
done->new_child());
write_helpers[5].WriteAsync(node_,mti_five,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_five_event),
done->new_child());
write_helpers[6].WriteAsync(node_,mti_six,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_six_event),
done->new_child());
write_helpers[7].WriteAsync(node_,mti_seven,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_seven_event),
done->new_child());
write_helpers[8].WriteAsync(node_,mti_eight,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_eight_event),
done->new_child());
write_helpers[9].WriteAsync(node_,mti_nine,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_nine_event),
done->new_child());
write_helpers[10].WriteAsync(node_,mti_ten,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(pwm_ten_event),
done->new_child());
}
void ConfiguredPWMConsumer::handle_identify_consumer(const EventRegistryEntry
®istry_entry,
EventReport *event,
BarrierNotifiable *done)
{
SendConsumerIdentified(event,done);
done->maybe_done();
}
void ConfiguredPWMConsumer::SendConsumerIdentified(openlcb::EventReport* event, BarrierNotifiable* done)
{
openlcb::Defs::MTI mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_INVALID;
uint32_t current_duty_cycle = /* pwm_->get_duty() */ 0;
if (event->event == pwm_zero_event &&
current_duty_cycle == zero_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_one_event &&
current_duty_cycle == one_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_two_event &&
current_duty_cycle == two_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_three_event &&
current_duty_cycle == three_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_four_event &&
current_duty_cycle == four_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_five_event &&
current_duty_cycle == five_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_six_event &&
current_duty_cycle == six_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_seven_event &&
current_duty_cycle == seven_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_eight_event &&
current_duty_cycle == eight_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_nine_event &&
current_duty_cycle == nine_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else if (event->event == pwm_ten_event &&
current_duty_cycle == ten_duty) {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_VALID;
} else {
mti = openlcb::Defs::MTI_CONSUMER_IDENTIFIED_UNKNOWN;
}
event->event_write_helper<1>()->WriteAsync(node_, mti,
openlcb::WriteHelper::global(),
openlcb::eventid_to_buffer(event->event),
done->new_child());
}
void ConfiguredPWMConsumer::register_handler()
{
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_zero_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_one_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_two_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_three_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_four_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_five_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_six_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_seven_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_eight_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_nine_event),0);
openlcb::EventRegistry::instance()->register_handler(
openlcb::EventRegistryEntry(this,pwm_ten_event),0);
}
void ConfiguredPWMConsumer::unregister_handler()
{
openlcb::EventRegistry::instance()->unregister_handler(this);
}
| 46.7
| 108
| 0.609963
|
RobertPHeller
|
2588ecbf5ba8af9b5faadfeb107428a9334ae03a
| 4,036
|
cpp
|
C++
|
hardware/digistump/avr/libraries/LPD8806/LPD8806.cpp
|
emptyland/arduino
|
278cf1189401ba2bcb2d4125e42ac338c20ee4c8
|
[
"BSD-3-Clause"
] | 1
|
2021-04-10T10:01:06.000Z
|
2021-04-10T10:01:06.000Z
|
hardware/digistump/avr/libraries/LPD8806/LPD8806.cpp
|
emptyland/arduino
|
278cf1189401ba2bcb2d4125e42ac338c20ee4c8
|
[
"BSD-3-Clause"
] | 6
|
2020-06-04T06:04:39.000Z
|
2021-05-02T17:09:15.000Z
|
arduino/portable/packages/digistump/hardware/avr/1.6.7/libraries/LPD8806/LPD8806.cpp
|
darrintw/ardublockly-tw
|
b9c29bbe52c77a7bec14ae69a5a7365c9e4ab86e
|
[
"Apache-2.0"
] | 3
|
2021-04-10T10:01:08.000Z
|
2021-09-02T00:14:31.000Z
|
#include "LPD8806.h"
// Arduino library to control LPD8806-based RGB LED Strips
// (c) Adafruit industries
// MIT license
/*****************************************************************************/
// Constructor for use with arbitrary clock/data pins:
LPD8806::LPD8806(uint16_t n, uint8_t dpin, uint8_t cpin) {
pixels = NULL;
begun = false;
updateLength(n);
updatePins(dpin, cpin);
}
// Activate hard/soft SPI as appropriate:
void LPD8806::begin(void) {
startBitbang();
begun = true;
}
// Change pin assignments post-constructor, using arbitrary pins:
void LPD8806::updatePins(uint8_t dpin, uint8_t cpin) {
datapin = dpin;
clkpin = cpin;
clkport = portOutputRegister(digitalPinToPort(cpin));
clkpinmask = digitalPinToBitMask(cpin);
dataport = portOutputRegister(digitalPinToPort(dpin));
datapinmask = digitalPinToBitMask(dpin);
if(begun == true) { // If begin() was previously invoked...
startBitbang(); // Regardless, now enable 'soft' SPI outputs
} // Otherwise, pins are not set to outputs until begin() is called.
// Note: any prior clock/data pin directions are left as-is and are
// NOT restored as inputs!
hardwareSPI = false;
}
// Enable software SPI pins and issue initial latch:
void LPD8806::startBitbang() {
pinMode(datapin, OUTPUT);
pinMode(clkpin , OUTPUT);
*dataport &= ~datapinmask; // Data is held low throughout (latch = 0)
for(uint8_t i = 8; i>0; i--) {
*clkport |= clkpinmask;
*clkport &= ~clkpinmask;
}
}
// Change strip length (see notes with empty constructor, above):
void LPD8806::updateLength(uint16_t n) {
if(pixels != NULL) free(pixels); // Free existing data (if any)
numLEDs = n;
n *= 3; // 3 bytes per pixel
if(NULL != (pixels = (uint8_t *)malloc(n + 1))) { // Alloc new data
memset(pixels, 0x80, n); // Init to RGB 'off' state
pixels[n] = 0; // Last byte is always zero for latch
} else numLEDs = 0; // else malloc failed
// 'begun' state does not change -- pins retain prior modes
}
uint16_t LPD8806::numPixels(void) {
return numLEDs;
}
// This is how data is pushed to the strip. Unfortunately, the company
// that makes the chip didnt release the protocol document or you need
// to sign an NDA or something stupid like that, but we reverse engineered
// this from a strip controller and it seems to work very nicely!
void LPD8806::show(void) {
uint16_t i, n3 = numLEDs * 3 + 1; // 3 bytes per LED + 1 for latch
// write 24 bits per pixel
for (i=0; i<n3; i++ ) {
for (uint8_t bit=0x80; bit; bit >>= 1) {
if(pixels[i] & bit) *dataport |= datapinmask;
else *dataport &= ~datapinmask;
*clkport |= clkpinmask;
*clkport &= ~clkpinmask;
}
}
}
// Convert separate R,G,B into combined 32-bit GRB color:
uint32_t LPD8806::Color(byte r, byte g, byte b) {
return 0x808080 | ((uint32_t)g << 16) | ((uint32_t)r << 8) | (uint32_t)b;
}
// Set pixel color from separate 7-bit R, G, B components:
void LPD8806::setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
if(n < numLEDs) { // Arrays are 0-indexed, thus NOT '<='
uint8_t *p = &pixels[n * 3];
*p++ = g | 0x80; // LPD8806 color order is GRB,
*p++ = r | 0x80; // not the more common RGB,
*p++ = b | 0x80; // so the order here is intentional; don't "fix"
}
}
// Set pixel color from 'packed' 32-bit RGB value:
void LPD8806::setPixelColor(uint16_t n, uint32_t c) {
if(n < numLEDs) { // Arrays are 0-indexed, thus NOT '<='
uint8_t *p = &pixels[n * 3];
*p++ = (c >> 16) | 0x80;
*p++ = (c >> 8) | 0x80;
*p++ = c | 0x80;
}
}
// Query color from previously-set pixel (returns packed 32-bit GRB value)
uint32_t LPD8806::getPixelColor(uint16_t n) {
if(n < numLEDs) {
uint16_t ofs = n * 3;
return ((uint32_t)((uint32_t)pixels[ofs ] << 16) |
(uint32_t)((uint32_t)pixels[ofs + 1] << 8) |
(uint32_t)pixels[ofs + 2]) & 0x7f7f7f;
}
return 0; // Pixel # is out of bounds
}
| 32.288
| 79
| 0.625867
|
emptyland
|
258932e9f96ae85ee617f4c40c1f163bf0a461e9
| 353
|
cpp
|
C++
|
0812_largest_triangle_area.cpp
|
fxshan/LeetCode
|
a54bbe22bc335dcb3c7efffcc34357cab7641492
|
[
"Apache-2.0"
] | 2
|
2020-06-04T13:20:20.000Z
|
2020-06-04T14:49:10.000Z
|
0812_largest_triangle_area.cpp
|
fxshan/LeetCode
|
a54bbe22bc335dcb3c7efffcc34357cab7641492
|
[
"Apache-2.0"
] | null | null | null |
0812_largest_triangle_area.cpp
|
fxshan/LeetCode
|
a54bbe22bc335dcb3c7efffcc34357cab7641492
|
[
"Apache-2.0"
] | null | null | null |
class Solution {
public:
double largestTriangleArea(vector<vector<int>>& points) {
double res = 0;
for (vector i : points)
for (vector j : points)
for (vector k : points)
res = max(res, 0.5 * (i[0] * (j[1] - k[1]) + j[0] * (k[1] - i[1]) +
k[0] * (i[1] - j[1])));
return res;
}
};
| 27.153846
| 77
| 0.456091
|
fxshan
|
258aaeff7d847467639165d02ba07830f5290c63
| 861
|
hpp
|
C++
|
drape_frontend/read_mwm_task.hpp
|
kudlav/organicmaps
|
390236365749e0525b9229684132c2888d11369d
|
[
"Apache-2.0"
] | 4,879
|
2015-09-30T10:56:36.000Z
|
2022-03-31T18:43:03.000Z
|
drape_frontend/read_mwm_task.hpp
|
mbrukman/omim
|
d22fe2b6e0beee697f096e931df97a64f9db9dc1
|
[
"Apache-2.0"
] | 7,549
|
2015-09-30T10:52:53.000Z
|
2022-03-31T22:04:22.000Z
|
drape_frontend/read_mwm_task.hpp
|
mbrukman/omim
|
d22fe2b6e0beee697f096e931df97a64f9db9dc1
|
[
"Apache-2.0"
] | 1,493
|
2015-09-30T10:43:06.000Z
|
2022-03-21T09:16:49.000Z
|
#pragma once
#include "drape_frontend/tile_info.hpp"
#include "base/thread.hpp"
#include <memory>
namespace df
{
class ReadMWMTask : public threads::IRoutine
{
public:
explicit ReadMWMTask(MapDataProvider & model);
void Do() override;
void Init(std::shared_ptr<TileInfo> const & tileInfo);
void Reset() override;
bool IsCancelled() const override;
TileKey const & GetTileKey() const { return m_tileKey; }
private:
std::weak_ptr<TileInfo> m_tileInfo;
TileKey m_tileKey;
MapDataProvider & m_model;
#ifdef DEBUG
bool m_checker;
#endif
};
class ReadMWMTaskFactory
{
public:
explicit ReadMWMTaskFactory(MapDataProvider & model)
: m_model(model)
{}
// Caller must handle object life cycle.
ReadMWMTask * GetNew() const
{
return new ReadMWMTask(m_model);
}
private:
MapDataProvider & m_model;
};
} // namespace df
| 17.22
| 58
| 0.721254
|
kudlav
|
258f0019f7566eaf98860fb8aa6a8a20a2223140
| 529
|
hpp
|
C++
|
Siv3D/include/Siv3D/FileAction.hpp
|
emadurandal/OpenSiv3D
|
2c7a77526be7bb8669a223066210337d74bdc9c6
|
[
"MIT"
] | 709
|
2016-03-19T07:55:58.000Z
|
2022-03-31T08:02:22.000Z
|
Siv3D/include/Siv3D/FileAction.hpp
|
emadurandal/OpenSiv3D
|
2c7a77526be7bb8669a223066210337d74bdc9c6
|
[
"MIT"
] | 415
|
2017-05-21T05:05:02.000Z
|
2022-03-29T16:08:27.000Z
|
Siv3D/include/Siv3D/FileAction.hpp
|
emadurandal/OpenSiv3D
|
2c7a77526be7bb8669a223066210337d74bdc9c6
|
[
"MIT"
] | 123
|
2016-03-19T12:47:08.000Z
|
2022-03-25T03:47:51.000Z
|
//-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2021 Ryo Suzuki
// Copyright (c) 2016-2021 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# pragma once
# include "Common.hpp"
namespace s3d
{
/// @brief ファイルの操作
enum class FileAction: uint8
{
/// @brief 不明な操作
Unknown,
/// @brief ファイルが新規追加された
Added,
/// @brief ファイルが削除された
Removed,
/// @brief ファイルの内容が更新された
Modified,
};
}
| 16.030303
| 50
| 0.52552
|
emadurandal
|
2590e40fb962694ad4e013e627025acdfecb9ce0
| 5,906
|
cpp
|
C++
|
podofo-0.9.6/test/unit/FontTest.cpp
|
zia95/pdf-toolkit-console-
|
369d73f66f7d4c74a252e83d200acbb792a6b8d5
|
[
"MIT"
] | 1
|
2020-12-29T07:37:14.000Z
|
2020-12-29T07:37:14.000Z
|
podofo-0.9.6/test/unit/FontTest.cpp
|
zia95/pdf-toolkit-console-
|
369d73f66f7d4c74a252e83d200acbb792a6b8d5
|
[
"MIT"
] | null | null | null |
podofo-0.9.6/test/unit/FontTest.cpp
|
zia95/pdf-toolkit-console-
|
369d73f66f7d4c74a252e83d200acbb792a6b8d5
|
[
"MIT"
] | null | null | null |
/***************************************************************************
* Copyright (C) 2009 by Dominik Seichter *
* domseichter@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 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 Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "FontTest.h"
#include <cppunit/Asserter.h>
#include <ft2build.h>
#include FT_FREETYPE_H
using namespace PoDoFo;
CPPUNIT_TEST_SUITE_REGISTRATION( FontTest );
void FontTest::setUp()
{
m_pDoc = new PdfMemDocument();
m_pVecObjects = new PdfVecObjects();
m_pFontCache = new PdfFontCache( m_pVecObjects );
}
void FontTest::tearDown()
{
delete m_pDoc;
delete m_pFontCache;
delete m_pVecObjects;
}
#if defined(PODOFO_HAVE_FONTCONFIG)
void FontTest::testFonts()
{
FcObjectSet* objectSet = NULL;
FcFontSet* fontSet = NULL;
FcPattern* pattern = NULL;
FcConfig* pConfig = NULL;
// Initialize fontconfig
CPPUNIT_ASSERT_EQUAL( !FcInit(), false );
pConfig = FcInitLoadConfigAndFonts();
CPPUNIT_ASSERT_EQUAL( !pConfig, false );
// Get all installed fonts
pattern = FcPatternCreate();
objectSet = FcObjectSetBuild( FC_FAMILY, FC_STYLE, FC_FILE, FC_SLANT, FC_WEIGHT, NULL );
fontSet = FcFontList( NULL, pattern, objectSet );
FcObjectSetDestroy( objectSet );
FcPatternDestroy( pattern );
if( fontSet )
{
printf("Testing %i fonts\n", fontSet->nfont );
int j;
for (j = 0; j < fontSet->nfont; j++)
{
testSingleFont( fontSet->fonts[j], pConfig );
}
FcFontSetDestroy( fontSet );
}
// Shut fontconfig down
// Causes an assertion in fontconfig FcFini();
}
void FontTest::testSingleFont(FcPattern* pFont, FcConfig* pConfig)
{
std::string sFamily;
std::string sPath;
bool bBold;
bool bItalic;
if( GetFontInfo( pFont, sFamily, sPath, bBold, bItalic ) )
{
std::string sPodofoFontPath =
m_pFontCache->GetFontConfigFontPath( pConfig, sFamily.c_str(),
bBold, bItalic );
std::string msg = "Font failed: " + sPodofoFontPath;
EPdfFontType eFontType = PdfFontFactory::GetFontType( sPath.c_str() );
if( eFontType == ePdfFontType_TrueType )
{
// Only TTF fonts can use identity encoding
PdfFont* pFont = m_pDoc->CreateFont( sFamily.c_str(), bBold, bItalic,
new PdfIdentityEncoding() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( msg, pFont != NULL, true );
}
else if( eFontType != ePdfFontType_Unknown )
{
PdfFont* pFont = m_pDoc->CreateFont( sFamily.c_str(), bBold, bItalic );
CPPUNIT_ASSERT_EQUAL_MESSAGE( msg, pFont != NULL, true );
}
else
{
printf("Ignoring font: %s\n", sPodofoFontPath.c_str());
}
}
}
void FontTest::testCreateFontFtFace()
{
FT_Face face;
FT_Error error;
// TODO: Find font file on disc!
error = FT_New_Face( m_pDoc->GetFontLibrary(), "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", 0, &face );
if( !error )
{
PdfFont* pFont = m_pDoc->CreateFont( face );
CPPUNIT_ASSERT_MESSAGE( "Cannot create font from FT_Face.", pFont != NULL );
}
}
bool FontTest::GetFontInfo( FcPattern* pFont, std::string & rsFamily, std::string & rsPath,
bool & rbBold, bool & rbItalic )
{
FcChar8* family = NULL;
FcChar8* file = NULL;
int slant;
int weight;
if( FcPatternGetString(pFont, FC_FAMILY, 0, &family) == FcResultMatch )
{
rsFamily = reinterpret_cast<char*>(family);
if( FcPatternGetString(pFont, FC_FILE, 0, &file) == FcResultMatch )
{
rsPath = reinterpret_cast<char*>(file);
if( FcPatternGetInteger(pFont, FC_SLANT, 0, &slant) == FcResultMatch )
{
if(slant == FC_SLANT_ROMAN)
rbItalic = false;
else if(slant == FC_SLANT_ITALIC)
rbItalic = true;
else
return false;
if( FcPatternGetInteger(pFont, FC_WEIGHT, 0, &weight) == FcResultMatch )
{
if(weight == FC_WEIGHT_MEDIUM)
rbBold = false;
else if(weight == FC_WEIGHT_BOLD)
rbBold = true;
else
return false;
return true;
}
}
//free( file );
}
//free( family );
}
return false;
}
#endif
| 33.179775
| 115
| 0.526752
|
zia95
|
25977b810b0f80b9cb060e17cd3ffb1a385e5c16
| 1,292
|
cpp
|
C++
|
libs/pika/execution/tests/regressions/split_continuation_clear.cpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 13
|
2022-01-17T12:01:48.000Z
|
2022-03-16T10:03:14.000Z
|
libs/pika/execution/tests/regressions/split_continuation_clear.cpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 163
|
2022-01-17T17:36:45.000Z
|
2022-03-31T17:42:57.000Z
|
libs/pika/execution/tests/regressions/split_continuation_clear.cpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 4
|
2022-01-19T08:44:22.000Z
|
2022-01-31T23:16:21.000Z
|
// Copyright (c) 2022 ETH Zurich
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// This test reproduces a segfault in the split sender adaptor which happens if
// the continuations are cleared after all continuations are called. This may
// happen because the last continuation to run may reset the shared state of the
// split adaptor. If the shared state has been reset the continuations have
// already been released. There is a corresponding comment in the set_value
// implementation of split_receiver.
#include <pika/execution.hpp>
#include <pika/init.hpp>
#include <pika/testing.hpp>
#include <cstddef>
namespace ex = pika::execution::experimental;
int pika_main()
{
ex::thread_pool_scheduler sched;
for (std::size_t i = 0; i < 100; ++i)
{
auto s = ex::schedule(sched) | ex::split();
for (std::size_t j = 0; j < 10; ++j)
{
ex::start_detached(s);
}
}
return pika::finalize();
}
int main(int argc, char* argv[])
{
PIKA_TEST_EQ_MSG(pika::init(pika_main, argc, argv), 0,
"pika main exited with non-zero status");
return pika::util::report_errors();
}
| 28.711111
| 80
| 0.682663
|
pika-org
|
2599ad10f3991d5cd7850beafcc9204547252aec
| 1,089
|
cpp
|
C++
|
problemsets/UVA/UVA836.cpp
|
juarezpaulino/coderemite
|
a4649d3f3a89d234457032d14a6646b3af339ac1
|
[
"Apache-2.0"
] | null | null | null |
problemsets/UVA/UVA836.cpp
|
juarezpaulino/coderemite
|
a4649d3f3a89d234457032d14a6646b3af339ac1
|
[
"Apache-2.0"
] | null | null | null |
problemsets/UVA/UVA836.cpp
|
juarezpaulino/coderemite
|
a4649d3f3a89d234457032d14a6646b3af339ac1
|
[
"Apache-2.0"
] | null | null | null |
/**
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <numeric>
using namespace std;
int M, N;
char MAT[30][30];
int main() {
int T;
scanf("%d ", &T);
while (T--) {
int M = 0;
while (gets(MAT[M])) {
if (!MAT[M][0]) break;
M++;
}
for (N = 0; MAT[0][N]; N++);
int ret = -1;
for (int k = 0; k < M; k++) {
int DP[30] = {0};
for (int i = k; i < M; i++) {
int s = 0;
for (int j = 0; j < N; j++) {
if (DP[j]==-1) s = 0;
else if (MAT[i][j]=='0') { DP[j] = -1; s = 0; }
else s += ++DP[j];
if (s > ret) ret = s;
}
}
}
printf("%d\n", ret);
if (T) putchar('\n');
}
return 0;
}
| 19.8
| 67
| 0.399449
|
juarezpaulino
|
259a92c669b2ad7330ff4a4a3b05585f9fe62d7a
| 421
|
cpp
|
C++
|
Engine/Samples/Core/Math/main.cpp
|
ZenEngine3D/ZenEngine
|
42bcd06f743eb1381a587c9671de67e24cf72316
|
[
"MIT"
] | 1
|
2018-10-12T19:10:59.000Z
|
2018-10-12T19:10:59.000Z
|
Engine/Samples/Core/Math/main.cpp
|
ZenEngine3D/ZenEngine
|
42bcd06f743eb1381a587c9671de67e24cf72316
|
[
"MIT"
] | null | null | null |
Engine/Samples/Core/Math/main.cpp
|
ZenEngine3D/ZenEngine
|
42bcd06f743eb1381a587c9671de67e24cf72316
|
[
"MIT"
] | 1
|
2019-03-09T02:12:31.000Z
|
2019-03-09T02:12:31.000Z
|
#include "zenEngine.h"
namespace sample
{
extern void SampleVector();
class SampleBaseMath : public zenSys::zSampleEngineInstance
{
public:
virtual const char* GetAppName()const
{
return "Sample Math";
}
virtual void Update()
{
SampleVector();
SetDone();
}
};
}
int main(int argc, char * const argv[])
{
sample::SampleBaseMath Sample;
zenSys::LaunchEngine(&Sample, argc, argv);
return 0;
}
| 15.592593
| 60
| 0.68171
|
ZenEngine3D
|
259b417714e466f713cae90869cfb8d203e85878
| 288
|
cpp
|
C++
|
CodeChef/Begginer-Problems/SMPAIR.cpp
|
annukamat/My-Competitive-Journey
|
adb13a5723483cde13e5f3859b3a7ad840b86c97
|
[
"MIT"
] | 7
|
2018-11-08T11:39:27.000Z
|
2020-09-10T17:50:57.000Z
|
CodeChef/Begginer-Problems/SMPAIR.cpp
|
annukamat/My-Competitive-Journey
|
adb13a5723483cde13e5f3859b3a7ad840b86c97
|
[
"MIT"
] | null | null | null |
CodeChef/Begginer-Problems/SMPAIR.cpp
|
annukamat/My-Competitive-Journey
|
adb13a5723483cde13e5f3859b3a7ad840b86c97
|
[
"MIT"
] | 2
|
2019-09-16T14:34:03.000Z
|
2019-10-12T19:24:00.000Z
|
#include <bits/stdc++.h>
using namespace std;
int main(){
long int t;
vector<long int> vals(100000);
long int n, x;
cin>>t;
while(t--){
cin>> n;
for(int i=0;i<n; i++)
cin>>x;
vals.push_back(x);
}
sort(vals.begin(), vals+n);
}
| 16
| 34
| 0.489583
|
annukamat
|
259de4d152a4f89a607a1d66209fb8fb75e69105
| 1,393
|
hpp
|
C++
|
src/color/hsi/get/gray.hpp
|
3l0w/color
|
e42d0933b6b88564807bcd5f49e9c7f66e24990a
|
[
"Apache-2.0"
] | 120
|
2015-12-31T22:30:14.000Z
|
2022-03-29T15:08:01.000Z
|
src/color/hsi/get/gray.hpp
|
3l0w/color
|
e42d0933b6b88564807bcd5f49e9c7f66e24990a
|
[
"Apache-2.0"
] | 6
|
2016-08-22T02:14:56.000Z
|
2021-11-06T22:39:52.000Z
|
src/color/hsi/get/gray.hpp
|
3l0w/color
|
e42d0933b6b88564807bcd5f49e9c7f66e24990a
|
[
"Apache-2.0"
] | 23
|
2016-02-03T01:56:26.000Z
|
2021-09-28T16:36:27.000Z
|
#ifndef color_hsi_get_gray
#define color_hsi_get_gray
// ::color::get::gray( c )
#include "../../gray/place/place.hpp"
#include "../../gray/akin/hsi.hpp"
#include "../../gray/trait/component.hpp"
#include "../category.hpp"
#include "../../_internal/normalize.hpp"
#include "../../_internal/diverse.hpp"
#include "../../generic/trait/scalar.hpp"
namespace color
{
namespace get
{
template< typename tag_name >
inline
typename ::color::trait::component< typename ::color::akin::gray< ::color::category::hsi<tag_name> >::akin_type >::return_type
gray( ::color::model< ::color::category::hsi<tag_name> > const& color_parameter )
{
typedef ::color::category::hsi<tag_name> category_type;
typedef typename ::color::trait::scalar<category_type>::instance_type scalar_type;
typedef typename ::color::akin::gray<category_type>::akin_type akin_type;
typedef ::color::_internal::diverse< akin_type > diverse_type;
typedef ::color::_internal::normalize<category_type> normalize_type;
enum{ intensity_p = ::color::place::_internal::intensity<category_type>::position_enum };
scalar_type g = normalize_type::template process<intensity_p >( color_parameter.template get<intensity_p >() );
return diverse_type::template process<0>( g );
}
}
}
#endif
| 30.282609
| 132
| 0.656856
|
3l0w
|
259e79dc8c56138e5a173d30655bd280e724de4f
| 3,479
|
cpp
|
C++
|
test/test_free_functions.cpp
|
jb--/luaponte
|
06bfe551bce23e411e75895797b8bb84bb662ed2
|
[
"BSL-1.0"
] | 3
|
2015-08-30T10:02:10.000Z
|
2018-08-27T06:54:44.000Z
|
test/test_free_functions.cpp
|
halmd-org/luaponte
|
165328485954a51524a0b1aec27518861c6be719
|
[
"BSL-1.0"
] | null | null | null |
test/test_free_functions.cpp
|
halmd-org/luaponte
|
165328485954a51524a0b1aec27518861c6be719
|
[
"BSL-1.0"
] | null | null | null |
// Luaponte library
// Copyright (c) 2011-2012 Peter Colberg
// Luaponte is based on Luabind, a library, inspired by and similar to
// Boost.Python, that helps you create bindings between C++ and Lua,
// Copyright (c) 2003-2010 Daniel Wallin and Arvid Norberg.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include <luaponte/luaponte.hpp>
#include <luaponte/adopt_policy.hpp>
struct base : counted_type<base>
{
int f()
{
return 5;
}
};
COUNTER_GUARD(base);
int f(int x)
{
return x + 1;
}
int f(int x, int y)
{
return x + y;
}
base* create_base()
{
return new base();
}
void test_value_converter(const std::string str)
{
TEST_CHECK(str == "converted string");
}
void test_pointer_converter(const char* const str)
{
TEST_CHECK(std::strcmp(str, "converted string") == 0);
}
struct copy_me
{
};
void take_by_value(copy_me m)
{
}
int function_should_never_be_called(lua_State* L)
{
lua_pushnumber(L, 10);
return 1;
}
void test_main(lua_State* L)
{
using namespace luaponte;
lua_pushcclosure(L, &function_should_never_be_called, 0);
lua_setglobal(L, "f");
DOSTRING(L, "assert(f() == 10)");
module(L)
[
class_<copy_me>("copy_me")
.def(constructor<>()),
class_<base>("base")
.def("f", &base::f),
def("by_value", &take_by_value),
def("f", (int(*)(int)) &f),
def("f", (int(*)(int, int)) &f),
def("create", &create_base, adopt(return_value))
// def("set_functor", &set_functor)
#if !(BOOST_MSVC < 1300)
,
def("test_value_converter", &test_value_converter),
def("test_pointer_converter", &test_pointer_converter)
#endif
];
DOSTRING(L,
"e = create()\n"
"assert(e:f() == 5)");
DOSTRING(L, "assert(f(7) == 8)");
DOSTRING(L, "assert(f(3, 9) == 12)");
// DOSTRING(L, "set_functor(function(x) return x * 10 end)");
// TEST_CHECK(functor_test(20) == 200);
// DOSTRING(L, "set_functor(nil)");
DOSTRING(L, "function lua_create() return create() end");
base* ptr = call_function<base*>(L, "lua_create") [ adopt(result) ];
delete ptr;
#if !(BOOST_MSVC < 1300)
DOSTRING(L, "test_value_converter('converted string')");
DOSTRING(L, "test_pointer_converter('converted string')");
#endif
DOSTRING_EXPECTED(L, "f('incorrect', 'parameters')",
"No matching overload found, candidates:\n"
"int f(int,int)\n"
"int f(int)");
DOSTRING(L, "function failing_fun() error('expected error message') end");
try
{
call_function<void>(L, "failing_fun");
TEST_ERROR("function didn't fail when it was expected to");
}
catch(luaponte::error const& e)
{
// LuaJIT 2.0 and Lua >= 5.2 will return expected1
std::string expected52("[string \"function failing_fun() error('expected error ...\"]:1: expected error message");
// Lua < 5.2 will return expected2
std::string expected51("[string \"function failing_fun() error('expected erro...\"]:1: expected error message");
std::string result(lua_tostring(L, -1));
if (result != expected51 && result != expected52)
{
TEST_ERROR("function failed with unexpected error message");
}
lua_pop(L, 1);
}
}
| 23.193333
| 122
| 0.616556
|
jb--
|
259fbcf71e33fd6166fdebc6cfb7ca4a5337cb97
| 596
|
cpp
|
C++
|
GraphicsToolsModule/Objects/gtmaterialparametervector3f.cpp
|
HowCanidothis-zz/DevLib
|
d3d7f4ef7b2b3f1c9559ca6bd56743e5aeff06ee
|
[
"MIT"
] | null | null | null |
GraphicsToolsModule/Objects/gtmaterialparametervector3f.cpp
|
HowCanidothis-zz/DevLib
|
d3d7f4ef7b2b3f1c9559ca6bd56743e5aeff06ee
|
[
"MIT"
] | null | null | null |
GraphicsToolsModule/Objects/gtmaterialparametervector3f.cpp
|
HowCanidothis-zz/DevLib
|
d3d7f4ef7b2b3f1c9559ca6bd56743e5aeff06ee
|
[
"MIT"
] | 1
|
2020-07-27T02:23:38.000Z
|
2020-07-27T02:23:38.000Z
|
#include "gtmaterialparametervector3f.h"
#include <QOpenGLShaderProgram>
#include "ResourcesModule/resourcessystem.h"
#include "../internal.hpp"
GtMaterialParameterVector3F::GtMaterialParameterVector3F(const QString& name, const QString& resource)
: GtMaterialParameterBase(name, resource)
{}
GtMaterialParameterBase::FDelegate GtMaterialParameterVector3F::apply()
{
m_vector = ResourcesSystem::GetResource<Vector3F>(m_resource);
return [this](QOpenGLShaderProgram* program, gLocID loc, OpenGLFunctions*) {
program->setUniformValue(loc, m_vector->Data().Get());
};
}
| 31.368421
| 102
| 0.771812
|
HowCanidothis-zz
|
25a65c573b1d9e09046be77976bf90321d8b36d9
| 408
|
cpp
|
C++
|
10783.cpp
|
shaonsani/UVA_Solving
|
ee916a2938ea81b3676baf4c8150b1b42c9ab5a5
|
[
"MIT"
] | null | null | null |
10783.cpp
|
shaonsani/UVA_Solving
|
ee916a2938ea81b3676baf4c8150b1b42c9ab5a5
|
[
"MIT"
] | null | null | null |
10783.cpp
|
shaonsani/UVA_Solving
|
ee916a2938ea81b3676baf4c8150b1b42c9ab5a5
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
int t,a,b,ca=1;
cin>>t;
while(t!=0)
{
int sum=0;
cin>>a;
cin>>b;
for(int i=a; i<=b; i++)
{
if(i%2==1)
{
sum+=i;
}
}
cout<<"Case "<<ca<<": "<<sum<<endl;
ca++;
t--;
}
return 0;
}
| 12.75
| 43
| 0.335784
|
shaonsani
|
25a7341141377dfd268a9ba521547ead79c8b139
| 10,744
|
hpp
|
C++
|
geometry/include/pcl/geometry/impl/face.hpp
|
zhangxaochen/CuFusion
|
e8bab7a366b1f2c85a80b95093d195d9f0774c11
|
[
"MIT"
] | 52
|
2017-09-05T13:31:44.000Z
|
2022-03-14T08:48:29.000Z
|
geometry/include/pcl/geometry/impl/face.hpp
|
GucciPrada/CuFusion
|
522920bcf316d1ddf9732fc71fa457174168d2fb
|
[
"MIT"
] | 4
|
2018-05-17T22:45:35.000Z
|
2020-02-01T21:46:42.000Z
|
geometry/include/pcl/geometry/impl/face.hpp
|
GucciPrada/CuFusion
|
522920bcf316d1ddf9732fc71fa457174168d2fb
|
[
"MIT"
] | 21
|
2015-07-27T13:00:36.000Z
|
2022-01-17T08:18:41.000Z
|
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2009-2012, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, 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 the copyright holder(s) 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.
*
* $Id: face.hpp 6833 2012-08-15 01:44:45Z Martin $
*
*/
#ifndef PCL_GEOMETRY_FACE_HPP
#define PCL_GEOMETRY_FACE_HPP
namespace pcl
{
/** \brief A Face is defined by a closed loop of edges.
*
* \tparam FaceDataT User data that is stored in the Face: Must have operator == (Equality Comparable)
* \tparam MeshT Mesh to which the Face belongs to (classes derived from MeshBase)
*
* \note It is not necessary to declare the Face manually. Please declare the mesh first and use the provided typedefs.
* \author Martin Saelzle
* \ingroup geometry
*/
template <class FaceDataT, class MeshT>
class Face : public FaceDataT
{
//////////////////////////////////////////////////////////////////////////
// Types
//////////////////////////////////////////////////////////////////////////
public:
typedef pcl::Face <FaceDataT, MeshT> Self;
typedef FaceDataT FaceData;
typedef MeshT Mesh;
typedef typename Mesh::HalfEdge HalfEdge;
typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
//////////////////////////////////////////////////////////////////////////
// Constructor
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Constructor
* \param face_data (optional) User data that is stored in the Face; defaults to FaceData ()
* \param idx_inner_half_edge (optional) Inner HalfEdgeIndex; defaults to HalfEdgeIndex () (invalid index)
*/
Face (const FaceData& face_data = FaceData (),
const HalfEdgeIndex& idx_inner_half_edge = HalfEdgeIndex ())
: FaceData (face_data),
is_deleted_ (false),
idx_inner_half_edge_ (idx_inner_half_edge)
{
}
//////////////////////////////////////////////////////////////////////////
// InnerHalfEdge
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Returns the inner HalfEdgeIndex (non-const) */
HalfEdgeIndex&
getInnerHalfEdgeIndex ()
{
return (idx_inner_half_edge_);
}
/** \brief Returns the inner HalfEdgeIndex (const) */
const HalfEdgeIndex&
getInnerHalfEdgeIndex () const
{
return (idx_inner_half_edge_);
}
/** \brief Set the inner HalfEdgeIndex */
void
setInnerHalfEdgeIndex (const HalfEdgeIndex& idx_inner_half_edge)
{
idx_inner_half_edge_ = idx_inner_half_edge;
}
/** \brief Returns the inner HalfEdge (non-const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for Mesh::getElement
*/
HalfEdge&
getInnerHalfEdge (Mesh& mesh) const
{
return (mesh.getElement (this->getInnerHalfEdgeIndex ()));
}
/** \brief Returns the inner HalfEdge (const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for Mesh::getElement
*/
const HalfEdge&
getInnerHalfEdge (const Mesh& mesh) const
{
return (mesh.getElement (this->getInnerHalfEdgeIndex ()));
}
//////////////////////////////////////////////////////////////////////////
// OuterHalfEdge
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Returns the outer HalfEdgeIndex (non-const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for getInnerHalfEdge -> getOppositeHalfEdgeIndex
*/
HalfEdgeIndex&
getOuterHalfEdgeIndex (Mesh& mesh) const
{
return (this->getInnerHalfEdge (mesh).getOppositeHalfEdgeIndex ());
}
/** \brief Returns the outer HalfEdgeIndex (const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for getInnerHalfEdge -> getOppositeHalfEdgeIndex
*/
const HalfEdgeIndex&
getOuterHalfEdgeIndex (const Mesh& mesh) const
{
return (this->getInnerHalfEdge (mesh).getOppositeHalfEdgeIndex ());
}
/** \brief Set the outer HalfEdgeIndex
* \param mesh Reference to the mesh to which the Face belongs to
* \param idx_outer_half_edge Outer HalfEdgeIndex
* \note Convenience method for getInnerHalfEdge -> setOppositeHalfEdgeIndex
*/
void
setOuterHalfEdgeIndex (Mesh& mesh,
const HalfEdgeIndex& idx_outer_half_edge) const
{
this->getInnerHalfEdge (mesh).setOppositeHalfEdgeIndex (idx_outer_half_edge);
}
/** \brief Returns the outer HalfEdge (non-const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for getInnerHalfEdge -> getOppositeHalfEdge
*/
HalfEdge&
getOuterHalfEdge (Mesh& mesh) const
{
return (this->getInnerHalfEdge (mesh).getOppositeHalfEdge (mesh));
}
/** \brief Returns the outer HalfEdge (const)
* \param mesh Reference to the mesh to which the Face belongs to
* \note Convenience method for getInnerHalfEdge -> getOppositeHalfEdge
*/
const HalfEdge&
getOuterHalfEdge (const Mesh& mesh) const
{
return (this->getInnerHalfEdge (mesh).getOppositeHalfEdge (mesh));
}
//////////////////////////////////////////////////////////////////////////
// deleted
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Returns true if the Face is marked as deleted */
bool
getDeleted () const
{
return (is_deleted_);
}
/** \brief Mark the Face as deleted (or not-deleted) */
void
setDeleted (const bool is_deleted)
{
is_deleted_ = is_deleted;
}
//////////////////////////////////////////////////////////////////////////
// Isolated
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Returns true if the Face is isolated (not connected to any HalfEdge) */
bool
isIsolated () const
{
return (!this->getInnerHalfEdgeIndex ().isValid ());
}
//////////////////////////////////////////////////////////////////////////
// isBoundary
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Returns true if any Vertex in the Face is on the boundary
* \param mesh Reference to the mesh to which the Face belongs to
*/
bool
isBoundary (const Mesh& mesh) const
{
typename Mesh::VertexAroundFaceConstCirculator circ = mesh.getVertexAroundFaceConstCirculator (*this);
const typename Mesh::VertexAroundFaceConstCirculator circ_end = circ;
do
{
if ((*circ++).isBoundary (mesh))
{
return (true);
}
} while (circ!=circ_end);
return (false);
}
//////////////////////////////////////////////////////////////////////////
// Operators
//////////////////////////////////////////////////////////////////////////
public:
/** \brief Equality comparison operator with FaceData */
bool
operator == (const FaceData& other) const
{
return (FaceData::operator == (other));
}
/** \brief Inequality comparison operator with FaceData */
bool
operator != (const FaceData& other) const
{
return (!this->operator == (other));
}
/** \brief Equality comparison operator with another Face */
bool
operator == (const Self& other) const
{
return (this->getInnerHalfEdgeIndex () == other.getInnerHalfEdgeIndex () &&
this->operator == (FaceData (other)));
}
/** \brief Inequality comparison operator with another Face */
bool
operator != (const Self& other) const
{
return (!this->operator == (other));
}
//////////////////////////////////////////////////////////////////////////
// Members
//////////////////////////////////////////////////////////////////////////
private:
/** \brief Face is marked as deleted */
bool is_deleted_;
/** \brief Index to an inner HalfEdge */
HalfEdgeIndex idx_inner_half_edge_;
};
} // End namespace pcl
#endif // PCL_GEOMETRY_FACE_HPP
| 34.996743
| 123
| 0.53239
|
zhangxaochen
|
25ad7e1add2861ae364335aea992758eca1d85aa
| 2,542
|
hpp
|
C++
|
includes/adventofcode.hpp
|
mbitokhov/AdventOfCode2017
|
a716822b2906580b03b7c5cda8e7a696961f4c40
|
[
"Unlicense"
] | null | null | null |
includes/adventofcode.hpp
|
mbitokhov/AdventOfCode2017
|
a716822b2906580b03b7c5cda8e7a696961f4c40
|
[
"Unlicense"
] | null | null | null |
includes/adventofcode.hpp
|
mbitokhov/AdventOfCode2017
|
a716822b2906580b03b7c5cda8e7a696961f4c40
|
[
"Unlicense"
] | null | null | null |
#pragma once
#include <vector>
#include <cstring>
#include <string>
constexpr long day1p1(const char input[], const size_t &index=0);
constexpr long day1p2(const char input[], const size_t &index=0);
long day2p1(const std::vector<std::vector<int>>&);
long day2p2(const std::vector<std::vector<int>>&);
long day3p1(const long&);
long day3p2(const long&);
long day4p1(const std::vector<std::vector<std::string>>&);
long day4p2(const std::vector<std::vector<std::string>>&);
unsigned long day5p1(std::vector<int>);
unsigned long day5p2(std::vector<int>);
long day6p1(std::vector<int>);
long day6p2(std::vector<int>);
std::string day7p1(std::vector<std::vector<std::string>>);
long day7p2(std::vector<std::vector<std::string>>);
long day8p1(std::vector<std::vector<std::string>>);
long day8p2(std::vector<std::vector<std::string>>);
long day9p1(std::string);
long day9p2(const std::string&);
long day10p1(const std::vector<int> &input);
std::string day10p2(std::string input);
long day11p1(const std::vector<std::string> &input);
long day11p2(const std::vector<std::string> &input);
constexpr long day1p1(const char input[], const size_t &index)
{
/*
* Sum up integers that are the same as the the value ahead of them
*
* This code is the same as the following
* if(input[index != 0]) {
* if(input[index] == input[(index+1) % strlen(input)]) {
* return (input[index] - '0') + day1p1(input,index+1);
* } else {
* return day1p1(input,index+1);
* }
* } else {
* return 0;
* }
*/
return (input[index] != 0) ?
(
(
(input[index] == input[(index + 1) % strlen(input)]) ?
input[index] - '0':
0
) + day1p1(input, index+1)
): 0;
}
constexpr long day1p2(const char input[], const size_t &index)
{
/*
* Sum up integers that are the same as the the value half way
* around the list
*
* This code is the same as the following
* if(input[index != 0]) {
* if(input[index] == input[(index+ strlen(input)/2) % strlen(input)]) {
* return (input[index] - '0') + day1p2(input,index+1);
* } else {
* return day1p2(input,index+1);
* }
* } else {
* return 0;
* }
*/
return (input[index] != 0) ?
(
(
(input[index] == input[(index + (strlen(input) / 2)) % strlen(input)]) ?
input[index] - '0':
0
) + day1p2(input, index+1)
): 0;
}
| 30.626506
| 81
| 0.579858
|
mbitokhov
|
25ad7edcabee4e006d328dc7213cfcfff80fef4e
| 31,886
|
cpp
|
C++
|
multimedia/wmdm_sr1/mdsp/mspmspsv/svchost/pmspservice.cpp
|
npocmaka/Windows-Server-2003
|
5c6fe3db626b63a384230a1aa6b92ac416b0765f
|
[
"Unlicense"
] | 17
|
2020-11-13T13:42:52.000Z
|
2021-09-16T09:13:13.000Z
|
multimedia/wmdm_sr1/mdsp/mspmspsv/svchost/pmspservice.cpp
|
sancho1952007/Windows-Server-2003
|
5c6fe3db626b63a384230a1aa6b92ac416b0765f
|
[
"Unlicense"
] | 2
|
2020-10-19T08:02:06.000Z
|
2020-10-19T08:23:18.000Z
|
multimedia/wmdm_sr1/mdsp/mspmspsv/svchost/pmspservice.cpp
|
sancho1952007/Windows-Server-2003
|
5c6fe3db626b63a384230a1aa6b92ac416b0765f
|
[
"Unlicense"
] | 14
|
2020-11-14T09:43:20.000Z
|
2021-08-28T08:59:57.000Z
|
// PMSPservice.cpp
#include "NTServApp.h"
#include "PMSPservice.h"
#include "svchost.h"
#define BUFSIZE 256
#define PIPE_TIMEOUT 2000
#define NUM_BYTES_PER_READ_REQUEST (sizeof(MEDIA_SERIAL_NUMBER_DATA))
#define INACTIVE_TIMEOUT_SHUTDOWN (5*60*1000) // in millisec -- 5 minutes
#include "serialid.h"
#include "aclapi.h"
#include <crtdbg.h>
LPTSTR g_lpszPipename = "\\\\.\\pipe\\WMDMPMSPpipe";
// static member variables
const DWORD CPMSPService::m_dwMaxConsecutiveConnectErrors = 5;
static DWORD CheckDriveType(HANDLE hPipe, LPCWSTR pwszDrive)
{
// On XP, as a result of the impersonation, we use the
// client's drive letter namespace for the GetDriveType call.
// When we CreateFile the drive letter, we use the LocalSystem
// drive namespace.
if (ImpersonateNamedPipeClient(hPipe) == 0)
{
return GetLastError();
}
DWORD dwDriveType = GetDriveTypeW(pwszDrive);
RevertToSelf();
if (dwDriveType != DRIVE_FIXED && dwDriveType != DRIVE_REMOVABLE)
{
return ERROR_INVALID_PARAMETER;
}
return ERROR_SUCCESS;
}
static VOID GetAnswerToRequest(HANDLE hPipe,
LPBYTE szBufIn,
DWORD dwSizeIn,
LPBYTE szBufOut,
DWORD dwBufSizeOut,
LPDWORD pdwNumBytesWritten)
{
WCHAR wcsDeviceName[]=L"A:\\";
WMDMID stMSN;
DWORD dwDriveNum;
HRESULT hr=E_FAIL;
PMEDIA_SERIAL_NUMBER_DATA pMSNIn = (PMEDIA_SERIAL_NUMBER_DATA)szBufIn;
PMEDIA_SERIAL_NUMBER_DATA pMSNOut = (PMEDIA_SERIAL_NUMBER_DATA)szBufOut;
if (!hPipe || !szBufIn || !szBufOut || !pdwNumBytesWritten || dwBufSizeOut < sizeof(MEDIA_SERIAL_NUMBER_DATA))
{
_ASSERTE(0);
return;
}
// For all errors, we send back (and write to the pipe) the
// entire MEDIA_SERIAL_NUMBER_DATA struct. On successful returns,
// the number of bytes written may be more or less than
// sizeof(MEDIA_SERIAL_NUMBER_DATA) depnding on the length of
// the serial number.
ZeroMemory(szBufOut, dwBufSizeOut);
*pdwNumBytesWritten = sizeof(MEDIA_SERIAL_NUMBER_DATA);
if (dwSizeIn >= NUM_BYTES_PER_READ_REQUEST)
{
dwDriveNum = pMSNIn->Reserved[1];
if (dwDriveNum < 26)
{
wcsDeviceName[0] = L'A' + (USHORT)dwDriveNum;
CPMSPService::DebugMsg("Getting serial number for %c", 'A' + (USHORT) (wcsDeviceName[0] - 'A'));
DWORD dwErr = CheckDriveType(hPipe, wcsDeviceName);
CPMSPService::DebugMsg("CheckDriveType returns %u", dwErr);
if (dwErr == ERROR_SUCCESS)
{
hr = UtilGetSerialNumber(wcsDeviceName, &stMSN, FALSE);
CPMSPService::DebugMsg("hr = %x\n", hr);
CPMSPService::DebugMsg("serial = %c %c %c %c ...\n", stMSN.pID[0], stMSN.pID[1], stMSN.pID[2], stMSN.pID[3]);
if (hr == S_OK)
{
// Note that dwNumBytesToTransfer could actually be less than sizeof(MEDIA_SERIAL_NUMBER_DATA)
DWORD dwNumBytesToTransfer = FIELD_OFFSET(MEDIA_SERIAL_NUMBER_DATA, SerialNumberData) + stMSN.SerialNumberLength;
if (dwNumBytesToTransfer > dwBufSizeOut)
{
pMSNOut->Result = ERROR_INSUFFICIENT_BUFFER;
}
else
{
CopyMemory(pMSNOut->SerialNumberData, stMSN.pID, stMSN.SerialNumberLength);
*pdwNumBytesWritten = dwNumBytesToTransfer;
pMSNOut->SerialNumberLength = stMSN.SerialNumberLength;
pMSNOut->Reserved[1] = stMSN.dwVendorID;
pMSNOut->Result = ERROR_SUCCESS;
}
}
else
{
pMSNOut->Result = 0xFFFF & hr;
}
}
else
{
pMSNOut->Result = dwErr;
}
}
else
{
pMSNOut->Result = ERROR_INVALID_PARAMETER;
}
}
else
{
// This should never happen because this function is called only after
// reading NUM_BYTES_PER_READ_REQUEST or more bytes.
_ASSERTE(m_PipeState[i].dwNumBytesRead >= NUM_BYTES_PER_READ_REQUEST);
pMSNOut->Result = ERROR_INVALID_PARAMETER;
}
}
CPMSPService::CPMSPService(DWORD& dwLastError)
:CNTService()
{
ZeroMemory(&m_PipeState, MAX_PIPE_INSTANCES * sizeof(PIPE_STATE));
m_hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
// unsignalled manual reset event
m_dwNumClients = 0;
dwLastError = m_hStopEvent? ERROR_SUCCESS : GetLastError();
}
CPMSPService::~CPMSPService()
{
CPMSPService::DebugMsg("~CPMSPService, last error %u, num clients: %u",
m_Status.dwWin32ExitCode, m_dwNumClients );
if (m_hStopEvent)
{
CloseHandle(m_hStopEvent);
}
DWORD i;
DWORD dwRet;
for (i = 0; i < MAX_PIPE_INSTANCES; i++)
{
if (m_PipeState[i].state == PIPE_STATE::CONNECT_PENDING ||
m_PipeState[i].state == PIPE_STATE::READ_PENDING ||
m_PipeState[i].state == PIPE_STATE::WRITE_PENDING)
{
BOOL bDisconnect = 0;
_ASSERTE(m_PipeState[i].hPipe);
_ASSERTE(m_PipeState[i].overlapped.hEvent);
CancelIo(m_PipeState[i].hPipe);
CPMSPService::DebugMsg("~CPMSPService client %u's state: %u", i, m_PipeState[i].state);
if (m_PipeState[i].state == PIPE_STATE::CONNECT_PENDING)
{
dwRet = WaitForSingleObject(m_PipeState[i].overlapped.hEvent, 0);
_ASSERTE(dwRet != WAIT_FAILED);
if (dwRet == WAIT_OBJECT_0)
{
bDisconnect = 1;
}
}
else
{
bDisconnect = 1;
_ASSERTE(m_dwNumClients > 0);
m_dwNumClients--;
}
// Note that we do not call FlushFileBuffers. That is
// a sync call and a malicious client can prevent us from
// progressing by not reading bytes from a pipe. That would
// prevent the service from stopping.
//
// In normal circumstances we disconnect the pipe only after
// the client tells us it is done (by closing its end of the
// pipe), so these is no need to flush.
if (bDisconnect)
{
DisconnectNamedPipe(m_PipeState[i].hPipe);
}
}
if (m_PipeState[i].overlapped.hEvent)
{
CloseHandle(m_PipeState[i].overlapped.hEvent);
}
if (m_PipeState[i].hPipe)
{
CloseHandle(m_PipeState[i].hPipe);
}
}
_ASSERTE(m_dwNumClients == 0);
}
BOOL CPMSPService::OnInit(DWORD& dwLastError)
{
BOOL bRet = FALSE;
PSID pAuthUserSID = NULL;
PSID pAdminSID = NULL;
PACL pACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
__try
{
DWORD i;
DWORD dwRet;
EXPLICIT_ACCESS ea[2];
// SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
SECURITY_ATTRIBUTES sa;
// Create a well-known SID for interactive users
if (!AllocateAndInitializeSid(&SIDAuthNT, 1,
SECURITY_INTERACTIVE_RID,
0, 0, 0, 0, 0, 0, 0,
&pAuthUserSID))
{
dwLastError = GetLastError();
DebugMsg("AllocateAndInitializeSid Error %u - auth users\n", dwLastError);
__leave;
}
// Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow authenticated users read access to the key.
ZeroMemory(ea, 2 * sizeof(EXPLICIT_ACCESS));
// Was: ea[0].grfAccessPermissions = GENERIC_WRITE | GENERIC_READ;
// Disallow non admins from creating pipe instances. Don't know if
// GENERIC_WRITE enables that, but the replacement below is safer.
// Following leaves DELETE access turned on; what effect does this have for named pipes?
// ea[0].grfAccessPermissions = (FILE_ALL_ACCESS & ~(FILE_CREATE_PIPE_INSTANCE | WRITE_OWNER | WRITE_DAC));
// Following is same as above except that DELETE access is not given
ea[0].grfAccessPermissions = (FILE_GENERIC_READ | FILE_GENERIC_WRITE) & ~(FILE_CREATE_PIPE_INSTANCE);
ea[0].grfAccessMode = SET_ACCESS;
ea[0].grfInheritance= NO_INHERITANCE;
ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
ea[0].Trustee.ptstrName = (LPTSTR) pAuthUserSID;
// Create a SID for the BUILTIN\Administrators group.
if (!AllocateAndInitializeSid(&SIDAuthNT, 2, // 3,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, // DOMAIN_ALIAS_RID_POWER_USERS,
0, 0, 0, 0, 0,
&pAdminSID))
{
dwLastError = GetLastError();
DebugMsg("AllocateAndInitializeSid Error %u - Domain, Power, Admins\n", dwLastError);
__leave;
}
// Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow the Administrators group full access to the key.
ea[1].grfAccessPermissions = GENERIC_ALL;
ea[1].grfAccessMode = SET_ACCESS;
ea[1].grfInheritance= NO_INHERITANCE;
ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
ea[1].Trustee.ptstrName = (LPTSTR) pAdminSID;
// Create a new ACL that contains the new ACEs.
dwRet = SetEntriesInAcl(2, ea, NULL, &pACL);
if (ERROR_SUCCESS != dwRet)
{
dwLastError = dwRet;
DebugMsg("SetEntriesInAcl Error %u\n", dwLastError);
__leave;
}
// Initialize a security descriptor.
pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
SECURITY_DESCRIPTOR_MIN_LENGTH);
if (pSD == NULL)
{
dwLastError = GetLastError();
DebugMsg("LocalAlloc Error %u\n", dwLastError);
__leave;
}
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
{
dwLastError = GetLastError();
DebugMsg("InitializeSecurityDescriptor Error %u\n", dwLastError);
__leave;
}
// Add the ACL to the security descriptor.
if (!SetSecurityDescriptorDacl(pSD,
TRUE, // fDaclPresent flag
pACL,
FALSE)) // not a default DACL
{
dwLastError = GetLastError();
DebugMsg("SetSecurityDescriptorDacl Error %u\n", dwLastError);
__leave;
}
// Bump up the check point
SetStatus(SERVICE_START_PENDING);
// Initialize a security attributes structure.
sa.nLength = sizeof (SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = pSD;
sa.bInheritHandle = FALSE;
for (i = 0; i < MAX_PIPE_INSTANCES; i++)
{
// Note that if i == 0, we supply FILE_FLAG_FIRST_PIPE_INSTANCE
// to this function. This causes the call to fail if an instance
// of the named pipe is already open. That can happen in 2
// cases: 1. Another instance of this dll is running or 2. We have
// a name clash with another app (benign or malicious).
// @@@@ Note: Apparently FILE_FLAG_FIRST_PIPE_INSTANCE is supported
// only with Win2K SP2 and up. To do: (a) Confirm this (b) What is
// the effect of setting this flag on Win2K gold and SP1?
m_PipeState[i].hPipe = CreateNamedPipe(
g_lpszPipename, // pipe name
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED |
(i == 0? FILE_FLAG_FIRST_PIPE_INSTANCE : 0),
// read/write access
PIPE_TYPE_BYTE | // byte type pipe
PIPE_READMODE_BYTE | // byte-read mode
PIPE_WAIT, // blocking mode
MAX_PIPE_INSTANCES, // max. instances
BUFSIZE, // output buffer size
BUFSIZE, // input buffer size
PIPE_TIMEOUT, // client time-out
&sa); // no security attribute
if (m_PipeState[i].hPipe == INVALID_HANDLE_VALUE)
{
// Note that we bail out if we fail to create ANY pipe instance,
// not just the first one. We expect to create all pipe instances;
// failure to do so could mean that another app (benign or malicious)
// is creating pipe instances. This is possible only if the other
// app has the FILE_CREATE_PIPE_INSTANCE access right.
dwLastError = GetLastError();
m_PipeState[i].hPipe = NULL;
DebugMsg("CreateNamedPipe Error %u, instance = %u\n", dwLastError, i);
__leave;
}
m_PipeState[i].overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
// unsignalled manual reset event
if (m_PipeState[i].overlapped.hEvent == NULL)
{
dwLastError = GetLastError();
DebugMsg("CreateEvent Error %u, instance = %u\n", dwLastError, i);
__leave;
}
// Errors connecting ot the client are sdtashed away in
// m_PipeState[i].dwLastIOCallError. Let CPMSPService::Run
// deal with the error. We'll just continue to start up the
// service here.
ConnectToClient(i);
// Bump up the check point
SetStatus(SERVICE_START_PENDING);
}
bRet = TRUE;
dwLastError = ERROR_SUCCESS;
CPMSPService::DebugMsg("OnInit succeeded");
}
__finally
{
if (pAuthUserSID)
{
FreeSid(pAuthUserSID);
}
if (pAdminSID)
{
FreeSid(pAdminSID);
}
if (pACL)
{
LocalFree(pACL);
}
if (pSD)
{
LocalFree(pSD);
}
}
return bRet;
}
// This routine initiates a connection to a client on pipe instance i.
// Success/error status is saved away in m_PipeState[i].dwLastIOCallError
void CPMSPService::ConnectToClient(DWORD i)
{
m_PipeState[i].state = PIPE_STATE::CONNECT_PENDING;
m_PipeState[i].overlapped.Offset = m_PipeState[i].overlapped.OffsetHigh = 0;
m_PipeState[i].dwNumBytesTransferredByLastIOCall = 0;
m_PipeState[i].dwNumBytesRead = 0;
m_PipeState[i].dwNumBytesToWrite = m_PipeState[i].dwNumBytesWritten = 0;
m_PipeState[i].dwLastIOCallError = 0;
DWORD dwRet = ConnectNamedPipe(m_PipeState[i].hPipe, &m_PipeState[i].overlapped);
if (dwRet)
{
// The event should be signalled already, but just in case:
SetEvent(m_PipeState[i].overlapped.hEvent);
m_PipeState[i].dwLastIOCallError = ERROR_SUCCESS;
}
else
{
m_PipeState[i].dwLastIOCallError = GetLastError();
if (m_PipeState[i].dwLastIOCallError == ERROR_PIPE_CONNECTED)
{
// The event should be signalled already, but just in case:
SetEvent(m_PipeState[i].overlapped.hEvent);
}
else if (m_PipeState[i].dwLastIOCallError == ERROR_IO_PENDING)
{
// Do nothing
}
else
{
// Set tbe event so that CPMSPService::Run deals with the error
// in the next iteration of its main loop
SetEvent(m_PipeState[i].overlapped.hEvent);
}
}
}
// This routine initiates a read on pipe instance i.
// Success/error status is saved away in m_PipeState[i].dwLastIOCallError
void CPMSPService::Read(DWORD i)
{
DWORD dwRet;
m_PipeState[i].state = PIPE_STATE::READ_PENDING;
m_PipeState[i].overlapped.Offset = m_PipeState[i].overlapped.OffsetHigh = 0;
CPMSPService::DebugMsg("Read(): client %u has %u unprocessed bytes in read buffer",
i, m_PipeState[i].dwNumBytesRead);
if (m_PipeState[i].dwNumBytesRead >= NUM_BYTES_PER_READ_REQUEST)
{
// We already have another complete request; process it.
dwRet = 1;
m_PipeState[i].dwNumBytesTransferredByLastIOCall = 0;
}
else
{
dwRet = ReadFile(m_PipeState[i].hPipe,
m_PipeState[i].readBuf + m_PipeState[i].dwNumBytesRead,
sizeof(m_PipeState[i].readBuf)- m_PipeState[i].dwNumBytesRead,
&m_PipeState[i].dwNumBytesTransferredByLastIOCall,
&m_PipeState[i].overlapped);
}
if (dwRet)
{
// The event should be signalled already if we issued a ReadFile,
// but it won't be signalled in other cases
SetEvent(m_PipeState[i].overlapped.hEvent);
m_PipeState[i].dwLastIOCallError = ERROR_SUCCESS;
}
else
{
m_PipeState[i].dwLastIOCallError = GetLastError();
if (m_PipeState[i].dwLastIOCallError == ERROR_IO_PENDING)
{
// Do nothing
}
else
{
// Set tbe event so that CPMSPService::Run deals with the error
// in the next iteration of its main loop. (Note that this may
// not be an error condition - e.g., it could be EOF)
SetEvent(m_PipeState[i].overlapped.hEvent);
}
}
}
// This routine initiates a write on pipe instance i.
// Success/error status is saved away in m_PipeState[i].dwLastIOCallError
void CPMSPService::Write(DWORD i)
{
DWORD dwRet;
m_PipeState[i].state = PIPE_STATE::WRITE_PENDING;
m_PipeState[i].overlapped.Offset = m_PipeState[i].overlapped.OffsetHigh = 0;
dwRet = WriteFile(m_PipeState[i].hPipe,
m_PipeState[i].writeBuf + m_PipeState[i].dwNumBytesWritten,
m_PipeState[i].dwNumBytesToWrite - m_PipeState[i].dwNumBytesWritten,
&m_PipeState[i].dwNumBytesTransferredByLastIOCall,
&m_PipeState[i].overlapped);
if (dwRet)
{
// The event should be signalled already, but just in case:
SetEvent(m_PipeState[i].overlapped.hEvent);
m_PipeState[i].dwLastIOCallError = ERROR_SUCCESS;
}
else
{
m_PipeState[i].dwLastIOCallError = GetLastError();
if (m_PipeState[i].dwLastIOCallError == ERROR_IO_PENDING)
{
// Do nothing
}
else
{
// Set tbe event so that CPMSPService::Run deals with the error
// in the next iteration of its main loop. (Note that this may
// not be an error condition - e.g., it could be EOF)
SetEvent(m_PipeState[i].overlapped.hEvent);
}
}
}
void CPMSPService::Run()
{
DWORD i;
DWORD dwRet;
HANDLE hWaitArray[MAX_PIPE_INSTANCES+1];
SetStatus(SERVICE_RUNNING);
hWaitArray[0] = m_hStopEvent;
for (i = 0; i < MAX_PIPE_INSTANCES; i++)
{
hWaitArray[i+1] = m_PipeState[i].overlapped.hEvent;
}
do
{
DWORD dwTimeout = (m_dwNumClients == 0)? INACTIVE_TIMEOUT_SHUTDOWN : INFINITE;
dwRet = WaitForMultipleObjects(
sizeof(hWaitArray)/sizeof(hWaitArray[0]),
hWaitArray,
FALSE, // wait for any one to be signalled
dwTimeout);
if (dwRet == WAIT_FAILED)
{
m_Status.dwWin32ExitCode = GetLastError();
CPMSPService::DebugMsg("Wait failed, last error %u", m_Status.dwWin32ExitCode );
break;
}
if (dwRet == WAIT_OBJECT_0)
{
// Service has been stopped
CPMSPService::DebugMsg("Service stopped");
break;
}
if (dwRet == WAIT_TIMEOUT)
{
_ASSERTE(m_dwNumClients == 0);
CPMSPService::DebugMsg("Service timed out - stopping");
OnStop();
continue;
}
_ASSERTE(dwRet >= WAIT_OBJECT_0 + 1);
i = dwRet - WAIT_OBJECT_0 - 1;
_ASSERTE(i < MAX_PIPE_INSTANCES);
CPMSPService::DebugMsg("Service woken up by client %u in state %u", i, m_PipeState[i].state);
// Although it's likely that all Win32 I/O calls do this at the
// start of an I/O, we need to do this anyway. Our destructor
// uses the state of this event to determine whether to disconnect
// the pipe.
ResetEvent(m_PipeState[i].overlapped.hEvent);
_ASSERTE(m_PipeState[i].state != PIPE_STATE::NO_IO_PENDING);
if (m_PipeState[i].dwLastIOCallError == ERROR_IO_PENDING)
{
if (!GetOverlappedResult(m_PipeState[i].hPipe,
&m_PipeState[i].overlapped,
&m_PipeState[i].dwNumBytesTransferredByLastIOCall,
FALSE))
{
m_PipeState[i].dwLastIOCallError = GetLastError();
// The following assertion should not fail because our event was
// signaled.
_ASSERTE(m_PipeState[i].dwLastIOCallError != ERROR_IO_INCOMPLETE);
}
else
{
m_PipeState[i].dwLastIOCallError = ERROR_SUCCESS;
}
}
switch (m_PipeState[i].state)
{
case PIPE_STATE::NO_IO_PENDING:
// This should not happen.
// We have asserted m_PipeState[i].state != NO_IO_PENDING above.
break;
case PIPE_STATE::CONNECT_PENDING:
if (m_PipeState[i].dwLastIOCallError == ERROR_SUCCESS ||
m_PipeState[i].dwLastIOCallError == ERROR_PIPE_CONNECTED)
{
// A client has connected; issue a read
m_dwNumClients++;
CPMSPService::DebugMsg("Client %u connected, num clients is now: %u",
i, m_dwNumClients);
Read(i);
// Reset error counter
m_PipeState[i].dwConsecutiveConnectErrors = 0;
}
else
{
CPMSPService::DebugMsg("Client %u connect failed, error %u, # consecutive errors %u",
i, m_PipeState[i].dwLastIOCallError,
m_PipeState[i].dwConsecutiveConnectErrors+1);
if (++m_PipeState[i].dwConsecutiveConnectErrors == m_dwMaxConsecutiveConnectErrors)
{
// We are done with this instance of the pipe, don't
// attempt to connect any more
// @@@@ We should break out of the loop and stop the service if all pipe instances
// are hosed?
m_PipeState[i].state = PIPE_STATE::NO_IO_PENDING;
}
else
{
// Connect to next client
ConnectToClient(i);
}
}
break;
case PIPE_STATE::READ_PENDING:
if (m_PipeState[i].dwLastIOCallError == ERROR_SUCCESS)
{
// We read something. We may have read only a part of
// a request or more than one request (if the client wrote
// two requests to pipe before our read completed).
//
// We have assumed that a request always has NUM_BYTES_PER_READ_REQUEST
// bytes. Otherwise, we can't handle cases where the client writes
// two requests at once (before our read completes) or writes part of
// requests or writes the whole request but ReadFile returns with some
// of the bytes that the client wrote (this is unlikely to happen in
// practice).
m_PipeState[i].dwNumBytesRead += m_PipeState[i].dwNumBytesTransferredByLastIOCall;
CPMSPService::DebugMsg("Client %u read %u bytes; total bytes read: %u",
i, m_PipeState[i].dwNumBytesTransferredByLastIOCall,
m_PipeState[i].dwNumBytesRead);
if (m_PipeState[i].dwNumBytesRead >= NUM_BYTES_PER_READ_REQUEST)
{
GetAnswerToRequest(m_PipeState[i].hPipe,
m_PipeState[i].readBuf,
m_PipeState[i].dwNumBytesRead,
m_PipeState[i].writeBuf,
sizeof(m_PipeState[i].writeBuf),
&m_PipeState[i].dwNumBytesToWrite);
// Remove the read request that has been processed from the read buffer
m_PipeState[i].dwNumBytesRead -= NUM_BYTES_PER_READ_REQUEST;
MoveMemory(m_PipeState[i].readBuf,
m_PipeState[i].readBuf + NUM_BYTES_PER_READ_REQUEST,
m_PipeState[i].dwNumBytesRead);
// Write response to the request that was just processed
Write(i);
}
else
{
Read(i);
}
}
else
{
// If (m_PipeState[i].dwLastIOCallError == ERROR_HANDLE_EOF),
// the reader's done and gone. So we can connect to another
// client. For all other errors, we bail out on the client,
// and connect to another client. Note that we do not call
// FlushFileBuffers here. When the client's gone (we read EOF),
// this is not necessary. In other cases, the client may lose
// the response to its last request - too bad. In any case the
// client has to be able to handle the server's abrupt disconnect.
//
// Calling FlushFileBuffers opens us up to DOS attacks (and could
// prevent the service from stopping) because the call is synchronous
// and does not return till the client has read the stuff we wrote to
// the pipe.
CPMSPService::DebugMsg("Client %u read failed, error %u, num clients left: %u",
i, m_PipeState[i].dwLastIOCallError, m_dwNumClients-1);
DisconnectNamedPipe(m_PipeState[i].hPipe);
m_dwNumClients--;
// Connect to another client
ConnectToClient(i);
}
break;
case PIPE_STATE::WRITE_PENDING:
if (m_PipeState[i].dwLastIOCallError == ERROR_SUCCESS)
{
m_PipeState[i].dwNumBytesWritten += m_PipeState[i].dwNumBytesTransferredByLastIOCall;
_ASSERTE(m_PipeState[i].dwNumBytesWritten <= m_PipeState[i].dwNumBytesToWrite);
CPMSPService::DebugMsg("Wrote %u of %u bytes to client %u",
m_PipeState[i].dwNumBytesWritten,
m_PipeState[i].dwNumBytesToWrite, i);
// >= is only a safety net. == should suffice in view of the assert above.
if (m_PipeState[i].dwNumBytesWritten >= m_PipeState[i].dwNumBytesToWrite)
{
// We are done with this request, read the next one
m_PipeState[i].dwNumBytesWritten = m_PipeState[i].dwNumBytesToWrite = 0;
Read(i);
}
else
{
// We wrote only a part of what we were asked to write. Write the rest.
// This is very unlikely to happen since our buffers are small.
Write(i);
}
}
else
{
// For all errors, we bail out on the client,
// and connect to another client. Note that we do not call
// FlushFileBuffers here. The client may lose
// the response to its last request - too bad. In any case the
// client has to be able to handle the server's abrupt disconnect.
//
// Calling FlushFileBuffers opens us up to DOS attacks (and could
// prevent the service from stopping) because the call is synchronous
// and does not return till the client has read the stuff we wrote to
// the pipe.
CPMSPService::DebugMsg("Client %u write failed, error %u, num clients left: %u",
i, m_PipeState[i].dwLastIOCallError, m_dwNumClients-1);
m_PipeState[i].dwNumBytesWritten = m_PipeState[i].dwNumBytesToWrite = 0;
DisconnectNamedPipe(m_PipeState[i].hPipe);
m_dwNumClients--;
// Connect to another client
ConnectToClient(i);
}
break;
} // switch m_PipeState[i].state)
}
while (1);
return;
}
// Process user control requests
BOOL CPMSPService::OnUserControl(DWORD dwOpcode)
{
// switch (dwOpcode)
// {
// case SERVICE_CONTROL_USER + 0:
// // Save the current status in the registry
// SaveStatus();
// return TRUE;
// default:
// break;
// }
return FALSE; // say not handled
}
void CPMSPService::OnStop()
{
SetStatus(SERVICE_STOP_PENDING);
if (m_hStopEvent)
{
SetEvent(m_hStopEvent);
}
else
{
_ASSERTE(m_hStopEvent);
}
}
void CPMSPService::OnShutdown()
{
OnStop();
}
| 38.232614
| 134
| 0.535564
|
npocmaka
|
25af18af72584b900b02d6a5ef4ad2982c61e0d0
| 564
|
hh
|
C++
|
spl/include/ast/ext_dec_list.hh
|
Alan052918/CS323-Compilers
|
d2591dbf0e8b3eb87ab507cb8633c12d587fee99
|
[
"MIT"
] | 2
|
2020-09-09T03:33:10.000Z
|
2020-11-29T15:14:01.000Z
|
spl/include/ast/ext_dec_list.hh
|
Alan052918/CS323-Compilers
|
d2591dbf0e8b3eb87ab507cb8633c12d587fee99
|
[
"MIT"
] | null | null | null |
spl/include/ast/ext_dec_list.hh
|
Alan052918/CS323-Compilers
|
d2591dbf0e8b3eb87ab507cb8633c12d587fee99
|
[
"MIT"
] | 1
|
2020-09-09T03:35:14.000Z
|
2020-09-09T03:35:14.000Z
|
#ifndef EXT_DEC_LIST_H
#define EXT_DEC_LIST_H
#include "ast.hh"
#include "../common.hh"
#include "../enums.hh"
#include "../symtable.hh"
#include "../typedef.hh"
class VarDec;
class ExtDecList : public NonterminalNode {
public:
// nonterminal member variables
std::vector<VarDec *> node_list;
// data member variables
std::vector<std::pair<std::string, std::vector<int> > > dec_list;
VarType *var_type;
ExtDecList(int fl, int ll, int fc, int lc, int rhsf);
void visit(int indent_level, SymbolTable *st) override;
};
#endif // EXT_DEC_LIST_H
| 20.888889
| 67
| 0.703901
|
Alan052918
|
25b1d4fc8bb3fe881a34d29ce566da161761ccd9
| 351
|
cpp
|
C++
|
src/apps/S3DAnalyzer/rendering/entity/stereo/anaglyphrectangleentity.cpp
|
hugbed/OpenS3D
|
4ffad16f9b0973404b59eb1424cc45f68754fe12
|
[
"BSD-3-Clause"
] | 8
|
2017-04-16T16:38:15.000Z
|
2020-04-20T03:23:15.000Z
|
src/apps/S3DAnalyzer/rendering/entity/stereo/anaglyphrectangleentity.cpp
|
hugbed/OpenS3D
|
4ffad16f9b0973404b59eb1424cc45f68754fe12
|
[
"BSD-3-Clause"
] | 40
|
2017-04-12T17:24:44.000Z
|
2017-12-21T18:41:23.000Z
|
src/apps/S3DAnalyzer/rendering/entity/stereo/anaglyphrectangleentity.cpp
|
hugbed/OpenS3D
|
4ffad16f9b0973404b59eb1424cc45f68754fe12
|
[
"BSD-3-Clause"
] | 6
|
2017-07-13T21:51:09.000Z
|
2021-05-18T16:22:03.000Z
|
#include "anaglyphrectangleentity.h"
AnaglyphRectangleEntity::AnaglyphRectangleEntity() : RectangleEntity() {}
void AnaglyphRectangleEntity::addShaders() {
m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/stereo/overlap.vert");
m_program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/stereo/anaglyph.frag");
}
| 39
| 96
| 0.803419
|
hugbed
|
25b5f7f721e45e2291d58fd3e0d534790183be7d
| 1,855
|
cpp
|
C++
|
Utils/tetvtk2mesh/tetvtk2mesh.cpp
|
msraig/CE-PolyCube
|
e46aff6e0594b711735118bfa902a91bc3d392ca
|
[
"MIT"
] | 19
|
2020-08-13T05:15:09.000Z
|
2022-03-31T14:51:29.000Z
|
Utils/tetvtk2mesh/tetvtk2mesh.cpp
|
xh-liu-tech/CE-PolyCube
|
86d4ed0023215307116b6b3245e2dbd82907cbb8
|
[
"MIT"
] | 2
|
2020-09-08T07:03:04.000Z
|
2021-08-04T05:43:27.000Z
|
Utils/tetvtk2mesh/tetvtk2mesh.cpp
|
xh-liu-tech/CE-PolyCube
|
86d4ed0023215307116b6b3245e2dbd82907cbb8
|
[
"MIT"
] | 10
|
2020-08-06T02:37:46.000Z
|
2021-07-01T09:12:06.000Z
|
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
//hex to vtk
int main(int argc, char** argv)
{
//input must be two file name'
//tet version
if (argc != 3)
{
std::cout << "input format: " << "input.vtk output.mesh" << std::endl;
}
std::ifstream inputfile(argv[1]);
std::ofstream outputfile(argv[2]);
std::string str;
unsigned int n_point, n_tet;
std::vector<double> coord_x, coord_y, coord_z;
do
{
inputfile >> str;
} while (str != "POINTS");
inputfile >> n_point >> str;
//hexfile >> n_hex >> str;
//std::cout << "n point: " << n_point << std::endl;
coord_x.resize(n_point);
coord_y.resize(n_point);
coord_z.resize(n_point);
double x, y, z;
for (size_t i = 0; i < n_point; i++)
{
inputfile >> x >> y >> z;
//pts.push_back(ig::CVec<double, 3>(x, y, z));
coord_x[i] = x;
coord_y[i] = y;
coord_z[i] = z;
}
do
{
inputfile >> str;
} while (str != "CELLS");
int hex_type;
inputfile >> n_tet >> hex_type;
outputfile << "MeshVersionFormatted 1" << std::endl;
outputfile << "Dimension 3" << std::endl;
outputfile << "Vertices " << std::endl;
outputfile << n_point << std::endl;
for (size_t i = 0; i < n_point; i++)
{
outputfile << coord_x[i] << " " << coord_y[i] << " " << coord_z[i] << " 0" << std::endl;
}
outputfile << "Tetrahedra " << std::endl;
outputfile << n_tet << std::endl;
//int vtk_id[] = { 2, 3, 6, 7, 1, 0, 5, 4 };
int vtk_id[] = { 0,1,2,3,4,5,6,7 };
for (size_t i = 0; i < n_tet; i++)
{
int tmp;
std::vector<int> id(4, 0);
inputfile >> tmp;
for (size_t j = 0; j < 4; j++)
{
inputfile >> id[j];
}
//outputfile << "8";
for (size_t j = 0; j < 4; j++)
{
outputfile << id[vtk_id[j]] + 1 << " ";
}
outputfile << "0" << std::endl;
}
outputfile << "End" << std::endl;
inputfile.close();
outputfile.close();
return 1;
}
| 19.322917
| 90
| 0.566038
|
msraig
|
25bfd0677c71cf52215b34f200bf2f7c4a4f5ba5
| 796
|
cpp
|
C++
|
src/mgos_homie.cpp
|
cslauritsen/mgos-garage
|
934bc266d7486be320fec806dd265c655af76d56
|
[
"MIT"
] | null | null | null |
src/mgos_homie.cpp
|
cslauritsen/mgos-garage
|
934bc266d7486be320fec806dd265c655af76d56
|
[
"MIT"
] | null | null | null |
src/mgos_homie.cpp
|
cslauritsen/mgos-garage
|
934bc266d7486be320fec806dd265c655af76d56
|
[
"MIT"
] | null | null | null |
#include "all.h"
void homie::Device::computePsk() {
int rc = 0;
unsigned char output[64];
int is384 = 0;
rc = mbedtls_sha512_ret((const unsigned char *)this->topicBase.c_str(),
this->topicBase.length(), output, is384);
if (0 == rc) {
char *hex = (char *)calloc(1, sizeof(output) * 2 + 1);
char *p = hex;
for (size_t i = 0; i < sizeof(output); i++) {
sprintf(p, "%02x", output[i]);
p += 2;
}
this->psk = std::string(static_cast<const char *>(hex));
free(hex);
} else {
LOG(LL_ERROR, ("SHA512 failed: %d", rc));
}
}
void homie::Device::publish(Message &m) {
mgos_mqtt_pub(m.topic.c_str(), m.payload.c_str(), m.payload.length(), m.qos,
m.retained);
LOG(LL_DEBUG, ("pub t=%s", m.topic.c_str()));
}
| 28.428571
| 78
| 0.556533
|
cslauritsen
|
25bfe6ccebf748994e3fa1ba664e9062153d7e8f
| 3,453
|
cpp
|
C++
|
src/language_dialog.cpp
|
sweetkristas/anura
|
5e8cbcfc7b761c5c01e5c5509a0fb159b8fb60cd
|
[
"CC0-1.0"
] | null | null | null |
src/language_dialog.cpp
|
sweetkristas/anura
|
5e8cbcfc7b761c5c01e5c5509a0fb159b8fb60cd
|
[
"CC0-1.0"
] | null | null | null |
src/language_dialog.cpp
|
sweetkristas/anura
|
5e8cbcfc7b761c5c01e5c5509a0fb159b8fb60cd
|
[
"CC0-1.0"
] | null | null | null |
#include <boost/bind.hpp>
#include "button.hpp"
#include "language_dialog.hpp"
#include "dialog.hpp"
#include "draw_scene.hpp"
#include "graphical_font_label.hpp"
#include "i18n.hpp"
#include "level.hpp"
#include "preferences.hpp"
#include "json_parser.hpp"
#include "foreach.hpp"
namespace {
void end_dialog(gui::dialog* d)
{
d->close();
}
void do_draw_scene() {
draw_scene(level::current(), last_draw_position());
}
void set_locale(const std::string& value) {
preferences::set_locale(value);
i18n::init();
graphical_font::init_for_locale(i18n::get_locale());
}
class grid {
gui::dialog& dialog_;
int cell_width_;
int cell_height_;
int h_padding_;
int v_padding_;
int start_x_;
int start_y_;
int column_count_;
int widget_count_;
public:
grid(gui::dialog& dialog, int cell_width, int cell_height, int h_padding, int v_padding, int start_x, int start_y, int column_count) :
dialog_(dialog), cell_width_(cell_width), cell_height_(cell_height), h_padding_(h_padding), v_padding_(v_padding), start_x_(start_x), start_y_(start_y), column_count_(column_count), widget_count_(0) {
}
void add_widget(gui::widget_ptr widget) {
dialog_.add_widget(widget,
start_x_ + h_padding_ + (widget_count_ % column_count_) * (cell_width_ + h_padding_),
start_y_ + v_padding_ + (widget_count_ / column_count_) * (cell_height_ + v_padding_));
widget_count_++;
}
int total_width() {
return start_x_ + column_count_ * (cell_width_ + h_padding_);
}
int total_height() {
return start_y_ + (widget_count_ + column_count_ - 1) / column_count_ * (cell_height_ + v_padding_);
}
};
}
void show_language_dialog()
{
using namespace gui;
dialog d(0, 0, 0, 0);
d.set_background_frame("empty_window");
d.set_draw_background_fn(do_draw_scene);
const int button_width = 300;
const int button_height = 50;
const int padding = 20;
d.add_widget(widget_ptr(new graphical_font_label(_("Language change will take effect in next level."), "door_label", 2)), padding, padding);
grid g(d, button_width, button_height, padding, padding, 0, 40, 2);
typedef std::map<variant, variant> variant_map;
variant_map languages = json::parse_from_file("data/languages.cfg").as_map();
int index = 0;
foreach(variant_map::value_type pair, languages) {
widget_ptr b(new button(
widget_ptr(new graphical_font_label(pair.second.as_string(), "language_names", 2)),
boost::bind(set_locale, pair.first.as_string()),
BUTTON_STYLE_NORMAL, BUTTON_SIZE_DOUBLE_RESOLUTION));
b->set_dim(button_width, button_height);
g.add_widget(b);
}
widget_ptr system_button(new button(
widget_ptr(new graphical_font_label(_("Use system language"), "door_label", 2)),
boost::bind(set_locale, "system"),
BUTTON_STYLE_NORMAL, BUTTON_SIZE_DOUBLE_RESOLUTION));
system_button->set_dim(button_width, button_height);
g.add_widget(system_button);
widget_ptr back_button(new button(widget_ptr(new graphical_font_label(_("Back"), "door_label", 2)), boost::bind(end_dialog, &d), BUTTON_STYLE_DEFAULT, BUTTON_SIZE_DOUBLE_RESOLUTION));
back_button->set_dim(button_width, button_height);
g.add_widget(back_button);
int dialog_width = g.total_width() + padding;
int dialog_height = g.total_height() + padding;
d.set_loc((preferences::virtual_screen_width() - dialog_width) / 2,
(preferences::virtual_screen_height() - dialog_height) / 2);
d.set_dim(g.total_width() + padding, g.total_height() + padding);
d.show_modal();
}
| 31.108108
| 203
| 0.742832
|
sweetkristas
|
25c0733690a2dbbf47e53f0a74d66be3f8a5fba7
| 5,377
|
hpp
|
C++
|
cxxreflect/reflection/module_locator.hpp
|
dbremner/cxxreflect
|
bbf1649b00755f8463e4a73b28dec4cd5b609493
|
[
"BSL-1.0"
] | 5
|
2019-03-21T14:52:16.000Z
|
2021-02-20T13:14:25.000Z
|
cxxreflect/reflection/module_locator.hpp
|
dbremner/cxxreflect
|
bbf1649b00755f8463e4a73b28dec4cd5b609493
|
[
"BSL-1.0"
] | null | null | null |
cxxreflect/reflection/module_locator.hpp
|
dbremner/cxxreflect
|
bbf1649b00755f8463e4a73b28dec4cd5b609493
|
[
"BSL-1.0"
] | 2
|
2017-02-17T23:24:23.000Z
|
2021-07-06T18:10:35.000Z
|
// Copyright James P. McNellis 2011 - 2013. //
// Distributed under the Boost Software License, Version 1.0. //
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
#ifndef CXXREFLECT_REFLECTION_MODULE_LOCATOR_HPP_
#define CXXREFLECT_REFLECTION_MODULE_LOCATOR_HPP_
#include "cxxreflect/reflection/detail/forward_declarations.hpp"
namespace cxxreflect { namespace reflection {
/// Represents the location of a module, either on disk (path) or in memory (byte range)
class module_location
{
public:
enum class kind
{
uninitialized,
file,
memory
};
module_location();
explicit module_location(core::const_byte_range const& memory_range);
explicit module_location(core::string_reference const& file_path);
auto get_kind() const -> kind;
auto is_file() const -> bool;
auto is_memory() const -> bool;
auto is_initialized() const -> bool;
auto memory_range() const -> core::const_byte_range;
auto file_path() const -> core::string_reference;
auto to_string() const -> core::string;
friend auto operator==(module_location const&, module_location const&) -> bool;
friend auto operator< (module_location const&, module_location const&) -> bool;
CXXREFLECT_GENERATE_COMPARISON_OPERATORS(module_location)
private:
core::const_byte_range _memory_range;
core::string _file_path;
core::value_initialized<kind> _kind;
};
} }
namespace cxxreflect { namespace reflection { namespace detail {
typedef std::unique_ptr<class base_module_locator> unique_base_module_locator;
class base_module_locator
{
public:
virtual auto locate_assembly(assembly_name const& target_assembly) const -> module_location = 0;
virtual auto locate_namespace(core::string_reference const& namespace_name) const -> module_location = 0;
virtual auto locate_module(assembly_name const& requesting_assembly,
core::string_reference const& module_name) const -> module_location = 0;
virtual auto copy() const -> unique_base_module_locator = 0;
virtual ~base_module_locator() { }
};
template <typename T>
class derived_module_locator : public base_module_locator
{
public:
template <typename U>
derived_module_locator(U&& x)
: _x(std::forward<U>(x))
{
}
virtual auto locate_assembly(assembly_name const& target_assembly) const -> module_location override
{
return _x.locate_assembly(target_assembly);
}
virtual auto locate_namespace(core::string_reference const& namespace_name) const -> module_location override
{
return _x.locate_namespace(namespace_name);
}
virtual auto locate_module(assembly_name const& requesting_assembly,
core::string_reference const& module_name) const -> module_location override
{
return _x.locate_module(requesting_assembly, module_name);
}
virtual auto copy() const -> unique_base_module_locator
{
return core::make_unique<derived_module_locator>(_x);
}
private:
T _x;
};
} } }
namespace cxxreflect { namespace reflection {
class module_locator
{
public:
module_locator();
template <typename T>
module_locator(T x)
: _x(core::make_unique<detail::derived_module_locator<T>>(x))
{
}
module_locator(module_locator const&);
module_locator(module_locator&&);
auto operator=(module_locator const&) -> module_locator&;
auto operator=(module_locator&&) -> module_locator&;
auto locate_assembly(assembly_name const& target_assembly) const -> module_location;
auto locate_namespace(core::string_reference const& namespace_name) const -> module_location;
auto locate_module(assembly_name const& requesting_assembly,
core::string_reference const& module_name) const -> module_location;
auto is_initialized() const -> bool;
private:
detail::unique_base_module_locator _x;
};
class search_path_module_locator
{
public:
typedef std::vector<core::string> search_path_sequence;
search_path_module_locator(search_path_sequence const& sequence);
auto locate_assembly(assembly_name const& target_assembly) const -> module_location;
auto locate_namespace(core::string_reference const& namespace_name) const -> module_location;
auto locate_module(assembly_name const& requesting_assembly,
core::string_reference const& module_name) const -> module_location;
private:
search_path_sequence _sequence;
};
} }
#endif
| 29.064865
| 118
| 0.616143
|
dbremner
|
25c0b0af1a83afb1285a1ffdd396ff228a57fe67
| 24,253
|
cpp
|
C++
|
estl/containers/unittest/vector_s_unittest.cpp
|
mlutken/playground
|
88b0fc457ae8f028b9a1f8f959b8361a645468be
|
[
"Unlicense"
] | null | null | null |
estl/containers/unittest/vector_s_unittest.cpp
|
mlutken/playground
|
88b0fc457ae8f028b9a1f8f959b8361a645468be
|
[
"Unlicense"
] | null | null | null |
estl/containers/unittest/vector_s_unittest.cpp
|
mlutken/playground
|
88b0fc457ae8f028b9a1f8f959b8361a645468be
|
[
"Unlicense"
] | null | null | null |
#include <stdexcept>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "../vector_s.hpp"
#include <vector>
using namespace testing;
using namespace estl;
class VectorSUnitTest : public testing::Test
{
public:
VectorSUnitTest() = default;
~VectorSUnitTest() override = default;
void SetUp() override
{
}
void TearDown() override;
};
void VectorSUnitTest::TearDown()
{
}
// ----------------------------------------
// --- Simple helper test element class ---
// ----------------------------------------
struct Rect {
Rect() = default;
Rect(unsigned w, unsigned h)
: width_(w),
height_(h)
{
}
unsigned width_ = 0;
unsigned height_ = 0;
};
inline bool operator== (const Rect& lhs, const Rect& rhs) {
return lhs.width_ == rhs.width_ &&
lhs.height_ == rhs.height_;
}
// -------------------
// -- Constructors ---
// -------------------
TEST_F(VectorSUnitTest, default_constructor)
{
vector_s<int, 10> v;
EXPECT_TRUE(v.empty());
EXPECT_EQ(static_cast<size_t>(0u), v.size());
EXPECT_EQ(10u, v.capacity());
EXPECT_EQ(10u, v.max_size());
}
TEST_F(VectorSUnitTest, count_constructor)
{
vector_s<std::string, 10> vs(5);
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string(""), vs[0]);
EXPECT_EQ(std::string(""), vs[1]);
EXPECT_EQ(std::string(""), vs[2]);
EXPECT_EQ(std::string(""), vs[3]);
EXPECT_EQ(std::string(""), vs[4]);
vector_s<std::string, 10> vsv(5, "value");
EXPECT_FALSE(vsv.empty());
EXPECT_EQ(5u, vsv.size());
EXPECT_EQ(std::string("value"), vsv[0]);
EXPECT_EQ(std::string("value"), vsv[1]);
EXPECT_EQ(std::string("value"), vsv[2]);
EXPECT_EQ(std::string("value"), vsv[3]);
EXPECT_EQ(std::string("value"), vsv[4]);
}
TEST_F(VectorSUnitTest, range_constructor)
{
std::vector<std::string> vs_src{"0","1","2","3","4"};
vector_s<std::string, 10> vs(vs_src.begin(), vs_src.end());
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
}
TEST_F(VectorSUnitTest, copy_constructor)
{
std::vector<std::string> v_raw_src{"0","1","2","3","4"};
vector_s<std::string, 10> v_src(v_raw_src.begin(), v_raw_src.end());
vector_s<std::string, 10> vs(v_src);
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
vector_s<std::string, 10> v_src_move(v_raw_src.begin(), v_raw_src.end());
vector_s<std::string, 10> vs_move(std::move(v_src_move));
EXPECT_FALSE(vs_move.empty());
EXPECT_EQ(5u, vs_move.size());
EXPECT_EQ(std::string("0"), vs_move[0]);
EXPECT_EQ(std::string("1"), vs_move[1]);
EXPECT_EQ(std::string("2"), vs_move[2]);
EXPECT_EQ(std::string("3"), vs_move[3]);
EXPECT_EQ(std::string("4"), vs_move[4]);
vector_s<std::string, 12> vs_diff_capacity(v_src);
EXPECT_FALSE(vs_diff_capacity.empty());
EXPECT_EQ(5u, vs_diff_capacity.size());
EXPECT_EQ(std::string("0"), vs_diff_capacity[0]);
EXPECT_EQ(std::string("1"), vs_diff_capacity[1]);
EXPECT_EQ(std::string("2"), vs_diff_capacity[2]);
EXPECT_EQ(std::string("3"), vs_diff_capacity[3]);
EXPECT_EQ(std::string("4"), vs_diff_capacity[4]);
vector_s<std::string, 10> v_src_move_diff_capacity(v_raw_src.begin(), v_raw_src.end());
vector_s<std::string, 12> vs_diff_capacity_move(std::move(v_src_move_diff_capacity));
EXPECT_FALSE(vs_diff_capacity_move.empty());
EXPECT_EQ(5u, vs_diff_capacity_move.size());
EXPECT_EQ(std::string("0"), vs_diff_capacity_move[0]);
EXPECT_EQ(std::string("1"), vs_diff_capacity_move[1]);
EXPECT_EQ(std::string("2"), vs_diff_capacity_move[2]);
EXPECT_EQ(std::string("3"), vs_diff_capacity_move[3]);
EXPECT_EQ(std::string("4"), vs_diff_capacity_move[4]);
}
TEST_F(VectorSUnitTest, push_back)
{
vector_s<unsigned, 6> v{};
EXPECT_EQ(0u, v.size());
// Insert 3 elements from start
v.push_back(0u); // rvalue reference (the (T&& value) overload)
v.push_back(1u); // rvalue reference (the (T&& value) overload)
v.push_back(2u); // rvalue reference (the (T&& value) overload)
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
const unsigned v10 = 10u;
v.push_back(v10); // Normal (const T& value) overload
EXPECT_EQ(10u, v[3]);
EXPECT_EQ(4u, v.size());
}
#if (CXX_STANDARD != 98)
TEST_F(VectorSUnitTest, assignment)
{
std::vector<int> v_raw_src{0,1,2,3,4};
vector_s<int, 10> v_src(v_raw_src.begin(), v_raw_src.end());
vector_s<int, 10> v;
v = v_src;
EXPECT_FALSE(v.empty());
EXPECT_EQ(5u, v.size());
EXPECT_EQ(static_cast<int>(0), v[0]);
EXPECT_EQ(1, v[1]);
EXPECT_EQ(2, v[2]);
EXPECT_EQ(3, v[3]);
EXPECT_EQ(4, v[4]);
vector_s<std::string, 10> vs_src{"0","1","2","3","4"};
vector_s<std::string, 10> vs;
vs = vs_src;
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
vector_s<std::string, 20> vsdifferent; // Different capicy from source vector!
vsdifferent = vs_src;
EXPECT_FALSE(vsdifferent.empty());
EXPECT_EQ(5u, vsdifferent.size());
EXPECT_EQ(std::string("0"), vsdifferent[0]);
EXPECT_EQ(std::string("1"), vsdifferent[1]);
EXPECT_EQ(std::string("2"), vsdifferent[2]);
EXPECT_EQ(std::string("3"), vsdifferent[3]);
EXPECT_EQ(std::string("4"), vsdifferent[4]);
}
TEST_F(VectorSUnitTest, initializer_list_constructor)
{
vector_s<int, 10> v{0,1,2,3,4};
EXPECT_FALSE(v.empty());
EXPECT_EQ(5u, v.size());
EXPECT_EQ(static_cast<int>(0), v[0]);
EXPECT_EQ(1, v[1]);
EXPECT_EQ(2, v[2]);
EXPECT_EQ(3, v[3]);
EXPECT_EQ(4, v[4]);
vector_s<std::string, 10> vs{"0","1","2","3","4"};
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
}
TEST_F(VectorSUnitTest, initializer_list_assignment)
{
vector_s<int, 10> v;
v = {0,1,2,3,4};
EXPECT_FALSE(v.empty());
EXPECT_EQ(5u, v.size());
EXPECT_EQ(static_cast<int>(0), v[0]);
EXPECT_EQ(1, v[1]);
EXPECT_EQ(2, v[2]);
EXPECT_EQ(3, v[3]);
EXPECT_EQ(4, v[4]);
vector_s<std::string, 10> vs;
vs = {"0","1","2","3","4"};
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
}
TEST_F(VectorSUnitTest, assign_function)
{
vector_s<std::string, 10> vsv;
vsv.assign(5, "value");
EXPECT_FALSE(vsv.empty());
EXPECT_EQ(5u, vsv.size());
EXPECT_EQ(std::string("value"), vsv[0]);
EXPECT_EQ(std::string("value"), vsv[1]);
EXPECT_EQ(std::string("value"), vsv[2]);
EXPECT_EQ(std::string("value"), vsv[3]);
EXPECT_EQ(std::string("value"), vsv[4]);
}
TEST_F(VectorSUnitTest, initializer_list_assign_function)
{
vector_s<std::string, 10> vs;
vs.assign({"00","11","22","33","44"});
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("00"), vs[0]);
EXPECT_EQ(std::string("11"), vs[1]);
EXPECT_EQ(std::string("22"), vs[2]);
EXPECT_EQ(std::string("33"), vs[3]);
EXPECT_EQ(std::string("44"), vs[4]);
}
TEST_F(VectorSUnitTest, range_assignment)
{
std::vector<int> v_src{0,1,2,3,4};
vector_s<int, 10> v;
v.assign(v_src.begin(), v_src.end());
EXPECT_FALSE(v.empty());
EXPECT_EQ(5u, v.size());
EXPECT_EQ(static_cast<int>(0), v[0]);
EXPECT_EQ(1, v[1]);
EXPECT_EQ(2, v[2]);
EXPECT_EQ(3, v[3]);
EXPECT_EQ(4, v[4]);
std::vector<std::string> vs_src{"0","1","2","3","4"};
vector_s<std::string, 10> vs;
vs.assign(vs_src.begin(), vs_src.end());
EXPECT_FALSE(vs.empty());
EXPECT_EQ(5u, vs.size());
EXPECT_EQ(std::string("0"), vs[0]);
EXPECT_EQ(std::string("1"), vs[1]);
EXPECT_EQ(std::string("2"), vs[2]);
EXPECT_EQ(std::string("3"), vs[3]);
EXPECT_EQ(std::string("4"), vs[4]);
}
TEST_F(VectorSUnitTest, construct_out_of_range)
{
std::vector<unsigned> v_src{0u,1u,2u,3u,4u};
std::vector<unsigned> v_src_too_big{0u,1u,2u,3u,4u,5u};
using vec_t = vector_s<unsigned, 5>;
EXPECT_THROW(vec_t(6), std::range_error);
EXPECT_THROW(vec_t(6, 12u), std::range_error);
EXPECT_THROW((vec_t{0u, 1u, 2u, 3u, 4u, 5u}), std::range_error);
EXPECT_NO_THROW((vec_t(v_src.begin(), v_src.end())));
EXPECT_THROW((vec_t(v_src.end(), v_src.begin())), std::out_of_range);
EXPECT_THROW((vec_t(v_src_too_big.begin(), v_src_too_big.end())), std::range_error);
}
TEST_F(VectorSUnitTest, assign_out_of_range)
{
std::vector<unsigned> v_src{0u,1u,2u,3u,4u};
std::vector<unsigned> v_src_too_big{0u,1u,2u,3u,4u,5u};
using vec_t = vector_s<unsigned, 5>;
vec_t v;
EXPECT_THROW( (v = {0u, 1u, 2u, 3u, 4u, 5u}), std::range_error );
EXPECT_NO_THROW( v.assign(v_src.begin(), v_src.end()) );
EXPECT_THROW(v.assign(v_src.end(), v_src.begin()), std::out_of_range);
EXPECT_THROW(v.assign(v_src_too_big.begin(), v_src_too_big.end()), std::range_error);
}
// ----------------------
// --- Element access ---
// ----------------------
TEST_F(VectorSUnitTest, element_access_at)
{
vector_s<unsigned, 5> v{0u,1u,2u,3u,4u};
EXPECT_EQ(0u, v.at(0));
EXPECT_EQ(1u, v.at(1));
EXPECT_EQ(2u, v.at(2));
EXPECT_EQ(3u, v.at(3));
EXPECT_EQ(4u, v.at(4));
EXPECT_THROW(v.at(5), std::out_of_range);
// const variant of at()
const vector_s<unsigned, 5> vc{0u,1u,2u,3u,4u};
EXPECT_EQ(0u, vc.at(0));
EXPECT_EQ(1u, vc.at(1));
EXPECT_EQ(2u, vc.at(2));
EXPECT_EQ(3u, vc.at(3));
EXPECT_EQ(4u, vc.at(4));
EXPECT_THROW(vc.at(5), std::out_of_range);
}
TEST_F(VectorSUnitTest, element_access_operator_index)
{
vector_s<unsigned, 5> v{0u,1u,2u,3u,4u};
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v[3]);
EXPECT_EQ(4u, v[4]);
EXPECT_NO_THROW(v[5]);
// const variant of at()
vector_s<unsigned, 5> vc{0u,1u,2u,3u,4u};
EXPECT_EQ(0u, vc[0]);
EXPECT_EQ(1u, vc[1]);
EXPECT_EQ(2u, vc[2]);
EXPECT_EQ(3u, vc[3]);
EXPECT_EQ(4u, vc[4]);
EXPECT_NO_THROW(vc[5]);
}
TEST_F(VectorSUnitTest, element_access_front_back)
{
vector_s<unsigned, 4> v{1u,2u,3u,4u};
EXPECT_EQ(1u, v.front());
EXPECT_EQ(4u, v.back());
// const variant of front()/back()
const vector_s<unsigned, 4> vc{1u,2u,3u,4u};
EXPECT_EQ(1u, vc.front());
EXPECT_EQ(4u, vc.back());
}
TEST_F(VectorSUnitTest, access_raw_data)
{
vector_s<unsigned, 4> v{1u,2u,3u,4u};
EXPECT_EQ(1u, *(v.data()));
EXPECT_EQ(4u, *(v.data() + 3));
// const variant of data() function
vector_s<unsigned, 4> vc{1u,2u,3u,4u};
EXPECT_EQ(1u, *(vc.data()));
EXPECT_EQ(4u, *(vc.data() + 3));
}
// -----------------
// --- Iterators ---
// -----------------
TEST_F(VectorSUnitTest, iterator_loop)
{
using vec_t = vector_s<size_t, 4>;
{
vec_t v{1u,2u,3u,4u};
size_t count = 0;
for (auto& elem : v) {
++count;
EXPECT_EQ(count, elem);
elem = count + 1u;
}
EXPECT_EQ(4u, count);
EXPECT_EQ(2u, v[0]);
EXPECT_EQ(3u, v[1]);
EXPECT_EQ(4u, v[2]);
EXPECT_EQ(5u, v[3]);
}
// const
{
const vec_t v{1u,2u,3u,4u};
size_t count = 0;
for (const auto& elem : v) {
++count;
EXPECT_EQ(count, elem);
}
EXPECT_EQ(4u, count);
}
}
TEST_F(VectorSUnitTest, range_for_loop)
{
using vec_t = vector_s<size_t, 4>;
{
vec_t v{1u,2u,3u,4u};
size_t count = 0;
for (auto& e : v ) {
++count;
EXPECT_EQ(count, e);
e = count + 1u;
}
EXPECT_EQ(4u, count);
EXPECT_EQ(2u, v[0]);
EXPECT_EQ(3u, v[1]);
EXPECT_EQ(4u, v[2]);
EXPECT_EQ(5u, v[3]);
}
// const
{
const vec_t v{1u,2u,3u,4u};
size_t count = 0;
for (const auto& e : v ) {
++count;
EXPECT_EQ(count, e);
}
EXPECT_EQ(4u, count);
}
}
TEST_F(VectorSUnitTest, reverse_iterator_loop)
{
using vec_t = vector_s<size_t, 4>;
{
vec_t v{4u,3u,2u,1u};
size_t count = 0;
for (vec_t::reverse_iterator it = v.rbegin(); it != v.rend(); ++it) {
++count;
EXPECT_EQ(count, *it);
*it = count + 1u;
}
EXPECT_EQ(4u, count);
EXPECT_EQ(5u, v[0]);
EXPECT_EQ(4u, v[1]);
EXPECT_EQ(3u, v[2]);
EXPECT_EQ(2u, v[3]);
}
// const
{
const vec_t v{4u,3u,2u,1u};
size_t count = 0;
for (auto it = v.crbegin(); it != v.crend(); ++it) {
++count;
EXPECT_EQ(count, *it);
}
EXPECT_EQ(4u, count);
}
}
// ----------------
// --- Capacity ---
// ----------------
// NOTE: Tested in 'default_constructor_test'
// -----------------
// --- Modifiers ---
// -----------------
struct S {
S() = default;
explicit S(size_t v) : val(v) { ++count_constructor; }
S( const S& other) = default;
~S() { ++count_destructor; }
size_t val = 0;
static size_t count_constructor;
static size_t count_destructor;
};
size_t S::count_constructor = 0;
size_t S::count_destructor = 0;
TEST_F(VectorSUnitTest, clear)
{
using vec_t = vector_s<S, 10>;
vec_t v{S(1u),S(2u),S(3u),S(4u)};
EXPECT_FALSE(v.empty());
EXPECT_EQ(4u, v.size());
EXPECT_EQ(10u, v.capacity());
EXPECT_EQ(10u, v.max_size());
EXPECT_EQ(4u, S::count_constructor);
EXPECT_EQ(4u, S::count_destructor);
v.clear();
EXPECT_EQ(static_cast<size_t>(0u), v.size());
EXPECT_EQ(8u, S::count_destructor);
}
TEST_F(VectorSUnitTest, insert_single_element)
{
vector_s<std::string, 10> v{"0","1","2"};
EXPECT_EQ("0", v[0]);
EXPECT_EQ("1", v[1]);
EXPECT_EQ("2", v[2]);
EXPECT_EQ(3u, v.size());
const auto it1 = v.insert(v.begin(), "10");
EXPECT_EQ("10", *it1);
EXPECT_EQ("10", v[0]);
EXPECT_EQ("0", v[1]);
EXPECT_EQ("1", v[2]);
EXPECT_EQ("2", v[3]);
EXPECT_EQ(4u, v.size());
const auto it2 = v.insert(v.begin()+2, "20");
EXPECT_EQ("20", *it2);
EXPECT_EQ("10", v[0]);
EXPECT_EQ("0", v[1]);
EXPECT_EQ("20", v[2]);
EXPECT_EQ("1", v[3]);
EXPECT_EQ("2", v[4]);
EXPECT_EQ(5u, v.size());
const auto it3 = v.insert(v.end(), "50");
EXPECT_EQ("50", *it3);
EXPECT_EQ("10", v[0]);
EXPECT_EQ("0", v[1]);
EXPECT_EQ("20", v[2]);
EXPECT_EQ("1", v[3]);
EXPECT_EQ("2", v[4]);
EXPECT_EQ("50", v[5]);
EXPECT_EQ(6u, v.size());
}
TEST_F(VectorSUnitTest, insert_multiple_elements)
{
vector_s<unsigned, 10> v{0u,1u,2u};
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
// Insert zero elements
v.insert(v.begin(), 0, 10u);
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
// Insert 3 elements from start
const auto it1 = v.insert(v.begin(), 3, 10u);
EXPECT_EQ(10u, *it1);
EXPECT_EQ(10u, *(it1 + 1));
EXPECT_EQ(10u, *(it1 + 2));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(10u, v[1]);
EXPECT_EQ(10u, v[2]);
EXPECT_EQ(0u, v[3]);
EXPECT_EQ(1u, v[4]);
EXPECT_EQ(2u, v[5]);
EXPECT_EQ(6u, v.size());
// Insert 2 elements in the middle
const auto it2 = v.insert(v.begin()+3, 2, 20u);
EXPECT_EQ(20u, *it2);
EXPECT_EQ(20u, *(it2 + 1));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(10u, v[1]);
EXPECT_EQ(10u, v[2]);
EXPECT_EQ(20u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(0u, v[5]);
EXPECT_EQ(1u, v[6]);
EXPECT_EQ(2u, v[7]);
EXPECT_EQ(8u, v.size());
// Insert 2 elements 'in' the end
const auto it3 = v.insert(v.end(), 2, 50u);
EXPECT_EQ(50u, *it3);
EXPECT_EQ(50u, *(it3 + 1));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(10u, v[1]);
EXPECT_EQ(10u, v[2]);
EXPECT_EQ(20u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(0u, v[5]);
EXPECT_EQ(1u, v[6]);
EXPECT_EQ(2u, v[7]);
EXPECT_EQ(50u, v[8]);
EXPECT_EQ(50u, v[9]);
EXPECT_EQ(10u, v.size());
}
TEST_F(VectorSUnitTest, insert_iterator_range)
{
constexpr std::array<unsigned, 3> src{10u,20u,30u};
vector_s<unsigned, 12> v{0u,1u,2u};
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
// Insert zero elements
v.insert(v.begin(), src.begin(), src.begin());
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
// Insert 3 elements from start
const auto it1 = v.insert(v.begin(), src.begin(), src.end());
EXPECT_EQ(v.begin(), it1);
EXPECT_EQ(src[0], *it1);
EXPECT_EQ(src[1], *(it1 + 1));
EXPECT_EQ(src[2], *(it1 + 2));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(0u, v[3]);
EXPECT_EQ(1u, v[4]);
EXPECT_EQ(2u, v[5]);
EXPECT_EQ(6u, v.size());
// Insert 3 elements in the middle
const auto it2 = v.insert(v.begin()+3, src.begin(), src.end());
EXPECT_EQ(v.begin()+3, it2);
EXPECT_EQ(src[0], *it2);
EXPECT_EQ(src[1], *(it2 + 1));
EXPECT_EQ(src[2], *(it2 + 2));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(10u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(30u, v[5]);
EXPECT_EQ(0u, v[6]);
EXPECT_EQ(1u, v[7]);
EXPECT_EQ(2u, v[8]);
EXPECT_EQ(9u, v.size());
// Insert 3 elements 'in' the end
const auto it3 = v.insert(v.end(), src.begin(), src.end());
EXPECT_EQ(v.begin()+9, it3);
EXPECT_EQ(src[0], *it3);
EXPECT_EQ(src[1], *(it3 + 1));
EXPECT_EQ(src[2], *(it3 + 2));
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(10u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(30u, v[5]);
EXPECT_EQ(0u, v[6]);
EXPECT_EQ(1u, v[7]);
EXPECT_EQ(2u, v[8]);
EXPECT_EQ(10u, v[9]);
EXPECT_EQ(20u, v[10]);
EXPECT_EQ(30u, v[11]);
EXPECT_EQ(12u, v.size());
}
TEST_F(VectorSUnitTest, insert_initializer_list)
{
vector_s<unsigned, 12> v{0u,1u,2u};
EXPECT_EQ(0u, v[0]);
EXPECT_EQ(1u, v[1]);
EXPECT_EQ(2u, v[2]);
EXPECT_EQ(3u, v.size());
// Insert 3 elements from start
v.insert(v.begin(), {10u,20u,30u});
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(0u, v[3]);
EXPECT_EQ(1u, v[4]);
EXPECT_EQ(2u, v[5]);
EXPECT_EQ(6u, v.size());
// Insert 3 elements in the middle
v.insert(v.begin()+3, {10u,20u,30u});
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(10u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(30u, v[5]);
EXPECT_EQ(0u, v[6]);
EXPECT_EQ(1u, v[7]);
EXPECT_EQ(2u, v[8]);
EXPECT_EQ(9u, v.size());
// Insert 3 elements 'in' the end
v.insert(v.end(), {10u,20u,30u});
EXPECT_EQ(10u, v[0]);
EXPECT_EQ(20u, v[1]);
EXPECT_EQ(30u, v[2]);
EXPECT_EQ(10u, v[3]);
EXPECT_EQ(20u, v[4]);
EXPECT_EQ(30u, v[5]);
EXPECT_EQ(0u, v[6]);
EXPECT_EQ(1u, v[7]);
EXPECT_EQ(2u, v[8]);
EXPECT_EQ(10u, v[9]);
EXPECT_EQ(20u, v[10]);
EXPECT_EQ(30u, v[11]);
EXPECT_EQ(12u, v.size());
}
TEST_F(VectorSUnitTest, emplace)
{
vector_s<Rect, 6> v{ {1u,1u}, {2u,2u}, {3u,3u}, {4u,4u} };
EXPECT_EQ(Rect(1u, 1u), v[0]);
EXPECT_EQ(Rect(2u, 2u), v[1]);
EXPECT_EQ(Rect(3u, 3u), v[2]);
EXPECT_EQ(Rect(4u, 4u), v[3]);
EXPECT_EQ(4u, v.size());
const auto it = v.emplace(v.begin()+1, 10u, 10u);
EXPECT_EQ(Rect(10u, 10u), *it);
EXPECT_EQ(5u, v.size());
EXPECT_EQ(Rect(1u, 1u), v[0]);
EXPECT_EQ(Rect(10u, 10u), v[1]);
EXPECT_EQ(Rect(2u, 2u), v[2]);
EXPECT_EQ(Rect(3u, 3u), v[3]);
EXPECT_EQ(Rect(4u, 4u), v[4]);
}
TEST_F(VectorSUnitTest, erase_single_element)
{
vector_s<unsigned, 12> v{0u, 1u, 2u, 3u, 4u, 5u};
EXPECT_EQ(6u, v.size());
// Erase one element from the beginning
const auto it1 = v.erase(v.begin());
EXPECT_EQ(1u, *it1);
EXPECT_EQ(v.begin(), it1);
EXPECT_EQ(5u, v.size());
EXPECT_EQ(1u, v[0]);
EXPECT_EQ(2u, v[1]);
EXPECT_EQ(3u, v[2]);
EXPECT_EQ(4u, v[3]);
EXPECT_EQ(5u, v[4]);
// Erase one element from the middle
const auto it2 = v.erase(v.begin()+2);
EXPECT_EQ(4u, *it2);
EXPECT_EQ(v.begin()+2, it2);
EXPECT_EQ(4u, v.size());
EXPECT_EQ(1u, v[0]);
EXPECT_EQ(2u, v[1]);
EXPECT_EQ(4u, v[2]);
EXPECT_EQ(5u, v[3]);
// Erase last element
const auto it3 = v.erase(v.end()-1);
EXPECT_EQ(v.end(), it3);
EXPECT_EQ(3u, v.size());
EXPECT_EQ(1u, v[0]);
EXPECT_EQ(2u, v[1]);
EXPECT_EQ(4u, v[2]);
}
TEST_F(VectorSUnitTest, erase_range_of_elements)
{
vector_s<unsigned, 12> v{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u};
EXPECT_EQ(12u, v.size());
// Erase 3 elements from the beginning
const auto it1 = v.erase(v.begin(), v.begin() +3);
EXPECT_EQ(v.begin(), it1);
EXPECT_EQ(3u, *it1);
EXPECT_EQ(9u, v.size());
EXPECT_EQ(3u, v[0]);
EXPECT_EQ(4u, v[1]);
EXPECT_EQ(5u, v[2]);
EXPECT_EQ(6u, v[3]);
EXPECT_EQ(7u, v[4]);
EXPECT_EQ(8u, v[5]);
EXPECT_EQ(9u, v[6]);
EXPECT_EQ(10u, v[7]);
EXPECT_EQ(11u, v[8]);
// Erase 3 elements from the middle
const auto it2 = v.erase(v.begin()+3, v.begin()+6);
EXPECT_EQ(v.begin()+3, it2);
EXPECT_EQ(9u, *it2);
EXPECT_EQ(6u, v.size());
EXPECT_EQ(3u, v[0]);
EXPECT_EQ(4u, v[1]);
EXPECT_EQ(5u, v[2]);
EXPECT_EQ(9u, v[3]);
EXPECT_EQ(10u, v[4]);
EXPECT_EQ(11u, v[5]);
// Erase 3 last element
const auto it3 = v.erase(v.end()-3, v.end());
EXPECT_EQ(v.end(), it3);
EXPECT_EQ(3u, v.size());
EXPECT_EQ(3u, v[0]);
EXPECT_EQ(4u, v[1]);
EXPECT_EQ(5u, v[2]);
}
TEST_F(VectorSUnitTest, emplace_back)
{
vector_s<Rect, 6> v{};
EXPECT_EQ(0u, v.size());
const auto& ret1 = v.emplace_back(1u,2u);
EXPECT_EQ(Rect(1u, 2u), ret1);
EXPECT_EQ(Rect(1u, 2u), v.back());
EXPECT_EQ(1u, v.size());
const auto& ret2 = v.emplace_back(2u,3u);
EXPECT_EQ(Rect(2u, 3u), ret2);
EXPECT_EQ(Rect(2u, 3u), v.back());
EXPECT_EQ(2u, v.size());
}
TEST_F(VectorSUnitTest, pop_back)
{
vector_s<unsigned, 12> v{0u, 1u, 2u, 3u, 4u, 5u};
EXPECT_EQ(6u, v.size());
EXPECT_EQ(5u, v.back());
v.pop_back();
EXPECT_EQ(4u, v.back());
EXPECT_EQ(5u, v.size());
v.pop_back();
EXPECT_EQ(3u, v.back());
EXPECT_EQ(4u, v.size());
}
TEST_F(VectorSUnitTest, swap)
{
// NOTE: The reason for using different capacities here
// is to exercise the mixed-capacity constructors, assigment
// and equality functions/operators.
vector_s<unsigned, 12> original_v1{0u, 1u, 2u, 3u, 4u, 5u};
vector_s<unsigned, 11> original_v2{0u, 1u, 2u};
vector_s<unsigned, 10> v1 = original_v1;
vector_s<unsigned, 9> v2 = original_v2;
EXPECT_EQ(6u, v1.size());
EXPECT_EQ(3u, v2.size());
v1.swap(v2);
EXPECT_EQ(6u, v2.size());
EXPECT_EQ(3u, v1.size());
EXPECT_EQ(v1, original_v2);
EXPECT_EQ(v2, original_v1);
}
#endif // (CXX_STANDARD != 98)
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 27.06808
| 91
| 0.57564
|
mlutken
|
25c1dcf30031bb224d23644a9edb4afa00324808
| 1,255
|
cpp
|
C++
|
noise.cpp
|
ursinus-cs174-s2022/HW2_Steganography
|
af8ad24dbb6be42b5c4cb9f46b66cd8abfc3d3fe
|
[
"Apache-2.0"
] | null | null | null |
noise.cpp
|
ursinus-cs174-s2022/HW2_Steganography
|
af8ad24dbb6be42b5c4cb9f46b66cd8abfc3d3fe
|
[
"Apache-2.0"
] | null | null | null |
noise.cpp
|
ursinus-cs174-s2022/HW2_Steganography
|
af8ad24dbb6be42b5c4cb9f46b66cd8abfc3d3fe
|
[
"Apache-2.0"
] | null | null | null |
/**
* @file grayscale.cpp
* @author Chris Tralie
*
* Purpose: To add a certain amount of noise to an image
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sstream>
#include "simplecanvas/SimpleCanvas.h"
#include "randutils.h"
using namespace std;
/**
* @brief Add noise to every channel of every pixel
*
* @param image Image to which to add noise
* @param snr Signal to noise ratio
*/
void noise(SimpleCanvas& image, float snr) {
RandFloat r;
float amt = 255/snr;
for (int i = 0; i < image.height; i++) {
for (int j = 0; j < image.width; j++) {
for (int k = 0; k < 3; k++) {
float x = (float)image.data[i][j][k];
x += amt*(r.nextFloat()-0.5);
if (x > 255) {
x = 255;
}
if (x < 0) {
x = 0;
}
image.data[i][j][k] = (uint8_t)x;
}
}
}
}
int main(int argc, char** argv) {
if (argc < 4) {
printf("Usage: ./noise <image in> <snr> <image out>\n");
return 1;
}
SimpleCanvas image(argv[1]);
float snr = atof(argv[2]);
noise(image, snr);
image.write(argv[3]);
return 0;
}
| 22.818182
| 64
| 0.495618
|
ursinus-cs174-s2022
|
5adeeb047ecd3ce367a32b84c6f8778bde34cb8d
| 1,335
|
cpp
|
C++
|
boboleetcode/Play-Leetcode-master/0672-Bulb-Switcher-II/cpp-0672/main2.cpp
|
mcuallen/CodeLrn2019
|
adc727d92904c5c5d445a2621813dfa99474206d
|
[
"Apache-2.0"
] | 2
|
2019-03-20T17:05:59.000Z
|
2019-10-15T07:56:45.000Z
|
boboleetcode/Play-Leetcode-master/0672-Bulb-Switcher-II/cpp-0672/main2.cpp
|
mcuallen/CodeLrn2019
|
adc727d92904c5c5d445a2621813dfa99474206d
|
[
"Apache-2.0"
] | 6
|
2019-12-04T06:08:32.000Z
|
2021-05-10T20:22:47.000Z
|
boboleetcode/Play-Leetcode-master/0672-Bulb-Switcher-II/cpp-0672/main2.cpp
|
mcuallen/CodeLrn2019
|
adc727d92904c5c5d445a2621813dfa99474206d
|
[
"Apache-2.0"
] | null | null | null |
/// Source : https://leetcode.com/problems/bulb-switcher-ii/description/
/// Author : liuyubobobo
/// Time : 2017-12-02
#include <iostream>
#include <unordered_set>
using namespace std;
/// For further analysis, we can see the first three lights uniquely determine the rest of the sequence
/// Assume the four operation is a, b, c, d, then:
/// - Light 1 = 1 + a + c + d
/// - Light 2 = 1 + a + b
/// - Light 3 = 1 + a + c
/// - Light 4 = 1 + a + b + d
/// - Light 5 = 1 + a + c
/// - Light 6 = 1 + a + b
///
/// so that (module 2)
/// - Light 4 = (Light 1) + (Light 2) + (Light 3)
/// - Light 5 = Light 3
/// - Light 6 = Light 2
///
/// so there's just 8 cases, we can enumerate all these 8 cases and get the result.
///
/// Time Complexity: O(1)
/// Space Complexity: O(1)
class Solution {
public:
int flipLights(int n, int m) {
n = min(n, 3);
if (m == 0) return 1;
if (m == 1) return n == 1 ? 2 : n == 2 ? 3 : 4;
if (m == 2) return n == 1 ? 2 : n == 2 ? 4 : 7;
return n == 1 ? 2 : n == 2 ? 4 : 8;
}
};
int main() {
cout << Solution().flipLights(1, 1) << endl;
cout << Solution().flipLights(2, 1) << endl;
cout << Solution().flipLights(3, 1) << endl;
cout << Solution().flipLights(3, 3) << endl;
cout << Solution().flipLights(3, 2) << endl;
return 0;
}
| 27.244898
| 103
| 0.538577
|
mcuallen
|
5ae569aec9055db273a7666f15859ef8ee7f7031
| 544
|
cpp
|
C++
|
Sorting Algorithms/insertionSort.cpp
|
Raghav1806/Data-Structures-CSL-201-
|
2e4e3c67e3ff28ac6a9e1f06fe12a2864b17d177
|
[
"MIT"
] | null | null | null |
Sorting Algorithms/insertionSort.cpp
|
Raghav1806/Data-Structures-CSL-201-
|
2e4e3c67e3ff28ac6a9e1f06fe12a2864b17d177
|
[
"MIT"
] | null | null | null |
Sorting Algorithms/insertionSort.cpp
|
Raghav1806/Data-Structures-CSL-201-
|
2e4e3c67e3ff28ac6a9e1f06fe12a2864b17d177
|
[
"MIT"
] | null | null | null |
// insertion sort algorithm
#include <iostream>
using namespace std;
int main(){
int size, i, j, curr;
cout << "Enter the size of array to be sorted\n";
cin >> size;
int A[size];
cout << "Enter the elements of array\n";
for(i = 0; i < size; i++)
cin >> A[i];
for(i = 0; i < size - 1; i++){
j = i + 1;
curr = A[j];
while(j > 0 && A[j - 1] > A[j]){
A[j] = A[j - 1];
A[j - 1] = curr;
j--;
}
}
cout << "The sorted array is\n";
for(i = 0; i < size; i++)
cout << A[i] << " ";
cout << "\n";
return 0;
}
| 16
| 50
| 0.483456
|
Raghav1806
|
5ae97766fa4dcf353527302a99c555db13297345
| 6,580
|
hpp
|
C++
|
include/mxx/type_traits.hpp
|
asrivast28/mxx
|
75a4a7b8b04922f070991f1d9a4351e339a0d848
|
[
"Apache-2.0"
] | 76
|
2015-09-28T22:06:07.000Z
|
2022-03-25T17:47:34.000Z
|
include/mxx/type_traits.hpp
|
asrivast28/mxx
|
75a4a7b8b04922f070991f1d9a4351e339a0d848
|
[
"Apache-2.0"
] | 23
|
2015-10-29T17:35:51.000Z
|
2021-09-07T09:56:56.000Z
|
include/mxx/type_traits.hpp
|
asrivast28/mxx
|
75a4a7b8b04922f070991f1d9a4351e339a0d848
|
[
"Apache-2.0"
] | 20
|
2015-10-29T17:18:01.000Z
|
2021-05-12T16:41:20.000Z
|
#ifndef MXX_TYPE_TRAITS
#define MXX_TYPE_TRAITS
#include <type_traits>
#include <vector>
#include <string>
namespace mxx {
// source for testing if member functions are available: http://stackoverflow.com/a/16824239/4639394
#define MXX_DEFINE_HAS_MEMBER(member) \
template<typename, typename T> \
struct has_member_ ## member {}; \
\
template<typename C, typename Ret, typename... Args> \
struct has_member_ ## member <C, Ret(Args...)> { \
private: \
template<typename T> \
static constexpr auto check(T*) \
-> typename \
std::is_same< \
decltype( std::declval<T>(). member ( std::declval<Args>()... ) ), \
Ret /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ \
>::type; /* attempt to call it and see if the return type is correct */ \
template <typename> \
static constexpr std::false_type check(...); \
typedef decltype(check<C>(0)) type; \
public: \
static constexpr bool value = type::value; \
};
#define MXX_DEFINE_HAS_STATIC_MEMBER(member) \
template<typename, typename T> \
struct has_static_member_ ## member {}; \
\
template<typename C, typename Ret, typename... Args> \
struct has_static_member_ ## member <C, Ret(Args...)> { \
private: \
template<typename T> \
static constexpr auto check(T*) \
-> typename \
std::is_same< \
decltype(T:: member ( std::declval<Args>()... ) ), \
Ret /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ \
>::type; /* attempt to call it and see if the return type is correct */ \
template<typename> \
static constexpr std::false_type check(...); \
typedef decltype(check<C>(0)) type; \
public: \
static constexpr bool value = type::value; \
};
#define MXX_DEFINE_IS_GLOBAL_FUNC(fname) \
template<typename U> \
struct is_global_func_ ## fname { \
private: \
typedef U signature; \
template <typename T, T> struct has_matching_sig; \
template <typename T> \
static std::true_type check(has_matching_sig<T*,& :: fname>*); \
template <typename T> \
static std::false_type check(...); \
typedef decltype(check<signature>(0)) type; \
public: \
static constexpr bool value = type::value; \
};
// own implementation of the HAS_MEMBER struct
template <typename, typename>
struct has_member_size : std::false_type {};
template <typename C, typename R, typename... Args>
struct has_member_size<C, R(Args...)> : std::integral_constant<bool,
std::is_same<decltype(std::declval<C>().size(std::declval<Args>()...)), R>::value> {};
// type traits returning whether the type `C` has the typedef member ::value_type
#define MXX_DEFINE_HAS_TYPEDEF(type_name) \
template <typename C, typename Enable = void> \
struct has_typedef_ ## type_name : std::false_type {}; \
template <typename C> \
struct has_typedef_ ## type_name <C, typename std::enable_if< \
!std::is_same<typename C:: type_name ,void>::value>::type> \
: std::true_type {};
MXX_DEFINE_HAS_TYPEDEF(value_type)
MXX_DEFINE_HAS_TYPEDEF(iterator)
MXX_DEFINE_HAS_TYPEDEF(const_iterator)
MXX_DEFINE_HAS_MEMBER(data)
//MXX_DEFINE_HAS_MEMBER(size)
MXX_DEFINE_HAS_MEMBER(resize)
MXX_DEFINE_HAS_MEMBER(end)
MXX_DEFINE_HAS_MEMBER(begin)
MXX_DEFINE_HAS_STATIC_MEMBER(datatype)
MXX_DEFINE_HAS_MEMBER(datatype)
// TODO: build this into the mxx/datatype structures
template <typename T, typename Enable = void>
struct has_datatype : std::false_type {};
/***********************************************************
* Compile-time reflection for members begin() and end() *
***********************************************************/
template <typename C, typename Enable = void>
struct has_nonconst_begin_end : std::false_type {};
template <typename C>
struct has_nonconst_begin_end<C, typename std::enable_if<has_typedef_iterator<C>::value>::type>
: std::integral_constant<bool,
has_member_begin<typename std::remove_const<C>::type, typename C::iterator()>::value
&& has_member_end<typename std::remove_const<C>::type, typename C::iterator()>::value> {};
template <typename C, typename Enable = void>
struct has_const_begin_end : std::false_type {};
template <typename C>
struct has_const_begin_end<C, typename std::enable_if<has_typedef_iterator<C>::value>::type>
: std::integral_constant<bool,
has_member_begin<const typename std::remove_const<C>::type, typename C::const_iterator()>::value
&& has_member_end<const typename std::remove_const<C>::type, typename C::const_iterator()>::value> {};
template <typename C>
struct has_begin_end : std::integral_constant<bool,
has_nonconst_begin_end<C>::value
&& has_const_begin_end<C>::value> {};
/**************************************************************
* Compile-time determination whether a type is a container *
**************************************************************/
/*
template <typename C, typename Enable = void>
struct is_container : std::false_type {};
*/
template <typename C, typename Enable = void>
struct is_container : std::integral_constant<bool,
has_begin_end<C>::value> {};
template <typename C, typename Enable = void>
struct is_flat_container : std::false_type {};
template <typename C>
struct is_flat_container<C, typename std::enable_if<has_typedef_value_type<C>::value>::type>
: std::integral_constant<bool,
is_container<C>::value
&& mxx::has_datatype<typename C::value_type>::value> {};
template <typename C, typename Enable = void>
struct is_contiguous_container : std::false_type {};
template <typename T, typename A>
struct is_contiguous_container<std::vector<T,A>> : std::true_type {};
template <typename C, typename CT, typename A>
struct is_contiguous_container<std::basic_string<C, CT, A>> : std::true_type {};
// anything that's templated by at least its value type T and has the member functions
// size_t size(), void resize(size_t size), and T* data()
template <template <typename, typename...> class C, typename T, typename... Targs>
struct is_contiguous_container<C<T,Targs...>> : std::integral_constant<bool,
has_member_data<C<T,Targs...>, T*()>::value &&
has_member_size<C<T,Targs...>, std::size_t()>::value &&
has_member_resize<C<T,Targs...>, void(std::size_t)>::value> {};
template <typename C>
struct is_flat_contiguous_container : std::integral_constant<bool,
is_contiguous_container<C>::value && is_flat_container<C>::value> {};
template <typename C, typename Enable = void>
struct is_flat_type : std::integral_constant<bool,
is_contiguous_container<C>::value> {};
} // namespace mxx
#endif // MXX_TYPE_TRAITS
| 35.956284
| 106
| 0.670365
|
asrivast28
|
5aea383e89d1bf70f266b1ec1b9d000edd891f76
| 6,986
|
cpp
|
C++
|
wled00/Effect/snowflake/StarBurst.cpp
|
mdraper81/WLED
|
408696ef02f7b2dd66300a6a2ddb67a74d037b88
|
[
"MIT"
] | null | null | null |
wled00/Effect/snowflake/StarBurst.cpp
|
mdraper81/WLED
|
408696ef02f7b2dd66300a6a2ddb67a74d037b88
|
[
"MIT"
] | null | null | null |
wled00/Effect/snowflake/StarBurst.cpp
|
mdraper81/WLED
|
408696ef02f7b2dd66300a6a2ddb67a74d037b88
|
[
"MIT"
] | null | null | null |
#include "StarBurst.h"
namespace Effect
{
namespace Snowflake
{
/*
** ============================================================================
** Constructor
** ============================================================================
*/
StarBurst::StarBurst(NeoPixelWrapper* pixelWrapper, Data* effectData)
: BaseSnowFlake(pixelWrapper, effectData)
, mEffectLengthInTicks(0)
, mHoldLengthInTicks(0)
, mCurrentTick(0)
{
}
/*
** ============================================================================
** Destructor
** ============================================================================
*/
StarBurst::~StarBurst()
{
}
/*
** ============================================================================
** Run the current effect
** ============================================================================
*/
bool StarBurst::runEffect(uint32_t delta)
{
incrementRunningTime(delta);
updateEffectData();
// This effect will light one LED at a time all the way up the length of the
// arm and to the ends of the large chevron. This will take a total number
// of ticks equal to the arm length and half the large chevron length (in case
// the large chevron length is odd we'll round up);
mEffectLengthInTicks = mArmLength + getNumberOfTicksForLargeChevron();
// We'll hold the effect for half the time that it took to light up all LEDs
mHoldLengthInTicks = mEffectLengthInTicks / 2;
mCurrentTick = getCurrentTick() % (mEffectLengthInTicks + mHoldLengthInTicks);
if (mCurrentTick == 0)
{
// Turn off all LEDs to reset the effect
setPixelColorForRange(mStartingAddress, mNumLEDs, 0x00000000);
}
else
{
// Process the effect to turn on the next LED (or hold the effect)
for (int armIndex = 0; armIndex < mNumberOfArms; ++armIndex)
{
processArm(armIndex);
}
}
}
/*
** ============================================================================
** Process the LEDs in the arm with the given index. This will turn on the
** correct LEDs for this arm
** ============================================================================
*/
void StarBurst::processArm(int armIndex)
{
// Turn on the correct number of LEDs in the arm for where we are in the
// effect (what tick we are on).
const uint16_t armStartingAddress = getStartingAddressForArmIndex(armIndex);
for (int armAddressIndex = 0; armAddressIndex < mArmLength; ++armAddressIndex)
{
uint16_t address = armStartingAddress + armAddressIndex;
if (mCurrentTick > armAddressIndex)
{
// This LED should be on
const int effectOffset = armAddressIndex;
setPixelColorFromPalette(address, effectOffset);
}
else
{
// The LED should be off since we haven't gotten to this address yet
setPixelColor(address, 0x00000000);
}
}
// If the current tick is greater than the small chevron position then we
// should start lighting up LEDs in the small chevron
if (mCurrentTick > mSmallChevronPosition)
{
processSmallChevron(armIndex);
}
// If the current tick is greater than the arm length then we have reached
// the end of the arm and should start lighting up LEDs in the large chevron
if (mCurrentTick > mArmLength)
{
processLargeChevron(armIndex);
}
}
/*
** ============================================================================
** Process the LEDs in the small chevron for the arm with the given index.
** This will turn on the correct LEDs.
** ============================================================================
*/
void StarBurst::processSmallChevron(int armIndex)
{
// This is a paranoia check to ensure that we only turn the LEDs on if we
// have reached the small chevron
if (mCurrentTick > mSmallChevronPosition)
{
const uint8_t numTicksToProcess = getNumberOfTicksForSmallChevron();
const uint16_t smallChevronStartingAddress_Left = getStartingAddressForSmallChevron(armIndex, true);
const uint16_t smallChevronStartingAddress_Right = getStartingAddressForSmallChevron(armIndex, false);
for (uint8_t chevronAddressIndex = 0; chevronAddressIndex < numTicksToProcess; ++chevronAddressIndex)
{
const uint16_t leftAddress = smallChevronStartingAddress_Left + chevronAddressIndex;
const uint16_t rightAddress = smallChevronStartingAddress_Right + chevronAddressIndex;
if (mCurrentTick > mSmallChevronPosition + chevronAddressIndex)
{
// This LED should be on
const int effectOffset = mSmallChevronPosition + chevronAddressIndex;
setPixelColorFromPalette(leftAddress, effectOffset);
setPixelColorFromPalette(rightAddress, effectOffset);
}
else
{
// The LED should be off since we haven't gotten to this address yet
setPixelColor(leftAddress, 0x00000000);
setPixelColor(rightAddress, 0x00000000);
}
}
}
}
/*
** ============================================================================
** Process the LEDs in the large chevron for the arm with the given index.
** This will turn on the correct LEDs.
** ============================================================================
*/
void StarBurst::processLargeChevron(int armIndex)
{
// This is a paranoia check to ensure that we only turn the LEDs on if we
// have reached the large chevron
if (mCurrentTick > mArmLength)
{
const uint8_t numTicksToProcess = getNumberOfTicksForLargeChevron();
const uint16_t largeChevronStartingAddress_Left = getStartingAddressForLargeChevron(armIndex, true);
const uint16_t largeChevronStartingAddress_Right = getStartingAddressForLargeChevron(armIndex, false);
for (uint8_t chevronAddressIndex = 0; chevronAddressIndex < numTicksToProcess; ++chevronAddressIndex)
{
const uint16_t leftAddress = largeChevronStartingAddress_Left + chevronAddressIndex;
const uint16_t rightAddress = largeChevronStartingAddress_Right + chevronAddressIndex;
if (mCurrentTick > mArmLength + chevronAddressIndex)
{
// This LED should be on
const int effectOffset = mArmLength + chevronAddressIndex;
setPixelColorFromPalette(leftAddress, effectOffset);
setPixelColorFromPalette(rightAddress, effectOffset);
}
else
{
// The LED should be off since we haven't gotten to this address yet
setPixelColor(leftAddress, 0x00000000);
setPixelColor(rightAddress, 0x00000000);
}
}
}
}
} // namespace Effect::Snowflake
} // namespace Effect
| 38.174863
| 110
| 0.577584
|
mdraper81
|
5aebf0364bd5cea46e2b0c66afdcb8edb69e3c2a
| 4,374
|
cpp
|
C++
|
leetcode/37-permutation.cpp
|
Moonshile/MyAlgorithmCandy
|
e1ab006a5abe7d2749ae564ad2bffc4a628ed31b
|
[
"Apache-2.0"
] | 2
|
2016-11-26T02:56:35.000Z
|
2019-06-17T04:09:02.000Z
|
leetcode/37-permutation.cpp
|
Moonshile/MyAlgorithmCandy
|
e1ab006a5abe7d2749ae564ad2bffc4a628ed31b
|
[
"Apache-2.0"
] | null | null | null |
leetcode/37-permutation.cpp
|
Moonshile/MyAlgorithmCandy
|
e1ab006a5abe7d2749ae564ad2bffc4a628ed31b
|
[
"Apache-2.0"
] | 3
|
2016-07-18T14:13:20.000Z
|
2019-06-17T04:08:32.000Z
|
class Solution {
private:
static inline int row(int i, int v) { return (i<<4) | v; }
static inline int col(int j, int v) { return 0x100 | (j<<4) | v; }
static inline int grid(int i, int j, int v) { return 0x200 | ((i/3*3 + j/3)<<4) | v; }
static inline bool isBusyCell(int i, int j, int v, vector<bool> &m) { return m[row(i, v)] || m[col(j, v)] || m[grid(i, j, v)]; }
static inline void setBusyCell(int i, int j, int v, vector<bool> &m) { m[row(i, v)] = m[col(j, v)] = m[grid(i, j, v)] = true; }
static inline void resetBusyCell(int i, int j, int v, vector<bool> &m) { m[row(i, v)] = m[col(j, v)] = m[grid(i, j, v)] = false; }
friend struct EmptyCell;
struct EmptyCell {
vector<int> positions;
vector<int> space;
EmptyCell(vector<int> p, vector<int> s): positions(p), space(s) {}
bool next_permutation_nlt(vector<int> &v, int offset) {
for (auto i = v.begin() + offset + 1; i != v.end(); ++i) {
if (*i > v[offset]) {
iter_swap(v.begin() + offset, i);
sort(v.begin() + offset + 1, v.end());
return !is_sorted(v.begin(), v.end());
}
}
return next_permutation(v.begin(), v.end());
}
bool forward(int i, vector<bool> &m) {
int k;
do {
for (k = 0; k < space.size(); ++k) {
int j = positions[k], v = space[k];
if (Solution::isBusyCell(i, j, v, m)) {
break;
} else {
Solution::setBusyCell(i, j, v, m);
}
}
if (k == space.size()) {
return true;
}
for (int w = 0; w < k; ++w) {
int j = positions[w], v = space[w];
Solution::resetBusyCell(i, j, v, m);
}
} while (next_permutation_nlt(space, k));
return false;
}
};
// return false if there is a row contains only one empty cell and the only value is invalid
bool install(vector<vector<char>> &board, vector<bool> &m, vector<EmptyCell> &map) {
for (int i = 0; i < 9; ++i) {
vector<int> positions, space;
for (int j = 0; j < 9; ++j) {
board[i][j] != '.' ? setBusyCell(i, j, board[i][j] - '0', m) : positions.push_back(j);
}
for (int v = 1; v <= 9; ++v) {
if (!m[row(i, v)]) {
space.push_back(v);
}
}
// if there is only one empty cell in the row, then try to fill it with the only value
if (space.size() == 1) {
int j = positions[0], v = space[0];
if (isBusyCell(i, j, v, m)) {
return false;
}
setBusyCell(i, j, v, m);
positions.clear();
space.clear();
}
EmptyCell ec(positions, space);
map.push_back(ec);
}
return true;
}
public:
void solveSudoku(vector<vector<char>>& board) {
vector<bool> m(0x300, false);
vector<EmptyCell> map;
install(board, m, map);
int i = 0;
while (i >= 0) {
// forwarding
for(; i < 9; ++i) {
if (map[i].space.size() > 0 && !map[i].forward(i, m)) {
break;
}
}
// success
if (i == 9) {
for (int ii = 0; ii < 9; ++ii) {
for (int k = 0; k < map[ii].space.size(); ++k) {
int j = map[ii].positions[k], v = map[ii].space[k] + '0';
board[ii][j] = v;
}
}
return;
}
// backwarding
for (--i; i >= 0; --i) {
for (int k = 0; k < map[i].space.size(); ++k) {
int j = map[i].positions[k], v = map[i].space[k];
resetBusyCell(i, j, v, m);
}
if (next_permutation(map[i].space.begin(), map[i].space.end())) {
break;
}
}
}
}
};
| 37.706897
| 134
| 0.405121
|
Moonshile
|
5aecb24cb91e7cbab905d3f4d806d586dd28db20
| 102,616
|
cc
|
C++
|
src/utils/opp_lcg32_seedtool.cc
|
eniac/parallel-inet-omnet
|
810ed40aecac89efbd0b6a05ee10f44a09417178
|
[
"Xnet",
"X11"
] | 15
|
2021-08-20T08:10:01.000Z
|
2022-03-24T21:24:50.000Z
|
src/utils/opp_lcg32_seedtool.cc
|
eniac/parallel-inet-omnet
|
810ed40aecac89efbd0b6a05ee10f44a09417178
|
[
"Xnet",
"X11"
] | 1
|
2022-03-30T09:03:39.000Z
|
2022-03-30T09:03:39.000Z
|
src/utils/opp_lcg32_seedtool.cc
|
eniac/parallel-inet-omnet
|
810ed40aecac89efbd0b6a05ee10f44a09417178
|
[
"Xnet",
"X11"
] | 3
|
2021-08-20T08:10:34.000Z
|
2021-12-02T06:15:02.000Z
|
//=========================================================================
// SEEDTOOL.CC - part of
//
// OMNeT++/OMNEST
// Discrete System Simulation in C++
//
// seedtool utility
//
// To compile under Unix: gcc seedtool -o seedtool
//
// Author: Andras Varga
//
//=========================================================================
/*--------------------------------------------------------------*
Copyright (C) 1992 Andras Varga, Gyorgy Pongor
Copyright (C) 1992-2008 Andras Varga
Copyright (C) 2006-2008 OpenSim Ltd.
This file is distributed WITHOUT ANY WARRANTY. See the file
`license' for details on this and other legal matters.
*--------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "../common/ver.h"
#define INTRAND_MAX 0x7ffffffeL /* = 2**31-2 */
#define TABLESIZE 4096
struct hashelem {long index; long seed;};
extern struct hashelem hashtable[TABLESIZE];
/*------- long int pseudorandom number generator -------------
* Range: 1 ... 2**31-2
* Period length: 2**31-2
* Global variable used: long int theSeed : seed
* Method: x=(x * 7**5) mod (2**31-1)
* To check: if x[0]=1 then x[10000]=1,043,618,065
* Required hardware: exactly 32-bit integer aritmetics
* Source: Raj Jain: The Art of Computer Systems Performance Analysis
* (John Wiley & Sons, 1991) Pages 441-444, 455
*---------------------------------------------------------*/
long nextrand(long seed)
{
const long int a=16807, q=127773, r=2836;
seed=a*(seed%q) - r*(seed/q);
if (seed<=0) seed+=INTRAND_MAX+1;
return seed;
}
int testrand()
{
long seed = 1;
for(int i=0; i<10000; i++) seed=nextrand(seed);
int good = (seed==1043618065L);
return good;
}
void filltable()
{
const long cyclelength = 0x7FFFFFFE;
const long gap = cyclelength/TABLESIZE;
long i, seed, nextstop, k;
// init the table
for(i=0; i<TABLESIZE; i++)
hashtable[i].index = hashtable[i].seed = -1;
// fill out the table
i=0; seed=1; nextstop=0; k=0;
do {
if (i>=nextstop)
{
// generate hash value out of seed
int hashvalue = seed%TABLESIZE;
// insert it into the table if its slot is unused
if (hashtable[hashvalue].index==-1)
{
hashtable[hashvalue].index = i;
hashtable[hashvalue].seed = seed;
nextstop += gap;
fprintf(stderr,"\r%ld",++k);
fflush(stderr);
}
}
// next seed value
seed = nextrand(seed);
i++;
} while (seed!=1);
printf("\n");
}
void printtable()
{
printf("struct hashelem hashtable[TABLESIZE] = {\n");
for(int i=0;i<TABLESIZE;i++)
{
printf( "{%ld,%ld},",
hashtable[i].index,
hashtable[i].seed
);
if (i%4==3) printf("\n");
}
printf("\n};");
}
long indexofseed(long seed)
{
// check seed passed
if (seed<=0 || seed>INTRAND_MAX)
{
fprintf(stderr,"Invalid seed %ld\n",seed);
exit(1);
}
// find closest match in the table
long i=0;
for(;;)
{
// generate hash value out of seed
int hashvalue = seed%TABLESIZE;
// is it in the table?
if (hashtable[hashvalue].seed==seed)
return hashtable[hashvalue].index - i;
// next seed value
seed = nextrand(seed);
i++;
}
}
long seedatindex(long index)
{
// find closest index in hashtable
int closest = -1;
long i;
for (i=0; i<TABLESIZE; i++)
if (hashtable[i].index<=index && (closest<0 || hashtable[i].index>hashtable[closest].index))
closest = i;
// cycle to desired index "on foot"
long seed = hashtable[closest].seed;
for(i = hashtable[closest].index; i<index; i++)
seed = nextrand(seed);
return seed;
}
int main(int argc, char *argv[])
{
if (argc==1)
{
fprintf(stderr,
"opp_lcg32_seedtool -- part of " OMNETPP_PRODUCT ", (C) 2006-2008 Andras Varga, OpenSim Ltd.\n"
"Version: " OMNETPP_VERSION_STR ", build: " OMNETPP_BUILDID ", edition: " OMNETPP_EDITION "\n"
"\n"
"Generates seeds for the LCG32 random number generator. This RNG has a\n"
"period length of 2^31-2, which makes about 2.147 billion random numbers.\n"
"\n"
"THIS PROGRAM IS OBSOLETE. OMNeT++ uses Mersenne Twister by default, which has\n"
"a practically infinite period length (2^19937), and needs no such seed generator.\n"
"\n"
"Usage:\n"
" seedtool i seed - index of 'seed' in cycle\n"
" seedtool s index - seed at index 'index' in cycle\n"
" seedtool d seed1 seed2 - distance of 'seed1' and 'seed2' in cycle\n"
" seedtool g seed0 dist - generate seed 'dist' away from 'seed0'\n"
" seedtool g seed0 dist n - generate 'n' seeds 'dist' apart, starting at 'seed0'\n"
" seedtool t - generate hashtable\n"
" seedtool p - print hashtable\n"
);
exit(0);
}
if (!testrand())
{
fprintf(stderr,"Random number generator does not work correctly!\n");
exit(1);
}
long arg[5];
for (int i=2; i<5; i++)
arg[i] = argc>i ? atol(argv[i]) : 0;
switch (argv[1][0])
{
case 'i':
printf("%ld\n", indexofseed( arg[2] ));
break;
case 's':
printf("%ld\n", seedatindex( arg[2] ));
break;
case 'd':
printf("%ld\n", indexofseed( arg[3] ) - indexofseed( arg[2] ));
break;
case 'g':
{
long index = indexofseed( arg[2] ),
dist = arg[3],
count = arg[4];
if (count==0) count=1;
/*
* 20020806, N. Reijers
* This runs into trouble if too many seeds, too far apart are requested.
* There are 2^31 seeds, but when we keep adding dist to index, it will
* eventually exceed 2^31.
* Because index is of type long, it doesn't loop until 2^32, so we get
* periods of 2^31/dist seeds followed by as many zeros.
* The fix applied here is the line index&=0x7fffffffL; which makes it loop.
* (effectively it does a index%=2^31;)
* The result is that a continuous stream of seeds is generated although,
* depending on dist, the period will be somewhere between 2^31/dist and
* 2^31.
*/
for (; count>0; count--)
{
index += dist;
index &= 0x7fffffffL; /* Fix. */
printf("%ld\n", seedatindex( index ));
}
}
break;
case 't':
filltable();
printtable();
break;
case 'p':
printtable();
break;
default:
fprintf(stderr,"Invalid switch %s\n",argv[1]);
return 1;
}
return 0;
}
//==========================================================================
// The following table was automatically generated with 'seedtool t > file'
struct hashelem hashtable[TABLESIZE] = {
{225443410,448950272},{0,1},{881326447,1096794114},{382205223,350486531},{1603793934,1682608132},
{1465382165,1332060165},{328203662,1203453958},{205520504,682684423},{665844490,662712328},
{201326209,1944424457},{1867510295,1134006282},{888142178,2036408331},{524811287,1442787340},
{190316182,170766349},{1582298168,221458446},{175111858,1634951183},{1707078472,1131225104},
{870840707,1356865553},{91225938,713355282},{1952969076,832454675},{1400370577,709382164},
{1819800181,987041813},{235929150,1975304214},{111673131,1846829079},{1023932513,69812248},
{1766847199,1719595033},{946862322,761995290},{1387787689,236412955},{461372560,2035470364},
{352320864,1209155613},{6291444,1616572446},{763886159,861655071},{883423595,1553391648},
{1282930289,2021711905},{1804595861,2011299874},{1824518770,1297158179},{1645212612,1569869860},
{1347941877,1370636325},{397933833,568291366},{562559951,378998823},{525335574,103219240},
{1903686101,584294441},{1525675178,1278636074},{1931473310,1154060331},{1422390632,2018992172},
{2068836517,4141101},{689961692,1996484654},{768080455,2000973871},{745011827,1179041840},
{855636386,2039369777},{2063593647,1644945458},{39845812,1226514483},{1821897341,1541886004},
{1299707473,959442997},{769653317,990683190},{715651756,932954167},{1808265881,839446584},
{16777184,583516217},{1805120145,1879564346},{1247278773,1752514619},{849869227,695664700},
{1828188776,1174114365},{1983377730,2111402046},{2096099538,1623355455},{1870656024,542462016},
{1296561755,412872769},{1943007639,1629278274},{1339553286,758440003},{1335883277,767418436},
{331349384,1461260357},{1696068448,803938374},{1543500933,823246919},{1618473969,1463713864},
{1555035242,393289801},{1734865688,351338570},{329776524,1934868555},{1303377484,585986124},
{1447032120,1571516493},{1386214828,1811361870},{1922560429,1798586447},{885520744,1159557200},
{331873671,1853395025},{1265628819,1334165586},{847247793,426844243},{80215911,953606228},
{310377904,234786901},{1576006722,841936982},{1366816209,1546641495},{1666708375,1373540440},
{1409283461,1349828697},{1936191895,1183199322},{155713239,1965199451},{298843590,599105628},
{1709175623,869097565},{1752691443,1780707422},{102760252,1571070047},{1931997608,1597710432},
{1085798377,245035105},{217579105,17199202},{1526723746,1141731427},{1656222636,348524644},
{1393554850,561471589},{182451877,997285990},{675281656,538529895},{212336235,1676873832},
{578288561,333746281},{1365767637,1868222570},{1594356771,606978155},{130023176,161980524},
{989853856,1840164973},{139984629,1245012078},{969406663,2017685615},{1521480879,1103036528},
{1287124591,734310513},{1707602760,354345074},{1970794834,1585688691},{1807217293,1341907060},
{1809314441,1529860213},{372768057,140619894},{447216811,1988796535},{734001800,1621143672},
{1085274091,954638457},{19398619,2127011962},{718797477,401801339},{515374121,86974588},
{1129314202,1538003069},{2021650683,760225918},{229637706,1098535039},{2028990730,1787859072},
{1455944999,1352798337},{1204811526,1900073090},{1047525426,1663127683},{217054818,965865604},
{997718161,812322949},{2038952172,751128710},{682097389,1563746439},{430963914,215142536},
{1703932755,19280009},{339737976,1581576330},{591395736,946602123},{1216870127,821276812},
{1094711256,685330573},{2138566769,2058440846},{1417147762,588292239},{938998017,1416867984},
{743963254,113270929},{1647834043,461963410},{328727949,438349971},{294649294,1662521492},
{1018165355,2083369109},{1724904237,1358074006},{139460342,1904025751},{1266677392,1868091544},
{664271629,765603993},{497024076,235450522},{935328008,486404251},{18874332,757579932},
{1138227080,2035470493},{1355281897,541892766},{1172305732,1597907103},{407370999,52568224},
{241172020,1684254881},{1274541700,823693474},{79691624,244301987},{1095759830,1912180900},
{1889006073,1480372389},{425721045,996950182},{1376253375,1175937191},{2120741100,1690255528},
{1974989129,551452841},{180354728,1989922986},{1473246470,1428873387},{1118828458,1247629484},
{1307571778,696344749},{447741098,613052590},{673184508,684441775},{2000679199,1558978736},
{1112012727,1023471793},{1665659806,1986539698},{1286600299,434897075},{2069360798,948887732},
{1757410033,1392574645},{622328670,269410486},{860879254,2020102327},{959445211,541262008},
{1394079138,564428985},{1981804885,1396134074},{236453437,1300271291},{1715991352,439771324},
{1762128613,2129072317},{1558705255,415916222},{115343140,2141974719},{1366291922,1618170048},
{573045693,504606913},{587725727,1391653058},{943192313,905875651},{1986523452,1894858948},
{1679291261,927056069},{61865866,280236230},{1792537254,463552711},{34078655,1483522248},
{121110297,701550793},{963115219,412168394},{584055718,1981071563},{1300756047,652255436},
{1933046181,1526038733},{1486353649,522199246},{1804071570,816099535},{679475952,1220571344},
{915405102,1087430865},{1868034585,319443154},{1973416278,1264013523},{948959470,1779298516},
{455605403,1213071573},{179830441,682369238},{90177364,772923607},{712506033,1402732760},
{1100478414,22339801},{1728049961,1190383834},{952629479,1410621659},{879753586,1031110876},
{150994656,1148367069},{782236204,1348813022},{1733817113,1583128799},{1568666705,892080352},
{1371534792,280383713},{1468527887,303300834},{1928851884,1881854179},{574094266,567697636},
{2107633749,1513136357},{1078982649,1399558374},{1677718400,755478759},{726137496,1033433320},
{665320205,199610601},{1624765417,603807978},{276823536,279015659},{446692524,1793765612},
{1700787051,746139885},{278920684,171671790},{1177024317,657981679},{283114980,736784624},
{661650194,108441841},{136314620,893821170},{1812984451,1636835571},{1416099187,1533169908},
{1188034342,1813913845},{1404040587,1128841462},{1577579591,703070455},{1096284117,634507512},
{1244657338,2053030137},{1506276554,1931268346},{1848635962,1411055867},{1007679614,292278524},
{83885920,119038205},{507509816,183132414},{1454372140,682860799},{846199219,319418624},
{241696307,854950145},{1962406258,157438210},{1222637284,1719038211},{1120401320,1970266372},
{249560612,1496523013},{1580725307,1354875142},{1360000485,1139630343},{1832907352,1183895816},
{2111828060,1267101961},{1906307533,1463787786},{265813509,1873330443},{1373107653,1944666380},
{1596978203,657486093},{196607625,609943822},{714603181,1783611663},{1297086042,1327038736},
{419429600,773591313},{1880617494,800997650},{1363146201,417493267},{1793585831,364245268},
{1406662023,705237269},{819460581,305926422},{281017832,960590103},{752351849,747389208},
{1717039927,386728217},{1847063110,237388058},{1943531926,989171995},{1109915579,386056476},
{940046591,1309557021},{1863316017,737956126},{1274017410,913649951},{1169684297,975909152},
{1709699919,1252188449},{1641018315,1086968098},{171966136,768741667},{1214772981,388469028},
{1666184087,1371423013},{418905313,958353702},{838334913,674476327},{1402467726,1383403816},
{2142237181,133194025},{316145061,1622049066},{1858597421,1016860971},{980940977,1847382316},
{1410856317,1945039149},{605551485,152727854},{208141939,772092207},{1491596516,394846512},
{206569078,1320091953},{651164455,1115742514},{1782051522,902844723},{904395076,1992180020},
{1639969736,483295541},{1609561090,1210581302},{93323086,1661600055},{1170732871,764473656},
{992999578,1543221561},{1268250254,1752793402},{2061496493,756404539},{1070069767,1535365436},
{908065084,2119835965},{105905974,447004990},{203947643,745017663},{1902637525,2035323200},
{1470625036,456720705},{1293940317,966865218},{2031087893,515277123},{1580201020,1433211204},
{761789011,239944005},{589822876,1407811910},{2124935221,765800775},{1458566434,1583567176},
{322436506,577896777},{2070409393,1667531082},{92798799,1305207115},{1402992013,695619916},
{26214350,1239789901},{1662514078,865120590},{1187510055,1494831439},{923269407,1179930960},
{1653601199,1462825297},{355466589,833524050},{49282978,1776021843},{1201141517,1699782996},
{1352136174,163905877},{1056438307,800264534},{727186069,1168757079},{486538337,2032382296},
{2019029263,2012655961},{721418913,259957082},{375913779,1139999067},{1494217950,1922802012},
{287833563,1118753117},{1892676077,1334284638},{1265104531,1826054495},{1453323565,2119528800},
{1857024561,19644769},{567802823,410636642},{2024272129,246387043},{207617652,1821061476},
{1905258961,877080933},{1390409127,537301350},{815266285,1190539623},{829422034,754233704},
{1775235782,634716521},{1747448577,412754282},{365428039,688894315},{610794355,1908306284},
{1353709035,1776075117},{468712581,520593774},{1533539475,1928278383},{1379923386,1891606896},
{123207445,1588994417},{637532992,1275359602},{1643639745,617234803},{342883698,1532207476},
{1595405341,421708149},{431488201,952549750},{2073555124,2056384887},{301989312,194961784},
{2118119516,1162678649},{1447556412,1647120762},{699398860,1790841211},{1881141757,1413079420},
{1403516300,222781821},{1739584266,659394942},{608697207,152785279},{229113419,963457408},
{26738637,89227649},{1142945660,251556226},{1715467064,1949761923},{737147522,1698099588},
{2075128010,386232709},{910686520,219640198},{131596037,1334854023},{325057940,342524296},
{1126168476,1507574153},{1321727527,1598329226},{1482683639,939680139},{1004009606,853021068},
{414186730,1340805517},{1247803062,1294057870},{2041573604,1167884687},{1388836263,1617457552},
{267386370,1108701585},{78643050,522199442},{220200540,1523306899},{1712321342,1627132308},
{654310176,710447509},{1528296607,1003721110},{198180486,1875599767},{9961453,1408156056},
{1476916483,250286489},{2039476456,171946394},{389545241,2082066843},{187694746,436801948},
{775420473,1773719965},{1814557318,871215518},{285212128,389554591},{1957163381,806281632},
{1415574900,2020360609},{615512938,2143486370},{697825997,2013491619},{197131912,764506532},
{809499129,1156997541},{1009776763,387789222},{137887482,886022567},{1833955927,1835553192},
{494926929,914334121},{581958570,80150954},{2036855003,1973367211},{1634726866,1320157612},
{2029515000,334365101},{1211102973,632848814},{1769468630,336855471},{1822945912,880603568},
{911210806,2057609649},{406322425,640250290},{606600059,627925427},{1956639087,491418036},
{1292367458,1340854709},{1571288141,723870134},{374865205,2048905655},{874510716,283570616},
{68157310,1996652985},{1024981085,76878266},{1516762292,1209823675},{338165115,1762640316},
{857733532,108880317},{305135034,1893245374},{1873801745,1216299455},{1213724406,1542459840},
{1585968177,1817665985},{859830680,483254722},{645921584,1849590211},{2087710940,439919044},
{937949443,1703489989},{1238890188,474550726},{1810363016,241775047},{1283978864,825377224},
{715127468,2068455881},{1153955688,1010479562},{518519843,1745736139},{1263007383,582656460},
{1687679854,899744205},{1223161574,1844257230},{18350045,1142485455},{1728574241,1136140752},
{2052059360,540918225},{1022883938,1662480850},{458751125,1359208915},{1518859439,524255700},
{825752025,1115988437},{1598026778,242475478},{511704113,114799063},{1667756949,1028055512},
{1787818670,480182745},{596114319,704717274},{561511377,184922587},{1310717500,700412380},
{1801974425,462004701},{2095050976,941228510},{1224734432,303423967},{1839198801,2077503968},
{491781206,634847713},{527957009,1907565026},{1043855417,2132156899},{423623896,1551839716},
{275774963,448164325},{1308620356,955159014},{841480635,1229967847},{1571812426,1636078056},
{906492225,1385718249},{1480062201,1401322},{1277163133,1694519787},{919075111,870998508},
{238026299,1025671661},{644348723,440254958},{243269169,1943200239},{1617425400,2062193136},
{238550585,758108657},{896530771,103227890},{55574422,1625440755},{532675592,579711476},
{1146615674,1145602549},{753924706,528175606},{965212367,359739895},{1317008946,950125048},
{1057486880,836334073},{932182287,1248637434},{1798828697,1680572923},{1206384388,1700594172},
{74448754,545853949},{1632105433,338485758},{1885336055,336675327},{1917841854,1498530304},
{1409807743,1217208833},{721943199,756646402},{249036325,2083340803},{1048574001,1124229636},
{670563073,2125804037},{1302328909,2088550918},{1334310424,1383408135},{1439167819,230781448},
{296746442,882360841},{823654877,439783946},{526908437,1398530571},{1003485318,1928045068},
{772274751,615481869},{459799699,1760997902},{758643289,1394549263},{1162344279,1931162128},
{1441264969,1144525329},{1199044369,1040359954},{1551365239,610927123},{1194850077,1686118932},
{370670909,1378673173},{244842029,1898611222},{1652552628,596382231},{519044130,1669251608},
{973600959,172319257},{1461187869,310166042},{1838150239,745194011},{209714800,1668895260},
{2129129556,1401029149},{1818227318,1121772062},{1041758271,1397797407},{290979286,617054752},
{1829761642,423080481},{280493546,284234274},{399506696,1403339299},{330300810,146104868},
{384302371,795451941},{1270347401,1707000358},{2035806426,2006471207},{1597502494,1930011176},
{1548743799,1036304937},{1454896426,59396650},{643824436,1848476203},{1246754486,769479212},
{1394603420,1071018541},{99614530,1412665902},{1017641069,207086127},{89128790,1882346032},
{1159722844,803848753},{970979524,418099762},{887617891,1596236339},{799537676,1715384884},
{141557490,1673241141},{988805287,2103448118},{2092429437,1342468663},{148373221,1540575800},
{1323824675,1215291961},{843053496,621048378},{1014495346,1333916219},{1305474631,1740681788},
{71303032,994071101},{1005582467,389472830},{242744881,1490403903},{2137518328,2050056768},
{415759591,670868033},{1429730652,451547714},{1135081355,278295107},{1650979765,262685252},
{1972367698,1372213829},{566229960,1470370374},{289930711,993755719},{197656199,1338212936},
{476052596,846869065},{1046476852,1285370442},{614988651,2065404491},{668990213,980386380},
{176160432,186901069},{730856078,413872718},{538442749,921399887},{1307047495,828600912},
{1525150885,1242006097},{119537436,859427410},{405798138,686436947},{266337796,575005268},
{16252897,2048385621},{1395127707,1810309718},{180879015,1220502103},{1961881971,1074836056},
{253230621,446206553},{1685582710,758506074},{975698107,1390232155},{660601620,757023324},
{264764935,1194664541},{1912074696,877494878},{2050486462,267686495},{749206126,1731203680},
{1489499368,2133787233},{427293905,835822178},{432536775,777347683},{1630008289,116683364},
{380108075,1325478501},{1786770101,432820838},{1295513178,1210339943},{1795158689,1660019304},
{1959784827,1973809769},{891812187,1400492650},{1497363673,487453291},{1602221072,741380716},
{1562899550,20099693},{2133848196,542495342},{950532331,2004058735},{632814410,264606320},
{1814033020,616407665},{1141372799,1422578290},{575667126,1549939315},{1325397538,1521242740},
{1703408463,2098369141},{555744220,1678365302},{1894248945,1701409399},{1819275896,762831480},
{555219933,947712633},{914356528,1011380858},{2003300629,674849403},{61341579,1951003260},
{252182047,1736905341},{1320678954,642978430},{1805644442,1318122111},{314047913,1627824768},
{1432876373,1184318081},{243793455,1021645442},{1967649114,136426115},{1180170037,1880175236},
{473431161,1049055877},{275250675,1403032198},{1344796158,1200743047},{33554368,375841416},
{1277687422,2133287561},{1181218615,1669272202},{770701890,1790288523},{492305494,622363276},
{1453847853,205054605},{1424487783,1797800590},{725088921,2083693199},{1713894208,73597584},
{1022359652,1775657617},{1965552044,414724754},{509082677,744727187},{1158149984,1722872468},
{227540558,945074837},{1863840293,227414678},{889190752,336118423},{695728852,333742744},
{1813508735,1272316569},{744487540,266822298},{1190131490,226472603},{2135421024,1556632220},
{2071457952,498422429},{1108342718,448852638},{616561512,630108831},{142081777,1722913440},
{1020262502,2123236001},{1851781690,1970442914},{1118304172,1354695331},{1833431639,270598820},
{836237766,141419173},{685767397,360829606},{1415050615,963326631},{474479735,991765160},
{1503655117,1784926889},{1372583368,999850666},{2040525032,330527403},{1946153352,343999148},
{1428682081,1057313453},{1751642872,2098676398},{245890605,772182703},{1596453915,1635377840},
{1331688982,1854411441},{1576531011,754078386},{610270068,2051871411},{1758458598,2121441972},
{2012737793,1593565877},{2130178133,456172214},{178781867,1389458103},{1724379944,2123408056},
{322960792,3637945},{1713369918,2123006650},{362282317,1046753979},{1438643528,462066364},
{1749021436,397714109},{1477440766,750764734},{1604842508,720646847},{1226831580,1863037632},
{115867427,1520370369},{1615328247,1803371202},{98565956,889959107},{133693185,729789124},
{378535214,341709509},{1374156227,1849303750},{464518282,881156807},{633862983,1449153224},
{929036565,1801122505},{462421134,245068490},{481295466,12493515},{1536685198,703083212},
{2058875053,1705562829},{1166538575,746873550},{760740437,1541485263},{47710117,1210413776},
{2139615272,1541599953},{420478176,1635365586},{659553046,81654483},{2033184993,373154516},
{1646785469,1306583765},{1544025215,277115606},{1001912457,1705755351},{292552146,493781720},
{2131750995,502682329},{202374782,328319706},{1237317320,1926025947},{158858961,1640567516},
{451935394,1426592477},{1246230199,478667486},{993523865,1403101919},{902822215,471765728},
{2020077834,977625825},{746584688,660927202},{1215821554,1785082595},{417332453,1374667492},
{11534314,136225509},{1330116119,2143507174},{1627386854,245875431},{1549268085,995078888},
{1490547946,1729934057},{403700990,224875242},{1799352984,984007403},{1090516960,13058796},
{183500450,147034861},{1507325127,400667374},{287309276,484479727},{1097856980,1401193200},
{2123362420,702165745},{1468003601,608064242},{882899308,426533619},{732428940,2041852660},
{1519908014,1338516213},{754973280,2073772790},{623901531,48321271},{1133508495,1443205880},
{1537209488,2007913209},{1928327596,1722561274},{222821975,1604133627},{748681839,1199915772},
{1485829371,1376244477},{3145722,728359678},{1237841608,1022632703},{1751118580,1035412224},
{2621435,150205185},{1324873249,242094850},{494402641,265822979},{2065166517,746640132},
{24117202,1451713285},{722991773,56218374},{620755809,2039157511},{830994895,71783176},
{1976037711,548582153},{933755147,1184768778},{702544581,2026271499},{1208481536,110936844},
{1365243349,2120033037},{457702551,1423966990},{477625457,1651860239},{350748003,503603984},
{739768957,1943507729},{1678766975,650330898},{1450702129,2109047571},{853539236,496935700},
{1012922488,1501635349},{247987751,40657686},{905443654,607716119},{258473492,1431008024},
{34602942,1112441625},{703593154,1715528474},{1144518522,1605587739},{706214590,2129408796},
{1211627259,2014663453},{1240463044,2000708382},{999291022,820794143},{1659892660,1150464800},
{112721705,1499480865},{1652028340,16724770},{1493169376,253748003},{268959232,1222226724},
{858257821,1051747109},{682621674,1619288870},{1343747581,498746151},{1313863223,1123742504},
{1340601862,1964380969},{1210578685,917152554},{1947201919,1053733675},{1354757608,2134696748},
{822606303,1491313453},{437779645,1793241902},{1839723086,1313755951},{2134372909,1029063472},
{613940077,1257632561},{101711678,442782514},{1000863883,1019794227},{128974603,164143924},
{273153527,317731637},{911735093,1906778934},{1220540136,1374077751},{867170699,829567800},
{1109391292,433591097},{2117595230,1660711738},{930609425,529793851},{598211467,1952461628},
{1390933411,384021309},{1719137075,1225974590},{4194296,1550086975},{1419244912,396882752},
{1547170938,1984639809},{1474819344,353272642},{1215297268,1813091139},{731380365,706302788},
{1589638185,1752580933},{824179164,740062022},{1063254036,1963918151},{2038427863,1085518664},
{369622336,1585439561},{30932933,1651938122},{563084238,1201251147},{461896848,160904012},
{1002436744,153793357},{907540799,302342990},{735050374,973132623},{585628580,1794274128},
{125304593,14717777},{728758932,244613970},{1991766316,1531274067},{1758982894,1920463700},
{1362097628,1148158805},{1032321103,1870893910},{833092043,1714385751},{751303271,1446937432},
{519568417,912171865},{1411380608,1790341978},{1321203240,191075163},{543685619,1471460188},
{626522965,383157085},{1126692763,192324446},{612891503,58975071},{281542119,1480500064},
{511179828,1327940449},{1927803308,1583481698},{622852956,911848291},{422575322,1904640868},
{1677194114,689271653},{1431827797,540447590},{1958736245,1785766759},{1130362772,1801823080},
{2031612127,2135397225},{1081079794,2052182890},{1101002701,1541321579},{926415130,1888969580},
{1466430741,718402413},{1656746920,1290359662},{1637872594,1452168047},{648018733,1840223088},
{1729622818,1526322033},{1383069107,560468850},{348126568,404091763},{1731195688,1444303732},
{1732768536,1340859253},{392690963,408101750},{1585443893,1796735863},{7340018,1385505656},
{1093662682,1171805049},{1298658901,1362133882},{92274512,708420475},{248512038,1348117372},
{602930050,1020441469},{588774301,1552450430},{973076674,462443391},{1676669828,1450644352},
{2145383741,255046529},{2109206636,2016093058},{1689252719,1288926083},{1151334252,346723204},
{132120324,117556101},{1089468387,1865302918},{1552938094,1174578055},{1335358989,1753465736},
{1952444789,906064777},{1622668267,401580938},{2051535038,1581855627},{1023408224,959325068},
{1606415368,1406149517},{320339357,19461006},{1357903330,992605071},{1083176942,525861776},
{1509946561,1286706065},{1399322003,29942674},{1010825336,146568083},{2130702639,2077799316},
{1714418503,44536725},{493878354,1018192790},{1185412907,1037898647},{416283879,253301656},
{372243770,159413145},{1920463281,543626138},{1374680514,88011675},{163577544,1365582748},
{960493787,1340384157},{889715039,1556034462},{563608526,684975007},{995096728,833282976},
{1312290362,495899553},{975173821,460362658},{1773138636,1637700515},{890239327,142980004},
{1897394653,1137750949},{1131935638,1269851046},{1520956594,1557476263},{1385166254,1914418088},
{1106245571,1532056489},{704117444,655098794},{1391981985,1084531627},{535297027,796853164},
{777517621,1897907117},{267910657,1582953390},{1430254936,694817711},{395312398,1571926960},
{1970270560,91730865},{836762052,897418162},{687864544,106570675},{2023747862,637625268},
{44040108,1238676405},{2096623786,730346422},{564132813,531325879},{1451750711,397079480},
{1676145539,1174807481},{1174402881,69665722},{589298588,1636438971},{1940386193,1669129148},
{155188952,292090813},{1317533231,1103176638},{1698165596,157828031},{2032660765,1649947584},
{839383487,1865630657},{1929900447,1718506434},{1066924045,37135299},{531627018,1533617092},
{1996484905,2103006149},{838859202,1795085254},{1950347652,261653447},{2098720877,1293038536},
{851966375,1555624905},{1002961032,2125689802},{1417672049,1730634699},{850393514,492270540},
{86507355,600740813},{912783667,1643160526},{7864305,403346383},{456129690,355103696},
{1687155567,848442321},{2125459580,1592370130},{894957909,376067027},{700447433,1116672980},
{565181386,159749077},{1944580492,1160745942},{1196947221,1153872855},{2097148019,2034787288},
{2110779474,2018132953},{1389360550,1719870426},{1785721522,130266075},{144703212,703480796},
{893909335,1810359261},{166198980,533857246},{1611658239,2080048095},{1142421374,1313526752},
{1934619052,289006561},{1166014290,71590882},{2033709281,929280995},{193461903,452531172},
{1949823353,641901541},{219676253,842142694},{46661543,1919058919},{2087186617,1551332328},
{935852295,1563431913},{359136595,1205191658},{1368389073,1482540011},{845150646,1955435500},
{1901064672,1242506221},{1609036804,1518437358},{1048049713,1678963695},{923793694,852562928},
{1220015851,935351281},{570948543,341824498},{1529869471,795411443},{1065351184,1540305908},
{1938813339,764322805},{1084225517,534520822},{771226177,1370190839},{1427109215,333140984},
{1267725966,1259238393},{2119692397,371291130},{1184888620,856609787},{1983902021,1748534268},
{1523053740,213165053},{613415790,1222681598},{1150285678,253785087},{1607988241,51721216},
{89653077,2141955073},{124780306,757888002},{1396700569,1410057219},{1319630382,152396804},
{112197418,1481851909},{1753740015,1363227654},{1194325787,1171219463},{1398273436,1482560520},
{601357189,599942153},{1533015188,2014512138},{1121449893,1449665547},{1461712158,535024652},
{289406424,1154040845},{1747972869,2094470158},{1260910238,1989198863},{1186461482,800470032},
{1241511620,243692561},{1610609666,226157586},{377486640,2138063891},{28311498,1429591060},
{845674931,488002581},{1469576463,175158294},{998242448,1397642263},{149421795,1135215640},
{430439627,544293913},{413138156,761111578},{1332213268,2000004123},{1569715281,1118905372},
{965736654,190239773},{711981747,194626590},{667417354,394400799},{1992290620,129188896},
{1971843411,1045877793},{1259337379,1609147426},{500169798,1785967651},{1115682738,1375720484},
{1134557068,412107813},{1502082255,211678246},{1844441671,426554407},{1748497148,750249000},
{1119352745,700036137},{489159772,2038125610},{1779954380,1375904811},{1430779230,1871877164},
{724564634,1586426925},{252706334,607069230},{87031642,1492952111},{1690825578,854959152},
{272104953,481088561},{1497887959,205796402},{381156649,1520092211},{1459615012,1495258164},
{2127556691,1124439093},{1908404689,1767306294},{1128265624,1239643191},{716700333,1196811320},
{1222112998,462750777},{1881666053,764490810},{1328018972,176669755},{724040347,1639134268},
{478674031,923292733},{1106769858,671638590},{537394175,258360383},{627571541,1297593408},
{506461242,920671297},{286260702,1000670274},{2005397776,942076995},{868219275,1952289860},
{1603269649,651162693},{326630801,1743598662},{808450554,860750919},{1493693663,1532527688},
{1692922724,1758262345},{1773662929,1094141002},{565705674,563307595},{219151966,509551692},
{1917317561,372966477},{411565295,1523639374},{1625813988,207782991},{1270871689,1065370704},
{810023415,1961489489},{343407985,363615314},{2129654047,1230562387},{308805043,581891156},
{1854927408,668820565},{680000239,345261142},{1564996698,2089210967},{1320154668,1202230360},
{2053632184,1094808665},{1506800838,1579689050},{939522305,432993371},{1807741576,1457882204},
{483916902,1012884573},{332397958,586568798},{1953493376,1515775071},{1375729092,2057409632},
{140508916,1403708513},{1314387509,700953698},{1186985769,1746011235},{1346369016,1670485092},
{1611133955,830583909},{2116022489,533460070},{1030748243,1260467303},{1527772330,1529087080},
{276299249,1169224809},{2052583612,135672938},{1174927167,1305179243},{1800401563,517727340},
{1146091382,1779516525},{571997117,1729434734},{1300231760,1331807343},{1253045930,1660384368},
{1336931850,439645297},{1640494023,1185404018},{441973941,2003211379},{324009366,1863468148},
{1962930534,2037089397},{1132984207,1220306038},{811071990,728675447},{169344701,1046434936},
{380632364,1651709049},{186646172,1861153914},{898103631,1973728379},{1029175383,571049084},
{657455898,2145371261},{425196757,1782910},{1452274993,1309717631},{1269823115,2025698432},
{264240648,1656755329},{1538782351,1041196162},{942143740,1475376259},{876083577,697357444},
{504888381,789972101},{750778984,1068156038},{497548364,472769671},{156761813,870380680},
{58195857,1575728265},{1518335154,755164298},{1249375921,634803339},{636484419,681772172},
{406846712,1480369293},{979892403,614352014},{865597838,859329679},{1437070670,1946084496},
{757594716,112645265},{982513841,45515922},{106954548,205649043},{228589132,752784532},
{1159198557,1336657045},{2013262084,147235990},{300940738,1258103959},{1822421623,1142764696},
{1480586488,155870361},{1811411591,1800336538},{1484780788,368403611},{1873277459,1250231452},
{1345320442,161350813},{202899069,1307661470},{1517286578,874800287},{1172830022,42325152},
{1837625936,591643809},{1117779884,1602725026},{1714942797,182469795},{2122313869,646558884},
{649591593,1244488869},{100663104,1573119142},{1720709938,999396519},{135790333,941221032},
{1818751603,370173097},{434109636,962880682},{719321764,1810736299},{752876136,1929704620},
{1923084729,575935661},{491256919,1411560622},{793770518,213718191},{1223685858,1705149616},
{505936955,635077809},{1746924285,1880478898},{1965027692,875455667},{1362621917,829273268},
{1462236443,1283699893},{1232074450,1754887350},{526384148,1612539063},{1120925606,1690629304},
{1285027437,1319937209},{1930424747,521417914},{1232598738,675923131},{968358089,922772668},
{1039136834,11441341},{1053292587,1588786366},{594541458,2026452159},{1514665147,1326159040},
{903346501,1087890625},{952105192,257721538},{1213200121,914371779},{495975502,418759876},
{1827664490,552649925},{663747343,1844741318},{1444410688,727794887},{1695544163,854951112},
{2141189169,2129450185},{1522005163,1522263242},{1495790812,261412043},{1647309755,1245480140},
{822082016,2140959949},{2059923662,364598478},{816839147,1583252687},{1093138398,500982992},
{1155528552,602211537},{1583346740,2135618770},{716176044,1527526611},{1987572032,391693524},
{1475867909,1586910421},{534772740,977892566},{741866106,705459415},{480771180,1855087832},
{319815070,1177081049},{341310837,1416127706},{450886820,1989682395},{412613869,683697372},
{978319542,856057053},{1147664243,284681438},{162528971,1394144479},{807926268,1204782304},
{110624557,2105595105},{2091905158,689808610},{976746681,1680749795},{1043331131,495355108},
{1768944343,976172261},{1604318220,1005077734},{199229060,2033206503},{1498412250,1076684008},
{1723331372,438711529},{512228399,1857701098},{418381026,75453675},{1490023656,555562220},
{1488450796,2075022573},{347602281,922121454},{456653977,809407727},{1068496908,531666160},
{1942483340,1092773105},{849344942,882615538},{1891103221,867140851},{2066215129,1714427124},
{651688741,1793758453},{1386739117,920528118},{87555929,586450167},{1561850973,1931343096},
{463469708,1332974841},{1897918941,4654330},{1238365894,908047611},{1460139298,986084604},
{692583127,1543005437},{516422696,752772350},{663223056,1298928895},{1425536361,1180984576},
{132644611,1310655745},{579861423,2106033410},{1973940556,1487406339},{1797780132,284026116},
{53477274,1063113989},{51380126,1916880134},{1671951245,1887479047},{1427633506,1319175432},
{174063284,867276041},{1124071328,1159382282},{794819092,81253643},{1789915818,1310418188},
{99090243,1342760205},{1264580247,1096992014},{117440288,782157071},{1185937194,1393661200},
{692058841,423556369},{557841368,1198802194},{479198318,1773282579},{912259380,1478788372},
{1635775442,1184527637},{12058601,1563874582},{413662443,1462871319},{1445459259,1770251544},
{141033203,1232147737},{246939177,664302874},{1020786790,686400795},{299367877,1006568732},
{1513092283,1475511581},{1872753167,938824990},{95420234,206050591},{1333786128,1467544864},
{542112760,651404577},{1483207926,890254626},{758119002,670827811},{1698689880,1940841764},
{2088235223,159552805},{1706554193,1746322726},{1937764756,785315111},{803731971,485004584},
{654834463,268457257},{1941434764,80069930},{49807265,62620971},{306183608,1990571308},
{1573385288,964592941},{1326446114,502359342},{877656438,951833903},{1710224195,31147312},
{424672470,1686697265},{352845151,941286706},{1537733771,1113859379},{2095575178,199910708},
{1691874149,1479882037},{962066646,719017270},{1631581145,2111288631},{234356289,1865274680},
{37224377,102597945},{1131411346,484730170},{1252521643,1411573051},{854063523,1858213180},
{1339028998,127255869},{743438967,1902200126},{326106516,1429955903},{1039661122,515945792},
{194510477,2066986305},{759167576,328897858},{1369437644,2133468483},{84934494,1778320708},
{216530531,1509221701},{88604503,1418192198},{1862791712,705123655},{924842268,1304380744},
{925366555,1699833161},{1078458359,1467995466},{671611647,2032780619},{643300150,1175926092},
{337640828,235095373},{693107414,1764971854},{5242870,1261516111},{894433622,111748432},
{1593832480,2058732881},{487586910,719512914},{1859121712,551794003},{1547695225,1731319124},
{871364995,1034790229},{506985529,145540438},{1195374362,376382807},{1164965714,1356690776},
{1929376170,625821017},{3670009,1274557786},{1264055957,310818139},{530054157,1199760732},
{390069528,476591453},{1312814649,848172382},{2008543497,853554527},{2138042848,489506144},
{1680864137,426169697},{863500689,1529283938},{1692398440,585426275},{1545073790,52426084},
{1356854758,1308157285},{72875893,595645798},{192413329,1916626279},{161480396,207279464},
{604502911,771822953},{38797238,2010576234},{2034757878,1893549419},{574618552,1159284076},
{913307954,748176749},{1871180318,226616686},{449313960,342594927},{1189607204,1266447728},
{258997779,1380861297},{1695019883,1482241394},{175636145,260060531},{630717261,1218262388},
{1945104773,1893606773},{2136993957,721012086},{2118643802,2109638007},{1903161821,2004747640},
{23592915,1130513785},{423099610,2011719034},{966260941,105895291},{1989144918,733861244},
{1737487119,1632249213},{2093478013,429364606},{2144861228,2108163455},{357563735,551445888},
{774371899,226444673},{1711272774,2086286722},{152043232,2092299651},{1704981326,545453444},
{2102390898,1187218821},{70778745,1259541894},{33030081,1951466887},{1514140857,486360456},
{1744302853,556414345},{1060108315,333473162},{466091143,1002804619},{810547702,2065429900},
{1466955027,2108687757},{700971719,1129059726},{1449653557,285468047},{919599398,1691497872},
{1779430080,1067578769},{1590162473,1141020050},{1842868826,57308563},{1245181628,2027861396},
{1513616571,500716949},{1688204143,484517270},{1044379704,842962327},{1227355868,1861813656},
{550501350,369108377},{988280996,1106179482},{2054680754,2136323483},{204471930,143717788},
{2020602106,1206863261},{571472830,944502174},{427818192,378189215},{1669329809,455988640},
{961018071,1418110369},{1455420712,528971170},{824703452,1048561059},{1684009860,437134756},
{376438066,891942309},{14155749,1689150886},{335019393,2092406183},{878705012,2138989992},
{1385690542,1936291241},{319290783,607114666},{1178597177,1542309291},{1361573344,1970877868},
{2024796419,526308781},{572521404,82908590},{444071089,489559471},{1837101650,945337776},
{345505133,622069169},{116391714,1103177138},{1239414468,5096883},{1234695887,1518921140},
{1440216391,2040460725},{224919123,706045366},{2139091024,244553143},{1990193479,1686320568},
{1866461723,763528633},{1225783007,1725568442},{1161295707,1496663483},{181403302,1144329660},
{1075836924,1097045437},{1950871956,1718388158},{995621013,1287574975},{1998582061,1660925376},
{364379465,612615617},{996669588,1689081282},{2086662267,183932355},{56098709,817837508},
{639630140,121427397},{1125119902,1191413190},{17825758,1458341319},{1832383074,996767176},
{145227499,1310021065},{709360312,1224852938},{1618998260,263538123},{1189082917,296203724},
{1010301049,691467725},{1485305078,862578126},{792721946,1061983695},{931657999,1986876880},
{490208345,1248175569},{927987991,938120658},{1444934977,97805779},{1889530353,814347732},
{2042622158,1677211093},{1059584027,397186518},{1205335813,625075671},{2067263692,1201817048},
{1148712817,820442585},{867694986,1788036570},{1309668926,1045714395},{1038612553,929592796},
{1641542615,1122977245},{56622996,11711966},{1787294389,2031945183},{1092614108,1361679840},
{1434449235,1296045537},{1949299076,1581209058},{467664005,1408267747},{1749545725,657405412},
{593492884,927704549},{1886908924,520152550},{1654125485,1133528551},{1959260521,700028392},
{450362533,1966597609},{201850495,1918273002},{2030039293,2064152043},{479722605,1124877804},
{2074079402,1757898221},{294125007,1638413806},{452983968,282195439},{2131226750,956982768},
{1410332034,1568351729},{1155004261,883308018},{1422914924,1819301363},{397409546,2073662964},
{1137178504,548476405},{1384117686,1791206902},{1072166915,2036581879},{1327494685,1098937848},
{1650455487,558581241},{1855975985,1584182778},{1746399998,2091398651},{356515161,614426108},
{1605891082,1736340989},{1121974184,1675183614},{2140664054,1489364479},{600832902,1327101440},
{1334834702,1761744385},{1303901770,352192002},{439352507,773146115},{740817532,1333786116},
{2078273684,966063621},{113245992,1777116678},{1708127050,29550087},{1288173159,910611976},
{147324647,555410953},{954202340,269100554},{1471673612,1120966155},{1802498709,1362556428},
{1177548608,347928077},{1088419813,1181455886},{914880815,2057094671},{760216150,1970869776},
{2054156489,1200305681},{1892151784,868029970},{1741681417,74810899},{1165490003,333411860},
{1296037465,923837973},{776993334,1591567894},{2043146452,1356523031},{780663344,420632088},
{1628435422,1073198617},{401603842,95413786},{1796207265,201307675},{1600123925,1081955868},
{1771041487,1666266653},{421526748,775370270},{2119168056,1256687135},{433585349,1522632224},
{1314911796,1851078177},{671087360,1530709538},{1047001139,1410700835},{1940910479,1353025060},
{444595376,1607644709},{1500509396,841524774},{983038126,1313392167},{2082992257,339637800},
{2027942152,1047422505},{222297689,1717057066},{1275065985,1549190699},{1116207027,90101292},
{599784328,1116087853},{1429206364,1563080238},{1631056857,134600239},{1875898893,182670896},
{1743778564,33117745},{203423356,1200260658},{1449129268,481060403},{159907536,859092532},
{1007155328,2039064117},{2068312235,948487734},{955250914,2043070007},{835189191,1779476024},
{82313059,1982346809},{747108975,466245178},{1626338278,1422714427},{2051010760,492926524},
{2105536656,391280189},{1115158450,1982772798},{1966076265,1899210303},{2048913605,1311352384},
{501218372,969008705},{1663562653,871269954},{618658662,1261598275},{445643951,937408068},
{1210054396,529843781},{1636299734,1503876678},{2006970637,1261901383},{1922036142,797324872},
{487062623,284034633},{1132459920,989840970},{438303932,1287804491},{1473770759,2059626060},
{500694085,1998734925},{190840468,1281082958},{1507849418,559793743},{605027198,1912489552},
{1076361211,563521105},{251133473,1843144274},{1679815549,962393683},{1013971060,1304442452},
{1114634162,633357909},{1907880393,262800982},{1702884177,1232238167},{829946323,928716376},
{11010027,503961177},{361758030,2096178778},{31457220,96249435},{477101170,211621468},
{1619522543,1378809437},{947386610,1292813918},{1367340498,1729283679},{1625289710,1359890016},
{541064185,377951841},{681573100,2058864226},{1051719722,722953827},{1045428282,1221080676},
{556268508,1800943205},{1584919602,90130022},{465566856,1096844903},{2046292177,1148372584},
{1052244011,1007289961},{1663038367,1977947754},{1850733110,712463979},{277347824,1863001708},
{1989669199,82151021},{1721234222,3192430},{742390392,1034810991},{2112876615,2129675888},
{1639445466,204211825},{976222394,1289094770},{2132275404,1028638323},{1448604984,1608599156},
{17301471,268519029},{313523626,479876726},{350223716,431392375},{535821315,318621304},
{1011349624,251135609},{597687180,1484879482},{210763374,1183438459},{122158871,1296623228},
{310902191,158439037},{618134373,1074099838},{1221588711,1947481727},{1579152445,1364940416},
{1198520082,1450514049},{2037903588,211334786},{71827319,9905795},{1896870366,898713220},
{1031796816,1905747589},{1780478652,1683523206},{1788867248,1775048327},{2003824914,1447462536},
{953678053,1254885001},{875559290,1273128586},{921172259,1973417611},{707263163,1035241100},
{80740198,475870861},{20971480,1977665166},{767031882,1175414415},{1803547289,818538128},
{1377826236,1021249169},{1094186969,2147395218},{688913121,1349076627},{1341126148,1765557908},
{379059501,1621919381},{1407186319,451991190},{354942299,1669285527},{153616091,1894061720},
{1896346080,1758660249},{69730171,572155546},{587201440,1327113883},{138411768,462022300},
{1434973519,1175013021},{1658319782,178558622},{168820414,1128388255},{658504472,1039574688},
{255327769,767080097},{255852056,567953058},{1772614368,959555235},{164101831,394380964},
{351796577,433190565},{152567517,119035558},{2080370829,1488918183},{1250424496,1850545832},
{1190655778,1340761769},{439876793,2080200362},{2132799614,1883612843},{1522529448,371218092},
{126877454,966952621},{1478489341,1752647342},{946338035,27981487},{862976404,480122544},
{308280757,1669105329},{57671570,1853478578},{1894773221,1602778803},{1809838729,332940980},
{455081118,501118645},{696777423,1488271030},{1559753825,348473015},{1116731310,717444792},
{1736438553,1887401657},{1594881068,492418746},{1854403132,482100923},{401079555,1237706428},
{1329591835,1388787389},{1301804622,1342617278},{2064642207,593938111},{773847612,1642743488},
{2092953730,570980033},{114294566,986859202},{227016271,1098012355},{2085089429,275928772},
{1704457046,1904424645},{1475343618,1504757446},{1553986668,1493186247},{900725066,2112943816},
{1442837824,2085996233},{1193277213,257869514},{63963014,961275595},{1017116780,2058413772},
{189267608,1274717901},{1040185412,899507918},{349175142,582043343},{1546646650,2077185744},
{303562173,223098577},{1504703694,1169921746},{1103624136,1831552723},{603454337,2065979092},
{800586249,193324757},{984086699,94709462},{318242209,464152279},{759691863,805918424},
{1482159349,152717017},{748157549,727906010},{375389492,1937360603},{2030563558,2143753948},
{1927279014,913463005},{646445871,255993566},{1560802399,947193567},{1980756291,1503246048},
{482344040,757061345},{467139717,1339668194},{147848934,1237599971},{1642591183,4646628},
{778041910,251373285},{2016407862,2010089190},{1031272530,1628620519},{934803721,1354200808},
{231734854,1609430761},{1850208829,1912358634},{2057826476,840967915},{699923145,517289708},
{228064845,2096207597},{379583788,1412593390},{333970820,1703458543},{764410449,200374000},
{334495106,1813153521},{240123446,156317426},{1633154005,568620787},{1877996041,147478260},
{771750465,541132533},{1923609010,271218422},{1531966614,2046793463},{1515713719,518280952},
{2101866584,1182234361},{504364095,356869882},{848820653,534546171},{1143469947,86001404},
{419953887,777000701},{621804382,2105743102},{1401419156,102184703},{886569317,2081810176},
{745536114,328922881},{812120563,1082877698},{200277634,1415190275},{124256019,1226856196},
{1216345843,960472837},{1697117020,1347843846},{288882137,2105648903},{186121885,214857480},
{2135945565,1613817609},{1592783910,1475495690},{1825043052,1327204107},{1470100749,973215500},
{1775760075,1024005901},{1001388170,1151596302},{2079322339,1543960335},{1921511859,136926992},
{623377243,552695569},{1021835363,1582884626},{1182791472,1579624211},{1218442989,1503516436},
{2110255290,1367549717},{1852305975,746243862},{302513599,174003991},{778566196,1809905432},
{940570878,216024857},{2001203506,731117338},{1081604081,841500443},{1061156888,69768988},
{1627911137,1229498141},{1868558873,881559326},{44564395,925648671},{2076176526,230663968},
{741341818,664971041},{314572200,1137288994},{1910501831,154990371},{1911550403,220501796},
{1998057778,442648357},{60293005,2012542758},{560987090,2096404263},{27787211,172750632},
{2088759465,1102231337},{1082652655,492193578},{1472197901,1697199915},{2141712925,1222936364},
{666893064,237995821},{746060401,407971630},{62390153,74061615},{1230501589,570869552},
{1245705919,351684401},{844626357,840738610},{676854517,222590771},{230686280,48809780},
{631765836,486958901},{273677814,1471432502},{475004024,1166411575},{802159110,1339246392},
{469761152,646842169},{1856500276,1715296058},{257424917,1329628987},{1313338944,2067687228},
{131071750,581756733},{1202190093,1217779518},{1499460820,811472703},{661125910,229246784},
{1474295047,173696833},{1730671392,1528346434},{1796731556,913299267},{1845490243,73193284},
{735574661,1368803141},{1350563313,835770182},{1613231099,1333000007},{1795682975,1652311880},
{383778084,496404297},{360709456,2111354698},{2055729362,1756452683},{1982329196,285939532},
{1599075350,1200117581},{95944521,1213437774},{1049098287,351487823},{1054341158,567056208},
{1550316659,1188636497},{949483758,396363602},{149946082,1313945427},{886045031,2130360148},
{1347417590,265254741},{1572861,1851017046},{1776808644,1506801495},{1150809967,1350338392},
{307756469,295606105},{2059399345,139888474},{736098948,397047643},{717224616,1597871964},
{1491072229,652728157},{1170208584,989546334},{151518943,1784543071},{2128080950,301229920},
{62914440,1342437217},{471858300,951920482},{516946982,1157576547},{488111197,1199535972},
{25165776,1745925989},{2090332306,680417126},{967309516,1557559143},{1972891981,1613625192},
{1096808404,1839535977},{342359411,2016274282},{484965475,1758619499},{677903091,862902124},
{892860761,646555501},{1433924950,731297646},{1463285021,1868879727},{522189852,1689560944},
{311426479,1070401393},{2128605418,2067515250},{316669348,1938782067},{1883763204,378550132},
{568327108,1268938613},{581434283,1762932598},{916453676,70526839},{705166015,1634965368},
{1459090721,513828729},{1071642628,199325562},{396360972,1045546875},{435682497,1692731260},
{1015543919,1280071549},{2063069353,1729628030},{1789391535,51353471},{185597600,225286016},
{1539306641,836679553},{1914171847,757503874},{1699214174,704386947},{358612308,783390596},
{1879044608,743405445},{1073739777,448542598},{1568142424,666253191},{2045767879,739116936},
{1197471511,748627849},{556792795,1656895370},{710933172,294762379},{755497567,2063824780},
{1251997356,850184077},{1792012968,31315854},{1325921826,1317271439},{1391457699,1070884752},
{1048574,497276817},{544209906,270907282},{624425817,943167379},{374340919,219346836},
{343932272,2096674709},{1338504712,1834842006},{662174482,829122455},{370146622,187455384},
{198704773,242722713},{1717564215,1523709850},{2106060952,1843025819},{179306154,2143209372},
{1200617230,791709597},{710408885,1614727070},{2011689246,1957590943},{817887721,1840924576},
{920647976,835348385},{128450315,677697442},{1127741337,1323829155},{1361049060,569866148},
{400555268,1606682533},{130547463,835856294},{821033442,1742370727},{1032845390,1876391848},
{1718088499,975194025},{1830810206,1234798506},{1420817772,1190442923},{1981280605,600070060},
{465042570,1354413997},{1228404441,322467758},{168296127,775112623},{620231521,1954031536},
{717748903,1002866609},{515898408,271091634},{1808790164,1335977907},{1638921167,1385785268},
{1505752264,1365292981},{1918366138,1595180982},{1052768298,1687693239},{1113061301,864044984},
{2134896770,1574791097},{722467488,330028986},{1725952804,952424379},{1512043710,1126381500},
{827324886,2057975741},{1510470849,1469921214},{833616330,1224509375},{2044719312,815327168},
{1418720630,501827521},{1756361456,1533581250},{1558180966,1650980803},{616037226,2041382852},
{784857639,1968277445},{750254697,1477949382},{1104148422,7395271},{513801260,1676216264},
{57147283,764069833},{29884359,99166154},{791673371,1746024395},{1919938994,1869502412},
{1168111436,1104635853},{1145042809,2021808078},{1866986010,903096271},{2023223607,323282896},
{776469047,1915471825},{517995556,1997907922},{934279436,1043269587},{386923806,146978772},
{1383593393,2039990229},{1071118342,1080608726},{1206908678,2093332439},{1864888859,1218140120},
{649067306,804394969},{1086322664,2099914714},{1954541956,967649243},{388496667,1669507036},
{801634823,419346397},{1735389981,1073055710},{1199568656,1398818783},{634387272,620513248},
{2106585222,599439329},{617610087,175687650},{2109730918,1430255587},{798489101,25429988},
{2044195027,1081821157},{1281357429,1016346598},{1967124825,1003898855},{1678242687,1096226792},
{801110536,1921554409},{448789672,1951143914},{1538258059,1898366955},{1932521896,1436592108},
{554171360,1214576621},{1899491814,2130651118},{1550840949,1091098607},{366476613,260536304},
{363855178,1960712177},{848296366,1222514674},{592444311,1693415411},{869792133,749766644},
{1587016753,902019061},{1918890438,98080758},{1857548845,1282541559},{1579676732,919046136},
{433061062,303359993},{1049622576,560191482},{292027859,1434994683},{353893725,59553788},
{1111488440,2004953085},{2142761248,849893374},{1175451456,340994047},{1212675834,1234057216},
{1033893964,543610881},{601881476,1335851010},{1097332692,1061971971},{1831858778,1676494852},
{1261958809,911759365},{542637046,567629830},{1573909575,36952071},{1794110117,301471752},
{1835528795,294524937},{805829119,1671837706},{1843393102,555456523},{327155088,164517900},
{424148183,1749760013},{218103392,1376311310},{1530393755,1045026831},{720894625,161744912},
{165674692,499333137},{1575482437,458524690},{1762652909,1950271507},{2009592073,1620211732},
{4718583,944392213},{220724827,1109723158},{1291843168,254650391},{369098048,4610072},
{873462142,219899929},{125828880,223823898},{1847587390,638867483},{1408234884,1743259676},
{1323300389,19458077},{764934735,1320093726},{936900870,1878501407},{1443886402,1162688544},
{1310193213,660850721},{678427380,125159458},{309853617,835647523},{2017456377,1117460516},
{1735914262,1505146917},{246414890,1394530342},{1421342058,1315125287},{1460663586,1274947624},
{1364719063,1955698729},{1786245809,432871466},{1193801500,1386145835},{22020054,684165164},
{1463809304,246708269},{1675621253,1448785966},{1764225759,582764591},{667941639,998746160},
{1754264314,520173617},{1673524105,1297922098},{576715700,127576115},{1158674272,787937332},
{650640168,295626805},{2123886660,1410533430},{1730147101,936581175},{1612182525,480004152},
{242220594,1620072505},{469236865,2136467514},{1534588049,592021563},{1240987329,1962154044},
{1633678294,377305149},{336067968,423991358},{968882379,1170524223},{1694495587,35153984},
{2034233571,1828026433},{1462760731,1884604482},{1102575561,908539971},{157810387,1986271300},
{723516060,1697110085},{1782575804,689268806},{728234643,1233537095},{94895947,1763473480},
{1360524774,1755306057},{767556170,492726346},{120061723,1814808651},{1852830258,651651148},
{1173878593,305080397},{1716515638,1841240142},{971503812,464103503},{1337980424,1552238672},
{2086137981,32426065},{791149083,577312850},{395836685,1836148819},{597162893,127551572},
{709884599,135481429},{1015019632,1309001814},{1302853196,1791559767},{503839808,1615579224},
{41418673,1321887833},{2116546717,942090330},{1635251159,1985472603},{38272951,189847644},
{1772090061,1239976029},{1705505611,1378801758},{158334674,716920927},{1255143079,935581792},
{173014710,1262835809},{2105012344,1616271458},{358088021,122120291},{1601696785,2105428068},
{875035007,2081130597},{1865413150,1355348070},{775944762,187168871},{2022174975,1522735208},
{1945629070,931391593},{136838907,833177706},{442498228,290117739},{781187631,1237346412},
{807401981,373434477},{1691349863,493250670},{1311241787,1337596015},{499121224,1684633712},
{1815081597,432003185},{1825567341,1637709938},{1225258719,952105075},{2019553534,384374900},
{996145302,1096194165},{1693971299,839952502},{1062729751,1935726711},{1501033684,915728504},
{772799039,404994169},{230161993,1295501434},{1235744463,2047010939},{804256262,644294780},
{103808826,1109051517},{1139275655,1038784638},{2025844985,1106110591},{1859645994,1948223616},
{486014049,611207297},{257949204,1763260546},{991951005,1496127619},{1441789254,730683524},
{1901588950,1566156933},{1781002940,689563782},{321912218,786835591},{1397749146,1749690504},
{702020293,1664211081},{2007494939,1805564042},{1396176281,1870604427},{13107175,429648012},
{816314859,619911309},{719846051,1759987854},{1765798617,91986063},{579337138,584099984},
{160431822,708872337},{698874571,1274456210},{1162868566,1488394387},{1243084477,735819924},
{1263531670,2022877333},{1044903994,301426838},{2143810008,650172567},{1937240471,408246424},
{1769992931,858142873},{1997533476,617855130},{1956114818,1309915291},{817363434,313563292},
{2103439463,156412061},{5767157,402938014},{233832002,1411524767},{637008708,1276774560},
{1916268986,1957832865},{1289221733,2005498018},{969930950,455772323},{528481296,1397991588},
{1008203902,1651599525},{896006485,897632422},{263192074,1276807335},{104857400,1332885672},
{1904734685,459274409},{740293244,1261590698},{839907774,1559378091},{1283454577,1534847148},
{788527648,591317165},{933230861,645114030},{182976163,1196882095},{1075312637,1581082800},
{812644850,14895281},{378010927,758143154},{2010116364,1333237939},{1476392194,2006431924},
{393739537,295905461},{321387931,913111222},{126353167,347306167},{1939861911,1439566008},
{1615852534,1495271609},{1140848513,1200396474},{27262924,1898231995},{1258288800,420161724},
{1519383727,429729981},{2089283721,1505908926},{625474392,1396435135},{408419573,1448384704},
{2113925195,1093699777},{920123685,1632123074},{586152867,600197315},{1346893303,271268036},
{1125644189,1383889093},{216006244,233539782},{499645511,1087645895},{1179121464,366418120},
{795867668,916224201},{1326970397,430655690},{1617949682,1199970507},{1976561995,1228839116},
{251657760,996055245},{972028098,901986510},{1495266526,479725775},{790624796,471124176},
{67108736,817895633},{1192752925,639338706},{43515821,520063187},{1069021195,1626966228},
{1370486219,364357845},{621280095,829135062},{103284539,267282647},{532151306,975657176},
{25690063,204142809},{2026369291,2058995930},{689437408,681720027},{382729511,1694861532},
{800061962,816404701},{1110964153,2129000670},{291503572,1534695647},{173538997,2018322656},
{1567093844,1704339681},{1621619696,969001186},{981465264,1414957283},{473955448,877312228},
{962590932,215656677},{204996217,903026918},{2018504968,359667943},{738196096,1265674472},
{508558391,173619433},{2043670764,548858090},{2082468156,632785131},{640678716,965339372},
{448265385,1400961261},{1509422277,573372654},{652213028,377829615},{262143500,1211885808},
{1451226417,1509288177},{1253570220,1564408050},{585104292,725911795},{1331164693,1548282100},
{595065745,322545909},{1925706151,1214302454},{756546141,754813175},{1904210394,2098215160},
{45612969,1213397241},{631241548,259524858},{1660416933,272173307},{602405764,112654588},
{732953227,938010877},{489684059,1646778622},{766507595,1845631231},{1034418251,672700672},
{972552387,267397377},{1920987571,107198722},{1756885737,581175555},{402128129,1151916292},
{272629240,867436805},{606075772,224954630},{1397224864,198666503},{1774711495,242993416},
{1891627496,1676110089},{1404564873,2048514314},{446168238,164632843},{367525188,555698444},
{1557132394,1225623821},{1925181892,1289316622},{385350945,193693967},{1349514738,440060176},
{1445983546,204822801},{443546802,373852434},{1059059741,475269395},{338689402,190028052},
{363330891,132077845},{66584449,873564438},{1602745369,1141786903},{317193635,1735571736},
{633338696,1686800665},{1164441427,470206746},{31981507,466057499},{582482857,1165924636},
{1004533892,550459677},{1985999188,792082718},{1053816870,303016223},{1140324225,1302767904},
{1042806843,1487604001},{1784672950,1274292514},{498596938,1416055075},{534248453,1103952164},
{1405613449,2112629029},{1994912046,720415014},{262667787,717371687},{1227880154,1656113448},
{390593815,454465833},{551549926,769333546},{628620113,12937515},{815790573,2018896172},
{751827559,1274018093},{1934094773,1521273134},{1353184751,627878191},{2058350786,634882352},
{1770517203,812149041},{137363194,1855494450},{196083338,204044595},{77594476,883894580},
{1355806182,1925269813},{404225277,942565686},{1064302610,630307127},{1719661367,1060956472},
{2089807984,1153112377},{1123547041,1791228218},{522714139,51145019},{2014310656,1577687356},
{1358951904,319834429},{156237526,528800062},{948435185,1323878719},{1231550163,1116813632},
{1556608104,1724549441},{1036515399,1386674498},{2121789529,496994627},{240647733,1218763076},
{1978659149,1473075525},{65535875,1921042758},{1665135528,1052678471},{1712845645,499038536},
{167771840,714303817},{164626119,673077578},{1254618796,464132427},{54525848,1944598860},
{1880093183,20166989},{1681912697,1819941198},{76545902,1499167055},{994572441,1609202000},
{1722282801,1591212369},{1420293483,953542994},{1088944101,2111482195},{1149761393,114182484},
{373816631,94038357},{1298134612,1483884886},{109575983,1741551959},{821557729,1389062488},
{650115880,1231812953},{819984868,2131880282},{1248327348,1806117211},{184024737,772790620},
{1883238911,1078937949},{1638396878,1852713310},{1357379046,385390943},{64487301,431823200},
{1876423174,1272428897},{664795916,1107462498},{134741759,1934981475},{1750594296,1892768100},
{1149237104,2134419813},{1610085384,713177446},{897055057,8083815},{2004349213,1813789032},
{127401741,274282857},{586677153,168348010},{842004922,2021497195},{619707234,1111071084},
{297270729,507439469},{1680339836,209967470},{1006631040,750754159},{666368777,1241643376},
{1332737554,1354062193},{2107109470,1889540466},{234880576,1261369715},{852490663,1433352564},
{918026537,2032327029},{1290270307,1845594486},{1060632603,2111900023},{2047340744,247671160},
{1233123025,47196537},{855112097,647833978},{1545598086,547629435},{1481635063,1300904316},
{1948774794,1071806845},{1821373040,901929342},{1541928069,1081952639},{344456559,10971520},
{936376582,2035227009},{35651516,1540876674},{317717922,563063171},{384826658,490072452},
{143654638,1951783301},{1798304414,219060614},{559414229,1672882567},{1122498467,759486856},
{543161332,611547529},{2041049311,820517258},{1436546380,2006276491},{2069885095,438864268},
{495451215,610769293},{2136469684,2073692558},{851442088,1853376911},{1025505373,1164319120},
{357039447,194722193},{1102051275,54102418},{476576883,1172273555},{1909453259,471419284},
{191364755,1516849557},{1760555747,1359366550},{167247553,1901914519},{1304426064,1349507480},
{1421866346,405531033},{1019213931,523876762},{1382544820,989886875},{1236793033,2013632924},
{254803482,435714461},{1745875716,1614252446},{662698768,1338427807},{1913647557,1763633568},
{2083516542,529136033},{416808165,134343074},{1379399097,2009737635},{1893200384,741685668},
{250609186,579316133},{1508373700,1494432166},{1720185647,1273592231},{1183315761,721160616},
{754448993,106060201},{1064826898,1352194474},{1324348962,1913809323},{298319303,2014624172},
{2002776342,130849197},{15728610,906451374},{600308615,133564847},{1464857882,638593456},
{813169137,28326321},{336592254,410614194},{2121265205,1068779955},{2037379333,1761159604},
{1532490903,893270453},{96993095,1758771638},{828373461,1222003127},{784333352,1891580344},
{157286101,2132486585},{594017171,483604922},{28835785,175372731},{376962353,1316239804},
{472382589,1167251901},{411041009,512821694},{1975513471,1479854527},{1745351429,1734015424},
{247463464,2104605121},{648543020,267041218},{2042097942,1108797891},{1119877032,1750563268},
{1566569558,2030623173},{415235304,1747642822},{2005922081,1008990663},{1261434522,77781448},
{864024976,262621641},{901249354,1164609994},{1129838485,1801480651},{454556829,1420388812},
{630192974,2135058893},{1358427618,898795982},{1725428517,634067407},{1467479321,150084048},
{440925368,1279588817},{1801450138,1962441170},{674757369,1165572563},{481819754,1522481620},
{1203238668,1045748181},{1080031221,1868057046},{1330640408,565660119},{245366316,540752344},
{806877693,1906792921},{1816654456,2077346266},{624950104,85780955},{1626862561,1423509980},
{1176500028,2144131549},{753400419,400292318},{470285439,20851167},{72351606,1745828320},
{209190513,466905569},{297795016,1523788258},{655883037,965032419},{883947882,2065316324},
{1984950605,245545445},{1739059979,1539049958},{1271395976,1323084263},{1671426962,2024036840},
{1364194774,806361577},{1623192557,1572911594},{1759507179,1800378859},{51904413,1629370860},
{408943860,2075572717},{1860170310,1334311406},{1605366795,784308719},{657980185,29428208},
{1423963494,388438513},{2067787980,78395890},{945289464,1114700275},{998766735,2020166132},
{865073550,542345717},{1853354559,1382357494},{954726630,643312119},{1416623480,1207253496},
{884996456,220645881},{1384641967,1368594938},{1589113897,1872079355},{675805943,1906924028},
{1414002041,938322429},{1734341396,2107349502},{120586010,1400220159},{831519182,827079168},
{1348990456,1836046849},{872413570,1173559810},{1977610568,1186507267},{1721758509,111897092},
{1275590273,1708435973},{1701311322,1974372870},{1567618132,308132359},{910162232,1022355976},
{707787452,1851218441},{1105196996,1945205258},{1877471750,1515731467},{50331552,1419557388},
{1992814944,521890317},{686291684,2083641870},{548928491,754735631},{2146956941,1526475280},
{318766496,1995082257},{832043470,706451986},{1151858539,1137216019},{1157625701,830159380},
{426245331,448715285},{2108682448,1818802710},{1492645089,102890007},{1505227980,1767438872},
{922745120,1713130009},{1030223956,1790282266},{1028651097,2133752347},{1061681177,1783917084},
{690485979,295160349},{796391953,576735774},{797964814,341875231},{546307054,74152480},
{793246231,1981352481},{472906875,1918798370},{765459021,1355938339},{1450177846,1930803748},
{502791233,1528564261},{570424257,700336678},{1806168723,865204775},{1731719969,1860831784},
{1768420060,29895209},{1156052836,826051114},{1755312878,779299371},{1926754729,1923320364},
{195034764,977320493},{558365655,869341742},{1074788351,1170201135},{739244670,1037736496},
{653785889,2002827825},{1363670487,821254706},{1985474870,1433541171},{808974843,2024294964},
{1812460169,716958261},{462945421,1934408246},{564657100,249543223},{223870549,1800837688},
{1492120803,1902733881},{1963454830,1483799098},{138936055,427575867},{170917563,1769675324},
{904919362,1580243517},{562035664,2000665150},{908589371,788789823},{1000339597,1835145792},
{684718822,2102041153},{1930949033,716958274},{1539830920,958212675},{1584395316,1892825668},
{1941959054,1720613445},{288357850,511101510},{1761080034,1010297415},{293600720,1238645320},
{964688081,1912535625},{653261604,533723722},{1217394414,962689611},{1797255855,22264396},
{1086846951,1942514253},{1248851637,620780110},{90701651,505940559},{985659561,920554064},
{1993863472,1392593489},{391642389,47118930},{2071982229,293886547},{768604743,602765908},
{762837585,1590803029},{184549024,521783894},{938473730,885381719},{861403541,1329760856},
{1535636623,852265561},{1557656682,1698261594},{48234404,739334747},{323485079,222804572},
{738720383,201235037},{40370099,1515879006},{762313299,631642719},{214433383,1340238432},
{1130887060,1387260513},{1378350523,1255524962},{1426060640,2083273315},{1674048398,1321097828},
{1163917140,1719429733},{614464366,1299475046},{1836577366,1600350823},{63438727,813845096},
{1674572679,871783017},{729283217,217979498},{1875374602,1462028907},{672660221,1865042540},
{2122838212,764332653},{1284503150,1512475246},{1645736905,1573546607},{285736415,1811978864},
{2065690823,164665969},{311950765,998247026},{2078797971,507472499},{625998678,1684503156},
{478149744,1044425333},{695204562,1852463734},{223346262,1247038071},{1840771661,1311586936},
{897579344,785775225},{1582822453,555301498},{629668689,1734851195},{647494445,469695100},
{1195898647,254405245},{1954017658,1459161726},{66060162,1094687359},{436731071,1716742784},
{1512567996,2076473985},{641727288,863304322},{398982407,348678787},{385875232,2088155780},
{609745781,1659087493},{533199879,559409798},{814217712,1672624775},{545782768,290605704},
{1935667619,1661672073},{36175803,135731850},{632290122,524946059},{520092704,874523276},
{890763614,71305869},{113770280,258919054},{861927828,172370575},{1817178744,2080443024},
{1267201679,2136857233},{1260385948,502512274},{1376777662,1457769107},{327679375,1659120276},
{1924657586,1321945749},{818412007,1748130454},{945813748,1581742743},{60817292,1189509784},
{554695646,915561113},{891287900,1398114970},{256900631,740625051},{827849175,1521539740},
{1343223294,583240349},{881850734,709696158},{256376344,771058335},{680524527,2127600288},
{1664611225,1280359073},{2053107903,1696410274},{584580005,1343154851},{123731732,1505188516},
{2015883519,33565349},{706738876,1664527014},{1849684545,2057128615},{1583871032,733977256},
{463993995,133024425},{19922906,1343220394},{642775863,1328343723},{781711918,684141228},
{551025637,1717279405},{354418012,794684078},{1993339189,1680067247},{1834480213,571628208},
{295173581,2025360049},{1826091625,1471621810},{1816130180,619989683},{1433400658,1114827444},
{1553462385,849926837},{1316484661,1415346870},{1136654224,1810975415},{337116541,679176888},
{1077934072,239332025},{2114449503,2028370618},{2036330761,1694153403},{779614770,791947964},
{1141897086,1347619517},{1991242044,864381630},{678951665,710978239},{880277874,229329600},
{1776284356,628271809},{853014949,1827896002},{794294805,923552451},{1157101409,367860420},
{417856740,1371486917},{595590032,970488518},{361233743,924056263},{2079846634,819157704},
{1452799277,1227954889},{803207685,134113994},{169868988,492444363},{452459682,857623244},
{691010266,411433677},{1744827143,78170830},{1249900209,256289487},{1555559532,572820176},
{878180725,1568942801},{999815309,1996278482},{1690301288,384129747},{163053257,410630868},
{109051696,394779349},{1793061540,1053600470},{1318057521,492243671},{40894386,147770072},
{1231025876,945081049},{1333261841,10918618},{309329330,1571056347},{609221496,567184092},
{1890054636,1925765853},{1418196335,385309406},{734526087,1104018143},{548404202,594447072},
{1431303514,1201548001},{244317742,1005382370},{1163392853,1414154979},{1406137734,476531428},
{218627679,631945957},{1234171598,2018568934},{2040000731,1057589991},{1091041253,683391720},
{846723506,1284696809},{1440740676,1234676458},{143130351,1616911083},{333446532,341002988},
{1503130831,829610733},{1977086283,1107393262},{837286341,1001347823},{2081943721,1629174512},
{880802160,85330673},{1279260281,1406331634},{1905783246,588901107},{1067448332,761617140},
{104333113,1605065461},{94371660,396618486},{1308096072,949979895},{1077409785,643586808},
{73924467,1163668217},{150470369,2142214906},{1065875472,1900600059},{296222155,1420331772},
{1565520990,1993526013},{1009252478,588593918},{274726388,513526527},{688388831,1115577088},
{1456469286,1727511297},{1971319136,1242397442},{905967936,1589062403},{145751786,96197380},
{1614279674,1845537541},{211287661,1601510150},{1988620609,1835150087},{279444971,1460357896},
{1644164033,741743369},{1207957248,404560650},{1778381511,2140822283},{2016932117,699546380},
{703068868,155523853},{596638606,976284430},{1276638845,273791759},{1063778324,1231375120},
{963639506,1769667345},{1842344527,1196354322},{2108158125,2007010067},{403176703,1666673428},
{286784989,1281223445},{599260041,1001073430},{233307715,781138711},{1761604321,396479256},
{1154479974,1268730649},{673708795,871807770},{2097672438,2088545051},{646970158,1074957084},
{295697868,1069284125},{925890843,893315870},{1201665805,922815263},{1684534134,1268013856},
{1287648872,1478753057},{583007144,695659298},{1228928729,1572608803},{1219491562,2044271396},
{533724167,467393317},{1398797716,2126023462},{428342479,1359776551},{329252236,1715637032},
{36700090,1467083561},{1259861662,1278331690},{814741999,2052533035},{1757934317,766237484},
{1668281234,793262893},{918550824,476863278},{1855451696,1165912879},{79167337,1371437872},
{460848273,813488945},{59768718,1479084850},{1556083816,572078899},{1729098545,1730276148},
{394263825,1321151285},{1108867005,766069558},{195559051,393063223},{1843917400,1550748472},
{840432061,613641017},{1196422934,1091541818},{557317083,2065865531},{592968598,1241115452},
{1811935880,475982653},{558889942,870255422},{1763701470,376904511},{1599599643,708168512},
{1871704591,1152576321},{1278735998,1834683202},{757070430,336128835},{1944056205,962374468},
{591920023,194517829},{1148188530,649448262},{1107294144,2084113223},{1520432313,827288392},
{1516238006,1570384713},{212860522,1343568714},{2062545074,837147467},{868743559,678812492},
{2064117935,1554504525},{943716603,1554279246},{1381496245,240978767},{1377301955,1909775184},
{1913123264,727309137},{1110439866,1406061394},{1367864783,876936019},{1322251820,581565268},
{2012213533,488942421},{1056962593,2025503574},{1488975081,500812631},{1018689641,337701720},
{1428157790,304147289},{1305998917,578710362},{1289746020,982563675},{1243608766,52632412},
{813693425,1220172637},{159383248,481753950},{1471149323,849140575},{1726477091,1698945888},
{895482196,664742753},{1079506933,803859298},{981989552,1786927971},{429915341,1416293220},
{97517382,1660611429},{409992434,1613896550},{862452115,1732430695},{1414526326,1364585320},
{1446507835,1680481129},{873986430,765246314},{1498936535,1170635627},{989329571,827689836},
{842529213,1432374125},{1432352084,137562990},{1378874811,1195273071},{324533654,1242381168},
{1657795496,311466865},{1099429839,724831090},{1340077573,957160307},{368573761,1677900660},
{639105854,430934901},{14680036,1675742070},{312999340,33753975},{2056253631,1424808824},
{1623716847,1677163385},{2026893545,1966984058},{269483518,792234875},{261619213,1038179196},
{1258813090,319925117},{1559229541,257522558},{1345844729,1020005247},{687340260,1867180928},
{524287001,1177217921},{1074264065,467704706},{2062020876,1494633347},{135266046,222874500},
{1608512516,1379023749},{1278211706,122878854},{432012489,442669959},{127926028,178858888},
{1753215734,618843017},{1788342962,1228049290},{1651504050,1082583947},{400030981,1144085388},
{1860694564,1433045901},{1026029660,444345230},{1256715944,1841712015},{271580666,228744080},
{485489762,1575017361},{52428700,1127689106},{1742205704,615484307},{929560851,355318676},
{1112537016,956595093},{708311737,632138646},{1207432961,2055084951},{1699738456,1533893528},
{98041669,2107468697},{569375682,727419802},{1628959710,1344756635},{916977963,2130160540},
{1885860344,409398173},{78118763,1884363678},{909637945,2087435167},{1882714625,136706976},
{1269298827,90889121},{1612706813,1612712866},{1344271869,598252451},{260046352,1244240804},
{898627918,2003954597},{1874326036,1092651942},{1595929629,1909554087},{1037039687,868809640},
{1778905804,1590332329},{371719483,615648170},{1099954128,1443113899},{1393030561,410553260},
{1184364334,681474989},{160956109,1556589486},{951580905,1716399023},{330825097,3627952},
{1337456137,1446005681},{1774187209,1861073842},{1620571117,1992326067},{1395651996,2064055220},
{1279784567,468372405},{2084565133,1706339254},{449838246,505097143},{1239938756,2035219384},
{188219033,230316985},{1419769197,1302936506},{1171257158,365284283},{608172920,30809020},
{638057279,2069707709},{1919414724,347597758},{1528820893,2114448319},{1727001379,109546432},
{1864364591,1750309825},{81264485,247532482},{789576222,409553859},{10485740,1770228676},
{68681597,1141078981},{990902431,182107078},{1829237349,1917549511},{1319106093,164174792},
{1294464607,1049500617},{224394836,1514363850},{573569978,1253137355},{434633923,178641868},
{307232182,1367407565},{340262264,1308240846},{300416451,594869199},{1292891742,372263888},
{2144334049,687213521},{869267846,43084754},{1914696124,463535059},{694680275,1881975764},
{1593308195,948857813},{118488862,1975901142},{2133323886,614230999},{52952987,411380696},
{1540879494,1692789721},{110100270,1758313434},{91750225,1067375579},{445119663,1669270492},
{1192228638,1576446941},{1145567097,2042379230},{937425156,443743199},{1951920513,1451609056},
{783284779,2069105633},{870316420,121220066},{1128789913,912030691},{1616901113,116992996},
{1564472419,441760741},{1840247376,478665702},{9437166,154205159},{1138751364,1447844840},
{1722807087,1374886889},{1348466166,1374718954},{1113585588,2109402091},{290454998,1532697580},
{530578444,1012304877},{747633262,1630448622},{1152382827,868236271},{498072650,646663152},
{1588589611,890379249},{303037886,779246578},{237502011,1197628403},{1872228882,709254132},
{1224210145,2087652341},{539491323,543210486},{659028759,568798199},{85983068,1572178936},
{1504179403,62708729},{977270968,1527004154},{1387263407,1763699707},{1050146861,232107004},
{713554608,1390672893},{713030320,1768889342},{1217918703,50478079},{736623235,818727936},
{1392506273,1505782785},{1496315098,933526530},{517471269,999648259},{774896186,436845572},
{480246892,1436326917},{523238426,647216134},{284163554,1738464263},{2022699249,244255752},
{1442313537,697375753},{1657271208,2120375306},{1957687660,1853586443},{116916001,306162700},
{166723266,1986026509},{820509156,1145302030},{1371010505,1511394319},{1906831831,553311248},
{2115498048,2024590353},{1738535695,576445458},{2066739391,267009043},{1995960637,579337236},
{1180694324,1541106709},{876607866,2127031318},{283639267,1819311127},{761264724,847297560},
{77070189,973720601},{1781527226,464337946},{1530918045,578800667},{1723855665,341077020},
{1701835604,976698397},{683670248,1607244830},{1874850313,489339935},{32505794,1809169440},
{1178072889,535407649},{509606964,154844194},{1011873910,2003618851},{1114109876,932019236},
{901773640,457149477},{847772079,243866662},{154140378,1791671335},{54001561,594922536},
{2056777932,1158339625},{1670378383,243960874},{1123022754,1091669035},{913832241,1270262828},
{1572336714,1770732589},{2075652242,1027763246},{1282406002,34241583},{2117070918,1294371888},
{1841295949,1020103729},{278396397,1912523826},{1890578927,1892854835},{670038786,230853684},
{802683398,1099455541},{603978624,1740782646},{394788111,1961794615},{510655538,873348152},
{1636824032,540351545},{383253797,786820154},{718273190,228777019},{1254094506,895872060},
{1105721289,1097804861},{1012398197,1361071166},{1968697688,1783442495},{213909096,1702562880},
{1884287494,811584577},{1276114558,170400834},{2046816464,1402129475},{512752687,520219716},
{1304950343,893594693},{1372059080,975301702},{672135935,883436615},{1912598980,888605768},
{320863644,860675145},{857209245,712825930},{1072691202,2105175115},{12582888,2128145484},
{1221064424,2064022605},{1570239566,215002190},{892336476,2064890959},{1487926508,1246248016},
{992475291,642325585},{1727525666,328019026},{987756708,29600851},{2099245151,869686356},
{697301710,425426005},{1629483997,417897558},{177209006,1157446743},{438828219,1408060504},
{903870788,699436121},{1646261180,1537616986},{1050671151,1482497115},{805304832,1904942172},
{35127229,1733491805},{843577783,146111582},{951056621,334052447},{339213689,2091494496},
{263716361,784194657},{1642066884,916175970},{2048389322,1008082019},{756021854,91155556},
{1853878832,1979477093},{1581773882,415083622},{1997009203,1098939495},{88080216,109354088},
{282066406,233995369},{250084899,1404902506},{207093365,627141739},{1171781451,1478597740},
{373292344,880098413},{402652416,1757432942},{1315436085,1951292527},{872937857,1734085744},
{1955066225,1825377393},{153091804,604454002},{396885261,655338611},{1229977304,1796684916},
{268434944,1009159285},{1209005822,2032479350},{1870131747,802475127},{41942960,1259236472},
{1411904892,1423998073},{1135605642,758172794},{2094526574,1278921851},{1750070011,651754620},
{590347162,191782013},{607648634,1949355134},{552598499,1271676031},{1301280337,227458176},
{2045243598,95947905},{538967036,221932674},{1469052174,517131395},{1882190340,1931525252},
{1655698357,1190071429},{1736962832,1100926086},{1984426306,888818823},{1027602520,675851400},
{1948250494,1461664905},{23068628,1708555402},{742914679,335293579},{1613755398,25832588},
{1947726205,430853261},{1835004502,1614929038},{1670902670,1200778383},{566754247,1324928144},
{1407710595,1405344913},{191889042,2128567442},{1591735340,2041212051},{2099769465,1520098452},
{2076700850,2028391573},{1936716189,1317047446},{1529345180,1753767063},{367000900,2046479512},
{1437594954,134044825},{1084749804,1339391130},{1191180064,790989979},{1672475530,17878172},
{178257580,393931933},{1653076911,1407261854},{1127217050,1225555103},{770177603,158256288},
{990378144,711527585},{540539897,667380898},{1817703029,999480483},{1322776105,962481316},
{1886384630,20855973},{1315960371,914996390},{451411107,977247399},{856684959,1546206376},
{1515189430,388770985},{856160671,544799914},{58720144,1564286123},{2035282161,1375685804},
{1790964393,691440813},{1037563973,1309883566},{1643115461,1080564911},{1686631279,1417465008},
{8912879,360627377},{547879915,558443698},{1621095410,1782217907},{193986190,1375968436},
{1033369684,1391475893},{1810887300,1378118838},{1648358328,174820535},{1008728188,185711800},
{959969497,1853971641},{1549792374,1771383994},{106430263,253406395},{818936294,497913020},
{1236268746,2009717949},{165150405,1647492286},{795343379,1051221183},{484441189,1765301440},
{2057302190,1640832193},{536869888,1947229378},{1329067547,534236355},{1388311978,249801924},
{527432722,302148805},{1898443238,1882500294},{2010640674,753581255},{1968173406,164895944},
{1272444549,1472818377},{1649406904,1121094858},{1087895529,296320203},{1412429178,333065420},
{1104672709,1268858061},{1042282557,414391502},{799013388,1436306639},{1098905553,370089168},
{96468808,1998982353},{737671810,1633328338},{1900016088,280206547},{1499985109,2069630164},
{1823470195,331807957},{2100293765,1776975062},{1218967276,1854160087},{221773401,1142365400},
{1412953465,1242631385},{1161819994,963247322},{902297929,1943387355},{1067972619,19381468},
{2002252062,1887857885},{1400894869,181259486},{1563423838,94522591},{879229299,2106354912},
{1351087601,1268309217},{2124410945,347966690},{1685058427,1626152163},{412089582,1251634404},
{1960309102,1556737253},{24641489,866614502},{893385048,855882983},{947910896,515206376},
{266862083,999406825},{398458120,971562218},{1935143321,130030827},{549977064,1146891500},
{1290794594,1624526061},{1740108557,1528458478},{2103963754,184155375},{1380447671,939498736},
{441449654,1355521265},{1540355214,1516997874},{1328543260,68754675},{84410207,2105408756},
{1865937443,1693613301},{1900540379,157859062},{1672999817,962497783},{1380971958,1781714168},
{305659321,363773177},{1851257397,1110195450},{301465025,616586491},{1669854110,622050556},
{284687842,1341869309},{1601172504,1859325182},{1869083165,1151483135},{950008044,984767744},
{1876947461,2025278721},{974125246,1377877250},{1038088262,1822354691},{48758691,197627140},
{279969258,1424260357},{1766322903,1692851462},{114818853,550538503},{200801921,1603566856},
{576191413,599620873},{232259141,1090800906},{694155988,1908284683},{471334013,1436986636},
{1167587150,1587657997},{381680936,312343822},{1382020534,1289886991},{239599159,1162935568},
{552074211,363113745},{154664665,212327698},{980416690,1099885843},{315620774,351120660},
{2102915237,1851243797},{1280308856,343768342},{1167062865,248937751},{656407324,351915288},
{1262483098,369687833},{177733293,313494810},{773323325,2103921947},{1828713072,1661160732},
{977795255,122834205},{1443362114,1075272990},{2146431944,1582796063},{1586492467,471100704},
{731904652,597122337},{39321525,2142412066},{1578628166,2123435299},{1179645750,1267911972},
{1244133055,1675210021},{332922245,2107997478},{974649534,263429415},{1368913359,391576872},
{1235220172,1433046313},{468188291,827059498},{315096487,355679531},{1606939659,320478508},
{1908928970,773872941},{1661989790,1770179886},{20447193,333569327},{635960133,1511025968},
{1979183470,1925692721},{860354967,958332210},{537918462,529644851},{271056380,558308660},
{1740632848,1771478325},{340786550,717385014},{941095168,1206672695},{1204287240,1054170424},
{2104488064,1287851321},{787479076,448367930},{953153768,144432443},{458226838,1247141180},
{1413477753,1691102525},{429391056,1694936382},{304610747,559668543},{225967697,959130944},
{2025320693,1922952513},{410516721,2136583490},{1040709695,713088323},{1058011167,1456483652},
{1359476193,2081090885},{1502606542,1008684358},{568851395,596626759},{825227738,1052114248},
{1435497807,497556809},{1710748482,1924345162},{1341650433,1396538699},{1637348301,1544240460},
{1156577124,1742462285},{1592259620,874397006},{391118102,631393615},{782760491,1642155344},
{1527248032,1219104081},{804780547,603774290},{536345603,429268307},{1055914023,1432624468},
{1570763853,243526997},{215481957,338980182},{660077333,1526406487},{1212151544,1000275288},
{854587811,1529584985},{944240887,812485978},{1561326687,2000014683},{642251575,1487367516},
{214957671,971570525},{199753347,1045171550},{100138817,808918367},{2049962210,1041657184},
{206044791,996343137},{1600648213,485936482},{2013786374,1541975395},{492829780,962735460},
{274202101,355478885},{1777857218,1941323110},{1318581805,1251851623},{1978134853,1251315048},
{1742729994,231611753},{1373631944,1646251370},{1147139957,1491635563},{899152205,1785490796},
{1785197239,677477741},{578812848,2071461230},{1658844072,305659247},{1907356122,73809264},
{1266153105,1685458289},{612367217,554237298},{1286076011,1998814579},{1682961275,246279540},
{1911026133,133102965},{2006446355,1978592630},{1999630618,1958485367},{2143285567,1184210296},
{404749564,776015225},{655358750,2065423738},{443022515,1873132923},{887093604,2137349500},
{1994387755,1639562621},{421002461,1434185086},{520616991,1779191167},{232783428,1639464320},
{871889281,1953348993},{986708134,1460231554},{1465906453,739532163},{2072506525,931216772},
{1542976641,1868447109},{437255359,1878515078},{1693447013,988786055},{134217472,779685256},
{76021615,723021193},{1026553950,1856417162},{22544341,13032843},{1548219511,1605537164},
{6815731,420257165},{1572861001,525217166},{1708651342,1674075535},{921696546,92470672},
{1898967514,1015487889},{1846538829,978087314},{837810626,1181416851},{1660941219,249965972},
{211811948,1188711829},{1408759169,1625705878},{1041233984,1862143383},{1820324468,1264876952},
{1034942539,439156121},{231210567,528907674},{50855839,1145818523},{1336407565,640744860},
{668465926,738024861},{2100818145,751570334},{2081419409,224292255},{73400180,200510880},
{727710356,1525497249},{979368117,1243385250},{459275412,1910132131},{1895297508,37424548},
{1563948122,1457175973},{1309144642,1278463398},{796916241,1193930151},{681048813,1927601576},
{2015359238,264146345},{475528309,440663466},{1988096305,548634027},{440401080,656096684},
{335543680,390880685},{635435844,526708142},{1257240226,123960751},{785381926,671931824},
{81788772,351583665},{859306394,1520889266},{1689777005,1206107571},{1955590511,1441906100},
{348650855,336612789},{1979707715,16403894},{470809726,901479863},{1051195437,1329638840},
{823130590,1657413049},{1620046835,853167546},{2027417840,1561849275},{70254458,1304624572},
{2098196708,464559549},{785906213,1255013822},{2008019227,1728847295},{711457459,1394093504},
{2113400928,569789889},{984610986,1969884610},{1632629720,949104067},{788003363,267836868},
{560462803,1243205061},{192937616,194579910},{1168635727,139820487},{1732244254,1840319944},
{986183848,1487879625},{858782106,535940554},{1028126814,1845714379},{1448080697,1794538956},
{1590686758,2130038221},{1351611888,1962147278},{1794634404,1902640591},{1536160910,1799523792},
{1524102309,1382624721},{1477965056,1933954514},{985135273,1605983699},{270007805,1982094804},
{513276973,604208597},{917502250,1265466838},{1098381265,1240075735},{1288697446,1538649560},
{676330230,1424023001},{1080555511,1762557402},{2091380874,385510875},{1806693005,1415392732},
{107478835,1212169693},{1961357690,724012510},{1760031465,1516309983},{1982853450,1154801120},
{1862267426,766504417},{1191704351,871210466},{834140618,2048855523},{346029420,1158692324},
{111148845,1486667237},{2145908329,1742003686},{2101342337,997965287},{685243109,1584639464},
{1076885498,2074398185},{409468148,1334795754},{1134032782,1615375851},{1616376822,1638518252},
{1933570467,2033503725},{341835124,857800174},{1107818432,464518639},{1622143978,772787696},
{686815970,1637965297},{674233082,1176141298},{2126508094,1895489011},{146276073,456207860},
{1496839386,1373613557},{529529870,2092686838},{1523578025,2091818487},{407895286,1002524152},
{1005058179,739765753},{505412668,1211862522},{1019738215,1643998715},{1823994499,1887383036},
{1306523204,1617219069},{733477516,1212112382},{983562412,1025588735},{8388592,1204444672},
{1830285922,1560772097},{2125983870,1681399298},{1831334514,1573076483},{704641728,213323268},
{1655174062,2007059973},{1649931192,1321061894},{2070933661,1054129671},{749730412,1663016456},
{1960833381,1339063817},{1294988892,1985695242},{226491984,1248050699},{1524626598,922635788},
{559938516,1849908749},{129498889,1102560782},{393215250,977833487},{1987047741,729288208},
{293076433,1044639249},{1884811776,1247784466},{884472171,820280851},{1659368368,1526853140},
{299892165,594386453},{553122786,1528327702},{1250948782,1068240407},{994048154,505732632},
{1087371240,722251289},{547355628,668405274},{1439692104,1777679899},{185073311,1120202268},
{580909996,1711762973},{1607463942,1978596894},{312475052,1275923999},{1464333591,2081603104},
{1182267185,46214689},{2111303799,1724096034},{691534553,1866579491},{453508255,1036029476},
{1013446775,860810789},{1517810869,73293350},{957872349,245792295},{1472722183,212225576},
{355990873,1670315561},{634911557,1131232810},{93847373,1316314667},{502266946,351723052},
{2017980666,645635629},{991426719,1189092910},{82837346,1132224047},{1083701229,741060144},
{531102731,1978097201},{523762713,1454235186},{1291318881,384572979},{1675096970,295611956},
{213384810,1910394421},{1743254278,1136541238},{656931611,401489463},{1706029899,732065336},
{371195196,302816825},{1588065327,1103896122},{826800599,1276100155},{1054865444,399736380},
{1202714378,1152941629},{1073215489,807833150},{172490423,1837588031},{1869607445,1558085184},
{1681388420,89304641},{828897748,1006812738},{714078894,966086211},{1197995797,1107783236},
{1783624375,719523397},{1095235543,330989126},{1990717746,209346119},{529005583,522526280},
{122683158,2047663689},{1405089160,1725193802},{797440527,1977155147},{1484256500,1706901068},
{580385709,404557389},{108003122,959618638},{627047252,2039463503},{1916793280,126197328},
{1281881715,828898897},{567278534,337935954},{927463703,1699397203},{2094002281,716025428},
{1016592493,1140424277},{1280833142,61636182},{46137256,676585047},{928512278,262131288},
{644873010,2046635609},{1242560190,490180186},{1136129929,447565403},{958920923,1635364444},
{1999106336,2099175005},{30408646,26693214},{1697641307,11865695},{1791488679,1769815648},
{1902113246,1942789729},{693631701,1071951458},{1887957500,1073749603},{1969746266,1483841124},
{259522066,1097703013},{1888481789,2016956006},{683145961,1336970855},{1268774542,1840610920},
{1926230456,474050153},{1510995134,55844458},{790100509,233082475},{1958211961,1262669420},
{1846014532,624000621},{1541403780,884477550},{45088682,1925086831},{1546122369,2108231280},
{1233647311,214724209},{13631462,890580594},{926939416,230157939},{1963979107,1014333044},
{1479537914,165760629},{1389884838,1277247094},{1399846290,1206763127},{677378804,1468104312},
{1634202584,1050975865},{1181742900,372280954},{1624241127,924577403},{1205860102,1667370620},
{1139799940,930328189},{414711017,1637527166},{1425012070,312262271},{1614803962,510992000},
{915929389,135544449},{545258480,1111215746},{1035466825,1387695747},{2140139565,449162884},
{698350284,54197893},{899676493,992185990},{826276312,1479110279},{705690303,938438280},
{1587541040,1464712841},{67633023,186695306},{1534063765,1352822411},{1630532573,1115405964},
{924317981,205872781},{1401943438,1166175886},{493354068,473992847},{488635484,809504400},
{353369438,1381371537},{1175975743,1020329618},{490732632,1052745363},{645397297,829902484},
{1574433863,60939925},{1668805522,1835732630},{1711797059,1559752343},{1752167155,967794328},
{426769619,403742361},{351272290,2047434394},{365952326,1089093275},{1070594056,434966172},
{482868327,1148276381},{176684719,122797726},{1457517862,1639964319},{236977724,478199456},
{235404863,728661665},{628095826,1320308386},{55050135,299650723},{1273493124,1555644068},
{2001727799,274165413},{1027078237,1329651366},{909113659,758259367},{1974464848,1550405288},
{882375021,2078723753},{987232423,1116180138},{142606064,1918406315},{1569190997,1169817260},
{108527409,1573498541},{386399519,878550702},{1686106994,1942392495},{2077225130,363630256},
{866122125,1707908785},{1844965974,1134050994},{866646411,764698291},{1551889525,153452212},
{1256191653,1118826165},{1841820249,132304566},{1436022099,1982217911},{75497328,811491000},
{422051036,23826105},{1661465503,1043955386},{510131251,114880187},{931133712,53759676},
{611318642,1269231293},{188743320,1162370750},{786430500,500076223},{304086460,1507176128},
{457178264,1990590145},{1021311076,2037767874},{1765274330,590610115},{1578103870,1263226564},
{282590693,289361605},{1741157129,74567366},{549452776,1024667335},{1951396224,1378909896},
{181927589,2033925833},{454032542,176824010},{210239087,368094923},{1878520329,1252216524},
{270532092,90934989},{2127032563,364240590},{466615430,1715809999},{1964503406,660430544},
{1299183186,412081873},{501742659,1527889618},{1203762952,944078547},{1311766075,1189043924},
{496499790,220446421},{37748664,677404374},{2049437897,1805885143},{641203001,513441496},
{1767371492,1644736217},{1352660462,865713882},{1124595616,1391574747},{997193874,741756636},
{725613210,2028486365},{1893724644,232795870},{729807506,1727958751},{1815605892,325951200},
{932706574,1739353825},{208666226,1092644578},{944765177,1297948387},{540015610,1661914852},
{144178925,637320933},{1939337613,661110502},{806353406,964374247},{1552413810,290864872},
{1790440107,832401129},{1016068208,848654058},{577239987,207097579},{1257764513,183615212},
{1069545480,1776901869},{864549263,52485870},{503315520,726241007},{763361872,1476779760},
{1755837163,1258409713},{1858073141,1946918642},{1508897986,2080038643},{638581566,16469748},
{1966600538,1293856501},{1544549506,1228082934},{967833804,1490583287},{162004683,1502437112},
{1024456799,885186297},{1784148664,163081978},{483392615,1695502075},{187170459,1542999804},
{619182947,547954429},{174587571,1938013950},{2084040835,1091297023},{1029699670,10858240},
{617085799,339619585},{1861743138,1142615810},{1082128370,1278856963},{1458042148,1647574788},
{1272968838,390291205},{392166677,28262150},{2004873490,983498503},{1354233321,1502080776},
{261094926,836779785},{508034103,1767587594},{1101526987,1504857867},{769129029,1686515468},
{1946677632,993414925},{514849834,69390},{1879568903,1188658959},{1895821801,83341072},
{2047865053,1363713809},{102235965,2139287314},{575142840,1120812819},{1438119243,1218117396},
{1700262754,165138197},{958396638,322969366},{1481110775,1532686103},{1654649796,1393245976},
{1483732210,1569099545},{789051936,1620877082},{1826615910,2117287707},{1820848752,1087737628},
{1486877932,433037085},{1160771418,852061982},{360185169,138272543},{765983307,245092128},
{1526199457,1628565281},{1209530109,1817689890},{405273851,1963613987},{607124346,1396080420},
{1924133292,756698917},{966785228,845786918},{1683485557,1671270183},{347077994,240623400},
{2000154906,1608417065},{2114973776,1760411434},{779090482,1010204459},{362806604,101244716},
{1849160254,1326059309},{344980846,215838510},{726661782,2014416687},{1995436338,1693617968},
{1644688328,1795039025},{514325549,13872946},{1909977541,335400755},{221249114,1192464180},
{961542359,341327669},{1226307296,98959158},{1006106754,957894455},{253754908,1572937528},
{1767895765,1805020985},{2090856646,388575034},{844102071,1040600891},{349699430,535424828},
{955775206,618700605},{2011164933,798424894},{2028466476,10493759},{368049474,1374191424},
{1771565780,413110081},{1117255601,198745922},{1938289081,1351003971},{2055205058,1668042564},
{956299488,1984323397},{2077749423,1131831110},{1242035903,333782855},{277872110,163655496},
{640154427,1211813705},{629144401,1236131658},{85458781,876109643},{1848111675,1728659276},
{546831341,773615437},{1535112342,631439182},{1494742237,188374863},{42991534,1510838096},
{541588471,311209809},{1667232663,452153170},{1487402219,1739108179},{1297610332,562634580},
{1915744700,632745813},{1251473069,1999081302},{121634584,1260056407},{877132151,2066693976},
{2032136430,389779289},{1045952565,1599995738},{1342699007,588607323},{1577055303,870367068},
{1531442332,1811492701},{47185830,1022861150},{1803022993,1953668959},{1152907114,511618912},
{521665566,1015238497},{922220833,1281830754},{1574958151,95248227},{811596278,1323573092},
{1777332931,1999961957},{1598551068,566222694},{1501557970,811560807},{850917801,1768394600},
{830470608,1060622185},{930085138,533872490},{65011588,844611435},{1153431400,374513516},
{29360072,1494298477},{942668026,299462510},{1423439207,1167298415},{834664904,260960112},
{387972380,280002417},{260570639,343703410},{1066399758,1386008435},{1214248693,624566132},
{1169160012,187506549},{1055389734,818343798},{2060447948,573767543},{957348062,758202232},
{1969221987,1430163321},{525859861,242364282},{1342174721,1490481019},{346553707,107470716},
{730331791,446443389},{1783100087,1413513086},{42467247,909217663},{1271920262,1981329280},
{1137702790,1842220929},{1838674509,1721323394},{1560278112,1180065667},{1511519421,1592819588},
{786954789,449359749},{1915220419,746999686},{2097148,419950471},{1229453016,375807880},
{1188558632,1330823049},{1369961935,533278602},{170393275,1388908427},{2073030837,576724876},
{720370338,130342797},{941619452,1134858126},{119013149,1964539791},{544734193,601821072},
{364903752,1583996817},{553647072,462266258},{970455239,470339475},{783809065,153440148},
{524287,596864917},{701496006,98529174},{117964575,996954007},{435158210,972029848},
{1479013630,1540116377},{2085613709,1077682074},{1764750047,1938231195},{2120216665,995553180},
{1103099852,1690484637},{1143994234,850481054},{265289222,33873823},{835713478,728088480},
{978843831,1525624737},{1581249593,441778082},{2080895147,1874853795},{1426584933,369991588},
{254279195,2099724197},{460323986,1409290150},{1285551726,1021218727},{1861218852,2112212904},
{1696592734,494608297},{1350039025,1826570154},{1800925847,1927450539},{708836025,535064492},
{133168898,58904493},{840956348,472944558},{521141278,153726895},{325582227,250347440},
{1375204801,1840922545},{15204323,472407986},{1542452355,567439283},{105381687,1519947700},
{171441849,2006716341},{1058535454,754433974},{2009067794,1395343287},{1799877271,265387960},
{2112352326,1109499833},{1733292822,540733370},{964163793,1384423355},{569899969,826998716},
{792197657,253853629},{389020954,617639870},{577764274,320331711},{590871449,927621056},
{832567758,653774785},{1293416030,199282626},{146800360,1832341443},{83361633,1224208324},
{1664086942,1219624901},{1718612787,1817325510},{1089992675,1091321799},{669514499,1681145800},
{1062205462,1437638601},{1554510958,217165770},{69205884,750239691},{583531431,1748426700},
{436206785,568950733},{428866766,1871622094},{1763177187,514392015},{148897508,173191120},
{1255667367,779665361},{888666466,681385938},{2074603700,1935437779},{59244431,890957780},
{2060972230,356339669},{1827140197,1019531222},{21495767,540565463},{1648882629,214192088},
{101187391,445226969},{900200781,877297626},{1356330471,1482711003},{598735754,838938588},
{1200092946,290467805},{1682436991,24592350},{1688728428,61296607},{1456993577,173354976},
{684194536,1000185825},{306707895,356417506},{1566045271,1299181539},{1091565534,579026916},
{907016511,458018789},{1183840047,1023938534},{1980232008,1544904679},{1738011416,1008762856},
{2021126393,563601385},{387448093,339034090},{189791894,1855213547},{1562375264,234094572},
{2014834944,1585672173},{1160247139,1175506926},{1887433218,1318850543},{588250017,449249264},
{611842929,1815785457},{696253139,1936674802},{74973041,1390813171},{1754788594,1673334772},
{956823776,167489525},{1173354306,2111897590},{652737316,796594167},{780139056,1157468152},
{1035991112,557969401},{1591211048,907370490},{1836053075,1329336315},{239074872,365875196},
{1092089821,1687924733},{359660883,1123516414},{1702359889,745918463},
};
| 80.546311
| 110
| 0.793872
|
eniac
|
5af27f1563b3385df9acbc8fd8d973b92daedaa5
| 548
|
cpp
|
C++
|
Compiler/IntConstantExpression.cpp
|
acbarrentine/Mika
|
8d88f015360c1ab731da0fda1281a3327dcb9ec9
|
[
"Unlicense"
] | null | null | null |
Compiler/IntConstantExpression.cpp
|
acbarrentine/Mika
|
8d88f015360c1ab731da0fda1281a3327dcb9ec9
|
[
"Unlicense"
] | null | null | null |
Compiler/IntConstantExpression.cpp
|
acbarrentine/Mika
|
8d88f015360c1ab731da0fda1281a3327dcb9ec9
|
[
"Unlicense"
] | null | null | null |
#include "stdafx.h"
#include "IntConstantExpression.h"
#include "Compiler.h"
#include "ObjectFileHelper.h"
void IntConstantExpression::ResolveType(SymbolTable&)
{
mType = GCompiler.GetIntType();
Token& tok = GCompiler.GetToken(mRootToken);
mValue = tok.GetIntValue();
}
void IntConstantExpression::GenCode(ObjectFileHelper& helper)
{
mResultRegister = new IRRegisterOperand;
IRInstruction* op = helper.EmitInstruction(CopyConstantToStack, mRootToken);
op->SetOperand(0, mResultRegister);
op->SetOperand(1, new IRIntOperand(mValue));
}
| 23.826087
| 77
| 0.775547
|
acbarrentine
|
5af511673b65874c9ebf3e5e97032f7758235e5c
| 1,073
|
hh
|
C++
|
src/lisp/map.hh
|
kuriboshi/lips
|
f9f4838a95ff574fb7a627a3eb966b38b6f430f7
|
[
"Apache-2.0"
] | 1
|
2020-11-10T11:02:21.000Z
|
2020-11-10T11:02:21.000Z
|
src/lisp/map.hh
|
kuriboshi/lips
|
f9f4838a95ff574fb7a627a3eb966b38b6f430f7
|
[
"Apache-2.0"
] | null | null | null |
src/lisp/map.hh
|
kuriboshi/lips
|
f9f4838a95ff574fb7a627a3eb966b38b6f430f7
|
[
"Apache-2.0"
] | null | null | null |
//
// Lips, lisp shell.
// Copyright 2020 Krister Joas
//
#pragma once
#include "lisp.hh"
namespace lisp
{
namespace Map
{
void init();
LISPT map(lisp&, LISPT, LISPT, LISPT);
LISPT mapc(lisp&, LISPT, LISPT, LISPT);
LISPT maplist(lisp&, LISPT, LISPT, LISPT);
LISPT mapcar(lisp&, LISPT, LISPT, LISPT);
}
inline LISPT map(lisp& l, LISPT a, LISPT b, LISPT c) { return Map::map(l, a, b, c); }
inline LISPT map(LISPT a, LISPT b, LISPT c) { return Map::map(lisp::current(), a, b, c); }
inline LISPT mapc(lisp& l, LISPT a, LISPT b, LISPT c) { return Map::mapc(l, a, b, c); }
inline LISPT mapc(LISPT a, LISPT b, LISPT c) { return Map::mapc(lisp::current(), a, b, c); }
inline LISPT maplist(lisp& l, LISPT a, LISPT b, LISPT c) { return Map::maplist(l, a, b, c); }
inline LISPT maplist(LISPT a, LISPT b, LISPT c) { return Map::maplist(lisp::current(), a, b, c); }
inline LISPT mapcar(lisp& l, LISPT a, LISPT b, LISPT c) { return Map::mapcar(l, a, b, c); }
inline LISPT mapcar(LISPT a, LISPT b, LISPT c) { return Map::mapcar(lisp::current(), a, b, c); }
} // namespace lisp
| 33.53125
| 98
| 0.650513
|
kuriboshi
|
5af6f81c6da9bb1476794675832ad0e9875d9b55
| 31,030
|
cc
|
C++
|
kleption.cc
|
jdb19937/tewel
|
e2dc25c0998b2bf2763cd68ff66691e0c9f86928
|
[
"MIT"
] | null | null | null |
kleption.cc
|
jdb19937/tewel
|
e2dc25c0998b2bf2763cd68ff66691e0c9f86928
|
[
"MIT"
] | null | null | null |
kleption.cc
|
jdb19937/tewel
|
e2dc25c0998b2bf2763cd68ff66691e0c9f86928
|
[
"MIT"
] | null | null | null |
#define __MAKEMORE_KLEPTION_CC__ 1
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <dirent.h>
#include "kleption.hh"
#include "random.hh"
#include "youtil.hh"
#include "colonel.hh"
#include "camera.hh"
#include "display.hh"
#include "picpipes.hh"
#include "rando.hh"
#include <algorithm>
namespace makemore {
std::string Kleption::picreader_cmd;
std::string Kleption::picwriter_cmd;
std::string Kleption::vidreader_cmd;
std::string Kleption::vidwriter_cmd;
Kleption::Kleption(
const std::string &_fn,
unsigned int _pw, unsigned int _ph, unsigned int _pc,
Flags _flags, Trav _trav, Kind _kind,
unsigned int _sw, unsigned int _sh, unsigned int _sc,
const char *refsfn, double _evolve, double _rvgmul, double _trim
) {
fn = _fn;
flags = _flags;
trav = _trav;
pw = _pw;
ph = _ph;
pc = _pc;
sw = _sw;
sh = _sh;
sc = _sc;
loaded = false;
trim = _trim;
b = 0;
dat = NULL;
cam = NULL;
frames = 0;
dsp = NULL;
idi = 0;
vidreader = NULL;
vidwriter = NULL;
datreader = NULL;
datn = 0;
datwriter = NULL;
refwriter = NULL;
rvg = NULL;
evolve = _evolve;
rvgmul = _rvgmul;
if (refsfn) {
if (trav != TRAV_REFS)
error("refsfn requires trav refs");
refreader = fopen(refsfn, "r");
if (!refreader)
error(std::string("can't open ") + refsfn + ": " + strerror(errno));
} else
refreader = NULL;
if (_kind == KIND_SDL) {
if (!(flags & FLAG_WRITER))
error("can't input from sdl");
// assert(fn == "0");
kind = KIND_SDL;
dsp = new Display;
dsp->open();
return;
}
if (_kind == KIND_REF) {
if (!(flags & FLAG_WRITER))
error("can't input from ref");
kind = KIND_REF;
return;
}
if (_kind == KIND_CAM) {
if (fn == "")
fn = "/dev/video0";
if (flags & FLAG_WRITER)
error("can't output to camera");
}
if (_kind == KIND_RND) {
if (flags & FLAG_WRITER)
error("can't output to rnd kind");
kind = KIND_RND;
return;
}
struct stat buf;
int ret = ::stat(fn.c_str(), &buf);
if (ret != 0) {
if (!(flags & FLAG_WRITER))
error("failed to stat " + fn + ": " + strerror(errno));
if (_kind == KIND_DIR) {
if (0 == ::mkdir(fn.c_str(), 0755))
warning("created directory " + fn);
else if (errno != EEXIST)
error("failed to create directory " + fn + ": " + strerror(errno));
if (pw == 0 || ph == 0 || pc == 0)
error("outdim required for dir kind");
kind = KIND_DIR;
return;
}
if (_kind == KIND_RVG) {
kind = KIND_RVG;
return;
}
if (_kind == KIND_F64LE) {
kind = KIND_F64LE;
return;
}
if (_kind == KIND_U8) {
kind = KIND_U8;
return;
}
if (_kind == KIND_VID) {
kind = KIND_VID;
return;
}
if (_kind == KIND_PIC) {
kind = KIND_PIC;
return;
}
assert(_kind == KIND_ANY);
if (endswith(fn, ".dat") || endswith(fn, ".f64le")) {
kind = KIND_F64LE;
} else if (endswith(fn, ".rgb") || endswith(fn, ".u8")) {
kind = KIND_U8;
} else if (endswith(fn, ".rvg")) {
kind = KIND_RVG;
} else if (
endswith(fn, ".mp4") ||
endswith(fn, ".avi") ||
endswith(fn, ".mkv")
) {
kind = KIND_VID;
} else if (
endswith(fn, ".jpg") ||
endswith(fn, ".png") ||
endswith(fn, ".pbm") ||
endswith(fn, ".pgm") ||
endswith(fn, ".ppm")
) {
kind = KIND_PIC;
} else {
warning(std::string("can't identify kind from extension, assuming pic for ") + fn);
kind = KIND_PIC;
}
return;
}
if (S_ISDIR(buf.st_mode)) {
assert(_kind == KIND_DIR || _kind == KIND_ANY);
if (pw == 0 || ph == 0 || pc == 0)
error("outdim required for dir kind");
kind = KIND_DIR;
return;
} else if (S_ISCHR(buf.st_mode) && ::major(buf.st_rdev) == 81) {
if (flags & FLAG_WRITER)
error("can't output to camera");
if (trav != TRAV_SCAN)
error("reading cam kind requires scan traversal");
assert(_kind == KIND_CAM || _kind == KIND_ANY);
kind = KIND_CAM;
return;
} else {
if (_kind == KIND_F64LE) {
kind = KIND_F64LE;
return;
}
if (_kind == KIND_U8) {
kind = KIND_U8;
return;
}
if (_kind == KIND_VID) {
if (!(flags & FLAG_WRITER))
if (trav != TRAV_SCAN)
error("reading vid kind requires scan traversal");
kind = KIND_VID;
return;
}
if (_kind == KIND_PIC) {
kind = KIND_PIC;
return;
}
if (_kind == KIND_RVG) {
kind = KIND_RVG;
return;
}
if (endswith(fn, ".dat") || endswith(fn, ".f64le")) {
kind = KIND_F64LE;
} else if (endswith(fn, ".rgb") || endswith(fn, ".u8")) {
kind = KIND_U8;
} else if (endswith(fn, ".rvg")) {
kind = KIND_RVG;
} else if (
endswith(fn, ".mp4") ||
endswith(fn, ".avi") ||
endswith(fn, ".mkv")
) {
if (!(flags & FLAG_WRITER))
if (trav != TRAV_SCAN)
error("reading vid kind requires scan traversal");
kind = KIND_VID;
} else if (
endswith(fn, ".jpg") ||
endswith(fn, ".png") ||
endswith(fn, ".pbm") ||
endswith(fn, ".pgm") ||
endswith(fn, ".ppm")
) {
kind = KIND_PIC;
} else {
warning(std::string("can't identify kind from extension, assuming pic for ") + fn);
kind = KIND_PIC;
}
return;
}
}
Kleption::~Kleption() {
if (loaded)
unload();
if (dsp)
delete dsp;
if (vidwriter)
delete vidwriter;
if (datreader)
fclose(datreader);
if (datwriter)
fclose(datwriter);
if (refreader)
fclose(refreader);
if (refwriter)
fclose(refwriter);
if (rvg) {
assert(flags & FLAG_WRITER);
rvg->save(fn);
delete rvg;
}
}
void Kleption::unload() {
if (!loaded)
return;
switch (kind) {
case KIND_RND:
break;
case KIND_RVG:
assert(rvg);
delete rvg;
rvg = NULL;
break;
case KIND_CAM:
assert(cam);
delete cam;
cam = NULL;
assert(dat);
delete[] dat;
dat = NULL;
b = 0;
idi = 0;
break;
case KIND_VID:
if (vidreader) {
delete vidreader;
vidreader = NULL;
}
assert(dat);
delete[] dat;
dat = NULL;
b = 0;
idi = 0;
break;
case KIND_DIR:
for (auto psi = id_sub.begin(); psi != id_sub.end(); ++psi) {
Kleption *subkl = psi->second;
delete subkl;
}
ids.clear();
id_sub.clear();
idi = 0;
break;
case KIND_PIC:
assert(dat);
delete[] dat;
dat = NULL;
b = 0;
idi = 0;
break;
case KIND_U8:
case KIND_F64LE:
assert(dat);
unmapfp(dat, datn);
if (datreader)
fclose(datreader);
datreader = NULL;
dat = NULL;
b = 0;
idi = 0;
break;
}
loaded = false;
}
void Kleption::load() {
if (loaded)
return;
switch (kind) {
case KIND_VID:
{
assert(!vidreader);
vidreader = new Picreader(vidreader_cmd);
vidreader->open(fn);
assert(!dat);
unsigned int w, h;
assert(vidreader->read(&dat, &w, &h));
if (w != sw) {
if (sw)
error("vid width doesn't match");
sw = w;
}
if (h != sh) {
if (sh)
error("vid height doesn't match");
sh = h;
}
if (3 != sc) {
if (sc)
error("vid channels doesn't match");
sc = 3;
}
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = 3;
assert(pw <= w);
assert(ph <= h);
assert(pc == 3);
b = 1;
}
break;
case KIND_RND:
{
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
if (sw == 0)
sw = pw;
if (sh == 0)
sh = ph;
if (sc == 0)
sc = pc;
assert(pw <= sw);
assert(ph <= sh);
assert(pw > 0);
assert(ph > 0);
assert(pc == sc);
}
break;
case KIND_RVG:
{
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
if (sw == 0)
sw = pw;
if (sh == 0)
sh = ph;
if (sc == 0)
sc = pc;
assert(pw <= sw);
assert(ph <= sh);
assert(pw > 0);
assert(ph > 0);
assert(pc == sc);
assert(!rvg);
rvg = new Rando(sc);
rvg->load(fn);
}
break;
case KIND_CAM:
{
assert(!cam);
cam = new Camera(fn, sw, sh);
cam->open();
if (sw && cam->w != sw)
error("cam width doesn't match");
if (sh && cam->h != sh)
error("cam height doesn't match");
if (sc && 3 != sh)
error("cam channels doesn't match");
sw = cam->w;
sh = cam->h;
sc = 3;
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
assert(pw <= sw);
assert(ph <= sh);
assert(pw > 0);
assert(ph > 0);
assert(pc == 3);
assert(!dat);
dat = new uint8_t[sw * sh * 3];
b = 1;
}
break;
case KIND_DIR:
{
assert(ids.empty());
assert(id_sub.empty());
assert(pw > 0);
assert(ph > 0);
assert(pc > 0);
DIR *dp = ::opendir(fn.c_str());
assert(dp);
struct dirent *de;
while ((de = ::readdir(dp))) {
if (*de->d_name == '.')
continue;
std::string subfn = de->d_name;
Kleption *subkl = new Kleption(
fn + "/" + subfn, pw, ph, pc,
flags & ~FLAG_REPEAT, trav, KIND_ANY,
sw, sh, sc
);
if (subkl->kind == KIND_CAM) {
delete subkl;
error("v4l2 device found in dir, dir can contain only pics");
}
if (subkl->kind == KIND_VID) {
delete subkl;
error("vid found in dir, dir can contain only pics");
}
assert(
subkl->kind == KIND_DIR ||
subkl->kind == KIND_F64LE ||
subkl->kind == KIND_U8 ||
subkl->kind == KIND_PIC
);
id_sub.insert(std::make_pair(subfn, subkl));
ids.push_back(subfn);
}
::closedir(dp);
assert(ids.size() > 0);
std::sort(ids.begin(), ids.end());
}
break;
case KIND_PIC:
assert(!dat);
unsigned int w, h;
{
Picreader picreader(picreader_cmd);
picreader.open(fn);
picreader.read(&dat, &w, &h);
}
b = 1;
if (w != sw) {
if (sw)
error("pic width doesn't match");
sw = w;
}
if (h != sh) {
if (sh)
error("pic height doesn't match");
sh = h;
}
if (3 != sc) {
if (sc)
error("pic channels doesn't match");
sc = 3;
}
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
assert(pw <= sw);
assert(ph <= sh);
assert(pc == sc);
assert(pw > 0);
assert(sw > 0);
assert(ph > 0);
assert(sh > 0);
assert(pc > 0);
assert(sc == 3);
break;
case KIND_U8:
{
assert(!dat);
if (!sw) {
sw = pw;
if (!sw)
error("dat width required");
}
if (!sh) {
sh = ph;
if (!sh)
error("dat height required");
}
if (!sc) {
sc = pc;
if (!sc)
error("dat channels required");
}
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
datn = 0;
assert(!datreader);
if (!(datreader = ::fopen(fn.c_str(), "r")))
error("can't open " + fn);
// dat = slurp(fn, &datn);
dat = mapfp(datreader, &datn);
unsigned int swhc = sw * sh * sc;
assert(datn % swhc == 0);
b = datn / swhc;
break;
}
case KIND_F64LE:
{
assert(!dat);
if (!sw) {
sw = pw;
if (!sw)
error("dat width required");
}
if (!sh) {
sh = ph;
if (!sh)
error("dat height required");
}
if (!sc) {
sc = pc;
if (!sc)
error("dat channels required");
}
if (pw == 0)
pw = sw;
if (ph == 0)
ph = sh;
if (pc == 0)
pc = sc;
datn = 0;
assert(!datreader);
if (!(datreader = ::fopen(fn.c_str(), "r")))
error("can't open " + fn);
// dat = slurp(fn, &datn);
dat = mapfp(datreader, &datn);
unsigned int swhc = sw * sh * sc;
assert(datn % (8 * swhc) == 0);
b = datn / swhc / 8;
break;
}
default:
assert(0);
}
loaded = true;
}
static void _outcrop(
const uint8_t *tmpdat, double *kdat, Kleption::Flags flags,
int sw, int sh, int sc, int pw, int ph, int pc,
unsigned int *x0p, unsigned int *y0p, double trim
) {
assert(pw <= sw);
assert(ph <= sh);
assert(pc == sc);
unsigned int x0, y0, x1, y1;
if (flags & Kleption::FLAG_CENTER) {
x0 = (sw - pw) / 2;
y0 = (sh - ph) / 2;
} else {
int bx0 = trim * sw;
int by0 = trim * sh;
int bx1 = sw - bx0;
int by1 = sh - by0;
assert(bx1 > bx0);
assert(by1 > by0);
int bsw = bx1 - bx0;
int bsh = by1 - by0;
assert(bsw >= pw);
assert(bsh >= ph);
x0 = bx0 + (randuint() % (bsw - pw + 1));
y0 = by0 + (randuint() % (bsh - ph + 1));
}
x1 = x0 + pw - 1;
y1 = y0 + ph - 1;
unsigned int pwhc = pw * ph * pc;
double *ddat = new double[pwhc];
double *edat = ddat;
for (unsigned int y = y0; y <= y1; ++y)
for (unsigned int x = x0; x <= x1; ++x) {
for (unsigned int z = 0; z < sc; ++z)
*edat++ = (0.5 + (double)tmpdat[z + sc * (x + sw * y)]) / 256.0;
}
enk(ddat, pwhc, kdat);
delete[] ddat;
if (x0p)
*x0p = x0;
if (y0p)
*y0p = y0;
}
static void _outcrop(
const double *tmpdat, double *kdat, Kleption::Flags flags,
int sw, int sh, int sc, int pw, int ph, int pc,
unsigned int *x0p, unsigned int *y0p, double trim
) {
assert(pw <= sw);
assert(ph <= sh);
assert(pc == sc);
unsigned int x0, y0, x1, y1;
if (flags & Kleption::FLAG_CENTER) {
x0 = (sw - pw) / 2;
y0 = (sh - ph) / 2;
} else {
int bx0 = trim * sw;
int by0 = trim * sh;
int bx1 = sw - bx0;
int by1 = sh - by0;
assert(bx1 > bx0);
assert(by1 > by0);
int bsw = bx1 - bx0;
int bsh = by1 - by0;
assert(bsw >= pw);
assert(bsh >= ph);
x0 = bx0 + (randuint() % (bsw - pw + 1));
y0 = by0 + (randuint() % (bsh - ph + 1));
}
x1 = x0 + pw - 1;
y1 = y0 + ph - 1;
unsigned int pwhc = pw * ph * pc;
double *ddat = new double[pwhc];
double *edat = ddat;
for (unsigned int y = y0; y <= y1; ++y)
for (unsigned int x = x0; x <= x1; ++x) {
for (unsigned int z = 0; z < sc; ++z)
*edat++ = tmpdat[z + sc * (x + sw * y)];
}
enk(ddat, pwhc, kdat);
delete[] ddat;
if (x0p)
*x0p = x0;
if (y0p)
*y0p = y0;
}
static void cpumatvec(const double *a, const double *b, int aw, int ahbw, double *c) {
int ah = ahbw;
int bw = ahbw;
int cw = aw;
for (int cx = 0; cx < cw; ++cx) {
c[cx] = 0;
for (int i = 0; i < ahbw; ++i) {
c[cx] += a[cx + aw * i] * b[i];
}
}
}
bool Kleption::pick(double *kdat, std::string *idp) {
load();
switch (kind) {
case KIND_VID:
{
if (!vidreader) {
unload();
load();
return false;
}
unsigned int x0, y0;
_outcrop(dat, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
assert(vidreader);
if (!vidreader->read(dat, sw, sh)) {
if (flags & FLAG_REPEAT) {
unload();
load();
} else {
delete(vidreader);
vidreader = NULL;
}
}
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, frames);
*idp = buf;
}
++frames;
return true;
}
case KIND_CAM:
{
assert(cam);
assert(pc == sc);
assert(cam->w == sw);
assert(cam->h == sh);
assert(sc == 3);
cam->read(dat);
unsigned int x0, y0;
_outcrop(dat, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, frames);
*idp = buf;
}
++frames;
return true;
}
case KIND_RND:
{
unsigned int swh = sw * sh;
unsigned int swhc = swh * sc;
double *rnd = new double[swhc];
for (int j = 0; j < swhc; ++j)
rnd[j] = randgauss();
unsigned int x0, y0;
_outcrop(rnd, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
delete[] rnd;
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, frames);
*idp = buf;
}
++frames;
return true;
}
case KIND_RVG:
{
assert(rvg);
assert(rvg->dim == sc);
unsigned int swh = sw * sh;
unsigned int swhc = swh * sc;
double *rnd = new double[swhc];
for (int xy = 0; xy < swh; ++xy)
rvg->generate(rnd + xy * sc, rvgmul, evolve);
unsigned int x0, y0;
_outcrop(rnd, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
delete[] rnd;
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, frames);
*idp = buf;
}
++frames;
return true;
}
case KIND_DIR:
{
unsigned int idn = ids.size();
unsigned int idj;
if (trav == TRAV_SCAN) {
if (idi >= idn) {
idi = 0;
if (!(flags & FLAG_REPEAT))
return false;
}
idj = idi;
} else if (trav == TRAV_RAND) {
idj = randuint() % idn;
} else if (trav == TRAV_REFS) {
std::string ref;
if (!read_line(refreader, &ref)) {
rewind(refreader);
assert(read_line(refreader, &ref));
if (!(flags & FLAG_REPEAT)) {
rewind(refreader);
return false;
}
}
find(ref, kdat);
if (idp)
*idp = ref;
return true;
}
assert(idj < idn);
std::string id = ids[idj];
Kleption *subkl = id_sub[id];
assert(subkl != NULL);
std::string idq;
bool ret = subkl->pick(kdat, idp ? &idq : NULL);
if (!ret) {
assert(trav == TRAV_SCAN);
++idi;
if (idi >= idn) {
idi = 0;
if (!(flags & FLAG_REPEAT))
return false;
}
idj = idi;
id = ids[idj];
subkl = id_sub[id];
ret = subkl->pick(kdat, idp ? &idq : NULL);
assert(ret);
}
if (idp)
*idp = id + "/" + idq;
return true;
}
case KIND_PIC:
{
if (trav == TRAV_SCAN) {
if (!(flags & FLAG_REPEAT) && idi > 0) {
assert(idi == 1);
idi = 0;
return false;
}
} else if (trav == TRAV_REFS) {
std::string ref;
if (!read_line(refreader, &ref)) {
rewind(refreader);
assert(read_line(refreader, &ref));
if (!(flags & FLAG_REPEAT)) {
rewind(refreader);
return false;
}
}
find(ref, kdat);
if (idp)
*idp = ref;
return true;
}
assert(dat);
assert(sw >= pw);
assert(sh >= ph);
assert(sc == 3);
assert(pc == sc);
unsigned int x0, y0;
_outcrop(dat, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
if ((flags & FLAG_LOWMEM) && kind == KIND_PIC)
unload();
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u.ppm", pw, ph, sc, x0, y0);
*idp = buf;
}
if (trav == TRAV_SCAN) {
assert(idi == 0);
if (!(flags & FLAG_REPEAT))
++idi;
}
return true;
}
case KIND_U8:
{
assert(dat);
assert(pc == sc);
assert(b > 0);
unsigned int v;
if (trav == TRAV_SCAN) {
if (idi >= b) {
idi = 0;
if (!(flags & FLAG_REPEAT))
return false;
}
v = idi;
++idi;
} else if (trav == TRAV_REFS) {
std::string ref;
if (!read_line(refreader, &ref)) {
rewind(refreader);
assert(read_line(refreader, &ref));
if (!(flags & FLAG_REPEAT)) {
rewind(refreader);
return false;
}
}
find(ref, kdat);
if (idp)
*idp = ref;
return true;
} else if (trav == TRAV_RAND) {
v = randuint() % b;
} else {
assert(0);
}
assert(v < b);
unsigned int swhc = sw * sh * sc;
const uint8_t *tmpdat = dat + (long)v * (long)swhc;
unsigned int x0, y0;
_outcrop(tmpdat, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, v);
*idp = buf;
}
return true;
}
case KIND_F64LE:
{
assert(dat);
assert(pc == sc);
assert(b > 0);
unsigned int v;
if (trav == TRAV_SCAN) {
if (idi >= b) {
idi = 0;
if (!(flags & FLAG_REPEAT))
return false;
}
v = idi;
++idi;
} else if (trav == TRAV_REFS) {
std::string ref;
if (!read_line(refreader, &ref)) {
rewind(refreader);
assert(read_line(refreader, &ref));
if (!(flags & FLAG_REPEAT)) {
rewind(refreader);
return false;
}
}
find(ref, kdat);
if (idp)
*idp = ref;
return true;
} else if (trav == TRAV_RAND) {
v = randuint() % b;
} else {
assert(0);
}
assert(v < b);
unsigned int swhc = sw * sh * sc;
const double *tmpdat = ((double *)dat) + (long)v * (long)swhc;
unsigned int x0, y0;
_outcrop(tmpdat, kdat, flags, sw, sh, sc, pw, ph, pc, &x0, &y0, trim);
if (idp) {
char buf[256];
sprintf(buf, "%ux%ux%u+%u+%u+%u.ppm", pw, ph, sc, x0, y0, v);
*idp = buf;
}
return true;
}
default:
assert(0);
}
assert(0);
}
void Kleption::find(const std::string &id, double *kdat) {
const char *cid = id.c_str();
std::string pid, qid;
if (const char *p = ::strchr(cid, '/')) {
pid = std::string(cid, p - cid);
qid = p + 1;
} else {
pid = id;
qid = "";
}
load();
switch (kind) {
case KIND_RND:
case KIND_RVG:
case KIND_CAM:
case KIND_VID:
assert(0);
case KIND_DIR:
{
assert(qid != "");
Kleption *subkl = id_sub[pid];
assert(subkl != NULL);
subkl->find(qid, kdat);
break;
}
case KIND_PIC:
{
assert(qid == "");
assert(dat);
unsigned int vpw, vph, vpc, x0, y0;
sscanf(pid.c_str(), "%ux%ux%u+%u+%u.ppm", &vpw, &vph, &vpc, &x0, &y0);
assert(sw >= pw);
assert(sh >= ph);
assert(vpw == pw);
assert(vph == ph);
assert(vpc == pc);
assert(sc == 3);
assert(pc == sc);
assert(x0 >= 0);
assert(x0 < sw);
assert(y0 >= 0);
assert(y0 < sh);
unsigned int x1 = x0 + pw - 1;
unsigned int y1 = y0 + ph - 1;
assert(x1 >= x0);
assert(x1 < sw);
assert(y1 >= y0);
assert(y1 < sh);
unsigned int pwhc = pw * ph * pc;
double *ddat = new double[pwhc];
double *edat = ddat;
for (unsigned int y = y0; y <= y1; ++y)
for (unsigned int x = x0; x <= x1; ++x) {
for (unsigned int z = 0; z < sc; ++z)
*edat++ = (double)dat[z + sc * (x + sw * y)] / 255.0;
}
enk(ddat, pwhc, kdat);
delete[] ddat;
break;
}
case KIND_U8:
{
assert(dat);
assert(qid == "");
unsigned int vpw, vph, vpc, x0, y0, v;
sscanf(pid.c_str(), "%ux%ux%u+%u+%u+%u.ppm", &vpw, &vph, &vpc, &x0, &y0, &v);
assert(v < b);
// info(fmt("matching %ux%ux%u -> %ux%ux%u", vpw, vph, vpc, pw, ph, pc));
// assert(vpw == pw);
// assert(vph == ph);
// assert(vpc == pc);
assert(sw == pw);
assert(sh == ph);
assert(pc == sc);
assert(x0 >= 0);
assert(x0 < sw);
assert(y0 >= 0);
assert(y0 < sh);
unsigned int x1 = x0 + pw - 1;
unsigned int y1 = y0 + ph - 1;
assert(x1 >= x0);
assert(x1 < sw);
assert(y1 >= y0);
assert(y1 < sh);
unsigned int pwhc = pw * ph * pc;
unsigned int swhc = sw * sh * sc;
const uint8_t *tmpdat = dat + (long)v * (long)swhc;
double *ddat = new double[pwhc];
double *edat = ddat;
for (unsigned int y = y0; y <= y1; ++y)
for (unsigned int x = x0; x <= x1; ++x) {
for (unsigned int z = 0; z < sc; ++z)
*edat++ = (double)tmpdat[z + sc * (x + sw * y)] / 255.0;
}
enk(ddat, pwhc, kdat);
delete[] ddat;
}
break;
case KIND_F64LE:
{
assert(dat);
assert(qid == "");
unsigned int vpw, vph, vpc, x0, y0, v;
sscanf(pid.c_str(), "%ux%ux%u+%u+%u+%u.ppm", &vpw, &vph, &vpc, &x0, &y0, &v);
assert(v < b);
// fprintf(stderr, "pid=%s pw=%d ph=%d pc=%d\n", pid.c_str(), pw, ph, pc);
// assert(vpw == pw);
// assert(vph == ph);
// assert(vpc == pc);
assert(sw == pw);
assert(sh == ph);
assert(pc == sc);
assert(x0 >= 0);
assert(x0 < sw);
assert(y0 >= 0);
assert(y0 < sh);
unsigned int x1 = x0 + pw - 1;
unsigned int y1 = y0 + ph - 1;
assert(x1 >= x0);
assert(x1 < sw);
assert(y1 >= y0);
assert(y1 < sh);
unsigned int pwhc = pw * ph * pc;
unsigned int swhc = sw * sh * sc;
const double *tmpdat = ((double *)dat) + (long)v * (long)swhc;
double *ddat = new double[pwhc];
double *edat = ddat;
for (unsigned int y = y0; y <= y1; ++y)
for (unsigned int x = x0; x <= x1; ++x) {
for (unsigned int z = 0; z < sc; ++z)
*edat++ = tmpdat[z + sc * (x + sw * y)];
}
enk(ddat, pwhc, kdat);
delete[] ddat;
}
break;
default:
assert(0);
}
}
bool Kleption::place(const std::string &id, const double *kdat) {
info(fmt("placing %s", id.c_str()));
assert(flags & FLAG_WRITER);
assert(pw > 0);
assert(ph > 0);
assert(pc > 0);
const char *cid = id.c_str();
std::string pid, qid;
if (const char *p = ::strchr(cid, '/')) {
pid = std::string(cid, p - cid);
qid = p + 1;
} else {
pid = id;
qid = "";
}
switch (kind) {
case KIND_RND:
error("can't place to kind rnd");
break;
case KIND_RVG:
{
if (!rvg)
rvg = new Rando(pc);
unsigned int pwh = pw * ph;
unsigned int pwhc = pwh * pc;
double *ddat = new double[pwhc];
dek(kdat, pwhc, ddat);
for (int xy = 0; xy < pwh; ++xy)
rvg->observe(ddat + xy * pc);
delete[] ddat;
}
return true;
case KIND_U8:
{
if (!datwriter) {
datwriter = fopen(fn.c_str(), (flags & FLAG_APPEND) ? "a" : "w");
if (!datwriter)
error(std::string("failed to open ") + fn + ": " + strerror(errno));
}
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
uint8_t *tmp = new uint8_t[pwhc];
dek(kdat, pwhc, dtmp);
dedub(dtmp, pwhc, tmp);
fwrite(tmp, 1, pw * ph * pc, datwriter);
delete[] tmp;
delete[] dtmp;
}
return true;
case KIND_F64LE:
{
if (!datwriter) {
datwriter = fopen(fn.c_str(), (flags & FLAG_APPEND) ? "a" : "w");
if (!datwriter)
error(std::string("failed to open ") + fn + ": " + strerror(errno));
}
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
dek(kdat, pwhc, dtmp);
fwrite(dtmp, 1, pw * ph * pc * 8, datwriter);
delete[] dtmp;
}
return true;
case KIND_VID:
{
if (!vidwriter) {
vidwriter = new Picwriter(vidwriter_cmd);
vidwriter->open(fn);
}
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
uint8_t *tmp = new uint8_t[pwhc];
dek(kdat, pwhc, dtmp);
dedub(dtmp, pwhc, tmp);
vidwriter->write(tmp, pw, ph);
delete[] tmp;
delete[] dtmp;
}
return true;
case KIND_CAM:
assert(0);
case KIND_DIR:
{
std::string fnp = fn;
while (const char *p = ::strchr(qid.c_str(), '/')) {
fnp += std::string("/" + pid);
if (0 == ::mkdir(fnp.c_str(), 0755))
warning("created directory " + fnp);
else if (errno != EEXIST)
error("failed to create directory " + fnp + ": " + strerror(errno));
pid = std::string(qid.c_str(), p - qid.c_str());
qid = std::string(p + 1);
}
Picwriter *picwriter = new Picwriter(picwriter_cmd);
picwriter->open(fnp + "/" + pid);
assert(pc == 3);
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
uint8_t *tmp = new uint8_t[pwhc];
dek(kdat, pwhc, dtmp);
dedub(dtmp, pwhc, tmp);
picwriter->write(tmp, pw, ph);
delete picwriter;
delete[] tmp;
delete[] dtmp;
}
return true;
case KIND_PIC:
{
Picwriter *picwriter = new Picwriter(picwriter_cmd);
picwriter->open(fn);
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
uint8_t *tmp = new uint8_t[pwhc];
dek(kdat, pwhc, dtmp);
dedub(dtmp, pwhc, tmp);
picwriter->write(tmp, pw, ph);
delete picwriter;
delete[] tmp;
delete[] dtmp;
}
return true;
case KIND_SDL:
{
assert(dsp);
assert(pc == 3);
unsigned int pwhc = pw * ph * pc;
double *dtmp = new double[pwhc];
uint8_t *tmp = new uint8_t[pwhc];
dek(kdat, pwhc, dtmp);
dedub(dtmp, pwhc, tmp);
dsp->update(tmp, pw, ph);
dsp->present();
delete[] tmp;
delete[] dtmp;
}
return !dsp->done();
case KIND_REF:
if (!refwriter) {
refwriter = fopen(fn.c_str(), (flags & FLAG_APPEND) ? "a" : "w");
if (!refwriter)
error(std::string("failed to open ") + fn + ": " + strerror(errno));
setbuf(refwriter, NULL);
}
fprintf(refwriter, "%s\n", id.c_str());
return true;
default:
assert(0);
}
assert(0);
}
// static
std::string Kleption::pick_pair(
Kleption *kl0, double *kdat0,
Kleption *kl1, double *kdat1
) {
std::string id;
bool ret = kl0->pick(kdat0, &id);
assert(ret);
kl1->find(id, kdat1);
return id;
}
}
| 21.593598
| 89
| 0.477312
|
jdb19937
|
5af8c11d00fe7ab4a4053086cf0211ba4bcc6a3b
| 3,647
|
cc
|
C++
|
attic/acpi.cc
|
Anton-Cao/sv6
|
f525c4d588d3cfe750867990902b882cd4a21fad
|
[
"MIT-0"
] | 147
|
2015-01-13T08:56:18.000Z
|
2022-03-10T06:49:25.000Z
|
attic/acpi.cc
|
Anton-Cao/sv6
|
f525c4d588d3cfe750867990902b882cd4a21fad
|
[
"MIT-0"
] | 1
|
2018-05-12T11:46:14.000Z
|
2018-05-12T11:46:14.000Z
|
attic/acpi.cc
|
Anton-Cao/sv6
|
f525c4d588d3cfe750867990902b882cd4a21fad
|
[
"MIT-0"
] | 34
|
2015-01-06T12:36:58.000Z
|
2021-09-23T17:56:22.000Z
|
// http://www.acpi.info/spec.htm
#include "types.h"
#include "amd64.h"
#include "kernel.hh"
#include "cpu.hh"
#include "apic.hh"
struct rsdp {
u8 signature[8];
u8 checksum;
u8 oemid[6];
u8 revision;
u32 rsdtaddr;
u32 length;
u64 xsdtaddr;
u8 extchecksum;
u8 reserved[3];
};
struct header {
u8 signature[4];
u32 length;
u8 revision;
u8 checksum;
u8 oemid[6];
u8 oemtableid[8];
u32 oemrevision;
u32 creatorid;
u32 creatorrevision;
};
struct rsdt {
struct header hdr;
u32 entry[];
};
struct xsdt {
struct header hdr;
u64 entry[];
} __attribute__((packed));
struct madt {
struct header hdr;
u32 localaddr;
u32 flags;
u8 entry[];
};
struct madt_apic {
u8 type;
u8 length;
u8 procid;
u8 apicid;
u32 flags;
} __attribute__((packed));
struct madt_x2apic {
u8 type;
u8 length;
u8 reserved[2];
u32 apicid;
u32 flags;
u32 procuid;
} __attribute__((packed));
#define CPU_ENABLED 0x1
static u8
sum(u8 *a, u32 length)
{
u8 s = 0;
for (u32 i = 0; i < length; i++)
s += a[i];
return s;
}
static struct rsdp *
rsdp_search1(paddr pa, int len)
{
u8 *start = (u8 *)p2v(pa);
for (u8 *p = start; p < (start + len); p += 16) {
if ((memcmp(p, "RSD PTR ", 8) == 0) && (sum(p, 20) == 0))
return (struct rsdp *)p;
}
return 0;
}
static struct rsdp *
rsdp_search(void)
{
struct rsdp *ret;
u8 *bda;
paddr pa;
bda = (u8 *)p2v(0x400);
if ((pa = ((bda[0x0F] << 8) | bda[0x0E]) << 4)) {
if ((ret = rsdp_search1(pa, 1024)))
return ret;
}
return rsdp_search1(0xE0000, 0x20000);
}
static void
scan_madt(struct madt* madt)
{
struct madt_x2apic* mx2;
struct madt_apic* ma;
u8* type;
u8* end;
u32 c;
end = ((u8*)madt) + madt->hdr.length;
type = ((u8*)madt) + sizeof(*madt);
c = 0 == myid() ? 1 : 0;
while (type < end) {
s64 id = -1;
switch (type[0]) {
case 0: // Processor Local APIC
ma = (struct madt_apic*) type;
if (ma->flags & CPU_ENABLED)
id = ma->apicid;
break;
case 9: // Processor Local x2APIC
mx2 = (struct madt_x2apic*) type;
if (mx2->flags & CPU_ENABLED)
id = mx2->apicid;
break;
}
if (id != -1 && id != lapicid().num) {
assert(c < NCPU);
if (VERBOSE)
cprintf("%u from %u to %ld\n", c, cpus[c].hwid.num, id);
cpus[c].hwid.num = id;
c = c+1 == myid() ? c+2 : c+1;
}
type = type + type[1];
}
}
void
initacpi(void)
{
struct rsdp* rsdp = rsdp_search();
struct madt* madt = nullptr;
if (!rsdp)
return;
if (rsdp->xsdtaddr) {
struct xsdt* xsdt = (struct xsdt*) p2v(rsdp->xsdtaddr);
if (sum((u8 *)xsdt, xsdt->hdr.length)) {
cprintf("initacpi: bad xsdt checksum\n");
return;
}
u32 n = xsdt->hdr.length > sizeof(*xsdt) ?
(xsdt->hdr.length - sizeof(*xsdt)) / 8 : 0;
for (u32 i = 0; i < n; i++) {
struct header* h = (struct header*) p2v(xsdt->entry[i]);
if (memcmp(h->signature, "APIC", 4) == 0) {
madt = (struct madt*) h;
break;
}
}
} else {
struct rsdt* rsdt = (struct rsdt*) p2v(rsdp->rsdtaddr);
if (sum((u8 *)rsdt, rsdt->hdr.length)) {
cprintf("initacpi: bad rsdt checksum\n");
return;
}
u32 n = rsdt->hdr.length > sizeof(*rsdt) ?
(rsdt->hdr.length - sizeof(*rsdt)) / 8 : 0;
for (u32 i = 0; i < n; i++) {
struct header* h = (struct header*) p2v(rsdt->entry[i]);
if (memcmp(h->signature, "APIC", 4) == 0) {
madt = (struct madt*) h;
break;
}
}
}
if (madt != nullptr)
scan_madt(madt);
}
| 18.994792
| 64
| 0.549767
|
Anton-Cao
|
5afa0b2d60def81c35bdec955d27b68cbbf8e422
| 14,976
|
cpp
|
C++
|
Samples/Win7Samples/multimedia/mediafoundation/MFCaptureToFile/winmain.cpp
|
windows-development/Windows-classic-samples
|
96f883e4c900948e39660ec14a200a5164a3c7b7
|
[
"MIT"
] | 8
|
2017-04-30T17:38:27.000Z
|
2021-11-29T00:59:03.000Z
|
Samples/Win7Samples/multimedia/mediafoundation/MFCaptureToFile/winmain.cpp
|
TomeSq/Windows-classic-samples
|
96f883e4c900948e39660ec14a200a5164a3c7b7
|
[
"MIT"
] | null | null | null |
Samples/Win7Samples/multimedia/mediafoundation/MFCaptureToFile/winmain.cpp
|
TomeSq/Windows-classic-samples
|
96f883e4c900948e39660ec14a200a5164a3c7b7
|
[
"MIT"
] | 2
|
2020-08-11T13:21:49.000Z
|
2021-09-01T10:41:51.000Z
|
//////////////////////////////////////////////////////////////////////////
//
// winmain.cpp. Application entry-point.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <windowsx.h>
#include <mfapi.h>
#include <mfidl.h>
#include <mfreadwrite.h>
#include <assert.h>
#include <strsafe.h>
#include <shlwapi.h>
#include <Dbt.h>
#include <ks.h>
#include <ksmedia.h>
template <class T> void SafeRelease(T **ppT)
{
if (*ppT)
{
(*ppT)->Release();
*ppT = NULL;
}
}
#include "capture.h"
#include "resource.h"
// Include the v6 common controls in the manifest
#pragma comment(linker, \
"\"/manifestdependency:type='Win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' "\
"processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' "\
"language='*'\"")
enum FileContainer
{
FileContainer_MP4 = IDC_CAPTURE_MP4,
FileContainer_WMV = IDC_CAPTURE_WMV
};
DeviceList g_devices;
CCapture *g_pCapture = NULL;
HDEVNOTIFY g_hdevnotify = NULL;
const UINT32 TARGET_BIT_RATE = 240 * 1000;
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void OnInitDialog(HWND hDlg);
void OnCloseDialog();
void UpdateUI(HWND hDlg);
void StopCapture(HWND hDlg);
void StartCapture(HWND hDlg);
void OnSelectEncodingType(HWND hDlg, FileContainer file);
HRESULT GetSelectedDevice(HWND hDlg, IMFActivate **ppActivate);
HRESULT UpdateDeviceList(HWND hDlg);
void OnDeviceChange(HWND hwnd, WPARAM reason, DEV_BROADCAST_HDR *pHdr);
void NotifyError(HWND hwnd, const WCHAR *sErrorMessage, HRESULT hrErr);
void EnableDialogControl(HWND hDlg, int nIDDlgItem, BOOL bEnable);
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, INT /*nCmdShow*/)
{
(void)HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
INT_PTR ret = DialogBox(
hInstance,
MAKEINTRESOURCE(IDD_DIALOG1),
NULL,
DialogProc
);
if (ret == 0 || ret == -1)
{
MessageBox( NULL, L"Could not create dialog", L"Error", MB_OK | MB_ICONERROR );
}
return 0;
}
//-----------------------------------------------------------------------------
// Dialog procedure
//-----------------------------------------------------------------------------
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
OnInitDialog(hDlg);
break;
case WM_DEVICECHANGE:
OnDeviceChange(hDlg, wParam, (PDEV_BROADCAST_HDR)lParam);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_CAPTURE_MP4: // Fall through
case IDC_CAPTURE_WMV:
OnSelectEncodingType(hDlg, (FileContainer)(LOWORD(wParam)));
return TRUE;
case IDC_CAPTURE:
if (g_pCapture && g_pCapture->IsCapturing())
{
StopCapture(hDlg);
}
else
{
StartCapture(hDlg);
}
return TRUE;
case IDCANCEL:
OnCloseDialog();
::EndDialog(hDlg, IDCANCEL);
return TRUE;
}
break;
}
return FALSE;
}
//-----------------------------------------------------------------------------
// OnInitDialog
// Handler for WM_INITDIALOG message.
//-----------------------------------------------------------------------------
void OnInitDialog(HWND hDlg)
{
HRESULT hr = S_OK;
HWND hEdit = GetDlgItem(hDlg, IDC_OUTPUT_FILE);
SetWindowText(hEdit, TEXT("capture.mp4"));
CheckRadioButton(hDlg, IDC_CAPTURE_MP4, IDC_CAPTURE_WMV, IDC_CAPTURE_MP4);
// Initialize the COM library
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Initialize Media Foundation
if (SUCCEEDED(hr))
{
hr = MFStartup(MF_VERSION);
}
// Register for device notifications
if (SUCCEEDED(hr))
{
DEV_BROADCAST_DEVICEINTERFACE di = { 0 };
di.dbcc_size = sizeof(di);
di.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
di.dbcc_classguid = KSCATEGORY_CAPTURE;
g_hdevnotify = RegisterDeviceNotification(
hDlg,
&di,
DEVICE_NOTIFY_WINDOW_HANDLE
);
if (g_hdevnotify == NULL)
{
hr = HRESULT_FROM_WIN32(GetLastError());
}
}
// Enumerate the video capture devices.
if (SUCCEEDED(hr))
{
hr = UpdateDeviceList(hDlg);
}
if (SUCCEEDED(hr))
{
UpdateUI(hDlg);
if (g_devices.Count() == 0)
{
::MessageBox(
hDlg,
TEXT("Could not find any video capture devices."),
TEXT("MFCaptureToFile"),
MB_OK
);
}
}
else
{
OnCloseDialog();
::EndDialog(hDlg, 0);
}
}
//-----------------------------------------------------------------------------
// OnCloseDialog
//
// Frees resources before closing the dialog.
//-----------------------------------------------------------------------------
void OnCloseDialog()
{
if (g_pCapture)
{
g_pCapture->EndCaptureSession();
}
SafeRelease(&g_pCapture);
g_devices.Clear();
if (g_hdevnotify)
{
UnregisterDeviceNotification(g_hdevnotify);
}
MFShutdown();
CoUninitialize();
}
//-----------------------------------------------------------------------------
// StartCapture
//
// Starts video capture.
//-----------------------------------------------------------------------------
void StartCapture(HWND hDlg)
{
EncodingParameters params;
if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_CAPTURE_WMV))
{
params.subtype = MFVideoFormat_WMV3;
}
else
{
params.subtype = MFVideoFormat_H264;
}
params.bitrate = TARGET_BIT_RATE;
HRESULT hr = S_OK;
WCHAR pszFile[MAX_PATH] = { 0 };
HWND hEdit = GetDlgItem(hDlg, IDC_OUTPUT_FILE);
IMFActivate *pActivate = NULL;
// Get the name of the target file.
if (0 == GetWindowText(hEdit, pszFile, MAX_PATH))
{
hr = HRESULT_FROM_WIN32(GetLastError());
}
// Create the media source for the capture device.
if (SUCCEEDED(hr))
{
hr = GetSelectedDevice(hDlg, &pActivate);
}
// Start capturing.
if (SUCCEEDED(hr))
{
hr = CCapture::CreateInstance(hDlg, &g_pCapture);
}
if (SUCCEEDED(hr))
{
hr = g_pCapture->StartCapture(pActivate, pszFile, params);
}
if (SUCCEEDED(hr))
{
UpdateUI(hDlg);
}
SafeRelease(&pActivate);
if (FAILED(hr))
{
NotifyError(hDlg, L"Error starting capture.", hr);
}
}
//-----------------------------------------------------------------------------
// StopCapture
//
// Stops video capture.
//-----------------------------------------------------------------------------
void StopCapture(HWND hDlg)
{
HRESULT hr = S_OK;
hr = g_pCapture->EndCaptureSession();
SafeRelease(&g_pCapture);
UpdateDeviceList(hDlg);
// NOTE: Updating the device list releases the existing IMFActivate
// pointers. This ensures that the current instance of the video capture
// source is released.
UpdateUI(hDlg);
if (FAILED(hr))
{
NotifyError(hDlg, L"Error stopping capture. File might be corrupt.", hr);
}
}
//-----------------------------------------------------------------------------
// CreateSelectedDevice
//
// Create a media source for the video capture device selected by the user.
//-----------------------------------------------------------------------------
HRESULT GetSelectedDevice(HWND hDlg, IMFActivate **ppActivate)
{
HWND hDeviceList = GetDlgItem(hDlg, IDC_DEVICE_LIST);
// First get the index of the selected item in the combo box.
int iListIndex = ComboBox_GetCurSel(hDeviceList);
if (iListIndex == CB_ERR)
{
return HRESULT_FROM_WIN32(GetLastError());
}
// Now find the index of the device within the device list.
//
// This index is stored as item data in the combo box, so that
// the order of the combo box items does not need to match the
// order of the device list.
LRESULT iDeviceIndex = ComboBox_GetItemData(hDeviceList, iListIndex);
if (iDeviceIndex == CB_ERR)
{
return HRESULT_FROM_WIN32(GetLastError());
}
// Now create the media source.
return g_devices.GetDevice((UINT32)iDeviceIndex, ppActivate);
}
//-----------------------------------------------------------------------------
// UpdateDeviceList
//
// Enumerates the video capture devices and populates the list of device
// names in the dialog UI.
//-----------------------------------------------------------------------------
HRESULT UpdateDeviceList(HWND hDlg)
{
HRESULT hr = S_OK;
WCHAR *szFriendlyName = NULL;
HWND hCombobox = GetDlgItem(hDlg, IDC_DEVICE_LIST);
ComboBox_ResetContent( hCombobox );
g_devices.Clear();
hr = g_devices.EnumerateDevices();
if (FAILED(hr)) { goto done; }
for (UINT32 iDevice = 0; iDevice < g_devices.Count(); iDevice++)
{
// Get the friendly name of the device.
hr = g_devices.GetDeviceName(iDevice, &szFriendlyName);
if (FAILED(hr)) { goto done; }
// Add the string to the combo-box. This message returns the index in the list.
int iListIndex = ComboBox_AddString(hCombobox, szFriendlyName);
if (iListIndex == CB_ERR || iListIndex == CB_ERRSPACE)
{
hr = E_FAIL;
goto done;
}
// The list might be sorted, so the list index is not always the same as the
// array index. Therefore, set the array index as item data.
int result = ComboBox_SetItemData(hCombobox, iListIndex, iDevice);
if (result == CB_ERR)
{
hr = E_FAIL;
goto done;
}
CoTaskMemFree(szFriendlyName);
szFriendlyName = NULL;
}
if (g_devices.Count() > 0)
{
// Select the first item.
ComboBox_SetCurSel(hCombobox, 0);
}
done:
return hr;
}
//-----------------------------------------------------------------------------
// OnSelectEncodingType
//
// Called when the user toggles between file-format types.
//-----------------------------------------------------------------------------
void OnSelectEncodingType(HWND hDlg, FileContainer file)
{
WCHAR pszFile[MAX_PATH] = { 0 };
HWND hEdit = GetDlgItem(hDlg, IDC_OUTPUT_FILE);
GetWindowText(hEdit, pszFile, MAX_PATH);
switch (file)
{
case FileContainer_MP4:
PathRenameExtension(pszFile, L".mp4");
break;
case FileContainer_WMV:
PathRenameExtension(pszFile, L".wmv");
break;
default:
assert(false);
break;
}
SetWindowText(hEdit, pszFile);
}
//-----------------------------------------------------------------------------
// UpdateUI
//
// Updates the dialog UI for the current state.
//-----------------------------------------------------------------------------
void UpdateUI(HWND hDlg)
{
BOOL bEnable = (g_devices.Count() > 0); // Are there any capture devices?
BOOL bCapturing = (g_pCapture != NULL); // Is video capture in progress now?
HWND hButton = GetDlgItem(hDlg, IDC_CAPTURE);
if (bCapturing)
{
SetWindowText(hButton, L"Stop Capture");
}
else
{
SetWindowText(hButton, L"Start Capture");
}
EnableDialogControl(hDlg, IDC_CAPTURE, bCapturing || bEnable);
EnableDialogControl(hDlg, IDC_DEVICE_LIST, !bCapturing && bEnable);
// The following cannot be changed while capture is in progress,
// but are OK to change when there are no capture devices.
EnableDialogControl(hDlg, IDC_CAPTURE_MP4, !bCapturing);
EnableDialogControl(hDlg, IDC_CAPTURE_WMV, !bCapturing);
EnableDialogControl(hDlg, IDC_OUTPUT_FILE, !bCapturing);
}
//-----------------------------------------------------------------------------
// OnDeviceChange
//
// Handles WM_DEVICECHANGE messages.
//-----------------------------------------------------------------------------
void OnDeviceChange(HWND hDlg, WPARAM reason, DEV_BROADCAST_HDR *pHdr)
{
if (reason == DBT_DEVNODES_CHANGED || reason == DBT_DEVICEARRIVAL)
{
// Check for added/removed devices, regardless of whether
// the application is capturing video at this time.
UpdateDeviceList(hDlg);
UpdateUI(hDlg);
}
// Now check if the current video capture device was lost.
if (pHdr == NULL)
{
return;
}
if (pHdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE)
{
return;
}
HRESULT hr = S_OK;
BOOL bDeviceLost = FALSE;
if (g_pCapture && g_pCapture->IsCapturing())
{
hr = g_pCapture->CheckDeviceLost(pHdr, &bDeviceLost);
if (FAILED(hr) || bDeviceLost)
{
StopCapture(hDlg);
MessageBox(hDlg, L"The capture device was removed or lost.", L"Lost Device", MB_OK);
}
}
}
void NotifyError(HWND hwnd, const WCHAR *sErrorMessage, HRESULT hrErr)
{
const size_t MESSAGE_LEN = 512;
WCHAR message[MESSAGE_LEN];
HRESULT hr = StringCchPrintf (message, MESSAGE_LEN, L"%s (HRESULT = 0x%X)", sErrorMessage, hrErr);
if (SUCCEEDED(hr))
{
MessageBox(hwnd, message, NULL, MB_OK | MB_ICONERROR);
}
}
void EnableDialogControl(HWND hDlg, int nIDDlgItem, BOOL bEnable)
{
HWND hwnd = GetDlgItem(hDlg, nIDDlgItem);
if (!bEnable && hwnd == GetFocus())
{
// When disabling a control that has focus, set the
// focus to the next control.
::SendMessage(GetParent(hwnd), WM_NEXTDLGCTL, 0, FALSE);
}
EnableWindow(hwnd, bEnable);
}
| 25.340102
| 110
| 0.529046
|
windows-development
|
5afc5e1a7334fc71a78aae9fed6318b80a74bad0
| 846
|
cc
|
C++
|
poj/3/3636.cc
|
eagletmt/procon
|
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
|
[
"MIT"
] | 1
|
2015-04-17T09:54:23.000Z
|
2015-04-17T09:54:23.000Z
|
poj/3/3636.cc
|
eagletmt/procon
|
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
|
[
"MIT"
] | null | null | null |
poj/3/3636.cc
|
eagletmt/procon
|
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
|
[
"MIT"
] | null | null | null |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
struct cmp
{
bool operator()(const pair<int,int>& a, const pair<int,int>& b) const
{
if (a.first == b.first) {
return a.second < b.second;
} else {
return a.first > b.first;
}
}
};
int main()
{
int T;
scanf("%d", &T);
while (T-- > 0) {
int N;
scanf("%d", &N);
static pair<int,int> a[20000];
for (int i = 0; i < N; i++) {
scanf("%d %d", &a[i].first, &a[i].second);
}
sort(a, a+N, cmp());
// LIS
vector<int> v;
for (int i = 0; i < N; i++) {
const int x = a[i].second;
vector<int>::iterator it = upper_bound(v.begin(), v.end(), x);
if (it == v.end()) {
v.push_back(x);
} else {
*it = x;
}
}
printf("%lu\n", v.size());
}
return 0;
}
| 18.391304
| 71
| 0.476359
|
eagletmt
|
5afcc9ce1af33e50dd599d3b2f62f2c5a9bf7c65
| 883
|
cpp
|
C++
|
Notes/File Handling/fileHandling.cpp
|
Concept-Team/e-box-UTA018
|
a6caf487c9f27a5ca30a00847ed49a163049f67e
|
[
"MIT"
] | 26
|
2021-03-17T03:15:22.000Z
|
2021-06-09T13:29:41.000Z
|
Notes/File Handling/fileHandling.cpp
|
Servatom/e-box-UTA018
|
a6caf487c9f27a5ca30a00847ed49a163049f67e
|
[
"MIT"
] | 6
|
2021-03-16T19:04:05.000Z
|
2021-06-03T13:41:04.000Z
|
Notes/File Handling/fileHandling.cpp
|
Concept-Team/e-box-UTA018
|
a6caf487c9f27a5ca30a00847ed49a163049f67e
|
[
"MIT"
] | 42
|
2021-03-17T03:16:22.000Z
|
2021-06-14T21:11:20.000Z
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
//For output file
//opening a file
ofstream out("myFile.txt");
if(!out.is_open()){
cout<<"Error in opening file"<<endl;
//ABORT
return 1;
}
out<<"Raghav is a human"<<endl;
out<<"Yash is a human"<<endl;
out<<"Rupanshi is human"<<endl;
//File input
ifstream in("myFile.txt");
if (!in){
//error in opening file
cout<<"Error in opening file"<<endl;
//Abort
return 1;
}
//Option 1
/*
string sentence;
in >> sentence;
cout<<sentence<<endl;
in >> sentence;
cout<<sentence<<endl;
in >> sentence;
cout<<sentence<<endl;
*/
char c;
while(!in.eof()){
in.get(c);
cout << c;
}
in.close();
out.close();
return 0;
}
| 15.767857
| 44
| 0.518686
|
Concept-Team
|
85076df3619cc1a573d2fcf4d646a58b1524ac40
| 1,090
|
cpp
|
C++
|
Codechef/chefmayshort.cpp
|
ujjwalgulecha/Coding
|
d04c19d8f673749a00c85cd5e8935960fb7e8b16
|
[
"MIT"
] | null | null | null |
Codechef/chefmayshort.cpp
|
ujjwalgulecha/Coding
|
d04c19d8f673749a00c85cd5e8935960fb7e8b16
|
[
"MIT"
] | 1
|
2018-02-14T16:00:44.000Z
|
2021-10-17T16:32:50.000Z
|
Codechef/chefmayshort.cpp
|
ujjwalgulecha/Coding
|
d04c19d8f673749a00c85cd5e8935960fb7e8b16
|
[
"MIT"
] | null | null | null |
<<<<<<< HEAD
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int gcd(int m,int n);
int gcd(int m,int n)
{
while(m!=n){
if(m>n)
return gcd(m-n,n);
else
return gcd(m,n-m);
}
return m;
}
int main()
{
int t,n,x,i,a[1001],diff,flag=0;
cin>>t;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n-1;i++)
x=gcd(x,a[i]);
cout<<x<<endl;
}
return 0;
}
=======
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int gcd(int m,int n);
int gcd(int m,int n)
{
while(m!=n){
if(m>n)
return gcd(m-n,n);
else
return gcd(m,n-m);
}
return m;
}
int main()
{
int t,n,x,i,a[1001],diff,flag=0;
cin>>t;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n-1;i++)
x=gcd(x,a[i]);
cout<<x<<endl;
}
return 0;
}
>>>>>>> efd4245fe427ffeefe49c72470b81a015d8dcf82
| 16.515152
| 48
| 0.445872
|
ujjwalgulecha
|
850781cb97ae66118a26a0fe738abc3e04d7885b
| 3,296
|
cpp
|
C++
|
src/core/template_deriveditem.cpp
|
mvsframework/mvs
|
4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81
|
[
"Apache-2.0"
] | null | null | null |
src/core/template_deriveditem.cpp
|
mvsframework/mvs
|
4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81
|
[
"Apache-2.0"
] | null | null | null |
src/core/template_deriveditem.cpp
|
mvsframework/mvs
|
4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81
|
[
"Apache-2.0"
] | null | null | null |
//
// Copyright © 2015 Claus Christmann <hcc |ä| gatech.edu>.
//
// 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 "template_deriveditem.h"
#include "template_deriveditem_p.h"
//############################################################################//
// //
// DerivedItemPrivate //
// //
//############################################################################//
DerivedItemPrivate::DerivedItemPrivate ( DerivedItem* q
,DerivedItem::Settings* const settings
,SimItem* parent)
:SimItemPrivate(q,settings)
,q_ptr ( q )
,xmlSettings(settings)
{ //NOTE: Do _NOT_ use q_ptr or q in here, it _WILL_ break things!
}
DerivedItemPrivate::~DerivedItemPrivate()
{
}
void DerivedItemPrivate::unInitializeDerivedItem()
{
// undo whatever DerivedItem::initializeItem() did...
}
//############################################################################//
// //
// DerivedItem //
// //
//############################################################################//
/** \note This constructor does NOT do any work!
* All DerivedItem level construction needs to happen in
* DerivedItem(DerivedItemPrivate & dd, ...)!
*/
DerivedItem::DerivedItem( Settings* const settings
,SimItem* parent)
:DerivedItem(*new DerivedItemPrivate(this,settings,parent),parent)
{}
DerivedItem::DerivedItem( DerivedItemPrivate& dd
,SimItem* parent )
: SimItem(dd, parent) // DerivedItems have SimItems as parents
{
Q_D(DerivedItem); Q_ASSERT(d);
/** \internal
* This will only indicate the status of the DerivedItem, any derived classes
* will not be constructed at this point!
*/
d->setStatus(Status::Constructed);
}
DerivedItem::~DerivedItem()
{
Q_D(DerivedItem); Q_ASSERT(d);
d->unInitializeDerivedItem();
}
void DerivedItem::initializeItem()
{
SimItem::initializeItem();
// do local work below ...
}
void DerivedItem::startItem()
{
SimItem::startItem();
// do local work below ...
}
void DerivedItem::stopItem()
{
// do local work above...
SimItem::stopItem();
}
void DerivedItem::unInitializeItem()
{
Q_D(DerivedItem); Q_ASSERT(d);
d->unInitializeDerivedItem();
// do local work above...
SimItem::unInitializeItem();
}
#include "template_deriveditem.moc"
| 29.693694
| 80
| 0.522755
|
mvsframework
|
8508032439c9d78399714ef8e4769ca2116c455b
| 4,586
|
cpp
|
C++
|
kernel/ubsan.cpp
|
qookei/quack
|
47808580dda218cb47d0c9ca04b51eb24f1e2266
|
[
"Zlib"
] | 16
|
2019-06-25T15:18:03.000Z
|
2021-10-10T18:52:30.000Z
|
kernel/ubsan.cpp
|
qookei/quack
|
47808580dda218cb47d0c9ca04b51eb24f1e2266
|
[
"Zlib"
] | null | null | null |
kernel/ubsan.cpp
|
qookei/quack
|
47808580dda218cb47d0c9ca04b51eb24f1e2266
|
[
"Zlib"
] | null | null | null |
#include <stddef.h>
#include <stdint.h>
#include <kmesg.h>
enum type_kinds { TK_INTEGER = 0x0000, TK_FLOAT = 0x0001, TK_UNKNOWN = 0xffff };
struct type_descriptor {
uint16_t type_kind;
uint16_t type_info;
char type_name[];
};
struct source_location {
char *filename;
uint32_t line;
uint32_t column;
};
struct overflow_data {
struct source_location loc;
struct type_descriptor *type;
};
struct shift_out_of_bounds_data {
struct source_location loc;
struct type_descriptor *lhs_type;
struct type_descriptor *rhs_type;
};
struct out_of_bounds_data {
struct source_location loc;
struct type_descriptor *array_type;
struct type_descriptor *index_type;
};
struct non_null_return_data {
struct source_location attr_loc;
};
struct type_mismatch_data_v1 {
struct source_location loc;
struct type_descriptor *type;
unsigned char log_alignment;
unsigned char type_check_kind;
};
struct type_mismatch_data {
struct source_location loc;
struct type_descriptor *type;
unsigned long alignment;
unsigned char type_check_kind;
};
struct vla_bound_data {
struct source_location loc;
struct type_descriptor *type;
};
struct invalid_value_data {
struct source_location loc;
struct type_descriptor *type;
};
struct unreachable_data {
struct source_location loc;
};
struct nonnull_arg_data {
struct source_location loc;
};
static void log_location(struct source_location loc) {
kmesg("ubsan", "ubsan failure at %s:%d", loc.filename, loc.line);
}
void __ubsan_handle_add_overflow(struct overflow_data *data, uintptr_t lhs,
uintptr_t rhs) {
kmesg("ubsan", "add of %ld and %ld will overflow", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_sub_overflow(struct overflow_data *data, uintptr_t lhs,
uintptr_t rhs) {
kmesg("ubsan", "subtract of %ld and %ld will overflow", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_pointer_overflow(struct overflow_data *data, uintptr_t lhs,
uintptr_t rhs) {
kmesg("ubsan", "pointer %lx and %lx will overflow", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_mul_overflow(struct overflow_data *data, uintptr_t lhs,
uintptr_t rhs) {
kmesg("ubsan", "multiply of %ld and %ld will overflow", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_divrem_overflow(struct overflow_data *data,
uintptr_t lhs, uintptr_t rhs) {
kmesg("ubsan", "division of %ld and %ld will overflow", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_negate_overflow(struct overflow_data *data,
uintptr_t old) {
kmesg("ubsan", "negation of %ld will overflow", old);
log_location(data->loc);
}
void __ubsan_handle_shift_out_of_bounds(
struct shift_out_of_bounds_data *data, uintptr_t lhs, uintptr_t rhs) {
kmesg("ubsan", "shift of %ld by %ld will go out of bounds", lhs, rhs);
log_location(data->loc);
}
void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data,
uintptr_t index) {
kmesg("ubsan", "out of bounds access at index %ld", index);
log_location(data->loc);
}
void __ubsan_handle_nonnull_return(struct non_null_return_data *data,
struct source_location *loc) {
kmesg("ubsan", "null return at %s:%d", data->attr_loc.filename, data->attr_loc.line);
log_location(*loc);
}
void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data,
uintptr_t ptr) {
if(!ptr) {
kmesg("ubsan", "null pointer access");
} else if (ptr & ((1 << data->log_alignment) - 1)) {
kmesg("ubsan", "misaligned access (ptr %016lx, alignment %ld)", ptr, (1 << data->log_alignment));
} else {
kmesg("ubsan", "too large access (ptr %016lx)", ptr);
}
log_location(data->loc);
}
void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data,
uintptr_t bound) {
kmesg("ubsan", "negative vla bound %ld", bound);
log_location(data->loc);
}
void __ubsan_handle_load_invalid_value(struct invalid_value_data *data,
uintptr_t val) {
kmesg("ubsan", "invalid value %lx", val);
log_location(data->loc);
}
void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) {
kmesg("ubsan", "reached __builtin_unreachabe");
log_location(data->loc);
}
void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data) {
kmesg("ubsan", "null argument");
log_location(data->loc);
}
void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, uintptr_t ptr) {
if(!ptr) {
kmesg("ubsan", "null pointer access");
} else if (ptr & (data->alignment - 1)) {
kmesg("ubsan", "misaligned access (ptr %016lx, alignment %ld)", ptr, data->alignment);
} else {
kmesg("ubsan", "too large access (ptr %016lx)", ptr);
}
log_location(data->loc);
}
| 26.056818
| 99
| 0.744876
|
qookei
|
8508e990a285b9913d791410fa0cf7b8de83fcad
| 1,325
|
cpp
|
C++
|
Periodic.cpp
|
olehzdubna/FastOutReader
|
81cd55220492a6ae042b38af03c1152ee6fc7eef
|
[
"MIT"
] | null | null | null |
Periodic.cpp
|
olehzdubna/FastOutReader
|
81cd55220492a6ae042b38af03c1152ee6fc7eef
|
[
"MIT"
] | null | null | null |
Periodic.cpp
|
olehzdubna/FastOutReader
|
81cd55220492a6ae042b38af03c1152ee6fc7eef
|
[
"MIT"
] | 1
|
2020-02-12T16:47:00.000Z
|
2020-02-12T16:47:00.000Z
|
/*
* Periodic.cpp
*
* Created on: Jul 6, 2019
* Author: oleh
*/
#include <iostream>
#include <Utils.h>
#include <Periodic.h>
Periodic::Periodic()
: AxisX()
, samples(0)
, trig(0)
, firstTime(0)
, incrementTime(0) {
}
Periodic::~Periodic() {
}
/*
// Read periodic information from a file
// See 'Vertical Header->Abscissa Data Type->Perodic' section of online
// help for HPLogic Fast Binary Data File Format under the File Out tool (8.2)
*/
std::shared_ptr<Periodic> Periodic::read(std::ifstream& inFile) {
std::string line;
//TODO: for debug std::cout << "+++ Periodic Data" << std::endl;
auto periodic = std::make_shared<Periodic>();
/* number of samples and trigger position */
std::getline(inFile, line);
::sscanf(line.data(), "%d %d\n", &periodic->samples, &periodic->trig ) ;
//TODO: for debug std::cout << "+++ samples = " << periodic->samples << " trigger = " << periodic->trig << std::endl;
/* Time of first sample sample */
/* Time between samples */
std::getline(inFile, line);
::sscanf(line.data(), "%d %d\n", &periodic->firstTime, &periodic->incrementTime ) ;
//TODO: for debug std::cout << "+++ origin = " << periodic->firstTime << " ps, increment = " << periodic->incrementTime << std::endl;
Utils::readAttributes(inFile, "Periodic");
return periodic;
}
| 25.480769
| 139
| 0.637736
|
olehzdubna
|
850b15fcb635adbf4ee8a34c4bf3a16106ae6fc0
| 4,255
|
cpp
|
C++
|
formats/lua/Scanner.cpp
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 5
|
2016-06-14T17:56:47.000Z
|
2022-02-10T19:54:25.000Z
|
formats/lua/Scanner.cpp
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 42
|
2016-06-21T20:48:22.000Z
|
2021-03-23T15:20:51.000Z
|
formats/lua/Scanner.cpp
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 1
|
2016-10-02T02:58:49.000Z
|
2016-10-02T02:58:49.000Z
|
/**
* Copyright (c) 2016 Xavier R. Guerin
*
* 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 "Scanner.h"
#include "Common.h"
#include "Object.h"
#include <ace/common/Log.h>
#include <ace/common/String.h>
#include <ace/engine/Master.h>
#include <lua.hpp>
#include <iostream>
#include <string>
#include <vector>
namespace {
static void
report_errors(lua_State* L)
{
const char* str = lua_tostring(L, -1);
std::cerr << "-- " << str << std::endl;
lua_pop(L, 1);
}
static void
build_args(lua_State* L, int argc, char** argv)
{
lua_newtable(L);
for (int i = 0; i < argc; i += 1) {
lua_pushstring(L, argv[i]);
lua_rawseti(L, -2, i);
}
lua_setglobal(L, "arg");
}
}
namespace ace { namespace luafmt {
tree::Value::Ref
Scanner::open(std::string const& fn, int argc, char** argv)
{
if (argc == 0 or argv == nullptr) {
ACE_LOG(Error, "invalid ARGC/ARGV arguments");
return nullptr;
}
tree::Value::Ref obj;
lua_State* L = luaL_newstate();
luaL_openlibs(L);
shift(fn, argc, argv);
build_args(L, argc, argv);
if (luaL_loadfile(L, fn.c_str()) != 0) {
report_errors(L);
goto error;
}
if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) {
report_errors(L);
goto error;
}
lua_getglobal(L, "config");
if (!lua_istable(L, -1)) {
ACE_LOG(Error, "no \"config\" dictionary found in \"", fn, "\"");
goto error;
}
obj = Object::build("", L);
lua_pop(L, 1);
error:
return obj;
}
tree::Value::Ref
Scanner::parse(std::string const& s, int argc, char** argv)
{
if (argc == 0 or argv == nullptr) {
ACE_LOG(Error, "invalid ARGC/ARGV arguments");
return nullptr;
}
tree::Value::Ref obj;
lua_State* L = luaL_newstate();
luaL_openlibs(L);
shift("", argc, argv);
build_args(L, argc, argv);
if (luaL_loadstring(L, s.c_str()) != 0) {
report_errors(L);
goto error;
}
if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) {
report_errors(L);
goto error;
}
lua_getglobal(L, "config");
if (!lua_istable(L, -1)) {
ACE_LOG(Error, "no \"config\" dictionary found in inline LUA");
goto error;
}
obj = Object::build("", L);
lua_pop(L, 1);
error:
return obj;
}
void
Scanner::dump(tree::Value const& v, const Format f, std::ostream& o) const
{
o << "config = ";
dump_value(v, o, 0, true);
o << std::endl;
}
bool
Scanner::openAll(std::string const& fn, int argc, char** argv,
std::list<tree::Value::Ref>& values)
{
auto res = open(fn, argc, argv);
if (res == nullptr) {
return false;
}
values.push_back(res);
return true;
}
bool
Scanner::parseAll(std::string const& s, int argc, char** argv,
std::list<tree::Value::Ref>& values)
{
auto res = parse(s, argc, argv);
if (res == nullptr) {
return false;
}
values.push_back(res);
return true;
}
bool
Scanner::dumpAll(std::list<tree::Value::Ref>& values, const Format f,
std::ostream& o) const
{
if (values.size() != 1) {
return false;
}
dump(*values.front(), f, o);
return true;
}
std::string
Scanner::name() const
{
return "lua";
}
std::string
Scanner::extension() const
{
return "lua";
}
}}
extern "C" {
void*
loadPlugin()
{
return new ace::luafmt::Scanner();
}
}
| 22.513228
| 80
| 0.644418
|
xguerin
|
85183b4114cbd1d8ce1bd978f58c2abb97c1a5d7
| 3,095
|
cpp
|
C++
|
CREP/utility.cpp
|
martinschonger/aerdg
|
d28df9fc9e2e0780f6e492e378320ed004e516ea
|
[
"MIT"
] | null | null | null |
CREP/utility.cpp
|
martinschonger/aerdg
|
d28df9fc9e2e0780f6e492e378320ed004e516ea
|
[
"MIT"
] | null | null | null |
CREP/utility.cpp
|
martinschonger/aerdg
|
d28df9fc9e2e0780f6e492e378320ed004e516ea
|
[
"MIT"
] | null | null | null |
/*
Implementation of some functions declared in utility.h.
*/
#include "utility.h"
namespace crep
{
tstamp_ util::CUR_TIME = 0;
tstamp_ util::CUR_TIME_AGE = 0;
//Begin: legacy code
dur util::charikar_partial_time_detailed = dur(0);
dur util::charikar_partial_time_detailed2 = dur(0);
dur util::charikar_partial_time_detailed3 = dur(0);
std::vector<std::vector<std::pair<int32_t, int32_t>>> util::edge_ontime = std::vector<std::vector<std::pair<int32_t, int32_t>>>();
std::vector<log_cluster_assignment_record> util::cluster_assignment = std::vector<log_cluster_assignment_record>();
std::vector<std::pair<int32_t, int32_t>> util::cluster = std::vector<std::pair<int32_t, int32_t>>();
//End: legacy code
void append_to_file(std::string filename, std::string new_content)
{
std::ofstream ost{ filename, std::ios_base::app };
ost << new_content << std::endl;
ost.close();
}
std::string get_timestamp()
{
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
std::ostringstream oss;
oss << std::put_time(&tm, "%Y%m%d-%H%M%S");
auto str = oss.str();
return str;
}
std::string get_project_root()
{
#if defined(__GNUC__)
return "/mnt/c/Users/Martin Schonger/source/repos/CREP/";
#elif defined(_MSC_VER)
return "C:/Users/Martin Schonger/source/repos/CREP/";
#endif
}
std::string get_log_dir()
{
#if defined(__GNUC__)
return "/mnt/c/Users/Martin Schonger/source/repos/crep_eval/log/";
#elif defined(_MSC_VER)
return "C:/Users/Martin Schonger/source/repos/crep_eval/log/";
#endif
}
std::map<std::string, std::string> read_config(const std::string& filename)
{
std::map<std::string, std::string> res;
std::ifstream is_file(filename);
if (!is_file.is_open())
{
std::cerr << "[ERROR] Failed to open config file '" << filename << "'." << std::endl;
}
else
{
//Inspired by https://stackoverflow.com/a/6892829/2868795 (Author: sbi).
//Note that for this snippet a license different from the one specified by the LICENSE file in the root directory might apply.
//Begin: snippet
std::string line;
while (std::getline(is_file, line))
{
std::istringstream is_line(line);
std::string key;
if (std::getline(is_line, key, '='))
{
std::string value;
if (std::getline(is_line, value))
{
res.emplace(key, trim(value));
}
}
}
//End: snippet
}
return res;
}
//Begin: legacy code
namespace prob
{
double exp(const double lambda, const double& x)
{
return lambda * std::exp((-lambda) * x);
}
double exp_log(const double p, const double beta, const double& x)
{
return (1 / (-std::log(p)))
* ((beta * (1 - p) * std::exp((-beta) * x))
/ (1 - (1 - p) * std::exp((-beta) * x)));
}
double beta(const double alpha, const double beta, const double& x)
{
return (std::pow(x, alpha - 1.0) * std::pow(1.0 - x, beta - 1.0)) / std::beta(alpha, beta);
}
}
//End: legacy code
}
// Copyright (c) 2019 Martin Schonger
| 26.452991
| 132
| 0.630048
|
martinschonger
|
851efea545fc612423498046f866042e0173dee5
| 17,573
|
cpp
|
C++
|
aws-cpp-sdk-ec2/source/model/IpamPool.cpp
|
perfectrecall/aws-sdk-cpp
|
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
|
[
"Apache-2.0"
] | 1
|
2022-01-05T18:20:03.000Z
|
2022-01-05T18:20:03.000Z
|
aws-cpp-sdk-ec2/source/model/IpamPool.cpp
|
perfectrecall/aws-sdk-cpp
|
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
|
[
"Apache-2.0"
] | 1
|
2022-01-03T23:59:37.000Z
|
2022-01-03T23:59:37.000Z
|
aws-cpp-sdk-ec2/source/model/IpamPool.cpp
|
ravindra-wagh/aws-sdk-cpp
|
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
|
[
"Apache-2.0"
] | 1
|
2021-11-09T11:58:03.000Z
|
2021-11-09T11:58:03.000Z
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ec2/model/IpamPool.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace EC2
{
namespace Model
{
IpamPool::IpamPool() :
m_ownerIdHasBeenSet(false),
m_ipamPoolIdHasBeenSet(false),
m_sourceIpamPoolIdHasBeenSet(false),
m_ipamPoolArnHasBeenSet(false),
m_ipamScopeArnHasBeenSet(false),
m_ipamScopeType(IpamScopeType::NOT_SET),
m_ipamScopeTypeHasBeenSet(false),
m_ipamArnHasBeenSet(false),
m_ipamRegionHasBeenSet(false),
m_localeHasBeenSet(false),
m_poolDepth(0),
m_poolDepthHasBeenSet(false),
m_state(IpamPoolState::NOT_SET),
m_stateHasBeenSet(false),
m_stateMessageHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_autoImport(false),
m_autoImportHasBeenSet(false),
m_publiclyAdvertisable(false),
m_publiclyAdvertisableHasBeenSet(false),
m_addressFamily(AddressFamily::NOT_SET),
m_addressFamilyHasBeenSet(false),
m_allocationMinNetmaskLength(0),
m_allocationMinNetmaskLengthHasBeenSet(false),
m_allocationMaxNetmaskLength(0),
m_allocationMaxNetmaskLengthHasBeenSet(false),
m_allocationDefaultNetmaskLength(0),
m_allocationDefaultNetmaskLengthHasBeenSet(false),
m_allocationResourceTagsHasBeenSet(false),
m_tagsHasBeenSet(false),
m_awsService(IpamPoolAwsService::NOT_SET),
m_awsServiceHasBeenSet(false)
{
}
IpamPool::IpamPool(const XmlNode& xmlNode) :
m_ownerIdHasBeenSet(false),
m_ipamPoolIdHasBeenSet(false),
m_sourceIpamPoolIdHasBeenSet(false),
m_ipamPoolArnHasBeenSet(false),
m_ipamScopeArnHasBeenSet(false),
m_ipamScopeType(IpamScopeType::NOT_SET),
m_ipamScopeTypeHasBeenSet(false),
m_ipamArnHasBeenSet(false),
m_ipamRegionHasBeenSet(false),
m_localeHasBeenSet(false),
m_poolDepth(0),
m_poolDepthHasBeenSet(false),
m_state(IpamPoolState::NOT_SET),
m_stateHasBeenSet(false),
m_stateMessageHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_autoImport(false),
m_autoImportHasBeenSet(false),
m_publiclyAdvertisable(false),
m_publiclyAdvertisableHasBeenSet(false),
m_addressFamily(AddressFamily::NOT_SET),
m_addressFamilyHasBeenSet(false),
m_allocationMinNetmaskLength(0),
m_allocationMinNetmaskLengthHasBeenSet(false),
m_allocationMaxNetmaskLength(0),
m_allocationMaxNetmaskLengthHasBeenSet(false),
m_allocationDefaultNetmaskLength(0),
m_allocationDefaultNetmaskLengthHasBeenSet(false),
m_allocationResourceTagsHasBeenSet(false),
m_tagsHasBeenSet(false),
m_awsService(IpamPoolAwsService::NOT_SET),
m_awsServiceHasBeenSet(false)
{
*this = xmlNode;
}
IpamPool& IpamPool::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode ownerIdNode = resultNode.FirstChild("ownerId");
if(!ownerIdNode.IsNull())
{
m_ownerId = Aws::Utils::Xml::DecodeEscapedXmlText(ownerIdNode.GetText());
m_ownerIdHasBeenSet = true;
}
XmlNode ipamPoolIdNode = resultNode.FirstChild("ipamPoolId");
if(!ipamPoolIdNode.IsNull())
{
m_ipamPoolId = Aws::Utils::Xml::DecodeEscapedXmlText(ipamPoolIdNode.GetText());
m_ipamPoolIdHasBeenSet = true;
}
XmlNode sourceIpamPoolIdNode = resultNode.FirstChild("sourceIpamPoolId");
if(!sourceIpamPoolIdNode.IsNull())
{
m_sourceIpamPoolId = Aws::Utils::Xml::DecodeEscapedXmlText(sourceIpamPoolIdNode.GetText());
m_sourceIpamPoolIdHasBeenSet = true;
}
XmlNode ipamPoolArnNode = resultNode.FirstChild("ipamPoolArn");
if(!ipamPoolArnNode.IsNull())
{
m_ipamPoolArn = Aws::Utils::Xml::DecodeEscapedXmlText(ipamPoolArnNode.GetText());
m_ipamPoolArnHasBeenSet = true;
}
XmlNode ipamScopeArnNode = resultNode.FirstChild("ipamScopeArn");
if(!ipamScopeArnNode.IsNull())
{
m_ipamScopeArn = Aws::Utils::Xml::DecodeEscapedXmlText(ipamScopeArnNode.GetText());
m_ipamScopeArnHasBeenSet = true;
}
XmlNode ipamScopeTypeNode = resultNode.FirstChild("ipamScopeType");
if(!ipamScopeTypeNode.IsNull())
{
m_ipamScopeType = IpamScopeTypeMapper::GetIpamScopeTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(ipamScopeTypeNode.GetText()).c_str()).c_str());
m_ipamScopeTypeHasBeenSet = true;
}
XmlNode ipamArnNode = resultNode.FirstChild("ipamArn");
if(!ipamArnNode.IsNull())
{
m_ipamArn = Aws::Utils::Xml::DecodeEscapedXmlText(ipamArnNode.GetText());
m_ipamArnHasBeenSet = true;
}
XmlNode ipamRegionNode = resultNode.FirstChild("ipamRegion");
if(!ipamRegionNode.IsNull())
{
m_ipamRegion = Aws::Utils::Xml::DecodeEscapedXmlText(ipamRegionNode.GetText());
m_ipamRegionHasBeenSet = true;
}
XmlNode localeNode = resultNode.FirstChild("locale");
if(!localeNode.IsNull())
{
m_locale = Aws::Utils::Xml::DecodeEscapedXmlText(localeNode.GetText());
m_localeHasBeenSet = true;
}
XmlNode poolDepthNode = resultNode.FirstChild("poolDepth");
if(!poolDepthNode.IsNull())
{
m_poolDepth = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(poolDepthNode.GetText()).c_str()).c_str());
m_poolDepthHasBeenSet = true;
}
XmlNode stateNode = resultNode.FirstChild("state");
if(!stateNode.IsNull())
{
m_state = IpamPoolStateMapper::GetIpamPoolStateForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(stateNode.GetText()).c_str()).c_str());
m_stateHasBeenSet = true;
}
XmlNode stateMessageNode = resultNode.FirstChild("stateMessage");
if(!stateMessageNode.IsNull())
{
m_stateMessage = Aws::Utils::Xml::DecodeEscapedXmlText(stateMessageNode.GetText());
m_stateMessageHasBeenSet = true;
}
XmlNode descriptionNode = resultNode.FirstChild("description");
if(!descriptionNode.IsNull())
{
m_description = Aws::Utils::Xml::DecodeEscapedXmlText(descriptionNode.GetText());
m_descriptionHasBeenSet = true;
}
XmlNode autoImportNode = resultNode.FirstChild("autoImport");
if(!autoImportNode.IsNull())
{
m_autoImport = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(autoImportNode.GetText()).c_str()).c_str());
m_autoImportHasBeenSet = true;
}
XmlNode publiclyAdvertisableNode = resultNode.FirstChild("publiclyAdvertisable");
if(!publiclyAdvertisableNode.IsNull())
{
m_publiclyAdvertisable = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(publiclyAdvertisableNode.GetText()).c_str()).c_str());
m_publiclyAdvertisableHasBeenSet = true;
}
XmlNode addressFamilyNode = resultNode.FirstChild("addressFamily");
if(!addressFamilyNode.IsNull())
{
m_addressFamily = AddressFamilyMapper::GetAddressFamilyForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(addressFamilyNode.GetText()).c_str()).c_str());
m_addressFamilyHasBeenSet = true;
}
XmlNode allocationMinNetmaskLengthNode = resultNode.FirstChild("allocationMinNetmaskLength");
if(!allocationMinNetmaskLengthNode.IsNull())
{
m_allocationMinNetmaskLength = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(allocationMinNetmaskLengthNode.GetText()).c_str()).c_str());
m_allocationMinNetmaskLengthHasBeenSet = true;
}
XmlNode allocationMaxNetmaskLengthNode = resultNode.FirstChild("allocationMaxNetmaskLength");
if(!allocationMaxNetmaskLengthNode.IsNull())
{
m_allocationMaxNetmaskLength = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(allocationMaxNetmaskLengthNode.GetText()).c_str()).c_str());
m_allocationMaxNetmaskLengthHasBeenSet = true;
}
XmlNode allocationDefaultNetmaskLengthNode = resultNode.FirstChild("allocationDefaultNetmaskLength");
if(!allocationDefaultNetmaskLengthNode.IsNull())
{
m_allocationDefaultNetmaskLength = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(allocationDefaultNetmaskLengthNode.GetText()).c_str()).c_str());
m_allocationDefaultNetmaskLengthHasBeenSet = true;
}
XmlNode allocationResourceTagsNode = resultNode.FirstChild("allocationResourceTagSet");
if(!allocationResourceTagsNode.IsNull())
{
XmlNode allocationResourceTagsMember = allocationResourceTagsNode.FirstChild("item");
while(!allocationResourceTagsMember.IsNull())
{
m_allocationResourceTags.push_back(allocationResourceTagsMember);
allocationResourceTagsMember = allocationResourceTagsMember.NextNode("item");
}
m_allocationResourceTagsHasBeenSet = true;
}
XmlNode tagsNode = resultNode.FirstChild("tagSet");
if(!tagsNode.IsNull())
{
XmlNode tagsMember = tagsNode.FirstChild("item");
while(!tagsMember.IsNull())
{
m_tags.push_back(tagsMember);
tagsMember = tagsMember.NextNode("item");
}
m_tagsHasBeenSet = true;
}
XmlNode awsServiceNode = resultNode.FirstChild("awsService");
if(!awsServiceNode.IsNull())
{
m_awsService = IpamPoolAwsServiceMapper::GetIpamPoolAwsServiceForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(awsServiceNode.GetText()).c_str()).c_str());
m_awsServiceHasBeenSet = true;
}
}
return *this;
}
void IpamPool::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_ownerIdHasBeenSet)
{
oStream << location << index << locationValue << ".OwnerId=" << StringUtils::URLEncode(m_ownerId.c_str()) << "&";
}
if(m_ipamPoolIdHasBeenSet)
{
oStream << location << index << locationValue << ".IpamPoolId=" << StringUtils::URLEncode(m_ipamPoolId.c_str()) << "&";
}
if(m_sourceIpamPoolIdHasBeenSet)
{
oStream << location << index << locationValue << ".SourceIpamPoolId=" << StringUtils::URLEncode(m_sourceIpamPoolId.c_str()) << "&";
}
if(m_ipamPoolArnHasBeenSet)
{
oStream << location << index << locationValue << ".IpamPoolArn=" << StringUtils::URLEncode(m_ipamPoolArn.c_str()) << "&";
}
if(m_ipamScopeArnHasBeenSet)
{
oStream << location << index << locationValue << ".IpamScopeArn=" << StringUtils::URLEncode(m_ipamScopeArn.c_str()) << "&";
}
if(m_ipamScopeTypeHasBeenSet)
{
oStream << location << index << locationValue << ".IpamScopeType=" << IpamScopeTypeMapper::GetNameForIpamScopeType(m_ipamScopeType) << "&";
}
if(m_ipamArnHasBeenSet)
{
oStream << location << index << locationValue << ".IpamArn=" << StringUtils::URLEncode(m_ipamArn.c_str()) << "&";
}
if(m_ipamRegionHasBeenSet)
{
oStream << location << index << locationValue << ".IpamRegion=" << StringUtils::URLEncode(m_ipamRegion.c_str()) << "&";
}
if(m_localeHasBeenSet)
{
oStream << location << index << locationValue << ".Locale=" << StringUtils::URLEncode(m_locale.c_str()) << "&";
}
if(m_poolDepthHasBeenSet)
{
oStream << location << index << locationValue << ".PoolDepth=" << m_poolDepth << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << index << locationValue << ".State=" << IpamPoolStateMapper::GetNameForIpamPoolState(m_state) << "&";
}
if(m_stateMessageHasBeenSet)
{
oStream << location << index << locationValue << ".StateMessage=" << StringUtils::URLEncode(m_stateMessage.c_str()) << "&";
}
if(m_descriptionHasBeenSet)
{
oStream << location << index << locationValue << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
}
if(m_autoImportHasBeenSet)
{
oStream << location << index << locationValue << ".AutoImport=" << std::boolalpha << m_autoImport << "&";
}
if(m_publiclyAdvertisableHasBeenSet)
{
oStream << location << index << locationValue << ".PubliclyAdvertisable=" << std::boolalpha << m_publiclyAdvertisable << "&";
}
if(m_addressFamilyHasBeenSet)
{
oStream << location << index << locationValue << ".AddressFamily=" << AddressFamilyMapper::GetNameForAddressFamily(m_addressFamily) << "&";
}
if(m_allocationMinNetmaskLengthHasBeenSet)
{
oStream << location << index << locationValue << ".AllocationMinNetmaskLength=" << m_allocationMinNetmaskLength << "&";
}
if(m_allocationMaxNetmaskLengthHasBeenSet)
{
oStream << location << index << locationValue << ".AllocationMaxNetmaskLength=" << m_allocationMaxNetmaskLength << "&";
}
if(m_allocationDefaultNetmaskLengthHasBeenSet)
{
oStream << location << index << locationValue << ".AllocationDefaultNetmaskLength=" << m_allocationDefaultNetmaskLength << "&";
}
if(m_allocationResourceTagsHasBeenSet)
{
unsigned allocationResourceTagsIdx = 1;
for(auto& item : m_allocationResourceTags)
{
Aws::StringStream allocationResourceTagsSs;
allocationResourceTagsSs << location << index << locationValue << ".AllocationResourceTagSet." << allocationResourceTagsIdx++;
item.OutputToStream(oStream, allocationResourceTagsSs.str().c_str());
}
}
if(m_tagsHasBeenSet)
{
unsigned tagsIdx = 1;
for(auto& item : m_tags)
{
Aws::StringStream tagsSs;
tagsSs << location << index << locationValue << ".TagSet." << tagsIdx++;
item.OutputToStream(oStream, tagsSs.str().c_str());
}
}
if(m_awsServiceHasBeenSet)
{
oStream << location << index << locationValue << ".AwsService=" << IpamPoolAwsServiceMapper::GetNameForIpamPoolAwsService(m_awsService) << "&";
}
}
void IpamPool::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_ownerIdHasBeenSet)
{
oStream << location << ".OwnerId=" << StringUtils::URLEncode(m_ownerId.c_str()) << "&";
}
if(m_ipamPoolIdHasBeenSet)
{
oStream << location << ".IpamPoolId=" << StringUtils::URLEncode(m_ipamPoolId.c_str()) << "&";
}
if(m_sourceIpamPoolIdHasBeenSet)
{
oStream << location << ".SourceIpamPoolId=" << StringUtils::URLEncode(m_sourceIpamPoolId.c_str()) << "&";
}
if(m_ipamPoolArnHasBeenSet)
{
oStream << location << ".IpamPoolArn=" << StringUtils::URLEncode(m_ipamPoolArn.c_str()) << "&";
}
if(m_ipamScopeArnHasBeenSet)
{
oStream << location << ".IpamScopeArn=" << StringUtils::URLEncode(m_ipamScopeArn.c_str()) << "&";
}
if(m_ipamScopeTypeHasBeenSet)
{
oStream << location << ".IpamScopeType=" << IpamScopeTypeMapper::GetNameForIpamScopeType(m_ipamScopeType) << "&";
}
if(m_ipamArnHasBeenSet)
{
oStream << location << ".IpamArn=" << StringUtils::URLEncode(m_ipamArn.c_str()) << "&";
}
if(m_ipamRegionHasBeenSet)
{
oStream << location << ".IpamRegion=" << StringUtils::URLEncode(m_ipamRegion.c_str()) << "&";
}
if(m_localeHasBeenSet)
{
oStream << location << ".Locale=" << StringUtils::URLEncode(m_locale.c_str()) << "&";
}
if(m_poolDepthHasBeenSet)
{
oStream << location << ".PoolDepth=" << m_poolDepth << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << ".State=" << IpamPoolStateMapper::GetNameForIpamPoolState(m_state) << "&";
}
if(m_stateMessageHasBeenSet)
{
oStream << location << ".StateMessage=" << StringUtils::URLEncode(m_stateMessage.c_str()) << "&";
}
if(m_descriptionHasBeenSet)
{
oStream << location << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
}
if(m_autoImportHasBeenSet)
{
oStream << location << ".AutoImport=" << std::boolalpha << m_autoImport << "&";
}
if(m_publiclyAdvertisableHasBeenSet)
{
oStream << location << ".PubliclyAdvertisable=" << std::boolalpha << m_publiclyAdvertisable << "&";
}
if(m_addressFamilyHasBeenSet)
{
oStream << location << ".AddressFamily=" << AddressFamilyMapper::GetNameForAddressFamily(m_addressFamily) << "&";
}
if(m_allocationMinNetmaskLengthHasBeenSet)
{
oStream << location << ".AllocationMinNetmaskLength=" << m_allocationMinNetmaskLength << "&";
}
if(m_allocationMaxNetmaskLengthHasBeenSet)
{
oStream << location << ".AllocationMaxNetmaskLength=" << m_allocationMaxNetmaskLength << "&";
}
if(m_allocationDefaultNetmaskLengthHasBeenSet)
{
oStream << location << ".AllocationDefaultNetmaskLength=" << m_allocationDefaultNetmaskLength << "&";
}
if(m_allocationResourceTagsHasBeenSet)
{
unsigned allocationResourceTagsIdx = 1;
for(auto& item : m_allocationResourceTags)
{
Aws::StringStream allocationResourceTagsSs;
allocationResourceTagsSs << location << ".AllocationResourceTagSet." << allocationResourceTagsIdx++;
item.OutputToStream(oStream, allocationResourceTagsSs.str().c_str());
}
}
if(m_tagsHasBeenSet)
{
unsigned tagsIdx = 1;
for(auto& item : m_tags)
{
Aws::StringStream tagsSs;
tagsSs << location << ".TagSet." << tagsIdx++;
item.OutputToStream(oStream, tagsSs.str().c_str());
}
}
if(m_awsServiceHasBeenSet)
{
oStream << location << ".AwsService=" << IpamPoolAwsServiceMapper::GetNameForIpamPoolAwsService(m_awsService) << "&";
}
}
} // namespace Model
} // namespace EC2
} // namespace Aws
| 36.307851
| 189
| 0.702157
|
perfectrecall
|
8521e0922a05bd286fa561d8f883e4165bb6c0ba
| 1,224
|
cpp
|
C++
|
src/svLibrary/src/Engine.cpp
|
sevanspowell/sev
|
c678aaab3a9e6bd4e5b98774205c8775c9a3291d
|
[
"MIT"
] | null | null | null |
src/svLibrary/src/Engine.cpp
|
sevanspowell/sev
|
c678aaab3a9e6bd4e5b98774205c8775c9a3291d
|
[
"MIT"
] | 1
|
2017-06-11T06:34:50.000Z
|
2017-06-11T06:34:50.000Z
|
src/svLibrary/src/Engine.cpp
|
sevanspowell/sev
|
c678aaab3a9e6bd4e5b98774205c8775c9a3291d
|
[
"MIT"
] | null | null | null |
#include <cassert>
#include <sstream>
#include <sv/Engine.h>
#include <sv/Globals.h>
#include <sv/ProgramOptions.h>
#include <sv/platform/SDL2Platform.h>
namespace sv {
Engine::Engine() {
isInitialized = false;
platform = std::shared_ptr<Platform>(new SDL2Platform());
}
Engine::~Engine() {
if (isInitialized == true) {
platform->shutdown();
}
}
bool Engine::initialize(int argc, char *argv[]) {
isInitialized = true;
ProgramOptions options(argc, (const char **)argv);
// Find game to load
// std::string game("default");
// int32_t optionIndex = options.checkOption("--game");
// if (optionIndex >= 0) {
// const char *gameOption = options.getOption(optionIndex + 1);
// if (gameOption != nullptr) {
// game = std::string(gameOption);
// }
// }
// Get config file path
// std::stringstream configFilePath;
// configFilePath << game << "/config.cfg" << std::endl;
isInitialized &= client.initialize(options);
isInitialized &= platform->initialize();
return isInitialized;
}
uint32_t Engine::getMilliseconds() const {
assert(isInitialized == true);
return platform->getMilliseconds();
}
}
| 23.538462
| 71
| 0.625817
|
sevanspowell
|
8522913d7710c96bb191a5516028f509c2f728ca
| 715
|
cpp
|
C++
|
2021.11.11-Homework-5/Project5/Source.cpp
|
021213/programming-c-rus-2021-2022
|
58d981f5b63554594705f597aad76bbfa6777988
|
[
"Apache-2.0"
] | null | null | null |
2021.11.11-Homework-5/Project5/Source.cpp
|
021213/programming-c-rus-2021-2022
|
58d981f5b63554594705f597aad76bbfa6777988
|
[
"Apache-2.0"
] | null | null | null |
2021.11.11-Homework-5/Project5/Source.cpp
|
021213/programming-c-rus-2021-2022
|
58d981f5b63554594705f597aad76bbfa6777988
|
[
"Apache-2.0"
] | null | null | null |
#include<iostream>
using namespace std;
int main(int argc, char* argv[])
{
int choice = 0;
int count = 0;
int capacity = 3;
int* a = new int[capacity] { 0 };
int element = 0;
do
{
cin >> choice;
switch (choice)
{
case 1:
cout << "[" << count << "/" << capacity << "] : ";
for (int i = 0; i < count; ++i)
{
cout << a[i] << " ";
}
cout << endl;
break;
case 2:
cin >> element;
if (count == capacity)
{
int* temp = new int[capacity * 2]{ 0 };
for (int i = 0; i < capacity; ++i)
{
temp[i] = a[i];
}
delete[] a;
a = temp;
capacity *= 2;
}
a[count] = element;
++count;
break;
}
} while (choice != 0);
return EXIT_SUCCESS;
}
| 16.25
| 53
| 0.483916
|
021213
|
8526dab9bfc639c7b5cb90b3a340e96be8d9cd89
| 201
|
cpp
|
C++
|
Easy/172_Factorial_Trailing_Zeroes.cpp
|
ShehabMMohamed/LeetCodeCPP
|
684340f29ac15c5e8fa9f6ef5c3f99d4c95ce780
|
[
"MIT"
] | 1
|
2021-03-15T10:02:10.000Z
|
2021-03-15T10:02:10.000Z
|
Easy/172_Factorial_Trailing_Zeroes.cpp
|
ShehabMMohamed/LeetCodeCPP
|
684340f29ac15c5e8fa9f6ef5c3f99d4c95ce780
|
[
"MIT"
] | null | null | null |
Easy/172_Factorial_Trailing_Zeroes.cpp
|
ShehabMMohamed/LeetCodeCPP
|
684340f29ac15c5e8fa9f6ef5c3f99d4c95ce780
|
[
"MIT"
] | null | null | null |
class Solution {
public:
int trailingZeroes(int n) {
int trails = 0;
for(long long int i = 5; n/i > 0; i*=5) {
trails += (n/i);
}
return trails;
}
};
| 20.1
| 49
| 0.452736
|
ShehabMMohamed
|
852bae421dee27b71e48ffd59f87498c7b2defc2
| 23,028
|
hpp
|
C++
|
include/Vector/GenericLengthedVector.hpp
|
Renardjojo/RenardMath
|
74b4e65cf8f663eda830e00a1c61b563f711288c
|
[
"MIT"
] | null | null | null |
include/Vector/GenericLengthedVector.hpp
|
Renardjojo/RenardMath
|
74b4e65cf8f663eda830e00a1c61b563f711288c
|
[
"MIT"
] | null | null | null |
include/Vector/GenericLengthedVector.hpp
|
Renardjojo/RenardMath
|
74b4e65cf8f663eda830e00a1c61b563f711288c
|
[
"MIT"
] | null | null | null |
/*
* Project : FoxMath
* Editing by Six Jonathan
* Date : 2020-08-28 - 10 h 03
*
*
* MIT License
*
* Copyright (c) 2020 Six Jonathan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include "Vector/GenericVector.hpp"
#include "Macro/CrossInheritanceCompatibility.hpp"
namespace FoxMath
{
/**
* @brief Lengthed vector save vector length. This fact optimize length computation of vector but use more memory to save this variable. Use it if you want to know frequently the vector length with vector that don't move between each length check
*
* @tparam TLength
* @tparam TType
*/
template <size_t TLength, typename TType>
class GenericLengthedVector final : public GenericVector<TLength, TType>
{
private:
using Parent = GenericVector<TLength, TType>;
protected:
#pragma region attribut
TType m_length;
bool m_lengthIsDirty = true;
#pragma endregion //!attribut
public:
#pragma region constructor/destructor
constexpr inline
GenericLengthedVector () noexcept = default;
constexpr inline
GenericLengthedVector (const GenericLengthedVector& other) noexcept = default;
constexpr inline
GenericLengthedVector (GenericLengthedVector&& other) noexcept = default;
inline
~GenericLengthedVector () noexcept = default;
constexpr inline
GenericLengthedVector& operator=(GenericLengthedVector const& other) noexcept = default;
constexpr inline
GenericLengthedVector& operator=(GenericLengthedVector && other) noexcept = default;
DECLARE_CROSS_INHERITANCE_COMPATIBILTY(GenericLengthedVector, Parent, GenericVector)
#pragma endregion //!constructor/destructor
#pragma region methods
/**
* @brief Fill generic vector's member with scalar value
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& fill (const TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return GenericVector<TLength, TType>::fill(scalar);
}
/**
* @brief Deprecated to avoid compare distance hack (Less optimized than check directly the length).
* If you really want the squart length ask it explicitely with length() * length()
*
*/
TType squareLength () const noexcept = delete;
/**
* @brief Homogenize vector to the lower dimension
* @note devise each component by the last
* @example to convert vector 4 to vector 3 it must be homogenize to lose it fourth dimension
*
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& homogenize () noexcept
{
m_length /= Parent::m_data[TLength - 1];
return GenericVector<TLength, TType>::homogenize();
}
/**
* @brief Normalize the generic vector. If the generic vector is null (all components are set to 0), nothing is done.
*
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& normalize () noexcept
{
if (m_length) [[likely]]
{
for (size_t i = 0; i < TLength; i++)
Parent::m_data[i] /= m_length;
}
m_length = static_cast<TType>(1);
return *this;
}
/**
* @brief Clamp the generic vector's length to max value
*
* @param maxLength
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& clampLength (TType maxLength) noexcept
{
if (m_length > maxLength) [[likely]]
{
const TType coef = maxLength / m_length;
*this *= coef;
m_length = maxLength;
}
return *this;
}
/**
* @brief perform cross product with another generic vector
*
* @param other
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& cross (const GenericVector<TLength, TType>& other) noexcept
{
m_lengthIsDirty = true;
return GenericVector<TLength, TType>::cross(other);
}
/**
* @brief Performs a linear interpolation between 2 generic vectors of the same type.
*
* @param other
* @param t
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& lerp (const GenericVector<TLength, TType>& other, TType t) noexcept
{
m_lengthIsDirty = true;
return GenericVector<TLength, TType>::lerp(other, t);
}
/**
* @brief Performs a reflection with a normal generic vector
*
* @param normalNormalized : Normal must be normalized
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& reflect (const GenericVector<TLength, TType>& normalNormalized) noexcept
{
m_lengthIsDirty = true;
return GenericVector<TLength, TType>::reflect(normalNormalized);
}
/**
* @brief Set the magnitude of the current generic vector
*
* @param newLength
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& setLength (TType newLength) noexcept
{
const TType coef = newLength / m_length;
*this *= coef;
m_length = newLength;
return *this;
}
/**
* @brief rotate generic vector around another unit generic vector. This function assert if axis is not unit
*
* @param unitAxis
* @param angleRad
*/
inline constexpr
GenericLengthedVector& rotateAroundAxis (const GenericVector<TLength, TType>& unitAxis, const Angle<EAngleType::Radian, TType>& angle) noexcept
{
m_lengthIsDirty = true;
return GenericVector<TLength, TType>::rotateAroundAxis(unitAxis, angle);
}
#pragma endregion //!methods
#pragma region accessor
/**
* @brief return magnitude of the generic vector
*
* @return constexpr cnost TType
*/
[[nodiscard]] inline constexpr
const TType length () noexcept
{
if (m_lengthIsDirty)
{
m_length = GenericVector<TLength, TType>::length();
m_lengthIsDirty = false;
}
return m_length;
}
/**
* @brief return magnitude of the generic vector
*
* @note TODO: When vector is create, constructor must compute the vector length
*
* @return constexpr cnost TType
*/
[[nodiscard]] inline constexpr
const TType length () const noexcept
{
return m_length;
}
#pragma endregion //!accessor
#pragma region mutator
/**
* @brief Set the Data a index
*
* A similar member function, GenericsetDataAt, has the same behavior as this operator function,
* except that GenericsetDataAt is bound-checked and signals if the requested position is out of range by throwing an out_of_range exception.
*
* Portable programs should never call this function with an argument index that is out of range,
* since this causes undefined behavior.
*
* @tparam TscalarType
* @tparam true
* @param index
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& setData(size_t index, TscalarType scalar) noexcept
{
assert(index < TLength);
Parent::m_data[index] = static_cast<TType>(scalar);
m_lengthIsDirty = true;
return *this;
}
/**
* @brief Set the Data at index
*
* The function automatically checks whether index is within the bounds of valid elements in the GenericVector, throwing an out_of_range exception if it is not (i.e., if n is greater than, or equal to, its size).
* This is in contrast with function GenericsetData, that does not check against bounds.
*
* @tparam TscalarType
* @tparam true
* @param index
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& setDataAt(size_t index, TscalarType scalar) throw ()
{
if (index < TLength) [[likely]]
{
Parent::m_data[index] = static_cast<TType>(scalar);
m_lengthIsDirty = true;
return *this;
}
std::__throw_out_of_range_fmt(__N("Genericat: index"
"(which is %zu) >= TLength "
"(which is %zu)"),
index, TLength);
}
#pragma endregion //!mutator
#pragma region operator
#pragma region member access operators
#pragma endregion //!member access operators
#pragma region assignment operators
/**
* @brief fill the vector with scalar assigned
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return implicit constexpr&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
implicit inline constexpr
GenericLengthedVector& operator=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator=(scalar);
}
/**
* @brief addition assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator+=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator+=(scalar);
}
/**
* @brief addition assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator+=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator+=(other);
}
/**
* @brief subtraction assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator-=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator-=(scalar);
}
/**
* @brief subtraction assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator-=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator-=(other);
}
/**
* @brief multiplication assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator*=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator*=(scalar);
}
/**
* @brief multiplication assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator*=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator*=(other);
}
/**
* @brief division assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator/=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator/=(scalar);
}
/**
* @brief division assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator/=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator/=(other);
}
/**
* @brief modulo assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator%=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator%=(scalar);
}
/**
* @brief modulo assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator%=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator%=(other);
}
/**
* @brief bitwise AND assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator&=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator&=(scalar);
}
/**
* @brief bitwise AND assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator&=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator&=(other);
}
/**
* @brief bitwise OR assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator|=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator|=(scalar);
}
/**
* @brief bitwise OR assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator|=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator|=(other);
}
/**
* @brief bitwise XOR assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator^=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator^=(scalar);
}
/**
* @brief bitwise XOR assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator^=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator^=(other);
}
/**
* @brief bitwise left shift assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator<<=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator<<=(scalar);
}
/**
* @brief bitwise left shift assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator<<=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator<<=(other);
}
/**
* @brief bitwise right shift assignment
*
* @tparam TscalarType
* @tparam true
* @param scalar
* @return constexpr GenericLengthedVector&
*/
template<typename TscalarType, IsArithmetic<TscalarType> = true>
inline constexpr
GenericLengthedVector& operator>>=(TscalarType scalar) noexcept
{
m_lengthIsDirty = true;
return Parent::operator>>=(scalar);
}
/**
* @brief bitwise right shift assignment
*
* @tparam TLengthOther
* @tparam TType
* @param other
* @return constexpr GenericLengthedVector&
*/
template <size_t TLengthOther, typename TTypeOther>
inline constexpr
GenericLengthedVector& operator>>=(const GenericVector<TLengthOther, TTypeOther>& other) noexcept
{
m_lengthIsDirty = true;
return Parent::operator>>=(other);
}
#pragma endregion //!region assignment operators
#pragma region increment decrement operators
/**
* @brief pre-increment operator
*
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& operator++ () noexcept
{
m_lengthIsDirty = true;
return Parent::operator++();
}
/**
* @brief pre-decrement operator
*
* @return constexpr GenericLengthedVector&
*/
inline constexpr
GenericLengthedVector& operator-- () noexcept
{
m_lengthIsDirty = true;
return Parent::operator--();
}
/**
* @brief post-increment operator
*
* @return constexpr GenericLengthedVector
*/
inline constexpr
GenericLengthedVector operator++ (int) noexcept
{
m_lengthIsDirty = true;
return Parent::operator++();
}
/**
* @brief post-decrement operator
*
* @return constexpr GenericLengthedVector
*/
inline constexpr
GenericLengthedVector operator-- (int) noexcept
{
m_lengthIsDirty = true;
return Parent::operator--();
}
#pragma endregion //!increment decrement operators
#pragma endregion //!operators
#pragma region convertor
#pragma endregion //!convertor
};
} /*namespace FoxMath*/
| 31.588477
| 250
| 0.57543
|
Renardjojo
|
852cb2f518a7b520b016b9426084cc6c4714d19a
| 371
|
cpp
|
C++
|
matriz/MATRIZ.cpp
|
ejpcr/libs-c
|
e544e4338ea9f2fe8c57de83045944f38ae06a07
|
[
"MIT"
] | null | null | null |
matriz/MATRIZ.cpp
|
ejpcr/libs-c
|
e544e4338ea9f2fe8c57de83045944f38ae06a07
|
[
"MIT"
] | null | null | null |
matriz/MATRIZ.cpp
|
ejpcr/libs-c
|
e544e4338ea9f2fe8c57de83045944f38ae06a07
|
[
"MIT"
] | null | null | null |
#include <C:\TC\BIN\PRESENTA.CPP>
#include <C:\TC\BIN\CAPTURA.CPP>
#include <C:\TC\BIN\SALIDA.CPP>
#include <C:\TC\BIN\PROCESO.CPP>
#include <C:\TC\BIN\Menu.CPP>
void main()
{entrar();
matriz a,b; double x;
a=crear(a);limpiar(); b=crear(b);limpiar();
a=llenar(a);limpiar(); b=llenar(b);limpiar();
menu(a,b);
getchar();
vaciar(a);vaciar(b);
limpiar(); getchar();
}
| 24.733333
| 46
| 0.6469
|
ejpcr
|
852d241652927fe22d2f76c1f1384a421db67a87
| 1,245
|
cpp
|
C++
|
November/Homeworks/Homework 1/AlgoritmaOdev4/AlgoritmaOdev4.cpp
|
MrMirhan/Algorithm-Class-221-HomeWorks
|
3198fce11a0fd4ea10b576b418cec3a35ffcff2e
|
[
"MIT"
] | 1
|
2020-11-19T09:15:09.000Z
|
2020-11-19T09:15:09.000Z
|
November/Homeworks/Homework 1/AlgoritmaOdev4/AlgoritmaOdev4.cpp
|
MrMirhan/Algorithm-Class-221-HomeWorks
|
3198fce11a0fd4ea10b576b418cec3a35ffcff2e
|
[
"MIT"
] | null | null | null |
November/Homeworks/Homework 1/AlgoritmaOdev4/AlgoritmaOdev4.cpp
|
MrMirhan/Algorithm-Class-221-HomeWorks
|
3198fce11a0fd4ea10b576b418cec3a35ffcff2e
|
[
"MIT"
] | 2
|
2020-11-12T17:37:28.000Z
|
2020-11-21T14:48:49.000Z
|
// AlgoritmaOdev4.cpp : Bu dosya 'main' işlevi içeriyor. Program yürütme orada başlayıp biter.
//
#include <iostream>
#include <string>
using namespace std;
void minmax(int a, int b, int c, int d) {
int min_ab, min_cd, min, max_ab, max_cd, max;
min_ab = a < b ? a : b;
min_cd = c < d ? c : d;
max_ab = a > b ? a : b;
max_cd = c > d ? c : d;
min = min_ab < min_cd ? min_ab : min_cd;
max = max_ab > max_cd ? max_ab : max_cd;
cout << "Max: " << max << endl;
cout << "Min: " << min << endl;
}
int main()
{
setlocale(LC_ALL, "Turkish");
while (true) {
char i;
int a, b, c, d;
while (1) {
cout << "Karşılaştırmak adına 4 sayı giriniz. (Örn: 2, 10, 278, 5210)" << endl;
cin >> a >> b >> c >> d;
if (cin.good()) {
break;
}
else {
cout << "Lütfen sadece sayı giriniz!" << endl;
cin.clear();
cin.ignore(INT_MAX, '\n');
}
}
minmax(a, b, c, d);
cout << "\nİşlemi bitirmek için 'c' yazın. Devam etmek için bir harfe basıp ENTER tuşuna basın.";
cin >> i;
if (i == 'c') {
break;
}
}
}
| 25.408163
| 105
| 0.469076
|
MrMirhan
|
852fd5adb5e70262f234a2e9b9f05aec7056b782
| 4,075
|
cpp
|
C++
|
libs/7zip/win/CPP/7zip/UI/Common/ExtractingFilePath.cpp
|
JosephMillsAtWork/yacl
|
22458da501b1bdf08c67f20b01bbe9d639cf326f
|
[
"MIT"
] | 2
|
2019-04-03T20:07:36.000Z
|
2020-06-24T14:05:46.000Z
|
libs/7zip/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp
|
JosephMillsAtWork/yacl
|
22458da501b1bdf08c67f20b01bbe9d639cf326f
|
[
"MIT"
] | null | null | null |
libs/7zip/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp
|
JosephMillsAtWork/yacl
|
22458da501b1bdf08c67f20b01bbe9d639cf326f
|
[
"MIT"
] | 1
|
2020-06-24T14:05:52.000Z
|
2020-06-24T14:05:52.000Z
|
// ExtractingFilePath.cpp
#include "StdAfx.h"
#include "../../../Common/Wildcard.h"
#include "../../../Windows/FileName.h"
#include "ExtractingFilePath.h"
static UString ReplaceIncorrectChars(const UString &s, bool repaceColon)
{
#ifdef _WIN32
UString res;
bool beforeColon = true;
{
for (unsigned i = 0; i < s.Len(); i++)
{
wchar_t c = s[i];
if (beforeColon)
if (c == '*' || c == '?' || c < 0x20 || c == '<' || c == '>' || c == '|' || c == '"')
c = '_';
if (c == ':')
{
if (repaceColon)
c = '_';
else
beforeColon = false;
}
res += c;
}
}
if (beforeColon)
{
for (int i = res.Len() - 1; i >= 0; i--)
{
wchar_t c = res[i];
if (c != '.' && c != ' ')
break;
res.ReplaceOneCharAtPos(i, '_');
}
}
return res;
#else
return s;
#endif
}
#ifdef _WIN32
static const wchar_t *g_ReservedNames[] =
{
L"CON", L"PRN", L"AUX", L"NUL"
};
static bool CheckTail(const UString &name, unsigned len)
{
int dotPos = name.Find(L'.');
if (dotPos < 0)
dotPos = name.Len();
UString s = name.Left(dotPos);
s.TrimRight();
return s.Len() != len;
}
static bool CheckNameNum(const UString &name, const wchar_t *reservedName)
{
unsigned len = MyStringLen(reservedName);
if (name.Len() <= len)
return true;
if (MyStringCompareNoCase_N(name, reservedName, len) != 0)
return true;
wchar_t c = name[len];
if (c < L'0' || c > L'9')
return true;
return CheckTail(name, len + 1);
}
static bool IsSupportedName(const UString &name)
{
for (unsigned i = 0; i < ARRAY_SIZE(g_ReservedNames); i++)
{
const wchar_t *reservedName = g_ReservedNames[i];
unsigned len = MyStringLen(reservedName);
if (name.Len() < len)
continue;
if (MyStringCompareNoCase_N(name, reservedName, len) != 0)
continue;
if (!CheckTail(name, len))
return false;
}
if (!CheckNameNum(name, L"COM"))
return false;
return CheckNameNum(name, L"LPT");
}
#endif
static UString GetCorrectFileName(const UString &path, bool repaceColon)
{
if (path == L".." || path == L".")
return UString();
return ReplaceIncorrectChars(path, repaceColon);
}
void MakeCorrectPath(bool isPathFromRoot, UStringVector &pathParts, bool replaceAltStreamColon)
{
for (unsigned i = 0; i < pathParts.Size();)
{
UString &s = pathParts[i];
#ifdef _WIN32
bool needReplaceColon = (replaceAltStreamColon || i != pathParts.Size() - 1);
if (i == 0 && isPathFromRoot && NWindows::NFile::NName::IsDrivePath(s))
{
UString s2 = s[0];
s2 += L'_';
s2 += GetCorrectFileName(s.Ptr(2), needReplaceColon);
s = s2;
}
else
s = GetCorrectFileName(s, needReplaceColon);
#endif
if (s.IsEmpty())
pathParts.Delete(i);
else
{
#ifdef _WIN32
if (!IsSupportedName(s))
s = (UString)L"_" + s;
#endif
i++;
}
}
}
UString MakePathNameFromParts(const UStringVector &parts)
{
UString result;
FOR_VECTOR (i, parts)
{
if (i != 0)
result += WCHAR_PATH_SEPARATOR;
result += parts[i];
}
return result;
}
static const wchar_t *k_EmptyReplaceName = L"[]";
void Correct_IfEmptyLastPart(UStringVector &parts)
{
if (parts.IsEmpty())
parts.Add(k_EmptyReplaceName);
else
{
UString &s = parts.Back();
if (s.IsEmpty())
s = k_EmptyReplaceName;
}
}
UString GetCorrectFsPath(const UString &path)
{
UString res = GetCorrectFileName(path, true);
#ifdef _WIN32
if (!IsSupportedName(res))
res = (UString)L"_" + res;
#endif
if (res.IsEmpty())
res = k_EmptyReplaceName;
return res;
}
UString GetCorrectFullFsPath(const UString &path)
{
UStringVector parts;
SplitPathToParts(path, parts);
FOR_VECTOR (i, parts)
{
UString &s = parts[i];
#ifdef _WIN32
while (!s.IsEmpty() && (s.Back() == '.' || s.Back() == ' '))
s.DeleteBack();
if (!IsSupportedName(s))
s.InsertAtFront(L'_');
#endif
}
return MakePathNameFromParts(parts);
}
| 21.335079
| 95
| 0.590675
|
JosephMillsAtWork
|
8532d44e9378acd401cf14b9f932d162525658fd
| 7,384
|
cpp
|
C++
|
Driver/Thread/Pthread/ZThreadPthread.cpp
|
paintdream/PaintsNowCore
|
4962b579ff3bc00aa55bb9294a4d722b1bef36ac
|
[
"MIT"
] | 2
|
2020-10-09T07:43:13.000Z
|
2021-09-01T02:09:09.000Z
|
Driver/Thread/Pthread/ZThreadPthread.cpp
|
paintdream/PaintsNowCore
|
4962b579ff3bc00aa55bb9294a4d722b1bef36ac
|
[
"MIT"
] | null | null | null |
Driver/Thread/Pthread/ZThreadPthread.cpp
|
paintdream/PaintsNowCore
|
4962b579ff3bc00aa55bb9294a4d722b1bef36ac
|
[
"MIT"
] | 1
|
2021-03-31T02:02:02.000Z
|
2021-03-31T02:02:02.000Z
|
#include "ZThreadPthread.h"
#if defined(_DEBUG) && defined(_MSC_VER)
#include <Windows.h>
#endif
#if !defined(_MSC_VER) || _MSC_VER > 1200
#define USE_STD_THREAD
#include <thread>
#include <mutex>
#include <condition_variable>
#include <chrono>
#else
#include <windows.h>
#include <process.h>
#if _WIN32_WINNT >= 0x0600 // Windows Vista
#define HAS_CONDITION_VARIABLE 1
#else
#define HAS_CONDITION_VARIABLE 0
#endif
#endif
using namespace PaintsNow;
class LockImpl : public IThread::Lock {
public:
#ifdef USE_STD_THREAD
std::mutex cs;
#if defined(_DEBUG) && defined(_MSC_VER)
DWORD owner;
#endif
#else
CRITICAL_SECTION cs;
#if defined(_DEBUG)
DWORD owner;
#endif
#endif
size_t lockCount;
};
class ThreadImpl : public IThread::Thread {
public:
#ifdef USE_STD_THREAD
std::thread thread;
#else
HANDLE thread;
#endif
TWrapper<bool, IThread::Thread*, size_t> proxy;
size_t index;
bool running;
bool managed;
bool reserved[2];
};
class EventImpl : public IThread::Event {
public:
#ifdef USE_STD_THREAD
std::condition_variable cond;
#else
#if HAS_CONDITION_VARIABLE
CONDITION_VARIABLE cond;
#else
HANDLE cond;
#endif
#endif
};
#ifdef USE_STD_THREAD
static void
#else
static UINT _stdcall
#endif
_ThreadProc(void* param)
{
ThreadImpl* thread = reinterpret_cast<ThreadImpl*>(param);
thread->running = true;
bool deleteSelf = thread->proxy(thread, thread->index);
if (deleteSelf) {
thread->running = false;
delete thread;
}
#ifndef USE_STD_THREAD
::_endthreadex(0);
return 0;
#endif
}
ZThreadPthread::ZThreadPthread() {
}
ZThreadPthread::~ZThreadPthread() {
}
void ZThreadPthread::Wait(Thread* th) {
ThreadImpl* t = static_cast<ThreadImpl*>(th);
#ifdef USE_STD_THREAD
t->thread.join();
#else
::WaitForSingleObject(t->thread, INFINITE);
#endif
t->managed = false;
}
IThread::Thread* ZThreadPthread::NewThread(const TWrapper<bool, IThread::Thread*, size_t>& wrapper, size_t index) {
ThreadImpl* t = new ThreadImpl();
t->proxy = wrapper;
t->index = index;
t->managed = true;
#ifdef USE_STD_THREAD
t->thread = std::thread(_ThreadProc, t);
#else
t->thread = (HANDLE)::_beginthreadex(nullptr, 0, _ThreadProc, t, 0, nullptr);
#endif
return t;
}
bool ZThreadPthread::IsThreadRunning(Thread* th) const {
assert(th != nullptr);
ThreadImpl* thread = static_cast<ThreadImpl*>(th);
return thread->running;
}
void ZThreadPthread::DeleteThread(Thread* thread) {
assert(thread != nullptr);
ThreadImpl* t = static_cast<ThreadImpl*>(thread);
if (t->managed) {
#ifdef USE_STD_THREAD
t->thread.detach();
#else
::CloseHandle(t->thread);
#endif
}
delete t;
}
IThread::Lock* ZThreadPthread::NewLock() {
LockImpl* lock = new LockImpl();
lock->lockCount = 0;
#if defined(_DEBUG) && defined(_MSC_VER)
lock->owner = 0;
#endif
#ifndef USE_STD_THREAD
::InitializeCriticalSection(&lock->cs);
#endif
return lock;
}
void ZThreadPthread::DoLock(Lock* l) {
assert(l != nullptr);
LockImpl* lock = static_cast<LockImpl*>(l);
#ifdef USE_STD_THREAD
#if defined(_DEBUG) && defined(_MSC_VER)
assert(lock->owner != ::GetCurrentThreadId());
#endif
lock->cs.lock();
#if defined(_DEBUG) && defined(_MSC_VER)
lock->owner = ::GetCurrentThreadId();
// printf("Thread %d, takes: %p\n", lock->owner, lock);
#endif
#else
::EnterCriticalSection(&lock->cs);
#endif
assert(lock->lockCount == 0);
lock->lockCount++;
}
void ZThreadPthread::UnLock(Lock* l) {
assert(l != nullptr);
LockImpl* lock = static_cast<LockImpl*>(l);
lock->lockCount--;
#ifdef USE_STD_THREAD
#if defined(_DEBUG) && defined(_MSC_VER)
// printf("Thread %d, releases: %p\n", lock->owner, lock);
lock->owner = ::GetCurrentThreadId();
lock->owner = 0;
#endif
lock->cs.unlock();
#else
::LeaveCriticalSection(&lock->cs);
#endif
}
bool ZThreadPthread::TryLock(Lock* l) {
assert(l != nullptr);
LockImpl* lock = static_cast<LockImpl*>(l);
#ifdef USE_STD_THREAD
bool success = lock->cs.try_lock();
#else
bool success = ::TryEnterCriticalSection(&lock->cs) != 0;
#endif
if (success) {
lock->lockCount++;
}
return success;
}
void ZThreadPthread::DeleteLock(Lock* l) {
assert(l != nullptr);
LockImpl* lock = static_cast<LockImpl*>(l);
#ifndef USE_STD_THREAD
::DeleteCriticalSection(&lock->cs);
#endif
delete lock;
}
bool ZThreadPthread::IsLocked(Lock* l) {
assert(l != nullptr);
LockImpl* lock = static_cast<LockImpl*>(l);
return lock->lockCount != 0;
}
IThread::Event* ZThreadPthread::NewEvent() {
EventImpl* ev = new EventImpl();
#ifndef USE_STD_THREAD
#if HAS_CONDITION_VARIABLE
::InitializeConditionVariable(&ev->cond);
#else
ev->cond = ::CreateEvent(NULL, FALSE, FALSE, NULL);
#endif
#endif
return ev;
}
void ZThreadPthread::Signal(Event* event) {
assert(event != nullptr);
EventImpl* ev = static_cast<EventImpl*>(event);
#ifdef USE_STD_THREAD
ev->cond.notify_one();
#else
#if HAS_CONDITION_VARIABLE
::WakeConditionVariable(&ev->cond);
#else
::SetEvent(ev->cond);
#endif
#endif
}
void ZThreadPthread::Wait(Event* event, Lock* lock, size_t timeout) {
assert(event != nullptr);
assert(lock != nullptr);
EventImpl* ev = static_cast<EventImpl*>(event);
LockImpl* l = static_cast<LockImpl*>(lock);
assert(l->lockCount != 0);
l->lockCount--; // it's safe because we still hold this lock
#ifdef USE_STD_THREAD
std::unique_lock<std::mutex> u(l->cs, std::adopt_lock);
ev->cond.wait_for(u, std::chrono::microseconds(timeout));
u.release();
#else
#if HAS_CONDITION_VARIABLE
::SleepConditionVariableCS(&ev->cond, &l->cs, (DWORD)timeout);
#else
::LeaveCriticalSection(&l->cs);
::WaitForSingleObject(ev->cond, (DWORD)timeout); // Windows Event's SetEvent can be called before WaitForSingleObject
::EnterCriticalSection(&l->cs);
#endif
#endif
l->lockCount++; // it's also safe because we has already take lock before returning from pthread_cond_wait
}
void ZThreadPthread::Wait(Event* event, Lock* lock) {
assert(event != nullptr);
assert(lock != nullptr);
EventImpl* ev = static_cast<EventImpl*>(event);
LockImpl* l = static_cast<LockImpl*>(lock);
l->lockCount--; // it's safe because we still hold this lock
#ifdef USE_STD_THREAD
std::unique_lock<std::mutex> u(l->cs, std::adopt_lock);
#if defined(_DEBUG) && defined(_MSC_VER)
l->owner = 0;
#endif
ev->cond.wait(u);
#if defined(_DEBUG) && defined(_MSC_VER)
l->owner = ::GetCurrentThreadId();
#endif
u.release();
#else
#if HAS_CONDITION_VARIABLE
::SleepConditionVariableCS(&ev->cond, &l->cs, INFINITE);
#else
::LeaveCriticalSection(&l->cs);
::WaitForSingleObject(ev->cond, INFINITE);
::EnterCriticalSection(&l->cs);
#endif
#endif
l->lockCount++; // it's also safe because we has already take lock before returning from pthread_cond_wait
}
void ZThreadPthread::DeleteEvent(Event* event) {
assert(event != nullptr);
EventImpl* ev = static_cast<EventImpl*>(event);
#ifndef USE_STD_THREAD
#if !HAS_CONDITION_VARIABLE
::CloseHandle(ev->cond);
#endif
#endif
delete ev;
}
void ZThreadPthread::Sleep(size_t milliseconds) {
#ifdef USE_STD_THREAD
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
#else
::Sleep((DWORD)milliseconds);
#endif
}
| 22.860681
| 119
| 0.687839
|
paintdream
|
8539c3db25cc2d087a1b4366f5cbb96d5a369184
| 3,585
|
cpp
|
C++
|
DataStructure/cht.cpp
|
rsk0315/codefolio
|
1de990978489f466e1fd47884d4a19de9cc30e02
|
[
"MIT"
] | 1
|
2020-03-20T13:24:30.000Z
|
2020-03-20T13:24:30.000Z
|
DataStructure/cht.cpp
|
rsk0315/codefolio
|
1de990978489f466e1fd47884d4a19de9cc30e02
|
[
"MIT"
] | null | null | null |
DataStructure/cht.cpp
|
rsk0315/codefolio
|
1de990978489f466e1fd47884d4a19de9cc30e02
|
[
"MIT"
] | null | null | null |
template <typename Tp>
class lower_envelope {
public:
using size_type = size_t;
using value_type = Tp;
private:
using interval_type = std::pair<value_type, value_type>;
using line_type = std::pair<value_type, value_type>;
std::map<interval_type, line_type> M_lines;
std::map<line_type, interval_type, std::greater<line_type>> M_intervals;
static value_type const S_min = std::numeric_limits<value_type>::min();
static value_type const S_max = std::numeric_limits<value_type>::max();
static value_type S_divfloor(value_type x, value_type y) {
value_type q = x / y;
value_type r = x % y;
if (r < 0) --q;
return q;
}
static value_type S_divceil(value_type x, value_type y) {
value_type q = x / y;
value_type r = x % y;
if (r > 0) ++q;
return q;
}
public:
bool push(value_type const& a, value_type const& b) {
// try to push y = ax+b; return true if it is actually pushed
if (M_lines.empty()) {
M_lines[interval_type(S_min, S_max)] = line_type(a, b);
M_intervals[line_type(a, b)] = interval_type(S_min, S_max);
return true;
}
auto it = M_intervals.lower_bound(line_type(a, S_min));
value_type lb = S_min;
value_type ub = S_max;
auto it1 = it; // next one
if (it != M_intervals.end() && it->first.first == a) {
if (it->first.second <= b) return false;
M_lines.erase(it->second);
it1 = M_intervals.erase(it);
}
auto it0 = M_intervals.end(); // previous one
if (it != M_intervals.begin()) it0 = std::prev(it);
if (it0 != M_intervals.end()) {
value_type a0, b0;
std::tie(a0, b0) = it0->first;
lb = S_divceil(b-b0, -(a-a0)); // XXX this may cause overflow
}
if (it1 != M_intervals.end()) {
value_type a1, b1;
std::tie(a1, b1) = it1->first;
ub = S_divfloor(b1-b, -(a1-a)); // XXX this may cause overflow
}
if (ub < lb) return false;
if (it0 != M_intervals.end()) {
while (lb <= it0->second.first) {
M_lines.erase(it0->second);
it0 = M_intervals.erase(it0);
if (it0 == M_intervals.begin()) {
it0 = M_intervals.end();
break;
}
--it0;
value_type a0, b0;
std::tie(a0, b0) = it0->first;
lb = S_divceil(b-b0, -(a-a0));
}
}
while (it1 != M_intervals.end() && it1->second.second <= ub) {
M_lines.erase(it1->second);
it1 = M_intervals.erase(it1);
value_type a1, b1;
std::tie(a1, b1) = it1->first;
ub = S_divfloor(b1-b, -(a1-a));
}
if (it0 != M_intervals.end()) {
value_type a0, b0, l0, u0;
std::tie(a0, b0) = it0->first;
std::tie(l0, u0) = it0->second;
it0->second.second = std::min(u0, lb-1);
M_lines.erase(interval_type(l0, u0));
M_lines[it0->second] = it0->first;
}
if (it1 != M_intervals.end()) {
value_type a1, b1, l1, u1;
std::tie(a1, b1) = it1->first;
std::tie(l1, u1) = it1->second;
it1->second.first = std::max(l1, ub+1);
M_lines.erase(interval_type(l1, u1));
M_lines[it1->second] = it1->first;
}
M_lines[interval_type(lb, ub)] = line_type(a, b);
M_intervals[line_type(a, b)] = interval_type(lb, ub);
return true;
}
value_type get(value_type const& x) {
// return the minimum value at x
value_type a, b;
std::tie(a, b) = (--M_lines.upper_bound(interval_type(x, S_max)))->second;
return a*x + b;
}
};
template <typename Tp> Tp const lower_envelope<Tp>::S_min;
template <typename Tp> Tp const lower_envelope<Tp>::S_max;
| 29.875
| 78
| 0.591353
|
rsk0315
|
853b0a18ec8a70ae2b7be35776b998dea2b8c39c
| 5,139
|
cpp
|
C++
|
Applied/CCore/src/FileName.cpp
|
SergeyStrukov/CCore-4-xx
|
5faeadd50a24a7dbe18ffff8efe5f49212588637
|
[
"BSL-1.0"
] | null | null | null |
Applied/CCore/src/FileName.cpp
|
SergeyStrukov/CCore-4-xx
|
5faeadd50a24a7dbe18ffff8efe5f49212588637
|
[
"BSL-1.0"
] | null | null | null |
Applied/CCore/src/FileName.cpp
|
SergeyStrukov/CCore-4-xx
|
5faeadd50a24a7dbe18ffff8efe5f49212588637
|
[
"BSL-1.0"
] | null | null | null |
/* FileName.cpp */
//----------------------------------------------------------------------------------------
//
// Project: CCore 4.01
//
// Tag: Applied
//
// License: Boost Software License - Version 1.0 - August 17th, 2003
//
// see http://www.boost.org/LICENSE_1_0.txt or the local copy
//
// Copyright (c) 2020 Sergey Strukov. All rights reserved.
//
//----------------------------------------------------------------------------------------
#include <CCore/inc/FileName.h>
#include <CCore/inc/OutBuf.h>
namespace CCore {
/* class FileName */
struct FileName::PathUp : PathBase
{
StrLen path;
ulen up;
bool ok;
PathUp(StrLen path,ulen up) // path ends (if non-empty) with '/' or '\\' or ':'
: ok(false)
{
SplitPath split_dev(path);
ulen len=split_dev.path.len;
for(; len && up ;up--)
{
SplitName split({split_dev.path.ptr,len-1});
switch( split.getNameType() )
{
case Name :
{
len=split.path.len;
}
break;
case DotDotName :
{
set(path.prefix(split_dev.dev.len+len),up);
}
return;
default: return;
}
}
set(path.prefix(split_dev.dev.len+len),up);
}
void set(StrLen path_,ulen up_)
{
path=path_;
up=up_;
ok=true;
}
};
struct FileName::InspectPath
{
DynArray<StrLen> list;
ulen up = 0 ;
bool root = false ;
bool ok = false ;
explicit InspectPath(SplitPathName split_file)
: list(DoReserve,10)
{
list.append_copy(split_file.name);
StrLen path=split_file.path;
for(;;)
{
SplitPathName split_path(path);
switch( split_path.getNameType() )
{
case SplitPathName::Name :
{
if( up )
up--;
else
list.append_copy(split_path.name);
}
break;
case SplitPathName::EmptyName :
{
if( !!split_path || up ) return;
root=true;
}
break;
case SplitPathName::DotName :
{
// skip
}
break;
case SplitPathName::DotDotName :
{
up++;
}
break;
}
if( !split_path ) break;
path=split_path.path;
}
ok=true;
}
bool shrink(StrLen &path)
{
if( up )
{
PathUp path_up(path,up);
if( !path_up.ok ) return false;
path=path_up.path;
up=path_up.up;
}
return true;
}
template <class T,class S>
void put(T &out,S set) const
{
if( root ) out('/');
for(ulen count=up; count ;count--) out('.','.','/');
auto r=RangeReverse(list);
for(; r.len>1 ;++r) out(*r,'/');
set();
out(*r);
}
ulen countLen(ulen &off,ulen len) const
{
OutCount<ulen,char> counter(len);
put(counter, [&] () { off=counter; } );
return counter;
}
ULenSat countLenSat(ulen &off,ulen len) const
{
OutCount<ULenSat,char> counter(len);
put(counter, [&] () { off=ULenSat(counter).value; } );
return counter;
}
void put(OutBuf<char> &out) const
{
put(out, [] () {} );
}
};
class FileName::Out : public OutBuf<char>
{
public:
Out(DynArray<char> &buf,ulen len) : OutBuf<char>(buf.extend_raw(len).ptr) {}
};
void FileName::setAbs(StrLen file_name,SplitPath split_dev,SplitPathName split_file)
{
if( !split_file )
{
buf.extend_copy(file_name);
off=split_dev.dev.len;
}
else
{
// inspect
InspectPath inspect(split_file);
if( !inspect.ok ) return;
// count len
ulen len=inspect.countLen(off,split_dev.dev.len);
// build
Out out(buf,len);
out(split_dev.dev);
inspect.put(out);
}
ok=true;
}
void FileName::setRel(StrLen path,SplitPathName split_file)
{
if( !split_file )
{
ulen len=LenAdd(path.len,split_file.name.len);
Out out(buf,len);
out(path,split_file.name);
off=path.len;
}
else
{
// inspect
InspectPath inspect(split_file);
if( !inspect.ok || inspect.root ) return;
if( !inspect.shrink(path) ) return;
// count len
ulen off_;
ULenSat len=inspect.countLenSat(off_,path.len);
if( !len ) return;
off=off_;
// build
Out out(buf,len.value);
out(path);
inspect.put(out);
}
ok=true;
}
FileName::FileName(StrLen file_name)
{
SplitPath split_dev(file_name);
SplitPathName split_file(split_dev.path);
if( split_file.getNameType()==SplitPathName::Name )
{
setAbs(file_name,split_dev,split_file);
}
}
FileName::FileName(StrLen path,StrLen file_name)
{
SplitPath split_dev(file_name);
SplitPathName split_file(split_dev.path);
if( split_file.getNameType()==SplitPathName::Name )
{
if( !split_dev && !PathIsRooted(file_name) )
{
setRel(path,split_file);
}
else
{
setAbs(file_name,split_dev,split_file);
}
}
}
} // namespace CCore
| 17.13
| 90
| 0.526562
|
SergeyStrukov
|
853bfe4922c5b8f74af6397ae26fdb8878cf1de1
| 1,068
|
cpp
|
C++
|
cses/introductoryproblems/1094_IncreasingArray.cpp
|
seahrh/cses-problem-set
|
1d4ab18f7686ab4e87cc74a5e911494780e42b21
|
[
"MIT"
] | null | null | null |
cses/introductoryproblems/1094_IncreasingArray.cpp
|
seahrh/cses-problem-set
|
1d4ab18f7686ab4e87cc74a5e911494780e42b21
|
[
"MIT"
] | null | null | null |
cses/introductoryproblems/1094_IncreasingArray.cpp
|
seahrh/cses-problem-set
|
1d4ab18f7686ab4e87cc74a5e911494780e42b21
|
[
"MIT"
] | 1
|
2022-02-12T11:05:13.000Z
|
2022-02-12T11:05:13.000Z
|
/*
You are given an array of n integers.
Modify the array so that it is increasing, i.e., every element is at least as large as the previous element.
On each turn, you may increase the value of any element by one. What is the minimum number of turns required?
Input
The first input line contains an integer n: the size of the array.
Then, the second line contains n integers x1,x2,…,xn: the contents of the array.
Output
Print the minimum number of turns.
Constraints
1≤n≤2⋅10^5
1≤xi≤10^9
Example
Input:
5
3 2 5 1 7
Output:
5
SOLUTION
Time O(N)
Space O(1): if the original array can be modified
*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
vector<ll> xs(n);
for (ll i = 0; i < n; i++)
cin >> xs[i];
ll res = 0, prev = xs[0];
for (ll i = 1; i < n; i++)
{
if (xs[i] < prev)
{
res += prev - xs[i];
xs[i] = prev;
}
prev = xs[i];
}
cout << res;
return 0;
}
| 21.795918
| 109
| 0.607678
|
seahrh
|
853c50a2752dba650627d28f485d9eccc266c10c
| 227
|
cpp
|
C++
|
MainLib/Core/SceneCompletion/CPUInstantiations.cpp
|
Bovey0809/SCFusion
|
1d4a8f4eb0f330f5a69efd89fbf28686c1405471
|
[
"BSD-2-Clause"
] | 30
|
2020-11-06T09:11:55.000Z
|
2022-03-11T06:56:57.000Z
|
MainLib/Core/SceneCompletion/CPUInstantiations.cpp
|
ShunChengWu/SCFusion
|
1d4a8f4eb0f330f5a69efd89fbf28686c1405471
|
[
"BSD-2-Clause"
] | 1
|
2021-12-17T07:03:01.000Z
|
2021-12-17T07:03:01.000Z
|
MainLib/Core/SceneCompletion/CPUInstantiations.cpp
|
Bovey0809/SCFusion
|
1d4a8f4eb0f330f5a69efd89fbf28686c1405471
|
[
"BSD-2-Clause"
] | 1
|
2021-12-17T07:02:47.000Z
|
2021-12-17T07:02:47.000Z
|
// Copyright 2014-2017 Oxford University Innovation Limited and the authors of InfiniTAM
#include "../../ITMLibDefines.h"
#include "SceneCompletion.tpp"
//Core
template class SCFUSION::SceneCompletion<ITMVoxel, ITMVoxelIndex>;
| 37.833333
| 88
| 0.797357
|
Bovey0809
|
853cd933cd66cd7622490591b70fa693c08ff795
| 558
|
hpp
|
C++
|
src/Jogo/GUI/EventHandler.hpp
|
MatheusKunnen/Jogo-TecProg
|
66f4320e51e42d12da74e487cc8552377ce865bb
|
[
"MIT"
] | null | null | null |
src/Jogo/GUI/EventHandler.hpp
|
MatheusKunnen/Jogo-TecProg
|
66f4320e51e42d12da74e487cc8552377ce865bb
|
[
"MIT"
] | null | null | null |
src/Jogo/GUI/EventHandler.hpp
|
MatheusKunnen/Jogo-TecProg
|
66f4320e51e42d12da74e487cc8552377ce865bb
|
[
"MIT"
] | null | null | null |
//
// EventHandler.hpp
// Jogo-SFML
//
// Created by Matheus Kunnen Ledesma on 11/5/19.
// Copyright © 2019 Matheus Kunnen Ledesma. All rights reserved.
//
#ifndef EventHandler_hpp
#define EventHandler_hpp
#include "base_gui_includes.hpp"
namespace GUI {
namespace Events {
enum Type {CLICK, HOVER, ENABLED, DISABLED};
}
class EventHandler{
public:
// Constructor & Destructor
EventHandler();
virtual ~EventHandler();
// Methods
virtual void onGuiEvent(int id, Events::Type event_id) = 0;
};
}
#endif /* EventHandler_hpp */
| 18
| 65
| 0.695341
|
MatheusKunnen
|
853d0f79142828a35817ae677b9c4030ca469793
| 464
|
cpp
|
C++
|
src/keycreate/keycreate.cpp
|
fusor-io/fusor-state-machine
|
d52f96e7067aecb19088c9d59c57bdb7cba55504
|
[
"MIT"
] | null | null | null |
src/keycreate/keycreate.cpp
|
fusor-io/fusor-state-machine
|
d52f96e7067aecb19088c9d59c57bdb7cba55504
|
[
"MIT"
] | null | null | null |
src/keycreate/keycreate.cpp
|
fusor-io/fusor-state-machine
|
d52f96e7067aecb19088c9d59c57bdb7cba55504
|
[
"MIT"
] | null | null | null |
#include <string.h>
#include "keycreate.h"
char *KeyCreate::withScope(const char *scopeId, const char *name)
{
strncpy(_buffer, scopeId, MAX_VAR_NAME_LEN - 1);
strncat(_buffer, ".", MAX_VAR_NAME_LEN - strlen(_buffer) - 1);
strncat(_buffer, name, MAX_VAR_NAME_LEN - strlen(_buffer) - 1);
return _buffer;
}
const char *KeyCreate::createKey(const char *name)
{
char *buff = new char[strlen(name) + 1];
strcpy(buff, name);
return buff;
}
| 25.777778
| 67
| 0.678879
|
fusor-io
|
853dbabe78b9ceecae2a677a0eb27a9898be5720
| 4,351
|
tcc
|
C++
|
libraries/model/test/tcc/ModelMaker.tcc
|
Dream-maerD/ELL-master
|
9554afa876cc9e8e87529df3f3d99220abc711d6
|
[
"MIT"
] | 1
|
2018-11-08T06:19:31.000Z
|
2018-11-08T06:19:31.000Z
|
libraries/model/test/tcc/ModelMaker.tcc
|
vishnoitanuj/ELL
|
993d5370f0f7a274e8dfd8f43220c792be46f314
|
[
"MIT"
] | null | null | null |
libraries/model/test/tcc/ModelMaker.tcc
|
vishnoitanuj/ELL
|
993d5370f0f7a274e8dfd8f43220c792be46f314
|
[
"MIT"
] | 1
|
2019-12-19T10:02:48.000Z
|
2019-12-19T10:02:48.000Z
|
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Project: Embedded Learning Library (ELL)
// File: ModelMaker.tcc (compile_test)
// Authors: Umesh Madan, Chuck Jacobs
//
////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace ell;
template <typename T>
model::InputNode<T>* ModelMaker::Inputs(size_t count)
{
return _model.AddNode<model::InputNode<T>>(count);
}
template <typename T>
model::InputNode<T>* ModelMaker::Inputs(std::vector<T>& values)
{
auto node = Inputs<T>(values.size());
node->SetInput(values);
return node;
}
template <typename T>
model::OutputNode<T>* ModelMaker::Outputs(const model::OutputPort<T>& x)
{
return _model.AddNode<model::OutputNode<T>>(x);
}
template <typename T>
nodes::BinaryOperationNode<T>* ModelMaker::Add(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryOperationNode<T>>(x, y, emitters::BinaryOperationType::add);
}
template <typename T>
nodes::BinaryOperationNode<T>* ModelMaker::Subtract(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryOperationNode<T>>(x, y, emitters::BinaryOperationType::subtract);
}
template <typename T>
nodes::BinaryOperationNode<T>* ModelMaker::Multiply(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryOperationNode<T>>(x, y, emitters::BinaryOperationType::coordinatewiseMultiply);
}
template <typename T>
nodes::BinaryOperationNode<T>* ModelMaker::Divide(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryOperationNode<T>>(x, y, emitters::BinaryOperationType::coordinatewiseDivide);
}
template <typename T>
nodes::DotProductNode<T>* ModelMaker::DotProduct(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::DotProductNode<T>>(x, y);
}
template <typename T>
nodes::BinaryPredicateNode<T>* ModelMaker::Equals(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryPredicateNode<T>>(x, y, emitters::BinaryPredicateType::equal);
}
template <typename T>
nodes::BinaryPredicateNode<T>* ModelMaker::Lt(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryPredicateNode<T>>(x, y, emitters::BinaryPredicateType::less);
}
template <typename T>
nodes::BinaryPredicateNode<T>* ModelMaker::Gt(const model::OutputPort<T>& x, const model::OutputPort<T>& y)
{
return _model.AddNode<nodes::BinaryPredicateNode<T>>(x, y, emitters::BinaryPredicateType::greater);
}
template <typename T, typename S>
nodes::MultiplexerNode<T, S>* ModelMaker::Select(const model::OutputPort<T>& elts, const model::OutputPort<S>& selector)
{
auto node = _model.AddNode<nodes::MultiplexerNode<T, S>>(elts, selector);
return node;
}
template <typename T>
nodes::UnaryOperationNode<T>* ModelMaker::Sqrt(const model::OutputPort<T>& x)
{
return _model.AddNode<nodes::UnaryOperationNode<T>>(x, emitters::UnaryOperationType::sqrt);
}
template <typename T>
nodes::SumNode<T>* ModelMaker::Sum(const model::OutputPort<T>& x)
{
return _model.AddNode<nodes::SumNode<T>>(x);
}
template <typename T>
nodes::DelayNode<T>* ModelMaker::Delay(const model::OutputPort<T>& x, size_t windowSize)
{
return _model.AddNode<nodes::DelayNode<T>>(x, windowSize);
}
template <typename T>
nodes::AccumulatorNode<T>* ModelMaker::Accumulate(const model::OutputPort<T>& x)
{
return _model.AddNode<nodes::AccumulatorNode<T>>(x);
}
template <typename T>
nodes::ConstantNode<T>* ModelMaker::Constant(const T value)
{
return _model.AddNode<nodes::ConstantNode<T>>(value);
}
template <typename T>
nodes::ConstantNode<T>* ModelMaker::Constant(const std::vector<T>& values)
{
auto* pNode = _model.AddNode<nodes::ConstantNode<T>>(values);
// Work around a bug. Make sure literal values are propagated to outputs
_model.ComputeOutput<T>(pNode->output);
return pNode;
}
template <typename T>
model::OutputPort<T>* ModelMaker::GetOutputPort(model::Node* pNode, size_t portIndex)
{
auto pPort = pNode->GetOutputPorts()[portIndex];
return static_cast<model::OutputPort<T>*>(pPort);
}
| 33.21374
| 120
| 0.695702
|
Dream-maerD
|
8547fcd6076b24448a7bec1e939241764501064f
| 2,097
|
cpp
|
C++
|
rendering/Pipeline.cpp
|
broecker/gfx1993
|
d0390cdf6bd7b864dd86c99fa4d79cb31c00fa2f
|
[
"MIT"
] | null | null | null |
rendering/Pipeline.cpp
|
broecker/gfx1993
|
d0390cdf6bd7b864dd86c99fa4d79cb31c00fa2f
|
[
"MIT"
] | null | null | null |
rendering/Pipeline.cpp
|
broecker/gfx1993
|
d0390cdf6bd7b864dd86c99fa4d79cb31c00fa2f
|
[
"MIT"
] | null | null | null |
#include "Pipeline.h"
#include <glm/glm.hpp>
using glm::vec4;
namespace render {
VertexOut &&lerp(const VertexOut &a, const VertexOut &b, float d) {
VertexOut result;
result.clipPosition = glm::mix(a.clipPosition, b.clipPosition, d);
result.worldPosition = glm::mix(a.worldPosition, b.worldPosition, d);
result.worldNormal = glm::mix(a.worldNormal, b.worldNormal, d);
result.color = glm::mix(a.color, b.color, d);
result.texcoord = glm::mix(a.texcoord, b.texcoord, d);
return std::move(result);
}
ShadingGeometry &&interpolate(const ShadingGeometry &a,
const ShadingGeometry &b, float d) {
ShadingGeometry result;
result.position = mix(a.position, b.position, d);
result.normal = normalize(mix(a.normal, b.normal, d));
result.color = mix(a.color, b.color, d);
result.windowCoord = mix(a.windowCoord, b.windowCoord, d);
return std::move(result);
}
ShadingGeometry &&PointPrimitive::rasterize() const {
ShadingGeometry result;
result.position = p.worldPosition;
result.normal = p.worldNormal;
result.color = p.color;
result.texcoord = p.texcoord;
return std::move(result);
}
ShadingGeometry &&LinePrimitive::rasterize(float d) const {
ShadingGeometry result;
result.position = mix(a.worldPosition, b.worldPosition, d);
result.normal = normalize(mix(a.worldNormal, b.worldNormal, d));
result.color = mix(a.color, b.color, d);
result.texcoord = mix(a.texcoord, b.texcoord, d);
return std::move(result);
}
ShadingGeometry &&TrianglePrimitive::rasterize(const glm::vec3 &bary) const {
float bsum = bary.x + bary.y + bary.z;
ShadingGeometry sgeo;
sgeo.position = a.worldPosition * bary.x + b.worldPosition * bary.y +
c.worldPosition * bary.z / bsum;
sgeo.normal = a.worldNormal * bary.x + b.worldNormal * bary.y +
c.worldNormal * bary.z / bsum;
sgeo.color = a.color * bary.x + b.color * bary.y + c.color * bary.z / bsum;
sgeo.texcoord =
a.texcoord * bary.x + b.texcoord * bary.y + c.texcoord * bary.z / bsum;
return std::move(sgeo);
}
} // namespace render
| 32.261538
| 77
| 0.679542
|
broecker
|
854e2d0eada09c5c96b778e9d74865f6e0a55284
| 848
|
cpp
|
C++
|
Source/MapEditorModule/DetailsCustomisation/MapActorDetailCustomization.cpp
|
benoitestival/MapModuleEditor
|
3a7d72d0dc3761bd61f19df1e5af46081a791356
|
[
"MIT"
] | null | null | null |
Source/MapEditorModule/DetailsCustomisation/MapActorDetailCustomization.cpp
|
benoitestival/MapModuleEditor
|
3a7d72d0dc3761bd61f19df1e5af46081a791356
|
[
"MIT"
] | null | null | null |
Source/MapEditorModule/DetailsCustomisation/MapActorDetailCustomization.cpp
|
benoitestival/MapModuleEditor
|
3a7d72d0dc3761bd61f19df1e5af46081a791356
|
[
"MIT"
] | 1
|
2021-07-07T09:22:28.000Z
|
2021-07-07T09:22:28.000Z
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "MapActorDetailCustomization.h"
#include "Editor/PropertyEditor/Public/PropertyEditorModule.h"
#include "MapGenerator/MapActor.h"
#include "Modules/ModuleManager.h"
TSharedRef<IDetailCustomization> MapActorDetailCustomization::MakeInstance() {
return MakeShareable(new MapActorDetailCustomization);
}
void MapActorDetailCustomization::RegisterDetailsCustomization() {
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomClassLayout("MapActor", FOnGetDetailCustomizationInstance::CreateStatic(&MapActorDetailCustomization::MakeInstance));
}
void MapActorDetailCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) {
//TODO
//AMapActor*
}
| 33.92
| 147
| 0.837264
|
benoitestival
|
8556297f0b4422ad12dc45a3b3f36a85b70e6142
| 801
|
hpp
|
C++
|
lib/index.hpp
|
cirossmonteiro/tensor
|
6ece78825535188fba6dbe62ae4be0521381c026
|
[
"Unlicense"
] | 1
|
2019-03-31T05:23:20.000Z
|
2019-03-31T05:23:20.000Z
|
lib/index.hpp
|
cirossmonteiro/tensor
|
6ece78825535188fba6dbe62ae4be0521381c026
|
[
"Unlicense"
] | null | null | null |
lib/index.hpp
|
cirossmonteiro/tensor
|
6ece78825535188fba6dbe62ae4be0521381c026
|
[
"Unlicense"
] | null | null | null |
#pragma once
#ifndef INDEX_HPP
#define INDEX_HPP
#include <cstddef>
#include <iostream>
using namespace std;
class Index {
unsigned int size = 0;
unsigned int *values = NULL;
public:
~Index(); // done
Index(); // to do
Index(unsigned int new_size); // done
Index(unsigned int new_size, unsigned int *new_values); // done
Index(Index &index); // done
void check_internals() const;
// void copy(Index &new_index); // done
unsigned int get_size(); // done
unsigned int *get_values();
unsigned int &operator[](int index) const; // done
friend string &operator<<(string &ac, Index &index);// done
friend ostream &operator<<(ostream& out, Index &index);// done
void print(); // done
string get_string(); // done
void set_zero();
};
#endif
| 26.7
| 67
| 0.649189
|
cirossmonteiro
|
85563c3c4cf38752082c149c6ad400bbc57b34db
| 11,166
|
hpp
|
C++
|
src/mirrage/utils/include/mirrage/utils/ranges.hpp
|
lowkey42/mirrage
|
2527537989a548062d0bbca8370d063fc6b81a18
|
[
"MIT"
] | 14
|
2017-10-26T08:45:54.000Z
|
2021-04-06T11:44:17.000Z
|
src/mirrage/utils/include/mirrage/utils/ranges.hpp
|
lowkey42/mirrage
|
2527537989a548062d0bbca8370d063fc6b81a18
|
[
"MIT"
] | 17
|
2017-10-09T20:11:58.000Z
|
2018-11-08T22:05:14.000Z
|
src/mirrage/utils/include/mirrage/utils/ranges.hpp
|
lowkey42/mirrage
|
2527537989a548062d0bbca8370d063fc6b81a18
|
[
"MIT"
] | 1
|
2018-09-26T23:10:06.000Z
|
2018-09-26T23:10:06.000Z
|
/** simple wrappers for iterator pairs ***************************************
* *
* Copyright (c) 2018 Florian Oetke *
* This file is distributed under the MIT License *
* See LICENSE file for details. *
\*****************************************************************************/
#pragma once
#include <tuple>
#include <utility>
#include <vector>
namespace mirrage::util {
template <class Iter>
class iter_range {
public:
iter_range() noexcept {}
iter_range(Iter begin, Iter end) noexcept : b(begin), e(end) {}
bool operator==(const iter_range& o) noexcept { return b == o.b && e == o.e; }
Iter begin() const noexcept { return b; }
Iter end() const noexcept { return e; }
std::size_t size() const noexcept { return std::distance(b, e); }
private:
Iter b, e;
};
template <class T>
using vector_range = iter_range<typename std::vector<T>::iterator>;
template <class T>
using cvector_range = iter_range<typename std::vector<T>::const_iterator>;
template <class Range>
class skip_range {
public:
skip_range() noexcept {}
skip_range(std::size_t skip, Range range) noexcept : _skip(skip), _range(std::move(range)) {}
bool operator==(const skip_range& o) noexcept { return _range == o._range; }
auto begin() const noexcept
{
auto i = _range.begin();
auto skipped = std::size_t(0);
while(i != _range.end() && skipped++ < _skip)
++i;
return i;
}
auto end() const noexcept { return _range.end(); }
std::size_t size() const noexcept
{
auto s = _range.size();
return s > _skip ? s - _skip : 0;
}
private:
std::size_t _skip;
Range _range;
};
template <class Range>
auto skip(std::size_t skip, Range&& range)
{
return skip_range<std::remove_reference_t<Range>>(skip, std::forward<Range>(range));
}
namespace detail {
struct deref_join {
template <class... Iter>
[[maybe_unused]] auto operator()(Iter&&... iter) const
{
return std::tuple<decltype(*iter)...>(*iter...);
}
};
template <typename T>
class proxy_holder {
public:
proxy_holder(const T& value) : value(value) {}
T* operator->() { return &value; }
T& operator*() { return value; }
private:
T value;
};
} // namespace detail
template <class... Iter>
class join_iterator {
public:
join_iterator() = default;
template <class... T>
join_iterator(std::size_t index, T&&... iters) : _iters(std::forward<T>(iters)...), _index(index)
{
}
auto operator==(const join_iterator& rhs) const { return _index == rhs._index; }
auto operator!=(const join_iterator& rhs) const { return !(*this == rhs); }
auto operator*() const { return std::apply(detail::deref_join{}, _iters); }
auto operator-> () const { return proxy_holder(**this); }
auto operator++()
{
foreach_in_tuple(_iters, [](auto, auto& iter) { ++iter; });
++_index;
}
auto operator++(int)
{
auto v = *this;
++*this;
return v;
}
private:
std::tuple<Iter...> _iters;
std::size_t _index;
};
namespace detail {
struct get_join_begin {
template <class... Range>
[[maybe_unused]] auto operator()(Range&&... ranges) const
{
return join_iterator<std::remove_reference_t<decltype(ranges.begin())>...>(0,
ranges.begin()...);
}
};
struct get_join_iterator {
template <class... Range>
[[maybe_unused]] auto operator()(std::size_t offset, Range&&... ranges) const
{
return join_iterator<std::remove_reference_t<decltype(ranges.begin())>...>(
offset, (ranges.begin() + offset)...);
}
};
} // namespace detail
template <class... Range>
class join_range {
public:
join_range() noexcept {}
template <class... T>
join_range(T&&... ranges) noexcept : _ranges(std::forward<T>(ranges)...), _size(min(ranges.size()...))
{
}
auto begin() const noexcept { return std::apply(detail::get_join_begin{}, _ranges); }
auto begin() noexcept { return std::apply(detail::get_join_begin{}, _ranges); }
auto end() const noexcept
{
return std::apply(detail::get_join_iterator{}, std::tuple_cat(std::make_tuple(_size), _ranges));
}
auto end() noexcept
{
return std::apply(detail::get_join_iterator{}, std::tuple_cat(std::make_tuple(_size), _ranges));
}
auto size() const noexcept { return _size; }
private:
std::tuple<Range...> _ranges;
std::size_t _size;
};
template <class... Range>
auto join(Range&&... range)
{
return join_range<std::remove_reference_t<Range>...>(std::forward<Range>(range)...);
}
namespace detail {
template <class Arg>
auto construct_index_tuple(std::int64_t index, Arg arg)
{
return std::tuple<std::int64_t, Arg>(index, arg);
}
template <class, class... Args>
auto construct_index_tuple(std::int64_t index, std::tuple<Args...> arg)
{
return std::tuple<std::int64_t, Args...>(index, std::get<Args>(arg)...);
}
template <class BaseIter>
class indexing_range_iterator {
public:
indexing_range_iterator(BaseIter&& iter, std::int64_t index) : iter(iter), index(index) {}
auto operator==(const indexing_range_iterator& rhs) const { return iter == rhs.iter; }
auto operator!=(const indexing_range_iterator& rhs) const { return !(*this == rhs); }
auto operator*() { return construct_index_tuple<decltype(*iter)>(index, *iter); }
auto operator-> () { return proxy_holder(**this); }
auto operator*() const { return construct_index_tuple<decltype(*iter)>(index, *iter); }
auto operator-> () const { return proxy_holder(**this); }
auto operator++()
{
++iter;
++index;
}
auto operator++(int)
{
auto v = *this;
++*this;
return v;
}
private:
BaseIter iter;
std::int64_t index;
};
template <class BaseIter>
auto make_indexing_range_iterator(BaseIter&& iter, std::int64_t index)
{
return indexing_range_iterator<std::remove_reference_t<BaseIter>>(std::forward<BaseIter>(iter),
index);
}
} // namespace detail
template <class Range>
class indexing_range {
public:
indexing_range(Range&& range) noexcept : range(std::move(range)) {}
bool operator==(const indexing_range& rhs) noexcept { return range == rhs.range; }
auto begin() noexcept { return detail::make_indexing_range_iterator(range.begin(), 0u); }
auto end() noexcept { return detail::make_indexing_range_iterator(range.end(), std::int64_t(-1)); }
auto begin() const noexcept { return detail::make_indexing_range_iterator(range.begin(), 0u); }
auto end() const noexcept
{
return detail::make_indexing_range_iterator(range.end(), std::int64_t(-1));
}
private:
Range range;
};
template <class Range>
auto with_index(Range&& r) -> indexing_range<std::remove_reference_t<Range>>
{
return {std::move(r)};
}
template <class Range>
class indexing_range_view {
public:
indexing_range_view(Range& range) noexcept : range(&range) {}
bool operator==(const indexing_range_view& rhs) noexcept { return *range == *rhs.range; }
auto begin() noexcept { return detail::make_indexing_range_iterator(range->begin(), 0u); }
auto end() noexcept { return detail::make_indexing_range_iterator(range->end(), std::int64_t(-1)); }
auto begin() const noexcept { return detail::make_indexing_range_iterator(range->begin(), 0u); }
auto end() const noexcept
{
return detail::make_indexing_range_iterator(range->end(), std::int64_t(-1));
}
private:
Range* range;
};
template <class Range>
auto with_index(Range& r) -> indexing_range_view<std::remove_reference_t<Range>>
{
return {r};
}
template <class T>
class numeric_range {
struct iterator {
using iterator_category = std::random_access_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using reference = T&;
T p;
T s;
constexpr iterator(T v, T s = 1) noexcept : p(v), s(s) {}
constexpr iterator(const iterator&) noexcept = default;
constexpr iterator(iterator&&) noexcept = default;
iterator& operator++() noexcept
{
p += s;
return *this;
}
iterator operator++(int) noexcept
{
auto t = *this;
*this ++;
return t;
}
iterator& operator--() noexcept
{
p -= s;
return *this;
}
iterator operator--(int) noexcept
{
auto t = *this;
*this --;
return t;
}
bool operator==(const iterator& rhs) const noexcept { return p == rhs.p; }
bool operator!=(const iterator& rhs) const noexcept { return p != rhs.p; }
const T& operator*() const noexcept { return p; }
};
using const_iterator = iterator;
public:
constexpr numeric_range() noexcept {}
constexpr numeric_range(T begin, T end, T step = 1) noexcept : b(begin), e(end), s(step) {}
constexpr numeric_range(numeric_range&&) noexcept = default;
constexpr numeric_range(const numeric_range&) noexcept = default;
numeric_range& operator=(const numeric_range&) noexcept = default;
numeric_range& operator=(numeric_range&&) noexcept = default;
bool operator==(const numeric_range& o) noexcept { return b == o.b && e == o.e; }
constexpr iterator begin() const noexcept { return b; }
constexpr iterator end() const noexcept { return e; }
private:
T b, e, s;
};
template <class Iter, typename = std::enable_if_t<!std::is_arithmetic<Iter>::value>>
constexpr iter_range<Iter> range(Iter b, Iter e)
{
return {b, e};
}
template <class B, class E, typename = std::enable_if_t<std::is_arithmetic<B>::value>>
constexpr auto range(B b, E e, std::common_type_t<B, E> s = 1)
{
using T = std::common_type_t<B, E>;
return numeric_range<T>{T(b), std::max(T(e + 1), T(b)), T(s)};
}
template <class T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
constexpr numeric_range<T> range(T num)
{
return {0, static_cast<T>(num)};
}
template <class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value>>
auto range(Container& c) -> iter_range<typename Container::iterator>
{
using namespace std;
return {begin(c), end(c)};
}
template <class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value>>
auto range(const Container& c) -> iter_range<typename Container::const_iterator>
{
using namespace std;
return {begin(c), end(c)};
}
template <class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value>>
auto range_reverse(Container& c) -> iter_range<typename Container::reverse_iterator>
{
using namespace std;
return {rbegin(c), rend(c)};
}
template <class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value>>
auto range_reverse(const Container& c) -> iter_range<typename Container::const_reverse_iterator>
{
using namespace std;
return {rbegin(c), rend(c)};
}
} // namespace mirrage::util
| 29.307087
| 104
| 0.632814
|
lowkey42
|
85575110e6688911bc96e810076916a6fe555a8c
| 149,018
|
cpp
|
C++
|
jni/lua/packages/easeactions.cpp
|
zchajax/WiEngine
|
ea2fa297f00aa5367bb5b819d6714ac84a8a8e25
|
[
"MIT"
] | 39
|
2015-01-23T10:01:31.000Z
|
2021-06-10T03:01:18.000Z
|
jni/lua/packages/easeactions.cpp
|
luckypen/WiEngine
|
7e80641fe15a77a2fc43db90f15dad6aa2c2860a
|
[
"MIT"
] | 1
|
2015-04-15T08:07:47.000Z
|
2015-04-15T08:07:47.000Z
|
jni/lua/packages/easeactions.cpp
|
luckypen/WiEngine
|
7e80641fe15a77a2fc43db90f15dad6aa2c2860a
|
[
"MIT"
] | 20
|
2015-01-20T07:36:10.000Z
|
2019-09-15T01:02:19.000Z
|
/*
** Lua binding: easeactions
** Generated automatically by tolua++-1.0.92 on Sat Jun 11 19:26:05 2011.
*/
#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"
#include "tolua++.h"
/* Exported function */
TOLUA_API int tolua_easeactions_open (lua_State* tolua_S);
#include "WiEngine.h"
/* function to release collected object via destructor */
#ifdef __cplusplus
static int tolua_collect_wyEaseBackInOut (lua_State* tolua_S)
{
wyEaseBackInOut* self = (wyEaseBackInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseSineIn (lua_State* tolua_S)
{
wyEaseSineIn* self = (wyEaseSineIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBounce (lua_State* tolua_S)
{
wyEaseBounce* self = (wyEaseBounce*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBounceInOut (lua_State* tolua_S)
{
wyEaseBounceInOut* self = (wyEaseBounceInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBackIn (lua_State* tolua_S)
{
wyEaseBackIn* self = (wyEaseBackIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseExponentialIn (lua_State* tolua_S)
{
wyEaseExponentialIn* self = (wyEaseExponentialIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseElastic (lua_State* tolua_S)
{
wyEaseElastic* self = (wyEaseElastic*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBackOut (lua_State* tolua_S)
{
wyEaseBackOut* self = (wyEaseBackOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBounceOut (lua_State* tolua_S)
{
wyEaseBounceOut* self = (wyEaseBounceOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseElasticIn (lua_State* tolua_S)
{
wyEaseElasticIn* self = (wyEaseElasticIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseSineOut (lua_State* tolua_S)
{
wyEaseSineOut* self = (wyEaseSineOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseElasticInOut (lua_State* tolua_S)
{
wyEaseElasticInOut* self = (wyEaseElasticInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseRateAction (lua_State* tolua_S)
{
wyEaseRateAction* self = (wyEaseRateAction*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseAction (lua_State* tolua_S)
{
wyEaseAction* self = (wyEaseAction*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseSineInOut (lua_State* tolua_S)
{
wyEaseSineInOut* self = (wyEaseSineInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseOut (lua_State* tolua_S)
{
wyEaseOut* self = (wyEaseOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseIn (lua_State* tolua_S)
{
wyEaseIn* self = (wyEaseIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseBounceIn (lua_State* tolua_S)
{
wyEaseBounceIn* self = (wyEaseBounceIn*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseExponentialInOut (lua_State* tolua_S)
{
wyEaseExponentialInOut* self = (wyEaseExponentialInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseInOut (lua_State* tolua_S)
{
wyEaseInOut* self = (wyEaseInOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseExponentialOut (lua_State* tolua_S)
{
wyEaseExponentialOut* self = (wyEaseExponentialOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
static int tolua_collect_wyEaseElasticOut (lua_State* tolua_S)
{
wyEaseElasticOut* self = (wyEaseElasticOut*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
#endif
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
tolua_usertype(tolua_S,"wyAction");
tolua_usertype(tolua_S,"wyEaseSineIn");
tolua_usertype(tolua_S,"wyEaseBounce");
tolua_usertype(tolua_S,"wyEaseBounceInOut");
tolua_usertype(tolua_S,"wyEaseBackIn");
tolua_usertype(tolua_S,"wyEaseExponentialIn");
tolua_usertype(tolua_S,"wyEaseElastic");
tolua_usertype(tolua_S,"wyEaseBackOut");
tolua_usertype(tolua_S,"wyEaseBounceOut");
tolua_usertype(tolua_S,"wyEaseElasticIn");
tolua_usertype(tolua_S,"wyEaseSineOut");
tolua_usertype(tolua_S,"wyEaseElasticInOut");
tolua_usertype(tolua_S,"wyEaseExponentialInOut");
tolua_usertype(tolua_S,"wyIntervalAction");
tolua_usertype(tolua_S,"wyEaseRateAction");
tolua_usertype(tolua_S,"wyEaseOut");
tolua_usertype(tolua_S,"wyEaseAction");
tolua_usertype(tolua_S,"wyEaseSineInOut");
tolua_usertype(tolua_S,"wyEaseIn");
tolua_usertype(tolua_S,"wyEaseExponentialOut");
tolua_usertype(tolua_S,"wyEaseBounceIn");
tolua_usertype(tolua_S,"wyNode");
tolua_usertype(tolua_S,"wyEaseInOut");
tolua_usertype(tolua_S,"wyEaseElasticOut");
tolua_usertype(tolua_S,"wyEaseBackInOut");
}
/* method: new of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_new00
static int tolua_easeactions_wyEaseAction_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseAction* tolua_ret = (wyEaseAction*) Mtolua_new((wyEaseAction)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_new00_local
static int tolua_easeactions_wyEaseAction_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseAction* tolua_ret = (wyEaseAction*) Mtolua_new((wyEaseAction)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseAction");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_delete00
static int tolua_easeactions_wyEaseAction_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseAction* self = (wyEaseAction*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: start of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_start00
static int tolua_easeactions_wyEaseAction_start00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyNode",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseAction* self = (wyEaseAction*) tolua_tousertype(tolua_S,1,0);
wyNode* target = ((wyNode*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'start'", NULL);
#endif
{
self->start(target);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'start'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: stop of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_stop00
static int tolua_easeactions_wyEaseAction_stop00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseAction* self = (wyEaseAction*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'stop'", NULL);
#endif
{
self->stop();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'stop'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: setWrappedAction of class wyEaseAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseAction_setWrappedAction00
static int tolua_easeactions_wyEaseAction_setWrappedAction00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseAction",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseAction* self = (wyEaseAction*) tolua_tousertype(tolua_S,1,0);
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setWrappedAction'", NULL);
#endif
{
self->setWrappedAction(wrapped);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'setWrappedAction'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_make00
static int tolua_easeactions_wyEaseBackIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackIn* tolua_ret = (wyEaseBackIn*) wyEaseBackIn::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_new00
static int tolua_easeactions_wyEaseBackIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackIn* tolua_ret = (wyEaseBackIn*) Mtolua_new((wyEaseBackIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_new00_local
static int tolua_easeactions_wyEaseBackIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackIn* tolua_ret = (wyEaseBackIn*) Mtolua_new((wyEaseBackIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_delete00
static int tolua_easeactions_wyEaseBackIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackIn* self = (wyEaseBackIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_copy00
static int tolua_easeactions_wyEaseBackIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackIn* self = (wyEaseBackIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_reverse00
static int tolua_easeactions_wyEaseBackIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackIn* self = (wyEaseBackIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBackIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackIn_update00
static int tolua_easeactions_wyEaseBackIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackIn* self = (wyEaseBackIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_make00
static int tolua_easeactions_wyEaseBackInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackInOut* tolua_ret = (wyEaseBackInOut*) wyEaseBackInOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_new00
static int tolua_easeactions_wyEaseBackInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackInOut* tolua_ret = (wyEaseBackInOut*) Mtolua_new((wyEaseBackInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_new00_local
static int tolua_easeactions_wyEaseBackInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackInOut* tolua_ret = (wyEaseBackInOut*) Mtolua_new((wyEaseBackInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_delete00
static int tolua_easeactions_wyEaseBackInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackInOut* self = (wyEaseBackInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_copy00
static int tolua_easeactions_wyEaseBackInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackInOut* self = (wyEaseBackInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_reverse00
static int tolua_easeactions_wyEaseBackInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackInOut* self = (wyEaseBackInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBackInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackInOut_update00
static int tolua_easeactions_wyEaseBackInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackInOut* self = (wyEaseBackInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_make00
static int tolua_easeactions_wyEaseBackOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackOut* tolua_ret = (wyEaseBackOut*) wyEaseBackOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_new00
static int tolua_easeactions_wyEaseBackOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackOut* tolua_ret = (wyEaseBackOut*) Mtolua_new((wyEaseBackOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_new00_local
static int tolua_easeactions_wyEaseBackOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBackOut* tolua_ret = (wyEaseBackOut*) Mtolua_new((wyEaseBackOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBackOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_delete00
static int tolua_easeactions_wyEaseBackOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackOut* self = (wyEaseBackOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_copy00
static int tolua_easeactions_wyEaseBackOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackOut* self = (wyEaseBackOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_reverse00
static int tolua_easeactions_wyEaseBackOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackOut* self = (wyEaseBackOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBackOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBackOut_update00
static int tolua_easeactions_wyEaseBackOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBackOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBackOut* self = (wyEaseBackOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBounce */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounce_new00
static int tolua_easeactions_wyEaseBounce_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounce",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,0));
{
wyEaseBounce* tolua_ret = (wyEaseBounce*) Mtolua_new((wyEaseBounce)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounce");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBounce */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounce_new00_local
static int tolua_easeactions_wyEaseBounce_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounce",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,0));
{
wyEaseBounce* tolua_ret = (wyEaseBounce*) Mtolua_new((wyEaseBounce)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounce");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBounce */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounce_delete00
static int tolua_easeactions_wyEaseBounce_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounce",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounce* self = (wyEaseBounce*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_make00
static int tolua_easeactions_wyEaseBounceIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceIn* tolua_ret = (wyEaseBounceIn*) wyEaseBounceIn::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_new00
static int tolua_easeactions_wyEaseBounceIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceIn* tolua_ret = (wyEaseBounceIn*) Mtolua_new((wyEaseBounceIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_new00_local
static int tolua_easeactions_wyEaseBounceIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceIn* tolua_ret = (wyEaseBounceIn*) Mtolua_new((wyEaseBounceIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_delete00
static int tolua_easeactions_wyEaseBounceIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceIn* self = (wyEaseBounceIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_copy00
static int tolua_easeactions_wyEaseBounceIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceIn* self = (wyEaseBounceIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_reverse00
static int tolua_easeactions_wyEaseBounceIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceIn* self = (wyEaseBounceIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBounceIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceIn_update00
static int tolua_easeactions_wyEaseBounceIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceIn* self = (wyEaseBounceIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_make00
static int tolua_easeactions_wyEaseBounceInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceInOut* tolua_ret = (wyEaseBounceInOut*) wyEaseBounceInOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_new00
static int tolua_easeactions_wyEaseBounceInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceInOut* tolua_ret = (wyEaseBounceInOut*) Mtolua_new((wyEaseBounceInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_new00_local
static int tolua_easeactions_wyEaseBounceInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceInOut* tolua_ret = (wyEaseBounceInOut*) Mtolua_new((wyEaseBounceInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_delete00
static int tolua_easeactions_wyEaseBounceInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceInOut* self = (wyEaseBounceInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_copy00
static int tolua_easeactions_wyEaseBounceInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceInOut* self = (wyEaseBounceInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_reverse00
static int tolua_easeactions_wyEaseBounceInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceInOut* self = (wyEaseBounceInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBounceInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceInOut_update00
static int tolua_easeactions_wyEaseBounceInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceInOut* self = (wyEaseBounceInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_make00
static int tolua_easeactions_wyEaseBounceOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceOut* tolua_ret = (wyEaseBounceOut*) wyEaseBounceOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_new00
static int tolua_easeactions_wyEaseBounceOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceOut* tolua_ret = (wyEaseBounceOut*) Mtolua_new((wyEaseBounceOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_new00_local
static int tolua_easeactions_wyEaseBounceOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseBounceOut* tolua_ret = (wyEaseBounceOut*) Mtolua_new((wyEaseBounceOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseBounceOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_delete00
static int tolua_easeactions_wyEaseBounceOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceOut* self = (wyEaseBounceOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_copy00
static int tolua_easeactions_wyEaseBounceOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceOut* self = (wyEaseBounceOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_reverse00
static int tolua_easeactions_wyEaseBounceOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceOut* self = (wyEaseBounceOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseBounceOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseBounceOut_update00
static int tolua_easeactions_wyEaseBounceOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseBounceOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseBounceOut* self = (wyEaseBounceOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseElastic */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElastic_new00
static int tolua_easeactions_wyEaseElastic_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElastic",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElastic* tolua_ret = (wyEaseElastic*) Mtolua_new((wyEaseElastic)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElastic");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseElastic */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElastic_new00_local
static int tolua_easeactions_wyEaseElastic_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElastic",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElastic* tolua_ret = (wyEaseElastic*) Mtolua_new((wyEaseElastic)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElastic");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseElastic */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElastic_delete00
static int tolua_easeactions_wyEaseElastic_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElastic",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElastic* self = (wyEaseElastic*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_make00
static int tolua_easeactions_wyEaseElasticIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticIn* tolua_ret = (wyEaseElasticIn*) wyEaseElasticIn::make(period,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_new00
static int tolua_easeactions_wyEaseElasticIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticIn* tolua_ret = (wyEaseElasticIn*) Mtolua_new((wyEaseElasticIn)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_new00_local
static int tolua_easeactions_wyEaseElasticIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticIn* tolua_ret = (wyEaseElasticIn*) Mtolua_new((wyEaseElasticIn)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_delete00
static int tolua_easeactions_wyEaseElasticIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticIn* self = (wyEaseElasticIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_copy00
static int tolua_easeactions_wyEaseElasticIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticIn* self = (wyEaseElasticIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_reverse00
static int tolua_easeactions_wyEaseElasticIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticIn* self = (wyEaseElasticIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseElasticIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticIn_update00
static int tolua_easeactions_wyEaseElasticIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticIn* self = (wyEaseElasticIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_make00
static int tolua_easeactions_wyEaseElasticInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticInOut* tolua_ret = (wyEaseElasticInOut*) wyEaseElasticInOut::make(period,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_new00
static int tolua_easeactions_wyEaseElasticInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticInOut* tolua_ret = (wyEaseElasticInOut*) Mtolua_new((wyEaseElasticInOut)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_new00_local
static int tolua_easeactions_wyEaseElasticInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticInOut* tolua_ret = (wyEaseElasticInOut*) Mtolua_new((wyEaseElasticInOut)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_delete00
static int tolua_easeactions_wyEaseElasticInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticInOut* self = (wyEaseElasticInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_copy00
static int tolua_easeactions_wyEaseElasticInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticInOut* self = (wyEaseElasticInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_reverse00
static int tolua_easeactions_wyEaseElasticInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticInOut* self = (wyEaseElasticInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseElasticInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticInOut_update00
static int tolua_easeactions_wyEaseElasticInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticInOut* self = (wyEaseElasticInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_make00
static int tolua_easeactions_wyEaseElasticOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticOut* tolua_ret = (wyEaseElasticOut*) wyEaseElasticOut::make(period,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_new00
static int tolua_easeactions_wyEaseElasticOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticOut* tolua_ret = (wyEaseElasticOut*) Mtolua_new((wyEaseElasticOut)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_new00_local
static int tolua_easeactions_wyEaseElasticOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float period = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseElasticOut* tolua_ret = (wyEaseElasticOut*) Mtolua_new((wyEaseElasticOut)(period,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseElasticOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_delete00
static int tolua_easeactions_wyEaseElasticOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticOut* self = (wyEaseElasticOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_copy00
static int tolua_easeactions_wyEaseElasticOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticOut* self = (wyEaseElasticOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_reverse00
static int tolua_easeactions_wyEaseElasticOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticOut* self = (wyEaseElasticOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseElasticOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseElasticOut_update00
static int tolua_easeactions_wyEaseElasticOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseElasticOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseElasticOut* self = (wyEaseElasticOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_make00
static int tolua_easeactions_wyEaseExponentialIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialIn* tolua_ret = (wyEaseExponentialIn*) wyEaseExponentialIn::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_new00
static int tolua_easeactions_wyEaseExponentialIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialIn* tolua_ret = (wyEaseExponentialIn*) Mtolua_new((wyEaseExponentialIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_new00_local
static int tolua_easeactions_wyEaseExponentialIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialIn* tolua_ret = (wyEaseExponentialIn*) Mtolua_new((wyEaseExponentialIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_delete00
static int tolua_easeactions_wyEaseExponentialIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialIn* self = (wyEaseExponentialIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_copy00
static int tolua_easeactions_wyEaseExponentialIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialIn* self = (wyEaseExponentialIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_reverse00
static int tolua_easeactions_wyEaseExponentialIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialIn* self = (wyEaseExponentialIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseExponentialIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialIn_update00
static int tolua_easeactions_wyEaseExponentialIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialIn* self = (wyEaseExponentialIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_make00
static int tolua_easeactions_wyEaseExponentialInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialInOut* tolua_ret = (wyEaseExponentialInOut*) wyEaseExponentialInOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_new00
static int tolua_easeactions_wyEaseExponentialInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialInOut* tolua_ret = (wyEaseExponentialInOut*) Mtolua_new((wyEaseExponentialInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_new00_local
static int tolua_easeactions_wyEaseExponentialInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialInOut* tolua_ret = (wyEaseExponentialInOut*) Mtolua_new((wyEaseExponentialInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_delete00
static int tolua_easeactions_wyEaseExponentialInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialInOut* self = (wyEaseExponentialInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_copy00
static int tolua_easeactions_wyEaseExponentialInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialInOut* self = (wyEaseExponentialInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_reverse00
static int tolua_easeactions_wyEaseExponentialInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialInOut* self = (wyEaseExponentialInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseExponentialInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialInOut_update00
static int tolua_easeactions_wyEaseExponentialInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialInOut* self = (wyEaseExponentialInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_make00
static int tolua_easeactions_wyEaseExponentialOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialOut* tolua_ret = (wyEaseExponentialOut*) wyEaseExponentialOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_new00
static int tolua_easeactions_wyEaseExponentialOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialOut* tolua_ret = (wyEaseExponentialOut*) Mtolua_new((wyEaseExponentialOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_new00_local
static int tolua_easeactions_wyEaseExponentialOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseExponentialOut* tolua_ret = (wyEaseExponentialOut*) Mtolua_new((wyEaseExponentialOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseExponentialOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_delete00
static int tolua_easeactions_wyEaseExponentialOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialOut* self = (wyEaseExponentialOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_copy00
static int tolua_easeactions_wyEaseExponentialOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialOut* self = (wyEaseExponentialOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_reverse00
static int tolua_easeactions_wyEaseExponentialOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialOut* self = (wyEaseExponentialOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseExponentialOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseExponentialOut_update00
static int tolua_easeactions_wyEaseExponentialOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseExponentialOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseExponentialOut* self = (wyEaseExponentialOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_make00
static int tolua_easeactions_wyEaseIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseIn* tolua_ret = (wyEaseIn*) wyEaseIn::make(rate,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_new00
static int tolua_easeactions_wyEaseIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseIn* tolua_ret = (wyEaseIn*) Mtolua_new((wyEaseIn)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_new00_local
static int tolua_easeactions_wyEaseIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseIn* tolua_ret = (wyEaseIn*) Mtolua_new((wyEaseIn)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_delete00
static int tolua_easeactions_wyEaseIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseIn* self = (wyEaseIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_copy00
static int tolua_easeactions_wyEaseIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseIn* self = (wyEaseIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_reverse00
static int tolua_easeactions_wyEaseIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseIn* self = (wyEaseIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseIn_update00
static int tolua_easeactions_wyEaseIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseIn* self = (wyEaseIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_make00
static int tolua_easeactions_wyEaseInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseInOut* tolua_ret = (wyEaseInOut*) wyEaseInOut::make(rate,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_new00
static int tolua_easeactions_wyEaseInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseInOut* tolua_ret = (wyEaseInOut*) Mtolua_new((wyEaseInOut)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_new00_local
static int tolua_easeactions_wyEaseInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseInOut* tolua_ret = (wyEaseInOut*) Mtolua_new((wyEaseInOut)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_delete00
static int tolua_easeactions_wyEaseInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseInOut* self = (wyEaseInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_copy00
static int tolua_easeactions_wyEaseInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseInOut* self = (wyEaseInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_reverse00
static int tolua_easeactions_wyEaseInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseInOut* self = (wyEaseInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseInOut_update00
static int tolua_easeactions_wyEaseInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseInOut* self = (wyEaseInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_make00
static int tolua_easeactions_wyEaseOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseOut* tolua_ret = (wyEaseOut*) wyEaseOut::make(rate,wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_new00
static int tolua_easeactions_wyEaseOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseOut* tolua_ret = (wyEaseOut*) Mtolua_new((wyEaseOut)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_new00_local
static int tolua_easeactions_wyEaseOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseOut* tolua_ret = (wyEaseOut*) Mtolua_new((wyEaseOut)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_delete00
static int tolua_easeactions_wyEaseOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseOut* self = (wyEaseOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_copy00
static int tolua_easeactions_wyEaseOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseOut* self = (wyEaseOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_reverse00
static int tolua_easeactions_wyEaseOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseOut* self = (wyEaseOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseOut_update00
static int tolua_easeactions_wyEaseOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseOut* self = (wyEaseOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseRateAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseRateAction_new00
static int tolua_easeactions_wyEaseRateAction_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseRateAction",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseRateAction* tolua_ret = (wyEaseRateAction*) Mtolua_new((wyEaseRateAction)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseRateAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseRateAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseRateAction_new00_local
static int tolua_easeactions_wyEaseRateAction_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseRateAction",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
float rate = ((float) tolua_tonumber(tolua_S,2,0));
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,3,NULL));
{
wyEaseRateAction* tolua_ret = (wyEaseRateAction*) Mtolua_new((wyEaseRateAction)(rate,wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseRateAction");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseRateAction */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseRateAction_delete00
static int tolua_easeactions_wyEaseRateAction_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseRateAction",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseRateAction* self = (wyEaseRateAction*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_make00
static int tolua_easeactions_wyEaseSineIn_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineIn* tolua_ret = (wyEaseSineIn*) wyEaseSineIn::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_new00
static int tolua_easeactions_wyEaseSineIn_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineIn* tolua_ret = (wyEaseSineIn*) Mtolua_new((wyEaseSineIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineIn");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_new00_local
static int tolua_easeactions_wyEaseSineIn_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineIn* tolua_ret = (wyEaseSineIn*) Mtolua_new((wyEaseSineIn)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineIn");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_delete00
static int tolua_easeactions_wyEaseSineIn_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineIn* self = (wyEaseSineIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_copy00
static int tolua_easeactions_wyEaseSineIn_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineIn* self = (wyEaseSineIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_reverse00
static int tolua_easeactions_wyEaseSineIn_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineIn* self = (wyEaseSineIn*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseSineIn */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineIn_update00
static int tolua_easeactions_wyEaseSineIn_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineIn",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineIn* self = (wyEaseSineIn*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_make00
static int tolua_easeactions_wyEaseSineInOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineInOut* tolua_ret = (wyEaseSineInOut*) wyEaseSineInOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_new00
static int tolua_easeactions_wyEaseSineInOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineInOut* tolua_ret = (wyEaseSineInOut*) Mtolua_new((wyEaseSineInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineInOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_new00_local
static int tolua_easeactions_wyEaseSineInOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineInOut* tolua_ret = (wyEaseSineInOut*) Mtolua_new((wyEaseSineInOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineInOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_delete00
static int tolua_easeactions_wyEaseSineInOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineInOut* self = (wyEaseSineInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_copy00
static int tolua_easeactions_wyEaseSineInOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineInOut* self = (wyEaseSineInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_reverse00
static int tolua_easeactions_wyEaseSineInOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineInOut* self = (wyEaseSineInOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseSineInOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineInOut_update00
static int tolua_easeactions_wyEaseSineInOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineInOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineInOut* self = (wyEaseSineInOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: make of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_make00
static int tolua_easeactions_wyEaseSineOut_make00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineOut* tolua_ret = (wyEaseSineOut*) wyEaseSineOut::make(wrapped);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'make'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_new00
static int tolua_easeactions_wyEaseSineOut_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineOut* tolua_ret = (wyEaseSineOut*) Mtolua_new((wyEaseSineOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineOut");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: new_local of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_new00_local
static int tolua_easeactions_wyEaseSineOut_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isusertype(tolua_S,2,"wyIntervalAction",1,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyIntervalAction* wrapped = ((wyIntervalAction*) tolua_tousertype(tolua_S,2,NULL));
{
wyEaseSineOut* tolua_ret = (wyEaseSineOut*) Mtolua_new((wyEaseSineOut)(wrapped));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyEaseSineOut");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: delete of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_delete00
static int tolua_easeactions_wyEaseSineOut_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineOut* self = (wyEaseSineOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: copy of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_copy00
static int tolua_easeactions_wyEaseSineOut_copy00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineOut* self = (wyEaseSineOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'copy'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->copy();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'copy'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: reverse of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_reverse00
static int tolua_easeactions_wyEaseSineOut_reverse00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineOut* self = (wyEaseSineOut*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'reverse'", NULL);
#endif
{
wyAction* tolua_ret = (wyAction*) self->reverse();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"wyAction");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'reverse'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: update of class wyEaseSineOut */
#ifndef TOLUA_DISABLE_tolua_easeactions_wyEaseSineOut_update00
static int tolua_easeactions_wyEaseSineOut_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"wyEaseSineOut",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
wyEaseSineOut* self = (wyEaseSineOut*) tolua_tousertype(tolua_S,1,0);
float t = ((float) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update(t);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* Open function */
TOLUA_API int tolua_easeactions_open (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,NULL,0);
tolua_beginmodule(tolua_S,NULL);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseAction","wyEaseAction","wyIntervalAction",tolua_collect_wyEaseAction);
#else
tolua_cclass(tolua_S,"wyEaseAction","wyEaseAction","wyIntervalAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseAction");
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseAction_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseAction_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseAction_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseAction_delete00);
tolua_function(tolua_S,"start",tolua_easeactions_wyEaseAction_start00);
tolua_function(tolua_S,"stop",tolua_easeactions_wyEaseAction_stop00);
tolua_function(tolua_S,"setWrappedAction",tolua_easeactions_wyEaseAction_setWrappedAction00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBackIn","wyEaseBackIn","wyEaseAction",tolua_collect_wyEaseBackIn);
#else
tolua_cclass(tolua_S,"wyEaseBackIn","wyEaseBackIn","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBackIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBackIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBackIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBackIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBackIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBackIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBackIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBackIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBackIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBackInOut","wyEaseBackInOut","wyEaseAction",tolua_collect_wyEaseBackInOut);
#else
tolua_cclass(tolua_S,"wyEaseBackInOut","wyEaseBackInOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBackInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBackInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBackInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBackInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBackInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBackInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBackInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBackInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBackInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBackOut","wyEaseBackOut","wyEaseAction",tolua_collect_wyEaseBackOut);
#else
tolua_cclass(tolua_S,"wyEaseBackOut","wyEaseBackOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBackOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBackOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBackOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBackOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBackOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBackOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBackOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBackOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBackOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBounce","wyEaseBounce","wyEaseAction",tolua_collect_wyEaseBounce);
#else
tolua_cclass(tolua_S,"wyEaseBounce","wyEaseBounce","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBounce");
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBounce_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBounce_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBounce_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBounce_delete00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBounceIn","wyEaseBounceIn","wyEaseBounce",tolua_collect_wyEaseBounceIn);
#else
tolua_cclass(tolua_S,"wyEaseBounceIn","wyEaseBounceIn","wyEaseBounce",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBounceIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBounceIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBounceIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBounceIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBounceIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBounceIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBounceIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBounceIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBounceIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBounceInOut","wyEaseBounceInOut","wyEaseBounce",tolua_collect_wyEaseBounceInOut);
#else
tolua_cclass(tolua_S,"wyEaseBounceInOut","wyEaseBounceInOut","wyEaseBounce",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBounceInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBounceInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBounceInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBounceInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBounceInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBounceInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBounceInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBounceInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBounceInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseBounceOut","wyEaseBounceOut","wyEaseBounce",tolua_collect_wyEaseBounceOut);
#else
tolua_cclass(tolua_S,"wyEaseBounceOut","wyEaseBounceOut","wyEaseBounce",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseBounceOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseBounceOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseBounceOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseBounceOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseBounceOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseBounceOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseBounceOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseBounceOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseBounceOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseElastic","wyEaseElastic","wyEaseAction",tolua_collect_wyEaseElastic);
#else
tolua_cclass(tolua_S,"wyEaseElastic","wyEaseElastic","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseElastic");
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseElastic_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseElastic_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseElastic_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseElastic_delete00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseElasticIn","wyEaseElasticIn","wyEaseElastic",tolua_collect_wyEaseElasticIn);
#else
tolua_cclass(tolua_S,"wyEaseElasticIn","wyEaseElasticIn","wyEaseElastic",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseElasticIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseElasticIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseElasticIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseElasticIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseElasticIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseElasticIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseElasticIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseElasticIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseElasticIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseElasticInOut","wyEaseElasticInOut","wyEaseElastic",tolua_collect_wyEaseElasticInOut);
#else
tolua_cclass(tolua_S,"wyEaseElasticInOut","wyEaseElasticInOut","wyEaseElastic",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseElasticInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseElasticInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseElasticInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseElasticInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseElasticInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseElasticInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseElasticInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseElasticInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseElasticInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseElasticOut","wyEaseElasticOut","wyEaseElastic",tolua_collect_wyEaseElasticOut);
#else
tolua_cclass(tolua_S,"wyEaseElasticOut","wyEaseElasticOut","wyEaseElastic",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseElasticOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseElasticOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseElasticOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseElasticOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseElasticOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseElasticOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseElasticOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseElasticOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseElasticOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseExponentialIn","wyEaseExponentialIn","wyEaseAction",tolua_collect_wyEaseExponentialIn);
#else
tolua_cclass(tolua_S,"wyEaseExponentialIn","wyEaseExponentialIn","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseExponentialIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseExponentialIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseExponentialIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseExponentialIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseExponentialIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseExponentialIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseExponentialIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseExponentialIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseExponentialIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseExponentialInOut","wyEaseExponentialInOut","wyEaseAction",tolua_collect_wyEaseExponentialInOut);
#else
tolua_cclass(tolua_S,"wyEaseExponentialInOut","wyEaseExponentialInOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseExponentialInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseExponentialInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseExponentialInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseExponentialInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseExponentialInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseExponentialInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseExponentialInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseExponentialInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseExponentialInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseExponentialOut","wyEaseExponentialOut","wyEaseAction",tolua_collect_wyEaseExponentialOut);
#else
tolua_cclass(tolua_S,"wyEaseExponentialOut","wyEaseExponentialOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseExponentialOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseExponentialOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseExponentialOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseExponentialOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseExponentialOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseExponentialOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseExponentialOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseExponentialOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseExponentialOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseIn","wyEaseIn","wyEaseRateAction",tolua_collect_wyEaseIn);
#else
tolua_cclass(tolua_S,"wyEaseIn","wyEaseIn","wyEaseRateAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseInOut","wyEaseInOut","wyEaseRateAction",tolua_collect_wyEaseInOut);
#else
tolua_cclass(tolua_S,"wyEaseInOut","wyEaseInOut","wyEaseRateAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseOut","wyEaseOut","wyEaseRateAction",tolua_collect_wyEaseOut);
#else
tolua_cclass(tolua_S,"wyEaseOut","wyEaseOut","wyEaseRateAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseRateAction","wyEaseRateAction","wyEaseAction",tolua_collect_wyEaseRateAction);
#else
tolua_cclass(tolua_S,"wyEaseRateAction","wyEaseRateAction","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseRateAction");
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseRateAction_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseRateAction_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseRateAction_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseRateAction_delete00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseSineIn","wyEaseSineIn","wyEaseAction",tolua_collect_wyEaseSineIn);
#else
tolua_cclass(tolua_S,"wyEaseSineIn","wyEaseSineIn","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseSineIn");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseSineIn_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseSineIn_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseSineIn_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseSineIn_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseSineIn_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseSineIn_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseSineIn_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseSineIn_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseSineInOut","wyEaseSineInOut","wyEaseAction",tolua_collect_wyEaseSineInOut);
#else
tolua_cclass(tolua_S,"wyEaseSineInOut","wyEaseSineInOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseSineInOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseSineInOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseSineInOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseSineInOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseSineInOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseSineInOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseSineInOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseSineInOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseSineInOut_update00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"wyEaseSineOut","wyEaseSineOut","wyEaseAction",tolua_collect_wyEaseSineOut);
#else
tolua_cclass(tolua_S,"wyEaseSineOut","wyEaseSineOut","wyEaseAction",NULL);
#endif
tolua_beginmodule(tolua_S,"wyEaseSineOut");
tolua_function(tolua_S,"make",tolua_easeactions_wyEaseSineOut_make00);
tolua_function(tolua_S,"new",tolua_easeactions_wyEaseSineOut_new00);
tolua_function(tolua_S,"new_local",tolua_easeactions_wyEaseSineOut_new00_local);
tolua_function(tolua_S,".call",tolua_easeactions_wyEaseSineOut_new00_local);
tolua_function(tolua_S,"delete",tolua_easeactions_wyEaseSineOut_delete00);
tolua_function(tolua_S,"copy",tolua_easeactions_wyEaseSineOut_copy00);
tolua_function(tolua_S,"reverse",tolua_easeactions_wyEaseSineOut_reverse00);
tolua_function(tolua_S,"update",tolua_easeactions_wyEaseSineOut_update00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
TOLUA_API int luaopen_easeactions (lua_State* tolua_S) {
return tolua_easeactions_open(tolua_S);
};
#endif
| 30.110729
| 126
| 0.76535
|
zchajax
|
855a6cbddf47fbd3cfde60a54ae772f0997434e7
| 5,516
|
hpp
|
C++
|
library/src/main/jni/openslmediaplayer/include/oslmp/OpenSLMediaPlayerContext.hpp
|
cirnoftw/android-openslmediaplayer
|
6b363282dd0ac19bcb4e8ce52a4cb7bf35c58583
|
[
"Apache-2.0"
] | 435
|
2015-01-16T14:36:07.000Z
|
2022-02-11T02:32:19.000Z
|
library/src/main/jni/openslmediaplayer/include/oslmp/OpenSLMediaPlayerContext.hpp
|
cirnoftw/android-openslmediaplayer
|
6b363282dd0ac19bcb4e8ce52a4cb7bf35c58583
|
[
"Apache-2.0"
] | 59
|
2015-02-12T22:21:49.000Z
|
2021-06-16T11:48:15.000Z
|
library/src/main/jni/openslmediaplayer/include/oslmp/OpenSLMediaPlayerContext.hpp
|
cirnoftw/android-openslmediaplayer
|
6b363282dd0ac19bcb4e8ce52a4cb7bf35c58583
|
[
"Apache-2.0"
] | 104
|
2015-01-16T14:36:07.000Z
|
2021-05-24T03:32:54.000Z
|
//
// Copyright (C) 2014 Haruki Hasegawa
//
// 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 OPENSLMEDIAPLAYERCONTEXT_HPP_
#define OPENSLMEDIAPLAYERCONTEXT_HPP_
#include <jni.h> // for JNIEnv
#include <oslmp/OpenSLMediaPlayerAPICommon.hpp>
// constants
#define OSLMP_CONTEXT_OPTION_USE_BASSBOOST (1 << 0) // NOTE: low-latency playback is disabled if specified this option
#define OSLMP_CONTEXT_OPTION_USE_VIRTUALIZER (1 << 1) // NOTE: low-latency playback is disabled if specified this option
#define OSLMP_CONTEXT_OPTION_USE_EQUALIZER (1 << 2) // NOTE: low-latency playback is disabled if specified this option
#define OSLMP_CONTEXT_OPTION_USE_ENVIRONMENAL_REVERB \
(1 << 8) // NOTE: low-latency playback is disabled if specified this option
#define OSLMP_CONTEXT_OPTION_USE_PRESET_REVERB \
(1 << 9) // NOTE: low-latency playback is disabled if specified this option
#define OSLMP_CONTEXT_OPTION_USE_VISUALIZER (1 << 16)
#define OSLMP_CONTEXT_OPTION_USE_HQ_EQUALIZER (1 << 17)
#define OSLMP_CONTEXT_OPTION_USE_PREAMP (1 << 18)
#define OSLMP_CONTEXT_OPTION_USE_HQ_VISUALIZER (1 << 19)
// resampler quality specifier
#define OSLMP_CONTEXT_RESAMPLER_QUALITY_LOW 0
#define OSLMP_CONTEXT_RESAMPLER_QUALITY_MIDDLE 1
#define OSLMP_CONTEXT_RESAMPLER_QUALITY_HIGH 2
// HQEqualizer implementation type specifier
#define OSLMP_CONTEXT_HQ_EQUALIZER_IMPL_BASIC_PEAKING_FILTER 0
#define OSLMP_CONTEXT_HQ_EQUALIZER_IMPL_FLAT_GAIN_RESPONSE 1
// Sink backend implementation type specifier
#define OSLMP_CONTEXT_SINK_BACKEND_TYPE_OPENSL 0
#define OSLMP_CONTEXT_SINK_BACKEND_TYPE_AUDIO_TRACK 1
//
// forward declarations
//
namespace oslmp {
namespace impl {
class OpenSLMediaPlayerInternalContext;
} // namespace impl
} // namespace oslmp
namespace oslmp {
class OpenSLMediaPlayerContext : public virtual android::RefBase {
friend class impl::OpenSLMediaPlayerInternalContext;
public:
class InternalThreadEventListener;
struct create_args_t {
uint32_t system_out_sampling_rate; // [millihertz]
uint32_t system_out_frames_per_buffer; // [frames]
bool system_supports_low_latency;
bool system_supports_floating_point;
uint32_t options;
int stream_type;
uint32_t short_fade_duration; // Fade duration used to avoid audio artifacts (unit: [ms])
uint32_t long_fade_duration; // Fade duration used when calling start(), pause() and seek() (unit: [ms])
uint32_t resampler_quality;
uint32_t hq_equalizer_impl_type;
uint32_t sink_backend_type;
bool use_low_latency_if_available;
bool use_floating_point_if_available;
InternalThreadEventListener *listener;
create_args_t() OSLMP_API_ABI : system_out_sampling_rate(44100000),
system_out_frames_per_buffer(512),
system_supports_low_latency(false),
system_supports_floating_point(false),
options(0),
stream_type(3), // 3 = STREAM_MUSIC
short_fade_duration(25),
long_fade_duration(1500),
listener(nullptr),
resampler_quality(OSLMP_CONTEXT_RESAMPLER_QUALITY_MIDDLE),
hq_equalizer_impl_type(OSLMP_CONTEXT_HQ_EQUALIZER_IMPL_BASIC_PEAKING_FILTER),
sink_backend_type(OSLMP_CONTEXT_SINK_BACKEND_TYPE_OPENSL),
use_low_latency_if_available(false),
use_floating_point_if_available(true)
{
}
};
public:
virtual ~OpenSLMediaPlayerContext() OSLMP_API_ABI;
static android::sp<OpenSLMediaPlayerContext> create(JNIEnv *env, const create_args_t &args) noexcept OSLMP_API_ABI;
InternalThreadEventListener *getInternalThreadEventListener() const noexcept OSLMP_API_ABI;
int32_t getAudioSessionId() const noexcept OSLMP_API_ABI;
private:
class Impl;
OpenSLMediaPlayerContext(Impl *impl);
impl::OpenSLMediaPlayerInternalContext &getInternal() const noexcept OSLMP_API_ABI;
private:
Impl *impl_; // NOTE: do not use unique_ptr to avoid cxxporthelper dependencies
};
class OpenSLMediaPlayerContext::InternalThreadEventListener : public virtual android::RefBase {
public:
virtual ~InternalThreadEventListener() {}
virtual void onEnterInternalThread(OpenSLMediaPlayerContext *context) noexcept OSLMP_API_ABI = 0;
virtual void onLeaveInternalThread(OpenSLMediaPlayerContext *context) noexcept OSLMP_API_ABI = 0;
};
} // namespace oslmp
#endif // OPENSLMEDIAPLAYERCONTEXT_HPP_
| 42.430769
| 120
| 0.687999
|
cirnoftw
|
855eff19f12f55dbac9886aa25d8181539af2efe
| 3,220
|
cpp
|
C++
|
Container.cpp
|
nirry78/codegen
|
9c538533ea899c8e9bb4a5f2f0851c0680708c82
|
[
"MIT"
] | null | null | null |
Container.cpp
|
nirry78/codegen
|
9c538533ea899c8e9bb4a5f2f0851c0680708c82
|
[
"MIT"
] | null | null | null |
Container.cpp
|
nirry78/codegen
|
9c538533ea899c8e9bb4a5f2f0851c0680708c82
|
[
"MIT"
] | null | null | null |
#include "Container.h"
Container::Container(json& object):
mFieldCount(0)
{
for (auto& [key, value] : object.items())
{
if (!key.compare("name"))
{
mName = value.get<std::string>();
LOGD(" Name: %s\n", mName.c_str());
}
else if (!key.compare("parameters"))
{
if (value.is_array())
{
ParseParameters(value);
}
else
{
LOGE("Parameters must be an array\n");
}
}
else if (!key.compare("group"))
{
mGroup = value.get<std::string>();
LOGD(" Group: %s\n", mGroup.c_str());
}
else
{
LOGE("Container has unregonized key: %s\n", key.c_str());
}
}
ForeachFieldReset(NULL);
}
Container::~Container()
{
}
bool Container::ForeachFieldReset(Tag *tag)
{
bool result = false;
mFieldIterator = mFieldList.begin();
mIteratorTag = tag;
if (mFieldIterator != mFieldList.end())
{
if (tag)
{
if (!(*mFieldIterator).AcceptNameAndGroup(tag))
{
result = ForeachFieldNext();
}
else
{
result = true;
}
}
else
{
result = true;
}
}
mFieldCount = 0;
LOGD("<Container::ForeachFieldReset> count: %u, result: %u\n",
mFieldCount, result);
return result;
}
bool Container::ForeachFieldNext()
{
bool result = false;
++mFieldIterator;
if (mIteratorTag)
{
while (mFieldIterator != mFieldList.end())
{
result = (*mFieldIterator).AcceptNameAndGroup(mIteratorTag);
if (result)
{
break;
}
++mFieldIterator;
}
}
else
{
result = (mFieldIterator != mFieldList.end());
}
if (result)
{
mFieldCount++;
}
LOGD("<Container::ForeachFieldNext> count: %u, result: %u\n",
mFieldCount, result);
return result;
}
void Container::Output(Document* document, std::string& name, Tag* tag, uint32_t count)
{
LOGD("<Container::Output> name: %s, count: %u\n", name.c_str(), count);
if (StringCompare(name, "name"))
{
if (tag)
{
tag->Output(document, mName);
}
else
{
document->Output(mName);
}
}
else if (StringCompare(name, "count") && tag)
{
tag->Output(document, "%u", count);
}
}
void Container::OutputField(Document* document, std::string& name, Tag* tag)
{
if (mFieldIterator != mFieldList.end())
{
mFieldIterator->Output(document, name, tag, mFieldCount);
}
}
void Container::ParseParameters(json& object)
{
for (auto& [key, value] : object.items())
{
(void)key;
if (value.is_object())
{
mFieldList.push_back(Field(value));
}
else
{
LOGE("Expecting object");
}
}
}
bool Container::IsValid()
{
return true;
}
| 19.634146
| 87
| 0.476708
|
nirry78
|
856056ee5d6517a7e2eff6c71d9352575e1caebb
| 38,794
|
cpp
|
C++
|
SerialPrograms/Source/NintendoSwitch/TestProgramSwitch.cpp
|
BlizzardHero/Arduino-Source
|
bc4ce6433651b0feef488735098900f8bf4144f8
|
[
"MIT"
] | null | null | null |
SerialPrograms/Source/NintendoSwitch/TestProgramSwitch.cpp
|
BlizzardHero/Arduino-Source
|
bc4ce6433651b0feef488735098900f8bf4144f8
|
[
"MIT"
] | null | null | null |
SerialPrograms/Source/NintendoSwitch/TestProgramSwitch.cpp
|
BlizzardHero/Arduino-Source
|
bc4ce6433651b0feef488735098900f8bf4144f8
|
[
"MIT"
] | null | null | null |
/* Test Program (Switch)
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/
#include <cmath>
//#include <QSystemTrayIcon>
#include <QProcess>
#include "Common/Cpp/Exceptions.h"
#include "Common/Cpp/PrettyPrint.h"
#include "Common/Cpp/AlignedVector.h"
#include "Common/Cpp/SIMDDebuggers.h"
#include "Common/Qt/QtJsonTools.h"
#include "ClientSource/Libraries/Logging.h"
#include "CommonFramework/PersistentSettings.h"
#include "CommonFramework/Tools/StatsTracking.h"
#include "CommonFramework/Tools/StatsDatabase.h"
#include "CommonFramework/Tools/InterruptableCommands.h"
#include "CommonFramework/Inference/InferenceThrottler.h"
#include "CommonFramework/Inference/AnomalyDetector.h"
#include "CommonFramework/Inference/StatAccumulator.h"
#include "CommonFramework/Inference/TimeWindowStatTracker.h"
#include "CommonFramework/InferenceInfra/VisualInferenceSession.h"
#include "CommonFramework/InferenceInfra/InferenceRoutines.h"
#include "CommonFramework/Inference/FrozenImageDetector.h"
#include "CommonFramework/Inference/BlackScreenDetector.h"
#include "CommonFramework/ImageTools/SolidColorTest.h"
#include "CommonFramework/ImageMatch/FilterToAlpha.h"
#include "CommonFramework/ImageMatch/ImageDiff.h"
#include "CommonFramework/ImageMatch/ImageCropper.h"
#include "CommonFramework/ImageMatch/ImageDiff.h"
#include "CommonFramework/OCR/OCR_RawOCR.h"
#include "CommonFramework/OCR/OCR_Filtering.h"
#include "CommonFramework/OCR/OCR_StringNormalization.h"
#include "CommonFramework/OCR/OCR_TextMatcher.h"
#include "CommonFramework/OCR/OCR_LargeDictionaryMatcher.h"
#include "CommonFramework/ImageMatch/ExactImageDictionaryMatcher.h"
#include "CommonFramework/ImageMatch/CroppedImageDictionaryMatcher.h"
#include "CommonFramework/Inference/ImageMatchDetector.h"
#include "CommonFramework/Notifications/ProgramNotifications.h"
#include "CommonFramework/Tools/ErrorDumper.h"
#include "NintendoSwitch/NintendoSwitch_Settings.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Device.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "Pokemon/Resources/Pokemon_PokemonNames.h"
#include "PokemonSwSh/ShinyHuntTracker.h"
#include "PokemonSwSh/Resources/PokemonSwSh_PokemonSprites.h"
#include "PokemonSwSh/Resources/PokemonSwSh_PokeballSprites.h"
#include "PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinyEncounterDetector.h"
#include "PokemonSwSh/Inference/Dens/PokemonSwSh_RaidLobbyReader.h"
#include "PokemonSwSh/Inference/Battles/PokemonSwSh_StartBattleDetector.h"
#include "PokemonSwSh/Inference/PokemonSwSh_SummaryShinySymbolDetector.h"
#include "PokemonSwSh/Inference/Dens/PokemonSwSh_RaidCatchDetector.h"
#include "PokemonSwSh/Inference/Battles/PokemonSwSh_BattleMenuDetector.h"
#include "PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.h"
#include "PokemonSwSh/Inference/PokemonSwSh_FishingDetector.h"
#include "PokemonSwSh/Inference/PokemonSwSh_MarkFinder.h"
#include "PokemonSwSh/Inference/PokemonSwSh_ReceivePokemonDetector.h"
#include "PokemonSwSh/Inference/PokemonSwSh_PokemonSpriteReader.h"
#include "PokemonSwSh/Inference/PokemonSwSh_TypeSymbolFinder.h"
#include "PokemonSwSh/Inference/Battles/PokemonSwSh_BattleBallReader.h"
#include "PokemonSwSh/Inference/Dens/PokemonSwSh_DenMonReader.h"
#include "PokemonSwSh/Inference/Battles/PokemonSwSh_ExperienceGainDetector.h"
#include "PokemonSwSh/Inference/PokemonSwSh_YCommDetector.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_Entrance.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PokemonReader.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PathSelect.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_ItemSelectMenu.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_EndBattle.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_Lobby.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PokemonSwapMenu.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PokemonSelectMenu.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_ProfessorSwap.h"
#include "PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.h"
#include "PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Entrance.h"
#include "PokemonSwSh/MaxLair/AI/PokemonSwSh_MaxLair_AI.h"
#include "PokemonSwSh/MaxLair/AI/PokemonSwSh_MaxLair_AI_PathMatchup.h"
#include "PokemonSwSh/MaxLair/AI/PokemonSwSh_MaxLair_AI_RentalBossMatchup.h"
#include "PokemonSwSh/PkmnLib/PokemonSwSh_PkmnLib_Moves.h"
#include "PokemonSwSh/PkmnLib/PokemonSwSh_PkmnLib_Pokemon.h"
#include "PokemonSwSh/PkmnLib/PokemonSwSh_PkmnLib_Matchup.h"
#include "PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h"
#include "PokemonSwSh/Programs/PokemonSwSh_BasicCatcher.h"
#include "PokemonSwSh/Programs/PokemonSwSh_Internet.h"
#include "PokemonSwSh/Resources/PokemonSwSh_TypeSprites.h"
#include "Kernels/Kernels_x64_SSE41.h"
#include "Kernels/PartialWordAccess/Kernels_PartialWordAccess_x64_SSE41.h"
//#include "Kernels/PartialWordAccess/Kernels_PartialWordAccess_x64_AVX2.h"
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqr.h"
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqrDev.h"
#include "Kernels/Kernels_Alignment.h"
//#include "Kernels/Waterfill/Kernels_Waterfill_Intrinsics_SSE4.h"
//#include "Kernels/Waterfill/Kernels_Waterfill_FillQueue.h"
//#include "Kernels/BinaryImage/Kernels_BinaryImage_Default.h"
//#include "Kernels/BinaryImage/Kernels_BinaryImage_x64_SSE42.h"
#include "Kernels/BinaryImageFilters/Kernels_BinaryImage_BasicFilters_Default.h"
#include "Kernels/BinaryImageFilters/Kernels_BinaryImage_BasicFilters_x64_SSE42.h"
//#include "Kernels/BinaryImageFilters/Kernels_BinaryImage_BasicFilters_x64_AVX2.h"
//#include "Kernels/BinaryImageFilters/Kernels_BinaryImage_BasicFilters_x64_AVX512.h"
#include "Kernels/Waterfill/Kernels_Waterfill.h"
#include "CommonFramework/BinaryImage/BinaryImage_FilterRgb32.h"
#include "Integrations/DiscordWebhook.h"
#include "Pokemon/Pokemon_Notification.h"
#include "PokemonSwSh/Programs/PokemonSwSh_StartGame.h"
#include "PokemonSwSh/Inference/Battles/PokemonSwSh_BattleDialogTracker.h"
#include "PokemonBDSP/PokemonBDSP_Settings.h"
#include "PokemonBDSP/Inference/PokemonBDSP_DialogDetector.h"
#include "CommonFramework/ImageTools/ColorClustering.h"
#include "PokemonBDSP/Inference/PokemonBDSP_DialogDetector.h"
#include "PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.h"
#include "PokemonBDSP/Inference/PokemonBDSP_MarkFinder.h"
#include "PokemonBDSP/Programs/PokemonBDSP_GameEntry.h"
#include "PokemonBDSP/Inference/PokemonBDSP_MapDetector.h"
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_BattleBallReader.h"
#include "PokemonBDSP/Inference/PokemonBDSP_SelectionArrow.h"
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_BattleMenuDetector.h"
#include "PokemonBDSP/Inference/PokemonBDSP_VSSeekerReaction.h"
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_StartBattleDetector.h"
#include "PokemonBDSP/Inference/PokemonBDSP_MenuDetector.h"
#include "PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxDetector.h"
#include "PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxShinyDetector.h"
#include "PokemonBDSP/Programs/Eggs/PokemonBDSP_EggRoutines.h"
#include "PokemonBDSP/Programs/Eggs/PokemonBDSP_EggFeedback.h"
#include "PokemonBDSP/Programs/PokemonBDSP_RunFromBattle.h"
#include "PokemonBDSP/Programs/PokemonBDSP_BoxRelease.h"
#include "PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.h"
//#include "CommonFramework/BinaryImage/BinaryImage.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.h"
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PathSide.h"
#include "PokemonSwSh/Inference/PokemonSwSh_TypeSymbolFinder.h"
#include "PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_SparkleDetectorRadial.h"
#include "PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_SparkleDetectorSquare.h"
#include "PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinySparkleSet.h"
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_ExperienceGainDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_BubbleDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_ArcDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_QuestMarkDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_ShinySymbolDetector.h"
#include "CommonFramework/ImageMatch/SubObjectTemplateMatcher.h"
#include "CommonFramework/Inference/BlackBorderDetector.h"
#include "PokemonLA/Programs/PokemonLA_GameEntry.h"
#include "PokemonLA/PokemonLA_Settings.h"
#include "PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.h"
#include "PokemonLA/Inference/PokemonLA_MountDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_FlagDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_FlagTracker.h"
#include "CommonFramework/Tools/InterruptableCommands.h"
#include "CommonFramework/Tools/SuperControlSession.h"
#include "PokemonLA/Programs/PokemonLA_FlagNavigationAir.h"
#include "CommonFramework/ImageMatch/WaterfillTemplateMatcher.h"
#include "PokemonLA/Inference/Objects/PokemonLA_ButtonDetector.h"
#include "Kernels/ImageFilters/Kernels_ImageFilter_Basic.h"
#include "PokemonLA/Inference/PokemonLA_NotificationReader.h"
#include "PokemonLA/Inference/PokemonLA_OutbreakReader.h"
#include "PokemonLA/Inference/PokemonLA_SelectedRegionDetector.h"
#include "PokemonLA/Inference/PokemonLA_MapDetector.h"
#include "PokemonLA/Programs/PokemonLA_RegionNavigation.h"
#include "PokemonLA/Programs/PokemonLA_TradeRoutines.h"
#include "PokemonLA/Inference/PokemonLA_DialogDetector.h"
#include "PokemonLA/Inference/PokemonLA_OverworldDetector.h"
#include "CommonFramework/Tools/MultiConsoleErrors.h"
#include "PokemonLA/Inference/PokemonLA_UnderAttackDetector.h"
#include "PokemonLA/Programs/PokemonLA_EscapeFromAttack.h"
#include "PokemonLA/Inference/Objects/PokemonLA_ArcPhoneDetector.h"
#include "CommonFramework/Inference/SpectrogramMatcher.h"
#include "CommonFramework/ImageMatch/WaterfillTemplateMatcher.h"
#include "TestProgramSwitch.h"
#include <immintrin.h>
#include <fstream>
#include <QHttpMultiPart>
#include <QFile>
#include <QEventLoop>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
//#include <Windows.h>
#include <iostream>
using std::cout;
using std::endl;
//#include "../Internal/SerialPrograms/NintendoSwitch_Commands_ScalarButtons.h"
using namespace PokemonAutomation::Kernels;
using namespace PokemonAutomation::Kernels::Waterfill;
namespace PokemonAutomation{
namespace NintendoSwitch{
TestProgram_Descriptor::TestProgram_Descriptor()
: MultiSwitchProgramDescriptor(
"NintendoSwitch:TestProgram",
"Nintendo Switch", "Test Program (Switch)",
"",
"Test Program (Switch)",
FeedbackType::OPTIONAL_, true,
PABotBaseLevel::PABOTBASE_12KB,
1, 4, 1
)
{}
TestProgram::TestProgram(const TestProgram_Descriptor& descriptor)
: MultiSwitchProgramInstance(descriptor)
, LANGUAGE(
"<b>OCR Language:</b>",
{ Language::English }
)
, NOTIFICATION_TEST("Test", true, true, ImageAttachmentMode::JPG)
, NOTIFICATIONS({
&NOTIFICATION_TEST,
// &NOTIFICATION_ERROR_RECOVERABLE,
// &NOTIFICATION_ERROR_FATAL,
})
{
PA_ADD_OPTION(LANGUAGE);
PA_ADD_OPTION(NOTIFICATIONS);
}
//using namespace Kernels;
//using namespace Kernels::Waterfill;
using namespace PokemonLA;
void TestProgram::program(MultiSwitchProgramEnvironment& env){
using namespace Kernels;
using namespace Kernels::Waterfill;
using namespace OCR;
using namespace Pokemon;
// using namespace PokemonSwSh;
// using namespace PokemonBDSP;
using namespace PokemonLA;
LoggerQt& logger = env.logger();
ConsoleHandle& console = env.consoles[0];
BotBase& botbase = env.consoles[0];
VideoFeed& feed = env.consoles[0];
VideoOverlay& overlay = env.consoles[0];
#if 0
for (size_t c = 0; c < 10; c++){
QImage image("Digit-" + QString::number(c) + "-Original.png");
image = image.convertToFormat(QImage::Format::Format_ARGB32);
uint32_t* ptr = (uint32_t*)image.bits();
size_t words = image.bytesPerLine() / sizeof(uint32_t);
for (int r = 0; r < image.height(); r++){
for (int c = 0; c < image.width(); c++){
uint32_t& pixel = ptr[r * words + c];
uint32_t red = qRed(pixel);
uint32_t green = qGreen(pixel);
uint32_t blue = qBlue(pixel);
if (red < 0xa0 || green < 0xa0 || blue < 0xa0){
pixel = 0x00000000;
}
}
}
image.save("Digit-" + QString::number(c) + "-Template.png");
}
#endif
// QImage image("Distance-test.png");
QImage frame = feed.snapshot();
FlagTracker tracker(console, console);
tracker.process_frame(frame, std::chrono::system_clock::now());
double distance, flag_x, flag_y;
tracker.get(distance, flag_x, flag_y);
#if 0
ImageFloatBox box(flag_x - 0.017, flag_y - 0.055, 0.032, 0.025);
QImage image = extract_box(frame, box);
int c = 0;
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(image, 0xff808080, 0xffffffff);
// PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(image, 0xffd0d0d0, 0xffffffff);
WaterFillIterator finder(matrix, 30);
WaterfillObject object;
while (finder.find_next(object)){
// Skip anything that touches the edge.
if (object.min_x == 0 || object.min_y == 0 ||
object.max_x + 1 == matrix.width() || object.max_y + 1 == matrix.height()
){
continue;
}
// extract_box(image, object).save("image-" + QString::number(c++) + ".png");
read_digit(image, object);
}
#endif
// goto_camp_from_jubilife(env, console, WarpSpot::ICELANDS_ICEPEAK_ARENA);
#if 0
QImage image("screenshot-20220309-005426729947.png");
MountDetector detector;
detector.detect(image);
#endif
#if 0
pbf_move_left_joystick(console, 0, 0, 50, 0);
pbf_press_button(console, BUTTON_B, 20, 250);
pbf_mash_button(console, BUTTON_ZL, 250);
pbf_press_button(console, BUTTON_HOME, 20, 230);
#endif
#if 0
{
QImage image("screenshot-20220306-163207833403.png");
// QImage image("screenshot-20220306-172029164014.png");
DialogSurpriseDetector detector(logger, overlay, true);
detector.process_frame(image, std::chrono::system_clock::now());
}
#endif
#if 0
{
QImage image("screenshot-20220302-094034596712.png");
DialogDetector detector(logger, overlay, true);
detector.process_frame(image, std::chrono::system_clock::now());
}
{
QImage image("screenshot-Gin");
DialogDetector detector(logger, overlay, true);
detector.process_frame(image, std::chrono::system_clock::now());
}
#endif
#if 0
InferenceBoxScope box0(console, {0.925, 0.100, 0.014, 0.030});
// QImage screen("screenshot-20220228-121927882824.png");
QImage screen = feed.snapshot();
QImage image = extract_box(screen, box0);
ImageStats stats = image_stats(image);
cout << stats.average << stats.stddev << endl;
bool ok = is_white(stats);
cout << ok << endl;
#endif
// throw UserSetupError(env.logger(), "asdf");
// throw OperationFailedException(env.logger(), "asdf");
// FlagNavigationAir session(env, console);
// session.run_session();
// goto_camp_from_overworld(env, console);
// InferenceBoxScope box(console, {0.450, 0.005, 0.040, 0.010});
// ImageStats stats = image_stats(extract_box(console.video().snapshot(), box));
// cout << stats.average << stats.stddev << endl;
#if 0
pbf_press_dpad(console, DPAD_UP, 20, 480);
pbf_press_button(console, BUTTON_A, 20, 480);
pbf_press_button(console, BUTTON_B, 20, 230);
pbf_press_button(console, BUTTON_B, 20, 230);
#endif
#if 0
auto& context = console;
pbf_move_left_joystick(context, 0, 212, 50, 0);
pbf_press_button(context, BUTTON_B, 500, 80);
pbf_move_left_joystick(context, 224, 0, 50, 0);
pbf_press_button(context, BUTTON_B, 350, 80);
pbf_move_left_joystick(context, 0, 64, 50, 0);
pbf_press_button(context, BUTTON_B, 250, 80);
pbf_move_left_joystick(context, 0, 96, 50, 0);
pbf_press_button(context, BUTTON_B, 500, 0);
#endif
#if 0
VideoOverlaySet set(overlay);
DialogDetector detector(console, console);
detector.make_overlays(set);
detector.process_frame(feed.snapshot(), std::chrono::system_clock::now());
#endif
#if 0
InferenceBoxScope box0(overlay, {0.010, 0.700, 0.050, 0.100});
QImage image = extract_box(feed.snapshot(), box0);
ArcPhoneDetector detector(console, console, std::chrono::milliseconds(200), true);
detector.process_frame(image, std::chrono::system_clock::now());
wait_until(
env, console, std::chrono::seconds(10),
{ &detector }
);
#endif
// from_professor_return_to_jubilife(env, console);
// InferenceBoxScope box0(overlay, {0.900, 0.955, 0.080, 0.045});
// InferenceBoxScope box1(overlay, {0.500, 0.621, 0.300, 0.043});
// EscapeFromAttack session(env, console);
// session.run_session();
// cout << "Done escaping!" << endl;
#if 0
MapDetector detector;
VideoOverlaySet overlays(overlay);
detector.make_overlays(overlays);
#endif
#if 0
ButtonDetector detector(
console, console,
ButtonType::ButtonA,
{0.55, 0.40, 0.20, 0.40},
std::chrono::milliseconds(200), true
);
VideoOverlaySet overlays(overlay);
detector.make_overlays(overlays);
detector.process_frame(feed.snapshot(), std::chrono::system_clock::now());
#endif
#if 0
UnderAttackWatcher watcher;
wait_until(
env, console,
std::chrono::seconds(60),
{ &watcher }
);
#endif
// InferenceBoxScope box(overlay, 0.49, 0.07, 0.02, 0.03);
// ImageStats stats = image_stats(extract_box(feed.snapshot(), box));
// cout << stats.average << stats.stddev << endl;
// return_to_jubilife_from_overworld(env, console);
#if 0
pbf_move_right_joystick(console, 0, 128, 145, 0);
pbf_move_left_joystick(console, 128, 0, 50, 0);
pbf_press_button(console, BUTTON_B, 500, 125);
pbf_move_right_joystick(console, 255, 128, 45, 0);
pbf_move_left_joystick(console, 128, 0, 50, 0);
pbf_press_button(console, BUTTON_B, 420, 125);
pbf_move_right_joystick(console, 0, 128, 100, 0);
pbf_move_left_joystick(console, 128, 0, 50, 0);
pbf_press_button(console, BUTTON_B, 420, 125);
#endif
#if 0
TradeNameReader reader(console, LANGUAGE, console);
reader.read(feed.snapshot());
InferenceBoxScope box(overlay, {0.920, 0.100, 0.020, 0.030});
QImage image = extract_box(feed.snapshot(), box);
ImageStats stats = image_stats(image);
cout << stats.average << stats.stddev << endl;
// is_white()
// std::map<std::string, int> catch_count;
#endif
#if 0
TradeStats stats;
MultiConsoleErrorState error_state;
env.run_in_parallel([&](ConsoleHandle& console){
trade_current_pokemon(env, console, error_state, stats);
});
#endif
// trade_current_pokemon(env, console, error_state, stats);
#if 0
QImage image("screenshot-20220213-141558364230.png");
// CenterAButtonTracker tracker;
// WhiteObjectWatcher detector(console, {0.40, 0.50, 0.40, 0.50}, {{tracker, false}});
// detector.process_frame(image, std::chrono::system_clock::now());
ButtonDetector detector(console, console, ButtonType::ButtonA, {0.40, 0.50, 0.40, 0.50});
AsyncVisualInferenceSession visual(env, console, console, console);
visual += detector;
#endif
// InferenceBoxScope box(overlay, 0.40, 0.50, 0.40, 0.50);
// cout << std::chrono::system_clock::time_point::min() - std::chrono::system_clock::now() << endl;
// pbf_move_right_joystick(console, 0, 128, 45, 0);
#if 0
pbf_move_right_joystick(console, 128, 255, 200, 0);
pbf_move_right_joystick(console, 128, 0, 200, 0);
pbf_move_right_joystick(console, 128, 255, 80, 0);
pbf_move_right_joystick(console, 0, 128, 400, 0);
pbf_move_right_joystick(console, 128, 255, 120, 0);
pbf_move_right_joystick(console, 0, 128, 400, 0);
pbf_move_right_joystick(console, 128, 0, 200, 0);
pbf_move_right_joystick(console, 0, 128, 400, 0);
#endif
#if 0
FlagTracker flag(logger, overlay);
MountTracker mount(logger);
{
AsyncVisualInferenceSession visual(env, console, console, console);
visual += flag;
visual += mount;
AsyncCommandSession commands(env, console.botbase());
while (true){
// commands.dispatch([=](const BotBaseContext& context){
// pbf_move_right_joystick(context, 0, 128, 5 * TICKS_PER_SECOND, 0);
// });
// commands.wait();
double flag_distance, flag_x, flag_y;
bool flag_ok = flag.get(flag_distance, flag_x, flag_y);
if (flag_ok && 0.4 < flag_x && flag_x < 0.6 && flag_y > 0.6){
commands.dispatch([=](const BotBaseContext& context){
pbf_press_button(context, BUTTON_B, 300 * TICKS_PER_SECOND, 0);
});
}
}
commands.stop_session();
visual.stop();
}
#endif
#if 0
MountDetector mount_detector;
FlagDetector flags;
WhiteObjectWatcher watcher(console, {{flags, false}});
QImage image(feed.snapshot());
MountState mount_state = mount_detector.detect(image);
cout << MOUNT_STATE_STRINGS[(int)mount_state] << endl;
// watcher.process_frame(image, std::chrono::system_clock::now());
// flags.detections()
#endif
#if 0
QImage image("screenshot-20220211-023701107827.png");
FlagDetector flags;
WhiteObjectWatcher watcher(
console,
{{flags, false}}
);
watcher.process_frame(image, std::chrono::system_clock::now());
#endif
#if 0
QImage image(feed.snapshot());
// QImage image("screenshot-20220210-231922898436.png");
// QImage image("screenshot-20220211-005950586653.png");
// QImage image("screenshot-20220211-012426947705.png");
// QImage image("screenshot-20220211-014247032114.png");
// QImage image("screenshot-20220211-022344759878.png");
HmDetector detector(overlay);
cout << HM_STATE_STRINGS[(int)detector.detect(image)] << endl;
#endif
#if 0
InferenceBoxScope box(overlay, 0.905, 0.65, 0.08, 0.13);
QImage image = extract_box(feed.snapshot(), box);
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(
image,
192, 255,
192, 255,
0, 255
);
std::vector<WaterfillObject> objects = find_objects_inplace(matrix, 20, false);
ImagePixelBox result;
for (const WaterfillObject& object : objects){
int c = 0;
for (const auto& object : objects){
extract_box(image, object).save("test-" + QString::number(c++) + ".png");
}
if (HmWyrdeerMatcher::on().matches(result, image, object)){
cout << "Wyrdeer On" << endl;
}
#if 0
if (HmWyrdeerMatcher::off().matches(result, image, object)){
cout << "Wyrdeer Off" << endl;
}
if (HmWyrdeerMatcher::on().matches(result, image, object)){
cout << "Wyrdeer On" << endl;
}
if (HmUrsalunaMatcher::off().matches(result, image, object)){
cout << "Ursaluna Off" << endl;
}
if (HmUrsalunaMatcher::on().matches(result, image, object)){
cout << "Ursaluna On" << endl;
}
if (HmSneaslerMatcher::off().matches(result, image, object)){
cout << "Sneasler Off" << endl;
}
if (HmSneaslerMatcher::on().matches(result, image, object)){
cout << "Sneasler On" << endl;
}
if (HmBraviaryMatcher::off().matches(result, image, object)){
cout << "Braviary Off" << endl;
}
if (HmBraviaryMatcher::on().matches(result, image, object)){
cout << "Braviary On" << endl;
}
#endif
}
#endif
#if 0
InferenceBoxScope box(overlay, 0.905, 0.65, 0.08, 0.13);
QImage image = extract_box(feed.snapshot(), box);
// QImage image("test.png");
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(
image,
128, 255,
128, 255,
0, 255
);
std::vector<WaterfillObject> objects = find_objects_inplace(matrix, 20, false);
cout << objects.size() << endl;
// int c = 0;
// for (const auto& object : objects){
// extract_box(image, object).save("test-" + QString::number(c++) + ".png");
// }
#if 1
WaterfillObject object;
for (const WaterfillObject& obj : objects){
object.merge_assume_no_overlap(obj);
}
ImagePixelBox sbox(object.min_x, object.min_y, object.max_x, object.max_y);
extract_box(image, sbox).save("test.png");
#endif
#endif
// QImage image("2054071609223400_s.jpg");
// SelectionArrowFinder arrow_detector(console, ImageFloatBox(0.350, 0.450, 0.500, 0.400));
// arrow_detector.detect(image);
#if 0
// ArcWatcher arcs(overlay);
// BubbleWatcher bubbles(overlay);
BubbleDetector bubbles;
ArcDetector arcs;
QuestMarkDetector quest_marks;
WhiteObjectWatcher watcher(
overlay,
{{bubbles, false}, {arcs, false}, {quest_marks, false}}
);
// watcher.process_frame(feed.snapshot(), std::chrono::system_clock::now());
#if 1
{
VisualInferenceSession session(env, logger, feed, overlay);
session += watcher;
session.run();
}
#endif
#endif
#if 0
// InferenceBoxScope box(overlay, 0.40, 0.50, 0.40, 0.50);
InferenceBoxScope box(overlay, 0.010, 0.700, 0.050, 0.100);
QImage image(feed.snapshot());
image = extract_box(image, box);
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(
image,
128, 255,
128, 255,
128, 255
);
std::vector<WaterfillObject> objects = find_objects_inplace(matrix, 20, false);
cout << objects.size() << endl;
int c = 0;
for (const auto& object : objects){
extract_box(image, object).save("test-" + QString::number(c++) + ".png");
}
#endif
// ShinySymbolWatcher watcher(overlay, SHINY_SYMBOL_BOX_BOTTOM);
// watcher.process_frame(feed.snapshot(), std::chrono::system_clock::now());
// ArcDetector detector;
// QImage image("screenshot-20220124-212851483502.png");
// QImage image(feed.snapshot());
// find_arcs(image);
#if 0
QImage image0("test-image.png");
QImage image1("test-sprite.png");
for (int r = 0; r < image0.height(); r++){
for (int c = 0; c < image0.width(); c++){
uint32_t pixel1 = image1.pixel(c, r);
if ((pixel1 >> 24) == 0){
image0.setPixel(c, r, 0xff00ff00);
}
}
}
image0.save("test.png");
#endif
#if 0
QImage image("screenshot-20220124-212851483502.png");
InferenceBoxScope box(overlay, 0.4, 0.4, 0.2, 0.2);
image = extract_box(image, box);
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(
image,
128, 255,
128, 255,
128, 255
);
std::vector<WaterfillObject> objects = find_objects_inplace(matrix, 20, false);
cout << objects.size() << endl;
int c = 0;
for (const auto& object : objects){
extract_box(image, object).save("test-" + QString::number(c++) + ".png");
}
// WaterfillObject object = objects[1];
// object.merge_assume_no_overlap(objects[2]);
// extract_box(image, object).save("test.png");
#endif
#if 0
QImage image("MountOn-Wyrdeer-Template.png");
image = image.convertToFormat(QImage::Format::Format_ARGB32);
uint32_t* ptr = (uint32_t*)image.bits();
size_t words = image.bytesPerLine() / sizeof(uint32_t);
for (int r = 0; r < image.height(); r++){
for (int c = 0; c < image.width(); c++){
uint32_t& pixel = ptr[r * words + c];
uint32_t red = qRed(pixel);
uint32_t green = qGreen(pixel);
uint32_t blue = qBlue(pixel);
if (red < 0xa0 || green < 0xa0 || blue < 0xa0){
pixel = 0x00000000;
}
}
}
image.save("MountOn-Wyrdeer-Template-1.png");
#endif
#if 0
QImage image("screenshot-20220123-225755803973.png");
InferenceBoxScope box(overlay, 0.32, 0.87, 0.03, 0.04);
image = extract_box(image, box);
PackedBinaryMatrix matrix = compress_rgb32_to_binary_range(
image,
128, 255,
128, 255,
128, 255
);
std::vector<WaterfillObject> objects = find_objects_inplace(matrix, 20, false);
cout << objects.size() << endl;
// int c = 0;
// for (const auto& object : objects){
// extract_box(image, object).save("test-" + QString::number(c++) + ".png");
// }
WaterfillObject object = objects[0];
object.merge_assume_no_overlap(objects[1]);
extract_box(image, object).save("Sparkle.png");
#endif
#if 0
BlackBorderDetector detector;
VideoOverlaySet overlays(overlay);
detector.make_overlays(overlays);
detector.detect(feed.snapshot());
#endif
#if 0
ExperienceGainDetector detector;
VideoOverlaySet overlays(overlay);
detector.make_overlays(overlays);
detector.detect(feed.snapshot());
#endif
#if 0
ShinyEncounterTracker tracker(logger, overlay, BattleType::STANDARD);
{
VisualInferenceSession session(env, console, feed, overlay);
session += tracker;
session.run();
}
DoublesShinyDetection wild_result;
ShinyDetectionResult your_result;
determine_shiny_status(
logger,
wild_result, your_result,
tracker.dialog_tracker(),
tracker.sparkles_wild_overall(),
tracker.sparkles_wild_left(),
tracker.sparkles_wild_right(),
tracker.sparkles_own()
);
#if 0
determine_shiny_status(
logger,
SHINY_BATTLE_REGULAR,
tracker.dialog_timer(),
tracker.sparkles_wild()
);
#endif
#endif
#if 0
VisualInferenceSession session(env, feed, overlay);
ShinySparkleTracker tracker(overlay);
session += tracker;
session.run();
#endif
#if 0
QImage image = feed.snapshot();
PokemonSwSh::SparkleSet sparkles = PokemonSwSh::find_sparkles(image);
VideoOverlaySet overlays(overlay);
sparkles.draw_boxes(overlays, image, {0, 0, 1, 1});
#endif
#if 0
Kernels::PackedBinaryMatrix matrix0;
matrix0 = compress_rgb32_to_binary_min(image, 192, 192, 0);
// std::vector<WaterfillObject> objects = find_objects_inplace(matrix0, 10, false);
WaterFillIterator finder(matrix0, 20);
WaterfillObject object;
size_t c = 0;
VideoOverlaySet overlays(overlay);
while (finder.find_next(object)){
image.copy(object.min_x, object.min_y, object.width(), object.height()).save("test-" + QString::number(c) + ".png");
cout << c++ << endl;
PokemonSwSh::RadialSparkleDetector radial(object);
if (radial.is_ball()){
overlays.add(
COLOR_GREEN,
translate_to_parent(
image, {0, 0, 1, 1},
{object.min_x, object.min_y, object.max_x, object.max_y}
)
);
continue;
}
if (radial.is_star()){
overlays.add(
COLOR_BLUE,
translate_to_parent(
image, {0, 0, 1, 1},
{object.min_x, object.min_y, object.max_x, object.max_y}
)
);
continue;
}
if (PokemonSwSh::is_line_sparkle(object, image.width() * 0.25)){
overlays.add(
COLOR_YELLOW,
translate_to_parent(
image, {0, 0, 1, 1},
{object.min_x, object.min_y, object.max_x, object.max_y}
)
);
continue;
}
if (PokemonSwSh::is_square_sparkle(object)){
overlays.add(
COLOR_MAGENTA,
translate_to_parent(
image, {0, 0, 1, 1},
{object.min_x, object.min_y, object.max_x, object.max_y}
)
);
}
}
#endif
// PokemonSwSh::SelectionArrowFinder finder(overlay, ImageFloatBox(0.640, 0.600, 0.055, 0.380));
// QImage image("screenshot-20220108-185053570093.png");
// cout << finder.detect(image) << endl;
// QImage image("20220111-124433054843-PathPartyReader-ReadHP.png");
// QImage image("20220116-044701249467-ReadPathSide.png");
// cout << (int)PokemonSwSh::MaxLairInternal::read_side(image) << endl;
#if 0
QImage image("20220116-053836954926-ReadPath.png");
std::multimap<double, std::pair<PokemonType, ImagePixelBox>> candidates = PokemonSwSh::find_symbols(image, 0.20);
// std::deque<InferenceBoxScope> hits;
// hits.clear();
cout << "---------------" << endl;
for (const auto& item : candidates){
cout << get_type_slug(item.second.first) << ": " << item.first << endl;
// hits.emplace_back(overlay, translate_to_parent(screen, box, item.second.second), COLOR_GREEN);
}
#endif
// QImage image("20220111-124433054843-PathPartyReader-ReadHP.png");
// NintendoSwitch::PokemonSwSh::MaxLairInternal::PathReader detector(overlay, 0);
// double hp[4];
// detector.read_hp(logger, image, hp);
#if 0
MapDetector detector;
VideoOverlaySet set(overlay);
detector.make_overlays(set);
cout << detector.detect(feed.snapshot()) << endl;
#endif
// QImage image("screenshot-20220108-185053570093.png");
// PokemonSwSh::MaxLairInternal::BattleMenuReader reader(overlay, Language::English);
// cout << reader.can_dmax(image) << endl;
// SelectionArrowFinder detector(overlay, {0.50, 0.58, 0.40, 0.10}, COLOR_RED);
// detector.detect(feed.snapshot());
// InferenceBoxScope box(overlay, {0.23, 0.30, 0.35, 0.30});
#if 0
QImage image("screenshot-20220103-011451179122.png");
PackedBinaryMatrix matrix = filter_rgb32_range(
image,
192, 255,
0, 160,
0, 192
);
std::vector<WaterfillObject> objects = find_objects(matrix, 100, false);
VideoOverlaySet set(overlay);
size_t c = 0;
for (const WaterfillObject& object : objects){
ImagePixelBox box(object.min_x, object.min_y, object.max_x, object.max_y);
ImageFloatBox fbox = translate_to_parent(image, {0, 0, 1, 1}, box);
set.add(COLOR_RED, fbox);
image.copy(object.min_x, object.min_y, object.width(), object.height()).save("test-" + QString::number(c++) + ".png");
}
#endif
#if 0
QImage image("ExclamationTop-0.png");
for (int r = 0; r < image.height(); r++){
for (int c = 0; c < image.width(); c++){
uint32_t pixel = image.pixel(c, r);
cout << "(" << qRed(pixel) << "," << qGreen(pixel) << "," << qBlue(pixel) << ")";
}
cout << endl;
}
#endif
#if 0
QImage image("QuestionTop-0.png");
image = image.convertToFormat(QImage::Format_ARGB32);
uint32_t* ptr = (uint32_t*)image.bits();
size_t words = image.bytesPerLine() / sizeof(uint32_t);
for (int r = 0; r < image.height(); r++){
for (int c = 0; c < image.width(); c++){
uint32_t pixel = ptr[r*words + c];
if (qRed(pixel) + qGreen(pixel) + qBlue(pixel) < 50){
ptr[r*words + c] = 0;
}
}
}
image.save("QuestionTop-1.png");
#endif
#if 0
cout << std::hex << QColor("green").rgb() << endl;
cout << std::hex << QColor(Qt::green).rgb() << endl;
cout << std::hex << QColor(Qt::darkGreen).rgb() << endl;
cout << std::hex << QColor(Qt::darkCyan).rgb() << endl;
#endif
#if 0
QImage image("screenshot-20211227-082121670685.png");
image = extract_box(image, ImageFloatBox({0.95, 0.10, 0.05, 0.10}));
image.save("test.png");
BinaryImage binary_image = filter_rgb32_range(
image,
255, 255,
128, 255,
0, 128,
0, 128
);
cout << binary_image.dump() << endl;
#endif
#if 0
ShortDialogDetector detector;
OverlaySet overlays(overlay);
detector.make_overlays(overlays);
cout << detector.detect(QImage("20211228-013942613330.jpg")) << endl;
// cout << detector.detect(feed.snapshot()) << endl;
#endif
#if 0
BoxShinyDetector detector;
cout << detector.detect(QImage("20211226-031611120900.jpg")) << endl;
// pbf_mash_button(console, BUTTON_X, 10 * TICKS_PER_SECOND);
#endif
#if 0
BattleMenuDetector detector(BattleType::WILD);
OverlaySet overlays(overlay);
detector.make_overlays(overlays);
#endif
env.wait_for(std::chrono::seconds(60));
}
}
}
| 31.134831
| 127
| 0.6617
|
BlizzardHero
|
856472542cd47e4ec940c97e2ba7719c79562fe7
| 1,484
|
cc
|
C++
|
CodeChef/SHORT/COOK65/Problem B/B.cc
|
VastoLorde95/Competitive-Programming
|
6c990656178fb0cd33354cbe5508164207012f24
|
[
"MIT"
] | 170
|
2017-07-25T14:47:29.000Z
|
2022-01-26T19:16:31.000Z
|
CodeChef/SHORT/COOK65/Problem B/B.cc
|
navodit15/Competitive-Programming
|
6c990656178fb0cd33354cbe5508164207012f24
|
[
"MIT"
] | null | null | null |
CodeChef/SHORT/COOK65/Problem B/B.cc
|
navodit15/Competitive-Programming
|
6c990656178fb0cd33354cbe5508164207012f24
|
[
"MIT"
] | 55
|
2017-07-28T06:17:33.000Z
|
2021-10-31T03:06:22.000Z
|
#include <bits/stdc++.h>
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a) __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define func __FUNCTION__
#define line __LINE__
using namespace std;
template<typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p){out<<'('<<p.fi<<", "<<p.se<<')'; return out;}
template<typename T>
ostream& operator<<(ostream& out, vector<T> const & v){
int l = v.size(); for(int i = 0; i < l-1; i++) out<<v[i]<<' '; if(l>0) out<<v[l-1]; return out;}
void tr(){cout << endl;}
template<typename S, typename ... Strings>
void tr(S x, const Strings&... rest){cout<<x<<' ';tr(rest...);}
typedef long long ll;
typedef pair<int,int> pii;
const int M = (1<<27);
const ll MOD = (1ll<<32);
int q;
ll s, a, b, sum;
short h[M];
int main(){
sd(q);
sd3(s,a,b);
int tmp, x, y;
while(q--){
tmp = s >> 1;
x = tmp >> 27;
y = (tmp&(M-1));
if(s&1){
if(((h[y]>>x)&1) == 0){
h[y] ^= (1<<x);
sum += tmp;
}
}
else{
if(((h[y]>>x)&1) > 0){
h[y] ^= (1<<x);
sum -= tmp;
}
}
s = (s*a + b)%MOD;
}
printf("%lld\n", sum);
return 0;
}
| 20.328767
| 100
| 0.557951
|
VastoLorde95
|
8566a3fc64a064df90c9167e4d1799fd8b24e576
| 768
|
cpp
|
C++
|
Topics/2015_05_03/quiz.cpp
|
TelerikAcademy/C-Beginner
|
a4d5a8beb870da910f74da41362b02f0d754ee51
|
[
"MIT"
] | null | null | null |
Topics/2015_05_03/quiz.cpp
|
TelerikAcademy/C-Beginner
|
a4d5a8beb870da910f74da41362b02f0d754ee51
|
[
"MIT"
] | null | null | null |
Topics/2015_05_03/quiz.cpp
|
TelerikAcademy/C-Beginner
|
a4d5a8beb870da910f74da41362b02f0d754ee51
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <cmath>
using namespace std;
bool is_prime(long long a){
long long x=sqrt(a), i;
if (a%2==0){
if (a==2) {return true;}
else {return false;}
}
for (i=3; i<=x; i=i+2){
if (a%i==0) {return false;}
}
return true;
}
int main () {
long long n,m,i,j,brc,st10;
long long kcifri[4]={1,3,7,9};
cin >> n;
for (i=0;i<4;i=i+1) {
m=n*10+kcifri[i];
if (is_prime(m)) {
cout << m << endl;
return 0;
}
}
for (brc=1, st10=10;true;brc=brc+1,st10=st10*10){
for (j=0;j<st10; j=j+1){
for (i=0;i<4;i=i+1) {
m=(n*st10+j)*10+kcifri[i];
if (is_prime(m)) {
cout << m << endl;
return 0;
}
}
}
}
}
| 18.285714
| 52
| 0.451823
|
TelerikAcademy
|
85676711a5e512403a8f0422642f1b0912792d53
| 1,045
|
cpp
|
C++
|
500 problems pepcoding/Subarray with given sum.cpp
|
shikhar8434/OJ-problems
|
7e787b41fd8b6342f73ee59066e2a324608c511d
|
[
"MIT"
] | 2
|
2020-10-13T12:37:15.000Z
|
2020-10-28T14:29:15.000Z
|
500 problems pepcoding/Subarray with given sum.cpp
|
shikhar8434/OJ-problems
|
7e787b41fd8b6342f73ee59066e2a324608c511d
|
[
"MIT"
] | null | null | null |
500 problems pepcoding/Subarray with given sum.cpp
|
shikhar8434/OJ-problems
|
7e787b41fd8b6342f73ee59066e2a324608c511d
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ll long long int
#define vi vector<int>
#define vii vector<int, int>
#define vc vector<char>
#define vl vector<ll>
#define mod 1000000007
#define INF 1000000009
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--) {
int n, k;
cin >> n >> k;
vi A(n);
for(int i = 0 ; i < n; i++) {
cin >> A[i];
}
int l = 0, r = 0;
int curr_sum = A[0];
bool flag = 0;
for(int i = 1 ; i <= n; i++) {
while(curr_sum > k and l < i-1) {
curr_sum -= A[l];
l++;
}
if(curr_sum == k) {
cout << l + 1 << " " << i << "\n";
flag =1;
break;
}
if(i < n) {
curr_sum += A[i];
}
}
if(!flag)
cout << "-1\n";
}
return 0;
}
| 18.017241
| 43
| 0.42488
|
shikhar8434
|
85677ce7bc7152934b8d1ae4e3bc98f3c6353c32
| 3,470
|
hpp
|
C++
|
include/Xyz/LineClipping.hpp
|
jebreimo/Xyz
|
654e22412fc505c5f6a385992a6f5c7e6ab3cc3c
|
[
"BSD-2-Clause"
] | null | null | null |
include/Xyz/LineClipping.hpp
|
jebreimo/Xyz
|
654e22412fc505c5f6a385992a6f5c7e6ab3cc3c
|
[
"BSD-2-Clause"
] | null | null | null |
include/Xyz/LineClipping.hpp
|
jebreimo/Xyz
|
654e22412fc505c5f6a385992a6f5c7e6ab3cc3c
|
[
"BSD-2-Clause"
] | null | null | null |
//****************************************************************************
// Copyright © 2017 Jan Erik Breimo. All rights reserved.
// Created by Jan Erik Breimo on 24.04.2017.
//
// This file is distributed under the BSD License.
// License text is included with the source distribution.
//****************************************************************************
#pragma once
#include <utility>
#include "LineSegment.hpp"
#include "Rectangle.hpp"
namespace Xyz
{
constexpr unsigned OUTCODE_INSIDE = 0;
constexpr unsigned OUTCODE_LEFT = 0b0001;
constexpr unsigned OUTCODE_RIGHT = 0b0010;
constexpr unsigned OUTCODE_BOTTOM = 0b0100;
constexpr unsigned OUTCODE_TOP = 0b1000;
template <typename T>
unsigned computeClippingOutcode(const Rectangle<T>& rectangle,
const Vector<T, 2>& point)
{
auto [x, y] = point;
auto [x0, y0] = rectangle.min();
auto [x1, y1] = rectangle.max();
unsigned code = OUTCODE_INSIDE;
if (x1 < x)
code = OUTCODE_RIGHT;
else if (x < x0)
code = OUTCODE_LEFT;
if (y1 < y)
code += OUTCODE_TOP;
else if (y < y0)
code += OUTCODE_BOTTOM;
return code;
}
/** @brief Returns the relative start and end positions of @a line
* inside @a rectangle.
*
* Uses the Cohen-Sutherland algorithm to compute the relative positions.
*
* @tparam T a numeric type.
* @param rectangle the clipping rectangle.
* @param line the line that will be clipped.
* @return the relative start and end positions of the part of @a line
* that lies inside @a rectangle. Both positions will be between
* 0 and 1, unless @a line is completely outside @a rectangle in
* which case both positions are -1.
*/
template <typename T>
std::pair<double, double> getClippingPositions(
const Rectangle<T>& rectangle, const LineSegment<T, 2>& line)
{
auto startCode = computeClippingOutcode(rectangle, line.start());
auto endCode = computeClippingOutcode(rectangle, line.end());
double tStart = 0.0, tEnd = 1.0;
for (;;)
{
if (!(startCode | endCode))
return {tStart, tEnd};
if (startCode & endCode)
return {-1.0, -1.0};
auto start = line.start();
auto vector = line.end() - line.start();
auto bottomLeft = rectangle.min();
auto topRight = rectangle.max();
unsigned code = startCode ? startCode : endCode;
double t;
if (code & OUTCODE_TOP)
t = (get<1>(topRight) - get<1>(start)) / get<1>(vector);
else if (code & OUTCODE_BOTTOM)
t = (get<1>(bottomLeft) - get<1>(start)) / get<1>(vector);
else if (code & OUTCODE_LEFT)
t = (get<0>(bottomLeft) - get<0>(start)) / get<0>(vector);
else
t = (get<0>(topRight) - get<0>(start)) / get<0>(vector);
auto point = start + t * vector;
if (code == startCode)
{
tStart = t;
startCode = computeClippingOutcode(rectangle, point);
}
else
{
tEnd = t;
endCode = computeClippingOutcode(rectangle, point);
}
}
}
}
| 34.356436
| 78
| 0.52853
|
jebreimo
|
8567a7d469c661f801c378faf104dddee93794f1
| 2,000
|
cpp
|
C++
|
app/src/App.cpp
|
elchtzeasar/balcony-watering-system
|
2fb20dc8bdf79cff4b7ba93cb362489562b62732
|
[
"MIT"
] | null | null | null |
app/src/App.cpp
|
elchtzeasar/balcony-watering-system
|
2fb20dc8bdf79cff4b7ba93cb362489562b62732
|
[
"MIT"
] | null | null | null |
app/src/App.cpp
|
elchtzeasar/balcony-watering-system
|
2fb20dc8bdf79cff4b7ba93cb362489562b62732
|
[
"MIT"
] | null | null | null |
#include "App.h"
#include "IAppConfiguration.h"
#include "ConfigurationFile.h"
#include "SingleRunHandler.h"
#include "TextGui.h"
#include <cassert>
#include <variant>
namespace balcony_watering_system {
namespace app {
using ::balcony_watering_system::configuration::IAppConfiguration;
using ::balcony_watering_system::configuration::ConfigurationFile;
using ::balcony_watering_system::hardware::HWFactory;
using ::balcony_watering_system::logic::LogicFactory;
using ::std::chrono::milliseconds;
class App::Pimpl {
public:
Pimpl(const ConfigurationFile& configurationFile,
const LogicFactory& logicFactory,
const HWFactory& hwFactory) :
cycleTime(configurationFile.getAppConfiguration().getCycleTime()),
app(false) {
const auto& configuration = configurationFile.getAppConfiguration();
const auto mode = configuration.getMode();
switch (mode) {
case IAppConfiguration::Mode::TEXT_GUI:
app.emplace<TextGui>(logicFactory, hwFactory);
break;
case IAppConfiguration::Mode::SINGLE_RUN:
app.emplace<SingleRunHandler>(logicFactory, hwFactory);
break;
default:
break;
}
}
bool exec() {
if(TextGui* ui = std::get_if<TextGui>(&app)) {
return ui->exec();
}
else if(SingleRunHandler* handler = std::get_if<SingleRunHandler>(&app)) {
return handler->exec();
}
return true;
}
const milliseconds& getCycleTime() const {
return cycleTime;
}
private:
std::variant<bool, TextGui, SingleRunHandler> app;
const milliseconds cycleTime;
};
App::App(const ConfigurationFile& configuration,
const LogicFactory& logicFactory,
const HWFactory& hwFactory) :
pimpl(new Pimpl(configuration, logicFactory, hwFactory)) {
}
App::~App() {
delete pimpl;
}
bool App::exec() {
return pimpl->exec();
}
const milliseconds& App::getCycleTime() const {
return pimpl->getCycleTime();
}
} /* namespace app */
} /* namespace balcony_watering_system */
| 24.691358
| 78
| 0.7015
|
elchtzeasar
|
85696b81b51a00bf54ab18b733ba63df7b15bcd2
| 1,710
|
hpp
|
C++
|
include/put.hpp
|
Leonardo2718/btrio
|
67941bc4a5b1d6bc637e3b1ffd75cdbcaddbdba7
|
[
"BSL-1.0"
] | null | null | null |
include/put.hpp
|
Leonardo2718/btrio
|
67941bc4a5b1d6bc637e3b1ffd75cdbcaddbdba7
|
[
"BSL-1.0"
] | null | null | null |
include/put.hpp
|
Leonardo2718/btrio
|
67941bc4a5b1d6bc637e3b1ffd75cdbcaddbdba7
|
[
"BSL-1.0"
] | null | null | null |
/**
* Copyright Leonardo Banderali 2017 - 2017.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef PUT_HPP
#define PUT_HPP
#include "format.hpp"
#include "put_utils.hpp"
#include "basic_put.hpp"
#include <cstdio>
#define USE_PPUT 0
namespace btrio {
//~ iput ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename OutputIterator, typename T, typename F = btrio::default_format>
OutputIterator iput(OutputIterator begin, OutputIterator end, T arg) {
auto cursor = begin;
return basic_put<F>(arg, [&](auto c){ *cursor = c; ++cursor; return cursor; }, [&](auto i){ return i == end; }, cursor);
}
template <typename OutputIterator, typename T, typename F>
OutputIterator iput(OutputIterator begin, OutputIterator end, btrio::formatted_value<F, T> arg) {
auto cursor = begin;
return basic_put<F>(arg.value, [&](auto c){ *cursor = c; ++cursor; return cursor; }, [&](auto i){ return i == end; }, cursor);
}
//~ fput ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename T, typename F = btrio::default_format>
auto fput(T&& arg, FILE* f) {
return basic_put<F>(std::forward<T>(arg), std::putc, [](auto r){ return r == EOF; }, 0, f);
}
template <typename T, typename F>
auto fput(btrio::formatted_value<F, T> arg, FILE* f) {
return basic_put<F>(arg.value, std::putc, [](auto r){ return r == EOF; }, 0, f);
}
//~ put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename T> void put(T arg) { put(arg, stdout); }
}
#endif // PUT_HPP
| 31.666667
| 130
| 0.580117
|
Leonardo2718
|
856a124ab0f9a59e5777d742161ef3d253753311
| 2,143
|
hpp
|
C++
|
gearoenix/render/engine/gx-rnd-eng-configuration.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 35
|
2018-01-07T02:34:38.000Z
|
2022-02-09T05:19:03.000Z
|
gearoenix/render/engine/gx-rnd-eng-configuration.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 111
|
2017-09-20T09:12:36.000Z
|
2020-12-27T12:52:03.000Z
|
gearoenix/render/engine/gx-rnd-eng-configuration.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 5
|
2020-02-11T11:17:37.000Z
|
2021-01-08T17:55:43.000Z
|
#ifndef GEAROENIX_RENDER_ENGINE_CONFIGURATION_HPP
#define GEAROENIX_RENDER_ENGINE_CONFIGURATION_HPP
#include "../../core/gx-cr-build-configuration.hpp"
#include "../../core/gx-cr-static.hpp"
#include "../../math/gx-math-numeric.hpp"
#include "../../system/gx-sys-log.hpp"
#include <cstdint>
namespace gearoenix::render::engine {
struct Configuration {
GX_GETSET_VAL_PRV(std::int8_t, shadow_cascades_count, GX_MAX_SHADOW_CASCADES)
GX_GETSET_VAL_PRV(std::uint16_t, runtime_reflection_environment_resolution, GX_DEFAULT_RUNTIME_REFLECTION_ENVIRONMENT_RESOLUTION)
GX_GETSET_VAL_PRV(std::uint16_t, runtime_reflection_irradiance_resolution, GX_DEFAULT_RUNTIME_REFLECTION_IRRADIANCE_RESOLUTION)
GX_GETSET_VAL_PRV(std::uint32_t, maximum_cpu_render_memory_size, 512 * 1024 * 1024)
GX_GETSET_VAL_PRV(std::uint32_t, maximum_gpu_render_memory_size, 256 * 1024 * 1024)
GX_GETSET_VAL_PRV(std::uint32_t, maximum_gpu_buffer_size, 64 * 1024 * 1024)
GX_GETSET_VAL_PRV(std::uint16_t, brdflut_resolution, GX_DEFAULT_BRDFLUT_RESOLUTION)
GX_GET_VAL_PRV(std::uint16_t, runtime_reflection_radiance_resolution, GX_DEFAULT_RUNTIME_REFLECTION_RADIANCE_RESOLUTION)
GX_GET_VAL_PRV(std::uint8_t, runtime_reflection_radiance_levels, 1)
constexpr Configuration() noexcept
{
set_runtime_reflection_radiance_resolution(runtime_reflection_radiance_resolution);
}
constexpr void set_runtime_reflection_radiance_resolution(const std::uint16_t r) noexcept
{
runtime_reflection_radiance_resolution = r;
runtime_reflection_radiance_levels = static_cast<std::uint8_t>(math::Numeric::floor_log2(r) - 2);
}
static int compute_runtime_reflection_radiance_levels(const int r) noexcept
{
#ifdef GX_DEBUG_MODE
if (r <= 0) {
GXLOGF("Resolution(" << r << ") can not be equal or less than zero.")
}
#endif
const auto l = math::Numeric::floor_log2(r);
#ifdef GX_DEBUG_MODE
if (l <= 2) {
GXLOGF("Logarithm of 2 of Resolution(" << r << ") = " << l << " can not be equal or less than 2.")
}
#endif
return l - 2;
}
};
}
#endif
| 43.734694
| 133
| 0.74475
|
Hossein-Noroozpour
|
856a8b2d450d1f93a9bdf07f813386f156422476
| 360
|
cc
|
C++
|
src/gb/utils/test.cc
|
jonatan-ekstrom/FreshBoy
|
228302e720f4a8fe4bf5c911e86588e412c0ce0a
|
[
"MIT"
] | 3
|
2021-11-30T20:37:33.000Z
|
2022-01-06T20:26:52.000Z
|
src/gb/utils/test.cc
|
jonatan-ekstrom/FreshBoy
|
228302e720f4a8fe4bf5c911e86588e412c0ce0a
|
[
"MIT"
] | null | null | null |
src/gb/utils/test.cc
|
jonatan-ekstrom/FreshBoy
|
228302e720f4a8fe4bf5c911e86588e412c0ce0a
|
[
"MIT"
] | null | null | null |
#include "types.h"
namespace {
/* Compile time test to verify that integers are at least 32-bits wide. */
using namespace gb;
constexpr uint BitCount() {
auto i{static_cast<uint>(-1)};
uint count{0};
while (i != 0) {
i >>= 1;
++count;
}
return count;
}
static_assert(BitCount() >= 32, "16-bit ints not supported.");
}
| 16.363636
| 74
| 0.594444
|
jonatan-ekstrom
|
856d5d809dcc6ae46e6a30adca8435263c6eb802
| 5,172
|
hpp
|
C++
|
lib/poplin/ConvolutionInternal.hpp
|
graphcore/poplibs
|
3fe5a3ecafe995eddb72675d1b4a7af8a622009e
|
[
"MIT"
] | 95
|
2020-07-06T17:11:23.000Z
|
2022-03-12T14:42:28.000Z
|
lib/poplin/ConvolutionInternal.hpp
|
graphcore/poplibs
|
3fe5a3ecafe995eddb72675d1b4a7af8a622009e
|
[
"MIT"
] | null | null | null |
lib/poplin/ConvolutionInternal.hpp
|
graphcore/poplibs
|
3fe5a3ecafe995eddb72675d1b4a7af8a622009e
|
[
"MIT"
] | 14
|
2020-07-15T12:32:57.000Z
|
2022-01-26T14:58:45.000Z
|
// Copyright (c) 2020 Graphcore Ltd. All rights reserved.
#ifndef _ConvolutionInternal_hpp_
#define _ConvolutionInternal_hpp_
#include "CanonicalConvParams.hpp"
#include "ConvOptions.hpp"
#include "ConvPlan.hpp"
#include <poplin/Convolution.hpp>
namespace poplin {
struct ConvProgramTree;
struct ConvIndices {
unsigned cg;
unsigned b;
std::vector<unsigned> out;
unsigned oc;
unsigned ic;
std::vector<unsigned> kernel;
};
struct ConvSlice {
unsigned cgBegin, cgEnd;
unsigned batchBegin, batchEnd;
std::vector<unsigned> outFieldBegin, outFieldEnd;
unsigned outChanBegin, outChanEnd;
unsigned inChanBegin, inChanEnd;
std::vector<unsigned> kernelBegin, kernelEnd;
unsigned getNumFieldDims() const { return outFieldBegin.size(); }
unsigned getNumConvGroups() const { return cgEnd - cgBegin; }
unsigned getBatchSize() const { return batchEnd - batchBegin; }
unsigned getNumOutputChans() const { return outChanEnd - outChanBegin; }
unsigned getNumInputChans() const { return inChanEnd - inChanBegin; }
unsigned getOutputSize(unsigned dim) const {
return outFieldEnd[dim] - outFieldBegin[dim];
}
unsigned getKernelSize(unsigned dim) const {
return kernelEnd[dim] - kernelBegin[dim];
}
};
poplar::Tensor createInput(poplar::Graph &graph, const Plan &plan,
const CanonicalConvParams ¶ms,
const poplar::DebugNameAndId &dnai,
const ConvOptions &options);
poplar::Tensor createWeights(poplar::Graph &graph, const Plan &plan,
const CanonicalConvParams ¶ms,
const poplar::DebugNameAndId &dnai,
const ConvOptions &options);
poplar::Tensor convolution(poplar::Graph &graph, const poplar::Tensor &in,
const poplar::Tensor &weights, const Plan &plan,
const CanonicalConvParams ¶ms,
bool transposeAndFlipWeights, ConvProgramTree &cpt,
const poplar::DebugNameAndId &dnai,
const ConvOptions &options);
void weightsTransposeChansFlipXY(poplar::Graph &graph,
const poplar::Tensor &weightsInUnGrouped,
const poplar::Tensor &weightsOutUnGrouped,
ConvProgramTree &cpt,
const poplar::DebugNameAndId &dnai);
poplar::Tensor
calculateWeightDeltas(poplar::Graph &graph, const poplar::Tensor &zDeltas_,
const poplar::Tensor &activations_, const Plan &wuPlan,
const CanonicalConvParams &wuParams, ConvProgramTree &cpt,
const poplar::DebugNameAndId &dnai,
const ConvOptions &wuOptions);
void convolutionWeightUpdate(poplar::Graph &graph,
const poplar::Tensor &zDeltas,
const poplar::Tensor &weights,
const poplar::Tensor &activations,
const Plan &plan, CanonicalConvParams params,
const poplar::Tensor &scale, ConvProgramTree &cpt,
const poplar::DebugNameAndId &dnai,
const ConvOptions &options);
void convolutionWeightUpdate(poplar::Graph &graph,
const poplar::Tensor &zDeltas,
const poplar::Tensor &weights,
const poplar::Tensor &activations,
const Plan &plan, CanonicalConvParams params,
float scale, ConvProgramTree &cpt,
const poplar::DebugNameAndId &dnai,
const ConvOptions &options);
// Required for expand dims planning, we don't intend to use graph as mutable,
// but it is deemed safe because it only adds extra compute sets. (we don't
// provide rearrange prog to add them to). We also are careful to pass a copy of
// the plan to this function.
// TODO: make version of this without requiring a mutable graph/plan
CanonicalConvParams
convolutionPreprocess(poplar::Graph &graph, const ConvParams ¶ms,
const ConvOptions &options, Plan &plan, unsigned level,
const std::vector<Split<ConvIndices>> &indices,
bool serial);
CanonicalConvParams getSubConvolution(const ConvSlice &slice,
const CanonicalConvParams &originalParams,
poplar::Tensor *in,
poplar::Tensor *weights);
void iteratePartitionParallel(
const CanonicalConvParams ¶ms, const Partition &partition,
const std::function<void(const ConvIndices &, const ConvSlice &)> &f);
poplar::Tensor sliceOutput(const poplar::Tensor &out, const ConvSlice &slice,
const unsigned convGroupsPerGroup,
const unsigned outChansPerGroup);
} // namespace poplin
#endif // _ConvolutionInternal_hpp_
| 43.462185
| 80
| 0.607695
|
graphcore
|
85701f1cad53f89ee8392100a78788862b8f9e2e
| 568
|
cpp
|
C++
|
mytools/asm/SymbolTable.cpp
|
kingnak/nand2tetris
|
120be8f04251b88e519f1bac838c40fd4c1b68e1
|
[
"MIT"
] | null | null | null |
mytools/asm/SymbolTable.cpp
|
kingnak/nand2tetris
|
120be8f04251b88e519f1bac838c40fd4c1b68e1
|
[
"MIT"
] | null | null | null |
mytools/asm/SymbolTable.cpp
|
kingnak/nand2tetris
|
120be8f04251b88e519f1bac838c40fd4c1b68e1
|
[
"MIT"
] | null | null | null |
#include "SymbolTable.h"
using namespace std;
void SymbolTable::addFixedEntry(const string &symbol, int16_t address)
{
m_map.insert(make_pair(symbol, address));
}
int16_t SymbolTable::addVariableEntry(const std::string &symbol)
{
m_map.insert(make_pair(symbol, m_nextVariable));
return m_nextVariable++;
}
bool SymbolTable::contains(const string &symbol) const
{
return m_map.find(symbol) != m_map.cend();
}
int16_t SymbolTable::getAddress(const string &symbol) const
{
auto it = m_map.find(symbol);
if (it == m_map.cend()) return -1;
return it->second;
}
| 21.037037
| 70
| 0.742958
|
kingnak
|
8572d407a4dd363db5f244fdc0af278010b6e859
| 7,484
|
hpp
|
C++
|
src/v8bind/class.hpp
|
ayles/V8Bind
|
1ed1bf8b87f9a1f52d510e4ece77f3ff17a944d1
|
[
"MIT"
] | 1
|
2021-12-30T15:08:40.000Z
|
2021-12-30T15:08:40.000Z
|
src/v8bind/class.hpp
|
ayles/V8Bind
|
1ed1bf8b87f9a1f52d510e4ece77f3ff17a944d1
|
[
"MIT"
] | 1
|
2020-02-05T21:52:17.000Z
|
2020-02-07T19:21:37.000Z
|
src/v8bind/class.hpp
|
ayles/v8bind
|
1ed1bf8b87f9a1f52d510e4ece77f3ff17a944d1
|
[
"MIT"
] | null | null | null |
//
// Created by selya on 01.09.2019.
//
#ifndef SANDWICH_V8B_CLASS_HPP
#define SANDWICH_V8B_CLASS_HPP
#include <v8bind/type_info.hpp>
#include <v8.h>
#include <unordered_map>
#include <type_traits>
#include <memory>
#include <vector>
#include <cstddef>
#include <tuple>
#define V8B_IMPL inline
namespace v8b {
class PointerManager {
friend class ClassManager;
protected:
virtual void EndObjectManage(void *ptr) = 0;
public:
template<typename T>
static std::enable_if_t<std::is_base_of_v<PointerManager, T>, T &> GetInstance() {
static T instance;
return instance;
}
};
class ClassManager : public PointerManager {
public:
const TypeInfo type_info;
using ConstructorFunction = void * (*)(const v8::FunctionCallbackInfo<v8::Value> &);
using DestructorFunction = void (*)(v8::Isolate *, void *);
ClassManager(v8::Isolate *isolate, const TypeInfo &type_info);
~ClassManager();
// Delete unwanted constructors and operators
ClassManager(const ClassManager &) = delete;
ClassManager &operator=(const ClassManager &) = delete;
ClassManager &operator=(ClassManager &&) = delete;
// Leave constructor with move semantics
ClassManager(ClassManager &&) = default;
void RemoveObject(void *ptr);
void RemoveObjects();
v8::Local<v8::Object> FindObject(void *ptr) const;
v8::Local<v8::Object> WrapObject(void *ptr, bool take_ownership);
v8::Local<v8::Object> WrapObject(void *ptr, PointerManager *pointer_manager);
void SetPointerManager(void *ptr, PointerManager *pointer_manager);
void *UnwrapObject(v8::Local<v8::Value> value);
[[nodiscard]]
v8::Local<v8::FunctionTemplate> GetFunctionTemplate() const;
void SetBase(const TypeInfo &type_info,
void *(*base_to_this)(void *), void *(*this_to_base)(void *));
void SetConstructor(ConstructorFunction constructor_function);
void SetDestructor(DestructorFunction destructor_function);
void SetAutoWrap(bool auto_wrap = true);
[[nodiscard]]
bool IsAutoWrapEnabled() const;
[[nodiscard]]
v8::Isolate *GetIsolate() const;
protected:
void EndObjectManage(void *ptr) override;
private:
struct WrappedObject {
void *ptr;
v8::Global<v8::Object> wrapped_object;
PointerManager *pointer_manager;
};
WrappedObject &FindWrappedObject(void *ptr, void **base_ptr_ptr = nullptr) const;
void ResetObject(WrappedObject &object);
std::unordered_map<void *, WrappedObject> objects;
v8::Isolate *isolate;
v8::Persistent<v8::FunctionTemplate> function_template;
ConstructorFunction constructor_function;
DestructorFunction destructor_function;
struct BaseClassInfo {
ClassManager *base_class_manager = nullptr;
void *(*base_to_this)(void *) = nullptr;
void *(*this_to_base)(void *) = nullptr;
};
BaseClassInfo base_class_info;
std::vector<ClassManager *> derived_class_managers;
bool auto_wrap;
};
class ClassManagerPool {
public:
template<typename T>
static ClassManager &Get(v8::Isolate *isolate);
static ClassManager &Get(v8::Isolate *isolate, const TypeInfo &type_info);
static void Remove(v8::Isolate *isolate, const TypeInfo &type_info);
static void RemoveAll(v8::Isolate *isolate);
private:
std::vector<std::unique_ptr<ClassManager>> managers;
static std::unordered_map<v8::Isolate *, ClassManagerPool> pools;
static ClassManagerPool &GetInstance(v8::Isolate *isolate);
static void RemoveInstance(v8::Isolate *isolate);
};
template<typename T>
class Class {
ClassManager &class_manager;
public:
explicit Class(v8::Isolate *isolate);
// Set this as inherited from B
template<typename B>
Class &Inherit();
// Set constructor signatures as tuples of arguments
template<typename ...Args>
Class &Constructor();
// Set factory functions
template<typename ...F>
Class &Constructor(F&&... f);
template<typename U>
Class &InnerClass(const std::string &name, const v8b::Class<U> &cl);
template<typename U>
Class &Value(const std::string &name, U &&value);
template<typename U>
Class &Const(const std::string &name, U &&value);
template<typename Member>
Class &Var(const std::string &name, Member &&ptr);
template<typename Getter, typename Setter = std::nullptr_t>
Class &Property(const std::string &name, Getter &&getter, Setter &&setter = nullptr);
template<typename Getter, typename Setter = std::nullptr_t>
Class &Indexer(Getter &&getter, Setter &&setter = nullptr);
template<typename ...F>
Class &Function(const std::string &name, F&&... f);
template<typename U>
Class &StaticValue(const std::string &name, U &&value);
template<typename U>
Class &StaticConst(const std::string &name, U &&value);
template<typename V>
Class &StaticVar(const std::string &name, V &&v);
template<typename Getter, typename Setter = std::nullptr_t>
Class &StaticProperty(const std::string &name, Getter &&getter, Setter &&setter = nullptr);
template<typename ...F>
Class &StaticFunction(const std::string &name, F&&... f);
Class &AutoWrap(bool auto_wrap = true);
[[nodiscard]]
v8::Local<v8::FunctionTemplate> GetFunctionTemplate() const;
static T *UnwrapObject(v8::Isolate *isolate, v8::Local<v8::Value> value);
static v8::Local<v8::Object> WrapObject(v8::Isolate *isolate, T *ptr, bool take_ownership);
static v8::Local<v8::Object> WrapObject(v8::Isolate *isolate, T *ptr, PointerManager *pointer_manager);
static v8::Local<v8::Object> FindObject(v8::Isolate *isolate, T *ptr);
static void SetPointerManager(v8::Isolate *isolate, T *ptr, PointerManager *pointerManager);
private:
static bool initialized;
};
template<typename T>
class SharedPointerManager : public PointerManager {
std::unordered_map<T *, std::shared_ptr<T>> pointers;
public:
V8B_IMPL static v8::Local<v8::Object> WrapObject(v8::Isolate *isolate, const std::shared_ptr<T> &ptr) {
auto &instance = PointerManager::GetInstance<SharedPointerManager>();
auto res = Class<T>::WrapObject(isolate, ptr.get(), &instance);
instance.pointers.emplace(ptr.get(), ptr);
return res;
}
V8B_IMPL static v8::Local<v8::Object> FindObject(v8::Isolate *isolate, const std::shared_ptr<T> &ptr) {
auto &instance = PointerManager::GetInstance<SharedPointerManager>();
auto object = Class<T>::FindObject(isolate, ptr.get());
if (instance.pointers.find(ptr.get()) == instance.pointers.end()) {
Class<T>::SetPointerManager(isolate, ptr.get(), &instance);
instance.pointers.emplace(ptr.get(), ptr);
}
return object;
}
V8B_IMPL static std::shared_ptr<T> UnwrapObject(v8::Isolate *isolate, v8::Local<v8::Value> value) {
auto &instance = PointerManager::GetInstance<SharedPointerManager>();
auto ptr = Class<T>::UnwrapObject(isolate, value);
if (instance.pointers.find(ptr) == instance.pointers.end()) {
Class<T>::SetPointerManager(isolate, ptr, &instance);
instance.pointers.emplace(ptr, std::shared_ptr<T>(ptr));
}
return instance.pointers.find(ptr)->second;
}
protected:
V8B_IMPL void EndObjectManage(void *ptr) override {
pointers.erase(static_cast<T *>(ptr));
}
};
}
#endif //SANDWICH_V8B_CLASS_HPP
| 30.672131
| 107
| 0.685863
|
ayles
|
85750cdbde250c45b6e2d90232d5dc0ee76e96d3
| 97
|
hpp
|
C++
|
led-blink/src/main.hpp
|
ikapoz/stm32
|
9efc2a099f55bddaf85b68cc51fb6a31b48538b7
|
[
"MIT"
] | null | null | null |
led-blink/src/main.hpp
|
ikapoz/stm32
|
9efc2a099f55bddaf85b68cc51fb6a31b48538b7
|
[
"MIT"
] | null | null | null |
led-blink/src/main.hpp
|
ikapoz/stm32
|
9efc2a099f55bddaf85b68cc51fb6a31b48538b7
|
[
"MIT"
] | null | null | null |
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
int app_main();
#ifdef __cplusplus
}
#endif
| 9.7
| 18
| 0.721649
|
ikapoz
|
8577dbdb44873d3aeac351497f36cae3f4e7427f
| 7,204
|
cpp
|
C++
|
build/moc/moc_QGeoMapReplyQGC.cpp
|
UNIST-ESCL/UNIST_GCS
|
f61f0c12bbb028869e4494f507ea8ab52c8c79c2
|
[
"Apache-2.0"
] | 1
|
2018-11-07T06:10:53.000Z
|
2018-11-07T06:10:53.000Z
|
build/moc/moc_QGeoMapReplyQGC.cpp
|
UNIST-ESCL/UNIST_GCS
|
f61f0c12bbb028869e4494f507ea8ab52c8c79c2
|
[
"Apache-2.0"
] | null | null | null |
build/moc/moc_QGeoMapReplyQGC.cpp
|
UNIST-ESCL/UNIST_GCS
|
f61f0c12bbb028869e4494f507ea8ab52c8c79c2
|
[
"Apache-2.0"
] | 1
|
2018-11-07T06:10:47.000Z
|
2018-11-07T06:10:47.000Z
|
/****************************************************************************
** Meta object code from reading C++ file 'QGeoMapReplyQGC.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../src/QtLocationPlugin/QGeoMapReplyQGC.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'QGeoMapReplyQGC.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_QGeoTiledMapReplyQGC_t {
QByteArrayData data[16];
char stringdata0[208];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QGeoTiledMapReplyQGC_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QGeoTiledMapReplyQGC_t qt_meta_stringdata_QGeoTiledMapReplyQGC = {
{
QT_MOC_LITERAL(0, 0, 20), // "QGeoTiledMapReplyQGC"
QT_MOC_LITERAL(1, 21, 11), // "terrainDone"
QT_MOC_LITERAL(2, 33, 0), // ""
QT_MOC_LITERAL(3, 34, 13), // "responseBytes"
QT_MOC_LITERAL(4, 48, 27), // "QNetworkReply::NetworkError"
QT_MOC_LITERAL(5, 76, 5), // "error"
QT_MOC_LITERAL(6, 82, 20), // "networkReplyFinished"
QT_MOC_LITERAL(7, 103, 17), // "networkReplyError"
QT_MOC_LITERAL(8, 121, 10), // "cacheReply"
QT_MOC_LITERAL(9, 132, 13), // "QGCCacheTile*"
QT_MOC_LITERAL(10, 146, 4), // "tile"
QT_MOC_LITERAL(11, 151, 10), // "cacheError"
QT_MOC_LITERAL(12, 162, 20), // "QGCMapTask::TaskType"
QT_MOC_LITERAL(13, 183, 4), // "type"
QT_MOC_LITERAL(14, 188, 11), // "errorString"
QT_MOC_LITERAL(15, 200, 7) // "timeout"
},
"QGeoTiledMapReplyQGC\0terrainDone\0\0"
"responseBytes\0QNetworkReply::NetworkError\0"
"error\0networkReplyFinished\0networkReplyError\0"
"cacheReply\0QGCCacheTile*\0tile\0cacheError\0"
"QGCMapTask::TaskType\0type\0errorString\0"
"timeout"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QGeoTiledMapReplyQGC[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
6, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 2, 44, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 0, 49, 2, 0x08 /* Private */,
7, 1, 50, 2, 0x08 /* Private */,
8, 1, 53, 2, 0x08 /* Private */,
11, 2, 56, 2, 0x08 /* Private */,
15, 0, 61, 2, 0x08 /* Private */,
// signals: parameters
QMetaType::Void, QMetaType::QByteArray, 0x80000000 | 4, 3, 5,
// slots: parameters
QMetaType::Void,
QMetaType::Void, 0x80000000 | 4, 5,
QMetaType::Void, 0x80000000 | 9, 10,
QMetaType::Void, 0x80000000 | 12, QMetaType::QString, 13, 14,
QMetaType::Void,
0 // eod
};
void QGeoTiledMapReplyQGC::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QGeoTiledMapReplyQGC *_t = static_cast<QGeoTiledMapReplyQGC *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->terrainDone((*reinterpret_cast< QByteArray(*)>(_a[1])),(*reinterpret_cast< QNetworkReply::NetworkError(*)>(_a[2]))); break;
case 1: _t->networkReplyFinished(); break;
case 2: _t->networkReplyError((*reinterpret_cast< QNetworkReply::NetworkError(*)>(_a[1]))); break;
case 3: _t->cacheReply((*reinterpret_cast< QGCCacheTile*(*)>(_a[1]))); break;
case 4: _t->cacheError((*reinterpret_cast< QGCMapTask::TaskType(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
case 5: _t->timeout(); break;
default: ;
}
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QNetworkReply::NetworkError >(); break;
}
break;
case 2:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QNetworkReply::NetworkError >(); break;
}
break;
case 3:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QGCCacheTile* >(); break;
}
break;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
typedef void (QGeoTiledMapReplyQGC::*_t)(QByteArray , QNetworkReply::NetworkError );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QGeoTiledMapReplyQGC::terrainDone)) {
*result = 0;
return;
}
}
}
}
const QMetaObject QGeoTiledMapReplyQGC::staticMetaObject = {
{ &QGeoTiledMapReply::staticMetaObject, qt_meta_stringdata_QGeoTiledMapReplyQGC.data,
qt_meta_data_QGeoTiledMapReplyQGC, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QGeoTiledMapReplyQGC::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QGeoTiledMapReplyQGC::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QGeoTiledMapReplyQGC.stringdata0))
return static_cast<void*>(this);
return QGeoTiledMapReply::qt_metacast(_clname);
}
int QGeoTiledMapReplyQGC::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QGeoTiledMapReply::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 6)
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 6)
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
}
return _id;
}
// SIGNAL 0
void QGeoTiledMapReplyQGC::terrainDone(QByteArray _t1, QNetworkReply::NetworkError _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| 37.520833
| 143
| 0.619933
|
UNIST-ESCL
|