blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
201
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 7
100
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 260
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 11.4k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 80
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 8
9.86M
| extension
stringclasses 52
values | content
stringlengths 8
9.86M
| authors
listlengths 1
1
| author
stringlengths 0
119
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22d0baf299ddf5a53b33525132a2f9bd20dadb48 | 3345fa826de9ef0d373d18bacbc7bfe6353d0810 | /xblh-17559/Client/rgloader/xshell.cpp | 9077f45660b179276c354f993b5cc98c0faf5c9c | [] | no_license | g91/XBLS | 3e3ed6906905ce0f76ef633447c668d84acfcb33 | 3b88bd3bef80ab3fc9a51b843b7e43c821768bf4 | refs/heads/master | 2022-12-23T03:34:18.904914 | 2022-12-17T06:40:16 | 2022-12-17T06:40:16 | 251,020,633 | 12 | 11 | null | null | null | null | UTF-8 | C++ | false | false | 1,871 | cpp | #include "xshell.h"
using namespace std;
VOID patchInDashStrings(DWORD* addr, DWORD xex, DWORD path){
DWORD data[4];
if(xex & 0x8000){ // If bit 16 is 1
data[0] = 0x3D600000 + (((xex >> 16) & 0xFFFF) + 1); // lis %r11, dest>>16 + 1
}else{
data[0] = 0x3D600000 + ((xex >> 16) & 0xFFFF); // lis %r11, dest>>16
}
if(path & 0x8000){ // If bit 16 is 1
data[1] = (DWORD)0x3D400000 + (((path >> 16) & 0xFFFF) + 1); // lis %r11, dest>>16 + 1
}else{
data[1] = (DWORD)0x3D400000 + ((path >> 16) & 0xFFFF); // lis %r11, dest>>16
}
data[2] = 0x388B0000 + (xex & 0xFFFF);
data[3] = (DWORD)0x386A0000 + (DWORD)(path & 0xFFFF);
//printf("[RGLOADER]: Patch data @ %X = %08X.%08X.%08X.%08X\n", addr, data[0], data[1], data[2], data[3]);
DmSetMemory((LPVOID)addr, 0x10, (LPCVOID)data, 0);
}
int patch_Xshell_start_path(string nPath){
//nPath = "\\Device\\Harddisk0\\Partition1\\DEVKIT\\Utilities\\DashSelector";
//string xex = "DashSelector.xex";
int backslash = nPath.rfind("\\");
string xex = nPath.substr(backslash+1, nPath.length()-(backslash+1));
nPath=nPath.substr(0, backslash);
//xbox::utilities::DbgOut("[xblh] Setting xshell start button to: %s %s !\n", nPath.c_str(), xex.c_str());
startXex=new char[xex.length()];
strcpy(startXex, xex.c_str());
startPath=new char[nPath.length()];
strcpy(startPath, nPath.c_str());
OffsetManager om;
XSHELLOffsets* offsets = om.getXshellOffsets();
if(!offsets){
//xbox::utilities::DbgOut("[xblh] Failed to load xshell offsets...\r\n");
return -1;
}
patchInDashStrings((DWORD*)offsets->loc1 , (DWORD)startXex, (DWORD)startPath);
patchInDashStrings((DWORD*)offsets->loc2 , (DWORD)startXex, (DWORD)startPath);
patchInDashStrings((DWORD*)offsets->loc3 , (DWORD)startXex, (DWORD)startPath);
patchInDashStrings((DWORD*)offsets->loc4 , (DWORD)startXex, (DWORD)startPath);
return 1;
} | [
"[email protected]"
] | |
9636d58959f442596007db07ad532c059458239d | 22e1b7acc231c957291a5217b8ca098a29c9214c | /atom/renderer/api/context_bridge/render_frame_context_bridge_store.h | 6c06758865c7faceedee644912d6f6422d7bd662 | [
"MIT"
] | permissive | kevinkoo001/electron-6 | 0d5a641c942965da66941e3c653d20427d70ff59 | 03f0deb06370d945dfcfb61bc0cda93171157773 | refs/heads/master | 2022-12-22T10:59:29.671082 | 2020-02-20T20:07:53 | 2020-02-20T20:07:53 | 241,976,812 | 1 | 0 | MIT | 2022-12-10T08:11:28 | 2020-02-20T19:57:08 | C++ | UTF-8 | C++ | false | false | 2,252 | h | // Copyright (c) 2019 Slack Technologies, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_RENDERER_API_CONTEXT_BRIDGE_RENDER_FRAME_CONTEXT_BRIDGE_STORE_H_
#define ATOM_RENDERER_API_CONTEXT_BRIDGE_RENDER_FRAME_CONTEXT_BRIDGE_STORE_H_
#include <map>
#include <tuple>
#include "atom/renderer/atom_render_frame_observer.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace atom {
namespace api {
namespace context_bridge {
using FunctionContextPair =
std::tuple<v8::Global<v8::Function>, v8::Global<v8::Context>>;
using WeakGlobalPair = std::tuple<v8::Global<v8::Value>, v8::Global<v8::Value>>;
struct WeakGlobalPairNode {
explicit WeakGlobalPairNode(WeakGlobalPair pair_);
~WeakGlobalPairNode();
WeakGlobalPair pair;
bool detached = false;
struct WeakGlobalPairNode* prev = nullptr;
struct WeakGlobalPairNode* next = nullptr;
};
class RenderFramePersistenceStore final : public content::RenderFrameObserver {
public:
explicit RenderFramePersistenceStore(content::RenderFrame* render_frame);
~RenderFramePersistenceStore() override;
// RenderFrameObserver implementation.
void OnDestruct() override;
size_t take_func_id() { return next_func_id_++; }
std::map<size_t, FunctionContextPair>& functions() { return functions_; }
std::map<int, WeakGlobalPairNode*>* proxy_map() { return &proxy_map_; }
void CacheProxiedObject(v8::Local<v8::Value> from,
v8::Local<v8::Value> proxy_value);
v8::MaybeLocal<v8::Value> GetCachedProxiedObject(v8::Local<v8::Value> from);
private:
// func_id ==> { function, owning_context }
std::map<size_t, FunctionContextPair> functions_;
size_t next_func_id_ = 1;
// proxy maps are weak globals, i.e. these are not retained beyond
// there normal JS lifetime. You must check IsEmpty()
// object_identity ==> [from_value, proxy_value]
std::map<int, WeakGlobalPairNode*> proxy_map_;
};
} // namespace context_bridge
} // namespace api
} // namespace atom
#endif // ATOM_RENDERER_API_CONTEXT_BRIDGE_RENDER_FRAME_CONTEXT_BRIDGE_STORE_H_
| [
"[email protected]"
] | |
999b358b0f650e02436f21829c1ed1eaee6a4d48 | 4ec6b3553868126a0e0c59bea884f5b1ae1933c8 | /src/SAMLIGHT_CLIENT_CTRL_OCXLib_OCX.h | a57a55578d488e0b62a5013a3923f6522674e259 | [] | no_license | zhangzhihua8808/5_SAMLightPro | 8255d75da02f65a4e27ef30cb7307efd9a3284f6 | 8142dc6756bdb35c5d9e0d704decd4e3165d2848 | refs/heads/master | 2021-01-21T18:39:02.591391 | 2017-05-22T15:38:33 | 2017-05-22T15:38:33 | 92,068,519 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,317 | h | // ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// C++ TLBWRTR : $Revision: 1.151.1.0.1.27 $
// File generated on 2016/8/12 11:42:18 from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Windows\system32\sc_x64_samlight_client_ctrl.ocx (1)
// LIBID: {22C1DCFD-1974-40FB-9193-1D299C09903C}
// LCID: 0
// Helpfile: C:\Windows\system32\samlight_client_ctrl_ocx.hlp
// HelpString: SCAPS SAM SamlightClientCtrl
// DepndLst:
// (1) v2.0 stdole, (C:\Windows\SysWOW64\stdole2.tlb)
// ************************************************************************ //
#ifndef SAMLIGHT_CLIENT_CTRL_OCXLib_OCXH
#define SAMLIGHT_CLIENT_CTRL_OCXLib_OCXH
#pragma option push -b -w-inl
#include <olectrls.hpp>
#include <utilcls.h>
#if !defined(__UTILCLS_H_VERSION) || (__UTILCLS_H_VERSION < 0x0600)
//
// The code generated by the TLIBIMP utility or the Import|TypeLibrary
// and Import|ActiveX feature of C++Builder rely on specific versions of
// the header file UTILCLS.H found in the INCLUDE\VCL directory. If an
// older version of the file is detected, you probably need an update/patch.
//
#error "This file requires a newer version of the header UTILCLS.H" \
"You need to apply an update/patch to your copy of C++Builder"
#endif
#include <olectl.h>
#include <ocidl.h>
#if !defined(_NO_VCL)
#include <stdvcl.hpp>
#endif // _NO_VCL
#include <ocxproxy.h>
#include "SAMLIGHT_CLIENT_CTRL_OCXLib_TLB.h"
namespace Samlight_client_ctrl_ocxlib_tlb
{
// *********************************************************************//
// HelpString: SCAPS SAM SamlightClientCtrl
// Version: 2.6
// *********************************************************************//
// *********************************************************************//
// COM Component Proxy Class Declaration
// Component Name : TScSamlightClientCtrl
// Help String : SCAPS SAM SamlightClientCtrl
// Default Interface: _DSamlight_client_ctrl_ocx
// Def. Intf. Object: _DSamlight_client_ctrl_ocxDisp
// Def. Intf. DISP? : Yes
// Event Interface: _DSamlight_client_ctrl_ocxEvents
// TypeFlags : (34) CanCreate Control
// *********************************************************************//
// *********************************************************************//
// Definition of closures to allow VCL handlers to catch OCX events.
// *********************************************************************//
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
// Proxy class to host SCAPS SAM SamlightClientCtrl in CBuilder IDE/Applications.
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
class PACKAGE TScSamlightClientCtrl : public TOleControl
{
OVERLOADED_PROP_METHODS;
static TNoParam OptParam;
static GUID DEF_CTL_INTF;
// Instance of Closures to expose OCX Events as VCL ones
//
// Default Interace of OCX
//
_DSamlight_client_ctrl_ocxDisp m_OCXIntf;
// VCL Property Getters/Setters which delegate to OCX
//
// Static variables used by all instances of OCX proxy
//
static TControlData CControlData;
static GUID CTL_DEF_INTF;
// Method providing access to interface as __property
//
_DSamlight_client_ctrl_ocxDisp __fastcall GetDefaultInterface();
_DSamlight_client_ctrl_ocxDisp __fastcall GetControlInterface()
{ return GetDefaultInterface(); }
protected:
void __fastcall CreateControl ();
void __fastcall InitControlData();
public:
virtual __fastcall TScSamlightClientCtrl(TComponent* AOwner) : TOleControl(AOwner)
{};
virtual __fastcall TScSamlightClientCtrl(HWND Parent) : TOleControl(Parent)
{};
// OCX methods
//
long __fastcall ScIsRunning(void);
long __fastcall ScExecCommand(long CmdID);
long __fastcall ScChangeTextByName(BSTR EntityName, BSTR Text);
long __fastcall ScMarkEntityByName(BSTR EntityName, long WaitForMarkEnd);
long __fastcall ScIsMarking(void);
long __fastcall ScStopMarking(void);
long __fastcall ScLoadJob(BSTR FileName, long LoadEntities, long OverwriteEntities,
long LoadMaterials);
double __fastcall ScGetEntityOutline(BSTR EntityName, long Index);
double __fastcall ScGetWorkingArea(long Index);
long __fastcall ScOpticMatrixReset(void);
long __fastcall ScOpticMatrixTranslate(double X, double Y, double Z);
long __fastcall ScOpticMatrixRotate(double CenterX, double CenterY, double Angle);
long __fastcall ScSetMarkFlags(long Flags);
long __fastcall ScGetMarkFlags(void);
long __fastcall ScOpenEthernetConnection(BSTR SenderAddr, long SenderPort,
BSTR RecipientAddr, long RecipientPort);
long __fastcall ScCloseEthernetConnection(void);
long __fastcall ScGetInterfaceVersion(void);
long __fastcall ScSetDoubleValue(long Type, double Value);
double __fastcall ScGetDoubleValue(long Type);
long __fastcall ScSetLongValue(long Type, long Value);
long __fastcall ScGetLongValue(long Type);
long __fastcall ScSetLongData(long Type, VARIANT* Data, BSTR FileName);
long __fastcall ScTranslateEntity(BSTR EntityName, double X, double Y, double Z);
long __fastcall ScScaleEntity(BSTR EntityName, double ScaleX, double ScaleY,
double ScaleZ);
long __fastcall ScRotateEntity(BSTR EntityName, double X, double Y, double Angle);
long __fastcall ScImport(BSTR EntityName, BSTR FileName, BSTR Type, double Resolution,
long Flags);
long __fastcall ScSetEntityLongData(BSTR EntityName, long DataId, long Data);
long __fastcall ScGetEntityLongData(BSTR EntityName, long DataId);
long __fastcall ScDeleteEntity(BSTR EntityName);
long __fastcall ScGetLongData(long Type, VARIANT* Data, BSTR FileName);
long __fastcall ScGetConnectionStatus(void);
long __fastcall ScSetStringValue(long Type, BSTR Value);
long __fastcall ScGetStringValue(long Type, BSTR* Value);
long __fastcall ScShutDown(void);
long __fastcall ScGetOpticMatrix(long Index, double* Value);
long __fastcall ScMoveAbs(double X, double Y, double Z);
long __fastcall ScSwitchLaser(long LaserOnOff);
long __fastcall ScSetPen(long pen);
long __fastcall ScGetPen(long* pen);
long __fastcall ScShowApp(long Show);
long __fastcall ScSetHead(long Head);
long __fastcall ScGetHead(long* Head);
long __fastcall ScSaveJob(BSTR FileName, long Flags);
long __fastcall ScSetEntityDoubleData(BSTR EntityName, long DataId, double Data);
long __fastcall ScGetEntityDoubleData(BSTR EntityName, long DataId, double* Data);
long __fastcall ScSetEntityStringData(BSTR EntityName, long DataId, BSTR Data);
long __fastcall ScGetEntityStringData(BSTR EntityName, long DataId, BSTR* Data);
long __fastcall ScSetStringLongValue(long Type, BSTR SValue, long LValue);
long __fastcall ScSetStringDblValue(long Type, BSTR SValue, double DValue);
long __fastcall ScGetStringDblValue(long Type, BSTR SValue, double* RValue);
long __fastcall ScGetIDStringData(long Type, long Index, BSTR* Data);
long __fastcall ScOpenTCPConnection(BSTR RecipientAddr, long RecipientPort);
long __fastcall ScOpenUDPConnection(BSTR SenderAddr, long SenderPort,
BSTR RecipientAddr, long RecipientPort);
long __fastcall ScOpticMatrixScale(double ScaleX, double ScaleY);
long __fastcall ScSetPixelMapForPen(long pen, long pixel_zone0, long pixel_zone1,
long pixel_zone2, long pixel_zone3,
long pixel_zone4, long pixel_zone5);
long __fastcall ScSetMode(long Mode);
long __fastcall ScGetMode(long* Mode);
long __fastcall ScDuplicateEntity(BSTR EntityName, BSTR DuplicatedEntityName);
long __fastcall ScProcessFlashJob(BSTR Name, long JobNum, long Mode, long Flags);
BSTR __fastcall ScFlashCommand(BSTR Command, long Flags, BSTR* Return);
long __fastcall ScSetIDStringData(long Type, long Index, BSTR Data);
long __fastcall ScExport(BSTR EntityName, BSTR FileName, BSTR Type, double Resolution,
long Flags);
long __fastcall ScSlice(BSTR EntityName, BSTR LayerSolidName, double sliceThickness,
long doSliceOnlySelected, long doReverseDirection);
long __fastcall ScSetPenPathForPen(short* pen, short* enable, short* penToUse1,
int* loopOfPenToUse1, short* penToUse2,
int* loopOfPenToUse2, short* penToUse3,
int* loopOfPenToUse3, short* penToUse4,
int* loopOfPenToUse4, short* penToUse5,
int* loopOfPenToUse5);
long __fastcall ScGetPenPathForPen(short* pen, short* enable, short* penToUse1,
int* loopOfPenToUse1, short* penToUse2,
int* loopOfPenToUse2, short* penToUse3,
int* loopOfPenToUse3, short* penToUse4,
int* loopOfPenToUse4, short* penToUse5,
int* loopOfPenToUse5);
long __fastcall ScRotateEntity3D(BSTR EntityName, double px, double py, double pz,
double vx, double vy, double vz, double Angle);
long __fastcall ScGetEntityOutline2D(BSTR EntityName, double* MinX, double* MinY,
double* MaxX, double* MaxY);
long __fastcall ScGetEntityOutline3D(BSTR EntityName, double* MinX, double* MinY,
double* MaxX, double* MaxY, double* MinZ,
double* MaxZ);
// OCX properties
//
__property _DSamlight_client_ctrl_ocxDisp ControlInterface={ read=GetDefaultInterface };
// Published properties
//
__published:
// Standard/Extended properties
//
__property TabStop;
__property Align;
__property DragCursor;
__property DragMode;
__property ParentShowHint;
__property PopupMenu;
__property ShowHint;
__property TabOrder;
__property Visible;
__property OnDragDrop;
__property OnDragOver;
__property OnEndDrag;
__property OnEnter;
__property OnExit;
__property OnStartDrag;
// OCX properties
//
// OCX Events
//
};
typedef TScSamlightClientCtrl TScSamlightClientCtrlProxy;
// *********************************************************************//
// COM Component Proxy Class Declaration
// Component Name : TScConnectionToolCtrl
// Help String : ScConnectionToolCtrl
// Default Interface: SC_IConnectionToolCtrl
// Def. Intf. Object: TCOMSC_IConnectionToolCtrl
// Def. Intf. DISP? : No
// Event Interface: SC_DConnectionToolEvents
// TypeFlags : (2) CanCreate
// *********************************************************************//
// *********************************************************************//
// Definition of closures to allow VCL handlers to catch OCX events.
// *********************************************************************//
typedef void __fastcall (__closure * TScConnectionToolCtrlScReceived)(System::TObject * Sender,
long MessageSize);
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
// Proxy class to host ScConnectionToolCtrl in CBuilder IDE/Applications.
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
class PACKAGE TScConnectionToolCtrl : public TOleControl
{
OVERLOADED_PROP_METHODS;
static TNoParam OptParam;
static GUID DEF_CTL_INTF;
// Instance of Closures to expose OCX Events as VCL ones
//
TScConnectionToolCtrlScReceived FOnScReceived;
// Default Interace of OCX
//
TCOMSC_IConnectionToolCtrl m_OCXIntf;
// VCL Property Getters/Setters which delegate to OCX
//
// Static variables used by all instances of OCX proxy
//
static int EventDispIDs[1];
static TControlData CControlData;
static GUID CTL_DEF_INTF;
// Method providing access to interface as __property
//
TCOMSC_IConnectionToolCtrl __fastcall GetDefaultInterface();
TCOMSC_IConnectionToolCtrl __fastcall GetControlInterface()
{ return GetDefaultInterface(); }
protected:
void __fastcall CreateControl ();
void __fastcall InitControlData();
public:
virtual __fastcall TScConnectionToolCtrl(TComponent* AOwner) : TOleControl(AOwner)
{};
virtual __fastcall TScConnectionToolCtrl(HWND Parent) : TOleControl(Parent)
{};
// OCX methods
//
long __fastcall ScInitWriteBuffer(void);
long __fastcall ScInitReadBuffer(void);
long __fastcall ScOpenConnection(BSTR ListenName/*[in]*/, long ListenPort/*[in]*/,
BSTR RecipientName/*[in]*/, long RecipientPort/*[in]*/);
long __fastcall ScAddString(BSTR Str/*[in]*/);
long __fastcall ScAddLong(long Value/*[in]*/);
long __fastcall ScAddDouble(double Value/*[in]*/);
BSTR __fastcall ScGetString(void);
long __fastcall ScGetLong(void);
double __fastcall ScGetDouble(void);
long __fastcall ScSend(void);
long __fastcall ScWaitForReceived(long TimeOut/*[in]*/);
long __fastcall ScGetLastResult(void);
long __fastcall ScCreateSocket(BSTR ListenName/*[in]*/, long ListenPort/*[in]*/);
long __fastcall ScConnectTo(BSTR RecipientName/*[in]*/, long RecipientPort/*[in]*/);
long __fastcall ScClose(void);
long __fastcall ScGetLastError(void);
// OCX properties
//
__property TCOMSC_IConnectionToolCtrl ControlInterface={ read=GetDefaultInterface };
// Published properties
//
__published:
// Standard/Extended properties
//
// OCX properties
//
__property int ScConnectionType={ read=GetIntegerProp, write=SetIntegerProp, stored=false, index=2000 };
__property int ScMode={ read=GetIntegerProp, write=SetIntegerProp, stored=false, index=2013 };
// OCX Events
//
__property TScConnectionToolCtrlScReceived OnScReceived={ read=FOnScReceived, write=FOnScReceived };
};
typedef TScConnectionToolCtrl TScConnectionToolCtrlProxy;
}; // namespace Samlight_client_ctrl_ocxlib_tlb
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Samlight_client_ctrl_ocxlib_tlb;
#endif
#pragma option pop
#endif // SAMLIGHT_CLIENT_CTRL_OCXLib_OCXH
| [
"[email protected]"
] | |
757b670870964ccd4dc4b00d23479da7116059fc | 63c7496f5f92fac94a9efa5f089113259409b5a3 | /src/walletdb.cpp | c0c4b01c656ea7f517ce6554c13d928671445e18 | [
"MIT"
] | permissive | Jahare/Volt-1 | 54c657f5e292e2b44f085349e9baa22ac639aba1 | 24eddc9160a20145a1a4a187b643cdf138a87c1c | refs/heads/master | 2021-06-15T23:11:20.150952 | 2017-02-27T20:33:24 | 2017-02-27T20:33:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,350 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// 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 "walletdb.h"
#include "base58.h"
#include "protocol.h"
#include "serialize.h"
#include "sync.h"
#include "wallet.h"
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
static uint64_t nAccountingEntryNumber = 0;
extern bool fWalletUnlockStakingOnly;
//
// CWalletDB
//
bool CWalletDB::WriteName(const string& strAddress, const string& strName)
{
nWalletDBUpdated++;
return Write(make_pair(string("name"), strAddress), strName);
}
bool CWalletDB::EraseName(const string& strAddress)
{
// This should only be used for sending addresses, never for receiving addresses,
// receiving addresses must always have an address book entry if they're not change return.
nWalletDBUpdated++;
return Erase(make_pair(string("name"), strAddress));
}
bool CWalletDB::WriteTx(uint256 hash, const CWalletTx& wtx)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("tx"), hash), wtx);
}
bool CWalletDB::EraseTx(uint256 hash)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("tx"), hash));
}
bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
{
nWalletDBUpdated++;
if (!Write(std::make_pair(std::string("keymeta"), vchPubKey),
keyMeta, false))
return false;
// hash pubkey/privkey to accelerate wallet load
std::vector<unsigned char> vchKey;
vchKey.reserve(vchPubKey.size() + vchPrivKey.size());
vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end());
return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false);
}
bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta)
{
const bool fEraseUnencryptedKey = true;
nWalletDBUpdated++;
if (!Write(std::make_pair(std::string("keymeta"), vchPubKey),
keyMeta))
return false;
if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false))
return false;
if (fEraseUnencryptedKey)
{
Erase(std::make_pair(std::string("key"), vchPubKey));
Erase(std::make_pair(std::string("wkey"), vchPubKey));
}
return true;
}
bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true);
}
bool CWalletDB::WriteCScript(const uint160& hash, const CScript& redeemScript)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("cscript"), hash), redeemScript, false);
}
bool CWalletDB::WriteBestBlock(const CBlockLocator& locator)
{
nWalletDBUpdated++;
return Write(std::string("bestblock"), locator);
}
bool CWalletDB::ReadBestBlock(CBlockLocator& locator)
{
return Read(std::string("bestblock"), locator);
}
bool CWalletDB::WriteOrderPosNext(int64_t nOrderPosNext)
{
nWalletDBUpdated++;
return Write(std::string("orderposnext"), nOrderPosNext);
}
bool CWalletDB::WriteDefaultKey(const CPubKey& vchPubKey)
{
nWalletDBUpdated++;
return Write(std::string("defaultkey"), vchPubKey);
}
bool CWalletDB::ReadPool(int64_t nPool, CKeyPool& keypool)
{
return Read(std::make_pair(std::string("pool"), nPool), keypool);
}
bool CWalletDB::WritePool(int64_t nPool, const CKeyPool& keypool)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("pool"), nPool), keypool);
}
bool CWalletDB::ErasePool(int64_t nPool)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("pool"), nPool));
}
bool CWalletDB::WriteMinVersion(int nVersion)
{
return Write(std::string("minversion"), nVersion);
}
bool CWalletDB::ReadAccount(const string& strAccount, CAccount& account)
{
account.SetNull();
return Read(make_pair(string("acc"), strAccount), account);
}
bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
{
return Write(make_pair(string("acc"), strAccount), account);
}
bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry)
{
return Write(boost::make_tuple(string("acentry"), acentry.strAccount, nAccEntryNum), acentry);
}
bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
{
return WriteAccountingEntry(++nAccountingEntryNumber, acentry);
}
int64_t CWalletDB::GetAccountCreditDebit(const string& strAccount)
{
list<CAccountingEntry> entries;
ListAccountCreditDebit(strAccount, entries);
int64_t nCreditDebit = 0;
BOOST_FOREACH (const CAccountingEntry& entry, entries)
nCreditDebit += entry.nCreditDebit;
return nCreditDebit;
}
void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& entries)
{
bool fAllAccounts = (strAccount == "*");
Dbc* pcursor = GetCursor();
if (!pcursor)
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
unsigned int fFlags = DB_SET_RANGE;
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
if (fFlags == DB_SET_RANGE)
ssKey << boost::make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64_t(0));
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
fFlags = DB_NEXT;
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
{
pcursor->close();
throw runtime_error("CWalletDB::ListAccountCreditDebit() : error scanning DB");
}
// Unserialize
string strType;
ssKey >> strType;
if (strType != "acentry")
break;
CAccountingEntry acentry;
ssKey >> acentry.strAccount;
if (!fAllAccounts && acentry.strAccount != strAccount)
break;
ssValue >> acentry;
ssKey >> acentry.nEntryNo;
entries.push_back(acentry);
}
pcursor->close();
}
DBErrors
CWalletDB::ReorderTransactions(CWallet* pwallet)
{
LOCK(pwallet->cs_wallet);
// Old wallets didn't have any defined order for transactions
// Probably a bad idea to change the output of this
// First: get all CWalletTx and CAccountingEntry into a sorted-by-time multimap.
typedef pair<CWalletTx*, CAccountingEntry*> TxPair;
typedef multimap<int64_t, TxPair > TxItems;
TxItems txByTime;
for (map<uint256, CWalletTx>::iterator it = pwallet->mapWallet.begin(); it != pwallet->mapWallet.end(); ++it)
{
CWalletTx* wtx = &((*it).second);
txByTime.insert(make_pair(wtx->nTimeReceived, TxPair(wtx, (CAccountingEntry*)0)));
}
list<CAccountingEntry> acentries;
ListAccountCreditDebit("", acentries);
BOOST_FOREACH(CAccountingEntry& entry, acentries)
{
txByTime.insert(make_pair(entry.nTime, TxPair((CWalletTx*)0, &entry)));
}
int64_t& nOrderPosNext = pwallet->nOrderPosNext;
nOrderPosNext = 0;
std::vector<int64_t> nOrderPosOffsets;
for (TxItems::iterator it = txByTime.begin(); it != txByTime.end(); ++it)
{
CWalletTx *const pwtx = (*it).second.first;
CAccountingEntry *const pacentry = (*it).second.second;
int64_t& nOrderPos = (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos;
if (nOrderPos == -1)
{
nOrderPos = nOrderPosNext++;
nOrderPosOffsets.push_back(nOrderPos);
if (pwtx)
{
if (!WriteTx(pwtx->GetHash(), *pwtx))
return DB_LOAD_FAIL;
}
else
if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry))
return DB_LOAD_FAIL;
}
else
{
int64_t nOrderPosOff = 0;
BOOST_FOREACH(const int64_t& nOffsetStart, nOrderPosOffsets)
{
if (nOrderPos >= nOffsetStart)
++nOrderPosOff;
}
nOrderPos += nOrderPosOff;
nOrderPosNext = std::max(nOrderPosNext, nOrderPos + 1);
if (!nOrderPosOff)
continue;
// Since we're changing the order, write it back
if (pwtx)
{
if (!WriteTx(pwtx->GetHash(), *pwtx))
return DB_LOAD_FAIL;
}
else
if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry))
return DB_LOAD_FAIL;
}
}
WriteOrderPosNext(nOrderPosNext);
return DB_LOAD_OK;
}
class CWalletScanState {
public:
unsigned int nKeys;
unsigned int nCKeys;
unsigned int nKeyMeta;
bool fIsEncrypted;
bool fAnyUnordered;
int nFileVersion;
vector<uint256> vWalletUpgrade;
CWalletScanState() {
nKeys = nCKeys = nKeyMeta = 0;
fIsEncrypted = false;
fAnyUnordered = false;
nFileVersion = 0;
}
};
bool
ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
CWalletScanState &wss, string& strType, string& strErr)
{
try {
// Unserialize
// Taking advantage of the fact that pair serialization
// is just the two items serialized one after the other
ssKey >> strType;
if (strType == "name")
{
string strAddress;
ssKey >> strAddress;
ssValue >> pwallet->mapAddressBook[CBitcoinAddress(strAddress).Get()];
}
else if (strType == "tx")
{
uint256 hash;
ssKey >> hash;
CWalletTx& wtx = pwallet->mapWallet[hash];
ssValue >> wtx;
if (wtx.CheckTransaction() && (wtx.GetHash() == hash))
wtx.BindWallet(pwallet);
else
{
pwallet->mapWallet.erase(hash);
return false;
}
// Undo serialize changes in 31600
if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)
{
if (!ssValue.empty())
{
char fTmp;
char fUnused;
ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
strErr = strprintf("LoadWallet() upgrading tx ver=%d %d '%s' %s",
wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount, hash.ToString());
wtx.fTimeReceivedIsTxTime = fTmp;
}
else
{
strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString());
wtx.fTimeReceivedIsTxTime = 0;
}
wss.vWalletUpgrade.push_back(hash);
}
if (wtx.nOrderPos == -1)
wss.fAnyUnordered = true;
//// debug print
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString());
//LogPrintf(" %12d %s %s %s\n",
// wtx.vout[0].nValue,
// DateTimeStrFormat("%x %H:%M:%S", wtx.GetBlockTime()),
// wtx.hashBlock.ToString(),
// wtx.mapValue["message"]);
}
else if (strType == "acentry")
{
string strAccount;
ssKey >> strAccount;
uint64_t nNumber;
ssKey >> nNumber;
if (nNumber > nAccountingEntryNumber)
nAccountingEntryNumber = nNumber;
if (!wss.fAnyUnordered)
{
CAccountingEntry acentry;
ssValue >> acentry;
if (acentry.nOrderPos == -1)
wss.fAnyUnordered = true;
}
}
else if (strType == "key" || strType == "wkey")
{
CPubKey vchPubKey;
ssKey >> vchPubKey;
if (!vchPubKey.IsValid())
{
strErr = "Error reading wallet database: CPubKey corrupt";
return false;
}
CKey key;
CPrivKey pkey;
uint256 hash = 0;
if (strType == "key")
{
wss.nKeys++;
ssValue >> pkey;
} else {
CWalletKey wkey;
ssValue >> wkey;
pkey = wkey.vchPrivKey;
}
// Old wallets store keys as "key" [pubkey] => [privkey]
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
// using EC operations as a checksum.
// Newer wallets store keys as "key"[pubkey] => [privkey][hash(pubkey,privkey)], which is much faster while
// remaining backwards-compatible.
try
{
ssValue >> hash;
}
catch(...){}
bool fSkipCheck = false;
if (hash != 0)
{
// hash pubkey/privkey to accelerate wallet load
std::vector<unsigned char> vchKey;
vchKey.reserve(vchPubKey.size() + pkey.size());
vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
vchKey.insert(vchKey.end(), pkey.begin(), pkey.end());
if (Hash(vchKey.begin(), vchKey.end()) != hash)
{
strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt";
return false;
}
fSkipCheck = true;
}
if (!key.Load(pkey, vchPubKey, fSkipCheck))
{
strErr = "Error reading wallet database: CPrivKey corrupt";
return false;
}
if (!pwallet->LoadKey(key, vchPubKey))
{
strErr = "Error reading wallet database: LoadKey failed";
return false;
}
}
else if (strType == "mkey")
{
unsigned int nID;
ssKey >> nID;
CMasterKey kMasterKey;
ssValue >> kMasterKey;
if(pwallet->mapMasterKeys.count(nID) != 0)
{
strErr = strprintf("Error reading wallet database: duplicate CMasterKey id %u", nID);
return false;
}
pwallet->mapMasterKeys[nID] = kMasterKey;
if (pwallet->nMasterKeyMaxID < nID)
pwallet->nMasterKeyMaxID = nID;
}
else if (strType == "ckey")
{
wss.nCKeys++;
vector<unsigned char> vchPubKey;
ssKey >> vchPubKey;
vector<unsigned char> vchPrivKey;
ssValue >> vchPrivKey;
if (!pwallet->LoadCryptedKey(vchPubKey, vchPrivKey))
{
strErr = "Error reading wallet database: LoadCryptedKey failed";
return false;
}
wss.fIsEncrypted = true;
}
else if (strType == "keymeta")
{
CPubKey vchPubKey;
ssKey >> vchPubKey;
CKeyMetadata keyMeta;
ssValue >> keyMeta;
wss.nKeyMeta++;
pwallet->LoadKeyMetadata(vchPubKey, keyMeta);
// find earliest key creation time, as wallet birthday
if (!pwallet->nTimeFirstKey ||
(keyMeta.nCreateTime < pwallet->nTimeFirstKey))
pwallet->nTimeFirstKey = keyMeta.nCreateTime;
}
else if (strType == "defaultkey")
{
ssValue >> pwallet->vchDefaultKey;
}
else if (strType == "pool")
{
int64_t nIndex;
ssKey >> nIndex;
CKeyPool keypool;
ssValue >> keypool;
pwallet->setKeyPool.insert(nIndex);
// If no metadata exists yet, create a default with the pool key's
// creation time. Note that this may be overwritten by actually
// stored metadata for that key later, which is fine.
CKeyID keyid = keypool.vchPubKey.GetID();
if (pwallet->mapKeyMetadata.count(keyid) == 0)
pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
}
else if (strType == "version")
{
ssValue >> wss.nFileVersion;
if (wss.nFileVersion == 10300)
wss.nFileVersion = 300;
}
else if (strType == "cscript")
{
uint160 hash;
ssKey >> hash;
CScript script;
ssValue >> script;
if (!pwallet->LoadCScript(script))
{
strErr = "Error reading wallet database: LoadCScript failed";
return false;
}
}
else if (strType == "orderposnext")
{
ssValue >> pwallet->nOrderPosNext;
}
} catch (...)
{
return false;
}
return true;
}
static bool IsKeyType(string strType)
{
return (strType== "key" || strType == "wkey" ||
strType == "mkey" || strType == "ckey");
}
DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
{
pwallet->vchDefaultKey = CPubKey();
CWalletScanState wss;
bool fNoncriticalErrors = false;
DBErrors result = DB_LOAD_OK;
try {
LOCK(pwallet->cs_wallet);
int nMinVersion = 0;
if (Read((string)"minversion", nMinVersion))
{
if (nMinVersion > CLIENT_VERSION)
return DB_TOO_NEW;
pwallet->LoadMinVersion(nMinVersion);
}
// Get cursor
Dbc* pcursor = GetCursor();
if (!pcursor)
{
LogPrintf("Error getting wallet database cursor\n");
return DB_CORRUPT;
}
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = ReadAtCursor(pcursor, ssKey, ssValue);
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
{
LogPrintf("Error reading next record from wallet database\n");
return DB_CORRUPT;
}
// Try to be tolerant of single corrupt records:
string strType, strErr;
if (!ReadKeyValue(pwallet, ssKey, ssValue, wss, strType, strErr))
{
// losing keys is considered a catastrophic error, anything else
// we assume the user can live with:
if (IsKeyType(strType))
result = DB_CORRUPT;
else
{
// Leave other errors alone, if we try to fix them we might make things worse.
fNoncriticalErrors = true; // ... but do warn the user there is something wrong.
if (strType == "tx")
// Rescan if there is a bad transaction record:
SoftSetBoolArg("-rescan", true);
}
}
if (!strErr.empty())
LogPrintf("%s\n", strErr);
}
pcursor->close();
}
catch (boost::thread_interrupted) {
throw;
}
catch (...) {
result = DB_CORRUPT;
}
if (fNoncriticalErrors && result == DB_LOAD_OK)
result = DB_NONCRITICAL_ERROR;
// Any wallet corruption at all: skip any rewriting or
// upgrading, we don't want to make it worse.
if (result != DB_LOAD_OK)
return result;
LogPrintf("nFileVersion = %d\n", wss.nFileVersion);
LogPrintf("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total\n",
wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys);
// nTimeFirstKey is only reliable if all keys have metadata
if ((wss.nKeys + wss.nCKeys) != wss.nKeyMeta)
pwallet->nTimeFirstKey = 1; // 0 would be considered 'no value'
BOOST_FOREACH(uint256 hash, wss.vWalletUpgrade)
WriteTx(hash, pwallet->mapWallet[hash]);
// Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc:
if (wss.fIsEncrypted && (wss.nFileVersion == 40000 || wss.nFileVersion == 50000))
return DB_NEED_REWRITE;
if (wss.nFileVersion < CLIENT_VERSION) // Update
WriteVersion(CLIENT_VERSION);
if (wss.fAnyUnordered)
result = ReorderTransactions(pwallet);
return result;
}
void ThreadFlushWalletDB(const string& strFile)
{
// Make this thread recognisable as the wallet flushing thread
RenameThread("voltcoin-wallet");
static bool fOneThread;
if (fOneThread)
return;
fOneThread = true;
if (!GetBoolArg("-flushwallet", true))
return;
unsigned int nLastSeen = nWalletDBUpdated;
unsigned int nLastFlushed = nWalletDBUpdated;
int64_t nLastWalletUpdate = GetTime();
while (true)
{
MilliSleep(500);
if (nLastSeen != nWalletDBUpdated)
{
nLastSeen = nWalletDBUpdated;
nLastWalletUpdate = GetTime();
}
if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2)
{
TRY_LOCK(bitdb.cs_db,lockDb);
if (lockDb)
{
// Don't do this if any databases are in use
int nRefCount = 0;
map<string, int>::iterator mi = bitdb.mapFileUseCount.begin();
while (mi != bitdb.mapFileUseCount.end())
{
nRefCount += (*mi).second;
mi++;
}
if (nRefCount == 0)
{
boost::this_thread::interruption_point();
map<string, int>::iterator mi = bitdb.mapFileUseCount.find(strFile);
if (mi != bitdb.mapFileUseCount.end())
{
LogPrint("db", "Flushing wallet.dat\n");
nLastFlushed = nWalletDBUpdated;
int64_t nStart = GetTimeMillis();
// Flush wallet.dat so it's self contained
bitdb.CloseDb(strFile);
bitdb.CheckpointLSN(strFile);
bitdb.mapFileUseCount.erase(mi++);
LogPrint("db", "Flushed wallet.dat %dms\n", GetTimeMillis() - nStart);
}
}
}
}
}
}
bool BackupWallet(const CWallet& wallet, const string& strDest)
{
if (!wallet.fFileBacked)
return false;
while (true)
{
{
LOCK(bitdb.cs_db);
if (!bitdb.mapFileUseCount.count(wallet.strWalletFile) || bitdb.mapFileUseCount[wallet.strWalletFile] == 0)
{
// Flush log data to the dat file
bitdb.CloseDb(wallet.strWalletFile);
bitdb.CheckpointLSN(wallet.strWalletFile);
bitdb.mapFileUseCount.erase(wallet.strWalletFile);
// Copy wallet.dat
filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
filesystem::path pathDest(strDest);
if (filesystem::is_directory(pathDest))
pathDest /= wallet.strWalletFile;
try {
#if BOOST_VERSION >= 104000
filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
#else
filesystem::copy_file(pathSrc, pathDest);
#endif
LogPrintf("copied wallet.dat to %s\n", pathDest.string());
return true;
} catch(const filesystem::filesystem_error &e) {
LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what());
return false;
}
}
}
MilliSleep(100);
}
return false;
}
//
// Try to (very carefully!) recover wallet.dat if there is a problem.
//
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
{
// Recovery procedure:
// move wallet.dat to wallet.timestamp.bak
// Call Salvage with fAggressive=true to
// get as much data as possible.
// Rewrite salvaged data to wallet.dat
// Set -rescan so any missing transactions will be
// found.
int64_t now = GetTime();
std::string newFilename = strprintf("wallet.%d.bak", now);
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
newFilename.c_str(), DB_AUTO_COMMIT);
if (result == 0)
LogPrintf("Renamed %s to %s\n", filename, newFilename);
else
{
LogPrintf("Failed to rename %s to %s\n", filename, newFilename);
return false;
}
std::vector<CDBEnv::KeyValPair> salvagedData;
bool allOK = dbenv.Salvage(newFilename, true, salvagedData);
if (salvagedData.empty())
{
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
return false;
}
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
bool fSuccess = allOK;
Db* pdbCopy = new Db(&dbenv.dbenv, 0);
int ret = pdbCopy->open(NULL, // Txn pointer
filename.c_str(), // Filename
"main", // Logical db name
DB_BTREE, // Database type
DB_CREATE, // Flags
0);
if (ret > 0)
{
LogPrintf("Cannot create database file %s\n", filename);
return false;
}
CWallet dummyWallet;
CWalletScanState wss;
DbTxn* ptxn = dbenv.TxnBegin();
BOOST_FOREACH(CDBEnv::KeyValPair& row, salvagedData)
{
if (fOnlyKeys)
{
CDataStream ssKey(row.first, SER_DISK, CLIENT_VERSION);
CDataStream ssValue(row.second, SER_DISK, CLIENT_VERSION);
string strType, strErr;
bool fReadOK = ReadKeyValue(&dummyWallet, ssKey, ssValue,
wss, strType, strErr);
if (!IsKeyType(strType))
continue;
if (!fReadOK)
{
LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, strErr);
continue;
}
}
Dbt datKey(&row.first[0], row.first.size());
Dbt datValue(&row.second[0], row.second.size());
int ret2 = pdbCopy->put(ptxn, &datKey, &datValue, DB_NOOVERWRITE);
if (ret2 > 0)
fSuccess = false;
}
ptxn->commit(0);
pdbCopy->close(0);
delete pdbCopy;
return fSuccess;
}
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename)
{
return CWalletDB::Recover(dbenv, filename, false);
}
| [
"[email protected]"
] | |
deab1f94ee8851f2a397ee213ae447f3b26ffa63 | 4fc01b9dc05e510a3548a44bbb39a6a682461d25 | /src/base58.h | 66e85e523e9ea9b7aa75aac6888e8bb2da3b34ad | [
"MIT"
] | permissive | woocoins/wooo | e70c2ce6867fc118b8201050ff791c8a556579df | 16bb7eeb9edd98b4c09de24d6450d291bebd5ebe | refs/heads/master | 2021-01-10T02:22:09.325020 | 2015-05-26T14:53:48 | 2015-05-26T14:53:48 | 36,302,660 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,014 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// 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.
//
// Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and
// could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at.
// - Double-clicking selects the whole number as one word if it's all alphanumeric.
//
#ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H
#include <string>
#include <vector>
#include "bignum.h"
#include "key.h"
#include "script.h"
#include "allocators.h"
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
// Encode a byte sequence as a base58-encoded string
inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
{
CAutoBN_CTX pctx;
CBigNum bn58 = 58;
CBigNum bn0 = 0;
// Convert big endian data to little endian
// Extra zero at the end make sure bignum will interpret as a positive number
std::vector<unsigned char> vchTmp(pend-pbegin+1, 0);
reverse_copy(pbegin, pend, vchTmp.begin());
// Convert little endian data to bignum
CBigNum bn;
bn.setvch(vchTmp);
// Convert bignum to std::string
std::string str;
// Expected size increase from base58 conversion is approximately 137%
// use 138% to be safe
str.reserve((pend - pbegin) * 138 / 100 + 1);
CBigNum dv;
CBigNum rem;
while (bn > bn0)
{
if (!BN_div(&dv, &rem, &bn, &bn58, pctx))
throw bignum_error("EncodeBase58 : BN_div failed");
bn = dv;
unsigned int c = rem.getulong();
str += pszBase58[c];
}
// Leading zeroes encoded as base58 zeros
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
str += pszBase58[0];
// Convert little endian std::string to big endian
reverse(str.begin(), str.end());
return str;
}
// Encode a byte vector as a base58-encoded string
inline std::string EncodeBase58(const std::vector<unsigned char>& vch)
{
return EncodeBase58(&vch[0], &vch[0] + vch.size());
}
// Decode a base58-encoded string psz into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet)
{
CAutoBN_CTX pctx;
vchRet.clear();
CBigNum bn58 = 58;
CBigNum bn = 0;
CBigNum bnChar;
while (isspace(*psz))
psz++;
// Convert big endian string to bignum
for (const char* p = psz; *p; p++)
{
const char* p1 = strchr(pszBase58, *p);
if (p1 == NULL)
{
while (isspace(*p))
p++;
if (*p != '\0')
return false;
break;
}
bnChar.setulong(p1 - pszBase58);
if (!BN_mul(&bn, &bn, &bn58, pctx))
throw bignum_error("DecodeBase58 : BN_mul failed");
bn += bnChar;
}
// Get bignum as little endian data
std::vector<unsigned char> vchTmp = bn.getvch();
// Trim off sign byte if present
if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80)
vchTmp.erase(vchTmp.end()-1);
// Restore leading zeros
int nLeadingZeros = 0;
for (const char* p = psz; *p == pszBase58[0]; p++)
nLeadingZeros++;
vchRet.assign(nLeadingZeros + vchTmp.size(), 0);
// Convert little endian data to big endian
reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size());
return true;
}
// Decode a base58-encoded string str into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet)
{
return DecodeBase58(str.c_str(), vchRet);
}
// Encode a byte vector to a base58-encoded string, including checksum
inline std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
{
// add 4-byte hash check to the end
std::vector<unsigned char> vch(vchIn);
uint256 hash = Hash(vch.begin(), vch.end());
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
return EncodeBase58(vch);
}
// Decode a base58-encoded string psz that includes a checksum, into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet)
{
if (!DecodeBase58(psz, vchRet))
return false;
if (vchRet.size() < 4)
{
vchRet.clear();
return false;
}
uint256 hash = Hash(vchRet.begin(), vchRet.end()-4);
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
{
vchRet.clear();
return false;
}
vchRet.resize(vchRet.size()-4);
return true;
}
// Decode a base58-encoded string str that includes a checksum, into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet)
{
return DecodeBase58Check(str.c_str(), vchRet);
}
/** Base class for all base58-encoded data */
class CBase58Data
{
protected:
// the version byte
unsigned char nVersion;
// the actually encoded data
typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar;
vector_uchar vchData;
CBase58Data()
{
nVersion = 0;
vchData.clear();
}
void SetData(int nVersionIn, const void* pdata, size_t nSize)
{
nVersion = nVersionIn;
vchData.resize(nSize);
if (!vchData.empty())
memcpy(&vchData[0], pdata, nSize);
}
void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend)
{
SetData(nVersionIn, (void*)pbegin, pend - pbegin);
}
public:
bool SetString(const char* psz)
{
std::vector<unsigned char> vchTemp;
DecodeBase58Check(psz, vchTemp);
if (vchTemp.empty())
{
vchData.clear();
nVersion = 0;
return false;
}
nVersion = vchTemp[0];
vchData.resize(vchTemp.size() - 1);
if (!vchData.empty())
memcpy(&vchData[0], &vchTemp[1], vchData.size());
OPENSSL_cleanse(&vchTemp[0], vchData.size());
return true;
}
bool SetString(const std::string& str)
{
return SetString(str.c_str());
}
std::string ToString() const
{
std::vector<unsigned char> vch(1, nVersion);
vch.insert(vch.end(), vchData.begin(), vchData.end());
return EncodeBase58Check(vch);
}
int CompareTo(const CBase58Data& b58) const
{
if (nVersion < b58.nVersion) return -1;
if (nVersion > b58.nVersion) return 1;
if (vchData < b58.vchData) return -1;
if (vchData > b58.vchData) return 1;
return 0;
}
bool operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; }
bool operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; }
bool operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; }
bool operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; }
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
};
/** base58-encoded Bitcoin addresses.
* Public-key-hash-addresses have version 0 (or 111 testnet).
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
* Script-hash-addresses have version 5 (or 196 testnet).
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
*/
class CBitcoinAddress;
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
{
private:
CBitcoinAddress *addr;
public:
CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { }
bool operator()(const CKeyID &id) const;
bool operator()(const CScriptID &id) const;
bool operator()(const CNoDestination &no) const;
};
class CBitcoinAddress : public CBase58Data
{
public:
enum
{
PUBKEY_ADDRESS = 73, // WOOLFCOIN addresses start with W
SCRIPT_ADDRESS = 5,
PUBKEY_ADDRESS_TEST = 111,
SCRIPT_ADDRESS_TEST = 196,
};
bool Set(const CKeyID &id) {
SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &id, 20);
return true;
}
bool Set(const CScriptID &id) {
SetData(fTestNet ? SCRIPT_ADDRESS_TEST : SCRIPT_ADDRESS, &id, 20);
return true;
}
bool Set(const CTxDestination &dest)
{
return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
}
bool IsValid() const
{
unsigned int nExpectedSize = 20;
bool fExpectTestNet = false;
switch(nVersion)
{
case PUBKEY_ADDRESS:
nExpectedSize = 20; // Hash of public key
fExpectTestNet = false;
break;
case SCRIPT_ADDRESS:
nExpectedSize = 20; // Hash of CScript
fExpectTestNet = false;
break;
case PUBKEY_ADDRESS_TEST:
nExpectedSize = 20;
fExpectTestNet = true;
break;
case SCRIPT_ADDRESS_TEST:
nExpectedSize = 20;
fExpectTestNet = true;
break;
default:
return false;
}
return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize;
}
CBitcoinAddress()
{
}
CBitcoinAddress(const CTxDestination &dest)
{
Set(dest);
}
CBitcoinAddress(const std::string& strAddress)
{
SetString(strAddress);
}
CBitcoinAddress(const char* pszAddress)
{
SetString(pszAddress);
}
CTxDestination Get() const {
if (!IsValid())
return CNoDestination();
switch (nVersion) {
case PUBKEY_ADDRESS:
case PUBKEY_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
return CKeyID(id);
}
case SCRIPT_ADDRESS:
case SCRIPT_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
return CScriptID(id);
}
}
return CNoDestination();
}
bool GetKeyID(CKeyID &keyID) const {
if (!IsValid())
return false;
switch (nVersion) {
case PUBKEY_ADDRESS:
case PUBKEY_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
keyID = CKeyID(id);
return true;
}
default: return false;
}
}
bool IsScript() const {
if (!IsValid())
return false;
switch (nVersion) {
case SCRIPT_ADDRESS:
case SCRIPT_ADDRESS_TEST: {
return true;
}
default: return false;
}
}
};
bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; }
/** A base58-encoded secret key */
class CBitcoinSecret : public CBase58Data
{
public:
enum
{
PRIVKEY_ADDRESS = CBitcoinAddress::PUBKEY_ADDRESS + 128,
PRIVKEY_ADDRESS_TEST = CBitcoinAddress::PUBKEY_ADDRESS_TEST + 128,
};
void SetKey(const CKey& vchSecret)
{
assert(vchSecret.IsValid());
SetData(fTestNet ? PRIVKEY_ADDRESS_TEST : PRIVKEY_ADDRESS, vchSecret.begin(), vchSecret.size());
if (vchSecret.IsCompressed())
vchData.push_back(1);
}
CKey GetKey()
{
CKey ret;
ret.Set(&vchData[0], &vchData[32], vchData.size() > 32 && vchData[32] == 1);
return ret;
}
bool IsValid() const
{
bool fExpectTestNet = false;
switch(nVersion)
{
case PRIVKEY_ADDRESS:
break;
case PRIVKEY_ADDRESS_TEST:
fExpectTestNet = true;
break;
default:
return false;
}
return fExpectTestNet == fTestNet && (vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1));
}
bool SetString(const char* pszSecret)
{
return CBase58Data::SetString(pszSecret) && IsValid();
}
bool SetString(const std::string& strSecret)
{
return SetString(strSecret.c_str());
}
CBitcoinSecret(const CKey& vchSecret)
{
SetKey(vchSecret);
}
CBitcoinSecret()
{
}
};
#endif // BITCOIN_BASE58_H
| [
"woo"
] | woo |
d991cd6b4436ecd8b3bcfd63c707c299e9d339d6 | add246d790e0e8ff9eb49955bfd276c70439e613 | /main/analyzeTOFPET2.cpp | 4e72d72040e77b452077c8a660f6635bc39e5aaa | [] | no_license | abenagli/TBStudies | 0bee17521e29272659cfc31927db7dce56a38437 | 2d9c1b2b5cd2ee25ef0c8ad4d37bdcd5aeafe99a | refs/heads/master | 2020-03-30T15:46:52.235302 | 2020-01-19T12:33:53 | 2020-01-19T12:33:53 | 151,378,759 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 87,064 | cpp | #include "interface/FitUtils.h"
#include "interface/TreeUtils.h"
#include "interface/SetTDRStyle.h"
#include "CfgManager/interface/CfgManager.h"
#include "CfgManager/interface/CfgManagerT.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include "TFile.h"
#include "TChain.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TProfile2D.h"
#include "TGraphErrors.h"
#include "TF1.h"
#include "TCanvas.h"
#include "TLatex.h"
#include "TLine.h"
#include "TRandom3.h"
float FindXMaximum(TH1F* histo, const float& xMin, const float& xMax)
{
float max = -999999999.;
int binMax = -1;
for(int bin = 1; bin <= histo->GetNbinsX(); ++bin)
{
if( histo->GetBinCenter(bin) < xMin ) continue;
if( histo->GetBinCenter(bin) > xMax ) continue;
if( histo->GetBinContent(bin) > max ) { max = histo->GetBinContent(bin); binMax = bin; };
}
return histo->GetBinCenter(binMax);
}
struct EventSingle
{
std::string stepLabel;
unsigned int ch1;
unsigned int ch2;
std::string label1;
std::string label2;
std::string label12;
float qfine1;
float qfine2;
float tot1;
float tot2;
float energy1;
float energy2;
long long time1;
long long time2;
};
struct EventCoinc
{
std::string stepLabel;
unsigned int ch1;
unsigned int ch2;
unsigned int ch3;
unsigned int ch4;
std::string label1;
std::string label2;
std::string label3;
std::string label4;
std::string label1234;
float qfine1;
float qfine2;
float qfine3;
float qfine4;
float tot1;
float tot2;
float tot3;
float tot4;
float energy1;
float energy2;
float energy3;
float energy4;
long long time1;
long long time2;
long long time3;
long long time4;
};
int main(int argc, char** argv)
{
setTDRStyle();
if( argc < 2 )
{
std::cout << ">>> analyzeBars::usage: " << argv[0] << " configFile.cfg" << std::endl;
return -1;
}
//--- parse the config file
CfgManager opts;
opts.ParseConfigFile(argv[1]);
int debugMode = 0;
if( argc > 2 ) debugMode = atoi(argv[2]);
//--- get parameters
std::string plotDir = opts.GetOpt<std::string>("Output.plotDir");
system(Form("mkdir -p %s",plotDir.c_str()));
system(Form("mkdir -p %s/qfine/",plotDir.c_str()));
system(Form("mkdir -p %s/tot/",plotDir.c_str()));
system(Form("mkdir -p %s/totRatio/",plotDir.c_str()));
system(Form("mkdir -p %s/energy/",plotDir.c_str()));
system(Form("mkdir -p %s/energyRatio/",plotDir.c_str()));
system(Form("mkdir -p %s/CTR/",plotDir.c_str()));
system(Form("mkdir -p %s/CTR_energyCorr/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/qfine/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/tot/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/totRatio/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/energy/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/energyRatio/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/CTR/",plotDir.c_str()));
system(Form("cp /afs/cern.ch/user/a/abenagli/public/index.php %s/CTR_energyCorr/",plotDir.c_str()));
//--- open files and make the tree chain
std::string inputDir = opts.GetOpt<std::string>("Input.inputDir");
std::string fileBaseName = opts.GetOpt<std::string>("Input.fileBaseName");
std::string runs = opts.GetOpt<std::string>("Input.runs");
int maxEntries = opts.GetOpt<int>("Input.maxEntries");
TChain* tree = new TChain("data","data");
std::stringstream ss(runs);
std::string token;
while( std::getline(ss,token,',') )
{
std::stringstream ss2(token);
std::string token2;
int runMin = -1;
int runMax = -1;
while( std::getline(ss2,token2,'-') )
{
if( runMin != -1 && runMax == -1 ) runMax = atoi(token2.c_str());
if( runMin == -1 ) runMin = atoi(token2.c_str());
}
for(int run = runMin; run <= runMax; ++run)
{
//std::string fileName = Form("%s/*%04d*.root",inputDir.c_str(),run);
std::string fileName = Form("%s/*%s*%d*.root",inputDir.c_str(),fileBaseName.c_str(),run);
std::cout << ">>> Adding flle " << fileName << std::endl;
tree -> Add(fileName.c_str());
}
}
//--- define channels
std::vector<unsigned int> channels = opts.GetOpt<std::vector<unsigned int> >("Channels.channels");
std::vector<int> pairsMode = opts.GetOpt<std::vector<int> >("Channels.pairsMode");
std::vector<unsigned int> pairs = opts.GetOpt<std::vector<unsigned int> >("Channels.pairs");
std::vector<std::pair<unsigned int,unsigned int> > pairsVec;
for(unsigned int ii = 0; ii < pairs.size()/2; ++ii)
{
pairsVec.push_back(std::make_pair(pairs.at(0+ii*2),pairs.at(1+ii*2)));
}
std::vector<unsigned int> bars = opts.GetOpt<std::vector<unsigned int> >("Channels.bars");
std::vector<std::pair<std::pair<int,int>,std::pair<unsigned int,unsigned int> > > barsVec;
for(unsigned int ii = 0; ii < bars.size()/4; ++ii)
{
barsVec.push_back( std::make_pair(std::make_pair(bars.at(0+ii*4),bars.at(1+ii*4)),std::make_pair(bars.at(2+ii*4),bars.at(3+ii*4))) );
}
//--- get cuts per bar / Vov
std::map<unsigned int,std::map<float,float> > cut_qfineAcc;
std::map<unsigned int,std::map<float,float> > cut_totAcc;
std::map<unsigned int,std::map<float,float> > cut_energyAcc;
std::map<unsigned int,std::map<float,float> > cut_energyFitMin;
std::map<unsigned int,std::map<float,float> > cut_energyFitMax;
for(auto ch : channels)
{
std::vector<float> Vovs = opts.GetOpt<std::vector<float> >(Form("ch%d.Vovs",int(ch)));
std::vector<float> qfineMins = opts.GetOpt<std::vector<float> >(Form("ch%d.qfineMins",int(ch)));
std::vector<float> totMins = opts.GetOpt<std::vector<float> >(Form("ch%d.totMins",int(ch)));
std::vector<float> energyMins = opts.GetOpt<std::vector<float> >(Form("ch%d.energyMins",int(ch)));
std::vector<float> energyFitMins = opts.GetOpt<std::vector<float> >(Form("ch%d.energyFitMins",int(ch)));
std::vector<float> energyFitMaxs = opts.GetOpt<std::vector<float> >(Form("ch%d.energyFitMaxs",int(ch)));
int iter = 0;
for(auto Vov : Vovs)
{
cut_qfineAcc[ch][Vov] = qfineMins.at(iter);
cut_totAcc[ch][Vov] = totMins.at(iter);
cut_energyAcc[ch][Vov] = energyMins.at(iter);
cut_energyFitMin[ch][Vov] = energyFitMins.at(iter);
cut_energyFitMax[ch][Vov] = energyFitMaxs.at(iter);
++iter;
}
}
std::map<std::string,float> cut_energyMin;
std::map<std::string,float> cut_energyMax;
//--- get plot settings
float tResMin = opts.GetOpt<float>("Plots.tResMin");
float tResMax = opts.GetOpt<float>("Plots.tResMax");
//--- define branches
float step1, step2;
unsigned int channelCount[256];
float tot[256];
float qfine[256];
float energy[256];
long long time[256];
tree -> SetBranchStatus("*",0);
tree -> SetBranchStatus("step1", 1); tree -> SetBranchAddress("step1", &step1);
tree -> SetBranchStatus("step2", 1); tree -> SetBranchAddress("step2", &step2);
tree -> SetBranchStatus("channelCount",1); tree -> SetBranchAddress("channelCount", channelCount);
tree -> SetBranchStatus("qfine", 1); tree -> SetBranchAddress("qfine", qfine);
tree -> SetBranchStatus("tot", 1); tree -> SetBranchAddress("tot", tot);
tree -> SetBranchStatus("energy", 1); tree -> SetBranchAddress("energy", energy);
tree -> SetBranchStatus("time", 1); tree -> SetBranchAddress("time", time);
//--- define histograms
std::map<std::string,int> VovLabels;
std::map<std::string,int> thLabels;
std::vector<std::string> stepLabels;
std::map<std::string,float> map_Vovs;
std::map<std::string,float> map_ths;
std::map<std::string,TH1F*> h1_qfine;
std::map<std::string,TH2F*> h2_qfine_vs_tot;
std::map<std::string,TH1F*> h1_tot;
std::map<std::string,TH2F*> h2_tot_corr;
std::map<std::string,TH1F*> h1_totRatio;
std::map<std::string,TH1F*> h1_energy;
std::map<std::string,TH1F*> h1_energy_cut;
std::map<std::string,TH2F*> h2_energy_corr;
std::map<std::string,TH1F*> h1_energyRatio;
std::map<std::string,TH1F*> h1_deltaT_raw;
std::map<std::string,TH1F*> h1_deltaT;
std::map<std::string,TProfile*> p1_deltaT_vs_energyRatio;
std::map<std::string,TH1F*> h1_deltaT_energyCorr;
//------------------------
//--- 1st loop over events
std::map<std::string,std::vector<EventSingle> > eventsSingle;
std::map<std::string,std::vector<EventCoinc> > eventsCoinc;
int nEntries = tree->GetEntries();
if( maxEntries > 0 ) nEntries = maxEntries;
for(int entry = 0; entry < nEntries; ++entry)
{
tree -> GetEntry(entry);
if( entry%10000 == 0 ) std::cout << ">>> 1st loop: reading entry " << entry << " / " << nEntries << " (" << 100.*entry/nEntries << "%)" << "\r" << std::flush;
float vth1 = float(int(step2/10000)-1);;
// float vth2 = float(int((step2-10000*vth1)/100)-1);
// float vthe = float(int((step2-10000*vth1-step2-100*vth2)/1)-1);
std::string VovLabel = Form("Vov%.1f",step1);
std::string thLabel = Form("th%02.0f",vth1);
std::string stepLabel = Form("Vov%.1f_th%02.0f",step1,vth1);
//--- create histograms, if needed
for(auto ch : channels)
{
std::string label = Form("ch%d_%s",ch,stepLabel.c_str());
if( h1_tot[label] == NULL )
{
h1_qfine[label] = new TH1F(Form("h1_qfine_%s",label.c_str()),"",512,-0.5,511.5);
h2_qfine_vs_tot[label] = new TH2F(Form("h2_qfine_vs_tot_%s",label.c_str()),"",100,0.,500,256,-0.5,255.5);
h1_tot[label] = new TH1F(Form("h1_tot_%s",label.c_str()),"",2000,0.,1000.);
h1_energy[label] = new TH1F(Form("h1_energy_%s",label.c_str()),"",1000,-10.,40.);
h1_energy_cut[label] = new TH1F(Form("h1_energy_cut_%s",label.c_str()),"",1000,-10.,40.);
VovLabels[VovLabel] += 1;
thLabels[thLabel] += 1;
stepLabels.push_back(stepLabel);
map_Vovs[stepLabel] = step1;
map_ths[stepLabel] = vth1;
}
}
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
if( h2_tot_corr[label12] == NULL )
{
h2_tot_corr[label12] = new TH2F(Form("h2_tot_corr_%s",label12.c_str()),"",100,0.,500.,100,0.,500.);
h1_totRatio[label12] = new TH1F(Form("h1_totRatio_%s",label12.c_str()),"",1000,0.,5.);
h2_energy_corr[label12] = new TH2F(Form("h2_energy_corr_%s",label12.c_str()),"",200,0.,50.,200,0.,50.);
h1_energyRatio[label12] = new TH1F(Form("h1_energyRatio_%s",label12.c_str()),"",1000,0.,5.);
h1_deltaT_raw[label12] = new TH1F(Form("h1_deltaT_raw_%s",label12.c_str()),"",1250,-2500.,2500.);
h1_deltaT[label12] = new TH1F(Form("h1_deltaT_%s",label12.c_str()),"",1250,-2500,2500.);
p1_deltaT_vs_energyRatio[label12] = new TProfile(Form("p1_deltaT_vs_energyRatio_%s",label12.c_str()),"",1000,0.,5.);
h1_deltaT_energyCorr[label12] = new TH1F(Form("h1_deltaT_energyCorr_%s",label12.c_str()),"",1250,-2500.,2500.);
}
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label1234 = Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str());
if( h1_deltaT[label1234] == NULL )
{
h1_totRatio[label1234] = new TH1F(Form("h1_totRatio_%s",label1234.c_str()),"",1000,0.,5.);
h2_tot_corr[label1234] = new TH2F(Form("h2_tot_corr_%s",label1234.c_str()),"",100,0.,500.,100,0.,500.);
h1_energyRatio[label1234] = new TH1F(Form("h1_energyRatio_%s",label1234.c_str()),"",1000,0.,5.);
h2_energy_corr[label1234] = new TH2F(Form("h2_energy_corr_%s",label1234.c_str()),"",200,0.,50.,200,0.,50.);
h1_deltaT_raw[label1234] = new TH1F(Form("h1_deltaT_raw_%s",label1234.c_str()),"",1000,-5000.,5000.);
h1_deltaT[label1234] = new TH1F(Form("h1_deltaT_%s",label1234.c_str()),"",250,-5000.,5000.);
p1_deltaT_vs_energyRatio[label1234] = new TProfile(Form("p1_deltaT_vs_energyRatio_%s",label1234.c_str()),"",1000,0.,5.);
h1_deltaT_energyCorr[label1234] = new TH1F(Form("h1_deltaT_energyCorr_%s",label1234.c_str()),"",250,-5000.,5000.);
}
}
//--- fill histograms
for(auto ch1 : channels)
{
std::string label1 = Form("ch%d_%s",ch1,stepLabel.c_str());
float qfine1 = channelCount[int(ch1)] == 1 ? qfine[int(ch1)] : -1.;
float tot1 = channelCount[int(ch1)] == 1 ? tot[int(ch1)]/1000. : -1.;
float energy1 = channelCount[int(ch1)] == 1 ? energy[int(ch1)] : -1.;
if( channelCount[int(ch1)] == 1 )
{
h1_qfine[label1] -> Fill( qfine1 );
h2_qfine_vs_tot[label1] -> Fill( tot1,qfine1 );
h1_tot[label1] -> Fill( tot1 );
h1_energy[label1] -> Fill( energy1 );
}
}
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label1 = Form("ch%d_%s",ch1,stepLabel.c_str());
std::string label2 = Form("ch%d_%s",ch2,stepLabel.c_str());
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
float qfine1 = channelCount[int(ch1)] == 1 ? qfine[int(ch1)] : -1.;
float qfine2 = channelCount[int(ch2)] == 1 ? qfine[int(ch2)] : -1.;
float tot1 = channelCount[int(ch1)] == 1 ? tot[int(ch1)]/1000. : -1.;
float tot2 = channelCount[int(ch2)] == 1 ? tot[int(ch2)]/1000. : -1.;
float energy1 = channelCount[int(ch1)] == 1 ? energy[int(ch1)] : -1.;
float energy2 = channelCount[int(ch2)] == 1 ? energy[int(ch2)] : -1.;
long long time1 = channelCount[int(ch1)] == 1 ? time[int(ch1)] : -1.;
long long time2 = channelCount[int(ch2)] == 1 ? time[int(ch2)] : -1.;
if( channelCount[int(ch1)] == 1 && channelCount[int(ch2)] == 1 )
{
h2_tot_corr[label12] -> Fill( tot1,tot2 );
h2_tot_corr[label12] -> Fill( tot1,tot2 );
h2_energy_corr[label12] -> Fill( energy1,energy2 );
h2_energy_corr[label12] -> Fill( energy1,energy2 );
EventSingle anEvent;
anEvent.stepLabel = stepLabel;
anEvent.ch1 = ch1;
anEvent.ch2 = ch2;
anEvent.label1 = label1;
anEvent.label2 = label2;
anEvent.label12 = label12;
anEvent.qfine1 = qfine1;
anEvent.qfine2 = qfine2;
anEvent.tot1 = tot1;
anEvent.tot2 = tot2;
anEvent.energy1 = energy1;
anEvent.energy2 = energy2;
anEvent.time1 = time1;
anEvent.time2 = time2;
eventsSingle[label12].push_back(anEvent);
}
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
std::string label1 = Form("ch%d_%s",ch1,stepLabel.c_str());
std::string label2 = Form("ch%d_%s",ch2,stepLabel.c_str());
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label3 = Form("ch%d_%s",ch3,stepLabel.c_str());
std::string label4 = Form("ch%d_%s",ch4,stepLabel.c_str());
std::string label1234 = Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str());
float qfine1 = channelCount[int(ch1)] == 1 ? qfine[int(ch1)] : -1.;
float qfine2 = channelCount[int(ch2)] == 1 ? qfine[int(ch2)] : -1.;
float qfine3 = channelCount[int(ch3)] == 1 ? qfine[int(ch3)] : -1.;
float qfine4 = channelCount[int(ch4)] == 1 ? qfine[int(ch4)] : -1.;
float tot1 = channelCount[int(ch1)] == 1 ? tot[int(ch1)]/1000. : -1.;
float tot2 = channelCount[int(ch2)] == 1 ? tot[int(ch2)]/1000. : -1.;
float tot3 = channelCount[int(ch3)] == 1 ? tot[int(ch3)]/1000. : -1.;
float tot4 = channelCount[int(ch4)] == 1 ? tot[int(ch4)]/1000. : -1.;
float energy1 = channelCount[int(ch1)] == 1 ? energy[int(ch1)] : -1.;
float energy2 = channelCount[int(ch2)] == 1 ? energy[int(ch2)] : -1.;
float energy3 = channelCount[int(ch3)] == 1 ? energy[int(ch3)] : -1.;
float energy4 = channelCount[int(ch4)] == 1 ? energy[int(ch4)] : -1.;
long long time1 = channelCount[int(ch1)] == 1 ? time[int(ch1)] : -1.;
long long time2 = channelCount[int(ch2)] == 1 ? time[int(ch2)] : -1.;
long long time3 = channelCount[int(ch3)] == 1 ? time[int(ch3)] : -1.;
long long time4 = channelCount[int(ch4)] == 1 ? time[int(ch4)] : -1.;
if( channelCount[int(ch1)] == 1 && channelCount[int(ch2)] == 1 && channelCount[int(ch3)] == 1 && channelCount[int(ch4)] == 1)
{
h2_tot_corr[label1234] -> Fill( 0.5*(tot1+tot2),0.5*(tot3+tot4) );
h2_energy_corr[label1234] -> Fill( 0.5*(energy1+energy2),0.5*(energy3+energy4) );
EventCoinc anEvent;
anEvent.stepLabel = stepLabel;
anEvent.ch1 = ch1;
anEvent.ch2 = ch2;
anEvent.ch3 = ch3;
anEvent.ch4 = ch4;
anEvent.label1 = label1;
anEvent.label2 = label2;
anEvent.label3 = label3;
anEvent.label4 = label4;
anEvent.label1234 = label1234;
anEvent.qfine1 = qfine1;
anEvent.qfine2 = qfine2;
anEvent.qfine3 = qfine3;
anEvent.qfine4 = qfine4;
anEvent.tot1 = tot1;
anEvent.tot2 = tot2;
anEvent.tot3 = tot3;
anEvent.tot4 = tot4;
anEvent.energy1 = energy1;
anEvent.energy2 = energy2;
anEvent.energy3 = energy3;
anEvent.energy4 = energy4;
anEvent.time1 = time1;
anEvent.time2 = time2;
anEvent.time3 = time3;
anEvent.time4 = time4;
eventsCoinc[label1234].push_back(anEvent);
}
}
}
std::cout << std::endl;
std::vector<std::string>::iterator iter;
iter = std::unique(stepLabels.begin(),stepLabels.end());
stepLabels.resize( std::distance(stepLabels.begin(),iter) );
std::sort(stepLabels.begin(),stepLabels.end());
//------------------
//--- draw 1st plots
TCanvas* c;
float* vals = new float[6];
TLatex* latex;
std::map<std::string,TGraphErrors*> g_tot_vs_th;
std::map<std::string,TGraphErrors*> g_tot_vs_Vov;
std::map<std::string,TGraphErrors*> g_energy_vs_th;
std::map<std::string,TGraphErrors*> g_energy_vs_Vov;
for(auto stepLabel : stepLabels)
{
float Vov = map_Vovs[stepLabel];
float th = map_ths[stepLabel];
std::string VovLabel(Form("Vov%.1f",Vov));
std::string thLabel(Form("th%02.0f",th));
//--------------------------------------------------------
for(auto ch : channels)
{
std::string label(Form("ch%d_%s",int(ch),stepLabel.c_str()));
c = new TCanvas(Form("c_qfine_%s",label.c_str()),Form("c_qfine_%s",label.c_str()));
// gPad -> SetLogy();
h1_qfine[label] -> SetTitle(";Q_{fine} [ADC];entries");
h1_qfine[label] -> SetLineColor(kRed);
h1_qfine[label] -> Draw();
h1_qfine[label] -> GetXaxis() -> SetRangeUser(12,200);
TLine* line_qfineAcc1 = new TLine(cut_qfineAcc[ch][Vov],h1_qfine[label]->GetMinimum(),cut_qfineAcc[ch][Vov],h1_qfine[label]->GetMaximum());
line_qfineAcc1 -> SetLineColor(kBlack);
line_qfineAcc1 -> Draw("same");
latex = new TLatex(0.65,0.85,Form("ch%d",ch));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
c -> Print(Form("%s/qfine/c_qfine_%s.png",plotDir.c_str(),label.c_str()));
c -> Print(Form("%s/qfine/c_qfine_%s.pdf",plotDir.c_str(),label.c_str()));
c = new TCanvas(Form("c_qfine_vs_tot_%s",label.c_str()),Form("c_qfine_vs_tot_%s",label.c_str()));
gPad -> SetLogz();
h2_qfine_vs_tot[label] -> SetTitle(Form(";ch%d ToT [ns];ch%d Q_{fine} [ADC]",ch,ch));
h2_qfine_vs_tot[label] -> Draw("colz");
c -> Print(Form("%s/qfine/c_qfine_vs_tot_%s.png",plotDir.c_str(),label.c_str()));
c -> Print(Form("%s/qfine/c_qfine_vs_tot_%s.pdf",plotDir.c_str(),label.c_str()));
c = new TCanvas(Form("c_tot_%s",label.c_str()),Form("c_tot_%s",label.c_str()));
// gPad -> SetLogy();
h1_tot[label] -> SetTitle(";ToT [ns];entries");
h1_tot[label] -> SetLineColor(kRed);
h1_tot[label] -> Draw();
float max1 = FindXMaximum(h1_tot[label],cut_totAcc[ch][Vov],1000.);
h1_tot[label] -> GetXaxis() -> SetRangeUser(0.25*max1,2.*max1);
TF1* fitFunc1 = new TF1("fitFunc1","gaus",max1-0.05*max1,max1+0.05*max1);
h1_tot[label] -> Fit(fitFunc1,"QNRS+");
fitFunc1 -> SetLineColor(kBlack);
fitFunc1 -> SetLineWidth(3);
fitFunc1 -> Draw("same");
TLine* line_totAcc1 = new TLine(cut_totAcc[ch][Vov],h1_tot[label]->GetMinimum(),cut_totAcc[ch][Vov],h1_tot[label]->GetMaximum());
line_totAcc1 -> SetLineColor(kBlack);
line_totAcc1 -> Draw("same");
latex = new TLatex(0.65,0.85,Form("ch%d",ch));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
c -> Print(Form("%s/tot/c_tot_%s.png",plotDir.c_str(),label.c_str()));
c -> Print(Form("%s/tot/c_tot_%s.pdf",plotDir.c_str(),label.c_str()));
if( g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] == NULL )
g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] = new TGraphErrors();
if( g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] == NULL )
g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] = new TGraphErrors();
g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] -> SetPoint(g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())]->GetN(),th,fitFunc1->GetMaximumX());
g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] -> SetPointError(g_tot_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())]->GetN()-1,0.,0.);
g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] -> SetPoint(g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())]->GetN(),Vov,fitFunc1->GetMaximumX());
g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] -> SetPointError(g_tot_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())]->GetN()-1,0.,0.);
c = new TCanvas(Form("c_energy_%s",label.c_str()),Form("c_energy_%s",label.c_str()));
// gPad -> SetLogy();
h1_energy[label] -> SetTitle(";energy [a.u.];entries");
h1_energy[label] -> SetLineColor(kRed);
h1_energy[label] -> Draw();
max1 = FindXMaximum(h1_energy[label],cut_energyAcc[ch][Vov],100.);
h1_energy[label] -> GetXaxis() -> SetRangeUser(0.1*max1,2.5*max1);
fitFunc1 = new TF1("fitFunc1","gaus",max1-cut_energyFitMin[ch][Vov]*max1,max1+cut_energyFitMax[ch][Vov]*max1);
h1_energy[label] -> Fit(fitFunc1,"QNRS+");
fitFunc1 -> SetLineColor(kBlack);
fitFunc1 -> SetLineWidth(3);
fitFunc1 -> Draw("same");
cut_energyMin[Form("ch%d_%s",ch,stepLabel.c_str())] = fitFunc1->GetMaximumX()-cut_energyFitMin[ch][Vov]*fitFunc1->GetMaximumX();
cut_energyMax[Form("ch%d_%s",ch,stepLabel.c_str())] = fitFunc1->GetMaximumX()+cut_energyFitMax[ch][Vov]*fitFunc1->GetMaximumX();
TLine* line_energyMin1 = new TLine(cut_energyMin[Form("ch%d_%s",ch,stepLabel.c_str())],h1_energy[label]->GetMinimum(),cut_energyMin[Form("ch%d_%s",ch,stepLabel.c_str())],h1_energy[label]->GetMaximum());
line_energyMin1 -> SetLineColor(kBlack);
line_energyMin1 -> Draw("same");
TLine* line_energyMax1 = new TLine(cut_energyMax[Form("ch%d_%s",ch,stepLabel.c_str())],h1_energy[label]->GetMinimum(),cut_energyMax[Form("ch%d_%s",ch,stepLabel.c_str())],h1_energy[label]->GetMaximum());
line_energyMax1 -> SetLineColor(kBlack);
line_energyMax1 -> Draw("same");
latex = new TLatex(0.65,0.85,Form("ch%d",ch));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
c -> Print(Form("%s/energy/c_energy_%s.png",plotDir.c_str(),label.c_str()));
c -> Print(Form("%s/energy/c_energy_%s.pdf",plotDir.c_str(),label.c_str()));
if( g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] == NULL )
g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] = new TGraphErrors();
if( g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] == NULL )
g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] = new TGraphErrors();
g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] -> SetPoint(g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())]->GetN(),th,fitFunc1->GetMaximumX());
g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())] -> SetPointError(g_energy_vs_th[Form("ch%d_%s",ch,VovLabel.c_str())]->GetN()-1,0.,0.);
g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] -> SetPoint(g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())]->GetN(),Vov,fitFunc1->GetMaximumX());
g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())] -> SetPointError(g_energy_vs_Vov[Form("ch%d_%s",ch,thLabel.c_str())]->GetN()-1,0.,0.);
}
//--------------------------------------------------------
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
c = new TCanvas(Form("c_tot_corr_%s",label12.c_str()),Form("c_tot_corr_%s",label12.c_str()));
gPad -> SetLogz();
h2_tot_corr[label12] -> SetTitle(Form(";ch%d ToT [ns];ch%d ToT [ns]",ch1,ch2));
h2_tot_corr[label12] -> Draw("colz");
c -> Print(Form("%s/tot/c_tot_corr_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/tot/c_tot_corr_%s.pdf",plotDir.c_str(),label12.c_str()));
c = new TCanvas(Form("c_energy_corr_%s",label12.c_str()),Form("c_energy_corr_%s",label12.c_str()));
gPad -> SetLogz();
h2_energy_corr[label12] -> SetTitle(Form(";ch%d energy [a.u.];ch%d energy [a.u.]",ch1,ch2));
h2_energy_corr[label12] -> Draw("colz");
c -> Print(Form("%s/energy/c_energy_corr_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/energy/c_energy_corr_%s.pdf",plotDir.c_str(),label12.c_str()));
}
//--------------------------------------------------------
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
std::string label1 = Form("ch%d_%s",ch1,stepLabel.c_str());
std::string label2 = Form("ch%d_%s",ch2,stepLabel.c_str());
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label3 = Form("ch%d_%s",ch3,stepLabel.c_str());
std::string label4 = Form("ch%d_%s",ch4,stepLabel.c_str());
std::string label1234 = Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str());
c = new TCanvas(Form("c_tot_corr_%s",label1234.c_str()),Form("c_tot_corr_%s",label1234.c_str()));
gPad -> SetLogz();
h2_tot_corr[label1234] -> SetTitle(Form(";ch%d+ch%d ToT [ns];ch%d+ch%d ToT [ns]",ch1,ch2,ch3,ch4));
h2_tot_corr[label1234] -> Draw("colz");
c -> Print(Form("%s/tot/c_tot_corr_%s.png",plotDir.c_str(),label1234.c_str()));
c -> Print(Form("%s/tot/c_tot_corr_%s.pdf",plotDir.c_str(),label1234.c_str()));
c = new TCanvas(Form("c_energy_corr_%s",label1234.c_str()),Form("c_energy_corr_%s",label1234.c_str()));
gPad -> SetLogz();
h2_energy_corr[label1234] -> SetTitle(Form(";ch%d+ch%d energy [a.u.];ch%d+ch%d energy [a.u.]",ch1,ch2,ch3,ch4));
h2_energy_corr[label1234] -> Draw("colz");
c -> Print(Form("%s/energy/c_energy_corr_%s.png",plotDir.c_str(),label1234.c_str()));
c -> Print(Form("%s/energy/c_energy_corr_%s.pdf",plotDir.c_str(),label1234.c_str()));
}
}
//--------------------------------------------------------
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
c = new TCanvas(Form("c_tot_vs_th_ch%d-ch%d",ch1,ch2),Form("c_tot_vs_th_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
TH1F* hPad = (TH1F*)( gPad->DrawFrame(-1.,0.,64.,500.) );
hPad -> SetTitle(";threshold [DAC];ToT [ns]");
hPad -> Draw();
gPad -> SetGridy();
int iter = 0;
for(auto mapIt : VovLabels)
{
std::string label1(Form("ch%d_%s",ch1,mapIt.first.c_str()));
std::string label2(Form("ch%d_%s",ch2,mapIt.first.c_str()));
TGraph* g_tot1 = g_tot_vs_th[label1];
TGraph* g_tot2 = g_tot_vs_th[label2];
g_tot1 -> SetLineColor(1+iter);
g_tot1 -> SetMarkerColor(1+iter);
g_tot1 -> SetMarkerStyle(20);
g_tot1 -> Draw("PL,same");
g_tot2 -> SetLineColor(1+iter);
g_tot2 -> SetMarkerColor(1+iter);
g_tot2 -> SetMarkerStyle(25);
g_tot2 -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tot_vs_th_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_tot_vs_th_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
c = new TCanvas(Form("c_tot_vs_Vov_ch%d-ch%d",ch1,ch2),Form("c_tot_vs_Vov_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
hPad = (TH1F*)( gPad->DrawFrame(0.,0.,10.,500.) );
hPad -> SetTitle(";V_{ov} [V];ToT [ns]");
hPad -> Draw();
gPad -> SetGridy();
iter = 0;
for(auto mapIt : thLabels)
{
std::string label1(Form("ch%d_%s",ch1,mapIt.first.c_str()));
std::string label2(Form("ch%d_%s",ch2,mapIt.first.c_str()));
TGraph* g_tot1 = g_tot_vs_Vov[label1];
TGraph* g_tot2 = g_tot_vs_Vov[label2];
g_tot1 -> SetLineColor(1+iter);
g_tot1 -> SetMarkerColor(1+iter);
g_tot1 -> SetMarkerStyle(20);
g_tot1 -> Draw("PL,same");
g_tot2 -> SetLineColor(1+iter);
g_tot2 -> SetMarkerColor(1+iter);
g_tot2 -> SetMarkerStyle(25);
g_tot2 -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tot_vs_Vov_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_tot_vs_Vov_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
c = new TCanvas(Form("c_energy_vs_th_ch%d-ch%d",ch1,ch2),Form("c_energy_vs_th_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
hPad = (TH1F*)( gPad->DrawFrame(-1.,0.,64.,50.) );
hPad -> SetTitle(";threshold [DAC];energy [a.u.]");
hPad -> Draw();
gPad -> SetGridy();
iter = 0;
for(auto mapIt : VovLabels)
{
std::string label1(Form("ch%d_%s",ch1,mapIt.first.c_str()));
std::string label2(Form("ch%d_%s",ch2,mapIt.first.c_str()));
TGraph* g_energy1 = g_energy_vs_th[label1];
TGraph* g_energy2 = g_energy_vs_th[label2];
g_energy1 -> SetLineColor(1+iter);
g_energy1 -> SetMarkerColor(1+iter);
g_energy1 -> SetMarkerStyle(20);
g_energy1 -> Draw("PL,same");
g_energy2 -> SetLineColor(1+iter);
g_energy2 -> SetMarkerColor(1+iter);
g_energy2 -> SetMarkerStyle(25);
g_energy2 -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_energy_vs_th_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_energy_vs_th_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
c = new TCanvas(Form("c_energy_vs_Vov_ch%d-ch%d",ch1,ch2),Form("c_energy_vs_Vov_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
hPad = (TH1F*)( gPad->DrawFrame(0.,0.,10.,50.) );
hPad -> SetTitle(";V_{ov} [V];energy [a.u.]");
hPad -> Draw();
gPad -> SetGridy();
iter = 0;
for(auto mapIt : thLabels)
{
std::string label1(Form("ch%d_%s",ch1,mapIt.first.c_str()));
std::string label2(Form("ch%d_%s",ch2,mapIt.first.c_str()));
TGraph* g_energy1 = g_energy_vs_Vov[label1];
TGraph* g_energy2 = g_energy_vs_Vov[label2];
g_energy1 -> SetLineColor(1+iter);
g_energy1 -> SetMarkerColor(1+iter);
g_energy1 -> SetMarkerStyle(20);
g_energy1 -> Draw("PL,same");
g_energy2 -> SetLineColor(1+iter);
g_energy2 -> SetMarkerColor(1+iter);
g_energy2 -> SetMarkerStyle(25);
g_energy2 -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_energy_vs_Vov_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_energy_vs_Vov_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
}
//------------------------
//--- 2nd loop over events
std::map<std::string,std::vector<EventSingle> > eventsSingle2;
std::map<std::string,std::vector<EventCoinc> > eventsCoinc2;
for(auto mapIt : eventsSingle)
{
std::string label = mapIt.first;
float Vov = map_Vovs[label];
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 2nd loop: reading entry " << entry << " / " << nEntries << " (" << 100.*entry/nEntries << "%)" << "\r" << std::flush;
EventSingle anEvent = mapIt.second.at(entry);
if( anEvent.qfine1 < cut_qfineAcc[anEvent.ch1][Vov] ) continue;
if( anEvent.qfine2 < cut_qfineAcc[anEvent.ch2][Vov] ) continue;
if( anEvent.tot1 < cut_totAcc[anEvent.ch1][Vov] ) continue;
if( anEvent.tot2 < cut_totAcc[anEvent.ch2][Vov] ) continue;
if( anEvent.energy1 > cut_energyMin[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] &&
anEvent.energy1 < cut_energyMax[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] )
h1_energy_cut[anEvent.label1] -> Fill( anEvent.energy1 );
if( anEvent.energy2 > cut_energyMin[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] &&
anEvent.energy2 < cut_energyMax[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] )
h1_energy_cut[anEvent.label2] -> Fill( anEvent.energy2 );
if( anEvent.energy1 < cut_energyMin[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 < cut_energyMin[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy1 > cut_energyMax[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 > cut_energyMax[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
h1_totRatio[anEvent.label12] -> Fill( anEvent.tot2 / anEvent.tot1 );
h1_energyRatio[anEvent.label12] -> Fill( anEvent.energy2 / anEvent.energy1 );
h1_deltaT_raw[anEvent.label12] -> Fill( anEvent.time2-anEvent.time1 );
EventSingle anEvent2;
anEvent2.stepLabel = anEvent.stepLabel;
anEvent2.ch1 = anEvent.ch1;
anEvent2.ch2 = anEvent.ch2;
anEvent2.label1 = anEvent.label1;
anEvent2.label2 = anEvent.label2;
anEvent2.label12 = anEvent.label12;
anEvent2.qfine1 = anEvent.qfine1;
anEvent2.qfine2 = anEvent.qfine2;
anEvent2.tot1 = anEvent.tot1;
anEvent2.tot2 = anEvent.tot2;
anEvent2.energy1 = anEvent.energy1;
anEvent2.energy2 = anEvent.energy2;
anEvent2.time1 = anEvent.time1;
anEvent2.time2 = anEvent.time2;
eventsSingle2[anEvent.label12].push_back(anEvent2);
}
std::cout << std::endl;
}
for(auto mapIt : eventsCoinc)
{
std::string label = mapIt.first;
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 2nd loop: reading entry " << entry << " / " << nEntries << " (" << 100.*entry/nEntries << "%)" << "\r" << std::flush;
EventCoinc anEvent = mapIt.second.at(entry);
if( anEvent.energy1 < cut_energyMin[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 < cut_energyMin[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy3 < cut_energyMin[Form("ch%d_%s",anEvent.ch3,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy4 < cut_energyMin[Form("ch%d_%s",anEvent.ch4,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy1 > cut_energyMax[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 > cut_energyMax[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy3 > cut_energyMax[Form("ch%d_%s",anEvent.ch3,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy4 > cut_energyMax[Form("ch%d_%s",anEvent.ch4,anEvent.stepLabel.c_str())] ) continue;
h1_totRatio[anEvent.label1234] -> Fill( (anEvent.tot3+anEvent.tot4) / (anEvent.tot1+anEvent.tot2) );
h1_deltaT_raw[anEvent.label1234] -> Fill( 0.5*(anEvent.time3+anEvent.time4) - 0.5*(anEvent.time1+anEvent.time2) );
EventCoinc anEvent2;
anEvent2.stepLabel = anEvent.stepLabel;
anEvent2.ch1 = anEvent.ch1;
anEvent2.ch2 = anEvent.ch2;
anEvent2.ch3 = anEvent.ch3;
anEvent2.ch4 = anEvent.ch4;
anEvent2.label1 = anEvent.label1;
anEvent2.label2 = anEvent.label2;
anEvent2.label3 = anEvent.label3;
anEvent2.label4 = anEvent.label4;
anEvent2.label1234 = anEvent.label1234;
anEvent2.qfine1 = anEvent.qfine1;
anEvent2.qfine2 = anEvent.qfine2;
anEvent2.qfine3 = anEvent.qfine3;
anEvent2.qfine4 = anEvent.qfine4;
anEvent2.tot1 = anEvent.tot1;
anEvent2.tot2 = anEvent.tot2;
anEvent2.tot3 = anEvent.tot3;
anEvent2.tot4 = anEvent.tot4;
anEvent2.energy1 = anEvent.energy1;
anEvent2.energy2 = anEvent.energy2;
anEvent2.energy3 = anEvent.energy3;
anEvent2.energy4 = anEvent.energy4;
anEvent2.time1 = anEvent.time1;
anEvent2.time2 = anEvent.time2;
anEvent2.time3 = anEvent.time3;
anEvent2.time4 = anEvent.time4;
eventsCoinc2[anEvent.label1234].push_back(anEvent2);
}
std::cout << std::endl;
}
//------------------
//--- draw 2nd plots
std::map<std::string,float> CTRMeans;
std::map<std::string,float> CTRSigmas;
for(auto stepLabel : stepLabels)
{
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label1(Form("ch%d_%s",ch1,stepLabel.c_str()));
std::string label2(Form("ch%d_%s",ch2,stepLabel.c_str()));
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
//--------------------------------------------------------
FindSmallestInterval(vals,h1_deltaT_raw[label12],0.68);
float mean = vals[0];
float min = vals[4];
float max = vals[5];
float delta = max-min;
float sigma = 0.5*delta;
float effSigma = sigma;
CTRMeans[label12] = mean;
CTRSigmas[label12] = effSigma;
//--------------------------------------------------------
c = new TCanvas(Form("c_totRatio_%s",label12.c_str()),Form("c_totRatio_%s",label12.c_str()));
// gPad -> SetLogy();
h1_totRatio[label12] -> SetTitle(Form(";%d ToT / %d ToT;entries",ch1,ch2));
h1_totRatio[label12] -> Draw("colz");
TF1* fitFunc = new TF1(Form("fitFunc_totRatio_%s",label12.c_str()),"gaus",
h1_totRatio[label12]->GetMean()-1.5*h1_totRatio[label12]->GetRMS(),
h1_totRatio[label12]->GetMean()+1.5*h1_totRatio[label12]->GetRMS());
fitFunc -> SetParameters(1,h1_totRatio[label12]->GetMean(),h1_totRatio[label12]->GetRMS());
h1_totRatio[label12] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kRed);
fitFunc -> SetLineWidth(1);
fitFunc -> Draw("same");
latex = new TLatex(0.55,0.85,Form("#sigma = %.1f %%",100.*fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
c -> Print(Form("%s/totRatio/c_totRatio_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/totRatio/c_totRatio_%s.pdf",plotDir.c_str(),label12.c_str()));
c = new TCanvas(Form("c_energyRatio_%s",label12.c_str()),Form("c_energyRatio_%s",label12.c_str()));
// gPad -> SetLogy();
h1_energyRatio[label12] -> SetTitle(Form(";ch%d energy / ch%d energy;entries",ch1,ch2));
h1_energyRatio[label12] -> Draw("colz");
fitFunc = new TF1(Form("fitFunc_energyRatio_%s",label12.c_str()),"gaus",
h1_energyRatio[label12]->GetMean()-1.5*h1_energyRatio[label12]->GetRMS(),
h1_energyRatio[label12]->GetMean()+1.5*h1_energyRatio[label12]->GetRMS());
fitFunc -> SetParameters(1,h1_energyRatio[label12]->GetMean(),h1_energyRatio[label12]->GetRMS());
h1_energyRatio[label12] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kRed);
fitFunc -> SetLineWidth(1);
fitFunc -> Draw("same");
latex = new TLatex(0.55,0.85,Form("#sigma = %.1f %%",100.*fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
c -> Print(Form("%s/energyRatio/c_energyRatio_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/energyRatio/c_energyRatio_%s.pdf",plotDir.c_str(),label12.c_str()));
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
std::string label1 = Form("%d_%s",ch1,stepLabel.c_str());
std::string label2 = Form("%d_%s",ch2,stepLabel.c_str());
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label3 = Form("%d_%s",ch3,stepLabel.c_str());
std::string label4 = Form("%d_%s",ch4,stepLabel.c_str());
std::string label1234(Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str()));
//--------------------------------------------------------
FindSmallestInterval(vals,h1_deltaT_raw[label1234],0.68);
float mean = vals[0];
float min = vals[4];
float max = vals[5];
float delta = max-min;
float sigma = 0.5*delta;
float effSigma = sigma;
CTRMeans[label1234] = mean;
CTRSigmas[label1234] = effSigma;
//--------------------------------------------------------
c = new TCanvas(Form("c_totRatio_%s",label1234.c_str()),Form("c_totRatio_%s",label1234.c_str()));
gPad -> SetLogy();
h1_totRatio[label1234] -> SetTitle(Form(";%d+%d ToT / %d+%d ToT;entries",ch1,ch2,ch3,ch4));
h1_totRatio[label1234] -> Draw("colz");
c -> Print(Form("%s/totRatio/c_totRatio_%s.png",plotDir.c_str(),label1234.c_str()));
c -> Print(Form("%s/totRatio/c_totRatio_%s.pdf",plotDir.c_str(),label1234.c_str()));
}
}
//------------------------
//--- 3rd loop over events
for(auto mapIt : eventsSingle)
{
std::string label = mapIt.first;
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 3rd loop: reading entry " << entry << " / " << nEntries << " (" << 100.*entry/nEntries << "%)" << "\r" << std::flush;
EventSingle anEvent = mapIt.second.at(entry);
if( anEvent.energy1 < cut_energyMin[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 < cut_energyMin[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy1 > cut_energyMax[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 > cut_energyMax[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
float timeLow = CTRMeans[anEvent.label12] - 2.* CTRSigmas[anEvent.label12];
float timeHig = CTRMeans[anEvent.label12] + 2.* CTRSigmas[anEvent.label12];
long long deltaT = anEvent.time2 - anEvent.time1;
h1_deltaT[anEvent.label12] -> Fill( deltaT );
if( ( deltaT > timeLow ) &&
( deltaT < timeHig ) )
p1_deltaT_vs_energyRatio[anEvent.label12] -> Fill( anEvent.energy2/anEvent.energy1,anEvent.time2-anEvent.time1 );
}
std::cout << std::endl;
}
for(auto mapIt : eventsCoinc)
{
std::string label = mapIt.first;
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 3rd loop: reading entry " << entry << " / " << nEntries << " (" << 100.*entry/nEntries << "%)" << "\r" << std::flush;
EventCoinc anEvent = mapIt.second.at(entry);
if( anEvent.energy1 < cut_energyMin[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 < cut_energyMin[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy3 < cut_energyMin[Form("ch%d_%s",anEvent.ch3,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy4 < cut_energyMin[Form("ch%d_%s",anEvent.ch4,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy1 > cut_energyMax[Form("ch%d_%s",anEvent.ch1,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy2 > cut_energyMax[Form("ch%d_%s",anEvent.ch2,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy3 > cut_energyMax[Form("ch%d_%s",anEvent.ch3,anEvent.stepLabel.c_str())] ) continue;
if( anEvent.energy4 > cut_energyMax[Form("ch%d_%s",anEvent.ch4,anEvent.stepLabel.c_str())] ) continue;
float timeLow = CTRMeans[anEvent.label1234] - 2.* CTRSigmas[anEvent.label1234];
float timeHig = CTRMeans[anEvent.label1234] + 2.* CTRSigmas[anEvent.label1234];
long long timeComb = 0.5*(anEvent.time3+anEvent.time4) - 0.5*(anEvent.time1+anEvent.time2);
h1_deltaT[anEvent.label1234] -> Fill( timeComb );
if( ( timeComb > timeLow ) &&
( timeComb < timeHig ) )
p1_deltaT_vs_energyRatio[anEvent.label1234] -> Fill( (anEvent.energy3+anEvent.energy4)/(anEvent.energy1+anEvent.energy2),timeComb );
}
std::cout << std::endl;
}
//------------------
//--- draw 3rd plots
std::map<std::string,TF1*> fitFunc_energyCorr;
for(auto stepLabel : stepLabels)
{
float Vov = map_Vovs[stepLabel];
float th = map_ths[stepLabel];
std::string VovLabel(Form("Vov%.1f",Vov));
std::string thLabel(Form("th%02.0f",th));
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label1(Form("ch%d_%s",ch1,stepLabel.c_str()));
std::string label2(Form("ch%d_%s",ch2,stepLabel.c_str()));
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
//--------------------------------------------------------
c = new TCanvas(Form("c_deltaT_vs_energyRatio_%s",label12.c_str()),Form("c_deltaT_vs_energyRatio_%s",label12.c_str()));
p1_deltaT_vs_energyRatio[label12] -> SetTitle(Form(";ch%d energy / ch%d energy;#Deltat [ps]",ch2,ch1));
p1_deltaT_vs_energyRatio[label12] -> GetXaxis() -> SetRangeUser(h1_energyRatio[label12]->GetMean()-3.*h1_energyRatio[label12]->GetRMS(),
h1_energyRatio[label12]->GetMean()+3.*h1_energyRatio[label12]->GetRMS());
p1_deltaT_vs_energyRatio[label12] -> Draw("");
float fitXMin = h1_energyRatio[label12]->GetMean() - 2.*h1_energyRatio[label12]->GetRMS();
float fitXMax = h1_energyRatio[label12]->GetMean() + 2.*h1_energyRatio[label12]->GetRMS();
fitFunc_energyCorr[label12] = new TF1(Form("fitFunc_energyCorr_%s",label12.c_str()),"pol4",fitXMin,fitXMax);
p1_deltaT_vs_energyRatio[label12] -> Fit(fitFunc_energyCorr[label12],"QNRS+");
fitFunc_energyCorr[label12] -> SetLineColor(kRed);
fitFunc_energyCorr[label12] -> SetLineWidth(2);
fitFunc_energyCorr[label12] -> Draw("same");
c -> Print(Form("%s/CTR/c_deltaT_vs_energyRatio_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/CTR/c_deltaT_vs_energyRatio_%s.pdf",plotDir.c_str(),label12.c_str()));
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
std::string label1(Form("ch%d_%s",ch1,stepLabel.c_str()));
std::string label2(Form("ch%d_%s",ch2,stepLabel.c_str()));
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label3(Form("ch%d_%s",ch3,stepLabel.c_str()));
std::string label4(Form("ch%d_%s",ch4,stepLabel.c_str()));
std::string label1234(Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str()));
//--------------------------------------------------------
c = new TCanvas(Form("c_deltaT_vs_energyRatio_%s",label1234.c_str()),Form("c_deltaT_vs_energyRatio_%s",label1234.c_str()));
p1_deltaT_vs_energyRatio[label1234] -> SetTitle(Form(";ch%d+ch%d energy / ch%d+ch%d energy;#Deltat [ps]",ch3,ch4,ch1,ch2));
p1_deltaT_vs_energyRatio[label1234] -> GetXaxis() -> SetRangeUser(h1_energyRatio[label1234]->GetMean()-3.*h1_energyRatio[label1234]->GetRMS(),
h1_energyRatio[label1234]->GetMean()+3.*h1_energyRatio[label1234]->GetRMS());
p1_deltaT_vs_energyRatio[label1234] -> Draw("");
float fitXMin = h1_energyRatio[label1234]->GetMean() - 2.*h1_energyRatio[label1234]->GetRMS();
float fitXMax = h1_energyRatio[label1234]->GetMean() + 2.*h1_energyRatio[label1234]->GetRMS();
fitFunc_energyCorr[label1234] = new TF1(Form("fitFunc_energyCorr_%s",label1234.c_str()),"pol4",fitXMin,fitXMax);
p1_deltaT_vs_energyRatio[label1234] -> Fit(fitFunc_energyCorr[label1234],"QNRS+");
fitFunc_energyCorr[label1234] -> SetLineColor(kRed);
fitFunc_energyCorr[label1234] -> SetLineWidth(2);
fitFunc_energyCorr[label1234] -> Draw("same");
c -> Print(Form("%s/CTR/c_deltaT_vs_energyRatio_%s.png",plotDir.c_str(),label1234.c_str()));
c -> Print(Form("%s/CTR/c_deltaT_vs_energyRatio_%s.pdf",plotDir.c_str(),label1234.c_str()));
}
}
//------------------------
//--- 4th loop over events
for(auto mapIt : eventsSingle2)
{
std::string label = mapIt.first;
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 4th loop (" << label << "): reading entry " << entry << " / " << nEntries << "\r" << std::flush;
EventSingle anEvent = mapIt.second.at(entry);
long long deltaT = anEvent.time2-anEvent.time1;
float energyCorr = fitFunc_energyCorr[label]->Eval(anEvent.energy2/anEvent.energy1) - fitFunc_energyCorr[label]->Eval(h1_energy_cut[anEvent.label2]->GetMean()/h1_energy_cut[anEvent.label1]->GetMean());
h1_deltaT_energyCorr[label] -> Fill( deltaT - energyCorr );
}
std::cout << std::endl;
}
for(auto mapIt : eventsCoinc2)
{
std::string label = mapIt.first;
nEntries = mapIt.second.size();
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 4th loop (" << label << "): reading entry " << entry << " / " << nEntries << "\r" << std::flush;
EventCoinc anEvent = mapIt.second.at(entry);
long long deltaT = 0.5*(anEvent.time3+anEvent.time4) - 0.5*(anEvent.time1+anEvent.time2);
float energyCorr = fitFunc_energyCorr[label]->Eval((anEvent.energy3+anEvent.energy4)/(anEvent.energy1+anEvent.energy2)) - fitFunc_energyCorr[label]->Eval((h1_energy_cut[anEvent.label3]->GetMean()+h1_energy_cut[anEvent.label4]->GetMean())/(h1_energy_cut[anEvent.label1]->GetMean()+h1_energy_cut[anEvent.label2]->GetMean()));
h1_deltaT_energyCorr[label] -> Fill( deltaT - energyCorr );
}
std::cout << std::endl;
}
//------------------
//--- draw 4th plots
std::map<std::string,TGraphErrors*> g_tRes_effSigma_vs_th;
std::map<std::string,TGraphErrors*> g_tRes_gaus_vs_th;
std::map<std::string,TGraphErrors*> g_tRes_effSigma_vs_Vov;
std::map<std::string,TGraphErrors*> g_tRes_gaus_vs_Vov;
std::map<std::string,TGraphErrors*> g_tRes_energyCorr_effSigma_vs_th;
std::map<std::string,TGraphErrors*> g_tRes_energyCorr_gaus_vs_th;
std::map<std::string,TGraphErrors*> g_tRes_energyCorr_effSigma_vs_Vov;
std::map<std::string,TGraphErrors*> g_tRes_energyCorr_gaus_vs_Vov;
for(auto stepLabel : stepLabels)
{
float Vov = map_Vovs[stepLabel];
float th = map_ths[stepLabel];
std::string VovLabel(Form("Vov%.1f",Vov));
std::string thLabel(Form("th%02.0f",th));
int pairsIt = 0;
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
std::string label1(Form("ch%d_%s",ch1,stepLabel.c_str()));
std::string label2(Form("ch%d_%s",ch2,stepLabel.c_str()));
std::string label12 = Form("ch%d-ch%d_%s",ch1,ch2,stepLabel.c_str());
//--------------------------------------------------------
c = new TCanvas(Form("c_deltaT_energyCorr_%s",label12.c_str()),Form("c_deltaT_energyCorr_%s",label12.c_str()));
h1_deltaT_energyCorr[label12] -> GetXaxis() -> SetRangeUser(h1_deltaT_energyCorr[label12]->GetMean()-2.*h1_deltaT_energyCorr[label12]->GetRMS(),
h1_deltaT_energyCorr[label12]->GetMean()+2.*h1_deltaT_energyCorr[label12]->GetRMS());
h1_deltaT_energyCorr[label12] -> SetTitle(Form(";energy-corrected #Deltat [ps];entries"));
h1_deltaT_energyCorr[label12] -> SetLineWidth(2);
h1_deltaT_energyCorr[label12] -> SetLineColor(kBlue);
h1_deltaT_energyCorr[label12] -> SetMarkerColor(kBlue);
h1_deltaT_energyCorr[label12] -> Draw("");
float fitXMin = CTRMeans[label12] - 1.5*CTRSigmas[label12];
float fitXMax = CTRMeans[label12] + 1.5*CTRSigmas[label12];
TF1* fitFunc = new TF1(Form("fitFunc_energyCorr_%s",label12.c_str()),"gaus",fitXMin,fitXMax);
fitFunc -> SetParameters(1,h1_deltaT_energyCorr[label12]->GetMean(),h1_deltaT_energyCorr[label12]->GetRMS());
h1_deltaT_energyCorr[label12] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kBlue);
fitFunc -> SetLineWidth(2);
fitFunc -> Draw("same");
FindSmallestInterval(vals,h1_deltaT_energyCorr[label12],0.68);
float mean = vals[0];
float min = vals[4];
float max = vals[5];
float delta = max-min;
float sigma = 0.5*delta;
float effSigma = sigma;
latex = new TLatex(0.55,0.85,Form("time walk corr. #splitline{#sigma_{CTR}^{eff} = %.1f ps}{#sigma_{CTR}^{gaus} = %.1f ps}",effSigma,fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlue);
latex -> Draw("same");
if( g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] == NULL )
{
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] = new TGraphErrors();
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] = new TGraphErrors();
}
if( g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] == NULL )
{
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] = new TGraphErrors();
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] = new TGraphErrors();
}
if( pairsMode.at(pairsIt) == 0 )
{
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma);
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2));
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma);
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2));
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
}
if( pairsMode.at(pairsIt) == 1 )
{
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma/sqrt(2));
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/sqrt(2));
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/sqrt(2));
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma/sqrt(2));
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/sqrt(2));
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/sqrt(2));
}
if( pairsMode.at(pairsIt) == 2 )
{
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma/2);
g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/2);
g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/2.);
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma/2);
g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/2);
g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/2.);
}
h1_deltaT[label12] -> SetLineWidth(2);
h1_deltaT[label12] -> SetLineColor(kRed);
h1_deltaT[label12] -> SetMarkerColor(kRed);
h1_deltaT[label12] -> Draw("same");
fitXMin = CTRMeans[label12] - 1.5*CTRSigmas[label12];
fitXMax = CTRMeans[label12] + 1.5*CTRSigmas[label12];
fitFunc = new TF1(Form("fitFunc_%s",label12.c_str()),"gaus",fitXMin,fitXMax);
fitFunc -> SetParameters(1,h1_deltaT[label12]->GetMean(),h1_deltaT[label12]->GetRMS());
h1_deltaT[label12] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kRed);
fitFunc -> SetLineWidth(2);
fitFunc -> Draw("same");
FindSmallestInterval(vals,h1_deltaT[label12],0.68);
mean = vals[0];
min = vals[4];
max = vals[5];
delta = max-min;
sigma = 0.5*delta;
effSigma = sigma;
h1_deltaT_energyCorr[label12] -> GetXaxis() -> SetRangeUser(mean-5.*sigma,mean+5.*sigma);
latex = new TLatex(0.55,0.65,Form("#splitline{raw #sigma_{CTR}^{eff} = %.1f ps}{raw #sigma_{CTR}^{gaus} = %.1f ps}",effSigma,fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
if( pairsMode.at(pairsIt) == 0 )
{
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma);
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2));
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma);
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2));
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
}
if( pairsMode.at(pairsIt) == 1 )
{
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma/sqrt(2));
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/sqrt(2));
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/sqrt(2));
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma/sqrt(2));
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/sqrt(2));
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/sqrt(2));
}
if( pairsMode.at(pairsIt) == 2 )
{
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,effSigma/2.);
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/2.);
g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_th[Form("ch%d-ch%d_%s",ch1,ch2,VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/2.);
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,effSigma/2.);
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/2.);
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d-ch%d_%s",ch1,ch2,thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2)/2.);
}
c -> Print(Form("%s/CTR_energyCorr/c_deltaT_energyCorr_%s.png",plotDir.c_str(),label12.c_str()));
c -> Print(Form("%s/CTR_energyCorr/c_deltaT_energyCorr_%s.pdf",plotDir.c_str(),label12.c_str()));
++pairsIt;
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
std::string label1(Form("ch%d_%s",ch1,stepLabel.c_str()));
std::string label2(Form("ch%d_%s",ch2,stepLabel.c_str()));
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
std::string label3(Form("ch%d_%s",ch3,stepLabel.c_str()));
std::string label4(Form("ch%d_%s",ch4,stepLabel.c_str()));
std::string label1234(Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,stepLabel.c_str()));
//--------------------------------------------------------
c = new TCanvas(Form("c_deltaT_energyCorr_%s",label1234.c_str()),Form("c_deltaT_energyCorr_%s",label1234.c_str()));
// gPad -> SetLogy();
h1_deltaT_energyCorr[label1234] -> SetTitle(Form(";energy-corrected #Deltat [ps];entries"));
h1_deltaT_energyCorr[label1234] -> SetMarkerColor(kBlue);
h1_deltaT_energyCorr[label1234] -> SetLineColor(kBlue);
h1_deltaT_energyCorr[label1234] -> Draw("");
float fitXMin = CTRMeans[label1234] - 1.*CTRSigmas[label1234];
float fitXMax = CTRMeans[label1234] + 1.*CTRSigmas[label1234];
TF1* fitFunc = new TF1(Form("fitFunc_energyCorr_%s",label1234.c_str()),"gaus",fitXMin,fitXMax);
fitFunc -> SetParameters(1,h1_deltaT_energyCorr[label1234]->GetMean(),h1_deltaT_energyCorr[label1234]->GetRMS());
h1_deltaT_energyCorr[label1234] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kBlue-1);
fitFunc -> SetLineWidth(2);
fitFunc -> Draw("same");
FindSmallestInterval(vals,h1_deltaT_energyCorr[label1234],0.68);
float mean = vals[0];
float min = vals[4];
float max = vals[5];
float delta = max-min;
float sigma = 0.5*delta;
float effSigma = sigma;
latex = new TLatex(0.55,0.85,Form("#splitline{time walk corr. #sigma_{CTR}^{eff} = %.1f ps}{time walk corr. #sigma_{CTR}^{gaus} = %.1f ps}",effSigma,fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlue);
latex -> Draw("same");
if( g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] == NULL )
{
g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] = new TGraphErrors();
g_tRes_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] = new TGraphErrors();
}
if( g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] == NULL )
{
g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] = new TGraphErrors();
g_tRes_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] = new TGraphErrors();
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] = new TGraphErrors();
}
g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN(),th,effSigma/sqrt(2.));
g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/sqrt(2.));
g_tRes_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPoint(g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN(),Vov,effSigma/sqrt(2.));
g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPointError(g_tRes_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPoint(g_tRes_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/sqrt(2.));
g_tRes_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPointError(g_tRes_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
h1_deltaT[label1234] -> SetMarkerColor(kRed);
h1_deltaT[label1234] -> SetLineColor(kRed);
h1_deltaT[label1234] -> Draw("same");
fitXMin = CTRMeans[label1234] - 1.*CTRSigmas[label1234];
fitXMax = CTRMeans[label1234] + 1.*CTRSigmas[label1234];
fitFunc = new TF1(Form("fitFunc_%s",label1234.c_str()),"gaus",fitXMin,fitXMax);
fitFunc -> SetParameters(1,h1_deltaT[label1234]->GetMean(),h1_deltaT[label1234]->GetRMS());
h1_deltaT[label1234] -> Fit(fitFunc,"QNRSL+");
fitFunc -> SetLineColor(kRed-1);
fitFunc -> SetLineWidth(2);
fitFunc -> Draw("same");
FindSmallestInterval(vals,h1_deltaT[label1234],0.68);
mean = vals[0];
min = vals[4];
max = vals[5];
delta = max-min;
sigma = 0.5*delta;
effSigma = sigma;
latex = new TLatex(0.55,0.65,Form("#splitline{raw #sigma_{CTR}^{eff} = %.1f ps}{raw #sigma_{CTR}^{gaus} = %.1f ps}",effSigma,fitFunc->GetParameter(2)));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kRed);
latex -> Draw("same");
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN(),th,effSigma/sqrt(2.));
g_tRes_energyCorr_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN(),th,fitFunc->GetParameter(2)/sqrt(2.));
g_tRes_energyCorr_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_th[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+VovLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN(),Vov,effSigma/sqrt(2.));
g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_effSigma_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN()-1,0.,5.);
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPoint(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN(),Vov,fitFunc->GetParameter(2)/sqrt(2.));
g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())] -> SetPointError(g_tRes_energyCorr_gaus_vs_Vov[Form("ch%d+ch%d-ch%d+ch%d+_%s",ch1,ch2,ch3,ch4,+thLabel.c_str())]->GetN()-1,0.,fitFunc->GetParError(2));
c -> Print(Form("%s/CTR_energyCorr/c_deltaT_energyCorr_%s.png",plotDir.c_str(),label1234.c_str()));
c -> Print(Form("%s/CTR_energyCorr/c_deltaT_energyCorr_%s.pdf",plotDir.c_str(),label1234.c_str()));
}
}
//--------------------------------------------------------
int pairsIt = 0;
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
c = new TCanvas(Form("c_tRes_vs_th_ch%d-ch%d",ch1,ch2),Form("c_tRes_vs_th_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
TH1F* hPad = (TH1F*)( gPad->DrawFrame(-1.,tResMin,64.,tResMax) );
if( pairsMode.at(pairsIt) == 0 )
hPad -> SetTitle(";threshold [DAC];#sigma_{t_{diff}} [ps]");
if( pairsMode.at(pairsIt) == 1 )
hPad -> SetTitle(";threshold [DAC];#sigma_{t_{diff}} / #sqrt{2} [ps]");
if( pairsMode.at(pairsIt) == 2 )
hPad -> SetTitle(";threshold [DAC];#sigma_{t_{diff}} / 2 [ps]");
hPad -> Draw();
gPad -> SetGridy();
int iter = 0;
for(auto mapIt : VovLabels)
{
std::string label(Form("ch%d-ch%d_%s",ch1,ch2,mapIt.first.c_str()));
TGraph* g_effSigma = g_tRes_effSigma_vs_th[label];
TGraph* g_gaus = g_tRes_gaus_vs_th[label];
TGraph* g_energyCorr_effSigma = g_tRes_energyCorr_effSigma_vs_th[label];
TGraph* g_energyCorr_gaus = g_tRes_energyCorr_gaus_vs_th[label];
g_effSigma -> SetLineColor(1+iter);
g_effSigma -> SetMarkerColor(1+iter);
g_effSigma -> SetMarkerStyle(20);
// g_effSigma -> Draw("PL,same");
g_gaus -> SetLineColor(1+iter);
g_gaus -> SetMarkerColor(1+iter);
g_gaus -> SetMarkerStyle(20);
g_gaus -> Draw("PL,same");
g_energyCorr_effSigma -> SetLineColor(1+iter);
g_energyCorr_effSigma -> SetMarkerColor(1+iter);
g_energyCorr_effSigma -> SetMarkerStyle(21);
// g_energyCorr_effSigma -> Draw("PL,same");
g_energyCorr_gaus -> SetLineColor(1+iter);
g_energyCorr_gaus -> SetMarkerColor(1+iter);
g_energyCorr_gaus -> SetMarkerStyle(25);
g_energyCorr_gaus -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tRes_vs_th_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_tRes_vs_th_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
++pairsIt;
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
c = new TCanvas(Form("c_tRes_vs_th_ch%d+ch%d-ch%d+ch%d",ch1,ch2,ch3,ch4),Form("c_tRes_vs_th_ch%d+ch%d-ch%d+ch%d",ch1,ch2,ch3,ch4));
// gPad -> SetLogy();
TH1F* hPad = (TH1F*)( gPad->DrawFrame(-1.,tResMin,64.,tResMax) );
hPad -> SetTitle(";threshold [DAC];#sigma_{CTR} / #sqrt{2} [ps]");
hPad -> Draw();
gPad -> SetGridy();
int iter = 0;
for(auto mapIt : VovLabels)
{
std::string label(Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,mapIt.first.c_str()));
TGraph* g_effSigma = g_tRes_effSigma_vs_th[label];
TGraph* g_gaus = g_tRes_gaus_vs_th[label];
TGraph* g_energyCorr_effSigma = g_tRes_energyCorr_effSigma_vs_th[label];
TGraph* g_energyCorr_gaus = g_tRes_energyCorr_gaus_vs_th[label];
g_effSigma -> SetLineColor(1+iter);
g_effSigma -> SetMarkerColor(1+iter);
g_effSigma -> SetMarkerStyle(20);
// g_effSigma -> Draw("PL,same");
g_gaus -> SetLineColor(1+iter);
g_gaus -> SetMarkerColor(1+iter);
g_gaus -> SetMarkerStyle(20);
g_gaus -> Draw("PL,same");
g_energyCorr_effSigma -> SetLineColor(1+iter);
g_energyCorr_effSigma -> SetMarkerColor(1+iter);
g_energyCorr_effSigma -> SetMarkerStyle(21);
// g_energyCorr_effSigma -> Draw("PL,same");
g_energyCorr_gaus -> SetLineColor(1+iter);
g_energyCorr_gaus -> SetMarkerColor(1+iter);
g_energyCorr_gaus -> SetMarkerStyle(25);
g_energyCorr_gaus -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tRes_vs_th_ch%d+ch%d_ch%d+ch%d.png",plotDir.c_str(),ch1,ch2,ch3,ch4));
c -> Print(Form("%s/c_tRes_vs_th_ch%d+ch%d_ch%d+ch%d.pdf",plotDir.c_str(),ch1,ch2,ch3,ch4));
}
//--------------------------------------------------------
for(auto pair : pairsVec)
{
unsigned int ch1 = pair.first;
unsigned int ch2 = pair.second;
c = new TCanvas(Form("c_tRes_vs_Vov_ch%d-ch%d",ch1,ch2),Form("c_tRes_vs_Vov_ch%d-ch%d",ch1,ch2));
// gPad -> SetLogy();
TH1F* hPad = (TH1F*)( gPad->DrawFrame(0.,tResMin,10.,tResMax) );
hPad -> SetTitle(";V_{ov} [V];#sigma_{t_{diff}} / 2 [ps]");
hPad -> Draw();
gPad -> SetGridy();
int iter = 0;
for(auto mapIt : thLabels)
{
std::string label(Form("ch%d-ch%d_%s",ch1,ch2,mapIt.first.c_str()));
TGraph* g_effSigma = g_tRes_effSigma_vs_Vov[label];
TGraph* g_gaus = g_tRes_gaus_vs_Vov[label];
TGraph* g_energyCorr_effSigma = g_tRes_energyCorr_effSigma_vs_Vov[label];
TGraph* g_energyCorr_gaus = g_tRes_energyCorr_gaus_vs_Vov[label];
g_effSigma -> SetLineColor(1+iter);
g_effSigma -> SetMarkerColor(1+iter);
g_effSigma -> SetMarkerStyle(20);
// g_effSigma -> Draw("PL,same");
g_gaus -> SetLineColor(1+iter);
g_gaus -> SetMarkerColor(1+iter);
g_gaus -> SetMarkerStyle(20);
g_gaus -> Draw("PL,same");
g_energyCorr_effSigma -> SetLineColor(1+iter);
g_energyCorr_effSigma -> SetMarkerColor(1+iter);
g_energyCorr_effSigma -> SetMarkerStyle(21);
// g_energyCorr_effSigma -> Draw("PL,same");
g_energyCorr_gaus -> SetLineColor(1+iter);
g_energyCorr_gaus -> SetMarkerColor(1+iter);
g_energyCorr_gaus -> SetMarkerStyle(25);
g_energyCorr_gaus -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tRes_vs_Vov_ch%d-ch%d.png",plotDir.c_str(),ch1,ch2));
c -> Print(Form("%s/c_tRes_vs_Vov_ch%d-ch%d.pdf",plotDir.c_str(),ch1,ch2));
}
for(auto bar : barsVec)
{
unsigned int ch1 = bar.first.first;
unsigned int ch2 = bar.first.second;
unsigned int ch3 = bar.second.first;
unsigned int ch4 = bar.second.second;
c = new TCanvas(Form("c_tRes_vs_Vov_ch%d+ch%d-ch%d+ch%d",ch1,ch2,ch3,ch4),Form("c_tRes_vs_Vov_ch%d+ch%d-ch%d+ch%d",ch1,ch2,ch3,ch4));
// gPad -> SetLogy();
TH1F* hPad = (TH1F*)( gPad->DrawFrame(0.,tResMin,10.,tResMax) );
hPad -> SetTitle(";V_{ov} [V];#sigma_{CTR} / #sqrt{2} [ps]");
hPad -> Draw();
gPad -> SetGridy();
int iter = 0;
for(auto mapIt : thLabels)
{
std::string label(Form("ch%d+ch%d-ch%d+ch%d_%s",ch1,ch2,ch3,ch4,mapIt.first.c_str()));
TGraph* g_effSigma = g_tRes_effSigma_vs_Vov[label];
TGraph* g_gaus = g_tRes_gaus_vs_Vov[label];
TGraph* g_energyCorr_effSigma = g_tRes_energyCorr_effSigma_vs_Vov[label];
TGraph* g_energyCorr_gaus = g_tRes_energyCorr_gaus_vs_Vov[label];
g_effSigma -> SetLineColor(1+iter);
g_effSigma -> SetMarkerColor(1+iter);
g_effSigma -> SetMarkerStyle(20);
// g_effSigma -> Draw("PL,same");
g_gaus -> SetLineColor(1+iter);
g_gaus -> SetMarkerColor(1+iter);
g_gaus -> SetMarkerStyle(20);
g_gaus -> Draw("PL,same");
g_energyCorr_effSigma -> SetLineColor(1+iter);
g_energyCorr_effSigma -> SetMarkerColor(1+iter);
g_energyCorr_effSigma -> SetMarkerStyle(21);
// g_energyCorr_effSigma -> Draw("PL,same");
g_energyCorr_gaus -> SetLineColor(1+iter);
g_energyCorr_gaus -> SetMarkerColor(1+iter);
g_energyCorr_gaus -> SetMarkerStyle(25);
g_energyCorr_gaus -> Draw("PL,same");
latex = new TLatex(0.55,0.85-0.04*iter,Form("%s",mapIt.first.c_str()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> SetTextColor(kBlack+iter);
latex -> Draw("same");
++iter;
}
c -> Print(Form("%s/c_tRes_vs_Vov_ch%d+ch%d_ch%d+ch%d.png",plotDir.c_str(),ch1,ch2,ch3,ch4));
c -> Print(Form("%s/c_tRes_vs_Vov_ch%d+ch%d_ch%d+ch%d.pdf",plotDir.c_str(),ch1,ch2,ch3,ch4));
}
}
| [
"[email protected]"
] | |
038b140437a81b3f7b72cbeffa3d409f26ce9ad6 | c6fa1b9f90044ad35097b01e6671b09d4252db13 | /102 triangle containment/main.cpp | 229ef93807d739d803628146e5dcce03fbd1e35c | [] | no_license | fangzhou070101/Project_Euler | 5d84be3dd6f1b3165307bd945ce3911915e574c9 | 7476b3a3444044232b9037785e3cf63d2acfbf8c | refs/heads/master | 2022-03-11T19:22:04.949271 | 2022-03-02T03:29:23 | 2022-03-02T03:29:23 | 41,497,563 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,675 | cpp | #include <iostream>
#include <fstream>
using namespace std;
bool interior(int x1,int y1,int x2,int y2,int x3,int y3,int x,int y);
bool sameSide(int xl1,int yl1,int xl2,int yl2,int x1,int y1,int x2,int y2);
int main()
{
int triIdx;
int x1,x2,x3,y1,y2,y3;
int total=0;
char junk;
//cout<<sameSide(1,1,-1,-1,0,1,1,0);
ifstream triangles("triangles.txt");
if(!triangles.is_open()){
cout<<"file couldn't open.\n";
return 0;
}
for(triIdx=0;triIdx<1000;triIdx++)
{
triangles>>x1>>junk>>y1>>junk>>x2>>junk>>y2>>junk>>x3>>junk>>y3;
if(interior(x1,y1,x2,y2,x3,y3,0,0)) total++;
}
triangles.close();
cout<<total;
return 0;
}
bool interior(int x1,int y1,int x2,int y2,int x3,int y3,int x,int y)
{
if(sameSide(x1,y1,x2,y2,x3,y3,x,y)&&sameSide(x1,y1,x3,y3,x2,y2,x,y)&&sameSide(x2,y2,x3,y3,x1,y1,x,y)) return true;
return false;
}
bool sameSide(int xl1,int yl1,int xl2,int yl2,int x1,int y1,int x2,int y2) // returns true if two endpoints of line segment are the same
{
if(xl1==xl2 && yl1==yl2) return true;
if(xl1==xl2 && ((x1>=xl1&&x2>=xl1) || (x1<xl1&&x2<xl1))) return true;
if(yl1==yl2 && ((y1>=yl1&&y2>=yl1) || (y1<yl1&&y2<yl1))) return true;
if( y1==double((yl2-yl1)*(x1-xl1)+yl1*(xl2-xl1))/(xl2-xl1) || y2==double((yl2-yl1)*(x2-xl1)+yl1*(xl2-xl1))/(xl2-xl1) ) return true;
if( y1>double((yl2-yl1)*(x1-xl1)+yl1*(xl2-xl1))/(xl2-xl1) && y2>double((yl2-yl1)*(x2-xl1)+yl1*(xl2-xl1))/(xl2-xl1) ) return true;
if( y1<double((yl2-yl1)*(x1-xl1)+yl1*(xl2-xl1))/(xl2-xl1) && y2<double((yl2-yl1)*(x2-xl1)+yl1*(xl2-xl1))/(xl2-xl1) ) return true;
return false;
}
| [
"[email protected]"
] | |
43239b96ab8ca351abadac3f9373fd0285c182ee | 32d3a6b87652df41c9239085e245c00ec692883c | /Clases/Semana 6/Clase 1/MorelliSebastianS6C1.cpp | cc83e2123aefd63ceaf9fc786a6f675adde14557 | [] | no_license | SebastianMorelli/MetodosComputacionales-SM | 4ae9b48ee059ac04b0fe14a9852ee2d1eae33273 | e028ff95dcc1fab47036de7ea86488ebff98375a | refs/heads/master | 2021-07-12T12:31:40.662406 | 2020-08-30T03:26:27 | 2020-08-30T03:26:27 | 195,323,344 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 906 | cpp | //Este código soluciona una ecuación de onda de primer orden.
#include <iostream>
#include <cmath>
using namespace std;
//Declaración Variables
int ini = 0;
int fini = 2;
int numpunt = 80;
float vel = 1.0;
float dx = (fini - ini)/numpunt;
float dt = (dx/vel)*0.25;
//Declaración funciones
float * yoAdivinoFuturo (float arrPast, float arrFut);
int main()
{
float inicialWave[numpunt];
float futureWave[numpunt];
for (int i = 0; i <= numpunt; i++){
xWave = dx*i
if(xWave < 0.75 || xWave > 1.25){
inicialWave[i] = 1.0;
}
else{
inicialWave[i]=2.0;
}
}
}
float * yoAdivinoFuturo (float arrPast, flaot arrFut){
float * p = arrFut;
for( int i = 1; i <= numpunt; i++){
arrFut[i] = (vel*dt)/dx * (arrPast[i]-arrPast[i-1]) + arrPast[i];
}
return p;
}
| [
"[email protected]"
] | |
d2afe5fc276aea3c8d2a60ce558f05576ac4bb20 | 713535ea331ba86a72729393477ec4e0efb39576 | /정ㅋ벅ㅋ.cpp | 76ca620449e55dfe1e494254262ff1e8fa8c6b70 | [] | no_license | ljh1324/algorithm | 9ed2039cd887998765e56a01256eb7eeec4c4cf7 | 26c5e478c056c60e88e4d642dd7ac7cec585965e | refs/heads/master | 2020-03-12T10:27:09.106066 | 2018-04-22T14:09:50 | 2018-04-22T14:09:50 | 130,573,200 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 117 | cpp | // https://www.acmicpc.net/problem/1237
#include <stdio.h>
int main()
{
printf("문제의 정답\n");
return 0;
} | [
"[email protected]"
] | |
13351ff63e71afc6788d174f6cf8708f9a0bbd0a | 39abe80bce4f656d70000a6b630cad599b4969da | /ModelLoader/ModelLoader.cpp | 26993991cf736e1b0aa2c08355c37086c119bd9f | [] | no_license | kinleed2/RCC-Dear-ImGui-and-DirectX12-Test | e9a6deadfc1e943c7a642d9b827f02fd59547fbf | 223fdde3a3a680b5b62bb33b4708c4ea9c426493 | refs/heads/master | 2023-04-06T00:14:13.255016 | 2021-04-14T09:13:13 | 2021-04-14T09:13:13 | 355,753,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,857 | cpp | #include "ModelLoader.h"
#include "../SystemTable.h"
void ModelLoader::Load(const std::string& filename)
{
Assimp::Importer importer;
const aiScene* pScene = importer.ReadFile(filename,
aiProcess_Triangulate |
aiProcess_ConvertToLeftHanded);
this->mDirectory = filename.substr(0, filename.find_last_of('/'));
processNode(pScene->mRootNode, pScene);
}
void ModelLoader::processNode(aiNode* node, const aiScene* scene)
{
for (UINT i = 0; i < node->mNumMeshes; i++)
{
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
mGeometries.push_back(std::move(this->processMesh(mesh, scene)));
}
for (UINT i = 0; i < node->mNumChildren; i++)
{
this->processNode(node->mChildren[i], scene);
}
}
std::unique_ptr<MeshGeometry> ModelLoader::processMesh(aiMesh* mesh, const aiScene* scene)
{
// Data to fill
vector<VertexPositionNormalTexture> vertices;
vector<uint16_t> indices;
vector<Texture> textures;
if (mesh->mMaterialIndex >= 0)
{
aiMaterial* mat = scene->mMaterials[mesh->mMaterialIndex];
ModelMaterialData matData;
matData.materialname = mat->GetName().C_Str();
matData.meshname = mesh->mName.C_Str();
matData.diffuse = loadMaterialTextures(mat, aiTextureType_DIFFUSE, scene);
matData.normal = loadMaterialTextures(mat, aiTextureType_NORMALS, scene);
mMaterialData.push_back(matData);
}
// Walk through each of the mesh's vertices
for (UINT i = 0; i < mesh->mNumVertices; i++)
{
VertexPositionNormalTexture vertex;
vertex.position.x = mesh->mVertices[i].x;
vertex.position.y = mesh->mVertices[i].y;
vertex.position.z = mesh->mVertices[i].z;
if (mesh->HasNormals())
{
vertex.normal.x = mesh->mNormals[i].x;
vertex.normal.y = mesh->mNormals[i].y;
vertex.normal.z = mesh->mNormals[i].z;
}
if (mesh->mTextureCoords[0])
{
vertex.textureCoordinate.x = (float)mesh->mTextureCoords[0][i].x;
vertex.textureCoordinate.y = (float)mesh->mTextureCoords[0][i].y;
}
vertices.push_back(vertex);
}
for (UINT i = 0; i < mesh->mNumFaces; i++)
{
aiFace face = mesh->mFaces[i];
for (UINT j = 0; j < face.mNumIndices; j++)
indices.push_back(face.mIndices[j]);
}
auto meshGeometry = make_unique<MeshGeometry>();
meshGeometry->Set(g_pSys->pDeviceResources.get(), mesh->mName.C_Str(), vertices, indices);
return meshGeometry;
}
wstring ModelLoader::loadMaterialTextures(aiMaterial* mat, aiTextureType type, const aiScene* scene)
{
if (mat->GetTextureCount(type) > 1)
{
MessageBoxW(g_pSys->pDeviceResources->GetWindow(), L"texture more than 1", L"warning", MB_OK);
}
else
{
aiString str;
mat->GetTexture(type, 0, &str);
string filename = string(str.C_Str());
filename = filename.substr(filename.find_last_of("/\\") + 1);
filename = mDirectory + '/' + filename;
wstring filenamews = wstring(filename.begin(), filename.end());
return filenamews;
}
} | [
"[email protected]"
] | |
21ac6245e1d682662ec2ba008737b7614ff9d834 | bfc070a73536759e00777ab5c5f81ca25f3878ce | /sem4_sdd/sem4_sdd/Source.cpp | 1ef68ad98e28c2253e06bce5278310850fc301ce | [] | no_license | Data-Structures-Fork/SDD1058 | ffaf6a7cd6722963b7301020aaafaf1edafa675b | 523f0060fbefb7aac25dc001de575be0379077e6 | refs/heads/master | 2022-07-04T03:16:48.298053 | 2020-05-14T17:33:51 | 2020-05-14T17:33:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,287 | cpp | #include <iostream>
#include <stdio.h>
using namespace std;
//Structura stiva este un caz particular de lista simpla care respecta principiul LIFO (Last In First Out)
//informatie utila nod stiva
struct carte
{
int cod;
char *titlu;
float pret;
//int nrAutori;
//char **numeAutori;
};
//definire structura nod stiva (informatie utila de tip carte si pointer de legatura next)
struct nodStiva
{
carte inf;
nodStiva *next; //la fel ca la lista simpla
};
//definire structura nod lista simpla pentru conversie stiva-lista
struct nodLista
{
carte inf;
nodLista *next;
};
//functie folosita pentru inserarea unui nod in stiva
//adresa de inceput (primul element al stivei) se numeste "varf" (echivalent cu "cap" de la lista)
//varful se trimite cu doua ** din cauza ca metoda returneaza void si este nevoie de returnarea varfului modificat
//inserarea se face inaintea primului element, adica varful se actualizeaza dupa fiecare inserare
void push(nodStiva **varf, carte c)
{
nodStiva* nou = (nodStiva*)malloc(sizeof(nodStiva));
nou->inf.cod = c.cod;
nou->inf.titlu = (char*)malloc((strlen(c.titlu)+1)*sizeof(char));
strcpy(nou->inf.titlu, c.titlu);
nou->inf.pret = c.pret;
nou->next = NULL;
if (*varf == NULL)
{
*varf = nou;
}
else
{
nou->next = *varf;
*varf = nou;
}
}
//functie de extragere a unui nod din stiva
//returneaza int cu valoare 0 daca extragerea se face cu succes si -1 in caz contrar
//varful se actualizeaza la fiecare extragere deoarece se extrage mereu primul element
//se pastreaza in pointerul "val" informatia utila din nodul extras
//extragerea se face cu stergerea nodului din structura
int pop(nodStiva **varf, carte *val)
{
if (*varf==NULL) return -1;
else
{
(*val).cod = (*varf)->inf.cod;
(*val).titlu = (char*)malloc((strlen((*varf)->inf.titlu)+1)*sizeof(char));
strcpy((*val).titlu, (*varf)->inf.titlu);
(*val).pret = (*varf)->inf.pret;
nodStiva *temp = *varf;
*varf = (*varf)->next;
free(temp->inf.titlu);
free(temp);
return 0;
}
}
//functie de afisare a structurii stiva
void traversare(nodStiva *varf)
{
nodStiva *temp = varf;
while(temp)
{
printf("\nCod = %d, Titlu = %s, Pret = %5.2f", temp->inf.cod, temp->inf.titlu, temp->inf.pret);
temp = temp->next;
}
}
//functie de afisare a structurii lista simpla
void traversareLista(nodLista *cap)
{
nodLista *temp = cap;
while(temp)
{
printf("\nCod = %d, Titlu = %s, Pret = %5.2f", temp->inf.cod, temp->inf.titlu, temp->inf.pret);
temp = temp->next;
}
}
//functie de conversie din stiva de carti in vector de carti
void conversieStivaVector(nodStiva **varf, carte *vect, int *nr)
{
carte val;
while(pop(varf, &val)==0) //atat timp cat se extrage cu succes din stiva se insereaza in vector
{
vect[*nr] = val;
(*nr)++;
}
}
//functie de inserare nod in lista simpla
void inserareLista(nodLista** cap, carte val)
{
nodLista* nou = (nodLista*)malloc(sizeof(nodLista));
nou->inf.cod = val.cod;
nou->inf.titlu = (char*)malloc((strlen(val.titlu)+1)*sizeof(char));
strcpy(nou->inf.titlu, val.titlu);
nou->inf.pret = val.pret;
nou->next = NULL;
if (*cap==NULL)
*cap = nou;
else
{
nodLista* temp = *cap;
while(temp->next) temp = temp->next;
temp->next = nou;
}
}
//functie de conversie stiva in lista simpla
void conversieStivaListaSimpla(nodStiva** varf, nodLista**cap)
{
carte val;
while(pop(varf, &val)==0)
{
inserareLista(cap, val);
}
}
void main()
{
nodStiva *varf = NULL;
int n;
carte c;
printf("Nr. carti=");
scanf("%d", &n);
char buffer[20];
for (int i=0;i<n;i++)
{
printf("\nCod=");
scanf("%d", &c.cod);
printf("\nTitlu=");
cin.getline(buffer, 20, ';');
c.titlu = (char*)malloc((strlen(buffer)+1)*sizeof(char));
strcpy(c.titlu, buffer);
printf("\nPret=");
scanf("%f", &c.pret);
push(&varf, c);
}
traversare(varf);
carte val;
pop(&varf, &val);
printf("\nCartea extrasa are codul %d si titlul %s", val.cod, val.titlu);
printf("\n----------------\n");
/*carte *vect = (carte*)malloc(n*sizeof(carte));
int nr = 0;
conversieStivaVector(&varf, vect, &nr);
for(int i=0;i<nr;i++)
printf("\nCod = %d, Titlu = %s, Pret = %5.2f", vect[i].cod, vect[i].titlu, vect[i].pret);
free(vect);*/
nodLista* cap = NULL;
conversieStivaListaSimpla(&varf, &cap);
traversareLista(cap);
} | [
"[email protected]"
] | |
f073d01b08af0504a4b9b42505c1be2371574b80 | 81001ad1e99459969a39c679907130956b89eff1 | /src/calculusprime/internal/parsing/ParserHolder.cpp | 048068a7112660dc62143750c9b6b7e98969a343 | [
"Apache-2.0"
] | permissive | aposin/CalculusPrime-PnC | 214b91ac5e9c9761296f2fde16dc0c690fe21a6b | 8ab682b67f1a770c4404bcaa3f33260ab5aef1d3 | refs/heads/master | 2020-09-21T04:42:41.968894 | 2019-11-28T15:18:41 | 2019-11-28T15:18:41 | 224,681,250 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,741 | cpp | /*
Copyright 2019 Association for the promotion of open - source insurance software and for the establishment of open interface standards in the insurance industry
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 <calculusprime/internal/parsing/ParserHolder.h>
#include <calculusprime/internal/require.h>
using namespace antlr4;
namespace CalculusPrime {
void ParserHolder::parse(const std::string& formula_)
{
m_inputStream.reset(new ANTLRInputStream(formula_));
m_lexer.reset(new RatingEngineLexer(m_inputStream.get()));
m_tokens.reset(new CommonTokenStream(m_lexer.get()));
m_ratingEngineParser.reset(new RatingEngineParser(m_tokens.get()));
m_ratingEngineParser->setBuildParseTree(true);
m_ratingEngineParser->setErrorHandler(std::make_shared<BailErrorStrategy>());
m_ratingEngineParser->removeErrorListeners();
m_collectingErrorListener.reset(new CollectingErrorListener());
m_ratingEngineParser->addErrorListener(m_collectingErrorListener.get());
m_parseTree = m_ratingEngineParser->parse();
}
const std::vector<std::string>& ParserHolder::getErrors() const
{
CP_REQUIRE(m_collectingErrorListener);
return m_collectingErrorListener->getErrors();
}
}
| [
"[email protected]"
] | |
58f118e8b57e82aa66343bbba32ed7a0923b29ef | dd169c135fec84473c2b1423108d77c4c5947be3 | /cpp/IDBWindow/idblayout/idbtabcontent.cpp | b112d992c34013a6433667f0331d60201035249d | [] | no_license | chinab/enterprise-manage | 507bd900a8139511034826fac72b47cf5b26c68f | ea7dd8401b3f5f0996d4a5bb3f93d4c0c781a05f | refs/heads/master | 2021-01-23T12:05:02.018666 | 2014-05-09T10:13:32 | 2014-05-09T10:13:32 | 42,087,784 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 255 | cpp | #include "idbtabcontent.h"
IDBTabContent::IDBTabContent(QWidget *parent) :
QWidget(parent)
{
}
void IDBTabContent::setInfo(const QVariantMap &info){
info["name"];
}
void IDBTabContent::info(QVariantMap &info){
info["name"];
}
| [
"yinxvxv@7b49d478-5329-11de-936b-e9512c4d2277"
] | yinxvxv@7b49d478-5329-11de-936b-e9512c4d2277 |
fb4f87d1ca7250e4c0ed7ece57a88c0587a75e04 | 971b36d80bdf94cf29b4709e22d622354cc38f0f | /Software/test-inputs/test-inputs.ino | be40aedcf913723e8a23ad0b9e56e211676d8c32 | [] | no_license | Jedzia/UVTimer-Firmware | 5b8c0c543f2908d7e8fd539b8c7796a75bd33387 | 8e3bae8cd88566302572f9e885667d81147b5dc0 | refs/heads/master | 2022-07-30T16:42:15.051139 | 2020-05-23T12:47:57 | 2020-05-23T12:47:57 | 265,448,869 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,589 | ino | #include <Bounce2.h>
#define butInput1 4
#define butInput2 7
#define butInput3 8
#define butInput4 12
#define butInput5 6
#define butInput6 SDA
#define LED1 13
// Debouncers
const int debounceInverval = 25;
Bounce debInput1 = Bounce();
Bounce debInput2 = Bounce();
Bounce debInput3 = Bounce();
Bounce debInput4 = Bounce();
Bounce debInput5 = Bounce();
Bounce debInput6 = Bounce();
void setup() {
// put your setup code here, to run once:
pinMode(LED1, OUTPUT); // enable LED1 output
pinMode(butInput1, INPUT_PULLUP);
debInput1.attach(butInput1);
debInput1.interval(debounceInverval);
pinMode(butInput2, INPUT_PULLUP);
debInput2.attach(butInput2);
debInput2.interval(debounceInverval);
pinMode(butInput3, INPUT_PULLUP);
debInput3.attach(butInput3);
debInput3.interval(debounceInverval);
pinMode(butInput4, INPUT_PULLUP);
debInput4.attach(butInput4);
debInput4.interval(debounceInverval);
pinMode(butInput5, INPUT_PULLUP);
debInput5.attach(butInput5);
debInput5.interval(debounceInverval);
pinMode(butInput6, INPUT_PULLUP);
debInput6.attach(butInput6);
debInput6.interval(debounceInverval);
}
void loop() {
// put your main code here, to run repeatedly:
debInput1.update();
debInput2.update();
debInput3.update();
debInput4.update();
debInput5.update();
debInput6.update();
if (!debInput1.read())
{
}
// digitalWrite(LED1, debInput1.read());
digitalWrite(LED1, debInput1.read() && debInput2.read() &&debInput3.read() &&debInput4.read() &&debInput5.read() &&debInput6.read());
}
| [
"[email protected]"
] | |
6cf8d7e7aad003374fa2ad14e38040c10264cc0b | dcee496e112bab404f050534b745447d32aaebf4 | /q3.cpp | 843cfe71a72f7cf6c7eb99af30e4857ad47d8552 | [] | no_license | kushaangowda/GCC_2020 | 879a642d16aac88b17ef3451d14fd55d5395a482 | b663c60c0a844f791e4e927121c2566dd1b50eb4 | refs/heads/master | 2023-01-08T01:31:00.030915 | 2020-11-10T04:36:53 | 2020-11-10T04:36:53 | 311,544,877 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,224 | cpp | #include<bits/stdc++.h>
using namespace std;
string find_min_days(int profit[], int price[], int d)
{
map <int,int> m;
int i=1,p[d],q[d],c[d];
for(int j=0;j<d;j++){
c[j]=0;
}
m.insert(pair<int, int>(price[0], 1));
while(price[i]){
for(int j=0;j<d;j++){
if(m[price[i]-profit[j]]>0 && c[j]==0){
p[j] = m[price[i]-profit[j]];
q[j] = i+1;
c[j] = 1;
}
}
m[price[i]] = i+1;
i++;
}
string a;
for(int j=0;j<d;j++){
if(c[j]){
a.append(to_string(p[j]));
a.append(" ");
a.append(to_string(q[j]));
a.append(",");
}else{
a.append(to_string(-1));
a.append(",");
}
}
a.pop_back();
//Participants code will be here
return a;
}
int main ()
{
int n,d,i;
string answer="";
cin>>n>>d;
int price[n];
int profit[d];
for (i=0;i<n;i++)
cin>>price[i];
for (i=0;i<d;i++)
cin>>profit[i];
answer = find_min_days(profit,price,d);
// Do not remove below line
cout<<answer<<endl;
// Do not print anything after this line
return 0;
}
// 90/90 test cases successful | [
"[email protected]"
] | |
a17959f9262a98cceba68a579d09ce064d4fe747 | f16a32a85f2f94e8d54f5fffe7f3381100bd879f | /src/test/pow_tests.cpp | 90f69ebb7138f8f7efffad825b9cded986ae3d37 | [
"MIT"
] | permissive | Babocoin/Babocoin | 978ea6d2a4b7eb400b9d83bb7da99419f71c8f51 | 5dc79c49efb13851eb55436d05fd18a8bbafad78 | refs/heads/main | 2023-03-21T10:24:29.294544 | 2021-03-11T01:09:14 | 2021-03-11T01:09:14 | 339,209,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,533 | cpp | // Copyright (c) 2015-2018 The Bitcoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chain.h>
#include <chainparams.h>
#include <pow.h>
#include <random.h>
#include <util.h>
#include <test/test_babocoin.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
/* Test calculation of next difficulty target with no constraints applying */
BOOST_AUTO_TEST_CASE(get_next_work)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
int64_t nLastRetargetTime = 1261130161; // Block #30240
CBlockIndex pindexLast;
pindexLast.nHeight = 32255;
pindexLast.nTime = 1262152739; // Block #32255
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00d86aU);
}
/* Test the constraint on the upper bound for next work */
BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
int64_t nLastRetargetTime = 1231006505; // Block #0
CBlockIndex pindexLast;
pindexLast.nHeight = 2015;
pindexLast.nTime = 1233061996; // Block #2015
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffffU);
}
/* Test the constraint on the lower bound for actual time taken */
BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
int64_t nLastRetargetTime = 1279008237; // Block #66528
CBlockIndex pindexLast;
pindexLast.nHeight = 68543;
pindexLast.nTime = 1279297671; // Block #68543
pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c0168fdU);
}
/* Test the constraint on the upper bound for actual time taken */
BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 46367;
pindexLast.nTime = 1269211443; // Block #46367
pindexLast.nBits = 0x1c387f6f;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00e1fdU);
}
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
std::vector<CBlockIndex> blocks(10000);
for (int i = 0; i < 10000; i++) {
blocks[i].pprev = i ? &blocks[i - 1] : nullptr;
blocks[i].nHeight = i;
blocks[i].nTime = 1269211443 + i * chainParams->GetConsensus().nPowTargetSpacing;
blocks[i].nBits = 0x207fffff; /* target 0x7fffff000... */
blocks[i].nChainWork = i ? blocks[i - 1].nChainWork + GetBlockProof(blocks[i - 1]) : arith_uint256(0);
}
for (int j = 0; j < 1000; j++) {
CBlockIndex *p1 = &blocks[InsecureRandRange(10000)];
CBlockIndex *p2 = &blocks[InsecureRandRange(10000)];
CBlockIndex *p3 = &blocks[InsecureRandRange(10000)];
int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, chainParams->GetConsensus());
BOOST_CHECK_EQUAL(tdiff, p1->GetBlockTime() - p2->GetBlockTime());
}
}
BOOST_AUTO_TEST_SUITE_END()
| [
"[email protected]"
] | |
7b8cc1ce8d353d73949856a35073ac783312b2a8 | 3e7dae5e52d4c775c8dd50701f32e9b5aaaa090b | /src/utility/parallel.cpp | 0fc92a76dbaf40f57c9da7055ea74a8a559a4a68 | [] | no_license | haolly/soraytrace | 9702baab3adbaa1439b4f662ca6b7334009b5093 | e8679cacad54c988e123f12b390cbc86bce59a1d | refs/heads/master | 2021-02-08T07:55:53.544744 | 2014-08-01T11:07:42 | 2014-08-01T11:07:42 | 244,126,963 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,756 | cpp | /*
FileName: parallel.cpp
Created Time: 2011-09-02 12:14:02
Auther: Cao Jiayin
Email: [email protected]
Location: China, Shanghai
Description: SORT is short for Simple Open-source Ray Tracing. Anyone could checkout the source code from
'sourceforge', https://soraytrace.svn.sourceforge.net/svnroot/soraytrace. And anyone is free to
modify or publish the source code. It's cross platform. You could compile the source code in
linux and windows , g++ or visual studio 2008 is required.
*/
#include "parallel.h"
#include <omp.h>
#if defined(SORT_IN_WINDOWS)
#include <windows.h>
#endif
// whether multi thread is enabled
// by default it's enabled
static bool g_bMultiThreadEnabled = true;
// enable or disable multi-thread
bool MultiThreadEnabled()
{
return g_bMultiThreadEnabled;
}
void SetMultiThreadEnabled( bool enabled )
{
g_bMultiThreadEnabled = enabled;
}
// get the number of cpu cores in the system
unsigned NumSystemCores()
{
if( g_bMultiThreadEnabled )
{
#if defined(SORT_IN_WINDOWS)
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
#elif defined(SORT_IN_LINUX) || defined(SORT_IN_MAC)
return sysconf(_SC_NPROCESSORS_ONLN);
#endif
}
return 1;
}
// set the number of threads
// thread number is the same as the number of cpu cores
unsigned SetThreadNum()
{
if( g_bMultiThreadEnabled )
{
unsigned cores = NumSystemCores();
omp_set_num_threads( cores );
return cores;
}
return 1;
}
// get the thread id
unsigned ThreadId()
{
if( g_bMultiThreadEnabled )
return omp_get_thread_num();
return 0;
}
| [
"codeboycjy@32f55271-c391-4a20-9b51-6f3d7b68033c"
] | codeboycjy@32f55271-c391-4a20-9b51-6f3d7b68033c |
abdc509fc884bbe00b3cf9a741afb43dc4c196bc | 28f1dedfa55de3381f0e2124c7c819f582767e2a | /unmaintained/extras/avalanche/AvalancheCore/VMFox/CVMFox.h | 8e1c4f9d1d558317a2b9f48f15ec3e22cef259d7 | [] | no_license | rhusar/smartfrog | 3bd0032888c03a8a04036945c2d857f72a89dba6 | 0b4db766fb1ec1e1c2e48cbf5f7bf6bfd2df4e89 | refs/heads/master | 2021-01-10T05:07:39.218946 | 2014-11-28T08:52:32 | 2014-11-28T08:52:32 | 47,347,494 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,363 | h | #ifndef _CVMFOX_H_
#define _CVMFOX_H_
#define REAL_VIX_SDK_VERSION 1
#include <vix.h>
#include <stdio.h>
class CVMFox
{
private:
const char *m_pHostname, // hostname
*m_pUsername, // username
*m_pPassword, // password
*m_pVMPath; // path to the vm on the host
int m_iHostport; // port on the hostmachine
VixHandle m_HostHandle, // handle to the host
m_VMHandle; // handle to the vm
bool connect();
bool aquireVMHandle(); // gets the handle to the vm
void disconnect();
public:
// default constructor
CVMFox()
: m_pHostname(NULL),
m_pUsername(NULL),
m_pPassword(NULL),
m_pVMPath(""),
m_iHostport(0),
m_HostHandle(VIX_INVALID_HANDLE),
m_VMHandle(VIX_INVALID_HANDLE) { };
// destructor
~CVMFox();
// setters
void setHostname(const char* inHostname) { m_pHostname = inHostname; }
void setUsername(const char* inUsername) { m_pUsername = inUsername; }
void setPassword(const char* inPassword) { m_pPassword = inPassword; }
void setVMPath(const char* inVMPath) { m_pVMPath = inVMPath; }
void setHostPort(int inPort) { m_iHostport = inPort; }
void startVM();
void stopVM();
void suspendVM();
void resetVM();
void listRunningVMs();
void registerVM();
void unregisterVM();
void getPowerState();
void getToolsState();
};
#endif
| [
"helgemahrt@9868f95a-be1e-0410-b3e3-a02e98b909e6"
] | helgemahrt@9868f95a-be1e-0410-b3e3-a02e98b909e6 |
295fac7c4a6f3e1bcf8df61f83986d337c0e8bf1 | b6607ecc11e389cc56ee4966293de9e2e0aca491 | /acm.kbtu.kz/Programming langs/77/77.cpp | 8d8c8145b5af14395e5c23efbe515b040776b0a6 | [] | no_license | BekzhanKassenov/olymp | ec31cefee36d2afe40eeead5c2c516f9bf92e66d | e3013095a4f88fb614abb8ac9ba532c5e955a32e | refs/heads/master | 2022-09-21T10:07:10.232514 | 2021-11-01T16:40:24 | 2021-11-01T16:40:24 | 39,900,971 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 445 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int cnt[27];
int main()
{
string s;
while (cin >> s)
{
for (int i = 0; i < (int) s.length(); i++)
{
if (s[i] >= 'A' && s[i] <= 'Z')
cnt[s[i] - 'A'] ++;
if (s[i] >= 'a' && s[i] <= 'z')
cnt[s[i] - 'a'] ++;
}
}
for (int i = 0; i < 26; i++)
cout << char(i + 'A') << " - " << cnt[i] << endl;
return 0;
}
| [
"[email protected]"
] | |
7885b3f026473f70e153c8efc1c736a5c4375fc1 | 0c13f39b7dd406724f6469c3f87e1302f601c9d8 | /MeandrSAMD21G18A_LoRa_Receiver/CorePinScenario.cpp | 4d72c7662ccb04c1da205ed5dba9225b31bfbe0d | [] | no_license | Porokhnya/UROV | 581c1df96c066b72817f4fdb609e3446370d6384 | 685462db74c5b2198cbf4606585f68ac0c42ecc6 | refs/heads/master | 2021-06-05T08:13:23.900913 | 2021-04-21T14:10:22 | 2021-04-21T14:10:22 | 122,962,673 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,774 | cpp | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "CorePinScenario.h"
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CorePinScenario
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CorePinScenario::CorePinScenario()
{
actions = new CorePinActionsList;
isEnabled = true;
currentActionIndex = 0;
timer = 0;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bool CorePinScenario::enabled()
{
return isEnabled;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CorePinScenario::enable()
{
isEnabled = true;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CorePinScenario::disable()
{
isEnabled = false;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CorePinScenario::clear()
{
delete actions;
actions = new CorePinActionsList;
currentActionIndex = 0;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CorePinScenario::add(CorePinAction action)
{
actions->push_back(action);
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CorePinScenario::update()
{
if(!isEnabled || !actions->size())
return;
CorePinAction* action = &((*actions)[currentActionIndex]);
if(!timer) // first call
{
timer = micros();
}
if(micros() - timer > action->duration)
{
currentActionIndex++;
if(currentActionIndex >= actions->size())
currentActionIndex = 0;
action = &((*actions)[currentActionIndex]);
digitalWrite(action->pin,action->level);
timer = micros();
}
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| [
"[email protected]"
] | |
db6ef28f165ca00ec22b77ea9e0b0ffb3d4063e5 | 72806e672ae44be1ad5d1365224b9b430d1fa721 | /pod/pinocchio/qap/CircuitMatrixMultiply.cpp | 968b53d62e28300252e77a9443fdc62134908f56 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | imtypist/BlockSense | 277814436a50c800625193d4c72982e326f9566a | 00a0336205c1f1049d978b07bcf078b8c85374b0 | refs/heads/master | 2023-05-27T13:42:32.715625 | 2023-05-15T09:53:58 | 2023-05-15T09:53:58 | 145,524,879 | 14 | 4 | null | 2020-07-18T04:56:06 | 2018-08-21T07:33:59 | C++ | UTF-8 | C++ | false | false | 5,480 | cpp | #include "GateMul2.h"
#include "CircuitMatrixMultiply.h"
#include "Field.h"
#include "GateAddN.h"
// Generates a standard circuit for matrix multiplication
// c_{ij} = \sum_{k=1..N} a_ik * b_kj
CircuitMatrixMultiply::CircuitMatrixMultiply(Field* field, const int dimension) : Circuit(field) {
this->dimension = dimension;
this->fanIn2adders = false;
// Allocate I/O
freshWires(inputs, 2*dimension*dimension); // 2 NxN matrices
freshWires(outputs, dimension*dimension); // 1 NxN matrix
// Create the multiplication layer
for (int i = 0; i < dimension; i++) {
for (int j = 0; j < dimension; j++) {
GateAddN* adder = new GateAddN(field, dimension);
adder->assignOutput(freshWire(outputs)); // outputs[i][j]
addNonMulGate(adder);
for (int k = 0; k < dimension; k++) {
int indexA = 0 * (dimension*dimension) + i * dimension + k; // inputs[0][i][k]
int indexB = 1 * (dimension*dimension) + k * dimension + j; // inputs[1][k][j]
GateMul2* mul = new GateMul2(field, inputs[indexA], inputs[indexB], freshWire(intermediates));
addMulGate(mul);
adder->assignInput(mul->output);
}
}
}
this->labelWires();
this->sort(); // Topologically sort all of the gates we just added
this->assignIDs();
}
// Generates a circuit suitable for QAP creation
// fanIn2adders governs whether we divide fan-in-N adders into fanIn2adders
CircuitMatrixMultiply::CircuitMatrixMultiply(Field* field, const int dimension, bool fanIn2adders) : Circuit(field) {
this->dimension = dimension;
this->fanIn2adders = fanIn2adders;
// Allocate I/O
freshWires(inputs, 2*dimension*dimension+1); // 2 NxN matrices + a constant 1
freshWires(outputs, dimension*dimension); // 1 NxN matrix
int constOneInputIndex = 2*dimension*dimension;
for (int i = 0; i < dimension; i++) {
for (int j = 0; j < dimension; j++) {
WireList outputList;
// Create the a_ik * b_kj gates, for k = 1 to dimension
for (int k = 0; k < dimension; k++) {
int indexA = 0 * (dimension*dimension) + i * dimension + k; // inputs[0][i][k]
int indexB = 1 * (dimension*dimension) + k * dimension + j; // inputs[1][k][j]
GateMul2* mul = new GateMul2(field, inputs[indexA], inputs[indexB], freshWire(intermediates));
addMulGate(mul);
outputList.push_back(mul->output);
}
// Sum the results of the multiplication gates
if (!fanIn2adders) {
// Create a single fan-in-N adder
GateAddN* adder = new GateAddN(field, dimension);
addNonMulGate(adder);
adder->assignOutput(freshWire(nonMultIntermediates));
// Assign the outputs of the multiplications as inputs
for (WireList::iterator iter = outputList.begin(); iter != outputList.end(); iter++) {
adder->assignInput(*iter);
}
outputList.clear();
// Connect a single multiplication gate to the adder's output, so the overall output comes from a mult gate
int indexOut = i*dimension + j;
GateMul2* mul = new GateMul2(field, adder->output, inputs[constOneInputIndex], outputs[indexOut]);
addMulGate(mul);
} else {
// Create a binary tree of fan-in-2 adders (and multiplication gates) to sum the outputs of the multiplications
while (outputList.size() > 1) {
Wire* out1 = outputList.front(); outputList.pop_front();
Wire* out2 = outputList.front(); outputList.pop_front();
GateAddN* add2 = new GateAddN(field, 2);
add2->assignInput(out1);
add2->assignInput(out2);
add2->assignOutput(freshWire(nonMultIntermediates));
addNonMulGate(add2);
GateMul2* constMul = NULL;
if (outputList.size() == 0) {
// This is the last mul2 gate, so it's output is a circuit output
int outputIndex = dimension * i + j; // outputs[i][j]
constMul = new GateMul2(field, add2->output, inputs[constOneInputIndex], outputs[outputIndex]);
} else {
constMul = new GateMul2(field, add2->output, inputs[constOneInputIndex], freshWire(intermediates));
}
addMulGate(constMul);
outputList.push_back(constMul->output);
}
}
}
}
this->labelWires();
this->sort(); // Topologically sort all of the gates we just added
this->assignIDs();
}
void CircuitMatrixMultiply::labelWires() {
for (int i = 0; i < inputs.size(); i++) {
inputs[i]->trueInput = true;
}
for (int i = 0; i < outputs.size(); i++) {
outputs[i]->trueOutput = true;
}
}
/*
* This implements standard matrix multiplication,
* but it's modified for QAPs; i.e., it keeps track
* of intermediate multiplication outputs and it adds
* a "multiply by 1" ahead of each output
* Note1: We don't actually do the multiply by 1,
* we just keep track of the intermediate values
* Note2: This assumes we're using dimension-input adders,
* rather than 2-input adders
*/
void CircuitMatrixMultiply::directEval() {
if (fanIn2adders) {
// Not going to bother simulating this
gateEval();
} else {
for (int i = 0; i < dimension; i++) {
for (int j = 0; j < dimension; j++) {
FieldElt accumulator;
field->zero(accumulator);
for (int k = 0; k < dimension; k++) {
// a * b => c
field->mul(inputs[i*dimension+k]->value, inputs[dimension*dimension + k*dimension+j]->value, intermediates[i*dimension*dimension + j*dimension + k]->value);
field->add(intermediates[i*dimension*dimension + j*dimension + k]->value, accumulator, accumulator);
}
field->copy(accumulator, outputs[i*dimension + j]->value);
}
}
}
} | [
"[email protected]"
] | |
70967908818efef1c72c892a9d1fe98cc2d9c9e6 | 6d6d408af32b6ce6ef2529e65d7543d8d41082e3 | /Chapter_9/listing_9_9_static/src/static.cpp | c3d44bb5e1a84005e41d4e3131c2918a3765bd48 | [] | no_license | eugene-bogorodsk/S_Prata_Prime_C-_exercise | 52e52b59e26bfb2f33a344a57c97b69b74ede060 | 1a6dd062e42ac4515df81f23bd425a5a85a05199 | refs/heads/master | 2020-08-28T22:51:08.657340 | 2019-12-19T08:50:58 | 2019-12-19T08:50:58 | 217,844,234 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,323 | cpp | //============================================================================
// Name : static.cpp
// Author : eugene
// Version :
// Copyright : Your copyright notice
// Description :использование статической локальной переменной
//============================================================================
#include <iostream>
// константы
const int ArSize = 10;
//прототип функции
void strcount(const char* str);
int main() {
using namespace std;
char input [ArSize];
char next;
cout<<"Enter a line: \n";
cin.get(input,ArSize);
while(cin)
{
cin.get(next);
while(next != '\n')// строка не помещается
cin.get(next); //избавится от остатка
strcount(input);
cout<<"Enter next line(empty line to quit):\n";
cin.get(input,ArSize);
}
cout<<"Bye.\n";
return 0;
}
void strcount(const char* str)
{
using namespace std;
static int total = 0;//статическая локальня переменная
int count = 0; //автоматическая локальная переменная
cout<<"\""<<str<<"\" contains ";
while(*str++)// переход к концу строки
count++;
total+=count;
cout<<count<<" characters\n";
cout<<total<<" characters total\n";
}
| [
"[email protected]"
] | |
279566363979bbe9f807b61dccbd889e8989f41a | a6303eef855a92a619606b94439143c8c57ef383 | /linux/my_application.cc | 14f1b448fa53779792397b3a10d1f1445c9ac72b | [] | no_license | wdeoliveirawill/bytebank_contacts | c752f01f7caddd84776843efa6780157459b30b8 | 6cdef8b866cebee51e7cabd6d089fca5a2fc2a7d | refs/heads/master | 2023-06-21T01:33:31.155973 | 2021-07-20T23:15:02 | 2021-07-20T23:15:02 | 383,280,254 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,728 | cc | #include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen *screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "bytebank_app");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
}
else {
gtk_window_set_title(window, "bytebank_app");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GObject::dispose.
static void my_application_dispose(GObject *object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
nullptr));
}
| [
"[email protected]"
] | |
9eb74eba3a3a3b19b0286ecb00dc1e9d41f5c25d | 96af0059d1c0ad9a263b94a4632f5b9a118552fb | /include/load_balancing/monitors/Monitor.h | b8f89fb5e1a3ba10a619e8984b5b8b3ecadff781 | [] | no_license | dfunke/ParDeTria | 8c6c6094d4e8928b201bcdb451ef3fdd36edce52 | 917a218b533507d986b7e9485ceabc678539fb98 | refs/heads/master | 2023-08-10T16:02:47.313099 | 2023-08-07T16:14:38 | 2023-08-07T16:14:38 | 675,742,106 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,296 | h | #pragma once
#include <chrono>
#include "load_balancing/PartitionTree.h"
#include "load_balancing/Partitioner.h"
namespace LoadBalancing
{
struct Monitor
{
void registerPartitionStart() {}
void registerPartitionEnd() {}
template <uint D, typename Precision, typename MonitorT>
void registerPartition(const PartitionTree<D, Precision>& /*tree*/,
const Partitioner<D, Precision, MonitorT>& /*partitioner*/) {}
void registerSampleTriangulation(size_t /*numPoints*/, const std::string& /*provenance*/) {}
template <uint D, typename Precision>
void registerSampling(const Sampling<D, Precision>& /*sampling*/,
const std::string& /*provenance*/) {}
template <uint D, typename Precision>
void registerPartialTriangulation
(const std::vector<dSimplices<D, Precision>>& /*partialTriangulations*/,
const dSimplices<D, Precision>& /*borderTriangulation*/,
const dPoints<D, Precision>& /*points*/,
const std::string& /*provenance*/) {}
void registerTriangulationStart() {}
void registerTriangulationEnd() {}
void registerBaseTriangulation(size_t /*numPoints*/, const std::string& /*provenance*/) {}
};
}
| [
"[email protected]"
] | |
394a78bc75be40ababf317f7de183d7d94ac106a | 8a771181f68eded4be449b2e387add345f8d9716 | /DM2122 Prac/Source/GhostScene.h | 7d69a73304b7445791f32c6211bcbfebd0f75c4d | [] | no_license | HenIsTheMan/SP2 | f5480c3d179a89126b1dd49173b488f33a8b5776 | 3407d31ebcfa434abaf42639c394b5953f3f8841 | refs/heads/master | 2023-06-01T01:46:38.721085 | 2021-06-17T13:59:58 | 2021-06-17T13:59:58 | 275,838,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,851 | h | #pragma once
#include <MatrixStack.h>
#include "Scene.h"
#include "Mesh.h"
#include "Light.h"
#include "ParticleSystem.h"
#include "ScoreSystem.h"
#include "Object.h"
#include "Vehicle.h"
class GhostScene final: public Scene{
enum class MESH {
HITBOXWHITE, HITBOXRED, BULLET, LEFT, RIGHT, FRONT, BACK, TOP, BOTTOM, LIGHT_SPHERE,
UFO_BASE, UFO_PURPLE, UFO_RED, UFO_BLUE, UFO_PINK, GY_CAR, EH_CAR, LF_CAR, YW_CAR, PLATFORM,
ROBOT_BODY, ROBOT_ARM, ROBOT_FOREARM, ROBOT_UPPERLEG, ROBOT_LOWERLEG,
SMOKE, ARM, FOREARM, UPPER_LEG, LOWER_LEG, BODY, SPRITE1, STAGE, STAND, SPEAKER, TEXTBOX, NUM_GEOMETRY
};
enum OBJECT_INSTANCES{
PLATFORM1,
PLATFORM2,
PLATFORM3,
PLATFORM4,
PLATFORM5,
PLATFORM6,
PLATFORM7,
PLATFORM8,
PLATFORM9,
UFO_BASE1,
UFO_PURPLE1,
UFO_RED1,
UFO_BLUE1,
UFO_PINK1,
GY_CAR1,
EH_CAR1,
LF_CAR1,
YW_CAR1,
ROBOT_BODY1,
ROBOT_ARM1,
ROBOT_ARM2,
ROBOT_FOREARM1,
ROBOT_FOREARM2,
ROBOT_UPPERLEG1,
ROBOT_UPPERLEG2,
ROBOT_LOWERLEG1,
ROBOT_LOWERLEG2,
ROBOT_BODY2,
ROBOT_ARM3,
ROBOT_ARM4,
ROBOT_FOREARM3,
ROBOT_FOREARM4,
ROBOT_UPPERLEG3,
ROBOT_UPPERLEG4,
ROBOT_LOWERLEG3,
ROBOT_LOWERLEG4,
ROBOT_BODY3,
ROBOT_ARM5,
ROBOT_ARM6,
ROBOT_FOREARM5,
ROBOT_FOREARM6,
ROBOT_UPPERLEG5,
ROBOT_UPPERLEG6,
ROBOT_LOWERLEG5,
ROBOT_LOWERLEG6,
STAGE1,
STAND1,
SPEAKER1,
SPEAKER2,
NUM_INSTANCES,
};
bool animateDir, replay, showDebugInfo, showLightSphere, state, inRange[NUM_INSTANCES], interacted[NUM_INSTANCES];
double cullBounceTime, debugBounceTime, interactBounceTime, lightBounceTime, polyBounceTime, replayTime, replayBounceTime, smokeBounceTime, swingBounceTime, timePressed;
double CalcFrameRate() const;
float pAngleXZ, pAngle, mainCharAngle, leftUpperAngle, leftLowerAngle, rightUpperAngle, rightLowerAngle, leftArmAngle, leftForearmAngle, rightArmAngle, rightForearmAngle;
int Ani1, Switch, indexUpDown, indexLeftRight, indexJump;
Object object[NUM_INSTANCES];
Light light[7]{
Light('d', 0.f, 192.f, 0.f, 1.f, 1.f, 1.f, Vector3(0, 1, 0)), //ceilling light
Light('s', 13.f, 6.f, -8.f, 1.f, 1.f, 0.f, Vector3(0, 0, 1)), //eh car
Light('s', 7.f, 6.f, -8.f, 1.f, 1.f, 0.f, Vector3(0, 0, 1)),//eh car
Light('s', -48.f, 6.f, 72.f, 1.f, 0.6f, 0.f, Vector3(1, 0, 0)), //lf car
Light('s', -48.f, 6.f, 68.f, 1.f, 0.6f, 0.f, Vector3(1, 0, 0)), //lf car
Light('s', -84.f, 6.f, -11.f, 1.f, 0.f, 0.f, Vector3(0, 0, 1)), //yw car
Light('s', -76.f, 6.f, -11.f, 1.f, 0.f, 0.f, Vector3(0, 0, 1)), //yw car
};
Mesh* meshList[static_cast<unsigned int>(MESH::NUM_GEOMETRY)];
MS modelStack, viewStack, projectionStack;
ParticleEmitter smokeGenerator;
unsigned m_vertexArrayID;
void InitMeshes(), CreateInstances(), RenderLight(), RenderMeshOnScreen(Mesh*, float, float, float, float, int, int);
void InitLight() const, RenderMesh(Mesh*, bool, GLfloat = 1.f) const;
void RenderAnimation(Mesh*, int) const, RenderText(Mesh*, std::string, Color) const;
void createPlatforms(), createUFOs(), createRobot1(), createVehicles(), createRobot2(), createRobot3(), createStage(), createSpeaker();
void UpdateMainChar(double, const unsigned char*), UpdateMainTranslateXZ(double, const unsigned char*);
void UpdateMainRotateY(double, const unsigned char*), UpdateMainTranslateY(double, const unsigned char*);
void RenderMainChar(), RenderAnimationOnScreen(Mesh*, int, float, float, float, int, int), RenderSkybox(bool);
void RenderTextOnScreen(Mesh*, std::string, Color, float, float, float, int, int), renderObject(Object* obj);
void animateNpc(int instance), carCheck(int instance, const char* audioFileName), npcCheck(int instance, const char* audioFileName);
public:
~GhostScene() override{}
void Init() override, Update(double, float, const unsigned char* = 0) override, Render(double, int, int) override, Exit(Scene*) override;
}; | [
"[email protected]"
] | |
37d31a9dff5f64c0cc75eb1c0d4c78ae46e9ef41 | 53f0935ea44e900e00dc86d66f5181c5514d9b8e | /practice/sieve_of_eratosthenes.cpp | 829a53afbb064d9a5a3d5965621daf6b50861b17 | [] | no_license | losvald/algo | 3dad94842ad5eb4c7aa7295e69a9e727a27177f6 | 26ccb862c4808f0d5970cee4ab461d1bd4cecac6 | refs/heads/master | 2016-09-06T09:05:57.985891 | 2015-11-05T05:13:19 | 2015-11-05T05:13:19 | 26,628,114 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 722 | cpp | #include <cstdio>
#include <ctime>
#define MAX (long long)1E7/2
long long int prime[MAX];
int main() {
double start = clock();
for(long long int i = 2; i*i <= MAX; i++) {
if(prime[i]) continue;
for(long long int j = i; j*i < MAX; j++)
prime[i*j] = 1;
}
//for(int i = 1; i < MAX; i++) if(!prime[i]) printf("%d ", i);
printf("%lf ms\t Interval od 1 do %lld\n", clock()-start, MAX);
for(;;) {
long long int a;
scanf("%lld", &a);
if(!a) break;
if(!prime[a]) printf("\n%d je prost broj.", a);
else printf("\n%d nije prost broj.", a);
}
printf("Gotovo!");
return 0;
}
| [
"[email protected]"
] | |
ddbe5e5e38b281234ad25697109ae3f2e750a383 | adc6d4ae00ea137c0e9d97299482033602f9dd85 | /Cv11_Obalovacia_trieda/Pole.h | 54bc1569d345bf030720f5ee94a59854bf7d9117 | [] | no_license | pego149/inf3 | 5b8303c68434b5dca4831765463afb8aa39b6c02 | 4f12f9dcc25aabbcd94805f22e735c33c691285f | refs/heads/master | 2020-03-31T06:05:31.262689 | 2018-12-10T09:19:52 | 2018-12-10T09:19:52 | 151,967,895 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,652 | h | #pragma once
#include <iostream>
#include "VynimkaIndex.h"
using namespace std;
template <class T>
class Pole
{
unsigned int aRozsah;
int aDolnyIndex;
T *aData;
void copy(const Pole *zdroj);
void zmaz();
public:
Pole(int pDolnyIndex, unsigned int pRozsah, T initval);
Pole(const Pole &zdroj) { copy(zdroj); }
Pole &operator =(const Pole &zdroj)
{
if (&zdroj)
{
zmaz();
copy(zdroj);
}
return *this;
}
T &operator [](int index);
void vypis();
~Pole();
};
template<class T>
inline void Pole<T>::copy(const Pole * zdroj)
{
aRozsah = zdroj->aRozsah;
aDolnyIndex = zdroj->aDolnyIndex;
aData = nullptr;
if (aRozsah != 0)
{
aData = new T[aRozsah];
for (int i = 0; i < aRozsah; i++)
{
aData[i] = zdroj->aData[i];
}
}
}
template<class T>
inline void Pole<T>::zmaz()
{
if (aData)
{
delete[] aData;
}
aData = nullptr;
aRozsah = 0;
}
template <class T>
Pole<T>::Pole(int pDolnyIndex, unsigned int pRozsah, T initval)
:aRozsah(pRozsah), aDolnyIndex(pDolnyIndex), aData(aRozsah != 0 ? new T[aRozsah] : nullptr)
{
for (int i = 0; i < aRozsah; i++)
{
aData[i] = initval;
}
}
template<class T>
inline T & Pole<T>::operator[](int index)
{
if (!aData)
{
throw VynimkaIndex("Pole neexistuje", -1);
}
if (index<aDolnyIndex)
{
throw VynimkaDolnyIndex(aDolnyIndex);
}
int hornyRozsah = aDolnyIndex + aRozsah - 1;
if (index > hornyRozsah)
{
throw VynimkaHornyIndex(hornyRozsah);
}
return aData[index - aDolnyIndex];
}
template<class T>
inline void Pole<T>::vypis()
{
for (int i = 0; i < aRozsah; i++)
{
cout << aData[i] << endl;
}
cout << endl;
}
template <class T>
Pole<T>::~Pole()
{
}
| [
"cani3@RB052-11"
] | cani3@RB052-11 |
87b78b4f57aa0bd0c1bb80698ac0da729720ba0e | eccf86a1eea9d8d38e2b3ca2b46bc87234549ff5 | /include/mu_test.h | 5fb33934c91977c04d6a5ac8bc6d1fe4dbf92b29 | [] | no_license | Rom4ikKot/SmartHome | d8d41278ef5d756328bf08c96217a9d118bd6551 | fc0951cb577afccabbfa302503d02be718fc0902 | refs/heads/master | 2022-05-30T03:26:37.675223 | 2020-05-06T05:09:38 | 2020-05-06T05:09:38 | 261,653,111 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,775 | h | #ifndef MU_TEST_H_
#define MU_TEST_H_
/**
* mu_test.h
* Header only Minimal Unit Test Framework
* a tiny unit test framework for simple tests.
* Version: 0.42tau
* Author: Muhammad Zahalqa
* [email protected] (c)2019
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/**
* Caveat Lector: Readers of this code shall not be disallowed from not failing
* to be unable to not partly misunderstand this!!!
*/
#define MT__MU_VERSION (0.42)
#define MT_WITH []={
typedef const char* MT_SYMBOL;
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
static MT_SYMBOL MT__ABCDEF MT_WITH
" ║Out beyond ideas of wrongdoingC++██████╗ █████╗ ███████╗███████╗ ",
" ║and rightdoing there is a field.C# ███████╗ █████╗ ██╗ ██╗ ",
" ║I'll meet you there.Scheme██╔══██╗██╔══██╗██╔════╝██╔════╝ ",
" ║When the soul lies down in that grassJava ██╔════╝ ██╔══██╗ ██║ ██║ ",
" ║the world is too full to talk about.Scala██████╔╝███████║███████╗███████╗ ",
" ║ ― Jalal Ad-Din RumiScheme █████╗ ███████║ ██║ ██║ ",
" ║██████████████████████████████████████████Fortran██╔═══╝ ██╔══██║╚════██║╚════██║ ",
" ║Look on my Works, ye Mighty, and despair!Pascal ██╔══╝ ██╔══██║ ██║ ██║ ",
" ║Nothing beside remains. Round the decayKotlin██║ ██║ ██║███████║███████║ ",
" ║Of that colossal Wreck, boundless and bareGO ██║ ██║ ██║ ██║ ███████╗ ",
" ║The lone and level sands stretch far away.Basic?╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ",
" ╚══════════════════════════════════════════Rust ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ",
" Every line of code is written without reasonPython",
" maintained out of weakness, and deleted by chance.",
" Jean-Paul Sartre’s Programming in ANSI C "};
#define KNRM 0
#define KRED 31
#define KGRN 32
#define KYEL 33
#define KBLU 34
#define KMAG 35
#define KCYN 36
#define KWHT 37
#define KBRED 91
#define KBGRN 92
#define KBYEL 93
#define KBBLU 94
#define KBMAG 95
#define KBCYN 96
#define KULN 4
enum MT_Cats{MT__V_MARK,MT__X_MARK,MT__GRIN_FACE,MT__ANGUISH,MT__GRIMACE,MT__LOUD_CRY,MT__SCREAM,MT__CAT_GRIN,MT__CAT_GRIN_SMILE,MT__CAT_JOY,MT__CAT_POUTING,MT__CAT_SAD,
MT__CAT_WAERY,MT__STOP_WATCH,MT__TIMER_CLOCK,MT__HOUR_GLASS,MT__CLOCK_FACE_2_OCLOCK,MT__THUMBS_UP,MT__THUMBS_DOWN,MT__PASS_EMJ=MT__GRIN_FACE,MT_FAIL_ICN=MT__X_MARK,MT_PASS_ICN=MT__V_MARK};MT_SYMBOL Catz MT_WITH
"\xE2\x9C\x94","\xE2\x9C\x98","\xF0\x9F\x98\x80","\xF0\x9F\x98\xA7","\xF0\x9F\x98\xAC","\xF0\x9F\x98\xAD","\xF0\x9F\x98\xB1",
"\xF0\x9F\x98\xBA","\xF0\x9F\x98\xB8","\xF0\x9F\x98\xB9","\xF0\x9F\x98\xBE","\xF0\x9F\x98\xBF","\xF0\x9F\x99\x80","\xE2\x8F\xB1","\xE2\x8F\xB2","\xE2\x8F\xB3","\xF0\x9F\x95\x91","\xF0\x9F\x91\x8D","\xF0\x9F\x91\x8E"};
#define __MERGE_(a, b) a##b
#define __LABEL_(x, a) __MERGE_(x, a)
#define __UNIQUE_NAME_(x) __LABEL_(x, __LINE__)
#define MT_CAT(x,y,z) x y z
#define MT_ANSIESC(x) MT_CAT("\x1B[", #x, "m")
#define MT_CLR(c) MT_ANSIESC(c)
#define MT_FAIL (1)
#define MT_PASS (0)
#define MT__GIVE __MERGE_(re,turn)
#define M__P fprintf(
#define M__VP vfprintf(
#define M__FP M__P stdout,
#define M__VFP M__VP stdout,
#define MT__COLOR(f) (!f?MT_CLR(KGRN):MT_CLR(KRED))
#define ____b(l) M__FP MT_CLR(KYEL) "\n ╔" l "╗" MT_CLR(KNRM) )
#define ____c(l) M__FP MT_CLR(KYEL) "\n ╚" l "╝" MT_CLR(KNRM) )
#define ____x(l) M__FP MT_CLR(KYEL) "\n ║ " l MT_CLR(KYEL) " ║" MT_CLR(KNRM))
#define ____z(l) M__FP MT_CLR(KYEL) "\n ║ " l
#define ____z0(l) M__FP MT_CLR(KYEL) "\n ║%s%s" MT_CLR(KYEL) "║" MT_CLR(KCYN) l MT_CLR(KYEL) " ║" MT_CLR(KNRM)
#define ____nl() M__FP "\n" MT_CLR(KNRM) )
#define MT_NTV(x) ((x)/((x)>1e6?1e6:(x)>1e3?1e3:1e0))
#define MT_NTS(x) ((x)>1e6?" s":(x)>1e3?"ms":"μs")
static MT_SYMBOL mt__current_test_name;double mt__total_time;int mt__trace_on,mt__current_test_was_traced;struct mt__AssertResult{int youShalN0tPass;int where;MT_SYMBOL message;MT_SYMBOL actual_expected;};
typedef struct MT__TestRec0rd{struct mt__AssertResult (*whatMayFail)(void);MT_SYMBOL whatName;int shouldaCoulda;} MT__TestRec0rd;
#define UNIT_IMPL(name) static struct mt__AssertResult name(void){struct mt__AssertResult (*___unsed)(void) = name;struct mt__AssertResult __ok = {MT_PASS, 0, 0, 0};mt__current_test_name=#name; mt__current_test_was_traced=0;if(___unsed){
#define XUNIT(name) static int __UNIQUE_NAME_(name)(void){static const char* __testName = #name;
#define END_UNIT_IMPL }MT__GIVE __ok;}
#define TEST_SUITE_IMPL(name) int main(int argc, const char**argv){MT_SYMBOL __test_name = #name;MT_SYMBOL*a___z = &MT__ABCDEF[0];MT__TestRec0rd mt_testRec0rds MT_WITH
#define TEST_IMPL(unit) {unit, #unit, 0},
#define IGNORE_TEST_IMPL(unit) {unit, MT_CLR(KYEL) #unit, 1},
#define XIGNORE_TEST(unit) {unit, 0, 1},
#define XTEST(unit) {unit, 0, 1},
#define END_SUITE_IMPL {NULL, NULL, 0}};long mt__passedAway=0;MT__TestRec0rd *mt__pUtRec = mt_testRec0rds;long mt__totalUtRec = 0;MT_SYMBOL mt__k001Ik0n = 0;long mt__failfails = 0, __ignored = 0;if(argc > 1)mt__trace_on = !strcmp(argv[1], "-v");\
____b("═════════════════════════════════════"); \
____x("•• inf ••" MT_CLR(KRED) "•" MT_CLR(KCYN) " ▌ ▄ " MT_CLR(KRED) "·." MT_CLR(KCYN) " ▄" MT_CLR(KRED) "•" MT_CLR(KCYN) " ▄▌▄▄▄▄▄▄▄▄ " MT_CLR(KRED) ".." MT_CLR(KCYN) "▄▄ " MT_CLR(KRED) "·" MT_CLR(KCYN) " ▄▄▄▄▄"); \
____x("•• 1 ⌠ 1 s dx••" MT_CLR(KRED) "·" MT_CLR(KCYN) "██ ▐███" MT_CLR(KRED) "▪" MT_CLR(KCYN) "█" MT_CLR(KRED) "▪" MT_CLR(KCYN) "██▌" MT_CLR(KRED)"•" MT_CLR(KCYN) "██ ▀▄" MT_CLR(KRED)"." MT_CLR(KCYN) "▀" MT_CLR(KRED)"·" MT_CLR(KCYN) "▐█ ▀" MT_CLR(KRED)". •" MT_CLR(KCYN) "██ "); \
____x("••ζ(s)= ──── ⎮────── x ⋅ ──••" MT_CLR(KCYN) "▐█ ▌▐▌▐█" MT_CLR(KRED)"·" MT_CLR(KCYN) "█▌▐█▌ ▐█" MT_CLR(KRED)".▪" MT_CLR(KCYN) "▐▀▀▪▄▄▀▀▀█▄ ▐█" MT_CLR(KRED)".▪"); \
____x("•• Γ(s) ⎮ x 2••" MT_CLR(KCYN) "\xE2\x96\x88\xE2\x96\x88\x20\xE2\x96\x88\xE2\x96\x88\xE2\x96\x8C\xE2\x96\x90\xE2\x96\x88\xE2\x96\x8C\xE2\x96\x90\xE2\x96\x88\xE2\x96\x84\xE2\x96\x88\xE2\x96\x8C\x20\xE2\x96\x90\xE2\x96\x88\xE2\x96\x8C" MT_CLR(KRED)"·" MT_CLR(KCYN) "▐█▄▄▌▐█▄" MT_CLR(KRED)"▪" MT_CLR(KCYN) "▐█ ▐█▌" MT_CLR(KRED)"·"); \
____x("•• ⌡ e - 1 x ••" MT_CLR(KCYN) "▀▀ █" MT_CLR(KRED)"▪" MT_CLR(KCYN) "\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20\x20\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20\x20\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20\x20\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20\x20\xE2\x96\x80\xE2\x96\x80\xE2\x96\x80\x20"); \
____z("•• 0 ••" MT_CLR(KBGRN) "%*.*s \x20\x20\xC2\xA9\xce\xbc\x5f\x74\x65\x73\x74%*.*f" MT_CLR(KYEL) " ║"), -20,19, "\x6D\x40\x74\x72\x79\x66\x69\x6E\x61\x6C\x6C\x79\x2E\x63\x6F\x6D", 5,2, MT__MU_VERSION); \
if(mt__trace_on) ____x("\x20\x20\x20\x20\x20\x20\x20\x20\x1B\x5B\x39\x33\x6D\x62\x75\x69\x6C\x74\x20\x62\x79\x3A\x20\x20\x1B\x5B\x39\x32\x6D\x4D\x75\x68\x61\x6D\x6D\x61\x64\x20\x5A\x61\x68\x61\x6C\x71\x61");\
____c("═════════════════════════════════════"); \
mt__fprintInBox(stdout, __test_name, 37);while(mt__pUtRec->whatMayFail){ \
if(!mt__pUtRec->whatName){++mt__pUtRec; continue;}\
++mt__totalUtRec;\
if(mt__pUtRec->shouldaCoulda){M__FP MT_CLR(KBYEL) "\t%s" MT_CLR(KBBLU) " %s" MT_CLR(KNRM), mt__trace_on ? "Skipping test :" : "SKIP -", mt__pUtRec->whatName);++__ignored;}else{ \
clock_t __begin = clock();\
struct mt__AssertResult __r = mt__pUtRec->whatMayFail(); \
clock_t __end = clock();\
double __time_spent = (double)(__end - __begin);\
mt__total_time += __time_spent;\
M__FP "%s" MT_CLR(KNRM), __r.youShalN0tPass == MT_PASS ? MT_CLR(KBGRN) "\tPASS -":MT_CLR(KBRED) "\tFAIL -");\
if(mt__trace_on)M__FP "[%5.0f%s]", MT_NTV(__time_spent), MT_NTS(__time_spent)); \
M__FP MT_CLR(KBBLU) " %s" MT_CLR(KNRM), mt__pUtRec->whatName); \
if( __r.youShalN0tPass != MT_PASS){++mt__failfails; \
M__FP MT_CLR(KCYN) "\n\t\t\tFailed at line:" MT_CLR(KRED)" %d\n" MT_CLR(KNRM), __r.where);\
M__FP MT_CLR(KYEL) "\t\t\t%s\n" MT_CLR(KNRM), __r.message); \
if(__r.actual_expected)M__FP "\t\t\t%s\n" MT_CLR(KNRM), __r.actual_expected); \
free((void*)__r.actual_expected);}else{++mt__passedAway;}}M__FP "\n"); fflush(stdout);++mt__pUtRec;}\
if(mt__failfails>0)++a___z;mt__k001Ik0n=mt__failfails>mt__totalUtRec/2?Catz[MT__SCREAM]:mt__failfails>mt__totalUtRec/3?Catz[MT__LOUD_CRY]:mt__failfails>mt__totalUtRec/4?Catz[MT__GRIMACE]:mt__failfails==0?Catz[MT__PASS_EMJ]:Catz[MT__ANGUISH]; \
____b("══════════════════════════════════╦════════════════"); \
____z0(" Total:" MT_CLR(KBMAG) "%4ld %s"), MT__COLOR(mt__failfails), *(a___z--,++a___z), mt__totalUtRec,mt__k001Ik0n); \
____z0(" Passed:" MT_CLR(KBGRN) "%4ld %s "), MT__COLOR(mt__failfails), *(a___z++,++a___z), mt__passedAway, Catz[MT_PASS_ICN]); \
____z0(" Failed:" MT_CLR(KBRED) "%4ld %s "), MT__COLOR(mt__failfails), *(a___z++,++a___z), mt__failfails, Catz[MT_FAIL_ICN]); \
____z0("Skipped:" MT_CLR(KBCYN) "%4ld " ), MT__COLOR(mt__failfails), *(a___z++,++a___z), __ignored); \
____z0("Total:" MT_CLR(KBCYN) "%6.0f %s" ), MT__COLOR(mt__failfails), *(a___z++,++a___z), MT_NTV(mt__total_time),MT_NTS(mt__total_time)); \
____z0(" %*.*s%*c" ), MT__COLOR(mt__failfails), *(a___z++,++a___z), 10,10,mt__totalUtRec>10?Catz[MT__CAT_JOY]:mt__totalUtRec>=7?Catz[MT__CAT_GRIN]:mt__totalUtRec>=5?Catz[MT__CAT_POUTING]:Catz[MT__CAT_SAD],6,' '); \
____c("══════════════════════════════════╩════════════════");____nl();MT__GIVE (int)mt__failfails;}
#define mt__STATEMENTS(s) do {s;} while((void)0, 0)
#define MT_BLOCK(b) do {b} while((void)0,0)
#define mt__fprintCharN(fp, s, repeat) MT_BLOCK({int n = repeat;while(n--) fprintf(fp, "%s", s);})
#define mtt__fprintInBox(fp, s, minWidth) mt__STATEMENTS({int ml=0, mr=0,mw=minWidth,len = (int)strlen(s);if(len+1 < mw){mr=ml=(mw-len)/2; mr += (mw-len) % 2;}else{mw=len+2;}M__P fp, "\n");M__P fp\
,MT_CLR(KYEL) " ╔");mt__fprintCharN(fp, "═", mw);M__P fp, MT_CLR(KYEL) "╗\n");M__P fp, MT_CLR(KYEL) " ║" MT_CLR(KCYN) "%*s%s%*s" MT_CLR(KYEL) "║\n", mr, " ", s, ml, " ");M__P fp, MT_CLR(KYEL) " ╚");mt__fprintCharN(fp, "═", mw);M__P fp, MT_CLR(KYEL) "╝\n");})
#define mt__fprintInBox(fp, s, minWidth) do{int ml=0, mr=0,mw=minWidth,len = (int)strlen(s);if(len+1 < mw){mr=ml=(mw-len)/2; mr += (mw-len)\
%2;}else{mw=len+2;}M__P fp, "\n");M__P fp, MT_CLR(KYEL) " ╔");mt__fprintCharN(fp, "═", mw);M__P fp, MT_CLR(KYEL) "╗\n");M__P fp, MT_CLR(KYEL) " ║" MT_CLR(KCYN) "%*s%s%*s" MT_CLR(KYEL) "║\n", mr," ", s, ml," ");\
M__P fp, MT_CLR(KYEL) " ╚");mt__fprintCharN(fp, "═", mw);M__P fp, MT_CLR(KYEL) "╝\n");}while((void)0,0)
#define mt__EXPECTED MT_CLR(KCYN) "expected: " MT_CLR(KGRN)
#define mt__ACTUALL MT_CLR(KCYN) "actual : " MT_CLR(KRED)
static char* mt__EXPECTED_i(long a,long e,MT_SYMBOL xx,MT_SYMBOL zz){char* p = (char*) malloc(1024);if(p) sprintf(p,mt__ACTUALL "%ld\n\t\t\t" mt__EXPECTED "%ld",a,e);(void)xx;(void)zz;MT__GIVE p;}
static char* mt__EXPECTED_s(MT_SYMBOL a, MT_SYMBOL e,MT_SYMBOL xx,MT_SYMBOL zz){char*p;if(!a)return 0;p=(char*) malloc(1024);if(p)sprintf(p,mt__ACTUALL "'%s'\n\t\t\t" mt__EXPECTED "'%s'",a,e);(void)xx;(void)zz;MT__GIVE p;}
static char* mt__EXPECTED_p(const volatile void*volatile const a,const volatile void*volatile const e,MT_SYMBOL xx,MT_SYMBOL zz){char* p = (char*) malloc(1024);if(p) sprintf(p,mt__ACTUALL "%p\n\t\t\t" mt__EXPECTED "%p",a,e);(void)xx;(void)zz;MT__GIVE p;}
static void mt__trace_logw(int nl,MT_SYMBOL fmt,va_list arg){if(!mt__trace_on)return;if(!mt__current_test_was_traced){mt__current_test_was_traced=1;M__FP MT_CLR(KBCYN) "\tTracing - " MT_CLR(KBBLU) "%s\n", mt__current_test_name);}M__FP MT_CLR(KNRM));M__VFP fmt,arg);M__FP MT_CLR(KNRM));M__FP nl?"\n":"");fflush(stdout);}
static void mt__trace_log(MT_SYMBOL fmt,...){va_list arg;va_start(arg, fmt);mt__trace_logw(1,fmt,arg);va_end (arg);}static void mt__trace_loga(MT_SYMBOL fmt, ...){va_list arg;va_start(arg, fmt);mt__trace_logw(0,fmt,arg);va_end (arg);}void(*mt__fancy_pointers[])()={(void(*)())mt__trace_log,(void(*)())mt__trace_loga,(void(*)())mt__trace_logw, (void(*)())mt__EXPECTED_s, (void(*)())mt__EXPECTED_i, (void(*)())mt__EXPECTED_p};
#ifdef __cplusplus
#include <sstream>
template<typename A,typename B>inline const char*mt_cxx_Expected(A const&a,B const&e){std::stringstream ss;ss<<mt__ACTUALL<<a<<"\n\t\t\t"<<mt__EXPECTED<<e;char*p=(char*)malloc(1+ss.tellp());strcpy(p,ss.str().c_str());MT__GIVE p;}
#define ASSERT_NOT_EQUAL_CXX_IMPL(a,e) mt__STATEMENTS({mt__ASSERT(a!=e,__LINE__, "ASSERT_EQUAL(" #a ", " #e ")", mt_cxx_Expected(a,e)); })
#define ASSERT_EQUAL_CXX_IMPL(a,e) mt__STATEMENTS({mt__ASSERT(a==e,__LINE__, "ASSERT_EQUAL(" #a ", " #e ")", mt_cxx_Expected(a,e)); })
class MT_Tracer {
public:
template<typename T>
MT_Tracer& trace(T const& o){
if(!mt__trace_on){return *this;}if(!mt__current_test_was_traced){mt__current_test_was_traced=1;M__FP MT_CLR(KBCYN) "\tTracing - " MT_CLR(KBBLU) "%s\n", mt__current_test_name);}
std::cout << MT_CLR(KNRM) << o << MT_CLR(KNRM);
return *this;
}
};
template<typename T>
MT_Tracer& operator<<(MT_Tracer& tm, const T& obj){
return tm.trace(obj);
}
MT_Tracer TRACER;
#endif
#define mt__ASSERT(cond,where,msg,expected) do if(!(cond)){struct mt__AssertResult __r={MT_FAIL,where,msg,0};__r.actual_expected=expected;MT__GIVE __r;}while((void)0,0)
#define mt__ASSERT_INT(a,op,e,n) mt__STATEMENTS({long _a=(long)(a);long _e=(long)(e);mt__ASSERT(_a op _e,__LINE__,n "(" #a ", " #e ")",mt__EXPECTED_i(_a,_e,#e,#a));})
#define mt__ASSERT_STR(a,op,e,n) mt__STATEMENTS({const char* _a=(const char*)(a);const char* _e=(const char*)(e);mt__ASSERT(strcmp(_a,_e) op 0,__LINE__,n "(" #a ", " #e ")",mt__EXPECTED_s(_a,_e,#e,#a));})
#define mt__ASSERT_PTR(a,op,e,n) mt__STATEMENTS({const void* _a=(const void*)(a);const void* _e=(const void*)(e);mt__ASSERT(_a op _e,__LINE__,n "(" #a ", " #e ")",mt__EXPECTED_p(_a,_e,#e,#a));})
#define TRACE_LOG_IMPL mt__trace_log
#define TRACE_APPEND_IMPL mt__trace_loga
#define ASSERT_EQUAL_INT_IMPL(a,e) mt__ASSERT_INT(a,==,e,"ASSERT(_EQUAL_)::INT")
#define ASSERT_NOT_EQUAL_INT_IMPL(a,e) mt__ASSERT_INT(a,!=,e,"ASSERT(_NOT_EQUAL_)::INT")
#define ASSERT_EQUAL_STR_IMPL(a,e) mt__ASSERT_STR(a,==,e,"ASSERT(_EQUAL_)::STR")
#define ASSERT_NOT_EQUAL_STR_IMPL(a,e) mt__ASSERT_STR(a,!=,e,"ASSERT(_NOT_EQUAL_)::STR")
#define ASSERT_EQUAL_PTR_IMPL(a,e) mt__ASSERT_PTR(a,==,e,"ASSERT(_EQUAL_)::PTR")
#define ASSERT_NOT_EQUAL_PTR_IMPL(a,e) mt__ASSERT_PTR(a,!=,e,"ASSERT(_NOT_EQUAL_)::PTR")
#define ASSERT_THAT_IMPL(e) mt__STATEMENTS({int _e = !!(e); mt__ASSERT((_e),__LINE__,"ASSERT_THAT(" #e ")", mt__EXPECTED_s(0,0,0,0)); })
/* Readers shall not be disallowed from not failing to be unable to not partly misunderstand this */
#define MU_TEST_PUBLIC
#define UNIT(name) UNIT_IMPL(name)
#define END_UNIT END_UNIT_IMPL
#define TEST_SUITE(name) TEST_SUITE_IMPL(name)
#define TEST(unit) TEST_IMPL(unit)
#define IGNORE_TEST(unit) IGNORE_TEST_IMPL(unit)
#define END_SUITE END_SUITE_IMPL
#define TRACE_LOG TRACE_LOG_IMPL
#define TRACE_APPEND TRACE_APPEND_IMPL
#define ASSERT_EQUAL_INT(actual, expected) ASSERT_EQUAL_INT_IMPL(actual,expected)
#define ASSERT_NOT_EQUAL_INT(actual, expected) ASSERT_NOT_EQUAL_INT_IMPL(actual,expected)
#define ASSERT_EQUAL_STR(actual, expected) ASSERT_EQUAL_STR_IMPL(actual,expected)
#define ASSERT_NOT_EQUAL_STR(actual, expected) ASSERT_NOT_EQUAL_STR_IMPL(actual,expected)
#define ASSERT_EQUAL_PTR(actual, expected) ASSERT_EQUAL_PTR_IMPL(actual,expected)
#define ASSERT_NOT_EQUAL_PTR(actual, expected) ASSERT_NOT_EQUAL_PTR_IMPL(actual,expected)
#define ASSERT_THAT(expression) ASSERT_THAT_IMPL(expression)
#ifdef __cplusplus
#define ASSERT_EQUAL(actual, expected) ASSERT_EQUAL_CXX_IMPL(actual, expected)
#define ASSERT_NOT_EQUAL(actual, expected) ASSERT_NOT_EQUAL_CXX_IMPL(actual, expected)
#endif
#endif /* MU_TEST_H_ */
| [
"[email protected]"
] | |
a12f4da194c686cb4e20ed0da2e22a8f76e2287b | 2ef809e1f0af431c7a311eb79b45c674bd055b64 | /src/Materials.cpp | 95dcd9ddfd8a7764693f213f4fc03db258a21c0d | [] | no_license | nurgan/pbcb | 9f8ec24e79e314651b0fd79d5319a640e74b27ce | 404149701ec1b21278fb7d050cf205bc05c4f1b4 | refs/heads/master | 2021-01-01T20:06:42.685145 | 2017-07-29T23:42:24 | 2017-07-29T23:42:24 | 98,764,333 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,945 | cpp | #include "Materials.hpp"
#include <iostream>
Materials& Materials::instance() {
static Materials *instance = new Materials();
return *instance;
}
Materials::Materials() {
// Populate the `materials` map
std::shared_ptr<material_t> mat;
std::pair<std::string, std::shared_ptr<material_t>> material;
// Emerald
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.0215f, 0.1745f, 0.0215f);
mat->diffuse = glm::vec3(0.07568f, 0.61424f, 0.07568f);
mat->specular = glm::vec3(0.633f, 0.727811f, 0.633f);
mat->shine = 76.8f;
material = std::make_pair("emerald", mat);
materials.insert(material);
// Shiny Blue Plastic
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.02f, 0.04f, 0.2f);
mat->diffuse = glm::vec3(0.0f, 0.16f, 0.9f);
mat->specular = glm::vec3(0.14f, 0.2f, 0.8f);
mat->shine = 120.0f;
material = std::make_pair("blue plastic", mat);
materials.insert(material);
// Flat Grey
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.13, 0.13, 0.14);
mat->diffuse = glm::vec3(0.3, 0.3, 0.4);
mat->specular = glm::vec3(0.3, 0.3, 0.4);
mat->shine = 4.0;
material = std::make_pair("matte grey", mat);
materials.insert(material);
// Brass
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.3294, 0.2235, 0.02745);
mat->diffuse = glm::vec3(0.7804, 0.5686, 0.11373);
mat->specular = glm::vec3(0.9922, 0.941176, 0.80784);
mat->shine = 27.9;
material = std::make_pair("brass", mat);
materials.insert(material);
// Copper
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.1913, 0.0735, 0.0225);
mat->diffuse = glm::vec3(0.7038, 0.27048, 0.0828);
mat->specular = glm::vec3(0.257, 0.1376, 0.08601);
mat->shine = 12.8;
material = std::make_pair("copper", mat);
materials.insert(material);
// Ruby
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.1745, 0.01175, 0.01175);
mat->diffuse = glm::vec3(0.61424, 0.04136, 0.04136);
mat->specular = glm::vec3(0.727811, 0.626959, 0.626959);
mat->shine = 76.8;
material = std::make_pair("ruby", mat);
materials.insert(material);
// Obsidian
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.05375, 0.05, 0.06625);
mat->diffuse = glm::vec3(0.18275, 0.17, 0.22525);
mat->specular = glm::vec3(0.332741, 0.328634, 0.346435);
mat->shine = 38.4;
material = std::make_pair("obsidian", mat);
materials.insert(material);
// Cyan Plastic
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.0, 0.3, 0.3);
mat->diffuse = glm::vec3(0.0, 0.50980392, 0.50980392);
mat->specular = glm::vec3(0.50196078, 0.50196078, 0.50196078);
mat->shine = 32.0;
material = std::make_pair("cyan plastic", mat);
materials.insert(material);
// Yellow Plastic
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.3, 0.3, 0.0);
mat->diffuse = glm::vec3(0.5, 0.5, 0.0);
mat->specular = glm::vec3(0.6, 0.6, 0.5);
mat->shine = 32.0;
material = std::make_pair("yellow plastic", mat);
materials.insert(material);
// Red Rubber
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.05, 0.0, 0.0);
mat->diffuse = glm::vec3(0.5, 0.4, 0.4);
mat->specular = glm::vec3(0.7, 0.04, 0.04);
mat->shine = 10.0;
material = std::make_pair("red rubber", mat);
materials.insert(material);
// White Plastic
mat = std::make_shared<material_t>();
mat->ambient = glm::vec3(0.2, 0.3, 0.3);
mat->diffuse = glm::vec3(0.5, 0.5, 0.5);
mat->specular = glm::vec3(0.7, 0.7, 0.7);
mat->shine = 75.0;
material = std::make_pair("white plastic", mat);
materials.insert(material);
}
std::shared_ptr<material_t> Materials::getMaterial(const std::string& mat) {
return materials.at(mat);
}
| [
"[email protected]"
] | |
a4b6025050db61c3d34205f58400e7f78d78aed6 | 29339372c71c6d25e384f12889e6b14ace17ac8f | /PolygonFillDemo/PolygonFillDemo.cpp | 0760132186c6c346d82d8357b7e438172c34ee3d | [] | no_license | FanHuaRan/PolygonFill | 12c6d3d0523f3ab7e4d99e0fba8992765ad8cd69 | dad18015dbf062571f833c860d6941feda20fb61 | refs/heads/master | 2021-01-11T04:13:42.427256 | 2016-10-18T03:00:19 | 2016-10-18T03:00:19 | 71,203,256 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,217 | cpp | // PolygonFillDemo.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "PolygonFillDemo.h"
#include "MainFrm.h"
#include "PolygonFillDemoDoc.h"
#include "PolygonFillDemoView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPolygonFillDemoApp
BEGIN_MESSAGE_MAP(CPolygonFillDemoApp, CWinApp)
//{{AFX_MSG_MAP(CPolygonFillDemoApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPolygonFillDemoApp construction
CPolygonFillDemoApp::CPolygonFillDemoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPolygonFillDemoApp object
CPolygonFillDemoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CPolygonFillDemoApp initialization
BOOL CPolygonFillDemoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPolygonFillDemoDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CPolygonFillDemoView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CPolygonFillDemoApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CPolygonFillDemoApp message handlers
| [
"[email protected]"
] | |
6316a95c37464779f979cd155531e511dad81211 | 03c2b8fe97f7b2cf14e6392288bbff4ec8f973c9 | /Final_Term/Application.cpp | 157172923bd8fc26a7e0c5c08d68c4fdc052e8d1 | [] | no_license | Chuncheonian/DataStructure | c6e69d6a05f6def688b1b8d2e3c308de2902b3af | 63467b6ffe2a8e5b392b50c64fdc83df179bdebb | refs/heads/main | 2023-01-23T19:27:08.304820 | 2020-12-04T11:25:11 | 2020-12-04T11:25:11 | 301,158,430 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 37,879 | cpp | #include "Application.h"
// Program driver.
void Application::Run() {
while (1) {
m_command = GetCommand();
switch (m_command) {
case 1: // Add new record into masterList.
AddContents();
break;
case 2: // Get a createTime from keyboard and delete the rocord with same create Time.
DeleteContents();
break;
case 3: // Get a record from keyboard and Replace the rocord with same record.
ReplaceContents();
break;
case 4: // Get a create time from keyboard and Display a record with input create time.
RetrieveContents();
break;
case 5: // Display all MultimediaContents in the list in screen.
DisplayAllContents();
break;
case 6: // Make all list empty.
MakeEmpty();
break;
// case 7: // get data from data file
// ReadDataFromFile();
// break;
// case 8: // put data to data file
// WriteDataToFile();
// break;
// case 9: // Search MultiContent Record by combining one or more Primary KEYs.
// SearchMCFromPks();
// break;
case 0: // quit
return;
case 11: // Add new record into favoritedphotolist or favoritevideolist.
AddFavoriteContent();
break;
case 12: // Get a create time from keyboard and Delete the rocord with same create time.
DeleteFavoriteContent();
break;
case 13: // Get the list want to see from keyboard and Display all records in the corresponding list in screen.
DisplayAllFavoriteContent();
break;
case 14: // Display detail information of the specific record in screen.
DisplayDetailFC();
break;
case 15: // Get the condition by keyboard and Rearrange order of FavoriteContent elements.
RearrangeFC();
break;
case 21: // Display all Character record in the list on screen.
DisplayAllCharacter();
break;
case 22: // Search createTime from Location Record and Get detail content records.
SearchMCFromCharacter();
break;
case 31: // Display all Location record in the list on screen.
DisplayAllLocation();
break;
case 32: // Search createTime from Location Record and Get detail content records.
SearchMCFromLocation();
break;
case 41: // Display all Event record in the list on screen.
DisplayAllEvent();
break;
case 42: // Search createTime from Event Record and Get detail content records.
SearchMCFromEvent();
break;
default:
cout << "\tIllegal sellection...\n";
break;
}
}
}
// Display command on screen and get a input from keyboard.
int Application::GetCommand() {
int command;
cout << endl
<< endl;
cout << "\t ----- Main Command ----- " << endl;
cout << "\t 1 : Insert content" << endl;
cout << "\t 2 : Delete content" << endl;
cout << "\t 3 : Update content" << endl;
cout << "\t 4 : Search content by Content creation time" << endl;
cout << "\t 5 : Display all content" << endl;
cout << "\t 6 : Make empty list" << endl;
// cout << "\t 7 : Get from file" << endl;
// cout << "\t 8 : Put to file" << endl;
// cout << "\t 9 : Search content by combining keys" << endl;
cout << "\t 0 : Quit " << endl;
cout << "\t ----- Favorite Command ----- " << endl;
cout << "\t 11 : Add favorite content" << endl;
cout << "\t 12 : Delete favorite content" << endl;
cout << "\t 13 : Display all favorite content" << endl;
cout << "\t 14 : Display detail favorite content on screen" << endl;
cout << "\t 15 : Rerrange Favorite Content's order" << endl;
cout << "\t ----- Character Command ----- " << endl;
cout << "\t 21 : Display all Character content" << endl;
cout << "\t 22 : Display detail character content on screen" << endl;
cout << "\t ----- Location Command ----- " << endl;
cout << "\t 31 : Display all Location content" << endl;
cout << "\t 32 : Display detail location content on screen" << endl;
cout << "\t ----- Event Command ----- " << endl;
cout << "\t 41 : Display all Event content" << endl;
cout << "\t 42 : Display detail event content on screen" << endl;
cout << endl << "\t Choose a Command--> ";
cin >> command;
cout << endl;
return command;
}
// Add new record into masterList.
int Application::AddContents() {
MultimediaContent mainContent;
cin >> mainContent;
if (m_masterList.IsFull()) { // masterList 안이 꽉 찰 경우
cout << "\n\tList is full" << endl;
return -1;
}
else { // masterList에 추가
m_masterList.Add(mainContent);
// characterlist, locationlist, eventlist에 추가
AddCharacter(mainContent);
AddLocation(mainContent);
AddEvent(mainContent);
DisplayAllContents();
cout << "\n\t<========ADD SUCCESS !===========>" << endl;
return 1;
}
}
// Get a createTime from keyboard and delete the rocord with same create Time.
int Application::DeleteContents() {
MultimediaContent mainContent;
mainContent.SetTimeFromKB();
bool found;
m_masterList.RetrieveItem(mainContent, found);
if (m_masterList.IsEmpty()) { // masterList 안이 비어있을 경우
cout << "\tList is empty" << endl;
return -1;
}
if (found == false) { // masterList에 없는 경우
cout << "\tThe content doesn't exist" << endl;
return 0;
}
// masterlist에서 제거
m_masterList.DeleteItem(mainContent);
// characterlist, locationlist, eventlist에서 삭제
DeleteMCFromCharacter(mainContent);
DeleteMCFromLocation(mainContent);
DeleteMCFromEvent(mainContent);
// favoritephotolist,favoritevideolist에서 삭제
FavoriteContent musicContent;
FavoriteContent photoContent;
FavoriteContent videoContent;
musicContent.SetTime(mainContent.GetTime());
photoContent.SetTime(mainContent.GetTime());
videoContent.SetTime(mainContent.GetTime());
if (m_favoriteMusicList.Retrieve_BinS(musicContent)) // favoritemusiclist에 있으면 삭제
m_favoriteMusicList.Delete(musicContent);
if (m_favoritePhotoList.Retrieve_BinS(photoContent)) // favoritephotolist에 있으면 삭제
m_favoritePhotoList.Delete(photoContent);
if (m_favoriteVideoList.Retrieve_BinS(videoContent)) // favoritevideolist에 있으면 삭제
m_favoriteVideoList.Delete(videoContent);
DisplayAllContents();
cout << "\t<========DELETE SUCCESS !===========>" << endl;
return 1;
}
// Get a record from keyboard and Replace the rocord with same record.
int Application::ReplaceContents() {
MultimediaContent oldMC;
MultimediaContent mainContent;
FavoriteContent musicContent;
FavoriteContent photoContent;
FavoriteContent videoContent;
mainContent.SetTimeFromKB();
musicContent.SetTime(mainContent.GetTime());
photoContent.SetTime(mainContent.GetTime());
videoContent.SetTime(mainContent.GetTime());
bool found;
m_masterList.RetrieveItem(mainContent, found);
// masterlist에 존재하는 경우
if (found == true) {
oldMC = mainContent;
mainContent.SetNameFromKB();
mainContent.SetTypeFromKB();
mainContent.SetCharacterFromKB();
mainContent.SetLocationFromKB();
mainContent.SetEventNameFromKB();
m_masterList.UpdateItem(mainContent); // masterlist에 교체 완료
// favoritemusiclist에서 변경 작업
if (m_favoriteMusicList.Retrieve_BinS(musicContent)) {
if (mainContent.GetType() == 2) { // music -> photo 경우
m_favoriteMusicList.Delete(musicContent);
photoContent.SetRecordMC(mainContent);
photoContent.SetCondition(musicContent.GetCondition());
photoContent.SetViewNumber(musicContent.GetViewNumber());
m_favoritePhotoList.Add(photoContent);
}
else if (mainContent.GetType() == 3) { // music -> video인 경우
m_favoriteMusicList.Delete(musicContent);
videoContent.SetRecordMC(mainContent);
videoContent.SetCondition(musicContent.GetCondition());
videoContent.SetViewNumber(musicContent.GetViewNumber());
m_favoriteVideoList.Add(videoContent);
}
else { // 타입이 변경되지 않은 경우
musicContent.SetRecordMC(mainContent);
m_favoriteMusicList.Replace(musicContent);
}
}
// favoritephotolist에서 변경 작업
if (m_favoritePhotoList.Retrieve_BinS(photoContent)) {
if (mainContent.GetType() == 1) { // photo -> music 경우
m_favoritePhotoList.Delete(photoContent);
musicContent.SetRecordMC(mainContent);
musicContent.SetCondition(photoContent.GetCondition());
musicContent.SetViewNumber(photoContent.GetViewNumber());
m_favoriteMusicList.Add(musicContent);
}
else if (mainContent.GetType() == 3) { // photo -> video인 경우
m_favoritePhotoList.Delete(photoContent);
videoContent.SetRecordMC(mainContent);
videoContent.SetCondition(photoContent.GetCondition());
videoContent.SetViewNumber(photoContent.GetViewNumber());
m_favoriteVideoList.Add(videoContent);
}
else { // 타입이 변경되지 않은 경우
photoContent.SetRecordMC(mainContent);
m_favoritePhotoList.Replace(photoContent);
}
}
// favoritevideolist에서 변경 작업
if (m_favoriteVideoList.Retrieve_BinS(videoContent)) {
if (mainContent.GetType() == 1) { // video -> music 경우
m_favoriteVideoList.Delete(videoContent);
musicContent.SetRecordMC(mainContent);
musicContent.SetCondition(videoContent.GetCondition());
musicContent.SetViewNumber(videoContent.GetViewNumber());
m_favoriteMusicList.Add(musicContent);
}
if (mainContent.GetType() == 2) { // video -> photo인 경우
m_favoriteVideoList.Delete(videoContent);
photoContent.SetRecordMC(mainContent);
photoContent.SetCondition(videoContent.GetCondition());
photoContent.SetViewNumber(videoContent.GetViewNumber());
m_favoritePhotoList.Add(photoContent);
}
else { // 타입이 변경되지 않은 경우
videoContent.SetRecordMC(mainContent);
m_favoriteVideoList.Replace(videoContent);
}
}
// specific class modification
if (oldMC.GetCharacter() != mainContent.GetCharacter()) {
DeleteMCFromCharacter(oldMC);
AddCharacter(mainContent);
}
if (oldMC.GetLocation() != mainContent.GetLocation()) {
DeleteMCFromLocation(oldMC);
AddLocation(mainContent);
}
if (oldMC.GetEventName() != mainContent.GetEventName()) {
DeleteMCFromEvent(oldMC);
AddEvent(mainContent);
}
cout << "\n\tReplacing worked"; // 모든 변경사항 변경 완료
DisplayAllContents();
return 1;
}
cout << "\n\tNot exist the Primary Key in list";
return 0;
}
// Get a create time from keyboard and Display a record with input create time.
void Application::RetrieveContents() {
MultimediaContent mainContent;
mainContent.SetTimeFromKB();
bool found;
m_masterList.RetrieveItem(mainContent, found);
if (found == true) {
cout << "<============ Content Found !==========>" << endl;
cout << mainContent << endl;
cout << "<====================================>" << endl;
}
else
cout << "<======== Content Not Found!==========>" << endl;
}
// Display all MultimediaContents in the list in screen.
void Application::DisplayAllContents() {
cout << "\n\t--Current list--" << endl;
m_masterList.PrintTree(cout);
}
// Make masterList empty.
void Application::MakeEmpty() {
m_masterList.MakeEmpty();
m_favoriteMusicList.MakeEmpty();
m_favoritePhotoList.MakeEmpty();
m_favoriteVideoList.MakeEmpty();
m_characterList.MakeEmpty();
m_locationList.MakeEmpty();
m_eventList.MakeEmpty();
cout << "List is now empty.";
}
// // Open a file by file descriptor as an input file.
// int Application::OpenInFile(char *fileName) {
// m_inFile.open(fileName); // file open for reading.
// // 파일 오픈에 성공하면 1, 그렇지 않다면 0을 리턴.
// if (!m_inFile)
// return 0;
// else
// return 1;
// }
// // Open a file by file descriptor as an output file.
// int Application::OpenOutFile(char *fileName) {
// m_outFile.open(fileName); // file open for writing.
// // 파일 오픈에 성공하면 1, 그렇지 않다면 0을 리턴.
// if (!m_outFile)
// return 0;
// else
// return 1;
// }
// // Open a file as a read mode, Read all data on the file, and Set list by the data.
// int Application::ReadDataFromFile() {
// int index = 0;
// MultimediaContent mainContent; // 읽기용 임시 변수
// char filename[FILENAMESIZE];
// cout << "\n\tEnter Input file Name : ";
// cin >> filename;
// // file open, open error가 발생하면 0을 리턴
// if (!OpenInFile(filename))
// return 0;
// // 파일의 모든 내용을 읽어 list에 추가
// while (!m_inFile.eof()) {
// // array에 학생들의 정보가 들어있는 structure 저장
// mainContent.ReadDataFromFile(m_inFile);
// m_masterList.Add(mainContent);
// }
// m_inFile.close(); // file close
// // 현재 list 출력
// DisplayAllContents();
// return 1;
// }
// // Open a file as a write mode, and Write all data into the file,
// int Application::WriteDataToFile() {
// MultimediaContent mainContent; // 쓰기용 임시 변수
// char filename[FILENAMESIZE];
// cout << "\n\tEnter Output file Name : ";
// cin >> filename;
// // file open, open error가 발생하면 0을 리턴
// if (!OpenOutFile(filename))
// return 0;
// DoublyIterator<MultimediaContent> iter(m_masterList);
// // iteration을 이용하여 모든 item 출력
// while (iter.NotNull()) {
// mainContent.WriteDataToFile(m_outFile);
// mainContent = iter.Next();
// }
// m_outFile.close(); // file close
// return 1;
// }
// @@ Favorite-Content Functions @@
// Check if record is a picture or video and Add new record into corresponding list (FavoritePhotoList or FavoriteVideoList).
int Application::AddFavoriteContent() {
MultimediaContent mainContent;
mainContent.SetTimeFromKB();
bool found;
m_masterList.RetrieveItem(mainContent, found);
if (found == false) {
cout << "\n\tNot exist the Primary Key in list";
return 0;
}
if (mainContent.GetType() == 1) { // Type == Music
FavoriteContent musicContent(mainContent); // musicContent 변수 세팅
if (m_favoriteMusicList.GetLength() >= 1) { // FavoriteMusicList에 이미 컨텐츠가 존재하면 m_condition 일치하게 만들기
FavoriteContent temp;
m_favoriteMusicList.ResetList();
m_favoriteMusicList.GetNextItem(temp);
musicContent.SetCondition(temp.GetCondition());
}
int status = m_favoriteMusicList.Add(musicContent);
if (status == 0) {
cout << "\n\tThe content already exists" << endl;
return 0;
}
else if (status == 1)
cout << "\n\t<========ADD SUCCESS !===========>" << endl;
}
else if (mainContent.GetType() == 2) { // Type == Photo
FavoriteContent photoContent(mainContent); // photoContent 변수 세팅
if (m_favoritePhotoList.GetLength() >= 1) { // FavoritePhotoList에 이미 컨텐츠가 존재하면 m_condition 일치하게 만들기
FavoriteContent temp;
m_favoritePhotoList.ResetList();
m_favoritePhotoList.GetNextItem(temp);
photoContent.SetCondition(temp.GetCondition());
}
int status = m_favoritePhotoList.Add(photoContent);
if (status == 0) {
cout << "\n\tThe content already exists" << endl;
return 0;
}
else if (status == 1)
cout << "\n\t<========ADD SUCCESS !===========>" << endl;
}
else if (mainContent.GetType() == 3) { // Type == Video
FavoriteContent videoContent(mainContent); // videoContent 변수 세팅
if (m_favoriteVideoList.GetLength() >= 1) { // FavoriteVideoList에 이미 컨텐츠가 존재하면 m_condition 일치하게 만들기
FavoriteContent temp;
m_favoriteVideoList.ResetList();
m_favoriteVideoList.GetNextItem(temp);
videoContent.SetCondition(temp.GetCondition());
}
int status = m_favoriteVideoList.Add(videoContent);
if (status == 0) {
cout << "\n\tThe content already exists" << endl;
return 0;
}
else if (status == 1)
cout << "\n\t<========ADD SUCCESS !===========>" << endl;
}
return 1;
}
// Get a create time from keyboard and Delete the rocord with same create time.
int Application::DeleteFavoriteContent() {
MultimediaContent mainContent;
mainContent.SetTimeFromKB();
bool found;
m_masterList.RetrieveItem(mainContent, found);
if (found == false) {
cout << "\n\tNot exist the Primary Key in list";
return 0;
}
if (mainContent.GetType() == 1) { // Type == Music
FavoriteContent musicContent;
musicContent.SetTime(mainContent.GetTime());
int status = m_favoriteMusicList.Delete(musicContent);
if (status == -1) {
cout << "\tList is empty" << endl;
return -1;
}
else if (status == 0) {
cout << "\tThe content doesn't exist" << endl;
return 0;
}
else {
cout << "\t<========DELETE SUCCESS !===========>" << endl;
return 1;
}
}
else if (mainContent.GetType() == 2) { // Type == Photo
FavoriteContent photoContent;
photoContent.SetTime(mainContent.GetTime());
int status = m_favoritePhotoList.Delete(photoContent);
if (status == -1) {
cout << "\tList is empty" << endl;
return -1;
}
else if (status == 0) {
cout << "\tThe content doesn't exist" << endl;
return 0;
}
else {
cout << "\t<========DELETE SUCCESS !===========>" << endl;
return 1;
}
}
else if (mainContent.GetType() == 3) { // Type == Video
FavoriteContent videoContent;
videoContent.SetTime(mainContent.GetTime());
int status = m_favoriteVideoList.Delete(videoContent);
if (status == -1) {
cout << "\tList is empty" << endl;
return -1;
}
else if (status == 0) {
cout << "\tThe content doesn't exist" << endl;
return 0;
}
else {
cout << "\t<========DELETE SUCCESS !===========>" << endl;
return 1;
}
}
return 1;
}
// Get the list want to see from keyboard and Display all records in the corresponding list in screen.
void Application::DisplayAllFavoriteContent() {
cout << "\n\t--Current Favorite Music list--" << endl;
m_favoriteMusicList.ResetList();
int length = m_favoriteMusicList.GetLength();
for (int i = 0; i < length; i++) {
FavoriteContent musicContent;
m_favoriteMusicList.GetNextItem(musicContent);
musicContent.SetViewNumber(musicContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoriteMusicList.Replace(musicContent); // 조회 수 1 증가 된 musicContent favoritePhotoList에 업데이트
cout << musicContent << endl; // 출력
}
cout << "\n\t--Current Favorite Photo list--" << endl;
m_favoritePhotoList.ResetList();
length = m_favoritePhotoList.GetLength();
for (int i = 0; i < length; i++) {
FavoriteContent photoContent;
m_favoritePhotoList.GetNextItem(photoContent);
photoContent.SetViewNumber(photoContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoritePhotoList.Replace(photoContent); // 조회 수 1 증가 된 photoContent를 favoritePhotoList에 업데이트
cout << photoContent << endl; // 출력
}
cout << "\n\t--Current Favorite Video list--" << endl;
m_favoriteVideoList.ResetList();
length = m_favoriteVideoList.GetLength();
for (int i = 0; i < length; i++) {
FavoriteContent videoContent;
m_favoriteVideoList.GetNextItem(videoContent);
videoContent.SetViewNumber(videoContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoriteVideoList.Replace(videoContent); // 조회 수 1 증가 된 videoContent를 favoriteVideoList에 업데이트
cout << videoContent << endl; // 출력
}
}
// Display detail information of the specific record in screen.
void Application::DisplayDetailFC() {
MultimediaContent mainContent;
mainContent.SetTimeFromKB();
bool found;
m_masterList.RetrieveItem(mainContent, found);
if (found == false)
cout << "\n\tNot exist the Primary Key in list";
if (mainContent.GetType() == 1) { // Type == Music
FavoriteContent musicContent;
musicContent.SetTime(mainContent.GetTime());
if (m_favoriteMusicList.Retrieve_BinS(musicContent)) {
musicContent.SetViewNumber(musicContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoriteMusicList.Replace(musicContent); // 조회 수 1 증가 된 musicContent favoriteMusicList에 업데이트
mainContent.SetTime(musicContent.GetTime());
m_masterList.RetrieveItem(mainContent, found);
cout << "\n\tCurrent list" << endl;
cout << mainContent; // 출력
}
else
cout << "\n\tNot exist in Favorite Music list" << endl;
}
else if (mainContent.GetType() == 2) { // Type == Photo
FavoriteContent photoContent;
photoContent.SetTime(mainContent.GetTime());
if (m_favoritePhotoList.Retrieve_BinS(photoContent)) {
photoContent.SetViewNumber(photoContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoritePhotoList.Replace(photoContent); // 조회 수 1 증가 된 photoContent를 favoritePhotoList에 업데이트
mainContent.SetTime(photoContent.GetTime());
m_masterList.RetrieveItem(mainContent, found);
cout << "\n\tCurrent list" << endl;
cout << mainContent; // 출력
}
else
cout << "\n\tNot exist in Favorite Photo list" << endl;
}
else if (mainContent.GetType() == 3) { // Type == Photo
FavoriteContent videoContent;
videoContent.SetTime(mainContent.GetTime());
if (m_favoriteVideoList.Retrieve_BinS(videoContent)) {
videoContent.SetViewNumber(videoContent.GetViewNumber() + 1); // 조회 수 1 증가
m_favoriteVideoList.Replace(videoContent); // 조회 수 1 증가 된 videoContent를 favoriteVideoList에 업데이트
mainContent.SetTime(videoContent.GetTime());
m_masterList.RetrieveItem(mainContent, found);
cout << "\n\tCurrent list" << endl;
cout << mainContent; // 출력
}
else
cout << "\n\tNot exist in Favorite Video list" << endl;
}
}
// Get the condition by keyboard and Rearrange order of FavoriteContent elements.
void Application::RearrangeFC() {
int listType;
int condition;
cout << "\n\tChoose the list Rearranging (1. Favorite Music List, 2. Favorite Photo List, 3. Favorite Video List) : ";
cin >> listType;
if (listType == 1) { // Type -> Music
SortedList<FavoriteContent> tmpPhotoList = m_favoriteMusicList; // Favorite Music Content List.
int length = m_favoriteMusicList.GetLength();
m_favoriteMusicList.MakeEmpty();
tmpPhotoList.ResetList();
cout << "\n\tEnter the condition to see in what order (1. createTime, 2. contentName, 3. viewNumber) : ";
cin >> condition;
if (!(condition == 1 || condition == 2 || condition == 3)) { // 1, 2, 3 외의 숫자를 입력한 경우
cout << "\n\tEnter 1 or 2 or 3" << endl;
return;
}
for (int i = 0; i < length; i++) {
FavoriteContent musicContent;
tmpPhotoList.GetNextItem(musicContent);
musicContent.SetCondition(condition);
m_favoriteMusicList.Add(musicContent);
}
DisplayAllFavoriteContent();
cout << "\n\t<========Modification SUCCESS !===========>" << endl;
}
else if (listType == 2) { // Type -> Photo
SortedList<FavoriteContent> tmpPhotoList = m_favoritePhotoList; // Favorite Photo Content List.
int length = m_favoritePhotoList.GetLength();
m_favoritePhotoList.MakeEmpty();
tmpPhotoList.ResetList();
cout << "\n\tEnter the condition to see in what order (1. createTime, 2. contentName, 3. viewNumber) : ";
cin >> condition;
if (!(condition == 1 || condition == 2 || condition == 3)) { // 1, 2, 3 외의 숫자를 입력한 경우
cout << "\n\tEnter 1 or 2 or 3" << endl;
return;
}
for (int i = 0; i < length; i++) {
FavoriteContent photoContent;
tmpPhotoList.GetNextItem(photoContent);
photoContent.SetCondition(condition);
m_favoritePhotoList.Add(photoContent);
}
DisplayAllFavoriteContent();
cout << "\n\t<========Modification SUCCESS !===========>" << endl;
}
else if (listType == 3) { // Type -> Video
SortedList<FavoriteContent> tmpVideoList = m_favoriteVideoList; // Favorite Video Content List.
int length = m_favoriteVideoList.GetLength();
m_favoriteVideoList.MakeEmpty();
tmpVideoList.ResetList();
cout << "\n\tEnter the condition to see in what order (1. createTime, 2. contentName, 3. viewNumber) : ";
cin >> condition;
if (!(condition == 1 || condition == 2 || condition == 3)) { // 1, 2, 3 외의 숫자를 입력한 경우
cout << "\n\tEnter 1 or 2 or 3" << endl;
return;
}
for (int i = 0; i < length; i++) {
FavoriteContent videoContent;
tmpVideoList.GetNextItem(videoContent);
videoContent.SetCondition(condition);
m_favoriteVideoList.Add(videoContent);
}
DisplayAllFavoriteContent();
cout << "\n\t<========Modification SUCCESS !===========>" << endl;
}
else // 1, 2 외의 숫자를 입력한 경우
cout << "\n\tEnter 1 or 2" << endl;
}
// @@ Character Functions @@
// Display all Character record in the list on screen.
void Application::DisplayAllCharacter() {
CharacterContent character;
m_characterList.ResetList();
cout << "\n\t--Current Character list--" << endl;
for (int i = 0; i < m_characterList.GetLength(); i++) {
m_characterList.GetNextItem(character);
cout << character << endl;
}
}
// Add CreateTime into CreateTime List of CharacterContent.
void Application::AddCharacter(MultimediaContent &_mainContent) {
CharacterContent character;
character.SetName(_mainContent.GetCharacter());
if (!m_characterList.Get(character)) { // chracterlist안에 같은 character name이 존재하지 않은 경우
character.AddCreateTime(_mainContent.GetTime());
m_characterList.Add(character); // character name 신규 추가
}
else { // chracterlist안에 이미 같은 character name이 존재하는 경우
character.AddCreateTime(_mainContent.GetTime());
m_characterList.Replace(character); // 변경된 사항 characterList에 업데이트
}
}
// Search createTime from Location Record and Get detail content records.
void Application::SearchMCFromCharacter() {
CharacterContent character;
character.SetNameFromKB();
if (m_characterList.Get(character)) {
character.SearchAtMasterList(m_masterList); // 디테일 정보 출력
}
else {
cout << "\tNot Exist Character in list." << endl;
DisplayAllCharacter();
}
}
// Delete createTime into CreateTime List of CharacterContent.
void Application::DeleteMCFromCharacter(MultimediaContent &_mainContent) {
CharacterContent character;
character.SetName(_mainContent.GetCharacter());
if (m_characterList.Get(character)) {
if (character.GetCount() == 1) { // characterList에 같은 character가 하나인 경우
m_characterList.Delete(character);
}
else { // characterList에 같은 character가 둘 이상인 경우
character.DeleteCreateTime(_mainContent.GetTime());
m_characterList.Replace(character); // 변경된 사항 characterList에 업데이트
}
}
}
// @@ Location Functions @@
// Display all Location record in the list on screen.
void Application::DisplayAllLocation() {
LocationContent location;
m_locationList.ResetList();
cout << "\n\t--Current Location list--" << endl;
for (int i = 0; i < m_locationList.GetLength(); i++) {
m_locationList.GetNextItem(location);
cout << location << endl;
}
}
// Add CreateTime into CreateTime List of LocationContent.
void Application::AddLocation(MultimediaContent &_mainContent) {
LocationContent location;
location.SetName(_mainContent.GetLocation());
if (!m_locationList.Get(location)) { // locationlist안에 같은 location이 존재하지 않은 경우
location.AddCreateTime(_mainContent.GetTime());
m_locationList.Add(location); // location 신규 추가
}
else { // locationlist안에 이미 같은 location이 존재하는 경우
location.AddCreateTime(_mainContent.GetTime());
m_locationList.Replace(location); // 변경된 사항 locationlist 업데이트
}
}
// Search createTime from Location Record and Get detail content records.
void Application::SearchMCFromLocation() {
LocationContent location;
location.SetNameFromKB();
if (m_locationList.Get(location)) {
location.SearchAtMasterList(m_masterList); // 디테일 정보 출력
}
else {
cout << "\tNot Exist Location in list." << endl;
DisplayAllLocation();
}
}
// Delete createTime into CreateTime List of LocationContent.
void Application::DeleteMCFromLocation(MultimediaContent &_mainContent) {
LocationContent location;
location.SetName(_mainContent.GetLocation());
if (m_locationList.Get(location)) {
if (location.GetCount() == 1) // locationList에 같은 location가 하나인 경우
m_locationList.Delete(location);
else { // locationList에 같은 location가 둘 이상인 경우
location.DeleteCreateTime(_mainContent.GetTime());
m_locationList.Replace(location); // 변경된 사항 locationlist 업데이트
}
}
}
// @@ Event Functions @@
// Display all Event record in the list on screen.
void Application::DisplayAllEvent() {
EventContent event;
m_eventList.ResetList();
cout << "\n\t--Current Event list--" << endl;
for (int i = 0; i < m_eventList.GetLength(); i++) {
m_eventList.GetNextItem(event);
cout << event << endl;
}
}
// Add CreateTime into CreateTime List of EventContent.
void Application::AddEvent(MultimediaContent& _mainContent) {
EventContent event;
event.SetName(_mainContent.GetEventName());
if (!m_eventList.Get(event)) { // evnetList안에 같은 event가 존재하지 않은 경우
event.AddCreateTime(_mainContent.GetTime());
m_eventList.Add(event); // event 신규 추가
}
else { // evnetList안에 이미 같은 event가 존재하는 경우
event.AddCreateTime(_mainContent.GetTime());
m_eventList.Replace(event); // 변경된 사항 evnetList 업데이트
}
}
// Search createTime from Event Record and Get detail content records.
void Application::SearchMCFromEvent() {
EventContent event;
event.SetNameFromKB();
if (m_eventList.Get(event)) {
event.SearchAtMasterList(m_masterList); // 디테일 정보 출력
}
else {
cout << "\tNot Exist Event in list." << endl;
DisplayAllEvent();
}
}
// Delete createTime into CreateTime List of EventContents.
void Application::DeleteMCFromEvent(MultimediaContent &_mainContent) {
EventContent event;
event.SetName(_mainContent.GetEventName());
if (m_eventList.Get(event)) {
if (event.GetCount() == 1) // eventList에 같은 event가 하나인 경우
m_eventList.Delete(event);
else { // eventList에 같은 event가 둘 이상인 경우
event.DeleteCreateTime(_mainContent.GetTime());
m_eventList.Replace(event); // 변경된 사항 evnetList 업데이트
}
}
}
// Search content by combining one or more keys
// // Search MultiContent Record by combining one or more Primary KEYs.
// void Application::SearchMCFromPks() {
// MultimediaContent mainContent;
// CharacterContent character;
// LocationContent location;
// EventContent event;
// UnsortedList<string> inputKeyList;
// SortedSinglyLinkedList<MultimediaContent> tmpList;
// string inputKey = "";
// int countKey = 0;
// // 키 입력 받기
// while (1) {
// cout << "\n\tInput Searching Keys (Quit 'q'): ";
// cin >> inputKey;
// if (inputKey == "q")
// break;
// countKey++;
// inputKeyList.Add(inputKey);
// }
// // 입력 된 키의 종류(character, location, event) 확인하기
// for (int i = 0; i < countKey; i++) {
// character.SetName(inputKeyList[i]);
// location.SetName(inputKeyList[i]);
// event.SetName(inputKeyList[i]);
// if (m_characterList.Get(character))
// mainContent.SetCharacter(character.GetName());
// if (m_locationList.Get(location))
// mainContent.SetLocation(location.GetName());
// if (m_eventList.Get(event))
// mainContent.SetEventName(event.GetName());
// }
// bool isFind = false;
// cout << "\n\t<====================================>" << endl;
// if (countKey == 1) { // 입력된 키가 하나인 경우
// if (searchKeyFromCharacter(mainContent, tmpList, 1)) // 키가 character인지?
// isFind = true;
// else if (searchKeyFromLocation(mainContent, tmpList, 1)) // 키가 location인지?
// isFind = true;
// else if (searchKeyFromEvent(mainContent, tmpList, 1)) // 키가 event인지?
// isFind = true;
// }
// else if (countKey == 2) { // 입력된 키가 두개인 경우
// if (searchKeyFromCharacter(mainContent,tmpList, 1)) { // 키가 character인지?
// if (searchKeyFromLocation(mainContent, tmpList, 0)) // 키가 character이고 location인지?
// isFind = true;
// else if (searchKeyFromEvent(mainContent, tmpList, 0)) // 키가 character이고 event인지?
// isFind = true;
// }
// else if (searchKeyFromLocation(mainContent, tmpList, 1)) // 키가 location인지?
// if (searchKeyFromEvent(mainContent, tmpList, 0)) // 키가 location이고 event인지?
// isFind = true;
// }
// else if (countKey == 3) { // 입력된 키가 세 개인 경우
// if (searchKeyFromCharacter(mainContent, tmpList, 1)) // 키가 character인지?
// if (searchKeyFromLocation(mainContent, tmpList, 0)) // 키가 character이고 location인지?
// if (searchKeyFromEvent(mainContent, tmpList, 0)) // 키가 character, location이고 event인지?
// isFind = true;
// }
// if (isFind) {
// MultimediaContent tmp;
// tmpList.ResetList();
// for (int i = 0; i < tmpList.GetLength(); i++) { // 같은 키를 포함하는 MultimediaContent 정보 출력
// tmpList.GetNextItem(tmp);
// cout << tmp << endl;
// }
// cout << "\t<============I FOUND CONTENT !==========>" << endl;
// }
// else
// cout << "\n\t<========I CAN'T FIND CONTENT !==========>" << endl;
// }
// // Search MultiContent Record with PK of Character Class
// bool Application::searchKeyFromCharacter(MultimediaContent& _mc, SortedSinglyLinkedList<MultimediaContent>& _list, bool _condition) {
// bool isFind = false;
// DoublyIterator<MultimediaContent> iter(m_masterList);
// // masterList 한바퀴 돌기
// while (iter.NotNull()) {
// if (_mc.GetCharacter().find(iter.GetCurrentNode().data.GetCharacter(),0) != -1) {// 동일한 character인 경우
// MultimediaContent tmp = iter.GetCurrentNode().data;
// _list.Add(tmp); // _list에 추가
// isFind = true;
// }
// iter.Next();
// }
// if (isFind)
// return true;
// else
// return false;
// }
// // Search MultiContent Record with PK of Location Class
// bool Application::searchKeyFromLocation(MultimediaContent& _mc, SortedSinglyLinkedList<MultimediaContent>& _list, bool _condition) {
// bool isFind = false;
// if (_condition) { // 그 전에 키를 파악하지 못한 경우
// DoublyIterator<MultimediaContent> iter(m_masterList);
// // masterList 한바퀴 돌기
// while (iter.NotNull()) {
// if (_mc.GetLocation().find(iter.GetCurrentNode().data.GetLocation(),0) != -1) { // 동일한 Location인 경우
// MultimediaContent tmp = iter.GetCurrentNode().data;
// _list.Add(tmp); // _list에 추가
// isFind = true;
// }
// iter.Next();
// }
// }
// else { // 그 전에 다른 키가 존재하여 파악한 경우
// MultimediaContent mainContent;
// SortedSinglyLinkedList<MultimediaContent> tmpList;
// _list.ResetList();
// for (int i = 0; i < _list.GetLength(); i++) { // _list 한바퀴 돌기
// _list.GetNextItem(mainContent);
// if (_mc.GetLocation() == mainContent.GetLocation()) { // 동일한 Location인 경우
// tmpList.Add(mainContent); // tmpList에 추가
// isFind = true;
// }
// }
// _list = tmpList; // tmpList를 _List에 할당
// }
// if (isFind)
// return true;
// else
// return false;
// }
// // Search MultiContent Record with PK of Event Class
// bool Application::searchKeyFromEvent(MultimediaContent& _mc, SortedSinglyLinkedList<MultimediaContent>& _list, bool _condition) {
// bool isFind = false;
// if (_condition) { // 그 전에 키를 파악하지 못한 경우
// DoublyIterator<MultimediaContent> iter(m_masterList);
// // masterList 한바퀴 돌기
// while (iter.NotNull()) {
// if (_mc.GetEventName().find(iter.GetCurrentNode().data.GetEventName(),0) != -1) { // 동일한 Event인 경우
// MultimediaContent tmp = iter.GetCurrentNode().data;
// _list.Add(tmp); // _list에 추가
// isFind = true;
// }
// iter.Next();
// }
// }
// else { // 그 전에 다른 키가 존재하여 파악한 경우
// MultimediaContent mainContent;
// SortedSinglyLinkedList<MultimediaContent> tmpList;
// _list.ResetList();
// for (int i = 0; i < _list.GetLength(); i++) { // _list 한바퀴 돌기
// _list.GetNextItem(mainContent);
// if (_mc.GetEventName() == mainContent.GetEventName()) { // 동일한 Event인 경우
// tmpList.Add(mainContent); // tmpList에 추가
// isFind = true;
// }
// }
// _list = tmpList; // tmpList를 _List에 할당
// }
// if (isFind)
// return true;
// else
// return false;
// } | [
"[email protected]"
] | |
f8642953a193d4bb5930e41d476341ffec48179f | f2ce7081a4d0849443dd441160b4ec20457e6601 | /SearchMethod/test.cpp~ | 7d2c9cb9c58643c8e012cc12752b6dff3e84f753 | [] | no_license | man4ish/NGS-Code | 5a140f841a4df86928c0e1c75e3d9e1f24ca0b6b | 1d4f59f4070d0b2c3c089ee979de247ac473e149 | refs/heads/master | 2021-01-13T14:45:24.615913 | 2019-03-18T15:48:35 | 2019-03-18T15:48:35 | 76,582,283 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | #include <iostream>
using namespace std;
std::string GetMapIndexFile(std::string filename)
{
int j =0;
for (int i = filename.size()-1; i >= 0 ; i-- )
{ if(filename[i] == '.')
j++;
if(j == 3)
return filename.substr(0,i) + ".MapIndex.txt";
}
}
int main()
{
string s = "hs_mgb_1.0.ref_genome.37.1.gene.chr1.txt";
std::cout << GetMapIndexFile(s)<< endl;
return 0;
}
| [
"[email protected]"
] | ||
6bb1878a9f8e6dc2763910763c67b238343be27c | 06954096d7b4d0732379f6354f8a355af6070831 | /src/game/client/swarm/vgui/experience_bar.cpp | 8bb3de0b2b68aa9b46b3129c0b1ee8de3d5997ed | [] | no_license | Nightgunner5/Jastian-Summer | 9ee590bdac8d5cf281f844d1be3f1f5709ae4b91 | 22749cf0839bbb559bd13ec7e6a5af4458b8bdb7 | refs/heads/master | 2016-09-06T15:55:32.938564 | 2011-04-16T17:57:12 | 2011-04-16T17:57:12 | 1,446,629 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,058 | cpp | #include "cbase.h"
#include <vgui_controls/Label.h>
#include "vgui_controls/AnimationController.h"
#include <vgui_controls/ImagePanel.h>
#include "statsbar.h"
#include "experience_bar.h"
#include "c_asw_player.h"
#include <vgui/ILocalize.h>
#include "skillanimpanel.h"
#include "clientmode_asw.h"
#include "asw_gamerules.h"
#include <vgui/IVGui.h>
#include "vgui_avatarimage.h"
#include "asw_player_shared.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
ConVar asw_xp_screen_debug( "asw_xp_screen_debug", "0", FCVAR_CHEAT, "If enabled, XP screen will show dummy player slots" );
ExperienceBar::ExperienceBar(vgui::Panel *parent, const char *name) :
vgui::EditablePanel( parent, name )
{
m_flOldBarMin = -1.0f;
m_bOldCapped = false;
m_iPlayerLevel = 0;
m_nOldPlayerXP = -1;
m_pPlayerNameLabel = new vgui::Label( this, "PlayerNameLabel", "" );
m_pPlayerLevelLabel = new vgui::Label( this, "PlayerLevelLabel", "" );
m_pExperienceCounter = new vgui::Label( this, "ExperienceCounter", "" );
m_pLevelUpLabel = new vgui::Label( this, "LevelUpLabel", "#asw_level_up" );
m_pPromotionIcon = new vgui::ImagePanel( this, "PromotionIcon" );
m_pAvatarBackground = new vgui::Panel( this, "AvatarBackground" );
m_pAvatarImage = new CAvatarImagePanel( this, "AvatarImage" );
m_pExperienceBar = new StatsBar( this, "ExperienceBar" );
m_pExperienceBar->UseExternalCounter( m_pExperienceCounter );
m_pExperienceBar->SetShowMaxOnCounter( true );
m_pExperienceBar->SetColors( Color( 255, 255, 255, 0 ), Color( 93,148,192,255 ), Color( 255, 255, 255, 255 ), Color( 17,37,57,255 ), Color( 35, 77, 111, 255 ) );
//m_pExperienceBar->m_bShowCumulativeTotal = true;
m_nLastPromotion = -1;
UpdateMinMaxes( 0 );
m_pExperienceBar->m_flBorder = 1.5f;
vgui::ivgui()->AddTickSignal( GetVPanel() );
}
void ExperienceBar::UpdateMinMaxes( int nPromotion )
{
if ( m_nLastPromotion == nPromotion )
return;
m_nLastPromotion = nPromotion;
m_pExperienceBar->ClearMinMax();
m_pExperienceBar->AddMinMax( 0, g_iLevelExperience[ 0 ] * g_flPromotionXPScale[ m_nLastPromotion ] );
for ( int i = 0; i < ASW_NUM_EXPERIENCE_LEVELS - 1; i++ )
{
m_pExperienceBar->AddMinMax( g_iLevelExperience[ i ] * g_flPromotionXPScale[ m_nLastPromotion ] , g_iLevelExperience[ i + 1 ] * g_flPromotionXPScale[ m_nLastPromotion ] );
}
}
void ExperienceBar::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( "resource/UI/ExperienceBar.res" );
m_pLevelUpLabel->SetVisible( false );
}
void ExperienceBar::PerformLayout()
{
BaseClass::PerformLayout();
if ( m_pAvatarImage )
{
int wide, tall;
m_pAvatarImage->GetSize( wide, tall );
if ( ((CAvatarImage*)m_pAvatarImage->GetImage()) )
{
((CAvatarImage*)m_pAvatarImage->GetImage())->SetAvatarSize( wide, tall );
((CAvatarImage*)m_pAvatarImage->GetImage())->SetPos( -AVATAR_INDENT_X, -AVATAR_INDENT_Y );
}
}
}
void ExperienceBar::OnTick()
{
BaseClass::OnTick();
SetVisible( m_hPlayer.Get() || asw_xp_screen_debug.GetBool() );
if ( m_hPlayer.Get() )
{
int nPromotion = m_hPlayer->GetPromotion();
if ( nPromotion <= 0 || nPromotion > ASW_PROMOTION_CAP )
{
m_pPromotionIcon->SetVisible( false );
}
else
{
m_pPromotionIcon->SetVisible( true );
m_pPromotionIcon->SetImage( VarArgs( "briefing/promotion_%d", nPromotion ) );
}
}
if ( m_hPlayer.Get() )
{
if ( ASWGameRules()->GetGameState() <= ASW_GS_BRIEFING )
{
int nXP = m_hPlayer->GetExperience();
if ( nXP != m_nOldPlayerXP )
{
m_pExperienceBar->Init( nXP, nXP, 1.0, true, false );
Msg( "Experience bar in briefing set xp to %d\n", nXP );
m_nOldPlayerXP = nXP;
m_iPlayerLevel = m_hPlayer->GetLevel();
UpdateLevelLabel();
}
m_pPlayerNameLabel->SetText( m_hPlayer->GetPlayerName() );
}
else
{
float flBarMin = m_pExperienceBar->GetBarMin();
bool bCapped = ( (int) m_pExperienceBar->m_fCurrent ) >= ASW_XP_CAP * g_flPromotionXPScale[ m_hPlayer->GetPromotion() ];
if ( m_flOldBarMin == -1 )
{
m_bOldCapped = bCapped;
}
if ( m_flOldBarMin != -1 && ( m_flOldBarMin != flBarMin || m_bOldCapped != bCapped ) ) // bar min has changed - player has levelled up!
{
m_iPlayerLevel = LevelFromXP( m_pExperienceBar->m_fCurrent, m_hPlayer->GetPromotion() );
UpdateLevelLabel();
m_pLevelUpLabel->SetVisible( true );
SkillAnimPanel *pSkillAnim = dynamic_cast<SkillAnimPanel*>(GetClientMode()->GetViewport()->FindChildByName("SkillAnimPanel", true));
if ( pSkillAnim )
{
pSkillAnim->AddParticlesAroundPanel( m_pPlayerLevelLabel );
}
}
m_flOldBarMin = flBarMin;
m_bOldCapped = bCapped;
}
}
}
void ExperienceBar::InitFor( C_ASW_Player *pPlayer )
{
m_hPlayer = pPlayer;
if ( !pPlayer )
{
if ( !asw_xp_screen_debug.GetBool() )
{
SetVisible( false );
}
else
{
m_pPlayerNameLabel->SetText( "Player" );
m_pPlayerLevelLabel->SetText( "Level 5" );
m_pExperienceBar->Init( 1200, 1500, 1500.0f / 4.0f, true, false );
m_pExperienceBar->SetStartCountingTime( gpGlobals->curtime + 15.0f );
}
return;
}
SetVisible( true );
m_pPlayerNameLabel->SetText( pPlayer->GetPlayerName() );
#if !defined(NO_STEAM)
CSteamID steamID = pPlayer->GetSteamID();
if ( steamID.IsValid() )
{
if ( steamID.ConvertToUint64() != m_lastSteamID.ConvertToUint64() )
{
m_pAvatarImage->SetAvatarBySteamID( &steamID );
int wide, tall;
m_pAvatarImage->GetSize( wide, tall );
((CAvatarImage*)m_pAvatarImage->GetImage())->SetAvatarSize( wide, tall );
((CAvatarImage*)m_pAvatarImage->GetImage())->SetPos( -AVATAR_INDENT_X, -AVATAR_INDENT_Y );
}
m_lastSteamID = steamID;
}
#endif
UpdateMinMaxes( pPlayer->GetPromotion() );
if ( ASWGameRules()->GetGameState() <= ASW_GS_BRIEFING )
{
m_iPlayerLevel = pPlayer->GetLevel();
UpdateLevelLabel();
m_pExperienceBar->Init( pPlayer->GetExperience(), pPlayer->GetExperience(), 1.0f, true, false );
Msg( "init xp bar to %d / %d. pPlayer->GetLevel() = %d\n", pPlayer->GetExperience(), pPlayer->GetExperience(), pPlayer->GetLevel() );
}
else
{
m_iPlayerLevel = pPlayer->GetLevelBeforeDebrief();
UpdateLevelLabel();
int iEarnedXP = ( GetClientModeASW() && !GetClientModeASW()->IsOfficialMap() ) ? 0 : pPlayer->GetEarnedXP( ASW_XP_TOTAL );
int nGoalXP = pPlayer->GetExperienceBeforeDebrief() + iEarnedXP;
nGoalXP = MIN( nGoalXP, ASW_XP_CAP * g_flPromotionXPScale[ pPlayer->GetPromotion() ] );
float flRate = (float) iEarnedXP / 3.0f; // take 4 seconds to increase XP.
if ( iEarnedXP < 150 ) // if XP is really low, count it up in 1 second
{
flRate = (float) iEarnedXP;
}
m_pExperienceBar->Init( pPlayer->GetExperienceBeforeDebrief(), nGoalXP, flRate, true, false );
Msg( "init xp bar to %d / %d. pPlayer->GetLevelBeforeDebrief() = %d\n", pPlayer->GetExperienceBeforeDebrief(), nGoalXP, pPlayer->GetLevelBeforeDebrief() );
m_pExperienceBar->SetStartCountingTime( gpGlobals->curtime + 11.0f );
}
}
void ExperienceBar::UpdateLevelLabel()
{
wchar_t szLevelNum[16]=L"";
_snwprintf( szLevelNum, ARRAYSIZE( szLevelNum ), L"%i", m_iPlayerLevel + 1 ); // levels start at 0 in code, but show from 1 in the UI
wchar_t wzLevelLabel[64];
g_pVGuiLocalize->ConstructString( wzLevelLabel, sizeof( wzLevelLabel ), g_pVGuiLocalize->Find( "#asw_experience_level" ), 1, szLevelNum );
m_pPlayerLevelLabel->SetText( wzLevelLabel );
}
bool ExperienceBar::IsDoneAnimating()
{
if ( !m_hPlayer.Get() )
return true;
if ( !IsVisible() )
return true;
return m_pExperienceBar->IsDoneAnimating();
}
// Small version ======================
ExperienceBarSmall::ExperienceBarSmall(vgui::Panel *parent, const char *name) :
BaseClass( parent, name )
{
m_pExperienceBar->m_flBorder = 0.0f;
}
void ExperienceBarSmall::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( "resource/UI/ExperienceBarSmall.res" );
m_pLevelUpLabel->SetVisible( false );
} | [
"[email protected]"
] | |
7eccb7583068ccc6745af229ce8e98659bc0eaf7 | 104a193527bc263482ea634842c15ec813a99c0f | /src/statistics/amise_optimal_bandwidth_estimator.cpp | de031426158f35c70b68e910efd5a413bdceb41f | [
"MIT"
] | permissive | channotation/chap | d33b3a298ffd65b946a069c78baf8502c03271c9 | 1d137bfba9e0e9c4ed7dff016ccb0418834daac4 | refs/heads/master | 2022-10-26T16:45:56.138277 | 2022-03-02T22:33:51 | 2022-03-02T22:33:51 | 121,681,474 | 15 | 8 | NOASSERTION | 2022-10-05T23:43:00 | 2018-02-15T20:52:49 | C++ | UTF-8 | C++ | false | false | 7,121 | cpp | // CHAP - The Channel Annotation Package
//
// Copyright (c) 2016 - 2018 Gianni Klesse, Shanlin Rao, Mark S. P. Sansom, and
// Stephen J. Tucker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include <numeric>
#include <boost/math/special_functions/factorials.hpp>
#include <boost/math/special_functions/hermite.hpp>
#include <boost/math/tools/roots.hpp>
#include "statistics/amise_optimal_bandwidth_estimator.hpp"
#include "statistics/summary_statistics.hpp"
/*!
* Estimates the AMISE-optimal bandwidth for kernel density estimation on a
* given sample. Requires there to be at least two distinct sample points.
*/
real
AmiseOptimalBandWidthEstimator::estimate(
const std::vector<real> &sampleIn)
{
// make copy of sample:
// (not so memory efficient, but avoids rescaling the data back)
auto sample = sampleIn;
// sanity checks:
if( sample.size() < 2 )
{
// one angstrom returned in this case as default:
return 0.1;
}
// shift and scale data:
auto ss = gdd_.getShiftAndScaleParams(sample, sample);
gdd_.shiftAndScale(sample, ss.first, ss.second);
// estimate standard deviation of the sample:
SummaryStatistics sumStats;
for(auto s : sample)
{
sumStats.update(s);
}
real sigma = sumStats.sd();
// estimate functionals six and eight by assuming Gaussianity:
real phi6 = functionalPhi6(sigma);
real phi8 = functionalPhi8(sigma);
// calculate prototype bandwidth optimal wrt asymptotic MSE:
real g1 = std::pow(-6.0 / ( SQRT2PI_*phi6*sample.size() ), 1.0/7.0);
real g2 = std::pow(30.0 / ( SQRT2PI_*phi8*sample.size() ), 1.0/9.0);
// estimate functionals via KDE with bandwidth from optimal MSE:
real phi4 = functionalPhiFast(sample, g1, 4);
phi6 = functionalPhiFast(sample, g2, 6);
// calculate constant prefactor in gamma expression:
gammaFactor_ = gammaFactor(phi4, phi6);
// parameters for boost root finder:
// initial guess is Silverman's rule of thumb:
real guess = 1.06*sigma/std::pow(sample.size(), 1.0/5.0);
real factor = 2.0;
boost::uintmax_t it = 20;
boost::math::tools::eps_tolerance<real> tol(std::numeric_limits<real>::digits - 4);
// objective function for root finding:
std::function<real(real)> objectiveFunction = std::bind(
&AmiseOptimalBandWidthEstimator::optimalBandwidthEquation,
this,
std::placeholders::_1,
sample);
// find root:
std::pair<real, real> root = bracket_and_solve_root(
objectiveFunction,
guess,
factor,
true,
tol,
it);
// return AMISE-optimal bandwidth (scaled back to original interval):
return root.first / ss.second;
}
/*!
* Calculates the eighth order density derivative functional:
*
* \f[
* \phi_6 = \frac{-15}{16 \sqrt{\pi} \sigma^7}
* \f]
*
* This is based on an approximation assuming a Gaussian probability density.
*/
real
AmiseOptimalBandWidthEstimator::functionalPhi6(real sigma)
{
return -15.0 / ( 16.0 * std::pow(sigma, 7) * SQRTPI_ );
}
/*!
* Calculates the eighth order density derivative functional:
*
* \f[
* \phi_8 = \frac{105}{32 \sqrt{\pi} \sigma^9}
* \f]
*
* This is based on an approximation assuming a Gaussian probability density.
*/
real
AmiseOptimalBandWidthEstimator::functionalPhi8(real sigma)
{
return 105.0 / ( 32.0 * std::pow(sigma, 9) * SQRTPI_ );
}
/*!
* Evaluation the functional
*
* \f[
* \Phi_r = \frac{1}{N}\sum_{i=1}^N p^{(r)}(s_i)
* \f]
*
* i.e. the sum over the density derivative evaluated at each sample point. The
* derivative itself is evaluated using the GaussianDensityDerivative class,
* which uses an approximate method to evaluate this expression in linear
* complexity with the number of sample points.
*/
real
AmiseOptimalBandWidthEstimator::functionalPhiFast(
const std::vector<real> &sample,
real bw,
int deriv)
{
// set density derivative estimation parameters:
gdd_.setErrorBound(0.01);
gdd_.setBandWidth(bw);
gdd_.setDerivOrder(deriv);
// obtain derivative estimate at each sample point:
std::vector<real> d = gdd_.estimateApprox(sample, sample);
// average of derivatives is estimate for phi:
real phi = std::accumulate(d.begin(), d.end(), 0.0);
phi /= sample.size();
// return phi parameter:
return phi;
}
/*!
* Computes the constant prefactor in gamma(), which needs to be assigned to
* gammaFactor_ prior to calling gamma().
*/
real
AmiseOptimalBandWidthEstimator::gammaFactor(
const real phi4,
const real phi6)
{
return std::pow(-6.0*std::sqrt(2.0)*phi4 / phi6 , 1.0/7.0);
}
/*!
* Returns the bandwidth, \f$ \gamma \f$, used to estimate the density
* derivative functional entering the optimalBandwidthEquation():
*
* \f[
* \gamma = \left[ \frac{-6\sqrt{2}\Phi_4(g_1)}{\Phi_6(g_2)} \right]^{\frac{1}{7}} h^{\frac{5}{7}}
* \f]
*
* Note that as the prefactor on square brackets is independent of \f$ h \f$,
* it is computed only once using gammaFactor() and stored in a member variable
* of AmiseOptimalBandWidthEstimator (this precompution must be carried out
* manually!).
*/
real
AmiseOptimalBandWidthEstimator::gamma(real bw)
{
return gammaFactor_ * std::pow(bw, 5.0/7.0);
}
/*!
* Returns the value for the implicit expression for the AMISE-optimal
* bandwidth:
*
* \f[
* h - \left[ \frac{1.0}{2\sqrt{\pi}\Phi_4\big(\gamma (h)\big) N} \right]^{\frac{1}{5}}
* \f]
*
* This is solved iteratively to obtain \f$ h \f$, which can then used to
* obtain a kernel density estimate via the KernelDensityEstimator class.
*/
real
AmiseOptimalBandWidthEstimator::optimalBandwidthEquation(
const real bw,
const std::vector<real> &samples)
{
// estimate density derivative functional:
real phi4 = functionalPhiFast(samples, gamma(bw), 4);
// evaluate optimal bandwidth equation:
return bw - std::pow(1.0/(2.0*SQRTPI_*phi4*samples.size()) , 1.0/5.0);
}
| [
"[email protected]"
] | |
a8a2637fae07090c0cac05a78407ce988adb0fe3 | f405913222192fdaaadee0fe64940b7bf40266df | /Plugins/AirSim/Source/AirSimGameMode.cpp | a610b90dac1c1fcdba441e9b20be5212064d7eea | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | InfiniteGamingProductions/AirSim-UGC | e6f96009520a1ae37d3eab4e9726c0179ca35e32 | fc2f2477fe8f0b9f8b707d4357b795d3c8b6e3a1 | refs/heads/main | 2023-05-09T00:49:19.726511 | 2021-06-01T10:23:45 | 2021-06-01T10:23:45 | 359,653,598 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,647 | cpp | #include "AirSimGameMode.h"
#include "Misc/FileHelper.h"
#include "SimHUD/SimHUD.h"
#include "common/Common.hpp"
#include "AirBlueprintLib.h"
class AUnrealLog : public msr::airlib::Utils::Logger
{
public:
virtual void log(int level, const std::string& message) override
{
size_t tab_pos;
static const std::string delim = ":\t";
if ((tab_pos = message.find(delim)) != std::string::npos) {
UAirBlueprintLib::LogMessageString(message.substr(0, tab_pos),
message.substr(tab_pos + delim.size(), std::string::npos), LogDebugLevel::Informational);
return; //display only
}
if (level == msr::airlib::Utils::kLogLevelError) {
UE_LOG(LogTemp, Error, TEXT("%s"), *FString(message.c_str()));
}
else if (level == msr::airlib::Utils::kLogLevelWarn) {
UE_LOG(LogTemp, Warning, TEXT("%s"), *FString(message.c_str()));
}
else {
UE_LOG(LogTemp, Log, TEXT("%s"), *FString(message.c_str()));
}
//#ifdef _MSC_VER
// //print to VS output window
// OutputDebugString(std::wstring(message.begin(), message.end()).c_str());
//#endif
//also do default logging
msr::airlib::Utils::Logger::log(level, message);
}
};
static AUnrealLog GlobalASimLog;
AAirSimGameMode::AAirSimGameMode(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
DefaultPawnClass = nullptr;
HUDClass = ASimHUD::StaticClass();
common_utils::Utils::getSetLogger(&GlobalASimLog);
}
void AAirSimGameMode::StartPlay()
{
Super::StartPlay();
}
| [
"[email protected]"
] | |
ce7f0226ff486b180beba45d7aecb54bb062fffb | cc8b1b01620fe4ea2dd181d2cdf7a15f44ef0d81 | /code/cpp/vtk-examples/cpp-examples/working-with-3d-data/registration/IterativeClosestPointsTransform.cxx | d2ba34bbc454b1999c9cc154994691cf3d5c60e7 | [] | no_license | santiagoom/vtk-examples | 2c73bca9efda3268ed69d79e54988b9393b1cf60 | 6324f302f3bd9d7ade3474c74086e530879e062c | refs/heads/main | 2023-07-16T02:10:55.862748 | 2021-08-19T06:55:32 | 2021-08-19T06:55:32 | 307,636,085 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,426 | cxx | #include <vtkActor.h>
#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkIterativeClosestPointTransform.h>
#include <vtkLandmarkTransform.h>
#include <vtkLine.h>
#include <vtkMath.h>
#include <vtkMatrix4x4.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkUnsignedCharArray.h>
#include <vtkVertexGlyphFilter.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLPolyDataWriter.h>
// For compatibility with new VTK generic data arrays
#ifdef vtkGenericDataArray_h
#define InsertNextTupleValue InsertNextTypedTuple
#endif
namespace {
void CreatePolyData(vtkSmartPointer<vtkPolyData> polydata);
void PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata);
void TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata);
void AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData);
} // namespace
int main(int argc, char* argv[])
{
vtkNew<vtkNamedColors> colors;
vtkNew<vtkPolyData> source;
vtkNew<vtkPolyData> target;
// An aid to orient the view of the created data.
vtkNew<vtkPolyData> linesPolyData;
auto createdData = false;
if (argc == 3)
{
std::cout << "Reading data..." << std::endl;
std::string strSource = argv[1];
std::string strTarget = argv[2];
vtkNew<vtkXMLPolyDataReader> sourceReader;
sourceReader->SetFileName(strSource.c_str());
sourceReader->Update();
source->ShallowCopy(sourceReader->GetOutput());
vtkNew<vtkXMLPolyDataReader> targetReader;
targetReader->SetFileName(strTarget.c_str());
targetReader->Update();
target->ShallowCopy(targetReader->GetOutput());
}
else
{
std::cout << "Creating data..." << std::endl;
CreatePolyData(source);
target->ShallowCopy(source);
TranslatePolyData(target);
PerturbPolyData(target);
AxesLines(linesPolyData);
createdData = true;
}
// Setup ICP transform
vtkNew<vtkIterativeClosestPointTransform> icp;
icp->SetSource(source);
icp->SetTarget(target);
icp->GetLandmarkTransform()->SetModeToRigidBody();
icp->SetMaximumNumberOfIterations(20);
// icp->StartByMatchingCentroidsOn();
icp->Modified();
icp->Update();
// Get the resulting transformation matrix (this matrix takes the source
// points to the target points)
vtkSmartPointer<vtkMatrix4x4> m = icp->GetMatrix();
std::cout << "The resulting matrix is: " << *m << std::endl;
// Transform the source points by the ICP solution
vtkNew<vtkTransformPolyDataFilter> icpTransformFilter;
icpTransformFilter->SetInputData(source);
icpTransformFilter->SetTransform(icp);
icpTransformFilter->Update();
/*
// If you need to take the target points to the source points, the matrix is:
icp->Inverse();
vtkSmartPointer<vtkMatrix4x4> minv = icp->GetMatrix();
std::cout << "The resulting inverse matrix is: " << *minv << std::cout;
*/
// Visualize
vtkNew<vtkPolyDataMapper> sourceMapper;
sourceMapper->SetInputData(source);
vtkNew<vtkActor> sourceActor;
sourceActor->SetMapper(sourceMapper);
sourceActor->GetProperty()->SetColor(colors->GetColor3d("Red").GetData());
sourceActor->GetProperty()->SetPointSize(5);
vtkNew<vtkPolyDataMapper> targetMapper;
targetMapper->SetInputData(target);
vtkNew<vtkActor> targetActor;
targetActor->SetMapper(targetMapper);
targetActor->GetProperty()->SetColor(colors->GetColor3d("Lime").GetData());
targetActor->GetProperty()->SetPointSize(5);
vtkNew<vtkPolyDataMapper> solutionMapper;
solutionMapper->SetInputConnection(icpTransformFilter->GetOutputPort());
vtkNew<vtkActor> solutionActor;
solutionActor->SetMapper(solutionMapper);
solutionActor->GetProperty()->SetColor(colors->GetColor3d("Blue").GetData());
solutionActor->GetProperty()->SetPointSize(5);
vtkNew<vtkPolyDataMapper> axesMapper;
vtkNew<vtkActor> axesActor;
if (createdData)
{
axesMapper->SetInputData(linesPolyData);
axesActor->SetMapper(axesMapper);
axesActor->GetProperty()->SetLineWidth(1);
}
// Create a renderer, render window, and interactor
vtkNew<vtkRenderer> renderer;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->SetWindowName("IterativeClosestPointsTransform");
// Add the actor to the scene
renderer->AddActor(sourceActor);
renderer->AddActor(targetActor);
renderer->AddActor(solutionActor);
if (createdData)
{
renderer->AddActor(axesActor);
}
renderer->SetBackground(colors->GetColor3d("lamp_black").GetData());
// Render and interact
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
namespace // anonymous
{
void CreatePolyData(vtkSmartPointer<vtkPolyData> polydata)
{
// This function creates a set of 4 points (the origin and a point unit
// distance along each axis)
vtkNew<vtkPoints> points;
// Create points
double origin[3] = {0.0, 0.0, 0.0};
points->InsertNextPoint(origin);
double p1[3] = {1.0, 0.0, 0.0};
points->InsertNextPoint(p1);
double p2[3] = {0.0, 1.0, 0.0};
points->InsertNextPoint(p2);
double p3[3] = {0.0, 0.0, 1.0};
points->InsertNextPoint(p3);
vtkNew<vtkPolyData> temp;
temp->SetPoints(points);
vtkNew<vtkVertexGlyphFilter> vertexFilter;
vertexFilter->SetInputData(temp);
vertexFilter->Update();
polydata->ShallowCopy(vertexFilter->GetOutput());
}
void PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata)
{
vtkNew<vtkPoints> points;
points->ShallowCopy(polydata->GetPoints());
for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)
{
double p[3];
points->GetPoint(i, p);
double perturb[3];
if (i % 3 == 0)
{
perturb[0] = .1;
perturb[1] = 0;
perturb[2] = 0;
}
else if (i % 3 == 1)
{
perturb[0] = 0;
perturb[1] = .1;
perturb[2] = 0;
}
else
{
perturb[0] = 0;
perturb[1] = 0;
perturb[2] = .1;
}
for (unsigned int j = 0; j < 3; j++)
{
p[j] += perturb[j];
}
points->SetPoint(i, p);
}
polydata->SetPoints(points);
}
void TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata)
{
vtkNew<vtkTransform> transform;
transform->Translate(0, .3, 0);
vtkNew<vtkTransformPolyDataFilter> transformFilter;
transformFilter->SetInputData(polydata);
transformFilter->SetTransform(transform);
transformFilter->Update();
polydata->ShallowCopy(transformFilter->GetOutput());
}
void AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData)
{
// Create four points
double origin[3] = {0.0, 0.0, 0.0};
double p0[3] = {1.2, 0.0, 0.0};
double p1[3] = {0.0, 1.5, 0.0};
double p2[3] = {0.0, 0.0, 1.2};
// Create a vtkPoints container and store the points in it
vtkNew<vtkPoints> pts;
pts->InsertNextPoint(origin);
pts->InsertNextPoint(p0);
pts->InsertNextPoint(p1);
pts->InsertNextPoint(p2);
// Add the points to the polydata container
linesPolyData->SetPoints(pts);
// Create the lines (between Origin and p0, ,p1, p2)
vtkNew<vtkLine> line0;
line0->GetPointIds()->SetId(0, 0);
line0->GetPointIds()->SetId(1, 1);
vtkNew<vtkLine> line1;
line1->GetPointIds()->SetId(0, 0);
line1->GetPointIds()->SetId(1, 2);
vtkNew<vtkLine> line2;
line2->GetPointIds()->SetId(0, 0);
line2->GetPointIds()->SetId(1, 3);
// Create a vtkCellArray container and store the lines in it
vtkNew<vtkCellArray> lines;
lines->InsertNextCell(line0);
lines->InsertNextCell(line1);
lines->InsertNextCell(line2);
// Add the lines to the polydata container
linesPolyData->SetLines(lines);
vtkNew<vtkNamedColors> namedColors;
// Create a vtkUnsignedCharArray container and store the colors in it
vtkNew<vtkUnsignedCharArray> colors;
colors->SetNumberOfComponents(3);
colors->InsertNextTupleValue(namedColors->GetColor3ub("DarkRed").GetData());
colors->InsertNextTupleValue(namedColors->GetColor3ub("DarkGreen").GetData());
colors->InsertNextTupleValue(namedColors->GetColor3ub("SteelBlue").GetData());
// Color the lines.
linesPolyData->GetCellData()->SetScalars(colors);
}
} // end anonymous namespace
| [
"[email protected]"
] | |
0f87f51c808bf92b2b4689781d5bb96ea4d33f9b | 66862c422fda8b0de8c4a6f9d24eced028805283 | /slambook2/3rdparty/ceres-solver/include/ceres/ordered_groups.h | ecba24c824ad0c8cf48125f3baaa1d9187814e4e | [
"BSD-3-Clause",
"MIT"
] | permissive | zhh2005757/slambook2_in_Docker | 57ed4af958b730e6f767cd202717e28144107cdb | f0e71327d196cdad3b3c10d96eacdf95240d528b | refs/heads/main | 2023-09-01T03:26:37.542232 | 2021-10-27T11:45:47 | 2021-10-27T11:45:47 | 416,666,234 | 17 | 6 | MIT | 2021-10-13T09:51:00 | 2021-10-13T09:12:15 | null | UTF-8 | C++ | false | false | 6,670 | h | // Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: [email protected] (Sameer Agarwal)
#ifndef CERES_PUBLIC_ORDERED_GROUPS_H_
#define CERES_PUBLIC_ORDERED_GROUPS_H_
#include <map>
#include <set>
#include <unordered_map>
#include <vector>
#include "ceres/internal/port.h"
#include "glog/logging.h"
namespace ceres {
// A class for storing and manipulating an ordered collection of
// groups/sets with the following semantics:
//
// Group ids are non-negative integer values. Elements are any type
// that can serve as a key in a map or an element of a set.
//
// An element can only belong to one group at a time. A group may
// contain an arbitrary number of elements.
//
// Groups are ordered by their group id.
template <typename T>
class OrderedGroups {
public:
// Add an element to a group. If a group with this id does not
// exist, one is created. This method can be called any number of
// times for the same element. Group ids should be non-negative
// numbers.
//
// Return value indicates if adding the element was a success.
bool AddElementToGroup(const T element, const int group) {
if (group < 0) {
return false;
}
auto it = element_to_group_.find(element);
if (it != element_to_group_.end()) {
if (it->second == group) {
// Element is already in the right group, nothing to do.
return true;
}
group_to_elements_[it->second].erase(element);
if (group_to_elements_[it->second].size() == 0) {
group_to_elements_.erase(it->second);
}
}
element_to_group_[element] = group;
group_to_elements_[group].insert(element);
return true;
}
void Clear() {
group_to_elements_.clear();
element_to_group_.clear();
}
// Remove the element, no matter what group it is in. Return value
// indicates if the element was actually removed.
bool Remove(const T element) {
const int current_group = GroupId(element);
if (current_group < 0) {
return false;
}
group_to_elements_[current_group].erase(element);
if (group_to_elements_[current_group].size() == 0) {
// If the group is empty, then get rid of it.
group_to_elements_.erase(current_group);
}
element_to_group_.erase(element);
return true;
}
// Bulk remove elements. The return value indicates the number of
// elements successfully removed.
int Remove(const std::vector<T>& elements) {
if (NumElements() == 0 || elements.size() == 0) {
return 0;
}
int num_removed = 0;
for (int i = 0; i < elements.size(); ++i) {
num_removed += Remove(elements[i]);
}
return num_removed;
}
// Reverse the order of the groups in place.
void Reverse() {
if (NumGroups() == 0) {
return;
}
auto it = group_to_elements_.rbegin();
std::map<int, std::set<T>> new_group_to_elements;
new_group_to_elements[it->first] = it->second;
int new_group_id = it->first + 1;
for (++it; it != group_to_elements_.rend(); ++it) {
for (const auto& element : it->second) {
element_to_group_[element] = new_group_id;
}
new_group_to_elements[new_group_id] = it->second;
new_group_id++;
}
group_to_elements_.swap(new_group_to_elements);
}
// Return the group id for the element. If the element is not a
// member of any group, return -1.
int GroupId(const T element) const {
auto it = element_to_group_.find(element);
if (it == element_to_group_.end()) {
return -1;
}
return it->second;
}
bool IsMember(const T element) const {
auto it = element_to_group_.find(element);
return (it != element_to_group_.end());
}
// This function always succeeds, i.e., implicitly there exists a
// group for every integer.
int GroupSize(const int group) const {
auto it = group_to_elements_.find(group);
return (it == group_to_elements_.end()) ? 0 : it->second.size();
}
int NumElements() const {
return element_to_group_.size();
}
// Number of groups with one or more elements.
int NumGroups() const {
return group_to_elements_.size();
}
// The first group with one or more elements. Calling this when
// there are no groups with non-zero elements will result in a
// crash.
int MinNonZeroGroup() const {
CHECK_NE(NumGroups(), 0);
return group_to_elements_.begin()->first;
}
const std::map<int, std::set<T>>& group_to_elements() const {
return group_to_elements_;
}
const std::map<T, int>& element_to_group() const {
return element_to_group_;
}
private:
std::map<int, std::set<T>> group_to_elements_;
std::unordered_map<T, int> element_to_group_;
};
// Typedef for the most commonly used version of OrderedGroups.
typedef OrderedGroups<double*> ParameterBlockOrdering;
} // namespace ceres
#endif // CERES_PUBLIC_ORDERED_GROUP_H_
| [
"[email protected]"
] | |
a35238b0c05b7091bf6dbc857935a8903a16ee27 | 2b448c61a302f7623fdcbb9094f6d14242199d78 | /project/main/cpp/ui/MainWindow.h | 8a617cbb0c7b8971fb5b27ab9967491274df4657 | [] | no_license | iosifsecheleadan/movie-collection-manager | 71b75704e95d631bd2f54571f1e0929e2d468e70 | 04aeb22179fa512628d62684d629eec29226d92e | refs/heads/master | 2023-03-21T10:43:32.759410 | 2020-06-01T06:56:06 | 2020-06-01T06:56:06 | 346,054,712 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,531 | h | //
// Created by sechelea on 5/25/20.
//
#pragma once
#include <utility>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QListView>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QLabel>
#include <QtCore/QStringListModel>
#include <QtWidgets/QMessageBox>
#include <project/main/cpp/domain/validator/ValidatorException.h>
#include <QtWidgets/QShortcut>
#include "project/main/cpp/domain/entity/Movie.h"
#include "../ctrl/Administrator.h"
#include "UserInterfaceException.h"
#include "project/main/cpp/ctrl/UndoRedoController.h"
class MainWindow : public QMainWindow{
Q_OBJECT
private:
// OBJECTS
Controller<Movie>* user;
Administrator* admin;
UndoRedoController<Movie> *undoRedo;
std::string fileLocation;
QWidget* main;
QGridLayout* gridLayout;
QLabel* dataBaseLabel;
QListView* dataBaseList;
QLineEdit* addMovieEdit;
QPushButton* addNewButton;
QPushButton* removeButton;
QPushButton* updateButton;
QPushButton* adminOpenHTML;
QPushButton* adminOpenCSV;
QPushButton* watchTrailer;
QPushButton* adminUndo;
QPushButton* adminRedo;
QShortcut* ctrlZ;
QShortcut* ctrlY;
QLabel* watchListLabel;
QListView* watchList;
QLabel* searchMovieLabel;
QLineEdit* searchMovieEdit;
QPushButton* watchMovie;
QPushButton* userOpenHTML;
QPushButton* userOpenCSV;
// UI SET UP
void setUp() {
this->main = new QWidget();
this->gridLayout = new QGridLayout();
this->setUpAdmin();
this->setUpUser();
this->main->setLayout(this->gridLayout);
this->setCentralWidget(this->main);
}
void setUpUser() {
this->watchListLabel = new QLabel("Move Watch List");
this->watchList = new QListView();
this->watchList->setEditTriggers(QAbstractItemView::NoEditTriggers);
this->searchMovieLabel = new QLabel("Search Movies by Genre:");
this->searchMovieEdit = new QLineEdit("Search");
this->searchMovieEdit->setToolTip("Search Movies in Watch List and in Data Base By Genre");
connect(searchMovieEdit, SIGNAL(textChanged(const QString&)), this, SLOT(searchByGenre(const QString&)));
this->watchMovie = new QPushButton("Watch Movie");
this->watchMovie->setToolTip("Open Selected Movie in new Tab\nDelete and Rate Selected Movie");
connect(watchMovie, SIGNAL(released()), this, SLOT(watchSelectedMovie()));
this->userOpenCSV = new QPushButton("Open CSV");
this->userOpenCSV->setToolTip("Open Saved CSV File");
connect(userOpenCSV, SIGNAL(released()), this, SLOT(openUserCSV()));
this->userOpenHTML = new QPushButton("Open HTML");
this->userOpenHTML->setToolTip("Open Saved HTML File");
connect(userOpenHTML, SIGNAL(released()), this, SLOT(openUserHTML()));
this->gridLayout->addWidget(this->watchListLabel, 0, 3, 1, 3);
this->gridLayout->addWidget(this->watchList, 1, 3, 1, 3);
this->gridLayout->addWidget(this->userOpenCSV, 2, 3);
this->gridLayout->addWidget(this->userOpenHTML, 2, 4);
this->gridLayout->addWidget(this->watchMovie, 2, 5);
this->gridLayout->addWidget(this->searchMovieLabel, 3, 3, 1, 3);
this->gridLayout->addWidget(this->searchMovieEdit, 4, 3, 1, 3);
}
void setUpAdmin() {
this->dataBaseLabel = new QLabel("Movie Data Base");
this->dataBaseList = new QListView();
this->dataBaseList->setEditTriggers(QAbstractItemView::NoEditTriggers);
this->addMovieEdit = new QLineEdit("Input New Movie data");
this->addNewButton = new QPushButton("Add");
this->addNewButton->setToolTip("Add New Movie");
connect(addNewButton, SIGNAL(released()), this, SLOT(addNewMovie()));
this->removeButton = new QPushButton("Remove");
this->removeButton->setToolTip("Remove Selected Movie");
connect(removeButton, SIGNAL(released()), this, SLOT(removeSelectedMovie()));
this->updateButton = new QPushButton("Update");
this->updateButton->setToolTip("Update Selected Movie with New Movie");
connect(updateButton, SIGNAL(released()), this, SLOT(updateSelectedMovie()));
this->adminOpenCSV = new QPushButton("Open CSV");
this->adminOpenCSV->setToolTip("Open Saved CSV File");
connect(adminOpenCSV, SIGNAL(released()), this, SLOT(openAdminCSV()));
this->adminOpenHTML = new QPushButton("Open HTML");
this->adminOpenHTML->setToolTip("Open Saved HTML File");
connect(adminOpenHTML, SIGNAL(released()), this, SLOT(openAdminHTML()));
this->watchTrailer = new QPushButton("Watch Trailer");
this->watchTrailer->setToolTip("Open Trailer of Selected Movie in new Tab");
connect(watchTrailer, SIGNAL(released()), this, SLOT(watchSelectedTrailer()));
this->adminUndo = new QPushButton("UNDO");
this->adminUndo->setToolTip("Undo Previous Change made to Data Base");
connect(adminUndo, SIGNAL(released()), this, SLOT(undo()));
this->ctrlZ = new QShortcut(QKeySequence("Ctrl+Z"), this);
connect(ctrlZ, SIGNAL(activated()), this, SLOT(undo()));
this->adminRedo = new QPushButton("REDO");
this->adminRedo->setToolTip("Redo Previous Undo made to Data Base");
connect(adminRedo, SIGNAL(released()), this, SLOT(redo()));
this->ctrlY = new QShortcut(QKeySequence("Ctrl+Y"), this);
connect(ctrlY, SIGNAL(activated()), this, SLOT(redo()));
this->gridLayout->addWidget(this->dataBaseLabel, 0, 0, 1, 3);
this->gridLayout->addWidget(this->dataBaseList, 1, 0, 1, 3);
this->gridLayout->addWidget(this->adminOpenCSV, 2, 0);
this->gridLayout->addWidget(this->adminOpenHTML, 2, 1);
this->gridLayout->addWidget(this->watchTrailer, 2, 2);
this->gridLayout->addWidget(this->addNewButton, 3, 0);
this->gridLayout->addWidget(this->removeButton, 3, 1);
this->gridLayout->addWidget(this->updateButton, 3, 2);
this->gridLayout->addWidget(this->addMovieEdit, 4, 0, 1, 3);
this->gridLayout->addWidget(this->adminUndo, 5, 0);
this->gridLayout->addWidget(this->adminRedo, 5, 1);
}
// LOAD AND SAVE FILES
void loadFiles() {
this->admin->loadCSV(this->fileLocation + "/admin.csv");
this->user->loadCSV(this->fileLocation + "/user.csv");
}
void saveFiles() {
this->admin->saveCSV(this->fileLocation + "/admin.csv");
this->user->saveCSV(this->fileLocation + "/user.csv");
this->admin->saveHTML(this->fileLocation + "/admin.html");
this->user->saveHTML(this->fileLocation + "/user.html");
}
// REFRESH - load tables after add / remove / update
void refreshTables() {
this->refreshDataBase();
this->refreshWatchList();
}
void refreshWatchList() {
QStringListModel* model = new QStringListModel(this);
QStringList stringList;
for(int index = 0; index < this->user->size(); index += 1) {
stringList.append(QString(
this->user->getToString(index)
.c_str()));
}
model->setStringList(stringList);
this->watchList->setModel(model);
this->watchList->update();
}
void refreshDataBase() {
QStringListModel* model = new QStringListModel(this);
QStringList stringList;
for(int index = 0; index < this->admin->size(); index += 1) {
stringList.append(QString(
this->admin->getToString(index)
.c_str()));
}
model->setStringList(stringList);
this->dataBaseList->setModel(model);
this->dataBaseList->update();
}
// MESSAGE BOXES
void errorMessage(QString message) {
QMessageBox box;
message = "There has been an ERROR:\n\t" + message;
box.critical(this, "Error", message);
box.show();
}
void simpleMessage(const QString& message) {
QMessageBox box;
box.setWindowTitle("Message");
box.setText(message);
box.exec();
}
// FILTER
void filterUser(const std::string& string) {
QStringListModel* model = new QStringListModel(this);
QStringList stringList;
for(int index = 0; index < this->user->size(); index += 1) {
Movie movie = this->user->get(index);
if(movie.getGenre().find(string) != std::string::npos) {
stringList.append(QString(
movie.toString(",")
.c_str()));
}
}
model->setStringList(stringList);
this->watchList->setModel(model);
this->watchList->update();
}
void filterAdmin(const std::string& string) {
QStringListModel* model = new QStringListModel(this);
QStringList stringList;
for(int index = 0; index < this->admin->size(); index += 1) {
Movie movie = this->admin->get(index);
if(movie.getGenre().find(string) != std::string::npos) {
stringList.append(QString(
movie.toString(",")
.c_str()));
}
}
model->setStringList(stringList);
this->dataBaseList->setModel(model);
this->dataBaseList->update();
}
// OTHER
void closeEvent(QCloseEvent* event) override {
this->saveFiles();
QMainWindow::closeEvent(event);
}
static void openWithDefault(const std::string& thing) {
system(("xdg-open " + thing).c_str());
}
private slots:
void addNewMovie() {
std::string string = this->addMovieEdit->text().toStdString();
try { Movie* movie = new Movie(string);
this->admin->add(*movie);
this->undoRedo->addOperation("add", *movie);
this->refreshDataBase();
} catch (MainException& exception) { this->errorMessage(exception.what()); return;}
}
void removeSelectedMovie() {
if(this->dataBaseList->selectionModel()->selectedIndexes().empty()) {
this->errorMessage("Please Select a Movie from the Movie Data Base"); return;
}
QModelIndex index = this->dataBaseList->selectionModel()->selectedIndexes().first();
std::string data = index.data().toString().toStdString();
try { Movie *movie = new Movie(data);
this->admin->remove(*movie);
this->undoRedo->addOperation("remove", *movie);
this->refreshDataBase();
} catch (MainException& exception) { this->errorMessage(exception.what()); return; }
}
void updateSelectedMovie() {
std::string string = this->addMovieEdit->text().toStdString();
if(this->dataBaseList->selectionModel()->selectedIndexes().empty()) {
this->errorMessage("Please Select a Movie from the Movie Data Base"); return;
}
QModelIndex index = this->dataBaseList->selectionModel()->selectedIndexes().first();
std::string data = index.data().toString().toStdString();
try { Movie* newMovie = new Movie(string);
Movie* selected = new Movie(data);
this->admin->update(*selected, *newMovie);
this->undoRedo->addOperation("update old", *selected);
this->undoRedo->addOperation("update new", *newMovie);
this->refreshDataBase();
} catch (MainException& exception) { this->errorMessage(exception.what()); }
}
void openUserCSV() {
this->saveFiles();
openWithDefault(this->fileLocation + "/user.csv");
}
void openUserHTML() {
this->saveFiles();
openWithDefault(this->fileLocation + "/user.html");
}
void openAdminCSV() {
openWithDefault(this->fileLocation + "/admin.csv");
this->saveFiles();
}
void openAdminHTML() {
this->saveFiles();
openWithDefault(this->fileLocation + "/admin.html");
}
void searchByGenre(const QString& string) {
this->filterUser(string.toStdString());
this->filterAdmin(string.toStdString());
}
void watchSelectedTrailer() {
if(this->dataBaseList->selectionModel()->selectedIndexes().empty()) {
this->errorMessage("Please Select a Movie from the Movie Data Base"); return;
}
QModelIndex index = this->dataBaseList->selectionModel()->selectedIndexes().first();
std::string data = index.data().toString().toStdString();
try {
Movie* movie = new Movie(data);
this->openWithDefault(movie->getLinkToTrailer());
if(askUserYesNo("Did you like the Trailer?",
"Would you like to save the Movie to your Watch List?")
== QMessageBox::Yes) {
this->user->add(*movie);
this->refreshWatchList();
}
} catch (MainException& exception) { this->errorMessage(exception.what()); return; }
}
void watchSelectedMovie() {
if(this->watchList->selectionModel()->selectedIndexes().empty()) {
this->errorMessage("Please Select a Movie from the Watch List");
}
QModelIndex index = this->watchList->selectionModel()->selectedIndexes().first();
std::string data = index.data().toString().toStdString();
try { Movie *movie = new Movie(data);
this->openWithDefault(movie->getLinkToMovie());
if (askUserYesNo("Did you like the Movie?",
"Would you like to give it a Like")
== QMessageBox::Yes) {
Movie *newMovie = new Movie(*movie);
newMovie->setNoLikes(newMovie->getNoLikes() + 1);
this->admin->update(*movie, *newMovie);
}
this->user->remove(*movie);
this->refreshTables();
} catch (MainException& exception) { this->errorMessage(exception.what()); return; }
}
static int askUserYesNo(const QString& question, const QString& details) {
QMessageBox messageBox;
messageBox.setText(question);
messageBox.setInformativeText(details);
messageBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
messageBox.setDefaultButton(QMessageBox::Yes);
return messageBox.exec();
}
void undo() {
try {
auto operation = this->undoRedo->undo();
if (operation.first == "add") {
this->admin->remove(operation.second);
} else if (operation.first == "remove") {
this->admin->add(operation.second);
} else if (operation.first.rfind("update", 0) == 0) {
auto nextOperation = this->undoRedo->undo();
this->admin->update(operation.second, nextOperation.second);
} else { throw MainException("Unknown Operation"); }
this->refreshDataBase();
} catch (MainException& ex) { this->errorMessage(ex.what()); }
}
void redo() {
try {
auto operation = this->undoRedo->redo();
if (operation.first == "add") {
this->admin->add(operation.second);
} else if (operation.first == "remove") {
this->admin->remove(operation.second);
} else if(operation.first.rfind("update", 0) == 0) {
auto nextOperation = this->undoRedo->redo();
this->admin->update(operation.second, nextOperation.second);
} else { throw MainException("Unknown Operation"); }
this->refreshDataBase();
} catch (MainException& ex) { this->errorMessage(ex.what()); }
}
public:
MainWindow(Controller<Movie>* administrator, Controller<Movie>* user, UndoRedoController<Movie>* undoRedo, std::string fileLocation) {
this->admin = (Administrator *) administrator;
this->user = user;
this->undoRedo = undoRedo;
this->fileLocation = std::move(fileLocation);
this->setUp();
this->loadFiles();
this->refreshTables();
}
void run() {
this->show();
}
};
| [
"[email protected]"
] | |
7fde23bd58a1fd6b03253f9c9e432e6a766a458b | ec0a8e179459bfa15b3abfd21df2ea33d201f0bd | /Codigo/Versao2017comp3/states/pededisco.hpp | b809efa145b744b7b2ebe9541ced88e1ecb04747 | [] | no_license | UnbDroid/Festo2017 | b32fbf61e6a703feb1d04e47b765186f2ecca376 | eb4afb447bbb6cb1016a289231071471c6228e6e | refs/heads/master | 2021-01-20T02:47:59.381718 | 2017-11-11T07:48:35 | 2017-11-11T07:48:35 | 101,334,390 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 673 | hpp | #ifndef PedeDisco_HPP
#define PedeDisco_HPP
#include "robotinostate.hpp"
class PedeDisco: public RobotinoState
{
public:
/** Singleton. */
static PedeDisco *instance();
/**
* Called when entering the PedeDisco state.
*
* @param bigbob the robot that is moving to it's goal'.
*/
void enter(Robotino *robotino);
/**
*
* @param bigbob the robot to PedeDisco.
*/
void execute(Robotino *robotino);
/**
* Called when leaving the PedeDisco state.
*
* @param bigbob the robot that is moving to it's goal.
*/
void exit(Robotino *robotino);
private:
PedeDisco();
~PedeDisco();
};
#endif | [
"[email protected]"
] | |
207b08725de7fdcd45c26bd4f0e6ea81de6d5984 | fa889d051a1b3c4d861fb06b10aa5b2e21f97123 | /kbe/src/lib/entitydef/property.cpp | 53bceaddb441592142991f27e0850947950f7268 | [
"MIT",
"LGPL-3.0-only"
] | permissive | BuddhistDeveloper/HeroLegendServer | bcaa837e3bbd6544ce0cf8920fd54a1a324d95c8 | 8bf77679595a2c49c6f381c961e6c52d31a88245 | refs/heads/master | 2022-12-08T00:32:45.623725 | 2018-01-15T02:01:44 | 2018-01-15T02:01:44 | 117,069,431 | 1 | 1 | MIT | 2022-11-19T15:58:30 | 2018-01-11T08:05:32 | Python | GB18030 | C++ | false | false | 14,067 | cpp | /*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2017 KBEngine.
KBEngine 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 3 of the License, or
(at your option) any later version.
KBEngine 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 KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "datatypes.h"
#include "entitydef.h"
#include "property.h"
#include "pyscript/vector2.h"
#include "pyscript/vector3.h"
#include "pyscript/vector4.h"
#include "pyscript/copy.h"
#ifndef CODE_INLINE
#include "property.inl"
#endif
namespace KBEngine{
uint32 PropertyDescription::propertyDescriptionCount_ = 0;
//-------------------------------------------------------------------------------------
PropertyDescription::PropertyDescription(ENTITY_PROPERTY_UID utype,
std::string dataTypeName,
std::string name, uint32 flags,
bool isPersistent,
DataType* dataType,
bool isIdentifier,
std::string indexType,
uint32 databaseLength,
std::string defaultStr,
DETAIL_TYPE detailLevel):
name_(name),
dataTypeName_(dataTypeName),
flags_(flags),
isPersistent_(isPersistent),
dataType_(dataType),
isIdentifier_(isIdentifier),
databaseLength_(databaseLength),
utype_(utype),
defaultValStr_(defaultStr),
detailLevel_(detailLevel),
aliasID_(-1),
indexType_(indexType)
{
dataType_->incRef();
// mailbox 无法保存
if(isPersistent && strcmp(dataType_->getName(), "MAILBOX") == 0)
{
isPersistent_ = false;
}
EntityDef::md5().append((void*)name_.c_str(), (int)name_.size());
EntityDef::md5().append((void*)defaultValStr_.c_str(), (int)defaultValStr_.size());
EntityDef::md5().append((void*)dataTypeName.c_str(), (int)dataTypeName.size());
EntityDef::md5().append((void*)&utype_, sizeof(ENTITY_PROPERTY_UID));
EntityDef::md5().append((void*)&flags_, sizeof(uint32));
EntityDef::md5().append((void*)&isPersistent_, sizeof(bool));
EntityDef::md5().append((void*)&isIdentifier_, sizeof(bool));
EntityDef::md5().append((void*)&databaseLength_, sizeof(uint32));
EntityDef::md5().append((void*)&detailLevel_, sizeof(int8));
DATATYPE_UID uid = dataType->id();
EntityDef::md5().append((void*)&uid, sizeof(DATATYPE_UID));
PropertyDescription::propertyDescriptionCount_++;
if(dataType == NULL)
{
ERROR_MSG(fmt::format("PropertyDescription::PropertyDescription: {} DataType is NULL, in property[{}].\n",
dataTypeName.c_str(), name_.c_str()));
}
}
//-------------------------------------------------------------------------------------
PropertyDescription::~PropertyDescription()
{
dataType_->decRef();
}
//-------------------------------------------------------------------------------------
void PropertyDescription::addToStream(MemoryStream* mstream, PyObject* pyValue)
{
dataType_->addToStream(mstream, pyValue);
}
//-------------------------------------------------------------------------------------
PyObject* PropertyDescription::createFromStream(MemoryStream* mstream)
{
return dataType_->createFromStream(mstream);
}
//-------------------------------------------------------------------------------------
PyObject* PropertyDescription::parseDefaultStr(const std::string& defaultVal)
{
return dataType_->parseDefaultStr(defaultVal);
}
//-------------------------------------------------------------------------------------
void PropertyDescription::addPersistentToStream(MemoryStream* mstream, PyObject* pyValue)
{
// 允许使用默认值来创建一个流
if(pyValue == NULL)
{
pyValue = newDefaultVal();
dataType_->addToStream(mstream, pyValue);
Py_DECREF(pyValue);
return;
}
dataType_->addToStream(mstream, pyValue);
}
//-------------------------------------------------------------------------------------
PyObject* PropertyDescription::createFromPersistentStream(MemoryStream* mstream)
{
return dataType_->createFromStream(mstream);
}
//-------------------------------------------------------------------------------------
PropertyDescription* PropertyDescription::createDescription(ENTITY_PROPERTY_UID utype,
std::string& dataTypeName,
std::string& name,
uint32 flags,
bool isPersistent,
DataType* dataType,
bool isIdentifier,
std::string indexType,
uint32 databaseLength,
std::string& defaultStr,
DETAIL_TYPE detailLevel)
{
PropertyDescription* propertyDescription = NULL;
if(dataTypeName == "FIXED_DICT" ||
strcmp(dataType->getName(), "FIXED_DICT") == 0)
{
propertyDescription = new FixedDictDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel);
}
else if(dataTypeName == "ARRAY" ||
strcmp(dataType->getName(), "ARRAY") == 0)
{
propertyDescription = new ArrayDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel);
}
else if(dataTypeName == "VECTOR2" ||
strcmp(dataType->getName(), "VECTOR2") == 0)
{
propertyDescription = new VectorDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel, 2);
}
else if(dataTypeName == "VECTOR3" ||
strcmp(dataType->getName(), "VECTOR3") == 0)
{
propertyDescription = new VectorDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel, 3);
}
else if(dataTypeName == "VECTOR4" ||
strcmp(dataType->getName(), "VECTOR4") == 0)
{
propertyDescription = new VectorDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel, 4);
}
else
{
propertyDescription = new PropertyDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength,
defaultStr, detailLevel);
}
return propertyDescription;
}
//-------------------------------------------------------------------------------------
PyObject* PropertyDescription::newDefaultVal(void)
{
return dataType_->parseDefaultStr(defaultValStr_);
}
//-------------------------------------------------------------------------------------
PyObject* PropertyDescription::onSetValue(PyObject* parentObj, PyObject* value)
{
PyObject* pyName = PyUnicode_InternFromString(getName());
int result = PyObject_GenericSetAttr(parentObj, pyName, value);
Py_DECREF(pyName);
if(result == -1)
return NULL;
return value;
}
//-------------------------------------------------------------------------------------
FixedDictDescription::FixedDictDescription(ENTITY_PROPERTY_UID utype,
std::string dataTypeName,
std::string name,
uint32 flags,
bool isPersistent,
DataType* dataType,
bool isIdentifier,
std::string indexType,
uint32 databaseLength,
std::string defaultStr,
DETAIL_TYPE detailLevel):
PropertyDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength, defaultStr, detailLevel)
{
KBE_ASSERT(dataType->type() == DATA_TYPE_FIXEDDICT);
/*
FixedDictType::FIXEDDICT_KEYTYPE_MAP& keyTypes =
static_cast<FixedDictType*>(dataType)->getKeyTypes();
FixedDictType::FIXEDDICT_KEYTYPE_MAP::iterator iter = keyTypes.begin();
for(; iter != keyTypes.end(); ++iter)
{
PropertyDescription* pPropertyDescription = PropertyDescription::createDescription(0,
std::string(iter->second->getName()), iter->first, flags, isPersistent, iter->second, false, 0, std::string(), detailLevel);
}
*/
}
//-------------------------------------------------------------------------------------
FixedDictDescription::~FixedDictDescription()
{
}
//-------------------------------------------------------------------------------------
PyObject* FixedDictDescription::onSetValue(PyObject* parentObj, PyObject* value)
{
if(static_cast<FixedDictType*>(dataType_)->isSameType(value))
{
FixedDictType* dataType = static_cast<FixedDictType*>(this->getDataType());
PyObject* pyobj = dataType->createNewFromObj(value);
PropertyDescription::onSetValue(parentObj, pyobj);
Py_DECREF(pyobj);
return pyobj;
}
return NULL;
}
//-------------------------------------------------------------------------------------
void FixedDictDescription::addPersistentToStream(MemoryStream* mstream, PyObject* pyValue)
{
// 允许使用默认值来创建一个流
if(pyValue == NULL)
{
pyValue = newDefaultVal();
static_cast<FixedDictType*>(dataType_)->addToStreamEx(mstream, pyValue, true);
Py_DECREF(pyValue);
return;
}
static_cast<FixedDictType*>(dataType_)->addToStreamEx(mstream, pyValue, true);
}
//-------------------------------------------------------------------------------------
PyObject* FixedDictDescription::createFromPersistentStream(MemoryStream* mstream)
{
return ((FixedDictType*)dataType_)->createFromStreamEx(mstream, true);
}
//-------------------------------------------------------------------------------------
ArrayDescription::ArrayDescription(ENTITY_PROPERTY_UID utype,
std::string dataTypeName,
std::string name,
uint32 flags,
bool isPersistent,
DataType* dataType,
bool isIdentifier,
std::string indexType,
uint32 databaseLength,
std::string defaultStr,
DETAIL_TYPE detailLevel):
PropertyDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength, defaultStr, detailLevel)
{
}
//-------------------------------------------------------------------------------------
ArrayDescription::~ArrayDescription()
{
}
//-------------------------------------------------------------------------------------
PyObject* ArrayDescription::onSetValue(PyObject* parentObj, PyObject* value)
{
if(static_cast<FixedArrayType*>(dataType_)->isSameType(value))
{
FixedArrayType* dataType = static_cast<FixedArrayType*>(this->getDataType());
PyObject* pyobj = dataType->createNewFromObj(value);
PropertyDescription::onSetValue(parentObj, pyobj);
Py_DECREF(pyobj);
return pyobj;
}
return NULL;
}
//-------------------------------------------------------------------------------------
void ArrayDescription::addPersistentToStream(MemoryStream* mstream, PyObject* pyValue)
{
// 允许使用默认值来创建一个流
if(pyValue == NULL)
{
pyValue = newDefaultVal();
static_cast<FixedArrayType*>(dataType_)->addToStreamEx(mstream, pyValue, true);
Py_DECREF(pyValue);
return;
}
static_cast<FixedArrayType*>(dataType_)->addToStreamEx(mstream, pyValue, true);
}
//-------------------------------------------------------------------------------------
PyObject* ArrayDescription::createFromPersistentStream(MemoryStream* mstream)
{
return ((FixedArrayType*)dataType_)->createFromStreamEx(mstream, true);
}
//-------------------------------------------------------------------------------------
VectorDescription::VectorDescription(ENTITY_PROPERTY_UID utype,
std::string dataTypeName,
std::string name,
uint32 flags,
bool isPersistent,
DataType* dataType,
bool isIdentifier,
std::string indexType,
uint32 databaseLength,
std::string defaultStr,
DETAIL_TYPE detailLevel,
uint8 elemCount):
PropertyDescription(utype, dataTypeName, name, flags, isPersistent,
dataType, isIdentifier, indexType, databaseLength, defaultStr, detailLevel),
elemCount_(elemCount)
{
}
//-------------------------------------------------------------------------------------
VectorDescription::~VectorDescription()
{
}
//-------------------------------------------------------------------------------------
PyObject* VectorDescription::onSetValue(PyObject* parentObj, PyObject* value)
{
switch(elemCount_)
{
case 2:
{
if(PyObject_TypeCheck(value, script::ScriptVector2::getScriptType()))
{
return PropertyDescription::onSetValue(parentObj, value);
}
else
{
PyObject* pyobj = PyObject_GetAttrString(parentObj, const_cast<char*>(getName()));
if(pyobj == NULL)
return NULL;
script::ScriptVector2* v = static_cast<script::ScriptVector2*>(pyobj);
v->__py_pySet(v, value);
Py_XDECREF(pyobj);
return v;
}
}
break;
case 3:
{
if(PyObject_TypeCheck(value, script::ScriptVector3::getScriptType()))
{
return PropertyDescription::onSetValue(parentObj, value);
}
else
{
PyObject* pyobj = PyObject_GetAttrString(parentObj, const_cast<char*>(getName()));
if(pyobj == NULL)
return NULL;
script::ScriptVector3* v = static_cast<script::ScriptVector3*>(pyobj);
v->__py_pySet(v, value);
Py_XDECREF(pyobj);
return v;
}
}
break;
case 4:
{
if(PyObject_TypeCheck(value, script::ScriptVector4::getScriptType()))
{
return PropertyDescription::onSetValue(parentObj, value);
}
else
{
PyObject* pyobj = PyObject_GetAttrString(parentObj, const_cast<char*>(getName()));
if(pyobj == NULL)
return NULL;
script::ScriptVector4* v = static_cast<script::ScriptVector4*>(pyobj);
v->__py_pySet(v, value);
Py_XDECREF(pyobj);
return v;
}
}
break;
};
return NULL;
}
}
| [
"[email protected]"
] | |
40aa59cf3aabbf10391c89aa810c65e74ae89484 | 25a44ce978c53666bbe162b372298ac5eed432f4 | /Uri/1117-Validacao_de_nota.cpp | 44374651b1d1c8732c952179ba520944b847dd0a | [] | no_license | Kanchii/Online_Judge_Problems | 85304dfaf4d12516c8a511e9b9957ab59cc77a71 | 4bac6d7e547a01cd81d79d50ec37a93e8d915807 | refs/heads/master | 2021-10-19T03:17:28.285146 | 2018-09-09T12:53:35 | 2018-09-09T12:53:35 | 110,837,225 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 432 | cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
float a, media = 0;
int erro = 0, numero = 0;
bool termina = true;
while(termina){
scanf("%f", &a);
if(a >= 0 && a<=10){
media+=a;
numero++;
} else {
printf("nota invalida\n");
}
if(numero == 2){
termina = false;
}
}
printf("media = %.2f\n", media/numero);
return 0;
}
| [
"[email protected]"
] | |
818536a9ca4cffd94a8205fe42059b827cd1a080 | fdc56fd4ea8b795327fc7d19b8e69649635bd07b | /M.cpp | a6169755711d5672b67afaa568f878472e444466 | [] | no_license | Laspiirinne/PSO | 20e7f4d35506da80ed77185589e95def53d6ddc6 | d5dab51ee5b63aed20c395cea2477dccd97f52b4 | refs/heads/master | 2023-06-25T05:59:37.829063 | 2023-06-10T08:44:18 | 2023-06-10T08:44:18 | 259,522,434 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 170,089 | cpp | double Ac_M10[10][10] = {
-1.8785768809450733e+001,3.3616954860437176e+001,2.6882113915382682e+001,-1.0433064197429360e+001,9.4489289408247579e-001,-3.3538964332596910e+000,3.5352127339076374e+000,7.3942769413967824e+000,7.7909087526412346e+000,2.0912921099835673e+000
,-3.8080580880289006e-001,1.0420967284673154e+001,9.3472919131156775e+000,-2.0926490513724943e+001,1.1425903158890700e+001,1.1056372574995397e+000,3.6879282505970373e+001,-1.9103397804634721e+000,7.5611684932093199e+000,-9.7430664357899719e+000
,-1.2341688082549489e+001,6.3621993552738045e+000,8.2484299397924641e+000,8.0892563664178354e+000,6.9234506619011427e-002,2.5786241359574857e+000,-4.9734021861818611e-001,-2.0627220954843271e+000,1.4302051477457656e+000,1.5522003760944671e+001
,-1.7006542510444671e+001,-1.2679306064055677e+001,5.1658120519511158e+001,-3.9766120780636900e+000,3.9349384750136576e+000,-3.0777202564613845e+001,6.1465971476271157e+000,-1.1404959107806402e+001,1.2694206030880832e+001,-9.3951432281174387e+000
,-5.4847491542826621e+000,-1.3643476981518553e+001,-2.0812578603542899e+001,1.2480631776818850e+001,8.4497820599569917e-001,2.4830393330514045e+001,3.3838505185702559e+001,-1.7003569707093064e+001,-5.2939643674048442e+000,2.6065703095424336e+001
,1.1422878520470586e+001,1.0221461943150496e+001,-5.9994789874002628e+000,-8.9358916025741415e+000,3.3407916251514460e+000,3.9245488542554492e+000,-6.7605717857278513e+000,1.4016300477765046e+001,2.3533969357952147e+000,-1.5957358828479556e+001
,1.4106979735005300e+001,-6.8979757292229404e-001,2.5928358266684882e+001,-3.0138271725378775e+001,1.2953067028884863e+001,-1.7125782201118525e+001,1.9122903237509483e+001,3.8502101712160597e+000,1.4449871260335931e+001,-3.7768641488073015e+001
,1.8171620273851625e+000,-4.5228977429981496e+000,2.5960648243684310e+000,-3.0779703663335480e+000,3.6662383806277021e+000,-3.1422719671052084e+000,-1.9391037957658499e+000,-1.1328460209494431e+000,-1.4593971192280721e+000,-4.3850653050781068e+000
,1.7059635015136770e+001,-4.0887343040678509e+001,-9.0413685473717607e+000,9.2078166133516532e+000,2.4835590816969209e+000,-3.1352382866663429e+000,-5.1597084344852373e-001,-1.0448164970351954e+001,-3.9790838641391200e+000,-5.0101517638708923e+000
,-2.1004104733841622e+000,4.2857434922129016e+000,1.8138803730523911e+001,-5.5691566223518540e+000,2.0414928764167950e-002,-5.5315683071808275e+000,1.7507462325577925e+000,2.0183823538506891e+000,8.9673707865551204e+000,-3.5936542419629482e+000
};
double Ac_M30[30][30] = {
2.5111902646033988e+000,8.2577410940921254e+000,4.5769720243342649e+000,1.1663051871013478e+001,1.8392711991609043e+000,3.9304779816384312e+000,6.3818691295165566e+000,5.5541636638466469e+000,3.7922599957203942e+000,8.1195795091142084e+000,6.7498731166769330e+000,4.1674483926880299e+000,5.2472291070976933e+000,4.3800910215229356e+000,1.6362652066486465e+000,1.5457444553413353e+000,6.7296511695196717e+000,1.0841704025647012e+001,5.2713336626605596e+000,7.3151424579520929e+000,5.5864551891835443e+000,1.3436020980535218e-001,4.7579512970292051e+000,7.4940642261667341e+000,5.7142287635324598e+000,3.4949745886606784e+000,1.6868920105415459e+001,6.0586004356392378e+000,1.1353403083342686e+001,1.0923576208896637e+000
,-1.1762520815425976e+000,1.9467231905937696e-001,9.2623216277797766e+000,4.8776204559600167e+000,3.0138253051512947e+000,4.1389413474182186e+000,4.3813990781956429e+000,1.0955999597384529e+000,3.3625539508337665e+000,2.4151787289442970e+000,6.8616131423545177e+000,5.9404672880754572e-003,2.1359334459571060e+000,3.0727574965743903e-001,9.5029546146555948e+000,3.7892209919771429e+000,2.7696427577007503e+000,2.6727167084115719e+000,3.3741168120544809e+000,2.0411067751984415e+000,3.3402470701439788e+000,8.3749909435210357e-001,5.2590490478456857e+000,1.5214938770854254e+000,3.5602450658168063e+000,5.8784904977759578e-001,8.2496572038031193e+000,1.5778811846183591e+000,2.5639243540204100e+000,1.5379586044818629e+000
,-1.3085812283158484e+000,2.0503713510983976e+000,3.8749598247741446e+000,2.1360189905937013e+000,4.2537428107045339e-001,3.0436540446668690e+000,2.8524638400066973e+000,4.6096927306855866e+000,2.6769899949340137e+000,1.8654380314467155e-002,4.1843245155883002e+000,2.9414549211011054e+000,9.0702547942115999e+000,2.8901675024341760e+000,6.5170875304560765e+000,6.4582204731678141e+000,5.2147578439709585e+000,5.6728283981570335e+000,1.2918267757780038e+000,4.2523775825072829e-001,2.0042569131772372e+000,7.0102070420207587e+000,3.2458529989643554e+000,9.7585219519376876e-001,1.4063626039048713e+000,2.0524623161985742e+000,2.8720785812443812e+000,2.4458510545723491e+000,1.1089245294598029e+000,2.6062919912953580e-001
,-6.9130132282255441e-001,1.9945323148620686e+000,8.6047544859931246e+000,2.9761072632153596e+000,2.5462817170506593e+000,1.3089272819698949e-001,2.0952635102573707e+000,3.3569684373927915e+000,2.5997886774932327e-001,5.4018232238416557e+000,3.0612958034992652e+000,1.4039784625555660e+000,3.4596259047551641e+000,8.7514478130657081e-001,4.0378670430385091e+000,2.6981413548750095e+000,1.0464805632232836e+000,1.6212081849802271e-001,3.9721206819198489e+000,3.6009588611547283e-001,3.5904310229755434e+000,1.1357447862030143e+000,6.0855513363313580e+000,3.0659775059864619e-001,2.3495830369958446e+000,3.9039399727395279e+000,1.4818186582438302e+000,2.8783951594657520e+000,7.2585035383637688e+000,4.7966447713100209e+000
,-4.4423208195583835e-001,3.5713856787861915e+000,1.3286045625307453e+001,1.2839633153682575e+001,4.4896798726966036e+000,7.8690136415435648e+000,1.9651054773910639e+000,8.6366363503659240e+000,9.4822649845241885e-002,1.0673493697992319e+001,1.2531569864026039e+001,1.8549791851385953e+000,4.8458317753038891e+000,3.3031932998435436e+000,1.4504105531464209e+001,2.5900447684339514e+000,6.1356861589960872e+000,4.2709043158416957e+000,6.8616830868538310e+000,2.7448701401161961e+000,5.1026763913165691e+000,5.9431250035101861e+000,8.7669666776919879e+000,2.0006623595368072e+000,4.8220557102433964e-001,7.4508873874788470e+000,1.0450132561749831e+001,3.6259332629960679e+000,4.1791775437350971e+000,3.9824767971390695e+000
,-1.0464299208072154e+001,1.8582026098543591e-001,6.5520413966727755e+000,5.9119451916699219e+000,8.1689376200300856e+000,1.0982208830632558e+001,3.0013584645614602e+000,2.9120659976777534e+000,2.6719375054369290e+000,3.2565588882474192e+000,1.0109819456145726e+000,8.1891692680680102e+000,1.2001606012082647e+001,5.6514054670437452e-001,6.8161309029866617e+000,7.0342127069431628e+000,1.2406011075764850e+001,1.4537675875626526e+001,1.4015463474018615e+000,7.0761477781215720e-002,5.1730185880423090e+000,1.7500331178638167e+001,3.0976732548896924e+000,4.0266353200237841e+000,3.0078191708339106e+000,6.9867874651810844e+000,6.3941959158811414e+000,3.6878262127586989e+000,1.0500866576776128e+001,1.3151879796730649e+001
,-5.7811238250400532e+000,4.6954279199155611e+000,9.3841394258290478e+000,7.5752111540975360e+000,8.5142783285251831e+000,5.7206305451108346e+000,3.8284935959355160e+000,5.9099886139439803e+000,1.4890776917348506e-001,6.3118557909516637e-001,7.5720764781945382e+000,3.7705573930473490e+000,8.1785775142090564e+000,5.0982568695538326e+000,1.2071057253718950e+001,1.2487379324442383e+000,4.7854419252377683e-001,8.6788258759695331e+000,9.4620985863008933e-001,7.8972756845699010e-001,8.6497832132950592e+000,2.4854196643654078e+000,1.2153488342644684e+001,3.0622423287838485e+000,1.7037027582981643e-001,2.0935247896287046e+000,5.1540426232404899e+000,4.5082775046079915e+000,1.6106478189308102e+000,3.2748798874869531e+000
,2.2688183102066888e+000,7.3004524017451464e+000,4.3315756283271289e+000,1.0744288747208991e+001,1.5049273777556030e-001,5.2270383191035619e-001,6.6861830579244366e+000,3.7822199735751276e+000,2.1887041557208389e+000,8.9662841068564134e+000,7.9370928349120060e+000,1.3156741545363397e+000,3.3952200221430955e+000,1.5598471755009025e+000,2.7888347922477204e+000,2.1389947526360622e+000,8.3238581342060218e+000,1.1033496914596266e+000,2.0809958580689525e+000,3.6719079154589567e+000,1.0730187868315110e+001,7.8657492114426142e-001,1.2077147983799486e+001,3.2004833008354185e+000,1.9646808590108427e+000,2.6570004171458312e+000,1.2549412268552729e+001,5.0480531452626547e+000,8.9256031810958394e+000,3.2910786331928614e+000
,4.1055194191981968e-002,4.1981642865923439e+000,3.8089200457764699e-001,8.2394225183177401e+000,4.7799576127962640e+000,3.4787851409838986e+000,4.3402296935447344e+000,1.2696168576985805e+000,6.1468102360164671e+000,3.0718648059925666e+000,9.7133791295682892e-001,5.8961201640005063e+000,7.5755083185838190e-001,8.7820093428977841e-001,1.5325189430622428e+000,5.8443715227903894e+000,8.3701472806639698e-001,3.9072787371408775e+000,2.0301730166233138e+000,3.2026767861827339e+000,1.4701370967177350e+000,6.8587753098361048e+000,5.7516870726842155e+000,2.2611091220924573e+000,5.4462330475091587e+000,9.9457521403162885e-001,4.1980664749812027e+000,9.1628371906244410e-001,4.3417664143220032e+000,6.6000309534052348e-001
,-4.7588052348870686e+000,1.2490963683052729e+000,5.2302416836961934e+000,1.9442367894113321e+001,3.9901655585702649e+000,5.2167853292723496e+000,4.9601188551763764e+000,2.1136647271764106e+000,3.6524674000405544e-001,3.6709416597019735e+000,1.9142880398717106e+000,6.0943337187539530e+000,2.6829676276599868e+000,1.2274223265327979e+000,9.4336456725351674e+000,4.9664378753052905e+000,3.6169072412457082e+000,1.4555234532874778e-001,2.2803947884135107e+000,2.2654090892975538e+000,5.3178184746926913e+000,4.3569587179320823e+000,9.7513948827124803e+000,2.1844180242408706e+000,4.5517292199083386e+000,3.2039375193038246e+000,8.1618775395274117e+000,9.8819645078383154e+000,9.4267939399997691e-001,4.0907597726080605e+000
,5.8957144568778368e+000,5.6739583783367094e+000,7.5511890952773886e+000,8.6763663921391991e+000,8.7421284728629498e+000,7.8769414134491553e+000,6.1863149428784920e+000,1.3852922593783206e+000,2.3393505014942435e+000,7.3034028140998508e+000,6.2034590672145551e-001,3.2148004432772503e+000,5.2855867830614722e-001,3.2765172515905244e-001,6.6001767892053396e+000,4.0304805143902369e+000,2.7481974168251599e+000,1.1317199597948133e+000,4.0416153042750000e+000,3.8072768199027371e+000,7.1747954059737307e+000,7.1059106926610749e+000,1.6168247905354850e+001,8.4907428074822988e+000,1.2052755696949251e+000,3.2137834518973687e+000,1.0194600833625421e+001,8.1537702193512995e+000,3.3461422886714698e+000,6.8525766351026736e+000
,5.0507551005154721e+000,1.0150841665383323e+000,4.4889517626626629e+000,3.0719093620471365e+000,6.3092147908051945e+000,4.6071715866893594e+000,5.1877198593127460e-001,2.5762076049942544e+000,2.5389515408876373e+000,3.8711704280020434e+000,8.6099787829018004e-001,9.3331925171311010e+000,3.8982417469588411e+000,2.0456371430824070e+000,4.6321726666275849e+000,3.2510523438785062e+000,1.0340844584872428e+001,9.9383629354701668e+000,2.6818750646678962e+000,3.0928871960662968e-001,3.5538046906233629e+000,1.1909220170048043e+001,3.4077956498388162e+000,8.5223499290921845e-001,1.4705436942360726e+000,1.8651383236501812e-002,4.0093993707899928e-001,1.0066041993408876e+000,5.5465678335987922e+000,8.9362874512202186e+000
,-2.2967366420733080e+000,7.5076859602699306e+000,3.8788041852868922e+000,1.9278707838760820e+000,8.6060524575825816e+000,4.9022504271775613e+000,3.6941525186262203e-001,3.7711058984310473e+000,4.4972361485535188e+000,6.9206442499661200e+000,6.5556066531062571e+000,3.9794812646356310e+000,5.5167001728927367e-001,1.2503803722341893e+000,1.1577926205347564e+001,9.8949362466786994e-001,4.6434492055763421e+000,3.9903009834914564e-002,2.7178894672660281e+000,2.6288290501898479e+000,1.3910978581870110e+000,2.0405348288775609e+000,1.4571897255676616e+001,1.6457997025263595e+000,6.0112884846917891e-001,8.4040479658269551e-001,1.4631979926819447e+000,3.2023768022226649e+000,1.6711768384467316e+000,3.3759766251533998e+000
,-3.9375156766066337e+000,3.1399299192956929e+000,7.0632092358776095e+000,1.8092484750688675e+000,8.8702478366926787e+000,7.1162797575146426e+000,5.6156980095799314e-001,1.6076237660478159e+000,4.4298033770189671e-001,5.3926297635189568e+000,3.2533129344769782e+000,5.3910491395161020e-001,7.5009269003970163e+000,9.8057308514295738e-001,5.6342477580369952e+000,2.2369081576061749e+000,3.1478227045519458e+000,5.9377624757314145e+000,8.8723905966015770e-001,3.7786627030781950e+000,4.5798516366241158e+000,9.6822440702373900e+000,5.0079900839244268e-003,2.0666085879540494e+000,2.8401007471138193e+000,1.0726704708603498e+000,6.1071204002038284e+000,2.0148184392786019e+000,7.1658239506934418e+000,9.2720748191496032e+000
,-2.6802400108558748e+000,3.5600434995900165e-001,4.1445690762178772e-001,6.7764618278142660e-002,5.3206433037272429e+000,7.3787543788354781e-001,1.2136684358984866e+000,3.1458143279857671e+000,2.5076971836735140e+000,2.5361040388240879e+000,3.5584313174389122e+000,2.1311591533309513e+000,3.7642012522767332e+000,8.1620439737117167e-001,4.6329564239596568e+000,1.8412028912752174e-001,1.2174333740701588e+000,4.0360684855290136e+000,2.2585569498776978e+000,9.1008254236667518e-001,3.7541872563123806e+000,7.4576507561771974e+000,1.4568472563765222e+000,1.6086122502502214e+000,7.5764877196366531e-001,3.7903223473240319e+000,8.8704009905126058e-001,6.0277911110325979e+000,3.2819170272693354e-001,8.6600276660951525e-001
,6.5782082376756978e+000,8.1841029329132065e-001,9.2888639172964389e+000,2.2144135507579069e+001,5.2232692529304892e+000,1.8041411263480054e+000,6.9247674480073140e+000,2.7767801206174636e+000,2.4943841856277307e+000,4.7436362008417570e+000,2.6908221523406097e+000,6.0888553341012814e+000,9.8103945013113647e-001,1.2367295029956667e-001,1.4013182874013280e-001,1.3797914058713273e+001,1.9140307163145940e+000,1.3560533260143395e+000,2.4858409618477904e+000,2.6693043246691528e+000,2.2893697932797594e+000,1.2599570228592629e+001,9.3847348962722998e-001,3.0007506518134730e+000,6.7484649197610178e+000,2.9989918132723914e+000,7.5092740496512898e+000,4.7127898137406730e+000,2.5839742623096855e+000,4.2594073216356794e+000
,-4.3024320193125973e+000,1.0302191609738225e+000,3.5401401034044280e-002,3.8646036591002857e+000,1.1181713062447539e+001,1.7991288421541245e+000,4.6323822026738970e+000,2.7809915175751341e+000,2.5313169687422117e+000,1.0165545659183975e+001,1.5506226417615061e+000,5.4027829211712977e+000,7.0667343369424325e+000,3.5594650532243692e+000,7.8385107861986283e+000,8.7279452793105350e-001,6.7293992567989642e+000,1.8519436599504211e+000,3.1730230733872498e+000,3.0347745630898443e-001,7.2943286321179768e+000,4.3124335764223809e-001,1.2108553118909567e+001,2.7855123137319424e+000,3.9514225898531379e+000,5.2165715415244271e+000,1.4018077996402409e+001,3.6806182504814076e+000,1.0312528175880152e+001,9.0724262013648111e+000
,-5.5329864922490914e+000,1.3681576267420914e+000,2.9962789113758914e+000,1.1805877383771748e+000,1.1727360989475766e+000,3.0334405374569635e+000,2.4082744014884844e-001,1.2745548563169782e+000,3.6640706145869864e+000,1.4502390574626720e+000,4.3774922918318027e-001,5.1391211373221957e+000,2.1842397317007856e+000,1.7226736633847843e+000,5.0039030065256034e+000,1.5556773763707230e+000,4.5926280736109506e+000,3.1529946446351376e-002,1.9620386750575327e+000,1.3115193273334391e+000,2.9714404292395602e+000,4.3586285713805735e+000,3.0209104071865602e+000,2.0262896740167382e+000,2.1791003429886819e+000,1.9956140445455484e-001,6.4226876496993424e-001,4.8430217469126963e-001,8.6769719388542621e-001,3.4282566958973373e+000
,4.7496886837485377e+000,3.0130962354663238e+000,8.9647347150615808e-001,5.4044089018261738e+000,3.2519001244819705e+000,4.7005011690414369e+000,4.8584192208462884e-001,2.1290198545775536e+000,5.7439866074550174e+000,5.0507270409938601e+000,5.2904267608435216e+000,1.0017074714718186e+001,4.1097834544823444e+000,2.1715889992323039e+000,9.1439732379958851e+000,2.1580967522563212e+000,4.2883005730833608e+000,8.4407968596225675e+000,6.2293370820164340e-001,3.6685777058957408e-001,5.3726662118598023e+000,6.4222116419608737e+000,1.2410218824501939e+001,3.7493570416711957e+000,2.7699126830365564e+000,3.5082222436746777e+000,5.7401737725928292e+000,6.6066520019612778e+000,5.6306777738011951e+000,6.2531552976119871e+000
,4.5590348136006194e+000,1.9133502664802449e-001,9.7246988850632707e+000,1.6676435885179576e+001,1.1815244699143054e+001,2.9636196153348622e+000,2.6441950625646982e+000,3.5045347535842035e+000,1.5394738508529109e+000,3.2479533092428405e+000,4.1361784784436129e+000,1.4150422310097437e+000,1.8077736159480107e-001,2.5167947201866085e+000,6.1608285249881440e+000,6.7945755129587226e+000,7.5817729728994809e-002,7.2736717628740988e-001,1.6683055420721837e+000,1.2534583279579286e+000,7.2705811800097386e+000,5.0206807311713471e+000,1.0710260791368778e+001,3.4823148999760281e+000,3.1599569378574079e+000,5.2642337105470336e+000,7.2446415792643961e+000,1.0641144576600027e+001,2.8015125221679434e-002,2.1956976936330955e-001
,-2.5513085043810344e+000,5.6247633162565034e+000,5.8227501198454705e+000,1.8839847954245890e+001,2.2876653328083139e+000,3.2026509307644129e+000,1.4315718142819273e-001,1.9393371050172241e+000,7.2974863965998384e+000,4.7148114553315947e+000,2.2859238491031868e+000,1.5719145123582468e+000,1.1886888386113303e+000,6.6512504866502242e-001,3.6211248910508802e+000,7.3150552275590019e+000,2.5920811268356303e+000,3.6049680612829635e+000,1.2692515127885735e+000,4.6036285376649140e+000,6.1868646030843815e+000,8.6258401941956393e+000,1.5640620254332642e+001,9.3397120438836172e+000,7.0056492461347042e-001,8.0331851014550413e+000,8.9845696621150228e+000,8.7567881258408029e+000,3.0002946387562526e+000,1.5527019436374203e+000
,-3.8612903754795389e+000,4.6754483726315357e+000,9.2512155936011524e+000,2.3607840924556356e+001,8.6955655504927982e+000,2.9890761291947134e+000,4.7394354006804384e+000,2.8356784578772074e+000,9.8166653883445393e-002,1.2599368055638564e+001,1.0371683803332736e+001,6.8802661076069542e+000,1.3323520170751154e+001,8.3664309813693438e-001,5.1740407946195521e+000,1.0492637215530110e+001,6.8020531332912935e+000,6.1161686240207116e+000,6.1216820220834611e-001,1.5616787444124285e+000,2.9610174003698821e+000,1.4555633724082611e+001,2.4089210401013990e+000,4.1647632225019171e+000,1.2885371130833283e+000,5.2492159991554055e-001,4.1974380990138838e-001,6.8473069211651181e+000,2.4178117806412915e+000,7.7028914750038480e+000
,4.1611371423877053e+000,1.4820377177923658e+000,1.2871131760474233e+000,1.1780576083757202e+001,1.3704438843176279e+001,2.2529706444658775e+000,4.6289786480007216e+000,8.4485256789553702e+000,4.5012419230538043e+000,3.2180822100676387e+000,9.0966927467004375e+000,6.3597664788223831e+000,2.4587668770524620e+000,2.7472396634682528e+000,1.1352826871439879e+001,1.6900717568947712e+000,4.9446475840448105e+000,1.2874782451208633e+000,5.5144651633012218e+000,4.3632046338437597e-001,2.4608856135017079e+000,2.7668726158968946e+000,5.2442569579482941e+000,3.8397648050673561e+000,1.9744867737957825e+000,3.8504675955016556e+000,5.7191840316533318e+000,3.1125551947104624e+000,2.1919986794855943e+000,1.3026077572473954e-001
,2.1053106927251957e+000,5.4481698789679101e-001,1.8463460394236781e+000,5.0978480548833249e-001,8.1913978191834804e+000,2.2684979135170835e-001,3.0851797887818924e+000,5.6992111184819469e+000,3.2935943901088378e+000,2.9094447111894088e+000,7.7649583288537629e+000,1.1668970305075335e+000,3.0203138081157559e+000,6.7991669245330737e+000,1.0774654169742099e+001,1.5250393026865812e+000,7.5542314110537152e+000,5.8701310791959860e-001,1.3007596553023062e+000,4.0807162826483490e+000,2.1864655686812160e+000,2.4064847064680794e+000,6.9580471791212242e+000,3.2357537230417077e+000,4.3042279283433338e+000,2.0637053734784094e-001,2.6250272141353848e+000,5.7153116858511543e+000,1.3755895996309002e+000,7.3139628018954603e+000
,4.4606143748925815e+000,3.1952976197848404e+000,8.1903188739765334e+000,1.7720929604353678e+001,1.0799035076752885e+000,4.0320465721695893e+000,6.8461706343317923e+000,2.9909239687853848e+000,1.0138487919520105e+000,4.2105501855860892e+000,7.6471102581991057e-001,6.3076470536318592e+000,6.7918112064941871e+000,1.3588577626377345e+000,1.6246138143018776e+000,1.0150256933841442e+001,8.9550865163709865e+000,2.4112957186005501e+000,2.9918358631703246e+000,2.0841054852597667e+000,3.8788283603335283e-001,1.2037911290804784e+001,7.8478144500433122e-001,3.5125859319946096e+000,6.3580512246788015e+000,2.3542709339094050e+000,1.7629785519170058e+000,7.5089297125074941e+000,4.1539565200276689e+000,8.4305890712223146e+000
,1.1299545143656423e-001,3.7193678613980558e-001,7.0255683307809997e+000,9.7690136894484638e+000,6.4079325776610796e-001,1.1677067837314976e+001,1.4515727489278767e+000,1.1715021644690176e+000,1.6926476580912793e+000,8.8120532679683705e-001,4.2682825530523232e+000,5.6374594710075163e+000,4.8974500013531115e+000,1.7173589307977707e-001,9.2113304680450014e-001,2.4905148715845815e+000,9.6070469447448215e+000,7.2067972047987681e+000,4.3496477277447507e+000,4.6213391401175858e+000,1.0832359506208546e+001,5.1006267591496313e+000,4.0761313113644393e+000,9.3277548793533871e-001,5.0265512140221980e-001,8.6858164471001000e+000,1.5294166113376837e+001,5.9942486983296019e+000,1.1694453405846096e+001,1.1801285777570579e+001
,3.6721201369020071e+000,2.6266279533884895e+000,6.2952706473265172e+000,1.0698599349512321e+000,3.8113302994051375e+000,1.5949006885529526e+000,8.2264942161034227e-001,2.9961023548979657e+000,1.1410712161871278e-002,3.8049739555840176e+000,2.9095969601553967e-001,1.5441256642165688e-001,6.0091236927948035e+000,1.0488409418576379e+000,1.1420533472469993e-001,1.0411398867498760e+000,1.7664882512232245e+000,1.2322615086785684e+000,3.2960713266398476e+000,2.3736081403353029e+000,1.2501587585395990e+000,7.2087313455376612e-001,6.1567731870051767e-001,1.4032590478706066e+000,3.0055294423481325e+000,1.2156261459075970e+000,4.2094269477193649e-002,2.2318793590146617e+000,1.6113608788934293e+000,6.4697351868926694e+000
,-5.8185529297158372e+000,9.1692957123285423e-001,3.6661199006009199e-001,5.1299503247235405e+000,6.9050641304147957e+000,6.5445798712234575e+000,7.1622004822116399e+000,1.2183927219650177e+000,2.8386972148047189e-002,1.3304659303178061e+001,5.2120311019755947e+000,1.9841457562171061e-001,2.0439380455533831e+000,2.9548032145709496e-001,9.7387660311549329e+000,4.3738934395327149e+000,5.1338212986011271e+000,6.8187972382171589e+000,2.0321661918244391e+000,1.2990684156080132e+000,5.2824866779081745e+000,8.7970445244304791e+000,1.2849891231025046e+001,2.7871568041542045e+000,6.2258818054938425e+000,4.4293876597725088e+000,7.4036051874247004e+000,3.4789466856660187e+000,1.6328914814136246e+000,1.1057519935283844e+000
,3.4868785913811906e+000,2.6339386298341982e+000,3.8345442598175135e+000,6.3386615372963782e+000,8.4402204874350364e-002,8.9153745292785802e-001,7.3867522414644622e+000,3.1433412659900224e+000,1.7569569189932993e-001,1.1898406849449290e+000,2.0637456564992989e+000,3.8737417532091958e+000,7.6310374217908148e+000,8.7040751999169408e-001,5.4169231361090375e+000,4.7961748026885873e+000,5.4414840220533529e+000,7.1132200570148507e+000,4.0210071017841251e+000,1.0933378235540314e+000,7.2371341591055549e-001,1.1778856908851662e+001,8.9475053172754464e+000,3.7169797000665405e-001,3.3683497769665385e+000,4.6574430831545914e+000,4.5395553802300398e-001,1.7407016169440057e+000,1.6522054174095602e+000,1.0293176939756639e+000
,2.4619449069966399e+000,3.3673200633356609e-001,5.5240382557857715e-001,8.4526717776349756e+000,5.6338448584726226e+000,4.4617023670493730e+000,3.7791579697242024e+000,2.7692458222436231e+000,1.0068035379461520e+000,1.3729931455271689e+000,2.8837599177371960e+000,3.9353447413494282e+000,1.5888078809409378e+000,1.6663327424869052e+000,3.3451072476151555e+000,9.0188786814882089e+000,4.9663439412673824e+000,2.3784061157183620e+000,4.9841154916435686e+000,6.3694517538404272e+000,4.8104575530481490e+000,4.6956315107236710e+000,8.8702169041350452e+000,1.8512664237737275e+000,4.7853186190453051e-001,2.2841714202034744e+000,1.6997915076850245e+000,4.1158541210277297e+000,2.0796815078086990e+000,6.0644228800452833e+000
};
double Ac_M50[50][50] = {
-2.1811729470950274e+000,2.9343564593939337e+000,4.1158689203891088e+000,-3.6992430320521930e+000,-3.2153101374188258e+000,3.4669850781190128e+000,-6.8626185349392954e-001,-3.0846136810965961e+000,-2.9511902151453384e+000,2.6081176120398699e+000,-4.4318350150044328e+000,-2.2842559537252032e+000,-5.8438364812164945e-001,-8.1934176961296523e-001,2.1370619334267711e+000,1.0373706119516755e+000,7.5991505142347675e+000,5.1999097115695099e+000,3.9408477738561709e+000,-3.4732938281803212e+000,-8.8113605054781985e-001,-1.0414722942384169e+000,-1.3534110192071724e+000,5.6821317807103888e+000,-1.4005685069829434e+000,-3.9008975480227308e+000,-1.8457739778169152e-001,-4.0370734122858831e+000,4.9830889253460970e+000,3.9588500697990292e+000,4.1801611790707680e+000,1.0122371670224608e+000,-5.2698275628688558e+000,-2.8276736799870301e+000,8.2274620793837272e+000,3.2292604890683898e+000,-1.3614573837420272e+000,-3.3216232412179694e+000,6.9254427035927995e+000,3.7135256927772411e+000,2.5439551347493143e+000,2.1231066689138292e+000,1.4836095771699104e-001,2.6134229265738691e+000,8.1650325510348889e+000,1.8339867069126023e-001,-1.7417279953330608e-001,3.3158315165344896e+000,1.0718605428354687e+001,6.1816342719760380e+000
,-3.1460329687465491e+000,3.1294922933112357e+000,1.7406771097636959e+000,3.3972033341892560e+000,4.5168742879293475e+000,-1.8609839352718112e+000,-6.6794750296986809e+000,-8.5350430086845630e-001,2.3779878701480146e+000,4.2024989673268260e+000,4.8786324869313775e+000,-1.9753722953629818e+000,-3.8532226896390012e+000,8.5638364594454206e+000,-2.9484667067260713e+000,2.7848063190247965e+000,-2.8848079593625933e+000,-3.3911068408602145e+000,-4.4843216681123517e+000,-8.4213106456396289e+000,5.4397152679963057e-001,-5.8404408232180876e+000,2.1837124162774164e+000,5.1524701683697138e+000,9.4573477274393092e+000,-1.4234140156734756e+000,3.0934687334904583e+000,-6.1834767902113175e+000,4.4909928680947448e+000,1.5931733939682113e+000,9.6686297277429603e+000,3.8211080362703278e+000,3.6139427870159593e+000,-1.6158151535387910e+000,8.9816521118963237e+000,-9.8968075636932848e+000,-4.3480022089001888e+000,2.1418930140130370e+000,-3.9949416653466190e+000,7.0593454536248590e+000,1.0184487622541950e-001,6.4029557113461344e+000,-1.3818998210997158e+000,4.6894351202694597e+000,1.3255764721669074e+001,-1.6568005393764331e+000,3.8962265693816529e+000,-1.0470762325715043e+001,-8.5790508920659292e+000,2.5761360022745916e+000
,4.2092447161147023e-001,-5.9449936080319699e+000,5.3533840244904116e+000,-1.5208951886519071e+000,-2.4662566080313746e+000,6.7097387253174485e+000,2.9842599043161804e+000,5.6768403407696280e+000,-7.7472877916698808e+000,-3.3580475312997002e+000,-4.6756353978966461e+000,7.5222143070609748e+000,-5.4258332775701552e+000,-1.0288365006862724e+001,1.9199120248387000e+000,1.4816911786796343e+000,-7.3599145053506931e-001,-8.7261491363499344e-001,-1.4933500276098174e-001,3.5781562017118680e+000,1.0048772655141549e+000,1.1356479301293319e+000,-2.2062397580806792e+000,-5.1557020836351342e+000,-7.6689308966860956e+000,4.0657521700580004e+000,-2.4663616196362819e+000,2.9849967410942635e+000,-7.0452187924416165e+000,3.4382151233104832e+000,8.1013544124008696e+000,-9.0305416752125325e+000,1.0220345349838247e+000,2.4098582775893456e+000,-1.8982396462010536e+000,-3.1848219163948635e+000,-1.2656966222586525e+000,2.8133821108493495e-001,-1.1290730412197130e+000,-8.3848589659007045e-001,-2.1178873821856947e+000,-6.1982689180311938e+000,-4.8227245553389453e-001,1.8587026897794681e+000,-2.4756399620641543e+000,7.7589834239425377e+000,-1.1645653640910256e+001,1.2877148071357308e+001,6.0481544466001376e+000,-2.4050185670380984e+000
,-5.5485916616621509e+000,1.4988371369325841e+000,-3.7020228016958536e+000,5.7165843051443082e+000,-2.0675846929386861e+000,5.3360268949678265e+000,-1.4268843872951417e-001,-2.4822308461399389e-001,7.4147729414036867e+000,1.3220465654098885e+000,-1.0209750882267960e+001,6.6666305601558626e+000,1.7613534272086786e+000,-2.7601559045104112e+000,7.4096518732265082e+000,7.5901909060849846e+000,-8.4792850443198766e+000,4.7816014976501497e+000,4.4337705266926850e+000,4.0736938670069227e+000,8.8443586893385078e+000,-7.1689423657978741e+000,2.8239787163913750e+000,-5.3389541504250282e-001,-4.3307117152129931e-001,4.9597606797100928e+000,-1.2601007487442842e-001,1.4345588967709360e+000,4.1563481167598466e+000,2.6508103993175429e+000,-3.5810705164839209e+000,2.3805374293217896e+000,7.6488453509835064e-001,2.0404572679638018e+000,-1.1368984134823383e+000,1.2028363466745473e+001,-1.7310494862505517e+000,-1.2791032788711671e+001,5.8012211983748321e+000,-1.7204361114288758e+000,3.5430060277004078e+000,-6.0779076942869263e+000,-6.0134160167061212e+000,-4.9971293783458065e-001,-3.3628939141447862e+000,4.0655694089105898e+000,5.7355798695910809e-001,-8.3617235383841615e-001,9.8658946044499789e+000,-1.1954359393107708e-001
,-6.3935566750024786e-001,-3.9514896138401301e-001,2.3069989612265989e+000,3.8565463471003636e-001,-4.8100849595698203e-001,-1.0006064984240512e+001,5.2811416726708869e+000,2.8969528632672796e+000,-1.1553189554396566e+000,3.9682203061933299e+000,6.6029728391179789e+000,-5.8782456061005428e+000,-2.7068043868554059e+000,-1.5500045812474721e+000,-1.8180339237987786e+000,-4.9873103939647319e+000,-5.9927012094443965e-001,-4.5481016850388557e-002,1.9451656749203491e-001,-5.8828226775644046e+000,1.2275571169403832e+000,-5.7586868792924557e+000,-4.3902377264794479e-001,-2.9378632584375614e-001,6.1359064970661823e+000,-3.5563400831757206e+000,-7.7694097768151309e+000,2.6893068525420250e-001,3.0054015598246790e+000,-2.4796462950666323e+000,2.8353779597578197e+000,-1.7377057054178779e+000,-4.4880067347915487e-001,-3.6404066767198269e+000,-3.9622276542118477e+000,-6.1916292358039584e+000,1.9937579250643571e+000,4.3381227971318816e+000,-5.3129700299363947e+000,5.2895058519585874e+000,-8.2473207910617994e+000,3.9230927641429822e+000,6.1180765350614914e+000,3.9320448009365840e+000,4.0572573069362639e+000,-6.2463793460399399e+000,-1.1449017914685404e-001,6.9006463118365851e+000,-7.5269146850081485e+000,1.3336916884733001e-002
,6.4199236103241395e+000,-6.0316797813000020e+000,-3.0689611155570096e+000,-1.2035655769374570e+001,3.0809712824631469e-001,5.4773332886393113e+000,1.0959850013032411e+000,-2.3650407605876991e+000,-3.4218816606155240e+000,5.3338777262439967e+000,-7.7104451752251979e-001,7.1699438660180403e+000,-2.1532439705948636e-001,-1.5155100065161986e+000,-3.4264779237482998e+000,5.4539973388617664e+000,-5.6795776424734221e+000,3.4076879723740348e+000,-3.6052235126882830e+000,1.8296723066525042e+000,4.6472726424895443e+000,8.3639408241658959e+000,5.1338274610163568e+000,-5.3995364060024409e+000,-2.8486035974424122e+000,4.3202397080741388e+000,3.0488335457888932e-001,-1.4931740649216831e+000,-1.1396159484269791e+001,-1.1050907808768368e+001,-3.4500513068044203e+000,-2.6872707236169235e+000,2.1386914417975800e+000,9.9135716249915218e-001,-3.4136270495413701e+000,4.1839573707648653e-001,-1.3607422533909588e+000,-1.3469137572609498e+000,-1.2553468395131823e+001,-2.2509397155238924e+000,3.2940950763667654e+000,-6.7473810014259223e+000,-1.7735676906362765e+000,-9.5183806711625338e-002,-3.3611071114495554e+000,1.1564853700262774e+000,6.4482717276426005e-001,-2.1970747979822134e+000,-2.5851404006331200e+000,-8.7737453466680577e+000
,1.8571626252641125e+000,-3.8961959624155340e+000,4.3189799309112891e+000,-3.4366786860246767e-001,-1.2001599209008278e+000,-6.5009967530803658e+000,6.9689750330211220e-001,-4.0920533047888057e+000,-4.9770519699926945e+000,-1.7931007136851806e+000,7.5520267455939969e+000,-1.2320174440434515e+000,-3.2611050768494820e+000,3.3580617911869943e+000,-5.6918827858729628e+000,-2.6076765088737570e+000,6.4178497228190734e-001,4.9664734307129882e-001,-5.3554563538956863e+000,-9.5232484607648993e-001,-3.3894884630314155e+000,1.4540986965034808e+000,-1.3254603447624527e+000,-4.7842899142736517e+000,1.2807120952432860e-001,1.8543231540116825e+000,-1.3360613750237954e-001,-3.0166364343414975e+000,-1.2021482652910873e+000,-3.2731236432990891e+000,-4.7476200977059593e+000,2.0177207465402893e+000,2.5618682240752708e+000,1.6416245764163035e+000,-1.8590560400133138e+000,-1.4009699009429470e+000,1.6307229309117868e+000,8.5972455492349198e-001,-4.3394390230312130e+000,4.4583309959060413e-001,-1.3997426098970047e+000,-4.7642522175065671e-001,1.2367873743967683e+000,-1.9387013055294420e-002,-4.4001582185666788e+000,-4.7068071983131103e+000,-3.6389038893384509e+000,-9.7609941150918977e-001,-9.0739706945553795e+000,-1.3626293782393137e+000
,4.0530268287450308e+000,-1.8843489971519274e+000,-2.3805543620199363e+000,4.5487261625595963e+000,6.0230179543926154e-001,-6.0143881558952383e+000,3.0112680421170923e+000,-7.1066909979022990e+000,3.4975876325327815e+000,3.0169396459472102e+000,4.1662935500322246e-001,7.9068693233383298e+000,4.9479567736764113e-001,2.6004782294206312e+000,-2.6409157885778805e+000,1.6288352667874704e+000,-3.6741027469992296e+000,5.2425915008054513e+000,-1.6227706873430148e+000,4.6494486473840961e+000,-2.3156414266203469e+000,3.3583851911673923e+000,5.4832028243714666e+000,-1.8295180150881392e+000,5.9599256878129543e+000,5.5431539001469545e+000,-6.4602954585006056e-001,-1.3966441701068359e+000,-5.0200563449101434e+000,-2.2982430911342306e+000,-4.2345186263867934e-002,4.0915492724945306e+000,4.3483389461704860e+000,-2.6524411093421163e+000,1.1606237709014178e+000,-1.4442959328932927e+000,1.6004049208147142e+000,-2.0059519933056813e+000,-3.6052625257588526e+000,-2.7532575056845415e-001,6.3627931628971501e-001,-4.7161051112717551e+000,-1.1999199145830987e+001,4.5516756297793437e+000,-3.2184957251689039e+000,-6.4895161636881200e+000,-5.8967495952371012e+000,3.2342669680385336e+000,4.1432640348745551e+000,2.0569888761010273e+000
,-7.7581452059963008e+000,-9.8645143540405156e-002,5.9861618294865986e+000,-2.7309061267420840e+000,-2.0425462378835109e+000,-1.1055593896832166e+001,3.2291991729464322e+000,9.3250072284729040e+000,2.3999742043158965e+000,3.7539013503070917e+000,-1.6319539983121201e+000,-2.8447975642204724e+000,-6.2770770699262330e+000,-4.5707955684322812e+000,3.1626102967095453e+000,-7.2087367340903086e-001,-5.7826681893224778e+000,-1.5654697174360579e+000,6.9813370538633155e+000,-9.8299330614430449e+000,1.9124855997478838e+000,5.4344775033468973e-001,-5.1002076014097106e+000,5.2838982367012797e+000,1.1433632185874972e+001,6.4780633296029961e+000,-6.1461282457274420e+000,1.8831015014938597e+000,1.1099584467023320e+001,2.2748443725911285e+000,1.5868910588507415e+001,-8.9989748391527566e+000,-4.0396609101243266e+000,-4.6539933782559570e+000,-3.8987311879530981e+000,-3.3485010648169183e-001,3.4520664551714448e+000,-6.3635557647664722e+000,2.6061633579208139e+000,5.4240470720792127e+000,-1.3151951400348695e+001,5.2194066499669090e+000,8.8421896729772413e+000,3.6065330162966633e+000,-1.3613786812808266e+000,-6.6357170484124826e+000,-1.9388374295440722e+000,1.0450913798719810e+001,-9.8121444773768907e-001,-1.8786742896715825e-001
,4.5202090608065260e-001,5.4849844534018075e+000,-7.9159259807163602e+000,-6.7871176046141768e+000,-6.2829211741980178e+000,1.6634816179134576e-001,2.5458573630539871e+000,-5.0360008254541455e+000,-5.1821714351156629e+000,8.9154511431793759e-001,3.9998382072705509e+000,-9.4545156862895521e+000,5.8592948086505450e+000,3.8131092872238375e+000,-4.7487746904106363e+000,-6.3140007522020518e+000,2.9788044158495817e+000,1.5394282026260078e+000,4.1011683113512856e+000,-4.8969400226597068e+000,4.9616855047098500e+000,-4.3912784954408729e-001,3.9990629230529823e-001,8.3443709920458176e-001,1.9323857272125990e+000,6.1159707052890233e-001,6.4431724544201974e-001,-1.0514187685791894e+000,-2.9754506725245049e+000,-6.4572849448242717e+000,-5.0388858227996680e+000,3.4568074781503704e+000,3.4599218967219286e-001,-2.2455041283013641e+000,-6.9626339733592655e+000,5.9872865486135618e+000,1.1455220373026789e+000,9.3517963615368094e-001,-3.2308752791539885e+000,6.7024084098977765e-001,6.7917248620438586e-001,1.7112236941099024e+000,7.6100431449807964e+000,-5.1474826844717940e+000,-9.1618133229929705e-002,-7.0141200113833291e+000,1.3976562446799421e+000,-6.1613072333341750e+000,-5.8794340019326174e+000,-1.9577365367461372e+000
,2.9452217605396811e+000,-1.6841047050692226e-001,-6.6195435581581519e+000,-1.0483330187872827e+001,-3.5203936810447933e+000,1.3386515666614596e+001,2.8242791307770636e+000,2.3120441620675161e+000,-1.1150066758189546e+001,-2.3310665940541329e+000,3.5289234276077974e-001,5.8968953134222835e-001,2.8668678016413311e+000,-6.6354517159434101e+000,-1.1100856004113255e+000,-4.2946650145712582e+000,1.0146693790965454e+001,7.7842136115330113e-002,9.6722094966449212e-001,-3.2016458820903568e+000,2.3114023274097328e+000,4.3408260118260977e-001,-7.6242179483834260e-001,-4.6250874870066392e+000,-1.0837328955784463e+001,-7.9136001387400388e+000,-2.2756005506392518e+000,4.6170394303310571e+000,-1.3819975736283016e+001,-9.5971174921846796e+000,-1.1725990333911551e+000,-5.5343187201878745e+000,-3.1857003964580932e+000,6.9972980520783890e-001,1.1336298441676203e-001,-2.5719425115846173e+000,-3.4855449230365085e+000,1.0382753719780389e+001,-5.8949150982908076e+000,-1.0528830039306365e-001,3.6064562189817160e+000,-2.6267824248071747e+000,5.1247298001565262e+000,-6.6484325843158176e+000,1.0405809744053737e+001,4.2676693342327772e+000,-5.8850548527959257e+000,2.0036724768435787e+000,1.6843430701429007e+001,1.5940306368542807e+000
,-3.4471851464195331e+000,-5.8458273610787721e+000,1.5767831454852228e+000,-1.6281794049238170e+000,4.5003201166809115e+000,7.6923709205441488e+000,-8.6140323884892673e+000,2.2385027115885001e+000,2.1912666594323298e+000,8.7628976790963764e-001,-2.8533344190825527e-001,5.1970978202339220e+000,-1.7988350332615390e+000,-4.4504600339041724e+000,-1.3978834256068484e+000,7.2940693716288401e+000,-1.9566371958137581e+000,-2.9874478102508534e-001,2.4293886225911665e+000,3.6399239336324061e+000,-3.6193124115116913e+000,4.3950290722549135e-001,-1.1421990750310587e+000,-4.3675089338463273e+000,-7.4009017696591490e+000,-4.0540043269357078e+000,6.4462472175383274e+000,5.7907859386822595e+000,-4.0557217515402522e-001,-1.0844480949466892e-001,1.3536147317934903e+000,-2.7504152583988999e+000,1.4583255320756121e+000,7.6168385147939350e+000,4.7427463351658528e+000,3.3902099531238594e+000,-3.1178474788494065e-001,-5.1702376235355967e+000,3.4076435796063329e+000,-4.4079114892516937e+000,2.5842671850963068e+000,-2.0403758176039331e+000,-3.7978044313005288e-001,-5.3178728876615207e+000,-2.3778464167760696e+000,2.8943767347490139e+000,6.0885921292966427e-001,-5.0579725510740836e+000,-3.4085259037061792e+000,-2.8155616641706871e+000
,-7.7648573102733325e+000,-3.9886174419911367e+000,-6.1073400976879311e-001,8.5127815912231897e-001,1.9416266479746624e+000,1.7971002245937850e+000,-6.2305519288754478e+000,6.7554604784971373e+000,-6.2300211862579602e-001,2.6405233376662940e+000,-2.2219226269330399e+000,4.2827145199543164e+000,5.1228871232695337e+000,-2.9765687516604387e+000,-6.9134276092309999e-001,-8.9191656240511730e-001,-2.7940592086149327e-002,-5.5150110255700460e+000,5.5862728107623658e+000,8.4613931297396192e+000,-4.2239374113507404e+000,-2.3313665681614251e-001,-5.8795181302599611e+000,-4.7317419006919312e+000,1.3398979010309098e+000,-3.7642924432716036e+000,-6.8771000065983501e-001,1.2127702789885397e+001,-3.9789516092269355e+000,9.1765544900529750e-001,4.3587187859050164e-001,-7.3068248350777978e+000,3.6732037234119104e+000,-3.4030965505660595e+000,8.7098469889685646e+000,8.6333109997623569e-001,5.2555714670139473e+000,9.4701062791072621e-001,4.6921666978973784e+000,-5.2024033363092252e+000,4.8528953995282326e-001,5.1206797787017522e-001,-1.4948052992167593e+000,-5.3868547764704324e+000,-2.8166399279894603e+000,2.3481682332736882e+000,-6.2715547150045952e+000,9.1608832312138799e-001,2.0907171321973861e+000,-9.8145416076184633e-001
,-5.1666958554753579e+000,-4.1697993719116222e-001,-8.4319800913518037e+000,-1.5359251339555937e+000,-7.0609979300766779e-001,4.3411468586802435e+000,2.5693535095295426e+000,-2.1741121756241477e+000,-2.5601575798851493e-002,2.2982612721743501e-001,-3.0333713159000033e+000,1.7581813262472767e+000,3.2793556199447278e+000,6.1765427847373493e+000,3.9674762394762739e+000,1.9930925350362685e+000,-5.6393389262346840e+000,-3.2639128219396136e+000,2.4254169053489312e+000,-7.2455141566814927e+000,7.5504111860620728e+000,4.5567873023994769e+000,1.2160168858636817e+000,3.6533847080841886e+000,7.0641079598141161e+000,6.3235647616357582e+000,-4.6596300310092778e+000,2.0207500941168561e+000,-3.0950243999330023e+000,2.8615647045670788e-003,-7.8074236787256801e-001,-6.7630814328924527e-001,6.9137124094557505e+000,-7.7290270919038271e+000,-7.0202197014653214e+000,1.1280960267225364e+001,-1.7339369051093461e+000,-8.1983066628628531e-001,-5.5357902297283248e+000,-3.7694170090805503e+000,3.9554514978625441e+000,7.2523713517346644e-001,1.2112121062258026e+001,-1.6292463152138104e+000,-1.2124615886986200e+001,1.5134431872318124e+000,-6.4254777394595985e-001,-4.4545227190099501e-001,-1.2218292182342469e+000,-3.8520664828652507e+000
,-3.3561070345154581e-001,7.0707624820431461e+000,1.4674652802508992e+000,-3.0730033919186170e+000,-1.7899452610931232e+000,3.7843178892477134e+000,7.5227842168339665e+000,-3.5987005133635490e+000,-2.3960636280281908e-001,-8.2307275478401198e+000,-1.4360818021181296e+000,3.8254929083819927e-001,3.1555565857999137e+000,5.3135439776426221e+000,2.3174352584767632e+000,-3.3923085197173277e+000,1.7168732819697403e+000,1.9680148487080624e+000,2.5178205572163659e+000,-1.7986745586928874e+000,1.0280379572180225e+001,-2.4684372910962145e+000,-2.4687419393669696e-002,1.4975380011231458e+000,5.8388984181694079e+000,-1.1237795311024701e+000,-9.0839650709205042e+000,-5.0159695949671379e+000,2.4071537595928914e+000,-4.6558227964026466e+000,-3.6669377196913517e+000,8.0228078187696850e-001,1.9560320762470540e+000,-6.9178982983209298e+000,-4.7708336526598440e+000,5.1567231271327199e+000,6.0894423174590582e+000,2.7980394027582123e+000,5.1106870085113663e+000,3.2817455472998662e+000,2.8675389997881764e+000,-3.5534898996502053e+000,3.0061364793976972e+000,2.3239826044004548e-002,3.8347922166483381e+000,6.0738331394029144e-001,-6.7170927411679022e+000,2.6413883707665229e+000,1.4859522089716151e+001,-1.3818286610858928e+000
,-2.4715190174895514e+000,-3.7414919677293051e-001,5.1921287875200166e+000,1.1902324987797133e+001,-1.9756230302336490e+000,3.8802234767123687e+000,-4.0911016907474309e+000,4.7415869557601473e+000,-1.1816388064867063e+000,-4.2548201664959171e+000,1.8842639024118932e-001,-2.1615241000693577e+000,3.1403765141680831e+000,-1.1378960048445477e+000,4.3937882878001613e+000,3.8270455221371686e+000,-1.3872753499230983e+000,6.6712419743230695e+000,4.9470290900903130e-001,1.1258466587334681e+001,-7.4733184602090503e+000,-5.5191973030611785e-001,-6.3232925350748848e-001,-2.1943458835630745e+000,1.5646354080719969e+000,2.7186823390917971e+000,1.0985072863938565e+000,8.0499490520549699e+000,-3.2467377916294953e+000,-2.0038127858112271e+000,-2.4473023790133950e+000,3.5815229916846212e+000,-2.7361527621152018e+000,-7.0574742008027211e+000,8.1565846417201247e+000,-9.1578764436479310e-001,4.3850117043103802e+000,-2.6733941033412845e+000,-7.1186212267290183e-001,-7.0765803713119046e+000,2.6203999193069722e+000,3.6570522832601982e+000,3.1961418178421535e+000,-3.0500289116774870e+000,9.9450462377817561e-001,-6.4755893342861812e+000,-2.8881896223447892e+000,-4.8891221918153436e+000,1.0517692480682424e+001,3.6544895486961035e+000
,2.9666417406904272e-001,2.9720201469407010e+000,-5.6017474259920430e+000,4.7034210856119740e+000,3.4620074421966605e+000,3.5171457983801537e+000,-1.9168368402805152e+000,1.6811930148283909e+000,4.3192059868915811e+000,-1.0797859518581636e+000,-5.3817004787644063e-001,-1.0473814671837853e+000,2.1962163431478650e+000,-1.3761400379487618e-001,-3.2578390146238689e+000,4.3506291168241455e+000,-1.4292086023620361e+000,-8.9405910022638651e+000,8.4399434727659581e-002,-2.8940684720691636e+000,5.3666691145990360e+000,8.8177255016488687e-001,-5.6752472750834157e-003,-1.9495389295037431e+000,1.8064237267480887e+000,-3.4297707079803463e+000,-1.0160893452890365e+000,-1.6731593068488397e+000,2.2929244435170890e+000,2.2366880983195068e+000,-1.9950526222917837e+000,-3.8941073367627848e+000,1.5433138519138578e+000,4.2197946352835043e+000,-2.8077699305944703e+000,-2.5851128126741790e-001,-5.6566675377543807e-001,4.8540005055384006e+000,3.1487208799966769e-002,-1.3155036246132684e-001,-3.3517562233580347e+000,-1.0092338530555633e+001,-6.3488890442060830e+000,-3.9061374212523298e-001,-1.9485004835642112e+000,6.9843196369239573e+000,-2.2999028127816290e+000,3.3602085971705238e+000,-1.5620520805170279e+000,-3.9491968415013727e+000
,2.6048494755189662e+000,2.9964190143001979e+000,6.7571854933163005e+000,-5.7916367291253634e-001,-5.0833149899180032e+000,2.2104847992939369e+000,4.7041570755041240e-001,-3.1851851483527565e+000,-7.7722094428096733e-001,-4.9353560365544142e+000,1.2263777645695213e+000,-3.2808145377925495e+000,-1.9961238317497771e+000,4.6511020918184149e+000,-2.6607563459666190e+000,1.8688055512071997e+000,3.6941558977895466e+000,-2.5805269534045476e+000,-3.9943189696700848e-001,-7.0378726393183380e+000,3.7150356361287500e+000,5.1561449210203465e+000,-4.6073718501041476e+000,2.4696447169066404e+000,-3.9411157544994770e+000,4.6327728756694020e+000,-3.7446992848713241e+000,-7.8867550642307682e+000,5.1630641286160168e+000,1.8734277127680381e+000,-3.1673874305394509e+000,-4.9650452584674927e+000,-5.4648587166823068e+000,-2.2776037495174153e+000,-7.5102068243324931e+000,6.1305655049562073e+000,4.4183439158525706e-001,-4.4668863024756378e-001,1.3167555564095549e+001,-1.6110353072594135e+000,2.9690065476329246e+000,-3.1525897823014577e+000,9.0512984361701161e+000,4.8407480310665285e-001,-5.4244869846681931e-001,1.2888974804914455e+000,-1.9021503201540890e+000,4.5864855911547471e+000,1.7225792820365322e+000,-3.9824931880513068e+000
,1.8231673285971719e+000,-7.0001556271648511e+000,1.1485846713961731e+001,5.1577039977630070e+000,-3.0568470009120978e+000,-1.2857634279969027e+001,1.1507675097475594e+000,-5.9461081900247228e+000,-3.4188254934032081e+000,4.0423304736025861e-001,4.4267572682944598e+000,2.9868652400815972e+000,-6.3732997626917332e+000,1.6452847894751246e+000,-4.4267453088457192e+000,-7.4033665499888865e+000,6.8872891214096921e+000,3.3994482733247073e+000,-4.0318658986080083e+000,4.9858481415162199e+000,-5.7944776468617079e+000,6.1481567452274879e+000,1.6320192313311395e+000,-3.1650980492201355e+000,-6.4617373706941112e+000,4.4208297333707351e+000,6.3735789557047760e+000,-2.7479316152368085e+000,-2.0499011963889031e+000,4.8630430784247819e-001,-1.3283266997575174e+000,4.7051895884164265e+000,2.6455191310692143e+000,7.8745605492249782e+000,8.1294860775022340e+000,-2.0120994132679395e+000,7.7761182580198938e+000,3.1297747186355043e+000,3.6371128995356652e+000,-4.2030550816160090e+000,8.8663708284773091e-001,-3.3405741942572004e-001,1.6585541300317976e+000,2.5845850515318598e+000,-2.5149128079144218e+000,-5.0908428932439174e+000,-2.9153631028861762e+000,9.2741548352896981e+000,-2.1433748385601166e+000,2.7035924462540950e+000
,7.1489923725660409e-001,-2.1127479967924248e+000,2.8192261862008521e+000,1.5083412800243428e+001,5.8586356388110037e+000,-1.2193307869141913e+001,-2.2980760121405526e+000,8.3506900491133917e-001,1.3307217935755807e+001,5.4509103868950310e+000,-5.6232547903206695e+000,-1.4160964517954446e+000,-1.0532352336436606e+000,-4.5792992077246425e-001,-1.5575426441628615e+000,1.1586986869065132e+000,-9.8210424380287122e+000,1.4155711333073322e+000,-3.8610147568957203e+000,6.7622355663153577e+000,4.4525318125257991e+000,-2.7733833730937709e+000,3.5902823959104171e+000,2.3942673732200257e+000,4.3085199915146726e+000,8.3193366954880899e-001,-7.3824286375076653e+000,5.4874861066437060e+000,7.6101427257282097e+000,9.6732360999421001e+000,-6.2556127412705176e-001,6.0366249987577607e+000,4.4004844455150227e-001,3.2612946240293885e+000,8.9202150493347043e-001,-1.3337392183961578e+000,3.4888862920441350e+000,-5.5759908219895102e+000,4.5515601503242626e+000,3.9469173233064625e-001,-7.3882878265914744e+000,-1.6127223291856254e+000,-5.1051638655163423e+000,1.1711372588296905e+001,-1.4527042164639599e+000,-1.1184455382710803e+000,8.2702685380623713e+000,6.1268254964828230e+000,-3.8349391290106691e+000,2.6592264504272167e+000
,-4.6316674520859430e-001,-3.8935058983974993e-002,5.0926383662392345e+000,-5.5354351566522046e+000,-1.6637932192880718e+000,2.0528938319119661e+000,-5.1016813154598326e+000,-3.2865504806885566e+000,-1.3709507625760056e+000,4.9457343239615517e+000,1.5966689520840194e+000,1.2913033973754501e+001,-4.7490870504065787e+000,3.8821847932506928e+000,-8.7774780036817057e-001,-4.3996773299896113e+000,4.5202014181850378e+000,-4.9031942705015945e+000,-3.3830107711856834e+000,-7.4553413366514629e+000,-5.5901035933342049e+000,7.7527677934700714e+000,-9.8516056135935587e-002,4.0482169310873317e+000,8.9724225924070158e+000,6.0902755089479612e+000,-2.8386386213715555e+000,-8.9106652184988864e+000,9.8901563044713503e-001,6.4998328402531191e-001,1.3614123652336918e+001,-5.7346875897302141e+000,7.1780197429491448e+000,-1.0337801894096472e+001,5.2890325554999933e+000,-2.0402494448151982e+000,2.8202679360060929e+000,3.8389248466026653e+000,7.1393911269608292e+000,1.1834501838615374e-001,4.9560425648324333e+000,4.4893226629868215e+000,4.1907750455089596e+000,-4.8243228782179211e+000,-4.1472081883040870e+000,3.1366895472270921e+000,-9.8606522362319673e+000,-3.8550045385706602e+000,-2.5610581031535440e+000,-3.1378457578325269e+000
,-5.2836273838891579e+000,-2.8815824446201304e+000,-4.7552577902598596e+000,2.5412893861642372e-001,-5.3152546849370053e+000,-1.7732955853119183e+000,-3.3832699892849956e+000,2.4565239991822888e-001,7.4577614020928318e-001,1.4254129194103693e+000,-2.1002117738144994e+000,-9.6169199400079919e-001,5.3790275789583379e+000,2.2489591424230468e+000,-2.8360578756252077e+000,-6.4400438846124581e+000,6.6442822924926037e-001,-5.2358093747879817e+000,2.9328928561523993e-001,-2.4523623765379485e-001,1.4275301439657597e+000,-9.4671036150133880e-001,1.7431212265818727e+000,1.8356930849449866e+000,6.3351225565534790e+000,5.2500948340246389e-001,5.5469285030803964e-002,4.6409856956437112e+000,8.1224089813038869e-001,-1.7079888440406188e+000,3.4716153706178698e-002,1.1109002416769145e+000,2.0538453507277583e+000,1.1298240660938865e+000,-7.4249451466549610e-001,4.0227526179640716e+000,1.1588017471594141e+000,6.0166201535169446e+000,-9.4023627469053483e+000,-5.6533297626916239e+000,-4.0605757318494193e+000,5.3092381649969189e-001,-2.5933070261937661e+000,-5.4594003576216048e+000,-9.7394346490535053e+000,-5.3513535624768252e-003,6.5206646104027977e+000,1.6299133627589169e-001,-1.1356343237597859e+001,-4.9852545048266474e+000
,-1.1864604689855875e+001,1.2931772291353982e+000,1.8402193139550544e+000,-4.0420036107493145e+000,-4.7846813025113226e+000,-3.4115638138517470e+000,1.0361860511857974e+000,-4.4494079012200913e+000,5.7575157377924746e-001,-8.2810156686999381e+000,3.7418361442152528e+000,9.4942039203701878e+000,3.8523623603054937e+000,-1.1894869422299352e+000,1.4969706842247945e+000,4.7308348664840683e+000,5.7154050983790139e-001,6.8863958602171680e+000,7.3348667857514593e+000,-1.1106307010293291e+001,-6.6627749560887928e-001,4.6647970921762862e+000,-1.6591584193504847e+000,-8.3601385446505052e+000,6.7318808390071083e-001,-2.1103057569457193e+000,-2.9684150640653134e-001,-2.9474073860189267e+000,-1.1307584464248698e+001,-3.5290929926976924e+000,-1.8871154018317107e+000,-1.4395350558063708e-002,5.1415401323803334e+000,-2.5803666163110925e+000,-3.5595145924380014e+000,2.3892136920461464e+000,1.2323426962656616e+000,-1.1293367538657562e+000,-8.3951947886049216e-001,1.5687649791348799e+000,-1.0661161604438734e+001,-8.0098716104107073e+000,-9.3232378658308193e+000,3.1682169692155502e+000,-9.6717438461850624e-001,-2.8043411756205976e+000,-3.8517426574980598e+000,1.9754748283029675e+000,1.2424173141005145e+001,9.6098673014747487e+000
,-6.0914548728392603e-001,3.9203705703777989e+000,5.0800095077777287e+000,2.6739095749910602e+000,1.4726100965536593e+000,1.1465176844260533e+001,-9.6225359078035186e+000,-2.3900179874056766e+000,3.1914345348994457e+000,1.9593850652052527e+000,1.8856400531655928e+000,2.7079934678278961e+000,7.1752646322789537e-001,5.2359838948393049e+000,-6.0820434052552802e-002,9.6063202621320087e+000,-5.9727054836807589e+000,-2.1171782588613639e+000,-1.3699056683779329e+000,-5.0723885637241994e-001,-5.7101792176493238e-001,3.0991708649284835e+000,-5.6521776443623295e-001,5.3129043372111676e-002,4.2924795837999807e-001,5.0870410385179614e+000,2.5078074753790491e+000,-8.8918765995246059e+000,1.0985935053638622e+000,2.9140235225006403e+000,2.0570717829502100e-001,3.8651931155674696e-001,7.9876024006882873e-001,-3.4203090619871959e+000,4.4551226943915543e+000,3.3541720032232973e+000,-2.5872391415994143e+000,-3.7634664008684475e+000,7.3717193516030806e+000,-6.4292715864512950e-001,1.0241206956976981e+001,-1.2359996887085538e+000,4.1510513868326306e+000,-9.4197977501216723e-001,3.1100167548783997e-001,4.3136476411300455e+000,-9.8574637700042766e-001,-1.4070926816813452e+001,-6.2529408007046063e+000,-1.3363497104103585e+000
,4.6248006588493542e+000,-1.2524760020368615e+000,-7.6074060025445513e+000,-3.6968282365076810e+000,7.3192208179215568e+000,-3.4790223475317212e+000,2.0155247639546841e+000,2.0109770930561854e+000,6.6060878035350550e+000,3.4287922498360222e+000,-8.6201643218527497e+000,-1.6607298168228533e+000,5.1335117699446292e-002,4.6878596438881803e-001,5.9489942320132458e+000,-4.6100113872317099e+000,-9.8992048136750277e-001,-9.4483569342058760e-001,-2.6990540467456308e+000,9.4558914278719328e+000,8.0683825361216577e-001,-5.4452452375969500e+000,-2.3628600196975618e+000,1.0451615342775106e+001,3.4968965886778793e+000,-2.7495603977089553e+000,7.2166448291809315e-001,8.3895323602136198e+000,9.2800882281159591e+000,1.0400644650999160e+000,-9.2114494398731220e-002,9.3266897302184120e+000,-4.6010577102573382e+000,7.8187710686109513e-001,2.4293097352377404e+000,-3.7131512861669047e-002,-1.5138631016740141e+000,1.1435936714118213e+000,-2.5142963280549862e+000,7.0534370232069410e+000,5.0734112127806128e+000,8.8504460050415794e+000,7.3896880523105120e+000,3.6052820490442676e+000,1.5750021373981287e+000,-1.5740889847625090e+000,1.1364142452818664e+001,-1.2978070116701115e+000,-1.3199166352026312e+000,3.5385938834896074e+000
,7.2232914934328081e+000,5.2496627277177987e+000,1.1690868011797662e+000,-2.2570424549795765e+000,-9.3776223822605032e-001,1.1410435340221745e+000,6.0901379315588491e+000,1.3513911604453406e+000,-5.2767946642842576e+000,1.6400969368819516e+000,4.0799797291328712e+000,-9.1074193434790285e+000,-1.2362925665078228e+000,-2.1588858438287102e+000,1.5141297306234942e+000,-4.1436884531790827e+000,-4.2037447353524571e-001,-8.0816746477611598e+000,1.0400159844335737e+000,-4.2568787738202625e+000,-8.3468527206809391e+000,4.0103573756657500e+000,-8.9145105183432349e+000,3.0335858381663106e+000,-4.8690740387238369e+000,8.1204733743750399e+000,8.6835571632956761e+000,-9.1817766898104232e+000,-2.6313313668935638e+000,4.2257572245871735e+000,7.1327169362954876e+000,-1.6654522241389318e+000,-1.7686805018121088e+000,-1.2045078168461507e+000,-7.7306278623375588e+000,-1.5970628246642891e+000,-7.6287118362788906e+000,-8.4671457928656713e-001,-1.0190526590363962e+000,3.6015207206278856e+000,-5.9275716757582519e-001,1.2651963939317568e+000,1.2243831858067077e+001,-6.7100196596205719e-001,-8.2967822763050716e+000,2.2991724990553846e+000,-4.3882405336640042e+000,2.4989098087666801e+000,-1.7497943493979708e+001,-1.9748765615384682e+000
,3.2482035377926533e+000,-1.1360715756968091e-001,-1.8984048369512379e+000,1.5771424739141601e+001,-1.9433240718891318e+000,6.7137369308291825e+000,-9.0800262015281543e+000,1.2427786628590862e+000,4.1367047972104602e+000,-1.0813704787528748e+001,-9.4409970875800830e+000,4.7094158036935090e+000,6.7648466762096806e+000,1.9438841676975795e+000,-1.6371246734583782e+000,-7.4135671514726531e-001,-6.7244505482676846e+000,-5.2068259926599207e+000,-3.6905551469741832e-001,3.1869701951790228e+000,9.6394336029539822e+000,-6.5840789745434747e-001,4.0418196140975256e-002,-8.4037419455648106e+000,3.7292160037932995e+000,-3.2737349038418180e+000,-8.5147453503640502e+000,-1.0645944417862012e+000,-3.6723742264320207e+000,2.2488027868527078e+000,-6.6103786948619483e+000,-5.2323015605956797e+000,1.2172854077272651e+001,-8.9405656883093532e-001,-4.3992500270224655e+000,1.3041629585855601e+000,1.0120035637873093e+001,5.3840213851349827e-001,6.7739425455766566e-001,-1.5626914563724617e+000,-9.1217909409640576e+000,-1.5940553727030816e+001,-1.9383172551488634e+001,6.8822707845468347e+000,-6.2601846934513850e+000,7.5592191672235964e+000,1.8132310651882325e-001,4.4521601543756484e+000,5.6251212875926644e+000,-5.4120655068477168e+000
,4.5218151529564947e+000,-1.9976262397247651e+000,2.2885052115546571e+000,6.2747762215383931e+000,-2.0375932259009786e+000,2.3240718320982694e+000,1.4280380970982047e+000,1.0941675169165450e+000,-1.1936966576547732e+000,1.5299980628741502e-001,-2.3714094633943184e+000,-3.3058055207699151e+000,-9.3230481576344515e-001,5.0420605344918759e+000,-2.7876138570258937e+000,-2.2207021201700479e+000,4.3334937864659766e+000,1.9403092840782226e+000,-5.5357475781553562e+000,6.0704892062639324e+000,7.4603845538190559e+000,-3.8640866151320581e+000,1.7046632306183704e+000,7.4729659877609285e+000,-1.7871737800820866e+000,-3.8887950945094913e+000,-8.1484142348439956e+000,3.7962804822076262e+000,-3.5938080660069160e-001,7.7225800897011754e-001,-4.2504513480357780e+000,-1.7631708414996788e-001,-2.2278682169000432e+000,-2.9863965024167642e+000,1.5825340967736146e+000,-3.4970339880237886e+000,5.2288793672126941e+000,4.2036036672590402e+000,6.3521701118285891e+000,-2.4180914825910640e+000,1.4388084911073515e+000,1.3041393066293936e+000,-6.1263198618286041e-001,3.4190714876403665e+000,1.3234967252039171e+001,1.6362229353310938e+000,2.0117773741629037e+000,2.4410743748650603e+000,6.0763167431540497e+000,-4.9676531967193398e+000
,-5.0060754739278384e+000,3.8910696112122323e+000,-6.2135803480383140e+000,-5.0432862498910920e+000,2.5425871088080392e+000,2.3106009695968837e+000,-4.7880594660191109e+000,-2.5081472661268895e+000,2.9492448139053717e+000,4.4079611176734108e+000,-1.4449455642902527e+000,1.7098228682941903e+000,2.4262747574264321e+000,-3.5068298951140933e+000,-2.8480672455229143e+000,-1.1564147561601641e+000,-1.2910585251787643e+000,-2.8710279270861920e+000,6.6319543860749679e+000,-7.5776058602758534e+000,1.2810422924042646e+000,-3.0916350590400001e+000,-4.6834169470694285e+000,4.2385539650518123e+000,8.8093809145302124e+000,-9.8229008108608831e+000,1.4697269795885957e+000,5.5982770203132837e-001,-3.3792589843769654e+000,1.3741830411820128e+000,1.2995788828396325e+001,-1.6836500489523063e+000,4.3235404984728660e+000,-2.6285111377342578e+000,-4.7270668610698363e-001,-5.3816736897024366e+000,-2.3589705431286205e+000,-1.7127784200082679e+000,-3.0997632279357532e+000,6.6729707892478247e+000,-4.5219329050817558e+000,1.4423982895076934e+000,-1.3126538808102870e+000,-9.8474647745921595e-001,3.9746217089109956e+000,-7.3003517902489901e-001,-5.3377778175606299e+000,3.2841957194853570e+000,-1.9800747633150213e+000,3.1908812830548667e+000
,2.9245635634469642e+000,-6.6154045645456638e-001,-2.6579254760369238e+000,-7.5402856413173307e+000,-3.8999487845468064e+000,7.8772667183018834e+000,5.4151605852172429e+000,5.3020677509154837e+000,-6.0839635748650656e+000,-2.0304564110630370e+000,-2.2481528778092925e+000,-2.8484646036608599e+000,-5.9479334829812212e+000,-6.8028191704633167e+000,6.0542281549551058e+000,2.6026630080810154e-001,3.0497587066230203e+000,4.2089554681329933e+000,-1.4468448854997834e-001,4.7578075833344524e+000,4.1258810378904043e-001,1.3298790354625238e+000,2.2999048094270651e+000,5.6291370270268570e-001,-1.2362773524800987e+001,1.9343543085093158e+000,-7.5579695850257833e-001,4.2386422854263746e+000,-2.3422784917485506e-001,-5.2223952719710915e+000,5.0255507968400959e-001,-4.1763316045082688e-001,-5.4529813380921315e+000,-1.0249446838745901e+000,-4.9733606582436476e+000,-1.2656690805203732e+000,-6.6575110866379630e+000,-4.0671448805235331e+000,-8.0783684792437516e-001,-1.5338509568089023e+000,4.2600227301578197e+000,5.2336935395664286e+000,1.3322172693987124e+001,-6.7515272323809441e+000,-7.6906120836188741e-001,-1.0519818034962253e-001,-1.6713589914411011e+000,3.5969339894882433e+000,3.7421112397430849e+000,-3.6299644687614521e+000
,9.1137736425015314e-001,-3.6210332517370016e+000,1.4241630266536351e+001,-6.9262641407944852e+000,-5.1047132193551397e+000,-1.7846386272103967e+000,7.2403464760406189e-001,6.9618311613652892e+000,-1.2635271780228175e+001,4.8918271483304991e+000,9.1784708224910627e+000,3.2308648586104027e+000,-8.2602597472940751e+000,-1.1939202628505621e+001,-1.0965073313317306e+000,1.9446710198374646e+000,5.7236613282502147e-001,5.6056564007345233e-001,-5.7755521939326568e+000,-9.0571786483332613e+000,-3.1693047528076375e+000,4.0373378108908229e+000,3.7202610335281685e+000,-5.7721072494624730e+000,-5.7496243905714248e+000,7.6662800892717780e+000,-2.7866560589672962e+000,-3.0627345922765778e+000,2.0122088154329849e+000,-2.0535208518660579e+000,7.0217240020058496e+000,-1.3535790325351622e+001,-6.1745642060872523e+000,1.8310542479302925e+000,9.3403300764438901e-001,3.5601055784433471e+000,-3.7642835567307604e+000,7.8105011804444757e-001,2.0075537193234183e+000,-4.4561132939526127e+000,3.5203518846430910e+000,3.5270633984557067e+000,4.0481946540237823e+000,-8.5550353241383839e+000,2.5587669823147059e+000,5.9217213786071010e+000,-3.5900407521810274e+000,-8.4589831401383684e+000,-1.8355560229854886e+000,-3.5177948510631998e+000
,6.8547951203351831e-001,-2.2502047043382203e+000,1.7831275504998552e+000,1.9411558038793562e+000,-1.0440876525015121e+000,3.5524432868500471e+000,-1.5982213829068863e+000,-2.7260932888435803e+000,-3.2758800153946139e+000,-4.7641203300249968e+000,1.7923104617288688e+000,4.7460339895142339e-001,-3.1220793673564118e+000,-5.8879626786565575e+000,-2.8234750913777440e-001,5.4495660392610758e-002,7.5243987746737497e+000,3.9221978300612674e+000,7.8513953230771219e-002,9.8193695802471015e-001,-2.8978946979723152e-001,-5.1949448213725278e+000,-1.1720220919006277e+000,-1.6715306238821022e+000,-1.2917972005547458e+001,-8.9931768061842927e+000,4.4952056371879401e+000,1.8586621991861560e+000,2.0900750761897027e+000,6.2633382646114448e+000,-9.3612484406374836e+000,1.7113808094457479e+000,7.3523176570351267e-001,7.5390548278572496e+000,8.4527224911249677e-001,5.0702561562752502e+000,2.0558549190727593e+000,-1.5513559122863239e+000,5.4584147678510826e+000,-1.1278514003213678e+000,8.1522968025845213e+000,-8.9564486845202440e-001,-8.2105023870746763e-001,-2.1239148671962768e-001,4.8352710596398722e+000,8.1997094054914932e-001,3.1926171359625988e+000,-1.4064772361264610e+000,7.0508466218335011e+000,4.8882608769529545e+000
,-2.0470858357196002e+000,5.9853594309617684e+000,7.8649479598883056e+000,2.8666713659058232e+000,-1.1455139204546754e+000,7.7812434077113881e+000,-1.5134098276644659e+000,6.8637450194095457e+000,1.7679186909836935e+000,-4.3255337795290476e+000,4.1727162340654624e+000,-5.9992565295736675e+000,3.7533740569912868e+000,-1.3756271110986649e+000,-6.6804059893868377e+000,2.3667715141293479e+000,5.6271258216417532e+000,-2.6281524403773453e+000,-4.7148010840093493e+000,-2.3985710522752881e+000,4.3051545295201761e+000,3.9388455363878228e+000,2.4401452993795565e+000,7.0122153193027348e-001,2.1407918780721480e+000,-1.3083384079893992e+000,-6.0126709027329968e+000,-6.7895433236111167e+000,7.0428327795598484e+000,-3.5814138811771463e+000,-2.6745528167303143e+000,-1.0353236057017385e+001,-6.4507303161186966e+000,-8.5388435307263570e+000,4.9691989815334353e-001,-4.6377044563600851e+000,9.4321689548071355e+000,4.1138653537320078e+000,1.1638457495582875e+001,1.6594110151581061e+000,4.0499168077447395e-001,-7.0012701444904246e-001,4.0737399154321734e+000,-4.6662900066935640e+000,1.6725469244254835e+001,4.1589911342598258e+000,-2.7053126486781087e+000,-6.4170593588931970e+000,7.3570534389171733e+000,-7.9604210783495102e+000
,-3.9048482723357472e+000,-9.9755470615005204e-001,2.3160453361666762e+000,2.1651432561188959e+000,-4.7025237774267792e+000,1.4080616982404106e+000,-6.1132765438429475e+000,3.4046805113961240e+000,-9.2446975237357820e-001,-6.7922654486149092e-001,-5.1727405927807659e+000,6.0777319226072102e+000,-9.2086933305910570e+000,3.3315828367554863e+000,1.1131483248308074e+001,-6.6802510864263596e+000,2.0497869965763509e+000,-5.2328555074041301e+000,-1.3309024963264615e+000,-5.5574235903749329e+000,-7.6541276059061074e+000,-2.4209691260347741e+000,-4.1480705761844572e+000,1.5786998978769549e+001,-1.3158149517992754e+000,9.4384757868557330e+000,8.3538955463816755e+000,1.1044711104871845e+000,5.5214173876269310e+000,1.3548170700023649e+001,1.4821765169052050e+001,-9.7533097975170993e+000,2.7400145801457518e+000,-8.9749429854204965e-001,1.7621548289113351e+000,9.3349886693383510e-001,-2.1583978621138757e+000,1.0693802548829192e+000,2.0228323267816886e+000,-4.2265083941926482e+000,-1.5964610966343229e+000,8.3676467124631948e+000,3.3001333336157384e+000,-4.2234329092448730e+000,-4.3847623056571514e+000,7.3510209194735454e+000,1.8139250561338154e+000,-4.4686912343170621e-001,-6.4884168866432974e+000,2.8228293736815289e+000
,-5.4375636216293377e-001,6.6693890934008877e+000,5.8695669928451384e+000,5.1798734612631678e+000,5.9527402299405061e+000,3.9017362572555698e+000,-6.1113943586287434e-001,3.6907674440900009e+000,4.1431984446936907e+000,-2.3500123747083951e-001,6.0826568657452817e+000,-1.1501158185333246e+001,1.4021476797283059e+000,-1.1526976730907434e+000,-1.2525063573527939e+000,1.1741181134216299e+001,-1.0579997350257871e+001,-6.4725216595500017e+000,-9.8683915164063940e-003,-5.0825139324607012e+000,4.0920512866134828e+000,4.2293573748363116e+000,-1.4843329236657192e+000,-3.8095155897199757e+000,3.5238294008007771e+000,1.5362544657659443e+000,-4.6644799146078260e+000,-9.7400176215953174e+000,7.5314182768507481e+000,4.6011675759090211e+000,5.1090757606000603e-001,-1.1140180347287947e-001,-9.4125264557704225e-001,-1.8377614684163927e-003,-7.7440882455118478e+000,-1.1321012799039716e+000,3.3975750232331403e-001,-5.6923937232396700e+000,8.7408751901969453e+000,5.8487383280699135e+000,4.8025197003097292e-001,8.3644305415878517e-001,1.1569829516144816e+001,5.6360309078892703e+000,1.2400290286083848e+000,-1.4270298143000693e-001,-1.4931441815354058e+000,-7.5083161935158849e+000,-8.6398284184815068e+000,-3.9855992613047539e+000
,-9.7229178176256408e+000,1.2237304109344873e+000,6.1483683425928133e+000,3.9390589886324712e+000,-4.1456255392467751e+000,-5.2564047727205550e+000,-6.6738814439588001e+000,2.6982969376958290e+000,-4.0664884456966072e-001,-5.0756521948243662e+000,7.4234422115881804e+000,-4.2676331394227729e-001,-2.8220900854520287e-001,4.9853788283680656e+000,-4.9328409110036615e+000,1.8659285219734565e+000,-2.1950293765366014e+000,6.5015369894615205e-001,3.3641320694535586e+000,-5.6701193250519779e+000,-3.7486536837587865e+000,2.0082123005904480e+000,-6.8063853157838139e+000,-6.3771726001196916e+000,6.6207246966365121e+000,5.6214119815572694e+000,7.8469064393639953e-001,1.5464900057469269e+000,1.5029112195862371e+000,-8.9194019348114925e-002,-1.7349149820646252e+000,-2.1259382978191019e+000,1.3645612692513860e+000,-8.9160135658389406e-001,3.7615548979138520e+000,3.5848616722971749e+000,3.4709287742466781e+000,-1.6450903687955318e+000,-5.3292898771781472e-001,-3.8771373712956838e+000,-7.2631271844242207e+000,8.6366675028179885e-001,-3.8244194419067621e+000,-3.8993360177240080e+000,-2.8364142591114496e+000,-6.7814172697243968e+000,-1.7525249594663577e+000,-5.8176648298400258e+000,-2.9432796646677586e+000,3.0960411284463025e+000
,3.8050452006769392e-001,-5.3455620437816611e+000,5.3040246829369853e-001,5.7697357225548345e+000,5.0525235685783674e+000,1.9165633815135438e-001,-6.7246089040790222e+000,5.6268624188415766e+000,4.1882614785918815e+000,1.6002600103811742e+000,-4.9824403584408623e+000,4.4050067670152373e+000,-6.8783327943174584e+000,1.7185232185571799e+000,5.2985258321134721e-001,-1.8059328706642681e+000,-2.4507232813548026e+000,-1.0173870886818232e+001,-5.6141421130228784e+000,6.3181355911266524e-001,4.6580428145464401e+000,-1.5310469728543996e+000,4.4493017486650338e-001,6.3555289417190703e+000,4.3126679561078456e+000,4.0445769539552616e+000,-3.8464125773766001e-004,3.6915284488653359e+000,5.5380547924924288e+000,4.1274162920938107e+000,5.2800971181653704e+000,-7.7713132106604110e+000,5.1978048109598092e+000,-9.8435441514820010e-001,1.9255710821344236e+000,-2.7672785643822246e+000,4.6571313321724812e+000,2.0292189455876155e+000,-6.6681327474375843e-002,4.5187825446676821e-001,3.5823045899542505e+000,7.9324309708603113e+000,5.3467361496158494e+000,2.3921896010992869e+000,8.3370095193321114e-001,5.5701464991098888e+000,6.0334410871826150e-001,-7.4931186180840548e-001,1.2079289274754368e+000,-5.8625433839404586e+000
,-1.5885196853469390e+000,6.0193341017515376e+000,5.9435247204248441e-002,-4.3367479477741719e+000,5.7031675201409513e+000,1.1496493813664879e+001,-7.2232014127725535e+000,-4.3800281967108772e+000,2.2200652275907231e+000,8.5419279903757517e-001,4.1973503917222024e+000,7.1327431956937914e+000,-6.7840507707639763e-001,7.1689636392514533e+000,-9.1503203713593795e-001,1.0265630202689072e+001,-2.6419301200347234e+000,-5.1450782358264764e+000,4.9207014214024012e+000,-9.5953830074669373e+000,1.2252815162682940e+000,2.3222026816864512e+000,1.0671953252994828e+000,-3.9542860975042893e+000,-1.5118921397147604e+000,-1.0543192696646136e-001,6.7391498848495237e+000,-9.9055508548075615e+000,-2.5130369531504169e+000,-2.8081005671103361e+000,9.2527233685454888e+000,-1.6941512287245895e+000,6.5316387786896621e+000,-3.8165559110516099e+000,5.2255606658008524e+000,2.4559789267451624e+000,-3.2854731436557798e+000,-3.2329134447745633e+000,7.4527184987487471e+000,9.3205657971644762e-001,1.2095851696408237e+001,-6.6615362642738740e-001,1.6160608304896412e-001,-1.0869892129182173e+001,4.9204564454858879e+000,4.2883868508731009e+000,-3.5807483215187728e+000,-1.8399048415752503e+001,1.2479363940882788e+000,-4.3926778928000854e+000
,6.5769807553748070e+000,-3.8172831209446958e+000,3.6144348261607253e+000,1.2545564310275601e+000,7.8741681494346871e-001,2.5657170392368598e+000,-6.5728692430321916e+000,-6.0485483360795156e+000,-5.7245052248687289e-001,3.2850948232803362e-001,1.4983128792702884e+000,1.1594123608525646e+001,-6.2064725054493568e+000,5.1624133839567126e+000,-1.3732901818005883e+000,-1.2609669494575687e+001,2.7318384855098339e+000,-2.3478559361583677e+000,-9.3331014691652854e+000,8.7106033472171362e-001,-2.8495543963973788e+000,4.1982500586793590e+000,2.2492442642584312e+000,6.2142450024098821e+000,-2.3214910239485753e-001,5.5604593527221469e-003,6.6435901505013351e-001,-1.9743352519942505e+000,-4.3795679464807131e+000,-2.8499406210309739e+000,-3.5920392853027101e+000,-7.3885195386364866e-001,9.6838457589325060e+000,8.3154702544509962e-001,2.3784012699751163e+000,-1.1148602251591961e+000,1.3420108909579122e+001,9.3847726014755253e+000,2.0178493387958629e+000,-4.5694166154690858e+000,2.4579962313736043e+000,3.7957719547951498e+000,1.5273576982323585e+000,1.2368083159100400e+000,-4.7554777348511772e+000,4.7510510362434655e+000,2.8675528505130896e+000,-4.3254893320254189e+000,-3.1605542469573757e+000,-2.5925006789101124e+000
,9.7639487688478113e+000,5.3998907268841574e+000,2.5935458792647439e+000,5.0228925314554355e-002,-3.5704079329211145e+000,2.5105983824106786e+000,5.0665838083735704e+000,-1.1859278114366289e+001,-6.0013051781510987e+000,4.0929673198229377e+000,-1.0305551576643450e+000,2.9922034173611523e-001,-3.5985417258008243e+000,2.0485970654064918e+000,4.6423794713851319e+000,5.4658264169255810e-001,4.2008392702057229e+000,-1.6926356212579248e+000,1.3103883272353416e+000,-1.0461983576264512e+001,-2.1537708054285405e+000,-2.5601801047754678e+000,-1.5639064382078688e-001,9.0943859759246912e+000,9.7991038821757759e-001,6.5488574538713085e+000,3.0722999030760136e+000,-2.4398249435698169e+001,7.4999929156210747e+000,9.8841664702202472e+000,8.3676547274692474e+000,7.7934338059599737e+000,1.5227405811752073e+000,-9.9258659704002350e-001,-3.6250848816174548e+000,2.7636643285163833e+000,-8.9017143322684262e+000,-3.4256976753560293e+000,-3.2819551139167968e-001,1.1456029522853832e+001,1.3064310615478087e+001,5.1612432033010194e+000,7.3798837993376196e+000,1.0148480210180699e+001,-4.1385692514564294e+000,1.4189451741830217e+000,-4.6542448210871665e+000,3.3554074355571086e+000,-5.5324924385846810e+000,5.9349909293212724e+000
,1.2560866431941571e+000,3.7480956024950389e+000,-2.3597838546770027e+000,-1.2198874515935918e+000,6.8320830459955086e+000,3.6728319500474833e+000,-5.3657654116117568e+000,4.0527202794586223e+000,9.3889936338471340e+000,-7.8422192668904982e+000,-1.0147629080890554e+000,-7.7027588097553705e+000,6.9696708648823980e-001,4.4674018746664466e+000,-1.2383150548770665e-001,5.7019862908848653e+000,1.6117398685088868e+000,-1.5407472883280505e+001,3.0949582940687481e+000,-1.3651248190397858e+001,7.5721940918225492e+000,-1.8101384319925056e+000,-6.9435166283158605e+000,2.5838585494815974e-001,-2.1633605422122106e+000,-1.0371603058474584e+001,-3.5648261991489488e-001,-9.6415953802038246e+000,1.0280203185378966e+001,2.4719064670615847e+000,-7.4378193379471043e+000,-2.0654157176475225e+000,1.4593682471905760e+000,3.5604596651220848e+000,-1.1380357918840678e+001,-1.0569040341228426e+000,2.1042975668151540e-001,-1.1793326939799451e+000,8.8832496238358214e+000,6.3993559493674974e+000,-4.0335742428712011e+000,-2.5114409539793370e-001,2.3619245680111423e+000,5.0621175906778983e+000,8.5761869301308502e-001,1.0492943089231279e+001,1.1878573928061357e+001,-1.3247286585771947e-001,-2.7091917820887330e+000,-1.8531959741784358e+000
,-5.6280138148500809e+000,6.4199331907586430e+000,-3.5136759438281145e-001,7.5872682072987239e+000,-2.7011328318836587e+000,2.0525403772057835e+000,-1.6421285547080271e+000,2.1969028149608540e+000,3.4673515662865100e+000,-6.6498102182449053e+000,4.5303092497703163e+000,-1.4040368031007670e+001,7.2641927007826421e+000,2.1511173672129411e+000,-2.1937037715660579e+000,3.0230355859883598e+000,-2.2317497691811030e+000,1.9151407766026578e+000,7.5887284681062956e+000,1.4818966799918902e+000,-6.5100525366108775e-001,-1.4983234945234889e+000,-5.3928524106769062e+000,-9.7294565348101987e+000,2.9508315541359771e+000,1.0200568097679046e+000,-7.1530275389546176e+000,7.4912695421945097e+000,3.0818774223181111e+000,-5.6860737452504599e+000,-1.3680596615006635e+001,5.4589922613072019e+000,-8.1750789673978623e+000,-4.5391751516199985e+000,-2.5075480098218303e+000,1.3216152247421840e+001,-6.6728217884882923e-001,-7.6064169328735058e+000,1.9716005334633557e+000,-6.2570329889732879e+000,9.8711990378459147e-001,-4.3455458680818687e-001,6.3467087258677797e+000,-7.1764176742209980e+000,-7.5365036699258612e+000,-9.4499884840649990e+000,-3.5896272815322288e+000,-1.2169515334565801e+000,1.9952126530026333e+000,1.1544739515188046e-001
,-5.4693958306760591e+000,1.2156973866629002e+000,3.6909240013811719e+000,-2.1284987551514423e+000,-2.0385909758677991e+000,3.4887865819046948e+000,3.1573557746189196e+000,2.2576668151494013e+000,-2.4075731583422995e+000,1.1447367605979699e+000,3.1541788128118311e+000,1.8444041168750858e+000,-5.1027913450849371e-001,-9.2410868653663458e-001,3.2809830536487006e+000,-8.9547047041975047e-001,-1.0156190762986268e-001,-4.7121644453941718e+000,4.3405630703007967e+000,-5.9274514843911188e+000,3.2200819590737764e+000,-1.9586602184162627e+000,-3.7951247789383175e-001,1.2196956069057814e+000,-2.6665939866881230e+000,-1.7941404003013382e-002,-1.2675347181342360e+000,4.1706657231754585e-001,1.1431844653597631e+000,-2.8513250194585416e-001,8.6955359432515622e-001,-9.3904842157541246e+000,-5.4523558494352953e-001,-7.1128856218905412e-001,-1.6209518290447742e+000,7.5851409451209388e+000,1.3099798793191837e+000,2.4855690622931390e+000,3.5034586494512667e+000,-8.3226711009563292e+000,-5.6769843624286775e-001,-6.0956533177732874e-001,6.7735517735030530e+000,-1.0185775204643706e+001,-3.1494337027822978e+000,7.3016560582027452e+000,7.2960344627205842e-001,-8.3409583339702498e-001,-5.6237303440018627e+000,-3.1144102100450990e+000
,-6.0288363769107969e+000,1.4041361112661825e+000,-2.8918156556254138e+000,-7.6965732206974780e-001,-1.9413208463813305e+000,8.0242641548209424e+000,-5.0199607244031688e+000,-1.7331120734002465e+000,6.5822622825957069e+000,-1.1034898619233010e+001,-5.7182333214938437e+000,-2.4012631941320297e+000,-8.0220120117248467e-002,3.6067346850455388e+000,-1.7064054008536320e+000,-1.9391515896099292e+000,7.6389795048007214e-001,-7.1298701928242103e+000,3.9320209123199263e+000,-9.4487150677040557e+000,8.3370816131738348e+000,-6.3149769164951222e+000,-5.3370298299443188e+000,1.0739310541773825e+000,1.1182700682884594e+000,-8.5344051464296324e+000,-4.0805181130967059e+000,4.1714575811486361e+000,6.1649546864685378e+000,5.1684374612976625e-001,-1.0233609730527087e+001,-2.6319073802948103e+000,-6.9434233476999963e-001,2.8940269950678454e-001,-8.3759865205750224e+000,1.0741783550875775e+001,2.7943406498955938e+000,1.1444763998506403e-001,6.1559192734005697e+000,-4.7566201686090910e+000,-1.1200248975153018e+000,-3.0153426506576988e+000,4.0591294604053169e-001,-4.9225802610799025e+000,-3.9762174234851613e+000,6.0813759865059369e+000,5.7111751772942050e+000,-1.2298026755462972e+000,4.8013750207293766e+000,-5.9038974747466897e+000
,5.7554934597360830e-001,2.9920388580556545e+000,-9.7561168674641578e+000,-4.1190558234405161e+000,3.8445471822259187e+000,6.5047840193601498e+000,1.7123968853122686e+000,6.9949001539192732e+000,1.1796137920554614e-001,4.6772474786599165e+000,-5.4719406193507270e-001,-6.0227058780620473e+000,7.2495361449986619e+000,-4.7773421074293871e+000,-2.3340682378966724e+000,1.0897315692690242e+001,-3.6833129256146435e+000,3.7598477405563862e+000,4.0658760737486599e+000,2.8903180275464557e-001,3.7479923438013412e+000,-4.6189228887582594e+000,2.0480664604422367e+000,-6.2986403056774130e+000,-1.3685839932796777e+000,-6.5890800362995092e+000,4.7542229228687616e-001,1.5480290144566127e+000,-4.8825926286882976e-001,-2.6882070864134677e+000,-2.7585787527980821e+000,-3.3477583021276551e+000,-5.6229192576530362e+000,1.7669434875395582e+000,2.2115234779658426e+000,2.6371829556482367e+000,-2.2706546813200670e+000,-1.2216523744440202e+000,-2.2959277072205322e-001,3.0091249940667333e+000,-1.0553655512878621e+000,-8.1984025911179970e+000,-7.9955670104330494e+000,-3.3634822672671381e+000,9.5903398094524821e+000,-1.6633279403572538e+000,-1.0412283635366795e+000,-7.9086528224990404e+000,7.1294555339998054e+000,-8.3745660948206502e-001
,-1.1187530538769568e+001,6.3081019042802300e-001,-2.7599743086068789e+000,3.7036770529267153e+000,-5.8836147789018360e+000,-2.4990579440319789e+000,-5.6407513610330744e+000,-5.4361570016775005e+000,1.6334013031852888e+000,-9.6237027693965804e-001,1.4745606162929215e+000,3.0357056543094378e+000,-2.0100837088012367e+000,2.9466730138352766e+000,3.6327416843417593e-001,-4.6410804691730476e+000,3.0577465172156919e+000,-7.4261996906979588e-001,3.4103572262850488e+000,-1.0399037025554961e+001,2.3836938843324744e+000,-8.3797622580305706e+000,-2.8572480161090130e+000,1.7403251870901058e+000,-1.0062561128401437e+000,-5.3964827393620993e+000,2.2515093948452498e+000,5.8738357681186075e+000,3.9957326504158863e+000,4.4319156735494349e+000,1.6142605860516943e+000,2.4094645274892139e+000,4.2327707477589662e+000,6.8815971542790733e+000,5.7936327511460908e+000,9.5094330038439754e+000,8.4730939642489378e-001,7.9796407507909628e-001,9.8397536995412089e+000,-2.8498948525290388e+000,-8.7720846553144105e-001,-6.0925557793780571e-001,-1.1412863731510758e+001,-2.6881156658676932e+000,3.1929214846490566e+000,-4.2315130917167548e-001,2.4803623659072369e+000,-5.0833365114597138e+000,5.3413720960347044e+000,9.2980945408017384e+000
,-1.1922644977235153e+000,1.6649431772679650e+000,-8.0550310047959677e+000,3.8863404177485052e+000,4.2314979693822190e+000,6.6728212422053215e+000,-4.0101552381793395e+000,2.8725927716487085e+000,5.8049768903588141e+000,4.0616483467062894e+000,-2.2426454685261890e+000,7.6893060333028829e-001,1.0835686179854390e+001,6.0816889971397226e-001,-4.1930973044529871e+000,-2.1044790803608731e+000,-3.5017603562000792e+000,-4.5550270701879887e+000,-3.8557729247777289e-001,1.0673072900747322e+001,5.0580958420793012e+000,-4.6582742809744220e+000,7.2162619283934373e-002,-2.5274322580827491e+000,5.5336680811719070e+000,-7.3059355976345861e+000,-3.4123825781771240e+000,8.8347186820787869e+000,-4.6060966722676309e+000,-4.1075664182981493e+000,-9.4420608391915994e+000,1.5820995419468473e+000,-6.8482077678083431e-001,-2.6692653232871404e+000,4.4059140297012842e+000,-1.1280201243051007e+000,1.7516415070616231e+000,4.2808215354346375e+000,-5.6730016265579373e+000,-2.6916319125112609e+000,1.7950197497458060e+000,-3.4891624888514552e+000,-3.8174590764089258e+000,2.9202250098223376e-002,3.5093210104443942e+000,6.2535453378961181e+000,2.2662263710872428e+000,-4.8716457831247278e-001,1.4760307952025506e+000,-2.7455338128198696e+000
,-1.9236930676805444e+000,5.3347278659125008e-001,2.6425764247442531e+000,1.0183739251732810e+001,-3.1015755760221153e+000,3.6717862357760964e+000,-6.3520459348779490e-001,4.0435575291637255e-001,3.9936016715896927e+000,-1.3073070435307679e+001,-5.7917066452571253e-001,-7.8709512594148032e-002,6.5394205649515735e-001,-7.0053311583365807e-001,2.5871128632274423e+000,-2.7047200384278294e+000,5.8355626127248383e-001,9.7405476744496650e-002,-4.9985598115295604e-001,4.9295623908982078e+000,-4.3082282546018300e+000,-4.4807713888141523e+000,-5.4291159672731135e+000,-6.1419288668499625e+000,-4.5086816510347170e+000,-6.8036944374108754e-001,4.1912418636502649e+000,-2.6827917042023791e-001,-3.1820724778687075e+000,-1.1236794057849850e+000,-8.8640699472632214e+000,4.4405005401623772e+000,1.6089085173259314e+000,4.6716636267543903e+000,-6.3853695909181312e+000,-1.3803288481122480e+000,-1.7158913423105211e+000,-2.6690320245975765e+000,-2.8297853586656214e+000,-3.1377818016518999e+000,1.4211068644766816e+000,8.7585584688205681e-002,-9.6183668608524542e-001,-8.7782449153364484e-001,-4.9985851453463965e+000,1.3203097680480140e+000,1.4888412512279494e+000,1.2417488298476791e+000,-8.8037533369990628e-001,4.1716045498325025e+000
,4.1801316762662841e+000,2.3634378051554070e+000,2.3399858095859893e+000,-1.7533312020584899e+000,2.0177597049911089e+000,-4.3482640558288352e+000,3.4201917058537656e+000,-9.0583905210993390e+000,1.0023515000055649e+000,1.5233811801270729e+001,1.4088366250897322e+000,4.1735156280246208e+000,-1.1586411070026838e+001,6.3409353673306255e+000,3.1339091026425394e+000,-5.0081893153790267e+000,1.8332748391652287e+000,6.3770461555555551e+000,-9.0614689796982861e-001,-1.8456893308726998e+000,-1.6186946873876835e+000,7.0048338930844931e+000,6.3972304624453935e+000,1.6699938145399280e+001,1.4256929306696106e+001,7.6711363647758981e+000,-5.0450659433482716e+000,-8.5189078423823013e+000,1.3043568810082991e+001,4.5368880133863536e+000,1.0888449458163436e+001,9.6922997925029950e+000,1.2667109970270194e+000,-8.6612361356240708e+000,4.7069936352950261e+000,-1.1947532857666382e-001,4.6716833625000493e+000,-1.1267970096951485e+000,7.9054387842930591e+000,2.0108207299483687e+000,1.2867478412992957e+001,1.3919255423627142e+001,1.9024072399674235e+001,3.9317713006015724e+000,-1.3293143596875021e+000,-1.3751226117225041e+001,-6.7958955446693032e+000,1.6588519969148052e+000,-5.5005181032617374e+000,4.5268007451269554e+000
,4.8226272946892665e+000,3.6305204118150471e+000,5.1053113393387264e+000,-2.9821990647847798e+000,6.4323807187480044e+000,-3.8650185158329348e-001,2.4970875382556770e+000,-2.0813140765654885e+000,-1.7011705585334647e+000,4.9181371616529923e-001,2.5627033347020114e+000,2.0268677963792987e+000,-4.6221457685066619e-001,-7.7219238122785487e+000,-1.2512802313087561e+000,6.7162768933124362e+000,-8.1724549866127436e+000,4.8642312592567771e+000,6.2863096741048075e-001,2.1047673864785104e+000,4.4327962440336943e+000,9.0401247347041895e+000,1.3214975272110767e+000,-5.7946808441661233e+000,4.4274037335203351e+000,3.4532083684495904e+000,-1.0753778198933023e+001,-4.3285619304416469e+000,-4.8756664351269725e+000,1.9002095596659221e+000,5.6953013429413106e+000,-6.3898275015128112e+000,1.6806163434316892e+000,-6.3930545517409456e+000,-5.3126207807308488e+000,3.3448844981379050e-001,8.9134929373676543e-003,-9.0306236715080868e+000,-3.3501946684117068e-001,2.2423483963512552e+000,-4.3856487391494321e+000,-7.5121305106400387e+000,-5.2793628569447835e+000,4.4552169853382582e+000,-7.5513033274902575e-001,3.0295722150422826e+000,-1.0364432900818068e+001,5.0571515150567814e+000,5.4138610588759892e+000,-8.4489015231464526e-001
};
double Ra_M10[10][10] = {
-2.5895261738163883e-001,1.0175942956744435e-001,2.4679218027933841e-001,4.2336638278665978e-001,5.5587977013563261e-001,4.7324508893696443e-001,5.7100202766406705e-001,2.3833191325746064e-001,4.0301773325109469e-001,1.0929187891467511e+000
,1.7279565987950521e-001,1.9981637292749274e-001,1.0970707492248599e-002,4.4498865221943396e-001,6.6677132918536208e-001,5.7109996926234385e-001,6.9272435788176184e-003,4.4040741520351262e-001,7.5593410436098496e-001,2.4817003612007793e-001
,7.1509850952775245e-001,5.7092690133792146e-001,7.9437272043384366e-001,4.0574079212326905e-002,6.1700165264422291e-001,1.4442817339295375e-001,5.5500293627097286e-001,6.1292047818696418e-002,4.2337586705494190e-001,2.9275888271258088e-001
,3.7459878093614041e-001,3.0414535752990945e-001,6.1854121595880873e-001,1.8253713882553899e-001,8.5951776584540202e-002,6.8205916320058879e-001,4.8965989868924947e-001,2.5409249835682568e-001,2.0647249378240112e-001,4.5247309637109323e-001
,-1.9101408337939288e-001,1.4013677463582844e-001,7.6213646685863601e-001,2.6395334070357190e-001,2.3210209939619258e-001,4.2312555008356156e-001,8.0252489467613775e-001,4.8181973827203645e-001,2.7594074125143486e-001,5.7137971996846970e-001
,-1.0592640806749581e-001,5.3512904963661634e-001,1.4380270301318246e-001,9.1721616786171423e-001,1.8453412783445541e-001,7.5570057136865182e-003,2.9109770529581835e-001,3.9219703336260764e-001,8.2078877023958086e-001,3.8704746700053760e-001
,4.7632734580863423e-001,4.2847033067361601e-001,7.9783357160050222e-002,6.9401738854079098e-001,7.6879205215483715e-001,8.6638766447985571e-002,1.6889764907831950e-001,1.6681970926268003e-001,5.1795112514378439e-001,1.8446898846123311e-001
,-5.4043471667983167e-001,5.0348312813737306e-001,3.4535113741970119e-001,2.5084744370085982e-001,1.7847360081965177e-001,2.0845804127948184e-001,3.7880938613374354e-001,8.9879028768233038e-001,5.0809615458221019e-002,5.9852972227781165e-001
,6.2999379529317623e-001,8.8094352929402542e-001,2.6543667218141342e-001,8.5114380324344963e-001,1.1409151085517524e-001,5.8820342362657174e-001,1.4751162215097532e-001,3.6861868050340613e-001,1.9226941922360685e-001,2.5841711929933181e-001
,-7.3702890253821662e-001,1.3986673295774771e-001,3.9029592969760579e-002,3.8707641355809652e-001,8.1739840167997546e-001,5.2663977330131773e-001,1.4884568436925888e-001,4.4706266373652870e-001,4.0258059679430486e-001,1.7838778804513830e-002
};
double Ra_M30[30][30] = {
6.3352589498522960e-002,5.6723050762523250e-002,2.6950709414277321e-002,5.0367729150895724e-001,1.7229433871272504e-001,1.8640203659987595e-001,7.3397031978678258e-003,3.3098916489160640e-001,4.2665189119292742e-002,7.0160713714977646e-002,3.2679132554803312e-003,1.4972020339323092e-001,1.0373777561442425e-001,2.6597739612791282e-001,9.5781729754961936e-002,3.1606391809113392e-002,2.3792251896035660e-001,5.9185411160660939e-001,3.3640073043714680e-001,2.3392627475841743e-001,5.8394107273065532e-001,3.5405001809514308e-001,1.5298918062807598e-001,3.0256480178875365e-002,2.5397238155608393e-001,3.1572678634248547e-001,3.5150776667363171e-001,3.0480088990757720e-001,6.0246527470463704e-002,1.4784275286950338e-001
,-1.5303824114632544e-001,1.8358535100278101e-001,1.4343088966796802e-001,3.0368486493833252e-002,2.4045786963278276e-001,3.4471976220035158e-002,7.0752508556361254e-002,3.3818894801085264e-001,5.7402235473376895e-001,2.9999811349627287e-001,1.1816642073004084e-002,2.0282788646220051e-001,1.2148286246059095e-001,2.7628216666834293e-001,3.6301766511459488e-001,4.3656278888976596e-001,2.5449693389248257e-001,1.8667279514280669e-002,8.7977341771880532e-002,1.2612561251090862e-001,1.4350306337753108e-001,1.6471686978689171e-001,6.1777442032724117e-003,8.4683171535382251e-001,2.7655666142128449e-001,7.2282608587736108e-002,4.0076503474141163e-002,4.3832594189734536e-003,1.9246963531342157e-002,4.1713912034498241e-001
,-9.4616229912051181e-002,1.6857350848164440e-001,1.3820485006442146e-001,3.3398346653936578e-001,4.5823089281081399e-002,1.5126745263475783e-001,1.0470289793845276e-001,2.7633450351527145e-001,3.1345701506659451e-001,1.4216228422573023e-002,2.1149308945846634e-001,2.4789011794141738e-001,6.1682762813234350e-002,1.0115370707468610e-001,6.7651033099391600e-001,2.3761492552368871e-001,2.2422212811473841e-001,1.0478403606959068e-001,3.0501541776493385e-001,4.0184550037919614e-001,3.1998325404569206e-002,8.5811372806232161e-002,2.6791530259704721e-001,1.1954616459090261e-001,4.0723833688222015e-002,4.0503948565098041e-001,1.5019639187367363e-002,1.3667079048804404e-001,2.8899443907879996e-001,2.6334350861696509e-001
,7.9731330308619022e-002,2.9029746866406658e-001,1.5711033378260056e-001,1.4805619823469293e-001,3.1403841896355017e-001,1.4830673685132398e-001,9.6415633544066640e-002,3.9111625799204980e-001,3.9905847568730141e-003,1.0173782181061546e-001,1.7007538709175166e-001,1.5927197939226609e-001,1.8835110361374169e-001,2.9727864973136270e-001,2.4984743261669734e-001,3.5776550824778963e-001,1.6545432898652054e-001,1.0990465300888526e-001,9.9633388732801503e-002,5.3650111522391830e-001,6.6793689225651065e-001,1.6072901328255829e-001,3.0180406715580595e-002,8.3714389328455666e-003,1.8604999869284500e-001,1.7200654086355155e-001,5.0651332654886871e-001,1.8213782646119569e-002,5.1310227617157356e-001,9.1353413513319506e-002
,-3.9097869147729580e-001,4.0516313545701610e-001,2.9280344754806076e-001,3.3350018678391921e-002,1.6773031217578363e-001,2.1746638495485310e-001,2.8288010081692985e-002,6.0934032846319020e-001,1.2905128754630954e-001,1.5383241083884502e-002,2.6677132178120239e-001,7.1262578818980071e-002,8.8256334414079762e-002,2.0016851943143352e-001,2.1404662174010528e-001,2.8957335795260486e-001,2.2523641420841328e-001,1.2098621720922725e-002,4.3185955579106428e-001,1.0205590950971773e-001,1.7601787564100060e-001,8.8959917742607242e-001,2.9692315512112943e-001,2.3234762222452876e-001,2.6719466953478455e-001,1.8717538884440096e-002,3.9407941093235049e-001,7.1004129542103014e-002,5.0068361017785090e-001,7.0008457032509352e-002
,1.1640775059901108e-001,1.2411817286987235e-001,1.6708268282778771e-003,1.1655231072970242e-001,2.8712159807233895e-001,3.8324047856083815e-001,2.3170784348726339e-002,2.3241673939402219e-001,3.9420324855862943e-001,1.8017436277032778e-001,1.1544634241055229e-001,2.8135069771461141e-001,4.7636575565475026e-001,3.2774731322460937e-001,1.5241662374533727e-001,4.7602739949595713e-001,2.6082106684617268e-001,3.4285011712567692e-001,4.1881708652986060e-001,1.3590717717385309e-001,5.0005287398730069e-001,2.2484279936358550e-001,7.5845684136696478e-001,1.4197748119565942e-001,2.3124559527700234e-001,1.8817574549712440e-001,2.2154027387194089e-001,5.3779130311334011e-001,1.6145939015329910e-001,3.2648117861603754e-001
,2.8076026605559218e-001,2.0459814784556232e-001,5.0171080594473172e-001,9.9814617066979458e-002,3.7130363446846698e-001,2.8473528087456512e-001,5.0370572703026706e-001,3.1074188199153800e-002,1.3922571090137803e-001,6.2093838782830835e-001,3.6602195707226598e-001,1.8911637623628827e-001,3.1311000135133868e-002,2.6994250113418727e-001,8.1790400450164891e-002,3.0256136439559950e-001,3.0798895655272296e-001,5.7762327049527204e-002,2.5984640435035258e-002,8.4032129175491355e-002,4.8714025036927788e-003,1.3369198165259943e-001,2.2501015701436999e-001,2.6722614828920804e-001,3.1452111240625147e-001,1.3111373390155406e-001,6.3644233593790955e-002,1.3611615763883869e-001,6.1622776045321148e-001,5.2231943907070144e-001
,2.1809792855351498e-001,1.5659253162891282e-002,3.1396291645326868e-002,2.9831526548691295e-001,6.3480134238296326e-001,8.0409036697758479e-002,5.7644985543788579e-002,1.9627871330339058e-001,1.8165656462608568e-001,1.1810278280167409e-001,1.8886316814426200e-002,3.3756700632674586e-001,3.5024945330277441e-001,4.2796866596963046e-001,2.1958979331840209e-001,1.7616291116332281e-001,1.4218717912062934e-001,2.2157310812540337e-001,6.1493770355210080e-002,2.0108102491589547e-001,8.7121081544472623e-002,2.9588987238893388e-001,2.5061272832655124e-001,2.5063647812530621e-002,1.8925836759833997e-001,5.0424840207636171e-002,1.4985557590469015e-001,4.6053698296160450e-001,1.9942238927352071e-001,3.0483492302404630e-001
,-4.9771559268385709e-002,9.4132832474907224e-002,2.3650756746006210e-001,3.3102298276168195e-002,1.4871067841765573e-001,1.6679259138580066e-001,7.2501312835411535e-001,1.9344718089168617e-001,1.6077444297823196e-001,4.7429322201909518e-001,4.5713801576431501e-001,4.2216078662862944e-001,4.2175733138484439e-001,2.3850947864798056e-001,8.3667010681589202e-002,4.0603511075240524e-002,2.1616323965536580e-001,1.3768293723683239e-001,5.6265680786963135e-001,1.2858720436076043e-001,2.3135843593208363e-001,1.0064553874378594e-001,2.9750632492034768e-001,1.6698629430390778e-002,5.1831927625084540e-002,2.8253859864244402e-001,2.9728283251851895e-002,1.8897748034632633e-001,5.7359157117103002e-002,3.3452473594845550e-001
,-1.3925633275190830e-001,2.2209098954969089e-001,1.2012828708841183e-001,3.1614837377130228e-001,5.1183005961010060e-002,2.7540225676952179e-001,3.5925174441493535e-001,4.4297397481374373e-001,1.5011794783112334e-001,3.0199433865476166e-001,4.7049966066726612e-001,2.7273902679492884e-001,4.2289194915651018e-001,2.4057006386366618e-002,5.4583741550567233e-001,2.4547709307917881e-001,4.6003943983266918e-002,5.3530859107174464e-002,1.9432644915130357e-001,3.8819314062970268e-002,2.5297745139802330e-001,1.5403952082127018e-001,2.6799915887122333e-001,3.1286434673164984e-002,2.6320634996153502e-001,1.8714800772846080e-001,2.4730717839944527e-001,2.0301608532527807e-001,2.8864922104713764e-001,6.3111498211666750e-001
,2.2074266351601457e-001,1.1266075532698061e-001,7.2241582019346703e-002,3.5922744273817947e-002,1.0159862684335982e-001,2.0799823630206574e-001,2.1988238613391320e-001,6.0660045527886430e-001,2.1393148333055445e-001,6.2658842874021833e-002,4.6000592722183153e-002,9.2784887834003515e-002,1.1251264256444871e-001,6.4816515390490059e-001,1.8531037045724286e-001,6.9076035902384902e-001,1.7023209807096473e-001,1.7583420881648260e-001,1.4739114115086022e-001,2.1884252222916525e-002,5.1674671366810621e-001,8.1126591578333879e-002,1.8607182988440127e-001,3.5378646073856643e-002,5.2475296638563124e-002,5.2551692473663825e-001,4.7330496090962693e-001,2.8836894787041958e-002,5.0634127944341641e-002,7.2379782847092608e-002
,1.5227857012773682e-001,3.5890907545504747e-001,4.0311576678653227e-001,6.7079463404727202e-001,8.4538814526172415e-002,1.1878067788422383e-001,1.6710734844154340e-001,9.5941533427942788e-002,1.7337352202551856e-001,1.7717436234025222e-001,5.8945522783608761e-002,1.1168668267598318e-001,6.1916229752819248e-002,5.6395653813750823e-001,4.1791622486727664e-001,7.4613224373306183e-002,1.4658483315164927e-001,3.2461640422078702e-001,7.5524733119117449e-002,5.1982957163182120e-001,2.3033034961347559e-001,3.3161492836201656e-001,5.1170390749651185e-001,2.8547087590118064e-001,2.0073840807203575e-001,1.4725592075748190e-001,4.6255754697309942e-001,6.0327452097444847e-002,4.9896731024407665e-001,1.9713242338771780e-002
,3.1443529214710980e-001,9.1551701280605927e-002,2.4131250171541102e-001,3.0823643101075587e-001,1.5751811615472695e-002,1.0837694969979236e-001,3.3368256804806223e-001,9.7736654395649283e-002,2.3415834339896408e-001,1.9895365656634859e-001,1.1866077269974197e-001,7.0637937614193980e-001,2.9667295180456538e-001,3.8925196359689822e-002,4.0718653001751293e-001,1.0879528190943742e-001,9.3148482293452350e-002,2.5373082951682252e-001,1.7769258797233684e-001,1.1904351194733081e-002,1.4004256163295823e-002,8.0122743851895994e-002,1.6405392512187764e-001,4.0277077092674984e-001,1.8563791255097423e-001,4.1599192401061780e-001,1.2529767835121203e-001,4.2748141622566221e-001,8.6787161600866844e-002,1.3574130382605679e-001
,6.2456391898019525e-001,2.1194385261232473e-002,1.5790651976032902e-001,2.0046793068165814e-002,1.3485287207486447e-002,1.9143050922350266e-001,5.3053619287120934e-002,1.6480258166845130e-001,2.5581078799060381e-002,5.2048496088289065e-001,2.7366106496207987e-001,3.7268447698550033e-001,5.0563899025107140e-001,5.0607165278366584e-001,1.7622109812935938e-001,1.6088276699725435e-001,9.1154208328017988e-002,3.1937211510091112e-001,1.0076220868501951e-001,1.7199096873026187e-001,1.1170952761795268e-001,1.5276479657982292e-001,7.2803828119683833e-002,3.0445143022152271e-001,3.4296871062700884e-001,3.3763415872847674e-001,3.2589197904172987e-002,3.9462767299677681e-001,1.3173293396858948e-001,2.3186690614308192e-001
,-3.3469228494985137e-001,2.0799931761035834e-001,6.4523538951504603e-002,4.1833830759685520e-001,6.4169555067820627e-002,1.7527317152551250e-001,1.1082704894603775e-001,4.3741984086665819e-001,3.9351853787706437e-001,2.8604100205000355e-001,5.6910189905937236e-001,1.0181603584935292e-001,4.5485482259097904e-001,6.3603621125206233e-002,1.0655964113618122e-001,1.9782088627298269e-002,7.7720658248032232e-002,2.9510223386463082e-002,1.2437913293723712e-001,2.5781268610402719e-001,5.7604499056418090e-001,2.2581422643369581e-001,4.0572768097048034e-001,1.5764904110653599e-001,1.1341289128143667e-002,1.4851350034808614e-001,5.5527884065659533e-002,3.5507268828100202e-001,2.2404728666046494e-001,1.2539346485283065e-001
,-1.9850895807711058e-001,4.5326397453132722e-001,1.0398033683866753e-001,3.2633801250030230e-002,9.1314019424013321e-002,5.6903817655767341e-001,2.7286489856743251e-001,4.0988738750653836e-001,8.2669859994791400e-002,1.9009629707365031e-001,9.1926923332890237e-002,8.8172606226820424e-002,2.5568024963859959e-001,2.5677859500848793e-001,1.2486970262940503e-001,2.3789170778049062e-001,2.4286433093315454e-001,2.6459619311082727e-001,2.2474512771605368e-001,2.6296232628549330e-002,6.4669768761915743e-003,2.4451032686765417e-001,2.1189052231900604e-001,2.2850709647377421e-003,3.2117657826456369e-001,2.7579813108444118e-001,2.7698772002238681e-001,5.1891715887249412e-001,1.8052480491100051e-001,2.3591694484557954e-001
,-3.1942635721679002e-001,1.8159731602181259e-001,6.2138905606841405e-002,2.3095094676068476e-001,1.6355391317440895e-001,6.2743723725128389e-002,4.4562776381459746e-001,1.7784844982906634e-001,3.6249806310299260e-001,1.7975683881766333e-001,5.5555431649360709e-001,4.2018934556316945e-001,3.9335134942970340e-001,3.8764690107189999e-003,4.6774398293644082e-001,1.1218926829095412e-001,2.1917507916913259e-001,3.1003503866519394e-001,1.2568335546410068e-002,6.6712560094245310e-002,1.5370487420072571e-001,7.0705051800840379e-001,2.1904334332760392e-001,1.4204759439403283e-001,2.1992215382554028e-001,1.7423635387683581e-001,2.0309131798586313e-001,3.3370216189057095e-001,4.0682536453019898e-002,3.3379446174958338e-001
,5.2878687249498561e-002,3.0608131674192995e-001,4.0454717313195188e-001,1.7044314492885823e-001,3.6286473522077992e-002,1.7340755399328106e-001,1.6075335121374462e-001,2.3993018676500177e-001,7.5389893765679383e-001,2.7583212425502740e-001,2.9195639069675672e-001,4.5478124446842676e-002,2.6024227411294654e-001,2.9303555661736369e-001,2.1107229602275898e-001,1.2362281077672166e-001,1.8897873891249867e-001,2.2110317637406918e-001,1.7747628664673934e-001,1.4851477409108343e-001,8.1248724562948210e-002,1.4961261809138654e-001,4.7819459229728051e-001,2.0600894669061368e-001,1.9981606085349479e-001,4.5702361375897338e-002,1.8436806734899275e-001,1.9619834388626295e-001,2.7134280656839656e-002,2.1673523441517289e-001
,-1.2098851840808815e-001,1.0045906754921452e-001,2.0471084225037173e-001,4.7266092521609576e-001,3.3829586753027241e-001,2.9481533808033611e-001,6.5337323091315888e-004,7.3059470309908892e-002,4.1371927088380983e-001,3.1262153628757894e-001,2.6718836897377679e-001,3.7580178653694718e-001,4.4490750923516162e-002,2.0554550655666959e-001,3.8827142965764429e-002,1.9309451680858764e-001,2.6942048128166401e-001,3.6344740384626795e-001,1.1646121573376635e-001,5.5949325612743317e-001,1.3855118758774485e-001,4.8164559834687742e-001,5.6540911168123931e-001,6.8134895144556548e-002,3.0427193726501522e-001,2.6156754594109870e-002,4.2093466523717066e-001,2.0777143271129575e-002,3.2572542198541449e-001,1.5332282801681621e-001
,-4.4930782843651795e-001,2.4472667977437620e-001,1.6737635815761187e-001,1.3430001529183805e-001,2.7453390367486968e-001,3.9479034140681768e-002,6.3738200252687824e-003,1.0505299872164929e-001,3.1079040895401294e-001,6.9351346716707596e-001,5.2639148278401715e-001,7.2569748367050822e-003,9.1185576859873357e-002,4.3556940780065884e-001,1.2550044140864369e-001,2.5015968690685886e-001,1.3159571769917278e-001,2.1365691024452527e-001,3.3163084907182261e-001,4.8530675700234122e-001,1.7371913880855583e-001,1.0184034777212750e-001,2.6155309285996931e-001,1.6760356630961928e-001,7.5385863422193805e-002,1.2743443848461031e-002,5.4817163925401657e-001,4.1629547161699298e-001,3.0820534457037735e-001,2.7904132047576524e-001
,5.5603240525775172e-002,3.7622417785064627e-001,1.7167152742138964e-001,3.8887755533328106e-001,5.0571378360732466e-001,1.5936721545761376e-001,5.6673554795662454e-002,2.7801988945324080e-001,1.2444596303043737e-001,4.4033900162646689e-001,7.2527594927229794e-002,3.3208467391610830e-001,5.3974659926222279e-001,5.6397197055262926e-001,3.7615328855093072e-001,1.7956544126243673e-001,2.1205781403078797e-001,6.6614554266432535e-002,2.3029648388321358e-001,1.0021971123949601e-001,1.1754999771520605e-002,1.8169814370133233e-001,1.8386571440989419e-001,5.1520126514505538e-001,3.3869996483978548e-001,3.3692492698433935e-001,1.5931280009476201e-001,1.4537981887358953e-001,1.3639381352982102e-001,3.9497011915244129e-001
,-4.4998772224654765e-001,2.3838811137117805e-001,3.7022441605543599e-001,1.5207307416223501e-001,5.2672803829473036e-002,3.7833615618852390e-001,3.2151407785299219e-001,8.9066232573895288e-002,2.2208756809702468e-001,1.7310793803032579e-001,2.6563895172210039e-001,5.3273720087529494e-002,2.0186748329826321e-001,1.4449839225557942e-001,3.4175834158926099e-001,3.0548865658921287e-001,5.9021685901209509e-001,6.8095190901190206e-001,1.6675225015767289e-001,1.8663305009546455e-001,2.2857089144903744e-001,8.1342778716821190e-002,4.3154350737026487e-001,3.9477008085890919e-001,6.1658515336815781e-002,2.8455104184414504e-001,1.6791198454376671e-001,2.7370661419920417e-001,3.6569822648266498e-001,1.4846258804785598e-001
,-5.0930476823181792e-001,5.5145268792848610e-002,5.5736525418629779e-001,1.9116309158266145e-001,5.5493070576813508e-001,1.7263562082753675e-001,2.2195319353503512e-001,3.9231597399574086e-001,2.6270615434896738e-001,3.1531135515250497e-001,4.6836633409207851e-002,3.1746254596314971e-001,1.5587527714923358e-001,8.4913129109784158e-002,1.8147885992927765e-001,7.9527042279908533e-003,3.3773885925697011e-001,3.5273336441729031e-001,1.5223884149437325e-001,3.8036990021405659e-001,7.6830688191089860e-002,2.4148856814584913e-001,1.0637264113410359e-001,2.9896451116624967e-001,5.4693659204500533e-001,2.1206819416691797e-001,3.6307485988514632e-002,2.7154233102382935e-001,1.4664628992897813e-002,1.9382418530329498e-001
,1.1154886613263536e-001,6.4371498069999888e-001,1.1664996244848248e-001,3.6768099240917512e-001,2.9895796311783873e-001,6.0513885044089041e-002,1.2162057399845444e-002,3.6497819666065717e-001,6.0954971930925347e-002,1.7668123997779805e-001,2.1884683182836137e-001,8.8954489142616819e-002,1.0689520492332445e-001,1.5144390319388643e-001,3.6392522884452105e-001,5.3145768596323573e-001,6.2285830615583659e-001,1.5538277682004253e-001,3.0211357438769637e-001,4.3872672348035069e-001,3.3767207313498454e-001,2.8775509216722622e-001,1.2075393220669384e-001,2.2962491263881035e-001,2.5275962117475137e-001,1.3047689624678388e-001,8.5279352232789235e-003,1.0974660424916488e-001,7.5924409914351385e-002,2.7260914831317751e-001
,-2.7158074399957677e-001,3.4871063311664535e-001,1.9801210865495598e-002,6.0172368662607160e-002,1.6669316871492347e-002,9.7956508595536659e-002,3.1902512088596319e-001,3.6543774787308074e-002,3.5439016902672821e-001,1.5628321044264701e-001,6.0944639579834659e-001,4.2925901468284816e-001,1.0292567605791395e-001,5.6079043347752426e-002,2.1719251144931251e-001,2.3356235871036382e-001,4.7025817714492801e-001,1.5721644654023753e-001,3.3370480045288108e-002,2.8423824538933079e-001,1.1465876057709301e-001,2.2260976290536541e-001,1.0579486570029173e-001,3.8691173916887200e-002,8.3902928867980719e-001,2.2026907622146710e-001,3.7348346016359796e-001,3.2050732074361121e-001,3.0905208709495530e-001,1.0119829169347228e-001
,-2.8483766713252329e-001,3.8676529856502539e-001,2.8954064586952777e-001,1.0278504879082706e-001,5.7979363592498911e-001,6.1902993826787744e-001,3.5226832455003859e-001,2.1653752181435718e-001,2.1158684823484045e-001,2.3313749375995335e-001,1.9952272259973924e-002,1.1023535324932031e-001,1.2722883132348550e-001,1.0022619920907408e-001,2.8013781424922346e-001,1.0797535911704169e-001,2.5895903046357466e-001,3.8632293638552161e-002,3.7540111062680331e-001,2.3784747235502501e-002,1.7760365037457235e-001,1.1032452920669877e-001,3.2086761388552409e-001,2.8154006071111842e-001,7.4660222788556496e-002,2.6088730658023945e-001,2.6527512124908442e-001,9.9602587853353630e-002,5.5738091722983107e-001,1.7963455059211758e-001
,-4.7819406439647205e-001,4.5354028107485139e-001,2.1414164562559734e-002,2.7262320089949010e-001,1.3093585523562906e-001,3.2285996093030656e-001,3.8907940195368729e-001,2.6274965261521420e-002,2.6691099541019464e-001,1.3572777118037122e-001,3.9988310336496545e-002,5.8593329395910436e-002,1.6183477874626123e-001,1.5630440612367291e-001,1.6745559631137608e-001,3.8328718243274174e-001,4.7476368867754559e-001,4.7094685449435070e-002,1.2140831206618286e-001,2.4901239537734782e-001,4.3646979713157293e-002,1.9765303749138097e-001,1.0376854275295036e-001,3.7498443023171463e-001,4.2764442225019855e-001,6.1241775160448886e-001,1.9730113740988187e-001,2.3229553032545380e-001,7.8765375263717019e-002,3.3827090875675925e-001
,1.4725587741674584e-001,6.2253156117590469e-001,1.2702206769352406e-001,5.5254918241399345e-002,4.6178399293437050e-001,6.6908847284324546e-001,1.8780797714846989e-001,6.0527344994258336e-001,1.9939876432642881e-001,6.7566788856223248e-002,1.9079690602654734e-001,8.8721026689623672e-002,1.0752288316770534e-001,3.8803464307073085e-002,4.7715043321658192e-002,1.9711124616823270e-001,5.9724084309047554e-001,2.6290758226777032e-002,4.1657902419924542e-001,2.0965391894001477e-002,1.3452280834154309e-001,4.2999638607470209e-001,7.0898361870565821e-002,3.1470217812769646e-001,2.6894606134424909e-001,1.6857577838248161e-001,2.1330591105377716e-001,2.6906071922239864e-002,3.1643202123696357e-001,2.2194189195356026e-002
,3.5903925081536275e-001,7.2148062219117542e-002,1.5648361353877149e-001,2.4302181008234645e-002,3.4979266092724942e-001,5.2274171546098003e-001,3.6769968731431857e-001,3.8391892821233192e-001,1.1020491967528034e-002,1.0393713144084128e-001,1.7755040448546563e-001,1.3817204422054830e-001,9.2780802570348847e-002,1.8251032954153196e-001,7.0339659471595858e-002,5.7160921283501510e-002,6.2619001847177391e-002,1.5623491326213881e-001,4.7738736646248259e-001,3.8393596527767937e-001,1.6053069972589793e-002,5.0648948855668306e-002,9.8763419321592119e-002,1.4423735208049157e-001,1.7159220321086766e-001,6.6234122044921251e-001,4.2504576047653819e-001,5.8387882336739838e-001,9.0492128862517895e-002,4.0329492599894540e-001
,-6.8392766291593812e-002,2.5983134623327819e-001,6.1679227099912737e-001,2.5625277154254539e-001,2.3655696114094105e-001,3.0866034264359594e-002,2.3933241275518116e-001,9.8689477115977309e-002,2.8175454081236828e-001,1.4920906302395515e-001,4.5726924806653785e-001,3.2197046147603534e-002,3.8316766942320973e-001,2.8895273972973651e-001,1.7165722981895515e-001,9.1622476687810955e-002,3.8998885054129670e-002,4.6375683305534732e-001,1.3697514442355389e-002,9.2682751596480720e-002,3.1841029810498722e-001,2.5510245540510856e-001,4.4743885752496319e-003,1.8541196836009775e-002,1.8698962512229167e-001,1.7459770017003354e-001,2.5718647154012098e-001,5.7410966053960633e-001,5.3592062713613053e-001,2.2613813427929019e-001
};
double Ra_M50[50][50] = {
3.3738351929312738e-001,1.3906932070819356e-001,6.8007744900044145e-002,1.1998048305300532e-001,3.6212595926243268e-001,4.3690293482065698e-002,3.1855584150687101e-002,9.9891896491934265e-002,2.1799517544264107e-002,4.4563337992254060e-001,1.4305433844836141e-001,2.2536656033121194e-001,1.0448534415176626e-001,1.0493671204873271e-001,1.2860219812548052e-001,1.2244140882849876e-001,2.1992903608429059e-003,3.1610550096927920e-001,1.6689454853708396e-001,2.2901429002092691e-001,2.5026793696128585e-001,2.1652784795613994e-001,2.7135538890061850e-001,1.0728165520758030e-002,1.0589908325656514e-001,2.2721428283640355e-001,5.0956378238045275e-002,5.5747624516526734e-002,5.0919394901737854e-003,8.1104237994742881e-002,1.0844143022075220e-001,1.3914002791022398e-001,1.7956816049035496e-001,1.4241991464983108e-002,7.7016216745603758e-002,3.2962172367946868e-001,3.2165230204751583e-001,2.9053657793769356e-002,5.5840546804204239e-001,5.1067228767165164e-002,2.4805651432247230e-001,9.7818969616761037e-002,1.8406269719997984e-001,1.0393197542100960e-001,4.6065483591932765e-001,4.7350912548247154e-001,1.6570079408307986e-001,7.3042716281215822e-002,3.2739086079605476e-002,2.1703918984434920e-001
,7.1835804949493542e-003,1.6167944202512480e-001,1.6626069385199241e-002,1.2551868369401617e-001,2.6975188114550780e-001,1.0375400180686360e-001,1.0074365417326034e-001,1.4712389122499597e-001,8.8796056701917717e-002,1.3213345935685189e-001,1.8589822845738294e-001,2.7864294908191656e-001,2.8530774308247092e-001,8.9068789416501939e-002,1.2597430859528219e-001,9.4055216991023177e-002,8.3245087587313554e-002,4.4895630409162515e-002,3.2547762448316758e-001,1.7075321100746613e-001,8.6043232763628588e-002,1.9298046228498664e-001,1.1197995955904927e-001,2.5043050770653896e-001,5.0239707054591620e-001,1.6941369270304396e-001,1.5285705684176278e-002,4.1029728802958543e-001,5.0699561273558569e-001,1.3875769586237027e-001,1.6166981161205622e-002,9.6068733583706670e-002,2.1675148579248439e-002,5.1840823536614666e-001,6.1083720670806294e-002,1.7117986688307679e-001,6.9448735518580496e-002,4.0640817234594928e-001,9.5780597201604339e-002,2.6532183846602242e-001,3.7614345361675228e-001,1.0060140599221221e-001,4.8072902883185364e-001,1.1557343539851866e-001,2.5804910396375924e-001,5.5117687267598574e-003,3.2197843447492575e-001,1.3191959027579120e-001,2.0329872150803265e-002,9.4764586620809138e-002
,-4.0300713507342600e-002,1.9958092943886074e-001,5.5341397824141714e-002,2.7547560881050670e-001,5.4480929076844464e-001,1.7608229730915182e-002,1.8078246278904711e-001,8.4555494086448649e-002,6.1538078104188365e-001,4.6912148103271373e-001,1.0771931256739335e-001,2.3524149672074848e-001,1.0655701364854459e-001,1.2887782507788662e-001,1.9504320267659192e-001,3.8128909050128543e-002,3.5305982521568358e-002,3.5092370724717387e-001,1.5612262725121104e-001,3.2186838432651403e-002,1.7895897495099189e-001,6.8461086758061174e-002,2.3008385808510279e-001,9.4148590953209335e-002,5.5674073202425955e-002,1.2569365056808360e-001,2.0019655669103981e-002,3.0401103445590894e-001,3.3185122346769452e-001,1.4610868307295757e-001,2.7206958263100200e-001,1.4113672689222542e-001,1.6480194423974723e-001,2.8838362768683851e-001,9.1579124038552229e-002,1.6070401621420077e-002,1.7121578127291018e-001,2.0961244153588729e-001,3.5478554803386353e-001,1.4300509361692709e-001,2.4582995123945302e-003,3.1316219616484886e-001,3.8227957113164020e-002,1.8082744257725220e-001,1.8911558224155733e-001,3.5139060878995626e-001,3.2228452698490014e-002,2.9587207600428567e-001,2.1103224674790859e-002,6.1387049473319126e-002
,-3.1722020208770810e-002,3.4575143456308355e-001,2.6494651974580691e-001,7.1184525684853589e-002,8.9399847617194314e-002,2.0320262383746138e-002,3.6914567493318499e-002,3.3300867532067857e-001,6.0652357761393286e-003,8.4435014271621533e-002,1.7840818141799608e-001,2.9613784849569352e-001,2.4525138060205873e-001,3.6397348436607739e-002,1.2249911196203908e-001,1.8173533361726585e-002,1.7961799587943045e-002,5.7923546788187494e-002,4.7242400481132912e-001,1.4033933201363363e-001,3.7842255956032689e-001,2.4107249113475188e-002,7.1321837682888578e-002,1.2544141861044039e-001,8.7727162058211669e-002,4.9161729270862736e-001,7.2982344440164701e-002,1.1534634167531348e-001,2.5829371507431609e-001,1.7789460018716083e-001,3.2843074148057018e-002,3.4739672323577703e-001,1.4319610219146531e-001,2.6425581423101757e-001,3.2980703440110240e-002,1.2393392959358930e-001,2.1693071214212370e-001,1.0128297783724278e-002,3.0328515473758594e-001,8.7398867434950969e-002,1.0235577120027589e-001,1.4509253400289651e-001,5.8799404091143863e-002,2.6478024940945422e-001,1.1171227039287002e-001,8.5493592994040718e-002,2.8601530434938044e-001,2.5869095380212964e-001,1.8013511663068227e-001,5.5707712205800586e-001
,-1.5449678468465139e-001,1.2593829380180524e-001,1.9028393250453046e-001,5.1888250934198604e-002,2.6667291736560655e-001,4.1805946085775134e-002,3.4703720515115344e-001,9.2589076435674059e-002,2.0792353403134978e-001,2.0722787509846444e-001,2.5991479611068197e-001,1.0361502054387703e-001,6.8387615415580472e-002,3.8537958936266825e-002,1.6441062853522109e-001,5.8884636378640304e-002,2.3943878041337185e-001,1.0211759973684437e-001,3.7827215280554966e-002,1.9345226195104115e-001,2.6329796681910426e-003,7.2974937688951927e-002,2.4025922638432756e-001,5.4272349106637710e-002,4.9683400540372485e-001,7.4199374930818338e-002,3.9892116757563012e-001,2.1627262649977635e-002,8.3226742787598507e-002,2.3581274331963595e-001,8.3118617965717762e-002,5.3278573297668587e-002,2.5041595658743282e-001,2.1895724105435116e-001,1.0930319328787813e-001,1.0747789973670844e-002,2.4541014530857053e-001,3.2727899831978352e-002,3.7743335071647527e-001,1.5368170470366188e-001,4.4731367340450223e-001,1.1831167911731696e-001,1.4427377118866674e-001,2.2463994823916145e-002,5.2920491712713014e-002,2.8144384728580649e-002,3.8180087585595507e-001,3.7368744230981643e-001,1.3178056751024089e-001,2.5926508887402983e-001
,-1.6090893569968520e-001,1.3874269616989107e-001,2.0574225283542050e-001,1.4994284355480747e-001,2.0313753821187447e-001,4.1160454425282933e-002,2.7112960952874032e-001,1.7160961212466991e-001,6.3951373876430503e-002,6.3272835851156159e-002,1.0166185308539612e-002,1.6765800121101357e-001,5.7648537462344669e-002,1.3764905635469832e-001,1.7442920829396230e-001,3.5908311729101278e-001,7.9152373613263716e-002,5.6109938175445150e-002,1.8881482252490767e-001,2.3340505547554724e-001,1.8827594961752947e-001,7.4828843317377450e-002,7.2077424954057889e-002,6.8114832024492061e-002,2.5533011351983920e-001,2.2322109966007825e-001,2.0842332903939403e-001,5.5238166019481183e-001,2.5433078375402629e-001,5.0930225681247254e-001,2.6697484695246981e-001,4.8684565847804434e-001,1.3056828313052165e-002,4.1063220587447428e-002,3.8560740908141106e-001,1.7825828450496123e-001,6.4796859987207134e-002,2.1766719101132254e-001,1.9227767316936764e-001,2.0470518296466261e-001,5.9590639240950885e-002,1.3180102761014315e-001,1.2453204879940362e-001,1.1705597003672211e-001,2.5737388016710597e-003,3.3449859375698843e-001,4.0084945431710223e-001,9.1067955421144361e-002,3.0805385202904262e-001,6.2455318413853787e-002
,2.2010469345616757e-001,1.2452946439049815e-001,2.0037120602321828e-001,2.8763398955190733e-001,2.5967188722393321e-002,1.6873170420525335e-001,1.5251659071697546e-001,7.4877907497625823e-002,5.7872560945750884e-001,2.6587337658993310e-002,5.8036052677637416e-003,7.3940057017458510e-002,2.6288611911851600e-001,4.2057473538564906e-002,1.9858437304682990e-002,3.8842647852907988e-002,3.8056784603767746e-001,2.3729041185033030e-002,2.4465443272896373e-001,4.9482647596728525e-002,3.9797767493048632e-004,1.3752936433898710e-001,1.8668305731769574e-001,4.0044339209644031e-001,5.2391182038639024e-002,2.5741330934027203e-002,2.5471666680235683e-001,1.1472016512302913e-001,1.8276147603899748e-001,2.2299689892880678e-001,7.0258783283164428e-001,1.6893563069819800e-001,1.8967894462405746e-001,1.9450343980259285e-002,1.3403270885844279e-001,1.2743310694600501e-001,2.4185510387279954e-001,1.4208097913637413e-001,1.0720764308062129e-001,2.5218573495486202e-001,1.8544433787432815e-001,2.4628567329749412e-002,7.1283655654004005e-002,2.2018132576030797e-001,2.1868705270583297e-001,1.4749181090520251e-002,2.0819399347353240e-001,2.9935910250093967e-001,9.7970963992392204e-002,3.0154410947595710e-002
,2.3896084612427484e-001,6.5114296596013588e-002,2.0763141257295817e-001,8.9697217520710415e-002,3.5971736739946825e-001,7.1593960775272567e-002,3.8025688733329080e-002,1.3195790005881813e-001,3.5245660188288269e-001,1.1894319220216269e-002,1.7504720727159639e-001,4.4183289665135267e-002,1.5296691409358060e-001,1.1792930950781154e-001,2.3363491045359484e-002,1.5417524432797083e-001,9.8029925957373365e-002,1.0207637240841864e-001,5.3103390041385201e-003,3.9353319670947080e-002,9.0451457028045981e-002,4.1180446140716132e-001,2.0803496536795180e-001,2.3751589921071536e-001,7.4329006313322926e-002,1.5341406322657369e-001,1.9100217759090601e-001,6.7137325615602761e-002,6.5007638865729633e-002,2.0369029921232165e-001,5.6976517318106483e-002,2.0003594614404777e-001,3.5526904179771868e-001,3.8485505682696114e-001,1.0191951343998372e-001,4.8412684940861461e-001,4.2115543891701757e-001,5.2788293970508504e-001,5.5087845928017749e-002,7.4635156849483061e-002,5.1307908098808898e-002,2.9367620329874466e-001,4.7919139579823883e-001,3.4708174024509347e-001,8.4046476870049500e-002,2.2875136091303810e-001,4.9690057075161539e-002,5.6057852732285099e-002,1.0519138574796581e-001,6.1065816731920769e-002
,1.3283527663339370e-001,1.0692229800091937e-001,2.7455553674682426e-001,1.7737045663398643e-001,8.5958547858284454e-002,2.2684120297932563e-002,2.7104324205009894e-001,1.2247845175126271e-001,2.2522133080663786e-001,1.8765935458267477e-001,2.0178179102874561e-001,1.5646314515291718e-001,3.1037024934114799e-001,4.5593175631164512e-001,1.6501525130236888e-001,4.4815936209389617e-002,1.3496314857870340e-001,8.5515315596730257e-002,1.7034466802128306e-001,1.3084930341981531e-002,2.2032332528700557e-002,5.8116527902969971e-002,1.2847748896961728e-001,4.0791918223190088e-001,3.3073108484185892e-001,1.7712494979567600e-001,2.3663405576477692e-001,1.1965318017625839e-001,1.0057719007538279e-001,2.7163793496302491e-001,2.9984532600683539e-001,1.4744030474198902e-001,4.1736986210626187e-001,2.6644881101498270e-002,3.7273442124149481e-001,5.3454938344871389e-002,8.9756329721167594e-002,2.4820430800221860e-001,2.2099415372642980e-002,3.3136919320193081e-001,5.0444267445200461e-002,8.8090873354747384e-002,3.6485208318342505e-001,1.5182148053760536e-001,3.0543014618174474e-002,2.2711200514221258e-001,3.3320350489695692e-002,2.0602046259926363e-001,1.2741659199997094e-001,1.9900057333676888e-001
,-8.8153288205972624e-002,1.2529188799782670e-001,2.5308283133374260e-001,2.9572807311519650e-002,8.6819658748350750e-002,2.0253321140197586e-001,1.6908244469285169e-002,1.7116878316664982e-001,1.1108553157819329e-001,3.6799764371861110e-001,1.1033546969557968e-001,1.2732829091738901e-001,2.0406782284173053e-001,3.0633567041967813e-001,1.5942994188861434e-001,1.2777916757663468e-001,5.7857728739273306e-001,4.3958248562517288e-003,2.5009004189654249e-001,1.7765724671835803e-001,5.8392946989690342e-001,2.2716487619960524e-001,8.1904545147951466e-002,1.3254835532721754e-001,1.1585044657045762e-001,1.9887615546712742e-002,5.1659907720404304e-003,1.7190666647499578e-001,4.1402508043292718e-001,1.5926653208185676e-001,1.8633825377294480e-002,2.0356747556449886e-001,2.0467994667503958e-002,1.5777765937181287e-001,1.9844154446737267e-001,2.3480812871166581e-001,1.0648433900251586e-001,1.1988859492803690e-001,7.1973274547156268e-002,4.2122318865314069e-002,1.0928776031004592e-001,2.4235214711136732e-001,1.6631963889103737e-001,9.2260574876894638e-002,6.6690035037667697e-002,2.0402493673491923e-001,3.1367950150865009e-001,1.4497353704085850e-001,1.8837452655357290e-001,2.4015058275895895e-002
,-5.4323485673218808e-001,2.6788995186830611e-001,2.4576322996884561e-001,1.0792858439386144e-002,2.7787447634582935e-001,4.1436541708037533e-001,1.9027367328730710e-001,2.3048405627791091e-001,2.9947832753382042e-001,1.8993861111839158e-001,8.6376898038641403e-002,3.9392847819794408e-003,7.7102994876963635e-002,1.0942186851478743e-001,1.2739707094745181e-001,1.1940667592811439e-001,4.5886394637255973e-001,8.9343567457885839e-002,5.6005453723715314e-002,2.2300656029655544e-001,2.3074789583709867e-002,4.6984168565039341e-002,3.4064519663225601e-002,7.5156410984960578e-002,1.4770114269916579e-001,1.1796125145213317e-001,5.1836415258468638e-001,1.1947432446790121e-001,1.6745079333558119e-001,3.3790447580358790e-001,2.3130473018485111e-002,1.1169491323897920e-001,3.6960855909974222e-001,3.3657940747863746e-001,5.8489729014030732e-002,7.1298639862360791e-002,7.4445997893643825e-002,1.6199194225920560e-001,1.5036398655082620e-001,3.5362716626092150e-001,2.0950721704131953e-001,9.9948353886378405e-002,1.4811483022035354e-001,2.2844267960556819e-001,5.7618442190366555e-002,2.1928589923066451e-002,9.0736613536848948e-002,1.2238400369438128e-001,1.1758173157772263e-002,5.0119681662867954e-003
,-1.8875872770490111e-002,1.8305139423801897e-001,8.5294760254962992e-002,1.8956722916224900e-001,7.6255205002843024e-002,1.0736381757333990e-001,5.2095787114188025e-002,1.8529750052826860e-001,1.9207071921956670e-001,2.1393856060763983e-001,2.9930201360047098e-001,1.0806233752844570e-002,2.3386849853703959e-001,6.9605889802852067e-002,4.5330581590762054e-001,2.5718645104904009e-001,3.9368018694624335e-001,1.1694733443035371e-001,1.9912862775677678e-001,5.3606401731902918e-004,5.6284957738679635e-002,1.5165213979886782e-001,4.6226222347559265e-001,2.7252135627777035e-001,3.1400677798171267e-002,1.7479331442625246e-001,2.1682559645675620e-001,1.6156176148446749e-001,1.5796787718556893e-001,5.3393597936270881e-002,2.6471440678276659e-001,4.1399725638138846e-002,8.0479930242105049e-002,5.2450814837627813e-001,8.9396298335134294e-002,8.2071627775986804e-003,3.7700583419288958e-001,4.9243457372258374e-002,4.4098078731003970e-001,1.9891674225988348e-001,9.4658247202072637e-002,2.1230437746095041e-001,2.0912050017774031e-001,1.0333007708883996e-001,1.5750755776108913e-001,3.3310108313449083e-001,4.4051993202094498e-002,1.6063710722281491e-001,1.0582800826460437e-001,1.4250826432573943e-002
,-1.0572423835433134e-001,3.3876360575897069e-001,2.0434250193755144e-001,2.2316048926600932e-001,3.2856827721633293e-002,7.3279207005161176e-002,2.8408707062998517e-001,2.9113671147464805e-002,9.4065933060175091e-002,2.6667931678696816e-001,1.7317906644734074e-001,9.3889702292331116e-003,2.4690558477726865e-001,1.3030955283655982e-001,4.1344387566091750e-001,1.3234835974797915e-001,1.7398002420641803e-001,1.7342194375531837e-002,2.4842742358301245e-001,3.5412916145564227e-001,2.3912079387896387e-001,1.8682413894875051e-002,2.6473892592809556e-001,1.2172248451150576e-001,2.0423694761179631e-001,2.2352543050247708e-001,2.3829536170232166e-001,1.4129975231674374e-001,2.7845734770124769e-001,4.5835779113055815e-002,3.7057204833717938e-001,1.4977250421627120e-002,3.6421590039749452e-001,1.9772970400719658e-001,8.9037881501320137e-003,1.3108425122655892e-001,1.1866065010853704e-002,2.0339804387676277e-001,8.6687690166232484e-002,4.0686842084867558e-002,1.6950832587909182e-002,1.0824273193132383e-001,4.0301544415397250e-001,1.4755608121105482e-001,2.5685937383207635e-001,1.7946415215177192e-001,3.9925456473952903e-001,3.9484802205680064e-001,1.7139949513156688e-001,3.1681389205532712e-001
,2.2484647106987687e-001,1.2813023948767118e-003,5.2874925372091701e-002,2.4361523322007253e-001,1.6164937421045456e-001,3.3475328606454513e-001,3.5761880842887894e-002,1.6664930270866407e-001,1.0249493012148494e-002,2.7682975883439115e-001,1.3534016223011183e-001,4.6675857927898523e-001,2.9205596078775487e-003,1.5971059085466632e-001,9.1685981583618029e-002,3.8934020861550389e-001,3.1718017469526166e-001,1.5030192552934382e-001,4.1755321767522874e-001,2.9886641438650946e-001,2.5890885005174801e-003,2.9829748054989830e-001,2.3564726148582166e-001,4.2168173338734161e-001,1.2279889061681806e-002,2.9866557537356259e-002,1.1983156121187825e-002,2.0982976081639546e-001,1.6063499472722392e-001,2.3471651106225996e-001,5.0373327125496851e-002,1.3994095185049121e-001,5.0895168664164048e-002,5.5953088814541434e-003,1.1707967655703300e-001,7.6491506542349319e-002,1.0397636996623968e-001,2.1571519665535241e-001,1.0337228554286584e-002,1.3317446569580367e-003,4.4016987355396597e-001,2.0495760922657008e-001,2.8493909130343842e-001,1.4535852222140871e-001,4.9856776181630619e-001,4.3031556166180424e-001,2.1157314835845195e-001,1.2625627623976227e-001,1.9868499184234076e-001,1.9512821180548170e-001
,-1.0213186306891642e-001,1.0325441325663184e-001,3.3122189348001263e-001,1.0868814586912902e-001,2.1617072911033590e-002,6.7751737610268231e-002,2.2000185645441622e-001,4.5206358236523206e-002,9.7071567054365787e-002,2.6410927176900949e-002,1.5625748514399190e-001,2.8257976729187978e-001,1.1309217973535240e-001,7.6878313947361845e-002,1.3304269878561562e-001,4.0479227096948162e-001,1.9441306498369573e-001,1.7094117796106516e-002,1.5954969434029026e-001,5.7207121008789275e-001,1.5629948286174269e-001,4.1453175949017873e-001,7.4880334843438229e-002,8.4771637687096488e-002,3.3851027262325167e-001,3.6155619562498664e-001,2.7038922877377553e-001,6.4928299811316245e-002,4.5766584396978435e-002,2.0421173021687106e-001,5.5715881316120777e-002,4.5887455536527177e-002,1.2337356301406729e-001,1.8941659108750697e-001,3.5661306933839482e-002,1.1235556007929660e-001,8.1603786870907982e-002,1.1364853680841544e-001,1.3310954026623126e-001,4.1794359413190801e-001,3.7648901796576051e-001,1.5523812593979941e-001,1.8389103409162783e-001,3.3059557158211073e-001,1.9214701062142173e-001,6.5079374525514377e-002,9.0888014281724536e-002,3.2949378153993536e-001,1.6030960733433433e-001,1.7438863148545558e-001
,-1.4628876516403108e-001,1.3619464488671504e-001,1.0488131550163819e-001,1.0841926181767422e-001,1.4463152659657258e-001,3.5846404517011660e-001,3.6849650713730997e-001,1.1943376489509351e-001,4.4796615131948513e-002,1.4365946585486192e-001,2.2406787931998923e-001,3.0365973333265428e-001,1.5840341926021334e-001,2.9124831755246522e-001,2.0564913799101950e-001,3.3054237081502064e-001,2.5445665443397608e-001,2.5185315618958515e-001,1.4260603178192743e-001,3.3380444648283492e-002,1.0015319923866789e-001,2.8890426202422725e-001,4.2941868371312136e-001,3.6576727656606556e-001,9.3263972489286390e-002,8.3458046913506098e-002,2.3543199349051339e-001,2.3251922281682472e-001,3.0715228171273040e-001,5.2978121667575477e-002,1.0261814544016112e-001,1.7478442825659538e-001,6.9787556805170320e-002,2.1144464220895443e-001,3.2318349944451924e-001,1.2690603368414807e-001,1.6149498333819612e-001,1.7073489099279079e-001,2.0835714164276486e-002,4.8413350605976985e-002,1.1541668295414839e-001,3.2300972824776397e-001,1.5803588820184319e-001,9.5004105686569973e-002,2.2347470437064210e-001,9.5976497746538783e-002,1.5074461135402567e-001,3.8124399377962770e-001,1.3553259259672334e-001,4.0440042383496268e-003
,-2.2382505328022950e-001,9.6609333206782153e-002,4.3593481542373497e-001,2.4833043371887617e-001,1.9642664452597874e-001,2.8497475134157318e-001,1.5084048264348657e-001,3.1957362384079319e-001,1.8851418256352789e-001,2.0583997107391963e-001,1.7899600678048880e-001,9.3295338713446675e-003,3.1495761415018236e-001,2.6785635742210645e-001,1.5732256842882036e-001,4.7206370537644315e-001,1.4296516988336705e-001,1.1052187499876468e-002,2.1996590465888735e-001,7.9895942366768211e-002,1.2349109859014343e-001,1.9785258827107347e-001,2.1913333354489983e-002,4.5867010610770427e-002,2.3768862322305040e-001,1.2126095764031505e-001,3.7270275371676723e-002,3.1758915535293364e-001,8.1573469100985410e-002,2.2664879783453495e-002,1.3191157714742804e-001,1.4515763788895406e-001,3.2334905270186154e-001,5.8826832576158380e-002,1.2868628548178679e-001,4.4208648857052862e-001,9.4781391356983422e-002,3.3387470318085788e-001,8.3617560867104840e-002,2.3730683449588885e-001,1.0857360707407009e-001,1.7584391795194551e-001,3.5708786634135170e-001,1.2031635084034313e-002,2.2230656631190160e-001,4.2595254551944017e-002,4.5955748967345261e-001,5.6613937047099640e-002,1.2750002828441115e-001,8.9757170648612050e-002
,-1.4701316397872921e-001,2.9570378497678995e-001,8.3594428449995234e-002,3.0704254931036395e-001,1.0528421531434701e-001,5.9642951973112268e-001,2.2112807195352135e-002,5.8576350427541224e-002,1.6103738080511742e-001,1.5039400321812421e-001,6.8888788248721314e-002,3.9767165761090012e-001,1.6624999396483825e-001,2.4992813976581058e-001,5.3699587021824924e-002,3.4781857749506012e-001,3.7348414115927264e-001,4.1751907682892403e-001,1.2429341198576836e-001,1.7024117302268210e-001,5.9790474292192558e-002,1.3065129453446307e-002,2.4539940656557596e-001,2.0193212823065324e-001,3.8336089442399840e-001,7.7533526074300335e-002,7.8801180855105166e-002,3.9474583656597478e-001,1.0394433187295041e-001,1.3137801632362386e-001,1.2735189130213256e-001,1.0502031708140128e-001,2.4982399396431521e-001,1.3044554599398647e-001,7.5838008250004404e-002,3.8257335234694800e-001,4.2338372289502713e-002,2.5140061661923008e-001,1.1136342446479729e-001,1.0555844932047127e-001,1.1337099494313840e-001,4.0526640936839975e-001,4.5518111674278905e-001,3.3263493651233655e-001,2.0621240668421628e-001,1.9613668131380244e-002,1.6204730681729135e-001,1.0928291195979951e-002,1.4184186880317284e-001,1.5261879584088262e-001
,-2.7056344577781799e-001,3.3210133477608306e-001,1.7076946378461227e-001,7.6208179365076192e-002,8.2746994158771972e-002,4.3018576967814054e-001,2.0391818980612419e-001,1.9830751694653198e-003,3.2245329371060588e-001,2.0176396644181332e-001,1.6521490173924114e-001,2.9280209056644402e-001,2.1328998901136026e-001,1.6071009713394283e-001,1.5408971783292921e-001,1.4269091798422254e-001,1.1035191882229040e-001,3.0488838330158131e-003,2.2398373979614183e-001,8.4281673726854273e-002,6.1315301237856133e-002,2.2348883309392809e-001,3.5146473014831270e-001,8.1815065919900398e-002,1.6987171762855169e-001,3.9526155936056434e-002,2.5100725402871307e-002,1.8697179310818315e-001,2.4031130320478192e-001,7.1342036633299299e-002,8.7605984832051023e-003,4.0900411775135925e-001,1.6854136148085688e-001,1.4837583298906613e-002,3.3345428033697538e-001,3.2814024965909086e-002,3.2002471301380113e-002,1.6112184614892183e-001,2.8044889168607284e-001,5.1789523810841287e-001,1.0752468010977716e-001,3.7637672725334131e-001,7.4663625794915381e-002,4.4127508261739079e-001,2.9357476346289862e-001,7.6106371500131886e-002,1.8929692452503138e-001,1.0696388479061383e-001,2.2599555611471112e-001,3.7065922318926546e-002
,8.6563325413114914e-002,1.3849377997761769e-002,2.4712546514067974e-003,3.3657065017926308e-001,8.8354664880533451e-002,1.1310772224776623e-001,1.7719917058750499e-003,3.5854843896348471e-001,8.3302709353397203e-002,7.7817721454175037e-003,7.0662399633378142e-002,2.9575929476700774e-001,1.6996447149326030e-001,1.5142976692500557e-001,6.2479043294115320e-002,4.1421532907136197e-002,2.5167590059805778e-001,2.4641876711808380e-001,1.8897744140283096e-001,2.1667623015389204e-001,9.7883677109159156e-002,3.9690638598137123e-002,2.2796899665719052e-002,2.9020004117364817e-001,1.0554625186254986e-001,1.0762783645753053e-001,1.4271767588096965e-001,8.5573688648749605e-002,3.2119708085750383e-002,2.8545308968468402e-001,4.6413119726797770e-002,2.8285529840263945e-001,1.6198790017929179e-001,3.4959029112574404e-002,4.0485902305442728e-001,6.7610567970604205e-002,1.7353265171924223e-001,2.7681738342696582e-001,3.4583111766743091e-001,4.5930661238379683e-001,8.5214912238138762e-002,7.3234363434035304e-002,2.5051888990378157e-001,4.5010190023482405e-001,6.4283705430782115e-002,1.9207504393210617e-001,1.1201196421901335e-002,1.8149949556294165e-001,2.3331439569137014e-001,2.4576114878944116e-001
,-1.5962381001107129e-002,4.2118984362568229e-001,2.0409299981167159e-001,2.2597211088473854e-001,4.4804745291542408e-001,2.0800355939702572e-002,5.5294947726346654e-002,2.7766724681907001e-001,3.9784483300668488e-001,2.4341824758261227e-001,1.7590913692314181e-001,2.7276597276271120e-001,1.8467719254060100e-001,2.9505373621660935e-001,3.5441207623837578e-001,9.4694561594414098e-002,2.9192000925638761e-001,7.4926581984381971e-002,1.2025713015780693e-003,1.4374118243089046e-001,1.4959710342495597e-001,2.0394377481125409e-002,1.1123898648368821e-001,4.7021163673819040e-002,3.7964876131849939e-001,1.7858089868696669e-001,4.1626113182463970e-001,3.7524671640931505e-002,8.5318313930254477e-002,2.6967783312248367e-001,1.4650847100047515e-001,7.8317655795214283e-002,3.4560720582811684e-002,1.2116488986263822e-001,1.5230142381531778e-001,4.5931594429310892e-002,3.5568064333538363e-001,1.7762598149145212e-001,3.2337846429050515e-001,1.9368327024420540e-001,1.6064961697250796e-001,1.2400332194922306e-002,8.6694789252079824e-002,3.4488334969309441e-002,1.2581153141489562e-001,1.2900807875809012e-001,3.2577703357124826e-001,1.6974010288081037e-001,1.5427327562430124e-001,1.0619846354524051e-001
,-3.3169889510021333e-001,3.3676919247827058e-001,4.0398995818688201e-002,2.2259154177451809e-001,4.7798420555193494e-001,7.9152624407423197e-002,7.0719209629574786e-002,2.6435066775034398e-002,1.0875263628835410e-001,1.8199918805095992e-002,4.9122902965270658e-002,8.9094110774875029e-002,3.7643014444387374e-001,7.3867775172422559e-002,2.1371514876530917e-001,1.6683786721768573e-001,2.8121753110889586e-001,3.9381770156446982e-001,4.2777439398621275e-002,1.4067348720091997e-002,5.3860640129607407e-001,1.3699336734007576e-002,1.0200920207507193e-001,1.9854776731464931e-002,1.5958404359750439e-001,8.6988584786808751e-002,6.1270211423418104e-002,1.4494657128908531e-001,3.4027421310744249e-001,1.1164242470373784e-001,2.2922955851113844e-001,4.0079050140932271e-002,1.7222129484205533e-002,2.5580139231283407e-003,1.8402137322924009e-001,3.1229865886971509e-002,2.0111007828273963e-001,2.2769039067039037e-001,2.1332386295665023e-001,4.8683302323762175e-002,1.3167116347360736e-001,1.8157816800177393e-002,1.5073141375022325e-001,2.5466677120290448e-001,2.9764831829487437e-001,1.7604477064134963e-001,2.9438741507348876e-001,2.5057683491455346e-001,6.4854633832796160e-002,1.2923100913204413e-001
,-9.2430261110740680e-003,9.6093911062654594e-002,3.0895859918048063e-001,1.4236373169347494e-001,2.0691104963483122e-003,1.6409826159630846e-002,3.2417853674339880e-001,3.8078381017469784e-002,1.0941254258470513e-001,8.1089055094126755e-002,7.4032393257240892e-001,1.7197038831507566e-001,2.1946798162005329e-001,2.7038398638404837e-001,6.8974326733180533e-002,1.8988789597601288e-001,1.4088166479408815e-001,5.7954134749765483e-002,3.9516882365476425e-001,3.7038051573641612e-001,1.2282128131080729e-001,4.5815665287018809e-001,1.4987502303499484e-001,4.9473664401165539e-002,2.1049752957778045e-001,1.7754232282356236e-001,3.0287878984223005e-001,3.2880371373425962e-002,1.8269822725214546e-001,5.9401406514189660e-002,1.8970094335963583e-002,2.5520464680857258e-001,2.5995276734332518e-001,3.0487807212845092e-001,8.1112342468432880e-002,1.2013871120733363e-001,8.9464254439750347e-003,8.5375891979010202e-002,1.5429882146991009e-001,2.9909473157275990e-001,1.6998611253479463e-002,1.9990128006480378e-002,3.0679542199530696e-001,2.3563275517246807e-001,1.9081224164164587e-001,1.4096932181941116e-001,2.8210270527385492e-002,1.1230895270840995e-001,2.7162384922302418e-001,1.8464689030573114e-001
,-1.7417381204506535e-001,1.6759976294281448e-001,4.5973015135237433e-001,7.8412791208210250e-002,1.1788660006728045e-001,2.4760704208551099e-001,1.1716185822521488e-001,5.4889441993843310e-002,2.0860957695243289e-002,2.0810816687262060e-001,2.0660214637191433e-003,3.6870212327502006e-001,2.1599811964714705e-001,1.3530346192532388e-002,3.1792765725164228e-002,9.1513236137837822e-002,2.3262413726582695e-001,7.2714425156407234e-002,2.2881874325080948e-001,1.3161192171962657e-001,3.3122397391284431e-001,1.5962058610253980e-002,2.6712041811269398e-002,2.8782451068169945e-001,1.6305676191599600e-001,3.2005257210783583e-001,4.2820496526928331e-001,2.4653800792429853e-001,2.6968354446332925e-002,2.2081521058779119e-001,1.0417036499570738e-001,1.3666486831449956e-001,4.3944537984859489e-001,1.1264560011773478e-001,8.5734225161073443e-002,1.0233914092372501e-001,4.2538583360214194e-001,4.9517359710283976e-001,3.5767734875191581e-002,4.6681340333357163e-002,7.0300299906087604e-002,1.1290953139350141e-001,7.4860818776507673e-002,2.0916965260131523e-001,4.2316549139176096e-001,1.0596459781764188e-001,1.4540952256710643e-001,1.4519587920722599e-002,1.7854502942850092e-001,1.4831704554022351e-001
,4.7628284277763902e-002,3.7440608710928400e-002,2.7578165435921516e-002,3.5275902283046601e-001,3.2696942420525948e-001,1.5138912676133678e-001,6.6652455331748600e-002,3.6968719022935015e-001,6.6721302568548274e-002,3.4037373423062239e-001,2.5479891966534346e-001,1.9951026200760505e-001,3.8426564793435358e-001,3.1697057775176901e-001,9.9320557606177653e-002,1.0343426896099281e-001,1.2717184040853144e-001,3.1514589033909507e-001,1.2948871587282046e-001,1.5365227000616477e-001,3.1285716742254632e-001,2.5947247628739456e-001,5.2209732773719014e-002,1.5489519667009780e-001,7.0249576157748031e-002,4.2850166198585482e-001,1.5056447379901389e-001,8.2409204288998339e-002,1.0586202830367777e-001,1.8734072212586972e-001,1.5711233533860728e-003,1.8483100907893721e-002,1.3083451388941147e-001,2.5428547900730591e-001,5.3630380442002183e-002,8.6290831564192205e-003,2.3808822195126630e-001,1.3259781843642557e-001,4.0672491762435264e-001,6.1639217442851738e-002,2.7678499918354521e-001,2.2991519224817328e-001,2.8306678490399806e-001,1.6001206195833945e-001,5.2665168268466130e-002,2.7170280116224710e-001,6.8994148402513431e-002,2.8643913650637015e-001,1.8171309433038174e-001,1.4425145399181846e-001
,-2.0198280337669108e-001,1.3945049453930539e-001,1.6478353014605840e-001,1.2279562121028906e-001,1.2710975533432239e-001,6.4459253852521090e-002,3.5561015577321653e-001,5.6957587224298445e-001,1.1812351364719126e-001,3.3270361216021765e-001,1.3127240683308070e-001,6.5903645533008676e-002,7.7208701969117846e-002,3.2264310151811509e-001,1.9440282431661099e-001,1.4162748662161981e-001,6.3178428813950679e-002,4.8165729919643668e-001,3.3706280032976504e-001,2.5785543487898976e-001,7.9440620262882386e-002,7.9226082302438439e-002,7.4639300317431559e-002,2.3552414846567357e-001,1.9803631195923627e-002,3.5635849592690949e-001,5.3170704401479030e-002,3.4779525130228710e-003,5.9990982895154789e-002,2.6773785520950671e-001,6.4111196574048390e-001,1.2941459630294419e-001,3.2074712559031306e-002,1.2826113612662587e-001,3.1698618759643066e-001,8.8882087323115838e-002,3.2665532236834649e-001,7.7306966773108651e-002,1.5120928052235905e-001,2.2061826637797782e-001,6.4629184405479240e-002,1.5795153937625300e-001,5.2743019076541319e-003,3.3439697394993817e-001,2.8133701468489678e-002,1.6387054561571072e-002,1.1088761041865722e-001,2.1388409814660322e-001,1.6510501071945446e-001,1.2761004578999686e-002
,2.1520208136982186e-001,9.5476047320210866e-002,2.4934572064979596e-001,5.9514583062515704e-002,3.1172349743869371e-002,3.7661982700552366e-001,2.7812227428317138e-001,1.0142512622737673e-001,3.8856280240098340e-001,2.0049263651528304e-001,8.0859293169817478e-002,1.8204670969813014e-002,3.0940470444341378e-001,1.7834353878435316e-001,2.5385320536539119e-001,7.2209655170997727e-002,1.1019188000038682e-001,7.9024640938545429e-002,1.5378138389771248e-003,6.5548128511093942e-002,1.9090944129371446e-002,4.1227802987814155e-001,6.8493694052038390e-001,4.1933343875493945e-001,1.1449921903478541e-001,1.6036107190708732e-001,4.0359818582793638e-002,3.1997831709363678e-001,2.9474873278216279e-001,4.1340601938584548e-001,1.6492469656579822e-001,3.2743354444764661e-001,2.2272520539582277e-001,3.8681851179040591e-002,1.2577177866276948e-002,9.1276381554170505e-002,5.1394668218643934e-002,4.8188459087253215e-002,4.8635261465850649e-002,1.2137273488365016e-002,8.1706204639386007e-002,3.4776092642723425e-002,2.4248742514182239e-002,3.7776243663776327e-001,2.8662305696718160e-001,6.3816481504960262e-002,1.7861626931480148e-001,5.2886264930264028e-002,1.6205530965816878e-001,2.6520468596359126e-001
,1.8159205156685856e-002,8.7816536000293197e-002,3.7607568941169439e-001,4.0265178657242323e-001,1.2847732127759723e-001,2.2604419541839815e-001,1.3440008184565877e-001,4.4632912324178009e-001,7.1107338826463307e-002,9.1568078551111515e-002,3.8098258573484312e-002,1.8334565177917853e-001,1.9386093978488389e-001,1.5353708464391769e-001,2.3319118670958480e-001,2.7800100599944241e-002,8.9261484329911406e-002,2.6491940944702463e-001,1.0894809565507665e-001,3.5544688012958993e-002,3.0200706655674553e-001,5.6467565584616460e-003,7.9586797513126153e-002,4.2300573267077496e-001,2.3792435554920194e-002,8.7095006304004879e-002,1.0722750872051328e-002,1.2469616723545299e-001,1.3351099623258947e-001,5.9055235374708477e-002,1.3668452730773822e-001,2.9415305432162470e-001,9.4446637790938148e-002,3.4399881530649623e-001,1.8016038890828190e-001,1.7432305533319037e-002,4.1960676223182856e-002,2.5906331408992039e-001,3.1352432449678408e-001,3.8382254207596569e-002,8.8187473986295284e-002,3.3659927545210806e-002,1.6012532497907220e-001,3.4122080403819727e-002,9.2255047175453922e-002,5.6090212773736291e-002,1.7534079329476887e-001,1.6710389060966671e-001,1.9152644587790632e-001,1.2739482382207182e-001
,3.2555808597912927e-001,5.0114269351906782e-001,2.8704294067998437e-001,1.8910026553648099e-001,8.5532213781209537e-002,1.6199168326126290e-001,7.1351281615818468e-002,8.3719024798204894e-002,3.1921437288012600e-001,4.0901224580220347e-001,1.0258424088709059e-001,1.1969229054139718e-001,4.5679987274490980e-001,2.2840837057355337e-001,2.9855565521334770e-001,1.4099846271465538e-001,8.9826060705576638e-002,2.9561320392035795e-001,2.6447557915891279e-001,2.6326086381998703e-001,2.9189808078840923e-001,5.7319082714026491e-002,1.0867466302274434e-001,8.9060548292760111e-002,5.5584763689914760e-003,8.3307758010200572e-002,3.9413555360509861e-001,4.8914518773229804e-002,2.0329964218005087e-001,4.9034932407786197e-002,2.4624691169494459e-001,9.3339347973758258e-002,3.0208296967215953e-001,6.1481996056744231e-002,9.1116698427833404e-002,2.5063286120942813e-001,1.6743716802387093e-002,3.0598426060422079e-001,1.1829060448959888e-001,5.5943061353243853e-002,2.1536788949873842e-001,5.3858372735418436e-001,2.0342083690588436e-001,3.0138652370528211e-002,1.8902886337853833e-001,1.0114536136034227e-001,3.4406450450893511e-001,4.2008726225119475e-002,1.6653173525113371e-001,8.3086415704041003e-002
,3.4582844928051026e-001,2.9121580717510698e-002,5.7671901960663192e-002,1.8187250060683280e-001,1.9268065762142703e-001,2.3629341480179808e-001,1.3344400348657151e-001,3.3497344739348112e-001,8.4741216461668867e-003,8.9799725078517044e-003,2.3127840796362265e-004,2.4495155008326067e-002,4.5543761779931899e-002,3.7285597512813906e-001,1.4954482071340673e-002,1.9661466429969551e-001,7.9665576932938381e-002,5.1493241526793652e-002,5.1100165653852569e-001,2.3987269595034701e-002,1.5840558997114415e-001,2.0600076999907405e-001,4.7647807481058783e-002,2.1447062356176977e-001,8.6705383592284843e-002,3.7891099751730058e-002,3.0175434210550645e-001,3.2608839568964743e-001,2.0302075030365649e-001,9.9924467522367263e-002,3.7449494617909111e-003,2.7832532877211713e-001,6.9940966764215518e-002,2.5064594806973961e-001,1.1335240051560054e-001,5.2385802425336270e-001,1.0771963078366521e-002,5.7735867747942107e-002,5.5323529403115117e-003,9.8054185073433078e-003,3.5336412074428170e-002,5.2071132919621378e-002,4.0278639377703845e-001,1.2420324522685422e-001,2.4470298011101313e-001,2.6687562224068151e-001,1.9033247017714177e-002,2.8705633253827767e-001,2.9213737341076979e-001,7.3519979156127018e-003
,-8.2534602012871522e-002,1.1875267675703549e-001,3.5134120736936350e-002,2.2375827427876974e-001,2.4157127567451326e-002,1.7435293457981133e-001,5.7977015683896925e-002,3.0460427300789510e-002,2.6136944184472788e-001,4.1109142684842365e-001,2.1953917606636827e-002,1.8474679566605456e-001,3.1332561343297177e-001,1.8747214990300334e-001,6.3151522071806104e-002,3.9979737669494159e-001,1.1922652736981412e-001,2.5167909532554694e-001,1.0421254237147543e-001,3.2437575052402112e-001,1.7164254901687773e-002,2.3145720022261251e-001,1.3238259426835566e-001,1.6649310790726068e-001,2.5524633061644830e-001,2.6423574225576130e-001,1.6808768632484794e-001,1.7329873893523215e-001,2.0261872464266673e-001,5.7989527516556519e-002,1.3206724587985452e-001,8.7913902921936418e-002,5.1607888003507629e-001,1.7575126755645717e-001,8.4898530809752210e-002,9.8518770244627619e-003,1.7726970651292633e-002,2.8168438321033426e-002,5.4331212660690183e-003,1.2435307490976030e-001,5.0214953740236834e-001,2.7017599959271606e-002,5.7391229128009577e-002,7.2947307013659618e-002,1.9234451746415832e-001,2.0771456386911663e-001,2.8818365076409702e-001,1.3082085817326136e-001,9.5619016050096151e-002,2.2589952998531407e-002
,2.1151851894870198e-002,2.4388747628392757e-001,1.4019297823772608e-001,1.4692939540962810e-001,1.4380217442678239e-002,2.5930313156789919e-001,1.2618133125573505e-002,1.9634404884082836e-002,5.5182545139412412e-002,3.7735443911152779e-002,4.8666468666296386e-001,6.4166268513929120e-002,1.0622650592205657e-003,5.3393986825277046e-002,3.0331368897337735e-001,1.5088757502997308e-001,1.0790688801993507e-001,2.5439599187058648e-001,3.6354005067200690e-001,1.0252402475489958e-001,5.9648664700423869e-002,1.9814827499540538e-001,6.9225639935112201e-002,1.6520929822728495e-001,2.5014538081910363e-002,2.1845457745563809e-001,1.6451908546330357e-001,2.5062582151856866e-001,4.3985142114493009e-001,1.6315647251599275e-002,1.0911331783979883e-001,4.3100813959893353e-001,2.2563938145529916e-001,2.8851471509698834e-001,5.7736334748847840e-001,2.6434504020630528e-001,9.2461000541409540e-003,6.4605486473514342e-002,9.3765434083038016e-002,1.6715155878796403e-002,2.6048838906898392e-001,4.0146920000204617e-001,1.6555182550245978e-001,2.2563202903810621e-002,5.7561274137780914e-002,6.3349713700171395e-002,1.6831589590718279e-001,6.5420255951425213e-002,1.8170266186399045e-001,5.8639222712588195e-002
,2.4404904609072747e-001,2.2566175512202144e-001,1.1718608051876185e-001,2.5185602459583628e-001,1.0040367262703621e-001,4.2117055407979759e-001,1.2043801461836995e-001,7.6044032761411751e-002,3.1696280452517339e-001,2.6026274555750439e-001,2.6992146144591217e-001,1.5535986172003721e-001,3.2410131550152610e-001,2.8914681946075715e-001,1.5475204082127544e-001,1.8342633831069022e-001,7.5932184170524275e-002,8.3738009807826724e-002,4.1540589052764858e-002,3.8161743752365090e-001,3.2549855761772495e-002,4.0957039730556194e-001,1.4329058713674783e-001,7.3130693867786575e-002,2.3917141293436714e-001,1.2098580051163532e-001,1.4713202104288575e-001,3.4018136026506340e-001,4.4196288751062823e-002,4.8157546284311759e-001,2.0007509073612068e-001,2.4156927369646747e-001,9.1041212508515906e-002,4.8225726557090932e-002,4.2571477560760615e-002,2.1297917856478316e-001,1.9730712337406808e-001,1.4965900479625832e-001,1.5067559556032928e-001,7.4742542772337897e-002,4.3497901308894429e-002,1.0609025438155530e-001,8.0342146139005283e-002,4.9767675033612110e-002,2.9905109674360941e-001,1.2909304196478227e-001,8.2967735074844340e-002,9.1200335589867190e-002,5.0645640362740829e-001,1.3281594216982087e-001
,5.8289796205032225e-002,1.6531132232192874e-001,2.5264398759267087e-002,2.6124024833560444e-001,3.6363786573970758e-001,8.4137084499463916e-002,1.7379777227019100e-001,2.0520622456830184e-001,1.2886860998803329e-001,8.5540267166002659e-002,3.7873068802486581e-001,4.8836818423061723e-001,1.3154589532063538e-001,1.6954330873701021e-001,1.7366988228637606e-001,5.0768877868590821e-002,1.3489640440850198e-001,2.4419097838975051e-001,1.0860064179154323e-001,3.2894888537391836e-001,9.4215709496505040e-002,2.8320662719282275e-001,3.4685126975369968e-001,2.7055357574035527e-001,6.8015272478665526e-002,6.1916651029677139e-002,7.0609283113519994e-002,6.7698405222083521e-002,3.9398127535072880e-001,2.2744031722603533e-001,6.4574716988833741e-002,1.0498313208122188e-001,3.4726036121022119e-001,3.3467023061239226e-001,4.0278781280869936e-003,1.1338183146671246e-001,1.1524237288746476e-001,2.6817991550045939e-001,2.4721075751078880e-001,1.4825605033169756e-001,1.0719307340212467e-001,6.3930385406783211e-002,3.0448091797198140e-001,6.8953021150855123e-002,2.6109877311838259e-001,1.2863435754405592e-001,4.8036086435841441e-001,1.0942335930408673e-001,1.2269682365920047e-001,3.1922404796385556e-001
,-1.9890680433477806e-001,1.2259951687192781e-001,1.8124638977310570e-001,1.5656734471084882e-001,2.0431332673283120e-001,1.4398114499339323e-001,1.6716539482952725e-001,6.8256544204128702e-002,7.7772635744548416e-002,2.1822811927780494e-001,1.7297751806450928e-001,4.5624634671963024e-002,1.0271149838847039e-001,2.0155257844168389e-001,8.0223902188535590e-002,4.5550925713498369e-001,2.9697651265785585e-001,3.5221921198105577e-001,2.7982841722908069e-001,1.7581895685294063e-001,1.6608061095430063e-001,6.0198351295399376e-002,3.7935195071887889e-001,2.2909211679865538e-001,3.6579210356691361e-001,2.0812753445326468e-001,1.6135331439640292e-002,2.3849918492755559e-001,4.2874310967668533e-001,2.9349417127666483e-001,1.0288068028819293e-001,3.2184728467385620e-001,9.3951143959547304e-002,1.6504196104720217e-001,3.0451233095044633e-001,3.5537743353076849e-002,9.0542934650566821e-003,1.8912853343050054e-001,1.4247416328666149e-002,2.2462687025803760e-002,1.2239721246326990e-001,6.9952599936388207e-002,2.6629608038199243e-001,2.7054610339030377e-001,1.4989123868617777e-003,4.9218110845668808e-002,1.2633740063668814e-001,3.2544985482076882e-001,3.5887580314031930e-001,3.4802315489546876e-001
,3.7986235173250157e-002,1.9561352610199462e-001,1.7414277493395600e-001,1.8384158235891537e-001,3.5960297275015840e-001,9.8587773588397459e-002,2.9986013438854063e-002,1.3685408565032334e-001,8.7034828427446448e-002,1.7768579612238783e-001,2.1655158449179779e-001,1.2583585241470963e-001,1.0863040454497805e-001,3.1991503612108868e-001,3.3794339735179968e-001,5.0539125955040498e-001,7.2636201607846687e-002,1.0259976710848270e-001,3.1905875479875440e-001,1.9790317250997397e-001,2.3983862459845595e-001,1.2334100780040980e-001,1.6131434209292506e-001,2.9138381798833701e-001,3.2558702993549099e-003,3.4743607733244336e-002,2.2738178188063361e-002,1.9840892339314342e-001,3.2551679808974310e-001,1.6062113598643071e-001,2.3422280583867056e-002,3.9740596309899684e-001,1.9753951507135334e-001,2.1352839907600927e-002,6.4225640172682022e-002,2.2216270754198761e-001,3.4014578410377955e-001,1.4500556170598544e-001,1.1075011391088760e-002,1.3420157206057165e-001,6.6259462059488072e-002,2.8557050379835180e-001,2.9223798370951881e-001,7.0268039531642706e-002,5.7424314167805357e-002,1.8338729528841161e-001,1.0449487405268182e-001,3.3143854353530414e-002,1.6932815981288266e-001,3.9310263440467852e-001
,1.0510062134489044e-001,2.1816331763641861e-001,5.8882749280792485e-002,1.6664602649981930e-001,1.6540042164755470e-001,6.4528662536004616e-002,3.8691584086054343e-001,1.7398413699662368e-002,1.0664614466034310e-001,9.0236836135437704e-002,7.4819862679668475e-002,2.7299315648858030e-001,3.8594882634934380e-001,5.4123731753297821e-002,2.4498609517672637e-001,2.5325693635313035e-001,4.6720755642218337e-002,2.0239003938011560e-001,3.0122345033339293e-001,1.1130953046655612e-001,2.2577003182710181e-001,1.6735796737546504e-001,7.9837455382681978e-003,2.2382012622616640e-001,2.6567473563879429e-001,1.3050282550001077e-001,9.1790623623668383e-002,2.3739229067954878e-001,2.3734727434427427e-001,1.5014396547101144e-001,1.5929637331247623e-001,6.8462715355706180e-002,1.5550954492553698e-001,3.3215906245615262e-001,1.2830387892286882e-001,1.7060427267458430e-002,9.2293137589981394e-002,1.8149304532174496e-001,2.3212038719245426e-001,1.3598543053889980e-001,1.6505303005393995e-001,3.1312449524710606e-001,1.7768850028987634e-003,3.2889661584804891e-001,2.8809040238129124e-001,3.3434434749266229e-001,2.4813534011249011e-001,2.4068706547879798e-001,1.1353284988224877e-001,5.8926524143848602e-001
,1.7674627021237174e-001,1.3395810274895681e-001,3.9453411919866860e-001,1.0601064472280798e-001,1.9921703864931972e-001,1.1573291711251628e-002,1.3513119214337133e-001,1.4136484906978650e-001,3.3836440720624006e-001,2.6381524034874987e-001,7.4295733797548197e-003,9.2285368384439265e-002,3.1996883028855574e-002,5.4289016145789448e-001,6.8255338818912908e-003,1.2099208798379577e-001,7.0247927355610223e-002,1.2069459083178853e-001,2.3183522211221136e-002,1.6601013416038594e-002,2.4906644668236860e-001,3.5168517096775798e-001,8.2375969196169935e-002,2.7085226289163356e-001,6.0046500579778742e-002,3.0313089573332319e-001,2.3682196603433839e-001,2.9020439609590165e-001,2.3579033816109854e-001,1.9315014888438714e-001,1.7393025825709948e-001,1.0203380546428525e-001,1.0024670288915322e-002,1.7505383540257869e-002,9.1869302765405836e-002,3.1033847251318733e-002,5.9386987827824345e-001,5.0106927564766771e-002,4.0637619951222637e-001,9.5907097223415394e-002,2.2305919195804678e-002,8.0494465983041580e-002,1.9877904395624327e-002,6.1644122554989716e-002,1.7285370135769082e-001,3.5828754480199054e-001,7.3160639603975300e-003,3.7851782754517907e-002,4.1313791373893138e-001,2.4519467963807257e-001
,4.2597780573791516e-002,7.0962455083724604e-002,7.0945483477851345e-002,3.5426844652264233e-001,1.8011077401135253e-001,4.4670403527188490e-001,5.9772962534402549e-002,4.0074686229343226e-001,5.3074394760683881e-002,9.2019245148138126e-002,3.8130773216506075e-001,7.4743784035548516e-002,4.0688777665789599e-001,2.9157137174318176e-001,6.6796143878516734e-002,1.2060569288036205e-001,1.1336103304804275e-001,2.5286937059452758e-001,1.2860231932417321e-001,2.5492151682403624e-001,3.9200249495263781e-002,2.7447035358385324e-001,2.1087972235860136e-001,9.5389271367996270e-002,5.5458309105892833e-002,1.4411447319863619e-002,1.6720334699222952e-001,2.6216453097265224e-001,1.8954191414825745e-002,1.6162682838800471e-002,2.1059838305817727e-001,2.5783481416644993e-001,3.2191563922602379e-001,1.8926200621090036e-001,3.1556572444761377e-001,1.0514183551560102e-001,2.4918796512777575e-001,1.8279913892755345e-001,5.7613227134955827e-002,3.4628660622513574e-001,2.2647256365136412e-001,2.0712743483631135e-001,1.6709304404679609e-001,2.3694059713099794e-002,1.7138410792024730e-001,3.1867836473801159e-001,1.0774957045007178e-002,5.6468557731852130e-002,1.5580625746719298e-001,2.8984253675196836e-001
,-2.4381139493572107e-001,1.8870722759099318e-001,1.2750963889238651e-001,1.2800500270170675e-001,2.8869177913917443e-001,1.6333652488278430e-001,1.1072913116150876e-001,6.8284695524300609e-002,3.9085692622439455e-001,1.4344633974841278e-001,1.6252930072469823e-001,1.3929715428935671e-001,7.3335736511714267e-002,1.3786558986405312e-001,4.1960670639528008e-001,1.3779120810831225e-001,1.6282854470842853e-001,1.9360257731351586e-002,1.7886645552837285e-001,4.0629789090219659e-001,2.6872134194821329e-001,8.3094793660112479e-002,1.1330425313887309e-001,2.1702390548630261e-002,4.8510552433528059e-001,5.9864109725748571e-002,1.6937483600006120e-001,1.9316929708076752e-001,1.3297541660661838e-001,1.4914830672675086e-001,1.6036225716913699e-001,1.9461668032510071e-001,7.4394271353975611e-002,1.4091461158287077e-001,4.1463223903992305e-002,1.5031587228552787e-002,1.5735193571443643e-001,1.4187215197552022e-001,1.1162164943819938e-001,3.7022098801426977e-002,2.5932461863470319e-001,1.3550324689104234e-001,3.1595980256498568e-002,1.9054362799920024e-001,6.5939348612159498e-002,5.2581472813884711e-001,2.7639118860410855e-001,3.0894520233435585e-001,8.0735515160073407e-002,5.2813432983917954e-002
,7.8690788604947645e-002,5.8517622743293904e-002,4.6253964635644990e-001,4.0021530585265325e-001,2.8548748145869818e-001,3.4453313947334576e-003,1.4125698481884016e-001,7.1398697283299659e-002,2.3862850901347804e-001,1.3525537344771382e-001,7.7493123652418741e-002,5.4028512920979921e-001,4.5746423411658488e-001,4.5906899412496782e-001,1.3652973916911862e-001,4.0089506974137246e-001,3.7382119805679404e-001,7.2005910380131377e-002,7.5267005799991701e-003,2.6428781774090437e-001,2.3982179202921752e-001,2.1545810969634188e-001,4.0315539808996943e-002,6.7205847328912841e-002,1.2870142899246984e-001,1.9028211887829177e-001,1.6744999710183156e-001,3.4802419663061156e-002,1.8180337987389417e-001,6.5956216407199925e-002,1.4723948358205013e-001,6.0658451766995018e-002,8.2426452282523349e-002,1.4066297772307779e-001,1.1394198022241256e-001,2.9756440441704737e-002,2.1440644832327907e-001,2.6786293219254848e-001,1.0819948574978999e-001,3.3467201804606334e-001,6.1869347599775623e-002,2.5852728232448136e-001,2.2645243943198309e-001,1.0905198718512070e-001,1.9879509894421116e-001,2.7727635302309740e-002,1.3619788891832598e-002,1.2861365569722422e-001,2.7641603831620773e-002,1.4542590694160573e-001
,1.6719064455255306e-001,1.5118812197111683e-001,9.4960115206087353e-002,1.0488459494843987e-001,7.7942691816809554e-003,1.9655440133142665e-001,1.8686632318663993e-001,1.9397176722539738e-001,1.0814630963494802e-001,1.9038030152940677e-001,3.2899592932952537e-001,2.1724940368875256e-001,7.8011882342701913e-002,2.1001186560656354e-001,2.4863905376692585e-001,2.7002739256368680e-001,1.2041869917248400e-001,2.7440973983956779e-001,1.2917895161259227e-001,1.0823083053180477e-001,3.7120177797944875e-001,7.4116735030506795e-002,4.1403414824312246e-001,4.0671622580217959e-001,2.0218687782758221e-001,2.3513470887665575e-001,4.6867792728268826e-001,8.5382965812952363e-002,9.9486602909433536e-002,3.7015115123484842e-002,8.8464633407666610e-002,5.6862195590793266e-002,2.8980662166433629e-001,2.3862700316597960e-001,2.9429140897776718e-001,5.3605011898093129e-002,1.9009817507760315e-001,5.3692451861151499e-002,1.9646681885378403e-001,1.9468130416728543e-001,1.9909145103510073e-001,3.3064209659240279e-001,1.9916497965771401e-001,1.5817520990412098e-001,1.4342521261723437e-001,1.4727496121144945e-001,4.2544810634431235e-001,1.4814814232853818e-001,2.9773943396882957e-001,6.4224008530154447e-002
,5.6224867613762192e-002,2.6247443326916270e-001,1.9801299742937370e-001,3.3211962922156685e-001,6.8341326923127804e-002,5.2739371052195272e-001,2.0223285052904430e-001,1.9364407687843030e-001,1.2286308384687693e-001,6.5397827710983694e-002,2.2820095464265558e-001,6.9187985132157473e-002,7.7990904848430326e-002,3.1118424168245923e-003,1.1938585606943799e-002,2.4983927678797252e-001,2.9419985608297727e-004,1.8229241997202432e-002,3.2337504589748711e-001,1.5904674375284272e-001,6.5027645205225804e-002,4.9329189871209012e-001,3.0801449748088527e-001,1.3722632617202862e-001,1.9781803263307599e-001,3.7584314443887012e-001,3.8157162219869711e-001,6.1224808296750310e-002,1.4201182332580001e-001,4.1158679979119717e-001,5.7256352502576997e-002,1.9770308458599023e-001,1.3714651646743004e-001,8.8117285659624192e-002,3.9262768664886732e-001,5.3489475060886145e-002,1.5785760734015014e-001,1.9894282330886595e-001,4.8285347544141988e-001,3.3206712443954900e-001,4.1081411364683684e-001,3.3085231217872763e-001,2.0593666306494000e-002,1.4935694051923565e-001,6.8809369949204502e-002,2.6537349073199747e-002,9.9453810863853569e-003,1.5788835401222145e-001,8.7264948957453806e-002,6.5651877967005556e-002
,9.8268248580984097e-002,1.1091615932820598e-002,1.6278863413371053e-001,2.0906960311549191e-001,8.7606317045371196e-002,6.6867230931155555e-002,4.9479611284941973e-002,1.5498064489273267e-003,5.0819305267666690e-002,2.2514517109682114e-001,1.7251467005878496e-001,3.8763428346525536e-001,1.3674020003491510e-001,2.3043458900650102e-001,3.6651933481666732e-001,1.4194898718552257e-001,1.5850026759664160e-001,2.4089133977366783e-001,1.9467973820509535e-001,4.1013530763285642e-002,2.0422740443384213e-001,1.1761805555567911e-001,3.2410309009910682e-002,2.0724303766331181e-001,1.9892566590762983e-001,3.8040378801151908e-001,2.3245014649832532e-001,3.2112363587029813e-001,5.8520608147298238e-002,1.3844113138296382e-001,2.6116583781035202e-001,1.0418345854823380e-001,4.7732146649947138e-001,1.0497271501892020e-002,5.7646400439177126e-002,3.4278656363741689e-001,5.0157104311880973e-001,7.7264026093743485e-002,2.5694318219808648e-001,2.3257958733098327e-003,6.8901614159041003e-002,6.2988979226971165e-002,3.3302114415136704e-002,8.6712887589774704e-002,4.8778680544204742e-002,1.4813154567476131e-001,1.6018508681021271e-001,1.8108217271977423e-001,4.7345072645005942e-001,1.2157873370479301e-001
,9.0346148572045315e-002,1.1795645217978964e-001,3.9846009311216274e-001,2.2038372400994427e-001,3.6879882301112055e-001,1.8282355908697212e-001,2.0148577602885287e-001,2.5058650121741155e-001,1.1684299472810297e-002,4.0644438880926392e-002,2.3555100138466487e-001,1.0606276755596132e-002,8.6727254395942824e-002,8.6290125058939918e-002,2.8958016467580178e-001,7.0865940642587721e-002,2.6080951036199590e-002,1.9713106689309950e-001,3.0726104879996752e-001,2.3478571103438725e-001,1.4847246028001948e-001,2.5954840214829564e-004,1.4518344349349735e-001,2.7695162781267327e-002,1.2615727945300656e-001,3.6304901048188132e-001,9.0124782039119708e-002,2.6689622910375982e-001,2.0880784926196952e-001,5.7734965390996873e-002,2.7277221123222145e-001,3.4712818708799936e-001,2.2052626147550415e-002,2.5462647973913421e-001,4.0143510234225810e-001,3.5533511557755215e-001,9.5214389951038356e-002,2.2738199376673957e-001,1.6347069363277703e-001,4.3217438262444730e-002,1.6579927734965869e-001,7.3943143218151444e-002,9.1630492980349129e-002,5.8221248727607366e-001,1.2945690260578024e-001,1.8337604887917063e-002,1.0407205171919276e-001,7.3515184422876509e-002,1.2407333278100879e-001,1.0914130628270249e-002
,-2.1348516005472870e-001,6.2936021148878896e-001,5.2312556718824565e-002,4.1935614101209118e-001,1.3410462733398903e-001,8.8760195305734493e-002,1.5087702415577116e-002,2.8940510204401104e-001,1.2119789984022906e-001,2.6619358677851290e-001,3.9475088850340657e-002,6.5790103012251216e-002,2.3638891616766383e-001,1.0707593140594907e-001,3.0806744191249086e-001,5.1148063734140936e-002,9.9437881249323734e-002,1.6392942502362276e-001,2.5882059561934068e-001,1.7919565177899319e-001,2.0581644142714808e-001,1.7531241088227328e-001,6.0634223287570885e-002,6.4821254615763726e-002,2.2298367088305876e-001,2.9657514518882677e-001,3.6725582178973662e-002,1.7034765461067788e-002,1.8518253280132480e-001,2.4746118231256900e-002,3.0989387859627215e-001,1.6385412647436409e-001,3.8011073409296103e-001,1.9885224592781775e-001,8.0218170260087138e-002,1.2609594690001710e-001,2.8089863652519770e-001,1.4264434100172696e-001,5.9756025320716180e-002,1.5923254244394114e-001,6.4250918882886504e-002,1.0379337540859147e-001,3.2159048699609130e-002,2.0825425203039397e-001,2.4558651685510810e-001,3.7968242343394482e-001,2.6312935314828347e-002,7.7608081836744502e-002,4.5547816411773759e-003,2.3460226130715642e-001
,-1.8704124809635572e-001,1.5094223682691099e-001,2.1413024069055087e-001,1.9377487972869831e-001,2.8245656417688003e-001,2.3313577669442054e-001,6.8711654316497761e-001,4.3655624212557254e-002,1.1129243110975527e-001,1.0284281465334887e-001,2.3326057939987913e-001,8.7352121922632919e-002,1.7697212808409288e-001,1.2168527510659589e-001,2.3466696609062418e-001,1.5414278027569547e-001,6.7444461668004690e-002,4.3951595075698197e-001,9.4727955473643960e-003,1.0707666672875539e-002,7.7415770800785585e-002,3.8705650062274069e-002,6.9025642880820276e-002,1.6769714720915394e-001,2.5869812792849300e-001,1.1379929349126933e-002,2.1410729274139698e-001,5.9865233137437572e-002,1.5216287496501160e-001,1.5785845207774155e-001,8.8595603045261373e-002,2.0049447296353365e-001,1.6308667675738259e-001,1.7111004158689880e-001,2.0483767461395075e-001,1.4783820743685377e-001,9.5366323620782872e-002,3.5588288872376625e-002,2.1094490995690648e-001,2.7734401432076550e-001,3.6597918817458558e-001,6.6237759139883348e-002,1.1920675808315893e-001,6.7294086161601235e-002,5.3790917614502890e-003,2.5269144849062775e-001,7.2533856787919751e-002,2.3289752832901667e-001,6.7424186650563697e-002,1.6161114900495702e-001
,-1.0991149188970176e-001,1.6174705020349139e-001,3.1737922020216547e-001,2.1046559092441525e-001,9.6011659352290599e-002,1.0258987733641664e-001,4.6790532058320483e-002,1.9172015382059288e-001,1.6162803718997149e-001,1.4829139914281089e-001,4.1918256564192602e-001,2.5765942209360243e-001,2.7858749764059632e-001,2.4420430179059990e-001,2.7844423570622040e-001,1.0283103448684579e-001,5.5294260795830082e-003,2.7759556458227669e-001,1.6084168174483815e-001,2.0319499663553792e-001,4.1226368999512306e-002,1.9505600014220281e-003,1.8408082624135666e-001,2.2293312859545281e-002,1.8776257917454747e-001,3.2776444560143558e-001,3.2644736688401427e-001,1.6954918936328489e-001,7.0229269607883685e-002,1.5011808470969246e-001,6.8028499626809902e-002,6.3582791303964020e-002,2.9045445093046784e-001,2.2101575739690309e-004,3.0517338311461839e-001,4.3856014451521019e-001,1.5934693843859473e-003,5.0784826786035853e-001,1.4419932660617304e-001,3.4227575429716217e-001,5.7250761016237522e-002,1.9915073866587821e-001,1.3374746741841598e-001,1.2768987096014192e-001,7.7043483343394142e-002,8.9674837194602924e-002,1.7654320377613866e-001,8.4831897099428663e-002,3.1987447271258185e-001,1.3497253849423269e-001
,3.6942570844429329e-001,1.4382386720046228e-001,4.8940873725508212e-002,2.4918534500290684e-001,7.2462920793933364e-002,2.5552296229068957e-002,4.6380947386968595e-002,3.6345021530400251e-001,1.9937113189864331e-001,2.1312826323518713e-001,6.3508561225067803e-002,1.7750716446103415e-001,1.3603243299561529e-001,7.8404294468420149e-002,6.7122810394755011e-002,1.2282166065171997e-001,2.0910905044695646e-001,4.1012272926494814e-002,9.2261729384901583e-002,3.4128798890131790e-002,4.9268001692484348e-001,2.9865285965935240e-001,2.9173333628649006e-001,1.4449263724029127e-001,1.2923172284394374e-001,5.8880352197915702e-002,1.1813721853905966e-001,1.5076046531620274e-001,1.0699996563690162e-001,7.3518742693277392e-002,1.5682149350031338e-001,1.7744898135310497e-001,2.8337848742059391e-001,1.6459989461818320e-001,2.7029716432425493e-001,3.4584165614563817e-001,2.2311960694536978e-001,3.3254873370233515e-002,1.8053329009634689e-001,3.3822052488960269e-001,8.9702225576530153e-002,4.1072116015901278e-001,3.3776250251940677e-002,3.9934157506252753e-002,3.9124009103060881e-001,1.6784749206770661e-001,3.0087303981369212e-001,7.1745669320718072e-003,7.0686785119145645e-001,3.9582481816673877e-002
,5.1153081490006147e-001,2.9869001323114611e-003,3.1895276050061294e-001,1.5440214720804288e-001,9.0637186506600784e-002,1.1900706693910929e-002,5.1399615428756450e-002,2.5859209775982678e-001,2.4608778362827524e-001,1.6505760097640748e-001,3.0524791875323398e-001,1.3691143660733518e-001,1.6913442263525702e-001,4.1124724647447058e-001,2.2101085424825356e-001,6.2882289168942368e-002,4.2667571293082124e-001,3.2269094415117758e-002,2.9333511443849453e-001,1.9019527867219091e-001,3.7948413682339370e-003,7.3610699357048531e-002,1.0405873890447208e-001,3.4868367463642812e-005,1.3012194654289491e-001,5.4861737948663003e-002,1.1682845592655733e-001,6.0690948379585698e-002,9.8774803360560867e-002,1.1889315134013449e-001,3.1763231435240380e-001,2.9199061436175738e-001,1.0892499175846166e-002,2.9421451852527924e-002,3.9813157681094069e-001,4.4793738160395713e-001,4.7705178611217397e-002,1.4778145466810144e-001,2.5297571561486440e-003,9.4437682058037042e-002,2.2564583620531239e-001,2.3040937172954187e-001,5.7433627210036454e-002,7.9880358534228896e-002,2.0518269152079055e-001,1.4870123957140347e-001,1.6467154641793266e-001,3.5199667680895874e-001,1.5767694465606272e-001,2.3619925150926695e-002
}; | [
"[email protected]"
] | |
413cac1d12ddfbd2b863766d5bac83397ad387ea | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/chrome/browser/ui/unload_controller.h | a96ec5d5c2ecc80c5d48a941803b8ca827c83538 | [
"MIT",
"BSD-3-Clause"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 6,865 | h | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
#define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
#include <set>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class Browser;
class TabStripModel;
namespace content {
class NotificationSource;
class NotifictaionDetails;
class WebContents;
}
namespace chrome {
class UnloadController : public content::NotificationObserver,
public TabStripModelObserver {
public:
explicit UnloadController(Browser* browser);
virtual ~UnloadController();
// Returns true if |contents| can be cleanly closed. When |browser_| is being
// closed, this function will return false to indicate |contents| should not
// be cleanly closed, since the fast shutdown path will just kill its
// renderer.
bool CanCloseContents(content::WebContents* contents);
// Returns true if we need to run unload events for the |contents|.
static bool ShouldRunUnloadEventsHelper(content::WebContents* contents);
// Helper function to run beforeunload listeners on a WebContents.
// Returns true if |contents| beforeunload listeners were invoked.
static bool RunUnloadEventsHelper(content::WebContents* contents);
// Called when a BeforeUnload handler is fired for |contents|. |proceed|
// indicates the user's response to the Y/N BeforeUnload handler dialog. If
// this parameter is false, any pending attempt to close the whole browser
// will be canceled. Returns true if Unload handlers should be fired. When the
// |browser_| is being closed, Unload handlers for any particular WebContents
// will not be run until every WebContents being closed has a chance to run
// its BeforeUnloadHandler.
bool BeforeUnloadFired(content::WebContents* contents, bool proceed);
bool is_attempting_to_close_browser() const {
return is_attempting_to_close_browser_;
}
// Called in response to a request to close |browser_|'s window. Returns true
// when there are no remaining beforeunload handlers to be run.
bool ShouldCloseWindow();
// Begins the process of confirming whether the associated browser can be
// closed.
bool CallBeforeUnloadHandlers(
const base::Callback<void(bool)>& on_close_confirmed);
// Clears the results of any beforeunload confirmation dialogs triggered by a
// CallBeforeUnloadHandlers call.
void ResetBeforeUnloadHandlers();
// Returns true if |browser_| has any tabs that have BeforeUnload handlers
// that have not been fired. This method is non-const because it builds a list
// of tabs that need their BeforeUnloadHandlers fired.
// TODO(beng): This seems like it could be private but it is used by
// AreAllBrowsersCloseable() in application_lifetime.cc. It seems
// very similar to ShouldCloseWindow() and some consolidation
// could be pursued.
bool TabsNeedBeforeUnloadFired();
private:
typedef std::set<content::WebContents*> UnloadListenerSet;
// Overridden from content::NotificationObserver:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// Overridden from TabStripModelObserver:
virtual void TabInsertedAt(content::WebContents* contents,
int index,
bool foreground) OVERRIDE;
virtual void TabDetachedAt(content::WebContents* contents,
int index) OVERRIDE;
virtual void TabReplacedAt(TabStripModel* tab_strip_model,
content::WebContents* old_contents,
content::WebContents* new_contents,
int index) OVERRIDE;
virtual void TabStripEmpty() OVERRIDE;
void TabAttachedImpl(content::WebContents* contents);
void TabDetachedImpl(content::WebContents* contents);
// Processes the next tab that needs it's beforeunload/unload event fired.
void ProcessPendingTabs();
// Whether we've completed firing all the tabs' beforeunload/unload events.
bool HasCompletedUnloadProcessing() const;
// Clears all the state associated with processing tabs' beforeunload/unload
// events since the user cancelled closing the window.
void CancelWindowClose();
// Removes |web_contents| from the passed |set|.
// Returns whether the tab was in the set in the first place.
bool RemoveFromSet(UnloadListenerSet* set,
content::WebContents* web_contents);
// Cleans up state appropriately when we are trying to close the browser and
// the tab has finished firing its unload handler. We also use this in the
// cases where a tab crashes or hangs even if the beforeunload/unload haven't
// successfully fired. If |process_now| is true |ProcessPendingTabs| is
// invoked immediately, otherwise it is invoked after a delay (PostTask).
//
// Typically you'll want to pass in true for |process_now|. Passing in true
// may result in deleting |tab|. If you know that shouldn't happen (because of
// the state of the stack), pass in false.
void ClearUnloadState(content::WebContents* web_contents, bool process_now);
bool is_calling_before_unload_handlers() {
return !on_close_confirmed_.is_null();
}
Browser* browser_;
content::NotificationRegistrar registrar_;
// Tracks tabs that need there beforeunload event fired before we can
// close the browser. Only gets populated when we try to close the browser.
UnloadListenerSet tabs_needing_before_unload_fired_;
// Tracks tabs that need there unload event fired before we can
// close the browser. Only gets populated when we try to close the browser.
UnloadListenerSet tabs_needing_unload_fired_;
// Whether we are processing the beforeunload and unload events of each tab
// in preparation for closing the browser. UnloadController owns this state
// rather than Browser because unload handlers are the only reason that a
// Browser window isn't just immediately closed.
bool is_attempting_to_close_browser_;
// A callback to call to report whether the user chose to close all tabs of
// |browser_| that have beforeunload event handlers. This is set only if we
// are currently confirming that the browser is closable.
base::Callback<void(bool)> on_close_confirmed_;
base::WeakPtrFactory<UnloadController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(UnloadController);
};
} // namespace chrome
#endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
| [
"[email protected]"
] | |
b933bfe86d2fad749676aecdbd5ec5b267de159a | a0748011dbe873a6cb0cf3805c0ebdb391f791b0 | /DICOMAnonymizer/dcmtk/dcmtk-3.6.0/oflog/libsrc/factory.cc | a9839ed04b46973b7e2b4c4ba6dc8f68df5fe88c | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"xlock",
"IJG",
"LicenseRef-scancode-other-permissive"
] | permissive | Booritas/covid19-prototype | e0379572661046103e5483632987053eb2a91710 | 8cea8c2064c09863bda42ad067f359b2ba8eabf4 | refs/heads/master | 2022-08-19T19:22:10.008221 | 2020-05-20T15:06:01 | 2020-05-20T15:06:01 | 259,352,221 | 0 | 0 | MIT | 2020-04-27T14:32:07 | 2020-04-27T14:32:06 | null | UTF-8 | C++ | false | false | 5,436 | cc | // Module: Log4CPLUS
// File: factory.cxx
// Created: 2/2002
// Author: Tad E. Smith
//
//
// Copyright 2002-2009 Tad E. Smith
//
// 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 "dcmtk/oflog/spi/factory.h"
#include "dcmtk/oflog/spi/logfact.h"
#include "dcmtk/oflog/consap.h"
#include "dcmtk/oflog/fileap.h"
#include "dcmtk/oflog/nullap.h"
#include "dcmtk/oflog/socketap.h"
#include "dcmtk/oflog/syslogap.h"
#include "dcmtk/oflog/helpers/loglog.h"
#include "dcmtk/oflog/helpers/threads.h"
#if defined (_WIN32)
# if defined (LOG4CPLUS_HAVE_NT_EVENT_LOG)
# include "dcmtk/oflog/ntelogap.h"
# endif
# if defined (LOG4CPLUS_HAVE_WIN32_CONSOLE)
# include "dcmtk/oflog/winconap.h"
# endif
# include "dcmtk/oflog/windebap.h"
#endif
using namespace log4cplus;
using namespace log4cplus::helpers;
using namespace log4cplus::spi;
///////////////////////////////////////////////////////////////////////////////
// LOCAL file class definitions
///////////////////////////////////////////////////////////////////////////////
namespace log4cplus {
namespace spi {
BaseFactory::~BaseFactory()
{ }
AppenderFactory::AppenderFactory()
{ }
AppenderFactory::~AppenderFactory()
{ }
LayoutFactory::LayoutFactory()
{ }
LayoutFactory::~LayoutFactory()
{ }
FilterFactory::FilterFactory()
{ }
FilterFactory::~FilterFactory()
{ }
LoggerFactory::~LoggerFactory()
{ }
} // namespace spi
namespace
{
template <typename ProductFactoryBase>
class LocalFactoryBase
: public ProductFactoryBase
{
public:
LocalFactoryBase (tchar const * n)
: name (n)
{ }
virtual log4cplus::tstring getTypeName()
{
return name;
}
private:
log4cplus::tstring name;
};
template <typename LocalProduct, typename ProductFactoryBase>
class FactoryTempl
: public LocalFactoryBase<ProductFactoryBase>
{
public:
typedef typename ProductFactoryBase::ProductPtr ProductPtr;
FactoryTempl (tchar const * n)
: LocalFactoryBase<ProductFactoryBase> (n)
{ }
virtual ProductPtr createObject (Properties const & props, log4cplus::tstring& error)
{
error.clear();
return ProductPtr (new LocalProduct (props, error));
}
};
} // namespace
#define REG_PRODUCT(reg, productprefix, productname, productns, productfact) \
reg.put ( \
OFauto_ptr<productfact> ( \
new FactoryTempl<productns productname, productfact> ( \
LOG4CPLUS_TEXT(productprefix) \
LOG4CPLUS_TEXT(#productname))))
#define REG_APPENDER(reg, appendername) \
REG_PRODUCT (reg, "log4cplus::", appendername, log4cplus::, AppenderFactory)
#define REG_LAYOUT(reg, layoutname) \
REG_PRODUCT (reg, "log4cplus::", layoutname, log4cplus::, LayoutFactory)
#define REG_FILTER(reg, filtername) \
REG_PRODUCT (reg, "log4cplus::spi::", filtername, spi::, FilterFactory)
void initializeFactoryRegistry()
{
AppenderFactoryRegistry& reg = getAppenderFactoryRegistry();
REG_APPENDER (reg, ConsoleAppender);
REG_APPENDER (reg, NullAppender);
REG_APPENDER (reg, FileAppender);
REG_APPENDER (reg, RollingFileAppender);
REG_APPENDER (reg, DailyRollingFileAppender);
REG_APPENDER (reg, SocketAppender);
#if defined(_WIN32) && !defined(__MINGW32__)
#if defined(LOG4CPLUS_HAVE_NT_EVENT_LOG)
REG_APPENDER (reg, NTEventLogAppender);
# endif
# if defined(LOG4CPLUS_HAVE_WIN32_CONSOLE)
REG_APPENDER (reg, Win32ConsoleAppender);
# endif
REG_APPENDER (reg, Win32DebugAppender);
#elif defined(LOG4CPLUS_HAVE_SYSLOG_H)
REG_APPENDER (reg, SysLogAppender);
#endif // defined(_WIN32) && !defined(__MINGW32__)
LayoutFactoryRegistry& reg2 = getLayoutFactoryRegistry();
REG_LAYOUT (reg2, SimpleLayout);
REG_LAYOUT (reg2, TTCCLayout);
REG_LAYOUT (reg2, PatternLayout);
FilterFactoryRegistry& reg3 = getFilterFactoryRegistry();
REG_FILTER (reg3, DenyAllFilter);
REG_FILTER (reg3, LogLevelMatchFilter);
REG_FILTER (reg3, LogLevelRangeFilter);
REG_FILTER (reg3, StringMatchFilter);
}
///////////////////////////////////////////////////////////////////////////////
// public methods
///////////////////////////////////////////////////////////////////////////////
namespace spi
{
AppenderFactoryRegistry&
getAppenderFactoryRegistry()
{
static AppenderFactoryRegistry singleton;
return singleton;
}
LayoutFactoryRegistry&
getLayoutFactoryRegistry()
{
static LayoutFactoryRegistry singleton;
return singleton;
}
FilterFactoryRegistry&
getFilterFactoryRegistry()
{
static FilterFactoryRegistry singleton;
return singleton;
}
} // namespace spi
} // namespace log4cplus
| [
"[email protected]"
] | |
523a263c85c4f98ea9f5942116155e4a44ad155f | 536656cd89e4fa3a92b5dcab28657d60d1d244bd | /ash/shelf/hotseat_widget_unittest.cc | d7c1bbd3aaba3e5921d5af9ed950ba5d17142de3 | [
"BSD-3-Clause"
] | permissive | ECS-251-W2020/chromium | 79caebf50443f297557d9510620bf8d44a68399a | ac814e85cb870a6b569e184c7a60a70ff3cb19f9 | refs/heads/master | 2022-08-19T17:42:46.887573 | 2020-03-18T06:08:44 | 2020-03-18T06:08:44 | 248,141,336 | 7 | 8 | BSD-3-Clause | 2022-07-06T20:32:48 | 2020-03-18T04:52:18 | null | UTF-8 | C++ | false | false | 80,525 | cc | // Copyright (c) 2020 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 "ash/shelf/hotseat_widget.h"
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/app_list/test/app_list_test_helper.h"
#include "ash/assistant/assistant_controller.h"
#include "ash/focus_cycler.h"
#include "ash/home_screen/drag_window_from_shelf_controller_test_api.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/test/assistant_test_api.h"
#include "ash/public/cpp/test/shell_test_api.h"
#include "ash/shelf/home_button.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_app_button.h"
#include "ash/shelf/shelf_focus_cycler.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_metrics.h"
#include "ash/shelf/shelf_navigation_widget.h"
#include "ash/shelf/shelf_test_util.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shelf/shelf_view_test_api.h"
#include "ash/shelf/test/hotseat_state_watcher.h"
#include "ash/shelf/test/overview_animation_waiter.h"
#include "ash/shelf/test/shelf_layout_manager_test_base.h"
#include "ash/shelf/test/widget_animation_smoothness_inspector.h"
#include "ash/shelf/test/widget_animation_waiter.h"
#include "ash/shell.h"
#include "ash/system/overview/overview_button_tray.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/unified/unified_system_tray.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "ash/wm/window_state.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/assistant/public/mojom/assistant.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#include "ui/events/test/event_generator.h"
#include "ui/wm/core/window_util.h"
namespace ash {
namespace {
ShelfWidget* GetShelfWidget() {
return AshTestBase::GetPrimaryShelf()->shelf_widget();
}
ShelfLayoutManager* GetShelfLayoutManager() {
return AshTestBase::GetPrimaryShelf()->shelf_layout_manager();
}
} // namespace
class HotseatWidgetTest
: public ShelfLayoutManagerTestBase,
public testing::WithParamInterface<
std::tuple<ShelfAutoHideBehavior,
/*is_assistant_enabled*/ bool,
/*navigation_buttons_shown_in_tablet_mode*/ bool>> {
public:
HotseatWidgetTest()
: ShelfLayoutManagerTestBase(
base::test::TaskEnvironment::TimeSource::MOCK_TIME),
shelf_auto_hide_behavior_(std::get<0>(GetParam())),
is_assistant_enabled_(std::get<1>(GetParam())),
navigation_buttons_shown_in_tablet_mode_(std::get<2>(GetParam())) {
if (is_assistant_enabled_)
assistant_test_api_ = AssistantTestApi::Create();
if (navigation_buttons_shown_in_tablet_mode_) {
scoped_feature_list_.InitWithFeatures(
{chromeos::features::kShelfHotseat},
{features::kHideShelfControlsInTabletMode});
} else {
scoped_feature_list_.InitWithFeatures(
{chromeos::features::kShelfHotseat,
features::kHideShelfControlsInTabletMode},
{});
}
}
// testing::Test:
void SetUp() override {
ShelfLayoutManagerTestBase::SetUp();
if (is_assistant_enabled_) {
assistant_test_api_->SetAssistantEnabled(true);
assistant_test_api_->GetAssistantState()->NotifyFeatureAllowed(
mojom::AssistantAllowedState::ALLOWED);
assistant_test_api_->GetAssistantState()->NotifyStatusChanged(
mojom::AssistantState::READY);
assistant_test_api_->WaitUntilIdle();
}
}
ShelfAutoHideBehavior shelf_auto_hide_behavior() const {
return shelf_auto_hide_behavior_;
}
bool is_assistant_enabled() const { return is_assistant_enabled_; }
AssistantTestApi* assistant_test_api() { return assistant_test_api_.get(); }
void ShowShelfAndActivateAssistant() {
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
SwipeUpOnShelf();
// If the launcher button is not expected to be shown, show the assistant UI
// directly; otherwise, simulate the long press on the home button,
if (!navigation_buttons_shown_in_tablet_mode_ &&
Shell::Get()->tablet_mode_controller()->InTabletMode()) {
Shell::Get()->assistant_controller()->ui_controller()->ShowUi(
chromeos::assistant::mojom::AssistantEntryPoint::kLongPressLauncher);
return;
}
views::View* home_button =
GetPrimaryShelf()->navigation_widget()->GetHomeButton();
auto center_point = home_button->GetBoundsInScreen().CenterPoint();
GetEventGenerator()->set_current_screen_location(center_point);
GetEventGenerator()->PressTouch();
GetAppListTestHelper()->WaitUntilIdle();
// Advance clock to make sure long press gesture is triggered.
task_environment_->AdvanceClock(base::TimeDelta::FromSeconds(5));
GetAppListTestHelper()->WaitUntilIdle();
GetEventGenerator()->ReleaseTouch();
GetAppListTestHelper()->WaitUntilIdle();
}
void ShowShelfAndGoHome() {
// If the launcher button is not expected to be shown, go home directly;
// otherwise, simulate tap on the home button,
if (!navigation_buttons_shown_in_tablet_mode_ &&
Shell::Get()->tablet_mode_controller()->InTabletMode()) {
Shell::Get()->home_screen_controller()->GoHome(GetPrimaryDisplay().id());
return;
}
// Ensure the shelf, and the home button, are visible.
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
SwipeUpOnShelf();
views::View* home_button =
GetPrimaryShelf()->navigation_widget()->GetHomeButton();
GetEventGenerator()->GestureTapAt(
home_button->GetBoundsInScreen().CenterPoint());
}
void StartOverview() {
ASSERT_FALSE(Shell::Get()->overview_controller()->InOverviewSession());
// If the overview button is not expected to be shown, start overview
// directly; otherwise, simulate tap on the overview button, which should
// toggle overview.
if (!navigation_buttons_shown_in_tablet_mode_ &&
Shell::Get()->tablet_mode_controller()->InTabletMode()) {
Shell::Get()->overview_controller()->StartOverview();
return;
}
const gfx::Point overview_button_center = GetPrimaryShelf()
->status_area_widget()
->overview_button_tray()
->GetBoundsInScreen()
.CenterPoint();
GetEventGenerator()->GestureTapAt(overview_button_center);
}
void EndOverview() {
ASSERT_TRUE(Shell::Get()->overview_controller()->InOverviewSession());
// If the overview button is not expected to be shown, end overview
// directly; otherwise, simulate tap on the overview button, which should
// toggle overview.
if (!navigation_buttons_shown_in_tablet_mode_ &&
Shell::Get()->tablet_mode_controller()->InTabletMode()) {
Shell::Get()->overview_controller()->EndOverview();
return;
}
const gfx::Point overview_button_center = GetPrimaryShelf()
->status_area_widget()
->overview_button_tray()
->GetBoundsInScreen()
.CenterPoint();
GetEventGenerator()->GestureTapAt(overview_button_center);
}
private:
const ShelfAutoHideBehavior shelf_auto_hide_behavior_;
const bool is_assistant_enabled_;
const bool navigation_buttons_shown_in_tablet_mode_;
std::unique_ptr<AssistantTestApi> assistant_test_api_;
base::test::ScopedFeatureList scoped_feature_list_;
};
// Counts the number of times the work area changes.
class DisplayWorkAreaChangeCounter : public display::DisplayObserver {
public:
DisplayWorkAreaChangeCounter() {
Shell::Get()->display_manager()->AddObserver(this);
}
~DisplayWorkAreaChangeCounter() override {
Shell::Get()->display_manager()->RemoveObserver(this);
}
void OnDisplayMetricsChanged(const display::Display& display,
uint32_t metrics) override {
if (metrics & display::DisplayObserver::DISPLAY_METRIC_WORK_AREA)
work_area_change_count_++;
}
int count() const { return work_area_change_count_; }
private:
int work_area_change_count_ = 0;
DISALLOW_COPY_AND_ASSIGN(DisplayWorkAreaChangeCounter);
};
// Watches the shelf for state changes.
class ShelfStateWatcher : public ShelfObserver {
public:
ShelfStateWatcher() { AshTestBase::GetPrimaryShelf()->AddObserver(this); }
~ShelfStateWatcher() override {
AshTestBase::GetPrimaryShelf()->RemoveObserver(this);
}
void WillChangeVisibilityState(ShelfVisibilityState new_state) override {
state_change_count_++;
}
int state_change_count() const { return state_change_count_; }
private:
int state_change_count_ = 0;
};
// Used to test the Hotseat, ScrollabeShelf, and DenseShelf features.
INSTANTIATE_TEST_SUITE_P(
All,
HotseatWidgetTest,
testing::Combine(testing::Values(ShelfAutoHideBehavior::kNever,
ShelfAutoHideBehavior::kAlways),
testing::Bool(),
testing::Bool()));
TEST_P(HotseatWidgetTest, LongPressHomeWithoutAppWindow) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
GetAppListTestHelper()->CheckVisibility(true);
HotseatStateWatcher watcher(GetShelfLayoutManager());
ShowShelfAndActivateAssistant();
GetAppListTestHelper()->CheckVisibility(true);
EXPECT_EQ(
is_assistant_enabled(),
GetAppListTestHelper()->GetAppListView()->IsShowingEmbeddedAssistantUI());
// Hotseat should not change when showing Assistant.
watcher.CheckEqual({});
}
TEST_P(HotseatWidgetTest, LongPressHomeWithAppWindow) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
GetAppListTestHelper()->CheckVisibility(true);
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
GetAppListTestHelper()->CheckVisibility(false);
HotseatStateWatcher watcher(GetShelfLayoutManager());
ShowShelfAndActivateAssistant();
GetAppListTestHelper()->CheckVisibility(false);
EXPECT_EQ(
is_assistant_enabled(),
GetAppListTestHelper()->GetAppListView()->IsShowingEmbeddedAssistantUI());
std::vector<HotseatState> expected_state;
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
// |ShowShelfAndActivateAssistant()| will bring up shelf so it will trigger
// one hotseat state change.
expected_state.push_back(HotseatState::kExtended);
}
watcher.CheckEqual(expected_state);
}
// Tests that closing a window which was opened prior to entering tablet mode
// results in a kShown hotseat.
TEST_P(HotseatWidgetTest, ClosingLastWindowInTabletMode) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
// Activate the window and go to tablet mode.
wm::ActivateWindow(window.get());
TabletModeControllerTestApi().EnterTabletMode();
// Close the window, the AppListView should be shown, and the hotseat should
// be kShown.
window->Hide();
EXPECT_EQ(HotseatState::kShown, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(true);
}
// Tests that the hotseat is kShown when entering tablet mode with no windows.
TEST_P(HotseatWidgetTest, GoingToTabletModeNoWindows) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
GetAppListTestHelper()->CheckVisibility(true);
EXPECT_EQ(HotseatState::kShown, GetShelfLayoutManager()->hotseat_state());
}
// Tests that the hotseat is kHidden when entering tablet mode with a window.
TEST_P(HotseatWidgetTest, GoingToTabletModeWithWindows) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
// Activate the window and go to tablet mode.
wm::ActivateWindow(window.get());
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(false);
}
// The in-app Hotseat should not be hidden automatically when the shelf context
// menu shows (https://crbug.com/1020388).
TEST_P(HotseatWidgetTest, InAppShelfShowingContextMenu) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
EXPECT_FALSE(Shell::Get()->app_list_controller()->IsVisible());
ShelfTestUtil::AddAppShortcut("app_id", TYPE_PINNED_APP);
// Swipe up on the shelf to show the hotseat.
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
ShelfViewTestAPI shelf_view_test_api(
GetPrimaryShelf()->shelf_widget()->shelf_view_for_testing());
ShelfAppButton* app_icon = shelf_view_test_api.GetButton(0);
// Accelerate the generation of the long press event.
ui::GestureConfiguration::GetInstance()->set_show_press_delay_in_ms(1);
ui::GestureConfiguration::GetInstance()->set_long_press_time_in_ms(1);
// Press the icon enough long time to generate the long press event.
GetEventGenerator()->MoveTouch(app_icon->GetBoundsInScreen().CenterPoint());
GetEventGenerator()->PressTouch();
ui::GestureConfiguration* gesture_config =
ui::GestureConfiguration::GetInstance();
const int long_press_delay_ms = gesture_config->long_press_time_in_ms() +
gesture_config->show_press_delay_in_ms();
base::RunLoop run_loop;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(),
base::TimeDelta::FromMilliseconds(long_press_delay_ms));
run_loop.Run();
GetEventGenerator()->ReleaseTouch();
// Expects that the hotseat's state is kExntended.
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Ensures that the ink drop state is InkDropState::ACTIVATED before closing
// the menu.
app_icon->FireRippleActivationTimerForTest();
}
// Tests that a window that is created after going to tablet mode, then closed,
// results in a kShown hotseat.
TEST_P(HotseatWidgetTest, CloseLastWindowOpenedInTabletMode) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
// Activate the window after entering tablet mode.
wm::ActivateWindow(window.get());
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(false);
// Hide the window, the hotseat should be kShown, and the home launcher should
// be visible.
window->Hide();
EXPECT_EQ(HotseatState::kShown, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(true);
}
// Tests that swiping up on an autohidden shelf shows the hotseat, and swiping
// down hides it.
TEST_P(HotseatWidgetTest, ShowingAndHidingAutohiddenShelf) {
if (shelf_auto_hide_behavior() != ShelfAutoHideBehavior::kAlways)
return;
GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
SwipeDownOnShelf();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
// Swipe down again, nothing should change.
SwipeDownOnShelf();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
}
// Tests that swiping up on several places in the in-app shelf shows the
// hotseat (crbug.com/1016931).
TEST_P(HotseatWidgetTest, SwipeUpInAppShelfShowsHotseat) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
// Swipe up from the center of the shelf.
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
// Swipe down from the hotseat to hide it.
gfx::Rect hotseat_bounds =
GetPrimaryShelf()->hotseat_widget()->GetWindowBoundsInScreen();
gfx::Point start = hotseat_bounds.top_center();
gfx::Point end = start + gfx::Vector2d(0, 80);
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(100);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
ASSERT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 1);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
// Swipe up from the right part of the shelf (the system tray).
start = GetShelfWidget()
->status_area_widget()
->GetWindowBoundsInScreen()
.CenterPoint();
end = start + gfx::Vector2d(0, -80);
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 1);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 2);
// Swipe down from the hotseat to hide it.
start = hotseat_bounds.top_center();
end = start + gfx::Vector2d(0, 80);
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
ASSERT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 2);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 2);
// Swipe up from the left part of the shelf (the home/back button).
start = GetShelfWidget()
->navigation_widget()
->GetWindowBoundsInScreen()
.CenterPoint();
end = start + gfx::Vector2d(0, -80);
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 2);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 3);
}
// Tests that swiping up on the hotseat does nothing.
TEST_P(HotseatWidgetTest, SwipeUpOnHotseatBackgroundDoesNothing) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
// Swipe up on the shelf to show the hotseat.
EXPECT_FALSE(Shell::Get()->app_list_controller()->IsVisible());
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
// Swipe up on the Hotseat (parent of ShelfView) does nothing.
gfx::Point start(GetPrimaryShelf()
->shelf_widget()
->hotseat_widget()
->GetWindowBoundsInScreen()
.top_center());
const gfx::Point end(start + gfx::Vector2d(0, -300));
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(100);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_FALSE(Shell::Get()->app_list_controller()->IsVisible());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
}
// Tests that tapping an active window with an extended hotseat results in a
// hidden hotseat.
TEST_P(HotseatWidgetTest, TappingActiveWindowHidesHotseat) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
histogram_tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf, 0);
// Swipe up on the shelf to show the hotseat.
SwipeUpOnShelf();
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
histogram_tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf, 0);
// Tap the shelf background, nothing should happen.
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
gfx::Point tap_point = display_bounds.bottom_center();
GetEventGenerator()->GestureTapAt(tap_point);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
// Tap the active window, the hotseat should hide.
tap_point.Offset(0, -200);
GetEventGenerator()->GestureTapAt(tap_point);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
histogram_tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf, 1);
}
// Tests that gesture dragging an active window hides the hotseat.
TEST_P(HotseatWidgetTest, GestureDraggingActiveWindowHidesHotseat) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
// Swipe up on the shelf to show the hotseat.
SwipeUpOnShelf();
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
// Gesture drag on the active window, the hotseat should hide.
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
gfx::Point start = display_bounds.bottom_center();
start.Offset(0, -200);
gfx::Point end = start;
end.Offset(0, -200);
GetEventGenerator()->GestureScrollSequence(
start, end, base::TimeDelta::FromMilliseconds(10), 4);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
}
// Tests that a swipe up on the shelf shows the hotseat while in split view.
TEST_P(HotseatWidgetTest, SwipeUpOnShelfShowsHotseatInSplitView) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
// Go into split view mode by first going into overview, and then snapping
// the open window on one side.
OverviewController* overview_controller = Shell::Get()->overview_controller();
overview_controller->StartOverview();
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
split_view_controller->SnapWindow(window.get(), SplitViewController::LEFT);
EXPECT_TRUE(split_view_controller->InSplitViewMode());
// We should still be able to drag up the hotseat.
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
}
// Tests that releasing the hotseat gesture below the threshold results in a
// kHidden hotseat when the shelf is shown.
TEST_P(HotseatWidgetTest, ReleasingSlowDragBelowThreshold) {
GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kNever);
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
const gfx::Point start(display_bounds.bottom_center());
const int hotseat_size = GetPrimaryShelf()
->shelf_widget()
->hotseat_widget()
->GetWindowBoundsInScreen()
.height();
const gfx::Point end(start + gfx::Vector2d(0, -hotseat_size / 2 + 1));
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(1000);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
}
// Tests that releasing the hotseat gesture above the threshold results in a
// kExtended hotseat.
TEST_P(HotseatWidgetTest, ReleasingSlowDragAboveThreshold) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
const gfx::Point start(display_bounds.bottom_center());
const int hotseat_size = GetPrimaryShelf()
->shelf_widget()
->hotseat_widget()
->GetWindowBoundsInScreen()
.height();
const gfx::Point end(start + gfx::Vector2d(0, -hotseat_size * 3.0f / 2.0f));
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(1000);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeDownToHide, 0);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
}
// Tests that showing overview after showing the hotseat results in only one
// animation, to |kExtended|.
TEST_P(HotseatWidgetTest, ShowingOverviewFromShownAnimatesOnce) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
std::unique_ptr<HotseatStateWatcher> state_watcher_ =
std::make_unique<HotseatStateWatcher>(GetShelfLayoutManager());
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
StartOverview();
state_watcher_->CheckEqual({HotseatState::kExtended});
}
// Tests that the hotseat is not flush with the bottom of the screen when home
// launcher is showing.
TEST_P(HotseatWidgetTest, HotseatNotFlushWhenHomeLauncherShowing) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
const int display_height =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds().height();
const int hotseat_bottom = GetPrimaryShelf()
->shelf_widget()
->hotseat_widget()
->GetWindowBoundsInScreen()
.bottom();
EXPECT_LT(hotseat_bottom, display_height);
}
// Tests that home -> overview results in only one hotseat state change.
TEST_P(HotseatWidgetTest, HomeToOverviewChangesStateOnce) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
// First, try with no windows open.
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
OverviewAnimationWaiter waiter;
StartOverview();
waiter.Wait();
watcher.CheckEqual({HotseatState::kExtended});
}
// Open a window, then open the home launcher.
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ShowShelfAndGoHome();
GetAppListTestHelper()->CheckVisibility(true);
// Activate overview and expect the hotseat only changes state to extended.
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
OverviewAnimationWaiter waiter;
StartOverview();
waiter.Wait();
watcher.CheckEqual({HotseatState::kExtended});
}
}
// Tests that home -> in-app results in only one state change.
TEST_P(HotseatWidgetTest, HomeToInAppChangesStateOnce) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
// Go to in-app, the hotseat should hide.
HotseatStateWatcher watcher(GetShelfLayoutManager());
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
watcher.CheckEqual({HotseatState::kHidden});
}
// Tests that in-app -> home via closing the only window, swiping from the
// bottom of the shelf, and tapping the home launcher button results in only one
// state change.
TEST_P(HotseatWidgetTest, InAppToHomeChangesStateOnce) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
// Go to in-app with an extended hotseat.
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
// Press the home button, the hotseat should transition directly to kShown.
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
ShowShelfAndGoHome();
watcher.CheckEqual({HotseatState::kShown});
}
// Go to in-app.
window->Show();
wm::ActivateWindow(window.get());
// Extend the hotseat, then Swipe up to go home, the hotseat should transition
// directly to kShown.
SwipeUpOnShelf();
{
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
HotseatStateWatcher watcher(GetShelfLayoutManager());
FlingUpOnShelf();
watcher.CheckEqual({HotseatState::kShown});
// Wait for the window animation to complete, and verify the hotseat state
// remained kShown.
ShellTestApi().WaitForWindowFinishAnimating(window.get());
watcher.CheckEqual({HotseatState::kShown});
}
// Nothing left to test for autohidden shelf.
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
return;
// Go to in-app and do not extend the hotseat.
window->Show();
wm::ActivateWindow(window.get());
// Press the home button, the hotseat should transition directly to kShown.
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
ShowShelfAndGoHome();
watcher.CheckEqual({HotseatState::kShown});
}
}
// Tests that transitioning from overview to home while a transition from home
// to overview is still in progress ends up with hotseat in kShown state (and in
// app shelf not visible).
TEST_P(HotseatWidgetTest, HomeToOverviewAndBack) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
WindowState::Get(window.get())->Minimize();
// Start going to overview - hotseat should transition to extended state.
HotseatStateWatcher watcher(GetShelfLayoutManager());
{
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
StartOverview();
watcher.CheckEqual({HotseatState::kExtended});
}
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_TRUE(overview_controller->InOverviewSession());
ShowShelfAndGoHome();
GetAppListTestHelper()->CheckVisibility(true);
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_FALSE(ShelfConfig::Get()->is_in_app());
watcher.CheckEqual({HotseatState::kExtended, HotseatState::kShown});
}
TEST_P(HotseatWidgetTest, InAppToOverviewAndBack) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// Start watching hotseat state before swipping up the shelf, so hotseat
// change expectation match for both auto-hidden and always-shown shelf.
HotseatStateWatcher watcher(GetShelfLayoutManager());
// Make sure shelf (and overview button) are visible - this is moves the
// hotseat into kExtended state.
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
SwipeUpOnShelf();
// Start going to overview - use non zero animation so transition is not
// immediate.
{
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
StartOverview();
}
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_TRUE(overview_controller->InOverviewSession());
GetAppListTestHelper()->CheckVisibility(false);
// Hotseat should be extended as overview is starting.
watcher.CheckEqual({HotseatState::kExtended});
// Exit overview to go back to the app window.
EndOverview();
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_TRUE(ShelfConfig::Get()->is_in_app());
// The hotseat is expected to be hidden.
watcher.CheckEqual({HotseatState::kExtended, HotseatState::kHidden});
}
// Tests transition to home screen initiated while transition from app window to
// overview is in progress.
TEST_P(HotseatWidgetTest, ShowShelfAndGoHomeDuringInAppToOverviewTransition) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// Start watching hotseat state before swipping up the shelf, so hotseat
// change expectation match for both auto-hidden and always-shown shelf.
HotseatStateWatcher watcher(GetShelfLayoutManager());
// Make sure shelf (and overview button) are visible - this is moves the
// hotseat into kExtended state.
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways)
SwipeUpOnShelf();
// Start going to overview - use non zero animation so transition is not
// immediate.
{
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
StartOverview();
}
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_TRUE(overview_controller->InOverviewSession());
GetAppListTestHelper()->CheckVisibility(false);
// Hotseat should be extended as overview is starting.
watcher.CheckEqual({HotseatState::kExtended});
// Go home - expect transition to home (with hotseat in kShown
// state, and in app shelf hidden).
ShowShelfAndGoHome();
GetAppListTestHelper()->CheckVisibility(true);
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_FALSE(ShelfConfig::Get()->is_in_app());
watcher.CheckEqual({HotseatState::kExtended, HotseatState::kShown});
}
// Tests that in-app -> overview results in only one state change with an
// autohidden shelf.
TEST_P(HotseatWidgetTest, InAppToOverviewChangesStateOnceAutohiddenShelf) {
GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
TabletModeControllerTestApi().EnterTabletMode();
// Test going to overview mode using the controller from an autohide hidden
// shelf. Go to in-app.
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
// Enter overview by using the controller.
OverviewAnimationWaiter waiter;
Shell::Get()->overview_controller()->StartOverview();
waiter.Wait();
watcher.CheckEqual({HotseatState::kExtended});
}
{
OverviewAnimationWaiter waiter;
Shell::Get()->overview_controller()->EndOverview();
waiter.Wait();
}
// Test in-app -> overview again with the autohide shown shelf.
EXPECT_TRUE(ShelfConfig::Get()->is_in_app());
EXPECT_EQ(ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN,
GetShelfLayoutManager()->auto_hide_state());
SwipeUpOnShelf();
{
HotseatStateWatcher watcher(GetShelfLayoutManager());
// Enter overview by using the controller.
OverviewAnimationWaiter waiter;
Shell::Get()->overview_controller()->StartOverview();
waiter.Wait();
watcher.CheckEqual({});
EXPECT_EQ(HotseatState::kExtended,
GetShelfLayoutManager()->hotseat_state());
}
}
// Tests that going between Applist and overview in tablet mode with no windows
// results in no work area change.
TEST_P(HotseatWidgetTest,
WorkAreaDoesNotUpdateAppListToFromOverviewWithNoWindow) {
TabletModeControllerTestApi().EnterTabletMode();
DisplayWorkAreaChangeCounter counter;
{
OverviewAnimationWaiter waiter;
Shell::Get()->overview_controller()->StartOverview();
waiter.Wait();
}
EXPECT_EQ(0, counter.count());
{
OverviewAnimationWaiter waiter;
Shell::Get()->overview_controller()->EndOverview();
waiter.Wait();
}
EXPECT_EQ(0, counter.count());
}
// Tests that switching between AppList and overview with a window results in no
// work area change.
TEST_P(HotseatWidgetTest,
WorkAreaDoesNotUpdateAppListToFromOverviewWithWindow) {
DisplayWorkAreaChangeCounter counter;
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ASSERT_EQ(1, counter.count());
ShowShelfAndGoHome();
{
OverviewAnimationWaiter waiter;
StartOverview();
waiter.Wait();
}
EXPECT_EQ(1, counter.count());
{
OverviewAnimationWaiter waiter;
EndOverview();
waiter.Wait();
}
EXPECT_EQ(1, counter.count());
}
// Tests that switching between AppList and an active window does not update the
// work area.
TEST_P(HotseatWidgetTest, WorkAreaDoesNotUpdateOpenWindowToFromAppList) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ASSERT_TRUE(ShelfConfig::Get()->is_in_app());
// Go to the home launcher, work area should not update.
DisplayWorkAreaChangeCounter counter;
ShowShelfAndGoHome();
GetAppListTestHelper()->CheckVisibility(true);
EXPECT_EQ(0, counter.count());
// Go back to the window, work area should not update.
wm::ActivateWindow(window.get());
EXPECT_TRUE(ShelfConfig::Get()->is_in_app());
EXPECT_EQ(0, counter.count());
}
// Tests that switching between overview and an active window does not update
// the work area.
TEST_P(HotseatWidgetTest, WorkAreaDoesNotUpdateOpenWindowToFromOverview) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ASSERT_TRUE(ShelfConfig::Get()->is_in_app());
// Go to overview, there should not be a work area update.
DisplayWorkAreaChangeCounter counter;
{
OverviewAnimationWaiter waiter;
StartOverview();
waiter.Wait();
}
EXPECT_EQ(0, counter.count());
// Go back to the app, there should not be a work area update.
wm::ActivateWindow(window.get());
EXPECT_TRUE(ShelfConfig::Get()->is_in_app());
EXPECT_EQ(0, counter.count());
}
// Tests that the shelf opaque background is properly updated after a tablet
// mode transition with no apps.
TEST_P(HotseatWidgetTest, ShelfBackgroundNotVisibleInTabletModeNoApps) {
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_FALSE(GetShelfWidget()->GetOpaqueBackground()->visible());
}
// Tests that the shelf opaque background is properly updated after a tablet
// mode transition with no apps with dense shelf.
TEST_P(HotseatWidgetTest, DenseShelfBackgroundNotVisibleInTabletModeNoApps) {
UpdateDisplay("300x1000");
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_FALSE(GetShelfWidget()->GetOpaqueBackground()->visible());
}
// Tests that the hotseat is extended if focused with a keyboard.
TEST_P(HotseatWidgetTest, ExtendHotseatIfFocusedWithKeyboard) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ASSERT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Focus the shelf. Hotseat should now show extended.
GetPrimaryShelf()->shelf_focus_cycler()->FocusShelf(false /* last_element */);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Focus the status area. Hotseat should now hide, as it was
// automatically extended by focusing it.
GetPrimaryShelf()->shelf_focus_cycler()->FocusStatusArea(
false /* last_element */);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Now swipe up to show the shelf and then focus it with the keyboard. Hotseat
// should keep extended.
SwipeUpOnShelf();
GetPrimaryShelf()->shelf_focus_cycler()->FocusShelf(false /* last_element */);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Now focus the status area widget again. Hotseat should remain shown, as it
// was manually extended.
GetPrimaryShelf()->shelf_focus_cycler()->FocusStatusArea(
false /* last_element */);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
}
// Tests that if the hotseat was hidden while being focused, doing a traversal
// focus on the next element brings it up again.
TEST_P(HotseatWidgetTest, SwipeDownOnFocusedHotseat) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
ShelfTestUtil::AddAppShortcut("app_id_1", TYPE_APP);
ShelfTestUtil::AddAppShortcut("app_id_2", TYPE_APP);
ASSERT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Focus the shelf, then swipe down on the shelf to hide it. Hotseat should be
// hidden.
GetPrimaryShelf()->shelf_focus_cycler()->FocusShelf(false /* last_element */);
gfx::Rect hotseat_bounds =
GetPrimaryShelf()->hotseat_widget()->GetWindowBoundsInScreen();
gfx::Point start = hotseat_bounds.top_center();
gfx::Point end = start + gfx::Vector2d(0, 80);
GetEventGenerator()->GestureScrollSequence(
start, end, base::TimeDelta::FromMilliseconds(100), 4 /*scroll_steps*/);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Focus to the next element in the hotseat. The hotseat should show again.
GetEventGenerator()->PressKey(ui::VKEY_TAB, 0);
GetEventGenerator()->ReleaseKey(ui::VKEY_TAB, 0);
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
}
// Tests that in overview, we can still exit by clicking on the hotseat if the
// point is not on the visible area.
TEST_P(HotseatWidgetTest, ExitOverviewWithClickOnHotseat) {
std::unique_ptr<aura::Window> window1 = AshTestBase::CreateTestWindow();
ShelfTestUtil::AddAppShortcut("app_id_1", TYPE_APP);
TabletModeControllerTestApi().EnterTabletMode();
ASSERT_TRUE(TabletModeControllerTestApi().IsTabletModeStarted());
ASSERT_FALSE(WindowState::Get(window1.get())->IsMinimized());
// Enter overview, hotseat is visible. Choose the point to the farthest left.
// This point will not be visible.
auto* overview_controller = Shell::Get()->overview_controller();
auto* hotseat_widget = GetPrimaryShelf()->hotseat_widget();
overview_controller->StartOverview();
ASSERT_TRUE(overview_controller->InOverviewSession());
ASSERT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
gfx::Point far_left_point =
hotseat_widget->GetWindowBoundsInScreen().left_center();
// Tests that on clicking, we exit overview and all windows are minimized.
GetEventGenerator()->set_current_screen_location(far_left_point);
GetEventGenerator()->ClickLeftButton();
EXPECT_EQ(HotseatState::kShown, GetShelfLayoutManager()->hotseat_state());
EXPECT_TRUE(WindowState::Get(window1.get())->IsMinimized());
EXPECT_FALSE(overview_controller->InOverviewSession());
}
// Hides the hotseat if the hotseat is in kExtendedMode and the system tray
// is about to show (see https://crbug.com/1028321).
TEST_P(HotseatWidgetTest, DismissHotseatWhenSystemTrayShows) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Activates the system tray when hotseat is in kExtended mode and waits for
// the update in system tray to finish.
StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget();
const gfx::Point status_area_widget_center =
status_area_widget->GetNativeView()->GetBoundsInScreen().CenterPoint();
GetEventGenerator()->GestureTapAt(status_area_widget_center);
base::RunLoop().RunUntilIdle();
// Expects that the system tray shows and the hotseat is hidden.
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
EXPECT_TRUE(status_area_widget->unified_system_tray()->IsBubbleShown());
// Early out since the remaining code is only meaningful for auto-hide shelf.
if (GetPrimaryShelf()->auto_hide_behavior() !=
ShelfAutoHideBehavior::kAlways) {
return;
}
// Auto-hide shelf should show when opening the system tray.
EXPECT_EQ(ShelfAutoHideState::SHELF_AUTO_HIDE_SHOWN,
GetShelfLayoutManager()->auto_hide_state());
// Auto-hide shelf should hide when closing the system tray.
GetEventGenerator()->GestureTapAt(status_area_widget_center);
// Waits for the system tray to be closed.
base::RunLoop().RunUntilIdle();
EXPECT_EQ(ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN,
GetShelfLayoutManager()->auto_hide_state());
}
// Tests that the work area updates once each when going to/from tablet mode
// with no windows open.
TEST_P(HotseatWidgetTest, WorkAreaUpdatesClamshellToFromHomeLauncherNoWindows) {
DisplayWorkAreaChangeCounter counter;
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_EQ(1, counter.count());
TabletModeControllerTestApi().LeaveTabletMode();
EXPECT_EQ(2, counter.count());
}
// Tests that the work area changes just once when opening a window in tablet
// mode.
TEST_P(HotseatWidgetTest, OpenWindowInTabletModeChangesWorkArea) {
DisplayWorkAreaChangeCounter counter;
TabletModeControllerTestApi().EnterTabletMode();
ASSERT_EQ(1, counter.count());
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
EXPECT_EQ(1, counter.count());
}
// Tests that going to and from tablet mode with an open window results in a
// work area change.
TEST_P(HotseatWidgetTest, ToFromTabletModeWithWindowChangesWorkArea) {
DisplayWorkAreaChangeCounter counter;
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_EQ(1, counter.count());
TabletModeControllerTestApi().LeaveTabletMode();
EXPECT_EQ(2, counter.count());
}
// Tests that the hotseat is flush with the bottom of the screen when in
// clamshell mode and the shelf is oriented on the bottom.
TEST_P(HotseatWidgetTest, HotseatFlushWithScreenBottomInClamshell) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
const int display_height =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds().height();
const int hotseat_bottom = GetPrimaryShelf()
->shelf_widget()
->hotseat_widget()
->GetWindowBoundsInScreen()
.bottom();
EXPECT_EQ(hotseat_bottom, display_height);
}
// Tests that when hotseat and drag-window-to-overview features are both
// enabled, HomeLauncherGestureHandler can receive and process events properly.
TEST_P(HotseatWidgetTest, DragActiveWindowInTabletMode) {
base::test::ScopedFeatureList scoped_features;
scoped_features.InitAndEnableFeature(
features::kDragFromShelfToHomeOrOverview);
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// Swipe up to bring up the hotseat first.
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Now swipe up again to start drag the active window.
ui::test::EventGenerator* generator = GetEventGenerator();
const gfx::Rect bottom_shelf_bounds =
GetShelfWidget()->GetWindowBoundsInScreen();
generator->MoveMouseTo(bottom_shelf_bounds.CenterPoint());
generator->PressTouch();
EXPECT_TRUE(window->layer()->transform().IsIdentity());
// Drag upward, test the window transform changes.
const gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
generator->MoveTouch(display_bounds.CenterPoint());
const gfx::Transform upward_transform = window->layer()->transform();
EXPECT_FALSE(upward_transform.IsIdentity());
// Drag downwad, test the window tranfrom changes.
generator->MoveTouch(display_bounds.bottom_center());
const gfx::Transform downward_transform = window->layer()->transform();
EXPECT_NE(upward_transform, downward_transform);
generator->ReleaseTouch();
EXPECT_TRUE(window->layer()->transform().IsIdentity());
}
// Tests that when hotseat and drag-window-to-overview features are both
// enabled, hotseat is not extended after dragging a window to overview, and
// then activating the window.
TEST_P(HotseatWidgetTest, ExitingOvervieHidesHotseat) {
base::test::ScopedFeatureList scoped_features;
scoped_features.InitAndEnableFeature(
features::kDragFromShelfToHomeOrOverview);
const ShelfAutoHideBehavior auto_hide_behavior = shelf_auto_hide_behavior();
GetPrimaryShelf()->SetAutoHideBehavior(auto_hide_behavior);
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// If the shelf is auto-hidden, swipe up to bring up shelf and hotseat first
// (otherwise, the window drag to overview will not be handled).
if (auto_hide_behavior == ShelfAutoHideBehavior::kAlways) {
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended,
GetShelfLayoutManager()->hotseat_state());
}
// Swipe up to start dragging the active window.
const gfx::Rect bottom_shelf_bounds =
GetShelfWidget()->GetWindowBoundsInScreen();
StartScroll(bottom_shelf_bounds.CenterPoint());
// Drag upward, to the center of the screen, and release (this should enter
// the overview).
const gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
UpdateScroll(display_bounds.CenterPoint().y() -
bottom_shelf_bounds.CenterPoint().y());
// Small scroll update, to simulate the user holding the pointer.
UpdateScroll(2);
DragWindowFromShelfController* window_drag_controller =
GetShelfLayoutManager()->window_drag_controller_for_testing();
ASSERT_TRUE(window_drag_controller);
DragWindowFromShelfControllerTestApi test_api;
test_api.WaitUntilOverviewIsShown(window_drag_controller);
EndScroll(/*is_fling=*/false, 0.f);
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
EXPECT_TRUE(overview_controller->InOverviewSession());
// Activate the window - the overview session should exit, and hotseat should
// be hidden.
wm::ActivateWindow(window.get());
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
}
// Tests that failing to drag the maximized window to overview mode results in
// an extended hotseat.
TEST_P(HotseatWidgetTest, FailingOverviewDragResultsInExtendedHotseat) {
base::test::ScopedFeatureList scoped_features;
scoped_features.InitAndEnableFeature(
features::kDragFromShelfToHomeOrOverview);
const ShelfAutoHideBehavior auto_hide_behavior = shelf_auto_hide_behavior();
GetPrimaryShelf()->SetAutoHideBehavior(auto_hide_behavior);
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// If the shelf is auto-hidden, swipe up to bring up shelf and hotseat first
// (otherwise, the window drag to overview will not be handled).
if (auto_hide_behavior == ShelfAutoHideBehavior::kAlways) {
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended,
GetShelfLayoutManager()->hotseat_state());
}
// Swipe up to start dragging the active window.
const gfx::Rect bottom_shelf_bounds =
GetShelfWidget()->GetWindowBoundsInScreen();
StartScroll(bottom_shelf_bounds.top_center());
// Drag upward, a bit past the hotseat extended height but not enough to go to
// overview.
const int extended_hotseat_distance_from_top_of_shelf =
ShelfConfig::Get()->hotseat_bottom_padding() +
ShelfConfig::Get()->hotseat_size();
UpdateScroll(-extended_hotseat_distance_from_top_of_shelf - 30);
EndScroll(/*is_fling=*/false, 0.f);
ASSERT_FALSE(Shell::Get()->overview_controller()->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
}
// Tests that hotseat remains in extended state while in overview mode when
// flinging the shelf up or down.
TEST_P(HotseatWidgetTest, SwipeOnHotseatInOverview) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
OverviewController* overview_controller = Shell::Get()->overview_controller();
overview_controller->StartOverview();
Shelf* const shelf = GetPrimaryShelf();
SwipeUpOnShelf();
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
// Drag from the hotseat to the bezel, the hotseat should remain in extended
// state.
DragHotseatDownToBezel();
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
SwipeUpOnShelf();
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
}
TEST_P(HotseatWidgetTest, SwipeOnHotseatInSplitViewWithOverview) {
Shelf* const shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
OverviewController* overview_controller = Shell::Get()->overview_controller();
overview_controller->StartOverview();
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
split_view_controller->SnapWindow(window.get(), SplitViewController::LEFT);
SwipeUpOnShelf();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
DragHotseatDownToBezel();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
SwipeUpOnShelf();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_TRUE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
}
TEST_P(HotseatWidgetTest, SwipeOnHotseatInSplitView) {
Shelf* const shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window1 =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
std::unique_ptr<aura::Window> window2 =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window1.get());
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
split_view_controller->SnapWindow(window1.get(), SplitViewController::LEFT);
split_view_controller->SnapWindow(window2.get(), SplitViewController::RIGHT);
EXPECT_TRUE(split_view_controller->InSplitViewMode());
SwipeUpOnShelf();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
DragHotseatDownToBezel();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
SwipeUpOnShelf();
EXPECT_TRUE(split_view_controller->InSplitViewMode());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
if (shelf_auto_hide_behavior() == ShelfAutoHideBehavior::kAlways) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} else {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
}
// Tests that swiping downward, towards the bezel, from a variety of points
// results in hiding the hotseat.
TEST_P(HotseatWidgetTest, HotseatHidesWhenSwipedToBezel) {
// Go to in-app shelf and extend the hotseat.
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
// Drag from the hotseat to the bezel, the hotseat should hide.
DragHotseatDownToBezel();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Reset the hotseat and swipe from the center of the hotseat, it should hide.
SwipeUpOnShelf();
gfx::Rect shelf_widget_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
gfx::Rect hotseat_bounds =
GetPrimaryShelf()->hotseat_widget()->GetWindowBoundsInScreen();
gfx::Point start = hotseat_bounds.CenterPoint();
const gfx::Point end =
gfx::Point(shelf_widget_bounds.x() + shelf_widget_bounds.width() / 2,
shelf_widget_bounds.bottom() + 1);
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(100);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Reset the hotseat and swipe from the bottom of the hotseat, it should hide.
SwipeUpOnShelf();
start = hotseat_bounds.bottom_center();
start.Offset(0, -1);
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Reset the hotseat and swipe from the center of the in-app shelf, it should
// hide.
SwipeUpOnShelf();
start = shelf_widget_bounds.CenterPoint();
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Reset the hotseat and swipe from the bottom of the in-app shelf, it should
// hide.
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
start = shelf_widget_bounds.bottom_center();
// The first few events which get sent to ShelfLayoutManager are
// ui::ET_TAP_DOWN, and ui::ET_GESTURE_START. After a few px we get
// ui::ET_GESTURE_SCROLL_UPDATE. Add 6 px of slop to get the first events out
// of the way, and 1 extra px to ensure we are not on the bottom edge of the
// display.
start.Offset(0, -7);
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
}
// Tests that flinging up the in-app shelf should show the hotseat.
TEST_P(HotseatWidgetTest, FlingUpHotseatWithShortFling) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
GetAppListTestHelper()->CheckVisibility(false);
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 0);
// Scrolls the hotseat by a distance not sufficuent to trigger the action of
// entering home screen from the in-app shelf.
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
const gfx::Point start(display_bounds.bottom_center());
const gfx::Point end(start + gfx::Vector2d(0, -20));
const int fling_speed =
DragWindowFromShelfController::kVelocityToHomeScreenThreshold + 1;
const int scroll_steps = 20;
base::TimeDelta scroll_time =
GetEventGenerator()->CalculateScrollDurationForFlingVelocity(
start, end, fling_speed, scroll_steps);
GetEventGenerator()->GestureScrollSequence(start, end, scroll_time,
scroll_steps);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(false);
histogram_tester.ExpectBucketCount(kHotseatGestureHistogramName,
InAppShelfGestures::kSwipeUpToShow, 1);
}
// Tests that flinging up the in-app shelf should show the home launcher if the
// gesture distance is long enough.
TEST_P(HotseatWidgetTest, FlingUpHotseatWithLongFling) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
GetAppListTestHelper()->CheckVisibility(false);
base::HistogramTester histogram_tester;
histogram_tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kFlingUpToShowHomeScreen, 0);
// Scrolls the hotseat by the sufficient distance to trigger the action of
// entering home screen from the in-app shelf.
gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
const gfx::Point start(display_bounds.bottom_center());
const gfx::Point end(start + gfx::Vector2d(0, -200));
const int fling_speed =
DragWindowFromShelfController::kVelocityToHomeScreenThreshold + 1;
const int scroll_steps = 20;
base::TimeDelta scroll_time =
GetEventGenerator()->CalculateScrollDurationForFlingVelocity(
start, end, fling_speed, scroll_steps);
GetEventGenerator()->GestureScrollSequence(start, end, scroll_time,
scroll_steps);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(HotseatState::kShown, GetShelfLayoutManager()->hotseat_state());
GetAppListTestHelper()->CheckVisibility(true);
histogram_tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kFlingUpToShowHomeScreen, 1);
}
// Tests that UpdateVisibilityState is ignored during a shelf drag. This
// prevents drag from getting interrupted.
TEST_P(HotseatWidgetTest, NoVisibilityStateUpdateDuringDrag) {
// Autohide the shelf, then start a shelf drag.
GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
std::unique_ptr<aura::Window> window1 =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window1.get());
ASSERT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
// Drag the autohidden shelf up a bit, then open a new window and activate it
// during the drag. The shelf state should not change.
gfx::Point start_drag = GetVisibleShelfWidgetBoundsInScreen().top_center();
GetEventGenerator()->set_current_screen_location(start_drag);
GetEventGenerator()->PressTouch();
GetEventGenerator()->MoveTouchBy(0, -2);
auto shelf_state_watcher = std::make_unique<ShelfStateWatcher>();
std::unique_ptr<aura::Window> window2 =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window2.get());
window2->SetBounds(gfx::Rect(0, 0, 200, 200));
EXPECT_EQ(0, shelf_state_watcher->state_change_count());
}
// Tests that popups don't activate the hotseat. (crbug.com/1018266)
TEST_P(HotseatWidgetTest, HotseatRemainsHiddenIfPopupLaunched) {
// Go to in-app shelf and extend the hotseat.
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Hide hotseat by clicking outside its bounds.
gfx::Rect hotseat_bounds =
GetPrimaryShelf()->hotseat_widget()->GetWindowBoundsInScreen();
gfx::Point start = hotseat_bounds.top_center();
GetEventGenerator()->GestureTapAt(gfx::Point(start.x() + 1, start.y() - 1));
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Create a popup window and wait until all actions finish. The hotseat should
// remain hidden.
aura::Window* window_2 = CreateTestWindowInParent(window.get());
window_2->SetBounds(gfx::Rect(201, 0, 100, 100));
window_2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window_2->Show();
GetAppListTestHelper()->WaitUntilIdle();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
}
// Tests that blur is not showing during animations.
TEST_P(HotseatWidgetTest, NoBlurDuringAnimations) {
TabletModeControllerTestApi().EnterTabletMode();
ASSERT_EQ(
ShelfConfig::Get()->shelf_blur_radius(),
GetShelfWidget()->hotseat_widget()->GetHotseatBackgroundBlurForTest());
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
// Open a window, as the hotseat animates to kHidden, it should lose its blur.
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
EXPECT_EQ(
0, GetShelfWidget()->hotseat_widget()->GetHotseatBackgroundBlurForTest());
// Wait for the animation to finish, hotseat blur should return.
ShellTestApi().WaitForWindowFinishAnimating(window.get());
EXPECT_EQ(
ShelfConfig::Get()->shelf_blur_radius(),
GetShelfWidget()->hotseat_widget()->GetHotseatBackgroundBlurForTest());
}
// TODO(manucornet): Enable this test once the new API for layer animation
// sequence observers is available.
TEST_P(HotseatWidgetTest, DISABLED_OverviewToHomeAnimationAndBackIsSmooth) {
// Go into tablet mode and make sure animations are over.
HotseatWidget* hotseat = GetPrimaryShelf()->hotseat_widget();
WidgetAnimationWaiter waiter(hotseat);
TabletModeControllerTestApi().EnterTabletMode();
waiter.WaitForAnimation();
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
// Go into overview and back to know what to expect in terms of bounds.
const gfx::Rect shown_hotseat_bounds = hotseat->GetWindowBoundsInScreen();
{
WidgetAnimationWaiter waiter(hotseat);
StartOverview();
waiter.WaitForAnimation();
}
const gfx::Rect extended_hotseat_bounds = hotseat->GetWindowBoundsInScreen();
{
WidgetAnimationWaiter waiter(hotseat);
EndOverview();
waiter.WaitForAnimation();
}
// The extended hotseat should be higher (lower value of Y) than the
// shown hotseat.
EXPECT_GT(shown_hotseat_bounds.y(), extended_hotseat_bounds.y());
// We should start with the hotseat in its shown position again.
EXPECT_EQ(shown_hotseat_bounds, hotseat->GetWindowBoundsInScreen());
{
WidgetAnimationSmoothnessInspector inspector(hotseat);
WidgetAnimationWaiter waiter(hotseat);
StartOverview();
waiter.WaitForAnimation();
EXPECT_TRUE(inspector.CheckAnimation(4));
}
// The hotseat should now be extended.
EXPECT_EQ(extended_hotseat_bounds, hotseat->GetWindowBoundsInScreen());
{
WidgetAnimationSmoothnessInspector inspector(hotseat);
WidgetAnimationWaiter waiter(hotseat);
EndOverview();
waiter.WaitForAnimation();
EXPECT_TRUE(inspector.CheckAnimation(4));
}
// And we should now be back where we started.
EXPECT_EQ(shown_hotseat_bounds, hotseat->GetWindowBoundsInScreen());
}
} // namespace ash
| [
"[email protected]"
] | |
44af7806383d406bfe85733203286f4acd1e15a7 | 47a4b9901faf9742273b02ba14444d8d555b65a4 | /CodeChef/MXMEDIAN.cpp | e11dcac5cd3e206fe02df6474db1fef6703fc1f5 | [] | no_license | Aulene/Competitive-Programming-Solutions | a028b7b96e024d8547e2ff66801e5377d7fb76cd | 81d2705263313755399f2e3b6e01e029d40f61a6 | refs/heads/master | 2021-06-27T20:03:53.657351 | 2019-04-25T19:48:29 | 2019-04-25T19:48:29 | 101,798,734 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 875 | cpp | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<list>
using namespace std;
#define lli long long int
#define mod 1000000007
#define p push
#define pb push_back
#define mp make_pair
vector<int> v;
int a[100007], a1[100007], a2[100007];
int ans[100007];
int main()
{
int t, i, n;
vector<int>::iterator it;
cin >> t;
while(t--)
{
cin >> n;
for(i=0; i<2*n; i++)
cin >> a[i];
sort(a, a+2*n);
for(i=0; i<n; i++)
{
ans[i]=max(a[i], a[i+n]);
v.pb(a[i]);
v.pb(a[i+n]);
}
sort(ans, ans+n);
cout << ans[(n-1)/2] << endl;
for(it=v.begin(); it!=v.end(); it++)
cout << *it << " ";
cout << endl;
v.clear();
}
return 0;
} | [
"[email protected]"
] | |
b4fe00b74a17a0f3f838ad04dbbe90e554f0b133 | 951dfe797204714a5f199fd0d33ca5c003882473 | /gamewindow.cpp | 73da511e1c5ca39c69151b4db16f20b6c62df860 | [] | no_license | justko/TankGame | e8a5f5a767d2a36560d0cbb37b99e0f1ab05c1c9 | 467674b97db5e32eb73ea6df78a95a7555b9ba12 | refs/heads/master | 2020-03-09T08:51:17.131348 | 2018-04-17T00:35:27 | 2018-04-17T00:35:27 | 128,698,552 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,748 | cpp | #include "gamewindow.h"
#include "ui_gamewindow.h"
#include"gamewidget.h"
#include"scorewidget.h"
#include<thread>
#include<QVBoxLayout>
#include<unistd.h>
#include<QDebug>
#include<QFileDialog>
std::string GameWindow::defaultMap="map.dat";
GameWindow::GameWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::GameWindow),game(new Game(defaultMap)){
ui->setupUi(this);
setCentralWidget(ui->centralWidget);
GameWidget *gameWidget=new GameWidget(game);
ScoreWidget *scoreWidget=new ScoreWidget(game);
scoreWidget->setMaximumSize(100,500);
QHBoxLayout *mLayout=new QHBoxLayout();
mLayout->addWidget(gameWidget);
mLayout->addWidget(scoreWidget);
ui->centralWidget->setLayout(mLayout);
}
GameWindow::~GameWindow(){delete ui;}
void GameWindow::keyPressEvent(QKeyEvent *event){
if(game==nullptr)return;
if(event->key()==Qt::Key_P){
if(game->getIsStarted()){
game->stop();
}else{
std::thread t(Game::start,game,this);
t.detach();
}
}else if(game->getIsStarted()){
qDebug()<<"in";
game->input(event->key());
}
}
void GameWindow::on_actionNew_triggered(){
game->stop();
sleep(1);
delete game;
game=new Game(defaultMap);
update();
}
void GameWindow::on_actionMap_triggered(){
QFileDialog *chooseMap=new QFileDialog(this);
chooseMap->setDirectory(".");
chooseMap->setFileMode(QFileDialog::ExistingFile);
chooseMap->setNameFilter("Map File (*.dat *.txt)");
chooseMap->exec();
QStringList map=chooseMap->selectedFiles();
QString m=map.at(0);
defaultMap=m.toStdString();
game->stop();
sleep(1);
delete game;
game=new Game(defaultMap);
update();
}
| [
"[email protected]"
] | |
c56d92a26e59cf956e28a403d0837986660a3e9d | 4af610aa0ee92b0ff55493937f9382d190dbc999 | /src/sample/sample.cpp | bca27bc3732b79eeaa4278da447f3ce1175385d7 | [
"Apache-2.0"
] | permissive | msrocean/pcapml | 3db2d51b60415ae550cc6407327878d31b95095c | 69f9836a5adc12f05ccc42036db708a0c0192f68 | refs/heads/main | 2023-05-13T00:52:55.877953 | 2021-06-02T22:20:15 | 2021-06-02T22:20:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 860 | cpp | /*
* Copyright 2020 nPrint
* 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 https://www.apache.org/licenses/LICENSE-2.0
*/
#include "sample.hpp"
Sample::Sample(size_t sid, std::string label) {
this->sid = sid;
this->label = label;
}
void Sample::add_pkt(uint8_t *pkt_buf, uint64_t pkt_len, uint64_t ts) {
pkts.push_back(pkt_buf);
pkt_lens.push_back(pkt_len);
pkt_ts.push_back(ts);
}
size_t Sample::get_sid() {
return sid;
}
void Sample::print(FILE *stream, int verbose) {
fprintf(stream, "Sample Information { \n");
fprintf(stream, " SID: %zu\n", sid);
fprintf(stream, " Label: %s\n", label.c_str());
fprintf(stream, " n_pkts: %ld\n", pkts.size());
fprintf(stream, "}\n");
}
| [
"[email protected]"
] | |
541820536076eeea4ab9977230fe806383d06742 | e3e012664e3b4c016b7ed240cd9b81af1289149e | /thirdparty/linux/miracl/miracl_osmt/source/curve/pairing/irred.cpp | f3ebc69c2cba763ecfdedb59e9d064da46a1bbb5 | [
"Unlicense"
] | permissive | osu-crypto/MultipartyPSI | b48ce23163fed8eb458a05e3af6e4432963f08c7 | 44e965607b0d27416420d32cd09e6fcc34782c3a | refs/heads/implement | 2023-07-20T10:16:55.866284 | 2021-05-12T22:01:12 | 2021-05-12T22:01:12 | 100,207,769 | 73 | 29 | Unlicense | 2023-07-11T04:42:04 | 2017-08-13T22:15:27 | C++ | UTF-8 | C++ | false | false | 9,683 | cpp | /* program to find smallest irreducible polynomial */
/* cl /O2 /GX irred.cpp polymod.cpp poly.cpp big.cpp zzn.cpp miracl.lib
*/
#include <iostream>
#include <fstream>
#include <cstring>
#include "polymod.h"
using namespace std;
Miracl precision=200;
// Code to parse formula in command line
// This code isn't mine, but its public domain
// Shamefully I forget the source
//
// NOTE: It may be necessary on some platforms to change the operators * and #
//
#if defined(unix)
#define TIMES '.'
#define RAISE '^'
#else
#define TIMES '*'
#define RAISE '#'
#endif
Big tt;
static char *ss;
void eval_power (Big& oldn,Big& n,char op)
{
if (op) n=pow(oldn,toint(n)); // power(oldn,size(n),n,n);
}
void eval_product (Big& oldn,Big& n,char op)
{
switch (op)
{
case TIMES:
n*=oldn;
break;
case '/':
n=oldn/n;
break;
case '%':
n=oldn%n;
}
}
void eval_sum (Big& oldn,Big& n,char op)
{
switch (op)
{
case '+':
n+=oldn;
break;
case '-':
n=oldn-n;
}
}
void eval (void)
{
Big oldn[3];
Big n;
int i;
char oldop[3];
char op;
char minus;
for (i=0;i<3;i++)
{
oldop[i]=0;
}
LOOP:
while (*ss==' ')
ss++;
if (*ss=='-') /* Unary minus */
{
ss++;
minus=1;
}
else
minus=0;
while (*ss==' ')
ss++;
if (*ss=='(' || *ss=='[' || *ss=='{') /* Number is subexpression */
{
ss++;
eval ();
n=tt;
}
else /* Number is decimal value */
{
for (i=0;ss[i]>='0' && ss[i]<='9';i++)
;
if (!i) /* No digits found */
{
cout << "Error - invalid number" << endl;
exit (20);
}
op=ss[i];
ss[i]=0;
n=atoi(ss);
ss+=i;
*ss=op;
}
if (minus) n=-n;
do
op=*ss++;
while (op==' ');
if (op==0 || op==')' || op==']' || op=='}')
{
eval_power (oldn[2],n,oldop[2]);
eval_product (oldn[1],n,oldop[1]);
eval_sum (oldn[0],n,oldop[0]);
tt=n;
return;
}
else
{
if (op==RAISE)
{
eval_power (oldn[2],n,oldop[2]);
oldn[2]=n;
oldop[2]=RAISE;
}
else
{
if (op==TIMES || op=='/' || op=='%')
{
eval_power (oldn[2],n,oldop[2]);
oldop[2]=0;
eval_product (oldn[1],n,oldop[1]);
oldn[1]=n;
oldop[1]=op;
}
else
{
if (op=='+' || op=='-')
{
eval_power (oldn[2],n,oldop[2]);
oldop[2]=0;
eval_product (oldn[1],n,oldop[1]);
oldop[1]=0;
eval_sum (oldn[0],n,oldop[0]);
oldn[0]=n;
oldop[0]=op;
}
else /* Error - invalid operator */
{
cout << "Error - invalid operator" << endl;
exit (20);
}
}
}
}
goto LOOP;
}
int main(int argc,char ** argv)
{
ofstream ofile;
int ip,i,j,k,m,s,M,Base;
BOOL gotP,ir,fout,first,binomial;
Big w,p,t,xx[16];
miracl *mip=&precision;
argc--; argv++;
if (argc<1)
{
cout << "incorrect usage" << endl;
cout << "Program finds simplest irreducible polynomial with respect" << endl;
cout << "to a given prime modulus, of the form x^k+x^2+n" << endl;
cout << "irred <prime modulus P> <M>" << endl;
cout << "OR" << endl;
cout << "irred <formula for P> <M>" << endl;
cout << "To insist on a binomial, use -b" << endl;
cout << "To input P in Hex, precede with -h" << endl;
cout << "To output to a file, use flag -o <filename>" << endl;
#if defined(unix)
cout << "e.g. irred -f 2^192-2^64-1 6 -o zzn6.dat" << endl;
#else
cout << "e.g. irred -f 2#192-2#64-1 6 -o zzn6.dat" << endl;
#endif
return 0;
}
fout=FALSE;
Base=10;
ip=0;
M=0;
gotP=FALSE;
binomial=FALSE;
while (ip<argc)
{
if (!gotP && strcmp(argv[ip],"-f")==0)
{
ip++;
if (!gotP && ip<argc)
{
ss=argv[ip++];
tt=0;
eval();
p=tt;
gotP=TRUE;
continue;
}
else
{
cout << "Error in command line" << endl;
return 0;
}
}
if (strcmp(argv[ip],"-o")==0)
{
ip++;
if (ip<argc)
{
fout=TRUE;
ofile.open(argv[ip++]);
continue;
}
else
{
cout << "Error in command line" << endl;
return 0;
}
}
if (strcmp(argv[ip],"-h")==0)
{
ip++;
Base=16;
continue;
}
if (strcmp(argv[ip],"-b")==0)
{
ip++;
binomial=TRUE;
continue;
}
if (!gotP)
{
mip->IOBASE=Base;
p=argv[ip++];
mip->IOBASE=10;
gotP=TRUE;
continue;
}
if (gotP)
{
M=atoi(argv[ip++]);
continue;
}
cout << "Error in command line" << endl;
return 0;
}
if (!gotP || M<2)
{
cout << "Error in command line" << endl;
return 0;
}
if (!prime(p))
{
cout << "This number is not prime!" << endl;
exit(0);
}
if (M>36)
{
cout << "M is too big!" << endl;
exit(0);
}
//forever
//{
modulo(p);
cout << "p%24= " << p%24 << endl;
if (M==2) binomial=TRUE;
PolyMod h,g,x;
Poly f;
int ns=0;
x.addterm(1,1);
i=1;
j=2; m=1; first=FALSE;
if (M==12) j=4;
//j=2; m=-1;
forever
{
g=x;
f.clear();
f.addterm(i,0);
if (!binomial) f.addterm(m,j);
f.addterm(1,M);
// cout << f << endl;
setmod(f);
/*
ir=TRUE;
for (k=1;k<=M;k++)
{
g=pow(g,p);
if (k==M) break;
if (k>1 && prime((Big)k) && M%k==0)
{
h=gcd(g-x);
if (!isone(h))
{
cout << "k= " << k << endl;
cout << "h= " << h << endl;
ir=FALSE;
break;
}
}
}
if (ir)
{
if (!iszero(g-x)) ir=FALSE;
break;
}
if (ir) break;
*/
ir=TRUE;
// Ben-Or irreducibility test
for (k=1;k<=M/2;k++)
{
g=pow(g,p);
h=gcd(g-x);
if (!isone(h))
{
ir=FALSE;
break;
}
}
if (ir)
{
cout << "\nirreducible polynomial P(x) = " << f ;
ns++;
if (ns==10) break;
// break;
}
if (first)
{
if (!binomial)
{
if (m==1)
{
m=-1;
continue;
}
m=1;
}
j=j+1;
if (j==M)
{
j=1;
if (i<0) first=FALSE;
else i=-1;
}
continue;
}
//cout << "\ni= " << i << endl;
if (i>0) i=(-i);
else { i=(-i); i++; }
}
//cout << "p= " << p;
//cout << " irreducible polynomial P(x) = " << f << endl;
// cout << "\nirreducible polynomial P(x) = " << f << endl << endl;
if (fout)
{
ofile << i << endl;
if (binomial) ofile << 0 << endl;
else ofile << j << endl;
}
g=x;
g=pow(g,p);
if (fout)
for (i=0;i<M;i++) ofile << g.coeff(i) << endl;
for (j=2;j<M;j++)
for (i=0;i<M;i++) ofile << pow(g,j).coeff(i) << endl;
s=0; // HAC 3.34 Step 3
t=pow(p,M)-1;
while (t%2==0) { t/=2; s++; }
if (fout) ofile << s << endl;
w=t;
for (i=0;i<M;i++)
{
if (fout) ofile << w%p << endl;
w/=p;
}
w=(t+1)/2;
for (i=0;i<M;i++)
{
if (fout) ofile << w%p << endl;
w/=p;
}
//p+=8;
//while (!prime(p)) p+=8;
//}
/*
for (i=1;i<6;i++)
{
cout << i << "*p^2 should be x^" << i << " is " << pow(x,i*p*p) << endl;
}
for (i=1;i<6;i++)
{
cout << i << "*p^3 should be x^" << i << " is " << pow(x,i*p*p*p) << endl;
}
for (i=1;i<8;i++)
{
cout << i << "*p^4 should be x^" << i << " is " << pow(x,i*p*p*p*p) << endl;
}
for (i=1;i<10;i++)
{
cout << i << "*p^5 should be x^" << i << " is " << pow(x,i*p*p*p*p*p) << endl;
}
for (i=1;i<12;i++)
{
cout << i << "*p^6 should be x^" << i << " is " << pow(x,i*p*p*p*p*p*p) << endl;
}
*/
return 0;
}
| [
"[email protected]"
] | |
f662dd110c9b6966e200a23c5bac34b6922f8576 | 210ce4f1f0441a95e7a8a4369fc05d81a837de32 | /corelib/src/Signature.cpp | 3ce57b04beca7c5182cbe9755fccb932b4cfdffb | [] | no_license | abdullah38rcc/rtabmap | 2340bf49f44e4e204790a1f8e8ee0e8314e7396d | c8203f2119ea8c06905b5a3f5d82a8f1999bd8ac | refs/heads/master | 2021-01-18T04:44:52.403700 | 2014-11-04T21:21:26 | 2014-11-04T21:21:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,299 | cpp | /*
Copyright (c) 2010-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Universite de Sherbrooke nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "rtabmap/core/Signature.h"
#include "rtabmap/core/EpipolarGeometry.h"
#include "rtabmap/core/Memory.h"
#include "rtabmap/core/util3d.h"
#include <opencv2/highgui/highgui.hpp>
#include <rtabmap/utilite/UtiLite.h>
namespace rtabmap
{
Signature::Signature() :
_id(0), // invalid id
_mapId(-1),
_weight(-1),
_saved(false),
_modified(true),
_neighborsModified(true),
_enabled(false),
_fx(0.0f),
_fy(0.0f),
_cx(0.0f),
_cy(0.0f)
{
}
Signature::Signature(
int id,
int mapId,
const std::multimap<int, cv::KeyPoint> & words,
const std::multimap<int, pcl::PointXYZ> & words3, // in base_link frame (localTransform applied)
const Transform & pose,
const cv::Mat & depth2DCompressed, // in base_link frame
const cv::Mat & imageCompressed, // in camera_link frame
const cv::Mat & depthCompressed, // in camera_link frame
float fx,
float fy,
float cx,
float cy,
const Transform & localTransform) :
_id(id),
_mapId(mapId),
_weight(0),
_saved(false),
_modified(true),
_neighborsModified(true),
_words(words),
_enabled(false),
_imageCompressed(imageCompressed),
_depthCompressed(depthCompressed),
_depth2DCompressed(depth2DCompressed),
_fx(fx),
_fy(fy),
_cx(cx),
_cy(cy),
_pose(pose),
_localTransform(localTransform),
_words3(words3)
{
}
Signature::~Signature()
{
//UDEBUG("id=%d", _id);
}
void Signature::addNeighbors(const std::map<int, Transform> & neighbors)
{
for(std::map<int, Transform>::const_iterator i=neighbors.begin(); i!=neighbors.end(); ++i)
{
this->addNeighbor(i->first, i->second);
}
}
void Signature::addNeighbor(int neighbor, const Transform & transform)
{
UDEBUG("Add neighbor %d to %d", neighbor, this->id());
_neighbors.insert(std::pair<int, Transform>(neighbor, transform));
_neighborsModified = true;
}
void Signature::removeNeighbor(int neighborId)
{
int count = (int)_neighbors.erase(neighborId);
if(count)
{
_neighborsModified = true;
}
}
void Signature::removeNeighbors()
{
if(_neighbors.size())
_neighborsModified = true;
_neighbors.clear();
}
void Signature::changeNeighborIds(int idFrom, int idTo)
{
std::map<int, Transform>::iterator iter = _neighbors.find(idFrom);
if(iter != _neighbors.end())
{
Transform t = iter->second;
_neighbors.erase(iter);
_neighbors.insert(std::pair<int, Transform>(idTo, t));
_neighborsModified = true;
}
UDEBUG("(%d) neighbor ids changed from %d to %d", _id, idFrom, idTo);
}
void Signature::addLoopClosureId(int loopClosureId, const Transform & transform)
{
if(loopClosureId && _loopClosureIds.insert(std::pair<int, Transform>(loopClosureId, transform)).second)
{
_neighborsModified=true;
}
}
void Signature::addChildLoopClosureId(int childLoopClosureId, const Transform & transform)
{
if(childLoopClosureId && _childLoopClosureIds.insert(std::pair<int, Transform>(childLoopClosureId, transform)).second)
{
_neighborsModified=true;
}
}
void Signature::changeLoopClosureId(int idFrom, int idTo)
{
std::map<int, Transform>::iterator iter = _loopClosureIds.find(idFrom);
if(iter != _loopClosureIds.end())
{
Transform t = iter->second;
_loopClosureIds.erase(iter);
_loopClosureIds.insert(std::pair<int, Transform>(idTo, t));
_neighborsModified = true;
}
UDEBUG("(%d) loop closure ids changed from %d to %d", _id, idFrom, idTo);
}
float Signature::compareTo(const Signature & s) const
{
float similarity = 0.0f;
const std::multimap<int, cv::KeyPoint> & words = s.getWords();
if(words.size() != 0 && _words.size() != 0)
{
std::list<std::pair<int, std::pair<cv::KeyPoint, cv::KeyPoint> > > pairs;
unsigned int totalWords = _words.size()>words.size()?_words.size():words.size();
EpipolarGeometry::findPairs(words, _words, pairs);
similarity = float(pairs.size()) / float(totalWords);
}
return similarity;
}
void Signature::changeWordsRef(int oldWordId, int activeWordId)
{
std::list<cv::KeyPoint> kps = uValues(_words, oldWordId);
if(kps.size())
{
std::list<pcl::PointXYZ> pts = uValues(_words3, oldWordId);
_words.erase(oldWordId);
_words3.erase(oldWordId);
_wordsChanged.insert(std::make_pair(oldWordId, activeWordId));
for(std::list<cv::KeyPoint>::const_iterator iter=kps.begin(); iter!=kps.end(); ++iter)
{
_words.insert(std::pair<int, cv::KeyPoint>(activeWordId, (*iter)));
}
for(std::list<pcl::PointXYZ>::const_iterator iter=pts.begin(); iter!=pts.end(); ++iter)
{
_words3.insert(std::pair<int, pcl::PointXYZ>(activeWordId, (*iter)));
}
}
}
bool Signature::isBadSignature() const
{
return !_words.size();
}
void Signature::removeAllWords()
{
_words.clear();
_words3.clear();
}
void Signature::removeWord(int wordId)
{
_words.erase(wordId);
_words3.erase(wordId);
}
void Signature::setDepthCompressed(const cv::Mat & bytes, float fx, float fy, float cx, float cy)
{
UASSERT_MSG(bytes.empty() || (!bytes.empty() && fx > 0.0f && fy > 0.0f && cx >= 0.0f && cy >= 0.0f), uFormat("fx=%f fy=%f cx=%f cy=%f",fx,fy,cx,cy).c_str());
_depthCompressed = bytes;
_fx=fx;
_fy=fy;
_cx=cx;
_cy=cy;
}
SensorData Signature::toSensorData()
{
this->uncompressData();
return SensorData(_imageRaw,
_depthRaw,
_depth2DRaw,
_fx,
_fy,
_cx,
_cy,
_pose,
_localTransform,
_id);
}
void Signature::uncompressData()
{
uncompressData(&_imageRaw, &_depthRaw, &_depth2DRaw);
}
void Signature::uncompressData(cv::Mat * imageRaw, cv::Mat * depthRaw, cv::Mat * depth2DRaw) const
{
if(imageRaw)
{
*imageRaw = _imageRaw;
}
if(depthRaw)
{
*depthRaw = _depthRaw;
}
if(depth2DRaw)
{
*depth2DRaw = _depth2DRaw;
}
if( (imageRaw && imageRaw->empty()) ||
(depthRaw && depthRaw->empty()) ||
(depth2DRaw && depth2DRaw->empty()))
{
util3d::CompressionThread ctImage(_imageCompressed, true);
util3d::CompressionThread ctDepth(_depthCompressed, true);
util3d::CompressionThread ctDepth2D(_depth2DCompressed, false);
if(imageRaw && imageRaw->empty())
{
ctImage.start();
}
if(depthRaw && depthRaw->empty())
{
ctDepth.start();
}
if(depth2DRaw && depth2DRaw->empty())
{
ctDepth2D.start();
}
ctImage.join();
ctDepth.join();
ctDepth2D.join();
if(imageRaw && imageRaw->empty())
{
*imageRaw = ctImage.getUncompressedData();
}
if(depthRaw && depthRaw->empty())
{
*depthRaw = ctDepth.getUncompressedData();
}
if(depth2DRaw && depth2DRaw->empty())
{
*depth2DRaw = ctDepth2D.getUncompressedData();
}
}
}
} //namespace rtabmap
| [
"matlabbe@f169173b-cf89-36c8-b27e-44dbe73f0c83"
] | matlabbe@f169173b-cf89-36c8-b27e-44dbe73f0c83 |
429ed9119bf7ca791d08d9b43881b5e614588108 | 3cf9e141cc8fee9d490224741297d3eca3f5feff | /C++ Benchmark Programs/Benchmark Files 1/classtester/autogen-sources/source-9379.cpp | aad19430eac4886f04823d792a5ad7fc301800d6 | [] | no_license | TeamVault/tauCFI | e0ac60b8106fc1bb9874adc515fc01672b775123 | e677d8cc7acd0b1dd0ac0212ff8362fcd4178c10 | refs/heads/master | 2023-05-30T20:57:13.450360 | 2021-06-14T09:10:24 | 2021-06-14T09:10:24 | 154,563,655 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,486 | cpp | struct c0;
void __attribute__ ((noinline)) tester0(c0* p);
struct c0
{
bool active0;
c0() : active0(true) {}
virtual ~c0()
{
tester0(this);
active0 = false;
}
virtual void f0(){}
};
void __attribute__ ((noinline)) tester0(c0* p)
{
p->f0();
}
struct c1;
void __attribute__ ((noinline)) tester1(c1* p);
struct c1
{
bool active1;
c1() : active1(true) {}
virtual ~c1()
{
tester1(this);
active1 = false;
}
virtual void f1(){}
};
void __attribute__ ((noinline)) tester1(c1* p)
{
p->f1();
}
struct c2;
void __attribute__ ((noinline)) tester2(c2* p);
struct c2 : c1
{
bool active2;
c2() : active2(true) {}
virtual ~c2()
{
tester2(this);
c1 *p1_0 = (c1*)(c2*)(this);
tester1(p1_0);
active2 = false;
}
virtual void f2(){}
};
void __attribute__ ((noinline)) tester2(c2* p)
{
p->f2();
if (p->active1)
p->f1();
}
struct c3;
void __attribute__ ((noinline)) tester3(c3* p);
struct c3 : c1, c0
{
bool active3;
c3() : active3(true) {}
virtual ~c3()
{
tester3(this);
c0 *p0_0 = (c0*)(c3*)(this);
tester0(p0_0);
c1 *p1_0 = (c1*)(c3*)(this);
tester1(p1_0);
active3 = false;
}
virtual void f3(){}
};
void __attribute__ ((noinline)) tester3(c3* p)
{
p->f3();
if (p->active0)
p->f0();
if (p->active1)
p->f1();
}
struct c4;
void __attribute__ ((noinline)) tester4(c4* p);
struct c4 : c2, c0
{
bool active4;
c4() : active4(true) {}
virtual ~c4()
{
tester4(this);
c0 *p0_0 = (c0*)(c4*)(this);
tester0(p0_0);
c1 *p1_0 = (c1*)(c2*)(c4*)(this);
tester1(p1_0);
c2 *p2_0 = (c2*)(c4*)(this);
tester2(p2_0);
active4 = false;
}
virtual void f4(){}
};
void __attribute__ ((noinline)) tester4(c4* p)
{
p->f4();
if (p->active0)
p->f0();
if (p->active1)
p->f1();
if (p->active2)
p->f2();
}
int __attribute__ ((noinline)) inc(int v) {return ++v;}
int main()
{
c0* ptrs0[25];
ptrs0[0] = (c0*)(new c0());
ptrs0[1] = (c0*)(c3*)(new c3());
ptrs0[2] = (c0*)(c4*)(new c4());
for (int i=0;i<3;i=inc(i))
{
tester0(ptrs0[i]);
delete ptrs0[i];
}
c1* ptrs1[25];
ptrs1[0] = (c1*)(new c1());
ptrs1[1] = (c1*)(c2*)(new c2());
ptrs1[2] = (c1*)(c3*)(new c3());
ptrs1[3] = (c1*)(c2*)(c4*)(new c4());
for (int i=0;i<4;i=inc(i))
{
tester1(ptrs1[i]);
delete ptrs1[i];
}
c2* ptrs2[25];
ptrs2[0] = (c2*)(new c2());
ptrs2[1] = (c2*)(c4*)(new c4());
for (int i=0;i<2;i=inc(i))
{
tester2(ptrs2[i]);
delete ptrs2[i];
}
c3* ptrs3[25];
ptrs3[0] = (c3*)(new c3());
for (int i=0;i<1;i=inc(i))
{
tester3(ptrs3[i]);
delete ptrs3[i];
}
c4* ptrs4[25];
ptrs4[0] = (c4*)(new c4());
for (int i=0;i<1;i=inc(i))
{
tester4(ptrs4[i]);
delete ptrs4[i];
}
return 0;
}
| [
"[email protected]"
] | |
a4065286c22de05cd18d6d0e8159a96260e95056 | e05c6343d03ea5d015c0a805e9b4ff334e4063b2 | /core/src/TimeManager.cpp | 26eb2ca0496fa270ef9549ec52faef2975ee8f58 | [] | no_license | nguyenvuducthuy/3Dengine | a74e4ea43d1461f4b92e0f3f7f0a5e2e7cf3f9b5 | 8d0d38a5f1373c1ba632386657965679e026fd0b | refs/heads/master | 2020-05-21T21:22:48.286975 | 2018-12-10T11:14:56 | 2018-12-10T11:14:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 489 | cpp | /**
* @class TimeManager
* @brief Interface for time manager management
*
* @author Roberto Cano (http://www.robertocano.es)
*/
#include "TimeManager.hpp"
#include "GLFWTimeManager.hpp"
TimeManager *TimeManager::_timeManager = NULL;
TimeManager *TimeManager::GetInstance()
{
if (_timeManager == NULL) {
_timeManager = new GLFWTimeManager();
}
return _timeManager;
}
void TimeManager::DisposeInstance(void)
{
delete _timeManager;
_timeManager = NULL;
}
| [
"[email protected]"
] | |
81ee83eefec4fca30b5d943e68f4509fec049ca1 | c43ac755962c8cbb1e062eaa2c2efb6a39becc0e | /libs/mathtools/src/angles.h | e223a078f06a9ae60b3db680e962e551d07d7979 | [
"MIT"
] | permissive | jc-gonzalez/fisica | 6272b2fd484e2bd446ead5030f8454bf0afe9f3b | 218567df497b3ef021964242a08f7a65e588bff4 | refs/heads/master | 2022-04-08T05:10:52.725867 | 2020-02-12T18:57:31 | 2020-02-12T18:57:31 | 153,597,957 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,107 | h | /******************************************************************************
* File: angles.h
* This file is part of the Cherenkov Detector Simulation library
*
* Domain: cherdetsim.angles
*
* Last update: 2.0
*
* Date: 2019/03/13
*
* Author: J C Gonzalez
*
* Copyright (C) 2019 by J C Gonzalez
*_____________________________________________________________________________
*
* Topic: General Information
*
* Purpose:
* Declare DockerMng class
*
* Created by:
* J C Gonzalez
*
* Status:
* Prototype
*
* Dependencies:
* Component
*
* Files read / modified:
* none
*
* History:
* See <Changelog>
*
* About: License Conditions
* See <License>
*
******************************************************************************/
#ifndef ANGLES_H
#define ANGLES_H
//============================================================
// Group: External Dependencies
//============================================================
//------------------------------------------------------------
// Topic: System headers
// none
//------------------------------------------------------------
//------------------------------------------------------------
// Topic: External packages
// none
//------------------------------------------------------------
//------------------------------------------------------------
// Topic: Project headers
// nones
//------------------------------------------------------------
//======================================================================
// Namespace: MathTools
//======================================================================
namespace MathTools {
extern const double Radians2Degrees;
extern const double Degrees2Radians;
extern const double Deg360; // 2 Pi
extern const double Deg180; // Pi
extern const double Deg120; // 2 Pi / 3
extern const double Deg90; // Pi / 2
extern const double Deg60; // Pi / 3
extern const double Deg30; // Pi / 6
double d2r(double x);
double r2d(double x);
}
#endif // ANGLES_H
| [
"[email protected]"
] | |
66dbf2187e690281d4ce72609a62dcc62aa81c6c | 0c48e2c65151861ebcd8fc5527d2fd74d563282d | /Classes/CatchFish.hpp | 3d2c95e14553c1143dc7d5000321aa9c058c08e4 | [] | no_license | FJSDS/xxlib_cocos_cpp | cfc185568b2a65f153dfa4825f374b20050bd347 | 0523f78a4af996a53fca71903c6a5e15ac0781f9 | refs/heads/master | 2020-05-20T19:59:13.105300 | 2019-05-23T14:05:20 | 2019-05-23T14:05:20 | 185,734,947 | 0 | 0 | null | 2019-05-09T05:53:29 | 2019-05-09T05:53:28 | null | UTF-8 | C++ | false | false | 5,324 | hpp | inline CatchFish::CatchFish() {
}
inline CatchFish::~CatchFish() {
disposed = true;
// todo: more release
#ifdef CC_TARGET_PLATFORM
dialer.reset();
cc_listener.Reset();
#endif
}
inline int CatchFish::Update() noexcept {
#ifdef CC_TARGET_PLATFORM
return dialer->Update();
#else
return scene->Update();
#endif
}
#ifndef CC_TARGET_PLATFORM
inline int ReadFile(const char* fn, xx::BBuffer& bb)
{
FILE* fp = fopen(fn, "rb");
if (nullptr == fp) return -1;
fseek(fp, 0L, SEEK_END); // 定位到文件末尾
int flen = ftell(fp); // 得到文件大小
if (flen <= 0)
{
fclose(fp);
return -1;
}
bb.Clear();
bb.Reserve(flen); // 申请内存空间
fseek(fp, 0L, SEEK_SET); // 定位到文件开头
if (fread(bb.buf, flen, 1, fp) != 1) return -2; // 一次性读取全部文件内容
bb.len = flen;
fclose(fp);
return 0;
}
inline int CatchFish::Init(std::string const& cfgName) noexcept {
// 从文件加载 cfg. 出问题返回非 0
{
xx::BBuffer bb;
if (int r = ReadFile(cfgName.c_str(), bb)) return r;
if (int r = bb.ReadRoot(cfg)) return r;
}
// 初始化派生类的东西
if (int r = cfg->InitCascade()) return r;
// 场景初始化
xx::MakeTo(scene);
xx::MakeTo(scene->borns);
xx::MakeTo(scene->fishs);
xx::MakeTo(scene->freeSits);
xx::MakeTo(scene->items);
xx::MakeTo(scene->players);
xx::MakeTo(scene->rnd, 123); // todo: 时间 seed ?
xx::MakeTo(scene->frameEvents);
xx::MakeTo(scene->frameEvents->events);
xx::MakeTo(scene->hitChecks);
xx::MakeTo(scene->hitChecks->hits);
scene->cfg = &*cfg;
scene->catchFish = this;
// 关卡初始化
int r = cfg->stageBufs[0].ReadRoot(scene->stage);
assert(!r);
scene->stage->InitCascade(&*scene);
// 空位初始化
scene->freeSits->Add(PKG::CatchFish::Sits::LeftTop
, PKG::CatchFish::Sits::RightTop
, PKG::CatchFish::Sits::RightBottom
, PKG::CatchFish::Sits::LeftBottom);
#else
inline int CatchFish::Init(std::string const& ip, int const& port, std::string const& cfgName) noexcept {
// 暂存 ip, port
serverIp = ip;
serverPort = port;
assert(!cc_scene);
// 初始化 cocos 相关
cc_visibleSize = cocos2d::Director::getInstance()->getOpenGLView()->getDesignResolutionSize();
cc_visibleSize_2 = cc_visibleSize / 2;
cc_p1 = { -cc_visibleSize_2.width, -cc_visibleSize_2.height };
cc_p2 = { 0, -cc_visibleSize_2.height };
cc_p3 = { cc_visibleSize_2.width, -cc_visibleSize_2.height };
cc_p4 = { -cc_visibleSize_2.width, 0 };
cc_p5 = { 0, 0 };
cc_p6 = { cc_visibleSize_2.width, 0 };
cc_p7 = { -cc_visibleSize_2.width, cc_visibleSize_2.height };
cc_p8 = { 0, cc_visibleSize_2.height };
cc_p9 = { cc_visibleSize_2.width, cc_visibleSize_2.height };
cc_scene = cocos2d::Director::getInstance()->getRunningScene();
cc_fishNode = cocos2d::ClippingRectangleNode::create({ -designSize_2.x, -designSize_2.y, designSize.x, designSize.y });
cc_fishNode->setScale(designSize.x / designSize.y > cc_visibleSize.width / cc_visibleSize.height ? cc_visibleSize.width / designSize.x : cc_visibleSize.height / designSize.y);
cc_scene->addChild(cc_fishNode);
cc_uiNode = cocos2d::Node::create();
cc_scene->addChild(cc_uiNode);
cc_listener = cocos2d::EventListenerTouchAllAtOnce::create();
cc_listener->onTouchesBegan = [](const std::vector<cocos2d::Touch*> & ts, cocos2d::Event * e) {
cc_touchs.AddRange(ts.data(), ts.size());
};
cc_listener->onTouchesMoved = [](const std::vector<cocos2d::Touch*> & ts, cocos2d::Event * e) {
};
cc_listener->onTouchesEnded = [](const std::vector<cocos2d::Touch*> & ts, cocos2d::Event * e) {
for (auto&& t : ts) {
cc_touchs.Remove(t);
}
};
cc_listener->onTouchesCancelled = cc_listener->onTouchesEnded;
cocos2d::Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(cc_listener, cc_scene);
// 从文件加载 cfg. 出问题返回非 0
{
auto&& data = cocos2d::FileUtils::getInstance()->getDataFromFile(cfgName);
xx::BBuffer bb;
bb.Reset(data.getBytes(), data.getSize());
auto&& r = bb.ReadRoot(cfg);
bb.Reset();
if (r) return r;
}
// 初始化派生类的东西
if (int r = cfg->InitCascade()) return r;
// 存易用单例
::catchFish = this;
// 初始化拨号器
xx::MakeTo(::dialer);
#endif
return 0;
}
inline void CatchFish::Cleanup(PKG::CatchFish::Player_s p) noexcept {
assert(p);
#ifndef CC_TARGET_PLATFORM
// 网络解绑
if (p->peer) {
assert(p->peer->player_w.lock() == p);
p->peer->Dispose(1);
p->peer.reset();
}
#endif
// 从玩家总容器移除
assert(players.Find(p) != -1);
players.Remove(p);
// 从玩家所在场景移除
auto && ps = *p->scene->players;
assert(ps.len);
size_t i = ps.len - 1;
for (; i != -1; --i) {
if (ps[i].lock() == p) {
ps.SwapRemoveAt(i);
break;
}
}
assert(i != -1);
#ifndef CC_TARGET_PLATFORM
// 归还座位
assert(p->scene->freeSits->Find(p->sit) == -1);
p->scene->freeSits->Add(p->sit);
// 清理该玩家已产生的事件
auto && es = *p->scene->frameEvents->events;
if (es.len) {
for (i = es.len - 1; i != -1; --i) {
if (es[i]->playerId == p->id) {
es.SwapRemoveAt(i);
}
}
}
// 生成离开事件
{
auto&& e = xx::Make<PKG::CatchFish::Events::Leave>();
e->playerId = p->id;
p->scene->frameEvents->events->Add(std::move(e));
}
#endif
xx::CoutTN("cleanup player: id = ", p->id);
}
| [
"[email protected]"
] | |
99fe9fd79ba88937ed317b3a4e2d85c6ed69dabd | ce0816d59932114f4b6bc1f33ff0bba86e9a7dae | /Assignment2/AirlineReservation/AirlineReservation/User.cpp | cad4a303a0f60fa21c52de4adf3f6fe25c10d73c | [
"MIT"
] | permissive | Janani-Sankar/janani-assignments | b31bed5a3b7fa4be9fb74bc156e8f4173679ae42 | e8a1a009eefd56204a43187ad128d0c17269d7b0 | refs/heads/master | 2020-07-22T10:00:34.365542 | 2019-10-21T04:04:08 | 2019-10-21T04:04:08 | 207,160,406 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 807 | cpp | #include"User.h"
#include<string>
#include<vector>
#include"pch.h"
#include<stdio.h>
using namespace std;
namespace AirlineRSystem
{
User::User(const std::string& firstName, const std::string& lastName, int idno)
: mFirstName(firstName), mLastName(lastName), midno(idno)
{
/*mFirstName = firstName;
mLastName = lastName;*/
}
void User::setFirstName(const string& firstName)
{
mFirstName = firstName;
}
void User::setLastName(const string& lastName)
{
mLastName = lastName;
}
const string& User::getFirstName() const
{
return mFirstName;
}
const string& User::getLastName() const
{
return mLastName;
}
int User::getidno() const
{
return midno;
}
void User::setseatno(int seatNumber) {
mseatno = seatNumber;
}
int User::getseatno() const {
return mseatno;
}
} | [
"[email protected]"
] | |
60b1f2d85babe132405279fd31f6c31d3cab96c9 | 2db7e8c11170b3e426bf2524d2ba122dd0726d9e | /source/libs/stdex/vector_queue.h | e160387560befe407713dbab089268c4a4f9c528 | [] | no_license | DominikSadko/MS-Engine | bbc56a2bee31616db54a45224cd942cf99ebc53f | 9de4cb1ea1d736cdf1b10bf7b7cd263d9a09260e | refs/heads/master | 2020-05-17T00:51:20.081599 | 2016-08-09T08:21:13 | 2016-08-09T08:21:13 | 41,730,290 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 787 | h | #ifndef __VECTOR_QUEUE_H__
#define __VECTOR_QUEUE_H__
namespace stdex
{
template <typename Type, typename Compare = std::less<Type>>
class vector_queue
{
public:
explicit vector_queue(const Compare& compare = Compare())
: m_compare{compare}
{ }
void push(Type element)
{
m_elements.push_back(std::move(element));
std::push_heap(m_elements.begin(), m_elements.end(), m_compare);
}
void pop()
{
std::pop_heap(m_elements.begin(), m_elements.end(), m_compare);
m_elements.pop_back();
}
Type top() const { return m_elements.front(); }
bool empty() const { return m_elements.empty(); }
std::vector<Type>& elements() { return m_elements; }
private:
std::vector<Type> m_elements;
Compare m_compare;
};
} // stdex
#endif // __VECTOR_QUEUE_H__ //
| [
"[email protected]"
] | |
30d40db558503db8b264c14a1d5b7ccef47b146b | 7f545cc51e3c5655aa273d3d99119127bc2900d4 | /剑指offer/字符流中第一个不重复的字符.cpp | 76dc0949cfd9f798ef24c390de6c991f70bcc8fc | [] | no_license | winterfell30/LeetCode | b2e2118411da74c9babdd84991e9430b97240a7d | e59436a4d76f8d6fa23b020a5af6cb9dcc39e5c3 | refs/heads/master | 2021-06-23T09:39:41.022404 | 2017-08-13T11:35:05 | 2017-08-13T11:35:05 | 86,675,612 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 609 | cpp | class Solution
{
public:
//Insert one char from stringstream
Solution()
{
while (!q.empty()) q.pop();
memset(vis, 0, sizeof(vis));
}
void Insert(char ch)
{
vis[ch-'\0']++;
if (vis[ch-'\0'] == 1)
q.push(ch-'\0');
}
//return the first appearence once char in current stringstream
char FirstAppearingOnce()
{
while (!q.empty() && vis[q.front()] > 1)
q.pop();
if (q.empty()) return '#';
else return q.front();
}
private:
int vis[256];
queue<int> q;
};
| [
"[email protected]"
] | |
ffff402ed248fbf7dcf73a2105f10b592e0c5770 | 7a724a6d3fdf6d9f2c6d648503bbbc2c5f6bf5ee | /C++/C++/NOMINAFU.CPP | 3241ddb3bc7d4a3e075da45b518211ef0846f1a4 | [] | no_license | ingenierialinuxpereira/developments | 863e9489f5852ee0ee81edb82e03c431528f81b2 | bc726ff4a98608daed50f68153d001f95d29bb63 | refs/heads/main | 2023-04-11T05:15:11.127958 | 2021-03-31T20:00:47 | 2021-03-31T20:00:47 | 351,871,128 | 0 | 1 | null | null | null | null | ISO-8859-10 | C++ | false | false | 17,349 | cpp | # include <conio.h>
# include<dos.h>
# include <stdio.h>
# include <iostream.h>
# include <alloc.h>
# include <time.h>
#define ENTER 13
#define fd 77
#define fi 75
#define F10 68
#define ESC 27
#define fup 72
#define fdown 80
#define cuantos 10
struct empleado
{
char codigo[25];
char nombre[40];
char apellido[40];
char direccion[50];
int telefono;
float sal_basico;
int edad;
char sexo[1];
int numero_hijos;
char estado_civil[1];
}archivo[cuantos];
void menu ();
void cuadro (int x1,int y1,int x2,int y2,int color);
void coloreo(int x1,int y1,int x2,int y2, int color, int tipo);
void ingreso();
void saludo();
void desplaza(int opc);
void desplaza1(int opc);
void opciones();
void main ()
{
clrscr ();
menu ();
}
void menu ()
{
cuadro (4,1,21,80,BROWN);
coloreo(6,2,20,79,BLUE,219);
cuadro(22,15,24,63,BLUE);
//cuadro(22,36,24,62,BROWN);
cuadro(1,1,3,35,BROWN);
cuadro(1,36,3,79,BROWN);
opciones();
}
void coloreo(int x1,int y1,int x2,int y2,int color, int tipo)
{
int yi,xi;
for(xi=y1;xi<=y2;xi++)
{
for(yi=x1;yi<=x2;yi++)
{
gotoxy(xi,yi);
textcolor(color); delay(5);
cprintf("%c",tipo);
}
}
}
void cuadro (int x1,int y1,int x2,int y2, int color)
{
int xi,g;
textcolor(color);
for (xi=y1; xi<=y2; xi++)
{
gotoxy (xi,x1);delay(15);
cprintf("%c",196);
gotoxy (xi,x2);
cprintf("%c",196);
}
for (xi=x1; xi<=x2; xi++)
{
gotoxy (y1,xi);
cprintf("%c",179);
gotoxy (y2,xi);
cprintf("%c",179);
}
gotoxy(y1,x1);
cprintf("%c",218);
gotoxy(y2,x2);
cprintf("%c",217);
gotoxy(y2,x1);
cprintf("%c",191);
gotoxy(y1,x2);
cprintf("%c",192);
}
void opciones()
{
time_t t;
int opc;
char b,a,c;
gotoxy(4,2);
textcolor(15);
cprintf("CIDCA PEREIRA IV SEM. SISTEMAS");
/*t = time(NULL);
gotoxy(37,23);
cprintf("%s", ctime(&t));*/
gotoxy(44,2);cprintf("COLEGIO GENERAL RAFAEL REYES");
gotoxy(16,23);printf("SU OPCION:");
//gotoxy(2,23);
//putchar(char(15));
gotoxy(26,23);
putchar(char(16));
gotoxy(9,5);cprintf("EMPLEADOS");
gotoxy(24,5);cprintf("NOMINA");
gotoxy(36,5);cprintf("REPORTES");
gotoxy(50,5);cprintf("ACERCA DE");
gotoxy(66,5);cprintf("SALIR");
textcolor(15);
opc=1;
while ((a=getch()) !=F10)
{textcolor(15); gotoxy(28,23);
printf("%d",opc);
if (a==fd)
{
switch (opc)
{
case 1 : gotoxy (9,5);
textbackground(RED);
cprintf ("EMPLEADOS");
gotoxy(66,5);
textbackground(0);
cprintf("SALIR");
gotoxy(31,23);
cprintf("Administracion de empleados");
desplaza(opc);
opc++;
coloreo(6,5,12,23,BLUE,219);
break;
case 2:
gotoxy (24,5);
textbackground(RED);
cprintf ("NOMINA");
textbackground(0);
gotoxy(9,5);
cprintf("EMPLEADOS");
gotoxy(31,23);
cprintf("Administracion de nĒmina ");
desplaza(opc);
opc++;
textbackground(0);
coloreo(6,20,12,37,BLUE,219);
break;
case 3 :
gotoxy (36,5);
textbackground(RED);
cprintf ("REPORTES");
gotoxy(24,5);
textbackground(0);
cprintf("NOMINA");
gotoxy(31,23);
cprintf("Suministro de reportes ");
desplaza(opc);
opc++;
textbackground(0);
coloreo(6,33,12,49,BLUE,219);
break;
case 4 : gotoxy (50,5);
textbackground(RED);
cprintf ("ACERCA DE");
textbackground(0);
gotoxy(36,5);
cprintf("REPORTES");
gotoxy(31,23);
cprintf("Informacion del programa ");
desplaza(opc);
opc++;
textbackground(0);
coloreo(6,47,12,65,BLUE,219);
break;
case 5 : gotoxy (66,5);
textbackground(RED);
cprintf ("SALIR");
gotoxy(50,5);
textbackground(0);
cprintf("ACERCA DE");
gotoxy(31,23);
cprintf("Para salir favor oprima F10 ");
desplaza(opc);
opc=1;
textbackground(0);
coloreo(6,66,8,75,BLUE,219);
break;
}
gotoxy(79,24);
}
else
{
if(a==fi)
{
switch(opc)
{
case 1:gotoxy(28,23);printf("4");
gotoxy (50,5);
textbackground(RED);
cprintf ("ACERCA DE");
gotoxy(66,5);
textbackground(0);
cprintf("SALIR");
gotoxy(31,23);
printf("Informacion del programa ");
desplaza1(opc);
opc=5;
textbackground(0);
coloreo(6,47,12,75,BLUE,219);
break;
case 2 :gotoxy(28,23);printf("5");
gotoxy (66,5);
textbackground(RED);
cprintf ("SALIR");
textbackground(0);
gotoxy (9,5);
cprintf ("EMPLEADOS");
gotoxy(31,23);
cprintf("Para salir favor oprima F10 ");
desplaza1(opc);
opc--;
textbackground(0);
coloreo(6,67,8,75,BLUE,219);
break;
case 3 :gotoxy(28,23);printf("1");
gotoxy (9,5);
textbackground(RED);
cprintf ("EMPLEADOS");
textbackground(0);
gotoxy (24,5);
cprintf ("NOMINA");
gotoxy(31,23);
cprintf("Administracion de empleados");
desplaza1(opc);
opc--;
textbackground(0);
coloreo(6,5,12,23,BLUE,219);
break;
case 4 :gotoxy(28,23);printf("2");
gotoxy (24,5);
textbackground(RED);
cprintf ("NOMINA");
gotoxy (36,5);
textbackground(0);
cprintf ("REPORTES");
gotoxy(31,23);
printf("Administracion de nĒmina ");
desplaza1(opc);
opc--;
textbackground(0);
coloreo(6,20,12,40,BLUE,219);
break;
case 5 :gotoxy(28,23);printf("3");
gotoxy (36,5);
textbackground(RED);
cprintf ("REPORTES");
textbackground(0);
gotoxy (50,5);
cprintf ("ACERCA DE");
gotoxy(31,23);
cprintf("Suministro de reportes ");
desplaza1(opc);
opc--;
textbackground(0);
coloreo(6,33,12,53,BLUE,219);
break;
}
gotoxy(80,24);
}
}
}
gotoxy(80,24);
}
void desplaza(int opc)
{ int a,op;
switch (opc)
{
case 1 : textbackground(BLUE);
coloreo(6,9,10,19,BROWN,219);
cuadro(6,9,10,19,15);
gotoxy(10,7);cprintf("Ingreso ");
gotoxy(10,8);cprintf("Modificar");
gotoxy(10,9);cprintf("Consulta ");
op=1;
while ((a=getch()) !=ESC)
{
saludo();
if((a==ENTER) && (op == 1))
ingreso();
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (10,7);
textbackground(RED);
cprintf ("Ingreso ");
textbackground(BLUE);
gotoxy(10,9);
cprintf("Consulta ");
op++;
break;
case 2: gotoxy (10,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(10,7);
cprintf("Ingreso ");
op++;
break;
case 3:gotoxy (10,9);
textbackground(RED);
cprintf ("Consulta ");
gotoxy(10,8);
textbackground(BLUE);
cprintf("Modificar");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (10,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(10,9);
cprintf("Consulta ");
op=3;
break;
case 2:gotoxy(10,9);
textbackground(RED);
cprintf("Consulta ");
textbackground(BLUE);
gotoxy(10,7);
cprintf("Ingreso ");
op--;
break;
case 3:gotoxy(10,7);
textbackground(RED);
cprintf("Ingreso ");
textbackground(BLUE);
gotoxy(10,8);
cprintf("Modificar");
op--;
break;
} // sw
} //if
}//else
} //wh
break;
case 2 :
textbackground(BLUE);
coloreo(6,24,10,34,BROWN,219);
cuadro(6,24,10,34,15);
gotoxy(25,7);cprintf("Novedades");
gotoxy(25,8);cprintf("Modificar");
gotoxy(25,9);cprintf("Calcular ");
op=1;
while ((a=getch()) !=ESC)
{
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (25,7);
textbackground(RED);
cprintf ("Novedades");
textbackground(BLUE);
gotoxy(25,9);
cprintf("Calcular ");
op++;
break;
case 2: gotoxy (25,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(25,7);
cprintf("Novedades");
op++;
break;
case 3: gotoxy (25,9);
textbackground(RED);
cprintf ("Calcular ");
gotoxy(25,8);
textbackground(BLUE);
cprintf("Modificar");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (25,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(25,9);
cprintf("Calcular ");
op=3;
break;
case 2:gotoxy(25,9);
textbackground(RED);
cprintf("Calcular ");
textbackground(BLUE);
gotoxy(25,7);
cprintf("Novedades");
op--;
break;
case 3:gotoxy(25,7);
textbackground(RED);
cprintf("Novedades");
textbackground(BLUE);
gotoxy(25,8);
cprintf("Modificar");
op--;
break;
} // sw //
} //if
}//else
} //wh
break;
case 3: textbackground(BLUE);
coloreo(6,36,10,48,BROWN,219);
cuadro(6,36,10,48,15);
gotoxy(37,7);cprintf("Cons/emp ");
gotoxy(37,8);cprintf("Cons/rango ");
gotoxy(37,9);cprintf("Totales ");
op=1;
while ((a=getch()) !=ESC)
{
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (37,7);
textbackground(RED);
cprintf ("Cons/emp ");
textbackground(BLUE);
gotoxy(37,9);
cprintf("Totales ");
op++;
break;
case 2: gotoxy (37,8);
textbackground(RED);
cprintf ("Cons/rango");
textbackground(BLUE);
gotoxy(37,7);
cprintf("Cons/emp ");
op++;
break;
case 3:gotoxy (37,9);
textbackground(RED);
cprintf ("Totales ");
gotoxy(37,8);
textbackground(BLUE);
cprintf("Cons/rango");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (37,8);
textbackground(RED);
cprintf ("Cons/rango");
textbackground(BLUE);
gotoxy(37,9);
cprintf("Totales ");
op=3;
break;
case 2:gotoxy(37,9);
textbackground(RED);
cprintf("Totales ");
textbackground(BLUE);
gotoxy(37,7);
cprintf("Cons/emp ");
op--;
break;
case 3:gotoxy(37,7);
textbackground(RED);
cprintf("Cons/emp ");
textbackground(BLUE);
gotoxy(37,8);
cprintf("Cons/rango");
op--;
break;
} // sw
} //if
}//else
} //wh
break;
case 4: textbackground(BLUE);
coloreo(6,50,10,58,BROWN,219);
cuadro(6,50,10,58,15);
gotoxy(51,7);cprintf("Sistema");
gotoxy(51,8);cprintf("-------");
gotoxy(51,9);cprintf("Nomina ");
getch();
break;
case 5:textbackground(BLUE);
coloreo(6,67,8,75,BROWN,219);
cuadro(6,67,8,75,15);
gotoxy(68,7);
cprintf("Adios ");
getch();
break;
}
gotoxy(80,24);
}
void desplaza1(int opc)
{int a,op,b;
switch (opc)
{
case 1 : textbackground(BLUE);
coloreo(6,50,10,58,BROWN,219);
cuadro(6,50,10,58,15);
gotoxy(51,7);cprintf("Sistema");
gotoxy(51,8);cprintf("-------");
gotoxy(51,9);cprintf("Nomina ");
getch();
break;
case 2 : textbackground(BLUE);
coloreo(6,67,8,75,BROWN,219);
cuadro(6,67,8,75,15);
gotoxy(68,7);cprintf("Adios ");
getch();
break;
case 3:
textbackground(BLUE);
coloreo(6,9,10,19,BROWN,219);
cuadro(6,9,10,19,15);
gotoxy(10,7);cprintf("Ingreso ");
gotoxy(10,8);cprintf("Modificar");
gotoxy(10,9);cprintf("Consulta ");
op=1;
while ((a=getch()) !=ESC)
{
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (10,7);
textbackground(RED);
cprintf ("Ingreso ");
textbackground(BLUE);
gotoxy(10,9);
cprintf("Consulta ");
op++;
break;
case 2: gotoxy (10,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(10,7);
cprintf("Ingreso ");
op++;
break;
case 3:gotoxy (10,9);
textbackground(RED);
cprintf ("Consulta ");
gotoxy(10,8);
textbackground(BLUE);
cprintf("Modificar");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (10,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(10,9);
cprintf("Consulta ");
op=3;
break;
case 2:gotoxy(10,9);
textbackground(RED);
cprintf("Consulta ");
textbackground(BLUE);
gotoxy(10,7);
cprintf("Ingreso ");
op--;
break;
case 3:gotoxy(10,7);
textbackground(RED);
cprintf("Ingreso ");
textbackground(BLUE);
gotoxy(10,8);
cprintf("Modificar");
op--;
break;
} // sw
} //if
}//else
gotoxy(80,24);
} //wh
break;
case 4: textbackground(BLUE);
coloreo(6,24,10,34,BROWN,219);
cuadro(6,24,10,34,15);
gotoxy(25,7);cprintf("Novedades");
gotoxy(25,8);cprintf("Modificar");
gotoxy(25,9);cprintf("Calcular ");
op=1;
while ((a=getch()) !=ESC)
{
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (25,7);
textbackground(RED);
cprintf ("Novedades");
textbackground(BLUE);
gotoxy(25,9);
cprintf("Calcular ");
op++;
break;
case 2: gotoxy (25,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(25,7);
cprintf("Novedades");
op++;
break;
case 3:gotoxy (25,9);
textbackground(RED);
cprintf ("Calcular ");
gotoxy(25,8);
textbackground(BLUE);
cprintf("Modificar");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (25,8);
textbackground(RED);
cprintf ("Modificar");
textbackground(BLUE);
gotoxy(25,9);
cprintf("Calcular ");
op=3;
break;
case 2:gotoxy(25,9);
textbackground(RED);
cprintf("Calcular ");
textbackground(BLUE);
gotoxy(25,7);
cprintf("Novedades");
op--;
break;
case 3:gotoxy(25,7);
textbackground(RED);
cprintf("Novedades");
textbackground(BLUE);
gotoxy(25,8);
cprintf("Modificar");
op--;
break;
} // sw //
} //if
}//else
gotoxy(80,24);
} //wh
break;
case 5:textbackground(BLUE);
coloreo(6,36,10,48,BROWN,219);
cuadro(6,36,10,48,15);
gotoxy(37,7);
gotoxy(37,7);cprintf("Cons/emp ");
gotoxy(37,8);cprintf("Cons/rango ");
gotoxy(37,9);cprintf("Totales ");
op=1;
while ((a=getch()) !=ESC)
{
if (a==fdown)
{
switch (op)
{
case 1: gotoxy (37,7);
textbackground(RED);
cprintf ("Cons/emp");
textbackground(BLUE);
gotoxy(37,9);
cprintf("Totales");
op++;
break;
case 2: gotoxy (37,8);
textbackground(RED);
cprintf ("Cons/rango");
textbackground(BLUE);
gotoxy(37,7);
cprintf("Cons/emp");
op++;
break;
case 3:gotoxy (37,9);
textbackground(RED);
cprintf ("Totales");
gotoxy(37,8);
textbackground(BLUE);
cprintf("Cons/rango");
op=1;
break;
} // sw
gotoxy(80,24);
}
else
{
if(a==fup)
{
switch(op)
{case 1:gotoxy (37,8);
textbackground(RED);
cprintf ("Cons/rango");
textbackground(BLUE);
gotoxy(37,9);
cprintf("Totales");
op=3;
break;
case 2:gotoxy(37,9);
textbackground(RED);
cprintf("Totales");
textbackground(BLUE);
gotoxy(37,7);
cprintf("Cons/emp");
op--;
break;
case 3:gotoxy(37,7);
textbackground(RED);
cprintf("Cons/emp");
textbackground(BLUE);
gotoxy(37,8);
cprintf("Cons/rango");
op--;
break;
} // sw
} //if
}//else
gotoxy(80,24);
} //wh
break;
}
gotoxy(80,24);
}
void ingreso()
{ int i,cuant;
cprintf("Cuantos empleados?");
scanf("%d",&cuant);
//cuadro(1,1,23,80,BLUE);
for(i=0;i<=cuant;i++)
{
printf("Nombre:");
scanf("%s",&archivo[i].nombre);
printf("Apellido:");scanf("%s",&archivo[i].apellido);
printf("Codigo:");scanf("%s",&archivo[i].codigo);
printf("Direccion:");scanf("%s",&archivo[i].direccion);
printf("Telefono:");scanf("%s",&archivo[i].telefono);
printf("Sexo:");scanf("%s",&archivo[i].sexo);
printf("Edad:");scanf("%d",&archivo[i].edad);
printf("Numero de hijos:");scanf("%d",&archivo[i].numero_hijos);
printf("Estado civil:");scanf("%s",&archivo[i].estado_civil);
printf("Salario_basico:");scanf("%f",&archivo[i].sal_basico);
}
}
void saludo()
{
gotoxy(70,24);cprintf("Hola");
} | [
"[email protected]"
] | |
d5478e986b48883976a09d19e1d310378fce0673 | 590c960c77796d9f47b53c405fea07ec1153a0d3 | /Demo/DemoDlg.cpp | ef7283b1a40536169de6b52aeebc31cfa504b567 | [] | no_license | beyondmadman/ResLib | 5d7ec1469016f40d62e28c6b2922ee601025e940 | d067d5291d4717db9a7ee7d62ec15d4752bd4ed1 | refs/heads/master | 2022-11-22T15:27:46.447416 | 2020-07-20T07:37:49 | 2020-07-20T07:37:49 | 281,044,944 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 17,545 | cpp |
// DemoDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "Demo.h"
#include "DemoDlg.h"
#include "afxdialogex.h"
#include "ResLoad.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// CDemoDlg 对话框
CDemoDlg::CDemoDlg(CWnd* pParent /*=NULL*/)
: m_IsDrawForm(FALSE), m_ButtonState(bsNone), CDialog(IDD_DEMO_DIALOG, pParent)
{
//m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_hIcon = LoadICO(IDR_ICO_II);
m_FirstShow = FALSE;
m_IsMax = TRUE;
m_CapitonColor = RGB(0, 0, 255);
m_Caption = "系统登录";
}
void CDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_STC_USERNAME, m_lUsername);
DDX_Control(pDX, IDC_STC_PASSWORD, m_lPasswrod);
}
BEGIN_MESSAGE_MAP(CDemoDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_SIZE()
ON_WM_NCACTIVATE()
ON_WM_ACTIVATE()
ON_WM_NCMOUSEMOVE()
ON_WM_NCPAINT()
ON_WM_NCLBUTTONDOWN()
ON_WM_CREATE()
ON_WM_SHOWWINDOW()
ON_WM_CTLCOLOR()
ON_WM_NCLBUTTONDBLCLK()
ON_BN_CLICKED(ID_BTN_SIGNIN, OnBtnSignIn)
ON_BN_CLICKED(ID_BTN_SIGNOUT, OnBtnSignOut)
ON_WM_WINDOWPOSCHANGED()
END_MESSAGE_MAP()
// CDemoDlg 消息处理程序
BOOL CDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 将“关于...”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
m_BorderHeight = GetSystemMetrics(SM_CYBORDER);
m_BorderWidth = GetSystemMetrics(SM_CXBORDER);
m_CaptionHeight = GetSystemMetrics(SM_CYCAPTION);
//获取按钮位图大小
HBITMAP hBitmap;
CBitmap bitmap;
hBitmap = LoadBMP(IDR_BMP_FF);
bitmap.Attach(hBitmap);
BITMAPINFO bInfo;
bitmap.GetObject(sizeof(bInfo), &bInfo);
m_ButtonWidth = bInfo.bmiHeader.biWidth;
m_ButtonHeight = bInfo.bmiHeader.biHeight;
bitmap.DeleteObject();
CRect rect;
GetClientRect(rect);
m_IniRect.CopyRect(CRect(8, (m_CaptionHeight + 3 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_MinRect.CopyRect(CRect(rect.Width() - 45, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_MaxRect.CopyRect(CRect(rect.Width() - 32, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_CloseRect.CopyRect(CRect(rect.Width() - 19, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_CaptionFont.CreateFont(14, 10, 0, 0, 600, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_ROMAN, _T("宋体"));
DrawForm();
m_lUsername.ModifyStyleEx(0, WS_EX_TRANSPARENT);
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
void CDemoDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CDemoDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
DrawForm();
m_IsDrawForm = TRUE;
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CDemoDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CDemoDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
CRect rect;
GetClientRect(rect);
m_IniRect.CopyRect(CRect(8, (m_CaptionHeight + 3 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_MinRect.CopyRect(CRect(rect.Width() - 45, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_MaxRect.CopyRect(CRect(rect.Width() - 32, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
m_CloseRect.CopyRect(CRect(rect.Width() - 19, (m_CaptionHeight + 2 * m_BorderHeight - m_ButtonHeight) / 2, m_ButtonWidth, m_ButtonHeight));
Invalidate();
}
BOOL CDemoDlg::OnNcActivate(BOOL bActive)
{
OnPaint();
return CDialog::OnNcActivate(bActive);
}
void CDemoDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);
OnPaint();
}
void CDemoDlg::OnNcMouseMove(UINT nHitTest, CPoint point)
{
CDialog::OnNcMouseMove(nHitTest, point);
CRect tempIni, tempMin, tempMax, tempClose, ClientRect;
CDC* pWindowDC = GetWindowDC();
CDC memDC;
memDC.CreateCompatibleDC(pWindowDC);
BITMAPINFO bInfo;
HBITMAP hBitmap;
CBitmap LeftLine;
hBitmap = LoadBMP(IDR_BMP_GG);
int x, y;
GetWindowRect(ClientRect);
tempIni.CopyRect(CRect(m_IniRect.left + ClientRect.left, ClientRect.top + m_IniRect.top, m_IniRect.right + m_IniRect.left + ClientRect.left, m_IniRect.bottom + m_IniRect.top + ClientRect.top));
tempMin.CopyRect(CRect(m_MinRect.left + ClientRect.left, ClientRect.top + m_MinRect.top, m_MinRect.right + m_MinRect.left + ClientRect.left, m_MinRect.bottom + m_MinRect.top + ClientRect.top));
tempMax.CopyRect(CRect(m_MaxRect.left + ClientRect.left, ClientRect.top + m_MaxRect.top, m_MaxRect.right + m_MaxRect.left + ClientRect.left, m_MaxRect.bottom + m_MaxRect.top + ClientRect.top));
tempClose.CopyRect(CRect(m_CloseRect.left + ClientRect.left, ClientRect.top + m_CloseRect.top, m_CloseRect.right + m_CloseRect.left + ClientRect.left, m_CloseRect.bottom + m_CloseRect.top + ClientRect.top));
if (tempIni.PtInRect(point)) //鼠标在初始化按钮上移动时,更改按钮显示的位图
{
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bInfo), &bInfo);
x = bInfo.bmiHeader.biWidth;
y = bInfo.bmiHeader.biHeight;
memDC.SelectObject(&LeftLine);
pWindowDC->StretchBlt(m_IniRect.left, m_IniRect.top, m_IniRect.right, m_IniRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
m_IsDrawForm = FALSE;
m_ButtonState = bsIni;
LeftLine.DeleteObject();
}
else if (tempMin.PtInRect(point))//鼠标在最小化按钮上移动时,更改按钮显示的位图
{
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bInfo), &bInfo);
x = bInfo.bmiHeader.biWidth;
y = bInfo.bmiHeader.biHeight;
memDC.SelectObject(&LeftLine);
pWindowDC->StretchBlt(m_MinRect.left, m_MinRect.top, m_MinRect.right, m_MinRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
m_IsDrawForm = FALSE;
m_ButtonState = bsMin;
LeftLine.DeleteObject();
}
else if (tempMax.PtInRect(point))
{
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bInfo), &bInfo);
x = bInfo.bmiHeader.biWidth;
y = bInfo.bmiHeader.biHeight;
memDC.SelectObject(&LeftLine);
pWindowDC->StretchBlt(m_MaxRect.left, m_MaxRect.top, m_MaxRect.right, m_MaxRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
m_IsDrawForm = FALSE;
if (m_IsMax)
{
m_ButtonState = bsMax;
}
else
{
m_ButtonState = bsRes;
}
LeftLine.DeleteObject();
}
else if (tempClose.PtInRect(point))
{
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bInfo), &bInfo);
x = bInfo.bmiHeader.biWidth;
y = bInfo.bmiHeader.biHeight;
memDC.SelectObject(&LeftLine);
pWindowDC->StretchBlt(m_CloseRect.left, m_CloseRect.top, m_CloseRect.right, m_CloseRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
m_IsDrawForm = FALSE;
m_ButtonState = bsClose;
LeftLine.DeleteObject();
}
else
{
m_ButtonState = bsNone;
if (m_IsDrawForm == FALSE)
DrawForm();
// m_IsDrawForm = TRUE;
}
ReleaseDC(&memDC);
}
void CDemoDlg::DrawForm()
{
//获取窗口设备上下文
CDC* pWindowDC = GetWindowDC();
HBITMAP hBitmap;
CBitmap LeftLine;
hBitmap = LoadBMP(IDR_BMP_CC);
BITMAPINFO bitinfo;
CDC memDC;
memDC.CreateCompatibleDC(pWindowDC);
CRect Clientrect;
GetClientRect(Clientrect);
int leftwidth = 0; //左标题的宽度
int rightwidth = 0; //右标题的宽度
int leftlinewidth = 0; //左边线宽度
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
rightwidth = bitinfo.bmiHeader.biWidth;
LeftLine.DeleteObject();
int x, y;
//绘制左边线
//获取位图大小
hBitmap = LoadBMP(IDR_BMP_DD);
LeftLine.Attach(hBitmap);
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
leftlinewidth = x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
memDC.SelectObject(&LeftLine);
pWindowDC->StretchBlt(1 - m_BorderWidth, m_CaptionHeight + 1, x + 1, Clientrect.Height() + 2 * m_BorderHeight + 5, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制左标题**************************************/
hBitmap = LoadBMP(IDR_BMP_BB);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
leftwidth = x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(-m_BorderWidth, 0, x, m_CaptionHeight + 4, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制左标题**************************************/
/*****************************绘制中间标题**************************************/
hBitmap = LoadBMP(IDR_BMP_AA);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(leftwidth - 1, 0, Clientrect.Width() - leftwidth - rightwidth, m_CaptionHeight + 4, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制中间标题***************************************/
/*****************************绘制右标题**************************************/
hBitmap = LoadBMP(IDR_BMP_CC);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(Clientrect.Width() - x - 1, 0, x + m_BorderWidth + 9, m_CaptionHeight + 4, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制右标题***************************************/
/*****************************绘制右边框**************************************/
hBitmap = LoadBMP(IDR_BMP_DD);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(Clientrect.Width() + m_BorderWidth + 2, m_CaptionHeight + 1, x + m_BorderWidth, Clientrect.Height() + 2 * m_BorderHeight + 5, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制右边框***************************************/
/*****************************绘制底边框**************************************/
hBitmap = LoadBMP(IDR_BMP_EE);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(leftlinewidth - m_BorderWidth, Clientrect.Height() + m_CaptionHeight + 2, Clientrect.Width() + m_BorderWidth, y + 2, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制底边框***************************************/
/*****************************绘制初始化按钮**************************************/
hBitmap = LoadBMP(IDR_BMP_FF);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(m_IniRect.left, m_IniRect.top, m_IniRect.right, m_IniRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制初始化按钮***************************************/
/*****************************绘制最小化按钮**************************************/
hBitmap = LoadBMP(IDR_BMP_FF);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(m_MinRect.left, m_MinRect.top, m_MinRect.right, m_MinRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制最小化按钮***************************************/
/*****************************绘制最大化按钮**************************************/
hBitmap = LoadBMP(IDR_BMP_FF);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(m_MaxRect.left, m_MaxRect.top, m_MaxRect.right, m_MaxRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
/*****************************绘制最大化按钮***************************************/
/*****************************绘制关闭按钮**************************************/
hBitmap = LoadBMP(IDR_BMP_FF);
LeftLine.Attach(hBitmap);
//获取位图大小
LeftLine.GetObject(sizeof(bitinfo), &bitinfo);
memDC.SelectObject(&LeftLine);
x = bitinfo.bmiHeader.biWidth;
y = bitinfo.bmiHeader.biHeight;
pWindowDC->StretchBlt(m_CloseRect.left, m_CloseRect.top, m_CloseRect.right, m_CloseRect.bottom, &memDC, 0, 0, x, y, SRCCOPY);
LeftLine.DeleteObject();
m_IsDrawForm = TRUE;
/*****************************绘制关闭按钮***************************************/
ReleaseDC(&memDC);
DrawFormCaption();
}
void CDemoDlg::OnNcPaint()
{
DrawForm();
m_IsDrawForm = TRUE;
}
void CDemoDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
CDialog::OnNcLButtonDown(nHitTest, point);
switch (m_ButtonState)
{
case bsClose: //关闭窗口
{
DestroyWindow();
}
break;
case bsIni: //还原窗口到初始大小和位置
{
m_IsMax = TRUE;
MoveWindow(m_OrigonRect.left, m_OrigonRect.top, m_OrigonRect.Width(), m_OrigonRect.Height());
}
break;
case bsMin: //
{
CWnd* pDesk = GetDesktopWindow();
CRect rect;
pDesk->GetClientRect(rect);
SetWindowPos(0, (rect.Width() - m_OrigonRect.Width()) / 2, 2, m_OrigonRect.Width(), 0, SWP_SHOWWINDOW);
}
break;
case bsMax:
{
m_ButtonState = bsMax;
ShowWindow(SW_SHOWMAXIMIZED);
m_IsMax = FALSE;
}
break;
case bsRes:
{
ShowWindow(SW_RESTORE);
m_IsMax = TRUE;
}
break;
}
}
int CDemoDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
{
return -1;
}
return 0;
}
void CDemoDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if (m_FirstShow == FALSE)
{
m_FirstShow = TRUE;
GetWindowRect(m_OrigonRect);
}
}
HBRUSH CDemoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
//绘制背景
if (nCtlColor == CTLCOLOR_DLG)
{
HBITMAP hBitmap;
CBitmap bitmap;
hBitmap = LoadBMP(IDR_BMP_HH);
bitmap.Attach(hBitmap);
CBrush brush(&bitmap);
CRect rect;
GetClientRect(rect);
pDC->SelectObject(&brush);
bitmap.DeleteObject();
pDC->FillRect(rect, &brush);
return brush;
}
else if (nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);
}
else
{
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
}
void CDemoDlg::DrawFormCaption()
{
if (!m_Caption.IsEmpty())
{
CDC* pDC = GetWindowDC();
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(m_CapitonColor);
pDC->SetTextAlign(TA_CENTER);
CRect rect;
GetClientRect(rect);
pDC->SelectObject(&m_CaptionFont);
pDC->TextOut(rect.Width() / 2, m_CaptionHeight / 3, m_Caption);
}
}
//阻止用户双击标题栏
void CDemoDlg::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
{
//CDialog::OnNcLButtonDblClk(nHitTest, point);
}
void CDemoDlg::OnBtnSignIn()
{
}
void CDemoDlg::OnBtnSignOut()
{
DestroyWindow();
}
void CDemoDlg::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
CDialog::OnWindowPosChanged(lpwndpos);
}
| [
"[email protected]"
] | |
0df04844482c22de10899109c2432e29e62107cd | 57de0787f7cee17ab1aaa48b919505f25ce11d80 | /src/qt/transactiondesc.cpp | b268e37b64dd914dedce80a7431ade34628295d2 | [
"MIT"
] | permissive | xcobary/xcoin | 791b843581e847c39a8fb65ef02004983c8f66ea | 946cae5c0354855b3ba4c3da79f80e5d5b8a8f77 | refs/heads/master | 2020-12-03T02:07:50.379876 | 2017-06-30T20:03:50 | 2017-06-30T20:03:50 | 95,906,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,712 | cpp | #include "transactiondesc.h"
#include "guiutil.h"
#include "xunits.h"
#include "main.h"
#include "wallet.h"
#include "../db.h"
#include "ui_interface.h"
#include "base58.h"
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
{
if (!wtx.IsFinal())
{
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
return tr("Open for %n block(s)", "", nBestHeight - wtx.nLockTime);
else
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime));
}
else
{
int nDepth = wtx.GetDepthInMainChain();
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/offline").arg(nDepth);
else if (nDepth < 6)
return tr("%1/unconfirmed").arg(nDepth);
else
return tr("%1 confirmations").arg(nDepth);
}
}
QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
{
QString strHTML;
{
LOCK(wallet->cs_wallet);
strHTML.reserve(4000);
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
int64 nTime = wtx.GetTxTime();
mpq nCredit = wtx.GetCredit(wtx.nRefHeight);
mpq nDebit = wtx.GetDebit(wtx.nRefHeight);
mpq nNet = nCredit - nDebit;
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
int nRequests = wtx.GetRequestCount();
if (nRequests != -1)
{
if (nRequests == 0)
strHTML += tr(", has not been successfully broadcast yet");
else if (nRequests > 0)
strHTML += tr(", broadcast through %n node(s)", "", nRequests);
}
strHTML += "<br>";
strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>";
//
// From
//
if (wtx.IsCoinBase())
{
strHTML += "<b>" + tr("Source") + ":</b> " + tr("Generated") + "<br>";
}
else if (wtx.mapValue.count("from") && !wtx.mapValue["from"].empty())
{
// Online transaction
strHTML += "<b>" + tr("From") + ":</b> " + GUIUtil::HtmlEscape(wtx.mapValue["from"]) + "<br>";
}
else
{
// Offline transaction
if (nNet > 0)
{
// Credit
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (wallet->IsMine(txout))
{
CTxDestination address;
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
{
if (wallet->mapAddressBook.count(address))
{
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
strHTML += "<b>" + tr("To") + ":</b> ";
strHTML += GUIUtil::HtmlEscape(CXcoinAddress(address).ToString());
if (!wallet->mapAddressBook[address].empty())
strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + ")";
else
strHTML += " (" + tr("own address") + ")";
strHTML += "<br>";
}
}
break;
}
}
}
}
//
// To
//
if (wtx.mapValue.count("to") && !wtx.mapValue["to"].empty())
{
// Online transaction
std::string strAddress = wtx.mapValue["to"];
strHTML += "<b>" + tr("To") + ":</b> ";
CTxDestination dest = CXcoinAddress(strAddress).Get();
if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].empty())
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest]) + " ";
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
}
//
// Amount
//
if (wtx.IsCoinBase() && nCredit == 0)
{
//
// Coinbase
//
mpq nUnmatured = 0;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += wallet->GetCredit(wtx,txout,wtx.nRefHeight);
strHTML += "<b>" + tr("Credit") + ":</b> ";
if (wtx.IsInMainChain())
strHTML += XcoinUnits::formatWithUnit(XcoinUnits::XCN, nUnmatured)+ " (" + tr("matures in %n more block(s)", "", wtx.GetBlocksToMaturity()) + ")";
else
strHTML += "(" + tr("not accepted") + ")";
strHTML += "<br>";
}
else if (nNet > 0)
{
//
// Credit
//
strHTML += "<b>" + tr("Credit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, nNet) + "<br>";
}
else
{
bool fAllFromMe = true;
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
fAllFromMe = fAllFromMe && wallet->IsMine(txin);
bool fAllToMe = true;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
fAllToMe = fAllToMe && wallet->IsMine(txout);
if (fAllFromMe)
{
//
// Debit
//
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (wallet->IsMine(txout))
continue;
if (!wtx.mapValue.count("to") || wtx.mapValue["to"].empty())
{
// Offline transaction
CTxDestination address;
if (ExtractDestination(txout.scriptPubKey, address))
{
strHTML += "<b>" + tr("To") + ":</b> ";
if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty())
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " ";
strHTML += GUIUtil::HtmlEscape(CXcoinAddress(address).ToString());
strHTML += "<br>";
}
}
strHTML += "<b>" + tr("Debit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, -GetPresentValue(wtx, txout, wtx.nRefHeight)) + "<br>";
}
if (fAllToMe)
{
// Payment to self
mpq nChange = wtx.GetChange(wtx.nRefHeight);
mpq nValue = nCredit - nChange;
strHTML += "<b>" + tr("Debit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, -nValue) + "<br>";
strHTML += "<b>" + tr("Credit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, nValue) + "<br>";
}
mpq nTxFee = nDebit - wtx.GetValueOut();
if (nTxFee > 0)
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, -nTxFee) + "<br>";
}
else
{
//
// Mixed debit transaction
//
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
if (wallet->IsMine(txin))
strHTML += "<b>" + tr("Debit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, -wallet->GetDebit(txin,wtx.nRefHeight)) + "<br>";
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
if (wallet->IsMine(txout))
strHTML += "<b>" + tr("Credit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, wallet->GetCredit(wtx,txout,wtx.nRefHeight)) + "<br>";
}
}
strHTML += "<b>" + tr("Net amount") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, nNet, true) + "<br>";
//
// Message
//
if (wtx.mapValue.count("message") && !wtx.mapValue["message"].empty())
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["message"], true) + "<br>";
if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
strHTML += "<b>" + tr("Reference Height") + ":</b> " + QString("%1").arg(wtx.nRefHeight) + "<br>";
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + wtx.GetHash().ToString().c_str() + "<br>";
if (wtx.IsCoinBase())
strHTML += "<br>" + tr("Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to \"not accepted\" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
//
// Debug view
//
if (fDebug)
{
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
if(wallet->IsMine(txin))
strHTML += "<b>" + tr("Debit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, -wallet->GetDebit(txin,wtx.nRefHeight)) + "<br>";
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
if(wallet->IsMine(txout))
strHTML += "<b>" + tr("Credit") + ":</b> " + XcoinUnits::formatWithUnit(XcoinUnits::XCN, wallet->GetCredit(wtx,txout,wtx.nRefHeight)) + "<br>";
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
strHTML += GUIUtil::HtmlEscape(wtx.ToString(), true);
CTxDB txdb("r"); // To fetch source txouts
strHTML += "<br><b>" + tr("Inputs") + ":</b>";
strHTML += "<ul>";
{
LOCK(wallet->cs_wallet);
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
{
COutPoint prevout = txin.prevout;
CTransaction prev;
if(txdb.ReadDiskTx(prevout.hash, prev))
{
if (prevout.n < prev.vout.size())
{
strHTML += "<li>";
const CTxOut &vout = prev.vout[prevout.n];
CTxDestination address;
if (ExtractDestination(vout.scriptPubKey, address))
{
if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty())
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " ";
strHTML += QString::fromStdString(CXcoinAddress(address).ToString());
}
strHTML = strHTML + " " + tr("Amount") + "=" + XcoinUnits::formatWithUnit(XcoinUnits::XCN, GetPresentValue(wtx, vout, wtx.nRefHeight));
strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) ? tr("true") : tr("false")) + "</li>";
}
}
}
}
strHTML += "</ul>";
}
strHTML += "</font></html>";
}
return strHTML;
}
| [
"[email protected]"
] | |
07d4d3afa4153dde5e299a253a323bf82b9a6a31 | a8dead89e139e09733d559175293a5d3b2aef56c | /src/addons/MyGUI/Extends/MessageBoxStyle.h | beca957e8063222fa45675f6273ef186f865c0cd | [
"MIT"
] | permissive | riyanhax/Demi3D | 4f3a48e6d76462a998b1b08935b37d8019815474 | 73e684168bd39b894f448779d41fab600ba9b150 | refs/heads/master | 2021-12-04T06:24:26.642316 | 2015-01-29T22:06:00 | 2015-01-29T22:06:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,716 | h | /*!
@file
@author Albert Semenov
@date 10/2010
*/
#ifndef __MESSAGE_BOX_STYLE_H__
#define __MESSAGE_BOX_STYLE_H__
#include <MyGUI.h>
namespace MyGUI
{
struct MessageBoxStyle
{
enum Enum
{
None = MYGUI_FLAG_NONE,
Ok = MYGUI_FLAG(0),
Yes = MYGUI_FLAG(1),
No = MYGUI_FLAG(2),
Abort = MYGUI_FLAG(3),
Retry = MYGUI_FLAG(4),
Ignore = MYGUI_FLAG(5),
Cancel = MYGUI_FLAG(6),
Try = MYGUI_FLAG(7),
Continue = MYGUI_FLAG(8),
_IndexUserButton1 = 9, // индекс первой кнопки юзера
Button1 = MYGUI_FLAG(_IndexUserButton1),
Button2 = MYGUI_FLAG(_IndexUserButton1 + 1),
Button3 = MYGUI_FLAG(_IndexUserButton1 + 2),
Button4 = MYGUI_FLAG(_IndexUserButton1 + 3),
_CountUserButtons = 4, // колличество кнопок юзера
_IndexIcon1 = _IndexUserButton1 + _CountUserButtons, // индекс первой иконки
IconDefault = MYGUI_FLAG(_IndexIcon1),
IconInfo = MYGUI_FLAG(_IndexIcon1),
IconQuest = MYGUI_FLAG(_IndexIcon1 + 1),
IconError = MYGUI_FLAG(_IndexIcon1 + 2),
IconWarning = MYGUI_FLAG(_IndexIcon1 + 3),
Icon1 = MYGUI_FLAG(_IndexIcon1),
Icon2 = MYGUI_FLAG(_IndexIcon1 + 1),
Icon3 = MYGUI_FLAG(_IndexIcon1 + 2),
Icon4 = MYGUI_FLAG(_IndexIcon1 + 3),
Icon5 = MYGUI_FLAG(_IndexIcon1 + 4),
Icon6 = MYGUI_FLAG(_IndexIcon1 + 5),
Icon7 = MYGUI_FLAG(_IndexIcon1 + 6),
Icon8 = MYGUI_FLAG(_IndexIcon1 + 7)
};
MessageBoxStyle(Enum _value = None) :
value(_value)
{
}
MessageBoxStyle& operator |= (MessageBoxStyle const& _other)
{
value = Enum(int(value) | int(_other.value));
return *this;
}
friend MessageBoxStyle operator | (Enum const& a, Enum const& b)
{
return MessageBoxStyle(Enum(int(a) | int(b)));
}
MessageBoxStyle operator | (Enum const& a)
{
return MessageBoxStyle(Enum(int(value) | int(a)));
}
friend bool operator == (MessageBoxStyle const& a, MessageBoxStyle const& b)
{
return a.value == b.value;
}
friend bool operator != (MessageBoxStyle const& a, MessageBoxStyle const& b)
{
return a.value != b.value;
}
friend std::ostream& operator << (std::ostream& _stream, const MessageBoxStyle& _value)
{
//_stream << _value.print();
return _stream;
}
friend std::istream& operator >> (std::istream& _stream, MessageBoxStyle& _value)
{
std::string val;
_stream >> val;
_value = parse(val);
return _stream;
}
// возвращает индекс иконки
size_t getIconIndex()
{
size_t index = 0;
int num = value >> _IndexIcon1;
while (num != 0)
{
if ((num & 1) == 1)
return index;
++index;
num >>= 1;
}
return ITEM_NONE;
}
// возвращает индекс иконки
size_t getButtonIndex()
{
size_t index = 0;
int num = value;
while (num != 0)
{
if ((num & 1) == 1)
return index;
++index;
num >>= 1;
}
return ITEM_NONE;
}
// возвращает список кнопок
std::vector<MessageBoxStyle> getButtons()
{
std::vector<MessageBoxStyle> buttons;
size_t index = 0;
int num = value;
while (index < _IndexIcon1)
{
if ((num & 1) == 1)
{
buttons.push_back(MessageBoxStyle::Enum( MYGUI_FLAG(index)));
}
++index;
num >>= 1;
}
return buttons;
}
typedef std::map<std::string, int> MapAlign;
static MessageBoxStyle parse(const std::string& _value)
{
MessageBoxStyle result(MessageBoxStyle::Enum(0));
const MapAlign& map_names = result.getValueNames();
const std::vector<std::string>& vec = utility::split(_value);
for (size_t pos = 0; pos < vec.size(); pos++)
{
MapAlign::const_iterator iter = map_names.find(vec[pos]);
if (iter != map_names.end())
{
result.value = Enum(int(result.value) | int(iter->second));
}
else
{
MYGUI_LOG(Warning, "Cannot parse type '" << vec[pos] << "'");
}
}
return result;
}
private:
const MapAlign& getValueNames()
{
static MapAlign map_names;
if (map_names.empty())
{
MYGUI_REGISTER_VALUE(map_names, None);
MYGUI_REGISTER_VALUE(map_names, Ok);
MYGUI_REGISTER_VALUE(map_names, Yes);
MYGUI_REGISTER_VALUE(map_names, No);
MYGUI_REGISTER_VALUE(map_names, Abort);
MYGUI_REGISTER_VALUE(map_names, Retry);
MYGUI_REGISTER_VALUE(map_names, Ignore);
MYGUI_REGISTER_VALUE(map_names, Cancel);
MYGUI_REGISTER_VALUE(map_names, Try);
MYGUI_REGISTER_VALUE(map_names, Continue);
MYGUI_REGISTER_VALUE(map_names, Button1);
MYGUI_REGISTER_VALUE(map_names, Button2);
MYGUI_REGISTER_VALUE(map_names, Button3);
MYGUI_REGISTER_VALUE(map_names, Button4);
MYGUI_REGISTER_VALUE(map_names, IconDefault);
MYGUI_REGISTER_VALUE(map_names, IconInfo);
MYGUI_REGISTER_VALUE(map_names, IconQuest);
MYGUI_REGISTER_VALUE(map_names, IconError);
MYGUI_REGISTER_VALUE(map_names, IconWarning);
MYGUI_REGISTER_VALUE(map_names, Icon1);
MYGUI_REGISTER_VALUE(map_names, Icon2);
MYGUI_REGISTER_VALUE(map_names, Icon3);
MYGUI_REGISTER_VALUE(map_names, Icon4);
MYGUI_REGISTER_VALUE(map_names, Icon5);
MYGUI_REGISTER_VALUE(map_names, Icon6);
MYGUI_REGISTER_VALUE(map_names, Icon7);
MYGUI_REGISTER_VALUE(map_names, Icon8);
}
return map_names;
}
private:
Enum value;
};
} // namespace MyGUI
#endif // __MESSAGE_BOX_STYLE_H__
| [
"[email protected]"
] | |
2e59f8a6b767576bf6ce33017a2eedb31b9629b4 | 3c103fd7cf4caf65e603b0256b0bf0a15216c98c | /include/Driver.h | f028b28c57987c0e42aef5a1dfc91fddd123f49a | [] | no_license | ewolfers/SDL-Experimental | ae03694328e83a748658b55f6cfba17f74f8602b | 8152e831ef9fdb841648b99483713eb9ced13978 | refs/heads/master | 2021-01-25T08:48:40.762660 | 2013-08-01T06:08:14 | 2013-08-01T06:08:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 177 | h | #ifndef _DRIVER_H_
#define _DRIVER_H_
#include "SDL2/SDL.h"
#include "Error.h"
class Driver {
public:
Driver(Uint32 flags = 0) throw(Error);
virtual ~Driver();
};
#endif | [
"[email protected]"
] | |
55c890c38914c9aa0214d2f56252373a2dd44c4a | bc5abd5765233ec72e964d816745fde4c32d9e03 | /bmp2c/bmp2c.cpp | f4ba1479783557dbe042c613155775e2cf33742c | [] | no_license | bigtruck/console_tools | eb4060215924b76cc0fdef50125fe7d091e2830f | 891a94346d59191a8a12a601eb45960a7d8d95f1 | refs/heads/master | 2020-06-26T09:26:36.864680 | 2019-08-25T13:18:55 | 2019-08-25T13:18:55 | 199,595,801 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,133 | cpp | #include <iostream>
#include <fstream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
using namespace std;
int convertDepth(const cv::Mat img);
int main(int argc, char const *argv[])
{
cout << "!!!TOOL BY xiaoyong!!!" << endl;
if(argc < 2)
{
cout << "缺少参数" << endl;
for (int i = 1; i < argc; i++)
{
cout << "argv-" << i << ' ' << argv[i] << endl;
}
return -1;
}
char buffer[255];
// cout << "!hello word!" << endl;
// cv::Mat imgInput = cv::imread("/Users/XiaoYong/Projects/console_tool/bmp2c/test.bmp");
string inName = argv[1];
cv::Mat imgInput = cv::imread(inName);
// cv::imshow("test",imgInput);
cv::Mat imgBGR565 ;
cv::Mat imgRGB ;
cv::cvtColor(imgInput,imgBGR565,cv::COLOR_BGR2BGR565);
// cout << "bgr565 data:\r\n" << imgBGR565 << endl ;
if(imgInput.type() == CV_8UC3)
{
int w = imgBGR565.cols;
int h = imgBGR565.rows;
int byteLength = w * h * 2 ;
uchar *pIndex = imgBGR565.ptr() ;
// cout << "\r\nimgBGR565:\r\n" << imgBGR565 << "\r\n" << endl ;
int cnt = 0 ;
int bl,bh;
unsigned short rgb;
int l ;
cout << "x size:" << w << endl ;
cout << "y size:" << h << endl ;
if(byteLength > 0)
{
string outName ;
if(argc > 2)
{
outName = argv[2];
}
else
{
string str = argv[1];
size_t found = str.find_last_of('.');
outName = str.substr(0,found);
outName += ".h";
}
ofstream outFile(outName,ios::binary | ios::out);
if(!outFile)
{
cout << "connot create out file !!!" << endl ;
}
else
{
outFile.seekp(outFile.beg);
string name ;
size_t i = inName.find_last_of('/');
size_t d = inName.find_last_of('.');
if(d >= inName.length())
{
d = inName.length() ;
}
name = inName.substr(i+1,d-i-1);
for (int j = 0; j < name.length(); j++)
{
name[j] = toupper(name[j]);
}
l = sprintf(buffer,"#ifndef __%s_H\r\n#define __%s_H\r\n",name.data(),name.data());
outFile.write(buffer,l);
l = sprintf(buffer,"\r\n#define BMP_X_SIZE_%s\t\t\t%d\r\n",name.data(),w);
outFile.write(buffer,l);
l = sprintf(buffer,"#define BMP_Y_SIZE_%s\t\t\t%d\r\n",name.data(),h);
outFile.write(buffer,l);
l = sprintf(buffer,"\r\nconst unsigned short bmp_%s[]={\r\n",name.data());
outFile.write(buffer,l);
while(cnt < byteLength)
{
bl = *pIndex++;
bh = *pIndex++;
rgb = bl | (bh << 8) ;
l = sprintf(buffer,"0x%04x,",rgb) ;
outFile.write(buffer,l);
cnt += 2;
if((cnt % (w*2)) == 0)
{
outFile.write("\r\n",2);
}
}
outFile.write("\r\n};\r\n\r\n#endif\r\n",16);
outFile.close();
cout << "convert done ^_^ " << endl;
}
}
else
{
cout << "Data error !!!" << endl ;
}
}
else
{
cout << "this image format not support !!!" << endl ;
}
//cv::waitKey();
// cv::Mat img_bgr565 ;
// cv::Mat img_rgb565 ;
// cv::cvtColor(imgInput,img_bgr565,cv::COLOR_BGR2BGR565);
// cv::cvtColor(img_bgr565,img_rgb565,cv::COLOR_BGR5652RGB);
// cv::imshow("rgb",img_rgb565);
// cout << "img depth:" << img_rgb565.depth() << endl;
// cout << "img_out" << img_rgb565 << endl ;
// cv::waitKey();
// cv::Mat imgbgr888(3,3,CV_8UC3,cv::Scalar(0,255,255));
// cout << "show 888" << endl ;
// cout << imgbgr888 << endl ;
// cv::Mat imgbgr565;
// cv::cvtColor(imgbgr888,imgbgr565,cv::COLOR_BGR2BGR565);
// cout << "show 565" << endl ;
// cout << imgbgr565 << endl ;
return 0;
}
int convertDepth(const cv::Mat img)
{
int type = img.type() ;
cv::Mat imgRGB,imgBGR565 ;
cv::cvtColor(img,imgBGR565,cv::COLOR_BGR2BGR565);
cv::cvtColor(imgBGR565,imgRGB,cv::COLOR_BGR2RGB);
switch (type)
{
case CV_8UC1:
cout << "image type CV_8UC1" << endl ;
cout << "not support!!!" << endl ;
break;
case CV_8UC2:
cout << "image type CV_8UC2" << endl ;
cout << "not support!!!" << endl ;
break;
case CV_8UC3:
cout << "image type CV_8UC3" << endl ;
cout << imgRGB << endl ;
break;
case CV_8UC4:
cout << "image type CV_8UC4" << endl ;
cout << "not support!!!" << endl ;
break;
default:
break;
}
return 0;
}
| [
"[email protected]"
] | |
f8c6e14f187abff5539d048de75301aee723b3b6 | 2a9741c2d772285d94b655735706236ee93e5874 | /LearnOGL/Colors.cpp | 33979b1c03800014ea7279d38a91635414df44e8 | [] | no_license | MDNobu/MyOGLExercise | 4ce696775f88736386dd0ebc3ff2a91a939f14ce | 90cdc1e08d6fead5f813d669569ae1421864b4c6 | refs/heads/master | 2023-06-23T19:32:02.078578 | 2021-07-16T17:37:41 | 2021-07-16T17:37:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,890 | cpp | //#include <glad/glad.h>
//#include <GLFW/glfw3.h>
//
//#include <glm/glm.hpp>
//#include <glm/gtc/matrix_transform.hpp>
//#include <glm/gtc/type_ptr.hpp>
//
////#include <learnopengl/shader_m.h>
////#include <camera.h>
//#include "camera.h"
//#include "Shader.h"
//
//#include <iostream>
//
//void framebuffer_size_callback(GLFWwindow* window, int width, int height);
//void mouse_callback(GLFWwindow* window, double xpos, double ypos);
//void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
//void processInput(GLFWwindow* window);
//
//// settings
//const unsigned int SCR_WIDTH = 800;
//const unsigned int SCR_HEIGHT = 600;
//
//// camera
//Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
//float lastX = SCR_WIDTH / 2.0f;
//float lastY = SCR_HEIGHT / 2.0f;
//bool firstMouse = true;
//
//// timing
//float deltaTime = 0.0f;
//float lastFrame = 0.0f;
//
//// lighting
//glm::vec3 lightPos(1.2f, 1.0f, 2.0f);
//
//int TestColors()
//{
// // glfw: initialize and configure
// // ------------------------------
// glfwInit();
// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
// glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
//
//
//
// // glfw window creation
// // --------------------
// GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
// if (window == NULL)
// {
// std::cout << "Failed to create GLFW window" << std::endl;
// glfwTerminate();
// return -1;
// }
// glfwMakeContextCurrent(window);
// glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
// glfwSetCursorPosCallback(window, mouse_callback);
// glfwSetScrollCallback(window, scroll_callback);
//
// // tell GLFW to capture our mouse
// glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
//
// // glad: load all OpenGL function pointers
// // ---------------------------------------
// if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
// {
// std::cout << "Failed to initialize GLAD" << std::endl;
// return -1;
// }
//
// // configure global opengl state
// // -----------------------------
// glEnable(GL_DEPTH_TEST);
//
// // build and compile our shader zprogram
// // ------------------------------------
// Shader lightingShader("1.colors.vs", "1.colors.fs");
// Shader lightCubeShader("1.light_cube.vs", "1.light_cube.fs");
//
// // set up vertex data (and buffer(s)) and configure vertex attributes
// // ------------------------------------------------------------------
// float vertices[] = {
// -0.5f, -0.5f, -0.5f,
// 0.5f, -0.5f, -0.5f,
// 0.5f, 0.5f, -0.5f,
// 0.5f, 0.5f, -0.5f,
// -0.5f, 0.5f, -0.5f,
// -0.5f, -0.5f, -0.5f,
//
// -0.5f, -0.5f, 0.5f,
// 0.5f, -0.5f, 0.5f,
// 0.5f, 0.5f, 0.5f,
// 0.5f, 0.5f, 0.5f,
// -0.5f, 0.5f, 0.5f,
// -0.5f, -0.5f, 0.5f,
//
// -0.5f, 0.5f, 0.5f,
// -0.5f, 0.5f, -0.5f,
// -0.5f, -0.5f, -0.5f,
// -0.5f, -0.5f, -0.5f,
// -0.5f, -0.5f, 0.5f,
// -0.5f, 0.5f, 0.5f,
//
// 0.5f, 0.5f, 0.5f,
// 0.5f, 0.5f, -0.5f,
// 0.5f, -0.5f, -0.5f,
// 0.5f, -0.5f, -0.5f,
// 0.5f, -0.5f, 0.5f,
// 0.5f, 0.5f, 0.5f,
//
// -0.5f, -0.5f, -0.5f,
// 0.5f, -0.5f, -0.5f,
// 0.5f, -0.5f, 0.5f,
// 0.5f, -0.5f, 0.5f,
// -0.5f, -0.5f, 0.5f,
// -0.5f, -0.5f, -0.5f,
//
// -0.5f, 0.5f, -0.5f,
// 0.5f, 0.5f, -0.5f,
// 0.5f, 0.5f, 0.5f,
// 0.5f, 0.5f, 0.5f,
// -0.5f, 0.5f, 0.5f,
// -0.5f, 0.5f, -0.5f,
// };
// // first, configure the cube's VAO (and VBO)
// unsigned int VBO, cubeVAO;
// glGenVertexArrays(1, &cubeVAO);
// glGenBuffers(1, &VBO);
//
// glBindBuffer(GL_ARRAY_BUFFER, VBO);
// glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
//
// glBindVertexArray(cubeVAO);
//
// // position attribute
// glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
// glEnableVertexAttribArray(0);
//
// // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)
// unsigned int lightCubeVAO;
// glGenVertexArrays(1, &lightCubeVAO);
// glBindVertexArray(lightCubeVAO);
//
// // we only need to bind to the VBO (to link it with glVertexAttribPointer), no need to fill it; the VBO's data already contains all we need (it's already bound, but we do it again for educational purposes)
// glBindBuffer(GL_ARRAY_BUFFER, VBO);
//
// glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
// glEnableVertexAttribArray(0);
//
//
// // render loop
// // -----------
// while (!glfwWindowShouldClose(window))
// {
// // per-frame time logic
// // --------------------
// float currentFrame = glfwGetTime();
// deltaTime = currentFrame - lastFrame;
// lastFrame = currentFrame;
//
// // input
// // -----
// processInput(window);
//
// // render
// // ------
// glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//
// // be sure to activate shader when setting uniforms/drawing objects
// lightingShader.use();
// lightingShader.setVec3("objectColor", 1.0f, 0.5f, 0.31f);
// lightingShader.setVec3("lightColor", 1.0f, 1.0f, 1.0f);
//
// // view/projection transformations
// glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
// glm::mat4 view = camera.GetViewMatrix();
// lightingShader.setMat4("projection", projection);
// lightingShader.setMat4("view", view);
//
// // world transformation
// glm::mat4 model = glm::mat4(1.0f);
// lightingShader.setMat4("model", model);
//
// // render the cube
// glBindVertexArray(cubeVAO);
// glDrawArrays(GL_TRIANGLES, 0, 36);
//
//
// // also draw the lamp object
// lightCubeShader.use();
// lightCubeShader.setMat4("projection", projection);
// lightCubeShader.setMat4("view", view);
// model = glm::mat4(1.0f);
// model = glm::translate(model, lightPos);
// model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
// lightCubeShader.setMat4("model", model);
//
// glBindVertexArray(lightCubeVAO);
// glDrawArrays(GL_TRIANGLES, 0, 36);
//
//
// // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
// // -------------------------------------------------------------------------------
// glfwSwapBuffers(window);
// glfwPollEvents();
// }
//
// // optional: de-allocate all resources once they've outlived their purpose:
// // ------------------------------------------------------------------------
// glDeleteVertexArrays(1, &cubeVAO);
// glDeleteVertexArrays(1, &lightCubeVAO);
// glDeleteBuffers(1, &VBO);
//
// // glfw: terminate, clearing all previously allocated GLFW resources.
// // ------------------------------------------------------------------
// glfwTerminate();
// return 0;
//}
//
//
//// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
//// ---------------------------------------------------------------------------------------------------------
//void processInput(GLFWwindow* window)
//{
// if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
// glfwSetWindowShouldClose(window, true);
//
// if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
// camera.ProcessKeyboard(FORWARD, deltaTime);
// if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
// camera.ProcessKeyboard(BACKWARD, deltaTime);
// if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
// camera.ProcessKeyboard(LEFT, deltaTime);
// if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
// camera.ProcessKeyboard(RIGHT, deltaTime);
//}
//
//// glfw: whenever the window size changed (by OS or user resize) this callback function executes
//// ---------------------------------------------------------------------------------------------
//void framebuffer_size_callback(GLFWwindow* window, int width, int height)
//{
// // make sure the viewport matches the new window dimensions; note that width and
// // height will be significantly larger than specified on retina displays.
// glViewport(0, 0, width, height);
//}
//
//
//// glfw: whenever the mouse moves, this callback is called
//// -------------------------------------------------------
//void mouse_callback(GLFWwindow* window, double xpos, double ypos)
//{
// if (firstMouse)
// {
// lastX = xpos;
// lastY = ypos;
// firstMouse = false;
// }
//
// float xoffset = xpos - lastX;
// float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top
//
// lastX = xpos;
// lastY = ypos;
//
// camera.ProcessMouseMovement(xoffset, yoffset);
//}
//
//// glfw: whenever the mouse scroll wheel scrolls, this callback is called
//// ----------------------------------------------------------------------
//void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
//{
// camera.ProcessMouseScroll(yoffset);
//}
////{"mode":"full", "isActive" : false} | [
"[email protected]"
] | |
74077ffbffe3d8b18af81145d8ba8dc9fed01310 | 4d23984454aad217cd450540ebc39ca180ecce10 | /drive-app/sxprofilemanagerbutton.h | 2ee5a8d4620c0daa5faa88969b93951ee764977d | [] | no_license | mailanetworks/sx-desktop-clients | a9a9005871724de7a54342449dd46692dd68e21a | 04eb41f87b9a4599207ad68131acf48c7667f6b5 | refs/heads/master | 2021-01-19T09:27:34.428190 | 2016-11-18T10:59:08 | 2016-11-18T10:59:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,904 | h | /*
* Copyright (C) 2012-2016 Skylable Ltd. <[email protected]>
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Special exception for linking this software with OpenSSL:
*
* In addition, as a special exception, Skylable Ltd. gives permission to
* link the code of this program with the OpenSSL library and distribute
* linked combinations including the two. You must obey the GNU General
* Public License in all respects for all of the code used other than
* OpenSSL. You may extend this exception to your version of the program,
* but you are not obligated to do so. If you do not wish to do so, delete
* this exception statement from your version.
*/
#ifndef SXPROFILEMANAGERBUTTON_H
#define SXPROFILEMANAGERBUTTON_H
#include "sxbutton.h"
class SxProfileManagerButton : public SxButton
{
Q_OBJECT
public:
enum ButtonState {
state1,
state2,
state3
};
SxProfileManagerButton(QString img1, QString img2, QString img3, ButtonState state);
ButtonState getState() const;
void setState(ButtonState state);
private:
QString m_img1, m_img2, m_img3;
ButtonState m_state;
void updateImage();
};
#endif // SXPROFILEMANAGERBUTTON_H
| [
"[email protected]"
] | |
22ec0e3ebfc5f1d11196a05f25eb7947fdbdb132 | 1c3dfc7b1c52c2188d75478a1d87bc380b3c65ca | /sfml2-space-invaders/Explosion.h | 43c7cdb4a3affe4d8a0a939b4cb248c34aee685f | [] | no_license | SIRprise/space_invaders_project | 06eabb2cff73a6292a4c189eda80145347da84f5 | a13ec40cdf7b2a987b247c7a7b99d9ed7f32f9a6 | refs/heads/master | 2023-03-07T12:12:45.826092 | 2021-02-21T02:47:04 | 2021-02-21T02:47:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 660 | h | #pragma once
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Rect.hpp>
#include "Texture2D.h"
class Explosion
{
public:
Explosion();
Explosion(sf::Vector2f position, int rowid, int maxShootTime);
Explosion& operator=(const Explosion& other);
~Explosion();
sf::IntRect TileBoundingBox();
sf::Vector2f getPosition();
void Animator(float deltaTime);
void Update(float deltaTime);
void setPosition(sf::Vector2f position);
Texture2D tex2d;
bool animationCompleted = false;
void LoadResources();
protected:
const int moveSpeed = 50;
sf::Vector2f pos;
sf::IntRect spriteRect;
const float animationSpeed = 25.0f;
float currentFrame;
};
| [
"[email protected]"
] | |
f80531943ceab2ea6ca1b1c8d3953b27691233d0 | ceb64df6ce48b1b63cbbfda4dbb9dc1cc10ae259 | /URI/2159 - Approximate Number of Primes/8440039.cpp | 9fa20cbfbb96767dbfd8b4aa5c5b1fa6b0379fc3 | [] | no_license | xack20/Some-of-OJ-s-Solves | 672be26c5da7d8d57a2fe0237368cc850466a924 | 59b6f46ad632ebc43ff295c37dd3e03039f63abb | refs/heads/master | 2023-01-31T04:36:13.003736 | 2020-12-15T22:24:51 | 2020-12-15T22:24:51 | 284,292,577 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 181 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
double n,a=1.25506;
cin >> n;
printf("%.1lf %.1lf\n",n/log(n),a*(n/log(n)));
return 0;
}
| [
"[email protected]"
] | |
f683389cf4593b7ec5eb77db46fcc8705f90ba17 | 2eec9f81eaa04b2179f03306ec3188c542fe908e | /과제/성적표관리(벡터수정버전)+정렬+스마트포인터/성적표관리/성적표관리/Student.h | af2022752115dcf705ebbc46a253f442b08692f4 | [] | no_license | SKMBOSS/BACKUP | 6fa3149ed1d9013faf028077b2961b64eba0d75e | d5cf31ef9d9ad0b35f72bed985e9d8af47428fe3 | refs/heads/master | 2020-07-28T00:54:00.168561 | 2019-09-18T08:47:05 | 2019-09-18T08:47:05 | 209,261,118 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 519 | h | #pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string>
using namespace std;
class Student
{
protected:
int no;
string szName;
int kor;
int eng;
int math;
public:
virtual float GetSum() = 0;
virtual void LoadStudent(FILE* pFile);
virtual void SaveStudent(FILE* pFile);
virtual void PrintLine();
virtual void InputLine(const int iCurStudent);
inline virtual int GetKor()
{
return kor;
}
inline virtual int GetNo()
{
return no;
}
Student();
virtual ~Student();
};
| [
"[email protected]"
] | |
af0d0f94a95a8a41c0040111ab6542d401065bae | f9a5932b1de1f469cb685e63a35f43ba32aadfce | /Plugins/EpicLeaderboard/Intermediate/Build/Android/UE4/Inc/EpicLeaderboard/EpicLeaderboard.init.gen.cpp | 718b1e85743690389f699bcbf439f9823fdace6c | [] | no_license | Wilsman/Baller-Repo | 6deebf907fbc39027577ce3620bfb45f9d064329 | 2080715d297b002698fcc51aaabb5c74e1990dfa | refs/heads/master | 2021-09-18T04:40:42.232221 | 2018-07-09T19:00:38 | 2018-07-09T19:00:38 | 140,329,920 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,466 | cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "GeneratedCppIncludes.h"
#include "Private/EpicLeaderboardPrivatePCH.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeEpicLeaderboard_init() {}
EPICLEADERBOARD_API UFunction* Z_Construct_UDelegateFunction_EpicLeaderboard_EpicLeaderboardResponse__DelegateSignature();
UPackage* Z_Construct_UPackage__Script_EpicLeaderboard()
{
static UPackage* ReturnPackage = nullptr;
if (!ReturnPackage)
{
static UObject* (*const SingletonFuncArray[])() = {
(UObject* (*)())Z_Construct_UDelegateFunction_EpicLeaderboard_EpicLeaderboardResponse__DelegateSignature,
};
static const UE4CodeGen_Private::FPackageParams PackageParams = {
"/Script/EpicLeaderboard",
PKG_CompiledIn | 0x00000000,
0x7CFF1A74,
0xAFE983B8,
SingletonFuncArray, ARRAY_COUNT(SingletonFuncArray),
METADATA_PARAMS(nullptr, 0)
};
UE4CodeGen_Private::ConstructUPackage(ReturnPackage, PackageParams);
}
return ReturnPackage;
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif
| [
"[email protected]"
] | |
e2131a584a30cdc10d33e2a3e101affae986bdd3 | fe92f604cd6f8aca5e255ffbe52e78b376a1e01f | /0419/Practice2.cpp | f805615b1a9f3fd108f9c0332eb99e744f5c106a | [] | no_license | Edwin-J/GameProgramming | f88c6831a793196d7e95fa935ce8b4a1362c6353 | 253202031295de12517259d8eea3945c38544adb | refs/heads/master | 2021-01-23T07:26:00.164937 | 2017-08-31T06:07:47 | 2017-08-31T06:07:47 | 86,422,528 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 241 | cpp | #include<iostream>
using namespace std;
int main(){
int i;
char menu[5][10] = {
"init",
"open",
"close",
"read",
"write"
};
for (i = 0; i < 5; i++){
cout << i + 1 << "¹øÂ° ¸Þ´º : " << menu[i] << endl;
}
return 0;
} | [
"[email protected]"
] | |
a93eb15cdedf981da2e444b0f3327a3cd182669b | 45ce04ea3a3f60659b7b5bfd6f84f21a215e0486 | /learn_coordinate_temp.cpp | 6253b33abcebbd3eedca7cf59d72ba1a34f82f81 | [] | no_license | allenxuan/OpenGL_Practice | 34d66b8be9266517e8509f354dbd481e94bc8d6b | 1c962ad1e5772565a31cb4e1e6c12dbe997c3c64 | refs/heads/master | 2020-07-26T18:28:43.578602 | 2020-03-08T16:19:52 | 2020-03-08T16:19:52 | 208,732,742 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,025 | cpp | #include <glad/glad.h>
#include <GLFW/glfw3.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <shader.h>
#include <iostream>
void framebuffer_size_callback(GLFWwindow *window, int width, int height);
void processInput(GLFWwindow *window);
// settings
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;
int main() {
// glfw: initialize and configure
// ------------------------------
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // uncomment this statement to fix compilation on OS X
#endif
// glfw window creation
// --------------------
GLFWwindow *window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
if (window == NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
// glad: load all OpenGL function pointers
// ---------------------------------------
if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
// build and compile our shader zprogram
// ------------------------------------
Shader ourShader("/Users/allenxuan/CLionProjects/GLFW_GLAD OpenGL/shader_source/6.1.coordinate_systems.vs",
"/Users/allenxuan/CLionProjects/GLFW_GLAD OpenGL/shader_source/6.1.coordinate_systems.fs");
// set up vertex data (and buffer(s)) and configure vertex attributes
// ------------------------------------------------------------------
float vertices[] = {
// positions // texture coords
0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right
0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left
};
unsigned int indices[] = {
0, 1, 3, // first triangle
1, 2, 3 // second triangle
};
unsigned int VBO, VAO, EBO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
// position attribute
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *) 0);
glEnableVertexAttribArray(0);
// texture coord attribute
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *) (3 * sizeof(float)));
glEnableVertexAttribArray(1);
// load and create a texture
// -------------------------
unsigned int texture1, texture2;
// texture 1
// ---------
glGenTextures(1, &texture1);
glBindTexture(GL_TEXTURE_2D, texture1);
// set the texture wrapping parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// set texture filtering parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// load image, create texture and generate mipmaps
int width, height, nrChannels;
stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.
unsigned char *data = stbi_load("/Users/allenxuan/CLionProjects/GLFW_GLAD OpenGL/texture_image/container.jpg",
&width, &height, &nrChannels, 0);
if (data) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
} else {
std::cout << "Failed to load texture" << std::endl;
}
stbi_image_free(data);
// texture 2
// ---------
glGenTextures(1, &texture2);
glBindTexture(GL_TEXTURE_2D, texture2);
// set the texture wrapping parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// set texture filtering parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// load image, create texture and generate mipmaps
data = stbi_load("/Users/allenxuan/CLionProjects/GLFW_GLAD OpenGL/texture_image/awesomeface.png", &width, &height,
&nrChannels, 0);
if (data) {
// note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
} else {
std::cout << "Failed to load texture" << std::endl;
}
stbi_image_free(data);
// tell opengl for each sampler to which texture unit it belongs to (only has to be done once)
// -------------------------------------------------------------------------------------------
ourShader.use();
ourShader.setInt("texture1", 0);
ourShader.setInt("texture2", 1);
// render loop
// -----------
while (!glfwWindowShouldClose(window)) {
// input
// -----
processInput(window);
// render
// ------
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// bind textures on corresponding texture units
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture1);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture2);
// activate shader
ourShader.use();
// create transformations
glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first
glm::mat4 view = glm::mat4(1.0f);
glm::mat4 projection = glm::mat4(1.0f);
model = glm::rotate(model, glm::radians(-55.0f), glm::vec3(1.0f, 0.0f, 0.0f));
view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));
projection = glm::perspective(glm::radians(45.0f), (float) SCR_WIDTH / (float) SCR_HEIGHT, 0.1f, 100.0f);
// retrieve the matrix uniform locations
unsigned int modelLoc = glGetUniformLocation(ourShader.ID, "model");
unsigned int viewLoc = glGetUniformLocation(ourShader.ID, "view");
// pass them to the shaders (3 different ways)
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);
// note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.
ourShader.setMat4("projection", projection);
// render container
glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
// -------------------------------------------------------------------------------
glfwSwapBuffers(window);
glfwPollEvents();
}
// optional: de-allocate all resources once they've outlived their purpose:
// ------------------------------------------------------------------------
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
glDeleteBuffers(1, &EBO);
// glfw: terminate, clearing all previously allocated GLFW resources.
// ------------------------------------------------------------------
glfwTerminate();
return 0;
}
// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
// ---------------------------------------------------------------------------------------------------------
void processInput(GLFWwindow *window) {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
}
// glfw: whenever the window size changed (by OS or user resize) this callback function executes
// ---------------------------------------------------------------------------------------------
void framebuffer_size_callback(GLFWwindow *window, int width, int height) {
// make sure the viewport matches the new window dimensions; note that width and
// height will be significantly larger than specified on retina displays.
glViewport(0, 0, width, height);
} | [
"[email protected]"
] | |
a0cb1886cbf57f7a1608e5497f223c1b6b26d98b | b4dce0ff0d699f6fbe62f3e573d3be98b2dc8b24 | /babymind_unpackingfw7/examples/ButterflyPlots.cpp | a42794e2572b6d11d2c0c03b0ee5e6c9a790586f | [] | no_license | robert-mihai/CITIROC_Ana | 9403d276be97a9c721280b7e912b34cc721866c4 | 189285a2e33c7979463a059ad4e22534e72e5cf5 | refs/heads/main | 2023-03-29T06:18:19.735887 | 2021-03-09T09:05:44 | 2021-03-09T09:05:44 | 343,483,814 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,447 | cpp | #include <stdio.h>
#include <string.h>
#include <string>
#include <exception>
#include <fstream>
#include <vector>
#include "TFile.h"
#include "TDirectory.h"
#include "TSystem.h"
#include "TMacro.h"
#include <TTree.h>
#include <iostream>
#include "TClonesArray.h"
#include "TObject.h"
#include "Rtypes.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TF1.h"
#include "TCanvas.h"
#include "TStyle.h"
using namespace std;
//Function to get the directory of the input file in order to create output file in same directory
string GetLocation(string str)
{
int i = str.rfind("_all");
string way = str.substr(0,i);
return way;
}
//Function to get the directory of the input file in order to create output files in same directory
string GetDir(string str)
{
int i = str.rfind("/");
string way = str.substr(0,i);
return way;
}
//Function to check that the input file is indeed a _all_reconstructed.root file
bool CheckFile(string str)
{
if (str.find("_all.root") != string::npos) return 0;
return 1;
}
struct vectorsTree
{
vector<double> *FEBSN;
vector<double> *SpillTag;
vector<double> *GTrigTag;
vector<double> *GTrigTime;
vector<double> *hitsChannel;
vector<double> *hitAmpl;
vector<double> *hitLGAmpl;
vector<double> *hitLeadTime;
vector<double> *hitTrailTime;
vector<double> *hitTimeDif;
vector<double> *SpillTime;
vector<double> *SpillTimeGTrig;
vector<double> *hitTimefromSpill;
vector<double> *SpillTrailTime;
vector<double> *AsicTemperature;
vector<double> *FPGATemperature;
vector<double> *GlobalHV;
vector<double> *BoardTemperature;
vector<double> *BoardHumidity;
};
int main (int argc, char **argv)
{
if (argc != 2) { printf("Enter source _all.root file ./ButterflyPlots inputfile \n"); return EXIT_FAILURE; }
string sFileName(argv[1]);
if (CheckFile(sFileName) == 1) { printf("Source must be an _all.root file \n"); return EXIT_FAILURE; }
TFile *FileInput=new TFile(sFileName.c_str(),"read");
cout<<"Reading "<<sFileName<<endl;
//string rootFileOutput=GetLocation(sFileName.c_str());
//rootFileOutput+="_ButterflyPlots.root";
//TFile wfile(rootFileOutput.c_str(), "recreate");
//cout<<rootFileOutput<<endl;
// Specify directory for output Event Display PNG
string foutDir = GetDir(sFileName) + "/Baseline_noise_2/";
string createFolder ="mkdir -p ";
createFolder += foutDir.c_str();
system(createFolder.c_str());
ostringstream foutPNGnum;
ostringstream foutBunchnum;
string foutPNG;
vectorsTree FEB;
FEB.FEBSN=0;
FEB.SpillTag=0;
FEB.hitsChannel=0;
FEB.hitAmpl=0;
FEB.hitLeadTime=0;
FEB.GTrigTag=0;
FEB.GTrigTime=0;
FEB.hitLGAmpl=0;
FEB.hitTrailTime=0;
FEB.hitTimeDif=0;
FEB.SpillTime=0;
FEB.SpillTimeGTrig=0;
FEB.hitTimefromSpill=0;
FEB.SpillTrailTime=0;
FEB.AsicTemperature=0;
FEB.FPGATemperature=0;
FEB.GlobalHV=0;
FEB.BoardTemperature=0;
FEB.BoardHumidity=0;
string sFEB = "FEB_1";
TTree *FEBtree = (TTree*)FileInput->Get(sFEB.c_str());
FEBtree->SetBranchAddress((sFEB+"_SN").c_str(),&FEB.FEBSN);
FEBtree->SetBranchAddress((sFEB+"_SpillTag").c_str(),&FEB.SpillTag);
FEBtree->SetBranchAddress((sFEB+"_GTrigTag").c_str(),&FEB.GTrigTag);
FEBtree->SetBranchAddress((sFEB+"_GTrigTime").c_str(),&FEB.GTrigTime);
FEBtree->SetBranchAddress((sFEB+"_hitsChannel").c_str(),&FEB.hitsChannel);
FEBtree->SetBranchAddress((sFEB+"_hitAmpl").c_str(),&FEB.hitAmpl);
FEBtree->SetBranchAddress((sFEB+"_hitLGAmpl").c_str(),&FEB.hitLGAmpl);
FEBtree->SetBranchAddress((sFEB+"_hitLeadTime").c_str(),&FEB.hitLeadTime);
FEBtree->SetBranchAddress((sFEB+"_hitTrailTime").c_str(),&FEB.hitTrailTime);
FEBtree->SetBranchAddress((sFEB+"_hitTimeDif").c_str(),&FEB.hitTimeDif);
FEBtree->SetBranchAddress((sFEB+"_SpillTime").c_str(),&FEB.SpillTime);
FEBtree->SetBranchAddress((sFEB+"_SpillTimeGTrig").c_str(),&FEB.SpillTimeGTrig);
FEBtree->SetBranchAddress((sFEB+"_hitTimefromSpill").c_str(),&FEB.hitTimefromSpill);
FEBtree->SetBranchAddress((sFEB+"_SpillTrailTime").c_str(),&FEB.SpillTrailTime);
FEBtree->SetBranchAddress((sFEB+"_AsicTemperature").c_str(),&FEB.AsicTemperature);
FEBtree->SetBranchAddress((sFEB+"_FPGATemperature").c_str(),&FEB.FPGATemperature);
FEBtree->SetBranchAddress((sFEB+"_GlobalHV").c_str(),&FEB.GlobalHV);
FEBtree->SetBranchAddress((sFEB+"_BoardTemperature").c_str(),&FEB.BoardTemperature);
FEBtree->SetBranchAddress((sFEB+"_BoardHumidity").c_str(),&FEB.BoardHumidity);
cout<< "Number of Spills "<< FEBtree->GetEntries() <<endl;
// Creating Histograms and Canvases_________________________________________________________________
TH1D *Amplitude = new TH1D ("Ch","",100,0,100);
Amplitude->SetTitle(" Amplitude of monitor hit (ToT) ; Amplitude [2.5 ns]; Counts");
//TH1D *proximity = new TH1D("prox","",63,-31,32);
TH1D *proximity = new TH1D("prox","",60,-30,30);
proximity->SetTitle("channel proximity;Channel distance to monitor hit;Counts");
TH1D *proximity_norm = new TH1D("prox","",32,0,32);
proximity_norm->SetTitle("channel proximity;Channel distance to monitor hit;Counts");
TH1D *baseline = new TH1D ("NBaseline_noise","",100,0,100);
baseline->SetTitle("N baseline noise per monitor hit; N baseline noise per monitor hit;Counts");
TH2D *bl_Amplitude = new TH2D("NB_Ch","",100,0,1000,100,0,100);
bl_Amplitude->SetTitle("N baseline noise vs monitor hit Amplitude;Monitor hit ToT [2.5 ns];N baseline noise");
//TH2D *Amplitude_proximity = new TH2D("Ch_prox","",63,-31,32,100,0,1);
TH2D *Amplitude_proximity = new TH2D("Ch_prox","",60,-30,30,100,0,1);
Amplitude_proximity->SetTitle("Amplitude ratio vs channel proximity;Channel distance to monitor hit;Amplitude ratio");
//TH2D *time_proximity = new TH2D("T_prox","",63,-31,32,200,-100,100);
TH2D * time_proximity = new TH2D("T_prox","",60,-30,30,100,0,100);
time_proximity->SetTitle("time delay vs channel proximity;Channel distance to monitor hit;Hit time delay [#times 2.5 ns]");
TH2D *Ch0_behaviour = new TH2D("Ch0","",200,-100,100,300,0,300);
Ch0_behaviour->SetTitle("Monitor Hit ch behaviour; Hit time delay; Amplitude [2.5 ns]" );
TH2D *Channels = new TH2D("Channel_map","",96,0,96,96,0,96);
Channels->SetTitle("Channel Map; Monitor hit channel; Noise hit channel" );
TCanvas *c1 = new TCanvas("c1","c1", 2000, 900);
TCanvas *c2 = new TCanvas("c2","c2", 800, 600);
//__________________________________________________________________________________________________
//loop over spills
for (Int_t Spill = 0; Spill<FEBtree->GetEntries(); Spill++){
FEBtree->GetEntry(Spill);
if(FEB.SpillTag->empty()){
cout<<"EMPTY SPILL"<<endl;
continue;
}
Int_t Spilltag = FEB.SpillTag->back();
//cout << "_Getting Spill Number " << Spilltag << " of "<<FEBtree->GetEntries()<<"..."<<endl;
int count_bl=0;
bool notmaximum =false;
//loop over spill hits to find the one with max amplitude
for (Int_t hit1 = 0; hit1<FEB.SpillTag->size(); hit1++){
//if ( 25 > FEB.hitTimeDif->at(hit1) || FEB.hitTimeDif->at(hit1) > 50 ) continue;
if ( FEB.hitTimeDif->at(hit1) < 25 ) continue;
if ( FEB.hitTimeDif->at(hit1) > 50) continue;
count_bl=0;
notmaximum = false;
//std::cout << "FEB.SpillTag->size() = " << FEB.SpillTag->size() << std::endl;
//check if hit1 is maximum Amplitude on the ASIC
for (Int_t hit_check = 0; hit_check<FEB.SpillTag->size(); hit_check++){
if (hit_check == hit1) continue;
if (abs(FEB.hitTimefromSpill->at(hit_check)-FEB.hitTimefromSpill->at(hit1))<100 && FEB.hitTimeDif->at(hit_check)>FEB.hitTimeDif->at(hit1))
notmaximum = true;
}
if (notmaximum) continue;
for(int hit2=0; hit2<FEB.SpillTag->size(); hit2++){
if (hit2 == hit1) continue;
if (FEB.hitTimefromSpill->at(hit2)-FEB.hitTimefromSpill->at(hit1)>0 && FEB.hitTimefromSpill->at(hit2)-FEB.hitTimefromSpill->at(hit1)<100){
count_bl ++;
Amplitude_proximity->Fill(FEB.hitsChannel->at(hit2)-FEB.hitsChannel->at(hit1),FEB.hitTimeDif->at(hit2)/FEB.hitTimeDif->at(hit1));
time_proximity->Fill(FEB.hitsChannel->at(hit2)-FEB.hitsChannel->at(hit1),FEB.hitTimefromSpill->at(hit2)-FEB.hitTimefromSpill->at(hit1));
proximity->Fill(FEB.hitsChannel->at(hit2)-FEB.hitsChannel->at(hit1));
proximity_norm->Fill(abs(FEB.hitsChannel->at(hit2)-FEB.hitsChannel->at(hit1)));
Channels->Fill(FEB.hitsChannel->at(hit1),FEB.hitsChannel->at(hit2));
if(FEB.hitsChannel->at(hit2)-FEB.hitsChannel->at(hit1)==0){
Ch0_behaviour->Fill(FEB.hitTimefromSpill->at(hit2)-FEB.hitTimefromSpill->at(hit1),FEB.hitTimeDif->at(hit2));
}
}
}
Amplitude->Fill(FEB.hitTimeDif->at(hit1));
baseline->Fill(count_bl);//count_bl is the number of hits which correspond to the 2.5 ns between two hits condition
bl_Amplitude->Fill(FEB.hitTimeDif->at(hit1),count_bl);
}
}
proximity_norm->Scale(1/Amplitude->GetEntries());
c2->cd();
//proximity_norm->Draw("hist");
//time_proximity->Draw("colz");
Channels->Draw("colz");
gPad -> SetLogz();
//Ch0_behaviour->Draw("colz");
c1->Divide(3,2);
c1->cd(1);
Amplitude->Draw("hist");
c1->cd(2);
baseline->Draw("hist");// y-axis: spills. x-axis: hit1-hit2_time < 2.5 ns
gPad -> SetLogy();
c1->cd(3);
bl_Amplitude->Draw("colz");// the time difference for maximum amplitude hit vs
gPad -> SetLogz();
c1->cd(4);
Amplitude_proximity->Draw("colz");
gPad -> SetLogz();
c1->cd(5);
time_proximity->Draw("colz");
gPad -> SetLogz();
c1->cd(6);
proximity->Draw("hist");
foutPNG = foutDir + "crosstalk_all_ver_above300pe_All.png";
c1->SaveAs(foutPNG.c_str());
//foutPNG = foutDir + "crosstalk_ratiobelow20per_above300pe_All.C";
//c1->SaveAs(foutPNG.c_str());
foutPNG = foutDir + "crosstalk_all_ver_above300pe_channel_map.png";
c2->SaveAs(foutPNG.c_str());
foutPNG = foutDir + "crosstalk_all_ver_above300pe_channel_map.C";
c2->SaveAs(foutPNG.c_str());
cout<<"_Plotting 100% done"<<endl;
FileInput->Close();
return 0;
}
| [
"[email protected]"
] | |
14a81b6f4efc5e0dab7f86075bf7297dc8a1e01f | 5a0c02406d5789d9be561a359df75db2674ded2f | /kod-arduino/PID-tester/mpu.h | 74b1d2baecb260613ff17cf2d73794311174b7c9 | [] | no_license | gyarab/2020-4e-priban-Dron | 45629b33c6ed49dc3c6304dbf9683db33da2df98 | 2398580eeb8a425e3e20da33c7785d242a7f9a5e | refs/heads/master | 2023-04-16T20:11:46.481054 | 2021-04-28T05:53:03 | 2021-04-28T05:53:03 | 297,241,783 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 615 | h |
#ifndef mpu_h
#define mpu_h
#include <Arduino.h>
#include <math.h>
class mpu{
public:
mpu();
void initiate();
void refresh();
float angleX, angleY;
float Gyr_rawX, Gyr_rawY, Gyr_rawZ;
float elapsedTime, actualTime, timePrev;
float Gyro_raw_error_x, Gyro_raw_error_y;
float Acc_angle_error_x, Acc_angle_error_y;
private:
float Gyro_angle_x, Gyro_angle_y;
float gyroFix_X = 4.0;
float gyroFix_Y = 0.0;
float rad_to_deg = 180/3.141592654;
float Acc_rawX, Acc_rawY, Acc_rawZ;
float Acc_angle_x, Acc_angle_y;
};
#endif
| [
"[email protected]"
] | |
ab1e02c855a7582fbd6b016b458b70da16cc02d8 | afdfb8480993ad647ad07379a268fa6aa93019d8 | /파일명 정렬.cpp | 66b78bd0ad33a1990cd8445d8df381a6d84bd99e | [] | no_license | lsmmay322/Kakao-coding | a9cbc7f079b10202a1f80c0538f3fbdf9940be6b | fc3279b5577a46d1f45fc99c54dcabf3f6d98ec6 | refs/heads/master | 2023-02-19T11:44:09.391611 | 2021-01-22T10:39:30 | 2021-01-22T10:39:30 | 327,585,824 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,536 | cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
typedef struct {
string head;
int num;
string full_name;
}f_name;
bool ft_comp(f_name a, f_name b) {
transform(a.head.begin(), a.head.end(), a.head.begin(), ::tolower);
transform(b.head.begin(), b.head.end(), b.head.begin(), ::tolower);
if (a.head == b.head)
return a.num < b.num;
return a.head < b.head;
}
vector<string> solution(vector<string> files) {
vector<string> answer;
vector<f_name> file;
f_name tmp;
int num;
bool check;
bool finish;
for (int i = 0; i < files.size(); i++) {
check = true;
finish = false;
num = 0;
for (int j = 0; j < files[i].length(); j++) {
if ((files[i][j] >= '0' && files[i][j] <= '9') && check) {
tmp.head = files[i].substr(0, j);
check = false;
}
if ((files[i][j] >= '0' && files[i][j] <= '9') && !check) {
num = num * 10 + (files[i][j] - '0');
finish = true; // finish = true가 되도 일단 tail 전에 숫자가 계속 존재하면 else if문으로 넘어가지 않는다.
}
else if (finish)
break;
}
tmp.num = num;
tmp.full_name = files[i];
file.push_back(tmp);
}
stable_sort(file.begin(), file.end(), ft_comp);
for (int i = 0; i < file.size(); i++)
answer.push_back(file[i].full_name);
return answer;
} | [
"[email protected]"
] | |
fe219cd5b1cf894cfc1fe40b03b9cfea65d27b97 | 8242d218808b8cc5734a27ec50dbf1a7a7a4987a | /Intermediate/Build/Win64/Netshoot/Inc/Engine/FontFace.gen.cpp | 8a0b52fd58da6cfbaef5b8fa9a33144a576300b2 | [] | no_license | whyhhr/homework2 | a2e75b494a962eab4fb0a740f83dc8dc27f8f6ee | 9808107fcc983c998d8601920aba26f96762918c | refs/heads/main | 2023-08-29T08:14:39.581638 | 2021-10-22T16:47:11 | 2021-10-22T16:47:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,171 | cpp | // Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/GeneratedCppIncludes.h"
#include "Engine/Classes/Engine/FontFace.h"
#include "Serialization/ArchiveUObjectFromStructuredArchive.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeFontFace() {}
// Cross Module References
ENGINE_API UClass* Z_Construct_UClass_UFontFace_NoRegister();
ENGINE_API UClass* Z_Construct_UClass_UFontFace();
COREUOBJECT_API UClass* Z_Construct_UClass_UObject();
UPackage* Z_Construct_UPackage__Script_Engine();
SLATECORE_API UEnum* Z_Construct_UEnum_SlateCore_EFontHinting();
SLATECORE_API UEnum* Z_Construct_UEnum_SlateCore_EFontLoadingPolicy();
SLATECORE_API UEnum* Z_Construct_UEnum_SlateCore_EFontLayoutMethod();
SLATECORE_API UClass* Z_Construct_UClass_UFontFaceInterface_NoRegister();
// End Cross Module References
void UFontFace::StaticRegisterNativesUFontFace()
{
}
UClass* Z_Construct_UClass_UFontFace_NoRegister()
{
return UFontFace::StaticClass();
}
struct Z_Construct_UClass_UFontFace_Statics
{
static UObject* (*const DependentSingletons[])();
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[];
#endif
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SourceFilename_MetaData[];
#endif
static const UE4CodeGen_Private::FStrPropertyParams NewProp_SourceFilename;
static const UE4CodeGen_Private::FBytePropertyParams NewProp_Hinting_Underlying;
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_Hinting_MetaData[];
#endif
static const UE4CodeGen_Private::FEnumPropertyParams NewProp_Hinting;
static const UE4CodeGen_Private::FBytePropertyParams NewProp_LoadingPolicy_Underlying;
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_LoadingPolicy_MetaData[];
#endif
static const UE4CodeGen_Private::FEnumPropertyParams NewProp_LoadingPolicy;
static const UE4CodeGen_Private::FBytePropertyParams NewProp_LayoutMethod_Underlying;
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_LayoutMethod_MetaData[];
#endif
static const UE4CodeGen_Private::FEnumPropertyParams NewProp_LayoutMethod;
#if WITH_EDITORONLY_DATA
static const UE4CodeGen_Private::FBytePropertyParams NewProp_FontFaceData_Inner;
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_FontFaceData_MetaData[];
#endif
static const UE4CodeGen_Private::FArrayPropertyParams NewProp_FontFaceData;
static const UE4CodeGen_Private::FStrPropertyParams NewProp_SubFaces_Inner;
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SubFaces_MetaData[];
#endif
static const UE4CodeGen_Private::FArrayPropertyParams NewProp_SubFaces;
#endif // WITH_EDITORONLY_DATA
static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[];
#if WITH_EDITORONLY_DATA
#endif // WITH_EDITORONLY_DATA
static const UE4CodeGen_Private::FImplementedInterfaceParams InterfaceParams[];
static const FCppClassTypeInfoStatic StaticCppClassTypeInfo;
static const UE4CodeGen_Private::FClassParams ClassParams;
};
UObject* (*const Z_Construct_UClass_UFontFace_Statics::DependentSingletons[])() = {
(UObject* (*)())Z_Construct_UClass_UObject,
(UObject* (*)())Z_Construct_UPackage__Script_Engine,
};
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::Class_MetaDataParams[] = {
{ "AutoExpandCategories", "FontFace" },
{ "BlueprintType", "true" },
{ "Comment", "/**\n * A font face asset contains the raw payload data for a source TTF/OTF file as used by FreeType.\n * During cook this asset type generates a \".ufont\" file containing the raw payload data (unless loaded \"Inline\").\n */" },
{ "HideCategories", "Object" },
{ "IncludePath", "Engine/FontFace.h" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "A font face asset contains the raw payload data for a source TTF/OTF file as used by FreeType.\nDuring cook this asset type generates a \".ufont\" file containing the raw payload data (unless loaded \"Inline\")." },
};
#endif
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_SourceFilename_MetaData[] = {
{ "Category", "FontFace" },
{ "Comment", "/** The filename of the font face we were created from. This may not always exist on disk, as we may have previously loaded and cached the font data inside this asset. */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "The filename of the font face we were created from. This may not always exist on disk, as we may have previously loaded and cached the font data inside this asset." },
};
#endif
const UE4CodeGen_Private::FStrPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_SourceFilename = { "SourceFilename", nullptr, (EPropertyFlags)0x0010000000000015, UE4CodeGen_Private::EPropertyGenFlags::Str, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, SourceFilename), METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_SourceFilename_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_SourceFilename_MetaData)) };
const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) };
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting_MetaData[] = {
{ "Category", "FontFace" },
{ "Comment", "/** The hinting algorithm to use with the font face. */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "The hinting algorithm to use with the font face." },
};
#endif
const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting = { "Hinting", nullptr, (EPropertyFlags)0x0010000000000005, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, Hinting), Z_Construct_UEnum_SlateCore_EFontHinting, METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting_MetaData)) };
const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) };
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy_MetaData[] = {
{ "Category", "FontFace" },
{ "Comment", "/** Enum controlling how this font face should be loaded at runtime. See the enum for more explanations of the options. */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "Enum controlling how this font face should be loaded at runtime. See the enum for more explanations of the options." },
};
#endif
const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy = { "LoadingPolicy", nullptr, (EPropertyFlags)0x0010000000000005, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, LoadingPolicy), Z_Construct_UEnum_SlateCore_EFontLoadingPolicy, METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy_MetaData)) };
const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) };
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod_MetaData[] = {
{ "Category", "FontFace" },
{ "Comment", "/** Which method should we use when laying out the font? Try changing this if you notice clipping or height issues with your font. */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "Which method should we use when laying out the font? Try changing this if you notice clipping or height issues with your font." },
};
#endif
const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod = { "LayoutMethod", nullptr, (EPropertyFlags)0x0010040000000005, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, LayoutMethod), Z_Construct_UEnum_SlateCore_EFontLayoutMethod, METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod_MetaData)) };
#if WITH_EDITORONLY_DATA
const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData_Inner = { "FontFaceData", nullptr, (EPropertyFlags)0x0000000820000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) };
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData_MetaData[] = {
{ "Comment", "/** The data associated with the font face. This should always be filled in providing the source filename is valid. */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "The data associated with the font face. This should always be filled in providing the source filename is valid." },
};
#endif
const UE4CodeGen_Private::FArrayPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData = { "FontFaceData", nullptr, (EPropertyFlags)0x0010000820000000, UE4CodeGen_Private::EPropertyGenFlags::Array, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, FontFaceData_DEPRECATED), EArrayPropertyFlags::None, METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData_MetaData)) };
const UE4CodeGen_Private::FStrPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces_Inner = { "SubFaces", nullptr, (EPropertyFlags)0x0000000800020000, UE4CodeGen_Private::EPropertyGenFlags::Str, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, METADATA_PARAMS(nullptr, 0) };
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces_MetaData[] = {
{ "Category", "FontFace" },
{ "Comment", "/** Transient cache of the sub-faces available within this face */" },
{ "ModuleRelativePath", "Classes/Engine/FontFace.h" },
{ "ToolTip", "Transient cache of the sub-faces available within this face" },
};
#endif
const UE4CodeGen_Private::FArrayPropertyParams Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces = { "SubFaces", nullptr, (EPropertyFlags)0x0010040800022001, UE4CodeGen_Private::EPropertyGenFlags::Array, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UFontFace, SubFaces), EArrayPropertyFlags::None, METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces_MetaData)) };
#endif // WITH_EDITORONLY_DATA
const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_UFontFace_Statics::PropPointers[] = {
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_SourceFilename,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting_Underlying,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_Hinting,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy_Underlying,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_LoadingPolicy,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod_Underlying,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_LayoutMethod,
#if WITH_EDITORONLY_DATA
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData_Inner,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_FontFaceData,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces_Inner,
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UFontFace_Statics::NewProp_SubFaces,
#endif // WITH_EDITORONLY_DATA
};
const UE4CodeGen_Private::FImplementedInterfaceParams Z_Construct_UClass_UFontFace_Statics::InterfaceParams[] = {
{ Z_Construct_UClass_UFontFaceInterface_NoRegister, (int32)VTABLE_OFFSET(UFontFace, IFontFaceInterface), false },
};
const FCppClassTypeInfoStatic Z_Construct_UClass_UFontFace_Statics::StaticCppClassTypeInfo = {
TCppClassTypeTraits<UFontFace>::IsAbstract,
};
const UE4CodeGen_Private::FClassParams Z_Construct_UClass_UFontFace_Statics::ClassParams = {
&UFontFace::StaticClass,
nullptr,
&StaticCppClassTypeInfo,
DependentSingletons,
nullptr,
Z_Construct_UClass_UFontFace_Statics::PropPointers,
InterfaceParams,
UE_ARRAY_COUNT(DependentSingletons),
0,
UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::PropPointers),
UE_ARRAY_COUNT(InterfaceParams),
0x000800A0u,
METADATA_PARAMS(Z_Construct_UClass_UFontFace_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_UFontFace_Statics::Class_MetaDataParams))
};
UClass* Z_Construct_UClass_UFontFace()
{
static UClass* OuterClass = nullptr;
if (!OuterClass)
{
UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_UFontFace_Statics::ClassParams);
}
return OuterClass;
}
IMPLEMENT_CLASS(UFontFace, 4023674804);
template<> ENGINE_API UClass* StaticClass<UFontFace>()
{
return UFontFace::StaticClass();
}
static FCompiledInDefer Z_CompiledInDefer_UClass_UFontFace(Z_Construct_UClass_UFontFace, &UFontFace::StaticClass, TEXT("/Script/Engine"), TEXT("UFontFace"), false, nullptr, nullptr, nullptr);
DEFINE_VTABLE_PTR_HELPER_CTOR(UFontFace);
IMPLEMENT_FSTRUCTUREDARCHIVE_SERIALIZER(UFontFace)
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif
| [
"[email protected]"
] | |
6ff9b1702f76be677ab2c53a308758d6d266b3a4 | b45de82997ab3742c616d0f6d3c9968ae95cf4af | /aplibs/include/apctrl.hpp | dd3b8ba2ac7819e6097b38c70ee44196aed543ab | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | huskyproject/fastlst | cc153caa59a73aa2ce5a42c582b8420b41f1174d | 5594243ffec2b5ddd9cc632978bbcc87ce07a8f5 | refs/heads/master | 2021-05-13T12:50:40.671272 | 2018-01-11T19:40:33 | 2018-01-11T19:40:33 | 116,687,868 | 2 | 2 | null | 2018-01-23T11:56:04 | 2018-01-08T14:37:12 | C++ | UTF-8 | C++ | false | false | 3,367 | hpp | /*****************************************************************************/
/* */
/* (C) Copyright 1993-1998 Alberto Pasquale */
/* */
/* A L L R I G H T S R E S E R V E D */
/* */
/*****************************************************************************/
/* */
/* This source code is NOT in the public domain and it CANNOT be used or */
/* distributed without written permission from the author. */
/* */
/*****************************************************************************/
/* */
/* How to contact the author: Alberto Pasquale of 2:332/504@fidonet */
/* Viale Verdi 106 */
/* 41100 Modena */
/* Italy */
/* */
/*****************************************************************************/
// ApCtrl.Hpp Ver. 1.00
#ifndef _APCTRL_HPP_
#define _APCTRL_HPP_
#ifdef __OS2__
#define INCL_DOSSEMAPHORES
#define INCL_DOSDATETIME
#include <os2.h>
#endif
#include <typedefs.h>
#pragma pack (1)
// Implemented in TIMERS.CPP
int Sleep (ulong interval); // sleep interval ms (rounded to clock ticks)
// Returns 0 on success
// The following class allows to know whether a specified
// interval has elapsed since last time.
// Start allows to set the interval and start the timer.
// Elapsed returns TRUE when interval has elapsed
// since Start or last time Elapsed returned TRUE.
// Start can be used many times with different values.
class PTIMER { // periodic timer
ulong start, interval;
public:
void Start (ulong interval); /* time in s/1000 */
bool Elapsed (); // True if interval has elapsed
};
// The following class is useful to know the time
// elapsed (in s/1000) from last call to the Start.
class TIMER {
ulong start;
public:
void Start ();
ulong Elapsed (); /* elapsed in s/1000 */
};
#ifdef __OS2__
// Implemented in MUTEX.CPP
// Class to implement a Mutually exclusive Semaphore
// Request to request access to the exclusive resource, blocking.
// Release to release the resource.
class Mutex {
private:
HMTX hmtx; // Handle for Mutex Semaphore
public:
Mutex ();
~Mutex ();
void Request ();
void Release ();
};
// Automatic Request/Release of the Mutex object passed to creator
class AutoMutex {
private:
Mutex *MutexSem;
public:
AutoMutex (Mutex *MutexSem);
~AutoMutex ();
};
#endif
#endif
| [
""
] | |
11e3565a83c29ace83b2cab6c36cb6fa2681887c | e5e0d729f082999a9bec142611365b00f7bfc684 | /tensorflow/lite/delegates/gpu/cl/opencl_wrapper.cc | 1bfa04b32f2fe351c3d9e74403afa85467530221 | [
"Apache-2.0"
] | permissive | NVIDIA/tensorflow | ed6294098c7354dfc9f09631fc5ae22dbc278138 | 7cbba04a2ee16d21309eefad5be6585183a2d5a9 | refs/heads/r1.15.5+nv23.03 | 2023-08-16T22:25:18.037979 | 2023-08-03T22:09:23 | 2023-08-03T22:09:23 | 263,748,045 | 763 | 117 | Apache-2.0 | 2023-07-03T15:45:19 | 2020-05-13T21:34:32 | C++ | UTF-8 | C++ | false | false | 11,759 | cc | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
#include <dlfcn.h>
#include "absl/strings/str_cat.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
namespace tflite {
namespace gpu {
namespace cl {
#define LoadFunction(function) \
if (is_pixel) { \
function = reinterpret_cast<PFN_##function>(loadOpenCLPointer(#function)); \
} else { \
function = reinterpret_cast<PFN_##function>(dlsym(libopencl, #function)); \
}
Status LoadOpenCL() {
void* libopencl = dlopen("libOpenCL.so", RTLD_NOW | RTLD_LOCAL);
if (libopencl) {
LoadOpenCLFunctions(libopencl, false);
return OkStatus();
} else {
// Pixel phone?
libopencl = dlopen("libOpenCL-pixel.so", RTLD_NOW | RTLD_LOCAL);
if (libopencl) {
typedef void (*enableOpenCL_t)();
enableOpenCL_t enableOpenCL =
reinterpret_cast<enableOpenCL_t>(dlsym(libopencl, "enableOpenCL"));
enableOpenCL();
LoadOpenCLFunctions(libopencl, true);
return OkStatus();
} else {
return UnknownError(
absl::StrCat("OpenCL library not loaded - ", dlerror()));
}
}
}
void LoadOpenCLFunctions(void* libopencl, bool is_pixel) {
typedef void* (*loadOpenCLPointer_t)(const char* name);
loadOpenCLPointer_t loadOpenCLPointer;
if (is_pixel) {
loadOpenCLPointer = reinterpret_cast<loadOpenCLPointer_t>(
dlsym(libopencl, "loadOpenCLPointer"));
}
LoadFunction(clGetPlatformIDs);
LoadFunction(clGetPlatformInfo);
LoadFunction(clGetDeviceIDs);
LoadFunction(clGetDeviceInfo);
LoadFunction(clCreateSubDevices);
LoadFunction(clRetainDevice);
LoadFunction(clReleaseDevice);
LoadFunction(clCreateContext);
LoadFunction(clCreateContextFromType);
LoadFunction(clRetainContext);
LoadFunction(clReleaseContext);
LoadFunction(clGetContextInfo);
LoadFunction(clCreateCommandQueueWithProperties);
LoadFunction(clRetainCommandQueue);
LoadFunction(clReleaseCommandQueue);
LoadFunction(clGetCommandQueueInfo);
LoadFunction(clCreateBuffer);
LoadFunction(clCreateSubBuffer);
LoadFunction(clCreateImage);
LoadFunction(clCreatePipe);
LoadFunction(clRetainMemObject);
LoadFunction(clReleaseMemObject);
LoadFunction(clGetSupportedImageFormats);
LoadFunction(clGetMemObjectInfo);
LoadFunction(clGetImageInfo);
LoadFunction(clGetPipeInfo);
LoadFunction(clSetMemObjectDestructorCallback);
LoadFunction(clSVMAlloc);
LoadFunction(clSVMFree);
LoadFunction(clCreateSamplerWithProperties);
LoadFunction(clRetainSampler);
LoadFunction(clReleaseSampler);
LoadFunction(clGetSamplerInfo);
LoadFunction(clCreateProgramWithSource);
LoadFunction(clCreateProgramWithBinary);
LoadFunction(clCreateProgramWithBuiltInKernels);
LoadFunction(clRetainProgram);
LoadFunction(clReleaseProgram);
LoadFunction(clBuildProgram);
LoadFunction(clCompileProgram);
LoadFunction(clLinkProgram);
LoadFunction(clUnloadPlatformCompiler);
LoadFunction(clGetProgramInfo);
LoadFunction(clGetProgramBuildInfo);
LoadFunction(clCreateKernel);
LoadFunction(clCreateKernelsInProgram);
LoadFunction(clRetainKernel);
LoadFunction(clReleaseKernel);
LoadFunction(clSetKernelArg);
LoadFunction(clSetKernelArgSVMPointer);
LoadFunction(clSetKernelExecInfo);
LoadFunction(clGetKernelInfo);
LoadFunction(clGetKernelArgInfo);
LoadFunction(clGetKernelWorkGroupInfo);
LoadFunction(clWaitForEvents);
LoadFunction(clGetEventInfo);
LoadFunction(clCreateUserEvent);
LoadFunction(clRetainEvent);
LoadFunction(clReleaseEvent);
LoadFunction(clSetUserEventStatus);
LoadFunction(clSetEventCallback);
LoadFunction(clGetEventProfilingInfo);
LoadFunction(clFlush);
LoadFunction(clFinish);
LoadFunction(clEnqueueReadBuffer);
LoadFunction(clEnqueueReadBufferRect);
LoadFunction(clEnqueueWriteBuffer);
LoadFunction(clEnqueueWriteBufferRect);
LoadFunction(clEnqueueFillBuffer);
LoadFunction(clEnqueueCopyBuffer);
LoadFunction(clEnqueueCopyBufferRect);
LoadFunction(clEnqueueReadImage);
LoadFunction(clEnqueueWriteImage);
LoadFunction(clEnqueueFillImage);
LoadFunction(clEnqueueCopyImage);
LoadFunction(clEnqueueCopyImageToBuffer);
LoadFunction(clEnqueueCopyBufferToImage);
LoadFunction(clEnqueueMapBuffer);
LoadFunction(clEnqueueMapImage);
LoadFunction(clEnqueueUnmapMemObject);
LoadFunction(clEnqueueMigrateMemObjects);
LoadFunction(clEnqueueNDRangeKernel);
LoadFunction(clEnqueueNativeKernel);
LoadFunction(clEnqueueMarkerWithWaitList);
LoadFunction(clEnqueueBarrierWithWaitList);
LoadFunction(clEnqueueSVMFree);
LoadFunction(clEnqueueSVMMemcpy);
LoadFunction(clEnqueueSVMMemFill);
LoadFunction(clEnqueueSVMMap);
LoadFunction(clEnqueueSVMUnmap);
LoadFunction(clGetExtensionFunctionAddressForPlatform);
LoadFunction(clCreateImage2D);
LoadFunction(clCreateImage3D);
LoadFunction(clEnqueueMarker);
LoadFunction(clEnqueueWaitForEvents);
LoadFunction(clEnqueueBarrier);
LoadFunction(clUnloadCompiler);
LoadFunction(clGetExtensionFunctionAddress);
LoadFunction(clCreateCommandQueue);
LoadFunction(clCreateSampler);
LoadFunction(clEnqueueTask);
// OpenGL sharing
LoadFunction(clCreateFromGLBuffer);
LoadFunction(clCreateFromGLTexture);
LoadFunction(clEnqueueAcquireGLObjects);
LoadFunction(clEnqueueReleaseGLObjects);
// cl_khr_egl_event extension
LoadFunction(clCreateEventFromEGLSyncKHR);
}
// No OpenCL support, do not set function addresses
PFN_clGetPlatformIDs clGetPlatformIDs;
PFN_clGetPlatformInfo clGetPlatformInfo;
PFN_clGetDeviceIDs clGetDeviceIDs;
PFN_clGetDeviceInfo clGetDeviceInfo;
PFN_clCreateSubDevices clCreateSubDevices;
PFN_clRetainDevice clRetainDevice;
PFN_clReleaseDevice clReleaseDevice;
PFN_clCreateContext clCreateContext;
PFN_clCreateContextFromType clCreateContextFromType;
PFN_clRetainContext clRetainContext;
PFN_clReleaseContext clReleaseContext;
PFN_clGetContextInfo clGetContextInfo;
PFN_clCreateCommandQueueWithProperties clCreateCommandQueueWithProperties;
PFN_clRetainCommandQueue clRetainCommandQueue;
PFN_clReleaseCommandQueue clReleaseCommandQueue;
PFN_clGetCommandQueueInfo clGetCommandQueueInfo;
PFN_clCreateBuffer clCreateBuffer;
PFN_clCreateSubBuffer clCreateSubBuffer;
PFN_clCreateImage clCreateImage;
PFN_clCreatePipe clCreatePipe;
PFN_clRetainMemObject clRetainMemObject;
PFN_clReleaseMemObject clReleaseMemObject;
PFN_clGetSupportedImageFormats clGetSupportedImageFormats;
PFN_clGetMemObjectInfo clGetMemObjectInfo;
PFN_clGetImageInfo clGetImageInfo;
PFN_clGetPipeInfo clGetPipeInfo;
PFN_clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback;
PFN_clSVMAlloc clSVMAlloc;
PFN_clSVMFree clSVMFree;
PFN_clCreateSamplerWithProperties clCreateSamplerWithProperties;
PFN_clRetainSampler clRetainSampler;
PFN_clReleaseSampler clReleaseSampler;
PFN_clGetSamplerInfo clGetSamplerInfo;
PFN_clCreateProgramWithSource clCreateProgramWithSource;
PFN_clCreateProgramWithBinary clCreateProgramWithBinary;
PFN_clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels;
PFN_clRetainProgram clRetainProgram;
PFN_clReleaseProgram clReleaseProgram;
PFN_clBuildProgram clBuildProgram;
PFN_clCompileProgram clCompileProgram;
PFN_clLinkProgram clLinkProgram;
PFN_clUnloadPlatformCompiler clUnloadPlatformCompiler;
PFN_clGetProgramInfo clGetProgramInfo;
PFN_clGetProgramBuildInfo clGetProgramBuildInfo;
PFN_clCreateKernel clCreateKernel;
PFN_clCreateKernelsInProgram clCreateKernelsInProgram;
PFN_clRetainKernel clRetainKernel;
PFN_clReleaseKernel clReleaseKernel;
PFN_clSetKernelArg clSetKernelArg;
PFN_clSetKernelArgSVMPointer clSetKernelArgSVMPointer;
PFN_clSetKernelExecInfo clSetKernelExecInfo;
PFN_clGetKernelInfo clGetKernelInfo;
PFN_clGetKernelArgInfo clGetKernelArgInfo;
PFN_clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
PFN_clWaitForEvents clWaitForEvents;
PFN_clGetEventInfo clGetEventInfo;
PFN_clCreateUserEvent clCreateUserEvent;
PFN_clRetainEvent clRetainEvent;
PFN_clReleaseEvent clReleaseEvent;
PFN_clSetUserEventStatus clSetUserEventStatus;
PFN_clSetEventCallback clSetEventCallback;
PFN_clGetEventProfilingInfo clGetEventProfilingInfo;
PFN_clFlush clFlush;
PFN_clFinish clFinish;
PFN_clEnqueueReadBuffer clEnqueueReadBuffer;
PFN_clEnqueueReadBufferRect clEnqueueReadBufferRect;
PFN_clEnqueueWriteBuffer clEnqueueWriteBuffer;
PFN_clEnqueueWriteBufferRect clEnqueueWriteBufferRect;
PFN_clEnqueueFillBuffer clEnqueueFillBuffer;
PFN_clEnqueueCopyBuffer clEnqueueCopyBuffer;
PFN_clEnqueueCopyBufferRect clEnqueueCopyBufferRect;
PFN_clEnqueueReadImage clEnqueueReadImage;
PFN_clEnqueueWriteImage clEnqueueWriteImage;
PFN_clEnqueueFillImage clEnqueueFillImage;
PFN_clEnqueueCopyImage clEnqueueCopyImage;
PFN_clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
PFN_clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
PFN_clEnqueueMapBuffer clEnqueueMapBuffer;
PFN_clEnqueueMapImage clEnqueueMapImage;
PFN_clEnqueueUnmapMemObject clEnqueueUnmapMemObject;
PFN_clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects;
PFN_clEnqueueNDRangeKernel clEnqueueNDRangeKernel;
PFN_clEnqueueNativeKernel clEnqueueNativeKernel;
PFN_clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList;
PFN_clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList;
PFN_clEnqueueSVMFree clEnqueueSVMFree;
PFN_clEnqueueSVMMemcpy clEnqueueSVMMemcpy;
PFN_clEnqueueSVMMemFill clEnqueueSVMMemFill;
PFN_clEnqueueSVMMap clEnqueueSVMMap;
PFN_clEnqueueSVMUnmap clEnqueueSVMUnmap;
PFN_clGetExtensionFunctionAddressForPlatform
clGetExtensionFunctionAddressForPlatform;
PFN_clCreateImage2D clCreateImage2D;
PFN_clCreateImage3D clCreateImage3D;
PFN_clEnqueueMarker clEnqueueMarker;
PFN_clEnqueueWaitForEvents clEnqueueWaitForEvents;
PFN_clEnqueueBarrier clEnqueueBarrier;
PFN_clUnloadCompiler clUnloadCompiler;
PFN_clGetExtensionFunctionAddress clGetExtensionFunctionAddress;
PFN_clCreateCommandQueue clCreateCommandQueue;
PFN_clCreateSampler clCreateSampler;
PFN_clEnqueueTask clEnqueueTask;
PFN_clCreateFromGLBuffer clCreateFromGLBuffer;
PFN_clCreateFromGLTexture clCreateFromGLTexture;
PFN_clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects;
PFN_clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects;
PFN_clCreateEventFromEGLSyncKHR clCreateEventFromEGLSyncKHR;
cl_mem CreateImage2DLegacy(cl_context context, cl_mem_flags flags,
const cl_image_format* image_format,
const cl_image_desc* image_desc, void* host_ptr,
cl_int* errcode_ret) {
if (clCreateImage) { // clCreateImage available since OpenCL 1.2
return clCreateImage(context, flags, image_format, image_desc, host_ptr,
errcode_ret);
} else {
return clCreateImage2D(context, flags, image_format,
image_desc->image_width, image_desc->image_height,
image_desc->image_row_pitch, host_ptr, errcode_ret);
}
}
} // namespace cl
} // namespace gpu
} // namespace tflite
| [
"[email protected]"
] | |
7d294d32323a49bb02b4867e931a2e27b09604ee | cead25f8417819c6dbd8d83c21e5ac4713370af6 | /main.cpp | 9ddef75ac5926fb339da3fe4c5b27c9d7e18c011 | [] | no_license | mmstratiev/StairsOpenGL | 6d6b5414e55d4c28a9da40e0f5955549ee355f16 | 8e6fb40ae7e3e203460ece427f55c4800aeab049 | refs/heads/master | 2022-03-10T02:24:07.441774 | 2022-02-16T00:30:55 | 2022-02-16T00:30:55 | 128,784,951 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 234 | cpp | #include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//creates the main window and shows it
MainWindow *w = new MainWindow;
w->show();
return a.exec();
}
| [
"[email protected]"
] | |
0ba25eb99c92042ccafc7383222855ec8501f871 | 0c0b6a1089fb73a2a9aaac3476c75a27a695f712 | /serversmodel.h | ab6fd6114e90c73ca1832c3769a188fcc418a5b9 | [] | no_license | shaan7/gameservers | bcce8b26a1ab69c990520d43457780e80ae28637 | b113208e8c2d16090b1126b73ad4f9948be901d0 | refs/heads/master | 2020-04-06T03:41:10.727502 | 2014-04-28T06:31:03 | 2014-04-28T06:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 691 | h | #ifndef SERVERSMODEL_H
#define SERVERSMODEL_H
#include <QAbstractListModel>
class Pinger;
class ServersModel : public QAbstractListModel
{
Q_OBJECT
public:
enum ServerRoles { HostRole, PortRole, PingRole };
explicit ServersModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QHash<int, QByteArray> roleNames() const;
signals:
private slots:
void latency();
private:
QStringList mServerList;
QHash<QString, int> mLastKnownPing;
QHash<Pinger*, QString> mPingers;
void initServerList();
void createPinger(const QString &server);
};
#endif // SERVERSMODEL_H
| [
"[email protected]"
] | |
8eec7208db4679b5ce11250a870f9bf8fe080516 | cfeac52f970e8901871bd02d9acb7de66b9fb6b4 | /generated/src/aws-cpp-sdk-pi/source/model/ListPerformanceAnalysisReportsResult.cpp | c35eca7f0921a79fd261a76d188ae07ddc22c63b | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | aws/aws-sdk-cpp | aff116ddf9ca2b41e45c47dba1c2b7754935c585 | 9a7606a6c98e13c759032c2e920c7c64a6a35264 | refs/heads/main | 2023-08-25T11:16:55.982089 | 2023-08-24T18:14:53 | 2023-08-24T18:14:53 | 35,440,404 | 1,681 | 1,133 | Apache-2.0 | 2023-09-12T15:59:33 | 2015-05-11T17:57:32 | null | UTF-8 | C++ | false | false | 1,702 | cpp | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/pi/model/ListPerformanceAnalysisReportsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::PI::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
ListPerformanceAnalysisReportsResult::ListPerformanceAnalysisReportsResult()
{
}
ListPerformanceAnalysisReportsResult::ListPerformanceAnalysisReportsResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
ListPerformanceAnalysisReportsResult& ListPerformanceAnalysisReportsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("AnalysisReports"))
{
Aws::Utils::Array<JsonView> analysisReportsJsonList = jsonValue.GetArray("AnalysisReports");
for(unsigned analysisReportsIndex = 0; analysisReportsIndex < analysisReportsJsonList.GetLength(); ++analysisReportsIndex)
{
m_analysisReports.push_back(analysisReportsJsonList[analysisReportsIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
const auto& headers = result.GetHeaderValueCollection();
const auto& requestIdIter = headers.find("x-amzn-requestid");
if(requestIdIter != headers.end())
{
m_requestId = requestIdIter->second;
}
return *this;
}
| [
"[email protected]"
] | |
c0124a37cd6efca76cc6f3402f76ba088ebe0a42 | 31c38c6fa9d1aa2ad0ce113e7084cb8c0f7bc956 | /SDK/LuminRuntimeSettings_classes.h | 92e9158b7913efcfcc125c0163a9add6c51d1bf4 | [] | no_license | xnf4o/DBD_SDK_461 | d46feebba60aa71285479e4c71ff5dbf5d57b227 | 9d4fb29a75b63f4bd8813d4ee0cdb897aa792a58 | refs/heads/main | 2023-04-12T22:27:19.819706 | 2021-04-14T22:09:39 | 2021-04-14T22:09:39 | 358,058,055 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,889 | h | #pragma once
// Name: DeadByDaylight, Version: 4.6.1
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// Class LuminRuntimeSettings.LuminRuntimeSettings
// 0x0120 (FullSize[0x0150] - InheritedSize[0x0030])
class ULuminRuntimeSettings : public UObject
{
public:
struct FString PackageName; // 0x0030(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FString ApplicationDisplayName; // 0x0040(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
LuminRuntimeSettings_ELuminFrameTimingHint FrameTimingHint; // 0x0050(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bProtectedContent; // 0x0051(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bManualCallToAppReady; // 0x0052(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bUseMobileRendering; // 0x0053(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bUseVulkan; // 0x0054(0x0001) (ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char UnknownData_0EIT[0x3]; // 0x0055(0x0003) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY)
struct FFilePath Certificate; // 0x0058(0x0010) (Edit, Config, GlobalConfig, NativeAccessSpecifierPublic)
struct FDirectoryPath IconModelPath; // 0x0068(0x0010) (Edit, Config, GlobalConfig, NativeAccessSpecifierPublic)
struct FDirectoryPath IconPortalPath; // 0x0078(0x0010) (Edit, Config, GlobalConfig, NativeAccessSpecifierPublic)
struct FLocalizedIconInfos LocalizedIconInfos; // 0x0088(0x0010) (Edit, Config, GlobalConfig, NativeAccessSpecifierPublic)
int VersionCode; // 0x0098(0x0004) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int MinimumAPILevel; // 0x009C(0x0004) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<LuminRuntimeSettings_ELuminPrivilege> AppPrivileges; // 0x00A0(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<struct FLuminComponentSubElement> ExtraComponentSubElements; // 0x00B0(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<struct FLuminComponentElement> ExtraComponentElements; // 0x00C0(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FString SpatializationPlugin; // 0x00D0(0x0010) (Edit, ZeroConstructor, Config, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FString ReverbPlugin; // 0x00E0(0x0010) (Edit, ZeroConstructor, Config, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FString OcclusionPlugin; // 0x00F0(0x0010) (Edit, ZeroConstructor, Config, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int SoundCueCookQualityIndex; // 0x0100(0x0004) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bRemoveDebugInfo; // 0x0104(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char UnknownData_BQF3[0x3]; // 0x0105(0x0003) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY)
struct FDirectoryPath VulkanValidationLayerLibs; // 0x0108(0x0010) (Edit, Config, GlobalConfig, NativeAccessSpecifierPublic)
bool bFrameVignette; // 0x0118(0x0001) (Edit, ZeroConstructor, Config, GlobalConfig, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char UnknownData_5VPN[0x7]; // 0x0119(0x0007) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY)
TArray<struct FLocalizedAppName> LocalizedAppNames; // 0x0120(0x0010) (Edit, ZeroConstructor, Config, GlobalConfig, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char UnknownData_ZPIO[0x20]; // 0x0130(0x0020) MISSED OFFSET (PADDING)
static UClass* StaticClass()
{
static auto ptr = nullptr;
if (!ptr)
ptr =
UObject::FindClass("Class LuminRuntimeSettings.LuminRuntimeSettings");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"[email protected]"
] | |
adb6ec676a2d2fbb2893feb5d622df6050019bfe | 8f449fe36b67ba8268e8787e3b2af645c9dbe7c3 | /src/utils/string.hpp | c00e7e271acae30672d8a701e2b3911877be6aab | [] | no_license | maciekgajewski/falcondb | f70fe73c65b8792f2d86c0a58a3b776aadc917dd | 404867fc0833fecd32604fb72b92183631ed994f | refs/heads/master | 2020-12-30T10:50:08.121601 | 2012-08-07T22:04:29 | 2012-08-07T22:04:29 | 4,841,193 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,335 | hpp | /*
FalconDB, a database
Copyright (C) 2012 Maciej Gajewski <maciej.gajewski0 at gmail dot com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef FALCONDB_STRING_HPP
#define FALCONDB_STRING_HPP
#include <sstream>
namespace falcondb {
namespace detail {
template <typename A>
void build_string(std::ostream& s, const A& a)
{
s << a;
}
template<typename A, typename ...B>
void build_string(std::ostream& s, const A& a, const B& ...b)
{
s << a;
build_string(s, b...);
}
}
/// concatenates all params into string
template<typename ...T>
std::string build_string(const T& ...t)
{
std::ostringstream ss;
detail::build_string(ss, t...);
return ss.str();
}
}
#endif
| [
"[email protected]"
] | |
2e1cc057b491bfcadeb2d332a3882e1458bff828 | b3505199d1dc87c93efb7523c60c6ce8b1353e3e | /Online Judge Solutions/UVa/12004 - Bubble Sort.cpp | 075c9d1acc98a7ae3f8a78263097b1e25bb82e72 | [] | no_license | habibrahmanbd/Code-Lab | ee3fee907fd364d693cb733aa20e50aef17e360d | e22635aba137c73fb0d25dd9df75667dd1b1d74f | refs/heads/master | 2021-01-02T23:08:51.674572 | 2019-01-17T16:57:27 | 2019-01-17T16:57:27 | 99,474,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,838 | cpp | using namespace std;
#include<bits/stdc++.h>
#define db double
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define pi pair<int,int>
#define pl pair<long,long>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define II ({int a; _in(a); a;})
#define IL ({long a; _in(a); a;})
#define ILL ({ll a; _in(a); a;})
#define ID ({db a; sf("%lf",&a); a;})
#define IF ({float a; sf("%f",&a); a;})
#define IC ({char a; sf("%c",&a); a;})
#define IS ({string a; _in_cin_string(a); a;})
#define FRI(a,b,c) for(int i=a; i<=b; i+=c)
#define FRL(a,b,c) for(long i=a; i<=b; i+=c)
#define FRLL(a,b,c) for(ll i=a; i<=b; i+=c)
#define all(V) V.begin(),V.end()
#define clr(A,B) memset(A,B,sizeof A)
#define _F_in freopen("in.txt","r",stdin)
#define _F_out freopen("out.txt","w",stdout)
#define PI 2*acos(0.0)
#define mod 1000000007
#define INF LLONG_MAX
#define sqr(n) (n*n)
#define endl '\n'
template <typename T>inline T BigMod (T b,T p,T m){if (p == 0) return 1;if (p%2 == 0){T s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
template <typename T>inline T ModInv (T b,T m){return BigMod(b,m-2,m);}
template <typename T>inline T Bigmod(T b,T p,T m){ if(p==0) return 1; else if (!(p&1)) return sqr(Bigmod(b,p/2,m)) % m;else return ((b % m) * Bigmod(b,p-1,m)) % m;}
template <typename T>inline T gcd(T a,T b){ if(b==0)return a; return gcd(b,a%b);}
template <typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
template <typename T>inline T euclide(T a,T b,T &x,T &y) {if(a<0){T d=euclide(-a,b,x,y);x=-x;return d;} if(b<0){T d=euclide(a,-b,x,y);y=-y;return d;} if(b==0){x=1;y=0;return a;}else{T d=euclide(b,a%b,x,y);T t=x;x=y;y=t-(a/b)*y;return d;}}
template <typename T>inline T Dis(T x1,T y1,T x2, T y2){return sqrt( (sqr((x1-x2)) + sqr((y1-y2))) );}
template <typename T>inline T Angle(T x1,T y1,T x2, T y2){ return atan(double(y1-y2) / double(x1-x2));}
template <typename T>inline T DIFF(T a,T b) { T d = a-b;if(d<(T)0)return -d;else return d;}
template <typename T>inline T ABS(T a) {if(a<0)return -a;else return a;}
template <typename T>inline ll isLeft(T a,T b,T c) { return (a.x-b.x)*(b.y-c.y)-(b.x-c.x)*(a.y-b.y); }
template <typename T>inline void _in(T &x){register int c = getchar();x = 0;bool neg = 0;for(;((c<48 | c>57) && c != '-');c = getchar()); if(c=='-') {neg=1;c=getchar();}for(;c>47 && c<58;c = getchar()) {x = (x<<1) + (x<<3) + c - 48;}if(neg) x=-x;}
template <typename T>inline bool isLeapYear(T N){ if (N%4) return 0; else if (N%100) return 1; else if (N%400) return 0; else return 1; }
template <typename T>inline T Set(T N,T pos){ return N=N | (1<<pos);}
template <typename T>inline T Reset(T N,T pos){return N= N & ~(1<<pos);}
template <typename T>inline bool Check(T N,T pos){return (bool)(N & (1<<pos));}
template <class T, class X>inline T togglebit(T a, X i) { T t=1;return (a^(t<<i)); }
template <class T, class X>inline T toInt(T &sm, X s) {stringstream ss(s); ss>>sm; return sm;}
template <typename T>inline int cdigittoint(T ch){return ch-'0';}
template <typename T>inline bool isVowel(T ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
template <typename T>inline bool isConst(T ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
inline double DEG(double x) { return (180.0*x)/(PI);}
inline double RAD(double x) { return (x*(double)PI)/(180.0);}
//ll dx[]={-1, -1, -1, 0, +1, +1, +1, 0};
//ll dy[]={-1, 0, +1, +1, +1, 0, -1, -1};
//------------------------------------------------------
#define mx 100005
ll X[mx], Y[mx];
void Solve()
{
X[0];
ll mul_2_3=1;
ll mul_4_5=1;
for(ll i=3; i<=mx; i+=2)
{
if((i&3)==2||(i&3)==3)
{
X[i] = (i*mul_2_3);
Y[i]=2;
X[i-1] = (i-2)*mul_2_3;
Y[i-1]=2;
mul_2_3+=2;
}
if((i&3)==0||(i&3)==1)
{
X[i] = i*mul_4_5;
X[i-1] = (i-2)*mul_4_5;
mul_4_5++;
}
}
return;
}
int main()
{
clr(Y,0);
Solve();
ll t=ILL;
for(ll cs=1; cs<=t; cs++)
{
ll n=ILL;
if(Y[n]==0)
pf("Case %lld: %lld\n",cs, X[n]);
else
pf("Case %lld: %lld/%lld\n",cs,X[n],Y[n]);
}
return 0;
}
| [
"[email protected]"
] | |
205782b224bc265f25f31242e1820706bfa6513b | 08d7a5a7e2c9814fec46b459b4bd644e2223ebd7 | /dcmrender [MSVC 6]/src/dcmapi/DcmRotationInfoSequence.h | 83f7099e3b7173a41084523730c1981c5e98c02e | [] | no_license | IMAGE-ET/dicom-render | c936924e07840a966ccc0779344c69230c9b0470 | dce9f4c725740c0e46ef060e6022e5694d3a7518 | refs/heads/master | 2020-03-11T15:27:05.459768 | 2012-04-08T19:07:08 | 2012-04-08T19:07:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,061 | h | // DcmRotationInfoSequence.h: interface for the CDcmRotationSequence class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DCMROTATIONINFOSEQUENCE_H__A89034ED_BC12_47D4_A42A_24A9FAC6B912__INCLUDED_)
#define AFX_DCMROTATIONINFOSEQUENCE_H__A89034ED_BC12_47D4_A42A_24A9FAC6B912__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "DcmSequence.h"
class AFX_EXT_CLASS CDcmRotationSequence : public CDcmSequence
{
public:
DECLARE_SERIAL( CDcmRotationSequence );
public:
CDcmRotationSequence();
CDcmRotationSequence(CDcmRotationSequence& sequence);
virtual ~CDcmRotationSequence();
public:
CDcmRotationSequence& operator=( CDcmRotationSequence& sequence );
protected:
// Constructs sequence dataset
virtual void InitializeSequence();
public:
CString& StartAngle();
void StartAngle(const CString& Tag_0054_0200_1C_DS_VM_1 );
public:
CString& AngularStep();
void AngularStep(const CString& Tag_0018_1144_1C_DS_VM_1 );
public:
CString& RotationDirection();
void RotationDirection(const CString& Tag_0018_1140_1C_CS_VM_1 );
public:
CString& ScanArc();
void ScanArc(const CString& Tag_0018_1143_1C_DS_VM_1 );
public:
CString& ActualFrameDuration();
void ActualFrameDuration(const CString& Tag_0018_1242_1C_IS_VM_1 );
public:
CStringArray& RadialPosition();
void RadialPosition(const CStringArray& Tag_0018_1142_3_DS_VM_1N );
public:
CString& DistanceSourceToDetector();
void DistanceSourceToDetector(const CString& Tag_0018_1110_2C_DS_VM_1 );
public:
const unsigned short& NumberFramesRotation();
void NumberFramesRotation(const unsigned short Tag_0054_0053_1C_US_VM_1);
public:
CString& TableTraverse();
void TableTraverse(const CString& Tag_0018_1131_3_DS_VM_1 );
public:
CString& TableHeight();
void TableHeight(const CString& Tag_0018_1130_3_DS_VM_1 );
public:
CString& TypeDetectorMotion ();
void TypeDetectorMotion(const CString& Tag_0054_0202_3_CS_VM_1 );
};
#endif // !defined(AFX_DCMROTATIONINFOSEQUENCE_H__A89034ED_BC12_47D4_A42A_24A9FAC6B912__INCLUDED_)
| [
"[email protected]"
] | |
d3d0d48f15691c9c3f5e5d463e6c7964b943d1b2 | c7fa8f8c041ca54b541c04d7fb343fd488036d0f | /gdal/ogr/ogrsf_frmts/elastic/ogr_elastic.h | a1f4a2435ade7282abe4e1f8f88241e25e8b32f4 | [
"LicenseRef-scancode-info-zip-2005-02",
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | afarnham/gdal | 0823c75e2a878d4a4e0d856e7f8aad2dfbc7ad70 | bcefc42e50a4c5f6e2dde0fc2fe6aca73caac9cd | refs/heads/master | 2021-01-16T20:47:41.197081 | 2012-10-09T00:26:34 | 2012-10-09T00:26:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,317 | h | /******************************************************************************
* $Id$
*
* Project: ElasticSearch Translator
* Purpose:
* Author:
*
******************************************************************************
* Copyright (c) 2011, Adam Estrada
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef _OGR_ELASTIC_H_INCLUDED
#define _OGR_ELASTIC_H_INCLUDED
#include "ogrsf_frmts.h"
#include "ogr_p.h"
#include "cpl_hash_set.h"
class OGRElasticDataSource;
/************************************************************************/
/* OGRElasticLayer */
/************************************************************************/
class OGRElasticLayer : public OGRLayer {
OGRFeatureDefn* poFeatureDefn;
OGRSpatialReference* poSRS;
OGRElasticDataSource* poDS;
CPLString sIndex;
void* pAttributes;
char* pszLayerName;
public:
OGRElasticLayer(const char *pszFilename,
const char* layerName,
OGRElasticDataSource* poDS,
OGRSpatialReference *poSRSIn,
int bWriteMode = FALSE);
~OGRElasticLayer();
void ResetReading();
OGRFeature * GetNextFeature();
OGRErr CreateFeature(OGRFeature *poFeature);
OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK);
OGRFeatureDefn * GetLayerDefn();
int TestCapability(const char *);
OGRSpatialReference *GetSpatialRef();
int GetFeatureCount(int bForce);
void PushIndex();
CPLString BuildMap();
};
/************************************************************************/
/* OGRElasticDataSource */
/************************************************************************/
class OGRElasticDataSource : public OGRDataSource {
char* pszName;
char* pszServer;
OGRElasticLayer** papoLayers;
int nLayers;
public:
OGRElasticDataSource();
~OGRElasticDataSource();
int Open(const char * pszFilename,
int bUpdate);
int Create(const char *pszFilename,
char **papszOptions);
const char* GetName() {
return pszName;
}
int GetLayerCount() {
return nLayers;
}
OGRLayer* GetLayer(int);
OGRLayer * CreateLayer(const char * pszLayerName,
OGRSpatialReference *poSRS,
OGRwkbGeometryType eType,
char ** papszOptions);
int TestCapability(const char *);
void UploadFile(const CPLString &url, const CPLString &data);
void DeleteIndex(const CPLString &url);
int bOverwrite;
int nBulkUpload;
char* pszWriteMap;
char* pszMapping;
};
/************************************************************************/
/* OGRElasticDriver */
/************************************************************************/
class OGRElasticDriver : public OGRSFDriver {
public:
~OGRElasticDriver();
const char* GetName();
OGRDataSource* Open(const char *, int);
OGRDataSource* CreateDataSource(const char * pszName, char **papszOptions);
int TestCapability(const char *);
};
#endif /* ndef _OGR_Elastic_H_INCLUDED */
| [
"[email protected]"
] | |
ec007850b41fc2c38c62d339dcb132e06ae98101 | 9ca0a6a86f7f56155ada68191b9b48ae6b2bc5c7 | /11_stacks/example_stack2.cpp | ca3dd134d1c76e83203bc419a9cbd39ad51afe33 | [] | no_license | aruizgarciarojas/tc1031 | b0222430835e9bfb287dd0359a53c918c909f998 | a79c2c38099b93bf07602a05d93dfc6e81802599 | refs/heads/master | 2023-08-24T05:23:19.502699 | 2021-10-25T14:39:33 | 2021-10-25T14:39:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 955 | cpp | #include <iostream>
#include <stack>
#include <string>
#include "exception.h"
using namespace std;
int isValid(const string &str) {
stack<char> s;
int i;
char top;
for (int i = 0; i < str.size(); i++) {
if (str[i] == '{' || str[i] == '[' || str[i] == '(') {
s.push(str[i]);
} else {
if (s.empty()) {
return false;
}
if (str[i] == '}' && s.top() != '{') {
return false;
}
if (str[i] == ']' && s.top() != '[') {
return false;
}
if (str[i] == ')' && s.top() != '(') {
return false;
}
s.pop();
}
}
return (s.empty());
}
int main(int argc, char* argv[]) {
string input;
while(cin >> input) {
cout << input << "? " << isValid(input) << "\n";
}
return 0;
}
| [
"[email protected]"
] | |
a0656db4e55c4f4b3bb0ae05a0f7f8d16e97040c | 0e6bafdcdeca8d396221f372c9e9e908ce2b6fcd | /source/segment.cpp | 69916a9daf5c316372538088acea5b37c798828e | [] | no_license | Pavelius/c2 | bc2aa0e0f569876621b38cc568c1889335f205c1 | 0e200e4178d70d8a0dcd368b3e10b9b666d77a8f | refs/heads/master | 2021-01-16T19:14:06.807394 | 2017-08-19T13:46:56 | 2017-08-19T13:46:56 | 100,157,218 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,269 | cpp | #include "segment.h"
#include "genstate.h"
using namespace c2;
segment* c2::segments[DataUninitialized + 1];
struct data_segment : segment, public aref<unsigned char>
{
unsigned rvabase;
data_segment()
{
initialize();
}
void add(unsigned char a) override
{
if(!gen.code)
return;
reserve(count + 1);
data[count++] = a;
}
unsigned get() override
{
return count;
}
void set(unsigned count) override
{
if(!count && this->count == 0)
return;
reserve(count);
}
unsigned char* getdata() override
{
return data;
}
};
struct bbs_segment : segment
{
unsigned count;
bbs_segment() : count(0)
{
}
void add(unsigned char a) override
{
if(!gen.code)
return;
count++;
}
unsigned get() override
{
return count;
}
unsigned char* getdata() override
{
return 0;
}
void set(unsigned count) override
{
this->count = count;
}
};
static data_segment data_initialized;
static data_segment data_string;
static data_segment code;
static bbs_segment data_uninitialized;
void segments_cleanup()
{
segments[Code] = &code;
segments[Data] = &data_initialized;
segments[DataUninitialized] = &data_initialized;
segments[DataStrings] = &data_string;
// Clear all sections
for(auto p : segments)
p->set(0);
} | [
"[email protected]"
] | |
b789350c95b24da833361490ce1853f8406d2ef9 | 665e96413288099369d9bb24a4854ec338710fa0 | /atcoder/ABC/191/B.cpp | 5c8add4bc16ba902928955d58e10c8f98e8192d5 | [] | no_license | dtc03012/My_Algorithm | 0c653a6ba7d2a7bca84e1f70e7d5efa8fd025afa | 4d39327a0460928654adf0f4af63ea8e4abdeaf0 | refs/heads/main | 2023-05-28T15:28:21.486170 | 2021-06-15T18:31:05 | 2021-06-15T18:31:05 | 373,727,306 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,141 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
if(0<=y&&y<n&&0<=x&&x<m) return true;
return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};
void solve(int tc){
int n,x;
scanf("%d%d",&n,&x);
vector<int> v;
for(int e=0;e<n;e++){
int r;
scanf("%d",&r);
if(r==x) continue;
v.push_back(r);
}
for(int e=0;e<sz(v);e++) printf("%d ",v[e]);
}
int main(void){
/*
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
*/
int tc = 1;
/*
scanf("%d",&tc);
*/
for(int test_number=1;test_number<=tc;test_number++){
solve(test_number);
}
return 0;
} | [
"[email protected]"
] | |
29de2de0c4696f7de6a35dc812684f264b9013be | 70c146fef1e4a02ad2d70db02d6bc4e39cf31eb4 | /UDPExperiment/UDPExperiment.cpp | 91c4b756493f6ad47a5ba555d9cad8f76a6c4f39 | [] | no_license | thomasgaozx/udp-multiplayer | e5c9f6a639eeee46fd2403702fa1e688d1f76278 | d0a4f98470b993088dad4b37547a97de121e9e46 | refs/heads/master | 2023-02-13T19:17:42.653886 | 2021-01-12T01:34:38 | 2021-01-12T01:34:38 | 322,440,077 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,638 | cpp | // UDPExperiment.cpp : Defines the entry point for the application.
//
#include "UDPExperiment.h"
#include "delta.h"
#include "object.h"
using namespace std;
constexpr float TOL = 1E-6f;
void UnitTestPacket(bool bigEndian) {
unitTestSetEndian(bigEndian);
uint64_t A = 0xff00ee334466aa55;
uint64_t B = 0x123;
int32_t C = 0x00ff3344;
int32_t D = 0xff000000;
double E = 0.124385738472;
double F = 10024.1324324738742;
float G = 13.24323f;
float H = 0.11111243f;
uint8_t I = 0x01;
auto writer = PacketWriter();
writer << A << B << C << D << E << F << G << H << I;
uint64_t a, b;
uint32_t c, d;
double e, f;
float g, h;
uint8_t i;
auto reader = PacketReader(writer.flush());
reader >> a >> b >> c >> d >> e >> f >> g >> h >> i;
assert((a == A));
assert((b == B));
assert((c == C));
assert((d == D));
assert((abs(e - E) < TOL));
assert((abs(f - F) < TOL));
assert((abs(g - G) < TOL));
assert((abs(h - H) < TOL));
assert((i == I));
cout << "UnitTestPacket Completed!" << endl;
}
void UnitTestSerialize() {
CreatureStatus status0{};
CreatureStatus status1{};
CreatureStatus status2{};
status1.x = 5.1f;
status1.z = 3.2f;
status1.heading = 0.5555555555;
status1.animframe = 3;
status1.faction = 5;
status2.x = 5.5f;
auto writer = PacketWriter();
writeDelta<CreatureStatus>(writer, status1, status0);
auto tmp1 = writer.flush();
writeDelta<CreatureStatus>(writer, status2, status0);
auto tmp2 = writer.flush();
cout << "status1 delta string size: " << tmp1.size() << endl;
cout << "status2 delta string size: " << tmp2.size() << endl;
assert((tmp1.size() > tmp2.size()));
vector<char> tmp; // merge tmp1 tmp2
tmp.reserve(tmp1.size() + tmp2.size());
tmp.insert(tmp.end(), tmp1.begin(), tmp1.end());
tmp.insert(tmp.end(), tmp2.begin(), tmp2.end());
auto reader = PacketReader(move(tmp));
CreatureStatus res1{}, res2{};
// read tmp1 first
readDelta(reader, res1);
readDelta(reader, res2);
cout << "res1: ";
cout << res1.x << ", "
<< res1.z << ", "
<< res1.heading << ", "
<< static_cast<uint32_t>(res1.animframe) << ", "
<< static_cast<uint32_t>(res1.faction) << endl;
cout << "res2: " << res2.x << endl;
assert((abs(res1.x - status1.x) < TOL));
assert((abs(res1.z - status1.z) < TOL));
assert((abs(res1.heading - status1.heading) < TOL));
assert((res1.animframe == status1.animframe));
assert((res1.faction == status1.faction));
assert((abs(res2.x - status2.x) < TOL));
cout << "UnitTestSerialize Completed!" << endl;
}
int main()
{
UnitTestPacket(true);
UnitTestPacket(false);
UnitTestSerialize();
cout << "Hello CMake." << endl;
return 0;
}
| [
"[email protected]"
] | |
e1bc1c8ca16d5fa2fd2a0010bf6ec20bbac806c1 | 6f224b734744e38062a100c42d737b433292fb47 | /clang-tools-extra/clangd/unittests/tweaks/ObjCMemberwiseInitializerTests.cpp | 05235e01efad8b103bfd076dd5741acef1f817b2 | [
"NCSA",
"LLVM-exception",
"Apache-2.0"
] | permissive | smeenai/llvm-project | 1af036024dcc175c29c9bd2901358ad9b0e6610e | 764287f1ad69469cc264bb094e8fcdcfdd0fcdfb | refs/heads/main | 2023-09-01T04:26:38.516584 | 2023-08-29T21:11:41 | 2023-08-31T22:16:12 | 216,062,316 | 0 | 0 | Apache-2.0 | 2019-10-18T16:12:03 | 2019-10-18T16:12:03 | null | UTF-8 | C++ | false | false | 3,595 | cpp | //===-- ObjCMemberwiseInitializerTests.cpp ----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "TestTU.h"
#include "TweakTesting.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
namespace clang {
namespace clangd {
namespace {
TWEAK_TEST(ObjCMemberwiseInitializer);
TEST_F(ObjCMemberwiseInitializerTest, TestAvailability) {
FileName = "TestTU.m";
// Ensure the action can't be triggered since arc is disabled.
EXPECT_UNAVAILABLE(R"cpp(
@interface Fo^o
@end
)cpp");
ExtraArgs.push_back("-fobjc-runtime=macosx");
ExtraArgs.push_back("-fobjc-arc");
// Ensure the action can be initiated on the interface and implementation,
// but not on the forward declaration.
EXPECT_AVAILABLE(R"cpp(
@interface Fo^o
@end
)cpp");
EXPECT_AVAILABLE(R"cpp(
@interface Foo
@end
@implementation F^oo
@end
)cpp");
EXPECT_UNAVAILABLE("@class Fo^o;");
// Ensure that the action can be triggered on ivars and properties,
// including selecting both.
EXPECT_AVAILABLE(R"cpp(
@interface Foo {
id _fi^eld;
}
@end
)cpp");
EXPECT_AVAILABLE(R"cpp(
@interface Foo
@property(nonatomic) id fi^eld;
@end
)cpp");
EXPECT_AVAILABLE(R"cpp(
@interface Foo {
id _fi^eld;
}
@property(nonatomic) id pr^op;
@end
)cpp");
// Ensure that the action can't be triggered on property synthesis
// and methods.
EXPECT_UNAVAILABLE(R"cpp(
@interface Foo
@property(nonatomic) id prop;
@end
@implementation Foo
@dynamic pr^op;
@end
)cpp");
EXPECT_UNAVAILABLE(R"cpp(
@interface Foo
@end
@implementation Foo
- (void)fo^o {}
@end
)cpp");
}
TEST_F(ObjCMemberwiseInitializerTest, Test) {
FileName = "TestTU.m";
ExtraArgs.push_back("-fobjc-runtime=macosx");
ExtraArgs.push_back("-fobjc-arc");
const char *Input = R"cpp(
@interface Foo {
id [[_field;
}
@property(nonatomic) id prop]];
@property(nonatomic) id notSelected;
@end)cpp";
const char *Output = R"cpp(
@interface Foo {
id _field;
}
@property(nonatomic) id prop;
@property(nonatomic) id notSelected;
- (instancetype)initWithField:(id)field prop:(id)prop;
@end)cpp";
EXPECT_EQ(apply(Input), Output);
Input = R"cpp(
@interface Foo
@property(nonatomic, nullable) id somePrettyLongPropertyName;
@property(nonatomic, nonnull) id someReallyLongPropertyName;
@end
@implementation F^oo
- (instancetype)init {
return self;
}
@end)cpp";
Output = R"cpp(
@interface Foo
@property(nonatomic, nullable) id somePrettyLongPropertyName;
@property(nonatomic, nonnull) id someReallyLongPropertyName;
- (instancetype)initWithSomePrettyLongPropertyName:(nullable id)somePrettyLongPropertyName someReallyLongPropertyName:(nonnull id)someReallyLongPropertyName;
@end
@implementation Foo
- (instancetype)init {
return self;
}
- (instancetype)initWithSomePrettyLongPropertyName:(nullable id)somePrettyLongPropertyName someReallyLongPropertyName:(nonnull id)someReallyLongPropertyName {
self = [super init];
if (self) {
_somePrettyLongPropertyName = somePrettyLongPropertyName;
_someReallyLongPropertyName = someReallyLongPropertyName;
}
return self;
}
@end)cpp";
EXPECT_EQ(apply(Input), Output);
}
} // namespace
} // namespace clangd
} // namespace clang
| [
"[email protected]"
] | |
5b9adc6183cf12c2405f6e6291b72201f73775fc | edeb49ef323a013bb6c5612be20cdb0c3d5e6d52 | /main/main.cpp | 653efd98655be6b3d03d6a10f7a79bf39fd0fbd9 | [] | no_license | oi-chen/cpp_for_linux | cfe92539c9bfed08213e61b057fcae96c7c2b0ab | 9c99fb3d60b7f4751cba095f81bad1367e01522a | refs/heads/master | 2020-08-12T00:36:22.079591 | 2019-10-12T17:30:13 | 2019-10-12T17:30:13 | 214,657,611 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 97 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"hello world"<<endl;
return 0;
} | [
"[email protected]"
] | |
095d2c57883cbfd4aca69e789547540bb663dcab | 86fc3265cbce7091ae2484fc67d1c7e81841fc5a | /DS3640.cpp | 33677b7578535c093e2745e9f1aa012ed07758f9 | [] | no_license | TamperProof/DS3640 | 47a8ffd3068176a6b2e1af07c99091bdaa12eff4 | ecec1567b0e0bccadc6b9fe2ff0bb834998f0d65 | refs/heads/master | 2021-01-10T15:04:28.026312 | 2015-10-29T15:46:13 | 2015-10-29T15:46:13 | 45,192,278 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,816 | cpp | /*
* DS3640.h - library for DS3640 RTC
Copyright (c) Michael Margolis 2009
This library is intended to be uses with Arduino Time.h library functions
The 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 Dec 2009 - Initial release
5 Sep 2011 updated for Arduino 1.0
*/
#include <Wire.h>
#include "DS3640.h"
#define DS3640_CTRL_ID 0x50
DS3640::DS3640()
{
Wire.begin();
}
// PUBLIC FUNCTIONS
time_t DS3640::get() // Aquire data from buffer and convert to time_t
{
tmElements_t tm;
if (readtm(tm) == false) return 0;
return(makeTime(tm));
}
bool DS3640::set(time_t t)
{
tmElements_t tm;
breakTime(t, tm);
tm.Second |= 0x80; // stop the clock
writetm(tm);
tm.Second &= 0x7f; // start the clock
writetm(tm);
}
// Aquire data from the RTC chip in BCD format
bool DS3640::readtm(tmElements_t &tm)
{
uint8_t sec;
Wire.beginTransmission(DS3640_CTRL_ID);
#if ARDUINO >= 100
Wire.write((uint8_t)0x01);
#else
Wire.send(0x01);
#endif
if (Wire.endTransmission() != 0) {
exists = false;
return false;
}
exists = true;
// request the 7 data fields (secs, min, hr, dow, date, mth, yr)
Wire.requestFrom(DS3640_CTRL_ID, tmNbrFields);
if (Wire.available() < tmNbrFields) return false;
#if ARDUINO >= 100
sec = Wire.read();
tm.Second = bcd2dec(sec & 0x7f);
tm.Minute = bcd2dec(Wire.read() );
tm.Hour = bcd2dec(Wire.read() & 0x3f); // mask assumes 24hr clock
tm.Wday = bcd2dec(Wire.read() );
tm.Day = bcd2dec(Wire.read() );
tm.Month = bcd2dec(Wire.read() );
tm.Year = y2kYearToTm((bcd2dec(Wire.read())));
#else
sec = Wire.receive();
tm.Second = bcd2dec(sec & 0x7f);
tm.Minute = bcd2dec(Wire.receive() );
tm.Hour = bcd2dec(Wire.receive() & 0x3f); // mask assumes 24hr clock
tm.Wday = bcd2dec(Wire.receive() );
tm.Day = bcd2dec(Wire.receive() );
tm.Month = bcd2dec(Wire.receive() );
tm.Year = y2kYearToTm((bcd2dec(Wire.receive())));
#endif
if (sec & 0x80) return false; // clock is halted
return true;
}
bool DS3640::writetm(tmElements_t &tm)
{
Wire.beginTransmission(DS3640_CTRL_ID);
#if ARDUINO >= 100
Wire.write((uint8_t)0x01); // reset register pointer
Wire.write(dec2bcd(tm.Second)) ;
Wire.write(dec2bcd(tm.Minute));
Wire.write(dec2bcd(tm.Hour)); // sets 24 hour format
Wire.write(dec2bcd(tm.Wday));
Wire.write(dec2bcd(tm.Day));
Wire.write(dec2bcd(tm.Month));
Wire.write(dec2bcd(tmYearToY2k(tm.Year)));
#else
Wire.send(0x01); // reset register pointer
Wire.send(dec2bcd(tm.Second)) ;
Wire.send(dec2bcd(tm.Minute));
Wire.send(dec2bcd(tm.Hour)); // sets 24 hour format
Wire.send(dec2bcd(tm.Wday));
Wire.send(dec2bcd(tm.Day));
Wire.send(dec2bcd(tm.Month));
Wire.send(dec2bcd(tmYearToY2k(tm.Year)));
#endif
if (Wire.endTransmission() != 0) {
exists = false;
return false;
}
exists = true;
return true;
}
// request the 2 data fields used for temperature
void DS3640::temp()
{
byte temp[2];
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x26); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, 2);
for (i=0; i<2; i++) {
temp[i] = Wire.read();
Serial.print(temp[i], HEX);
}
}
// request HW generated random number
byte DS3640::RNG(byte *values, byte nBytes)
{
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x7f); // reset register pointer
Wire.send(0x00); // set to slot 0
Wire.endTransmission();
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x80); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, nBytes);
for (i=0; i<nBytes; i++) {
values[i] = Wire.read();
//Serial.println("read ");
Serial.print(values[i], HEX);
}
}
// read nBytes from DS3640 starting at register addr
byte DS3640::read(byte addr, byte *values, byte nBytes)
{
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(addr); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, nBytes);
for (i=0; i<nBytes; i++) {
values[i] = Wire.read();
//Serial.println("read ");
Serial.print(values[i], HEX);
}
return 0;
}
// read a single byte to DS3640 register addr
//byte DS3640::read(byte addr)
//{
// byte b;
// readRTC(addr, &b, 1);
// return b;
//}
// write nBytes to DS3640 starting at register addr
byte DS3640::write(byte addr, byte *values, byte nBytes)
{
//byte write[nBytes];
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(addr); // reset register pointer
for (i=0; i<nBytes; i++) {
Wire.send(values[i]);
//Serial.println("wrote ");
Serial.print(values[i], HEX);
}
return Wire.endTransmission();
}
// write a single byte to DS3640 register addr
//byte DS3640::writebyte(byte addr, byte value)
//{
// return ( write(addr, &value, 1) );
//}
// PRIVATE FUNCTIONS
// Convert Decimal to Binary Coded Decimal (BCD)
uint8_t DS3640::dec2bcd(uint8_t num)
{
return ((num/10 * 16) + (num % 10));
}
// Convert Binary Coded Decimal (BCD) to Decimal
uint8_t DS3640::bcd2dec(uint8_t num)
{
return ((num/16 * 10) + (num % 16));
}
bool DS3640::exists = false;
DS3640 RTC = DS3640(); // create an instance for the user
/*
* DS3640.h - library for DS3640 RTC
Copyright (c) Michael Margolis 2009
This library is intended to be uses with Arduino Time.h library functions
The 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 Dec 2009 - Initial release
5 Sep 2011 updated for Arduino 1.0
*/
#include <Wire.h>
#include "DS3640.h"
#define DS3640_CTRL_ID 0x50
DS3640::DS3640()
{
Wire.begin();
}
// PUBLIC FUNCTIONS
time_t DS3640::get() // Aquire data from buffer and convert to time_t
{
tmElements_t tm;
if (readtm(tm) == false) return 0;
return(makeTime(tm));
}
bool DS3640::set(time_t t)
{
tmElements_t tm;
breakTime(t, tm);
tm.Second |= 0x80; // stop the clock
writetm(tm);
tm.Second &= 0x7f; // start the clock
writetm(tm);
}
// Aquire data from the RTC chip in BCD format
bool DS3640::readtm(tmElements_t &tm)
{
uint8_t sec;
Wire.beginTransmission(DS3640_CTRL_ID);
#if ARDUINO >= 100
Wire.write((uint8_t)0x01);
#else
Wire.send(0x01);
#endif
if (Wire.endTransmission() != 0) {
exists = false;
return false;
}
exists = true;
// request the 7 data fields (secs, min, hr, dow, date, mth, yr)
Wire.requestFrom(DS3640_CTRL_ID, tmNbrFields);
if (Wire.available() < tmNbrFields) return false;
#if ARDUINO >= 100
sec = Wire.read();
tm.Second = bcd2dec(sec & 0x7f);
tm.Minute = bcd2dec(Wire.read() );
tm.Hour = bcd2dec(Wire.read() & 0x3f); // mask assumes 24hr clock
tm.Wday = bcd2dec(Wire.read() );
tm.Day = bcd2dec(Wire.read() );
tm.Month = bcd2dec(Wire.read() );
tm.Year = y2kYearToTm((bcd2dec(Wire.read())));
#else
sec = Wire.receive();
tm.Second = bcd2dec(sec & 0x7f);
tm.Minute = bcd2dec(Wire.receive() );
tm.Hour = bcd2dec(Wire.receive() & 0x3f); // mask assumes 24hr clock
tm.Wday = bcd2dec(Wire.receive() );
tm.Day = bcd2dec(Wire.receive() );
tm.Month = bcd2dec(Wire.receive() );
tm.Year = y2kYearToTm((bcd2dec(Wire.receive())));
#endif
if (sec & 0x80) return false; // clock is halted
return true;
}
bool DS3640::writetm(tmElements_t &tm)
{
Wire.beginTransmission(DS3640_CTRL_ID);
#if ARDUINO >= 100
Wire.write((uint8_t)0x01); // reset register pointer
Wire.write(dec2bcd(tm.Second)) ;
Wire.write(dec2bcd(tm.Minute));
Wire.write(dec2bcd(tm.Hour)); // sets 24 hour format
Wire.write(dec2bcd(tm.Wday));
Wire.write(dec2bcd(tm.Day));
Wire.write(dec2bcd(tm.Month));
Wire.write(dec2bcd(tmYearToY2k(tm.Year)));
#else
Wire.send(0x01); // reset register pointer
Wire.send(dec2bcd(tm.Second)) ;
Wire.send(dec2bcd(tm.Minute));
Wire.send(dec2bcd(tm.Hour)); // sets 24 hour format
Wire.send(dec2bcd(tm.Wday));
Wire.send(dec2bcd(tm.Day));
Wire.send(dec2bcd(tm.Month));
Wire.send(dec2bcd(tmYearToY2k(tm.Year)));
#endif
if (Wire.endTransmission() != 0) {
exists = false;
return false;
}
exists = true;
return true;
}
// request the 2 data fields used for temperature
void DS3640::temp()
{
byte temp[2];
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x26); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, 2);
for (i=0; i<2; i++) {
temp[i] = Wire.read();
Serial.print(temp[i], HEX);
}
}
// request HW generated random number
byte DS3640::RNG(byte *values, byte nBytes)
{
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x7f); // reset register pointer
Wire.send(0x00); // set to slot 0
Wire.endTransmission();
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(0x80); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, nBytes);
for (i=0; i<nBytes; i++) {
values[i] = Wire.read();
//Serial.println("read ");
Serial.print(values[i], HEX);
}
}
// read nBytes from DS3640 starting at register addr
byte DS3640::read(byte addr, byte *values, byte nBytes)
{
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(addr); // reset register pointer
Wire.endTransmission();
Wire.requestFrom(DS3640_CTRL_ID, nBytes);
for (i=0; i<nBytes; i++) {
values[i] = Wire.read();
//Serial.println("read ");
Serial.print(values[i], HEX);
}
return 0;
}
// read a single byte to DS3640 register addr
//byte DS3640::read(byte addr)
//{
// byte b;
// readRTC(addr, &b, 1);
// return b;
//}
// write nBytes to DS3640 starting at register addr
byte DS3640::write(byte addr, byte *values, byte nBytes)
{
//byte write[nBytes];
int i;
Wire.beginTransmission(DS3640_CTRL_ID);
Wire.send(addr); // reset register pointer
for (i=0; i<nBytes; i++) {
Wire.send(values[i]);
//Serial.println("wrote ");
Serial.print(values[i], HEX);
}
return Wire.endTransmission();
}
// write a single byte to DS3640 register addr
//byte DS3640::writebyte(byte addr, byte value)
//{
// return ( write(addr, &value, 1) );
//}
// PRIVATE FUNCTIONS
// Convert Decimal to Binary Coded Decimal (BCD)
uint8_t DS3640::dec2bcd(uint8_t num)
{
return ((num/10 * 16) + (num % 10));
}
// Convert Binary Coded Decimal (BCD) to Decimal
uint8_t DS3640::bcd2dec(uint8_t num)
{
return ((num/16 * 10) + (num % 16));
}
bool DS3640::exists = false;
DS3640 RTC = DS3640(); // create an instance for the user
| [
"[email protected]"
] | |
6747d2a5d7a18cebbd8bd5103d3ba368f1d11f2f | 8a0070c6be2c3c520aae10169f3f18009d1e6d3f | /class_wunderschoen/header.h | 1b2ec5b48afb144b153be5b5d38301421ddb2ba5 | [] | no_license | haidertom/Cpp-Playground | c9384cdcefef8896f3e248a4178120dbe6a7d552 | 758f4c4bd9e4c0574a9f47b253f2b0e79b0c1443 | refs/heads/master | 2020-03-29T14:04:15.588570 | 2018-09-23T15:47:22 | 2018-09-23T15:47:22 | 149,997,180 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,215 | h | //
// header.h
// class_wunderschoen
//
// Created by Tom Haider on 11.07.16.
// Copyright © 2016 Tom Haider. All rights reserved.
//
#ifndef header_h
#define header_h
#include <iostream>
#include <cstring>
using namespace std;
class Einzeldatum
{
private:
int Jahr;
int Tag;
string Monat;
string Ereignis;
Einzeldatum * next;
Einzeldatum * prev;
Einzeldatum * actu;
public:
Einzeldatum();
Einzeldatum(int j, int t, string monat, string ereignis);//Konstruktor für das erste Element
Einzeldatum(const Einzeldatum & E);
void durckeDatum();
void neuesDatum(Einzeldatum * newData);
void Ausgeben();
void AllesAusgeben();
};
class Kalender
{
private:
string name;
Einzeldatum * pFirst;
public:
Kalender();
Kalender(const Kalender & K);
Kalender(string n, ifstream & Eingabe);
void ersteAdresse();
void neuesEinzeldatum(int jahr, int tag,string monat, string ereignis);
void AllesAusgeben();
void operator += (const Kalender & K);
};
#endif /* header_h */
class Error
{
private:
int Jahr;
string Fehler;
public:
Error(string fehler);
void FehlerAusgabe();
};
| [
"[email protected]"
] | |
8fe3208d2095a3a10a3caac63c508a52dbe9e955 | 7742c07c6a2ddd31e1ffe1b228c5dfe9208b2a9b | /assignment-2/lib/EqualizeTransform.hpp | 986cd9aafc1dbb4dc1ecf024ff00ceb3fe448399 | [] | no_license | Izajur/image-processing-lab | 594dc2f59c0dc697aa93f5a341c40f11bc3602d9 | e0fc833af60fe3f49d4ae289443978757c3ca322 | refs/heads/main | 2023-02-25T05:15:27.194048 | 2021-02-01T12:17:14 | 2021-02-01T12:17:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 265 | hpp | #include<vector>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
class EqualizeTransform
{
private:
int maxIntensityVal;
vector<int> transformation;
public:
int transform(int);
int invTransform(int);
EqualizeTransform(Mat,int);
};
| [
"[email protected]"
] | |
ab948f49fb135a3f3b817a2b3495fd92ec9e25e8 | 2e0087af109ec1c34f33553371fdfe1257f875ce | /nms/nms_2020_0221.cpp | d0cbfa17217a2c22f93177abd4d45a50a6bbc0fe | [] | no_license | guicunbin/some_code | b6f0009e4ca42bfeceeebd1bb7ad0cec4f7a6c9e | 7e783c61afe4a08469579cf1ae795e074c20114f | refs/heads/master | 2021-06-11T04:25:30.765853 | 2020-08-04T10:14:25 | 2020-08-04T10:14:25 | 128,301,910 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,720 | cpp | // 按照置信度将所有的bbox升序排列(或者降序也行,只是后面的操作都相应改一下)作为一个set,然后:
// 选取set的最后一个bbox,并将该bbox加入pick集合
// 将set中该bbox之前的所有bbox与其计算overlap,将那些overlap大于指定threshold的bbox(包括该bbox自己)从set中删除,更新set
// 回到2,直到set中无元素。
// 返回pick集合,作为NMS之后得到的结果
#include<vector>
#include<assert.h>
#include<algorithm>
#include<utility>
#include"../utils/utils.hpp"
static bool my_comp(pair<vector<int>,float> a, pair<vector<int>,float> b){
return a.second < b.second;
}
static bool my_comp_for_cv(pair<cv::Rect,float> a, pair<cv::Rect, float> b){
return a.second < b.second;
}
vector<vector<int>> nms(vector<vector<int>> boxes_yxyx, vector<float>scores, float IOU_min){
// [y_top, x_left, y_down, x_right]
// scores_min != IOU_min
assert(boxes_yxyx.size() > 0 && boxes_yxyx.size() == scores.size());
assert(boxes_yxyx[0].size() == 4);
vector<pair<vector<int>, float>> bboxes_scores;
for(int i=0; i<boxes_yxyx.size(); i++){
bboxes_scores.push_back(make_pair(boxes_yxyx[i], scores[i]));
}
// 1.sort the boxes_yxyx by confidence_scores
sort(bboxes_scores.begin(), bboxes_scores.end(), my_comp);
for(int i=0; i<boxes_yxyx.size(); i++){
boxes_yxyx[i] = bboxes_scores[i].first;
}
vector<vector<int>> pickes;
while(!boxes_yxyx.empty()){
//cout<<"pickes.size() = "<<pickes.size()<<endl;
//2. push_back the last element to the pickes;
vector<int> pick = boxes_yxyx.back();
pickes.push_back(pick); boxes_yxyx.pop_back();
//3. compute the overlap and just remain the IOU < IOU_min boxes; and remain the sorting by scores
vector<vector<int>> next_boxes_yxyx;
for(auto bbox: boxes_yxyx){
float y1 = min(bbox[0], pick[0]);
float x1 = max(bbox[1], pick[1]);
float y2 = max(bbox[2], pick[2]);
float x2 = min(bbox[3], pick[3]);
// print_vec(bbox, "bbox = ");
float S_inter = (x2 - x1) * (y1 - y2);
//float S_outer = (bbox[3] - bbox[1])*(bbox[0] - bbox[2]) + (pick[3] - pick[1])*(pick[0] - pick[2]) + S_inter;
float S_outer = (bbox[3] - bbox[1])*(bbox[0] - bbox[2]) + (pick[3] - pick[1])*(pick[0] - pick[2]) - S_inter;
if(S_inter <=0 || S_inter / S_outer < IOU_min){
next_boxes_yxyx.push_back(bbox);
}
}
boxes_yxyx = next_boxes_yxyx;
}
return pickes;
}
vector<cv::Rect> nms_for_opencv(vector<cv::Rect> boxes_rec, vector<float>scores, float IOU_min){
assert(boxes_rec.size() > 0 && boxes_rec.size() == scores.size());
vector<pair<cv::Rect, float>> bboxes_scores;
for(int i=0; i<boxes_rec.size(); i++){
bboxes_scores.push_back(make_pair(boxes_rec[i], scores[i]));
}
// 1.sort the boxes_rec by confidence_scores
sort(bboxes_scores.begin(), bboxes_scores.end(), my_comp_for_cv);
for(int i=0; i<boxes_rec.size(); i++){
boxes_rec[i] = bboxes_scores[i].first;
}
vector<cv::Rect> pickes;
while(!boxes_rec.empty()){
//cout<<"pickes.size() = "<<pickes.size()<<endl;
//2. push_back the last element to the pickes;
cv::Rect pk = boxes_rec.back();
//x1_y1_x2_y2
vector<int> pick = {pk.x, pk.y, pk.x + pk.width, pk.y + pk.height };
pickes.push_back(pk); boxes_rec.pop_back();
//3. compute the overlap and just remain the IOU < IOU_min boxes; and remain the sorting by scores
vector<cv::Rect> next_boxes_rec;
for(auto bb: boxes_rec){
// x1_y1_x2_y2
vector<int> bbox = {bb.x, bb.y, bb.x + bb.width, bb.y + bb.height};
float x1 = max(bbox[0], pick[0]);
float y1 = max(bbox[1], pick[1]);
float x2 = min(bbox[2], pick[2]);
float y2 = min(bbox[3], pick[3]);
// print_vec(bbox, "bbox = ");
float S_inter = (x2 - x1) * (y2 - y1);
float S_outer = (bbox[3] - bbox[1])*(bbox[2] - bbox[0]) + (pick[3] - pick[1])*(pick[2] - pick[0]) - S_inter;
if(S_inter <=0 || 1.0* S_inter / S_outer < IOU_min){
next_boxes_rec.push_back(bb);
}
}
boxes_rec = next_boxes_rec;
}
return pickes;
}
int main(){
// y2_x1_y1_x2
vector<vector<int>> Faked_bboxes_yxyx = { {21, 10, 12, 12}, {25, 5, 3, 15}, {27, 5, 10, 15}, {20, 5, 1, 15},
{21, 15, 1, 30}, {26, 6, 6, 40}, {24, 7, 3, 35}, {30, 11, 0, 56}};
vector<cv::Rect> Faked_bboxes_Rect;
for(auto vf: Faked_bboxes_yxyx){
//cv::Rect rec(vf[1], vf[0], vf[3] - vf[1], vf[2] - vf[0]);
cv::Rect rec(vf[1], vf[2], abs(vf[3] - vf[1]), abs(vf[2] - vf[0]));
Faked_bboxes_Rect.push_back(rec);
}
vector<float> scores = {0.5, 0.3, 1, 0.8, 0.2, 0.14, 1, 0.99};
float IOU_min = 0.24;
vector<vector<int>> pickes = nms(Faked_bboxes_yxyx, scores, IOU_min);
vector<cv::Rect> pickes_rec = nms_for_opencv(Faked_bboxes_Rect, scores, IOU_min);
cout<<"bboxes = "<<endl;
for(auto vec: Faked_bboxes_yxyx){
print_vec(vec);
cout<<",";
}
print_vec(scores, "scores = ");
cout<<endl<<"pickes = "<<endl;
for (auto p: pickes){
print_vec(p);
}
cout<<endl<<"pickes_rec = "<<endl;
for (auto p: pickes_rec){
vector<int> pv = {p.y, p.x, p.y + p.height, p.x + p.width};
print_vec(pv);
}
}
| [
"[email protected]"
] | |
69b764227a36eaf8e2a52b699c68057f8171a0d2 | 3d55a6e42b656fff6b1e41148d195983e18d1aea | /Data Structure practice/stack/t infix to postfix.cpp | 42ea0b5e3118510910e1c8afbf5fdb176d789cd0 | [] | no_license | sunny2028/DS-IN-CPP | 9d5aacc645fa60055d73072f5b1f4109e42c1244 | 7f888d119531cc0e5a75a2601772c12c66c51ea8 | refs/heads/master | 2020-04-18T14:26:38.373085 | 2019-01-25T17:57:48 | 2019-01-25T17:57:48 | 167,588,839 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,280 | cpp | #include<iostream>//https://www.geeksforgeeks.org/stack-set-2-infix-to-postfix/
#include<cstring>//tie complexity:O(n) space complexity:O(1)
using namespace std;
struct mystack
{int capacity;
int top;
int *arr;
};
mystack *createstack(int x)
{mystack *newnode=new mystack;
newnode->top=-1;
newnode->capacity=x;
newnode->arr=new int[x];
return newnode;
}
bool isempty(mystack *s)
{
return (s->top==-1);
}
bool isoperand(char a)
{return (a>='a'&&a<='z')||(a>='A'&&a<='Z');
}
void push(mystack *s,char a)
{s->arr[++s->top]=a;
}
int pop(mystack *s)
{
return(s->arr[s->top--]);
}
int peek(mystack *s)
{
return(s->arr[s->top]);
}
int value(char ch)
{switch(ch)
{case '+':
case '-':return 1;
case '/':
case '*':return 2;
case '^':return 3;
}
return -1;
}
int infixtopostfix(char *a)
{mystack *s=createstack(strlen(a));
if(!s)
return -1;
int i,k;
for(i=0,k=-1;a[i];i++)
{if(isoperand(a[i]))
a[++k]=a[i];
else if(a[i]=='(')
push(s,a[i]);
else if(a[i]==')')
{while(!isempty(s)&&peek(s)!='(')
a[++k]=pop(s);
if(!isempty(s)&&peek(s)!='(')
return -1;
pop(s);
}
else
{while(!isempty(s)&&value(a[i])<=value(peek(s)))
a[++k]=pop(s);
push(s,a[i]);
}
}
while(!isempty(s))
a[++k]=pop(s);
a[++k]='\0';
cout<<a;
}
int main()
{char a[]="a+b*(c^d-e)^(f+g*h)-i";
infixtopostfix(a);
return 0;
}
| [
"[email protected]"
] | |
3a7d0661d24b14f190bd5eb754fa5e7f9a7d874d | 884bc546d05bbe141caf833a297896ba0b2dcb27 | /Source/AdventureEngineEditor/Private/WordGroupsFactory.h | 2819e20b9ef99d4fe1cb06e4db76160a1be2c667 | [] | no_license | dakitten2358/AdventureEnginePlugin | 675da0ac6c9df0a65a165542e17843b8302a8ac9 | 847e0f7bdc1d8d73de1bb3fc0c28df679181ca57 | refs/heads/master | 2020-03-25T01:11:14.297446 | 2018-08-02T01:28:53 | 2018-08-02T01:28:53 | 143,225,383 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 850 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Factories/Factory.h"
#include "EditorReimportHandler.h"
#include "WordGroupsFactory.generated.h"
/**
*
*/
UCLASS()
class ADVENTUREENGINEEDITOR_API UWordGroupsFactory : public UFactory, public FReimportHandler
{
GENERATED_UCLASS_BODY()
public:
virtual UObject* FactoryCreateText(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, const TCHAR* Type, const TCHAR*& Buffer, const TCHAR* BufferEnd, FFeedbackContext* Warn) override;
virtual bool CanReimport(UObject* Obj, TArray<FString>& OutFilenames) override;
virtual void SetReimportPaths(UObject* Obj, const TArray<FString>& NewReimportPaths) override;
virtual EReimportResult::Type Reimport(UObject* Obj) override;
};
| [
"[email protected]"
] | |
d727b38128baec32d7a061d0f1811fb7dd9533b6 | d2249116413e870d8bf6cd133ae135bc52021208 | /VC++jsnm code/ex32a/CntrItem.cpp | f48bed8de379846f11ce78923828ccc82b1943b8 | [] | no_license | Unknow-man/mfc-4 | ecbdd79cc1836767ab4b4ca72734bc4fe9f5a0b5 | b58abf9eb4c6d90ef01b9f1203b174471293dfba | refs/heads/master | 2023-02-17T18:22:09.276673 | 2021-01-20T07:46:14 | 2021-01-20T07:46:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,097 | cpp | // CntrItem.cpp : implementation of the CEx32aCntrItem class
//
#include "stdafx.h"
#include "ex32a.h"
#include "ex32aDoc.h"
#include "ex32aView.h"
#include "CntrItem.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx32aCntrItem implementation
IMPLEMENT_SERIAL(CEx32aCntrItem, CRichEditCntrItem, 0)
CEx32aCntrItem::CEx32aCntrItem(REOBJECT* preo, CEx32aDoc* pContainer)
: CRichEditCntrItem(preo, pContainer)
{
// TODO: add one-time construction code here
}
CEx32aCntrItem::~CEx32aCntrItem()
{
// TODO: add cleanup code here
}
/////////////////////////////////////////////////////////////////////////////
// CEx32aCntrItem diagnostics
#ifdef _DEBUG
void CEx32aCntrItem::AssertValid() const
{
CRichEditCntrItem::AssertValid();
}
void CEx32aCntrItem::Dump(CDumpContext& dc) const
{
CRichEditCntrItem::Dump(dc);
}
#endif
/////////////////////////////////////////////////////////////////////////////
| [
"[email protected]"
] | |
71438ddfb827c1b34f3a695b85dcf0b58b8b4900 | 3dae85df94e05bb1f3527bca0d7ad413352e49d0 | /ml/nn/runtime/test/generated/examples/lsh_projection_2_relaxed.example.cpp | ad0cd0d082318a8e0ee2feabdca45760750fdc22 | [
"Apache-2.0"
] | permissive | Wenzhao-Xiang/webml-wasm | e48f4cde4cb986eaf389edabe78aa32c2e267cb9 | 0019b062bce220096c248b1fced09b90129b19f9 | refs/heads/master | 2020-04-08T11:57:07.170110 | 2018-11-29T07:21:37 | 2018-11-29T07:21:37 | 159,327,152 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 693 | cpp | // clang-format off
// Generated file (from: lsh_projection_2_relaxed.mod.py). Do not edit
std::vector<MixedTypedExample> examples = {
// Begin of an example
{
.operands = {
//Input(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
{{1, {}}},
// int -> INT32 map
{{0, {12345, 54321, 67890, 9876, -12345678, -87654321}}},
// int -> QUANT8_ASYMM map
{},
// int -> QUANT16_ASYMM map
{}
},
//Output(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
{},
// int -> INT32 map
{{0, {1, 2, 2, 0}}},
// int -> QUANT8_ASYMM map
{},
// int -> QUANT16_ASYMM map
{}
}
},
}, // End of an example
};
| [
"[email protected]"
] | |
d69a269dd4a461b16890aa2034f2e24ad5b83bfd | a6b64925fdfa968e78b34f1f201aae56e882e18a | /Server/MainDll/common/ScreenManager.cpp | b3ec3c2e94f9670d72efe57ff464b1a9471a3027 | [] | no_license | nickwu1220/PCRemote | 5bfe9641da2497e7656018fc441cebcf4a784c49 | 6e326a72f3a0b3d61446abee359eb6ac1aa61720 | refs/heads/master | 2016-09-05T14:51:28.284403 | 2014-09-01T09:43:21 | 2014-09-01T09:43:21 | 18,865,903 | 1 | 1 | null | null | null | null | GB18030 | C++ | false | false | 9,790 | cpp | // ScreenManager.cpp: implementation of the CScreenManager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#define _WIN32_WINNT 0x0400
#include "ScreenManager.h"
#include "until.h"
//#include <winable.h> // BlockInput
#include <WinUser.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CScreenManager::CScreenManager(CClientSocket *pClient):CManager(pClient)
{
m_bAlgorithm = ALGORITHM_SCAN;
m_biBitCount = 8;
m_pScreenSpy = new CScreenSpy(8);
m_bIsWorking = true;
m_bIsBlankScreen = false;
m_bIsBlockInput = false;
m_bIsCaptureLayer = false;
m_hWorkThread = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL, true);
m_hBlankThread = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ControlThread, this, 0, NULL, true);
}
CScreenManager::~CScreenManager()
{
InterlockedExchange((LPLONG)&m_bIsBlankScreen, false);
InterlockedExchange((LPLONG)&m_bIsWorking, false);
WaitForSingleObject(m_hWorkThread, INFINITE);
WaitForSingleObject(m_hBlankThread, INFINITE);
CloseHandle(m_hWorkThread);
CloseHandle(m_hBlankThread);
if (m_pScreenSpy)
delete m_pScreenSpy;
}
void CScreenManager::ResetScreen(int biBitCount)
{
m_bIsWorking = false;
WaitForSingleObject(m_hWorkThread, INFINITE);
CloseHandle(m_hWorkThread);
delete m_pScreenSpy;
if (biBitCount == 3) // 4位灰度
m_pScreenSpy = new CScreenSpy(4, true);
else if (biBitCount == 7) // 8位灰度
m_pScreenSpy = new CScreenSpy(8, true);
else
m_pScreenSpy = new CScreenSpy(biBitCount);
m_pScreenSpy->setAlgorithm(m_bAlgorithm);
m_pScreenSpy->setCaptureLayer(m_bIsCaptureLayer);
m_biBitCount = biBitCount;
m_bIsWorking = true;
m_hWorkThread = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL, true);
}
void CScreenManager::OnReceive(LPBYTE lpBuffer, UINT nSize)
{
try
{
switch (lpBuffer[0])
{
case COMMAND_NEXT:
// 通知内核远程控制端对话框已打开,WaitForDialogOpen可以返回
NotifyDialogIsOpen();
break;
case COMMAND_SCREEN_RESET:
ResetScreen(*(LPBYTE)&lpBuffer[1]);
break;
case COMMAND_ALGORITHM_RESET:
m_bAlgorithm = *(LPBYTE)&lpBuffer[1];
m_pScreenSpy->setAlgorithm(m_bAlgorithm);
break;
case COMMAND_SCREEN_CTRL_ALT_DEL:
::SimulateCtrlAltDel();
break;
case COMMAND_SCREEN_CONTROL:
{
// 远程仍然可以操作
BlockInput(false);
ProcessCommand(lpBuffer + 1, nSize - 1);
BlockInput(m_bIsBlockInput);
}
break;
case COMMAND_SCREEN_BLOCK_INPUT: //ControlThread里锁定
m_bIsBlockInput = *(LPBYTE)&lpBuffer[1];
break;
case COMMAND_SCREEN_BLANK:
m_bIsBlankScreen = *(LPBYTE)&lpBuffer[1];
break;
case COMMAND_SCREEN_CAPTURE_LAYER:
m_bIsCaptureLayer = *(LPBYTE)&lpBuffer[1];
m_pScreenSpy->setCaptureLayer(m_bIsCaptureLayer);
break;
case COMMAND_SCREEN_GET_CLIPBOARD:
SendLocalClipboard();
break;
case COMMAND_SCREEN_SET_CLIPBOARD:
UpdateLocalClipboard((char *)lpBuffer + 1, nSize - 1);
break;
default:
break;
}
}catch(...){}
}
void CScreenManager::sendBITMAPINFO()
{
DWORD dwBytesLength = 1 + m_pScreenSpy->getBISize();
LPBYTE lpBuffer = (LPBYTE)VirtualAlloc(NULL, dwBytesLength, MEM_COMMIT, PAGE_READWRITE);
lpBuffer[0] = TOKEN_BITMAPINFO;
memcpy(lpBuffer + 1, m_pScreenSpy->getBI(), dwBytesLength - 1);
Send(lpBuffer, dwBytesLength);
VirtualFree(lpBuffer, 0, MEM_RELEASE);
}
void CScreenManager::sendFirstScreen()
{
BOOL bRet = false;
LPVOID lpFirstScreen = NULL;
lpFirstScreen = m_pScreenSpy->getFirstScreen();
if (lpFirstScreen == NULL)
return;
DWORD dwBytesLength = 1 + m_pScreenSpy->getFirstImageSize();
LPBYTE lpBuffer = new BYTE[dwBytesLength];
if (lpBuffer == NULL)
return;
lpBuffer[0] = TOKEN_FIRSTSCREEN;
memcpy(lpBuffer + 1, lpFirstScreen, dwBytesLength - 1);
Send(lpBuffer, dwBytesLength);
delete [] lpBuffer;
}
void CScreenManager::sendNextScreen()
{
LPVOID lpNetScreen = NULL;
DWORD dwBytes;
lpNetScreen = m_pScreenSpy->getNextScreen(&dwBytes);
if (dwBytes == 0 || !lpNetScreen)
return;
DWORD dwBytesLength = 1 + dwBytes;
LPBYTE lpBuffer = new BYTE[dwBytesLength];
if (!lpBuffer)
return;
lpBuffer[0] = TOKEN_NEXTSCREEN;
memcpy(lpBuffer + 1, (const char *)lpNetScreen, dwBytes);
Send(lpBuffer, dwBytesLength);
delete [] lpBuffer;
}
DWORD WINAPI CScreenManager::WorkThread(LPVOID lparam)
{
CScreenManager *pThis = (CScreenManager *)lparam;
pThis->sendBITMAPINFO();
// 等控制端对话框打开
pThis->WaitForDialogOpen();
pThis->sendFirstScreen();
try // 控制端强制关闭时会出错
{
while (pThis->m_bIsWorking)
pThis->sendNextScreen();
}catch(...){};
return 0;
}
// 创建这个线程主要是为了保持一直黑屏
DWORD WINAPI CScreenManager::ControlThread(LPVOID lparam)
{
static bool bIsScreenBlanked = false;
CScreenManager *pThis = (CScreenManager *)lparam;
while (pThis->IsConnect())
{
// 加快反应速度
for (int i = 0; i < 100; i++)
{
if (pThis->IsConnect())
{
// 分辨率大小改变了
if (pThis->IsMetricsChange())
pThis->ResetScreen(pThis->GetCurrentPixelBits());
Sleep(10);
}
else
break;
}
if (pThis->m_bIsBlankScreen)
{
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 1, NULL, 0);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);
bIsScreenBlanked = true;
}
else
{
if (bIsScreenBlanked)
{
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, NULL, 0);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)-1);
bIsScreenBlanked = false;
}
}
BlockInput(pThis->m_bIsBlockInput);
// 分辨率大小改变了
if (pThis->IsMetricsChange())
pThis->ResetScreen(pThis->GetCurrentPixelBits());
}
BlockInput(false);
return -1;
}
void CScreenManager::ProcessCommand( LPBYTE lpBuffer, UINT nSize )
{
// 数据包不合法
if (nSize % sizeof(MSG) != 0)
return;
SwitchInputDesktop();
// 命令个数
int nCount = nSize / sizeof(MSG);
// 处理多个命令
for (int i = 0; i < nCount; i++)
{
MSG *pMsg = (MSG *)(lpBuffer + i * sizeof(MSG));
switch (pMsg->message)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
{
POINT point;
point.x = LOWORD(pMsg->lParam);
point.y = HIWORD(pMsg->lParam);
SetCursorPos(point.x, point.y);
SetCapture(WindowFromPoint(point));
}
break;
default:
break;
}
switch(pMsg->message)
{
case WM_LBUTTONDOWN:
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
break;
case WM_LBUTTONUP:
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
break;
case WM_RBUTTONDOWN:
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
break;
case WM_RBUTTONUP:
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
break;
case WM_LBUTTONDBLCLK:
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
break;
case WM_RBUTTONDBLCLK:
mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
break;
case WM_MBUTTONDOWN:
mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0);
break;
case WM_MBUTTONUP:
mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0);
break;
case WM_MOUSEWHEEL:
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, GET_WHEEL_DELTA_WPARAM(pMsg->wParam), 0);
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
keybd_event(pMsg->wParam, MapVirtualKey(pMsg->wParam, 0), 0, 0);
break;
case WM_KEYUP:
case WM_SYSKEYUP:
keybd_event(pMsg->wParam, MapVirtualKey(pMsg->wParam, 0), KEYEVENTF_KEYUP, 0);
break;
default:
break;
}
}
}
void CScreenManager::UpdateLocalClipboard( char *buf, int len )
{
if (!::OpenClipboard(NULL))
return;
::EmptyClipboard();
HGLOBAL hglbCopy = GlobalAlloc(GMEM_DDESHARE, len);
if (hglbCopy != NULL) {
// Lock the handle and copy the text to the buffer.
LPTSTR lptstrCopy = (LPTSTR) GlobalLock(hglbCopy);
memcpy(lptstrCopy, buf, len);
GlobalUnlock(hglbCopy); // Place the handle on the clipboard.
SetClipboardData(CF_TEXT, hglbCopy);
GlobalFree(hglbCopy);
}
CloseClipboard();
}
void CScreenManager::SendLocalClipboard()
{
if (!::OpenClipboard(NULL))
return;
HGLOBAL hglb = GetClipboardData(CF_TEXT);
if (hglb == NULL)
{
::CloseClipboard();
return;
}
int nPacketLen = GlobalSize(hglb) + 1;
LPSTR lpstr = (LPSTR) GlobalLock(hglb);
LPBYTE lpData = new BYTE[nPacketLen];
lpData[0] = TOKEN_CLIPBOARD_TEXT;
memcpy(lpData + 1, lpstr, nPacketLen - 1);
::GlobalUnlock(hglb);
::CloseClipboard();
Send(lpData, nPacketLen);
delete[] lpData;
}
// 屏幕分辨率是否发生改变
bool CScreenManager::IsMetricsChange()
{
LPBITMAPINFO lpbmi = m_pScreenSpy->getBI();
return (lpbmi->bmiHeader.biWidth != ::GetSystemMetrics(SM_CXSCREEN)) ||
(lpbmi->bmiHeader.biHeight != ::GetSystemMetrics(SM_CYSCREEN));
}
bool CScreenManager::IsConnect()
{
return m_pClient->IsRunning();
}
int CScreenManager::GetCurrentPixelBits()
{
return m_biBitCount;
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.