blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2 values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905 values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 10.4M | extension stringclasses 115 values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a656a25a4886bd4d01432b35069c967472035d44 | 0e89641c4b79034acbac26db1855ed71105abb47 | /cpp/fcs/examples/vgroup/c_inl.hpp | 46a567b9dec8bb6783d07542435035970d1baf79 | [] | no_license | patefacio/codegen | 25f9af2e8fc21ae6df492110f12ca9e9e9b58f41 | 17fc8829804c4a4bb7e1efd653e6e20c1e585bfc | refs/heads/master | 2016-09-06T10:33:42.599798 | 2013-05-29T13:58:44 | 2013-05-29T13:58:44 | 7,753,270 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,111 | hpp | /******************************************************************************
* c_inl.hpp
*
* Copyright (c) Daniel Davidson
*
* Distributed under the Boost Software License
* (http://www.boost.org/LICENSE_1_0.txt)
*******************************************************************************/
/*!
* \file c_inl.hpp
*
* \brief
*
*/
#ifndef _FCS_EXAMPLES_VGROUP_C_INL_H_
#define _FCS_EXAMPLES_VGROUP_C_INL_H_
#include <pantheios/pantheios.hpp>
#include "fcs/examples/vgroup/c.hpp"
namespace fcs {
namespace examples {
namespace vgroup {
inline void
C::observe(int i, char const * s) {
// custom <observe impl>
// end <observe impl>
pantheios::log(PANTHEIOS_SEV_DEBUG, "C::observe");
}
inline void
C::do_good(int i) {
// custom <do_good impl>
// end <do_good impl>
pantheios::log(PANTHEIOS_SEV_DEBUG, "C::do_good");
}
inline void
C::do_bad(int i) {
// custom <do_bad impl>
// end <do_bad impl>
pantheios::log(PANTHEIOS_SEV_DEBUG, "C::do_bad");
}
} // namespace vgroup
} // namespace examples
} // namespace fcs
#endif // _FCS_EXAMPLES_VGROUP_C_INL_H_
| [
"dbdavidson@yahoo.com"
] | dbdavidson@yahoo.com |
5c4709c46c9c7d64671b3a040879a796b8416f5e | 1235c262c1d0c872d8ea76b9298aa21f297557ad | /src/checkpoints.cpp | 930180194cf3774d5ea8539624622b8b0266eb0b | [
"MIT"
] | permissive | kyonetca/potcoin | b100d45faf29eea5bf6d304b2fb502b544d0e77d | 99fe734668ae3af37ff810467cc5b012dabc5dc3 | refs/heads/master | 2021-01-22T02:08:33.479357 | 2014-04-05T05:46:51 | 2014-04-05T05:46:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,626 | cpp | // Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>
#include "checkpoints.h"
#include "main.h"
#include "uint256.h"
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
// How many times we expect transactions after the last checkpoint to
// be slower. This number is a compromise, as it can't be accurate for
// every system. When reindexing from a fast disk with a slow CPU, it
// can be up to 20, while when downloading from a slow network with a
// fast multicore CPU, it won't be much higher than 1.
static const double fSigcheckVerificationFactor = 5.0;
struct CCheckpointData {
const MapCheckpoints *mapCheckpoints;
int64 nTimeLastCheckpoint;
int64 nTransactionsLastCheckpoint;
double fTransactionsPerDay;
};
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 10, uint256("0xc2818dc9bf6fd7fb692cc0886d39a724bb4e86fad095a62266bd015b9fbae04f"))
( 17, uint256("0x6c8818dd77bcaee6c3c775a34c0a84f349cc4db99e2c8b40ed7adb83b0184606"))
( 22, uint256("0x592cc1502043365de34d8c806fa2355e8f2ca47bfd568812c77547b4b72df744"))
( 27, uint256("0x49fc54fa7fe3939e57b83a468cb40333177b8e1ae1648a641ccc79d47ca68834"))
( 35, uint256("0x697905a9b6822eb09a6e3eecb82133cde24f15e5c400368b65bdc9b2cc7943c7"))
( 50, uint256("0x6a5411cbcbe8d69dd3cc85af05ad7439fc2c02acd8d5861471ea32a1b59ce271"))
//( 80000, uint256("0x4fcb7c02f676a300503f49c764a89955a8f920b46a8cbecb4867182ecdb2e90a"))
//(120000, uint256("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131"))
//(161500, uint256("0xdbe89880474f4bb4f75c227c77ba1cdc024991123b28b8418dbbf7798471ff43"))
//(179620, uint256("0x2ad9c65c990ac00426d18e446e0fd7be2ffa69e9a7dcb28358a50b2b78b9f709"))
//(240000, uint256("0x7140d1c4b4c2157ca217ee7636f24c9c73db39c4590c4e6eab2e3ea1555088aa"))
//(383640, uint256("0x2b6809f094a9215bafc65eb3f110a35127a34be94b7d0590a096c3f126c6f364"))
//(409004, uint256("0x487518d663d9f1fa08611d9395ad74d982b667fbdc0e77e9cf39b4f1355908a3"))
//(456000, uint256("0xbf34f71cc6366cd487930d06be22f897e34ca6a40501ac7d401be32456372004"))
;
static const CCheckpointData data = {
&mapCheckpoints,
1389838908, // * UNIX timestamp of last checkpoint block
50, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
8000.0 // * estimated number of transactions per day after checkpoint
};
static MapCheckpoints mapCheckpointsTestnet =
boost::assign::map_list_of
( 546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
;
static const CCheckpointData dataTestnet = {
&mapCheckpointsTestnet,
1369685559,
37581,
300
};
const CCheckpointData &Checkpoints() {
if (fTestNet)
return dataTestnet;
else
return data;
}
bool CheckBlock(int nHeight, const uint256& hash)
{
if (fTestNet) return true; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return true;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
if (i == checkpoints.end()) return true;
return hash == i->second;
//return true;
}
// Guess how far we are in the verification process at the given block index
double GuessVerificationProgress(CBlockIndex *pindex) {
if (pindex==NULL)
return 0.0;
int64 nNow = time(NULL);
double fWorkBefore = 0.0; // Amount of work done before pindex
double fWorkAfter = 0.0; // Amount of work left after pindex (estimated)
// Work is defined as: 1.0 per transaction before the last checkoint, and
// fSigcheckVerificationFactor per transaction after.
const CCheckpointData &data = Checkpoints();
if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
double nCheapBefore = pindex->nChainTx;
double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
fWorkBefore = nCheapBefore;
fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
} else {
double nCheapBefore = data.nTransactionsLastCheckpoint;
double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
double nExpensiveAfter = (nNow - pindex->nTime)/86400.0*data.fTransactionsPerDay;
fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
}
return fWorkBefore / (fWorkBefore + fWorkAfter);
}
int GetTotalBlocksEstimate()
{
if (fTestNet) return 0; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return 0;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
return checkpoints.rbegin()->first;
//return 0;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
if (fTestNet) return NULL; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return NULL;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
//return NULL;
}
return NULL;
}
}
| [
"dev@potcoin.info"
] | dev@potcoin.info |
02cb389ca81f38509d526905d3c30e92cc66b689 | 1a20961af3b03b46c109b09812143a7ef95c6caa | /ZGame/DX11/hieroglyph3/trunk/Hieroglyph3/Extensions/GlyphRift/ViewRift.cpp | 103e6fdd186676c9b37f5715aafdc01f6ca561bc | [
"MIT"
] | permissive | JetAr/ZNginx | eff4ae2457b7b28115787d6af7a3098c121e8368 | 698b40085585d4190cf983f61b803ad23468cdef | refs/heads/master | 2021-07-16T13:29:57.438175 | 2017-10-23T02:05:43 | 2017-10-23T02:05:43 | 26,522,265 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,305 | cpp | //--------------------------------------------------------------------------------
// This file is a portion of the Hieroglyph 3 Rendering Engine. It is distributed
// under the MIT License, available in the root of this distribution and
// at the following URL:
//
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) Jason Zink
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
#include "GlyphRift/ViewRift.h"
#include "Entity3D.h"
#include "Scene.h"
#include "Texture2dConfigDX11.h"
#include "Log.h"
#include "IParameterManager.h"
#include "PipelineManagerDX11.h"
#include "Texture2dDX11.h"
#include "BoundsVisualizerActor.h"
#include "SceneGraph.h"
//--------------------------------------------------------------------------------
using namespace Glyph3;
//--------------------------------------------------------------------------------
ViewRift::ViewRift( RiftHMDPtr hmd, ResourcePtr RenderTarget, int SwapChain ) :
m_pHmd( hmd )
{
// Get the desired texture sizes for the eye render targets. Note that these
// are typically larger than the resolution of the HMD's display panel itself.
unsigned int width = m_pHmd->DesiredEyeTextureWidth();
unsigned int height = m_pHmd->DesiredEyeTextureHeight();
// Create a single depth buffer, which will be used in rendering the scene
// into each eye.
Texture2dConfigDX11 depthConfig;
depthConfig.SetDepthBuffer( width, height );
m_DepthTarget = RendererDX11::Get()->CreateTexture2D( &depthConfig, 0 );
// Read back the actual size of the texture created for use in the other
// setup functions below.
D3D11_TEXTURE2D_DESC desc = RendererDX11::Get()->GetTexture2DByIndex( m_DepthTarget->m_iResource )->GetActualDescription();
// Create a view port to use on the scene. Since they are the exact same
// for both eyes, we can just use one viewport.
D3D11_VIEWPORT viewport;
viewport.Width = static_cast< float >( desc.Width );
viewport.Height = static_cast< float >( desc.Height );
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
viewport.TopLeftX = 0.0f;
viewport.TopLeftY = 0.0f;
m_iViewports[0] = RendererDX11::Get()->CreateViewPort( viewport );
// Configure the rendering for the rift's eye textures. This is not dependent
// on the swap chain size, but we provide the option to limit the resolution
// for the eye textures here. Default values are 2048 x 2048, essentially
// allowing whatever the rift requests.
m_pHmd->ConfigureRendering( );
// Set up the projection matrices according to the FOV for each eye. These
// can be calculated once and then reused as long as the FOV is not changed
// during runtime.
m_proj[0] = m_pHmd->GetPerspectiveFov( 0, 0.01f, 10000.0f );
m_proj[1] = m_pHmd->GetPerspectiveFov( 1, 0.01f, 10000.0f );
}
//--------------------------------------------------------------------------------
ViewRift::~ViewRift()
{
}
//--------------------------------------------------------------------------------
void ViewRift::Update( float fTime )
{
}
//--------------------------------------------------------------------------------
void ViewRift::QueuePreTasks( RendererDX11* pRenderer )
{
if ( m_pEntity != NULL )
{
Matrix4f view = m_pEntity->Transform.GetView();
SetViewMatrix( view );
}
// Queue this view into the renderer for processing.
pRenderer->QueueTask( this );
if ( m_pScene )
{
// Run through the graph and pre-render the entities
m_pScene->PreRender( pRenderer, VT_PERSPECTIVE );
}
}
//--------------------------------------------------------------------------------
void ViewRift::ExecuteTask( PipelineManagerDX11* pPipelineManager, IParameterManager* pParamManager )
{
// Here we assume that the ovrHmd_BeginFrame function has already been called
// by the application at the beginning of the rendering phase. The
// application will also call the ovrHmd_EndFrame function after all rendering
// is completed.
if ( m_pScene )
{
// Configure the desired viewports in this pipeline. This state is the
// same for both eyes, so we pull it out of the loop.
ConfigureViewports( pPipelineManager );
for ( unsigned int eye = 0; eye < 2; ++eye )
{
// Set up the view matrices for this eye. This starts by getting the
// view matrix from the node that this view's entity is attached to.
// That represents the camera's node (instead of its body). We then apply
// the eye's spatial state (including position and orientation) to that
// parent location.
//
// NOTE: This view's entity location and orientation is updated according
// to the Rift's *head* location. That provides an approximate location
// for using to visualize the location of the rift in world space.
// This is why we need to grab the parent's view - the eye matrices are
// in relation to the whole rift, as opposed to relative to the head.
Matrix4f centerView = m_pEntity->GetParent()->Transform.GetView();
m_view[eye] = centerView * m_pHmd->GetEyeSpatialState( eye );
// Set the parameters for rendering this view
pPipelineManager->ClearRenderTargets();
pPipelineManager->OutputMergerStage.DesiredState.RenderTargetViews.SetState( 0, m_pHmd->GetEyeTexture(eye)->m_iResourceRTV );
pPipelineManager->OutputMergerStage.DesiredState.DepthTargetViews.SetState( m_DepthTarget->m_iResourceDSV );
pPipelineManager->ApplyRenderTargets();
pPipelineManager->ClearBuffers( m_vColor, 1.0f );
// Set this view's render parameters
SetViewMatrix( m_view[eye] );
SetProjMatrix( m_proj[eye] );
SetRenderParams( pParamManager );
// Set the light parameters (currently only supporting the first light...)
if ( m_pScene->GetLightCount() > 0 )
{
m_pScene->GetLight( 0 )->Parameters.SetRenderParams( pParamManager );
}
// Run through the graph and render each of the entities. This will sort the entities
// based on whether or not they are transparent.
std::vector<Entity3D*> entity_list;
GetAllEntities( m_pScene->GetRoot(), entity_list );
auto const transparent_check = []( Entity3D* entity)
{
return entity->Visual.iPass != Renderable::ALPHA;
};
// We use stable partition to sort, and return the first transparent entity.
auto const iter_first_alpha = std::stable_partition(begin(entity_list), end(entity_list), transparent_check);
// Now we can render all entities in the sorted order.
for ( auto& entity : entity_list )
{
entity->Render( pPipelineManager, pParamManager, VT_PERSPECTIVE );
}
// If the debug view is enabled, then we can render some additional scene
// related information as an overlay on this view. Note that this is
// accomplished without the actor being attached to the scene!
if ( m_bDebugViewEnabled )
{
std::vector<Entity3D*> list;
GetAllEntities( m_pScene->GetRoot(), list );
m_pDebugVisualizer->UpdateBoundsData( list );
m_pDebugVisualizer->GetBody()->Render( pPipelineManager, pParamManager, VT_PERSPECTIVE );
}
}
}
}
//--------------------------------------------------------------------------------
void ViewRift::Resize( UINT width, UINT height )
{
// These sizes are determined by the Rift Headset, and should not change
// with window size changes.
}
//--------------------------------------------------------------------------------
std::wstring ViewRift::GetName()
{
return( L"ViewRift" );
}
//--------------------------------------------------------------------------------
| [
"126.org@gmail.com"
] | 126.org@gmail.com |
08856ff1985867b58eb05fc178401e2d9b14e364 | 88ed9abde9b457e5f2b3f59143705e93294c0f74 | /l5/stack/count/lock_free (копия).h | 976572303760b4b7876b466e678ed139884882bf | [] | no_license | ZonDBeer/_PCT | f41ad2a1033aa128385fb02769d137b95e15a585 | c83d5ac6eeb1206a8fb7359662bdf6919d286ddf | refs/heads/master | 2020-03-19T03:03:21.371622 | 2018-06-01T08:26:08 | 2018-06-01T08:26:08 | 135,689,780 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,898 | h | template <typename T>
class lock_free_queue
{
private:
struct node;
struct counted_node_ptr
{
int external_count;
node* ptr;
};
std::atomic<counted_node_ptr> head;
std::atomic<counted_node_ptr> tail;
struct node_counter
{
unsigned internal_count:30;
unsigned external_counters:2;
};
struct node
{
std::atomic<T*> data;
std::atomic<node_counter> count;
std::atomic<counted_node_ptr> next;
node() : data(0) {
node_counter new_count;
new_count.internal_count = 0;
new_count.external_counters = 2;
count.store(new_count);
counted_node_ptr next_counted_node = { 0, 0 };
next.store(next_counted_node);
}
void release_ref(){
node_counter old_counter = count.load();
node_counter new_counter;
do {
new_counter = old_counter;
--new_counter.internal_count;
} while (!count.compare_exchange_strong(old_counter, new_counter));
if(!new_counter.internal_count && !new_counter.external_counters) {
delete this;
}
}
};
void set_new_tail(counted_node_ptr &old_tail, counted_node_ptr const &new_tail) {
node* const current_tail_ptr = old_tail.ptr;
while(!tail.compare_exchange_weak(old_tail, new_tail) &&
old_tail.ptr == current_tail_ptr);
if(old_tail.ptr == current_tail_ptr)
free_external_counter(old_tail);
else
current_tail_ptr -> release_ref();
}
static void free_external_counter(counted_node_ptr &old_node_ptr) {
node* const ptr = old_node_ptr.ptr;
int const count_increase = old_node_ptr.external_count - 2;
node_counter old_counter = ptr -> count.load();
node_counter new_counter;
do {
new_counter = old_counter;
--new_counter.external_counters;
new_counter.internal_count += count_increase;
} while(!ptr -> count.compare_exchange_strong(old_counter, new_counter));
if(!new_counter.internal_count && !new_counter.external_counters){
delete ptr;
}
}
static void increase_external_count(std::atomic<counted_node_ptr>& counter,
counted_node_ptr& old_counter)
{
counted_node_ptr new_counter;
do {
new_counter = old_counter;
++new_counter.external_count;
} while (!counter.compare_exchange_strong(old_counter, new_counter));
old_counter.external_count = new_counter.external_count;
}
public:
lock_free_queue() {
counted_node_ptr new_counted_node;
new_counted_node.external_count = 1;
new_counted_node.ptr = new node;
head.store(new_counted_node);
tail.store(new_counted_node);
}
lock_free_queue(const lock_free_queue& other) = delete;
~lock_free_queue(){
T val;
while (pop());
}
std::unique_ptr<T> pop() {
counted_node_ptr old_head = head.load();
for(;;) {
increase_external_count(head, old_head);
node* const ptr = old_head.ptr;
if(ptr == tail.load().ptr) {
return std::unique_ptr<T>();
}
counted_node_ptr next = ptr -> next.load();
if(head.compare_exchange_strong(old_head, next)) {
T* const res = ptr -> data.exchange(nullptr);
free_external_counter(old_head);
return std::unique_ptr<T>(res);
}
ptr -> release_ref();
}
}
void push(T new_value) {
std::unique_ptr<T> new_data(new T(new_value));
counted_node_ptr new_next;
new_next.ptr = new node;
new_next.external_count = 1;
counted_node_ptr old_tail = tail.load();
for(;;) {
increase_external_count(tail, old_tail);
T* old_data = nullptr;
if(old_tail.ptr -> data.compare_exchange_strong(old_data, new_data.get())) {
counted_node_ptr old_next = {0};
if(!old_tail.ptr -> next.compare_exchange_strong(old_next, new_next)) {
delete new_next.ptr;
new_next = old_next;
}
set_new_tail(old_tail, new_next);
new_data.release();
break;
} else {
counted_node_ptr old_next = {0};
if(old_tail.ptr -> next.compare_exchange_strong(old_next, new_next)) {
old_next = new_next;
new_next.ptr = new node;
}
set_new_tail(old_tail, old_next);
}
}
}
};
| [
"vlad-z7x@mail.ru"
] | vlad-z7x@mail.ru |
7ab0c99f5cae422414c72daf12dcbc7f9e78faa3 | 3b411b513f5d43aa3094cd5ae406c7ebd63a079c | /src/tlb2h/std.h | 9dfda5c4d35961ccee9749be08fec511b8afa7dd | [] | no_license | dbremner/comet | 17752230ec5998ab962a3f6631bd645d146a5328 | 434e893426dbbfca000a53e342226e17ad223ddf | refs/heads/master | 2021-01-22T20:55:26.139527 | 2015-10-05T04:21:31 | 2015-10-05T04:21:31 | 42,421,800 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,719 | h | #pragma once
/*
* Copyright © 2000, 2001 Sofus Mortensen, Michael Geddes
*
* This material is provided "as is", with absolutely no warranty
* expressed or implied. Any use is at your own risk. Permission to
* use or copy this software for any purpose is hereby granted without
* fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is
* granted, provided the above notices are retained, and a notice that
* the code was modified is included with the above copyright notice.
*/
//#define _STLP_NO_OWN_IOSTREAMS
// Make sure there is no stlport .dll dependence - either use the provide
// iostreams or use stlport's staticx library.
#if !defined(_STLP_NO_OWN_IOSTREAMS) && !defined(_STLP_USE_STATIC_LIB)
#define _STLP_USE_STATIC_LIB
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#pragma warning( disable : 4786 )
#include <comdef.h>
#include <comutil.h>
#include <crtdbg.h>
#undef IMPLTYPEFLAG_FDEFAULT
#undef IMPLTYPEFLAG_FSOURCE
#undef IMPLTYPEFLAG_FRESTRICTED
#undef IMPLTYPEFLAG_FDEFAULTVTABLE
#undef IDLFLAG_NONE
#undef IDLFLAG_FIN
#undef IDLFLAG_FOUT
#undef IDLFLAG_FLCID
#undef IDLFLAG_FRETVAL
#undef PARAMFLAG_NONE
#undef PARAMFLAG_FIN
#undef PARAMFLAG_FOUT
#undef PARAMFLAG_FLCID
#undef PARAMFLAG_FRETVAL
#undef PARAMFLAG_FOPT
#undef PARAMFLAG_FHASDEFAULT
#undef PARAMFLAG_FHASCUSTDATA
#import <tlbinf32.dll> exclude("_DirectCalls")
#include <iostream>
#include <fstream>
#include <map>
#include <vector>
#include <list>
#include <sstream>
#include <stack>
#include <set>
#include <string>
| [
"sofusmortensen@localhost"
] | sofusmortensen@localhost |
1c263b51b7fb0c3fcd561008c88a47925f5cc7b6 | ea4c64185ef9c5bd32fa0beb6c6e12edd442622f | /MineEngine/Include/fontshaderclass.h | f6fd74e20f227be0c39238adf9ece0bf55907dec | [] | no_license | RumbleJack/DirectXDemo | 0571a5d40c29224a834bdfc4c75a76593a365de5 | 1e5c6db3923ee70b59814ff7288c4a7ce26b2fee | refs/heads/master | 2020-03-14T23:25:00.545381 | 2018-05-04T18:27:23 | 2018-05-04T18:27:23 | 131,844,514 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,343 | h | // 文件名: fontshaderclass.h
#ifndef _FONTSHADERCLASS_H_
#define _FONTSHADERCLASS_H_
// 类名: FontShaderClass
class DllExport FontShaderClass
{
private:
struct ConstantVertexBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct ConstPSBufferType
{
XMFLOAT4 pixelColor;
};
public:
FontShaderClass();
FontShaderClass(const FontShaderClass&);
~FontShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext* deviceContext, int indexCount,
XMMATRIX worldMatrix, XMMATRIX viewMatrix,XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture,
XMFLOAT4 pixelColor);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
void RenderShader(ID3D11DeviceContext*, int);
private:
// 着色器
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
// 着色器输入参数布局
ID3D11InputLayout* m_layout;
// 着色器常量缓冲
ID3D11Buffer* m_constantVertexBuffer;
ID3D11Buffer* m_pixelColorBuffer;
// 采样器状态,传递像素着色器采样状态
ID3D11SamplerState* m_sampleState;
};
#endif | [
"renjiewen1995@163.com"
] | renjiewen1995@163.com |
3d6b0ee3920a41ff050c1970c776ecb8fb751182 | 3ab03690aeccc359a472234d7bd55d4c9157f367 | /spline.cpp | 4ddfa487d06a494c7985da22e108beb3261289d6 | [] | no_license | kerinin/arduino-splines | 29cdd2dfbebabf3440148eb10def962715c9c710 | c97ea41a7cd8f231a40cc438c227842d383cb619 | refs/heads/master | 2021-01-19T20:15:29.422885 | 2015-01-22T22:28:01 | 2015-01-22T22:28:01 | 705,205 | 16 | 12 | null | 2019-05-23T06:47:05 | 2010-06-05T20:12:05 | C++ | UTF-8 | C++ | false | false | 2,825 | cpp | #include "WProgram.h"
#include "spline.h"
#include <math.h>
Spline::Spline(void) {
_prev_point = 0;
}
Spline::Spline( float x[], float y[], int numPoints, int degree )
{
setPoints(x,y,numPoints);
setDegree(degree);
_prev_point = 0;
}
Spline::Spline( float x[], float y[], float m[], int numPoints )
{
setPoints(x,y,m,numPoints);
setDegree(Hermite);
_prev_point = 0;
}
void Spline::setPoints( float x[], float y[], int numPoints ) {
_x = x;
_y = y;
_length = numPoints;
}
void Spline::setPoints( float x[], float y[], float m[], int numPoints ) {
_x = x;
_y = y;
_m = m;
_length = numPoints;
}
void Spline::setDegree( int degree ){
_degree = degree;
}
float Spline::value( float x )
{
if( _x[0] > x ) {
return _y[0];
}
else if ( _x[_length-1] < x ) {
return _y[_length-1];
}
else {
for(int i = 0; i < _length; i++ )
{
int index = ( i + _prev_point ) % _length;
if( _x[index] == x ) {
_prev_point = index;
return _y[index];
} else if( (_x[index] < x) && (x < _x[index+1]) ) {
_prev_point = index;
return calc( x, index );
}
}
}
}
float Spline::calc( float x, int i )
{
switch( _degree ) {
case 0:
return _y[i];
case 1:
if( _x[i] == _x[i+1] ) {
// Avoids division by 0
return _y[i];
} else {
return _y[i] + (_y[i+1] - _y[i]) * ( x - _x[i]) / ( _x[i+1] - _x[i] );
}
case Hermite:
return hermite( ((x-_x[i]) / (_x[i+1]-_x[i])), _y[i], _y[i+1], _m[i], _m[i+1], _x[i], _x[i+1] );
case Catmull:
if( i == 0 ) {
// x prior to spline start - first point used to determine tangent
return _y[1];
} else if( i == _length-2 ) {
// x after spline end - last point used to determine tangent
return _y[_length-2];
} else {
float t = (x-_x[i]) / (_x[i+1]-_x[i]);
float m0 = (i==0 ? 0 : catmull_tangent(i) );
float m1 = (i==_length-1 ? 0 : catmull_tangent(i+1) );
return hermite( t, _y[i], _y[i+1], m0, m1, _x[i], _x[i+1]);
}
}
}
float Spline::hermite( float t, float p0, float p1, float m0, float m1, float x0, float x1 ) {
return (hermite_00(t)*p0) + (hermite_10(t)*(x1-x0)*m0) + (hermite_01(t)*p1) + (hermite_11(t)*(x1-x0)*m1);
}
float Spline::hermite_00( float t ) { return (2*pow(t,3)) - (3*pow(t,2)) + 1;}
float Spline::hermite_10( float t ) { return pow(t,3) - (2*pow(t,2)) + t; }
float Spline::hermite_01( float t ) { return (3*pow(t,2)) - (2*pow(t,3)); }
float Spline::hermite_11( float t ) { return pow(t,3) - pow(t,2); }
float Spline::catmull_tangent( int i )
{
if( _x[i+1] == _x[i-1] ) {
// Avoids division by 0
return 0;
} else {
return (_y[i+1] - _y[i-1]) / (_x[i+1] - _x[i-1]);
}
}
| [
"kerinin@gmail.com"
] | kerinin@gmail.com |
2edde90e7603df05a4a1afc7ff730a97d1bb4294 | 54bbee5e1f7de6f2f4ad242b8161577caf453b20 | /flareirc/talkwindowtab.h | 6eb90be026d6f2ffa9b2c485663cd57128debda2 | [] | no_license | jr551/FlareIRC | 2c960691023fe35aaaf40420cb024079a1116829 | 85fcf7929ff1974bae8df98dc6e4fe864db91abb | refs/heads/main | 2023-07-05T21:55:39.215356 | 2021-08-18T20:40:24 | 2021-08-18T20:40:24 | 397,378,506 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 604 | h | #ifndef TALKWINDOWTAB_H
#define TALKWINDOWTAB_H
#include <QWidget>
class TalkWindowTab : public QWidget
{
Q_OBJECT
public:
explicit TalkWindowTab(QWidget *parent = 0);
enum TalkWindowTabType_t
{
SERVER_TAB = 0,
CHANNEL_TAB,
PRIVMSG_TAB
};
virtual TalkWindowTabType_t GetTabType() = 0;
virtual QString GetTabContext() = 0;
virtual void AddChatLine( QString line ) = 0;
virtual bool UpdateNick( QString oldNick, QString newNick ) = 0;
virtual void LocalNickUpdated( QString nick ) = 0;
signals:
public slots:
};
#endif // TALKWINDOWTAB_H
| [
"johnrowe551@gmail.com"
] | johnrowe551@gmail.com |
aa9ca14ffc314c8840f0a35a66c07ebba8ce7f46 | edf85ec3c273e7ce0ed4790e5725a55393a2c488 | /extlibs/include/Jopnal/Physics/Shape/CompoundShape.hpp | d060452187d7b3c23b32086587be3e68242c4e95 | [
"Zlib"
] | permissive | Jopnal/Jopmodel | fb9cb83dad5c4432d5ffaefc8ac45c97ce37ee97 | cfd50b9fd24eaf63497bf5bed883f0b831d9ad65 | refs/heads/master | 2021-01-17T06:33:40.982800 | 2016-08-09T08:12:28 | 2016-08-09T08:12:28 | 61,036,364 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,741 | hpp | // Jopnal Engine C++ Library
// Copyright (c) 2016 Team Jopnal
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgement in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//////////////////////////////////////////////
#ifndef JOP_COMPOUNDSHAPE_HPP
#define JOP_COMPOUNDSHAPE_HPP
// Headers
#include <Jopnal/Header.hpp>
#include <Jopnal/Physics/Shape/CollisionShape.hpp>
//////////////////////////////////////////////
namespace jop
{
class Transform;
class JOP_API CompoundShape final : public CollisionShape
{
public:
/// \brief Constructor
///
/// \param name Name of the resource
///
CompoundShape(const std::string& name);
/// \brief Add a child shape
///
/// \param childShape Reference to a valid shape
/// \param childTransform Local transform for the child
///
void addChild(CollisionShape& childShape, const Transform::Variables& childTransform);
};
}
#endif | [
"eetu.asikainen@hotmail.com"
] | eetu.asikainen@hotmail.com |
9207a95556b75b897e630d1c5422b4a4a3919904 | e373db953fa904225c94da4d99368a8d246290c4 | /code/kepler_main - Copy.cpp | 370ff819d1b2572f0164223c6505c2fd3681fdea | [] | no_license | kepler425b/lab64 | dded28d970c824f158cb2b2c0a99ed10d9b84c6e | 34ca6c1cbd09c318d963946c8e5fdf929163a3f5 | refs/heads/master | 2020-04-13T11:28:09.393416 | 2018-12-31T11:05:12 | 2018-12-31T11:05:12 | 158,926,088 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,458 | cpp | #define _CRT_SECURE_NO_WARNINGS
#define GLEW_STATIC
#include <Windows.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <glm.hpp>
#include <GL\glew.h>
#include <gl/GL.h>
#include "Model.h"
#include "Camera.h"
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cassert>
#include <math.h>
SDL_Event Event;
SDL_Renderer *Renderer = NULL;
SDL_Window *Window = NULL;
SDL_Surface *Screen = NULL;
float dt = 1.0 / 60;
__int64 FPS = 0;
const UINT8 *keyState;
bool quit = false;
int SCW = 1024;
int SCH = 768;
GLuint model_list;
Model model_object;
Camera camera_object;
static int isWire = 0;
static int isFog = 1;
int isOrtho = 0;
using namespace std;
using namespace glm;
#define right SDL_SCANCODE_RIGHT
#define left SDL_SCANCODE_LEFT
#define up SDL_SCANCODE_UP
#define down SDL_SCANCODE_DOWN
std::vector<vec3> s_data;
void sdldie(const char *msg)
{
printf("%s: %s\n", msg, SDL_GetError());
SDL_Quit();
exit(1);
}
void checkSDLError(int line = -1)
{
#ifndef NDEBUG
const char *error = SDL_GetError();
if (*error != '\0')
{
printf("SDL Error: %s\n", error);
if (line != -1)
printf(" + line: %i\n", line);
SDL_ClearError();
}
#endif
}
void close()
{
SDL_DestroyWindow(Window);
SDL_DestroyRenderer(Renderer);
Window = NULL;
Renderer = NULL;
SDL_Quit();
IMG_Quit();
}
void Model::loadFile(int argc, char **argv) {
string fileObjectLine;
ifstream fileObject;
assert(argc == 2);
fileObject = ifstream(argv[1]);
if (fileObject.is_open()) {
while (!fileObject.eof()) {
getline(fileObject, fileObjectLine);
if (fileObjectLine.c_str()[0] == 'v') { // if the line starts with 'v', it's declaring a vertice
//cout << fileObjectLine << endl;
float x, y, z;
fileObjectLine[0] = ' '; // get rid of 'v'
sscanf(fileObjectLine.c_str(), "%f %f %f ", &x, &y, &z); // assign the vertice's values to x,y,z
model_object.vertex_list.push_back(x); // save the values into the vector vertex_list of
model_object.vertex_list.push_back(y); // object model_object
model_object.vertex_list.push_back(z);
//cout << "line is " << fileObjectLine << endl;
//cout << model_object.vertex_list.size() << endl;
continue; // skip to next iteration
}
}
model_list = glGenLists(1); // init one display list
glNewList(model_list, GL_COMPILE); // start of display list
// NOTE: this will only run once, after all the vertices have been added and right before polygons/faces are added
//applyTransfToMatrix();
//model_object.applyTransfToMatrix();
// go back to beginning of the file
fileObject.clear();
fileObject.seekg(0, ios::beg);
#if 1
glBegin(GL_POINTS);
while (!fileObject.eof()) {
getline(fileObject, fileObjectLine);
// scanning for 'f' and adding polygons to display list
if (fileObjectLine.c_str()[0] == 'f') { // if the line starts with 'f', it's declaring a face/polygon
s_list.push_back(fileObjectLine);
fileObjectLine[0] = ' ';
uint vertexIndex[3], uvIndex[3], normalIndex[3];
uint matches = sscanf(fileObjectLine.c_str(), "%d/%d/%d %d/%d/%d %d/%d/%d",
&vertexIndex[0], &uvIndex[0], &normalIndex[0],
&vertexIndex[1], &uvIndex[1], &normalIndex[1],
&vertexIndex[2], &uvIndex[2], &normalIndex[2]);
if (matches != 9) {
}
vec3 temp;
temp.x = model_object.vertex_list.at(vertexIndex[0] - 1);
temp.y = model_object.vertex_list.at(vertexIndex[1] - 1);
temp.z = model_object.vertex_list.at(vertexIndex[2] - 1);
s_data.push_back(temp);
glVertex3f(temp.x, temp.y, temp.z);
continue;
}
}
glEnd();
glEndList();
}
}
#endif
#if 0
// read file again and process the lines starting with 's'
int num = 0;
while (!fileObject.eof()) {
getline(fileObject, fileObjectLine);
// scanning for 'f' and adding polygons to display list
if (fileObjectLine.c_str()[0] == 'f') { // if the line starts with 'f', it's declaring a face/polygon
s_list.push_back(fileObjectLine);
fileObjectLine[0] = ' '; // get rid of 'f' from the line string
istringstream iss(fileObjectLine);
int x, y, z; //cout << "line is : " << fileObjectLine << endl;
x = 0;
y = 1;
z = 2;
int stride = 0;
int v_size = model_object.vertex_list.size();
for (int index = 3; index < model_object.vertex_list.size(); index += 3)
{
if (x >= v_size) { x = v_size; };
if (y >= v_size) { y = v_size; };
if (z >= v_size) { z = v_size; };
if (num == 0)
{
glBegin(GL_LINES);
}
glVertex3f(model_object.vertex_list[x], model_object.vertex_list[y], model_object.vertex_list[z]);
stride += 3;
x += 3;
y += 3;
z += 3;
num++;
if (num >= 3) {
glEnd();
num = 0;
}
}
glEnd();
}
}
glEndList();
}
}
#endif
void drawModelTransf() {
// model
// apply model translations
glTranslatef(model_object.model_x, model_object.model_y, model_object.model_z);
// translate to z = -2 so model can rotate about its axis
glTranslatef(0, 0, -2);
// apply rotation transformations
glRotatef(model_object.model_rotx, 1, 0, 0);
glRotatef(model_object.model_roty, 0, 1, 0);
glRotatef(model_object.model_rotz, 0, 0, 1);
// translate back to z = 0 where the camera is
glTranslatef(0, 0, 2);
}
void drawCameraTransf() {
// camera
glTranslatef(camera_object.camera_x, camera_object.camera_y, camera_object.camera_z);
glRotatef(camera_object.camera_rotx, 1, 0, 0);
glRotatef(camera_object.camera_roty, 0, 1, 0);
glRotatef(camera_object.camera_rotz, 0, 0, 1);
//gluLookAt(0.0, 0.0, 0.0, model_object.model_x, model_object.model_y, model_object.model_z, 0.0, 1.0, 0.0);
}
// Drawing (display) routine.
void drawScene(void)
{
// Clear screen to background color.
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
static int fogMode = GL_LINEAR; // Fog mode
static float fogStart = 1.0; // Fog start z value.
static float fogEnd = 5.0; // Fog end z value.
float fogColor[4] = { 1.0, 1.0, 1.0, 0.0 };
// Fog controls.
if (isFog) glEnable(GL_FOG);
else glDisable(GL_FOG);
glHint(GL_FOG_HINT, GL_NICEST);
glFogfv(GL_FOG_COLOR, fogColor);
glFogi(GL_FOG_MODE, fogMode);
glFogf(GL_FOG_START, fogStart);
glFogf(GL_FOG_END, fogEnd);
// reset transformation matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Set foreground (or drawing) color.
glColor3f(1.0f, 0.0f, 0.0f);
// wireframe or not?
if (isWire) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// apply translations and rotations to model and camera
drawCameraTransf();
drawModelTransf();
// draw display list
glCallList(model_list);
}
// Initialization routine.
void setup(void)
{
// Set background (or clearing) color.
glClearColor(0.0, 0.0, 0.0, 0.0);
}
// OpenGL window reshape routine.
void resize(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (isOrtho) {
glOrtho(-1.0, 1.0, -1.0, 1.0, 1, 100.0);
}
else {
glFrustum(-1.0, 1.0, -1.0, 1.0, 1, 100.0);
}
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char* argv[])
{
SDL_Window *mainWindow;
SDL_GLContext glContext;
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
}
mainWindow = SDL_CreateWindow("Beaminster", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
if (!mainWindow) /* Die if creation failed */
sdldie("Unable to create window");
checkSDLError(__LINE__);
glContext = SDL_GL_CreateContext(mainWindow);
SDL_SetWindowResizable(mainWindow, SDL_TRUE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
if (!glewInit() == GLEW_OK) {
printf("error");
}
unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
//glBufferData(GL_ARRAY_BUFFER, 3, &)
checkSDLError(__LINE__);
SDL_GL_SetSwapInterval(1);
int w, h;
SDL_GetWindowSize(mainWindow, &w, &h);
glViewport(0, 0, w, h);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
/*char *asd = (char *)malloc(256);
strcpy_s(asd, 256, "asd");
TTF_Font *font = TTF_OpenFont("font/ProggyClean.ttf", 24);*/
LARGE_INTEGER Frequency;
QueryPerformanceFrequency(&Frequency);
double SecondPerTick = 1.0 / (double)Frequency.LowPart;
LARGE_INTEGER tick_beforloop;
QueryPerformanceCounter(&tick_beforloop);
model_object.loadFile(argc, argv);
GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
while (!quit){
LARGE_INTEGER last_tick;
QueryPerformanceCounter(&last_tick);
while (SDL_PollEvent(&Event)){
if (Event.type == SDL_QUIT){
quit = true;
}
switch (Event.type)
if (Event.type == SDL_WINDOWEVENT)
{
switch (Event.window.event)
{
case SDL_WINDOWEVENT_RESIZED:
{
resize(Event.window.data1, Event.window.data2);
break;
default:
break;
}
}
case SDL_KEYDOWN:
{
switch (Event.key.keysym.sym)
{
case SDLK_UP:
model_object.model_rotx += 10;
break;
case SDLK_DOWN:
model_object.model_rotx -= 10;
break;
case SDLK_RIGHT:
model_object.model_roty += 10;
break;
case SDLK_LEFT:
model_object.model_roty -= 10;
break;
default:
break;
}
}
if(Event.type == SDL_KEYUP)
{
switch (Event.key.keysym.sym)
{
case SDLK_UP:
break;
case SDLK_DOWN:
break;
case SDLK_RIGHT:
break;
default:
break;
case SDLK_LEFT:
break;
}
}
}
if (Event.type == SDL_MOUSEBUTTONDOWN){
if (Event.button.button == SDL_BUTTON_LEFT){
}
}
else if (Event.type == SDL_MOUSEBUTTONUP){
}
}
const UINT8* Key = SDL_GetKeyboardState(NULL);
if (Key[right]){
}
if (Key[left]){
}
if (Key[up]){
}
if (Key[down]){
}
drawScene();
LARGE_INTEGER now_tick;
QueryPerformanceCounter(&now_tick);
__int64 Interval = now_tick.QuadPart - tick_beforloop.QuadPart;
double SecondsGoneBy = (double)Interval * SecondPerTick;
}
SDL_GL_DeleteContext(glContext);
SDL_DestroyWindow(mainWindow);
SDL_Quit();
return 0;
}
| [
"bra3as@gmail.com"
] | bra3as@gmail.com |
2a20cc82f54bc1e68845c918b4c0596ad4738fe7 | a84538af8bf1f763a3d71d939744976425358b30 | /src/qt/receivecoinsdialog.cpp | 31194902385b71fc1cc5dbe1f40de5761002c103 | [
"MIT"
] | permissive | YourLocalDundee/foxdcoin | 8de421b280a812e390249f14ed0b5892c546ebf1 | 9db505f6f32bd3e51bd2b2da533744c98cee23af | refs/heads/master | 2023-05-14T05:10:26.435417 | 2021-06-09T06:18:50 | 2021-06-09T06:18:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,731 | cpp | // Copyright (c) 2011-2016 The Bitcoin Core developers
// Copyright (c) 2017-2019 The Raven Core developers
// Copyright (c) 2020-2021 The Foxdcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "receivecoinsdialog.h"
#include "ui_receivecoinsdialog.h"
#include "addressbookpage.h"
#include "addresstablemodel.h"
#include "foxdcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "receiverequestdialog.h"
#include "recentrequeststablemodel.h"
#include "walletmodel.h"
#include "guiconstants.h"
#include <QAction>
#include <QCursor>
#include <QItemSelection>
#include <QMessageBox>
#include <QScrollBar>
#include <QTextDocument>
#include <QGraphicsDropShadowEffect>
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent),
ui(new Ui::ReceiveCoinsDialog),
columnResizingFixer(0),
model(0),
platformStyle(_platformStyle)
{
ui->setupUi(this);
if (!_platformStyle->getImagesOnButtons()) {
ui->clearButton->setIcon(QIcon());
ui->receiveButton->setIcon(QIcon());
ui->showRequestButton->setIcon(QIcon());
ui->removeRequestButton->setIcon(QIcon());
} else {
ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
ui->receiveButton->setIcon(_platformStyle->SingleColorIcon(":/icons/receiving_addresses"));
ui->showRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/edit"));
ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
}
// context menu actions
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(copyURIAction);
contextMenu->addAction(copyLabelAction);
contextMenu->addAction(copyMessageAction);
contextMenu->addAction(copyAmountAction);
// context menu signals
connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));
connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI()));
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage()));
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
setupRequestFrame(platformStyle);
setupHistoryFrame(platformStyle);
}
void ReceiveCoinsDialog::setModel(WalletModel *_model)
{
this->model = _model;
if(_model && _model->getOptionsModel())
{
_model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
updateDisplayUnit();
QTableView* tableView = ui->recentRequestsView;
tableView->verticalHeader()->hide();
tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
tableView->setModel(_model->getRecentRequestsTableModel());
tableView->setAlternatingRowColors(true);
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
connect(tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
tableView->show();
}
}
ReceiveCoinsDialog::~ReceiveCoinsDialog()
{
delete ui;
}
void ReceiveCoinsDialog::clear()
{
ui->reqAmount->clear();
ui->reqLabel->setText("");
ui->reqMessage->setText("");
ui->reuseAddress->setChecked(false);
updateDisplayUnit();
}
void ReceiveCoinsDialog::reject()
{
clear();
}
void ReceiveCoinsDialog::accept()
{
clear();
}
void ReceiveCoinsDialog::setupRequestFrame(const PlatformStyle *platformStyle)
{
/** Update the coincontrol frame */
ui->frame2->setStyleSheet(QString(".QFrame {background-color: %1; border: none;}").arg(platformStyle->WidgetBackGroundColor().name()));
/** Create the shadow effects on the frames */
ui->frame2->setGraphicsEffect(GUIUtil::getShadowEffect());
ui->label_5->setStyleSheet(STRING_LABEL_COLOR);
ui->label_2->setStyleSheet(STRING_LABEL_COLOR);
ui->label_2->setFont(GUIUtil::getSubLabelFont());
ui->label->setStyleSheet(STRING_LABEL_COLOR);
ui->label->setFont(GUIUtil::getSubLabelFont());
ui->label_3->setStyleSheet(STRING_LABEL_COLOR);
ui->label_3->setFont(GUIUtil::getSubLabelFont());
ui->label_4->setStyleSheet(STRING_LABEL_COLOR);
ui->label_4->setFont(GUIUtil::getSubLabelFont());
ui->label_7->setStyleSheet(STRING_LABEL_COLOR);
ui->label_7->setFont(GUIUtil::getSubLabelFont());
ui->reuseAddress->setStyleSheet(QString(".QCheckBox{ %1; }").arg(STRING_LABEL_COLOR));
ui->reqLabel->setFont(GUIUtil::getSubLabelFont());
ui->reqAmount->setFont(GUIUtil::getSubLabelFont());
ui->reqMessage->setFont(GUIUtil::getSubLabelFont());
ui->receiveButton->setFont(GUIUtil::getSubLabelFont());
ui->clearButton->setFont(GUIUtil::getSubLabelFont());
ui->recentRequestsView->setFont(GUIUtil::getSubLabelFont());
ui->showRequestButton->setFont(GUIUtil::getSubLabelFont());
ui->removeRequestButton->setFont(GUIUtil::getSubLabelFont());
ui->label_5->setFont(GUIUtil::getSubLabelFont());
ui->label_6->setFont(GUIUtil::getSubLabelFontBolded());
}
void ReceiveCoinsDialog::setupHistoryFrame(const PlatformStyle *platformStyle)
{
/** Update the coincontrol frame */
ui->frame->setStyleSheet(QString(".QFrame {background-color: %1; border: none;}").arg(platformStyle->WidgetBackGroundColor().name()));
/** Create the shadow effects on the frames */
ui->frame->setGraphicsEffect(GUIUtil::getShadowEffect());
ui->label_6->setStyleSheet(STRING_LABEL_COLOR);
contextMenu->setFont(GUIUtil::getSubLabelFont());
}
void ReceiveCoinsDialog::updateDisplayUnit()
{
if(model && model->getOptionsModel())
{
ui->reqAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}
void ReceiveCoinsDialog::on_receiveButton_clicked()
{
if(!model || !model->getOptionsModel() || !model->getAddressTableModel() || !model->getRecentRequestsTableModel())
return;
QString address;
QString label = ui->reqLabel->text();
if(ui->reuseAddress->isChecked())
{
/* Choose existing receiving address */
AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if(dlg.exec())
{
address = dlg.getReturnValue();
if(label.isEmpty()) /* If no label provided, use the previously used label */
{
label = model->getAddressTableModel()->labelForAddress(address);
}
} else {
return;
}
} else {
/* Generate new receiving address */
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
}
SendCoinsRecipient info(address, label,
ui->reqAmount->value(), ui->reqMessage->text());
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModel(model->getOptionsModel());
dialog->setInfo(info);
dialog->show();
clear();
/* Store request for later reference */
model->getRecentRequestsTableModel()->addNewRequest(info);
}
void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &index)
{
const RecentRequestsTableModel *submodel = model->getRecentRequestsTableModel();
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setModel(model->getOptionsModel());
dialog->setInfo(submodel->entry(index.row()).recipient);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
void ReceiveCoinsDialog::recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
{
// Enable Show/Remove buttons only if anything is selected.
bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty();
ui->showRequestButton->setEnabled(enable);
ui->removeRequestButton->setEnabled(enable);
}
void ReceiveCoinsDialog::on_showRequestButton_clicked()
{
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
return;
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
for (const QModelIndex& index : selection) {
on_recentRequestsView_doubleClicked(index);
}
}
void ReceiveCoinsDialog::on_removeRequestButton_clicked()
{
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
return;
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
if(selection.empty())
return;
// correct for selection mode ContiguousSelection
QModelIndex firstIndex = selection.at(0);
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
}
// We override the virtual resizeEvent of the QWidget to adjust tables column
// sizes as the tables width is proportional to the dialogs width.
void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
}
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Return)
{
// press return -> submit form
if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() || ui->reqMessage->hasFocus())
{
event->ignore();
on_receiveButton_clicked();
return;
}
}
this->QDialog::keyPressEvent(event);
}
QModelIndex ReceiveCoinsDialog::selectedRow()
{
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
return QModelIndex();
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
if(selection.empty())
return QModelIndex();
// correct for selection mode ContiguousSelection
QModelIndex firstIndex = selection.at(0);
return firstIndex;
}
// copy column of selected row to clipboard
void ReceiveCoinsDialog::copyColumnToClipboard(int column)
{
QModelIndex firstIndex = selectedRow();
if (!firstIndex.isValid()) {
return;
}
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.model()->index(firstIndex.row(), column), Qt::EditRole).toString());
}
// context menu
void ReceiveCoinsDialog::showMenu(const QPoint &point)
{
if (!selectedRow().isValid()) {
return;
}
contextMenu->exec(QCursor::pos());
}
// context menu action: copy URI
void ReceiveCoinsDialog::copyURI()
{
QModelIndex sel = selectedRow();
if (!sel.isValid()) {
return;
}
const RecentRequestsTableModel * const submodel = model->getRecentRequestsTableModel();
const QString uri = GUIUtil::formatFoxdcoinURI(submodel->entry(sel.row()).recipient);
GUIUtil::setClipboard(uri);
}
// context menu action: copy label
void ReceiveCoinsDialog::copyLabel()
{
copyColumnToClipboard(RecentRequestsTableModel::Label);
}
// context menu action: copy message
void ReceiveCoinsDialog::copyMessage()
{
copyColumnToClipboard(RecentRequestsTableModel::Message);
}
// context menu action: copy amount
void ReceiveCoinsDialog::copyAmount()
{
copyColumnToClipboard(RecentRequestsTableModel::Amount);
}
| [
"foxrtb@gmail.com"
] | foxrtb@gmail.com |
c06ccb1f43b98fabe5820c8cda59ece9c80c402e | 9989ec29859d067f0ec4c7b82e6255e227bd4b54 | /atcoder.jp/abc_129/abc129_b.cpp | 6338f04541dd4cc59d006f4d2adbaf0b31076a8e | [] | no_license | hikko624/prog_contest | 8fa8b0e36e4272b6ad56d6506577c13f9a11c9de | 34350e2d298deb52c99680d72345ca44ab6f8849 | refs/heads/master | 2022-09-10T20:43:28.046873 | 2022-08-26T13:59:29 | 2022-08-26T13:59:29 | 217,740,540 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,871 | cpp | // abc129_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
ll sum = 0, right, left, ans = inf, now;
cin>>n;
vector<int> w(n);
rep(i, n) {
cin >> w.at(i);
sum += w.at(i);
}
right = sum, left = 0;
rep(i, n) {
now = abs(right - left);
ans = min(ans, now);
right -= w.at(i);
left += w.at(i);
}
cout << ans << endl;
return 0;
}
| [
"hikko624@gmail.com"
] | hikko624@gmail.com |
ede47cfe9ff4c0885b07f33ff32ab74df43fb304 | 07cbe159795612509c2e7e59eb9c8ff6c6ed6b0d | /partitioned/RayleighBenard/3D/Ra_1e+05_multiFluidBoussinesqFoam_resX20_Y10_lowB_sigma_0_5_divTransfer_laplacianTransfer_gamma_1e-2/init_118/b.stable | f53126c44eaad2dd91765b1b1b2107f860b876ce | [] | no_license | AtmosFOAM/danRun | aacaaf8a22e47d1eb6390190cb98fbe846001e7a | 94d19c4992053d7bd860923e9605c0cbb77ca8a2 | refs/heads/master | 2021-03-22T04:32:10.679600 | 2020-12-03T21:09:40 | 2020-12-03T21:09:40 | 118,792,506 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 69,885 | stable | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object b.stable;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
internalField nonuniform List<scalar>
4000
(
-0.00137882171868
0.0103941238049
0.0156116732701
0.00477034491101
0.0140187481075
0.028264409045
0.0165069501869
0.00967904261138
0.000535972895072
0.00406737321052
0.027533698543
0.0156207886228
0.0128699685467
0.0205713319817
0.00466961335479
0.00959059662264
0.0267684921704
0.0107324932883
0.00517670875542
-0.00297438585463
-0.0141171184845
-0.000136677887698
0.00474950824591
-0.00387821562679
0.00196258799121
0.0198710697696
0.00591956901827
0.00252495449512
-0.00477098597868
-0.00598986188041
0.0173790874252
0.00477146001545
0.00107819595082
0.00650441016393
-0.00514835029058
-0.000306194057672
0.0188219532228
-0.000691402803008
-0.00380208481614
-0.0122864782201
-0.013425762575
-0.00243193823364
0.00258270874324
-0.00273306227699
0.00109632471989
0.0143770578119
0.00198210926914
0.00214553437221
-0.00198986347606
-0.00537617325843
0.0121156364437
0.00223807167178
-0.0012148101716
-0.00152368908431
-0.00565468393461
-0.000754768941917
0.0139173642628
-0.00279564843223
-0.00492773710168
-0.0124253816025
-0.00792733294193
-0.00399938685452
5.79237849167e-05
7.53677667539e-05
0.00187097502042
0.0109456708386
0.00115575966895
0.00263140109721
-0.000750822817699
-0.00382448538202
0.0127725338622
0.00363750750533
-0.00132843312211
-0.00393097236003
-0.00555273414783
-0.000105981152763
0.0100214371127
-0.0030876525879
-0.00553649062531
-0.0114784582088
-0.00430423347784
-0.00452661867784
-0.00193093530203
0.000583823682184
0.00302203987384
0.00819073091736
0.00133382930573
0.00379799442878
-0.000175508629183
-0.00251815148168
0.0141767771272
0.00578375537025
-0.000851412815383
-0.00557453120215
-0.00585233326558
0.000268935473392
0.00620232580768
-0.00307586101594
-0.00632468296584
-0.0125563113885
-0.00296277532331
-0.00597543237048
-0.00200673336509
-0.00249114063561
0.00449037927496
0.00584618631983
0.00202909073269
0.00515748626844
-0.000464971012232
-0.000612576206107
0.0152873761018
0.00724379903055
0.000163484115775
-0.00735018865541
-0.00637098449057
0.000674757115257
0.00358397863452
-0.0026959282468
-0.00674087709911
-0.0154497385093
-0.00246640356769
-0.0059903405303
-0.00150032447985
-0.00729606981621
0.0043907166687
0.0040706392195
0.00333369323366
0.00564037953367
-0.00153795160519
0.00163458809501
0.0152734120911
0.0089325077066
0.00174975969186
-0.00979825169326
-0.00720152346056
0.000959460122865
0.003689909614
-0.00186489226017
-0.00652567200839
-0.0173933885051
-0.00225921127449
-0.00778958166732
-0.00114004003066
-0.0132902430662
0.00372494480251
0.00310119916254
0.00520791042745
0.00581106969951
-0.00327019883537
0.00266955084321
0.0147646324065
0.01153105662
0.00418494902183
-0.0131984469565
-0.00912013258342
0.00109193610241
0.00520766214303
0.000574939388283
-0.00655720569911
-0.0188148531427
-0.00136515252278
-0.0136895202333
-0.00493061608841
-0.0209508993779
0.0026526425863
-0.00162174786644
0.00464556529557
0.0039752047656
-0.00846018554433
0.00138767415458
0.0127144702466
0.0110822941097
0.00412694064489
-0.0182565165191
-0.0136473571851
-0.00138070036762
0.00649750164059
0.00320081808382
-0.0108369877537
-0.0200069024989
-0.00728677718703
-0.0228582333163
-0.0193128168069
-0.0293397125261
-0.00528642184936
-0.016464483181
-0.00615719966576
-0.00955671588422
-0.0210188054169
-0.00937316515247
0.000127654837359
-0.00252614460822
-0.00658647971378
-0.0268071525479
-0.0237460086079
-0.0150043752913
-0.00173226733611
-0.00529948436544
-0.0219441483066
-0.0267591265498
0.0172567589347
0.00786720771903
-0.00247090844028
0.00491018901429
0.0175507713288
0.0270339329306
0.0257978581241
0.020636114563
0.0242498314482
0.0270416536643
0.0215454833578
0.0198039902153
0.0219836427966
0.0114424741389
0.0067463800177
0.00699770400274
0.0288303186059
0.0216917898006
0.0119225060994
0.00648169166481
0.00030161254192
-0.00520566379176
-0.0138070395305
-0.00161288409927
0.00474733412455
0.0199163154535
0.018813102622
0.0118463280946
0.015151047697
0.0189382325774
0.00906536924913
0.00981985783329
0.00641395488662
0.00295850492493
-0.00169818198463
0.000199094825949
0.0218413265849
0.00565670588511
-0.00259260054299
-0.0101479062538
-0.00655220848345
-0.00779836771443
-0.0152624759481
0.00392351729476
0.00356965343262
0.0185361142976
0.0193455033455
0.00894971953363
0.0107068247121
0.0145349514137
0.00426387329539
0.0101710796825
0.00261220533999
-0.000345489893167
-3.51474234808e-05
-0.000250713709759
0.0156787236285
-0.00106564832928
-0.0047206392108
-0.0111562650151
-0.00764192698182
-0.00749560953577
-0.0160491683961
0.00632000837066
0.00493107378673
0.0174061468251
0.0197105915894
0.00597759127127
0.00767773158986
0.0114737931005
0.00185422844829
0.0114505175529
0.00300531628447
-0.000162242501637
0.00267298730416
-0.000346846532235
0.0104467773428
-0.00363785597242
-0.00574956091914
-0.00773210033446
-0.00706985982349
-0.00660426079108
-0.016910858787
0.00683857769733
0.00620726442703
0.0156942495182
0.0193582570054
0.000385308896483
0.00506879299984
0.0092431432767
0.00185362644744
0.0125607801816
0.00213373829948
0.00090145231229
0.00449535785135
-0.000585363912748
0.00832493133322
-0.00580786114922
-0.00799701615557
-0.00516601341078
-0.00585778227292
-0.00555856412367
-0.0179414439161
0.00549645373116
0.00720233790578
0.013933215198
0.0183610160635
-0.00074109703342
0.00304268133241
0.00805961416619
0.00302128798984
0.0129229937864
-0.00219148812035
0.00171812141498
0.00530734196623
-0.00185479838729
0.00885774651966
-0.00825571631121
-0.011492797866
-0.00438614585106
-0.00402186821935
-0.00450098738241
-0.0197929573923
0.00263220267499
0.00831542020195
0.0133871165067
0.0163976472716
0.00193234452747
0.00198633510851
0.00732602532623
0.00540984665905
0.0127192807383
-0.0067296992183
0.0022527643769
0.005384940281
-0.00358790666898
0.00889771141666
-0.0104110123606
-0.0150463654122
-0.00499449779084
-0.0011017834789
-0.00220672142314
-0.0224765934745
-0.000722041546581
0.00909724913207
0.0138391456847
0.0146962650825
0.00320845683925
0.00139222386425
0.0063898598772
0.00740063457678
0.0118026041895
-0.00935433915858
0.00241416904583
0.00242288422704
-0.00514914906461
0.0071660706009
-0.0121048557056
-0.0186992520237
-0.00772084990691
0.00184522937433
0.00080481489548
-0.0257792440676
-0.00679644673775
0.00665046109755
0.0132703819075
0.0143260237804
0.00229278271436
-0.000899639907657
0.00435246345191
0.00628120602793
0.0103370364774
-0.013340810013
0.000676943267775
-0.00507411873887
-0.00715188140267
-0.00246229689291
-0.013951084855
-0.0229255976408
-0.0140231060858
-0.00511396631671
-0.00597336862729
-0.0300943808264
-0.0210329360141
-0.00670970429084
0.00283354834989
0.00415751509709
-0.0109436055237
-0.0146960967491
-0.00678029539833
-0.00564892567159
0.000190165503792
-0.022978131681
-0.0120178700956
-0.0194745581105
-0.0163568669337
-0.0165766339954
-0.0232207647217
-0.0286083770121
-0.0260872349394
0.01332715703
0.00525548114421
-0.00145700283302
0.0203460311125
0.0250066973697
0.024957977605
0.0120856574435
0.00555445454286
0.008838139078
-0.00182658905078
0.00462836575491
0.0197570442086
0.0188299487468
0.0216498896311
0.0150751080454
0.0195609345439
0.0222955445502
0.0202730975323
0.00146431514968
0.00682587144448
-0.000803636811273
-0.00673862835056
-0.0103199578211
0.00516680612808
0.0134722266422
0.0159786854994
0.00605452325111
-0.00122728417232
-0.000700233344946
-0.0077510758386
-0.00420413231699
0.0044533750799
0.00746975893622
0.0115479533444
0.00552030231868
0.0103684960233
0.0154719735954
0.0104364704471
-0.00517467085127
-0.00545403095244
-0.00385366849789
-0.00782848107303
-0.00981430723124
-0.000138068141701
0.00769340766608
0.0129349105045
0.00592927744369
-0.00146942736112
-0.00282447661883
-0.00752501103996
-0.00382249581685
-0.000151362293319
0.00429128055644
0.0114430010428
0.00421578677676
0.0111762688753
0.0160605917077
0.00949964798953
-0.00441374470135
-0.00433819437892
-0.00352695431877
-0.0078501603784
-0.00559909107189
0.00187624017621
0.00597404614869
0.0129453647681
0.00665717423405
-0.000593289945278
-0.00406054433777
-0.00710579473452
-0.00170691483976
0.00190063521473
0.00225218824269
0.0125533747557
0.00529020245289
0.0148261892103
0.0178193494614
0.0117148844867
-0.00528601252169
-0.00188698673129
-0.00265554704438
-0.00809124098885
-0.00246873390374
0.00423058181015
0.00601376145365
0.0132620398812
0.00661570824501
-0.000365645773447
-0.00447726271456
-0.00674355772323
-0.000302861938065
0.00358152818643
0.00146565795737
0.0135850711193
0.00775113245769
0.0180478569741
0.0191187461531
0.0120352331932
-0.00780056493951
-0.00022364562149
-0.00130688508722
-0.00794680869596
-0.000980335867464
0.00533325407093
0.00625183636798
0.0136958622132
0.0071061951756
0.00110709530922
-0.00467819569686
-0.00619741208095
0.000569174040632
0.00178997353093
0.0020860195303
0.0135651667527
0.009354445176
0.0186513224758
0.0190323725516
0.0113380268363
-0.010213215585
0.0017134195234
0.000387181981575
-0.00648751445021
-0.000894466163006
0.00592743854541
0.00703224511711
0.0141396593217
0.00815032295969
0.00225662754216
-0.0045087748382
-0.00571224244212
0.000963412323713
-0.00178123183485
0.00415317478813
0.0131216825443
0.0105523547002
0.0180822745207
0.0180772063044
0.0105186304823
-0.0128479156872
0.00392345446428
0.00194583005187
-0.00434319840844
-0.00508476335122
0.00638086899136
0.00859442356495
0.0140518614772
0.0103266083929
0.0023361359235
-0.00378339921045
-0.00603564973035
0.00103129634272
-0.00227017415483
0.00702726337311
0.012315469624
0.0110977079066
0.0168648366557
0.0129588245159
0.00954808871967
-0.0162863614857
0.00599704809007
0.00157764406509
-0.00513695783096
-0.0138243917391
0.0053641477514
0.0105995248902
0.0111736870187
0.00957149836362
-0.00253214737428
-0.00593525015202
-0.0100063857794
-0.0020196417273
-0.00374917541523
0.00681138903188
0.0113776502173
0.00423293253102
0.0127075398087
0.00110397488026
0.00720688476678
-0.0209156378787
0.00597030814441
-0.00819479849635
-0.014926869945
-0.0268436075512
-0.00596989490522
0.00149885308517
-0.00474722197855
-0.00314451195239
-0.0192053323365
-0.0183038214046
-0.0218817137862
-0.0169188983573
-0.016889248629
-0.00442516516188
0.00267103289036
-0.0116248915396
-0.00614340176954
-0.0109444699248
-0.00589571224444
-0.0279361698553
-0.00259256711358
0.0215198101074
0.0165790163914
0.0175584273034
0.0174459775018
0.0251837902844
0.0195677213637
0.0194559756825
0.00198865207771
0.0184453121882
0.00613129850937
0.0091019513231
0.00416775241918
0.0189358707982
0.010798042998
0.014187508052
0.0251111520918
0.0241112264552
0.0226934554812
0.0173112061199
0.0212024494796
0.0096842501445
-0.0028061651504
0.00100550664703
0.00542212307481
0.0141062285658
0.00810201336782
0.00816905970974
-0.00833937718125
0.0103270071531
-0.00330910795696
-0.000270431508681
-0.00659119245033
0.00226504862234
0.000478923409118
0.00918149244315
0.0127328377555
0.0136944244062
0.0134572152634
0.00596849044092
0.0138762627587
0.00436627337029
-0.0133772971548
-0.00066557748824
0.000761110447139
0.00885628925779
0.00488081378133
0.000437315615037
-0.0092262687333
0.00571414245558
-0.00278661129856
0.000465145515169
-0.00799918420008
-0.00715687810064
-0.000675474608668
0.0107888357532
0.00661794222973
0.01068334871
0.00963829078196
0.00510333296135
0.014042799605
0.00127626402924
-0.0148633706323
0.000938828172911
0.000502599759268
0.0073517542234
0.00486413365602
-7.24849585532e-05
-0.0074663141114
-0.00335722747473
-0.00180668382059
0.000867196551467
-0.00859948512579
-0.00989295756075
-0.000539327261492
0.0124599378994
0.00507584443283
0.0103382648844
0.00897597493404
0.00581398628002
0.0149595922446
-0.00093293874602
-0.0151282532164
0.00177874155795
0.00124241926723
0.00730684609754
0.00521577612424
0.00332563023571
-0.00520668335996
-0.0102195070035
-0.00106449817942
0.000850904276506
-0.00926513714038
-0.0104314278717
-0.000203865321846
0.0126948235748
0.00547544462579
0.0108518840669
0.00947012806942
0.0058353525527
0.015901822277
-0.00155534681476
-0.0145068124187
0.000757146690986
0.00266755446065
0.00767893611163
0.00592566815377
0.00583683876712
-0.00419928460129
-0.0124170383148
-0.000653740449076
0.000968130578108
-0.0102885919959
-0.0129985126806
0.000452742430598
0.0112742724353
0.00622055722293
0.0122937560614
0.0103016011025
0.00536600162272
0.0158411872632
-0.00157004500495
-0.0125319480218
-0.00291918729063
0.00439031886677
0.00859882221165
0.0072322744273
0.00666088283381
-0.00478619371481
-0.0142700253548
-0.000503010030685
0.000739781330874
-0.0120638364623
-0.0132288313959
0.00146738426239
0.0106356989173
0.0066001231262
0.0142909705921
0.0100457249777
0.00473023408129
0.0155523637056
-0.00180428360681
-0.0104545017853
-0.0079778067589
0.00635476556472
0.0104021349559
0.0099255871755
0.00413292445038
-0.0082265552157
-0.0160288310064
-0.000870585497027
-0.000870611800157
-0.014872081702
-0.0103881530504
0.00184485697416
0.0122155965006
0.00701672588609
0.0162073436497
0.00884492631271
0.00485079801019
0.0150340730117
-0.00348790327645
-0.00980050495682
-0.0133489433654
0.00595981499046
0.0107745657596
0.0118263665018
-0.00521700261681
-0.0128672651644
-0.0182604530606
-0.00312395705412
-0.00531171147223
-0.0193826989621
-0.0073719370219
-0.00196654867077
0.0100106922288
0.00529670562127
0.0159457032122
0.00475846215327
0.00154457144239
0.0134802639961
-0.0133236229522
-0.018779568607
-0.0206623570835
-0.00575325588271
-0.000912430535247
0.00284545384453
-0.0238193785085
-0.0220480962773
-0.0253087489738
-0.0144923773219
-0.0186575025563
-0.0269455293125
-0.0134104518635
-0.0164666550661
-0.0073651742011
-0.00674842859347
0.0070226803379
-0.0111887698584
-0.0136627822607
0.00172991072685
0.0130480127337
0.00694636655694
0.00279740368458
0.0171021008896
0.00912636593331
0.00885325805956
0.0020803993074
0.00455319705665
0.00867995831199
0.0201536056119
0.025065759783
0.0079545450574
0.00145483722286
0.00493836329458
0.00738492902903
0.0175834415974
0.00573888695905
0.0159282444855
0.0067326381773
0.0048830431637
0.00435106784792
-0.00807476105557
-0.00462913925515
0.00367926296234
-0.00164985262852
-0.00532865035796
-0.00643358150122
-0.00678215380706
-0.00402416355322
0.00612772518513
0.0142952195548
-0.0070977747174
-0.0105095511219
-0.00303331365902
-0.00130615002684
0.00179381078645
-0.00321033615215
0.00341814678732
-0.00188403124682
-0.0030478229621
0.00510486464547
-0.00876684881958
-0.000829241137603
-0.000727425391066
-0.000111165495585
-0.00415592066812
-0.00438293073204
-0.00886102203017
-0.00727433536589
0.0032222517375
0.00796662947247
-0.00872153909588
-0.0117696093934
-0.00194966456091
-0.000152616562135
-0.0030704377383
-0.00361505789162
0.00316473820884
-0.000893680388895
-0.00105934634482
0.00561324870911
-0.00538299559706
0.00139763075502
-0.00186204417082
0.00338600630731
-0.0002602608663
-0.00267310694024
-0.0107229812143
-0.0082775024731
0.00376642685962
0.00406819593264
-0.00719037498279
-0.0111284311601
-0.00141209704597
0.00328586686944
0.000730849927818
-0.0017057600211
0.00394800911075
0.000951850120296
0.000736088980345
0.00380983171066
-0.00108139990562
0.00254297027807
-0.00167601984565
0.00508592402064
0.00276953155981
-0.00362064197808
-0.0129692591211
-0.00844630788744
0.00442484203373
0.00142383029697
-0.00586030780767
-0.00924929915082
-0.0031393575038
0.00712542706729
0.00602835717056
0.000130549137239
0.00430484631071
0.00259229478863
0.00147532248209
0.000702903723352
0.00159003564035
0.00343530299088
-0.000860817432112
0.00559637483481
0.00530316166075
-0.00634767660489
-0.0150558119553
-0.00775804066815
0.00430549118299
0.000310390579405
-0.00495277217948
-0.00723699301753
-0.00653230386719
0.0112796168228
0.00904256972578
0.00181887082663
0.00449073244968
0.00418916598663
0.00170562157833
-0.00145363426734
0.00217822762194
0.00424374956154
0.000691214854009
0.00594314288955
0.00667225794788
-0.00738130986238
-0.0175514568905
-0.00487899431945
0.00374433564741
0.000417722637741
-0.00462651643717
-0.00604832053337
-0.00994573839883
0.0136880517885
0.00817718288461
0.00346376324485
0.00472116376522
0.00485634430429
0.00151534588362
-0.00393046508779
0.000590676357974
0.00489140496164
0.00351430681327
0.00630524425589
0.00706519677199
-0.00818588790876
-0.0203857629585
-9.23114770666e-05
0.00347586936121
-0.000162924656877
-0.00408892906823
-0.0059404226994
-0.0133413483722
0.0116724194172
0.00235123251732
0.00588114904511
0.00538438480421
0.00304802057363
0.00115400038316
-0.00922178266917
-0.00402589777145
0.00493508666208
0.00486589664178
0.00435789008373
0.00676415947072
-0.0144108351724
-0.0236923491664
0.00228367863597
0.00259365666097
-0.00624128132119
-0.00370242485116
-0.0106153696167
-0.0178930042987
0.00142350857
-0.00653046974151
0.00641024070059
0.0049582999597
-0.00144366093641
-0.0018407355301
-0.0214183218031
-0.0172527624506
-0.00531269250295
-0.00563068839294
-0.0101150583612
-0.00315264866029
-0.0267471655992
-0.0284100359464
-0.00521590161825
-0.00784988374332
-0.014453904599
-0.0101756734994
-0.0224350700956
-0.0255781085313
-0.0181395678433
-0.0216639563083
-0.0032307833523
-0.00757106392547
-0.0151600019751
-0.0151308589844
0.0220705397264
0.00586480092095
0.0210632387084
0.0198809175184
0.00587614093434
0.00328502074066
-0.00128045609569
0.00911966551114
0.0179277284428
0.013818161212
0.0219861953229
0.0157537412645
-0.000675525511422
-0.00833311521378
0.000740687223766
0.0161879590623
0.0158291812957
0.0208231018894
0.00318693576957
0.00199028023006
0.0152924162149
-0.00340335516232
0.00566583251819
0.00341009966033
-0.00266917609984
-0.00928431855717
-0.0136133246853
0.000237930354636
0.00303499428658
-0.000853047127509
0.00933365775582
-0.000496581334453
-0.00714893763682
-0.0170888174786
-0.00722781512065
-0.00258126759899
0.00396903784791
0.00885704660504
-0.00377385342268
-0.00697104886861
0.0106667850989
-0.00248975472017
-2.76206265986e-05
-0.00141264977589
-0.000522381849736
-0.0107467759323
-0.0120557385455
-0.00237677129369
-0.00169290758648
-0.00238890500575
0.0096090871084
-0.00450591873995
-0.00329287923482
-0.0172542041509
-0.00604706809548
-0.00685423886448
-0.00236652384928
0.0033030882903
-0.00408513760674
-0.00743617015302
-0.00140650540508
0.000585732001367
9.23664549621e-05
-0.00181797686761
0.000886060301643
-0.01031088745
-0.00775739214922
-0.00338756762413
-0.00176789568262
-0.0015540824256
0.0101410917912
-0.00539207546723
-0.00133085610715
-0.0167041051344
-0.00285349203688
-0.00495158652174
-0.00322121029486
0.00077710652416
-0.00406185931155
-0.00739116576571
-0.00568588444119
0.00383958150378
0.00108299067955
-0.00133916018971
0.000396794344145
-0.00851432817048
-0.00525509052444
-0.00349870227185
-0.000978580809426
0.000936070202265
0.00951924061674
-0.00568703187107
-0.000591038814942
-0.016172782451
-0.0015094591865
-0.00283450940561
-0.00393486512526
-0.00254210859259
-0.0043832529348
-0.00876007608597
-0.00398021268626
0.00529252759577
0.0022162805335
-0.000522348850872
-0.000654563537833
-0.00599681995453
-0.00468522075765
-0.00262028026367
0.000488813753236
0.00548191974938
0.00824983001612
-0.00517558302403
-0.000334745539588
-0.0159773031188
-0.00144562726206
-0.00138190875912
-0.00529697411528
-0.00521569550096
-0.00787609120759
-0.0104895303859
-0.00194708502041
0.0049146839368
0.00303660282043
0.000392390285802
-0.000967127292666
-0.0049064941694
-0.00618893021676
-0.00105913281009
0.00227197299998
0.00964529661667
0.007353706894
-0.0034563913442
-0.000279721113501
-0.0172044859868
-0.00321321633696
-0.000175426437622
-0.00549075587243
-0.00794515416817
-0.0131457435903
-0.0122173319648
-0.00108508495171
0.0040591030151
0.00379307826993
0.00157678719104
-0.000414280929915
-0.00526202150738
-0.0104508485444
0.00104608661943
0.00471784060391
0.0109490151816
0.00712076094495
-0.00117918207575
-0.000419395083096
-0.0200992036784
-0.00690715861689
0.000657549173056
-0.00130430955622
-0.0100475021817
-0.0185451997959
-0.0138177868043
8.01650830128e-05
0.00378402345221
0.00365287064461
0.00147516631005
-0.000541901863577
-0.0116630055946
-0.0168151938891
0.00125766880293
0.00483591741367
0.00959193724231
0.00283802646169
0.00131326184024
-0.00389356769536
-0.0249775661321
-0.0147412871728
-0.000507020461179
0.00249916386752
-0.0141788732147
-0.0240072971495
-0.0144109354278
-0.00720286086586
-0.00185257743464
-0.00141644449634
-0.00791872987639
-0.00844919568461
-0.0243910572026
-0.0262480159377
-0.00864415096124
-0.00451089722838
-0.00377768100284
-0.0151917296379
-0.00565559969622
-0.0185586322236
-0.0306784294193
-0.027133087993
-0.0116794210302
-0.00656888538288
-0.0247163762339
-0.0297580409103
-0.0206126992805
0.023714317238
0.0181337348679
0.0075373581895
0.0028511879457
0.0122105343126
0.00699355826369
0.0078617788237
0.0277472624838
0.00218156004044
0.000918557748196
0.00711568232134
0.025095904698
0.00760105025249
0.00388758752028
0.0068371228431
0.0155956222372
0.0287149102602
0.00590566466549
-0.0015506470973
0.023669840984
0.0124840378544
0.00319649402976
-0.00276898065971
-0.0105255535614
-0.000500436813365
4.38775346491e-05
-0.00608910940627
0.0191469480728
-0.00630058279342
-0.00807428505275
-0.00205403204813
0.0161716890328
0.000538414277801
0.000161102633875
-0.00425327879596
0.00117418908549
0.019675876431
-0.00485351066461
-0.00947479291207
0.0123457758358
0.00838129899982
-0.0015964825455
-0.00164243834384
-0.00636509780137
-0.000990510628477
-0.00898833484628
-0.00686802493436
0.0138896398827
-0.00337292617726
-0.0046338424467
-0.000985750171378
0.0133537517247
0.00151467709541
0.00342216403718
-0.0021267865396
-0.00459786633141
0.0125297153884
-0.0059047981105
-0.0107816157849
0.0074268116731
0.00767377538594
-0.00305113353346
-0.000350435770885
-0.00210681968281
-0.00476354510892
-0.00868716928548
-0.00583553683538
0.0105073699812
-0.0015142804008
0.0021994609338
-0.000541205604566
0.0122891660037
0.00271449558619
0.00474211277298
-0.000782459398881
-0.00489836528619
0.00753911575846
-0.00596724568711
-0.0130538380408
0.00624986407929
0.00671029387002
-0.00381664384593
6.58690959341e-05
-0.000366030252704
-0.00738225158172
-0.00425933298677
-0.00449208931911
0.00831558942105
-0.00061198477995
0.006188302585
-0.00230793842961
0.0113102998621
0.00438076337218
0.00601471172972
-0.000893820517334
-0.0043943647898
0.00405255551876
-0.00598796189436
-0.0128129392185
0.00490047439758
0.00510621099489
-0.0039949016528
-0.000723376138005
0.000397489430192
-0.00654166330404
-0.00190400447299
-0.00297978375893
0.00707347559912
-8.97585328264e-05
0.00803247367536
-0.00508928503685
0.0098340252183
0.00547447502237
0.00766179627737
-0.000985357656364
-0.00352709547562
0.00138966350387
-0.00507976292144
-0.0101783367718
0.00077980262014
0.00318303391199
-0.00349446826515
-0.00392097323521
0.000628013738836
-0.00587560792534
-0.000894466743038
-0.00128572564563
0.00635575946946
9.4503657139e-05
0.0090318294546
-0.00903500264639
0.0080252718442
0.00551126315701
0.00751976914342
-4.14082116373e-05
-0.00176767585981
-0.000436159925018
-0.00302951211119
-0.00882846770617
-0.00379783543682
0.000785510436807
-0.00163129482859
-0.00774892718702
0.000337691015238
-0.00676852264451
-0.000742318936007
-0.00121979965512
0.00584165768806
-0.00131753544395
0.00935456656437
-0.0142926446369
0.00676698051355
0.00365467778371
0.00417811990293
0.00122065153471
0.00188508901598
-0.000271895584146
-0.001438878161
-0.0103938920527
-0.00912736142012
-0.00237314177627
0.000293655237902
-0.0114843319785
-0.00237048580017
-0.0109230088699
-0.00454242324787
-0.00603094549657
0.00452852544244
-0.00737479954868
0.00616002296754
-0.0205240092617
0.00533323729536
0.000290028167959
0.0035224532601
0.00167579445193
0.00358343211385
0.00178973756993
-0.001667287679
-0.0153731961662
-0.0156477765997
-0.00944890061828
-0.00661990931854
-0.0189007530267
-0.0140923848038
-0.0212448041494
-0.0176657696646
-0.0156933129354
-0.00577767086557
-0.0213616509925
-0.00949935801951
-0.0282270938956
-0.00452944283575
-0.0135741380112
-0.00493776368637
-0.00861991490633
-0.0096966317633
-0.0036314598576
-0.0120979053786
-0.0250595746401
-0.0249539827149
0.0299627668802
0.0132841332718
0.00651454289096
-0.00514688973065
0.00276817703355
0.00329251023586
0.0182492156853
0.028218451667
0.000973908045348
-0.00197270754696
0.00167294005008
0.0204838561506
0.0163342421052
0.0276060894263
0.0284884888954
0.0242492338335
0.0211812365973
0.00737297809532
0.0137169957805
0.011931600061
0.0252914856944
-0.000295271586392
-0.00493120790888
-0.0172515433251
-0.0111831720485
-0.00815075218999
0.00384913901036
0.0165360945627
-0.0104479530841
-0.00990913435029
-0.00434230550554
0.0106573593887
0.00163227577599
0.0168153636748
0.0207058500357
0.0106059652876
0.00595223863291
-0.00693340899041
-0.00467007827504
-0.00544732747238
0.022075036162
-0.00240599238065
-0.00347769087611
-0.0186435959621
-0.0115479563566
-0.00887584305667
0.000651250261112
0.00819709629447
-0.0111819179248
-0.00846545230981
-0.00417342372792
0.00766235487421
-0.00161518116587
0.0104079231465
0.0161172212589
0.00369563361474
-0.0013655247685
-0.00905511183336
-0.0105844821916
-0.00903082132318
0.0194520770576
-0.00196589528724
-0.00205909376466
-0.0193158082542
-0.00972906165795
-0.00444784194866
0.00119369278627
0.00443556363401
-0.00951616215196
-0.00785027200794
-0.00398711070508
0.00710793375993
-0.000411062384476
0.00747744615056
0.0132694758046
0.00250579578685
-0.00422582944009
-0.00723199651268
-0.0104417816721
-0.00878446195503
0.0170720972447
-0.00162091344218
-0.00169577299657
-0.0201542319058
-0.00951657360727
-0.00111692898793
0.00208896418852
0.00330109254987
-0.00747467928673
-0.00786742521002
-0.003050187914
0.00731890881435
0.00193665333493
0.00593338901013
0.0106731780264
0.00321406321638
-0.00489376973265
-0.00500481115714
-0.00984578245775
-0.00802626621828
0.0144434897482
-0.00170400863052
-0.00163462722356
-0.0210456271136
-0.0118598259285
0.000388625871618
0.00298698588619
0.00354760387704
-0.00584801922949
-0.00857725139857
-0.000931501199828
0.00791526649543
0.0050093956264
0.00456326651019
0.00812133241024
0.00485533207263
-0.00464979255596
-0.00369667012668
-0.00977884426862
-0.00707607400538
0.0109582148725
-0.0013034030581
-0.00208182218305
-0.0220129551963
-0.0150069633775
0.000583862855174
0.00422597299054
0.00418306042553
-0.00490693333992
-0.0096259135376
0.00162976549204
0.00876972866919
0.0082761828904
0.00451865359064
0.00714194765897
0.00725751983531
-0.0037044926455
-0.00334258250493
-0.0100539558208
-0.00637269139927
0.00631001325606
0.00155606908107
-0.00465099561524
-0.023212659913
-0.0186484325319
0.00109546288648
0.00623894504947
0.00519240989251
-0.00476533983063
-0.0113776432002
0.00361082450211
0.0100824951428
0.0107010014064
0.00458801365821
0.00754490281149
0.0101008590328
-0.00145708052742
-0.00355917908244
-0.0103919295979
-0.0062509958669
0.0016763317904
0.000726435017945
-0.0124893660929
-0.0249991181872
-0.023444860014
0.00252813252568
0.00685877815158
0.00429466510351
-0.00870656664709
-0.0152375874154
0.00312516854755
0.0110951566366
0.0106526205949
0.00464302192785
0.00802965539109
0.0119092053104
0.00246941576238
-0.00889870502674
-0.01286147369
-0.00657610977399
-0.00656333166475
-0.0116373096084
-0.025338266577
-0.0297239826366
-0.0294485971656
-0.0060484434818
-0.00284042384687
-0.00608043905669
-0.0202428515939
-0.0241290208743
-0.00938029406849
0.0029806419578
0.00244115888283
-0.00265521814372
-0.00024730904704
0.0034157021927
-0.00378817713863
-0.0238642639339
-0.0202571338463
-0.0108719386942
0.0086111716964
0.00598222072015
0.00134241513481
0.000437007489012
0.0179171161259
0.00893526767527
0.0299659665217
0.0101103443414
0.0114903959302
0.01471302558
0.00999680950393
0.0107314218262
-9.83953336988e-05
0.00270831158991
0.024574823403
0.0117932504416
0.0132321129643
-0.0034835834105
0.00886805619017
0.0231740873169
-0.000726036402688
-0.0018070938104
-0.00795134256743
-0.00919754962125
0.000385113728589
-0.00556456501182
0.0246086949489
0.00013000362387
-0.00510060768199
0.00267847524733
0.00215710151405
0.00426432194104
-0.00953600940585
-0.00637779426739
0.014644832949
0.000259086991499
-0.000259983955147
-0.0123839903524
0.000637885778881
0.0128361553808
-0.00230972204509
-0.00249081829918
-0.00827695815768
-0.00746773070592
-0.0053030093165
-0.00669098794222
0.0218042442729
-0.00140894408511
-0.00659989365714
-0.000766381337493
0.00144508013788
0.0069279434471
-0.0100618248419
-0.00423962055995
0.00615020463743
-0.00172964770145
-0.00144485372083
-0.0128222776216
0.00310707519239
0.00616286680663
-0.00237461350384
-0.00255571699987
-0.00806340069593
-0.00442250714392
-0.00123081407447
-0.00433562418784
0.0210407689772
-0.00074020615806
-0.00366849001645
-0.00217040160809
0.00136262490872
0.00858832377535
-0.00993404515771
-0.0016348567193
-0.000383234494025
-0.00156791215133
-0.00087437419008
-0.0123399292407
0.00250651935969
0.00331933398393
-0.00187222122446
-0.00142944672432
-0.00872223755782
-0.00290941578162
0.00217812688171
-0.00098809523557
0.0205678716358
0.000510411796538
-0.00116842041849
-0.00260049607731
0.00149727123723
0.00806230559891
-0.00946097347784
0.000124918764349
-0.00293611843909
-0.00128544007006
-0.000309885460214
-0.0112448556258
0.000511726201452
0.00275410219916
-0.00115439879928
-0.000138083264776
-0.0104403042927
-0.00258979148452
0.00329160555989
0.00282814624893
0.0199909780982
0.00221774486526
-0.00037296825354
-0.00267897712698
0.00199203320852
0.00245158008616
-0.00794765537642
0.00144182836553
-0.00258922956026
-0.0010667141482
0.000445735882518
-0.00955499604931
-0.000716625969317
0.00188634284879
-0.000423477462473
0.000724960857871
-0.0129896566196
-0.00321117760312
0.00478403271255
0.00499164127104
0.0192213489805
0.00467784078024
-0.000375320425644
-0.00254553458353
0.00274128553731
-0.00269939226955
-0.00532449581821
0.00266715089559
-0.00125546623477
-0.000779777822988
0.00134103088261
-0.00800214403286
-0.00144652260988
0.00144389904376
0.00116703390791
0.00168875498717
-0.0166389629357
-0.00332634868734
0.00638372328483
0.00534149519315
0.0181358438717
0.00642433491665
-0.00323433589902
-0.0045016325547
0.00379510484472
-0.00309409026133
-0.00255627122393
0.00341775354084
0.000308113888415
0.000364988985891
0.00267906149887
-0.00747850184439
-0.00243681236848
0.000349209191497
0.00506510636972
0.00206187318492
-0.0220724876692
-0.00430301995038
0.00444369922556
0.00565241504524
0.016041596779
0.00399891910062
-0.0107948801186
-0.0100784030943
0.00295064946854
-0.00514326691171
-0.00122941832267
0.00155835699019
0.00100636104822
0.0040277655899
0.00425819879544
-0.0124311794449
-0.00572454522624
-0.00144651931198
-0.00083559069452
-0.0105825862535
-0.0293549365694
-0.0149252076432
-0.00917397297212
-0.00501785049139
0.00440401650898
-0.00762737609967
-0.0238450366286
-0.0210360666525
-0.00859281215348
-0.0183487046291
-0.0114452327054
-0.0112878447026
-0.00908647419916
-0.00153842211951
-0.00377640069632
-0.024299543666
-0.0164184262561
-0.00828233595608
0.00124320434348
0.0218030700594
0.0120857832251
0.011922023349
0.017853150795
0.029347845708
0.0279565341564
0.0203016299028
0.0141745114261
0.0259742043887
0.0289312952979
0.0237502593747
0.0122068181686
0.00291414799609
0.00869925951972
0.00909562061199
0.0183698126456
-0.00121576522553
0.0233520664951
0.00861173100812
-0.00384894258124
0.0139179573952
-0.00029012987543
-0.00133529741412
0.00389951648521
0.0200459964343
0.0193543093444
0.00643657174682
0.00176230674405
0.017951071698
0.0227267518889
0.0105131117875
0.000215834671441
-0.00629215067068
-0.00379622989089
0.00308731678444
0.00767604985777
-0.00685850402606
0.017339204945
0.00189116325702
-0.00345271151186
0.00989446242191
-0.0022798015549
-0.00195728323191
-0.000150498179837
0.0118985603295
0.0139488141753
0.00107968433678
-0.00590455892761
0.0124854484892
0.0182827942043
0.00316382644384
0.000379115033024
-0.00676503766058
-0.00534649323686
0.00368509203166
0.0064832575955
-0.004276379515
0.0127751794264
0.0015078475658
-0.00238263637038
0.00632338969358
-0.00123879140822
6.30392999874e-05
0.000870672202742
0.00697378297877
0.0125207962643
0.000409630298427
-0.00825784582549
0.00859133577681
0.0145641154332
-0.000644648331977
0.00181800000313
-0.00680963646714
-0.00574828030078
0.00236258312765
0.00683324197454
-0.00211562672621
0.00545241003943
0.00157798955322
-0.00106636894259
0.0039929645062
-0.00032582182056
0.00213685965646
0.00287002745599
0.00608994853788
0.011837602703
0.0011236349752
-0.00824292843565
0.00511983605519
0.0113261409665
-0.00131097696006
0.00299095006439
-0.00757562809814
-0.00594217411009
-0.00202840278761
0.00668441575991
-0.000680612291912
0.00186955383352
0.00134561242735
0.000197367819607
0.0030994274034
4.14152156218e-05
0.00308713830115
0.00469040316169
0.00699065438552
0.0108830170409
0.00272630239636
-0.00919219035454
0.00299516184163
0.00891156380523
-0.000169136870186
0.00350094622255
-0.00870574927443
-0.00524356459747
-0.00607196399578
0.00622758135998
-3.32467380678e-05
0.00159572163995
0.000328554137324
0.00111828421949
0.00303234103469
0.000147236729416
0.00320687513579
0.00633609378002
0.00948290875611
0.0110078212206
0.0043995626825
-0.0113216250743
0.00252269747709
0.00775129394587
0.00160616475702
0.00370415143539
-0.0102582149403
-0.00449417636533
-0.00842333030531
0.00479520298461
-0.00026416755211
0.00241063718839
0.000275743304472
0.00131961262412
0.00318580469968
0.000160249966722
0.000502796817864
0.00768238939865
0.0132565982906
0.0118210753501
0.00651806305092
-0.0140169826769
0.00200010844844
0.00796332689391
0.00357466541742
0.00371989967515
-0.0131819471664
-0.00530360539626
-0.00952605292124
0.00174596481638
-0.00409097766412
0.00414412125991
0.00175283562653
-0.00203030418091
0.00217012567382
-0.00176886542496
-0.00508350689158
0.00838583923328
0.0140112473414
0.00838433414513
0.00699641073632
-0.017705839556
-5.88437579668e-05
0.00812319807544
0.00441596393709
0.00123024556038
-0.0189319482186
-0.0121733860723
-0.0116723575936
-0.00406483955353
-0.0121091743907
0.00533287699489
0.0011754490067
-0.0146357316282
-0.00790354702668
-0.013024333414
-0.0144871426529
-0.000307209117285
0.00331316625107
-0.0111945398024
-0.00458979317967
-0.0246342314865
-0.00844829591999
0.000257833074982
-0.00614453277676
-0.0134796650626
-0.0279922086378
-0.0250483593112
-0.0239631095841
-0.0167608877804
-0.0239538658101
-0.004756195534
-0.00982158848947
0.0259985377264
0.029128540357
0.0291366450274
0.0158210499226
0.011871917226
0.0286958627519
0.0090528538709
-0.00136956135256
0.00766912585456
0.0124405693114
0.0230351552612
0.0247776536975
0.00941805487851
0.0061273439349
0.00199202840883
0.0173104439219
0.028600934148
0.025179113665
0.0292245193935
0.0240053712982
0.0210229588395
0.0227654344082
0.0215225551784
0.00500976681198
0.00319845244362
0.0205190763572
-0.000653817431133
-0.00569069886727
-0.00076789981043
0.000915861190165
0.011259622564
0.0159691035432
-0.00325682481085
-0.00660790256136
-0.0116239863984
0.00364544804638
0.020976335365
0.0155873487067
0.02366448502
0.0152068882141
0.0178501585893
0.0183280619181
0.0160074850482
0.0030239171533
0.00301612050299
0.0156984129204
0.00116068089623
0.00176487132634
-0.00094207783128
-0.00226721583628
0.0071496803673
0.0107344203345
-0.00360724791371
-0.00470303015974
-0.0141167674377
0.00177651071595
0.0157492485284
0.0101535113171
0.0215687849433
0.0102437173451
0.0145515587183
0.0148487712325
0.0121735223424
0.00315049237161
0.00459376655194
0.0143033462106
0.0022384254549
0.00488203485544
0.00053523129925
-0.00341779816623
0.00633497705348
0.00577932224767
-0.00290122260161
0.00168844741805
-0.0152274273525
0.0043776069231
0.0126847070163
0.0071779657303
0.0204220348243
0.0063359912801
0.0113926287398
0.0122520905751
0.00858696227372
0.00352668837476
0.00568194920612
0.0133384175157
0.00259949878986
0.0065220946335
0.00112858962218
-0.00369159996711
0.00602477819252
0.000200454416034
-0.00192219736671
0.00558234709394
-0.0158608844362
0.00726135817656
0.0120959928115
0.00578345850497
0.0194894680128
0.00298978778913
0.00895630659799
0.0103499709284
0.00571337615493
0.00427312319007
0.00612642889553
0.0119690126362
0.00466077075481
0.00775568647036
0.000365226539317
-0.0036941185243
0.00579608064942
-0.00319487091348
-0.00010635262105
0.00709743845544
-0.0160634325725
0.0096005120768
0.0124680372476
0.0056290574449
0.0185510887906
0.00022899677382
0.00908157382248
0.00997394022664
0.00502356051399
0.0051653611078
0.00627752653841
0.0106500652792
0.00805368440201
0.00906646421276
-0.0022232318225
-0.00315406537924
0.00549980839245
-0.00277745596066
0.00063164922131
0.00699076214883
-0.0157547195432
0.00971102608663
0.0135774009073
0.00615676824253
0.0174347540315
-0.000364019685792
0.0105599337628
0.0104953831779
0.00496204530994
0.00598425011975
0.00672373686912
0.00983781105798
0.00998081806304
0.0103666081458
-0.00750084427057
-0.00190246794719
0.00502789043613
0.00109534689355
0.00128475202526
0.00347472710105
-0.0150043407244
0.00745743125789
0.0102402070943
0.00685149368541
0.0159371528293
0.000104566201502
0.0123413668065
0.0109126820253
0.00431773780467
0.00569628772743
0.00513918029534
0.00707615101746
0.00948621869835
0.00799771479391
-0.0158641006101
-0.0030974295108
0.00238750119838
0.00560894751431
0.0018636277925
-0.00527167472643
-0.0144716237461
0.00099677246278
0.00233202241369
0.00417817179153
0.0129670583926
-0.00478544331146
0.00350018238766
0.00200848483625
-0.00484481034196
-0.00123437342702
-0.00597384989261
-0.00922796821478
-3.99224009113e-05
-0.00904012952466
-0.0271772735508
-0.0145634587157
-0.0132851503664
-0.00363554294403
-0.0103005121853
-0.0226366096953
-0.0230359210367
-0.015623090253
-0.00436924953665
-0.00866738761169
0.000219038734334
-0.0196574921915
0.0112001408285
0.00910575362136
0.00429122396901
0.00212124498805
0.00589431754343
0.0178142247033
0.00657920259496
-0.00839418699205
-0.00124902838809
0.00652777588918
0.0292274731073
0.0233812805946
0.0046849652883
0.0161984512503
-0.000864767324222
0.0104564156887
0.0290409138337
0.0211252369566
0.00438813048304
0.0259080318483
0.00430004501623
-0.0037268368499
-0.0069505978017
-0.00663208949394
-0.00101059850253
0.00229206671011
-0.00433878378405
-0.0191462428569
-0.0104151624288
-0.00457721329912
0.0220127184219
0.0137606213748
-0.00731756098358
0.00863621400912
-0.0125430084067
-0.0048032533973
0.0239549432509
0.00741182102125
-0.00564087462739
0.0166956609027
0.00432236880958
-0.0067716771225
-0.00734568828502
-0.00578515562914
0.000835192217807
-0.00290997479889
-0.00100242482363
-0.0197740255825
-0.00951357395938
-0.0050188518769
0.0164887608473
0.00592834198313
-0.009550843755
0.00506612690339
-0.0109243117587
-0.00642348818806
0.0209326866137
0.00689233180392
-0.00673341777361
0.0113259504178
0.00415982964118
-0.0095339987995
-0.00634555451795
-0.00302233814262
0.00307615765581
-0.00226107745471
0.00347325163985
-0.0197356920882
-0.00840221755092
-0.00316727080834
0.0133491581071
-0.000381366344021
-0.00578916790536
-0.00159900479884
-0.00843315913916
-0.00437114933011
0.0188456473493
0.00938403395748
-0.00772822076673
0.00919682885044
0.00270140780971
-0.0108222203282
-0.0057251792866
-0.000639616677557
0.00438067810854
0.000994388031213
0.00364266638735
-0.0196849520968
-0.00744570380343
-0.000465239363354
0.0120764647387
-0.00237105285649
-0.0018237388704
-0.00624364399829
-0.00789986985532
-0.00224375488474
0.0181988277626
0.0103616093989
-0.00972761634014
0.00902703335691
0.00201819893149
-0.00968692725189
-0.00398227672608
0.00150427911123
0.00467377850251
0.00279157154665
-0.000641404861494
-0.0204956603249
-0.00671206439941
0.00342674688121
0.0112729411814
-0.0019195446281
0.000296403245174
-0.0065719434534
-0.00735049526884
-0.000371357309525
0.0184190210457
0.0102577342346
-0.0114806097054
0.00761869004837
0.00224458254218
-0.00758048848924
-0.000526065714958
0.00301712485942
0.0043758822133
0.00335696921573
-0.00489545384675
-0.0225111804075
-0.00645833052761
0.00469422304682
0.0109379766352
-0.0010205258753
0.000836211009881
-0.0075125801395
-0.00538607495716
0.00142291568909
0.0185619917612
0.00931289280398
-0.0126825167728
0.00371527881332
0.00324844402962
-0.00373814422265
0.00178404193708
0.00338646292694
0.00360506172632
0.00430488415017
-0.00928620872328
-0.0249774812342
-0.00672847177097
0.00343076557078
0.0114947246135
0.00110926498923
0.00109458204016
-0.0127529874275
-0.00254428516276
0.00358559337558
0.0181344900813
0.00739753761361
-0.0142671608662
0.00190360896311
0.00287716015673
-0.000146798782313
0.00165252660823
-0.00187103224262
0.000250535006926
0.00398698922671
-0.0152793576459
-0.0277848843613
-0.00721707390542
-0.00503246982033
0.0113123850977
0.00617981655898
0.0018389716816
-0.0177606164828
-0.000509368652292
0.00516409691012
0.0155270965821
0.002126104742
-0.0195571363259
0.000898382056598
-0.00724810629075
-0.00818077580893
-0.011422555724
-0.0180243023687
-0.0125792905219
-0.00535016456291
-0.0248461690798
-0.031110776927
-0.0181498150191
-0.0228999460466
0.000429251398312
-0.000237315820996
-0.00981493813922
-0.0207041297989
-0.00750175291992
-0.00454104975039
-0.00135753648955
-0.0130319013653
-0.028037981452
-0.00998956672237
0.0283300627821
0.000515459573678
0.00756502174992
0.0110522707044
0.0232358148827
0.00920417237202
-0.000407719199848
0.00201796186445
0.00624725457642
0.0239693634559
0.0128811603281
0.000701068675287
0.000406828568425
0.0140643443199
0.0289871813166
0.0309923942753
0.0202487392508
0.0122642418406
-0.00478710070899
-0.0021336491363
0.0202684527712
-0.00927769314736
-0.002294316306
0.00173507865079
0.0136709969345
-0.0057597688525
-0.0138558544468
-0.00818631658031
-0.00224211459205
0.0128709207824
-0.00484741625334
-0.0113922009089
-0.0150589958763
0.000660219022245
0.022332379175
0.0277739292805
0.00789307400123
0.000781508053145
-0.0122804513699
-0.00798609197828
0.0149936103556
-0.0112483322742
-0.00539885523369
0.00151320710368
0.0111876051118
-0.00822405610949
-0.0149878110121
-0.00770618447421
-0.000979968924148
0.00715520927359
-0.00852624045154
-0.00793842798164
-0.017876044905
-0.00596875772736
0.0177928284378
0.0250903345786
0.00482516534049
0.00206807452268
-0.00812410948126
-0.00383975038328
0.0117052245522
-0.0113230982051
-0.00879205359934
0.0025316866908
0.00933784824295
-0.00746934758883
-0.0141322137486
-0.00747893455222
0.000458291163306
0.00660995417425
-0.00738589184943
-0.0043119407587
-0.0184132471779
-0.0076765422465
0.0145130368241
0.0229748907837
0.00678270672123
0.00648015279845
-0.00276028848415
-0.00138305955845
0.010208701574
-0.00767120818094
-0.0130415336909
0.00280832455609
0.00727263938155
-0.00545968015896
-0.0119305252371
-0.00936132644173
0.000905534534078
0.0069134462877
-0.0049005776597
-0.00304324865592
-0.0180354172584
-0.00678235880441
0.0118987365455
0.0209500342641
0.0111840023219
0.00844983674057
0.000580426626275
-0.000618311414883
0.00898401534956
-0.00374641804673
-0.0154402906719
0.0021598853055
0.00484155870781
-0.0031804892727
-0.00955441966152
-0.0122427796691
-7.50692691286e-05
0.00711122650199
-0.00255241211986
-0.00262670059634
-0.0170925184505
-0.00295196850637
0.00963630144739
0.0187920366083
0.0146308845663
0.00870054356787
0.00194899080703
-0.00124065177913
0.00855535860148
-0.00102194700047
-0.0168934011383
0.000749269227594
0.00256257208763
-0.00198626343074
-0.00858151389663
-0.0152445203007
-0.00202787593866
0.00694597049868
-0.00161229094253
-0.00235556843024
-0.0167481797853
0.000724076691077
0.00777596888254
0.0165162880379
0.0164408797563
0.00975969481297
0.00197384227765
-0.00258633117826
0.00769148048413
-0.00128992121747
-0.019078070016
-0.000547652327443
-0.000491985812782
-0.00209963956865
-0.00864677968087
-0.0184827750266
-0.00349546574788
0.00665366313914
-0.00369631873212
-0.00213719789108
-0.0188536325682
-0.000374912691981
0.00686314413645
0.0138488551708
0.0161034883751
0.0125809316293
-0.00169748134683
-0.00578112321561
-0.000614810588643
-0.0016626558545
-0.0237804555618
-0.00277558473962
-0.00401682754995
-0.00580009279097
-0.0122740254716
-0.0230752482816
-0.00488028801041
0.00564427181104
-0.00982515364547
-0.00217153577673
-0.0241462537785
-0.00632528119232
0.00547164080994
0.00978510001595
0.00905547919563
0.0117071115625
-0.0104556251692
-0.0129041603454
-0.0147774832188
-0.00825019184196
-0.0298148605444
-0.014475779876
-0.0148353069203
-0.0167813508439
-0.0211614249484
-0.0297311059114
-0.0152207996798
-0.00354882805278
-0.0215089737056
-0.0117710362163
-0.0301962093202
-0.0181439740101
-0.00485428902217
-0.00149543540483
-0.0144578954531
-0.00433450515644
-0.0253715095575
-0.0249781401125
0.0207739609004
0.000134421556893
-0.00205367236211
0.0178012993303
0.0284105390347
0.0136591524493
0.0055139729605
0.00782514034414
0.0182527835743
0.028073980213
0.00740309995706
0.00126827773832
0.00466121164631
0.0146786993845
0.0192230352677
0.0305636751085
0.0244652290166
0.0179839353468
0.00529631806336
-0.000505893654695
0.00908885026925
-0.00908462061764
-0.0075790936709
0.00665976431754
0.0219400585988
6.23807205418e-05
-0.00486862848187
-0.0029201023323
0.0040203546221
0.0194405025116
-0.0086990904129
-0.0141908894725
-0.00653635198862
0.00252258837535
0.00678234749407
0.0262634583051
0.0125893576053
0.00574614082376
-0.00531618359462
-0.0118471135919
0.0029312609989
-0.0102022457667
-0.00617557400934
0.00375282960106
0.0166985866849
-0.000808214365356
-0.00910150992008
-0.00358264244707
0.000105391012072
0.0129190116807
-0.0118569069913
-0.0145467346367
-0.00527992864845
-0.000585891013794
0.00360473146146
0.0223166236864
0.00329677279776
0.00374529413372
-0.00347411110494
-0.0124442137544
0.000374690424728
-0.0105248535461
-0.00769978269927
0.0070135691496
0.0114476569904
-4.95720452152e-05
-0.0124115055319
-0.00289576343759
0.00077106520038
0.0094696275798
-0.0102461967605
-0.0102207791488
-0.00325303593803
0.000336489845401
0.00518986380775
0.018787048976
0.0019575945837
0.00240364937597
-0.000326599690128
-0.0123051191366
-0.000561057031285
-0.00980307937514
-0.0104837960927
0.00844414407444
0.00631483204079
-0.0010539769313
-0.0123431120626
-0.00232437871689
0.00184788963556
0.00723085613953
-0.00723917371749
-0.00631988439833
-0.00206655143471
0.00340085975675
0.00721903350795
0.0163994431529
0.00263917087247
0.00029041674596
0.00170314924413
-0.0124077784435
-0.000861659022044
-0.00858379412822
-0.0117354071048
0.00765985693815
0.00335544104965
-0.00204918971513
-0.0104633023729
-0.00122144038135
0.00283801241397
0.00558168604601
-0.00434348826328
-0.00460108655763
-0.00203439396055
0.0054055728445
0.0080380969545
0.0149856231025
0.00317164834421
0.000386141576942
0.0027544431044
-0.0122663548965
-0.0010691706655
-0.00764887205985
-0.0124800308561
0.00708586659965
0.00392797585425
-0.00108344241394
-0.00939569798731
0.000117272275142
0.00402993981864
0.00446614157784
-0.00231537499851
-0.004233798899
-0.00295628539095
0.00716614372809
0.00958974440026
0.0139390200347
0.00372299484951
0.00316509931395
0.00315543729372
-0.0109428789814
-0.00129076071317
-0.00731686390807
-0.0135676353612
0.00589147885987
0.0068740240617
0.00154607402946
-0.0104491588946
0.000642828080673
0.00613667536469
0.0031638503873
-0.00110570353701
-0.00434270193872
-0.00464298038934
0.00738675820014
0.00930895787783
0.0128550262413
0.00308769091566
0.00686809417187
0.0016347400858
-0.0083710876639
-0.00203654282445
-0.00817966689583
-0.0167730571336
0.000975229466899
0.0112253381753
0.00662775630154
-0.0160228002809
-0.00448638424503
0.00570008984625
0.000734113773063
-0.00181926868589
-0.008560844773
-0.0101073395045
0.00194949818039
0.00586611540147
0.0121494872161
-0.000674938670781
0.0061136346878
-0.00677471862887
-0.00698883137322
-0.00925854765671
-0.0160540215647
-0.0258652990149
-0.00990719033967
0.00436500728316
0.00334048851641
-0.0255693970069
-0.0201394167197
-0.00754145404252
-0.0097575718379
-0.0120876637924
-0.0217887537093
-0.0227678901096
-0.0150035721601
-0.00409838817766
0.00385546968688
-0.0143311642624
-0.00851539753368
-0.0246374665956
-0.0150588881661
0.0241719973442
0.00785542006784
0.0174488325238
0.0127181230019
0.0267036066766
0.018960549038
-0.00247681868974
0.00467160112064
0.0250090626428
0.0286528325374
0.0127045556577
0.00192553522528
0.00249138549473
0.0121561182385
0.0195595218001
0.02936806124
0.0222565024644
0.0255117276833
-0.000442526744523
0.00605604039068
0.0102123174124
-0.00191538467474
0.00481343254004
0.00137091281209
0.0198895829618
0.0087003305974
-0.00939623818759
-0.00156519076902
0.0153926371814
0.0221629733338
0.00250273455588
-0.00910762302536
-0.00711608691436
0.00111207651392
0.0097691110193
0.0219466288455
0.00763082415623
0.0159180228093
-0.0129690880087
-0.0098848104314
6.18068237105e-05
-0.00292543045527
0.00148736766625
-0.000377287042987
0.0162540095817
0.00933876900743
-0.00815507847421
0.000504712924767
0.00994669502688
0.0184779495954
0.000817203020264
-0.0100236908832
-0.00385396330543
0.00135605191201
0.00654901914588
0.014288423875
0.00181066946111
0.00899882228378
-0.0136022794731
-0.0117525196358
-0.00481144813078
-0.0025998791042
0.000981930133862
-0.000461821915358
0.013345124716
0.0110316496173
-0.00564370797877
0.00152404982056
0.0072946588342
0.0176328698134
0.000163863311925
-0.00902467113933
-0.00106342605559
0.00239955559162
0.00610462166492
0.00740494681864
0.00161087501434
0.00383839943767
-0.012402614059
-0.0115422159491
-0.00464427599045
-0.00204714373352
0.000444654831752
-0.000347239793405
0.0105819662422
0.0129955782966
-0.003003242867
0.00248859322005
0.00625568948289
0.0172752556808
0.000341957637208
-0.00811020945691
-0.000969267251824
0.00198271274422
0.00628760229079
0.002561234808
0.000129731517394
-0.00037858132936
-0.011082674726
-0.0105992890117
-0.00363371464198
-0.00211504910612
-0.000152315873774
1.45279097764e-05
0.00782050686202
0.0144059306766
-0.000528611621973
0.00317768368186
0.00630542443603
0.0167699326682
0.00161883964752
-0.00813878794288
-0.00436025806756
0.00234901396573
0.00558850617134
-0.000165528024033
-0.0024977157313
-0.00547473817215
-0.00969664965129
-0.00891958157778
-0.00318857277533
-0.00454386603367
-0.000488910749292
0.000772095684028
0.00535333777887
0.0149214081642
0.00176551918134
0.00329076137723
0.00701141878847
0.0158586955609
0.00405296488171
-0.0100791590435
-0.00858052155278
0.00208603202271
0.00460467023977
-0.000810835800798
-0.0037558079016
-0.0088858277917
-0.0081788341894
-0.00685546967216
-0.00360298573806
-0.00841906488967
-0.000737363138877
0.000863538737527
0.00400343095442
0.0146269953649
0.00424815362121
0.00320637999474
0.00928265154122
0.0153683240423
0.0069940532738
-0.0124487675616
-0.0119123454848
-0.000196273927148
0.00406667236894
0.00058691723151
-0.00459134161477
-0.0143846988851
-0.00733229813721
-0.00622867442931
-0.0058263539489
-0.0135415942055
-0.00273402957116
-0.00313897725948
0.00231879104366
0.0135878461903
0.00527657744754
0.00159066019317
0.0106116278278
0.0136938840172
0.00446313748135
-0.0158646772734
-0.0167683045694
-0.00623623097813
0.00320319037448
0.00477111558245
-0.00675540859776
-0.019597109403
-0.00974417112323
-0.00994980180321
-0.0169650956221
-0.0225173182482
-0.011881490016
-0.0148266308276
-0.00562090046171
0.00339732799788
-0.00695925446212
-0.00996411213446
0.000274643651542
-0.00186141599695
-0.0146572400952
-0.0232862579911
-0.0262090898669
-0.018788067821
-0.0056074707406
0.000633214163561
-0.0132241895644
-0.0267527068871
-0.0204283429952
-0.021081261575
0.0268189727938
0.0187053759436
0.0197140302479
0.0148105130354
0.0256191810485
0.0276349863438
0.00705491627749
0.00846384594426
0.0221563499816
0.0305915248831
0.0188519402069
0.0123280916801
0.00345802264261
0.0110570462014
0.0275807853853
0.0233362976477
0.00343135631971
0.0121836718619
-0.000627755051769
0.00899668470129
0.0123387277147
0.00576863506366
0.0087947623567
0.00918567588015
0.0110189249306
0.0182029523485
-0.00186964497303
0.000572322581717
0.00929571067901
0.0265867621039
0.00628209482098
-0.00117317102405
-0.00751650910528
0.00156659324499
0.0192626248372
0.0144358982693
-0.00851181970962
-0.00714259325467
-0.00866501886815
-0.0030204163499
0.00123690137949
0.00274146299518
0.00172957823718
0.0114442587762
0.00287836445412
0.0162645550525
-0.000446875604879
0.000600215352457
0.00551866813578
0.0230631231351
0.00333806661595
-0.00287084379785
-0.0084664841781
0.00195668729518
0.0120055342032
0.00983407474404
-0.0100488699398
-0.010330737366
-0.00617471630089
-0.00383913312543
-0.00290758260607
0.00337751039014
0.0011761267905
0.0134770326325
-0.000375545606634
0.0152687358423
0.00110875803524
0.00196992885346
0.00602303624791
0.0200374616889
0.00413877256021
-0.00280780533713
-0.00802509421591
0.00355378942523
0.00627229404707
0.0071025195502
-0.0100819649886
-0.00845996740554
-0.00351934347964
-0.00241367861674
-0.00318215002952
0.00450232979002
0.00319710696663
0.0125777522534
-0.00216105519931
0.0133926519195
0.00177490807132
0.00310885709291
0.00730504102237
0.0175615934125
0.00528172274882
-0.00259127568142
-0.00711050504421
0.00662064511211
0.00181835964301
0.00462981631083
-0.00831282097879
-0.00713742538153
-0.0014126804698
-0.000711461959552
-0.00286930116508
0.00520540926755
0.00375724428366
0.0102006041432
-0.00277201903207
0.010953948501
0.00215994521081
0.00380745993832
0.00865336676758
0.0160117316895
0.00598496673704
-0.00255352709401
-0.00614685933204
0.00689506382664
-0.000810443629648
0.00204316513129
-0.00561782312854
-0.0108967446793
-0.000252581994799
0.00073227574619
-0.00247966364248
0.00488184616455
0.00225577495376
0.0103974199909
-0.00204343659908
0.0089449723197
0.00256922104353
0.00401170788257
0.00949946688308
0.0148514351901
0.00666556852719
-0.00300642753585
-0.00459443023082
-0.00370436984725
-0.00159196791138
-0.000154055314513
-0.00511665028606
-0.0154625969836
4.00300794809e-05
0.00172152239414
-0.00191634330287
0.00390644575431
-0.00299691008534
0.0113012579546
0.000261348122009
0.00678734962222
0.0028633242581
0.00340889217423
0.0098870270084
0.0147190348816
0.00731178501348
-0.00502997854242
-0.00259499231383
-0.0123768451415
-0.00134285187289
-0.00140584429981
-0.00623533727063
-0.0180225415845
-0.00148640809309
0.0020594111655
-0.00138648810306
0.00200478929325
-0.0122407345832
0.0109336838637
0.00133852564094
0.00417777017424
-0.000194194664991
0.000179626930358
0.00898124107314
0.0143629663588
0.0073963963543
-0.0120195522321
-0.00320636306317
-0.0150883613215
-0.00221339862293
-0.00308464604278
-0.010178110282
-0.0205394093279
-0.00760047054327
-0.00295209507644
-0.0096031601798
-0.0105174367626
-0.0240730786876
0.001447837329
-0.00830526925588
-0.00636084355241
-0.015136859225
-0.0104765373984
-0.00179789692187
0.00525279272397
-0.00291507416882
-0.0260523867806
-0.0140237249977
-0.0167616351679
-0.0117702880826
-0.0121965821666
-0.0187354179048
-0.0254129292804
-0.0214180523375
-0.0183983972025
0.0280764204803
0.01838202275
0.0118095079561
0.00562408307263
0.0190628065968
0.0214293546685
0.00330421885015
0.0163143032848
0.028579753712
0.0204963796121
0.00905978292516
0.0102074274643
0.0170654559534
0.0265295046005
0.0129925398791
0.00308537660474
0.00924564198561
-0.0050970185394
0.0122120219176
0.0150621684956
0.0187364193314
0.0111682064648
0.00559619752625
-0.00116485912681
0.00300457243319
0.010744438611
-0.00573814516124
0.00334446183671
0.0206177588989
0.00799674204026
0.000581718585168
-0.00140569212022
0.00114285100496
0.0176401860865
-0.00105188395625
-0.00488144604687
-0.00148947768192
-0.013972355904
-0.00400454161094
0.000103805645215
0.0135717139799
0.0113763603331
0.00712586131389
-0.000665065152195
-0.00326598121744
0.00538275401561
-0.00712068612419
-0.00104441293657
0.0154229708405
0.00213307443323
-0.000599122699922
-0.00301246687744
-0.00536883292756
0.0119327680492
-0.00259161253281
-0.00693526070274
-0.0029481065894
-0.0142587120488
-0.00543632281113
-0.00396737951667
0.0125240686822
0.0128475497915
0.00921493559097
-0.00120147799413
-0.0047214850138
0.0020036448358
-0.00812867990091
-0.00216710329079
0.012104269992
-0.000179171349615
-0.0012290277659
-0.0033261958987
-0.00600426173646
0.00801484128287
-0.00136644007532
-0.00898758785246
-0.00403947947805
-0.0143806451885
-0.00340952410213
-0.00439928258158
0.0129304632643
0.0144308152317
0.0103138609178
-0.00297655843616
-0.00440090872881
-0.000663295137178
-0.00920146051392
-0.00217165836716
0.00956945397367
-0.000366389346445
-0.00188029969325
-0.00342746069854
-0.00430398420912
0.00538058651726
-0.00063962032679
-0.00966230992014
-0.00499845746323
-0.0152818482607
-0.00195635133593
-0.00368507048608
0.0139319893925
0.0153094000339
0.0103055826316
-0.00358725428739
-0.00373813995315
-0.00243753344745
-0.010581330539
-0.00215781242409
0.00736979254515
0.000372399621117
-0.002643661439
-0.00359352339998
-0.00273406845814
0.00381279951529
-0.00365027652713
-0.00957329708939
-0.00572671052009
-0.015994397941
-0.000579473023571
-0.000730238756533
0.015306952837
0.0149566404144
0.00968566313951
-0.0031848404788
-0.00339432098048
-0.00267823982247
-0.0127440993205
-0.0024046741434
0.00537528155565
0.00144204292211
-0.00396126329938
-0.00385141450073
-0.0030077784057
0.00304565110178
-0.00735969997068
-0.00912598651994
-0.00642066483439
-0.0168819985874
0.000601836338622
0.00470230812421
0.0166721240503
0.01417056778
0.00878841198715
-0.00288618312062
-0.00310227088277
-0.00211526145237
-0.0163985677531
-0.00275931297485
0.00420701675315
0.00266506187979
-0.00659807495258
-0.00387232266956
-0.00298514972453
0.00311044559231
-0.00987826452049
-0.00895714144221
-0.00751416175628
-0.0186004696081
0.00135450259363
0.00878321546219
0.0163160208446
0.0130751439468
0.00649760503864
-0.00673139066647
-0.00476305768624
-0.00422093103507
-0.0217582313216
-0.00407626326474
0.00291415973272
0.00237191739369
-0.011997974309
-0.00422023788405
-0.00200645155602
0.00295197734246
-0.0115995689686
-0.0114908632767
-0.012768097985
-0.0222733779409
-0.000245192075794
0.00679172256968
0.00566740003157
0.00254981935501
-0.00588195889455
-0.0199348444333
-0.0155500399488
-0.0180308449094
-0.0287635462069
-0.0135184721769
-0.00760524543602
-0.00702411995534
-0.0236949529822
-0.016617839332
-0.00976641774169
-0.00459548858987
-0.0186116858639
-0.0208237387135
-0.025872254181
-0.0288475200501
-0.0134533773703
-0.00953110378506
0.0291010400706
0.0261188167953
0.013984795671
0.000989281957095
0.0123092671137
0.000672191441755
0.00341268308004
0.0182154374325
0.0137250862958
0.0164963557646
0.0194613320932
0.0295281288448
0.0107425576256
0.0227729024256
0.00333633270186
0.0153533145488
0.0221640180718
0.0152660843774
0.020279557665
0.0265967268828
0.0218352208167
0.0183125696791
0.00378332639012
-0.00376195985379
0.00263131219281
-0.00490039904411
-0.00952504325139
0.000248129765976
-0.000886917459201
0.00495474372073
0.00754213882674
0.0229279889251
-0.00172051960333
0.0131119643428
-0.00653966476549
-0.00341268126488
0.0133679150765
0.00464409634831
0.00662373402142
0.0182235176995
0.0170669731976
0.0168527643235
0.00429275715645
-0.00102936553888
0.00198711261507
-0.000371510117403
-0.0113198829297
-0.00713436266086
-0.00514018290114
0.00109376159705
0.00365551429252
0.0173132345478
-0.000490202457062
0.00727858823791
-0.00722466678297
-0.0103253311669
0.0108172528991
0.00425178823175
0.00142895748986
0.0133027931059
0.0138802199049
0.0153932259291
0.00577821009816
-0.000268267435463
0.00142058153903
-0.00814080471004
-0.0118228528349
-0.00877024412202
-0.00711441598074
-1.97948288849e-05
0.00248849707904
0.0127687867967
0.00231819999237
0.00113153851043
-0.0068459523008
-0.011304934578
0.00788866382858
0.00542137825286
0.00107535908486
0.0108293802129
0.0128547813354
0.0124848222892
0.00772893042653
-0.000446749221978
0.000473265378504
-0.0122426552443
-0.00991528649693
-0.00802813354315
-0.00864360301836
-0.000864358237739
0.00253788077389
0.00946319407044
0.00409207008646
-0.00464994364118
-0.00635731192244
-0.00856504284319
0.00479334272551
0.00614958104544
0.00160900622564
0.0103076370853
0.0138720039807
0.0104468496645
0.00966376319942
-0.00186449553161
-0.000868258301048
-0.011545395829
-0.00706548072898
-0.00705066848571
-0.00941846472699
-0.00190921512421
0.0028905193933
0.00776146857131
0.00381197384489
-0.00637778070364
-0.0053193039745
-0.00313227916493
0.00433221823512
0.00280052831591
0.00201147519204
0.0103562803858
0.0154727660417
0.0095975670234
0.0102208955137
-0.00379460993605
-0.0019678735775
-0.0118809761728
-0.0049730785154
-0.00655388969739
-0.00966871029735
-0.00307027375961
0.00367908516986
0.0073247608907
0.00293078102377
-0.00657532423826
-0.00449999241953
0.00110733736021
0.00510024542937
-0.00264119071036
0.00197571178879
0.0108536625798
0.0169971860195
0.00633664066461
0.00716972725847
-0.00756391885589
-0.00345504302489
-0.0139308817716
-0.00579537449896
-0.00635413546633
-0.0103097086653
-0.00509429450228
0.00570529069375
0.00744922106473
0.00279917576155
-0.00583950940778
-0.00448068518446
0.00266335370246
0.00646032402595
-0.000908791881316
0.00261685383194
0.0110966626041
0.0167237522564
0.00586431084754
-0.000487863529683
-0.0143283032005
-0.00884846103962
-0.0160073805331
-0.0134803557565
-0.00721256415381
-0.0134527536766
-0.0104344077597
0.00848907073652
0.00666366502209
0.0027920646411
-0.00393475526262
-0.00766705764336
0.000650526337265
0.00718356652407
0.0037401620043
0.00333325377619
0.00935537586633
0.00669374470775
-0.004435257044
-0.0154066349305
-0.025842039568
-0.021658521225
-0.0211183728603
-0.0232184774558
-0.0156430902527
-0.023126392989
-0.0230590662315
-0.00057983480377
-0.00374451110063
-0.00486381984207
-0.00835275218294
-0.0194583399992
-0.0146098971102
-0.00167594064659
-0.00262513231265
-0.00457129613372
-0.00517266863218
0.0199191013032
0.0182375672789
0.0274504871853
0.0125929644314
0.00292162222364
0.000467379755365
0.01982700421
0.00108845000423
0.00687655472558
0.0081171009409
0.0222994202517
0.0229196509588
-0.00187151874419
0.00195605953065
0.0189617077212
6.28198165501e-05
0.0228007906991
0.00934297980161
0.0187416593852
0.0172904440014
0.0124344411156
0.00452397541081
0.0184432412753
-0.00922394747335
-0.0079589823357
-0.0116230952973
0.00364257012255
-0.0115858211049
-0.00527698414439
-0.00286858946644
0.0125694782644
0.0103973334685
-0.0122400273008
-0.00754751947485
0.00718547190672
-0.00972212122855
0.00876129858563
-0.00090815673809
0.00846972177481
0.00674707757305
0.00798755223648
0.000245647323593
0.00888000722569
-0.0175083823992
-0.00965652374194
-0.0121631269119
-0.0022871864563
-0.0123323620379
-0.00926648876923
-0.00481001269761
0.00820387012178
0.00264014451653
-0.0122123610802
-0.00662267388282
-0.00834959461968
-0.0101669425406
0.00229379394935
-0.00254104407412
0.00459309857754
0.00348189545983
0.00311858835527
-0.00212351125633
0.00308544751906
-0.0191774108823
-0.00963984398093
-0.0114623004782
-0.00276058942137
-0.0101899578042
-0.0123078386367
-0.00506581930802
0.00665815717462
-0.000933403855151
-0.00985961763162
-0.0070817956459
-0.0110673342237
-0.00699026910907
0.00106757965365
-0.00272280282599
0.00327601539052
0.00277601294526
0.00149805358147
-0.00234164783119
0.00222321032838
-0.0200375119625
-0.00515884185808
-0.0114100958842
-0.00212626462059
-0.00887738841878
-0.0144885010692
-0.00456554873795
0.00618268202754
3.81219552561e-05
-0.00789860654403
-0.00879984995911
-0.00740497745364
-0.00234687653237
0.0015808621428
-0.00131794679924
0.00210163467817
0.00335800420505
0.00399276868823
-0.00155718527787
0.0034063117852
-0.0206360960909
-0.00131101401993
-0.00969288976523
-0.00110547324665
-0.00885921445041
-0.0163026401514
-0.00333103401625
0.0063437282138
0.00365033019987
-0.00593051066758
-0.0120857198888
-0.0045110986145
0.000412572572019
0.00338222775236
0.000793959870294
0.000717484103778
0.00448866708575
0.00464392401467
-0.000217639908002
0.00599923567836
-0.0209468640627
0.000865617928878
-0.00780979442007
1.65557311844e-05
-0.0103993078178
-0.0181012611941
-0.00160636631427
0.00686305858026
0.00758409717776
-0.00456884752669
-0.0153849056032
-0.00328929875008
0.00117284139868
0.00634191595539
0.00261563419766
-0.001922929153
0.00569029676753
0.00348709549415
0.00166731848945
0.00869784379394
-0.0210194079999
0.00157192862626
-0.00528820226004
0.00129220762574
-0.0122241602473
-0.0204945433177
0.000554861035218
0.00778769445736
0.0109363142168
-0.0052248183438
-0.018063772462
-0.00383309454741
0.00109682196126
0.00999879408819
0.00431084189892
-0.00684204231756
0.00645120854308
-0.00373367503188
0.00410030379316
0.00832679048915
-0.0233386590876
-0.00170220400691
-0.000299346057016
0.00206363294573
-0.0152833366204
-0.0244318362244
0.000427672998801
0.00862289271213
0.0107742609259
-0.0115601113667
-0.0211666457986
-0.00989523598837
0.0011596819742
0.0120283780822
0.00506283305778
-0.0149464327986
0.00480393225024
-0.0160069762543
-0.00318114578743
-0.0023108258589
-0.0296482633559
-0.0161715334356
-0.00419527769177
-0.00266672562973
-0.023560587411
-0.0300281289056
-0.0107367214984
-0.000230802185573
0.000743177039758
-0.0237538182467
-0.0278954211404
-0.0222826441409
-0.0077819343332
0.00283978348327
-0.00666648112939
-0.0268370570416
-0.00717841106663
0.00192852912067
0.0238869277502
0.00906800387689
0.010549085739
0.0116134324131
0.0202612519771
0.00935022643039
-0.000450368920461
-0.00713584909242
0.00232220880832
0.0186157980624
0.0137316886148
0.0102585548332
7.14995699867e-05
0.0200691870152
0.0159920135755
0.0275606869111
0.0186751304421
0.00887998879082
0.00511536912281
-0.00573205712576
0.0102414711237
0.00258485276402
0.00550497614857
-0.00216537415559
0.00322262100613
-0.00169933315056
-0.00648391311379
-0.0189754572643
-0.00786229005217
0.0067992164959
0.00482965101203
-0.0016410065001
-0.0108807783764
0.00348564235824
0.000903737553827
0.0180030982099
0.00632039547749
0.000295263953923
-0.00246995522886
-0.00462624321201
0.00236832766489
0.00408496649665
2.08610826995e-05
-0.00150676787104
-0.00386206342997
-0.00106541517584
-0.00103124478005
-0.0203129129517
-0.00833646547165
0.00322158536772
0.00473252987914
-0.00426962380895
-0.0117569436529
-0.00399130623187
-0.00323319385324
0.0119206915778
0.00311885400607
0.000954208730685
-0.000120273804349
-0.00373425357274
-0.0010743005309
0.00521973265516
-0.0106473088362
0.000139501747282
-0.00576347832369
0.000743708704177
0.0015916076881
-0.020845395206
-0.00761985599295
0.00474716161569
0.00562468447476
-0.00396388811935
-0.0122445702542
-0.00503292360709
-0.00421804336612
0.00882113357259
0.0013763498866
0.00237734517838
0.000976681027996
-0.00365471095984
-0.0026747513811
0.00519325488443
-0.0128877265612
-0.00152243633167
-0.00577150497297
0.00135964432682
0.00203227155639
-0.0214301146132
-0.00677029713447
0.00806915976117
0.00428856626752
-0.00416964586722
-0.0132805232597
-0.00465410381784
-0.00486172166253
0.00731369290852
-0.00122379159003
0.00240246088831
0.00162944198283
-0.00390608022428
-0.00288098077391
0.00473488782714
-0.0134453258814
-0.00240313847629
-0.00466439623647
0.00141566104015
0.000185007656024
-0.021978339951
-0.0064877131828
0.0105996949511
-0.00041258843054
-0.00495546430439
-0.0144195075915
-0.00438613087059
-0.00482056005296
0.00634054721394
-0.00214486802839
-0.00120508564566
0.00106157452435
-0.00549064963269
-0.00185326728175
0.00352172155157
-0.014074635657
-0.00135050865656
-0.00242504385304
0.00123245219042
-0.00420667133563
-0.0228708109473
-0.00849428434397
0.00973415964114
-0.00590560258332
-0.00583302556133
-0.0161099163086
-0.00306964318371
-0.00412064414515
0.0061003359086
-0.00191638774545
-0.00688918002576
0.001497542755
-0.00714731298304
0.000872024967285
0.00270796436433
-0.0164619393856
0.000803165010154
-0.00125857154293
0.000392224266389
-0.0103661328634
-0.0243998858482
-0.0129104415789
0.00590241947186
-0.0100752680155
-0.00797952510079
-0.0191093411388
-0.00198801834581
-0.00252449976145
0.00684460560781
-0.000680103959818
-0.0130094304271
0.00306054986642
-0.0050932632292
0.000600172783699
0.00211565217313
-0.0191101972111
-0.000472859605543
-0.00175473171646
-0.00305028422192
-0.0184283004894
-0.0272056151531
-0.0198766979057
-0.004106744338
-0.0125396506421
-0.0131502692853
-0.0238628227737
-0.00513918331836
-0.00225861275429
0.00895325519433
0.00289794085191
-0.0196146315206
0.000641642049146
-0.0157638589735
-0.0101149551408
-0.00673911697265
-0.0236443504918
-0.01032605981
-0.0128732746177
-0.0156313512053
-0.0277332804818
-0.0308769284732
-0.0287092251559
-0.0192983921652
-0.0206085468357
-0.0225317285455
-0.0295671513922
-0.0176733036714
-0.0098351298871
0.00264143531349
-0.00341103945052
-0.0280766421977
-0.0145448703259
)
;
boundaryField
{
ground
{
type fixedValue;
value uniform 0.0327;
}
top
{
type fixedValue;
value uniform -0.0327;
}
left
{
type cyclic;
}
right
{
type cyclic;
}
front
{
type cyclic;
}
back
{
type cyclic;
}
}
// ************************************************************************* //
| [
"d.shipley.1341@gmail.com"
] | d.shipley.1341@gmail.com |
bb9f56b2d9ad4f27b103c7ad78d2fc4021201314 | 68af9795028bc44b4e1205f3407cd60a45f73776 | /Libs/LibCogmatix/CompositePart.h | fdb5bb262e6d606051b150568aa14322f5cb403f | [] | no_license | lindkvis/Cogmatix | 607c30c4f7a8bddfd6eeb82617e110bb982123a9 | b7dcc88a959d0fc62210bb50dc35d7dd4c73b68c | refs/heads/master | 2021-05-27T06:13:08.824681 | 2012-06-16T15:39:41 | 2012-06-16T15:39:41 | 4,606,449 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 848 | h | #pragma once
#include <osg/Geode>
#include "Node.h"
namespace LibCogmatix
{
class CompositePart : public TMachineNode<osg::Group>
{
public:
typedef osg::ref_ptr<CompositePart> Ptr;
typedef osg::ref_ptr<const CompositePart> CPtr;
// TODO: make this unicode
void loadGraphics (CoString fileName);
factory_protected:
CompositePart(NodeID ID, CoString name, CoString fileName) : TMachineNode<osg::Group> (ID, name)
{
loadGraphics(fileName);
}
~CompositePart() {}
CompositePart() : TMachineNode<osg::Group>() {}
CompositePart(const CompositePart& copyFrom, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
: TMachineNode<osg::Group>(copyFrom, copyop)
{
}
META_Node(LibCogmatix, CompositePart);
private:
String _fileName;
};
}
| [
"lindkvis@gmail.com"
] | lindkvis@gmail.com |
8778db54174f0a49064c0b97b58275fe7e13a3b8 | 6ccdb5faae5e4fc3d1be490790566ecb87ee0f03 | /controlCar_46_/controlCar_46_.ino | d8877c6d96da4f318ecec772767c9dfd115bf327 | [] | no_license | EmbeddedProjectInDonggukUniv/Smart-Traffic-System | 76ccdb9a237b18c11375152badbe9d54c92cfcab | ae975f14ba59af216b3b044665352829bd237ea5 | refs/heads/master | 2021-01-13T03:42:33.110648 | 2016-12-24T06:36:28 | 2016-12-24T06:36:28 | 77,269,764 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,882 | ino | #include <EEPROM.h>
#include <MsTimer2.h>
#define Node_ID 46// 아두이노 ID 강성지(42) 고성욱(19) 진대한(46) 윤지현(72) 이준희 (91)
#define Server_ID 248 // SM5 ID
#define Port_Num 7777 // 통신하기 위한 포트 넘버
int touchSensor = 12; // 터치센서 핀 설정
int ledPin = 13; // LED 핀 설정
int ledLightPin = 11; // LIght LED 핀 설정
int turn_light = 0;
int crashed = 0;
int nearby_crashed = 0;
uint16_t output;
uint8_t ID = 0;
uint32_t timer_check = 0;
uint8_t RX_flag = 0, TX_flag = 0, Timer_flag = 0;
// RX_flag 데이터를 받을 수 있는지 여부
// TX는 데이터를 보낼 수 있는지 여부
uint8_t EEPROM_buf[2] = {0xAA, 0};
char RX_buf[17];
uint8_t TX_buf[17] = {0xA0, 0x0A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0A, 0xA0};
int RX_count = 0;
void setup() {
int i;
static int RX_count = 0;
static char Check_buf[3] = {0, 0, 0};
Serial.begin(115200);
Serial1.begin(9600);
delay(50);
timer_check = millis();
Serial.println("Start Wifi Setting");
Serial1.print("AT\r\n");
delay(10);
Serial1.print("AT+WAUTO=0,Jin\r\n");
delay(10);
Serial1.print("AT+NDHCP=0\r\n");
delay(10);
Serial1.print("AT+NAUTO=0,1,192.168.43.");
Serial1.print(Server_ID);
Serial1.print(",");
Serial1.print(Port_Num);
Serial1.print("\r\n");
delay(10);
Serial1.print("AT+NSET=192.168.43.");
Serial1.print(Node_ID);
Serial1.print(",255.255.255.0,192.168.43.1\r\n");
delay(10);
Serial1.print("AT&W0\r\n");
delay(10);
Serial1.print("ATC0\r\n");
delay(10);
Serial1.print("ATA\r\n");
delay(10);
Serial.println("Wifi Setting Finish");
MsTimer2::set(200, TIMER_ISR);
MsTimer2::start();
}
void loop() {
uint16_t i;
long duration, cm;
pinMode(ledPin, OUTPUT);
pinMode(ledLightPin, OUTPUT);
pinMode(touchSensor, INPUT);
int touchValue = digitalRead(touchSensor);
if (touchValue == LOW || crashed == 1 || nearby_crashed == 1){ // 충돌 발생 시
crashed = 1;
digitalWrite(ledPin, HIGH);// LED 켜짐
} else { // 터치 안됨
digitalWrite(ledPin,LOW); // LED 꺼짐
}
if (turn_light == 0){ // 밤인 경우
digitalWrite(ledLightPin, HIGH);
} else { // 낮인 경우
digitalWrite(ledLightPin, LOW);
}
if(((timer_check+4000) < millis()) && (RX_flag == 0)) {
if(RX_count < 1) {
if(EEPROM.read(0) == 0xAA) {
ID = EEPROM.read(1);
RX_flag = 1;
Serial.print("\n\rID : ");
Serial.println(ID);
TX_buf[3] = ID;
} else {
RX_flag = 2;
Serial.println("\n\rWifi Connected Error");
Serial.print("\n\rPlease reset the ADK-2560");
}
}
}
if(Timer_flag && TX_flag) {
TX_buf[4] = 1; // data[4]
TX_buf[6] = crashed; // data[6]
TX_buf[7] = 0; // data[7]
TX_buf[8] = 8; // data[8]
TX_buf[14] = TX_buf[2];
for(i = 3; i < 14; i++) {
TX_buf[14] += TX_buf[i];
}
Serial.println("\n\rTX Packet data");
for(i = 0; i < 17; i++) {
Serial.write(' ');
Serial.print(TX_buf[i], HEX);
Serial1.write(TX_buf[i]);
}
Timer_flag = 0;
}
}
void serialEvent1(void) {
static char Check_buf[4] = {0, 0, 0, };
uint8_t i,check_sum = 0, RX_cnt = 0;
if(RX_flag == 0) {
char da = Serial1.read();
Serial.write(da);
Check_buf[0] = Check_buf[1];
Check_buf[1] = Check_buf[2];
Check_buf[2] = da;
if((Check_buf[0] == 'A') && (Check_buf[1] == 'T') && (Check_buf[2] == 'A') && (RX_count == 0)) {
RX_count = 1;
} else if(RX_count == 4) {
if(Check_buf[2] != ':') {
ID = ID*10 + (Check_buf[2]-'0');
} else {
RX_count++;
}
} else if(RX_count == 5) {
if(Check_buf[2] == ']') {
if((Check_buf[0] == 'O') && (Check_buf[1] == 'K')) {
RX_flag = 1;
delay(1000);
RX_cnt = Serial1.available();
Serial.println(RX_cnt);
while(1) {
Serial.write(Serial1.read());
RX_cnt--;
if(RX_cnt == 0)
break;
}
Serial.print("\n\rID : ");
Serial.print(ID);
EEPROM_buf[1] = ID;
if(EEPROM.read(1) != ID) {
for(i=0; i<2; i++) {
EEPROM.write(i,EEPROM_buf[i]);
}
}
TX_buf[3] = ID;
} else {
RX_flag = 2;
Serial.print("\n\rWifi Connected Error");
Serial.print("\n\rPlease reset the ADK-2560");
}
}
} else if((Check_buf[2] == '.') && ((RX_count == 1) || (RX_count == 2) || (RX_count == 3))) {
RX_count++;
}
else if(RX_count == 1) {
if(Check_buf[2] == ']') {
if((Check_buf[0] == 'O') && (Check_buf[1] == 'R')) {
RX_flag = 2;
Serial.print("\n\rWifi Connected fail");
Serial.print("\n\rPlease reset the ADK-2560");
}
}
}
} else if(RX_flag == 1) {
if(Serial1.available() > 16) {
Serial1.readBytes(RX_buf, 17);
if(((uint8_t)RX_buf[0] == 0xA0) && ((uint8_t)RX_buf[1] == 0x0A)) {
for(i=2; i<14; i++) {
check_sum += (uint8_t)RX_buf[i];
}
if(check_sum == (uint8_t)RX_buf[14]) {
Serial.println("\n\rRX Packet data");
for(i=0; i<17; i++) {
Serial.write(' ');
Serial.print((uint8_t)RX_buf[i],HEX);
}
if((int)RX_buf[10] != 0) {// When car crash occurred
nearby_crashed=1;
}else{
nearby_crashed=0;
}
if((int)RX_buf[12] == 1) {// 밝기에 따라 전조등 작동
turn_light=1;
}else{
turn_light=0;
}
TX_flag = RX_buf[4];
if(!TX_flag) {
for(i=4; i<14; i++) {
TX_buf[i] = 0;
}
TX_buf[14] = TX_buf[2];
TX_buf[4] = 1; // data[4]
TX_buf[6] = crashed; // data[6]
TX_buf[7] = 0; // data[7]
TX_buf[8] = 8; // data[8]
TX_buf[14] = TX_buf[2];
for(i=3; i<14; i++) {
TX_buf[14] += TX_buf[i];
}
Serial.println("\n\rTX Packet data");
for(i=0; i<17; i++) {
Serial.write(' ');
Serial.print(TX_buf[i],HEX);
Serial1.write(TX_buf[i]);
}
}
}
}
}
}
}
void serialEvent(void) {
Serial1.write(Serial.read());
}
void TIMER_ISR(void) {
Timer_flag = 1;
}
| [
"hanguk46@naver.com"
] | hanguk46@naver.com |
6990e7da85c5e8c546136116e22a110809be3deb | 078695ff4f7cd90d7fa20352c17e172f3205aa9a | /src/InventoryManager.cpp | 5a0a72a95ac4374b18a321065bcb0648a2e7c9d6 | [
"MIT"
] | permissive | maca134/3den_inventory_manager | 73620f107958ea77148b4e5233411d0c26bd16c9 | 8a2227317bf1a462073049a078d86740d101d87f | refs/heads/master | 2021-01-21T12:12:05.524642 | 2017-08-31T22:18:21 | 2017-08-31T22:18:21 | 102,050,117 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,684 | cpp | /* #Soxeba
$[
1.063,
["inventory",[[0,0,1,1],0.025,0.04,"GUI_GRID"],0,0,0],
[-1000,"background",[2,"",["0 * GUI_GRID_W + GUI_GRID_X","0 * GUI_GRID_H + GUI_GRID_Y","40 * GUI_GRID_W","25 * GUI_GRID_H"],[-1,-1,-1,-1],[0,0,0,0.75],[-1,-1,-1,-1],"","-1"],[]],
[-1001,"title",[2,"Inventory Manager",["0 * GUI_GRID_W + GUI_GRID_X","0 * GUI_GRID_H + GUI_GRID_Y","40 * GUI_GRID_W","1 * GUI_GRID_H"],[-1,-1,-1,-1],[0,0,0,0.75],[-1,-1,-1,-1],"","-1"],[]],
[-1004,"sepV",[2,"",["19.76 * GUI_GRID_W + GUI_GRID_X","1.27 * GUI_GRID_H + GUI_GRID_Y","0.4 * GUI_GRID_W","23.5 * GUI_GRID_H"],[-1,-1,-1,-1],[0,0,0,0.75],[-1,-1,-1,-1],"","-1"],[]],
[-1006,"capacityBorder",[2,"",["20.5 * GUI_GRID_W + GUI_GRID_X","3.5 * GUI_GRID_H + GUI_GRID_Y","19 * GUI_GRID_W","1 * GUI_GRID_H"],[-1,-1,-1,-1],[0,0,0,0.75],[-1,-1,-1,-1],"","-1"],[]],
[-1008,"capacityBackground",[2,"",["21 * GUI_GRID_W + GUI_GRID_X","3.75 * GUI_GRID_H + GUI_GRID_Y","18 * GUI_GRID_W","0.5 * GUI_GRID_H"],[-1,-1,-1,-1],[1,1,1,0.25],[-1,-1,-1,-1],"","-1"],[]],
[-1005,"targetLbl",[2,"Target Vehicle: ",["0.5 * GUI_GRID_W + GUI_GRID_X","1.5 * GUI_GRID_H + GUI_GRID_Y","19 * GUI_GRID_W","1.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]],
[-1002,"searchLbl",[2,"Search",["0.5 * GUI_GRID_W + GUI_GRID_X","3 * GUI_GRID_H + GUI_GRID_Y","3.5 * GUI_GRID_W","1 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]],
[-1003,"currentInventoryLbl",[2,"Current Inventory",["32.5 * GUI_GRID_W + GUI_GRID_X","2.5 * GUI_GRID_H + GUI_GRID_Y","7 * GUI_GRID_W","1 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]],
[1009,"capacityForeground",[2,"",["21 * GUI_GRID_W + GUI_GRID_X","3.75 * GUI_GRID_H + GUI_GRID_Y","9 * GUI_GRID_W","0.5 * GUI_GRID_H"],[-1,-1,-1,-1],[1,1,1,0.75],[-1,-1,-1,-1],"","-1"],[]],
[1501,"resultsTree",[2,"",["0.5 * GUI_GRID_W + GUI_GRID_X","6 * GUI_GRID_H + GUI_GRID_Y","19 * GUI_GRID_W","16.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]],
[1500,"currentItemsList",[2,"",["20.5 * GUI_GRID_W + GUI_GRID_X","4.5 * GUI_GRID_H + GUI_GRID_Y","19 * GUI_GRID_W","15 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]],
[1400,"searchInput",[2,"",["0.5 * GUI_GRID_W + GUI_GRID_X","4 * GUI_GRID_H + GUI_GRID_Y","15.5 * GUI_GRID_W","1.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Search Term","-1"],[]],
[1401,"amountInput",[2,"1",["0.5 * GUI_GRID_W + GUI_GRID_X","23 * GUI_GRID_H + GUI_GRID_Y","15.5 * GUI_GRID_W","1.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Amount of Items to Add","-1"],[]],
[1606,"clearSearchBtn",[2,"Clear",["16.5 * GUI_GRID_W + GUI_GRID_X","4 * GUI_GRID_H + GUI_GRID_Y","3 * GUI_GRID_W","1.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Clear Search","-1"],[]],
[1607,"addBtn",[2,"Add",["16.5 * GUI_GRID_W + GUI_GRID_X","23 * GUI_GRID_H + GUI_GRID_Y","3 * GUI_GRID_W","1.5 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Add X Items To Container","-1"],[]],
[1600,"deleteOneBtn",[2,"Delete 1",["20.5 * GUI_GRID_W + GUI_GRID_X","20 * GUI_GRID_H + GUI_GRID_Y","5.5 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Delete 1 Item","-1"],[]],
[1601,"deleteAllBtn",[2,"Delete All",["27 * GUI_GRID_W + GUI_GRID_X","20 * GUI_GRID_H + GUI_GRID_Y","6 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Delete All Selected Items","-1"],[]],
[1602,"clearBtn",[2,"Clear",["34 * GUI_GRID_W + GUI_GRID_X","20 * GUI_GRID_H + GUI_GRID_Y","5.5 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Clear All Inventory","-1"],[]],
[1604,"exportBtn",[2,"Export",["20.5 * GUI_GRID_W + GUI_GRID_X","22.5 * GUI_GRID_H + GUI_GRID_Y","5.5 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Export To Clipboard","-1"],[]],
[1605,"importBtn",[2,"Import",["27 * GUI_GRID_W + GUI_GRID_X","22.5 * GUI_GRID_H + GUI_GRID_Y","6 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Import From Clipboard","-1"],[]],
[1603,"closeBtn",[2,"Close",["34 * GUI_GRID_W + GUI_GRID_X","22.5 * GUI_GRID_H + GUI_GRID_Y","5.5 * GUI_GRID_W","2 * GUI_GRID_H"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"Close","-1"],[]]
]
*/
#define GUI_GRID_X (0)
#define GUI_GRID_Y (0)
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)
class RscText;
class RscButton;
class RscListbox;
class RscEdit;
class RscTree;
class ctrlStaticBackgroundDisable;
class ctrlStaticBackgroundDisableTiles;
class EdenInventoryManager {
idd = 11548;
enableSimulation = 1;
enableDisplay = 1;
onLoad = "uiNamespace setVariable ['EdenInventoryManager', _this select 0]";
onUnload = "uiNamespace setVariable ['EdenInventoryManager', displayNull]";
class controlsBackground {
class BackgroundDisableTiles : ctrlStaticBackgroundDisableTiles {};
class BackgroundDisable : ctrlStaticBackgroundDisable {};
class background: RscText
{
idc = -1;
x = 0 * GUI_GRID_W + GUI_GRID_X;
y = 0 * GUI_GRID_H + GUI_GRID_Y;
w = 40 * GUI_GRID_W;
h = 25 * GUI_GRID_H;
colorBackground[] = {0,0,0,0.75};
};
class title: RscText
{
idc = -1;
text = "Inventory Manager"; //--- ToDo: Localize;
x = 0 * GUI_GRID_W + GUI_GRID_X;
y = 0 * GUI_GRID_H + GUI_GRID_Y;
w = 40 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
colorBackground[] = {0,0,0,0.75};
};
class sepV: RscText
{
idc = -1;
x = 19.76 * GUI_GRID_W + GUI_GRID_X;
y = 1.27 * GUI_GRID_H + GUI_GRID_Y;
w = 0.4 * GUI_GRID_W;
h = 23.5 * GUI_GRID_H;
colorBackground[] = {0,0,0,0.75};
};
class capacityBorder: RscText
{
idc = -1;
x = 20.5 * GUI_GRID_W + GUI_GRID_X;
y = 3.5 * GUI_GRID_H + GUI_GRID_Y;
w = 19 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
colorBackground[] = {0,0,0,0.75};
};
class capacityBackground: RscText
{
idc = -1;
x = 21 * GUI_GRID_W + GUI_GRID_X;
y = 3.75 * GUI_GRID_H + GUI_GRID_Y;
w = 18 * GUI_GRID_W;
h = 0.5 * GUI_GRID_H;
colorBackground[] = {1,1,1,0.25};
};
class targetLbl: RscText
{
idc = -1;
text = "Target Vehicle: "; //--- ToDo: Localize;
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 1.5 * GUI_GRID_H + GUI_GRID_Y;
w = 19 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
};
class searchLbl: RscText
{
idc = -1;
text = "Search"; //--- ToDo: Localize;
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 3 * GUI_GRID_H + GUI_GRID_Y;
w = 3.5 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
};
class currentInventoryLbl: RscText
{
idc = -1;
text = "Current Inventory"; //--- ToDo: Localize;
x = 32.5 * GUI_GRID_W + GUI_GRID_X;
y = 2.5 * GUI_GRID_H + GUI_GRID_Y;
w = 7 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
};
};
class controls {
class capacityForeground: RscText
{
idc = 1009;
x = 21 * GUI_GRID_W + GUI_GRID_X;
y = 3.75 * GUI_GRID_H + GUI_GRID_Y;
w = 9 * GUI_GRID_W;
h = 0.5 * GUI_GRID_H;
colorBackground[] = {1,1,1,0.75};
};
class allItemsTree: RscTree
{
idc = 1501;
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 6 * GUI_GRID_H + GUI_GRID_Y;
w = 19 * GUI_GRID_W;
h = 16.5 * GUI_GRID_H;
};
class inventoryItemsTree: RscTree
{
idc = 1500;
x = 20.5 * GUI_GRID_W + GUI_GRID_X;
y = 4.5 * GUI_GRID_H + GUI_GRID_Y;
w = 19 * GUI_GRID_W;
h = 15 * GUI_GRID_H;
};
class searchInput: RscEdit
{
idc = 1400;
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 4 * GUI_GRID_H + GUI_GRID_Y;
w = 15.5 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
tooltip = "Search Term"; //--- ToDo: Localize;
};
class amountInput: RscEdit
{
idc = 1401;
text = "1"; //--- ToDo: Localize;
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 23 * GUI_GRID_H + GUI_GRID_Y;
w = 15.5 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
tooltip = "Amount of Items to Add"; //--- ToDo: Localize;
};
class clearSearchBtn: RscButton
{
idc = 1606;
text = "Clear"; //--- ToDo: Localize;
x = 16.5 * GUI_GRID_W + GUI_GRID_X;
y = 4 * GUI_GRID_H + GUI_GRID_Y;
w = 3 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
tooltip = "Clear Search"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_clearSearch";
};
class addBtn: RscButton
{
idc = 1607;
text = "Add"; //--- ToDo: Localize;
x = 16.5 * GUI_GRID_W + GUI_GRID_X;
y = 23 * GUI_GRID_H + GUI_GRID_Y;
w = 3 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
tooltip = "Add X Items To Container"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_addItem";
};
class deleteOneBtn: RscButton
{
idc = 1600;
text = "Delete 1"; //--- ToDo: Localize;
x = 20.5 * GUI_GRID_W + GUI_GRID_X;
y = 20 * GUI_GRID_H + GUI_GRID_Y;
w = 5.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Delete 1 Item"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_deleteOne";
};
class deleteAllBtn: RscButton
{
idc = 1601;
text = "Delete All"; //--- ToDo: Localize;
x = 27 * GUI_GRID_W + GUI_GRID_X;
y = 20 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Delete All Selected Items"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_deleteAll";
};
class clearBtn: RscButton
{
idc = 1602;
text = "Clear"; //--- ToDo: Localize;
x = 34 * GUI_GRID_W + GUI_GRID_X;
y = 20 * GUI_GRID_H + GUI_GRID_Y;
w = 5.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Clear All Inventory"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_clearInventory";
};
class exportBtn: RscButton
{
idc = 1604;
text = "Export"; //--- ToDo: Localize;
x = 20.5 * GUI_GRID_W + GUI_GRID_X;
y = 22.5 * GUI_GRID_H + GUI_GRID_Y;
w = 5.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Export To Clipboard"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_exportInventory";
};
class importBtn: RscButton
{
idc = 1605;
text = "Import"; //--- ToDo: Localize;
x = 27 * GUI_GRID_W + GUI_GRID_X;
y = 22.5 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Import From Clipboard"; //--- ToDo: Localize;
onButtonClick = "[] spawn EIM_fnc_importInventory";
};
class closeBtn: RscButton
{
idc = 1603;
text = "Close"; //--- ToDo: Localize;
x = 34 * GUI_GRID_W + GUI_GRID_X;
y = 22.5 * GUI_GRID_H + GUI_GRID_Y;
w = 5.5 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
tooltip = "Close"; //--- ToDo: Localize;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 1)";
};
};
}; | [
"maca134@googlemail.com"
] | maca134@googlemail.com |
bfb39f6ce76b15ea2d3812e8c2797270a033c2a8 | 947f7337f02133ff894005fa2d1d667a79040b0f | /C++/Complete-Modern-C++/Section02-Basic-Language-Facilities/namespace/src/namespace.cpp | f1559130f847a58680c12eafaaba2f38abf7c782 | [] | no_license | qelias/Udemy | 34464626f1bcce560f6274188cb479bf090db5dc | 2ddbcd001b371262c6b234e772856bbd1208d7df | refs/heads/main | 2023-03-25T01:42:11.970181 | 2021-03-23T12:15:16 | 2021-03-23T12:15:16 | 318,497,631 | 0 | 0 | null | 2021-03-20T15:36:45 | 2020-12-04T11:36:33 | Jupyter Notebook | UTF-8 | C++ | false | false | 388 | cpp | #include <iostream>
namespace Namespace1 {
float Calculate(float x, float y){
return (x + y)/2;
}
}
namespace Namespace2 {
float Calculate(float x, float y){
return (x + y);
}
}
int main(){
//using namespace Namespace1;
std::cout<<Namespace1::Calculate(1,5)<<std::endl;
std::cout<<Namespace2::Calculate(1,5)<<std::endl;
return 0;
} | [
"elias.quent@gmail.com"
] | elias.quent@gmail.com |
f16b0a8edf8e9ca8a5d87a7278714f99ac2991ec | 72335f4c1c11da288d488c95e77e57e80a84ed00 | /Parametre.h | e0e2b8ecddcaf80fea585e9dfbbcdd68922e0276 | [] | no_license | antoinepay/comp | 8f8e732558b125270ea05cb8c45609b995e48f7b | c0a02ca6db8d8f7efdd9de258d5598012971f898 | refs/heads/master | 2020-04-01T20:25:21.732562 | 2018-10-18T10:00:43 | 2018-10-18T10:00:43 | 153,602,889 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 381 | h |
#ifndef PARAMETRE_H_
#define PARAMETRE_H_
#include <stdio.h>
#include "Variable.h"
class Parametre {
public:
Parametre(int type2, Variable* v);
virtual ~Parametre();
void print();
int getType();
char* getNomVal();
string buildIR_param(CFG* cfg, int indice, int taille);
protected:
int type;
Variable* nom;
};
#endif /* PARAMETRE_H_ */
| [
"antoine.payan@hotmail.fr"
] | antoine.payan@hotmail.fr |
bda200fa2dd7b7601fa7e603cd7e6cccc32a1950 | 51d5cff1ac2c3baccaa65df86a6d82b83ada5740 | /sphereGenerator.cpp | 5fde665274ad834f5341e5e23ef528f0bb05ce48 | [] | no_license | cou929/polygonise | 4c72da66d71ef22cfa61bbea43673c4b6a4fa982 | 4bd895abe90f9c914e0b7e67830c57a949f575a4 | refs/heads/master | 2021-01-10T18:37:40.142040 | 2009-11-06T07:26:04 | 2009-11-06T07:26:04 | 299,520 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,018 | cpp | #include <iostream>
#include <vector>
#include <cmath>
std::vector <std::vector <int> > generateSphere(int radius);
std::vector <std::vector <int> > generateSphere(int radius)
{
std::vector <std::vector <int> > ret;
for (int x=-radius; x<=radius; x++)
for (int y=-radius; y<=radius; y++)
for (int z=-radius; z<=radius; z++)
{
int distance = (int)sqrt(x*x + y*y + z*z);
int range = 1;
if (distance - range <= (int)sqrt(radius*radius) && (int)sqrt(radius*radius) <= distance + range)
{
std::vector <int> tmp;
tmp.push_back(x); tmp.push_back(y); tmp.push_back(z);
ret.push_back(tmp);
}
}
return ret;
}
int main(int argc, char ** argv)
{
std::vector <std::vector <int> > sphere;
int radius = 5;
if (argc == 2)
radius = atoi(argv[1]);
sphere = generateSphere(radius);
for (int i=0; i<sphere.size(); i++)
{
for (int j=0; j<sphere[i].size(); j++)
std::cout << sphere[i][j] << "\t";
std::cout << std::endl;
}
return 0;
}
| [
"cou929@gmail.com"
] | cou929@gmail.com |
b998bb618b8fdc5202d1eade78f7576bd24c77ff | 4797c7058b7157e3d942e82cf8ad94b58be488ae | /PlayerShip.cpp | f70fc2002f2cfb0b6a7261c671bdf0ac7d214a00 | [] | no_license | koguz/DirectX-Space-Game | 2d1d8179439870fd1427beb9624f1c5452546c39 | be672051fd0009cbd5851c92bd344d3b23645474 | refs/heads/master | 2020-05-18T02:11:47.963185 | 2011-05-25T14:35:26 | 2011-05-25T14:35:26 | 1,799,267 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,804 | cpp | #include "PlayerShip.h"
PlayerShip::PlayerShip():BaseObject()
{
speed = 0.0f;
lastShot = 0;
}
bool PlayerShip::Init(IDirect3DDevice9 *d, IDirectSound8 *s)
{
((MyMesh*)(this))->Init(d, "ship01.x");
Sound = s;
Engine.Init(Sound, "PSEngine.wav");
Fire.Init(Sound, "PSFire.wav");
Fire.SetLoop(false);
Scratch.Init(Sound, "Scratch.wav");
Scratch.SetLoop(false);
HitSound.Init(Sound, "hitship.wav");
HitSound.SetLoop(false);
/*
Mission1.Init(Sound, "mission01.wav");
Mission1.SetLoop(false);
Mission1.Play();
*/
Engine.SetVolume(-800);
Engine.Play();
maxSpeed = 6.0f;
minSpeed = 0.6f;
casSpeed = 2.0f;
laserInterval = 500;
health = 2000;
return true;
}
void PlayerShip::Scratched()
{
Scratch.setPosition(position);
Scratch.Play();
health -= 5;
}
void PlayerShip::Hit(int d)
{
health -= d;
HitSound.Play();
}
void PlayerShip::Update(float deltaTime)
{
if (health < 2000 && GetTickCount() - lastGen > 100 )
{
health++;
lastGen = GetTickCount();
}
time = deltaTime;
TranslateV(speed * look * deltaTime);
Engine.setPosition(position);
Fire.setPosition(position);
HitSound.setPosition(position);
// Mission1.setPosition(position);
std::vector<Laser>::iterator temp;
std::vector<Laser>::iterator toDel;
bool d = false;
for(temp = lasers.begin(); temp != lasers.end(); temp++)
{
(*temp).Update(time);
// (*temp).Draw();
if (abs((*temp).getPosition().x) > 200 || abs((*temp).getPosition().y) > 200 || abs((*temp).getPosition().z) > 200 )
{
toDel = temp;
d = true;
}
if ((*temp).getHit())
{
toDel = temp;
d = true;
}
}
if (d)
lasers.erase(toDel);
}
void PlayerShip::SpeedUp()
{
SetSpeed(maxSpeed);
}
void PlayerShip::SpeedDown()
{
SetSpeed(minSpeed);
}
void PlayerShip::SpeedNormal()
{
SetSpeed(casSpeed);
}
void PlayerShip::SetSpeed(float s)
{
if (s == speed) return;
if (s >= casSpeed && s < maxSpeed && speed != s)
Engine.setFrequency(0);
else if (s >= maxSpeed && speed != s)
Engine.setFrequency(24000);
else if (s >= minSpeed && s < casSpeed && speed != s)
Engine.setFrequency(20000);
speed = s;
}
void PlayerShip::FireLaser()
{
if (health < 0) return;
if (GetTickCount() - lastShot > laserInterval)
{
Laser laser1(Device, Laser::RED);
Laser laser2(Device, Laser::RED);
laser1.SetRotation(rotationMatrix);
laser1.TranslateV(position + (right * 0.6f));
laser1.SetOrientation(up, right, look);
laser2.SetRotation(rotationMatrix);
laser2.TranslateV(position - (right * 0.6f));
laser2.SetOrientation(up, right, look);
lasers.push_back(laser1);
lasers.push_back(laser2);
Fire.Play();
lastShot = GetTickCount();
}
else return;
}
| [
"kayaoguz@gmail.com"
] | kayaoguz@gmail.com |
610504608efec634bd3ed68809a4ebeca4c6a66f | f821e40a2d0d8f3eed02f197a1e4007f4e1b9799 | /src/core/app/al_WindowApp.cpp | a5cf104456fc72b2025d33bdcef82a6f8fb7b794 | [] | no_license | worldmaking/allolib | e5235e4de66b862003e5b4343fd2e4f755d0fbb3 | 1585da0cc2ebb533865858142c9fec341aa39406 | refs/heads/master | 2021-05-14T12:22:07.464372 | 2018-01-05T17:00:14 | 2018-01-05T17:00:14 | 116,406,076 | 0 | 0 | null | 2018-01-05T16:42:19 | 2018-01-05T16:42:19 | null | UTF-8 | C++ | false | false | 1,773 | cpp | #include "al/core/app/al_WindowApp.hpp"
#include "al/core/graphics/al_GLFW.hpp"
#include "al/core/graphics/al_GPUObject.hpp"
using namespace al;
bool WindowApp::StandardWindowAppKeyControls::keyDown(const Keyboard& k){
if(k.ctrl()){
switch(k.key()){
case 'q': window().close(); return false;
// case 'h': window().hide(); return false;
// case 'm': window().iconify(); return false;
case 'c': window().cursorHideToggle(); return false;
default:;
}
}
else{
switch(k.key()){
case Keyboard::ESCAPE: window().fullScreenToggle(); return false;
default:;
}
}
return true;
}
WindowApp::WindowApp() {
append(stdControls);
append(windowEventHandler());
}
void WindowApp::open() {
glfw::init();
create();
onCreate();
}
void WindowApp::loop() {
onDraw();
refresh();
}
void WindowApp::closeApp() {
destroy(); // destroy window
glfw::terminate(); // this also closes existing windows
}
void WindowApp::start() {
open();
startFPS();
while (!shouldQuit()) {
loop();
tickFPS();
}
closeApp();
}
// call user event functions inside WindowEventHandler class
bool WindowApp::keyDown(const Keyboard& k) {
onKeyDown(k);
return true;
}
bool WindowApp::keyUp(const Keyboard& k) {
onKeyUp(k);
return true;
}
bool WindowApp::mouseDown(const Mouse& m) {
onMouseDown(m);
return true;
}
bool WindowApp::mouseDrag(const Mouse& m) {
onMouseDrag(m);
return true;
}
bool WindowApp::mouseMove(const Mouse& m) {
onMouseMove(m);
return true;
}
bool WindowApp::mouseUp(const Mouse& m) {
onMouseUp(m);
return true;
}
bool WindowApp::resize(int dw, int dh) {
onResize(dw, dh);
return true;
}
bool WindowApp::visibility(bool v) {
onVisibility(v);
return true;
} | [
"younkeehong@gmail.com"
] | younkeehong@gmail.com |
6320f8e6cc934f58e811f3b3a351e8bf8d9fd9a8 | 5702eb53222af6e3e41672853c98e87c76fda0e3 | /util/cpp/Pipe.h | 4fbbb64a8a0db393e86f73402cc162649e3af158 | [] | no_license | agilecomputing/nomads | fe46464f62440d29d6074370c1750f69c75ea309 | 0c381bfe728fb24d170721367336c383f209d839 | refs/heads/master | 2021-01-18T11:12:29.670874 | 2014-12-13T00:46:40 | 2014-12-13T00:46:40 | 50,006,520 | 1 | 0 | null | 2016-01-20T05:19:14 | 2016-01-20T05:19:13 | null | UTF-8 | C++ | false | false | 1,829 | h | /*
* Pipe.h
*
* This file is part of the IHMC Util Library
* Copyright (c) 1993-2014 IHMC.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 (GPLv3) as published by the Free Software Foundation.
*
* U.S. Government agencies and organizations may redistribute
* and/or modify this program under terms equivalent to
* "Government Purpose Rights" as defined by DFARS
* 252.227-7014(a)(12) (February 2014).
*
* Alternative licenses that allow for use within commercial products may be
* available. Contact Niranjan Suri at IHMC (nsuri@ihmc.us) for details.
*/
#ifndef INCL_PIPE_H
#define INCL_PIPE_H
#include <sys/stat.h>
#if defined (WIN32)
#include <fcntl.h>
#include <io.h>
#elif defined (UNIX)
#include <unistd.h>
#endif
namespace NOMADSUtil
{
class Pipe
{
public:
Pipe (void);
~Pipe (void);
int init (void);
// Get the file descriptor which can be used with read()
int getReadFileDescriptor (void);
// Get the file descriptor which can be used with write()
int getWriteFileDescriptor (void);
int sendBytes (void *pData, unsigned long ulSize);
int receive (void *pBuf, int iSize);
int receiveBytes (void *pBuf, unsigned long ulSize);
unsigned long bytesAvail (void);
protected:
Pipe (int fdRead, int fdWrite);
protected:
int _fdRead;
int _fdWrite;
struct stat statbuf;
};
inline int Pipe::getReadFileDescriptor (void)
{
return _fdRead;
}
inline int Pipe::getWriteFileDescriptor (void)
{
return _fdWrite;
}
}
#endif // #ifndef INCL_PIPE_H
| [
"giacomo.benincasa@gmail.com"
] | giacomo.benincasa@gmail.com |
216fb3e3aa1b8308e286b0383a791ba22ee85c15 | b21a7616ec39e53c4c5d596c32fc2e6c6f3d5273 | /DiscrethMath/1 course/Combinatorics/num2choose.cpp | 8c865145f3bf97c4d291031fe1fad6edac8596b8 | [] | no_license | vladrus13/ITMO | d34fbd5feee0626c0fe5722b79dd928ee2a3f36a | c4ff564ea5f73e02354c0ae9248fee75df928b4e | refs/heads/master | 2022-02-23T03:13:36.794460 | 2022-02-10T22:24:16 | 2022-02-10T22:24:16 | 177,217,313 | 17 | 9 | null | 2020-08-07T15:06:37 | 2019-03-22T22:33:18 | Java | UTF-8 | C++ | false | false | 905 | cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
#include <iomanip>
#include <cassert>
#include <fstream>
#include <bitset>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
ll c(int n, int k) {
if (k == 0) return 1;
if (n == k) return 1;
return c(n - 1, k) + c(n - 1, k - 1);
}
void rec(ll n, ll k, ll m) {
int num = 1;
while (k > 0) {
if (m < c(n - 1, k - 1)) {
cout << num << ' ';
k--;
} else {
m -= c(n - 1, k - 1);
}
n--;
num++;
}
}
int main() {
#ifdef _DEBUG
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
freopen("num2choose.in", "r", stdin);
freopen("num2choose.out", "w", stdout);
#endif
ll n, k, m;
cin >> n >> k >> m;
rec(n, k, m);
return 0;
} | [
"vladrus13rus@yandex.ru"
] | vladrus13rus@yandex.ru |
d7f5abeaf1bc07391381afc90d2ab0451eccf88e | dcdf8a7edb8a765707459a540997750402f65bea | /src/qt/BitalGostrings.cpp | b94a58be9f8b6c0e9c5fa3aeb4b23a142e042e1e | [
"MIT"
] | permissive | ifinmakassar/BitalGO | a313fa0e2015cc02fa3dc8d63d8d3a692dd8b019 | f8f5e126a7c808f72ff85b32e28c09a45fe684ca | refs/heads/master | 2022-04-06T12:33:49.209408 | 2020-03-16T06:15:12 | 2020-03-16T06:15:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 35,995 | cpp |
#include <QtGlobal>
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif
static const char UNUSED *BitalGo_strings[] = {
QT_TRANSLATE_NOOP("BitalGo-core", " mints deleted\n"),
QT_TRANSLATE_NOOP("BitalGo-core", " mints updated, "),
QT_TRANSLATE_NOOP("BitalGo-core", " unconfirmed transactions removed\n"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"(1 = keep tx meta data e.g. account owner and payment request information, 2 "
"= drop tx meta data)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Allow JSON-RPC connections from specified source. Valid for <ip> are a "
"single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or "
"a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Bind to given address and whitelist peers connecting to it. Use [host]:port "
"notation for IPv6"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Bind to given address to listen for JSON-RPC connections. Use [host]:port "
"notation for IPv6. This option can be specified multiple times (default: "
"bind to all interfaces)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Calculated accumulator checkpoint is not what is recorded by block index"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Cannot obtain a lock on data directory %s. BitalGo Core is probably already "
"running."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Change automatic finalized budget voting behavior. mode=auto: Vote for only "
"exact finalized budget match to my generated budget. (string, default: auto)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Continuously rate-limit free transactions to <n>*1000 bytes per minute "
"(default:%u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Create new files with system default permissions, instead of umask 077 (only "
"effective with disabled wallet functionality)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Delete all wallet transactions and only recover those parts of the "
"blockchain through -rescan on startup"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Delete all zerocoin spends and mints that have been recorded to the "
"blockchain database and reindex them (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Disable all ALG specific functionality (Masternodes, Zerocoin, SwiftX, "
"Budgeting) (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Distributed under the MIT software license, see the accompanying file "
"COPYING or <http://www.opensource.org/licenses/mit-license.php>."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable SwiftX, show confirmations for locked transactions (bool, default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable automatic Zerocoin minting from specific addresses (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable automatic wallet backups triggered after each zALG minting (0-1, "
"default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable or disable staking functionality for ALG inputs (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable or disable staking functionality for zALG inputs (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enable spork administration functionality with the appropriate private key."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Enter regression test mode, which uses a special chain in which blocks can "
"be solved instantly."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: Listening for incoming connections failed (listen returned error %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: The transaction is larger than the maximum allowed transaction size!"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat "
"and coins were spent in the copy but not marked as spent here."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: This transaction requires a transaction fee of at least %s because of "
"its amount, complexity, or use of recently received funds!"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: Unsupported argument -checklevel found. Checklevel must be level 4."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Error: Unsupported argument -socks found. Setting SOCKS version isn't "
"possible anymore, only SOCKS5 proxies are supported."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Execute command when a relevant alert is received or we see a really long "
"fork (%s in cmd is replaced by message)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
"TxID)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Execute command when the best block changes (%s in cmd is replaced by block "
"hash)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Execute command when the best block changes and its size is over (%s in cmd "
"is replaced by block hash, %d with the block size)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Failed to find coin set amongst held coins with less than maxNumber of Spends"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Fees (in ALG/Kb) smaller than this are considered zero fee for relaying "
"(default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Fees (in ALG/Kb) smaller than this are considered zero fee for transaction "
"creation (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Flush database activity from memory pool to disk log every <n> megabytes "
"(default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Found unconfirmed denominated outputs, will wait till they confirm to "
"continue."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"If paytxfee is not set, include enough fee so transactions begin "
"confirmation on average within n blocks (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"In rare cases, a spend with 7 coins exceeds our maximum allowable "
"transaction size, please retry spend using 6 or less coins"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"In this mode -genproclimit controls how many blocks are generated "
"immediately."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Insufficient or insufficient confirmed funds, you might need to wait a few "
"minutes and try again."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay "
"fee of %s to prevent stuck transactions)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Keep the specified amount available for spending at all times (default: 0)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Log transaction priority and fee per kB when mining blocks (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Maintain a full transaction index, used by the getrawtransaction rpc call "
"(default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Maximum average size of an index occurrence in the block spam filter "
"(default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Maximum size of data in data carrier transactions we relay and mine "
"(default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Maximum size of the list of indexes in the block spam filter (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Maximum total fees to use in a single wallet transaction, setting too low "
"may abort large transactions (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Number of seconds to keep misbehaving peers from reconnecting (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Obfuscation uses exact denominated amounts to send funds, you might simply "
"need to anonymize some more coins."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Output debugging information (default: %u, supplying <category> is optional)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Preferred Denomination for automatically minted Zerocoin "
"(1/5/10/50/100/500/1000/5000), 0 for no preference. default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Query for peer addresses via DNS lookup, if low on addresses (default: 1 "
"unless -connect)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Randomize credentials for every proxy connection. This enables Tor stream "
"isolation (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Require high priority for relaying free or low-fee transactions (default:%u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Send trace/debug info to console instead of debug.log file (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Set the number of included blocks to precompute per cycle. (minimum: %d) "
"(maximum: %d) (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Set the number of script verification threads (%u to %d, 0 = auto, <0 = "
"leave that many cores free, default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Set the number of threads for coin generation if enabled (-1 = all cores, "
"default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Show N confirmations for a successfully locked transaction (0-9999, default: "
"%u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Specify custom backup path to add a copy of any automatic zALG backup. If "
"set as dir, every backup generates a timestamped file. If set as file, will "
"rewrite to that file every backup. If backuppath is set as well, 4 backups "
"will happen"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Specify custom backup path to add a copy of any wallet backup. If set as "
"dir, every backup generates a timestamped file. If set as file, will rewrite "
"to that file every backup."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Support filtering of blocks and transaction with bloom filters (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"SwiftX requires inputs with at least 6 confirmations, you might need to wait "
"a few minutes and try again."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"The block database contains a block which appears to be from the future. "
"This may be due to your computer's date and time being set incorrectly. Only "
"rebuild the block database if you are sure that your computer's date and "
"time are correct"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"This is a pre-release test build - use at your own risk - do not use for "
"staking or merchant applications!"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"This product includes software developed by the OpenSSL Project for use in "
"the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software "
"written by Eric Young and UPnP software written by Thomas Bernard."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Total length of network version string (%i) exceeds maximum length (%i). "
"Reduce the number or size of uacomments."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Unable to bind to %s on this computer. BitalGo Core is probably already running."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Unable to locate enough Obfuscation denominated funds for this transaction."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Unable to locate enough Obfuscation non-denominated funds for this "
"transaction that are not equal 10000 ALG."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Unable to locate enough funds for this transaction that are not equal 10000 "
"ALG."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: "
"%s)"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: -maxtxfee is set very high! Fees this large could be paid on a "
"single transaction."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong BitalGo Core will not work properly."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: The network does not appear to fully agree! Some miners appear to "
"be experiencing issues."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: We do not appear to fully agree with our peers! You may need to "
"upgrade, or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
"you should restore from a backup."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Whitelist peers connecting from the given netmask or IP address. Can be "
"specified multiple times."),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"Whitelisted peers cannot be DoS banned and their transactions are always "
"relayed, even if they are already in the mempool, useful e.g. for a gateway"),
QT_TRANSLATE_NOOP("BitalGo-core", ""
"You must specify a masternodeprivkey in the configuration. Please see "
"documentation for help."),
QT_TRANSLATE_NOOP("BitalGo-core", "(9436 could be used only on mainnet)"),
QT_TRANSLATE_NOOP("BitalGo-core", "(default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "(default: 1)"),
QT_TRANSLATE_NOOP("BitalGo-core", "(must be 9436 for mainnet)"),
QT_TRANSLATE_NOOP("BitalGo-core", "<category> can be:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Accept command line and JSON-RPC commands"),
QT_TRANSLATE_NOOP("BitalGo-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Accept public REST requests (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Add a node to connect to and attempt to keep the connection open"),
QT_TRANSLATE_NOOP("BitalGo-core", "Adding Wrapped Serials supply..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("BitalGo-core", "Already have that input."),
QT_TRANSLATE_NOOP("BitalGo-core", "Always query for peer addresses via DNS lookup (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Append comment to the user agent string"),
QT_TRANSLATE_NOOP("BitalGo-core", "Attempt to force blockchain corruption recovery"),
QT_TRANSLATE_NOOP("BitalGo-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("BitalGo-core", "Automatically create Tor hidden service (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Block creation options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Calculating missing accumulators..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Can't denominate: no compatible inputs left."),
QT_TRANSLATE_NOOP("BitalGo-core", "Can't find random Masternode."),
QT_TRANSLATE_NOOP("BitalGo-core", "Can't mix while sync in progress."),
QT_TRANSLATE_NOOP("BitalGo-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("BitalGo-core", "Cannot resolve -bind address: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Cannot resolve -whitebind address: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("BitalGo-core", "CoinSpend: Accumulator witness does not verify"),
QT_TRANSLATE_NOOP("BitalGo-core", "CoinSpend: failed check"),
QT_TRANSLATE_NOOP("BitalGo-core", "Collateral not valid."),
QT_TRANSLATE_NOOP("BitalGo-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Connect through SOCKS5 proxy"),
QT_TRANSLATE_NOOP("BitalGo-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("BitalGo-core", "Connection options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Copyright (C) 2009-%i The Bitcoin Core Developers"),
QT_TRANSLATE_NOOP("BitalGo-core", "Copyright (C) 2014-%i The Dash Core Developers"),
QT_TRANSLATE_NOOP("BitalGo-core", "Copyright (C) 2015-%i The BitalGo Core Developers"),
QT_TRANSLATE_NOOP("BitalGo-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("BitalGo-core", "Could not parse masternode.conf"),
QT_TRANSLATE_NOOP("BitalGo-core", "Couldn't generate the accumulator witness"),
QT_TRANSLATE_NOOP("BitalGo-core", "Debugging/Testing options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Delete blockchain folders and resync from scratch"),
QT_TRANSLATE_NOOP("BitalGo-core", "Disable OS notifications for incoming transactions (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Disable safemode, override a real safe mode event (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Display the stake modifier calculations in the debug.log file."),
QT_TRANSLATE_NOOP("BitalGo-core", "Display verbose coin stake messages in the debug.log file."),
QT_TRANSLATE_NOOP("BitalGo-core", "Do not load the wallet and disable wallet RPC calls"),
QT_TRANSLATE_NOOP("BitalGo-core", "Do you want to rebuild the block database now?"),
QT_TRANSLATE_NOOP("BitalGo-core", "Done loading"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable automatic Zerocoin minting (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable precomputation of zALG spends and stakes (0-1, default %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish hash block in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish hash transaction (locked via SwiftX) in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish hash transaction in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish raw block in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish raw transaction (locked via SwiftX) in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable publish raw transaction in <address>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable staking functionality (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Enable the client to act as a masternode (0-1, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Entries are full."),
QT_TRANSLATE_NOOP("BitalGo-core", "Error connecting to Masternode."),
QT_TRANSLATE_NOOP("BitalGo-core", "Error initializing block database"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error initializing wallet database environment %s!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error loading block database"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error loading wallet.dat: Wallet requires newer version of BitalGo Core"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error opening block database"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error reading from database, shutting down."),
QT_TRANSLATE_NOOP("BitalGo-core", "Error recovering public key."),
QT_TRANSLATE_NOOP("BitalGo-core", "Error writing zerocoinDB to disk"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: A fatal internal error occured, see debug.log for details"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: A fatal internal error occurred, see debug.log for details"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: Can't select current denominated inputs"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: Disk space is low!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: No valid utxo!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: Unsupported argument -tor found, use -onion."),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: Wallet locked, unable to create transaction!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Error: You already have pending entries in the Obfuscation pool"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to calculate accumulator checkpoint"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to create mint"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to find Zerocoins in wallet.dat"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to listen on any port. Use -listen=0 if you want this."),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to parse host:port string"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to read block"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to select a zerocoin"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to wipe zerocoinDB"),
QT_TRANSLATE_NOOP("BitalGo-core", "Failed to write coin serial number into wallet"),
QT_TRANSLATE_NOOP("BitalGo-core", "Fee (in ALG/kB) to add to transactions you send (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Finalizing transaction."),
QT_TRANSLATE_NOOP("BitalGo-core", "Force safe mode (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Found enough users, signing ( waiting %s )"),
QT_TRANSLATE_NOOP("BitalGo-core", "Found enough users, signing ..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Generate coins (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "How many blocks to check at startup (default: %u, 0 = all)"),
QT_TRANSLATE_NOOP("BitalGo-core", "If <category> is not supplied, output all debugging information."),
QT_TRANSLATE_NOOP("BitalGo-core", "Importing..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Imports blocks from external blk000??.dat file"),
QT_TRANSLATE_NOOP("BitalGo-core", "Include IP addresses in debug output (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Incompatible mode."),
QT_TRANSLATE_NOOP("BitalGo-core", "Incompatible version."),
QT_TRANSLATE_NOOP("BitalGo-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
QT_TRANSLATE_NOOP("BitalGo-core", "Information"),
QT_TRANSLATE_NOOP("BitalGo-core", "Initialization sanity check failed. BitalGo Core is shutting down."),
QT_TRANSLATE_NOOP("BitalGo-core", "Input is not valid."),
QT_TRANSLATE_NOOP("BitalGo-core", "Insufficient funds"),
QT_TRANSLATE_NOOP("BitalGo-core", "Insufficient funds."),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid -onion address or hostname: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -maxtxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount for -reservebalance=<amount>"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid amount"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid masternodeprivkey. Please see documenation."),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid netmask specified in -whitelist: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid port detected in masternode.conf"),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid private key."),
QT_TRANSLATE_NOOP("BitalGo-core", "Invalid script detected."),
QT_TRANSLATE_NOOP("BitalGo-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Last Obfuscation was too recent."),
QT_TRANSLATE_NOOP("BitalGo-core", "Last successful Obfuscation action was too recent."),
QT_TRANSLATE_NOOP("BitalGo-core", "Limit size of signature cache to <n> entries (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Line: %d"),
QT_TRANSLATE_NOOP("BitalGo-core", "Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Listen for connections on <port> (default: %u or testnet: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading addresses..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading block index..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading budget cache..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading masternode cache..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading masternode payment cache..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading sporks..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading wallet... (%3.2f %%)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Loading wallet..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Location of the auth cookie (default: data dir)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Lock is already in place."),
QT_TRANSLATE_NOOP("BitalGo-core", "Lock masternodes from masternode configuration file (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Lookup(): Invalid -proxy address or hostname: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Maintain at most <n> connections to peers (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Masternode options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Masternode queue is full."),
QT_TRANSLATE_NOOP("BitalGo-core", "Masternode:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Mint did not make it into blockchain"),
QT_TRANSLATE_NOOP("BitalGo-core", "Missing input transaction information."),
QT_TRANSLATE_NOOP("BitalGo-core", "Mixing in progress..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Need address because change is not exact"),
QT_TRANSLATE_NOOP("BitalGo-core", "Need to specify a port with -whitebind: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "No Masternodes detected."),
QT_TRANSLATE_NOOP("BitalGo-core", "No compatible Masternode found."),
QT_TRANSLATE_NOOP("BitalGo-core", "No funds detected in need of denominating."),
QT_TRANSLATE_NOOP("BitalGo-core", "No matching denominations found for mixing."),
QT_TRANSLATE_NOOP("BitalGo-core", "Node relay options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Non-standard public key detected."),
QT_TRANSLATE_NOOP("BitalGo-core", "Not compatible with existing transactions."),
QT_TRANSLATE_NOOP("BitalGo-core", "Not enough file descriptors available."),
QT_TRANSLATE_NOOP("BitalGo-core", "Not in the Masternode list."),
QT_TRANSLATE_NOOP("BitalGo-core", "Number of automatic wallet backups (default: 10)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Number of custom location backups to retain (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Obfuscation is idle."),
QT_TRANSLATE_NOOP("BitalGo-core", "Obfuscation request complete:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Obfuscation request incomplete:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Only accept block chain matching built-in checkpoints (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Only connect to nodes in network <net> (ipv4, ipv6 or onion)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Password for JSON-RPC connections"),
QT_TRANSLATE_NOOP("BitalGo-core", "Percentage of automatically minted Zerocoin (1-100, default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Preparing for resync..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Prepend debug output with timestamp (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Print version and exit"),
QT_TRANSLATE_NOOP("BitalGo-core", "RPC server options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Randomly drop 1 of every <n> network messages"),
QT_TRANSLATE_NOOP("BitalGo-core", "Randomly fuzz 1 of every <n> network messages"),
QT_TRANSLATE_NOOP("BitalGo-core", "Rebuild block chain index from current blk000??.dat files"),
QT_TRANSLATE_NOOP("BitalGo-core", "Recalculating ALG supply..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Recalculating minted ZALG..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Recalculating spent ZALG..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Receive and display P2P network alerts (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Reindex the ALG and zALG money supply statistics"),
QT_TRANSLATE_NOOP("BitalGo-core", "Reindex the accumulator database"),
QT_TRANSLATE_NOOP("BitalGo-core", "Reindexing zerocoin database..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Reindexing zerocoin failed"),
QT_TRANSLATE_NOOP("BitalGo-core", "Relay and mine data carrier transactions (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Relay non-P2SH multisig (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("BitalGo-core", "Rescanning..."),
QT_TRANSLATE_NOOP("BitalGo-core", "ResetMintZerocoin finished: "),
QT_TRANSLATE_NOOP("BitalGo-core", "ResetSpentZerocoin finished: "),
QT_TRANSLATE_NOOP("BitalGo-core", "Run a thread to flush wallet periodically (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("BitalGo-core", "Selected coins value is less than payment target"),
QT_TRANSLATE_NOOP("BitalGo-core", "Send transactions as zero-fee transactions if possible (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Session not complete!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Session timed out."),
QT_TRANSLATE_NOOP("BitalGo-core", "Set database cache size in megabytes (%d to %d, default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set external address:port to get to this masternode (example: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set key pool size to <n> (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set maximum block size in bytes (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set minimum block size in bytes (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set the Maximum reorg depth (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set the masternode private key"),
QT_TRANSLATE_NOOP("BitalGo-core", "Set the number of threads to service RPC calls (default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Show all debugging options (usage: --help -help-debug)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Signing failed."),
QT_TRANSLATE_NOOP("BitalGo-core", "Signing timed out."),
QT_TRANSLATE_NOOP("BitalGo-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify configuration file (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify connection timeout in milliseconds (minimum: 1, default: %d)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify data directory"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify masternode configuration file (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify pid file (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify wallet file (within data directory)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("BitalGo-core", "Spend Valid"),
QT_TRANSLATE_NOOP("BitalGo-core", "Spend unconfirmed change when sending transactions (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Staking options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Stop running after importing blocks from disk (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Submitted following entries to masternode: %u / %d"),
QT_TRANSLATE_NOOP("BitalGo-core", "Submitted to masternode, waiting for more entries ( %u / %d ) %s"),
QT_TRANSLATE_NOOP("BitalGo-core", "Submitted to masternode, waiting in queue %s"),
QT_TRANSLATE_NOOP("BitalGo-core", "Support the zerocoin light node protocol (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "SwiftX options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronization failed"),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronization finished"),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronization pending..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronizing budgets..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronizing masternode winners..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronizing masternodes..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Synchronizing sporks..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Syncing zALG wallet..."),
QT_TRANSLATE_NOOP("BitalGo-core", "The coin spend has been used"),
QT_TRANSLATE_NOOP("BitalGo-core", "The transaction did not verify"),
QT_TRANSLATE_NOOP("BitalGo-core", "This help message"),
QT_TRANSLATE_NOOP("BitalGo-core", "This is experimental software."),
QT_TRANSLATE_NOOP("BitalGo-core", "This is intended for regression testing tools and app development."),
QT_TRANSLATE_NOOP("BitalGo-core", "This is not a Masternode."),
QT_TRANSLATE_NOOP("BitalGo-core", "Threshold for disconnecting misbehaving peers (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Too many spends needed"),
QT_TRANSLATE_NOOP("BitalGo-core", "Tor control port password (default: empty)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Tor control port to use if onion listening enabled (default: %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction Created"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction Mint Started"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction amount too small"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction amounts must be positive"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction created successfully."),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction fees are too high."),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction not valid."),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction too large for fee policy"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transaction too large"),
QT_TRANSLATE_NOOP("BitalGo-core", "Transmitting final transaction."),
QT_TRANSLATE_NOOP("BitalGo-core", "Trying to spend an already spent serial #, try again."),
QT_TRANSLATE_NOOP("BitalGo-core", "Unable to bind to %s on this computer (bind returned error %s)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Unable to find transaction containing mint"),
QT_TRANSLATE_NOOP("BitalGo-core", "Unable to sign spork message, wrong key?"),
QT_TRANSLATE_NOOP("BitalGo-core", "Unable to start HTTP server. See debug log for details."),
QT_TRANSLATE_NOOP("BitalGo-core", "Unknown network specified in -onlynet: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "Unknown state: id = %u"),
QT_TRANSLATE_NOOP("BitalGo-core", "Upgrade wallet to latest format"),
QT_TRANSLATE_NOOP("BitalGo-core", "Use UPnP to map the listening port (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Use UPnP to map the listening port (default: 1 when listening)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Use a custom max chain reorganization depth (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Use block spam filter (default: %u)"),
QT_TRANSLATE_NOOP("BitalGo-core", "Use the test network"),
QT_TRANSLATE_NOOP("BitalGo-core", "User Agent comment (%s) contains unsafe characters."),
QT_TRANSLATE_NOOP("BitalGo-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("BitalGo-core", "Value is below the smallest available denomination (= 1) of zALG"),
QT_TRANSLATE_NOOP("BitalGo-core", "Value more than Obfuscation pool maximum allows."),
QT_TRANSLATE_NOOP("BitalGo-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("BitalGo-core", "Wallet %s resides outside data directory %s"),
QT_TRANSLATE_NOOP("BitalGo-core", "Wallet is locked."),
QT_TRANSLATE_NOOP("BitalGo-core", "Wallet needed to be rewritten: restart BitalGo Core to complete"),
QT_TRANSLATE_NOOP("BitalGo-core", "Wallet options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Wallet window title"),
QT_TRANSLATE_NOOP("BitalGo-core", "Warning"),
QT_TRANSLATE_NOOP("BitalGo-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Warning: Unsupported argument -benchmark ignored, use -debug=bench."),
QT_TRANSLATE_NOOP("BitalGo-core", "Warning: Unsupported argument -debugnet ignored, use -debug=net."),
QT_TRANSLATE_NOOP("BitalGo-core", "Will retry..."),
QT_TRANSLATE_NOOP("BitalGo-core", "You don't have enough Zerocoins in your wallet"),
QT_TRANSLATE_NOOP("BitalGo-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("BitalGo-core", "Your entries added successfully."),
QT_TRANSLATE_NOOP("BitalGo-core", "Your transaction was accepted into the pool!"),
QT_TRANSLATE_NOOP("BitalGo-core", "Zapping all transactions from wallet..."),
QT_TRANSLATE_NOOP("BitalGo-core", "ZeroMQ notification options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "Zerocoin options:"),
QT_TRANSLATE_NOOP("BitalGo-core", "could not get lock on cs_spendcache"),
QT_TRANSLATE_NOOP("BitalGo-core", "isValid(): Invalid -proxy address or hostname: '%s'"),
QT_TRANSLATE_NOOP("BitalGo-core", "on startup"),
QT_TRANSLATE_NOOP("BitalGo-core", "wallet.dat corrupt, salvage failed"),
};
| [
"kyzer@traebit.ca"
] | kyzer@traebit.ca |
a4d05b9f0d82c3a2d026e184e66b7d0c423b027a | 69740a5b14d963b51ac0b8d956c205d3b7879353 | /contrib/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp | 97a286cdb211f05d078425087463c3be6e8075c0 | [] | no_license | SEDS/OASIS | eba334ae59e69fc66d1e355fedb5ad5583b40695 | ddf365eea9874fa5938072fea1fad5b41c27f3e9 | refs/heads/master | 2020-12-24T15:51:12.761878 | 2013-12-03T20:30:21 | 2013-12-03T20:30:21 | 13,195,236 | 4 | 3 | null | 2015-10-24T09:40:39 | 2013-09-29T15:58:55 | C++ | UTF-8 | C++ | false | false | 3,550 | hpp | // file : CCF/IDL2/SemanticGraph/ValueType.hpp
// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id : $Id: ValueType.hpp 74499 2006-09-22 10:02:37Z boris $
#ifndef CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
#define CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
#include "CCF/IDL2/SemanticGraph/Elements.hpp"
#include "CCF/IDL2/SemanticGraph/Operation.hpp"
#include "CCF/IDL2/SemanticGraph/Interface.hpp" // Supports
namespace CCF
{
namespace IDL2
{
namespace SemanticGraph
{
//
//
//
class ValueType : public virtual Type,
public virtual Scope
{
typedef
std::vector <Inherits*>
Inherits_;
typedef
std::vector <Supports*>
Supports_;
public:
typedef
Inherits_::const_iterator
InheritsIterator;
InheritsIterator
inherits_begin () const
{
return inherits_.begin ();
}
InheritsIterator
inherits_end () const
{
return inherits_.end ();
}
typedef
Supports_::const_iterator
SupportsIterator;
SupportsIterator
supports_begin () const
{
return supports_.begin ();
}
SupportsIterator
supports_end () const
{
return supports_.end ();
}
public:
virtual bool
complete () const
{
return true;
}
static Introspection::TypeInfo const&
static_type_info ();
protected:
friend class Graph<Node, Edge>;
ValueType () // For virtual inheritance only.
{
type_info (static_type_info ());
}
virtual
~ValueType () = 0;
using Type::add_edge_right;
using Scope::add_edge_left;
void
add_edge_left (Inherits& e)
{
inherits_.push_back (&e);
}
void
add_edge_right (Inherits&)
{
}
void
add_edge_left (Supports& e)
{
supports_.push_back (&e);
}
private:
Inherits_ inherits_;
Supports_ supports_;
};
//
//
//
class AbstractValueType : public virtual ValueType
{
public:
static Introspection::TypeInfo const&
static_type_info ();
protected:
friend class Graph<Node, Edge>;
AbstractValueType (Path const& path, unsigned long line)
: Node (path, line)
{
type_info (static_type_info ());
}
};
//
//
//
class ConcreteValueType : public virtual ValueType
{
public:
static Introspection::TypeInfo const&
static_type_info ();
protected:
friend class Graph<Node, Edge>;
ConcreteValueType (Path const& path, unsigned long line)
: Node (path, line)
{
type_info (static_type_info ());
}
};
//
//
//
class ValueTypeFactory : public virtual TwoWayOperation
{
public:
static Introspection::TypeInfo const&
static_type_info ();
protected:
friend class Graph<Node, Edge>;
ValueTypeFactory (Path const& path, unsigned long line)
: Node (path, line), TwoWayOperation (path, line)
{
type_info (static_type_info ());
}
};
}
}
}
#endif // CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
| [
"hillj@cs.iupui.edu"
] | hillj@cs.iupui.edu |
52b23d257a70956478e0a4087ad3561cb7fe9b7d | 9807004938c74382be6a1797b1948a95cdba9955 | /beam/beam/Source.cpp | 1a7ee232a809b2a02081ba5d00135ae33ca5b304 | [] | no_license | KillPeopleFast/AprilCode | e2bff81db906442469d4e90370b82ea222a722f0 | 37e330f95fed4db3b64da9f866a5fd13850af40d | refs/heads/master | 2021-01-19T04:02:32.079090 | 2017-05-02T18:55:17 | 2017-05-02T18:55:17 | 87,348,008 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,201 | cpp | #include <iostream>
#include <allegro5/allegro.h>
#include <math.h>
using namespace std;
const float FPS = 60;
const int SCREEN_W = 640;
const int SCREEN_H = 480;
const int ship_SIZE = 32;
enum MYKEYS {
KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_SPACE
};
int main()
{
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_BITMAP *ship = NULL;
ALLEGRO_BITMAP *beam = NULL;
ALLEGRO_BITMAP *beam2 = NULL;
float ship_x = SCREEN_W / 2.0 - ship_SIZE / 2.0;
float ship_y = SCREEN_H / 2.0 - ship_SIZE / 2.0;
bool key[5] = { false, false, false, false, false };
bool redraw = true;
bool doexit = false;
double beam_x = 0;
double beam_y = 0;
double beam2_x = 0;
double beam2_y = 0;
int t = 0; //parameter for parametric equations
bool shootBeam = false;
al_init();
al_install_keyboard();
timer = al_create_timer(1.0 / FPS);
display = al_create_display(SCREEN_W, SCREEN_H);
//create ship
ship = al_create_bitmap(ship_SIZE, ship_SIZE);
al_set_target_bitmap(ship);
al_clear_to_color(al_map_rgb(255, 0, 255));
//create first beam object
beam = al_create_bitmap(3, 3);
al_set_target_bitmap(beam);
al_clear_to_color(al_map_rgb(0, 200, 55));
////////////////////beam2
beam2 = al_create_bitmap(3, 3);
al_set_target_bitmap(beam2);
al_clear_to_color(al_map_rgb(0, 200, 55));
//set up game screen, queue, and timer to be ready to play
al_set_target_bitmap(al_get_backbuffer(display));
event_queue = al_create_event_queue();
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_timer_event_source(timer));
al_register_event_source(event_queue, al_get_keyboard_event_source());
al_clear_to_color(al_map_rgb(0, 0, 0));
al_flip_display();
al_start_timer(timer);
while (!doexit)//game loop!
{
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if (ev.type == ALLEGRO_EVENT_TIMER) {
//reset beam when spacebar is first pressed!
if (key[KEY_SPACE] && shootBeam == false) {
t = 0; //reset time parameter
shootBeam = true; //tell render section to draw it, and movement algorithm to freeze ship when shooting
}
//move beam while space is being pressed
if (shootBeam) {
beam_x = ship_x + t;
////equation for beam////////////////////////////////////////////////////////////
//LOOK! LOOK! Here's where you can change the path of the beam!
beam_y = ship_y + 10 * sin(3 *(beam_x += 40)) + 10;
beam2_y = ship_y + 10 * sin(400 * (beam2_x += 40)) + 10;
////////////////////////////////////////////////////////////////
t++; //increase time
cout << "beam being fired" << endl;
}
//normal keyboard input movement, but only allow ship to move when not firing beam
if (key[KEY_UP] && ship_y >= 4.0 && shootBeam == false) {
ship_y -= 4.0;
}
if (key[KEY_DOWN] && ship_y <= SCREEN_H - ship_SIZE - 4.0 && shootBeam == false) {
ship_y += 4.0;
}
if (key[KEY_LEFT] && ship_x >= 4.0 && shootBeam == false) {
ship_x -= 4.0;
}
if (key[KEY_RIGHT] && ship_x <= SCREEN_W - ship_SIZE - 4.0 && shootBeam == false) {
ship_x += 4.0;
}
//when spacebar is let go, stop drawing beam and reset position
if (key[KEY_SPACE] == false) {
shootBeam = false;
beam_x = ship_x;
beam_y = ship_y;
beam2_x = ship_x;
beam2_y = ship_y;
}
redraw = true;
}
//kill game if window "x" is clicked with mouse
else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
}
//basic allegro keyboard input
else if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {
switch (ev.keyboard.keycode) {
case ALLEGRO_KEY_UP:
key[KEY_UP] = true;
break;
case ALLEGRO_KEY_DOWN:
key[KEY_DOWN] = true;
break;
case ALLEGRO_KEY_LEFT:
key[KEY_LEFT] = true;
break;
case ALLEGRO_KEY_RIGHT:
key[KEY_RIGHT] = true;
break;
case ALLEGRO_KEY_SPACE:
key[KEY_SPACE] = true;
break;
}
}
else if (ev.type == ALLEGRO_EVENT_KEY_UP) {
switch (ev.keyboard.keycode) {
case ALLEGRO_KEY_UP:
key[KEY_UP] = false;
break;
case ALLEGRO_KEY_DOWN:
key[KEY_DOWN] = false;
break;
case ALLEGRO_KEY_LEFT:
key[KEY_LEFT] = false;
break;
case ALLEGRO_KEY_RIGHT:
key[KEY_RIGHT] = false;
break;
case ALLEGRO_KEY_SPACE:
key[KEY_SPACE] = false;
break;
case ALLEGRO_KEY_ESCAPE:
doexit = true;
break;
}
}
//RENDER SECTION
if (redraw && al_is_event_queue_empty(event_queue)) {
redraw = false;
//only redraw when beam is NOT being fired...
if (shootBeam == false)
al_clear_to_color(al_map_rgb(0, 0, 0));
//when not being fired, beam is behind ship
al_draw_bitmap(beam, beam_x, beam_y, 0);
al_draw_bitmap(beam2, beam2_x, beam2_y, 0);
//draw ship
al_draw_bitmap(ship, ship_x, ship_y, 0);
al_flip_display();
}//end render section
}//END GAME LOOP
al_destroy_bitmap(ship);
al_destroy_timer(timer);
al_destroy_display(display);
al_destroy_event_queue(event_queue);
return 0;
}//end main | [
"game110pm@605-110-STU05"
] | game110pm@605-110-STU05 |
54c8814db2d143243de8cbc4a1ac31c6de4ae2a5 | 66433c1b726dddfec94706d3dfa6a029c904b94b | /0.3/a1/tasks.cpp | a0d8c300c15f5139513d3dd5ded9f2485047a8b1 | [] | no_license | LeandroPerrotta/DarghosTFS04_87 | 2177feb1d288b1d0341c682d7d12ab28320683ec | 392291bd826cfd30e369c440303ad1588016606f | refs/heads/master | 2023-06-15T13:59:44.906677 | 2021-07-16T22:32:47 | 2021-07-16T22:32:47 | 386,390,869 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,441 | cpp | //////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#include "otpch.h"
#include "tasks.h"
#include "outputmessage.h"
#include "game.h"
extern Game g_game;
#if defined __EXCEPTION_TRACER__
#include "exception.h"
#endif
bool Dispatcher::m_shutdown = false;
Dispatcher::Dispatcher()
{
OTSYS_THREAD_LOCKVARINIT(m_taskLock);
OTSYS_THREAD_SIGNALVARINIT(m_taskSignal);
OTSYS_CREATE_THREAD(Dispatcher::dispatcherThread, NULL);
}
OTSYS_THREAD_RETURN Dispatcher::dispatcherThread(void* p)
{
#if defined __EXCEPTION_TRACER__
ExceptionHandler dispatcherExceptionHandler;
dispatcherExceptionHandler.InstallHandler();
#endif
srand((unsigned int)OTSYS_TIME());
while(!Dispatcher::m_shutdown)
{
Task* task = NULL;
// check if there are tasks waiting
OTSYS_THREAD_LOCK(getDispatcher().m_taskLock, "")
if(getDispatcher().m_taskList.empty())
{
//if the list is empty wait for signal
OTSYS_THREAD_WAITSIGNAL(getDispatcher().m_taskSignal, getDispatcher().m_taskLock);
}
if(!getDispatcher().m_taskList.empty() && !Dispatcher::m_shutdown)
{
// take the first task
task = getDispatcher().m_taskList.front();
getDispatcher().m_taskList.pop_front();
}
OTSYS_THREAD_UNLOCK(getDispatcher().m_taskLock, "");
// finally execute the task...
if(task)
{
OutputMessagePool::getInstance()->startExecutionFrame();
(*task)();
delete task;
OutputMessagePool::getInstance()->sendAll();
g_game.clearSpectatorCache();
}
}
#if defined __EXCEPTION_TRACER__
dispatcherExceptionHandler.RemoveHandler();
#endif
#ifndef WIN32
return NULL;
#endif
}
void Dispatcher::addTask(Task* task)
{
OTSYS_THREAD_LOCK(m_taskLock, "");
bool do_signal = false;
if(!Dispatcher::m_shutdown)
{
do_signal = m_taskList.empty();
m_taskList.push_back(task);
}
#ifdef _DEBUG
else
std::cout << "Error: [Dispatcher::addTask] Dispatcher thread is terminated." << std::endl;
#endif
OTSYS_THREAD_UNLOCK(m_taskLock, "");
// send a signal if the list was empty
if(do_signal)
OTSYS_THREAD_SIGNAL_SEND(m_taskSignal);
}
void Dispatcher::flush()
{
Task* task = NULL;
while(!m_taskList.empty())
{
task = getDispatcher().m_taskList.front();
m_taskList.pop_front();
(*task)();
delete task;
OutputMessagePool::getInstance()->sendAll();
g_game.clearSpectatorCache();
}
}
void Dispatcher::stop()
{
OTSYS_THREAD_LOCK(m_taskLock, "");
flush();
m_shutdown = true;
OTSYS_THREAD_UNLOCK(m_taskLock, "");
}
| [
"leandro_perrotta@hotmail.com"
] | leandro_perrotta@hotmail.com |
8c6870d4ea91942d97b726091c87216d592696df | ea537927ff592c52b8ae13ffff69f1b3c58e4d48 | /video/opengl/OpenGL_model.cpp | 06291b4edc2d523144323165c8e7d3929f76c612 | [
"MIT"
] | permissive | 124327288/YuYu | eacbcbd496ee5032dcf4fdc4fc2dbc4c7b767e1e | f3598899ae5e6892a6b5d546bb0849f5d6a3c5a8 | refs/heads/main | 2023-02-26T03:07:04.273960 | 2021-01-25T20:56:28 | 2021-01-25T20:56:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 391 | cpp | #include "yy.h"
#include "OpenGL.h"
#include "OpenGL_model.h"
OpenGLModel::OpenGLModel()
:
m_VAO(0),
m_vBuffer(0),
m_iBuffer(0),
m_iCount(0)
{
}
OpenGLModel::~OpenGLModel()
{
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &m_vBuffer);
glDeleteBuffers(1, &m_iBuffer);
glDeleteVertexArrays(1,&m_VAO);
}
| [
"artembasov@outlook.com"
] | artembasov@outlook.com |
86e1a52548ea87ab1e6008bfd122572696824392 | a3a2bccb492c513b75344cded0110e75bc17103d | /python/3.pyp/2.jisuanke_cainiao/data/787/简单算法入门/实现折半查找.cpp | 275ff6864a9336721713033ade499d8fb6e33cdc | [] | no_license | ldc0111/learn | abc40e0041b48a821935860be800a616d7dd0404 | e06d68437d5d1525cc6cee95fd99a9f2b90b17df | refs/heads/master | 2020-03-26T01:57:31.444390 | 2019-11-21T03:19:32 | 2019-11-21T03:19:32 | 144,390,234 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,253 | cpp | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
int k;
int numbers[1000001];
int m;
int i,j;
int flag = 0;
// 反复读入数字和查找数字的数量
while (scanf("%d %d", &n, &k) != EOF) {
// 读入给定的数字
for (i = 0; i < n; i++) {
scanf("%d", &numbers[i]);
}
for (j = 0; j < k; j++) {
// 读入待查找的数字,
scanf("%d", &m);
flag = 0;
// 请在下面完成查找读入数字的功能
int head = 0,tail = n - 1;
while (head < tail){
int mid = (head + tail) >> 1;
//cout << numbers[mid] << m << endl;
if(numbers[mid] == m) {
cout << mid + 1;
flag = 1;
if(j != k - 1) cout << " ";
else cout << endl;
break;
} else if (numbers[mid] < m) head = mid + 1;
else tail = mid;
}
if (flag == 0) {
cout << "0";
if(j != k - 1) cout << " ";
else cout << endl;
}
}
}
return 0;
} | [
"15736818863@163.com"
] | 15736818863@163.com |
09a6e28398f7b2c3db6eb431c9d9a3499eceb3c5 | 7eabf1ee7f6d64767dec4c44ce89f12812fd31a4 | /INTERVALTREE/intervaltree.h | cec9b116a072c06b939aacef34bf9e94e9660abe | [] | no_license | benjlouie/bl_library | ed2717521e2771e5267787d2509560be3e8ce01b | e7cd38ade5babe68f1d7f6702bbb7c4f58f3c1c8 | refs/heads/master | 2021-01-17T02:17:30.904155 | 2017-06-29T01:07:48 | 2017-06-29T01:07:48 | 43,112,542 | 2 | 0 | null | 2015-10-04T21:37:31 | 2015-09-25T06:02:33 | C | UTF-8 | C++ | false | false | 16,905 | h | //insert/delete cases used straight from wikipedia
#ifndef BL_INTERVALTREE_H
#define BL_INTERVALTREE_H
#include <functional>
#include <vector>
//TODO: remove debug dependencies
#include <iostream>
#include <queue>
//TODO: check if some allocator needs to be passed in
//TODO: make iterator for class
template<typename K>
struct Interval {
K low;
K high;
inline void operator= (const Interval<K> &rhs){ this->low = rhs.low; this->high = rhs.high; }
};
template<typename K> inline bool operator==(const Interval<K> &lhs, const Interval<K> &rhs){ return (lhs.low == rhs.low) && (lhs.high == rhs.high); }
template<typename K> inline bool operator!=(const Interval<K> &lhs, const Interval<K> &rhs){ return !operator==(lhs, rhs); }
template<typename K> inline bool operator< (const Interval<K> &lhs, const Interval<K> &rhs){ return lhs.low < rhs.low; }
template<typename K> inline bool operator> (const Interval<K> &lhs, const Interval<K> &rhs){ return operator< (rhs, lhs); }
template<typename K> inline bool operator<=(const Interval<K> &lhs, const Interval<K> &rhs){ return !operator> (lhs, rhs); }
template<typename K> inline bool operator>=(const Interval<K> &lhs, const Interval<K> &rhs){ return !operator< (lhs, rhs); }
template <typename K, typename T>
class IntervalTree
{
public:
IntervalTree(void);
~IntervalTree(void);
size_t size(void);
size_t count(const Interval<K> &key, const T *dataCmp = nullptr);
void clear(void);
bool empty(void);
T& insert(const Interval<K> &key, const T &data);
void remove(const Interval<K> &key, const T *dataCmp = nullptr);
std::vector<std::pair<const Interval<K> &, T&>> *intersect(const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> *list = nullptr);
std::vector<std::pair<const Interval<K> &, T&>> *within(const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> *list = nullptr);
T& operator[](const Interval<K> &key);
//TODO: remove debug method
void print(void);
private:
struct Node {
Interval<K> key;
K max;
T data;
enum Color { RED, BLACK } color;
Node *parent;
Node *left;
Node *right;
};
size_t size_;
Node *root_;
Node leaf_;
size_t count_(Node *root, const Interval<K> &key, const T *dataCmp = nullptr);
Node *peek(Node *root, const Interval<K> &key, const T *dataCmp = nullptr);
Node *grandparent(Node *n);
Node *uncle(Node *n);
Node *sibling(Node *n);
Node *predecessor(Node *n);
Node *successor(Node *n);
void rotate_right(Node *n);
void rotate_left(Node *n);
bool is_leaf(Node *n);
void replace_node(Node *n, Node *replacement);
void updateMax(Node *n);
void insert_case1(Node *n);
void insert_case2(Node *n);
void insert_case3(Node *n);
void insert_case4(Node *n);
void insert_case5(Node *n);
void remove_case0(Node *n);
void remove_case1(Node *n);
void remove_case2(Node *n);
void remove_case3(Node *n);
void remove_case4(Node *n);
void remove_case5(Node *n);
void remove_case6(Node *n);
std::vector<std::pair<const Interval<K> &, T&>> *intersect_(Node *root, const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> &intervals);
std::vector<std::pair<const Interval<K> &, T&>> *within_(Node *root, const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> &intervals);
void foreach_postorder(Node *root, std::function<void(Node *)> func);
};
template <typename K, typename T>
IntervalTree<K, T>::IntervalTree(void)
{
size_ = 0;
root_ = &leaf_;
leaf_.color = Node::BLACK;
leaf_.left = nullptr;
leaf_.right = nullptr;
}
template <typename K, typename T>
IntervalTree<K, T>::~IntervalTree(void)
{
clear();
}
template <typename K, typename T>
size_t IntervalTree<K, T>::size(void)
{
return size_;
}
template <typename K, typename T>
size_t IntervalTree<K, T>::count(const Interval<K> &key, const T *dataCmp)
{
return count_(root_, key, dataCmp);
}
//TODO: this method can be optimized
template <typename K, typename T>
size_t IntervalTree<K, T>::count_(Node *root, const Interval<K> &key, const T *dataCmp)
{
Node *cur = peek(root, key);
if (cur == &leaf_) {
return 0;
}
if (key == cur->key && (dataCmp == nullptr || cur->data == *dataCmp)) {
return (1 + count_(cur->left, key, dataCmp) + count_(cur->right, key, dataCmp));
}
return count_(cur->left, key, dataCmp) + count_(cur->right, key, dataCmp);
}
template <typename K, typename T>
void IntervalTree<K, T>::clear(void)
{
foreach_postorder(root_, [](Node *cur){ delete cur; });
root_ = &leaf_;
size_ = 0;
}
template <typename K, typename T>
bool IntervalTree<K, T>::empty(void)
{
return !size_;
}
/* HELPER section */
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::peek(Node *root, const Interval<K> &key, const T *dataCmp)
{
Node *cur = root;
while (cur != &leaf_) {
if (key < cur->key) {
cur = cur->left;
}
else if (key > cur->key) {
cur = cur->right;
}
else { //key.high may not equal cur->key.high, be aware
Node *ret = cur;
if (dataCmp && cur->data != *dataCmp) {
//dataCmp not equal, check subtrees (left first)
ret = peek(cur->left, key, dataCmp);
if (ret == &leaf_) {
ret = peek(cur->right, key, dataCmp);
}
}
return ret;
}
}
return &leaf_;
}
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::grandparent(Node *n)
{
if (n && n->parent) {
return n->parent->parent;
}
else {
return nullptr;
}
}
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::uncle(Node *n)
{
Node *g = grandparent(n);
if (g == nullptr)
return nullptr; // No grandparent means no uncle
if (n->parent == g->left)
return g->right;
else
return g->left;
}
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::sibling(Node *n)
{
if (!n || !n->parent) {
return nullptr;
}
if (n == n->parent->left) {
return n->parent->right;
}
else {
return n->parent->left;
}
}
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::predecessor(Node *n)
{
if (n->left == &leaf_) {
return nullptr;
}
Node *cur = n->left;
while (cur->right != &leaf_) {
cur = cur->right;
}
return cur;
}
template <typename K, typename T>
typename IntervalTree<K, T>::Node *
IntervalTree<K, T>::successor(Node *n)
{
if (n->right == &leaf_) {
return nullptr;
}
Node *cur = n->right;
while (cur->left != &leaf_) {
cur = cur->left;
}
return cur;
}
template <typename K, typename T>
void IntervalTree<K, T>::rotate_right(Node *n)
{
Node *left = n->left;
Node *parent = nullptr;
Node **parentLink;
//get parentLink
if (n->parent) {
parent = n->parent;
if (n->parent->left == n) {
parentLink = &n->parent->left;
}
else {
parentLink = &n->parent->right;
}
}
else {
parentLink = &root_;
}
//rotate right
*parentLink = left;
n->left = left->right;
n->parent = left;
left->parent = parent;
if (left->right != &leaf_) {
left->right->parent = n;
}
left->right = n;
updateMax(n);
updateMax(left);
}
template <typename K, typename T>
void IntervalTree<K, T>::rotate_left(Node *n)
{
Node *right = n->right;
Node *parent = nullptr;
Node **parentLink;
//get parentLink
if (n->parent) {
parent = n->parent;
if (n->parent->left == n) {
parentLink = &n->parent->left;
}
else {
parentLink = &n->parent->right;
}
}
else {
parentLink = &root_;
}
//rotate left
*parentLink = right;
n->right = right->left;
n->parent = right;
right->parent = parent;
if (right->left != &leaf_) {
right->left->parent = n;
}
right->left = n;
updateMax(n);
updateMax(right);
}
template <typename K, typename T>
bool IntervalTree<K, T>::is_leaf(Node *n)
{
return n == &leaf_;
}
template <typename K, typename T>
void IntervalTree<K, T>::replace_node(Node *n, Node *replacement)
{
if (!n->parent) {
root_ = replacement;
replacement->parent = nullptr;
return;
}
replacement->parent = n->parent;
if (n->parent->left == n) {
n->parent->left = replacement;
}
else {
n->parent->right = replacement;
}
}
//TODO: this may be traversing more than necessary, think about it more
template <typename K, typename T>
void IntervalTree<K, T>::updateMax(Node *n)
{
if (n == &leaf_) {
return;
}
n->max = n->key.high;
bool changed = false;
if (n->left != &leaf_ && n->left->max > n->max) {
n->max = n->left->max;
changed = true;
}
if (n->right != &leaf_ && n->right->max > n->max) {
n->max = n->right->max;
changed = true;
}
if (n->parent && (changed || (n->max > n->parent->max))) {
updateMax(n->parent);
}
}
/* INSERT section */
template <typename K, typename T>
T& IntervalTree<K, T>::insert(const Interval<K> &key, const T &data)
{
Node *n = new Node{ key, key.high, data, Node::RED, nullptr, &leaf_, &leaf_ };
Node *prev = nullptr;
Node *cur = root_;
Node **prevLink = &root_;
//BST insert at leaf
while (cur != &leaf_) {
prev = cur;
if (key >= cur->key) {
prevLink = &cur->right;
cur = cur->right;
}
else {
prevLink = &cur->left;
cur = cur->left;
}
}
//insert node
n->parent = prev;
*prevLink = n;
insert_case1(n);
updateMax(n);
size_++;
return n->data;
}
template <typename K, typename T>
void IntervalTree<K, T>::insert_case1(Node *n)
{
if (n->parent == nullptr) {
n->color = Node::BLACK;
}
else {
insert_case2(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::insert_case2(Node *n)
{
if (n->parent->color == Node::BLACK) {
return; /* Tree is still valid */
}
else {
insert_case3(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::insert_case3(Node *n)
{
Node *g;
Node *u = uncle(n);
if ((u != nullptr) && (u->color == Node::RED)) {
n->parent->color = Node::BLACK;
u->color = Node::BLACK;
g = grandparent(n);
g->color = Node::RED;
insert_case1(g);
}
else {
insert_case4(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::insert_case4(Node *n)
{
Node *g = grandparent(n);
if ((n == n->parent->right) && (n->parent == g->left)) {
rotate_left(n->parent);
n = n->left;
}
else if ((n == n->parent->left) && (n->parent == g->right)) {
rotate_right(n->parent);
n = n->right;
}
insert_case5(n);
}
template <typename K, typename T>
void IntervalTree<K, T>::insert_case5(Node *n)
{
Node *g = grandparent(n);
n->parent->color = Node::BLACK;
g->color = Node::RED;
if (n == n->parent->left)
rotate_right(g);
else
rotate_left(g);
}
/* REMOVE section */
template <typename K, typename T>
void IntervalTree<K, T>::remove(const Interval<K> &key, const T *dataCmp)
{
Node *cur = peek(root_, key, dataCmp);
if (cur != &leaf_) {
//BST delete, then correct
Node *removeNode = cur;
if (cur->left != &leaf_) {
removeNode = predecessor(cur);
}
else if (cur->right != &leaf_) {
removeNode = successor(cur);
}
//swap replacement(removeNode) with cur
if (removeNode != cur) {
cur->key = removeNode->key;
cur->data = removeNode->data;
}
remove_case0(removeNode);
updateMax(cur);
size_--;
}
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case0(Node *n)
{
// Precondition: n has at most one non-leaf child.
Node *child = is_leaf(n->right) ? n->left : n->right;
replace_node(n, child);
if (n->color == Node::BLACK) {
if (child->color == Node::RED) {
child->color = Node::BLACK;
}
else {
remove_case1(child);
}
}
delete n;
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case1(Node *n)
{
if (n->parent) {
remove_case2(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case2(Node *n)
{
Node *s = sibling(n);
if (s->color == Node::RED) {
n->parent->color = Node::RED;
s->color = Node::BLACK;
if (n == n->parent->left) {
rotate_left(n->parent);
}
else {
rotate_right(n->parent);
}
}
remove_case3(n);
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case3(Node *n)
{
Node *s = sibling(n);
if ((n->parent->color == Node::BLACK)
&& (s->color == Node::BLACK)
&& (s->left->color == Node::BLACK)
&& (s->right->color == Node::BLACK)) {
s->color = Node::RED;
remove_case1(n->parent);
}
else {
remove_case4(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case4(Node *n)
{
Node *s = sibling(n);
if ((n->parent->color == Node::RED)
&& (s->color == Node::BLACK)
&& (s->left->color == Node::BLACK)
&& (s->right->color == Node::BLACK)) {
s->color = Node::RED;
n->parent->color = Node::BLACK;
}
else {
remove_case5(n);
}
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case5(Node *n)
{
Node *s = sibling(n);
if (s->color == Node::BLACK) {
if ((n == n->parent->left)
&& (s->right->color == Node::BLACK)
&& (s->left->color == Node::RED)) {
s->color = Node::RED;
s->left->color = Node::BLACK;
rotate_right(s);
}
else if ((n == n->parent->right)
&& (s->left->color == Node::BLACK)
&& (s->right->color == Node::RED)) {
s->color = Node::RED;
s->right->color = Node::BLACK;
rotate_left(s);
}
}
remove_case6(n);
}
template <typename K, typename T>
void IntervalTree<K, T>::remove_case6(Node *n)
{
Node *s = sibling(n);
s->color = n->parent->color;
n->parent->color = Node::BLACK;
if (n == n->parent->left) {
s->right->color = Node::BLACK;
rotate_left(n->parent);
}
else {
s->left->color = Node::BLACK;
rotate_right(n->parent);
}
}
/* ACCESS section */
//TODO: check intersect/within and make sure the booleans work (x:x) intersects (x:x) and is within (x:x)
//TODO: elements of vector can still be changed (like with iterator), maybe copy instead of ref? (could be memory heavy)
template <typename K, typename T>
std::vector<std::pair<const Interval<K> &, T&>> *
IntervalTree<K, T>::intersect(const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> *intervals)
{
std::vector<std::pair<const Interval<K> &, T&>> *list = intervals;
if (list == nullptr) {
list = new std::vector<std::pair<const Interval<K> &, T&>>;
}
list = intersect_(root_, key, *list);
return list;
}
template <typename K, typename T>
std::vector<std::pair<const Interval<K> &, T&>> *
IntervalTree<K, T>::intersect_(Node *root, const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> &intervals)
{
if (root == &leaf_) {
return &intervals;
}
if (key.low <= root->max) {
intersect_(root->left, key, intervals);
}
if (key.low <= root->key.high && key.high >= root->key.low) {
intervals.push_back(std::pair<const Interval<K> &, T&>(root->key, root->data));
}
if (key.high >= root->key.low) {
intersect_(root->right, key, intervals);
}
return &intervals;
}
template <typename K, typename T>
std::vector<std::pair<const Interval<K> &, T&>> *
IntervalTree<K, T>::within(const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> *intervals)
{
std::vector<std::pair<const Interval<K> &, T&>> *list = intervals;
if (list == nullptr) {
list = new std::vector<std::pair<const Interval<K> &, T&>>;
}
list = within_(root_, key, *list);
return list;
}
template <typename K, typename T>
std::vector<std::pair<const Interval<K> &, T&>> *
IntervalTree<K, T>::within_(Node *root, const Interval<K> &key, std::vector<std::pair<const Interval<K> &, T&>> &intervals)
{
if (root == &leaf_) {
return &intervals;
}
if (key.low <= root->max && key.low <= root->key.low) { //TODO: check 2nd test
within_(root->left, key, intervals);
}
if (key.low <= root->key.low && key.high >= root->key.high) {
intervals.push_back(std::pair<const Interval<K> &, T&>(root->key, root->data));
}
if (key.high >= root->key.low) { //TODO: need extra test here? think more about intervals within others
within_(root->right, key, intervals);
}
return &intervals;
}
template <typename K, typename T>
T& IntervalTree<K, T>::operator[](const Interval<K> &key)
{
Node *node = peek(root_, key);
if (node != &leaf_) {
//key exists
return node->data;
}
T data; //TODO: does this work on types with complex allocation?
return insert(key, data);
}
template <typename K, typename T>
void IntervalTree<K, T>::foreach_postorder(Node *root, std::function<void(Node *)> func)
{
if (root == &leaf_) {
return;
}
foreach_postorder(root->left, func);
foreach_postorder(root->right, func);
func(root);
}
//TODO: remove debug method
template <typename K, typename T>
void IntervalTree<K, T>::print(void)
{
std::queue<Node *> q;
q.push(root_);
while (q.size() > 0) {
int size = q.size();
for (int i = 0; i < size; i++) {
Node *cur = q.front();
q.pop();
if (cur != &leaf_) {
std::cout << "(" << cur->key.low << ":" << cur->key.high << ")" << cur->max << "|" << cur->data << ", ";
q.push(cur->left);
q.push(cur->right);
}
else {
std::cout << "NULL, ";
}
}
std::cout << std::endl;
}
}
#endif // !BL_IntervalTree_H
| [
"benjlouie@gmail.com"
] | benjlouie@gmail.com |
0f7a85f971b322d064a4e477bc3165059ad7ef3e | 9a7ed884412c559f7343329f8f08eb4ffa9cbdb0 | /Source/ChaliceAbilities/Private/ChaliceAbilities/System/ChaliceAbilitiesBlueprintLibrary.cpp | 295d45835ecdc5e951abc47813815a7946d85235 | [
"MIT"
] | permissive | spencer-melnick/Chalice | 696218357f76849fbeb1d6ea58e26a1129320e86 | fdb414d0620249af54b3b666222a8731e84d097e | refs/heads/main | 2021-06-22T21:42:56.718028 | 2021-01-23T04:19:11 | 2021-01-23T04:19:11 | 314,052,311 | 5 | 0 | MIT | 2021-01-23T04:19:12 | 2020-11-18T20:38:58 | C++ | UTF-8 | C++ | false | false | 1,143 | cpp | // Copyright (c) 2020 Spencer Melnick
#include "ChaliceAbilities/System/ChaliceAbilitiesBlueprintLibrary.h"
#include "ChaliceAbilities/System/ChaliceAbilityInterface.h"
#include "ChaliceAbilities/System/ChaliceAbilityComponent.h"
#include "ChaliceCore/Components/InteractionComponent.h"
// UChaliceAbilitiesBlueprintLibrary
UChaliceAbilityComponent* UChaliceAbilitiesBlueprintLibrary::GetAbilityComponent(const AActor* Actor)
{
const IChaliceAbilityInterface* AbilityInterface = Cast<IChaliceAbilityInterface>(Actor);
if (!AbilityInterface)
{
return nullptr;
}
return AbilityInterface->GetChaliceAbilityComponent();
}
FGameplayTagContainer UChaliceAbilitiesBlueprintLibrary::GetActorOwnedTags(const AActor* Actor)
{
FGameplayTagContainer Tags;
const UChaliceAbilityComponent* AbilityComponent = GetAbilityComponent(Actor);
if (AbilityComponent)
{
AbilityComponent->GetOwnedGameplayTags(Tags);
}
return Tags;
}
UInteractionComponent* UChaliceAbilitiesBlueprintLibrary::GetInteractionComponent(const AActor* Actor)
{
if (!Actor)
{
return nullptr;
}
return Actor->FindComponentByClass<UInteractionComponent>();
}
| [
"smelnick97@gmail.com"
] | smelnick97@gmail.com |
b00e8fe2372a1490138b15332b3c00a32a455abf | aa0168a62f7629c08f4d30d8719fe4239e978cfb | /libVcf/test/testReadBCFByRange.cpp | ff1101bcca0c8b7d4792b7ec7ea47b84e3215fe3 | [] | no_license | Shicheng-Guo/rvtests | e41416785f42e4ff7da87f633ffff86dd64eaf60 | be1bd88b2bd663804bb8c2aff8a4d990a29850d2 | refs/heads/master | 2020-04-07T10:51:02.496565 | 2018-10-05T05:59:27 | 2018-10-05T05:59:27 | 158,302,712 | 1 | 0 | null | 2018-11-19T23:20:09 | 2018-11-19T23:20:08 | null | UTF-8 | C++ | false | false | 963 | cpp | #include "VCFUtil.h"
int main() {
VCFInputFile vin("test.bcf.gz");
vin.setRangeList("1:196341364-196341449");
while (vin.readRecord()){
VCFRecord& r = vin.getVCFRecord();
VCFPeople& people = r.getPeople();
VCFIndividual* indv;
printf("%s:%d\t", r.getChrom(), r.getPos());
bool tagMissing;
VCFInfo& info = r.getVCFInfo();
std::string anno = info.getTag("ANNO", &tagMissing).toStr();
printf("ANNO=%s\t", anno.c_str());
// assert(tagMissing); // all variant has tagMissing == true
bool missingGenotype; // missing indicator
int GTidx = r.getFormatIndex("GT");
for (int i = 0; i < people.size(); i++){
indv = people[i];
const VCFValue& gt = indv->justGet(GTidx);
missingGenotype = gt.isMissingGenotype();
if (!missingGenotype) {
printf("%d", gt.getGenotype());
} else {
printf("M");
}
printf("\t");
}
printf("\n");
}
return 0;
}
| [
"zhanxw@gmail.com"
] | zhanxw@gmail.com |
077602fc32230c1cef1c937d28a276a6aaa00016 | a627fc9abcfcf159b7de03e570a63d96b9324c38 | /11_flood_fill.cpp | 10951374ac241dc0f81e963ec6e5e54f6f5b53a8 | [] | no_license | jishnupramod/Leetcode-May-Challenge-2020 | 888fd08944cb53b3985cb8632826dc7f366f8367 | ca3a18e130c3e882f236d01b840a61ffebb0d33d | refs/heads/master | 2022-09-18T00:59:01.377052 | 2020-05-31T07:50:33 | 2020-05-31T07:50:33 | 260,855,256 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,185 | cpp | /*
An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).
Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor,
"flood fill" the image.
To perform a "flood fill", consider the starting pixel,
plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel,
plus any pixels connected 4-directionally to those pixels (also with the same color as the starting pixel), and so on.
Replace the color of all of the aforementioned pixels with the newColor.
At the end, return the modified image.
Example 1:
Input:
image = [[1,1,1],[1,1,0],[1,0,1]]
sr = 1, sc = 1, newColor = 2
Output: [[2,2,2],[2,2,0],[2,0,1]]
Explanation:
From the center of the image (with position (sr, sc) = (1, 1)), all pixels connected
by a path of the same color as the starting pixel are colored with the new color.
Note the bottom corner is not colored 2, because it is not 4-directionally connected
to the starting pixel.
Note:
The length of image and image[0] will be in the range [1, 50].
The given starting pixel will satisfy 0 <= sr < image.length and 0 <= sc < image[0].length.
The value of each color in image[i][j] and newColor will be an integer in [0, 65535].
*/
class Solution {
private:
void dfs(vector<vector<int>>& img, int i, int j, int row, int col, int newColor, int origColor) {
if (i<0 or j<0 or i+1>row or j+1>col or img[i][j] != origColor)
return;
img[i][j] = newColor;
dfs(img, i+1, j, row, col, newColor, origColor);
dfs(img, i-1, j, row, col, newColor, origColor);
dfs(img, i, j+1, row, col, newColor, origColor);
dfs(img, i, j-1, row, col, newColor, origColor);
}
public:
vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc, int newColor) {
int row = image.size();
int col = row > 0 ? image[0].size() : 0;
int origColor = image[sr][sc];
if (origColor == newColor)
return image;
dfs(image, sr, sc, row, col, newColor, origColor);
return image;
}
};
| [
"jishnumagnanimous@gmail.com"
] | jishnumagnanimous@gmail.com |
4adc7cc8ec31850973654ef844db67e4e1a09dd1 | 4d77398fc24009f483f2b2abc028a135e09fc9eb | /Assignment4/Solid_plate/4.6/gradTz | 87c95012df331fd955deda67300fa4644c7502b6 | [] | permissive | Naveen-Surya/CFD-Lab-1 | 12c635b72c611d83080ed6dd316b1b0016f2f86f | c38b0bfe43c7135f4a10e744ea1ac6cf6e9d4a1a | refs/heads/master | 2020-04-05T16:43:39.651232 | 2018-08-23T12:10:06 | 2018-08-23T12:10:06 | 157,026,052 | 0 | 1 | MIT | 2018-11-10T22:11:51 | 2018-11-10T22:11:51 | null | UTF-8 | C++ | false | false | 1,376 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "4.6";
object gradTz;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 -1 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
left
{
type calculated;
value uniform 0;
}
right
{
type calculated;
value uniform 0;
}
interface
{
type calculated;
value uniform 0;
}
bottom
{
type calculated;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //
| [
"sarthakgarg1993@gmail.com"
] | sarthakgarg1993@gmail.com | |
1d34a4de9f54517b1bdea58238f41f206b568ef3 | 6f5890355a6b21cde87e4a847a9cc8fd7386dc4e | /eights.cpp | e97f72fe4643e0c07cf3ca770b24f5c9841ed5ff | [] | no_license | mjww3/algorithms | 1d5fc8ddc55f93b76a4cb4aff953753ceb7db380 | 95bbcf7fc433714051211cd9e58dd02a50950fa0 | refs/heads/master | 2021-01-19T23:57:00.863976 | 2017-07-01T19:51:50 | 2017-07-01T19:51:50 | 89,052,257 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 253 | cpp | #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
int main()
{
long long int T,K;
cin>>T;
while(T--)
{
cin>>K;
long long int result = 192+(K-1)*250;
cout<<result<<endl;
}
return 0;
}
///solved | [
"mukuljainagro@gmail.com"
] | mukuljainagro@gmail.com |
0b34fd63d46101c52c160ffd834e098e418a4ca5 | cdea526b9be1cdfd42e69fe1d49433bdf39c8906 | /src/ImplicitShape/Torus.cpp | 4389b9ce86dad8222a38db69a697aa0cc9bdd420 | [] | no_license | johannmeyer/ray-tracer | 0c628ec4293a90d4b1064706b0daf1dcebcb380d | 387deaeda95e1aaf2bfc9cf8797f775fed8b82cb | refs/heads/master | 2023-05-03T20:02:25.016984 | 2021-05-22T18:42:18 | 2021-05-22T18:42:18 | 361,144,767 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 483 | cpp | #include "ImplicitShape.h"
double Torus::get_distance(const Point3& p) const
{
Point3 q = p;
double x = sqrt(q.x()*q.x() + q.z()*q.z()) - radius_major;
double y = q.y();
return sqrt(x*x + y*y) - radius_minor;
}
void Torus::bounding_box(AABB& output_box) const
{
double max_radius_xz = radius_major + radius_minor;
double max_radius_y = radius_minor;
Vec3 delta = Vec3(max_radius_xz, max_radius_y, max_radius_xz);
output_box = AABB(-delta, delta);
} | [
"johann.meyer@gmail.com"
] | johann.meyer@gmail.com |
1876064c6ce5245ca5015c49c05e4376782abd95 | f2f74b28e4e49996d4df3a28d442e30983f3257d | /computadora.cpp | b40c865437cc258b0e6aac2085397fff5a7e05fc | [] | no_license | davidfranc/EDO_Actividad13 | 51de1747930ffc9e97b6da12b05251e0ee745c2e | 1905d7dc76bc92abf944c5c307769fe7e46e0b17 | refs/heads/main | 2023-01-06T11:09:29.354931 | 2020-11-02T05:58:45 | 2020-11-02T05:58:45 | 309,272,879 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 906 | cpp | #include "computadora.h"
Computadora::Computadora()
{
}
Computadora::Computadora(const string &sistemaOperativo, const string &procesador, int memoriaRam, int almacenamiento)
{
this->sistemaOperativo = sistemaOperativo;
this->procesador = procesador;
this->memoriaRam = memoriaRam;
this->almacenamiento = almacenamiento;
}
void Computadora::setSistemaOperativo(const string &v)
{
sistemaOperativo = v;
}
string Computadora::getSistemaOperativo()
{
return sistemaOperativo;
}
void Computadora::setProcesador(const string &v)
{
procesador = v;
}
string Computadora::getProcesador()
{
return procesador;
}
void Computadora::setMemoriaRam(int v)
{
memoriaRam = v;
}
int Computadora::getMemoriaRam()
{
return memoriaRam;
}
void Computadora::setAlmacenamiento(int v)
{
almacenamiento = v;
}
int Computadora::getAlmacenamiento()
{
return almacenamiento;
}
| [
"david.andrade7477@alumnos.udg.mx"
] | david.andrade7477@alumnos.udg.mx |
a46b77f82879c308c052cfd25a4beeb404b8f76f | 77d707e44c708aeac4fe9271c77aebc7d2707180 | /src/main.cpp | 388696a1586940d2345d1919725eab5f798d180f | [] | no_license | aksoysamet/Minigames | d95db1d88ce251762468abe9e9cea77dbcf8a9ef | 264c88fd5a357c3d4abbb20cc1c3b2c4915e68fc | refs/heads/master | 2022-12-03T08:41:01.953770 | 2020-08-15T11:26:11 | 2020-08-15T11:26:11 | 287,731,090 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,828 | cpp | #include "main.h"
#include "lobby.h"
#include <set>
void **ppPluginData;
extern void *pAMXFunctions;
vector < lobby * > maplar;
vector < lobby * > yuklenecekler;
typedef void(*logprintf_t)(char* format, ...);
logprintf_t logprintf;
milliseconds uptime;
milliseconds nuptime;
std::chrono::duration<double> tmt;
int tickRate = 0;
std::set<AMX*> amxList;
bf_map* lastmap = nullptr;
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
return sampgdk::Supports() | SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES | SUPPORTS_PROCESS_TICK;
}
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF];
bool load = sampgdk::Load(ppData);
sampgdk::logprintf("Minigames Loaded.");
return true;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
sampgdk::logprintf("Minigames unLoaded.");
sampgdk::Unload();
}
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick()
{
if(yuklenecekler.size() > 0)
{
uptime = duration_cast< milliseconds >(
system_clock::now().time_since_epoch()
);
if(yuklenecekler.front()->lobbymap->load()) {
maplar.push_back(yuklenecekler.front());
}
nuptime = duration_cast< milliseconds >(
system_clock::now().time_since_epoch()
);
tmt = (nuptime - uptime);
tickRate += (int)(tmt.count()*1000);
yuklenecekler.erase(yuklenecekler.begin());
}
tickRate += 5;
if(tickRate >= 50)
{
if(maplar.size() > 0)
{
auto pMaps = maplar.begin();
for (; pMaps != maplar.end(); ++pMaps) {
(*pMaps)->ProcessTick();
}
}
tickRate = 0;
}
}
PLUGIN_FUNCTION LoadMap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if (params[2] >= mLobby->dir->GetDirCount() || params[2] < 0)return 0;
cell mapid = (cell)mLobby->LoadLobbyMap(params[2], params[3]);
return mapid;
}
PLUGIN_FUNCTION LoadRandomMap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
cell mapid = (cell)mLobby->LoadLobbyMapRandom(params[2]);
return mapid;
}
PLUGIN_FUNCTION UnLoadMap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(std::find(maplar.begin(), maplar.end(), mLobby) != maplar.end() ||
std::find(yuklenecekler.begin(), yuklenecekler.end(), mLobby) != yuklenecekler.end() )
{
bf_map *cmap = mLobby->lobbymap;
if (cmap != nullptr)
{
if(cmap->m_bLoaded)
{
for (auto yukle = maplar.begin(); yukle != maplar.end(); ++yukle)
{
if (mLobby == (*yukle))
{
maplar.erase(yukle);
break;
}
}
cmap->destroy();
}
else
{
for (auto yukle = yuklenecekler.begin(); yukle != yuklenecekler.end(); ++yukle)
{
if (mLobby == (*yukle))
{
yuklenecekler.erase(yukle);
break;
}
}
}
if(!(mLobby->processrun))delete cmap;
else {
sampgdk::logprintf("Process Tick Calisirken Unload yapilamadi!");
return false;
}
mLobby->currentmapid = INVALID_MAP_ID;
mLobby->lobbymap = nullptr;
return true;
}
}
return false;
}
PLUGIN_FUNCTION CreateLobby(AMX* amx, cell* params)
{
char * file;
lobby * mLobby;
amx_StrParam(amx, params[1], file);
if(!file[0])
{
return (cell)0;
}else
{
mLobby = new lobby(file,params[2]);
if(mLobby->dir->GetDirCount() == 0)sampgdk::logprintf("Map bulunamadı!");
}
return (cell)mLobby;
}
PLUGIN_FUNCTION DestroyLobby(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
delete mLobby;
return true;
}
return false;
}
PLUGIN_FUNCTION AddPlayerLobby(AMX* amx, cell* params)
{
if(!IsPlayerConnected(params[1])) return 0;
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->AddPlayerToLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION DelPlayerLobby(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->DelPlayerToLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION IsPlayerInLobby(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->IsPlayerInLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION AddVehicleLobby(AMX* amx, cell* params)
{
if(!IsValidVehicle(params[1])) return 0;
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->AddVehicleToLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION DelVehicleLobby(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->DelVehicleToLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION IsVehicleInLobby(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[2];
if(mLobby != NULL)
{
return mLobby->IsVehicleInLobby(params[1]);
}
return false;
}
PLUGIN_FUNCTION AddProjectile(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->AddProjectile(params[2],params[3]);
}
return false;
}
PLUGIN_FUNCTION AddTrap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return (cell)mLobby->AddTrap(params[2]);
}
return 0;
}
PLUGIN_FUNCTION DestroyTrap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
Trap * trap = (Trap*)params[2];
if(trap != NULL)
{
return mLobby->DestroyTrap(trap);
}
}
return 0;
}
PLUGIN_FUNCTION DestroyAllTrap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
mLobby->DestroyAllTrap();
return 1;
}
return 0;
}
PLUGIN_FUNCTION GetMapCount(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->GetMapCount();
}
return 0;
}
PLUGIN_FUNCTION SetLobbyCheckCol(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
mLobby->SetLobbyCheckCol((bool)params[2]);
return 1;
}
return 0;
}
PLUGIN_FUNCTION GetVehicleLastHit(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->GetVehicleLastHit(params[2]);
}
return 0;
}
PLUGIN_FUNCTION ResetVehicleLastHit(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->ResetVehicleLastHit(params[2]);
}
return 0;
}
PLUGIN_FUNCTION GetVehicleLastShooter(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->GetVehicleLastShooter(params[2]);
}
return 0;
}
PLUGIN_FUNCTION ResetVehicleLastShooter(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->ResetVehicleLastShooter(params[2]);
}
return 0;
}
PLUGIN_FUNCTION GetMapInfo(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
if (params[2] >= mLobby->dir->GetDirCount() || params[2] < 0)return 0;
cell* addr = NULL;
amx_GetAddr(amx, params[3], &addr);
amx_SetString(addr, mLobby->dir->dirlist.at(params[2])->GetMapName(), 0, 0, params[4]);
}
return 0;
}
PLUGIN_FUNCTION GetMapLocation(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
if (params[2] >= mLobby->dir->GetDirCount() || params[2] < 0)return 0;
cell* addr = NULL;
amx_GetAddr(amx, params[3], &addr);
amx_SetString(addr, mLobby->dir->dirlist.at(params[2])->GetMapLocation(), 0, 0, params[4]);
}
return 0;
}
PLUGIN_FUNCTION GetMapLastStart(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
if (params[2] >= mLobby->dir->GetDirCount() || params[2] < 0)return 0;
return (cell)mLobby->dir->dirlist.at(params[2])->GetLastStartTime();
}
return 0;
}
PLUGIN_FUNCTION GetCurrentMapID(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->currentmapid;
}
return INVALID_MAP_ID;
}
PLUGIN_FUNCTION DeleteMap(AMX* amx, cell* params)
{
lobby * mLobby = (lobby*)params[1];
if(mLobby != NULL)
{
return mLobby->DeleteMap(params[2]);
}
return 0;
}
//GetMapCheckPoint(cpid, checkpoints[], checkpoint_size);
PLUGIN_FUNCTION GetMapCheckPoint(AMX* amx, cell* params)
{
if (lastmap != nullptr)
{
cell *cptr = NULL;
int size = params[3];
size_t id = params[1];
amx_GetAddr(amx, params[2], &cptr);
if (lastmap->m_flags & FLAG_PICKUP)
{
if (id >= lastmap->m_vPickups.size() || size < 3)return false;
auto spInformation = lastmap->m_vPickups.at(id);
for(int i = 0; i < 3;i++)cptr[i] = amx_ftoc(spInformation[i]);
}
else if (lastmap->m_flags & FLAG_CHECKPS)
{
if (id >= lastmap->m_vRaceCheckps.size() || size < 5)return false;
auto scInformation = lastmap->m_vRaceCheckps.at(id);
for (int i = 0; i < 5; i++)cptr[i] = amx_ftoc(scInformation[i]);
}
return true;
}
return false;
}
//GetMapSpawnPoint(spid, spawnpoint[], spawnpoint_size);
PLUGIN_FUNCTION GetMapSpawnPoint(AMX* amx, cell* params)
{
if (lastmap != nullptr)
{
cell *cptr = NULL;
int size = params[3];
size_t id = params[1];
amx_GetAddr(amx, params[2], &cptr);
if (lastmap->m_flags & FLAG_PED)
{
if (id >= lastmap->m_vSpawnpoints.size() || size < 4)return false;
auto spInformation = lastmap->m_vSpawnpoints.at(id);
for (int i = 0; i < 4; i++)cptr[i] = amx_ftoc(spInformation[i]);
}
else
{
if (id >= lastmap->m_vSpawnpoints.size() || size < 5)return false;
auto spInformation = lastmap->m_vSpawnpoints.at(id);
for (int i = 0; i < 5; i++)cptr[i] = amx_ftoc(spInformation[i]);
}
return true;
}
return false;
}
const AMX_NATIVE_INFO ListNatives[] =
{
{ "LoadMap", LoadMap },
{ "LoadRandomMap", LoadRandomMap},
{ "UnLoadMap", UnLoadMap},
{ "CreateLobby", CreateLobby},
{ "DestroyLobby", DestroyLobby},
{ "AddPlayerLobby", AddPlayerLobby},
{ "DelPlayerLobby", DelPlayerLobby},
{ "IsPlayerInLobby", IsPlayerInLobby},
{ "GetMapCount", GetMapCount},
{ "AddVehicleLobby", AddVehicleLobby},
{ "DelVehicleLobby", DelVehicleLobby},
{ "IsVehicleInLobby", IsVehicleInLobby},
{ "AddProjectile", AddProjectile},
{ "SetLobbyCheckCol", SetLobbyCheckCol},
{ "GetVehicleLastHit", GetVehicleLastHit},
{ "ResetVehicleLastHit", ResetVehicleLastHit},
{ "GetVehicleLastShooter", GetVehicleLastShooter},
{ "ResetVehicleLastShooter", ResetVehicleLastShooter},
{ "AddTrap", AddTrap},
{ "DestroyTrap", DestroyTrap},
{ "DestroyAllTrap", DestroyAllTrap},
{ "GetMapInfo", GetMapInfo},
{ "GetMapLastStart", GetMapLastStart},
{ "GetCurrentMapID", GetCurrentMapID},
{ "DeleteMap", DeleteMap},
{ "GetMapLocation", GetMapLocation},
{ "GetMapCheckPoint", GetMapCheckPoint },
{ "GetMapSpawnPoint", GetMapSpawnPoint },
{ NULL, NULL }
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx)
{
amxList.insert(amx);
return amx_Register(amx, ListNatives, -1);
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload(AMX *amx)
{
amxList.erase(amx);
return AMX_ERR_NONE;
}
| [
"aksoysamett@outlook.com"
] | aksoysamett@outlook.com |
69700b2276f8a6dc175bec8c750d3757be9ec78a | 74441dee7a5b6c7560e300d30fc97279687ce1e4 | /main.cc | 7841e178ad36f200cfd46de640047e79a73e1d1e | [] | no_license | golegen/MayanCalculator | ddc8d5416cb97315bdd9a4f1b874684e15a9e76f | b3fc44ed7aff4ce651d2f174e24c656147093099 | refs/heads/master | 2021-01-09T11:50:19.757473 | 2015-03-11T02:46:00 | 2015-03-11T02:46:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,303 | cc | /*
* main.cc
*
* Created on: Apr 17, 2012
* Author: jonathan
*/
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <cstdio>
#include <cmath>
using namespace std;
/*******************************************************************************
*
*
*
* Helper Functions
*
*
*
*******************************************************************************/
/**
* Function that validates the mayan date to make sure the values
* don't go above or below the bounds.
*/
string validateMayanDate(unsigned int baktun, unsigned int katun, unsigned tun, unsigned int uinal, unsigned int kin) {
while(1) {
if (baktun > 19) {
cout << "date out of bounds.\n";
exit(1);
}
if (katun >= 20) {
katun -= 20;
baktun++;
}
if (tun >= 20) {
tun -= 20;
katun++;
}
if (uinal >= 18) {
uinal -= 18;
tun++;
}
if (kin >= 20) {
kin -= 20;
uinal++;
}
if (baktun < 0 || katun < 0 || tun < 0 || uinal < 0 || kin < 0) {
cout << "date out of bounds.\n";
exit(1);
}
if (kin < 20 && uinal < 18 && tun < 20 && katun < 20 && baktun < 20) {
std::ostringstream oss;
oss << "" << baktun;
oss << "." << katun;
oss << "." << tun;
oss << "." << uinal;
oss << "." << kin;
return oss.str();
}
}
return "error validating date.\n";
}
/**
* Function that validates the gregorian date to make sure the values
* don't go above or below the bounds.
*/
void validateGregorianDate(unsigned int month, unsigned int day, int year) {
if (year > 4772 || year < -3113) {
cout << "date out of bounds.\n";
exit(1);
}
if (year == 4772) {
if (month == 10) {
if (day >= 13) {
cout << "date out of bounds.\n";
exit(1);
}
} else if (month > 10) {
cout << "date out of bounds.\n";
exit(1);
}
}
if (year == -3113) {
if (month == 8) {
if (day <= 10) {
cout << "date out of bounds.\n";
exit(1);
}
} else if (month < 8) {
cout << "date out of bounds.\n";
exit(1);
}
}
}
/**
* Converts the Gregorian Date into a number of days
* Returns the number of days that correspond to the gregorian date
*/
unsigned int convertToDays(unsigned int month, unsigned int day, int year) {
unsigned int days = 0;
int base = -3113;
int monthDays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
validateGregorianDate(month, day, year);
if (year > base)
days+= 142;
if (year == base) {
if (month <= 8 && day < 11) {
cout << "Not a valid mayan date.";
} else {
if (month == 8) {
days += day;
days -= 11;
} else {
for (unsigned int i = 8; i < month; i++) {
days += monthDays[i];
}
days += day;
}
return days;
}
} else {
for (;;) {
if ((base % 4 == 0 && !(base % 100 == 0)) || (base % 400 == 0))
days++;
base++;
if (base == year)
break;
days += 365;
}
if ((year % 4 == 0 && !(year % 100 == 0)) || (year % 400 == 0))
monthDays[2] = 29;
for (unsigned int i = 1; i < month; i++) {
days += monthDays[i];
}
days += day;
return days;
}
return 0;
}
/**
* Converts the Mayan Date into a number of days
* Returns the number of days that correspond to the mayan date
*/
unsigned int convertToDays(unsigned int baktun, unsigned int katun, unsigned tun, unsigned int uinal, unsigned int kin) {
unsigned int a, b, c, d, e;
a = 144000 * baktun;
b = 7200 * katun;
c = 360 * tun;
d = 20 * uinal;
e = kin;
string result = validateMayanDate(baktun, katun, tun, uinal, kin);
unsigned int days = a + b + c + d + e;
return days;
}
/**
* Converts the specified days into a mayan date
*/
string convertToMayan(unsigned int dayArg) {
unsigned int days = dayArg;
unsigned int baktun = 0, katun = 0, tun = 0, uinal = 0, kin = 0;
while (days > 0) {
if (days >= 144000) {
baktun++;
days -= 144000;
}
if (days >= 7200) {
days -= 7200;
katun++;
}
if (days >= 360) {
days -= 360;
tun++;
}
if (days >= 20) {
days -= 20;
uinal++;
}
if (days <= 20) {
kin += days;
days = 0;
}
}
string result = validateMayanDate(baktun, katun, tun, uinal, kin);
return result;
}
/**
* Converts the specified days into a gregorian date
*/
string convertToGregorian(unsigned int dayArg) {
unsigned int days = dayArg;
unsigned int month = 1, day = 1;
unsigned int monthDays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string monthNames[13] = {"", "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
string dayOfTheWeek[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday"};
int year = -3113;
if (days < 142) {
for (month = 8; days > monthDays[month]; month++) {
days -= monthDays[month];
}
days += 11;
if (days > monthDays[month]) {
days -= monthDays[month];
month++;
}
day = days;
} else {
days -= 142;
for (;;) {
year++;
if ((year % 4 == 0 && !(year % 100 == 0)) || (year % 400 == 0))
days--;
if (days < 365)
break;
days -= 365;
}
for (month = 1; days > monthDays[month]; month++) {
days -= monthDays[month];
}
day = days;
}
validateGregorianDate(month, day, year);
std::ostringstream oss;
oss << dayOfTheWeek[dayArg % 7] << " ";
oss << monthNames[month] << " ";
oss << day << ", ";
if (year < 0) {
oss << abs (year-1) << " B.C.\n";
} else {
oss << year << " A.D.\n";
}
return oss.str();
}
/*******************************************************************************
*
*
*
* Main Functions
*
*
*
*******************************************************************************/
/*
* Adds a number of days to a mayan date
* Returns the mayan date with the # of days added
*/
void MayanPlus(char* dateArg, char* daysArg) {
unsigned int days, baktun, katun, tun, uinal, kin;
if (sscanf(dateArg, "%u.%u.%u.%u.%u", &baktun, &katun, &tun, &uinal, &kin) != 5) {
cout << "invalid argument for mayan date or days.\n";
exit(1);
}
if (sscanf(daysArg, "%u", &days) != 1) {
cout << "invalid argument for days.\n";
exit(1);
}
unsigned int mayanDays = convertToDays(baktun, katun, tun, uinal, kin);
mayanDays += days;
string result = convertToMayan(mayanDays);
std::cout << result << "\n";
}
/**
* Subtracts a number of days from a mayan date
* Returns the mayan date with the # of days subtracted
*/
void MayanMinus(char* dateArg, char* daysArg) {
unsigned int days, baktun, katun, tun, uinal, kin;
if (sscanf(dateArg, "%u.%u.%u.%u.%u", &baktun, &katun, &tun, &uinal, &kin) != 5) {
cout << "invalid argument for days or mayan date.\n";
exit(1);
}
if (sscanf(daysArg, "%u", &days) != 1) {
cout << "invalid argument for days.\n";
exit(1);
}
unsigned int mayanDays = convertToDays(baktun, katun, tun, uinal, kin);
mayanDays -= days;
string result = convertToMayan(mayanDays);
std::cout << result << "\n";
}
/**
* Compares two mayan dates and
* Returns the number of days in between them.
*/
void MayanCompare(char* dateOne, char* dateTwo) {
unsigned int baktun, katun, tun, uinal, kin;
unsigned int daysOne = 0, daysTwo = 0;
if( sscanf(dateOne, "%u.%u.%u.%u.%u", &baktun, &katun, &tun, &uinal, &kin) != 5) {
cout << "invalid mayan date for second or third argument\n";
exit(1);
} else {
daysOne = convertToDays(baktun, katun, tun, uinal, kin);
}
if( sscanf(dateTwo, "%u.%u.%u.%u.%u", &baktun, &katun, &tun, &uinal, &kin) != 5) {
cout << "invalid mayan date for third argument\n";
exit(1);
} else {
daysTwo = convertToDays(baktun, katun, tun, uinal, kin);
}
int days = daysOne-daysTwo;
if (days >= 0) {
cout << "Day Difference: " << days << " ";
string result = convertToGregorian(days);
std::cout << "\nDate Conversion: " << result << "\n";
} else {
days = daysTwo - daysOne;
cout << "Day Difference: " << days << " ";
string result = convertToGregorian(days);
std::cout << "\nDate Conversion: " << result << "\n";
}
}
/*
* Adds a number of days to a gregoran date
* Returns the gregorian date with the # of days added
*/
void GregorianPlus(char* dateArg, char* daysArg) {
unsigned int days, month, day, year;
if (sscanf(dateArg, "%u/%u/%d", &month, &day, &year) != 3) {
cout << "invalid gregorian date entered.\n";
exit(1);
}
if (sscanf(daysArg, "%u", &days) != 1) {
cout << "invalid argument for days.\n";
exit(1);
}
unsigned int gregorianDays = convertToDays(month, day, year);
gregorianDays += days;
string result = convertToGregorian(gregorianDays);
std::cout << result << "\n";
}
/*
* Subtracts a number of days from a gregoran date
* Returns the gregorian date with the # of days subtracted
*/
void GregorianMinus(char* dateArg, char* daysArg) {
unsigned int days, month, day, year;
if (sscanf(dateArg, "%u/%u/%d", &month, &day, &year) != 3) {
cout << "invalid gregorian date entered.\n";
exit(1);
}
if (sscanf(daysArg, "%u", &days) != 1) {
cout << "invalid argument for days.\n";
exit(1);
}
unsigned int gregorianDays = convertToDays(month, day, year);
gregorianDays -= days;
string result = convertToGregorian(gregorianDays);
std::cout << result << "\n";
}
/**
* Compares two gregorian dates and
* Returns the number of days in between them in gregorian form.
*/
void GregorianCompare(char* dateOne, char* dateTwo) {
unsigned int month, day, year;
unsigned int daysOne = 0, daysTwo = 0;
if (sscanf(dateOne, "%u/%u/%d", &month, &day, &year) != 3) {
cout << "invalid gregorian date for second or third argument.\n";
exit(1);
} else {
daysOne = convertToDays(month, day, year);
}
if (sscanf(dateTwo, "%u/%u/%d", &month, &day, &year) != 3) {
cout << "invalid gregorian date for third argument.\n";
exit(1);
} else {
daysTwo = convertToDays(month, day, year);
}
int days = daysOne-daysTwo;
if (days >= 0) {
cout << "Day Difference: " << days << " ";
string result = convertToGregorian(days);
std::cout << "\nDate Conversion: " << result << "\n";
} else {
days = daysTwo - daysOne;
cout << "Day Difference: " << days << " ";
string result = convertToGregorian(days);
std::cout << "\nDate Conversion: " << result << "\n";
}
}
/**
* Used for testing multiple test cases for gregorian input.
*/
void testFunction(unsigned int month, unsigned int day, int year) {
unsigned int days = convertToDays(month, day, year);
string result = convertToMayan(days);
std::cout << result << "\n";
}
/**
* Used for testing multiple test cases for mayan input.
*/
void testFunction(unsigned int baktun, unsigned int katun, unsigned int tun, unsigned int uinal, unsigned int kin) {
unsigned int days = convertToDays(baktun, katun, tun, uinal, kin);
string result = convertToGregorian(days);
std::cout << result << "\n";
}
/**
* Takes a gregorian date, outputs a mayan date
*/
void GregorianConvert(char* gDate) {
unsigned int month, day;
int year;
if (sscanf(gDate, "%u/%u/%d", &month, &day, &year) != 3)
cout << "invalid gregorian date entered.\n";
else
testFunction(month, day, year);
}
/**
* Takes a mayan date, outputs a gregorian date
*/
void MayanConvert(char* mDate) {
unsigned int baktun, katun, tun, uinal, kin;
if (sscanf(mDate, "%u.%u.%u.%u.%u", &baktun, &katun, &tun, &uinal, &kin) != 5)
cout << "invalid mayan date entered.\n";
else
testFunction(baktun, katun, tun, uinal, kin);
}
/*******************************************************************************
*
*
*
* Start Function
*
*
*
*******************************************************************************/
/*
* main function that checks the arguments and calls the corresponding main function
*/
int main(int argc, char** argv) {
if (argv[1] == NULL) {
cout << "no arguments entered.\n";
exit(1);
}
if (strcmp(argv[1],"m+d") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
MayanPlus(argv[2], argv[3]);
} else if (strcmp(argv[1],"m-d") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
MayanMinus(argv[2], argv[3]);
} else if (strcmp(argv[1],"m-m") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
MayanCompare(argv[2], argv[3]);
} else if (strcmp(argv[1],"g+d") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
GregorianPlus(argv[2], argv[3]);
} else if (strcmp(argv[1],"g-d") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
GregorianMinus(argv[2], argv[3]);
} else if (strcmp(argv[1],"g-g") == 0) {
if (argv[2] == NULL || argv[3] == NULL) {
cout << "second or third argument is null\n";
exit(1);
}
GregorianCompare(argv[2], argv[3]);
} else if (strcmp(argv[1],"g=") == 0) {
if (argv[2] == NULL) {
cout << "second argument is null\n";
exit(1);
}
GregorianConvert(argv[2]);
} else if (strcmp(argv[1],"m=") == 0) {
if (argv[2] == NULL) {
cout << "second argument is null\n";
exit(1);
}
MayanConvert(argv[2]);
} else {
cout << "invalid 1st argument.\n";
}
return 0;
}
| [
"JonAlvarez22@gmail.com"
] | JonAlvarez22@gmail.com |
ff6b21d2996e9d884c2152c78b14e2ef0d5530f4 | 63a381d90124527f8dd7d833f3da70b3160f1869 | /src/Underworld/Conv/CodeVM.hpp | 8e4ce818bd5c0b9a9ba7b145e8716ea42febadda | [] | no_license | zengnotes/MultiplayerOnlineGame | f75fe82c1ce53c631466c209db7c397ecbff27e2 | 31561dedb03d77d69dff0ea2853aa666ec4c7751 | refs/heads/master | 2021-01-20T06:32:50.570693 | 2014-11-11T20:02:43 | 2014-11-11T20:02:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,296 | hpp | //
// Underworld - an Ultima Underworld remake project
// Copyright (C) 2002-2014 Michael Fink
//
/// \file Underworld/Conv/CodeVM.hpp Conversation code virtual machine
//
#pragma once
// includes
#include <string>
#include <vector>
#include "Savegame.hpp"
#include "ConvStack.hpp"
#include "ConvGlobals.hpp"
/// for more info about the underworld conversation assembler script, look in
/// the file docs/uw-formats.txt
/// a gnu-gdb style debugger named "cnvdbg" and a disassembler and experimental
/// decompiler (produces C-like code) is available in the "tools" folder.
// forward references
namespace Underworld
{
class ConvGlobals;
}
namespace Conv
{
// enums
/// function types
enum T_enDataType
{
dataTypeUnknown, ///< unknown data type
dataTypeVoid, ///< void data type
dataTypeInt, ///< integer data type
dataTypeString, ///< string data type
};
// structs
/// imported item info
typedef struct
{
/// type of the function/global memory location
T_enDataType m_enDataType;
/// name of imported item
std::string m_strName;
} ImportedItem;
// classes
class CodeCallback
{
public:
/// ctor
CodeCallback() throw() {}
/// prints "say" string
virtual void Say(Uint16 index) = 0;
/// shows menu, with possible answers
virtual Uint16 BablMenu(const std::vector<Uint16>& uiAnswerStringIds) = 0;
/// executes external function
virtual Uint16 ExternalFunc(const char* pszFuncName, ConvStack& stack) = 0;
};
/// \brief Conversation code virtual machine
/// \details Virtual machine to run conversation code loaded from cnv.ark files.
/// It emulates a forth-like stack-based opcode language with intrinsic functions
/// (called imported functions). The code segment contains 16-bit opcodes that
/// are executed one by one using the step() method. It returns false when the
/// execution is stopped due to an error or when conversation has finished.
/// The class uses the CodeCallback to let the user respond to
/// higher-level actions in the virtual machine.
///
/// The conversation code first has to be loaded using
/// Import::ConvLoader, then Init() can be called. When exiting,
/// Done() should be called to write back conversation globals for the given
/// conversation.
class CodeVM
{
public:
/// ctor
CodeVM();
/// dtor
virtual ~CodeVM() {}
/// inits virtual machine after filling code segment
void Init(CodeCallback* pCodeCallback, const Underworld::ConvGlobals& cg);
/// does a step in code; returns false when program has stopped
bool Step();
/// writes back conv globals
void Done(Underworld::ConvGlobals& cg);
/// replaces all @ placeholder in the given string
void ReplacePlaceholder(std::string& str);
// get functions
/// returns code segment
std::vector<Uint16>& CodeSegment(){ return m_code; }
/// returns map with imported functions
std::map<Uint16, ImportedItem>& ImportedFuncs(){ return m_mapImportedFuncs; }
/// returns map with imported globals
std::map<Uint16, ImportedItem>& ImportedGlobals(){ return m_mapImportedGlobals; }
/// returns string block to use for this conversation
Uint16 StringBlock() const { return m_uiStringBlock; }
/// returns number of reserved global variables
Uint16 GlobalsReserved() const { return m_uiGlobalsReserved; }
/// returns local string value
virtual std::string GetLocalString(Uint16 uiStrNum);
// set functions
/// sets result register
void SetResultRegister(Uint16 val);
/// sets conversation slot
void ConvSlot(Uint16 uiConvSlot){ m_uiConvSlot = uiConvSlot; }
/// sets string block to use
void StringBlock(Uint16 uiStringBlock){ m_uiStringBlock = uiStringBlock; }
/// sets number of globals reserved at start of memory
void GlobalsReserved(Uint16 uiGlobalsReserved){ m_uiGlobalsReserved = uiGlobalsReserved; }
protected:
/// called when saying a string
void SayOp(Uint16 uiStringId);
/// executes an imported function
virtual void ImportedFunc(const char* pszFuncName);
/// queries for a global variable value
virtual Uint16 GetGlobal(const char* pszGlobName);
/// sers global variable value
virtual void SetGlobal(const char* pszGlobName, Uint16 val);
/// called when storing a value to the stack
void StoreValue(Uint16 at, Uint16 val);
/// called when fetching a value from stack
void FetchValue(Uint16 at);
protected:
/// conversation slot number
Uint16 m_uiConvSlot;
/// number of string block to use
Uint16 m_uiStringBlock;
/// code bytes
std::vector<Uint16> m_code;
/// instruction pointer
Uint16 m_uiInstrPtr;
/// base (frame) pointer
Uint16 m_uiBasePtr;
/// stack
ConvStack m_stack;
/// number of values for globals reserved on stack
Uint16 m_uiGlobalsReserved;
/// tracks call/ret level
unsigned int m_uiCallLevel;
/// result register for (imported) functions
Uint16 m_uiResultRegister;
/// indicates if conversation has finished
bool m_bFinished;
/// all imported functions
std::map<Uint16, ImportedItem> m_mapImportedFuncs;
/// names of all imported globals
std::map<Uint16, ImportedItem> m_mapImportedGlobals;
/// code callback pointer
CodeCallback* m_pCodeCallback;
};
} // namespace Conv
| [
"michael.fink@asamnet.de"
] | michael.fink@asamnet.de |
8ac116a343ac0d9eff0bda6224c2ddd18fb97946 | 5013750dde6990bf5d384cfd806b0d411f04d675 | /leetcode/c++/941. Valid Mountain Array.cpp | c038656a4c6344bd5d0c2c63353edb62fe24a6f9 | [] | no_license | 543877815/algorithm | 2c403319f83630772ac94e67b35a27e71227d2db | 612b2e43fc6e1a2a746401288e1b89689e908926 | refs/heads/master | 2022-10-11T10:31:17.049279 | 2022-09-25T15:11:46 | 2022-09-25T15:11:46 | 188,680,726 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | cpp | // 线性扫描
// 时间复杂度:O(n)
// 空间复杂度:O(1)
class Solution {
public:
bool validMountainArray(vector<int> &A) {
if (A.size() <= 2) return false;
int up = -1;
for (int i = 0; i < A.size() - 1; i++) {
if (A[i] == A[i + 1]) return false;
if (up == -1) {
if (A[i] > A[i + 1]) up = i;
} else {
if (A[i] < A[i + 1]) return false;
}
}
return up > 0;
}
}; | [
"543877815@qq.com"
] | 543877815@qq.com |
28c0b5cf4e30a19d80ebbd7a2353070951a558a5 | e4b596b8a84c8b486b6b9f9e7651d6975acee195 | /test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.pointer.pass.cpp | def76084835b0be32d6f34cf51b570cbe69af5e7 | [
"NCSA",
"LLVM-exception",
"MIT",
"Apache-2.0"
] | permissive | apple/swift-libcxx | d82de71cb3995135915dd98fc1c6b8727070a692 | 67f490a99c007a333b6395f7499808c1279e5d32 | refs/heads/stable | 2023-03-16T10:52:36.522814 | 2019-10-25T22:47:30 | 2019-10-25T22:47:30 | 159,257,562 | 23 | 20 | Apache-2.0 | 2019-10-25T22:47:31 | 2018-11-27T01:32:35 | C++ | UTF-8 | C++ | false | false | 2,811 | cpp | //===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <numeric>
// template <class _Tp>
// _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept
//
#include <numeric>
#include <cassert>
#include "test_macros.h"
template <typename T>
constexpr void constexpr_test()
{
constexpr T array[1000] = {};
ASSERT_SAME_TYPE(decltype(std::midpoint(array, array)), const T*);
ASSERT_NOEXCEPT( std::midpoint(array, array));
static_assert(std::midpoint(array, array) == array, "");
static_assert(std::midpoint(array, array + 1000) == array + 500, "");
static_assert(std::midpoint(array, array + 9) == array + 4, "");
static_assert(std::midpoint(array, array + 10) == array + 5, "");
static_assert(std::midpoint(array, array + 11) == array + 5, "");
static_assert(std::midpoint(array + 9, array) == array + 5, "");
static_assert(std::midpoint(array + 10, array) == array + 5, "");
static_assert(std::midpoint(array + 11, array) == array + 6, "");
}
template <typename T>
void runtime_test()
{
T array[1000] = {}; // we need an array to make valid pointers
ASSERT_SAME_TYPE(decltype(std::midpoint(array, array)), T*);
ASSERT_NOEXCEPT( std::midpoint(array, array));
assert(std::midpoint(array, array) == array);
assert(std::midpoint(array, array + 1000) == array + 500);
assert(std::midpoint(array, array + 9) == array + 4);
assert(std::midpoint(array, array + 10) == array + 5);
assert(std::midpoint(array, array + 11) == array + 5);
assert(std::midpoint(array + 9, array) == array + 5);
assert(std::midpoint(array + 10, array) == array + 5);
assert(std::midpoint(array + 11, array) == array + 6);
}
template <typename T>
void pointer_test()
{
runtime_test< T>();
runtime_test<const T>();
runtime_test< volatile T>();
runtime_test<const volatile T>();
// The constexpr tests are always const, but we can test them anyway.
constexpr_test< T>();
constexpr_test<const T>();
// GCC 9.0.1 (unreleased as of 2019-03) barfs on this, but we have a bot for it.
// Uncomment when gcc 9.1 is released
#ifndef TEST_COMPILER_GCC
constexpr_test< volatile T>();
constexpr_test<const volatile T>();
#endif
}
int main(int, char**)
{
pointer_test<char>();
pointer_test<int>();
pointer_test<double>();
return 0;
}
| [
"mclow.lists@gmail.com"
] | mclow.lists@gmail.com |
d5c8f516c92ef8f9868ed377e9d40ee2b450db74 | 1af49694004c6fbc31deada5618dae37255ce978 | /cc/trees/ukm_manager.cc | b3761e46d3d4a81e7f1d25f83828fe42f0342513 | [
"BSD-3-Clause"
] | permissive | sadrulhc/chromium | 59682b173a00269ed036eee5ebfa317ba3a770cc | a4b950c23db47a0fdd63549cccf9ac8acd8e2c41 | refs/heads/master | 2023-02-02T07:59:20.295144 | 2020-12-01T21:32:32 | 2020-12-01T21:32:32 | 317,678,056 | 3 | 0 | BSD-3-Clause | 2020-12-01T21:56:26 | 2020-12-01T21:56:25 | null | UTF-8 | C++ | false | false | 13,434 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/trees/ukm_manager.h"
#include <algorithm>
#include <utility>
#include "cc/metrics/compositor_frame_reporter.h"
#include "cc/metrics/throughput_ukm_reporter.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
namespace cc {
UkmManager::UkmManager(std::unique_ptr<ukm::UkmRecorder> recorder)
: recorder_(std::move(recorder)) {
DCHECK(recorder_);
}
UkmManager::~UkmManager() {
RecordCheckerboardUkm();
RecordRenderingUkm();
}
void UkmManager::SetSourceId(ukm::SourceId source_id) {
// If we accumulated any metrics, record them before resetting the source.
RecordCheckerboardUkm();
RecordRenderingUkm();
source_id_ = source_id;
}
void UkmManager::SetUserInteractionInProgress(bool in_progress) {
if (user_interaction_in_progress_ == in_progress)
return;
user_interaction_in_progress_ = in_progress;
if (!user_interaction_in_progress_)
RecordCheckerboardUkm();
}
void UkmManager::AddCheckerboardStatsForFrame(int64_t checkerboard_area,
int64_t num_missing_tiles,
int64_t total_visible_area) {
DCHECK_GE(total_visible_area, checkerboard_area);
if (source_id_ == ukm::kInvalidSourceId || !user_interaction_in_progress_)
return;
checkerboarded_content_area_ += checkerboard_area;
num_missing_tiles_ += num_missing_tiles;
total_visible_area_ += total_visible_area;
num_of_frames_++;
}
void UkmManager::AddCheckerboardedImages(int num_of_checkerboarded_images) {
if (user_interaction_in_progress_) {
num_of_images_checkerboarded_during_interaction_ +=
num_of_checkerboarded_images;
}
total_num_of_checkerboarded_images_ += num_of_checkerboarded_images;
}
void UkmManager::RecordCheckerboardUkm() {
// Only make a recording if there was any visible area from PictureLayers,
// which can be checkerboarded.
if (num_of_frames_ > 0 && total_visible_area_ > 0) {
DCHECK_NE(source_id_, ukm::kInvalidSourceId);
ukm::builders::Compositor_UserInteraction(source_id_)
.SetCheckerboardedContentArea(checkerboarded_content_area_ /
num_of_frames_)
.SetNumMissingTiles(num_missing_tiles_ / num_of_frames_)
.SetCheckerboardedContentAreaRatio(
(checkerboarded_content_area_ * 100) / total_visible_area_)
.SetCheckerboardedImagesCount(
num_of_images_checkerboarded_during_interaction_)
.Record(recorder_.get());
}
checkerboarded_content_area_ = 0;
num_missing_tiles_ = 0;
num_of_frames_ = 0;
total_visible_area_ = 0;
num_of_images_checkerboarded_during_interaction_ = 0;
}
void UkmManager::RecordRenderingUkm() {
if (source_id_ == ukm::kInvalidSourceId)
return;
ukm::builders::Compositor_Rendering(source_id_)
.SetCheckerboardedImagesCount(total_num_of_checkerboarded_images_)
.Record(recorder_.get());
total_num_of_checkerboarded_images_ = 0;
}
void UkmManager::RecordThroughputUKM(
FrameSequenceTrackerType tracker_type,
FrameSequenceMetrics::ThreadType thread_type,
int64_t throughput) const {
ukm::builders::Graphics_Smoothness_PercentDroppedFrames builder(source_id_);
switch (thread_type) {
case FrameSequenceMetrics::ThreadType::kMain: {
switch (tracker_type) {
#define CASE_FOR_MAIN_THREAD_TRACKER(name) \
case FrameSequenceTrackerType::k##name: \
builder.SetMainThread_##name(throughput); \
break;
CASE_FOR_MAIN_THREAD_TRACKER(CompositorAnimation);
CASE_FOR_MAIN_THREAD_TRACKER(MainThreadAnimation);
CASE_FOR_MAIN_THREAD_TRACKER(PinchZoom);
CASE_FOR_MAIN_THREAD_TRACKER(RAF);
CASE_FOR_MAIN_THREAD_TRACKER(ScrollbarScroll);
CASE_FOR_MAIN_THREAD_TRACKER(TouchScroll);
CASE_FOR_MAIN_THREAD_TRACKER(Video);
CASE_FOR_MAIN_THREAD_TRACKER(WheelScroll);
CASE_FOR_MAIN_THREAD_TRACKER(CanvasAnimation);
CASE_FOR_MAIN_THREAD_TRACKER(JSAnimation);
#undef CASE_FOR_MAIN_THREAD_TRACKER
default:
NOTREACHED();
break;
}
break;
}
case FrameSequenceMetrics::ThreadType::kCompositor: {
switch (tracker_type) {
#define CASE_FOR_COMPOSITOR_THREAD_TRACKER(name) \
case FrameSequenceTrackerType::k##name: \
builder.SetCompositorThread_##name(throughput); \
break;
CASE_FOR_COMPOSITOR_THREAD_TRACKER(CompositorAnimation);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(MainThreadAnimation);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(PinchZoom);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(RAF);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(ScrollbarScroll);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(TouchScroll);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(Video);
CASE_FOR_COMPOSITOR_THREAD_TRACKER(WheelScroll);
#undef CASE_FOR_COMPOSITOR_THREAD_TRACKER
default:
NOTREACHED();
break;
}
break;
}
case FrameSequenceMetrics::ThreadType::kUnknown:
NOTREACHED();
break;
}
builder.Record(recorder_.get());
}
void UkmManager::RecordAggregateThroughput(AggregationType aggregation_type,
int64_t throughput_percent) const {
ukm::builders::Graphics_Smoothness_PercentDroppedFrames builder(source_id_);
switch (aggregation_type) {
case AggregationType::kAllAnimations:
builder.SetAllAnimations(throughput_percent);
break;
case AggregationType::kAllInteractions:
builder.SetAllInteractions(throughput_percent);
break;
case AggregationType::kAllSequences:
builder.SetAllSequences(throughput_percent);
break;
}
builder.Record(recorder_.get());
}
void UkmManager::RecordCompositorLatencyUKM(
CompositorFrameReporter::FrameReportType report_type,
const std::vector<CompositorFrameReporter::StageData>& stage_history,
const CompositorFrameReporter::ActiveTrackers& active_trackers,
const viz::FrameTimingDetails& viz_breakdown) const {
using StageType = CompositorFrameReporter::StageType;
ukm::builders::Graphics_Smoothness_Latency builder(source_id_);
if (report_type == CompositorFrameReporter::FrameReportType::kDroppedFrame) {
builder.SetMissedFrame(true);
}
// Record each stage
for (const CompositorFrameReporter::StageData& stage : stage_history) {
switch (stage.stage_type) {
#define CASE_FOR_STAGE(name) \
case StageType::k##name: \
builder.Set##name((stage.end_time - stage.start_time).InMicroseconds()); \
break;
CASE_FOR_STAGE(BeginImplFrameToSendBeginMainFrame);
CASE_FOR_STAGE(SendBeginMainFrameToCommit);
CASE_FOR_STAGE(Commit);
CASE_FOR_STAGE(EndCommitToActivation);
CASE_FOR_STAGE(Activation);
CASE_FOR_STAGE(EndActivateToSubmitCompositorFrame);
CASE_FOR_STAGE(TotalLatency);
#undef CASE_FOR_STAGE
// Break out kSubmitCompositorFrameToPresentationCompositorFrame to report
// the viz breakdown.
case StageType::kSubmitCompositorFrameToPresentationCompositorFrame:
builder.SetSubmitCompositorFrameToPresentationCompositorFrame(
(stage.end_time - stage.start_time).InMicroseconds());
if (viz_breakdown.received_compositor_frame_timestamp.is_null())
break;
builder
.SetSubmitCompositorFrameToPresentationCompositorFrame_SubmitToReceiveCompositorFrame(
(viz_breakdown.received_compositor_frame_timestamp -
stage.start_time)
.InMicroseconds());
if (viz_breakdown.draw_start_timestamp.is_null())
break;
builder
.SetSubmitCompositorFrameToPresentationCompositorFrame_ReceivedCompositorFrameToStartDraw(
(viz_breakdown.draw_start_timestamp -
viz_breakdown.received_compositor_frame_timestamp)
.InMicroseconds());
if (viz_breakdown.swap_timings.is_null())
break;
builder
.SetSubmitCompositorFrameToPresentationCompositorFrame_StartDrawToSwapStart(
(viz_breakdown.swap_timings.swap_start -
viz_breakdown.draw_start_timestamp)
.InMicroseconds());
builder
.SetSubmitCompositorFrameToPresentationCompositorFrame_SwapStartToSwapEnd(
(viz_breakdown.swap_timings.swap_end -
viz_breakdown.swap_timings.swap_start)
.InMicroseconds());
builder
.SetSubmitCompositorFrameToPresentationCompositorFrame_SwapEndToPresentationCompositorFrame(
(viz_breakdown.presentation_feedback.timestamp -
viz_breakdown.swap_timings.swap_end)
.InMicroseconds());
break;
default:
NOTREACHED();
break;
}
}
// Record the active trackers
for (size_t type = 0; type < active_trackers.size(); ++type) {
if (!active_trackers.test(type))
continue;
const auto frame_sequence_tracker_type =
static_cast<FrameSequenceTrackerType>(type);
switch (frame_sequence_tracker_type) {
#define CASE_FOR_TRACKER(name) \
case FrameSequenceTrackerType::k##name: \
builder.Set##name(true); \
break;
CASE_FOR_TRACKER(CompositorAnimation);
CASE_FOR_TRACKER(MainThreadAnimation);
CASE_FOR_TRACKER(PinchZoom);
CASE_FOR_TRACKER(RAF);
CASE_FOR_TRACKER(ScrollbarScroll);
CASE_FOR_TRACKER(TouchScroll);
CASE_FOR_TRACKER(Video);
CASE_FOR_TRACKER(WheelScroll);
CASE_FOR_TRACKER(CanvasAnimation);
CASE_FOR_TRACKER(JSAnimation);
#undef CASE_FOR_TRACKER
default:
NOTREACHED();
break;
}
}
builder.Record(recorder_.get());
}
void UkmManager::RecordEventLatencyUKM(
const EventMetrics::List& events_metrics,
const std::vector<CompositorFrameReporter::StageData>& stage_history,
const viz::FrameTimingDetails& viz_breakdown) const {
using StageType = CompositorFrameReporter::StageType;
for (const auto& event_metrics : events_metrics) {
ukm::builders::Graphics_Smoothness_EventLatency builder(source_id_);
builder.SetEventType(static_cast<int64_t>(event_metrics->type()));
if (event_metrics->scroll_type()) {
builder.SetScrollInputType(
static_cast<int64_t>(*event_metrics->scroll_type()));
if (!viz_breakdown.swap_timings.is_null()) {
builder.SetTotalLatencyToSwapBegin(
(viz_breakdown.swap_timings.swap_start -
event_metrics->time_stamp())
.InMicroseconds());
}
}
// It is possible for an event to arrive in the compositor in the middle of
// a frame (e.g. the browser received the event *after* renderer received a
// begin-impl, and the event reached the compositor before that frame
// ended). To handle such cases, find the first stage that happens after the
// event's arrival in the browser.
auto stage_it = std::find_if(
stage_history.begin(), stage_history.end(),
[&event_metrics](const CompositorFrameReporter::StageData& stage) {
return stage.start_time > event_metrics->time_stamp();
});
// TODO(crbug.com/1079116): Ideally, at least the start time of
// SubmitCompositorFrameToPresentationCompositorFrame stage should be
// greater than the event time stamp, but apparently, this is not always the
// case (see crbug.com/1093698). For now, skip to the next event in such
// cases. Hopefully, the work to reduce discrepancies between the new
// EventLatency and the old Event.Latency metrics would fix this issue. If
// not, we need to reconsider investigating this issue.
if (stage_it == stage_history.end())
continue;
builder.SetBrowserToRendererCompositor(
(stage_it->start_time - event_metrics->time_stamp()).InMicroseconds());
for (; stage_it != stage_history.end(); ++stage_it) {
// Total latency is calculated since the event timestamp.
const base::TimeTicks start_time =
stage_it->stage_type == StageType::kTotalLatency
? event_metrics->time_stamp()
: stage_it->start_time;
switch (stage_it->stage_type) {
#define CASE_FOR_STAGE(name) \
case StageType::k##name: \
builder.Set##name((stage_it->end_time - start_time).InMicroseconds()); \
break;
CASE_FOR_STAGE(BeginImplFrameToSendBeginMainFrame);
CASE_FOR_STAGE(SendBeginMainFrameToCommit);
CASE_FOR_STAGE(Commit);
CASE_FOR_STAGE(EndCommitToActivation);
CASE_FOR_STAGE(Activation);
CASE_FOR_STAGE(EndActivateToSubmitCompositorFrame);
CASE_FOR_STAGE(SubmitCompositorFrameToPresentationCompositorFrame);
CASE_FOR_STAGE(TotalLatency);
#undef CASE_FOR_STAGE
default:
NOTREACHED();
break;
}
}
builder.Record(recorder_.get());
}
}
} // namespace cc
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
caa7369cef122e29e93ca6dcdd9419d8e597a464 | 8e9e2ef1eec0393bca595ce7c703006b52b566bc | /CENG315/THE2/test.cpp | 99756e8437aa86ebec0b1091111dcc70073afcd4 | [] | no_license | aralyekta/METU | 964c45b08a7d9b3a12cff18280f211b38991f0f1 | 3643841facd8e90d3525ecafa3d94751852e7f25 | refs/heads/master | 2023-04-06T04:00:39.595100 | 2023-03-22T13:25:15 | 2023-03-22T13:25:15 | 289,202,348 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,964 | cpp | //This file is entirely for your test purposes.
//This will not be evaluated, you can change it and experiment with it as you want.
#include <iostream>
#include <fstream>
#include <random>
#include <ctime>
#include <algorithm> // DELET THIS
#include "the2.h"
//the2.h only contains declaration of the function quickSort and quickSort3 which are:
//void quickSort(unsigned short* arr, long &swap, double & avg_dist, double & max_dist, bool hoare, int size);
//void quickSort3(unsigned short *arr, long &swap, long &comparison, int size);
using namespace std;
void randomFill(unsigned short*& arr, unsigned short*& arr2, int size, unsigned short minval, unsigned short interval)
{
arr = new unsigned short [size];
arr2 = new unsigned short [size];
for (int i=0; i <size; i++)
{
unsigned short curNum = minval + (random() % interval);
arr[i] = curNum;
arr2[i] = curNum;
}
}
void print_to_file(unsigned short* arr, int size)
{
ofstream ofile;
ofile.open("sorted.txt");
ofile<<size<<endl;
for(int i=0;i<size; i++)
ofile<<arr[i]<<endl;
}
void read_from_file(unsigned short*& arr, int& size)
{
char addr[]= "in01.txt"; //You can test from in01.txt to in04.txt
ifstream infile (addr);
if (!infile.is_open())
{
cout << "File \'"<< addr
<< "\' can not be opened. Make sure that this file exists." <<endl;
return;
}
infile >> size;
arr = new unsigned short [size];
for (int i=0; i<size;i++) {
infile >> arr[i];
}
}
void test()
{
clock_t begin, end;
double duration;
char f_select='3'; // c tests for quicksort with classical partitioning, h for quicksort with hoare partitioning, 3 for 3-way quicksort
//data generation and initialization- you may test with your own data
long comparison=0;
long swap=0;
double avg_dist=0;
double max_dist=0;
bool hoare, q3;
bool rand_fill=true;
switch(f_select) {
case '3':
q3=true;
break;
case 'h':
q3=false;
hoare=true;
break;
case 'c':
q3=false;
hoare=false;
break;
default:
cout<<"Invalid argument for function selection."<<endl;
return;
}
int size= 1 << 21; // for maximum see the "boundaries for test cases" part
unsigned short minval=0;
unsigned short interval= (unsigned short)((1<<16)-1); // unsigned short 65535 in maximum , you can try to minimize interval for data generation to make your code test more equality conditions
unsigned short *arr;
unsigned short *arr2;
/*
BOUNDARIES FOR TEST CASES. THESE ARE THE MOST DIFFICULT INPUTS TO BE TESTED
***QUICKSORT WITH CLASSICAL PARTITIONING *** NOTE THAT IT PERFORMS BETTER WHEN THERE ARE LESS EQUALITY CONDITIONS IN OUR CASE LARGER INTERVAL FOR NUMBERS TO BE GENERATED
size <= 2^16 when interval == 2^16-1
size <= 2^20 when interval >= 2^13-1
size <= 2^19 when interval >= 2^11-1
size <= 2^18 when interval >= 2^9 -1
size <= 2^17 when interval >= 2^7 -1
size <= 2^16 when interval >= 2^5 -1
********************************
***QUICKSORT WITH HOARE PARTITIONING *** INTERVAL HAS NO EFFECT
size <= 2^22
********************************
***3-WAY QUICKSORT *** IT PERFORMS BETTER WHEN THERE ARE MORE EQUALITY CONDITIONS IN OUR CASE SMALLER INTERVAL FOR NUMBERS TO BE GENERATED
size <=2^25 when interval <= 2^2-1
size <=2^24 when interval <= 2^5-1
size <=2^23 when interval <= 2^10-1
size <=2^22 when interval <= 2^16-1
********************************
*/
if(rand_fill)
randomFill(arr, arr2, size, minval, interval); //Randomly generate initial array
else
read_from_file(arr, size); //Read the test inputs. in01.txt through in04.txt exists. Due to the limitation of the system larger inputs are not stored but generated on evaluation.
//data generation or read end
if ((begin = clock() ) ==-1)
cerr << "clock error" << endl;
//Function call for the solution
if(q3) {
std::cout << "Quicksort 3\n";
quickSort3(arr, swap, comparison, size);
}
else {
std::cout << "Quicksort with hoare:" << hoare << "\n";
quickSort(arr, swap, avg_dist, max_dist, hoare, size);
}
sort(arr2, arr2+size, greater<unsigned short>());
//Function end
if ((end = clock() ) ==-1)
cerr << "clock error" << endl;
//Calculate duration and print output
cout<<"Number of Swaps: " << swap <<endl;
duration = ((double) end - begin) / CLOCKS_PER_SEC;
cout << "Duration: " << duration << " seconds." <<endl;
if(q3)
cout<<"Number of Comparisons: " << comparison <<endl;
else
{
cout<<"Average Distance of Swaps(0 for quickSort3): " << avg_dist <<endl;
cout<<"Maximum Distance of Swaps(0 for quickSort3): " << max_dist <<endl;
}
bool wrong = false;
cout <<"Size of the array:"<< size << endl;
for (int i = 0; i < size; i++) {
if (arr[i] != arr2[i]) {
std::cout << "There was a mistake with index:" << i << "\n";
std::cout << "In first it is:" << arr[i] << " and on the other it is:" << arr2[i] << "\n";
wrong = true;
break;
}
}
cout << "\n";
if (!wrong) {
std::cout << "It was correct\n";
}
else {
std::cout << "It was wrong\n";
}
//print_to_file(arr,size);
delete [] arr;
delete [] arr2;
//Calculation and output end
}
int main()
{
srandom(time(0));
test();
// // Case:
// unsigned short arr[8] = {1,2,1,3,4,1,5,6};
// int size = 8;
// // unsigned short arr[] = {1,2,1,3,4,1,5};
// // int size = 7;
// // unsigned short arr[] = {2,4,3};
// // int size = 3;
// long swap = 0;
// long comparison = 0;
// double avg_dist = 0;
// double max_dist = 0;
// bool hoare = true;
// //quickSort(arr, swap, avg_dist, max_dist, hoare, size);
// quickSort3(arr, swap, comparison, size);
// for (int i = 0; i < size; i++) {
// cout << arr[i] << " ";
// }
// cout << "\n";
// //cout << "swap:" << swap << " avg_dist:" << avg_dist << " max_dist:" << max_dist << "\n";
// cout << "swap:" << swap << " comparison:" << comparison << "\n";
return 0;
}
| [
"aralyektayarimca@gmail.com"
] | aralyektayarimca@gmail.com |
3a6aac0bc1c3d3400370e52ba0c910d3a51d11dc | c9b02ab1612c8b436c1de94069b139137657899b | /server/app/data/DataTimeLimitProp.cpp | 8ac6fb9d7df041dee55ff503aceb4b228daaf2f3 | [] | no_license | colinblack/game_server | a7ee95ec4e1def0220ab71f5f4501c9a26ab61ab | a7724f93e0be5c43e323972da30e738e5fbef54f | refs/heads/master | 2020-03-21T19:25:02.879552 | 2020-03-01T08:57:07 | 2020-03-01T08:57:07 | 138,948,382 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,650 | cpp | /*
* DataTimeLimitProp.cpp
*
* Created on: 2016-11-29
* Author: dawx62fac
*/
#include "DataTimeLimitProp.h"
DBCTimeLimitProp::DBCTimeLimitProp(unsigned uid_, unsigned id_)
: uid(uid_), id(id_), op_time(0)
{
}
DBCTimeLimitProp::DBCTimeLimitProp()
: uid(0), id(0), op_time(0)
{
}
/////////////////////////////////////////////////////////////
int DBCTimeLimitPropHandler::Get(DBCTimeLimitProp &data)
{
warn_log("unrealized_interface");
return -1;
}
int DBCTimeLimitPropHandler::Get(vector<DBCTimeLimitProp> &data)
{
if (data.empty())
{
return R_ERROR;
}
unsigned uid = data.begin()->uid;
data.clear();
DBCREQ_DECLARE(DBC::GetRequest, uid);
DBCREQ_SET_KEY(uid);
DBCREQ_NEED_BEGIN();
DBCREQ_NEED(uid);
DBCREQ_NEED(id);
DBCREQ_NEED(op_time);
DBCREQ_EXEC;
DBCREQ_ARRAY_GET_BEGIN(data);
DBCREQ_ARRAY_GET_INT(data, uid);
DBCREQ_ARRAY_GET_INT(data, id);
DBCREQ_ARRAY_GET_INT(data, op_time);
DBCREQ_ARRAY_GET_END();
return 0;
}
int DBCTimeLimitPropHandler::Add(DBCTimeLimitProp &data)
{
DBCREQ_DECLARE(DBC::InsertRequest, data.uid);
DBCREQ_SET_KEY(data.uid);
DBCREQ_SET_INT(data, id);
DBCREQ_SET_INT(data, op_time);
DBCREQ_EXEC;
return 0;
}
int DBCTimeLimitPropHandler::Set(DBCTimeLimitProp &data)
{
DBCREQ_DECLARE(DBC::UpdateRequest, data.uid);
DBCREQ_SET_KEY(data.uid);
DBCREQ_SET_CONDITION(EQ, id, data.id);
DBCREQ_SET_INT(data, id);
DBCREQ_SET_INT(data, op_time);
DBCREQ_EXEC;
return 0;
}
int DBCTimeLimitPropHandler::Del(DBCTimeLimitProp &data)
{
DBCREQ_DECLARE(DBC::DeleteRequest, data.uid);
DBCREQ_SET_KEY(data.uid);
DBCREQ_SET_CONDITION(EQ, id, data.id);
DBCREQ_EXEC;
return 0;
}
| [
"178370407@qq.com"
] | 178370407@qq.com |
ad2b3ac322d712e65b9a386396bb7583b8e6f3ba | 22af93db463774bfa5810ccc26193d91354849b9 | /3rd/flash_sdk_src/core/graphics/fla_transToImage.cpp | 3cb3709d41c68cd9c10e84c3f8d5223f36052d92 | [] | no_license | adroitly/boom | f5ba38c1360e315cfc79a602ca787208f244b87c | 57bb7f29ba2da552e7d47ac5d2dd9691539ad78e | refs/heads/master | 2016-08-12T07:41:34.105425 | 2016-03-08T07:16:13 | 2016-03-08T07:16:13 | 53,380,550 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,307 | cpp | //=============================================================================
// FlashFire
//
// Copyright (C) 2015 PatGame. All rights reserved.
//
// Created by HJC
//
//=============================================================================
#include "fla_transToImage.h"
#include "../definition/fla_DefinitionUtils.h"
#include "../base/fla_ColorTransform.h"
#include "../base/fla_utils.h"
#include "../platform/fla_PlatformTraits.h"
#include "fla_RenderOfDefinition.h"
namespace fla
{
Image::Ptr Definition_transToImage(const Definition& definition, PixelFormat pixelFormat, float scale)
{
auto rt = adjustRectForRender(definition.getBounds(), scale);
PlatformTraits::BitmapGraphics bitmapGraphics(rt.width, rt.height, pixelFormat);
bitmapGraphics.flipAndScale(scale);
// 设置缩放比例,和位置调整
bitmapGraphics.translateCTM(-rt.x, -rt.y);
RenderOfDefinition<PlatformTraits::Graphics> renderVisitor(bitmapGraphics, ColorTransform::identity());
definition.accept(renderVisitor);
return bitmapGraphics.createImage();
}
void Definition_render(const Definition& definition, PlatformTraits::Graphics& graphics, const Size& size)
{
Rect rt = definition.getBounds();
auto scale = std::min(size.width / rt.width, size.height / rt.height);
Point offset;
offset.x = (size.width - rt.width * scale) * 0.5;
offset.y = (size.height - rt.height * scale) * 0.5;
graphics.clipToRect(Rect(offset.x, offset.y, rt.width * scale, rt.height * scale));
graphics.translateCTM(offset.x, offset.y);
graphics.scaleCTM(scale, scale);
// 设置缩放比例,和位置调整
graphics.translateCTM(-rt.x, -rt.y);
RenderOfDefinition<PlatformTraits::Graphics> renderVisitor(graphics, ColorTransform::identity());
definition.accept(renderVisitor);
}
Image::Ptr Definition_transToImage(const Definition& definition, PixelFormat pixelFormat, const Size& size)
{
PlatformTraits::BitmapGraphics bitmapGraphics(size.width, size.height, pixelFormat);
bitmapGraphics.flipAndScale(1.0);
Definition_render(definition, bitmapGraphics, size);
return bitmapGraphics.createImage();
}
}
| [
"adroitly@163.com"
] | adroitly@163.com |
e24d1a4195d1e40ea067c48d5f12ac478b4904dc | c8944016308a0049becaee8567a08328389ac9cd | /climbot5d/src/test/kine_test.cpp | cc8fa4d74bc37387156427fe17eb24a03f12ca4e | [] | no_license | Jiongyu/birl-module-robot-1.0 | 75cb4c66afcb3dec28daddef0c6dc6b32306e40a | d0be500d47bf8de3dab0101807a4ddc5695c28c9 | refs/heads/master | 2020-06-19T19:47:14.521984 | 2019-10-24T01:55:22 | 2019-10-24T01:55:22 | 196,848,066 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,586 | cpp | #include "./../kinematics/Kine.h"
#include "ros/ros.h"
#include "std_msgs/Int64MultiArray.h"
int main(int argc, char **argv)
{
void Current_joint_Rad_to_Deg(double (&joint_value)[5]);
double New_joint_value[5];//unit:degree
double Robot_Link_Len[6] = {0.1764,0.2568,0.2932,0.2932,0.2568,0.1764}; //robot link length
Kine_CR_FiveDoF_G1 Climbot_G1; // robot based on the gripper1 to get inverse solution
Kine_CR_FiveDoF_G2 Climbot_G2; // robot based on the gripper6 to get inverse solution
Climbot_G1.Set_Length(Robot_Link_Len);
Climbot_G2.Set_Length(Robot_Link_Len);
double Current_joint_value[5] = {0,0,0,0,0}; //unit:degree
double New_point[6]; //new cartesian point (xyzwpr(RxRyRz)) unit:(meter,degree)
///end
double Top_point[6];
Climbot_G1.FKine(Current_joint_value,Top_point);
for(int i = 0; i < 6; i++){
std::cout<<Top_point[i]<<std::endl;
}
std::cout<<"-------------------------------------"<<std::endl;
Climbot_G2.FKine(Current_joint_value,Top_point);
for(int i = 0; i < 6; i++){
std::cout<<Top_point[i]<<std::endl;
}
std::cout<<"-----------inversion position--------------------------"<<std::endl;
New_point[0] = 0.57;
New_point[1] = 0;
New_point[2] = 0;
New_point[3] = 0;
New_point[4] = 0;
New_point[5] = 180;
// Current_joint_Rad_to_Deg(Current_joint_value);
Climbot_G1.IKine(New_point,Current_joint_value,New_joint_value);
for(int i = 0; i < 5; i++){
std::cout<<New_joint_value[i]<<std::endl;
}
double current_top_velocity[6] = {-0.06,0,0,0,0,0}; // m/s,degree/s
double new_joint_velocity[5] = {0,0,0,0,0}; // degree/s
std::cout<<"velocity_inverse-----------------------------"<<std::endl;
Climbot_G1.Vel_IKine(New_joint_value,current_top_velocity,new_joint_velocity);
for(int i = 0; i < 5; i++){
std::cout<<new_joint_velocity[i]<<std::endl;
}
std::cout<<"velocity_positive-----------------------------"<<std::endl;
new_joint_velocity[0] = 0;
new_joint_velocity[1] = 8.32102;
new_joint_velocity[2] = -16.642;
new_joint_velocity[3] = 8.32102;
new_joint_velocity[4] = 0;
Climbot_G1.Vel_FKine(New_joint_value,new_joint_velocity,current_top_velocity);
for(int i = 0; i < 6; i++){
std::cout<<current_top_velocity[i]<<std::endl;
}
return 0;
}
void Current_joint_Rad_to_Deg(double (&joint_value)[5]){
joint_value[0]*=PI_DEG;
joint_value[1]*=PI_DEG;
joint_value[2]*=PI_DEG;
joint_value[3]*=PI_DEG;
joint_value[4]*=PI_DEG;
} | [
"35024339@qq.com"
] | 35024339@qq.com |
cf523c557bfa8886ed6a31dd931ea92f9e009b24 | f15413586e7aaa664fca4d8c9b5b855c2079ca5c | /A_Neopixel/A_Neopixel.ino | d3cea135707bd829b57b34408293974442143841 | [] | no_license | Mantve/Neopixel-Compilation | 26415bbf8024aaf57324b01f15071725cadc5906 | 7a73f3b15ac07a608a2974e7764e901fd6f1643e | refs/heads/master | 2022-11-15T08:21:18.715878 | 2020-07-15T22:17:35 | 2020-07-15T22:17:35 | 269,668,321 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 163 | ino | /*
* Don't forget to plug in the ground wire first!
*
* Compilation of Neopixel based animations
* Includes mode and color changing with hardware buttons
*/
| [
"mantvydasri99@gmail.com"
] | mantvydasri99@gmail.com |
aec852ff378105a0bcc8f6858cdb4a5e422db39b | ffb03571bad61884bc5b52732426c0c4af5a5192 | /test/test_stringcs/test_strcs_functional_abstracts__contains_cstr.hpp | 845476f1408a1e46c61dd3e98c677f9695afbec8 | [
"MIT"
] | permissive | skrzj-dev/libxccc | 62c1a85fde78921b3febb0bbb0dbafaecad00b5f | 621ce71dcc0ad8fb7a13460aeb3dc250188fb5d2 | refs/heads/master | 2021-01-05T10:07:13.137975 | 2020-11-12T23:42:18 | 2020-11-12T23:42:18 | 240,985,730 | 0 | 0 | MIT | 2020-11-12T22:41:48 | 2020-02-16T23:56:20 | C++ | UTF-8 | C++ | false | false | 18,560 | hpp | /*
* Copyright block:
*
* Source file of libxccc project
*
* Copyright (c) 2019 Jakub Skrzyniarz, skrzj-dev@protonmail.com
*
* Licensed under: MIT license; See the file "LICENSE" of libxccc project for more information.
*
* Copyright block: end
*/
#ifndef _TEST_STRINGCS_ABSTRACTS_CONTAINS_HPP_
#define _TEST_STRINGCS_ABSTRACTS_CONTAINS_HPP_
/* --- */
#include "xcc/test/xcc_test2.hpp"
#include "xcc/test/xcc_test2_paramrow.hpp"
#include "xcc/common/xcc_cpp.hpp"
/* --- */
#include "test_strcs_functional_abstracts__shared.hpp"
/* --- */
template<typename TPL_STROBJ>
class subtest_containsCstr_tplt: public test_xcStringS_testStaticStr_sub_I<TPL_STROBJ>
{
protected: test_xcStringS_testStaticStr_intfs_tpl<TPL_STROBJ>* intfs;
protected: virtual int testedOp_cstr(test_xcStringS_I_abstract<TPL_STROBJ>* intf, TPL_STROBJ* ref_self, const char* param1)=0;
typedef xcc_test3_DATAROW5_DECLT(
xcc_test2_failureDetails_t*
, test_xcStringS_I_abstract<TPL_STROBJ>*
, testParamValued01<TPL_STROBJ>
, const char*
, int
) test_contains_cstr_paramsError_expectRetv_paramRow_t;
protected: int test_contains_cstr_paramsError_expectRetv(
xcc_test2_failureDetails_t* failInfo
, test_xcStringS_I_abstract<TPL_STROBJ>* strIntf
, testParamValued01<TPL_STROBJ> target1
, const char* cstr_param1
, int resultval
)
{
xcc_test2_scope_disconnected();
do
{
xcc_test2_case("checking internal state");
if(1)
{
test_xcStringS_state<TPL_STROBJ> self_state;
test_xcStringS_state<TPL_STROBJ>* ptr_self_state=&self_state;
xcc_test2_expect( 0 == target1.intf->prepareState2(*failInfo, ptr_self_state, target1.value) );
xcc_test2_expect( resultval == testedOp_cstr(strIntf, ptr_self_state->refp_obj_operational, cstr_param1) );
xcc_test2_expect( 0 == target1.intf->verifyState(*failInfo, ptr_self_state, target1.value.c_str()) );
xcc_test2_expect( 0 == target1.intf->deinit(*failInfo, ptr_self_state) );
}
xcc_test2_case_end();
} while(0);
xcc_test2_scope_end();
}
typedef xcc_test3_DATAROW4_DECLT(
xcc_test2_failureDetails_t*
, test_xcStringS_I_abstract<TPL_STROBJ>*
, testParamValued01<TPL_STROBJ>
, int
) test_contains_cstr_againstItself_expectRetv_paramRow_t;
private: int test_contains_cstr_againstItself_expectRetv(
xcc_test2_failureDetails_t* failInfo
, test_xcStringS_I_abstract<TPL_STROBJ>* strIntf
, testParamValued01<TPL_STROBJ> self
, int resultval
)
{
xcc_test2_scope_disconnected();
do
{
xcc_test2_case("checking internal state");
if(1)
{
test_xcStringS_state<TPL_STROBJ> self_state;
test_xcStringS_state<TPL_STROBJ>* ptr_self_state=&self_state;
xcc_test2_expect( 0 == self.intf->prepareState2(*failInfo, ptr_self_state, self.value) );
xcc_test2_expect( resultval == testedOp_cstr(
strIntf
, ptr_self_state->refp_obj_operational
, strIntf->cstr( ptr_self_state->refp_obj_operational)
)
);
xcc_test2_expect( 0 == self.intf->verifyState(*failInfo, ptr_self_state, self.value.c_str() ) );
xcc_test2_expect( 0 == self.intf->deinit(*failInfo, ptr_self_state) );
}
xcc_test2_case_end();
} while(0);
xcc_test2_scope_end();
}
public: subtest_containsCstr_tplt(
test_xcStringS_testStaticStr_intfs_tpl<TPL_STROBJ>* ref_intfs
)
{
this->intfs=ref_intfs;
}
public: int test_contains_strc_ANYCASE(xcc_test2_param_list)
{
xcc_test2_scope("[CSTRD]-[contains-cstr-anycase]");
test_xcStringS_param_I_Set_tplt<TPL_STROBJ>* ref_set=this->intfs->INTF_SET;
xcc_test2_failureDetails_t* refp_failReport=xcc_test2_case_referp_customFailInfo();
/* errors: */
if(1)
{
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsNull->value(), NULL, 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsNull->value(), "", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsNull->value(), "abcd123", 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.01,null self]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitZero->value(), NULL, 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitZero->value(), "", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitZero->value(), "abcd123", 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.02,uninit-zero-self]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitNonZero->value(), NULL, 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitNonZero->value(), "", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitNonZero->value(), "abcd123", 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.03,uninit-non-zero-self]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitEmpty->value(), NULL, 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.04,init-empty.self]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("qwerty386"), NULL, 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.05,init-non-empty.self]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
}
/* errors: done */
/* itself x itself: */
if(1)
{
if(1)
{
test_contains_cstr_againstItself_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW4_ITZ_T(test_contains_cstr_againstItself_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitZero->value(), 0
)
, xcc_test3_DATAROW4_ITZ_T(test_contains_cstr_againstItself_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsUninitNonZero->value(), 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow4(
"contains-cstr-[err-param.01,self-against-self]"
, "TODO"
, test_contains_cstr_againstItself_expectRetv_paramRow_t
, test_contains_cstr_againstItself_expectRetv
, rows
);
}
if(1)
{
test_contains_cstr_againstItself_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW4_ITZ_T(test_contains_cstr_againstItself_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitEmpty->value(), 0
)
, xcc_test3_DATAROW4_ITZ_T(test_contains_cstr_againstItself_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("qwerty123"), 1
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow4(
"contains-cstr-[ok-param.01,self-against-self]"
, "TODO"
, test_contains_cstr_againstItself_expectRetv_paramRow_t
, test_contains_cstr_againstItself_expectRetv
, rows
);
}
}
/* itself x itself: done */
/* ok params: */
if(1)
{
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitEmpty->value(), "", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("qwerty386"), "qwerty386", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("xxx.qwerty386"), "qwerty386", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("zxcvby386"), "qwerty386", 0
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[ok-param.01,exact-match]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
}
/* ok params: done */
xcc_test2_scope_end();
}
public: int test_contains_cstr_okParamsMatchCaseInsensitive(xcc_test2_param_list)
{
xcc_test2_scope("[CSTRD]-[contains-cstr-matchCaseInsensitive]");
test_xcStringS_param_I_Set_tplt<TPL_STROBJ>* ref_set=this->intfs->INTF_SET;
xcc_test2_failureDetails_t* refp_failReport=xcc_test2_case_referp_customFailInfo();
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz123ABCDZ!@#$%^&*()"), "abcdz123ABCDZ!@#$%^&*()", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz123ABCDZ!@#$%^&*()"), "ABCDZ123abcdz!@#$%^&*()", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz123abcdz!@#$%^&*()"), "ABCDZ123ABCDZ!@#$%^&*()", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var4"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("ABCDZ123ABCDZ!@#$%^&*()"), "abcdz123abcdz!@#$%^&*()", 1
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[err-param.210.case-insensitive-match]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
xcc_test2_scope_end();
}
};
template<typename TPL_STROBJ>
class subtest_containsCstr_eqCaseSensitive_tplt: public subtest_containsCstr_tplt<TPL_STROBJ>
{
/* --- --- --- --- */
/* --- --- --- --- */
/* --- --- --- --- */
using typename subtest_containsCstr_tplt<TPL_STROBJ>::test_contains_cstr_paramsError_expectRetv_paramRow_t;
using subtest_containsCstr_tplt<TPL_STROBJ>::intfs;
using subtest_containsCstr_tplt<TPL_STROBJ>::test_contains_cstr_paramsError_expectRetv;
/* --- --- --- --- */
/* --- --- --- --- */
/* --- --- --- --- */
public: subtest_containsCstr_eqCaseSensitive_tplt(test_xcStringS_testStaticStr_intfs_tpl<TPL_STROBJ>* ref_intfs): subtest_containsCstr_tplt<TPL_STROBJ>(ref_intfs)
{
}
protected: int testedOp_cstr(test_xcStringS_I_abstract<TPL_STROBJ>* intf, TPL_STROBJ* ref_self, const char* param1)
{
return intf->contains_cstr(ref_self, param1);
}
public: int perform(xcc_test2_param_list)
{
int x=0;
x+=this->test_contains_strc_ANYCASE(xcc_test2_param_list_forward);
x+=this->test_contains_cstr_okParamsMatchCaseSensitive(xcc_test2_param_list_forward);
return x;
}
public: int test_contains_cstr_okParamsMatchCaseSensitive(xcc_test2_param_list)
{
xcc_test2_scope("[CSTRD]-[contains-cstr-matchCaseInsensitive]");
test_xcStringS_param_I_Set_tplt<TPL_STROBJ>* ref_set=this->intfs->INTF_SET;
xcc_test2_failureDetails_t* refp_failReport=xcc_test2_case_referp_customFailInfo();
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123ABCZ.!@#$%^&*().zyx"), "abcdz.123ABCZ.!@#$%^&*().zyx", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123ABCZ.!@#$%^&*().zyx"), "ABCDZ.123abcz.!@#$%^&*().zyx", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123abcz.!@#$%^&*().zyx"), "ABCZ", 0
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var4"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123abcz.!@#$%^&*().zyx"), "abcz", 1
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[ok-param.10110.case-insensitive-match-of-entire-string]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
xcc_test2_scope_end();
}
};
template<typename TPL_STROBJ>
class subtest_containsCstr_eqCaseInSensitive_tplt: public subtest_containsCstr_tplt<TPL_STROBJ>
{
/* --- --- --- --- */
/* --- --- --- --- */
/* --- --- --- --- */
using typename subtest_containsCstr_tplt<TPL_STROBJ>::test_contains_cstr_paramsError_expectRetv_paramRow_t;
using subtest_containsCstr_tplt<TPL_STROBJ>::intfs;
using subtest_containsCstr_tplt<TPL_STROBJ>::test_contains_cstr_paramsError_expectRetv;
/* --- --- --- --- */
/* --- --- --- --- */
/* --- --- --- --- */
public: subtest_containsCstr_eqCaseInSensitive_tplt(test_xcStringS_testStaticStr_intfs_tpl<TPL_STROBJ>* ref_intfs): subtest_containsCstr_tplt<TPL_STROBJ>(ref_intfs)
{
}
protected: int testedOp_cstr(test_xcStringS_I_abstract<TPL_STROBJ>* intf, TPL_STROBJ* ref_self, const char* param1)
{
return intf->containsNC_cstr(ref_self, param1);
}
public: int perform(xcc_test2_param_list)
{
int x=0;
x+=this->test_contains_strc_ANYCASE(xcc_test2_param_list_forward);
x+=this->test_containsObj_cstr_okParamsMatchCaseInsensitive(xcc_test2_param_list_forward);
return x;
}
/* --- --- --- --- */
/* --- --- --- --- */
/* --- --- --- --- */
public: int test_containsObj_cstr_okParamsMatchCaseInsensitive(xcc_test2_param_list)
{
xcc_test2_scope("[CSTRD]-[contains-obj-matchCaseInsensitive]");
test_xcStringS_param_I_Set_tplt<TPL_STROBJ>* ref_set=this->intfs->INTF_SET;
xcc_test2_failureDetails_t* refp_failReport=xcc_test2_case_referp_customFailInfo();
if(1)
{
test_contains_cstr_paramsError_expectRetv_paramRow_t rows[]=
{
xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var1"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123ABCZ.!@#$%^&*().zyx"), "abcdz.123ABCZ.!@#$%^&*().zyx", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var2"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123ABCZ.!@#$%^&*().zyx"), "ABCDZ.123abcz.!@#$%^&*().zyx", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var3"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123abcz.!@#$%^&*().zyx"), "ABCZ", 1
)
, xcc_test3_DATAROW5_ITZ_T(test_contains_cstr_paramsError_expectRetv_paramRow_t, "var4"
, refp_failReport, intfs->INTF_STATICSTR
, intfs->INTF_SET->strcsInitNonEmpty->value("abcdz.123abcz.!@#$%^&*().zyx"), "abcz", 1
)
, xcc_test3_DATAROWX_ITZ_TERM()
};
xcc_test3_case_forDataRow5(
"contains-cstr-[ok-param.10110.case-insensitive-match-of-entire-string]"
, "FALSE_RETVV-ANY-PARAM-NULL"
, test_contains_cstr_paramsError_expectRetv_paramRow_t
, test_contains_cstr_paramsError_expectRetv
, rows
);
}
xcc_test2_scope_end();
}
};
#endif
| [
"58396303+skrzj-dev@users.noreply.github.com"
] | 58396303+skrzj-dev@users.noreply.github.com |
762dac43ebf0eda69e4c19baf07e125e918d61e0 | eed2380fc14c3cc663afb353e5a5a65a820a8b64 | /trade_app/ib_client/IBJts/source/cppclient/client/Order.h | 1b7b30d77bb4249ce91b0596b106519a5a5c969b | [
"MIT"
] | permissive | lishin1980/dockerized_trade_exec | dd7c445c292ef631368425135a7836b1cde2b71c | 6eff2b075ebf79380de21c857b033b4edfad6147 | refs/heads/main | 2023-02-20T12:51:58.854649 | 2021-01-23T00:10:55 | 2021-01-23T00:10:55 | 332,207,247 | 2 | 0 | MIT | 2021-01-23T12:40:19 | 2021-01-23T12:40:18 | null | UTF-8 | C++ | false | false | 8,278 | h | /* Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
* and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. */
#pragma once
#ifndef TWS_API_CLIENT_ORDER_H
#define TWS_API_CLIENT_ORDER_H
#include "TagValue.h"
#include "OrderCondition.h"
#include "SoftDollarTier.h"
#include <float.h>
#include <limits.h>
#define UNSET_DOUBLE DBL_MAX
#define UNSET_INTEGER INT_MAX
#define UNSET_LONG LLONG_MAX
enum Origin { CUSTOMER,
FIRM,
UNKNOWN };
enum AuctionStrategy { AUCTION_UNSET = 0,
AUCTION_MATCH = 1,
AUCTION_IMPROVEMENT = 2,
AUCTION_TRANSPARENT = 3 };
enum UsePriceMmgtAlgo { DONT_USE = 0,
USE,
DEFAULT = UNSET_INTEGER };
struct OrderComboLeg
{
OrderComboLeg()
{
price = UNSET_DOUBLE;
}
double price;
bool operator==( const OrderComboLeg& other) const
{
return (price == other.price);
}
};
typedef std::shared_ptr<OrderComboLeg> OrderComboLegSPtr;
struct Order
{
// order identifier
long orderId = 0;
long clientId = 0;
int permId = 0;
// main order fields
std::string action;
double totalQuantity = 0;
std::string orderType;
double lmtPrice = UNSET_DOUBLE;
double auxPrice = UNSET_DOUBLE;
// extended order fields
std::string tif; // "Time in Force" - DAY, GTC, etc.
std::string activeStartTime = ""; // for GTC orders
std::string activeStopTime = ""; // for GTC orders
std::string ocaGroup; // one cancels all group name
int ocaType = 0; // 1 = CANCEL_WITH_BLOCK, 2 = REDUCE_WITH_BLOCK, 3 = REDUCE_NON_BLOCK
std::string orderRef; // order reference
bool transmit = true; // if false, order will be created but not transmited
long parentId = 0; // Parent order Id, to associate Auto STP or TRAIL orders with the original order.
bool blockOrder = false;
bool sweepToFill = false;
int displaySize = 0;
int triggerMethod = 0; // 0=Default, 1=Double_Bid_Ask, 2=Last, 3=Double_Last, 4=Bid_Ask, 7=Last_or_Bid_Ask, 8=Mid-point
bool outsideRth = false;
bool hidden = false;
std::string goodAfterTime; // Format: 20060505 08:00:00 {time zone}
std::string goodTillDate; // Format: 20060505 08:00:00 {time zone}
std::string rule80A; // Individual = 'I', Agency = 'A', AgentOtherMember = 'W', IndividualPTIA = 'J', AgencyPTIA = 'U', AgentOtherMemberPTIA = 'M', IndividualPT = 'K', AgencyPT = 'Y', AgentOtherMemberPT = 'N'
bool allOrNone = false;
int minQty = UNSET_INTEGER;
double percentOffset = UNSET_DOUBLE; // REL orders only
bool overridePercentageConstraints = false;
double trailStopPrice = UNSET_DOUBLE; // TRAILLIMIT orders only
double trailingPercent = UNSET_DOUBLE;
// financial advisors only
std::string faGroup;
std::string faProfile;
std::string faMethod;
std::string faPercentage;
// institutional (ie non-cleared) only
std::string openClose = ""; // O=Open, C=Close
Origin origin = CUSTOMER; // 0=Customer, 1=Firm
int shortSaleSlot = 0; // 1 if you hold the shares, 2 if they will be delivered from elsewhere. Only for Action="SSHORT
std::string designatedLocation; // set when slot=2 only.
int exemptCode = -1;
// SMART routing only
double discretionaryAmt = 0;
bool eTradeOnly = true;
bool firmQuoteOnly = true;
double nbboPriceCap = UNSET_DOUBLE;
bool optOutSmartRouting = false;
// BOX exchange orders only
int auctionStrategy = AUCTION_UNSET; // AUCTION_MATCH, AUCTION_IMPROVEMENT, AUCTION_TRANSPARENT
double startingPrice = UNSET_DOUBLE;
double stockRefPrice = UNSET_DOUBLE;
double delta = UNSET_DOUBLE;
// pegged to stock and VOL orders only
double stockRangeLower = UNSET_DOUBLE;
double stockRangeUpper = UNSET_DOUBLE;
bool randomizeSize = false;
bool randomizePrice = false;
// VOLATILITY ORDERS ONLY
double volatility = UNSET_DOUBLE;
int volatilityType = UNSET_INTEGER; // 1=daily, 2=annual
std::string deltaNeutralOrderType = "";
double deltaNeutralAuxPrice = UNSET_DOUBLE;
long deltaNeutralConId = 0;
std::string deltaNeutralSettlingFirm = "";
std::string deltaNeutralClearingAccount = "";
std::string deltaNeutralClearingIntent = "";
std::string deltaNeutralOpenClose = "";
bool deltaNeutralShortSale = false;
int deltaNeutralShortSaleSlot = 0;
std::string deltaNeutralDesignatedLocation = "";
bool continuousUpdate = false;
int referencePriceType = UNSET_INTEGER; // 1=Average, 2 = BidOrAsk
// COMBO ORDERS ONLY
double basisPoints = UNSET_DOUBLE; // EFP orders only
int basisPointsType = UNSET_INTEGER; // EFP orders only
// SCALE ORDERS ONLY
int scaleInitLevelSize = UNSET_INTEGER;
int scaleSubsLevelSize = UNSET_INTEGER;
double scalePriceIncrement = UNSET_DOUBLE;
double scalePriceAdjustValue = UNSET_DOUBLE;
int scalePriceAdjustInterval = UNSET_INTEGER;
double scaleProfitOffset = UNSET_DOUBLE;
bool scaleAutoReset = false;
int scaleInitPosition = UNSET_INTEGER;
int scaleInitFillQty = UNSET_INTEGER;
bool scaleRandomPercent = false;
std::string scaleTable = "";
// HEDGE ORDERS
std::string hedgeType; // 'D' - delta, 'B' - beta, 'F' - FX, 'P' - pair
std::string hedgeParam; // 'beta=X' value for beta hedge, 'ratio=Y' for pair hedge
// Clearing info
std::string account; // IB account
std::string settlingFirm;
std::string clearingAccount; // True beneficiary of the order
std::string clearingIntent; // "" (Default), "IB", "Away", "PTA" (PostTrade)
// ALGO ORDERS ONLY
std::string algoStrategy;
TagValueListSPtr algoParams;
TagValueListSPtr smartComboRoutingParams;
std::string algoId;
// What-if
bool whatIf = false;
// Not Held
bool notHeld = false;
bool solicited = false;
// models
std::string modelCode;
// order combo legs
typedef std::vector<OrderComboLegSPtr> OrderComboLegList;
typedef std::shared_ptr<OrderComboLegList> OrderComboLegListSPtr;
OrderComboLegListSPtr orderComboLegs;
TagValueListSPtr orderMiscOptions;
//VER PEG2BENCH fields:
int referenceContractId = UNSET_INTEGER;
double peggedChangeAmount = UNSET_DOUBLE;
bool isPeggedChangeAmountDecrease = false;
double referenceChangeAmount = UNSET_DOUBLE;
std::string referenceExchangeId;
std::string adjustedOrderType;
double triggerPrice = UNSET_DOUBLE;
double adjustedStopPrice = UNSET_DOUBLE;
double adjustedStopLimitPrice = UNSET_DOUBLE;
double adjustedTrailingAmount = UNSET_DOUBLE;
int adjustableTrailingUnit = UNSET_INTEGER;
double lmtPriceOffset = UNSET_DOUBLE;
std::vector<std::shared_ptr<OrderCondition>> conditions;
bool conditionsCancelOrder = false;
bool conditionsIgnoreRth = false;
// ext operator
std::string extOperator = "";
SoftDollarTier softDollarTier = SoftDollarTier("", "", "");
// native cash quantity
double cashQty = UNSET_DOUBLE;
std::string mifid2DecisionMaker = "";
std::string mifid2DecisionAlgo = "";
std::string mifid2ExecutionTrader = "";
std::string mifid2ExecutionAlgo = "";
// don't use auto price for hedge
bool dontUseAutoPriceForHedge = false;
bool isOmsContainer = false;
bool discretionaryUpToLimitPrice = false;
std::string autoCancelDate = "";
double filledQuantity = UNSET_DOUBLE;
int refFuturesConId = UNSET_INTEGER;
bool autoCancelParent = false;
std::string shareholder = "";
bool imbalanceOnly = false;
bool routeMarketableToBbo = false;
long long parentPermId = UNSET_LONG;
UsePriceMmgtAlgo usePriceMgmtAlgo = UsePriceMmgtAlgo::DEFAULT;
public:
// Helpers
static void CloneOrderComboLegs(OrderComboLegListSPtr& dst, const OrderComboLegListSPtr& src);
};
inline void
Order::CloneOrderComboLegs(OrderComboLegListSPtr& dst, const OrderComboLegListSPtr& src)
{
if (!src.get())
return;
dst->reserve(src->size());
OrderComboLegList::const_iterator iter = src->begin();
const OrderComboLegList::const_iterator iterEnd = src->end();
for (; iter != iterEnd; ++iter) {
const OrderComboLeg* leg = iter->get();
if (!leg)
continue;
dst->push_back(OrderComboLegSPtr(new OrderComboLeg(*leg)));
}
}
#endif
| [
"trb5me@virginia.edu"
] | trb5me@virginia.edu |
361ce8a085426136eb4de308bf776d21b4d3ee1f | 1593b8975b5ac78c9e00d199aa0bf3c2de40f155 | /gazebo/common/ColladaLoader_TEST.cc | 16eef80dd466e0076a0985554309b89629711ca7 | [
"Apache-2.0"
] | permissive | kesaribath47/gazebo-deb | 3e0da13ec54f33cc8036623bb8bba2d4a4f46150 | 456da84cfb7b0bdac53241f6c4e86ffe1becfa7d | refs/heads/master | 2021-01-22T23:15:52.075857 | 2013-07-12T18:22:26 | 2013-07-12T18:22:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,661 | cc | /*
* Copyright 2013 Open Source Robotics Foundation
*
* 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 <gtest/gtest.h>
#include "test_config.h"
#include "gazebo/common/Mesh.hh"
#include "gazebo/common/ColladaLoader.hh"
using namespace gazebo;
/////////////////////////////////////////////////
TEST(ColladaLoader, LoadBox)
{
common::ColladaLoader loader;
common::Mesh *mesh = loader.Load(
std::string(PROJECT_SOURCE_PATH) + "/test/data/box.dae");
EXPECT_STREQ("unknown", mesh->GetName().c_str());
EXPECT_EQ(math::Vector3(1, 1, 1), mesh->GetMax());
EXPECT_EQ(math::Vector3(-1, -1, -1), mesh->GetMin());
EXPECT_EQ(36u, mesh->GetVertexCount());
EXPECT_EQ(36u, mesh->GetNormalCount());
EXPECT_EQ(36u, mesh->GetIndexCount());
EXPECT_EQ(0u, mesh->GetTexCoordCount());
EXPECT_EQ(1u, mesh->GetSubMeshCount());
EXPECT_EQ(1u, mesh->GetMaterialCount());
// Make sure we can read a submesh name
EXPECT_STREQ("Cube", mesh->GetSubMesh(0)->GetName().c_str());
}
/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| [
"thomas.moulard@gmail.com"
] | thomas.moulard@gmail.com |
ab71c18276c4425e677b8c72f37c445b6da9adfc | 5515d24784c2505a9b0c2f743a6d8656e8c35b03 | /code/c++/349.两个数组的交集.cpp | 35ffd4f990233378b664d1913c59df6a77e3d0b3 | [] | no_license | wangcy6/leetcode | 0eb160afb0bcfb9fa3f542b1a96670c4a16c9cb0 | a4129ac84419cdd6c38c12a70154f7043a4ec50a | refs/heads/master | 2021-06-09T19:06:38.215155 | 2021-04-12T07:58:52 | 2021-04-12T07:58:52 | 164,075,525 | 5 | 1 | null | 2020-10-13T23:29:05 | 2019-01-04T07:45:48 | C++ | UTF-8 | C++ | false | false | 1,687 | cpp | /*
* @lc app=leetcode.cn id=349 lang=cpp
*
* [349] 两个数组的交集
*
* https://leetcode-cn.com/problems/intersection-of-two-arrays/description/
*
* algorithms
* Easy (69.49%)
* Likes: 212
* Dislikes: 0
* Total Accepted: 82.9K
* Total Submissions: 118.2K
* Testcase Example: '[1,2,2,1]\n[2,2]'
*
* 给定两个数组,编写一个函数来计算它们的交集。
*
*
*
* 示例 1:
*
* 输入:nums1 = [1,2,2,1], nums2 = [2,2]
* 输出:[2]
*
*
* 示例 2:
*
* 输入:nums1 = [4,9,5], nums2 = [9,4,9,8,4]
* 输出:[9,4]
*
*
*
* 说明:
*
*
* 输出结果中的每个元素一定是唯一的。
* 我们可以不考虑输出结果的顺序。
*
* 上来一看就梦了,心慌 然后感觉不太好
* 但是我还是标准算法分析去思考这个题目,get it
*
*/
// @lc code=start
class Solution
{
public:
vector<int> intersection(vector<int> &nums1, vector<int> &nums2)
{
vector<int> res;
map<int, int> hash;
//for循环遍历
for (int i = 0; i < nums1.size(); i++)
{
for (int j = 0; j < nums2.size(); j++)
{
//判断是否相等
if (nums1[i] == nums2[j])
{
if (hash.count(nums1[i]) == 1)
{
//有重复
}
else
{
res.push_back(nums1[i]);
hash[nums1[i]] = nums1[i];
}
break;
}
}
}
return res;
}
};
// @lc code=end
| [
"wang_cyi@163.com"
] | wang_cyi@163.com |
3de4897aaaea5062a6db32ddd73ec2086d42aea2 | adedc60b13c8e0538f4add6323084ec672b649bd | /corso01/sketch45/sketch45.ino | 096ae59072c4ce2f5ebecf1efe6403a412d2885c | [] | no_license | radiojam11/LezioniArduino | ed955d9bcbfa8d5b74876c519ebf4c235fe47140 | 13b771bf18bad7c31d35fd6178f04b2f678f30bb | refs/heads/master | 2020-05-21T18:23:47.887654 | 2015-06-25T18:28:09 | 2015-06-25T18:28:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,651 | ino | /* Prof. Michele Maffucci
19.04.2014
Utilizzo del ponte H L293D
per pilotare da tastiers il senso
di rotazione di un motore in CC
Collegamenti
L293D > Arduino
pin 1 - pin 9 - pin 16: +Vcc
pin 2: pin 4 Arduino
pin 3: motore
pin 4 - pin 5 - pin 12 - pin 13: GND
pin 6: motore
pin 7: 4 Arduino
pin 8: Vin Arduino
*/
// Pin di input del ponte H
const int pinIngresso1 = 5; // collegato al pin 3 dell'L293D
const int pinIngresso2 = 4; // collegato al pin 6 dell'L293D
void setup()
{
Serial.begin(9600); // inizializzazione della porta seriale
pinMode(pinIngresso1, OUTPUT); // pin di controllo senso di rotazione
pinMode(pinIngresso2, OUTPUT); // pin di controllo senso di rotazione
Serial.println("1 - 2 impostano la direzione, qualsiasi altro pulsante ferma il motore");
Serial.println("----------------------------------------------------------------------");
}
void loop()
{
if ( Serial.available()) { // verifica disponibilia' di un carattere sulla serial
char ch = Serial.read(); // legge il carattere inserito
if (ch == '1') // rotazione oraria
{
Serial.println("Rotazione oraria");
digitalWrite(pinIngresso1,LOW);
digitalWrite(pinIngresso2,HIGH);
}
else if (ch == '2') // rotazione antioraria
{
Serial.println("Rotazione antioraria");
digitalWrite(pinIngresso1,HIGH);
digitalWrite(pinIngresso2,LOW);
}
else
{
Serial.println("Motore fermo"); // ferma il motore
digitalWrite(pinIngresso1,LOW);
digitalWrite(pinIngresso2,LOW);
}
}
}
| [
"michele@maffucci.it"
] | michele@maffucci.it |
21c81415639ffc62519e9609474d63c55fe2cc4b | e1522f45a46820f6ddbfcc699379821e7eb660af | /codeforces.com/Codeforces Ladder 1600-1699/0363C.cpp | 55205e004134fb2b2c8c7c6d69736afb86d9b8fd | [] | no_license | dmkz/competitive-programming | 1b8afa76eefbdfd9d5766d5347e99b1bfc50761b | 8d02a5db78301cf34f5fdffd3fdf399c062961cb | refs/heads/master | 2023-08-21T00:09:21.754596 | 2023-08-13T13:21:48 | 2023-08-13T13:21:48 | 130,999,150 | 21 | 12 | null | 2023-02-16T17:43:53 | 2018-04-25T11:54:48 | C++ | UTF-8 | C++ | false | false | 1,184 | cpp | /*
Problem: 363C. Fixing Typos
Solution: strings, greedy, implementation, O(n)
Author: Dmitry Kozyrev, github: dmkz, e-mail: dmkozyrev@rambler.ru
*/
#include <iostream>
#include <string>
#include <vector>
struct Pair { char item; int count; };
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0); std::cout.tie(0); std::cerr.tie(0);
std::string s;
while (std::cin >> s) {
std::vector<Pair> arr{Pair{s[0], 0}};
for (auto& it : s) {
if (it == arr.back().item) {
arr.back().count++;
} else {
arr.push_back(Pair{it, 1});
}
}
for (int i = 0; i < (int)arr.size(); ++i) {
auto& curr = arr[i];
curr.count = std::min(curr.count, 2);
if (i > 0 && curr.count == 2) {
const auto& prev = arr[i-1];
if (prev.count == 2) {
curr.count = 1;
}
}
}
s.clear();
for (const auto& it : arr) {
s += std::string(it.count, it.item);
}
std::cout << s << std::endl;
}
return 0;
} | [
"dmkozyrev@rambler.ru"
] | dmkozyrev@rambler.ru |
e6f9b51cecbdb6102c2a6cbfb9d83f826cac5670 | a8c5043594e5540b6a31939626474289ac45fe3b | /ExampleFramework/ExampleFramework/core/Name/Model/NameModel.cpp | 43ee85697b71a0882f3e917732c4000fdb95515d | [] | no_license | rexcosta/Example-Swift-Obj-C-and-C-plus-plus | 1c90a5ddeb7b89782fab952caea4db4254ee24bb | ac45bb8aa29e6a75f7d10e52a3588de208e3b31e | refs/heads/master | 2022-06-18T09:46:45.623291 | 2020-05-03T11:36:13 | 2020-05-03T11:36:13 | 260,894,189 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,942 | cpp | //
// The MIT License (MIT)
//
// Copyright (c) 2020 Effective Like ABoss, David Costa Gonçalves
//
// 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 "NameModel.hpp"
using namespace std;
using namespace example;
NameModel::NameModel() {
this->name = "";
this->nameHistory = "";
this->id = 0;
}
NameModel::NameModel(string name, string nameHistory, int id) {
this->name = name;
this->nameHistory = nameHistory;
this->id = id;
}
NameModel::~NameModel() {
}
void NameModel::setName(string name) {
this->name = name;
}
string NameModel::getName() const {
return name;
}
void NameModel::setNameHistory(string nameHistory) {
this->nameHistory = nameHistory;
}
string NameModel::getNameHistory() const {
return nameHistory;
}
int NameModel::getId() const {
return id;
}
bool NameModel::operator==(const NameModel &rhs) const {
return id == rhs.getId();
}
| [
"david.1991@live.com"
] | david.1991@live.com |
333d22c28abdb02c905799693ca51d965cb505ec | 3e4f11467f3aa3b0b5439ea052db0024c590924e | /src/freetypelib.h | 4b86fb50385333cd89bde4c231dc20fc28a9d06c | [
"MIT"
] | permissive | if1live/harfbuzz-example | 5ae799352eb580ad1aaffa315348ec32dcd9e435 | 84bdfd47567d0dad5df6295ad84a8bf74a87e355 | refs/heads/master | 2021-01-15T20:33:44.528264 | 2016-02-01T08:09:55 | 2016-02-01T08:09:55 | 50,823,893 | 1 | 0 | null | 2016-02-01T07:58:29 | 2016-02-01T07:58:29 | null | UTF-8 | C++ | false | false | 610 | h | #pragma once
#include <ft2build.h>
#include FT_FREETYPE_H
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
typedef struct {
unsigned char* buffer;
unsigned int width;
unsigned int height;
float bearing_x;
float bearing_y;
} Glyph;
class FreeTypeLib {
public:
FreeTypeLib();
~FreeTypeLib();
FT_Face* loadFace(const string& fontName, int ptSize, int deviceHDPI, int deviceVDPI);
void freeFace(FT_Face* face);
Glyph* rasterize(FT_Face* face, uint32_t glyphIndex) const;
void freeGlyph(Glyph* glyph);
private:
FT_Library lib;
int force_ucs2_charmap(FT_Face ftf);
};
| [
"karim.naaji@gmail.com"
] | karim.naaji@gmail.com |
289f30787d165ca9b235f4fb7de455a3a4f40442 | 2124d0b0d00c3038924f5d2ad3fe14b35a1b8644 | /source/GamosCore/GamosScoring/Scorers/include/GmPSDose_LET.hh | 52f9f975fe589acefe74f19fdf2fda4a7b80c607 | [] | no_license | arceciemat/GAMOS | 2f3059e8b0992e217aaf98b8591ef725ad654763 | 7db8bd6d1846733387b6cc946945f0821567662b | refs/heads/master | 2023-07-08T13:31:01.021905 | 2023-06-26T10:57:43 | 2023-06-26T10:57:43 | 21,818,258 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | hh |
#ifndef GmPSDose_LET_h
#define GmPSDose_LET_h 1
#include "GamosCore/GamosScoring/Management/include/GmVPrimitiveScorer.hh"
#include "G4THitsMap.hh"
////////////////////////////////////////////////////////////////////////////////
// Description:
// This is a primitive scorer class for scoring energy deposit.
//
///////////////////////////////////////////////////////////////////////////////
class GmPSDose_LET : public GmVPrimitiveScorer
{
public: // with description
GmPSDose_LET(G4String name);
virtual ~GmPSDose_LET();
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
private:
};
#endif
| [
"pedro.arce@ciemat.es"
] | pedro.arce@ciemat.es |
21bbe264f860da3da9e207276ddbaef1cf957294 | 7a8635c9e1f6664cf5f6b10b8708d5bc70c609d4 | /battery_parametres.h | 5918532296161ae5aba67a3b969cbebbf8d377d5 | [] | no_license | EgorSidorov/Run_tracker | d6a20c0c66e303eca06e9fcaf8556e2d4ee31404 | ceb1d4bd4a7f7c1deb23429d4f8c3b3a6e4bf9a3 | refs/heads/master | 2020-03-26T02:31:09.396269 | 2019-01-27T18:04:24 | 2019-01-27T18:04:24 | 144,413,922 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 528 | h | #ifndef BATTERY_PARAMETRES_H
#define BATTERY_PARAMETRES_H
#include <QObject>
#if defined(Q_OS_ANDROID)
#include <QtAndroidExtras/QAndroidJniObject>
#endif
class battery_parametres : public QObject
{
Q_OBJECT
public:
explicit battery_parametres(QObject *parent = nullptr);
Q_INVOKABLE void set_battery_ignore();
Q_INVOKABLE QString get_battery_parametres();
Q_INVOKABLE void release_battery_ignore();
signals:
public slots:
private:
QAndroidJniObject main_activity;
};
#endif // BATTERY_PARAMETRES_H
| [
"sega-96@mail.ru"
] | sega-96@mail.ru |
0b495fc9d47e41580231aca51546d7875d2b8fb6 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/collectd/gumtree/collectd_repos_function_573_collectd-4.3.3.cpp | b27c4e1eb39ec12bbc59973e95064f3821a4675a | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,506 | cpp | int main (int argc, char **argv)
{
int collectd_argc = 0;
char *collectd = NULL;
char **collectd_argv = NULL;
struct sigaction sa;
int i = 0;
/* parse command line options */
while (42) {
int c = getopt (argc, argv, "hc:P:");
if (-1 == c)
break;
switch (c) {
case 'c':
collectd = optarg;
break;
case 'P':
pidfile = optarg;
break;
case 'h':
default:
exit_usage (argv[0]);
}
}
for (i = optind; i < argc; ++i)
if (0 == strcmp (argv[i], "-f"))
break;
/* i < argc => -f already present */
collectd_argc = 1 + argc - optind + ((i < argc) ? 0 : 1);
collectd_argv = (char **)calloc (collectd_argc + 1, sizeof (char *));
if (NULL == collectd_argv) {
fprintf (stderr, "Out of memory.");
return 3;
}
collectd_argv[0] = (NULL == collectd) ? "collectd" : collectd;
if (i == argc)
collectd_argv[collectd_argc - 1] = "-f";
for (i = optind; i < argc; ++i)
collectd_argv[i - optind + 1] = argv[i];
collectd_argv[collectd_argc] = NULL;
openlog ("collectdmon", LOG_CONS | LOG_PID, LOG_DAEMON);
if (-1 == daemonize ())
return 1;
sa.sa_handler = sig_int_term_handler;
sa.sa_flags = 0;
sigemptyset (&sa.sa_mask);
if (0 != sigaction (SIGINT, &sa, NULL)) {
syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno));
return 1;
}
if (0 != sigaction (SIGTERM, &sa, NULL)) {
syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno));
return 1;
}
sa.sa_handler = sig_hup_handler;
if (0 != sigaction (SIGHUP, &sa, NULL)) {
syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno));
return 1;
}
sigaddset (&sa.sa_mask, SIGCHLD);
if (0 != sigprocmask (SIG_BLOCK, &sa.sa_mask, NULL)) {
syslog (LOG_ERR, "Error: sigprocmask() failed: %s", strerror (errno));
return 1;
}
while (0 == loop) {
int status = 0;
if (0 != collectd_start (collectd_argv)) {
syslog (LOG_ERR, "Error: failed to start collectd.");
break;
}
assert (0 < collectd_pid);
while ((collectd_pid != waitpid (collectd_pid, &status, 0))
&& (EINTR == errno))
if ((0 != loop) || (0 != restart))
collectd_stop ();
collectd_pid = 0;
log_status (status);
check_respawn ();
if (0 != restart) {
syslog (LOG_INFO, "Info: restarting collectd");
restart = 0;
}
else if (0 == loop)
syslog (LOG_WARNING, "Warning: restarting collectd");
}
syslog (LOG_INFO, "Info: shutting down collectdmon");
pidfile_delete ();
closelog ();
free (collectd_argv);
return 0;
} | [
"993273596@qq.com"
] | 993273596@qq.com |
dbcbfed221617b1a2e3b45a19cd123974eeecac8 | c8d047ce0f40d541a3da75a1e11f1c9f99a11c1d | /src/script/interpreter.h | f2c51d06d1a9a475e8f0b1b7b9d03f9be81348a9 | [
"MIT"
] | permissive | anandsinha095/jdcoin-new | d6e91b459663ab992586fe41a055a50e046a9c71 | f6044406959c81bd1bc9662fa67025e434a72e5c | refs/heads/master | 2023-02-04T05:18:43.249231 | 2020-12-23T20:11:41 | 2020-12-23T20:11:41 | 323,985,965 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,557 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin developers
// Copyright (c) 2018-2019 The JDCOIN developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_SCRIPT_INTERPRETER_H
#define BITCOIN_SCRIPT_INTERPRETER_H
#include "script_error.h"
#include "primitives/transaction.h"
#include <vector>
#include <stdint.h>
#include <string>
class CPubKey;
class CScript;
class CTransaction;
class uint256;
/** Signature hash types/flags */
enum
{
SIGHASH_ALL = 1,
SIGHASH_NONE = 2,
SIGHASH_SINGLE = 3,
SIGHASH_ANYONECANPAY = 0x80,
};
/** Script verification flags */
enum
{
SCRIPT_VERIFY_NONE = 0,
// Evaluate P2SH subscripts (softfork safe, BIP16).
SCRIPT_VERIFY_P2SH = (1U << 0),
// Passing a non-strict-DER signature or one with undefined hashtype to a checksig operation causes script failure.
// Evaluating a pubkey that is not (0x04 + 64 bytes) or (0x02 or 0x03 + 32 bytes) by checksig causes script failure.
// (softfork safe, but not used or intended as a consensus rule).
SCRIPT_VERIFY_STRICTENC = (1U << 1),
// Passing a non-strict-DER signature to a checksig operation causes script failure (softfork safe, BIP62 rule 1)
SCRIPT_VERIFY_DERSIG = (1U << 2),
// Passing a non-strict-DER signature or one with S > order/2 to a checksig operation causes script failure
// (softfork safe, BIP62 rule 5).
SCRIPT_VERIFY_LOW_S = (1U << 3),
// verify dummy stack item consumed by CHECKMULTISIG is of zero-length (softfork safe, BIP62 rule 7).
SCRIPT_VERIFY_NULLDUMMY = (1U << 4),
// Using a non-push operator in the scriptSig causes script failure (softfork safe, BIP62 rule 2).
SCRIPT_VERIFY_SIGPUSHONLY = (1U << 5),
// Require minimal encodings for all push operations (OP_0... OP_16, OP_1NEGATE where possible, direct
// pushes up to 75 bytes, OP_PUSHDATA up to 255 bytes, OP_PUSHDATA2 for anything larger). Evaluating
// any other push causes the script to fail (BIP62 rule 3).
// In addition, whenever a stack element is interpreted as a number, it must be of minimal length (BIP62 rule 4).
// (softfork safe)
SCRIPT_VERIFY_MINIMALDATA = (1U << 6),
// Discourage use of NOPs reserved for upgrades (NOP1-10)
//
// Provided so that nodes can avoid accepting or mining transactions
// containing executed NOP's whose meaning may change after a soft-fork,
// thus rendering the script invalid; with this flag set executing
// discouraged NOPs fails the script. This verification flag will never be
// a mandatory flag applied to scripts in a block. NOPs that are not
// executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected.
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1U << 7),
// Require that only a single stack element remains after evaluation. This changes the success criterion from
// "At least one stack element must remain, and when interpreted as a boolean, it must be true" to
// "Exactly one stack element must remain, and when interpreted as a boolean, it must be true".
// (softfork safe, BIP62 rule 6)
// Note: CLEANSTACK should never be used without P2SH.
SCRIPT_VERIFY_CLEANSTACK = (1U << 8),
// Verify CHECKLOCKTIMEVERIFY
//
// See BIP65 for details.
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9)
};
bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror);
uint256 SignatureHash(const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
class BaseSignatureChecker
{
public:
virtual bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const
{
return false;
}
virtual bool CheckLockTime(const CScriptNum& nLockTime) const
{
return false;
}
virtual bool CheckColdStake(const CScript& script) const
{
return false;
}
virtual ~BaseSignatureChecker() {}
};
class TransactionSignatureChecker : public BaseSignatureChecker
{
private:
const CTransaction* txTo;
unsigned int nIn;
protected:
virtual bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const;
public:
TransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn) : txTo(txToIn), nIn(nInIn) {}
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const override;
bool CheckLockTime(const CScriptNum& nLockTime) const override;
bool CheckColdStake(const CScript& script) const override {
return txTo->CheckColdStake(script);
}
};
class MutableTransactionSignatureChecker : public TransactionSignatureChecker
{
private:
const CTransaction txTo;
public:
MutableTransactionSignatureChecker(const CMutableTransaction* txToIn, unsigned int nInIn) : TransactionSignatureChecker(&txTo, nInIn), txTo(*txToIn) {}
};
bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
#endif // BITCOIN_SCRIPT_INTERPRETER_H
| [
"anandsinha095@gmail.com"
] | anandsinha095@gmail.com |
2d8cc961332a1502dc2074be219f10ab878beba7 | 27fa98581735c1cc3dc22514108c630c80aee651 | /ConsoleApplication11/includes.h | db602e2bcc1159f064f22c454f9461114f22a04c | [] | no_license | p41z3/p41z3-test | 6b24ed002181a4f89c0ad1ac3be91d4bd29bd387 | 9c13d5d80f6166aed10a35e9512e3eb622f8a63d | refs/heads/master | 2021-06-16T04:25:22.917011 | 2021-04-07T13:05:39 | 2021-04-07T13:05:39 | 20,646,734 | 0 | 0 | null | 2021-04-07T13:05:39 | 2014-06-09T13:06:23 | C++ | UTF-8 | C++ | false | false | 61 | h | #include <iostream>
using namespace std;
#define MODULE 100 | [
"p42z3@gmail.com"
] | p42z3@gmail.com |
87cefa7f82f334ce46ea0e0fa18c086b248caba8 | 2ed839500f7c31f518beb433cdc7d21de6d4789b | /Game/texture.cpp | 11c4c9c4acad7197e347d1337503cd5b679e9afb | [] | no_license | NEUGWB/Game | 585d560c399c0a6938c9d697c258833aaabc558a | a55a0ca4d3ee225de6957eb9e1cadbe1bd9ad388 | refs/heads/main | 2023-03-05T17:39:10.481202 | 2021-02-17T15:57:27 | 2021-02-17T15:57:27 | 335,865,133 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,572 | cpp | /*******************************************************************
** 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 <iostream>
#include "texture.h"
Texture2D::Texture2D()
: Width(0), Height(0), Internal_Format(GL_RGB), Image_Format(GL_RGB), Wrap_S(GL_REPEAT), Wrap_T(GL_REPEAT), Filter_Min(GL_LINEAR), Filter_Max(GL_LINEAR)
{
glGenTextures(1, &this->ID);
}
Texture2D::~Texture2D()
{
//glDeleteTextures(1, &this->ID);
}
void Texture2D::Generate(unsigned int width, unsigned int height, unsigned char* data)
{
this->Width = width;
this->Height = height;
// create Texture
glBindTexture(GL_TEXTURE_2D, this->ID);
glTexImage2D(GL_TEXTURE_2D, 0, this->Internal_Format, width, height, 0, this->Image_Format, GL_UNSIGNED_BYTE, data);
// set Texture wrap and filter modes
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, this->Wrap_S);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, this->Wrap_T);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, this->Filter_Min);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, this->Filter_Max);
// unbind texture
glBindTexture(GL_TEXTURE_2D, 0);
}
void Texture2D::Bind() const
{
glBindTexture(GL_TEXTURE_2D, this->ID);
} | [
"850609901@qq.com"
] | 850609901@qq.com |
b484f913a47b747e5ebef10a13c1df2f4149879f | f72e694bb2df5abd070e8b33f130536b6ac605f6 | /src/phonetics.hpp | de83ddc7d1915960853fcb544b5fb9379b83d7b2 | [] | no_license | MubashirAli11/STT | 17b51eb49f4ded55e2a2e8d9bc60ca4f7a10c57e | 575bee875ec943ec354054b70b4235fdb9b1322d | refs/heads/master | 2020-04-13T12:26:09.120210 | 2018-12-26T17:20:40 | 2018-12-26T17:20:40 | 163,201,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 126 | hpp | #ifndef PHONETICS__HPP
#define PHONETICS__HPP
namespace marfix_stt {
class Phonetics {
};
}
#endif // PHONETICS__HPP
| [
"mubashir.ali1@hotmail.com"
] | mubashir.ali1@hotmail.com |
0735542d0ca96b5eeccf896dbd5108fb929d91a4 | c8feb0c5dee0935d8696af8e0fe70916ace7d927 | /Assignment1/Includes/Transaction.cpp | 6ea0588e4e06262e8feb093631a7e2b10a17c97e | [] | no_license | WhiteOlivierus/OOPA | 67795dd4e2c37e295c9817cbe76b174839513ecd | 454e083bc21bc37362c8f5924e7e58de6960e1b6 | refs/heads/main | 2023-01-22T10:05:57.454689 | 2020-12-08T14:26:39 | 2020-12-08T14:26:39 | 311,994,941 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 672 | cpp | #include "Transaction.h"
std::ostream &operator<<(std::ostream &stream, const Transaction &transaction)
{
std::string action = transaction.wasCredited ? "added." : "removed.";
stream << "A transaction was made " << transaction.GetDate() << " and a amount of " << std::setprecision(2) << std::fixed << transaction.amountCredited << " euro was " << action;
return stream;
}
std::string Transaction::GetDate() const
{
struct tm buf;
char str[26];
localtime_s(&buf, &dateTime);
asctime_s(str, sizeof str, &buf);
std::string out = std::string(str);
out.erase(std::remove(out.begin(), out.end(), '\n'), out.end());
return out;
} | [
"bas.dijkstra@student.hku.nl"
] | bas.dijkstra@student.hku.nl |
527471e6175a6e80ca73f05e82037fc8e23aee9c | 0cdc1b6e00003152dc8e89cfa642b456943cb10f | /samples/sample-watch/src/SmplWatchApp.h | 0ab7c8d76badeaf105f9f3fd1958c1437598cd24 | [
"Apache-2.0"
] | permissive | karlkar/tizen-app-assist | 9a8250936526c1b19c4ce061ea286a44f393bcfe | 08732965a5129a51dc08b830c1121a07aeaf51f7 | refs/heads/master | 2021-01-22T03:40:24.421824 | 2017-05-25T10:46:29 | 2017-05-25T10:46:29 | 92,393,390 | 0 | 0 | null | 2017-05-25T10:40:46 | 2017-05-25T10:40:46 | null | UTF-8 | C++ | false | false | 1,325 | h | /*
* Copyright (c) 2014-2016 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _SMPL_WATCH_APP_H_
#define _SMPL_WATCH_APP_H_
#include <WWatchApp.h>
class SmplWatchFaceViewController;
class SmplWatchApp : public app_assist::WWatchApp {
public:
SmplWatchApp();
virtual ~SmplWatchApp();
private:
bool onCreate(); // override
void onTerminate(); // override
void onPause(); // override
void onResume(); // override
void onAppControl(app_control_h request, bool firstLaunch); // override
void onTimeTick(watch_time_h watchTime); // override
void onAmbientModeTimeTick(watch_time_h watchTime); // override
void onAmbientModeChanged(bool ambientMode); // override
SmplWatchFaceViewController* _watchFaceView;
};
#endif /* _SMPL_WATCH_APP_H_ */
| [
"hosang.kim@samsung.com"
] | hosang.kim@samsung.com |
87bb2436e0e7fca6de7efc7acbfc9cb0448ff39a | 843124c50abdb72602af0b61daad9660739e5368 | /src/ces/systems/CUpdateSystem.h | dc0ee85f7abfcdc6d8484517ae7b313525c3bbc5 | [
"MIT"
] | permissive | opengamejam/OpenJam | 8806e9dd7eaa5e90048851733c9dc24d4d1f2e5c | 565dd19fa7f1a727966b4274b810424e5395600b | refs/heads/master | 2020-04-03T21:30:34.937897 | 2017-06-19T12:41:44 | 2017-06-19T12:41:44 | 28,153,757 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | h | //
// CUpdateSystem.h
// OpenJam
//
// Created by Yevgeniy Logachev
// Copyright (c) 2014 yev. All rights reserved.
//
#ifndef CUPDATESYSTEM_H
#define CUPDATESYSTEM_H
#include "ISystem.h"
#include "CUpdateComponent.h"
namespace jam {
CLASS_PTR(CUpdateSystem)
class CUpdateSystem : public CSystemBase<CUpdateComponent> {
JAM_OBJECT
public:
CUpdateSystem();
virtual ~CUpdateSystem();
virtual void Update(unsigned long dt) override;
};
} // namespace jam
#endif /* CUPDATESYSTEM_H */
| [
"evg1985@gmail.com"
] | evg1985@gmail.com |
f6de1b2d38f135e1ffb77dcd02ce0a80c58f6b26 | e7d7377b40fc431ef2cf8dfa259a611f6acc2c67 | /SampleDump/Cpp/SDK/BP_Zweihander_AlpineGuard_functions.cpp | 8a59474fcf95522e7e38555fdbe078ae8535d40c | [] | no_license | liner0211/uSDK_Generator | ac90211e005c5f744e4f718cd5c8118aab3f8a18 | 9ef122944349d2bad7c0abe5b183534f5b189bd7 | refs/heads/main | 2023-09-02T16:37:22.932365 | 2021-10-31T17:38:03 | 2021-10-31T17:38:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,546 | cpp | // Name: Mordhau, Version: Patch23
#include "../pch.h"
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------
// Function:
// Offset -> 0x014F36A0
// Name -> Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveBeginPlay
// Flags -> (BlueprintCallable, BlueprintEvent)
void UBP_Zweihander_AlpineGuard_C::ReceiveBeginPlay()
{
static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveBeginPlay");
UBP_Zweihander_AlpineGuard_C_ReceiveBeginPlay_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function:
// Offset -> 0x014F36A0
// Name -> Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveActorBeginOverlap
// Flags -> (BlueprintCallable, BlueprintEvent)
// Parameters:
// class AActor* OtherActor (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UBP_Zweihander_AlpineGuard_C::ReceiveActorBeginOverlap(class AActor* OtherActor)
{
static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveActorBeginOverlap");
UBP_Zweihander_AlpineGuard_C_ReceiveActorBeginOverlap_Params params;
params.OtherActor = OtherActor;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function:
// Offset -> 0x014F36A0
// Name -> Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveTick
// Flags -> (BlueprintCallable, BlueprintEvent)
// Parameters:
// float DeltaSeconds (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UBP_Zweihander_AlpineGuard_C::ReceiveTick(float DeltaSeconds)
{
static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ReceiveTick");
UBP_Zweihander_AlpineGuard_C_ReceiveTick_Params params;
params.DeltaSeconds = DeltaSeconds;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function:
// Offset -> 0x014F36A0
// Name -> Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ExecuteUbergraph_BP_Zweihander_AlpineGuard
// Flags -> (Final)
// Parameters:
// int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UBP_Zweihander_AlpineGuard_C::ExecuteUbergraph_BP_Zweihander_AlpineGuard(int EntryPoint)
{
static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_AlpineGuard.BP_Zweihander_AlpineGuard_C.ExecuteUbergraph_BP_Zweihander_AlpineGuard");
UBP_Zweihander_AlpineGuard_C_ExecuteUbergraph_BP_Zweihander_AlpineGuard_Params params;
params.EntryPoint = EntryPoint;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"talon_hq@outlook.com"
] | talon_hq@outlook.com |
d1f32cc5aae59505e9a8bd203f7a2ff935692b5a | f30f043fa0dd940106d0a6d26cedd1dca6fa89d2 | /1505052/divide_offline_1505052.cpp | 716624b943e0159ac4a14b5fd0e85d7fae58bf9c | [] | no_license | oaishi/CSE-204-Data-Structures-Sessional | 8c10ad3581181a2f41a8c03370ea2a720a964685 | 4e862dc59a25077eff10f90b7b7281fa7fd7756c | refs/heads/master | 2020-12-21T17:28:04.522965 | 2020-01-27T14:11:54 | 2020-01-27T14:11:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,361 | cpp | #include<cstdio>
#include<iostream>
using namespace std;
int smally ;
typedef struct points
{
int x;
int y;
} p;
p L[3000], R[3000];
void skyline(p values[], int l, int r)
{
for(int i=l; i<=r; i++)
{
if(values[i].y<smally)
{
cout<< values[i].x<<" " <<values[i].y<<endl;
smally=values[i].y;
}
}
}
void printArr(p arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
printArr(arr, l, m);
printArr(arr, m+1, r );
skyline(arr, l, r);
}
}
void mergeY(p arr[], int l, int m, int r)
{
int i, j, k;
int low = m - l + 1;
int high = r - m;
L[low], R[high];
for (i = 0; i < low ; i++)
{
L[i].x = arr[l + i].x;
L[i].y = arr[l + i].y;
}
for (j = 0; j < high ; j++)
{
R[j].x = arr[m + 1+ j].x;
R[j].y = arr[m + 1+ j].y;
}
i = 0;
j = 0;
k = l;
while (i < low && j < high)
{
if (L[i].x < R[j].x)
{
arr[k].x = L[i].x;
arr[k].y = L[i].y;
i++;
}
else if(L[i].x > R[j].x)
{
arr[k].x = R[j].x;
arr[k].y = R[j].y;
j++;
}
else
{
if (L[i].y <= R[j].y)
{
arr[k].x = L[i].x;
arr[k].y = L[i].y;
i++;
}
else if(L[i].y > R[j].y)
{
arr[k].x = R[j].x;
arr[k].y = R[j].y;
j++;
}
}
k++;
}
while (i < low)
{
arr[k].x = L[i].x;
arr[k].y = L[i].y;
i++;
k++;
}
while (j < high)
{
arr[k].x = R[j].x;
arr[k].y = R[j].y;
j++;
k++;
}
}
void mergeSortY(p arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
mergeSortY(arr, l, m);
mergeSortY(arr, m+1, r);
mergeY(arr, l, m, r);
}
}
int main()
{
int arr_size, small;
cin>>arr_size;
p values[3000];
for(int i=0; i<arr_size; i++)
{
cin>>values[i].x;
cin>>values[i].y;
}
mergeSortY(values, 0, arr_size - 1);
smally=values[0].y;
smally++;
cout<<"Non-Dominating Points-\n";
printArr(values, 0,arr_size -1);
return 0;
}
| [
"oaishi.faria@gmail.com"
] | oaishi.faria@gmail.com |
d16c26d59704c27dc206b8c750e5f5c9dae726c3 | d69cc85c6d1039c64112432b22a1a756b267b1a8 | /_cmake/core/WMath.cpp | c0ccdccfd00eed2cc7d4bbcbe6080bd35131101f | [
"MIT"
] | permissive | SSG-DRD-IOT/lab-protocols-mqtt-arduino | 02a004f60fcdd8da65d221dc287f26e3a016afa1 | 834cef842154b4645f98f1f7da57cb0ea887ca98 | refs/heads/master | 2021-01-19T07:54:17.220914 | 2018-04-03T16:11:34 | 2018-04-03T16:11:34 | 100,647,409 | 0 | 4 | MIT | 2018-04-03T16:11:35 | 2017-08-17T21:40:18 | C | UTF-8 | C++ | false | false | 1,614 | cpp | /*
Part of the Wiring project - http://wiring.org.co
Copyright (c) 2004-06 Hernando Barragan
Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
extern "C" {
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
}
#include "WMath.h"
void randomSeed(uint32_t dwSeed)
{
if (dwSeed != 0)
srand(dwSeed);
}
long random(long howbig)
{
if (howbig == 0) {
return 0;
}
return rand() % howbig;
}
long random(long howsmall, long howbig)
{
if (howsmall >= howbig) {
return howsmall;
}
long diff = howbig - howsmall;
return random(diff) + howsmall;
}
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
unsigned int makeWord(unsigned int w)
{
return w;
}
unsigned int makeWord(unsigned char h, unsigned char l)
{
return (h << 8) | l;
}
| [
"christopherx.crase@intel.com"
] | christopherx.crase@intel.com |
974f8f2cd45da2b934c87fb9a445db829da94f65 | c4c3734e8fd5cb2a36db6e22614d420d63e13e35 | /TP11 Bitcoin/TP11 Bitcoin/parameters.h | e62154297af2bc57594f1838e5e0354132d52998 | [] | no_license | fmoriconi/EDA_TP11 | a089e5842a88b9cca412484b753986665535a67e | 00a5d4a47f303e18821b4d075025788b6290a2be | refs/heads/master | 2020-03-19T03:23:56.823686 | 2018-06-20T22:41:14 | 2018-06-20T22:41:14 | 135,724,318 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 257 | h | #pragma once
#define OPTION_QTY 2
class parameters_t{
public:
parameters_t() {
options[0] = { "nodes" };
options[1] = { "miners" };
}
const char * options[OPTION_QTY];
bool flags[2] = { false }; // Nodes - Miners.
int nodes;
int miners;
}; | [
"31166325+fmoriconi@users.noreply.github.com"
] | 31166325+fmoriconi@users.noreply.github.com |
4b03f95116dd6f35d573ae35cb817f0ecd47800c | fa426ed53e612707a2447697164d70708399d673 | /Proiect/src/Revista.cpp | 40d4e21aab0451c580d66ff05bb26500b0540835 | [] | no_license | iamvale/Home | da61d5c0c2fb5e28d6b23acfd0c17b7ac07f17b4 | 10c7a66f62b2b0e521d5b39f6de8636fd4283eba | refs/heads/master | 2020-05-04T09:44:01.016405 | 2019-06-16T18:57:36 | 2019-06-16T18:57:36 | 179,074,575 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 263 | cpp | #include "Revista.h"
#include "Articol.h"
Revista::Revista(std::string tit, int bucEx, int bucDisp, std::string tip):Articol(tit, bucEx, bucDisp)
{
tipRev = tip;
}
Revista::~Revista()
{
//dtor
}
void Revista::setTip(std::string tp) {
tipRev = tp;
}
| [
"32463819+iamvalentina@users.noreply.github.com"
] | 32463819+iamvalentina@users.noreply.github.com |
33f4af957c223aa085f09d46e9b1149eb12f353a | 92ed12aef7e5d1d6e5b0574bc6d70549b1b345e5 | /Problems Implementations/C++ Implementation/Rounds Participations/Advent of code/2021/Day 12_part 2.cpp | 919d8f13f59f0b35385dcfdae6d58f14447e11f6 | [] | no_license | AmEr-Tinsley/Competitive-programming | 0d9adc3ef7b0a0d7a2aefc74ac3376ca3e97d74c | 0892a75e6f2a0d489d9edd53e37d4787c3452aa4 | refs/heads/master | 2023-03-16T23:58:07.349218 | 2023-03-11T17:50:27 | 2023-03-11T17:50:27 | 159,981,161 | 5 | 1 | null | 2022-09-03T07:46:03 | 2018-12-01T19:47:10 | C++ | UTF-8 | C++ | false | false | 1,790 | cpp | // ¯\_(ツ)_/¯
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/detail/standard_policies.hpp>
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define ll long long
using namespace std;
//using namespace __gnu_pbds;
//typedef tree< int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
void file()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
//freopen("out.txt","w",stdout);
#endif
}
int tc;
const int N = 1e6 + 5, M = 2e6 + 5, MOD = 1e9 + 7, OO = 1e9 + 7;
const ll INF = 2e18;
map<string,vector<string>>g;
map<string,int>visited;
bool isSmallCave(string s){
return s[0] >= 'a' && s[0] <= 'z';
}
int go(string u){
int cnt = 0;
if(u == "end")return 1;
for(auto v : g[u]){
if(isSmallCave(v)){
bool validToVisit = v != "start";
if(visited[v] > 1)continue;
else if(visited[v] == 1){
for(auto p : visited){
if(isSmallCave(p.first) && p.second > 1)validToVisit = false;
}
}
if(validToVisit){
visited[v]++;
cnt+=go(v);
visited[v]--;
}
}
else{
cnt+=go(v);
}
}
return cnt;
}
void solve(int tc)
{
string a,b;
while(cin>>a>>b){
g[a].pb(b);
g[b].pb(a);
}
visited["start"] = 1;
int ans = go("start");
cout<<ans<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
file();
int tc = 1;
//scanf("%d",&tc);
for (int i = 1; i <= tc; i++)
solve(i);
} | [
"amerhosni07@gmail.com"
] | amerhosni07@gmail.com |
f0b8bd048e7d8230588f404e58053e4734f420aa | 780a8d5c451f9b4c4f5e1bec25c0c7f72ffeffd6 | /Project/Dizzy-Spiral/Dizzy_Spiral/iOS/Classes/Native/Il2CppCodeRegistration.cpp | d0f92de51dfa812955c8a1b4bede244210bfc3f4 | [] | no_license | 1812michaelpichler/Dizzy_Spiral | 2a88c8d0711f5ac62601f554e8fc3760eb98b5eb | 7822c88d6446314c910e8de828c0ff31d3721172 | refs/heads/master | 2020-06-11T00:45:33.294090 | 2018-01-22T14:52:57 | 2018-01-22T14:52:57 | 75,831,816 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,365 | cpp | #include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "class-internals.h"
#include "codegen/il2cpp-codegen.h"
extern const Il2CppMethodPointer g_MethodPointers[];
extern const Il2CppMethodPointer g_DelegateWrappersManagedToNative[];
extern const Il2CppMarshalingFunctions g_MarshalingFunctions[];
extern const Il2CppMethodPointer g_Il2CppGenericMethodPointers[];
extern const InvokerMethod g_Il2CppInvokerPointers[];
extern const CustomAttributesCacheGenerator g_AttributeGenerators[];
const Il2CppCodeRegistration g_CodeRegistration =
{
11160,
g_MethodPointers,
0,
NULL,
25,
g_DelegateWrappersManagedToNative,
177,
g_MarshalingFunctions,
0,
NULL,
4302,
g_Il2CppGenericMethodPointers,
1648,
g_Il2CppInvokerPointers,
2527,
g_AttributeGenerators,
0,
NULL,
};
extern const Il2CppMetadataRegistration g_MetadataRegistration;
static const Il2CppCodeGenOptions s_Il2CppCodeGenOptions =
{
false,
};
static void s_Il2CppCodegenRegistration()
{
il2cpp_codegen_register (&g_CodeRegistration, &g_MetadataRegistration, &s_Il2CppCodeGenOptions);
}
static il2cpp::utils::RegisterRuntimeInitializeAndCleanup s_Il2CppCodegenRegistrationVariable (&s_Il2CppCodegenRegistration, NULL);
| [
"patrick@patrickkiss.com"
] | patrick@patrickkiss.com |
84ec860e24b49a71b2e4cab7930fa1f7813edb19 | b1310472138ac77fbb5b6dde1a30a5d337c9ebf6 | /TBGJCUtils/Examples/2017/TidyNumbers.cpp | c0aad6e62729fb63bf5d9c975053faa90b3fd5c3 | [] | no_license | bigbangvn/TBGJCUtils | 876da3784e0e203d0d874147ea1e49fe514d970e | a194b4848f4f973bbd51fc5ef7a97de8c5703e6e | refs/heads/master | 2021-01-19T03:51:57.098574 | 2017-04-14T01:06:26 | 2017-04-14T01:06:26 | 84,417,684 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,940 | cpp | //
// TidyNumbers.cpp
// TBGJCUtils
//
// Created by trongbangvp@gmail.com on 4/8/17.
// Copyright © 2017 trongbangvp@gmail.com. All rights reserved.
//
#include <stdio.h>
#include <assert.h>
#include <iostream>
#include <algorithm>
using namespace std;
unsigned long long powInterger(int b, int n)
{
if(b == 0)
{
assert(0);
return 1;
}
if(n == 0) return 1;
if(n == 1) return b;
unsigned long long result = b;
for(int i = 1; i<n; ++i)
{
result = result * b;
}
return result;
}
unsigned long long findLastTidyNumber(unsigned long long N)
{
if(N<10)
return N;
//Convert to array
const int len = 20;
int index = len - 1;
int arr[len] = {0};
unsigned long long temp = N;
while(temp > 0)
{
int a = temp % 10;
temp = temp/10;
arr[index--] = a;
}
//Solve
for(int i = len-1; i> index+1; --i)
{
if(arr[i] < 0)
{
arr[i] = 9;
--arr[i-1];
}
if(arr[i] < arr[i-1])
{
--arr[i-1];
for(int j = i; j<len; ++j)
{
arr[j] = 9;
}
}
// if(currMax == 0)
// {
// return powInterger(10, (len-1) - (index+1)) - 1;
// }
}
unsigned long long result = 0;
unsigned long long gain = 1;
for(int i = len - 1; i >= index + 1; --i)
{
if(arr[i] >= 0)
{
result += arr[i]*gain;
gain *= 10;
} else
{
break;
}
}
return result;
}
#if 0
int main(int argc, const char * argv[]) {
int numTest;
cin >> numTest;
for(int i = 0; i<numTest; ++i)
{
unsigned long long N;
cin >> N;
unsigned long long result = findLastTidyNumber(N);
cout <<"Case #" <<i+1 <<": " <<result <<endl;
}
}
#endif
| [
"trongbangvp@gmail.com"
] | trongbangvp@gmail.com |
ecd64ec81b7b5f051ca86789c2752f4ab93034a5 | b2a68dcd001d23c1d7920352680ae394623026ea | /BOJ/02563/2563.cpp14.cpp | 578e93dfb813a3788d3ef400c8fa0d869ba6d817 | [] | no_license | nathankim0/algorithm-ps | 236779ba0daad0876a8e9d41990d23024778a9a5 | 29368dda780c29315d35c2ef7e78a0418df1aa53 | refs/heads/master | 2023-06-12T19:15:21.076210 | 2021-07-09T10:10:52 | 2021-07-09T10:10:52 | 384,387,567 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 387 | cpp | #include <iostream>
using namespace std;
int arr[100][100];
int main() {
int n;
int a, b;
scanf("%d", &n);
while (n--) {
scanf("%d %d", &a, &b);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
arr[a + i][b + j] = 1;
}
}
}
int cnt = 0;
for (int i = 0; i <= 100; i++) {
for (int j = 0; j <= 100; j++) {
if (arr[i][j]) cnt++;
}
}
cout << cnt;
} | [
"jinyeob07@gmail.com"
] | jinyeob07@gmail.com |
bc7d576730b068c422b038b306572cc616ff7208 | 938495d61712257f36cfeaa36f4380a760930047 | /clibrary/radonsolver.cpp | 1ac926ccf8fc0c4fdd2abeb1fb3d61a8a7c828c4 | [] | no_license | chaoshunh/seismic_unix | cec401f04e77c8dd6caf93e8cbac000a7ea15794 | c975332d5fab748d5f42ed8225e9f878def7d76a | refs/heads/master | 2022-11-06T18:22:16.105316 | 2020-06-26T16:52:43 | 2020-06-26T16:52:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,593 | cpp | #include "radonsolver.h"
/* This is an interface to the WTCGLS method in routine wtcgls.cpp
This function solves the system of equations
(FH WdT Wd FH + WmT Wm ) m = FH WdT Wd d
Notice that LH=FH WdT and L= Wd F are computed with matrix_3.
If we assumed noise and model are uncorrelated,
i.e., data and model covariances matrices Cd and Cm are diagonal
Wd is the factorization of the inverse data Covariance matrix
inv(Cd)=WdT Wd
Wm is the factorization of the inverse model Covariance matrix
inv(Cm)=WmT Wm
Wm is useful to increase resolution
Wd is useful to taper data at the boundaries and
to reduce effect of killed or bad traces
Wm depends on the model so iteration are necessary
Wd does not change.
*/
void radonsolver(float *pos, int nh, float **data, float *t, int nt, float dt,float **model, float *q, int nq, float dq, float eps1, float eps2, float eps, float fmax, float *Wd, int itercg, int iter_end,int norm,float step, int testadj, int rtmethod, float depth, char *solver)
{
int iq,ih,freq,iter; // counters
int nfft,maxfreq,nf; // sizes
complex **m2, **d2; // Workable arrays
complex **L; // operator
float w=0,wa,*dh;
float df;
float *Wm;
float **J;
// Foster and Mosher offset function
float *g=0;
float quantil1=eps1;
float quantil2=eps2;
float sigmam;
float sigmad;
int freqflag=0;
complex czero; czero.r=czero.i=0;
float J0=0;
int nf2=0;
complex *RC=0;
float *Cd;
// Note that c allocates memory per column
// Hence 2 D array with alloc2type requires reversing dimension
// i.e., first columns, then rows.
d2=ealloc2complex(nh,nt);
m2=ealloc2complex(nq,nt);
L=ealloc2complex(nq,nh);
dh=ealloc1float(nh);
Wm=ealloc1float(nq);
g=ealloc1float(nh);
Cd=ealloc1float(nh);
/**** cgfft ****/
nf2=npfa((int) 2*nq);
RC=ealloc1complex(nf2);
/*********************/
dataweigths(pos,nh,Wd,TRUE);
//for (ih=0;ih<nh;ih++) Cd[ih]=Wd[ih]*nh/fabs(pos[nh-1]-pos[0]);
for (ih=0;ih<nh;ih++) Cd[ih]=1;
//for (ih=0;ih<nh;ih++) Wd[ih]=Wd[ih]*nh/fabs(pos[nh-1]-pos[0]);
radon_moveout(pos,g,nh,rtmethod,depth);
fft_parameters(nt,dt,&nfft,&nf,&df);
fftgo_xt2fx(-1,data,d2,nh,nt,dt,nfft,nf);
maxfreq=(int) (fmax/df);
if (freqflag==1) maxfreq=nf;
fprintf(stderr,"maxfreq=%d, dt=%f, df=%f, nfft=%d nf=%d \n",maxfreq,dt,df,nfft,nf);
J=ealloc2float(iter_end,maxfreq);
for (freq=1;freq<maxfreq;freq++){
w=2*PI*freq*df;
wa=freqweight(freq,df,fmax-10,fmax);
radon_matrix(L,g,q,nh,nq,w);
//fprintf(stderr,"freq=%f\n",freq*df);
if (STREQ(solver,"cgfft_")) radon_matrix_cgfft(L,RC,nh,nq,nf2,Cd);
for (iter=1;iter<=iter_end;iter++){
// The deviations for data and model are computed on the least squares solution
// (after the first iteration). Then they are kept fixed to find the minimum
// of the cost function.
if (iter==2)
deviations(m2[freq],nq,d2[freq],nh,norm,quantil1,quantil2,&sigmam,&sigmad);
weights_inv(m2[freq],nq,norm,sigmam,Wm,iter);
//taper(Wm,nq,nq/5);
if (STREQ(solver,"adj___"))
Atimesx(d2[freq],L,m2[freq],nh,nq,TRUE);
else if (STREQ(solver,"cgfft_"))
/*I change for now step to sigmam to test Wm */
J0=radon_cgfft(d2[freq],L,RC,m2[freq],nh,nq,nf2,Wm,Cd,eps,itercg,step);
else if (STREQ(solver,"wtcgls"))
J0=wtcgls(d2[freq],L,m2[freq],Wm,Wd,nh,nq,0,step,itercg);
else if (STREQ(solver,"toep__"))
J0=radon_toeplitz(d2[freq],L,m2[freq],eps1,nh,nq);
else if (STREQ(solver,"cgtoep"))
J0=radon_cgtoep(d2[freq],L,m2[freq],eps1,nh,nq);
J[freq][iter-1]=J0;
}
if ((STREQ(solver,"toep__"))||(STREQ(solver,"adj___")))
for (iq=0;iq<nq;iq++) m2[freq][iq]/=nh;
if ((STREQ(solver,"cgfft_")))
for (iq=0;iq<nq;iq++) m2[freq][iq]/=nh;
if ((wa<1)&&(wa>0)) for (iq=0;iq<nq;iq++) m2[freq][iq]*=wa;
normalize(iter_end,J[freq]);
}
for (iq=0;iq<nq;iq++) m2[0][iq]=czero; //dc can not be recovered
for (freq=maxfreq;freq<nf;freq++) for (iq=0;iq<nq;iq++) m2[freq][iq]=czero;
fprintf(stderr,"w=%f\n",w);
fftback_fx2xt(1,model,m2,nq,nt,dt,nfft,nf);
//plotcurves(J,iter_end,freq,10,50,"Cost");
free2float(J);
free1complex(RC);
free1float(Cd);
free1float(g);
free1float(Wm);
free1float(dh);
free2complex(L);
free2complex(m2);
free2complex(d2);
return;
}
| [
"danielotrad@gmail.com"
] | danielotrad@gmail.com |
1addd448690efedd6671c19277e9cc0b33f7ffa1 | eb8d36a89dbaeffeedd8584d970aa2b33a8b2c6e | /CQ-0232/sequence/sequence.cpp | 21844bcdfa0c23cc3d06afc89831f115549b4c02 | [] | no_license | mcfx0/CQ-NOIP-2021 | fe3f3a88c8b0cd594eb05b0ea71bfa2505818919 | 774d04aab2955fc4d8e833deabe43e91b79632c2 | refs/heads/main | 2023-09-05T12:41:42.711401 | 2021-11-20T08:59:40 | 2021-11-20T08:59:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,174 | cpp | #include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,m,k,mar;
long long v[107],num[31],ans=0,dpc[107][107];
int now[107];
bool check()
{
long long size=0;
memset(now,0,sizeof(now));
for(int i=0;i<=m;i++) now[i]=num[i];
for(int i=0;i<=mar;i++)
{
now[i+1]+=(now[i]/2);
now[i]=now[i]%2;
}
for(int i=0;i<=mar;i++)
{
size+=now[i];
if(size>k) return 0;
}
return 1;
}
void dfs(int id,int y)
{
if(id>m)
{
if(y==0&&check())
{
long long tmp=1,times=1,w=n;
for(int i=0;i<=m;i++)
{
if(num[i]>0)
{
for(int j=1;j<=num[i];j++) tmp=tmp*v[i]%mod;
times=times*dpc[w][num[i]]%mod;
w-=num[i];
}
}
ans=(ans+times*tmp%mod)%mod;
}
return;
}
for(int i=0;i<=y;i++)
{
num[id]=i;
dfs(id+1,y-i);
}
}
int main()
{
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
scanf("%d %d %d",&n,&m,&k);
for(int i=0;i<=m;i++)
{
scanf("%lld",&v[i]);
v[i]=v[i]%mod;
}
dpc[1][1]=1;
for(int i=2;i<=n;i++)
{
dpc[i][1]=i;
for(int j=2;j<i;j++) dpc[i][j]=(dpc[i-1][j]+dpc[i-1][j-1])%mod;
dpc[i][i]=1;
}
mar=log2(n*(1<<m))+1;
dfs(0,n);
printf("%lld",ans);
return 0;
}
| [
"3286767741@qq.com"
] | 3286767741@qq.com |
dad48b7df4931359c3ac91da7a7e2803ede7a18c | c05b8546d5c02434c2851fc5cc820fc6e12db563 | /src/qt/bitcoinstrings.cpp.save.save.save | 5362e07588801e25387dcceb15bc7eed95ca42a1 | [
"MIT"
] | permissive | taxicoinfoundation/taxicoin | 8289a75dabcc041220d14f6a3c11e5cbd8504de1 | b8db911cad0082b8d4c839f43f10420b6959c42c | refs/heads/master | 2016-09-02T04:54:57.264740 | 2014-03-06T21:36:01 | 2014-03-06T21:36:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,614 | save | #include <QtGlobal>
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif
static const char UNUSED *bitcoin_strings[] = {
QT_TRANSLATE_NOOP("bitcoin-core", ""
"%s, you must set a rpcpassword in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=taxicoinrpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"Taxicoin Alert\" admin@foo.com\n"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
"@STRENGTH)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"An error occurred while setting up the RPC port %u for listening on IPv4: %s"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"An error occurred while setting up the RPC port %u for listening on IPv6, "
"falling back to IPv4: %s"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Cannot obtain a lock on data directory %s. Taxicoin is probably already "
"running."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat "
"and coins were spent in the copy but not marked as spent here."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: This transaction requires a transaction fee of at least %s because of "
"its amount, complexity, or use of recently received funds!"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when a relevant alert is received (%s in cmd is replaced by "
"message)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
"TxID)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when the best block changes (%s in cmd is replaced by block "
"hash)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Number of seconds to keep misbehaving peers from reconnecting (default: "
"86400)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Set maximum size of high-priority/low-fee transactions in bytes (default: "
"27000)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Set the number of script verification threads (up to 16, 0 = auto, <0 = "
"leave that many cores free, default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"This is a pre-release test build - use at your own risk - do not use for "
"mining or merchant applications"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Unable to bind to %s on this computer. Taxicoin is probably already running."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Displayed transactions may not be correct! You may need to upgrade, "
"or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong Taxicoin will not work properly."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
"you should restore from a backup."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"You must set rpcpassword=<password> in the configuration file:\n"
"%s\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions."),
QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "Taxicoin version"),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"),
QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Taxicoin"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to sync block index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write file info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write to coin database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"),
QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"),
QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"),
QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"),
QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-4, default: 3)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Information"),
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"),
QT_TRANSLATE_NOOP("bitcoin-core", "List commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 9333 or testnet: 19333)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain a full transaction index (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."),
QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"),
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra network debugging information"),
QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Taxicoin Wiki for SSL setup instructions)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or taxicoind"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: taxicoin.conf)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: taxicoind.pid)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"),
QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Taxicoin to complete"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
};
| [
"simmons.johnalan@gmail.com"
] | simmons.johnalan@gmail.com |
334ba2edefb4b6fa70d14a5ddc56762d4caaf0d8 | c1008dbb560e2f100d65751faa2fef775ac50e82 | /shopMall/mall.cpp | 102720dd030d397b6b49d0a546bebea8327fee45 | [
"MIT"
] | permissive | Alexader/OOPDesign | 363136eeb1448f64c26952c93159fe39f1d0512e | 860d0ef07eaeba600fb30acb17536a08e5682bc3 | refs/heads/master | 2021-04-09T13:25:01.070235 | 2018-03-16T15:30:23 | 2018-03-16T15:30:23 | 125,450,302 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,466 | cpp | //Submit this file
#include "mall.h"
//You are NOT allowed to include any additional library
//NOTE: Mall::duplicateShopLinkedList must NOT be implemented here
Mall::Mall(string name, string address) : name(name), address(address) {
shopHead = nullptr;
}
Mall::Mall(Mall &another) {
// Use duplicateShopLinkedList() to copy
shopHead = duplicateShopLinkedList(another.shopHead);
name = another.name;
address = another.address;
}
Mall::~Mall() {
// Delete the whole list
Node *head = shopHead; Node *temp = shopHead;
while (temp != nullptr) {
temp = temp->getNext();
delete head;
head = temp;
}
}
Shop *Mall::getShop(int shopNumber) {
if (shopHead == nullptr) return nullptr;
else {
// Traverse the list
Node *temp = shopHead;
while (temp != nullptr) {
if (temp->getShop()->getShopNumber() == shopNumber)
return temp->getShop();
temp = temp->getNext();
}
return nullptr;
}
}
void Mall::setName(string name) {
this->name = name;
}
void Mall::setAddress(string address) {
this->address = address;
}
string Mall::getName() {
return name;
}
string Mall::getAddress() {
return address;
}
bool Mall::addShop(string name, int shopNumber) {
if (shopHead == nullptr) {
shopHead = new Node(new Shop(name, shopNumber), nullptr);
return true;
}
Node *temp = shopHead;
do {
if (temp->getShop()->getShopNumber() == shopNumber) return false;
if (temp->getNext() == nullptr) {
temp->setNext(new Node(new Shop(name, shopNumber), nullptr));
return true;
}
temp = temp->getNext();
} while (temp != nullptr);
}
bool Mall::removeShop(int shopNumber) {
Node *fence = shopHead;
Node *formerPointer = nullptr;
if (fence == nullptr) return false;
while (fence->getNext() != nullptr) {
formerPointer = fence; // Save fence former pointer
if (fence->getShop()->getShopNumber() == shopNumber) {
// Swap next Node and current Node and delete next Node
Shop *tempShop = fence->getShop();
fence->setShop(fence->getNext()->getShop());
Node *temp = fence->getNext();
fence->setNext(temp->getNext());
temp->setShop(tempShop);
delete temp;
temp = nullptr; tempShop = nullptr;
return true;
}
else fence = fence->getNext();
}
if (fence->getShop()->getShopNumber() == shopNumber) { // In tail node
formerPointer->setNext(nullptr);
delete fence;
return true;
}
return false;
}
| [
"tyxj58@gmail.com"
] | tyxj58@gmail.com |
8097ca8d35928dcbda6a130961aa16ab4dd0bfc2 | 62d77106b820b69098da1772a6f1eee57810c07e | /src/ReFFT.cpp | ccfe8afd72231b0e1c3221a5eaa63080a38e12b7 | [] | no_license | gdkar/rmwarp | eb2a6c2e5c00532ea14f995ce9bb31bd6a285cdd | bce89d436b0c3ca4aecc54b21debc3d6265d2cb2 | refs/heads/master | 2021-01-20T00:11:32.749997 | 2017-04-22T20:18:52 | 2017-04-22T20:18:52 | 89,094,131 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,038 | cpp | #include <thread>
#include <mutex>
#include "rmwarp/ReFFT.hpp"
#include "rmwarp/KaiserWindow.hpp"
using namespace RMWarp;
namespace detail {
struct _wisdom_reg {
template<class F,class D>
static void wisdom(F && ffunc, D && dfunc, const char mode[]) {
if(auto home = getenv("HOME")){
char fn[256];
::snprintf(fn, sizeof(fn), "%s/%s.f", home, ".rubberband.wisdom");
if(auto f = ::fopen(fn, mode)){
std::forward<F>(ffunc)(f);
fclose(f);
}
::snprintf(fn, sizeof(fn), "%s/%s.d", home, ".rubberband.wisdom");
if(auto f = ::fopen(fn, mode)){
std::forward<D>(dfunc)(f);
fclose(f);
}
}
}
static std::once_flag _wisdom_once;
_wisdom_reg(){
std::call_once(_wisdom_once,[](){
fftwf_init_threads();
fftwf_make_planner_thread_safe();
fftw_init_threads();
fftw_make_planner_thread_safe();
wisdom(fftwf_import_wisdom_from_file,fftw_import_wisdom_from_file,"rb");
});
}
~_wisdom_reg() {
wisdom(fftwf_export_wisdom_to_file,fftw_export_wisdom_to_file,"wb");
}
};
/*static*/ std::once_flag _wisdom_reg::_wisdom_once{};
_wisdom_reg the_registrar{};
}
void ReFFT::initPlans()
{
if(m_size) {
if(m_plan_r2c) {
fftwf_destroy_plan(m_plan_r2c);
m_plan_r2c = 0;
}
if(m_plan_c2r) {
fftwf_destroy_plan(m_plan_c2r);
m_plan_c2r = 0;
}
m_coef = m_size ? (m_size / 2 + 1) : 0; /// <- number of non-redundant forier coefficients
m_spacing = align_up(m_coef, item_alignment);
cexpr_for_each([sz=size_type(m_size)](auto & item){item.resize(sz);}
, m_h
, m_Dh
, m_Th
, m_TDh
, m_flat
);
cexpr_for_each([sz=size_type(spacing() * 2)](auto & item){item.resize(sz);}
, m_split
, m_X
, m_X_Dh
, m_X_Th
, m_X_TDh
);
auto _real = &m_split[0]; auto _imag = &m_split[m_spacing]; auto _time = &m_flat[0];
{
auto dims = fftwf_iodim{ m_size, 1, 1};
m_plan_r2c = fftwf_plan_guru_split_dft_r2c(
1, &dims, 0, nullptr, _time, _real, _imag, FFTW_ESTIMATE);
}
{
auto dims = fftwf_iodim{ m_size, 1, 1};
m_plan_c2r = fftwf_plan_guru_split_dft_c2r(
1, &dims, 0, nullptr, _real, _imag, _time, FFTW_ESTIMATE);
}
}
}
/*static*/ ReFFT ReFFT::Kaiser(int _size, float alpha)
{
auto win = vector_type(_size, 0.0f);
auto win_dt = vector_type(_size, 0.0f);
make_kaiser_window(win.begin(),win.end(), alpha);
return ReFFT(win.cbegin(),win.cend());
}
ReFFT& ReFFT::operator=(ReFFT && o ) noexcept
{
swap(o);
return *this;
}
void ReFFT::swap(ReFFT &o) noexcept
{
using std::swap;
swap(m_size,o.m_size);
swap(m_coef,o.m_coef);
swap(m_spacing,o.m_spacing);
swap(m_h,o.m_h);
swap(m_Dh,o.m_Dh);
swap(m_Th,o.m_Th);
swap(m_TDh,o.m_TDh);
swap(m_flat,o.m_flat);
swap(m_split,o.m_split);
swap(m_X,o.m_X);
swap(m_X_Dh,o.m_X_Dh);
swap(m_X_Th,o.m_X_Th);
swap(m_X_TDh,o.m_X_TDh);
swap(m_plan_r2c,o.m_plan_r2c);
swap(m_plan_c2r,o.m_plan_c2r);
}
ReFFT::ReFFT(ReFFT && o ) noexcept
: ReFFT(0)
{
swap(o);
}
ReFFT::~ReFFT()
{
if(m_size) {
if(m_plan_r2c) {
fftwf_destroy_plan(m_plan_r2c);
m_plan_r2c = 0;
}
if(m_plan_c2r) {
fftwf_destroy_plan(m_plan_c2r);
m_plan_c2r = 0;
}
}
}
void ReFFT::_finish_process( ReSpectrum & dst, int64_t _when )
{
using reg = simd_reg<float>;
using std::tie; using std::make_pair; using std::copy; using std::get;
constexpr auto w = int(simd_width<float>);
const auto _real = &m_X[0], _imag = &m_X[m_spacing]
,_real_Dh = &m_X_Dh[0], _imag_Dh = &m_X_Dh[m_spacing]
,_real_Th = &m_X_Th[0], _imag_Th = &m_X_Th[m_spacing]
,_real_TDh = &m_X_TDh[0], _imag_TDh = &m_X_TDh[m_spacing]
;
auto _cmul = [](auto r0, auto i0, auto r1, auto i1) {
return make_pair(r0 * r1 - i0 * i1, r0 * i1 + r1 * i0);
};
auto _pcmul = [&](auto x0, auto x1) {
return _cmul(std::get<0>(x0),std::get<1>(x0),
std::get<0>(x1),std::get<1>(x1));
};
auto _cinv = [e=m_epsilon](auto r, auto i) {
auto n = bs::rec(bs::sqr(r) + bs::sqr(i) + e);//bs::Eps<float>());
return make_pair(r * n , -i * n);
};
dst.reset(m_size, _when);
for(auto i = 0; i < m_coef; i += w ) {
auto _X_r = reg(_real + i), _X_i = reg(_imag + i);
bs::store(_X_r, dst.X_real() + i);
bs::store(_X_i, dst.X_imag() + i);
{
auto _X_mag = bs::hypot(_X_i,_X_r);
bs::store(_X_mag, dst.mag_data() + i);
bs::store(bs::log(_X_mag), dst.M_data() + i);
bs::store(bs::atan2(_X_i,_X_r), dst.Phi_data() + i);
}
tie(_X_r, _X_i) = _cinv(_X_r,_X_i);
auto _Dh_over_X = _cmul( reg(_real_Dh + i),reg(_imag_Dh + i) ,_X_r, _X_i );
bs::store(get<0>(_Dh_over_X), &dst.dM_dt [0] + i);
bs::store(get<1>(_Dh_over_X), &dst.dPhi_dt[0] + i);
auto _Th_over_X = _cmul( reg(_real_Th + i),reg(_imag_Th + i) ,_X_r, _X_i );
bs::store(-get<1>(_Th_over_X), &dst.dM_dw [0] + i);
bs::store( get<0>(_Th_over_X), &dst.dPhi_dw[0] + i);
auto _TDh_over_X = std::get<0>(_cmul( reg(_real_TDh + i),reg(_imag_TDh + i) ,_X_r, _X_i ));
auto _Th_Dh_over_X2 = std::get<0>(_pcmul(_Th_over_X,_Dh_over_X));
bs::store(_TDh_over_X - _Th_Dh_over_X2,&dst.d2Phi_dtdw[0] + i);
}
for(auto i = 0; i < m_coef; ++i) {
auto _X_r = *(_real + i), _X_i = *(_imag + i);
bs::store(_X_r, dst.X_real() + i);
bs::store(_X_i, dst.X_imag() + i);
{
auto _X_mag = bs::hypot(_X_i,_X_r);
bs::store(_X_mag, dst.mag_data() + i);
bs::store(bs::log(_X_mag), dst.M_data() + i);
bs::store(bs::atan2(_X_i,_X_r), dst.Phi_data() + i);
}
tie(_X_r, _X_i) = _cinv(_X_r,_X_i);
auto _Dh_over_X = _cmul( *(_real_Dh + i),*(_imag_Dh + i) ,_X_r, _X_i );
bs::store(get<0>(_Dh_over_X), &dst.dM_dt [0] + i);
bs::store(get<1>(_Dh_over_X), &dst.dPhi_dt[0] + i);
auto _Th_over_X = _cmul( *(_real_Th + i),*(_imag_Th + i) ,_X_r, _X_i );
bs::store(-get<1>(_Th_over_X), &dst.dM_dw [0] + i);
bs::store( get<0>(_Th_over_X), &dst.dPhi_dw[0] + i);
auto _TDh_over_X = std::get<0>(_cmul( *(_real_TDh + i),*(_imag_TDh + i) ,_X_r, _X_i ));
auto _Th_Dh_over_X2 = std::get<0>(_pcmul(_Th_over_X,_Dh_over_X));
bs::store(_TDh_over_X - _Th_Dh_over_X2,&dst.d2Phi_dtdw[0] + i);
}
}
int ReFFT::spacing() const
{
return m_spacing;
}
int ReFFT::size() const
{
return m_size;
}
int ReFFT::coefficients() const
{
return m_coef;
}
void ReFFT::updateGroupDelay(ReSpectrum &spec)
{
auto _lgd = spec.local_group_delay();
auto _lgda = spec.local_group_delay_acc();
auto _lgdw = spec.local_group_delay_weight();
auto _ltime = spec.local_time();
auto _mag = spec.mag_data();
auto _dPhi_dw = spec.dPhi_dw_data();
auto fr = 0.9f;//bs::pow(10.0f, -40.0f/20.0f);
auto ep = bs::sqrt(m_epsilon * fr * bs::rec(1-fr));
bs::transform(_mag,_mag + m_coef, _lgdw, [ep](auto m) {
auto _res = bs::is_less(m,decltype(m)(ep));
return bs::if_zero_else_one(_res);
});
/* std::transform(_mag,_mag + m_coef, _lgdw,[ep](auto m) {
return (m > ep) ? 1.0f : 0.0f;
});*/
bs::transform(_lgdw,_lgdw + m_coef, _dPhi_dw, _lgda,bs::multiplies);
std::partial_sum(_lgda,_lgda+m_coef,_lgda);
std::partial_sum(_lgdw,_lgdw+m_coef,_lgdw);
auto i = 0;
auto hi_bound = [](auto x){return (x * 1200)/1024;};
auto lo_bound = [](auto x){return (x * 860 )/1024;};
for(; i < m_coef - 8 && hi_bound(i) < i + 8; ++i) {
auto hi = i + 8;
auto lo = lo_bound(i);
auto _w = _lgdw[hi] - _lgdw[lo] + m_epsilon;
auto _d = _lgda[hi] - _lgda[lo];
_lgd[i] = -_d * bs::rec(_w);
}
for(; hi_bound(i) < m_coef; ++i) {
auto hi = hi_bound(i);
auto lo = lo_bound(i);
auto _w = _lgdw[hi] - _lgdw[lo] + m_epsilon;
auto _d = _lgda[hi] - _lgda[lo];
_lgd[i] = -_d * bs::rec(_w);
}
{
auto hi = m_coef - 1;
auto hiw = _lgdw[hi];
auto hid = _lgda[hi];
for(; i < m_coef; ++i) {
auto lo = lo_bound(i);
auto _w = hiw - _lgdw[lo] + m_epsilon;
auto _d = hid - _lgda[lo];
_lgd[i] = -_d * bs::rec(_w);
}
}
bs::transform(_lgd,_lgd+m_coef, _ltime, [w=float(spec.when())](auto x){return x + w;});
}
| [
"gdkar@alum.mit.edu"
] | gdkar@alum.mit.edu |
3e7ad41fb531cd7880edde73953569f83d0f00fa | 527421f3589e943db64c476656927c62829d1524 | /kernel/lib/userboot/userboot.cpp | dadb16b238c4305342cfd39eb98d444f0c0619cf | [] | no_license | wahwahwinner/smartnix | 5e0d0248ed8eaeb38d51a4b44c41eaa21d9c9b59 | f3aa1cc8873ec08f3ea7d66713843d3fdbebd7b5 | refs/heads/master | 2020-04-28T21:01:49.414154 | 2019-03-04T03:58:26 | 2019-03-04T03:58:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,371 | cpp |
#include <assert.h>
#include <err.h>
#include <inttypes.h>
#include <platform.h>
#include <trace.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <kernel/cmdline.h>
#include <vm/vm_object_paged.h>
#include <lib/console.h>
#include <lib/vdso.h>
#include <lk/init.h>
#include <mexec.h>
#include <object/channel_dispatcher.h>
#include <object/handle.h>
#include <object/job_dispatcher.h>
#include <object/message_packet.h>
#include <object/process_dispatcher.h>
#include <object/resource_dispatcher.h>
#include <object/thread_dispatcher.h>
#include <object/vm_address_region_dispatcher.h>
#include <object/vm_object_dispatcher.h>
#include <zircon/processargs.h>
#include <zircon/stack.h>
#if ENABLE_ENTROPY_COLLECTOR_TEST
#include <lib/crypto/entropy/quality_test.h>
#endif
static const size_t stack_size = ZIRCON_DEFAULT_STACK_SIZE;
#define STACK_VMO_NAME "userboot-initial-stack"
#define RAMDISK_VMO_NAME "userboot-raw-ramdisk"
#define CRASHLOG_VMO_NAME "crashlog"
namespace {
#include "userboot-code.h"
// This is defined in assembly by userboot-image.S; userboot-code.h
// gives details about the image's size and layout.
extern "C" const char userboot_image[];
class UserbootImage : private RoDso {
public:
explicit UserbootImage(const VDso* vdso)
: RoDso("userboot", userboot_image,
USERBOOT_CODE_END, USERBOOT_CODE_START),
vdso_(vdso) {}
// The whole userboot image consists of the userboot rodso image
// immediately followed by the vDSO image. This returns the size
// of that combined image.
size_t size() const {
return RoDso::size() + vdso_->size();
}
zx_status_t Map(fbl::RefPtr<VmAddressRegionDispatcher> root_vmar,
uintptr_t* vdso_base, uintptr_t* entry) {
// Create a VMAR (placed anywhere) to hold the combined image.
fbl::RefPtr<VmAddressRegionDispatcher> vmar;
zx_rights_t vmar_rights;
zx_status_t status = root_vmar->Allocate(0, size(),
ZX_VM_CAN_MAP_READ |
ZX_VM_CAN_MAP_WRITE |
ZX_VM_CAN_MAP_EXECUTE |
ZX_VM_CAN_MAP_SPECIFIC,
&vmar, &vmar_rights);
if (status != ZX_OK)
return status;
// Map userboot proper.
status = RoDso::Map(vmar, 0);
if (status == ZX_OK) {
*entry = vmar->vmar()->base() + USERBOOT_ENTRY;
// Map the vDSO right after it.
*vdso_base = vmar->vmar()->base() + RoDso::size();
status = vdso_->Map(fbl::move(vmar), RoDso::size());
}
return status;
}
private:
const VDso* vdso_;
};
} // anonymous namespace
// Get a handle to a VM object, with full rights except perhaps for writing.
static zx_status_t get_vmo_handle(fbl::RefPtr<VmObject> vmo, bool readonly,
fbl::RefPtr<VmObjectDispatcher>* disp_ptr,
Handle** ptr) {
if (!vmo)
return ZX_ERR_NO_MEMORY;
zx_rights_t rights;
fbl::RefPtr<Dispatcher> dispatcher;
zx_status_t result = VmObjectDispatcher::Create(
fbl::move(vmo), &dispatcher, &rights);
if (result == ZX_OK) {
if (disp_ptr)
*disp_ptr = fbl::RefPtr<VmObjectDispatcher>::Downcast(dispatcher);
if (readonly)
rights &= ~ZX_RIGHT_WRITE;
if (ptr)
*ptr = Handle::Make(fbl::move(dispatcher), rights).release();
}
return result;
}
static zx_status_t get_job_handle(Handle** ptr) {
zx_rights_t rights;
fbl::RefPtr<Dispatcher> dispatcher;
zx_status_t result = JobDispatcher::Create(
0u, GetRootJobDispatcher(), &dispatcher, &rights);
if (result == ZX_OK)
*ptr = Handle::Make(fbl::move(dispatcher), rights).release();
return result;
}
static zx_status_t get_resource_handle(Handle** ptr) {
zx_rights_t rights;
fbl::RefPtr<ResourceDispatcher> root;
zx_status_t result = ResourceDispatcher::Create(&root, &rights, ZX_RSRC_KIND_ROOT, 0, 0, 0,
"root");
if (result == ZX_OK)
*ptr = Handle::Make(fbl::RefPtr<Dispatcher>(root.get()),
rights).release();
return result;
}
// Create a channel and write the bootstrap message down one side of
// it, returning the handle to the other side.
static zx_status_t make_bootstrap_channel(
fbl::RefPtr<ProcessDispatcher> process,
fbl::unique_ptr<MessagePacket> msg,
zx_handle_t* out) {
HandleOwner user_channel_handle;
fbl::RefPtr<ChannelDispatcher> kernel_channel;
*out = ZX_HANDLE_INVALID;
{
fbl::RefPtr<Dispatcher> mpd0, mpd1;
zx_rights_t rights;
zx_status_t status = ChannelDispatcher::Create(&mpd0, &mpd1, &rights);
if (status != ZX_OK)
return status;
user_channel_handle = Handle::Make(fbl::move(mpd0), rights);
kernel_channel = DownCastDispatcher<ChannelDispatcher>(&mpd1);
}
// Here it goes!
zx_status_t status = kernel_channel->Write(ZX_KOID_INVALID, fbl::move(msg));
if (status != ZX_OK)
return status;
zx_handle_t hv = process->MapHandleToValue(user_channel_handle);
process->AddHandle(fbl::move(user_channel_handle));
*out = hv;
return ZX_OK;
}
enum bootstrap_handle_index {
BOOTSTRAP_VDSO,
BOOTSTRAP_VDSO_LAST_VARIANT = BOOTSTRAP_VDSO + VDso::variants() - 1,
BOOTSTRAP_RAMDISK,
BOOTSTRAP_RESOURCE_ROOT,
BOOTSTRAP_STACK,
BOOTSTRAP_PROC,
BOOTSTRAP_THREAD,
BOOTSTRAP_JOB,
BOOTSTRAP_VMAR_ROOT,
BOOTSTRAP_CRASHLOG,
#if ENABLE_ENTROPY_COLLECTOR_TEST
BOOTSTRAP_ENTROPY_FILE,
#endif
BOOTSTRAP_HANDLES
};
struct bootstrap_message {
zx_proc_args_t header;
uint32_t handle_info[BOOTSTRAP_HANDLES];
char cmdline[CMDLINE_MAX];
};
static fbl::unique_ptr<MessagePacket> prepare_bootstrap_message() {
const size_t data_size =
offsetof(struct bootstrap_message, cmdline) +
__kernel_cmdline_size;
bootstrap_message* msg =
static_cast<bootstrap_message*>(malloc(data_size));
if (msg == nullptr) {
return nullptr;
}
memset(&msg->header, 0, sizeof(msg->header));
msg->header.protocol = ZX_PROCARGS_PROTOCOL;
msg->header.version = ZX_PROCARGS_VERSION;
msg->header.environ_off = offsetof(struct bootstrap_message, cmdline);
msg->header.environ_num = static_cast<uint32_t>(__kernel_cmdline_count);
msg->header.handle_info_off =
offsetof(struct bootstrap_message, handle_info);
for (int i = 0; i < BOOTSTRAP_HANDLES; ++i) {
uint32_t info = 0;
switch (static_cast<bootstrap_handle_index>(i)) {
case BOOTSTRAP_VDSO ... BOOTSTRAP_VDSO_LAST_VARIANT:
info = PA_HND(PA_VMO_VDSO, i - BOOTSTRAP_VDSO);
break;
case BOOTSTRAP_RAMDISK:
info = PA_HND(PA_VMO_BOOTDATA, 0);
break;
case BOOTSTRAP_RESOURCE_ROOT:
info = PA_HND(PA_RESOURCE, 0);
break;
case BOOTSTRAP_STACK:
info = PA_HND(PA_VMO_STACK, 0);
break;
case BOOTSTRAP_PROC:
info = PA_HND(PA_PROC_SELF, 0);
break;
case BOOTSTRAP_THREAD:
info = PA_HND(PA_THREAD_SELF, 0);
break;
case BOOTSTRAP_JOB:
info = PA_HND(PA_JOB_DEFAULT, 0);
break;
case BOOTSTRAP_VMAR_ROOT:
info = PA_HND(PA_VMAR_ROOT, 0);
break;
case BOOTSTRAP_CRASHLOG:
info = PA_HND(PA_VMO_KERNEL_FILE, 0);
break;
#if ENABLE_ENTROPY_COLLECTOR_TEST
case BOOTSTRAP_ENTROPY_FILE:
info = PA_HND(PA_VMO_KERNEL_FILE, 1);
break;
#endif
case BOOTSTRAP_HANDLES:
__builtin_unreachable();
}
msg->handle_info[i] = info;
}
memcpy(msg->cmdline, __kernel_cmdline, __kernel_cmdline_size);
fbl::unique_ptr<MessagePacket> packet;
uint32_t num_handles = BOOTSTRAP_HANDLES;
zx_status_t status =
MessagePacket::Create(msg, static_cast<uint32_t>(data_size), num_handles, &packet);
free(msg);
if (status != ZX_OK) {
return nullptr;
}
return packet;
}
static void clog_to_vmo(const void* data, size_t off, size_t len, void* cookie) {
VmObject* vmo = static_cast<VmObject*>(cookie);
vmo->Write(data, off, len);
}
// Converts platform crashlog into a VMO
static zx_status_t crashlog_to_vmo(fbl::RefPtr<VmObject>* out) {
size_t size = platform_recover_crashlog(0, NULL, NULL);
fbl::RefPtr<VmObject> crashlog_vmo;
zx_status_t status = VmObjectPaged::Create(PMM_ALLOC_FLAG_ANY, 0u, size, &crashlog_vmo);
if (status != ZX_OK) {
return status;
}
platform_recover_crashlog(size, crashlog_vmo.get(), clog_to_vmo);
crashlog_vmo->set_name(CRASHLOG_VMO_NAME, sizeof(CRASHLOG_VMO_NAME) - 1);
mexec_stash_crashlog(crashlog_vmo);
*out = fbl::move(crashlog_vmo);
return ZX_OK;
}
static zx_status_t attempt_userboot() {
size_t rsize;
void* rbase = platform_get_ramdisk(&rsize);
if (rbase)
dprintf(INFO, "userboot: ramdisk %#15zx @ %p\n", rsize, rbase);
fbl::RefPtr<VmObject> stack_vmo;
zx_status_t status = VmObjectPaged::Create(PMM_ALLOC_FLAG_ANY, 0u, stack_size, &stack_vmo);
if (status != ZX_OK)
return status;
stack_vmo->set_name(STACK_VMO_NAME, sizeof(STACK_VMO_NAME) - 1);
fbl::RefPtr<VmObject> rootfs_vmo;
status = VmObjectPaged::CreateFromROData(rbase, rsize, &rootfs_vmo);
if (status != ZX_OK)
return status;
rootfs_vmo->set_name(RAMDISK_VMO_NAME, sizeof(RAMDISK_VMO_NAME) - 1);
fbl::RefPtr<VmObject> crashlog_vmo;
status = crashlog_to_vmo(&crashlog_vmo);
if (status != ZX_OK)
return status;
// Prepare the bootstrap message packet. This puts its data (the
// kernel command line) in place, and allocates space for its handles.
// We'll fill in the handles as we create things.
fbl::unique_ptr<MessagePacket> msg = prepare_bootstrap_message();
if (!msg)
return ZX_ERR_NO_MEMORY;
Handle** const handles = msg->mutable_handles();
DEBUG_ASSERT(msg->num_handles() == BOOTSTRAP_HANDLES);
status = get_vmo_handle(rootfs_vmo, false, nullptr,
&handles[BOOTSTRAP_RAMDISK]);
fbl::RefPtr<VmObjectDispatcher> stack_vmo_dispatcher;
if (status == ZX_OK)
status = get_vmo_handle(stack_vmo, false, &stack_vmo_dispatcher,
&handles[BOOTSTRAP_STACK]);
if (status == ZX_OK)
status = get_vmo_handle(crashlog_vmo, true, nullptr,
&handles[BOOTSTRAP_CRASHLOG]);
if (status == ZX_OK)
status = get_resource_handle(&handles[BOOTSTRAP_RESOURCE_ROOT]);
if (status == ZX_OK)
status = get_job_handle(&handles[BOOTSTRAP_JOB]);
#if ENABLE_ENTROPY_COLLECTOR_TEST
if (status == ZX_OK) {
if (crypto::entropy::entropy_was_lost) {
status = ZX_ERR_INTERNAL;
} else {
status = get_vmo_handle(
crypto::entropy::entropy_vmo,
/* readonly */ true, /* disp_ptr */ nullptr,
&handles[BOOTSTRAP_ENTROPY_FILE]);
}
}
#endif
if (status != ZX_OK)
return status;
fbl::RefPtr<Dispatcher> proc_disp;
fbl::RefPtr<VmAddressRegionDispatcher> vmar;
zx_rights_t rights, vmar_rights;
status = ProcessDispatcher::Create(GetRootJobDispatcher(), "userboot", 0,
&proc_disp, &rights,
&vmar, &vmar_rights);
if (status != ZX_OK)
return status;
handles[BOOTSTRAP_PROC] = Handle::Make(proc_disp, rights).release();
auto proc = DownCastDispatcher<ProcessDispatcher>(&proc_disp);
ASSERT(proc);
handles[BOOTSTRAP_VMAR_ROOT] = Handle::Make(vmar, vmar_rights).release();
const VDso* vdso = VDso::Create();
for (size_t i = BOOTSTRAP_VDSO; i <= BOOTSTRAP_VDSO_LAST_VARIANT; ++i) {
HandleOwner vmo_handle =
vdso->vmo_handle(static_cast<VDso::Variant>(i - BOOTSTRAP_VDSO));
handles[i] = vmo_handle.release();
}
UserbootImage userboot(vdso);
uintptr_t vdso_base = 0;
uintptr_t entry = 0;
status = userboot.Map(vmar, &vdso_base, &entry);
if (status != ZX_OK)
return status;
// Map the stack anywhere.
fbl::RefPtr<VmMapping> stack_mapping;
status = vmar->Map(0,
fbl::move(stack_vmo), 0, stack_size,
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE,
&stack_mapping);
if (status != ZX_OK)
return status;
uintptr_t stack_base = stack_mapping->base();
uintptr_t sp = compute_initial_stack_pointer(stack_base, stack_size);
// Create the user thread and stash its handle for the bootstrap message.
fbl::RefPtr<ThreadDispatcher> thread;
{
fbl::RefPtr<Dispatcher> ut_disp;
// Make a copy of proc, as we need to a keep a copy for the
// bootstrap message.
status = ThreadDispatcher::Create(proc, 0, "userboot", &ut_disp, &rights);
if (status != ZX_OK)
return status;
handles[BOOTSTRAP_THREAD] = Handle::Make(ut_disp, rights).release();
thread = DownCastDispatcher<ThreadDispatcher>(&ut_disp);
}
DEBUG_ASSERT(thread);
// All the handles are in place, so we can send the bootstrap message.
zx_handle_t hv;
status = make_bootstrap_channel(proc, fbl::move(msg), &hv);
if (status != ZX_OK)
return status;
dprintf(SPEW, "userboot: %-23s @ %#" PRIxPTR "\n", "entry point", entry);
// Start the process's initial thread.
status = thread->Start(entry, sp, static_cast<uintptr_t>(hv), vdso_base,
/* initial_thread= */ true);
if (status != ZX_OK) {
printf("userboot: failed to start initial thread: %d\n", status);
return status;
}
return ZX_OK;
}
void userboot_init(uint level) {
attempt_userboot();
}
LK_INIT_HOOK(userboot, userboot_init, LK_INIT_LEVEL_USER);
| [
"376305680@qq.com"
] | 376305680@qq.com |
285c592161eae7c5bca0d84c0d4a2d8769e892f1 | 31bd4984f3cb44e1292321895cec5ff5d993aac6 | /addons/ofxCvOpticalFlowLK/ofxCvOpticalFlowLK.h | 347b87e34c06c58308b321ef9e5db4929a723d3c | [
"MIT"
] | permissive | HellicarAndLewis/Triptych | a221a1cd58d9232ca58adbaad5f3610eba6547eb | 866e865f60ddd24efee57a6a8904567669ff71a4 | refs/heads/master | 2020-12-24T15:31:57.395363 | 2013-12-12T13:30:49 | 2013-12-12T13:30:49 | 4,615,958 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,954 | h | //
// ofxCvOpticalFlowLK.h - a OpenCV cvOpticalFlowLK warpper for openFrameworks
//
// Copyright (C) 2008 Takashi Maekawa <takachin@generative.info>
// All rights reserved.
// This is free software with ABSOLUTELY NO WARRANTY.
//
// You can redistribute it and/or modify it under the terms of
// the GNU Lesser General Public License.
//
#pragma once
#include "ofMain.h"
#include "ofxCvConstants.h"
#include "ofxCvGrayscaleImage.h"
class ofxCvOpticalFlowLK: public ofBaseDraws
{
public:
ofxCvOpticalFlowLK(void);
~ofxCvOpticalFlowLK(void);
void allocate(int _w, int _h);
void calc( ofxCvGrayscaleImage & pastImage, ofxCvGrayscaleImage & currentImage, int size);
void setCalcStep(int _cols, int _rows);
void reset();
void draw();
float getTotalMovement();
void draw(float x,float y) {
glPushMatrix();
glTranslatef(x, y, 0);
draw();
glPopMatrix();
}
bool forceAtPos(const ofVec2f &pos, ofVec2f &force) {
if(pos.x<captureWidth && pos.y < captureHeight && pos.x>=0 && pos.y>=0) {
force.x = cvGetReal2D(vel_x, pos.y, pos.x);
force.y = cvGetReal2D(vel_y, pos.y, pos.x);
return true;
} else {
return false;
}
}
void forceAtPos(float x, float y, float *dx, float *dy) {
if(x<captureWidth && y<captureHeight && x>=0 && y>=0) {
*dx = cvGetReal2D( vel_x, y, x );
*dy = cvGetReal2D( vel_y, y, x );
}
}
void draw(float x,float y,float w, float h) {
glPushMatrix();
glScalef(w/captureWidth, h/captureHeight, 1);
draw(x, y);
glPopMatrix();
}
int captureWidth;
int captureHeight;
IplImage* vel_x;
IplImage* vel_y;
float getWidth() { return captureWidth; }
float getHeight() { return captureHeight; }
static const int DEFAULT_CAPTURE_WIDTH = 320;
static const int DEFAULT_CAPTURE_HEIGHT = 240;
static const int DEFAULT_CAPTURE_COLS_STEP = 4;
static const int DEFAULT_CAPTURE_ROWS_STEP = 4;
int captureColsStep;
int captureRowsStep;
void blur(int flowBlur);
};
| [
"bereza@gmail.com"
] | bereza@gmail.com |
194d430f35af5845eabf51a09e706ba4daf37b08 | f221ab39e0d2c307be6fbf7adf58f636b24bdeea | /lib/FastPatchList.cpp | 69778839215440ea709a601913eba4f7e6a4d76b | [
"BSD-3-Clause"
] | permissive | ChristianFrisson/NMPT | 3a40e81e5e69f03980d7460d1d3ccf18d4bc3978 | dda56fa5202bde140500120ee472465d386b685c | refs/heads/master | 2021-01-20T07:00:10.101779 | 2018-07-18T00:46:30 | 2018-07-18T00:46:30 | 11,305,943 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,475 | cpp | /*
* FastPatchList.cpp
* OpenCV
*
* Created by Nicholas Butko on 7/25/09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "FastPatchList.h"
#include "DebugGlobals.h"
#include <math.h>
#include <iostream>
#include <opencv2/core/core.hpp>
using namespace std;
using namespace cv;
FastPatchList::FastPatchList(Size minSize, Size maxSize, double scaleInc, double stepWidth,
cv::Size patchSize, int scaleStepWidth) : PatchList(minSize, maxSize, scaleInc, stepWidth, patchSize), scalestepwidth(scaleStepWidth){
}
void FastPatchList::resetPointers() {
if (_PATCHLIST_DEBUG) cout<< "FastPatchList Reset Pointers" << endl;
resetContainerSizes();
double* dest1 = (double*)filterImage.data;
double* dest2 = (double*)accumulatorImage.data;
int dstWidthStep1 = filterImage.step/sizeof(double);
int dstWidthStep2 = accumulatorImage.step/sizeof(double);
const integral_type* integralData = images[0]->startOfIntegralData();
Size mins = getMinEffectivePatchSize();
double currWidth = mins.width;
double currHeight = mins.height;
double currInc = stepwidth;
totalPatches = 0;
for (int i = 0; i < numScales; i++) {
Size s = images[0]->getImageSize();
int filterWidth = s.width - (int)currWidth + 1;
int filterHeight = s.height - (int)currHeight + 1;
int scalewidth = ceil(filterWidth *1.0/currInc);
int scaleheight = ceil(filterHeight*1.0/currInc);
numAtScale[i] = scalewidth*scaleheight;
scaleImageSizes[i] = cvSize(scalewidth,scaleheight);
scalePatchSizes[i]= cvSize((int)currWidth, (int)currHeight);
scaleFilterSizes[i]= cvSize((int)currWidth, (int)currHeight);
totalPatches+= numAtScale[i];
if (_PATCHLIST_DEBUG) cout<< "FastPatchList: Scale " << i << " expects " << numAtScale[i] << " patches of size " << (int)currWidth << "x" << (int)currHeight << "." << endl;
srcAtScales[i] = (const integral_type**)malloc(numAtScale[i]*sizeof(integral_type*));
destsAtScales[i] = (double**)malloc(numAtScale[i]*sizeof(double*));
accAtScales[i] = (double**)malloc(numAtScale[i]*sizeof(double*));
imLocAtScales[i] = (int*)malloc(numAtScale[i]*sizeof(int));
int ind = 0;
for (int j = 0; j < scaleheight; j++) {
int width = images[0]->getImageSize().width;
int rowInd1 = ((int)(j*currInc))*(images[0]->integralDataRowWidth());
int rowInd2 = j*dstWidthStep1;
int rowInd3 = j*dstWidthStep2;
int rowInd4 = ((int)(j*currInc))*(width);
for (int k = 0; k < scalewidth; k++) {
srcAtScales[i][ind] = &integralData[rowInd1+(int)(k*currInc)];
destsAtScales[i][ind] = &dest1[rowInd2+k];
accAtScales[i][ind] = &dest2[rowInd3+k];
imLocAtScales[i][ind] = rowInd4+(int)(k*currInc);
ind++;
}
}
//cout<< "Scale " << i << " found " << ind << " patches." << endl;
currWidth = currWidth*scaleinc;
currHeight = currHeight*scaleinc;
if (scalestepwidth) currInc = currInc*scaleinc;
}
if (_PATCHLIST_DEBUG) cout<< "In all, " << totalPatches << " patches were listed." << endl;
srcInds = (integral_type**)malloc(numAtScale[0]*sizeof(integral_type*));
destInds = (double**)malloc(numAtScale[0]*sizeof(double*));
accInds = (double**)malloc(numAtScale[0]*sizeof(double*));
imLoc = (int*)malloc(numAtScale[0]*sizeof(int));
shouldResetAccumulator = 1;
}
int FastPatchList::setImageAllScalesNeedsPointerReset(IplImage* newImage) {
Mat img = newImage;
oldNumScales = numScales;
origImageSize = img.size();
numScales = getEffectiveNumScales();
if (_PATCHLIST_DEBUG) cout<< "SetImage on FastPatchList with " << numScales << " scales." << endl;
if (numScales < 1) {
cout<< "Warning: There are no scales. Possibly the minimum size is larger than the image?" << endl;
}
int needsReset = 0;
for (int i = 0; i < numScales; i++) {
if (_PATCHLIST_DEBUG) cout << "For scale " << i << " needsReset is so far " << needsReset << endl;
if (i == 0 ) {
if (!images.empty()) {
if (_PATCHLIST_DEBUG) cout << "Replacing old patch." << endl;
//checking for a change in image size or underlying memory structure
const integral_type* previousIntegral = images[i]->startOfIntegralData();
Size s1 = images[i]->getImageSize();
images[i]->setImage(img,copyImageData,1);
Size s2 = images[i]->getImageSize();
if (s1.width != s2.width || s1.height != s2.height ||
previousIntegral != images[i]->startOfIntegralData() ){
if (_PATCHLIST_DEBUG) {
if (s1.width != s2.width)
cout << "Needs reset because image width at scale " << i
<< " changed from " << s1.width << " to "
<< s2.width << endl;
if (s1.height != s2.height)
cout << "Needs reset because image height at scale " << i
<< " changed from " << s1.height << " to "
<< s2.height << endl;
if (previousIntegral != images[i]->startOfIntegralData())
cout << "Needs reset because integral pointer at scale " << i
<< " changed from " << (void*)previousIntegral << " to "
<< (void*)images[i]->startOfIntegralData()<< endl;
}
needsReset = 1;
}
} else {
images.push_back(new ImagePatch());
images[0]->setImage(img,copyImageData,1);
needsReset = 1;
}
} else if ((unsigned int) i < images.size()) {
images[i] = images[0];
} else {
//cout << "Adding new one." << endl;
images.push_back(images[0]);
needsReset = 1;
}
}
return needsReset;
}
| [
"christian.frisson@gmail.com"
] | christian.frisson@gmail.com |
ddafe2f276010941feb6e654dd4d4f88fd803e1f | edcdce99f0102fb170074b5f7c438df3000568fc | /AST_algorithm.h | 8570472d125b34d2a78161013469fa8b2e0abf5d | [] | no_license | lavender94/CSCI561-resolution | 0468d607ae9bf6416b8215a7cf73b06165588787 | 89303c733fa37b5a882c4edfe6548d9f1cae94cf | refs/heads/master | 2021-03-18T03:57:12.459581 | 2017-11-18T00:24:22 | 2017-11-18T00:24:22 | 73,983,780 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 268 | h | #pragma once
#include "common.h"
#include <string>
#include "Parser.h"
Expression *EXP(Parser &p);
Expression *EXP2(Parser &p);
Expression *EXP3(Parser &p);
Expression *OP(Parser &p);
Expression *FUNC(Parser &p, std::string name);
Expression *buildAST(Parser &p);
| [
"hchen132@gmail.com"
] | hchen132@gmail.com |
ef99b6ab1b3879922be63648890b1875406f324d | e4db258fb2fdbdc1fce5fdf7357a7f7d309e78f7 | /template method/max1.hpp | 4fb20a0bad85edfde356add75f44d88e319f1fea | [] | no_license | cepiloth/develnote | d42a316ce72eded0a9d8df2314de8d8026e08229 | 4fd72f9b5a948e584b99a917a5b40907bbddff12 | refs/heads/master | 2021-06-22T16:57:33.641236 | 2021-04-14T03:04:43 | 2021-04-14T03:04:43 | 206,345,777 | 1 | 0 | null | null | null | null | UHC | C++ | false | false | 1,044 | hpp | #pragma once
// 2020-10-11
template<typename T>
T max (T a, T b)
{
// b < a 라면 a를 반환하고 아니라면 b를 반환한다.
return b > a ? a : b;
}
/*
역사적인 이유로 형식 파라미터를 저으이할 때 typenmae 대신 class 사용할 수도 있다.
typename이라는 키워드는 C++98 표준을 만드는 중 상당히 늦게 도입됐다.
그 전에는 형식 파라미터를 키워드 class로 도입해야 했기 때문에 여전히 typename 대신 class를 사용할 수 있다.
그래서 템플릿 max()는 다음처럼 정의해도 된다.
template<class T>
T max(T a, T b)
{
return b > a ? a : b;
}
의미상 두 함수는 다를 게 전혀 없다. 따라서 여기서 class를 사용하더라도 템플릿 인자로 어떠한 형식이든 사용할 수 있다.
하지만 class를 사용하면 오해할 수 있으므로(T로 클래스형만을 쓸 수 있는 게 아닌데도) typename을 사용하는 편이 좋다.
클래스형 선언과 달리 typename 대신 키워드 struct 는 쓸 수 없다.
*/ | [
"lim10260@nate.com"
] | lim10260@nate.com |
76e6dc2af4ac43f2fc8e8cf2081d00009a7ff427 | efaa8fe089e2ae47e582989e0035110df64d3732 | /week-03/day-3/BlogPost/main.cpp | 698be5d4600444499a12ba57e321520c82a3fbe7 | [] | no_license | green-fox-academy/gabortrajtler | b2416cba8c1d1c4bd05bbf71ac6c6bd8eb3ff83c | bc081a15fc7a1094928c4c428cb17faa6efc7369 | refs/heads/master | 2020-06-11T04:56:49.368008 | 2019-10-23T12:41:56 | 2019-10-23T12:41:56 | 193,855,290 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,384 | cpp | #include <iostream>
#include "BlogPost.h"
#include "Blog.h"
/*
*
* Create a BlogPost class that has
an authorName
a title
a text
a publicationDate
Create a few blog post objects:
"Lorem Ipsum" titled by John Doe posted at "2000.05.04."
Lorem ipsum dolor sit amet.
"Wait but why" titled by Tim Urban posted at "2010.10.10."
A popular long-form, stick-figure-illustrated blog about almost everything.
"One Engineer Is Trying to Get IBM to Reckon With Trump" titled by William Turton at "2017.03.28."
Daniel Hanley, a cybersecurity engineer at IBM, doesn’t want to be the center of attention. When I asked to take his picture outside one of IBM’s New York City offices, he told me that he wasn’t really into the whole organizer profile thing.
*
* Reuse your BlogPost class
Create a Blog class which can
store a list of BlogPosts
add BlogPosts to the list
delete(int) one item at given index
update(int, BlogPost) one item at the given index and update it with another BlogPost
*
*/
int main()
{
std::cout << "Blog Posts: " << std::endl;
BlogPost blogPost0("John Doe", "Lorem Ipsum", "Lorem ipsum dolor sit amet.", "2000.05.04.");
BlogPost blogPost1("Tim Urban", "Wait but why", "A popular long-form, stick-figure-illustrated blog about almost everything.", "2010.10.10.");
BlogPost blogPost2("William Turton", "One Engineer Is Trying to Get IBM to Reckon With Trump", "Daniel Hanley, a cybersecurity engineer at IBM, doesn’t want to be the center of attention. When I asked to take his picture outside one of IBM’s New York City offices, he told me that he wasn’t really into the whole organizer profile thing.", "2017.03.28.");
BlogPost blogPost3("William Turton", "One Engineer Is Trying to Get IBM to Reckon With Trump", "Daniel Hanley, a cybersecurity engineer at IBM, doesn't want to be the center of attention. When I asked to take his picture outside one of IBM's New York City offices, he told me that he wasn't really into the whole organizer profile thing.", "2017.03.28.");
/* std::cout << blogPost1.getTitle() << " titled by " << blogPost1.getAuthorName()
<< " posted at " << blogPost1.getPublicationDate() << " Text:" << std::endl;
std::cout << blogPost1.getText() << std::endl << std::endl;
std::cout << blogPost2.getTitle() << " titled by " << blogPost2.getAuthorName()
<< " posted at " << blogPost2.getPublicationDate() << " Text:" << std::endl;
std::cout << blogPost2.getText() << std::endl << std::endl;
std::cout << blogPost3.getTitle() << " titled by " << blogPost3.getAuthorName()
<< " posted at " << blogPost3.getPublicationDate() << " Text:" << std::endl;
std::cout << blogPost3.getText() << std::endl << std::endl;*/
Blog blog;
blog.add(blogPost0);
blog.add(blogPost1);
blog.add(blogPost2);
blog.deletePost(0);
blog.update(1, blogPost3);
std::cout << "Welcome to our Blog!" << std::endl;
for (int i = 0; i < blog.getBlog().size(); ++i) {
std::cout << blog.getBlog()[i].getTitle() << " titled by " << blog.getBlog()[i].getAuthorName()
<< " posted at " << blog.getBlog()[0].getPublicationDate() << " Text:" << std::endl;
std::cout << blog.getBlog()[i].getText() << std::endl << std::endl;
}
return 0;
} | [
"trajtlerg@gmail.com"
] | trajtlerg@gmail.com |
f950f1654162ea62c0f16b142cab3fdda0a54051 | cbd3ac62b75ac3dceb6ffb219eaa3fe9d2ef0c00 | /src/base/test/gtest_xml_util.h | 3775b7831770951a810cc0a08dbc55549db7f40d | [
"BSD-3-Clause"
] | permissive | crazypeace/naiveproxy | d403fa282bcf65cac3eacb519667d6767080d05d | 0a8242dca02b760272d4a0eb8f8a712f9d1093c4 | refs/heads/master | 2023-03-09T21:23:30.415305 | 2022-10-06T17:23:40 | 2022-10-06T17:23:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 830 | h | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_TEST_GTEST_XML_UTIL_H_
#define BASE_TEST_GTEST_XML_UTIL_H_
#include <vector>
namespace base {
class FilePath;
struct TestResult;
// Produces a vector of test results based on GTest output file.
// Returns true iff the output file exists and has been successfully parsed.
// On successful return and if non-null, |crashed| is set to true if the test
// results are valid but incomplete.
[[nodiscard]] bool ProcessGTestOutput(const base::FilePath& output_file,
std::vector<TestResult>* results,
bool* crashed);
} // namespace base
#endif // BASE_TEST_GTEST_XML_UTIL_H_
| [
"kizdiv@gmail.com"
] | kizdiv@gmail.com |
c14a022563a566a1d038bb525e67ea0bc694c5ec | 502a0c02e0a8e25a5277249f2595975bdcaabf4c | /Challenge280 - SOLVED/Challenge280/stdafx.cpp | 290110a8a856363e5cbca69ec1b00d7de31a9626 | [] | no_license | seanhouser/Daily_Challenges | 7e386cb3e30e795516b700963d1fe1b664a011b3 | de1f43424f70103c362c5bcee9563efac1d7a9ba | refs/heads/master | 2021-07-15T16:14:36.214786 | 2017-10-19T19:48:25 | 2017-10-19T19:48:25 | 43,339,918 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 291 | cpp | // stdafx.cpp : source file that includes just the standard includes
// Challenge280.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"seanmhouser@gmail.com"
] | seanmhouser@gmail.com |
82d075e227b96e28ad56ebaee083d785d8bf6c0e | 141e1ea2c92f3dfb68c3cf25699b40bebfad7007 | /psana/src/legion_helper.h | 5e2a7fe5be0f9b16fe0dd620e8497944acd0bdff | [] | no_license | brtnfld/lcls2 | 33c4973264f046830fd4d134b7635c2d8353ea15 | 250fdd53f764b6e9842b959ab36688debd9c49b6 | refs/heads/master | 2020-03-21T00:41:24.741236 | 2018-06-25T16:55:38 | 2018-06-25T16:55:38 | 137,905,284 | 0 | 0 | null | 2018-06-19T14:46:28 | 2018-06-19T14:46:27 | null | UTF-8 | C++ | false | false | 1,337 | h | #ifndef LEGION_HELPER_H
#define LEGION_HELPER_H
#ifndef PSANA_USE_LEGION
#error legion_helper.h requires PSANA_USE_LEGION
#endif
#include <stddef.h>
#include <vector>
#include <legion.h>
// Helper for creating a logical region
class LegionArray {
public:
LegionArray();
LegionArray(size_t bytes);
LegionArray(const LegionArray &array) = delete; // not supported
~LegionArray();
LegionArray &operator=(LegionArray &&array); // consumes array
operator bool() const;
char *get_pointer();
private:
Legion::LogicalRegionT<1> region;
Legion::PhysicalRegion physical;
template <class C, typename ... Ts>
friend class LegionTask;
};
// Helper for creating a task
template <class C, typename ... Ts>
class LegionTask {
public:
LegionTask();
LegionTask(Ts ... ts);
void add_array(const LegionArray &array);
void launch();
protected:
std::vector<LegionArray> arrays; // valid inside run()
private:
Legion::TaskLauncher launcher;
protected:
static Legion::TaskID register_task(const char *task_name);
public:
static void task_wrapper(const Legion::Task *task,
const std::vector<Legion::PhysicalRegion> ®ions,
Legion::Context ctx, Legion::Runtime *runtime);
};
#include "legion_helper.inl"
#endif
| [
"slaughter@cs.stanford.edu"
] | slaughter@cs.stanford.edu |
e48f9106829f23a9ab3205dbf714fa9728a22f79 | cecf6991e6007ee4bc32a82e438c9120b3826dad | /Ranking/Source/Updater.cpp | bdf78bd2f178877c4c5d61b255aa3c2fc2266d32 | [] | no_license | thinking2535/Rso | 172a3499400331439a530cab78934fa4c4433771 | 35d556463118825a1d5d36f49d46f18a05806169 | refs/heads/main | 2022-11-30T12:43:50.917063 | 2022-11-23T10:47:59 | 2022-11-23T10:47:59 | 31,525,549 | 11 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 49 | cpp | #include "Updater.h"
namespace rso::ranking
{
}
| [
"thinking2535@gmail.com"
] | thinking2535@gmail.com |
b72d7a0782028668ce0d0ce9826ec15dc97d1d3a | f9946f5d1283deece81f886de81b60829d7ca205 | /include/shared_data.h | ef0de2b5abf6a548676d908e3939681cd9324800 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | mg-code/tilemaker | 01843f9d862114a25807b3acb695cd24f6731ac9 | b1f326108ca33f6cc6e5f48cac9a3e10272d686a | refs/heads/master | 2020-03-22T21:54:18.602973 | 2018-07-13T07:45:26 | 2018-07-13T07:45:26 | 140,720,612 | 0 | 0 | null | 2018-07-12T13:59:32 | 2018-07-12T13:59:31 | null | UTF-8 | C++ | false | false | 1,353 | h | #ifndef _SHARED_DATA_H
#define _SHARED_DATA_H
#include <vector>
#include <map>
#include "rapidjson/document.h"
#include "osm_store.h"
#include "output_object.h"
#include "osm_object.h"
#include "mbtiles.h"
class Config
{
public:
std::vector<LayerDef> layers; // List of layers
std::map<std::string,uint> layerMap; // Layer->position map
std::vector<std::vector<uint> > layerOrder; // Order of (grouped) layers, e.g. [ [0], [1,2,3], [4] ]
uint baseZoom, startZoom, endZoom;
uint mvtVersion;
bool includeID, compress, gzip;
std::string compressOpt;
bool clippingBoxFromJSON;
double minLon, minLat, maxLon, maxLat;
std::string projectName, projectVersion, projectDesc;
std::string defaultView;
std::vector<Geometry> cachedGeometries; // prepared boost::geometry objects (from shapefiles)
Config();
virtual ~Config();
void readConfig(rapidjson::Document &jsonConfig, bool hasClippingBox, Box &clippingBox,
std::map< uint, std::vector<OutputObject> > &tileIndex, OSMObject &osmObject);
};
class SharedData
{
public:
uint zoom;
int threadNum;
OSMStore *osmStore;
bool verbose;
bool sqlite;
MBTiles mbtiles;
std::string outputFile;
std::map< uint, std::vector<OutputObject> > *tileIndexForZoom;
class Config config;
SharedData(OSMStore *osmStore);
virtual ~SharedData();
};
#endif //_SHARED_DATA_H
| [
"tim2009@sheerman-chase.org.uk"
] | tim2009@sheerman-chase.org.uk |
250b55c4b52f80dd481ed51feccebba13a44471b | d4058e13d7c5310cfbd889deecc27f9acdea9ea4 | /addcompilerwizard.h | 4f1109159d46a9e87fd3e51b30517d87df3053ef | [] | no_license | FreestyleOJ/Project_lemon | 24f95d5f6d6b55f7869f32ea39edcac403c3b984 | eda202936e40cf282b667fb106d5f2528daf9f59 | refs/heads/master | 2020-04-01T13:40:46.122735 | 2015-10-21T15:13:11 | 2015-10-21T15:13:11 | 43,739,368 | 7 | 5 | null | 2015-10-06T08:45:49 | 2015-10-06T08:45:49 | null | UTF-8 | C++ | false | false | 910 | h | #ifndef ADDCOMPILERWIZARD_H
#define ADDCOMPILERWIZARD_H
#include <QtCore>
#include <QtGui>
#include <QWizard>
namespace Ui {
class AddCompilerWizard;
}
class Compiler;
class AddCompilerWizard : public QWizard
{
Q_OBJECT
public:
explicit AddCompilerWizard(QWidget *parent = 0);
~AddCompilerWizard();
void accept();
const QList<Compiler*>& getCompilerList() const;
private:
Ui::AddCompilerWizard *ui;
QList<Compiler*> compilerList;
int nextId() const;
bool validateCurrentPage();
private slots:
void compilerTypeChanged();
void selectCompilerLocation();
void selectInterpreterLocation();
void selectGccPath();
void selectGppPath();
void selectFpcPath();
void selectFbcPath();
void selectJavacPath();
void selectJavaPath();
void selectPythonPath();
};
#endif // ADDCOMPILERWIZARD_H
| [
"crash@crash-VPCEA18EC.(none)"
] | crash@crash-VPCEA18EC.(none) |
320ff4b86c7a7febf7737bae1be9b0737864467b | 3f935da243e0839f15392d914d45f9c7037e1ddf | /DriverStation/main.cpp | 9bb5d42d925531b4588cef53e6522af150fe1f4a | [] | no_license | dgitz/DriverStation | d7fe1ab0c3f9ad9f6e8fa6acd9d309b4b65f6771 | 0110d75b465e75bf3c4514fb76006bf2aaecc1b0 | refs/heads/master | 2021-01-19T07:55:14.316051 | 2020-04-05T20:05:58 | 2020-04-05T20:05:58 | 83,970,385 | 0 | 1 | null | 2020-04-05T20:05:59 | 2017-03-05T13:04:31 | C++ | UTF-8 | C++ | false | false | 1,669 | cpp | #include "mainwindow.h"
#include <QApplication>
#include <QtCharts/QChartView>
#include <QDesktopWidget>
/*
class Player : public QCoreApplication
{
public:
Player(int argc, char **argv);
~Player();
private:
void onBusMessage(const QGst::MessagePtr & message);
private:
QGst::PipelinePtr pipeline1;
};
Player::Player(int argc, char **argv)
: VideoWidget(argc, argv)
{
QGst::init(&argc, &argv);
Need to implement this string as a string
gst-launch -v udpsrc port=8888 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false
const char *caps = "application/x-rtp, encoding-name=JPEG,payload=26";
QString pipe1Descr = QString("udpsrc port=5001 ! %1 ! rtpjpegdepay ! "
"jpegdec ! "
"autovideosink").arg(caps);
pipeline1 = QGst::Parse::launch(pipe1Descr).dynamicCast<QGst::Pipeline>();
QGlib::connect(pipeline1->bus(), "message::error", this, &Player::onBusMessage);
pipeline1->bus()->addSignalWatch();
pipeline1->setState(QGst::StatePlaying);
}
Player::~Player()
{
pipeline1->setState(QGst::StateNull);
}
void Player::onBusMessage(const QGst::MessagePtr & message)
{
switch (message->type()) {
case QGst::MessageEos:
quit();
break;
case QGst::MessageError:
qCritical() << message.staticCast<QGst::ErrorMessage>()->error();
break;
default:
break;
}
}
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.showFullScreen();
return a.exec();
}
| [
"davidgitz@gmail.com"
] | davidgitz@gmail.com |
7fc709b06e020795d6c55c0ae0a7312148d2fa69 | 77c518b87e67e9926d130f856a7edb12302596eb | /Filters/Sources/vtkPolyPointSource.h | 7abdc80b8338fa6d3ccda5dca20059b61a23a61b | [
"BSD-3-Clause"
] | permissive | t3dbrida/VTK | 73e308baa1e779f208421a728a4a15fec5c4f591 | e944bac3ba12295278dcbfa5d1cd7e71d6457bef | refs/heads/master | 2023-08-31T21:01:58.375533 | 2019-09-23T06:43:00 | 2019-09-23T06:43:00 | 139,547,456 | 2 | 0 | NOASSERTION | 2019-11-22T14:46:48 | 2018-07-03T07:49:14 | C++ | UTF-8 | C++ | false | false | 2,094 | h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPolyPointSource.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkPolyPointSource
* @brief create points from a list of input points
*
* vtkPolyPointSource is a source object that creates a vert from
* user-specified points. The output is a vtkPolyData.
*/
#ifndef vtkPolyPointSource_h
#define vtkPolyPointSource_h
#include "vtkFiltersSourcesModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
class vtkPoints;
class VTKFILTERSSOURCES_EXPORT vtkPolyPointSource : public vtkPolyDataAlgorithm
{
public:
static vtkPolyPointSource* New();
vtkTypeMacro(vtkPolyPointSource, vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@{
/**
* Set the number of points in the poly line.
*/
void SetNumberOfPoints(vtkIdType numPoints);
vtkIdType GetNumberOfPoints();
//@}
/**
* Resize while preserving data.
*/
void Resize(vtkIdType numPoints);
/**
* Set a point location.
*/
void SetPoint(vtkIdType id, double x, double y, double z);
//@{
/**
* Get the points.
*/
void SetPoints(vtkPoints* points);
vtkGetObjectMacro(Points, vtkPoints);
//@}
/**
* Get the mtime plus consider its Points
*/
vtkMTimeType GetMTime() override;
protected:
vtkPolyPointSource();
~vtkPolyPointSource() override;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector *) override;
vtkPoints* Points;
private:
vtkPolyPointSource(const vtkPolyPointSource&) = delete;
void operator=(const vtkPolyPointSource&) = delete;
};
#endif
| [
"ken.martin@kitware.com"
] | ken.martin@kitware.com |
9c559f0f6142643e58dd5f6891b311e7c63ed9d7 | 0acace81433043d274bbeb5628fc150cc0f2d072 | /Sources/Emulator/src/mess/machine/vic20user.h | 8a99aeb0e3a7e31f898ba4ab5fbcf8d66ac5f150 | [] | no_license | SonnyJim/MAMEHub | b11780c6e022b47b0be97e4670c49b15a55ec052 | aeaa71c5ebdcf33c06d56625810913a99d3a4a66 | refs/heads/master | 2020-12-03T03:36:28.729082 | 2014-07-11T13:04:23 | 2014-07-11T13:04:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,652 | h | /**********************************************************************
Commodore VIC-20 User Port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
GND 1 A GND
+5V 2 B CB1
/RESET 3 C PB0
JOY0 4 D PB1
JOY1 5 E PB2
JOY2 6 F PB3
LIGHT PEN 7 H PB4
CASSETTE SWITCH 8 J PB5
ATN 9 K PB6
+9VAC 10 L PB7
+9VAC 11 M CB2
GND 12 N GND
**********************************************************************/
#pragma once
#ifndef __VIC20_USER_PORT__
#define __VIC20_USER_PORT__
#include "emu.h"
//**************************************************************************
// CONSTANTS
//**************************************************************************
#define VIC20_USER_PORT_TAG "user"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define VIC20_USER_PORT_INTERFACE(_name) \
const vic20_user_port_interface (_name) =
#define MCFG_VIC20_USER_PORT_ADD(_tag, _config, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, VIC20_USER_PORT, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> vic20_user_port_interface
struct vic20_user_port_interface
{
devcb_write_line m_out_light_pen_cb;
devcb_write_line m_out_cb1_cb;
devcb_write_line m_out_cb2_cb;
devcb_write_line m_out_reset_cb;
};
// ======================> vic20_user_port_device
class device_vic20_user_port_interface;
class vic20_user_port_device : public device_t,
public vic20_user_port_interface,
public device_slot_interface
{
public:
// construction/destruction
vic20_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// computer interface
DECLARE_READ8_MEMBER( pb_r );
DECLARE_WRITE8_MEMBER( pb_w );
DECLARE_READ_LINE_MEMBER( joy0_r );
DECLARE_READ_LINE_MEMBER( joy1_r );
DECLARE_READ_LINE_MEMBER( joy2_r );
DECLARE_READ_LINE_MEMBER( light_pen_r );
DECLARE_READ_LINE_MEMBER( cassette_switch_r );
DECLARE_WRITE_LINE_MEMBER( cb1_w );
DECLARE_WRITE_LINE_MEMBER( cb2_w );
DECLARE_WRITE_LINE_MEMBER( atn_w );
DECLARE_WRITE_LINE_MEMBER( port_reset_w );
// cartridge interface
DECLARE_WRITE_LINE_MEMBER( light_pen_w ) { m_out_light_pen_func(state); }
DECLARE_WRITE_LINE_MEMBER( via_cb1_w ) { m_out_cb1_func(state); }
DECLARE_WRITE_LINE_MEMBER( via_cb2_w ) { m_out_cb2_func(state); }
DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_out_reset_func(state); }
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
devcb_resolved_write_line m_out_light_pen_func;
devcb_resolved_write_line m_out_cb1_func;
devcb_resolved_write_line m_out_cb2_func;
devcb_resolved_write_line m_out_reset_func;
device_vic20_user_port_interface *m_card;
};
// ======================> device_vic20_user_port_interface
// class representing interface-specific live vic20_expansion card
class device_vic20_user_port_interface : public device_slot_card_interface
{
public:
// construction/destruction
device_vic20_user_port_interface(const machine_config &mconfig, device_t &device);
virtual ~device_vic20_user_port_interface();
virtual UINT8 vic20_pb_r(address_space &space, offs_t offset) { return 0xff; };
virtual void vic20_pb_w(address_space &space, offs_t offset, UINT8 data) { };
virtual int vic20_joy0_r() { return 1; };
virtual int vic20_joy1_r() { return 1; };
virtual int vic20_joy2_r() { return 1; };
virtual int vic20_light_pen_r() { return 1; };
virtual int vic20_cassette_switch_r() { return 1; };
virtual void vic20_cb1_w(int state) { };
virtual void vic20_cb2_w(int state) { };
virtual void vic20_atn_w(int state) { };
protected:
vic20_user_port_device *m_slot;
};
// device type definition
extern const device_type VIC20_USER_PORT;
#endif
| [
"jgmath2000@gmail.com"
] | jgmath2000@gmail.com |
66bf6731d2b54181692cc3be4eae289983951821 | 82050f339441ed964202d8cf5252be757192d95e | /source/remote.cpp | f0f0c09200fd5d366c65018cb3e1477c193659e4 | [] | no_license | Raphaeloo/aquaExternal | e1844900776f09ea5e0d0c9a38a052cc94dfa952 | 0a2019843a324aed0a620f579e999e2b428c1fe0 | refs/heads/master | 2021-05-11T01:22:06.761162 | 2017-12-16T07:28:29 | 2017-12-16T07:28:29 | 118,326,482 | 1 | 0 | null | 2018-01-21T10:54:56 | 2018-01-21T10:54:56 | null | UTF-8 | C++ | false | false | 7,007 | cpp | #include "remote.h"
#define FINDPATTERN_CHUNKSIZE 0x1000
namespace remote
{
// Map Module
void* MapModuleMemoryRegion::find(Handle handle, const char* data, const char* pattern)
{
char buffer[FINDPATTERN_CHUNKSIZE];
size_t len = strlen(pattern);
size_t chunksize = sizeof(buffer);
size_t totalsize = this->end - this->start;
size_t chunknum = 0;
while (totalsize)
{
size_t readsize = (totalsize < chunksize) ? totalsize : chunksize;
size_t readaddr = this->start + (chunksize * chunknum);
bzero(buffer, chunksize);
if (handle.Read((void*) readaddr, buffer, readsize))
{
for (size_t b = 0; b < readsize; b++)
{
size_t matches = 0;
while (buffer[b + matches] == data[matches] || pattern[matches] != 'x')
{
matches++;
if (matches == len)
return (char*) (readaddr + b);
}
}
}
totalsize -= readsize;
chunknum++;
}
return NULL;
}
// Handle
Handle::Handle(pid_t target)
{
std::stringstream buffer;
buffer << target;
pid = target;
pidStr = buffer.str();
}
Handle::Handle(std::string target)
{
// Check to see if the string is numeric (no negatives or dec allowed, which makes this function usable)
if (strspn(target.c_str(), "0123456789") != target.size())
{
pid = -1;
pidStr.clear();
}
else
{
std::istringstream buffer(target);
pidStr = target;
buffer >> pid;
}
}
std::string Handle::GetPath()
{
return GetSymbolicLinkTarget(("/proc/" + pidStr + "/exe"));
}
std::string Handle::GetWorkingDirectory()
{
return GetSymbolicLinkTarget(("/proc/" + pidStr + "/cwd"));
}
bool Handle::IsValid()
{
return (pid != -1);
}
bool Handle::IsRunning()
{
if (!IsValid())
return false;
struct stat sts;
return !(stat(("/proc/" + pidStr).c_str(), &sts) == -1 && errno == ENOENT);
}
bool Handle::Write(void* address, void* buffer, size_t size)
{
struct iovec local[1];
struct iovec remote[1];
local[0].iov_base = buffer;
local[0].iov_len = size;
remote[0].iov_base = address;
remote[0].iov_len = size;
return (process_vm_writev(pid, local, 1, remote, 1, 0) == size);
}
bool Handle::Read(void* address, void* buffer, size_t size)
{
struct iovec local[1];
struct iovec remote[1];
local[0].iov_base = buffer;
local[0].iov_len = size;
remote[0].iov_base = address;
remote[0].iov_len = size;
return (process_vm_readv(pid, local, 1, remote, 1, 0) == size);
}
unsigned long Handle::GetCallAddress(void* address)
{
int code = 0;
if (Read((char*) address + 1, &code, sizeof(unsigned int)))
return (unsigned long)code + (unsigned long) address + 5;
return 0;
}
unsigned long Handle::GetAbsoluteAddress(void* address, int offset, int size)
{
int code = 0;
if(Read((char*) address + offset, &code, sizeof(unsigned int)))
return (unsigned long) address + code + size;
return 0;
}
MapModuleMemoryRegion* Handle::GetRegionOfAddress(void* address)
{
for (size_t i = 0; i < regions.size(); i++)
{
if (regions[i].start > (unsigned long) address && (regions[i].start + regions[i].end) <= (unsigned long) address)
return ®ions[i];
}
return NULL;
}
void Handle::ParseMaps()
{
regions.clear();
std::ifstream maps("/proc/" + pidStr + "/maps");
std::string line;
while (std::getline(maps, line))
{
std::istringstream iss(line);
std::string memorySpace, permissions, offset, device, inode;
if (iss >> memorySpace >> permissions >> offset >> device >> inode)
{
std::string pathname;
for (size_t ls = 0, i = 0; i < line.length(); i++)
{
if (line.substr(i, 1).compare(" ") == 0)
{
ls++;
if (ls == 5)
{
size_t begin = line.substr(i, line.size()).find_first_not_of(' ');
if (begin != -1)
pathname = line.substr(begin + i, line.size());
else
pathname.clear();
}
}
}
MapModuleMemoryRegion region;
size_t memorySplit = memorySpace.find_first_of('-');
size_t deviceSplit = device.find_first_of(':');
std::stringstream ss;
if (memorySplit != -1)
{
ss << std::hex << memorySpace.substr(0, memorySplit);
ss >> region.start;
ss.clear();
ss << std::hex << memorySpace.substr(memorySplit + 1, memorySpace.size());
ss >> region.end;
ss.clear();
}
if (deviceSplit != -1)
{
ss << std::hex << device.substr(0, deviceSplit);
ss >> region.deviceMajor;
ss.clear();
ss << std::hex << device.substr(deviceSplit + 1, device.size());
ss >> region.deviceMinor;
ss.clear();
}
ss << std::hex << offset;
ss >> region.offset;
ss.clear();
ss << inode;
ss >> region.inodeFileNumber;
region.readable = (permissions[0] == 'r');
region.writable = (permissions[1] == 'w');
region.executable = (permissions[2] == 'x');
region.shared = (permissions[3] != '-');
if (!pathname.empty())
{
region.pathname = pathname;
size_t fileNameSplit = pathname.find_last_of('/');
if (fileNameSplit != -1)
region.filename = pathname.substr(fileNameSplit + 1, pathname.size());
}
regions.push_back(region);
}
}
}
std::string Handle::GetSymbolicLinkTarget(std::string target)
{
char buf[PATH_MAX];
ssize_t len = ::readlink(target.c_str(), buf, sizeof(buf) - 1);
if (len != -1)
{
buf[len] = 0;
return std::string(buf);
}
return std::string();
}
};
unsigned long remote::getModule(const char * moduleName, pid_t pid)
{
char cmd[256];
FILE *maps;
unsigned long result = 0;
snprintf(cmd, 256, "grep \"%s\" /proc/%i/maps | head -n 1 | cut -d \"-\" -f1", moduleName, pid);
maps = popen(cmd, "r");
if (maps)
if (fscanf(maps, "%" SCNx64, &result));
pclose(maps);
return result;
}
// Functions Exported
bool remote::FindProcessByName(std::string name, remote::Handle* out)
{
if(out == NULL || name.empty())
return false;
struct dirent *dire;
DIR *dir = opendir("/proc/");
if (dir) {
while ((dire = readdir(dir)) != NULL)
{
if (dire->d_type != DT_DIR)
continue;
std::string mapsPath = ("/proc/" + std::string(dire->d_name) + "/maps");
if (access(mapsPath.c_str(), F_OK) == -1)
continue;
remote::Handle proc(dire->d_name);
if (!proc.IsValid() || !proc.IsRunning())
continue;
std::string procPath = proc.GetPath();
if(procPath.empty())
continue;
size_t namePos = procPath.find_last_of('/');
if(namePos == -1)
continue; // what?
std::string exeName = procPath.substr(namePos + 1);
if(exeName.compare(name) == 0)
{
*out = proc;
return true;
}
}
closedir(dir);
}
return false;
} | [
"filipeps3net@hotmail.com"
] | filipeps3net@hotmail.com |
ed02ecd38a52081ebbbac646dad577266409300b | 3ae0faf27a72aa9a0e69836bb73aaaec37b7a1e8 | /src/component/layout/zIndexComponent.cpp | aa31d528796a25695bff44e0d453725d83446307 | [] | no_license | Jackbenfu/Jackbengine | 9be48ee5a9623cf1a51c8106336858c38278b076 | 4036b4086c41736e0b00bfe3ea2eb3f3f0b72c08 | refs/heads/master | 2021-07-01T20:44:39.679403 | 2020-05-27T21:53:20 | 2020-05-27T21:53:20 | 63,488,028 | 5 | 0 | null | 2019-04-06T14:11:57 | 2016-07-16T15:00:26 | C++ | UTF-8 | C++ | false | false | 415 | cpp | //
// zIndexComponent.cpp
// jackbengine
//
// Created by Damien Bendejacq on 29/07/2017.
// Copyright © 2017 Damien Bendejacq. All rights reserved.
//
#include "zIndexComponent.hpp"
namespace Jackbengine {
ZIndexComponent::ZIndexComponent(uint index)
: m_index {index}
{
}
uint ZIndexComponent::index() const
{
return m_index;
}
void ZIndexComponent::setIndex(uint index)
{
m_index = index;
}
}
| [
"damien.bendejacq@iscool-e.com"
] | damien.bendejacq@iscool-e.com |
821567d7cb92f5489ccb9e22de5f2b342291fb29 | dac5254630fefae851da7c843dcab7f6a6af9703 | /Linux/Sources/Application/Address_Book/CGroupTable.cp | 020888673ec3609dc3131eac23720497d2e01393 | [
"Apache-2.0"
] | permissive | gpreviato/Mulberry-Mail | dd4e3618468fff36361bd2aeb0a725593faa0f8d | ce5c56ca7044e5ea290af8d3d2124c1d06f36f3a | refs/heads/master | 2021-01-20T03:31:39.515653 | 2017-09-21T13:09:55 | 2017-09-21T13:09:55 | 18,178,314 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 34,723 | cp | /*
Copyright (c) 2007 Cyrus Daboo. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Source for CGroupTable class
#include "CGroupTable.h"
#include "CAddressBook.h"
#include "CAddressBookView.h"
#include "CAddressBookWindow.h"
#include "CAddressList.h"
#include "CAddressView.h"
#include "CClipboard.h"
#include "CCommands.h"
#include "CEditGroupDialog.h"
#include "CErrorHandler.h"
#include "CGroup.h"
#include "CGroupList.h"
#include "CGroupTableAction.h"
#include "CIconLoader.h"
#include "CMessage.h"
#include "CMulberryApp.h"
#include "CMulSelectionData.h"
#include "CPreferences.h"
#include "CReplyChooseDialog.h"
#include "CTableRowGeometry.h"
#include "CTableRowSelector.h"
#include "CTaskClasses.h"
#include "CUserAction.h"
#include <UNX_LTableArrayStorage.h>
#include <JXColormap.h>
#include <JXDisplay.h>
#include <JXTextMenu.h>
#include <JTableSelection.h>
#include <jASCIIConstants.h>
#include <jXKeysym.h>
#include <algorithm>
#include <memory>
/////////////////////////////////////////////////////////////////////////////
// CGroupTable
// C O N S T R U C T I O N / D E S T R U C T I O N M E T H O D S
// Default constructor
CGroupTable::CGroupTable(JXScrollbarSet* scrollbarSet,
JXContainer* enclosure,
const HSizingOption hSizing,
const VSizingOption vSizing,
const JCoordinate x, const JCoordinate y,
const JCoordinate w, const JCoordinate h)
: CHierarchyTableDrag(scrollbarSet, enclosure, hSizing, vSizing, x,y,w,h)
{
SetBorderWidth(0);
mAdbk = NULL;
mTableView = NULL;
mEditAction = NULL;
mReplaceAction = NULL;
mLastTyping = 0UL;
mLastChars[0] = 0;
mTableGeometry = new CTableRowGeometry(this, 128, 18);
mTableSelector = new CTableRowSelector(this);
mTableStorage = new LTableArrayStorage(this, sizeof(SGroupTableItem));
SetRowSelect(true);
}
// Default destructor
CGroupTable::~CGroupTable()
{
if (mEditAction || mReplaceAction)
{
mTableView->GetUndoer()->PostAction(NULL);
mEditAction = NULL;
mReplaceAction = NULL;
}
}
// O T H E R M E T H O D S ____________________________________________________________________________
void CGroupTable::OnCreate()
{
// Find table view in super view chain
const JXContainer* parent = GetEnclosure();
while(parent && !dynamic_cast<const CAddressBookView*>(parent))
parent = parent->GetEnclosure();
mTableView = const_cast<CAddressBookView*>(dynamic_cast<const CAddressBookView*>(parent));
CHierarchyTableDrag::OnCreate();
// Get keys but not Tab which is used to shift focus
WantInput(kTrue);
SetKeySelection(true);
// Set Drag & Drop info
AddDropFlavor(CMulberryApp::sFlavorGrpList);
AddDragFlavor(GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom());
AddDragFlavor(GetDisplay()->GetSelectionManager()->GetTextXAtom());
AddDropFlavor(CMulberryApp::sFlavorMsgList);
AddDropFlavor(CMulberryApp::sFlavorAddrList);
AddDropFlavor(CMulberryApp::sFlavorGrpList);
AddDropFlavor(GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom());
AddDropFlavor(GetDisplay()->GetSelectionManager()->GetTextXAtom());
SetReadOnly(false);
SetDropCell(true);
SetAllowDrag(true);
SetSelfDrag(true);
SetAllowMove(false);
// Context menu
CreateContextMenu(CMainMenu::eContextAdbkGroup);
}
// Resize columns
void CGroupTable::ApertureResized(const JCoordinate dw, const JCoordinate dh)
{
CHierarchyTableDrag::ApertureResized(dw, dh);
// Single column always fills table width
if (mCols)
{
JCoordinate cw = GetApertureWidth();
if (cw < 32)
cw = 32;
SetColWidth(cw, 1, 1);
}
}
// Set dirty flag
void CGroupTable::SetDirty(bool dirty)
{
mDirty = dirty;
}
// Is it dirty
bool CGroupTable::IsDirty()
{
return mDirty;
}
void CGroupTable::DoSelectionChanged()
{
CHierarchyTableDrag::DoSelectionChanged();
// Determine whether preview is triggered
const CUserAction& preview = mTableView->GetPreviewAction();
if (preview.GetSelection())
DoPreview();
// Determine whether full view is triggered
const CUserAction& fullview = mTableView->GetFullViewAction();
if (fullview.GetSelection())
DoFullView();
}
// Handle single click
void CGroupTable::DoSingleClick(TableIndexT row, const CKeyModifiers& mods)
{
// Determine whether preview is triggered
const CUserAction& preview = mTableView->GetPreviewAction();
if (preview.GetSingleClick() &&
(preview.GetSingleClickModifiers() == mods))
DoPreview();
// Determine whether full view is triggered
const CUserAction& fullview = mTableView->GetFullViewAction();
if (fullview.GetSingleClick() &&
(fullview.GetSingleClickModifiers() == mods))
DoFullView();
}
// Handle double click
void CGroupTable::DoDoubleClick(TableIndexT row, const CKeyModifiers& mods)
{
// Determine whether preview is triggered
const CUserAction& preview = mTableView->GetPreviewAction();
if (preview.GetDoubleClick() &&
(preview.GetDoubleClickModifiers() == mods))
DoPreview();
// Determine whether full view is triggered
const CUserAction& fullview = mTableView->GetFullViewAction();
if (fullview.GetDoubleClick() &&
(fullview.GetDoubleClickModifiers() == mods))
DoFullView();
}
void CGroupTable::DoPreview()
{
// Ignore if no preview pane
if (!mTableView->GetPreview())
return;
CGroup* grp = NULL;
// Determine whether to do groups or address only
if (TestSelectionOr((TestSelectionPP) &CGroupTable::TestSelectionGroup))
{
// Create list to hold preview items (make sure list does not delete them when it is destroyed)
CGroupList grps;
grps.set_delete_data(false);
// Add each selected group
DoToSelection1((DoToSelection1PP) &CGroupTable::AddGroupToList, &grps);
// Set to single group only
if (grps.size() == 1)
grp = grps.front();
}
// Only do preview if there has been a change
if (grp != mTableView->GetPreview()->GetGroup())
{
// Always clear out message preview immediately, otherwise
// do preview at idle time to prevent re-entrant network calls
if (grp)
{
// Give it to preview (if its NULL the preview will be cleared)
CGroupPreviewTask* task = new CGroupPreviewTask(mTableView->GetPreview(), mAdbk, grp);
task->Go();
}
else
// do immediate update of preview
mTableView->GetPreview()->SetGroup(mAdbk, grp);
}
}
// Just edit the item
void CGroupTable::DoFullView()
{
DoEditEntry();
}
// Set the entry list
void CGroupTable::SetAddressBook(CAddressBook* adbk)
{
// Cache list
mAdbk = adbk;
if (mAdbk)
mAdbk->GetGroupList()->SetComparator(new CGroupComparator());
// Force reset
ResetTable();
}
// Insert group into display
TableIndexT CGroupTable::InsertGroup(TableIndexT pos, CGroup* grp)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Find position of previous group
TableIndexT woRow;
for(woRow = 0; woRow < mCollapsableTree->CountNodes(); woRow++)
{
if (GetNestingLevel(woRow) == 0)
pos--;
if (pos < 0) break;
}
SGroupTableItem item(true, grp);
TableIndexT newRow = InsertSiblingRows(1, woRow, &item, sizeof(SGroupTableItem), true, false);
// Add all addresses in group
for(unsigned long i = 0; i < grp->GetAddressList().size(); i++)
{
SGroupTableItem addr_item(false, grp);
AddLastChildRow(newRow, &addr_item, sizeof(SGroupTableItem), false, false);
}
DeepCollapseRow(newRow);
return GetExposedIndex(newRow);
}
// Delete group from display
void CGroupTable::DeleteGroup(TableIndexT pos)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Find position of group
TableIndexT woRow;
for(woRow = 0; woRow < mCollapsableTree->CountNodes(); woRow++)
{
if (GetNestingLevel(woRow) == 0)
pos--;
if (pos < 0) break;
}
RemoveRows(1, woRow, false);
}
// Replace one group with another
void CGroupTable::ReplaceGroup(CGroup* old_grp, CGroup* new_grp)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Get change
short diff = new_grp->GetAddressList().size() - old_grp->GetAddressList().size();
// Do replace
CGroupList::iterator replace = find(mAdbk->GetGroupList()->begin(), mAdbk->GetGroupList()->end(), old_grp);
if (replace < mAdbk->GetGroupList()->end())
{
*replace = new_grp;
// Force change in adbk
mAdbk->UpdateGroup(new_grp);
short pos = mAdbk->GetGroupList()->FetchIndexOf(new_grp);
// Find position of group
TableIndexT woRow;
for(woRow = 0; woRow <= mCollapsableTree->CountNodes(); woRow++)
{
if (GetNestingLevel(woRow) == 0)
pos--;
if (pos < 1) break;
}
// Replace group item in table
SGroupTableItem grp_item(true, new_grp);
STableCell aCell(woRow, 1);
SetCellData(aCell, &grp_item, sizeof(SGroupTableItem));
// Change address rows
SGroupTableItem addr_item(false, new_grp);
short num = (diff > 0) ? diff : -diff;
while(num--)
{
if (diff > 0)
AddLastChildRow(woRow, &addr_item, sizeof(SGroupTableItem), false, false);
else
RemoveRows(1, woRow+1, false);
}
// Refill address rows with new group
for(short i = 0; i < new_grp->GetAddressList().size(); i++)
{
SGroupTableItem addr_item(false, new_grp);
STableCell aCell(woRow + 1 + i, 1);
SetCellData(aCell, &addr_item, sizeof(SGroupTableItem));
}
}
}
// Insert address into display
void CGroupTable::InsertedAddress(CGroup* grp, int num)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
short pos = mAdbk->GetGroupList()->FetchIndexOf(grp);
// Find position of group
TableIndexT woRow;
for(woRow = 0; woRow < mCollapsableTree->CountNodes(); woRow++)
{
if (GetNestingLevel(woRow) == 0)
pos--;
if (pos < 0) break;
}
// Replace group item
SGroupTableItem grp_item(true, grp);
STableCell aCell(woRow + 1, 1);
SetCellData(aCell, &grp_item, sizeof(SGroupTableItem));
// Add required number of new addresses
SGroupTableItem addr_item(false, grp);
while(num--)
AddLastChildRow(woRow, &addr_item, sizeof(SGroupTableItem), false, false);
// Refill address rows with new group
for(short i = 0; i < grp->GetAddressList().size(); i++)
{
SGroupTableItem addr_item(false, grp);
STableCell aCell(woRow + 1 + i, 1);
SetCellData(aCell, &addr_item, sizeof(SGroupTableItem));
}
}
// Delete address from display
void CGroupTable::DeletedAddress(CGroup* grp, int num)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Prevent window update during changes
StDeferTableAdjustment changing(this);
short pos = mAdbk->GetGroupList()->FetchIndexOf(grp);
// Find position of group
UInt32 woRow;
for(woRow = 0; woRow < mCollapsableTree->CountNodes(); woRow++)
{
if (GetNestingLevel(woRow) == 0)
pos--;
if (pos < 0) break;
}
// Replace group item
SGroupTableItem grp_item(true, grp);
STableCell aCell(woRow + 1, 1);
SetCellData(aCell, &grp_item, sizeof(SGroupTableItem));
// Remove number of required rows
while(num--)
RemoveRows(1, woRow+1, false);
// Refill address rows with new group
for(short i = 0; i < grp->GetAddressList().size(); i++)
{
SGroupTableItem addr_item(false, grp);
STableCell aCell(woRow + 1 + i, 1);
SetCellData(aCell, &addr_item, sizeof(SGroupTableItem));
}
}
// Keep cached list in sync
void CGroupTable::ResetTable()
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Delete all existing rows
RemoveAllRows(true);
// Add all groups
if (mAdbk)
{
UInt32 last_grp_row = 0;
for(CGroupList::iterator iter = mAdbk->GetGroupList()->begin(); iter != mAdbk->GetGroupList()->end(); iter++)
{
// Insert group item
SGroupTableItem grp_item(true, *iter);
last_grp_row = InsertSiblingRows(1, last_grp_row, &grp_item, sizeof(SGroupTableItem), true, false);
// Add all addresses in group
for(short i = 0; i < (*iter)->GetAddressList().size(); i++)
{
SGroupTableItem addr_item(false, *iter);
AddLastChildRow(last_grp_row, &addr_item, sizeof(SGroupTableItem), false, false);
}
}
}
mTableView->UpdateCaptions();
Refresh();
}
// Reset the table from the address list
void CGroupTable::ClearTable()
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Remove all rows
Clear();
}
void CGroupTable::OnNewMessage(void)
{
CreateNewLetter(GetDisplay()->GetLatestKeyModifiers().meta());
}
void CGroupTable::OnNewGroup(void)
{
CreateNewEntry();
}
void CGroupTable::OnEditGroup(void)
{
DoEditEntry();
}
void CGroupTable::OnDeleteGroup(void)
{
DoDeleteEntry();
}
// Create new letter from selection
void CGroupTable::CreateNewLetter(bool option_key)
{
// Create list of selected addresses
CAddressList list;
// Copy selection into list for active list only
AddSelectionToList(&list);
CReplyChooseDialog::ProcessChoice(&list,
!(CPreferences::sPrefs->mOptionKeyAddressDialog.GetValue() ^ option_key) && (list.size() > 0));
}
// Create a new group
void CGroupTable::CreateNewEntry()
{
// Create new group and add to list
CGroup* new_grp = new CGroup;
// Let DialogHandler process events
if (CEditGroupDialog::PoseDialog(new_grp))
{
// Only add if some text available
if (!new_grp->IsEmpty())
{
// Initiate action
mTableView->GetUndoer()->PostAction(new CGroupTableNewAction(this, new_grp, IsDirty()));
}
else
delete new_grp;
}
else
delete new_grp;
}
// Edit selected entries
void CGroupTable::DoEditEntry()
{
// Create new edit action ready to store edits (force previous one to be committed)
CGroupTableEditAction* oldEditAction = mEditAction;
mEditAction = new CGroupTableEditAction(this, IsDirty());
// Do edit for each selection
if (TestSelectionOr((TestSelectionPP) &CGroupTable::EditEntry))
// Initiate action - will commit previous
mTableView->GetUndoer()->PostAction(mEditAction);
else
{
// Delete attempted action and restore previous
delete mEditAction;
mEditAction = oldEditAction;
}
}
// Edit specified group
bool CGroupTable::EditEntry(TableIndexT row)
{
bool done_edit = false;
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Copy original address
CGroup* copy = new CGroup(*item.mGroup);
// Only edit groups
if (item.mIsGroup)
{
// Let DialogHandler process events
if (CEditGroupDialog::PoseDialog(copy))
{
// Add info to action
mEditAction->AddEdit(item.mGroup, copy);
done_edit = true;
}
else
{
delete copy;
done_edit = false;
}
}
return done_edit;
}
// Delete selected entries
void CGroupTable::DoDeleteEntry()
{
// Determine whether to do groups or address only
if (TestSelectionOr((TestSelectionPP) &CGroupTable::TestSelectionGroup))
{
// Create list to hold deleted items
CGroupList* grps = new CGroupList();
// Add each selected group
DoToSelection1((DoToSelection1PP) &CGroupTable::AddGroupToList, grps);
// Initiate delete action if some selected
if (grps->size() > 0)
mTableView->GetUndoer()->PostAction(new CGroupTableDeleteAction(this, grps, IsDirty()));
else
delete grps;
}
else
{
CGroup* aGrp = NULL;
if (TestSelectionAnd1((TestSelection1PP) &CGroupTable::TestSameGroup, &aGrp) && aGrp)
{
// Copy original group
CGroup* copy = new CGroup(*aGrp);
// Delete selected addresses (in reverse)
STableCell delCell(0, 0);
while (GetPreviousSelectedCell(delCell))
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(delCell.row);
STableCell woCell(woRow, delCell.col);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Determine position in group
short pos = woRow - GetParentIndex(woRow) - 1;
// Delete address
copy->GetAddressList().erase(copy->GetAddressList().begin() + pos);
}
// Initiate delete action
mReplaceAction = new CGroupTableReplaceAction(this, aGrp, copy, IsDirty());
mTableView->GetUndoer()->PostAction(mReplaceAction);
}
else if (aGrp)
CErrorHandler::PutStopAlertRsrc("Alerts::Adbk::DeleteAddressSameGroup");
}
}
// Add from list - not unique
void CGroupTable::AddGroupsFromList(CGroupList* grps)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Add all groups
mAdbk->AddGroup(grps, true);
SelectGroups(grps);
mTableView->UpdateCaptions();
SetDirty(false);
}
// Change from list
void CGroupTable::ChangeGroupsFromList(CGroupList* old_grps, CGroupList* new_grps)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Delete from list
mAdbk->UpdateGroup(old_grps, new_grps);
// Reset only after all changes have happened
UnselectAllCells();
Refresh();
mTableView->UpdateCaptions();
SetDirty(false);
}
// Delete from list
void CGroupTable::RemoveGroupsFromList(CGroupList* grps)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Delete from list
mAdbk->RemoveGroup(grps);
// Reset only after all changes have happened
UnselectAllCells();
Refresh();
mTableView->UpdateCaptions();
SetDirty(false);
}
// Delete from list
void CGroupTable::SelectGroups(CGroupList* grps)
{
// Prevent selection changes
StDeferSelectionChanged _defer(this);
// Remove existing selection
UnselectAllCells();
// Loop over all rows selecting from list
for(TableIndexT row = 1; row <= mRows; row++)
{
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
if (item.mIsGroup)
{
CGroup* grp = item.mGroup;
CGroupList::const_iterator found = std::find(grps->begin(), grps->end(), grp);
if (found != grps->end())
SelectCell(STableCell(row, 1));
}
}
// Bring first item into view
ShowFirstSelection();
// Reset only after all changes have happened
SetDirty(false);
}
// Add selected addresses to list
void CGroupTable::AddSelectionToList(CAddressList* list)
{
// Add all selected address to drag
DoToSelection1((DoToSelection1PP) &CGroupTable::AddAddressesToList, list);
}
// Add group to list
bool CGroupTable::AddAddressesToList(TableIndexT row, CAddressList* list)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Check for group
if (item.mIsGroup)
{
// Add all addresses in this group
for(short i = 0; i < item.mGroup->GetAddressList().size(); i++)
{
cdstring& aStr = item.mGroup->GetAddressList().at(i);
list->push_back(new CAddress(aStr));
}
}
else
{
// Determine position in group
short pos = woRow - GetParentIndex(woRow) - 1;
// Copy and save in selected list
list->push_back(new CAddress(item.mGroup->GetAddressList().at(pos)));
}
return true;
}
// Add to text
bool CGroupTable::AddToText(TableIndexT row, cdstring* txt)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Check for group
if (item.mIsGroup)
{
// Add all addresses in this group
for(unsigned long i = 0; i < item.mGroup->GetAddressList().size(); i++)
{
*txt += item.mGroup->GetAddressList().at(i);
*txt += os_endl;
}
}
else
{
// Determine position in group
UInt32 pos = woRow - GetParentIndex(woRow) - 1;
// Copy and save in selected list
*txt += item.mGroup->GetAddressList().at(pos);
*txt += os_endl;
}
return true;
}
// Add group to list
bool CGroupTable::AddGroupToList(TableIndexT row, CGroupList* list)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Check for group and attempt unique insert
if (item.mIsGroup)
return list->InsertUniqueItem(item.mGroup);
return false;
}
// Test for selected item group
bool CGroupTable::TestSelectionGroup(TableIndexT row)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// This is deleted
return item.mIsGroup;
}
// Test for selected items in same group
bool CGroupTable::TestSameGroup(TableIndexT row, CGroup** test)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// This is deleted
return *test ? (item.mGroup == *test) : ((*test = item.mGroup) != NULL);
}
// Common updaters
void CGroupTable::OnUpdateEditPaste(JXTextMenu* menu, JIndex item)
{
// Check for text in clipboard
menu->EnableItem(item);
}
// Command handlers
void CGroupTable::OnEditCut()
{
// Copy first
OnEditCopy();
// Delete selection
DoDeleteEntry();
}
void CGroupTable::OnEditCopy()
{
cdstring txt;
// Add all selected groups to text
DoToSelection1((DoToSelection1PP) &CGroupTable::AddGroupText, &txt);
// Now copy to scrap
CClipboard::CopyToSecondaryClipboard(GetDisplay(), txt);
}
// Add groups as text to handle
bool CGroupTable::AddGroupText(TableIndexT row , cdstring* txt)
{
// Determine whether to do groups or address only
bool got_grp = TestSelectionOr((TestSelectionPP) &CGroupTable::TestSelectionGroup);
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Do not do mixture - copy only groups or only addresses
if (got_grp && !item.mIsGroup) return false;
// Check for single address or group
if (got_grp)
{
CGroup* theGrp = item.mGroup;
for(unsigned long i = 0; i < theGrp->GetAddressList().size(); i++)
{
cdstring& aStr = theGrp->GetAddressList().at(i);
// Add CR before if multi-copy
if (txt->length())
*txt += "\r\n";
*txt += aStr;
}
}
else
{
// Determine position in group
UInt32 pos = woRow - GetParentIndex(woRow) - 1;
// Get address
CGroup* theGrp = item.mGroup;
cdstring& aStr = theGrp->GetAddressList().at(pos);
// Add CR before if multi-copy
if (txt->length())
*txt += os_endl;
*txt += aStr;
}
return true;
}
void CGroupTable::OnEditPaste()
{
cdstring txt;
CClipboard::GetSecondaryClipboard(GetDisplay(), txt);
if (txt.length())
DoToSelection1((DoToSelection1PP) &CGroupTable::AddAddressTextToGroup, txt);
}
// Add address as text to handle
bool CGroupTable::AddAddressTextToGroup(TableIndexT row, char* txt)
{
// Get its info
TableIndexT woRow = GetWideOpenIndex(row);
STableCell woCell(woRow, 1);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
// Check for group
if (item.mIsGroup)
DropDataIntoCell(GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom(), (unsigned char*) txt, ::strlen(txt), STableCell(row, 1));
return true;
}
void CGroupTable::ActionDeleted()
{
if (mEditAction)
mEditAction = NULL;
if (mReplaceAction)
mReplaceAction = NULL;
}
#pragma mark ____________________________________Keyboard/Mouse
// Double-clicked item
void CGroupTable::LClickCell(const STableCell& inCell, const JXKeyModifiers& modifiers)
{
CHierarchyTableDrag::LClickCell(inCell, modifiers);
DoSingleClick(inCell.row, CKeyModifiers(modifiers));
}
// Double-clicked item
void CGroupTable::LDblClickCell(const STableCell& inCell, const JXKeyModifiers& modifiers)
{
DoDoubleClick(inCell.row, CKeyModifiers(modifiers));
}
// Handle key down
bool CGroupTable::HandleChar(const int key, const JXKeyModifiers& modifiers)
{
// Look for preview/full view based on key stroke
// Determine whether preview is triggered
CKeyModifiers mods(modifiers);
const CUserAction& preview = mTableView->GetPreviewAction();
if ((preview.GetKey() == key) &&
(preview.GetKeyModifiers() == mods))
{
DoPreview();
return true;
}
// Determine whether full view is triggered
const CUserAction& fullview = mTableView->GetFullViewAction();
if ((fullview.GetKey() == key) &&
(fullview.GetKeyModifiers() == mods))
{
DoFullView();
return true;
}
switch(key)
{
case kJDeleteKey:
case kJForwardDeleteKey:
DoDeleteEntry();
return true;
case '\t':
//mTableView->FocusAddress();
//mTableView->SetFocus();
return true;
default:
// Did not handle key
return CHierarchyTableDrag::HandleChar(key, modifiers);
}
}
// Select from key press
void CGroupTable::DoKeySelection()
{
// Create new address for typed chars
CGroup* temp = new CGroup(mLastChars);
// Get low bound insert pos
long select = mAdbk->GetGroupList()->FetchInsertIndexOf(temp);
// Clip to end of list
if (select > mAdbk->GetGroupList()->size()) select--;
// Find exposed position of group
UInt32 pos;
for(pos = 0; pos < mCollapsableTree->CountNodes(); pos++)
{
if (GetNestingLevel(pos) == 0)
select--;
if (select < 0) break;
}
STableCell aCell(GetExposedIndex(pos), 2);
UnselectAllCells();
FakeClickSelect(aCell, false);
ScrollCellIntoFrame(aCell);
delete temp;
}
bool CGroupTable::ObeyCommand(unsigned long cmd, SMenuCommandChoice* menu)
{
switch (cmd)
{
case CCommand::eFileNewMessage:
case CCommand::eToolbarNewLetter:
OnNewMessage();
return true;
case CCommand::eEditCut:
OnEditCut();
return true;
case CCommand::eEditCopy:
OnEditCopy();
return true;
case CCommand::eEditPaste:
OnEditPaste();
return true;
case CCommand::eAddressEdit:
case CCommand::eToolbarAddressBookEditBtn:
DoEditEntry();
return true;
case CCommand::eAddressDelete:
case CCommand::eToolbarAddressBookDeleteBtn:
DoDeleteEntry();
return true;
default:;
}
return CHierarchyTableDrag::ObeyCommand(cmd, menu);
}
void CGroupTable::UpdateCommand(unsigned long cmd, CCmdUI* cmdui)
{
switch(cmd)
{
case CCommand::eEditCut:
case CCommand::eEditCopy:
case CCommand::eAddressEdit:
case CCommand::eToolbarAddressBookEditBtn:
case CCommand::eAddressDelete:
case CCommand::eToolbarAddressBookDeleteBtn:
OnUpdateSelection(cmdui);
return;
case CCommand::eFileNewMessage:
case CCommand::eToolbarNewLetter:
case CCommand::eEditPaste:
OnUpdateAlways(cmdui);
return;
default:;
}
CHierarchyTableDrag::UpdateCommand(cmd, cmdui);
}
// Draw the titles
void CGroupTable::DrawCell(JPainter* pDC, const STableCell& inCell, const JRect& inLocalRect)
{
TableIndexT woRow = GetWideOpenIndex(inCell.row);
STableCell woCell(woRow, inCell.col);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
unsigned long bkgnd = 0x00FFFFFF;
if (item.mIsGroup && CellIsSelected(inCell) && IsActive() && HasFocus())
{
JColorIndex bkgnd_index = GetColormap()->GetDefaultSelectionColor();
JSize r, g, b;
GetColormap()->GetRGB(bkgnd_index, &r, &g, &b);
bkgnd = ((r & 0xFF00) << 8) | (g & 0xFF00) | ((b & 0xFF00) >> 8);
}
JXImage* icon;
const char* content;
if (item.mIsGroup)
{
CGroup* grp = item.mGroup;
icon = CIconLoader::GetIcon(IDI_GROUP_FLAG, this, 16, bkgnd);
content = grp->GetName();
}
else
{
CGroup* grp = item.mGroup;
icon = CIconLoader::GetIcon(IDI_ADDRESS_FLAG, this, 16, bkgnd);
// Determine position in group
UInt32 pos = woRow - GetParentIndex(woRow) - 1;
// Determine name to use
content = grp->GetAddressList().at(pos);
}
DrawHierarchyRow(pDC, inCell.row, inLocalRect, content, icon);
}
#pragma mark ____________________________________Drag&Drop
// Limit flavors based on selection
bool CGroupTable::GetSelectionAtom(CFlavorsList& atoms)
{
// Determine whether to do groups or address only
bool all_grp = TestSelectionAnd((TestSelectionPP) &CGroupTable::TestSelectionGroup);
// If all groups allow group list drag
if (all_grp)
atoms.push_back(CMulberryApp::sFlavorGrpList);
else
atoms.push_back(CMulberryApp::sFlavorAddrList);
// Always do text
atoms.push_back(GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom());
atoms.push_back(GetDisplay()->GetSelectionManager()->GetTextXAtom());
return true;
}
// Determine if drop into cell
bool CGroupTable::IsDropCell(JArray<Atom>& typeList, const STableCell& cell)
{
if (IsValidCell(cell))
{
TableIndexT woRow = GetWideOpenIndex(cell.row);
STableCell woCell(woRow, cell.col);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
return item.mIsGroup;
}
else
return false;
}
bool CGroupTable::RenderSelectionData(CMulSelectionData* seldata, Atom type)
{
bool rendered = false;
if (type == CMulberryApp::sFlavorGrpList)
{
// Create list to hold dragged items
std::auto_ptr<CGroupList> grps(new CGroupList);
grps->set_delete_data(false);
// Add each selected address
DoToSelection1((DoToSelection1PP) &CGroupTable::AddGroupToList, grps.get());
seldata->SetData(type, reinterpret_cast<unsigned char*>(grps.release()), sizeof(CGroupList*));
rendered = true;
}
else if (type == CMulberryApp::sFlavorAddrList)
{
// Create list to hold deleted items
std::auto_ptr<CAddressList> addrs(new CAddressList);
addrs->set_delete_data(false);
// Add each selected address
DoToSelection1((DoToSelection1PP) &CGroupTable::AddAddressesToList, addrs.get());
seldata->SetData(type, reinterpret_cast<unsigned char*>(addrs.release()), sizeof(CAddressList*));
rendered = true;
}
else if ((type == GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom()) ||
(type == GetDisplay()->GetSelectionManager()->GetTextXAtom()))
{
cdstring txt;
// Add all selected address to text
DoToSelection1((DoToSelection1PP) &CGroupTable::AddToText, &txt);
// Add all selected address to text
unsigned long dataLength = txt.length() + 1;
unsigned char* data = new unsigned char[dataLength];
if (data)
{
::memcpy(data, txt.c_str(), dataLength);
seldata->SetData(type, data, dataLength);
rendered = true;
}
}
return rendered;
}
// Drop data into whole table
bool CGroupTable::DropData(Atom inFlavor, unsigned char* drag_data, unsigned long data_size)
{
if (inFlavor == CMulberryApp::sFlavorGrpList)
{
CGroupList* grps = reinterpret_cast<CGroupList*>(drag_data);
CGroupTableNewAction* add_action = NULL;
for(CGroupList::const_iterator iter = grps->begin(); iter != grps->end(); iter++)
{
// Does it already exist?
if (!mAdbk->GetGroupList()->IsDuplicate(*iter))
{
CGroup* copy = new CGroup(**iter);
// Check for existing action
if (add_action)
add_action->AddGroup(copy);
else
// Create new action - action owns list
add_action = new CGroupTableNewAction(this, copy, IsDirty());
}
}
// Post action after all added
mTableView->GetUndoer()->PostAction(add_action);
}
return true;
}
// Drop data into cell
bool CGroupTable::DropDataIntoCell(Atom theFlavor,
unsigned char* drag_data,
unsigned long data_size, const STableCell& inCell)
{
bool added = false;
// Only allow drag to group
TableIndexT woRow = GetWideOpenIndex(inCell.row);
STableCell woCell(woRow, inCell.col);
SGroupTableItem item;
UInt32 dataSize = sizeof(SGroupTableItem);
GetCellData(woCell, &item, dataSize);
if (!item.mIsGroup)
return false;
CGroup* old_grp = item.mGroup;
// Create new group
CGroup* new_grp = new CGroup(*old_grp);
if (theFlavor == CMulberryApp::sFlavorMsgList)
{
CMessageList* msgs = reinterpret_cast<CMessageList*>(drag_data);
for(CMessageList::const_iterator iter = msgs->begin(); iter != msgs->end(); iter++)
{
CEnvelope* theEnv = (*iter)->GetEnvelope();
// Add From
if (theEnv->GetFrom()->size())
{
// Add to list
cdstring txt = theEnv->GetFrom()->front()->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
// Add Reply-To
if (theEnv->GetReplyTo()->size())
{
// Add to list
cdstring txt = theEnv->GetReplyTo()->front()->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
// Add all To: except me
for(CAddressList::iterator iter = theEnv->GetTo()->begin(); iter != theEnv->GetTo()->end(); iter++)
{
// Add to list
cdstring txt = (*iter)->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
// Add all Ccs except me
for(CAddressList::iterator iter = theEnv->GetCC()->begin(); iter != theEnv->GetCC()->end(); iter++)
{
// Add to list
cdstring txt = (*iter)->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
}
}
else if (theFlavor == CMulberryApp::sFlavorAddrList)
{
CAddressList* addrs = reinterpret_cast<CAddressList*>(drag_data);
for(CAddressList::const_iterator iter = addrs->begin(); iter != addrs->end(); iter++)
{
// Add to list
cdstring txt = (*iter)->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
}
else if (theFlavor == CMulberryApp::sFlavorGrpList)
{
unsigned long count = *((unsigned long*) drag_data);
drag_data += sizeof(unsigned long);
for(unsigned long i = 0; i < count; i++)
{
CGroup* theGrp = ((CGroup**) drag_data)[i];
// Add group to new group
new_grp->AddAddress(theGrp->GetNickName());
added = true;
}
}
else if ((theFlavor == GetDisplay()->GetSelectionManager()->GetMimePlainTextXAtom()) ||
(theFlavor == GetDisplay()->GetSelectionManager()->GetTextXAtom()))
{
// Parse text into list
CAddressList list(reinterpret_cast<const char*>(drag_data), data_size);
// Try to add these to table
for(CAddressList::iterator iter = list.begin(); iter != list.end(); iter++)
{
// Now add to group
cdstring txt = (*iter)->GetFullAddress();
new_grp->AddAddress(txt);
added = true;
}
}
// If there was a change reset both tables
if (added)
{
// Check for existing action and force close
if (mReplaceAction)
mTableView->GetUndoer()->PostAction(NULL);
// Create new action and post
mReplaceAction = new CGroupTableReplaceAction(this, old_grp, new_grp, IsDirty());
mTableView->GetUndoer()->PostAction(mReplaceAction);
}
else
delete new_grp;
return added;
}
| [
"svnusers@a91246af-f21b-0410-bd1c-c3c7fc455132"
] | svnusers@a91246af-f21b-0410-bd1c-c3c7fc455132 |
69bb2dc63c1e5b5e632f2a5a288cb89432338cd2 | 12937c90030aa0a9d14f20e55a593ac81186b384 | /posix_qextserialport.h | 1f789aa92cb0ca8e069d8a8e94f09686fafe8596 | [] | no_license | iuvei/baccarat-1 | 8c61d4b124e266337353cc5710abff6c9b828804 | 617c0eb1a1de7e347aafc7026923a6eb03591128 | refs/heads/master | 2020-11-26T15:17:31.785402 | 2016-02-19T09:03:27 | 2016-02-19T09:03:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,943 | h | #ifndef _POSIX_QEXTSERIALPORT_H_
#define _POSIX_QEXTSERIALPORT_H_
#include <stdio.h>
#include <termios.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include "qextserialbase.h"
class Posix_QextSerialPort:public QextSerialBase
{
private:
/*!
* This method is a part of constructor.
*/
void init();
protected:
struct termios Posix_CommConfig;
struct timeval Posix_Timeout;
struct timeval Posix_Copy_Timeout;
virtual qint64 readData(char * data, qint64 maxSize);
virtual qint64 writeData(const char * data, qint64 maxSize);
public:
QFile* Posix_File;
Posix_QextSerialPort();
Posix_QextSerialPort(const Posix_QextSerialPort& s);
Posix_QextSerialPort(const QString & name, QextSerialBase::QueryMode mode = QextSerialBase::Polling);
Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling);
Posix_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling);
Posix_QextSerialPort& operator=(const Posix_QextSerialPort& s);
virtual ~Posix_QextSerialPort();
virtual void setBaudRate(BaudRateType);
virtual void setDataBits(DataBitsType);
virtual void setParity(ParityType);
virtual void setStopBits(StopBitsType);
virtual void setFlowControl(FlowType);
virtual void setTimeout(long);
virtual bool open(OpenMode mode);
virtual void close();
virtual void flush();
virtual qint64 size() const;
virtual qint64 bytesAvailable();
virtual void ungetChar(char c);
virtual void translateError(ulong error);
virtual void setDtr(bool set=true);
virtual void setRts(bool set=true);
virtual ulong lineStatus();
};
#endif
| [
"weison86@sina.cn"
] | weison86@sina.cn |
7460aa3ffe22f81d4469c6be9668f2bd6165afbe | 90f518ee59a241d39752ba0c7ab2ed4f7325de31 | /src/NetWidgets/Widgets/nSldClassifier.cpp | f6100d8a15a716890788984c57dcdc51cb3a4cd3 | [
"MIT"
] | permissive | Vladimir-Lin/QtNetWidgets | 86999fcae79914f319cbd8cd671215ed0f09012e | e09339c47d40b65875f15bd0839e0bdf89951601 | refs/heads/main | 2023-05-23T14:32:03.824075 | 2021-06-16T17:12:13 | 2021-06-16T17:12:13 | 377,571,914 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,087 | cpp | #include <netwidgets.h>
N::SldClassifier:: SldClassifier (QObject * parent,Plan * p)
: QThread ( parent )
, NetworkManager ( p)
, plan ( p)
, Go (NULL )
, Progress (NULL )
, Mode (None )
, Chunk (10000 )
{
connect(this,SIGNAL(currentProgress(int,QString)) ,
this,SLOT (showProgress (int,QString)) ) ;
}
N::SldClassifier::~SldClassifier(void)
{
}
void N::SldClassifier::DefaultUI(void)
{
Go = new QToolButton(plan->status) ;
Go -> setAutoRaise (true) ;
Go -> setCheckable (true) ;
Go -> setIcon (QIcon(":/images/StopPlay.png")) ;
Go -> setToolTip (tr("Stop analyizing") ) ;
plan -> status -> addPermanentWidget ( Go ) ;
Progress = plan -> Progress ( "%v/%m" ) ;
Progress -> setTextVisible ( true ) ;
}
void N::SldClassifier::showProgress(int index,QString message)
{
Progress -> setValue ( index ) ;
plan -> showMessage ( message ) ;
}
bool N::SldClassifier::OneSecond(void)
{
QDateTime D = Lastest ;
QDateTime S = QDateTime::currentDateTime() ;
time_t d = D.toTime_t() ;
time_t s = S.toTime_t() ;
return (d!=s) ;
}
void N::SldClassifier::doTLDs(SqlConnection & Connection)
{
bool done = false ;
QString Limit = QString ( " limit 0,%1 ;" ) . arg(Chunk) ;
TUID TOTAL = SiteTotal ( Connection ) ;
SUID LUID = LastestTld ( Connection ) ;
TUID FUID = 0 ;
TUID AUID = 0 ;
UUIDs Uuids ;
NAMEs URLs ;
QMap<SUID,TUID> IDs ;
QString Q ;
QString Options ;
QDateTime Start ;
if (LUID>0) FUID = SiteId( Connection , LUID ) ;
Go -> setChecked ( true ) ;
Progress -> setRange ( 0,(int)TOTAL) ;
Limit = " order by id asc" + Limit ;
Lastest = QDateTime::currentDateTime ( ) ;
Start = QDateTime::currentDateTime ( ) ;
AUID = FUID ;
while (!done) {
Uuids . clear ( ) ;
URLs . clear ( ) ;
IDs . clear ( ) ;
Options = QString(" where id > %1").arg(FUID) ;
Q = Connection.sql.SelectFrom (
"id,uuid,url" ,
PlanTable(SiteDepot) ,
Options + Limit ) ;
SqlLoopNow ( Connection , Q ) ;
TUID fuid = Connection . Value ( 0 ) . toLongLong () ;
SUID uuid = Connection . Uuid ( 1 ) ;
QString url = Connection . String( 2 ) ;
Uuids << uuid ;
IDs [ uuid ] = fuid ;
URLs [ uuid ] = url ;
SqlLoopErr ( Connection , Q ) ;
SqlLoopEnd ( Connection , Q ) ;
if (Uuids.count()<=0) done = true; else {
for (int i=0;Go->isChecked() && i<Uuids.count();i++) {
SUID uuid = Uuids [ i ] ;
FUID = IDs [ uuid ] ;
QUrl url ;
url . setHost (URLs[uuid]) ;
SUID tld = UrlTLD ( url ) ;
if (tld>0) InsertTldMap ( Connection , uuid , tld ) ;
if (OneSecond()) {
TUID INDEX = FUID - AUID ;
TUID STOTA = TOTAL - AUID ;
QString msg ;
QDateTime ETA ;
ETA = Time::ETA(Start,(int)INDEX,(int)STOTA) ;
msg = tr("Estimated complete time : %1" )
.arg(ETA.toString("yyyy/MM/dd hh:mm:ss") ) ;
emit currentProgress( (int)FUID , msg ) ;
Lastest = QDateTime::currentDateTime ( ) ;
} ;
} ;
} ;
if (!Go->isChecked()) done = true ;
} ;
}
void N::SldClassifier::doSLDs(SqlConnection & Connection)
{
bool done = false ;
QString Limit = QString ( " limit 0,%1 ;" ) . arg(Chunk) ;
TUID TOTAL = SiteTotal ( Connection ) ;
SUID LUID = LastestSld ( Connection ) ;
TUID FUID = 0 ;
TUID AUID = 0 ;
UUIDs Uuids ;
NAMEs URLs ;
QMap<SUID,TUID> IDs ;
QString Q ;
QString Options ;
QDateTime Start ;
if (LUID>0) FUID = SiteId( Connection , LUID ) ;
Go -> setChecked ( true ) ;
Progress -> setRange ( 0,(int)TOTAL) ;
Limit = " order by id asc" + Limit ;
Lastest = nTimeNow ;
Start = nTimeNow ;
AUID = FUID ;
while (!done) {
Uuids . clear ( ) ;
URLs . clear ( ) ;
IDs . clear ( ) ;
Options = QString(" where id > %1").arg(FUID) ;
Q = Connection.sql.SelectFrom (
"id,uuid,url" ,
PlanTable(SiteDepot) ,
Options + Limit ) ;
SqlLoopNow ( Connection , Q ) ;
TUID fuid = Connection . Value ( 0 ) . toLongLong () ;
SUID uuid = Connection . Uuid ( 1 ) ;
QString url = Connection.String( 2 ) ;
Uuids << uuid ;
IDs [ uuid ] = fuid ;
URLs [ uuid ] = url ;
SqlLoopErr ( Connection , Q ) ;
SqlLoopEnd ( Connection , Q ) ;
if (Uuids.count()<=0) done = true; else {
for (int i=0;Go->isChecked() && i<Uuids.count();i++) {
SUID uuid = Uuids [ i ] ;
FUID = IDs [ uuid ] ;
QUrl url ;
url . setHost (URLs[uuid]) ;
SUID sld = UrlSLD ( url ) ;
if (sld>0) InsertSldMap ( Connection , uuid , sld ) ;
if (OneSecond()) {
TUID INDEX = FUID - AUID ;
TUID STOTA = TOTAL - AUID ;
QString msg ;
QDateTime ETA ;
ETA = Time::ETA(Start,(int)INDEX,(int)STOTA) ;
msg = tr("Estimated complete time : %1" )
.arg(ETA.toString("yyyy/MM/dd hh:mm:ss") ) ;
emit currentProgress( (int)FUID , msg ) ;
Lastest = QDateTime::currentDateTime ( ) ;
} ;
} ;
} ;
if (!Go->isChecked()) done = true ;
} ;
}
void N::SldClassifier::run(void)
{
SqlConnection SC ( NetPlan->sql ) ;
if (SC.open("nSldClassifier","run")) {
if (LoadDomainIndex(SC)) {
PrepareDomainMap ( ) ;
switch (Mode) {
case None :
break ;
case DoTLD :
plan->showMessage(tr("Counting sites...")) ;
plan->processEvents ( ) ;
doTLDs(SC) ;
break ;
case DoSLD :
plan->showMessage(tr("Counting sites...")) ;
plan->processEvents ( ) ;
doSLDs(SC) ;
break ;
} ;
} ;
SC . close ( ) ;
} ;
SC.remove() ;
Go -> hide ( ) ;
Progress -> hide ( ) ;
Go -> deleteLater ( ) ;
Progress -> deleteLater ( ) ;
Go = NULL ;
Progress = NULL ;
emit Finished ( ) ;
}
| [
"lin.vladimir@gmail.com"
] | lin.vladimir@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.